removed all left rsnotify elements and moved uint32 flags to proper enum classes

This commit is contained in:
csoler 2025-10-07 21:13:24 +02:00
parent 116c7f1aec
commit ff68c770d8
37 changed files with 360 additions and 235 deletions

View file

@ -684,7 +684,7 @@ void ChatLobbyWidget::updateDisplay()
if (autoSubscribe && subscribed && _lobby_infos.find(lobby.lobby_id) == _lobby_infos.end()) if (autoSubscribe && subscribed && _lobby_infos.find(lobby.lobby_id) == _lobby_infos.end())
{ {
ChatDialog *cd = ChatDialog::getChat(ChatId(lobby.lobby_id), RS_CHAT_OPEN); ChatDialog *cd = ChatDialog::getChat(ChatId(lobby.lobby_id), RsChatFlags::RS_CHAT_OPEN);
addChatPage(dynamic_cast<ChatLobbyDialog*>(cd)); addChatPage(dynamic_cast<ChatLobbyDialog*>(cd));
} }
@ -787,7 +787,7 @@ void ChatLobbyWidget::showLobby(QTreeWidgetItem *item)
showBlankPage(id) ; showBlankPage(id) ;
else else
{ {
_lobby_infos[id].dialog->showDialog(RS_CHAT_FOCUS); _lobby_infos[id].dialog->showDialog(RsChatFlags::RS_CHAT_FOCUS);
if (_lobby_infos[id].dialog->isWindowed()) if (_lobby_infos[id].dialog->isWindowed())
showBlankPage(id, true); showBlankPage(id, true);
} }
@ -850,7 +850,7 @@ bool ChatLobbyWidget::showLobbyAnchor(ChatLobbyId id, QString anchor)
if(_lobby_infos.find(id) == _lobby_infos.end()) { if(_lobby_infos.find(id) == _lobby_infos.end()) {
showBlankPage(id) ; showBlankPage(id) ;
} else { } else {
_lobby_infos[id].dialog->showDialog(RS_CHAT_FOCUS); _lobby_infos[id].dialog->showDialog(RsChatFlags::RS_CHAT_FOCUS);
if (_lobby_infos[id].dialog->isWindowed()) if (_lobby_infos[id].dialog->isWindowed())
showBlankPage(id, true); showBlankPage(id, true);

View file

@ -643,7 +643,7 @@ void GenCertDialog::genPerson()
std::cout << "RsAccounts::GenerateSSLCertificate" << std::endl; std::cout << "RsAccounts::GenerateSSLCertificate" << std::endl;
// now cache the PGP password so that it's not asked again for immediately signing the key // now cache the PGP password so that it's not asked again for immediately signing the key
rsNotify->cachePgpPassphrase(ui.password_input->text().toUtf8().constData()) ; rsLoginHelper->cachePgpPassphrase(ui.password_input->text().toUtf8().constData()) ;
bool okGen = RsAccounts::createNewAccount(PGPId, "", genLoc, "", isHiddenLoc, isAutoTor, sslPasswd, sslId, err); bool okGen = RsAccounts::createNewAccount(PGPId, "", genLoc, "", isHiddenLoc, isAutoTor, sslPasswd, sslId, err);

View file

@ -192,27 +192,27 @@ void NewsFeed::handleEvent(std::shared_ptr<const RsEvent> event)
void NewsFeed::handleEvent_main_thread(std::shared_ptr<const RsEvent> event) void NewsFeed::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
{ {
uint flags = Settings->getNewsFeedFlags(); RsFeedTypeFlags flags = (RsFeedTypeFlags)Settings->getNewsFeedFlags();
if(event->mType == RsEventType::AUTHSSL_CONNECTION_AUTENTICATION && (flags & RS_FEED_TYPE_SECURITY)) if(event->mType == RsEventType::AUTHSSL_CONNECTION_AUTENTICATION && (!!(flags & RsFeedTypeFlags::RS_FEED_TYPE_SECURITY)))
handleSecurityEvent(event); handleSecurityEvent(event);
if(event->mType == RsEventType::FRIEND_LIST && (flags & RS_FEED_TYPE_PEER)) if(event->mType == RsEventType::FRIEND_LIST && (!!(flags & RsFeedTypeFlags::RS_FEED_TYPE_PEER)))
handleConnectionEvent(event); handleConnectionEvent(event);
if(event->mType == RsEventType::GXS_CIRCLES && (flags & RS_FEED_TYPE_CIRCLE)) if(event->mType == RsEventType::GXS_CIRCLES && (!!(flags & RsFeedTypeFlags::RS_FEED_TYPE_CIRCLE)))
handleCircleEvent(event); handleCircleEvent(event);
if(event->mType == RsEventType::GXS_CHANNELS && (flags & RS_FEED_TYPE_CHANNEL)) if(event->mType == RsEventType::GXS_CHANNELS && (!!(flags & RsFeedTypeFlags::RS_FEED_TYPE_CHANNEL)))
handleChannelEvent(event); handleChannelEvent(event);
if(event->mType == RsEventType::GXS_FORUMS && (flags & RS_FEED_TYPE_FORUM)) if(event->mType == RsEventType::GXS_FORUMS && (!!(flags & RsFeedTypeFlags::RS_FEED_TYPE_FORUM)))
handleForumEvent(event); handleForumEvent(event);
if(event->mType == RsEventType::GXS_POSTED && (flags & RS_FEED_TYPE_POSTED)) if(event->mType == RsEventType::GXS_POSTED && (!!(flags & RsFeedTypeFlags::RS_FEED_TYPE_POSTED)))
handlePostedEvent(event); handlePostedEvent(event);
if(event->mType == RsEventType::MAIL_STATUS && (flags & RS_FEED_TYPE_MSG)) if(event->mType == RsEventType::MAIL_STATUS && (!!(flags & RsFeedTypeFlags::RS_FEED_TYPE_MSG)))
handleMailEvent(event); handleMailEvent(event);
} }
@ -389,25 +389,25 @@ void NewsFeed::handleCircleEvent(std::shared_ptr<const RsEvent> event)
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_REQUEST: case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_REQUEST:
// only show membership requests if we're an admin of that circle // only show membership requests if we're an admin of that circle
if(details.isIdInInviteeList(pe->mGxsId)) if(details.isIdInInviteeList(pe->mGxsId))
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RS_FEED_ITEM_CIRCLE_MEMB_JOIN),true); addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_JOIN),true);
else if(details.mAmIAdmin) else if(details.mAmIAdmin)
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RS_FEED_ITEM_CIRCLE_MEMB_REQ),true); addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_REQ),true);
break; break;
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_LEAVE: case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_LEAVE:
if(details.isIdInInviteeList(pe->mGxsId)) if(details.isIdInInviteeList(pe->mGxsId))
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RS_FEED_ITEM_CIRCLE_MEMB_LEAVE),true); addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_LEAVE),true);
break; break;
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_ID_ADDED_TO_INVITEE_LIST: case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_ID_ADDED_TO_INVITEE_LIST:
if(rsIdentity->isOwnId(pe->mGxsId)) if(rsIdentity->isOwnId(pe->mGxsId))
{ {
if(details.isIdRequestingMembership(pe->mGxsId)) if(details.isIdRequestingMembership(pe->mGxsId))
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RS_FEED_ITEM_CIRCLE_MEMB_ACCEPTED),true); addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_ACCEPTED),true);
else else
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RS_FEED_ITEM_CIRCLE_INVITE_REC),true); addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_INVITE_REC),true);
} }
break; break;
@ -415,9 +415,9 @@ void NewsFeed::handleCircleEvent(std::shared_ptr<const RsEvent> event)
if(rsIdentity->isOwnId(pe->mGxsId)) if(rsIdentity->isOwnId(pe->mGxsId))
{ {
if(details.isIdRequestingMembership(pe->mGxsId)) if(details.isIdRequestingMembership(pe->mGxsId))
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RS_FEED_ITEM_CIRCLE_MEMB_REVOKED),true); addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_REVOKED),true);
else else
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RS_FEED_ITEM_CIRCLE_INVITE_CANCELLED),true); addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_INVITE_CANCELLED),true);
} }
break; break;
@ -451,7 +451,7 @@ void NewsFeed::handleConnectionEvent(std::shared_ptr<const RsEvent> event)
addFeedItemIfUnique(new SecurityIpItem( addFeedItemIfUnique(new SecurityIpItem(
this, e.mSslId, e.mOwnLocator.toString(), this, e.mSslId, e.mOwnLocator.toString(),
e.mReportedLocator.toString(), e.mReportedLocator.toString(),
RS_FEED_ITEM_SEC_IP_WRONG_EXTERNAL_IP_REPORTED, RsFeedTypeFlags::RS_FEED_ITEM_SEC_IP_WRONG_EXTERNAL_IP_REPORTED,
false ), false); false ), false);
break; break;
default: break; default: break;
@ -469,31 +469,31 @@ void NewsFeed::handleSecurityEvent(std::shared_ptr<const RsEvent> event)
#ifdef NEWS_DEBUG #ifdef NEWS_DEBUG
std::cerr << "NotifyQt: handling security event from (" << e.mSslId << "," << e.mPgpId << ") error code: " << (int)e.mErrorCode << std::endl; std::cerr << "NotifyQt: handling security event from (" << e.mSslId << "," << e.mPgpId << ") error code: " << (int)e.mErrorCode << std::endl;
#endif #endif
uint flags = Settings->getNewsFeedFlags(); RsFeedTypeFlags flags = (RsFeedTypeFlags)Settings->getNewsFeedFlags();
if(e.mErrorCode == RsAuthSslError::PEER_REFUSED_CONNECTION && (flags & RS_FEED_TYPE_SECURITY_IP)) if(e.mErrorCode == RsAuthSslError::PEER_REFUSED_CONNECTION && (!!(flags & RsFeedTypeFlags::RS_FEED_TYPE_SECURITY_IP)))
{ {
addFeedItemIfUnique(new PeerItem(this, NEWSFEED_PEERLIST, e.mSslId, PEER_TYPE_HELLO, false), true ); addFeedItemIfUnique(new PeerItem(this, NEWSFEED_PEERLIST, e.mSslId, PEER_TYPE_HELLO, false), true );
return; return;
} }
uint32_t FeedItemType=0; RsFeedTypeFlags FeedItemType(RsFeedTypeFlags::RS_FEED_TYPE_NONE);
switch(e.mErrorCode) switch(e.mErrorCode)
{ {
case RsAuthSslError::NO_CERTIFICATE_SUPPLIED: // fallthrough case RsAuthSslError::NO_CERTIFICATE_SUPPLIED: // fallthrough
case RsAuthSslError::MISMATCHED_PGP_ID: // fallthrough case RsAuthSslError::MISMATCHED_PGP_ID: // fallthrough
case RsAuthSslError::MISSING_AUTHENTICATION_INFO: case RsAuthSslError::MISSING_AUTHENTICATION_INFO:
FeedItemType = RS_FEED_ITEM_SEC_BAD_CERTIFICATE; break; FeedItemType = RsFeedTypeFlags::RS_FEED_ITEM_SEC_BAD_CERTIFICATE; break;
case RsAuthSslError::PGP_SIGNATURE_VALIDATION_FAILED: case RsAuthSslError::PGP_SIGNATURE_VALIDATION_FAILED:
FeedItemType = RS_FEED_ITEM_SEC_WRONG_SIGNATURE; break; FeedItemType = RsFeedTypeFlags::RS_FEED_ITEM_SEC_WRONG_SIGNATURE; break;
case RsAuthSslError::NOT_A_FRIEND: case RsAuthSslError::NOT_A_FRIEND:
FeedItemType = RS_FEED_ITEM_SEC_CONNECT_ATTEMPT; break; FeedItemType = RsFeedTypeFlags::RS_FEED_ITEM_SEC_CONNECT_ATTEMPT; break;
case RsAuthSslError::IP_IS_BLACKLISTED: case RsAuthSslError::IP_IS_BLACKLISTED:
FeedItemType = RS_FEED_ITEM_SEC_IP_BLACKLISTED; break; FeedItemType = RsFeedTypeFlags::RS_FEED_ITEM_SEC_IP_BLACKLISTED; break;
case RsAuthSslError::MISSING_CERTIFICATE: case RsAuthSslError::MISSING_CERTIFICATE:
FeedItemType = RS_FEED_ITEM_SEC_MISSING_CERTIFICATE; break; FeedItemType = RsFeedTypeFlags::RS_FEED_ITEM_SEC_MISSING_CERTIFICATE; break;
default: default:
return; // display nothing return; // display nothing
} }
@ -503,11 +503,11 @@ void NewsFeed::handleSecurityEvent(std::shared_ptr<const RsEvent> event)
addFeedItemIfUnique(new SecurityItem(this, NEWSFEED_SECLIST, e.mPgpId, e.mSslId, det.location, e.mLocator.toString(), FeedItemType, false), true ); addFeedItemIfUnique(new SecurityItem(this, NEWSFEED_SECLIST, e.mPgpId, e.mSslId, det.location, e.mLocator.toString(), FeedItemType, false), true );
if (Settings->getMessageFlags() & RS_MESSAGE_CONNECT_ATTEMPT) if (Settings->getMessageFlags() & RshareSettings::RS_MESSAGE_CONNECT_ATTEMPT)
MessageComposer::addConnectAttemptMsg(e.mPgpId, e.mSslId, QString::fromStdString(det.name + "(" + det.location + ")")); MessageComposer::addConnectAttemptMsg(e.mPgpId, e.mSslId, QString::fromStdString(det.name + "(" + det.location + ")"));
} }
void NewsFeed::testFeeds(uint /*notifyFlags*/) void NewsFeed::testFeeds(RsFeedTypeFlags /*notifyFlags*/)
{ {
#ifdef TO_REMOVE #ifdef TO_REMOVE
if (!instance) { if (!instance) {

View file

@ -24,6 +24,7 @@
#include <retroshare-gui/mainpage.h> #include <retroshare-gui/mainpage.h>
#include "gui/feeds/FeedHolder.h" #include "gui/feeds/FeedHolder.h"
#include "gui/feeds/FeedItem.h"
#include <retroshare-gui/RsAutoUpdatePage.h> #include <retroshare-gui/RsAutoUpdatePage.h>
#define IMAGE_NEWSFEED ":/icons/png/newsfeed.png" #define IMAGE_NEWSFEED ":/icons/png/newsfeed.png"
@ -67,19 +68,19 @@ public:
/** Default Destructor */ /** Default Destructor */
virtual ~NewsFeed(); virtual ~NewsFeed();
virtual QIcon iconPixmap() const { return QIcon(IMAGE_NEWSFEED) ; } //MainPage virtual QIcon iconPixmap() const override { return QIcon(IMAGE_NEWSFEED) ; } //MainPage
virtual QString pageName() const { return tr("Activity") ; } //MainPage virtual QString pageName() const override { return tr("Activity") ; } //MainPage
virtual QString helpText() const { return ""; } //MainPage virtual QString helpText() const override { return ""; } //MainPage
virtual UserNotify *createUserNotify(QObject *parent) override; virtual UserNotify *createUserNotify(QObject *parent) override;
/* FeedHolder Functions (for FeedItem functionality) */ /* FeedHolder Functions (for FeedItem functionality) */
virtual QScrollArea *getScrollArea(); virtual QScrollArea *getScrollArea()override ;
virtual void deleteFeedItem(FeedItem *item, uint32_t type); virtual void deleteFeedItem(FeedItem *item, uint32_t type)override ;
virtual void openChat(const RsPeerId& peerId); virtual void openChat(const RsPeerId& peerId)override ;
virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const QVector<RsGxsMessageId> &versions, const RsGxsMessageId &msgId, const QString &title); virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const QVector<RsGxsMessageId> &versions, const RsGxsMessageId &msgId, const QString &title)override ;
static void testFeeds(uint notifyFlags); static void testFeeds(RsFeedTypeFlags notifyFlags);
static void testFeed(FeedNotify *feedNotify); static void testFeed(FeedNotify *feedNotify);
void handleEvent(std::shared_ptr<const RsEvent> event); // get events from libretroshare void handleEvent(std::shared_ptr<const RsEvent> event); // get events from libretroshare

View file

@ -1758,7 +1758,7 @@ static void processList(const QStringList &list, const QString &textSingular, co
} }
else else
{ {
ChatDialog* chatDialog = ChatDialog::getChat(chatId, Settings->getChatFlags()); ChatDialog* chatDialog = ChatDialog::getChat(chatId, (RsChatFlags)Settings->getChatFlags());
if (chatDialog) { if (chatDialog) {
chatroomFound.append(link.name()); chatroomFound.append(link.name());
} else { } else {

View file

@ -86,7 +86,7 @@ void ChatDialog::init(const ChatId &id, const QString &title)
return NULL; return NULL;
} }
/*static*/ ChatDialog* ChatDialog::getChat(ChatId id, uint chatflags) /*static*/ ChatDialog* ChatDialog::getChat(ChatId id, RsChatFlags chatflags)
{ {
if(id.isBroadcast() || id.isNotSet()) if(id.isBroadcast() || id.isNotSet())
return NULL; // broadcast is not handled by a chat dialog return NULL; // broadcast is not handled by a chat dialog
@ -97,9 +97,9 @@ void ChatDialog::init(const ChatId &id, const QString &title)
if (cd == NULL) { if (cd == NULL) {
if(id.isDistantChatId()) if(id.isDistantChatId())
chatflags = RS_CHAT_OPEN | RS_CHAT_FOCUS; // force open for distant chat chatflags = RsChatFlags::RS_CHAT_OPEN | RsChatFlags::RS_CHAT_FOCUS; // force open for distant chat
if (chatflags & RS_CHAT_OPEN) { if (!!(chatflags & RsChatFlags::RS_CHAT_OPEN)) {
if (id.isLobbyId()) { if (id.isLobbyId()) {
ChatLobbyDialog* cld = new ChatLobbyDialog(id.toLobbyId()); ChatLobbyDialog* cld = new ChatLobbyDialog(id.toLobbyId());
cld->init(ChatId(), ""); cld->init(ChatId(), "");
@ -176,7 +176,7 @@ void ChatDialog::init(const ChatId &id, const QString &title)
// play sound when recv a message // play sound when recv a message
SoundManager::play(SOUND_NEW_CHAT_MESSAGE); SoundManager::play(SOUND_NEW_CHAT_MESSAGE);
ChatDialog *cd = getChat(msg.chat_id, Settings->getChatFlags()); ChatDialog *cd = getChat(msg.chat_id, (RsChatFlags)Settings->getChatFlags());
if(cd) if(cd)
cd->addChatMsg(msg); cd->addChatMsg(msg);
else else
@ -185,7 +185,7 @@ void ChatDialog::init(const ChatId &id, const QString &title)
/*static*/ void ChatDialog::chatFriend(const ChatId &peerId, const bool forceFocus) /*static*/ void ChatDialog::chatFriend(const ChatId &peerId, const bool forceFocus)
{ {
getChat(peerId, forceFocus ? RS_CHAT_OPEN | RS_CHAT_FOCUS : RS_CHAT_OPEN); getChat(peerId, forceFocus ? (RsChatFlags::RS_CHAT_OPEN | RsChatFlags::RS_CHAT_FOCUS) : RsChatFlags::RS_CHAT_OPEN);
// below is the old code witch does lots of error checking. // below is the old code witch does lots of error checking.
// because there are many different chat types, there are also different ways to check if the id is valid // because there are many different chat types, there are also different ways to check if the id is valid

View file

@ -28,7 +28,8 @@
#include <QWidget> #include <QWidget>
#include <retroshare/rsmsgs.h> #include <retroshare/rsmsgs.h>
class ChatWidget; #include "gui/chat/ChatWidget.h"
class RSStyle; class RSStyle;
class ChatDialog : public QWidget class ChatDialog : public QWidget
@ -37,14 +38,14 @@ class ChatDialog : public QWidget
public: public:
static ChatDialog *getExistingChat(ChatId id); static ChatDialog *getExistingChat(ChatId id);
static ChatDialog *getChat(ChatId id, uint chatflags = 0); static ChatDialog *getChat(ChatId id, RsChatFlags chatflags = RsChatFlags::RS_CHAT_NONE);
static void cleanupChat(); static void cleanupChat();
static void chatFriend(const ChatId &peerId, bool forceFocus = true); static void chatFriend(const ChatId &peerId, bool forceFocus = true);
static void chatFriend(const RsPgpId &gpgId, bool forceFocus = true); static void chatFriend(const RsPgpId &gpgId, bool forceFocus = true);
static void closeChat(const ChatId &chat_id); static void closeChat(const ChatId &chat_id);
static void chatMessageReceived(ChatMessage msg); static void chatMessageReceived(ChatMessage msg);
virtual void showDialog(uint /*chatflags*/) {} virtual void showDialog(RsChatFlags /*chatflags*/) {}
virtual ChatWidget *getChatWidget() = 0; virtual ChatWidget *getChatWidget() = 0;
virtual bool hasPeerStatus() = 0; virtual bool hasPeerStatus() = 0;

View file

@ -930,9 +930,9 @@ bool ChatLobbyDialog::canClose()
return false; return false;
} }
void ChatLobbyDialog::showDialog(uint chatflags) void ChatLobbyDialog::showDialog(RsChatFlags chatflags)
{ {
if (chatflags & RS_CHAT_FOCUS) if (!!(chatflags & RsChatFlags::RS_CHAT_FOCUS))
{ {
if (isWindowed() && mPCWindow) { if (isWindowed() && mPCWindow) {
mPCWindow->showDialog(this, chatflags); mPCWindow->showDialog(this, chatflags);
@ -1020,5 +1020,5 @@ void ChatLobbyDialog::setWindowed(bool windowed)
} }
show(); show();
if (chatLobbyPage)// If not defined, we are on autosubscribe loop of lobby widget constructor. So don't recall it. if (chatLobbyPage)// If not defined, we are on autosubscribe loop of lobby widget constructor. So don't recall it.
showDialog(RS_CHAT_FOCUS); showDialog(RsChatFlags::RS_CHAT_FOCUS);
} }

View file

@ -44,10 +44,10 @@ class ChatLobbyDialog: public ChatDialog
public: public:
void handleLobbyEvent(RsChatLobbyEventCode event_type, const RsGxsId& gxs_id, const QString& str); void handleLobbyEvent(RsChatLobbyEventCode event_type, const RsGxsId& gxs_id, const QString& str);
virtual void showDialog(uint chatflags); virtual void showDialog(RsChatFlags chatflags) override;
virtual ChatWidget *getChatWidget(); virtual ChatWidget *getChatWidget() override;
virtual bool hasPeerStatus() { return false; } virtual bool hasPeerStatus() override{ return false; }
virtual bool notifyBlink(); virtual bool notifyBlink() override;
void setIdentity(const RsGxsId& gxs_id); void setIdentity(const RsGxsId& gxs_id);
bool isParticipantMuted(const RsGxsId &participant); bool isParticipantMuted(const RsGxsId &participant);
ChatLobbyId id() const { return lobbyId ;} ChatLobbyId id() const { return lobbyId ;}

View file

@ -132,7 +132,7 @@ void ChatUserNotify::iconClicked()
{ {
ChatDialog *chatDialog = NULL; ChatDialog *chatDialog = NULL;
// ChatWidget removes the waiting chat from the list with clearWaitingChat() // ChatWidget removes the waiting chat from the list with clearWaitingChat()
chatDialog = ChatDialog::getChat(waitingChats.begin()->first, RS_CHAT_OPEN | RS_CHAT_FOCUS); chatDialog = ChatDialog::getChat(waitingChats.begin()->first, RsChatFlags::RS_CHAT_OPEN | RsChatFlags::RS_CHAT_FOCUS);
if (chatDialog == NULL) { if (chatDialog == NULL) {
MainWindow::showWindow(MainWindow::Friends); MainWindow::showWindow(MainWindow::Friends);
@ -144,7 +144,7 @@ void ChatUserNotify::chatMessageReceived(ChatMessage msg)
{ {
if(!msg.chat_id.isBroadcast() if(!msg.chat_id.isBroadcast()
&&( ChatDialog::getExistingChat(msg.chat_id) &&( ChatDialog::getExistingChat(msg.chat_id)
|| (Settings->getChatFlags() & RS_CHAT_OPEN) || (Settings->getChatFlags() & (uint32_t)RsChatFlags::RS_CHAT_OPEN)
|| msg.chat_id.isDistantChatId())) || msg.chat_id.isDistantChatId()))
{ {
ChatDialog::chatMessageReceived(msg); ChatDialog::chatMessageReceived(msg);

View file

@ -53,6 +53,17 @@ namespace Ui {
class ChatWidget; class ChatWidget;
} }
enum class RsChatFlags: uint32_t {
RS_CHAT_NONE = 0x0000,
RS_CHAT_OPEN = 0x0001,
RS_CHAT_FOCUS = 0x0004,
RS_CHAT_TABBED_WINDOW = 0x0008,
RS_CHAT_BLINK = 0x0010,
};
RS_REGISTER_ENUM_FLAGS_TYPE(RsChatFlags);
// a Container for the logic behind buttons in a PopupChatDialog // a Container for the logic behind buttons in a PopupChatDialog
// Plugins can implement this interface to provide their own buttons // Plugins can implement this interface to provide their own buttons
class ChatWidgetHolder class ChatWidgetHolder

View file

@ -113,7 +113,7 @@ ChatWidget *PopupChatDialog::getChatWidget()
bool PopupChatDialog::notifyBlink() bool PopupChatDialog::notifyBlink()
{ {
return (Settings->getChatFlags() & RS_CHAT_BLINK); return (Settings->getChatFlags() & (uint32_t)RsChatFlags::RS_CHAT_BLINK);
} }
void PopupChatDialog::processSettings(bool load) void PopupChatDialog::processSettings(bool load)
@ -129,7 +129,7 @@ void PopupChatDialog::processSettings(bool load)
Settings->endGroup(); Settings->endGroup();
} }
void PopupChatDialog::showDialog(uint chatflags) void PopupChatDialog::showDialog(RsChatFlags chatflags)
{ {
PopupChatWindow *window = WINDOW(this); PopupChatWindow *window = WINDOW(this);
if (window) { if (window) {

View file

@ -46,11 +46,11 @@ protected:
/** Default destructor */ /** Default destructor */
virtual ~PopupChatDialog(); virtual ~PopupChatDialog();
virtual void init(const ChatId &chat_id, const QString &title); virtual void init(const ChatId &chat_id, const QString &title) override;
virtual void showDialog(uint chatflags); virtual void showDialog(RsChatFlags chatflags) override;
virtual ChatWidget *getChatWidget(); virtual ChatWidget *getChatWidget() override;
virtual bool hasPeerStatus() { return true; } virtual bool hasPeerStatus() override{ return true; }
virtual bool notifyBlink(); virtual bool notifyBlink() override;
virtual void updateStatus(int /*status*/) {} virtual void updateStatus(int /*status*/) {}

View file

@ -49,7 +49,7 @@ static PopupChatWindow *instance = NULL;
/*static*/ PopupChatWindow *PopupChatWindow::getWindow(bool needSingleWindow) /*static*/ PopupChatWindow *PopupChatWindow::getWindow(bool needSingleWindow)
{ {
if (needSingleWindow == false && (Settings->getChatFlags() & RS_CHAT_TABBED_WINDOW)) { if (needSingleWindow == false && (Settings->getChatFlags() & (uint32_t)RsChatFlags::RS_CHAT_TABBED_WINDOW)) {
if (instance == NULL) { if (instance == NULL) {
instance = new PopupChatWindow(true); instance = new PopupChatWindow(true);
} }
@ -162,7 +162,7 @@ void PopupChatWindow::showContextMenu(QPoint)
} }
} }
if (Settings->getChatFlags() & RS_CHAT_TABBED_WINDOW) if (Settings->getChatFlags() & (uint32_t)RsChatFlags::RS_CHAT_TABBED_WINDOW)
{ {
if(tabbedWindow) if(tabbedWindow)
contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(":/images/tab-dock.png"),tr("Dock window"),this,SLOT(docTab())); contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(":/images/tab-dock.png"),tr("Dock window"),this,SLOT(docTab()));
@ -300,9 +300,9 @@ void PopupChatWindow::removeDialog(ChatDialog *dialog)
} }
} }
void PopupChatWindow::showDialog(ChatDialog *dialog, uint chatflags) void PopupChatWindow::showDialog(ChatDialog *dialog, RsChatFlags chatflags)
{ {
if (chatflags & RS_CHAT_FOCUS) { if (!!(chatflags & RsChatFlags::RS_CHAT_FOCUS)) {
if (tabbedWindow) { if (tabbedWindow) {
ui.tabWidget->setCurrentWidget(dialog); ui.tabWidget->setCurrentWidget(dialog);
} }
@ -352,7 +352,7 @@ void PopupChatWindow::calculateTitle(ChatDialog *dialog)
icon = FilesDefs::getIconFromQtResourcePath(IMAGE_TYPING); icon = FilesDefs::getIconFromQtResourcePath(IMAGE_TYPING);
} else if (hasNewMessages) { } else if (hasNewMessages) {
icon = FilesDefs::getIconFromQtResourcePath(IMAGE_CHAT); icon = FilesDefs::getIconFromQtResourcePath(IMAGE_CHAT);
if (Settings->getChatFlags() & RS_CHAT_BLINK) { if (Settings->getChatFlags() & (uint32_t)RsChatFlags::RS_CHAT_BLINK) {
mBlinkIcon = icon; mBlinkIcon = icon;
} else { } else {
mBlinkIcon = QIcon(); mBlinkIcon = QIcon();
@ -423,7 +423,7 @@ void PopupChatWindow::tabNewMessage(ChatDialog *dialog)
void PopupChatWindow::dockTab() void PopupChatWindow::dockTab()
{ {
if ((Settings->getChatFlags() & RS_CHAT_TABBED_WINDOW) && chatDialog) { if ((Settings->getChatFlags() & (uint32_t)RsChatFlags::RS_CHAT_TABBED_WINDOW) && chatDialog) {
PopupChatWindow *pcw = getWindow(false); PopupChatWindow *pcw = getWindow(false);
if (pcw) { if (pcw) {
ChatDialog *pcd = chatDialog; ChatDialog *pcd = chatDialog;

View file

@ -27,6 +27,9 @@
#include "ui_PopupChatWindow.h" #include "ui_PopupChatWindow.h"
#include <retroshare/rstypes.h> #include <retroshare/rstypes.h>
#include <retroshare/rsmsgs.h> #include <retroshare/rsmsgs.h>
#include "gui/chat/ChatWidget.h"
Q_DECLARE_METATYPE(RsGxsId) Q_DECLARE_METATYPE(RsGxsId)
Q_DECLARE_METATYPE(QList<RsGxsId>) Q_DECLARE_METATYPE(QList<RsGxsId>)
@ -43,7 +46,7 @@ public:
public: public:
void addDialog(ChatDialog *dialog); void addDialog(ChatDialog *dialog);
void removeDialog(ChatDialog *dialog); void removeDialog(ChatDialog *dialog);
void showDialog(ChatDialog *dialog, uint chatflags); void showDialog(ChatDialog *dialog, RsChatFlags chatflags);
void alertDialog(ChatDialog *dialog); void alertDialog(ChatDialog *dialog);
void calculateTitle(ChatDialog *dialog); void calculateTitle(ChatDialog *dialog);

View file

@ -106,6 +106,8 @@ QString AvatarWidget::frameState()
return "AWAY"; return "AWAY";
case RsStatusValue::RS_STATUS_BUSY: case RsStatusValue::RS_STATUS_BUSY:
return "BUSY"; return "BUSY";
default:
break;
} }
} }
return "NOTHING"; return "NOTHING";

View file

@ -48,7 +48,7 @@ uint64_t FeedItem::hash_64bits(const std::string& s) const
if(mHash == 0) if(mHash == 0)
mHash = hash64(s); mHash = hash64(s);
return mHash; return mHash;
} }
uint64_t FeedItem::hash64(const std::string& s) uint64_t FeedItem::hash64(const std::string& s)

View file

@ -21,10 +21,70 @@
#ifndef _FEED_ITEM_H #ifndef _FEED_ITEM_H
#define _FEED_ITEM_H #define _FEED_ITEM_H
#include <retroshare/rsflags.h>
#include <QWidget> #include <QWidget>
class FeedHolder; class FeedHolder;
enum class RsFeedTypeFlags: uint32_t {
RS_FEED_TYPE_NONE = 0x0000,
RS_FEED_TYPE_PEER = 0x0010,
RS_FEED_TYPE_CHANNEL = 0x0020,
RS_FEED_TYPE_FORUM = 0x0040,
RS_FEED_TYPE_CHAT = 0x0100,
RS_FEED_TYPE_MSG = 0x0200,
RS_FEED_TYPE_FILES = 0x0400,
RS_FEED_TYPE_SECURITY = 0x0800,
RS_FEED_TYPE_POSTED = 0x1000,
RS_FEED_TYPE_SECURITY_IP = 0x2000,
RS_FEED_TYPE_CIRCLE = 0x4000,
RS_FEED_ITEM_PEER_CONNECT = RS_FEED_TYPE_PEER | 0x0001,
RS_FEED_ITEM_PEER_DISCONNECT = RS_FEED_TYPE_PEER | 0x0002,
RS_FEED_ITEM_PEER_HELLO = RS_FEED_TYPE_PEER | 0x0003,
RS_FEED_ITEM_PEER_NEW = RS_FEED_TYPE_PEER | 0x0004,
RS_FEED_ITEM_PEER_OFFSET = RS_FEED_TYPE_PEER | 0x0005,
RS_FEED_ITEM_PEER_DENIES_CONNEXION = RS_FEED_TYPE_PEER | 0x0006,
RS_FEED_ITEM_SEC_CONNECT_ATTEMPT = RS_FEED_TYPE_SECURITY | 0x0001,
RS_FEED_ITEM_SEC_AUTH_DENIED = RS_FEED_TYPE_SECURITY | 0x0002, // locally denied connection
RS_FEED_ITEM_SEC_UNKNOWN_IN = RS_FEED_TYPE_SECURITY | 0x0003,
RS_FEED_ITEM_SEC_UNKNOWN_OUT = RS_FEED_TYPE_SECURITY | 0x0004,
RS_FEED_ITEM_SEC_WRONG_SIGNATURE = RS_FEED_TYPE_SECURITY | 0x0005,
RS_FEED_ITEM_SEC_BAD_CERTIFICATE = RS_FEED_TYPE_SECURITY | 0x0006,
RS_FEED_ITEM_SEC_INTERNAL_ERROR = RS_FEED_TYPE_SECURITY | 0x0007,
RS_FEED_ITEM_SEC_MISSING_CERTIFICATE = RS_FEED_TYPE_SECURITY | 0x0008,
RS_FEED_ITEM_SEC_IP_BLACKLISTED = RS_FEED_TYPE_SECURITY_IP | 0x0001,
RS_FEED_ITEM_SEC_IP_WRONG_EXTERNAL_IP_REPORTED = RS_FEED_TYPE_SECURITY_IP | 0x0002,
RS_FEED_ITEM_CHANNEL_NEW = RS_FEED_TYPE_CHANNEL | 0x0002,
RS_FEED_ITEM_CHANNEL_MSG = RS_FEED_TYPE_CHANNEL | 0x0003,
RS_FEED_ITEM_CHANNEL_PUBLISHKEY = RS_FEED_TYPE_CHANNEL| 0x0004,
RS_FEED_ITEM_FORUM_NEW = RS_FEED_TYPE_FORUM | 0x0001,
RS_FEED_ITEM_FORUM_MSG = RS_FEED_TYPE_FORUM | 0x0003,
RS_FEED_ITEM_FORUM_PUBLISHKEY = RS_FEED_TYPE_FORUM | 0x0004,
RS_FEED_ITEM_POSTED_NEW = RS_FEED_TYPE_POSTED | 0x0001,
RS_FEED_ITEM_POSTED_MSG = RS_FEED_TYPE_POSTED | 0x0003,
RS_FEED_ITEM_CHAT_NEW = RS_FEED_TYPE_CHAT | 0x0001,
RS_FEED_ITEM_MESSAGE = RS_FEED_TYPE_MSG | 0x0001,
RS_FEED_ITEM_FILES_NEW = RS_FEED_TYPE_FILES | 0x0001,
RS_FEED_ITEM_CIRCLE_MEMB_REQ = RS_FEED_TYPE_CIRCLE | 0x0001,
RS_FEED_ITEM_CIRCLE_INVITE_REC = RS_FEED_TYPE_CIRCLE | 0x0002,
RS_FEED_ITEM_CIRCLE_MEMB_LEAVE = RS_FEED_TYPE_CIRCLE | 0x0003,
RS_FEED_ITEM_CIRCLE_MEMB_JOIN = RS_FEED_TYPE_CIRCLE | 0x0004,
RS_FEED_ITEM_CIRCLE_MEMB_ACCEPTED = RS_FEED_TYPE_CIRCLE | 0x0005,
RS_FEED_ITEM_CIRCLE_MEMB_REVOKED = RS_FEED_TYPE_CIRCLE | 0x0006,
RS_FEED_ITEM_CIRCLE_INVITE_CANCELLED= RS_FEED_TYPE_CIRCLE | 0x0007,
};
RS_REGISTER_ENUM_FLAGS_TYPE(RsFeedTypeFlags);
class FeedItem : public QWidget class FeedItem : public QWidget
{ {
Q_OBJECT Q_OBJECT

View file

@ -40,7 +40,7 @@
#define CIRCLESDIALOG_GROUPUPDATE 3 #define CIRCLESDIALOG_GROUPUPDATE 3
GxsCircleItem::GxsCircleItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsCircleId &circleId, const RsGxsId &gxsId, const uint32_t type) GxsCircleItem::GxsCircleItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsCircleId &circleId, const RsGxsId &gxsId, RsFeedTypeFlags type)
:FeedItem(feedHolder,feedId,NULL), mType(type), mCircleId(circleId), mGxsId(gxsId) :FeedItem(feedHolder,feedId,NULL), mType(type), mCircleId(circleId), mGxsId(gxsId)
{ {
setup(); setup();
@ -92,7 +92,7 @@ void GxsCircleItem::setup()
// from here we can figure out if we already have requested membership or not // from here we can figure out if we already have requested membership or not
if (mType == RS_FEED_ITEM_CIRCLE_MEMB_REQ) if (mType == RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_REQ)
{ {
ui->titleLabel->setText(tr("You received a membership request a circle you're administrating:")); ui->titleLabel->setText(tr("You received a membership request a circle you're administrating:"));
ui->iconLabel->setPixmap(pixmap); ui->iconLabel->setPixmap(pixmap);
@ -105,7 +105,7 @@ void GxsCircleItem::setup()
ui->membershipButton->setHidden(true); ui->membershipButton->setHidden(true);
} }
else if (mType == RS_FEED_ITEM_CIRCLE_INVITE_REC) else if (mType == RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_INVITE_REC)
{ {
ui->titleLabel->setText(tr("You received an invitation to join this circle:")); ui->titleLabel->setText(tr("You received an invitation to join this circle:"));
ui->iconLabel->setPixmap(pixmap); ui->iconLabel->setPixmap(pixmap);
@ -118,7 +118,7 @@ void GxsCircleItem::setup()
connect(ui->membershipButton, SIGNAL(clicked()), this, SLOT(requestCircleSubscription())); connect(ui->membershipButton, SIGNAL(clicked()), this, SLOT(requestCircleSubscription()));
ui->inviteeButton->setHidden(true); ui->inviteeButton->setHidden(true);
} }
else if (mType == RS_FEED_ITEM_CIRCLE_MEMB_LEAVE) else if (mType == RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_LEAVE)
{ {
ui->titleLabel->setText(idName + tr(" has left this circle.")); ui->titleLabel->setText(idName + tr(" has left this circle."));
ui->iconLabel->setPixmap(pixmap); ui->iconLabel->setPixmap(pixmap);
@ -127,7 +127,7 @@ void GxsCircleItem::setup()
ui->membershipButton->setHidden(true); ui->membershipButton->setHidden(true);
ui->inviteeButton->setHidden(true); ui->inviteeButton->setHidden(true);
} }
else if (mType == RS_FEED_ITEM_CIRCLE_MEMB_JOIN) else if (mType == RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_JOIN)
{ {
if(circleDetails.mAmIAdmin) if(circleDetails.mAmIAdmin)
{ {
@ -148,7 +148,7 @@ void GxsCircleItem::setup()
ui->membershipButton->setHidden(true); ui->membershipButton->setHidden(true);
} }
else if (mType == RS_FEED_ITEM_CIRCLE_MEMB_REVOKED) else if (mType == RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_REVOKED)
{ {
ui->titleLabel->setText(tr("Your identity %1 has been revoked from this circle.").arg(idName)); ui->titleLabel->setText(tr("Your identity %1 has been revoked from this circle.").arg(idName));
@ -162,7 +162,7 @@ void GxsCircleItem::setup()
ui->inviteeButton->setHidden(true); ui->inviteeButton->setHidden(true);
} }
else if (mType == RS_FEED_ITEM_CIRCLE_MEMB_ACCEPTED) else if (mType == RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_ACCEPTED)
{ {
ui->titleLabel->setText(tr("Your identity %1 as been accepted in this circle.").arg(idName)); ui->titleLabel->setText(tr("Your identity %1 as been accepted in this circle.").arg(idName));
@ -198,7 +198,7 @@ void GxsCircleItem::showCircleDetails()
{ {
CreateCircleDialog dlg; CreateCircleDialog dlg;
dlg.editExistingId(RsGxsGroupId(mCircleId), true, mType != RS_FEED_ITEM_CIRCLE_MEMB_REQ) ; dlg.editExistingId(RsGxsGroupId(mCircleId), true, mType != RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_REQ) ;
dlg.exec(); dlg.exec();
} }
@ -215,9 +215,9 @@ void GxsCircleItem::toggleCircleMembership()
return; return;
} }
if(mType == RS_FEED_ITEM_CIRCLE_INVITE_REC) if(mType == RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_INVITE_REC)
rsGxsCircles->requestCircleMembership(mGxsId,mCircleId); rsGxsCircles->requestCircleMembership(mGxsId,mCircleId);
else if(mType == RS_FEED_ITEM_CIRCLE_MEMB_REVOKED) else if(mType == RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_REVOKED)
rsGxsCircles->cancelCircleMembership(mGxsId,mCircleId); rsGxsCircles->cancelCircleMembership(mGxsId,mCircleId);
else else
RsErr() << __PRETTY_FUNCTION__ << ": inconsistent call. mType is " << mType << std::endl; RsErr() << __PRETTY_FUNCTION__ << ": inconsistent call. mType is " << mType << std::endl;
@ -225,12 +225,12 @@ void GxsCircleItem::toggleCircleMembership()
void GxsCircleItem::toggleCircleInvite() void GxsCircleItem::toggleCircleInvite()
{ {
if(mType == RS_FEED_ITEM_CIRCLE_MEMB_JOIN) if(mType == RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_JOIN)
RsThread::async([this]() RsThread::async([this]()
{ {
rsGxsCircles->revokeIdsFromCircle(std::set<RsGxsId>( { mGxsId } ),mCircleId); rsGxsCircles->revokeIdsFromCircle(std::set<RsGxsId>( { mGxsId } ),mCircleId);
}); });
else if(mType == RS_FEED_ITEM_CIRCLE_MEMB_REQ) else if(mType == RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_REQ)
RsThread::async([this]() RsThread::async([this]()
{ {
rsGxsCircles->inviteIdsToCircle(std::set<RsGxsId>( { mGxsId } ),mCircleId); rsGxsCircles->inviteIdsToCircle(std::set<RsGxsId>( { mGxsId } ),mCircleId);

View file

@ -37,7 +37,7 @@ class GxsCircleItem : public FeedItem
public: public:
/** Default Constructor */ /** Default Constructor */
GxsCircleItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsCircleId &circleId, const RsGxsId &gxsId, const uint32_t type); GxsCircleItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsCircleId &circleId, const RsGxsId &gxsId, RsFeedTypeFlags type);
virtual ~GxsCircleItem(); virtual ~GxsCircleItem();
uint64_t uniqueIdentifier() const override; uint64_t uniqueIdentifier() const override;
@ -60,7 +60,7 @@ private slots:
private: private:
void setup(); void setup();
uint32_t mType; RsFeedTypeFlags mType;
RsGxsCircleId mCircleId; RsGxsCircleId mCircleId;
RsGxsId mGxsId; RsGxsId mGxsId;

View file

@ -40,14 +40,14 @@
****/ ****/
/** Constructor */ /** Constructor */
SecurityIpItem::SecurityIpItem(FeedHolder *parent, const RsPeerId &sslId, const std::string &ipAddr, uint32_t result, uint32_t type, bool isTest) : SecurityIpItem::SecurityIpItem(FeedHolder *parent, const RsPeerId &sslId, const std::string &ipAddr, uint32_t result, RsFeedTypeFlags type, bool isTest) :
FeedItem(parent,0,NULL), mType(type), mSslId(sslId), mIpAddr(ipAddr), mResult(result), mIsTest(isTest), FeedItem(parent,0,NULL), mType(type), mSslId(sslId), mIpAddr(ipAddr), mResult(result), mIsTest(isTest),
ui(new(Ui::SecurityIpItem)) ui(new(Ui::SecurityIpItem))
{ {
setup(); setup();
} }
SecurityIpItem::SecurityIpItem(FeedHolder *parent, const RsPeerId &sslId, const std::string& ipAddr, const std::string& ipAddrReported, uint32_t type, bool isTest) : SecurityIpItem::SecurityIpItem(FeedHolder *parent, const RsPeerId &sslId, const std::string& ipAddr, const std::string& ipAddrReported, RsFeedTypeFlags type, bool isTest) :
FeedItem(parent,0,NULL), mType(type), mSslId(sslId), mIpAddr(ipAddr), mIpAddrReported(ipAddrReported), mResult(0), mIsTest(isTest), FeedItem(parent,0,NULL), mType(type), mSslId(sslId), mIpAddr(ipAddr), mIpAddrReported(ipAddrReported), mResult(0), mIsTest(isTest),
ui(new(Ui::SecurityIpItem)) ui(new(Ui::SecurityIpItem))
{ {
@ -81,7 +81,7 @@ void SecurityIpItem::setup()
uint64_t SecurityIpItem::uniqueIdentifier() const uint64_t SecurityIpItem::uniqueIdentifier() const
{ {
return hash_64bits("SecurityItem " + QString::number(mType).toStdString() + " " + mSslId.toStdString() + " " + mIpAddr + " " + mIpAddrReported) ; return hash_64bits("SecurityItem " + QString::number((int)mType).toStdString() + " " + mSslId.toStdString() + " " + mIpAddr + " " + mIpAddrReported) ;
} }
void SecurityIpItem::updateItemStatic() void SecurityIpItem::updateItemStatic()
@ -97,12 +97,12 @@ void SecurityIpItem::updateItemStatic()
/* Specific type */ /* Specific type */
switch (mType) { switch (mType) {
case RS_FEED_ITEM_SEC_IP_BLACKLISTED: case RsFeedTypeFlags::RS_FEED_ITEM_SEC_IP_BLACKLISTED:
ui->rsBanListButton->setDisabled(mIsTest); ui->rsBanListButton->setDisabled(mIsTest);
ui->ipAddrReported->hide(); ui->ipAddrReported->hide();
ui->ipAddrReportedLabel->hide(); ui->ipAddrReportedLabel->hide();
break; break;
case RS_FEED_ITEM_SEC_IP_WRONG_EXTERNAL_IP_REPORTED: case RsFeedTypeFlags::RS_FEED_ITEM_SEC_IP_WRONG_EXTERNAL_IP_REPORTED:
ui->rsBanListButton->hide(); ui->rsBanListButton->hide();
break; break;
default: default:
@ -126,7 +126,7 @@ void SecurityIpItem::updateItem()
if(!RsAutoUpdatePage::eventsLocked()) { if(!RsAutoUpdatePage::eventsLocked()) {
switch (mType) { switch (mType) {
case RS_FEED_ITEM_SEC_IP_BLACKLISTED: case RsFeedTypeFlags::RS_FEED_ITEM_SEC_IP_BLACKLISTED:
ui->titleLabel->setText(RsBanListDefs::resultString(mResult)); ui->titleLabel->setText(RsBanListDefs::resultString(mResult));
ui->ipAddr->setText(QString::fromStdString(mIpAddr)); ui->ipAddr->setText(QString::fromStdString(mIpAddr));
@ -145,7 +145,7 @@ void SecurityIpItem::updateItem()
} }
} }
break; break;
case RS_FEED_ITEM_SEC_IP_WRONG_EXTERNAL_IP_REPORTED: case RsFeedTypeFlags::RS_FEED_ITEM_SEC_IP_WRONG_EXTERNAL_IP_REPORTED:
ui->titleLabel->setText(tr("Wrong external ip address reported")); ui->titleLabel->setText(tr("Wrong external ip address reported"));
ui->ipAddr->setText(QString::fromStdString(mIpAddr)); ui->ipAddr->setText(QString::fromStdString(mIpAddr));
ui->ipAddr->setToolTip(tr("<p>This is the external IP your Retroshare node thinks it is using.</p>")) ; ui->ipAddr->setToolTip(tr("<p>This is the external IP your Retroshare node thinks it is using.</p>")) ;

View file

@ -38,8 +38,8 @@ class SecurityIpItem : public FeedItem
public: public:
/** Default Constructor */ /** Default Constructor */
SecurityIpItem(FeedHolder *parent, const RsPeerId &sslId, const std::string& ipAddr, uint32_t result, uint32_t type, bool isTest); SecurityIpItem(FeedHolder *parent, const RsPeerId &sslId, const std::string& ipAddr, uint32_t result, RsFeedTypeFlags type, bool isTest);
SecurityIpItem(FeedHolder *parent, const RsPeerId &sslId, const std::string& ipAddr, const std::string& ipAddrReported, uint32_t type, bool isTest); SecurityIpItem(FeedHolder *parent, const RsPeerId &sslId, const std::string& ipAddr, const std::string& ipAddrReported, RsFeedTypeFlags type, bool isTest);
void updateItemStatic(); void updateItemStatic();
@ -60,7 +60,7 @@ private slots:
void banIpListChanged(const QString &ipAddress); void banIpListChanged(const QString &ipAddress);
private: private:
uint32_t mType; RsFeedTypeFlags mType;
RsPeerId mSslId; RsPeerId mSslId;
std::string mIpAddr; std::string mIpAddr;
std::string mIpAddrReported; std::string mIpAddrReported;

View file

@ -45,7 +45,7 @@
****/ ****/
/** Constructor */ /** Constructor */
SecurityItem::SecurityItem(FeedHolder *parent, uint32_t feedId, const RsPgpId &gpgId, const RsPeerId &sslId, const std::string &sslCn, const std::string& ip_address,uint32_t type, bool isHome) : SecurityItem::SecurityItem(FeedHolder *parent, uint32_t feedId, const RsPgpId &gpgId, const RsPeerId &sslId, const std::string &sslCn, const std::string& ip_address,RsFeedTypeFlags type, bool isHome) :
FeedItem(parent,feedId,NULL), FeedItem(parent,feedId,NULL),
mGpgId(gpgId), mSslId(sslId), mSslCn(sslCn), mIP(ip_address), mType(type), mIsHome(isHome) mGpgId(gpgId), mSslId(sslId), mSslCn(sslCn), mIP(ip_address), mType(type), mIsHome(isHome)
{ {
@ -105,7 +105,7 @@ SecurityItem::~SecurityItem()
} }
uint64_t SecurityItem::uniqueIdentifier() const uint64_t SecurityItem::uniqueIdentifier() const
{ {
return hash_64bits("SecurityItem " + QString::number(mType).toStdString() + " " + mSslId.toStdString()); return hash_64bits("SecurityItem " + QString::number((uint)mType).toStdString() + " " + mSslId.toStdString());
} }
void SecurityItem::updateItemStatic() void SecurityItem::updateItemStatic()
@ -122,35 +122,35 @@ void SecurityItem::updateItemStatic()
switch(mType) switch(mType)
{ {
case RS_FEED_ITEM_SEC_CONNECT_ATTEMPT: case RsFeedTypeFlags::RS_FEED_ITEM_SEC_CONNECT_ATTEMPT:
title = tr("Connect Attempt"); title = tr("Connect Attempt");
requestLabel->show(); requestLabel->show();
avatar->setDefaultAvatar(":images/avatar_request.png"); avatar->setDefaultAvatar(":images/avatar_request.png");
break; break;
case RS_FEED_ITEM_SEC_AUTH_DENIED: case RsFeedTypeFlags::RS_FEED_ITEM_SEC_AUTH_DENIED:
title = tr("Connection refused by remote peer"); title = tr("Connection refused by remote peer");
requestLabel->hide(); requestLabel->hide();
avatar->setDefaultAvatar(":images/avatar_refused.png"); avatar->setDefaultAvatar(":images/avatar_refused.png");
break; break;
case RS_FEED_ITEM_SEC_UNKNOWN_IN: case RsFeedTypeFlags::RS_FEED_ITEM_SEC_UNKNOWN_IN:
title = tr("Unknown (Incoming) Connect Attempt"); title = tr("Unknown (Incoming) Connect Attempt");
requestLabel->hide(); requestLabel->hide();
avatar->setDefaultAvatar(":images/avatar_request_unknown.png"); avatar->setDefaultAvatar(":images/avatar_request_unknown.png");
break; break;
case RS_FEED_ITEM_SEC_UNKNOWN_OUT: case RsFeedTypeFlags::RS_FEED_ITEM_SEC_UNKNOWN_OUT:
title = tr("Unknown (Outgoing) Connect Attempt"); title = tr("Unknown (Outgoing) Connect Attempt");
requestLabel->hide(); requestLabel->hide();
break; break;
case RS_FEED_ITEM_SEC_WRONG_SIGNATURE: case RsFeedTypeFlags::RS_FEED_ITEM_SEC_WRONG_SIGNATURE:
title = tr("Certificate has wrong signature!! This peer is not who he claims to be."); title = tr("Certificate has wrong signature!! This peer is not who he claims to be.");
requestLabel->hide(); requestLabel->hide();
break; break;
case RS_FEED_ITEM_SEC_MISSING_CERTIFICATE: case RsFeedTypeFlags::RS_FEED_ITEM_SEC_MISSING_CERTIFICATE:
title = tr("Peer/node not in friendlist (PGP id=")+QString::fromStdString(mGpgId.toStdString())+")"; title = tr("Peer/node not in friendlist (PGP id=")+QString::fromStdString(mGpgId.toStdString())+")";
avatar->setDefaultAvatar(":images/avatar_request_unknown.png"); avatar->setDefaultAvatar(":images/avatar_request_unknown.png");
requestLabel->show(); requestLabel->show();
break; break;
case RS_FEED_ITEM_SEC_BAD_CERTIFICATE: case RsFeedTypeFlags::RS_FEED_ITEM_SEC_BAD_CERTIFICATE:
{ {
RsPeerDetails details ; RsPeerDetails details ;
if(rsPeers->getGPGDetails(mGpgId, details)) if(rsPeers->getGPGDetails(mGpgId, details))
@ -161,7 +161,7 @@ void SecurityItem::updateItemStatic()
} }
avatar->setDefaultAvatar(":icons/ssl.png"); avatar->setDefaultAvatar(":icons/ssl.png");
break; break;
case RS_FEED_ITEM_SEC_INTERNAL_ERROR: case RsFeedTypeFlags::RS_FEED_ITEM_SEC_INTERNAL_ERROR:
title = tr("Certificate caused an internal error."); title = tr("Certificate caused an internal error.");
requestLabel->hide(); requestLabel->hide();
break; break;
@ -232,7 +232,7 @@ void SecurityItem::updateItem()
removeFriendButton->hide(); removeFriendButton->hide();
peerDetailsButton->setEnabled(false); peerDetailsButton->setEnabled(false);
if(mType == RS_FEED_ITEM_SEC_BAD_CERTIFICATE) if(mType == RsFeedTypeFlags::RS_FEED_ITEM_SEC_BAD_CERTIFICATE)
{ {
peerNameLabel->setText(tr("SSL request")); peerNameLabel->setText(tr("SSL request"));
friendRequesttoolButton->hide(); friendRequesttoolButton->hide();

View file

@ -38,7 +38,7 @@ class SecurityItem : public FeedItem, private Ui::SecurityItem
public: public:
/** Default Constructor */ /** Default Constructor */
SecurityItem(FeedHolder *parent, uint32_t feedId, const RsPgpId &gpgId, const RsPeerId &sslId, const std::string &sslCn, const std::string& ip_addr,uint32_t type, bool isHome); SecurityItem(FeedHolder *parent, uint32_t feedId, const RsPgpId &gpgId, const RsPeerId &sslId, const std::string &sslCn, const std::string& ip_addr,RsFeedTypeFlags type, bool isHome);
~SecurityItem(); ~SecurityItem();
void updateItemStatic(); void updateItemStatic();
@ -66,7 +66,7 @@ private:
RsPeerId mSslId; RsPeerId mSslId;
std::string mSslCn; std::string mSslCn;
std::string mIP; std::string mIP;
uint32_t mType; RsFeedTypeFlags mType;
bool mIsHome; bool mIsHome;
RsEventsHandlerId_t mEventHandlerId; RsEventsHandlerId_t mEventHandlerId;

View file

@ -238,9 +238,9 @@ void ImHistoryBrowser::historyAdd(HistoryMsg& msg)
} }
} }
void ImHistoryBrowser::historyChanged(uint msgId, int type) void ImHistoryBrowser::historyChanged(uint msgId, RsChatHistoryChangeFlags type)
{ {
if (type == NOTIFY_TYPE_ADD) { if (type == RsChatHistoryChangeFlags::ADD) {
/* history message added */ /* history message added */
HistoryMsg msg; HistoryMsg msg;
if (rsHistory->getMessage(msgId, msg) == false) { if (rsHistory->getMessage(msgId, msg) == false) {
@ -254,7 +254,7 @@ void ImHistoryBrowser::historyChanged(uint msgId, int type)
return; return;
} }
if (type == NOTIFY_TYPE_DEL) { if (type == RsChatHistoryChangeFlags::DEL) {
/* history message removed */ /* history message removed */
int count = ui.listWidget->count(); int count = ui.listWidget->count();
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
@ -267,7 +267,7 @@ void ImHistoryBrowser::historyChanged(uint msgId, int type)
return; return;
} }
if (type == NOTIFY_TYPE_MOD) { if (type == RsChatHistoryChangeFlags::MOD) {
/* clear history */ /* clear history */
// As no ChatId nor msgId are send via Notify, // As no ChatId nor msgId are send via Notify,
// only check if history of this chat is empty before clear our list. // only check if history of this chat is empty before clear our list.

View file

@ -52,7 +52,7 @@ private slots:
void createThreadFinished(); void createThreadFinished();
void createThreadProgress(int current, int count); void createThreadProgress(int current, int count);
void historyChanged(uint msgId, int type); void historyChanged(uint msgId, RsChatHistoryChangeFlags type);
void filterChanged(const QString& text); void filterChanged(const QString& text);

View file

@ -261,7 +261,9 @@ void MessageWidget::handleEvent_main_thread(std::shared_ptr<const RsEvent> event
case RsMailStatusEventCode::MESSAGE_RECEIVED_ACK: case RsMailStatusEventCode::MESSAGE_RECEIVED_ACK:
case RsMailStatusEventCode::SIGNATURE_FAILED: case RsMailStatusEventCode::SIGNATURE_FAILED:
break; break;
} default:
break;
}
} }
void MessageWidget::connectAction(enumActionType actionType, QToolButton* button) void MessageWidget::connectAction(enumActionType actionType, QToolButton* button)

View file

@ -351,6 +351,8 @@ void MessagesDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> even
case RsMailStatusEventCode::MESSAGE_RECEIVED_ACK: case RsMailStatusEventCode::MESSAGE_RECEIVED_ACK:
case RsMailStatusEventCode::SIGNATURE_FAILED: case RsMailStatusEventCode::SIGNATURE_FAILED:
break; break;
default:
break;
} }
} }
@ -1088,11 +1090,13 @@ void MessagesDialog::doubleClicked(const QModelIndex& proxy_index)
} }
/* edit message */ /* edit message */
switch (Settings->getMsgOpen()) { switch (Settings->getMsgOpen())
case RshareSettings::MSG_OPEN_TAB: {
default:
case RsSettingsMsgOptions::MSG_OPEN_TAB:
openAsTab(); openAsTab();
break; break;
case RshareSettings::MSG_OPEN_WINDOW: case RsSettingsMsgOptions::MSG_OPEN_WINDOW:
openAsWindow(); openAsWindow();
break; break;
} }

View file

@ -715,7 +715,7 @@ void NotifyQt::async_handleIncomingEvent(std::shared_ptr<const RsEvent> event)
/* Finally Check for PopupMessages / System Error Messages */ /* Finally Check for PopupMessages / System Error Messages */
uint popupflags = Settings->getNotifyFlags(); RsNotifyPopupFlags popupflags = (RsNotifyPopupFlags)Settings->getNotifyFlags();
auto insertToaster = [this](ToasterItem *toaster) { auto insertToaster = [this](ToasterItem *toaster) {
@ -736,7 +736,7 @@ void NotifyQt::async_handleIncomingEvent(std::shared_ptr<const RsEvent> event)
{ {
SoundManager::play(SOUND_MESSAGE_ARRIVED); SoundManager::play(SOUND_MESSAGE_ARRIVED);
if((popupflags & RS_POPUP_MSG) && !_disableAllToaster) if((!!(popupflags & RsNotifyPopupFlags::RS_POPUP_MSG)) && !_disableAllToaster)
{ {
for(auto msgid:ev1->mChangedMsgIds) for(auto msgid:ev1->mChangedMsgIds)
{ {
@ -757,7 +757,7 @@ void NotifyQt::async_handleIncomingEvent(std::shared_ptr<const RsEvent> event)
{ {
SoundManager::play(SOUND_USER_ONLINE); SoundManager::play(SOUND_USER_ONLINE);
if ((popupflags & RS_POPUP_CONNECT) && !_disableAllToaster) if ((!!(popupflags & RsNotifyPopupFlags::RS_POPUP_CONNECT)) && !_disableAllToaster)
insertToaster(new ToasterItem(new OnlineToaster(ev2->mSslId))); insertToaster(new ToasterItem(new OnlineToaster(ev2->mSslId)));
} }
return; return;
@ -771,7 +771,7 @@ void NotifyQt::async_handleIncomingEvent(std::shared_ptr<const RsEvent> event)
{ {
SoundManager::play(SOUND_DOWNLOAD_COMPLETE); SoundManager::play(SOUND_DOWNLOAD_COMPLETE);
if ((popupflags & RS_POPUP_DOWNLOAD) && !_disableAllToaster) if ((!!(popupflags & RsNotifyPopupFlags::RS_POPUP_DOWNLOAD)) && !_disableAllToaster)
insertToaster(new ToasterItem(new DownloadToaster(ev3->mHash))); insertToaster(new ToasterItem(new DownloadToaster(ev3->mHash)));
} }
return; return;
@ -783,7 +783,7 @@ void NotifyQt::async_handleIncomingEvent(std::shared_ptr<const RsEvent> event)
{ {
if(ev4->mErrorCode == RsAuthSslError::NOT_A_FRIEND) if(ev4->mErrorCode == RsAuthSslError::NOT_A_FRIEND)
{ {
if ((popupflags & RS_POPUP_CONNECT_ATTEMPT) && !_disableAllToaster) if ((!!(popupflags & RsNotifyPopupFlags::RS_POPUP_CONNECT_ATTEMPT)) && !_disableAllToaster)
// id = gpgid // id = gpgid
// title = ssl name // title = ssl name
// msg = peer id // msg = peer id
@ -810,7 +810,7 @@ void NotifyQt::async_handleIncomingEvent(std::shared_ptr<const RsEvent> event)
if(ev5->mEventCode == RsChatServiceEventCode::CHAT_MESSAGE_RECEIVED) if(ev5->mEventCode == RsChatServiceEventCode::CHAT_MESSAGE_RECEIVED)
{ {
if (ev5->mCid.isPeerId() && (popupflags & RS_POPUP_CHAT) && !_disableAllToaster) if (ev5->mCid.isPeerId() && (!!(popupflags & RsNotifyPopupFlags::RS_POPUP_CHAT)) && !_disableAllToaster)
{ {
// TODO: fix for distant chat, look up if dstant chat uses RS_POPUP_CHAT // TODO: fix for distant chat, look up if dstant chat uses RS_POPUP_CHAT
ChatDialog *chatDialog = ChatDialog::getChat(ev5->mCid); ChatDialog *chatDialog = ChatDialog::getChat(ev5->mCid);
@ -822,7 +822,7 @@ void NotifyQt::async_handleIncomingEvent(std::shared_ptr<const RsEvent> event)
insertToaster(new ToasterItem(new ChatToaster(ev5->mCid.toPeerId(), QString::fromUtf8(ev5->mMsg.msg.c_str())))); insertToaster(new ToasterItem(new ChatToaster(ev5->mCid.toPeerId(), QString::fromUtf8(ev5->mMsg.msg.c_str()))));
} }
#ifdef RS_DIRECT_CHAT #ifdef RS_DIRECT_CHAT
else if (ev5->mCid.isBroadcast() && (popupflags & RS_POPUP_GROUPCHAT) && !_disableAllToaster) else if (ev5->mCid.isBroadcast() && (!!(popupflags & RsNotifyPopupFlags::RS_POPUP_GROUPCHAT)) && !_disableAllToaster)
{ {
MainWindow *mainWindow = MainWindow::getInstance(); MainWindow *mainWindow = MainWindow::getInstance();
if (mainWindow && mainWindow->isActiveWindow() && !mainWindow->isMinimized() if (mainWindow && mainWindow->isActiveWindow() && !mainWindow->isMinimized()
@ -832,7 +832,7 @@ void NotifyQt::async_handleIncomingEvent(std::shared_ptr<const RsEvent> event)
insertToaster(new ToasterItem(new GroupChatToaster(ev5->mCid.toPeerId(), QString::fromUtf8(ev5->mMsg.msg.c_str())))); insertToaster(new ToasterItem(new GroupChatToaster(ev5->mCid.toPeerId(), QString::fromUtf8(ev5->mMsg.msg.c_str()))));
} }
#endif #endif
else if (ev5->mCid.isLobbyId() && (popupflags & RS_POPUP_CHATLOBBY) && !_disableAllToaster) else if (ev5->mCid.isLobbyId() && (!!(popupflags & RsNotifyPopupFlags::RS_POPUP_CHATLOBBY)) && !_disableAllToaster)
{ {
ChatDialog *chatDialog = ChatDialog::getChat(ev5->mCid); ChatDialog *chatDialog = ChatDialog::getChat(ev5->mCid);
ChatWidget *chatWidget; ChatWidget *chatWidget;
@ -861,7 +861,7 @@ void NotifyQt::async_handleIncomingEvent(std::shared_ptr<const RsEvent> event)
switch(ev6->mEventCode) switch(ev6->mEventCode)
{ {
case RsSystemEventCode::TIME_SHIFT_PROBLEM: case RsSystemEventCode::TIME_SHIFT_PROBLEM:
displayErrorMessage(RS_SYS_WARNING,tr("System time mismatch"),tr("Time shift problem notification. Make sure your machine is on time, because it will break chat rooms.")); displayErrorMessage(RsNotifySysFlags::RS_SYS_WARNING,tr("System time mismatch"),tr("Time shift problem notification. Make sure your machine is on time, because it will break chat rooms."));
break; break;
case RsSystemEventCode::DISK_SPACE_ERROR: case RsSystemEventCode::DISK_SPACE_ERROR:
@ -870,7 +870,7 @@ void NotifyQt::async_handleIncomingEvent(std::shared_ptr<const RsEvent> event)
case RsSystemEventCode::DATA_STREAMING_ERROR: case RsSystemEventCode::DATA_STREAMING_ERROR:
case RsSystemEventCode::GENERAL_ERROR: case RsSystemEventCode::GENERAL_ERROR:
displayErrorMessage(RS_SYS_WARNING,tr("Internal error"),QString::fromUtf8(ev6->mErrorMsg.c_str())); displayErrorMessage(RsNotifySysFlags::RS_SYS_WARNING,tr("Internal error"),QString::fromUtf8(ev6->mErrorMsg.c_str()));
break; break;
default: break; default: break;
} }
@ -913,7 +913,7 @@ void NotifyQt::async_handleIncomingEvent(std::shared_ptr<const RsEvent> event)
startWaitingToasters(); startWaitingToasters();
} }
void NotifyQt::testToasters(uint notifyFlags, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin) void NotifyQt::testToasters(RsNotifyPopupFlags notifyFlags, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin)
{ {
QString title = tr("Test"); QString title = tr("Test");
QString message = tr("This is a test."); QString message = tr("This is a test.");
@ -922,37 +922,38 @@ void NotifyQt::testToasters(uint notifyFlags, /*RshareSettings::enumToasterPosit
RsPgpId pgpid = rsPeers->getGPGOwnId(); RsPgpId pgpid = rsPeers->getGPGOwnId();
uint pos = 0; uint pos = 0;
uint nf = (uint)notifyFlags;
while (notifyFlags) { while (nf) {
uint type = notifyFlags & (1 << pos); uint type = nf & (1 << pos);
notifyFlags &= ~(1 << pos); nf &= ~(1 << pos);
++pos; ++pos;
ToasterItem *toaster = NULL; ToasterItem *toaster = NULL;
switch(type) switch(type)
{ {
case RS_POPUP_ENCRYPTED_MSG: case (int)RsNotifyPopupFlags::RS_POPUP_ENCRYPTED_MSG:
toaster = new ToasterItem(new MessageToaster(std::string(), tr("Unknown title"), QString("[%1]").arg(tr("Encrypted message")))); toaster = new ToasterItem(new MessageToaster(std::string(), tr("Unknown title"), QString("[%1]").arg(tr("Encrypted message"))));
break; break;
case RS_POPUP_MSG: case (int)RsNotifyPopupFlags::RS_POPUP_MSG:
toaster = new ToasterItem(new MessageToaster(id.toStdString(), title, message)); toaster = new ToasterItem(new MessageToaster(id.toStdString(), title, message));
break; break;
case RS_POPUP_CONNECT: case (int)RsNotifyPopupFlags::RS_POPUP_CONNECT:
toaster = new ToasterItem(new OnlineToaster(id)); toaster = new ToasterItem(new OnlineToaster(id));
break; break;
case RS_POPUP_DOWNLOAD: case (int)RsNotifyPopupFlags::RS_POPUP_DOWNLOAD:
toaster = new ToasterItem(new DownloadToaster(RsFileHash::random())); toaster = new ToasterItem(new DownloadToaster(RsFileHash::random()));
break; break;
case RS_POPUP_CHAT: case (int)RsNotifyPopupFlags::RS_POPUP_CHAT:
toaster = new ToasterItem(new ChatToaster(id, message)); toaster = new ToasterItem(new ChatToaster(id, message));
break; break;
case RS_POPUP_GROUPCHAT: case (int)RsNotifyPopupFlags::RS_POPUP_GROUPCHAT:
#ifdef RS_DIRECT_CHAT #ifdef RS_DIRECT_CHAT
toaster = new ToasterItem(new GroupChatToaster(id, message)); toaster = new ToasterItem(new GroupChatToaster(id, message));
#endif // RS_DIRECT_CHAT #endif // RS_DIRECT_CHAT
break; break;
case RS_POPUP_CHATLOBBY: case (int)RsNotifyPopupFlags::RS_POPUP_CHATLOBBY:
{ {
std::list<RsGxsId> gxsid; std::list<RsGxsId> gxsid;
if(rsIdentity->getOwnIds(gxsid) && (gxsid.size() > 0)){ if(rsIdentity->getOwnIds(gxsid) && (gxsid.size() > 0)){
@ -960,7 +961,7 @@ void NotifyQt::testToasters(uint notifyFlags, /*RshareSettings::enumToasterPosit
} }
break; break;
} }
case RS_POPUP_CONNECT_ATTEMPT: case (int)RsNotifyPopupFlags::RS_POPUP_CONNECT_ATTEMPT:
toaster = new ToasterItem(new FriendRequestToaster(pgpid, id)); toaster = new ToasterItem(new FriendRequestToaster(pgpid, id));
break; break;
} }
@ -1332,18 +1333,18 @@ void NotifyQt::addToaster(uint notifyFlags, const std::string& id, const std::st
} }
#endif #endif
void NotifyQt::displayErrorMessage(int type,const QString& title,const QString& error_msg) void NotifyQt::displayErrorMessage(RsNotifySysFlags type,const QString& title,const QString& error_msg)
{ {
/* make a warning message */ /* make a warning message */
switch(type) switch(type)
{ {
case RS_SYS_ERROR: QMessageBox::critical(MainWindow::getInstance(),title,error_msg); case RsNotifySysFlags::RS_SYS_ERROR: QMessageBox::critical(MainWindow::getInstance(),title,error_msg);
break; break;
case RS_SYS_WARNING: QMessageBox::warning(MainWindow::getInstance(),title,error_msg); case RsNotifySysFlags::RS_SYS_WARNING: QMessageBox::warning(MainWindow::getInstance(),title,error_msg);
break; break;
case RS_SYS_INFO: QMessageBox::information(MainWindow::getInstance(),title,error_msg); case RsNotifySysFlags::RS_SYS_INFO: QMessageBox::information(MainWindow::getInstance(),title,error_msg);
break; break;
default: std::cerr << "Warning: unhandled system error type " << type << std::endl; default: std::cerr << "Warning: unhandled system error type " << type << std::endl;

View file

@ -30,6 +30,8 @@
#include <QPoint> #include <QPoint>
//#include <QMutex> //#include <QMutex>
#include "settings/rsharesettings.h"
#include <string> #include <string>
class QTimer; class QTimer;
@ -94,7 +96,7 @@ class NotifyQt: public QObject
void notifyChatFontChanged(); void notifyChatFontChanged();
void notifyChatStyleChanged(int /*ChatStyle::enumStyleType*/ styleType); void notifyChatStyleChanged(int /*ChatStyle::enumStyleType*/ styleType);
void testToasters(uint notifyFlags, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin); void testToasters(RsNotifyPopupFlags notifyFlags, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin);
void testToaster(ToasterNotify *toasterNotify, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin); void testToaster(ToasterNotify *toasterNotify, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin);
void testToaster(QString tag, ToasterNotify *toasterNotify, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin); void testToaster(QString tag, ToasterNotify *toasterNotify, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin);
#ifdef TO_REMOVE #ifdef TO_REMOVE
@ -154,7 +156,7 @@ class NotifyQt: public QObject
NotifyQt(); NotifyQt();
static void displayDiskSpaceWarning(int loc,int size_limit_mb); static void displayDiskSpaceWarning(int loc,int size_limit_mb);
static void displayErrorMessage(int type,const QString& title,const QString& error_msg); static void displayErrorMessage(RsNotifySysFlags type,const QString& title,const QString& error_msg);
static NotifyQt *_instance; static NotifyQt *_instance;
static bool _disableAllToaster; static bool _disableAllToaster;

View file

@ -354,18 +354,18 @@ void ChatPage::updateChatLobbyUserNotify()
void ChatPage::updateChatFlags() void ChatPage::updateChatFlags()
{ {
uint chatflags = 0; RsChatFlags chatflags(RsChatFlags::RS_CHAT_NONE);
if (ui.chat_NewWindow->isChecked()) if (ui.chat_NewWindow->isChecked())
chatflags |= RS_CHAT_OPEN; chatflags |= RsChatFlags::RS_CHAT_OPEN;
if (ui.chat_Focus->isChecked()) if (ui.chat_Focus->isChecked())
chatflags |= RS_CHAT_FOCUS; chatflags |= RsChatFlags::RS_CHAT_FOCUS;
if (ui.chat_tabbedWindow->isChecked()) if (ui.chat_tabbedWindow->isChecked())
chatflags |= RS_CHAT_TABBED_WINDOW; chatflags |= RsChatFlags::RS_CHAT_TABBED_WINDOW;
if (ui.chat_Blink->isChecked()) if (ui.chat_Blink->isChecked())
chatflags |= RS_CHAT_BLINK; chatflags |= RsChatFlags::RS_CHAT_BLINK;
Settings->setChatFlags(chatflags); Settings->setChatFlags((uint32_t)chatflags);
} }
void ChatPage::updateChatLobbyFlags() void ChatPage::updateChatLobbyFlags()
@ -473,12 +473,12 @@ ChatPage::load()
if(!gxs_id.isNull()) if(!gxs_id.isNull())
ui.chatLobbyIdentity_IC->setChosenId(gxs_id); ui.chatLobbyIdentity_IC->setChosenId(gxs_id);
uint chatflags = Settings->getChatFlags(); RsChatFlags chatflags = (RsChatFlags) Settings->getChatFlags();
whileBlocking(ui.chat_NewWindow)->setChecked(chatflags & RS_CHAT_OPEN); whileBlocking(ui.chat_NewWindow)->setChecked(!!(chatflags & RsChatFlags::RS_CHAT_OPEN));
whileBlocking(ui.chat_Focus)->setChecked(chatflags & RS_CHAT_FOCUS); whileBlocking(ui.chat_Focus)->setChecked(!!(chatflags & RsChatFlags::RS_CHAT_FOCUS));
whileBlocking(ui.chat_tabbedWindow)->setChecked(chatflags & RS_CHAT_TABBED_WINDOW); whileBlocking(ui.chat_tabbedWindow)->setChecked(!!(chatflags & RsChatFlags::RS_CHAT_TABBED_WINDOW));
whileBlocking(ui.chat_Blink)->setChecked(chatflags & RS_CHAT_BLINK); whileBlocking(ui.chat_Blink)->setChecked(!!(chatflags & RsChatFlags::RS_CHAT_BLINK));
uint chatLobbyFlags = Settings->getChatLobbyFlags(); uint chatLobbyFlags = Settings->getChatLobbyFlags();

View file

@ -49,8 +49,8 @@ MessagePage::MessagePage(QWidget * parent, Qt::WindowFlags flags)
ui.editpushButton->setEnabled(false); ui.editpushButton->setEnabled(false);
ui.deletepushButton->setEnabled(false); ui.deletepushButton->setEnabled(false);
ui.openComboBox->addItem(tr("A new tab"), RshareSettings::MSG_OPEN_TAB); ui.openComboBox->addItem(tr("A new tab"), (int)RsSettingsMsgOptions::MSG_OPEN_TAB);
ui.openComboBox->addItem(tr("A new window"), RshareSettings::MSG_OPEN_WINDOW); ui.openComboBox->addItem(tr("A new window"), (int)RsSettingsMsgOptions::MSG_OPEN_WINDOW);
// Font size // Font size
QFontDatabase db; QFontDatabase db;
@ -97,7 +97,7 @@ void MessagePage::distantMsgsComboBoxChanged(int i)
void MessagePage::updateMsgToReadOnActivate() { Settings->setMsgSetToReadOnActivate(ui.setMsgToReadOnActivate->isChecked()); } void MessagePage::updateMsgToReadOnActivate() { Settings->setMsgSetToReadOnActivate(ui.setMsgToReadOnActivate->isChecked()); }
void MessagePage::updateLoadEmbededImages() { Settings->setMsgLoadEmbeddedImages(ui.loadEmbeddedImages->isChecked()); } void MessagePage::updateLoadEmbededImages() { Settings->setMsgLoadEmbeddedImages(ui.loadEmbeddedImages->isChecked()); }
void MessagePage::updateMsgOpen() { Settings->setMsgOpen( static_cast<RshareSettings::enumMsgOpen>(ui.openComboBox->itemData(ui.openComboBox->currentIndex()).toInt()) ); } void MessagePage::updateMsgOpen() { Settings->setMsgOpen( (RsSettingsMsgOptions)(ui.openComboBox->itemData(ui.openComboBox->currentIndex()).toInt()) ); }
void MessagePage::updateDistantMsgs() { Settings->setValue("DistantMessages", ui.comboBox->currentIndex()); } void MessagePage::updateDistantMsgs() { Settings->setValue("DistantMessages", ui.comboBox->currentIndex()); }
void MessagePage::updateLoadEmoticons() { Settings->setValueToGroup("Messages", "Emoticons", ui.emoticonscheckBox->isChecked()); } void MessagePage::updateLoadEmoticons() { Settings->setValueToGroup("Messages", "Emoticons", ui.emoticonscheckBox->isChecked()); }
@ -128,7 +128,7 @@ MessagePage::load()
{ {
whileBlocking(ui.setMsgToReadOnActivate)->setChecked(Settings->getMsgSetToReadOnActivate()); whileBlocking(ui.setMsgToReadOnActivate)->setChecked(Settings->getMsgSetToReadOnActivate());
whileBlocking(ui.loadEmbeddedImages)->setChecked(Settings->getMsgLoadEmbeddedImages()); whileBlocking(ui.loadEmbeddedImages)->setChecked(Settings->getMsgLoadEmbeddedImages());
whileBlocking(ui.openComboBox)->setCurrentIndex(ui.openComboBox->findData(Settings->getMsgOpen())); whileBlocking(ui.openComboBox)->setCurrentIndex(ui.openComboBox->findData((uint)Settings->getMsgOpen()));
whileBlocking(ui.emoticonscheckBox)->setChecked(Settings->value("Emoticons", true).toBool()); whileBlocking(ui.emoticonscheckBox)->setChecked(Settings->value("Emoticons", true).toBool());
whileBlocking(ui.minimumFontSize)->setCurrentIndex(ui.minimumFontSize->findData(Settings->getMessageFontSize())); whileBlocking(ui.minimumFontSize)->setCurrentIndex(ui.minimumFontSize->findData(Settings->getMessageFontSize()));

View file

@ -29,6 +29,7 @@
#include "gui/common/UserNotify.h" #include "gui/common/UserNotify.h"
#include "gui/common/FeedNotify.h" #include "gui/common/FeedNotify.h"
#include "gui/common/ToasterNotify.h" #include "gui/common/ToasterNotify.h"
#include "gui/feeds/FeedItem.h"
#include "gui/notifyqt.h" #include "gui/notifyqt.h"
#include "gui/NewsFeed.h" #include "gui/NewsFeed.h"
#include "util/misc.h" #include "util/misc.h"
@ -180,32 +181,32 @@ NotifyPage::~NotifyPage()
{ {
} }
uint NotifyPage::getNewsFlags() RsFeedTypeFlags NotifyPage::getNewsFlags()
{ {
uint newsFlags = 0; RsFeedTypeFlags newsFlags(RsFeedTypeFlags::RS_FEED_TYPE_NONE);
if (ui.notify_Peers->isChecked()) if (ui.notify_Peers->isChecked())
newsFlags |= RS_FEED_TYPE_PEER; newsFlags |= RsFeedTypeFlags::RS_FEED_TYPE_PEER;
if (ui.notify_Circles->isChecked()) if (ui.notify_Circles->isChecked())
newsFlags |= RS_FEED_TYPE_CIRCLE; newsFlags |= RsFeedTypeFlags::RS_FEED_TYPE_CIRCLE;
if (ui.notify_Channels->isChecked()) if (ui.notify_Channels->isChecked())
newsFlags |= RS_FEED_TYPE_CHANNEL; newsFlags |= RsFeedTypeFlags::RS_FEED_TYPE_CHANNEL;
if (ui.notify_Forums->isChecked()) if (ui.notify_Forums->isChecked())
newsFlags |= RS_FEED_TYPE_FORUM; newsFlags |= RsFeedTypeFlags::RS_FEED_TYPE_FORUM;
if (ui.notify_Posted->isChecked()) if (ui.notify_Posted->isChecked())
newsFlags |= RS_FEED_TYPE_POSTED; newsFlags |= RsFeedTypeFlags::RS_FEED_TYPE_POSTED;
#if 0 #if 0
if (ui.notify_Blogs->isChecked()) if (ui.notify_Blogs->isChecked())
newsFlags |= RS_FEED_TYPE_BLOG; newsFlags |= RS_FEED_TYPE_BLOG;
#endif #endif
if (ui.notify_Messages->isChecked()) if (ui.notify_Messages->isChecked())
newsFlags |= RS_FEED_TYPE_MSG; newsFlags |= RsFeedTypeFlags::RS_FEED_TYPE_MSG;
if (ui.notify_Chat->isChecked()) if (ui.notify_Chat->isChecked())
newsFlags |= RS_FEED_TYPE_CHAT; newsFlags |= RsFeedTypeFlags::RS_FEED_TYPE_CHAT;
if (ui.notify_Security->isChecked()) if (ui.notify_Security->isChecked())
newsFlags |= RS_FEED_TYPE_SECURITY; newsFlags |= RsFeedTypeFlags::RS_FEED_TYPE_SECURITY;
if (ui.notify_SecurityIp->isChecked()) if (ui.notify_SecurityIp->isChecked())
newsFlags |= RS_FEED_TYPE_SECURITY_IP; newsFlags |= RsFeedTypeFlags::RS_FEED_TYPE_SECURITY_IP;
return newsFlags; return newsFlags;
} }
@ -220,24 +221,24 @@ QString NotifyPage::helpText() const
} }
uint NotifyPage::getNotifyFlags() RsNotifyPopupFlags NotifyPage::getNotifyFlags()
{ {
uint notifyFlags = 0; RsNotifyPopupFlags notifyFlags(RsNotifyPopupFlags::RS_POPUP_NONE);
if (ui.popup_Connect->isChecked()) if (ui.popup_Connect->isChecked())
notifyFlags |= RS_POPUP_CONNECT; notifyFlags |= RsNotifyPopupFlags::RS_POPUP_CONNECT;
if (ui.popup_NewMsg->isChecked()) if (ui.popup_NewMsg->isChecked())
notifyFlags |= RS_POPUP_MSG; notifyFlags |= RsNotifyPopupFlags::RS_POPUP_MSG;
if (ui.popup_DownloadFinished->isChecked()) if (ui.popup_DownloadFinished->isChecked())
notifyFlags |= RS_POPUP_DOWNLOAD; notifyFlags |= RsNotifyPopupFlags::RS_POPUP_DOWNLOAD;
if (ui.popup_PrivateChat->isChecked()) if (ui.popup_PrivateChat->isChecked())
notifyFlags |= RS_POPUP_CHAT; notifyFlags |= RsNotifyPopupFlags::RS_POPUP_CHAT;
if (ui.popup_GroupChat->isChecked()) if (ui.popup_GroupChat->isChecked())
notifyFlags |= RS_POPUP_GROUPCHAT; notifyFlags |= RsNotifyPopupFlags::RS_POPUP_GROUPCHAT;
if (ui.popup_ChatLobby->isChecked()) if (ui.popup_ChatLobby->isChecked())
notifyFlags |= RS_POPUP_CHATLOBBY; notifyFlags |= RsNotifyPopupFlags::RS_POPUP_CHATLOBBY;
if (ui.popup_ConnectAttempt->isChecked()) if (ui.popup_ConnectAttempt->isChecked())
notifyFlags |= RS_POPUP_CONNECT_ATTEMPT; notifyFlags |= RsNotifyPopupFlags::RS_POPUP_CONNECT_ATTEMPT;
return notifyFlags; return notifyFlags;
} }
@ -273,9 +274,9 @@ void NotifyPage::updateUserNotifySettings()
MainWindow::installNotifyIcons(); MainWindow::installNotifyIcons();
} }
void NotifyPage::updateMessageFlags() { Settings->setMessageFlags( ui.message_ConnectAttempt->isChecked()? RS_MESSAGE_CONNECT_ATTEMPT : 0); } void NotifyPage::updateMessageFlags() { Settings->setMessageFlags( ui.message_ConnectAttempt->isChecked()? RshareSettings::RS_MESSAGE_CONNECT_ATTEMPT : 0); }
void NotifyPage::updateNotifyFlags() { Settings->setNotifyFlags(getNotifyFlags()); } void NotifyPage::updateNotifyFlags() { Settings->setNotifyFlags((int)getNotifyFlags()); }
void NotifyPage::updateNewsFeedFlags(){ Settings->setNewsFeedFlags(getNewsFlags()); } void NotifyPage::updateNewsFeedFlags(){ Settings->setNewsFeedFlags((int)getNewsFlags()); }
void NotifyPage::updateSystrayChatLobby() { Settings->setDisplayTrayChatLobby(ui.systray_ChatLobby->isChecked()); } void NotifyPage::updateSystrayChatLobby() { Settings->setDisplayTrayChatLobby(ui.systray_ChatLobby->isChecked()); }
void NotifyPage::updateSystrayGroupChat() { Settings->setDisplayTrayGroupChat(ui.systray_GroupChat->isChecked()); MainWindow::installGroupChatNotifier(); } void NotifyPage::updateSystrayGroupChat() { Settings->setDisplayTrayGroupChat(ui.systray_GroupChat->isChecked()); MainWindow::installGroupChatNotifier(); }
@ -292,35 +293,35 @@ void NotifyPage::updateToasterPosition()
void NotifyPage::load() void NotifyPage::load()
{ {
/* Extract from rsNotify the flags */ /* Extract from rsNotify the flags */
uint notifyflags = Settings->getNotifyFlags() ; RsNotifyPopupFlags notifyflags = (RsNotifyPopupFlags)Settings->getNotifyFlags() ;
uint newsflags = Settings->getNewsFeedFlags() ; RsFeedTypeFlags newsflags = (RsFeedTypeFlags)Settings->getNewsFeedFlags() ;
uint messageflags = Settings->getMessageFlags() ; uint messageflags = Settings->getMessageFlags() ;
whileBlocking(ui.popup_Connect)->setChecked(notifyflags & RS_POPUP_CONNECT); whileBlocking(ui.popup_Connect)->setChecked(!!(notifyflags & RsNotifyPopupFlags::RS_POPUP_CONNECT));
whileBlocking(ui.popup_NewMsg)->setChecked(notifyflags & RS_POPUP_MSG); whileBlocking(ui.popup_NewMsg)->setChecked(!!(notifyflags & RsNotifyPopupFlags::RS_POPUP_MSG));
whileBlocking(ui.popup_DownloadFinished)->setChecked(notifyflags & RS_POPUP_DOWNLOAD); whileBlocking(ui.popup_DownloadFinished)->setChecked(!!(notifyflags & RsNotifyPopupFlags::RS_POPUP_DOWNLOAD));
whileBlocking(ui.popup_PrivateChat)->setChecked(notifyflags & RS_POPUP_CHAT); whileBlocking(ui.popup_PrivateChat)->setChecked(!!(notifyflags & RsNotifyPopupFlags::RS_POPUP_CHAT));
#ifdef RS_DIRECT_CHAT #ifdef RS_DIRECT_CHAT
whileBlocking(ui.popup_GroupChat)->setChecked(notifyflags & RS_POPUP_GROUPCHAT); whileBlocking(ui.popup_GroupChat)->setChecked(!!(notifyflags & RsNotifyPopupFlags::RS_POPUP_GROUPCHAT));
#endif // def RS_DIRECT_CHAT #endif // def RS_DIRECT_CHAT
whileBlocking(ui.popup_ChatLobby)->setChecked(notifyflags & RS_POPUP_CHATLOBBY); whileBlocking(ui.popup_ChatLobby)->setChecked(!!(notifyflags & RsNotifyPopupFlags::RS_POPUP_CHATLOBBY));
whileBlocking(ui.popup_ConnectAttempt)->setChecked(notifyflags & RS_POPUP_CONNECT_ATTEMPT); whileBlocking(ui.popup_ConnectAttempt)->setChecked(!!(notifyflags & RsNotifyPopupFlags::RS_POPUP_CONNECT_ATTEMPT));
whileBlocking(ui.notify_Peers)->setChecked(newsflags & RS_FEED_TYPE_PEER); whileBlocking(ui.notify_Peers )->setChecked(!!(newsflags & RsFeedTypeFlags::RS_FEED_TYPE_PEER));
whileBlocking(ui.notify_Circles)->setChecked(newsflags & RS_FEED_TYPE_CIRCLE); whileBlocking(ui.notify_Circles )->setChecked(!!(newsflags & RsFeedTypeFlags::RS_FEED_TYPE_CIRCLE));
whileBlocking(ui.notify_Channels)->setChecked(newsflags & RS_FEED_TYPE_CHANNEL); whileBlocking(ui.notify_Channels )->setChecked(!!(newsflags & RsFeedTypeFlags::RS_FEED_TYPE_CHANNEL));
whileBlocking(ui.notify_Forums)->setChecked(newsflags & RS_FEED_TYPE_FORUM); whileBlocking(ui.notify_Forums )->setChecked(!!(newsflags & RsFeedTypeFlags::RS_FEED_TYPE_FORUM));
whileBlocking(ui.notify_Posted)->setChecked(newsflags & RS_FEED_TYPE_POSTED); whileBlocking(ui.notify_Posted )->setChecked(!!(newsflags & RsFeedTypeFlags::RS_FEED_TYPE_POSTED));
#if 0 #if 0
whileBlocking(ui.notify_Blogs)->setChecked(newsflags & RS_FEED_TYPE_BLOG); whileBlocking(ui.notify_Blogs)->setChecked(newsflags & RS_FEED_TYPE_BLOG);
#endif #endif
whileBlocking(ui.notify_Chat)->setChecked(newsflags & RS_FEED_TYPE_CHAT); whileBlocking(ui.notify_Chat )->setChecked(!!(newsflags & RsFeedTypeFlags::RS_FEED_TYPE_CHAT));
whileBlocking(ui.notify_Messages)->setChecked(newsflags & RS_FEED_TYPE_MSG); whileBlocking(ui.notify_Messages )->setChecked(!!(newsflags & RsFeedTypeFlags::RS_FEED_TYPE_MSG));
whileBlocking(ui.notify_Chat)->setChecked(newsflags & RS_FEED_TYPE_CHAT); whileBlocking(ui.notify_Chat )->setChecked(!!(newsflags & RsFeedTypeFlags::RS_FEED_TYPE_CHAT));
whileBlocking(ui.notify_Security)->setChecked(newsflags & RS_FEED_TYPE_SECURITY); whileBlocking(ui.notify_Security )->setChecked(!!(newsflags & RsFeedTypeFlags::RS_FEED_TYPE_SECURITY));
whileBlocking(ui.notify_SecurityIp)->setChecked(newsflags & RS_FEED_TYPE_SECURITY_IP); whileBlocking(ui.notify_SecurityIp)->setChecked(!!(newsflags & RsFeedTypeFlags::RS_FEED_TYPE_SECURITY_IP));
whileBlocking(ui.message_ConnectAttempt)->setChecked(messageflags & RS_MESSAGE_CONNECT_ATTEMPT); whileBlocking(ui.message_ConnectAttempt)->setChecked(messageflags & RshareSettings::RS_MESSAGE_CONNECT_ATTEMPT);
whileBlocking(ui.systray_GroupChat)->setChecked(Settings->getDisplayTrayGroupChat()); whileBlocking(ui.systray_GroupChat)->setChecked(Settings->getDisplayTrayGroupChat());
whileBlocking(ui.systray_ChatLobby)->setChecked(Settings->getDisplayTrayChatLobby()); whileBlocking(ui.systray_ChatLobby)->setChecked(Settings->getDisplayTrayChatLobby());

View file

@ -23,8 +23,10 @@
#include <retroshare-gui/configpage.h> #include <retroshare-gui/configpage.h>
#include "ui_NotifyPage.h" #include "ui_NotifyPage.h"
#include "rsharesettings.h"
#include "gui/chat/ChatLobbyUserNotify.h" #include "gui/chat/ChatLobbyUserNotify.h"
#include "gui/feeds/FeedItem.h"
#include "gui/common/FilesDefs.h" #include "gui/common/FilesDefs.h"
class UserNotify; class UserNotify;
@ -102,8 +104,8 @@ private slots:
void updateToasterPosition(); void updateToasterPosition();
private: private:
uint getNewsFlags(); RsFeedTypeFlags getNewsFlags();
uint getNotifyFlags(); RsNotifyPopupFlags getNotifyFlags();
QList<FeedNotifySetting> mFeedNotifySettingList; QList<FeedNotifySetting> mFeedNotifySettingList;
QList<ToasterNotifySetting> mToasterNotifySettingList; QList<ToasterNotifySetting> mToasterNotifySettingList;

View file

@ -27,8 +27,11 @@
#include <lang/languagesupport.h> #include <lang/languagesupport.h>
#include <rshare.h> #include <rshare.h>
#include "rsharesettings.h"
#include "rsharesettings.h" #include "rsharesettings.h"
#include "gui/MainWindow.h" #include "gui/MainWindow.h"
#include "gui/chat/ChatWidget.h"
#include "gui/feeds/FeedItem.h"
#ifdef RS_JSONAPI #ifdef RS_JSONAPI
#include <retroshare/rsjsonapi.h> #include <retroshare/rsjsonapi.h>
@ -133,15 +136,15 @@ void RshareSettings::initSettings()
/* defaults here are not ideal.... but dusent matter */ /* defaults here are not ideal.... but dusent matter */
uint defChat = RS_CHAT_OPEN; uint defChat = (uint32_t)RsChatFlags::RS_CHAT_OPEN;
// This is not default... RS_CHAT_FOCUS. // This is not default... RS_CHAT_FOCUS.
uint defNotify = (RS_POPUP_CONNECT | RS_POPUP_MSG); RsNotifyPopupFlags defNotify = (RsNotifyPopupFlags::RS_POPUP_CONNECT | RsNotifyPopupFlags::RS_POPUP_MSG);
uint defNewsFeed = (RS_FEED_TYPE_MSG | RS_FEED_TYPE_FILES | RS_FEED_TYPE_SECURITY | RS_FEED_TYPE_SECURITY_IP | RS_FEED_TYPE_CIRCLE | RS_FEED_TYPE_CHANNEL |RS_FEED_TYPE_FORUM | RS_FEED_TYPE_POSTED); RsFeedTypeFlags defNewsFeed = (RsFeedTypeFlags::RS_FEED_TYPE_MSG | RsFeedTypeFlags::RS_FEED_TYPE_FILES | RsFeedTypeFlags::RS_FEED_TYPE_SECURITY | RsFeedTypeFlags::RS_FEED_TYPE_SECURITY_IP | RsFeedTypeFlags::RS_FEED_TYPE_CIRCLE | RsFeedTypeFlags::RS_FEED_TYPE_CHANNEL |RsFeedTypeFlags::RS_FEED_TYPE_FORUM | RsFeedTypeFlags::RS_FEED_TYPE_POSTED);
setDefault(SETTING_NEWSFEED_FLAGS, defNewsFeed); setDefault(SETTING_NEWSFEED_FLAGS, (int)defNewsFeed);
setDefault(SETTING_CHAT_FLAGS, defChat); setDefault(SETTING_CHAT_FLAGS, defChat);
setDefault(SETTING_NOTIFY_FLAGS, defNotify); setDefault(SETTING_NOTIFY_FLAGS, (int)defNotify);
setDefault("DisplayTrayGroupChat", true); setDefault("DisplayTrayGroupChat", true);
setDefault("AddFeedsAtEnd", false); setDefault("AddFeedsAtEnd", false);
@ -1023,30 +1026,31 @@ void RshareSettings::setMsgLoadEmbeddedImages(bool value)
setValueToGroup("Message", "LoadEmbeddedImages", value); setValueToGroup("Message", "LoadEmbeddedImages", value);
} }
RshareSettings::enumMsgOpen RshareSettings::getMsgOpen() RsSettingsMsgOptions RshareSettings::getMsgOpen()
{ {
enumMsgOpen value = (enumMsgOpen) valueFromGroup("Message", "msgOpen", MSG_OPEN_TAB).toInt(); RsSettingsMsgOptions value = (RsSettingsMsgOptions) valueFromGroup("Message", "msgOpen", (int)RsSettingsMsgOptions::MSG_OPEN_TAB).toInt();
switch (value) { switch (value) {
case MSG_OPEN_TAB: default:
case MSG_OPEN_WINDOW: case RsSettingsMsgOptions::MSG_OPEN_TAB:
case RsSettingsMsgOptions::MSG_OPEN_WINDOW:
return value; return value;
} }
return MSG_OPEN_TAB; return RsSettingsMsgOptions::MSG_OPEN_TAB;
} }
void RshareSettings::setMsgOpen(enumMsgOpen value) void RshareSettings::setMsgOpen(RsSettingsMsgOptions value)
{ {
switch (value) { switch (value) {
case MSG_OPEN_TAB: case RsSettingsMsgOptions::MSG_OPEN_TAB:
case MSG_OPEN_WINDOW: case RsSettingsMsgOptions::MSG_OPEN_WINDOW:
break; break;
default: default:
value = MSG_OPEN_TAB; value = RsSettingsMsgOptions::MSG_OPEN_TAB;
} }
setValueToGroup("Message", "msgOpen", value); setValueToGroup("Message", "msgOpen", (int)value);
} }
/* Forum */ /* Forum */

View file

@ -28,6 +28,7 @@
#include <QSettings> #include <QSettings>
#include <stdint.h> #include <stdint.h>
#include <retroshare/rsflags.h>
#include <gui/linetypes.h> #include <gui/linetypes.h>
#include "rsettings.h" #include "rsettings.h"
@ -56,6 +57,38 @@ public:
bool mOpenAllInNewTab; bool mOpenAllInNewTab;
bool mHideTabBarWithOneTab; bool mHideTabBarWithOneTab;
}; };
enum class RsNotifyPopupFlags: uint32_t {
RS_POPUP_NONE = 0x0000,
RS_POPUP_MSG = 0x0001,
RS_POPUP_CHAT = 0x0002,
RS_POPUP_CONNECT = 0x0008,
// RS_SYSTRAY_GROUP_MSG = 0x0010,
RS_POPUP_DOWNLOAD = 0x0020,
RS_POPUP_GROUPCHAT = 0x0040,
RS_POPUP_CHATLOBBY = 0x0080,
RS_POPUP_CONNECT_ATTEMPT = 0x0100,
RS_POPUP_ENCRYPTED_MSG = 0x0200,
};
RS_REGISTER_ENUM_FLAGS_TYPE(RsNotifyPopupFlags);
//enum class RsNotifySystrayFlags: uint32_t {
// RS_SYSTRAY_GROUP_MSG = 0x0010,
//}
enum class RsNotifySysFlags: uint32_t {
RS_SYS_ERROR = 0x0001,
RS_SYS_WARNING = 0x0002,
RS_SYS_INFO = 0x0004,
};
RS_REGISTER_ENUM_FLAGS_TYPE(RsNotifySysFlags);
enum class RsSettingsMsgOptions: uint8_t
{
MSG_OPEN_NONE = 0x00,
MSG_OPEN_TAB = 0x01,
MSG_OPEN_WINDOW = 0x02,
};
RS_REGISTER_ENUM_FLAGS_TYPE(RsSettingsMsgOptions);
/** Handles saving and restoring RShares's settings /** Handles saving and restoring RShares's settings
* *
@ -86,11 +119,10 @@ public:
TOASTERPOS_BOTTOMRIGHT TOASTERPOS_BOTTOMRIGHT
}; };
enum enumMsgOpen enum enumMsgOptions :uint32_t
{ {
MSG_OPEN_TAB, RS_MESSAGE_CONNECT_ATTEMPT = 0x0001,
MSG_OPEN_WINDOW };
};
public: public:
/* create settings object */ /* create settings object */
@ -191,8 +223,8 @@ public:
uint getNewsFeedFlags(); uint getNewsFeedFlags();
void setNewsFeedFlags(uint flags); void setNewsFeedFlags(uint flags);
uint getChatFlags(); uint getChatFlags();
void setChatFlags(uint flags); void setChatFlags(uint flags);
uint getChatLobbyFlags(); uint getChatLobbyFlags();
void setChatLobbyFlags(uint flags); void setChatLobbyFlags(uint flags);
@ -305,8 +337,8 @@ public:
bool getMsgLoadEmbeddedImages(); bool getMsgLoadEmbeddedImages();
void setMsgLoadEmbeddedImages(bool value); void setMsgLoadEmbeddedImages(bool value);
enumMsgOpen getMsgOpen(); RsSettingsMsgOptions getMsgOpen();
void setMsgOpen(enumMsgOpen value); void setMsgOpen(RsSettingsMsgOptions value);
/* Forum */ /* Forum */
bool getForumMsgSetToReadOnActivate(); bool getForumMsgSetToReadOnActivate();

View file

@ -731,7 +731,7 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
// QObject::connect(notify,SIGNAL(diskFull(int,int)) ,w ,SLOT(displayDiskSpaceWarning(int,int))) ; // QObject::connect(notify,SIGNAL(diskFull(int,int)) ,w ,SLOT(displayDiskSpaceWarning(int,int))) ;
// QObject::connect(notify,SIGNAL(filesPostModChanged(bool)) ,w ,SLOT(postModDirectories(bool)) ,Qt::QueuedConnection ) ; // QObject::connect(notify,SIGNAL(filesPostModChanged(bool)) ,w ,SLOT(postModDirectories(bool)) ,Qt::QueuedConnection ) ;
// QObject::connect(notify,SIGNAL(transfersChanged()) ,w->transfersDialog ,SLOT(insertTransfers() )) ; // QObject::connect(notify,SIGNAL(transfersChanged()) ,w->transfersDialog ,SLOT(insertTransfers() )) ;
QObject::connect(notify,SIGNAL(publicChatChanged(int)) ,w->friendsDialog ,SLOT(publicChatChanged(int) )); // QObject::connect(notify,SIGNAL(publicChatChanged(int)) ,w->friendsDialog ,SLOT(publicChatChanged(int) ));
// QObject::connect(notify,SIGNAL(neighboursChanged()) ,w->friendsDialog->networkDialog ,SLOT(securedUpdateDisplay())) ; // QObject::connect(notify,SIGNAL(neighboursChanged()) ,w->friendsDialog->networkDialog ,SLOT(securedUpdateDisplay())) ;
// QObject::connect(notify,SIGNAL(chatStatusChanged(const QString&,const QString&,bool)),w->friendsDialog,SLOT(updatePeerStatusString(const QString&,const QString&,bool))); // QObject::connect(notify,SIGNAL(chatStatusChanged(const QString&,const QString&,bool)),w->friendsDialog,SLOT(updatePeerStatusString(const QString&,const QString&,bool)));
@ -752,11 +752,10 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
} }
/* Startup a Timer to keep the gui's updated */ /* Startup a Timer to keep the gui's updated */
QTimer *timer = new QTimer(w); //QTimer *timer = new QTimer(w);
timer -> connect(timer, SIGNAL(timeout()), notify, SLOT(UpdateGUI())); //timer -> connect(timer, SIGNAL(timeout()), notify, SLOT(UpdateGUI()));
timer->start(1000); //timer->start(1000);
//notify->enable() ; // enable notification system after GUI creation, to avoid data races in Qt.
notify->enable() ; // enable notification system after GUI creation, to avoid data races in Qt.
// Read webui params in settings. We cannot save them to some webui.cfg because cfg needs the node id and // Read webui params in settings. We cannot save them to some webui.cfg because cfg needs the node id and
// jsonapi is started before node ID selection in retroshare-service. // jsonapi is started before node ID selection in retroshare-service.