[Kwintv] PATCH: Settings->Configure->General option added

Neil Macvicar kwintv@mail.kde.org
Sun, 30 Mar 2003 03:16:30 +0100


--Boundary-00=_+Nlh+8TSxHOf3Cv
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi all,
	Another day, another patch :) Sorry for increasing your workload George. This 
patch adds the previously discussed "Mute mixer element on exit" option to 
the General settings configuration.

Altered files:
	qtvision.cpp : Added check for _cfg->autoMute before muting on exit.
	cfgdata.cpp/h : Added autoMute to the data elements. Added persist/restore 
capability for autoMute.
	generalwidget.ui : Altered UI to include the radio button.
	settingsdialog.cpp : Added autoMute operations.

George, this patch also includes the mixer/configure.in.in from my previous 
patch, which for some reason did not get included with the last patch merge, 
perhaps because it was a new file. 

Regards,
Neil.
--Boundary-00=_+Nlh+8TSxHOf3Cv
Content-Type: text/x-diff;
  charset="us-ascii";
  name="autoMute.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="autoMute.patch"

diff -Nur fresh/kdenonbeta/kwintv3/qtvision/cfgdata.cpp test/kdenonbeta/kwintv3/qtvision/cfgdata.cpp
--- fresh/kdenonbeta/kwintv3/qtvision/cfgdata.cpp	Fri Nov 22 00:15:49 2002
+++ test/kdenonbeta/kwintv3/qtvision/cfgdata.cpp	Sun Mar 30 02:18:36 2003
@@ -49,6 +49,7 @@
         mirror = other.mirror;
         maxResolution = other.maxResolution;
         autoStart = other.autoStart;
+	autoMute = other.autoMute;
         videoDesktopEnabled = other.videoDesktopEnabled;
         stayOnTop = other.stayOnTop;
         autoScaleEnabled = other.autoScaleEnabled;
@@ -100,6 +101,7 @@
     mirror = false;
     maxResolution = false;
     autoStart = true;
+    autoMute = false;
     videoDesktopEnabled = true;
     stayOnTop = false;
     firstTime = true;
@@ -141,6 +143,7 @@
     firstTime = _cfg->readBoolEntry("First Time", true);
     frameRate = _cfg->readNumEntry("Frame Rate", 22);
     autoStart = _cfg->readBoolEntry("Auto Start", true);
+    autoMute = _cfg->readBoolEntry("Auto Mute", false);
     maxResolution = _cfg->readBoolEntry("Capture at Max Res", false);
     landscape = _cfg->readBoolEntry("Display Landscape", false);
     mirror = _cfg->readBoolEntry("Mirror image", false);
@@ -241,6 +244,7 @@
     _cfg->writeEntry("NTSC PAL SECAM", nps);
     _cfg->writeEntry("Frame Rate", frameRate);
     _cfg->writeEntry("Auto Start", autoStart);
+    _cfg->writeEntry("Auto Mute", autoMute);
     _cfg->writeEntry("Capture at Max Res", maxResolution);
     _cfg->writeEntry("Display Landscape", landscape);
     _cfg->writeEntry("Mirror image", mirror);
diff -Nur fresh/kdenonbeta/kwintv3/qtvision/cfgdata.h test/kdenonbeta/kwintv3/qtvision/cfgdata.h
--- fresh/kdenonbeta/kwintv3/qtvision/cfgdata.h	Wed Dec 18 07:55:03 2002
+++ test/kdenonbeta/kwintv3/qtvision/cfgdata.h	Sun Mar 30 02:18:36 2003
@@ -82,6 +82,7 @@
 public:
     int frameRate;
     bool autoStart;
+    bool autoMute;
     bool maxResolution;
     bool landscape;
     bool mirror;
diff -Nur fresh/kdenonbeta/kwintv3/qtvision/generalwidget.ui test/kdenonbeta/kwintv3/qtvision/generalwidget.ui
--- fresh/kdenonbeta/kwintv3/qtvision/generalwidget.ui	Wed Jan  8 00:44:47 2003
+++ test/kdenonbeta/kwintv3/qtvision/generalwidget.ui	Sun Mar 30 02:18:41 2003
@@ -8,7 +8,7 @@
         <rect>
             <x>0</x>
             <y>0</y>
-            <width>463</width>
+            <width>495</width>
             <height>450</height>
         </rect>
     </property>
