forked from PurpleI2P/i2pd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
qt: daemon now operates in the background thread; added Quit GUI button
- Loading branch information
hypnosis-i2p
committed
Jun 17, 2016
1 parent
3e912c6
commit 1b35f68
Showing
12 changed files
with
360 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,66 @@ | ||
#ifndef DAEMONQT_H | ||
#define DAEMONQT_H | ||
|
||
#include <QObject> | ||
#include <QThread> | ||
|
||
namespace i2p | ||
{ | ||
namespace util | ||
{ | ||
namespace DaemonQt | ||
{ | ||
class Worker : public QObject | ||
{ | ||
Q_OBJECT | ||
|
||
public slots: | ||
void startDaemon(); | ||
void restartDaemon(); | ||
void stopDaemon(); | ||
|
||
signals: | ||
void resultReady(); | ||
}; | ||
|
||
class DaemonQTImpl | ||
{ | ||
public: | ||
typedef void (*runningChangedCallback)(); | ||
|
||
/** | ||
* @brief init | ||
* @param argc | ||
* @param argv | ||
* @return success | ||
*/ | ||
bool static init(int argc, char* argv[]); | ||
void static deinit(); | ||
void static start(); | ||
void static stop(); | ||
void static restart(); | ||
void static setRunningCallback(runningChangedCallback cb); | ||
bool static isRunning(); | ||
private: | ||
void static setRunning(bool running); | ||
}; | ||
|
||
class Controller : public QObject | ||
{ | ||
Q_OBJECT | ||
QThread workerThread; | ||
public: | ||
Controller(); | ||
~Controller(); | ||
public slots: | ||
void handleResults(){} | ||
signals: | ||
void startDaemon(); | ||
void stopDaemon(); | ||
void restartDaemon(); | ||
}; | ||
} | ||
} | ||
} | ||
|
||
#endif // DAEMONQT_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#if 0 | ||
#include "i2pd_qt_gui.h" | ||
#include <QApplication> | ||
#include <QMessageBox> | ||
#include "mainwindow.h" | ||
#include "DaemonQT.h" | ||
|
||
int runGUI( int argc, char* argv[] ) { | ||
QApplication app(argc, argv); | ||
bool daemonInitSuccess = i2p::util::DaemonQTImpl::init(argc, argv); | ||
if(!daemonInitSuccess) { | ||
QMessageBox::critical(0, "Error", "Daemon init failed"); | ||
return 1; | ||
} | ||
MainWindow w; | ||
w.show (); | ||
i2p::util::DaemonQTImpl::start(); | ||
int result = app.exec(); | ||
//QMessageBox::information(&w, "Debug", "exec finished"); | ||
i2p::util::DaemonQTImpl::stop(); | ||
//QMessageBox::information(&w, "Debug", "demon stopped"); | ||
return result; | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
#ifndef IQPD_QT_GUI_H | ||
#define IQPD_QT_GUI_H | ||
|
||
int runGUI( int argc, char* argv[] ); | ||
|
||
#endif // IQPD_QT_GUI_H |
Oops, something went wrong.