1 /*
2  * soundkonverterview.h
3  *
4  * Copyright (C) 2007 Daniel Faust <hessijames@gmail.com>
5  */
6 #ifndef _SOUNDKONVERTERVIEW_H_
7 #define _SOUNDKONVERTERVIEW_H_
8 
9 
10 #include <QWidget>
11 #include <KUrl>
12 
13 
14 class KPushButton;
15 class QMenu;
16 class KAction;
17 class KActionMenu;
18 class QToolButton;
19 
20 class ProgressIndicator;
21 class ComboButton;
22 class Config;
23 class Logger;
24 class CDManager;
25 class FileList;
26 class OptionsLayer;
27 
28 // class QPainter;
29 // class KUrl;
30 
31 /**
32  * This is the main view class for soundKonverter.  Most of the non-menu,
33  * non-toolbar, and non-statusbar (e.g., non frame) GUI code should go
34  * here.
35  *
36  * @short Main view
37  * @author Daniel Faust <hessijames@gmail.com>
38  * @version 1.0
39  */
40 
41 class soundKonverterView : public QWidget
42 {
43     Q_OBJECT
44 public:
45     /** Default constructor */
46     soundKonverterView( Logger *_logger, Config *_config, CDManager *_cdManager, QWidget *parent );
47 
48     /** Destructor */
49     ~soundKonverterView();
50 
51     void addConvertFiles( const KUrl::List& urls, QString _profile, QString _format, const QString& directory, const QString& notifyCommand = "" );
52     void loadAutosaveFileList();
53     void loadFileList(const QString& fileListPath);
54 
55     QAction *start() { return startAction; }
56     KActionMenu *stopMenu() { return stopActionMenu; }
57 
58     void startConversion();
59     void killConversion();
60 
61 signals:
62     /** Use this signal to change the content of the statusbar */
63 //     void signalChangeStatusbar(const QString& text);
64 
65     /** Use this signal to change the content of the caption */
66 //     void signalChangeCaption( const QString& text );
67 
68 public slots:
69     bool showCdDialog( const QString& device = "", QString _profile = "", QString _format = "", const QString& directory = "", const QString& notifyCommand = "" );
70     void loadFileList( bool user = true );
71     void saveFileList( bool user = true );
72     void updateFileList();
73 
74 private slots:
75     void addClicked( int index );
76     void showFileDialog();
77     void showDirDialog();
78     void showUrlDialog();
79     void showPlaylistDialog();
80 
81     // connected to fileList
82     /** The count of items in the file list has changed to @p count */
83     void fileCountChanged( int count );
84     /** The conversion has started */
85     void conversionStarted();
86     /** The conversion has stopped */
87     void conversionStopped( bool failed );
88     /** Conversion will continue/stop after current files have been converted */
89     void queueModeChanged( bool enabled );
90 
91 private:
92     Config *config;
93     Logger *logger;
94     CDManager *cdManager;
95 
96     FileList *fileList;
97     OptionsLayer *optionsLayer;
98 
99     /** The combobutton for adding files */
100     ComboButton *cAdd;
101 
102     /** The button to start the conversion */
103     KPushButton *pStart;
104     /** Tha start action */
105     QAction *startAction;
106 
107     /** The button to stop the conversion */
108     KPushButton *pStop;
109     /** The menu for the stop button */
110     KActionMenu *stopActionMenu;
111     KAction *killAction;
112     KAction *stopAction;
113     KAction *continueAction;
114 
115     /** Displays the current progress */
116     ProgressIndicator *progressIndicator;
117 
118     void cleanupParameters( QString *profile, QString *format );
119 
120 signals:
121     void progressChanged( const QString& progress );
122     void signalConversionStarted();
123     void signalConversionStopped( bool failed );
124     void showLog( const int logId );
125 };
126 
127 #endif // _soundKonverterVIEW_H_
128