This commit is contained in:
Klaus Basan
2017-03-05 19:13:33 +01:00
committed by Mathew Sutcliffe
parent 6a6f98ebd1
commit a7393b04e1
2 changed files with 9 additions and 10 deletions

View File

@@ -130,7 +130,7 @@ namespace BlackGui
if (message.isSelcalMessage() && ownAircraft.isSelcalSelected(message.getSelcalCode())) if (message.isSelcalMessage() && ownAircraft.isSelcalSelected(message.getSelcalCode()))
{ {
// this is SELCAL for me // this is SELCAL for me
if (sGui->getIContextAudio()) if (sGui && sGui->getIContextAudio())
{ {
sGui->getIContextAudio()->playSelcalTone(message.getSelcalCode()); sGui->getIContextAudio()->playSelcalTone(message.getSelcalCode());
} }
@@ -275,11 +275,11 @@ namespace BlackGui
layout->addWidget(closeButton); layout->addWidget(closeButton);
newTab->setLayout(layout); newTab->setLayout(layout);
textEdit->setContextMenuPolicy(Qt::CustomContextMenu); textEdit->setContextMenuPolicy(Qt::CustomContextMenu);
int index = ui->tw_TextMessages->addTab(newTab, tabName); const int index = ui->tw_TextMessages->addTab(newTab, tabName);
this->connect(closeButton, &QPushButton::released, this, &CTextMessageComponent::ps_closeTextMessageTab); this->connect(closeButton, &QPushButton::released, this, &CTextMessageComponent::ps_closeTextMessageTab);
ui->tw_TextMessages->setCurrentIndex(index); ui->tw_TextMessages->setCurrentIndex(index);
if (sGui->getIContextNetwork()) if (sGui && sGui->getIContextNetwork())
{ {
QString realName = sGui->getIContextNetwork()->getUserForCallsign(CCallsign(tabName)).getRealName(); QString realName = sGui->getIContextNetwork()->getUserForCallsign(CCallsign(tabName)).getRealName();
if (!realName.isEmpty()) ui->tw_TextMessages->setTabToolTip(index, realName); if (!realName.isEmpty()) ui->tw_TextMessages->setTabToolTip(index, realName);
@@ -301,7 +301,7 @@ namespace BlackGui
textEdit->insertTextMessage(textMessage); textEdit->insertTextMessage(textMessage);
// sound // sound
if (sGui->getIContextAudio()) if (sGui && sGui->getIContextAudio())
{ {
sGui->getIContextAudio()->playNotification(CNotificationSounds::NotificationTextMessagePrivate, true); sGui->getIContextAudio()->playNotification(CNotificationSounds::NotificationTextMessagePrivate, true);
} }
@@ -309,7 +309,7 @@ namespace BlackGui
CSimulatedAircraft CTextMessageComponent::getOwnAircraft() const CSimulatedAircraft CTextMessageComponent::getOwnAircraft() const
{ {
Q_ASSERT(sGui->getIContextOwnAircraft()); Q_ASSERT(sGui && sGui->getIContextOwnAircraft());
return sGui->getIContextOwnAircraft()->getOwnAircraft(); return sGui->getIContextOwnAircraft()->getOwnAircraft();
} }
@@ -320,7 +320,7 @@ namespace BlackGui
if (!callsignResolution) { return nullptr; } if (!callsignResolution) { return nullptr; }
// resolve callsign // resolve callsign
CAtcStation station(sGui->getIContextNetwork()->getOnlineStationForCallsign(callsign)); const CAtcStation station(sGui->getIContextNetwork()->getOnlineStationForCallsign(callsign));
if (!station.getCallsign().isEmpty()) if (!station.getCallsign().isEmpty())
{ {
const CSimulatedAircraft ownAircraft(this->getOwnAircraft()); const CSimulatedAircraft ownAircraft(this->getOwnAircraft());
@@ -339,7 +339,7 @@ namespace BlackGui
QWidget *CTextMessageComponent::findTextMessageTabByName(const QString &name) const QWidget *CTextMessageComponent::findTextMessageTabByName(const QString &name) const
{ {
if (name.isEmpty()) { return nullptr; } if (name.isEmpty()) { return nullptr; }
QString n = name.trimmed(); const QString n = name.trimmed();
for (int index = 0; index < ui->tw_TextMessages->count(); index++) for (int index = 0; index < ui->tw_TextMessages->count(); index++)
{ {
QString tabName = ui->tw_TextMessages->tabText(index); QString tabName = ui->tw_TextMessages->tabText(index);
@@ -377,7 +377,7 @@ namespace BlackGui
if (!ui->le_textMessages->isVisible()) { return; } if (!ui->le_textMessages->isVisible()) { return; }
if (!this->isVisible()) { return; } if (!this->isVisible()) { return; }
QString cl(ui->le_textMessages->text().trimmed().simplified()); const QString cl(ui->le_textMessages->text().trimmed().simplified());
ui->le_textMessages->clear(); ui->le_textMessages->clear();
this->handleEnteredTextMessage(cl); this->handleEnteredTextMessage(cl);
} }
@@ -406,7 +406,7 @@ namespace BlackGui
// only if visible // only if visible
if (enteredLine.isEmpty()) { return ""; } if (enteredLine.isEmpty()) { return ""; }
int index = ui->tw_TextMessages->currentIndex(); const int index = ui->tw_TextMessages->currentIndex();
QString cmd(".msg "); QString cmd(".msg ");
if (index < 0 || index == ui->tw_TextMessages->indexOf(ui->tb_TextMessagesAll)) if (index < 0 || index == ui->tw_TextMessages->indexOf(ui->tb_TextMessagesAll))
{ {

View File

@@ -34,7 +34,6 @@ namespace BlackMisc
class BLACKMISC_EXPORT CAirlineIcaoCodeList : class BLACKMISC_EXPORT CAirlineIcaoCodeList :
public CSequence<CAirlineIcaoCode>, public CSequence<CAirlineIcaoCode>,
public BlackMisc::Db::IDatastoreObjectList<CAirlineIcaoCode, CAirlineIcaoCodeList, int>, public BlackMisc::Db::IDatastoreObjectList<CAirlineIcaoCode, CAirlineIcaoCodeList, int>,
public BlackMisc::Mixin::MetaType<CAirlineIcaoCodeList> public BlackMisc::Mixin::MetaType<CAirlineIcaoCodeList>
{ {
public: public: