summaryrefslogtreecommitdiffstats
path: root/src/k9main.h
blob: 0e9d6e5940ab9fce41fa801e47ea4edb629b4b82 (plain)
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
//
// C++ Interface:
//
// Description:
//
//
// Author: Jean-Michel PETIT <k9copy@free.fr>, (C) 2005
//
// Copyright: See COPYING file that comes with this distribution
//
//

#ifndef K9MAIN_H
#define K9MAIN_H
#include "k9common.h"
#include "k9cddrive.h"
#include "images.h"
#include "k9mainw.h"
#include "tdeconfigdlg.h"
#include "k9playbackoptions.h"
#include <tqstring.h>
#include <tdemessagebox.h>
#include <tqlistview.h>
#include <tdemainwindow.h>
#include <tdeaboutdata.h>
#include <tqevent.h>
#include <tdefiledialog.h>
#include <tqlistbox.h>
#include "k9copy.h"
#include <tqmutex.h>

enum  eStreamType {SUB,AUD,VID,NONE,CHAP} ;
enum  eObjectType {TITLE,CHAPTER,TITLESET,STREAM,ROOT};

class LvItem : public TQListViewItem {
public:
    LvItem( TQListViewItem *parent,eObjectType _objectType)
            : TQListViewItem( parent), obj( NULL ) {
        objectType=_objectType;
    }
    LvItem( TQListView *parent,eObjectType _objectType)
            : TQListViewItem( parent), obj( NULL ) {
        objectType=_objectType;
    }
    eObjectType objectType;
    TQObject *obj;
    virtual int rtti () const;
    int compare ( TQListViewItem * i, int col, bool ascending ) const;
    void paintCell ( TQPainter * p, const TQColorGroup & cg, int column, int width, int align );
};

class k9Main;
class k9DVD;
class  k9DVDAudioStream;
class  k9DVDSubtitle;
class k9DVDTitle;
class KLibFactory;
class k9PlaybackOptions;
class k9LangSelect;
class k9UpdateFactor;

class ckLvItem : public TQCheckListItem {
public:
    ckLvItem( TQListViewItem *parent,k9Main *dlg,eObjectType _objectType)
            : TQCheckListItem( parent,"",TQCheckListItem::CheckBox) {
        mainDlg=dlg;
        obj=NULL;
        stream=NULL;
        streamType=NONE;
        language="";
        objectType=_objectType;
    }
    ckLvItem( TQListView *parent,k9Main *dlg,eObjectType _objectType)
            : TQCheckListItem( parent,"",TQCheckListItem::CheckBox) {
        mainDlg=dlg;
        obj=NULL;
        stream=NULL;
        streamType=NONE;
        language="";
        objectType=_objectType;
    }
    eStreamType streamType;
    eObjectType objectType;

    k9Main *mainDlg;
    k9DVDTitle *mainTitle;
    TQObject *obj;
    TQObject *stream;
    TQString language;
    virtual int rtti () const;
    void paintCell ( TQPainter * p, const TQColorGroup & cg, int column, int width, int align );
    int compare ( TQListViewItem * i, int col, bool ascending ) const;
    double getstreamSize();

protected:
    void stateChange(bool state);

};


class k9DVDListItem : public TQObject {
    Q_OBJECT
  
public:
    k9DVDAudioStream *audioStream;
    k9DVDSubtitle *subtitle;
    k9DVDTitle *title;
    ckLvItem *listItem;
    eStreamType streamType;
public:
    k9DVDListItem(TQObject *DVD,ckLvItem *List,eStreamType type);
};


class k9Main : public MainDlg {
    Q_OBJECT
  

public:

