Commit 6ed0a5aee5f991f3a8c78f1ee5117fe9ea05d7f6

Authored by Denis Dovzhenko
Committed by David Gräff
1 parent 0ce9ae3a

Color config dialog change + minor bugfixes (#64)

1) Separate settings for screen & print channel/spectrum colors
2) eliminated warning ...helper.h:111:2: warning: extra ‘;’ [-Wpedantic]
3) eliminated warning ...control.cpp:724:26: warning: overflow in implicit constant conversion [-Woverflow]
4) min width for Config dialog Icons widget
5) wrong type cast removed
6) print spectrum magnitude only if spectrum is enabled
openhantek/src/configdialog.cpp
@@ -56,6 +56,7 @@ DsoConfigDialog::DsoConfigDialog(DsoSettings *settings, QWidget *parent, @@ -56,6 +56,7 @@ DsoConfigDialog::DsoConfigDialog(DsoSettings *settings, QWidget *parent,
56 QSize(CONFIG_LIST_WIDTH - 2 * this->contentsWidget->frameWidth(), 56 QSize(CONFIG_LIST_WIDTH - 2 * this->contentsWidget->frameWidth(),
57 CONFIG_LIST_ITEMHEIGHT)); 57 CONFIG_LIST_ITEMHEIGHT));
58 this->contentsWidget->setMaximumWidth(CONFIG_LIST_WIDTH); 58 this->contentsWidget->setMaximumWidth(CONFIG_LIST_WIDTH);
  59 + this->contentsWidget->setMinimumWidth(CONFIG_LIST_WIDTH);
59 this->contentsWidget->setMinimumHeight( 60 this->contentsWidget->setMinimumHeight(
60 CONFIG_LIST_ITEMHEIGHT * 3 + 2 * (this->contentsWidget->frameWidth())); 61 CONFIG_LIST_ITEMHEIGHT * 3 + 2 * (this->contentsWidget->frameWidth()));
61 62
openhantek/src/configpages.cpp
@@ -125,115 +125,161 @@ DsoConfigColorsPage::DsoConfigColorsPage(DsoSettings *settings, QWidget *parent) @@ -125,115 +125,161 @@ DsoConfigColorsPage::DsoConfigColorsPage(DsoSettings *settings, QWidget *parent)
125 this->settings = settings; 125 this->settings = settings;
126 126
127 // Initialize elements 127 // Initialize elements
128 - // Screen category 128 + DsoSettingsViewColor& colorSettings = this->settings->view.color;
  129 + enum {
  130 + COL_LABEL = 0,
  131 + COL_SCR_CHANNEL,
  132 + COL_SCR_SPECTRUM,
  133 + COL_PRT_CHANNEL,
  134 + COL_PRT_SPECTRUM
  135 + };
  136 +
  137 + // Plot Area
  138 + this->graphLabel = new QLabel(tr("<hr width=\"100%\"/>")); // 4*80
  139 + this->graphLabel->setAlignment(Qt::AlignRight);
  140 + this->graphLabel->setTextFormat(Qt::RichText);
  141 +
  142 + this->screenColorsLabel = new QLabel(tr("Screen"));
  143 + this->screenColorsLabel->setAlignment(Qt::AlignHCenter);
  144 + this->printColorsLabel = new QLabel(tr("Print"));
  145 + this->printColorsLabel->setAlignment(Qt::AlignHCenter);
  146 +
129 this->axesLabel = new QLabel(tr("Axes")); 147 this->axesLabel = new QLabel(tr("Axes"));
130 - this->axesColorBox = new ColorBox(this->settings->view.color.screen.axes); 148 + this->axesColorBox = new ColorBox(colorSettings.screen.axes);
  149 + this->printAxesColorBox = new ColorBox(colorSettings.print.axes);
  150 +
131 this->backgroundLabel = new QLabel(tr("Background")); 151 this->backgroundLabel = new QLabel(tr("Background"));
132 - this->backgroundColorBox =  
133 - new ColorBox(this->settings->view.color.screen.background); 152 + this->backgroundColorBox = new ColorBox(colorSettings.screen.background);
  153 + this->printBackgroundColorBox =
  154 + new ColorBox(colorSettings.print.background);
  155 +
