mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 11:55:35 +08:00
Allow to reset/disable overlay messages with one click
This commit is contained in:
committed by
Mat Sutcliffe
parent
242bea3636
commit
70f9420da5
@@ -11,6 +11,11 @@
|
||||
#include "settingstextmessageinlinecomponent.h"
|
||||
#include "ui_settingstextmessageinlinecomponent.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QCheckBox>
|
||||
#include <QTimer>
|
||||
#include <QPointer>
|
||||
|
||||
using namespace BlackGui::Settings;
|
||||
using namespace BlackMisc;
|
||||
|
||||
@@ -23,11 +28,14 @@ namespace BlackGui
|
||||
ui(new Ui::CSettingsTextMessageInlineComponent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
connect(ui->cb_All, &QCheckBox::released, this, &CSettingsTextMessageInlineComponent::changeSettings);
|
||||
connect(ui->cb_Frequency, &QCheckBox::released, this, &CSettingsTextMessageInlineComponent::changeSettings);
|
||||
connect(ui->cb_Private, &QCheckBox::released, this, &CSettingsTextMessageInlineComponent::changeSettings);
|
||||
connect(ui->cb_Supervisor, &QCheckBox::released, this, &CSettingsTextMessageInlineComponent::changeSettings);
|
||||
connect(ui->cb_Focus, &QCheckBox::released, this, &CSettingsTextMessageInlineComponent::changeSettings);
|
||||
connect(ui->cb_All, &QCheckBox::released, this, &CSettingsTextMessageInlineComponent::changeSettings);
|
||||
connect(ui->cb_Frequency, &QCheckBox::released, this, &CSettingsTextMessageInlineComponent::changeSettings);
|
||||
connect(ui->cb_Private, &QCheckBox::released, this, &CSettingsTextMessageInlineComponent::changeSettings);
|
||||
connect(ui->cb_Supervisor, &QCheckBox::released, this, &CSettingsTextMessageInlineComponent::changeSettings);
|
||||
connect(ui->cb_Focus, &QCheckBox::released, this, &CSettingsTextMessageInlineComponent::changeSettings);
|
||||
connect(ui->pb_Disable, &QPushButton::released, this, &CSettingsTextMessageInlineComponent::disableAllOverlayMessages);
|
||||
connect(ui->pb_Reset, &QPushButton::released, this, &CSettingsTextMessageInlineComponent::resetOverlayMessages);
|
||||
|
||||
this->settingsChanged();
|
||||
}
|
||||
|
||||
@@ -57,5 +65,32 @@ namespace BlackGui
|
||||
const CStatusMessage m = m_settings.setAndSave(s);
|
||||
CLogMessage::preformatted(m);
|
||||
}
|
||||
|
||||
void CSettingsTextMessageInlineComponent::disableAllOverlayMessages()
|
||||
{
|
||||
CTextMessageSettings s(m_settings.get());
|
||||
s.disableAllPopups();
|
||||
const CStatusMessage m = m_settings.setAndSave(s);
|
||||
CLogMessage::preformatted(m);
|
||||
|
||||
QPointer<CSettingsTextMessageInlineComponent> myself(this);
|
||||
QTimer::singleShot(500, this, [ = ]
|
||||
{
|
||||
if (myself) { myself->settingsChanged(); }
|
||||
});
|
||||
}
|
||||
|
||||
void CSettingsTextMessageInlineComponent::resetOverlayMessages()
|
||||
{
|
||||
CTextMessageSettings s;
|
||||
const CStatusMessage m = m_settings.setAndSave(s);
|
||||
CLogMessage::preformatted(m);
|
||||
|
||||
QPointer<CSettingsTextMessageInlineComponent> myself(this);
|
||||
QTimer::singleShot(500, this, [ = ]
|
||||
{
|
||||
if (myself) { myself->settingsChanged(); }
|
||||
});
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -42,6 +42,12 @@ namespace BlackGui
|
||||
//! Change the settings
|
||||
void changeSettings();
|
||||
|
||||
//! Disable all overlay messages
|
||||
void disableAllOverlayMessages();
|
||||
|
||||
//! Reset all overlay messages
|
||||
void resetOverlayMessages();
|
||||
|
||||
QScopedPointer<Ui::CSettingsTextMessageInlineComponent> ui;
|
||||
BlackMisc::CSetting<BlackGui::Settings::TextMessageSettings> m_settings { this, &CSettingsTextMessageInlineComponent::settingsChanged }; //!< settings changed
|
||||
};
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>283</width>
|
||||
<height>45</height>
|
||||
<width>293</width>
|
||||
<height>46</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -79,11 +79,49 @@
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QCheckBox" name="cb_All">
|
||||
<property name="toolTip">
|
||||
<string>all messages as overlay</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>all</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2" alignment="Qt::AlignLeft">
|
||||
<widget class="QWidget" name="wi_Buttons" native="true">
|
||||
<layout class="QHBoxLayout" name="hl_Buttons">
|
||||
<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="QPushButton" name="pb_Disable">
|
||||
<property name="toolTip">
|
||||
<string>disable all overlay message</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>disable</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_Reset">
|
||||
<property name="text">
|
||||
<string>reset</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
@@ -91,6 +129,8 @@
|
||||
<tabstop>cb_Supervisor</tabstop>
|
||||
<tabstop>cb_Selcal</tabstop>
|
||||
<tabstop>cb_Frequency</tabstop>
|
||||
<tabstop>pb_Disable</tabstop>
|
||||
<tabstop>pb_Reset</tabstop>
|
||||
<tabstop>cb_All</tabstop>
|
||||
<tabstop>cb_Focus</tabstop>
|
||||
</tabstops>
|
||||
|
||||
@@ -41,6 +41,16 @@ namespace BlackGui
|
||||
return this->getPopupAllMessages() || m_popupSelcalMessages;
|
||||
}
|
||||
|
||||
void CTextMessageSettings::disableAllPopups()
|
||||
{
|
||||
m_popupPrivateMessages = false;
|
||||
m_popupSupervisorMessages = false;
|
||||
m_popupFrequencyMessages = false;
|
||||
m_popupAllMessages = false;
|
||||
m_popupSelcalMessages = false;
|
||||
m_focus = false;
|
||||
}
|
||||
|
||||
bool CTextMessageSettings::popup(const CTextMessage &textMessage) const
|
||||
{
|
||||
if (this->getPopupAllMessages()) { return true; }
|
||||
|
||||
@@ -86,6 +86,9 @@ namespace BlackGui
|
||||
//! SELCAL messages?
|
||||
void setPopupSelcalMessages(bool popup) { m_popupSelcalMessages = popup; }
|
||||
|
||||
//! Entirely disable
|
||||
void disableAllPopups();
|
||||
|
||||
//! Popup the given message? Quick check without frequency checks.
|
||||
bool popup(const BlackMisc::Network::CTextMessage &textMessage) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user