qt ui - status buttons done

pull/925/head
hypnosis-i2p 7 years ago
parent d6253b1dee
commit b791a6a348

@ -174,7 +174,8 @@ INCLUDEPATH += ../../daemon
INCLUDEPATH += .
FORMS += mainwindow.ui \
tunnelform.ui
tunnelform.ui \
statusbuttons.ui
LIBS += -lz

@ -1,5 +1,6 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "ui_statusbuttons.h"
#include <QMessageBox>
#include <QTimer>
#include <QFile>
@ -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)

@ -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<MainWindowItem*> configItems;
NonGUIOptionItem* logOption;
NonGUIOptionItem* daemonOption;

@ -6,10 +6,22 @@
<rect>
<x>0</x>
<y>0</y>
<width>816</width>
<height>516</height>
<width>904</width>
<height>550</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>904</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>950</width>
<height>16777215</height>
</size>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
@ -22,14 +34,14 @@
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>516</height>
<width>904</width>
<height>550</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>516</height>
<height>550</height>
</size>
</property>
<widget class="QWidget" name="horizontalLayoutWidget">
@ -37,19 +49,27 @@
<rect>
<x>10</x>
<y>10</y>
<width>796</width>
<height>496</height>
<width>931</width>
<height>498</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
<enum>QLayout::SetMaximumSize</enum>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,0,0,0">
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,0,0,0,0,0">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<property name="geometry" stdset="0">
<rect>
<x>0</x>
<y>0</y>
<width>170</width>
<height>496</height>
</rect>
</property>
<item>
<widget class="QPushButton" name="statusPagePushButton">
<property name="enabled">
@ -60,6 +80,22 @@
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="statusButtonsPane" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>172</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="settingsPagePushButton">
<property name="enabled">
@ -100,6 +136,22 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_19">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>172</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
@ -136,7 +188,7 @@
</size>
</property>
<property name="currentIndex">
<number>4</number>
<number>0</number>
</property>
<widget class="QWidget" name="statusPage">
<widget class="QWidget" name="verticalLayoutWidget_5">
@ -231,8 +283,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>679</width>
<height>3000</height>
<width>684</width>
<height>426</height>
</rect>
</property>
<property name="sizePolicy">
@ -247,7 +299,7 @@
<x>10</x>
<y>10</y>
<width>679</width>
<height>3000</height>
<height>3052</height>
</rect>
</property>
<layout class="QGridLayout" name="settingsContentsGridLayout" rowstretch="0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0">

@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>StatusButtonsForm</class>
<widget class="QWidget" name="StatusButtonsForm">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>170</width>
<height>295</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>170</width>
<height>295</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry">
<rect>
<x>20</x>
<y>0</y>
<width>151</width>
<height>301</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<widget class="QPushButton" name="mainPagePushButton">
<property name="text">
<string>Main page</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="routerCommandsPushButton">
<property name="text">
<string>Router commands</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="localDestinationsPushButton">
<property name="text">
<string>Local destinations</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="leasesetsPushButton">
<property name="text">
<string>Leasesets</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="tunnelsPushButton">
<property name="text">
<string>Tunnels</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="transitTunnelsPushButton">
<property name="text">
<string>Transit tunnels</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="transportsPushButton">
<property name="text">
<string>Transports</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="i2pTunnelsPushButton">
<property name="text">
<string>I2P tunnels</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="samSessionsPushButton">
<property name="text">
<string>SAM sessions</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>
Loading…
Cancel
Save