Mercurial > hg > easyhg
comparison settingsdialog.cpp @ 230:e67bd8abc3e3
* Add settings for text verboseness and toolbar labels
author | Chris Cannam |
---|---|
date | Thu, 06 Jan 2011 15:15:02 +0000 |
parents | 34417b6e4345 |
children | 661f5808aa0a |
comparison
equal
deleted
inserted
replaced
229:a1f4b5359051 | 230:e67bd8abc3e3 |
---|---|
25 #include <QSettings> | 25 #include <QSettings> |
26 #include <QDir> | 26 #include <QDir> |
27 #include <QFileDialog> | 27 #include <QFileDialog> |
28 | 28 |
29 SettingsDialog::SettingsDialog(QWidget *parent) : | 29 SettingsDialog::SettingsDialog(QWidget *parent) : |
30 QDialog(parent) | 30 QDialog(parent), |
31 m_presentationChanged(false) | |
31 { | 32 { |
32 setModal(true); | 33 setModal(true); |
33 setWindowTitle(tr("Settings")); | 34 setWindowTitle(tr("Settings")); |
34 | 35 |
35 QSettings settings; | 36 QSettings settings; |
36 | 37 |
37 QGridLayout *mainLayout = new QGridLayout; | 38 QGridLayout *mainLayout = new QGridLayout; |
38 setLayout(mainLayout); | 39 setLayout(mainLayout); |
40 | |
41 | |
39 | 42 |
40 QGroupBox *meBox = new QGroupBox(tr("User details")); | 43 QGroupBox *meBox = new QGroupBox(tr("User details")); |
41 mainLayout->addWidget(meBox, 0, 0); | 44 mainLayout->addWidget(meBox, 0, 0); |
42 QGridLayout *meLayout = new QGridLayout; | 45 QGridLayout *meLayout = new QGridLayout; |
43 meBox->setLayout(meLayout); | 46 meBox->setLayout(meLayout); |
58 m_emailEdit->setText(settings.value("email").toString()); | 61 m_emailEdit->setText(settings.value("email").toString()); |
59 meLayout->addWidget(m_emailEdit, row++, 1); | 62 meLayout->addWidget(m_emailEdit, row++, 1); |
60 | 63 |
61 settings.endGroup(); | 64 settings.endGroup(); |
62 | 65 |
66 | |
67 | |
68 QGroupBox *lookBox = new QGroupBox(tr("Presentation")); | |
69 mainLayout->addWidget(lookBox, 1, 0); | |
70 QGridLayout *lookLayout = new QGridLayout; | |
71 lookBox->setLayout(lookLayout); | |
72 | |
73 settings.beginGroup("Presentation"); | |
74 | |
75 row = 0; | |
76 | |
77 m_showIconLabels = new QCheckBox(tr("Show labels on toolbar icons")); | |
78 m_showIconLabels->setChecked(settings.value("showiconlabels", true).toBool()); | |
79 lookLayout->addWidget(m_showIconLabels, row++, 0); | |
80 | |
81 m_showExtraText = new QCheckBox(tr("Show long descriptions for file status headings")); | |
82 m_showExtraText->setChecked(settings.value("showhelpfultext", true).toBool()); | |
83 lookLayout->addWidget(m_showExtraText, row++, 0); | |
84 | |
85 settings.endGroup(); | |
86 | |
87 | |
88 | |
63 QGroupBox *pathsBox = new QGroupBox(tr("System application locations")); | 89 QGroupBox *pathsBox = new QGroupBox(tr("System application locations")); |
64 mainLayout->addWidget(pathsBox, 1, 0); | 90 mainLayout->addWidget(pathsBox, 2, 0); |
65 QGridLayout *pathsLayout = new QGridLayout; | 91 QGridLayout *pathsLayout = new QGridLayout; |
66 pathsBox->setLayout(pathsLayout); | 92 pathsBox->setLayout(pathsLayout); |
67 | 93 |
68 settings.beginGroup("Locations"); | 94 settings.beginGroup("Locations"); |
69 | 95 |
133 pathsLayout->addWidget(m_useExtension, row++, 2); | 159 pathsLayout->addWidget(m_useExtension, row++, 2); |
134 | 160 |
135 settings.endGroup(); | 161 settings.endGroup(); |
136 | 162 |
137 | 163 |
164 | |
138 QDialogButtonBox *bbox = new QDialogButtonBox(QDialogButtonBox::Ok); | 165 QDialogButtonBox *bbox = new QDialogButtonBox(QDialogButtonBox::Ok); |
139 connect(bbox, SIGNAL(accepted()), this, SLOT(accept())); | 166 connect(bbox, SIGNAL(accepted()), this, SLOT(accept())); |
140 mainLayout->addWidget(bbox, 2, 0); | 167 mainLayout->addWidget(bbox, 3, 0); |
141 m_ok = bbox->button(QDialogButtonBox::Ok); | 168 m_ok = bbox->button(QDialogButtonBox::Ok); |
142 } | 169 } |
143 | 170 |
144 void | 171 void |
145 SettingsDialog::hgPathBrowse() | 172 SettingsDialog::hgPathBrowse() |
197 QSettings settings; | 224 QSettings settings; |
198 settings.beginGroup("User Information"); | 225 settings.beginGroup("User Information"); |
199 settings.setValue("name", m_nameEdit->text()); | 226 settings.setValue("name", m_nameEdit->text()); |
200 settings.setValue("email", m_emailEdit->text()); | 227 settings.setValue("email", m_emailEdit->text()); |
201 settings.endGroup(); | 228 settings.endGroup(); |
229 settings.beginGroup("Presentation"); | |
230 bool b; | |
231 b = m_showIconLabels->isChecked(); | |
232 if (b != settings.value("showiconlabels", true)) { | |
233 settings.setValue("showiconlabels", b); | |
234 m_presentationChanged = true; | |
235 } | |
236 b = m_showExtraText->isChecked(); | |
237 if (b != settings.value("showhelpfultext", true)) { | |
238 settings.setValue("showhelpfultext", b); | |
239 m_presentationChanged = true; | |
240 } | |
241 settings.endGroup(); | |
202 settings.beginGroup("Locations"); | 242 settings.beginGroup("Locations"); |
203 settings.setValue("hgbinary", m_hgPathLabel->text()); | 243 settings.setValue("hgbinary", m_hgPathLabel->text()); |
204 settings.setValue("extdiffbinary", m_diffPathLabel->text()); | 244 settings.setValue("extdiffbinary", m_diffPathLabel->text()); |
205 settings.setValue("mergebinary", m_mergePathLabel->text()); | 245 settings.setValue("mergebinary", m_mergePathLabel->text()); |
206 settings.setValue("editorbinary", m_editPathLabel->text()); | 246 settings.setValue("editorbinary", m_editPathLabel->text()); |