Kstars

dslrinfodialog.cpp
1/*
2 SPDX-FileCopyrightText: 2017 Jasem Mutlaq <mutlaqja@ikarustech.com>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "dslrinfodialog.h"
8
9#include <KLocalizedString>
10#include "ksnotification.h"
11
12#include "Options.h"
13
14DSLRInfo::DSLRInfo(QWidget *parent, ISD::Camera *ccd) : QDialog(parent)
15{
16#ifdef Q_OS_MACOS
17 setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint);
18#endif
19
20 setupUi(this);
21
22 currentCCD = ccd;
23
24 connect(buttonBox, SIGNAL(accepted()), this, SLOT(save()));
25
26 DSLRIcon->setPixmap(
27 QIcon::fromTheme("camera-photo").pixmap(48, 48));
28}
29
30void DSLRInfo::save()
31{
32 sensorMaxWidth = maxWidth->value();
33 sensorMaxHeight = maxHeight->value();
34 sensorPixelW = pixelX->value();
35 sensorPixelH = pixelY->value();
36
37 if (sensorMaxWidth == 0 || sensorMaxHeight == 0 || sensorPixelW == 0 || sensorPixelH == 0)
38 {
39 KSNotification::error(i18n("Invalid values. Please set all values."));
40 return;
41 }
42
43 ISD::CameraChip *primaryChip = currentCCD->getChip(ISD::CameraChip::PRIMARY_CCD);
44 primaryChip->setImageInfo(sensorMaxWidth, sensorMaxHeight, sensorPixelW, sensorPixelH, 8);
45 primaryChip->setFrame(0, 0, sensorMaxWidth, sensorMaxHeight);
46
47 currentCCD->setConfig(SAVE_CONFIG);
48
49 emit infoChanged();
50}
CameraChip class controls a particular chip in camera.
Camera class controls an INDI Camera device.
Definition indicamera.h:45
QString i18n(const char *text, const TYPE &arg...)
const QList< QKeySequence > & save()
QIcon fromTheme(const QString &name)
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 1 2024 18:54:15 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.