aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/General/scrobbler/lastfmscrobbler.cpp116
-rw-r--r--src/plugins/General/scrobbler/lastfmscrobbler.h5
2 files changed, 5 insertions, 116 deletions
diff --git a/src/plugins/General/scrobbler/lastfmscrobbler.cpp b/src/plugins/General/scrobbler/lastfmscrobbler.cpp
index fe4ae2ff4..be327ae0a 100644
--- a/src/plugins/General/scrobbler/lastfmscrobbler.cpp
+++ b/src/plugins/General/scrobbler/lastfmscrobbler.cpp
@@ -82,8 +82,6 @@ void LastfmResponse::parse(QIODevice *device)
LastfmScrobbler::LastfmScrobbler(QObject *parent) : QObject(parent)
{
- m_getTokenReply = 0;
- m_getSessionReply = 0;
m_notificationReply = 0;
m_submitedSongs = 0;
m_submitReply = 0;
@@ -104,9 +102,7 @@ LastfmScrobbler::LastfmScrobbler(QObject *parent) : QObject(parent)
setupProxy();
m_cachedSongs = m_cache->load();
- if(m_session.isEmpty())
- getToken();
- else
+ if(!m_session.isEmpty())
{
submit();
if(m_core->state() == Qmmp::Playing)
@@ -193,66 +189,7 @@ void LastfmScrobbler::processResponse(QNetworkReply *reply)
qWarning("LastfmScrobbler: invalid content");
}
- if (reply == m_getTokenReply)
- {
- m_getTokenReply = 0;
- if(response.status == "ok")
- {
- m_token = response.token;
- qDebug("LastfmScrobbler: token: %s", qPrintable(m_token));
- QDesktopServices::openUrl("http://www.last.fm/api/auth/?api_key="API_KEY"&token="+m_token);
- QTimer::singleShot(120000, this, SLOT(getSession())); //2 minutes
- }
- else if(error_code == "8" || error_code == "7" || error_code == "11" || error_code.isEmpty())
- {
- m_token.clear();
- QTimer::singleShot(120000, this, SLOT(getToken())); // wait 2 minutes and try again
- }
- else
- {
- m_token.clear();
- qWarning("LastfmScrobbler: service returned unrecoverable error, scrobbling disabled");
- }
- }
- else if(reply == m_getSessionReply)
- {
- m_getSessionReply = 0;
- m_session.clear();
- if(response.status == "ok")
- {
- m_session = response.key;
- qDebug("LastfmScrobbler: name: %s", qPrintable(response.name));
- qDebug("LastfmScrobbler: key: %s", qPrintable(m_session));
- qDebug("LastfmScrobbler: subscriber: %s", qPrintable(response.subscriber));
- QSettings settings(Qmmp::configFile(), QSettings::IniFormat);
- settings.setValue("Scrobbler/lastfm_session", m_session);
- submit();
- }
- else if(error_code == "4" || error_code == "15") //invalid token
- {
- m_token.clear();
- getToken();
- }
- else if(error_code == "11") //service offline
- {
- QTimer::singleShot(120000, this, SLOT(getSession()));
- }
- else if(error_code == "14") // unauthorized token
- {
- QDesktopServices::openUrl("http://www.last.fm/api/auth/?api_key="API_KEY"&token="+m_token);
- QTimer::singleShot(120000, this, SLOT(getSession())); //2 minutes
- }
- else if (error_code.isEmpty()) //network error
- {
- QTimer::singleShot(120000, this, SLOT(getSession()));
- }
- else
- {
- m_token.clear();
- qWarning("LastfmScrobbler: service returned unrecoverable error, scrobbling disabled");
- }
- }
- else if (reply == m_submitReply)
+ if (reply == m_submitReply)
{
m_submitReply = 0;
if (response.status == "ok")
@@ -276,7 +213,7 @@ void LastfmScrobbler::processResponse(QNetworkReply *reply)
else if(error_code == "9") //invalid session key
{
m_session.clear();
- getToken();
+ qWarning("LastfmScrobbler: invalid session key, scrobbling disabled");
}
else if(error_code == "11" || error_code == "16" || error_code.isEmpty()) //unavailable
{
@@ -298,7 +235,7 @@ void LastfmScrobbler::processResponse(QNetworkReply *reply)
else if(error_code == "9") //invalid session key
{
m_session.clear();
- getToken();
+ qWarning("LastfmScrobbler: invalid session key, scrobbling disabled");
}
}
reply->deleteLater();
@@ -321,51 +258,6 @@ void LastfmScrobbler::setupProxy()
m_http->setProxy(QNetworkProxy::NoProxy);
}
-void LastfmScrobbler::getToken()
-{
- qDebug("LastfmScrobbler: new token request");
- m_session.clear();
- QUrl url(QString(SCROBBLER_LASTFM_URL) + "?");
- url.setPort(80);
- url.addQueryItem("method", "auth.getToken");
- url.addQueryItem("api_key", API_KEY);
-
- QByteArray data;
- data.append("api_key"API_KEY);
- data.append("methodauth.getToken");
- data.append(SECRET);
- url.addQueryItem("api_sig", QCryptographicHash::hash(data,QCryptographicHash::Md5).toHex());
-
- QNetworkRequest request(url);
- request.setRawHeader("User-Agent", m_ua);
- request.setRawHeader("Host",url.host().toAscii());
- request.setRawHeader("Accept", "*/*");
- m_getTokenReply = m_http->get(request);
-}
-
-void LastfmScrobbler::getSession()
-{
- qDebug("LastfmScrobbler: new session request");
- QUrl url(QString(SCROBBLER_LASTFM_URL) + "?");
- url.setPort(80);
- url.addQueryItem("api_key", API_KEY);
- url.addQueryItem("method", "auth.getSession");
- url.addQueryItem("token", m_token);
-
- QByteArray data;
- data.append("api_key"API_KEY);
- data.append("methodauth.getSession");
- data.append("token" + m_token.toUtf8());
- data.append(SECRET);
- url.addQueryItem("api_sig", QCryptographicHash::hash(data, QCryptographicHash::Md5).toHex());
-
- QNetworkRequest request(url);
- request.setRawHeader("User-Agent", m_ua);
- request.setRawHeader("Host",url.host().toAscii());
- request.setRawHeader("Accept", "*/*");
- m_getSessionReply = m_http->get(request);
-}
-
void LastfmScrobbler::submit()
{
if (m_cachedSongs.isEmpty() || m_session.isEmpty() || m_submitReply)
diff --git a/src/plugins/General/scrobbler/lastfmscrobbler.h b/src/plugins/General/scrobbler/lastfmscrobbler.h
index d6e97c8c0..cf0c2609e 100644
--- a/src/plugins/General/scrobbler/lastfmscrobbler.h
+++ b/src/plugins/General/scrobbler/lastfmscrobbler.h
@@ -64,8 +64,6 @@ private slots:
void updateMetaData();
void processResponse(QNetworkReply *reply);
void setupProxy();
- void getToken();
- void getSession();
void submit();
private:
@@ -78,10 +76,9 @@ private:
QList <SongInfo> m_cachedSongs;
QByteArray m_ua;
int m_submitedSongs;
- QString m_token, m_session;
+ QString m_session;
QNetworkAccessManager *m_http;
SoundCore *m_core;
- QNetworkReply *m_getTokenReply, *m_getSessionReply;
QNetworkReply *m_submitReply, *m_notificationReply;
QTime *m_time;
ScrobblerCache *m_cache;
ommit/src/ui/mainwindow.cpp?id=49ba6c2fa06151f4c80b847d5be20185e3896ac8'>49ba6c2fa
2d622fd9b
11b7655bb
edfa16a7b

7e9e91c7a
2d622fd9b
eac0064e6

e956dd352
24af8da3f
b8b7804fc
b2e1612aa

c08f92cd6
92f1159a1
f47fcc22a

2d622fd9b
97c98d9d5
2d622fd9b

97c98d9d5


2d622fd9b
90d3aeb64
2d622fd9b



2d622fd9b
49ae26a0d
fd6e0ed37
49ae26a0d
2702b572b
f47fcc22a
f47fcc22a





1484a13bf
f47fcc22a

2d622fd9b
92f1159a1

2d622fd9b
0e860ae0b

76095a463
c08f92cd6
bd3bb4892
06d187781
f47fcc22a
97c98d9d5

f47fcc22a
90d3aeb64
c08f92cd6
54e207710
2d622fd9b

2d622fd9b
053884732
2d622fd9b


f47fcc22a
2d622fd9b



36460a06f
90d3aeb64
2d622fd9b


080507d3a

30e11dd37
080507d3a



30e11dd37
2d622fd9b

2d622fd9b






88a5a4439
2d622fd9b
e656da41c
2d622fd9b

fedd13511
2d622fd9b
e656da41c
2d622fd9b

f47fcc22a
2d622fd9b

0e860ae0b




053884732

0e860ae0b
0e860ae0b
0e860ae0b
0e860ae0b
0e860ae0b
eac0064e6

9a85b8bef
eac0064e6
0e860ae0b

0e860ae0b
90d3aeb64
76095a463

eac0064e6
053884732
76095a463
eac0064e6

76095a463

43ee25ac7
2d622fd9b



2972e8742

2d622fd9b



c08f92cd6
2d622fd9b



c08f92cd6
2d622fd9b

1484a13bf




86aac72c6
2d622fd9b


97c98d9d5
2d622fd9b




ae75e5707
fa1e4194b
034128b6d
2731ececc

2d622fd9b
2731ececc















22617b420
2731ececc




fa1e4194b
11b7655bb
fa1e4194b
2295f52f6

22617b420
2295f52f6
fa1e4194b
2295f52f6
2d622fd9b
a6eba9ecc
2d622fd9b
fa1e4194b
f56054da3
fa1e4194b
0a9bc84fa
2d622fd9b
92f1159a1




d60ec0e8d
013ee07b5
2d622fd9b
49ba6c2fa
2295f52f6
4be19e3fd
49ba6c2fa
5ae46a29f
fa1e4194b
5ae46a29f


fa1e4194b
5ae46a29f


fa1e4194b
5ae46a29f


fa1e4194b

da7c4209e


2d622fd9b



ae75e5707
fa1e4194b
2d622fd9b
fa1e4194b

2295f52f6


2d622fd9b




00a72dd68
4cb1b1275
deb8cb930

00a72dd68
4cb1b1275
00a72dd68
4cb1b1275
40c82a8a1
2d622fd9b



d28e87a85
2d622fd9b

a6eba9ecc

97c98d9d5

a42fba17b
ef849d74d




a42fba17b
a6eba9ecc

2d622fd9b

d28e87a85
2d622fd9b
46a95c311
2295f52f6
4be19e3fd
46a95c311

2d622fd9b


2d622fd9b



a6eba9ecc
2d622fd9b
a6eba9ecc
2d622fd9b

bd3bb4892










2d622fd9b


2295f52f6





2d622fd9b
a1715a3b0
6d1217944
2295f52f6






6d1217944

92f1159a1



d60ec0e8d
2295f52f6


92f1159a1
2295f52f6
92f1159a1
2295f52f6
d60ec0e8d
2295f52f6
92f1159a1
2295f52f6
6d1217944
b3e010787









86aac72c6

c08f92cd6
b3e010787
86aac72c6
2295f52f6
2d622fd9b
2295f52f6

2d622fd9b
ce067a843
080507d3a







ef0abefb6
0b96bbb6b
2d622fd9b

2d622fd9b

f40087159
2d622fd9b

46a95c311



46a95c311




2d622fd9b




2d622fd9b

c08f92cd6
2d622fd9b



c08f92cd6
2d622fd9b

2d622fd9b

0e860ae0b
f47fcc22a
2d622fd9b



a1715a3b0
2d622fd9b
dc0e3abbb
2d622fd9b

97c98d9d5
8cbd1444b
aecf85927
8cbd1444b
06d187781
06d187781

97c98d9d5
06d187781







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
                                                                            
                                                                            














                                                                            
                                                                            





                                                                             
                 
                           
                        
                                 
                            
                           

                                  
                                      
                              
                                 
                                   
                               
                                
                                  

                            
                       

                     


                       
                       
                       
                         
                          
 
                        
 
                                                             
 


                                                                                            
              
                     

                                                                         
                           
 

                                                      
                            
 
                                       

                                               
                                      
                                               

                    
                            
                                                        

                                


                                      
 
                                                  



                                     
 
                    
                           
                                                               
                                   
                       





                                                                
                                                           

                                                                     
 

                                                                                                   
 

                                                                                      
                                                                    
                                                                                    
                                                                              
 
                   

                                  
                       
                                                               
                                                         
                           

 
                         
  


                       
                     



                         
           
                                                                     


           

                          
                                                 



                           
                                                                  

 






                            
                     
 
 

                       
                     
 
 

                           
                         

 




                                             

                                                                                                            
              
                      
              
                       
                                

                                                                                                     
            
                                   

              
 
 

                               
                                                                           
                                                                     
     

                                                       

 
                                           



                         

                                                           



                         
                                   



                          
                              

 




                                
                                             


                                                  
                                               




                               
                                                                 
                                   
                                                                                                       

                 
     















                                                                                                
 




                                                                                                     
                                                                              
                                                                       
                                                           

                                                                       
                                                                     
         
                                                                                           
                                                                                     
               
                              
                    
                                                                           
                              
                                                                            
                              
                         




                                                                                            
                                                                                               
                        
     
               
                                                                                          
                                                        
      
                                          
                                                                  


                                   
                                                           


                                                 
                                                           


                                                

                                                                    


                                                                               



                                
                                                                 
                                   
              

                                             


                                                                                              




                               
                                                      
                                                                 

                                                                                                   
                       
                                     
                              
                     
                                             



                                   
                                    

               

                         

                                                                 
               




                                                              
      

                              

                          
                         
         
               
                                                                                              
                                                            

                


        



                                     
               
     
                          

 










                               


                                 





                                                                                          
                               
                                                                                      
                               






                                                                                                    

                                                        



                                                                                                              
                                                                    


                                                                                                
                                                               
                                                                       
                                                                 
                                                                         
                                                                   
                                                                          
                                                        
                                                                    
 









                                                                                                         

                                     
                                                                                         
 
                               
                                                                                           
                               

                                                                                      
                               
                                                                                     







                                                                    
                                                                           
                                                                       

 

                        
                            

 



                                 




                                   




                         

                               
                                   



                               
                                   

 

                            
                                         
                        



               
                              
 
                                  

 
                         
 
                             
 
 

                                             
                     







                                                                                             
/***************************************************************************
 *   Copyright (C) 2006-2015 by Ilya Kotov                                 *
 *   forkotov02@hotmail.ru                                                 *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
 ***************************************************************************/
#include <QtGui>
#include <QFileDialog>
#include <QDir>
#include <QAction>
#include <QMenu>
#include <math.h>
#include <qmmp/soundcore.h>
#include <qmmp/visual.h>
#include <qmmp/metadatamanager.h>
#include <qmmpui/uihelper.h>
#include <qmmpui/general.h>
#include <qmmpui/playlistparser.h>
#include <qmmpui/playlistformat.h>
#include <qmmpui/commandlinemanager.h>
#include <qmmpui/filedialog.h>
#include <qmmpui/playlistmodel.h>
#include <qmmpui/playlistmanager.h>
#include <qmmpui/mediaplayer.h>
#include <qmmpui/configdialog.h>
#include <qmmpui/qmmpuisettings.h>
#include "hotkeyeditor.h"
#include "skinnedsettings.h"
#include "mainwindow.h"
#include "skin.h"
#include "playlist.h"
#include "dock.h"
#include "eqwidget.h"
#include "mainvisual.h"
#include "listwidget.h"
#include "visualmenu.h"
#include "windowsystem.h"
#include "actionmanager.h"

#define KEY_OFFSET 10000

MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
#ifdef Q_WS_X11
    qDebug("MainWindow: detected wm: %s", qPrintable(WindowSystem::netWindowManagerName()));
#endif
    m_vis = 0;
    m_update = false;
    setWindowFlags(Qt::Window | Qt::FramelessWindowHint |
                   Qt::WindowCloseButtonHint | Qt::WindowSystemMenuHint);
    setWindowTitle("Qmmp");

    m_titleFormatter.setPattern("%if(%p,%p - %t,%t)");

    new ActionManager(this);

    m_player = MediaPlayer::instance();
    m_core = SoundCore::instance();
    m_pl_manager = PlayListManager::instance();
    m_uiHelper = UiHelper::instance();
    m_ui_settings = QmmpUiSettings::instance();

    //user interface
    m_skin = new Skin(this);
    resize(275 * m_skin->ratio(),116 * m_skin->ratio());
    Dock *dock = new Dock(this);
    dock->setMainWidget(this);
    m_display = new MainDisplay(this);
    setCentralWidget(m_display);
    m_display->setFocus ();

    m_playlist = new PlayList(m_pl_manager, this);
    dock->addWidget(m_playlist);

    m_equalizer = new EqWidget(this);
    dock->addWidget(m_equalizer);

    createActions();
    //prepare visualization
    Visual::initialize(this, m_visMenu, SLOT(updateActions()));
    m_vis = MainVisual::instance();
    Visual::add(m_vis);
    //connections
    connect (m_playlist,SIGNAL(next()),SLOT(next()));
    connect (m_playlist,SIGNAL(prev()),SLOT(previous()));
    connect (m_playlist,SIGNAL(play()),SLOT(play()));
    connect (m_playlist,SIGNAL(pause()), m_core ,SLOT(pause()));
    connect (m_playlist,SIGNAL(stop()),SLOT(stop()));
    connect (m_playlist,SIGNAL(eject()),SLOT(playFiles()));
    connect (m_playlist,SIGNAL(loadPlaylist()),SLOT(loadPlaylist()));
    connect (m_playlist,SIGNAL(savePlaylist()),SLOT(savePlaylist()));

    connect(m_display,SIGNAL(shuffleToggled(bool)),m_ui_settings,SLOT(setShuffle(bool)));
    connect(m_display,SIGNAL(repeatableToggled(bool)),m_ui_settings,SLOT(setRepeatableList(bool)));

    connect(m_core, SIGNAL(stateChanged(Qmmp::State)), SLOT(showState(Qmmp::State)));
    connect(m_core, SIGNAL(elapsedChanged(qint64)),m_playlist, SLOT(setTime(qint64)));
    connect(m_core, SIGNAL(metaDataChanged()),SLOT(showMetaData()));
    connect(m_uiHelper, SIGNAL(toggleVisibilityCalled()), SLOT(toggleVisibility()));
    connect(m_uiHelper, SIGNAL(showMainWindowCalled()), SLOT(showAndRaise()));

    readSettings();
    m_display->setEQ(m_equalizer);
    m_display->setPL(m_playlist);
    dock->updateDock();
    m_pl_manager->currentPlayList()->doCurrentVisibleRequest();
    if (m_startHidden && m_uiHelper->visibilityControl())
        toggleVisibility();
}

MainWindow::~MainWindow()
{}

void MainWindow::play()
{
    m_player->play();
}

void MainWindow::replay()
{
    stop();
    m_pl_manager->activatePlayList(m_pl_manager->selectedPlayList());
    play();
}

void MainWindow::forward()
{
    m_core->seek(m_core->elapsed() + KEY_OFFSET);
}

void MainWindow::backward()
{
    m_core->seek(qMax(qint64(0), m_core->elapsed() - KEY_OFFSET));
}

void MainWindow::pause(void)
{
    m_core->pause();
}

void MainWindow::stop()
{
    m_player->stop();
}

void MainWindow::next()
{
    m_player->next();
}

void MainWindow::previous()
{
    m_player->previous();
}

void MainWindow::showState(Qmmp::State state)
{
    switch ((int) state)
    {
    case Qmmp::Playing:
        if (m_pl_manager->currentPlayList()->currentTrack())
            m_equalizer->loadPreset(m_pl_manager->currentPlayList()->currentTrack()->url().section("/",-1));
        break;
    case Qmmp::Paused:
        break;
    case Qmmp::Stopped:
        m_playlist->setTime(-1);
        if (m_pl_manager->currentPlayList()->currentTrack())
            setWindowTitle(m_titleFormatter.format(m_pl_manager->currentPlayList()->currentTrack()));
        else
            setWindowTitle("Qmmp");
        break;
    }
}

void MainWindow::showMetaData()
{
    PlayListTrack *track = m_pl_manager->currentPlayList()->currentTrack();
    if (track && track->url() == m_core->metaData().value(Qmmp::URL))
    {
        setWindowTitle(m_titleFormatter.format(track));
    }
}

void MainWindow::closeEvent (QCloseEvent *)
{
    writeSettings();
    m_playlist->close();
    m_equalizer->close();
    if (!m_hideOnClose || !m_uiHelper->visibilityControl())
        m_uiHelper->exit();
}

void MainWindow::addDir()
{
    m_uiHelper->addDirectory(this);
}

void MainWindow::addFile()
{
    m_uiHelper->addFile(this);
}

void MainWindow::playFiles()
{
    m_uiHelper->playFiles(this);
}

void MainWindow::changeEvent (QEvent * event)
{
    if (event->type() == QEvent::ActivationChange)
    {
        m_display->setActive(isActiveWindow());
    }
}

void MainWindow::readSettings()
{
    QSettings settings(Qmmp::configFile(), QSettings::IniFormat);
    settings.beginGroup("Skinned");
    m_titleFormatter.setPattern(settings.value("window_title_format","%if(%p,%p - %t,%t)").toString());

    if (m_update)
    {
        if(ACTION(ActionManager::WM_ALLWAYS_ON_TOP)->isChecked())
        {
            setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
            m_playlist->setWindowFlags(m_playlist->windowFlags() | Qt::WindowStaysOnTopHint);
            m_equalizer->setWindowFlags(m_equalizer->windowFlags() | Qt::WindowStaysOnTopHint);
        }
        else
        {
            setWindowFlags(windowFlags() & ~Qt::WindowStaysOnTopHint);
            m_playlist->setWindowFlags(m_playlist->windowFlags() & ~Qt::WindowStaysOnTopHint);
            m_equalizer->setWindowFlags(m_equalizer->windowFlags() & ~Qt::WindowStaysOnTopHint);
        }
        show();
        qApp->processEvents();
        m_playlist->setVisible(m_display->isPlaylistVisible());
        m_equalizer->setVisible(m_display->isEqualizerVisible());

        if (m_pl_manager->currentPlayList()->currentTrack())
            setWindowTitle(m_titleFormatter.format(m_pl_manager->currentPlayList()->currentTrack()));
    }
    else
    {
        move(settings.value("mw_pos", QPoint(100, 100)).toPoint()); //geometry
        m_startHidden = settings.value("start_hidden", false).toBool();
        if(settings.value("always_on_top", false).toBool())
        {
            ACTION(ActionManager::WM_ALLWAYS_ON_TOP)->setChecked(true);
            setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
        }
        ACTION(ActionManager::WM_STICKY)->setChecked(settings.value("show_on_all_desktops",
                                                                    false).toBool());
        show();
        qApp->processEvents();
        //visibility
        m_playlist->setVisible(settings.value("pl_visible",true).toBool());
        qApp->processEvents();
        m_equalizer->setVisible(settings.value("eq_visible",true).toBool());
        qApp->processEvents();
        // Repeat/Shuffle