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