Commit 4181ca6c authored by Scott Wheeler's avatar Scott Wheeler

Continuing the ongoing attempt to break everything and removing a lot more

code.  For now I'm removing the subclass relationship of the DCOP interface
to the main window and will probably provide a concrete implementation soon
of that interface with KActions from the new global KActionCollection.  This
frees up the need to implement that interface in the JuK class for the
moment.

svn path=/trunk/kdemultimedia/juk/; revision=292435
parent 49a758a3
......@@ -43,9 +43,10 @@ using namespace ActionCollection;
////////////////////////////////////////////////////////////////////////////////
JuK::JuK(QWidget *parent, const char *name) :
DCOPObject("Player"),
KMainWindow(parent, name, WDestructiveClose),
m_shuttingDown(false)
m_player(PlayerManager::instance()),
m_shuttingDown(false),
m_muted(false)
{
// Expect segfaults if you change this order.
......@@ -61,11 +62,12 @@ JuK::JuK(QWidget *parent, const char *name) :
setupSplitterConnections();
slotPlaylistChanged();
readConfig();
setupPlayer();
setupSystemTray();
setupGlobalAccels();
processArgs();
m_player->setPlaylistInterface(m_splitter);
SplashScreen::finishedLoading();
QTimer::singleShot(0, CollectionList::instance(), SLOT(slotCheckCache()));
}
......@@ -100,12 +102,6 @@ void JuK::setTime(int time)
m_player->seek(time);
}
void JuK::startPlayingPlaylist()
{
m_player->stop();
action("play")->activate();
}
void JuK::slotGuessTagInfoFromFile()
{
m_splitter->slotGuessTagInfo(TagGuesser::FileName);
......@@ -116,27 +112,6 @@ void JuK::slotGuessTagInfoFromInternet()
m_splitter->slotGuessTagInfo(TagGuesser::MusicBrainz);
}
void JuK::play()
{
m_player->play();
}
void JuK::pause()
{
m_player->pause();
}
void JuK::stop()
{
m_player->stop();
m_splitter->stop();
}
void JuK::back()
{
play(m_splitter->playPreviousFile(m_randomPlayAction->isChecked()));
}
void JuK::back(int howMany)
{
for(--howMany; howMany > 0; --howMany)
......@@ -231,9 +206,9 @@ void JuK::setupLayout()
// playlist item activation connection
connect(m_splitter, SIGNAL(signalActivated()),
this, SLOT(slotPlaySelectedFile()));
this, SLOT(slotPlayCurrent()));
connect(m_splitter, SIGNAL(signalListBoxDoubleClicked()),
this, SLOT(startPlayingPlaylist()));
this, SLOT(slotPlayCurrent()));
// create status bar
......@@ -335,13 +310,13 @@ void JuK::setupActions()
m_randomPlayAction = new KToggleAction(i18n("&Random Play"), 0,
actionCollection(), "randomPlay");
new KAction(i18n("&Play"), "player_play", 0, this, SLOT(play()),
new KAction(i18n("&Play"), "player_play", 0, m_player, SLOT(play()),
actionCollection(), "play");
new KAction(i18n("P&ause"), "player_pause", 0, this, SLOT(pause()),
new KAction(i18n("P&ause"), "player_pause", 0, m_player, SLOT(pause()),
actionCollection(), "pause");
new KAction(i18n("&Stop"), "player_stop", 0, this, SLOT(stop()),
new KAction(i18n("&Stop"), "player_stop", 0, m_player, SLOT(stop()),
actionCollection(), "stop");
m_backAction = new KToolBarPopupAction(i18n("Previous &Track"), "player_start", 0,
......@@ -387,9 +362,6 @@ void JuK::setupActions()
// settings menu
//////////////////////////////////////////////////
new KToggleAction(i18n("Show Menu Bar"), "CTRL+m", this,
SLOT(slotToggleMenuBar()), actionCollection(), "toggleMenuBar");
setStandardToolBarMenuEnabled(true);
m_toggleSplashAction = new KToggleAction(i18n("Show Splash Screen on Startup"),
......@@ -473,23 +445,11 @@ void JuK::setupSystemTray()
}
}
void JuK::setupPlayer()
{
m_muted = false;
if(m_sliderAction) {
}
m_player = PlayerManager::instance();
PlayerManager::instance()->setPlaylistInterface(m_splitter);
}
void JuK::setupGlobalAccels()
{
m_accel = new KGlobalAccel(this);
KeyDialog::insert(m_accel, "PlayPause", i18n("Play/Pause"), this, SLOT(playPause()));
KeyDialog::insert(m_accel, "Stop", i18n("Stop Playing"), this, SLOT(stop()));
KeyDialog::insert(m_accel, "Stop", i18n("Stop Playing"), action("stop"), SLOT(activate()));
KeyDialog::insert(m_accel, "Back", i18n("Back"), this, SLOT(back()));
KeyDialog::insert(m_accel, "Forward", i18n("Forward"), this, SLOT(forward()));
KeyDialog::insert(m_accel, "SeekBack", i18n("Seek Back"), this, SLOT(seekBack()));
......@@ -631,8 +591,6 @@ bool JuK::queryExit()
delete m_systemTray;
m_systemTray = 0;
stop();
Cache::instance()->save();
saveConfig();
delete m_splitter;
......@@ -765,7 +723,7 @@ void JuK::slotEditKeys()
// additional player slots
////////////////////////////////////////////////////////////////////////////////
void JuK::slotPlaySelectedFile()
void JuK::slotPlayCurrent()
{
m_player->stop();
action("play")->activate();
......
......@@ -38,7 +38,7 @@ class SliderAction;
class StatusLabel;
class SystemTray;
class JuK : public KMainWindow, virtual public JuKIface
class JuK : public KMainWindow
{
Q_OBJECT
......@@ -48,11 +48,7 @@ public:
virtual KActionCollection *actionCollection() const;
public slots:
void play();
void pause();
void stop();
void back();
void back(int howMany);
void back(int howMany = 0);
void slotPopulateBackMenu();
void forward();
void seekBack();
......@@ -79,7 +75,6 @@ private:
* @see createSplitterAction();
*/
void setupSplitterConnections();
void setupPlayer();
void setupSystemTray();
void setupGlobalAccels();
......@@ -150,13 +145,8 @@ private slots:
void slotConfigureTagGuesser();
void slotConfigureFileRenamer();
/**
* This method is called to check our progress in the playing file. It uses
* m_playTimer to know when to call itself again.
*/
void slotPlaySelectedFile();
void startPlayingPlaylist();
void slotToggleMenuBar() { menuBar()->isVisible() ? menuBar()->hide() : menuBar()->show(); }
void slotPlayCurrent();
void slotGuessTagInfoFromFile();
void slotGuessTagInfoFromInternet();
......
......@@ -131,6 +131,8 @@ PlaylistSplitter::PlaylistSplitter(QWidget *parent, const char *name) :
setupLayout();
readConfig();
connect(action("stop"), SIGNAL(activated()), this, SLOT(stop()));
m_editor->slotUpdateCollection();
}
......@@ -299,21 +301,6 @@ QString PlaylistSplitter::playRandomFile()
return play(p->nextItem(i, true));
}
void PlaylistSplitter::stop()
{
m_nextPlaylistItem = 0;
if(!m_playingItem)
return;
Playlist *p = m_playingItem->playlist();
if(p)
p->setPlaying(m_playingItem, false);
m_playingItem = 0;
}
QString PlaylistSplitter::playingArtist() const
{
if(m_playingItem) {
......@@ -1101,6 +1088,21 @@ void PlaylistSplitter::slotCreateSearchList(const PlaylistSearch &search,
setupPlaylist(p, false, 0);
}
void PlaylistSplitter::stop()
{
m_nextPlaylistItem = 0;
if(!m_playingItem)
return;
Playlist *p = m_playingItem->playlist();
if(p)
p->setPlaying(m_playingItem, false);
m_playingItem = 0;
}
#include "playlistsplitter.moc"
......
......@@ -110,12 +110,6 @@ public:
*/
QString playRandomFile();
/**
* Since the player is handled at a higher level, this just clears the
* pointer to the currently playing item and updates the icon.
*/
void stop();
////////////////////////////////////////////////////////////////////////////
QString playingArtist() const;
......@@ -417,6 +411,12 @@ private slots:
void slotCreateSearchList(const PlaylistSearch &search, const QString &searchCategory,
const QString &name);
/**
* Since the player is handled at a higher level, this just clears the
* pointer to the currently playing item and updates the icon.
*/
void stop();
private:
PlaylistItem *m_playingItem;
PlaylistBox *m_playlistBox;
......
......@@ -29,7 +29,7 @@
#include "systemtray.h"
#include "playermanager.h"
#include "actioncollection.h"
#include "jukIface.h"
#include "juk.h"
using namespace ActionCollection;
......@@ -181,7 +181,7 @@ void SystemTray::wheelEvent(QWheelEvent *e)
// that a reinterpret_cast isn't portable when combined with multiple
// inheritance. (This is why I don't check the result.)
JuKIface *juk = dynamic_cast<JuKIface *>(parent());
JuK *juk = dynamic_cast<JuK *>(parent());
switch(e->state()) {
case ShiftButton:
......
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