refs #816, some formatting in message component

This commit is contained in:
Klaus Basan
2016-11-22 03:51:25 +01:00
parent 20b4044d29
commit 927343399c
2 changed files with 12 additions and 14 deletions

View File

@@ -117,7 +117,7 @@ namespace BlackGui
void CTextMessageComponent::displayTextMessage(const CTextMessageList &messages)
{
if (messages.isEmpty()) return;
foreach (CTextMessage message, messages)
for (const CTextMessage &message : messages)
{
bool relevantForMe = false;
@@ -281,14 +281,14 @@ namespace BlackGui
void CTextMessageComponent::addPrivateChannelTextMessage(const CTextMessage &textMessage)
{
if (!textMessage.isPrivateMessage()) { return; }
CCallsign cs = textMessage.wasSent() ? textMessage.getRecipientCallsign() : textMessage.getSenderCallsign();
const CCallsign cs = textMessage.wasSent() ? textMessage.getRecipientCallsign() : textMessage.getSenderCallsign();
if (cs.isEmpty()) { return; }
QWidget *tab = this->findTextMessageTabByCallsign(cs);
if (tab == nullptr) { tab = this->addNewTextMessageTab(cs); }
Q_ASSERT(tab != nullptr);
if (!tab) { tab = this->addNewTextMessageTab(cs); }
Q_ASSERT_X(tab, Q_FUNC_INFO, "Missing tab");
CTextMessageTextEdit *textEdit = tab->findChild<CTextMessageTextEdit *>();
Q_ASSERT(textEdit != nullptr);
if (textEdit == nullptr) { return; } // do not crash, though this situation could not happen
Q_ASSERT_X(textEdit, Q_FUNC_INFO, "Missing text edit");
if (!textEdit) { return; } // do not crash, though this situation could not happen
textEdit->insertTextMessage(textMessage);
// sound

View File

@@ -32,7 +32,6 @@ namespace BlackMisc
namespace Network { class CTextMessage; }
}
namespace Ui { class CTextMessageComponent; }
namespace BlackGui
{
class CDockWidgetInfoArea;
@@ -60,9 +59,9 @@ namespace BlackGui
explicit CTextMessageComponent(QWidget *parent = nullptr);
//! Destructor
~CTextMessageComponent();
virtual ~CTextMessageComponent();
//! copydoc CEnableForDockWidgetInfoArea::setParentDockWidgetInfoArea
//! \copydoc CEnableForDockWidgetInfoArea::setParentDockWidgetInfoArea
virtual bool setParentDockWidgetInfoArea(BlackGui::CDockWidgetInfoArea *parentDockableWidget) override;
signals:
@@ -99,7 +98,7 @@ namespace BlackGui
QWidget *addNewTextMessageTab(const BlackMisc::Aviation::CCallsign &callsign);
//! Add new text message tab
//! \param tabName name of the new tab, usually the channel name
//! \param tabName name of the new tab, usually the channel name
QWidget *addNewTextMessageTab(const QString &tabName);
//! Find text message tab by callsign
@@ -111,7 +110,7 @@ namespace BlackGui
//! Private channel text message
void addPrivateChannelTextMessage(const BlackMisc::Network::CTextMessage &textMessage);
//! own aircraft
//! Own aircraft
const BlackMisc::Simulation::CSimulatedAircraft getOwnAircraft() const;
//! For this text message's recepient, is the current tab selected?
@@ -136,7 +135,6 @@ namespace BlackGui
void handleEnteredTextMessage(const QString &textMessage);
private slots:
//! Cockpit values changed, used to updated some components
void ps_onChangedAircraftCockpit();
@@ -149,6 +147,6 @@ namespace BlackGui
//! Command line entered
void ps_textMessageEntered();
};
}
}
} // ns
} // ns
#endif // guard