mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-02 11:04:00 +01:00
qt forms now work!
This commit is contained in:
parent
5b769869d0
commit
f202fb9af6
|
@ -162,7 +162,7 @@ namespace qt
|
||||||
{
|
{
|
||||||
i2p::qt::Controller daemonQtController(daemon);
|
i2p::qt::Controller daemonQtController(daemon);
|
||||||
qDebug("Starting the daemon...");
|
qDebug("Starting the daemon...");
|
||||||
emit daemonQtController.startDaemon();
|
//DEBUG //emit daemonQtController.startDaemon();
|
||||||
//daemon.start ();
|
//daemon.start ();
|
||||||
qDebug("Starting GUI event loop...");
|
qDebug("Starting GUI event loop...");
|
||||||
result = app.exec();
|
result = app.exec();
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#ifndef ANDROID
|
#ifndef ANDROID
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
#endif
|
#endif
|
||||||
|
#include <QScrollBar>
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent) :
|
MainWindow::MainWindow(QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
|
@ -15,17 +16,46 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
resize(800, 480);
|
setFixedSize(width(), 480);
|
||||||
//ui->stackedWidget->setCurrentIndex(4);//quit page
|
onResize();
|
||||||
ui->stackedWidget->setCurrentIndex(1);//sett. page
|
|
||||||
|
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
|
#ifndef ANDROID
|
||||||
createActions();
|
createActions();
|
||||||
createTrayIcon();
|
createTrayIcon();
|
||||||
#endif
|
#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->fastQuitPushButton, SIGNAL(released()), this, SLOT(handleQuitButton()));
|
||||||
QObject::connect(ui->gracefulQuitPushButton, SIGNAL(released()), this, SLOT(handleGracefulQuitButton()));
|
QObject::connect(ui->gracefulQuitPushButton, SIGNAL(released()), this, SLOT(handleGracefulQuitButton()));
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef ANDROID
|
#ifndef ANDROID
|
||||||
QObject::connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
|
QObject::connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
|
||||||
|
@ -38,6 +68,34 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
//QMetaObject::connectSlotsByName(this);
|
//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
|
#ifndef ANDROID
|
||||||
void MainWindow::createActions() {
|
void MainWindow::createActions() {
|
||||||
toggleWindowVisibleAction = new QAction(tr("&Toggle the window"), this);
|
toggleWindowVisibleAction = new QAction(tr("&Toggle the window"), this);
|
||||||
|
@ -106,12 +164,15 @@ void MainWindow::handleQuitButton() {
|
||||||
|
|
||||||
void MainWindow::handleGracefulQuitButton() {
|
void MainWindow::handleGracefulQuitButton() {
|
||||||
qDebug("Graceful Quit pressed.");
|
qDebug("Graceful Quit pressed.");
|
||||||
|
/*
|
||||||
ui->gracefulQuitPushButton->setText(QApplication::translate("MainWindow", "Graceful quit is in progress", 0));
|
ui->gracefulQuitPushButton->setText(QApplication::translate("MainWindow", "Graceful quit is in progress", 0));
|
||||||
ui->gracefulQuitPushButton->setEnabled(false);
|
ui->gracefulQuitPushButton->setEnabled(false);
|
||||||
ui->gracefulQuitPushButton->adjustSize();
|
ui->gracefulQuitPushButton->adjustSize();
|
||||||
ui->quitPage->adjustSize();
|
ui->quitPage->adjustSize();
|
||||||
i2p::context.SetAcceptsTunnels (false); // stop accpting tunnels
|
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() {
|
void MainWindow::handleGracefulQuitTimerEvent() {
|
||||||
|
|
|
@ -43,6 +43,11 @@ private slots:
|
||||||
void iconActivated(QSystemTrayIcon::ActivationReason reason);
|
void iconActivated(QSystemTrayIcon::ActivationReason reason);
|
||||||
void toggleVisibilitySlot();
|
void toggleVisibilitySlot();
|
||||||
#endif
|
#endif
|
||||||
|
void showStatusPage();
|
||||||
|
void showSettingsPage();
|
||||||
|
void showTunnelsPage();
|
||||||
|
void showRestartPage();
|
||||||
|
void showQuitPage();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifndef ANDROID
|
#ifndef ANDROID
|
||||||
|
@ -60,6 +65,8 @@ protected:
|
||||||
#ifndef ANDROID
|
#ifndef ANDROID
|
||||||
void closeEvent(QCloseEvent *event);
|
void closeEvent(QCloseEvent *event);
|
||||||
#endif
|
#endif
|
||||||
|
void resizeEvent(QResizeEvent* event);
|
||||||
|
void onResize();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue