mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 16:34:13 +00:00
Merge pull request #536 from hypnosis-i2p/openssl
Added graceful quit button; the code for stopping tunnels pending
This commit is contained in:
commit
8cc3a08871
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<manifest package="org.purplei2p.i2pd" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="2.8.0" android:versionCode="1" android:installLocation="auto">
|
<manifest package="org.purplei2p.i2pd" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="2.8.0" android:versionCode="2" android:installLocation="auto">
|
||||||
<uses-sdk android:minSdkVersion="11" android:targetSdkVersion="23"/>
|
<uses-sdk android:minSdkVersion="11" android:targetSdkVersion="23"/>
|
||||||
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
|
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
|
||||||
<!-- <application android:hardwareAccelerated="true" -->
|
<!-- <application android:hardwareAccelerated="true" -->
|
||||||
|
@ -10,7 +10,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
|||||||
|
|
||||||
TARGET = i2pd_qt
|
TARGET = i2pd_qt
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
QMAKE_CXXFLAGS *= -std=c++11 -DUSE_UPNP
|
QMAKE_CXXFLAGS *= -std=c++11
|
||||||
|
|
||||||
# git clone https://github.com/PurpleI2P/Boost-for-Android-Prebuilt.git
|
# git clone https://github.com/PurpleI2P/Boost-for-Android-Prebuilt.git
|
||||||
# git clone https://github.com/PurpleI2P/OpenSSL-for-Android-Prebuilt.git
|
# git clone https://github.com/PurpleI2P/OpenSSL-for-Android-Prebuilt.git
|
||||||
@ -29,7 +29,7 @@ IFADDRS_PATH = /mnt/media/android/android-ifaddrs
|
|||||||
|
|
||||||
SOURCES += DaemonQT.cpp\
|
SOURCES += DaemonQT.cpp\
|
||||||
mainwindow.cpp \
|
mainwindow.cpp \
|
||||||
../../HTTPServer.cpp ../../I2PControl.cpp ../../UPnP.cpp ../../Daemon.cpp ../../Config.cpp \
|
../../HTTPServer.cpp ../../I2PControl.cpp ../../Daemon.cpp ../../Config.cpp \
|
||||||
../../AddressBook.cpp \
|
../../AddressBook.cpp \
|
||||||
../../api.cpp \
|
../../api.cpp \
|
||||||
../../Base.cpp \
|
../../Base.cpp \
|
||||||
@ -72,8 +72,7 @@ SOURCES += DaemonQT.cpp\
|
|||||||
../../TunnelGateway.cpp \
|
../../TunnelGateway.cpp \
|
||||||
../../TunnelPool.cpp \
|
../../TunnelPool.cpp \
|
||||||
../../util.cpp \
|
../../util.cpp \
|
||||||
../../i2pd.cpp \
|
../../i2pd.cpp
|
||||||
$$IFADDRS_PATH/ifaddrs.c
|
|
||||||
|
|
||||||
HEADERS += DaemonQT.h mainwindow.h \
|
HEADERS += DaemonQT.h mainwindow.h \
|
||||||
../../HTTPServer.h ../../I2PControl.h ../../UPnP.h ../../Daemon.h ../../Config.h \
|
../../HTTPServer.h ../../I2PControl.h ../../UPnP.h ../../Daemon.h ../../Config.h \
|
||||||
@ -125,8 +124,7 @@ HEADERS += DaemonQT.h mainwindow.h \
|
|||||||
../../TunnelGateway.h \
|
../../TunnelGateway.h \
|
||||||
../../TunnelPool.h \
|
../../TunnelPool.h \
|
||||||
../../util.h \
|
../../util.h \
|
||||||
../../version.h \
|
../../version.h
|
||||||
$$IFADDRS_PATH/ifaddrs.h
|
|
||||||
|
|
||||||
FORMS += mainwindow.ui
|
FORMS += mainwindow.ui
|
||||||
|
|
||||||
@ -140,6 +138,8 @@ android {
|
|||||||
message("Using Android settings")
|
message("Using Android settings")
|
||||||
DEFINES += ANDROID=1
|
DEFINES += ANDROID=1
|
||||||
DEFINES += __ANDROID__
|
DEFINES += __ANDROID__
|
||||||
|
DEFINES += USE_UPNP
|
||||||
|
|
||||||
INCLUDEPATH += $$BOOST_PATH/boost_1_53_0/include \
|
INCLUDEPATH += $$BOOST_PATH/boost_1_53_0/include \
|
||||||
$$OPENSSL_PATH/openssl-1.0.2/include \
|
$$OPENSSL_PATH/openssl-1.0.2/include \
|
||||||
$$MINIUPNP_PATH/miniupnp-2.0/include \
|
$$MINIUPNP_PATH/miniupnp-2.0/include \
|
||||||
@ -149,6 +149,9 @@ DISTFILES += \
|
|||||||
|
|
||||||
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
|
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
|
||||||
|
|
||||||
|
SOURCES += $$IFADDRS_PATH/ifaddrs.c ../../UPnP.cpp
|
||||||
|
HEADERS += $$IFADDRS_PATH/ifaddrs.h
|
||||||
|
|
||||||
equals(ANDROID_TARGET_ARCH, armeabi-v7a){
|
equals(ANDROID_TARGET_ARCH, armeabi-v7a){
|
||||||
|
|
||||||
DEFINES += ANDROID_ARM7A
|
DEFINES += ANDROID_ARM7A
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
//#include "ui_mainwindow.h"
|
//#include "ui_mainwindow.h"
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent) :
|
MainWindow::MainWindow(QWidget *parent) :
|
||||||
QMainWindow(parent)/*,
|
QMainWindow(parent)/*,
|
||||||
@ -22,20 +23,29 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
verticalLayout1->setContentsMargins(0, 0, 0, 0);
|
verticalLayout1->setContentsMargins(0, 0, 0, 0);
|
||||||
quitButton = new QPushButton(verticalLayoutWidget);
|
quitButton = new QPushButton(verticalLayoutWidget);
|
||||||
quitButton->setObjectName(QStringLiteral("quitButton"));
|
quitButton->setObjectName(QStringLiteral("quitButton"));
|
||||||
QSizePolicy sizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
|
QSizePolicy sizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
||||||
sizePolicy.setHorizontalStretch(0);
|
sizePolicy.setHorizontalStretch(1);
|
||||||
sizePolicy.setVerticalStretch(0);
|
//sizePolicy.setVerticalStretch(1);
|
||||||
sizePolicy.setHeightForWidth(quitButton->sizePolicy().hasHeightForWidth());
|
sizePolicy.setHeightForWidth(quitButton->sizePolicy().hasHeightForWidth());
|
||||||
quitButton->setSizePolicy(sizePolicy);
|
quitButton->setSizePolicy(sizePolicy);
|
||||||
|
|
||||||
verticalLayout1->addWidget(quitButton);
|
verticalLayout1->addWidget(quitButton);
|
||||||
|
gracefulQuitButton = new QPushButton(verticalLayoutWidget);
|
||||||
|
gracefulQuitButton->setObjectName(QStringLiteral("gracefulQuitButton"));
|
||||||
|
QSizePolicy sizePolicy2(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
||||||
|
sizePolicy2.setHorizontalStretch(1);
|
||||||
|
//sizePolicy2.setVerticalStretch(1);
|
||||||
|
sizePolicy2.setHeightForWidth(gracefulQuitButton->sizePolicy().hasHeightForWidth());
|
||||||
|
gracefulQuitButton->setSizePolicy(sizePolicy2);
|
||||||
|
verticalLayout1->addWidget(gracefulQuitButton);
|
||||||
|
|
||||||
setCentralWidget(centralWidget);
|
setCentralWidget(centralWidget);
|
||||||
|
|
||||||
setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0));
|
setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0));
|
||||||
quitButton->setText(QApplication::translate("MainWindow", "Quit", 0));
|
quitButton->setText(QApplication::translate("MainWindow", "Quit", 0));
|
||||||
|
gracefulQuitButton->setText(QApplication::translate("MainWindow", "Graceful Quit", 0));
|
||||||
|
|
||||||
QObject::connect(quitButton, SIGNAL(released()), this, SLOT(handleQuitButton()));
|
QObject::connect(quitButton, SIGNAL(released()), this, SLOT(handleQuitButton()));
|
||||||
|
QObject::connect(gracefulQuitButton, SIGNAL(released()), this, SLOT(handleGracefulQuitButton()));
|
||||||
|
|
||||||
//QMetaObject::connectSlotsByName(this);
|
//QMetaObject::connectSlotsByName(this);
|
||||||
}
|
}
|
||||||
@ -46,6 +56,23 @@ void MainWindow::handleQuitButton() {
|
|||||||
QApplication::instance()->quit();
|
QApplication::instance()->quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::handleGracefulQuitButton() {
|
||||||
|
qDebug("Graceful Quit pressed.");
|
||||||
|
gracefulQuitButton->setText(QApplication::translate("MainWindow", "Graceful quit is in progress", 0));
|
||||||
|
gracefulQuitButton->setEnabled(false);
|
||||||
|
gracefulQuitButton->adjustSize();
|
||||||
|
verticalLayoutWidget->adjustSize();
|
||||||
|
//here, the code to stop tunnels
|
||||||
|
QTimer::singleShot(10*60*1000/*millis*/, this, SLOT(handleGracefulQuitTimerEvent()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::handleGracefulQuitTimerEvent() {
|
||||||
|
qDebug("Hiding the main window");
|
||||||
|
close();
|
||||||
|
qDebug("Performing quit");
|
||||||
|
QApplication::instance()->quit();
|
||||||
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
{
|
{
|
||||||
qDebug("Destroying main window");
|
qDebug("Destroying main window");
|
||||||
|
@ -27,12 +27,15 @@ public:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleQuitButton();
|
void handleQuitButton();
|
||||||
|
void handleGracefulQuitButton();
|
||||||
|
void handleGracefulQuitTimerEvent();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWidget *centralWidget;
|
QWidget *centralWidget;
|
||||||
QWidget *verticalLayoutWidget;
|
QWidget *verticalLayoutWidget;
|
||||||
QVBoxLayout *verticalLayout1;
|
QVBoxLayout *verticalLayout1;
|
||||||
QPushButton *quitButton;
|
QPushButton *quitButton;
|
||||||
|
QPushButton *gracefulQuitButton;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
@ -37,6 +37,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="gracefulShutdownButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Graceful Quit</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
@ -60,8 +67,25 @@
|
|||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>gracefulShutdownButton</sender>
|
||||||
|
<signal>released()</signal>
|
||||||
|
<receiver>MainWindow</receiver>
|
||||||
|
<slot>handleGracefulQuitButton()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>395</x>
|
||||||
|
<y>319</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>399</x>
|
||||||
|
<y>239</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
<slots>
|
<slots>
|
||||||
<slot>handleQuitButton()</slot>
|
<slot>handleQuitButton()</slot>
|
||||||
|
<slot>handleGracefulQuitButton()</slot>
|
||||||
</slots>
|
</slots>
|
||||||
</ui>
|
</ui>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user