Mercurial > hg > easyhg
changeset 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 | 24820581e532 1244dc3107cb 28ffb19d231f |
files | grapher.cpp grapher.h mainwindow.cpp settingsdialog.cpp settingsdialog.h |
diffstat | 5 files changed, 71 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- 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 <QSettings> + #include <iostream> +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; }
--- 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<int, QString> RowDateMap; RowDateMap m_rowDates; + bool m_showDates; + QStringList m_uncommittedParents; int m_uncommittedParentRow; UncommittedItem *m_uncommitted;
--- 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)
--- 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 <QSettings> #include <QDir> #include <QFileDialog> +#include <QMessageBox> 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("<qt><b>Restore default settings?</b><br><br>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());
--- 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 <QLabel> #include <QPushButton> #include <QCheckBox> +#include <QComboBox> 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;