Added settings for the blinking icons

- private chat window/tab
- chat lobby tab
- all tray notifier

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5729 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2012-10-27 15:59:12 +00:00
parent 03e521c024
commit af2257b1a9
28 changed files with 217 additions and 29 deletions

View File

@ -53,10 +53,11 @@ const uint32_t RS_POPUP_CONNECT_ATTEMPT = 0x0100;
/* CHAT flags are here - so they are in the same place as
* other Notify flags... not used by libretroshare though
*/
const uint32_t RS_CHAT_OPEN = 0x0001;
//const uint32_t free = 0x0002;
const uint32_t RS_CHAT_FOCUS = 0x0004;
const uint32_t RS_CHAT_TABBED_WINDOW = 0x0008;
const uint32_t RS_CHAT_OPEN = 0x0001;
//const uint32_t free = 0x0002;
const uint32_t RS_CHAT_FOCUS = 0x0004;
const uint32_t RS_CHAT_TABBED_WINDOW = 0x0008;
const uint32_t RS_CHAT_BLINK = 0x0010;
const uint32_t RS_FEED_TYPE_PEER = 0x0010;
const uint32_t RS_FEED_TYPE_CHAN = 0x0020;

View File

@ -49,9 +49,15 @@ bool ChannelUserNotify::notifyCombined()
return (Settings->getTrayNotifyFlags() & TRAYNOTIFY_CHANNELS_COMBINED);
}
void ChannelUserNotify::setNotifyEnabled(bool enabled, bool combined)
bool ChannelUserNotify::notifyBlink()
{
return (Settings->getTrayNotifyBlinkFlags() & TRAYNOTIFY_BLINK_CHANNELS);
}
void ChannelUserNotify::setNotifyEnabled(bool enabled, bool combined, bool blink)
{
uint notifyFlags = Settings->getTrayNotifyFlags();
uint blinkFlags = Settings->getTrayNotifyBlinkFlags();
if (enabled) {
notifyFlags |= TRAYNOTIFY_CHANNELS;
@ -65,7 +71,14 @@ void ChannelUserNotify::setNotifyEnabled(bool enabled, bool combined)
notifyFlags &= ~TRAYNOTIFY_CHANNELS_COMBINED;
}
if (blink) {
blinkFlags |= TRAYNOTIFY_BLINK_CHANNELS;
} else {
blinkFlags &= ~TRAYNOTIFY_BLINK_CHANNELS;
}
Settings->setTrayNotifyFlags(notifyFlags);
Settings->setTrayNotifyBlinkFlags(blinkFlags);
}
QIcon ChannelUserNotify::getIcon()

View File

@ -34,7 +34,8 @@ public:
virtual bool hasSetting(QString &name);
virtual bool notifyEnabled();
virtual bool notifyCombined();
virtual void setNotifyEnabled(bool enabled, bool combined);
virtual bool notifyBlink();
virtual void setNotifyEnabled(bool enabled, bool combined, bool blink);
private:
virtual QIcon getIcon();

View File

@ -45,6 +45,7 @@ public:
virtual ChatWidget *getChatWidget() = 0;
virtual bool hasPeerStatus() = 0;
virtual bool notifyBlink() = 0;
void addToParent(QWidget *newParent);
void removeFromParent(QWidget *oldParent);

View File

