Browse Source

qt ui - status buttons done

pull/925/head
hypnosis-i2p 7 years ago
parent
commit
b791a6a348
  1. 3
      qt/i2pd_qt/i2pd_qt.pro
  2. 27
      qt/i2pd_qt/mainwindow.cpp
  3. 4
      qt/i2pd_qt/mainwindow.h
  4. 78
      qt/i2pd_qt/mainwindow.ui
  5. 109
      qt/i2pd_qt/statusbuttons.ui

3
qt/i2pd_qt/i2pd_qt.pro

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

27
qt/i2pd_qt/mainwindow.cpp

@ -1,5 +1,6 @@
#include "mainwindow.h" #include "mainwindow.h"
#include "ui_mainwindow.h" #include "ui_mainwindow.h"
#include "ui_statusbuttons.h"
#include <QMessageBox> #include <QMessageBox>
#include <QTimer> #include <QTimer>
#include <QFile> #include <QFile>
@ -28,6 +29,7 @@ MainWindow::MainWindow(QWidget *parent) :
,quitting(false) ,quitting(false)
#endif #endif
,ui(new Ui::MainWindow) ,ui(new Ui::MainWindow)
,statusButtonsUI(new Ui::StatusButtonsForm)
,i2pController(nullptr) ,i2pController(nullptr)
,configItems() ,configItems()
,datadir() ,datadir()
@ -37,12 +39,16 @@ MainWindow::MainWindow(QWidget *parent) :
{ {
ui->setupUi(this); 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")); setWindowTitle(QApplication::translate("AppTitle","I2PD"));
//TODO handle resizes and change the below into resize() call //TODO handle resizes and change the below into resize() call
setFixedSize(width(), 480); setFixedSize(width(), 550);
ui->centralWidget->setMinimumHeight(480); ui->centralWidget->setFixedHeight(550);
ui->centralWidget->setMaximumHeight(480);
onResize(); onResize();
ui->stackedWidget->setCurrentIndex(0); ui->stackedWidget->setCurrentIndex(0);
@ -70,6 +76,7 @@ MainWindow::MainWindow(QWidget *parent) :
#endif #endif
QObject::connect(ui->statusPagePushButton, SIGNAL(released()), this, SLOT(showStatusPage())); QObject::connect(ui->statusPagePushButton, SIGNAL(released()), this, SLOT(showStatusPage()));
setStatusButtonsVisible(true);
QObject::connect(ui->settingsPagePushButton, SIGNAL(released()), this, SLOT(showSettingsPage())); QObject::connect(ui->settingsPagePushButton, SIGNAL(released()), this, SLOT(showSettingsPage()));
QObject::connect(ui->tunnelsPagePushButton, SIGNAL(released()), this, SLOT(showTunnelsPage())); QObject::connect(ui->tunnelsPagePushButton, SIGNAL(released()), this, SLOT(showTunnelsPage()));
@ -226,11 +233,15 @@ MainWindow::MainWindow(QWidget *parent) :
//QMetaObject::connectSlotsByName(this); //QMetaObject::connectSlotsByName(this);
} }
void MainWindow::showStatusPage(){ui->stackedWidget->setCurrentIndex(0);} void MainWindow::showStatusPage(){ui->stackedWidget->setCurrentIndex(0);setStatusButtonsVisible(true);}
void MainWindow::showSettingsPage(){ui->stackedWidget->setCurrentIndex(1);} void MainWindow::showSettingsPage(){ui->stackedWidget->setCurrentIndex(1);setStatusButtonsVisible(false);}
void MainWindow::showTunnelsPage(){ui->stackedWidget->setCurrentIndex(2);} void MainWindow::showTunnelsPage(){ui->stackedWidget->setCurrentIndex(2);setStatusButtonsVisible(false);}
void MainWindow::showRestartPage(){ui->stackedWidget->setCurrentIndex(3);} void MainWindow::showRestartPage(){ui->stackedWidget->setCurrentIndex(3);setStatusButtonsVisible(false);}
void MainWindow::showQuitPage(){ui->stackedWidget->setCurrentIndex(4);} void MainWindow::showQuitPage(){ui->stackedWidget->setCurrentIndex(4);setStatusButtonsVisible(false);}
void MainWindow::setStatusButtonsVisible(bool visible) {
ui->statusButtonsPane->setVisible(visible);
}
//TODO //TODO
void MainWindow::resizeEvent(QResizeEvent *event) void MainWindow::resizeEvent(QResizeEvent *event)

