From 7173de9b1d76aada67d30573b764579a818ac684 Mon Sep 17 00:00:00 2001 From: Roman Savochenko Date: Sun, 19 Nov 2023 10:20:26 +0200 Subject: KMix: Dynamism in tracing of appearance new audio-controllers Signed-off-by: Roman Savochenko --- kmix/kmix.cpp | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'kmix/kmix.cpp') diff --git a/kmix/kmix.cpp b/kmix/kmix.cpp index 20e9c58f..bdc2c521 100644 --- a/kmix/kmix.cpp +++ b/kmix/kmix.cpp @@ -4,6 +4,7 @@ * Copyright (C) 2000 Stefan Schimanski * Copyright (C) 2001 Preston Brown * Copyright (C) 2003 Sven Leiber + * Copyright (C) 2020 Roman Savochenko * 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 @@ -98,12 +99,18 @@ KMixWindow::KMixWindow() hide(); } connect( kapp, TQT_SIGNAL( aboutToQuit()), TQT_SLOT( saveSettings()) ); + + mixersUpdTimer = new TQTimer(); + connect(mixersUpdTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(mixersUpdate())); + mixersUpdTimer->start(10000); } KMixWindow::~KMixWindow() { - MixerToolBox::deinitMixer(); + delete mixersUpdTimer; + + MixerToolBox::deinitMixer(Mixer::mixers()); } @@ -136,6 +143,34 @@ KMixWindow::initActions() createGUI( "kmixui.rc" ); } +void +KMixWindow::mixersUpdate() +{ + //Do not update the mixers at the mixer window and the dock widget visibility + if(!m_dockWidget || isVisible() || (m_dockWidget->_dockAreaPopup && ((TQWidget*)m_dockWidget->_dockAreaPopup)->isVisible())) return; + //Detection the mixers configuration change + else { + TQPtrList tmpMix; +#ifdef WITH_KMIX_EXPERIMENTAL + MixerToolBox::initMixer(tmpMix, KMixSettings::multiDriver(), m_hwInfoString, true); +#else + MixerToolBox::initMixer(tmpMix, false, m_hwInfoString, true); +#endif + bool chMixers = (tmpMix.count() != Mixer::mixers().count()); + MixerToolBox::deinitMixer(tmpMix); + if(!chMixers) return; + } + MixerToolBox::deinitMixer(Mixer::mixers()); +#ifdef WITH_KMIX_EXPERIMENTAL + MixerToolBox::initMixer(Mixer::mixers(), KMixSettings::multiDriver(), m_hwInfoString); +#else + MixerToolBox::initMixer(Mixer::mixers(), false, m_hwInfoString); +#endif + + initMixerWidgets(); + updateDocking(); +} + void KMixWindow::initWidgets() { @@ -271,6 +306,8 @@ void KMixWindow::initMixerWidgets() { m_mixerWidgets.clear(); + m_cMixer->clear(); + mixerNameLayout->show(); int id=0; Mixer *mixer; -- cgit v1.2.3