@ -117,6 +117,11 @@ ChatWidget *ChatLobbyDialog::getChatWidget()
return ui.chatWidget;
}
bool ChatLobbyDialog::notifyBlink()
{
return (Settings->getChatLobbyFlags() & RS_CHATLOBBY_BLINK);
}
void ChatLobbyDialog::processSettings(bool load)
{
Settings->beginGroup(QString("ChatLobbyDialog"));

View File

@ -38,6 +38,7 @@ public:
virtual void showDialog(uint chatflags);
virtual ChatWidget *getChatWidget();
virtual bool hasPeerStatus() { return false; }
virtual bool notifyBlink();
void setNickname(const QString &nickname);
private slots:

View File

@ -104,7 +104,11 @@ void ChatTabWidget::tabInfoChanged(ChatDialog *dialog)
setTabIcon(tab, QIcon(IMAGE_TYPING));
} else if (dialog->hasNewMessages()) {
setTabIcon(tab, QIcon(IMAGE_CHAT));
setBlinking(tab, true);
if (dialog->notifyBlink()) {
setBlinking(tab, true);
} else {
setBlinking(tab, false);
}
} else if (dialog->hasPeerStatus()) {
setBlinking(tab, false);
setTabIcon(tab, QIcon(StatusDefs::imageIM(dialog->getPeerStatus())));

View File

@ -51,9 +51,15 @@ bool ChatUserNotify::notifyCombined()
return (Settings->getTrayNotifyFlags() & TRAYNOTIFY_PRIVATECHAT_COMBINED);
}
void ChatUserNotify::setNotifyEnabled(bool enabled, bool combined)
bool ChatUserNotify::notifyBlink()
{
return (Settings->getTrayNotifyBlinkFlags() & TRAYNOTIFY_BLINK_PRIVATECHAT);
}
void ChatUserNotify::setNotifyEnabled(bool enabled, bool combined, bool blink)
{
uint notifyFlags = Settings->getTrayNotifyFlags();
uint blinkFlags = Settings->getTrayNotifyBlinkFlags();
if (enabled) {
notifyFlags |= TRAYNOTIFY_PRIVATECHAT;
@ -67,7 +73,14 @@ void ChatUserNotify::setNotifyEnabled(bool enabled, bool combined)
notifyFlags &= ~TRAYNOTIFY_PRIVATECHAT_COMBINED;
}
if (blink) {
blinkFlags |= TRAYNOTIFY_BLINK_PRIVATECHAT;
} else {
blinkFlags &= ~TRAYNOTIFY_BLINK_PRIVATECHAT;
}
Settings->setTrayNotifyFlags(notifyFlags);
Settings->setTrayNotifyBlinkFlags(blinkFlags);
}
QIcon ChatUserNotify::getIcon()

View File

@ -34,7 +34,8 @@ public:
virtual bool hasSetting(QString &name);
virtual bool notifyEnabled();
virtual bool notifyCombined();
virtual void setNotifyEnabled(bool enabled, bool combined);
virtual bool notifyBlink();
virtual void setNotifyEnabled(bool enabled, bool combined, bool blink);
private slots:
void privateChatChanged(int list, int type);
@ -43,7 +44,6 @@ private:
virtual QIcon getIcon();
virtual QIcon getMainIcon(bool hasNew);
virtual unsigned int getNewCount();
virtual bool isBlinking() { return true; }
virtual void iconClicked();
};

View File

@ -29,6 +29,7 @@
#include <retroshare/rspeers.h>
#include <retroshare/rsiface.h>
#include <retroshare/rsnotify.h>
#include <algorithm>
@ -92,6 +93,11 @@ ChatWidget *PopupChatDialog::getChatWidget()
return ui.chatWidget;
}
bool PopupChatDialog::notifyBlink()
{
return (Settings->getChatFlags() & RS_CHAT_BLINK);
}
void PopupChatDialog::processSettings(bool load)
{
Settings->beginGroup(QString("PopupChatDialog"));

View File

@ -50,6 +50,7 @@ protected:
virtual void showDialog(uint chatflags);
virtual ChatWidget *getChatWidget();
virtual bool hasPeerStatus() { return true; }
virtual bool notifyBlink();
virtual void updateStatus(int /*status*/) {}

View File

@ -275,7 +275,11 @@ void PopupChatWindow::calculateTitle(ChatDialog *dialog)
icon = QIcon(IMAGE_TYPING);
} else if (hasNewMessages) {
icon = QIcon(IMAGE_CHAT);
mBlinkIcon = icon;
if (Settings->getChatFlags() & RS_CHAT_BLINK) {
mBlinkIcon = icon;
} else {
mBlinkIcon = QIcon();
}
} else {
mBlinkIcon = QIcon();
if (cd && cd->hasPeerStatus()) {

View File

@ -147,9 +147,9 @@ void UserNotify::trayIconClicked(QSystemTrayIcon::ActivationReason e)
void UserNotify::blink(bool on)
{
bool blinking = isBlinking();
if (mTrayIcon) {
bool blinking = notifyBlink();
if (blinking) {
/* blink icon */
mTrayIcon->setIcon(on ? getIcon() : QIcon());
@ -159,7 +159,7 @@ void UserNotify::blink(bool on)
mTrayIcon->setIcon(getIcon());
}
}
}
mLastBlinking = blinking;
mLastBlinking = blinking;
}
}

