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
ee454d5f
Commit
ee454d5f
authored
Jan 28, 2010
by
Jakob Leben
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: prettier button with menu for playlist view switching
parent
f6b3f672
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
25 deletions
+43
-25
modules/gui/qt4/components/playlist/standardpanel.cpp
modules/gui/qt4/components/playlist/standardpanel.cpp
+41
-24
modules/gui/qt4/components/playlist/standardpanel.hpp
modules/gui/qt4/components/playlist/standardpanel.hpp
+2
-1
No files found.
modules/gui/qt4/components/playlist/standardpanel.cpp
View file @
ee454d5f
...
@@ -97,25 +97,37 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
...
@@ -97,25 +97,37 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
BUTTONACT
(
addButton
,
popupAdd
()
);
BUTTONACT
(
addButton
,
popupAdd
()
);
layout
->
addWidget
(
addButton
,
0
,
3
);
layout
->
addWidget
(
addButton
,
0
,
3
);
/* Button to switch views */
QPushButton
*
viewButton
=
new
QPushButton
(
this
);
QPushButton
*
viewButton
=
new
QPushButton
(
this
);
viewButton
->
setIcon
(
QIcon
(
":/buttons/playlist/playlist_add"
)
);
viewButton
->
setIcon
(
style
()
->
standardIcon
(
QStyle
::
SP_FileDialogContentsView
)
);
layout
->
addWidget
(
viewButton
,
0
,
2
);
layout
->
addWidget
(
viewButton
,
0
,
2
);
BUTTONACT
(
viewButton
,
toggleView
()
);
/* View selection menu */
viewSelectionMapper
=
new
QSignalMapper
;
CONNECT
(
viewSelectionMapper
,
mapped
(
int
),
this
,
showView
(
int
)
);
QActionGroup
*
actionGroup
=
new
QActionGroup
(
this
);
QAction
*
action
=
actionGroup
->
addAction
(
"Detailed view"
);
action
->
setCheckable
(
true
);
viewSelectionMapper
->
setMapping
(
action
,
TREE_VIEW
);
CONNECT
(
action
,
triggered
(),
viewSelectionMapper
,
map
()
);
action
=
actionGroup
->
addAction
(
"Icon view"
);
action
->
setCheckable
(
true
);
viewSelectionMapper
->
setMapping
(
action
,
ICON_VIEW
);
CONNECT
(
action
,
triggered
(),
viewSelectionMapper
,
map
()
);
QMenu
*
viewMenu
=
new
QMenu
(
this
);
viewMenu
->
addActions
(
actionGroup
->
actions
()
);
viewButton
->
setMenu
(
viewMenu
);
/* Saved Settings */
/* Saved Settings */
getSettings
()
->
beginGroup
(
"Playlist"
);
getSettings
()
->
beginGroup
(
"Playlist"
);
int
i_viewMode
=
getSettings
()
->
value
(
"view-mode"
,
TREE_VIEW
).
toInt
();
int
i_viewMode
=
getSettings
()
->
value
(
"view-mode"
,
TREE_VIEW
).
toInt
();
if
(
i_viewMode
==
ICON_VIEW
)
showView
(
i_viewMode
);
{
createIconView
();
currentView
=
iconView
;
}
else
{
createTreeView
();
currentView
=
treeView
;
}
getSettings
()
->
endGroup
();
getSettings
()
->
endGroup
();
...
@@ -348,27 +360,32 @@ void StandardPLPanel::createTreeView()
...
@@ -348,27 +360,32 @@ void StandardPLPanel::createTreeView()
layout
->
addWidget
(
treeView
,
1
,
0
,
1
,
-
1
);
layout
->
addWidget
(
treeView
,
1
,
0
,
1
,
-
1
);
}
}
void
StandardPLPanel
::
toggleView
(
)
void
StandardPLPanel
::
showView
(
int
i_view
)
{
{
if
(
treeView
&&
treeView
->
isVisible
()
)
switch
(
i_view
)
{
case
TREE_VIEW
:
{
if
(
treeView
==
NULL
)
createTreeView
();
locationBar
->
setIndex
(
treeView
->
rootIndex
()
);
if
(
iconView
)
iconView
->
hide
();
treeView
->
show
();
currentView
=
treeView
;
break
;
}
case
ICON_VIEW
:
{
{
if
(
iconView
==
NULL
)
if
(
iconView
==
NULL
)
createIconView
();
createIconView
();
locationBar
->
setIndex
(
iconView
->
rootIndex
()
);
locationBar
->
setIndex
(
iconView
->
rootIndex
()
);
treeView
->
hide
();
if
(
treeView
)
treeView
->
hide
();
iconView
->
show
();
iconView
->
show
();
currentView
=
iconView
;
currentView
=
iconView
;
break
;
}
}
else
default:
;
{
if
(
treeView
==
NULL
)
createTreeView
();
locationBar
->
setIndex
(
treeView
->
rootIndex
()
);
iconView
->
hide
();
treeView
->
show
();
currentView
=
treeView
;
}
}
}
}
...
...
modules/gui/qt4/components/playlist/standardpanel.hpp
View file @
ee454d5f
...
@@ -78,6 +78,7 @@ private:
...
@@ -78,6 +78,7 @@ private:
int
currentRootId
;
int
currentRootId
;
QSignalMapper
*
selectColumnsSigMapper
;
QSignalMapper
*
selectColumnsSigMapper
;
QSignalMapper
*
viewSelectionMapper
;
int
last_activated_id
;
int
last_activated_id
;
...
@@ -102,7 +103,7 @@ private slots:
...
@@ -102,7 +103,7 @@ private slots:
void
popupSelectColumn
(
QPoint
);
void
popupSelectColumn
(
QPoint
);
void
popupPlView
(
const
QPoint
&
);
void
popupPlView
(
const
QPoint
&
);
void
toggleColumnShown
(
int
);
void
toggleColumnShown
(
int
);
void
toggleView
(
);
void
showView
(
int
);
void
activate
(
const
QModelIndex
&
);
void
activate
(
const
QModelIndex
&
);
void
handleInputChange
(
input_thread_t
*
);
void
handleInputChange
(
input_thread_t
*
);
};
};
...
...
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