1 
2 #ifndef FILELISTITEM_H
3 #define FILELISTITEM_H
4 
5 #include "metadata/tagengine.h"
6 
7 #include <QTreeWidgetItem>
8 #include <QItemDelegate>
9 #include <QLabel>
10 #include <QWeakPointer>
11 
12 #include <KUrl>
13 
14 
15 /**
16 	@author Daniel Faust <hessijames@gmail.com>
17 */
18 class FileListItem : public QTreeWidgetItem
19 {
20 public:
21     enum State {
22         WaitingForConversion,
23         Ripping,
24         Converting,
25         ApplyingReplayGain,
26         WaitingForAlbumGain,
27         ApplyingAlbumGain,
28         Stopped
29     };
30 
31     // code values will be displayed in the log files
32     enum ReturnCode {
33         Succeeded                       = 0,
34         SucceededWithProblems           = 1,
35         StoppedByUser                   = 2,
36         Skipped                         = 3,
37         Encrypted                       = 7,
38         BackendNeedsConfiguration       = 4,
39         DiscFull                        = 5,
40         CantWriteOutput                 = 8,
41         Failed                          = 6
42     };
43 
44     explicit FileListItem( QTreeWidget *parent );
45     FileListItem( QTreeWidget *parent, QTreeWidgetItem *after );
46     ~FileListItem();
47 
48     int conversionOptionsId;
49     TagData *tags;              // we need to instruct the tagengine to read the tags from the file!
50                                 // and the user can change them!
51     KUrl url;                   // the original input file path name
52     // KUrl outputUrl;             // if the user wants to change the output directory/file name per file
53     QString codecName;          // the codec name of the input file
54     State state;                // is this item being converted or ripper or etc.
55     ReturnCode returnCode;      // what's the return code of the conversion
56     bool local;                 // is this a local file?
57     int track;                  // the number of the track, if it is on an audio cd
58                                 // if it is lower than 0, it isn't an audio cd track at all
59     int tracks;                 // the total amount of tracks on the cd
60     QString device;             // the device of the audio cd
61 
62     float length;               // the length of the track, used for the calculation of the progress bar
63     QString notifyCommand;      // execute this command, when the file is converted (%i=input file, %o=output file)
64 
65     int logId;                  // the id the item is registered at the logger with, 0 if the conversion hasn't started yet
66 
67     QWeakPointer<QLabel> lInfo; // a pointer to button to show additional information (e.g. error log). if no butotn shall be shown the pointer must be 0
68 };
69 
70 class FileListItemDelegate : public QItemDelegate
71 {
72 public:
73     explicit FileListItemDelegate( QObject *parent );
74 
75     virtual void paint( QPainter *painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const;
76 };
77 
78 #endif
79