comparison ui/mainwindow.cpp @ 709:8f110e6b8295

(UI) Changed update header to GridLayout and moved action buttons to bottom left.
author Emanuel Schuetze <emanuel@intevation.de>
date Wed, 02 Jul 2014 13:09:09 +0200
parents bd48fae793b6
children cdf8a924e480
comparison
equal deleted inserted replaced
708:bd48fae793b6 709:8f110e6b8295
19 #include <QApplication> 19 #include <QApplication>
20 #include <QFile> 20 #include <QFile>
21 #include <QTimer> 21 #include <QTimer>
22 #include <QHBoxLayout> 22 #include <QHBoxLayout>
23 #include <QVBoxLayout> 23 #include <QVBoxLayout>
24 #include <QGridLayout>
24 #include <QGroupBox> 25 #include <QGroupBox>
25 #include <QSplitter> 26 #include <QSplitter>
26 #include <QLabel> 27 #include <QLabel>
27 #include <QImage> 28 #include <QImage>
28 #include <QCheckBox> 29 #include <QCheckBox>
76 mTrayMode(trayMode) 77 mTrayMode(trayMode)
77 { 78 {
78 createActions(); 79 createActions();
79 createTrayIcon(); 80 createTrayIcon();
80 createContent(); 81 createContent();
81 resize(950, 540); 82 resize(1065, 600);
83 setMinimumWidth(760);
82 qRegisterMetaType<SSLConnection::ErrorCode>("SSLConnection::ErrorCode"); 84 qRegisterMetaType<SSLConnection::ErrorCode>("SSLConnection::ErrorCode");
83 qRegisterMetaType<Certificate::Status>("Certificate::Status"); 85 qRegisterMetaType<Certificate::Status>("Certificate::Status");
84 86
85 connect(mTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), 87 connect(mTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
86 this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason))); 88 this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));
524 * The updates page. 526 * The updates page.
525 ********************************/ 527 ********************************/
526 QVBoxLayout *updatesMainLayout = new QVBoxLayout; 528 QVBoxLayout *updatesMainLayout = new QVBoxLayout;
527 mUpdatesPanel = new QScrollArea; 529 mUpdatesPanel = new QScrollArea;
528 QScrollArea *updatesContent = new QScrollArea; 530 QScrollArea *updatesContent = new QScrollArea;
529 // updatesContent->setFrameShape(QFrame::NoFrame);
530 mUpdatesWidget = new QWidget; 531 mUpdatesWidget = new QWidget;
531 532
532 /* The updates header */ 533 /* The header */
533 QHBoxLayout *updatesHeaderLayout = new QHBoxLayout; 534 QGridLayout *updatesHeaderLayout = new QGridLayout;
534 QVBoxLayout *updatesHeaderTextLayout = new QVBoxLayout; 535
535 QVBoxLayout *updatesHeaderButtonLayout = new QVBoxLayout; 536 /* Header 1: Update date and search button */
536 QHBoxLayout *updatesHeaderActionLayout = new QHBoxLayout;
537 QHBoxLayout *updatesHeaderSearchLayout = new QHBoxLayout;
538
539 mUpdatesHeader = 537 mUpdatesHeader =
540 new QLabel("<h2>" + tr("Certificates unchanged")+ "</h2>"); 538 new QLabel("<h2>" + tr("Certificates unchanged")+ "</h2>");
541 mLastCertUpdate = 539 mLastCertUpdate =
542 new QLabel(""); 540 new QLabel("");
543 mLastCertUpdate->hide(); 541 mLastCertUpdate->hide();
550 new QLabel(tr("Last sucessful update check: %1").arg(lastUpdateCheck)); 548 new QLabel(tr("Last sucessful update check: %1").arg(lastUpdateCheck));
551 } else { 549 } else {
552 mLastUpdateCheck = new QLabel(""); 550 mLastUpdateCheck = new QLabel("");
553 mLastUpdateCheck->hide(); 551 mLastUpdateCheck->hide();
554 } 552 }
555 QLabel *updatesTip =
556 new QLabel(tr("You should apply the following changes to your root certificates:"));
557 updatesTip->setWordWrap(true);
558
559 updatesHeaderTextLayout->addWidget(mUpdatesHeader);
560 updatesHeaderTextLayout->addWidget(mLastCertUpdate);
561 updatesHeaderTextLayout->addWidget(mLastUpdateCheck);
562 updatesHeaderTextLayout->addWidget(mSoftwareVersionLabel);
563 updatesHeaderTextLayout->addSpacing(10);
564 updatesHeaderTextLayout->addWidget(updatesTip);
565
566 QPushButton *searchUpdates = new QPushButton(" " + tr("Check for updates")); 553 QPushButton *searchUpdates = new QPushButton(" " + tr("Check for updates"));
567 searchUpdates->setIcon(QIcon(":/img/edit-find.png")); 554 searchUpdates->setIcon(QIcon(":/img/edit-find.png"));
555 connect(searchUpdates, SIGNAL(clicked()), this, SLOT(checkUpdates()));
556
557 // addWidget(*Widget, row, column, rowspan, colspan, [Qt::Alignment])
558 updatesHeaderLayout->addWidget(mUpdatesHeader, 0, 0, 1, 2);
559 updatesHeaderLayout->addWidget(mLastCertUpdate, 1, 0, 1, 1);
560 updatesHeaderLayout->addWidget(mSoftwareVersionLabel, 2, 0, 1, 1);
561 updatesHeaderLayout->addWidget(mLastUpdateCheck, 3, 0, 1, 1);
562 updatesHeaderLayout->addWidget(searchUpdates, 1, 2, 2, 1, Qt::AlignRight);
563 updatesHeaderLayout->setRowMinimumHeight(4, 15);
564
565 /* Header 2: Action text and buttons */
566 QLabel *updatesTip =
567 new QLabel(tr("You should apply the following, recommended changes to your root certificates."));
568 updatesTip->setWordWrap(true);
569 QHBoxLayout *updatesHeaderActionButtonLayout = new QHBoxLayout;
568 mQuitButton = new QPushButton(" " + tr("Quit without saving")); 570 mQuitButton = new QPushButton(" " + tr("Quit without saving"));
569 mQuitButton->setIcon(QIcon(":/img/application-exit.png")); 571 mQuitButton->setIcon(QIcon(":/img/application-exit.png"));
570 QPushButton *installButton = new QPushButton(" " + tr("Apply changes")); 572 QPushButton *installButton = new QPushButton(" " + tr("Apply changes"));
571 #ifdef Q_OS_WIN 573 #ifdef Q_OS_WIN
572 if (is_admin()) { 574 if (is_admin()) {
576 #else 578 #else
577 installButton->setIcon(QIcon(":/img/view-refresh.png")); 579 installButton->setIcon(QIcon(":/img/view-refresh.png"));
578 #endif 580 #endif
579 connect(mQuitButton, SIGNAL(clicked()), this, SLOT(closeApp())); 581 connect(mQuitButton, SIGNAL(clicked()), this, SLOT(closeApp()));
580 connect(installButton, SIGNAL(clicked()), this, SLOT(checkAndInstallCerts())); 582 connect(installButton, SIGNAL(clicked()), this, SLOT(checkAndInstallCerts()));
581 connect(searchUpdates, SIGNAL(clicked()), this, SLOT(checkUpdates())); 583
582 584 // addWidget(*Widget, row, column, rowspan, colspan)
583 updatesHeaderActionLayout->addWidget(installButton); 585 updatesHeaderLayout->addWidget(updatesTip, 5, 0, 1, 2);
584 updatesHeaderActionLayout->addWidget(mQuitButton); 586 updatesHeaderActionButtonLayout->addWidget(installButton);
585 updatesHeaderSearchLayout->insertStretch(0, 1); 587 updatesHeaderActionButtonLayout->addWidget(mQuitButton);
586 updatesHeaderSearchLayout->addWidget(searchUpdates); 588 updatesHeaderLayout->addLayout(updatesHeaderActionButtonLayout, 6, 0, 1, 1);
587 589 updatesHeaderLayout->setRowMinimumHeight(7, 10);
588 updatesHeaderButtonLayout->addLayout(updatesHeaderSearchLayout);
589 updatesHeaderButtonLayout->addLayout(updatesHeaderActionLayout);
590
591 updatesHeaderLayout->addLayout(updatesHeaderTextLayout);
592 updatesHeaderLayout->insertStretch(1, 10);
593 updatesHeaderLayout->addLayout(updatesHeaderButtonLayout);
594 590
595 /* The central panels. */ 591 /* The central panels. */
596 QVBoxLayout *updatesCenterLayout = new QVBoxLayout; 592 QVBoxLayout *updatesCenterLayout = new QVBoxLayout;
597 QHBoxLayout *updatesNewLayout = new QHBoxLayout; 593 QHBoxLayout *updatesNewLayout = new QHBoxLayout;
598 QHBoxLayout *updatesRemoveLayout = new QHBoxLayout; 594 QHBoxLayout *updatesRemoveLayout = new QHBoxLayout;

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