[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Support for your volume Up/Down and mute keys
From:       Willi Richert <mennosimons () gmx ! net>
Date:       2003-08-21 12:25:07
[Download RAW message or body]

Hi,

I've attached a patch and a new tar.bz2 for kmilo's on screen functionality. 
KMilo up to now only supports Powerbooks an Vaio laptops. Using tha attached 
patch you can change volume/mute state using dcop calls to kmix also from 
other laptops (at least I hope so ;-).

I've only tested und my HP Omnibook XE3-GF. For Volume I'm using QT's Key 
symbols defined qnamespace.h
For mute I'm using X symbol XF86AudioMute.

So I think it should work also for many other laptops.

It would be nice if you drop me a mail, if it works or not with your laptop.

Thanks,
willi richert

PS: After installing the patch you have to make -f Makefile.cvs, etc  in 
kdeutils directory.


["generic-2003-08-21.tar.bz2" (application/x-tbz)]
["kmilo.patch" (text/x-diff)]

? generic
? kmilo-willi.patch
? omnibook
? kmilo_kvaio/kcmkvaio/main.loT
Index: Makefile.am
===================================================================
RCS file: /home/kde/kdeutils/kmilo/Makefile.am,v
retrieving revision 1.7
diff -u -3 -p -u -r1.7 Makefile.am
--- Makefile.am	8 Aug 2003 21:02:54 -0000	1.7
+++ Makefile.am	21 Aug 2003 12:19:37 -0000
@@ -1,3 +1,5 @@
+GENERIC_SUBDIR=generic
+
 if include_kmilo_powerbook
 POWERBOOK_SUBDIR=powerbook
 endif
@@ -10,4 +12,4 @@ if include_kmilo_kvaio
 KVAIO_SUBDIR=kmilo_kvaio
 endif
 
-SUBDIRS=kmilod $(POWERBOOK_SUBDIR) $(KVAIO_SUBDIR)
+SUBDIRS=kmilod $(POWERBOOK_SUBDIR)  $(GENERIC_SUBDIR)
Index: configure.in.in
===================================================================
RCS file: /home/kde/kdeutils/kmilo/configure.in.in,v
retrieving revision 1.7
diff -u -3 -p -u -r1.7 configure.in.in
--- configure.in.in	8 Aug 2003 21:02:54 -0000	1.7
+++ configure.in.in	21 Aug 2003 12:19:37 -0000
@@ -29,4 +29,5 @@ AM_CONDITIONAL(include_kmilo_pbb, test x
 AC_CHECK_HEADER(linux/sonypi.h, [have_sonypi=true])
 AM_CONDITIONAL(include_kmilo_kvaio, test x$have_sonypi = xtrue)
 
+
 AC_SUBST(KEYBOARD_LIBS)
Index: kmilod/kmilod.cpp
===================================================================
RCS file: /home/kde/kdeutils/kmilo/kmilod/kmilod.cpp,v
retrieving revision 1.8
diff -u -3 -p -u -r1.8 kmilod.cpp
--- kmilod/kmilod.cpp	12 Jun 2003 01:59:50 -0000	1.8
+++ kmilod/kmilod.cpp	21 Aug 2003 12:19:37 -0000
@@ -38,14 +38,12 @@
 
 #include "defaultskin.h"
 
-
 extern "C" {
    KDEDModule *create_kmilod(const QCString &name) {
 	   return new KMiloD(name);
    }
 }
 
-
 KMiloD::KMiloD(const QCString &name) : KDEDModule(name), _interval(100)
 {
 	_monitors.setAutoDelete(true);
@@ -57,15 +55,22 @@ KMiloD::KMiloD(const QCString &name) : K
 		KService::Ptr service = *it;
 		KMilo::Monitor *m = KParts::ComponentFactory::createInstanceFromService<KMilo::Monitor>(service);
 		if (m) {
-			if (m->init()) {
+			if (m->init(this)) {
 				_monitors.append(m);
 				kdDebug() << "KMilo loaded module "
 					<< service->property("Name").toString()
 					<< endl;
 			} else {
 				delete m;
+				kdDebug() << "KMilo Error: Module " 
+					  << service->property("Name").toString()
+					  << " did not initialise." << endl;
 			}
-		}
+		} else
+		    kdDebug() << "KMilo Error: Module " 
+			      << service->property("Name").toString()
+			      << " not loadable." << endl;
+
 	}
 
 	// Create the display skin object
@@ -76,11 +81,17 @@ KMiloD::KMiloD(const QCString &name) : K
 	if (!_monitors.isEmpty()) {
 		_timer.start(_interval);
 	}
+
+	kdDebug() << "KMilo() erfolgreich"<< endl;
 }
 
+void KMiloD::test(){
+	kdDebug() << "KMilo:test()"<< endl;
+}
 
 KMiloD::~KMiloD()
 {
+	kdDebug() << "~KMilo() wurde aufgerufen"<< endl;
 	_timer.stop();
 
 	// Modules are automatically cleaned up when this is done.  It has
Index: kmilod/kmilod.h
===================================================================
RCS file: /home/kde/kdeutils/kmilo/kmilod/kmilod.h,v
retrieving revision 1.4
diff -u -3 -p -u -r1.4 kmilod.h
--- kmilod/kmilod.h	12 Jun 2003 01:59:50 -0000	1.4
+++ kmilod/kmilod.h	21 Aug 2003 12:19:38 -0000
@@ -27,8 +27,8 @@
 #include <qtimer.h>
 #include <qptrlist.h>
 #include "monitor.h"
-#include "displayskin.h"
 
+#include "displayskin.h"
 
 class KMiloD : public KDEDModule {
 	Q_OBJECT
@@ -51,7 +51,7 @@ class KMiloD : public KDEDModule {
 		virtual void reconfigure();
 	private slots:
 		virtual void doTimer();
-
+	void test();
 	private:
 		QTimer _timer;
 		int _interval;
Index: kmilod/monitor.cpp
===================================================================
RCS file: /home/kde/kdeutils/kmilo/kmilod/monitor.cpp,v
retrieving revision 1.6
diff -u -3 -p -u -r1.6 monitor.cpp
--- kmilod/monitor.cpp	18 Aug 2003 18:28:27 -0000	1.6
+++ kmilod/monitor.cpp	21 Aug 2003 12:19:38 -0000
@@ -19,6 +19,7 @@
    Boston, MA 02111-1307, USA.
 
 */
+#include <kdebug.h>
 
 #include "monitor.h"
 
@@ -28,6 +29,12 @@ KMilo::Monitor::Monitor(QObject *parent,
 }
 
 KMilo::Monitor::~Monitor() {
+}
+
+bool KMilo::Monitor::init(KMiloD* milod=0) {
+	_kmilod = milod;
+
+	return true;
 }
 
 void KMilo::Monitor::reconfigure(KConfig*)
Index: kmilod/monitor.h
===================================================================
RCS file: /home/kde/kdeutils/kmilo/kmilod/monitor.h,v
retrieving revision 1.8
diff -u -3 -p -u -r1.8 monitor.h
--- kmilod/monitor.h	18 Aug 2003 18:28:27 -0000	1.8
+++ kmilod/monitor.h	21 Aug 2003 12:19:38 -0000
@@ -27,10 +27,12 @@
 #include <qobject.h>
 
 class KConfig;
+class KMiloD;
 
 namespace KMilo {
 
-class Monitor : public QObject {
+class Monitor : public QObject 
+{
 	public:
 		Monitor(QObject *parent, const char *name, const QStringList&);
 		virtual ~Monitor();
@@ -40,7 +42,7 @@ class Monitor : public QObject {
 		 *  must return true if its hardware is present and it should
 		 *  be loaded.  If it returns false, it will be unloaded.
 		 */
-		virtual bool init() = 0;
+		virtual bool init(KMiloD* milod=0);
 
 		enum DisplayType { None, Error, Volume, Mute, Brightness };
 
@@ -63,6 +65,7 @@ class Monitor : public QObject {
 		
 	protected:
 		bool _poll;  // set to false to disable polling.
+		KMiloD* _kmilod; // if not polling then call directly
 };
 
 }


>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic