mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
fixed settings for tray message enable/disable
now it can be enabled and disabled at runtime git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3141 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
6d3db4ae66
commit
1585859896
@ -357,6 +357,20 @@ void MainWindow::createTrayIcon()
|
|||||||
trayIcon->show();
|
trayIcon->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*static*/ void MainWindow::installGroupChatNotifier()
|
||||||
|
{
|
||||||
|
if (_instance == NULL) {
|
||||||
|
// nothing to do
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Settings->getDisplayTrayGroupChat()) {
|
||||||
|
QObject::connect(_instance->peersDialog, SIGNAL(notifyGroupChat(const QString&,const QString&)), _instance, SLOT(displaySystrayMsg(const QString&,const QString&)), Qt::QueuedConnection);
|
||||||
|
} else {
|
||||||
|
QObject::disconnect(_instance->peersDialog, SIGNAL(notifyGroupChat(const QString&,const QString&)), _instance, SLOT(displaySystrayMsg(const QString&,const QString&)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::displaySystrayMsg(const QString& title,const QString& msg)
|
void MainWindow::displaySystrayMsg(const QString& title,const QString& msg)
|
||||||
{
|
{
|
||||||
trayIcon->showMessage(title, msg, QSystemTrayIcon::Information, 3000);
|
trayIcon->showMessage(title, msg, QSystemTrayIcon::Information, 3000);
|
||||||
|
@ -134,6 +134,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
PluginsPage* pluginsPage ;
|
PluginsPage* pluginsPage ;
|
||||||
|
|
||||||
|
static void installGroupChatNotifier();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void updateHashingInfo(const QString&) ;
|
void updateHashingInfo(const QString&) ;
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
#include "rsiface/rsnotify.h"
|
#include "rsiface/rsnotify.h"
|
||||||
#include "rsharesettings.h"
|
#include "rsharesettings.h"
|
||||||
|
|
||||||
|
#include "gui/MainWindow.h"
|
||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
|
||||||
@ -63,97 +65,91 @@ NotifyPage::closeEvent (QCloseEvent * event)
|
|||||||
bool
|
bool
|
||||||
NotifyPage::save(QString &errmsg)
|
NotifyPage::save(QString &errmsg)
|
||||||
{
|
{
|
||||||
/* extract from rsNotify the flags */
|
/* extract from rsNotify the flags */
|
||||||
|
|
||||||
uint notifyflags = 0;
|
uint notifyflags = 0;
|
||||||
uint newsflags = 0;
|
uint newsflags = 0;
|
||||||
uint chatflags = 0;
|
uint chatflags = 0;
|
||||||
|
|
||||||
if (ui.popup_Connect->isChecked())
|
if (ui.popup_Connect->isChecked())
|
||||||
notifyflags |= RS_POPUP_CONNECT;
|
notifyflags |= RS_POPUP_CONNECT;
|
||||||
|
|
||||||
if (ui.popup_NewMsg->isChecked())
|
if (ui.popup_NewMsg->isChecked())
|
||||||
notifyflags |= RS_POPUP_MSG;
|
notifyflags |= RS_POPUP_MSG;
|
||||||
|
|
||||||
//if (ui.popup_NewChat->isChecked())
|
//if (ui.popup_NewChat->isChecked())
|
||||||
notifyflags |= RS_POPUP_CHAT;
|
notifyflags |= RS_POPUP_CHAT;
|
||||||
|
|
||||||
//if (ui.popup_Call->isChecked())
|
//if (ui.popup_Call->isChecked())
|
||||||
// notifyflags |= RS_POPUP_CALL;
|
// notifyflags |= RS_POPUP_CALL;
|
||||||
|
|
||||||
|
|
||||||
if (ui.notify_Peers->isChecked())
|
if (ui.notify_Peers->isChecked())
|
||||||
newsflags |= RS_FEED_TYPE_PEER;
|
newsflags |= RS_FEED_TYPE_PEER;
|
||||||
if (ui.notify_Channels->isChecked())
|
if (ui.notify_Channels->isChecked())
|
||||||
newsflags |= RS_FEED_TYPE_CHAN;
|
newsflags |= RS_FEED_TYPE_CHAN;
|
||||||
if (ui.notify_Forums->isChecked())
|
if (ui.notify_Forums->isChecked())
|
||||||
newsflags |= RS_FEED_TYPE_FORUM;
|
newsflags |= RS_FEED_TYPE_FORUM;
|
||||||
if (ui.notify_Blogs->isChecked())
|
if (ui.notify_Blogs->isChecked())
|
||||||
newsflags |= RS_FEED_TYPE_BLOG;
|
newsflags |= RS_FEED_TYPE_BLOG;
|
||||||
if (ui.notify_Chat->isChecked())
|
if (ui.notify_Chat->isChecked())
|
||||||
newsflags |= RS_FEED_TYPE_CHAT;
|
newsflags |= RS_FEED_TYPE_CHAT;
|
||||||
if (ui.notify_Messages->isChecked())
|
if (ui.notify_Messages->isChecked())
|
||||||
newsflags |= RS_FEED_TYPE_MSG;
|
newsflags |= RS_FEED_TYPE_MSG;
|
||||||
|
|
||||||
if (ui.chat_NewWindow->isChecked())
|
if (ui.chat_NewWindow->isChecked())
|
||||||
chatflags |= RS_CHAT_OPEN_NEW;
|
chatflags |= RS_CHAT_OPEN_NEW;
|
||||||
if (ui.chat_Reopen->isChecked())
|
if (ui.chat_Reopen->isChecked())
|
||||||
chatflags |= RS_CHAT_REOPEN;
|
chatflags |= RS_CHAT_REOPEN;
|
||||||
if (ui.chat_Focus->isChecked())
|
if (ui.chat_Focus->isChecked())
|
||||||
chatflags |= RS_CHAT_FOCUS;
|
chatflags |= RS_CHAT_FOCUS;
|
||||||
|
|
||||||
Settings->setNotifyFlags(notifyflags);
|
Settings->setNotifyFlags(notifyflags);
|
||||||
Settings->setNewsFeedFlags(newsflags);
|
Settings->setNewsFeedFlags(newsflags);
|
||||||
Settings->setChatFlags(chatflags);
|
Settings->setChatFlags(chatflags);
|
||||||
|
|
||||||
Settings->setValue(QString::fromUtf8("DisplayTrayGroupChat"), trayGroupChat());
|
|
||||||
|
|
||||||
load();
|
Settings->setDisplayTrayGroupChat(ui.systray_GroupChat->isChecked());
|
||||||
return true;
|
MainWindow::installGroupChatNotifier();
|
||||||
|
|
||||||
|
load();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Loads the settings for this page */
|
/** Loads the settings for this page */
|
||||||
void NotifyPage::load()
|
void NotifyPage::load()
|
||||||
{
|
{
|
||||||
/* extract from rsNotify the flags */
|
/* extract from rsNotify the flags */
|
||||||
uint notifyflags = Settings->getNotifyFlags();
|
uint notifyflags = Settings->getNotifyFlags();
|
||||||
uint newsflags = Settings->getNewsFeedFlags();
|
uint newsflags = Settings->getNewsFeedFlags();
|
||||||
uint chatflags = Settings->getChatFlags();
|
uint chatflags = Settings->getChatFlags();
|
||||||
|
|
||||||
ui.popup_Connect->setChecked(notifyflags & RS_POPUP_CONNECT);
|
ui.popup_Connect->setChecked(notifyflags & RS_POPUP_CONNECT);
|
||||||
ui.popup_NewMsg->setChecked(notifyflags & RS_POPUP_MSG);
|
ui.popup_NewMsg->setChecked(notifyflags & RS_POPUP_MSG);
|
||||||
ui.systray_GroupChat->setChecked(true) ;
|
ui.systray_GroupChat->setChecked(true) ;
|
||||||
//ui.popup_NewChat->setChecked(notifyflags & RS_POPUP_CHAT);
|
//ui.popup_NewChat->setChecked(notifyflags & RS_POPUP_CHAT);
|
||||||
//ui.popup_Call->setChecked(notifyflags & RS_POPUP_CALL);
|
//ui.popup_Call->setChecked(notifyflags & RS_POPUP_CALL);
|
||||||
|
|
||||||
ui.notify_Peers->setChecked(newsflags & RS_FEED_TYPE_PEER);
|
ui.notify_Peers->setChecked(newsflags & RS_FEED_TYPE_PEER);
|
||||||
ui.notify_Channels->setChecked(newsflags & RS_FEED_TYPE_CHAN);
|
ui.notify_Channels->setChecked(newsflags & RS_FEED_TYPE_CHAN);
|
||||||
ui.notify_Forums->setChecked(newsflags & RS_FEED_TYPE_FORUM);
|
ui.notify_Forums->setChecked(newsflags & RS_FEED_TYPE_FORUM);
|
||||||
ui.notify_Blogs->setChecked(newsflags & RS_FEED_TYPE_BLOG);
|
ui.notify_Blogs->setChecked(newsflags & RS_FEED_TYPE_BLOG);
|
||||||
ui.notify_Chat->setChecked(newsflags & RS_FEED_TYPE_CHAT);
|
ui.notify_Chat->setChecked(newsflags & RS_FEED_TYPE_CHAT);
|
||||||
ui.notify_Messages->setChecked(newsflags & RS_FEED_TYPE_MSG);
|
ui.notify_Messages->setChecked(newsflags & RS_FEED_TYPE_MSG);
|
||||||
|
|
||||||
ui.chat_NewWindow->setChecked(chatflags & RS_CHAT_OPEN_NEW);
|
ui.chat_NewWindow->setChecked(chatflags & RS_CHAT_OPEN_NEW);
|
||||||
ui.chat_Reopen->setChecked(chatflags & RS_CHAT_REOPEN);
|
ui.chat_Reopen->setChecked(chatflags & RS_CHAT_REOPEN);
|
||||||
ui.chat_Focus->setChecked(chatflags & RS_CHAT_FOCUS);
|
ui.chat_Focus->setChecked(chatflags & RS_CHAT_FOCUS);
|
||||||
|
|
||||||
ui.systray_GroupChat->setChecked(Settings->value(QString::fromUtf8("DisplayTrayGroupChat"), false).toBool());
|
ui.systray_GroupChat->setChecked(Settings->getDisplayTrayGroupChat());
|
||||||
|
|
||||||
/* disable ones that don't work yet */
|
/* disable ones that don't work yet */
|
||||||
ui.notify_Chat->setEnabled(false);
|
ui.notify_Chat->setEnabled(false);
|
||||||
//ui.popup_NewChat->setEnabled(false);
|
//ui.popup_NewChat->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Loads the settings for this page */
|
/** Loads the settings for this page */
|
||||||
void NotifyPage::updateStatus()
|
void NotifyPage::updateStatus()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NotifyPage::trayGroupChat() const {
|
|
||||||
if(ui.systray_GroupChat->isChecked()) return true;
|
|
||||||
return ui.systray_GroupChat->isChecked();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -42,8 +42,6 @@ class NotifyPage : public ConfigPage
|
|||||||
bool save(QString &errmsg);
|
bool save(QString &errmsg);
|
||||||
/** Loads the settings for this page */
|
/** Loads the settings for this page */
|
||||||
void load();
|
void load();
|
||||||
|
|
||||||
bool trayGroupChat() const;
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void updateStatus();
|
void updateStatus();
|
||||||
|
@ -132,6 +132,8 @@ void RshareSettings::initSettings()
|
|||||||
setDefault(SETTING_NEWSFEED_FLAGS, defNewsFeed);
|
setDefault(SETTING_NEWSFEED_FLAGS, defNewsFeed);
|
||||||
setDefault(SETTING_CHAT_FLAGS, defChat);
|
setDefault(SETTING_CHAT_FLAGS, defChat);
|
||||||
setDefault(SETTING_NOTIFY_FLAGS, defNotify);
|
setDefault(SETTING_NOTIFY_FLAGS, defNotify);
|
||||||
|
|
||||||
|
setDefault("DisplayTrayGroupChat", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets/sets the currently saved chat avatar. */
|
/** Gets/sets the currently saved chat avatar. */
|
||||||
@ -264,6 +266,16 @@ void RshareSettings::setNotifyFlags(uint flags)
|
|||||||
setValue(SETTING_NOTIFY_FLAGS, flags);
|
setValue(SETTING_NOTIFY_FLAGS, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RshareSettings::getDisplayTrayGroupChat()
|
||||||
|
{
|
||||||
|
return value("DisplayTrayGroupChat").toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RshareSettings::setDisplayTrayGroupChat(bool bValue)
|
||||||
|
{
|
||||||
|
setValue("DisplayTrayGroupChat", bValue);
|
||||||
|
}
|
||||||
|
|
||||||
/** Returns true if RetroShare is set to run on system boot. */
|
/** Returns true if RetroShare is set to run on system boot. */
|
||||||
bool
|
bool
|
||||||
RshareSettings::runRetroshareOnBoot()
|
RshareSettings::runRetroshareOnBoot()
|
||||||
|
@ -114,6 +114,9 @@ public:
|
|||||||
uint getNotifyFlags();
|
uint getNotifyFlags();
|
||||||
void setNotifyFlags(uint flags);
|
void setNotifyFlags(uint flags);
|
||||||
|
|
||||||
|
bool getDisplayTrayGroupChat();
|
||||||
|
void setDisplayTrayGroupChat(bool bValue);
|
||||||
|
|
||||||
//! Save placement, state and size information of a window.
|
//! Save placement, state and size information of a window.
|
||||||
void saveWidgetInformation(QWidget *widget);
|
void saveWidgetInformation(QWidget *widget);
|
||||||
|
|
||||||
|
@ -172,24 +172,17 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
QObject::connect(ConfCertDialog::instance(),SIGNAL(configChanged()),w->networkDialog,SLOT(insertConnect())) ;
|
QObject::connect(ConfCertDialog::instance(),SIGNAL(configChanged()),w->networkDialog,SLOT(insertConnect())) ;
|
||||||
QObject::connect(w->peersDialog,SIGNAL(friendsUpdated()),w->networkDialog,SLOT(insertConnect())) ;
|
QObject::connect(w->peersDialog,SIGNAL(friendsUpdated()),w->networkDialog,SLOT(insertConnect())) ;
|
||||||
|
|
||||||
{
|
w->installGroupChatNotifier();
|
||||||
if(Settings->value(QString::fromUtf8("DisplayTrayGroupChat"), true).toBool())
|
|
||||||
{
|
|
||||||
QObject::connect(w->peersDialog,SIGNAL(notifyGroupChat(const QString&,const QString&)),w,SLOT(displaySystrayMsg(const QString&,const QString&)),Qt::QueuedConnection) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QObject::connect(w->messengerWindow,SIGNAL(startChat(QTreeWidgetItem* )),w->peersDialog,SLOT(chatfriend(QTreeWidgetItem* ))) ;
|
QObject::connect(w->messengerWindow,SIGNAL(startChat(QTreeWidgetItem* )),w->peersDialog,SLOT(chatfriend(QTreeWidgetItem* ))) ;
|
||||||
QObject::connect(w->idle, SIGNAL(secondsIdle(int)), w->messengerWindow, SLOT(checkAndSetIdle(int)));
|
QObject::connect(w->idle, SIGNAL(secondsIdle(int)), w->messengerWindow, SLOT(checkAndSetIdle(int)));
|
||||||
|
|
||||||
|
/* only show window, if not startMinimized */
|
||||||
|
if(!Settings->value(QString::fromUtf8("StartMinimized"), false).toBool())
|
||||||
{
|
{
|
||||||
/* only show window, if not startMinimized */
|
|
||||||
if(!Settings->value(QString::fromUtf8("StartMinimized"), false).toBool())
|
|
||||||
{
|
|
||||||
|
|
||||||
w->show();
|
w->show();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Startup a Timer to keep the gui's updated */
|
/* Startup a Timer to keep the gui's updated */
|
||||||
|
Loading…
Reference in New Issue
Block a user