renamed NotifyQt into RsGUIEventManager

This commit is contained in:
csoler 2025-11-11 18:56:24 +01:00
parent 390084971a
commit a91a0893cf
17 changed files with 62 additions and 65 deletions

View file

@ -358,7 +358,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateStatus()));
timer->start(1000);
connect(NotifyQt::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
connect(RsGUIEventManager::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
settingsChanged();
mFontSizeHandler.registerFontSize(ui->listWidget, 1.5f);

View file

@ -289,7 +289,7 @@ PostedListWidgetWithModel::PostedListWidgetWithModel(const RsGxsGroupId& postedI
connect(ui->submitPostButton, SIGNAL(clicked()), this, SLOT(createMsg()));
connect(ui->subscribeToolButton, SIGNAL(subscribe(bool)), this, SLOT(subscribeGroup(bool)));
connect(ui->filter_LE, SIGNAL(textChanged(QString)), this, SLOT(filterItems(QString)));
connect(NotifyQt::getInstance(), SIGNAL(settingsChanged()),this, SLOT(settingsChanged()));
connect(RsGUIEventManager::getInstance(), SIGNAL(settingsChanged()),this, SLOT(settingsChanged()));
/* add filter actions */
ui->postsTree->setPlaceholderText(tr("No posts available in this board"));

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* gui/NotifyQt.cpp *
* gui/RsGUIEventManager.cpp *
* *
* Copyright (c) 2010 Retroshare Team <retroshare.project@gmail.com> *
* *
@ -62,29 +62,26 @@
* #define NOTIFY_DEBUG
****/
/*static*/ NotifyQt *NotifyQt::_instance = nullptr;
/*static*/ bool NotifyQt::_disableAllToaster = false;
/*static*/ RsGUIEventManager *RsGUIEventManager::_instance = nullptr;
/*static*/ bool RsGUIEventManager::_disableAllToaster = false;
/*static*/ NotifyQt *NotifyQt::Create ()
/*static*/ void RsGUIEventManager::Create ()
{
if (_instance == nullptr) {
_instance = new NotifyQt ();
}
return _instance;
if (_instance == nullptr)
_instance = new RsGUIEventManager ();
}
/*static*/ NotifyQt *NotifyQt::getInstance ()
/*static*/ RsGUIEventManager *RsGUIEventManager::getInstance ()
{
return _instance;
}
/*static*/ bool NotifyQt::isAllDisable ()
/*static*/ bool RsGUIEventManager::isAllDisable ()
{
return _disableAllToaster;
}
void NotifyQt::SetDisableAll(bool bValue)
void RsGUIEventManager::SetDisableAll(bool bValue)
{
if (bValue!=_disableAllToaster)
{
@ -93,7 +90,7 @@ void NotifyQt::SetDisableAll(bool bValue)
}
}
NotifyQt::NotifyQt() : cDialog(NULL)
RsGUIEventManager::RsGUIEventManager() : cDialog(NULL)
{
runningToasterTimer = new QTimer(this);
connect(runningToasterTimer, SIGNAL(timeout()), this, SLOT(runningTick()));
@ -118,7 +115,7 @@ NotifyQt::NotifyQt() : cDialog(NULL)
}, mEventHandlerId); // No event type means we expect to catch all possible events
}
bool NotifyQt::GUI_askForPassword(const std::string& title, const std::string& key_details, bool prev_is_bad)
bool RsGUIEventManager::GUI_askForPassword(const std::string& title, const std::string& key_details, bool prev_is_bad)
{
RsAutoUpdatePage::lockAllEvents() ;
@ -171,7 +168,7 @@ bool NotifyQt::GUI_askForPassword(const std::string& title, const std::string& k
RsLoginHelper::clearPgpPassphrase();
return false;
}
bool NotifyQt::GUI_askForPluginConfirmation(const std::string& plugin_file_name, const RsFileHash& plugin_file_hash, bool first_time)
bool RsGUIEventManager::GUI_askForPluginConfirmation(const std::string& plugin_file_name, const RsFileHash& plugin_file_hash, bool first_time)
{
// By default, when no information is known about plugins, just dont load them. They will be enabled from the GUI by the user.
@ -207,14 +204,14 @@ bool NotifyQt::GUI_askForPluginConfirmation(const std::string& plugin_file_name,
}
}
void NotifyQt::enable()
void RsGUIEventManager::enable()
{
QMutexLocker m(&_mutex) ;
std::cerr << "Enabling notification system" << std::endl;
_enabled = true ;
}
void NotifyQt::sync_handleIncomingEvent(std::shared_ptr<const RsEvent> event)
void RsGUIEventManager::sync_handleIncomingEvent(std::shared_ptr<const RsEvent> event)
{
auto ev6 = dynamic_cast<const RsSystemEvent*>(event.get());
@ -224,7 +221,7 @@ void NotifyQt::sync_handleIncomingEvent(std::shared_ptr<const RsEvent> event)
GUI_askForPluginConfirmation(ev6->plugin_file_name, ev6->plugin_file_hash, ev6->plugin_first_time);
}
void NotifyQt::async_handleIncomingEvent(std::shared_ptr<const RsEvent> event)
void RsGUIEventManager::async_handleIncomingEvent(std::shared_ptr<const RsEvent> event)
{
/* Finally Check for PopupMessages / System Error Messages */
@ -403,7 +400,7 @@ void NotifyQt::async_handleIncomingEvent(std::shared_ptr<const RsEvent> event)
startWaitingToasters();
}
void NotifyQt::testToasters(RsNotifyPopupFlags notifyFlags, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin)
void RsGUIEventManager::testToasters(RsNotifyPopupFlags notifyFlags, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin)
{
QString title = tr("Test");
QString message = tr("This is a test.");
@ -469,7 +466,7 @@ void NotifyQt::testToasters(RsNotifyPopupFlags notifyFlags, /*RshareSettings::en
}
}
void NotifyQt::testToaster(ToasterNotify *toasterNotify, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin)
void RsGUIEventManager::testToaster(ToasterNotify *toasterNotify, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin)
{
if (!toasterNotify) {
@ -490,7 +487,7 @@ void NotifyQt::testToaster(ToasterNotify *toasterNotify, /*RshareSettings::enumT
}
}
void NotifyQt::testToaster(QString tag, ToasterNotify *toasterNotify, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin)
void RsGUIEventManager::testToaster(QString tag, ToasterNotify *toasterNotify, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin)
{
if (!toasterNotify) {
@ -511,7 +508,7 @@ void NotifyQt::testToaster(QString tag, ToasterNotify *toasterNotify, /*RshareSe
}
}
void NotifyQt::notifyChatFontChanged()
void RsGUIEventManager::notifyChatFontChanged()
{
{
QMutexLocker m(&_mutex) ;
@ -521,7 +518,7 @@ void NotifyQt::notifyChatFontChanged()
emit chatFontChanged();
}
void NotifyQt::notifyChatStyleChanged(int /*ChatStyle::enumStyleType*/ styleType)
void RsGUIEventManager::notifyChatStyleChanged(int /*ChatStyle::enumStyleType*/ styleType)
{
{
QMutexLocker m(&_mutex) ;
@ -532,12 +529,12 @@ void NotifyQt::notifyChatStyleChanged(int /*ChatStyle::enumStyleType*/ styleType
emit chatStyleChanged(styleType);
}
void NotifyQt::notifySettingsChanged()
void RsGUIEventManager::notifySettingsChanged()
{
emit settingsChanged();
}
void NotifyQt::startWaitingToasters()
void RsGUIEventManager::startWaitingToasters()
{
{
if (waitingToasterList.empty()) {
@ -607,7 +604,7 @@ void NotifyQt::startWaitingToasters()
}
}
void NotifyQt::runningTick()
void RsGUIEventManager::runningTick()
{
//QMutexLocker lock(&runningToasterMutex);
@ -692,7 +689,7 @@ void NotifyQt::runningTick()
}
}
void NotifyQt::displayErrorMessage(RsNotifySysFlags type,const QString& title,const QString& error_msg)
void RsGUIEventManager::displayErrorMessage(RsNotifySysFlags type,const QString& title,const QString& error_msg)
{
/* make a warning message */
switch(type)
@ -711,7 +708,7 @@ void NotifyQt::displayErrorMessage(RsNotifySysFlags type,const QString& title,co
}
}
void NotifyQt::displayDiskSpaceWarning(int loc,int size_limit_mb)
void RsGUIEventManager::displayDiskSpaceWarning(int loc,int size_limit_mb)
{
QString locString ;
switch(loc)

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* gui/NotifyQt.h *
* gui/RsGUIEventManager.h *
* *
* Copyright (c) 2010 Retroshare Team <retroshare.project@gmail.com> *
* *
@ -48,16 +48,16 @@ class SignatureEventData ;
struct TurtleFileInfo;
struct TurtleGxsInfo;
class NotifyQt: public QObject
class RsGUIEventManager: public QObject
{
Q_OBJECT
public:
static NotifyQt *Create ();
static NotifyQt *getInstance ();
static void Create();
static RsGUIEventManager *getInstance ();
static bool isAllDisable();
void enable() ;
virtual ~NotifyQt() = default;
virtual ~RsGUIEventManager() = default;
virtual bool GUI_askForPassword(const std::string& title, const std::string& key_details, bool prev_is_bad);
virtual bool GUI_askForPluginConfirmation(const std::string& plugin_filename, const RsFileHash& plugin_file_hash,bool first_time);
@ -96,12 +96,12 @@ class NotifyQt: public QObject
void runningTick();
private:
NotifyQt();
RsGUIEventManager();
static void displayDiskSpaceWarning(int loc,int size_limit_mb);
static void displayErrorMessage(RsNotifySysFlags type,const QString& title,const QString& error_msg);
static NotifyQt *_instance;
static RsGUIEventManager *_instance;
static bool _disableAllToaster;
/* system notifications */

View file

@ -130,7 +130,7 @@ ChatStyle::ChatStyle() : QObject()
{
m_styleType = TYPE_UNKNOWN;
connect(NotifyQt::getInstance(), SIGNAL(chatStyleChanged(int)), SLOT(styleChanged(int)));
connect(RsGUIEventManager::getInstance(), SIGNAL(chatStyleChanged(int)), SLOT(styleChanged(int)));
}
/* Destructor. */

View file

@ -199,7 +199,7 @@ ChatWidget::ChatWidget(QWidget *parent)
}, this );
},mEventHandlerId_friends,RsEventType::FRIEND_LIST);
connect(NotifyQt::getInstance(), SIGNAL(chatFontChanged()), this, SLOT(resetFonts()));
connect(RsGUIEventManager::getInstance(), SIGNAL(chatFontChanged()), this, SLOT(resetFonts()));
connect(ui->textBrowser, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuTextBrowser(QPoint)));

View file

@ -173,7 +173,7 @@ void GxsGroupFrameDialog::initUi()
processSettings(true);
if (groupFrameSettingsType() != GroupFrameSettings::Nothing) {
connect(NotifyQt::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
connect(RsGUIEventManager::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
settingsChanged();
}

View file

@ -446,7 +446,7 @@ GxsChannelPostsWidgetWithModel::GxsChannelPostsWidgetWithModel(const RsGxsGroupI
/* Connect signals */
connect(ui->postButton, SIGNAL(clicked()), this, SLOT(createMsg()));
connect(ui->subscribeToolButton, SIGNAL(subscribe(bool)), this, SLOT(subscribeGroup(bool)));
connect(NotifyQt::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
connect(RsGUIEventManager::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
ui->postButton->setText(tr("Add new post"));

View file

@ -173,7 +173,7 @@ void AppearancePage::updateRbtPageOnToolBar()
ui.cmboTollButtonsStyle->show();
}
NotifyQt::getInstance()->notifySettingsChanged();
RsGUIEventManager::getInstance()->notifySettingsChanged();
}
void AppearancePage::updateStatusToolTip() { MainWindow::getInstance()->toggleStatusToolTip(ui.checkBoxDisableSysTrayToolTip->isChecked()); }
@ -194,7 +194,7 @@ void AppearancePage::updateCmboToolButtonStyle()
default:
Settings->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
}
NotifyQt::getInstance()->notifySettingsChanged();
RsGUIEventManager::getInstance()->notifySettingsChanged();
}
void AppearancePage::updateCmboToolButtonSize()
@ -226,7 +226,7 @@ void AppearancePage::updateCmboToolButtonSize()
Settings->setToolButtonSize(128);
Settings->setListItemIconSize(128);
}
NotifyQt::getInstance()->notifySettingsChanged();
RsGUIEventManager::getInstance()->notifySettingsChanged();
}
// void AppearancePage::updateCmboListItemSize()
// {
@ -369,5 +369,5 @@ void AppearancePage::updateFontSize()
{
Settings->setFontSize(ui.minimumFontSize_SB->value());
NotifyQt::getInstance()->notifySettingsChanged();
RsGUIEventManager::getInstance()->notifySettingsChanged();
}

View file

@ -126,7 +126,7 @@ void ChatPage::updateFontsAndEmotes()
void ChatPage::updateChatParams()
{
Settings->setChatScreenFont(fontTempChat.toString());
NotifyQt::getInstance()->notifyChatFontChanged();
RsGUIEventManager::getInstance()->notifyChatFontChanged();
Settings->setChatSendMessageWithCtrlReturn(ui.sendMessageWithCtrlReturn->isChecked());
Settings->setChatSendAsPlainTextByDef(ui.sendAsPlainTextByDef->isChecked());
@ -186,7 +186,7 @@ void ChatPage::updatePublicStyle()
if (publicStylePath != info.stylePath || publicStyleVariant != ui.publicComboBoxVariant->currentText()) {
Settings->setPublicChatStyle(info.stylePath, ui.publicComboBoxVariant->currentText());
NotifyQt::getInstance()->notifyChatStyleChanged(ChatStyle::TYPE_PUBLIC);
RsGUIEventManager::getInstance()->notifyChatStyleChanged(ChatStyle::TYPE_PUBLIC);
}
}
@ -196,7 +196,7 @@ void ChatPage::updatePrivateStyle()
if (privateStylePath != info.stylePath || privateStyleVariant != ui.privateComboBoxVariant->currentText()) {
Settings->setPrivateChatStyle(info.stylePath, ui.privateComboBoxVariant->currentText());
NotifyQt::getInstance()->notifyChatStyleChanged(ChatStyle::TYPE_PRIVATE);
RsGUIEventManager::getInstance()->notifyChatStyleChanged(ChatStyle::TYPE_PRIVATE);
}
}
@ -206,7 +206,7 @@ void ChatPage::updateHistoryStyle()
if (historyStylePath != info.stylePath || historyStyleVariant != ui.historyComboBoxVariant->currentText()) {
Settings->setHistoryChatStyle(info.stylePath, ui.historyComboBoxVariant->currentText());
NotifyQt::getInstance()->notifyChatStyleChanged(ChatStyle::TYPE_HISTORY);
RsGUIEventManager::getInstance()->notifyChatStyleChanged(ChatStyle::TYPE_HISTORY);
}
}

View file

@ -78,6 +78,6 @@ void GroupFrameSettingsWidget::saveSettings()
Settings->setGroupFrameSettings(mType, groupFrameSettings);
NotifyQt::getInstance()->notifySettingsChanged();
RsGUIEventManager::getInstance()->notifySettingsChanged();
}
}

View file

@ -311,5 +311,5 @@ void MessagePage::updateFontSize()
{
Settings->setMessageFontSize(ui.minimumFontSize->currentData().toInt());
NotifyQt::getInstance()->notifySettingsChanged();
RsGUIEventManager::getInstance()->notifySettingsChanged();
}

View file

@ -44,8 +44,8 @@ NotifyPage::NotifyPage(QWidget * parent, Qt::WindowFlags flags)
connect(ui.testFeedButton, SIGNAL(clicked()), this, SLOT(testFeed()));
connect(ui.testToasterButton, SIGNAL(clicked()), this, SLOT(testToaster()));
connect(ui.pushButtonDisableAll,SIGNAL(toggled(bool)), NotifyQt::getInstance(), SLOT(SetDisableAll(bool)));
connect(NotifyQt::getInstance(),SIGNAL(disableAllChanged(bool)), ui.pushButtonDisableAll, SLOT(setChecked(bool)));
connect(ui.pushButtonDisableAll,SIGNAL(toggled(bool)), RsGUIEventManager::getInstance(), SLOT(SetDisableAll(bool)));
connect(RsGUIEventManager::getInstance(),SIGNAL(disableAllChanged(bool)), ui.pushButtonDisableAll, SLOT(setChecked(bool)));
ui.notify_Blogs->hide();
@ -325,7 +325,7 @@ void NotifyPage::load()
whileBlocking(ui.systray_GroupChat)->setChecked(Settings->getDisplayTrayGroupChat());
whileBlocking(ui.systray_ChatLobby)->setChecked(Settings->getDisplayTrayChatLobby());
whileBlocking(ui.pushButtonDisableAll)->setChecked(NotifyQt::isAllDisable());
whileBlocking(ui.pushButtonDisableAll)->setChecked(RsGUIEventManager::isAllDisable());
RshareSettings::enumToasterPosition toasterPosition = Settings->getToasterPosition();
ui.comboBoxToasterPosition->clear();
@ -412,16 +412,16 @@ void NotifyPage::testToaster()
{
RshareSettings::enumToasterPosition pos = (RshareSettings::enumToasterPosition) ui.comboBoxToasterPosition->itemData(ui.comboBoxToasterPosition->currentIndex()).toInt();
QPoint margin = QPoint(ui.spinBoxToasterXMargin->value(), ui.spinBoxToasterYMargin->value());
NotifyQt::getInstance()->testToasters(getNotifyFlags(), pos, margin);
RsGUIEventManager::getInstance()->testToasters(getNotifyFlags(), pos, margin);
/* notify of plugins */
QList<ToasterNotifySetting>::iterator toasterNotifyIt;
for (toasterNotifyIt = mToasterNotifySettingList.begin(); toasterNotifyIt != mToasterNotifySettingList.end(); ++toasterNotifyIt) {
if (toasterNotifyIt->mEnabledCheckBox->isChecked()){
if (toasterNotifyIt->mEnabledCheckBox->accessibleName().isEmpty()){
NotifyQt::getInstance()->testToaster(toasterNotifyIt->mToasterNotify, pos, margin) ;
RsGUIEventManager::getInstance()->testToaster(toasterNotifyIt->mToasterNotify, pos, margin) ;
} else {
NotifyQt::getInstance()->testToaster(toasterNotifyIt->mEnabledCheckBox->accessibleName(), toasterNotifyIt->mToasterNotify, pos, margin) ;
RsGUIEventManager::getInstance()->testToaster(toasterNotifyIt->mEnabledCheckBox->accessibleName(), toasterNotifyIt->mToasterNotify, pos, margin) ;
}
}
}

View file

@ -238,6 +238,6 @@ void SettingsPage::notifySettingsChanged()
/* call to RsIface save function.... */
//rsicontrol -> ConfigSave();
if (NotifyQt::getInstance())
NotifyQt::getInstance()->notifySettingsChanged();
if (RsGUIEventManager::getInstance())
RsGUIEventManager::getInstance()->notifySettingsChanged();
}

