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; if (!this->m_init) return;
this->m_init = false; this->m_init = false;
if (this->m_rt->getIContextApplication()) emit this->m_rt->getIContextApplication()->widgetGuiTerminating();
// close info window // close info window
if (this->m_infoWindow) 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 * Connection terminated
*/ */
@@ -317,11 +325,6 @@ void MainWindow::connectionStatusChanged(uint /** from **/, uint to)
} }
} }
void MainWindow::simulatorAvailable()
{
m_timerSimulator->start(500);
}
/* /*
* Timer event * Timer event
*/ */
@@ -353,7 +356,7 @@ void MainWindow::timerBasedUpdates()
} }
else if (sender == this->m_timerSimulator) else if (sender == this->m_timerSimulator)
{ {
updateSimulatorData(); this->updateSimulatorData();
} }
// own aircraft // own aircraft
@@ -525,3 +528,12 @@ void MainWindow::updateSimulatorData()
ui->le_SimulatorCom2Standby->setText(ownAircraft.getCom2System().getFrequencyStandby().toFormattedQString()); ui->le_SimulatorCom2Standby->setText(ownAircraft.getCom2System().getFrequencyStandby().toFormattedQString());
ui->le_SimulatorTransponder->setText(ownAircraft.getTransponderCodeFormatted()); 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> <item>
<widget class="QToolBox" name="tb_StatusPage"> <widget class="QToolBox" name="tb_StatusPage">
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>1</number>
</property> </property>
<property name="tabSpacing"> <property name="tabSpacing">
<number>3</number> <number>3</number>
@@ -638,6 +638,15 @@ QStatusBar QLabel {
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </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"> <property name="lineWrapMode">
<enum>QPlainTextEdit::NoWrap</enum> <enum>QPlainTextEdit::NoWrap</enum>
</property> </property>

View File

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