View File

@ -42,7 +42,8 @@ public:
virtual bool hasSetting(QString &/*name*/) { return false; }
virtual bool notifyEnabled() { return false; }
virtual bool notifyCombined() { return false; }
virtual void setNotifyEnabled(bool /*enabled*/, bool /*combined*/) {}
virtual bool notifyBlink() { return false; }
virtual void setNotifyEnabled(bool /*enabled*/, bool /*combined*/, bool /*blink*/) {}
signals:
void countChanged();
@ -58,7 +59,6 @@ private:
virtual QIcon getIcon() { return QIcon(); }
virtual QIcon getMainIcon(bool /*hasNew*/) { return QIcon(); }
virtual unsigned int getNewCount() { return 0; }
virtual bool isBlinking() { return false; }
virtual QString getTrayMessage(bool plural);
virtual QString getNotifyMessage(bool plural);

View File

@ -49,9 +49,15 @@ bool ForumUserNotify::notifyCombined()
return (Settings->getTrayNotifyFlags() & TRAYNOTIFY_FORUMS_COMBINED);
}
void ForumUserNotify::setNotifyEnabled(bool enabled, bool combined)
bool ForumUserNotify::notifyBlink()
{
return (Settings->getTrayNotifyBlinkFlags() & TRAYNOTIFY_BLINK_FORUMS);
}
void ForumUserNotify::setNotifyEnabled(bool enabled, bool combined, bool blink)
{
uint notifyFlags = Settings->getTrayNotifyFlags();
uint blinkFlags = Settings->getTrayNotifyBlinkFlags();
if (enabled) {
notifyFlags |= TRAYNOTIFY_FORUMS;
@ -65,7 +71,14 @@ void ForumUserNotify::setNotifyEnabled(bool enabled, bool combined)
notifyFlags &= ~TRAYNOTIFY_FORUMS_COMBINED;
}
if (blink) {
blinkFlags |= TRAYNOTIFY_BLINK_FORUMS;
} else {
blinkFlags &= ~TRAYNOTIFY_BLINK_FORUMS;
}
Settings->setTrayNotifyFlags(notifyFlags);
Settings->setTrayNotifyBlinkFlags(blinkFlags);
}
QIcon ForumUserNotify::getIcon()

View File

@ -34,7 +34,8 @@ public:
virtual bool hasSetting(QString &name);
virtual bool notifyEnabled();
virtual bool notifyCombined();
virtual void setNotifyEnabled(bool enabled, bool combined);
virtual bool notifyBlink();
virtual void setNotifyEnabled(bool enabled, bool combined, bool blink);
private:
virtual QIcon getIcon();

View File