134 this->borderLabel = new QLabel(tr("Border")); 156 this->borderLabel = new QLabel(tr("Border"));
135 - this->borderColorBox = new ColorBox(this->settings->view.color.screen.border); 157 + this->borderColorBox = new ColorBox(colorSettings.screen.border);
  158 + this->printBorderColorBox = new ColorBox(colorSettings.print.border);
  159 +
136 this->gridLabel = new QLabel(tr("Grid")); 160 this->gridLabel = new QLabel(tr("Grid"));
137 - this->gridColorBox = new ColorBox(this->settings->view.color.screen.grid);  
138 - this->markersLabel = new QLabel(tr("Markers"));  
139 - this->markersColorBox =  
140 - new ColorBox(this->settings->view.color.screen.markers);  
141 - this->textLabel = new QLabel(tr("Text"));  
142 - this->textColorBox = new ColorBox(this->settings->view.color.screen.text);  
143 -  
144 - this->screenLayout = new QGridLayout();  
145 - this->screenLayout->setColumnStretch(0, 1);  
146 - this->screenLayout->setColumnMinimumWidth(1, 80);  
147 - this->screenLayout->addWidget(this->backgroundLabel, 0, 0);  
148 - this->screenLayout->addWidget(this->backgroundColorBox, 0, 1);  
149 - this->screenLayout->addWidget(this->gridLabel, 1, 0);  
150 - this->screenLayout->addWidget(this->gridColorBox, 1, 1);  
151 - this->screenLayout->addWidget(this->axesLabel, 2, 0);  
152 - this->screenLayout->addWidget(this->axesColorBox, 2, 1);  
153 - this->screenLayout->addWidget(this->borderLabel, 3, 0);  
154 - this->screenLayout->addWidget(this->borderColorBox, 3, 1);  
155 - this->screenLayout->addWidget(this->markersLabel, 4, 0);  
156 - this->screenLayout->addWidget(this->markersColorBox, 4, 1);  
157 - this->screenLayout->addWidget(this->textLabel, 5, 0);  
158 - this->screenLayout->addWidget(this->textColorBox, 5, 1);  
159 -  
160 - this->screenGroup = new QGroupBox(tr("Screen"));  
161 - this->screenGroup->setLayout(this->screenLayout); 161 + this->gridColorBox = new ColorBox(colorSettings.screen.grid);
  162 + this->printGridColorBox = new ColorBox(colorSettings.print.grid);
162 163
163 - // Print category  
164 - this->printAxesLabel = new QLabel(tr("Axes"));  
165 - this->printAxesColorBox = new ColorBox(this->settings->view.color.print.axes);  
166 - this->printBackgroundLabel = new QLabel(tr("Background"));  
167 - this->printBackgroundColorBox =  
168 - new ColorBox(this->settings->view.color.print.background);  
169 - this->printBorderLabel = new QLabel(tr("Border"));  
170 - this->printBorderColorBox =  
171 - new ColorBox(this->settings->view.color.print.border);  
172 - this->printGridLabel = new QLabel(tr("Grid"));  
173 - this->printGridColorBox = new ColorBox(this->settings->view.color.print.grid);  
174 - this->printMarkersLabel = new QLabel(tr("Markers")); 164 + this->markersLabel = new QLabel(tr("Markers"));
  165 + this->markersColorBox = new ColorBox(colorSettings.screen.markers);
175 this->printMarkersColorBox = 166 this->printMarkersColorBox =
176 - new ColorBox(this->settings->view.color.print.markers);  
177 - this->printTextLabel = new QLabel(tr("Text"));  
178 - this->printTextColorBox = new ColorBox(this->settings->view.color.print.text);  
179 -  
180 - this->printLayout = new QGridLayout();  
181 - this->printLayout->setColumnStretch(0, 1);  
182 - this->printLayout->setColumnMinimumWidth(1, 80);  
183 - this->printLayout->addWidget(this->printBackgroundLabel, 0, 0);  
184 - this->printLayout->addWidget(this->printBackgroundColorBox, 0, 1);  
185 - this->printLayout->addWidget(this->printGridLabel, 1, 0);  
186 - this->printLayout->addWidget(this->printGridColorBox, 1, 1);  
187 - this->printLayout->addWidget(this->printAxesLabel, 2, 0);  
188 - this->printLayout->addWidget(this->printAxesColorBox, 2, 1);  
189 - this->printLayout->addWidget(this->printBorderLabel, 3, 0);  
190 - this->printLayout->addWidget(this->printBorderColorBox, 3, 1);  
191 - this->printLayout->addWidget(this->printMarkersLabel, 4, 0);  
192 - this->printLayout->addWidget(this->printMarkersColorBox, 4, 1);  
193 - this->printLayout->addWidget(this->printTextLabel, 5, 0);  
194 - this->printLayout->addWidget(this->printTextColorBox, 5, 1);  
195 -  
196 - this->printGroup = new QGroupBox(tr("Print"));  
197 - this->printGroup->setLayout(this->printLayout); 167 + new ColorBox(colorSettings.print.markers);
  168 +
  169 + this->textLabel = new QLabel(tr("Text"));
  170 + this->textColorBox = new ColorBox(colorSettings.screen.text);
  171 + this->printTextColorBox = new ColorBox(colorSettings.print.text);
