Commit 3ee5cdb7 authored by Matthias Kretz's avatar Matthias Kretz

- compile agains trunk except for the systray breakage

- deprecated -= a_lot
- Player interface is not needed anymore use Phonon directly and make use of
  the tick and finished signals (no polling with QTimer anymore)
  -> the change is untested because of the systray compilation error

svn path=/branches/work/bleedingedge/kdemultimedia/juk/; revision=560481
parent da012b3d
......@@ -41,7 +41,6 @@ set(juk_SRCS searchadaptor.cpp collectionadaptor.cpp playeradaptor.cpp
musicbrainzquery.cpp
nowplaying.cpp
playermanager.cpp
player.cpp
playlist.cpp
playlistbox.cpp
playlistcollection.cpp
......@@ -116,122 +115,3 @@ install( FILES jukui.rc jukui-rtl.rc DESTINATION ${DATA_INSTALL_DIR}/juk )
install( FILES jukservicemenu.desktop DESTINATION ${DATA_INSTALL_DIR}/konqueror/servicemenus )
kde4_install_icons( ${ICON_INSTALL_DIR} hicolor )
#original Makefile.am contents follow:
#bin_PROGRAMS = juk
#check_PROGRAMS = tagguessertest
#
#juk_SOURCES = \
# advancedsearchdialog.cpp \
# actioncollection.cpp \
# akodeplayer.cpp \
# artsplayer.cpp \
# cache.cpp \
# categoryreaderinterface.cpp \
# collectionlist.cpp \
# coverdialog.cpp \
# coverdialogbase.ui \
# covericonview.cpp \
# coverinfo.cpp \
# covermanager.cpp \
# deletedialog.cpp \
# deletedialogbase.ui \
# directorylist.cpp \
# directorylistbase.ui \
# dynamicplaylist.cpp \
# exampleoptions.cpp \
# exampleoptionsbase.ui \
# folderplaylist.cpp \
# filehandle.cpp \
# filerenamer.cpp \
# filerenamerbase.ui \
# filerenameroptions.cpp \
# filerenameroptionsbase.ui \
# filerenamerconfigdlg.cpp \
# gstreamerplayer.cpp \
# googlefetcher.cpp \
# googlefetcherdialog.cpp \
# historyplaylist.cpp \
# juk.cpp \
# jukIface.skel \
# k3bexporter.cpp \
# keydialog.cpp \
# main.cpp \
# mediafiles.cpp \
# musicbrainzquery.cpp \
# nowplaying.cpp \
# playermanager.cpp \
# playlist.cpp \
# playlistbox.cpp \
# playlistcollection.cpp \
# playlistinterface.cpp \
# playlistitem.cpp \
# playlistsearch.cpp \
# playlistsplitter.cpp \
# searchplaylist.cpp \
# searchwidget.cpp \
# slideraction.cpp \
# sortedstringlist.cpp \
# splashscreen.cpp \
# statuslabel.cpp \
# stringshare.cpp \
# systemtray.cpp \
# tag.cpp \
# tageditor.cpp \
# tagguesser.cpp \
# tagguesserconfigdlg.cpp \
# tagguesserconfigdlgwidget.ui \
# tagrenameroptions.cpp \
# tagtransactionmanager.cpp \
# trackpickerdialog.cpp \
# trackpickerdialogbase.ui \
# tracksequenceiterator.cpp \
# tracksequencemanager.cpp \
# treeviewitemplaylist.cpp \
# upcomingplaylist.cpp \
# ktrm.cpp \
# viewmode.cpp
#
#tagguessertest_SOURCES = tagguessertest.cpp tagguesser.cpp
#
#INCLUDES= $(all_includes) $(taglib_includes) $(akode_includes) $(GST_CFLAGS) $(ARTS_CFLAGS)
#
###################################################
## check to see if MusicBrainz is available
###################################################
#if link_lib_TP
#tplibs = -ltunepimp
#endif
###################################################
#
#juk_LDADD = -lm $(LDADD_GST) $(tplibs) $(LIB_KIO) $(taglib_libs) $(akode_libs) $(LIB_KHTML) $(LIB_ARTS)
#juk_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LDFLAGS_GST)
#
#KDE_CXXFLAGS = $(USE_EXCEPTIONS)
#
#tagguessertest_LDADD = $(LIB_KDECORE)
#tagguessertest_LDFLAGS = $(all_libraries)
#
#SUBDIRS = pics
#
#rcdir = $(kde_datadir)/juk
#rc_DATA = jukui.rc jukui-rtl.rc
#
#servicemenudir = $(kde_datadir)/konqueror/servicemenus
#servicemenu_DATA = jukservicemenu.desktop
#
#METASOURCES = AUTO
#KDE_ICON = AUTO
#POFILES = AUTO
#
#xdg_apps_DATA = juk.desktop
#
#messages: rc.cpp
# $(EXTRACTRC) *.rc >> rc.cpp
# $(XGETTEXT) *.rc *.cpp *.h -o $(podir)/juk.pot
# -rm rc.cpp
#KDE_OPTIONS=nofinal
......@@ -51,7 +51,7 @@ using namespace ActionCollection;
////////////////////////////////////////////////////////////////////////////////
JuK::JuK(QWidget *parent, const char *name) :
KMainWindow(parent, name, Qt::WDestructiveClose),
KMainWindow(parent, Qt::WDestructiveClose),
m_player(PlayerManager::instance()),
m_shuttingDown(false)
{
......@@ -67,7 +67,7 @@ JuK::JuK(QWidget *parent, const char *name) :
setupActions();
setupLayout();
if(QApplication::reverseLayout())
if(QApplication::isRightToLeft())
setupGUI(ToolBar | Save | Create, "jukui-rtl.rc");
else
setupGUI(ToolBar | Save | Create);
......@@ -328,7 +328,7 @@ void JuK::readConfig()
KConfigGroup playerConfig(KGlobal::config(), "Player");
if(m_sliderAction->volumeSlider()) {
int maxVolume = m_sliderAction->volumeSlider()->maxValue();
int maxVolume = m_sliderAction->volumeSlider()->maximum();
int volume = playerConfig.readEntry("Volume", maxVolume);
m_sliderAction->volumeSlider()->setVolume(volume);
}
......
......@@ -21,6 +21,7 @@
#include "mediafiles.h"
#include <taglib/tag.h>
#include <kurl.h>
#if (TAGLIB_MAJOR_VERSION>1) || \
((TAGLIB_MAJOR_VERSION==1) && (TAGLIB_MINOR_VERSION>=2))
#define TAGLIB_1_2
......@@ -47,7 +48,7 @@ namespace MediaFiles {
QStringList MediaFiles::openDialog(QWidget *parent)
{
KFileDialog dialog(QString::null, QString::null, parent);
KFileDialog dialog(KUrl(), QString::null, parent);
dialog.setOperationMode(KFileDialog::Opening);
dialog.setCaption(i18n("Open"));
......
/* This file is part of the KDE project
Copyright (C) 2006 Matthias Kretz <kretz@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#include "player.h"
#include <phonon/mediaobject.h>
#include <phonon/audiopath.h>
#include <phonon/audiooutput.h>
Player::Player( QObject* parent )
: QObject( parent )
, m_media( new Phonon::MediaObject( this ) )
, m_path( new Phonon::AudioPath( this ) )
, m_output( new Phonon::AudioOutput( this ) )
{
m_output->setCategory( Phonon::MusicCategory );
m_path->addOutput( m_output );
m_media->addAudioPath( m_path );
}
Player::~Player()
{
}
void Player::play( const FileHandle &file )
{
if( file.isNull() )
return;
m_media->setUrl( KUrl::fromPath( file.absFilePath() ) );
m_media->play();
}
void Player::pause()
{
m_media->pause();
}
void Player::stop()
{
m_media->stop();
}
void Player::setVolume( float volume )
{
m_output->setVolume( volume );
}
float Player::volume() const
{
return m_output->volume();
}
bool Player::playing() const
{
return m_media->state() == Phonon::PlayingState;
}
bool Player::paused() const
{
return m_media->state() == Phonon::PausedState;
}
int Player::totalTime() const
{
return m_media->totalTime() / 1000;
}
int Player::currentTime() const
{
return m_media->currentTime() / 1000;
}
int Player::position() const
{
if( m_media->currentTime() > 0 )
return static_cast<int>( m_media->currentTime() / 1000.0f / m_media->totalTime() + 0.5f );
return -1;
}
void Player::seek( int seekTime )
{
m_media->seek( seekTime * 1000 );
}
void Player::seekPosition( int position )
{
m_media->seek( static_cast<long>( m_media->totalTime() / 1000.0f * position + 0.5f ) );
}
#include "player.moc"
// vim: sw=4 ts=4 noet
/***************************************************************************
begin : Sun Feb 17 2002
copyright : (C) 2002 - 2004 by Scott Wheeler
email : wheeler@kde.org
(C) 2006 Matthias Kretz <kretz@kde.org>
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef PLAYER_H
#define PLAYER_H
#include <QObject>
#include "filehandle.h"
namespace Phonon
{
class MediaObject;
class AudioPath;
class AudioOutput;
}
class Player : public QObject
{
Q_OBJECT
public:
Player( QObject* parent = 0 );
~Player();
void play(const FileHandle &file = FileHandle::null());
void pause();
void stop();
void setVolume( float volume = 1.0 );
float volume() const;
bool playing() const;
bool paused() const;
int totalTime() const;
int currentTime() const;
int position() const; // in this case not really the percent
void seek( int seekTime );
void seekPosition( int position );
private:
Phonon::MediaObject* m_media;
Phonon::AudioPath* m_path;
Phonon::AudioOutput* m_output;
};
#endif
// vim: set et sw=4 tw=0 sta:
This diff is collapsed.
......@@ -16,22 +16,29 @@
#ifndef PLAYERMANAGER_H
#define PLAYERMANAGER_H
#include "player.h"
//Added by qt3to4:
#include <QPixmap>
#include <QObject>
#include "filehandle.h"
class QTimer;
class KSelectAction;
class SliderAction;
class StatusLabel;
class PlaylistInterface;
namespace Phonon
{
class AudioOutput;
class AudioPath;
class MediaObject;
}
/**
* This class serves as a proxy to the Player interface and handles managing
* the actions from the top-level mainwindow.
*/
class PlayerManager : public Player
class PlayerManager : public QObject
{
Q_OBJECT
......@@ -57,6 +64,8 @@ public:
FileHandle playingFile() const;
QString playingString() const;
KSelectAction* outputDeviceSelectAction();
void setPlaylistInterface(PlaylistInterface *interface);
void setStatusLabel(StatusLabel *label);
......@@ -89,14 +98,12 @@ signals:
void signalStop();
private:
Player *player() const;
void setup();
void setOutput(const QString &);
private slots:
void slotPollPlay();
void slotFinished();
void slotTick(qint64);
void slotUpdateTime(int position);
void slotSetOutput(const QString &);
void slotSetVolume(int volume);
private:
......@@ -104,13 +111,15 @@ private:
SliderAction *m_sliderAction;
PlaylistInterface *m_playlistInterface;
StatusLabel *m_statusLabel;
Player *m_player;
QTimer *m_timer;
bool m_noSeek;
bool m_muted;
bool m_setup;
static const int m_pollInterval = 800;
Phonon::AudioOutput *m_output;
Phonon::AudioPath *m_audioPath;
Phonon::MediaObject *m_media;
};
#endif
......
......@@ -49,6 +49,8 @@
#include <QtDBus>
#include <kaction.h>
#include "collectionadaptor.h"
#include <ktoggleaction.h>
#include <kactionmenu.h>
#define widget (kapp->mainWidget())
using namespace ActionCollection;
......@@ -291,7 +293,7 @@ QString PlaylistCollection::trackProperty(const QString &file, const QString &pr
QPixmap PlaylistCollection::trackCover(const QString &file, const QString &size) const
{
if(size.lower() != "small" && size.lower() != "large")
if(size.toLower() != "small" && size.toLower() != "large")
return QPixmap();
CollectionList *l = CollectionList::instance();
......@@ -300,7 +302,7 @@ QPixmap PlaylistCollection::trackCover(const QString &file, const QString &size)
if(!item)
return QPixmap();
if(size.lower() == "small")
if(size.toLower() == "small")
return item->file().coverInfo()->pixmap(CoverInfo::Thumbnail);
else
return item->file().coverInfo()->pixmap(CoverInfo::FullSize);
......
......@@ -142,7 +142,6 @@ SliderAction::SliderAction(const QString &text, KActionCollection* collection, c
m_dragging(false),
m_volumeDragging(false)
{
setToolBarWidgetFactory(this);
}
SliderAction::~SliderAction()
......
......@@ -49,7 +49,7 @@ private slots:
void slotValueChanged(int value);
};
class SliderAction : public KAction, public QActionWidgetFactory
class SliderAction : public KAction
{
Q_OBJECT
......
......@@ -116,7 +116,7 @@ PassiveInfo::PassiveInfo(QWidget *parent) :
void PassiveInfo::setTimeout(int delay)
{
m_timer->changeInterval(delay);
m_timer->start(delay);
}
void PassiveInfo::show()
......
......@@ -56,7 +56,7 @@ Tag::Tag(const QString &fileName) :
{
// using qDebug here since we want this to show up in non-debug builds as well
qDebug("Reading tag for %s", fileName.local8Bit().data());
qDebug("Reading tag for %s", fileName.toLocal8Bit().data());
if(MediaFiles::isMP3(fileName)) {
TagLib::MPEG::File file(QFile::encodeName(fileName).data());
......
......@@ -121,7 +121,7 @@ void DefaultSequenceIterator::advance()
// Pick first song remaining in list.
for(unsigned i = 0; i < albumMatches.count(); ++i)
for(int i = 0; i < albumMatches.count(); ++i)
if(albumMatches[i]->file().tag()->track() < item->file().tag()->track())
item = albumMatches[i];
m_albumSearch.clearItem(item);
......
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