summaryrefslogtreecommitdiffstats
path: root/src/k3b.h
blob: 4b5755946aff098eecc4d2a34081db6f0f07a096 (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
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
/*
 *
 * $Id: k3b.h 619556 2007-01-03 17:38:12Z trueg $
 * Copyright (C) 1998-2007 Sebastian Trueg <trueg@k3b.org>
 *
 * This file is part of the K3b project.
 * Copyright (C) 1998-2007 Sebastian Trueg <trueg@k3b.org>
 *
 * 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.
 * See the file "COPYING" for the exact licensing terms.
 */



#ifndef K3B_H
#define K3B_H


#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

// include files for TQt
#include <tqstrlist.h>
#include <tqworkspace.h>
#include <tqptrlist.h>

// include files for KDE
#include <kapplication.h>
#include <tdeparts/dockmainwindow.h>
#include <kdockwidget.h>
#include <tdeaction.h>
#include <kurl.h>

class TQVBox;


// forward declaration of the K3b classes
class K3bMainWindow;
class K3bDoc;
class K3bView;
class K3bDirView;
class K3bExternalBinManager;
class K3bOptionDialog;
class K3bJob;
class K3bProjectTabWidget;
class K3bSongManager;
class KSystemTray;
class K3bStatusBarManager;
class K3bProjectInterface;
class K3bThemedHeader;

namespace K3bDevice {
  class DeviceManager;
  class Device;
}


class K3bMainWindow : public KParts::DockMainWindow
{
  Q_OBJECT
  

 public:
  /** construtor of K3bMainWindow, calls all init functions to create the application.
   * @see initMenuBar initToolBar
   */
  K3bMainWindow();
  ~K3bMainWindow();

  /** opens a file specified by commandline option */
  K3bDoc* openDocument( const KURL& url = KURL() );

  K3bDevice::DeviceManager*      deviceManager() const;
  K3bExternalBinManager* externalBinManager() const;
  TDEConfig*               config() const            { return m_config; }
  // return main window with browser/cd/dvd view, used for DND
  K3bDirView*            mainWindow() const        { return m_dirView; }
  /**
   * @returns a pointer to the currently visible view or 0 if no project was created
   */
  K3bView* activeView() const;
  /**
   * @returns a pointer to the doc associated with the currently visible view or 0 if no project was created
   */
  K3bDoc* activeDoc() const;

  const TQPtrList<K3bDoc>& projects() const;

  bool eject();
  void showOptionDialog( int = 0 );

  /** Creates the main view of the KDockMainWindow instance and initializes the MDI view area including any needed
   *  connections.
   *  must be called after construction
   */
  void initView();

  KSystemTray* systemTray() const { return m_systemTray; }

 public slots:
  K3bDoc* slotNewAudioDoc();
  K3bDoc* slotNewDataDoc();
  K3bDoc* slotNewMixedDoc();
  K3bDoc* slotNewVcdDoc();
  K3bDoc* slotNewMovixDoc();
  K3bDoc* slotNewMovixDvdDoc();
  K3bDoc* slotNewDvdDoc();
  K3bDoc* slotNewVideoDvdDoc();
  K3bDoc* slotContinueMultisession();

  void slotClearProject();

  void blankCdrw( K3bDevice::Device* );
  void slotBlankCdrw();
  void formatDvd( K3bDevice::Device* );
  void slotFormatDvd();
  void slotWriteCdImage();
  void slotWriteCdImage( const KURL& url );
  void slotWriteDvdIsoImage();
  void slotWriteDvdIsoImage( const KURL& url );
  void cdCopy( K3bDevice::Device* );
  void slotCdCopy();
  void dvdCopy( K3bDevice::Device* );
  void slotDvdCopy();
  void cddaRip( K3bDevice::Device* );
  void slotCddaRip();
  void videoDvdRip( K3bDevice::Device* );
  void slotVideoDvdRip();
  void videoCdRip( K3bDevice::Device* );
  void slotVideoCdRip();
  void slotK3bSetup();

  void slotErrorMessage(const TQString&);
  void slotWarningMessage(const TQString&);

  void slotConfigureKeys();
  void slotShowTips();
  void slotCheckSystem();

  void addUrls( const KURL::List& urls );

 signals:
  void initializationInfo( const TQString& );
  void configChanged( TDEConfig* c );

 protected:
  /** queryClose is called by KTMainWindow on each closeEvent of a window. Against the
   * default implementation (only returns true), this overridden function retrieves all modified documents
   * from the open document list and asks the user to select which files to save before exiting the application.
   * @see KTMainWindow#queryClose
   * @see KTMainWindow#closeEvent
   */
  virtual bool queryClose();

  /** queryExit is called by KTMainWindow when the last window of the application is going to be closed during the closeEvent().
   * Against the default implementation that just returns true, this calls saveOptions() to save the settings of the last window's
   * properties.
   * @see KTMainWindow#queryExit
   * @see KTMainWindow#closeEvent
   */
  virtual bool queryExit();

  /** saves the window properties for each open window during session end to the session config file, including saving the currently
   * opened file by a temporary filename provided by TDEApplication.
   * @see KTMainWindow#saveProperties
   */
  virtual void saveProperties(TDEConfig *_cfg);

  /** reads the session config file and restores the application's state including the last opened files and documents by reading the
   * temporary files saved by saveProperties()
   * @see KTMainWindow#readProperties
   */
  virtual void readProperties(TDEConfig *_cfg);

  /**
   * checks if doc is modified and asks the user for saving if so.
   * returns false if the user chose cancel.
   */
  bool canCloseDocument( K3bDoc* );

  virtual void showEvent( TQShowEvent* e );

 private slots:
  /** open a file and load it into the document*/
  void slotFileOpen();
  /** opens a file from the recent files menu */
  void slotFileOpenRecent(const KURL& url);
  /** save a document */
  void slotFileSave();
  /** save a document by a new filename*/
  void slotFileSaveAs();
  void slotFileSaveAll();
  /** asks for saving if the file is modified, then closes the actual file and window*/
  void slotFileClose();
  void slotFileCloseAll();

  void slotDirTreeDockHidden();
  void slotContentsDockHidden();

  void slotSettingsConfigure();

  /** checks if the currently visible tab is a k3bview
      or not and dis- or enables some actions */
  void slotCurrentDocChanged();

  void slotFileQuit();

  /** toggles the statusbar
   */
  void slotViewStatusBar();

  void slotViewDocumentHeader();

  void slotCheckDockWidgetStatus();

  /** changes the statusbar contents for the standard label permanently, used to indicate current actions.
   * @param text the text that is displayed in the statusbar
   */
  void slotStatusMsg(const TQString &text);

  void slotShowDirTreeView();
  void slotShowContentsView();
  void slotShowMenuBar();

  void slotProjectAddFiles();

  void slotEditToolbars();
  void slotNewToolBarConfig();

  void slotDataImportSession();
  void slotDataClearImportedSession();
  void slotEditBootImages();

  void slotAudioServerError( const TQString& error );

  void createClient(K3bDoc* doc);

  /**
   * Run slotCheckSystem with a timer
   */
  void slotCheckSystemTimed();

 private:
  void fileSave( K3bDoc* doc = 0 );
  void fileSaveAs( K3bDoc* doc = 0 );
  void closeProject( K3bDoc* );

  /** save general Options like all bar positions and status as well as the geometry and the recent file list to the configuration
   * file
   */
  void saveOptions();
  /** read general Options again and initialize all variables like the recent file list */
  void readOptions();

  /** initializes the TDEActions of the application */
  void initActions();

  /** sets up the statusbar for the main window by initialzing a statuslabel.
   */
  void initStatusBar();

  bool isCdDvdImageAndIfSoOpenDialog( const KURL& url );

  /** the configuration object of the application */
  TDEConfig *m_config;

  /** The MDI-Interface is managed by this tabbed view */
  K3bProjectTabWidget* m_documentTab;

  // TDEAction pointers to enable/disable actions
  TDEActionMenu* actionFileNewMenu;
  TDEAction* actionFileNewAudio;
  TDEAction* actionFileNewData;
  TDEAction* actionFileNewMixed;
  TDEAction* actionFileNewVcd;
  TDEAction* actionFileNewMovix;
  TDEAction* actionFileNewMovixDvd;
  TDEAction* actionFileNewDvd;
  TDEAction* actionFileNewVideoDvd;
  TDEAction* actionFileContinueMultisession;
  TDEAction* actionFileOpen;
  TDERecentFilesAction* actionFileOpenRecent;
  TDEAction* actionFileSave;
  TDEAction* actionFileSaveAs;
  TDEAction* actionFileSaveAll;
  TDEAction* actionFileClose;
  TDEAction* actionFileCloseAll;
  TDEAction* actionFileQuit;
  TDEAction* actionSettingsConfigure;
  TDEAction* actionSettingsK3bSetup;
  TDEAction* actionToolsBlankCdrw;
  TDEAction* actionToolsWriteCdImage;
  TDEAction* actionToolsCddaRip;
  TDEAction* actionToolsVideoDvdRip;
  TDEAction* actionToolsVideoCdRip;
  TDEAction* actionCdCopy;
  TDEAction* actionProjectAddFiles;
  TDEToggleAction* actionViewStatusBar;
  TDEToggleAction* actionViewDirTreeView;
  TDEToggleAction* actionViewContentsView;
  TDEToggleAction* actionViewDocumentHeader;

  // project actions
  TQPtrList<TDEAction> m_dataProjectActions;

  KDockWidget* mainDock;
  KDockWidget* m_contentsDock;
  KDockWidget* m_dirTreeDock;

  // The K3b-specific widgets
  K3bDirView* m_dirView;
  K3bOptionDialog* m_optionDialog;

  K3bStatusBarManager* m_statusBarManager;

  KSystemTray* m_systemTray;

  bool m_initialized;

  // the funny header
  K3bThemedHeader* m_documentHeader;

  class Private;
  Private* d;
};

#endif // K3B_H