Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
JuK
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
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
Multimedia
JuK
Commits
cf7dc3d5
Commit
cf7dc3d5
authored
Feb 06, 2003
by
Scott Wheeler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make it possible to turn off system tray docking.
svn path=/trunk/kdemultimedia/juk/; revision=205249
parent
9ae1e54d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
30 deletions
+72
-30
juk.cpp
juk.cpp
+64
-27
juk.h
juk.h
+7
-3
jukui.rc
jukui.rc
+1
-0
No files found.
juk.cpp
View file @
cf7dc3d5
...
...
@@ -51,16 +51,16 @@ JuK::JuK(QWidget *parent, const char *name) : KMainWindow(parent, name, WDestruc
setupLayout
();
setupActions
();
setupPlayer
();
setupSystemTray
();
readConfig
();
setupSystemTray
();
processArgs
();
SplashScreen
::
finishedLoading
();
}
JuK
::~
JuK
()
{
delete
(
playTimer
);
}
////////////////////////////////////////////////////////////////////////////////
...
...
@@ -130,7 +130,9 @@ void JuK::setupActions()
new
KAction
(
i18n
(
"Delete"
),
"editdelete"
,
0
,
splitter
,
SLOT
(
removeSelectedItems
()),
actionCollection
(),
"removeItem"
);
// settings menu
restoreOnLoadAction
=
new
KToggleAction
(
i18n
(
"Restored Playlists on Load"
),
0
,
actionCollection
(),
"restoreOnLoad"
);
restoreOnLoadAction
=
new
KToggleAction
(
i18n
(
"Restored playlists on load"
),
0
,
actionCollection
(),
"restoreOnLoad"
);
toggleSystemTrayAction
=
new
KToggleAction
(
i18n
(
"Dock in system tray"
),
0
,
actionCollection
(),
"toggleSystemTray"
);
connect
(
toggleSystemTrayAction
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
toggleSystemTray
(
bool
)));
new
KAction
(
i18n
(
"Genre List Editor"
),
0
,
this
,
SLOT
(
showGenreListEditor
()),
actionCollection
(),
"showGenreListEditor"
);
connect
(
splitter
,
SIGNAL
(
playlistChanged
()),
this
,
SLOT
(
playlistChanged
()));
...
...
@@ -147,15 +149,24 @@ void JuK::setupActions()
}
void
JuK
::
setupSystemTray
()
{
systemTray
=
new
SystemTray
(
this
,
"systemTray"
);
systemTray
->
show
();
connect
(
systemTray
,
SIGNAL
(
play
()),
this
,
SLOT
(
playFile
()));
connect
(
systemTray
,
SIGNAL
(
stop
()),
this
,
SLOT
(
stopFile
()));
connect
(
systemTray
,
SIGNAL
(
pause
()),
this
,
SLOT
(
pauseFile
()));
connect
(
systemTray
,
SIGNAL
(
back
()),
this
,
SLOT
(
backFile
()));
connect
(
systemTray
,
SIGNAL
(
forward
()),
this
,
SLOT
(
forwardFile
()));
{
if
(
toggleSystemTrayAction
&&
toggleSystemTrayAction
->
isChecked
())
{
systemTray
=
new
SystemTray
(
this
,
"systemTray"
);
systemTray
->
show
();
connect
(
systemTray
,
SIGNAL
(
play
()),
this
,
SLOT
(
playFile
()));
connect
(
systemTray
,
SIGNAL
(
stop
()),
this
,
SLOT
(
stopFile
()));
connect
(
systemTray
,
SIGNAL
(
pause
()),
this
,
SLOT
(
pauseFile
()));
connect
(
systemTray
,
SIGNAL
(
back
()),
this
,
SLOT
(
backFile
()));
connect
(
systemTray
,
SIGNAL
(
forward
()),
this
,
SLOT
(
forwardFile
()));
if
(
player
.
paused
())
systemTray
->
slotPause
();
else
if
(
player
.
playing
())
systemTray
->
slotPlay
();
}
else
systemTray
=
0
;
}
void
JuK
::
setupPlayer
()
...
...
@@ -192,6 +203,19 @@ void JuK::processArgs()
splitter
->
open
(
files
);
}
/**
* These are settings that need to be know before setting up the GUI.
*/
void
JuK
::
readSettings
()
{
KConfig
*
config
=
KGlobal
::
config
();
{
// general settings
KConfigGroupSaver
saver
(
config
,
"Settings"
);
restore
=
config
->
readBoolEntry
(
"RestoreOnLoad"
,
true
);
}
}
void
JuK
::
readConfig
()
{
// Automagically save and restore many window settings.
...
...
@@ -215,18 +239,15 @@ void JuK::readConfig()
showEditorAction
->
setChecked
(
showEditor
);
splitter
->
setEditorVisible
(
showEditor
);
}
if
(
restoreOnLoadAction
)
restoreOnLoadAction
->
setChecked
(
restore
);
}
void
JuK
::
readSettings
()
{
KConfig
*
config
=
KGlobal
::
config
();
{
// general settings
KConfigGroupSaver
saver
(
config
,
"Settings"
);
restore
=
config
->
readBoolEntry
(
"RestoreOnLoad"
,
true
);
bool
dockInSystemTray
=
config
->
readBoolEntry
(
"DockInSystemTray"
,
true
);
toggleSystemTrayAction
->
setChecked
(
dockInSystemTray
);
}
if
(
restoreOnLoadAction
)
restoreOnLoadAction
->
setChecked
(
restore
);
}
void
JuK
::
saveConfig
()
...
...
@@ -247,6 +268,8 @@ void JuK::saveConfig()
KConfigGroupSaver
saver
(
config
,
"Settings"
);
if
(
restoreOnLoadAction
)
config
->
writeEntry
(
"RestoreOnLoad"
,
restoreOnLoadAction
->
isChecked
());
if
(
toggleSystemTrayAction
)
config
->
writeEntry
(
"DockInSystemTray"
,
toggleSystemTrayAction
->
isChecked
());
}
}
...
...
@@ -301,7 +324,8 @@ void JuK::playFile()
pauseAction
->
setEnabled
(
true
);
stopAction
->
setEnabled
(
true
);
playTimer
->
start
(
pollInterval
);
systemTray
->
slotPlay
();
if
(
systemTray
)
systemTray
->
slotPlay
();
}
}
else
if
(
player
.
playing
())
...
...
@@ -315,7 +339,8 @@ void JuK::pauseFile()
playTimer
->
stop
();
player
.
pause
();
pauseAction
->
setEnabled
(
false
);
systemTray
->
slotPause
();
if
(
systemTray
)
systemTray
->
slotPause
();
}
void
JuK
::
stopFile
()
...
...
@@ -334,8 +359,9 @@ void JuK::stopFile()
splitter
->
stop
();
statusLabel
->
clear
();
systemTray
->
slotStop
();
if
(
systemTray
)
systemTray
->
slotStop
();
}
void
JuK
::
backFile
()
...
...
@@ -358,6 +384,16 @@ void JuK::showGenreListEditor()
editor
->
exec
();
}
void
JuK
::
toggleSystemTray
(
bool
enabled
)
{
if
(
enabled
&&
!
systemTray
)
setupSystemTray
();
else
if
(
!
enabled
&&
systemTray
)
{
delete
(
systemTray
);
systemTray
=
0
;
}
}
////////////////////////////////////////////////////////////////////////////////
// additional player slots
////////////////////////////////////////////////////////////////////////////////
...
...
@@ -446,7 +482,8 @@ void JuK::playFile(const QString &file)
statusLabel
->
setPlayingItemInfo
(
splitter
->
playingTrack
(),
splitter
->
playingArtist
(),
splitter
->
playingList
());
systemTray
->
slotPlay
();
if
(
systemTray
)
systemTray
->
slotPlay
();
}
else
stopFile
();
...
...
juk.h
View file @
cf7dc3d5
...
...
@@ -52,13 +52,15 @@ private:
void
setupActions
();
void
setupPlayer
();
void
setupSystemTray
();
void
processArgs
();
void
readConfig
();
/**
*
This is only separate from readConfig() because it is useful to call it
*
before we construct the splitter
.
*
readSettings() is separate from readConfig() in that it contains settings
*
that need to be read before the GUI is setup
.
*/
void
readSettings
();
void
readConfig
();
void
saveConfig
();
virtual
bool
queryClose
();
...
...
@@ -79,6 +81,7 @@ private slots:
// settings menu
void
showGenreListEditor
();
void
toggleSystemTray
(
bool
enabled
);
// additional player slots
void
trackPositionSliderClick
();
...
...
@@ -118,6 +121,7 @@ private:
KToggleAction
*
restoreOnLoadAction
;
SliderAction
*
sliderAction
;
KToggleAction
*
randomPlayAction
;
KToggleAction
*
toggleSystemTrayAction
;
KAction
*
playAction
;
KAction
*
pauseAction
;
...
...
jukui.rc
View file @
cf7dc3d5
...
...
@@ -46,6 +46,7 @@
<Menu
name=
"settings"
noMerge=
"1"
><text>
&
Settings
</text>
<Action
name=
"showGenreListEditor"
/>
<Action
name=
"restoreOnLoad"
/>
<Action
name=
"toggleSystemTray"
/>
</Menu>
</MenuBar>
...
...
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