summaryrefslogtreecommitdiffstats
path: root/kmix/kmix.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kmix/kmix.cpp')
-rw-r--r--kmix/kmix.cpp98
1 files changed, 31 insertions, 67 deletions
diff --git a/kmix/kmix.cpp b/kmix/kmix.cpp
index 1ac09d85..3ebf6729 100644
--- a/kmix/kmix.cpp
+++ b/kmix/kmix.cpp
@@ -101,9 +101,7 @@ KMixWindow::~KMixWindow()
MixerToolBox::deinitMixer();
}
-
-void
-KMixWindow::initActions()
+void KMixWindow::initActions()
{
// file menu
KStdAction::quit( TQT_TQOBJECT(this), TQT_SLOT(quit()), actionCollection());
@@ -131,18 +129,14 @@ KMixWindow::initActions()
createGUI( "kmixui.rc" );
}
-
-void
-KMixWindow::initPrefDlg()
+void KMixWindow::initPrefDlg()
{
m_prefDlg = new KMixPrefDlg( this );
connect( m_prefDlg, TQT_SIGNAL(signalApplied(KMixPrefDlg *)),
this, TQT_SLOT(applyPrefs(KMixPrefDlg *)) );
}
-
-void
-KMixWindow::initWidgets()
+void KMixWindow::initWidgets()
{
// Main widget and layout
setCentralWidget( new TQWidget( this, "qt_central_widget" ) );
@@ -180,9 +174,7 @@ KMixWindow::initWidgets()
widgetsLayout->activate();
}
-
-void
-KMixWindow::updateDocking()
+void KMixWindow::updateDocking()
{
// delete old dock widget
if (m_dockWidget)
@@ -199,15 +191,13 @@ KMixWindow::updateDocking()
}
}
-void
-KMixWindow::saveSettings()
+void KMixWindow::saveSettings()
{
saveConfig();
saveVolumes();
}
-void
-KMixWindow::saveConfig()
+void KMixWindow::saveConfig()
{
TDEConfig *config = kapp->config();
config->setGroup(0);
@@ -266,8 +256,7 @@ KMixWindow::saveConfig()
config->setGroup(0);
}
-void
-KMixWindow::loadConfig()
+void KMixWindow::loadConfig()
{
TDEConfig *config = kapp->config();
config->setGroup(0);
@@ -327,18 +316,13 @@ KMixWindow::loadConfig()
}
}
-
-void
-KMixWindow::initMixerWidgets()
+void KMixWindow::initMixerWidgets()
{
- m_mixerWidgets.clear();
+ m_mixerWidgets.clear(); // This auto delete all KMixerWidget objects
+ m_cMixer->clear();
- int id=0;
- Mixer *mixer;
-
- // Attention!! If Mixer::mixers() is empty, we behave stupid. We don't show nothing and there
- // is not even a context menu.
- for ( mixer=Mixer::mixers().first(),id=0; mixer!=0; mixer=Mixer::mixers().next(),id++ )
+ int id = 0;
+ for (Mixer *mixer = Mixer::mixers().first(); mixer; mixer = Mixer::mixers().next(), id++)
{
//kdDebug(67100) << "Mixer number: " << id << " Name: " << mixer->mixerName() << endl ;
ViewBase::ViewFlags vflags = ViewBase::HasMenuBar;
@@ -370,25 +354,23 @@ KMixWindow::initMixerWidgets()
TQString grp;
grp.sprintf( "%i", mw->id() );
mw->loadConfig( kapp->config(), grp );
-
mw->setTicks( m_showTicks );
mw->setLabels( m_showLabels );
mw->setValueStyle ( m_valueStyle );
- // !! I am still not sure whether this works 100% reliably - chris
mw->show();
}
- if (id == 1)
+ if (m_cMixer->count() > 1)
+ {
+ mixerNameLayout->show();
+ }
+ else
{
- // don't show the Current Mixer bit unless we have multiple mixers
mixerNameLayout->hide();
}
}
-
-
-bool
-KMixWindow::queryClose ( )
+bool KMixWindow::queryClose ( )
{
if ( m_showDockWidget && !kapp->sessionSaving() )
{
@@ -398,16 +380,12 @@ KMixWindow::queryClose ( )
return true;
}
-
-void
-KMixWindow::quit()
+void KMixWindow::quit()
{
kapp->quit();
}
-
-void
-KMixWindow::showSettings()
+void KMixWindow::showSettings()
{
if (!m_prefDlg->isVisible())
{
@@ -428,16 +406,12 @@ KMixWindow::showSettings()
}
}
-
-void
-KMixWindow::showHelp()
+void KMixWindow::showHelp()
{
actionCollection()->action( "help_contents" )->activate();
}
-
-void
-KMixWindow::showAbout()
+void KMixWindow::showAbout()
{
actionCollection()->action( "help_about_app" )->activate();
}
@@ -465,8 +439,7 @@ KMixWindow::loadVolumes()
* Stores the volumes of all mixers Can be restored via loadVolumes() or
* the kmixctrl application.
*/
-void
-KMixWindow::saveVolumes()
+void KMixWindow::saveVolumes()
{
TDEConfig *cfg = new TDEConfig( "kmixctrlrc", false );
for (Mixer *mixer=Mixer::mixers().first(); mixer!=0; mixer=Mixer::mixers().next()) {
@@ -478,9 +451,7 @@ KMixWindow::saveVolumes()
delete cfg;
}
-
-void
-KMixWindow::applyPrefs( KMixPrefDlg *prefDlg )
+void KMixWindow::applyPrefs( KMixPrefDlg *prefDlg )
{
m_showDockWidget = prefDlg->m_dockingChk->isChecked();
m_volumeWidget = prefDlg->m_volumeChk->isChecked();
@@ -539,9 +510,7 @@ KMixWindow::applyPrefs( KMixPrefDlg *prefDlg )
saveConfig();
}
-
-void
-KMixWindow::toggleMenuBar()
+void KMixWindow::toggleMenuBar()
{
m_showMenubar = !m_showMenubar;
if( m_showMenubar )
@@ -554,16 +523,14 @@ KMixWindow::toggleMenuBar()
}
}
-void
-KMixWindow::showEvent( TQShowEvent * )
+void KMixWindow::showEvent( TQShowEvent * )
{
if ( m_visibilityUpdateAllowed )
m_isVisible = isVisible();
// !! could possibly start polling now (idea: use someting like ref() and unref() on Mixer instance
}
-void
-KMixWindow::hideEvent( TQHideEvent * )
+void KMixWindow::hideEvent( TQHideEvent * )
{
if ( m_visibilityUpdateAllowed )
{
@@ -574,9 +541,8 @@ KMixWindow::hideEvent( TQHideEvent * )
// But the dock icon is currently no View, so that must be done first.
}
-
-void
-KMixWindow::stopVisibilityUpdates() {
+void KMixWindow::stopVisibilityUpdates()
+{
m_visibilityUpdateAllowed = false;
}
@@ -585,14 +551,12 @@ KMixWindow::slotHWInfo() {
KMessageBox::information( 0, m_hwInfoString, i18n("Mixer Hardware Information") );
}
-void
-KMixWindow::showSelectedMixer( int mixer )
+void KMixWindow::showSelectedMixer( int mixer )
{
m_wsMixers->raiseWidget( mixer );
}
-void
-KMixWindow::configureGlobalShortcuts()
+void KMixWindow::configureGlobalShortcuts()
{
KKeyDialog::configure( m_globalAccel, 0, false ) ;
m_globalAccel->writeSettings();