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())
{
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));
}
@ -787,7 +787,7 @@ void ChatLobbyWidget::showLobby(QTreeWidgetItem *item)
showBlankPage(id) ;
else
{
_lobby_infos[id].dialog->showDialog(RS_CHAT_FOCUS);
_lobby_infos[id].dialog->showDialog(RsChatFlags::RS_CHAT_FOCUS);
if (_lobby_infos[id].dialog->isWindowed())
showBlankPage(id, true);
}
@ -850,7 +850,7 @@ bool ChatLobbyWidget::showLobbyAnchor(ChatLobbyId id, QString anchor)
if(_lobby_infos.find(id) == _lobby_infos.end()) {
showBlankPage(id) ;
} else {
_lobby_infos[id].dialog->showDialog(RS_CHAT_FOCUS);
_lobby_infos[id].dialog->showDialog(RsChatFlags::RS_CHAT_FOCUS);
if (_lobby_infos[id].dialog->isWindowed())
showBlankPage(id, true);

View file

@ -643,7 +643,7 @@ void GenCertDialog::genPerson()
std::cout << "RsAccounts::GenerateSSLCertificate" << std::endl;
// 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);

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)
{
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);
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);
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);
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);
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);
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);
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);
}
@ -389,25 +389,25 @@ void NewsFeed::handleCircleEvent(std::shared_ptr<const RsEvent> event)
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_REQUEST:
// only show membership requests if we're an admin of that circle
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)
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;
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_LEAVE:
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;
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_ID_ADDED_TO_INVITEE_LIST:
if(rsIdentity->isOwnId(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
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;
@ -415,9 +415,9 @@ void NewsFeed::handleCircleEvent(std::shared_ptr<const RsEvent> event)
if(rsIdentity->isOwnId(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
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;
@ -451,7 +451,7 @@ void NewsFeed::handleConnectionEvent(std::shared_ptr<const RsEvent> event)
addFeedItemIfUnique(new SecurityIpItem(
this, e.mSslId, e.mOwnLocator.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);
break;
default: break;
@ -469,31 +469,31 @@ void NewsFeed::handleSecurityEvent(std::shared_ptr<const RsEvent> event)
#ifdef NEWS_DEBUG
std::cerr << "NotifyQt: handling security event from (" << e.mSslId << "," << e.mPgpId << ") error code: " << (int)e.mErrorCode << std::endl;
#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 );
return;
}
uint32_t FeedItemType=0;
RsFeedTypeFlags FeedItemType(RsFeedTypeFlags::RS_FEED_TYPE_NONE);
switch(e.mErrorCode)
{
case RsAuthSslError::NO_CERTIFICATE_SUPPLIED: // fallthrough
case RsAuthSslError::MISMATCHED_PGP_ID: // fallthrough
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:
FeedItemType = RS_FEED_ITEM_SEC_WRONG_SIGNATURE; break;
FeedItemType = RsFeedTypeFlags::RS_FEED_ITEM_SEC_WRONG_SIGNATURE; break;
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:
FeedItemType = RS_FEED_ITEM_SEC_IP_BLACKLISTED; break;
FeedItemType = RsFeedTypeFlags::RS_FEED_ITEM_SEC_IP_BLACKLISTED; break;
case RsAuthSslError::MISSING_CERTIFICATE:
FeedItemType = RS_FEED_ITEM_SEC_MISSING_CERTIFICATE; break;
FeedItemType = RsFeedTypeFlags::RS_FEED_ITEM_SEC_MISSING_CERTIFICATE; break;
default:
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 );
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 + ")"));
}
void NewsFeed::testFeeds(uint /*notifyFlags*/)
void NewsFeed::testFeeds(RsFeedTypeFlags /*notifyFlags*/)
{
#ifdef TO_REMOVE
if (!instance) {

View file

@ -24,6 +24,7 @@
#include <retroshare-gui/mainpage.h>
#include "gui/feeds/FeedHolder.h"
#include "gui/feeds/FeedItem.h"
#include <retroshare-gui/RsAutoUpdatePage.h>
#define IMAGE_NEWSFEED ":/icons/png/newsfeed.png"
@ -67,19 +68,19 @@ public:
/** Default Destructor */
virtual ~NewsFeed();
virtual QIcon iconPixmap() const { return QIcon(IMAGE_NEWSFEED) ; } //MainPage
virtual QString pageName() const { return tr("Activity") ; } //MainPage
virtual QString helpText() const { return ""; } //MainPage
virtual QIcon iconPixmap() const override { return QIcon(IMAGE_NEWSFEED) ; } //MainPage
virtual QString pageName() const override { return tr("Activity") ; } //MainPage
virtual QString helpText() const override { return ""; } //MainPage
virtual UserNotify *createUserNotify(QObject *parent) override;
/* FeedHolder Functions (for FeedItem functionality) */
virtual QScrollArea *getScrollArea();
virtual void deleteFeedItem(FeedItem *item, uint32_t type);
virtual void openChat(const RsPeerId& peerId);
virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const QVector<RsGxsMessageId> &versions, const RsGxsMessageId &msgId, const QString &title);
virtual QScrollArea *getScrollArea()override ;
virtual void deleteFeedItem(FeedItem *item, uint32_t type)override ;
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)override ;
static void testFeeds(uint notifyFlags);
static void testFeeds(RsFeedTypeFlags notifyFlags);
static void testFeed(FeedNotify *feedNotify);
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
{
ChatDialog* chatDialog = ChatDialog::getChat(chatId, Settings->getChatFlags());
ChatDialog* chatDialog = ChatDialog::getChat(chatId, (RsChatFlags)Settings->getChatFlags());
if (chatDialog) {
chatroomFound.append(link.name());
} else {

View file

@ -86,7 +86,7 @@ void ChatDialog::init(const ChatId &id, const QString &title)
return NULL;
}
/*static*/ ChatDialog* ChatDialog::getChat(ChatId id, uint chatflags)
/*static*/ ChatDialog* ChatDialog::getChat(ChatId id, RsChatFlags chatflags)
{
if(id.isBroadcast() || id.isNotSet())
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(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()) {
ChatLobbyDialog* cld = new ChatLobbyDialog(id.toLobbyId());
cld->init(ChatId(), "");
@ -176,7 +176,7 @@ void ChatDialog::init(const ChatId &id, const QString &title)
// play sound when recv a 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)
cd->addChatMsg(msg);
else
@ -185,7 +185,7 @@ void ChatDialog::init(const ChatId &id, const QString &title)
/*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.
// 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 <retroshare/rsmsgs.h>
class ChatWidget;
#include "gui/chat/ChatWidget.h"
class RSStyle;
class ChatDialog : public QWidget
@ -37,14 +38,14 @@ class ChatDialog : public QWidget
public:
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 chatFriend(const ChatId &peerId, bool forceFocus = true);
static void chatFriend(const RsPgpId &gpgId, bool forceFocus = true);
static void closeChat(const ChatId &chat_id);
static void chatMessageReceived(ChatMessage msg);
virtual void showDialog(uint /*chatflags*/) {}
virtual void showDialog(RsChatFlags /*chatflags*/) {}
virtual ChatWidget *getChatWidget() = 0;
virtual bool hasPeerStatus() = 0;

View file

@ -930,9 +930,9 @@ bool ChatLobbyDialog::canClose()
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) {
mPCWindow->showDialog(this, chatflags);
@ -1020,5 +1020,5 @@ void ChatLobbyDialog::setWindowed(bool windowed)
}
show();
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:
void handleLobbyEvent(RsChatLobbyEventCode event_type, const RsGxsId& gxs_id, const QString& str);
virtual void showDialog(uint chatflags);
virtual ChatWidget *getChatWidget();
virtual bool hasPeerStatus() { return false; }
virtual bool notifyBlink();
virtual void showDialog(RsChatFlags chatflags) override;
virtual ChatWidget *getChatWidget() override;
virtual bool hasPeerStatus() override{ return false; }
virtual bool notifyBlink() override;
void setIdentity(const RsGxsId& gxs_id);
bool isParticipantMuted(const RsGxsId &participant);
ChatLobbyId id() const { return lobbyId ;}

View file

@ -132,7 +132,7 @@ void ChatUserNotify::iconClicked()
{
ChatDialog *chatDialog = NULL;
// 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) {
MainWindow::showWindow(MainWindow::Friends);
@ -144,7 +144,7 @@ void ChatUserNotify::chatMessageReceived(ChatMessage msg)
{
if(!msg.chat_id.isBroadcast()
&&( ChatDialog::getExistingChat(msg.chat_id)
|| (Settings->getChatFlags() & RS_CHAT_OPEN)
|| (Settings->getChatFlags() & (uint32_t)RsChatFlags::RS_CHAT_OPEN)
|| msg.chat_id.isDistantChatId()))
{
ChatDialog::chatMessageReceived(msg);

View file

@ -53,6 +53,17 @@ namespace Ui {
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
// Plugins can implement this interface to provide their own buttons
class ChatWidgetHolder

View file

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

View file

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

View file

@ -49,7 +49,7 @@ static PopupChatWindow *instance = NULL;
/*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) {
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)
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) {
ui.tabWidget->setCurrentWidget(dialog);
}
@ -352,7 +352,7 @@ void PopupChatWindow::calculateTitle(ChatDialog *dialog)
icon = FilesDefs::getIconFromQtResourcePath(IMAGE_TYPING);
} else if (hasNewMessages) {
icon = FilesDefs::getIconFromQtResourcePath(IMAGE_CHAT);
if (Settings->getChatFlags() & RS_CHAT_BLINK) {
if (Settings->getChatFlags() & (uint32_t)RsChatFlags::RS_CHAT_BLINK) {
mBlinkIcon = icon;
} else {
mBlinkIcon = QIcon();
@ -423,7 +423,7 @@ void PopupChatWindow::tabNewMessage(ChatDialog *dialog)
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);
if (pcw) {
ChatDialog *pcd = chatDialog;

View file

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

View file

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

View file

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

View file

@ -21,10 +21,70 @@
#ifndef _FEED_ITEM_H
#define _FEED_ITEM_H
#include <retroshare/rsflags.h>
#include <QWidget>
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
{
Q_OBJECT

View file

@ -40,7 +40,7 @@
#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)
{
setup();
@ -92,7 +92,7 @@ void GxsCircleItem::setup()
// 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->iconLabel->setPixmap(pixmap);
@ -105,7 +105,7 @@ void GxsCircleItem::setup()
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->iconLabel->setPixmap(pixmap);
@ -118,7 +118,7 @@ void GxsCircleItem::setup()
connect(ui->membershipButton, SIGNAL(clicked()), this, SLOT(requestCircleSubscription()));
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->iconLabel->setPixmap(pixmap);
@ -127,7 +127,7 @@ void GxsCircleItem::setup()
ui->membershipButton->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)
{
@ -148,7 +148,7 @@ void GxsCircleItem::setup()
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));
@ -162,7 +162,7 @@ void GxsCircleItem::setup()
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));
@ -198,7 +198,7 @@ void GxsCircleItem::showCircleDetails()
{
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();
}
@ -215,9 +215,9 @@ void GxsCircleItem::toggleCircleMembership()
return;
}
if(mType == RS_FEED_ITEM_CIRCLE_INVITE_REC)
if(mType == RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_INVITE_REC)
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);
else
RsErr() << __PRETTY_FUNCTION__ << ": inconsistent call. mType is " << mType << std::endl;
@ -225,12 +225,12 @@ void GxsCircleItem::toggleCircleMembership()
void GxsCircleItem::toggleCircleInvite()
{
if(mType == RS_FEED_ITEM_CIRCLE_MEMB_JOIN)
if(mType == RsFeedTypeFlags::RS_FEED_ITEM_CIRCLE_MEMB_JOIN)
RsThread::async([this]()
{
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]()
{
rsGxsCircles->inviteIdsToCircle(std::set<RsGxsId>( { mGxsId } ),mCircleId);

View file

@ -37,7 +37,7 @@ class GxsCircleItem : public FeedItem
public:
/** 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();
uint64_t uniqueIdentifier() const override;
@ -60,7 +60,7 @@ private slots:
private:
void setup();
uint32_t mType;
RsFeedTypeFlags mType;
RsGxsCircleId mCircleId;
RsGxsId mGxsId;

View file

@ -40,14 +40,14 @@
****/
/** 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),
ui(new(Ui::SecurityIpItem))
{
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),
ui(new(Ui::SecurityIpItem))
{
@ -81,7 +81,7 @@ void SecurityIpItem::setup()
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()
@ -97,12 +97,12 @@ void SecurityIpItem::updateItemStatic()
/* Specific type */
switch (mType) {
case RS_FEED_ITEM_SEC_IP_BLACKLISTED:
case RsFeedTypeFlags::RS_FEED_ITEM_SEC_IP_BLACKLISTED:
ui->rsBanListButton->setDisabled(mIsTest);
ui->ipAddrReported->hide();
ui->ipAddrReportedLabel->hide();
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();
break;
default:
@ -126,7 +126,7 @@ void SecurityIpItem::updateItem()
if(!RsAutoUpdatePage::eventsLocked()) {
switch (mType) {
case RS_FEED_ITEM_SEC_IP_BLACKLISTED:
case RsFeedTypeFlags::RS_FEED_ITEM_SEC_IP_BLACKLISTED:
ui->titleLabel->setText(RsBanListDefs::resultString(mResult));
ui->ipAddr->setText(QString::fromStdString(mIpAddr));
@ -145,7 +145,7 @@ void SecurityIpItem::updateItem()
}
}
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->ipAddr->setText(QString::fromStdString(mIpAddr));
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:
/** 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, const std::string& ipAddrReported, 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, RsFeedTypeFlags type, bool isTest);
void updateItemStatic();
@ -60,7 +60,7 @@ private slots:
void banIpListChanged(const QString &ipAddress);
private:
uint32_t mType;
RsFeedTypeFlags mType;
RsPeerId mSslId;
std::string mIpAddr;
std::string mIpAddrReported;

View file

@ -45,7 +45,7 @@
****/
/** 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),
mGpgId(gpgId), mSslId(sslId), mSslCn(sslCn), mIP(ip_address), mType(type), mIsHome(isHome)
{
@ -105,7 +105,7 @@ SecurityItem::~SecurityItem()
}
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()
@ -122,35 +122,35 @@ void SecurityItem::updateItemStatic()
switch(mType)
{
case RS_FEED_ITEM_SEC_CONNECT_ATTEMPT:
case RsFeedTypeFlags::RS_FEED_ITEM_SEC_CONNECT_ATTEMPT:
title = tr("Connect Attempt");
requestLabel->show();
avatar->setDefaultAvatar(":images/avatar_request.png");
break;
case RS_FEED_ITEM_SEC_AUTH_DENIED:
case RsFeedTypeFlags::RS_FEED_ITEM_SEC_AUTH_DENIED:
title = tr("Connection refused by remote peer");
requestLabel->hide();
avatar->setDefaultAvatar(":images/avatar_refused.png");
break;
case RS_FEED_ITEM_SEC_UNKNOWN_IN:
case RsFeedTypeFlags::RS_FEED_ITEM_SEC_UNKNOWN_IN:
title = tr("Unknown (Incoming) Connect Attempt");
requestLabel->hide();
avatar->setDefaultAvatar(":images/avatar_request_unknown.png");
break;
case RS_FEED_ITEM_SEC_UNKNOWN_OUT:
case RsFeedTypeFlags::RS_FEED_ITEM_SEC_UNKNOWN_OUT:
title = tr("Unknown (Outgoing) Connect Attempt");
requestLabel->hide();
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.");
requestLabel->hide();
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())+")";
avatar->setDefaultAvatar(":images/avatar_request_unknown.png");
requestLabel->show();
break;
case RS_FEED_ITEM_SEC_BAD_CERTIFICATE:
case RsFeedTypeFlags::RS_FEED_ITEM_SEC_BAD_CERTIFICATE:
{
RsPeerDetails details ;
if(rsPeers->getGPGDetails(mGpgId, details))
@ -161,7 +161,7 @@ void SecurityItem::updateItemStatic()
}
avatar->setDefaultAvatar(":icons/ssl.png");
break;
case RS_FEED_ITEM_SEC_INTERNAL_ERROR:
case RsFeedTypeFlags::RS_FEED_ITEM_SEC_INTERNAL_ERROR:
title = tr("Certificate caused an internal error.");
requestLabel->hide();
break;
@ -232,7 +232,7 @@ void SecurityItem::updateItem()
removeFriendButton->hide();
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"));
friendRequesttoolButton->hide();

View file

@ -38,7 +38,7 @@ class SecurityItem : public FeedItem, private Ui::SecurityItem
public:
/** 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();
void updateItemStatic();
@ -66,7 +66,7 @@ private:
RsPeerId mSslId;
std::string mSslCn;
std::string mIP;
uint32_t mType;
RsFeedTypeFlags mType;
bool mIsHome;
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 */
HistoryMsg msg;
if (rsHistory->getMessage(msgId, msg) == false) {
@ -254,7 +254,7 @@ void ImHistoryBrowser::historyChanged(uint msgId, int type)
return;
}
if (type == NOTIFY_TYPE_DEL) {
if (type == RsChatHistoryChangeFlags::DEL) {
/* history message removed */
int count = ui.listWidget->count();
for (int i = 0; i < count; ++i) {
@ -267,7 +267,7 @@ void ImHistoryBrowser::historyChanged(uint msgId, int type)
return;
}
if (type == NOTIFY_TYPE_MOD) {
if (type == RsChatHistoryChangeFlags::MOD) {
/* clear history */
// As no ChatId nor msgId are send via Notify,
// only check if history of this chat is empty before clear our list.

View file

@ -52,7 +52,7 @@ private slots:
void createThreadFinished();
void createThreadProgress(int current, int count);
void historyChanged(uint msgId, int type);
void historyChanged(uint msgId, RsChatHistoryChangeFlags type);
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::SIGNATURE_FAILED:
break;
}
default:
break;
}
}
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::SIGNATURE_FAILED:
break;
default:
break;
}
}
@ -1088,11 +1090,13 @@ void MessagesDialog::doubleClicked(const QModelIndex& proxy_index)
}
/* edit message */
switch (Settings->getMsgOpen()) {
case RshareSettings::MSG_OPEN_TAB:
switch (Settings->getMsgOpen())
{
default:
case RsSettingsMsgOptions::MSG_OPEN_TAB:
openAsTab();
break;
case RshareSettings::MSG_OPEN_WINDOW:
case RsSettingsMsgOptions::MSG_OPEN_WINDOW:
openAsWindow();
break;
}

View file

@ -715,7 +715,7 @@ void NotifyQt::async_handleIncomingEvent(std::shared_ptr<const RsEvent> event)
/* Finally Check for PopupMessages / System Error Messages */
uint popupflags = Settings->getNotifyFlags();
RsNotifyPopupFlags popupflags = (RsNotifyPopupFlags)Settings->getNotifyFlags();
auto insertToaster = [this](ToasterItem *toaster) {
@ -736,7 +736,7 @@ void NotifyQt::async_handleIncomingEvent(std::shared_ptr<const RsEvent> event)
{
SoundManager::play(SOUND_MESSAGE_ARRIVED);
if((popupflags & RS_POPUP_MSG) && !_disableAllToaster)
if((!!(popupflags & RsNotifyPopupFlags::RS_POPUP_MSG)) && !_disableAllToaster)
{
for(auto msgid:ev1->mChangedMsgIds)
{
@ -757,7 +757,7 @@ void NotifyQt::async_handleIncomingEvent(std::shared_ptr<const RsEvent> event)
{
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)));
}
return;
@ -771,7 +771,7 @@ void NotifyQt::async_handleIncomingEvent(std::shared_ptr<const RsEvent> event)
{
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)));
}
return;
@ -783,7 +783,7 @@ void NotifyQt::async_handleIncomingEvent(std::shared_ptr<const RsEvent> event)
{
if(ev4->mErrorCode == RsAuthSslError::NOT_A_FRIEND)
{
if ((popupflags & RS_POPUP_CONNECT_ATTEMPT) && !_disableAllToaster)
if ((!!(popupflags & RsNotifyPopupFlags::RS_POPUP_CONNECT_ATTEMPT)) && !_disableAllToaster)
// id = gpgid
// title = ssl name
// 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->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
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()))));
}
#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();
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()))));
}
#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);
ChatWidget *chatWidget;
@ -861,7 +861,7 @@ void NotifyQt::async_handleIncomingEvent(std::shared_ptr<const RsEvent> event)
switch(ev6->mEventCode)
{
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;
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::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;
default: break;
}
@ -913,7 +913,7 @@ void NotifyQt::async_handleIncomingEvent(std::shared_ptr<const RsEvent> event)
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 message = tr("This is a test.");
@ -922,37 +922,38 @@ void NotifyQt::testToasters(uint notifyFlags, /*RshareSettings::enumToasterPosit
RsPgpId pgpid = rsPeers->getGPGOwnId();
uint pos = 0;
uint nf = (uint)notifyFlags;
while (notifyFlags) {
uint type = notifyFlags & (1 << pos);
notifyFlags &= ~(1 << pos);
while (nf) {
uint type = nf & (1 << pos);
nf &= ~(1 << pos);
++pos;
ToasterItem *toaster = NULL;
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"))));
break;
case RS_POPUP_MSG:
case (int)RsNotifyPopupFlags::RS_POPUP_MSG:
toaster = new ToasterItem(new MessageToaster(id.toStdString(), title, message));
break;
case RS_POPUP_CONNECT:
case (int)RsNotifyPopupFlags::RS_POPUP_CONNECT:
toaster = new ToasterItem(new OnlineToaster(id));
break;
case RS_POPUP_DOWNLOAD:
case (int)RsNotifyPopupFlags::RS_POPUP_DOWNLOAD:
toaster = new ToasterItem(new DownloadToaster(RsFileHash::random()));
break;
case RS_POPUP_CHAT:
case (int)RsNotifyPopupFlags::RS_POPUP_CHAT:
toaster = new ToasterItem(new ChatToaster(id, message));
break;
case RS_POPUP_GROUPCHAT:
case (int)RsNotifyPopupFlags::RS_POPUP_GROUPCHAT:
#ifdef RS_DIRECT_CHAT
toaster = new ToasterItem(new GroupChatToaster(id, message));
#endif // RS_DIRECT_CHAT
break;
case RS_POPUP_CHATLOBBY:
case (int)RsNotifyPopupFlags::RS_POPUP_CHATLOBBY:
{
std::list<RsGxsId> gxsid;
if(rsIdentity->getOwnIds(gxsid) && (gxsid.size() > 0)){
@ -960,7 +961,7 @@ void NotifyQt::testToasters(uint notifyFlags, /*RshareSettings::enumToasterPosit
}
break;
}
case RS_POPUP_CONNECT_ATTEMPT:
case (int)RsNotifyPopupFlags::RS_POPUP_CONNECT_ATTEMPT:
toaster = new ToasterItem(new FriendRequestToaster(pgpid, id));
break;
}
@ -1332,18 +1333,18 @@ void NotifyQt::addToaster(uint notifyFlags, const std::string& id, const std::st
}
#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 */
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;
case RS_SYS_WARNING: QMessageBox::warning(MainWindow::getInstance(),title,error_msg);
case RsNotifySysFlags::RS_SYS_WARNING: QMessageBox::warning(MainWindow::getInstance(),title,error_msg);
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;
default: std::cerr << "Warning: unhandled system error type " << type << std::endl;

View file

@ -30,6 +30,8 @@
#include <QPoint>
//#include <QMutex>
#include "settings/rsharesettings.h"
#include <string>
class QTimer;
@ -94,7 +96,7 @@ class NotifyQt: public QObject
void notifyChatFontChanged();
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(QString tag, ToasterNotify *toasterNotify, /*RshareSettings::enumToasterPosition*/ int position, QPoint margin);
#ifdef TO_REMOVE
@ -154,7 +156,7 @@ class NotifyQt: public QObject
NotifyQt();
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 bool _disableAllToaster;

View file

@ -354,18 +354,18 @@ void ChatPage::updateChatLobbyUserNotify()
void ChatPage::updateChatFlags()
{
uint chatflags = 0;
RsChatFlags chatflags(RsChatFlags::RS_CHAT_NONE);
if (ui.chat_NewWindow->isChecked())
chatflags |= RS_CHAT_OPEN;
chatflags |= RsChatFlags::RS_CHAT_OPEN;
if (ui.chat_Focus->isChecked())
chatflags |= RS_CHAT_FOCUS;
chatflags |= RsChatFlags::RS_CHAT_FOCUS;
if (ui.chat_tabbedWindow->isChecked())
chatflags |= RS_CHAT_TABBED_WINDOW;
chatflags |= RsChatFlags::RS_CHAT_TABBED_WINDOW;
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()
@ -473,12 +473,12 @@ ChatPage::load()
if(!gxs_id.isNull())
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_Focus)->setChecked(chatflags & RS_CHAT_FOCUS);
whileBlocking(ui.chat_tabbedWindow)->setChecked(chatflags & RS_CHAT_TABBED_WINDOW);
whileBlocking(ui.chat_Blink)->setChecked(chatflags & RS_CHAT_BLINK);
whileBlocking(ui.chat_NewWindow)->setChecked(!!(chatflags & RsChatFlags::RS_CHAT_OPEN));
whileBlocking(ui.chat_Focus)->setChecked(!!(chatflags & RsChatFlags::RS_CHAT_FOCUS));
whileBlocking(ui.chat_tabbedWindow)->setChecked(!!(chatflags & RsChatFlags::RS_CHAT_TABBED_WINDOW));
whileBlocking(ui.chat_Blink)->setChecked(!!(chatflags & RsChatFlags::RS_CHAT_BLINK));
uint chatLobbyFlags = Settings->getChatLobbyFlags();

View file

@ -49,8 +49,8 @@ MessagePage::MessagePage(QWidget * parent, Qt::WindowFlags flags)
ui.editpushButton->setEnabled(false);
ui.deletepushButton->setEnabled(false);
ui.openComboBox->addItem(tr("A new tab"), RshareSettings::MSG_OPEN_TAB);
ui.openComboBox->addItem(tr("A new window"), RshareSettings::MSG_OPEN_WINDOW);
ui.openComboBox->addItem(tr("A new tab"), (int)RsSettingsMsgOptions::MSG_OPEN_TAB);
ui.openComboBox->addItem(tr("A new window"), (int)RsSettingsMsgOptions::MSG_OPEN_WINDOW);
// Font size
QFontDatabase db;
@ -97,7 +97,7 @@ void MessagePage::distantMsgsComboBoxChanged(int i)
void MessagePage::updateMsgToReadOnActivate() { Settings->setMsgSetToReadOnActivate(ui.setMsgToReadOnActivate->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::updateLoadEmoticons() { Settings->setValueToGroup("Messages", "Emoticons", ui.emoticonscheckBox->isChecked()); }
@ -128,7 +128,7 @@ MessagePage::load()
{
whileBlocking(ui.setMsgToReadOnActivate)->setChecked(Settings->getMsgSetToReadOnActivate());
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.minimumFontSize)->setCurrentIndex(ui.minimumFontSize->findData(Settings->getMessageFontSize()));

View file

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

View file

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

View file

@ -27,8 +27,11 @@
#include <lang/languagesupport.h>
#include <rshare.h>
#include "rsharesettings.h"
#include "rsharesettings.h"
#include "gui/MainWindow.h"
#include "gui/chat/ChatWidget.h"
#include "gui/feeds/FeedItem.h"
#ifdef RS_JSONAPI
#include <retroshare/rsjsonapi.h>
@ -133,15 +136,15 @@ void RshareSettings::initSettings()
/* 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.
uint defNotify = (RS_POPUP_CONNECT | 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);
RsNotifyPopupFlags defNotify = (RsNotifyPopupFlags::RS_POPUP_CONNECT | RsNotifyPopupFlags::RS_POPUP_MSG);
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_NOTIFY_FLAGS, defNotify);
setDefault(SETTING_NOTIFY_FLAGS, (int)defNotify);
setDefault("DisplayTrayGroupChat", true);
setDefault("AddFeedsAtEnd", false);
@ -1023,30 +1026,31 @@ void RshareSettings::setMsgLoadEmbeddedImages(bool 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) {
case MSG_OPEN_TAB:
case MSG_OPEN_WINDOW:
default:
case RsSettingsMsgOptions::MSG_OPEN_TAB:
case RsSettingsMsgOptions::MSG_OPEN_WINDOW:
return value;
}
return MSG_OPEN_TAB;
return RsSettingsMsgOptions::MSG_OPEN_TAB;
}
void RshareSettings::setMsgOpen(enumMsgOpen value)
void RshareSettings::setMsgOpen(RsSettingsMsgOptions value)
{
switch (value) {
case MSG_OPEN_TAB:
case MSG_OPEN_WINDOW:
case RsSettingsMsgOptions::MSG_OPEN_TAB:
case RsSettingsMsgOptions::MSG_OPEN_WINDOW:
break;
default:
value = MSG_OPEN_TAB;
value = RsSettingsMsgOptions::MSG_OPEN_TAB;
}
setValueToGroup("Message", "msgOpen", value);
setValueToGroup("Message", "msgOpen", (int)value);
}
/* Forum */

View file

@ -28,6 +28,7 @@
#include <QSettings>
#include <stdint.h>
#include <retroshare/rsflags.h>
#include <gui/linetypes.h>
#include "rsettings.h"
@ -56,6 +57,38 @@ public:
bool mOpenAllInNewTab;
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
*
@ -86,11 +119,10 @@ public:
TOASTERPOS_BOTTOMRIGHT
};
enum enumMsgOpen
{
MSG_OPEN_TAB,
MSG_OPEN_WINDOW
};
enum enumMsgOptions :uint32_t
{
RS_MESSAGE_CONNECT_ATTEMPT = 0x0001,
};
public:
/* create settings object */
@ -191,8 +223,8 @@ public:
uint getNewsFeedFlags();
void setNewsFeedFlags(uint flags);
uint getChatFlags();
void setChatFlags(uint flags);
uint getChatFlags();
void setChatFlags(uint flags);
uint getChatLobbyFlags();
void setChatLobbyFlags(uint flags);
@ -305,8 +337,8 @@ public:
bool getMsgLoadEmbeddedImages();
void setMsgLoadEmbeddedImages(bool value);
enumMsgOpen getMsgOpen();
void setMsgOpen(enumMsgOpen value);
RsSettingsMsgOptions getMsgOpen();
void setMsgOpen(RsSettingsMsgOptions value);
/* Forum */
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(filesPostModChanged(bool)) ,w ,SLOT(postModDirectories(bool)) ,Qt::QueuedConnection ) ;
// 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(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 */
QTimer *timer = new QTimer(w);
timer -> connect(timer, SIGNAL(timeout()), notify, SLOT(UpdateGUI()));
timer->start(1000);
notify->enable() ; // enable notification system after GUI creation, to avoid data races in Qt.
//QTimer *timer = new QTimer(w);
//timer -> connect(timer, SIGNAL(timeout()), notify, SLOT(UpdateGUI()));
//timer->start(1000);
//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
// jsonapi is started before node ID selection in retroshare-service.