mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-11-16 15:58:11 +00:00
DaemonManager: added console updated signals
This commit is contained in:
parent
3df9e44849
commit
3a431543fa
2 changed files with 15 additions and 4 deletions
|
@ -41,6 +41,7 @@ bool DaemonManager::start()
|
|||
QStringList arguments;
|
||||
|
||||
m_daemon = new QProcess();
|
||||
initialized = true;
|
||||
|
||||
// Connect output slots
|
||||
connect (m_daemon, SIGNAL(readyReadStandardOutput()), this, SLOT(printOutput()));
|
||||
|
@ -61,7 +62,7 @@ bool DaemonManager::start()
|
|||
|
||||
bool DaemonManager::stop()
|
||||
{
|
||||
if(m_daemon){
|
||||
if(initialized){
|
||||
qDebug() << "stopping daemon";
|
||||
m_daemon->terminate();
|
||||
// Wait until stopped. Max 10 seconds
|
||||
|
@ -80,7 +81,8 @@ void DaemonManager::printOutput()
|
|||
|
||||
foreach (QString line, strLines){
|
||||
// dConsole.append(line+"\n");
|
||||
qDebug() << "Daemon: " + line;
|
||||
emit daemonConsoleUpdated(line);
|
||||
// qDebug() << "Daemon: " + line;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,13 +93,20 @@ void DaemonManager::printError()
|
|||
|
||||
foreach (QString line, strLines){
|
||||
// dConsole.append(line+"\n");
|
||||
qDebug() << "Daemon ERROR: " + line;
|
||||
emit daemonConsoleUpdated(line);
|
||||
// qDebug() << "Daemon ERROR: " + line;
|
||||
}
|
||||
}
|
||||
|
||||
bool DaemonManager::running() const
|
||||
{
|
||||
return m_daemon && m_daemon->state() > QProcess::NotRunning;
|
||||
if(initialized){
|
||||
qDebug() << m_daemon->state();
|
||||
qDebug() << QProcess::NotRunning;
|
||||
|
||||
return m_daemon->state() > QProcess::NotRunning;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
QString DaemonManager::console() const
|
||||
|
|
|
@ -23,6 +23,7 @@ public:
|
|||
signals:
|
||||
void daemonStarted();
|
||||
void daemonStopped();
|
||||
void daemonConsoleUpdated(QString message);
|
||||
|
||||
public slots:
|
||||
void printOutput();
|
||||
|
@ -34,6 +35,7 @@ private:
|
|||
static DaemonManager * m_instance;
|
||||
QProcess *m_daemon;
|
||||
QString dConsole;
|
||||
bool initialized = false;
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue