Mercurial > hg > easyhg
comparison settingsdialog.cpp @ 273:cc95394e2392 easyhg_v0.3.2
* Add warning dialog for "restore default settings"; add option for dates or ages in history list
author | Chris Cannam |
---|---|
date | Tue, 25 Jan 2011 16:41:40 +0000 |
parents | 256138a4ed0e |
children |
comparison
equal
deleted
inserted
replaced
272:256138a4ed0e | 273:cc95394e2392 |
---|---|
23 #include <QGroupBox> | 23 #include <QGroupBox> |
24 #include <QDialogButtonBox> | 24 #include <QDialogButtonBox> |
25 #include <QSettings> | 25 #include <QSettings> |
26 #include <QDir> | 26 #include <QDir> |
27 #include <QFileDialog> | 27 #include <QFileDialog> |
28 #include <QMessageBox> | |
28 | 29 |
29 QString | 30 QString |
30 SettingsDialog::m_installPath; | 31 SettingsDialog::m_installPath; |
31 | 32 |
32 SettingsDialog::SettingsDialog(QWidget *parent) : | 33 SettingsDialog::SettingsDialog(QWidget *parent) : |
66 lookBox->setLayout(lookLayout); | 67 lookBox->setLayout(lookLayout); |
67 | 68 |
68 row = 0; | 69 row = 0; |
69 | 70 |
70 m_showIconLabels = new QCheckBox(tr("Show labels on toolbar icons")); | 71 m_showIconLabels = new QCheckBox(tr("Show labels on toolbar icons")); |
71 lookLayout->addWidget(m_showIconLabels, row++, 0); | 72 lookLayout->addWidget(m_showIconLabels, row++, 0, 1, 2); |
72 | 73 |
73 m_showExtraText = new QCheckBox(tr("Show long descriptions for file status headings")); | 74 m_showExtraText = new QCheckBox(tr("Show long descriptions for file status headings")); |
74 lookLayout->addWidget(m_showExtraText, row++, 0); | 75 lookLayout->addWidget(m_showExtraText, row++, 0, 1, 2); |
75 | 76 |
76 | 77 #ifdef NOT_IMPLEMENTED_YET |
78 lookLayout->addWidget(new QLabel(tr("Place the work and history views")), row, 0); | |
79 m_workHistoryArrangement = new QComboBox(); | |
80 m_workHistoryArrangement->addItem(tr("In separate tabs")); | |
81 m_workHistoryArrangement->addItem(tr("Side-by-side in a single pane")); | |
82 lookLayout->addWidget(m_workHistoryArrangement, row++, 1, Qt::AlignLeft); | |
83 lookLayout->setColumnStretch(1, 20); | |
84 #endif | |
85 | |
86 lookLayout->addWidget(new QLabel(tr("Label the history timeline with")), row, 0); | |
87 m_dateFormat = new QComboBox(); | |
88 m_dateFormat->addItem(tr("Ages, for example \"5 weeks ago\"")); | |
89 m_dateFormat->addItem(tr("Dates, for example \"2010-06-23\"")); | |
90 lookLayout->addWidget(m_dateFormat, row++, 1, Qt::AlignLeft); | |
91 lookLayout->setColumnStretch(1, 20); | |
92 | |
77 | 93 |
78 QGroupBox *pathsBox = new QGroupBox(tr("System application locations")); | 94 QGroupBox *pathsBox = new QGroupBox(tr("System application locations")); |
79 mainLayout->addWidget(pathsBox, 2, 0); | 95 mainLayout->addWidget(pathsBox, 2, 0); |
80 QGridLayout *pathsLayout = new QGridLayout; | 96 QGridLayout *pathsLayout = new QGridLayout; |
81 pathsBox->setLayout(pathsLayout); | 97 pathsBox->setLayout(pathsLayout); |
193 } | 209 } |
194 | 210 |
195 void | 211 void |
196 SettingsDialog::restoreDefaults() | 212 SettingsDialog::restoreDefaults() |
197 { | 213 { |
198 clear(); | 214 if (QMessageBox::question |
199 findDefaultLocations(); | 215 (this, tr("Restore default settings?"), |
200 reset(); | 216 tr("<qt><b>Restore default settings?</b><br><br>Are you sure you want to reset all settings to their default values?"), |
217 QMessageBox::Ok | QMessageBox::Cancel, | |
218 QMessageBox::Cancel) == QMessageBox::Ok) { | |
219 clear(); | |
220 findDefaultLocations(); | |
221 reset(); | |
222 } | |
201 } | 223 } |
202 | 224 |
203 void | 225 void |
204 SettingsDialog::findDefaultLocations(QString installPath) | 226 SettingsDialog::findDefaultLocations(QString installPath) |
205 { | 227 { |
377 m_emailEdit->setText(settings.value("email").toString()); | 399 m_emailEdit->setText(settings.value("email").toString()); |
378 settings.endGroup(); | 400 settings.endGroup(); |
379 settings.beginGroup("Presentation"); | 401 settings.beginGroup("Presentation"); |
380 m_showIconLabels->setChecked(settings.value("showiconlabels", true).toBool()); | 402 m_showIconLabels->setChecked(settings.value("showiconlabels", true).toBool()); |
381 m_showExtraText->setChecked(settings.value("showhelpfultext", true).toBool()); | 403 m_showExtraText->setChecked(settings.value("showhelpfultext", true).toBool()); |
404 #ifdef NOT_IMPLEMENTED_YET | |
405 m_workHistoryArrangement->setCurrentIndex(settings.value("workhistoryarrangement", 0).toInt()); | |
406 #endif | |
407 m_dateFormat->setCurrentIndex(settings.value("dateformat", 0).toInt()); | |
382 settings.endGroup(); | 408 settings.endGroup(); |
383 settings.beginGroup("Locations"); | 409 settings.beginGroup("Locations"); |
384 m_hgPathLabel->setText(settings.value("hgbinary").toString()); | 410 m_hgPathLabel->setText(settings.value("hgbinary").toString()); |
385 m_diffPathLabel->setText(settings.value("extdiffbinary").toString()); | 411 m_diffPathLabel->setText(settings.value("extdiffbinary").toString()); |
386 m_mergePathLabel->setText(settings.value("mergebinary").toString()); | 412 m_mergePathLabel->setText(settings.value("mergebinary").toString()); |
411 b = m_showExtraText->isChecked(); | 437 b = m_showExtraText->isChecked(); |
412 if (b != settings.value("showhelpfultext", true)) { | 438 if (b != settings.value("showhelpfultext", true)) { |
413 settings.setValue("showhelpfultext", b); | 439 settings.setValue("showhelpfultext", b); |
414 m_presentationChanged = true; | 440 m_presentationChanged = true; |
415 } | 441 } |
442 int i; | |
443 #ifdef NOT_IMPLEMENTED_YET | |
444 i = m_workHistoryArrangement->currentIndex(); | |
445 if (i != settings.value("workhistoryarrangement", 0)) { | |
446 settings.setValue("workhistoryarrangement", i); | |
447 m_presentationChanged = true; | |
448 } | |
449 #endif | |
450 i = m_dateFormat->currentIndex(); | |
451 if (i != settings.value("dateformat", 0)) { | |
452 settings.setValue("dateformat", i); | |
453 m_presentationChanged = true; | |
454 } | |
416 settings.endGroup(); | 455 settings.endGroup(); |
417 settings.beginGroup("Locations"); | 456 settings.beginGroup("Locations"); |
418 settings.setValue("hgbinary", m_hgPathLabel->text()); | 457 settings.setValue("hgbinary", m_hgPathLabel->text()); |
419 settings.setValue("extdiffbinary", m_diffPathLabel->text()); | 458 settings.setValue("extdiffbinary", m_diffPathLabel->text()); |
420 settings.setValue("mergebinary", m_mergePathLabel->text()); | 459 settings.setValue("mergebinary", m_mergePathLabel->text()); |