@@ -33,7 +33,7 @@
                 <cstring>GroupBox1</cstring>
             </property>
             <property name="frameShape">
-                <enum>Box</enum>
+                <enum>GroupBoxPanel</enum>
             </property>
             <property name="frameShadow">
                 <enum>Sunken</enum>
@@ -41,7 +41,7 @@
             <property name="title">
                 <string>Application Properties</string>
             </property>
-            <vbox>
+            <grid>
                 <property name="name">
                     <cstring>unnamed</cstring>
                 </property>
@@ -51,23 +51,7 @@
                 <property name="spacing">
                     <number>6</number>
                 </property>
-                <widget class="QCheckBox">
-                    <property name="name">
-                        <cstring>_autoStart</cstring>
-                    </property>
-                    <property name="sizePolicy">
-                        <sizepolicy>
-                            <hsizetype>4</hsizetype>
-                            <vsizetype>0</vsizetype>
-                            <horstretch>0</horstretch>
-                            <verstretch>0</verstretch>
-                        </sizepolicy>
-                    </property>
-                    <property name="text">
-                        <string>Auto play on startup</string>
-                    </property>
-                </widget>
-                <widget class="QCheckBox">
+                <widget class="QCheckBox" row="1" column="0">
                     <property name="name">
                         <cstring>_maxRes</cstring>
                     </property>
@@ -83,7 +67,7 @@
                         <string>Record video at maximum resolution</string>
                     </property>
                 </widget>
-                <widget class="QCheckBox">
+                <widget class="QCheckBox" row="2" column="0">
                     <property name="name">
                         <cstring>_videoDesktopEnabled</cstring>
                     </property>
@@ -99,7 +83,7 @@
                         <string>Video desktop on minimize</string>
                     </property>
                 </widget>
-                <widget class="QCheckBox">
+                <widget class="QCheckBox" row="3" column="0">
                     <property name="name">
                         <cstring>_stayOnTop</cstring>
                     </property>
@@ -115,7 +99,7 @@
                         <string>Always on top</string>
                     </property>
                 </widget>
-                <widget class="QLayoutWidget">
+                <widget class="QLayoutWidget" row="4" column="0" rowspan="1" colspan="2">
                     <property name="name">
                         <cstring>Layout4</cstring>
                     </property>
@@ -171,7 +155,7 @@
                         </widget>
                     </hbox>
                 </widget>
-                <widget class="QCheckBox">
+                <widget class="QCheckBox" row="5" column="0">
                     <property name="name">
                         <cstring>_useListingsURL</cstring>
                     </property>
@@ -190,7 +174,7 @@
                         <string>Check to make use of the listings URL. Usually requires an Internet connection.</string>
                     </property>
                 </widget>
-                <widget class="QLayoutWidget">
+                <widget class="QLayoutWidget" row="6" column="0" rowspan="1" colspan="2">
                     <property name="name">
                         <cstring>Layout8</cstring>
                     </property>
@@ -228,7 +212,31 @@
                         </widget>
                     </grid>
                 </widget>
-            </vbox>
+                <widget class="QCheckBox" row="0" column="0">
+                    <property name="name">
+                        <cstring>_autoStart</cstring>
+                    </property>
+                    <property name="sizePolicy">
+                        <sizepolicy>
+                            <hsizetype>4</hsizetype>
+                            <vsizetype>0</vsizetype>
+                            <horstretch>0</horstretch>
+                            <verstretch>0</verstretch>
+                        </sizepolicy>
+                    </property>
+                    <property name="text">
+                        <string>Auto play on startup</string>
+                    </property>
+                </widget>
+                <widget class="QCheckBox" row="0" column="1">
+                    <property name="name">
+                        <cstring>_autoMute</cstring>
+                    </property>
+                    <property name="text">
+                        <string>Mute mixer element on exit</string>
+                    </property>
+                </widget>
+            </grid>
         </widget>
         <widget class="QGroupBox">
             <property name="name">
diff -Nur fresh/kdenonbeta/kwintv3/qtvision/plugins/mixer/CVS/Entries test/kdenonbeta/kwintv3/qtvision/plugins/mixer/CVS/Entries
--- fresh/kdenonbeta/kwintv3/qtvision/plugins/mixer/CVS/Entries	Sun Mar 30 02:30:13 2003
+++ test/kdenonbeta/kwintv3/qtvision/plugins/mixer/CVS/Entries	Sun Mar 30 02:18:02 2003
@@ -1,3 +1,3 @@
 /.cvsignore/1.1/Thu Jun 13 04:17:54 2002//
