# HG changeset patch # User Chris Cannam # Date 1295973700 0 # Node ID cc95394e2392684217d6c19a12bd9bb56bf081a3 # Parent 256138a4ed0edcce60bab7e3b20b49a1132c8f33 * Add warning dialog for "restore default settings"; add option for dates or ages in history list diff -r 256138a4ed0e -r cc95394e2392 grapher.cpp --- a/grapher.cpp Tue Jan 25 16:12:23 2011 +0000 +++ b/grapher.cpp Tue Jan 25 16:41:40 2011 +0000 @@ -21,8 +21,18 @@ #include "debug.h" #include "changesetscene.h" +#include + #include +Grapher::Grapher(ChangesetScene *scene) : + m_scene(scene) +{ + QSettings settings; + settings.beginGroup("Presentation"); + m_showDates = (settings.value("dateformat", 0) == 1); +} + int Grapher::findAvailableColumn(int row, int parent, bool preferParentCol) { int col = parent; @@ -94,7 +104,12 @@ // above all nodes that have earlier dates (to the nearest day). // m_rowDates maps each row to a date: use that. - QString date = cs->age(); + QString date; + if (m_showDates) { + date = cs->date(); + } else { + date = cs->age(); + } while (m_rowDates.contains(row) && m_rowDates[row] != date) { --row; } diff -r 256138a4ed0e -r cc95394e2392 grapher.h --- a/grapher.h Tue Jan 25 16:12:23 2011 +0000 +++ b/grapher.h Tue Jan 25 16:41:40 2011 +0000 @@ -32,7 +32,7 @@ class Grapher { public: - Grapher(ChangesetScene *scene) { m_scene = scene; } + Grapher(ChangesetScene *scene); void layout(Changesets csets, QStringList uncommittedParents, @@ -79,6 +79,8 @@ typedef QMap RowDateMap; RowDateMap m_rowDates; + bool m_showDates; + QStringList m_uncommittedParents; int m_uncommittedParentRow; UncommittedItem *m_uncommitted; diff -r 256138a4ed0e -r cc95394e2392 mainwindow.cpp --- a/mainwindow.cpp Tue Jan 25 16:12:23 2011 +0000 +++ b/mainwindow.cpp Tue Jan 25 16:41:40 2011 +0000 @@ -1360,6 +1360,7 @@ if (settingsDlg->presentationChanged()) { hgTabs->updateFileStates(); updateToolBarStyle(); + hgRefresh(); } } @@ -1509,7 +1510,7 @@ void MainWindow::checkFilesystem() { DEBUG << "MainWindow::checkFilesystem" << endl; - hgStat(); + hgRefresh(); } void MainWindow::fsDirectoryChanged(QString d) diff -r 256138a4ed0e -r cc95394e2392 settingsdialog.cpp --- a/settingsdialog.cpp Tue Jan 25 16:12:23 2011 +0000 +++ b/settingsdialog.cpp Tue Jan 25 16:41:40 2011 +0000 @@ -25,6 +25,7 @@ #include #include #include +#include QString SettingsDialog::m_installPath; @@ -68,12 +69,27 @@ row = 0; m_showIconLabels = new QCheckBox(tr("Show labels on toolbar icons")); - lookLayout->addWidget(m_showIconLabels, row++, 0); + lookLayout->addWidget(m_showIconLabels, row++, 0, 1, 2); m_showExtraText = new QCheckBox(tr("Show long descriptions for file status headings")); - lookLayout->addWidget(m_showExtraText, row++, 0); + lookLayout->addWidget(m_showExtraText, row++, 0, 1, 2); + +#ifdef NOT_IMPLEMENTED_YET + lookLayout->addWidget(new QLabel(tr("Place the work and history views")), row, 0); + m_workHistoryArrangement = new QComboBox(); + m_workHistoryArrangement->addItem(tr("In separate tabs")); + m_workHistoryArrangement->addItem(tr("Side-by-side in a single pane")); + lookLayout->addWidget(m_workHistoryArrangement, row++, 1, Qt::AlignLeft); + lookLayout->setColumnStretch(1, 20); +#endif - + lookLayout->addWidget(new QLabel(tr("Label the history timeline with")), row, 0); + m_dateFormat = new QComboBox(); + m_dateFormat->addItem(tr("Ages, for example \"5 weeks ago\"")); + m_dateFormat->addItem(tr("Dates, for example \"2010-06-23\"")); + lookLayout->addWidget(m_dateFormat, row++, 1, Qt::AlignLeft); + lookLayout->setColumnStretch(1, 20); + QGroupBox *pathsBox = new QGroupBox(tr("System application locations")); mainLayout->addWidget(pathsBox, 2, 0); @@ -195,9 +211,15 @@ void SettingsDialog::restoreDefaults() { - clear(); - findDefaultLocations(); - reset(); + if (QMessageBox::question + (this, tr("Restore default settings?"), + tr("Restore default settings?

Are you sure you want to reset all settings to their default values?"), + QMessageBox::Ok | QMessageBox::Cancel, + QMessageBox::Cancel) == QMessageBox::Ok) { + clear(); + findDefaultLocations(); + reset(); + } } void @@ -379,6 +401,10 @@ settings.beginGroup("Presentation"); m_showIconLabels->setChecked(settings.value("showiconlabels", true).toBool()); m_showExtraText->setChecked(settings.value("showhelpfultext", true).toBool()); +#ifdef NOT_IMPLEMENTED_YET + m_workHistoryArrangement->setCurrentIndex(settings.value("workhistoryarrangement", 0).toInt()); +#endif + m_dateFormat->setCurrentIndex(settings.value("dateformat", 0).toInt()); settings.endGroup(); settings.beginGroup("Locations"); m_hgPathLabel->setText(settings.value("hgbinary").toString()); @@ -413,6 +439,19 @@ settings.setValue("showhelpfultext", b); m_presentationChanged = true; } + int i; +#ifdef NOT_IMPLEMENTED_YET + i = m_workHistoryArrangement->currentIndex(); + if (i != settings.value("workhistoryarrangement", 0)) { + settings.setValue("workhistoryarrangement", i); + m_presentationChanged = true; + } +#endif + i = m_dateFormat->currentIndex(); + if (i != settings.value("dateformat", 0)) { + settings.setValue("dateformat", i); + m_presentationChanged = true; + } settings.endGroup(); settings.beginGroup("Locations"); settings.setValue("hgbinary", m_hgPathLabel->text()); diff -r 256138a4ed0e -r cc95394e2392 settingsdialog.h --- a/settingsdialog.h Tue Jan 25 16:12:23 2011 +0000 +++ b/settingsdialog.h Tue Jan 25 16:41:40 2011 +0000 @@ -23,6 +23,7 @@ #include #include #include +#include class SettingsDialog : public QDialog { @@ -63,6 +64,10 @@ QCheckBox *m_showIconLabels; QCheckBox *m_showExtraText; + QComboBox *m_dateFormat; +#ifdef NOT_IMPLEMENTED_YET + QComboBox *m_workHistoryArrangement; +#endif QPushButton *m_ok;