198 172
199 // Graph category 173 // Graph category
200 - this->channelLabel = new QLabel(tr("Channel"));  
201 - this->channelLabel->setAlignment(Qt::AlignHCenter);  
202 - this->spectrumLabel = new QLabel(tr("Spectrum"));  
203 - this->spectrumLabel->setAlignment(Qt::AlignHCenter); 174 + this->screenChannelLabel = new QLabel(tr("Channel"));
  175 + this->screenChannelLabel->setAlignment(Qt::AlignHCenter);
  176 + this->screenSpectrumLabel = new QLabel(tr("Spectrum"));
  177 + this->screenSpectrumLabel->setAlignment(Qt::AlignHCenter);
  178 + this->printChannelLabel = new QLabel(tr("Channel"));
  179 + this->printChannelLabel->setAlignment(Qt::AlignHCenter);
  180 + this->printSpectrumLabel = new QLabel(tr("Spectrum"));
  181 + this->printSpectrumLabel->setAlignment(Qt::AlignHCenter);
  182 +
204 for (int channel = 0; channel < this->settings->scope.voltage.count(); 183 for (int channel = 0; channel < this->settings->scope.voltage.count();
205 ++channel) { 184 ++channel) {
206 this->colorLabel.append( 185 this->colorLabel.append(
207 new QLabel(this->settings->scope.voltage[channel].name)); 186 new QLabel(this->settings->scope.voltage[channel].name));
208 - this->channelColorBox.append(  
209 - new ColorBox(this->settings->view.color.screen.voltage[channel]));  
210 - this->spectrumColorBox.append(  
211 - new ColorBox(this->settings->view.color.screen.spectrum[channel])); 187 + this->screenChannelColorBox.append(
  188 + new ColorBox(colorSettings.screen.voltage[channel]));
  189 + this->screenSpectrumColorBox.append(
  190 + new ColorBox(colorSettings.screen.spectrum[channel]));
  191 + this->printChannelColorBox.append(
  192 + new ColorBox(colorSettings.print.voltage[channel]));
  193 + this->printSpectrumColorBox.append(
  194 + new ColorBox(colorSettings.print.spectrum[channel]));
212 } 195 }
213 196
214 - this->graphLayout = new QGridLayout();  
215 - this->graphLayout->setColumnStretch(0, 1);  
216 - this->graphLayout->setColumnMinimumWidth(1, 80);  
217 - this->graphLayout->setColumnMinimumWidth(2, 80);  
218 - this->graphLayout->addWidget(this->channelLabel, 0, 1);  
219 - this->graphLayout->addWidget(this->spectrumLabel, 0, 2); 197 + // Plot Area Layout
  198 + this->colorsLayout = new QGridLayout();
  199 + this->colorsLayout->setColumnStretch(COL_LABEL, 1);
  200 + this->colorsLayout->setColumnMinimumWidth(COL_SCR_CHANNEL, 80);
  201 + this->colorsLayout->setColumnMinimumWidth(COL_SCR_SPECTRUM, 80);
  202 + this->colorsLayout->setColumnMinimumWidth(COL_PRT_CHANNEL, 80);
  203 + this->colorsLayout->setColumnMinimumWidth(COL_PRT_SPECTRUM, 80);
  204 +
  205 + int row = 0;
  206 + this->colorsLayout->addWidget(this->screenColorsLabel, row,
  207 + COL_SCR_CHANNEL, 1, 2);
  208 + this->colorsLayout->addWidget(this->printColorsLabel, row,
  209 + COL_PRT_CHANNEL, 1, 2);
  210 + ++row;
  211 + this->colorsLayout->addWidget(this->backgroundLabel, row, COL_LABEL);
  212 + this->colorsLayout->addWidget(this->backgroundColorBox,
  213 + row, COL_SCR_CHANNEL, 1, 2);
  214 + this->colorsLayout->addWidget(this->printBackgroundColorBox,
  215 + row, COL_PRT_CHANNEL, 1, 2);
  216 + ++row;
  217 + this->colorsLayout->addWidget(this->gridLabel, row, COL_LABEL);
  218 + this->colorsLayout->addWidget(this->gridColorBox,
  219 + row, COL_SCR_CHANNEL, 1, 2);
  220 + this->colorsLayout->addWidget(this->printGridColorBox,
  221 + row, COL_PRT_CHANNEL, 1, 2);
  222 + ++row;
  223 + this->colorsLayout->addWidget(this->axesLabel, row, COL_LABEL);
  224 + this->colorsLayout->addWidget(this->axesColorBox,
  225 + row, COL_SCR_CHANNEL, 1, 2);
  226 + this->colorsLayout->addWidget(this->printAxesColorBox,
  227 + row, COL_PRT_CHANNEL, 1, 2);
  228 + ++row;
  229 + this->colorsLayout->addWidget(this->borderLabel, row, COL_LABEL);
  230 + this->colorsLayout->addWidget(this->borderColorBox,
  231 + row, COL_SCR_CHANNEL, 1, 2);
  232 + this->colorsLayout->addWidget(this->printBorderColorBox,
  233 + row, COL_PRT_CHANNEL, 1, 2);
  234 + ++row;
  235 + this->colorsLayout->addWidget(this->markersLabel, row, COL_LABEL);
  236 + this->colorsLayout->addWidget(this->markersColorBox,
  237 + row, COL_SCR_CHANNEL, 1, 2);
  238 + this->colorsLayout->addWidget(this->printMarkersColorBox,
  239 + row, COL_PRT_CHANNEL, 1, 2);
  240 + ++row;
  241 + this->colorsLayout->addWidget(this->textLabel, row, COL_LABEL);
  242 + this->colorsLayout->addWidget(this->textColorBox,
  243 + row, COL_SCR_CHANNEL, 1, 2);
  244 + this->colorsLayout->addWidget(this->printTextColorBox,
  245 + row, COL_PRT_CHANNEL, 1, 2);
  246 + ++row;
  247 +
  248 + // Graph
  249 + this->colorsLayout->addWidget(this->graphLabel, row, COL_LABEL, 1,
  250 + COL_PRT_SPECTRUM - COL_LABEL + 1);
  251 + ++row;
  252 +
  253 + this->colorsLayout->addWidget(this->screenChannelLabel, row,
  254 + COL_SCR_CHANNEL);
  255 + this->colorsLayout->addWidget(this->screenSpectrumLabel, row,
  256 + COL_SCR_SPECTRUM);
  257 + this->colorsLayout->addWidget(this->printChannelLabel, row,
  258 + COL_PRT_CHANNEL);
  259 + this->colorsLayout->addWidget(this->printSpectrumLabel, row,
  260 + COL_PRT_SPECTRUM);
  261 + ++row;
  262 +
