From b791a6a348f415ed9ecdbd93f852b99ebdca1d43 Mon Sep 17 00:00:00 2001 From: hypnosis-i2p Date: Mon, 31 Jul 2017 07:36:38 +0800 Subject: [PATCH] qt ui - status buttons done --- qt/i2pd_qt/i2pd_qt.pro | 3 +- qt/i2pd_qt/mainwindow.cpp | 27 ++++++--- qt/i2pd_qt/mainwindow.h | 4 ++ qt/i2pd_qt/mainwindow.ui | 78 +++++++++++++++++++++----- qt/i2pd_qt/statusbuttons.ui | 109 ++++++++++++++++++++++++++++++++++++ 5 files changed, 199 insertions(+), 22 deletions(-) create mode 100644 qt/i2pd_qt/statusbuttons.ui diff --git a/qt/i2pd_qt/i2pd_qt.pro b/qt/i2pd_qt/i2pd_qt.pro index 66839ff5..ed9ffd2e 100644 --- a/qt/i2pd_qt/i2pd_qt.pro +++ b/qt/i2pd_qt/i2pd_qt.pro @@ -174,7 +174,8 @@ INCLUDEPATH += ../../daemon INCLUDEPATH += . FORMS += mainwindow.ui \ - tunnelform.ui + tunnelform.ui \ + statusbuttons.ui LIBS += -lz diff --git a/qt/i2pd_qt/mainwindow.cpp b/qt/i2pd_qt/mainwindow.cpp index 9d312fa0..a4afe6a3 100644 --- a/qt/i2pd_qt/mainwindow.cpp +++ b/qt/i2pd_qt/mainwindow.cpp @@ -1,5 +1,6 @@ #include "mainwindow.h" #include "ui_mainwindow.h" +#include "ui_statusbuttons.h" #include #include #include @@ -28,6 +29,7 @@ MainWindow::MainWindow(QWidget *parent) : ,quitting(false) #endif ,ui(new Ui::MainWindow) + ,statusButtonsUI(new Ui::StatusButtonsForm) ,i2pController(nullptr) ,configItems() ,datadir() @@ -37,12 +39,16 @@ MainWindow::MainWindow(QWidget *parent) : { ui->setupUi(this); + statusButtonsUI->setupUi(ui->statusButtonsPane); + ui->statusButtonsPane->setFixedSize(172,300); + ui->verticalLayout->setGeometry(QRect(0,0,172,ui->verticalLayout->geometry().height())); + ui->statusButtonsPane->adjustSize(); + ui->centralWidget->adjustSize(); setWindowTitle(QApplication::translate("AppTitle","I2PD")); //TODO handle resizes and change the below into resize() call - setFixedSize(width(), 480); - ui->centralWidget->setMinimumHeight(480); - ui->centralWidget->setMaximumHeight(480); + setFixedSize(width(), 550); + ui->centralWidget->setFixedHeight(550); onResize(); ui->stackedWidget->setCurrentIndex(0); @@ -70,6 +76,7 @@ MainWindow::MainWindow(QWidget *parent) : #endif QObject::connect(ui->statusPagePushButton, SIGNAL(released()), this, SLOT(showStatusPage())); + setStatusButtonsVisible(true); QObject::connect(ui->settingsPagePushButton, SIGNAL(released()), this, SLOT(showSettingsPage())); QObject::connect(ui->tunnelsPagePushButton, SIGNAL(released()), this, SLOT(showTunnelsPage())); @@ -226,11 +233,15 @@ MainWindow::MainWindow(QWidget *parent) : //QMetaObject::connectSlotsByName(this); } -void MainWindow::showStatusPage(){ui->stackedWidget->setCurrentIndex(0);} -void MainWindow::showSettingsPage(){ui->stackedWidget->setCurrentIndex(1);} -void MainWindow::showTunnelsPage(){ui->stackedWidget->setCurrentIndex(2);} -void MainWindow::showRestartPage(){ui->stackedWidget->setCurrentIndex(3);} -void MainWindow::showQuitPage(){ui->stackedWidget->setCurrentIndex(4);} +void MainWindow::showStatusPage(){ui->stackedWidget->setCurrentIndex(0);setStatusButtonsVisible(true);} +void MainWindow::showSettingsPage(){ui->stackedWidget->setCurrentIndex(1);setStatusButtonsVisible(false);} +void MainWindow::showTunnelsPage(){ui->stackedWidget->setCurrentIndex(2);setStatusButtonsVisible(false);} +void MainWindow::showRestartPage(){ui->stackedWidget->setCurrentIndex(3);setStatusButtonsVisible(false);} +void MainWindow::showQuitPage(){ui->stackedWidget->setCurrentIndex(4);setStatusButtonsVisible(false);} + +void MainWindow::setStatusButtonsVisible(bool visible) { + ui->statusButtonsPane->setVisible(visible); +} //TODO void MainWindow::resizeEvent(QResizeEvent *event) diff --git a/qt/i2pd_qt/mainwindow.h b/qt/i2pd_qt/mainwindow.h index 05cb7151..fbadf83e 100644 --- a/qt/i2pd_qt/mainwindow.h +++ b/qt/i2pd_qt/mainwindow.h @@ -307,6 +307,7 @@ public: namespace Ui { class MainWindow; +class StatusButtonsForm; } using namespace i2p::client; @@ -359,6 +360,7 @@ private: #endif Ui::MainWindow* ui; + Ui::StatusButtonsForm* statusButtonsUI; i2p::qt::Controller* i2pController; @@ -369,6 +371,8 @@ protected: void resizeEvent(QResizeEvent* event); void onResize(); + void setStatusButtonsVisible(bool visible); + QList configItems; NonGUIOptionItem* logOption; NonGUIOptionItem* daemonOption; diff --git a/qt/i2pd_qt/mainwindow.ui b/qt/i2pd_qt/mainwindow.ui index 0b3071e9..8fb9ffc1 100644 --- a/qt/i2pd_qt/mainwindow.ui +++ b/qt/i2pd_qt/mainwindow.ui @@ -6,10 +6,22 @@ 0 0 - 816 - 516 + 904 + 550 + + + 904 + 0 + + + + + 950 + 16777215 + + MainWindow @@ -22,14 +34,14 @@ - 0 - 516 + 904 + 550 16777215 - 516 + 550 @@ -37,19 +49,27 @@ 10 10 - 796 - 496 + 931 + 498 - QLayout::SetDefaultConstraint + QLayout::SetMaximumSize - + QLayout::SetMinimumSize + + + 0 + 0 + 170 + 496 + + @@ -60,6 +80,22 @@ + + + + + 0 + 0 + + + + + 172 + 0 + + + + @@ -100,6 +136,22 @@ + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 172 + 0 + + + + @@ -136,7 +188,7 @@ - 4 + 0 @@ -231,8 +283,8 @@ 0 0 - 679 - 3000 + 684 + 426 @@ -247,7 +299,7 @@ 10 10 679 - 3000 + 3052 diff --git a/qt/i2pd_qt/statusbuttons.ui b/qt/i2pd_qt/statusbuttons.ui new file mode 100644 index 00000000..79461cd4 --- /dev/null +++ b/qt/i2pd_qt/statusbuttons.ui @@ -0,0 +1,109 @@ + + + StatusButtonsForm + + + + 0 + 0 + 170 + 295 + + + + + 0 + 0 + + + + + 170 + 295 + + + + Form + + + + + 20 + 0 + 151 + 301 + + + + + QLayout::SetDefaultConstraint + + + + + Main page + + + + + + + Router commands + + + + + + + Local destinations + + + + + + + Leasesets + + + + + + + Tunnels + + + + + + + Transit tunnels + + + + + + + Transports + + + + + + + I2P tunnels + + + + + + + SAM sessions + + + + + + + + +