File indexing completed on 2024-04-14 14:11:16

0001 /*
0002     SPDX-FileCopyrightText: 2011 Rafał Kułaga <rl.kulaga@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "pwizfovconfig.h"
0008 #include <KLocalizedString>
0009 
0010 PWizFovConfigUI::PWizFovConfigUI(QWidget *parent) : QFrame(parent)
0011 {
0012     setupUi(this);
0013     setupWidgets();
0014 
0015     connect(addLegendBox, SIGNAL(toggled(bool)), this, SLOT(slotUpdateLegendFields(bool)));
0016 }
0017 
0018 Legend::LEGEND_TYPE PWizFovConfigUI::getLegendType()
0019 {
0020     switch (typeCombo->currentIndex())
0021     {
0022         case 0: // Scale with magnitudes chart
0023         {
0024             return Legend::LT_SCALE_MAGNITUDES;
0025         }
0026 
0027         case 1: // Only scale
0028         {
0029             return Legend::LT_SCALE_ONLY;
0030         }
0031 
0032         case 2: // Only magnitudes chart
0033         {
0034             return Legend::LT_MAGNITUDES_ONLY;
0035         }
0036 
0037         default:
0038         {
0039             return Legend::LT_FULL;
0040         }
0041     }
0042 }
0043 
0044 void PWizFovConfigUI::slotUpdateLegendFields(bool enabled)
0045 {
0046     useAlphaBlendBox->setEnabled(enabled);
0047     typeCombo->setEnabled(enabled);
0048     orientationCombo->setEnabled(enabled);
0049     positionCombo->setEnabled(enabled);
0050 }
0051 
0052 void PWizFovConfigUI::setupWidgets()
0053 {
0054     QStringList types;
0055     types << i18n("Scale with magnitudes chart") << i18n("Only scale") << i18n("Only magnitudes chart");
0056     typeCombo->addItems(types);
0057 
0058     orientationCombo->addItem(i18n("Horizontal"));
0059     orientationCombo->addItem(i18n("Vertical"));
0060 
0061     QStringList positions;
0062     positions << i18n("Upper left corner") << i18n("Upper right corner") << i18n("Lower left corner")
0063               << i18n("Lower right corner");
0064     positionCombo->addItems(positions);
0065 
0066     useAlphaBlendBox->setEnabled(false);
0067     typeCombo->setEnabled(false);
0068     orientationCombo->setEnabled(false);
0069     positionCombo->setEnabled(false);
0070 }