Switch to unified view

a/GUI/mainw/trayicon.cpp b/GUI/mainw/trayicon.cpp
...
...
26
#include <QWheelEvent>
26
#include <QWheelEvent>
27
#include <QHoverEvent>
27
#include <QHoverEvent>
28
#include <QDebug>
28
#include <QDebug>
29
#include <QIcon>
29
#include <QIcon>
30
#include <QPixmap>
30
#include <QPixmap>
31
#include <QTimer>
31
#include <QSettings>
32
32
33
#include "HelperStructs/CSettingsStorage.h"
33
#include "HelperStructs/CSettingsStorage.h"
34
#include "HelperStructs/Helper.h"
34
#include "HelperStructs/Helper.h"
35
35
36
36
...
...
53
    m_playIcon = QIcon(play_pixmap);
53
    m_playIcon = QIcon(play_pixmap);
54
    m_pauseIcon = QIcon(pause_pixmap);
54
    m_pauseIcon = QIcon(pause_pixmap);
55
55
56
    m_vol_step = 5;
56
    m_vol_step = 5;
57
57
58
//    m_plugin_loader = NotificationPluginLoader::getInstance();
58
    QSettings settings;
59
    m_notification_active = m_settings->getShowNotifications();
60
    m_timeout = m_settings->getNotificationTimeout();
59
    m_timeout = m_settings->getNotificationTimeout();
61
62
    _timer = new QTimer(this);
63
    _timer->setInterval(300);
64
    _md_set = false;
65
60
66
    m_playAction = new QAction(tr("Play"), this);
61
    m_playAction = new QAction(tr("Play"), this);
67
    m_playAction->setIcon(QIcon(Helper::getIconPath("play.png")));
62
    m_playAction->setIcon(QIcon(Helper::getIconPath("play.png")));
68
    m_stopAction = new QAction(tr("Stop"), this);
63
    m_stopAction = new QAction(tr("Stop"), this);
69
    m_stopAction->setIcon(QIcon(Helper::getIconPath("stop.png")));
64
    m_stopAction->setIcon(QIcon(Helper::getIconPath("stop.png")));
...
...
95
    connect(m_bwdAction, SIGNAL(triggered()), this, SLOT(bwd_clicked()));
90
    connect(m_bwdAction, SIGNAL(triggered()), this, SLOT(bwd_clicked()));
96
    connect(m_stopAction, SIGNAL(triggered()), this, SLOT(stop_clicked()));
91
    connect(m_stopAction, SIGNAL(triggered()), this, SLOT(stop_clicked()));
97
    connect(m_showAction, SIGNAL(triggered()), this, SLOT(show_clicked()));
92
    connect(m_showAction, SIGNAL(triggered()), this, SLOT(show_clicked()));
98
    connect(m_closeAction, SIGNAL(triggered()), this, SLOT(close_clicked()));
93
    connect(m_closeAction, SIGNAL(triggered()), this, SLOT(close_clicked()));
99
    connect(m_muteAction, SIGNAL(triggered()), this, SLOT(mute_clicked()));
94
    connect(m_muteAction, SIGNAL(triggered()), this, SLOT(mute_clicked()));
100
    connect(_timer, SIGNAL(timeout()), this, SLOT(timer_timed_out()));
101
}
102
103
GUI_TrayIcon::~GUI_TrayIcon()
104
{
105
}
95
}
106
96
107
void GUI_TrayIcon::change_skin(QString stylesheet)
97
void GUI_TrayIcon::change_skin(QString stylesheet)
108
{
98
{
109
    this->m_trayContextMenu->setStyleSheet(stylesheet);
99
    this->m_trayContextMenu->setStyleSheet(stylesheet);
...
...
118
    }
108
    }
119
109
120
    return true;
110
    return true;
121
}
111
}
122
112
123
void GUI_TrayIcon::timer_timed_out()
124
{
125
    qDebug() << "Timed out";
126
    _timer->stop();
127
    if (_md_set) {
128
        trackChanged(_md);
129
    }
130
}
131
132
void GUI_TrayIcon::songChangedMessage(const MetaData& md)
113
void GUI_TrayIcon::songChangedMessage(const MetaData& md)
133
{
114
{
134
    _md = md;
135
    _md_set = true;
136
#if 0
137
    if (m_notification_active) {
138
        Notification* n = m_plugin_loader->get_cur_plugin();
139
140
        if (n) {
141
142
            n->notification_show(md);
143
        }
144
145
        else if (this -> isSystemTrayAvailable()) {
115
    if (isSystemTrayAvailable()) {
146
147
            this -> showMessage("Upplay", md.title + tr(" by ") + md.artist,
116
        showMessage("Upplay", md.title + tr(" by ") + md.artist,
148
                                QSystemTrayIcon::Information, m_timeout);
117
                    QSystemTrayIcon::Information, 1000/*m_timeout*/);
149
        }
118
    }
150
    }
151
#endif
152
}
153
154
void GUI_TrayIcon::trackChanged(const MetaData& md)
155
{
156
    songChangedMessage(md);
157
}
119
}
158
120
159
void  GUI_TrayIcon::set_timeout(int timeout_ms)
121
void  GUI_TrayIcon::set_timeout(int timeout_ms)
160
{
122
{
161
    m_timeout = timeout_ms;
123
    m_timeout = timeout_ms;
162
}
163
164
void  GUI_TrayIcon::set_notification_active(bool active)
165
{
166
    m_notification_active = active;
167
}
124
}
168
125
169
void GUI_TrayIcon::set_enable_play(bool b)
126
void GUI_TrayIcon::set_enable_play(bool b)
170
{
127
{
171
    m_playAction->setEnabled(b);
128
    m_playAction->setEnabled(b);
...
...
210
    emit sig_stop_clicked();
167
    emit sig_stop_clicked();
211
}
168
}
212
169
213
void GUI_TrayIcon::stop()
170
void GUI_TrayIcon::stop()
214
{
171
{
215
    _md_set = false;
216
}
172
}
217
173
218
void GUI_TrayIcon::fwd_clicked()
174
void GUI_TrayIcon::fwd_clicked()
219
{
175
{
220
    emit sig_fwd_clicked();
176
    emit sig_fwd_clicked();