#include <QSize>
#include <QMenu>
#include <QLabel>
+#include <QSlider>
+#include <QWidgetAction>
#include <assert.h>
#include <vlc_keys.h>
#ifdef WIN32
#define PREF_W 410
- #define PREF_H 121
+ #define PREF_H 151
#else
- #define PREF_W 450
- #define PREF_H 160
+ #define PREF_W 400
+ #define PREF_H 140
#endif
#define SET_WIDTH(i,j) i->widgetSize.setWidth(j)
/**
* Configuration and settings
**/
- settings = new QSettings( "VideoLAN", "VLC" );
+ settings = new QSettings( "vlc", "vlc-qt-interface" );
settings->beginGroup( "MainWindow" );
/* Main settings */
/* Menu Bar */
QVLCMenu::createMenuBar( this, p_intf, playlistEmbeddedFlag,
- isAdvancedVisible(), visualSelectorEnabled );
+ visualSelectorEnabled );
/* Status Bar */
/**
/**
* TODO: do we add a label for the current Volume ?
**/
- timeLabel = new QLabel;
+ b_remainingTime = false;
+ timeLabel = new TimeLabel;
nameLabel = new QLabel;
- speedLabel = new QLabel( "1.0x" );
+ speedLabel = new QLabel( "1.00x" );
timeLabel->setFrameStyle( QFrame::Sunken | QFrame::Panel );
speedLabel->setFrameStyle( QFrame::Sunken | QFrame::Panel );
statusBar()->addWidget( nameLabel, 8 );
statusBar()->addPermanentWidget( timeLabel, 2 );
speedLabel->setContextMenuPolicy ( Qt::CustomContextMenu );
timeLabel->setContextMenuPolicy ( Qt::CustomContextMenu );
+ CONNECT( timeLabel, timeLabelClicked(), this, toggleTimeDisplay() );
CONNECT( speedLabel, customContextMenuRequested( QPoint ),
this, showSpeedMenu( QPoint ) );
CONNECT( timeLabel, customContextMenuRequested( QPoint ),
/* Connect the input manager to the GUI elements it manages */
/* It is also connected to the control->slider, see the ControlsWidget */
CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ),
- this, setDisplay( float, int, int ) );
+ this, setDisplayPosition( float, int, int ) );
+
+ CONNECT( THEMIM->getIM(), rateChanged( int ), this, setRate( int ) );
/** Connects on nameChanged() */
/* Naming in the controller statusbar */
}
settings->setValue( "playlist-embedded", playlistEmbeddedFlag );
- settings->setValue( "adv-controls", isAdvancedVisible() );
+ settings->setValue( "adv-controls", getControlsVisibilityStatus() & 0x1 );
settings->setValue( "pos", pos() );
settings->endGroup();
delete settings;
}
}
+
void MainInterface::handleMainUi( QSettings *settings )
{
/* Create the main Widget and the mainLayout */
/* Add the controls Widget to the main Widget */
mainLayout->addWidget( controls );
+ /* Create the Speed Control Widget */
+ speedControl = new SpeedControlWidget( p_intf );
+ speedControlMenu = new QMenu( this );
+ QWidgetAction *widgetAction = new QWidgetAction( this );
+ widgetAction->setDefaultWidget( speedControl );
+ speedControlMenu->addAction( widgetAction );
/* Set initial size */
resize( PREF_W, PREF_H );
****************************************************************************/
void MainInterface::showSpeedMenu( QPoint pos )
{
- QMenu menu( this );
- menu.addAction( "Not Implemented Yet" );
- menu.exec( QCursor::pos() );
+ speedControlMenu->exec( QCursor::pos() - pos + QPoint( 0, speedLabel->height() ) );
}
void MainInterface::showTimeMenu( QPoint pos )
{
QMenu menu( this );
- menu.addAction( "Not Implemented Yet" );
- menu.exec( QCursor::pos() );
+ menu.addAction( qtr("Elapsed Time") , this, SLOT( setElapsedTime() ) );
+ menu.addAction( qtr("Remaining Time") , this, SLOT( setRemainTime() ) );
+ menu.exec( QCursor::pos() - pos +QPoint( 0, timeLabel->height() ) );
}
/****************************************************************************
// videoWidget->widgetSize = bgWidget->widgeTSize;
videoWidget->widgetSize = QSize( *pi_width, *pi_height );
}
-// videoWidget->updateGeometry(); /// FIXME: Needed ?
+ videoWidget->updateGeometry(); // Needed for deinterlace
need_components_update = true;
}
return ret;
playlistEmbeddedFlag = false;
menuBar()->clear();
- QVLCMenu::createMenuBar( this, p_intf, false, isAdvancedVisible(),
- visualSelectorEnabled);
+ QVLCMenu::createMenuBar( this, p_intf, false, visualSelectorEnabled);
if( videoIsActive )
{
void MainInterface::toggleMenus()
{
- msg_Dbg( p_intf, "I HAS HERE, HIDING YOUR MENUZ: \\_o<~~ coin coin" );
TOGGLEV( controls );
TOGGLEV( statusBar() );
updateGeometry();
controls->toggleAdvanced();
}
-bool MainInterface::isAdvancedVisible()
+int MainInterface::getControlsVisibilityStatus()
{
- return controls->b_advancedVisible;
+ return( (controls->isVisible() ? 0x2 : 0x0 )
+ + controls->b_advancedVisible );
}
/************************************************************************
* Other stuff
************************************************************************/
-void MainInterface::setDisplay( float pos, int time, int length )
+void MainInterface::setDisplayPosition( float pos, int time, int length )
{
char psz_length[MSTRTIME_MAX_SIZE], psz_time[MSTRTIME_MAX_SIZE];
secstotimestr( psz_length, length );
- secstotimestr( psz_time, time );
- QString title;
- title.sprintf( "%s/%s", psz_time, psz_length );
- timeLabel->setText( " "+title+" " );
+ secstotimestr( psz_time, b_remainingTime ? length - time : time );
+ QString title; title.sprintf( "%s/%s", psz_time, psz_length );
+ if( b_remainingTime ) timeLabel->setText( " -"+title+" " );
+ else timeLabel->setText( " "+title+" " );
}
+void MainInterface::toggleTimeDisplay()
+{
+ b_remainingTime = ( b_remainingTime ? false : true );
+}
+
+void MainInterface::setElapsedTime(){ b_remainingTime = false; }
+void MainInterface::setRemainTime(){ b_remainingTime = true; }
+
void MainInterface::setName( QString name )
{
input_name = name;
updateSystrayMenu( status );
}
+void MainInterface::setRate( int rate )
+{
+ QString str;
+ str.setNum( ( 1000 / (double)rate), 'f', 2 );
+ str.append( "x" );
+ speedLabel->setText( str );
+ speedControl->updateControls( rate );
+}
+
void MainInterface::updateOnTimer()
{
/* \todo Make this event-driven */
QVLCMenu::updateSystrayMenu( this, p_intf, true );
sysTray->show();
- CONNECT( sysTray, activated( QSystemTrayIcon::ActivationReason ),
+ CONNECT( sysTray, activated( QSystemTrayIcon::ActivationReason ),
this, handleSystrayClick( QSystemTrayIcon::ActivationReason ) );
}
show();
activateWindow();
}
+ else if( isMinimized() )
+ {
+ showNormal();
+ activateWindow();
+ }
else
{
#ifdef WIN32
PlaylistDialog::killInstance();
playlistEmbeddedFlag = true;
menuBar()->clear();
- QVLCMenu::createMenuBar(this, p_intf, true, isAdvancedVisible(),
- visualSelectorEnabled);
+ QVLCMenu::createMenuBar(this, p_intf, true, visualSelectorEnabled);
togglePlaylist();
}
else if ( event->type() == SetVideoOnTopEvent_Type )