View file

@ -47,11 +47,11 @@ ToasterDisable::ToasterDisable(QWidget *parent)
setLayout(hbox);
bool isDisable = NotifyQt::isAllDisable();
bool isDisable = RsGUIEventManager::isAllDisable();
imageButton->setChecked(isDisable);
connect(NotifyQt::getInstance(), SIGNAL(disableAllChanged(bool)), this, SLOT(disable(bool)));
connect(imageButton, SIGNAL(toggled(bool)), NotifyQt::getInstance(), SLOT(SetDisableAll(bool)));
connect(RsGUIEventManager::getInstance(), SIGNAL(disableAllChanged(bool)), this, SLOT(disable(bool)));
connect(imageButton, SIGNAL(toggled(bool)), RsGUIEventManager::getInstance(), SLOT(SetDisableAll(bool)));
disable(isDisable);
}

View file

@ -346,7 +346,7 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
//
RsControl::earlyInitNotificationSystem() ;
NotifyQt *notify = NotifyQt::Create();
RsGUIEventManager::Create();
//rsNotify->registerNotifyClient(notify);
/* RetroShare Core Objects */

View file

@ -71,7 +71,7 @@ public:
data.callback = callback;
mWidget.insert(widget, data);
QObject::connect(NotifyQt::getInstance(), &NotifyQt::settingsChanged, widget, [this, widget, callback]() {
QObject::connect(RsGUIEventManager::getInstance(), &RsGUIEventManager::settingsChanged, widget, [this, widget, callback]() {
mFontSizeHandlerBase->updateFontSize(widget, callback);
});
@ -93,7 +93,7 @@ public:
data.callback = callback;
mView.insert(view, data);
QObject::connect(NotifyQt::getInstance(), &NotifyQt::settingsChanged, view, [this, view, iconHeightFactor, callback]() {
QObject::connect(RsGUIEventManager::getInstance(), &RsGUIEventManager::settingsChanged, view, [this, view, iconHeightFactor, callback]() {
mFontSizeHandlerBase->updateFontSize(view, iconHeightFactor, callback);
});