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
23748912
Commit
23748912
authored
Aug 30, 2009
by
Jakob Leben
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qt4: let QTreeView manage visible playlist columns selection
And remove a lot of unnecessary code.
parent
73cad20b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
183 deletions
+56
-183
modules/gui/qt4/components/playlist/panels.hpp
modules/gui/qt4/components/playlist/panels.hpp
+2
-2
modules/gui/qt4/components/playlist/playlist_model.cpp
modules/gui/qt4/components/playlist/playlist_model.cpp
+17
-120
modules/gui/qt4/components/playlist/playlist_model.hpp
modules/gui/qt4/components/playlist/playlist_model.hpp
+2
-10
modules/gui/qt4/components/playlist/standardpanel.cpp
modules/gui/qt4/components/playlist/standardpanel.cpp
+35
-51
No files found.
modules/gui/qt4/components/playlist/panels.hpp
View file @
23748912
...
@@ -75,7 +75,7 @@ private:
...
@@ -75,7 +75,7 @@ private:
QTreeView
*
view
;
QTreeView
*
view
;
QPushButton
*
repeatButton
,
*
randomButton
,
*
addButton
,
*
gotoPlayingButton
;
QPushButton
*
repeatButton
,
*
randomButton
,
*
addButton
,
*
gotoPlayingButton
;
int
currentRootId
;
int
currentRootId
;
QSignalMapper
*
ContextUpdate
Mapper
;
QSignalMapper
*
selectColumnsSig
Mapper
;
public
slots
:
public
slots
:
void
removeItem
(
int
);
void
removeItem
(
int
);
virtual
void
setRoot
(
int
);
virtual
void
setRoot
(
int
);
...
@@ -90,7 +90,7 @@ private slots:
...
@@ -90,7 +90,7 @@ private slots:
void
setCurrentRootId
(
int
);
void
setCurrentRootId
(
int
);
void
popupAdd
();
void
popupAdd
();
void
popupSelectColumn
(
QPoint
);
void
popupSelectColumn
(
QPoint
);
void
checkSortingIndicator
(
int
);
void
toggleColumnShown
(
int
);
};
};
#endif
#endif
modules/gui/qt4/components/playlist/playlist_model.cpp
View file @
23748912
...
@@ -78,17 +78,6 @@ PLModel::PLModel( playlist_t *_p_playlist, /* THEPL */
...
@@ -78,17 +78,6 @@ PLModel::PLModel( playlist_t *_p_playlist, /* THEPL */
rootItem
=
NULL
;
/* PLItem rootItem, will be set in rebuild( ) */
rootItem
=
NULL
;
/* PLItem rootItem, will be set in rebuild( ) */
if
(
i_depth
==
DEPTH_SEL
)
i_showflags
=
0
;
else
{
i_showflags
=
getSettings
()
->
value
(
"qt-pl-showflags"
,
COLUMN_DEFAULT
).
toInt
();
if
(
i_showflags
<
1
)
i_showflags
=
COLUMN_DEFAULT
;
/* reasonable default to show something */
else
if
(
i_showflags
>=
COLUMN_END
)
i_showflags
=
COLUMN_END
-
1
;
/* show everything */
}
/* Icons initialization */
/* Icons initialization */
#define ADD_ICON(type, x) icons[ITEM_TYPE_##type] = QIcon( QPixmap( x ) )
#define ADD_ICON(type, x) icons[ITEM_TYPE_##type] = QIcon( QPixmap( x ) )
ADD_ICON
(
UNKNOWN
,
type_unknown_xpm
);
ADD_ICON
(
UNKNOWN
,
type_unknown_xpm
);
...
@@ -102,20 +91,15 @@ PLModel::PLModel( playlist_t *_p_playlist, /* THEPL */
...
@@ -102,20 +91,15 @@ PLModel::PLModel( playlist_t *_p_playlist, /* THEPL */
ADD_ICON
(
NODE
,
":/type/node"
);
ADD_ICON
(
NODE
,
":/type/node"
);
#undef ADD_ICON
#undef ADD_ICON
ContextUpdateMapper
=
new
QSignalMapper
(
this
);
rebuild
(
p_root
);
rebuild
(
p_root
);
CONNECT
(
THEMIM
->
getIM
(),
metaChanged
(
input_item_t
*
),
CONNECT
(
THEMIM
->
getIM
(),
metaChanged
(
input_item_t
*
),
this
,
processInputItemUpdate
(
input_item_t
*
)
);
this
,
processInputItemUpdate
(
input_item_t
*
)
);
CONNECT
(
THEMIM
,
inputChanged
(
input_thread_t
*
),
CONNECT
(
THEMIM
,
inputChanged
(
input_thread_t
*
),
this
,
processInputItemUpdate
(
input_thread_t
*
)
);
this
,
processInputItemUpdate
(
input_thread_t
*
)
);
CONNECT
(
ContextUpdateMapper
,
mapped
(
int
),
this
,
toggleColumnShown
(
int
)
);
}
}
PLModel
::~
PLModel
()
PLModel
::~
PLModel
()
{
{
if
(
i_depth
==
-
1
)
getSettings
()
->
setValue
(
"qt-pl-showflags"
,
i_showflags
);
delCallbacks
();
delCallbacks
();
delete
rootItem
;
delete
rootItem
;
}
}
...
@@ -374,7 +358,7 @@ QVariant PLModel::data( const QModelIndex &index, int role ) const
...
@@ -374,7 +358,7 @@ QVariant PLModel::data( const QModelIndex &index, int role ) const
return
QVariant
(
returninfo
);
return
QVariant
(
returninfo
);
}
}
int
metadata
=
columnToMeta
(
index
.
column
()
,
i_showflags
);
int
metadata
=
columnToMeta
(
index
.
column
()
);
if
(
metadata
==
COLUMN_END
)
return
QVariant
();
if
(
metadata
==
COLUMN_END
)
return
QVariant
();
QString
returninfo
;
QString
returninfo
;
...
@@ -423,7 +407,7 @@ QVariant PLModel::headerData( int section, Qt::Orientation orientation,
...
@@ -423,7 +407,7 @@ QVariant PLModel::headerData( int section, Qt::Orientation orientation,
if
(
i_depth
==
DEPTH_SEL
)
return
QVariant
(
QString
(
""
)
);
if
(
i_depth
==
DEPTH_SEL
)
return
QVariant
(
QString
(
""
)
);
int
meta_col
=
columnToMeta
(
section
,
i_showflags
);
int
meta_col
=
columnToMeta
(
section
);
if
(
meta_col
==
COLUMN_END
)
return
QVariant
();
if
(
meta_col
==
COLUMN_END
)
return
QVariant
();
...
@@ -478,17 +462,7 @@ QModelIndex PLModel::parent( const QModelIndex &index ) const
...
@@ -478,17 +462,7 @@ QModelIndex PLModel::parent( const QModelIndex &index ) const
int
PLModel
::
columnCount
(
const
QModelIndex
&
i
)
const
int
PLModel
::
columnCount
(
const
QModelIndex
&
i
)
const
{
{
int
columnCount
=
0
;
return
i_depth
==
DEPTH_SEL
?
1
:
columnFromMeta
(
COLUMN_END
);
int
metadata
=
1
;
if
(
i_depth
==
DEPTH_SEL
)
return
1
;
while
(
metadata
<
COLUMN_END
)
{
if
(
metadata
&
i_showflags
)
columnCount
++
;
metadata
<<=
1
;
}
return
columnCount
;
}
}
int
PLModel
::
rowCount
(
const
QModelIndex
&
parent
)
const
int
PLModel
::
rowCount
(
const
QModelIndex
&
parent
)
const
...
@@ -625,48 +599,32 @@ PLItem *PLModel::getItem( QModelIndex index )
...
@@ -625,48 +599,32 @@ PLItem *PLModel::getItem( QModelIndex index )
return
static_cast
<
PLItem
*>
(
index
.
internalPointer
()
);
return
static_cast
<
PLItem
*>
(
index
.
internalPointer
()
);
}
}
/*
int
PLModel
::
columnToMeta
(
int
_column
)
const
Computes meta data column id from shown column index and shown columns flags.
Returns COLUMN_END in case of failure.
*/
int
PLModel
::
columnToMeta
(
int
column
,
int
shown_flags
)
const
{
{
int
meta
=
1
;
int
meta
=
1
;
int
index
=
-
1
;
int
column
=
0
;
while
(
meta
<
COLUMN_END
)
while
(
column
!=
_column
&&
meta
!=
COLUMN_END
)
{
{
if
(
meta
&
shown_flags
)
index
++
;
if
(
index
==
column
)
break
;
meta
<<=
1
;
meta
<<=
1
;
column
++
;
}
}
return
meta
;
return
meta
;
}
}
/*
int
PLModel
::
columnFromMeta
(
int
meta_col
)
const
Computes shown column index from meta data column id and shown columns flags.
meta_col must be contained in shown_flags!
*/
int
PLModel
::
columnFromMeta
(
int
meta_col
,
int
shown_flags
)
const
{
{
assert
(
meta_col
&
shown_flags
);
int
meta
=
1
;
int
meta
=
1
;
int
index
=
-
1
;
int
column
=
0
;
while
(
meta
<
COLUMN_END
)
while
(
meta
!=
meta_col
&&
meta
!=
COLUMN_END
)
{
{
if
(
meta
&
shown_flags
)
index
++
;
if
(
meta
==
meta_col
)
break
;
meta
<<=
1
;
meta
<<=
1
;
column
++
;
}
}
return
index
;
return
column
;
}
}
/************************* Updates handling *****************************/
/************************* Updates handling *****************************/
...
@@ -930,20 +888,8 @@ void PLModel::sort( int column, Qt::SortOrder order )
...
@@ -930,20 +888,8 @@ void PLModel::sort( int column, Qt::SortOrder order )
void
PLModel
::
sort
(
int
i_root_id
,
int
column
,
Qt
::
SortOrder
order
)
void
PLModel
::
sort
(
int
i_root_id
,
int
column
,
Qt
::
SortOrder
order
)
{
{
int
i_index
=
-
1
;
int
meta
=
columnToMeta
(
column
);
int
i_flag
=
0
;
if
(
meta
==
COLUMN_END
)
return
;
int
i_column
=
1
;
for
(
i_column
=
1
;
i_column
!=
COLUMN_END
;
i_column
<<=
1
)
{
if
(
(
shownFlags
()
&
i_column
)
)
i_index
++
;
if
(
column
==
i_index
)
{
i_flag
=
i_column
;
break
;
}
}
PLItem
*
item
=
findById
(
rootItem
,
i_root_id
);
PLItem
*
item
=
findById
(
rootItem
,
i_root_id
);
if
(
!
item
)
return
;
if
(
!
item
)
return
;
...
@@ -960,10 +906,10 @@ void PLModel::sort( int i_root_id, int column, Qt::SortOrder order )
...
@@ -960,10 +906,10 @@ void PLModel::sort( int i_root_id, int column, Qt::SortOrder order )
{
{
playlist_item_t
*
p_root
=
playlist_ItemGetById
(
p_playlist
,
playlist_item_t
*
p_root
=
playlist_ItemGetById
(
p_playlist
,
i_root_id
);
i_root_id
);
if
(
p_root
&&
i_flag
)
if
(
p_root
)
{
{
playlist_RecursiveNodeSort
(
p_playlist
,
p_root
,
playlist_RecursiveNodeSort
(
p_playlist
,
p_root
,
i_column_sorting
(
i_flag
),
i_column_sorting
(
meta
),
order
==
Qt
::
AscendingOrder
?
order
==
Qt
::
AscendingOrder
?
ORDER_NORMAL
:
ORDER_REVERSE
);
ORDER_NORMAL
:
ORDER_REVERSE
);
}
}
...
@@ -1031,7 +977,7 @@ void PLModel::popup( QModelIndex & index, QPoint &point, QModelIndexList list )
...
@@ -1031,7 +977,7 @@ void PLModel::popup( QModelIndex & index, QPoint &point, QModelIndexList list )
menu
->
addAction
(
qtr
(
I_POP_INFO
),
this
,
SLOT
(
popupInfo
()
)
);
menu
->
addAction
(
qtr
(
I_POP_INFO
),
this
,
SLOT
(
popupInfo
()
)
);
menu
->
addSeparator
();
menu
->
addSeparator
();
QMenu
*
sort_menu
=
menu
->
addMenu
(
qtr
(
"Sort by "
)
+
QMenu
*
sort_menu
=
menu
->
addMenu
(
qtr
(
"Sort by "
)
+
qfu
(
psz_column_title
(
columnToMeta
(
index
.
column
()
,
i_showflags
)
)
)
);
qfu
(
psz_column_title
(
columnToMeta
(
index
.
column
()
)
)
)
);
sort_menu
->
addAction
(
qtr
(
"Ascending"
),
sort_menu
->
addAction
(
qtr
(
"Ascending"
),
this
,
SLOT
(
popupSortAsc
()
)
);
this
,
SLOT
(
popupSortAsc
()
)
);
sort_menu
->
addAction
(
qtr
(
"Descending"
),
sort_menu
->
addAction
(
qtr
(
"Descending"
),
...
@@ -1044,58 +990,9 @@ void PLModel::popup( QModelIndex & index, QPoint &point, QModelIndexList list )
...
@@ -1044,58 +990,9 @@ void PLModel::popup( QModelIndex & index, QPoint &point, QModelIndexList list )
menu
->
addSeparator
();
menu
->
addSeparator
();
menu
->
addAction
(
qtr
(
I_POP_EXPLORE
),
this
,
SLOT
(
popupExplore
()
)
);
menu
->
addAction
(
qtr
(
I_POP_EXPLORE
),
this
,
SLOT
(
popupExplore
()
)
);
}
}
if
(
tree
||
i_popup_item
>
-
1
)
menu
->
addSeparator
();
QMenu
*
col_selector
=
menu
->
addMenu
(
qtr
(
"Visible columns"
)
);
makeColumnSelectMenu
(
col_selector
);
menu
->
popup
(
point
);
menu
->
popup
(
point
);
}
}
void
PLModel
::
makeColumnSelectMenu
(
QMenu
*
menu
)
{
int
i_column
=
1
;
for
(
i_column
=
1
;
i_column
!=
COLUMN_END
;
i_column
<<=
1
)
{
QAction
*
option
=
menu
->
addAction
(
qfu
(
psz_column_title
(
i_column
)
)
);
option
->
setCheckable
(
true
);
option
->
setChecked
(
shownFlags
()
&
i_column
);
ContextUpdateMapper
->
setMapping
(
option
,
i_column
);
CONNECT
(
option
,
triggered
(),
ContextUpdateMapper
,
map
()
);
}
}
void
PLModel
::
toggleColumnShown
(
int
meta
)
{
assert
(
meta
);
if
(
rootItem
)
{
if
(
i_showflags
&
meta
)
{
/* Removing columns */
int
index
=
columnFromMeta
(
meta
,
i_showflags
);
beginRemoveColumns
(
QModelIndex
(),
index
,
index
);
i_showflags
&=
~
(
meta
);
getSettings
()
->
setValue
(
"qt-pl-showflags"
,
i_showflags
);
endRemoveColumns
();
}
else
{
/* Adding columns */
int
sf
=
i_showflags
;
sf
|=
meta
;
int
index
=
columnFromMeta
(
meta
,
sf
);
beginInsertColumns
(
QModelIndex
(),
index
,
index
);
i_showflags
=
sf
;
getSettings
()
->
setValue
(
"qt-pl-showflags"
,
i_showflags
);
endInsertColumns
();
}
emit
columnsChanged
(
meta
);
}
}
void
PLModel
::
popupDel
()
void
PLModel
::
popupDel
()
{
{
doDelete
(
current_selection
);
doDelete
(
current_selection
);
...
...
modules/gui/qt4/components/playlist/playlist_model.hpp
View file @
23748912
...
@@ -113,7 +113,6 @@ public:
...
@@ -113,7 +113,6 @@ public:
/* Lookups */
/* Lookups */
QStringList
selectedURIs
();
QStringList
selectedURIs
();
bool
hasRandom
();
bool
hasLoop
();
bool
hasRepeat
();
bool
hasRandom
();
bool
hasLoop
();
bool
hasRepeat
();
int
shownFlags
()
{
return
i_showflags
;
}
QModelIndex
index
(
PLItem
*
,
int
c
)
const
;
QModelIndex
index
(
PLItem
*
,
int
c
)
const
;
QModelIndex
currentIndex
(
)
{
return
index
(
currentItem
,
0
);
};
QModelIndex
currentIndex
(
)
{
return
index
(
currentItem
,
0
);
};
bool
isCurrent
(
const
QModelIndex
&
index
)
const
;
bool
isCurrent
(
const
QModelIndex
&
index
)
const
;
...
@@ -128,8 +127,6 @@ public:
...
@@ -128,8 +127,6 @@ public:
void
removeItem
(
int
);
void
removeItem
(
int
);
void
rebuild
();
void
rebuild
(
playlist_item_t
*
);
void
rebuild
();
void
rebuild
(
playlist_item_t
*
);
/* Helpers */
void
makeColumnSelectMenu
(
QMenu
*
menu
);
private:
private:
/* General */
/* General */
...
@@ -139,7 +136,6 @@ private:
...
@@ -139,7 +136,6 @@ private:
playlist_t
*
p_playlist
;
playlist_t
*
p_playlist
;
intf_thread_t
*
p_intf
;
intf_thread_t
*
p_intf
;
int
i_depth
;
int
i_depth
;
int
i_showflags
;
static
QIcon
icons
[
ITEM_TYPE_NUMBER
];
static
QIcon
icons
[
ITEM_TYPE_NUMBER
];
...
@@ -166,15 +162,14 @@ private:
...
@@ -166,15 +162,14 @@ private:
/* Popup */
/* Popup */
int
i_popup_item
,
i_popup_parent
,
i_popup_column
;
int
i_popup_item
,
i_popup_parent
,
i_popup_column
;
QModelIndexList
current_selection
;
QModelIndexList
current_selection
;
QSignalMapper
*
ContextUpdateMapper
;
/* Lookups */
/* Lookups */
PLItem
*
findById
(
PLItem
*
,
int
);
PLItem
*
findById
(
PLItem
*
,
int
);
PLItem
*
findByInput
(
PLItem
*
,
int
);
PLItem
*
findByInput
(
PLItem
*
,
int
);
PLItem
*
findInner
(
PLItem
*
,
int
,
bool
);
PLItem
*
findInner
(
PLItem
*
,
int
,
bool
);
static
inline
PLItem
*
getItem
(
QModelIndex
index
);
static
inline
PLItem
*
getItem
(
QModelIndex
index
);
int
columnFromMeta
(
int
meta_column
,
int
shown_flags
)
const
;
int
columnFromMeta
(
int
meta_column
)
const
;
int
columnToMeta
(
int
column
,
int
shown_flags
)
const
;
int
columnToMeta
(
int
column
)
const
;
PLItem
*
p_cached_item
;
PLItem
*
p_cached_item
;
PLItem
*
p_cached_item_bi
;
PLItem
*
p_cached_item_bi
;
int
i_cached_id
;
int
i_cached_id
;
...
@@ -183,8 +178,6 @@ private:
...
@@ -183,8 +178,6 @@ private:
signals:
signals:
void
shouldRemove
(
int
);
void
shouldRemove
(
int
);
void
currentChanged
(
const
QModelIndex
&
);
void
currentChanged
(
const
QModelIndex
&
);
void
columnsChanged
(
int
);
public
slots
:
public
slots
:
void
activateItem
(
const
QModelIndex
&
index
);
void
activateItem
(
const
QModelIndex
&
index
);
...
@@ -203,7 +196,6 @@ private slots:
...
@@ -203,7 +196,6 @@ private slots:
void
popupAddNode
();
void
popupAddNode
();
void
popupSortAsc
();
void
popupSortAsc
();
void
popupSortDesc
();
void
popupSortDesc
();
void
toggleColumnShown
(
int
meta_column
);
void
processInputItemUpdate
(
input_item_t
*
);
void
processInputItemUpdate
(
input_item_t
*
);
void
processInputItemUpdate
(
input_thread_t
*
p_input
);
void
processInputItemUpdate
(
input_thread_t
*
p_input
);
};
};
...
...
modules/gui/qt4/components/playlist/standardpanel.cpp
View file @
23748912
...
@@ -83,9 +83,13 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
...
@@ -83,9 +83,13 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
}
}
else
else
{
{
/* Configure the size of the header */
int
m
,
c
;
view
->
header
()
->
resizeSection
(
0
,
200
);
for
(
m
=
1
,
c
=
0
;
m
!=
COLUMN_END
;
m
<<=
1
,
c
++
)
view
->
header
()
->
resizeSection
(
1
,
80
);
{
view
->
setColumnHidden
(
c
,
!
(
m
&
COLUMN_DEFAULT
)
);
if
(
m
==
COLUMN_TITLE
)
view
->
header
()
->
resizeSection
(
c
,
200
);
else
if
(
m
==
COLUMN_DURATION
)
view
->
header
()
->
resizeSection
(
c
,
80
);
}
}
}
view
->
header
()
->
setSortIndicatorShown
(
true
);
view
->
header
()
->
setSortIndicatorShown
(
true
);
view
->
header
()
->
setClickable
(
true
);
view
->
header
()
->
setClickable
(
true
);
...
@@ -101,8 +105,6 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
...
@@ -101,8 +105,6 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
this
,
popupSelectColumn
(
QPoint
)
);
this
,
popupSelectColumn
(
QPoint
)
);
CONNECT
(
model
,
currentChanged
(
const
QModelIndex
&
),
CONNECT
(
model
,
currentChanged
(
const
QModelIndex
&
),
this
,
handleExpansion
(
const
QModelIndex
&
)
);
this
,
handleExpansion
(
const
QModelIndex
&
)
);
CONNECT
(
model
,
columnsChanged
(
int
),
this
,
checkSortingIndicator
(
int
)
);
currentRootId
=
-
1
;
currentRootId
=
-
1
;
CONNECT
(
parent
,
rootChanged
(
int
),
this
,
setCurrentRootId
(
int
)
);
CONNECT
(
parent
,
rootChanged
(
int
),
this
,
setCurrentRootId
(
int
)
);
...
@@ -172,6 +174,9 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
...
@@ -172,6 +174,9 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
layout
->
addLayout
(
buttons
);
layout
->
addLayout
(
buttons
);
// layout->addWidget( bar );
// layout->addWidget( bar );
setLayout
(
layout
);
setLayout
(
layout
);
selectColumnsSigMapper
=
new
QSignalMapper
(
this
);
CONNECT
(
selectColumnsSigMapper
,
mapped
(
int
),
this
,
toggleColumnShown
(
int
)
);
}
}
/* Function to toggle between the Repeat states */
/* Function to toggle between the Repeat states */
...
@@ -260,59 +265,38 @@ void StandardPLPanel::popupAdd()
...
@@ -260,59 +265,38 @@ void StandardPLPanel::popupAdd()
+
QPoint
(
0
,
addButton
->
height
()
)
);
+
QPoint
(
0
,
addButton
->
height
()
)
);
}
}
/* Set sortingindicator to -1 if it's on column thats removed,
void
StandardPLPanel
::
popupSelectColumn
(
QPoint
pos
)
* else check that it's still showing on correct column
*/
void
StandardPLPanel
::
checkSortingIndicator
(
int
meta
)
{
{
int
index
=
0
;
QMenu
menu
;
if
(
view
->
header
()
->
isSortIndicatorShown
()
==
false
)
return
;
int
sortIndex
=
view
->
header
()
->
sortIndicatorSection
();
int
i
,
j
;
if
(
sortIndex
<
0
||
sortIndex
>
view
->
header
()
->
count
()
||
meta
==
0
)
for
(
i
=
1
,
j
=
0
;
i
<
COLUMN_END
;
i
<<=
1
,
j
++
)
return
;
int
_meta
=
meta
;
while
(
_meta
)
{
{
if
(
_meta
&
model
->
shownFlags
()
)
QAction
*
option
=
menu
.
addAction
(
index
++
;
qfu
(
psz_column_title
(
i
)
)
);
_meta
>>=
1
;
option
->
setCheckable
(
true
);
option
->
setChecked
(
!
view
->
isColumnHidden
(
j
)
);
selectColumnsSigMapper
->
setMapping
(
option
,
j
);
CONNECT
(
option
,
triggered
(),
selectColumnsSigMapper
,
map
()
);
}
}
menu
.
exec
(
QCursor
::
pos
()
);
}
/* Adding column */
void
StandardPLPanel
::
toggleColumnShown
(
int
i
)
if
(
model
->
shownFlags
()
&
meta
)
{
{
if
(
view
->
isColumnHidden
(
i
)
)
/* If column is added before sortIndex, move it one to right*/
if
(
sortIndex
>=
index
)
{
{
sortIndex
+=
1
;
view
->
setColumnHidden
(
i
,
false
)
;
}
}
}
else
{
else
/* Column removed */
if
(
sortIndex
==
index
)
{
sortIndex
=
-
1
;
}
else
if
(
sortIndex
>
index
)
{
{
/* Move indicator left one step*/
int
visible
=
0
;
sortIndex
-=
1
;
int
m
,
c
;
}
for
(
m
=
1
,
c
=
0
;
m
!=
COLUMN_END
&&
visible
<
2
;
m
<<=
1
,
c
++
)
if
(
!
view
->
isColumnHidden
(
c
)
)
visible
++
;
if
(
visible
<
2
)
return
;
view
->
setColumnHidden
(
i
,
true
);
}
}
view
->
header
()
->
setSortIndicator
(
sortIndex
,
view
->
header
()
->
sortIndicatorOrder
()
);
}
void
StandardPLPanel
::
popupSelectColumn
(
QPoint
pos
)
{
QMenu
selectColMenu
;
model
->
makeColumnSelectMenu
(
&
selectColMenu
);
selectColMenu
.
exec
(
QCursor
::
pos
()
);
}
}
/* Search in the playlist */
/* Search in the playlist */
...
...
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