Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
47392467
Commit
47392467
authored
Jul 29, 2008
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stop allocating QSettings all the time everywhere.
parent
8462c96d
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
60 additions
and
62 deletions
+60
-62
modules/gui/qt4/components/open_panels.cpp
modules/gui/qt4/components/open_panels.cpp
+2
-5
modules/gui/qt4/components/playlist/playlist.cpp
modules/gui/qt4/components/playlist/playlist.cpp
+4
-5
modules/gui/qt4/components/playlist/playlist.hpp
modules/gui/qt4/components/playlist/playlist.hpp
+2
-3
modules/gui/qt4/components/playlist/playlist_item.cpp
modules/gui/qt4/components/playlist/playlist_item.cpp
+9
-5
modules/gui/qt4/components/playlist/playlist_item.hpp
modules/gui/qt4/components/playlist/playlist_item.hpp
+3
-1
modules/gui/qt4/components/playlist/playlist_model.cpp
modules/gui/qt4/components/playlist/playlist_model.cpp
+2
-3
modules/gui/qt4/dialogs/playlist.cpp
modules/gui/qt4/dialogs/playlist.cpp
+8
-10
modules/gui/qt4/dialogs/playlist.hpp
modules/gui/qt4/dialogs/playlist.hpp
+0
-1
modules/gui/qt4/main_interface.cpp
modules/gui/qt4/main_interface.cpp
+3
-4
modules/gui/qt4/qt4.cpp
modules/gui/qt4/qt4.cpp
+4
-3
modules/gui/qt4/qt4.hpp
modules/gui/qt4/qt4.hpp
+5
-0
modules/gui/qt4/util/qvlcframe.hpp
modules/gui/qt4/util/qvlcframe.hpp
+18
-22
No files found.
modules/gui/qt4/components/open_panels.cpp
View file @
47392467
...
@@ -44,7 +44,6 @@
...
@@ -44,7 +44,6 @@
#include <QDirModel>
#include <QDirModel>
#include <QScrollArea>
#include <QScrollArea>
#include <QUrl>
#include <QUrl>
#include <QSettings>
#define I_DEVICE_TOOLTIP "Select the device or the VIDEO_TS directory"
#define I_DEVICE_TOOLTIP "Select the device or the VIDEO_TS directory"
...
@@ -78,9 +77,8 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
...
@@ -78,9 +77,8 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
dialogBox
->
setFileMode
(
QFileDialog
::
ExistingFiles
);
dialogBox
->
setFileMode
(
QFileDialog
::
ExistingFiles
);
dialogBox
->
setAcceptMode
(
QFileDialog
::
AcceptOpen
);
dialogBox
->
setAcceptMode
(
QFileDialog
::
AcceptOpen
);
#if HAS_QT43
#if HAS_QT43
QSettings
settings
(
"vlc"
,
"vlc-qt-interface"
);
dialogBox
->
restoreState
(
dialogBox
->
restoreState
(
settings
.
value
(
"file-dialog-state"
).
toByteArray
()
);
getSettings
()
->
value
(
"file-dialog-state"
).
toByteArray
()
);
#endif
#endif
/* We don't want to see a grip in the middle of the window, do we? */
/* We don't want to see a grip in the middle of the window, do we? */
...
@@ -145,8 +143,7 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
...
@@ -145,8 +143,7 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
FileOpenPanel
::~
FileOpenPanel
()
FileOpenPanel
::~
FileOpenPanel
()
{
{
#if HAS_QT43
#if HAS_QT43
QSettings
settings
(
"vlc"
,
"vlc-qt-interface"
);
getSettings
()
->
setValue
(
"file-dialog-state"
,
dialogBox
->
saveState
()
);
settings
.
setValue
(
"file-dialog-state"
,
dialogBox
->
saveState
()
);
#endif
#endif
}
}
...
...
modules/gui/qt4/components/playlist/playlist.cpp
View file @
47392467
...
@@ -43,7 +43,6 @@
...
@@ -43,7 +43,6 @@
**********************************************************************/
**********************************************************************/
PlaylistWidget
::
PlaylistWidget
(
intf_thread_t
*
_p_i
,
PlaylistWidget
::
PlaylistWidget
(
intf_thread_t
*
_p_i
,
QSettings
*
settings
,
QWidget
*
_parent
)
QWidget
*
_parent
)
:
p_intf
(
_p_i
),
parent
(
_parent
)
:
p_intf
(
_p_i
),
parent
(
_parent
)
{
{
...
@@ -122,8 +121,8 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i,
...
@@ -122,8 +121,8 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i,
/* In case we want to keep the splitter informations */
/* In case we want to keep the splitter informations */
// components shall never write there setting to a fixed location, may infer
// components shall never write there setting to a fixed location, may infer
// with other uses of the same component...
// with other uses of the same component...
//
settings
->beginGroup( "playlist" );
//
getSettings()
->beginGroup( "playlist" );
restoreState
(
settings
->
value
(
"splitterSizes"
).
toByteArray
());
restoreState
(
getSettings
()
->
value
(
"splitterSizes"
).
toByteArray
());
}
}
void
PlaylistWidget
::
setArt
(
QString
url
)
void
PlaylistWidget
::
setArt
(
QString
url
)
...
@@ -143,8 +142,8 @@ QSize PlaylistWidget::sizeHint() const
...
@@ -143,8 +142,8 @@ QSize PlaylistWidget::sizeHint() const
PlaylistWidget
::~
PlaylistWidget
()
PlaylistWidget
::~
PlaylistWidget
()
{}
{}
void
PlaylistWidget
::
savingSettings
(
QSettings
*
settings
)
void
PlaylistWidget
::
savingSettings
()
{
{
settings
->
setValue
(
"splitterSizes"
,
saveState
()
);
getSettings
()
->
setValue
(
"splitterSizes"
,
saveState
()
);
}
}
modules/gui/qt4/components/playlist/playlist.hpp
View file @
47392467
...
@@ -40,16 +40,15 @@
...
@@ -40,16 +40,15 @@
class
PLSelector
;
class
PLSelector
;
class
PLPanel
;
class
PLPanel
;
class
QPushButton
;
class
QPushButton
;
class
QSettings
;
class
PlaylistWidget
:
public
QSplitter
class
PlaylistWidget
:
public
QSplitter
{
{
Q_OBJECT
;
Q_OBJECT
;
public:
public:
PlaylistWidget
(
intf_thread_t
*
_p_i
,
Q
Settings
*
settings
,
Q
Widget
*
parent
)
;
PlaylistWidget
(
intf_thread_t
*
_p_i
,
QWidget
*
parent
)
;
virtual
~
PlaylistWidget
();
virtual
~
PlaylistWidget
();
QSize
sizeHint
()
const
;
QSize
sizeHint
()
const
;
void
savingSettings
(
QSettings
*
settings
);
void
savingSettings
();
private:
private:
PLSelector
*
selector
;
PLSelector
*
selector
;
PLPanel
*
rightPanel
;
PLPanel
*
rightPanel
;
...
...
modules/gui/qt4/components/playlist/playlist_item.cpp
View file @
47392467
...
@@ -48,7 +48,7 @@
...
@@ -48,7 +48,7 @@
*/
*/
void
PLItem
::
init
(
int
_i_id
,
int
_i_input_id
,
PLItem
*
parent
,
PLModel
*
m
)
void
PLItem
::
init
(
int
_i_id
,
int
_i_input_id
,
PLItem
*
parent
,
PLModel
*
m
,
QSettings
*
settings
)
{
{
parentItem
=
parent
;
/* Can be NULL, but only for the rootItem */
parentItem
=
parent
;
/* Can be NULL, but only for the rootItem */
i_id
=
_i_id
;
/* Playlist item specific id */
i_id
=
_i_id
;
/* Playlist item specific id */
...
@@ -68,8 +68,7 @@ void PLItem::init( int _i_id, int _i_input_id, PLItem *parent, PLModel *m )
...
@@ -68,8 +68,7 @@ void PLItem::init( int _i_id, int _i_input_id, PLItem *parent, PLModel *m )
}
}
else
else
{
{
QSettings
settings
(
"vlc"
,
"vlc-qt-interface"
);
i_showflags
=
settings
->
value
(
"qt-pl-showflags"
,
39
).
toInt
();
i_showflags
=
settings
.
value
(
"qt-pl-showflags"
,
39
).
toInt
();
if
(
i_showflags
<
1
)
if
(
i_showflags
<
1
)
i_showflags
=
39
;
/* reasonable default to show something; */
i_showflags
=
39
;
/* reasonable default to show something; */
else
if
(
i_showflags
>=
COLUMN_END
)
else
if
(
i_showflags
>=
COLUMN_END
)
...
@@ -93,12 +92,17 @@ void PLItem::init( int _i_id, int _i_input_id, PLItem *parent, PLModel *m )
...
@@ -93,12 +92,17 @@ void PLItem::init( int _i_id, int _i_input_id, PLItem *parent, PLModel *m )
*/
*/
PLItem
::
PLItem
(
int
_i_id
,
int
_i_input_id
,
PLItem
*
parent
,
PLModel
*
m
)
PLItem
::
PLItem
(
int
_i_id
,
int
_i_input_id
,
PLItem
*
parent
,
PLModel
*
m
)
{
{
init
(
_i_id
,
_i_input_id
,
parent
,
m
);
init
(
_i_id
,
_i_input_id
,
parent
,
m
,
NULL
);
}
}
PLItem
::
PLItem
(
playlist_item_t
*
p_item
,
PLItem
*
parent
,
PLModel
*
m
)
PLItem
::
PLItem
(
playlist_item_t
*
p_item
,
PLItem
*
parent
,
PLModel
*
m
)
{
{
init
(
p_item
->
i_id
,
p_item
->
p_input
->
i_id
,
parent
,
m
);
init
(
p_item
->
i_id
,
p_item
->
p_input
->
i_id
,
parent
,
m
,
NULL
);
}
PLItem
::
PLItem
(
playlist_item_t
*
p_item
,
QSettings
*
settings
,
PLModel
*
m
)
{
init
(
p_item
->
i_id
,
p_item
->
p_input
->
i_id
,
NULL
,
m
,
settings
);
}
}
PLItem
::~
PLItem
()
PLItem
::~
PLItem
()
...
...
modules/gui/qt4/components/playlist/playlist_item.hpp
View file @
47392467
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
#include <QString>
#include <QString>
#include <QList>
#include <QList>
class
QSettings
;
class
PLModel
;
class
PLModel
;
class
PLItem
class
PLItem
...
@@ -44,6 +45,7 @@ class PLItem
...
@@ -44,6 +45,7 @@ class PLItem
public:
public:
PLItem
(
int
,
int
,
PLItem
*
parent
,
PLModel
*
);
PLItem
(
int
,
int
,
PLItem
*
parent
,
PLModel
*
);
PLItem
(
playlist_item_t
*
,
PLItem
*
parent
,
PLModel
*
);
PLItem
(
playlist_item_t
*
,
PLItem
*
parent
,
PLModel
*
);
PLItem
(
playlist_item_t
*
,
QSettings
*
,
PLModel
*
);
~
PLItem
();
~
PLItem
();
int
row
()
const
;
int
row
()
const
;
...
@@ -75,7 +77,7 @@ protected:
...
@@ -75,7 +77,7 @@ protected:
int
i_showflags
;
int
i_showflags
;
private:
private:
void
init
(
int
,
int
,
PLItem
*
,
PLModel
*
);
void
init
(
int
,
int
,
PLItem
*
,
PLModel
*
,
QSettings
*
);
void
updateColumnHeaders
();
void
updateColumnHeaders
();
PLItem
*
parentItem
;
PLItem
*
parentItem
;
PLModel
*
model
;
PLModel
*
model
;
...
...
modules/gui/qt4/components/playlist/playlist_model.cpp
View file @
47392467
...
@@ -98,8 +98,7 @@ PLModel::PLModel( playlist_t *_p_playlist, /* THEPL */
...
@@ -98,8 +98,7 @@ PLModel::PLModel( playlist_t *_p_playlist, /* THEPL */
PLModel
::~
PLModel
()
PLModel
::~
PLModel
()
{
{
QSettings
settings
(
"vlc"
,
"vlc-qt-interface"
);
getSettings
()
->
setValue
(
"qt-pl-showflags"
,
rootItem
->
i_showflags
);
settings
.
setValue
(
"qt-pl-showflags"
,
rootItem
->
i_showflags
);
delCallbacks
();
delCallbacks
();
delete
rootItem
;
delete
rootItem
;
}
}
...
@@ -591,7 +590,7 @@ void PLModel::rebuild( playlist_item_t *p_root )
...
@@ -591,7 +590,7 @@ void PLModel::rebuild( playlist_item_t *p_root )
if
(
p_root
)
if
(
p_root
)
{
{
delete
rootItem
;
delete
rootItem
;
rootItem
=
new
PLItem
(
p_root
,
NULL
,
this
);
rootItem
=
new
PLItem
(
p_root
,
getSettings
()
,
this
);
}
}
assert
(
rootItem
);
assert
(
rootItem
);
/* Recreate from root */
/* Recreate from root */
...
...
modules/gui/qt4/dialogs/playlist.cpp
View file @
47392467
...
@@ -50,26 +50,24 @@ PlaylistDialog::PlaylistDialog( intf_thread_t *_p_intf )
...
@@ -50,26 +50,24 @@ PlaylistDialog::PlaylistDialog( intf_thread_t *_p_intf )
QHBoxLayout
*
l
=
new
QHBoxLayout
(
centralWidget
()
);
QHBoxLayout
*
l
=
new
QHBoxLayout
(
centralWidget
()
);
settings
=
new
QSettings
(
"vlc"
,
"vlc-qt-interface"
);
getSettings
()
->
beginGroup
(
"playlistdialog"
);
settings
->
beginGroup
(
"playlistdialog"
);
playlistWidget
=
new
PlaylistWidget
(
p_intf
,
settings
,
this
);
playlistWidget
=
new
PlaylistWidget
(
p_intf
,
this
);
l
->
addWidget
(
playlistWidget
);
l
->
addWidget
(
playlistWidget
);
readSettings
(
settings
,
QSize
(
600
,
700
)
);
readSettings
(
getSettings
()
,
QSize
(
600
,
700
)
);
settings
->
endGroup
();
getSettings
()
->
endGroup
();
}
}
PlaylistDialog
::~
PlaylistDialog
()
PlaylistDialog
::~
PlaylistDialog
()
{
{
settings
->
beginGroup
(
"playlistdialog"
);
getSettings
()
->
beginGroup
(
"playlistdialog"
);
writeSettings
(
settings
);
writeSettings
(
getSettings
()
);
playlistWidget
->
savingSettings
(
settings
);
playlistWidget
->
savingSettings
();
settings
->
endGroup
();
getSettings
()
->
endGroup
();
delete
settings
;
}
}
void
PlaylistDialog
::
dropEvent
(
QDropEvent
*
event
)
void
PlaylistDialog
::
dropEvent
(
QDropEvent
*
event
)
...
...
modules/gui/qt4/dialogs/playlist.hpp
View file @
47392467
...
@@ -39,7 +39,6 @@ class PlaylistDialog : public QVLCMW
...
@@ -39,7 +39,6 @@ class PlaylistDialog : public QVLCMW
Q_OBJECT
;
Q_OBJECT
;
private:
private:
PlaylistWidget
*
playlistWidget
;
PlaylistWidget
*
playlistWidget
;
QSettings
*
settings
;
public:
public:
static
PlaylistDialog
*
getInstance
(
intf_thread_t
*
p_intf
)
static
PlaylistDialog
*
getInstance
(
intf_thread_t
*
p_intf
)
...
...
modules/gui/qt4/main_interface.cpp
View file @
47392467
...
@@ -110,7 +110,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
...
@@ -110,7 +110,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
i_visualmode
=
config_GetInt
(
p_intf
,
"qt-display-mode"
);
i_visualmode
=
config_GetInt
(
p_intf
,
"qt-display-mode"
);
/* Set the other interface settings */
/* Set the other interface settings */
settings
=
new
QSettings
(
"vlc"
,
"vlc-qt-interface"
);
settings
=
getSettings
(
);
settings
->
beginGroup
(
"MainWindow"
);
settings
->
beginGroup
(
"MainWindow"
);
//TODO: I don't like that code
//TODO: I don't like that code
...
@@ -224,7 +224,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
...
@@ -224,7 +224,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
CONNECT
(
this
,
askUpdate
(),
this
,
doComponentsUpdate
()
);
CONNECT
(
this
,
askUpdate
(),
this
,
doComponentsUpdate
()
);
/* Size and placement of interface */
/* Size and placement of interface */
QVLCTools
::
restoreWidgetPosition
(
settings
,
this
,
QSize
(
350
,
60
)
);
QVLCTools
::
restoreWidgetPosition
(
settings
,
this
,
QSize
(
380
,
60
)
);
/* Playlist */
/* Playlist */
...
@@ -250,7 +250,7 @@ MainInterface::~MainInterface()
...
@@ -250,7 +250,7 @@ MainInterface::~MainInterface()
msg_Dbg
(
p_intf
,
"Destroying the main interface"
);
msg_Dbg
(
p_intf
,
"Destroying the main interface"
);
if
(
playlistWidget
)
if
(
playlistWidget
)
playlistWidget
->
savingSettings
(
settings
);
playlistWidget
->
savingSettings
();
settings
->
beginGroup
(
"MainWindow"
);
settings
->
beginGroup
(
"MainWindow"
);
...
@@ -266,7 +266,6 @@ MainInterface::~MainInterface()
...
@@ -266,7 +266,6 @@ MainInterface::~MainInterface()
settings
->
setValue
(
"backgroundSize"
,
bgWidget
->
size
()
);
settings
->
setValue
(
"backgroundSize"
,
bgWidget
->
size
()
);
settings
->
endGroup
();
settings
->
endGroup
();
delete
settings
;
var_DelCallback
(
p_intf
->
p_libvlc
,
"intf-show"
,
IntfShowCB
,
p_intf
);
var_DelCallback
(
p_intf
->
p_libvlc
,
"intf-show"
,
IntfShowCB
,
p_intf
);
...
...
modules/gui/qt4/qt4.cpp
View file @
47392467
...
@@ -244,6 +244,7 @@ static int Open( vlc_object_t *p_this )
...
@@ -244,6 +244,7 @@ static int Open( vlc_object_t *p_this )
p_intf
->
p_sys
->
p_playlist
=
pl_Yield
(
p_intf
);
p_intf
->
p_sys
->
p_playlist
=
pl_Yield
(
p_intf
);
/* Listen to the messages */
/* Listen to the messages */
p_intf
->
p_sys
->
p_sub
=
msg_Subscribe
(
p_intf
);
p_intf
->
p_sys
->
p_sub
=
msg_Subscribe
(
p_intf
);
/* one settings to rule them all */
var_Create
(
p_this
,
"window_widget"
,
VLC_VAR_ADDRESS
);
var_Create
(
p_this
,
"window_widget"
,
VLC_VAR_ADDRESS
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
...
@@ -323,6 +324,7 @@ static void Init( intf_thread_t *p_intf )
...
@@ -323,6 +324,7 @@ static void Init( intf_thread_t *p_intf )
QApplication
*
app
=
new
QApplication
(
argc
,
argv
,
true
);
QApplication
*
app
=
new
QApplication
(
argc
,
argv
,
true
);
p_intf
->
p_sys
->
p_app
=
app
;
p_intf
->
p_sys
->
p_app
=
app
;
p_intf
->
p_sys
->
mainSettings
=
new
QSettings
(
"vlc"
,
"vlc-qt-interface"
);
/* Icon setting
/* Icon setting
FIXME: use a bigger icon ? */
FIXME: use a bigger icon ? */
if
(
QDate
::
currentDate
().
dayOfYear
()
>=
354
)
if
(
QDate
::
currentDate
().
dayOfYear
()
>=
354
)
...
@@ -390,13 +392,12 @@ static void Init( intf_thread_t *p_intf )
...
@@ -390,13 +392,12 @@ static void Init( intf_thread_t *p_intf )
if
(
config_GetInt
(
p_intf
,
"qt-updates-notif"
)
)
if
(
config_GetInt
(
p_intf
,
"qt-updates-notif"
)
)
{
{
int
interval
=
config_GetInt
(
p_intf
,
"qt-updates-days"
);
int
interval
=
config_GetInt
(
p_intf
,
"qt-updates-days"
);
QSettings
settings
(
"vlc"
,
"vlc-qt-interface"
);
if
(
QDate
::
currentDate
()
>
if
(
QDate
::
currentDate
()
>
settings
.
value
(
"updatedate"
).
toDate
().
addDays
(
interval
)
)
getSettings
()
->
value
(
"updatedate"
).
toDate
().
addDays
(
interval
)
)
{
{
/* The constructor of the update Dialog will do the 1st request */
/* The constructor of the update Dialog will do the 1st request */
UpdateDialog
::
getInstance
(
p_intf
);
UpdateDialog
::
getInstance
(
p_intf
);
settings
.
setValue
(
"updatedate"
,
QDate
::
currentDate
()
);
getSettings
()
->
setValue
(
"updatedate"
,
QDate
::
currentDate
()
);
}
}
}
}
#endif
#endif
...
...
modules/gui/qt4/qt4.hpp
View file @
47392467
...
@@ -46,12 +46,15 @@ class QMenu;
...
@@ -46,12 +46,15 @@ class QMenu;
class
MainInterface
;
class
MainInterface
;
class
DialogsProvider
;
class
DialogsProvider
;
class
VideoWidget
;
class
VideoWidget
;
class
QSettings
;
struct
intf_sys_t
struct
intf_sys_t
{
{
QApplication
*
p_app
;
QApplication
*
p_app
;
MainInterface
*
p_mi
;
MainInterface
*
p_mi
;
QSettings
*
mainSettings
;
bool
b_isDialogProvider
;
bool
b_isDialogProvider
;
playlist_t
*
p_playlist
;
playlist_t
*
p_playlist
;
...
@@ -106,6 +109,8 @@ struct intf_sys_t
...
@@ -106,6 +109,8 @@ struct intf_sys_t
#define setLayoutMargins( a, b, c, d, e) setMargin( e )
#define setLayoutMargins( a, b, c, d, e) setMargin( e )
#endif
#endif
#define getSettings() p_intf->p_sys->mainSettings
enum
{
enum
{
DialogEventType
=
0
,
DialogEventType
=
0
,
IMEventType
=
100
,
IMEventType
=
100
,
...
...
modules/gui/qt4/util/qvlcframe.hpp
View file @
47392467
...
@@ -29,11 +29,11 @@
...
@@ -29,11 +29,11 @@
#include <QSpacerItem>
#include <QSpacerItem>
#include <QHBoxLayout>
#include <QHBoxLayout>
#include <QApplication>
#include <QApplication>
#include <QSettings>
#include <QMainWindow>
#include <QMainWindow>
#include <QPushButton>
#include <QPushButton>
#include <QKeyEvent>
#include <QKeyEvent>
#include <QDesktopWidget>
#include <QDesktopWidget>
#include <QSettings>
#include "qt4.hpp"
#include "qt4.hpp"
#include <vlc_common.h>
#include <vlc_common.h>
...
@@ -48,17 +48,17 @@ class QVLCTools
...
@@ -48,17 +48,17 @@ class QVLCTools
window is docked into an other - don't all this function
window is docked into an other - don't all this function
or it may write garbage to position info!
or it may write garbage to position info!
*/
*/
static
void
saveWidgetPosition
(
QSettings
*
settings
,
QWidget
*
widget
)
static
void
saveWidgetPosition
(
QSettings
*
settings
,
QWidget
*
widget
)
{
{
settings
->
setValue
(
"geometry"
,
widget
->
saveGeometry
());
settings
->
setValue
(
"geometry"
,
widget
->
saveGeometry
());
}
}
static
void
saveWidgetPosition
(
QString
configName
,
QWidget
*
widget
)
static
void
saveWidgetPosition
(
intf_thread_t
*
p_intf
,
QString
configName
,
QWidget
*
widget
)
{
{
QSettings
*
settings
=
new
QSettings
(
"vlc"
,
"vlc-qt-interface"
);
getSettings
()
->
beginGroup
(
configName
);
settings
->
beginGroup
(
configName
);
QVLCTools
::
saveWidgetPosition
(
getSettings
(),
widget
);
QVLCTools
::
saveWidgetPosition
(
settings
,
widget
);
getSettings
()
->
endGroup
();
settings
->
endGroup
();
delete
settings
;
}
}
...
@@ -84,19 +84,18 @@ class QVLCTools
...
@@ -84,19 +84,18 @@ class QVLCTools
return
false
;
return
false
;
}
}
static
bool
restoreWidgetPosition
(
QString
configName
,
static
bool
restoreWidgetPosition
(
intf_thread_t
*
p_intf
,
QString
configName
,
QWidget
*
widget
,
QWidget
*
widget
,
QSize
defSize
=
QSize
(
0
,
0
),
QSize
defSize
=
QSize
(
0
,
0
),
QPoint
defPos
=
QPoint
(
0
,
0
)
)
QPoint
defPos
=
QPoint
(
0
,
0
)
)
{
{
QSettings
*
settings
=
new
QSettings
(
"vlc"
,
"vlc-qt-interface"
);
getSettings
()
->
beginGroup
(
configName
);
settings
->
beginGroup
(
configName
);
bool
defaultUsed
=
QVLCTools
::
restoreWidgetPosition
(
getSettings
(),
bool
defaultUsed
=
QVLCTools
::
restoreWidgetPosition
(
settings
,
widget
,
widget
,
defSize
,
defSize
,
defPos
);
defPos
);
settings
->
endGroup
();
getSettings
()
->
endGroup
();
delete
settings
;
return
defaultUsed
;
return
defaultUsed
;
}
}
...
@@ -138,12 +137,12 @@ protected:
...
@@ -138,12 +137,12 @@ protected:
QSize
defSize
=
QSize
(
0
,
0
),
QSize
defSize
=
QSize
(
0
,
0
),
QPoint
defPos
=
QPoint
(
0
,
0
)
)
QPoint
defPos
=
QPoint
(
0
,
0
)
)
{
{
QVLCTools
::
restoreWidgetPosition
(
name
,
this
,
defSize
,
defPos
);
QVLCTools
::
restoreWidgetPosition
(
p_intf
,
name
,
this
,
defSize
,
defPos
);
}
}
void
writeSettings
(
QString
name
)
void
writeSettings
(
QString
name
)
{
{
QVLCTools
::
saveWidgetPosition
(
name
,
this
);
QVLCTools
::
saveWidgetPosition
(
p_intf
,
name
,
this
);
}
}
virtual
void
cancel
()
virtual
void
cancel
()
...
@@ -225,14 +224,13 @@ protected:
...
@@ -225,14 +224,13 @@ protected:
void
readSettings
(
QString
name
,
QSize
defSize
)
void
readSettings
(
QString
name
,
QSize
defSize
)
{
{
QVLCTools
::
restoreWidgetPosition
(
name
,
this
,
defSize
);
QVLCTools
::
restoreWidgetPosition
(
p_intf
,
name
,
this
,
defSize
);
}
}
void
readSettings
(
QString
name
)
void
readSettings
(
QString
name
)
{
{
QVLCTools
::
restoreWidgetPosition
(
name
,
this
);
QVLCTools
::
restoreWidgetPosition
(
p_intf
,
name
,
this
);
}
}
void
readSettings
(
QSettings
*
settings
)
void
readSettings
(
QSettings
*
settings
)
{
{
QVLCTools
::
restoreWidgetPosition
(
settings
,
this
);
QVLCTools
::
restoreWidgetPosition
(
settings
,
this
);
...
@@ -245,14 +243,12 @@ protected:
...
@@ -245,14 +243,12 @@ protected:
void
writeSettings
(
QString
name
)
void
writeSettings
(
QString
name
)
{
{
QVLCTools
::
saveWidgetPosition
(
name
,
this
);
QVLCTools
::
saveWidgetPosition
(
p_intf
,
name
,
this
);
}
}
void
writeSettings
(
QSettings
*
settings
)
void
writeSettings
(
QSettings
*
settings
)
{
{
QVLCTools
::
saveWidgetPosition
(
settings
,
this
);
QVLCTools
::
saveWidgetPosition
(
settings
,
this
);
}
}
};
};
#endif
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment