1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

remove dependency injection from systemtrayicon

as it was used as experiment only
fix compilation warning about unchecked switch case
This commit is contained in:
agilob 2015-08-29 17:06:22 +01:00 committed by tux3
parent 8c4d58f391
commit 7d8e0644ce
5 changed files with 7 additions and 7 deletions

View File

@ -70,6 +70,8 @@ void logMessageHandler(QtMsgType type, const QMessageLogContext& ctxt, const QSt
case QtFatalMsg: case QtFatalMsg:
LogMsg += "Fatal"; LogMsg += "Fatal";
break; break;
default:
break;
} }
LogMsg += ": " + msg + "\n"; LogMsg += ": " + msg + "\n";

View File

@ -26,9 +26,8 @@
#include <QDebug> #include <QDebug>
#include "src/persistence/settings.h" #include "src/persistence/settings.h"
SystemTrayIcon::SystemTrayIcon(Widget *parent) SystemTrayIcon::SystemTrayIcon()
{ {
this->parent = parent;
QString desktop = getenv("XDG_CURRENT_DESKTOP"); QString desktop = getenv("XDG_CURRENT_DESKTOP");
if (desktop.isEmpty()) if (desktop.isEmpty())
desktop = getenv("DESKTOP_SESSION"); desktop = getenv("DESKTOP_SESSION");

View File

@ -22,7 +22,6 @@
#define SYSTEMTRAYICON_H #define SYSTEMTRAYICON_H
#include "systemtrayicon_private.h" #include "systemtrayicon_private.h"
#include "widget.h"
#include <QObject> #include <QObject>
class QSystemTrayIcon; class QSystemTrayIcon;
@ -32,7 +31,7 @@ class SystemTrayIcon : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
SystemTrayIcon(Widget *parent); SystemTrayIcon();
~SystemTrayIcon(); ~SystemTrayIcon();
void setContextMenu(QMenu* menu); void setContextMenu(QMenu* menu);
void show(); void show();
@ -49,7 +48,6 @@ private:
private: private:
SystrayBackendType backendType; SystrayBackendType backendType;
QSystemTrayIcon* qtIcon; QSystemTrayIcon* qtIcon;
Widget *parent;
#ifdef ENABLE_SYSTRAY_UNITY_BACKEND #ifdef ENABLE_SYSTRAY_UNITY_BACKEND
AppIndicator *unityIndicator; AppIndicator *unityIndicator;

View File

@ -119,6 +119,7 @@ void Widget::init()
offlineMsgTimer = new QTimer(); offlineMsgTimer = new QTimer();
offlineMsgTimer->start(15000); offlineMsgTimer->start(15000);
icon_size = 15;
statusOnline = new QAction(this); statusOnline = new QAction(this);
statusOnline->setIcon(getStatusIcon(Status::Online, icon_size, icon_size)); statusOnline->setIcon(getStatusIcon(Status::Online, icon_size, icon_size));
connect(statusOnline, &QAction::triggered, this, &Widget::setStatusOnline); connect(statusOnline, &QAction::triggered, this, &Widget::setStatusOnline);
@ -1693,7 +1694,7 @@ void Widget::onTryCreateTrayIcon()
{ {
if (QSystemTrayIcon::isSystemTrayAvailable()) if (QSystemTrayIcon::isSystemTrayAvailable())
{ {
icon = new SystemTrayIcon(this); icon = new SystemTrayIcon();
updateIcons(); updateIcons();
trayMenu = new QMenu(this); trayMenu = new QMenu(this);
QStyle *style = qApp->style(); QStyle *style = qApp->style();

View File

@ -183,7 +183,7 @@ private slots:
void friendListContextMenu(const QPoint &pos); void friendListContextMenu(const QPoint &pos);
private: private:
const int icon_size = 15; int icon_size;
private: private:
enum ActiveToolMenuButton { enum ActiveToolMenuButton {