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
a20ffdd4
Commit
a20ffdd4
authored
Aug 06, 2006
by
Clément Stenac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* Add random/loop buttons
* Improve hilighting
parent
fa2f997e
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
121 additions
and
20 deletions
+121
-20
modules/gui/qt4/components/playlist/panels.hpp
modules/gui/qt4/components/playlist/panels.hpp
+4
-0
modules/gui/qt4/components/playlist/standardpanel.cpp
modules/gui/qt4/components/playlist/standardpanel.cpp
+48
-5
modules/gui/qt4/dialogs/playlist.cpp
modules/gui/qt4/dialogs/playlist.cpp
+11
-6
modules/gui/qt4/dialogs/playlist.hpp
modules/gui/qt4/dialogs/playlist.hpp
+1
-1
modules/gui/qt4/main_interface.cpp
modules/gui/qt4/main_interface.cpp
+2
-2
modules/gui/qt4/menus.cpp
modules/gui/qt4/menus.cpp
+2
-0
modules/gui/qt4/playlist_model.cpp
modules/gui/qt4/playlist_model.cpp
+42
-2
modules/gui/qt4/playlist_model.hpp
modules/gui/qt4/playlist_model.hpp
+4
-0
modules/gui/qt4/util/qvlcframe.hpp
modules/gui/qt4/util/qvlcframe.hpp
+7
-4
No files found.
modules/gui/qt4/components/playlist/panels.hpp
View file @
a20ffdd4
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
class
QTreeView
;
class
QTreeView
;
class
PLModel
;
class
PLModel
;
class
QPushButton
;
/**
/**
* \todo Share a single model between views using a filterproxy
* \todo Share a single model between views using a filterproxy
...
@@ -62,10 +63,13 @@ public:
...
@@ -62,10 +63,13 @@ public:
private:
private:
PLModel
*
model
;
PLModel
*
model
;
QTreeView
*
view
;
QTreeView
*
view
;
QPushButton
*
repeatButton
,
*
randomButton
;
public
slots
:
public
slots
:
virtual
void
setRoot
(
int
);
virtual
void
setRoot
(
int
);
private
slots
:
private
slots
:
void
handleExpansion
(
const
QModelIndex
&
);
void
handleExpansion
(
const
QModelIndex
&
);
void
toggleRandom
();
void
toggleRepeat
();
};
};
#endif
#endif
modules/gui/qt4/components/playlist/standardpanel.cpp
View file @
a20ffdd4
...
@@ -24,6 +24,8 @@
...
@@ -24,6 +24,8 @@
#include "playlist_model.hpp"
#include "playlist_model.hpp"
#include "components/playlist/panels.hpp"
#include "components/playlist/panels.hpp"
#include <QTreeView>
#include <QTreeView>
#include <QPushButton>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QVBoxLayout>
#include <QHeaderView>
#include <QHeaderView>
#include "qt4.hpp"
#include "qt4.hpp"
...
@@ -35,7 +37,6 @@ StandardPLPanel::StandardPLPanel( QWidget *_parent, intf_thread_t *_p_intf,
...
@@ -35,7 +37,6 @@ StandardPLPanel::StandardPLPanel( QWidget *_parent, intf_thread_t *_p_intf,
PLPanel
(
_parent
,
_p_intf
)
PLPanel
(
_parent
,
_p_intf
)
{
{
model
=
new
PLModel
(
p_playlist
,
p_root
,
-
1
,
this
);
model
=
new
PLModel
(
p_playlist
,
p_root
,
-
1
,
this
);
model
->
Rebuild
();
view
=
new
QTreeView
(
0
);
view
=
new
QTreeView
(
0
);
view
->
setModel
(
model
);
view
->
setModel
(
model
);
view
->
header
()
->
resizeSection
(
0
,
300
);
view
->
header
()
->
resizeSection
(
0
,
300
);
...
@@ -47,24 +48,66 @@ StandardPLPanel::StandardPLPanel( QWidget *_parent, intf_thread_t *_p_intf,
...
@@ -47,24 +48,66 @@ StandardPLPanel::StandardPLPanel( QWidget *_parent, intf_thread_t *_p_intf,
SIGNAL
(
dataChanged
(
const
QModelIndex
&
,
const
QModelIndex
&
)
),
SIGNAL
(
dataChanged
(
const
QModelIndex
&
,
const
QModelIndex
&
)
),
this
,
SLOT
(
handleExpansion
(
const
QModelIndex
&
)
)
);
this
,
SLOT
(
handleExpansion
(
const
QModelIndex
&
)
)
);
model
->
Rebuild
();
QVBoxLayout
*
layout
=
new
QVBoxLayout
();
QVBoxLayout
*
layout
=
new
QVBoxLayout
();
layout
->
setSpacing
(
0
);
layout
->
setMargin
(
0
);
layout
->
setSpacing
(
0
);
layout
->
setMargin
(
0
);
QHBoxLayout
*
buttons
=
new
QHBoxLayout
();
repeatButton
=
new
QPushButton
(
this
);
buttons
->
addWidget
(
repeatButton
);
randomButton
=
new
QPushButton
(
this
);
buttons
->
addWidget
(
randomButton
);
if
(
model
->
hasRandom
()
)
randomButton
->
setText
(
qtr
(
"Random"
)
);
else
randomButton
->
setText
(
qtr
(
"No random"
)
);
if
(
model
->
hasRepeat
()
)
repeatButton
->
setText
(
qtr
(
"Repeat One"
)
);
else
if
(
model
->
hasLoop
()
)
repeatButton
->
setText
(
qtr
(
"Repeat All"
)
);
else
repeatButton
->
setText
(
qtr
(
"No Repeat"
)
);
connect
(
repeatButton
,
SIGNAL
(
clicked
()
),
this
,
SLOT
(
toggleRepeat
()
));
connect
(
randomButton
,
SIGNAL
(
clicked
()
),
this
,
SLOT
(
toggleRandom
()
));
layout
->
addWidget
(
view
);
layout
->
addWidget
(
view
);
layout
->
addLayout
(
buttons
);
setLayout
(
layout
);
setLayout
(
layout
);
}
}
void
StandardPLPanel
::
toggleRepeat
()
{
if
(
model
->
hasRepeat
()
)
{
model
->
setRepeat
(
false
);
model
->
setLoop
(
true
);
repeatButton
->
setText
(
qtr
(
"Repeat All"
)
);
}
else
if
(
model
->
hasLoop
()
)
{
model
->
setRepeat
(
false
)
;
model
->
setLoop
(
false
);
repeatButton
->
setText
(
qtr
(
"No Repeat"
)
);
}
else
{
model
->
setRepeat
(
true
);
repeatButton
->
setText
(
qtr
(
"Repeat One"
)
);
}
}
void
StandardPLPanel
::
toggleRandom
()
{
bool
prev
=
model
->
hasRandom
();
model
->
setRandom
(
!
prev
);
randomButton
->
setText
(
prev
?
qtr
(
"No Random"
)
:
qtr
(
"Random"
)
);
}
void
StandardPLPanel
::
handleExpansion
(
const
QModelIndex
&
index
)
void
StandardPLPanel
::
handleExpansion
(
const
QModelIndex
&
index
)
{
{
fprintf
(
stderr
,
"Checking expansion
\n
"
);
QModelIndex
parent
;
QModelIndex
parent
;
if
(
model
->
isCurrent
(
index
)
)
if
(
model
->
isCurrent
(
index
)
)
{
{
fprintf
(
stderr
,
"It is the current one
\n
"
)
;
parent
=
index
;
parent
=
index
;
while
(
parent
.
isValid
()
)
while
(
parent
.
isValid
()
)
{
{
fprintf
(
stderr
,
"Expanding %s
\n
"
,
(
model
->
data
(
parent
,
Qt
::
DisplayRole
)).
toString
().
toUtf8
().
data
()
);
view
->
setExpanded
(
parent
,
true
);
view
->
setExpanded
(
parent
,
true
);
parent
=
model
->
parent
(
parent
);
parent
=
model
->
parent
(
parent
);
}
}
...
...
modules/gui/qt4/dialogs/playlist.cpp
View file @
a20ffdd4
...
@@ -27,25 +27,30 @@
...
@@ -27,25 +27,30 @@
#include "components/playlist/panels.hpp"
#include "components/playlist/panels.hpp"
#include "components/playlist/selector.hpp"
#include "components/playlist/selector.hpp"
#include <QHBoxLayout>
#include <QHBoxLayout>
#include "menus.hpp"
PlaylistDialog
*
PlaylistDialog
::
instance
=
NULL
;
PlaylistDialog
*
PlaylistDialog
::
instance
=
NULL
;
PlaylistDialog
::
PlaylistDialog
(
intf_thread_t
*
_p_intf
)
:
QVLC
Frame
(
_p_intf
)
PlaylistDialog
::
PlaylistDialog
(
intf_thread_t
*
_p_intf
)
:
QVLC
MW
(
_p_intf
)
{
{
setWindowTitle
(
qtr
(
"Playlist"
)
);
setWindowTitle
(
qtr
(
"Playlist"
)
);
selector
=
new
PLSelector
(
this
,
p_intf
,
THEPL
);
QWidget
*
main
=
new
QWidget
(
this
);
selector
->
setMaximumWidth
(
150
);
setCentralWidget
(
main
);
QVLCMenu
::
createPlMenuBar
(
menuBar
(),
p_intf
);
rightPanel
=
qobject_cast
<
PLPanel
*>
(
new
StandardPLPanel
(
this
,
p_intf
,
selector
=
new
PLSelector
(
centralWidget
(),
p_intf
,
THEPL
);
THEPL
,
THEPL
->
p_local_category
)
);
selector
->
setMaximumWidth
(
140
);
rightPanel
=
qobject_cast
<
PLPanel
*>
(
new
StandardPLPanel
(
centralWidget
(),
p_intf
,
THEPL
,
THEPL
->
p_local_category
)
);
connect
(
selector
,
SIGNAL
(
activated
(
int
)
),
connect
(
selector
,
SIGNAL
(
activated
(
int
)
),
rightPanel
,
SLOT
(
setRoot
(
int
)
)
);
rightPanel
,
SLOT
(
setRoot
(
int
)
)
);
QHBoxLayout
*
layout
=
new
QHBoxLayout
();
QHBoxLayout
*
layout
=
new
QHBoxLayout
();
layout
->
addWidget
(
selector
,
0
);
layout
->
addWidget
(
selector
,
0
);
layout
->
addWidget
(
rightPanel
,
10
);
layout
->
addWidget
(
rightPanel
,
10
);
centralWidget
()
->
setLayout
(
layout
);
readSettings
(
"playlist"
,
QSize
(
600
,
300
)
);
readSettings
(
"playlist"
,
QSize
(
600
,
300
)
);
setLayout
(
layout
);
}
}
PlaylistDialog
::~
PlaylistDialog
()
PlaylistDialog
::~
PlaylistDialog
()
...
...
modules/gui/qt4/dialogs/playlist.hpp
View file @
a20ffdd4
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
class
PLSelector
;
class
PLSelector
;
class
PLPanel
;
class
PLPanel
;
class
PlaylistDialog
:
public
QVLC
Frame
class
PlaylistDialog
:
public
QVLC
MW
{
{
Q_OBJECT
;
Q_OBJECT
;
public:
public:
...
...
modules/gui/qt4/main_interface.cpp
View file @
a20ffdd4
modules/gui/qt4/menus.cpp
View file @
a20ffdd4
...
@@ -135,6 +135,8 @@ void QVLCMenu::createPlMenuBar( QMenuBar *bar, intf_thread_t *p_intf )
...
@@ -135,6 +135,8 @@ void QVLCMenu::createPlMenuBar( QMenuBar *bar, intf_thread_t *p_intf )
SLOT
(
simpleAppendDialog
()
)
);
SLOT
(
simpleAppendDialog
()
)
);
manageMenu
->
addSeparator
();
manageMenu
->
addSeparator
();
manageMenu
->
addMenu
(
SDMenu
(
p_intf
)
);
manageMenu
->
addMenu
(
SDMenu
(
p_intf
)
);
bar
->
addMenu
(
manageMenu
);
}
}
QMenu
*
QVLCMenu
::
SDMenu
(
intf_thread_t
*
p_intf
)
QMenu
*
QVLCMenu
::
SDMenu
(
intf_thread_t
*
p_intf
)
...
...
modules/gui/qt4/playlist_model.cpp
View file @
a20ffdd4
...
@@ -325,6 +325,36 @@ int PLModel::rowCount(const QModelIndex &parent) const
...
@@ -325,6 +325,36 @@ int PLModel::rowCount(const QModelIndex &parent) const
return
parentItem
->
childCount
();
return
parentItem
->
childCount
();
}
}
/************************* General playlist status ***********************/
bool
PLModel
::
hasRandom
()
{
if
(
var_GetBool
(
p_playlist
,
"random"
)
)
return
true
;
return
false
;
}
bool
PLModel
::
hasRepeat
()
{
if
(
var_GetBool
(
p_playlist
,
"repeat"
)
)
return
true
;
return
false
;
}
bool
PLModel
::
hasLoop
()
{
if
(
var_GetBool
(
p_playlist
,
"loop"
)
)
return
true
;
return
false
;
}
void
PLModel
::
setLoop
(
bool
on
)
{
var_SetBool
(
p_playlist
,
"loop"
,
on
?
VLC_TRUE
:
VLC_FALSE
);
}
void
PLModel
::
setRepeat
(
bool
on
)
{
var_SetBool
(
p_playlist
,
"repeat"
,
on
?
VLC_TRUE
:
VLC_FALSE
);
}
void
PLModel
::
setRandom
(
bool
on
)
{
var_SetBool
(
p_playlist
,
"random"
,
on
?
VLC_TRUE
:
VLC_FALSE
);
}
/************************* Lookups *****************************/
/************************* Lookups *****************************/
PLItem
*
PLModel
::
FindById
(
PLItem
*
root
,
int
i_id
)
PLItem
*
PLModel
::
FindById
(
PLItem
*
root
,
int
i_id
)
...
@@ -467,12 +497,22 @@ void PLModel::Rebuild()
...
@@ -467,12 +497,22 @@ void PLModel::Rebuild()
qDeleteAll
(
rootItem
->
children
);
qDeleteAll
(
rootItem
->
children
);
/* Recreate from root */
/* Recreate from root */
UpdateNodeChildren
(
rootItem
);
UpdateNodeChildren
(
rootItem
);
if
(
p_playlist
->
status
.
p_item
)
{
fprintf
(
stderr
,
"Playlist is playing"
);
PLItem
*
currentItem
=
FindByInput
(
rootItem
,
p_playlist
->
status
.
p_item
->
p_input
->
i_id
);
if
(
currentItem
)
{
fprintf
(
stderr
,
"Updating item
\n
"
);
UpdateTreeItem
(
p_playlist
->
status
.
p_item
,
currentItem
,
true
,
false
);
}
}
PL_UNLOCK
;
PL_UNLOCK
;
/* And signal the view */
/* And signal the view */
emit
layoutChanged
();
emit
layoutChanged
();
/// \todo Force current item to be updated
addCallbacks
();
addCallbacks
();
}
}
...
...
modules/gui/qt4/playlist_model.hpp
View file @
a20ffdd4
...
@@ -118,6 +118,7 @@ public:
...
@@ -118,6 +118,7 @@ public:
int
i_items_to_append
;
int
i_items_to_append
;
void
Rebuild
();
void
Rebuild
();
void
rebuildRoot
(
playlist_item_t
*
);
void
rebuildRoot
(
playlist_item_t
*
);
bool
hasRandom
();
bool
hasLoop
();
bool
hasRepeat
();
private:
private:
void
addCallbacks
();
void
addCallbacks
();
void
delCallbacks
();
void
delCallbacks
();
...
@@ -148,6 +149,9 @@ private:
...
@@ -148,6 +149,9 @@ private:
int
i_cached_input_id
;
int
i_cached_input_id
;
public
slots
:
public
slots
:
void
activateItem
(
const
QModelIndex
&
index
);
void
activateItem
(
const
QModelIndex
&
index
);
void
setRandom
(
bool
);
void
setLoop
(
bool
);
void
setRepeat
(
bool
);
friend
class
PLItem
;
friend
class
PLItem
;
};
};
...
...
modules/gui/qt4/util/qvlcframe.hpp
View file @
a20ffdd4
...
@@ -130,6 +130,11 @@ public:
...
@@ -130,6 +130,11 @@ public:
QVLCFrame
::
fixStyle
(
this
);
QVLCFrame
::
fixStyle
(
this
);
}
}
virtual
~
QVLCMW
()
{};
virtual
~
QVLCMW
()
{};
void
toggleVisible
()
{
if
(
isVisible
()
)
hide
();
else
show
();
}
protected:
protected:
intf_thread_t
*
p_intf
;
intf_thread_t
*
p_intf
;
QSize
mainSize
;
QSize
mainSize
;
...
@@ -138,10 +143,8 @@ protected:
...
@@ -138,10 +143,8 @@ protected:
{
{
QSettings
settings
(
"VideoLAN"
,
"VLC"
);
QSettings
settings
(
"VideoLAN"
,
"VLC"
);
settings
.
beginGroup
(
name
);
settings
.
beginGroup
(
name
);
mainSize
=
settings
.
value
(
"size"
,
defSize
).
toSize
();
resize
(
settings
.
value
(
"size"
,
defSize
).
toSize
()
);
QPoint
npos
=
settings
.
value
(
"pos"
,
QPoint
(
0
,
0
)
).
toPoint
();
move
(
settings
.
value
(
"pos"
,
QPoint
(
0
,
0
)
).
toPoint
()
);
if
(
npos
.
x
()
>
0
)
move
(
npos
);
settings
.
endGroup
();
settings
.
endGroup
();
}
}
void
readSettings
(
QString
name
)
void
readSettings
(
QString
name
)
...
...
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