begin reorganizing the player section: move directslider aside, new independant volume and progress widgets, old code untouched

Jean-Francois Dockes Jean-Francois Dockes 2015-11-24

added GUI/volumewidget/volumewidget.h
added GUI/volumewidget/volumewidget.cpp
added GUI/volumewidget/Makefile
added GUI/volumewidget/vw.cpp
added GUI/volumewidget/vw.pro
added GUI/volumewidget/volumewidget.ui
added GUI/volumewidget/volumewidgetif.h
added GUI/progresswidget/progresswidgetif.h
added GUI/progresswidget/progresswidget.ui
added GUI/progresswidget/progresswidget.cpp
added GUI/progresswidget/progresswidget.h
changed upplay.pro
copied GUI/player/DirectSlider.cpp -> GUI/widgets/directslider.cpp
copied GUI/player/DirectSlider.h -> GUI/widgets/directslider.h
GUI/volumewidget/volumewidget.h Diff Switch to side-by-side view
Loading...
GUI/volumewidget/volumewidget.cpp Diff Switch to side-by-side view
Loading...
GUI/volumewidget/Makefile Diff Switch to side-by-side view
Loading...
GUI/volumewidget/vw.cpp Diff Switch to side-by-side view
Loading...
GUI/volumewidget/vw.pro Diff Switch to side-by-side view
Loading...
GUI/volumewidget/volumewidget.ui Diff Switch to side-by-side view
Loading...
GUI/volumewidget/volumewidgetif.h Diff Switch to side-by-side view
Loading...
GUI/progresswidget/progresswidgetif.h Diff Switch to side-by-side view
Loading...
GUI/progresswidget/progresswidget.ui Diff Switch to side-by-side view
Loading...
GUI/progresswidget/progresswidget.cpp Diff Switch to side-by-side view
Loading...
GUI/progresswidget/progresswidget.h Diff Switch to side-by-side view
Loading...
upplay.pro Diff Switch to side-by-side view
Loading...
GUI/player/DirectSlider.cpp to GUI/widgets/directslider.cpp
--- a/GUI/player/DirectSlider.cpp
+++ b/GUI/widgets/directslider.cpp
@@ -1,7 +1,5 @@
 /*
- * Copyright (C) 2012
- *
- * This file is part of sayonara-player
+ * Copyright (C) 2015 J.F. Dockes
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -16,21 +14,15 @@
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
- * created by Lucio Carreras,
- * Sep 14, 2012
- *
  */
+#include "directslider.h"
+
+#include <cmath>
+
 #include <QDebug>
-#include <QStyle>
 #include <QEvent>
 #include <QMouseEvent>
-#include <QWheelEvent>
-#include <QAbstractSlider>
 #include <QStyleOptionSlider>
-
-#include "GUI/player/DirectSlider.h"
-
-#include <cmath>
 
 // A slider where a click sets the position to the click location
 // instead of moving by a fixed amount as does the standard widget.
@@ -39,15 +31,21 @@
 static int adjustedVal(double halfHandleWidth, int pos, int sz, 
                        int min, int max)
 {
-    if ( pos < halfHandleWidth )
+    if (pos < halfHandleWidth)
         pos = halfHandleWidth;
-    if ( pos > sz - halfHandleWidth )
+    if (pos > sz - halfHandleWidth)
         pos = sz - halfHandleWidth;
-    // get new dimensions accounting for slider handle width
+    // Get new dimensions accounting for slider handle width
     double newWidth = (sz - halfHandleWidth) - halfHandleWidth;
     double normalizedPosition = (pos - halfHandleWidth)  / newWidth ;
 
     return min + ((max-min) * normalizedPosition);
+}
+
+void DirectSlider::setValueNoSigs(int val) {
+    blockSignals(true);
+    setValue(val);
+    blockSignals(false);
 }
 
 void DirectSlider::mousePressEvent(QMouseEvent *event)
GUI/player/DirectSlider.h to GUI/widgets/directslider.h
--- a/GUI/player/DirectSlider.h
+++ b/GUI/widgets/directslider.h
@@ -1,7 +1,5 @@
 /*
- * Copyright (C) 2012  
- *
- * This file is part of sayonara-player
+ * Copyright (C) 2015 J.F. Dockes
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -15,9 +13,6 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- * created by Lucio Carreras, 
- * Sep 14, 2012 
  *
  */
 
@@ -33,26 +28,18 @@
 // instead of moving by a fixed amount as does the standard widget.
 // http://stackoverflow.com/questions/11132597/qslider-mouse-direct-jump
 class DirectSlider: public QSlider {
-
     Q_OBJECT
 
 public:
-    DirectSlider(QWidget* parent=0)
-        : QSlider(parent)
-        {}
-
-    virtual ~DirectSlider() {}
+    DirectSlider(QWidget* parent = 0)
+        : QSlider(parent) {
+    }
 
 public slots:
-
-    void setValueNoSigs(int val) {
-        blockSignals(true);
-        setValue(val);
-        blockSignals(false);
-    }
+    void setValueNoSigs(int val);
 
 protected:
-    virtual void mousePressEvent ( QMouseEvent * event );
+    virtual void mousePressEvent (QMouseEvent *event);
 };
 
 #endif /* DIRECTSLIDER_H_ */