]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/util/customwidgets.cpp
Removes trailing spaces. Removes tabs.
[vlc] / modules / gui / qt4 / util / customwidgets.cpp
index cd30fb547406d8ab5b61aa8c49aaa120e17133f2..67e7e99bb5487126c0261f1ceaa609cbf27855f1 100644 (file)
@@ -21,7 +21,8 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
 
 #include "customwidgets.hpp"
 #include <QPainter>
@@ -30,6 +31,7 @@
 #include <QColorGroup>
 #include <QRect>
 #include <QKeyEvent>
+#include <QWheelEvent>
 
 #include <vlc_keys.h>
 
@@ -143,6 +145,12 @@ int qtEventToVLCKey( QKeyEvent *e )
         HANDLE( Key_End, KEY_END );
         HANDLE( Key_Insert, KEY_INSERT );
         HANDLE( Key_Delete, KEY_DELETE );
+        HANDLE( Key_VolumeDown, KEY_VOLUME_DOWN);
+        HANDLE( Key_VolumeUp, KEY_VOLUME_UP );
+        HANDLE( Key_MediaPlay, KEY_MEDIA_PLAY_PAUSE );
+        HANDLE( Key_MediaStop, KEY_MEDIA_STOP );
+        HANDLE( Key_MediaPrevious, KEY_MEDIA_PREV_TRACK );
+        HANDLE( Key_MediaNext, KEY_MEDIA_NEXT_TRACK );
 
     }
     if( !found )
@@ -157,6 +165,18 @@ int qtEventToVLCKey( QKeyEvent *e )
     return i_vlck;
 }
 
+int qtWheelEventToVLCKey( QWheelEvent *e )
+{
+    int i_vlck = 0;
+    /* Handle modifiers */
+    i_vlck |= qtKeyModifiersToVLC( e );
+    if ( e->delta() > 0 )
+        i_vlck |= KEY_MOUSEWHEELUP;
+    else
+        i_vlck |= KEY_MOUSEWHEELDOWN;
+    return i_vlck;
+}
+
 QString VLCKeyToString( int val )
 {
     QString r = "";
@@ -177,3 +197,25 @@ QString VLCKeyToString( int val )
     }
     return r;
 }
+
+#include <QComboBox>
+
+void setfillVLCConfigCombo( const char *configname, intf_thread_t *p_intf,
+                        QComboBox *combo, QWidget *parent )
+{
+    module_config_t *p_config =
+                      config_FindConfig( VLC_OBJECT(p_intf), configname );
+    if( p_config )
+    {
+        for ( int i_index = 0; i_index < p_config->i_list; i_index++ )
+        {
+            combo->addItem( qfu( p_config->ppsz_list_text[i_index] ),
+                    QVariant( p_config->pi_list[i_index] ) );
+            if( p_config->value.i == p_config->pi_list[i_index] )
+            {
+                combo->setCurrentIndex( i_index );
+            }
+        }
+        combo->setToolTip( qfu( p_config->psz_longtext ) );
+    }
+}