summaryrefslogtreecommitdiffstats
path: root/src/k3bappdevicemanager.h
blob: 2fe79252c61d125926fd87ed91d6009ee204b36d (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
/* 
 *
 * $Id: sourceheader 380067 2005-01-19 13:03:46Z trueg $
 * Copyright (C) 2005 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_APP_DEVICE_MANAGER_H_
#define _K3B_APP_DEVICE_MANAGER_H_

class KActionCollection;
class KAction;
class K3bMediaCache;

namespace K3bDevice {
  class Device;
  class DiskInfo;
  class DiskInfoDetector;
}

namespace KIO {
  class Job;
}

#include <k3bdevicemanager.h>


/**
 * Enhanced device manager which can do some additional actions
 * and maintains a current device
 */
class K3bAppDeviceManager : public K3bDevice::DeviceManager
{
  Q_OBJECT
  TQ_OBJECT

 public:
  K3bAppDeviceManager( TQObject* tqparent = 0, const char* name = 0 );
  ~K3bAppDeviceManager();

  K3bDevice::Device* currentDevice() const;
  KActionCollection* actionCollection() const { return m_actionCollection; }
  void setMediaCache( K3bMediaCache* c );

 signals:
  void currentDeviceChanged( K3bDevice::Device* );

  /**
   * Emitted when starting to detect the diskinfo. This may be used to show some info
   * to the user since deteting the diskinfo might take some time.
   */
  void detectingDiskInfo( K3bDevice::Device* );
  void diskInfoReady( K3bDevice::DiskInfoDetector* );

  void mountFinished( const TQString& mountPoint );
  void unmountFinished( bool success );

 public slots:
  /**
   * \reimplemeted for internal reasons. The API is unaffected.
   */
  void clear();

  /**
   * \reimplemeted for internal reasons. The API is unaffected.
   */
  void removeDevice( const TQString& );

  /**
   * \reimplemeted for internal reasons. The API is unaffected.
   */
  int scanBus();

  void setCurrentDevice( K3bDevice::Device* );

  void diskInfo();
  void unlockDevice();
  void lockDevice();
  void mountDisk();
  void unmountDisk();
  void ejectDisk();
  void loadDisk();
  void setReadSpeed();

  void diskInfo( K3bDevice::Device* );
  void unlockDevice( K3bDevice::Device* );
  void lockDevice( K3bDevice::Device* );
  void mountDisk( K3bDevice::Device* );
  void unmountDisk( K3bDevice::Device* );
  void ejectDisk( K3bDevice::Device* );
  void loadDisk( K3bDevice::Device* );
  void setReadSpeed( K3bDevice::Device* );

 private slots:
  void slotMediumChanged( K3bDevice::Device* dev );

 private:
  KAction* m_actionDiskInfo;
  KAction* m_actionUnmount;
  KAction* m_actionMount;
  KAction* m_actionEject;
  KAction* m_actionLoad;
  KAction* m_actionSetReadSpeed;

  mutable K3bDevice::Device* m_currentDevice;
  KActionCollection* m_actionCollection;
  K3bDevice::DiskInfoDetector* m_diskInfoDetector;

  bool m_ejectRequested;
};

#endif