Browse Source

qt ui - status commands are now pushbuttons with no handlers

pull/925/head
hypnosis-i2p 7 years ago
parent
commit
db0e02c05d
  1. 2
      daemon/HTTPServer.cpp
  2. 1
      daemon/HTTPServer.h
  3. 3
      qt/i2pd_qt/i2pd_qt.pro
  4. 32
      qt/i2pd_qt/mainwindow.cpp
  5. 7
      qt/i2pd_qt/mainwindow.h
  6. 4
      qt/i2pd_qt/mainwindow.ui
  7. 94
      qt/i2pd_qt/routercommandswidget.ui

2
daemon/HTTPServer.cpp

@ -454,7 +454,7 @@ namespace http { @@ -454,7 +454,7 @@ namespace http {
s << "<br>\r\n";
}
void ShowCommands (std::stringstream& s, uint32_t token)
static void ShowCommands (std::stringstream& s, uint32_t token)
{
/* commands */
s << "<b>Router Commands</b><br>\r\n";

1
daemon/HTTPServer.h

@ -82,7 +82,6 @@ namespace http @@ -82,7 +82,6 @@ namespace http
void ShowLocalDestinations (std::stringstream& s);
void ShowLeasesSets(std::stringstream& s);
void ShowTunnels (std::stringstream& s);
void ShowCommands (std::stringstream& s, uint32_t token);
void ShowTransitTunnels (std::stringstream& s);
void ShowTransports (std::stringstream& s);
void ShowSAMSessions (std::stringstream& s);

3
qt/i2pd_qt/i2pd_qt.pro

@ -177,7 +177,8 @@ INCLUDEPATH += . @@ -177,7 +177,8 @@ INCLUDEPATH += .
FORMS += mainwindow.ui \
tunnelform.ui \
statusbuttons.ui
statusbuttons.ui \
routercommandswidget.ui
LIBS += -lz

32
qt/i2pd_qt/mainwindow.cpp

@ -1,9 +1,11 @@ @@ -1,9 +1,11 @@
#include <fstream>
#include <assert.h>
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "ui_statusbuttons.h"
#include "ui_statushtmlpaneform.h"
#include "ui_routercommandswidget.h"
#include <sstream>
#include <QScrollBar>
#include <QMessageBox>
#include <QTimer>
#include <QFile>
@ -12,6 +14,7 @@ @@ -12,6 +14,7 @@
#include "Config.h"
#include "FS.h"
#include "Log.h"
#include "RouterContext.h"
#include "HTTPServer.h"
@ -19,10 +22,6 @@ @@ -19,10 +22,6 @@
# include <QtDebug>
#endif
#include <QScrollBar>
#include <fstream>
#include "DaemonQT.h"
#include "SignatureTypeComboboxFactory.h"
@ -37,6 +36,8 @@ MainWindow::MainWindow(QWidget *parent) : @@ -37,6 +36,8 @@ MainWindow::MainWindow(QWidget *parent) :
,showHiddenInfoStatusMainPage(false)
,ui(new Ui::MainWindow)
,statusButtonsUI(new Ui::StatusButtonsForm)
,routerCommandsUI(new Ui::routerCommandsWidget)
,routerCommandsParent(new QWidget(this))
,i2pController(nullptr)
,configItems()
,datadir()
@ -47,6 +48,9 @@ MainWindow::MainWindow(QWidget *parent) : @@ -47,6 +48,9 @@ MainWindow::MainWindow(QWidget *parent) :
{
ui->setupUi(this);
statusButtonsUI->setupUi(ui->statusButtonsPane);
routerCommandsUI->setupUi(routerCommandsParent);
routerCommandsParent->hide();
ui->verticalLayout_2->addWidget(routerCommandsParent);
//,statusHtmlUI(new Ui::StatusHtmlPaneForm)
//statusHtmlUI->setupUi(lastStatusWidgetui->statusWidget);
ui->statusButtonsPane->setFixedSize(171,300);
@ -260,12 +264,26 @@ MainWindow::MainWindow(QWidget *parent) : @@ -260,12 +264,26 @@ MainWindow::MainWindow(QWidget *parent) :
//QMetaObject::connectSlotsByName(this);
}
void MainWindow::updateRouterCommandsButtons() {
bool acceptsTunnels = i2p::context.AcceptsTunnels ();
routerCommandsUI->declineTransitTunnelsPushButton->setEnabled(acceptsTunnels);
routerCommandsUI->acceptTransitTunnelsPushButton->setEnabled(!acceptsTunnels);
}
void MainWindow::showStatusPage(StatusPage newStatusPage){
ui->stackedWidget->setCurrentIndex(0);
setStatusButtonsVisible(true);
statusPage=newStatusPage;
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;
}
void MainWindow::showSettingsPage(){ui->stackedWidget->setCurrentIndex(1);setStatusButtonsVisible(false);}
@ -283,7 +301,7 @@ QString MainWindow::getStatusPageHtml(bool showHiddenInfo) { @@ -283,7 +301,7 @@ QString MainWindow::getStatusPageHtml(bool showHiddenInfo) {
switch (statusPage) {
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 leasesets: i2p::http::ShowLeasesSets(s); break;
case tunnels: i2p::http::ShowTunnels(s); break;

7
qt/i2pd_qt/mainwindow.h

@ -309,7 +309,7 @@ public: @@ -309,7 +309,7 @@ public:
namespace Ui {
class MainWindow;
class StatusButtonsForm;
class StatusHtmlPaneForm;
class routerCommandsWidget;
}
using namespace i2p::client;
@ -388,12 +388,17 @@ private: @@ -388,12 +388,17 @@ private:
Ui::MainWindow* ui;
Ui::StatusButtonsForm* statusButtonsUI;
Ui::routerCommandsWidget* routerCommandsUI;
TextBrowserTweaked1 * textBrowser;
QWidget * routerCommandsParent;
i2p::qt::Controller* i2pController;
protected:
void updateRouterCommandsButtons();
#ifndef ANDROID
void closeEvent(QCloseEvent *event);
#endif

4
qt/i2pd_qt/mainwindow.ui

@ -283,8 +283,8 @@ @@ -283,8 +283,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>80</width>
<height>26</height>
<width>689</width>
<height>496</height>
</rect>
</property>
<property name="sizePolicy">

94
qt/i2pd_qt/routercommandswidget.ui

@ -0,0 +1,94 @@ @@ -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…
Cancel
Save