mirror of
				https://github.com/PurpleI2P/i2pd.git
				synced 2025-11-04 08:30:46 +00:00 
			
		
		
		
	qt ui - status commands are now pushbuttons with no handlers
This commit is contained in:
		
							parent
							
								
									856dda68db
								
							
						
					
					
						commit
						db0e02c05d
					
				
					 7 changed files with 130 additions and 13 deletions
				
			
		| 
						 | 
				
			
			@ -177,7 +177,8 @@ INCLUDEPATH += .
 | 
			
		|||
 | 
			
		||||
FORMS += mainwindow.ui \
 | 
			
		||||
    tunnelform.ui \
 | 
			
		||||
    statusbuttons.ui
 | 
			
		||||
    statusbuttons.ui \
 | 
			
		||||
    routercommandswidget.ui
 | 
			
		||||
 | 
			
		||||
LIBS += -lz
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 @@
 | 
			
		|||
#include "Config.h"
 | 
			
		||||
#include "FS.h"
 | 
			
		||||
#include "Log.h"
 | 
			
		||||
#include "RouterContext.h"
 | 
			
		||||
 | 
			
		||||
#include "HTTPServer.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -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) :
 | 
			
		|||
    ,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) :
 | 
			
		|||
{
 | 
			
		||||
    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) :
 | 
			
		|||
    //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) {
 | 
			
		|||
 | 
			
		||||
    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;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -309,7 +309,7 @@ public:
 | 
			
		|||
namespace Ui {
 | 
			
		||||
  class MainWindow;
 | 
			
		||||
  class StatusButtonsForm;
 | 
			
		||||
  class StatusHtmlPaneForm;
 | 
			
		||||
  class routerCommandsWidget;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
using namespace i2p::client;
 | 
			
		||||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
									
										
									
									
									
										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…
	
	Add table
		Add a link
		
	
		Reference in a new issue