summaryrefslogtreecommitdiffstats
path: root/src/k3bwriterselectionwidget.h
blob: ef94d8ae44521fb69df543a67cd64cf375d25d52 (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
/*
 *
 * $Id: k3bwriterselectionwidget.h 690635 2007-07-21 16:47:29Z trueg $
 * Copyright (C) 2003 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 K3BWRITERSELECTIONWIDGET_H
#define K3BWRITERSELECTIONWIDGET_H

#include <tqwidget.h>

class KComboBox;
class KConfigBase;
class TQLabel;
class K3bMediaSelectionComboBox;
namespace K3bDevice {
  class Device;
  class DeviceManager;
}


/**
  *@author Sebastian Trueg
  */
class K3bWriterSelectionWidget : public TQWidget
{
   Q_OBJECT
  TQ_OBJECT

 public: 
  /**
   * Creates a writerselectionwidget
   */
  K3bWriterSelectionWidget( TQWidget* parent = 0, const char* name = 0 );
  ~K3bWriterSelectionWidget();

  int writerSpeed() const;
  K3bDevice::Device* writerDevice() const;

  TQValueList<K3bDevice::Device*> allDevices() const;

  /**
   * returns K3b::WritingApp
   */
  int writingApp() const;

  int wantedMediumType() const;
  int wantedMediumState() const;

  void loadDefaults();
  void loadConfig( KConfigBase* );
  void saveConfig( KConfigBase* );

 public slots:
  void setWriterDevice( K3bDevice::Device* );
  void setSpeed( int );
  void setWritingApp( int );

  /**
   * K3b::WritingApp or'ed together
   *
   * Defaults to cdrecord and cdrdao for CD and growisofs for DVD
   */
  void setSupportedWritingApps( int );

  /**
   * A simple hack to disable the speed selection for DVD formatting
   */
  void setForceAutoSpeed( bool );

  /**
   * Set the wanted medium type. Defaults to writable CD.
   * 
   * \param type a bitwise combination of the K3bDevice::MediaType enum
   */
  void setWantedMediumType( int type );

  /**
   * Set the wanted medium state. Defaults to empty media.
   *
   * \param state a bitwise combination of the K3bDevice::State enum
   */
  void setWantedMediumState( int state );

  /**
   * This is a hack to allow the copy dialogs to use the same device for reading
   * and writing without having the user to choose the same medium.
   *
   * \param overrideString A string which will be shown in place of the medium string.
   *                       For example: "Burn to the same device". Set it to 0 in order
   *                       to disable the feature.
   */
  void setOverrideDevice( K3bDevice::Device* dev, const TQString& overrideString = TQString(), const TQString& tooltip = TQString() );

  /**
   * Compare K3bMediaSelectionComboBox::setIgnoreDevice
   */
  void setIgnoreDevice( K3bDevice::Device* dev );

 signals:
  void writerChanged();
  void writerChanged( K3bDevice::Device* );
  void writingAppChanged( int app );

  /**
   * \see K3bMediaSelectionComboBox
   */
  void newMedia();
  void newMedium( K3bDevice::Device* dev );

 private slots:
  void slotRefreshWriterSpeeds();
  void slotRefreshWritingApps();
  void slotWritingAppSelected( int id );
  void slotConfigChanged( KConfigBase* c );
  void slotSpeedChanged( int index );
  void slotWriterChanged();
  void slotNewBurnMedium( K3bDevice::Device* dev );
  void slotManualSpeed();

 private:
  void clearSpeedCombo();
  void insertSpeedItem( int );
  int selectedWritingApp() const;

  class MediaSelectionComboBox;

  KComboBox* m_comboSpeed;
  MediaSelectionComboBox* m_comboMedium;
  KComboBox* m_comboWritingApp;
  TQLabel* m_writingAppLabel;

  class Private;
  Private* d;
};

#endif