fixed up top bar tooltips to display what the numbers actually mean

This commit is contained in:
csoler 2020-04-27 21:56:43 +02:00
parent 28a6b43357
commit f5af7dfeb3
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
14 changed files with 40 additions and 14 deletions

View file

@ -1110,10 +1110,16 @@ int pqissl::SSL_Connection_Complete()
if(rsEvents) if(rsEvents)
{ {
X509 *x509 = SSL_get_peer_certificate(ssl_connection); X509 *x509 = SSL_get_peer_certificate(ssl_connection);
auto ev = std::make_shared<RsAuthSslConnectionAutenticationEvent>();
ev->mSslId = RsX509Cert::getCertSslId(*x509); if(x509)
ev->mErrorCode = RsAuthSslError::PEER_REFUSED_CONNECTION; {
rsEvents->postEvent(ev); auto ev = std::make_shared<RsAuthSslConnectionAutenticationEvent>();
ev->mSslId = RsX509Cert::getCertSslId(*x509);
ev->mErrorCode = RsAuthSslError::PEER_REFUSED_CONNECTION;
if(!ev->mSslId.isNull())
rsEvents->postEvent(ev);
}
} }
std::string out; std::string out;

View file

@ -31,6 +31,7 @@ public:
TransferUserNotify(QObject *parent = 0); TransferUserNotify(QObject *parent = 0);
virtual bool hasSetting(QString *name, QString *group); virtual bool hasSetting(QString *name, QString *group);
virtual QString textInfo() const override { return tr("completed transfer(s)"); }
private: private:
virtual QIcon getIcon(); virtual QIcon getIcon();

View file

