File indexing completed on 2024-05-12 11:44:08
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2014 Illya Kovalevskyy <illya.kovalevskyy@gmail.com> 0004 0005 #include "MeasureConfigDialog.h" 0006 #include <QPushButton> 0007 0008 namespace Marble { 0009 0010 MeasureConfigDialog::MeasureConfigDialog(QDialog *parent) : 0011 QDialog(parent), 0012 ui(new Ui::MeasureConfigDialog) 0013 { 0014 ui->setupUi(this); 0015 0016 QPushButton *apply = ui->m_buttonBox->button(QDialogButtonBox::Apply); 0017 connect(apply, SIGNAL(clicked()), this, SIGNAL(applied())); 0018 connect(ui->m_modeCombo, SIGNAL(currentIndexChanged(int)), 0019 this, SLOT(updateTabs())); 0020 connect(ui->m_modeCombo, SIGNAL(currentIndexChanged(int)), 0021 ui->tabWidget, SLOT(setCurrentIndex(int))); 0022 } 0023 0024 MeasureConfigDialog::~MeasureConfigDialog() 0025 { 0026 delete ui; 0027 } 0028 0029 bool MeasureConfigDialog::showBearingLabel() const 0030 { 0031 return ui->m_showBearingLabelsCheckBox->isChecked(); 0032 } 0033 0034 bool MeasureConfigDialog::showBearingLabelChange() const 0035 { 0036 return ui->m_showBearingLabelChangeCheckBox->isChecked(); 0037 } 0038 0039 bool MeasureConfigDialog::showDistanceLabels() const 0040 { 0041 return ui->m_showDistanceLabelsCheckBox->isChecked(); 0042 } 0043 0044 bool MeasureConfigDialog::showRadius() const 0045 { 0046 return ui->m_showRadiusLabelsCheckBox->isChecked(); 0047 } 0048 0049 bool MeasureConfigDialog::showPerimeter() const 0050 { 0051 return ui->m_showPerimeter->isChecked(); 0052 } 0053 0054 bool MeasureConfigDialog::showCircumference() const 0055 { 0056 return ui->m_showCircumference->isChecked(); 0057 } 0058 0059 bool MeasureConfigDialog::showPolygonArea() const 0060 { 0061 return ui->m_showPolygonAreaLabelChangeCheckBox->isChecked(); 0062 } 0063 0064 bool MeasureConfigDialog::showCircularArea() const 0065 { 0066 return ui->m_showCircleAreaLabelChangeCheckBox->isChecked(); 0067 } 0068 0069 MeasureToolPlugin::PaintMode MeasureConfigDialog::paintMode() const 0070 { 0071 return (MeasureToolPlugin::PaintMode)ui->m_modeCombo->currentIndex(); 0072 } 0073 0074 void MeasureConfigDialog::setShowBearingLabel(bool show) 0075 { 0076 ui->m_showBearingLabelsCheckBox->setChecked(show); 0077 } 0078 0079 void MeasureConfigDialog::setShowBearingLabelChange(bool show) 0080 { 0081 ui->m_showBearingLabelChangeCheckBox->setChecked(show); 0082 } 0083 0084 void MeasureConfigDialog::setShowDistanceLabels(bool show) 0085 { 0086 ui->m_showDistanceLabelsCheckBox->setChecked(show); 0087 } 0088 0089 void MeasureConfigDialog::setShowRadius(bool show) 0090 { 0091 ui->m_showRadiusLabelsCheckBox->setChecked(show); 0092 } 0093 0094 void MeasureConfigDialog::setShowPerimeter(bool show) 0095 { 0096 ui->m_showPerimeter->setChecked(show); 0097 } 0098 0099 void MeasureConfigDialog::setShowCircumference(bool show) 0100 { 0101 ui->m_showCircumference->setChecked(show); 0102 } 0103 0104 void MeasureConfigDialog::setShowPolygonArea(bool show) 0105 { 0106 ui->m_showPolygonAreaLabelChangeCheckBox->setChecked(show); 0107 } 0108 0109 void MeasureConfigDialog::setShowCircularArea(bool show) 0110 { 0111 ui->m_showCircleAreaLabelChangeCheckBox->setChecked(show); 0112 } 0113 0114 void MeasureConfigDialog::setPaintMode(MeasureToolPlugin::PaintMode mode) 0115 { 0116 ui->m_modeCombo->setCurrentIndex((int)mode); 0117 updateTabs(); 0118 } 0119 0120 void MeasureConfigDialog::updateTabs() 0121 { 0122 switch (paintMode()) { 0123 case MeasureToolPlugin::Polygon: 0124 ui->tabWidget->setTabEnabled(0, true); 0125 ui->tabWidget->setTabEnabled(1, false); 0126 break; 0127 case MeasureToolPlugin::Circular: 0128 ui->tabWidget->setTabEnabled(0, false); 0129 ui->tabWidget->setTabEnabled(1, true); 0130 break; 0131 } 0132 } 0133 0134 } // namespace Marble 0135 0136 #include "moc_MeasureConfigDialog.cpp"