-/Makefile.am/1.2/Sat Mar 29 19:03:41 2003//
+/Makefile.am/1.1/Thu Jun 13 04:17:54 2002//
 D
diff -Nur fresh/kdenonbeta/kwintv3/qtvision/plugins/mixer/alsa/CVS/Entries test/kdenonbeta/kwintv3/qtvision/plugins/mixer/alsa/CVS/Entries
--- fresh/kdenonbeta/kwintv3/qtvision/plugins/mixer/alsa/CVS/Entries	Sun Mar 30 02:30:16 2003
+++ test/kdenonbeta/kwintv3/qtvision/plugins/mixer/alsa/CVS/Entries	Sun Mar 30 02:18:02 2003
@@ -1,6 +1,6 @@
 /.cvsignore/1.1/Fri Nov 22 00:15:49 2002//
-/Makefile.am/1.2/Sat Mar 29 19:03:41 2003//
-/qtvision_alsa.cpp/1.5/Sat Mar 29 19:03:41 2003//
-/qtvision_alsa.desktop/1.14/Sat Mar 29 19:03:41 2003//
-/qtvision_alsa.h/1.3/Sat Mar 29 19:03:41 2003//
+/Makefile.am/1.1/Sun Nov  3 07:33:49 2002//
+/qtvision_alsa.cpp/1.4/Sat Feb 22 10:00:52 2003//
+/qtvision_alsa.desktop/1.13/Thu Jan  9 13:22:07 2003//
+/qtvision_alsa.h/1.2/Tue Dec 17 02:25:45 2002//
 D
diff -Nur fresh/kdenonbeta/kwintv3/qtvision/plugins/mixer/configure.in.in test/kdenonbeta/kwintv3/qtvision/plugins/mixer/configure.in.in
--- fresh/kdenonbeta/kwintv3/qtvision/plugins/mixer/configure.in.in	Thu Jan  1 01:00:00 1970
+++ test/kdenonbeta/kwintv3/qtvision/plugins/mixer/configure.in.in	Sun Mar 30 02:18:11 2003
@@ -0,0 +1,81 @@
+
+##################################################################
+## 
+##    QtVision mixer configure script
+##    Neil Macvicar (blackmogu@vfemail.net)
+##
+##################################################################
+
+AC_DEFUN(AC_PATH_ASOUND,
+[
+LIBASOUND="-lasound"
+AC_MSG_CHECKING([for alsa libraries and headers])
+
+ac_alsa_libs=NO ac_alsa_includes=NO
+alsa_libraries=""
+alsa_includes=""
+AC_ARG_WITH(alsa-dir,
+	[  --with-alsa-dir=DIR	where the root of alsa-lib is installed],
+	[ ac_alsa_includes="$withval"/include
+	  ac_alsa_libraries="$withval"/lib
+	])
+
+want_alsa_mixer=yes
+
+#AC_ARG_WITH(alsa,
+#	[  --without-alsa-mixer	disable alsa mixer plugin],
+#	[want_alsa_mixer=NO])
+
+if test $want_alsa_mixer = yes; then
+AC_CACHE_VAL(ac_cv_have_alsa,
+[# try to guess the location of the ALSA libraries/headers
+	alsa_incdirs="/usr/include /usr/local/include $prefix/include $kde_extra_includes"
+	alsa_incdirs="$ac_alsa_includes $alsa_incdirs"	
+	AC_FIND_FILE(alsa/asoundlib.h, $alsa_incdirs, alsa_incdir)
+	ac_alsa_includes="$alsa_incdir"
+
+	alsa_libdirs="/usr/lib /usr/local/lib $prefix/lib $exec_prefix/lib $kde_extra_libs"
+	if test ! "$ac_alsa_libraries" = "NO"; then
+		alsa_libdirs="$ac_alsa_libraries $alsa_libdirs"
+	fi
+
+	test=NONE
+	alsa_libdir=NONE
+
+	for dir in $alsa_libdirs; do
+		try="ls -1 $dir/libasound*"
+		if test=`eval $try 2>/dev/null`; then alsa_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
+	done
+
+	ac_alsa_libraries="$alsa_libdir"
+
+	if test "$ac_alsa_includes" = NO || test "$ac_alsa_libraries" = NO; then
+		have_alsa=no
+	else
+		ALSA_INCLUDES="-I$ac_alsa_includes ";
+		ALSA_LDFLAGS="-L$ac_alsa_libraries -lasound";
+		have_alsa=yes;
+	fi
+	])
+
+	eval "$ac_cv_have_alsa"
+	else
+		have_alsa=no
+	fi
+
+AC_SUBST(ALSA_INCLUDES)
+AC_SUBST(ALSA_LDFLAGS)
+AC_SUBST(LIBALSA)
+])
+
+AC_PATH_ASOUND
+
+if test "$ac_alsa_includes" = NO || test "$ac_alsa_libraries" = NO; then
+	ALSADIRS=
+	AC_MSG_RESULT([not found. Alsa mixer plugin disabled])
+else
+	ALSADIRS="yes"
+	AC_MSG_RESULT([found. Alsa mixer plugin enabled])
+fi
+
+AM_CONDITIONAL(include_ALSADIR, [test -n "$ALSADIRS"])
diff -Nur fresh/kdenonbeta/kwintv3/qtvision/qtvision.cpp test/kdenonbeta/kwintv3/qtvision/qtvision.cpp
--- fresh/kdenonbeta/kwintv3/qtvision/qtvision.cpp	Sat Feb 22 10:00:52 2003
+++ test/kdenonbeta/kwintv3/qtvision/qtvision.cpp	Sun Mar 30 02:18:30 2003
@@ -121,8 +121,11 @@
     _cs->save();
     stopDevice();
     
