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

List:       kde-multimedia
Subject:    Two small patches for juk (against tags/KDE/3.5.7)
From:       "Daniel Weigl" <danielweigl () gmx ! at>
Date:       2007-08-10 7:16:08
Message-ID: op.twt046uow9eg47 () mail ! gmx ! net
[Download RAW message or body]

Hello,

wheel.diff:
------------
Long time ago i had posted a bug/wish for juk for changing the default  
behaviour when scrolling over the icon in the System Tray.  
( http://bugs.kde.org/show_bug.cgi?id=139219 ).

It is just a little, non invasive Patch - so maybe you could include it.

shuffle_random.diff:
-----------------------
I cant describe the behavior detailed - but somehow the random-play was  
dependand on the underliying directory structure of the mp3's on the  
harddisk. Since i started using JuK i had the feeling, that it preferes  
some mp3's (or at least some genre). Some weeks ago i had resorted my  
complete collection - now one folder for each artist. And somehow, JuK now  
preferes some artist :)

The patch shuffles the random list each time it is build (i.e. if Juk is  
started, Collection is rebuild,...)


The last patch should work against the latest svn trunk. With wheel.diff I  
am not sure - i havent set up a KDE4 developing environment.

If there are some problems - pls. contact me.

I would be very glad, if the patches find its way into the m,ain trunk :)

Thank you in advance,
Daniel Weigl


-- 
Erstellt mit Operas revolutionärem E-Mail-Modul: http://www.opera.com/mail/
["shuffle_random.diff" (shuffle_random.diff)]

Index: tracksequenceiterator.cpp
===================================================================
--- tracksequenceiterator.cpp	(Revision 698355)
+++ tracksequenceiterator.cpp	(Arbeitskopie)
@@ -256,6 +256,20 @@
 
     m_randomItems = p->visibleItems();
     m_randomItems.remove(current());
+
+    // Now shuffle the RandomList, so we get 'more' randomness
+    int cnt = m_randomItems.count();
+    qDebug("Shuffling %d items...",cnt);
+    for( int a=0 ; a<cnt ; a++ ) {
+    	// Go through the whole list of m_randomItems and swap each one with a random one...
+    	// (So some items may be moved twice or more - but hey! thats random...)
+    	int pos2 = KApplication::random() % cnt;
+    	PlaylistItem* temp;
+    	temp = m_randomItems[a];
+    	m_randomItems[a] = m_randomItems[pos2];
+    	m_randomItems[pos2] = temp;
+    }
+    
     m_albumSearch.clearComponents();
     m_albumSearch.search();
 }

["wheel.diff" (wheel.diff)]

Index: juk.cpp
===================================================================
--- juk.cpp	(Revision 698355)
+++ juk.cpp	(Arbeitskopie)
@@ -176,7 +176,12 @@
     m_togglePopupsAction =
 	new KToggleAction(i18n("Popup &Track Announcement"),
 			  KShortcut(), this, 0, actions(), "togglePopups");
-    new KToggleAction(i18n("Save &Play Queue on Exit"),
+		m_toggleWheelAction =
+			  new KToggleAction(i18n("Wheel &changes Volume"),
+			  KShortcut(), this, 0, actions(), "toggleWheel");
+
+		
+	new KToggleAction(i18n("Save &Play Queue on Exit"),
                       KShortcut(), this, 0, actions(), "saveUpcomingTracks");
 
     connect(m_toggleSystemTrayAction, SIGNAL(toggled(bool)),
@@ -320,7 +325,10 @@
 
     bool showPopups = settingsConfig.readBoolEntry("TrackPopup", false);
     m_togglePopupsAction->setChecked(showPopups);
-
+    
+    bool WheelAction = settingsConfig.readBoolEntry("WheelChangesVolume", false);
+		m_toggleWheelAction->setChecked(WheelAction);
+		
     if(m_outputSelectAction)
 	m_outputSelectAction->setCurrentItem(settingsConfig.readNumEntry("MediaSystem", 0));
 
@@ -359,8 +367,10 @@
     settingsConfig.writeEntry("DockInSystemTray", m_toggleSystemTrayAction->isChecked());
     settingsConfig.writeEntry("DockOnClose", m_toggleDockOnCloseAction->isChecked());
     settingsConfig.writeEntry("TrackPopup", m_togglePopupsAction->isChecked());
+    settingsConfig.writeEntry("WheelChangesVolume", m_toggleWheelAction->isChecked());
+		
     if(m_outputSelectAction)
-	settingsConfig.writeEntry("MediaSystem", m_outputSelectAction->currentItem());
+      settingsConfig.writeEntry("MediaSystem", m_outputSelectAction->currentItem());
 
     KGlobal::config()->sync();
 }
Index: juk.h
===================================================================
--- juk.h	(Revision 698355)
+++ juk.h	(Arbeitskopie)
@@ -85,7 +85,8 @@
     KToggleAction *m_toggleSystemTrayAction;
     KToggleAction *m_toggleDockOnCloseAction;
     KToggleAction *m_togglePopupsAction;
-    KToggleAction *m_toggleSplashAction;
+		KToggleAction *m_toggleWheelAction;
+		KToggleAction *m_toggleSplashAction;
     KToggleAction *m_loopPlaylistAction;
     KSelectAction *m_outputSelectAction;
 
Index: systemtray.cpp
===================================================================
--- systemtray.cpp	(Revision 698355)
+++ systemtray.cpp	(Arbeitskopie)
@@ -188,7 +188,8 @@
     menu->plug(cm);
 
     action("togglePopups")->plug(cm);
-
+		action("toggleWheel")->plug(cm);
+		
     m_fadeTimer = new QTimer(this, "systrayFadeTimer");
     connect(m_fadeTimer, SIGNAL(timeout()), SLOT(slotNextStep()));
 
@@ -547,21 +548,20 @@
     // to) know about the JuK class, so a static_cast won't work, and I was told
     // that a reinterpret_cast isn't portable when combined with multiple
     // inheritance.  (This is why I don't check the result.)
+    bool shift=(e->state())==ShiftButton;
+    bool tW=!action<KToggleAction>("toggleWheel")->isChecked();
+    if (shift^tW){
+      if(e->delta() > 0)
+        action("forward")->activate();
+      else
+        action("back")->activate();
+    }else{
+      if(e->delta() > 0)
+        action("volumeUp")->activate();
+      else
+        action("volumeDown")->activate();
+   }
 
-    switch(e->state()) {
-    case ShiftButton:
-        if(e->delta() > 0)
-            action("volumeUp")->activate();
-        else
-            action("volumeDown")->activate();
-        break;
-    default:
-        if(e->delta() > 0)
-            action("forward")->activate();
-        else
-            action("back")->activate();
-        break;
-    }
     e->accept();
 }
 


_______________________________________________
kde-multimedia mailing list
kde-multimedia@kde.org
https://mail.kde.org/mailman/listinfo/kde-multimedia


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

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