refs #199, console redirection enabled for GUI

# hooked up with siganls
# changed widget to courier font
This commit is contained in:
Klaus Basan
2014-04-08 18:17:52 +02:00
parent 093462e7fb
commit 35b489d89a
3 changed files with 35 additions and 12 deletions

View File

@@ -67,6 +67,7 @@ void MainWindow::gracefulShutdown()
{
if (!this->m_init) return;
this->m_init = false;
if (this->m_rt->getIContextApplication()) emit this->m_rt->getIContextApplication()->widgetGuiTerminating();
// close info window
if (this->m_infoWindow)
@@ -280,6 +281,13 @@ void MainWindow::displayStatusMessages(const CStatusMessageList &messages)
}
}
void MainWindow::displayRedirectedOutput(const CStatusMessage &statusMessage, qint64 contextId)
{
if (!this->m_rt->getIContextApplication()) return;
if (this->m_rt->getIContextApplication()->getUniqueId() == contextId) return; //self triggered
this->ui->te_StatusPageConsole->appendHtml(statusMessage.toHtml());
}
/*
* Connection terminated
*/
@@ -317,11 +325,6 @@ void MainWindow::connectionStatusChanged(uint /** from **/, uint to)
}
}
void MainWindow::simulatorAvailable()
{
m_timerSimulator->start(500);
}
/*
* Timer event
*/
@@ -353,7 +356,7 @@ void MainWindow::timerBasedUpdates()
}
else if (sender == this->m_timerSimulator)
{
updateSimulatorData();
this->updateSimulatorData();
}
// own aircraft
@@ -525,3 +528,12 @@ void MainWindow::updateSimulatorData()
ui->le_SimulatorCom2Standby->setText(ownAircraft.getCom2System().getFrequencyStandby().toFormattedQString());
ui->le_SimulatorTransponder->setText(ownAircraft.getTransponderCodeFormatted());
}
void MainWindow::simulatorConnectionChanged(bool isAvailable)
{
// Simulator timer, TODO remove later
if (isAvailable)
this->m_timerSimulator->start(500);
else
this->m_timerSimulator->stop();
}

View File

@@ -554,7 +554,7 @@ QStatusBar QLabel {
<item>
<widget class="QToolBox" name="tb_StatusPage">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<property name="tabSpacing">
<number>3</number>
@@ -638,6 +638,15 @@ QStatusBar QLabel {
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Courier New</family>
<pointsize>-1</pointsize>
<weight>75</weight>
<italic>false</italic>
<bold>true</bold>
</font>
</property>
<property name="lineWrapMode">
<enum>QPlainTextEdit::NoWrap</enum>
</property>

View File

@@ -201,14 +201,15 @@ void MainWindow::init(GuiModes::CoreMode coreMode)
// signal / slots contexts / timers
bool connect;
this->connect(this->m_rt->getIContextNetwork(), &IContextNetwork::statusMessage, this, &MainWindow::displayStatusMessage);
this->connect(this->m_rt->getIContextNetwork(), &IContextNetwork::statusMessages, this, &MainWindow::displayStatusMessages);
this->connect(this->m_rt->getIContextApplication(), &IContextApplication::statusMessage, this, &MainWindow::displayStatusMessage);
this->connect(this->m_rt->getIContextApplication(), &IContextApplication::statusMessages, this, &MainWindow::displayStatusMessages);
this->connect(this->m_rt->getIContextApplication(), &IContextApplication::redirectedOutput, this, &MainWindow::displayRedirectedOutput);
this->connect(this->m_rt->getIContextNetwork(), &IContextNetwork::connectionTerminated, this, &MainWindow::connectionTerminated);
this->connect(this->m_rt->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &MainWindow::connectionStatusChanged);
this->connect(this->m_rt->getIContextSettings(), &IContextSettings::changedSettings, this, &MainWindow::changedSettings);
connect = this->connect(this->m_rt->getIContextNetwork(), SIGNAL(textMessagesReceived(BlackMisc::Network::CTextMessageList)), this, SLOT(appendTextMessagesToGui(BlackMisc::Network::CTextMessageList)));
Q_ASSERT(connect);
this->connect(this->m_rt->getIContextSimulator(), &IContextSimulator::connectionChanged, this, &MainWindow::simulatorAvailable);
this->connect(this->m_rt->getIContextSimulator(), &IContextSimulator::connectionChanged, this, &MainWindow::simulatorConnectionChanged);
this->connect(this->m_timerUpdateAircraftsInRange, &QTimer::timeout, this, &MainWindow::timerBasedUpdates);
this->connect(this->m_timerUpdateAtcStationsOnline, &QTimer::timeout, this, &MainWindow::timerBasedUpdates);
this->connect(this->m_timerUpdateUsers, &QTimer::timeout, this, &MainWindow::timerBasedUpdates);
@@ -239,12 +240,13 @@ void MainWindow::init(GuiModes::CoreMode coreMode)
// init context menus
this->initContextMenus();
// starting
emit this->m_rt->getIContextApplication()->widgetGuiStarting();
// do this as last statement, so it can be used as flag
// whether init has been completed
this->m_init = true;
// TODO remove later
simulatorAvailable();
}
//