Commit f3c5b0ad authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 : Changes in the main interface:

 - Don't use the .ui, do all by hand :)
 - Use a ControlWidgets to design all the controls, and implement the functions
 - Change a bit the advanced widget, that must be integrated in the
   controlsWidget
There is a lot of Not Yet Implemented, so feel free to add some.
parent 489efb13
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* $Id$ * $Id$
* *
* Authors: Clément Stenac <zorglub@videolan.org> * Authors: Clément Stenac <zorglub@videolan.org>
* Jean-Baptiste Kempf <jb@videolan.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -27,6 +28,7 @@ ...@@ -27,6 +28,7 @@
#include "main_interface.hpp" #include "main_interface.hpp"
#include "input_manager.hpp" #include "input_manager.hpp"
#include "util/input_slider.hpp"
#include <vlc_vout.h> #include <vlc_vout.h>
#include <QLabel> #include <QLabel>
...@@ -204,7 +206,7 @@ void VisualSelector::next() ...@@ -204,7 +206,7 @@ void VisualSelector::next()
/********************************************************************** /**********************************************************************
* More controls * More controls
**********************************************************************/ **********************************************************************/
ControlsWidget::ControlsWidget( intf_thread_t *_p_i ) : AdvControlsWidget::AdvControlsWidget( intf_thread_t *_p_i ) :
QFrame( NULL ), p_intf( _p_i ) QFrame( NULL ), p_intf( _p_i )
{ {
QHBoxLayout *layout = new QHBoxLayout( this ); QHBoxLayout *layout = new QHBoxLayout( this );
...@@ -239,43 +241,304 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i ) : ...@@ -239,43 +241,304 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i ) :
fullscreenButton->setMaximumWidth( 35 ); fullscreenButton->setMaximumWidth( 35 );
} }
ControlsWidget::~ControlsWidget() AdvControlsWidget::~AdvControlsWidget()
{ {
} }
void ControlsWidget::enableInput( bool enable ) void AdvControlsWidget::enableInput( bool enable )
{ {
slowerButton->setEnabled( enable ); slowerButton->setEnabled( enable );
normalButton->setEnabled( enable ); normalButton->setEnabled( enable );
fasterButton->setEnabled( enable ); fasterButton->setEnabled( enable );
} }
void ControlsWidget::enableVideo( bool enable ) void AdvControlsWidget::enableVideo( bool enable )
{ {
snapshotButton->setEnabled( enable ); snapshotButton->setEnabled( enable );
fullscreenButton->setEnabled( enable ); fullscreenButton->setEnabled( enable );
} }
void ControlsWidget::slower() void AdvControlsWidget::slower()
{ {
THEMIM->getIM()->slower(); THEMIM->getIM()->slower();
} }
void ControlsWidget::faster() void AdvControlsWidget::faster()
{ {
THEMIM->getIM()->faster(); THEMIM->getIM()->faster();
} }
void ControlsWidget::normal() void AdvControlsWidget::normal()
{ {
THEMIM->getIM()->normalRate(); THEMIM->getIM()->normalRate();
} }
void ControlsWidget::snapshot() void AdvControlsWidget::snapshot()
{ {
} }
void AdvControlsWidget::fullscreen()
{
}
ControlsWidget::ControlsWidget( intf_thread_t *_p_i ) :
QFrame( NULL ), p_intf( _p_i )
{
//QSize size( 500, 200 );
//resize( size );
controlLayout = new QGridLayout( this );
/** The main Slider **/
slider = new InputSlider( Qt::Horizontal, NULL );
controlLayout->addWidget( slider, 0, 1, 1, 14 );
/* Update the position when the IM has changed */
CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ),
slider, setPosition( float,int, int ) );
/* And update the IM, when the position has changed */
CONNECT( slider, sliderDragged( float ),
THEMIM->getIM(), sliderUpdate( float ) );
/** Disc and Menus handling */
discFrame = new QFrame( this );
QHBoxLayout *discLayout = new QHBoxLayout( discFrame );
QPushButton *menuButton = new QPushButton( discFrame );
discLayout->addWidget( menuButton );
QPushButton *prevSectionButton = new QPushButton( discFrame );
discLayout->addWidget( prevSectionButton );
QPushButton *nextSectionButton = new QPushButton( discFrame );
discLayout->addWidget( nextSectionButton );
controlLayout->addWidget( discFrame, 1, 13, 1, 4 );
BUTTON_SET_IMG( prevSectionButton, "", previous.png, "" );
BUTTON_SET_IMG( nextSectionButton, "", next.png, "" );
BUTTON_SET_IMG( menuButton, "", previous.png, "" );
discFrame->hide();
/* Change the navigation button display when the IM navigation changes */
CONNECT( THEMIM->getIM(), navigationChanged( int ),
this, setNavigation(int) );
/* Changes the IM navigation when triggered on the nav buttons */
CONNECT( prevSectionButton, clicked(), THEMIM->getIM(),
sectionPrev() );
CONNECT( nextSectionButton, clicked(), THEMIM->getIM(),
sectionNext() );
CONNECT( menuButton, clicked(), THEMIM->getIM(),
sectionMenu() );
/** Play Buttons **/
QSizePolicy sizePolicy( QSizePolicy::Maximum, QSizePolicy::Fixed );
sizePolicy.setHorizontalStretch( 0 );
sizePolicy.setVerticalStretch( 0 );
// sizePolicy.setHeightForWidth( playButton->sizePolicy( ).hasHeightForWidth( ) );
/* Play */
QPushButton *playButton = new QPushButton;
playButton->setSizePolicy( sizePolicy );
playButton->setMaximumSize( QSize( 45, 45 ) );
playButton->setIconSize( QSize( 30, 30 ) );
controlLayout->addWidget( playButton, 2, 0, 2, 2 );
/** Prev + Stop + Next Block **/
QHBoxLayout *controlButLayout = new QHBoxLayout;
controlButLayout->setSpacing( 0 ); /* Don't remove that, will be useful */
/* Prev */
QPushButton *prevButton = new QPushButton;
prevButton->setSizePolicy( sizePolicy );
prevButton->setMaximumSize( QSize( 26, 26 ) );
prevButton->setIconSize( QSize( 20, 20 ) );
controlButLayout->addWidget( prevButton );
/* Stop */
QPushButton *stopButton = new QPushButton;
stopButton->setSizePolicy( sizePolicy );
stopButton->setMaximumSize( QSize( 26, 26 ) );
stopButton->setIconSize( QSize( 20, 20 ) );
controlButLayout->addWidget( stopButton );
/* next */
QPushButton *nextButton = new QPushButton;
nextButton->setSizePolicy( sizePolicy );
nextButton->setMaximumSize( QSize( 26, 26 ) );
nextButton->setIconSize( QSize( 20, 20 ) );
controlButLayout->addWidget( nextButton );
/* Add this block to the main layout */
controlLayout->addLayout( controlButLayout, 3, 3, 1, 3 );
BUTTON_SET_ACT_I( playButton, "", play.png, qtr("Play"), play() );
BUTTON_SET_ACT_I( prevButton, "" , previous.png,
qtr("Previous"), prev() );
BUTTON_SET_ACT_I( nextButton, "", next.png, qtr("Next"), next() );
BUTTON_SET_ACT_I( stopButton, "", stop.png, qtr("Stop"), stop() );
/*
* Other first Line buttons
* Might need to be inside a frame to avoid a few resizing pb
* FIXME
*/
/** Playlist Button **/
playlistButton = new QPushButton;
playlistButton->setMaximumSize(QSize(45, 45));
controlLayout->addWidget( playlistButton, 3, 10 );
/** Fullscreen/Visualisation **/
QPushButton *fullscreenButton = new QPushButton( "F" );
BUTTON_SET_ACT( fullscreenButton, "F", qtr("Fullscreen"), fullscreen() );
fullscreenButton->setMaximumSize( QSize( 26, 26 ) );
controlLayout->addWidget( fullscreenButton, 3, 11 );
/** extended Settings **/
QPushButton *extSettingsButton = new QPushButton( "F" );
BUTTON_SET_ACT( extSettingsButton, "Ex", qtr("Extended Settings"),
extSettings() );
extSettingsButton->setMaximumSize( QSize( 26, 26 ) );
controlLayout->addWidget( extSettingsButton, 3, 12 );
/** Preferences **/
QPushButton *prefsButton = new QPushButton( "P" );
BUTTON_SET_ACT( prefsButton, "P", qtr("Preferences / Settings"), prefs() );
prefsButton->setMaximumSize( QSize( 26, 26 ) );
controlLayout->addWidget( prefsButton, 3, 13 );
/* Volume */
VolumeClickHandler *h = new VolumeClickHandler( p_intf, this );
QLabel *volMuteLabel = new QLabel;
volMuteLabel->setPixmap( QPixmap( ":/pixmaps/volume-low.png" ) );
volMuteLabel->setToolTip( qtr( "Mute" ) );
volMuteLabel->installEventFilter(h);
volumeSlider = new QSlider;
volumeSlider->setSizePolicy( sizePolicy );
volumeSlider->setMaximumSize( QSize(80, 200) );
volumeSlider->setOrientation( Qt::Horizontal );
volumeSlider->setMaximum( 100 );
volumeSlider->setFocusPolicy( Qt::NoFocus );
controlLayout->addWidget( volMuteLabel, 3, 14 );
controlLayout->addWidget( volumeSlider, 3, 15, 1, 2 );
/* Volume control connection */
CONNECT( volumeSlider, valueChanged( int ), this, updateVolume( int ) );
}
ControlsWidget::~ControlsWidget()
{
}
void ControlsWidget::stop()
{
THEMIM->stop();
}
void ControlsWidget::play()
{
if( playlist_IsEmpty(THEPL) )
{
/* The playlist is empty, open a file requester */
THEDP->openFileDialog();
setStatus( 0 );
return;
}
THEMIM->togglePlayPause();
}
void ControlsWidget::prev()
{
THEMIM->prev();
}
void ControlsWidget::next()
{
THEMIM->next();
}
void ControlsWidget::setNavigation( int navigation )
{
#define HELP_MENU N_("Menu")
#define HELP_PCH N_("Previous chapter")
#define HELP_NCH N_("Next chapter")
#define HELP_PTR N_("Previous track")
#define HELP_NTR N_("Next track")
// 1 = chapter, 2 = title, 0 = no
if( navigation == 0 )
{
discFrame->hide();
} else if( navigation == 1 ) {
prevSectionButton->show();
prevSectionButton->setToolTip( qfu(HELP_PCH) );
nextSectionButton->show();
nextSectionButton->setToolTip( qfu(HELP_NCH) );
menuButton->show();
discFrame->show();
} else {
prevSectionButton->show();
prevSectionButton->setToolTip( qfu(HELP_PCH) );
nextSectionButton->show();
nextSectionButton->setToolTip( qfu(HELP_NCH) );
menuButton->hide();
discFrame->show();
}
}
static bool b_my_volume;
void ControlsWidget::updateVolume( int sliderVolume )
{
if( !b_my_volume )
{
int i_res = sliderVolume * AOUT_VOLUME_MAX /
( 2*volumeSlider->maximum() );
aout_VolumeSet( p_intf, i_res );
}
}
void ControlsWidget::updateOnTimer()
{
audio_volume_t i_volume;
aout_VolumeGet( p_intf, &i_volume );
i_volume = (i_volume * 200 )/ AOUT_VOLUME_MAX ;
int i_gauge = volumeSlider->value();
b_my_volume = false;
if( i_volume - i_gauge > 1 || i_gauge - i_volume > 1 )
{
b_my_volume = true;
volumeSlider->setValue( i_volume );
b_my_volume = false;
}
}
void ControlsWidget::setStatus( int status )
{
if( status == 1 ) // Playing
playButton->setIcon( QIcon( ":/pixmaps/pause.png" ) );
else
playButton->setIcon( QIcon( ":/pixmaps/play.png" ) );
}
/*
* This functions toggle the fullscreen mode
* If there is no video, it should first activate Visualisations... TODO
*/
void ControlsWidget::fullscreen() void ControlsWidget::fullscreen()
{ {
msg_Dbg(p_intf, "Not implemented yet");
}
void ControlsWidget::extSettings()
{
THEDP->extendedDialog();
}
void ControlsWidget::prefs()
{
THEDP->prefsDialog();
} }
/********************************************************************** /**********************************************************************
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* $Id$ * $Id$
* *
* Authors: Clément Stenac <zorglub@videolan.org> * Authors: Clément Stenac <zorglub@videolan.org>
* Jean-Baptiste Kempf <jb@videolan.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -27,6 +28,7 @@ ...@@ -27,6 +28,7 @@
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <vlc_interface.h> #include <vlc_interface.h>
#include <vlc_aout.h>
#include "qt4.hpp" #include "qt4.hpp"
#include <QWidget> #include <QWidget>
...@@ -98,12 +100,12 @@ private slots: ...@@ -98,12 +100,12 @@ private slots:
}; };
class QPushButton; class QPushButton;
class ControlsWidget : public QFrame class AdvControlsWidget : public QFrame
{ {
Q_OBJECT Q_OBJECT
public: public:
ControlsWidget( intf_thread_t *); AdvControlsWidget( intf_thread_t *);
virtual ~ControlsWidget(); virtual ~AdvControlsWidget();
void enableInput( bool ); void enableInput( bool );
void enableVideo( bool ); void enableVideo( bool );
private: private:
...@@ -118,6 +120,64 @@ private slots: ...@@ -118,6 +120,64 @@ private slots:
void fullscreen(); void fullscreen();
}; };
class InputSlider;
class QSlider;
class QGridLayout;
class VolumeClickHandler;
class ControlsWidget : public QFrame
{
Q_OBJECT
public:
ControlsWidget( intf_thread_t *);
virtual ~ControlsWidget();
QPushButton *playlistButton;
QSlider *volumeSlider;
void setStatus( int );
public slots:
void setNavigation( int );
void updateOnTimer();
protected:
friend class MainInterface;
friend class VolumeClickHandler;
private:
intf_thread_t *p_intf;
QFrame *discFrame;
QGridLayout *controlLayout;
InputSlider *slider;
QPushButton *prevSectionButton, *nextSectionButton, *menuButton;
QPushButton *playButton;
private slots:
void play();
void stop();
void prev();
void next();
void updateVolume( int );
void fullscreen();
void extSettings();
void prefs();
};
class VolumeClickHandler : public QObject
{
public:
VolumeClickHandler( intf_thread_t *_p_intf, ControlsWidget *_m ) :QObject(_m)
{m = _m; p_intf = _p_intf; }
virtual ~VolumeClickHandler() {};
bool eventFilter( QObject *obj, QEvent *e )
{
if (e->type() == QEvent::MouseButtonPress )
{
aout_VolumeMute( p_intf, NULL );
return true;
}
return false;
}
private:
ControlsWidget *m;
intf_thread_t *p_intf;
};
/******************** Playlist Widgets ****************/ /******************** Playlist Widgets ****************/
#include <QModelIndex> #include <QModelIndex>
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* $Id$ * $Id$
* *
* Authors: Clément Stenac <zorglub@videolan.org> * Authors: Clément Stenac <zorglub@videolan.org>
* Jean-Baptiste Kempf <jb@videolan.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -24,7 +25,6 @@ ...@@ -24,7 +25,6 @@
#include "qt4.hpp" #include "qt4.hpp"
#include "main_interface.hpp" #include "main_interface.hpp"
#include "input_manager.hpp" #include "input_manager.hpp"
#include "util/input_slider.hpp"
#include "util/qvlcframe.hpp" #include "util/qvlcframe.hpp"
#include "util/customwidgets.hpp" #include "util/customwidgets.hpp"
#include "dialogs_provider.hpp" #include "dialogs_provider.hpp"
...@@ -152,6 +152,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -152,6 +152,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
this, showSpeedMenu( QPoint ) ); this, showSpeedMenu( QPoint ) );
CONNECT( timeLabel, customContextMenuRequested( QPoint ), CONNECT( timeLabel, customContextMenuRequested( QPoint ),
this, showTimeMenu( QPoint ) ); this, showTimeMenu( QPoint ) );
/* Systray */ /* Systray */
sysTray = NULL; sysTray = NULL;
if( config_GetInt( p_intf, "qt-start-minimized") ) if( config_GetInt( p_intf, "qt-start-minimized") )
...@@ -172,12 +173,8 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -172,12 +173,8 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
* CONNECTs * CONNECTs
**/ **/
/* Volume control */
CONNECT( ui.volumeSlider, valueChanged(int), this, updateVolume(int) );
/* Connect the input manager to the GUI elements it manages */ /* Connect the input manager to the GUI elements it manages */
CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ), /* It is also connected to the control->slider */
slider, setPosition( float,int, int ) );
CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ), CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ),
this, setDisplay( float, int, int ) ); this, setDisplay( float, int, int ) );
...@@ -197,23 +194,11 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -197,23 +194,11 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
/* PLAY_STATUS */ /* PLAY_STATUS */
CONNECT( THEMIM->getIM(), statusChanged( int ), this, setStatus( int ) ); CONNECT( THEMIM->getIM(), statusChanged( int ), this, setStatus( int ) );
CONNECT( THEMIM->getIM(), navigationChanged( int ),
this, setNavigation(int) );
if( config_GetInt( p_intf, "qt-system-tray" ) && sysTray ) if( config_GetInt( p_intf, "qt-system-tray" ) && sysTray )
{ {
CONNECT( THEMIM->getIM(), statusChanged( int ), this, CONNECT( THEMIM->getIM(), statusChanged( int ), this,
updateSystrayTooltipStatus( int ) ); updateSystrayTooltipStatus( int ) );
} }
CONNECT( slider, sliderDragged( float ),
THEMIM->getIM(), sliderUpdate( float ) );
/* Buttons */
CONNECT( ui.prevSectionButton, clicked(), THEMIM->getIM(),
sectionPrev() );
CONNECT( ui.nextSectionButton, clicked(), THEMIM->getIM(),
sectionNext() );
CONNECT( ui.menuButton, clicked(), THEMIM->getIM(),
sectionMenu() );
/** /**
* Callbacks * Callbacks
...@@ -281,7 +266,7 @@ void MainInterface::setVLCWindowsTitle( QString aTitle ) ...@@ -281,7 +266,7 @@ void MainInterface::setVLCWindowsTitle( QString aTitle )
void MainInterface::handleMainUi( QSettings *settings ) void MainInterface::handleMainUi( QSettings *settings )
{ {
QWidget *main = new QWidget( this ); QWidget *main = new QWidget( this );
QVBoxLayout *mainLayout = new QVBoxLayout( main ); mainLayout = new QVBoxLayout( main );
setCentralWidget( main ); setCentralWidget( main );
/* Margins, spacing */ /* Margins, spacing */
...@@ -289,36 +274,13 @@ void MainInterface::handleMainUi( QSettings *settings ) ...@@ -289,36 +274,13 @@ void MainInterface::handleMainUi( QSettings *settings )
mainLayout->setMargin( 0 ); mainLayout->setMargin( 0 );
/* CONTROLS */ /* CONTROLS */
QWidget *controls = new QWidget; controls = new ControlsWidget( p_intf );
ui.setupUi( controls );
/* Configure the UI */ /* Configure the UI */
slider = new InputSlider( Qt::Horizontal, NULL ); BUTTON_SET_IMG( controls->playlistButton, "" , playlist_icon.png,
mainLayout->insertWidget( 0, slider );
ui.discFrame->hide();
BUTTON_SET_IMG( ui.prevSectionButton, "", previous.png, "" );
BUTTON_SET_IMG( ui.nextSectionButton, "", next.png, "" );
BUTTON_SET_IMG( ui.menuButton, "", previous.png, "" );
BUTTON_SET_ACT_I( ui.prevButton, "" , previous.png,
qtr("Previous"), prev() );
BUTTON_SET_ACT_I( ui.nextButton, "", next.png, qtr("Next"), next() );
BUTTON_SET_ACT_I( ui.playButton, "", play.png, qtr("Play"), play() );
BUTTON_SET_ACT_I( ui.stopButton, "", stop.png, qtr("Stop"), stop() );
/* Volume */
ui.volMuteLabel->setPixmap( QPixmap( ":/pixmaps/volume-low.png" ) );
ui.volumeSlider->setMaximum( 100 );
ui.volMuteLabel->setToolTip( qtr( "Mute" ) );
VolumeClickHandler *h = new VolumeClickHandler( p_intf, this );
ui.volMuteLabel->installEventFilter(h);
ui.volumeSlider->setFocusPolicy( Qt::NoFocus );
BUTTON_SET_IMG( ui.playlistButton, "" , playlist_icon.png,
playlistEmbeddedFlag ? qtr( "Show playlist" ) : playlistEmbeddedFlag ? qtr( "Show playlist" ) :
qtr( "Open playlist" ) ); qtr( "Open playlist" ) );
BUTTONACT( ui.playlistButton, playlist() ); BUTTONACT( controls->playlistButton, playlist() );
#if DEBUG_COLOR #if DEBUG_COLOR
QPalette palette; QPalette palette;
...@@ -335,7 +297,7 @@ void MainInterface::handleMainUi( QSettings *settings ) ...@@ -335,7 +297,7 @@ void MainInterface::handleMainUi( QSettings *settings )
addSize = QSize( mainLayout->margin() * 2, PREF_H ); addSize = QSize( mainLayout->margin() * 2, PREF_H );
/* advanced Controls handling */ /* advanced Controls handling */
advControls = new ControlsWidget( p_intf ); advControls = new AdvControlsWidget( p_intf );
mainLayout->insertWidget( 0, advControls ); mainLayout->insertWidget( 0, advControls );
advControls->updateGeometry(); advControls->updateGeometry();
if( !advControlsEnabled ) advControls->hide(); if( !advControlsEnabled ) advControls->hide();
...@@ -731,7 +693,7 @@ void MainInterface::playlist() ...@@ -731,7 +693,7 @@ void MainInterface::playlist()
{ {
PlaylistDialog::killInstance(); PlaylistDialog::killInstance();
playlistWidget = new PlaylistWidget( p_intf ); playlistWidget = new PlaylistWidget( p_intf );
ui.vboxLayout->insertWidget( 0, playlistWidget ); mainLayout->insertWidget( 0, playlistWidget );
playlistWidget->widgetSize = settings->value( "playlistSize", playlistWidget->widgetSize = settings->value( "playlistSize",
QSize( 650, 310 ) ).toSize(); QSize( 650, 310 ) ).toSize();
playlistWidget->hide(); playlistWidget->hide();
...@@ -779,7 +741,7 @@ void MainInterface::undockPlaylist() ...@@ -779,7 +741,7 @@ void MainInterface::undockPlaylist()
{ {
playlistWidget->hide(); playlistWidget->hide();
playlistWidget->deleteLater(); playlistWidget->deleteLater();
ui.vboxLayout->removeWidget( playlistWidget ); mainLayout->removeWidget( playlistWidget );
playlistWidget = NULL; playlistWidget = NULL;
playlistEmbeddedFlag = false; playlistEmbeddedFlag = false;
...@@ -897,33 +859,6 @@ void MainInterface::wheelEvent( QWheelEvent *e ) ...@@ -897,33 +859,6 @@ void MainInterface::wheelEvent( QWheelEvent *e )
e->accept(); e->accept();
} }
void MainInterface::stop()
{
THEMIM->stop();
}
void MainInterface::play()
{
if( playlist_IsEmpty(THEPL) )
{
/* The playlist is empty, open a file requester */
THEDP->openFileDialog();
setStatus( 0 );
return;
}
THEMIM->togglePlayPause();
}
void MainInterface::prev()
{
THEMIM->prev();
}
void MainInterface::next()
{
THEMIM->next();
}
void MainInterface::setDisplay( float pos, int time, int length ) void MainInterface::setDisplay( float pos, int time, int length )
{ {
char psz_length[MSTRTIME_MAX_SIZE], psz_time[MSTRTIME_MAX_SIZE]; char psz_length[MSTRTIME_MAX_SIZE], psz_time[MSTRTIME_MAX_SIZE];
...@@ -942,48 +877,15 @@ void MainInterface::setName( QString name ) ...@@ -942,48 +877,15 @@ void MainInterface::setName( QString name )
void MainInterface::setStatus( int status ) void MainInterface::setStatus( int status )
{ {
if( status == 1 ) // Playing controls->setStatus( status );
ui.playButton->setIcon( QIcon( ":/pixmaps/pause.png" ) );
else
ui.playButton->setIcon( QIcon( ":/pixmaps/play.png" ) );
if( systrayMenu ) if( systrayMenu )
updateSystrayMenu( status ); updateSystrayMenu( status );
} }
#define HELP_MENU N_("Menu")
#define HELP_PCH N_("Previous chapter")
#define HELP_NCH N_("Next chapter")
#define HELP_PTR N_("Previous track")
#define HELP_NTR N_("Next track")
void MainInterface::setNavigation( int navigation )
{
// 1 = chapter, 2 = title, 0 = no
if( navigation == 0 )
{
ui.discFrame->hide();
} else if( navigation == 1 ) {
ui.prevSectionButton->show();
ui.prevSectionButton->setToolTip( qfu(HELP_PCH) );
ui.nextSectionButton->show();
ui.nextSectionButton->setToolTip( qfu(HELP_NCH) );
ui.menuButton->show();
ui.discFrame->show();
} else {
ui.prevSectionButton->show();
ui.prevSectionButton->setToolTip( qfu(HELP_PCH) );
ui.nextSectionButton->show();
ui.nextSectionButton->setToolTip( qfu(HELP_NCH) );
ui.menuButton->hide();
ui.discFrame->show();
}
}
static bool b_my_volume;
void MainInterface::updateOnTimer() void MainInterface::updateOnTimer()
{ {
/* \todo Make this event-driven */ /* \todo Make this event-driven */
// TO MOVE TO controls
advControls->enableInput( THEMIM->getIM()->hasInput() ); advControls->enableInput( THEMIM->getIM()->hasInput() );
advControls->enableVideo( THEMIM->getIM()->hasVideo() ); advControls->enableVideo( THEMIM->getIM()->hasVideo() );
...@@ -998,17 +900,7 @@ void MainInterface::updateOnTimer() ...@@ -998,17 +900,7 @@ void MainInterface::updateOnTimer()
need_components_update = false; need_components_update = false;
} }
audio_volume_t i_volume; controls->updateOnTimer();
aout_VolumeGet( p_intf, &i_volume );
i_volume = (i_volume * 200 )/ AOUT_VOLUME_MAX ;
int i_gauge = ui.volumeSlider->value();
b_my_volume = false;
if( i_volume - i_gauge > 1 || i_gauge - i_volume > 1 )
{
b_my_volume = true;
ui.volumeSlider->setValue( i_volume );
b_my_volume = false;
}
} }
void MainInterface::closeEvent( QCloseEvent *e ) void MainInterface::closeEvent( QCloseEvent *e )
...@@ -1017,16 +909,6 @@ void MainInterface::closeEvent( QCloseEvent *e ) ...@@ -1017,16 +909,6 @@ void MainInterface::closeEvent( QCloseEvent *e )
vlc_object_kill( p_intf ); vlc_object_kill( p_intf );
} }
void MainInterface::updateVolume( int sliderVolume )
{
if( !b_my_volume )
{
int i_res = sliderVolume * AOUT_VOLUME_MAX /
(2*ui.volumeSlider->maximum() );
aout_VolumeSet( p_intf, i_res );
}
}
static int InteractCallback( vlc_object_t *p_this, static int InteractCallback( vlc_object_t *p_this,
const char *psz_var, vlc_value_t old_val, const char *psz_var, vlc_value_t old_val,
vlc_value_t new_val, void *param ) vlc_value_t new_val, void *param )
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* $Id$ * $Id$
* *
* Authors: Clément Stenac <zorglub@videolan.org> * Authors: Clément Stenac <zorglub@videolan.org>
* Jean-Baptiste Kempf <jb@videolan.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
...@@ -39,12 +40,11 @@ class QKeyEvent; ...@@ -39,12 +40,11 @@ class QKeyEvent;
class QLabel; class QLabel;
class QEvent; class QEvent;
class InputManager; class InputManager;
class InputSlider;
class VideoWidget; class VideoWidget;
class BackgroundWidget; class BackgroundWidget;
class PlaylistWidget; class PlaylistWidget;
class VolumeClickHandler;
class VisualSelector; class VisualSelector;
class AdvControlsWidget;
class ControlsWidget; class ControlsWidget;
class QMenu; class QMenu;
class QSize; class QSize;
...@@ -70,7 +70,7 @@ protected: ...@@ -70,7 +70,7 @@ protected:
void dragMoveEvent( QDragMoveEvent * ); void dragMoveEvent( QDragMoveEvent * );
void dragLeaveEvent( QDragLeaveEvent * ); void dragLeaveEvent( QDragLeaveEvent * );
void closeEvent( QCloseEvent *); void closeEvent( QCloseEvent *);
Ui::MainInterfaceUI ui; //Ui::MainInterfaceUI ui;
friend class VolumeClickHandler; friend class VolumeClickHandler;
private: private:
QSettings *settings; QSettings *settings;
...@@ -78,6 +78,8 @@ private: ...@@ -78,6 +78,8 @@ private:
QSystemTrayIcon *sysTray; QSystemTrayIcon *sysTray;
QMenu *systrayMenu; QMenu *systrayMenu;
QString input_name; QString input_name;
QVBoxLayout *mainLayout;
ControlsWidget *controls;
bool need_components_update; bool need_components_update;
void calculateInterfaceSize(); void calculateInterfaceSize();
...@@ -98,7 +100,7 @@ private: ...@@ -98,7 +100,7 @@ private:
BackgroundWidget *bgWidget; BackgroundWidget *bgWidget;
VisualSelector *visualSelector; VisualSelector *visualSelector;
ControlsWidget *advControls; AdvControlsWidget *advControls;
PlaylistWidget *playlistWidget; PlaylistWidget *playlistWidget;
bool playlistEmbeddedFlag; bool playlistEmbeddedFlag;
...@@ -108,7 +110,6 @@ private: ...@@ -108,7 +110,6 @@ private:
bool visualSelectorEnabled; bool visualSelectorEnabled;
InputManager *main_input_manager; InputManager *main_input_manager;
InputSlider *slider;
input_thread_t *p_input; ///< Main input associated to the playlist input_thread_t *p_input; ///< Main input associated to the playlist
QLabel *timeLabel; QLabel *timeLabel;
...@@ -122,19 +123,13 @@ public slots: ...@@ -122,19 +123,13 @@ public slots:
void playlist(); void playlist();
void toggleUpdateSystrayMenu(); void toggleUpdateSystrayMenu();
private slots: private slots:
void setNavigation( int );
void setStatus( int ); void setStatus( int );
void setName( QString ); void setName( QString );
void setVLCWindowsTitle( QString title = "" ); void setVLCWindowsTitle( QString title = "" );
void setDisplay( float, int, int ); void setDisplay( float, int, int );
void updateOnTimer(); void updateOnTimer();
void play();
void stop();
void prev();
void next();
void visual(); void visual();
void advanced(); void advanced();
void updateVolume( int sliderVolume );
void handleSystrayClick( QSystemTrayIcon::ActivationReason ); void handleSystrayClick( QSystemTrayIcon::ActivationReason );
void updateSystrayMenu( int ); void updateSystrayMenu( int );
void updateSystrayTooltipName( QString ); void updateSystrayTooltipName( QString );
...@@ -143,25 +138,4 @@ private slots: ...@@ -143,25 +138,4 @@ private slots:
void showTimeMenu( QPoint ); void showTimeMenu( QPoint );
}; };
class VolumeClickHandler : public QObject
{
public:
VolumeClickHandler( intf_thread_t *_p_intf, MainInterface *_m ) :QObject(_m)
{m = _m; p_intf = _p_intf; }
virtual ~VolumeClickHandler() {};
bool eventFilter( QObject *obj, QEvent *e )
{
if (e->type() == QEvent::MouseButtonPress )
{
aout_VolumeMute( p_intf, NULL );
return true;
}
return false;
}
private:
MainInterface *m;
intf_thread_t *p_intf;
};
#endif #endif
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