Compare commits
2 commits
dev
...
bugfix/ope
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
669cb06d89 | ||
|
|
95d48d8a2d |
4 changed files with 17 additions and 1 deletions
|
|
@ -243,6 +243,9 @@ void CoreController::initNotificationHandler()
|
||||||
&ConnectionController::closeConnection);
|
&ConnectionController::closeConnection);
|
||||||
connect(this, &CoreController::translationsUpdated, m_notificationHandler.get(), &NotificationHandler::onTranslationsUpdated);
|
connect(this, &CoreController::translationsUpdated, m_notificationHandler.get(), &NotificationHandler::onTranslationsUpdated);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
auto* trayHandler = qobject_cast<SystemTrayNotificationHandler*>(m_notificationHandler.get());
|
||||||
|
connect(this, &CoreController::websiteUrlChanged, trayHandler, &SystemTrayNotificationHandler::updateWebsiteUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreController::updateTranslator(const QLocale &locale)
|
void CoreController::updateTranslator(const QLocale &locale)
|
||||||
|
|
@ -279,6 +282,7 @@ void CoreController::updateTranslator(const QLocale &locale)
|
||||||
m_engine->retranslate();
|
m_engine->retranslate();
|
||||||
|
|
||||||
emit translationsUpdated();
|
emit translationsUpdated();
|
||||||
|
emit websiteUrlChanged(m_languageModel->getCurrentSiteUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreController::initErrorMessagesHandler()
|
void CoreController::initErrorMessagesHandler()
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@
|
||||||
#include <QQmlContext>
|
#include <QQmlContext>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
|
||||||
|
#include "ui/systemtray_notificationhandler.h"
|
||||||
|
|
||||||
#include "ui/controllers/api/apiConfigsController.h"
|
#include "ui/controllers/api/apiConfigsController.h"
|
||||||
#include "ui/controllers/api/apiSettingsController.h"
|
#include "ui/controllers/api/apiSettingsController.h"
|
||||||
#include "ui/controllers/api/apiPremV1MigrationController.h"
|
#include "ui/controllers/api/apiPremV1MigrationController.h"
|
||||||
|
|
@ -61,6 +63,7 @@ public:
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void translationsUpdated();
|
void translationsUpdated();
|
||||||
|
void websiteUrlChanged(const QString &newUrl);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initModels();
|
void initModels();
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ SystemTrayNotificationHandler::SystemTrayNotificationHandler(QObject* parent) :
|
||||||
m_menu.addSeparator();
|
m_menu.addSeparator();
|
||||||
|
|
||||||
m_trayActionVisitWebSite = m_menu.addAction(QIcon(":/images/tray/link.png"), tr("Visit Website"), [&](){
|
m_trayActionVisitWebSite = m_menu.addAction(QIcon(":/images/tray/link.png"), tr("Visit Website"), [&](){
|
||||||
QDesktopServices::openUrl(QUrl("https://amnezia.org"));
|
QDesktopServices::openUrl(QUrl(websiteUrl));
|
||||||
});
|
});
|
||||||
|
|
||||||
m_trayActionQuit = m_menu.addAction(QIcon(":/images/tray/cancel.png"), tr("Quit") + " " + APPLICATION_NAME, this, [&](){
|
m_trayActionQuit = m_menu.addAction(QIcon(":/images/tray/cancel.png"), tr("Quit") + " " + APPLICATION_NAME, this, [&](){
|
||||||
|
|
@ -64,6 +64,11 @@ void SystemTrayNotificationHandler::onTranslationsUpdated()
|
||||||
m_trayActionQuit->setText(tr("Quit")+ " " + APPLICATION_NAME);
|
m_trayActionQuit->setText(tr("Quit")+ " " + APPLICATION_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SystemTrayNotificationHandler::updateWebsiteUrl(const QString &newWebsiteUrl) {
|
||||||
|
qDebug() << "Updated website URL:" << newWebsiteUrl;
|
||||||
|
websiteUrl = newWebsiteUrl;
|
||||||
|
}
|
||||||
|
|
||||||
void SystemTrayNotificationHandler::setTrayIcon(const QString &iconPath)
|
void SystemTrayNotificationHandler::setTrayIcon(const QString &iconPath)
|
||||||
{
|
{
|
||||||
QIcon trayIconMask(QPixmap(iconPath).scaled(128,128));
|
QIcon trayIconMask(QPixmap(iconPath).scaled(128,128));
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,9 @@ public:
|
||||||
|
|
||||||
void onTranslationsUpdated() override;
|
void onTranslationsUpdated() override;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void updateWebsiteUrl(const QString &newWebsiteUrl);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void notify(Message type, const QString& title,
|
virtual void notify(Message type, const QString& title,
|
||||||
const QString& message, int timerMsec) override;
|
const QString& message, int timerMsec) override;
|
||||||
|
|
@ -48,6 +51,7 @@ private:
|
||||||
const QString ConnectedTrayIconName = "active.png";
|
const QString ConnectedTrayIconName = "active.png";
|
||||||
const QString DisconnectedTrayIconName = "default.png";
|
const QString DisconnectedTrayIconName = "default.png";
|
||||||
const QString ErrorTrayIconName = "error.png";
|
const QString ErrorTrayIconName = "error.png";
|
||||||
|
QString websiteUrl = "https://amnezia.org";
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SYSTEMTRAY_NOTIFICATIONHANDLER_H
|
#endif // SYSTEMTRAY_NOTIFICATIONHANDLER_H
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue