Ref T384, overlay text messages added in frame

This commit is contained in:
Klaus Basan
2018-10-02 20:03:59 +02:00
parent b71936c6a1
commit b3c6e22346
4 changed files with 66 additions and 9 deletions

View File

@@ -63,6 +63,11 @@ namespace BlackGui
ui->tvp_StatusMessages->setForceColumnsToMaxSize(false); // problems with multiline entries, with T138 we need multiline messages
ui->tvp_StatusMessages->menuAddItems(CStatusMessageView::MenuSave);
ui->fr_Confirmation->setVisible(false);
ui->comp_OverlayTextMessage->showSettings(false);
ui->comp_OverlayTextMessage->showTextMessageEntry(true);
ui->comp_OverlayTextMessage->setAsUsedInOverlayMode();
this->setDefaultConfirmationButton(QMessageBox::Cancel);
}
@@ -145,7 +150,7 @@ namespace BlackGui
return s.popup(textMessage, ownAircraft);
}
void COverlayMessages::showOverlayMessages(const BlackMisc::CStatusMessageList &messages, bool appendOldMessages, int timeOutMs)
void COverlayMessages::showOverlayMessages(const CStatusMessageList &messages, bool appendOldMessages, int timeOutMs)
{
if (messages.isEmpty()) { return; }
if (!sGui || sGui->isShuttingDown()) { return; }
@@ -212,7 +217,7 @@ namespace BlackGui
void COverlayMessages::showOverlayTextMessage(const CTextMessage &textMessage, int timeOutMs)
{
if (textMessage.isEmpty()) { return; }
if (!displayTextMessage(textMessage)) { return; }
if (!this->displayTextMessage(textMessage)) { return; }
if (!sGui || sGui->isShuttingDown()) { return; }
if (this->hasPendingConfirmation())
@@ -240,6 +245,15 @@ namespace BlackGui
this->display(timeOutMs);
}
void COverlayMessages::showOverlayInlineTextMessage(Components::TextMessageTab tab)
{
ui->sw_StatusMessagesComponent->setCurrentWidget(ui->pg_OverlayTextMessage);
ui->comp_OverlayTextMessage->setTab(tab);
this->setHeader("Text message");
this->showKill(false);
this->display();
}
void COverlayMessages::showOverlayImage(const CPixmap &image, int timeOutMs)
{
this->showOverlayImage(image.toPixmap(), timeOutMs);

View File

@@ -12,8 +12,9 @@
#ifndef BLACKGUI_OVERLAYMESSAGES_H
#define BLACKGUI_OVERLAYMESSAGES_H
#include "blackgui/blackguiexport.h"
#include "blackgui/components/textmessagecomponenttab.h"
#include "blackgui/settings/textmessagesettings.h"
#include "blackgui/blackguiexport.h"
#include "blackmisc/pixmap.h"
#include "blackmisc/statusmessage.h"
#include "blackmisc/statusmessagelist.h"
@@ -30,7 +31,6 @@
class QKeyEvent;
class QPaintEvent;
class QPixmap;
class QWidget;
namespace BlackMisc { namespace Network { class CTextMessage; } }
namespace Ui { class COverlayMessages; }
@@ -98,6 +98,9 @@ namespace BlackGui
//! Info message, based on text message
void showOverlayTextMessage(const BlackMisc::Network::CTextMessage &textMessage, int timeOutMs = -1);
//! Inline text message
void showOverlayInlineTextMessage(BlackGui::Components::TextMessageTab tab);
//! Image
void showOverlayImage(const BlackMisc::CPixmap &image, int timeOutMs = -1);

View File

@@ -113,7 +113,7 @@
<item>
<widget class="QStackedWidget" name="sw_StatusMessagesComponent">
<property name="currentIndex">
<number>4</number>
<number>5</number>
</property>
<widget class="QWidget" name="pg_StatusMessages">
<layout class="QVBoxLayout" name="vl_PgStatusMessages">
@@ -295,6 +295,32 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="pg_OverlayTextMessage">
<layout class="QVBoxLayout" name="vl_OverlayTextMessage">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="BlackGui::Components::CTextMessageComponent" name="comp_OverlayTextMessage">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
@@ -375,6 +401,12 @@
<header>blackgui/components/statusmessageformsmall.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>BlackGui::Components::CTextMessageComponent</class>
<extends>QFrame</extends>
<header>blackgui/components/textmessagecomponent.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>pb_Ok</tabstop>

View File

@@ -12,13 +12,13 @@
#ifndef BLACKGUI_OVERLAYMESSAGES_FRAME_H
#define BLACKGUI_OVERLAYMESSAGES_FRAME_H
#include "blackgui/blackguiexport.h"
#include "blackgui/components/textmessagecomponenttab.h"
#include "blackgui/overlaymessages.h"
#include "blackgui/guiutility.h"
#include "blackmisc/pixmap.h"
#include "blackmisc/statusmessage.h"
#include "blackmisc/statusmessagelist.h"
#include "blackgui/blackguiexport.h"
#include "blackmisc/network/textmessage.h"
#include "blackmisc/pixmap.h"
#include "blackmisc/statusmessagelist.h"
#include "blackmisc/variant.h"
#include <QFrame>
@@ -163,6 +163,14 @@ namespace BlackGui
WIDGET::repaint();
}
//! \copydoc BlackGui::COverlayMessages::showOverlayImage
void showOverlayInlineTextMessage(Components::TextMessageTab tab)
{
this->initInnerFrame();
m_overlayMessages->showOverlayInlineTextMessage(tab);
WIDGET::repaint();
}
protected:
COverlayMessages *m_overlayMessages = nullptr; //!< embedded QFrame with status messages