-    // Save volume related settings...
-    _cfg->volumeMuted = _muted;
+    // Save volume related settings. We mute the mixer element in use
+    // if autoMute is set from general config. This is due to some cards
+    // not muting on application exit.
+    if(_cfg->autoMute == true)
+    	_cfg->volumeMuted = _muted;
     _cfg->volumeLeft = _am->volumeLeft();
     _cfg->volumeRight= _am->volumeRight();
     
@@ -314,7 +317,7 @@
                 // load the Channel file
                 _cs->load(_cfg->channelFile);
             }
-        } else { 
+        } else {
             if (_cs->fileName() != _cfg->channelFile && !_cfg->channelFile.isEmpty()) {
                 // load a different Channel file
                 _cs->load(_cfg->channelFile);
@@ -348,7 +351,8 @@
 void QtVision::stopDevice()
 {
     if ( _vsrc ) {
-        setMuteVolume (true);
+    	if(_cfg->autoMute == true)
+        	setMuteVolume (true);
         _cfg->lastSource = _vsrc->source();
         _cfg->saveTuning(_vsrc->device(), _vsrc->source());
         _vsrc->stopVideo();
diff -Nur fresh/kdenonbeta/kwintv3/qtvision/settingsdialog.cpp test/kdenonbeta/kwintv3/qtvision/settingsdialog.cpp
--- fresh/kdenonbeta/kwintv3/qtvision/settingsdialog.cpp	Mon Nov  4 06:17:52 2002
+++ test/kdenonbeta/kwintv3/qtvision/settingsdialog.cpp	Sun Mar 30 02:18:46 2003
@@ -175,6 +175,7 @@
     generalWidget->_maxRes->setChecked(cfg->maxResolution);
     generalWidget->_landscape->setChecked(cfg->landscape);
     generalWidget->_autoStart->setChecked(cfg->autoStart);
+    generalWidget->_autoMute->setChecked(cfg->autoMute);
     generalWidget->_frameRate->setValue(cfg->frameRate);
     generalWidget->_fixAR->setChecked(cfg->fixAR);
     generalWidget->_aspectCombo->setCurrentItem(cfg->ARmode);
@@ -253,6 +254,7 @@
     // Apply the general options
     newConfig->frameRate = generalWidget->_frameRate->value();
     newConfig->autoStart = generalWidget->_autoStart->isChecked();
+    newConfig->autoMute = generalWidget->_autoMute->isChecked();
     newConfig->landscape = generalWidget->_landscape->isChecked();
     newConfig->maxResolution = generalWidget->_maxRes->isChecked();
     newConfig->videoDesktopEnabled = generalWidget->_videoDesktopEnabled->isChecked();

--Boundary-00=_+Nlh+8TSxHOf3Cv--