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)
{
X509 *x509 = SSL_get_peer_certificate(ssl_connection);
auto ev = std::make_shared<RsAuthSslConnectionAutenticationEvent>();
ev->mSslId = RsX509Cert::getCertSslId(*x509);
ev->mErrorCode = RsAuthSslError::PEER_REFUSED_CONNECTION;
rsEvents->postEvent(ev);
if(x509)
{
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;

View File

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

View File

@ -483,7 +483,7 @@ void MainWindow::initStackedPage()
for (notifyIt = notify.begin(); notifyIt != notify.end(); ++notifyIt) {
UserNotify *userNotify = notifyIt->first->getUserNotify();
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()));
userNotifyList.push_back(userNotify);
}

View File

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

View File

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

View File

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

View File

@ -88,11 +88,12 @@ void UserNotify::setNotifyEnabled(bool enabled, bool combined, bool blink)
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;
if (mMainAction) {
mButtonText = mMainAction->text();
mButtonText2 = subtext;
if (mainToolBar) {
mMainToolButton = dynamic_cast<QToolButton*>(mainToolBar->widgetForAction(mMainAction));
}
@ -165,7 +166,10 @@ void UserNotify::update()
if (mMainAction) {
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();
font.setBold(count > 0);

View File

@ -37,12 +37,17 @@ public:
UserNotify(QObject *parent = 0);
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);
QSystemTrayIcon* getTrayIcon(){ return mTrayIcon;}
QAction* getNotifyIcon(){ return mNotifyIcon;}
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 notifyCombined();
bool notifyBlink();
@ -82,6 +87,7 @@ private:
QAction *mNotifyIcon;
unsigned int mNewCount;
QString mButtonText;
QString mButtonText2;
bool mLastBlinking;
};

View File

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

View File

@ -21,6 +21,7 @@
#include "retroshare/rsgxschannels.h"
#include "GxsChannelUserNotify.h"
#include "gui/MainWindow.h"
#include "gui/common/FilesDefs.h"
GxsChannelUserNotify::GxsChannelUserNotify(RsGxsIfaceHelper *ifaceImpl, const GxsGroupFrameDialog *g, QObject *parent) :
GxsUserNotify(ifaceImpl, g, parent)
@ -37,12 +38,12 @@ bool GxsChannelUserNotify::hasSetting(QString *name, QString *group)
QIcon GxsChannelUserNotify::getIcon()
{
return QIcon(":/icons/png/channel.png");
return FilesDefs::getIconFromQtResourcePath(":/icons/png/channel.png");
}
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()

View File

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

View File

@ -19,6 +19,7 @@
*******************************************************************************/
#include "retroshare/rsgxsforums.h"
#include "gui/common/FilesDefs.h"
#include "GxsForumUserNotify.h"
#include "gui/MainWindow.h"
@ -38,12 +39,12 @@ bool GxsForumUserNotify::hasSetting(QString *name, QString *group)
QIcon GxsForumUserNotify::getIcon()
{
return QIcon(":/icons/png/forums.png");
return FilesDefs::getIconFromQtResourcePath(":/icons/png/forums.png");
}
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()

View File

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

View File

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