Mercurial > trustbridge
comparison ui/mainwindow.cpp @ 790:399bc0df073d
(issue60) Make windows smaller and change details buttons to icon only
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Mon, 14 Jul 2014 18:27:46 +0200 |
parents | 07cc0aabf782 |
children | c61acf2a22dc |
comparison
equal
deleted
inserted
replaced
789:2e954efcb3f1 | 790:399bc0df073d |
---|---|
78 mTrayMode(trayMode) | 78 mTrayMode(trayMode) |
79 { | 79 { |
80 createActions(); | 80 createActions(); |
81 createTrayIcon(); | 81 createTrayIcon(); |
82 setupGUI(); | 82 setupGUI(); |
83 resize(1065, 600); | 83 resize(900, 600); |
84 setMinimumWidth(760); | 84 setMinimumWidth(760); |
85 qRegisterMetaType<SSLConnection::ErrorCode>("SSLConnection::ErrorCode"); | 85 qRegisterMetaType<SSLConnection::ErrorCode>("SSLConnection::ErrorCode"); |
86 qRegisterMetaType<Certificate::Status>("Certificate::Status"); | 86 qRegisterMetaType<Certificate::Status>("Certificate::Status"); |
87 | 87 |
88 connect(mTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), | 88 connect(mTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), |
531 mLastUpdateCheck = | 531 mLastUpdateCheck = |
532 new QLabel(tr("Last successful update check:")); | 532 new QLabel(tr("Last successful update check:")); |
533 mLastUpdateCheckContents = new QLabel(lastUpdateCheck); | 533 mLastUpdateCheckContents = new QLabel(lastUpdateCheck); |
534 } else { | 534 } else { |
535 mLastUpdateCheck = new QLabel(tr("Last successful update check:")); | 535 mLastUpdateCheck = new QLabel(tr("Last successful update check:")); |
536 mLastUpdateCheckContents = new QLabel(QString()); | 536 mLastUpdateCheckContents = new QLabel(tr("No connection with the updateserver.")); |
537 mLastUpdateCheck->hide(); | |
538 mLastUpdateCheckContents->hide(); | |
539 } | 537 } |
540 QPushButton *searchUpdates = new QPushButton(); | 538 QPushButton *searchUpdates = new QPushButton(); |
541 searchUpdates->setStyleSheet("QPushButton {border-style: outset; border-width: 0px;}"); | 539 searchUpdates->setStyleSheet("QPushButton {border-style: outset; border-width: 0px;}"); |
542 searchUpdates->setToolTip(tr("Check for updates")); | 540 searchUpdates->setToolTip(tr("Check for updates")); |
543 searchUpdates->setIcon(QIcon(":/img/update-list.png")); | 541 searchUpdates->setIcon(QIcon(":/img/update-list.png")); |
583 | 581 |
584 // addWidget(*Widget, row, column, rowspan, colspan) | 582 // addWidget(*Widget, row, column, rowspan, colspan) |
585 updatesHeaderLayout->addWidget(mUpdatesTip, 5, 0, 1, 4); | 583 updatesHeaderLayout->addWidget(mUpdatesTip, 5, 0, 1, 4); |
586 updatesHeaderActionButtonLayout->addWidget(mInstallButton); | 584 updatesHeaderActionButtonLayout->addWidget(mInstallButton); |
587 updatesHeaderActionButtonLayout->addWidget(mQuitButton); | 585 updatesHeaderActionButtonLayout->addWidget(mQuitButton); |
588 updatesHeaderLayout->addLayout(updatesHeaderActionButtonLayout, 6, 0, 1, 3, Qt::AlignLeft); | 586 updatesHeaderLayout->addLayout(updatesHeaderActionButtonLayout, 6, 0, 1, -1, Qt::AlignRight); |
589 updatesHeaderLayout->setRowMinimumHeight(7, 10); | 587 updatesHeaderLayout->setRowMinimumHeight(7, 10); |
590 | 588 |
591 /* The central panels. */ | 589 /* The central panels. */ |
592 QScrollArea *centralScrollArea = new QScrollArea; | 590 QScrollArea *centralScrollArea = new QScrollArea; |
593 QVBoxLayout *updatesCenterLayout = new QVBoxLayout; | 591 QVBoxLayout *updatesCenterLayout = new QVBoxLayout; |
596 QHBoxLayout *updatesManualLayout = new QHBoxLayout; | 594 QHBoxLayout *updatesManualLayout = new QHBoxLayout; |
597 mUpdatesNewCertificates = | 595 mUpdatesNewCertificates = |
598 new QLabel("<h3>" + | 596 new QLabel("<h3>" + |
599 tr("Install new trusted certificates (%1/%2)").arg(0).arg(0) + | 597 tr("Install new trusted certificates (%1/%2)").arg(0).arg(0) + |
600 "</h3>"); | 598 "</h3>"); |
601 mUpdatesDetailsNew = new QPushButton(tr("Show details")); | 599 mUpdatesDetailsNew = new QPushButton(); |
600 mUpdatesDetailsNew->setToolTip(tr("Show details")); | |
601 mUpdatesDetailsNew->setStyleSheet("QPushButton {border-style: outset; border-width: 0px;}"); | |
602 mUpdatesDetailsNew->setIcon(QIcon(":/img/arrow-left-double.png")); | |
602 connect(mUpdatesDetailsNew, | 603 connect(mUpdatesDetailsNew, |
603 SIGNAL(clicked()), | 604 SIGNAL(clicked()), |
604 this, | 605 this, |
605 SLOT(toggleUpdatesNew())); | 606 SLOT(toggleUpdatesNew())); |
606 updatesNewLayout->addWidget(mUpdatesNewCertificates); | 607 updatesNewLayout->addWidget(mUpdatesNewCertificates); |
608 updatesNewLayout->addWidget(mUpdatesDetailsNew); | |
607 updatesNewLayout->addStretch(1); | 609 updatesNewLayout->addStretch(1); |
608 updatesNewLayout->addWidget(mUpdatesDetailsNew); | |
609 mUpdatesNew = new CertificateListWidget(this); | 610 mUpdatesNew = new CertificateListWidget(this); |
610 connect(mUpdatesNew, SIGNAL(certListChanged(int)), | 611 connect(mUpdatesNew, SIGNAL(certListChanged(int)), |
611 this, SLOT(listChanged(int))); | 612 this, SLOT(listChanged(int))); |
612 mUpdatesNew->hide(); | 613 mUpdatesNew->hide(); |
613 | 614 |
614 mUpdatesRemoveCertificates = | 615 mUpdatesRemoveCertificates = |
615 new QLabel("<h3>" + | 616 new QLabel("<h3>" + |
616 tr("Remove revoked certificates (%1/%2)").arg(0).arg(0) + | 617 tr("Remove revoked certificates (%1/%2)").arg(0).arg(0) + |
617 "</h3>"); | 618 "</h3>"); |
618 mUpdatesDetailsRemove = new QPushButton(tr("Show details")); | 619 mUpdatesDetailsRemove = new QPushButton(); |
620 mUpdatesDetailsRemove->setToolTip(tr("Show details")); | |
621 mUpdatesDetailsRemove->setStyleSheet("QPushButton {border-style: outset; border-width: 0px;}"); | |
622 mUpdatesDetailsRemove->setIcon(QIcon(":/img/arrow-left-double.png")); | |
619 connect(mUpdatesDetailsRemove, | 623 connect(mUpdatesDetailsRemove, |
620 SIGNAL(clicked()), | 624 SIGNAL(clicked()), |
621 this, | 625 this, |
622 SLOT(toggleUpdatesRemove())); | 626 SLOT(toggleUpdatesRemove())); |
623 updatesRemoveLayout->addWidget(mUpdatesRemoveCertificates); | 627 updatesRemoveLayout->addWidget(mUpdatesRemoveCertificates); |
628 updatesRemoveLayout->addWidget(mUpdatesDetailsRemove); | |
624 updatesRemoveLayout->addStretch(1); | 629 updatesRemoveLayout->addStretch(1); |
625 updatesRemoveLayout->addWidget(mUpdatesDetailsRemove); | |
626 mUpdatesRemove = new CertificateListWidget(this); | 630 mUpdatesRemove = new CertificateListWidget(this); |
627 connect(mUpdatesRemove, SIGNAL(certListChanged(int)), | 631 connect(mUpdatesRemove, SIGNAL(certListChanged(int)), |
628 this, SLOT(listChanged(int))); | 632 this, SLOT(listChanged(int))); |
629 mUpdatesRemove->hide(); | 633 mUpdatesRemove->hide(); |
630 | 634 |
631 mUpdatesManualCertificates = | 635 mUpdatesManualCertificates = |
632 new QLabel("<h3>" + | 636 new QLabel("<h3>" + |
633 tr("Manually changed certificates (%1)").arg(0) + | 637 tr("Manually changed certificates (%1)").arg(0) + |
634 "</h3>"); | 638 "</h3>"); |
635 mUpdatesDetailsManual = new QPushButton(tr("Show details")); | 639 mUpdatesDetailsManual = new QPushButton(); |
640 mUpdatesDetailsManual->setToolTip(tr("Show details")); | |
641 mUpdatesDetailsManual->setStyleSheet("QPushButton {border-style: outset; border-width: 0px;}"); | |
642 mUpdatesDetailsManual->setIcon(QIcon(":/img/arrow-left-double.png")); | |
636 connect(mUpdatesDetailsManual, | 643 connect(mUpdatesDetailsManual, |
637 SIGNAL(clicked()), | 644 SIGNAL(clicked()), |
638 this, | 645 this, |
639 SLOT(toggleUpdatesManual())); | 646 SLOT(toggleUpdatesManual())); |
640 mUpdatesDetailsManual->hide(); | 647 mUpdatesDetailsManual->hide(); |
641 mUpdatesManualCertificates->hide(); | 648 mUpdatesManualCertificates->hide(); |
642 updatesManualLayout->addWidget(mUpdatesManualCertificates); | 649 updatesManualLayout->addWidget(mUpdatesManualCertificates); |
650 updatesManualLayout->addWidget(mUpdatesDetailsManual); | |
643 updatesManualLayout->addStretch(1); | 651 updatesManualLayout->addStretch(1); |
644 updatesManualLayout->addWidget(mUpdatesDetailsManual); | |
645 mUpdatesManual = new CertificateListWidget(this); | 652 mUpdatesManual = new CertificateListWidget(this); |
646 mUpdatesManual->hide(); | 653 mUpdatesManual->hide(); |
647 connect(mUpdatesManual, SIGNAL(certChanged(bool, const Certificate&)), | 654 connect(mUpdatesManual, SIGNAL(certChanged(bool, const Certificate&)), |
648 this, SLOT(removeFromManual(bool, const Certificate&))); | 655 this, SLOT(removeFromManual(bool, const Certificate&))); |
649 connect(mUpdatesManual, SIGNAL(certListChanged(int)), | 656 connect(mUpdatesManual, SIGNAL(certListChanged(int)), |
917 mInstallButton->setText(" " + tr("Apply changes")); | 924 mInstallButton->setText(" " + tr("Apply changes")); |
918 } | 925 } |
919 | 926 |
920 if (mUpdatesManual->certificates().size()) { | 927 if (mUpdatesManual->certificates().size()) { |
921 mUpdatesDetailsManual->show(); | 928 mUpdatesDetailsManual->show(); |
922 mUpdatesDetailsManual->setText(tr("Show details")); | 929 mUpdatesDetailsManual->setIcon(QIcon(":/img/arrow-left-double.png")); |
930 mUpdatesDetailsManual->setToolTip(tr("Show details")); | |
923 mUpdatesManualCertificates->show(); | 931 mUpdatesManualCertificates->show(); |
924 } else { | 932 } else { |
925 mUpdatesDetailsManual->hide(); | 933 mUpdatesDetailsManual->hide(); |
926 mUpdatesManualCertificates->hide(); | 934 mUpdatesManualCertificates->hide(); |
927 mUpdatesManual->hide(); | 935 mUpdatesManual->hide(); |
932 tr("Install new trusted certificates (%1/%2)") | 940 tr("Install new trusted certificates (%1/%2)") |
933 .arg(mUpdatesNew->selectedCertCount()) | 941 .arg(mUpdatesNew->selectedCertCount()) |
934 .arg(mUpdatesNew->certificates().size()) + | 942 .arg(mUpdatesNew->certificates().size()) + |
935 "</h3>"); | 943 "</h3>"); |
936 mUpdatesDetailsNew->show(); | 944 mUpdatesDetailsNew->show(); |
937 mUpdatesDetailsNew->setText(tr("Show details")); | 945 mUpdatesDetailsNew->setIcon(QIcon(":/img/arrow-left-double.png")); |
946 mUpdatesDetailsNew->setToolTip(tr("Show details")); | |
938 mUpdatesNewCertificates->show(); | 947 mUpdatesNewCertificates->show(); |
939 } else { | 948 } else { |
940 mUpdatesDetailsNew->hide(); | 949 mUpdatesDetailsNew->hide(); |
941 mUpdatesNew->hide(); | 950 mUpdatesNew->hide(); |
942 mUpdatesNewCertificates->hide(); | 951 mUpdatesNewCertificates->hide(); |
947 tr("Remove revoked certificates (%1/%2)") | 956 tr("Remove revoked certificates (%1/%2)") |
948 .arg(mUpdatesRemove->selectedCertCount()) | 957 .arg(mUpdatesRemove->selectedCertCount()) |
949 .arg(mUpdatesRemove->certificates().size()) + | 958 .arg(mUpdatesRemove->certificates().size()) + |
950 "</h3>"); | 959 "</h3>"); |
951 mUpdatesRemoveCertificates->show(); | 960 mUpdatesRemoveCertificates->show(); |
952 mUpdatesDetailsRemove->setText(tr("Show details")); | 961 mUpdatesDetailsRemove->setIcon(QIcon(":/img/arrow-left-double.png")); |
962 mUpdatesDetailsRemove->setToolTip(tr("Show details")); | |
953 mUpdatesDetailsRemove->show(); | 963 mUpdatesDetailsRemove->show(); |
954 } else { | 964 } else { |
955 mUpdatesRemoveCertificates->hide(); | 965 mUpdatesRemoveCertificates->hide(); |
956 mUpdatesDetailsRemove->hide(); | 966 mUpdatesDetailsRemove->hide(); |
957 mUpdatesRemove->hide(); | 967 mUpdatesRemove->hide(); |
1222 return; | 1232 return; |
1223 } | 1233 } |
1224 | 1234 |
1225 void MainWindow::toggleUpdatesNew() { | 1235 void MainWindow::toggleUpdatesNew() { |
1226 if (!mUpdatesNew->isVisible()) { | 1236 if (!mUpdatesNew->isVisible()) { |
1227 mUpdatesDetailsNew->setText(tr("Hide details")); | 1237 mUpdatesDetailsNew->setToolTip(tr("Hide details")); |
1238 mUpdatesDetailsNew->setIcon(QIcon(":/img/arrow-down-double.png")); | |
1228 mUpdatesNew->show(); | 1239 mUpdatesNew->show(); |
1229 } | 1240 } |
1230 else { | 1241 else { |
1231 mUpdatesNew->hide(); | 1242 mUpdatesNew->hide(); |
1232 mUpdatesDetailsNew->setText(tr("Show details")); | 1243 mUpdatesDetailsNew->setToolTip(tr("Show details")); |
1244 mUpdatesDetailsNew->setIcon(QIcon(":/img/arrow-left-double.png")); | |
1233 } | 1245 } |
1234 } | 1246 } |
1235 | 1247 |
1236 void MainWindow::toggleUpdatesRemove() { | 1248 void MainWindow::toggleUpdatesRemove() { |
1237 if (!mUpdatesRemove->isVisible()) { | 1249 if (!mUpdatesRemove->isVisible()) { |
1238 mUpdatesDetailsRemove->setText(tr("Hide details")); | 1250 mUpdatesDetailsRemove->setToolTip(tr("Hide details")); |
1251 mUpdatesDetailsRemove->setIcon(QIcon(":/img/arrow-down-double.png")); | |
1239 mUpdatesRemove->show(); | 1252 mUpdatesRemove->show(); |
1240 } | 1253 } |
1241 else { | 1254 else { |
1242 mUpdatesRemove->hide(); | 1255 mUpdatesRemove->hide(); |
1243 mUpdatesDetailsRemove->setText(tr("Show details")); | 1256 mUpdatesDetailsRemove->setToolTip(tr("Show details")); |
1257 mUpdatesDetailsRemove->setIcon(QIcon(":/img/arrow-left-double.png")); | |
1244 } | 1258 } |
1245 } | 1259 } |
1246 | 1260 |
1247 void MainWindow::toggleUpdatesManual() { | 1261 void MainWindow::toggleUpdatesManual() { |
1248 if (!mUpdatesManual->isVisible()) { | 1262 if (!mUpdatesManual->isVisible()) { |
1249 mUpdatesDetailsManual->setText(tr("Hide details")); | 1263 mUpdatesDetailsManual->setToolTip(tr("Hide details")); |
1264 mUpdatesDetailsManual->setIcon(QIcon(":/img/arrow-down-double.png")); | |
1250 mUpdatesManual->show(); | 1265 mUpdatesManual->show(); |
1251 } | 1266 } |
1252 else { | 1267 else { |
1253 mUpdatesDetailsManual->setText(tr("Show details")); | 1268 mUpdatesDetailsManual->setToolTip(tr("Show details")); |
1269 mUpdatesDetailsManual->setIcon(QIcon(":/img/arrow-left-double.png")); | |
1254 mUpdatesManual->hide(); | 1270 mUpdatesManual->hide(); |
1255 } | 1271 } |
1256 } | 1272 } |
1257 | 1273 |
1258 void MainWindow::closeEvent(QCloseEvent *event) | 1274 void MainWindow::closeEvent(QCloseEvent *event) |