@ -49,9 +49,15 @@ bool MessageUserNotify::notifyCombined()
return (Settings->getTrayNotifyFlags() & TRAYNOTIFY_MESSAGES_COMBINED);
}
void MessageUserNotify::setNotifyEnabled(bool enabled, bool combined)
bool MessageUserNotify::notifyBlink()
{
return (Settings->getTrayNotifyBlinkFlags() & TRAYNOTIFY_BLINK_MESSAGES);
}
void MessageUserNotify::setNotifyEnabled(bool enabled, bool combined, bool blink)
{
uint notifyFlags = Settings->getTrayNotifyFlags();
uint blinkFlags = Settings->getTrayNotifyBlinkFlags();
if (enabled) {
notifyFlags |= TRAYNOTIFY_MESSAGES;
@ -65,7 +71,14 @@ void MessageUserNotify::setNotifyEnabled(bool enabled, bool combined)
notifyFlags &= ~TRAYNOTIFY_MESSAGES_COMBINED;
}
if (blink) {
blinkFlags |= TRAYNOTIFY_BLINK_MESSAGES;
} else {
blinkFlags &= ~TRAYNOTIFY_BLINK_MESSAGES;
}
Settings->setTrayNotifyFlags(notifyFlags);
Settings->setTrayNotifyBlinkFlags(blinkFlags);
}
QIcon MessageUserNotify::getIcon()

View File

@ -34,7 +34,8 @@ public:
virtual bool hasSetting(QString &name);
virtual bool notifyEnabled();
virtual bool notifyCombined();
virtual void setNotifyEnabled(bool enabled, bool combined);
virtual bool notifyBlink();
virtual void setNotifyEnabled(bool enabled, bool combined, bool blink);
private:
virtual QIcon getIcon();

View File

@ -165,9 +165,18 @@ ChatPage::save(QString &/*errmsg*/)
chatflags |= RS_CHAT_FOCUS;
if (ui.chat_tabbedWindow->isChecked())
chatflags |= RS_CHAT_TABBED_WINDOW;
if (ui.chat_Blink->isChecked())
chatflags |= RS_CHAT_BLINK;
Settings->setChatFlags(chatflags);
uint chatLobbyFlags = 0;
if (ui.chatLobby_Blink->isChecked())
chatLobbyFlags |= RS_CHATLOBBY_BLINK;
Settings->setChatLobbyFlags(chatLobbyFlags);
return true;
}
@ -215,6 +224,11 @@ ChatPage::load()
ui.chat_NewWindow->setChecked(chatflags & RS_CHAT_OPEN);
ui.chat_Focus->setChecked(chatflags & RS_CHAT_FOCUS);
ui.chat_tabbedWindow->setChecked(chatflags & RS_CHAT_TABBED_WINDOW);
ui.chat_Blink->setChecked(chatflags & RS_CHAT_BLINK);
uint chatLobbyFlags = Settings->getChatLobbyFlags();
ui.chatLobby_Blink->setChecked(chatLobbyFlags & RS_CHATLOBBY_BLINK);
}
void ChatPage::on_pushButtonChangeChatFont_clicked()

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>444</width>
<height>378</height>
<height>390</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
@ -148,6 +148,13 @@
<string>Chat Lobby</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QCheckBox" name="chatLobby_Blink">
<property name="text">
<string>Blink tab icon</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
@ -232,6 +239,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chat_Blink">
<property name="text">
<string>Blink window/tab icon</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@ -61,9 +61,13 @@ NotifyPage::NotifyPage(QWidget * parent, Qt::WFlags flags)
QCheckBox *combinedCheckBox = new QCheckBox(tr("Combined"), this);
combinedCheckBox->setFont(font);
ui.notifyLayout->addWidget(combinedCheckBox, row++, 1);
ui.notifyLayout->addWidget(combinedCheckBox, row, 1);
mUserNotifySettingList.push_back(UserNotifySetting(userNotify, enabledCheckBox, combinedCheckBox));
QCheckBox *blinkCheckBox = new QCheckBox(tr("Blink"), this);
blinkCheckBox->setFont(font);
ui.notifyLayout->addWidget(blinkCheckBox, row++, 2);
mUserNotifySettingList.push_back(UserNotifySetting(userNotify, enabledCheckBox, combinedCheckBox, blinkCheckBox));
}
/* Hide platform specific features */
@ -134,7 +138,7 @@ NotifyPage::save(QString &/*errmsg*/)
/* save user notify */
QList<UserNotifySetting>::iterator notifyIt;
for (notifyIt = mUserNotifySettingList.begin(); notifyIt != mUserNotifySettingList.end(); ++notifyIt) {
notifyIt->mUserNotify->setNotifyEnabled(notifyIt->mEnabledCheckBox->isChecked(), notifyIt->mCombinedCheckBox->isChecked());
notifyIt->mUserNotify->setNotifyEnabled(notifyIt->mEnabledCheckBox->isChecked(), notifyIt->mCombinedCheckBox->isChecked(), notifyIt->mBlinkCheckBox->isChecked());
}
Settings->setNotifyFlags(getNotifyFlags());
@ -219,6 +223,7 @@ void NotifyPage::load()
for (notifyIt = mUserNotifySettingList.begin(); notifyIt != mUserNotifySettingList.end(); ++notifyIt) {
notifyIt->mEnabledCheckBox->setChecked(notifyIt->mUserNotify->notifyEnabled());
notifyIt->mCombinedCheckBox->setChecked(notifyIt->mUserNotify->notifyCombined());
notifyIt->mBlinkCheckBox->setChecked(notifyIt->mUserNotify->notifyBlink());
}
notifyToggled();
@ -230,9 +235,13 @@ void NotifyPage::notifyToggled()
for (notifyIt = mUserNotifySettingList.begin(); notifyIt != mUserNotifySettingList.end(); ++notifyIt) {
if (notifyIt->mEnabledCheckBox->isChecked()) {
notifyIt->mCombinedCheckBox->setEnabled(true);
notifyIt->mBlinkCheckBox->setEnabled(true);
} else {
notifyIt->mCombinedCheckBox->setChecked(false);
notifyIt->mCombinedCheckBox->setEnabled(false);
notifyIt->mBlinkCheckBox->setChecked(false);
notifyIt->mBlinkCheckBox->setEnabled(false);
}
}
}

