[PATCH 2 of 2] (Issue 27) Change Quit button text depending on changes or no changes
Wald Commits
scm-commit at wald.intevation.org
Tue Jul 1 16:44:13 CEST 2014
# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1404225838 -7200
# Node ID 0fc1a20adaff00728eab1f1be9587b03ef8d0e36
# Parent 3791a277f00b9fe1a8fe3ad4dc839133edc238c9
(Issue 27) Change Quit button text depending on changes or no changes.
diff -r 3791a277f00b -r 0fc1a20adaff ui/mainwindow.cpp
--- a/ui/mainwindow.cpp Tue Jul 01 16:39:28 2014 +0200
+++ b/ui/mainwindow.cpp Tue Jul 01 16:43:58 2014 +0200
@@ -549,8 +549,8 @@
QPushButton *searchUpdates = new QPushButton(tr("Check for updates"));
searchUpdates->setIcon(QIcon(":/img/edit-find.png"));
- QPushButton *quitButton = new QPushButton(tr("Quit without saving"));
- quitButton->setIcon(QIcon(":/img/application-exit.png"));
+ mQuitButton = new QPushButton(tr("Quit without saving"));
+ mQuitButton->setIcon(QIcon(":/img/application-exit.png"));
QPushButton *installButton = new QPushButton(tr("Install updates"));
#ifdef Q_OS_WIN
if (is_admin()) {
@@ -560,12 +560,12 @@
#else
installButton->setIcon(QIcon(":/img/view-refresh.png"));
#endif
- connect(quitButton, SIGNAL(clicked()), this, SLOT(closeApp()));
+ connect(mQuitButton, SIGNAL(clicked()), this, SLOT(closeApp()));
connect(installButton, SIGNAL(clicked()), this, SLOT(checkAndInstallCerts()));
connect(searchUpdates, SIGNAL(clicked()), this, SLOT(checkUpdates()));
updatesHeaderActionLayout->addWidget(installButton);
- updatesHeaderActionLayout->addWidget(quitButton);
+ updatesHeaderActionLayout->addWidget(mQuitButton);
updatesHeaderSearchLayout->insertStretch(0, 1);
updatesHeaderSearchLayout->addWidget(searchUpdates);
@@ -807,6 +807,15 @@
void MainWindow::listChanged(int selected)
{
+ if (mUpdatesRemove->selectedCertCount() +
+ mUpdatesNew->selectedCertCount() +
+ mUpdatesManual->selectedCertCount() == 0) {
+ /* No changes */
+ mQuitButton->setText(tr("Quit"));
+ } else {
+ mQuitButton->setText(tr("Quit without saving"));
+ }
+
mUpdatesHeader->setText("<h2>" + tr("Updates (%1/%2)")
.arg(mUpdatesRemove->selectedCertCount() + mUpdatesNew->selectedCertCount())
.arg(mUpdatesRemove->certificates().size() + mUpdatesNew->certificates().size()) +
diff -r 3791a277f00b -r 0fc1a20adaff ui/mainwindow.h
--- a/ui/mainwindow.h Tue Jul 01 16:39:28 2014 +0200
+++ b/ui/mainwindow.h Tue Jul 01 16:43:58 2014 +0200
@@ -30,6 +30,7 @@
class QMenu;
class QAction;
class QTimer;
+class QPushButton;
class MainWindow : public QMainWindow
@@ -186,6 +187,7 @@
QAction *mQuitAction;
CurrentState mCurState;
QMenuBar *mMenuBar;
+ QPushButton *mQuitButton;
/* The current list that should be installed */
CertificateList mListToInstall;
More information about the Trustbridge-commits
mailing list