Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
JuK
Commits
090c1fa7
Commit
090c1fa7
authored
Mar 28, 2021
by
Michael Pyne
Browse files
playlistsplitter: Use compile-time signal/slot connections.
parent
73cb0fa0
Changes
3
Hide whitespace changes
Inline
Side-by-side
playlistcollection.cpp
View file @
090c1fa7
...
...
@@ -633,7 +633,7 @@ void PlaylistCollection::setUpcomingPlaylistEnabled(bool enable)
}
}
QObject
*
PlaylistCollection
::
collectionActions
()
const
PlaylistCollection
::
ActionHandler
*
PlaylistCollection
::
collectionActions
()
const
{
return
m_actionHandler
;
}
...
...
playlistcollection.h
View file @
090c1fa7
...
...
@@ -53,6 +53,9 @@ class PlaylistCollection : public PlaylistInterface
friend
class
DynamicPlaylist
;
public:
class
ActionHandler
;
friend
PlaylistCollection
::
ActionHandler
;
PlaylistCollection
(
PlayerManager
*
player
,
QStackedWidget
*
playlistStack
);
virtual
~
PlaylistCollection
();
...
...
@@ -139,7 +142,7 @@ public:
/**
* Returns a pointer to the action handler.
*/
QObject
*
collectionActions
()
const
;
ActionHandler
*
collectionActions
()
const
;
void
newItems
(
const
KFileItemList
&
list
)
const
;
...
...
@@ -177,9 +180,6 @@ public:
*/
QStringList
excludedFolders
()
const
{
return
m_excludedFolderList
;
}
class
ActionHandler
;
friend
PlaylistCollection
::
ActionHandler
;
protected:
virtual
QStackedWidget
*
playlistStack
()
const
;
virtual
void
setupPlaylist
(
Playlist
*
playlist
,
const
QString
&
iconName
);
...
...
playlistsplitter.cpp
View file @
090c1fa7
...
...
@@ -160,7 +160,8 @@ void PlaylistSplitter::setupActions()
QAction
*
act
=
new
QAction
(
QIcon
::
fromTheme
(
QStringLiteral
(
"edit-clear"
)),
i18n
(
"Edit Track Search"
),
this
);
coll
->
addAction
(
"editTrackSearch"
,
act
);
coll
->
setDefaultShortcut
(
act
,
Qt
::
Key_F6
);
connect
(
act
,
SIGNAL
(
triggered
(
bool
)),
SLOT
(
setFocus
()));
connect
(
act
,
&
QAction
::
triggered
,
this
,
&
PlaylistSplitter
::
setFocus
);
}
void
PlaylistSplitter
::
setupLayout
()
...
...
@@ -207,28 +208,31 @@ void PlaylistSplitter::setupLayout()
m_playlistBox
=
new
PlaylistBox
(
m_player
,
this
,
m_playlistStack
);
m_playlistBox
->
setObjectName
(
QLatin1String
(
"playlistBox"
));
con
nect
(
m_playlistBox
->
collectionActions
()
,
SIGNAL
(
signalSelectedItemsChanged
()),
this
,
SLOT
(
slot
Playlist
Se
lectionChanged
()));
connect
(
m_playlistBox
,
SIGNAL
(
signalPlaylistDestroyed
(
Playlist
*
)),
m_editor
,
SLOT
(
slot
PlaylistDestroyed
(
Playlist
*
)));
connect
(
m_playlistBox
,
SIGNAL
(
startupComplete
()),
SLOT
(
slotEnable
())
);
con
st
auto
&
plistActions
=
m_playlistBox
->
collectionActions
()
;
connect
(
plistActions
,
&
Playlist
Col
lection
::
ActionHandler
::
signalSelectedItems
Changed
,
this
,
&
PlaylistSplitter
::
slotPlaylistSelectionChanged
);
connect
(
m_playlistBox
,
&
PlaylistBox
::
signal
PlaylistDestroyed
,
m_editor
,
&
TagEditor
::
slotPlaylistDestroyed
);
connect
(
m_playlistBox
,
&
QTreeWidget
::
currentItemChanged
,
this
,
&
PlaylistSplitter
::
slotCurrentPlaylistChanged
);
m_player
->
setPlaylistInterface
(
m_playlistBox
);
// Let interested parties know we're ready
connect
(
m_playlistBox
,
SIGNAL
(
startupComplete
()),
SIGNAL
(
guiReady
()));
connect
(
m_playlistBox
,
&
PlaylistBox
::
startupComplete
,
this
,
&
PlaylistSplitter
::
setFocus
);
connect
(
m_playlistBox
,
&
PlaylistBox
::
startupComplete
,
this
,
[
this
]()
{
this
->
slotEnable
();
this
->
setFocus
();
emit
guiReady
();
});
m_player
->
setPlaylistInterface
(
m_playlistBox
);
insertWidget
(
0
,
m_playlistBox
);
m_nowPlaying
=
new
NowPlaying
(
top
,
m_playlistBox
);
connect
(
m_player
,
SIGNAL
(
signalItemChanged
(
FileHandle
))
,
m_nowPlaying
,
SLOT
(
slotUpdate
(
FileHandle
))
);
connect
(
m_player
,
SIGNAL
(
signalItemChanged
(
FileHandle
))
,
m_lyricsWidget
,
SLOT
(
playing
(
FileHandle
))
);
connect
(
m_player
,
&
PlayerManager
::
signalItemChanged
,
m_nowPlaying
,
&
NowPlaying
::
slotUpdate
);
connect
(
m_player
,
&
PlayerManager
::
signalItemChanged
,
m_lyricsWidget
,
&
LyricsWidget
::
playing
);
// Create the search widget -- this must be done after the CollectionList is created.
...
...
@@ -237,18 +241,18 @@ void PlaylistSplitter::setupLayout()
// auto-shortcuts don't seem to work and aren't needed anyway.
KAcceleratorManager
::
setNoAccel
(
m_searchWidget
);
connect
(
m_searchWidget
,
SIGNAL
(
signalQueryChanged
())
,
this
,
SLOT
(
slotShowSearchResults
())
);
connect
(
m_searchWidget
,
SIGNAL
(
signalDownPressed
())
,
this
,
SLOT
(
slotFocusCurrentPlaylist
())
);
connect
(
m_searchWidget
,
SIGNAL
(
signalShown
(
bool
))
,
m_playlistBox
->
collectionActions
(),
SLOT
(
slotS
etSearchEnabled
(
bool
))
);
connect
(
m_searchWidget
,
SIGNAL
(
returnPressed
())
,
m_playlistBox
->
collectionActions
(),
SLOT
(
slotP
layFirst
()
)
);
connect
(
"showSearch"
_act
,
SIGNAL
(
toggled
(
bool
))
,
m_searchWidget
,
SLOT
(
setEnabled
(
bool
))
);
connect
(
m_playlistBox
,
&
PlaylistBox
::
signalMoveFocusAway
,
m_searchWidget
,
qOverload
<>
(
&
SearchWidget
::
setFocus
));
connect
(
m_searchWidget
,
&
SearchWidget
::
signalQueryChanged
,
this
,
&
PlaylistSplitter
::
slotShowSearchResults
);
connect
(
m_searchWidget
,
&
SearchWidget
::
signalDownPressed
,
this
,
&
PlaylistSplitter
::
slotFocusCurrentPlaylist
);
connect
(
m_searchWidget
,
&
SearchWidget
::
signalShown
,
m_playlistBox
,
[
this
](
bool
e
)
{
m_playlistBox
->
s
etSearchEnabled
(
e
);
}
);
connect
(
m_searchWidget
,
&
SearchWidget
::
returnPressed
,
m_playlistBox
,
[
this
]()
{
m_playlistBox
->
p
layFirst
()
;
}
);
connect
(
"showSearch"
_act
,
&
QAction
::
toggled
,
m_searchWidget
,
&
SearchWidget
::
setEnabled
);
connect
(
m_playlistBox
,
&
PlaylistBox
::
signalMoveFocusAway
,
m_searchWidget
,
qOverload
<>
(
&
SearchWidget
::
setFocus
));
topLayout
->
addWidget
(
m_nowPlaying
);
topLayout
->
addWidget
(
m_searchWidget
);
...
...
@@ -256,9 +260,10 @@ void PlaylistSplitter::setupLayout()
topLayout
->
addWidget
(
m_playlistStack
,
1
);
// Now that GUI setup is complete, add some auto-update signals.
connect
(
CollectionList
::
instance
(),
SIGNAL
(
signalCollectionChanged
()),
m_editor
,
SLOT
(
slotUpdateCollection
()));
connect
(
m_playlistStack
,
SIGNAL
(
currentChanged
(
int
)),
this
,
SLOT
(
slotPlaylistChanged
(
int
)));
connect
(
CollectionList
::
instance
(),
&
CollectionList
::
signalCollectionChanged
,
m_editor
,
&
TagEditor
::
slotUpdateCollection
);
connect
(
m_playlistStack
,
&
QStackedWidget
::
currentChanged
,
this
,
&
PlaylistSplitter
::
slotPlaylistChanged
);
// Show the collection on startup.
m_playlistBox
->
setCurrentItem
(
m_playlistBox
->
topLevelItem
(
0
));
...
...
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