comparison src/settingsdialog.cpp @ 642:b16e8ef6919b

Back out commit:5dc24f8 and instead move the extensions setting to its own tab (allowing us to provide a bit more information about what it's for)
author Chris Cannam
date Fri, 19 Oct 2012 12:08:11 +0100
parents b29b9694cd0d
children ae67ea0af696
comparison
equal deleted inserted replaced
641:b29b9694cd0d 642:b16e8ef6919b
113 lookLayout->setColumnStretch(1, 10); 113 lookLayout->setColumnStretch(1, 10);
114 lookLayout->setRowStretch(row, 20); 114 lookLayout->setRowStretch(row, 20);
115 115
116 116
117 QWidget *pathsBox = new QWidget; 117 QWidget *pathsBox = new QWidget;
118 m_tabs->addTab(pathsBox, tr("System application locations")); 118 m_tabs->addTab(pathsBox, tr("System applications"));
119 119
120 // QGroupBox *pathsBox = new QGroupBox(tr("System application locations"));
121 // mainLayout->addWidget(pathsBox, 2, 0);
122 QGridLayout *pathsLayout = new QGridLayout; 120 QGridLayout *pathsLayout = new QGridLayout;
123 pathsBox->setLayout(pathsLayout); 121 pathsBox->setLayout(pathsLayout);
124 122
125 row = 0; 123 row = 0;
126 124
143 connect(browse, SIGNAL(clicked()), this, SLOT(diffPathBrowse())); 141 connect(browse, SIGNAL(clicked()), this, SLOT(diffPathBrowse()));
144 142
145 m_multipleDiffInstances = new QCheckBox(tr("Run multiple instances for multiple files")); 143 m_multipleDiffInstances = new QCheckBox(tr("Run multiple instances for multiple files"));
146 pathsLayout->addWidget(m_multipleDiffInstances, row++, 2); 144 pathsLayout->addWidget(m_multipleDiffInstances, row++, 2);
147 145
148 pathsLayout->addWidget(new QLabel(tr("External file-merge program:")), row, 0); 146 pathsLayout->addWidget(new QLabel(tr("External merge program:")), row, 0);
149 147
150 m_mergePathLabel = new QLineEdit(); 148 m_mergePathLabel = new QLineEdit();
151 pathsLayout->addWidget(m_mergePathLabel, row, 2); 149 pathsLayout->addWidget(m_mergePathLabel, row, 2);
152 150
153 browse = new QPushButton(tr("Browse...")); 151 browse = new QPushButton(tr("Browse..."));
161 159
162 browse = new QPushButton(tr("Browse...")); 160 browse = new QPushButton(tr("Browse..."));
163 pathsLayout->addWidget(browse, row++, 1); 161 pathsLayout->addWidget(browse, row++, 1);
164 connect(browse, SIGNAL(clicked()), this, SLOT(sshPathBrowse())); 162 connect(browse, SIGNAL(clicked()), this, SLOT(sshPathBrowse()));
165 163
166 //!!! more info plz 164
165 QWidget *extBox = new QWidget;
166 m_tabs->addTab(extBox, tr("Extensions"));
167
168 QGridLayout *extLayout = new QGridLayout;
169 extBox->setLayout(extLayout);
170
171 row = 0;
172
167 m_useExtension = new QCheckBox(tr("Use EasyHg Mercurial extension")); 173 m_useExtension = new QCheckBox(tr("Use EasyHg Mercurial extension"));
168 pathsLayout->addWidget(m_useExtension, row, 0); 174 extLayout->addWidget(m_useExtension, row++, 0, 1, 2);
169 connect(m_useExtension, SIGNAL(stateChanged(int)), this, SLOT(useExtension(int))); 175 extLayout->addWidget(new QLabel(tr("This extension may be required for password entry when using https\nprotocols. It also provides the \"remember password\" feature.")), row++, 0, 1, 3);
176
177 extLayout->addWidget(new QLabel(tr("Extension file path:")), row, 0);
170 178
171 m_extensionPathLabel = new QLineEdit(); 179 m_extensionPathLabel = new QLineEdit();
172 pathsLayout->addWidget(m_extensionPathLabel, row, 2); 180 extLayout->addWidget(m_extensionPathLabel, row, 2);
173 181
174 m_extensionBrowse = new QPushButton(tr("Browse...")); 182 browse = new QPushButton(tr("Browse..."));
175 pathsLayout->addWidget(m_extensionBrowse, row++, 1); 183 extLayout->addWidget(browse, row++, 1);
176 connect(m_extensionBrowse, SIGNAL(clicked()), this, SLOT(extensionPathBrowse())); 184 connect(browse, SIGNAL(clicked()), this, SLOT(extensionPathBrowse()));
177 185
178 pathsLayout->setRowStretch(row, 20); 186 extLayout->setRowStretch(row, 20);
179 pathsLayout->setColumnStretch(2, 20); 187 extLayout->setColumnStretch(2, 20);
180 188
181 189
182 reset(); // loads current defaults from settings 190 reset(); // loads current defaults from settings
183 191
184 192
195 { 203 {
196 switch (t) { 204 switch (t) {
197 case PersonalDetailsTab: m_tabs->setCurrentIndex(0); break; 205 case PersonalDetailsTab: m_tabs->setCurrentIndex(0); break;
198 case PresentationTab: m_tabs->setCurrentIndex(1); break; 206 case PresentationTab: m_tabs->setCurrentIndex(1); break;
199 case PathsTab: m_tabs->setCurrentIndex(2); break; 207 case PathsTab: m_tabs->setCurrentIndex(2); break;
208 case ExtensionsTab: m_tabs->setCurrentIndex(3); break;
200 } 209 }
201 } 210 }
202 211
203 void 212 void
204 SettingsDialog::hgPathBrowse() 213 SettingsDialog::hgPathBrowse()
225 } 234 }
226 235
227 void 236 void
228 SettingsDialog::extensionPathBrowse() 237 SettingsDialog::extensionPathBrowse()
229 { 238 {
230 browseFor(tr("EasyHg Mercurial extension"), m_extensionPathLabel); 239 browseFor(tr("EasyMercurial extension"), m_extensionPathLabel);
231 }
232
233 void
234 SettingsDialog::useExtension(int)
235 {
236 m_extensionPathLabel->setEnabled(m_useExtension->isChecked());
237 m_extensionBrowse->setEnabled(m_useExtension->isChecked());
238 } 240 }
239 241
240 void 242 void
241 SettingsDialog::browseFor(QString title, QLineEdit *edit) 243 SettingsDialog::browseFor(QString title, QLineEdit *edit)
242 { 244 {
462 m_sshPathLabel->setText(settings.value("sshbinary").toString()); 464 m_sshPathLabel->setText(settings.value("sshbinary").toString());
463 m_extensionPathLabel->setText(settings.value("extensionpath").toString()); 465 m_extensionPathLabel->setText(settings.value("extensionpath").toString());
464 settings.endGroup(); 466 settings.endGroup();
465 settings.beginGroup(""); 467 settings.beginGroup("");
466 m_useExtension->setChecked(settings.value("useextension", true).toBool()); 468 m_useExtension->setChecked(settings.value("useextension", true).toBool());
467 useExtension(m_useExtension->isChecked());
468 m_multipleDiffInstances->setChecked(settings.value("multipleDiffInstances", false).toBool()); 469 m_multipleDiffInstances->setChecked(settings.value("multipleDiffInstances", false).toBool());
469 settings.endGroup(); 470 settings.endGroup();
470 } 471 }
471 472
472 void 473 void