aboutsummaryrefslogtreecommitdiff
path: root/qmidiplayer-desktop/qmpmainwindow.hpp
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2016-04-20 23:29:39 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2016-04-20 23:29:39 +0800
commit32568af90e5c521c68432a7e77b6dd8bf524adde (patch)
treee2bed775bf9953f26ad94531da2a20ec9f967482 /qmidiplayer-desktop/qmpmainwindow.hpp
parentb68f60e023175b144664de092c31416fa5b58880 (diff)
downloadQMidiPlayer-32568af90e5c521c68432a7e77b6dd8bf524adde.tar.xz
UI refinements and fix to two memory leaks.
Minor improvement in MIDI reading process.
Diffstat (limited to 'qmidiplayer-desktop/qmpmainwindow.hpp')
-rw-r--r--qmidiplayer-desktop/qmpmainwindow.hpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/qmidiplayer-desktop/qmpmainwindow.hpp b/qmidiplayer-desktop/qmpmainwindow.hpp
index 55e0b12..2f3876d 100644
--- a/qmidiplayer-desktop/qmpmainwindow.hpp
+++ b/qmidiplayer-desktop/qmpmainwindow.hpp
@@ -7,9 +7,11 @@
#include <QMoveEvent>
#include <QDropEvent>
#include <QDragEnterEvent>
+#include <QMouseEvent>
#include <QAction>
#include <QMenu>
#include <QApplication>
+#include <QSlider>
#include <thread>
#include <chrono>
#include "../core/qmpmidiplay.hpp"
@@ -24,6 +26,24 @@ namespace Ui {
class qmpMainWindow;
}
+class QClickableSlider:public QSlider
+{
+ Q_OBJECT
+ public:
+ explicit QClickableSlider(QWidget *parent=0):QSlider(parent){}
+ protected:
+ void mouseReleaseEvent(QMouseEvent *e)
+ {
+ QSlider::mouseReleaseEvent(e);
+ if(e->buttons()^Qt::LeftButton)
+ {
+ double p=e->pos().x()/(double)width();
+ setValue(p*(maximum()-minimum())+minimum());
+ emit sliderReleased();
+ }
+ }
+};
+
class qmpMainWindow:public QMainWindow
{
Q_OBJECT
@@ -83,6 +103,7 @@ class qmpMainWindow:public QMainWindow
qmpHelpWindow *helpw;
QAction *fnA1,*fnA2,*fnA3;
+ void onfnChanged();
void playerSetup();
private: