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
7c446cb7
Commit
7c446cb7
authored
Nov 04, 2009
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: recents factorization.
parent
dc92e9b3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
25 deletions
+24
-25
modules/gui/qt4/menus.cpp
modules/gui/qt4/menus.cpp
+2
-2
modules/gui/qt4/recents.cpp
modules/gui/qt4/recents.cpp
+12
-13
modules/gui/qt4/recents.hpp
modules/gui/qt4/recents.hpp
+10
-10
No files found.
modules/gui/qt4/menus.cpp
View file @
7c446cb7
...
...
@@ -1416,11 +1416,11 @@ void QVLCMenu::DoAction( QObject *data )
void
QVLCMenu
::
updateRecents
(
intf_thread_t
*
p_intf
)
{
if
(
recentsMenu
)
if
(
recentsMenu
)
{
QAction
*
action
;
RecentsMRL
*
rmrl
=
RecentsMRL
::
getInstance
(
p_intf
);
Q
List
<
QString
>
l
=
rmrl
->
recents
();
Q
StringList
l
=
rmrl
->
recents
();
recentsMenu
->
clear
();
...
...
modules/gui/qt4/recents.cpp
View file @
7c446cb7
...
...
@@ -26,8 +26,7 @@
#include "dialogs_provider.hpp"
#include "menus.hpp"
#include <QList>
#include <QString>
#include <QStringList>
#include <QAction>
#include <QSettings>
#include <QRegExp>
...
...
@@ -41,14 +40,15 @@ RecentsMRL* RecentsMRL::instance = NULL;
RecentsMRL
::
RecentsMRL
(
intf_thread_t
*
_p_intf
)
:
p_intf
(
_p_intf
)
{
stack
=
new
QList
<
QString
>
;
signalMapper
=
new
QSignalMapper
(
this
);
stack
=
new
QStringList
;
signalMapper
=
new
QSignalMapper
(
this
);
CONNECT
(
signalMapper
,
mapped
(
const
QString
&
),
DialogsProvider
::
getInstance
(
p_intf
),
playMRL
(
const
QString
&
)
);
isActive
=
config_GetInt
(
p_intf
,
"qt-recentplay"
);
/* Load the filter psz */
char
*
psz_tmp
=
config_GetPsz
(
p_intf
,
"qt-recentplay-filter"
);
if
(
psz_tmp
&&
*
psz_tmp
)
filter
=
new
QRegExp
(
psz_tmp
,
Qt
::
CaseInsensitive
);
...
...
@@ -57,6 +57,7 @@ RecentsMRL::RecentsMRL( intf_thread_t *_p_intf ) : p_intf( _p_intf )
free
(
psz_tmp
);
load
();
isActive
=
config_GetInt
(
p_intf
,
"qt-recentplay"
);
if
(
!
isActive
)
clear
();
}
...
...
@@ -98,20 +99,23 @@ void RecentsMRL::clear()
{
if
(
stack
->
isEmpty
()
)
return
;
stack
->
clear
();
if
(
isActive
)
QVLCMenu
::
updateRecents
(
p_intf
);
save
();
}
Q
List
<
QString
>
RecentsMRL
::
recents
()
Q
StringList
RecentsMRL
::
recents
()
{
return
QList
<
QString
>
(
*
stack
)
;
return
*
stack
;
}
void
RecentsMRL
::
load
()
{
/* Load from the settings */
QStringList
list
=
getSettings
()
->
value
(
"RecentsMRL/list"
).
toStringList
();
/* And filter the regexp on the list */
for
(
int
i
=
0
;
i
<
list
.
size
();
++
i
)
{
if
(
!
filter
||
filter
->
indexIn
(
list
.
at
(
i
)
)
==
-
1
)
...
...
@@ -121,11 +125,6 @@ void RecentsMRL::load()
void
RecentsMRL
::
save
()
{
QStringList
list
;
for
(
int
i
=
0
;
i
<
stack
->
size
();
++
i
)
list
<<
stack
->
at
(
i
);
getSettings
()
->
setValue
(
"RecentsMRL/list"
,
list
);
getSettings
()
->
setValue
(
"RecentsMRL/list"
,
*
stack
);
}
modules/gui/qt4/recents.hpp
View file @
7c446cb7
...
...
@@ -27,10 +27,9 @@
#include "qt4.hpp"
#include <QObject>
#include <QList>
#include <QString>
#include <QRegExp>
#include <QSignalMapper>
class
QStringList
;
class
QRegExp
;
class
QSignalMapper
;
#define RECENTS_LIST_SIZE 10
...
...
@@ -52,7 +51,8 @@ public:
}
void
addRecent
(
const
QString
&
);
QList
<
QString
>
recents
();
QStringList
recents
();
QSignalMapper
*
signalMapper
;
private:
...
...
@@ -61,13 +61,13 @@ private:
static
RecentsMRL
*
instance
;
void
load
();
void
save
();
intf_thread_t
*
p_intf
;
QList
<
QString
>
*
stack
;
bool
isActive
;
intf_thread_t
*
p_intf
;
QStringList
*
stack
;
QRegExp
*
filter
;
bool
isActive
;
void
load
();
void
save
();
public
slots
:
void
clear
();
};
...
...
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