View File

@ -33,10 +33,11 @@ public:
UserNotify *mUserNotify;
QCheckBox *mEnabledCheckBox;
QCheckBox *mCombinedCheckBox;
QCheckBox *mBlinkCheckBox;
public:
UserNotifySetting(UserNotify *userNotify, QCheckBox *enabledCheckBox, QCheckBox *combinedCheckBox)
: mUserNotify(userNotify), mEnabledCheckBox(enabledCheckBox), mCombinedCheckBox(combinedCheckBox) {}
UserNotifySetting(UserNotify *userNotify, QCheckBox *enabledCheckBox, QCheckBox *combinedCheckBox, QCheckBox *blinkCheckBox)
: mUserNotify(userNotify), mEnabledCheckBox(enabledCheckBox), mCombinedCheckBox(combinedCheckBox), mBlinkCheckBox(blinkCheckBox) {}
};
class NotifyPage : public ConfigPage

View File

@ -295,6 +295,16 @@ void RshareSettings::setChatFlags(uint flags)
setValue(SETTING_CHAT_FLAGS, flags);
}
uint RshareSettings::getChatLobbyFlags()
{
return value("ChatLobbyFlags").toUInt();
}
void RshareSettings::setChatLobbyFlags(uint flags)
{
setValue("ChatLobbyFlags", flags);
}
uint RshareSettings::getNotifyFlags()
{
return value(SETTING_NOTIFY_FLAGS).toUInt();
@ -315,6 +325,16 @@ void RshareSettings::setTrayNotifyFlags(uint flags)
setValue(SETTING_TRAYNOTIFY_FLAGS, flags);
}
uint RshareSettings::getTrayNotifyBlinkFlags()
{
return value("TrayNotifyBlinkFlags", 0).toUInt();
}
void RshareSettings::setTrayNotifyBlinkFlags(uint flags)
{
setValue("TrayNotifyBlinkFlags", flags);
}
uint RshareSettings::getMessageFlags()
{
return value("MessageFlags").toUInt();

View File

@ -43,6 +43,14 @@
#define TRAYNOTIFY_FORUMS_COMBINED 0x00000100
#define TRAYNOTIFY_TRANSFERS_COMBINED 0x00000200
#define TRAYNOTIFY_BLINK_PRIVATECHAT 0x00000001
#define TRAYNOTIFY_BLINK_MESSAGES 0x00000002
#define TRAYNOTIFY_BLINK_CHANNELS 0x00000004
#define TRAYNOTIFY_BLINK_FORUMS 0x00000008
#define TRAYNOTIFY_BLINK_TRANSFERS 0x00000010
#define RS_CHATLOBBY_BLINK 0x00000001
#define STATUSBAR_DISC 0x00000001
//Forward declaration.
@ -155,12 +163,18 @@ public:
uint getChatFlags();
void setChatFlags(uint flags);
uint getChatLobbyFlags();
void setChatLobbyFlags(uint flags);
uint getNotifyFlags();
void setNotifyFlags(uint flags);
uint getTrayNotifyFlags();
void setTrayNotifyFlags(uint flags);
uint getTrayNotifyBlinkFlags();
void setTrayNotifyBlinkFlags(uint flags);
uint getMessageFlags();
void setMessageFlags(uint flags);

View File

@ -49,9 +49,15 @@ bool TransferUserNotify::notifyCombined()
return (Settings->getTrayNotifyFlags() & TRAYNOTIFY_TRANSFERS_COMBINED);
}
void TransferUserNotify::setNotifyEnabled(bool enabled, bool combined)
bool TransferUserNotify::notifyBlink()
{
return (Settings->getTrayNotifyBlinkFlags() & TRAYNOTIFY_BLINK_TRANSFERS);
}
void TransferUserNotify::setNotifyEnabled(bool enabled, bool combined, bool blink)
{
uint notifyFlags = Settings->getTrayNotifyFlags();
uint blinkFlags = Settings->getTrayNotifyBlinkFlags();
if (enabled) {
notifyFlags |= TRAYNOTIFY_TRANSFERS;
@ -65,7 +71,14 @@ void TransferUserNotify::setNotifyEnabled(bool enabled, bool combined)
notifyFlags &= ~TRAYNOTIFY_TRANSFERS_COMBINED;
}
if (blink) {
blinkFlags |= TRAYNOTIFY_BLINK_TRANSFERS;
} else {
blinkFlags &= ~TRAYNOTIFY_BLINK_TRANSFERS;
}
Settings->setTrayNotifyFlags(notifyFlags);
Settings->setTrayNotifyBlinkFlags(blinkFlags);
}
QIcon TransferUserNotify::getIcon()

