comparison src/settingsdialog.cpp @ 466:46ef2f03273c

Split out preferences into three separate tabs
author Chris Cannam
date Mon, 04 Jul 2011 14:12:10 +0100
parents b57d50114d8d
children 2d57b81671de
comparison
equal deleted inserted replaced
465:b57d50114d8d 466:46ef2f03273c
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 #include <QMessageBox>
29 #include <QTabWidget>
29 30
30 QString 31 QString
31 SettingsDialog::m_installPath; 32 SettingsDialog::m_installPath;
32 33
33 SettingsDialog::SettingsDialog(QWidget *parent) : 34 SettingsDialog::SettingsDialog(QWidget *parent) :
38 setWindowTitle(tr("Settings")); 39 setWindowTitle(tr("Settings"));
39 40
40 QGridLayout *mainLayout = new QGridLayout; 41 QGridLayout *mainLayout = new QGridLayout;
41 setLayout(mainLayout); 42 setLayout(mainLayout);
42 43
43 44 QTabWidget *tw = new QTabWidget;
44 45 mainLayout->addWidget(tw, 0, 0);
45 QGroupBox *meBox = new QGroupBox(tr("User details")); 46
46 mainLayout->addWidget(meBox, 0, 0); 47
48 // QGroupBox *meBox = new QGroupBox(tr("User details"));
49 // mainLayout->addWidget(meBox, 0, 0);
50
51 QWidget *meBox = new QWidget;
52 tw->addTab(meBox, tr("User details"));
53
47 QGridLayout *meLayout = new QGridLayout; 54 QGridLayout *meLayout = new QGridLayout;
48 meBox->setLayout(meLayout); 55 meBox->setLayout(meLayout);
49 56
50 int row = 0; 57 int row = 0;
51 58
57 meLayout->addWidget(new QLabel(tr("Email address:")), row, 0); 64 meLayout->addWidget(new QLabel(tr("Email address:")), row, 0);
58 65
59 m_emailEdit = new QLineEdit(); 66 m_emailEdit = new QLineEdit();
60 meLayout->addWidget(m_emailEdit, row++, 1); 67 meLayout->addWidget(m_emailEdit, row++, 1);
61 68
62 69 meLayout->setRowStretch(row, 20);
63 70
64 QGroupBox *lookBox = new QGroupBox(tr("Presentation")); 71
65 mainLayout->addWidget(lookBox, 1, 0); 72 // QGroupBox *lookBox = new QGroupBox(tr("Presentation"));
73 // mainLayout->addWidget(lookBox, 1, 0);
74
75 QWidget *lookBox = new QWidget;
76 tw->addTab(lookBox, tr("Presentation"));
77
66 QGridLayout *lookLayout = new QGridLayout; 78 QGridLayout *lookLayout = new QGridLayout;
67 lookBox->setLayout(lookLayout); 79 lookBox->setLayout(lookLayout);
68 80
69 row = 0; 81 row = 0;
70 82
87 m_dateFormat = new QComboBox(); 99 m_dateFormat = new QComboBox();
88 m_dateFormat->addItem(tr("Ages, for example \"5 weeks ago\"")); 100 m_dateFormat->addItem(tr("Ages, for example \"5 weeks ago\""));
89 m_dateFormat->addItem(tr("Dates, for example \"2010-06-23\"")); 101 m_dateFormat->addItem(tr("Dates, for example \"2010-06-23\""));
90 lookLayout->addWidget(m_dateFormat, row++, 1, Qt::AlignLeft); 102 lookLayout->addWidget(m_dateFormat, row++, 1, Qt::AlignLeft);
91 lookLayout->setColumnStretch(1, 20); 103 lookLayout->setColumnStretch(1, 20);
92 104
93 105 lookLayout->setRowStretch(row, 20);
94 QGroupBox *pathsBox = new QGroupBox(tr("System application locations")); 106
95 mainLayout->addWidget(pathsBox, 2, 0); 107
108 QWidget *pathsBox = new QWidget;
109 tw->addTab(pathsBox, tr("System application locations"));
110
111 // QGroupBox *pathsBox = new QGroupBox(tr("System application locations"));
112 // mainLayout->addWidget(pathsBox, 2, 0);
96 QGridLayout *pathsLayout = new QGridLayout; 113 QGridLayout *pathsLayout = new QGridLayout;
97 pathsBox->setLayout(pathsLayout); 114 pathsBox->setLayout(pathsLayout);
98 115
99 row = 0; 116 row = 0;
100 117
153 connect(browse, SIGNAL(clicked()), this, SLOT(extensionPathBrowse())); 170 connect(browse, SIGNAL(clicked()), this, SLOT(extensionPathBrowse()));
154 171
155 //!!! more info plz 172 //!!! more info plz
156 m_useExtension = new QCheckBox(tr("Use EasyHg Mercurial extension")); 173 m_useExtension = new QCheckBox(tr("Use EasyHg Mercurial extension"));
157 pathsLayout->addWidget(m_useExtension, row++, 2); 174 pathsLayout->addWidget(m_useExtension, row++, 2);
175
176 pathsLayout->setRowStretch(row, 20);
158 177
159 178
160 reset(); // loads current defaults from settings 179 reset(); // loads current defaults from settings
161 180
162 181
420 DEBUG << "SettingsDialog::clear" << endl; 439 DEBUG << "SettingsDialog::clear" << endl;
421 QSettings settings; 440 QSettings settings;
422 settings.beginGroup("Presentation"); 441 settings.beginGroup("Presentation");
423 settings.remove("showiconlabels"); 442 settings.remove("showiconlabels");
424 settings.remove("showhelpfultext"); 443 settings.remove("showhelpfultext");
444 settings.remove("dateformat");
425 settings.endGroup(); 445 settings.endGroup();
426 settings.beginGroup("Locations"); 446 settings.beginGroup("Locations");
427 settings.remove("hgbinary"); 447 settings.remove("hgbinary");
428 settings.remove("extdiffbinary"); 448 settings.remove("extdiffbinary");
429 settings.remove("mergebinary"); 449 settings.remove("mergebinary");