mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Added NewsFeed / Popup / Chat Configuration options.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@870 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
52012e8fe9
commit
c05acf2f95
@ -120,6 +120,7 @@ HEADERS += rshare.h \
|
||||
gui/Preferences/GeneralDialog.h \
|
||||
gui/Preferences/PreferencesWindow.h \
|
||||
gui/Preferences/ServerDialog.h \
|
||||
gui/Preferences/NotifyDialog.h \
|
||||
gui/Preferences/ConfirmQuitDialog.h \
|
||||
gui/Preferences/rsharesettings.h \
|
||||
gui/Preferences/rsettings.h \
|
||||
@ -223,6 +224,7 @@ FORMS += gui/ChatDialog.ui \
|
||||
gui/Preferences/GeneralDialog.ui \
|
||||
gui/Preferences/PreferencesWindow.ui \
|
||||
gui/Preferences/ServerDialog.ui \
|
||||
gui/Preferences/NotifyDialog.ui \
|
||||
gui/Preferences/ConfirmQuitDialog.ui \
|
||||
gui/toaster/CallToaster.ui \
|
||||
gui/toaster/ChatToaster.ui \
|
||||
@ -331,6 +333,7 @@ SOURCES += main.cpp \
|
||||
gui/Preferences/GeneralDialog.cpp \
|
||||
gui/Preferences/PreferencesWindow.cpp \
|
||||
gui/Preferences/ServerDialog.cpp \
|
||||
gui/Preferences/NotifyDialog.cpp \
|
||||
gui/Preferences/ConfirmQuitDialog.cpp \
|
||||
gui/Preferences/rsharesettings.cpp \
|
||||
gui/Preferences/rsettings.cpp \
|
||||
|
@ -26,13 +26,14 @@
|
||||
#include "rsiface/rsiface.h"
|
||||
#include "rsiface/rspeers.h"
|
||||
#include "rsiface/rsmsgs.h"
|
||||
#include "rsiface/rsnotify.h"
|
||||
|
||||
#include "chat/PopupChatDialog.h"
|
||||
#include <sstream>
|
||||
|
||||
#include <QTextCodec>
|
||||
#include <QTextEdit>
|
||||
#include <QTextCursor>
|
||||
#include <QTextCodec>
|
||||
#include <QTextEdit>
|
||||
#include <QTextCursor>
|
||||
#include <QTextList>
|
||||
#include <QTextStream>
|
||||
#include <QTextDocumentFragment>
|
||||
@ -137,20 +138,27 @@ void ChatDialog::insertChat()
|
||||
return;
|
||||
}
|
||||
|
||||
QTextEdit *msgWidget = ui.msgText;
|
||||
QTextEdit *msgWidget = ui.msgText;
|
||||
std::list<ChatInfo>::iterator it;
|
||||
|
||||
|
||||
/** A RshareSettings object used for saving/loading settings */
|
||||
RshareSettings settings;
|
||||
uint chatflags = settings.getChatFlags();
|
||||
|
||||
/* add in lines at the bottom */
|
||||
for(it = newchat.begin(); it != newchat.end(); it++)
|
||||
{
|
||||
std::string msg(it->msg.begin(), it->msg.end());
|
||||
//std::cerr << "ChatDialog::insertChat(): " << msg << std::endl;
|
||||
std::cerr << "ChatDialog::insertChat(): " << msg << std::endl;
|
||||
|
||||
/* are they private? */
|
||||
if (it->chatflags & RS_CHAT_PRIVATE)
|
||||
{
|
||||
PopupChatDialog *pcd = getPrivateChat(it->rsid, it->name, true);
|
||||
std::cerr << "ChatDialog::insert(Private)Chat(): ";
|
||||
std::cerr << "Flags(" << chatflags << ") " << msg << std::endl;
|
||||
|
||||
PopupChatDialog *pcd = getPrivateChat(it->rsid, it->name, chatflags);
|
||||
pcd->addChatMsg(&(*it));
|
||||
continue;
|
||||
}
|
||||
@ -322,10 +330,19 @@ void ChatDialog::privchat()
|
||||
|
||||
|
||||
|
||||
PopupChatDialog *ChatDialog::getPrivateChat(std::string id, std::string name, bool show)
|
||||
PopupChatDialog *ChatDialog::getPrivateChat(std::string id, std::string name, uint chatflags)
|
||||
{
|
||||
/* see if it exists already */
|
||||
PopupChatDialog *popupchatdialog = NULL;
|
||||
bool show = false;
|
||||
|
||||
if (chatflags & RS_CHAT_REOPEN)
|
||||
{
|
||||
show = true;
|
||||
std::cerr << "reopen flag so: enable SHOW popupchatdialog()";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
|
||||
std::map<std::string, PopupChatDialog *>::iterator it;
|
||||
if (chatDialogs.end() != (it = chatDialogs.find(id)))
|
||||
@ -337,15 +354,49 @@ PopupChatDialog *ChatDialog::getPrivateChat(std::string id, std::string name, bo
|
||||
{
|
||||
popupchatdialog = new PopupChatDialog(id, name);
|
||||
chatDialogs[id] = popupchatdialog;
|
||||
|
||||
if (chatflags & RS_CHAT_OPEN_NEW)
|
||||
{
|
||||
std::cerr << "new chat so: enable SHOW popupchatdialog()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
show = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (show)
|
||||
{
|
||||
popupchatdialog->show();
|
||||
std::cerr << "SHOWING popupchatdialog()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
popupchatdialog->show();
|
||||
}
|
||||
|
||||
return popupchatdialog;
|
||||
/* now only do these if the window is visible */
|
||||
if (popupchatdialog->isVisible())
|
||||
{
|
||||
if (chatflags & RS_CHAT_FOCUS)
|
||||
{
|
||||
std::cerr << "focus chat flag so: GETFOCUS popupchatdialog()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
popupchatdialog->getfocus();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "no focus chat flag so: FLASH popupchatdialog()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
popupchatdialog->flash();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "not visible ... so leave popupchatdialog()";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
return popupchatdialog;
|
||||
}
|
||||
|
||||
void ChatDialog::clearOldChats()
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
ChatDialog(QWidget *parent = 0);
|
||||
/** Default Destructor */
|
||||
|
||||
PopupChatDialog *getPrivateChat(std::string id, std::string name, bool show);
|
||||
PopupChatDialog *getPrivateChat(std::string id, std::string name, uint chatflags);
|
||||
void clearOldChats();
|
||||
|
||||
void loadEmoticonsgroupchat();
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "feeds/BlogMsgItem.h"
|
||||
#include "feeds/MsgItem.h"
|
||||
|
||||
#include "Preferences/rsharesettings.h"
|
||||
|
||||
#include "GeneralMsgDialog.h"
|
||||
|
||||
@ -89,12 +90,15 @@ NewsFeed::NewsFeed(QWidget *parent)
|
||||
|
||||
|
||||
|
||||
|
||||
void NewsFeed::updateFeed()
|
||||
{
|
||||
if (!rsNotify)
|
||||
return;
|
||||
|
||||
/** A RshareSettings object used for saving/loading settings */
|
||||
RshareSettings settings;
|
||||
uint flags = settings.getNewsFeedFlags();
|
||||
|
||||
/* check for new messages */
|
||||
RsFeedItem fi;
|
||||
if (rsNotify->GetFeedItem(fi))
|
||||
@ -102,49 +106,63 @@ void NewsFeed::updateFeed()
|
||||
switch(fi.mType)
|
||||
{
|
||||
case RS_FEED_ITEM_PEER_CONNECT:
|
||||
addFeedItemPeerConnect(fi);
|
||||
if (flags & RS_FEED_TYPE_PEER)
|
||||
addFeedItemPeerConnect(fi);
|
||||
break;
|
||||
case RS_FEED_ITEM_PEER_DISCONNECT:
|
||||
addFeedItemPeerDisconnect(fi);
|
||||
if (flags & RS_FEED_TYPE_PEER)
|
||||
addFeedItemPeerDisconnect(fi);
|
||||
break;
|
||||
case RS_FEED_ITEM_PEER_NEW:
|
||||
addFeedItemPeerNew(fi);
|
||||
if (flags & RS_FEED_TYPE_PEER)
|
||||
addFeedItemPeerNew(fi);
|
||||
break;
|
||||
case RS_FEED_ITEM_PEER_HELLO:
|
||||
addFeedItemPeerHello(fi);
|
||||
if (flags & RS_FEED_TYPE_PEER)
|
||||
addFeedItemPeerHello(fi);
|
||||
break;
|
||||
|
||||
case RS_FEED_ITEM_CHAN_NEW:
|
||||
addFeedItemChanNew(fi);
|
||||
if (flags & RS_FEED_TYPE_CHAN)
|
||||
addFeedItemChanNew(fi);
|
||||
break;
|
||||
case RS_FEED_ITEM_CHAN_UPDATE:
|
||||
addFeedItemChanUpdate(fi);
|
||||
if (flags & RS_FEED_TYPE_CHAN)
|
||||
addFeedItemChanUpdate(fi);
|
||||
break;
|
||||
case RS_FEED_ITEM_CHAN_MSG:
|
||||
addFeedItemChanMsg(fi);
|
||||
if (flags & RS_FEED_TYPE_CHAN)
|
||||
addFeedItemChanMsg(fi);
|
||||
break;
|
||||
|
||||
case RS_FEED_ITEM_FORUM_NEW:
|
||||
addFeedItemForumNew(fi);
|
||||
if (flags & RS_FEED_TYPE_FORUM)
|
||||
addFeedItemForumNew(fi);
|
||||
break;
|
||||
case RS_FEED_ITEM_FORUM_UPDATE:
|
||||
addFeedItemForumUpdate(fi);
|
||||
if (flags & RS_FEED_TYPE_FORUM)
|
||||
addFeedItemForumUpdate(fi);
|
||||
break;
|
||||
case RS_FEED_ITEM_FORUM_MSG:
|
||||
addFeedItemForumMsg(fi);
|
||||
if (flags & RS_FEED_TYPE_FORUM)
|
||||
addFeedItemForumMsg(fi);
|
||||
break;
|
||||
|
||||
case RS_FEED_ITEM_BLOG_MSG:
|
||||
addFeedItemBlogMsg(fi);
|
||||
if (flags & RS_FEED_TYPE_BLOG)
|
||||
addFeedItemBlogMsg(fi);
|
||||
break;
|
||||
case RS_FEED_ITEM_CHAT_NEW:
|
||||
addFeedItemChatNew(fi);
|
||||
if (flags & RS_FEED_TYPE_CHAT)
|
||||
addFeedItemChatNew(fi);
|
||||
break;
|
||||
case RS_FEED_ITEM_MESSAGE:
|
||||
addFeedItemMessage(fi);
|
||||
if (flags & RS_FEED_TYPE_MSG)
|
||||
addFeedItemMessage(fi);
|
||||
break;
|
||||
case RS_FEED_ITEM_FILES_NEW:
|
||||
addFeedItemFilesNew(fi);
|
||||
if (flags & RS_FEED_TYPE_FILES)
|
||||
addFeedItemFilesNew(fi);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -29,12 +29,15 @@
|
||||
#include "rsiface/rspeers.h"
|
||||
#include "rsiface/rsstatus.h"
|
||||
#include "rsiface/rsmsgs.h"
|
||||
#include "rsiface/rsnotify.h"
|
||||
|
||||
#include "chat/PopupChatDialog.h"
|
||||
#include "msgs/ChanMsgDialog.h"
|
||||
#include "ChatDialog.h"
|
||||
#include "connect/ConfCertDialog.h"
|
||||
|
||||
#include "gui/Preferences/rsharesettings.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
@ -438,7 +441,7 @@ void PeersDialog::chatfriend()
|
||||
|
||||
if (detail.state & RS_PEER_STATE_CONNECTED)
|
||||
{
|
||||
getPrivateChat(id, name, true);
|
||||
getPrivateChat(id, name, RS_CHAT_REOPEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -647,6 +650,9 @@ void PeersDialog::insertChat()
|
||||
QTextEdit *msgWidget = ui.msgText;
|
||||
std::list<ChatInfo>::iterator it;
|
||||
|
||||
/** A RshareSettings object used for saving/loading settings */
|
||||
RshareSettings settings;
|
||||
uint chatflags = settings.getChatFlags();
|
||||
|
||||
/* add in lines at the bottom */
|
||||
for(it = newchat.begin(); it != newchat.end(); it++)
|
||||
@ -659,7 +665,7 @@ void PeersDialog::insertChat()
|
||||
/* are they private? */
|
||||
if (it->chatflags & RS_CHAT_PRIVATE)
|
||||
{
|
||||
PopupChatDialog *pcd = getPrivateChat(it->rsid, it->name, true);
|
||||
PopupChatDialog *pcd = getPrivateChat(it->rsid, it->name, chatflags);
|
||||
pcd->addChatMsg(&(*it));
|
||||
continue;
|
||||
}
|
||||
@ -828,10 +834,19 @@ void PeersDialog::toggleSendItem( QTreeWidgetItem *item, int col )
|
||||
return;
|
||||
}
|
||||
|
||||
PopupChatDialog *PeersDialog::getPrivateChat(std::string id, std::string name, bool show)
|
||||
PopupChatDialog *PeersDialog::getPrivateChat(std::string id, std::string name, uint chatflags)
|
||||
{
|
||||
/* see if it exists already */
|
||||
PopupChatDialog *popupchatdialog = NULL;
|
||||
bool show = false;
|
||||
|
||||
if (chatflags & RS_CHAT_REOPEN)
|
||||
{
|
||||
show = true;
|
||||
std::cerr << "reopen flag so: enable SHOW popupchatdialog()";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
|
||||
std::map<std::string, PopupChatDialog *>::iterator it;
|
||||
if (chatDialogs.end() != (it = chatDialogs.find(id)))
|
||||
@ -843,17 +858,52 @@ PopupChatDialog *PeersDialog::getPrivateChat(std::string id, std::string name, b
|
||||
{
|
||||
popupchatdialog = new PopupChatDialog(id, name);
|
||||
chatDialogs[id] = popupchatdialog;
|
||||
|
||||
if (chatflags & RS_CHAT_OPEN_NEW)
|
||||
{
|
||||
std::cerr << "new chat so: enable SHOW popupchatdialog()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
show = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (show)
|
||||
{
|
||||
popupchatdialog->show();
|
||||
std::cerr << "SHOWING popupchatdialog()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
popupchatdialog->show();
|
||||
}
|
||||
|
||||
return popupchatdialog;
|
||||
/* now only do these if the window is visible */
|
||||
if (popupchatdialog->isVisible())
|
||||
{
|
||||
if (chatflags & RS_CHAT_FOCUS)
|
||||
{
|
||||
std::cerr << "focus chat flag so: GETFOCUS popupchatdialog()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
popupchatdialog->getfocus();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "no focus chat flag so: FLASH popupchatdialog()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
popupchatdialog->flash();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "not visible ... so leave popupchatdialog()";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
return popupchatdialog;
|
||||
}
|
||||
|
||||
|
||||
void PeersDialog::clearOldChats()
|
||||
{
|
||||
/* nothing yet */
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
PeersDialog(QWidget *parent = 0);
|
||||
/** Default Destructor */
|
||||
|
||||
PopupChatDialog *getPrivateChat(std::string id, std::string name, bool show);
|
||||
PopupChatDialog *getPrivateChat(std::string id, std::string name, uint chatflags);
|
||||
void clearOldChats();
|
||||
|
||||
void loadEmoticonsgroupchat();
|
||||
|
@ -63,6 +63,9 @@ PreferencesWindow::PreferencesWindow(QWidget *parent, Qt::WFlags flags)
|
||||
ui.stackPages->add(new AppearanceDialog(ui.stackPages),
|
||||
createPageAction(QIcon(IMAGE_APPEARRANCE), tr("Appearance"), grp));
|
||||
|
||||
ui.stackPages->add(new NotifyDialog(ui.stackPages),
|
||||
createPageAction(QIcon(IMAGE_APPEARRANCE), tr("Notify"), grp));
|
||||
|
||||
/*foreach (ConfigPage *page, ui.stackPages->pages()) {
|
||||
connect(page, SIGNAL(helpRequested(QString)),
|
||||
this, SLOT(help(QString)));
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "ServerDialog.h"
|
||||
#include "CryptographyDialog.h"
|
||||
#include "AppearanceDialog.h"
|
||||
#include "NotifyDialog.h"
|
||||
#include "gui/help/browser/helpbrowser.h"
|
||||
#include <gui/common/rwindow.h>
|
||||
|
||||
@ -46,7 +47,8 @@ public:
|
||||
General = 0, /** Preferences page. */
|
||||
Server, /** Server page. */
|
||||
Directories, /** Directories page. */
|
||||
Appearance /** Appearance page. */
|
||||
Appearance, /** Appearance page. */
|
||||
Notify /** Notify page. */
|
||||
|
||||
};
|
||||
|
||||
|
@ -30,6 +30,8 @@
|
||||
|
||||
#include "rsharesettings.h"
|
||||
|
||||
#include "rsiface/rsnotify.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QMainWindow>
|
||||
|
||||
@ -49,6 +51,10 @@
|
||||
#define SETTING_BWGRAPH_OPACITY "StatisticDialog/Opacity"
|
||||
#define SETTING_BWGRAPH_ALWAYS_ON_TOP "StatisticDialog/AlwaysOnTop"
|
||||
|
||||
#define SETTING_NEWSFEED_FLAGS "NewsFeedFlags"
|
||||
#define SETTING_CHAT_FLAGS "ChatFlags"
|
||||
#define SETTING_NOTIFY_FLAGS "NotifyFlags"
|
||||
|
||||
/* Default Retroshare Settings */
|
||||
#define DEFAULT_OPACITY 100
|
||||
|
||||
@ -87,6 +93,25 @@ RshareSettings::RshareSettings()
|
||||
setDefault(SETTING_LANGUAGE, LanguageSupport::defaultLanguageCode());
|
||||
setDefault(SETTING_SHEETNAME, true);
|
||||
setDefault(SETTING_SHOW_MAINWINDOW_AT_START, true);
|
||||
|
||||
/* defaults here are not ideal.... but dusent matter */
|
||||
|
||||
uint defChat = (RS_CHAT_OPEN_NEW |
|
||||
RS_CHAT_REOPEN );
|
||||
// This is not default... RS_CHAT_FOCUS.
|
||||
|
||||
uint defNotify = (RS_POPUP_CONNECT | RS_POPUP_MSG |
|
||||
RS_POPUP_CHAT | RS_POPUP_CALL);
|
||||
|
||||
uint defNewsFeed = (RS_FEED_TYPE_PEER | RS_FEED_TYPE_CHAN |
|
||||
RS_FEED_TYPE_FORUM | RS_FEED_TYPE_BLOG |
|
||||
RS_FEED_TYPE_CHAT | RS_FEED_TYPE_MSG |
|
||||
RS_FEED_TYPE_FILES);
|
||||
|
||||
setDefault(SETTING_NEWSFEED_FLAGS, defNewsFeed);
|
||||
setDefault(SETTING_CHAT_FLAGS, defChat);
|
||||
setDefault(SETTING_NOTIFY_FLAGS, defNotify);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -179,6 +204,37 @@ RshareSettings::setShowMainWindowAtStart(bool show)
|
||||
setValue(SETTING_SHOW_MAINWINDOW_AT_START, show);
|
||||
}
|
||||
|
||||
/** Setting for Notify / Chat and NewsFeeds **/
|
||||
uint RshareSettings::getNewsFeedFlags()
|
||||
{
|
||||
return value(SETTING_NEWSFEED_FLAGS).toUInt();
|
||||
}
|
||||
|
||||
void RshareSettings::setNewsFeedFlags(uint flags)
|
||||
{
|
||||
setValue(SETTING_NEWSFEED_FLAGS, flags);
|
||||
}
|
||||
|
||||
uint RshareSettings::getChatFlags()
|
||||
{
|
||||
return value(SETTING_CHAT_FLAGS).toUInt();
|
||||
}
|
||||
|
||||
void RshareSettings::setChatFlags(uint flags)
|
||||
{
|
||||
setValue(SETTING_CHAT_FLAGS, flags);
|
||||
}
|
||||
|
||||
uint RshareSettings::getNotifyFlags()
|
||||
{
|
||||
return value(SETTING_NOTIFY_FLAGS).toUInt();
|
||||
}
|
||||
|
||||
void RshareSettings::setNotifyFlags(uint flags)
|
||||
{
|
||||
setValue(SETTING_NOTIFY_FLAGS, flags);
|
||||
}
|
||||
|
||||
/** Returns true if Vidalia is set to run on system boot. */
|
||||
bool
|
||||
RshareSettings::runRetroshareOnBoot()
|
||||
|
@ -99,6 +99,15 @@ public:
|
||||
/** Sets whether the bandwidth graph is always on top. */
|
||||
void setBWGraphAlwaysOnTop(bool alwaysOnTop);
|
||||
|
||||
uint getNewsFeedFlags();
|
||||
void setNewsFeedFlags(uint flags);
|
||||
|
||||
uint getChatFlags();
|
||||
void setChatFlags(uint flags);
|
||||
|
||||
uint getNotifyFlags();
|
||||
void setNotifyFlags(uint flags);
|
||||
|
||||
|
||||
//! Save placement, state and size information of a window.
|
||||
void saveWidgetInformation(QWidget *widget);
|
||||
|
@ -129,21 +129,43 @@ PopupChatDialog::~PopupChatDialog()
|
||||
}
|
||||
|
||||
/**
|
||||
Overloads the default show() slot so we can set opacity*/
|
||||
|
||||
void PopupChatDialog::show()
|
||||
{
|
||||
|
||||
if(!this->isVisible()) {
|
||||
QMainWindow::show();
|
||||
Overloads the default show() slot so we can set opacity*/
|
||||
|
||||
void PopupChatDialog::show()
|
||||
{
|
||||
|
||||
if(!this->isVisible()) {
|
||||
QMainWindow::show();
|
||||
} else {
|
||||
QMainWindow::activateWindow();
|
||||
setWindowState(windowState() & ~Qt::WindowMinimized | Qt::WindowActive);
|
||||
QMainWindow::raise();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//QMainWindow::activateWindow();
|
||||
//setWindowState(windowState() & ~Qt::WindowMinimized | Qt::WindowActive);
|
||||
//QMainWindow::raise();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void PopupChatDialog::getfocus()
|
||||
{
|
||||
|
||||
QMainWindow::activateWindow();
|
||||
setWindowState(windowState() & ~Qt::WindowMinimized | Qt::WindowActive);
|
||||
QMainWindow::raise();
|
||||
}
|
||||
|
||||
void PopupChatDialog::flash()
|
||||
{
|
||||
|
||||
if(!this->isVisible()) {
|
||||
//QMainWindow::show();
|
||||
} else {
|
||||
// Want to reduce the interference on other applications.
|
||||
//QMainWindow::activateWindow();
|
||||
//setWindowState(windowState() & ~Qt::WindowMinimized | Qt::WindowActive);
|
||||
//QMainWindow::raise();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void PopupChatDialog::closeEvent (QCloseEvent * event)
|
||||
{
|
||||
hide();
|
||||
|
@ -59,6 +59,9 @@ public:
|
||||
public slots:
|
||||
/** Overloaded QWidget.show */
|
||||
void show();
|
||||
|
||||
void getfocus();
|
||||
void flash();
|
||||
|
||||
void smileyWidget();
|
||||
void addSmiley();
|
||||
|
@ -18,6 +18,8 @@
|
||||
#include "gui/toaster/ChatToaster.h"
|
||||
#include "gui/toaster/CallToaster.h"
|
||||
|
||||
#include "gui/Preferences/rsharesettings.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
@ -185,34 +187,41 @@ static time_t lastTs = 0;
|
||||
|
||||
if (rsNotify->NotifyPopupMessage(type, id, msg))
|
||||
{
|
||||
RshareSettings settings;
|
||||
uint popupflags = settings.getNotifyFlags();
|
||||
|
||||
/* id the name */
|
||||
std::string name = rsPeers->getPeerName(id);
|
||||
std::string realmsg = msg + "<strong>" + name + "</strong>";
|
||||
switch(type)
|
||||
{
|
||||
case RS_POPUP_MSG:
|
||||
if (popupflags & RS_POPUP_MSG)
|
||||
{
|
||||
MessageToaster * msgToaster = new MessageToaster();
|
||||
msgToaster->setMessage(QString::fromStdString(realmsg));
|
||||
msgToaster->show();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case RS_POPUP_CHAT:
|
||||
if (popupflags & RS_POPUP_CHAT)
|
||||
{
|
||||
ChatToaster * chatToaster = new ChatToaster();
|
||||
chatToaster->setMessage(QString::fromStdString(realmsg));
|
||||
chatToaster->show();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case RS_POPUP_CALL:
|
||||
if (popupflags & RS_POPUP_CALL)
|
||||
{
|
||||
CallToaster * callToaster = new CallToaster();
|
||||
callToaster->setMessage(QString::fromStdString(realmsg));
|
||||
callToaster->show();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
case RS_POPUP_CONNECT:
|
||||
if (popupflags & RS_POPUP_CONNECT)
|
||||
{
|
||||
OnlineToaster * onlineToaster = new OnlineToaster();
|
||||
onlineToaster->setMessage(QString::fromStdString(realmsg));
|
||||
|
@ -45,7 +45,12 @@ const uint32_t RS_POPUP_CHAT = 0x0002;
|
||||
const uint32_t RS_POPUP_CALL = 0x0004;
|
||||
const uint32_t RS_POPUP_CONNECT = 0x0008;
|
||||
|
||||
|
||||
/* 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_NEW = 0x0001;
|
||||
const uint32_t RS_CHAT_REOPEN = 0x0002;
|
||||
const uint32_t RS_CHAT_FOCUS = 0x0004;
|
||||
|
||||
const uint32_t RS_FEED_TYPE_PEER = 0x0010;
|
||||
const uint32_t RS_FEED_TYPE_CHAN = 0x0020;
|
||||
|
Loading…
Reference in New Issue
Block a user