View File

@ -34,7 +34,8 @@ public:
virtual bool hasSetting(QString &name);
virtual bool notifyEnabled();
virtual bool notifyCombined();
virtual void setNotifyEnabled(bool enabled, bool combined);
virtual bool notifyBlink();
virtual void setNotifyEnabled(bool enabled, bool combined, bool blink);
private slots:
void downloadCountChanged(int count);

View File

@ -1226,6 +1226,14 @@ Bitte wähle einen zum Chatten aus.</translation>
<source>Chat Lobby</source>
<translation type="unfinished">Chatlobby</translation>
</message>
<message>
<source>Blink tab icon</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Blink window/tab icon</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ChatStyle</name>
@ -7884,6 +7892,10 @@ Rechtsklick und als Freund hinzufügen um zu verbinden.</translation>
<source>Test</source>
<translation>Test</translation>
</message>
<message>
<source>Blink</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>NotifyQt</name>

View File

@ -1194,6 +1194,14 @@ Please choose one of it to chat with.</source>
<source>Chat Lobby</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Blink tab icon</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Blink window/tab icon</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ChatStyle</name>
@ -7703,6 +7711,10 @@ Right-click and select &apos;make friend&apos; to be able to connect.</source>
<source>Test</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Blink</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>NotifyQt</name>