new notify capability of chat lobbies: message counting, nickname occurrence counting and specific text counting. Also sorts out notify tab in Settings (Patch from Phenom, slightly modified: gui layout/text + added a flag to enable/disable user defined text grep)

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8082 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2015-03-26 22:17:48 +00:00
parent 9d2b6faf9c
commit e40460bdcc
18 changed files with 1045 additions and 392 deletions

View File

@ -55,6 +55,7 @@ ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WindowFlags flags)
ui.setupUi(this);
m_bProcessSettings = false;
myChatLobbyUserNotify = NULL;
QObject::connect( NotifyQt::getInstance(), SIGNAL(lobbyListChanged()), SLOT(lobbyChanged()));
QObject::connect( NotifyQt::getInstance(), SIGNAL(chatLobbyEvent(qulonglong,int,const QString&,const QString&)), this, SLOT(displayChatLobbyEvent(qulonglong,int,const QString&,const QString&)));
@ -194,12 +195,29 @@ ChatLobbyWidget::~ChatLobbyWidget()
UserNotify *ChatLobbyWidget::getUserNotify(QObject *parent)
{
ChatLobbyUserNotify *notify = new ChatLobbyUserNotify(parent);
connect(this, SIGNAL(unreadCountChanged(uint)), notify, SLOT(unreadCountChanged(uint)));
notify->unreadCountChanged(unreadCount());
return notify;
if (!myChatLobbyUserNotify){
myChatLobbyUserNotify = new ChatLobbyUserNotify(parent);
connect(myChatLobbyUserNotify, SIGNAL(countChanged(ChatLobbyId, unsigned int)), this, SLOT(updateNotify(ChatLobbyId, unsigned int)));
}
return myChatLobbyUserNotify;
}
void ChatLobbyWidget::updateNotify(ChatLobbyId id, unsigned int count)
{
ChatLobbyDialog *dialog=NULL;
dialog=_lobby_infos[id].dialog;
if(!dialog) return;
QToolButton* notifyButton=dialog->getChatWidget()->getNotifyButton();
if (!notifyButton) return;
dialog->getChatWidget()->setNotify(myChatLobbyUserNotify);
if (count>0){
notifyButton->setVisible(true);
notifyButton->setIcon(_lobby_infos[id].default_icon);
notifyButton->setToolTip(QString("(%1)").arg(count));
} else {
notifyButton->setVisible(false);
}
}
void ChatLobbyWidget::lobbyTreeWidgetCustomPopupMenu(QPoint)
@ -332,7 +350,7 @@ void ChatLobbyWidget::addChatPage(ChatLobbyDialog *d)
connect(d,SIGNAL(lobbyLeave(ChatLobbyId)),this,SLOT(unsubscribeChatLobby(ChatLobbyId))) ;
connect(d,SIGNAL(typingEventReceived(ChatLobbyId)),this,SLOT(updateTypingStatus(ChatLobbyId))) ;
connect(d,SIGNAL(messageReceived(ChatLobbyId)),this,SLOT(updateMessageChanged(ChatLobbyId))) ;
connect(d,SIGNAL(messageReceived(bool,ChatLobbyId,QDateTime,QString,QString)),this,SLOT(updateMessageChanged(bool,ChatLobbyId,QDateTime,QString,QString))) ;
connect(d,SIGNAL(peerJoined(ChatLobbyId)),this,SLOT(updatePeerEntering(ChatLobbyId))) ;
connect(d,SIGNAL(peerLeft(ChatLobbyId)),this,SLOT(updatePeerLeaving(ChatLobbyId))) ;
@ -340,7 +358,6 @@ void ChatLobbyWidget::addChatPage(ChatLobbyDialog *d)
_lobby_infos[id].dialog = d ;
_lobby_infos[id].default_icon = QIcon() ;
_lobby_infos[id].last_typing_event = time(NULL) ;
_lobby_infos[id].unread_count = 0;
ChatLobbyInfo linfo ;
if(rsMsgs->getChatLobbyInfo(id,linfo))
@ -619,6 +636,7 @@ void ChatLobbyWidget::showLobby(QTreeWidgetItem *item)
else
ui.stackedWidget->setCurrentWidget(_lobby_infos[id].dialog) ;
}
void ChatLobbyWidget::subscribeChatLobbyAs()
{
QTreeWidgetItem *item = ui.lobbyTreeWidget->currentItem();
@ -638,6 +656,31 @@ void ChatLobbyWidget::subscribeChatLobbyAs()
if(rsMsgs->joinVisibleChatLobby(id,gxs_id))
ChatDialog::chatFriend(ChatId(id),true) ;
}
void ChatLobbyWidget::showLobbyAnchor(ChatLobbyId id, QString anchor)
{
QTreeWidgetItem *item = getTreeWidgetItem(id) ;
if(item != NULL) {
if(item->type() == TYPE_LOBBY) {
if(_lobby_infos.find(id) == _lobby_infos.end()) {
showBlankPage(id) ;
} else {
//ChatLobbyDialog cldChatLobby =_lobby_infos[id].dialog;
ui.stackedWidget->setCurrentWidget(_lobby_infos[id].dialog) ;
ChatLobbyDialog *cldCW=NULL ;
if (NULL != (cldCW = dynamic_cast<ChatLobbyDialog *>(ui.stackedWidget->currentWidget())))
cldCW->getChatWidget()->scrollToAnchor(anchor);
ui.lobbyTreeWidget->setCurrentItem(item);
}
}
}
}
void ChatLobbyWidget::subscribeChatLobbyAtItem(QTreeWidgetItem *item)
{
if (item == NULL || item->type() != TYPE_LOBBY) {
@ -810,9 +853,12 @@ void ChatLobbyWidget::unsubscribeChatLobby(ChatLobbyId id)
if(it != _lobby_infos.end())
{
if (myChatLobbyUserNotify){
myChatLobbyUserNotify->chatLobbyCleared(id, "");
}
ui.stackedWidget->removeWidget(it->second.dialog) ;
_lobby_infos.erase(it) ;
emit unreadCountChanged(unreadCount());
}
// Unsubscribe the chat lobby
@ -852,10 +898,7 @@ void ChatLobbyWidget::updateCurrentLobby()
int iPrivacyLevel= item->parent()->data(COLUMN_DATA, ROLE_PRIVACYLEVEL).toInt();
QIcon icon = (iPrivacyLevel==CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC) ? QIcon(IMAGE_PUBLIC) : QIcon(IMAGE_PRIVATE);
_lobby_infos[id].default_icon = icon ;
_lobby_infos[id].unread_count = 0;
item->setIcon(COLUMN_NAME, icon) ;
emit unreadCountChanged(unreadCount());
}
}
@ -863,19 +906,21 @@ void ChatLobbyWidget::updateCurrentLobby()
filterItems(ui.filterLineEdit->text());
}
}
void ChatLobbyWidget::updateMessageChanged(ChatLobbyId id)
void ChatLobbyWidget::updateMessageChanged(bool incoming, ChatLobbyId id, QDateTime time, QString senderName, QString msg)
{
QTreeWidgetItem *current_item = ui.lobbyTreeWidget->currentItem();
bool bIsCurrentItem = (current_item != NULL && current_item->data(COLUMN_DATA, ROLE_ID).toULongLong() == id);
if (myChatLobbyUserNotify){
if (incoming) myChatLobbyUserNotify->chatLobbyNewMessage(id, time, senderName, msg);
}
// Don't show anything for current lobby.
//
if(current_item != NULL && current_item->data(COLUMN_DATA, ROLE_ID).toULongLong() == id)
if(bIsCurrentItem)
return ;
_lobby_infos[id].default_icon = QIcon(IMAGE_MESSAGE) ;
++_lobby_infos[id].unread_count;
emit unreadCountChanged(unreadCount());
QTreeWidgetItem *item = getTreeWidgetItem(id) ;
@ -1054,14 +1099,3 @@ int ChatLobbyWidget::getNumColVisible()
}
return iNumColVis;
}
uint ChatLobbyWidget::unreadCount()
{
uint count = 0;
for (std::map<ChatLobbyId,ChatLobbyInfoStruct>::iterator it = _lobby_infos.begin(); it != _lobby_infos.end(); ++it) {
count += it->second.unread_count;
}
return count;
}

View File

@ -4,6 +4,7 @@
#include <retroshare/rsmsgs.h>
#include "ui_ChatLobbyWidget.h"
#include "RsAutoUpdatePage.h"
#include "chat/ChatLobbyUserNotify.h"
#define IMAGE_CHATLOBBY ":/images/chat_32.png"
@ -20,7 +21,6 @@ struct ChatLobbyInfoStruct
QIcon default_icon ;
ChatLobbyDialog *dialog ;
time_t last_typing_event ;
uint unread_count;
};
class ChatLobbyWidget : public RsAutoUpdatePage
@ -38,12 +38,13 @@ public:
virtual QString pageName() const { return tr("Chat Lobbies") ; } //MainPage
virtual QString helpText() const { return ""; } //MainPage
virtual UserNotify *getUserNotify(QObject *parent);
virtual UserNotify *getUserNotify(QObject *parent); //MainPage
virtual void updateDisplay();
void setCurrentChatPage(ChatLobbyDialog *) ; // used by ChatLobbyDialog to raise.
void addChatPage(ChatLobbyDialog *) ;
void showLobbyAnchor(ChatLobbyId id, QString anchor) ;
uint unreadCount();
@ -66,7 +67,7 @@ protected slots:
void subscribeChatLobbyAs() ;
void updateTypingStatus(ChatLobbyId id) ;
void resetLobbyTreeIcons() ;
void updateMessageChanged(ChatLobbyId);
void updateMessageChanged(bool incoming, ChatLobbyId, QDateTime time, QString senderName, QString msg);
void updatePeerEntering(ChatLobbyId);
void updatePeerLeaving(ChatLobbyId);
void autoSubscribeItem();
@ -75,11 +76,12 @@ private slots:
void filterColumnChanged(int);
void filterItems(const QString &text);
void setShowUserCountColumn(bool show);
void setShowTopicColumn(bool show);
void setShowSubscribeColumn(bool show);
void updateNotify(ChatLobbyId id, unsigned int count) ;
private:
void autoSubscribeLobby(QTreeWidgetItem *item);
void subscribeChatLobby(ChatLobbyId id) ;
@ -109,6 +111,8 @@ private:
QAction* showSubscribeAct;
int getNumColVisible();
ChatLobbyUserNotify* myChatLobbyUserNotify;
/* UI - from Designer */
Ui::ChatLobbyWidget ui;
};

View File

@ -336,7 +336,7 @@ void ChatLobbyDialog::addChatMsg(const ChatMessage& msg)
name = QString::fromUtf8(msg.peer_alternate_nickname.c_str()) + " (" + QString::fromStdString(gxs_id.toStdString()) + ")" ;
ui.chatWidget->addChatMsg(msg.incoming, name, sendTime, recvTime, message, ChatWidget::MSGTYPE_NORMAL);
emit messageReceived(id()) ;
emit messageReceived(msg.incoming, id(), sendTime, name, message) ;
// This is a trick to translate HTML into text.
QTextEdit editor;

View File

@ -56,7 +56,7 @@ private slots:
signals:
void lobbyLeave(ChatLobbyId) ;
void typingEventReceived(ChatLobbyId) ;
void messageReceived(ChatLobbyId) ;
void messageReceived(bool incoming, ChatLobbyId lobby_id, QDateTime time, QString senderName, QString msg) ;
void peerJoined(ChatLobbyId) ;
void peerLeft(ChatLobbyId) ;

View File

