mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-01 20:52:05 -04:00
Added disable all toaster in status bar (Modified patch from Phenom)
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7362 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
995d63c979
commit
cc08fd5a95
11 changed files with 195 additions and 57 deletions
|
@ -84,6 +84,7 @@
|
||||||
#include "statusbar/discstatus.h"
|
#include "statusbar/discstatus.h"
|
||||||
#include "statusbar/OpModeStatus.h"
|
#include "statusbar/OpModeStatus.h"
|
||||||
#include "statusbar/SoundStatus.h"
|
#include "statusbar/SoundStatus.h"
|
||||||
|
#include "statusbar/ToasterDisable.h"
|
||||||
#include <retroshare/rsstatus.h>
|
#include <retroshare/rsstatus.h>
|
||||||
|
|
||||||
#include <retroshare/rsiface.h>
|
#include <retroshare/rsiface.h>
|
||||||
|
@ -276,6 +277,8 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
|
||||||
statusBar()->addPermanentWidget(new OpModeStatus());
|
statusBar()->addPermanentWidget(new OpModeStatus());
|
||||||
|
|
||||||
statusBar()->addPermanentWidget(new SoundStatus());
|
statusBar()->addPermanentWidget(new SoundStatus());
|
||||||
|
|
||||||
|
statusBar()->addPermanentWidget(new ToasterDisable());
|
||||||
/** Status Bar end ******/
|
/** Status Bar end ******/
|
||||||
|
|
||||||
/* Creates a tray icon with a context menu and adds it to the system's * notification area. */
|
/* Creates a tray icon with a context menu and adds it to the system's * notification area. */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/" >
|
<qresource prefix="/">
|
||||||
<file>images/add_chat24.png</file>
|
<file>images/add_chat24.png</file>
|
||||||
<file>images/mail-encrypted-full.png</file>
|
<file>images/mail-encrypted-full.png</file>
|
||||||
<file>images/decrypt-mail.png</file>
|
<file>images/decrypt-mail.png</file>
|
||||||
|
@ -678,8 +678,10 @@
|
||||||
<file>images/circles/circles_64.png</file>
|
<file>images/circles/circles_64.png</file>
|
||||||
<file>images/newsfeed/news-feed-32.png</file>
|
<file>images/newsfeed/news-feed-32.png</file>
|
||||||
<file>images/newsfeed/news-feed-notify-32.png</file>
|
<file>images/newsfeed/news-feed-notify-32.png</file>
|
||||||
<file>images/share-icon-16.png</file>
|
<file>images/share-icon-16.png</file>
|
||||||
<file>help/version.html</file>
|
<file>help/version.html</file>
|
||||||
<file>images/view-certificate-sign-48.png</file>
|
<file>images/view-certificate-sign-48.png</file>
|
||||||
|
<file>images/toasterEnable.png</file>
|
||||||
|
<file>images/toasterDisable.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
BIN
retroshare-gui/src/gui/images/toasterDisable.png
Normal file
BIN
retroshare-gui/src/gui/images/toasterDisable.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
BIN
retroshare-gui/src/gui/images/toasterEnable.png
Normal file
BIN
retroshare-gui/src/gui/images/toasterEnable.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
|
@ -96,6 +96,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
/*static*/ NotifyQt *NotifyQt::_instance = NULL;
|
/*static*/ NotifyQt *NotifyQt::_instance = NULL;
|
||||||
|
/*static*/ bool NotifyQt::_disableAllToaster = false;
|
||||||
|
|
||||||
/*static*/ NotifyQt *NotifyQt::Create ()
|
/*static*/ NotifyQt *NotifyQt::Create ()
|
||||||
{
|
{
|
||||||
|
@ -111,6 +112,20 @@ public:
|
||||||
return _instance;
|
return _instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*static*/ bool NotifyQt::isAllDisable ()
|
||||||
|
{
|
||||||
|
return _disableAllToaster;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NotifyQt::SetDisableAll(bool bValue)
|
||||||
|
{
|
||||||
|
if (bValue!=_disableAllToaster)
|
||||||
|
{
|
||||||
|
_disableAllToaster=bValue;
|
||||||
|
emit disableAllChanged(bValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NotifyQt::NotifyQt() : cDialog(NULL)
|
NotifyQt::NotifyQt() : cDialog(NULL)
|
||||||
{
|
{
|
||||||
runningToasterTimer = new QTimer(this);
|
runningToasterTimer = new QTimer(this);
|
||||||
|
@ -141,9 +156,9 @@ void NotifyQt::notifyOwnAvatarChanged()
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NOTIFY_DEBUG
|
#ifdef NOTIFY_DEBUG
|
||||||
std::cerr << "Notifyqt:: notified that own avatar changed" << std::endl ;
|
std::cerr << "Notifyqt:: notified that own avatar changed" << std::endl ;
|
||||||
#endif
|
#endif
|
||||||
emit ownAvatarChanged() ;
|
emit ownAvatarChanged() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -726,7 +741,7 @@ void NotifyQt::notifyListPreChange(int list, int /*type*/)
|
||||||
/* New Timer Based Update scheme ...
|
/* New Timer Based Update scheme ...
|
||||||
* means correct thread seperation
|
* means correct thread seperation
|
||||||
*
|
*
|
||||||
* uses Flags, to detect changes
|
* uses Flags, to detect changes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void NotifyQt::enable()
|
void NotifyQt::enable()
|
||||||
|
@ -778,7 +793,7 @@ void NotifyQt::UpdateGUI()
|
||||||
case RS_POPUP_ENCRYPTED_MSG:
|
case RS_POPUP_ENCRYPTED_MSG:
|
||||||
soundManager->play(SOUND_MESSAGE_ARRIVED);
|
soundManager->play(SOUND_MESSAGE_ARRIVED);
|
||||||
|
|
||||||
if (popupflags & RS_POPUP_MSG)
|
if ((popupflags & RS_POPUP_MSG) && !_disableAllToaster)
|
||||||
{
|
{
|
||||||
toaster = new Toaster(new MessageToaster("", tr("Encrypted message"), QString("[%1]").arg(tr("Encrypted message"))));
|
toaster = new Toaster(new MessageToaster("", tr("Encrypted message"), QString("[%1]").arg(tr("Encrypted message"))));
|
||||||
}
|
}
|
||||||
|
@ -786,7 +801,7 @@ void NotifyQt::UpdateGUI()
|
||||||
case RS_POPUP_MSG:
|
case RS_POPUP_MSG:
|
||||||
soundManager->play(SOUND_MESSAGE_ARRIVED);
|
soundManager->play(SOUND_MESSAGE_ARRIVED);
|
||||||
|
|
||||||
if (popupflags & RS_POPUP_MSG)
|
if ((popupflags & RS_POPUP_MSG) && !_disableAllToaster)
|
||||||
{
|
{
|
||||||
toaster = new Toaster(new MessageToaster(id, QString::fromUtf8(title.c_str()), QString::fromUtf8(msg.c_str())));
|
toaster = new Toaster(new MessageToaster(id, QString::fromUtf8(title.c_str()), QString::fromUtf8(msg.c_str())));
|
||||||
}
|
}
|
||||||
|
@ -794,7 +809,7 @@ void NotifyQt::UpdateGUI()
|
||||||
case RS_POPUP_CONNECT:
|
case RS_POPUP_CONNECT:
|
||||||
soundManager->play(SOUND_USER_ONLINE);
|
soundManager->play(SOUND_USER_ONLINE);
|
||||||
|
|
||||||
if (popupflags & RS_POPUP_CONNECT)
|
if ((popupflags & RS_POPUP_CONNECT) && !_disableAllToaster)
|
||||||
{
|
{
|
||||||
toaster = new Toaster(new OnlineToaster(RsPeerId(id)));
|
toaster = new Toaster(new OnlineToaster(RsPeerId(id)));
|
||||||
}
|
}
|
||||||
|
@ -802,16 +817,16 @@ void NotifyQt::UpdateGUI()
|
||||||
case RS_POPUP_DOWNLOAD:
|
case RS_POPUP_DOWNLOAD:
|
||||||
soundManager->play(SOUND_DOWNLOAD_COMPLETE);
|
soundManager->play(SOUND_DOWNLOAD_COMPLETE);
|
||||||
|
|
||||||
if (popupflags & RS_POPUP_DOWNLOAD)
|
if ((popupflags & RS_POPUP_DOWNLOAD) && !_disableAllToaster)
|
||||||
{
|
{
|
||||||
/* id = file hash */
|
/* id = file hash */
|
||||||
toaster = new Toaster(new DownloadToaster(RsFileHash(id), QString::fromUtf8(title.c_str())));
|
toaster = new Toaster(new DownloadToaster(RsFileHash(id), QString::fromUtf8(title.c_str())));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RS_POPUP_CHAT:
|
case RS_POPUP_CHAT:
|
||||||
if (popupflags & RS_POPUP_CHAT)
|
if ((popupflags & RS_POPUP_CHAT) && !_disableAllToaster)
|
||||||
{
|
{
|
||||||
ChatDialog *chatDialog = ChatDialog::getChat(RsPeerId(id), 0);
|
ChatDialog *chatDialog = ChatDialog::getChat(RsPeerId(id), 0);
|
||||||
ChatWidget *chatWidget;
|
ChatWidget *chatWidget;
|
||||||
if (chatDialog && (chatWidget = chatDialog->getChatWidget()) && chatWidget->isActive()) {
|
if (chatDialog && (chatWidget = chatDialog->getChatWidget()) && chatWidget->isActive()) {
|
||||||
// do not show when active
|
// do not show when active
|
||||||
|
@ -821,7 +836,7 @@ void NotifyQt::UpdateGUI()
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RS_POPUP_GROUPCHAT:
|
case RS_POPUP_GROUPCHAT:
|
||||||
if (popupflags & RS_POPUP_GROUPCHAT)
|
if ((popupflags & RS_POPUP_GROUPCHAT) && !_disableAllToaster)
|
||||||
{
|
{
|
||||||
MainWindow *mainWindow = MainWindow::getInstance();
|
MainWindow *mainWindow = MainWindow::getInstance();
|
||||||
if (mainWindow && mainWindow->isActiveWindow() && !mainWindow->isMinimized()) {
|
if (mainWindow && mainWindow->isActiveWindow() && !mainWindow->isMinimized()) {
|
||||||
|
@ -836,9 +851,9 @@ void NotifyQt::UpdateGUI()
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RS_POPUP_CHATLOBBY:
|
case RS_POPUP_CHATLOBBY:
|
||||||
if (popupflags & RS_POPUP_CHATLOBBY)
|
if ((popupflags & RS_POPUP_CHATLOBBY) && !_disableAllToaster)
|
||||||
{
|
{
|
||||||
ChatDialog *chatDialog = ChatDialog::getChat(RsPeerId(id), 0);
|
ChatDialog *chatDialog = ChatDialog::getChat(RsPeerId(id), 0);
|
||||||
ChatWidget *chatWidget;
|
ChatWidget *chatWidget;
|
||||||
if (chatDialog && (chatWidget = chatDialog->getChatWidget()) && chatWidget->isActive()) {
|
if (chatDialog && (chatWidget = chatDialog->getChatWidget()) && chatWidget->isActive()) {
|
||||||
// do not show when active
|
// do not show when active
|
||||||
|
@ -853,7 +868,7 @@ void NotifyQt::UpdateGUI()
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RS_POPUP_CONNECT_ATTEMPT:
|
case RS_POPUP_CONNECT_ATTEMPT:
|
||||||
if (popupflags & RS_POPUP_CONNECT_ATTEMPT)
|
if ((popupflags & RS_POPUP_CONNECT_ATTEMPT) && !_disableAllToaster)
|
||||||
{
|
{
|
||||||
// id = gpgid
|
// id = gpgid
|
||||||
// title = ssl name
|
// title = ssl name
|
||||||
|
@ -868,7 +883,7 @@ void NotifyQt::UpdateGUI()
|
||||||
toaster->widget->setWindowFlags(Qt::ToolTip | Qt::WindowStaysOnTopHint);
|
toaster->widget->setWindowFlags(Qt::ToolTip | Qt::WindowStaysOnTopHint);
|
||||||
|
|
||||||
/* add toaster to waiting list */
|
/* add toaster to waiting list */
|
||||||
// QMutexLocker lock(&waitingToasterMutex);
|
//QMutexLocker lock(&waitingToasterMutex);
|
||||||
waitingToasterList.push_back(toaster);
|
waitingToasterList.push_back(toaster);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -967,7 +982,7 @@ void NotifyQt::testToaster(uint notifyFlags, /*RshareSettings::enumToasterPositi
|
||||||
toaster->margin = margin;
|
toaster->margin = margin;
|
||||||
|
|
||||||
/* add toaster to waiting list */
|
/* add toaster to waiting list */
|
||||||
// QMutexLocker lock(&waitingToasterMutex);
|
//QMutexLocker lock(&waitingToasterMutex);
|
||||||
waitingToasterList.push_back(toaster);
|
waitingToasterList.push_back(toaster);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -992,7 +1007,7 @@ void NotifyQt::notifySettingsChanged()
|
||||||
void NotifyQt::startWaitingToasters()
|
void NotifyQt::startWaitingToasters()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
// QMutexLocker lock(&waitingToasterMutex);
|
//QMutexLocker lock(&waitingToasterMutex);
|
||||||
|
|
||||||
if (waitingToasterList.empty()) {
|
if (waitingToasterList.empty()) {
|
||||||
/* No toasters are waiting */
|
/* No toasters are waiting */
|
||||||
|
@ -1001,7 +1016,7 @@ void NotifyQt::startWaitingToasters()
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// QMutexLocker lock(&runningToasterMutex);
|
//QMutexLocker lock(&runningToasterMutex);
|
||||||
|
|
||||||
if (runningToasterList.size() >= 3) {
|
if (runningToasterList.size() >= 3) {
|
||||||
/* Don't show more than 3 toasters at once */
|
/* Don't show more than 3 toasters at once */
|
||||||
|
@ -1012,7 +1027,7 @@ void NotifyQt::startWaitingToasters()
|
||||||
Toaster *toaster = NULL;
|
Toaster *toaster = NULL;
|
||||||
|
|
||||||
{
|
{
|
||||||
// QMutexLocker lock(&waitingToasterMutex);
|
//QMutexLocker lock(&waitingToasterMutex);
|
||||||
|
|
||||||
if (waitingToasterList.size()) {
|
if (waitingToasterList.size()) {
|
||||||
/* Take one toaster of the waiting list */
|
/* Take one toaster of the waiting list */
|
||||||
|
@ -1022,7 +1037,7 @@ void NotifyQt::startWaitingToasters()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toaster) {
|
if (toaster) {
|
||||||
// QMutexLocker lock(&runningToasterMutex);
|
//QMutexLocker lock(&runningToasterMutex);
|
||||||
|
|
||||||
/* Calculate positions */
|
/* Calculate positions */
|
||||||
QSize size = toaster->widget->size();
|
QSize size = toaster->widget->size();
|
||||||
|
@ -1069,7 +1084,7 @@ void NotifyQt::startWaitingToasters()
|
||||||
|
|
||||||
void NotifyQt::runningTick()
|
void NotifyQt::runningTick()
|
||||||
{
|
{
|
||||||
// QMutexLocker lock(&runningToasterMutex);
|
//QMutexLocker lock(&runningToasterMutex);
|
||||||
|
|
||||||
int interval = runningToasterTimer->interval();
|
int interval = runningToasterTimer->interval();
|
||||||
QPoint diff;
|
QPoint diff;
|
||||||
|
|
|
@ -31,6 +31,7 @@ class NotifyQt: public QObject, public NotifyClient
|
||||||
public:
|
public:
|
||||||
static NotifyQt *Create ();
|
static NotifyQt *Create ();
|
||||||
static NotifyQt *getInstance ();
|
static NotifyQt *getInstance ();
|
||||||
|
static bool isAllDisable();
|
||||||
void enable() ;
|
void enable() ;
|
||||||
|
|
||||||
virtual ~NotifyQt() { return; }
|
virtual ~NotifyQt() { return; }
|
||||||
|
@ -130,9 +131,11 @@ class NotifyQt: public QObject, public NotifyClient
|
||||||
/* Notify from GUI */
|
/* Notify from GUI */
|
||||||
void chatStyleChanged(int /*ChatStyle::enumStyleType*/ styleType);
|
void chatStyleChanged(int /*ChatStyle::enumStyleType*/ styleType);
|
||||||
void settingsChanged();
|
void settingsChanged();
|
||||||
|
void disableAllChanged(bool disableAll) const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void UpdateGUI(); /* called by timer */
|
void UpdateGUI(); /* called by timer */
|
||||||
|
void SetDisableAll(bool bValue);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void runningTick();
|
void runningTick();
|
||||||
|
@ -143,6 +146,7 @@ class NotifyQt: public QObject, public NotifyClient
|
||||||
NotifyQt();
|
NotifyQt();
|
||||||
|
|
||||||
static NotifyQt *_instance;
|
static NotifyQt *_instance;
|
||||||
|
static bool _disableAllToaster;
|
||||||
|
|
||||||
/* system notifications */
|
/* system notifications */
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,8 @@ NotifyPage::NotifyPage(QWidget * parent, Qt::WindowFlags flags)
|
||||||
|
|
||||||
connect(ui.notifyButton, SIGNAL(clicked()), this, SLOT(testNotify()));
|
connect(ui.notifyButton, SIGNAL(clicked()), this, SLOT(testNotify()));
|
||||||
connect(ui.toasterButton, SIGNAL(clicked()), this, SLOT(testToaster()));
|
connect(ui.toasterButton, 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)));
|
||||||
|
|
||||||
QFont font = ui.notify_Peers->font(); // use font from existing checkbox
|
QFont font = ui.notify_Peers->font(); // use font from existing checkbox
|
||||||
|
|
||||||
|
@ -239,6 +241,8 @@ void NotifyPage::load()
|
||||||
|
|
||||||
ui.addFeedsAtEnd->setChecked(Settings->getAddFeedsAtEnd());
|
ui.addFeedsAtEnd->setChecked(Settings->getAddFeedsAtEnd());
|
||||||
|
|
||||||
|
ui.pushButtonDisableAll->setChecked(NotifyQt::isAllDisable());
|
||||||
|
|
||||||
RshareSettings::enumToasterPosition toasterPosition = Settings->getToasterPosition();
|
RshareSettings::enumToasterPosition toasterPosition = Settings->getToasterPosition();
|
||||||
ui.comboBoxToasterPosition->clear();
|
ui.comboBoxToasterPosition->clear();
|
||||||
|
|
||||||
|
|
|
@ -19,22 +19,13 @@
|
||||||
<string>News Feed</string>
|
<string>News Feed</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="margin">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<item>
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="notify_Peers">
|
<widget class="QCheckBox" name="notify_Peers">
|
||||||
|
@ -174,12 +165,25 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<widget class="QPushButton" name="pushButtonDisableAll">
|
||||||
<property name="title">
|
<property name="toolTip">
|
||||||
<string>Toasters</string>
|
<string>Disable All Toaster temporaly</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Disable All Toasters</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Toasters</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout">
|
<layout class="QVBoxLayout">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
|
|
61
retroshare-gui/src/gui/statusbar/ToasterDisable.cpp
Normal file
61
retroshare-gui/src/gui/statusbar/ToasterDisable.cpp
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
/****************************************************************
|
||||||
|
* RetroShare is distributed under the following license:
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 RetroShare Team
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
* Boston, MA 02110-1301, USA.
|
||||||
|
****************************************************************/
|
||||||
|
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QPushButton>
|
||||||
|
|
||||||
|
#include "ToasterDisable.h"
|
||||||
|
#include "gui/notifyqt.h"
|
||||||
|
|
||||||
|
#define IMAGE_TOASTERDISABLE ":/images/toasterDisable.png"
|
||||||
|
#define IMAGE_TOASTERENABLE ":/images/toasterEnable.png"
|
||||||
|
|
||||||
|
ToasterDisable::ToasterDisable(QWidget *parent)
|
||||||
|
: QWidget(parent)
|
||||||
|
{
|
||||||
|
QHBoxLayout *hbox = new QHBoxLayout(this);
|
||||||
|
hbox->setMargin(0);
|
||||||
|
hbox->setSpacing(0);
|
||||||
|
|
||||||
|
imageButton = new QPushButton(this);
|
||||||
|
imageButton->setFlat(true);
|
||||||
|
imageButton->setCheckable(true);
|
||||||
|
imageButton->setMaximumSize(24, 24);
|
||||||
|
imageButton->setFocusPolicy(Qt::ClickFocus);
|
||||||
|
hbox->addWidget(imageButton);
|
||||||
|
|
||||||
|
setLayout(hbox);
|
||||||
|
|
||||||
|
bool isDisable = NotifyQt::isAllDisable();
|
||||||
|
imageButton->setChecked(isDisable);
|
||||||
|
|
||||||
|
connect(NotifyQt::getInstance(), SIGNAL(disableAllChanged(bool)), this, SLOT(disable(bool)));
|
||||||
|
connect(imageButton, SIGNAL(toggled(bool)), NotifyQt::getInstance(), SLOT(SetDisableAll(bool)));
|
||||||
|
|
||||||
|
disable(isDisable);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ToasterDisable::disable(bool isDisable)
|
||||||
|
{
|
||||||
|
imageButton->setIcon(QIcon(isDisable ? IMAGE_TOASTERDISABLE : IMAGE_TOASTERENABLE));
|
||||||
|
imageButton->setToolTip(isDisable ? tr("All Toasters are disable") : tr("Toasters are enable"));
|
||||||
|
imageButton->setChecked(isDisable);
|
||||||
|
}
|
43
retroshare-gui/src/gui/statusbar/ToasterDisable.h
Normal file
43
retroshare-gui/src/gui/statusbar/ToasterDisable.h
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
/****************************************************************
|
||||||
|
* RetroShare is distributed under the following license:
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 RetroShare Team
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
* Boston, MA 02110-1301, USA.
|
||||||
|
****************************************************************/
|
||||||
|
|
||||||
|
#ifndef TOASTERDISABLE_H
|
||||||
|
#define TOASTERDISABLE_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
class QPushButton;
|
||||||
|
|
||||||
|
class ToasterDisable : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
ToasterDisable(QWidget *parent = 0);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void disable(bool isDisable);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QPushButton *imageButton;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -470,12 +470,13 @@ HEADERS += rshare.h \
|
||||||
gui/statusbar/dhtstatus.h \
|
gui/statusbar/dhtstatus.h \
|
||||||
gui/statusbar/ratesstatus.h \
|
gui/statusbar/ratesstatus.h \
|
||||||
gui/statusbar/hashingstatus.h \
|
gui/statusbar/hashingstatus.h \
|
||||||
gui/statusbar/discstatus.h \
|
gui/statusbar/discstatus.h \
|
||||||
gui/statusbar/SoundStatus.h \
|
gui/statusbar/SoundStatus.h \
|
||||||
gui/statusbar/OpModeStatus.h \
|
gui/statusbar/OpModeStatus.h \
|
||||||
gui/advsearch/advancedsearchdialog.h \
|
gui/statusbar/ToasterDisable.h \
|
||||||
gui/advsearch/expressionwidget.h \
|
gui/advsearch/advancedsearchdialog.h \
|
||||||
gui/advsearch/guiexprelement.h \
|
gui/advsearch/expressionwidget.h \
|
||||||
|
gui/advsearch/guiexprelement.h \
|
||||||
gui/elastic/graphwidget.h \
|
gui/elastic/graphwidget.h \
|
||||||
gui/elastic/edge.h \
|
gui/elastic/edge.h \
|
||||||
gui/elastic/arrow.h \
|
gui/elastic/arrow.h \
|
||||||
|
@ -780,12 +781,13 @@ SOURCES += main.cpp \
|
||||||
gui/statusbar/dhtstatus.cpp \
|
gui/statusbar/dhtstatus.cpp \
|
||||||
gui/statusbar/ratesstatus.cpp \
|
gui/statusbar/ratesstatus.cpp \
|
||||||
gui/statusbar/hashingstatus.cpp \
|
gui/statusbar/hashingstatus.cpp \
|
||||||
gui/statusbar/discstatus.cpp \
|
gui/statusbar/discstatus.cpp \
|
||||||
gui/statusbar/SoundStatus.cpp \
|
gui/statusbar/SoundStatus.cpp \
|
||||||
gui/statusbar/OpModeStatus.cpp \
|
gui/statusbar/OpModeStatus.cpp \
|
||||||
gui/toaster/MessageToaster.cpp \
|
gui/statusbar/ToasterDisable.cpp \
|
||||||
gui/toaster/DownloadToaster.cpp \
|
gui/toaster/MessageToaster.cpp \
|
||||||
gui/toaster/OnlineToaster.cpp \
|
gui/toaster/DownloadToaster.cpp \
|
||||||
|
gui/toaster/OnlineToaster.cpp \
|
||||||
gui/toaster/ChatToaster.cpp \
|
gui/toaster/ChatToaster.cpp \
|
||||||
gui/toaster/GroupChatToaster.cpp \
|
gui/toaster/GroupChatToaster.cpp \
|
||||||
gui/toaster/ChatLobbyToaster.cpp \
|
gui/toaster/ChatLobbyToaster.cpp \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue