diff options
38 files changed, 741 insertions, 780 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 40130e63..25c4d84d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,7 +67,7 @@ option( WITH_MUSICBRAINZ "Enable MusicBrainz support (juk)" OFF ) option( WITH_TAGLIB "Enable taglib support (juk, tdefile-plugins)" ${WITH_ALL_OPTIONS} ) option( WITH_THEORA "Enable Ogg/Theora support (tdefile-plugins)" ${WITH_ALL_OPTIONS} ) option( WITH_VORBIS "Enable Ogg/Vorbis support (krec, mpeglib, oggarts, tdefile-plugins)" ${WITH_ALL_OPTIONS} ) - +option( WITH_KMIX_EXPERIMENTAL "Enable experimental/unmaintained KMix features" OFF ) ##### user requested modules #################### @@ -141,6 +141,11 @@ if( BUILD_KAUDIOCREATOR ) add_subdirectory( kaudiocreator ) endif( BUILD_KAUDIOCREATOR ) tde_conditional_add_subdirectory( BUILD_KMIX kmix ) +if( WITH_KMIX_EXPERIMENTAL ) + if( NOT BUILD_KMIX ) + tde_message_fatal( "KMix experimental features requested, but KMix won't be built" ) + endif( ) +endif( WITH_KMIX_EXPERIMENTAL ) if( BUILD_KREC ) if( NOT BUILD_ARTS ) tde_message_fatal( "krec can not be built without building arts" ) diff --git a/config.h.cmake b/config.h.cmake index 812818bb..f78d86cf 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -58,3 +58,6 @@ /* xine_artsplugin */ #cmakedefine HAVE_XSHMGETEVENTBASE 1 #cmakedefine ao_new_port @ao_new_port@ + +/* kmix */ +#cmakedefine WITH_KMIX_EXPERIMENTAL 1
\ No newline at end of file diff --git a/kmix/CMakeLists.txt b/kmix/CMakeLists.txt index f719a084..c9e03ba9 100644 --- a/kmix/CMakeLists.txt +++ b/kmix/CMakeLists.txt @@ -55,6 +55,13 @@ tde_create_translated_desktop( PO_DIR kmix-desktops ) +##### experimental/unmaintained features ######## + +unset( SOURCES_EXPERIMENTAL ) +if( WITH_KMIX_EXPERIMENTAL ) + set( SOURCES_EXPERIMENTAL experimental.ui viewsurround.cpp ) +endif( WITH_KMIX_EXPERIMENTAL ) + ##### kmix_panelapplet (module) ################# @@ -65,7 +72,7 @@ tde_add_kpart( kmix_panelapplet AUTOMOC mixer_backend.cpp ksmallslider.cpp volume.cpp kledbutton.cpp verticaltext.cpp mixerIface.skel colorwidget.ui dialogviewconfiguration.cpp kmixtoolbox.cpp mixertoolbox.cpp - dialogselectmaster.cpp + dialogselectmaster.cpp kmixsettings.kcfgc LINK tdeui-shared ${ALSA_LIBRARIES} DESTINATION ${PLUGIN_INSTALL_DIR} ) @@ -75,15 +82,16 @@ tde_add_kpart( kmix_panelapplet AUTOMOC tde_add_tdeinit_executable( kmix AUTOMOC SOURCES - main.cpp kmix.cpp kmixdockwidget.cpp kmixprefdlg.cpp + main.cpp kmix.cpp kmixdockwidget.cpp viewbase.cpp viewoutput.cpp viewinput.cpp viewswitches.cpp - viewsurround.cpp viewdockareapopup.cpp viewsliders.cpp - viewgrid.cpp mixdevicewidget.cpp mdwslider.cpp + viewdockareapopup.cpp viewsliders.cpp mixdevicewidget.cpp mdwslider.cpp mdwswitch.cpp mdwenum.cpp kmixerwidget.cpp mixer.cpp mixset.cpp mixdevice.cpp mixer_backend.cpp ksmallslider.cpp volume.cpp kledbutton.cpp verticaltext.cpp mixerIface.skel kmixtoolbox.cpp mixertoolbox.cpp dialogviewconfiguration.cpp - KMixApp.cpp dialogselectmaster.cpp kmixIface.skel + KMixApp.cpp dialogselectmaster.cpp kmixIface.skel kmixsettings.kcfgc + appearanceconfig.ui behaviorconfig.ui + ${SOURCES_EXPERIMENTAL} LINK tdeui-shared ${ALSA_LIBRARIES} ) @@ -94,6 +102,6 @@ tde_add_tdeinit_executable( kmixctrl AUTOMOC SOURCES kmixctrl.cpp mixer.cpp mixset.cpp mixdevice.cpp volume.cpp mixerIface.skel mixertoolbox.cpp - mixer_backend.cpp + mixer_backend.cpp kmixsettings.kcfgc LINK tdecore-shared ${ALSA_LIBRARIES} ) diff --git a/kmix/appearanceconfig.ui b/kmix/appearanceconfig.ui new file mode 100644 index 00000000..a55f5a11 --- /dev/null +++ b/kmix/appearanceconfig.ui @@ -0,0 +1,142 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>KMixAppearanceConfig</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>KMixAppearanceConfig</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>464</width> + <height>280</height> + </rect> + </property> + <property name="caption"> + <string>Appearance</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQComboBox" row="0" column="1"> + <item> + <property name="text"> + <string>Horizontal</string> + </property> + </item> + <item> + <property name="text"> + <string>Vertical</string> + </property> + </item> + <property name="name"> + <cstring>kcfg_Orientation</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="TQLabel" row="1" column="0"> + <property name="name"> + <cstring>lblValueStyle</cstring> + </property> + <property name="text"> + <string>Volume values:</string> + </property> + </widget> + <widget class="TQLabel" row="0" column="0"> + <property name="name"> + <cstring>lblOrientation</cstring> + </property> + <property name="text"> + <string>Sliders orientation:</string> + </property> + </widget> + <widget class="TQCheckBox" row="3" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>kcfg_Tickmarks</cstring> + </property> + <property name="text"> + <string>Show &tickmarks</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="TQCheckBox" row="4" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>kcfg_Labels</cstring> + </property> + <property name="text"> + <string>Show &labels</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="TQCheckBox" row="2" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>kcfg_Menubar</cstring> + </property> + <property name="text"> + <string>Show &menu bar</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <spacer row="5" column="1"> + <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>20</width> + <height>111</height> + </size> + </property> + </spacer> + <widget class="TQComboBox" row="1" column="1"> + <item> + <property name="text"> + <string>None</string> + </property> + </item> + <item> + <property name="text"> + <string>Absolute</string> + </property> + </item> + <item> + <property name="text"> + <string>Relative</string> + </property> + </item> + <property name="name"> + <cstring>kcfg_ValueStyle</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </grid> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kmix/behaviorconfig.ui b/kmix/behaviorconfig.ui new file mode 100644 index 00000000..c448735f --- /dev/null +++ b/kmix/behaviorconfig.ui @@ -0,0 +1,157 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>KMixBehaviorConfig</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>KMixBehaviorConfig</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>659</width> + <height>345</height> + </rect> + </property> + <property name="caption"> + <string>Behavior</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>kcfg_starttdeRestore</cstring> + </property> + <property name="text"> + <string>Automatically start mixer when you &login</string> + </property> + <property name="tristate"> + <bool>true</bool> + </property> + </widget> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>kcfg_AllowDocking</cstring> + </property> + <property name="text"> + <string>Enable system &tray icon</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="TQGroupBox"> + <property name="name"> + <cstring>grpSystray</cstring> + </property> + <property name="title"> + <string>System Tray</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer row="1" column="0"> + <property name="name"> + <cstring>spacer1_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQCheckBox" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>kcfg_TrayVolumeControl</cstring> + </property> + <property name="text"> + <string>Enable system tray volume &slider</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="TQLayoutWidget" row="1" column="1"> + <property name="name"> + <cstring>layout1</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>kcfg_DockIconMuting</cstring> + </property> + <property name="text"> + <string>&Middle click on system tray icon toggles muting</string> + </property> + <property name="checked"> + <bool>false</bool> + </property> + </widget> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>kcfg_Visible</cstring> + </property> + <property name="text"> + <string>Show mixer window when starting KMix</string> + </property> + <property name="checked"> + <bool>false</bool> + </property> + </widget> + </vbox> + </widget> + </grid> + </widget> + <spacer> + <property name="name"> + <cstring>spacer3</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>161</height> + </size> + </property> + </spacer> + </vbox> +</widget> +<connections> + <connection> + <sender>kcfg_TrayVolumeControl</sender> + <signal>toggled(bool)</signal> + <receiver>kcfg_DockIconMuting</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>kcfg_TrayVolumeControl</sender> + <signal>toggled(bool)</signal> + <receiver>kcfg_Visible</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>kcfg_AllowDocking</sender> + <signal>toggled(bool)</signal> + <receiver>grpSystray</receiver> + <slot>setEnabled(bool)</slot> + </connection> +</connections> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kmix/dialogselectmaster.cpp b/kmix/dialogselectmaster.cpp index 9b568f80..b2020397 100644 --- a/kmix/dialogselectmaster.cpp +++ b/kmix/dialogselectmaster.cpp @@ -61,7 +61,7 @@ void DialogSelectMaster::createWidgets(Mixer *ptr_mixer) _layout = new TQVBoxLayout(m_mainFrame,0,-1, "_layout" ); // Default or user selected - TQButtonGroup *bgMasterSelection = new TQButtonGroup(1, Qt::Vertical, i18n("KMix master channel selection"), m_mainFrame); + TQButtonGroup *bgMasterSelection = new TQButtonGroup(1, TQt::Vertical, i18n("KMix master channel selection"), m_mainFrame); connect(bgMasterSelection, TQT_SIGNAL(clicked(int)), this, TQT_SLOT(masterSelectionChanged(int))); _layout->add(bgMasterSelection); m_defaultMaster = new TQRadioButton(i18n("Default"), bgMasterSelection); diff --git a/kmix/experimental.ui b/kmix/experimental.ui new file mode 100644 index 00000000..992e9dd4 --- /dev/null +++ b/kmix/experimental.ui @@ -0,0 +1,87 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>KMixExperimental</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>KMixExperimental</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>637</width> + <height>310</height> + </rect> + </property> + <property name="caption"> + <string>Experimental features</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>lblWarning</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>4</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>Raised</enum> + </property> + <property name="text"> + <string><p align="center"><b>WARNING!</b><br> +These are features which are experimental and/or untested.<br> +Please avoid using them in production.</p> +<p align="center">The settings here will be applied after a restart.</p></string> + </property> + </widget> + <widget class="TQGroupBox"> + <property name="name"> + <cstring>grpBox</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Exprerimental features</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>kcfg_MultiDriver</cstring> + </property> + <property name="text"> + <string>Enable multi-driver mode</string> + </property> + </widget> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>kcfg_Experimental_ViewSurround</cstring> + </property> + <property name="text"> + <string>Enable Surround View (EXPERIMENTAL)</string> + </property> + </widget> + </vbox> + </widget> + </vbox> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kmix/kledbutton.cpp b/kmix/kledbutton.cpp index 3ad3ba75..09c8c3c9 100644 --- a/kmix/kledbutton.cpp +++ b/kmix/kledbutton.cpp @@ -44,7 +44,7 @@ KLedButton::~KLedButton() void KLedButton::mousePressEvent( TQMouseEvent *e ) { - if (e->button() == Qt::LeftButton) + if (e->button() == TQt::LeftButton) { toggle(); emit stateChanged( state() ); diff --git a/kmix/kmix.cpp b/kmix/kmix.cpp index 1ac09d85..20e9c58f 100644 --- a/kmix/kmix.cpp +++ b/kmix/kmix.cpp @@ -19,11 +19,16 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + // include files for QT #include <tqmap.h> #include <tqhbox.h> #include <tqcheckbox.h> #include <tqradiobutton.h> +#include <tqpushbutton.h> #include <tqwidgetstack.h> #include <tqlayout.h> #include <tqtooltip.h> @@ -46,51 +51,51 @@ #include <tdeaccel.h> #include <kglobalaccel.h> #include <kkeydialog.h> +#include <tdeconfigdialog.h> // application specific includes #include "mixertoolbox.h" #include "kmix.h" #include "kmixerwidget.h" -#include "kmixprefdlg.h" #include "kmixdockwidget.h" #include "kmixtoolbox.h" +#include "kmixsettings.h" +#include "behaviorconfig.h" +#include "appearanceconfig.h" + +#ifdef WITH_KMIX_EXPERIMENTAL +#include "experimental.h" +#endif /** * Constructs a mixer window (KMix main window) */ KMixWindow::KMixWindow() - : DCOPObject("kmix"), TDEMainWindow(0, 0, 0, 0), m_showTicks( true ), - m_dockWidget( 0L ) + : DCOPObject("kmix"), TDEMainWindow(0, 0, 0, 0), m_dockWidget( 0L ) { m_visibilityUpdateAllowed = true; - m_multiDriverMode = false; // -<- I never-ever want the multi-drivermode to be activated by accident - m_surroundView = false; // -<- Also the experimental surround View (3D) - m_gridView = false; // -<- Also the experimental Grid View - // As long as we do not know better, we assume to start hidden. We need - // to initialize this variable here, as we don't trigger a hideEvent(). - m_isVisible = false; m_mixerWidgets.setAutoDelete(true); - loadConfig(); // Need to load config before initMixer(), due to "MultiDriver" keyword - MixerToolBox::initMixer(Mixer::mixers(), m_multiDriverMode, m_hwInfoString); + +#ifdef WITH_KMIX_EXPERIMENTAL + MixerToolBox::initMixer(Mixer::mixers(), KMixSettings::multiDriver(), m_hwInfoString); +#else + MixerToolBox::initMixer(Mixer::mixers(), false, m_hwInfoString); +#endif + + loadConfig(); initActions(); initWidgets(); initMixerWidgets(); - - initPrefDlg(); updateDocking(); - if ( m_startVisible ) + if ( KMixSettings::visible() ) { - /* Started visible: We should do probably do: - * m_isVisible = true; - * But as a showEvent() is triggered by show() we don't need it. - */ - show(); + show(); } else { - hide(); + hide(); } connect( kapp, TQT_SIGNAL( aboutToQuit()), TQT_SLOT( saveSettings()) ); } @@ -110,7 +115,7 @@ KMixWindow::initActions() // settings menu KStdAction::showMenubar( TQT_TQOBJECT(this), TQT_SLOT(toggleMenuBar()), actionCollection()); - KStdAction::preferences( TQT_TQOBJECT(this), TQT_SLOT(showSettings()), actionCollection()); + KStdAction::preferences( TQT_TQOBJECT(this), TQT_SLOT(showSettings()), actionCollection()); new TDEAction( i18n( "Configure &Global Shortcuts..." ), "configure_shortcuts", 0, TQT_TQOBJECT(this), TQT_SLOT( configureGlobalShortcuts() ), actionCollection(), "settings_global" ); KStdAction::keyBindings( guiFactory(), TQT_SLOT(configureShortcuts()), actionCollection()); @@ -131,16 +136,6 @@ KMixWindow::initActions() createGUI( "kmixui.rc" ); } - -void -KMixWindow::initPrefDlg() -{ - m_prefDlg = new KMixPrefDlg( this ); - connect( m_prefDlg, TQT_SIGNAL(signalApplied(KMixPrefDlg *)), - this, TQT_SLOT(applyPrefs(KMixPrefDlg *)) ); -} - - void KMixWindow::initWidgets() { @@ -172,7 +167,7 @@ KMixWindow::initWidgets() widgetsLayout->setStretchFactor( m_wsMixers, 10 ); widgetsLayout->addWidget( m_wsMixers ); - if ( m_showMenubar ) + if ( KMixSettings::menubar() ) menuBar()->show(); else menuBar()->hide(); @@ -191,10 +186,10 @@ KMixWindow::updateDocking() m_dockWidget = 0L; } - if (m_showDockWidget) + if ( KMixSettings::allowDocking() ) { // create dock widget - m_dockWidget = new KMixDockWidget( Mixer::mixers().first(), this, "mainDockWidget", m_volumeWidget, m_dockIconMuting ); + m_dockWidget = new KMixDockWidget( Mixer::mixers().first(), this, "mainDockWidget", KMixSettings::trayVolumeControl(), KMixSettings::dockIconMuting() ); m_dockWidget->show(); } } @@ -209,49 +204,28 @@ KMixWindow::saveSettings() void KMixWindow::saveConfig() { - TDEConfig *config = kapp->config(); - config->setGroup(0); - - // make sure we don't start without any UI - // can happen e.g. when not docked and kmix closed via 'X' button - bool startVisible = m_isVisible; - if ( !m_showDockWidget ) + // make sure we don't start without any UI (in case the tray icon is disabled) + bool startVisible = KMixSettings::visible(); + if ( !KMixSettings::allowDocking() ) + { startVisible = true; + } + + KMixSettings::setSize(size()); + KMixSettings::setPosition(pos()); + KMixSettings::setVisible(startVisible); - config->writeEntry( "Size", size() ); - config->writeEntry( "Position", pos() ); - // Cannot use isVisible() here, as in the "aboutToQuit()" case this widget is already hidden. - // (Please note that the problem was only there when quitting via Systray - esken). - config->writeEntry( "Visible", startVisible ); - config->writeEntry( "Menubar", m_showMenubar ); - config->writeEntry( "AllowDocking", m_showDockWidget ); - config->writeEntry( "TrayVolumeControl", m_volumeWidget ); - config->writeEntry( "Tickmarks", m_showTicks ); - config->writeEntry( "Labels", m_showLabels ); - config->writeEntry( "starttdeRestore", m_onLogin ); - config->writeEntry( "DockIconMuting", m_dockIconMuting ); Mixer* mixerMasterCard = Mixer::masterCard(); - if ( mixerMasterCard != 0 ) { - config->writeEntry( "MasterMixer", mixerMasterCard->id() ); + if ( mixerMasterCard != 0 ) + { + KMixSettings::setMasterMixer(mixerMasterCard->id()); } MixDevice* mdMaster = Mixer::masterCardDevice(); - if ( mdMaster != 0 ) { - config->writeEntry( "MasterMixerDevice", mdMaster->getPK() ); + if ( mdMaster != 0 ) + { + KMixSettings::setMasterMixerDevice(mdMaster->getPK()); } - if ( m_valueStyle == MixDeviceWidget::NABSOLUTE ) - config->writeEntry( "ValueStyle", "Absolute"); - else if ( m_valueStyle == MixDeviceWidget::NRELATIVE ) - config->writeEntry( "ValueStyle", "Relative"); - else - config->writeEntry( "ValueStyle", "None" ); - - if ( m_toplevelOrientation == Qt::Vertical ) - config->writeEntry( "Orientation","Vertical" ); - else - config->writeEntry( "Orientation","Horizontal" ); - config->writeEntry( "Autostart", m_autoStart ); - // save mixer widgets for ( KMixerWidget *mw = m_mixerWidgets.first(); mw != 0; mw = m_mixerWidgets.next() ) { @@ -259,72 +233,37 @@ KMixWindow::saveConfig() { // protect from unplugged devices (better do *not* save them) TQString grp; grp.sprintf( "%i", mw->id() ); - mw->saveConfig( config, grp ); + mw->saveConfig( TDESharedConfig::openConfig("kmixrc"), grp ); } } - config->setGroup(0); + KMixSettings::writeConfig(); } void KMixWindow::loadConfig() { - TDEConfig *config = kapp->config(); - config->setGroup(0); - - m_showDockWidget = config->readBoolEntry("AllowDocking", true); - m_volumeWidget = config->readBoolEntry("TrayVolumeControl", true); - //hide on close has to stay true for usability. KMixPrefDlg option commented out. nolden - m_hideOnClose = config->readBoolEntry("HideOnClose", true); - m_showTicks = config->readBoolEntry("Tickmarks", true); - m_showLabels = config->readBoolEntry("Labels", true); - const TQString& valueStyleString = config->readEntry("ValueStyle", "None"); - m_onLogin = config->readBoolEntry("starttdeRestore", true ); - m_dockIconMuting = config->readBoolEntry( "DockIconMuting", false); - m_startVisible = config->readBoolEntry("Visible", false); - m_multiDriverMode = config->readBoolEntry("MultiDriver", false); - m_surroundView = config->readBoolEntry("Experimental-ViewSurround", false ); - m_gridView = config->readBoolEntry("Experimental-ViewGrid", false ); - const TQString& orientationString = config->readEntry("Orientation", "Horizontal"); - bool useDefaultMaster = config->readBoolEntry( "UseDefaultMaster", true ); - if (!useDefaultMaster) + if (!KMixSettings::useDefaultMaster()) { - TQString mixerMasterCard = config->readEntry( "MasterMixer", "" ); - Mixer::setMasterCard(mixerMasterCard); - TQString masterDev = config->readEntry( "MasterMixerDevice", "" ); - Mixer::setMasterCardDevice(masterDev); + Mixer::setMasterCard(KMixSettings::masterMixer()); + Mixer::setMasterCardDevice(KMixSettings::masterMixerDevice()); } - if ( valueStyleString == "Absolute" ) - m_valueStyle = MixDeviceWidget::NABSOLUTE; - else if ( valueStyleString == "Relative" ) - m_valueStyle = MixDeviceWidget::NRELATIVE; - else - m_valueStyle = MixDeviceWidget::NNONE; - - if ( orientationString == "Vertical" ) - m_toplevelOrientation = Qt::Vertical; - else - m_toplevelOrientation = Qt::Horizontal; - m_autoStart = config->readBoolEntry("Autostart", true); - - // show/hide menu bar - m_showMenubar = config->readBoolEntry("Menubar", true); + m_toplevelOrientation = static_cast<TQt::Orientation>(KMixSettings::orientation()); TDEToggleAction *a = static_cast<TDEToggleAction*>(actionCollection()->action("options_show_menubar")); - if (a) a->setChecked( m_showMenubar ); + if (a) a->setChecked( KMixSettings::menubar() ); // restore window size and position if ( !kapp->isRestored() ) // done by the session manager otherwise { - TQSize defSize( minimumWidth(), height() ); - TQSize size = config->readSizeEntry("Size", &defSize ); - if(!size.isEmpty()) resize(size); - - TQPoint defPos = pos(); - TQPoint pos = config->readPointEntry("Position", &defPos); - move(pos); - } + TQSize size = KMixSettings::size(); + if(!size.isEmpty()) + { + resize(size); + } + move(KMixSettings::position()); + } } @@ -342,19 +281,23 @@ KMixWindow::initMixerWidgets() { //kdDebug(67100) << "Mixer number: " << id << " Name: " << mixer->mixerName() << endl ; ViewBase::ViewFlags vflags = ViewBase::HasMenuBar; - if ( m_showMenubar ) { + if (KMixSettings::menubar()) { vflags |= ViewBase::MenuBarVisible; } - if ( m_surroundView ) { + +#ifdef WITH_KMIX_EXPERIMENTAL + if (KMixSettings::experimental_ViewSurround()) { vflags |= ViewBase::Experimental_SurroundView; } - if ( m_gridView ) { + if (KMixSettings::experimental_ViewGrid()) { vflags |= ViewBase::Experimental_GridView; } - if ( m_toplevelOrientation == Qt::Vertical ) { +#endif + + if ( m_toplevelOrientation == TQt::Vertical ) { vflags |= ViewBase::Vertical; } - else { + else { vflags |= ViewBase::Horizontal; } @@ -369,11 +312,11 @@ KMixWindow::initMixerWidgets() TQString grp; grp.sprintf( "%i", mw->id() ); - mw->loadConfig( kapp->config(), grp ); + mw->loadConfig( TDESharedConfig::openConfig("kmixrc"), grp ); - mw->setTicks( m_showTicks ); - mw->setLabels( m_showLabels ); - mw->setValueStyle ( m_valueStyle ); + mw->setTicks(KMixSettings::tickmarks()); + mw->setLabels(KMixSettings::labels()); + mw->setValueStyle(KMixSettings::valueStyle()); // !! I am still not sure whether this works 100% reliably - chris mw->show(); } @@ -390,7 +333,7 @@ KMixWindow::initMixerWidgets() bool KMixWindow::queryClose ( ) { - if ( m_showDockWidget && !kapp->sessionSaving() ) + if ( KMixSettings::allowDocking() && !kapp->sessionSaving() ) { hide(); return false; @@ -409,25 +352,28 @@ KMixWindow::quit() void KMixWindow::showSettings() { - if (!m_prefDlg->isVisible()) + if (TDEConfigDialog::showDialog("KMixConfigDialog")) { - m_prefDlg->m_dockingChk->setChecked( m_showDockWidget ); - m_prefDlg->m_volumeChk->setChecked(m_volumeWidget); - m_prefDlg->m_showTicks->setChecked( m_showTicks ); - m_prefDlg->m_showLabels->setChecked( m_showLabels ); - m_prefDlg->m_onLogin->setChecked( m_onLogin ); - m_prefDlg->m_dockIconMuting->setChecked( m_dockIconMuting ); - m_prefDlg->_rbVertical ->setChecked( m_toplevelOrientation == Qt::Vertical ); - m_prefDlg->_rbHorizontal->setChecked( m_toplevelOrientation == Qt::Horizontal ); - m_prefDlg->_rbNone->setChecked( m_valueStyle == MixDeviceWidget::NNONE ); - m_prefDlg->_rbAbsolute->setChecked( m_valueStyle == MixDeviceWidget::NABSOLUTE ); - m_prefDlg->_rbRelative->setChecked( m_valueStyle == MixDeviceWidget::NRELATIVE ); - m_prefDlg->m_autoStartChk->setChecked( m_autoStart ); - - m_prefDlg->show(); + return; } -} + TDEConfigDialog *cfg = new TDEConfigDialog(this, "KMixConfigDialog", KMixSettings::self()); + + KMixBehaviorConfig *cfgb = new KMixBehaviorConfig(0, "Behavior"); + cfg->addPage(cfgb, i18n("Behavior"), "configure"); + + KMixAppearanceConfig *cfga = new KMixAppearanceConfig(0, "Appearance"); + cfg->addPage(cfga, i18n("Appearance"), "kmix"); + +#ifdef WITH_KMIX_EXPERIMENTAL + KMixExperimental *cfgx = new KMixExperimental(0, "Experimental"); + cfg->addPage(cfgx, i18n("Experimental"), "bug"); +#endif + + connect(cfg, TQT_SIGNAL(settingsChanged()), this, TQT_SLOT(applyPrefs())); + + cfg->show(); +} void KMixWindow::showHelp() @@ -480,60 +426,28 @@ KMixWindow::saveVolumes() void -KMixWindow::applyPrefs( KMixPrefDlg *prefDlg ) -{ - m_showDockWidget = prefDlg->m_dockingChk->isChecked(); - m_volumeWidget = prefDlg->m_volumeChk->isChecked(); - m_showTicks = prefDlg->m_showTicks->isChecked(); - m_showLabels = prefDlg->m_showLabels->isChecked(); - m_onLogin = prefDlg->m_onLogin->isChecked(); - m_dockIconMuting = prefDlg->m_dockIconMuting->isChecked(); - - if ( prefDlg->_rbNone->isChecked() ) { - m_valueStyle = MixDeviceWidget::NNONE; - } else if ( prefDlg->_rbAbsolute->isChecked() ) { - m_valueStyle = MixDeviceWidget::NABSOLUTE; - } else if ( prefDlg->_rbRelative->isChecked() ) { - m_valueStyle = MixDeviceWidget::NRELATIVE; - } - - bool toplevelOrientationHasChanged = - ( prefDlg->_rbVertical->isChecked() && m_toplevelOrientation == Qt::Horizontal ) - || ( prefDlg->_rbHorizontal->isChecked() && m_toplevelOrientation == Qt::Vertical ); - if ( toplevelOrientationHasChanged ) { +KMixWindow::applyPrefs() +{ + auto old = static_cast<TQt::Orientation>(KMixSettings::orientation()); + if (m_toplevelOrientation != old) + { TQString msg = i18n("The change of orientation will be adopted on the next start of KMix."); - KMessageBox::information(0,msg); - } - if ( prefDlg->_rbVertical->isChecked() ) { - //kdDebug(67100) << "KMix should change to Vertical layout\n"; - m_toplevelOrientation = Qt::Vertical; + KMessageBox::information(0, msg); } - else if ( prefDlg->_rbHorizontal->isChecked() ) { - //kdDebug(67100) << "KMix should change to Horizontal layout\n"; - m_toplevelOrientation = Qt::Horizontal; - } - m_autoStart = prefDlg->m_autoStartChk->isChecked(); - this->setUpdatesEnabled(false); updateDocking(); for (KMixerWidget *mw=m_mixerWidgets.first(); mw!=0; mw=m_mixerWidgets.next()) { - mw->setTicks( m_showTicks ); - mw->setLabels( m_showLabels ); - mw->setValueStyle ( m_valueStyle ); + mw->setTicks( KMixSettings::tickmarks() ); + mw->setLabels( KMixSettings::labels() ); + mw->setValueStyle( KMixSettings::valueStyle() ); mw->mixer()->readSetFromHWforceUpdate(); // needed, as updateDocking() has reconstructed the DockWidget } this->setUpdatesEnabled(true); - // avoid invisible and unaccessible main window - if( !m_showDockWidget && !isVisible() ) - { - show(); - } - this->repaint(); // make KMix look fast (saveConfig() often uses several seconds) kapp->processEvents(); saveConfig(); @@ -543,14 +457,13 @@ KMixWindow::applyPrefs( KMixPrefDlg *prefDlg ) void KMixWindow::toggleMenuBar() { - m_showMenubar = !m_showMenubar; - if( m_showMenubar ) + if( menuBar()->isShown() ) { - menuBar()->show(); + menuBar()->hide(); } else { - menuBar()->hide(); + menuBar()->show(); } } diff --git a/kmix/kmix.h b/kmix/kmix.h index c41beb65..1dbd0321 100644 --- a/kmix/kmix.h +++ b/kmix/kmix.h @@ -41,8 +41,6 @@ class TDEAccel; class TDEGlobalAccel; class KComboBox; class KMixerWidget; -class KMixerPrefWidget; -class KMixPrefDlg; class KMixDockWidget; class KMixWindow; class Mixer; @@ -88,7 +86,6 @@ KMixWindow : public TDEMainWindow, virtual public KMixIface void saveConfig(); void loadConfig(); - void initPrefDlg(); void initActions(); void initWidgets(); void initMixerWidgets(); @@ -107,7 +104,7 @@ KMixWindow : public TDEMainWindow, virtual public KMixIface void toggleMenuBar(); //void loadVolumes(); void saveVolumes(); - virtual void applyPrefs( KMixPrefDlg *prefDlg ); + virtual void applyPrefs(); void stopVisibilityUpdates(); private: @@ -117,30 +114,17 @@ KMixWindow : public TDEMainWindow, virtual public KMixIface TQPopupMenu *m_viewMenu; TQPopupMenu *m_helpMenu; - bool m_autoStart; - bool m_showDockWidget; bool m_volumeWidget; - bool m_hideOnClose; - bool m_showTicks; - bool m_dockIconMuting; - bool m_showLabels; - MixDeviceWidget::ValueStyle m_valueStyle; // No numbers by default bool m_onLogin; - bool m_startVisible; - bool m_showMenubar; bool m_isVisible; bool m_visibilityUpdateAllowed; - bool m_multiDriverMode; // Not officially supported. - bool m_surroundView; // Experimental. Off by defualt - bool m_gridView; // Experimental. Off by default - Qt::Orientation m_toplevelOrientation; + TQt::Orientation m_toplevelOrientation; TQPtrList<KMixerWidget> m_mixerWidgets; TQHBox* mixerNameLayout; KComboBox *m_cMixer; TQWidgetStack *m_wsMixers; - KMixPrefDlg *m_prefDlg; KMixDockWidget *m_dockWidget; TQString m_hwInfoString; TQVBoxLayout *widgetsLayout; diff --git a/kmix/kmix.kcfg b/kmix/kmix.kcfg new file mode 100644 index 00000000..b6d595bd --- /dev/null +++ b/kmix/kmix.kcfg @@ -0,0 +1,102 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE kcfg SYSTEM "http://www.kde.org/standards/kcfg/1.0/kcfg.dtd"> +<kcfg> + <kcfgfile name="kmixrc"/> + <group name="General"> + <entry key="AllowDocking" type="Bool"> + <default>true</default> + <label>Enable system tray icon</label> + <whatsthis>Docks the mixer into the TDE panel</whatsthis> + </entry> + <entry key="TrayVolumeControl" type="Bool"> + <default>true</default> + <label>Enable system tray volume slider</label> + <whatsthis>If enabled, clicking on the system tray icon pops up a volume indicator, otherwise it opens the mixer.</whatsthis> + </entry> + <entry key="Tickmarks" type="Bool"> + <default>true</default> + <label>Show tickmarks</label> + <whatsthis>Enable/disable tickmark scales on the sliders</whatsthis> + </entry> + <entry name="Labels" type="Bool"> + <default>true</default> + <label>Show labels</label> + <whatsthis>Enables/disables description labels above the sliders</whatsthis> + </entry> + <entry key="ValueStyle" type="Enum"> + <choices> + <choice name="None"> + <label>None</label> + </choice> + <choice name="Absolute"> + <label>Absolute</label> + </choice> + <choice name="Relative"> + <label>Relative</label> + </choice> + </choices> + <default>None</default> + <label>Volume Values</label> + <whatsthis>How volume values are displayed</whatsthis> + </entry> + <entry key="starttdeRestore" type="Bool"> + <default>true</default> + <label>Autostart</label> + <whatsthis>Automatically start mixer when you login</whatsthis> + </entry> + <entry key="DockIconMuting" type="Bool"> + <default>false</default> + <label>Middle click on system tray icon toggles muting</label> + </entry> + <entry key="Visible" type="Bool"> + <default>false</default> + <label>Show mixer window when starting KMix</label> + <whatsthis>Check this to make KMix open the mixer window on startup by default. By default this is unchecked, causing only the system tray icon to be shown on startup. Note that if both system tray icon and this option are disabled then this option is assumed to be checked (to avoid starting KMix with no GUI at all).</whatsthis> + </entry> + <entry key="Menubar" type="Bool"> + <default>true</default> + <label>Show menubar</label> + <whatsthis>Show the menu bar in the mixer window.</whatsthis> + </entry> + <entry key="MultiDriver" type="Bool"> + <default>false</default> + <label>Enable multi-driver mode</label> + <whatsthis>Try scanning all backends. By default this is unchecked, which results in the first found backend being used.</whatsthis> + </entry> + <entry key="Experimental_ViewSurround" type="Bool"> + <default>false</default> + <label>Enable Surround View (EXPERIMENTAL)</label> + </entry> + <entry key="Experimental_ViewGrid" type="Bool"> + <default>false</default> + <label>Enable Grid View (EXPERIMENTAL)</label> + </entry> + <entry key="Orientation" type="Enum"> + <choices> + <choice name="Horizontal"> + <label>Horizontal</label> + </choice> + <choice name="Vertical"> + <label>Vertical</label> + </choice> + </choices> + <default>Vertical</default> + <label>Slider Orientation</label> + </entry> + <entry key="UseDefaultMaster" type="Bool"> + <default>true</default> + </entry> + <entry key="MasterMixer" type="String"> + <default></default> + </entry> + <entry key="MasterMixerDevice" type="String"> + <default></default> + </entry> + <entry key="Size" type="Size"> + <default></default> + </entry> + <entry key="Position" type="Point"> + <default></default> + </entry> + </group> +</kcfg>
\ No newline at end of file diff --git a/kmix/kmixapplet.cpp b/kmix/kmixapplet.cpp index 0bcdd3f2..a4770993 100644 --- a/kmix/kmixapplet.cpp +++ b/kmix/kmixapplet.cpp @@ -452,7 +452,7 @@ int KMixApplet::heightForWidth(int) const { TQSizePolicy KMixApplet::sizePolicy() const { // return TQSizePolicy(TQSizePolicy::Preferred,TQSizePolicy::Preferred); - if ( orientation() == Qt::Vertical ) { + if ( orientation() == TQt::Vertical ) { //kdDebug(67100) << "KMixApplet::sizePolicy=(Ignored,Fixed)\n"; return TQSizePolicy(TQSizePolicy::Preferred, TQSizePolicy::Fixed); } diff --git a/kmix/kmixdockwidget.cpp b/kmix/kmixdockwidget.cpp index 7e08f71e..8867b40b 100644 --- a/kmix/kmixdockwidget.cpp +++ b/kmix/kmixdockwidget.cpp @@ -34,6 +34,7 @@ #include <tdelocale.h> #include <tdepopupmenu.h> #include <tdeglobalsettings.h> +#include <tdemainwindow.h> #include <tqapplication.h> #include <tqcursor.h> @@ -114,8 +115,18 @@ void KMixDockWidget::createActions() a->plug(popupMenu); } - // Help and quit popupMenu->insertSeparator(); + + // KMix Options + TDEMainWindow *toplevel = static_cast<TDEMainWindow*>(parent()); + a = toplevel->actionCollection()->action(KStdAction::name(KStdAction::Preferences)); + + if (a) + { + a->plug(popupMenu); + } + + // Help and quit popupMenu->insertItem(SmallIcon("help"), KStdGuiItem::help().text(), (new KHelpMenu(this, TDEGlobal::instance()->aboutData(), false))->menu(), false); popupMenu->insertSeparator(); a = actionCollection()->action(KStdAction::name(KStdAction::Quit)); @@ -349,7 +360,7 @@ KMixDockWidget::mousePressEvent(TQMouseEvent *me) // esken: Due to overwhelming request, LeftButton shows the ViewDockAreaPopup, if configured // to do so. Otherwise the main window will be shown. - if ( me->button() == Qt::LeftButton ) + if ( me->button() == TQt::LeftButton ) { if ( ! _volumePopup ) { // Case 1: User wants to show main window => This is the KSystemTray default action @@ -393,7 +404,7 @@ KMixDockWidget::mousePressEvent(TQMouseEvent *me) TQWidget::mousePressEvent(me); // KSystemTray's shouldn't do the default action for this return; } // LeftMouseButton pressed - else if ( me->button() == Qt::MidButton ) { + else if ( me->button() == TQt::MidButton ) { if ( ! _dockIconMuting ) { toggleActive(); } else { @@ -443,7 +454,7 @@ KMixDockWidget::wheelEvent(TQWheelEvent *e) // Mhhh, it doesn't work. TQt does not show it again. setVolumeTip(); // Simulate a mouse move to make TQt show the tooltip again - TQApplication::postEvent( this, new TQMouseEvent( TQEvent::MouseMove, TQCursor::pos(), Qt::NoButton, Qt::NoButton ) ); + TQApplication::postEvent( this, new TQMouseEvent( TQEvent::MouseMove, TQCursor::pos(), TQt::NoButton, TQt::NoButton ) ); } } diff --git a/kmix/kmixerwidget.cpp b/kmix/kmixerwidget.cpp index 94965122..e1d6a307 100644 --- a/kmix/kmixerwidget.cpp +++ b/kmix/kmixerwidget.cpp @@ -18,6 +18,7 @@ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include "../config.h" // TQt #include <tqlabel.h> @@ -42,9 +43,10 @@ #include "viewinput.h" #include "viewoutput.h" #include "viewswitches.h" -// KMix experimental -#include "viewgrid.h" + +#ifdef WITH_KMIX_EXPERIMENTAL #include "viewsurround.h" +#endif /** @@ -119,21 +121,22 @@ void KMixerWidget::createLayout(ViewBase::ViewFlags vflags) * 2c) Add Views to Tab ********************************************************************/ //KMixGUIProfile* prof = MixerToolbox::selectProfile(_mixer); - - + + possiblyAddView(new ViewOutput ( m_ioTab, "output", i18n("Output"), _mixer, vflags ) ); - possiblyAddView(new ViewInput( m_ioTab, "input", i18n("Input"), _mixer, vflags ) ); + possiblyAddView(new ViewInput ( m_ioTab, "input", i18n("Input"), _mixer, vflags ) ); possiblyAddView(new ViewSwitches( m_ioTab, "switches", i18n("Switches"), _mixer, vflags ) ); + +#ifdef WITH_KMIX_EXPERIMENTAL if ( vflags & ViewBase::Experimental_SurroundView ) possiblyAddView( new ViewSurround( m_ioTab, "surround", i18n("Surround"), _mixer, vflags ) ); - if ( vflags & ViewBase::Experimental_GridView ) - possiblyAddView( new ViewGrid( m_ioTab, "grid", i18n("Grid"), _mixer, vflags ) ); +#endif // *** Lower part: Slider and Mixer Name ************************************************ TQHBoxLayout *balanceAndDetail = new TQHBoxLayout( m_topLayout, 8, "balanceAndDetail"); // Create the left-right-slider - m_balanceSlider = new TQSlider( -100, 100, 25, 0, Qt::Horizontal, this, "RightLeft" ); + m_balanceSlider = new TQSlider( -100, 100, 25, 0, TQt::Horizontal, this, "RightLeft" ); m_balanceSlider->setTickmarks( TQSlider::Below ); m_balanceSlider->setTickInterval( 25 ); m_balanceSlider->setMinimumSize( m_balanceSlider->sizeHint() ); diff --git a/kmix/kmixprefdlg.cpp b/kmix/kmixprefdlg.cpp deleted file mode 100644 index 5489eea2..00000000 --- a/kmix/kmixprefdlg.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/* - * KMix -- KDE's full featured mini mixer - * - * - * Copyright (C) 2000 Stefan Schimanski <[email protected]> - * Copyright (C) 2001 Preston Brown <[email protected]> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include <tqbuttongroup.h> -#include <tqlayout.h> -#include <tqwhatsthis.h> -#include <tqcheckbox.h> -#include <tqlabel.h> -#include <tqradiobutton.h> - -#include <tdelocale.h> -// For "kapp" -#include <tdeapplication.h> - -#include "kmix.h" -#include "kmixprefdlg.h" -#include "kmixerwidget.h" - - -KMixPrefDlg::KMixPrefDlg( TQWidget *parent ) - : KDialogBase( Plain, i18n( "Configure" ), - Ok|Cancel|Apply, Ok, parent ) -{ - // general buttons - m_generalTab = plainPage( /* i18n("&General") */ ); - - TQBoxLayout *layout = new TQVBoxLayout( m_generalTab ); - layout->setSpacing( KDialog::spacingHint() ); - - m_dockingChk = new TQCheckBox( i18n("&Dock into panel"), m_generalTab ); - layout->addWidget( m_dockingChk ); - TQWhatsThis::add(m_dockingChk, i18n("Docks the mixer into the TDE panel")); - - m_volumeChk = new TQCheckBox(i18n("Enable system tray &volume control"), - m_generalTab); - layout->addWidget(m_volumeChk); - - m_showTicks = new TQCheckBox( i18n("Show &tickmarks"), m_generalTab ); - layout->addWidget( m_showTicks ); - TQWhatsThis::add(m_showTicks, - i18n("Enable/disable tickmark scales on the sliders")); - - m_showLabels = new TQCheckBox( i18n("Show &labels"), m_generalTab ); - layout->addWidget( m_showLabels ); - TQWhatsThis::add(m_showLabels, - i18n("Enables/disables description labels above the sliders")); - - - m_onLogin = new TQCheckBox( i18n("Restore volumes on login"), m_generalTab ); - layout->addWidget( m_onLogin ); - - m_dockIconMuting = new TQCheckBox( - i18n("Middle click on system tray icon toggles muting"), m_generalTab ); - layout->addWidget( m_dockIconMuting ); - - TQBoxLayout *numbersLayout = new TQHBoxLayout( layout ); - TQButtonGroup *numbersGroup = new TQButtonGroup( 3, Qt::Horizontal, i18n("Numbers"), m_generalTab ); - numbersGroup->setRadioButtonExclusive(true); - TQLabel* qlbl = new TQLabel( i18n("Volume Values: "), m_generalTab ); - _rbNone = new TQRadioButton( i18n("&None"), m_generalTab ); - _rbAbsolute = new TQRadioButton( i18n("A&bsolute"), m_generalTab ); - _rbRelative = new TQRadioButton( i18n("&Relative"), m_generalTab ); - numbersGroup->insert(_rbNone); - numbersGroup->insert(_rbAbsolute); - numbersGroup->insert(_rbRelative); - numbersGroup->hide(); - - numbersLayout->add(qlbl); - numbersLayout->add(_rbNone); - numbersLayout->add(_rbAbsolute); - numbersLayout->add(_rbRelative); - numbersLayout->addStretch(); - - m_autoStartChk = new TQCheckBox( i18n("&Autostart"), m_generalTab ); - layout->addWidget( m_autoStartChk ); - TQWhatsThis::add(m_autoStartChk, i18n("Automatically start mixer when you login")); - - TQBoxLayout *orientationLayout = new TQHBoxLayout( layout ); - TQButtonGroup* orientationGroup = new TQButtonGroup( 2, Qt::Horizontal, i18n("Orientation"), m_generalTab ); - //orientationLayout->add(orientationGroup); - orientationGroup->setRadioButtonExclusive(true); - TQLabel* qlb = new TQLabel( i18n("Slider Orientation: "), m_generalTab ); - _rbHorizontal = new TQRadioButton(i18n("&Horizontal"), m_generalTab ); - _rbVertical = new TQRadioButton(i18n("&Vertical" ), m_generalTab ); - orientationGroup->insert(_rbHorizontal); - orientationGroup->insert(_rbVertical); - orientationGroup->hide(); - //orientationLayout->add(qlb); - //orientationLayout->add(orientationGroup); - - orientationLayout->add(qlb); - orientationLayout->add(_rbHorizontal); - orientationLayout->add(_rbVertical); - - orientationLayout->addStretch(); - layout->addStretch(); - enableButtonSeparator(true); - - connect( this, TQT_SIGNAL(applyClicked()), this, TQT_SLOT(apply()) ); - connect( this, TQT_SIGNAL(okClicked()), this, TQT_SLOT(apply()) ); -} - -KMixPrefDlg::~KMixPrefDlg() -{ -} - -void KMixPrefDlg::apply() -{ - // disabling buttons => users sees that we are working - enableButtonOK(false); - enableButtonCancel(false); - enableButtonApply(false); - kapp->processEvents(); - emit signalApplied( this ); - // re-enable (in case of "Apply") - enableButtonOK(true); - enableButtonCancel(true); - enableButtonApply(true); -} - -#include "kmixprefdlg.moc" diff --git a/kmix/kmixprefdlg.h b/kmix/kmixprefdlg.h deleted file mode 100644 index 1df314aa..00000000 --- a/kmix/kmixprefdlg.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * KMix -- KDE's full featured mini mixer - * - * - * Copyright (C) 2000 Stefan Schimanski <[email protected]> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef KPREFDLG_H -#define KPREFDLG_H - -#include <kdialogbase.h> - -class KMixPrefWidget; -class KMixApp; -class TQCheckBox; -class TQRadioButton; - -class -KMixPrefDlg : public KDialogBase -{ - Q_OBJECT - - - friend class KMixWindow; - - public: - KMixPrefDlg( TQWidget *parent ); - ~KMixPrefDlg(); - - signals: - void signalApplied( KMixPrefDlg *prefDlg ); - - private slots: - void apply(); - - private: - TQFrame *m_generalTab; - KMixApp *m_mixApp; - KMixPrefWidget *m_mixPrefTab; - - TQCheckBox *m_autoStartChk; - TQCheckBox *m_dockingChk; - TQCheckBox *m_volumeChk; - TQCheckBox *m_hideOnCloseChk; - TQCheckBox *m_showTicks; - TQCheckBox *m_showLabels; - TQCheckBox *m_onLogin; - TQCheckBox *m_dockIconMuting; - TQRadioButton *_rbVertical; - TQRadioButton *_rbHorizontal; - TQRadioButton *_rbNone; - TQRadioButton *_rbAbsolute; - TQRadioButton *_rbRelative; -}; - -#endif diff --git a/kmix/kmixsettings.kcfgc b/kmix/kmixsettings.kcfgc new file mode 100644 index 00000000..07597da8 --- /dev/null +++ b/kmix/kmixsettings.kcfgc @@ -0,0 +1,6 @@ +File=kmix.kcfg +Singleton=true +ClassName=KMixSettings +Mutators=true +Visibility=KDE_EXPORT +SetUserTexts=true
\ No newline at end of file diff --git a/kmix/ksmallslider.cpp b/kmix/ksmallslider.cpp index 5a67a8b6..fd151717 100644 --- a/kmix/ksmallslider.cpp +++ b/kmix/ksmallslider.cpp @@ -37,19 +37,19 @@ static const TQColor backColor2 = "#000000"; */ KSmallSlider::KSmallSlider( TQWidget *parent, const char *name ) - : TQWidget( parent, name ), _orientation( Qt::Vertical ) + : TQWidget( parent, name ), _orientation( TQt::Vertical ) { init(); } -KSmallSlider::KSmallSlider( Qt::Orientation orientation, TQWidget *parent, const char *name ) +KSmallSlider::KSmallSlider( TQt::Orientation orientation, TQWidget *parent, const char *name ) : TQWidget( parent, name ), _orientation( orientation ) { init(); } KSmallSlider::KSmallSlider( int minValue, int maxValue, int pageStep, - int value, Qt::Orientation orientation, + int value, TQt::Orientation orientation, TQWidget *parent, const char *name ) : TQWidget( parent, name ), TQRangeControl( minValue, maxValue, 1, pageStep, value ), _orientation( orientation) @@ -91,7 +91,7 @@ int KSmallSlider::positionFromValue( int v ) const int KSmallSlider::valueFromPosition( int p ) const { - if ( _orientation == Qt::Vertical ) { + if ( _orientation == TQt::Vertical ) { // Coordiante System starts at TopLeft, but the slider values increase from Bottom to Top // Thus "revert" the position int avail = available(); @@ -140,7 +140,7 @@ void KSmallSlider::resizeEvent( TQResizeEvent * ) int KSmallSlider::available() const { int available = 0; - if ( _orientation == Qt::Vertical) { + if ( _orientation == TQt::Vertical) { available = height(); } else { @@ -231,7 +231,7 @@ void KSmallSlider::paintEvent( TQPaintEvent * ) // ------------------------ draw lower/left part ---------------------------------------- if ( width()>2 && height()>2 ) { - if ( _orientation == Qt::Horizontal ) { + if ( _orientation == TQt::Horizontal ) { TQRect outer = TQRect( 1, 1, sliderPos, height() - 2 ); // kdDebug(67100) << "KSmallSlider::paintEvent: outer = " << outer << endl; @@ -264,7 +264,7 @@ void KSmallSlider::paintEvent( TQPaintEvent * ) // -------- draw upper/right part -------------------------------------------------- TQRect inner; - if ( _orientation == Qt::Vertical ) { + if ( _orientation == TQt::Vertical ) { inner = TQRect( 1, 1, width() - 2, height() - 2 -sliderPos ); } else { @@ -286,7 +286,7 @@ void KSmallSlider::mousePressEvent( TQMouseEvent *e ) { //resetState(); - if ( e->button() == Qt::RightButton ) { + if ( e->button() == TQt::RightButton ) { return; } @@ -387,7 +387,7 @@ void KSmallSlider::subtractStep() int KSmallSlider::goodPart( const TQPoint &p ) const { - if ( _orientation == Qt::Vertical ) { + if ( _orientation == TQt::Vertical ) { return p.y() - 1; } else { @@ -402,7 +402,7 @@ TQSize KSmallSlider::sizeHint() const const int length = 25; const int thick = 10; - if ( _orientation == Qt::Vertical ) + if ( _orientation == TQt::Vertical ) return TQSize( thick, length ); else return TQSize( length, thick ); @@ -419,7 +419,7 @@ TQSize KSmallSlider::minimumSizeHint() const TQSizePolicy KSmallSlider::sizePolicy() const { - if ( _orientation == Qt::Vertical ) { + if ( _orientation == TQt::Vertical ) { //kdDebug(67100) << "KSmallSlider::sizePolicy() vertical value=(Fixed,MinimumExpanding)\n"; return TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Expanding ); } diff --git a/kmix/ksmallslider.h b/kmix/ksmallslider.h index e2949ab3..e0074d50 100644 --- a/kmix/ksmallslider.h +++ b/kmix/ksmallslider.h @@ -35,9 +35,9 @@ class KSmallSlider : public TQWidget, public TQRangeControl public: KSmallSlider( TQWidget *parent, const char *name=0 ); - KSmallSlider( Qt::Orientation, TQWidget *parent, const char *name=0 ); + KSmallSlider( TQt::Orientation, TQWidget *parent, const char *name=0 ); KSmallSlider( int minValue, int maxValue, int pageStep, int value, - Qt::Orientation, TQWidget *parent, const char *name=0 ); + TQt::Orientation, TQWidget *parent, const char *name=0 ); //virtual void setTracking( bool enable ); //bool tracking() const; @@ -104,7 +104,7 @@ public slots: //State state; //bool track; bool grayed; - Qt::Orientation _orientation; + TQt::Orientation _orientation; TQColor colHigh, colLow, colBack; TQColor grayHigh, grayLow, grayBack; diff --git a/kmix/main.cpp b/kmix/main.cpp index 16074aee..1860cf43 100644 --- a/kmix/main.cpp +++ b/kmix/main.cpp @@ -41,10 +41,10 @@ extern "C" KDE_EXPORT int kdemain(int argc, char *argv[]) { TDEAboutData aboutData( "kmix", I18N_NOOP("KMix"), APP_VERSION, description, TDEAboutData::License_GPL, - I18N_NOOP("(c) 1996-2000 Christian Esken\n(c) 2000-2003 Christian Esken, Stefan Schimanski\n(c) 2002-2005 Christian Esken, Helio Chissini de Castro")); + I18N_NOOP("(c) 1996-2000 Christian Esken\n(c) 2000-2003 Christian Esken, Stefan Schimanski\n(c) 2002-2005 Christian Esken, Helio Chissini de Castro\n (c) 2010-2022 The Trinity Desktop project")); - aboutData.addAuthor("Christian Esken", "Current maintainer", "[email protected]"); - aboutData.addAuthor("Helio Chissini de Castro", I18N_NOOP("Current redesign and co-maintainer, Alsa 0.9x port"), "[email protected]" ); + aboutData.addAuthor("Christian Esken", "Previous maintainer", "[email protected]"); + aboutData.addAuthor("Helio Chissini de Castro", I18N_NOOP("Redesign and previous co-maintainer, Alsa 0.9x port"), "[email protected]" ); aboutData.addAuthor("Stefan Schimanski", 0, "[email protected]"); aboutData.addAuthor("Sven Leiber", 0, "[email protected]"); aboutData.addAuthor("Brian Hanson", I18N_NOOP("Solaris port"), "[email protected]"); diff --git a/kmix/mdwenum.cpp b/kmix/mdwenum.cpp index 708000f2..04500df7 100644 --- a/kmix/mdwenum.cpp +++ b/kmix/mdwenum.cpp @@ -45,7 +45,7 @@ * The orientation (horizontal, vertical) is ignored */ MDWEnum::MDWEnum(Mixer *mixer, MixDevice* md, - Qt::Orientation orientation, + TQt::Orientation orientation, TQWidget* parent, ViewBase* mw, const char* name) : MixDeviceWidget(mixer,md,false,orientation,parent,mw,name), _label(0), _enumCombo(0), _layout(0) @@ -73,7 +73,7 @@ MDWEnum::~MDWEnum() void MDWEnum::createWidgets() { - if ( _orientation == Qt::Vertical ) { + if ( _orientation == TQt::Vertical ) { _layout = new TQVBoxLayout( this ); _layout->setAlignment(TQt::AlignHCenter); } @@ -195,7 +195,7 @@ bool MDWEnum::eventFilter( TQObject* obj, TQEvent* e ) { if (e->type() == TQEvent::MouseButtonPress) { TQMouseEvent *qme = TQT_TQMOUSEEVENT(e); - if (qme->button() == Qt::RightButton) { + if (qme->button() == TQt::RightButton) { showContextMenu(); return true; } diff --git a/kmix/mdwenum.h b/kmix/mdwenum.h index 34018729..eb681441 100644 --- a/kmix/mdwenum.h +++ b/kmix/mdwenum.h @@ -45,7 +45,7 @@ class MDWEnum : public MixDeviceWidget public: MDWEnum( Mixer *mixer, MixDevice* md, - Qt::Orientation orientation, + TQt::Orientation orientation, TQWidget* parent = 0, ViewBase* mw = 0, const char* name = 0); ~MDWEnum(); diff --git a/kmix/mdwslider.cpp b/kmix/mdwslider.cpp index 6b4c3f51..6170992a 100644 --- a/kmix/mdwslider.cpp +++ b/kmix/mdwslider.cpp @@ -57,7 +57,7 @@ */ MDWSlider::MDWSlider(Mixer *mixer, MixDevice* md, bool showMuteLED, bool showRecordLED, - bool small, Qt::Orientation orientation, + bool small, TQt::Orientation orientation, TQWidget* parent, ViewBase* mw, const char* name) : MixDeviceWidget(mixer,md,small,orientation,parent,mw,name), m_linked(true), m_valueStyle( NNONE), m_iconLabel( 0 ), m_muteLED( 0 ), m_recordLED( 0 ), m_label( 0 ), _layout(0) @@ -96,7 +96,7 @@ MDWSlider::MDWSlider(Mixer *mixer, MixDevice* md, TQSizePolicy MDWSlider::sizePolicy() const { - if ( _orientation == Qt::Vertical ) { + if ( _orientation == TQt::Vertical ) { return TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Expanding ); } else { @@ -113,18 +113,17 @@ TQSizePolicy MDWSlider::sizePolicy() const */ void MDWSlider::createWidgets( bool showMuteLED, bool showRecordLED ) { - if ( _orientation == Qt::Vertical ) { - _layout = new TQVBoxLayout( this ); - _layout->setAlignment(TQt::AlignCenter); + if ( _orientation == TQt::Vertical ) { + _layout = new TQVBoxLayout( this ); } else { - _layout = new TQHBoxLayout( this ); - _layout->setAlignment(TQt::AlignCenter); + _layout = new TQHBoxLayout( this ); } + _layout->setAlignment(TQt::AlignCenter); // -- MAIN SLIDERS LAYOUT --- TQBoxLayout *slidersLayout; - if ( _orientation == Qt::Vertical ) { + if ( _orientation == TQt::Vertical ) { slidersLayout = new TQHBoxLayout( _layout ); slidersLayout->setAlignment(TQt::AlignVCenter); } @@ -136,14 +135,14 @@ void MDWSlider::createWidgets( bool showMuteLED, bool showRecordLED ) /* cesken: This is inconsistent. Why should vertical and horizontal layout differ? * Also it eats too much space - especially when you don't show sliders at all. * Even more on the vertical panel applet (see Bug #97667) - if ( _orientation == Qt::Horizontal ) + if ( _orientation == TQt::Horizontal ) slidersLayout->addSpacing( 10 ); */ // -- LABEL LAYOUT TO POSITION TQBoxLayout *labelLayout; - if ( _orientation == Qt::Vertical ) { + if ( _orientation == TQt::Vertical ) { labelLayout = new TQVBoxLayout( slidersLayout ); labelLayout->setAlignment(TQt::AlignHCenter); } @@ -151,7 +150,7 @@ void MDWSlider::createWidgets( bool showMuteLED, bool showRecordLED ) labelLayout = new TQHBoxLayout( slidersLayout ); labelLayout->setAlignment(TQt::AlignVCenter); } - if ( _orientation == Qt::Vertical ) { + if ( _orientation == TQt::Vertical ) { m_label = new VerticalText( this, m_mixdevice->name().utf8().data() ); TQToolTip::add( m_label, m_mixdevice->name() ); @@ -166,7 +165,7 @@ void MDWSlider::createWidgets( bool showMuteLED, bool showRecordLED ) /* This addSpacing() looks VERY bizarre => removing it (cesken, 21.2.2006). Also horizontal and vertical spacing differs. This doesn't look sensible. - if ( _orientation == Qt::Horizontal ) + if ( _orientation == TQt::Horizontal ) labelLayout->addSpacing( 36 ); */ labelLayout->addWidget( m_label ); @@ -174,14 +173,14 @@ void MDWSlider::createWidgets( bool showMuteLED, bool showRecordLED ) /* This addSpacing() looks VERY bizarre => removing it (cesken, 21.2.2006) Also horizontal and vertical spacing differs. This doesn't look sensible. - if ( _orientation == Qt::Vertical ) { + if ( _orientation == TQt::Vertical ) { labelLayout->addSpacing( 18 ); } */ // -- SLIDERS, LEDS AND ICON TQBoxLayout *sliLayout; - if ( _orientation == Qt::Vertical ) { + if ( _orientation == TQt::Vertical ) { sliLayout = new TQVBoxLayout( slidersLayout ); sliLayout->setAlignment(TQt::AlignHCenter); } @@ -192,7 +191,7 @@ void MDWSlider::createWidgets( bool showMuteLED, bool showRecordLED ) // --- ICON ---------------------------- TQBoxLayout *iconLayout; - if ( _orientation == Qt::Vertical ) { + if ( _orientation == TQt::Vertical ) { iconLayout = new TQHBoxLayout( sliLayout ); iconLayout->setAlignment(TQt::AlignVCenter); } @@ -214,7 +213,7 @@ void MDWSlider::createWidgets( bool showMuteLED, bool showRecordLED ) // --- MUTE LED if ( showMuteLED ) { TQBoxLayout *ledlayout; - if ( _orientation == Qt::Vertical ) { + if ( _orientation == TQt::Vertical ) { ledlayout = new TQHBoxLayout( sliLayout ); ledlayout->setAlignment(TQt::AlignVCenter); } @@ -251,7 +250,7 @@ void MDWSlider::createWidgets( bool showMuteLED, bool showRecordLED ) // --- SLIDERS --------------------------- TQBoxLayout *volLayout; - if ( _orientation == Qt::Vertical ) { + if ( _orientation == TQt::Vertical ) { volLayout = new TQHBoxLayout( sliLayout ); volLayout->setAlignment(TQt::AlignVCenter); } @@ -271,7 +270,7 @@ void MDWSlider::createWidgets( bool showMuteLED, bool showRecordLED ) int maxvol = m_mixdevice->getVolume().maxVolume(); int minvol = m_mixdevice->getVolume().minVolume(); - if ( _orientation == Qt::Vertical ) { + if ( _orientation == TQt::Vertical ) { slinumLayout = new TQVBoxLayout( volLayout ); slinumLayout->setAlignment(TQt::AlignHCenter); } @@ -328,7 +327,7 @@ void MDWSlider::createWidgets( bool showMuteLED, bool showRecordLED ) // --- LED LAYOUT TO CENTER --- TQBoxLayout *reclayout; - if ( _orientation == Qt::Vertical ) { + if ( _orientation == TQt::Vertical ) { reclayout = new TQHBoxLayout( sliLayout ); reclayout->setAlignment(TQt::AlignVCenter); } @@ -651,7 +650,7 @@ void MDWSlider::volumeChange( int ) else { TQSlider *slider = dynamic_cast<TQSlider *>(m_sliders.first()); if (slider) { - if ( _orientation == Qt::Vertical ) + if ( _orientation == TQt::Vertical ) sliderValue= slider->maxValue() - slider->value(); else sliderValue= slider->value(); @@ -691,7 +690,7 @@ void MDWSlider::volumeChange( int ) { TQSlider *bigSlider = dynamic_cast<TQSlider *>(slider); if (bigSlider) - if ( _orientation == Qt::Vertical ) + if ( _orientation == TQt::Vertical ) vol.setVolume( chid, bigSlider->maxValue() - bigSlider->value() ); else vol.setVolume( chid, bigSlider->value() ); @@ -808,7 +807,7 @@ void MDWSlider::update() // show the top of both volumes, and not strangely low down // the main volume by half - if ( _orientation == Qt::Vertical ) + if ( _orientation == TQt::Vertical ) bigSlider->setValue( vol.maxVolume() - vol.getTopStereoVolume( Volume::MMAIN ) ); else bigSlider->setValue( vol.getTopStereoVolume( Volume::MMAIN ) ); @@ -844,7 +843,7 @@ void MDWSlider::update() { TQSlider *bigSlider = dynamic_cast<TQSlider *>(slider); if (bigSlider) - if ( _orientation == Qt::Vertical ) { + if ( _orientation == TQt::Vertical ) { bigSlider->setValue( vol.maxVolume() - vol[i] ); } else { @@ -936,7 +935,7 @@ bool MDWSlider::eventFilter( TQObject* obj, TQEvent* e ) { if (e->type() == TQEvent::MouseButtonPress) { TQMouseEvent *qme = TQT_TQMOUSEEVENT(e); - if (qme->button() == Qt::RightButton) { + if (qme->button() == TQt::RightButton) { showContextMenu(); return true; } diff --git a/kmix/mdwslider.h b/kmix/mdwslider.h index 374cc28e..0a6e8b56 100644 --- a/kmix/mdwslider.h +++ b/kmix/mdwslider.h @@ -60,7 +60,7 @@ class MDWSlider : public MixDeviceWidget public: MDWSlider( Mixer *mixer, MixDevice* md, bool showMuteLED, bool showRecordLED, - bool small, Qt::Orientation, + bool small, TQt::Orientation, TQWidget* parent = 0, ViewBase* mw = 0, const char* name = 0); ~MDWSlider() {} diff --git a/kmix/mdwswitch.cpp b/kmix/mdwswitch.cpp index 94acf747..9a59028e 100644 --- a/kmix/mdwswitch.cpp +++ b/kmix/mdwswitch.cpp @@ -46,7 +46,7 @@ * be "small" (uses KSmallSlider instead of TQSlider then). */ MDWSwitch::MDWSwitch(Mixer *mixer, MixDevice* md, - bool small, Qt::Orientation orientation, + bool small, TQt::Orientation orientation, TQWidget* parent, ViewBase* mw, const char* name) : MixDeviceWidget(mixer,md,small,orientation,parent,mw,name), _label(0) , _labelV(0) , _switchLED(0), _layout(0) @@ -77,7 +77,7 @@ MDWSwitch::~MDWSwitch() void MDWSwitch::createWidgets() { - if ( _orientation == Qt::Vertical ) { + if ( _orientation == TQt::Vertical ) { _layout = new TQVBoxLayout( this ); _layout->setAlignment(TQt::AlignHCenter); } @@ -90,7 +90,7 @@ void MDWSwitch::createWidgets() _layout->addSpacing( 4 ); // --- LEDS -------------------------- - if ( _orientation == Qt::Vertical ) { + if ( _orientation == TQt::Vertical ) { if( m_mixdevice->isRecordable() ) _switchLED = new KLedButton( TQt::red, m_mixdevice->isRecSource()?KLed::On:KLed::Off, @@ -220,7 +220,7 @@ bool MDWSwitch::eventFilter( TQObject* obj, TQEvent* e ) { if (e->type() == TQEvent::MouseButtonPress) { TQMouseEvent *qme = TQT_TQMOUSEEVENT(e); - if (qme->button() == Qt::RightButton) { + if (qme->button() == TQt::RightButton) { showContextMenu(); return true; } diff --git a/kmix/mdwswitch.h b/kmix/mdwswitch.h index 1a4f4cf9..fafe043d 100644 --- a/kmix/mdwswitch.h +++ b/kmix/mdwswitch.h @@ -55,7 +55,7 @@ class MDWSwitch : public MixDeviceWidget public: MDWSwitch( Mixer *mixer, MixDevice* md, - bool small, Qt::Orientation orientation, + bool small, TQt::Orientation orientation, TQWidget* parent = 0, ViewBase* mw = 0, const char* name = 0); ~MDWSwitch(); diff --git a/kmix/mixdevicewidget.cpp b/kmix/mixdevicewidget.cpp index d6bf2ff1..6c8fbc1e 100644 --- a/kmix/mixdevicewidget.cpp +++ b/kmix/mixdevicewidget.cpp @@ -53,7 +53,7 @@ * be "small" (uses KSmallSlider instead of TQSlider then). */ MixDeviceWidget::MixDeviceWidget(Mixer *mixer, MixDevice* md, - bool small, Qt::Orientation orientation, + bool small, TQt::Orientation orientation, TQWidget* parent, ViewBase* mw, const char* name) : TQWidget( parent, name ), m_mixer(mixer), m_mixdevice( md ), m_mixerwidget( mw ), m_disabled( false ), _orientation( orientation ), m_small( small ) diff --git a/kmix/mixdevicewidget.h b/kmix/mixdevicewidget.h index 1ee0d8d3..9021e9d8 100644 --- a/kmix/mixdevicewidget.h +++ b/kmix/mixdevicewidget.h @@ -59,7 +59,7 @@ public: enum ValueStyle { NNONE = 0, NABSOLUTE = 1, NRELATIVE = 2 } ; MixDeviceWidget( Mixer *mixer, MixDevice* md, - bool small, Qt::Orientation orientation, + bool small, TQt::Orientation orientation, TQWidget* parent = 0, ViewBase* mw = 0, const char* name = 0); ~MixDeviceWidget(); @@ -105,7 +105,7 @@ protected: TDEGlobalAccel* m_keys; ViewBase* m_mixerwidget; bool m_disabled; - Qt::Orientation _orientation; + TQt::Orientation _orientation; bool m_small; private: diff --git a/kmix/viewapplet.cpp b/kmix/viewapplet.cpp index 87020b95..4bebfdbc 100644 --- a/kmix/viewapplet.cpp +++ b/kmix/viewapplet.cpp @@ -47,14 +47,14 @@ ViewApplet::ViewApplet(TQWidget* parent, const char* name, Mixer* mixer, ViewBas if ( position == KPanelApplet::pLeft || position == KPanelApplet::pRight ) { //kdDebug(67100) << "ViewApplet() isVertical" << "\n"; - _viewOrientation = Qt::Vertical; + _viewOrientation = TQt::Vertical; } else { //kdDebug(67100) << "ViewApplet() isHorizontal" << "\n"; - _viewOrientation = Qt::Horizontal; + _viewOrientation = TQt::Horizontal; } - if ( _viewOrientation == Qt::Horizontal ) { + if ( _viewOrientation == TQt::Horizontal ) { _layoutMDW = new TQHBoxLayout( this ); setSizePolicy(TQSizePolicy::Fixed, TQSizePolicy::Preferred); } @@ -104,11 +104,11 @@ TQWidget* ViewApplet::add(MixDevice *md) Slider orientation is exactly the other way round. If the applet stretches horzontally, the sliders must be vertical */ - Qt::Orientation sliderOrientation; - if (_viewOrientation == Qt::Horizontal ) - sliderOrientation = Qt::Vertical; + TQt::Orientation sliderOrientation; + if (_viewOrientation == TQt::Horizontal ) + sliderOrientation = TQt::Vertical; else - sliderOrientation = Qt::Horizontal; + sliderOrientation = TQt::Horizontal; // kdDebug(67100) << "ViewApplet::add()\n"; MixDeviceWidget *mdw = @@ -147,7 +147,7 @@ TQSize ViewApplet::sizeHint() const { } TQSizePolicy ViewApplet::sizePolicy() const { - if ( _viewOrientation == Qt::Horizontal ) { + if ( _viewOrientation == TQt::Horizontal ) { //kdDebug(67100) << "ViewApplet::sizePolicy=(Fixed,Expanding)\n"; return TQSizePolicy(TQSizePolicy::Fixed, TQSizePolicy::Expanding); } @@ -159,7 +159,7 @@ TQSizePolicy ViewApplet::sizePolicy() const { bool ViewApplet::shouldShowIcons(TQSize qsz) { bool showIcons = false; - if ( _viewOrientation == Qt::Horizontal ) { + if ( _viewOrientation == TQt::Horizontal ) { if ( qsz.height() >= 32 ) { //kdDebug(67100) << "ViewApplet::resizeEvent() hor >=32" << qre->size() << "\n"; showIcons = true; diff --git a/kmix/viewapplet.h b/kmix/viewapplet.h index a5e32611..fc788582 100644 --- a/kmix/viewapplet.h +++ b/kmix/viewapplet.h @@ -41,7 +41,7 @@ private: // Position of the applet (pLeft, pRight, pTop, pBottom) //KPanelApplet::Position _KMIXposition; // Orientation of the applet (horizontal or vertical) - Qt::Orientation _viewOrientation; + TQt::Orientation _viewOrientation; }; #endif diff --git a/kmix/viewdockareapopup.cpp b/kmix/viewdockareapopup.cpp index e9cd9155..21b5d8d9 100644 --- a/kmix/viewdockareapopup.cpp +++ b/kmix/viewdockareapopup.cpp @@ -127,7 +127,7 @@ TQWidget* ViewDockAreaPopup::add(MixDevice *md) true, // Show Mute LED false, // Show Record LED false, // Small - Qt::Vertical, // Direction: only 1 device, so doesn't matter + TQt::Vertical, // Direction: only 1 device, so doesn't matter _frame, // parent 0, // Is "NULL", so that there is no RMB-popup _dockDevice->name().local8Bit()); diff --git a/kmix/viewgrid.cpp b/kmix/viewgrid.cpp deleted file mode 100644 index e6aa2045..00000000 --- a/kmix/viewgrid.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/* - * KMix -- KDE's full featured mini mixer - * - * - * Copyright (C) 1996-2004 Christian Esken <[email protected]> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "viewgrid.h" - -// TQt -#include <tqwidget.h> - -// KDE -#include <kdebug.h> - -// KMix -#include "mdwenum.h" -#include "mdwslider.h" -#include "mdwswitch.h" -#include "mixer.h" - -/** - */ -ViewGrid::ViewGrid(TQWidget* parent, const char* name, const TQString & caption, Mixer* mixer, ViewBase::ViewFlags vflags) - : ViewBase(parent, name, caption, mixer, WStyle_Customize|WStyle_NoBorder, vflags) -{ - m_spacingHorizontal = 5; - m_spacingVertical = 5; - - if ( _vflags & ViewBase::Vertical ) { - //_layoutMDW = new TQVBoxLayout(this); - } - else { - //_layoutMDW = new TQHBoxLayout(this); - } - init(); -} - -ViewGrid::~ViewGrid() { -} - -void ViewGrid::setMixSet(MixSet *mixset) -{ - MixDevice* md; - int testCounter = 0; - for ( md = mixset->first(); md != 0; md = mixset->next() ) { - if (testCounter<8) { - _mixSet->append(md); - } - testCounter++; - } -} - -int ViewGrid::count() -{ - return ( _mixSet->count() ); -} - -int ViewGrid::advice() { - if ( _mixSet->count() > 0 ) { - // The standard input and output views are always advised, if there are devices in it - return 100; - } - else { - return 0; - } -} - -TQWidget* ViewGrid::add(MixDevice *md) -{ - MixDeviceWidget *mdw = 0; - if ( md->isEnum() ) { - Qt::Orientation orientation = (_vflags & ViewBase::Vertical) ? Qt::Horizontal : Qt::Vertical; - mdw = new MDWEnum( - _mixer, // the mixer for this device - md, // MixDevice (parameter) - orientation, // Orientation - this, // parent - this, // View widget - md->name().latin1() - ); - } // an enum - else if (md->isSwitch()) { - Qt::Orientation orientation = (_vflags & ViewBase::Vertical) ? Qt::Horizontal : Qt::Vertical; - mdw = - new MDWSwitch( - _mixer, // the mixer for this device - md, // MixDevice (parameter) - false, // Small - orientation, // Orientation - this, // parent - this, // View widget - md->name().latin1() - ); - } // a switch - - else { // must be a slider - Qt::Orientation orientation = (_vflags & ViewBase::Vertical) ? Qt::Horizontal : Qt::Vertical; - mdw = - new MDWSlider( - _mixer, // the mixer for this device - md, // MixDevice (parameter) - true, // Show Mute LED - true, // Show Record LED - false, // Small - orientation, // Orientation - this, // parent - this, // View widget - md->name().latin1() - ); - } - return mdw; -} - -TQSize ViewGrid::sizeHint() const { - // kdDebug(67100) << "ViewGrid::sizeHint(): NewSize is " << _layoutMDW->sizeHint() << "\n"; - return( m_sizeHint); -} - -void ViewGrid::constructionFinished() { - //_layoutMDW->activate(); - - // do a manual layout - configurationUpdate(); -} - -void ViewGrid::refreshVolumeLevels() { - // kdDebug(67100) << "ViewGrid::refreshVolumeLevels()\n"; - - m_sizeHint.setWidth (0); - m_sizeHint.setHeight(0); - - m_testingX = 0; - m_testingY = 0; - - TQWidget *mdw = _mdws.first(); - MixDevice* md; - for ( md = _mixSet->first(); md != 0; md = _mixSet->next() ) { - if ( mdw == 0 ) { - kdError(67100) << "ViewGrid::refreshVolumeLevels(): mdw == 0\n"; - break; // sanity check (normally the lists are set up correctly) - } - else { - if ( mdw->inherits("MDWSlider")) { - //kdDebug(67100) << "ViewGrid::refreshVolumeLevels(): updating\n"; - // a slider, fine. Lets update its value - static_cast<MDWSlider*>(mdw)->update(); - } - else if ( mdw->inherits("MDWSwitch")) { - //kdDebug(67100) << "ViewGrid::refreshVolumeLevels(): updating\n"; - // a slider, fine. Lets update its value - static_cast<MDWSwitch*>(mdw)->update(); - } - else if ( mdw->inherits("MDWEnum")) { - static_cast<MDWEnum*>(mdw)->update(); - } - else { - kdError(67100) << "ViewGrid::refreshVolumeLevels(): mdw is unknown/unsupported type\n"; - // no slider. Cannot happen in theory => skip it - } - } - mdw = _mdws.next(); - } -} - -/** - This implementation makes sure the Grid's geometry is updated - after hiding/showing channels. -*/ -void ViewGrid::configurationUpdate() { - m_sizeHint.setWidth (0); - m_sizeHint.setHeight(0); - - m_testingX = 0; - m_testingY = 0; - - for (TQWidget *qw = _mdws.first(); qw !=0; qw = _mdws.next() ) { - - if ( qw->inherits("MixDeviceWidget")) { - MixDeviceWidget* mdw = static_cast<MixDeviceWidget*>(qw); - int xPos = m_testingX * m_spacingHorizontal; - int yPos = m_testingY * m_spacingVertical ; - mdw->move( xPos, yPos ); - mdw->resize( mdw->sizeHint() ); - int xMax = xPos + mdw->width() ; if ( xMax > m_sizeHint.width() ) m_sizeHint.setWidth(xMax); - int yMax = yPos + mdw->height(); if ( yMax > m_sizeHint.height() ) m_sizeHint.setHeight(yMax); - - m_testingX += 5; - if ( m_testingX > 50 ) { - m_testingY += 10; - m_testingX = 0; - } - } // inherits MixDeviceWidget - } // for all MDW's -} - - -#include "viewgrid.moc" diff --git a/kmix/viewgrid.h b/kmix/viewgrid.h deleted file mode 100644 index d9883ef6..00000000 --- a/kmix/viewgrid.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef ViewGrid_h -#define ViewGrid_h - -class TQBoxLayout; -#include "tqsize.h" -class TQWidget; - -class Mixer; -#include "viewbase.h" - -class ViewGrid : public ViewBase -{ - Q_OBJECT - -public: - ViewGrid(TQWidget* parent, const char* name, const TQString & caption, Mixer* mixer, ViewBase::ViewFlags vflags); - ~ViewGrid(); - - virtual int count(); - virtual int advice(); - virtual void setMixSet(MixSet *mixset); - virtual TQWidget* add(MixDevice *mdw); - virtual void configurationUpdate(); - virtual void constructionFinished(); - - TQSize sizeHint() const; - -public slots: - virtual void refreshVolumeLevels(); - -private: - unsigned int m_spacingHorizontal; - unsigned int m_spacingVertical; - - // m_maxX and m_maxY are the highest coordiantes encountered - TQSize m_sizeHint; - - unsigned int m_testingX; - unsigned int m_testingY; -}; - -#endif - diff --git a/kmix/viewsliders.cpp b/kmix/viewsliders.cpp index b36f7c2f..fcd6e423 100644 --- a/kmix/viewsliders.cpp +++ b/kmix/viewsliders.cpp @@ -41,10 +41,10 @@ ViewSliders::ViewSliders(TQWidget* parent, const char* name, const TQString & ca : ViewBase(parent, name, caption, mixer, WStyle_Customize|WStyle_NoBorder, vflags) { if ( _vflags & ViewBase::Vertical ) { - _layoutMDW = new TQVBoxLayout(this); + _layoutMDW = new TQHBoxLayout(this); } else { - _layoutMDW = new TQHBoxLayout(this); + _layoutMDW = new TQVBoxLayout(this); } /* * Do not call init(). Call init() only for "end usage" classes. @@ -85,7 +85,7 @@ int ViewSliders::advice() { TQWidget* ViewSliders::add(MixDevice *md) { - Qt::Orientation orientation = (_vflags & ViewBase::Vertical) ? Qt::Horizontal : Qt::Vertical; + TQt::Orientation orientation = (_vflags & ViewBase::Vertical) ? TQt::Vertical : TQt::Horizontal; MixDeviceWidget *mdw = new MDWSlider( _mixer, // the mixer for this device diff --git a/kmix/viewsurround.cpp b/kmix/viewsurround.cpp index 27cc1635..a7ab291c 100644 --- a/kmix/viewsurround.cpp +++ b/kmix/viewsurround.cpp @@ -102,7 +102,7 @@ int ViewSurround::advice() { TQWidget* ViewSurround::add(MixDevice *md) { bool small = false; - Qt::Orientation orientation = Qt::Vertical; + TQt::Orientation orientation = TQt::Vertical; switch ( md->type() ) { case MixDevice::VOLUME: _mdSurroundFront = md; @@ -113,22 +113,22 @@ TQWidget* ViewSurround::add(MixDevice *md) small = true; break; case MixDevice::SURROUND_LFE: - orientation = Qt::Horizontal; + orientation = TQt::Horizontal; small = true; break; case MixDevice::SURROUND_CENTERFRONT: - orientation = Qt::Horizontal; + orientation = TQt::Horizontal; small = true; break; case MixDevice::SURROUND_CENTERBACK: - orientation = Qt::Horizontal; + orientation = TQt::Horizontal; small = true; break; default: small = false; // these are the sliders on the left side of the surround View - orientation = (_vflags & ViewBase::Vertical) ? Qt::Horizontal : Qt::Vertical; + orientation = (_vflags & ViewBase::Vertical) ? TQt::Horizontal : TQt::Vertical; } // switch(type) MixDeviceWidget *mdw = createMDW(md, small, orientation); @@ -183,7 +183,7 @@ void ViewSurround::constructionFinished() { _layoutSurround->addWidget(personLabel ,rowOfSpeaker, 2, TQt::AlignHCenter | TQt::AlignVCenter); if ( _mdSurroundFront != 0 ) { - MixDeviceWidget *mdw = createMDW(_mdSurroundFront, true, Qt::Vertical); + MixDeviceWidget *mdw = createMDW(_mdSurroundFront, true, TQt::Vertical); _layoutSurround->addWidget(mdw,0,4, TQt::AlignBottom | TQt::AlignRight); _mdws.append(mdw); @@ -200,7 +200,7 @@ void ViewSurround::constructionFinished() { } if ( _mdSurroundBack != 0 ) { - MixDeviceWidget *mdw = createMDW(_mdSurroundBack, true, Qt::Vertical); + MixDeviceWidget *mdw = createMDW(_mdSurroundBack, true, TQt::Vertical); _layoutSurround->addWidget(mdw,2,4, TQt::AlignTop | TQt::AlignRight); _mdws.append(mdw); @@ -251,7 +251,7 @@ void ViewSurround::refreshVolumeLevels() { } -MixDeviceWidget* ViewSurround::createMDW(MixDevice *md, bool small, Qt::Orientation orientation) +MixDeviceWidget* ViewSurround::createMDW(MixDevice *md, bool small, TQt::Orientation orientation) { MixDeviceWidget* mdw = new MDWSlider( _mixer, // the mixer for this device diff --git a/kmix/viewsurround.h b/kmix/viewsurround.h index 32903f6b..1feebd89 100644 --- a/kmix/viewsurround.h +++ b/kmix/viewsurround.h @@ -30,7 +30,7 @@ public slots: virtual void refreshVolumeLevels(); private: - MixDeviceWidget* createMDW(MixDevice *md, bool small, Qt::Orientation orientation); + MixDeviceWidget* createMDW(MixDevice *md, bool small, TQt::Orientation orientation); MixDevice *_mdSurroundFront; MixDevice *_mdSurroundBack; diff --git a/kmix/viewswitches.cpp b/kmix/viewswitches.cpp index 06b346e5..be364d55 100644 --- a/kmix/viewswitches.cpp +++ b/kmix/viewswitches.cpp @@ -36,19 +36,22 @@ ViewSwitches::ViewSwitches(TQWidget* parent, const char* name, const TQString & { // Create switch buttonGroup if ( _vflags & ViewBase::Vertical ) { - _layoutMDW = new TQVBoxLayout(this); - _layoutSwitch = new TQVBoxLayout(_layoutMDW); + _layoutMDW = new TQHBoxLayout(this); + _layoutSwitch = new TQHBoxLayout(_layoutMDW); _layoutEnum = new TQVBoxLayout(_layoutMDW); // always vertical! } else { - _layoutMDW = new TQHBoxLayout(this); - _layoutSwitch = new TQHBoxLayout(_layoutMDW); + _layoutMDW = new TQVBoxLayout(this); + _layoutSwitch = new TQVBoxLayout(_layoutMDW); // Place enums right from the switches: This is done, so that there will be no // ugly space on the left side, when no Switch is shown. // Actually it is not really clear yet, why there is empty space at all: There are 0 items in // the _layoutEnum, so it might be a sizeHint() or some other subtle layout issue. _layoutEnum = new TQVBoxLayout(_layoutMDW); - } + } + _layoutSwitch->setSpacing(10); + _layoutEnum->setSpacing(10); + _layoutMDW->setMargin(10); init(); } @@ -88,7 +91,7 @@ TQWidget* ViewSwitches::add(MixDevice *md) MixDeviceWidget *mdw; if ( md->isEnum() ) { - Qt::Orientation orientation = (_vflags & ViewBase::Vertical) ? Qt::Horizontal : Qt::Vertical; + TQt::Orientation orientation = (_vflags & ViewBase::Vertical) ? TQt::Vertical : TQt::Horizontal; mdw = new MDWEnum( _mixer, // the mixer for this device md, // MixDevice (parameter) @@ -101,7 +104,7 @@ TQWidget* ViewSwitches::add(MixDevice *md) } // an enum else { // must be a switch - Qt::Orientation orientation = (_vflags & ViewBase::Vertical) ? Qt::Horizontal : Qt::Vertical; + TQt::Orientation orientation = (_vflags & ViewBase::Vertical) ? TQt::Vertical : TQt::Horizontal; mdw = new MDWSwitch( _mixer, // the mixer for this device @@ -124,6 +127,9 @@ TQSize ViewSwitches::sizeHint() const { } void ViewSwitches::constructionFinished() { + if (_vflags & ViewBase::Horizontal) { + static_cast<TQBoxLayout*>(_layoutMDW)->addStretch(); + } configurationUpdate(); // also does _layoutMDW->activate(); } diff --git a/kmix/viewswitches.h b/kmix/viewswitches.h index cf0d8360..8370014e 100644 --- a/kmix/viewswitches.h +++ b/kmix/viewswitches.h @@ -10,7 +10,7 @@ class Mixer; class ViewSwitches : public ViewBase { Q_OBJECT - + public: ViewSwitches(TQWidget* parent, const char* name, const TQString & caption, Mixer* mixer, ViewBase::ViewFlags vflags); ~ViewSwitches(); |