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
1cdeaa80
Commit
1cdeaa80
authored
Jan 25, 2010
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: variable renaming so they are more explicit
parent
27f5e6a9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
53 deletions
+53
-53
modules/gui/qt4/components/playlist/standardpanel.cpp
modules/gui/qt4/components/playlist/standardpanel.cpp
+51
-51
modules/gui/qt4/components/playlist/standardpanel.hpp
modules/gui/qt4/components/playlist/standardpanel.hpp
+2
-2
No files found.
modules/gui/qt4/components/playlist/standardpanel.cpp
View file @
1cdeaa80
...
...
@@ -62,49 +62,49 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
model
=
new
PLModel
(
p_playlist
,
p_intf
,
p_root
,
this
);
/* Create and configure the QTreeView */
v
iew
=
new
QTreeView
;
v
iew
->
setModel
(
model
);
view2
=
NULL
;
v
iew
->
setIconSize
(
QSize
(
20
,
20
)
);
v
iew
->
setAlternatingRowColors
(
true
);
v
iew
->
setAnimated
(
true
);
v
iew
->
setUniformRowHeights
(
true
);
v
iew
->
setSortingEnabled
(
true
);
v
iew
->
header
()
->
setSortIndicator
(
-
1
,
Qt
::
AscendingOrder
);
v
iew
->
header
()
->
setSortIndicatorShown
(
true
);
v
iew
->
header
()
->
setClickable
(
true
);
v
iew
->
header
()
->
setContextMenuPolicy
(
Qt
::
CustomContextMenu
);
v
iew
->
setSelectionBehavior
(
QAbstractItemView
::
SelectRows
);
v
iew
->
setSelectionMode
(
QAbstractItemView
::
ExtendedSelection
);
v
iew
->
setDragEnabled
(
true
);
v
iew
->
setAcceptDrops
(
true
);
v
iew
->
setDropIndicatorShown
(
true
);
installEventFilter
(
v
iew
);
treeV
iew
=
new
QTreeView
;
treeV
iew
->
setModel
(
model
);
iconView
=
NULL
;
treeV
iew
->
setIconSize
(
QSize
(
20
,
20
)
);
treeV
iew
->
setAlternatingRowColors
(
true
);
treeV
iew
->
setAnimated
(
true
);
treeV
iew
->
setUniformRowHeights
(
true
);
treeV
iew
->
setSortingEnabled
(
true
);
treeV
iew
->
header
()
->
setSortIndicator
(
-
1
,
Qt
::
AscendingOrder
);
treeV
iew
->
header
()
->
setSortIndicatorShown
(
true
);
treeV
iew
->
header
()
->
setClickable
(
true
);
treeV
iew
->
header
()
->
setContextMenuPolicy
(
Qt
::
CustomContextMenu
);
treeV
iew
->
setSelectionBehavior
(
QAbstractItemView
::
SelectRows
);
treeV
iew
->
setSelectionMode
(
QAbstractItemView
::
ExtendedSelection
);
treeV
iew
->
setDragEnabled
(
true
);
treeV
iew
->
setAcceptDrops
(
true
);
treeV
iew
->
setDropIndicatorShown
(
true
);
installEventFilter
(
treeV
iew
);
/* Saved Settings */
getSettings
()
->
beginGroup
(
"Playlist"
);
if
(
getSettings
()
->
contains
(
"headerStateV2"
)
)
{
v
iew
->
header
()
->
restoreState
(
treeV
iew
->
header
()
->
restoreState
(
getSettings
()
->
value
(
"headerStateV2"
).
toByteArray
()
);
}
else
{
for
(
int
m
=
1
,
c
=
0
;
m
!=
COLUMN_END
;
m
<<=
1
,
c
++
)
{
v
iew
->
setColumnHidden
(
c
,
!
(
m
&
COLUMN_DEFAULT
)
);
if
(
m
==
COLUMN_TITLE
)
v
iew
->
header
()
->
resizeSection
(
c
,
200
);
else
if
(
m
==
COLUMN_DURATION
)
v
iew
->
header
()
->
resizeSection
(
c
,
80
);
treeV
iew
->
setColumnHidden
(
c
,
!
(
m
&
COLUMN_DEFAULT
)
);
if
(
m
==
COLUMN_TITLE
)
treeV
iew
->
header
()
->
resizeSection
(
c
,
200
);
else
if
(
m
==
COLUMN_DURATION
)
treeV
iew
->
header
()
->
resizeSection
(
c
,
80
);
}
}
getSettings
()
->
endGroup
();
/* Connections for the TreeView */
CONNECT
(
v
iew
,
activated
(
const
QModelIndex
&
),
CONNECT
(
treeV
iew
,
activated
(
const
QModelIndex
&
),
model
,
activateItem
(
const
QModelIndex
&
)
);
CONNECT
(
v
iew
->
header
(),
customContextMenuRequested
(
const
QPoint
&
),
CONNECT
(
treeV
iew
->
header
(),
customContextMenuRequested
(
const
QPoint
&
),
this
,
popupSelectColumn
(
QPoint
)
);
CONNECT
(
model
,
currentChanged
(
const
QModelIndex
&
),
this
,
handleExpansion
(
const
QModelIndex
&
)
);
...
...
@@ -142,7 +142,7 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
BUTTONACT
(
viewButton
,
toggleView
()
);
/* Finish the layout */
layout
->
addWidget
(
v
iew
,
1
,
0
,
1
,
-
1
);
layout
->
addWidget
(
treeV
iew
,
1
,
0
,
1
,
-
1
);
selectColumnsSigMapper
=
new
QSignalMapper
(
this
);
CONNECT
(
selectColumnsSigMapper
,
mapped
(
int
),
...
...
@@ -152,19 +152,19 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
StandardPLPanel
::~
StandardPLPanel
()
{
getSettings
()
->
beginGroup
(
"Playlist"
);
getSettings
()
->
setValue
(
"headerStateV2"
,
v
iew
->
header
()
->
saveState
()
);
getSettings
()
->
setValue
(
"headerStateV2"
,
treeV
iew
->
header
()
->
saveState
()
);
getSettings
()
->
endGroup
();
}
/* Unused anymore, but might be useful, like in right-click menu */
void
StandardPLPanel
::
gotoPlayingItem
()
{
v
iew
->
scrollTo
(
model
->
currentIndex
()
);
treeV
iew
->
scrollTo
(
model
->
currentIndex
()
);
}
void
StandardPLPanel
::
handleExpansion
(
const
QModelIndex
&
index
)
{
v
iew
->
scrollTo
(
index
);
treeV
iew
->
scrollTo
(
index
);
}
/* PopupAdd Menu for the Add Menu */
...
...
@@ -204,7 +204,7 @@ void StandardPLPanel::popupSelectColumn( QPoint pos )
QAction
*
option
=
menu
.
addAction
(
qfu
(
psz_column_title
(
i
)
)
);
option
->
setCheckable
(
true
);
option
->
setChecked
(
!
v
iew
->
isColumnHidden
(
j
)
);
option
->
setChecked
(
!
treeV
iew
->
isColumnHidden
(
j
)
);
selectColumnsSigMapper
->
setMapping
(
option
,
j
);
CONNECT
(
option
,
triggered
(),
selectColumnsSigMapper
,
map
()
);
}
...
...
@@ -213,7 +213,7 @@ void StandardPLPanel::popupSelectColumn( QPoint pos )
void
StandardPLPanel
::
toggleColumnShown
(
int
i
)
{
view
->
setColumnHidden
(
i
,
!
v
iew
->
isColumnHidden
(
i
)
);
treeView
->
setColumnHidden
(
i
,
!
treeV
iew
->
isColumnHidden
(
i
)
);
}
/* Search in the playlist */
...
...
@@ -224,7 +224,7 @@ void StandardPLPanel::search( const QString& searchText )
void
StandardPLPanel
::
doPopup
(
QModelIndex
index
,
QPoint
point
)
{
QItemSelectionModel
*
selection
=
v
iew
->
selectionModel
();
QItemSelectionModel
*
selection
=
treeV
iew
->
selectionModel
();
QModelIndexList
list
=
selection
->
selectedIndexes
();
model
->
popup
(
index
,
point
,
list
);
}
...
...
@@ -289,35 +289,35 @@ void StandardPLPanel::keyPressEvent( QKeyEvent *e )
void
StandardPLPanel
::
deleteSelection
()
{
QItemSelectionModel
*
selection
=
v
iew
->
selectionModel
();
QItemSelectionModel
*
selection
=
treeV
iew
->
selectionModel
();
QModelIndexList
list
=
selection
->
selectedIndexes
();
model
->
doDelete
(
list
);
}
void
StandardPLPanel
::
toggleView
()
{
if
(
view
&&
v
iew
->
isVisible
()
)
if
(
treeView
&&
treeV
iew
->
isVisible
()
)
{
if
(
view2
==
NULL
)
if
(
iconView
==
NULL
)
{
view2
=
new
PlIconView
(
model
,
this
);
layout
->
addWidget
(
view2
,
1
,
0
,
1
,
-
1
);
installEventFilter
(
view2
);
iconView
=
new
PlIconView
(
model
,
this
);
layout
->
addWidget
(
iconView
,
1
,
0
,
1
,
-
1
);
installEventFilter
(
iconView
);
}
v
iew
->
hide
();
view2
->
show
();
treeV
iew
->
hide
();
iconView
->
show
();
}
else
{
view2
->
hide
();
v
iew
->
show
();
iconView
->
hide
();
treeV
iew
->
show
();
}
}
bool
StandardPLPanel
::
eventFilter
(
QObject
*
obj
,
QEvent
*
event
)
{
QAbstractItemView
*
v
iew
=
qobject_cast
<
QAbstractItemView
*>
(
obj
);
if
(
!
v
iew
)
return
false
;
QAbstractItemView
*
aV
iew
=
qobject_cast
<
QAbstractItemView
*>
(
obj
);
if
(
!
aV
iew
)
return
false
;
switch
(
event
->
type
()
)
{
...
...
@@ -326,18 +326,18 @@ bool StandardPLPanel::eventFilter( QObject *obj, QEvent *event )
QMouseEvent
*
mouseEvent
=
static_cast
<
QMouseEvent
*>
(
event
);
if
(
mouseEvent
->
button
()
&
Qt
::
RightButton
)
{
QModelIndex
index
=
v
iew
->
indexAt
(
QModelIndex
index
=
aV
iew
->
indexAt
(
QPoint
(
mouseEvent
->
x
(),
mouseEvent
->
y
()
)
);
doPopup
(
index
,
QCursor
::
pos
()
);
return
true
;
}
else
if
(
mouseEvent
->
button
()
&
Qt
::
LeftButton
)
{
if
(
!
v
iew
->
indexAt
(
QPoint
(
mouseEvent
->
x
(),
if
(
!
aV
iew
->
indexAt
(
QPoint
(
mouseEvent
->
x
(),
mouseEvent
->
y
()
)
).
isValid
()
)
v
iew
->
clearSelection
();
aV
iew
->
clearSelection
();
}
//
v
iew->mousePressEvent( mouseEvent );
//
aV
iew->mousePressEvent( mouseEvent );
}
return
true
;
case
QEvent
:
:
MouseButtonRelease
:
...
...
@@ -345,7 +345,7 @@ bool StandardPLPanel::eventFilter( QObject *obj, QEvent *event )
QMouseEvent
*
mouseEvent2
=
static_cast
<
QMouseEvent
*>
(
event
);
if
(
mouseEvent2
->
button
()
&
Qt
::
RightButton
)
return
false
;
/* Do NOT forward to QTreeView!! */
//
v
iew->mouseReleaseEvent( mouseEvent );
//
aV
iew->mouseReleaseEvent( mouseEvent );
return
true
;
}
default:
...
...
modules/gui/qt4/components/playlist/standardpanel.hpp
View file @
1cdeaa80
...
...
@@ -71,8 +71,8 @@ private:
QPushButton
*
addButton
;
QGridLayout
*
layout
;
QTreeView
*
v
iew
;
PlIconView
*
view2
;
QTreeView
*
treeV
iew
;
PlIconView
*
iconView
;
int
currentRootId
;
QSignalMapper
*
selectColumnsSigMapper
;
...
...
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