Kstars

dslrinfodialog.cpp
1 /*
2  SPDX-FileCopyrightText: 2017 Jasem Mutlaq <[email protected]>
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 
14 DSLRInfo::DSLRInfo(QWidget *parent, ISD::Camera *ccd) : QDialog(parent)
15 {
16 #ifdef Q_OS_OSX
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 
30 void 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 }
QIcon fromTheme(const QString &name)
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QString i18n(const char *text, const TYPE &arg...)
void setWindowFlags(Qt::WindowFlags type)
void setupUi(QWidget *widget)
QAction * save(const QObject *recvr, const char *slot, QObject *parent)
void accepted()
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri Aug 12 2022 04:00:53 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.