mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 04:04:16 +00:00
qt ui - status commands are now pushbuttons with no handlers
This commit is contained in:
parent
856dda68db
commit
db0e02c05d
@ -454,7 +454,7 @@ namespace http {
|
|||||||
s << "<br>\r\n";
|
s << "<br>\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShowCommands (std::stringstream& s, uint32_t token)
|
static void ShowCommands (std::stringstream& s, uint32_t token)
|
||||||
{
|
{
|
||||||
/* commands */
|
/* commands */
|
||||||
s << "<b>Router Commands</b><br>\r\n";
|
s << "<b>Router Commands</b><br>\r\n";
|
||||||
|
@ -82,7 +82,6 @@ namespace http
|
|||||||
void ShowLocalDestinations (std::stringstream& s);
|
void ShowLocalDestinations (std::stringstream& s);
|
||||||
void ShowLeasesSets(std::stringstream& s);
|
void ShowLeasesSets(std::stringstream& s);
|
||||||
void ShowTunnels (std::stringstream& s);
|
void ShowTunnels (std::stringstream& s);
|
||||||
void ShowCommands (std::stringstream& s, uint32_t token);
|
|
||||||
void ShowTransitTunnels (std::stringstream& s);
|
void ShowTransitTunnels (std::stringstream& s);
|
||||||
void ShowTransports (std::stringstream& s);
|
void ShowTransports (std::stringstream& s);
|
||||||
void ShowSAMSessions (std::stringstream& s);
|
void ShowSAMSessions (std::stringstream& s);
|
||||||
|
@ -177,7 +177,8 @@ INCLUDEPATH += .
|
|||||||
|
|
||||||
FORMS += mainwindow.ui \
|
FORMS += mainwindow.ui \
|
||||||
tunnelform.ui \
|
tunnelform.ui \
|
||||||
statusbuttons.ui
|
statusbuttons.ui \
|
||||||
|
routercommandswidget.ui
|
||||||
|
|
||||||
LIBS += -lz
|
LIBS += -lz
|
||||||
|
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
|
#include <fstream>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
#include "ui_statusbuttons.h"
|
#include "ui_statusbuttons.h"
|
||||||
#include "ui_statushtmlpaneform.h"
|
#include "ui_routercommandswidget.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <QScrollBar>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
@ -12,6 +14,7 @@
|
|||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "FS.h"
|
#include "FS.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
|
#include "RouterContext.h"
|
||||||
|
|
||||||
#include "HTTPServer.h"
|
#include "HTTPServer.h"
|
||||||
|
|
||||||
@ -19,10 +22,6 @@
|
|||||||
# include <QtDebug>
|
# include <QtDebug>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <QScrollBar>
|
|
||||||
|
|
||||||
#include <fstream>
|
|
||||||
|
|
||||||
#include "DaemonQT.h"
|
#include "DaemonQT.h"
|
||||||
#include "SignatureTypeComboboxFactory.h"
|
#include "SignatureTypeComboboxFactory.h"
|
||||||
|
|
||||||
@ -37,6 +36,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
,showHiddenInfoStatusMainPage(false)
|
,showHiddenInfoStatusMainPage(false)
|
||||||
,ui(new Ui::MainWindow)
|
,ui(new Ui::MainWindow)
|
||||||
,statusButtonsUI(new Ui::StatusButtonsForm)
|
,statusButtonsUI(new Ui::StatusButtonsForm)
|
||||||
|
,routerCommandsUI(new Ui::routerCommandsWidget)
|
||||||
|
,routerCommandsParent(new QWidget(this))
|
||||||
,i2pController(nullptr)
|
,i2pController(nullptr)
|
||||||
,configItems()
|
,configItems()
|
||||||
,datadir()
|
,datadir()
|
||||||
@ -47,6 +48,9 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
statusButtonsUI->setupUi(ui->statusButtonsPane);
|
statusButtonsUI->setupUi(ui->statusButtonsPane);
|
||||||
|
routerCommandsUI->setupUi(routerCommandsParent);
|
||||||
|
routerCommandsParent->hide();
|
||||||
|
ui->verticalLayout_2->addWidget(routerCommandsParent);
|
||||||
//,statusHtmlUI(new Ui::StatusHtmlPaneForm)
|
//,statusHtmlUI(new Ui::StatusHtmlPaneForm)
|
||||||
//statusHtmlUI->setupUi(lastStatusWidgetui->statusWidget);
|
//statusHtmlUI->setupUi(lastStatusWidgetui->statusWidget);
|
||||||
ui->statusButtonsPane->setFixedSize(171,300);
|
ui->statusButtonsPane->setFixedSize(171,300);
|
||||||
@ -260,12 +264,26 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
//QMetaObject::connectSlotsByName(this);
|
//QMetaObject::connectSlotsByName(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::updateRouterCommandsButtons() {
|
||||||
|
bool acceptsTunnels = i2p::context.AcceptsTunnels ();
|
||||||
|
routerCommandsUI->declineTransitTunnelsPushButton->setEnabled(acceptsTunnels);
|
||||||
|
routerCommandsUI->acceptTransitTunnelsPushButton->setEnabled(!acceptsTunnels);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::showStatusPage(StatusPage newStatusPage){
|
void MainWindow::showStatusPage(StatusPage newStatusPage){
|
||||||
ui->stackedWidget->setCurrentIndex(0);
|
ui->stackedWidget->setCurrentIndex(0);
|
||||||
setStatusButtonsVisible(true);
|
setStatusButtonsVisible(true);
|
||||||
statusPage=newStatusPage;
|
statusPage=newStatusPage;
|
||||||
showHiddenInfoStatusMainPage=false;
|
showHiddenInfoStatusMainPage=false;
|
||||||
textBrowser->setHtml(getStatusPageHtml(false));
|
if(newStatusPage!=StatusPage::commands){
|
||||||
|
textBrowser->setHtml(getStatusPageHtml(false));
|
||||||
|
textBrowser->show();
|
||||||
|
routerCommandsParent->hide();
|
||||||
|
}else{
|
||||||
|
routerCommandsParent->show();
|
||||||
|
textBrowser->hide();
|
||||||
|
updateRouterCommandsButtons();
|
||||||
|
}
|
||||||
wasSelectingAtStatusMainPage=false;
|
wasSelectingAtStatusMainPage=false;
|
||||||
}
|
}
|
||||||
void MainWindow::showSettingsPage(){ui->stackedWidget->setCurrentIndex(1);setStatusButtonsVisible(false);}
|
void MainWindow::showSettingsPage(){ui->stackedWidget->setCurrentIndex(1);setStatusButtonsVisible(false);}
|
||||||
@ -283,7 +301,7 @@ QString MainWindow::getStatusPageHtml(bool showHiddenInfo) {
|
|||||||
|
|
||||||
switch (statusPage) {
|
switch (statusPage) {
|
||||||
case main_page: i2p::http::ShowStatus(s, showHiddenInfo);break;
|
case main_page: i2p::http::ShowStatus(s, showHiddenInfo);break;
|
||||||
case commands: i2p::http::ShowCommands(s, /*token=*/0); break;
|
case commands: break;
|
||||||
case local_destinations: i2p::http::ShowLocalDestinations(s);break;
|
case local_destinations: i2p::http::ShowLocalDestinations(s);break;
|
||||||
case leasesets: i2p::http::ShowLeasesSets(s); break;
|
case leasesets: i2p::http::ShowLeasesSets(s); break;
|
||||||
case tunnels: i2p::http::ShowTunnels(s); break;
|
case tunnels: i2p::http::ShowTunnels(s); break;
|
||||||
|
@ -309,7 +309,7 @@ public:
|
|||||||
namespace Ui {
|
namespace Ui {
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
class StatusButtonsForm;
|
class StatusButtonsForm;
|
||||||
class StatusHtmlPaneForm;
|
class routerCommandsWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
using namespace i2p::client;
|
using namespace i2p::client;
|
||||||
@ -388,12 +388,17 @@ private:
|
|||||||
|
|
||||||
Ui::MainWindow* ui;
|
Ui::MainWindow* ui;
|
||||||
Ui::StatusButtonsForm* statusButtonsUI;
|
Ui::StatusButtonsForm* statusButtonsUI;
|
||||||
|
Ui::routerCommandsWidget* routerCommandsUI;
|
||||||
|
|
||||||
TextBrowserTweaked1 * textBrowser;
|
TextBrowserTweaked1 * textBrowser;
|
||||||
|
QWidget * routerCommandsParent;
|
||||||
|
|
||||||
i2p::qt::Controller* i2pController;
|
i2p::qt::Controller* i2pController;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
void updateRouterCommandsButtons();
|
||||||
|
|
||||||
#ifndef ANDROID
|
#ifndef ANDROID
|
||||||
void closeEvent(QCloseEvent *event);
|
void closeEvent(QCloseEvent *event);
|
||||||
#endif
|
#endif
|
||||||
|
@ -283,8 +283,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>80</width>
|
<width>689</width>
|
||||||
<height>26</height>
|
<height>496</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
94
qt/i2pd_qt/routercommandswidget.ui
Normal file
94
qt/i2pd_qt/routercommandswidget.ui
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>routerCommandsWidget</class>
|
||||||
|
<widget class="QWidget" name="routerCommandsWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>300</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="verticalLayoutWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>401</width>
|
||||||
|
<height>301</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Router Commands</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="runPeerTestPushButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Run peer test</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="declineTransitTunnelsPushButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Decline transit tunnels</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="acceptTransitTunnelsPushButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Accept transit tunnels</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="cancelGracefulQuitPushButton">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Cancel graceful quit</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
Loading…
x
Reference in New Issue
Block a user