mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
refs #275, own info window component
* added to CVariant for value object * signal in text message to indicate overlay messages * info window component (currently not runtme aware, maybe changed in future) * removed old window, adjusted GUI
This commit is contained in:
@@ -1,41 +0,0 @@
|
||||
#include "infowindow.h"
|
||||
#include "ui_infowindow.h"
|
||||
#include <QTimer>
|
||||
#include <QDesktopWidget>
|
||||
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
CInfoWindow::CInfoWindow(QWidget *parent) :
|
||||
QWizardPage(parent),
|
||||
ui(new Ui::InfoWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
/*
|
||||
* Destructor
|
||||
*/
|
||||
CInfoWindow::~CInfoWindow() { }
|
||||
|
||||
/*
|
||||
* Info message for some time
|
||||
*/
|
||||
void CInfoWindow::setInfoMessage(const QString &message, int displayTimeMs)
|
||||
{
|
||||
// center
|
||||
const QRect parent = this->parentWidget()->geometry();
|
||||
const QRect myself = this->rect();
|
||||
int dx = (parent.width() - myself.width()) / 2;
|
||||
int dy = (parent.height() - myself.height()) / 2;
|
||||
dy -= 80; // some offset, in order to display further on top
|
||||
this->move(dx, dy);
|
||||
|
||||
// message and display
|
||||
this->ui->te_Message->setText(message);
|
||||
this->show();
|
||||
|
||||
// hide after some time
|
||||
QTimer::singleShot(displayTimeMs, this, SLOT(hide()));
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
/* Copyright (C) 2013 VATSIM Community / authors
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef SAMPLE_INFOWINDOW_H
|
||||
#define SAMPLE_INFOWINDOW_H
|
||||
|
||||
#include <QWizardPage>
|
||||
#include <QScopedPointer>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class InfoWindow;
|
||||
}
|
||||
|
||||
class CInfoWindow : public QWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/*!
|
||||
* \brief Constructor
|
||||
* \param parent
|
||||
*/
|
||||
explicit CInfoWindow(QWidget *parent = nullptr);
|
||||
|
||||
/*!
|
||||
* \brief Destructor
|
||||
*/
|
||||
~CInfoWindow();
|
||||
|
||||
/*!
|
||||
* \brief Set info message displayed for some time
|
||||
* \param message
|
||||
* \param displayTimeMs
|
||||
*/
|
||||
void setInfoMessage(const QString &message, int displayTimeMs = 4000);
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::InfoWindow> ui;
|
||||
};
|
||||
|
||||
#endif // guard
|
||||
@@ -1,96 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>InfoWindow</class>
|
||||
<widget class="QWizardPage" name="InfoWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>245</width>
|
||||
<height>89</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>WizardPage</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QWidget {
|
||||
font-family: arial-rounded;
|
||||
font: bold 10px;
|
||||
color: black; /** font **/
|
||||
}
|
||||
|
||||
QPushButton {
|
||||
background-color: transparent;
|
||||
border-style: solid;
|
||||
border-width: 0px;
|
||||
border-radius:3px;
|
||||
border-color: green;
|
||||
max-height:20px;
|
||||
}
|
||||
|
||||
QTextEdit {
|
||||
background-color: rgba(255, 255, 0, 240); /* transparent yellow */
|
||||
border-style: solid;
|
||||
border-width:1px;
|
||||
border-radius:6px;
|
||||
border-color: green;
|
||||
opacity: 0.5;
|
||||
}
|
||||
</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QTextEdit" name="te_Message">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignTop">
|
||||
<widget class="QPushButton" name="pb_Close">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../src/blackgui/blackgui.qrc">
|
||||
<normaloff>:/blackgui/icons/close.png</normaloff>:/blackgui/icons/close.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../../src/blackgui/blackgui.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>pb_Close</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>InfoWindow</receiver>
|
||||
<slot>hide()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>272</x>
|
||||
<y>52</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>302</x>
|
||||
<y>67</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -24,7 +24,7 @@ using namespace BlackMisc::Audio;
|
||||
MainWindow::MainWindow(GuiModes::WindowMode windowMode, QWidget *parent) :
|
||||
QMainWindow(parent, windowMode == GuiModes::WindowFrameless ? (Qt::Window | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint) : (Qt::Tool | Qt::WindowStaysOnTopHint)),
|
||||
ui(new Ui::MainWindow),
|
||||
m_infoWindow(nullptr),
|
||||
m_compInfoWindow(nullptr),
|
||||
m_init(false), m_windowMode(windowMode), m_audioTestRunning(NoAudioTest),
|
||||
// contexts and runtime
|
||||
m_coreAvailable(false), m_contextNetworkAvailable(false), m_contextAudioAvailable(false),
|
||||
@@ -48,7 +48,11 @@ MainWindow::MainWindow(GuiModes::WindowMode windowMode, QWidget *parent) :
|
||||
this->setAttribute(Qt::WA_TranslucentBackground, true);
|
||||
// this->setAttribute(Qt::WA_PaintOnScreen);
|
||||
}
|
||||
|
||||
// GUI
|
||||
ui->setupUi(this);
|
||||
this->m_compInfoWindow = new CInfoWindowComponent(this); // setupUi has to be first!
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -73,10 +77,10 @@ void MainWindow::gracefulShutdown()
|
||||
this->getIContextApplication()->notifyAboutComponentChange(IContextApplication::ComponentGui, IContextApplication::ActionStops);
|
||||
|
||||
// close info window
|
||||
if (this->m_infoWindow)
|
||||
if (this->m_compInfoWindow)
|
||||
{
|
||||
this->m_infoWindow->close();
|
||||
this->m_infoWindow = nullptr;
|
||||
this->m_compInfoWindow->close();
|
||||
this->m_compInfoWindow = nullptr;
|
||||
}
|
||||
|
||||
// shut down all timers
|
||||
@@ -266,7 +270,7 @@ void MainWindow::displayStatusMessage(const CStatusMessage &statusMessage)
|
||||
|
||||
// display overlay for errors, but not for validation
|
||||
if (statusMessage.getSeverity() == CStatusMessage::SeverityError && statusMessage.getType() != CStatusMessage::TypeValidation)
|
||||
this->displayOverlayInfo(statusMessage);
|
||||
this->m_compInfoWindow->displayStatusMessage(statusMessage);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -426,36 +430,6 @@ void MainWindow::changeWindowOpacity(int opacity)
|
||||
this->ui->hs_SettingsGuiOpacity->setValue(o * 100.0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Display the info window
|
||||
*/
|
||||
void MainWindow::displayOverlayInfo(const QString &message)
|
||||
{
|
||||
if (!this->m_infoWindow)
|
||||
{
|
||||
this->m_infoWindow = new CInfoWindow(this);
|
||||
}
|
||||
|
||||
// display window
|
||||
if (message.isEmpty())
|
||||
{
|
||||
this->m_infoWindow->hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
this->m_infoWindow->setInfoMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Info window by
|
||||
*/
|
||||
void MainWindow::displayOverlayInfo(const CStatusMessage &message)
|
||||
{
|
||||
this->displayOverlayInfo(message.getMessage());
|
||||
// further code goes here, such as marking errors as red ...
|
||||
}
|
||||
|
||||
void MainWindow::updateSimulatorData()
|
||||
{
|
||||
if (this->getIContextSimulator()->isConnected())
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#pragma push_macro("interface")
|
||||
#undef interface
|
||||
|
||||
#include "infowindow.h"
|
||||
#include "guimodeenums.h"
|
||||
#include "blackinput/keyboard.h"
|
||||
#include "blackcore/context_audio.h"
|
||||
@@ -27,6 +26,7 @@
|
||||
#include "blackgui/userlistmodel.h"
|
||||
#include "blackgui/statusmessagelistmodel.h"
|
||||
#include "blackgui/keyboardkeylistmodel.h"
|
||||
#include "blackgui/infowindowcomponent.h"
|
||||
#include "blackmisc/nwtextmessage.h"
|
||||
#include "blacksound/soundgenerator.h"
|
||||
#include <QMainWindow>
|
||||
@@ -93,7 +93,7 @@ protected:
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::MainWindow> ui;
|
||||
CInfoWindow *m_infoWindow;
|
||||
BlackGui::CInfoWindowComponent *m_compInfoWindow;
|
||||
bool m_init;
|
||||
GuiModes::WindowMode m_windowMode;
|
||||
AudioTest m_audioTestRunning;
|
||||
@@ -314,14 +314,6 @@ private slots:
|
||||
//! Toogle Windows stay on top
|
||||
void toogleWindowStayOnTop();
|
||||
|
||||
//! Display the overlay window
|
||||
//! Empty string hides window
|
||||
void displayOverlayInfo(const QString &message = "");
|
||||
|
||||
//! Overlay info displaying status message
|
||||
void displayOverlayInfo(const BlackMisc::CStatusMessage &message);
|
||||
|
||||
|
||||
};
|
||||
|
||||
#pragma pop_macro("interface")
|
||||
|
||||
@@ -214,8 +214,7 @@ void MainWindow::initGuiSignals()
|
||||
// command line / text messages
|
||||
connected = this->connect(this->ui->le_CommandLineInput, SIGNAL(returnPressed()), this->ui->comp_TextMessages, SLOT(commandEntered()));
|
||||
Q_ASSERT(connected);
|
||||
this->connect(this->ui->comp_TextMessages, SIGNAL(displayOverlayInfo(BlackMisc::CStatusMessage)), this, SLOT(displayOverlayInfo(BlackMisc::CStatusMessage)));
|
||||
Q_ASSERT(connected);
|
||||
this->connect(this->ui->comp_TextMessages, &CTextMessageComponent::displayInInfoWindow, this->m_compInfoWindow, &CInfoWindowComponent::display);
|
||||
this->ui->comp_TextMessages->setSelcalCallback(std::bind(&CCockpitV1Component::getSelcalCode, this->ui->comp_Cockpit));
|
||||
|
||||
// voice
|
||||
|
||||
@@ -140,7 +140,7 @@ void MainWindow::audioVolumes()
|
||||
this->ui->lbl_StatusVoiceStatus->setPixmap(muted ? this->m_resPixmapVoiceMuted : this->m_resPixmapVoiceHigh);
|
||||
this->ui->comp_Cockpit->setCockpitVoiceStatusPixmap(muted ? this->m_resPixmapVoiceMuted : this->m_resPixmapVoiceHigh);
|
||||
this->ui->pb_SoundMute->setStyleSheet(muted ? "background-color: red;" : "");
|
||||
if (muted) this->displayOverlayInfo("Sound is muted!");
|
||||
if (muted) this->m_compInfoWindow->displayStringMessage("Sound is muted!");
|
||||
|
||||
// update own aircraft, also set volume/mute in voice
|
||||
this->m_ownAircraft.setCom1System(com1);
|
||||
|
||||
137
src/blackgui/infowindowcomponent.cpp
Normal file
137
src/blackgui/infowindowcomponent.cpp
Normal file
@@ -0,0 +1,137 @@
|
||||
#include "infowindowcomponent.h"
|
||||
#include "ui_infowindowcomponent.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <QDesktopWidget>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Network;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
CInfoWindowComponent::CInfoWindowComponent(QWidget *parent) :
|
||||
QWizardPage(parent), ui(new Ui::InfoWindow), m_hideTimer(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->hide();
|
||||
this->m_hideTimer = new QTimer(this);
|
||||
this->m_hideTimer->setSingleShot(true);
|
||||
connect(this->m_hideTimer, &QTimer::timeout, this, &CInfoWindowComponent::hide);
|
||||
}
|
||||
|
||||
/*
|
||||
* Destructor
|
||||
*/
|
||||
CInfoWindowComponent::~CInfoWindowComponent() { }
|
||||
|
||||
/*
|
||||
* Info message for some time
|
||||
*/
|
||||
void CInfoWindowComponent::displayStringMessage(const QString &message, int displayTimeMs)
|
||||
{
|
||||
if (message.isEmpty())
|
||||
{
|
||||
this->hide();
|
||||
return;
|
||||
}
|
||||
|
||||
// message and display
|
||||
this->ui->te_StringMessage->setText(message);
|
||||
this->setCurrentPage(this->ui->pg_StringMessage);
|
||||
this->showWindow(displayTimeMs);
|
||||
}
|
||||
|
||||
/*
|
||||
* Info message for some time
|
||||
*/
|
||||
void CInfoWindowComponent::displayTextMessage(const CTextMessage &textMessage, int displayTimeMs)
|
||||
{
|
||||
if (textMessage.isEmpty())
|
||||
{
|
||||
this->hide();
|
||||
return;
|
||||
}
|
||||
|
||||
// message and display
|
||||
this->ui->le_TmFrom->setText(textMessage.getSenderCallsign().asString());
|
||||
this->ui->le_TmTo->setText(textMessage.getRecipientCallsign().asString());
|
||||
this->ui->le_TmReceived->setText(textMessage.receivedTime());
|
||||
this->ui->te_TmText->setText(textMessage.getMessage());
|
||||
|
||||
this->setCurrentPage(this->ui->pg_TextMessage);
|
||||
this->showWindow(displayTimeMs);
|
||||
}
|
||||
|
||||
/*
|
||||
* Display status message
|
||||
*/
|
||||
void CInfoWindowComponent::displayStatusMessage(const CStatusMessage &statusMessage, int displayTimeMs)
|
||||
{
|
||||
if (statusMessage.isEmpty())
|
||||
{
|
||||
this->hide();
|
||||
return;
|
||||
}
|
||||
|
||||
this->ui->le_SmSeverity->setText(statusMessage.getSeverityAsString());
|
||||
this->ui->le_SmType->setText(statusMessage.getTypeAsString());
|
||||
this->ui->te_SmStatusMessage->setText(statusMessage.getMessage());
|
||||
this->ui->lbl_SmSeverity->setPixmap(statusMessage.toIcon());
|
||||
|
||||
this->setCurrentPage(this->ui->pg_StatusMessage);
|
||||
this->showWindow(displayTimeMs);
|
||||
}
|
||||
|
||||
/*
|
||||
* Display
|
||||
*/
|
||||
void CInfoWindowComponent::display(const BlackMisc::CVariant &variant, int displayTimeMs)
|
||||
{
|
||||
if (variant.isNull()) return;
|
||||
if (variant.canConvert<CTextMessage>())
|
||||
this->displayTextMessage(variant.value<CTextMessage>(), displayTimeMs);
|
||||
else if (variant.canConvert<CStatusMessage>())
|
||||
this->displayStatusMessage(variant.value<CStatusMessage>(), displayTimeMs);
|
||||
else
|
||||
this->displayStringMessage(variant.toString(), displayTimeMs);
|
||||
}
|
||||
|
||||
/*
|
||||
* Init this window
|
||||
*/
|
||||
void CInfoWindowComponent::initWindow()
|
||||
{
|
||||
// center
|
||||
const QRect parent = this->parentWidget()->geometry();
|
||||
const QRect myself = this->rect();
|
||||
int dx = (parent.width() - myself.width()) / 2;
|
||||
int dy = (parent.height() - myself.height()) / 2;
|
||||
dy -= 80; // some offset, in order to display further on top
|
||||
this->move(dx, dy);
|
||||
this->show();
|
||||
}
|
||||
|
||||
/*
|
||||
* Show window
|
||||
*/
|
||||
void CInfoWindowComponent::showWindow(int displayTimeMs)
|
||||
{
|
||||
this->initWindow();
|
||||
|
||||
// hide after some time
|
||||
this->m_hideTimer->start(displayTimeMs);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set current widget
|
||||
*/
|
||||
void CInfoWindowComponent::setCurrentPage(QWidget *widget)
|
||||
{
|
||||
this->ui->sw_DifferentModes->setCurrentWidget(widget);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
66
src/blackgui/infowindowcomponent.h
Normal file
66
src/blackgui/infowindowcomponent.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/* Copyright (C) 2013 VATSIM Community / authors
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef BLACKGUI_INFOWINDOW_H
|
||||
#define BLACKGUI_INFOWINDOW_H
|
||||
|
||||
#include "blackmisc/nwtextmessage.h"
|
||||
#include "blackmisc/statusmessage.h"
|
||||
#include "blackmisc/variant.h"
|
||||
|
||||
#include <QWizardPage>
|
||||
#include <QScopedPointer>
|
||||
|
||||
namespace Ui { class InfoWindow; }
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
|
||||
/*!
|
||||
* Multi purpose info window (pop up window)
|
||||
*/
|
||||
class CInfoWindowComponent : public QWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
const static int DefaultDisplayTimeMs = 4000; //!< Display n milliseconds
|
||||
|
||||
//! Constructor
|
||||
explicit CInfoWindowComponent(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
~CInfoWindowComponent();
|
||||
|
||||
public slots:
|
||||
|
||||
//! Info message, pure string
|
||||
void displayStringMessage(const QString &message, int displayTimeMs = DefaultDisplayTimeMs);
|
||||
|
||||
//! Info message, based on text message
|
||||
void displayTextMessage(const BlackMisc::Network::CTextMessage &textMessage, int displayTimeMs = DefaultDisplayTimeMs);
|
||||
|
||||
//! Info message, based on status message
|
||||
void displayStatusMessage(const BlackMisc::CStatusMessage &statusMessage, int displayTimeMs = DefaultDisplayTimeMs);
|
||||
|
||||
//! Display any of the specialized types
|
||||
void display(const BlackMisc::CVariant &variant, int displayTimeMs = DefaultDisplayTimeMs);
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::InfoWindow> ui; //!< user interface
|
||||
QTimer *m_hideTimer;
|
||||
|
||||
//! Init the window
|
||||
void initWindow();
|
||||
|
||||
//! Show window, hide after some time
|
||||
void showWindow(int displayTimeMs);
|
||||
|
||||
//! Current page
|
||||
void setCurrentPage(QWidget *widget);
|
||||
};
|
||||
}
|
||||
|
||||
#endif // guard
|
||||
206
src/blackgui/infowindowcomponent.ui
Normal file
206
src/blackgui/infowindowcomponent.ui
Normal file
@@ -0,0 +1,206 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>InfoWindow</class>
|
||||
<widget class="QWizardPage" name="InfoWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>278</width>
|
||||
<height>143</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>WizardPage</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QWidget {
|
||||
font-family: arial-rounded;
|
||||
font: bold 10px;
|
||||
color: black; /** font **/
|
||||
}
|
||||
|
||||
QPushButton {
|
||||
background-color: transparent;
|
||||
border-style: solid;
|
||||
border-width: 0px;
|
||||
border-radius:3px;
|
||||
border-color: green;
|
||||
max-height:20px;
|
||||
}
|
||||
|
||||
QTextEdit {
|
||||
background-color: rgba(255, 255, 0, 240); /* transparent yellow */
|
||||
border-style: solid;
|
||||
border-width:1px;
|
||||
border-radius:6px;
|
||||
border-color: green;
|
||||
opacity: 0.5;
|
||||
}
|
||||
</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="hl_InfoWindow">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<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="QStackedWidget" name="sw_DifferentModes">
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="pg_StringMessage">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTextEdit" name="te_StringMessage">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pg_TextMessage">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gl_TextMessage">
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="lbl_TmTo">
|
||||
<property name="text">
|
||||
<string>To</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Received</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="le_TmReceived"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbl_TmFrom">
|
||||
<property name="text">
|
||||
<string>From</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLineEdit" name="le_TmTo">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="le_TmFrom">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="3">
|
||||
<widget class="QTextEdit" name="te_TmText"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pg_StatusMessage">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gl_StatusMessage">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbl_SmSeverity">
|
||||
<property name="text">
|
||||
<string>Severity</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbl_SmType">
|
||||
<property name="text">
|
||||
<string>Type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="le_SmSeverity">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QTextEdit" name="te_SmStatusMessage"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="le_SmType"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignTop">
|
||||
<widget class="QPushButton" name="pb_Close">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="blackgui.qrc">
|
||||
<normaloff>:/blackgui/icons/close.png</normaloff>:/blackgui/icons/close.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="blackgui.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>pb_Close</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>InfoWindow</receiver>
|
||||
<slot>hide()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>272</x>
|
||||
<y>52</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>302</x>
|
||||
<y>67</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -81,7 +81,7 @@ namespace BlackGui
|
||||
}
|
||||
else
|
||||
{
|
||||
emit this->displayOverlayInfo(CStatusMessage::getInfoMessage("SELCAL received", CStatusMessage::TypeGui));
|
||||
emit this->displayInInfoWindow(CStatusMessage::getInfoMessage("SELCAL received", CStatusMessage::TypeGui).toCVariant(), 3 * 1000);
|
||||
}
|
||||
}
|
||||
continue; // not displayed
|
||||
@@ -127,7 +127,7 @@ namespace BlackGui
|
||||
{
|
||||
// if the channel is selected, do nothing
|
||||
if (!this->isCorrespondingTextMessageTabSelected(message))
|
||||
emit this->displayOverlayInfo(message.asStatusMessage(true, true, "\t"));
|
||||
emit this->displayInInfoWindow(message.toCVariant(), 5 * 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,8 +38,8 @@ namespace BlackGui
|
||||
void setSelcalCallback(const std::function<const QString(void)> &selcalCallback) { this->m_selcalCallback = selcalCallback; }
|
||||
|
||||
signals:
|
||||
//! Invisible text message
|
||||
void displayOverlayInfo(const BlackMisc::CStatusMessage &message) const;
|
||||
//! Message to be displayed in info window
|
||||
void displayInInfoWindow(const BlackMisc::CVariant &message, int displayDurationMs) const;
|
||||
|
||||
public slots:
|
||||
//! Command entered
|
||||
@@ -110,7 +110,6 @@ namespace BlackGui
|
||||
|
||||
//! Clear text edit
|
||||
void clearTextEdit();
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "dbus.h"
|
||||
#include "tuple.h"
|
||||
#include "json.h"
|
||||
#include "variant.h"
|
||||
#include <QtDBus/QDBusMetaType>
|
||||
#include <QString>
|
||||
#include <QtGlobal>
|
||||
@@ -36,7 +37,7 @@ namespace BlackMisc
|
||||
|
||||
public:
|
||||
//! True if and only if T is derived from CPhysicalQuantity.
|
||||
static const bool value = sizeof(test(*(T*)0)) == sizeof(yes);
|
||||
static const bool value = sizeof(test(*(T *)0)) == sizeof(yes);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -101,7 +102,7 @@ namespace BlackMisc
|
||||
friend bool operator!=(const CValueObject &valueObject, const CIndexVariantMap &valueMap);
|
||||
|
||||
//! Comparison operator to allow valueobjects be used as keys in QMap and std::set.
|
||||
template <class T> friend typename std::enable_if<std::is_base_of<CValueObject, T>::value && ! PhysicalQuantities::IsQuantity<T>::value, bool>::type
|
||||
template <class T> friend typename std::enable_if < std::is_base_of<CValueObject, T>::value &&! PhysicalQuantities::IsQuantity<T>::value, bool >::type
|
||||
operator<(const T &lhs, const T &rhs)
|
||||
{
|
||||
const auto &lhsBase = static_cast<const CValueObject &>(lhs);
|
||||
@@ -110,7 +111,7 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
//! Comparison for symmetry with operator<.
|
||||
template <class T> friend typename std::enable_if<std::is_base_of<CValueObject, T>::value && ! PhysicalQuantities::IsQuantity<T>::value, bool>::type
|
||||
template <class T> friend typename std::enable_if < std::is_base_of<CValueObject, T>::value &&! PhysicalQuantities::IsQuantity<T>::value, bool >::type
|
||||
operator>(const T &lhs, const T &rhs)
|
||||
{
|
||||
const auto &lhsBase = static_cast<const CValueObject &>(lhs);
|
||||
@@ -119,7 +120,7 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
//! Comparison for symmetry with operator<.
|
||||
template <class T> friend typename std::enable_if<std::is_base_of<CValueObject, T>::value && ! PhysicalQuantities::IsQuantity<T>::value, bool>::type
|
||||
template <class T> friend typename std::enable_if < std::is_base_of<CValueObject, T>::value &&! PhysicalQuantities::IsQuantity<T>::value, bool >::type
|
||||
operator<=(const T &lhs, const T &rhs)
|
||||
{
|
||||
const auto &lhsBase = static_cast<const CValueObject &>(lhs);
|
||||
@@ -128,7 +129,7 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
//! Comparison for symmetry with operator<.
|
||||
template <class T> friend typename std::enable_if<std::is_base_of<CValueObject, T>::value && ! PhysicalQuantities::IsQuantity<T>::value, bool>::type
|
||||
template <class T> friend typename std::enable_if < std::is_base_of<CValueObject, T>::value &&! PhysicalQuantities::IsQuantity<T>::value, bool >::type
|
||||
operator>=(const T &lhs, const T &rhs)
|
||||
{
|
||||
const auto &lhsBase = static_cast<const CValueObject &>(lhs);
|
||||
@@ -167,6 +168,9 @@ namespace BlackMisc
|
||||
//! Virtual method to return QVariant, used with DBus QVariant lists
|
||||
virtual QVariant toQVariant() const = 0;
|
||||
|
||||
//! Virtual method to return CVariant
|
||||
virtual CVariant toCVariant() const { return CVariant(this->toQVariant()); }
|
||||
|
||||
//! Contribute to JSON object
|
||||
virtual QJsonObject toJson() const { QJsonObject json; return json;}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user