comparison ui/mainwindow.cpp @ 722:b0929968562a

(Issue31) Add textoverlaybutton to show a text in the button.
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 02 Jul 2014 18:35:30 +0200
parents 49bf73b5c7de
children d39b5b65366e
comparison
equal deleted inserted replaced
721:abc76948d8e5 722:b0929968562a
464 /*********************************** 464 /***********************************
465 * The Buttonbar on the left side. 465 * The Buttonbar on the left side.
466 ***********************************/ 466 ***********************************/
467 mButtonGroup = new QButtonGroup; 467 mButtonGroup = new QButtonGroup;
468 468
469 QToolButton *updatesButton = new QToolButton; 469 TextOverlayButton *updatesButton = new TextOverlayButton;
470 updatesButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); 470 updatesButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
471 updatesButton->setIcon(QIcon(":/img/view-refresh.png")); 471 updatesButton->setIcon(QIcon(":/img/view-refresh.png"));
472 updatesButton->setIconSize(QSize(40, 40)); 472 updatesButton->setIconSize(QSize(40, 40));
473 updatesButton->setText(tr("Updates")); 473 updatesButton->setText(tr("Updates"));
474 updatesButton->setFixedWidth(120); 474 updatesButton->setFixedWidth(120);
475 updatesButton->setFixedHeight(80); 475 updatesButton->setFixedHeight(80);
476 updatesButton->setCheckable(true); 476 updatesButton->setCheckable(true);
477 updatesButton->setChecked(true); 477 updatesButton->setChecked(true);
478
479 connect(this, SIGNAL(changesChanged(const QString&)),
480 updatesButton, SLOT(setOverlay(const QString&)));
478 481
479 QToolButton *allInstallButton = new QToolButton; 482 QToolButton *allInstallButton = new QToolButton;
480 allInstallButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); 483 allInstallButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
481 allInstallButton->setIcon(QIcon(":/img/document-encrypt.png")); 484 allInstallButton->setIcon(QIcon(":/img/document-encrypt.png"));
482 allInstallButton->setIconSize(QSize(40, 40)); 485 allInstallButton->setIconSize(QSize(40, 40));
829 } 832 }
830 833
831 void MainWindow::listChanged(int selected) 834 void MainWindow::listChanged(int selected)
832 { 835 {
833 Q_UNUSED (selected); 836 Q_UNUSED (selected);
834 mChangeCount = mUpdatesRemove->selectedCertCount() + 837 setChangeCount(mUpdatesRemove->selectedCertCount() +
835 mUpdatesNew->selectedCertCount() + mUpdatesManual->certificates().size(); 838 mUpdatesNew->selectedCertCount() + mUpdatesManual->certificates().size());
836 839
837 /* Show a different tip in case of manual changes, updates aviailable, updates and manual 840 /* Show a different tip in case of manual changes, updates aviailable, updates and manual
838 * changes available */ 841 * changes available */
839 if (changeCount() && !mUpdatesManual->certificates().size()) { 842 if (changeCount() && !mUpdatesManual->certificates().size()) {
840 mUpdatesTip->setText( 843 mUpdatesTip->setText(
1167 1170
1168 void MainWindow::toggleUpdatesNew() { 1171 void MainWindow::toggleUpdatesNew() {
1169 if (!mUpdatesNew->isVisible()) { 1172 if (!mUpdatesNew->isVisible()) {
1170 mUpdatesDetailsNew->setText(tr("Hide details")); 1173 mUpdatesDetailsNew->setText(tr("Hide details"));
1171 mUpdatesNew->show(); 1174 mUpdatesNew->show();
1172 mUpdatesNew->setSelected(0); 1175 mUpdatesNew->setSelected(mUpdatesNew->selected());
1173 } 1176 }
1174 else { 1177 else {
1175 mUpdatesNew->hide(); 1178 mUpdatesNew->hide();
1176 mUpdatesDetailsNew->setText(tr("Show details")); 1179 mUpdatesDetailsNew->setText(tr("Show details"));
1177 QSize old = mUpdatesWidget->size(); 1180 QSize old = mUpdatesWidget->size();
1231 1234
1232 int MainWindow::changeCount() 1235 int MainWindow::changeCount()
1233 { 1236 {
1234 return mChangeCount; 1237 return mChangeCount;
1235 } 1238 }
1239
1240 void MainWindow::setChangeCount(int cnt)
1241 {
1242 if (mChangeCount != cnt) {
1243 mChangeCount = cnt;
1244 emit changesChanged(QString("%1").arg(cnt));
1245 }
1246 }

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