summaryrefslogtreecommitdiffstats
path: root/src/k3bapplication.h
blob: e0a50e1207b12cab8c67d491fe9ceed38379bf56 (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
/* 
 *
 * $Id: k3bapplication.h 619556 2007-01-03 17:38:12Z trueg $
 * Copyright (C) 2003 Sebastian Trueg <[email protected]>
 *
 * This file is part of the K3b project.
 * Copyright (C) 1998-2007 Sebastian Trueg <[email protected]>
 *
 * 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_APPLICATION_H_
#define _K3B_APPLICATION_H_

#include <kuniqueapplication.h>
#include <k3bcore.h>

#include <tqmap.h>

#define k3bappcore K3bApplication::Core::k3bAppCore()


class K3bMainWindow;
class K3bInterface;
class K3bJobInterface;
class K3bAudioServer;
class K3bThemeManager;
class K3bProjectManager;
class K3bAppDeviceManager;
class K3bMediaCache;


class K3bApplication : public KUniqueApplication
{
  Q_OBJECT
  

 public:
  K3bApplication();
  ~K3bApplication();

  int newInstance();

  class Core;

 public slots:
  void init();

 signals:
  void initializationInfo( const TQString& );
  void initializationDone();

 private slots:
  void slotShutDown();

 private:
  bool processCmdLineArgs();

  Core* m_core;
  K3bAudioServer* m_audioServer;
  K3bMainWindow* m_mainWindow;

  bool m_needToInit;
};


/**
 * The application's core which extends K3bCore with some additional features
 * like the thememanager or an enhanced device manager.
 */
class K3bApplication::Core : public K3bCore
{
  Q_OBJECT
  

 public:
  Core( TQObject* parent );
  ~Core();

  void init();

  // make sure the libk3b uses the same configuration
  // needed since the lib still depends on K3bCore::config
  // the goal is to make the lib independent from the config
  TDEConfig* config() const;

  void readSettings( TDEConfig* c = 0 );
  void saveSettings( TDEConfig* c = 0 );

  /**
   * \reimplemented from K3bCore. We use our own devicemanager here.
   */
  K3bDevice::DeviceManager* deviceManager() const;

  K3bAppDeviceManager* appDeviceManager() const { return m_appDeviceManager; }

  K3bThemeManager* themeManager() const { return m_themeManager; }

  K3bProjectManager* projectManager() const { return m_projectManager; }

  K3bMediaCache* mediaCache() const { return m_mediaCache; }

  K3bMainWindow* k3bMainWindow() const { return m_mainWindow; }

  K3bInterface* interface() const { return m_interface; }

  K3bJobInterface* jobInterface() const { return m_jobInterface; }

  static Core* k3bAppCore() { return s_k3bAppCore; }

 signals:
  /**
   * This is used for showing info in the K3b splashscreen
   */
  void initializationInfo( const TQString& );

  /**
   * Any component may request busy info
   * In the K3b main app this will be displayed
   * as a moving square in the taskbar
   *
   * FIXME: this is bad design
   */
  void busyInfoRequested( const TQString& );

  /**
   * FIXME: this is bad design
   */
  void busyFinishRequested();

 private:
  void initDeviceManager();

  bool internalBlockDevice( K3bDevice::Device* );
  void internalUnblockDevice( K3bDevice::Device* );

  K3bInterface* m_interface;
  K3bJobInterface* m_jobInterface;

  K3bThemeManager* m_themeManager;
  K3bMainWindow* m_mainWindow;
  K3bProjectManager* m_projectManager;
  K3bAppDeviceManager* m_appDeviceManager;
  K3bMediaCache* m_mediaCache;

  TQMap<K3bDevice::Device*, int> m_deviceBlockMap;

  static Core* s_k3bAppCore;

  friend class K3bApplication;
};

#endif