mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03: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"?>
|
||||
<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"/>
|
||||
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
|
||||
<!-- <application android:hardwareAccelerated="true" -->
|
||||
|
@ -10,7 +10,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = i2pd_qt
|
||||
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/OpenSSL-for-Android-Prebuilt.git
|
||||
@ -29,7 +29,7 @@ IFADDRS_PATH = /mnt/media/android/android-ifaddrs
|
||||
|
||||
SOURCES += DaemonQT.cpp\
|
||||
mainwindow.cpp \
|
||||
../../HTTPServer.cpp ../../I2PControl.cpp ../../UPnP.cpp ../../Daemon.cpp ../../Config.cpp \
|
||||
../../HTTPServer.cpp ../../I2PControl.cpp ../../Daemon.cpp ../../Config.cpp \
|
||||
../../AddressBook.cpp \
|
||||
../../api.cpp \
|
||||
../../Base.cpp \
|
||||
@ -72,8 +72,7 @@ SOURCES += DaemonQT.cpp\
|
||||
../../TunnelGateway.cpp \
|
||||
../../TunnelPool.cpp \
|
||||
../../util.cpp \
|
||||
../../i2pd.cpp \
|
||||
$$IFADDRS_PATH/ifaddrs.c
|
||||
../../i2pd.cpp
|
||||
|
||||
HEADERS += DaemonQT.h mainwindow.h \
|
||||
../../HTTPServer.h ../../I2PControl.h ../../UPnP.h ../../Daemon.h ../../Config.h \
|
||||
@ -125,8 +124,7 @@ HEADERS += DaemonQT.h mainwindow.h \
|
||||
../../TunnelGateway.h \
|
||||
../../TunnelPool.h \
|
||||
../../util.h \
|
||||
../../version.h \
|
||||
$$IFADDRS_PATH/ifaddrs.h
|
||||
../../version.h
|
||||
|
||||
FORMS += mainwindow.ui
|
||||
|
||||
@ -140,6 +138,8 @@ android {
|
||||
message("Using Android settings")
|
||||
DEFINES += ANDROID=1
|
||||
DEFINES += __ANDROID__
|
||||
DEFINES += USE_UPNP
|
||||
|
||||
INCLUDEPATH += $$BOOST_PATH/boost_1_53_0/include \
|
||||
$$OPENSSL_PATH/openssl-1.0.2/include \
|
||||
$$MINIUPNP_PATH/miniupnp-2.0/include \
|
||||
@ -149,6 +149,9 @@ DISTFILES += \
|
||||
|
||||
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
|
||||
|
||||
SOURCES += $$IFADDRS_PATH/ifaddrs.c ../../UPnP.cpp
|
||||
HEADERS += $$IFADDRS_PATH/ifaddrs.h
|
||||
|
||||
equals(ANDROID_TARGET_ARCH, armeabi-v7a){
|
||||
|
||||
DEFINES += ANDROID_ARM7A
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "mainwindow.h"
|
||||
//#include "ui_mainwindow.h"
|
||||
#include <QMessageBox>
|
||||
#include <QTimer>
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent)/*,
|
||||
@ -22,20 +23,29 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
verticalLayout1->setContentsMargins(0, 0, 0, 0);
|
||||
quitButton = new QPushButton(verticalLayoutWidget);
|
||||
quitButton->setObjectName(QStringLiteral("quitButton"));
|
||||
QSizePolicy sizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
|
||||
sizePolicy.setHorizontalStretch(0);
|
||||
sizePolicy.setVerticalStretch(0);
|
||||
QSizePolicy sizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
||||
sizePolicy.setHorizontalStretch(1);
|
||||
//sizePolicy.setVerticalStretch(1);
|
||||
sizePolicy.setHeightForWidth(quitButton->sizePolicy().hasHeightForWidth());
|
||||
quitButton->setSizePolicy(sizePolicy);
|
||||
|
||||
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);
|
||||
|
||||
setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 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(gracefulQuitButton, SIGNAL(released()), this, SLOT(handleGracefulQuitButton()));
|
||||
|
||||
//QMetaObject::connectSlotsByName(this);
|
||||
}
|
||||
@ -46,6 +56,23 @@ void MainWindow::handleQuitButton() {
|
||||
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()
|
||||
{
|
||||
qDebug("Destroying main window");
|
||||
|
@ -27,12 +27,15 @@ public:
|
||||
|
||||
private slots:
|
||||
void handleQuitButton();
|
||||
void handleGracefulQuitButton();
|
||||
void handleGracefulQuitTimerEvent();
|
||||
|
||||
private:
|
||||
QWidget *centralWidget;
|
||||
QWidget *verticalLayoutWidget;
|
||||
QVBoxLayout *verticalLayout1;
|
||||
QPushButton *quitButton;
|
||||
QPushButton *gracefulQuitButton;
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
@ -37,6 +37,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="gracefulShutdownButton">
|
||||
<property name="text">
|
||||
<string>Graceful Quit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
@ -60,8 +67,25 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</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>
|
||||
<slots>
|
||||
<slot>handleQuitButton()</slot>
|
||||
<slot>handleGracefulQuitButton()</slot>
|
||||
</slots>
|
||||
</ui>
|
||||
|
Loading…
Reference in New Issue
Block a user