Commit 2edae8bc authored by Scott Wheeler's avatar Scott Wheeler

Finally getting around to committing Daniel's systray stuff... Probably

a couple of other small tweaks in here since it's been a while since my
last commit...

svn path=/trunk/kdemultimedia/juk/; revision=196383
parent a50ca080
......@@ -3,12 +3,12 @@ bin_PROGRAMS = juk
## INCLUDES were found outside kdevelop specific part
juk_SOURCES = genrelisteditor.cpp genrelisteditorbase.ui splashscreen.cpp statuslabel.cpp cachedtag.cpp oggtag.cpp id3tag.cpp collectionlist.cpp playlistitem.cpp playlist.cpp playlistsplitter.cpp listboxpixmap.cpp playlistbox.cpp tageditor.cpp cache.cpp audiodata.cpp genrelistreader.cpp genrelistlist.cpp genrelist.cpp genre.cpp player.cpp tag.cpp customaction.cpp slideraction.cpp juk.cpp main.cpp
juk_SOURCES = systemtray.cpp genrelisteditor.cpp genrelisteditorbase.ui splashscreen.cpp statuslabel.cpp cachedtag.cpp oggtag.cpp id3tag.cpp collectionlist.cpp playlistitem.cpp playlist.cpp playlistsplitter.cpp listboxpixmap.cpp playlistbox.cpp tageditor.cpp cache.cpp audiodata.cpp genrelistreader.cpp genrelistlist.cpp genrelist.cpp genre.cpp player.cpp tag.cpp customaction.cpp slideraction.cpp juk.cpp main.cpp
juk_LDADD = -lid3 -lsoundserver_idl $(LIB_KFILE) $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_QT) $(LIBSOCKET)
SUBDIRS = pics data
EXTRA_DIST = main.cpp juk.cpp juk.h juk.desktop jukui.rc slideraction.cpp slideraction.h customaction.h customaction.cpp tag.cpp tag.h player.cpp player.h genre.h genre.cpp hi16-app-juk.png hi32-app-juk.png hi48-app-juk.png genrelist.cpp genrelist.h genrelistlist.cpp genrelistlist.h genrelistreader.cpp genrelistreader.h audiodata.cpp audiodata.h cache.cpp cache.h tageditor.cpp tageditor.h playlistbox.cpp playlistbox.h listboxpixmap.cpp listboxpixmap.h playlistsplitter.cpp playlistsplitter.h playlist.cpp playlist.h playlistitem.cpp playlistitem.h collectionlist.cpp collectionlist.h id3tag.cpp id3tag.h oggtag.cpp oggtag.h cachedtag.cpp cachedtag.h statuslabel.cpp statuslabel.h splashscreen.cpp splashscreen.h genrelisteditorbase.ui genrelisteditor.cpp genrelisteditor.h
EXTRA_DIST = main.cpp juk.cpp juk.h juk.desktop jukui.rc slideraction.cpp slideraction.h customaction.h customaction.cpp tag.cpp tag.h player.cpp player.h genre.h genre.cpp hi16-app-juk.png hi32-app-juk.png hi48-app-juk.png genrelist.cpp genrelist.h genrelistlist.cpp genrelistlist.h genrelistreader.cpp genrelistreader.h audiodata.cpp audiodata.h cache.cpp cache.h tageditor.cpp tageditor.h playlistbox.cpp playlistbox.h listboxpixmap.cpp listboxpixmap.h playlistsplitter.cpp playlistsplitter.h playlist.cpp playlist.h playlistitem.cpp playlistitem.h collectionlist.cpp collectionlist.h id3tag.cpp id3tag.h oggtag.cpp oggtag.h cachedtag.cpp cachedtag.h statuslabel.cpp statuslabel.h splashscreen.cpp splashscreen.h genrelisteditorbase.ui genrelisteditor.cpp genrelisteditor.h systemtray.h systemtray.cpp
install-data-local:
$(mkinstalldirs) $(kde_appsdir)/Multimedia/
......
......@@ -34,6 +34,7 @@
#include "statuslabel.h"
#include "splashscreen.h"
#include "genrelisteditor.h"
#include "systemtray.h"
////////////////////////////////////////////////////////////////////////////////
// public members
......@@ -50,9 +51,10 @@ JuK::JuK(QWidget *parent, const char *name) : KMainWindow(parent, name, WDestruc
setupLayout();
setupActions();
setupPlayer();
setupSystemTray();
readConfig();
processArgs();
SplashScreen::finishedLoading();
}
......@@ -93,7 +95,7 @@ void JuK::setupActions()
new KAction(i18n("Open &Directory..."), "fileopen", 0, splitter, SLOT(openDirectory()), actionCollection(), "openDirectory");
KStdAction::save(splitter, SLOT(save()), actionCollection());
new KAction(i18n("Delete"), "editdelete", 0, splitter, SLOT(removeSelectedItems()), actionCollection(), "remove");
KStdAction::quit(this, SLOT(quit()), actionCollection());
KStdAction::quit(this, SLOT(close()), actionCollection());
// edit menu
KStdAction::cut(splitter, SLOT(clearSelectedItems()), actionCollection());
......@@ -144,6 +146,18 @@ void JuK::setupActions()
connect(this, SIGNAL(dockWindowPositionChanged(QDockWindow *)), sliderAction, SLOT(updateOrientation(QDockWindow *)));
}
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()));
}
void JuK::setupPlayer()
{
trackPositionDragging = false;
......@@ -293,6 +307,8 @@ void JuK::playFile()
player.seekPosition(0);
else
playFile(splitter->playNextFile(randomPlayAction->isChecked()));
systemTray->slotPlay();
}
void JuK::pauseFile()
......@@ -300,6 +316,7 @@ void JuK::pauseFile()
playTimer->stop();
player.pause();
pauseAction->setEnabled(false);
systemTray->slotPause();
}
void JuK::stopFile()
......@@ -318,6 +335,8 @@ void JuK::stopFile()
splitter->stop();
statusLabel->clear();
systemTray->slotStop();
}
void JuK::backFile()
......
......@@ -36,6 +36,7 @@ class QListViewItem;
class SliderAction;
class StatusLabel;
class SystemTray;
class JuK : public KMainWindow
{
......@@ -50,6 +51,7 @@ private:
void setupLayout();
void setupActions();
void setupPlayer();
void setupSystemTray();
void processArgs();
void readConfig();
/**
......@@ -65,9 +67,6 @@ private slots:
void playlistChanged();
void updatePlaylistInfo();
// file menu
void quit() { close(); }
// edit menu
void copy() {};
void paste() {};
......@@ -108,10 +107,12 @@ private slots:
void playSelectedFile() { playFile(splitter->playSelectedFile()); }
void playFirstFile() { playFile(splitter->playFirstFile()); }
private:
// layout objects
PlaylistSplitter *splitter;
StatusLabel *statusLabel;
SystemTray *systemTray;
// actions
KToggleAction *showEditorAction;
......
......@@ -18,9 +18,11 @@
#include <kapplication.h>
#include <kiconloader.h>
#include <klocale.h>
#include <kdebug.h>
#include <qlabel.h>
#include <qfont.h>
#include <qtimer.h>
#include "splashscreen.h"
......@@ -34,9 +36,8 @@ int SplashScreen::count = 0;
SplashScreen *SplashScreen::instance()
{
if(!splash && !done) {
if(!splash && !done)
splash = new SplashScreen();
}
return(splash);
}
......@@ -51,8 +52,8 @@ void SplashScreen::increment()
{
if(splash) {
count++;
splash->countLabel->setText(QString::number(count));
kapp->processEvents();
if(count % 10 == 0)
splash->processEvents();
}
}
......@@ -94,3 +95,13 @@ SplashScreen::~SplashScreen()
{
}
////////////////////////////////////////////////////////////////////////////////
// private methods
////////////////////////////////////////////////////////////////////////////////
void SplashScreen::processEvents()
{
countLabel->setText(QString::number(count));
kapp->processEvents();
}
......@@ -45,6 +45,8 @@ protected:
virtual ~SplashScreen();
private:
void processEvents();
static SplashScreen *splash;
static bool done;
static int count;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment