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
8fc62fef
Commit
8fc62fef
authored
May 19, 2014
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: store time besides MRL for recent items
Ref #5315
parent
cbe150c9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
21 deletions
+54
-21
modules/gui/qt4/menus.cpp
modules/gui/qt4/menus.cpp
+1
-1
modules/gui/qt4/recents.cpp
modules/gui/qt4/recents.cpp
+45
-17
modules/gui/qt4/recents.hpp
modules/gui/qt4/recents.hpp
+8
-3
No files found.
modules/gui/qt4/menus.cpp
View file @
8fc62fef
...
...
@@ -1595,7 +1595,7 @@ void VLCMenuBar::updateRecents( intf_thread_t *p_intf )
{
QAction
*
action
;
RecentsMRL
*
rmrl
=
RecentsMRL
::
getInstance
(
p_intf
);
QStringList
l
=
rmrl
->
recent
s
();
QStringList
l
=
rmrl
->
recent
List
();
recentsMenu
->
clear
();
...
...
modules/gui/qt4/recents.cpp
View file @
8fc62fef
...
...
@@ -51,7 +51,8 @@
RecentsMRL
::
RecentsMRL
(
intf_thread_t
*
_p_intf
)
:
p_intf
(
_p_intf
)
{
stack
=
new
QStringList
;
recents
=
QStringList
();
times
=
QStringList
();
signalMapper
=
new
QSignalMapper
(
this
);
CONNECT
(
signalMapper
,
...
...
@@ -76,7 +77,6 @@ RecentsMRL::~RecentsMRL()
{
save
();
delete
filter
;
delete
stack
;
}
void
RecentsMRL
::
addRecent
(
const
QString
&
mrl
)
...
...
@@ -96,17 +96,21 @@ void RecentsMRL::addRecent( const QString &mrl )
}
#endif
int
i_index
=
stack
->
indexOf
(
mrl
);
int
i_index
=
recents
.
indexOf
(
mrl
);
if
(
0
<=
i_index
)
{
/* move to the front */
stack
->
move
(
i_index
,
0
);
recents
.
move
(
i_index
,
0
);
times
.
move
(
i_index
,
0
);
}
else
{
stack
->
prepend
(
mrl
);
if
(
stack
->
count
()
>
RECENTS_LIST_SIZE
)
stack
->
takeLast
();
recents
.
prepend
(
mrl
);
times
.
prepend
(
"-1"
);
if
(
recents
.
count
()
>
RECENTS_LIST_SIZE
)
{
recents
.
takeLast
();
times
.
takeLast
();
}
}
VLCMenuBar
::
updateRecents
(
p_intf
);
save
();
...
...
@@ -114,35 +118,40 @@ void RecentsMRL::addRecent( const QString &mrl )
void
RecentsMRL
::
clear
()
{
if
(
stack
->
isEmpty
()
)
if
(
recents
.
isEmpty
()
)
return
;
stack
->
clear
();
recents
.
clear
();
times
.
clear
();
if
(
isActive
)
VLCMenuBar
::
updateRecents
(
p_intf
);
save
();
}
QStringList
RecentsMRL
::
recent
s
()
QStringList
RecentsMRL
::
recent
List
()
{
return
*
stack
;
return
recents
;
}
void
RecentsMRL
::
load
()
{
/* Load from the settings */
QStringList
list
=
getSettings
()
->
value
(
"RecentsMRL/list"
).
toStringList
();
QStringList
list2
=
getSettings
()
->
value
(
"RecentsMRL/times"
).
toStringList
();
/* And filter the regexp on the list */
for
(
int
i
=
0
;
i
<
list
.
count
();
++
i
)
{
if
(
!
filter
||
filter
->
indexIn
(
list
.
at
(
i
)
)
==
-
1
)
stack
->
append
(
list
.
at
(
i
)
);
if
(
!
filter
||
filter
->
indexIn
(
list
.
at
(
i
)
)
==
-
1
)
{
recents
.
append
(
list
.
at
(
i
)
);
times
.
append
(
list2
.
value
(
i
,
"-1"
)
);
}
}
}
void
RecentsMRL
::
save
()
{
getSettings
()
->
setValue
(
"RecentsMRL/list"
,
*
stack
);
getSettings
()
->
setValue
(
"RecentsMRL/list"
,
recents
);
getSettings
()
->
setValue
(
"RecentsMRL/times"
,
times
);
}
playlist_item_t
*
RecentsMRL
::
toPlaylist
(
int
length
)
...
...
@@ -151,12 +160,12 @@ playlist_item_t *RecentsMRL::toPlaylist(int length)
if
(
p_node_recent
==
NULL
)
return
NULL
;
if
(
length
==
0
||
stack
->
count
()
<
length
)
length
=
stack
->
count
();
if
(
length
==
0
||
recents
.
count
()
<
length
)
length
=
recents
.
count
();
for
(
int
i
=
0
;
i
<
length
;
i
++
)
{
input_item_t
*
p_input
=
input_item_New
(
qtu
(
stack
->
at
(
i
)),
NULL
);
input_item_t
*
p_input
=
input_item_New
(
qtu
(
recents
.
at
(
i
)),
NULL
);
playlist_NodeAddInput
(
THEPL
,
p_input
,
p_node_recent
,
PLAYLIST_APPEND
,
PLAYLIST_END
,
false
);
}
...
...
@@ -168,6 +177,25 @@ void RecentsMRL::playMRL( const QString &mrl )
Open
::
openMRL
(
p_intf
,
mrl
);
}
int
RecentsMRL
::
time
(
const
QString
&
mrl
)
{
if
(
!
isActive
)
return
-
1
;
int
i_index
=
recents
.
indexOf
(
mrl
);
if
(
i_index
!=
-
1
)
return
times
.
value
(
i_index
,
"-1"
).
toInt
();
else
return
-
1
;
}
void
RecentsMRL
::
setTime
(
const
QString
&
mrl
,
const
int64_t
time
)
{
int
i_index
=
recents
.
indexOf
(
mrl
);
if
(
i_index
!=
-
1
)
times
[
i_index
]
=
QString
::
number
(
time
/
1000
);
}
int
Open
::
openMRL
(
intf_thread_t
*
p_intf
,
const
QString
&
mrl
,
bool
b_start
,
...
...
modules/gui/qt4/recents.hpp
View file @
8fc62fef
...
...
@@ -29,7 +29,7 @@
#include "util/singleton.hpp"
#include <QObject>
class
QStringList
;
#include <QStringList>
class
QRegExp
;
class
QSignalMapper
;
...
...
@@ -58,16 +58,21 @@ class RecentsMRL : public QObject, public Singleton<RecentsMRL>
public:
void
addRecent
(
const
QString
&
);
QStringList
recent
s
();
QStringList
recent
List
();
playlist_item_t
*
toPlaylist
(
int
length
);
QSignalMapper
*
signalMapper
;
int
time
(
const
QString
&
mrl
);
void
setTime
(
const
QString
&
mrl
,
const
int64_t
time
);
private:
RecentsMRL
(
intf_thread_t
*
_p_intf
);
virtual
~
RecentsMRL
();
intf_thread_t
*
p_intf
;
QStringList
*
stack
;
QStringList
recents
;
QStringList
times
;
QRegExp
*
filter
;
bool
isActive
;
...
...
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