Kstars

pwizfovconfig.cpp
1 /*
2  SPDX-FileCopyrightText: 2011 Rafał Kułaga <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #include "pwizfovconfig.h"
8 #include <KLocalizedString>
9 
11 {
12  setupUi(this);
13  setupWidgets();
14 
15  connect(addLegendBox, SIGNAL(toggled(bool)), this, SLOT(slotUpdateLegendFields(bool)));
16 }
17 
18 Legend::LEGEND_TYPE PWizFovConfigUI::getLegendType()
19 {
20  switch (typeCombo->currentIndex())
21  {
22  case 0: // Scale with magnitudes chart
23  {
24  return Legend::LT_SCALE_MAGNITUDES;
25  }
26 
27  case 1: // Only scale
28  {
29  return Legend::LT_SCALE_ONLY;
30  }
31 
32  case 2: // Only magnitudes chart
33  {
34  return Legend::LT_MAGNITUDES_ONLY;
35  }
36 
37  default:
38  {
39  return Legend::LT_FULL;
40  }
41  }
42 }
43 
44 void PWizFovConfigUI::slotUpdateLegendFields(bool enabled)
45 {
46  useAlphaBlendBox->setEnabled(enabled);
47  typeCombo->setEnabled(enabled);
48  orientationCombo->setEnabled(enabled);
49  positionCombo->setEnabled(enabled);
50 }
51 
52 void PWizFovConfigUI::setupWidgets()
53 {
55  types << i18n("Scale with magnitudes chart") << i18n("Only scale") << i18n("Only magnitudes chart");
56  typeCombo->addItems(types);
57 
58  orientationCombo->addItem(i18n("Horizontal"));
59  orientationCombo->addItem(i18n("Vertical"));
60 
61  QStringList positions;
62  positions << i18n("Upper left corner") << i18n("Upper right corner") << i18n("Lower left corner")
63  << i18n("Lower right corner");
64  positionCombo->addItems(positions);
65 
66  useAlphaBlendBox->setEnabled(false);
67  typeCombo->setEnabled(false);
68  orientationCombo->setEnabled(false);
69  positionCombo->setEnabled(false);
70 }
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QStringList types(Mode mode=Writing)
QString i18n(const char *text, const TYPE &arg...)
PWizFovConfigUI(QWidget *parent=nullptr)
Constructor.
Legend::LEGEND_TYPE getLegendType()
Get selected legend type.
void setupUi(QWidget *widget)
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Tue Aug 9 2022 04:06:05 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.