Mercurial > hg > easyhg
changeset 513:ddc7238fc3b0
Add "Show closed branches" toggle to history widget, when some closed branches exist in the repo
author | Chris Cannam |
---|---|
date | Tue, 18 Oct 2011 12:49:39 +0100 |
parents | 67d18eaca830 |
children | 306a62fe851e |
files | src/historywidget.cpp src/historywidget.h |
diffstat | 2 files changed, 33 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/historywidget.cpp Tue Oct 18 11:49:40 2011 +0100 +++ b/src/historywidget.cpp Tue Oct 18 12:49:39 2011 +0100 @@ -27,6 +27,7 @@ #include <iostream> #include <QGridLayout> +#include <QSettings> HistoryWidget::HistoryWidget() : m_showUncommitted(false), @@ -39,12 +40,28 @@ m_panned->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); m_panned->setCacheMode(QGraphicsView::CacheNone); + int row = 0; + QGridLayout *layout = new QGridLayout; - layout->addWidget(m_panned, 0, 0); - layout->addWidget(m_panner, 0, 1); + layout->setMargin(10); + layout->addWidget(m_panned, row, 0); + layout->addWidget(m_panner, row, 1); m_panner->setMaximumWidth(80); m_panner->connectToPanned(m_panned); + layout->setRowStretch(row, 20); + + QSettings settings; + settings.beginGroup("Presentation"); + bool showClosed = (settings.value("showclosedbranches", false).toBool()); + + m_showClosedBranches = new QCheckBox(tr("Show closed branches"), this); + m_showClosedBranches->setChecked(showClosed); + connect(m_showClosedBranches, SIGNAL(toggled(bool)), + this, SLOT(showClosedChanged(bool))); + layout->addWidget(m_showClosedBranches, ++row, 0, Qt::AlignLeft); + m_showClosedBranches->hide(); + setLayout(layout); } @@ -91,6 +108,7 @@ { if (closed == m_closedIds) return; m_closedIds = closed; + m_showClosedBranches->setVisible(!closed.empty()); m_refreshNeeded = true; } @@ -98,6 +116,14 @@ { setCurrent(m_currentIds, m_currentBranch, showUncommitted); } + +void HistoryWidget::showClosedChanged(bool show) +{ + QSettings settings; + settings.beginGroup("Presentation"); + settings.setValue("showclosedbranches", show); + layoutAll(); +} void HistoryWidget::parseNewLog(QString log) {
--- a/src/historywidget.h Tue Oct 18 11:49:40 2011 +0100 +++ b/src/historywidget.h Tue Oct 18 12:49:39 2011 +0100 @@ -22,6 +22,7 @@ #include <QWidget> #include <QSet> +#include <QCheckBox> class Panned; class Panner; @@ -64,6 +65,9 @@ void mergeFrom(QString id); void newBranch(QString id); void tag(QString id); + +private slots: + void showClosedChanged(bool); private: Changesets m_changesets; @@ -76,6 +80,7 @@ Panned *m_panned; Panner *m_panner; + QCheckBox *m_showClosedBranches; QGraphicsScene *scene(); void clearChangesets();