comparison ui/mainwindow.cpp @ 693:0fc1a20adaff

(Issue 27) Change Quit button text depending on changes or no changes.
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 01 Jul 2014 16:43:58 +0200
parents 3791a277f00b
children 25a73bfec359
comparison
equal deleted inserted replaced
692:3791a277f00b 693:0fc1a20adaff
547 updatesHeaderTextLayout->addSpacing(10); 547 updatesHeaderTextLayout->addSpacing(10);
548 updatesHeaderTextLayout->addWidget(updatesTip); 548 updatesHeaderTextLayout->addWidget(updatesTip);
549 549
550 QPushButton *searchUpdates = new QPushButton(tr("Check for updates")); 550 QPushButton *searchUpdates = new QPushButton(tr("Check for updates"));
551 searchUpdates->setIcon(QIcon(":/img/edit-find.png")); 551 searchUpdates->setIcon(QIcon(":/img/edit-find.png"));
552 QPushButton *quitButton = new QPushButton(tr("Quit without saving")); 552 mQuitButton = new QPushButton(tr("Quit without saving"));
553 quitButton->setIcon(QIcon(":/img/application-exit.png")); 553 mQuitButton->setIcon(QIcon(":/img/application-exit.png"));
554 QPushButton *installButton = new QPushButton(tr("Install updates")); 554 QPushButton *installButton = new QPushButton(tr("Install updates"));
555 #ifdef Q_OS_WIN 555 #ifdef Q_OS_WIN
556 if (is_admin()) { 556 if (is_admin()) {
557 QIcon uacShield = QApplication::style()->standardIcon(QStyle::SP_VistaShield); 557 QIcon uacShield = QApplication::style()->standardIcon(QStyle::SP_VistaShield);
558 installButton->setIcon(uacShield); 558 installButton->setIcon(uacShield);
559 } 559 }
560 #else 560 #else
561 installButton->setIcon(QIcon(":/img/view-refresh.png")); 561 installButton->setIcon(QIcon(":/img/view-refresh.png"));
562 #endif 562 #endif
563 connect(quitButton, SIGNAL(clicked()), this, SLOT(closeApp())); 563 connect(mQuitButton, SIGNAL(clicked()), this, SLOT(closeApp()));
564 connect(installButton, SIGNAL(clicked()), this, SLOT(checkAndInstallCerts())); 564 connect(installButton, SIGNAL(clicked()), this, SLOT(checkAndInstallCerts()));
565 connect(searchUpdates, SIGNAL(clicked()), this, SLOT(checkUpdates())); 565 connect(searchUpdates, SIGNAL(clicked()), this, SLOT(checkUpdates()));
566 566
567 updatesHeaderActionLayout->addWidget(installButton); 567 updatesHeaderActionLayout->addWidget(installButton);
568 updatesHeaderActionLayout->addWidget(quitButton); 568 updatesHeaderActionLayout->addWidget(mQuitButton);
569 updatesHeaderSearchLayout->insertStretch(0, 1); 569 updatesHeaderSearchLayout->insertStretch(0, 1);
570 updatesHeaderSearchLayout->addWidget(searchUpdates); 570 updatesHeaderSearchLayout->addWidget(searchUpdates);
571 571
572 updatesHeaderButtonLayout->addLayout(updatesHeaderSearchLayout); 572 updatesHeaderButtonLayout->addLayout(updatesHeaderSearchLayout);
573 updatesHeaderButtonLayout->addLayout(updatesHeaderActionLayout); 573 updatesHeaderButtonLayout->addLayout(updatesHeaderActionLayout);
805 setCentralWidget(base); 805 setCentralWidget(base);
806 } 806 }
807 807
808 void MainWindow::listChanged(int selected) 808 void MainWindow::listChanged(int selected)
809 { 809 {
810 if (mUpdatesRemove->selectedCertCount() +
811 mUpdatesNew->selectedCertCount() +
812 mUpdatesManual->selectedCertCount() == 0) {
813 /* No changes */
814 mQuitButton->setText(tr("Quit"));
815 } else {
816 mQuitButton->setText(tr("Quit without saving"));
817 }
818
810 mUpdatesHeader->setText("<h2>" + tr("Updates (%1/%2)") 819 mUpdatesHeader->setText("<h2>" + tr("Updates (%1/%2)")
811 .arg(mUpdatesRemove->selectedCertCount() + mUpdatesNew->selectedCertCount()) 820 .arg(mUpdatesRemove->selectedCertCount() + mUpdatesNew->selectedCertCount())
812 .arg(mUpdatesRemove->certificates().size() + mUpdatesNew->certificates().size()) + 821 .arg(mUpdatesRemove->certificates().size() + mUpdatesNew->certificates().size()) +
813 "</h2>"); 822 "</h2>");
814 mUpdatesNewCertificates->setText("<h3>" + 823 mUpdatesNewCertificates->setText("<h3>" +

http://wald.intevation.org/projects/trustbridge/