aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Input/opus/opus.pro
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/Input/opus/opus.pro')
0 files changed, 0 insertions, 0 deletions
tter trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> 2012-07-31 16:20:57 +0000 fixed FSF headers' href='/qmmp/commit/src/plugins/Ui/skinned/playlist.cpp?id=a8bf072ec18a3ecfd6110a1dcfdef7f7e0daf4bd'>a8bf072ec
2d622fd9b





5a1055301
7e96b6eb6
69c45fb3c
40c82a8a1


d184b2ace
92f1159a1
40c82a8a1
2d622fd9b
2d622fd9b


2d622fd9b





3d06313cd
e2225dbc1
872336337
40c82a8a1
05bacc09f
40c82a8a1
0e860ae0b
90d3aeb64
0e860ae0b
2d622fd9b
013ee07b5
ef5b02756
90d3aeb64
92f1159a1
11b7655bb

97c98d9d5

11b7655bb
b917024aa

2d622fd9b
845322411
912ee1ab6

8e520e92f
4d244c335

d75050705
912ee1ab6




845322411
912ee1ab6










2d622fd9b
2702b572b

26da2f9c1
26da2f9c1
26da2f9c1
26da2f9c1
26da2f9c1
2f0230b50

2f0230b50
0e860ae0b
2d622fd9b
8591d54ad
0e860ae0b
2d622fd9b
0e860ae0b
a7ebb6b84
0e860ae0b
6c1932796




















90d3aeb64

de2eb5542



0e860ae0b
87dbe6b33
d3e52b51b



90d3aeb64

26da2f9c1
97c98d9d5
d3e52b51b
2d622fd9b

2d622fd9b
90d3aeb64


2d622fd9b
97c98d9d5



19ada5737
97c98d9d5

97c98d9d5


05bacc09f




2312f6dc4

2312f6dc4

05bacc09f
2312f6dc4
05bacc09f
05bacc09f

97c98d9d5






8591d54ad
97c98d9d5
8591d54ad

97c98d9d5




2d622fd9b

0e860ae0b




dcd19e09a

a36e04a07



2d622fd9b


0e860ae0b

2295f52f6


123801afa
40c82a8a1
2295f52f6


40c82a8a1
43bf74b18
4b1702e1f

2295f52f6
0400576a8
2295f52f6
40c82a8a1

6c1932796
2d622fd9b

0c9515e6f
ef0abefb6
2d622fd9b
0c9515e6f

22ef61fd6
0c9515e6f

526e04b8b
0c9515e6f

22ef61fd6
0c9515e6f

b66a8c518
0c9515e6f

2d622fd9b
0c9515e6f

2d622fd9b
0c9515e6f

2d622fd9b
0c9515e6f

c73ba11ee
0c9515e6f

a04aa013d
0c9515e6f

8dd8df5b6
0c9515e6f

a49bf86a4
0c9515e6f

2d622fd9b
0e860ae0b
2d622fd9b
ef0abefb6

0c9515e6f

2d622fd9b
0c9515e6f

c74607021
0c9515e6f

526e04b8b
0c9515e6f

c74607021
0c9515e6f

b66a8c518
0c9515e6f

2d622fd9b
0c9515e6f

2d622fd9b
0c9515e6f

2d622fd9b
0c9515e6f

c73ba11ee
0c9515e6f

a04aa013d
0c9515e6f

2d622fd9b
0e860ae0b
2d622fd9b
ef0abefb6



9be61ad0b
92f1159a1
79fcd1357
92f1159a1
40c82a8a1

2d622fd9b
763ecdc6a
d184b2ace
123801afa
fef633fd8
2295f52f6
2d622fd9b
2295f52f6
40c82a8a1
2d622fd9b
2295f52f6
40c82a8a1
2295f52f6
40c82a8a1
2295f52f6

7e96b6eb6
2d622fd9b
2295f52f6

90d3aeb64
2295f52f6
40c82a8a1
2295f52f6
40c82a8a1
2295f52f6
2d622fd9b

5a1055301
2d622fd9b
8a3af3bd1

2d622fd9b

0e860ae0b
2d622fd9b
c9735a611

2d622fd9b
c9735a611