220 for (int channel = 0; channel < this->settings->scope.voltage.count(); 263 for (int channel = 0; channel < this->settings->scope.voltage.count();
221 - ++channel) {  
222 - this->graphLayout->addWidget(this->colorLabel[channel], channel + 1, 0);  
223 - this->graphLayout->addWidget(this->channelColorBox[channel], channel + 1,  
224 - 1);  
225 - this->graphLayout->addWidget(this->spectrumColorBox[channel], channel + 1,  
226 - 2); 264 + ++channel, ++row) {
  265 + this->colorsLayout->addWidget(this->colorLabel[channel],
  266 + row, COL_LABEL);
  267 + this->colorsLayout->addWidget(this->screenChannelColorBox[channel],
  268 + row, COL_SCR_CHANNEL);
  269 + this->colorsLayout->addWidget(this->screenSpectrumColorBox[channel],
  270 + row, COL_SCR_SPECTRUM);
  271 + this->colorsLayout->addWidget(this->printChannelColorBox[channel],
  272 + row, COL_PRT_CHANNEL);
  273 + this->colorsLayout->addWidget(this->printSpectrumColorBox[channel],
  274 + row, COL_PRT_SPECTRUM);
227 } 275 }
228 276
229 - this->graphGroup = new QGroupBox(tr("Graph"));  
230 - this->graphGroup->setLayout(this->graphLayout); 277 + this->colorsGroup = new QGroupBox(tr("Screen and Print Colors"));
  278 + this->colorsGroup->setLayout(this->colorsLayout);
