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
73cb0fa0
Commit
73cb0fa0
authored
Mar 28, 2021
by
Michael Pyne
Browse files
Add a user-defined literal for our action collection.
parent
de290e15
Changes
3
Hide whitespace changes
Inline
Side-by-side
actioncollection.cpp
View file @
73cb0fa0
...
...
@@ -50,6 +50,11 @@ namespace ActionCollection
return
actions
()
->
action
(
key
);
#endif
}
QAction
*
operator
""
_act
(
const
char
*
str
,
std
::
size_t
len
)
{
return
action
(
QString
::
fromLatin1
(
str
,
len
));
}
}
// vim: set et sw=4 tw=0 sta:
actioncollection.h
View file @
73cb0fa0
...
...
@@ -21,6 +21,8 @@ class KActionCollection;
class
QAction
;
class
QString
;
#include <cstddef>
namespace
ActionCollection
{
/**
...
...
@@ -42,6 +44,11 @@ namespace ActionCollection
{
return
dynamic_cast
<
T
*>
(
action
(
key
));
}
/**
* What ActionCollection::action does, in shorter form.
*/
QAction
*
operator
""
_act
(
const
char
*
str
,
std
::
size_t
len
);
}
#endif
...
...
playlistsplitter.cpp
View file @
73cb0fa0
...
...
@@ -165,6 +165,8 @@ void PlaylistSplitter::setupActions()
void
PlaylistSplitter
::
setupLayout
()
{
using
namespace
ActionCollection
;
// add literal
setOpaqueResize
(
false
);
// Disable the GUI until startup is complete (as indicated by PlaylistBox)
...
...
@@ -243,7 +245,7 @@ void PlaylistSplitter::setupLayout()
m_playlistBox
->
collectionActions
(),
SLOT
(
slotSetSearchEnabled
(
bool
)));
connect
(
m_searchWidget
,
SIGNAL
(
returnPressed
()),
m_playlistBox
->
collectionActions
(),
SLOT
(
slotPlayFirst
()));
connect
(
ActionCollection
::
action
<
KToggleAction
>
(
"showSearch"
)
,
SIGNAL
(
toggled
(
bool
)),
connect
(
"showSearch"
_act
,
SIGNAL
(
toggled
(
bool
)),
m_searchWidget
,
SLOT
(
setEnabled
(
bool
)));
connect
(
m_playlistBox
,
&
PlaylistBox
::
signalMoveFocusAway
,
m_searchWidget
,
qOverload
<>
(
&
SearchWidget
::
setFocus
));
...
...
@@ -264,6 +266,8 @@ void PlaylistSplitter::setupLayout()
void
PlaylistSplitter
::
readConfig
()
{
using
namespace
ActionCollection
;
// add literal
KConfigGroup
config
(
KSharedConfig
::
openConfig
(),
"Splitter"
);
QList
<
int
>
splitterSizes
=
config
.
readEntry
(
"PlaylistSplitterSizes"
,
QList
<
int
>
());
...
...
@@ -274,7 +278,7 @@ void PlaylistSplitter::readConfig()
setSizes
(
splitterSizes
);
bool
showSearch
=
config
.
readEntry
(
"ShowSearch"
,
true
);
ActionCollection
::
action
<
KToggleAction
>
(
"showSearch"
)
->
setChecked
(
showSearch
);
"showSearch"
_act
->
setChecked
(
showSearch
);
m_searchWidget
->
setHidden
(
!
showSearch
);
splitterSizes
=
config
.
readEntry
(
"EditorSplitterSizes"
,
QList
<
int
>
());
...
...
@@ -291,9 +295,11 @@ void PlaylistSplitter::readConfig()
void
PlaylistSplitter
::
saveConfig
()
{
using
namespace
ActionCollection
;
// add literal
KConfigGroup
config
(
KSharedConfig
::
openConfig
(),
"Splitter"
);
config
.
writeEntry
(
"PlaylistSplitterSizes"
,
sizes
());
config
.
writeEntry
(
"ShowSearch"
,
ActionCollection
::
action
<
KToggleAction
>
(
"showSearch"
)
->
isChecked
());
config
.
writeEntry
(
"ShowSearch"
,
"showSearch"
_act
->
isChecked
());
config
.
writeEntry
(
"EditorSplitterSizes"
,
m_editorSplitter
->
sizes
());
}
...
...
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