diff --git a/qt/i2pd_qt/DaemonQT.cpp b/qt/i2pd_qt/DaemonQT.cpp index accd69b1..c51e88e3 100644 --- a/qt/i2pd_qt/DaemonQT.cpp +++ b/qt/i2pd_qt/DaemonQT.cpp @@ -162,7 +162,7 @@ namespace qt { i2p::qt::Controller daemonQtController(daemon); qDebug("Starting the daemon..."); - emit daemonQtController.startDaemon(); + //DEBUG //emit daemonQtController.startDaemon(); //daemon.start (); qDebug("Starting GUI event loop..."); result = app.exec(); diff --git a/qt/i2pd_qt/mainwindow.cpp b/qt/i2pd_qt/mainwindow.cpp index 340832f0..03a2f8ea 100644 --- a/qt/i2pd_qt/mainwindow.cpp +++ b/qt/i2pd_qt/mainwindow.cpp @@ -6,6 +6,7 @@ #ifndef ANDROID #include #endif +#include MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), @@ -15,17 +16,46 @@ MainWindow::MainWindow(QWidget *parent) : #endif { ui->setupUi(this); - resize(800, 480); - //ui->stackedWidget->setCurrentIndex(4);//quit page - ui->stackedWidget->setCurrentIndex(1);//sett. page + setFixedSize(width(), 480); + onResize(); + + ui->stackedWidget->setCurrentIndex(0); + ui->settingsScrollArea->resize(ui->settingsContentsGridLayout->sizeHint().width()+10,ui->settingsScrollArea->height()); + QScrollBar* const barSett = ui->settingsScrollArea->verticalScrollBar(); + //QSize szSettContents = ui->settingsContentsGridLayout->minimumSize(); + int w = 683; + int h = 3000; + ui->settingsContents->setFixedSize(w, h); + ui->settingsContents->resize(w, h); + //ui->settingsContents->adjustSize(); + + /* + QPalette pal(palette()); + pal.setColor(QPalette::Background, Qt::red); + ui->settingsContents->setAutoFillBackground(true); + ui->settingsContents->setPalette(pal); + */ + + //ui->settingsScrollArea->adjustSize(); + ui->tunnelsScrollAreaWidgetContents->setFixedSize( + ui->tunnelsScrollArea->width() - barSett->width(), 0); #ifndef ANDROID createActions(); createTrayIcon(); #endif + QObject::connect(ui->statusPagePushButton, SIGNAL(released()), this, SLOT(showStatusPage())); + QObject::connect(ui->settingsPagePushButton, SIGNAL(released()), this, SLOT(showSettingsPage())); + + QObject::connect(ui->tunnelsPagePushButton, SIGNAL(released()), this, SLOT(showTunnelsPage())); + QObject::connect(ui->restartPagePushButton, SIGNAL(released()), this, SLOT(showRestartPage())); + QObject::connect(ui->quitPagePushButton, SIGNAL(released()), this, SLOT(showQuitPage())); + + /* QObject::connect(ui->fastQuitPushButton, SIGNAL(released()), this, SLOT(handleQuitButton())); QObject::connect(ui->gracefulQuitPushButton, SIGNAL(released()), this, SLOT(handleGracefulQuitButton())); +*/ #ifndef ANDROID QObject::connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), @@ -38,6 +68,34 @@ 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::resizeEvent(QResizeEvent *event) +{ + QMainWindow::resizeEvent(event); + onResize(); +} + +void MainWindow::onResize() +{ + if(isVisible()){ + ui->horizontalLayoutWidget->resize(ui->horizontalLayoutWidget->width(), height()); + + //status + ui->statusPage->resize(ui->statusPage->width(), height()); + + //tunnels + ui->tunnelsPage->resize(ui->tunnelsPage->width(), height()); + ui->verticalLayoutWidget_6->resize(ui->verticalLayoutWidget_6->width(), height()-20); + /*ui->tunnelsScrollArea->resize(ui->tunnelsScrollArea->width(), + ui->verticalLayoutWidget_6->height()-ui->label_5->height());*/ + } +} + #ifndef ANDROID void MainWindow::createActions() { toggleWindowVisibleAction = new QAction(tr("&Toggle the window"), this); @@ -106,12 +164,15 @@ void MainWindow::handleQuitButton() { void MainWindow::handleGracefulQuitButton() { qDebug("Graceful Quit pressed."); + /* ui->gracefulQuitPushButton->setText(QApplication::translate("MainWindow", "Graceful quit is in progress", 0)); ui->gracefulQuitPushButton->setEnabled(false); ui->gracefulQuitPushButton->adjustSize(); ui->quitPage->adjustSize(); i2p::context.SetAcceptsTunnels (false); // stop accpting tunnels - QTimer::singleShot(10*60*1000/*millis*/, this, SLOT(handleGracefulQuitTimerEvent())); + QTimer::singleShot(10*60*1000//millis + , this, SLOT(handleGracefulQuitTimerEvent())); + */ } void MainWindow::handleGracefulQuitTimerEvent() { diff --git a/qt/i2pd_qt/mainwindow.h b/qt/i2pd_qt/mainwindow.h index 5e1c0d8b..2af82467 100644 --- a/qt/i2pd_qt/mainwindow.h +++ b/qt/i2pd_qt/mainwindow.h @@ -43,6 +43,11 @@ private slots: void iconActivated(QSystemTrayIcon::ActivationReason reason); void toggleVisibilitySlot(); #endif + void showStatusPage(); + void showSettingsPage(); + void showTunnelsPage(); + void showRestartPage(); + void showQuitPage(); private: #ifndef ANDROID @@ -60,6 +65,8 @@ protected: #ifndef ANDROID void closeEvent(QCloseEvent *event); #endif + void resizeEvent(QResizeEvent* event); + void onResize(); }; #endif // MAINWINDOW_H diff --git a/qt/i2pd_qt/mainwindow.ui b/qt/i2pd_qt/mainwindow.ui index b2382173..8b006b5c 100644 --- a/qt/i2pd_qt/mainwindow.ui +++ b/qt/i2pd_qt/mainwindow.ui @@ -6,26 +6,32 @@ 0 0 - 800 - 3200 + 816 + 3000 MainWindow + + + 0 + 0 + + 10 10 - 781 - 3181 + 801 + 491 - QLayout::SetMaximumSize + QLayout::SetDefaultConstraint @@ -35,7 +41,7 @@ - false + true Status @@ -45,7 +51,7 @@ - false + true Settings @@ -55,7 +61,7 @@ - false + true Tunnels @@ -65,7 +71,7 @@ - false + true Restart @@ -75,7 +81,7 @@ - false + true Quit @@ -99,17 +105,35 @@ + + + 0 + 0 + + + + + 16777215 + 516 + + + + 1 + - 10 + 0 0 - 661 + 671 491 + + QLayout::SetMinAndMaxSize + @@ -139,18 +163,27 @@ + + + 0 + 0 + + 0 0 - 681 - 3171 + 701 + 460 + + QLayout::SetMinAndMaxSize + - + 15 @@ -163,6 +196,15 @@ + + Qt::ScrollBarAlwaysOn + + + Qt::ScrollBarAsNeeded + + + QAbstractScrollArea::AdjustIgnored + true @@ -171,8 +213,8 @@ 0 0 - 677 - 3138 + 684 + 427 @@ -187,10 +229,60 @@ 10 11 661 - 3121 + 3000 - + + + + + + 0 + 0 + + + + + 0 + 46 + + + + + 16777215 + 46 + + + + Configuration file: + + + + + 0 + 18 + 661 + 31 + + + + + QLayout::SetMinimumSize + + + + + + + + Browse… + + + + + + + @@ -340,97 +432,6 @@ - - - - - 0 - 0 - - - - - 0 - 46 - - - - - 16777215 - 46 - - - - Configuration file: - - - - - 0 - 18 - 661 - 31 - - - - - QLayout::SetMinimumSize - - - - - - - - Browse… - - - - - - - - - - - - 0 - 48 - - - - - 16777215 - 48 - - - - Pid file: - - - - - 0 - 20 - 661 - 31 - - - - - - - - - - Browse… - - - - - - - @@ -814,49 +815,6 @@ - - - - - 0 - 60 - - - - - 16777215 - 60 - - - - - 13 - - - - Ports - - - - - - - - 0 - 22 - - - - - 16777215 - 22 - - - - Insomnia (prevent system from sleeping) - - - @@ -1367,30 +1325,6 @@ - - - - - 0 - 60 - - - - - 16777215 - 60 - - - - - 13 - - - - Windows-specific options - - - @@ -1725,22 +1659,6 @@ - - - - Qt::Vertical - - - QSizePolicy::Preferred - - - - 20 - 40 - - - - @@ -2073,13 +1991,13 @@ 0 - 200 + 189 16777215 - 200 + 189 @@ -2175,6 +2093,600 @@ + + + + 0 + 100 + 661 + 31 + + + + + + + Password: + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + 0 + 130 + 661 + 31 + + + + + + + Certificate file: + + + + + + + + + + Browse… + + + + + + + + + 0 + 160 + 661 + 31 + + + + + + + Key file: + + + + + + + + + + Browse… + + + + + + + + + + + + 0 + 108 + + + + + 16777215 + 108 + + + + Limits + + + + + 0 + 20 + 661 + 31 + + + + + + + Maximum number of transit tunnels: + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + 0 + 50 + 661 + 31 + + + + + + + Maximum number of open files (0 — use system limit): + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + 0 + 80 + 661 + 31 + + + + + + + Maximum size of core file in Kb (0 — use system limit): + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + 0 + 60 + + + + + 16777215 + 60 + + + + + 13 + + + + Ports + + + + + + + + 0 + 22 + + + + + 16777215 + 22 + + + + Insomnia (prevent system from sleeping) + + + + + + + + 0 + 48 + + + + + 16777215 + 48 + + + + Pid file: + + + + + 0 + 20 + 661 + 31 + + + + + + + + + + Browse… + + + + + + + + + + + + 0 + 44 + + + + + 16777215 + 44 + + + + Cryptography + + + + + 0 + 20 + 661 + 22 + + + + Use ElGamal precomputed tables + + + + + + + + + 0 + 60 + + + + + 16777215 + 60 + + + + + 13 + + + + Windows-specific options + + + + + + + + 0 + 98 + + + + + 16777215 + 98 + + + + Reseeding + + + + + 0 + 20 + 661 + 22 + + + + Request SU3 signature verification + + + + + + 0 + 40 + 661 + 31 + + + + + + + SU3 file to reseed from: + + + + + + + + + + Browse… + + + + + + + + + 0 + 70 + 661 + 31 + + + + + + + Reseed URLs, separated by comma: + + + + + + + + + + + + + + + 0 + 78 + + + + + 16777215 + 78 + + + + Addressbook settings + + + + + 0 + 20 + 661 + 31 + + + + + + + Addressbook default subscription URL for initial setup: + + + + + + + + + + + + 0 + 50 + 661 + 31 + + + + + + + Addressbook subscriptions URLs, separated by comma: + + + + + + + + + + + + + + + 0 + 60 + + + + + 16777215 + 60 + + + + + 13 + + + + Various options + + + + + + + + 0 + 68 + + + + + 16777215 + 68 + + + + UPnP + + + + + 0 + 20 + 97 + 22 + + + + Enable + + + + + + 0 + 40 + 661 + 31 + + + + + + + Name i2pd appears in UPnP forwardings list: + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + @@ -2190,14 +2702,14 @@ 0 - 10 + 0 681 - 931 + 460 - QLayout::SetMaximumSize + QLayout::SetMinAndMaxSize @@ -2213,6 +2725,9 @@ + + Qt::ScrollBarAlwaysOn + true @@ -2221,21 +2736,10 @@ 0 0 - 98 - 28 + 664 + 427 - - - - 0 - 10 - 661 - 881 - - - - @@ -2253,6 +2757,9 @@ + + QLayout::SetMinAndMaxSize + @@ -2299,14 +2806,14 @@ 0 - 10 + 0 671 - 931 + 480 - QLayout::SetMaximumSize + QLayout::SetMinAndMaxSize