@ -483,7 +483,7 @@ void MainWindow::initStackedPage()
for (notifyIt = notify.begin(); notifyIt != notify.end(); ++notifyIt) { for (notifyIt = notify.begin(); notifyIt != notify.end(); ++notifyIt) {
UserNotify *userNotify = notifyIt->first->getUserNotify(); UserNotify *userNotify = notifyIt->first->getUserNotify();
if (userNotify) { if (userNotify) {
userNotify->initialize(ui->toolBarPage, notifyIt->second.first, notifyIt->second.second); userNotify->initialize(ui->toolBarPage, notifyIt->second.first, notifyIt->second.second,userNotify->textInfo());
connect(userNotify, SIGNAL(countChanged()), this, SLOT(updateTrayCombine())); connect(userNotify, SIGNAL(countChanged()), this, SLOT(updateTrayCombine()));
userNotifyList.push_back(userNotify); userNotifyList.push_back(userNotify);
} }

View file

@ -21,6 +21,7 @@
#include "retroshare/rsposted.h" #include "retroshare/rsposted.h"
#include "PostedUserNotify.h" #include "PostedUserNotify.h"
#include "gui/MainWindow.h" #include "gui/MainWindow.h"
#include "gui/common/FilesDefs.h"
PostedUserNotify::PostedUserNotify(RsGxsIfaceHelper *ifaceImpl, const GxsGroupFrameDialog *g, QObject *parent) : PostedUserNotify::PostedUserNotify(RsGxsIfaceHelper *ifaceImpl, const GxsGroupFrameDialog *g, QObject *parent) :
GxsUserNotify(ifaceImpl, g, parent) GxsUserNotify(ifaceImpl, g, parent)
@ -37,12 +38,12 @@ bool PostedUserNotify::hasSetting(QString *name, QString *group)
QIcon PostedUserNotify::getIcon() QIcon PostedUserNotify::getIcon()
{ {
return QIcon(":/icons/png/posted.png"); return FilesDefs::getIconFromQtResourcePath(":/icons/png/posted.png");
} }
QIcon PostedUserNotify::getMainIcon(bool hasNew) QIcon PostedUserNotify::getMainIcon(bool hasNew)
{ {
return hasNew ? QIcon(":/icons/png/posted-notify.png") : QIcon(":/icons/png/posted.png"); return hasNew ? FilesDefs::getIconFromQtResourcePath(":/icons/png/posted-notify.png") : FilesDefs::getIconFromQtResourcePath(":/icons/png/posted.png");
} }
void PostedUserNotify::iconClicked() void PostedUserNotify::iconClicked()

View file

@ -31,6 +31,7 @@ public:
PostedUserNotify(RsGxsIfaceHelper *ifaceImpl, const GxsGroupFrameDialog *g, QObject *parent = 0); PostedUserNotify(RsGxsIfaceHelper *ifaceImpl, const GxsGroupFrameDialog *g, QObject *parent = 0);
virtual bool hasSetting(QString *name, QString *group); virtual bool hasSetting(QString *name, QString *group);
virtual QString textInfo() const override { return tr("new board post(s)"); }
private: private:
virtual QIcon getIcon(); virtual QIcon getIcon();

View file

@ -41,6 +41,7 @@ public:
~ChatUserNotify(); ~ChatUserNotify();
virtual bool hasSetting(QString *name, QString *group); virtual bool hasSetting(QString *name, QString *group);
virtual QString textInfo() const override { return tr("mention(s)"); }
private slots: private slots:
void chatMessageReceived(ChatMessage msg); void chatMessageReceived(ChatMessage msg);

View file

@ -88,11 +88,12 @@ void UserNotify::setNotifyEnabled(bool enabled, bool combined, bool blink)
Settings->endGroup(); Settings->endGroup();
} }
void UserNotify::initialize(QToolBar *mainToolBar, QAction *mainAction, QListWidgetItem *listItem) void UserNotify::initialize(QToolBar *mainToolBar, QAction *mainAction, QListWidgetItem *listItem,const QString& subtext)
{ {
mMainAction = mainAction; mMainAction = mainAction;
if (mMainAction) { if (mMainAction) {
mButtonText = mMainAction->text(); mButtonText = mMainAction->text();
mButtonText2 = subtext;
if (mainToolBar) { if (mainToolBar) {
mMainToolButton = dynamic_cast<QToolButton*>(mainToolBar->widgetForAction(mMainAction)); mMainToolButton = dynamic_cast<QToolButton*>(mainToolBar->widgetForAction(mMainAction));
} }
@ -165,7 +166,10 @@ void UserNotify::update()
if (mMainAction) { if (mMainAction) {
mMainAction->setIcon(getMainIcon(count > 0)); mMainAction->setIcon(getMainIcon(count > 0));
mMainAction->setText((count > 0) ? QString("%1 (%2)").arg(mButtonText).arg(count) : mButtonText);
mMainAction->setText((count > 0) ? (!mButtonText2.isNull())?QString("%1 (%2)").arg(mButtonText).arg(count).arg(mButtonText2) : QString("%1 (%2 %3)").arg(mButtonText).arg(count) : mButtonText);
mMainAction->setToolTip((count > 0) ? (!mButtonText2.isNull())?QString("%1 %2").arg(count).arg(mButtonText2) : QString("%1").arg(count) : mButtonText);
QFont font = mMainAction->font(); QFont font = mMainAction->font();
font.setBold(count > 0); font.setBold(count > 0);

View file

@ -37,12 +37,17 @@ public:
UserNotify(QObject *parent = 0); UserNotify(QObject *parent = 0);
virtual ~UserNotify(); virtual ~UserNotify();
void initialize(QToolBar *mainToolBar, QAction *mainAction, QListWidgetItem *listItem); void initialize(QToolBar *mainToolBar, QAction *mainAction, QListWidgetItem *listItem,const QString& subtext);
void createIcons(QMenu *notifyMenu); void createIcons(QMenu *notifyMenu);
QSystemTrayIcon* getTrayIcon(){ return mTrayIcon;} QSystemTrayIcon* getTrayIcon(){ return mTrayIcon;}
QAction* getNotifyIcon(){ return mNotifyIcon;} QAction* getNotifyIcon(){ return mNotifyIcon;}
virtual bool hasSetting(QString */*name*/, QString */*group*/) { return false; } virtual bool hasSetting(QString */*name*/, QString */*group*/) { return false; }
// UserNotify is used to display tooltips when some services have no messages and so on, in the format of "Name (43242 new messages)"
// This method is used to pass the string that comes after the number.
virtual QString textInfo() const { return QString() ; }
bool notifyEnabled(); bool notifyEnabled();
bool notifyCombined(); bool notifyCombined();
bool notifyBlink(); bool notifyBlink();
@ -82,6 +87,7 @@ private:
QAction *mNotifyIcon; QAction *mNotifyIcon;
unsigned int mNewCount; unsigned int mNewCount;
QString mButtonText; QString mButtonText;
QString mButtonText2;
bool mLastBlinking; bool mLastBlinking;
}; };

View file

@ -29,6 +29,7 @@ class NewsFeedUserNotify : public UserNotify
{ {
Q_OBJECT Q_OBJECT
virtual QString textInfo() const override { return tr("logged event(s)"); }
public: public:
NewsFeedUserNotify(NewsFeed *newsFeed, QObject *parent = 0); NewsFeedUserNotify(NewsFeed *newsFeed, QObject *parent = 0);

View file

@ -21,6 +21,7 @@
#include "retroshare/rsgxschannels.h" #include "retroshare/rsgxschannels.h"
#include "GxsChannelUserNotify.h" #include "GxsChannelUserNotify.h"
#include "gui/MainWindow.h" #include "gui/MainWindow.h"
#include "gui/common/FilesDefs.h"
GxsChannelUserNotify::GxsChannelUserNotify(RsGxsIfaceHelper *ifaceImpl, const GxsGroupFrameDialog *g, QObject *parent) : GxsChannelUserNotify::GxsChannelUserNotify(RsGxsIfaceHelper *ifaceImpl, const GxsGroupFrameDialog *g, QObject *parent) :
GxsUserNotify(ifaceImpl, g, parent) GxsUserNotify(ifaceImpl, g, parent)
@ -37,12 +38,12 @@ bool GxsChannelUserNotify::hasSetting(QString *name, QString *group)
QIcon GxsChannelUserNotify::getIcon() QIcon GxsChannelUserNotify::getIcon()
{ {
return QIcon(":/icons/png/channel.png"); return FilesDefs::getIconFromQtResourcePath(":/icons/png/channel.png");
} }
QIcon GxsChannelUserNotify::getMainIcon(bool hasNew) QIcon GxsChannelUserNotify::getMainIcon(bool hasNew)
{ {
return hasNew ? QIcon(":/icons/png/channels-notify.png") : QIcon(":/icons/png/channel.png"); return hasNew ? FilesDefs::getIconFromQtResourcePath(":/icons/png/channels-notify.png") : FilesDefs::getIconFromQtResourcePath(":/icons/png/channel.png");
} }
void GxsChannelUserNotify::iconClicked() void GxsChannelUserNotify::iconClicked()

View file

@ -32,6 +32,7 @@ public:
GxsChannelUserNotify(RsGxsIfaceHelper *ifaceImpl, const GxsGroupFrameDialog *g, QObject *parent = 0); GxsChannelUserNotify(RsGxsIfaceHelper *ifaceImpl, const GxsGroupFrameDialog *g, QObject *parent = 0);
virtual bool hasSetting(QString *name, QString *group); virtual bool hasSetting(QString *name, QString *group);
virtual QString textInfo() const override { return tr("new message(s)"); }
private: private:
virtual QIcon getIcon(); virtual QIcon getIcon();

View file

@ -19,6 +19,7 @@
*******************************************************************************/ *******************************************************************************/
#include "retroshare/rsgxsforums.h" #include "retroshare/rsgxsforums.h"
#include "gui/common/FilesDefs.h"
#include "GxsForumUserNotify.h" #include "GxsForumUserNotify.h"
#include "gui/MainWindow.h" #include "gui/MainWindow.h"
@ -38,12 +39,12 @@ bool GxsForumUserNotify::hasSetting(QString *name, QString *group)
QIcon GxsForumUserNotify::getIcon() QIcon GxsForumUserNotify::getIcon()
{ {
return QIcon(":/icons/png/forums.png"); return FilesDefs::getIconFromQtResourcePath(":/icons/png/forums.png");
} }
QIcon GxsForumUserNotify::getMainIcon(bool hasNew) QIcon GxsForumUserNotify::getMainIcon(bool hasNew)
{ {
return hasNew ? QIcon(":/icons/png/forums-notify.png") : QIcon(":/icons/png/forums.png"); return hasNew ? FilesDefs::getIconFromQtResourcePath(":/icons/png/forums-notify.png") : FilesDefs::getIconFromQtResourcePath(":/icons/png/forums.png");
} }
void GxsForumUserNotify::iconClicked() void GxsForumUserNotify::iconClicked()

View file

@ -31,6 +31,7 @@ public:
GxsForumUserNotify(RsGxsIfaceHelper *ifaceImpl, const GxsGroupFrameDialog *g, QObject *parent = 0); GxsForumUserNotify(RsGxsIfaceHelper *ifaceImpl, const GxsGroupFrameDialog *g, QObject *parent = 0);
virtual bool hasSetting(QString *name, QString *group); virtual bool hasSetting(QString *name, QString *group);
virtual QString textInfo() const override { return tr("new message(s)"); }
private: private:
virtual QIcon getIcon(); virtual QIcon getIcon();

View file

@ -31,6 +31,7 @@ public:
MessageUserNotify(QObject *parent = 0); MessageUserNotify(QObject *parent = 0);
virtual bool hasSetting(QString *name, QString *group); virtual bool hasSetting(QString *name, QString *group);
virtual QString textInfo() const override { return tr("new mail(s)"); }
private: private:
virtual QIcon getIcon(); virtual QIcon getIcon();