    k9Main(TQWidget* parent = 0, const char* name = 0,  k9CdDrives *_drives=0 );
    ~k9Main();
    /*$PUBLIC_FUNCTIONS$*/
    void addTitle(k9DVDTitle *track);
    void addChapters(TQListViewItem *_parent,k9DVDTitle *_title);
    void updateSelection();
    void checkAll(bool state);
    void checkTS( bool _state,ckLvItem *_item );
    void checkTitle(bool state, ckLvItem *_item);
    void checkLang(TQString lang, eStreamType streamType,bool state);
    bool getupdating();
    void saveSettings();
    void setDVDSize();
    static int compare(double v1,double v2);
    void readSettings();
    bool getquickScan() {
        return m_quickScan;
    };
    void setPlaybackOptions(k9PlaybackOptions *_value) {
        m_playbackOptions=_value;
    };
    void setLangSelect(k9LangSelect *_value) {
        m_langSelect=_value;
    };
    TQObjectList *getItems() {
        return &items;
    };
    void updateFactor();
    bool withMenus();
    k9DVD *dvd;
    void eject();
private slots:
    virtual void          listView1CurrentChanged( TQListViewItem * );
    virtual void          bSaveClick();
    virtual void	  cbOutputDevActivated(int);
    virtual void	  bInputOpenClick();
    virtual void	  bInputOpenDirClick();
    virtual void	  foundMountPoint (const TQString &mountPoint, unsigned long kBSize, unsigned long kBUsed, unsigned long kBAvail);
    virtual void 	  fspDone();
    virtual void updateFactor_internal();
    virtual void	   deviceAdded(k9CdDrive *_drive);
    virtual void	   deviceRemoved(k9CdDrive *_drive);
    virtual void	   expanded(TQListViewItem*);
    virtual void	   collapsed (TQListViewItem*);
public slots:
    /*$PUBLIC_SLOTS$*/
    virtual void          PreviewTitle();
    virtual void          CreateMP4();
    virtual void	  extractMPEG2();
    virtual void          Copy();
    virtual void          Open();
    virtual void	   Clone(TQString _input,TQString _output);
    virtual void	   setInput(TQString _input);
    virtual void 	   setOutput(TQString _output);
    virtual void 	  volumeChanged(const TQString &device,const TQString &volumeName);

    void setDrives(k9CdDrives* _value);

protected:
    /*$PROTECTED_FUNCTIONS$*/
    TQObjectList items;
    k9DVDListItem *addListItem(TQObject *DVD,ckLvItem *List,eStreamType type);

    void readDrives();
    void addDrive (k9CdDrive *_drive);
    k9Copy *m_parent;
    TQPtrList<ckLvItem> tsItems;
    TQPtrList<ckLvItem> chItems;
    ckLvItem * root;
    TQPtrList <k9CdDrive> driveList;
    TQPtrList <k9CdDrive> recorderList;
    k9CdDrives *drives;
    TQPixmap pxVideo;
    TQPixmap pxSound;
    TQPixmap pxText;
    TQPixmap pxChapter;
    TQMutex m_mutex;
    bool updating;
    bool fspFinish;
    long fspAvail;
    void closeEvent( TQCloseEvent* ce );
    void closeDVD();
    KLibFactory *m_factory;
    TQString  getDevice(TQComboBox *_combo);
    k9UpdateFactor *m_update;
    //PREFERENCES
    TQString m_prefOutput;
    bool m_useDvdAuthor;
    bool m_quickScan;
    int  m_prefSize;
    bool m_prefK3b;
    bool m_prefMenu;
    bool m_prefAutoBurn;
    k9PlaybackOptions *m_playbackOptions;
    k9LangSelect *m_langSelect;

    KMdiToolViewAccessor *m_toolView;
    KDockWidget *m_dockWidget;
protected slots:
    /*$PROTECTED_SLOTS$*/
    void itemRenamed ( TQListViewItem *item, int col );
signals: // Signals
    /** No descriptions */
    void sig_progress(TQString str);
    void changeStatusbar(const TQString& str,int id);
    void changeCaption(const TQString& str);
    void showPreview(k9DVD *_dvd,k9DVDTitle * title,int chapter);
    void stopPreview();
    void SelectionChanged(k9DVD *_dvd,bool _withMenus);
    void changedTitle(k9DVDTitle *_title);
private:
    void fillLvLanguages();
    void updateLvLang(const eStreamType streamType,const TQString & lang) ;
    long getFreeSpace(const TQString & _path);
    void setProgressWindow(TQWidget *_widget);
    void removeProgressWindow();


};

#endif