231 279
232 // Main layout 280 // Main layout
233 this->mainLayout = new QVBoxLayout(); 281 this->mainLayout = new QVBoxLayout();
234 - this->mainLayout->addWidget(this->screenGroup);  
235 - this->mainLayout->addWidget(this->printGroup);  
236 - this->mainLayout->addWidget(this->graphGroup); 282 + this->mainLayout->addWidget(this->colorsGroup);
237 this->mainLayout->addStretch(1); 283 this->mainLayout->addStretch(1);
238 284
239 this->setLayout(this->mainLayout); 285 this->setLayout(this->mainLayout);
@@ -244,33 +290,36 @@ DsoConfigColorsPage::~DsoConfigColorsPage() {} @@ -244,33 +290,36 @@ DsoConfigColorsPage::~DsoConfigColorsPage() {}
244 290
245 /// \brief Saves the new settings. 291 /// \brief Saves the new settings.
246 void DsoConfigColorsPage::saveSettings() { 292 void DsoConfigColorsPage::saveSettings() {
  293 +
  294 + DsoSettingsViewColor& colorSettings = this->settings->view.color;
  295 +
247 // Screen category 296 // Screen category
248 - this->settings->view.color.screen.axes = this->axesColorBox->getColor();  
249 - this->settings->view.color.screen.background =  
250 - this->backgroundColorBox->getColor();  
251 - this->settings->view.color.screen.border = this->borderColorBox->getColor();  
252 - this->settings->view.color.screen.grid = this->gridColorBox->getColor();  
253 - this->settings->view.color.screen.markers = this->markersColorBox->getColor();  
254 - this->settings->view.color.screen.text = this->textColorBox->getColor(); 297 + colorSettings.screen.axes = this->axesColorBox->getColor();
  298 + colorSettings.screen.background = this->backgroundColorBox->getColor();
  299 + colorSettings.screen.border = this->borderColorBox->getColor();
  300 + colorSettings.screen.grid = this->gridColorBox->getColor();
  301 + colorSettings.screen.markers = this->markersColorBox->getColor();
  302 + colorSettings.screen.text = this->textColorBox->getColor();
255 303
256 // Print category 304 // Print category
257 - this->settings->view.color.print.axes = this->printAxesColorBox->getColor();  
258 - this->settings->view.color.print.background =  
259 - this->printBackgroundColorBox->getColor();  
260 - this->settings->view.color.print.border =  
261 - this->printBorderColorBox->getColor();  
262 - this->settings->view.color.print.grid = this->printGridColorBox->getColor();  
263 - this->settings->view.color.print.markers =  
264 - this->printMarkersColorBox->getColor();  
265 - this->settings->view.color.print.text = this->printTextColorBox->getColor(); 305 + colorSettings.print.axes = this->printAxesColorBox->getColor();
  306 + colorSettings.print.background = this->printBackgroundColorBox->getColor();
  307 + colorSettings.print.border = this->printBorderColorBox->getColor();
  308 + colorSettings.print.grid = this->printGridColorBox->getColor();
  309 + colorSettings.print.markers = this->printMarkersColorBox->getColor();
  310 + colorSettings.print.text = this->printTextColorBox->getColor();
266 311
267 // Graph category 312 // Graph category
268 for (int channel = 0; channel < this->settings->scope.voltage.count(); 313 for (int channel = 0; channel < this->settings->scope.voltage.count();
269 ++channel) { 314 ++channel) {
270 - this->settings->view.color.screen.voltage[channel] =  
271 - this->channelColorBox[channel]->getColor();  
272 - this->settings->view.color.screen.spectrum[channel] =  
273 - this->spectrumColorBox[channel]->getColor(); 315 + colorSettings.screen.voltage[channel] =
  316 + this->screenChannelColorBox[channel]->getColor();
  317 + colorSettings.screen.spectrum[channel] =
  318 + this->screenSpectrumColorBox[channel]->getColor();
  319 + colorSettings.print.voltage[channel] =
  320 + this->printChannelColorBox[channel]->getColor();
  321 + colorSettings.print.spectrum[channel] =
  322 + this->printSpectrumColorBox[channel]->getColor();
274 } 323 }
275 } 324 }
276 325
@@ -284,16 +333,10 @@ DsoConfigFilesPage::DsoConfigFilesPage(DsoSettings *settings, QWidget *parent) @@ -284,16 +333,10 @@ DsoConfigFilesPage::DsoConfigFilesPage(DsoSettings *settings, QWidget *parent)
284 this->settings = settings; 333 this->settings = settings;
285 334
286 // Initialize elements 335 // Initialize elements
287 - this->saveOnExitCheckBox = new QCheckBox(tr("Save default settings on exit"));  
288 - this->saveOnExitCheckBox->setChecked(this->settings->options.alwaysSave);  
289 - this->saveNowButton = new QPushButton(tr("Save default settings now"));  
290 336
291 - this->configurationLayout = new QVBoxLayout();  
292 - this->configurationLayout->addWidget(this->saveOnExitCheckBox, 0);  
293 - this->configurationLayout->addWidget(this->saveNowButton, 1);  
294 -  
295 - this->configurationGroup = new QGroupBox(tr("Configuration"));  
296 - this->configurationGroup->setLayout(this->configurationLayout); 337 + // Export group
  338 + this->screenColorCheckBox = new QCheckBox(tr("Export Images with Screen Colors"));
  339 + this->screenColorCheckBox->setChecked(this->settings->view.screenColorImages);
