|
4 | 4 | #include "../simulation/crystalPopulation.h" |
5 | 5 |
|
6 | 6 | CrystalSettingsWidget::CrystalSettingsWidget(std::shared_ptr<HaloSim::CrystalPopulationRepository> crystalRepository, QWidget *parent) |
7 | | - : QGroupBox("Crystal settings", parent), |
| 7 | + : QGroupBox("Crystal population settings", parent), |
8 | 8 | mModel(new CrystalModel(crystalRepository)), |
9 | 9 | mNextPopulationId(1) |
10 | 10 | { |
@@ -66,7 +66,7 @@ CrystalSettingsWidget::CrystalSettingsWidget(std::shared_ptr<HaloSim::CrystalPop |
66 | 66 | updateRemovePopulationButtonState(); |
67 | 67 | }); |
68 | 68 |
|
69 | | - connect(mRemovePopulationButton, &QPushButton::clicked, [this]() { |
| 69 | + connect(mRemovePopulationButton, &QToolButton::clicked, [this]() { |
70 | 70 | int index = mMapper->currentIndex(); |
71 | 71 | if (index == 0) |
72 | 72 | mMapper->toNext(); |
@@ -112,73 +112,66 @@ void CrystalSettingsWidget::setupUi() |
112 | 112 | mPopulationComboBox->setDuplicatesEnabled(true); |
113 | 113 |
|
114 | 114 | mAddPopulationButton = new AddCrystalPopulationButton(); |
115 | | - mAddPopulationButton->setMinimumHeight(30); |
| 115 | + mAddPopulationButton->setIconSize(QSize(24, 24)); |
116 | 116 |
|
117 | | - mRemovePopulationButton = new QPushButton("Remove population"); |
118 | | - mRemovePopulationButton->setMinimumHeight(30); |
119 | | - mRemovePopulationButton->setStyleSheet("padding: 10px;"); |
| 117 | + mRemovePopulationButton = new QToolButton(); |
| 118 | + mRemovePopulationButton->setIcon(QIcon::fromTheme("list-remove")); |
| 119 | + mRemovePopulationButton->setIconSize(QSize(24, 24)); |
120 | 120 |
|
121 | 121 | mCaRatioSlider = new SliderSpinBox(0.0, 15.0); |
122 | 122 |
|
123 | 123 | mCaRatioStdSlider = new SliderSpinBox(0.0, 10.0); |
124 | 124 |
|
125 | 125 | mTiltDistributionComboBox = new QComboBox(); |
126 | | - mTiltDistributionComboBox->addItems({"Uniform", "Gaussian"}); |
| 126 | + mTiltDistributionComboBox->addItems({tr("Uniform"), tr("Gaussian")}); |
127 | 127 |
|
128 | | - mTiltAverageLabel = new QLabel("Average"); |
129 | | - mTiltAverageSlider = createAngleSlider(0.0, 180.0); |
| 128 | + mTiltAverageLabel = new QLabel(tr("Average")); |
| 129 | + mTiltAverageSlider = SliderSpinBox::createAngleSlider(0.0, 180.0); |
130 | 130 |
|
131 | | - mTiltStdLabel = new QLabel("Standard deviation"); |
132 | | - mTiltStdSlider = createAngleSlider(0.0, 360.0); |
| 131 | + mTiltStdLabel = new QLabel(tr("Standard deviation")); |
| 132 | + mTiltStdSlider = SliderSpinBox::createAngleSlider(0.0, 360.0); |
133 | 133 |
|
134 | 134 | mRotationDistributionComboBox = new QComboBox(); |
135 | | - mRotationDistributionComboBox->addItems({"Uniform", "Gaussian"}); |
| 135 | + mRotationDistributionComboBox->addItems({tr("Uniform"), tr("Gaussian")}); |
136 | 136 |
|
137 | | - mRotationAverageLabel = new QLabel("Average"); |
138 | | - mRotationAverageSlider = createAngleSlider(0.0, 180.0); |
| 137 | + mRotationAverageLabel = new QLabel(tr("Average")); |
| 138 | + mRotationAverageSlider = SliderSpinBox::createAngleSlider(0.0, 180.0); |
139 | 139 |
|
140 | | - mRotationStdLabel = new QLabel("Standard deviation"); |
141 | | - mRotationStdSlider = createAngleSlider(0.0, 360.0); |
| 140 | + mRotationStdLabel = new QLabel(tr("Standard deviation")); |
| 141 | + mRotationStdSlider = SliderSpinBox::createAngleSlider(0.0, 360.0); |
142 | 142 |
|
143 | 143 | mWeightSpinBox = new QSpinBox(); |
144 | 144 | mWeightSpinBox->setMinimum(0); |
145 | 145 | mWeightSpinBox->setMaximum(10000); |
146 | 146 |
|
147 | 147 | auto mainLayout = new QFormLayout(this); |
148 | | - mainLayout->addRow("Crystal population", mPopulationComboBox); |
149 | 148 |
|
150 | 149 | auto populationButtonLayout = new QHBoxLayout(); |
| 150 | + populationButtonLayout->addWidget(mPopulationComboBox); |
151 | 151 | populationButtonLayout->addWidget(mAddPopulationButton); |
152 | 152 | populationButtonLayout->addWidget(mRemovePopulationButton); |
153 | 153 |
|
154 | 154 | mainLayout->addRow(populationButtonLayout); |
155 | | - mainLayout->addRow("Population weight", mWeightSpinBox); |
| 155 | + mainLayout->addRow(tr("Population weight"), mWeightSpinBox); |
156 | 156 | mainLayout->addItem(new QSpacerItem(0, 10)); |
157 | | - mainLayout->addRow("C/A ratio average", mCaRatioSlider); |
158 | | - mainLayout->addRow("C/A ratio std.", mCaRatioStdSlider); |
| 157 | + mainLayout->addRow(tr("C/A ratio average"), mCaRatioSlider); |
| 158 | + mainLayout->addRow(tr("C/A ratio std."), mCaRatioStdSlider); |
159 | 159 |
|
160 | | - auto tiltGroupBox = new QGroupBox("C-axis tilt"); |
| 160 | + auto tiltGroupBox = new QGroupBox(tr("C-axis tilt")); |
161 | 161 | auto tiltLayout = new QFormLayout(tiltGroupBox); |
162 | 162 | mainLayout->addRow(tiltGroupBox); |
163 | | - tiltLayout->addRow("Distribution", mTiltDistributionComboBox); |
| 163 | + tiltLayout->addRow(tr("Distribution"), mTiltDistributionComboBox); |
164 | 164 | tiltLayout->addRow(mTiltAverageLabel, mTiltAverageSlider); |
165 | 165 | tiltLayout->addRow(mTiltStdLabel, mTiltStdSlider); |
166 | 166 |
|
167 | | - auto rotationGroupBox = new QGroupBox("Rotation around C-axis"); |
| 167 | + auto rotationGroupBox = new QGroupBox(tr("Rotation around C-axis")); |
168 | 168 | auto rotationLayout = new QFormLayout(rotationGroupBox); |
169 | 169 | mainLayout->addRow(rotationGroupBox); |
170 | | - rotationLayout->addRow("Distribution", mRotationDistributionComboBox); |
| 170 | + rotationLayout->addRow(tr("Distribution"), mRotationDistributionComboBox); |
171 | 171 | rotationLayout->addRow(mRotationAverageLabel, mRotationAverageSlider); |
172 | 172 | rotationLayout->addRow(mRotationStdLabel, mRotationStdSlider); |
173 | 173 | } |
174 | 174 |
|
175 | | -SliderSpinBox *CrystalSettingsWidget::createAngleSlider(double min, double max) |
176 | | -{ |
177 | | - auto slider = new SliderSpinBox(min, max); |
178 | | - slider->setSuffix("°"); |
179 | | - return slider; |
180 | | -} |
181 | | - |
182 | 175 | void CrystalSettingsWidget::setTiltVisibility(bool visible) |
183 | 176 | { |
184 | 177 | mTiltAverageSlider->setVisible(visible); |
|
0 commit comments