Mercurial > hg > easyhg
changeset 416:8df07172d6da ignore
Return ignore type from ignore dialog
author | Chris Cannam |
---|---|
date | Thu, 16 Jun 2011 14:53:06 +0100 |
parents | 6d7dad48b13c |
children | 4593555915cf |
files | src/hgignoredialog.cpp src/hgignoredialog.h src/mainwindow.cpp |
diffstat | 3 files changed, 32 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/hgignoredialog.cpp Thu Jun 16 14:32:35 2011 +0100 +++ b/src/hgignoredialog.cpp Thu Jun 16 14:53:06 2011 +0100 @@ -51,8 +51,12 @@ foreach (QString option, options) { QRadioButton *b = new QRadioButton(option); layout->addWidget(b, row++, 1); - b->setChecked(first); - first = false; + if (first) { + m_option = option; + b->setChecked(true); + first = false; + } + connect(b, SIGNAL(toggled(bool)), this, SLOT(optionToggled(bool))); } } @@ -67,6 +71,16 @@ connect(bbox, SIGNAL(rejected()), this, SLOT(reject())); } +void +HgIgnoreDialog::optionToggled(bool checked) +{ + QObject *s = sender(); + QRadioButton *rb = qobject_cast<QRadioButton *>(s); + if (rb && checked) { + m_option = rb->text(); + } +} + HgIgnoreDialog::IgnoreType HgIgnoreDialog::confirmIgnore(QWidget *parent, QStringList files, QStringList suffixes) @@ -104,9 +118,11 @@ options, tr("Ignore")); if (d.exec() == QDialog::Accepted) { - - //... - + QString option = d.getOption(); + DEBUG << "HgIgnoreDialog::confirmIgnore: option = " << option << endl; + if (option == options[0]) return IgnoreGivenFilesOnly; + else if (option == options[1]) return IgnoreAllFilesOfGivenNames; + else return IgnoreAllFilesOfGivenSuffixes; } } else { @@ -120,9 +136,10 @@ options, tr("Ignore")); if (d.exec() == QDialog::Accepted) { - - //... - + QString option = d.getOption(); + DEBUG << "HgIgnoreDialog::confirmIgnore: option = " << option << endl; + if (option == options[0]) return IgnoreGivenFilesOnly; + else return IgnoreAllFilesOfGivenNames; } }
--- a/src/hgignoredialog.h Thu Jun 16 14:32:35 2011 +0100 +++ b/src/hgignoredialog.h Thu Jun 16 14:53:06 2011 +0100 @@ -35,6 +35,9 @@ static IgnoreType confirmIgnore(QWidget *parent, QStringList files, QStringList suffixes); +private slots: + void optionToggled(bool); + private: HgIgnoreDialog(QWidget *parent, QString title, @@ -43,7 +46,9 @@ QStringList options, QString okButtonText); - + QString getOption() const { return m_option; } + + QString m_option; }; #endif