aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Input/mpeg
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/Input/mpeg')
-rw-r--r--src/plugins/Input/mpeg/decodermpegfactory.cpp4
-rw-r--r--src/plugins/Input/mpeg/decodermpegfactory.h2
-rw-r--r--src/plugins/Input/mpeg/mpegmetadatamodel.cpp4
-rw-r--r--src/plugins/Input/mpeg/mpegmetadatamodel.h4
4 files changed, 7 insertions, 7 deletions
diff --git a/src/plugins/Input/mpeg/decodermpegfactory.cpp b/src/plugins/Input/mpeg/decodermpegfactory.cpp
index 5d9e6202a..0c1356262 100644
--- a/src/plugins/Input/mpeg/decodermpegfactory.cpp
+++ b/src/plugins/Input/mpeg/decodermpegfactory.cpp
@@ -361,9 +361,9 @@ QList<TrackInfo *> DecoderMPEGFactory::createPlayList(const QString &path, Track
return QList<TrackInfo*>() << info;
}
-MetaDataModel* DecoderMPEGFactory::createMetaDataModel(const QString &path, bool readOnly, QObject *parent)
+MetaDataModel* DecoderMPEGFactory::createMetaDataModel(const QString &path, bool readOnly)
{
- return new MPEGMetaDataModel(m_using_rusxmms, path, readOnly, parent);
+ return new MPEGMetaDataModel(m_using_rusxmms, path, readOnly);
}
void DecoderMPEGFactory::showSettings(QWidget *parent)
diff --git a/src/plugins/Input/mpeg/decodermpegfactory.h b/src/plugins/Input/mpeg/decodermpegfactory.h
index 58a3487ff..52210fb23 100644
--- a/src/plugins/Input/mpeg/decodermpegfactory.h
+++ b/src/plugins/Input/mpeg/decodermpegfactory.h
@@ -34,7 +34,7 @@ public:
DecoderProperties properties() const;
Decoder *create(const QString &, QIODevice *input);
QList<TrackInfo *> createPlayList(const QString &path, TrackInfo::Parts parts, QStringList *);
- MetaDataModel* createMetaDataModel(const QString &path, bool readOnly, QObject *parent = 0);
+ MetaDataModel* createMetaDataModel(const QString &path, bool readOnly);
void showSettings(QWidget *parent);
void showAbout(QWidget *parent);
QString translation() const;
diff --git a/src/plugins/Input/mpeg/mpegmetadatamodel.cpp b/src/plugins/Input/mpeg/mpegmetadatamodel.cpp
index 15712d0b5..3399c901d 100644
--- a/src/plugins/Input/mpeg/mpegmetadatamodel.cpp
+++ b/src/plugins/Input/mpeg/mpegmetadatamodel.cpp
@@ -34,8 +34,8 @@
#include <taglib/id3v2framefactory.h>
#include "mpegmetadatamodel.h"
-MPEGMetaDataModel::MPEGMetaDataModel(bool using_rusxmms, const QString &path, bool readOnly, QObject *parent) :
- MetaDataModel(readOnly, parent)
+MPEGMetaDataModel::MPEGMetaDataModel(bool using_rusxmms, const QString &path, bool readOnly) :
+ MetaDataModel(readOnly)
{
m_stream = new TagLib::FileStream(QStringToFileName(path), readOnly);
m_file = new TagLib::MPEG::File(m_stream, TagLib::ID3v2::FrameFactory::instance());
diff --git a/src/plugins/Input/mpeg/mpegmetadatamodel.h b/src/plugins/Input/mpeg/mpegmetadatamodel.h
index ec2e15355..dc0b2c77a 100644
--- a/src/plugins/Input/mpeg/mpegmetadatamodel.h
+++ b/src/plugins/Input/mpeg/mpegmetadatamodel.h
@@ -29,9 +29,9 @@ class QTextCodec;
class MPEGMetaDataModel : public MetaDataModel
{
-Q_OBJECT
+ Q_DECLARE_TR_FUNCTIONS(MPEGMetaDataModel)
public:
- MPEGMetaDataModel(bool using_rusxmms, const QString &path, bool readOnly, QObject *parent);
+ MPEGMetaDataModel(bool using_rusxmms, const QString &path, bool readOnly);
~MPEGMetaDataModel();
QList<MetaDataItem> extraProperties() const;
QList<TagModel* > tags() const;
rialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> 2008-08-21 17:19:01 +0000 imported 0.2 fixes' href='/qmmp/commit/src/ui/skin.cpp?id=46c25b4121fafda15baed14474a019a25bb667c0'>46c25b412
2d622fd9b




46c25b412

2d622fd9b

ae75e5707
2d622fd9b












46c25b412
2d622fd9b
ae75e5707
2d622fd9b

de26ec727

2d622fd9b














bfb812b86
2d622fd9b


7375ed80c
2d622fd9b





2d622fd9b








46c25b412
2d622fd9b










46c25b412

2d622fd9b
46c25b412

2d622fd9b
46c25b412

2d622fd9b
46c25b412

2d622fd9b
46c25b412

2d622fd9b
46c25b412

2d622fd9b











46c25b412













2d622fd9b











0843db1a0

46c25b412

0843db1a0







46c25b412
2d622fd9b





46c25b412






31d3fbf75
46c25b412
2d622fd9b
31d3fbf75
2d622fd9b
46c25b412

2d622fd9b
31d3fbf75








2d622fd9b
31d3fbf75
2d622fd9b












46c25b412

2d622fd9b
46c25b412

2d622fd9b
46c25b412

2d622fd9b
46c25b412

2d622fd9b



46c25b412

2d622fd9b
46c25b412







2d622fd9b


46c25b412



2d622fd9b
46c25b412

2d622fd9b
1e7a7fdfd

bdfdce731



1e7a7fdfd
2d622fd9b

de26ec727
2d622fd9b
46c25b412
2d622fd9b
de26ec727
2d622fd9b
46c25b412
2d622fd9b
de26ec727
2d622fd9b
46c25b412
2d622fd9b






de26ec727
46c25b412
de26ec727
46c25b412
de26ec727
2d622fd9b
de26ec727
46c25b412
de26ec727
2d622fd9b
46c25b412
2d622fd9b

46c25b412

2d622fd9b


46c25b412
2d622fd9b



de26ec727
3f1e40c12
de26ec727
3f1e40c12
2d622fd9b








46c25b412


b5833f942
46c25b412

b5833f942


46c25b412
2d622fd9b
46c25b412
2d622fd9b
46c25b412
2d622fd9b
46c25b412
2d622fd9b
46c25b412

2d622fd9b
46c25b412



2d622fd9b
46c25b412

2d622fd9b
46c25b412



2d622fd9b
46c25b412


1e7a7fdfd
46c25b412
2d622fd9b
46c25b412
2d622fd9b




bfb812b86





















2d622fd9b

de26ec727
46c25b412
de26ec727
46c25b412
de26ec727
2d622fd9b
de26ec727
46c25b412
de26ec727
2d622fd9b

46c25b412
2d622fd9b


de26ec727
2d622fd9b
46c25b412




2d622fd9b

46c25b412



2d622fd9b
46c25b412
2d622fd9b



7375ed80c
2d622fd9b
46c25b412
7375ed80c

2d622fd9b
2d622fd9b








46c25b412



2d622fd9b
46c25b412



2d622fd9b
1e7a7fdfd


46c25b412

2d622fd9b
46c25b412

2d622fd9b
46c25b412

2d622fd9b
46c25b412

2d622fd9b




46c25b412
2d622fd9b





46c25b412

2d622fd9b
46c25b412

2d622fd9b
46c25b412
2d622fd9b
46c25b412
2d622fd9b





46c25b412
2d622fd9b




46c25b412
2d622fd9b
46c25b412
2d622fd9b













































46c25b412



2d622fd9b










































46c25b412
2d622fd9b














46c25b412
2d622fd9b
46c25b412
2d622fd9b





46c25b412
2d622fd9b














4ccbc35ad


de26ec727
2d622fd9b
46c25b412
2d622fd9b
46c25b412
2d622fd9b

4ccbc35ad



2d622fd9b





































46c25b412
2d622fd9b
46c25b412
2d622fd9b
46c25b412
2d622fd9b
46c25b412
2d622fd9b
46c25b412
2d622fd9b

de26ec727
2d622fd9b

de26ec727







46c25b412

de26ec727











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
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
                                                                            
                                                                            

                                                                            


                                                                            














                                                                             
 




                           
                 
                  
 
                      

                 



                        
                 



                             
                                                       
 
                                                                  
                                          
                                      
     
                                      
                                                   
                                         
         
                                                 




                     

                            

                   
                                                                 












                                                             
                                        
 
                                                                 

                                        

                                                                              














                         
                


                        
                         





                   








                                         
                                        










                                             

                                                       
 

                                                    
 

                                                     
 

                                                    
 

                                                    
 

                                                      











                                             













                                                              











                                           

                              

                                                                         







                                            
                                                     





                        






                                            
                                                                
 
                              
                                                              
        

                                                                        
                                       








                                                                
                             
                                                      












                                           

                                                           
 

                                                             
 

                                                            
 

                                                          



                                                                                                                    

                                                            
 







                                                                   


                                                       



                                                     
                                                       

                                                        
 

                                                      



                                                        
 

 
                                              
 
                                                                         
                                                 
                                      
     
                                      
                                                   
                                         
         
                                                     






                       
                                                      
                       
                                                   
                       
                                             
 
                     
                                                          
                                                            
 
                          

                                           

                                               


                                                            
                                    



                  
                                              
                                                        
                                              
                                                      








                                           


                                                              
 

                                                             


                                           
                                
     
                                                       
     
                                
     
                                                       
     

                                                           
 



                                                          
 

                                                              
 



                                                             
 


                                                           
 
                                
     
                                                       




                  





















                                                                   

                         
                                                        
                       
                                                     
                       
                                             
 
                     
                                                          
                                                            

              
                                  


                                           
                                                
                             




                                              

                    



                                           
         
                                    



                  
                                 
     
                                                     

                                           
     








                                            



                                                        
 



                                                        
 


                                                 

                                                       
 

                                                      
 

                                                       
 

                                                        




                  
                            





                                     

                                     
     

                                    
         
                                                  
         
                           





                  
                                   




                                              
                                 
     
                                               













































                                              



                                                       










































                                                        
                                                                   














                                                                              
                                            
                
                                      





                                           
                                                      














                                                                            


                             
                                                      
 
                       
     
                                                                       

               



                                                                





































                                                                            
                                                                  
                                          
                                      
     
                                      
                                                   
                                         
         
                                                     

         
                                           

             







                                                                  

                                                  











                                                                     
/***************************************************************************
 *   Copyright (C) 2007-2008 by Ilya Kotov                                 *
 *   forkotov02@hotmail.ru                                                 *
 *                                                                         *
 *   Based on Promoe, an XMMS2 Client                                      *
 *   Copyright (C) 2005-2006 by XMMS2 Team                                 *
 *                                                                         *
 *   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.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#include <QCoreApplication>
#include <QDir>
#include <QSettings>
#include <QPainter>
#include <QPolygon>
#include <QImage>
#include <QBuffer>

#include <qmmp/qmmp.h>
#include "skin.h"

Skin *Skin::pointer = 0;

Skin *Skin::getPointer()
{
    if (!pointer)
        pointer = new Skin();
    return pointer;
}

QPixmap Skin::getPixmap (const QString& name, QDir dir)
{
    dir.setFilter (QDir::Files | QDir::Hidden | QDir::NoSymLinks);
    QFileInfoList f = dir.entryInfoList();
    for (int j = 0; j < f.size(); ++j)
    {
        QFileInfo fileInfo = f.at (j);
        QString fn = fileInfo.fileName().toLower();
        if (fn.section (".",0,0) == name)
        {
            return QPixmap (fileInfo.filePath());
        }
    }
    return QPixmap();
}

Skin::Skin (QObject *parent)
        : QObject (parent)
{
    pointer = this;
    QSettings settings(Qmmp::configFile(), QSettings::IniFormat);
    QString path = settings.value("skin_path","").toString();
    if (path.isEmpty() || !QDir(path).exists ())
        path = ":/default";
    setSkin (QDir::cleanPath(path));
    /* skin directory */
    QDir skinDir(QDir::homePath()+"/.qmmp");
    skinDir.mkdir ("skins");
}


Skin::~Skin()
{}

void Skin::setSkin (const QString& path)
{
    QSettings settings(Qmmp::configFile(), QSettings::IniFormat);
    settings.setValue("skin_path",path);

    qDebug ("Skin: set skin %s",qPrintable(path));    //TODO don't clear lists
    m_skin_dir = QDir (path);

    m_pledit_txt.clear();
    loadPLEdit();
    loadMain();
    buttons.clear();
    loadButtons();
    loadShufRep();
    titlebar.clear();
    loadTitleBar();
    loadPosBar();
    m_numbers.clear();
    loadNumbers();
    m_pl_parts.clear();
    loadPlayList();
    m_eq_parts.clear();
    loadEq_ex();
    m_eq_bar.clear();
    m_eq_spline.clear();
    loadEqMain();
    m_vis_colors.clear();
    loadVisColor();
    loadLetters();
    loadMonoSter();
    loadVolume();
    loadBalance();
    loadRegion();
    emit skinChanged();
}

void Skin::loadMain()
{
    QPixmap *pixmap = getPixmap ("main");
    if (!pixmap)
        pixmap = getDummyPixmap("main");

    m_main = pixmap->copy (0,0,275,116);
    delete pixmap;
}

void Skin::loadButtons()
{

    QPixmap *pixmap = getPixmap ("cbuttons");

    if (!pixmap)
        pixmap = getDummyPixmap("cbuttons");

    buttons[BT_PREVIOUS_N] = pixmap->copy (0, 0,23,18);
    buttons[BT_PREVIOUS_P] = pixmap->copy (0,18,23,18);

    buttons[BT_PLAY_N] = pixmap->copy (23, 0,23,18);
    buttons[BT_PLAY_P] = pixmap->copy (23,18,23,18);

    buttons[BT_PAUSE_N] = pixmap->copy (46, 0,23,18);
    buttons[BT_PAUSE_P] = pixmap->copy (46,18,23,18);

    buttons[BT_STOP_N] = pixmap->copy (69, 0,23,18);
    buttons[BT_STOP_P] = pixmap->copy (69,18,23,18);

    buttons[BT_NEXT_N] = pixmap->copy (92, 0,22,18);
    buttons[BT_NEXT_P] = pixmap->copy (92,18,22,18);

    buttons[BT_EJECT_N] = pixmap->copy (114, 0,22,16);
    buttons[BT_EJECT_P] = pixmap->copy (114,16,22,16);
    delete pixmap;

}

void Skin::loadTitleBar()
{

    QPixmap *pixmap = getPixmap ("titlebar");

    if (!pixmap)
        pixmap = getDummyPixmap("titlebar");

    buttons[BT_MENU_N] = pixmap->copy (0,0,9,9);
    buttons[BT_MENU_P] = pixmap->copy (0,9,9,9);
    buttons[BT_MINIMIZE_N] = pixmap->copy (9,0,9,9);
    buttons[BT_MINIMIZE_P] = pixmap->copy (9,9,9,9);
    buttons[BT_CLOSE_N] = pixmap->copy (18,0,9,9);
    buttons[BT_CLOSE_P] = pixmap->copy (18,9,9,9);
    buttons[BT_SHADE1_N] = pixmap->copy (0,18,9,9);
    buttons[BT_SHADE1_P] = pixmap->copy (9,18,9,9);
    buttons[BT_SHADE2_N] = pixmap->copy (0,27,9,9);
    buttons[BT_SHADE2_P] = pixmap->copy (9,27,9,9);
    titlebar[TITLEBAR_A] = pixmap->copy (27, 0,275,14);
    titlebar[TITLEBAR_I] = pixmap->copy (27,15,275,14);
    titlebar[TITLEBAR_SHADED_A] = pixmap->copy (27,29,275,14);
    titlebar[TITLEBAR_SHADED_I] = pixmap->copy (27,42,275,14);
    delete pixmap;

}

void Skin::loadPosBar()
{

    QPixmap *pixmap = getPixmap ("posbar");

    if (!pixmap)
        pixmap = getDummyPixmap("posbar");

    if (pixmap->width() > 249)
    {
        buttons[BT_POSBAR_N] = pixmap->copy (248,0,29, pixmap->height());
        buttons[BT_POSBAR_P] = pixmap->copy (278,0,29, pixmap->height());
    }
    else
    {
        QPixmap dummy(29, pixmap->height());
        dummy.fill(Qt::transparent);
        buttons[BT_POSBAR_N] = dummy;
        buttons[BT_POSBAR_P] = dummy;
    }
    posbar = pixmap->copy (0,0,248,pixmap->height());
    delete pixmap;

}

void Skin::loadNumbers()
{
    QPixmap *pixmap = getPixmap ("nums_ex");
    if (!pixmap)
        pixmap = getPixmap ("numbers");
    if (!pixmap)
        pixmap = getDummyPixmap("numbers");

    for (uint i = 0; i < 10; i++)
        m_numbers << pixmap->copy (i*9, 0, 9, pixmap->height());

    if (pixmap->width() > 107)
        m_numbers << pixmap->copy(99, 0, 9, pixmap->height());
    else
    {
        // We didn't find "-" symbol. So we have to extract it from "2".
        // Winamp uses this method too.
        QPixmap pix;
        if(pixmap->width() > 98)
            pix = pixmap->copy(90,0,9,pixmap->height());
        else
        {
            pix = QPixmap(9, pixmap->height());
            pix.fill(Qt::transparent);
        }
        QPixmap minus = pixmap->copy(18,pixmap->height()/2,9,1);
        QPainter paint(&pix);
        paint.drawPixmap(0,pixmap->height()/2, minus);
        m_numbers << pix;
    }
    delete pixmap;
}

void Skin::loadPlayList()
{

    QPixmap *pixmap = getPixmap ("pledit");

    if (!pixmap)
        pixmap = getDummyPixmap("pledit");

    m_pl_parts[PL_CORNER_UL_A] = pixmap->copy (0,0,25,20);
    m_pl_parts[PL_CORNER_UL_I] = pixmap->copy (0,21,25,20);

    m_pl_parts[PL_CORNER_UR_A] = pixmap->copy (153,0,25,20);
    m_pl_parts[PL_CORNER_UR_I] = pixmap->copy (153,21,25,20);

    m_pl_parts[PL_TITLEBAR_A] = pixmap->copy (26,0,100,20);
    m_pl_parts[PL_TITLEBAR_I] = pixmap->copy (26,21,100,20);

    m_pl_parts[PL_TFILL1_A] = pixmap->copy (127,0,25,20);
    m_pl_parts[PL_TFILL1_I] = pixmap->copy (127,21,25,20);

    //m_pl_parts[PL_TFILL2_A] = pixmap->copy();//FIXME: �����
    //m_pl_parts[PL_TFILL2_I] = pixmap->copy();

    m_pl_parts[PL_LFILL] = pixmap->copy (0,42,12,29);
    m_pl_parts[PL_RFILL] = pixmap->copy (31,42,20,29); //???

    m_pl_parts[PL_LSBAR] = pixmap->copy (0,72,125,38);
    m_pl_parts[PL_RSBAR] = pixmap->copy (126,72,150,38);
    m_pl_parts[PL_SFILL1] = pixmap->copy (179,0,25,38);
    m_pl_parts[PL_SFILL2] = pixmap->copy (250,21,75,38);
    m_pl_parts[PL_TITLEBAR_SHADED1_A] = pixmap->copy (99,42,50,14);
    m_pl_parts[PL_TITLEBAR_SHADED1_I] = pixmap->copy (99,57,50,14);
    m_pl_parts[PL_TITLEBAR_SHADED2] = pixmap->copy (72,42,25,14);
    m_pl_parts[PL_TFILL_SHADED] = pixmap->copy (72,57,25,14);

    m_pl_parts[PL_CONTROL] = pixmap->copy(129,94,60,8);

    buttons[PL_BT_ADD] = pixmap->copy (11,80,25,18);
    buttons[PL_BT_SUB] = pixmap->copy (40,80,25,18);
    buttons[PL_BT_SEL] = pixmap->copy (70,80,25,18);
    buttons[PL_BT_SORT] = pixmap->copy (99,80,25,18);
    buttons[PL_BT_LST] = pixmap->copy(229, 80, 25, 18);
    buttons[PL_BT_SCROLL_N] = pixmap->copy (52,53,8,18);
    buttons[PL_BT_SCROLL_P] = pixmap->copy (61,53,8,18);

    buttons[PL_BT_CLOSE_N] = pixmap->copy (167,3,9,9);
    buttons[PL_BT_CLOSE_P] = pixmap->copy (52,42,9,9);
    buttons[PL_BT_SHADE1_N] = pixmap->copy (158,3,9,9);
    buttons[PL_BT_SHADE1_P] = pixmap->copy (62,42,9,9);
    buttons[PL_BT_SHADE2_N] = pixmap->copy (129,45,9,9);
    buttons[PL_BT_SHADE2_P] = pixmap->copy (150,42,9,9);

}

QPixmap *Skin::getPixmap (const QString& name)
{
    m_skin_dir.setFilter (QDir::Files | QDir::Hidden | QDir::NoSymLinks);
    QFileInfoList f = m_skin_dir.entryInfoList();
    for (int j = 0; j < f.size(); ++j)
    {
        QFileInfo fileInfo = f.at (j);
        QString fn = fileInfo.fileName().toLower();
        if (fn.section (".",0,0) == name)
        {
            return new QPixmap (fileInfo.filePath());
        }
    }
    return 0;
}

void Skin::loadPLEdit()
{
    QString path = findFile("pledit.txt", m_skin_dir);
    if (path.isEmpty())
        path = findFile("pledit.txt", ":/default");
    if (path.isEmpty())
        qFatal("Skin: invalid default skin");

    QFile file(path);
    if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
        qFatal("Skin: unable to open %s", qPrintable(path));

    while (!file.atEnd ())
    {
        QByteArray line = file.readLine ();
        QList<QByteArray> l = line.split ('=');
        if (l.count () == 2)
        {
            m_pledit_txt[l[0].toLower () ] = l[1].trimmed();
        }
        else if (line.length() == 0)
        {
            break;
        }
    }
    if (!m_pledit_txt.keys().contains("mbbg"))
        m_pledit_txt["mbbg"] = m_pledit_txt["normalbg"];
    if (!m_pledit_txt.keys().contains("mbfg"))
        m_pledit_txt["mbfg"] = m_pledit_txt["normal"];
}

void Skin::loadEqMain()
{
    QPixmap *pixmap = getPixmap ("eqmain");

    if (!pixmap)
        pixmap = getDummyPixmap("eqmain");

    m_eq_parts[ EQ_MAIN ] = pixmap->copy (0,0,275,116);
    m_eq_parts[ EQ_TITLEBAR_A ] = pixmap->copy (0,134,275,14);
    m_eq_parts[ EQ_TITLEBAR_I ] = pixmap->copy (0,149,275,14);

    if (pixmap->height() > 295)
        m_eq_parts[ EQ_GRAPH ] = pixmap->copy (0,294,113,19);
    else
        m_eq_parts[ EQ_GRAPH ] = QPixmap();

    for (int i = 0; i < 14; ++i)
    {
        m_eq_bar << pixmap->copy (13 + i*15,164,14,63);
    }
    for (int i = 0; i < 14; ++i)
    {
        m_eq_bar << pixmap->copy (13 + i*15,229,14,63);
    }
    buttons[ EQ_BT_BAR_N ] = pixmap->copy (0,164,11,11);
    buttons[ EQ_BT_BAR_P ] = pixmap->copy (0,164+12,11,11);

    buttons[ EQ_BT_ON_N ] = pixmap->copy (69,119,28,12);
    buttons[ EQ_BT_ON_P ] = pixmap->copy (128,119,28,12);
    buttons[ EQ_BT_OFF_N ] = pixmap->copy (10, 119,28,12);
    buttons[ EQ_BT_OFF_P ] = pixmap->copy (187,119,28,12);

    buttons[ EQ_BT_PRESETS_N ] = pixmap->copy (224,164,44,12);
    buttons[ EQ_BT_PRESETS_P ] = pixmap->copy (224,176,44,12);

    buttons[ EQ_BT_AUTO_1_N ] = pixmap->copy (94,119,33,12);
    buttons[ EQ_BT_AUTO_1_P ] = pixmap->copy (153,119,33,12);
    buttons[ EQ_BT_AUTO_0_N ] = pixmap->copy (35, 119,33,12);
    buttons[ EQ_BT_AUTO_0_P ] = pixmap->copy (212,119,33,12);

    buttons[ EQ_BT_CLOSE_N ] = pixmap->copy (0,116,9,9);
    buttons[ EQ_BT_CLOSE_P ] = pixmap->copy (0,125,9,9);
    buttons[ EQ_BT_SHADE1_N ] = pixmap->copy (254,137,9,9);

    for (int i = 0; i < 19; ++i)
    {
        m_eq_spline << pixmap->copy (115, 294+i, 1, 1);
    }
    delete pixmap;

}

void Skin::loadEq_ex()
{
    QPixmap *pixmap = getPixmap ("eq_ex");

    if (!pixmap)
        pixmap = getDummyPixmap("eq_ex");

    buttons[ EQ_BT_SHADE1_P ] = pixmap->copy (1,38,9,9);
    buttons[ EQ_BT_SHADE2_N ] = pixmap->copy (254,3,9,9);
    buttons[ EQ_BT_SHADE2_P ] = pixmap->copy (1,47,9,9);
    m_eq_parts[ EQ_TITLEBAR_SHADED_A ] = pixmap->copy(0,0,275,14);
    m_eq_parts[ EQ_TITLEBAR_SHADED_I ] = pixmap->copy(0,15,275,14);
    m_eq_parts[ EQ_VOLUME1 ] = pixmap->copy(1,30,3,8);
    m_eq_parts[ EQ_VOLUME2 ] = pixmap->copy(4,30,3,8);
    m_eq_parts[ EQ_VOLUME3 ] = pixmap->copy(7,30,3,8);
    m_eq_parts[ EQ_BALANCE1 ] = pixmap->copy(11,30,3,8);
    m_eq_parts[ EQ_BALANCE2 ] = pixmap->copy(14,30,3,8);
    m_eq_parts[ EQ_BALANCE3 ] = pixmap->copy(17,30,3,8);

    delete pixmap;
}

void Skin::loadVisColor()
{
    QString path = findFile("viscolor.txt", m_skin_dir);
    if (path.isEmpty())
        path = findFile("viscolor.txt", ":/default");
    if (path.isEmpty())
        qFatal("Skin: invalid default skin");

    QFile file(path);
    if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
        qFatal("Skin: unable to open %s", qPrintable(path));

    int j = 0;
    while (!file.atEnd () && j<24)
    {
        j++;
        QByteArray line = file.readLine ();
        QString tmp = QString::fromAscii (line);
        tmp = tmp.trimmed ();
        int i = tmp.indexOf ("//");
        if (i>0)
            tmp.truncate (tmp.indexOf ("//"));
        QStringList list = tmp.split (",");
        if (list.count () >= 3)
        {
            //colors
            int r = list.at (0).toInt();
            int g = list.at (1).toInt();
            int b = list.at (2).toInt();
            m_vis_colors << QColor (r,g,b);
        }
        else if (line.length() == 0)
        {
            break;
        }
    }
    if (m_vis_colors.size() < 24)
    {
        qWarning ("Skin: cannot parse viscolor.txt");
        while (m_vis_colors.size() < 24)
            m_vis_colors << QColor (0,0,0);
    }
}

void Skin::loadShufRep()
{
    QPixmap *pixmap = getPixmap ("shufrep");

    if (!pixmap)
        pixmap = getDummyPixmap("shufrep");

    buttons[ BT_EQ_ON_N ] = pixmap->copy (0,73,23,12);
    buttons[ BT_EQ_ON_P ] = pixmap->copy (46,73,23,12);
    buttons[ BT_EQ_OFF_N ] = pixmap->copy (0,61,23,12);
    buttons[ BT_EQ_OFF_P ] = pixmap->copy (46,61,23,12);

    buttons[ BT_PL_ON_N ] = pixmap->copy (23,73,23,12);
    buttons[ BT_PL_ON_P ] = pixmap->copy (69,73,23,12);
    buttons[ BT_PL_OFF_N ] = pixmap->copy (23,61,23,12);
    buttons[ BT_PL_OFF_P ] = pixmap->copy (69,61,23,12);

    //buttons[ BT_PL_CLOSE_N ] = pixmap->copy ();
    //buttons[ BT_PL_CLOSE_P ] = pixmap->copy ();

    buttons[REPEAT_ON_N] = pixmap->copy (0,30, 28, 15);
    buttons[REPEAT_ON_P] = pixmap->copy (0,45, 28, 15);

    buttons[REPEAT_OFF_N] = pixmap->copy (0, 0,28,15);
    buttons[REPEAT_OFF_P] = pixmap->copy (0,15,28,15);

    buttons[SHUFFLE_ON_N] = pixmap->copy (28,30,46,15);
    buttons[SHUFFLE_ON_P] = pixmap->copy (28,45,46,15);

    buttons[SHUFFLE_OFF_N] = pixmap->copy (28, 0,46,15);
    buttons[SHUFFLE_OFF_P] = pixmap->copy (28,15,46,15);

    delete pixmap;

}

void Skin::loadLetters(void)
{
    QPixmap *img = getPixmap("text");

    if (!img)
        img = getDummyPixmap("text");

    QList<QList<QPixmap> > (letters);
    for (int i = 0; i < 3; i++)
    {
        QList<QPixmap> (l);
        for (int j = 0; j < 31; j++)
        {
            l.append (img->copy (j*5, i*6, 5, 6));
        }
        letters.append (l);
    }

    delete img;


    /* alphabet */
    for (uint i = 97; i < 123; i++)
    {
        m_letters.insert(i, letters[0][i-97]);
    }

    /* digits */
    for (uint i = 0; i <= 9; i++)
    {
        m_letters.insert (i+48, letters[1][i]);
    }

    /* special characters */
    m_letters.insert('"',  letters[0][27]);
    m_letters.insert('@',  letters[0][28]);
    m_letters.insert(':',  letters[1][12]);
    m_letters.insert('(',  letters[1][13]);
    m_letters.insert(')',  letters[1][14]);
    m_letters.insert('-',  letters[1][15]);
    m_letters.insert('\'', letters[1][16]);
    m_letters.insert('`',  letters[1][16]);
    m_letters.insert('!',  letters[1][17]);
    m_letters.insert('_',  letters[1][18]);
    m_letters.insert('+',  letters[1][19]);
    m_letters.insert('\\', letters[1][20]);
    m_letters.insert('/',  letters[1][21]);
    m_letters.insert('[',  letters[1][22]);
    m_letters.insert(']',  letters[1][23]);
    m_letters.insert('^',  letters[1][24]);
    m_letters.insert('&',  letters[1][25]);
    m_letters.insert('%',  letters[1][26]);
    m_letters.insert('.',  letters[1][27]);
    m_letters.insert(',',  letters[1][27]);
    m_letters.insert('=',  letters[1][28]);
    m_letters.insert('$',  letters[1][29]);
    m_letters.insert('#',  letters[1][30]);

    m_letters.insert(229, letters[2][0]);
    m_letters.insert(246, letters[2][1]);
    m_letters.insert(228, letters[2][2]);
    m_letters.insert('?', letters[2][3]);
    m_letters.insert('*', letters[2][4]);
    m_letters.insert(' ', letters[2][5]);

    /* text background */
    //m_items->insert (TEXTBG, letters[2][6]);
}

void Skin::loadMonoSter()
{
    QPixmap *pixmap = getPixmap("monoster");

    if (!pixmap)
        pixmap = getDummyPixmap("monoster");

    m_ms_parts.clear();
    m_ms_parts[ MONO_A ] = pixmap->copy (29,0,27,12);
    m_ms_parts[ MONO_I ] = pixmap->copy (29,12,27,12);
    m_ms_parts[ STEREO_A ] = pixmap->copy (0,0,27,12);
    m_ms_parts[ STEREO_I ] = pixmap->copy (0,12,27,12);

    delete pixmap;

    m_parts.clear();
    QPainter paint;
    pixmap = getPixmap("playpaus");

    if (!pixmap)
        pixmap = getDummyPixmap("playpaus");

    QPixmap part(11, 9);
    paint.begin(&part);
    paint.drawPixmap (0, 0, 3, 9, *pixmap, 36, 0, 3, 9);
    paint.drawPixmap (3, 0, 8, 9, *pixmap,  1, 0, 8, 9);
    paint.end();
    m_parts [PLAY] = part.copy();

    part = QPixmap(11, 9);
    paint.begin(&part);
    paint.drawPixmap (0, 0, 2, 9, *pixmap, 27, 0, 2, 9);
    paint.drawPixmap (2, 0, 9, 9, *pixmap,  9, 0, 9, 9);
    paint.end();
    m_parts [PAUSE] = part.copy();

    part = QPixmap(11, 9);
    paint.begin(&part);
    paint.drawPixmap (0, 0, 2, 9, *pixmap, 27, 0, 2, 9);
    paint.drawPixmap (2, 0, 9, 9, *pixmap, 18, 0, 9, 9);
    paint.end();
    m_parts [STOP]  = part.copy();

    delete pixmap;
}