@ -19,23 +19,77 @@
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <QTime>
#include <QMenu>
#include "ChatLobbyUserNotify.h"
#include "gui/notifyqt.h"
#include "gui/MainWindow.h"
#include "gui/ChatLobbyWidget.h"
#include "gui/settings/rsharesettings.h"
#include "util/DateTime.h"
#include <retroshare/rsidentity.h>
ChatLobbyUserNotify::ChatLobbyUserNotify(QObject *parent) :
UserNotify(parent)
{
_name = tr("Chat Lobbies");
_group = "ChatLobby";
_bCheckForNickName = Settings->valueFromGroup(_group, "CheckForNickName", true).toBool();
_bCountUnRead = Settings->valueFromGroup(_group, "CountUnRead", true).toBool();
_bCountSpecificText = Settings->valueFromGroup(_group, "CountSpecificText").toBool();
_textToNotify = Settings->valueFromGroup(_group, "TextToNotify").toStringList();
}
bool ChatLobbyUserNotify::hasSetting(QString *name, QString *group)
{
if (name) *name = tr("Chat Lobbies");
if (group) *group = "ChatLobby";
if (name) *name = _name;
if (group) *group = _group;
return true;
}
void ChatLobbyUserNotify::setCheckForNickName(bool value)
{
if (_bCheckForNickName != value) {
_bCheckForNickName = value;
Settings->setValueToGroup(_group, "CheckForNickName", value);
}
}
void ChatLobbyUserNotify::setCountUnRead(bool value)
{
if (_bCountUnRead != value) {
_bCountUnRead = value;
Settings->setValueToGroup(_group, "CountUnRead", value);
}
}
void ChatLobbyUserNotify::setCountSpecificText(bool value)
{
if (_bCountSpecificText != value) {
_bCountSpecificText = value;
Settings->setValueToGroup(_group, "CountSpecificText", value);
}
}
void ChatLobbyUserNotify::setTextToNotify(QStringList value)
{
if (_textToNotify != value) {
_textToNotify = value;
Settings->setValueToGroup(_group, "TextToNotify", value);
}
}
void ChatLobbyUserNotify::setTextToNotify(QString value)
{
QRegExp regExp("([ ~!@#$%^&*()_+{}|:\"<>?,./;'[\\]\\\\\\-=\\t\\n\\r])"); //RegExp for End of Word
QStringList list = value.split(regExp);
QString newValue = list.join("\n");
while(newValue.contains("\n\n")) newValue.replace("\n\n","\n");
list = newValue.split("\n");
setTextToNotify(list);
}
QIcon ChatLobbyUserNotify::getIcon()
{
return QIcon(":/images/chat_32.png");
@ -48,17 +102,229 @@ QIcon ChatLobbyUserNotify::getMainIcon(bool hasNew)
unsigned int ChatLobbyUserNotify::getNewCount()
{
return mUnreadCount;
int iNum=0;
for (lobby_map::iterator itCL=_listMsg.begin(); itCL!=_listMsg.end(); ++itCL) {
iNum+=itCL->second.size();
if (itCL->second.size()==0) _listMsg.erase(itCL);
}
return iNum;
}
QString ChatLobbyUserNotify::getTrayMessage(bool plural)
{
return plural ? tr("You have %1 new messages") : tr("You have %1 new message");
}
QString ChatLobbyUserNotify::getNotifyMessage(bool plural)
{
return plural ? tr("%1 new messages") : tr("%1 new message");
}
void ChatLobbyUserNotify::iconClicked()
{
MainWindow::showWindow(MainWindow::ChatLobby);
/// Tray icon Menu ///
QMenu* trayMenu = new QMenu(MainWindow::getInstance());
std::list<ChatLobbyId> lobbies;
rsMsgs->getChatLobbyList(lobbies);
bool doUpdate=false;
for (lobby_map::iterator itCL=_listMsg.begin(); itCL!=_listMsg.end();++itCL) {
/// Create a menu per lobby ///
bool bFound=false;
QString strLobbyName=tr("Unknown Lobby");
QIcon icoLobby=QIcon();
std::list<ChatLobbyId>::const_iterator lobbyIt;
for (lobbyIt = lobbies.begin(); lobbyIt != lobbies.end(); ++lobbyIt) {
ChatLobbyId clId = *lobbyIt;
if (clId==itCL->first) {
ChatLobbyInfo clInfo;
if (rsMsgs->getChatLobbyInfo(clId,clInfo))
strLobbyName=QString::fromUtf8(clInfo.lobby_name.c_str()) ;
icoLobby=(clInfo.lobby_flags & RS_CHAT_LOBBY_FLAGS_PUBLIC) ? QIcon(":/images/chat_red24.png") : QIcon(":/images/chat_x24.png");
bFound=true;
break;
}
}
if (bFound){
makeSubMenu(trayMenu, icoLobby, strLobbyName, itCL->first);
} else {
_listMsg.erase(itCL);
doUpdate=true;
}
}
if (notifyCombined()) {
QSystemTrayIcon* trayIcon=getTrayIcon();
if (trayIcon!=NULL) trayIcon->setContextMenu(trayMenu);
} else {
QAction* action=getNotifyIcon();
if (action!=NULL) {
action->setMenu(trayMenu);
}
}
QString strName=tr("Remove All");
QAction *pAction = new QAction( QIcon(), strName, trayMenu);
ActionTag actionTag={0x0, "", true};
pAction->setData(qVariantFromValue(actionTag));
connect(trayMenu, SIGNAL(triggered(QAction*)), this, SLOT(subMenuClicked(QAction*)));
connect(trayMenu, SIGNAL(hovered(QAction*)), this, SLOT(subMenuHovered(QAction*)));
trayMenu->addAction(pAction);
trayMenu->exec(QCursor::pos());
if (doUpdate) updateIcon();
}
void ChatLobbyUserNotify::unreadCountChanged(unsigned int unreadCount)
void ChatLobbyUserNotify::makeSubMenu(QMenu* parentMenu, QIcon icoLobby, QString strLobbyName, ChatLobbyId id)
{
mUnreadCount = unreadCount;
lobby_map::iterator itCL=_listMsg.find(id);
if (itCL==_listMsg.end()) return;
msg_map msgMap = itCL->second;
unsigned int msgCount=msgMap.size();
if(!parentMenu) parentMenu = new QMenu(MainWindow::getInstance());
QMenu *lobbyMenu = parentMenu->addMenu(icoLobby, strLobbyName);
connect(lobbyMenu, SIGNAL(triggered(QAction*)), this, SLOT(subMenuClicked(QAction*)));
connect(lobbyMenu, SIGNAL(hovered(QAction*)), this, SLOT(subMenuHovered(QAction*)));
lobbyMenu->setToolTip(getNotifyMessage(msgCount>1).arg(msgCount));
for (msg_map::iterator itMsg=msgMap.begin(); itMsg!=msgMap.end(); ++itMsg) {
/// initialize menu ///
QString strName=itMsg->first;
MsgData msgData=itMsg->second;
QTextDocument doc;
doc.setHtml(msgData.text);
strName.append(":").append(doc.toPlainText().left(30).replace(QString("\n"),QString(" ")));
QAction *pAction = new QAction( icoLobby, strName, lobbyMenu);
pAction->setToolTip(doc.toPlainText());
ActionTag actionTag={itCL->first, itMsg->first, false};
pAction->setData(qVariantFromValue(actionTag));
lobbyMenu->addAction(pAction);
}
QString strName=tr("Remove All");
QAction *pAction = new QAction( icoLobby, strName, lobbyMenu);
ActionTag actionTag={itCL->first, "", true};
pAction->setData(qVariantFromValue(actionTag));
lobbyMenu->addAction(pAction);
}
void ChatLobbyUserNotify::iconHovered()
{
iconClicked();
}
void ChatLobbyUserNotify::chatLobbyNewMessage(ChatLobbyId lobby_id, QDateTime time, QString senderName, QString msg)
{
bool bGetNickName = false;
if (_bCheckForNickName) {
RsGxsId gxs_id;
rsMsgs->getIdentityForChatLobby(lobby_id,gxs_id);
RsIdentityDetails details ;
rsIdentity->getIdDetails(gxs_id,details) ;
bGetNickName = checkWord(msg, QString::fromUtf8(details.mNickname.c_str()));
}
bool bFoundTextToNotify = false;
if(_bCountSpecificText)
for (QStringList::Iterator it = _textToNotify.begin(); it != _textToNotify.end(); ++it) {
bFoundTextToNotify |= checkWord(msg, (*it));
}
if ((bGetNickName || bFoundTextToNotify || _bCountUnRead)){
QString strAnchor = time.toString(Qt::ISODate);
strAnchor.append("_").append(senderName);
MsgData msgData;
msgData.text=msg;
msgData.unread=!(bGetNickName || bFoundTextToNotify);
_listMsg[lobby_id][strAnchor]=msgData;
emit countChanged(lobby_id, _listMsg[lobby_id].size());
updateIcon();
}
}
bool ChatLobbyUserNotify::checkWord(QString message, QString word)
{
bool bFound = false;
int nFound = -1;
if (((nFound=message.indexOf(word)) != -1)
&& (!word.isEmpty())) {
QString eow=" ~!@#$%^&*()_+{}|:\"<>?,./;'[]\\-="; // end of word
bool bFirstCharEOW = (nFound==0)?true:(eow.indexOf(message.at(nFound-1)) != -1);
bool bLastCharEOW = ((nFound+word.length()-1) < message.length())
?(eow.indexOf(message.at(nFound+word.length())) != -1)
:true;
bFound = (bFirstCharEOW && bLastCharEOW);
}
return bFound;
}
void ChatLobbyUserNotify::chatLobbyCleared(ChatLobbyId lobby_id, QString anchor, bool onlyUnread /*=false*/)
{
bool changed = anchor.isEmpty();
unsigned int count=0;
if (lobby_id==0) return;
lobby_map::iterator itCL=_listMsg.find(lobby_id);
if (itCL!=_listMsg.end()) {
if (!anchor.isEmpty()) {
msg_map::iterator itMsg=itCL->second.find(anchor);
if (itMsg!=itCL->second.end()) {
MsgData msgData = itMsg->second;
if(!onlyUnread || msgData.unread) {
itCL->second.erase(itMsg);
changed=true;
}
}
count = itCL->second.size();
}
if (count==0) _listMsg.erase(itCL);
}
if (changed) emit countChanged(lobby_id, count);
updateIcon();
}
void ChatLobbyUserNotify::subMenuClicked(QAction* action)
{
ActionTag actionTag=action->data().value<ActionTag>();
if(!actionTag.removeALL){
MainWindow::showWindow(MainWindow::ChatLobby);
ChatLobbyWidget *chatLobbyWidget = dynamic_cast<ChatLobbyWidget*>(MainWindow::getPage(MainWindow::ChatLobby));
if (chatLobbyWidget) chatLobbyWidget->showLobbyAnchor(actionTag.cli ,actionTag.timeStamp);
}
lobby_map::iterator itCL=_listMsg.find(actionTag.cli);
if (itCL!=_listMsg.end()) {
unsigned int count=0;
if(!actionTag.removeALL){
msg_map::iterator itMsg=itCL->second.find(actionTag.timeStamp);
if (itMsg!=itCL->second.end()) itCL->second.erase(itMsg);
count = itCL->second.size();
}
if (count==0) _listMsg.erase(itCL);
emit countChanged(actionTag.cli, count);
} else if(actionTag.cli==0x0){
for(itCL=_listMsg.begin();itCL!=_listMsg.end();++itCL){
emit countChanged(itCL->first, 0);
_listMsg.erase(itCL);
}
}
QMenu *lobbyMenu=dynamic_cast<QMenu*>(action->parent());
if (lobbyMenu) lobbyMenu->removeAction(action);
updateIcon();
}
void ChatLobbyUserNotify::subMenuHovered(QAction* action)
{
QMenu *lobbyMenu=dynamic_cast<QMenu*>(action->parent());
if (lobbyMenu) lobbyMenu->setToolTip(action->toolTip());
}

View File

@ -23,6 +23,22 @@
#define CHATLOBBYUSERNOTIFY_H
#include "gui/common/UserNotify.h"
#include <retroshare/rsmsgs.h>
#include <QDateTime>
#include <QMetaType>
struct ActionTag {
ChatLobbyId cli;
QString timeStamp;
bool removeALL;
};
Q_DECLARE_METATYPE(ActionTag)
struct MsgData {
QString text;
bool unread;
};
Q_DECLARE_METATYPE(MsgData)
class ChatLobbyUserNotify : public UserNotify
{
@ -32,18 +48,46 @@ public:
ChatLobbyUserNotify(QObject *parent = 0);
virtual bool hasSetting(QString *name, QString *group);
void makeSubMenu(QMenu* parentMenu, QIcon icoLobby, QString strLobbyName, ChatLobbyId id);
void chatLobbyNewMessage(ChatLobbyId lobby_id, QDateTime time, QString senderName, QString msg);
void chatLobbyCleared(ChatLobbyId lobby_id, QString anchor, bool onlyUnread=false);
void setCheckForNickName(bool value);
bool isCheckForNickName() { return _bCheckForNickName;}
void setCountUnRead(bool value);
bool isCountUnRead() { return _bCountUnRead;}
void setCountSpecificText(bool value);
bool isCountSpecificText() { return _bCountSpecificText;}
void setTextToNotify(QStringList);
void setTextToNotify(QString);
QString textToNotify() { return _textToNotify.join("\n");}
public slots:
void unreadCountChanged(uint unreadCount);
signals:
void countChanged(ChatLobbyId id, unsigned int count);
private slots:
void subMenuClicked(QAction* action);
void subMenuHovered(QAction* action);
private:
virtual QIcon getIcon();
virtual QIcon getMainIcon(bool hasNew);
virtual unsigned int getNewCount();
virtual QString getTrayMessage(bool plural);
virtual QString getNotifyMessage(bool plural);
virtual void iconClicked();
virtual void iconHovered();
bool checkWord(QString msg, QString word);
private:
uint mUnreadCount;
QString _name;
QString _group;
typedef std::map<QString, MsgData> msg_map;
typedef std::map<ChatLobbyId, msg_map> lobby_map;
lobby_map _listMsg;
QStringList _textToNotify;
bool _bCheckForNickName;
bool _bCountUnRead;
bool _bCountSpecificText;
};
#endif // CHATLOBBYUSERNOTIFY_H

View File

@ -31,10 +31,12 @@
#include <QTextCodec>
#include <QTimer>
#include <QTextDocumentFragment>
#include <QToolTip>
#include <QStringListModel>
#include "ChatWidget.h"
#include "ui_ChatWidget.h"
#include "gui/MainWindow.h"
#include "gui/notifyqt.h"
#include "gui/RetroShareLink.h"
#include "gui/settings/rsharesettings.h"
@ -44,9 +46,11 @@
#include "gui/common/StatusDefs.h"
#include "gui/common/FilesDefs.h"
#include "gui/common/Emoticons.h"
#include "gui/chat/ChatLobbyDialog.h"
#include "util/misc.h"
#include "util/HandleRichText.h"
#include "gui/chat/ChatUserNotify.h"
#include "gui/chat/ChatUserNotify.h"//For BradCast
#include "util/DateTime.h"
#include <retroshare/rsstatus.h>
#include <retroshare/rsidentity.h>
@ -104,6 +108,9 @@ ChatWidget::ChatWidget(QWidget *parent) :
connect(ui->searchButton, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuSearchButton(QPoint)));
connect(ui->actionSearch_History, SIGNAL(triggered()), this, SLOT(searchHistory()));
notify=NULL;
ui->notifyButton->setVisible(false);
ui->markButton->setToolTip(tr("<b>Mark this selected text</b><br><i>Ctrl+M</i>"));
connect(ui->sendButton, SIGNAL(clicked()), this, SLOT(sendChat()));
@ -135,7 +142,8 @@ ChatWidget::ChatWidget(QWidget *parent) :
ui->infoFrame->setVisible(false);
ui->statusMessageLabel->hide();
ui->searchframe->hide();
ui->actionSearch_History->setChecked(Settings->getChatSearchShowBarByDefault());
searchHistory();
setAcceptDrops(true);
ui->chatTextEdit->setAcceptDrops(false);
@ -156,8 +164,11 @@ ChatWidget::ChatWidget(QWidget *parent) :
menu->addAction(ui->actionSearch_History);
ui->pushtoolsButton->setMenu(menu);
ui->chatTextEdit->installEventFilter(this);
ui->textBrowser->installEventFilter(this);
ui->textBrowser->viewport()->installEventFilter(this);
ui->chatTextEdit->installEventFilter(this);
//ui->textBrowser->setMouseTracking(true);
//ui->chatTextEdit->setMouseTracking(true);
#if QT_VERSION < 0x040700
// embedded images are not supported before QT 4.7.0
@ -375,7 +386,8 @@ void ChatWidget::processSettings(bool load)
bool ChatWidget::eventFilter(QObject *obj, QEvent *event)
{
if (obj == ui->textBrowser || obj == ui->leSearch || obj == ui->chatTextEdit) {
if (obj == ui->textBrowser || obj == ui->textBrowser->viewport()
|| obj == ui->leSearch || obj == ui->chatTextEdit) {
if (event->type() == QEvent::KeyPress) {
QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
@ -419,24 +431,109 @@ bool ChatWidget::eventFilter(QObject *obj, QEvent *event)
}
}
if (chatType() == CHATTYPE_LOBBY) {
if ((event->type() == QEvent::KeyPress)
|| (event->type() == QEvent::MouseMove)
|| (event->type() == QEvent::Enter)
|| (event->type() == QEvent::Leave)
|| (event->type() == QEvent::Wheel)
|| (event->type() == QEvent::ToolTip) ) {
QTextCursor cursor = ui->textBrowser->cursorForPosition(QPoint(0, 0));
QPoint bottom_right(ui->textBrowser->viewport()->width() - 1, ui->textBrowser->viewport()->height() - 1);
int end_pos = ui->textBrowser->cursorForPosition(bottom_right).position();
cursor.setPosition(end_pos, QTextCursor::KeepAnchor);
if (!cursor.selectedText().isEmpty()){
QRegExp rx("<a\\s+name\\s*=\\s*\"(.*)\"",Qt::CaseInsensitive, QRegExp::RegExp2);
rx.setMinimal(true);
QString sel=cursor.selection().toHtml();
QStringList anchors;
int pos=0;
while ((pos = rx.indexIn(sel,pos)) != -1) {
anchors << rx.cap(1);
pos += rx.matchedLength();
}
if (!anchors.isEmpty()){
for (QStringList::iterator it=anchors.begin();it!=anchors.end();++it) {
QByteArray bytArray=it->toUtf8();
std::string stdString=std::string(bytArray.begin(),bytArray.end());
if (notify) notify->chatLobbyCleared(chatId.toLobbyId()
,QString::fromUtf8(stdString.c_str())
,obj != ui->textBrowser && obj != ui->textBrowser->viewport());//, true);
}
}
}
}
}
}
if (obj == ui->textBrowser) {
if (event->type() == QEvent::KeyPress) {
QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
if (keyEvent) {
if (keyEvent->key() == Qt::Key_Delete ) {
// Delete pressed
if (ui->textBrowser->textCursor().selectedText().length()>0)
// Delete key pressed
if (ui->textBrowser->textCursor().selectedText().length() > 0) {
if (chatType() == CHATTYPE_LOBBY) {
QRegExp rx("<a\\s+name\\s*=\\s*\"(.*)\"",Qt::CaseInsensitive, QRegExp::RegExp2);
rx.setMinimal(true);
QString sel=ui->textBrowser->textCursor().selection().toHtml();
QStringList anchors;
int pos=0;
while ((pos = rx.indexIn(sel,pos)) != -1) {
anchors << rx.cap(1);
pos += rx.matchedLength();
}
for (QStringList::iterator it=anchors.begin();it!=anchors.end();++it) {
QByteArray bytArray=it->toUtf8();
std::string stdString=std::string(bytArray.begin(),bytArray.end());
if (notify) notify->chatLobbyCleared(chatId.toLobbyId(), QString::fromUtf8(stdString.c_str()));
}
}
ui->textBrowser->textCursor().deleteChar();
}
}
if (keyEvent->key() == Qt::Key_M && keyEvent->modifiers() == Qt::ControlModifier)
{
on_markButton_clicked(!ui->markButton->isChecked());
}
}
}
if (event->type() == QEvent::ToolTip) {
QHelpEvent* helpEvent = static_cast<QHelpEvent*>(event);
QTextCursor cursor = ui->textBrowser->cursorForPosition(helpEvent->pos());
cursor.select(QTextCursor::WordUnderCursor);
QString toolTipText = "";
if (!cursor.selectedText().isEmpty()){
QRegExp rx("<a\\s+name\\s*=\\s*\"(.*)\"",Qt::CaseInsensitive, QRegExp::RegExp2);
rx.setMinimal(true);
QString sel=cursor.selection().toHtml();
QStringList anchors;
int pos=0;
while ((pos = rx.indexIn(sel,pos)) != -1) {
anchors << rx.cap(1);
pos += rx.matchedLength();
}
if (!anchors.isEmpty()){
toolTipText = anchors.at(0);
}
}
if (!toolTipText.isEmpty()){
QToolTip::showText(helpEvent->globalPos(), toolTipText);
return true;
} else {
QToolTip::hideText();
}
}
} else if (obj == ui->chatTextEdit) {
if (event->type() == QEvent::KeyPress) {
@ -691,6 +788,35 @@ void ChatWidget::focusDialog()
ui->chatTextEdit->setFocus();
}
QToolButton* ChatWidget::getNotifyButton()
{
if (ui) if (ui->notifyButton) return ui->notifyButton;
return NULL;
}
void ChatWidget::setNotify(ChatLobbyUserNotify *clun)
{
if(clun) notify=clun;
}
void ChatWidget::on_notifyButton_clicked()
{
if(!notify) return;
if (chatType() != CHATTYPE_LOBBY) return;
QMenu* menu = new QMenu(MainWindow::getInstance());
QIcon icoLobby=(ui->notifyButton->icon());
notify->makeSubMenu(menu, icoLobby, title, chatId.toLobbyId());
menu->exec(ui->notifyButton->mapToGlobal(ui->notifyButton->geometry().bottomLeft()));
}
void ChatWidget::scrollToAnchor(QString anchor)
{
ui->textBrowser->scrollToAnchor(anchor);
}
void ChatWidget::setWelcomeMessage(QString &text)
{
ui->textBrowser->setText(text);
@ -752,8 +878,12 @@ void ChatWidget::addChatMsg(bool incoming, const QString &name, const QDateTime
}
QString formattedMessage = RsHtml().formatText(ui->textBrowser->document(), message, formatTextFlag, backgroundColor, desiredContrast);
QString formatMsg = chatStyle.formatMessage(type, name, incoming ? sendTime : recvTime, formattedMessage, formatFlag);
QDateTime dtTimestamp=incoming ? sendTime : recvTime;
QString formatMsg = chatStyle.formatMessage(type, name, dtTimestamp, formattedMessage, formatFlag);
QString timeStamp = dtTimestamp.toString(Qt::ISODate);
formatMsg.prepend(QString("<a name=\"%1_%2\"/>").arg(timeStamp).arg(name));
//To call this anchor do: ui->textBrowser->scrollToAnchor(QString("%1_%2").arg(timeStamp).arg(name));
ui->textBrowser->textCursor().setBlockFormat(QTextBlockFormat ());
ui->textBrowser->append(formatMsg);
@ -1074,13 +1204,13 @@ bool ChatWidget::findText(const QString& qsStringToFind, bool bBackWard, bool bF
qtcCurrent=qtcHighLight;
if (bMoveToCursor || bForceMove) ui->textBrowser->setTextCursor(qtcHighLight);
}//if (bFirstFound && (qtcHighLight.position()>qtcCurrent.position()))
}
if (uiFoundCount<UINT_MAX)
uiFoundCount+=1;
}//if(!qtcHighLight.isNull())
}//while(!qtcHighLight.isNull() && !qtcHighLight.atEnd())
}
}
if (bFound)
{
@ -1218,6 +1348,9 @@ void ChatWidget::clearChatHistory()
ui->textBrowser->clear();
on_searchButton_clicked(false);
ui->markButton->setChecked(false);
if (chatType() == CHATTYPE_LOBBY) {
if (notify) notify->chatLobbyCleared(chatId.toLobbyId(),"");
}
}
void ChatWidget::deleteChatHistory()
@ -1434,7 +1567,7 @@ void ChatWidget::updateTitle()
ui->titleLabel->setText(RsHtml::plainText(name) + "@" + RsHtml::plainText(title));
}
void ChatWidget::updatePeersCustomStateString(const QString& peer_id, const QString& status_string)
void ChatWidget::updatePeersCustomStateString(const QString& /*peer_id*/, const QString& /*status_string*/)
{
QString status_text;

View File

@ -27,10 +27,12 @@
#include <QCompleter>
#include <QTextCursor>
#include <QTextCharFormat>
#include <QToolButton>
#include "gui/common/HashBox.h"
#include "gui/common/RsButtonOnText.h"
#include "ChatStyle.h"
#include "gui/style/RSStyle.h"
#include "ChatLobbyUserNotify.h"
#include <retroshare/rsmsgs.h>
#include <retroshare/rsfiles.h>
@ -84,6 +86,9 @@ public:
bool isTyping() { return typing; }
void focusDialog();
QToolButton* getNotifyButton();
void setNotify(ChatLobbyUserNotify* clun);
void scrollToAnchor(QString anchor);
void addToParent(QWidget *newParent);
void removeFromParent(QWidget *oldParent);
@ -162,6 +167,8 @@ private slots:
void toogle_MoveToCursor();
void toogle_SeachWithoutLimit();
void on_notifyButton_clicked();
void on_markButton_clicked(bool bValue);
void chooseColor();
@ -237,6 +244,7 @@ private:
QCompleter *completer;
QList<ChatWidgetHolder*> mChatWidgetHolder;
ChatLobbyUserNotify* notify;
Ui::ChatWidget *ui;
};

