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
c3338de6
Commit
c3338de6
authored
Feb 15, 2009
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: profiles for the interface toolbar edition
parent
7ca5ee99
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
104 additions
and
3 deletions
+104
-3
modules/gui/qt4/dialogs/toolbar.cpp
modules/gui/qt4/dialogs/toolbar.cpp
+96
-1
modules/gui/qt4/dialogs/toolbar.hpp
modules/gui/qt4/dialogs/toolbar.hpp
+7
-1
modules/gui/qt4/dialogs_provider.cpp
modules/gui/qt4/dialogs_provider.cpp
+1
-1
No files found.
modules/gui/qt4/dialogs/toolbar.cpp
View file @
c3338de6
...
...
@@ -39,6 +39,7 @@
#include <QDragEnterEvent>
#include <QDialogButtonBox>
#include <QInputDialog>
ToolbarEditDialog
*
ToolbarEditDialog
::
instance
=
NULL
;
...
...
@@ -134,6 +135,37 @@ ToolbarEditDialog::ToolbarEditDialog( intf_thread_t *_p_intf)
mainLayout
->
addWidget
(
FSCToolbarBox
,
3
,
0
,
1
,
-
1
);
/* Profile */
QGroupBox
*
profileBox
=
new
QGroupBox
(
qtr
(
"Profile"
),
this
);
QGridLayout
*
profileBoxLayout
=
new
QGridLayout
(
profileBox
);
profileCombo
=
new
QComboBox
;
QLabel
*
profileLabel
=
new
QLabel
(
qtr
(
"Select profile:"
),
this
);
QToolButton
*
newButton
=
new
QToolButton
;
newButton
->
setIcon
(
QIcon
(
":/new"
)
);
QToolButton
*
deleteButton
=
new
QToolButton
;
deleteButton
->
setIcon
(
QIcon
(
":/clear"
)
);
deleteButton
->
setToolTip
(
qtr
(
"Delete the current profile"
)
);
profileBoxLayout
->
addWidget
(
profileLabel
,
0
,
0
);
profileBoxLayout
->
addWidget
(
profileCombo
,
0
,
1
);
profileBoxLayout
->
addWidget
(
newButton
,
0
,
2
);
profileBoxLayout
->
addWidget
(
deleteButton
,
0
,
3
);
mainLayout
->
addWidget
(
profileBox
,
4
,
0
,
1
,
-
1
);
/* Fill combos */
int
i_size
=
getSettings
()
->
beginReadArray
(
"ToolbarProfiles"
);
for
(
int
i
=
0
;
i
<
i_size
;
i
++
)
{
getSettings
()
->
setArrayIndex
(
i
);
profileCombo
->
addItem
(
getSettings
()
->
value
(
"ProfileName"
).
toString
(),
getSettings
()
->
value
(
"Value"
).
toString
()
);
}
getSettings
()
->
endArray
();
profileCombo
->
setCurrentIndex
(
-
1
);
/* Buttons */
QDialogButtonBox
*
okCancel
=
new
QDialogButtonBox
;
QPushButton
*
okButton
=
new
QPushButton
(
qtr
(
"Cl&ose"
),
this
);
...
...
@@ -142,14 +174,62 @@ ToolbarEditDialog::ToolbarEditDialog( intf_thread_t *_p_intf)
okCancel
->
addButton
(
okButton
,
QDialogButtonBox
::
AcceptRole
);
okCancel
->
addButton
(
cancelButton
,
QDialogButtonBox
::
RejectRole
);
BUTTONACT
(
deleteButton
,
deleteProfile
()
);
BUTTONACT
(
newButton
,
newProfile
()
);
CONNECT
(
profileCombo
,
currentIndexChanged
(
int
),
this
,
changeProfile
(
int
)
);
BUTTONACT
(
okButton
,
close
()
);
BUTTONACT
(
cancelButton
,
cancel
()
);
mainLayout
->
addWidget
(
okCancel
,
4
,
2
);
mainLayout
->
addWidget
(
okCancel
,
5
,
2
);
}
ToolbarEditDialog
::~
ToolbarEditDialog
()
{
getSettings
()
->
beginWriteArray
(
"ToolbarProfiles"
);
for
(
int
i
=
0
;
i
<
profileCombo
->
count
();
i
++
)
{
getSettings
()
->
setArrayIndex
(
i
);
getSettings
()
->
setValue
(
"ProfileName"
,
profileCombo
->
itemText
(
i
)
);
getSettings
()
->
setValue
(
"Value"
,
profileCombo
->
itemData
(
i
)
);
}
getSettings
()
->
endArray
();
}
void
ToolbarEditDialog
::
newProfile
()
{
bool
ok
;
QString
name
=
QInputDialog
::
getText
(
this
,
qtr
(
"Profile Name"
),
qtr
(
"Please enter the new profile name."
),
QLineEdit
::
Normal
,
0
,
&
ok
);
if
(
!
ok
)
return
;
QString
temp
=
QString
::
number
(
positionCombo
->
currentIndex
()
);
temp
+=
"|"
+
controller1
->
getValue
();
temp
+=
"|"
+
controller2
->
getValue
();
temp
+=
"|"
+
controllerA
->
getValue
();
temp
+=
"|"
+
controller
->
getValue
();
temp
+=
"|"
+
controllerFSC
->
getValue
();
profileCombo
->
addItem
(
name
,
temp
);
profileCombo
->
setCurrentIndex
(
profileCombo
->
count
()
-
1
);
}
void
ToolbarEditDialog
::
deleteProfile
()
{
profileCombo
->
removeItem
(
profileCombo
->
currentIndex
()
);
}
void
ToolbarEditDialog
::
changeProfile
(
int
i
)
{
QStringList
qs_list
=
profileCombo
->
itemData
(
i
).
toString
().
split
(
"|"
);
if
(
qs_list
.
count
()
<
6
)
return
;
positionCombo
->
setCurrentIndex
(
positionCombo
->
findData
(
qs_list
[
0
].
toInt
()
)
);
controller1
->
resetLine
(
qs_list
[
1
]
);
controller2
->
resetLine
(
qs_list
[
2
]
);
controllerA
->
resetLine
(
qs_list
[
3
]
);
controller
->
resetLine
(
qs_list
[
4
]
);
controllerFSC
->
resetLine
(
qs_list
[
5
]
);
}
void
ToolbarEditDialog
::
close
()
...
...
@@ -384,6 +464,21 @@ DroppingController::DroppingController( intf_thread_t *_p_intf,
parseAndCreate
(
line
,
controlLayout
);
}
void
DroppingController
::
resetLine
(
QString
line
)
{
hide
();
QLayoutItem
*
child
;
int
i
=
0
;
while
(
(
child
=
controlLayout
->
takeAt
(
0
)
)
!=
0
)
{
child
->
widget
()
->
hide
();
delete
child
;
}
parseAndCreate
(
line
,
controlLayout
);
show
();
}
/* Overloading the AbstractController one, because we don't manage the
Spacing items in the same ways */
void
DroppingController
::
createAndAddWidget
(
QBoxLayout
*
controlLayout
,
...
...
modules/gui/qt4/dialogs/toolbar.hpp
View file @
c3338de6
...
...
@@ -57,6 +57,8 @@ public:
instance
=
new
ToolbarEditDialog
(
p_intf
);
return
instance
;
}
static
void
killInstance
()
{
if
(
instance
)
delete
instance
;
instance
=
NULL
;}
virtual
~
ToolbarEditDialog
();
int
getOptions
()
{
return
flatBox
->
isChecked
()
*
WIDGET_FLAT
+
bigBox
->
isChecked
()
*
WIDGET_BIG
+
...
...
@@ -66,13 +68,16 @@ private:
static
ToolbarEditDialog
*
instance
;
QCheckBox
*
flatBox
,
*
bigBox
,
*
shinyBox
;
QComboBox
*
positionCombo
;
QComboBox
*
positionCombo
,
*
profileCombo
;
WidgetListing
*
widgetListing
;
DroppingController
*
controller1
,
*
controller2
,
*
controllerA
;
DroppingController
*
controllerFSC
,
*
controller
;
private
slots
:
void
newProfile
();
void
deleteProfile
();
void
changeProfile
(
int
);
void
cancel
();
void
close
();
};
...
...
@@ -85,6 +90,7 @@ public:
QString
getValue
();
virtual
~
DroppingController
();
void
resetLine
(
QString
);
protected:
virtual
void
createAndAddWidget
(
QBoxLayout
*
controlLayout
,
int
i_index
,
buttonType_e
i_type
,
int
i_option
);
...
...
modules/gui/qt4/dialogs_provider.cpp
View file @
c3338de6
...
...
@@ -80,7 +80,6 @@ DialogsProvider::DialogsProvider( intf_thread_t *_p_intf ) :
DialogsProvider
::~
DialogsProvider
()
{
msg_Dbg
(
p_intf
,
"Destroying the Dialog Provider"
);
PlaylistDialog
::
killInstance
();
MediaInfoDialog
::
killInstance
();
MessagesDialog
::
killInstance
();
...
...
@@ -90,6 +89,7 @@ DialogsProvider::~DialogsProvider()
#ifdef UPDATE_CHECK
UpdateDialog
::
killInstance
();
#endif
ToolbarEditDialog
::
killInstance
();
delete
menusMapper
;
delete
menusUpdateMapper
;
...
...
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