4
qt/i2pd_qt/mainwindow.h

@ -307,6 +307,7 @@ public:
namespace Ui { namespace Ui {
class MainWindow; class MainWindow;
class StatusButtonsForm;
} }
using namespace i2p::client; using namespace i2p::client;
@ -359,6 +360,7 @@ private:
#endif #endif
Ui::MainWindow* ui; Ui::MainWindow* ui;
Ui::StatusButtonsForm* statusButtonsUI;
i2p::qt::Controller* i2pController; i2p::qt::Controller* i2pController;
@ -369,6 +371,8 @@ protected:
void resizeEvent(QResizeEvent* event); void resizeEvent(QResizeEvent* event);
void onResize(); void onResize();
void setStatusButtonsVisible(bool visible);
QList<MainWindowItem*> configItems; QList<MainWindowItem*> configItems;
NonGUIOptionItem* logOption; NonGUIOptionItem* logOption;
NonGUIOptionItem* daemonOption; NonGUIOptionItem* daemonOption;

78
qt/i2pd_qt/mainwindow.ui

@ -6,10 +6,22 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>816</width> <width>904</width>
<height>516</height> <height>550</height>
</rect> </rect>
</property> </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"> <property name="windowTitle">
<string>MainWindow</string> <string>MainWindow</string>
</property> </property>
@ -22,14 +34,14 @@
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>904</width>
<height>516</height> <height>550</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>16777215</width> <width>16777215</width>
<height>516</height> <height>550</height>
</size> </size>
</property> </property>
<widget class="QWidget" name="horizontalLayoutWidget"> <widget class="QWidget" name="horizontalLayoutWidget">
@ -37,19 +49,27 @@
<rect> <rect>
<x>10</x> <x>10</x>
<y>10</y> <y>10</y>
<width>796</width> <width>931</width>
<height>496</height> <height>498</height>
</rect> </rect>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<property name="sizeConstraint"> <property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum> <enum>QLayout::SetMaximumSize</enum>
</property> </property>
<item> <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"> <property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum> <enum>QLayout::SetMinimumSize</enum>
</property> </property>
<property name="geometry" stdset="0">
<rect>
<x>0</x>
<y>0</y>
<width>170</width>
<height>496</height>
</rect>
</property>
<item> <item>
<widget class="QPushButton" name="statusPagePushButton"> <widget class="QPushButton" name="statusPagePushButton">
<property name="enabled"> <property name="enabled">
@ -60,6 +80,22 @@
</property> </property>
</widget> </widget>
</item> </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> <item>
<widget class="QPushButton" name="settingsPagePushButton"> <widget class="QPushButton" name="settingsPagePushButton">
<property name="enabled"> <property name="enabled">
@ -100,6 +136,22 @@
</property> </property>
</widget> </widget>
</item> </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> <item>
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
@ -136,7 +188,7 @@
</size> </size>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>4</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="statusPage"> <widget class="QWidget" name="statusPage">
<widget class="QWidget" name="verticalLayoutWidget_5"> <widget class="QWidget" name="verticalLayoutWidget_5">
@ -231,8 +283,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>679</width> <width>684</width>
<height>3000</height> <height>426</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -247,7 +299,7 @@
<x>10</x> <x>10</x>
<y>10</y> <y>10</y>
<width>679</width> <width>679</width>
<height>3000</height> <height>3052</height>
</rect> </rect>
</property> </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"> <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">

109
qt/i2pd_qt/statusbuttons.ui

@ -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