mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 20:15: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 "settingstextmessageinlinecomponent.h"
|
||||||
#include "ui_settingstextmessageinlinecomponent.h"
|
#include "ui_settingstextmessageinlinecomponent.h"
|
||||||
|
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QCheckBox>
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QPointer>
|
||||||
|
|
||||||
using namespace BlackGui::Settings;
|
using namespace BlackGui::Settings;
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
|
|
||||||
@@ -28,6 +33,9 @@ namespace BlackGui
|
|||||||
connect(ui->cb_Private, &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_Supervisor, &QCheckBox::released, this, &CSettingsTextMessageInlineComponent::changeSettings);
|
||||||
connect(ui->cb_Focus, &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();
|
this->settingsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,5 +65,32 @@ namespace BlackGui
|
|||||||
const CStatusMessage m = m_settings.setAndSave(s);
|
const CStatusMessage m = m_settings.setAndSave(s);
|
||||||
CLogMessage::preformatted(m);
|
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
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -42,6 +42,12 @@ namespace BlackGui
|
|||||||
//! Change the settings
|
//! Change the settings
|
||||||
void changeSettings();
|
void changeSettings();
|
||||||
|
|
||||||
|
//! Disable all overlay messages
|
||||||
|
void disableAllOverlayMessages();
|
||||||
|
|
||||||
|
//! Reset all overlay messages
|
||||||
|
void resetOverlayMessages();
|
||||||
|
|
||||||
QScopedPointer<Ui::CSettingsTextMessageInlineComponent> ui;
|
QScopedPointer<Ui::CSettingsTextMessageInlineComponent> ui;
|
||||||
BlackMisc::CSetting<BlackGui::Settings::TextMessageSettings> m_settings { this, &CSettingsTextMessageInlineComponent::settingsChanged }; //!< settings changed
|
BlackMisc::CSetting<BlackGui::Settings::TextMessageSettings> m_settings { this, &CSettingsTextMessageInlineComponent::settingsChanged }; //!< settings changed
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>283</width>
|
<width>293</width>
|
||||||
<height>45</height>
|
<height>46</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -79,11 +79,49 @@
|
|||||||
</item>
|
</item>
|
||||||
<item row="1" column="3">
|
<item row="1" column="3">
|
||||||
<widget class="QCheckBox" name="cb_All">
|
<widget class="QCheckBox" name="cb_All">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>all messages as overlay</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>all</string>
|
<string>all</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
@@ -91,6 +129,8 @@
|
|||||||
<tabstop>cb_Supervisor</tabstop>
|
<tabstop>cb_Supervisor</tabstop>
|
||||||
<tabstop>cb_Selcal</tabstop>
|
<tabstop>cb_Selcal</tabstop>
|
||||||
<tabstop>cb_Frequency</tabstop>
|
<tabstop>cb_Frequency</tabstop>
|
||||||
|
<tabstop>pb_Disable</tabstop>
|
||||||
|
<tabstop>pb_Reset</tabstop>
|
||||||
<tabstop>cb_All</tabstop>
|
<tabstop>cb_All</tabstop>
|
||||||
<tabstop>cb_Focus</tabstop>
|
<tabstop>cb_Focus</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
|
|||||||
@@ -41,6 +41,16 @@ namespace BlackGui
|
|||||||
return this->getPopupAllMessages() || m_popupSelcalMessages;
|
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
|
bool CTextMessageSettings::popup(const CTextMessage &textMessage) const
|
||||||
{
|
{
|
||||||
if (this->getPopupAllMessages()) { return true; }
|
if (this->getPopupAllMessages()) { return true; }
|
||||||
|
|||||||
@@ -86,6 +86,9 @@ namespace BlackGui
|
|||||||
//! SELCAL messages?
|
//! SELCAL messages?
|
||||||
void setPopupSelcalMessages(bool popup) { m_popupSelcalMessages = popup; }
|
void setPopupSelcalMessages(bool popup) { m_popupSelcalMessages = popup; }
|
||||||
|
|
||||||
|
//! Entirely disable
|
||||||
|
void disableAllPopups();
|
||||||
|
|
||||||
//! Popup the given message? Quick check without frequency checks.
|
//! Popup the given message? Quick check without frequency checks.
|
||||||
bool popup(const BlackMisc::Network::CTextMessage &textMessage) const;
|
bool popup(const BlackMisc::Network::CTextMessage &textMessage) const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user