File indexing completed on 2024-10-06 04:26:04
0001 /* 0002 SPDX-FileCopyrightText: 1998-2009 Sebastian Trueg <trueg@k3b.org> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #ifndef K3BWRITERSELECTIONWIDGET_H 0007 #define K3BWRITERSELECTIONWIDGET_H 0008 0009 #include "k3bglobals.h" 0010 0011 #include <KSharedConfig> 0012 0013 #include <QWidget> 0014 #include <QLabel> 0015 0016 class QLabel; 0017 0018 namespace K3b { 0019 0020 class IntMapComboBox; 0021 class MediaSelectionComboBox; 0022 class Msf; 0023 0024 namespace Device { 0025 class Device; 0026 } 0027 0028 class WriterSelectionWidget : public QWidget 0029 { 0030 Q_OBJECT 0031 0032 public: 0033 /** 0034 * Creates a writerselectionwidget 0035 */ 0036 explicit WriterSelectionWidget( QWidget* parent = 0 ); 0037 ~WriterSelectionWidget() override; 0038 0039 int writerSpeed() const; 0040 Device::Device* writerDevice() const; 0041 0042 QList<Device::Device*> allDevices() const; 0043 0044 /** 0045 * returns K3b::WritingApp 0046 */ 0047 K3b::WritingApp writingApp() const; 0048 0049 Device::MediaTypes wantedMediumType() const; 0050 Device::MediaStates wantedMediumState() const; 0051 K3b::Msf wantedMediumSize() const; 0052 0053 void loadConfig( const KConfigGroup& ); 0054 void saveConfig( KConfigGroup ); 0055 0056 public Q_SLOTS: 0057 void setWriterDevice( K3b::Device::Device* ); 0058 void setSpeed( int ); 0059 void setWritingApp( K3b::WritingApp app ); 0060 0061 /** 0062 * K3b::WritingApp or'ed together 0063 * 0064 * Defaults to cdrecord and cdrdao for CD and growisofs for DVD 0065 */ 0066 void setSupportedWritingApps( K3b::WritingApps apps ); 0067 0068 /** 0069 * A simple hack to disable the speed selection for DVD formatting 0070 */ 0071 void setForceAutoSpeed( bool ); 0072 0073 /** 0074 * Set the wanted medium type. Defaults to writable CD. 0075 * 0076 * \param type a bitwise combination of the Device::MediaType enum 0077 */ 0078 void setWantedMediumType( K3b::Device::MediaTypes type ); 0079 0080 /** 0081 * Set the wanted medium state. Defaults to empty media. 0082 * 0083 * \param state a bitwise combination of the Device::State enum 0084 */ 0085 void setWantedMediumState( K3b::Device::MediaStates state ); 0086 0087 /** 0088 * Set the wanted medium size. Defaults to 0 which means 0089 * that the size should be irgnored. 0090 */ 0091 void setWantedMediumSize( const K3b::Msf& minSize ); 0092 0093 /** 0094 * This is a hack to allow the copy dialogs to use the same device for reading 0095 * and writing without having the user to choose the same medium. 0096 * 0097 * \param overrideString A string which will be shown in place of the medium string. 0098 * For example: "Burn to the same device". Set it to 0 in order 0099 * to disable the feature. 0100 */ 0101 void setOverrideDevice( K3b::Device::Device* dev, const QString& overrideString = QString(), const QString& tooltip = QString() ); 0102 0103 /** 0104 * Compare MediaSelectionComboBox::setIgnoreDevice 0105 */ 0106 void setIgnoreDevice( K3b::Device::Device* dev ); 0107 0108 Q_SIGNALS: 0109 void writerChanged(); 0110 void writerChanged( K3b::Device::Device* ); 0111 void writingAppChanged( K3b::WritingApp app ); 0112 0113 /** 0114 * \see MediaSelectionComboBox 0115 */ 0116 void newMedia(); 0117 void newMedium( K3b::Device::Device* dev ); 0118 0119 private Q_SLOTS: 0120 void slotRefreshWriterSpeeds(); 0121 void slotRefreshWritingApps(); 0122 void slotWritingAppSelected( int id ); 0123 void slotConfigChanged( KSharedConfig::Ptr c ); 0124 void slotSpeedChanged( int index ); 0125 void slotWriterChanged(); 0126 void slotNewBurnMedium( K3b::Device::Device* dev ); 0127 void slotManualSpeed(); 0128 0129 private: 0130 void clearSpeedCombo(); 0131 void insertSpeedItem( int ); 0132 K3b::WritingApp selectedWritingApp() const; 0133 0134 class MediaSelectionComboBox; 0135 0136 IntMapComboBox* m_comboSpeed; 0137 MediaSelectionComboBox* m_comboMedium; 0138 IntMapComboBox* m_comboWritingApp; 0139 QLabel* m_writingAppLabel; 0140 0141 class Private; 0142 Private* d; 0143 }; 0144 } 0145 0146 #endif