File indexing completed on 2024-10-06 04:26:04
0001 /* 0002 SPDX-FileCopyrightText: 1998-2008 Sebastian Trueg <trueg@k3b.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 0008 #ifndef _K3B_WRITING_MODE_WIDGET_H_ 0009 #define _K3B_WRITING_MODE_WIDGET_H_ 0010 0011 #include "k3bintmapcombobox.h" 0012 #include "k3bmedium.h" 0013 #include "k3bglobals.h" 0014 0015 #include <KConfigGroup> 0016 0017 0018 /** 0019 * Allows selection of K3b::WritingMode 0020 */ 0021 namespace K3b { 0022 class WritingModeWidget : public IntMapComboBox 0023 { 0024 Q_OBJECT 0025 0026 public: 0027 explicit WritingModeWidget( QWidget* parent = 0 ); 0028 explicit WritingModeWidget( WritingModes modes, QWidget* parent = 0 ); 0029 ~WritingModeWidget() override; 0030 0031 WritingMode writingMode() const; 0032 0033 /** 0034 * \return All supported writing modes. The list 0035 * is optionally filtered according to the device 0036 * set via setDevice. 0037 */ 0038 WritingModes supportedWritingModes() const; 0039 0040 void saveConfig( KConfigGroup ); 0041 0042 /** 0043 * This will not emit the writingModeChanged signal 0044 */ 0045 void loadConfig( const KConfigGroup& ); 0046 0047 public Q_SLOTS: 0048 /** 0049 * This will not emit the writingModeChanged signal 0050 */ 0051 void setWritingMode( WritingMode m ); 0052 void setSupportedModes( WritingModes modes ); 0053 0054 /** 0055 * If the device is set the supported writing modes 0056 * will be filtered by the ones supported by the drive. 0057 */ 0058 void setDevice( K3b::Device::Device* ); 0059 0060 /** 0061 * Set the writing modes which make sense with the provided medium. 0062 * This will also reset the device from the medium. 0063 * 0064 * \param m The medium. May even be non-writable or no medium at all 0065 * in which case only the auto mode will be selected. 0066 * 0067 * \sa setDevice 0068 */ 0069 void determineSupportedModesFromMedium( const Medium& m ); 0070 0071 /** 0072 * Convenience method. Does the same as the one above. 0073 * 0074 * \param dev The device which contains the medium. May even be 0 in 0075 * which case only the auto mode will be selected. 0076 */ 0077 void determineSupportedModesFromMedium( K3b::Device::Device* dev ); 0078 0079 Q_SIGNALS: 0080 void writingModeChanged( WritingMode mode ); 0081 0082 private: 0083 void init(); 0084 void updateModes(); 0085 0086 class Private; 0087 Private* d; 0088 0089 Q_PRIVATE_SLOT( d, void _k_writingModeChanged(int) ) 0090 }; 0091 } 0092 0093 #endif