Mercurial > trustbridge
diff ui/mainwindow.cpp @ 282:d13d51f7a0e2
Merged
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Wed, 02 Apr 2014 15:22:33 +0200 |
parents | 90432cb1f374 |
children | 75f7288ad67b |
line wrap: on
line diff
--- a/ui/mainwindow.cpp Wed Apr 02 15:22:13 2014 +0200 +++ b/ui/mainwindow.cpp Wed Apr 02 15:22:33 2014 +0200 @@ -12,7 +12,6 @@ #include <QHBoxLayout> #include <QVBoxLayout> #include <QGroupBox> -#include <QPushButton> #include <QSplitter> #include <QLabel> #include <QImage> @@ -33,6 +32,7 @@ #include "aboutdialog.h" #include "statusdialog.h" #include "certificateitemdelegate.h" +#include "separatoritemdelegate.h" MainWindow::MainWindow() { createActions(); @@ -239,10 +239,11 @@ QHBoxLayout *mainLayout = new QHBoxLayout; QVBoxLayout *infoLayout = new QVBoxLayout; QVBoxLayout *certLayout = new QVBoxLayout; + QVBoxLayout *detailLayout = new QVBoxLayout; QHBoxLayout *headerLayout = new QHBoxLayout; QVBoxLayout *headerTextLayout = new QVBoxLayout; QVBoxLayout *toolLayout = new QVBoxLayout; - QHBoxLayout *toolButtonLayout = new QHBoxLayout; + QHBoxLayout *bottomLayout = new QHBoxLayout; // The certificate list QGroupBox *certBox = new QGroupBox(tr("Managed Certificates")); @@ -267,28 +268,37 @@ headerLayout->setStretch(0, 0); headerLayout->setStretch(1, 10); - // The tools to update the certificate list/software and install - // certificates. + // The settings. QCheckBox *autoUpdateOption = new QCheckBox(tr("autoupdate")); toolLayout->addWidget(autoUpdateOption); // connect(autoUpdateOption, SIGNAL(stateChanged()), this, SLOT(setAutoUpdate())); - QPushButton *update = new QPushButton(tr("Search for Updates")); - connect(update, SIGNAL(clicked()), this, SLOT(checkUpdates())); - QPushButton *install = new QPushButton(tr("Install selected")); -// connect(update, SIGNAL(clicked()), this, SLOT(installCertificates())); - toolButtonLayout->addWidget(update); - toolButtonLayout->addWidget(install); - toolButtonLayout->insertStretch(2, 10); - toolLayout->addLayout(toolButtonLayout); + + // The buttons. + bottomLayout->setAlignment(Qt::AlignBottom); + installButton = new QPushButton(tr("Install selected")); + installButton->setFixedHeight(80); + connect(installButton, SIGNAL(clicked()), this, SLOT(resizeButtons())); + quitButton = new QPushButton(tr("Quit")); + quitButton->setFixedHeight(20); + connect(quitButton, SIGNAL(clicked()), qApp, SLOT(quit())); + bottomLayout->insertStretch(0, 10); + bottomLayout->addWidget(installButton); + bottomLayout->setAlignment(installButton, Qt::AlignBottom); + bottomLayout->addWidget(quitButton); + bottomLayout->setAlignment(quitButton, Qt::AlignBottom); // The certificate details + QGroupBox *detailBox = new QGroupBox(tr("Details")); certificateDetails = new QTextEdit; certificateDetails->setReadOnly(true); + detailLayout->addWidget(certificateDetails); + detailBox->setLayout(detailLayout); infoLayout->addSpacing(20); infoLayout->addLayout(headerLayout); infoLayout->addLayout(toolLayout); - infoLayout->addWidget(certificateDetails); + infoLayout->addWidget(detailBox); + infoLayout->addLayout(bottomLayout); mainLayout->addWidget(certBox); mainLayout->addLayout(infoLayout); @@ -311,6 +321,7 @@ continue; } QListWidgetItem* item = new QListWidgetItem(cert.shortDescription()); + SeparatorItemDelegate *separator = new SeparatorItemDelegate(); item->setData(Qt::UserRole, cert.details()); if (cert.isInstallCert()) { // This if statements is for testing! @TODO Remove this! @@ -324,6 +335,12 @@ item->setFlags(item->flags() | Qt::ItemIsUserCheckable); item->setCheckState(Qt::Checked); } + if (i == 3) { + QListWidgetItem *sep = new QListWidgetItem("New certificates"); + certificateList->setItemDelegateForRow(i, separator); + certificateList->addItem(sep); + i++; + } } else { // This if statements is for testing! @TODO Remove this! @@ -375,3 +392,9 @@ details.append("\rInstalled: 1.1.1971\rRemoved: 1.1.1971"); certificateDetails->setPlainText(details); } + +void MainWindow::resizeButtons() +{ + installButton->setFixedHeight(20); + quitButton->setFixedHeight(80); +}