97c98d9d5
2d622fd9b
c9735a611
2d622fd9b
c9735a611

0e860ae0b
2d622fd9b
c9735a611
2d622fd9b
c9735a611






2d622fd9b

97c98d9d5
2d622fd9b
97c98d9d5
2d622fd9b
97c98d9d5
0e860ae0b
2d622fd9b
5f78e890d
2f0230b50
2d622fd9b
013ee07b5
26da2f9c1
2d622fd9b

11b7655bb
2d622fd9b
90d3aeb64
0e860ae0b
2d622fd9b
0e860ae0b
2d622fd9b
845322411

912ee1ab6
845322411

912ee1ab6
845322411

912ee1ab6
845322411

912ee1ab6
912ee1ab6
912ee1ab6
845322411
912ee1ab6

845322411
7c3e4b704



2d622fd9b

90d3aeb64
0e860ae0b
2d622fd9b
26da2f9c1
2d622fd9b

11b7655bb
97c98d9d5
2d622fd9b
2d622fd9b
0e860ae0b
2d622fd9b
0e860ae0b
2d622fd9b
0e860ae0b
2d622fd9b




2312f6dc4
fa1e4194b
2312f6dc4



dcd19e09a
2312f6dc4



dcd19e09a
2312f6dc4
dcd19e09a

b917024aa
2312f6dc4
05bacc09f
0e860ae0b
2d622fd9b

bdfdce731
2312f6dc4


2d622fd9b


2db4c92bf

34926703d
2db4c92bf

1e31fe896
34926703d
2db4c92bf




34926703d
2db4c92bf


013ee07b5
2d622fd9b
2d622fd9b

845322411
872336337

845322411
eb86dfefb
4be19e3fd
f775730cd
4be19e3fd

872336337



2d622fd9b

ae75e5707
bdfdce731
fa1e4194b
2d622fd9b

845322411
912ee1ab6





2d622fd9b

0e860ae0b
2d622fd9b



0e860ae0b
2d622fd9b



0e860ae0b
2d622fd9b



0e860ae0b
2d622fd9b

0e860ae0b
2d622fd9b
178b0feca
029b517f5

2d622fd9b

0e860ae0b
2d622fd9b
0e860ae0b
d3e52b51b
0e860ae0b
d3e52b51b
0e860ae0b
2d622fd9b
d3e52b51b

47a8f7111
d3e52b51b





0e860ae0b
47a8f7111
2d622fd9b
0e860ae0b
2d622fd9b

0e860ae0b
2d622fd9b

0e860ae0b
2d622fd9b
eeffcb5f6
2d622fd9b
26da2f9c1



2f0230b50
48ff1231f
2702b572b


3d06313cd
90d3aeb64
3d06313cd
90d3aeb64

7e96b6eb6










3d06313cd
90d3aeb64
3d06313cd
90d3aeb64
3d06313cd

90d3aeb64
3d06313cd

90d3aeb64

dcd19e09a





40c82a8a1
1e31fe896
dcd19e09a
640afe96b
dcd19e09a


de2eb5542
dcd19e09a
b917024aa
dcd19e09a







1e31fe896
dcd19e09a



96f53fd1f
dcd19e09a








245d0ac0c
1e31fe896
dcd19e09a
96f53fd1f
dcd19e09a

96f53fd1f
dcd19e09a

d3e52b51b













2702b572b




912ee1ab6
845322411
912ee1ab6
97c98d9d5
912ee1ab6








2702b572b

912ee1ab6
2702b572b
912ee1ab6












97c98d9d5
2702b572b
26da2f9c1

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
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
                                                                            
                                                                            
                                                                            













                                                                            
                                                                            





                                                                             
                      
                       
                  


                                   
                            
                                  
                           
                 


                       





                             
                            
                             
                         
                          
                           
                     
 
                                                              
                          
 
                                                 
                                   
                           
                                               

                     

                              
                     

                            
 
                  

                                                               
                                                                                                          

                                                                
                                                          




                                                              
                  










                                                  
 

                                           
                                                                                       
                                                                                       
                                                                                           
                                                                                         
                                                                                            

                                       
                                                                   
                                              
 
                                                       
                                                       
 
                                                
                                                           
 




















                                                                                            

                                                             



                    
                                             
                                    



                                                                                                 

                                                          
                                                    
                      
                

 
                     


                             
 



                                       
                                                        

               


                                                       




                                 

                     

                                                                                                 
                                        
     
 

                                      






                                                              
                                                                 
 

                                                                       




                                                      

                            




                                      

                                                                                    



                                                              


                              

              


                                                                                                
                                                                             
              


                                                                                                              
                                                           
                              

                                                                            
                                                                                   
                                                              
                                                                                      

                                                           
                                                                                                       

                               
                                                              
                                                                     
 

                                                                                                 
 

                                                                                                 
 

                                                                                                   
 

                                                                                                             
 

                                                                                                   
 

                                                                                                                
 

                                                                                               
 

                                                                                                 
 

                                                                                                     
 

                                                                                                                         
 

                                                                                                                                 
 

                                                                                                 
 
                                         
 

                                                                     

                                                                                                         
 

                                                                                                         
 

                                                                                                           
 

                                                                                                                     
 

                                                                                                           
 

                                                                                                                        
 

                                                                                                       
 

                                                                                                         
 

                                                                                                             
 

                                                                                                                                 
 

                                                                                                                                          
 
                                         
                               



                                                                                            
 
                                                                                                                   
                                                                 
                                                                                         

                                                                                                    
                                         
                                                                                           
                                                                                           
                                                              
                                         
                                                                                                             
                 
                                                                                        
                                                              
                                 
                                                                                       
                                                             
                                                                                                       
                   

                                                                                                       
                                                                                                  
                                   

                                                                                                
                                   
                                                                                     
                                                                  
                                                                                         
                                                                      
                                                                                                       

 
                                          
 

                                

 
                                         
 

                                        
 

                                                                           
                                        
     
                                                                                    
     

                                                                                 
                              
     
                                                                                                   
     






                                                                                                   

 
                                           
 
                      
 
 
                                               
 
                
                                     
     
                        
                                                        

        
                         
 
 
                                              
 
                 
     

                              
 

                                                      
 

                         
 

                    
                                                                           
            
      
                                                                     

 
                  



                                                 

     
 
                                                
 
                                                      

                                     
                     
                                   
 
 
                                           
 
                                                  
     
                                                 




                             
                                                                  
                                                                   



                                                                     
                                                                                                   



                         
         
                                         

                                                                                 
                                
     
 
                 

                                     
                                   


                                          


        

                                                              
                                                                                    

                                        
                                                               
         




                                                               
         


                                                                                                     
                        
     

 
                  

                                    
                                              
                                          
     
                                           

                                                              



                                 

                              
                                                                  
              
                                                      

 
                  





                                

                            
                                                              



                            
                                                              



                               
                                                                    



                             
                                                                

 
                                      
 
                   

                                                                                          

 
                                   
 
                 
                                         
        
                                                        
                             
 

                                            
     





                                                                                                       
                                       
     
 
 

                                 
                                                                        

 
                                            
 
                                           
 



                                                                   
                                                                   
                              


                             
                               
 
                                                                   

 










                                                                                         
                              
 
                     
     

                                                               
     

                             

 





                                                                           
 
                                                     
     
                                                                   


     
                                                               
 
                                            







                                                                                                
                                                             



                                                                      
                                       








                                                                                   
                                    
                                                                                  
     
                                                           

                           
                                 

 













                                                                                        




                                     
 
                  
                
     








                                                                                    

        
      
     












                                                      
     
                      

             
/***************************************************************************
 *   Copyright (C) 2006-2020 by Ilya Kotov                                 *
 *   forkotov02@ya.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 <QPainter>
#include <QResizeEvent>
#include <QSettings>
#include <QMenu>
#include <QAction>
#include <QCloseEvent>
#include <QInputDialog>
#include <QScreen>
#include <qmmpui/playlistitem.h>
#include <qmmpui/playlistmodel.h>
#include <qmmpui/playlistmanager.h>
#include <qmmpui/uihelper.h>
#include <qmmpui/qmmpuisettings.h>
#include <qmmp/soundcore.h>
#include "dock.h"
#include "skin.h"
#include "listwidget.h"
#include "button.h"
#include "playlisttitlebar.h"
#include "playlistslider.h"
#include "pixmapwidget.h"
#include "symboldisplay.h"
#include "playlistcontrol.h"
#include "keyboardmanager.h"
#include "playlistbrowser.h"
#include "playlistselector.h"
#include "windowsystem.h"
#include "actionmanager.h"
#include "playlistheader.h"
#include "playlist.h"

PlayList::PlayList (PlayListManager *manager, QWidget *parent)
        : QWidget (parent)
{
    setAttribute(Qt::WA_AlwaysShowToolTips,true);
    setWindowTitle(tr("Playlist"));
    m_pl_manager = manager;
    m_ui_settings = QmmpUiSettings::instance();
    m_update = false;
    m_resize = false;
    m_skin = Skin::instance();
    m_ratio = m_skin->ratio();
    m_shaded = false;
    m_pl_browser = nullptr;
    m_pl_selector = nullptr;

#ifdef QMMP_WS_X11
    QString wm_name = WindowSystem::netWindowManagerName();
    m_compiz = wm_name.contains("compiz", Qt::CaseInsensitive);
    if(wm_name.contains("openbox", Qt::CaseInsensitive) || wm_name.contains("xfwm4", Qt::CaseInsensitive))
        setWindowFlags (Qt::Drawer | Qt::FramelessWindowHint);
    else if(wm_name.contains("metacity", Qt::CaseInsensitive) ||
            wm_name.contains("kwin", Qt::CaseInsensitive))
        setWindowFlags (Qt::Tool | Qt::FramelessWindowHint);
    else
#endif
        setWindowFlags (Qt::Dialog | Qt::FramelessWindowHint);

#ifdef QMMP_WS_X11
    if(m_compiz)
    {
        setFixedSize(275*m_ratio, 116*m_ratio);
    }
    else
#endif
    {
        resize (275*m_ratio, 116*m_ratio);
        setSizeIncrement (25*m_ratio, 29*m_ratio);
        setMinimumSize(275*m_ratio, 116*m_ratio);
    }

    m_listWidget = new ListWidget (this);
    m_plslider = new PlayListSlider (this);
    m_buttonAdd = new Button (this,Skin::PL_BT_ADD,Skin::PL_BT_ADD, Skin::CUR_PNORMAL);
    m_buttonSub = new Button (this,Skin::PL_BT_SUB,Skin::PL_BT_SUB, Skin::CUR_PNORMAL);
    m_selectButton  = new Button (this,Skin::PL_BT_SEL,Skin::PL_BT_SEL, Skin::CUR_PNORMAL);
    m_sortButton= new Button (this,Skin::PL_BT_SORT,Skin::PL_BT_SORT, Skin::CUR_PNORMAL);
    m_playlistButton = new Button (this,Skin::PL_BT_LST,Skin::PL_BT_LST, Skin::CUR_PNORMAL);
    m_resizeWidget = new QWidget(this);
    m_resizeWidget->resize(25,25);
    m_resizeWidget->setCursor(m_skin->getCursor (Skin::CUR_PSIZE));
    m_pl_control = new PlaylistControl (this);

    m_length_totalLength = new SymbolDisplay (this,17);
    m_length_totalLength->setAlignment (Qt::AlignLeft);

    m_current_time = new SymbolDisplay (this,6);
    m_keyboardManager = new KeyboardManager (m_listWidget);

    connect(m_listWidget, SIGNAL(doubleClicked()), parent, SLOT(replay()));

    connect(m_plslider, SIGNAL(sliderMoved(int)), m_listWidget, SLOT(setViewPosition(int)));
    connect(m_listWidget, SIGNAL(positionChanged(int, int)), m_plslider,
             SLOT(setPos (int, int)));
    connect(m_skin, SIGNAL(skinChanged()), SLOT(updateSkin()));
    connect(m_buttonAdd, SIGNAL(clicked()), SLOT(showAddMenu()));
    connect(m_buttonSub, SIGNAL(clicked()), SLOT(showSubMenu()));
    connect(m_selectButton, SIGNAL(clicked()), SLOT(showSelectMenu()));
    connect(m_sortButton, SIGNAL(clicked()), SLOT(showSortMenu()));
    connect(m_playlistButton, SIGNAL(clicked()), SLOT(showPlaylistMenu()));

    connect(m_pl_control, SIGNAL(nextClicked()), SIGNAL(next()));
    connect(m_pl_control, SIGNAL(previousClicked()), SIGNAL(prev()));
    connect(m_pl_control, SIGNAL(playClicked()), SIGNAL(play()));
    connect(m_pl_control, SIGNAL(pauseClicked()), SIGNAL(pause()));
    connect(m_pl_control, SIGNAL(stopClicked()), SIGNAL(stop()));
    connect(m_pl_control, SIGNAL(ejectClicked()), SIGNAL(eject()));

    connect(m_pl_manager, SIGNAL(selectedPlayListChanged(PlayListModel *, PlayListModel *)),
            m_listWidget, SLOT(setModel(PlayListModel*, PlayListModel*)));
    m_listWidget->setModel(m_pl_manager->selectedPlayList());

    createMenus();
    createActions();
    readSettings();

    m_titleBar = new PlayListTitleBar (this);
    m_titleBar->setMinimumSize(0,0);
    m_titleBar->move(0,0);
    connect(m_pl_manager, SIGNAL(currentPlayListChanged(PlayListModel *, PlayListModel *)),
            SLOT(onCurrentPlayListChanged(PlayListModel*,PlayListModel*)));
    connect(m_pl_manager->currentPlayList(), SIGNAL(listChanged(int)), SLOT(onListChanged(int)));
    m_titleBar->setModel(m_pl_manager->currentPlayList());

    setCursor(m_skin->getCursor(Skin::CUR_PNORMAL));
    updatePositions();
    setTime(-1);
}

PlayList::~PlayList()
{
    delete m_keyboardManager;
}

void PlayList::updatePositions()
{
    int sx = (width()-275*m_ratio)/25;
    int sy = (height()-116*m_ratio)/29;
    if (sx < 0 || sy < 0 || m_shaded) //skip shaded mode
        return;

    m_titleBar->resize (275*m_ratio+25*sx, 20*m_ratio);
    m_plslider->resize (20*m_ratio, 58*m_ratio+sy*29);

    int pl_x = 12*m_ratio;
    int pl_y = 20*m_ratio;
    int pl_w = 243*m_ratio+25*sx;
    int pl_h = 58*m_ratio+29*sy;

    if(m_pl_selector)
    {
        m_pl_selector->resize(243*m_ratio+25*sx, m_pl_selector->height());
        m_pl_selector->move(12*m_ratio, 20*m_ratio + 58*m_ratio+29*sy - m_pl_selector->height());
        pl_h -= m_pl_selector->height();
    }

    m_listWidget->resize (pl_w, pl_h);
    m_listWidget->move (pl_x, pl_y);

    m_buttonAdd->move (11*m_ratio, 86*m_ratio+29*sy);
    m_buttonSub->move (40*m_ratio, 86*m_ratio+29*sy);
    m_selectButton->move (70*m_ratio, 86*m_ratio+29*sy);
    m_sortButton->move (99*m_ratio, 86*m_ratio+29*sy);

    m_pl_control->move (128*m_ratio+sx*25, 100*m_ratio+29*sy);
    m_playlistButton->move (228*m_ratio+sx*25, 86*m_ratio+29*sy);

    m_length_totalLength -> move (132*m_ratio+sx*25, 88*m_ratio+29*sy);
    m_current_time->move (191*m_ratio+sx*25,101*m_ratio+29*sy);

    m_plslider->move (255*m_ratio+sx*25,20*m_ratio);
    m_resizeWidget->move(width() - 25, height() - 29);
}

void PlayList::createMenus()
{
    m_addMenu = new QMenu (this);
    m_subMenu = new QMenu (this);
    m_selectMenu = new QMenu (this);
    m_sortMenu = new QMenu (this);
    m_playlistMenu = new QMenu (this);
    m_copySelectedMenu = new QMenu (tr("&Copy Selection To"), m_listWidget->menu());
    m_copySelectedMenu->setIcon(QIcon::fromTheme("edit-copy"));
    connect(m_copySelectedMenu, SIGNAL(aboutToShow()),
            SLOT(generateCopySelectedMenu()));
    connect(m_copySelectedMenu, SIGNAL(triggered(QAction *)),
            SLOT(copySelectedMenuActionTriggered(QAction *)));
}

void PlayList::createActions()
{
    //add menu
    m_addMenu->addAction(SET_ACTION(ActionManager::PL_ADD_FILE, parent(), SLOT(addFile())));
    m_addMenu->addAction(SET_ACTION(ActionManager::PL_ADD_DIRECTORY, parent(), SLOT(addDir())));
    m_addMenu->addAction(SET_ACTION(ActionManager::PL_ADD_URL, parent(), SLOT(addUrl())));
    UiHelper::instance()->registerMenu(UiHelper::ADD_MENU, m_addMenu, false);
    //sub menu
    m_subMenu->addAction(SET_ACTION(ActionManager::PL_REMOVE_SELECTED, m_pl_manager, SLOT(removeSelected())));
    m_subMenu->addAction(SET_ACTION(ActionManager::PL_REMOVE_ALL, m_pl_manager, SLOT(clear())));
    m_subMenu->addAction(SET_ACTION(ActionManager::PL_REMOVE_UNSELECTED, m_pl_manager,
                                SLOT(removeUnselected())));
    m_subMenu->addSeparator();
    m_subMenu->addAction(SET_ACTION(ActionManager::PL_REFRESH, m_pl_manager,
                                SLOT(refresh())));
    m_subMenu->addAction(SET_ACTION(ActionManager::PL_REMOVE_INVALID, m_pl_manager,
                                SLOT(removeInvalidTracks())));
    m_subMenu->addAction(SET_ACTION(ActionManager::PL_REMOVE_DUPLICATES, m_pl_manager,
                                SLOT(removeDuplicates())));
    //sort menu
    m_sortMenu->addAction(SET_ACTION(ActionManager::PL_SHOW_INFO, m_pl_manager, SLOT(showDetails ())));
    m_sortMenu->addSeparator();

    QMenu* sort_mode_menu = new QMenu (tr("Sort List"), this);
    sort_mode_menu->setIcon(QIcon::fromTheme("view-sort-ascending"));

    QAction *titleAct = sort_mode_menu->addAction(tr ("By Title"));
    connect(titleAct, &QAction::triggered, [this]{ m_pl_manager->sort(PlayListModel::TITLE); } );

    QAction *albumAct = sort_mode_menu->addAction(tr ("By Album"));
    connect(albumAct, &QAction::triggered, [this]{ m_pl_manager->sort(PlayListModel::ALBUM); } );

    QAction *artistAct = sort_mode_menu->addAction(tr ("By Artist"));
    connect(artistAct, &QAction::triggered, [this]{ m_pl_manager->sort(PlayListModel::ARTIST); } );

    QAction *albumArtistAct = sort_mode_menu->addAction(tr ("By Album Artist"));
    connect(albumArtistAct, &QAction::triggered, [this]{ m_pl_manager->sort(PlayListModel::ALBUMARTIST); } );

    QAction *nameAct = sort_mode_menu->addAction(tr ("By Filename"));
    connect(nameAct, &QAction::triggered, [this]{ m_pl_manager->sort(PlayListModel::FILENAME); } );

    QAction *pathnameAct = sort_mode_menu->addAction(tr ("By Path + Filename"));
    connect(pathnameAct, &QAction::triggered, [this]{ m_pl_manager->sort(PlayListModel::PATH_AND_FILENAME); } );

    QAction *dateAct = sort_mode_menu->addAction(tr ("By Date"));
    connect(dateAct, &QAction::triggered, [this]{ m_pl_manager->sort(PlayListModel::DATE); } );

    QAction *trackAct = sort_mode_menu->addAction(tr("By Track Number"));
    connect(trackAct, &QAction::triggered, [this]{ m_pl_manager->sort(PlayListModel::TRACK); } );

    QAction *discAct = sort_mode_menu->addAction(tr("By Disc Number"));
    connect(discAct, &QAction::triggered, [this]{ m_pl_manager->sort(PlayListModel::DISCNUMBER); } );

    QAction *fileCreationDateAct = sort_mode_menu->addAction(tr("By File Creation Date"));
    connect(fileCreationDateAct, &QAction::triggered, [this]{ m_pl_manager->sort(PlayListModel::FILE_CREATION_DATE); } );

    QAction *fileModificationDateAct = sort_mode_menu->addAction(tr("By File Modification Date"));
    connect(fileModificationDateAct, &QAction::triggered, [this]{ m_pl_manager->sort(PlayListModel::FILE_MODIFICATION_DATE); } );

    QAction *groupAct = sort_mode_menu->addAction(tr("By Group"));
    connect(groupAct, &QAction::triggered, [this]{ m_pl_manager->sort(PlayListModel::GROUP); } );

    m_sortMenu->addMenu (sort_mode_menu);

    sort_mode_menu = new QMenu (tr("Sort Selection"), m_sortMenu);
    sort_mode_menu->setIcon(QIcon::fromTheme("view-sort-ascending"));
    titleAct = sort_mode_menu->addAction(tr ("By Title"));
    connect(titleAct, &QAction::triggered, [this]{ m_pl_manager->sortSelection(PlayListModel::TITLE); });

    albumAct = sort_mode_menu->addAction(tr ("By Album"));
    connect(albumAct, &QAction::triggered, [this]{ m_pl_manager->sortSelection(PlayListModel::ALBUM); });

    artistAct = sort_mode_menu->addAction(tr ("By Artist"));
    connect(artistAct, &QAction::triggered, [this]{ m_pl_manager->sortSelection(PlayListModel::ARTIST); });

    albumArtistAct = sort_mode_menu->addAction(tr ("By Album Artist"));
    connect(albumArtistAct, &QAction::triggered, [this]{ m_pl_manager->sortSelection(PlayListModel::ALBUMARTIST); });

    nameAct = sort_mode_menu->addAction(tr ("By Filename"));
    connect(nameAct, &QAction::triggered, [this]{ m_pl_manager->sortSelection(PlayListModel::FILENAME); });

    pathnameAct = sort_mode_menu->addAction(tr ("By Path + Filename"));
    connect(pathnameAct, &QAction::triggered, [this]{ m_pl_manager->sortSelection(PlayListModel::PATH_AND_FILENAME); });

    dateAct = sort_mode_menu->addAction(tr ("By Date"));
    connect(dateAct, &QAction::triggered, [this]{ m_pl_manager->sortSelection(PlayListModel::DATE); });

    trackAct = sort_mode_menu->addAction(tr ("By Track Number"));
    connect(trackAct, &QAction::triggered, [this]{ m_pl_manager->sortSelection(PlayListModel::TRACK); });

    discAct = sort_mode_menu->addAction(tr("By Disc Number"));
    connect(discAct, &QAction::triggered, [this]{ m_pl_manager->sortSelection(PlayListModel::DISCNUMBER); });

    fileCreationDateAct = sort_mode_menu->addAction(tr("By File Creation Date"));
    connect(fileCreationDateAct, &QAction::triggered, [this]{ m_pl_manager->sortSelection(PlayListModel::FILE_CREATION_DATE); });

    fileModificationDateAct = sort_mode_menu->addAction(tr("By File Modification Date"));
    connect(fileModificationDateAct, &QAction::triggered, [this]{ m_pl_manager->sortSelection(PlayListModel::FILE_MODIFICATION_DATE ); });

    m_sortMenu->addMenu (sort_mode_menu);
    m_sortMenu->addSeparator();
    m_sortMenu->addAction (QIcon::fromTheme("media-playlist-shuffle"), tr("Randomize List"),
                           m_pl_manager, SLOT(randomizeList()));
    m_sortMenu->addAction (QIcon::fromTheme("view-sort-descending"), tr("Reverse List"),
                           m_pl_manager, SLOT(reverseList()));

    m_sortMenu->addAction(SET_ACTION(ActionManager::PL_GROUP_TRACKS, m_ui_settings, SLOT(setGroupsEnabled(bool))));
    m_sortMenu->addAction(ACTION(ActionManager::PL_SHOW_HEADER));
    ACTION(ActionManager::PL_GROUP_TRACKS)->setChecked(m_ui_settings->isGroupsEnabled());
    //playlist context menu
    m_listWidget->menu()->addAction(ActionManager::instance()->action(ActionManager::PL_SHOW_INFO));
    m_listWidget->menu()->addSeparator();
    m_listWidget->menu()->addActions (m_subMenu->actions().mid(0,3)); //use 3 first actions
    m_listWidget->menu()->addMenu(UiHelper::instance()->createMenu(UiHelper::PLAYLIST_MENU,
                                  tr("Actions"), true, this));
    m_listWidget->menu()->addSeparator();
    m_listWidget->menu()->addAction(SET_ACTION(ActionManager::PL_ENQUEUE, m_pl_manager, SLOT(addToQueue())));
    //select menu
    m_selectMenu->addAction(SET_ACTION(ActionManager::PL_INVERT_SELECTION, m_pl_manager,
                                   SLOT(invertSelection ())));
    m_selectMenu->addSeparator();
    m_selectMenu->addAction(SET_ACTION(ActionManager::PL_CLEAR_SELECTION, m_pl_manager,
                                   SLOT(clearSelection ())));
    m_selectMenu->addAction(SET_ACTION(ActionManager::PL_SELECT_ALL, m_pl_manager, SLOT(selectAll())));
    //Playlist Menu
    m_playlistMenu->addAction(SET_ACTION(ActionManager::PL_NEW, m_pl_manager, SLOT(createPlayList())));
    m_playlistMenu->addAction(SET_ACTION(ActionManager::PL_CLOSE, this, SLOT(deletePlaylist())));
    m_playlistMenu->addAction(SET_ACTION(ActionManager::PL_RENAME, this, SLOT(renamePlaylist())));
    m_playlistMenu->addSeparator();
    m_playlistMenu->addAction(SET_ACTION(ActionManager::PL_LOAD, this, SIGNAL(loadPlaylist())));
    m_playlistMenu->addAction(SET_ACTION(ActionManager::PL_SAVE, this, SIGNAL(savePlaylist())));
    m_playlistMenu->addSeparator();
    m_playlistMenu->addAction(SET_ACTION(ActionManager::PL_SELECT_NEXT, m_pl_manager,
                                     SLOT(selectNextPlayList())));
    m_playlistMenu->addAction(SET_ACTION(ActionManager::PL_SELECT_PREVIOUS, m_pl_manager,
                                     SLOT(selectPreviousPlayList())));
    m_playlistMenu->addAction(SET_ACTION(ActionManager::PL_SHOW_MANAGER, this, SLOT(showPlayLists())));
}

void PlayList::closeEvent (QCloseEvent *e)
{
    if (e->spontaneous ())
        parentWidget()->close();
}

void PlayList::paintEvent (QPaintEvent *)
{
    int sx = (width()-275*m_ratio) /25;
    int sy = (height()-116*m_ratio) /29;

    QPainter paint(this);
    drawPixmap (&paint, 0, 20*m_ratio, m_skin->getPlPart (Skin::PL_LFILL));
    for (int i = 1; i<sy+2*m_ratio; i++)
    {
        drawPixmap (&paint, 0, 20*m_ratio+29*i, m_skin->getPlPart (Skin::PL_LFILL));
    }
    drawPixmap (&paint, 0, 78*m_ratio+29*sy, m_skin->getPlPart (Skin::PL_LSBAR));

    for (int i = 0; i<sx; i++)
    {
        drawPixmap (&paint, 125*m_ratio+i*25,78*m_ratio+sy*29,m_skin->getPlPart (Skin::PL_SFILL1));
    }
    drawPixmap (&paint,125*m_ratio+sx*25,78*m_ratio+sy*29,m_skin->getPlPart (Skin::PL_RSBAR));

}

void PlayList::drawPixmap (QPainter *painter, int x, int y, const QPixmap &pix)
{
    style()->drawItemPixmap(painter, QRect(x, y, pix.width(), pix.height()), Qt::AlignCenter, pix);
}

void PlayList::resizeEvent (QResizeEvent *)
{
    updatePositions();
}