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
6b65c19e
Commit
6b65c19e
authored
Nov 29, 2009
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: allow loop/repeat button to be in a toolbar (part 2)
Action and states consistency
parent
99748d1f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
78 additions
and
19 deletions
+78
-19
modules/gui/qt4/components/controller.cpp
modules/gui/qt4/components/controller.cpp
+4
-0
modules/gui/qt4/components/controller_widget.cpp
modules/gui/qt4/components/controller_widget.cpp
+4
-17
modules/gui/qt4/components/controller_widget.hpp
modules/gui/qt4/components/controller_widget.hpp
+2
-2
modules/gui/qt4/input_manager.cpp
modules/gui/qt4/input_manager.cpp
+57
-0
modules/gui/qt4/input_manager.hpp
modules/gui/qt4/input_manager.hpp
+11
-0
No files found.
modules/gui/qt4/components/controller.cpp
View file @
6b65c19e
...
...
@@ -372,6 +372,10 @@ QWidget *AbstractController::createWidget( buttonType_e button, int options )
setupButton
(
loopButton
);
loopButton
->
setToolTip
(
qtr
(
"Click to toggle between loop one, loop all"
)
);
loopButton
->
setCheckable
(
true
);
loopButton
->
updateIcons
(
NORMAL
);
CONNECT
(
THEMIM
,
repeatLoopChanged
(
int
),
loopButton
,
updateIcons
(
int
)
);
CONNECT
(
loopButton
,
clicked
(),
THEMIM
,
loopRepeatLoopStatus
()
);
widget
=
loopButton
;
}
break
;
default:
...
...
modules/gui/qt4/components/controller_widget.cpp
View file @
6b65c19e
...
...
@@ -235,22 +235,9 @@ void AtoB_Button::setIcons( bool timeA, bool timeB )
}
}
void
LoopButton
::
update
(
)
void
LoopButton
::
update
Icons
(
int
value
)
{
/* if( model->hasRepeat() )
{
repeatButton->setIcon( QIcon( ":/buttons/playlist/repeat_one" ) );
repeatButton->setChecked( true );
}
else if( model->hasLoop() )
{
repeatButton->setIcon( QIcon( ":/buttons/playlist/repeat_all" ) );
repeatButton->setChecked( true );
}
else
{
repeatButton->setIcon( QIcon( ":/buttons/playlist/repeat_one" ) );
repeatButton->setChecked( false );
}*/
//BUTTONACT( repeatButton, toggleRepeat() );
setChecked
(
value
!=
NORMAL
);
setIcon
(
(
value
==
REPEAT_ALL
)
?
QIcon
(
":/buttons/playlist/repeat_all"
)
:
QIcon
(
":/buttons/playlist/repeat_one"
)
);
}
modules/gui/qt4/components/controller_widget.hpp
View file @
6b65c19e
...
...
@@ -56,8 +56,8 @@ private slots:
class
LoopButton
:
public
QToolButton
{
Q_OBJECT
p
rivate
slots
:
void
update
(
);
p
ublic
slots
:
void
update
Icons
(
int
);
};
class
AtoB_Button
:
public
QToolButton
...
...
modules/gui/qt4/input_manager.cpp
View file @
6b65c19e
...
...
@@ -48,6 +48,10 @@ static int VolumeChanged( vlc_object_t *, const char *,
static
int
RandomChanged
(
vlc_object_t
*
,
const
char
*
,
vlc_value_t
,
vlc_value_t
,
void
*
);
static
int
LoopChanged
(
vlc_object_t
*
,
const
char
*
,
vlc_value_t
,
vlc_value_t
,
void
*
);
static
int
RepeatChanged
(
vlc_object_t
*
,
const
char
*
,
vlc_value_t
,
vlc_value_t
,
void
*
);
static
int
InputEvent
(
vlc_object_t
*
,
const
char
*
,
...
...
@@ -893,6 +897,8 @@ MainInputManager::MainInputManager( intf_thread_t *_p_intf )
var_AddCallback
(
THEPL
,
"playlist-item-append"
,
PLItemAppended
,
this
);
var_AddCallback
(
THEPL
,
"playlist-item-deleted"
,
PLItemRemoved
,
this
);
var_AddCallback
(
THEPL
,
"random"
,
RandomChanged
,
this
);
var_AddCallback
(
THEPL
,
"repeat"
,
RepeatChanged
,
this
);
var_AddCallback
(
THEPL
,
"loop"
,
LoopChanged
,
this
);
var_AddCallback
(
p_intf
->
p_libvlc
,
"volume-change"
,
VolumeChanged
,
this
);
...
...
@@ -932,6 +938,10 @@ MainInputManager::~MainInputManager()
var_DelCallback
(
THEPL
,
"item-current"
,
PLItemChanged
,
this
);
var_DelCallback
(
THEPL
,
"playlist-item-append"
,
PLItemAppended
,
this
);
var_DelCallback
(
THEPL
,
"playlist-item-deleted"
,
PLItemRemoved
,
this
);
var_DelCallback
(
THEPL
,
"random"
,
RandomChanged
,
this
);
var_DelCallback
(
THEPL
,
"repeat"
,
RepeatChanged
,
this
);
var_DelCallback
(
THEPL
,
"loop"
,
LoopChanged
,
this
);
}
vout_thread_t
*
MainInputManager
::
getVout
()
...
...
@@ -967,6 +977,10 @@ void MainInputManager::customEvent( QEvent *event )
case
RandomChanged_Type
:
emit
randomChanged
(
var_GetBool
(
THEPL
,
"random"
)
);
return
;
case
LoopChanged_Type
:
case
RepeatChanged_Type
:
notifyRepeatLoop
();
return
;
default:
if
(
type
!=
ItemChanged_Type
)
return
;
}
...
...
@@ -1042,6 +1056,28 @@ void MainInputManager::toggleRandom()
var_ToggleBool
(
THEPL
,
"random"
);
}
void
MainInputManager
::
notifyRepeatLoop
()
{
int
i_value
=
var_GetBool
(
THEPL
,
"loop"
)
*
REPEAT_ONE
+
var_GetBool
(
THEPL
,
"repeat"
)
*
REPEAT_ALL
;
emit
repeatLoopChanged
(
i_value
);
}
void
MainInputManager
::
loopRepeatLoopStatus
()
{
/* Toggle Normal -> Loop -> Repeat -> Normal ... */
if
(
var_GetBool
(
THEPL
,
"repeat"
)
)
var_SetBool
(
THEPL
,
"repeat"
,
false
);
else
if
(
var_GetBool
(
THEPL
,
"loop"
)
)
{
var_SetBool
(
THEPL
,
"loop"
,
false
);
var_SetBool
(
THEPL
,
"repeat"
,
true
);
}
else
var_SetBool
(
THEPL
,
"loop"
,
true
);
}
void
MainInputManager
::
activatePlayQuit
(
bool
b_exit
)
{
var_SetBool
(
THEPL
,
"play-and-exit"
,
b_exit
);
...
...
@@ -1097,3 +1133,24 @@ static int RandomChanged
QApplication
::
postEvent
(
mim
,
event
);
return
VLC_SUCCESS
;
}
/* Probably could be merged with next callback */
static
int
LoopChanged
(
vlc_object_t
*
obj
,
const
char
*
var
,
vlc_value_t
old
,
vlc_value_t
cur
,
void
*
data
)
{
MainInputManager
*
mim
=
static_cast
<
MainInputManager
*>
(
data
);
IMEvent
*
event
=
new
IMEvent
(
LoopChanged_Type
);
QApplication
::
postEvent
(
mim
,
event
);
return
VLC_SUCCESS
;
}
static
int
RepeatChanged
(
vlc_object_t
*
obj
,
const
char
*
var
,
vlc_value_t
old
,
vlc_value_t
cur
,
void
*
data
)
{
MainInputManager
*
mim
=
static_cast
<
MainInputManager
*>
(
data
);
IMEvent
*
event
=
new
IMEvent
(
RepeatChanged_Type
);
QApplication
::
postEvent
(
mim
,
event
);
return
VLC_SUCCESS
;
}
modules/gui/qt4/input_manager.hpp
View file @
6b65c19e
...
...
@@ -58,6 +58,8 @@ enum {
RecordingEvent_Type
,
ProgramChanged_Type
,
RandomChanged_Type
,
LoopChanged_Type
,
RepeatChanged_Type
,
/* SignalChanged_Type, */
FullscreenControlToggle_Type
=
QEvent
::
User
+
IMEventType
+
20
,
...
...
@@ -66,6 +68,11 @@ enum {
FullscreenControlPlanHide_Type
,
};
enum
{
NORMAL
,
/* loop: 0, repeat: 0 */
REPEAT_ONE
,
/* loop: 1, repeat: 0 */
REPEAT_ALL
,
/* loop: 0, repeat: 1 */
};
class
IMEvent
:
public
QEvent
{
friend
class
InputManager
;
...
...
@@ -257,6 +264,7 @@ private:
input_thread_t
*
p_input
;
intf_thread_t
*
p_intf
;
void
notifyRepeatLoop
();
public
slots
:
void
togglePlayPause
();
void
toggleRandom
();
...
...
@@ -265,12 +273,15 @@ public slots:
void
prev
();
void
activatePlayQuit
(
bool
);
void
loopRepeatLoopStatus
();
signals:
void
inputChanged
(
input_thread_t
*
);
void
volumeChanged
();
void
playlistItemAppended
(
int
itemId
,
int
parentId
);
void
playlistItemRemoved
(
int
itemId
);
void
randomChanged
(
bool
);
void
repeatLoopChanged
(
int
);
};
#endif
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