297 340
298 this->imageWidthLabel = new QLabel(tr("Image width")); 341 this->imageWidthLabel = new QLabel(tr("Image width"));
299 this->imageWidthSpinBox = new QSpinBox(); 342 this->imageWidthSpinBox = new QSpinBox();
@@ -308,17 +351,31 @@ DsoConfigFilesPage::DsoConfigFilesPage(DsoSettings *settings, QWidget *parent) @@ -308,17 +351,31 @@ DsoConfigFilesPage::DsoConfigFilesPage(DsoSettings *settings, QWidget *parent)
308 this->settings->options.imageSize.height()); 351 this->settings->options.imageSize.height());
309 352
310 this->exportLayout = new QGridLayout(); 353 this->exportLayout = new QGridLayout();
311 - this->exportLayout->addWidget(this->imageWidthLabel, 0, 0);  
312 - this->exportLayout->addWidget(this->imageWidthSpinBox, 0, 1);  
313 - this->exportLayout->addWidget(this->imageHeightLabel, 1, 0);  
314 - this->exportLayout->addWidget(this->imageHeightSpinBox, 1, 1); 354 + this->exportLayout->addWidget(this->screenColorCheckBox, 0, 0, 1, 2);
  355 + this->exportLayout->addWidget(this->imageWidthLabel, 1, 0);
  356 + this->exportLayout->addWidget(this->imageWidthSpinBox, 1, 1);
  357 + this->exportLayout->addWidget(this->imageHeightLabel, 2, 0);
  358 + this->exportLayout->addWidget(this->imageHeightSpinBox, 2, 1);
315 359
316 this->exportGroup = new QGroupBox(tr("Export")); 360 this->exportGroup = new QGroupBox(tr("Export"));
317 this->exportGroup->setLayout(this->exportLayout); 361 this->exportGroup->setLayout(this->exportLayout);
318 362
  363 + // Configuration group
  364 + this->saveOnExitCheckBox = new QCheckBox(tr("Save default settings on exit"));
  365 + this->saveOnExitCheckBox->setChecked(this->settings->options.alwaysSave);
  366 + this->saveNowButton = new QPushButton(tr("Save default settings now"));
  367 +
  368 + this->configurationLayout = new QVBoxLayout();
  369 + this->configurationLayout->addWidget(this->saveOnExitCheckBox, 0);
  370 + this->configurationLayout->addWidget(this->saveNowButton, 1);
  371 +
  372 + this->configurationGroup = new QGroupBox(tr("Configuration"));
  373 + this->configurationGroup->setLayout(this->configurationLayout);
  374 +
  375 + // Main layout
