Commit 7e953224 authored by Ludovic Fauvet's avatar Ludovic Fauvet

Single click seeking

parent 956d83b3
......@@ -46,8 +46,9 @@ PreviewWidget::PreviewWidget( QWidget *parent ) :
setAcceptDrops(true);
m_currentInstance = new LibVLCpp::Instance( vlc_argc, vlc_argv );
connect( m_ui->seekSlider, SIGNAL( sliderMoved(int) ),
connect( m_ui->seekSlider, SIGNAL( sliderPosChanged(int) ),
this, SLOT( seekSliderMoved(int) ) );
}
PreviewWidget::~PreviewWidget()
......
/*****************************************************************************
* Slider.cpp: Enhanced slider for user interactions
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Ludovic Fauvet <etix@l0cal.com>
*
* 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 the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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.
*****************************************************************************/
#include "Slider.h"
Slider::Slider( QWidget* parent ) : QSlider( parent ), m_isSliding( false )
{
connect( this, SIGNAL( valueChanged(int) ), this, SLOT( sliderChanged(int) ) );
}
void Slider::mousePressEvent( QMouseEvent* event )
{
m_isSliding = true;
if ( event->button() != Qt::LeftButton &&
event->button() != Qt::MidButton )
{
QSlider::mousePressEvent( event );
}
QMouseEvent newEvent( event->type(), event->pos(), event->globalPos(),
Qt::MouseButton( event->button() ^ Qt::LeftButton ^ Qt::MidButton ),
Qt::MouseButtons( event->buttons() ^ Qt::LeftButton ^ Qt::MidButton ),
event->modifiers() );
QSlider::mousePressEvent( &newEvent );
}
void Slider::mouseReleaseEvent( QMouseEvent* event )
{
m_isSliding = false;
QSlider::mouseReleaseEvent( event );
}
void Slider::sliderChanged( int value )
{
if ( m_isSliding )
{
emit sliderPosChanged( value );
}
}
/*****************************************************************************
* Slider.h: Enhanced slider for user interactions
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Ludovic Fauvet <etix@l0cal.com>
*
* 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 the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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.
*****************************************************************************/
#ifndef SLIDER_H
#define SLIDER_H
#include <QSlider>
#include <QMouseEvent>
class Slider : public QSlider
{
Q_OBJECT
public:
Slider( QWidget* parent = 0 );
protected:
void mousePressEvent( QMouseEvent* event );
void mouseReleaseEvent( QMouseEvent* event );
private slots:
void sliderChanged( int value );
signals:
void sliderPosChanged( int value );
private:
bool m_isSliding;
};
#endif // SLIDER_H
......@@ -70,7 +70,7 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QSlider" name="seekSlider">
<widget class="Slider" name="seekSlider">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
......@@ -282,6 +282,13 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Slider</class>
<extends>QSlider</extends>
<header>Slider.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../../../ressources.qrc"/>
</resources>
......
......@@ -30,7 +30,8 @@ SOURCES += src/main.cpp \
src/OutputMedia.cpp \
src/gui/About.cpp \
src/gui/Transcode.cpp \
src/InputMedia.cpp
src/InputMedia.cpp \
src/gui/Slider.cpp
HEADERS += src/gui/MainWindow.h \
src/gui/DockWidgetManager.h \
src/gui/LibraryWidget.h \
......@@ -52,7 +53,8 @@ HEADERS += src/gui/MainWindow.h \
src/OutputMedia.h \
src/gui/About.h \
src/gui/Transcode.h \
src/InputMedia.h
src/InputMedia.h \
src/gui/Slider.h
FORMS += src/gui/ui/MainWindow.ui \
src/gui/ui/PreviewWidget.ui \
src/gui/ui/Preferences.ui \
......@@ -60,13 +62,14 @@ FORMS += src/gui/ui/MainWindow.ui \
src/gui/ui/LibraryWidget.ui \
src/gui/ui/About.ui \
src/gui/ui/Transcode.ui
FORMS +=
FORMS +=
TRANSLATIONS = ts/vlmc_es.ts \
ts/vlmc_fr.ts \
ts/vlmc_sv.ts
RESOURCES += ressources.qrc
INCLUDEPATH += src/LibVLCpp \
src
INCLUDEPATH += src/LibVLCpp \
src/gui \
src
LIBS = -L/usr/local/lib \
-lvlc
CODECFORTR = UTF-8
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment