diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-03 02:15:56 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-03 02:15:56 +0000 |
commit | 50b48aec6ddd451a6d1709c0942477b503457663 (patch) | |
tree | a9ece53ec06fd0a2819de7a2a6de997193566626 /src/option | |
download | k3b-50b48aec6ddd451a6d1709c0942477b503457663.tar.gz k3b-50b48aec6ddd451a6d1709c0942477b503457663.zip |
Added abandoned KDE3 version of K3B
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/k3b@1084400 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/option')
27 files changed, 4125 insertions, 0 deletions
diff --git a/src/option/Makefile.am b/src/option/Makefile.am new file mode 100644 index 0000000..7b99dd3 --- /dev/null +++ b/src/option/Makefile.am @@ -0,0 +1,20 @@ +AM_CPPFLAGS = -I$(srcdir)/../../libk3b/core \ + -I$(srcdir)/../../libk3bdevice \ + -I$(srcdir)/../../libk3b/plugin \ + -I$(srcdir)/../../libk3b/tools \ + -I$(srcdir)/.. \ + $(all_includes) + +METASOURCES = AUTO + +noinst_LTLIBRARIES = liboption.la + +liboption_la_SOURCES = base_k3bcddboptiontab.ui base_k3bmiscoptiontab.ui \ + base_k3bpluginoptiontab.ui \ + base_k3bthemeoptiontab.ui k3bmiscoptiontab.cpp \ + k3bexternalbinoptiontab.cpp k3bcddboptiontab.cpp \ + k3bburningoptiontab.cpp k3boptiondialog.cpp \ + k3bdeviceoptiontab.cpp k3bnotifyoptiontab.cpp \ + k3bpluginoptiontab.cpp \ + k3bthemeoptiontab.cpp k3bdevicewidget.cpp \ + k3bexternalbinwidget.cpp diff --git a/src/option/base_k3bcddboptiontab.ui b/src/option/base_k3bcddboptiontab.ui new file mode 100644 index 0000000..f46e970 --- /dev/null +++ b/src/option/base_k3bcddboptiontab.ui @@ -0,0 +1,560 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>base_K3bCddbOptionTab</class> +<author>Sebastian Trueg</author> +<widget class="QWidget"> + <property name="name"> + <cstring>base_K3bCddbOptionTab</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>648</width> + <height>553</height> + </rect> + </property> + <property name="caption"> + <string>CDDB Options</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QTabWidget"> + <property name="name"> + <cstring>m_mainTabbed</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Local</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>m_checkUseLocalCddb</cstring> + </property> + <property name="text"> + <string>Use local CDDB directory</string> + </property> + </widget> + <widget class="QCheckBox" row="1" column="0"> + <property name="name"> + <cstring>m_checkSaveLocalEntries</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Save entries in local directory (the first directory in the list)</string> + </property> + </widget> + <widget class="QFrame" row="2" column="0"> + <property name="name"> + <cstring>m_boxLocalDirectory</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>Raised</enum> + </property> + <property name="lineWidth"> + <number>0</number> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>TextLabel1_4</cstring> + </property> + <property name="text"> + <string>Directory:</string> + </property> + </widget> + <widget class="KListView" row="1" column="0" rowspan="4" colspan="2"> + <column> + <property name="text"> + <string>Directory</string> + </property> + <property name="clickable"> + <bool>false</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>m_viewLocalDir</cstring> + </property> + <property name="fullWidth"> + <bool>true</bool> + </property> + </widget> + <widget class="QToolButton" row="3" column="2"> + <property name="name"> + <cstring>m_buttonLocalDirDown</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="autoRaise"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Move directory down</string> + </property> + </widget> + <widget class="QToolButton" row="0" column="2"> + <property name="name"> + <cstring>m_buttonAddLocalDir</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="autoRaise"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Add directory</string> + </property> + </widget> + <widget class="KLineEdit" row="0" column="1"> + <property name="name"> + <cstring>m_editLocalDir</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QToolButton" row="1" column="2"> + <property name="name"> + <cstring>m_buttonRemoveLocalDir</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="autoRaise"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Remove directory</string> + </property> + </widget> + <widget class="QToolButton" row="2" column="2"> + <property name="name"> + <cstring>m_buttonLocalDirUp</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="autoRaise"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Move directory up</string> + </property> + </widget> + <spacer row="4" column="2"> + <property name="name"> + <cstring>Spacer11_2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>51</height> + </size> + </property> + </spacer> + </grid> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Remote</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QFrame" row="1" column="0"> + <property name="name"> + <cstring>m_boxCddbServer</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>Raised</enum> + </property> + <property name="lineWidth"> + <number>0</number> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="text"> + <string>Server:</string> + </property> + </widget> + <widget class="QComboBox" row="0" column="1"> + <property name="name"> + <cstring>m_comboCddbType</cstring> + </property> + </widget> + <widget class="KListView" row="1" column="0" rowspan="4" colspan="4"> + <column> + <property name="text"> + <string>Type</string> + </property> + <property name="clickable"> + <bool>false</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Server</string> + </property> + <property name="clickable"> + <bool>false</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Port</string> + </property> + <property name="clickable"> + <bool>false</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>m_viewCddbServer</cstring> + </property> + <property name="allColumnsShowFocus"> + <bool>true</bool> + </property> + <property name="fullWidth"> + <bool>true</bool> + </property> + </widget> + <widget class="KLineEdit" row="0" column="2"> + <property name="name"> + <cstring>m_editCddbServer</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="KIntNumInput" row="0" column="3"> + <property name="name"> + <cstring>m_editCddbPort</cstring> + </property> + <property name="label"> + <string></string> + </property> + <property name="value"> + <number>80</number> + </property> + <property name="minValue"> + <number>0</number> + </property> + <property name="maxValue"> + <number>64000</number> + </property> + <property name="prefix"> + <string>Port </string> + </property> + </widget> + <widget class="QToolButton" row="0" column="4"> + <property name="name"> + <cstring>m_buttonAddCddbServer</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="autoRaise"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Add server</string> + </property> + </widget> + <widget class="QToolButton" row="1" column="4"> + <property name="name"> + <cstring>m_buttonRemoveCddbServer</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="autoRaise"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Remove server</string> + </property> + </widget> + <widget class="QToolButton" row="2" column="4"> + <property name="name"> + <cstring>m_buttonCddbServerUp</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="autoRaise"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Move server up</string> + </property> + </widget> + <widget class="QToolButton" row="3" column="4"> + <property name="name"> + <cstring>m_buttonCddbServerDown</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="autoRaise"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Move server down</string> + </property> + </widget> + <spacer row="4" column="4"> + <property name="name"> + <cstring>Spacer10</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>30</height> + </size> + </property> + </spacer> + </grid> + </widget> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>m_checkRemoteCddb</cstring> + </property> + <property name="text"> + <string>Enable remote CDDB queries</string> + </property> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Advanced</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>m_groupCgi</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>CGI Path</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="KLineEdit" row="2" column="1"> + <property name="name"> + <cstring>m_editManualCgiPath</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>~/cddb/cddb.cgi</string> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>TextLabel3</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Path:</string> + </property> + </widget> + <widget class="QCheckBox" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>m_checkManualCgiPath</cstring> + </property> + <property name="text"> + <string>Manual CGI path</string> + </property> + </widget> + </grid> + </widget> + <spacer> + <property name="name"> + <cstring>spacer5</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>31</width> + <height>151</height> + </size> + </property> + </spacer> + </vbox> + </widget> + </widget> + </vbox> +</widget> +<customwidgets> +</customwidgets> +<connections> + <connection> + <sender>m_checkManualCgiPath</sender> + <signal>toggled(bool)</signal> + <receiver>m_editManualCgiPath</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>m_checkManualCgiPath</sender> + <signal>toggled(bool)</signal> + <receiver>TextLabel3</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>m_checkUseLocalCddb</sender> + <signal>toggled(bool)</signal> + <receiver>m_boxLocalDirectory</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>m_checkUseLocalCddb</sender> + <signal>toggled(bool)</signal> + <receiver>m_checkSaveLocalEntries</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>m_checkRemoteCddb</sender> + <signal>toggled(bool)</signal> + <receiver>m_boxCddbServer</receiver> + <slot>setEnabled(bool)</slot> + </connection> +</connections> +<tabstops> + <tabstop>m_mainTabbed</tabstop> + <tabstop>m_checkUseLocalCddb</tabstop> + <tabstop>m_checkSaveLocalEntries</tabstop> + <tabstop>m_editLocalDir</tabstop> + <tabstop>m_viewLocalDir</tabstop> + <tabstop>m_checkRemoteCddb</tabstop> + <tabstop>m_comboCddbType</tabstop> + <tabstop>m_editCddbServer</tabstop> + <tabstop>m_editCddbPort</tabstop> + <tabstop>m_viewCddbServer</tabstop> + <tabstop>m_checkManualCgiPath</tabstop> + <tabstop>m_editManualCgiPath</tabstop> +</tabstops> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>klistview.h</includehint> + <includehint>klistview.h</includehint> + <includehint>knuminput.h</includehint> +</includehints> +</UI> diff --git a/src/option/base_k3bmiscoptiontab.ui b/src/option/base_k3bmiscoptiontab.ui new file mode 100644 index 0000000..364e91f --- /dev/null +++ b/src/option/base_k3bmiscoptiontab.ui @@ -0,0 +1,284 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>base_K3bMiscOptionTab</class> +<widget class="QWidget"> + <property name="name"> + <cstring>base_K3bMiscOptionTab</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox1</cstring> + </property> + <property name="title"> + <string>Misc</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>m_checkSaveOnExit</cstring> + </property> + <property name="text"> + <string>&Ask to save projects on exit</string> + </property> + <property name="toolTip" stdset="0"> + <string>Ask to save modified projects on exit</string> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="text"> + <string>Default Temporary Directory:</string> + </property> + </widget> + <widget class="KURLRequester"> + <property name="name"> + <cstring>m_editTempDir</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>The directory where K3b stores temporary files</string> + </property> + <property name="whatsThis" stdset="0"> + <string><p>This is the default temporary directory. This is where K3b will store temporary files like iso images or decoded audio files. +<p>Be aware that the temporary directory may also be changed in every project burn dialog.</string> + </property> + </widget> + </hbox> + </widget> + </vbox> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox3</cstring> + </property> + <property name="title"> + <string>System</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>m_checkSystemConfig</cstring> + </property> + <property name="text"> + <string>&Check system configuration</string> + </property> + <property name="toolTip" stdset="0"> + <string>Check system Configuration</string> + </property> + <property name="whatsThis" stdset="0"> + <string><p>If this option is checked K3b will check the system configuration for any problems on startup and when the the user changes the settings.</string> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>Used audio output system:</string> + </property> + </widget> + <widget class="KComboBox"> + <property name="name"> + <cstring>m_comboAudioOutputSystem</cstring> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>m_buttonConfigureAudioOutput</cstring> + </property> + <property name="text"> + <string>Confi&gure...</string> + </property> + </widget> + </hbox> + </widget> + </vbox> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox2</cstring> + </property> + <property name="title"> + <string>GUI Settings</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>m_checkShowProgressOSD</cstring> + </property> + <property name="text"> + <string>Show progress &OSD</string> + </property> + <property name="whatsThis" stdset="0"> + <string><p>If this option is checked K3b will display the progress in an OSD which always stays on top of all other windows.</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>m_checkHideMainWindowWhileWriting</cstring> + </property> + <property name="text"> + <string>Hide &main window while writing</string> + </property> + <property name="toolTip" stdset="0"> + <string>Hide the main window while displaying the progress window</string> + </property> + <property name="whatsThis" stdset="0"> + <string><p>If this option is checked K3b will hide the main window while displaying the progress dialog.</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>m_checkShowSplash</cstring> + </property> + <property name="text"> + <string>Show splash screen</string> + </property> + <property name="toolTip" stdset="0"> + <string>Show the splash screen when K3b starts</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>m_checkKonqiIntegration</cstring> + </property> + <property name="text"> + <string>E&nable Konqueror integration</string> + </property> + <property name="toolTip" stdset="0"> + <string>Enable integration of K3b actions into Konqueror menus</string> + </property> + <property name="whatsThis" stdset="0"> + <string><p>K3b can integrate itself into Konqueror. This integration allows to start K3b from the context menu in the file manager. +<p>A typical example is: in order to burn a folder to a data CD one clicks on the folder using the right mouse button. In the appearing context menu one selects "Create Data CD with K3b..." and a new K3b project containing the folder is created. +<p><em>Konqueror integration is not enabled by default to prevent unwanted cluttering of the Konqueror menus.</em></string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>m_checkKeepDialogsOpen</cstring> + </property> + <property name="text"> + <string>&Keep action dialogs open</string> + </property> + <property name="toolTip" stdset="0"> + <string>Do not close action dialogs after finishing the process</string> + </property> + <property name="whatsThis" stdset="0"> + <string><p>If this option is checked K3b will not close action dialogs such as the CD Copy dialog after the process has been finished. It will be kept open to start a new process like copying another CD.</string> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout4</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_3</cstring> + </property> + <property name="text"> + <string>&Default action dialog settings:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>m_comboActionDialogSettings</cstring> + </property> + </widget> + <widget class="K3bIntMapComboBox"> + <property name="name"> + <cstring>m_comboActionDialogSettings</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Settings to load when opening an action dialog</string> + </property> + </widget> + </hbox> + </widget> + </vbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>31</width> + <height>0</height> + </size> + </property> + </spacer> + </vbox> +</widget> +<customwidgets> + <customwidget> + <class>K3bIntMapComboBox</class> + <header location="global">k3bintmapcombobox.h</header> + <sizehint> + <width>-1</width> + <height>-1</height> + </sizehint> + <container>0</container> + <sizepolicy> + <hordata>5</hordata> + <verdata>5</verdata> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + <pixmap>image0</pixmap> + </customwidget> +</customwidgets> +<images> + <image name="image0"> + <data format="PNG" length="1125">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000042c49444154388db5954f6c14551cc73fefcd7476b65bdaae4bb78bb5502a14d404e4801c88182d1c4c2c693da847400f9c24c68b878684238660e2b1e01f12c19493012ef2478c814412d354a46017a8a564bb6da5bbedccee767776e63d0ffb073751d483bfe49799974c3eeffb7ebf37df9fd05a530b2184040cc0042420aaf9a4d0d554800f045a6b256ae0e1e1e1d6bebebe838ee31c48a7d39b5cd7fd075e251cc7617272f2ded8d8d819cff33e0316819259537aead4a9839d5dd6d1784f91f55b0a94830242088404d304292bef68a89f520802a598fecddaa04f1a876f5c250c7c0a64cdeac686e33807e23d45e6b297c8b877f1831542614550b6599835c83c2a81b6786a75134faf2f1169f12997350881d9021d0903e06de0745d3160a6d3e94dbd5b0a64dcbb94b5831d0e3375ab892b1772dcf9790528543f8dd0d367b36768153b5e31503a0f1aecb004580b44ffac58baae8b1714f0833c7638cc8dab303a320f4822ab4c7a37c69196203de3319d5ce1c4d13c733331dedc67a129a154fd128401ab0616d55a130ac3d42d93d1913940d13fd0c9ee0183685c60da01c5421bd72f7a8c8efccef9afd374267ad93d642365be0636a0d28ec7600941d9e6f23917f0e97f23ce5bef35d19ec863da0ed9059b2be70bec196c66dfa10ec0e49b338f7017258651bf95021035c595429bb0903248fe52a2b5b595dd7b4d945cc2340cdca536be389ee3f67886c5798f773fe8e0dac508c989659277a2180da4ca4ff07821058b8b251445d63d6b13ed1098a6417e39cac85197dbe31962ab9bd9f1f22a226d45366f6d0620fdb08c900d281af6110284b20085b414861d905d88f2e52739ee8cbb8022143259d3dd84691730aa2d52da441a8de0c6958068870022a41e9629ad3473fd3b8fdbe319dadb9b4924da994d2d716c7896fbe35152f78b48245d6b2da4507faf582be8eaf159b721cc837b05ae7debb1f79d08cb8b515edad942a22bc4b1c33eb3d34b1c797f06af90a72d16e2f96d9a74aa11dca8586b222d01af0fb60070f6c402d72f15d97f28c6f6d7027a5f5ce6c3233dc4e2ede496b278be4fff608cee8d3e1add806aeca51094cbb06397c1ecc328e746537c7e3ccdb5cb1136bf60635882d4d41c6ec6836ab37efa214f72208ed9f4d7cdd38ee310280542e38b1c43fb6de26b3672e1ec3cc99bcb246f66a938a3241ab3e91f7c861fbf77710b1e5e49915bae974203ba0e9e9c9cbc373d6d6d305a040a89c2a77f50b27d5782bbbf7acccf28349235dd16cf6dd374f7295e1de8a45c02d37499182b01cc0201a085d61a2144d8b2ac8fb6ed340e77240c4261890e04c250185262546d534a032154b59e0ad394e41c98182bf268ce6721ed9f064e0253356f6da2e24c1f030f783c15fe6da680af8021602bd051532ca9b8521488559f61aa86c29343578fbf0264a94c906c7d3409214c20043457a116ff6de6795578012889ff6b98fe016ea0ce1c6a2573410000000049454e44ae426082</data> + </image> +</images> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kurlrequester.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kcombobox.h</includehint> + <includehint>k3bintmapcombobox.h</includehint> +</includehints> +</UI> diff --git a/src/option/base_k3bpluginoptiontab.ui b/src/option/base_k3bpluginoptiontab.ui new file mode 100644 index 0000000..18321ee --- /dev/null +++ b/src/option/base_k3bpluginoptiontab.ui @@ -0,0 +1,90 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>base_K3bPluginOptionTab</class> +<author>Sebastian Trueg</author> +<widget class="QWidget"> + <property name="name"> + <cstring>Form1</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>600</width> + <height>480</height> + </rect> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QPushButton" row="2" column="1"> + <property name="name"> + <cstring>m_buttonConfigure</cstring> + </property> + <property name="text"> + <string>Configure...</string> + </property> + </widget> + <spacer row="2" column="0"> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>411</width> + <height>21</height> + </size> + </property> + </spacer> + <widget class="K3bListView" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>m_viewPlugins</cstring> + </property> + </widget> + <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string><p>Here all <em>K3b Plugins</em> may be configured. Be aware that this does not include the <em>KPart Plugins</em> which embed themselves in the K3b menu structure.</p></string> + </property> + </widget> + </grid> +</widget> +<customwidgets> + <customwidget> + <class>K3bListView</class> + <header location="global">k3blistview.h</header> + <sizehint> + <width>-1</width> + <height>-1</height> + </sizehint> + <container>0</container> + <sizepolicy> + <hordata>5</hordata> + <verdata>5</verdata> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + <pixmap>image0</pixmap> + </customwidget> +</customwidgets> +<images> + <image name="image0"> + <data format="PNG" length="1125">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000042c49444154388db5954f6c14551cc73fefcd7476b65bdaae4bb78bb5502a14d404e4801c88182d1c4c2c693da847400f9c24c68b878684238660e2b1e01f12c19493012ef2478c814412d354a46017a8a564bb6da5bbedccee767776e63d0ffb073751d483bfe49799974c3eeffb7ebf37df9fd05a530b2184040cc0042420aaf9a4d0d554800f045a6b256ae0e1e1e1d6bebebe838ee31c48a7d39b5cd7fd075e251cc7617272f2ded8d8d819cff33e0316819259537aead4a9839d5dd6d1784f91f55b0a94830242088404d304292bef68a89f520802a598fecddaa04f1a876f5c250c7c0a64cdeac686e33807e23d45e6b297c8b877f1831542614550b6599835c83c2a81b6786a75134faf2f1169f12997350881d9021d0903e06de0745d3160a6d3e94dbd5b0a64dcbb94b5831d0e3375ab892b1772dcf9790528543f8dd0d367b36768153b5e31503a0f1aecb004580b44ffac58baae8b1714f0833c7638cc8dab303a320f4822ab4c7a37c69196203de3319d5ce1c4d13c733331dedc67a129a154fd128401ab0616d55a130ac3d42d93d1913940d13fd0c9ee0183685c60da01c5421bd72f7a8c8efccef9afd374267ad93d642365be0636a0d28ec7600941d9e6f23917f0e97f23ce5bef35d19ec863da0ed9059b2be70bec196c66dfa10ec0e49b338f7017258651bf95021035c595429bb0903248fe52a2b5b595dd7b4d945cc2340cdca536be389ee3f67886c5798f773fe8e0dac508c989659277a2180da4ca4ff07821058b8b251445d63d6b13ed1098a6417e39cac85197dbe31962ab9bd9f1f22a226d45366f6d0620fdb08c900d281af6110284b20085b414861d905d88f2e52739ee8cbb8022143259d3dd84691730aa2d52da441a8de0c6958068870022a41e9629ad3473fd3b8fdbe319dadb9b4924da994d2d716c7896fbe35152f78b48245d6b2da4507faf582be8eaf159b721cc837b05ae7debb1f79d08cb8b515edad942a22bc4b1c33eb3d34b1c797f06af90a72d16e2f96d9a74aa11dca8586b222d01af0fb60070f6c402d72f15d97f28c6f6d7027a5f5ce6c3233dc4e2ede496b278be4fff608cee8d3e1add806aeca51094cbb06397c1ecc328e746537c7e3ccdb5cb1136bf60635882d4d41c6ec6836ab37efa214f72208ed9f4d7cdd38ee310280542e38b1c43fb6de26b3672e1ec3cc99bcb246f66a938a3241ab3e91f7c861fbf77710b1e5e49915bae974203ba0e9e9c9cbc373d6d6d305a040a89c2a77f50b27d5782bbbf7acccf28349235dd16cf6dd374f7295e1de8a45c02d37499182b01cc0201a085d61a2144d8b2ac8fb6ed340e77240c4261890e04c250185262546d534a032154b59e0ad394e41c98182bf268ce6721ed9f064e0253356f6da2e24c1f030f783c15fe6da680af8021602bd051532ca9b8521488559f61aa86c29343578fbf0264a94c906c7d3409214c20043457a116ff6de6795578012889ff6b98fe016ea0ce1c6a2573410000000049454e44ae426082</data> + </image> +</images> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>k3blistview.h</includehint> +</includehints> +</UI> diff --git a/src/option/base_k3bthemeoptiontab.ui b/src/option/base_k3bthemeoptiontab.ui new file mode 100644 index 0000000..47a48b4 --- /dev/null +++ b/src/option/base_k3bthemeoptiontab.ui @@ -0,0 +1,208 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>base_K3bThemeOptionTab</class> +<author>Sebastian Trueg</author> +<widget class="QWidget"> + <property name="name"> + <cstring>base_K3bThemeOptionTab</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>661</width> + <height>499</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox4</cstring> + </property> + <property name="title"> + <string>Theme Selection</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KListView"> + <column> + <property name="text"> + <string>Theme</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Author</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Version</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Comment</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>m_viewTheme</cstring> + </property> + <property name="allColumnsShowFocus"> + <bool>true</bool> + </property> + </widget> + </vbox> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox5</cstring> + </property> + <property name="title"> + <string>Preview</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="spacing"> + <number>0</number> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>m_leftPreviewLabel</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>m_centerPreviewLabel</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>1</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <bold>1</bold> + </font> + </property> + <property name="text"> + <string>no Theme selected</string> + </property> + <property name="alignment"> + <set>AlignCenter</set> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>m_rightPreviewLabel</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </hbox> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout5</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <spacer> + <property name="name"> + <cstring>spacer3</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>161</width> + <height>2</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>m_buttonInstallTheme</cstring> + </property> + <property name="text"> + <string>Install New Theme...</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>m_buttonRemoveTheme</cstring> + </property> + <property name="text"> + <string>Remove Theme</string> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<customwidgets> +</customwidgets> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>klistview.h</includehint> +</includehints> +</UI> diff --git a/src/option/k3bburningoptiontab.cpp b/src/option/k3bburningoptiontab.cpp new file mode 100644 index 0000000..21485cb --- /dev/null +++ b/src/option/k3bburningoptiontab.cpp @@ -0,0 +1,198 @@ +/* + * + * $Id: k3bburningoptiontab.cpp 619556 2007-01-03 17:38:12Z 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. + */ + +#include "k3bburningoptiontab.h" +#include <k3bmsfedit.h> +#include <k3bcore.h> +#include <k3bstdguiitems.h> +#include <k3bglobalsettings.h> + +#include <qlabel.h> +#include <qcombobox.h> +#include <qcheckbox.h> +#include <qlayout.h> +#include <qgroupbox.h> +#include <qtabwidget.h> +#include <qradiobutton.h> +#include <qvalidator.h> +#include <qbuttongroup.h> +#include <qspinbox.h> +#include <qtooltip.h> +#include <qwhatsthis.h> + +#include <knuminput.h> +#include <kconfig.h> +#include <kdialog.h> +#include <klocale.h> +#include <klineedit.h> + + +K3bBurningOptionTab::K3bBurningOptionTab( QWidget* parent, const char* name ) + : QWidget( parent, name ) +{ + setupGui(); +} + + +K3bBurningOptionTab::~K3bBurningOptionTab() +{ +} + + +void K3bBurningOptionTab::setupGui() +{ + QGridLayout* groupAdvancedLayout = new QGridLayout( this ); + groupAdvancedLayout->setAlignment( Qt::AlignTop ); + groupAdvancedLayout->setSpacing( KDialog::spacingHint() ); + groupAdvancedLayout->setMargin( 0 ); + + + QGroupBox* groupWritingApp = new QGroupBox( 0, Qt::Vertical, i18n("Burning"), this ); + groupWritingApp->layout()->setMargin( 0 ); + QGridLayout* bufferLayout = new QGridLayout( groupWritingApp->layout() ); + bufferLayout->setMargin( KDialog::marginHint() ); + bufferLayout->setSpacing( KDialog::spacingHint() ); + + m_checkBurnfree = K3bStdGuiItems::burnproofCheckbox( groupWritingApp ); + m_checkOverburn = new QCheckBox( i18n("Allow overburning (¬ supported by cdrecord <= 1.10)"), groupWritingApp ); + m_checkForceUnsafeOperations = new QCheckBox( i18n("Force unsafe operations"), groupWritingApp ); + m_checkManualWritingBufferSize = new QCheckBox( i18n("&Manual writing buffer size") + ":", groupWritingApp ); + m_editWritingBufferSize = new KIntNumInput( 4, groupWritingApp ); + m_editWritingBufferSize->setSuffix( " " + i18n("MB") ); + m_checkAllowWritingAppSelection = new QCheckBox( i18n("Manual writing application &selection"), groupWritingApp ); + bufferLayout->addMultiCellWidget( m_checkBurnfree, 0, 0, 0, 2 ); + bufferLayout->addMultiCellWidget( m_checkOverburn, 1, 1, 0, 2 ); + bufferLayout->addMultiCellWidget( m_checkForceUnsafeOperations, 2, 2, 0, 2 ); + bufferLayout->addWidget( m_checkManualWritingBufferSize, 3, 0 ); + bufferLayout->addWidget( m_editWritingBufferSize, 3, 1 ); + bufferLayout->addMultiCellWidget( m_checkAllowWritingAppSelection, 4, 4, 0, 2 ); + bufferLayout->setColStretch( 2, 1 ); + + QGroupBox* groupMisc = new QGroupBox( 2, Qt::Vertical, i18n("Miscellaneous"), this ); + m_checkEject = new QCheckBox( i18n("Do not &eject medium after write process"), groupMisc ); + m_checkAutoErasingRewritable = new QCheckBox( i18n("Automatically erase CD-RWs and DVD-RWs"), groupMisc ); + + groupAdvancedLayout->addWidget( groupWritingApp, 0, 0 ); + groupAdvancedLayout->addWidget( groupMisc, 1, 0 ); + groupAdvancedLayout->setRowStretch( 2, 1 ); + + + connect( m_checkManualWritingBufferSize, SIGNAL(toggled(bool)), + m_editWritingBufferSize, SLOT(setEnabled(bool)) ); + connect( m_checkManualWritingBufferSize, SIGNAL(toggled(bool)), + this, SLOT(slotSetDefaultBufferSizes(bool)) ); + + + m_editWritingBufferSize->setDisabled( true ); + // ----------------------------------------------------------------------- + + + QToolTip::add( m_checkOverburn, i18n("Allow burning more than the official media capacity") ); + QToolTip::add( m_checkAllowWritingAppSelection, i18n("Allow to choose between cdrecord and cdrdao") ); + QToolTip::add( m_checkAutoErasingRewritable, i18n("Automatically erase CD-RWs and DVD-RWs without asking") ); + QToolTip::add( m_checkEject, i18n("Do not eject the burn medium after a completed burn process") ); + QToolTip::add( m_checkForceUnsafeOperations, i18n("Force K3b to continue some operations otherwise deemed as unsafe") ); + + QWhatsThis::add( m_checkAllowWritingAppSelection, i18n("<p>If this option is checked K3b gives " + "the possibility to choose between cdrecord " + "and cdrdao when writing a cd." + "<p>This may be useful if one of the programs " + "does not support the used writer." + "<p><b>Be aware that K3b does not support both " + "programs in all project types.</b>") ); + + QWhatsThis::add( m_checkOverburn, i18n("<p>Each medium has an official maximum capacity which is stored in a read-only " + "area of the medium and is guaranteed by the vendor. However, this official " + "maximum is not always the actual maximum. Many media have an " + "actual total capacity that is slightly larger than the official amount." + "<p>If this option is checked K3b will disable a safety check that prevents " + "burning beyond the offical capacity." + "<p><b>Caution:</b> Enabling this option can cause failures in the end of the " + "burning process if K3b attempts to write beyond the official capacity. It " + "makes sense to first determine the actual maximum capacity of the media brand " + "with a simulated burn.") ); + + QWhatsThis::add( m_checkAutoErasingRewritable, i18n("<p>If this option is checked K3b will automatically " + "erase CD-RWs and format DVD-RWs if one is found instead " + "of an empty media before writing.") ); + + QWhatsThis::add( m_checkManualWritingBufferSize, i18n("<p>K3b uses a software buffer during the burning process to " + "avoid gaps in the data stream due to high system load. The default " + "sizes used are %1 MB for CD and %2 MB for DVD burning." + "<p>If this option is checked the value specified will be used for both " + "CD and DVD burning.").arg(4).arg(32) ); + + QWhatsThis::add( m_checkEject, i18n("<p>If this option is checked K3b will not eject the medium once the burn process " + "finishes. This can be helpful in case one leaves the computer after starting the " + "burning and does not want the tray to be open all the time." + "<p>However, on Linux systems a freshly burned medium has to be reloaded. Otherwise " + "the system will not detect the changes and still treat it as an empty medium.") ); + + QWhatsThis::add( m_checkForceUnsafeOperations, i18n("<p>If this option is checked K3b will continue in some situations " + "which would otherwise be deemed as unsafe." + "<p>This setting for example disables the check for medium speed " + "verification. Thus, one can force K3b to burn a high speed medium on " + "a low speed writer." + "<p><b>Caution:</b> Enabling this option may result in damaged media.") ); +} + + +void K3bBurningOptionTab::readSettings() +{ + KConfig* c = k3bcore->config(); + + c->setGroup( "General Options" ); + m_checkAutoErasingRewritable->setChecked( c->readBoolEntry( "auto rewritable erasing", false ) ); + m_checkAllowWritingAppSelection->setChecked( c->readBoolEntry( "Manual writing app selection", false ) ); + + m_checkBurnfree->setChecked( k3bcore->globalSettings()->burnfree() ); + m_checkEject->setChecked( !k3bcore->globalSettings()->ejectMedia() ); + m_checkOverburn->setChecked( k3bcore->globalSettings()->overburn() ); + m_checkForceUnsafeOperations->setChecked( k3bcore->globalSettings()->force() ); + m_checkManualWritingBufferSize->setChecked( k3bcore->globalSettings()->useManualBufferSize() ); + if( k3bcore->globalSettings()->useManualBufferSize() ) + m_editWritingBufferSize->setValue( k3bcore->globalSettings()->bufferSize() ); +} + + +void K3bBurningOptionTab::saveSettings() +{ + KConfig* c = k3bcore->config(); + + c->setGroup( "General Options" ); + c->writeEntry( "auto rewritable erasing", m_checkAutoErasingRewritable->isChecked() ); + c->writeEntry( "Manual writing app selection", m_checkAllowWritingAppSelection->isChecked() ); + + k3bcore->globalSettings()->setEjectMedia( !m_checkEject->isChecked() ); + k3bcore->globalSettings()->setOverburn( m_checkOverburn->isChecked() ); + k3bcore->globalSettings()->setBurnfree( m_checkBurnfree->isChecked() ); + k3bcore->globalSettings()->setUseManualBufferSize( m_checkManualWritingBufferSize->isChecked() ); + k3bcore->globalSettings()->setBufferSize( m_editWritingBufferSize->value() ); + k3bcore->globalSettings()->setForce( m_checkForceUnsafeOperations->isChecked() ); + + // FIXME: remove this once libk3b does not use KConfig anymore for these values + k3bcore->globalSettings()->saveSettings( c ); +} + + +void K3bBurningOptionTab::slotSetDefaultBufferSizes( bool b ) +{ + if( !b ) { + m_editWritingBufferSize->setValue( 4 ); + } +} + + +#include "k3bburningoptiontab.moc" diff --git a/src/option/k3bburningoptiontab.h b/src/option/k3bburningoptiontab.h new file mode 100644 index 0000000..8b71e06 --- /dev/null +++ b/src/option/k3bburningoptiontab.h @@ -0,0 +1,61 @@ +/* + * + * $Id: k3bburningoptiontab.h 619556 2007-01-03 17:38:12Z 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 K3B_BURNING_OPTION_TAB_H +#define K3B_BURNING_OPTION_TAB_H + +#include <qwidget.h> + +class QCheckBox; +class QLabel; +class QGroupBox; +class QComboBox; +class QString; +class QSpinBox; +class KIntNumInput; +class QRadioButton; + + + +class K3bBurningOptionTab : public QWidget +{ +Q_OBJECT + + public: + K3bBurningOptionTab( QWidget* parent = 0, const char* name = 0 ); + ~K3bBurningOptionTab(); + + void saveSettings(); + void readSettings(); + + private slots: + void slotSetDefaultBufferSizes( bool ); + + private: + void setupGui(); + + QCheckBox* m_checkBurnfree; + QCheckBox* m_checkEject; + QCheckBox* m_checkAutoErasingRewritable; + QCheckBox* m_checkOverburn; + QCheckBox* m_checkManualWritingBufferSize; + KIntNumInput* m_editWritingBufferSize; + QCheckBox* m_checkAllowWritingAppSelection; + QCheckBox* m_checkForceUnsafeOperations; +}; + + +#endif diff --git a/src/option/k3bcddboptiontab.cpp b/src/option/k3bcddboptiontab.cpp new file mode 100644 index 0000000..33b2349 --- /dev/null +++ b/src/option/k3bcddboptiontab.cpp @@ -0,0 +1,338 @@ +/* + * + * $Id$ + * 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. + */ + +#include "k3bcddboptiontab.h" + +#include <qvariant.h> +#include <qbuttongroup.h> +#include <qcheckbox.h> +#include <qlistbox.h> +#include <qpushbutton.h> +#include <qradiobutton.h> +#include <qtabwidget.h> +#include <qlayout.h> +#include <qtooltip.h> +#include <qwhatsthis.h> +#include <qstringlist.h> +#include <qcombobox.h> +#include <qtoolbutton.h> + +#include <kdialog.h> +#include <kiconloader.h> +#include <krun.h> +#include <klistview.h> +#include <klineedit.h> +#include <klocale.h> +#include <knuminput.h> +#include <kconfig.h> +#include <kapplication.h> +#include <kdeversion.h> + + +K3bCddbOptionTab::K3bCddbOptionTab( QWidget* parent, const char* name ) + : base_K3bCddbOptionTab( parent, name ) +{ + // fix all the margins and spacings that have been corrupted by QDesigner ;-) + // ----------------------------------------------------------------------------- + + base_K3bCddbOptionTabLayout->setMargin( 0 ); + base_K3bCddbOptionTabLayout->setSpacing( KDialog::spacingHint() ); + + m_mainTabbed->page(0)->layout()->setMargin( KDialog::marginHint() ); + m_mainTabbed->page(0)->layout()->setSpacing( KDialog::spacingHint() ); + m_mainTabbed->page(1)->layout()->setMargin( KDialog::marginHint() ); + m_mainTabbed->page(1)->layout()->setSpacing( KDialog::spacingHint() ); + +// m_groupLocalDir->layout()->setMargin( 0 ); +// m_groupLocalDirLayout->setMargin( KDialog::marginHint() ); +// m_groupLocalDirLayout->setSpacing( KDialog::spacingHint() ); + +// m_groupCddbServer->layout()->setMargin( 0 ); +// m_groupCddbServerLayout->setMargin( KDialog::marginHint() ); +// m_groupCddbServerLayout->setSpacing( KDialog::spacingHint() ); + + m_groupCgi->layout()->setMargin( 0 ); + m_groupCgiLayout->setMargin( KDialog::marginHint() ); + m_groupCgiLayout->setSpacing( KDialog::spacingHint() ); + + m_boxLocalDirectoryLayout->setSpacing( KDialog::spacingHint() ); + m_boxCddbServerLayout->setSpacing( KDialog::spacingHint() ); + // ----------------------------------------------------------------------------- + + + m_viewLocalDir->setSorting(-1); + m_viewLocalDir->setAcceptDrops( true ); + m_viewLocalDir->setDragEnabled( true ); + m_viewLocalDir->setDropVisualizer( true ); + + m_viewCddbServer->setSorting(-1); + m_viewCddbServer->setAcceptDrops( true ); + m_viewCddbServer->setDragEnabled( true ); + m_viewCddbServer->setDropVisualizer( true ); + + m_comboCddbType->insertItem( "Http" ); + m_comboCddbType->insertItem( "Cddbp" ); + + + // set icons for the buttons + m_buttonAddLocalDir->setPixmap( SmallIcon("ok") ); + m_buttonRemoveLocalDir->setPixmap( SmallIcon("stop") ); + m_buttonLocalDirUp->setPixmap( SmallIcon("up") ); + m_buttonLocalDirDown->setPixmap( SmallIcon("down") ); + m_buttonAddCddbServer->setPixmap( SmallIcon("ok") ); + m_buttonRemoveCddbServer->setPixmap( SmallIcon("stop") ); + m_buttonCddbServerUp->setPixmap( SmallIcon("up") ); + m_buttonCddbServerDown->setPixmap( SmallIcon("down") ); + + + // setup connections + // ----------------------------------------------------------------------------- + connect( m_buttonAddLocalDir, SIGNAL(clicked()), this, SLOT(slotLocalDirAdd()) ); + connect( m_buttonRemoveLocalDir, SIGNAL(clicked()), this, SLOT(slotLocalDirRemove()) ); + connect( m_buttonLocalDirUp, SIGNAL(clicked()), this, SLOT(slotLocalDirUp()) ); + connect( m_buttonLocalDirDown, SIGNAL(clicked()), this, SLOT(slotLocalDirDown()) ); + + connect( m_buttonAddCddbServer, SIGNAL(clicked()), this, SLOT(slotCddbServerAdd()) ); + connect( m_buttonRemoveCddbServer, SIGNAL(clicked()), this, SLOT(slotCddbServerRemove()) ); + connect( m_buttonCddbServerUp, SIGNAL(clicked()), this, SLOT(slotCddbServerUp()) ); + connect( m_buttonCddbServerDown, SIGNAL(clicked()), this, SLOT(slotCddbServerDown()) ); + + connect( m_editLocalDir, SIGNAL(textChanged(const QString&)), this, SLOT(enDisableButtons()) ); + connect( m_editCddbServer, SIGNAL(textChanged(const QString&)), this, SLOT(enDisableButtons()) ); + connect( m_viewLocalDir, SIGNAL(selectionChanged()), this, SLOT(enDisableButtons()) ); + connect( m_viewCddbServer, SIGNAL(selectionChanged()), this, SLOT(enDisableButtons()) ); + connect( m_comboCddbType, SIGNAL(highlighted(int)), + this, SLOT(slotServerTypeChanged()) ); + connect( m_comboCddbType, SIGNAL(activated(int)), + this, SLOT(slotServerTypeChanged()) ); + // ----------------------------------------------------------------------------- + + enDisableButtons(); +} + + +K3bCddbOptionTab::~K3bCddbOptionTab() +{ +} + + +void K3bCddbOptionTab::readSettings() +{ + KConfig* c = kapp->config(); + + c->setGroup( "Cddb" ); + + // old config <= 0.7.3 + QStringList cddbpServer = c->readListEntry( "cddbp server" ); + QStringList httpServer = c->readListEntry( "http server" ); + + // new config + QStringList cddbServer = c->readListEntry( "cddb server" ); + + QStringList localCddbDirs = c->readPathListEntry( "local cddb dirs" ); + + m_checkRemoteCddb->setChecked( c->readBoolEntry( "use remote cddb", true ) ); + m_checkUseLocalCddb->setChecked( c->readBoolEntry( "use local cddb query", true ) ); + m_checkSaveLocalEntries->setChecked( c->readBoolEntry( "save cddb entries locally", true ) ); + m_checkManualCgiPath->setChecked( c->readBoolEntry( "use manual cgi path", false ) ); + m_editManualCgiPath->setText( c->readEntry( "cgi path", "/~cddb/cddb.cgi" ) ); + + if( localCddbDirs.isEmpty() ) + localCddbDirs.append( "~/.cddb/" ); + + for( QStringList::const_iterator it = localCddbDirs.begin(); it != localCddbDirs.end(); ++it ) + (void)new KListViewItem( m_viewLocalDir, m_viewLocalDir->lastItem(), *it ); + + + // old config <= 0.7.3 + if( !httpServer.isEmpty() ) { + for( QStringList::iterator it = httpServer.begin(); it != httpServer.end(); ++it ) { + cddbServer.append( "Http " + *it ); + } + } + if( !cddbpServer.isEmpty() ) { + for( QStringList::iterator it = cddbpServer.begin(); it != cddbpServer.end(); ++it ) { + cddbServer.append( "Cddbp " + *it ); + } + } + + if( cddbServer.isEmpty() ) + cddbServer.append( "Http freedb2.org:80" ); + + for( QStringList::const_iterator it = cddbServer.begin(); it != cddbServer.end(); ++it ) { + const QString& s = *it; + QStringList buf = QStringList::split( ":", s.mid( s.find(" ")+1 ) ); + QString server = buf[0]; + int port = buf[1].toInt(); + if( s.startsWith("Http") ) + (void)new KListViewItem( m_viewCddbServer, m_viewCddbServer->lastItem(), "Http", server, QString::number(port) ); + else + (void)new KListViewItem( m_viewCddbServer, m_viewCddbServer->lastItem(), "Cddbp", server, QString::number(port) ); + } + + enDisableButtons(); +} + + +void K3bCddbOptionTab::apply() +{ + KConfig* c = kapp->config(); + + c->setGroup( "Cddb" ); + + c->writeEntry( "use remote cddb", m_checkRemoteCddb->isChecked() ); + c->writeEntry( "use local cddb query", m_checkUseLocalCddb->isChecked() ); + c->writeEntry( "save cddb entries locally", m_checkSaveLocalEntries->isChecked() ); + c->writeEntry( "use manual cgi path", m_checkManualCgiPath->isChecked() ); + c->writeEntry( "cgi path", m_editManualCgiPath->text() ); + + QStringList cddbServer; + QStringList localCddbDirs; + + QListViewItemIterator it( m_viewLocalDir ); + while( it.current() ) { + localCddbDirs.append( it.current()->text(0) ); + ++it; + } + + QListViewItemIterator it1( m_viewCddbServer ); + while( it1.current() ) { + cddbServer.append( it1.current()->text(0) + " " + it1.current()->text(1) + ":" + it1.current()->text(2) ); + ++it1; + } + + // new config + c->writeEntry( "cddb server", cddbServer ); + + // old config <= 0.7.3 + if( c->hasKey( "http server" ) ) + c->deleteEntry( "http server" ); + if( c->hasKey( "cddbp server" ) ) + c->deleteEntry( "cddbp server" ); + + c->writePathEntry( "local cddb dirs", localCddbDirs ); +} + + +void K3bCddbOptionTab::slotLocalDirAdd() +{ + if( !m_editLocalDir->text().isEmpty() ) { + QString localDir( m_editLocalDir->text() ); + QListViewItemIterator it( m_viewLocalDir ); + while( it.current() ) { + if ( it.current()->text(0) == localDir ) + return; + ++it; + } + (void)new KListViewItem( m_viewLocalDir, m_viewLocalDir->lastItem(), + localDir ); + + enDisableButtons(); + } +} + + +void K3bCddbOptionTab::slotLocalDirRemove() +{ + if( QListViewItem* item = m_viewLocalDir->selectedItem() ) + delete item; + + enDisableButtons(); +} + + +void K3bCddbOptionTab::slotCddbServerAdd() +{ + if( !m_editCddbServer->text().isEmpty() ) { + (void)new KListViewItem( m_viewCddbServer, m_viewCddbServer->lastItem(), + m_comboCddbType->currentText(), + m_editCddbServer->text(), + QString::number( m_editCddbPort->value() ) ); + + enDisableButtons(); + } +} + + +void K3bCddbOptionTab::slotCddbServerRemove() +{ + if( QListViewItem* item = m_viewCddbServer->selectedItem() ) + delete item; + + enDisableButtons(); +} + + +void K3bCddbOptionTab::enDisableButtons() +{ + m_buttonAddLocalDir->setDisabled( m_editLocalDir->text().isEmpty() ); + m_buttonRemoveLocalDir->setDisabled( m_viewLocalDir->selectedItem() == 0 ); + m_buttonLocalDirUp->setDisabled( m_viewLocalDir->selectedItem() == 0 || + m_viewLocalDir->selectedItem() == m_viewLocalDir->firstChild() ); + m_buttonLocalDirDown->setDisabled( m_viewLocalDir->selectedItem() == 0 || + m_viewLocalDir->selectedItem() == m_viewLocalDir->lastItem() ); + + m_buttonAddCddbServer->setDisabled( m_editCddbServer->text().isEmpty() ); + m_buttonRemoveCddbServer->setDisabled( m_viewCddbServer->selectedItem() == 0 ); + m_buttonCddbServerUp->setDisabled( m_viewCddbServer->selectedItem() == 0 || + m_viewCddbServer->selectedItem() == m_viewCddbServer->firstChild() ); + m_buttonCddbServerDown->setDisabled( m_viewCddbServer->selectedItem() == 0 || + m_viewCddbServer->selectedItem() == m_viewCddbServer->lastItem() ); + + if( m_viewLocalDir->childCount() <= 0 ) { + m_checkSaveLocalEntries->setChecked(false); + } + m_checkSaveLocalEntries->setDisabled( m_viewLocalDir->childCount() <= 0 ); +} + + +void K3bCddbOptionTab::slotServerTypeChanged() +{ + m_editCddbPort->setValue( m_comboCddbType->currentText() == "Http" ? 80 : 8880 ); +} + + +void K3bCddbOptionTab::slotLocalDirDown() +{ + QListViewItem* sel = m_viewLocalDir->selectedItem(); + m_viewLocalDir->moveItem( sel, 0, sel->nextSibling() ); + m_viewLocalDir->setSelected( sel, true ); +} + + +void K3bCddbOptionTab::slotLocalDirUp() +{ + QListViewItem* sel = m_viewLocalDir->selectedItem(); + m_viewLocalDir->moveItem( sel, 0, sel->itemAbove()->itemAbove() ); + m_viewLocalDir->setSelected( sel, true ); +} + + +void K3bCddbOptionTab::slotCddbServerDown() +{ + QListViewItem* sel = m_viewCddbServer->selectedItem(); + m_viewCddbServer->moveItem( sel, 0, sel->nextSibling() ); + m_viewCddbServer->setSelected( sel, true ); +} + + +void K3bCddbOptionTab::slotCddbServerUp() +{ + QListViewItem* sel = m_viewCddbServer->selectedItem(); + m_viewCddbServer->moveItem( sel, 0, sel->itemAbove()->itemAbove() ); + m_viewCddbServer->setSelected( sel, true ); +} + +#include "k3bcddboptiontab.moc" diff --git a/src/option/k3bcddboptiontab.h b/src/option/k3bcddboptiontab.h new file mode 100644 index 0000000..bc89259 --- /dev/null +++ b/src/option/k3bcddboptiontab.h @@ -0,0 +1,50 @@ +/* + * + * $Id$ + * 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 K3B_CDDB_OPTIONTAB_H +#define K3B_CDDB_OPTIONTAB_H + +#include "base_k3bcddboptiontab.h" + + +class K3bCddbOptionTab : public base_K3bCddbOptionTab +{ + Q_OBJECT + + public: + K3bCddbOptionTab( QWidget* parent = 0, const char* name = 0 ); + ~K3bCddbOptionTab(); + + public slots: + void readSettings(); + void apply(); + + private slots: + void slotLocalDirAdd(); + void slotLocalDirRemove(); + void slotLocalDirDown(); + void slotLocalDirUp(); + + void slotCddbServerAdd(); + void slotCddbServerRemove(); + void slotCddbServerDown(); + void slotCddbServerUp(); + + void slotServerTypeChanged(); + + void enDisableButtons(); +}; + +#endif diff --git a/src/option/k3bdeviceoptiontab.cpp b/src/option/k3bdeviceoptiontab.cpp new file mode 100644 index 0000000..65607c6 --- /dev/null +++ b/src/option/k3bdeviceoptiontab.cpp @@ -0,0 +1,94 @@ +/* + * + * $Id: k3bdeviceoptiontab.cpp 619556 2007-01-03 17:38:12Z 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. + */ + +#include "k3bdeviceoptiontab.h" +#include <k3bdevicemanager.h> +#include "k3bdevicewidget.h" +#include <k3bglobals.h> +#include <k3bcore.h> + +#include <qlabel.h> +#include <qstring.h> +#include <qlayout.h> +#include <qcursor.h> +#include <qapplication.h> + +#include <kapplication.h> +#include <kdialog.h> +#include <klocale.h> +#include <kconfig.h> +#include <kstandarddirs.h> + + +K3bDeviceOptionTab::K3bDeviceOptionTab( QWidget* parent, const char* name ) + : QWidget( parent, name ) +{ + QGridLayout* frameLayout = new QGridLayout( this ); + frameLayout->setSpacing( KDialog::spacingHint() ); + frameLayout->setMargin( 0 ); + + + // Info Label + // ------------------------------------------------ + m_labelDevicesInfo = new QLabel( this, "m_labelDevicesInfo" ); + m_labelDevicesInfo->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter | QLabel::AlignLeft ) ); + m_labelDevicesInfo->setText( i18n( "K3b tries to detect all your devices properly. " + "You can add devices that have not been detected and change " + "the black values by clicking in the list. If K3b is unable " + "to detect your drive, you need to modify their permissions " + "to give K3b write access to all devices." ) ); + // ------------------------------------------------ + + m_deviceWidget = new K3bDeviceWidget( k3bcore->deviceManager(), this ); + + frameLayout->addWidget( m_labelDevicesInfo, 0, 0 ); + frameLayout->addWidget( m_deviceWidget, 1, 0 ); + + connect( m_deviceWidget, SIGNAL(refreshButtonClicked()), this, SLOT(slotRefreshButtonClicked()) ); +} + + +K3bDeviceOptionTab::~K3bDeviceOptionTab() +{ +} + + +void K3bDeviceOptionTab::readDevices() +{ + m_deviceWidget->init(); +} + + + +void K3bDeviceOptionTab::saveDevices() +{ + // save changes to deviceManager + m_deviceWidget->apply(); + + // save the config + k3bcore->deviceManager()->saveConfig( kapp->config() ); +} + + +void K3bDeviceOptionTab::slotRefreshButtonClicked() +{ + QApplication::setOverrideCursor( QCursor(Qt::WaitCursor) ); + k3bcore->deviceManager()->clear(); + k3bcore->deviceManager()->scanBus(); + m_deviceWidget->init(); + QApplication::restoreOverrideCursor(); +} + +#include "k3bdeviceoptiontab.moc" diff --git a/src/option/k3bdeviceoptiontab.h b/src/option/k3bdeviceoptiontab.h new file mode 100644 index 0000000..492b421 --- /dev/null +++ b/src/option/k3bdeviceoptiontab.h @@ -0,0 +1,47 @@ +/* + * + * $Id: k3bdeviceoptiontab.h 619556 2007-01-03 17:38:12Z 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 K3B_DEVICE_OPTIONTAB_H +#define K3B_DEVICE_OPTIONTAB_H + +#include <qwidget.h> + +class QLabel; +class K3bDeviceWidget; + + +class K3bDeviceOptionTab : public QWidget +{ +Q_OBJECT + + public: + K3bDeviceOptionTab( QWidget*, const char* name = 0 ); + ~K3bDeviceOptionTab(); + + void readDevices(); + void saveDevices(); + + private slots: + void slotRefreshButtonClicked(); + + private: + QLabel* m_labelDevicesInfo; + K3bDeviceWidget* m_deviceWidget; +}; + + + +#endif diff --git a/src/option/k3bdevicewidget.cpp b/src/option/k3bdevicewidget.cpp new file mode 100644 index 0000000..d7d1e36 --- /dev/null +++ b/src/option/k3bdevicewidget.cpp @@ -0,0 +1,404 @@ +/* + * + * $Id$ + * 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. + */ + + +#include "k3bdevicewidget.h" +#include "k3bdevicemanager.h" +#include "k3bdevice.h" +#include "k3bdeviceglobals.h" +#include <k3blistview.h> + +#include <kinputdialog.h> +#include <kmessagebox.h> +#include <knuminput.h> +#include <kdialog.h> +#include <klocale.h> +#include <kconfig.h> +#include <ksimpleconfig.h> +#include <kiconloader.h> +#include <kstandarddirs.h> +#include <kio/global.h> + +#include <qgroupbox.h> +#include <qpushbutton.h> +#include <qlayout.h> +#include <qvariant.h> +#include <qtooltip.h> +#include <qwhatsthis.h> +#include <qheader.h> +#include <qstring.h> +#include <qcolor.h> +#include <qptrlist.h> + + +class K3bDeviceWidget::PrivateTempDevice +{ +public: + PrivateTempDevice( K3bDevice::Device* d ) { + device = d; + cdrdaoDriver = d->cdrdaoDriver(); + cdTextCapable = ( d->cdTextCapable() != 2 ); + writer = d->burner(); + } + + K3bDevice::Device* device; + QString cdrdaoDriver; + bool cdTextCapable; + bool writer; +}; + + +class K3bDeviceWidget::PrivateDeviceViewItem1 : public K3bListViewItem +{ +public: + PrivateDeviceViewItem1( int type, PrivateTempDevice* dev, QListView* view, QListViewItem* after ) + : K3bListViewItem( view, after ), + m_type(type) { + this->dev = dev; + init(); + } + + PrivateDeviceViewItem1( int type, PrivateTempDevice* dev, QListViewItem* item, QListViewItem* after ) + : K3bListViewItem( item, after ), + m_type(type) { + this->dev = dev; + init(); + } + + void setText(int col, const QString& text) { + if( col == 1 ) { + switch(m_type) { + case t_cdrdaoDriver: + dev->cdrdaoDriver = text; + break; + case t_cdTextCapable: + if( dev->cdrdaoDriver != "auto" ) + dev->cdTextCapable = ( text == i18n("yes") ); + break; + } + } + } + + QString text( int col ) const { + switch(m_type) { + case t_cdrdaoDriver: + return (col == 0 ? i18n("Cdrdao driver:") : dev->cdrdaoDriver ); + break; + case t_cdTextCapable: + if( col == 0 ) + return i18n("CD-Text capable:"); + else { + if( dev->cdrdaoDriver == "auto" ) + return "auto"; + else return ( dev->cdTextCapable ? i18n("yes") : i18n("no") ); + } + } + return "???"; + } + + enum itemType { t_cdrdaoDriver, t_cdTextCapable }; + + PrivateTempDevice* dev; + +private: + void init() { + static QStringList l; + static QStringList l2; + + switch(m_type) { + case t_cdrdaoDriver: + if( l.isEmpty() ) + for( int i = 0; i < 13; i++ ) + l.append(K3bDevice::Device::cdrdao_drivers[i]); + + setEditor( 1, COMBO, l ); + break; + case t_cdTextCapable: + if( l2.isEmpty() ) { + l2.append(i18n("auto")); + l2.append(i18n("yes")); + l2.append(i18n("no")); + } + + setEditor( 1, COMBO, l2 ); + } + } + + int m_type; +}; + + + + + + +K3bDeviceWidget::K3bDeviceWidget( K3bDevice::DeviceManager* manager, QWidget *parent, const char *name ) + : QWidget( parent, name ), m_deviceManager( manager ) +{ + QGridLayout* frameLayout = new QGridLayout( this ); + frameLayout->setSpacing( KDialog::spacingHint() ); + frameLayout->setMargin( 0 ); + + + // buttons + // ------------------------------------------------ + QGridLayout* refreshButtonGrid = new QGridLayout; + refreshButtonGrid->setSpacing( KDialog::spacingHint() ); + refreshButtonGrid->setMargin(0); + m_buttonRefreshDevices = new QPushButton( i18n( "Refresh" ), this, "m_buttonRefreshDevices" ); + m_buttonAddDevice = new QPushButton( i18n( "Add Device..." ), this, "m_buttonAddDevice" ); + QToolTip::add( m_buttonRefreshDevices, i18n( "Rescan the devices" ) ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + refreshButtonGrid->addItem( spacer, 0, 0 ); + refreshButtonGrid->addWidget( m_buttonRefreshDevices, 0, 2 ); + refreshButtonGrid->addWidget( m_buttonAddDevice, 0, 1 ); + // ------------------------------------------------ + + + // Devices Box + // ------------------------------------------------ + QGroupBox* groupDevices = new QGroupBox( 1, Qt::Vertical, i18n( "CD/DVD Drives" ), this ); + groupDevices->layout()->setSpacing( KDialog::spacingHint() ); + groupDevices->layout()->setMargin( KDialog::marginHint() ); + + m_viewDevices = new K3bListView( groupDevices, "m_viewDevicesReader" ); + m_viewDevices->addColumn( "V" ); + m_viewDevices->addColumn( "D" ); + m_viewDevices->setAllColumnsShowFocus( true ); + m_viewDevices->header()->hide(); + m_viewDevices->setSorting( -1 ); + m_viewDevices->setDoubleClickForEdit(false); + m_viewDevices->setAlternateBackground( QColor() ); + m_viewDevices->setSelectionMode( QListView::NoSelection ); + m_viewDevices->setFullWidth(true); + // ------------------------------------------------ + + + frameLayout->addWidget( groupDevices, 0, 0 ); + frameLayout->addLayout( refreshButtonGrid, 1, 0 ); + // ------------------------------------------------ + + // temporary device lists settings + // ------------------------------------------------ + m_tempDevices.setAutoDelete( true ); + // ------------------------------------------------ + + + // connections + // ------------------------------------------------ + // connect( m_buttonRefreshDevices, SIGNAL(clicked()), this, SLOT(slotRefreshDevices()) ); + connect( m_buttonRefreshDevices, SIGNAL(clicked()), this, SIGNAL(refreshButtonClicked()) ); + connect( m_buttonAddDevice, SIGNAL(clicked()), this, SLOT(slotNewDevice()) ); + connect( m_deviceManager, SIGNAL(changed()), this, SLOT(init()) ); + // ------------------------------------------------ +} + + +K3bDeviceWidget::~K3bDeviceWidget() +{ + m_tempDevices.clear(); +} + + +void K3bDeviceWidget::init() +{ + // fill the temporary lists + m_tempDevices.clear(); + + // add the reading devices + for( QPtrListIterator<K3bDevice::Device> it( m_deviceManager->allDevices() ); *it; ++it ) + m_tempDevices.append( new PrivateTempDevice( *it ) ); + + updateDeviceListViews(); +} + + +void K3bDeviceWidget::updateDeviceListViews() +{ + m_viewDevices->clear(); + + // create the parent view items + // ----------------------------------------- + m_writerParentViewItem = new QListViewItem( m_viewDevices, i18n("Writer Drives") ); + m_writerParentViewItem->setPixmap( 0, SmallIcon( "cdwriter_unmount" ) ); + // spacer item + (void)new QListViewItem( m_viewDevices ); + m_readerParentViewItem = new QListViewItem( m_viewDevices, i18n("Readonly Drives") ); + m_readerParentViewItem->setPixmap( 0, SmallIcon( "cdrom_unmount" ) ); + // ----------------------------------------- + + QFont fBold( m_viewDevices->font() ); + fBold.setBold(true); + QFont fItalic( m_viewDevices->font() ); + fItalic.setItalic(true); + + PrivateTempDevice* dev = m_tempDevices.first(); + while( dev ) { + // create the root device item + K3bListViewItem* devRoot = new K3bListViewItem( (dev->writer ? m_writerParentViewItem : m_readerParentViewItem), + dev->device->vendor() + " " + dev->device->description() ); + devRoot->setFont( 0, fBold ); + + // create the read-only info items + K3bListViewItem* systemDeviceItem = new K3bListViewItem( devRoot, i18n("System device name:") ); + if( dev->device->interfaceType() == K3bDevice::SCSI ) + systemDeviceItem->setText( 1, QString("%1 (%2)").arg(dev->device->devicename()).arg(dev->device->busTargetLun()) ); + else + systemDeviceItem->setText( 1, dev->device->devicename() ); + systemDeviceItem->setForegroundColor( 1, palette().disabled().foreground() ); + + K3bListViewItem* interfaceItem = new K3bListViewItem( devRoot, systemDeviceItem, + i18n("Interface type:"), + ( dev->device->interfaceType() == K3bDevice::SCSI ? + i18n("Generic SCSI") : + i18n("ATAPI") ) ); + interfaceItem->setForegroundColor( 1, palette().disabled().foreground() ); + + K3bListViewItem* vendorItem = new K3bListViewItem( devRoot, interfaceItem, + i18n("Vendor:"), + dev->device->vendor() ); + vendorItem->setForegroundColor( 1, palette().disabled().foreground() ); + K3bListViewItem* modelItem = new K3bListViewItem( devRoot, vendorItem, + i18n("Description:"), + dev->device->description() ); + modelItem->setForegroundColor( 1, palette().disabled().foreground() ); + K3bListViewItem* versionItem = new K3bListViewItem( devRoot, modelItem, + i18n("Firmware:"), + dev->device->version() ); + versionItem->setForegroundColor( 1, palette().disabled().foreground() ); + + + // drive type + // -------------------------------- + K3bListViewItem* typeItem = new K3bListViewItem( devRoot, versionItem, + i18n("Writes CD-R:"), + dev->device->writesCd() ? i18n("yes") : i18n("no") ); + typeItem->setForegroundColor( 1, palette().disabled().foreground() ); + typeItem = new K3bListViewItem( devRoot, typeItem, + i18n("Writes CD-RW:"), + dev->device->writesCdrw() ? i18n("yes") : i18n("no") ); + typeItem->setForegroundColor( 1, palette().disabled().foreground() ); + typeItem = new K3bListViewItem( devRoot, typeItem, + i18n("Reads DVD:"), + dev->device->readsDvd() ? i18n("yes") : i18n("no") ); + typeItem->setForegroundColor( 1, palette().disabled().foreground() ); + typeItem = new K3bListViewItem( devRoot, typeItem, + i18n("Writes DVD-R(W):"), + dev->device->writesDvdMinus() ? i18n("yes") : i18n("no") ); + typeItem->setForegroundColor( 1, palette().disabled().foreground() ); + typeItem = new K3bListViewItem( devRoot, typeItem, + i18n("Writes DVD-R Dual Layer:"), + (dev->device->type() & K3bDevice::DEVICE_DVD_R_DL) + ? i18n("yes") : i18n("no") ); + typeItem->setForegroundColor( 1, palette().disabled().foreground() ); + typeItem = new K3bListViewItem( devRoot, typeItem, + i18n("Writes DVD+R(W):"), + dev->device->writesDvdPlus() ? i18n("yes") : i18n("no") ); + typeItem->setForegroundColor( 1, palette().disabled().foreground() ); + typeItem = new K3bListViewItem( devRoot, typeItem, + i18n("Writes DVD+R Double Layer:"), + (dev->device->type() & K3bDevice::DEVICE_DVD_PLUS_R_DL) + ? i18n("yes") : i18n("no") ); + typeItem->setForegroundColor( 1, palette().disabled().foreground() ); + // -------------------------------- + + + // now add the reader (both interfaces) items + if( dev->device->bufferSize() > 0 ) { + typeItem = new K3bListViewItem( devRoot, typeItem, + i18n("Buffer Size:"), + KIO::convertSizeFromKB(dev->device->bufferSize()) ); + typeItem->setForegroundColor( 1, palette().disabled().foreground() ); + } + + PrivateDeviceViewItem1* cdrdaoDriverItem = new PrivateDeviceViewItem1( PrivateDeviceViewItem1::t_cdrdaoDriver, + dev, + devRoot, + typeItem ); + + + // now add the writer specific items + if( dev->writer ) { + PrivateDeviceViewItem1* cdTextItem = new PrivateDeviceViewItem1( PrivateDeviceViewItem1::t_cdTextCapable, + dev, + devRoot, + cdrdaoDriverItem ); + + typeItem = new K3bListViewItem( devRoot, cdTextItem, + i18n("Supports Burnfree:"), + dev->device->burnfree() ? i18n("yes") : i18n("no") ); + typeItem->setForegroundColor( 1, palette().disabled().foreground() ); + + + // and at last the write modes + (new K3bListViewItem( devRoot, + typeItem, + i18n("Write modes:"), + K3bDevice::writingModeString(dev->device->writingModes()) ))->setForegroundColor( 1, palette().disabled().foreground() ); + } + + devRoot->setOpen(true); + + dev = m_tempDevices.next(); + } + + // create empty items + if( m_writerParentViewItem->childCount() == 0 ) { + K3bListViewItem* item = new K3bListViewItem( m_writerParentViewItem, i18n("none") ); + item->setFont( 0, fItalic ); + } + if( m_readerParentViewItem->childCount() == 0 ) { + K3bListViewItem* item = new K3bListViewItem( m_readerParentViewItem, i18n("none") ); + item->setFont( 0, fItalic ); + } + + m_writerParentViewItem->setOpen( true ); + m_readerParentViewItem->setOpen( true ); +} + + +void K3bDeviceWidget::slotNewDevice() +{ + bool ok; + QString newDevicename = KInputDialog::getText( i18n("Location of New Drive"), + i18n("Please enter the device name where K3b should search\nfor a new drive (example: /dev/cdrom):"), + "/dev/", &ok, this ); + + if( ok ) { + if( K3bDevice::Device* dev = m_deviceManager->addDevice( newDevicename ) ) { + m_tempDevices.append( new PrivateTempDevice( dev ) ); + + updateDeviceListViews(); + } + else + KMessageBox::error( this, i18n("Could not find an additional device at\n%1").arg(newDevicename), i18n("Error"), false ); + } +} + + +void K3bDeviceWidget::apply() +{ + // update the devices + PrivateTempDevice* tempDev = m_tempDevices.first(); + while( tempDev != 0 ) { + tempDev->device->setCdrdaoDriver( tempDev->cdrdaoDriver ); + tempDev->device->setCdTextCapability( tempDev->cdTextCapable ); + + tempDev = m_tempDevices.next(); + } +} + + +#include "k3bdevicewidget.moc" diff --git a/src/option/k3bdevicewidget.h b/src/option/k3bdevicewidget.h new file mode 100644 index 0000000..a874c94 --- /dev/null +++ b/src/option/k3bdevicewidget.h @@ -0,0 +1,78 @@ +/* + * + * $Id: k3bdevicewidget.h 619556 2007-01-03 17:38:12Z 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 K3BDEVICEWIDGET_H +#define K3BDEVICEWIDGET_H + +#include <qwidget.h> +#include <qptrlist.h> +#include "k3bdevice.h" +#include "k3bdevicemanager.h" + +class QComboBox; +class QLabel; +class QGroupBox; +class QPushButton; +class QCheckBox; +class K3bListView; +class QString; +class KIntNumInput; +class QFrame; +class QListViewItem; +class QString; +class QLineEdit; + + +/** + *@author Sebastian Trueg + */ +class K3bDeviceWidget : public QWidget +{ + Q_OBJECT + + public: + K3bDeviceWidget( K3bDevice::DeviceManager*, QWidget *parent = 0, const char *name = 0 ); + ~K3bDeviceWidget(); + + public slots: + void init(); + void apply(); + + signals: + void refreshButtonClicked(); + + private slots: + void slotNewDevice(); + void updateDeviceListViews(); + + private: + class PrivateTempDevice; + class PrivateDeviceViewItem1; + + /** list to save changes to the devices before applying */ + QPtrList<PrivateTempDevice> m_tempDevices; + + QListViewItem* m_writerParentViewItem; + QListViewItem* m_readerParentViewItem; + + K3bDevice::DeviceManager* m_deviceManager; + + K3bListView* m_viewDevices; + QPushButton* m_buttonRefreshDevices; + QPushButton* m_buttonAddDevice; +}; + +#endif diff --git a/src/option/k3bexternalbinoptiontab.cpp b/src/option/k3bexternalbinoptiontab.cpp new file mode 100644 index 0000000..d5c78bc --- /dev/null +++ b/src/option/k3bexternalbinoptiontab.cpp @@ -0,0 +1,78 @@ +/* + * + * $Id: k3bexternalbinoptiontab.cpp 619556 2007-01-03 17:38:12Z 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. + */ + + +#include "k3bexternalbinoptiontab.h" +#include <k3bexternalbinmanager.h> +#include "k3bexternalbinwidget.h" + +#include <kmessagebox.h> +#include <kdialog.h> +#include <klocale.h> +#include <kiconloader.h> +#include <klistview.h> + +#include <qgroupbox.h> +#include <qlabel.h> +#include <qpushbutton.h> +#include <qlayout.h> +#include <qvariant.h> +#include <qtooltip.h> +#include <qwhatsthis.h> +#include <qfile.h> +#include <qptrlist.h> + + + +K3bExternalBinOptionTab::K3bExternalBinOptionTab( K3bExternalBinManager* manager, QWidget* parent, const char* name ) + : QWidget( parent, name ) +{ + m_manager = manager; + + QGridLayout* frameLayout = new QGridLayout( this ); + frameLayout->setSpacing( KDialog::spacingHint() ); + frameLayout->setMargin( 0 ); + + m_externalBinWidget = new K3bExternalBinWidget( manager, this ); + frameLayout->addWidget( m_externalBinWidget, 1, 0 ); + + QLabel* m_labelInfo = new QLabel( this, "m_labelInfo" ); + m_labelInfo->setText( i18n( "Specify the paths to the external programs that K3b needs to work properly, " + "or press \"Search\" to let K3b search for the programs." ) ); + m_labelInfo->setScaledContents( false ); + m_labelInfo->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter | QLabel::AlignLeft ) ); + + frameLayout->addWidget( m_labelInfo, 0, 0 ); +} + + +K3bExternalBinOptionTab::~K3bExternalBinOptionTab() +{ +} + + +void K3bExternalBinOptionTab::readSettings() +{ + m_externalBinWidget->load(); +} + + +void K3bExternalBinOptionTab::saveSettings() +{ + m_externalBinWidget->save(); +} + + +#include "k3bexternalbinoptiontab.moc" diff --git a/src/option/k3bexternalbinoptiontab.h b/src/option/k3bexternalbinoptiontab.h new file mode 100644 index 0000000..8622579 --- /dev/null +++ b/src/option/k3bexternalbinoptiontab.h @@ -0,0 +1,50 @@ +/* + * + * $Id: k3bexternalbinoptiontab.h 619556 2007-01-03 17:38:12Z 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 K3B_EXTERNALBIN_OPTIONTAB_H +#define K3B_EXTERNALBIN_OPTIONTAB_H + +#include <qwidget.h> + + + +class QPushButton; +class QListViewItem; +class KListView; +class K3bExternalBinManager; +class K3bExternalBinWidget; + + +class K3bExternalBinOptionTab : public QWidget +{ +Q_OBJECT + + public: + K3bExternalBinOptionTab( K3bExternalBinManager*, QWidget*, const char* name = 0 ); + ~K3bExternalBinOptionTab(); + + void readSettings(); + void saveSettings(); + + private: + K3bExternalBinManager* m_manager; + + K3bExternalBinWidget* m_externalBinWidget; +}; + + + +#endif diff --git a/src/option/k3bexternalbinwidget.cpp b/src/option/k3bexternalbinwidget.cpp new file mode 100644 index 0000000..e1c62bb --- /dev/null +++ b/src/option/k3bexternalbinwidget.cpp @@ -0,0 +1,318 @@ +/* + * + * $Id: k3bexternalbinwidget.cpp 619556 2007-01-03 17:38:12Z 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. + */ + +#include "k3bexternalbinwidget.h" +#include "k3bexternalbinmanager.h" + +#include <qpushbutton.h> +#include <kdebug.h> +#include <qtabwidget.h> +#include <qlayout.h> +#include <qheader.h> +#include <qlabel.h> +#include <qstringlist.h> +#include <qmap.h> +#include <qregexp.h> +#include <qfont.h> +#include <qpainter.h> +#include <qtooltip.h> +#include <qwhatsthis.h> +#include <qcursor.h> +#include <qapplication.h> +#include <qbitmap.h> + +#include <kdialog.h> +#include <kiconloader.h> +#include <klocale.h> +#include <keditlistbox.h> +#include <klistview.h> +#include <kglobalsettings.h> +#include <kdeversion.h> + + + +K3bExternalBinWidget::K3bExternalProgramViewItem::K3bExternalProgramViewItem( K3bExternalProgram* p, QListView* parent ) + : K3bListViewItem( parent ), m_program(p) +{ + QFont f( listView()->font() ); + f.setBold(true); + setFont( 0, f ); + setBackgroundColor( 0, KGlobalSettings::alternateBackgroundColor() ); + setBackgroundColor( 1, KGlobalSettings::alternateBackgroundColor() ); + setBackgroundColor( 2, KGlobalSettings::alternateBackgroundColor() ); + setText( 0, p->name() ); + setSelectable( false ); +} + + +K3bExternalBinWidget::K3bExternalBinViewItem::K3bExternalBinViewItem( K3bExternalBin* bin, K3bExternalProgramViewItem* parent ) + : K3bListViewItem( parent ), m_bin( bin ), m_parent( parent ) +{ + setText( 0, bin->path ); + setText( 1, bin->version ); + setText( 2, bin->features().join(", ") ); + + setDefault(false); +} + + +void K3bExternalBinWidget::K3bExternalBinViewItem::setDefault( bool b ) +{ + static QPixmap s_emptyPix( (int)KIcon::SizeSmall, (int)KIcon::SizeSmall ); + static bool s_emptyPixInitialized = false; + if( !s_emptyPixInitialized ) { + s_emptyPix.setMask( QBitmap( (int)KIcon::SizeSmall, (int)KIcon::SizeSmall, true ) ); + s_emptyPixInitialized = true; + } + + m_default = b; + if( b ) + setPixmap( 0, SmallIcon( "ok" ) ); + else + setPixmap( 0, s_emptyPix ); +} + + + + + +// /////////////////////////////////////////////////////////// +// +// K3BEXTERNALBINWIDGET +// +// ////////////////////////////////////////////////////////// + + +K3bExternalBinWidget::K3bExternalBinWidget( K3bExternalBinManager* manager, QWidget* parent, const char* name ) + : QWidget( parent, name ), m_manager( manager ) +{ + QGridLayout* mainGrid = new QGridLayout( this ); + mainGrid->setMargin( 0 ); + mainGrid->setSpacing( KDialog::spacingHint() ); + + m_mainTabWidget = new QTabWidget( this ); + m_rescanButton = new QPushButton( i18n("&Search"), this ); + mainGrid->addMultiCellWidget( m_mainTabWidget, 0, 0, 0, 1 ); + mainGrid->addWidget( m_rescanButton, 1, 1 ); + mainGrid->setColStretch( 0, 1 ); + mainGrid->setRowStretch( 0, 1 ); + + + // setup program tab + // ------------------------------------------------------------ + QWidget* programTab = new QWidget( m_mainTabWidget ); + QGridLayout* programTabLayout = new QGridLayout( programTab ); + programTabLayout->setMargin( KDialog::marginHint() ); + programTabLayout->setSpacing( KDialog::spacingHint() ); + m_programView = new K3bListView( programTab ); + m_defaultButton = new QPushButton( i18n("Set Default"), programTab ); + QToolTip::add( m_defaultButton, i18n("Change the versions K3b should use.") ); + QWhatsThis::add( m_defaultButton, i18n("<p>If K3b found more than one installed version of a program " + "it will choose one as the <em>default</em> which will be used " + "to do the work. If you want to change the default select the " + "wanted version and press this button.") ); + programTabLayout->addMultiCellWidget( m_programView, 1, 1, 0, 1 ); + programTabLayout->addWidget( m_defaultButton, 0, 1 ); + programTabLayout->addWidget( new QLabel( i18n("Use the 'Default' button to change the versions K3b should use."), + programTab ), 0, 0 ); + programTabLayout->setColStretch( 0, 1 ); + programTabLayout->setRowStretch( 1, 1 ); + + m_programView->addColumn( i18n("Path") ); + m_programView->addColumn( i18n("Version") ); + m_programView->addColumn( i18n("Features") ); + m_programView->setAllColumnsShowFocus(true); + m_programView->setFullWidth(true); + m_programView->setAlternateBackground( QColor() ); +#if KDE_IS_VERSION(3,4,0) + m_programView->setShadeSortColumn( false ); +#endif + m_mainTabWidget->addTab( programTab, i18n("Programs") ); + + + // setup parameters tab + // ------------------------------------------------------------ + QWidget* parametersTab = new QWidget( m_mainTabWidget ); + QGridLayout* parametersTabLayout = new QGridLayout( parametersTab ); + parametersTabLayout->setMargin( KDialog::marginHint() ); + parametersTabLayout->setSpacing( KDialog::spacingHint() ); + m_parameterView = new K3bListView( parametersTab ); + parametersTabLayout->addWidget( m_parameterView, 1, 0 ); + parametersTabLayout->addWidget( new QLabel( i18n("User parameters have to be separated by space."), parametersTab ), 0, 0 ); + + parametersTabLayout->setRowStretch( 1, 1 ); + + m_parameterView->addColumn( i18n("Program") ); + m_parameterView->addColumn( i18n("Parameters") ); + m_parameterView->setAllColumnsShowFocus(true); + m_parameterView->setFullWidth(true); + m_parameterView->setDefaultRenameAction( QListView::Accept ); + m_parameterView->setDoubleClickForEdit( false ); + + m_mainTabWidget->addTab( parametersTab, i18n("User Parameters") ); + + + // setup search path tab + // ------------------------------------------------------------ + QWidget* searchPathTab = new QWidget( m_mainTabWidget ); + QGridLayout* searchPathTabLayout = new QGridLayout( searchPathTab ); + searchPathTabLayout->setMargin( KDialog::marginHint() ); + searchPathTabLayout->setSpacing( KDialog::spacingHint() ); + m_searchPathBox = new KEditListBox( i18n("Search Path"), searchPathTab, "searchPathBox", true ); + searchPathTabLayout->addWidget( m_searchPathBox, 0, 0 ); + searchPathTabLayout->addWidget( new QLabel( i18n("<qt><b>Hint:</b> to force K3b to use another than the " + "default name for the executable specify it in the search path.</qt>"), + searchPathTab ), 1, 0 ); + + searchPathTabLayout->setRowStretch( 0, 1 ); + + m_mainTabWidget->addTab( searchPathTab, i18n("Search Path") ); + + + m_programRootItems.setAutoDelete( true ); + + + connect( m_rescanButton, SIGNAL(clicked()), this, SLOT(rescan()) ); + connect( m_defaultButton, SIGNAL(clicked()), this, SLOT(slotSetDefaultButtonClicked()) ); + connect( m_programView, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(slotProgramSelectionChanged(QListViewItem*)) ); + + slotProgramSelectionChanged( 0 ); +} + + +K3bExternalBinWidget::~K3bExternalBinWidget() +{ +} + +void K3bExternalBinWidget::rescan() +{ + QApplication::setOverrideCursor( QCursor(Qt::WaitCursor) ); + saveSearchPath(); + m_manager->search(); + load(); + QApplication::restoreOverrideCursor(); +} + + +void K3bExternalBinWidget::load() +{ + m_programRootItems.clear(); + m_parameterView->clear(); + + // load programs + const QMap<QString, K3bExternalProgram*>& map = m_manager->programs(); + for( QMap<QString, K3bExternalProgram*>::const_iterator it = map.begin(); it != map.end(); ++it ) { + K3bExternalProgram* p = it.data(); + + K3bExternalProgramViewItem* pV = new K3bExternalProgramViewItem( p, m_programView ); + m_programRootItems.append( pV ); + // populate it + QPtrListIterator<K3bExternalBin> binIt( p->bins() ); + for( ; binIt.current(); ++binIt ) { + K3bExternalBin* b = *binIt; + + K3bExternalBinViewItem* bV = new K3bExternalBinViewItem( b, pV ); + if( b == p->defaultBin() ) + bV->setDefault(true); + + pV->setOpen(true); + } + + if( p->bins().isEmpty() ) + pV->setText( 0, p->name() + i18n(" (not found)") ); + + // load user parameters + if( p->supportsUserParameters() ) { + K3bExternalProgramViewItem* paraV = new K3bExternalProgramViewItem( p, m_parameterView ); + paraV->setText( 1, p->userParameters().join( " " ) ); + paraV->setEditor( 1, K3bListViewItem::LINE ); + } + } + + + + // load search path + m_searchPathBox->clear(); + m_searchPathBox->insertStringList( m_manager->searchPath() ); +} + + +void K3bExternalBinWidget::save() +{ + saveSearchPath(); + + + // save the default programs + QListViewItemIterator progIt( m_programView ); + while( progIt.current() ) { + if( K3bExternalBinViewItem* bV = dynamic_cast<K3bExternalBinViewItem*>( progIt.current() ) ) { + if( bV->isDefault() ) + bV->parentProgramItem()->program()->setDefault( bV->bin() ); + } + + ++progIt; + } + + + // save the user parameters + QListViewItemIterator paraIt( m_parameterView ); + QRegExp reSpace( "\\s" ); + while( paraIt.current() ) { + K3bExternalProgramViewItem* pV = (K3bExternalProgramViewItem*)paraIt.current(); + pV->program()->setUserParameters( QStringList::split( reSpace, pV->text(1) ) ); + + ++paraIt; + } +} + + +void K3bExternalBinWidget::saveSearchPath() +{ + m_manager->setSearchPath( m_searchPathBox->items() ); +} + + +void K3bExternalBinWidget::slotSetDefaultButtonClicked() +{ + // check if we are on a binItem + K3bExternalBinViewItem* item = dynamic_cast<K3bExternalBinViewItem*>( m_programView->selectedItem() ); + if( item ) { + // remove all default flags + K3bExternalBinViewItem* bi = (K3bExternalBinViewItem*)item->parentProgramItem()->firstChild(); + QListViewItemIterator it( bi ); + while( it.current() && it.current()->parent() == item->parentProgramItem() ) { + ((K3bExternalBinViewItem*)it.current())->setDefault(false); + ++it; + } + + item->setDefault(true); + } +} + + +void K3bExternalBinWidget::slotProgramSelectionChanged( QListViewItem* item ) +{ + K3bExternalBinViewItem* bV = dynamic_cast<K3bExternalBinViewItem*>( item ); + if( bV ) { + if( bV->isDefault() ) + m_defaultButton->setEnabled(false); + else + m_defaultButton->setEnabled(true); + } + else + m_defaultButton->setEnabled(false); +} + +#include "k3bexternalbinwidget.moc" diff --git a/src/option/k3bexternalbinwidget.h b/src/option/k3bexternalbinwidget.h new file mode 100644 index 0000000..fe2e163 --- /dev/null +++ b/src/option/k3bexternalbinwidget.h @@ -0,0 +1,103 @@ +/* + * + * $Id: k3bexternalbinwidget.h 619556 2007-01-03 17:38:12Z 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 K3B_EXTERNAL_BIN_WIDGET_H +#define K3B_EXTERNAL_BIN_WIDGET_H + + +#include <qwidget.h> +#include <qptrlist.h> + +#include <k3blistview.h> + + +class K3bExternalBinManager; +class QPushButton; +class QTabWidget; +class KEditListBox; +class K3bExternalProgram; +class K3bExternalBin; + + +class K3bExternalBinWidget : public QWidget +{ + Q_OBJECT + + public: + K3bExternalBinWidget( K3bExternalBinManager*, QWidget* parent = 0, const char* name = 0 ); + ~K3bExternalBinWidget(); + + class K3bExternalBinViewItem; + class K3bExternalProgramViewItem; + + public slots: + void rescan(); + void load(); + void save(); + + private slots: + void slotSetDefaultButtonClicked(); + void slotProgramSelectionChanged( QListViewItem* ); + void saveSearchPath(); + + private: + K3bExternalBinManager* m_manager; + + QTabWidget* m_mainTabWidget; + K3bListView* m_programView; + K3bListView* m_parameterView; + KEditListBox* m_searchPathBox; + + QPushButton* m_defaultButton; + QPushButton* m_rescanButton; + + QPtrList<K3bExternalProgramViewItem> m_programRootItems; +}; + + +class K3bExternalBinWidget::K3bExternalProgramViewItem : public K3bListViewItem +{ + public: + K3bExternalProgramViewItem( K3bExternalProgram* p, QListView* parent ); + + K3bExternalProgram* program() const { return m_program; } + + private: + K3bExternalProgram* m_program; +}; + + + +class K3bExternalBinWidget::K3bExternalBinViewItem : public K3bListViewItem +{ + public: + K3bExternalBinViewItem( K3bExternalBin* bin, K3bExternalProgramViewItem* parent ); + + K3bExternalBin* bin() const { return m_bin; } + K3bExternalProgramViewItem* parentProgramItem() const { return m_parent; } + + bool isDefault() const { return m_default; } + void setDefault( bool b ); + + private: + K3bExternalBin* m_bin; + K3bExternalProgramViewItem* m_parent; + + bool m_default; +}; + + +#endif diff --git a/src/option/k3bmiscoptiontab.cpp b/src/option/k3bmiscoptiontab.cpp new file mode 100644 index 0000000..d81e565 --- /dev/null +++ b/src/option/k3bmiscoptiontab.cpp @@ -0,0 +1,187 @@ +/* + * + * $Id: k3bmiscoptiontab.cpp 619556 2007-01-03 17:38:12Z 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. + */ + + +#include "k3bmiscoptiontab.h" + +#include <k3bpluginmanager.h> +#include <k3baudiooutputplugin.h> +#include <k3baudioserver.h> +#include <k3bcore.h> +#include <k3bservicemenuinstaller.h> +#include <k3binteractiondialog.h> +#include <k3bintmapcombobox.h> + +#include <qcheckbox.h> +#include <qfileinfo.h> +#include <qradiobutton.h> + +#include <kapplication.h> +#include <klocale.h> +#include <kconfig.h> +#include <kdialog.h> +#include <kstandarddirs.h> +#include <kmessagebox.h> +#include <kurlrequester.h> +#include <kcombobox.h> + + +K3bMiscOptionTab::K3bMiscOptionTab(QWidget *parent, const char *name ) + : base_K3bMiscOptionTab(parent,name) +{ + m_editTempDir->setMode( KFile::Directory ); + connect( m_buttonConfigureAudioOutput, SIGNAL(clicked()), + this, SLOT(slotConfigureAudioOutput()) ); + + m_comboActionDialogSettings->insertItem( K3bInteractionDialog::LOAD_K3B_DEFAULTS, + i18n("Default Settings"), + i18n("Load the K3b Defaults at dialog startup.") ); + m_comboActionDialogSettings->insertItem( K3bInteractionDialog::LOAD_SAVED_SETTINGS, + i18n("Saved Settings"), + i18n("Load the settings saved by the user at dialog startup.") ); + m_comboActionDialogSettings->insertItem( K3bInteractionDialog::LOAD_LAST_SETTINGS, + i18n("Last Used Settings"), + i18n("Load the last used settings at dialog startup.") ); + m_comboActionDialogSettings->addGlobalWhatsThisText( i18n("K3b handles three sets of settings in action dialogs " + "(action dialogs include the CD Copy dialog or the Audio CD " + "project dialog):"), + i18n("One of these sets is loaded once an action dialog is opened. " + "This setting defines which set it will be.") ); +} + + +K3bMiscOptionTab::~K3bMiscOptionTab() +{ +} + + +void K3bMiscOptionTab::readSettings() +{ + KConfig* c = kapp->config(); + c->setGroup( "General Options" ); + m_checkSaveOnExit->setChecked( c->readBoolEntry( "ask_for_saving_changes_on_exit", true ) ); + m_checkShowSplash->setChecked( c->readBoolEntry("Show splash", true) ); + m_checkShowProgressOSD->setChecked( c->readBoolEntry( "Show progress OSD", true ) ); + m_checkHideMainWindowWhileWriting->setChecked( c->readBoolEntry( "hide main window while writing", false ) ); + m_checkKeepDialogsOpen->setChecked( c->readBoolEntry( "keep action dialogs open", false ) ); + m_comboActionDialogSettings->setSelectedValue( c->readNumEntry( "action dialog startup settings", + K3bInteractionDialog::LOAD_SAVED_SETTINGS ) ); + m_checkSystemConfig->setChecked( c->readBoolEntry( "check system config", true ) ); + + QString tempdir = c->readPathEntry( "Temp Dir", KGlobal::dirs()->resourceDirs( "tmp" ).first() ); + m_editTempDir->setURL( tempdir ); + +// if( c->readEntry( "Multiple Instances", "smart" ) == "smart" ) +// m_radioMultipleInstancesSmart->setChecked(true); +// else +// m_radioMultipleInstancesNew->setChecked(true); + + // Audio Output + m_comboAudioOutputSystem->clear(); + QPtrList<K3bPlugin> fl = k3bcore->pluginManager()->plugins( "AudioOutput" ); + for( QPtrListIterator<K3bPlugin> it( fl ); it.current(); ++it ) { + K3bAudioOutputPlugin* f = static_cast<K3bAudioOutputPlugin*>( it.current() ); + m_comboAudioOutputSystem->insertItem( QString::fromLocal8Bit(f->soundSystem()) ); + } + + m_comboAudioOutputSystem->setCurrentItem( c->readEntry( "Audio Output System", "arts" ), false ); + m_buttonConfigureAudioOutput->setEnabled( m_comboAudioOutputSystem->count() > 0 ); + + K3bServiceInstaller si; + m_checkKonqiIntegration->setChecked( si.allInstalled() ); +} + + +bool K3bMiscOptionTab::saveSettings() +{ + KConfig* c = kapp->config(); + c->setGroup( "General Options" ); + c->writeEntry( "ask_for_saving_changes_on_exit", m_checkSaveOnExit->isChecked() ); + c->writeEntry( "Show splash", m_checkShowSplash->isChecked() ); + c->writeEntry( "Show progress OSD", m_checkShowProgressOSD->isChecked() ); + c->writeEntry( "hide main window while writing", m_checkHideMainWindowWhileWriting->isChecked() ); + c->writeEntry( "keep action dialogs open", m_checkKeepDialogsOpen->isChecked() ); + c->writeEntry( "check system config", m_checkSystemConfig->isChecked() ); + c->writeEntry( "action dialog startup settings", m_comboActionDialogSettings->selectedValue() ); + + QString tempDir = m_editTempDir->url(); + QFileInfo fi( tempDir ); + + if( fi.isRelative() ) { + fi.setFile( fi.absFilePath() ); + } + + if( !fi.exists() ) { + if( KMessageBox::questionYesNo( this, i18n("Directory (%1) does not exist. Create?").arg(tempDir), + i18n("Create Directory"), i18n("Create"), KStdGuiItem::cancel() ) == KMessageBox::Yes ) { + if( !KStandardDirs::makeDir( fi.absFilePath() ) ) { + KMessageBox::error( this, i18n("Unable to create directory %1").arg(tempDir) ); + return false; + } + } + else { + // the dir does not exist and the user doesn't want to create it + return false; + } + } + + if( fi.isFile() ) { + KMessageBox::information( this, i18n("You specified a file for the temporary directory. " + "K3b will use its base path as the temporary directory."), + i18n("Warning"), + "temp file only using base path" ); + fi.setFile( fi.dirPath() ); + } + + // check for writing permission + if( !fi.isWritable() ) { + KMessageBox::error( this, i18n("You do not have permission to write to %1.").arg(fi.absFilePath()) ); + return false; + } + + m_editTempDir->setURL( fi.absFilePath() ); + + c->writePathEntry( "Temp Dir", m_editTempDir->url() ); + +// if( m_radioMultipleInstancesSmart->isChecked() ) +// c->writeEntry( "Multiple Instances", "smart" ); +// else +// c->writeEntry( "Multiple Instances", "always_new" ); + + // Audio Output System + if( m_comboAudioOutputSystem->count() > 0 ) { + c->writeEntry( "Audio Output System", m_comboAudioOutputSystem->currentText() ); + K3bAudioServer::instance()->setOutputMethod( m_comboAudioOutputSystem->currentText().local8Bit() ); + } + + K3bServiceInstaller si; + if( m_checkKonqiIntegration->isChecked() ) + si.install( this ); + else + si.remove( this ); + + return true; +} + + +void K3bMiscOptionTab::slotConfigureAudioOutput() +{ + QString system = m_comboAudioOutputSystem->currentText(); + if( K3bAudioOutputPlugin* plugin = K3bAudioServer::findOutputPlugin( system.local8Bit() ) ) { + k3bcore->pluginManager()->execPluginDialog( plugin, this ); + } +} + +#include "k3bmiscoptiontab.moc" diff --git a/src/option/k3bmiscoptiontab.h b/src/option/k3bmiscoptiontab.h new file mode 100644 index 0000000..6e5ded6 --- /dev/null +++ b/src/option/k3bmiscoptiontab.h @@ -0,0 +1,43 @@ +/* + * + * $Id: k3bmiscoptiontab.h 619556 2007-01-03 17:38:12Z 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 K3BMISCOPTIONTAB_H +#define K3BMISCOPTIONTAB_H + +#include "base_k3bmiscoptiontab.h" + +class QCheckBox; +class KURLRequester; + +/** + *@author Sebastian Trueg + */ +class K3bMiscOptionTab : public base_K3bMiscOptionTab +{ + Q_OBJECT + + public: + K3bMiscOptionTab(QWidget *parent=0, const char *name=0); + ~K3bMiscOptionTab(); + + void readSettings(); + bool saveSettings(); + + private slots: + void slotConfigureAudioOutput(); +}; + +#endif diff --git a/src/option/k3bnotifyoptiontab.cpp b/src/option/k3bnotifyoptiontab.cpp new file mode 100644 index 0000000..60ddc7c --- /dev/null +++ b/src/option/k3bnotifyoptiontab.cpp @@ -0,0 +1,61 @@ +/* + * + * $Id: k3bnotifyoptiontab.cpp 619556 2007-01-03 17:38:12Z 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. + */ + + +#include <kdeversion.h> + +#include "k3bnotifyoptiontab.h" + +#include <knotifydialog.h> +#include <kdebug.h> + +#include <qlayout.h> + + + +K3bNotifyOptionTab::K3bNotifyOptionTab( QWidget* parent, const char* name ) + : QWidget( parent, name ) +{ + m_notifyWidget = new KNotify::KNotifyWidget( this ); + + QHBoxLayout* box = new QHBoxLayout( this ); + box->addWidget( m_notifyWidget ); +} + + +K3bNotifyOptionTab::~K3bNotifyOptionTab() +{ +} + + +void K3bNotifyOptionTab::readSettings() +{ + m_notifyWidget->clear(); + KNotify::Application* app = m_notifyWidget->addApplicationEvents( "k3b/eventsrc" ); + if( app ) + m_notifyWidget->addVisibleApp(app); + else + kdDebug() << "(K3bNotifyOptionTab) could not find K3b eventsrc." << endl; +} + + +bool K3bNotifyOptionTab::saveSettings() +{ + m_notifyWidget->save(); + + return true; +} + +#include "k3bnotifyoptiontab.moc" diff --git a/src/option/k3bnotifyoptiontab.h b/src/option/k3bnotifyoptiontab.h new file mode 100644 index 0000000..03314dc --- /dev/null +++ b/src/option/k3bnotifyoptiontab.h @@ -0,0 +1,43 @@ +/* + * + * $Id: k3bnotifyoptiontab.h 619556 2007-01-03 17:38:12Z 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 _K3B_NOTIFY_OPTIONTAB_H_ +#define _K3B_NOTIFY_OPTIONTAB_H_ + +#include <qwidget.h> + +namespace KNotify { + class KNotifyWidget; +} + + +class K3bNotifyOptionTab : public QWidget +{ + Q_OBJECT + + public: + K3bNotifyOptionTab( QWidget* parent = 0, const char* name = 0 ); + ~K3bNotifyOptionTab(); + + void readSettings(); + bool saveSettings(); + + private: + KNotify::KNotifyWidget* m_notifyWidget; +}; + +#endif diff --git a/src/option/k3boptiondialog.cpp b/src/option/k3boptiondialog.cpp new file mode 100644 index 0000000..d0ba7ce --- /dev/null +++ b/src/option/k3boptiondialog.cpp @@ -0,0 +1,258 @@ +/* + * + * $Id$ + * 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. + */ + + +#include "k3boptiondialog.h" +#include <k3bcore.h> +#include "k3bcddboptiontab.h" +#include "k3bdeviceoptiontab.h" +#include "k3bburningoptiontab.h" +#include "k3bexternalbinoptiontab.h" +#include "k3bmiscoptiontab.h" +#include "k3bthemeoptiontab.h" +#include "k3bpluginoptiontab.h" +#include <k3bsystemproblemdialog.h> + + +#include <qlayout.h> +#include <qtooltip.h> +#include <qwhatsthis.h> +#include <qtabwidget.h> + +#include <klocale.h> +#include <kiconloader.h> +#include <kconfig.h> +#include <kdeversion.h> +#include "k3bnotifyoptiontab.h" + + +// TODO: handle the default-settings + +K3bOptionDialog::K3bOptionDialog(QWidget *parent, const char *name, bool modal ) + : KDialogBase( IconList, i18n("Settings"), Apply|Ok|Cancel, Ok, parent,name, modal, true) +{ + setupMiscPage(); + setupDevicePage(); + setupProgramsPage(); + setupCddbPage(); + setupNotifyPage(); + setupPluginPage(); + setupThemePage(); + setupBurningPage(); + + m_externalBinOptionTab->readSettings(); + m_cddbOptionTab->readSettings(); + m_deviceOptionTab->readDevices(); + m_burningOptionTab->readSettings(); + m_miscOptionTab->readSettings(); + m_notifyOptionTab->readSettings(); + m_pluginOptionTab->readSettings(); + m_themeOptionTab->readSettings(); + + // if we don't do this the dialog start really huge + // because of the label in the device-tab + resize( 700, 500 ); + + showPage( 0 ); +} + + +K3bOptionDialog::~K3bOptionDialog() +{ +} + + +void K3bOptionDialog::slotOk() +{ + if( saveSettings() ) { + accept(); + + k3bcore->config()->setGroup( "General Options" ); + if( k3bcore->config()->readBoolEntry( "check system config", true ) ) + K3bSystemProblemDialog::checkSystem(); + } +} + +void K3bOptionDialog::slotApply() +{ + saveSettings(); +} + + +bool K3bOptionDialog::saveSettings() +{ + // save all the shit! + m_cddbOptionTab->apply(); + m_deviceOptionTab->saveDevices(); + m_burningOptionTab->saveSettings(); + m_externalBinOptionTab->saveSettings(); + m_notifyOptionTab->saveSettings(); + + m_themeOptionTab->saveSettings(); + + if( !m_miscOptionTab->saveSettings() ) + return false; + + return true; +} + + +void K3bOptionDialog::slotDefault() +{ + switch( activePageIndex() ) + { + case 0: // device page + + break; + case 1: // programs page + break; + default: + break; + } +} + + +void K3bOptionDialog::setupBurningPage() +{ + QFrame* frame = addPage( i18n("Advanced"), i18n("Advanced Settings"), + KGlobal::instance()->iconLoader()->loadIcon( "cdwriter_unmount", KIcon::NoGroup, KIcon::SizeMedium ) ); + + QGridLayout* _frameLayout = new QGridLayout( frame ); + _frameLayout->setSpacing( 0 ); + _frameLayout->setMargin( 0 ); + + m_burningOptionTab = new K3bBurningOptionTab( frame ); + _frameLayout->addWidget( m_burningOptionTab, 0, 0 ); +} + + +void K3bOptionDialog::setupProgramsPage() +{ + QFrame* frame = addPage( i18n("Programs"), i18n("Setup External Programs"), + KGlobal::instance()->iconLoader()->loadIcon( "exec", KIcon::NoGroup, KIcon::SizeMedium ) ); + + QGridLayout* _frameLayout = new QGridLayout( frame ); + _frameLayout->setSpacing( 0 ); + _frameLayout->setMargin( 0 ); + + m_externalBinOptionTab = new K3bExternalBinOptionTab( k3bcore->externalBinManager(), frame ); + _frameLayout->addWidget( m_externalBinOptionTab, 0, 0 ); +} + + +void K3bOptionDialog::setupCddbPage() +{ + QFrame* frame = addPage( i18n("CDDB"), i18n("Setup the CDDB Server"), + KGlobal::instance()->iconLoader()->loadIcon( "connect_established", KIcon::NoGroup, KIcon::SizeMedium ) ); + + QGridLayout* mainGrid = new QGridLayout( frame ); + mainGrid->setSpacing(0); + mainGrid->setMargin(0); + // QTabWidget *_tab = new QTabWidget( frame ); + m_cddbOptionTab = new K3bCddbOptionTab( frame, "cddbremotepage"); + // m_cddbLocalTab = new K3bCddbLocalDBTab( frame, "cddblocalpage"); +// _tab->addTab( m_cddbOptionTab, i18n("Remote") ); +// _tab->addTab( m_cddbLocalTab, i18n("Local") ); + //mainGrid->addWidget( m_cddbOptionTab, 0, 0 ); + mainGrid->addWidget( m_cddbOptionTab, 0, 0 ); +} + + +void K3bOptionDialog::setupDevicePage() +{ + QFrame* frame = addPage( i18n("Devices"), i18n("Setup Devices"), + KGlobal::instance()->iconLoader()->loadIcon( "blockdevice", KIcon::NoGroup, KIcon::SizeMedium ) ); + + QHBoxLayout* box = new QHBoxLayout( frame ); + box->setSpacing(0); + box->setMargin(0); + m_deviceOptionTab = new K3bDeviceOptionTab( frame, "deviceOptionTab" ); + box->addWidget( m_deviceOptionTab ); +} + + +void K3bOptionDialog::setupMiscPage() +{ + QFrame* frame = addPage( i18n("Misc"), i18n("Miscellaneous Settings"), + KGlobal::instance()->iconLoader()->loadIcon( "misc", KIcon::NoGroup, KIcon::SizeMedium ) ); + + QVBoxLayout* box = new QVBoxLayout( frame ); + box->setSpacing( 0 ); + box->setMargin( 0 ); + + m_miscOptionTab = new K3bMiscOptionTab( frame ); + box->addWidget( m_miscOptionTab ); +} + + +void K3bOptionDialog::setupNotifyPage() +{ + QFrame* frame = addPage( i18n("Notifications"), i18n("System Notifications"), + KGlobal::instance()->iconLoader()->loadIcon( "knotify", + KIcon::NoGroup, KIcon::SizeMedium ) ); + QVBoxLayout* box = new QVBoxLayout( frame ); + box->setSpacing( 0 ); + box->setMargin( 0 ); + + m_notifyOptionTab = new K3bNotifyOptionTab( frame ); + box->addWidget( m_notifyOptionTab ); +} + + +void K3bOptionDialog::setupPluginPage() +{ + QFrame* frame = addPage( i18n("Plugins"), i18n("K3b Plugin Configuration"), + KGlobal::instance()->iconLoader()->loadIcon( "gear", + KIcon::NoGroup, KIcon::SizeMedium ) ); + QVBoxLayout* box = new QVBoxLayout( frame ); + box->setSpacing( 0 ); + box->setMargin( 0 ); + + m_pluginOptionTab = new K3bPluginOptionTab( frame ); + box->addWidget( m_pluginOptionTab ); +} + + +void K3bOptionDialog::setupThemePage() +{ + QFrame* frame = addPage( i18n("Themes"), i18n("K3b GUI Themes"), + KGlobal::instance()->iconLoader()->loadIcon( "style", + KIcon::NoGroup, KIcon::SizeMedium ) ); + QVBoxLayout* box = new QVBoxLayout( frame ); + box->setSpacing( 0 ); + box->setMargin( 0 ); + + m_themeOptionTab = new K3bThemeOptionTab( frame ); + box->addWidget( m_themeOptionTab ); +} + + +// void K3bOptionDialog::addOptionPage( QWidget* widget, +// const QString& name, +// const QString& header, +// const QPixmap& icon ) +// { +// QFrame* frame = addPage( name, header, icon ); + +// QVBoxLayout* box = new QVBoxLayout( frame ); +// box->setSpacing( 0 ); +// box->setMargin( 0 ); + +// widget->reparent( frame ); +// box->addWidget( widget ); +// } + + +#include "k3boptiondialog.moc" diff --git a/src/option/k3boptiondialog.h b/src/option/k3boptiondialog.h new file mode 100644 index 0000000..1f417b6 --- /dev/null +++ b/src/option/k3boptiondialog.h @@ -0,0 +1,91 @@ +/* + * + * $Id$ + * 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 K3BOPTIONDIALOG_H +#define K3BOPTIONDIALOG_H + +#include <kdialogbase.h> + +class K3bCddbOptionTab; +class K3bDeviceOptionTab; +class K3bBurningOptionTab; +class K3bExternalBinOptionTab; +class K3bMiscOptionTab; +class K3bNotifyOptionTab; +class K3bPluginOptionTab; +class K3bThemeOptionTab; + + +/** + *@author Sebastian Trueg + */ +class K3bOptionDialog : public KDialogBase +{ + Q_OBJECT + + public: + K3bOptionDialog(QWidget *parent=0, const char *name=0, bool modal = true); + ~K3bOptionDialog(); + + enum m_configPageIndex { Burning = 0, Devices = 1, Programs = 2, Cddb = 3 }; + +/* void addOptionPage( QWidget* widget, */ +/* const QString& name, */ +/* const QString& header, */ +/* const QPixmap& icon ); */ + + protected slots: + void slotOk(); + void slotApply(); + void slotDefault(); + + private: + bool saveSettings(); + + // programs tab + K3bExternalBinOptionTab* m_externalBinOptionTab; + void setupProgramsPage(); + + // device tab + K3bDeviceOptionTab* m_deviceOptionTab; + void setupDevicePage(); + + // burning tab + void setupBurningPage(); + K3bBurningOptionTab* m_burningOptionTab; + + // cddb tabs + K3bCddbOptionTab *m_cddbOptionTab; + void setupCddbPage(); + + // misc options + K3bMiscOptionTab* m_miscOptionTab; + void setupMiscPage(); + + // notify options + K3bNotifyOptionTab* m_notifyOptionTab; + void setupNotifyPage(); + + // plugin options + K3bPluginOptionTab* m_pluginOptionTab; + void setupPluginPage(); + + // theme options + K3bThemeOptionTab* m_themeOptionTab; + void setupThemePage(); +}; + +#endif diff --git a/src/option/k3bpluginoptiontab.cpp b/src/option/k3bpluginoptiontab.cpp new file mode 100644 index 0000000..59d7b74 --- /dev/null +++ b/src/option/k3bpluginoptiontab.cpp @@ -0,0 +1,137 @@ +/* + * + * $Id: k3bpluginoptiontab.cpp 619556 2007-01-03 17:38:12Z 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. + */ + +#include "k3bpluginoptiontab.h" + + +#include <k3bpluginmanager.h> +#include <k3bplugin.h> +#include <k3bpluginconfigwidget.h> +#include <k3blistview.h> +#include <k3bcore.h> + +#include <klocale.h> +#include <kmessagebox.h> +#include <kdebug.h> +#include <kdialogbase.h> +#include <kconfig.h> +#include <kglobalsettings.h> +#include <kdeversion.h> + +#include <qstringlist.h> +#include <qpushbutton.h> + + +class K3bPluginOptionTab::PluginViewItem : public K3bListViewItem +{ +public: + PluginViewItem( K3bPlugin* p, KListViewItem* parent ) + : K3bListViewItem( parent ), + plugin(p) { + const K3bPluginInfo& info = p->pluginInfo(); + setText( 0, info.name() ); + if( !info.author().isEmpty() ) { + if( info.email().isEmpty() ) + setText( 1, info.author() ); + else + setText( 1, info.author() + " <" + info.email() + ">" ); + } + setText( 2, info.version() ); + setText( 3, info.comment() ); + setText( 4, info.licence() ); + } + + K3bPlugin* plugin; +}; + + + +K3bPluginOptionTab::K3bPluginOptionTab( QWidget* parent, const char* name ) + : base_K3bPluginOptionTab( parent, name ) +{ +#if KDE_IS_VERSION(3,4,0) + m_viewPlugins->setShadeSortColumn( false ); +#endif + m_viewPlugins->addColumn( i18n("Name") ); + m_viewPlugins->addColumn( i18n("Author") ); + m_viewPlugins->addColumn( i18n("Version") ); + m_viewPlugins->addColumn( i18n("Description") ); + m_viewPlugins->addColumn( i18n("License") ); + m_viewPlugins->setAlternateBackground( QColor() ); + m_viewPlugins->setAllColumnsShowFocus(true); + + connect( m_viewPlugins, SIGNAL(doubleClicked(QListViewItem*, const QPoint&, int)), this, SLOT(slotConfigureButtonClicked()) ); + connect( m_buttonConfigure, SIGNAL(clicked()), this, SLOT(slotConfigureButtonClicked()) ); + connect( m_viewPlugins, SIGNAL(selectionChanged()), this, SLOT(slotSelectionChanged()) ); +} + + +K3bPluginOptionTab::~K3bPluginOptionTab() +{ +} + + +void K3bPluginOptionTab::readSettings() +{ + m_viewPlugins->clear(); + QStringList groups = k3bcore->pluginManager()->groups(); + for( QStringList::const_iterator it = groups.begin(); + it != groups.end(); ++it ) { + const QString& group = *it; + + K3bListViewItem* groupViewItem = new K3bListViewItem( m_viewPlugins, + m_viewPlugins->lastChild(), + group ); + QFont f( font() ); + f.setBold(true); + groupViewItem->setFont( 0, f ); + groupViewItem->setBackgroundColor( 0, KGlobalSettings::alternateBackgroundColor() ); + groupViewItem->setBackgroundColor( 1, KGlobalSettings::alternateBackgroundColor() ); + groupViewItem->setBackgroundColor( 2, KGlobalSettings::alternateBackgroundColor() ); + groupViewItem->setBackgroundColor( 3, KGlobalSettings::alternateBackgroundColor() ); + groupViewItem->setBackgroundColor( 4, KGlobalSettings::alternateBackgroundColor() ); + groupViewItem->setSelectable( false ); + + QPtrList<K3bPlugin> fl = k3bcore->pluginManager()->plugins( group ); + for( QPtrListIterator<K3bPlugin> fit( fl ); fit.current(); ++fit ) + (void)new PluginViewItem( fit.current(), groupViewItem ); + + groupViewItem->setOpen(true); + } + + slotSelectionChanged(); +} + + +bool K3bPluginOptionTab::saveSettings() +{ + return true; +} + + +void K3bPluginOptionTab::slotConfigureButtonClicked() +{ + QListViewItem* item = m_viewPlugins->selectedItem(); + if( PluginViewItem* pi = dynamic_cast<PluginViewItem*>( item ) ) + k3bcore->pluginManager()->execPluginDialog( pi->plugin, this ); +} + + +void K3bPluginOptionTab::slotSelectionChanged() +{ + m_buttonConfigure->setEnabled( dynamic_cast<PluginViewItem*>( m_viewPlugins->selectedItem() ) != 0 ); +} + +#include "k3bpluginoptiontab.moc" diff --git a/src/option/k3bpluginoptiontab.h b/src/option/k3bpluginoptiontab.h new file mode 100644 index 0000000..1fb1821 --- /dev/null +++ b/src/option/k3bpluginoptiontab.h @@ -0,0 +1,43 @@ +/* + * + * $Id: k3bpluginoptiontab.h 619556 2007-01-03 17:38:12Z 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 _K3B_PLUGIN_OPTION_TAB_H_ +#define _K3B_PLUGIN_OPTION_TAB_H_ + +#include "base_k3bpluginoptiontab.h" + + + +class K3bPluginOptionTab : public base_K3bPluginOptionTab +{ + Q_OBJECT + + public: + K3bPluginOptionTab( QWidget* parent = 0, const char* name = 0 ); + ~K3bPluginOptionTab(); + + public slots: + void readSettings(); + bool saveSettings(); + + private slots: + void slotConfigureButtonClicked(); + void slotSelectionChanged(); + + private: + class PluginViewItem; +}; + +#endif diff --git a/src/option/k3bthemeoptiontab.cpp b/src/option/k3bthemeoptiontab.cpp new file mode 100644 index 0000000..4fd3f61 --- /dev/null +++ b/src/option/k3bthemeoptiontab.cpp @@ -0,0 +1,234 @@ +/* + * + * $Id: k3bthemeoptiontab.cpp 642063 2007-03-13 09:40:13Z 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. + */ + + +#include "k3bthemeoptiontab.h" + +#include "k3bthememanager.h" + +#include <k3bapplication.h> +#include <klocale.h> +#include <kconfig.h> +#include <kmessagebox.h> +#include <kurlrequester.h> +#include <klistview.h> +#include <kio/global.h> +#include <kio/netaccess.h> +#include <kio/job.h> +#include <kstandarddirs.h> +#include <ktar.h> +#include <kurlrequesterdlg.h> +#include <kdeversion.h> + +#include <qlabel.h> +#include <qfile.h> +#include <qfileinfo.h> + + +class K3bThemeOptionTab::Private +{ +public: +}; + + +class ThemeViewItem : public KListViewItem +{ +public: + ThemeViewItem( K3bTheme* theme_, QListView* parent, QListViewItem* after ) + : KListViewItem( parent, after ), + theme(theme_) { + setText( 0, theme->name() ); + setText( 1, theme->author() ); + setText( 2, theme->version() ); + setText( 3, theme->comment() ); + } + + K3bTheme* theme; +}; + +K3bThemeOptionTab::K3bThemeOptionTab(QWidget *parent, const char *name ) + : base_K3bThemeOptionTab(parent,name) +{ + d = new Private(); + +#if KDE_IS_VERSION(3,4,0) + m_viewTheme->setShadeSortColumn( false ); +#endif + + connect( m_viewTheme, SIGNAL(selectionChanged()), + this, SLOT(selectionChanged()) ); + connect( kapp, SIGNAL(appearanceChanged()), + this, SLOT(selectionChanged()) ); + connect( m_buttonInstallTheme, SIGNAL(clicked()), + this, SLOT(slotInstallTheme()) ); + connect( m_buttonRemoveTheme, SIGNAL(clicked()), + this, SLOT(slotRemoveTheme()) ); +} + + +K3bThemeOptionTab::~K3bThemeOptionTab() +{ + delete d; +} + + +void K3bThemeOptionTab::readSettings() +{ + m_viewTheme->clear(); + + k3bappcore->themeManager()->loadThemes(); + + QValueList<K3bTheme*> themes = k3bappcore->themeManager()->themes(); + for( QValueList<K3bTheme*>::const_iterator it = themes.constBegin(); it != themes.constEnd(); ++it ) { + K3bTheme* theme = *it; + ThemeViewItem* item = new ThemeViewItem( theme, m_viewTheme, m_viewTheme->lastItem() ); + if( theme == k3bappcore->themeManager()->currentTheme() ) + m_viewTheme->setSelected( item, true ); + } +} + + +bool K3bThemeOptionTab::saveSettings() +{ + ThemeViewItem* item = (ThemeViewItem*)m_viewTheme->selectedItem(); + if( item ) + k3bappcore->themeManager()->setCurrentTheme( item->theme ); + + return true; +} + + +void K3bThemeOptionTab::selectionChanged() +{ + ThemeViewItem* item = (ThemeViewItem*)m_viewTheme->selectedItem(); + if( item ) { + m_centerPreviewLabel->setText( i18n("K3b - The CD/DVD Kreator") ); + m_centerPreviewLabel->setPaletteBackgroundColor( item->theme->backgroundColor() ); + m_centerPreviewLabel->setPaletteForegroundColor( item->theme->foregroundColor() ); + m_leftPreviewLabel->setPaletteBackgroundColor( item->theme->backgroundColor() ); + m_leftPreviewLabel->setPaletteForegroundColor( item->theme->foregroundColor() ); + m_rightPreviewLabel->setPaletteBackgroundColor( item->theme->backgroundColor() ); + m_rightPreviewLabel->setPaletteForegroundColor( item->theme->foregroundColor() ); + m_leftPreviewLabel->setPixmap( item->theme->pixmap( K3bTheme::PROJECT_LEFT ) ); + m_rightPreviewLabel->setPixmap( item->theme->pixmap( K3bTheme::PROJECT_RIGHT ) ); + + m_buttonRemoveTheme->setEnabled( item->theme->local() ); + } +} + + +void K3bThemeOptionTab::slotInstallTheme() +{ + KURL themeURL = KURLRequesterDlg::getURL( QString::null, this, + i18n("Drag or Type Theme URL") ); + + if( themeURL.url().isEmpty() ) + return; + + QString themeTmpFile; + // themeTmpFile contains the name of the downloaded file + + if( !KIO::NetAccess::download( themeURL, themeTmpFile, this ) ) { + QString sorryText; + if (themeURL.isLocalFile()) + sorryText = i18n("Unable to find the icon theme archive %1."); + else + sorryText = i18n("Unable to download the icon theme archive.\n" + "Please check that address %1 is correct."); + KMessageBox::sorry( this, sorryText.arg(themeURL.prettyURL()) ); + return; + } + + // check if the archive contains a dir with a k3b.theme file + QString themeName; + KTar archive( themeTmpFile ); + archive.open(IO_ReadOnly); + const KArchiveDirectory* themeDir = archive.directory(); + QStringList entries = themeDir->entries(); + bool validThemeArchive = false; + if( entries.count() > 0 ) { + if( themeDir->entry(entries.first())->isDirectory() ) { + const KArchiveDirectory* subDir = dynamic_cast<const KArchiveDirectory*>( themeDir->entry(entries.first()) ); + themeName = subDir->name(); + if( subDir && subDir->entry( "k3b.theme" ) ) { + validThemeArchive = true; + + // check for all nessessary pixmaps (this is a little evil hacking) + for( int i = 0; i <= K3bTheme::WELCOME_BG; ++i ) { + if( !subDir->entry( K3bTheme::filenameForPixmapType( (K3bTheme::PixmapType)i ) ) ) { + validThemeArchive = false; + break; + } + } + } + } + } + + if( !validThemeArchive ) { + KMessageBox::error( this, i18n("The file is not a valid K3b theme archive.") ); + } + else { + QString themeBasePath = locateLocal( "data", "k3b/pics/" ); + + // check if there already is a theme by that name + if( !QFile::exists( themeBasePath + '/' + themeName ) || + KMessageBox::warningYesNo( this, + i18n("A theme with the name '%1' already exists. Do you want to " + "overwrite it?"), + i18n("Theme exists"), + i18n("Overwrite"), + i18n("Cancel") ) == KMessageBox::Yes ) { + // install the theme + archive.directory()->copyTo( themeBasePath ); + } + } + + archive.close(); + KIO::NetAccess::removeTempFile(themeTmpFile); + + readSettings(); +} + + +void K3bThemeOptionTab::slotRemoveTheme() +{ + ThemeViewItem* item = (ThemeViewItem*)m_viewTheme->selectedItem(); + if( item ) { + QString question=i18n("<qt>Are you sure you want to remove the " + "<strong>%1</strong> icon theme?<br>" + "<br>" + "This will delete the files installed by this theme.</qt>"). + arg(item->text(0)); + + if( KMessageBox::warningContinueCancel( this, question, i18n("Delete") ) != KMessageBox::Continue ) + return; + + K3bTheme* theme = item->theme; + delete item; + QString path = theme->path(); + + // delete k3b.theme file to avoid it to get loaded + QFile::remove( path + "/k3b.theme" ); + + // reread the themes (this will also set the default theme in case we delete the + // selected one) + readSettings(); + + // delete the theme data itself + KIO::del( path, false, false ); + } +} + +#include "k3bthemeoptiontab.moc" diff --git a/src/option/k3bthemeoptiontab.h b/src/option/k3bthemeoptiontab.h new file mode 100644 index 0000000..bfb1d72 --- /dev/null +++ b/src/option/k3bthemeoptiontab.h @@ -0,0 +1,47 @@ +/* + * + * $Id: k3bthemeoptiontab.h 619556 2007-01-03 17:38:12Z 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 _K3BTHEMEOPTIONTAB_H_ +#define _K3BTHEMEOPTIONTAB_H_ + +#include "base_k3bthemeoptiontab.h" + + +/** + *@author Sebastian Trueg + */ +class K3bThemeOptionTab : public base_K3bThemeOptionTab +{ + Q_OBJECT + + public: + K3bThemeOptionTab( QWidget* parent = 0, const char* name = 0 ); + ~K3bThemeOptionTab(); + + void readSettings(); + bool saveSettings(); + + private slots: + void selectionChanged(); + void slotInstallTheme(); + void slotRemoveTheme(); + + private: + class Private; + Private* d; +}; + +#endif |