319 this->mainLayout = new QVBoxLayout(); 376 this->mainLayout = new QVBoxLayout();
320 - this->mainLayout->addWidget(this->configurationGroup);  
321 this->mainLayout->addWidget(this->exportGroup); 377 this->mainLayout->addWidget(this->exportGroup);
  378 + this->mainLayout->addWidget(this->configurationGroup);
322 this->mainLayout->addStretch(1); 379 this->mainLayout->addStretch(1);
323 380
324 this->setLayout(this->mainLayout); 381 this->setLayout(this->mainLayout);
@@ -332,6 +389,7 @@ DsoConfigFilesPage::~DsoConfigFilesPage() {} @@ -332,6 +389,7 @@ DsoConfigFilesPage::~DsoConfigFilesPage() {}
332 /// \brief Saves the new settings. 389 /// \brief Saves the new settings.
333 void DsoConfigFilesPage::saveSettings() { 390 void DsoConfigFilesPage::saveSettings() {
334 this->settings->options.alwaysSave = this->saveOnExitCheckBox->isChecked(); 391 this->settings->options.alwaysSave = this->saveOnExitCheckBox->isChecked();
  392 + this->settings->view.screenColorImages = this->screenColorCheckBox->isChecked();
335 this->settings->options.imageSize.setWidth(this->imageWidthSpinBox->value()); 393 this->settings->options.imageSize.setWidth(this->imageWidthSpinBox->value());
336 this->settings->options.imageSize.setHeight( 394 this->settings->options.imageSize.setHeight(
337 this->imageHeightSpinBox->value()); 395 this->imageHeightSpinBox->value());
openhantek/src/configpages.h
@@ -92,26 +92,27 @@ private: @@ -92,26 +92,27 @@ private:
92 92
93 QVBoxLayout *mainLayout; 93 QVBoxLayout *mainLayout;
94 94
95 - QGroupBox *screenGroup;  
96 - QGridLayout *screenLayout; 95 + QGroupBox *colorsGroup;
  96 + QGridLayout *colorsLayout;
  97 +
  98 + QLabel *screenColorsLabel, *printColorsLabel;
97 QLabel *axesLabel, *backgroundLabel, *borderLabel, *gridLabel, *markersLabel, 99 QLabel *axesLabel, *backgroundLabel, *borderLabel, *gridLabel, *markersLabel,
98 *textLabel; 100 *textLabel;
99 ColorBox *axesColorBox, *backgroundColorBox, *borderColorBox, *gridColorBox, 101 ColorBox *axesColorBox, *backgroundColorBox, *borderColorBox, *gridColorBox,
100 *markersColorBox, *textColorBox; 102 *markersColorBox, *textColorBox;
101 103
102 - QGroupBox *printGroup;  
103 - QGridLayout *printLayout;  
104 - QLabel *printAxesLabel, *printBackgroundLabel, *printBorderLabel,  
105 - *printGridLabel, *printMarkersLabel, *printTextLabel;  
106 ColorBox *printAxesColorBox, *printBackgroundColorBox, *printBorderColorBox, 104 ColorBox *printAxesColorBox, *printBackgroundColorBox, *printBorderColorBox,
107 *printGridColorBox, *printMarkersColorBox, *printTextColorBox; 105 *printGridColorBox, *printMarkersColorBox, *printTextColorBox;
108 106
109 - QGroupBox *graphGroup;  
110 - QGridLayout *graphLayout;  
111 - QLabel *channelLabel, *spectrumLabel; 107 + QLabel *graphLabel;
  108 +
  109 + QLabel *screenChannelLabel, *screenSpectrumLabel, *printChannelLabel,
  110 + *printSpectrumLabel;
112 QList<QLabel *> colorLabel; 111 QList<QLabel *> colorLabel;
113 - QList<ColorBox *> channelColorBox;  
114 - QList<ColorBox *> spectrumColorBox; 112 + QList<ColorBox *> screenChannelColorBox;
  113 + QList<ColorBox *> screenSpectrumColorBox;
  114 + QList<ColorBox *> printChannelColorBox;
  115 + QList<ColorBox *> printSpectrumColorBox;
115 116
116 private slots: 117 private slots:
117 }; 118 };
@@ -141,6 +142,7 @@ private: @@ -141,6 +142,7 @@ private:
141 142
142 QGroupBox *exportGroup; 143 QGroupBox *exportGroup;
143 QGridLayout *exportLayout; 144 QGridLayout *exportLayout;
  145 + QCheckBox *screenColorCheckBox;
