comparison main/PreferencesDialog.cpp @ 225:d7ded015af32

* Make font size in panes configurable, with a smaller default * Add [ and ] to select prev/next pane
author Chris Cannam
date Tue, 11 Dec 2007 14:58:29 +0000
parents 98ba77e0d897
children e3ff897a60bf
comparison
equal deleted inserted replaced
224:b5a2428f647b 225:d7ded015af32
28 #include <QMessageBox> 28 #include <QMessageBox>
29 #include <QTabWidget> 29 #include <QTabWidget>
30 #include <QLineEdit> 30 #include <QLineEdit>
31 #include <QFileDialog> 31 #include <QFileDialog>
32 #include <QMessageBox> 32 #include <QMessageBox>
33 #include <QSpinBox>
33 34
34 #include "widgets/WindowTypeSelector.h" 35 #include "widgets/WindowTypeSelector.h"
35 #include "widgets/IconLoader.h" 36 #include "widgets/IconLoader.h"
36 #include "base/Preferences.h" 37 #include "base/Preferences.h"
37 38
154 bgMode->setCurrentIndex(bg); 155 bgMode->setCurrentIndex(bg);
155 156
156 connect(bgMode, SIGNAL(currentIndexChanged(int)), 157 connect(bgMode, SIGNAL(currentIndexChanged(int)),
157 this, SLOT(backgroundModeChanged(int))); 158 this, SLOT(backgroundModeChanged(int)));
158 159
160 QSpinBox *fontSize = new QSpinBox;
161 int fs = prefs->getPropertyRangeAndValue("View Font Size", &min, &max,
162 &deflt);
163 fontSize->setMinimum(min);
164 fontSize->setMaximum(max);
165 fontSize->setSuffix(" pt");
166 fontSize->setSingleStep(1);
167 fontSize->setValue(fs);
168
169 connect(fontSize, SIGNAL(valueChanged(int)),
170 this, SLOT(viewFontSizeChanged(int)));
171
159 // General tab 172 // General tab
160 173
161 QFrame *frame = new QFrame; 174 QFrame *frame = new QFrame;
162 175
163 QGridLayout *subgrid = new QGridLayout; 176 QGridLayout *subgrid = new QGridLayout;
172 185
173 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel 186 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel
174 ("Background Mode"))), 187 ("Background Mode"))),
175 row, 0); 188 row, 0);
176 subgrid->addWidget(bgMode, row++, 1, 1, 2); 189 subgrid->addWidget(bgMode, row++, 1, 1, 2);
190
191 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel
192 ("View Font Size"))),
193 row, 0);
194 subgrid->addWidget(fontSize, row++, 1, 1, 2);
177 195
178 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel 196 subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel
179 ("Resample On Load"))), 197 ("Resample On Load"))),
180 row, 0); 198 row, 0);
181 subgrid->addWidget(resampleOnLoad, row++, 1, 1, 1); 199 subgrid->addWidget(resampleOnLoad, row++, 1, 1, 1);
310 PreferencesDialog::backgroundModeChanged(int mode) 328 PreferencesDialog::backgroundModeChanged(int mode)
311 { 329 {
312 m_backgroundMode = mode; 330 m_backgroundMode = mode;
313 m_applyButton->setEnabled(true); 331 m_applyButton->setEnabled(true);
314 m_changesOnRestart = true; 332 m_changesOnRestart = true;
333 }
334
335 void
336 PreferencesDialog::viewFontSizeChanged(int sz)
337 {
338 m_viewFontSize = sz;
339 m_applyButton->setEnabled(true);
315 } 340 }
316 341
317 void 342 void
318 PreferencesDialog::okClicked() 343 PreferencesDialog::okClicked()
319 { 344 {
333 prefs->setTuningFrequency(m_tuningFrequency); 358 prefs->setTuningFrequency(m_tuningFrequency);
334 prefs->setResampleQuality(m_resampleQuality); 359 prefs->setResampleQuality(m_resampleQuality);
335 prefs->setResampleOnLoad(m_resampleOnLoad); 360 prefs->setResampleOnLoad(m_resampleOnLoad);
336 prefs->setTemporaryDirectoryRoot(m_tempDirRoot); 361 prefs->setTemporaryDirectoryRoot(m_tempDirRoot);
337 prefs->setBackgroundMode(Preferences::BackgroundMode(m_backgroundMode)); 362 prefs->setBackgroundMode(Preferences::BackgroundMode(m_backgroundMode));
363 prefs->setViewFontSize(m_viewFontSize);
338 364
339 m_applyButton->setEnabled(false); 365 m_applyButton->setEnabled(false);
340 366
341 if (m_changesOnRestart) { 367 if (m_changesOnRestart) {
342 QMessageBox::information(this, tr("Preferences"), 368 QMessageBox::information(this, tr("Preferences"),