mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-11-17 00:07:51 +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;
|
QStringList arguments;
|
||||||
|
|
||||||
m_daemon = new QProcess();
|
m_daemon = new QProcess();
|
||||||
|
initialized = true;
|
||||||
|
|
||||||
// Connect output slots
|
// Connect output slots
|
||||||
connect (m_daemon, SIGNAL(readyReadStandardOutput()), this, SLOT(printOutput()));
|
connect (m_daemon, SIGNAL(readyReadStandardOutput()), this, SLOT(printOutput()));
|
||||||
|
@ -61,7 +62,7 @@ bool DaemonManager::start()
|
||||||
|
|
||||||
bool DaemonManager::stop()
|
bool DaemonManager::stop()
|
||||||
{
|
{
|
||||||
if(m_daemon){
|
if(initialized){
|
||||||
qDebug() << "stopping daemon";
|
qDebug() << "stopping daemon";
|
||||||
m_daemon->terminate();
|
m_daemon->terminate();
|
||||||
// Wait until stopped. Max 10 seconds
|
// Wait until stopped. Max 10 seconds
|
||||||
|
@ -80,7 +81,8 @@ void DaemonManager::printOutput()
|
||||||
|
|
||||||
foreach (QString line, strLines){
|
foreach (QString line, strLines){
|
||||||
// dConsole.append(line+"\n");
|
// dConsole.append(line+"\n");
|
||||||
qDebug() << "Daemon: " + line;
|
emit daemonConsoleUpdated(line);
|
||||||
|
// qDebug() << "Daemon: " + line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,13 +93,20 @@ void DaemonManager::printError()
|
||||||
|
|
||||||
foreach (QString line, strLines){
|
foreach (QString line, strLines){
|
||||||
// dConsole.append(line+"\n");
|
// dConsole.append(line+"\n");
|
||||||
qDebug() << "Daemon ERROR: " + line;
|
emit daemonConsoleUpdated(line);
|
||||||
|
// qDebug() << "Daemon ERROR: " + line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DaemonManager::running() const
|
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
|
QString DaemonManager::console() const
|
||||||
|
|
|
@ -23,6 +23,7 @@ public:
|
||||||
signals:
|
signals:
|
||||||
void daemonStarted();
|
void daemonStarted();
|
||||||
void daemonStopped();
|
void daemonStopped();
|
||||||
|
void daemonConsoleUpdated(QString message);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void printOutput();
|
void printOutput();
|
||||||
|
@ -34,6 +35,7 @@ private:
|
||||||
static DaemonManager * m_instance;
|
static DaemonManager * m_instance;
|
||||||
QProcess *m_daemon;
|
QProcess *m_daemon;
|
||||||
QString dConsole;
|
QString dConsole;
|
||||||
|
bool initialized = false;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue