Commit a23552a9 authored by Clément Stenac's avatar Clément Stenac

[Untested] Save interface position

parent 8f270cb5
...@@ -32,8 +32,10 @@ PlaylistDialog::PlaylistDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf ) ...@@ -32,8 +32,10 @@ PlaylistDialog::PlaylistDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf, playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf,
VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
new StandardPLPanel( this, p_intf, p_playlist, p_playlist->p_root_category ); new StandardPLPanel( this, p_intf, p_playlist, p_playlist->p_root_category );
readSettings( "playlist", QSize( 500,500 ) );
} }
PlaylistDialog::~PlaylistDialog() PlaylistDialog::~PlaylistDialog()
{ {
writeSettings( "playlist" );
} }
...@@ -31,11 +31,9 @@ ...@@ -31,11 +31,9 @@
#include <assert.h> #include <assert.h>
#include <QPushButton> #include <QPushButton>
MainInterface::MainInterface( intf_thread_t *_p_intf ) : QMainWindow(), MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
p_intf( _p_intf )
{ {
/* All UI stuff */ /* All UI stuff */
QVLCFrame::fixStyle( this );
QWidget *main = new QWidget( this ); QWidget *main = new QWidget( this );
setCentralWidget( main ); setCentralWidget( main );
setWindowTitle( QString::fromUtf8( _("VLC media player") ) ); setWindowTitle( QString::fromUtf8( _("VLC media player") ) );
...@@ -56,16 +54,14 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QMainWindow(), ...@@ -56,16 +54,14 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QMainWindow(),
ui.volLowLabel->setPixmap( QPixmap( ":/pixmaps/volume-low.png" ) ); ui.volLowLabel->setPixmap( QPixmap( ":/pixmaps/volume-low.png" ) );
ui.volHighLabel->setPixmap( QPixmap( ":/pixmaps/volume-high.png" ) ); ui.volHighLabel->setPixmap( QPixmap( ":/pixmaps/volume-high.png" ) );
// if( config_GetInt( p_intf, "embedded" ) ) // if( config_GetInt( p_intf, "embedded" ) )
{ {
videoWidget = new VideoWidget( p_intf ); videoWidget = new VideoWidget( p_intf );
videoWidget->resize( 1,1 ); videoWidget->resize( 1,1 );
ui.vboxLayout->insertWidget( 0, videoWidget ); ui.vboxLayout->insertWidget( 0, videoWidget );
} }
resize( QSize( 500, 121 ) );
i_saved_width = width(); readSettings( "MainWindow" , QSize( 500, 131) );
i_saved_height = height();
//QVLCMenu::createMenuBar(); //QVLCMenu::createMenuBar();
......
...@@ -26,14 +26,13 @@ ...@@ -26,14 +26,13 @@
#include <vlc/intf.h> #include <vlc/intf.h>
#include "ui/main_interface.h" #include "ui/main_interface.h"
#include "util/qvlcframe.hpp" #include "util/qvlcframe.hpp"
#include <QMainWindow>
class InputManager; class InputManager;
class QCloseEvent; class QCloseEvent;
class InputSlider; class InputSlider;
class VideoWidget; class VideoWidget;
class MainInterface : public QMainWindow class MainInterface : public QVLCMW
{ {
Q_OBJECT; Q_OBJECT;
public: public:
......
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
#include <QWidget> #include <QWidget>
#include <QApplication> #include <QApplication>
#include <QSettings>
#include <QMainWindow>
#include <QPlastiqueStyle> #include <QPlastiqueStyle>
#include <vlc/vlc.h> #include <vlc/vlc.h>
...@@ -52,7 +54,7 @@ public: ...@@ -52,7 +54,7 @@ public:
QVLCFrame( intf_thread_t *_p_intf ) : QWidget( NULL ), p_intf( _p_intf ) QVLCFrame( intf_thread_t *_p_intf ) : QWidget( NULL ), p_intf( _p_intf )
{ {
fixStyle( this ); fixStyle( this );
}; };
virtual ~QVLCFrame() {}; virtual ~QVLCFrame() {};
void toggleVisible() void toggleVisible()
...@@ -62,5 +64,54 @@ public: ...@@ -62,5 +64,54 @@ public:
} }
protected: protected:
intf_thread_t *p_intf; intf_thread_t *p_intf;
void readSettings( QString name, QSize defSize )
{
QSettings settings( "VideoLAN", "VLC" );
settings.beginGroup( name );
resize( settings.value( "size", defSize ).toSize() );
move( settings.value( "pos", QPoint( 0,0 ) ).toPoint() );
settings.endGroup();
}
void writeSettings( QString name )
{
QSettings settings( "VideoLAN", "VLC" );
settings.beginGroup( name );
settings.setValue ("size", size() );
settings.setValue( "pos", pos() );
settings.endGroup();
}
}; };
class QVLCMW : public QMainWindow
{
public:
QVLCMW( intf_thread_t *_p_intf ) : QMainWindow( NULL ), p_intf( _p_intf )
{
QVLCFrame::fixStyle( this );
}
virtual ~QVLCMW() {};
protected:
intf_thread_t *p_intf;
QSize mainSize;
void readSettings( QString name, QSize defSize )
{
QSettings settings( "VideoLAN", "VLC" );
settings.beginGroup( name );
mainSize = settings.value( "size", defSize ).toSize();
resize( mainSize );
move( settings.value( "pos", QPoint( 0,0 ) ).toPoint() );
settings.endGroup();
}
void writeSettings( QString name )
{
QSettings settings( "VideoLAN", "VLC" );
settings.beginGroup( name );
settings.setValue ("size", size() );
settings.setValue( "pos", pos() );
settings.endGroup();
}
};
#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