diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-06-03 18:49:38 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-06-03 18:49:38 +0900 |
commit | 65c258e955c049db6fb04782cc3e8aa69828daa0 (patch) | |
tree | fbfc3485d82e60bcb37aa4e48eb13fe74922c03b | |
parent | a810b668d20442a866d09634e33dbd050b888456 (diff) | |
download | tdemultimedia-65c258e955c049db6fb04782cc3e8aa69828daa0.tar.gz tdemultimedia-65c258e955c049db6fb04782cc3e8aa69828daa0.zip |
KMix: added mixer selection entry to sound mixer applet's popup menu.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
-rw-r--r-- | kmix/kmix.cpp | 1 | ||||
-rw-r--r-- | kmix/kmixapplet.cpp | 6 | ||||
-rw-r--r-- | kmix/viewbase.cpp | 41 | ||||
-rw-r--r-- | kmix/viewbase.h | 2 |
4 files changed, 38 insertions, 12 deletions
diff --git a/kmix/kmix.cpp b/kmix/kmix.cpp index f00db82a..1ac09d85 100644 --- a/kmix/kmix.cpp +++ b/kmix/kmix.cpp @@ -46,7 +46,6 @@ #include <tdeaccel.h> #include <kglobalaccel.h> #include <kkeydialog.h> -#include <tdepopupmenu.h> // application specific includes #include "mixertoolbox.h" diff --git a/kmix/kmixapplet.cpp b/kmix/kmixapplet.cpp index 23c3768f..0bcdd3f2 100644 --- a/kmix/kmixapplet.cpp +++ b/kmix/kmixapplet.cpp @@ -32,7 +32,7 @@ #include <tqpushbutton.h> #include <tqradiobutton.h> #include <tqwmatrix.h> - +#include <tqtooltip.h> // KDE #include <tdeaboutapplication.h> @@ -206,6 +206,7 @@ KMixApplet::KMixApplet( const TQString& configFile, Type t, // We do NOT know which mixer to use => ask the User m_errorLabel = new TQPushButton( i18n("Select Mixer"), this ); m_errorLabel->setGeometry(0, 0, m_errorLabel->sizeHint().width(), m_errorLabel->sizeHint().height() ); + TQToolTip::add(m_errorLabel, "Select one of the available mixers"); resize( m_errorLabel->sizeHint() ); connect( m_errorLabel, TQT_SIGNAL(clicked()), this, TQT_SLOT(selectMixer()) ); } @@ -287,6 +288,7 @@ void KMixApplet::loadConfig( TDEConfig *config, const TQString &grp ) if ( m_mixerWidget ) { //config->setGroup( grp ); KMixToolBox::loadConfig(m_mixerWidget->_mdws, config, grp, "PanelApplet" ); + connect(m_mixerWidget, TQT_SIGNAL(selectMixer()), this, TQT_SLOT(selectMixer())); } } @@ -322,7 +324,7 @@ void KMixApplet::selectMixer() bool ok = FALSE; TQString res = KInputDialog::getItem( i18n("Mixers"), i18n("Available mixers:"), - lst, 1, FALSE, &ok, this ); + lst, 0, FALSE, &ok, this ); if ( ok ) { Mixer *mixer = Mixer::mixers().at( lst.findIndex( res ) ); diff --git a/kmix/viewbase.cpp b/kmix/viewbase.cpp index 11bb06a8..86d1524c 100644 --- a/kmix/viewbase.cpp +++ b/kmix/viewbase.cpp @@ -60,6 +60,7 @@ ViewBase::ViewBase(TQWidget* parent, const char* name, const TQString & caption, } } new TDEAction(i18n("&Channels"), 0, TQT_TQOBJECT(this), TQT_SLOT(configureView()), _actions, "toggle_channels"); + new TDEAction(i18n("&Select Mixer"), 0, TQT_TQOBJECT(this), TQT_SLOT(selectMixerSlot()), _actions, "select_mixer"); connect ( _mixer, TQT_SIGNAL(newVolumeLevels()), this, TQT_SLOT(refreshVolumeLevels()) ); } @@ -129,15 +130,28 @@ TDEPopupMenu* ViewBase::getPopup() void ViewBase::popupReset() { TDEAction *a; - _popMenu = new TDEPopupMenu( this ); - _popMenu->insertTitle( SmallIcon( "kmix" ), i18n("Device Settings") ); + TDEAction *smb = _actions->action( "options_show_menubar" ); + + if (!smb && Mixer::mixers().count() > 1) + { + _popMenu->insertTitle( SmallIcon( "kmix" ), i18n("General") ); + a = _actions->action( "select_mixer" ); + a->plug(_popMenu); + } + + _popMenu->insertTitle( SmallIcon( "kmix" ), i18n("Device Settings") ); a = _actions->action( "toggle_channels" ); - if ( a ) a->plug( _popMenu ); + if (a) + { + a->plug(_popMenu); + } - a = _actions->action( "options_show_menubar" ); - if ( a ) a->plug( _popMenu ); + if (smb) + { + smb->plug(_popMenu); + } } @@ -161,7 +175,8 @@ void ViewBase::refreshVolumeLevels() // is virtual } -Mixer* ViewBase::getMixer() { +Mixer* ViewBase::getMixer() +{ return _mixer; } @@ -169,19 +184,27 @@ Mixer* ViewBase::getMixer() { * Open the View configuration dialog. The user can select which channels he wants * to see and which not. */ -void ViewBase::configureView() { - +void ViewBase::configureView() +{ DialogViewConfiguration* dvc = new DialogViewConfiguration(0, *this); dvc->show(); // !! The dialog is modal. Does it delete itself? } -void ViewBase::toggleMenuBarSlot() { +void ViewBase::toggleMenuBarSlot() +{ //kdDebug(67100) << "ViewBase::toggleMenuBarSlot() start\n"; emit toggleMenuBar(); //kdDebug(67100) << "ViewBase::toggleMenuBarSlot() done\n"; } +void ViewBase::selectMixerSlot() +{ + //kdDebug(67100) << "ViewBase::selectMixerSlot() start\n"; + emit selectMixer(); + //kdDebug(67100) << "ViewBase::selectMixerSlot() done\n"; +} + // ---------- Popup stuff END --------------------- #include "viewbase.moc" diff --git a/kmix/viewbase.h b/kmix/viewbase.h index 96840d88..79f4220b 100644 --- a/kmix/viewbase.h +++ b/kmix/viewbase.h @@ -107,12 +107,14 @@ public slots: virtual void refreshVolumeLevels(); virtual void configureView(); void toggleMenuBarSlot(); + void selectMixerSlot(); protected slots: void mousePressEvent( TQMouseEvent *e ); signals: void toggleMenuBar(); + void selectMixer(); private: TQString _caption; |