mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-06 02:16:04 +08:00
refs #841, use settings to decide which text message is displayed
This commit is contained in:
committed by
Mathew Sutcliffe
parent
062f0671ea
commit
a7469d2959
@@ -16,7 +16,10 @@
|
|||||||
#include "blackgui/views/statusmessageview.h"
|
#include "blackgui/views/statusmessageview.h"
|
||||||
#include "blackgui/views/viewbase.h"
|
#include "blackgui/views/viewbase.h"
|
||||||
#include "blackmisc/aviation/callsign.h"
|
#include "blackmisc/aviation/callsign.h"
|
||||||
|
#include "blackmisc/simulation/simulatedaircraft.h"
|
||||||
#include "blackmisc/network/textmessage.h"
|
#include "blackmisc/network/textmessage.h"
|
||||||
|
#include "blackcore/context/contextownaircraft.h"
|
||||||
|
#include "blackcore/application.h"
|
||||||
#include "ui_overlaymessages.h"
|
#include "ui_overlaymessages.h"
|
||||||
|
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
@@ -34,8 +37,12 @@
|
|||||||
|
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
using namespace BlackMisc::Network;
|
using namespace BlackMisc::Network;
|
||||||
|
using namespace BlackMisc::Simulation;
|
||||||
|
using namespace BlackCore;
|
||||||
|
using namespace BlackCore::Context;
|
||||||
using namespace BlackGui::Models;
|
using namespace BlackGui::Models;
|
||||||
using namespace BlackGui::Views;
|
using namespace BlackGui::Views;
|
||||||
|
using namespace BlackGui::Settings;
|
||||||
|
|
||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
{
|
{
|
||||||
@@ -110,6 +117,15 @@ namespace BlackGui
|
|||||||
return (this->width() < 400);
|
return (this->width() < 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool COverlayMessages::displayTextMessage(const CTextMessage &textMessage) const
|
||||||
|
{
|
||||||
|
const CTextMessageSettings s = this->m_messageSettings.getThreadLocal();
|
||||||
|
if (s.popup(textMessage)) { return true; } // fast check without needing own aircraft
|
||||||
|
if (!sApp || !sApp->getIContextOwnAircraft()) { return false; }
|
||||||
|
const CSimulatedAircraft ownAircraft(sApp->getIContextOwnAircraft()->getOwnAircraft());
|
||||||
|
return s.popup(textMessage, ownAircraft);
|
||||||
|
}
|
||||||
|
|
||||||
COverlayMessages::~COverlayMessages()
|
COverlayMessages::~COverlayMessages()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@@ -160,6 +176,7 @@ namespace BlackGui
|
|||||||
void COverlayMessages::showOverlayTextMessage(const CTextMessage &textMessage, int timeOutMs)
|
void COverlayMessages::showOverlayTextMessage(const CTextMessage &textMessage, int timeOutMs)
|
||||||
{
|
{
|
||||||
if (textMessage.isEmpty()) { return; }
|
if (textMessage.isEmpty()) { return; }
|
||||||
|
if (!displayTextMessage(textMessage)) { return; }
|
||||||
if (this->hasPendingConfirmation())
|
if (this->hasPendingConfirmation())
|
||||||
{
|
{
|
||||||
// defer message
|
// defer message
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#define BLACKGUI_OVERLAYMESSAGES_H
|
#define BLACKGUI_OVERLAYMESSAGES_H
|
||||||
|
|
||||||
#include "blackgui/blackguiexport.h"
|
#include "blackgui/blackguiexport.h"
|
||||||
|
#include "blackgui/settings/textmessagesettings.h"
|
||||||
#include "blackmisc/pixmap.h"
|
#include "blackmisc/pixmap.h"
|
||||||
#include "blackmisc/statusmessage.h"
|
#include "blackmisc/statusmessage.h"
|
||||||
#include "blackmisc/statusmessagelist.h"
|
#include "blackmisc/statusmessagelist.h"
|
||||||
@@ -130,6 +131,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<Ui::COverlayMessages> ui;
|
QScopedPointer<Ui::COverlayMessages> ui;
|
||||||
|
BlackMisc::CSettingReadOnly<BlackGui::Settings::TextMessageSettings> m_messageSettings { this };
|
||||||
QString m_header;
|
QString m_header;
|
||||||
int m_lastConfirmation = QMessageBox::Cancel;
|
int m_lastConfirmation = QMessageBox::Cancel;
|
||||||
bool m_awaitingConfirmation = false;
|
bool m_awaitingConfirmation = false;
|
||||||
@@ -145,6 +147,9 @@ namespace BlackGui
|
|||||||
|
|
||||||
//! Small
|
//! Small
|
||||||
bool useSmall() const;
|
bool useSmall() const;
|
||||||
|
|
||||||
|
//! Display this message (use settings to decide)
|
||||||
|
bool displayTextMessage(const BlackMisc::Network::CTextMessage &textMessage) const;
|
||||||
};
|
};
|
||||||
} // ns
|
} // ns
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user