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