View File

@ -115,7 +115,7 @@
<property name="margin">
<number>0</number>
</property>
<item row="0" column="4">
<item row="0" column="5">
<widget class="QToolButton" name="searchButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -159,7 +159,68 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QToolButton" name="notifyButton">
<property name="minimumSize">
<size>
<width>28</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>28</width>
<height>28</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/chat_red24.png</normaloff>:/images/chat_red24.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QToolButton" name="searchAfter">
<property name="minimumSize">
<size>
<width>14</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>14</width>
<height>28</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/arrow-right.png</normaloff>:/images/arrow-right.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="LineEditClear" name="leSearch"/>
</item>
<item row="0" column="4">
<widget class="QToolButton" name="searchBefore">
<property name="minimumSize">
<size>
@ -185,7 +246,7 @@
</property>
</widget>
</item>
<item row="0" column="0">
<item row="0" column="1">
<widget class="QToolButton" name="markButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -226,35 +287,6 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="LineEditClear" name="leSearch"/>
</item>
<item row="0" column="2">
<widget class="QToolButton" name="searchAfter">
<property name="minimumSize">
<size>
<width>14</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>14</width>
<height>28</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/arrow-right.png</normaloff>:/images/arrow-right.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@ -116,6 +116,7 @@ void UserNotify::createIcons(QMenu *notifyMenu)
if (mNotifyIcon == NULL) {
mNotifyIcon = notifyMenu->addAction(getIcon(), "", this, SLOT(trayIconClicked()));
mNotifyIcon->setVisible(false);
connect(mNotifyIcon, SIGNAL(hovered()), this, SLOT(trayIconHovered()));
}
} else {
DELETE_OBJECT(mNotifyIcon);
@ -212,11 +213,16 @@ QString UserNotify::getNotifyMessage(bool plural)
void UserNotify::trayIconClicked(QSystemTrayIcon::ActivationReason e)
{
if (e == QSystemTrayIcon::Trigger || e == QSystemTrayIcon::DoubleClick) {
if (e == QSystemTrayIcon::Trigger || e == QSystemTrayIcon::DoubleClick || e == QSystemTrayIcon::Context) {
iconClicked();
}
}
void UserNotify::trayIconHovered()
{
iconHovered();
}
void UserNotify::blink(bool on)
{
if (mTrayIcon) {

View File

@ -40,6 +40,8 @@ public:
void initialize(QToolBar *mainToolBar, QAction *mainAction, QListWidgetItem *listItem);
void createIcons(QMenu *notifyMenu);
QSystemTrayIcon* getTrayIcon(){ return mTrayIcon;}
QAction* getNotifyIcon(){ return mNotifyIcon;}
virtual bool hasSetting(QString */*name*/, QString */*group*/) { return false; }
bool notifyEnabled();
@ -55,6 +57,7 @@ public slots:
private slots:
void trayIconClicked(QSystemTrayIcon::ActivationReason e = QSystemTrayIcon::Trigger);
void trayIconHovered();
void blink(bool on);
protected:
@ -70,6 +73,7 @@ private:
virtual QString getNotifyMessage(bool plural);
virtual void iconClicked() {}
virtual void iconHovered() {}
private:
QToolButton *mMainToolButton;

View File

@ -131,6 +131,7 @@ ChatPage::save(QString &/*errmsg*/)
Settings->setChatSendMessageWithCtrlReturn(ui.sendMessageWithCtrlReturn->isChecked());
Settings->setChatSearchShowBarByDefault(ui.cbSearch_ShowBar->isChecked());
Settings->setChatSearchCharToStartSearch(ui.sbSearch_CharToStart->value());
Settings->setChatSearchCaseSensitively(ui.cbSearch_CaseSensitively->isChecked());
Settings->setChatSearchWholeWords(ui.cbSearch_WholeWords->isChecked());
@ -233,6 +234,7 @@ ChatPage::load()
ui.sendMessageWithCtrlReturn->setChecked(Settings->getChatSendMessageWithCtrlReturn());
ui.cbSearch_ShowBar->setChecked(Settings->getChatSearchShowBarByDefault());
ui.sbSearch_CharToStart->setValue(Settings->getChatSearchCharToStartSearch());
ui.cbSearch_CaseSensitively->setChecked(Settings->getChatSearchCaseSensitively());
ui.cbSearch_WholeWords->setChecked(Settings->getChatSearchWholeWords());

View File

@ -314,6 +314,13 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="cbSearch_ShowBar">
<property name="text">
<string>Show Bar by default</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="hlSearch_CharToStart">
<item>

View File

@ -43,6 +43,7 @@ NotifyPage::NotifyPage(QWidget * parent, Qt::WindowFlags flags)
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)));
connect(ui.chatLobbies_CountFollowingText,SIGNAL(toggled(bool)),ui.chatLobbies_TextToNotify,SLOT(setEnabled(bool))) ;
ui.notify_Blogs->hide();
@ -74,6 +75,7 @@ NotifyPage::NotifyPage(QWidget * parent, Qt::WindowFlags flags)
const QList<UserNotify*> &userNotifyList = MainWindow::getInstance()->getUserNotifyList();
QList<UserNotify*>::const_iterator it;
row = 0;
mChatLobbyUserNotify = 0;
for (it = userNotifyList.begin(); it != userNotifyList.end(); ++it) {
UserNotify *userNotify = *it;
@ -96,6 +98,9 @@ NotifyPage::NotifyPage(QWidget * parent, Qt::WindowFlags flags)
ui.notifyLayout->addWidget(blinkCheckBox, row++, 2);
mUserNotifySettingList.push_back(UserNotifySetting(userNotify, enabledCheckBox, combinedCheckBox, blinkCheckBox));
//To get ChatLobbyUserNotify Settings
if (!mChatLobbyUserNotify) mChatLobbyUserNotify = dynamic_cast<ChatLobbyUserNotify*>(*it);
}
/* Hide platform specific features */
@ -205,6 +210,12 @@ NotifyPage::save(QString &/*errmsg*/)
Settings->setToasterMargin(QPoint(ui.spinBoxToasterXMargin->value(), ui.spinBoxToasterYMargin->value()));
if (mChatLobbyUserNotify){
mChatLobbyUserNotify->setCountUnRead(ui.chatLobbies_CountUnRead->isChecked()) ;
mChatLobbyUserNotify->setCheckForNickName(ui.chatLobbies_CheckNickName->isChecked()) ;
mChatLobbyUserNotify->setCountSpecificText(ui.chatLobbies_CountFollowingText->isChecked()) ;
mChatLobbyUserNotify->setTextToNotify(ui.chatLobbies_TextToNotify->document()->toPlainText());
}
load();
return true;
}
@ -282,6 +293,15 @@ void NotifyPage::load()
}
notifyToggled();
ui.chatLobbies_TextToNotify->setEnabled(mChatLobbyUserNotify->isCountSpecificText()) ;
ui.chatLobbies_CountFollowingText->setChecked(mChatLobbyUserNotify->isCountSpecificText()) ;
if (mChatLobbyUserNotify){
ui.chatLobbies_CountUnRead->setChecked(mChatLobbyUserNotify->isCountUnRead());
ui.chatLobbies_CheckNickName->setChecked(mChatLobbyUserNotify->isCheckForNickName());
ui.chatLobbies_TextToNotify->setPlainText(mChatLobbyUserNotify->textToNotify());
}
}
void NotifyPage::notifyToggled()

