Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
d4a2b748
Commit
d4a2b748
authored
Jul 18, 2012
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: MLModel: Use Model Indexes instead of MLItem.
(see prev commit)
parent
856d5fe0
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
69 additions
and
21 deletions
+69
-21
modules/gui/qt4/components/playlist/ml_item.cpp
modules/gui/qt4/components/playlist/ml_item.cpp
+5
-0
modules/gui/qt4/components/playlist/ml_item.hpp
modules/gui/qt4/components/playlist/ml_item.hpp
+3
-0
modules/gui/qt4/components/playlist/ml_model.cpp
modules/gui/qt4/components/playlist/ml_model.cpp
+44
-11
modules/gui/qt4/components/playlist/ml_model.hpp
modules/gui/qt4/components/playlist/ml_model.hpp
+16
-7
modules/gui/qt4/util/pictureflow.cpp
modules/gui/qt4/util/pictureflow.cpp
+1
-3
No files found.
modules/gui/qt4/components/playlist/ml_item.cpp
View file @
d4a2b748
...
...
@@ -151,6 +151,11 @@ MLItem* MLItem::parent() const
return
parentItem
;
}
input_item_t
*
MLItem
::
inputItem
()
{
return
ml_CreateInputItem
(
p_ml
,
id
()
);
}
/**
* @brief Get a QVariant representing the data on a column
* @param column
...
...
modules/gui/qt4/components/playlist/ml_item.hpp
View file @
d4a2b748
...
...
@@ -45,11 +45,13 @@ class MLModel;
class
MLItem
{
friend
class
MLModel
;
public:
MLItem
(
const
MLModel
*
p_model
,
intf_thread_t
*
_p_intf
,
ml_media_t
*
p_media
,
MLItem
*
p_parent
);
virtual
~
MLItem
();
protected:
void
addChild
(
MLItem
*
child
,
int
row
=
-
1
);
void
delChild
(
int
row
);
void
clearChildren
();
...
...
@@ -58,6 +60,7 @@ public:
int
childCount
()
const
;
MLItem
*
parent
()
const
;
input_item_t
*
inputItem
();
QVariant
data
(
int
column
)
const
;
bool
setData
(
ml_select_e
meta
,
const
QVariant
&
data
);
...
...
modules/gui/qt4/components/playlist/ml_model.cpp
View file @
d4a2b748
...
...
@@ -504,6 +504,37 @@ void MLModel::play( const QModelIndex &idx )
AddItemToPlaylist
(
item
->
id
(),
true
,
p_ml
,
true
);
}
QString
MLModel
::
getURI
(
const
QModelIndex
&
index
)
const
{
return
QString
();
}
QModelIndex
MLModel
::
rootIndex
()
const
{
// FIXME
return
QModelIndex
();
}
bool
MLModel
::
isTree
()
const
{
// FIXME ?
return
false
;
}
bool
MLModel
::
canEdit
()
const
{
/* can always insert */
return
true
;
}
bool
MLModel
::
isCurrentItem
(
const
QModelIndex
&
index
,
playLocation
where
)
const
{
Q_UNUSED
(
index
);
if
(
where
==
IN_MEDIALIBRARY
)
return
true
;
return
false
;
}
bool
MLModel
::
popup
(
const
QModelIndex
&
index
,
const
QPoint
&
point
,
const
QModelIndexList
&
list
)
{
current_selection
=
list
;
...
...
@@ -586,6 +617,18 @@ void MLModel::popupSave()
THEDP
->
streamingDialog
(
NULL
,
mrls
[
0
]
);
}
QModelIndex
MLModel
::
getIndexByMLID
(
int
id
)
const
{
for
(
int
i
=
0
;
i
<
rowCount
(
);
i
++
)
{
QModelIndex
idx
=
index
(
i
,
0
);
MLItem
*
item
=
static_cast
<
MLItem
*
>
(
idx
.
internalPointer
()
);
if
(
item
->
id
()
==
id
)
return
idx
;
}
return
QModelIndex
();
}
static
int
mediaAdded
(
vlc_object_t
*
p_this
,
char
const
*
psz_var
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
data
)
...
...
@@ -614,17 +657,7 @@ static int mediaDeleted( vlc_object_t *p_this, char const *psz_var,
VLC_UNUSED
(
p_this
);
VLC_UNUSED
(
psz_var
);
VLC_UNUSED
(
oldval
);
MLModel
*
p_model
=
(
MLModel
*
)
data
;
QModelIndex
remove_idx
=
QModelIndex
();
for
(
int
i
=
0
;
i
<
p_model
->
rowCount
(
);
i
++
)
{
QModelIndex
idx
=
p_model
->
index
(
i
,
0
);
MLItem
*
item
=
static_cast
<
MLItem
*
>
(
idx
.
internalPointer
()
);
if
(
item
->
id
()
==
newval
.
i_int
)
{
remove_idx
=
idx
;
break
;
}
}
QModelIndex
remove_idx
=
p_model
->
getIndexByMLID
(
newval
.
i_int
);
if
(
remove_idx
.
isValid
()
)
p_model
->
remove
(
remove_idx
);
return
VLC_SUCCESS
;
...
...
modules/gui/qt4/components/playlist/ml_model.hpp
View file @
d4a2b748
...
...
@@ -54,12 +54,7 @@ public:
// Basic QAbstractItemModel implementation
MLModel
(
intf_thread_t
*
_p_intf
,
QObject
*
parent
=
NULL
);
virtual
~
MLModel
();
inline
MLItem
*
getItem
(
QModelIndex
index
)
const
{
if
(
index
.
isValid
()
)
return
static_cast
<
MLItem
*>
(
index
.
internalPointer
()
);
else
return
NULL
;
}
virtual
int
itemId
(
const
QModelIndex
&
)
const
;
QVariant
data
(
const
QModelIndex
&
idx
,
const
int
role
=
Qt
::
DisplayRole
)
const
;
...
...
@@ -95,13 +90,18 @@ public:
bool
bSignal
=
true
);
virtual
void
doDelete
(
QModelIndexList
list
);
void
remove
(
MLItem
*
item
);
void
remove
(
QModelIndex
idx
);
void
clear
();
virtual
bool
popup
(
const
QModelIndex
&
index
,
const
QPoint
&
point
,
const
QModelIndexList
&
list
);
void
play
(
const
QModelIndex
&
idx
);
QStringList
selectedURIs
();
virtual
QString
getURI
(
const
QModelIndex
&
index
)
const
;
virtual
QModelIndex
rootIndex
()
const
;
virtual
bool
isTree
()
const
;
virtual
bool
canEdit
()
const
;
virtual
bool
isCurrentItem
(
const
QModelIndex
&
index
,
playLocation
where
)
const
;
QModelIndex
getIndexByMLID
(
int
id
)
const
;
public
slots
:
void
activateItem
(
const
QModelIndex
&
index
);
...
...
@@ -113,6 +113,15 @@ protected slots:
void
popupStream
();
void
popupSave
();
protected:
void
remove
(
MLItem
*
item
);
inline
MLItem
*
getItem
(
QModelIndex
index
)
const
{
if
(
index
.
isValid
()
)
return
static_cast
<
MLItem
*>
(
index
.
internalPointer
()
);
else
return
NULL
;
}
private:
QList
<
MLItem
*
>
items
;
media_library_t
*
p_ml
;
...
...
modules/gui/qt4/util/pictureflow.cpp
View file @
d4a2b748
...
...
@@ -510,9 +510,7 @@ QRect PictureFlowSoftwareRenderer::renderSlide(const SlideInfo &slide, int col1,
index
=
((
MLModel
*
)
state
->
model
)
->
index
(
slide
.
slideIndex
,
0
,
QModelIndex
()
);
if
(
!
index
.
isValid
()
)
return
QRect
();
MLItem
*
item
=
static_cast
<
MLItem
*>
(
index
.
internalPointer
()
);
artURL
=
qfu
(
item
->
getMedia
()
->
psz_cover
);
artURL
=
mlm
->
data
(
index
,
COLUMN_COVER
).
toString
();
}
#endif
QString
key
=
QString
(
"%1%2%3%4"
).
arg
(
VLCModel
::
getMeta
(
index
,
COLUMN_TITLE
)).
arg
(
VLCModel
::
getMeta
(
index
,
COLUMN_ARTIST
)
).
arg
(
index
.
data
(
VLCModel
::
IsCurrentRole
).
toBool
()
).
arg
(
artURL
);
...
...
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