144 QLabel *imageWidthLabel; 146 QLabel *imageWidthLabel;
145 QSpinBox *imageWidthSpinBox; 147 QSpinBox *imageWidthSpinBox;
146 QLabel *imageHeightLabel; 148 QLabel *imageHeightLabel;
openhantek/src/exporter.cpp
@@ -206,14 +206,16 @@ bool Exporter::doExport() { @@ -206,14 +206,16 @@ bool Exporter::doExport() {
206 tr("/div"), 206 tr("/div"),
207 QTextOption(Qt::AlignRight)); 207 QTextOption(Qt::AlignRight));
208 // Print spectrum magnitude 208 // Print spectrum magnitude
209 - painter.setPen(colorValues->spectrum[channel]);  
210 - painter.drawText(QRectF(lineHeight * 6 + stretchBase * 2, top,  
211 - stretchBase * 2, lineHeight),  
212 - Helper::valueToString(  
213 - this->settings->scope.spectrum[channel].magnitude,  
214 - Helper::UNIT_DECIBEL, 0) +  
215 - tr("/div"),  
216 - QTextOption(Qt::AlignRight)); 209 + if (this->settings->scope.spectrum[channel].used) {
  210 + painter.setPen(colorValues->spectrum[channel]);
  211 + painter.drawText(QRectF(lineHeight * 6 + stretchBase * 2, top,
  212 + stretchBase * 2, lineHeight),
  213 + Helper::valueToString(
  214 + this->settings->scope.spectrum[channel].magnitude,
  215 + Helper::UNIT_DECIBEL, 0) +
  216 + tr("/div"),
  217 + QTextOption(Qt::AlignRight));
  218 + }
217 219
218 // Amplitude string representation (4 significant digits) 220 // Amplitude string representation (4 significant digits)
219 painter.setPen(colorValues->text); 221 painter.setPen(colorValues->text);
openhantek/src/hantek/control.cpp
@@ -721,7 +721,7 @@ unsigned int Control::updateSamplerate(unsigned int downsampler, @@ -721,7 +721,7 @@ unsigned int Control::updateSamplerate(unsigned int downsampler,
721 else { // Downsampling factors 3 and 4 are not supported 721 else { // Downsampling factors 3 and 4 are not supported
722 samplerateId = 3; 722 samplerateId = 3;
723 downsampler = 5; 723 downsampler = 5;
724 - downsamplerValue = 0xffff; 724 + downsamplerValue = (short int)0xffff;
725 } 725 }
726 } else { 726 } else {
727 // For any dividers above the downsampling factor can be set directly 727 // For any dividers above the downsampling factor can be set directly
openhantek/src/helper.h
@@ -108,6 +108,7 @@ template &lt;class T&gt; T DataArray&lt;T&gt;::operator[](unsigned int index) { @@ -108,6 +108,7 @@ template &lt;class T&gt; T DataArray&lt;T&gt;::operator[](unsigned int index) {
108 template <class T> unsigned int DataArray<T>::getSize() const { 108 template <class T> unsigned int DataArray<T>::getSize() const {
109 return this->size; 109 return this->size;
110 } 110 }
111 -}; 111 +
  112 +} // namespace Helper
112 113
113 #endif 114 #endif
openhantek/src/settings.cpp
@@ -413,8 +413,7 @@ int DsoSettings::load(const QString &amp;fileName) { @@ -413,8 +413,7 @@ int DsoSettings::load(const QString &amp;fileName) {
413 (Dso::InterpolationMode)settingsLoader->value("interpolation").toInt(); 413 (Dso::InterpolationMode)settingsLoader->value("interpolation").toInt();
414 if (settingsLoader->contains("screenColorImages")) 414 if (settingsLoader->contains("screenColorImages"))
415 this->view.screenColorImages = 415 this->view.screenColorImages =
416 - (Dso::InterpolationMode)settingsLoader->value("screenColorImages")  
417 - .toBool(); 416 + settingsLoader->value("screenColorImages").toBool();
418 if (settingsLoader->contains("zoom")) 417 if (settingsLoader->contains("zoom"))
419 this->view.zoom = 418 this->view.zoom =
420 (Dso::InterpolationMode)settingsLoader->value("zoom").toBool(); 419 (Dso::InterpolationMode)settingsLoader->value("zoom").toBool();