View File

@ -25,6 +25,8 @@
#include <retroshare-gui/configpage.h>
#include "ui_NotifyPage.h"
#include "gui/chat/ChatLobbyUserNotify.h"
class UserNotify;
class FeedNotify;
@ -79,6 +81,7 @@ private slots:
private:
uint getNewsFlags();
uint getNotifyFlags();
ChatLobbyUserNotify* mChatLobbyUserNotify;
QList<FeedNotifySetting> mFeedNotifySettingList;
QList<UserNotifySetting> mUserNotifySettingList;

View File

@ -10,247 +10,103 @@
<height>512</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QGroupBox" name="notify_ForumNewMsg">
<property name="title">
<string>News Feed</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>6</number>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QCheckBox" name="notify_Peers">
<property name="text">
<string>Friend Connect</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="notify_Channels">
<property name="text">
<string>Channels</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="notify_Forums">
<property name="text">
<string>Forums</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="notify_Posted">
<property name="text">
<string>Posted</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="notify_Blogs">
<property name="text">
<string>Blogs</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="notify_Messages">
<property name="text">
<string>Messages</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="notify_Chat">
<property name="text">
<string>Chat</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="notify_Security">
<property name="text">
<string>Security</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="feedLayout"/>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<widget class="QPushButton" name="notifyButton">
<property name="text">
<string>Test</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="trayNotifyGroupBox">
<property name="title">
<string>Systray Icon</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<layout class="QGridLayout" name="notifyLayout"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="messageGroupBox">
<property name="title">
<string>Message</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QCheckBox" name="message_ConnectAttempt">
<property name="text">
<string>Connect attempt</string>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>3</number>
</property>
<widget class="QWidget" name="tabFeed">
<attribute name="title">
<string>Feed</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_10">
<item>
<widget class="QGroupBox" name="notify_ForumNewMsg">
<property name="title">
<string>News Feed</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>6</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QPushButton" name="pushButtonDisableAll">
<property name="toolTip">
<string>Disable All Toaster temporarily</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>
<layout class="QVBoxLayout">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<layout class="QVBoxLayout" name="verticalLayout_8">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QCheckBox" name="popup_Connect">
<widget class="QCheckBox" name="notify_Peers">
<property name="text">
<string>Friend Connect</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="popup_NewMsg">
<widget class="QCheckBox" name="notify_Channels">
<property name="text">
<string>New Message</string>
<string>Channels</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="popup_DownloadFinished">
<widget class="QCheckBox" name="notify_Forums">
<property name="text">
<string>Download completed</string>
<string>Forums</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="popup_PrivateChat">
<widget class="QCheckBox" name="notify_Posted">
<property name="text">
<string>Private Chat</string>
<string>Posted</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="popup_GroupChat">
<widget class="QCheckBox" name="notify_Blogs">
<property name="text">
<string>Group Chat</string>
<string>Blogs</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="popup_ChatLobby">
<widget class="QCheckBox" name="notify_Messages">
<property name="text">
<string>Chat Lobby</string>
<string>Messages</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="popup_ConnectAttempt">
<widget class="QCheckBox" name="notify_Chat">
<property name="text">
<string>Connect attempt</string>
<string>Chat</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="notify_Security">
<property name="text">
<string>Security</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="feedLayout"/>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_9">
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<widget class="QPushButton" name="toasterButton">
<widget class="QPushButton" name="notifyButton">
<property name="text">
<string>Test</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@ -265,126 +121,347 @@
</layout>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QLabel" name="labelToasterPosition">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="messageGroupBox">
<property name="title">
<string>Message</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QCheckBox" name="message_ConnectAttempt">
<property name="text">
<string>Position</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
<widget class="QComboBox" name="comboBoxToasterPosition">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelToasterXMargin">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>X Margin</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="spinBoxToasterXMargin">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>20</number>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="labelToasterYMargin">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Y Margin</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QSpinBox" name="spinBoxToasterYMargin">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>20</number>
<string>Connect attempt</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Systray message</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QCheckBox" name="systray_GroupChat">
<property name="text">
<string>Group chat</string>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabToasters">
<attribute name="title">
<string>Toasters</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_11">
<item>
<widget class="QPushButton" name="pushButtonDisableAll">
<property name="toolTip">
<string>Disable All Toaster temporarily</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>
<layout class="QVBoxLayout">
<property name="leftMargin">
<number>9</number>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="systray_ChatLobby">
<property name="text">
<string>Chat lobbies</string>
<property name="topMargin">
<number>9</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<widget class="QCheckBox" name="popup_Connect">
<property name="text">
<string>Friend Connect</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="popup_NewMsg">
<property name="text">
<string>New Message</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="popup_DownloadFinished">
<property name="text">
<string>Download completed</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="popup_PrivateChat">
<property name="text">
<string>Private Chat</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="popup_GroupChat">
<property name="text">
<string>Group Chat</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="popup_ChatLobby">
<property name="text">
<string>Chat Lobby</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="popup_ConnectAttempt">
<property name="text">
<string>Connect attempt</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_9">
<item>
<widget class="QPushButton" name="toasterButton">
<property name="text">
<string>Test</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QLabel" name="labelToasterPosition">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Position</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
<widget class="QComboBox" name="comboBoxToasterPosition">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelToasterXMargin">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>X Margin</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="spinBoxToasterXMargin">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>20</number>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="labelToasterYMargin">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Y Margin</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QSpinBox" name="spinBoxToasterYMargin">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>20</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabSystray">
<attribute name="title">
<string>Systray</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_12">
<item>
<widget class="QGroupBox" name="trayNotifyGroupBox">
<property name="title">
<string>Systray Icon</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<layout class="QGridLayout" name="notifyLayout"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Systray message</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QCheckBox" name="systray_GroupChat">
<property name="text">
<string>Group chat</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="systray_ChatLobby">
<property name="text">
<string>Chat lobbies</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabChatLobbies">
<attribute name="title">
<string>Chat Lobbies</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_13">
<item>
<widget class="QCheckBox" name="chatLobbies_CountUnRead">
<property name="text">
<string>Count all unread messages</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chatLobbies_CheckNickName">
<property name="text">
<string>Count occurences of my current nickname</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chatLobbies_CountFollowingText">
<property name="text">
<string>Count occurences of any of the following texts (separate by newlines):</string>
</property>
</widget>
</item>
<item>
<widget class="QPlainTextEdit" name="chatLobbies_TextToNotify"/>
</item>
<item>
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>

View File

@ -496,6 +496,16 @@ void RshareSettings::setChatSendMessageWithCtrlReturn(bool bValue)
setValueToGroup("Chat", "SendMessageWithCtrlReturn", bValue);
}
bool RshareSettings::getChatSearchShowBarByDefault()
{
return valueFromGroup("Chat", "SearchShowBarByDefault", false).toBool();
}
void RshareSettings::setChatSearchShowBarByDefault(bool bValue)
{
setValueToGroup("Chat", "SearchShowBarByDefault", bValue);
}
void RshareSettings::setChatSearchCharToStartSearch(int iValue)
{
setValueToGroup("Chat", "SearchCharToStartSearch", iValue);

View File

@ -202,6 +202,9 @@ public:
bool getChatSendMessageWithCtrlReturn();
void setChatSendMessageWithCtrlReturn(bool bValue);
bool getChatSearchShowBarByDefault();
void setChatSearchShowBarByDefault(bool bValue);
void setChatSearchCharToStartSearch(int iValue);
int getChatSearchCharToStartSearch();