diff --git a/CMakeLists.txt b/CMakeLists.txt index d9ba7c7..14cb424 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,156 +1,158 @@ project(kscd) cmake_minimum_required(VERSION 2.8.12) find_package(ECM REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH "${ECM_MODULE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake") add_definitions(-fexceptions) include(FeatureSummary) include(KDEInstallDirs) include(KDECMakeSettings) include(KDECompilerSettings NO_POLICY_SCOPE) include(ECMInstallIcons) # Handle build type if(CMAKE_BUILD_TYPE MATCHES [Dd]ebug) message(STATUS "Debug build") add_definitions(-DKSCD_DEBUG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0") else() message(STATUS "Release build") add_definitions(-DNDEBUG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2") endif() find_package(Qt5 REQUIRED COMPONENTS Widgets Svg) -find_package(KF5 REQUIRED I18n Solid KIO KDELibs4Support GlobalAccel DBusAddons) +find_package(KF5 REQUIRED Config I18n Solid KIO KDELibs4Support GlobalAccel DBusAddons) find_package(Phonon4Qt5 REQUIRED) find_package(MusicBrainz5 REQUIRED) find_package(DiscId REQUIRED) include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/gui ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${PHONON_INCLUDE_DIR} ${MUSICBRAINZ5_INCLUDE_DIR} ${DISCID_INCLUDE_DIR} ) if(BUILD_TESTING) find_package(Qt5Test REQUIRED) add_subdirectory(tests) endif() ########### next target ############### set(kscd_SRCS ########## # Main ########## kscd.cpp ############### # Solid/Phonon ############### hwcontroler.cpp audiocd.cpp ######################### # Music Brainz ######################### mbmanager.cpp #################### # Graphics / SVG #################### gui/kscdwindow.cpp gui/kscdwidget.cpp gui/ejectbutton.cpp gui/stopbutton.cpp gui/playbutton.cpp gui/nextbutton.cpp gui/previousbutton.cpp gui/mutebutton.cpp gui/randombutton.cpp gui/loopbutton.cpp gui/tracklistbutton.cpp gui/volumebutton.cpp gui/panel.cpp gui/titlePopUp.cpp gui/tracklistdlg.cpp gui/background.cpp gui/closebutton.cpp gui/minimizebutton.cpp #gui/seekslider.cpp gui/seekcursor.cpp gui/seekbar.cpp #################### # DBus Connection #################### dbus/PlayerDBusHandler.cpp dbus/RootDBusHandler.cpp dbus/TracklistDBusHandler.cpp ) ################################## # DBUS LINKING # ################################## qt5_add_dbus_adaptor(kscd_SRCS org.kde.kscd.cdplayer.xml kscd.h KSCD) qt5_add_dbus_adaptor( kscd_SRCS dbus/org.freedesktop.MediaPlayer.root.xml dbus/RootDBusHandler.h KsCD::RootDBusHandler RootAdaptor RootAdaptor) qt5_add_dbus_adaptor( kscd_SRCS dbus/org.freedesktop.MediaPlayer.player.xml dbus/PlayerDBusHandler.h KsCD::PlayerDBusHandler PlayerAdaptor PlayerAdaptor) qt5_add_dbus_adaptor( kscd_SRCS dbus/org.freedesktop.MediaPlayer.tracklist.xml dbus/TracklistDBusHandler.h KsCD::TracklistDBusHandler TracklistAdaptor TracklistAdaptor) ################################## # Graphics Setting # ################################## file(GLOB resource_svg "gui/skin/*.svg") ki18n_wrap_ui(kscd_SRCS gui/trackListDlgUI.ui generalSettings.ui interfaceSettings.ui) ################################## # KsCD Executable # ################################## kconfig_add_kcfg_files(kscd_SRCS prefs.kcfgc) add_executable(kscd ${kscd_SRCS}) ################################## # Libraries Linking # ################################## target_link_libraries(kscd Qt5::Widgets Qt5::Svg KF5::Solid + KF5::ConfigGui + KF5::I18n KF5::KDELibs4Support KF5::GlobalAccel KF5::DBusAddons ${PHONON_LIBRARIES} ${MUSICBRAINZ5_LIBRARIES} ${DISCID_LIBRARIES} ) ########### install files ############### install(TARGETS kscd ${INSTALL_TARGETS_DEFAULT_ARGS}) install(FILES ${resource_svg} DESTINATION ${DATA_INSTALL_DIR}/kscd/skin) install(PROGRAMS org.kde.kscd.desktop DESTINATION ${XDG_APPS_INSTALL_DIR}) install(FILES kscd.kcfg DESTINATION ${KCFG_INSTALL_DIR}) install(FILES kscd-play-audiocd.desktop DESTINATION ${DATA_INSTALL_DIR}/solid/actions) install(FILES org.kde.kscd.cdplayer.xml DESTINATION ${DBUS_INTERFACES_INSTALL_DIR}) add_subdirectory(pics) feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/dbus/PlayerDBusHandler.cpp b/dbus/PlayerDBusHandler.cpp index 07089f9..980b162 100644 --- a/dbus/PlayerDBusHandler.cpp +++ b/dbus/PlayerDBusHandler.cpp @@ -1,165 +1,166 @@ /****************************************************************************** * Copyright (C) 2008 Amine Bouchikhi * * * * 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. * * * * 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, see . * ******************************************************************************/ #include "PlayerDBusHandler.h" #include "../kscd.h" -#include + +#include +#include #include #include -#include #include "PlayerAdaptor.h" // Marshall the DBusStatus data into a D-BUS argument QDBusArgument &operator<<(QDBusArgument &argument, const DBusStatus &status) { argument.beginStructure(); argument << status.Play; argument << status.Random; argument << status.Repeat; argument << status.RepeatPlaylist; argument.endStructure(); return argument; } // Retrieve the DBusStatus data from the D-BUS argument const QDBusArgument &operator>>(const QDBusArgument &argument, DBusStatus &status) { argument.beginStructure(); argument >> status.Play; argument >> status.Random; argument >> status.Repeat; argument >> status.RepeatPlaylist; argument.endStructure(); return argument; } namespace KsCD { PlayerDBusHandler *PlayerDBusHandler::s_instance = 0; PlayerDBusHandler::PlayerDBusHandler(KSCD* kscd) : QObject() { player = kscd; - kDebug() << "**** Launching Player Handler ****"; + qDebug() << "**** Launching Player Handler ****"; new PlayerAdaptor( this ); QDBusConnection::sessionBus().registerObject( QLatin1String( "/Player" ), this); s_instance = this; setObjectName( QLatin1String("PlayerDBusHandler" )); //QDBusConnection::sessionBus().registerObject( QLatin1String( "/Player" ), this); connect( this, SIGNAL(StatusChange(DBusStatus)), this, SLOT(slotCapsChange()) ); } DBusStatus PlayerDBusHandler::GetStatus() { - kDebug() << "**** Dbus -> GetStatus() ****"; + qDebug() << "**** Dbus -> GetStatus() ****"; struct DBusStatus s; memset(&s, 0, sizeof(struct DBusStatus)); return s; } void PlayerDBusHandler::Pause() { - kDebug() << "**** Dbus -> Pause() ****"; + qDebug() << "**** Dbus -> Pause() ****"; player->getDevices()->pause() ; } void PlayerDBusHandler::Play() { - kDebug() << "**** Dbus -> Play() ****"; + qDebug() << "**** Dbus -> Play() ****"; player->getDevices()->play(); } void PlayerDBusHandler::Next() { - kDebug() << "**** Dbus -> Next() ****"; + qDebug() << "**** Dbus -> Next() ****"; player->getDevices()->nextTrack(); } void PlayerDBusHandler::Prev() { - kDebug() << "**** Dbus -> Prev() ****"; + qDebug() << "**** Dbus -> Prev() ****"; player->getDevices()->prevTrack(); } void PlayerDBusHandler::Repeat( bool on ) { - kDebug() << "**** Dbus -> Repeat() ****"; + qDebug() << "**** Dbus -> Repeat() ****"; } //position is specified in milliseconds int PlayerDBusHandler::PositionGet() { - kDebug() << "**** Dbus -> PositionGet() ****"; + qDebug() << "**** Dbus -> PositionGet() ****"; return player->getDevices()->getTotalTime() - player->getDevices()->getRemainingTime(); } void PlayerDBusHandler::PositionSet( int time ) { - kDebug() << "**** Dbus -> Position set() = "< Position set() = "< Stop() ****"; + qDebug() << "**** Dbus -> Stop() ****"; player->getDevices()->stop(); } int PlayerDBusHandler::VolumeGet() { - kDebug() << "**** Dbus -> VolumeGet() ****"; + qDebug() << "**** Dbus -> VolumeGet() ****"; return player->getDevices()->getVolume(); } void PlayerDBusHandler::VolumeSet( int vol ) { - kDebug() << "**** Dbus -> VolumeSet() ****"; + qDebug() << "**** Dbus -> VolumeSet() ****"; player->getDevices()->setVolume(vol); } int PlayerDBusHandler::GetCaps() { - kDebug() << "**** Dbus -> GetCaps() ****"; + qDebug() << "**** Dbus -> GetCaps() ****"; return 0; } void PlayerDBusHandler::slotCapsChange() { - kDebug() << "**** Dbus -> slotCapsChange() ****"; + qDebug() << "**** Dbus -> slotCapsChange() ****"; } void PlayerDBusHandler::slotTrackChange() { - kDebug() << "**** Dbus -> slotTrackChange() ****"; + qDebug() << "**** Dbus -> slotTrackChange() ****"; } void PlayerDBusHandler::slotStatusChange() { - kDebug() << "**** Dbus -> slotStatusChange() ****"; + qDebug() << "**** Dbus -> slotStatusChange() ****"; } } // namespace KsCD diff --git a/gui/background.h b/gui/background.h index baf341d..1cd07e0 100644 --- a/gui/background.h +++ b/gui/background.h @@ -1,59 +1,59 @@ /* * Kscd - A simple cd player for the KDE Project * * Copyright (c) 1997 Bernd Johannes wuebben@math.cornell.edu * Copyright (c) 2002-2003 Aaron J. Seigo * Copyright (c) 2004 Alexander Kern * Copyright (c) 2003-2006 Richard Lärkäng * * -------------- * ISI KsCD Team : * -------------- * Stanislas KRZYWDA * Sovanramy Var * Bouchikhi Mohamed-Amine * Gastellu Sylvain * ----------------------------------------------------------------------------- * * 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, or (at your option) * any later version. * * 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. * */ #ifndef BACKGROUND_H #define BACKGROUND_H -#include -#include -#include #include +#include #include -#include +#include +#include + #include "kscdwidget.h" class BackGround:public KscdWidget { Q_OBJECT public: explicit BackGround(QWidget * parent=0, const QString& sName=QLatin1String( "kscdBack" )); virtual ~BackGround(); private: void mousePressEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent * event); void enterEvent (QEvent * event); void leaveEvent (QEvent * event); }; #endif /*BACKGROUND_H_*/ diff --git a/gui/closebutton.h b/gui/closebutton.h index 42b942f..6b2f04a 100644 --- a/gui/closebutton.h +++ b/gui/closebutton.h @@ -1,50 +1,50 @@ /* * Kscd - A simple cd player for the KDE Project * * Copyright (c) 1997 Bernd Johannes wuebben@math.cornell.edu * Copyright (c) 2002-2003 Aaron J. Seigo * Copyright (c) 2004 Alexander Kern * Copyright (c) 2003-2006 Richard Lärkäng * * -------------- * ISI KsCD Team : * -------------- * Stanislas KRZYWDA * Sovanramy Var * Bouchikhi Mohamed-Amine * Gastellu Sylvain * ----------------------------------------------------------------------------- * * 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, or (at your option) * any later version. * * 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. * */ #ifndef CLOSEBUTTON_H #define CLOSEBUTTON_H -#include #include -#include +#include + #include "kscdwidget.h" class CloseButton:public KscdWidget { Q_OBJECT public: explicit CloseButton(QWidget * parent=0); virtual ~CloseButton(); }; #endif /*CLOSEBUTTON_H_*/ diff --git a/gui/ejectbutton.h b/gui/ejectbutton.h index 0b3aea9..1d165f1 100644 --- a/gui/ejectbutton.h +++ b/gui/ejectbutton.h @@ -1,51 +1,51 @@ /* * Kscd - A simple cd player for the KDE Project * * Copyright (c) 1997 Bernd Johannes wuebben@math.cornell.edu * Copyright (c) 2002-2003 Aaron J. Seigo * Copyright (c) 2004 Alexander Kern * Copyright (c) 2003-2006 Richard Lärkäng * * -------------- * ISI KsCD Team : * -------------- * Stanislas KRZYWDA * Sovanramy Var * Bouchikhi Mohamed-Amine * Gastellu Sylvain * ----------------------------------------------------------------------------- * * 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, or (at your option) * any later version. * * 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. * */ #ifndef EJECTBUTTON_H #define EJECTBUTTON_H #include #include -#include + #include "kscdwidget.h" class EjectButton:public KscdWidget { Q_OBJECT public: explicit EjectButton(QWidget * parent=0); virtual ~EjectButton(); }; #endif /*EJECTBUTTON_H_*/ diff --git a/gui/kscdwidget.cpp b/gui/kscdwidget.cpp index 4de1dbd..a1e8b53 100644 --- a/gui/kscdwidget.cpp +++ b/gui/kscdwidget.cpp @@ -1,196 +1,200 @@ /* * Kscd - A simple cd player for the KDE Project * * Copyright (c) 1997 Bernd Johannes wuebben@math.cornell.edu * Copyright (c) 2002-2003 Aaron J. Seigo * Copyright (c) 2004 Alexander Kern * Copyright (c) 2003-2006 Richard Lärkäng * * -------------- * ISI KsCD Team : * -------------- * Stanislas KRZYWDA * Sovanramy Var * Bouchikhi Mohamed-Amine * Gastellu Sylvain * ----------------------------------------------------------------------------- * * 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, or (at your option) * any later version. * * 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 "kscdwidget.h" + +#include +#include #include -#include #include -#include -#include "klocale.h" +#include + +#include + KscdWidget::KscdWidget(const QString& sName,QWidget * parent):QWidget(parent) { m_state = QLatin1String( "default" ); m_name = sName; m_baseName = m_name; m_id = m_name + QLatin1Char( '_' ) + m_state; m_path = Prefs::url(); m_renderer = new QSvgRenderer(this); loadSkin(m_path); if (m_renderer->elementExists(m_id)) { setFixedSize(m_renderer->boundsOnElement(m_id).width(), m_renderer->boundsOnElement(m_id).height()); connect(this, SIGNAL(needRepaint()),this, SLOT(repaint())); connect(this,SIGNAL(changePicture()),this,SLOT(update())); setMouseTracking ( true ); } } KscdWidget::~KscdWidget() { delete m_bounds; delete m_renderer; } void KscdWidget::setName(const QString & sName) { m_name = sName; } QString KscdWidget::getName() const { return m_name; } QString KscdWidget::getState() const { return m_state; } void KscdWidget::setId(const QString & name,const QString & state) { m_id = name + QLatin1Char( '_' ) + state; } QString KscdWidget::getId() const { return m_id; } void KscdWidget::loadPicture(const QString & name,const QString & state) { m_id= name + QLatin1Char( '_' ) + state; emit(changePicture()); emit(needRepaint()); } void KscdWidget::paintEvent(QPaintEvent *event) { QPainter painter(this); if (m_renderer->elementExists(m_id)) m_renderer->render(&painter,m_id); } void KscdWidget::enterEvent (QEvent * event ) { event->accept(); m_state = QLatin1String( "over" ); m_id = m_name + QLatin1Char( '_' ) + m_state; emit(needRepaint()); setToolTip( i18n( qPrintable( m_name ) ) ); } void KscdWidget::leaveEvent (QEvent * event ) { event->accept(); m_state = QLatin1String( "default" ); m_id = m_name + QLatin1Char( '_' ) + m_state; emit(needRepaint()); } void KscdWidget::mousePressEvent(QMouseEvent *event) { if(m_bounds->contains(event->pos()+(m_bounds->boundingRect()).topLeft())) { event->accept(); - kDebug() << "**** button name : " << m_name << " ****"; + qDebug() << "**** button name : " << m_name << " ****"; m_state = QLatin1String( "pressed" ); m_id = m_name + QLatin1Char( '_' )+ m_state; emit(needRepaint()); } else { event->ignore(); } } void KscdWidget::mouseReleaseEvent(QMouseEvent *event) { if(m_bounds->contains(event->pos()+(m_bounds->boundingRect()).topLeft())) { event->accept(); m_state = QLatin1String( "over" ); m_id = m_name + QLatin1Char( '_' ) + m_state; emit(buttonClicked(QString(m_name))); emit(needRepaint()); } else { event->ignore(); } } QString KscdWidget::getPath() const { return m_path; } QRegion* KscdWidget::bounds() const { return m_bounds; } QPixmap KscdWidget::getPix() const { return pix; } void KscdWidget::loadSkin(const QString & skin) { const QString newId = m_baseName + QLatin1String( "_default" ); m_path = skin; if (!m_renderer->load(skin)) { Prefs::setUrl(Prefs::defaultUrlValue()); m_path = Prefs::url(); m_renderer->load(skin); } if (m_renderer->elementExists(m_id)){ QRectF rect = m_renderer->boundsOnElement(newId); resize(rect.width(),rect.height()); pix = QPixmap(rect.toRect().size()); pix.fill(QColor(Qt::transparent)); QPainter p(&pix); m_renderer->render(&p,newId,rect); m_bounds = new QRegion(pix); //setMask( pix.mask() ); move(rect.toRect().x(),rect.toRect().y()); } } diff --git a/gui/kscdwidget.h b/gui/kscdwidget.h index 90f1c17..42de458 100644 --- a/gui/kscdwidget.h +++ b/gui/kscdwidget.h @@ -1,92 +1,92 @@ /* * Kscd - A simple cd player for the KDE Project * * Copyright (c) 1997 Bernd Johannes wuebben@math.cornell.edu * Copyright (c) 2002-2003 Aaron J. Seigo * Copyright (c) 2004 Alexander Kern * Copyright (c) 2003-2006 Richard Lärkäng * * -------------- * ISI KsCD Team : * -------------- * Stanislas KRZYWDA * Sovanramy Var * Bouchikhi Mohamed-Amine * Gastellu Sylvain * ----------------------------------------------------------------------------- * * 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, or (at your option) * any later version. * * 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. * */ #ifndef KSCDWIDGET_H #define KSCDWIDGET_H #include #include #include #include #include -#include + #include "prefs.h" class KscdWidget:public QWidget { Q_OBJECT public: explicit KscdWidget(const QString& sName,QWidget * parent=0); virtual ~KscdWidget(); void setName(const QString &); QString getName() const; QString getState() const; void setId(const QString &,const QString &); QString getId() const; void loadPicture(const QString &,const QString &); void enterEvent (QEvent * event); void leaveEvent (QEvent * event); void mousePressEvent(QMouseEvent * event); void mouseReleaseEvent(QMouseEvent * event); QString getPath() const; QRegion* bounds() const; QPixmap getPix() const; void rotation(qreal); protected: void paintEvent(QPaintEvent *event); public: void loadSkin(const QString &); signals: void needRepaint(); void changePicture(); void buttonClicked(const QString &); protected: QRegion *m_bounds; QString m_state; QString m_name; QString m_id; QSvgRenderer *m_renderer; private: QPixmap pix; QString m_file; QString m_path; QString m_baseName; }; #endif /*KSCDWIDGET_H_*/ diff --git a/gui/kscdwindow.cpp b/gui/kscdwindow.cpp index de2a3cc..b1280f9 100644 --- a/gui/kscdwindow.cpp +++ b/gui/kscdwindow.cpp @@ -1,415 +1,417 @@ /* * Kscd - A simple cd player for the KDE Project * * Copyright (c) 1997 Bernd Johannes wuebben@math.cornell.edu * Copyright (c) 2002-2003 Aaron J. Seigo * Copyright (c) 2004 Alexander Kern * Copyright (c) 2003-2006 Richard Lärkäng * * -------------- * ISI KsCD Team : * -------------- * Stanislas KRZYWDA * Sovanramy Var * Bouchikhi Mohamed-Amine * Gastellu Sylvain * ----------------------------------------------------------------------------- * * 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, or (at your option) * any later version. * * 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 "kscdwindow.h" -#include + #include #include +#include #include -#include + +#include #include "panel.h" using namespace Phonon; KscdWindow::KscdWindow(QWidget *parent):QWidget(parent) { setWindowFlags(Qt::FramelessWindowHint); m_backG = new BackGround(this); m_stopB = new StopButton(this); m_playB = new PlayButton(this); m_nextB = new NextButton(this); m_prevB = new PreviousButton(this); m_ejectB = new EjectButton(this); m_muteB = new MuteButton(this); m_randB = new RandomButton(this); m_loopB = new LoopButton(this); m_trackB = new TrackListButton(this); m_volumeB = new VolumeButton(this); m_closeB = new CloseButton(this); m_miniB = new MinimizeButton(this); // m_slider = new SeekSlider(this); m_bar = new SeekBar(this); m_panel = new Panel(this); m_stateTrackDialog = false; m_trackDlgCreated = false; m_trackDlg = new TrackListDlg(parent); // m_prefB = new ConfigButton(this); m_move = false; // createTrackWindow(); setMask( m_backG->getPix().mask() ); connect(m_stopB,SIGNAL(buttonClicked(QString)),this,SIGNAL(actionClicked(QString))); connect(m_playB,SIGNAL(buttonClicked(QString)),this,SIGNAL(actionClicked(QString))); connect(m_prevB,SIGNAL(buttonClicked(QString)),this,SIGNAL(actionClicked(QString))); connect(m_nextB,SIGNAL(buttonClicked(QString)),this,SIGNAL(actionClicked(QString))); connect(m_ejectB,SIGNAL(buttonClicked(QString)),this,SIGNAL(actionClicked(QString))); connect(m_muteB,SIGNAL(buttonClicked(QString)),this,SIGNAL(actionClicked(QString))); connect(m_randB,SIGNAL(buttonClicked(QString)),this,SIGNAL(actionClicked(QString))); connect(m_loopB,SIGNAL(buttonClicked(QString)),this,SIGNAL(actionClicked(QString))); connect(m_trackB,SIGNAL(buttonClicked(QString)),this,SIGNAL(actionClicked(QString))); connect(m_volumeB,SIGNAL(buttonClicked(QString)),this,SIGNAL(actionClicked(QString))); connect(m_volumeB,SIGNAL(volumeChange(qreal)),this,SIGNAL(actionVolume(qreal))); connect(m_trackDlg,SIGNAL(itemClicked(int)),this,SLOT(doubleClickedEvent(int))); connect( m_trackDlg, SIGNAL(trackListClosed()), this, SLOT(closeTrackDialog()) ); connect(m_miniB,SIGNAL(buttonClicked(QString)),this,SIGNAL(actionClicked(QString))); connect(m_closeB,SIGNAL(buttonClicked(QString)),this,SIGNAL(actionClicked(QString))); connect(m_volumeB,SIGNAL(volumeChange(qreal)),m_panel,SLOT(setVolumeDisplay(qreal))); // connect(m_prefB,SIGNAL(buttonClicked(QString)),this,SIGNAL(actionClicked(QString))); } KscdWindow::~KscdWindow() { delete m_playB; delete m_stopB; delete m_nextB; delete m_prevB; delete m_ejectB; delete m_muteB; delete m_trackB; delete m_panel; delete m_closeB; delete m_backG; delete m_miniB; // delete m_slider; delete m_volumeB; delete m_loopB; delete m_randB; // delete /*m_popUp*/; delete m_trackDlg; } void KscdWindow::closeTrackDialog() { - kDebug()<<"Close Track Dialog"; + qDebug()<<"Close Track Dialog"; m_stateTrackDialog = false; m_trackDlg->hide(); } // void KscdWindow::clearTracklist() void KscdWindow::createTrackDialog(const QList & trackList,const QString & albumTitle) { QList::const_iterator it; QList::const_iterator end = trackList.constEnd(); m_trackDlg->removeRowsTrackTable(); m_stateTrackDialog = true; m_trackDlg->setAlbumLbl(albumTitle); int trackNumber = 0; m_trackDlg->setRowCount(trackList.count()); for(it = trackList.constBegin();it != end;++it) { m_trackDlg->addItemTrackTable(trackNumber,0,QString::number(trackNumber+1)); m_trackDlg->addItemTrackTable(trackNumber,1,(*it).Title); QTime time; time = time.addMSecs((*it).Duration); m_trackDlg->addItemTrackTable(trackNumber,2,time.toString(QLatin1String( "mm:ss" ))); // m_trackDlg->setYearLbl((*it).Year); trackNumber++; } m_trackDlg->moveTrackDialog(x(),y()+frameGeometry().height()); m_trackDlg->show(); } //Apply changes on kscdwidgets with new skin void KscdWindow::setNewSkin(QString & newS){ - kDebug () << "make change with new skin :"<writeConfig(); - kDebug () << "**** " << Prefs::url() << " ****"; + qDebug () << "**** " << Prefs::url() << " ****"; QSvgRenderer* rend = new QSvgRenderer(newS,this); this->resize(rend->boundsOnElement(QLatin1String( "kscdBack_default" )).width(), rend->boundsOnElement(QLatin1String( "kscdBack_default" )).height()); m_backG->loadSkin(newS); m_stopB->loadSkin(newS); m_playB->loadSkin(newS); m_prevB->loadSkin(newS); m_nextB->loadSkin(newS); m_ejectB->loadSkin(newS); m_muteB->loadSkin(newS); m_randB->loadSkin(newS); m_loopB->loadSkin(newS); m_trackB->loadSkin(newS); m_volumeB->loadSkin(newS); m_closeB->loadSkin(newS); m_miniB->loadSkin(newS); m_panel->loadSkin(newS); sslider->move(m_bar->x(),m_bar->y()-5); sslider->setMaximumWidth(m_bar->width()); sslider->setMinimumWidth(m_bar->width()); // (m_slider->cursor())->changeSkin(newS); // (m_slider->bar())->changeSkin(newS); //m_popUp->changeSkin(newS);; QRectF rect = rend->boundsOnElement(QLatin1String( "kscdBack_default" )); QPixmap pix(rect.toRect().size()); pix.fill(QColor(Qt::transparent)); QPainter p(&pix); rend->render(&p,QLatin1String( "kscdBack_default" ),rect); setMask(pix.mask()); delete rend; } void KscdWindow::doubleClickedEvent(int pos) { - kDebug()<<"signal recu\n"<<"pos clicked:"<addWidget((QWidget*)ss, 2, 3,1,2); // } /** * hide the title popUp */ // void KscdWindow::hideTitlePopUp() // { // if(m_titlePopUp != NULL) // { // m_titlePopUp->hide(); // } // } /** * Links treatments with the UI */ void KscdWindow::catchButton(QString & name) { - kDebug()<<"Catch :" << name; + qDebug()<<"Catch :" << name; emit(actionClicked(name)); } void KscdWindow::catchVolume(qreal value) { emit(actionVolume(value)); } void KscdWindow::changePicture(const QString & name,const QString & state) { - kDebug() << name << state; + qDebug() << name << state; QString result; QString def = QLatin1String( "default" ); if(name == QLatin1String( "play" )) { result = QLatin1String( "pause" ); m_playB->loadPicture(result,state); m_playB->setName(result); } else if(name == QLatin1String( "pause" )) { result = QLatin1String( "play" ); m_playB->loadPicture(result,state); m_playB->setName(result); } else if(name == QLatin1String( "stop" )) { result = QLatin1String( "play" ); m_stopB->loadPicture(name,state); m_playB->setName(result); QString tmp = m_playB->getName(); m_playB->loadPicture(tmp,def); } else if(name == QLatin1String( "eject" )) { result = QLatin1String( "play" ); m_playB->setName(result); QString tmp = m_playB->getName(); m_playB->loadPicture(tmp,def); } else if(name == QLatin1String( "next" )) { m_nextB->loadPicture(name,state); } else if(name == QLatin1String( "previous" )) { m_prevB->loadPicture(name,state); } else if(name == QLatin1String( "mute" )) { m_muteB->loadPicture(name,state); } else if(name == QLatin1String( "unmute" )) { m_muteB->loadPicture(name,state); } else if(name == QLatin1String( "random" )) { m_randB->loadPicture(name,state); } else if(name == QLatin1String( "p_random" )) { result = QLatin1String( "random" ); def = QLatin1String( "pressed" ); m_randB->loadPicture(result,def); } else if(name == QLatin1String( "loop" )) { m_loopB->loadPicture(name,state); } else if(name == QLatin1String( "looptrack" )) { m_loopB->loadPicture(name,state); } else if(name == QLatin1String( "loopdisc" )) { m_loopB->loadPicture(name,state); } else if(name == QLatin1String( "tracklist" )) { m_trackB->loadPicture(name,state); } else if(name == QLatin1String( "close" )) { m_closeB->loadPicture(name,state); } else if(name == QLatin1String( "minimize" )) { m_miniB->loadPicture(name,state); } } KscdWidget & KscdWindow::getPanel() const{ return *m_panel; } //void KscdWindow::paintEvent(QPaintEvent *event) //{ // QPainter painter(this); // painter.setBackgroundMode(Qt::TransparentMode); //} /** * Manages the Trackinfo Label */ void KscdWindow::showTrackinfoLabel(QString & infoStatus) { m_panel->setTitle(infoStatus); } /** * Manages the Artist label */ void KscdWindow::showArtistLabel(QString & infoStatus) { m_panel->setAuthor(infoStatus); } void KscdWindow::showArtistAlbum(QString & infoStatus) { m_panel->setAlbum(infoStatus); } void KscdWindow::setTime(qint64 pos){ m_panel->setTime(pos); // m_slider->setTime(pos); } void KscdWindow::panelInfo(const QString & mess) { QString informationDisplay; if(mess == QLatin1String( "loop" )) { m_panel->setLoop(QLatin1String( "" )); } if(mess == QLatin1String( "looptrack" )) { m_panel->setLoop(i18n( "loop track " )); //informationDisplay = "loop track "; } if(mess == QLatin1String( "loopdisc" )) { //informationDisplay = "loop disc "; m_panel->setLoop(i18n( "loop disc " )); } if(mess == QLatin1String( "random" )) { m_panel->setRandom(QLatin1String( "" )); } if(mess == QLatin1String( "p_random" )) { //informationDisplay += "random"; m_panel->setRandom(i18nc( "This action allow the user to listen a random track","random")); } m_panel->displayInfo(m_panel->getLoop(),m_panel->getRandom()); } void KscdWindow::mousePressEvent(QMouseEvent *event) { if(event->button() == Qt::LeftButton) { event->accept(); mousePosition = event->pos(); m_move =true; grabMouse(Qt::SizeAllCursor); } else { event->ignore(); } } void KscdWindow::mouseReleaseEvent(QMouseEvent *event) { releaseMouse(); m_move = false; } void KscdWindow::mouseMoveEvent(QMouseEvent * event) { if(m_move == true) { event->accept(); move(event->globalPos() - mousePosition); //emit(moveValue(event->globalPos() - mousePosition)); } else { event->ignore(); } } diff --git a/gui/kscdwindow.h b/gui/kscdwindow.h index a58fe9c..4ed8a3a 100644 --- a/gui/kscdwindow.h +++ b/gui/kscdwindow.h @@ -1,166 +1,165 @@ /* * Kscd - A simple cd player for the KDE Project * * Copyright (c) 1997 Bernd Johannes wuebben@math.cornell.edu * Copyright (c) 2002-2003 Aaron J. Seigo * Copyright (c) 2004 Alexander Kern * Copyright (c) 2003-2006 Richard Lärkäng * * -------------- * ISI KsCD Team : * -------------- * Stanislas KRZYWDA * Sovanramy Var * Bouchikhi Mohamed-Amine * Gastellu Sylvain * ----------------------------------------------------------------------------- * * 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, or (at your option) * any later version. * * 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. * */ #ifndef KSCDWINDOW_H #define KSCDWINDOW_H #include -#include +#include #include -#include #include -#include -#include +#include +#include + +#include + #include "kscdwidget.h" #include "stopbutton.h" #include "playbutton.h" #include "nextbutton.h" #include "previousbutton.h" #include "ejectbutton.h" #include "mutebutton.h" #include "randombutton.h" #include "loopbutton.h" #include "tracklistbutton.h" #include "volumebutton.h" #include "tracklistdlg.h" #include "closebutton.h" #include "minimizebutton.h" #include "background.h" #include "panel.h" #include "titlePopUp.h" #include "seekslider.h" #include "seekcursor.h" // #include "cddbmanager.h" #include "mbmanager.h" #include // #include #include "prefs.h" - -#include - class KscdWindow:public QWidget { Q_OBJECT protected: KscdWidget *m_stopB; KscdWidget *m_playB; KscdWidget *m_prevB; KscdWidget *m_nextB; KscdWidget *m_ejectB; KscdWidget *m_muteB; KscdWidget *m_randB; KscdWidget *m_loopB; KscdWidget *m_trackB; VolumeButton *m_volumeB; KscdWidget *m_closeB; KscdWidget *m_backG; KscdWidget *m_miniB; KscdWidget *m_prefB; // SeekSlider *m_slider; SeekBar *m_bar; Phonon::SeekSlider *sslider; Panel *m_panel; KscdWidget *m_popup; TrackListDlg *m_trackDlg; QPoint mousePosition; bool m_move; const QPalette * p_panelColor; void mousePressEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent * event); /** * Create the track list dialog */ void createTrackDialog(const QList & trackList,const QString & albumTitle); /** The dialog track state : true = visible / false = hide */ bool m_stateTrackDialog; /** The state creation of the track dialog */ bool m_trackDlgCreated; public: /** * Constructor */ KscdWindow(QWidget * parent = 0); /** * Destructor */ virtual ~KscdWindow(); // void paintEvent(QPaintEvent *event); KscdWidget & getPanel() const; void setTime(qint64 pos); public slots: void catchButton(QString &); void catchVolume(qreal); void changePicture(const QString &, const QString &); void doubleClickedEvent(int); void showArtistLabel(QString &); void showTrackinfoLabel(QString &); void panelInfo(const QString &); /** * Refresh skin */ void setNewSkin(QString &); void showArtistAlbum(QString &); //void setTime(qint64 pos); /** * Close the track list dialog */ void closeTrackDialog(); signals: void actionClicked(const QString &); void actionVolume(qreal); void trackClicked(int); }; #endif /*KSCDWINDOW_H_*/ diff --git a/gui/loopbutton.h b/gui/loopbutton.h index e01dbd4..b6861cb 100644 --- a/gui/loopbutton.h +++ b/gui/loopbutton.h @@ -1,53 +1,53 @@ /* * Kscd - A simple cd player for the KDE Project * * Copyright (c) 1997 Bernd Johannes wuebben@math.cornell.edu * Copyright (c) 2002-2003 Aaron J. Seigo * Copyright (c) 2004 Alexander Kern * Copyright (c) 2003-2006 Richard Lärkäng * * -------------- * ISI KsCD Team : * -------------- * Stanislas KRZYWDA * Sovanramy Var * Bouchikhi Mohamed-Amine * Gastellu Sylvain * ----------------------------------------------------------------------------- * * 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, or (at your option) * any later version. * * 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. * */ #ifndef LOOPBUTTON_H #define LOOPBUTTON_H #include #include #include -#include + #include "kscdwidget.h" class LoopButton:public KscdWidget { Q_OBJECT public: explicit LoopButton(QWidget * parent=0); virtual ~LoopButton(); void mousePressEvent(QMouseEvent * event); void mouseReleaseEvent(QMouseEvent * event); }; #endif /*LOOPBUTTON_H_*/ diff --git a/gui/minimizebutton.h b/gui/minimizebutton.h index 02797f5..9f17cba 100644 --- a/gui/minimizebutton.h +++ b/gui/minimizebutton.h @@ -1,50 +1,50 @@ /* * Kscd - A simple cd player for the KDE Project * * Copyright (c) 1997 Bernd Johannes wuebben@math.cornell.edu * Copyright (c) 2002-2003 Aaron J. Seigo * Copyright (c) 2004 Alexander Kern * Copyright (c) 2003-2006 Richard Lärkäng * * -------------- * ISI KsCD Team : * -------------- * Stanislas KRZYWDA * Sovanramy Var * Bouchikhi Mohamed-Amine * Gastellu Sylvain * ----------------------------------------------------------------------------- * * 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, or (at your option) * any later version. * * 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. * */ #ifndef MINIMIZEBUTTON_H #define MINIMIZEBUTTON_H #include #include -#include + #include "kscdwidget.h" class MinimizeButton:public KscdWidget { Q_OBJECT public: explicit MinimizeButton(QWidget * parent=0); virtual ~MinimizeButton(); }; #endif /*MINIMIZEBUTTON_H_*/ diff --git a/gui/mutebutton.h b/gui/mutebutton.h index f24f1fc..246b972 100644 --- a/gui/mutebutton.h +++ b/gui/mutebutton.h @@ -1,53 +1,53 @@ /* * Kscd - A simple cd player for the KDE Project * * Copyright (c) 1997 Bernd Johannes wuebben@math.cornell.edu * Copyright (c) 2002-2003 Aaron J. Seigo * Copyright (c) 2004 Alexander Kern * Copyright (c) 2003-2006 Richard Lärkäng * * -------------- * ISI KsCD Team : * -------------- * Stanislas KRZYWDA * Sovanramy Var * Bouchikhi Mohamed-Amine * Gastellu Sylvain * ----------------------------------------------------------------------------- * * 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, or (at your option) * any later version. * * 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. * */ #ifndef MUTEBUTTON_H #define MUTEBUTTON_H #include #include #include -#include + #include "kscdwidget.h" class MuteButton:public KscdWidget { Q_OBJECT public: explicit MuteButton(QWidget * parent=0); virtual ~MuteButton(); void mousePressEvent(QMouseEvent * event); void mouseReleaseEvent(QMouseEvent * event); }; #endif /*MUTEBUTTON_H_*/ diff --git a/gui/nextbutton.h b/gui/nextbutton.h index d7a0abf..22bb800 100644 --- a/gui/nextbutton.h +++ b/gui/nextbutton.h @@ -1,50 +1,50 @@ /* * Kscd - A simple cd player for the KDE Project * * Copyright (c) 1997 Bernd Johannes wuebben@math.cornell.edu * Copyright (c) 2002-2003 Aaron J. Seigo * Copyright (c) 2004 Alexander Kern * Copyright (c) 2003-2006 Richard Lärkäng * * -------------- * ISI KsCD Team : * -------------- * Stanislas KRZYWDA * Sovanramy Var * Bouchikhi Mohamed-Amine * Gastellu Sylvain * ----------------------------------------------------------------------------- * * 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, or (at your option) * any later version. * * 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. * */ #ifndef NEXTBUTTON_H #define NEXTBUTTON_H #include #include -#include + #include "kscdwidget.h" class NextButton:public KscdWidget { Q_OBJECT public: explicit NextButton(QWidget * parent=0); virtual ~NextButton(); }; #endif /*NEXTBUTTON_H_*/ diff --git a/gui/panel.cpp b/gui/panel.cpp index dfacd64..462e6cb 100644 --- a/gui/panel.cpp +++ b/gui/panel.cpp @@ -1,357 +1,357 @@ /* * Kscd - A simple cd player for the KDE Project * * Copyright (c) 1997 Bernd Johannes wuebben@math.cornell.edu * Copyright (c) 2002-2003 Aaron J. Seigo * Copyright (c) 2004 Alexander Kern * Copyright (c) 2003-2006 Richard Lärkäng * Copyright (c) 2008 Laurent Montel * * -------------- * ISI KsCD Team : * -------------- * Stanislas KRZYWDA * Sovanramy Var * Bouchikhi Mohamed-Amine * Gastellu Sylvain * ----------------------------------------------------------------------------- * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published byfor the time * the Free Software Foundation; either version 2, or (at your option) * any later version. * * 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 "panel.h" -#include + #include -#include +#include Panel::Panel(QWidget * parent, const QString& sName):KscdWidget(sName,parent) { m_bounds = new QRegion((m_renderer->boundsOnElement(getId())).toRect(),QRegion::Rectangle); move((m_bounds->boundingRect()).x(),(m_bounds->boundingRect()).y()); // m_bounds=new QRegion(pix.mask()); setAutoFillBackground(true); QPalette p_panelColor(Qt::transparent); setPalette(p_panelColor); vbl_layout = new QGridLayout(); vbl_layout->setVerticalSpacing(1); // index=0; ejectStatus = new QLabel(QLatin1String( "" )); titleTrack = new QLabel(QLatin1String( "" )); l_title = new QLabel(QLatin1String( "" )); l_title->setAlignment(Qt::AlignCenter); vbl_layout->addWidget(l_title,4,0); l_album = new QLabel(i18n("WELCOME!")); l_album->setAlignment(Qt::AlignCenter); vbl_layout->addWidget(l_album,3,0); l_author = new QLabel(QLatin1String( "" )); l_author->setAlignment(Qt::AlignCenter); vbl_layout->addWidget(l_author,2, 0); volumeDisplay = new QLabel(QLatin1String( "" )); vbl_layout->addWidget(volumeDisplay,5,0); l_loop = new QLabel(QLatin1String( "" )); l_random = new QLabel(QLatin1String( "" )); l_info = new QLabel(QLatin1String( "" )); textSize = new QLabel(QLatin1String( "" )); vbl_layoutIntern = new QGridLayout(); vbl_layoutIntern->addWidget(l_loop,0,0); vbl_layoutIntern->addWidget(l_random,0,1); vbl_layoutIntern->addWidget(ejectStatus,0,2); vbl_layout->addLayout(vbl_layoutIntern,0,0); l_time = new QLabel(QLatin1String( "
00 " )+i18n(":")+QLatin1String( " 00
" )); vbl_layout->addWidget(l_time, 5, 0); setLayout(vbl_layout); QTimer * timer = new QTimer (this); timer->setSingleShot(false); connect(timer,SIGNAL(timeout()),this,SLOT(update_panel_label())); timer->start(150); } void Panel::update_panel_label(){ timerVolume=timerVolume-1; if(timerVolume < 0) { volumeDisplay->clear(); } if(l_title->text().count()>0) { QFont fontActually = l_title->font(); int pointSize = fontActually.pointSize() ; int addSpace; switch (pointSize) { case 4: addSpace = 260; break; case 5: addSpace = 250; break; case 6: addSpace = 240; break; case 7: addSpace = 135; break; case 8: addSpace = 125; break; case 9: addSpace = 120; break; case 10: addSpace = 90; break; case 11: addSpace = 80; break; case 12: addSpace = 77; break; case 13: addSpace = 75; break; case 14: addSpace = 72; break; case 15: addSpace = 63; break; case 16: addSpace = 58; break; case 17: addSpace = 55; break; case 18: addSpace = 52; break; case 19: addSpace = 49; break; default: addSpace = 50; } if(l_title->text().count()!= addSpace) { l_title->setText(titleTrack->text()); } // if the size is lower than the size of the panel while(l_title->text().count()< addSpace) { //add QLatin1String( ":" ) to have the same size that the panel l_title->setText(l_title->text()+QLatin1Char( ' ' )); } //recup the first letter QChar c = l_title->text().data()[0]; //create a new data QString data; for(int i = 1; i text().count(); i++) { data = data+l_title->text().data()[i]; } //add the last letter data =data+c; setTitleDisplay(data); } } Panel::~Panel() { delete vbl_layout; delete l_title; delete ejectStatus; delete l_author; delete l_album; delete l_playing_state; delete l_volume; delete l_time; } QString Panel::getTitle() const { return l_title->text(); } QString Panel::getAlbum() const { return l_album->text(); } QString Panel::getAuthor() const { return l_author->text(); } QString Panel::getVolume() const { return l_volume->text(); } QString Panel::getLoop() const { return l_loop->text(); } QString Panel::getRandom() const { return l_random->text(); } void Panel::setTitleDisplay(const QString & title) { l_title->setText(title); } void Panel::setTitle(const QString & title) { l_title->setText(title); titleTrack->setText(title); } void Panel::setAuthor(const QString & author) { l_author->setText(author); } void Panel::setAlbum(const QString & album) { QString mess = album; l_album->setText(mess); } // void Panel::setVolume(const QString & volume) // { // volumeDisplay->setText(volume); // // } void Panel::setTextSizeFont(const QFont& font){ l_author->setFont(font); l_title->setFont(font); l_album->setFont(font); l_time->setFont(font); l_loop->setFont(font); l_random->setFont(font); ejectStatus->setFont(font); volumeDisplay->setFont(font); } void Panel::setTextColor(const QColor& c){ color = c; QPalette pal( QColor( c.red(), c.green(), c.blue() ), Qt::black, QColor( 128, 128, 128 ), QColor( 64, 64, 64 ), Qt::black, Qt::darkGreen, Qt::black ); l_title->setPalette(pal); l_author->setPalette(pal); l_album->setPalette(pal); l_time->setPalette(pal); l_loop->setPalette(pal); l_random->setPalette(pal); ejectStatus->setPalette(pal); volumeDisplay->setPalette(pal); } void Panel::setEjectAct(bool b){ if(b) { ejectStatus->setText(i18n("eject CD")); } else { ejectStatus->clear(); } } void Panel::mousePressEvent(QMouseEvent *event) { if(m_bounds->contains(event->pos()+(m_bounds->boundingRect()).topLeft())) { event->accept(); } else { event->ignore(); } } void Panel::mouseReleaseEvent(QMouseEvent *event) { if(m_bounds->contains(event->pos()+(m_bounds->boundingRect()).topLeft())) { event->accept(); } else { event->ignore(); } } void Panel::enterEvent (QEvent * event) { event->ignore(); } void Panel::leaveEvent (QEvent * event) { event->ignore(); } void Panel::setTime(qint64 pos) { qint64 md = ((pos/1000)/60)/10; qint64 mu = ((pos/1000)/60)%10; qint64 sd = ((pos/1000)%60)/10; qint64 su = ((pos/1000)%60)%10; QString result; /* %1 = Minutes decimal %2 = Minutes unit %3 = Seconds decimal %4 = Seconds unit */ QTextStream(&result) << i18n("%1 %2 : %3 %4",md,mu,sd,su); l_time->setText(QLatin1String( "
" ) + result + QLatin1String( "
" )); } void Panel::setLoop(const QString& loop) { l_loop->setText(loop); } void Panel::setRandom(const QString& random) { l_random->setText(random); } //concatenation display info random and loop panel void Panel::displayInfo(const QString& loop, const QString& random) { l_loop->setText(loop); l_random->setText(random); } QString Panel::getInfo() const { return l_info->text(); } void Panel::setVolumeDisplay(qreal volume) { timerVolume = 20; QString s; s = QString::fromLatin1( "

%1

").arg((int)volume); volumeDisplay->setText(s); } diff --git a/gui/playbutton.h b/gui/playbutton.h index 346f5cb..d624d28 100644 --- a/gui/playbutton.h +++ b/gui/playbutton.h @@ -1,52 +1,52 @@ /* * Kscd - A simple cd player for the KDE Project * * Copyright (c) 1997 Bernd Johannes wuebben@math.cornell.edu * Copyright (c) 2002-2003 Aaron J. Seigo * Copyright (c) 2004 Alexander Kern * Copyright (c) 2003-2006 Richard Lärkäng * * -------------- * ISI KsCD Team : * -------------- * Stanislas KRZYWDA * Sovanramy Var * Bouchikhi Mohamed-Amine * Gastellu Sylvain * ----------------------------------------------------------------------------- * * 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, or (at your option) * any later version. * * 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. * */ #ifndef PLAYBUTTON_H #define PLAYBUTTON_H #include #include #include -#include + #include "kscdwidget.h" class PlayButton:public KscdWidget { Q_OBJECT public: explicit PlayButton(QWidget * parent=0); virtual ~PlayButton(); void mousePressEvent(QMouseEvent * event); void mouseReleaseEvent(QMouseEvent * event); }; #endif /*PLAYBUTTON_H_*/ diff --git a/gui/previousbutton.h b/gui/previousbutton.h index 3d69fef..d24255f 100644 --- a/gui/previousbutton.h +++ b/gui/previousbutton.h @@ -1,52 +1,52 @@ /* * Kscd - A simple cd player for the KDE Project * * Copyright (c) 1997 Bernd Johannes wuebben@math.cornell.edu * Copyright (c) 2002-2003 Aaron J. Seigo * Copyright (c) 2004 Alexander Kern * Copyright (c) 2003-2006 Richard Lärkäng * * -------------- * ISI KsCD Team : * -------------- * Stanislas KRZYWDA * Sovanramy Var * Bouchikhi Mohamed-Amine * Gastellu Sylvain * ----------------------------------------------------------------------------- * * 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, or (at your option) * any later version. * * 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. * */ #ifndef PREVIOUSBUTTON_H #define PREVIOUSBUTTON_H #include #include -#include + #include "kscdwidget.h" class PreviousButton:public KscdWidget { Q_OBJECT public: explicit PreviousButton(QWidget * parent=0); virtual ~PreviousButton(); }; #endif /*PREVIOUSBUTTON_H_*/ diff --git a/gui/randombutton.h b/gui/randombutton.h index 5a9f638..edb7950 100644 --- a/gui/randombutton.h +++ b/gui/randombutton.h @@ -1,55 +1,55 @@ /* * Kscd - A simple cd player for the KDE Project * * Copyright (c) 1997 Bernd Johannes wuebben@math.cornell.edu * Copyright (c) 2002-2003 Aaron J. Seigo * Copyright (c) 2004 Alexander Kern * Copyright (c) 2003-2006 Richard Lärkäng * * -------------- * ISI KsCD Team : * -------------- * Stanislas KRZYWDA * Sovanramy Var * Bouchikhi Mohamed-Amine * Gastellu Sylvain * ----------------------------------------------------------------------------- * * 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, or (at your option) * any later version. * * 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. * */ #ifndef RANDOMBUTTON_H #define RANDOMBUTTON_H #include #include #include #include -#include + #include "kscdwidget.h" class RandomButton:public KscdWidget { Q_OBJECT public: explicit RandomButton(QWidget * parent=0); virtual ~RandomButton(); void mousePressEvent(QMouseEvent * event); void mouseReleaseEvent(QMouseEvent * event); void enterEvent (QEvent * event); void leaveEvent (QEvent * event); }; #endif /*RANDOMBUTTON_H_*/ diff --git a/gui/seekcursor.cpp b/gui/seekcursor.cpp index ea2cb38..a286354 100644 --- a/gui/seekcursor.cpp +++ b/gui/seekcursor.cpp @@ -1,68 +1,71 @@ /* * Kscd - A simple cd player for the KDE Project * * Copyright (c) 1997 Bernd Johannes wuebben@math.cornell.edu * Copyright (c) 2002-2003 Aaron J. Seigo * Copyright (c) 2004 Alexander Kern * Copyright (c) 2003-2006 Richard Lärkäng * * -------------- * ISI KsCD Team : * -------------- * Stanislas KRZYWDA * Sovanramy Var * Bouchikhi Mohamed-Amine * Gastellu Sylvain * ----------------------------------------------------------------------------- * * 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, or (at your option) * any later version. * * 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 "seekcursor.h" +#include + SeekCursor::SeekCursor(QWidget * parent,const QString& sName):KscdWidget(sName,parent) { m_posInit = x(); init(); hide(); } SeekCursor::~SeekCursor() { } int SeekCursor::getStep() const { return m_step; } void SeekCursor::setStep(qint64 time,int length) { m_step = ceil((SECOND_IN_MILLI * (float)length)/(float)time); - kDebug()<<"m_step:"< * Copyright (c) 2004 Alexander Kern * Copyright (c) 2003-2006 Richard Lärkäng * * -------------- * ISI KsCD Team : * -------------- * Stanislas KRZYWDA * Sovanramy Var * Bouchikhi Mohamed-Amine * Gastellu Sylvain * ----------------------------------------------------------------------------- * * 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, or (at your option) * any later version. * * 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. * */ #ifndef SEEKCURSOR_H #define SEEKCURSOR_H -#include #include -#include +#include + #include "kscdwidget.h" -#include + +#include #define SECOND_IN_MILLI 1000 class SeekCursor:public KscdWidget { Q_OBJECT public: SeekCursor(QWidget * parent=0, const QString& sName=QLatin1String( "seekCursor" )); virtual ~SeekCursor(); /** * Initialize the cursor to his initial position */ void init(); int getStep() const; void setStep(qint64,int); private: /** * Initial x position of the cursor */ int m_posInit; /** * Current x position of the cursor */ int m_posCurrent; /** * The step to move the cursor */ int m_step; public slots: /** * Move the cursor * @param: qreal */ void moveCursor(qreal); }; #endif /*SEEKSLIDER_H_*/ diff --git a/gui/seekslider.cpp b/gui/seekslider.cpp index db316db..828af2c 100644 --- a/gui/seekslider.cpp +++ b/gui/seekslider.cpp @@ -1,139 +1,142 @@ /* * Kscd - A simple cd player for the KDE Project * * Copyright (c) 1997 Bernd Johannes wuebben@math.cornell.edu * Copyright (c) 2002-2003 Aaron J. Seigo * Copyright (c) 2004 Alexander Kern * Copyright (c) 2003-2006 Richard Lärkäng * * -------------- * ISI KsCD Team : * -------------- * Stanislas KRZYWDA * Sovanramy Var * Bouchikhi Mohamed-Amine * Gastellu Sylvain * ----------------------------------------------------------------------------- * * 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, or (at your option) * any later version. * * 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 "seekslider.h" +#include + SeekSlider::SeekSlider(QWidget * parent):QWidget(parent) { m_bar = new SeekBar(parent); m_cursor = new SeekCursor(parent); } SeekSlider::~SeekSlider() { } SeekCursor* SeekSlider::cursor() const { return m_cursor; } SeekBar* SeekSlider::bar() const { return m_bar; } void SeekSlider::init(qint64 time) { setTime(time); m_timeL->setDuration((int)time); m_timeL->setFrameRange (0,m_bar->width()); m_timeL->setUpdateInterval(1000); m_cursor->setStep(m_time,m_bar->width()); /* setStep(m_time,m_bar->width()); - kDebug()<<"step slider"<start(); m_state = m_timeL->state(); } void SeekSlider::stop() { m_timeL->stop(); m_state = m_timeL->state(); m_cursor->init(); } void SeekSlider::pause() { m_timeL->setPaused(true); m_state = m_timeL->state(); } void SeekSlider::resume(QTimeLine::State state) { - kDebug()<<"m_state"<setPaused(false); m_state = m_timeL->state(); } } void SeekSlider::setTime(qint64 time) { m_time = time; - kDebug()<<"time:"<= 0) { // moveC(); } } // moveC(); -// kDebug()<<"SLIDER MOVEC:"; +// qDebug()<<"SLIDER MOVEC:"; // } void SeekSlider::moveC() { m_cursor->move(m_cursor->x()+m_step,m_cursor->y()); } qint64 SeekSlider::getTime() const { return m_time; } void SeekSlider::setTotalTime(qint64 time) { m_totalTime = time; - kDebug()<<"m_totalTime"<width())); - kDebug()<<"step:"< * Copyright (c) 2004 Alexander Kern * Copyright (c) 2003-2006 Richard Lärkäng * * -------------- * ISI KsCD Team : * -------------- * Stanislas KRZYWDA * Sovanramy Var * Bouchikhi Mohamed-Amine * Gastellu Sylvain * ----------------------------------------------------------------------------- * * 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, or (at your option) * any later version. * * 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. * */ #ifndef SEEKSLIDER_H #define SEEKSLIDER_H -#include #include -#include +#include + // #include "kscdwidget.h" #include "seekbar.h" #include "seekcursor.h" class SeekSlider:public QWidget { Q_OBJECT public: SeekSlider(QWidget * parent=0); virtual ~SeekSlider(); SeekCursor* cursor() const; SeekBar* bar() const; void setTime(qint64); qint64 getTime() const; void setTotalTime(qint64); void moveC(); /** * Calculation of move to do in 1 second */ void setStep(); int getStep() const; /** * Initialize all attibutes */ void init(qint64); /** * Start the qtimeline */ void start(qint64 time); /** * Stop the qtimeline */ void stop(); /** * Paused the qtimeline */ void pause(); private: /** * The bar of the slider */ SeekBar* m_bar; /** * The cursor of the slider */ SeekCursor* m_cursor; /** * A QTimeLine */ QTimeLine* m_timeL; /** * Current state of the slider */ QTimeLine::State m_state; /** * Current time of the current track */ qint64 m_time; /** * Total time of the current track */ qint64 m_totalTime; /** * Move to do in 1 second */ int m_step; public slots: /** * Restart the qtimeline after the pause mode */ void resume(QTimeLine::State state); }; #endif /*SEEKSLIDER_H_*/ diff --git a/gui/stopbutton.h b/gui/stopbutton.h index 138ea88..bc22e35 100644 --- a/gui/stopbutton.h +++ b/gui/stopbutton.h @@ -1,50 +1,50 @@ /* * Kscd - A simple cd player for the KDE Project * * Copyright (c) 1997 Bernd Johannes wuebben@math.cornell.edu * Copyright (c) 2002-2003 Aaron J. Seigo * Copyright (c) 2004 Alexander Kern * Copyright (c) 2003-2006 Richard Lärkäng * * -------------- * ISI KsCD Team : * -------------- * Stanislas KRZYWDA * Sovanramy Var * Bouchikhi Mohamed-Amine * Gastellu Sylvain * ----------------------------------------------------------------------------- * * 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, or (at your option) * any later version. * * 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. * */ #ifndef STOPBUTTON_H #define STOPBUTTON_H #include #include -#include + #include "kscdwidget.h" class StopButton:public KscdWidget { Q_OBJECT public: explicit StopButton(QWidget * parent=0); virtual ~StopButton(); }; #endif /*STOPBUTTON_H_*/ diff --git a/gui/titlePopUp.cpp b/gui/titlePopUp.cpp index 95de162..a12d889 100644 --- a/gui/titlePopUp.cpp +++ b/gui/titlePopUp.cpp @@ -1,84 +1,85 @@ /* * Kscd - A simple cd player for the KDE Project * * Copyright (c) 1997 Bernd Johannes wuebben@math.cornell.edu * Copyright (c) 2002-2003 Aaron J. Seigo * Copyright (c) 2004 Alexander Kern * Copyright (c) 2003-2006 Richard Lärkäng * * -------------- * ISI KsCD Team : * -------------- * Stanislas KRZYWDA * Sovanramy Var * Bouchikhi Mohamed-Amine * Gastellu Sylvain * ----------------------------------------------------------------------------- * * 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, or (at your option) * any later version. * * 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 "titlePopUp.h" + #include TitlePopUp::TitlePopUp(QWidget *parent, const QString& sName) : KscdWidget(sName,parent) { move(parent->width()/2,parent->height()/2); m_layout = new QGridLayout; /* resize(300,64);*/ -// kDebug() << "size : " << size(); +// qDebug() << "size : " << size(); // // move(600,400); setAutoFillBackground(false); m_lengthLbl = new QLabel(this); // m_lengthLbl->setGeometry(QRect(20, 30, 241, 22)); m_titleLbl = new QLabel(this); // m_titleLbl->setGeometry(QRect(20, 10, 201, 22)); m_layout->addWidget(m_titleLbl, 0, 0, Qt::AlignVCenter); m_layout->addWidget(m_lengthLbl, 1, 0, Qt::AlignVCenter); setLayout(m_layout); raise(); } TitlePopUp::~TitlePopUp() { delete m_layout; delete m_lengthLbl; delete m_titleLbl; } /** * show a popup containning current track title and his length */ void TitlePopUp::showTitlePopUp(const QString& trackTitle, const QString& trackLength) { QTimer::singleShot(5000, this, SLOT(hideTitlePopUp())); m_lengthLbl->setText(trackLength); m_titleLbl->setText(trackTitle); show(); } void TitlePopUp::hideTitlePopUp() { hide(); } diff --git a/gui/titlePopUp.h b/gui/titlePopUp.h index 570ec4e..7cf6113 100644 --- a/gui/titlePopUp.h +++ b/gui/titlePopUp.h @@ -1,66 +1,66 @@ /* * Kscd - A simple cd player for the KDE Project * * Copyright (c) 1997 Bernd Johannes wuebben@math.cornell.edu * Copyright (c) 2002-2003 Aaron J. Seigo * Copyright (c) 2004 Alexander Kern * Copyright (c) 2003-2006 Richard Lärkäng * * -------------- * ISI KsCD Team : * -------------- * Stanislas KRZYWDA * Sovanramy Var * Bouchikhi Mohamed-Amine * Gastellu Sylvain * Dembele Karim <> * ----------------------------------------------------------------------------- * * 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, or (at your option) * any later version. * * 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. * */ #ifndef TITLEPOPUP_H #define TITLEPOPUP_H #include #include #include + #include "kscdwidget.h" -#include class TitlePopUp : public KscdWidget { private: QGridLayout* m_layout; QLabel* m_lengthLbl; QLabel* m_titleLbl; public: TitlePopUp(QWidget *parent=0, const QString& sName=QLatin1String( "popup" )); ~TitlePopUp(); void enterEvent (QEvent * event){event->ignore();} void leaveEvent (QEvent * event){event->ignore();} void mousePressEvent(QMouseEvent * event){event->ignore();} void mouseReleaseEvent(QMouseEvent * event){event->ignore();} public slots: void showTitlePopUp(const QString& , const QString&); void hideTitlePopUp(); }; #endif // TITLEPOPUP_H diff --git a/gui/tracklistbutton.h b/gui/tracklistbutton.h index 6e3b0f8..5fe6b8c 100644 --- a/gui/tracklistbutton.h +++ b/gui/tracklistbutton.h @@ -1,50 +1,50 @@ /* * Kscd - A simple cd player for the KDE Project * * Copyright (c) 1997 Bernd Johannes wuebben@math.cornell.edu * Copyright (c) 2002-2003 Aaron J. Seigo * Copyright (c) 2004 Alexander Kern * Copyright (c) 2003-2006 Richard Lärkäng * * -------------- * ISI KsCD Team : * -------------- * Stanislas KRZYWDA * Sovanramy Var * Bouchikhi Mohamed-Amine * Gastellu Sylvain * ----------------------------------------------------------------------------- * * 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, or (at your option) * any later version. * * 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. * */ #ifndef TRACKLISTBUTTON_H #define TRACKLISTBUTTON_H #include #include -#include + #include "kscdwidget.h" class TrackListButton:public KscdWidget { Q_OBJECT public: explicit TrackListButton(QWidget * parent=0); virtual ~TrackListButton(); }; #endif /*TRACKLISTBUTTON_H_*/ diff --git a/gui/tracklistdlg.cpp b/gui/tracklistdlg.cpp index 4c69071..2801358 100644 --- a/gui/tracklistdlg.cpp +++ b/gui/tracklistdlg.cpp @@ -1,107 +1,106 @@ /* * Kscd - A simple cd player for the KDE Project * * Copyright (c) 1997 Bernd Johannes wuebben@math.cornell.edu * Copyright (c) 2002-2003 Aaron J. Seigo * Copyright (c) 2004 Alexander Kern * Copyright (c) 2003-2006 Richard Lärkäng * * -------------- * ISI KsCD Team : * -------------- * Stanislas KRZYWDA * Sovanramy Var * Bouchikhi Mohamed-Amine * Gastellu Sylvain * ----------------------------------------------------------------------------- * * 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, or (at your option) * any later version. * * 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 "tracklistdlg.h" #include -#include #include TrackListDlg::TrackListDlg(QWidget * parent) :KDialog(parent) { QWidget *page = new QWidget( this ); QVBoxLayout* vlay = new QVBoxLayout( page ); m_ui = new trackListDlgUI( this ); vlay->addWidget( m_ui ); setMainWidget( page ); setButtons( KDialog::Close ); m_ui->trackTable->horizontalHeader()->setResizeMode(0, QHeaderView::ResizeToContents); m_ui->trackTable->horizontalHeader()->setResizeMode(1, QHeaderView::Stretch); m_ui->trackTable->horizontalHeader()->setResizeMode(2, QHeaderView::ResizeToContents); m_ui->trackTable->verticalHeader()->hide(); setSizeIncrement ( 0, 50 ); connect(m_ui->trackTable,SIGNAL(itemDoubleClicked(QTableWidgetItem*)), this,SLOT(valueDoubleCliked(QTableWidgetItem*))); } TrackListDlg::~TrackListDlg() { } void TrackListDlg::closeEvent( QCloseEvent * ) { emit trackListClosed(); } void TrackListDlg::setAlbumLbl(const QString& album) { m_ui->albumLbl->setText(album); } void TrackListDlg::setYearLbl(const QString& year) { m_ui->yearLbl->setText(year); } void TrackListDlg::addItemTrackTable(int row,int column,const QString& item) { m_ui->trackTable->setItem(row,column, new QTableWidgetItem(item)); } int TrackListDlg::numberColumnTrackTable() const { return m_ui->trackTable->columnCount(); } void TrackListDlg::setRowCount(int nRows) { m_ui->trackTable->setRowCount(nRows); } void TrackListDlg::removeRowsTrackTable() { m_ui->trackTable->setRowCount(0); } void TrackListDlg::valueDoubleCliked(QTableWidgetItem* item) { emit(itemClicked(item->row()+ 1)); } void TrackListDlg::moveTrackDialog(int x, int y) { move(x,y); } diff --git a/gui/tracklistdlg.h b/gui/tracklistdlg.h index a37523e..035b3a9 100644 --- a/gui/tracklistdlg.h +++ b/gui/tracklistdlg.h @@ -1,114 +1,112 @@ /* * Kscd - A simple cd player for the KDE Project * * Copyright (c) 1997 Bernd Johannes wuebben@math.cornell.edu * Copyright (c) 2002-2003 Aaron J. Seigo * Copyright (c) 2004 Alexander Kern * Copyright (c) 2003-2006 Richard Lärkäng * * -------------- * ISI KsCD Team : * -------------- * Stanislas KRZYWDA * Sovanramy Var * Bouchikhi Mohamed-Amine * Gastellu Sylvain * ----------------------------------------------------------------------------- * * 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, or (at your option) * any later version. * * 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. * */ #ifndef TRACKLISTDLG_H #define TRACKLISTDLG_H #include "ui_trackListDlgUI.h" #include -#include - class trackListDlgUI : public QWidget, public Ui::trackListDlgUI { public: trackListDlgUI( QWidget *parent ) : QWidget( parent ) { setupUi( this ); } }; class TrackListDlg : public KDialog { Q_OBJECT public: /** Create an instance of TrackListDlg */ TrackListDlg(QWidget* parent = 0); /** Destroy an instance of TrackListDlg */ ~TrackListDlg(); /** Modify the text of the album label * @return void **/ void setAlbumLbl(const QString&); /** Modify the text of the year label * @return void **/ void setYearLbl(const QString&); /** Add a row to the track table * @return void **/ void addItemTrackTable(int,int,const QString&); /** Return the number of column of the track table * @return int **/ int numberColumnTrackTable() const; /** Set the number of rows * @return void **/ void setRowCount(int nRows); /** Remove all rows to the track table * @return void **/ void removeRowsTrackTable(); /** Move the track dialog * @return void **/ void moveTrackDialog(int, int); private: void closeEvent( QCloseEvent * event ); public slots: /** Mouse double click event on a row of the track table * @return void **/ void valueDoubleCliked(QTableWidgetItem*); signals: /** Send the postion of the clicked item**/ void itemClicked(int); void trackListClosed(); private: trackListDlgUI *m_ui; }; #endif // TRACKLISTDLG_H diff --git a/gui/volumebutton.h b/gui/volumebutton.h index fa8fc91..634256b 100644 --- a/gui/volumebutton.h +++ b/gui/volumebutton.h @@ -1,81 +1,82 @@ /* * Kscd - A simple cd player for the KDE Project * * Copyright (c) 1997 Bernd Johannes wuebben@math.cornell.edu * Copyright (c) 2002-2003 Aaron J. Seigo * Copyright (c) 2004 Alexander Kern * Copyright (c) 2003-2006 Richard Lärkäng * * -------------- * ISI KsCD Team : * -------------- * Stanislas KRZYWDA * Sovanramy Var * Bouchikhi Mohamed-Amine * Gastellu Sylvain * ----------------------------------------------------------------------------- * * 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, or (at your option) * any later version. * * 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. * */ #ifndef VOLUMEBUTTON_H #define VOLUMEBUTTON_H -#include -#include -#include #include -#include -#include "kscdwidget.h" +#include +#include +#include #include -#include + +#include "kscdwidget.h" + +#include #define wheelStep 2.5 class VolumeButton:public KscdWidget { Q_OBJECT private: qreal m_vValue; qreal m_angle; int m_posX; int m_posY; int m_centerX; int m_centerY; int m_deplacement; bool m_move; private: qreal angleToValue(qreal); qreal valueToAngle(qreal); public: VolumeButton(QWidget * parent=0, qreal value=50.0); virtual ~VolumeButton(); void changeSkin(const QString& newPathSkin); void mousePressEvent(QMouseEvent * event); void mouseReleaseEvent(QMouseEvent * event); void mouseMoveEvent(QMouseEvent * event); void wheelEvent(QWheelEvent * event); void paintEvent(QPaintEvent* event); void enterEvent (QEvent * event); void leaveEvent (QEvent * event); void rotation(qreal); void volumeShortcut(qreal); signals: void volumeChange(qreal); }; #endif /*VOLUMEBUTTON_H_*/ diff --git a/kscd.cpp b/kscd.cpp index a22015b..258a1b3 100644 --- a/kscd.cpp +++ b/kscd.cpp @@ -1,880 +1,884 @@ /* vim: noexpandtab * Kscd - A simple cd player for the KDE Project * * Copyright (c) 1997 Bernd Johannes wuebben@math.cornell.edu * Copyright (c) 2002-2003 Aaron J. Seigo * Copyright (c) 2004 Alexander Kern * Copyright (c) 2003-2006 Richard Lärkäng * Copyright (c) 2008 Amine Bouchikhi * Copyright (c) 2008 Laurent Montel * * 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, or (at your option) * any later version. * * 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 "kscd.h" #include "dbus/PlayerDBusHandler.h" #include "dbus/RootDBusHandler.h" #include "dbus/TracklistDBusHandler.h" + #include + #include -#include -#include -#include -#include -#include #include #include +#include +#include +#include +#include +#include +#include + #include "cdplayeradaptor.h" using namespace Phonon; bool stoppedByUser = true; KSCD::KSCD( QWidget *parent ) : KscdWindow(parent) { /** Hourglass */ setHourglass(); new CDPlayerAdaptor( this ); QDBusConnection::sessionBus().registerObject(QLatin1String( "/CDPlayer" ), this); devices = new HWControler(); new KsCD::PlayerDBusHandler(this); new KsCD::RootDBusHandler(this); new KsCD::TracklistDBusHandler(this); sslider = new Phonon::SeekSlider(devices->getMedia(),this); // sslider->setMediaObject(devices->getMedia()); sslider->move(m_bar->x(),m_bar->y()); sslider->setMaximumWidth(m_bar->width()); sslider->setMinimumWidth(m_bar->width()); sslider->show(); loadSettings(); /** Music Brainz initialisation */ m_MBManager = new MBManager(); if (devices->getMedia()) { m_MBManager->discLookup(devices->getMedia()->currentSource().deviceName()); } setupActions(); setupContextMenu(); } KSCD::~KSCD() { delete devices; delete m_MBManager; } void KSCD::setupActions() { m_actions = new KActionCollection(this); m_actions->setConfigGroup(QLatin1String( "Configuration" )); m_configureShortcutsAction = m_actions->addAction(i18n("Configure Shortcuts...")); m_configureShortcutsAction->setText(i18n("Configure Shortcuts...")); addAction(m_configureShortcutsAction); //m_configureShortcutsAction->setShortcut(Qt::Key_C); connect(m_configureShortcutsAction, SIGNAL(triggered()), this, SLOT(configureShortcuts())); m_configureAction = m_actions->addAction(i18n("Configure...")); m_configureAction->setText(i18n("Configure...")); addAction(m_configureAction); connect(m_configureAction, SIGNAL(triggered()), this, SLOT(optionsPreferences())); //download info m_downloadAction = m_actions->addAction(i18n("Download Info")); m_downloadAction->setText(i18n("Download Info")); addAction(m_downloadAction); connect(m_downloadAction, SIGNAL(triggered()), this, SLOT(discLookup())); //upload info m_uploadAction = m_actions->addAction( QLatin1String( "Upload Info" )); m_uploadAction->setText(i18n("Upload Info")); addAction(m_uploadAction); connect(m_uploadAction, SIGNAL(triggered()), this, SLOT(discUpload())); //play/pause m_playPauseAction = m_actions->addAction( QLatin1String( "Play/Pause" )); m_playPauseAction->setText(i18n("Play/Pause")); m_playPauseAction->setShortcut(Qt::Key_Space); connect(m_playPauseAction, SIGNAL(triggered()), this, SLOT(playShortcut())); addAction(m_playPauseAction); //stop m_stopAction = m_actions->addAction( QLatin1String( "Stop" )); m_stopAction->setText(i18n("Stop")); addAction(m_stopAction); m_stopAction->setShortcut(Qt::CTRL + Qt::ALT + Qt::Key_V); connect(m_stopAction, SIGNAL(triggered()), devices, SLOT(stop())); //next m_nextAction = m_actions->addAction( QLatin1String( "next" )); m_nextAction->setText(i18nc( "This action allow user to pass to the following track","Next" )); addAction(m_nextAction); m_nextAction->setShortcut(Qt::Key_Right); connect(m_nextAction, SIGNAL(triggered()), devices, SLOT(nextTrack())); //previous m_previousAction = m_actions->addAction( QLatin1String( "previous" )); m_previousAction->setText(i18nc( "This action allow the user to pass to the preceding track", "Previous" ) ); addAction(m_previousAction); m_previousAction->setShortcut(Qt::Key_Left); connect(m_previousAction, SIGNAL(triggered()), devices, SLOT(prevTrack())); //eject m_ejectAction = m_actions->addAction( QLatin1String( "eject" )); m_ejectAction->setText(i18nc( " This action allow to eject the inserted disc", "Eject")); addAction(m_ejectAction); m_ejectAction->setShortcut(Qt::CTRL + Qt::ALT + Qt::Key_E); connect(m_ejectAction, SIGNAL(triggered()), this, SLOT(ejectShortcut())); //volume up m_volumeUpAction = m_actions->addAction( QLatin1String( "volume_up" )); m_volumeUpAction->setText(i18n("Volume Up")); addAction(m_volumeUpAction); m_volumeUpAction->setShortcut(Qt::Key_Up); connect(m_volumeUpAction, SIGNAL(triggered()), this, SLOT(volumeUpShortcut())); //volume down m_volumeDownAction = m_actions->addAction( QLatin1String( "volume_down" )); m_volumeDownAction->setText(i18n("Volume Down")); addAction(m_volumeDownAction); m_volumeDownAction->setShortcut(Qt::Key_Down); connect(m_volumeDownAction, SIGNAL(triggered()), this, SLOT(volumeDownShortcut())); //random m_randomAction = m_actions->addAction( QLatin1String( "random" )); m_randomAction->setText(i18nc("This action allow the user to listen a random track list","Random")); addAction(m_randomAction); m_randomAction->setShortcut(Qt::CTRL + Qt:: Key_H); connect(m_randomAction, SIGNAL(triggered()), this, SLOT(randomShortcut())); //looptrack m_looptrackAction = m_actions->addAction( QLatin1String( "looptrack" )); m_looptrackAction->setText(i18n("Repeat Track")); addAction(m_looptrackAction); m_looptrackAction->setShortcut(Qt::CTRL + Qt::Key_T); connect(m_looptrackAction, SIGNAL(triggered()), this, SLOT(looptrackShortcut())); //loopdisc m_loopdiscAction = m_actions->addAction( QLatin1String( "loopdisc" )); m_loopdiscAction->setText(i18n("Repeat Album")); addAction(m_loopdiscAction); m_loopdiscAction->setShortcut(Qt::CTRL + Qt::Key_D); connect(m_loopdiscAction, SIGNAL(triggered()), this, SLOT(loopdiscShortcut())); //tracklist m_tracklistAction = m_actions->addAction( QLatin1String( "tracklist" )); m_tracklistAction->setText(i18n("Show Tracklist")); addAction(m_tracklistAction); connect(m_tracklistAction, SIGNAL(triggered()), this, SLOT(tracklistShortcut())); //mute m_muteAction = m_actions->addAction( QLatin1String( "mute" )); m_muteAction->setText(i18n("Mute/Unmute")); addAction(m_muteAction); connect(m_muteAction, SIGNAL(triggered()), this, SLOT(muteShortcut())); //minimize m_minimizeAction = m_actions->addAction( QLatin1String( "Minimize" )); m_minimizeAction->setText(i18n("Minimize")); addAction(m_minimizeAction); connect(m_minimizeAction, SIGNAL(triggered()), this, SLOT(minimizeShortcut())); //quit m_quitAction = KStandardAction::quit(this,SLOT(quitShortcut()),this); setContextMenuPolicy(Qt::CustomContextMenu); //Read saved settings m_actions->readSettings(); mute = false; play = false; random = false; looptrack = false; loopdisc = false; /** * General */ // Connects UI with actions triggering connect(this,SIGNAL(actionClicked(QString)), this, SLOT(actionButton(QString))); connect(this,SIGNAL(picture(QString,QString)), this, SLOT(changePicture(QString,QString))); // General connects connect(this,SIGNAL(trackClicked(int)), this, SLOT(playTrack(int))); connect(this,SIGNAL(actionVolume(qreal)), this, SLOT(changeVolume(qreal))); connect(devices,SIGNAL(currentTime(qint64)),this,SLOT(catchtime(qint64))); connect(this,SIGNAL(infoPanel(QString)),this,SLOT(panelInfo(QString))); // MB connect(m_MBManager, SIGNAL(showArtistLabel(QString&)), this, SLOT(showArtistLabel(QString&))); connect(m_MBManager, SIGNAL(discLookupFinished()), this, SLOT(discLookupFinished())); connect(devices,SIGNAL(trackChanged()),this,SLOT(restoreTrackinfoLabel())); connect(devices,SIGNAL(cdLoaded(QString)),m_MBManager,SLOT(discLookup(QString))); connect( this , SIGNAL(customContextMenuRequested(QPoint)) , SLOT(showContextMenu(QPoint)) ); } void KSCD::discLookup() { m_MBManager->discLookup(devices->getMedia()->currentSource().deviceName()); } void KSCD::discUpload() { m_MBManager->discUpload(devices->getMedia()->currentSource().deviceName()); } void KSCD::discLookupFinished() { // If the track dialog is open, refresh it if(m_stateTrackDialog) { createTrackDialog(m_MBManager->getTrackList(), m_MBManager->getDiscInfo().Title); } } void KSCD::setupContextMenu() { contextMenu = new QMenu( this ); contextMenu->addAction(m_configureShortcutsAction); contextMenu->addAction(m_configureAction); contextMenu->addSeparator(); contextMenu->addAction(m_minimizeAction); contextMenu->addAction(m_quitAction); } void KSCD::showContextMenu( const QPoint &p) { contextMenu->popup( mapToGlobal ( p ) ); } /** * CDDB Management */ void KSCD::restoreArtistLabel() { if( devices->getCD()->isCdInserted() && devices->isDiscValid() ) { QString artist, title; artist = m_MBManager->getDiscInfo().Artist; title = m_MBManager->getDiscInfo().Title; showArtistLabel(artist); showArtistAlbum(title); } else { QString empty; showArtistLabel(empty); } } void KSCD::restoreTrackinfoLabel() { QString title, length ; // If disc is inserted int currentTrack = devices->getCurrentTrack(); if (devices->getCD()->isCdInserted() && currentTrack > 0 ) { title = QString::fromLatin1("%1 - ").arg(currentTrack, 2, 10, QLatin1Char('0')) ; if (m_MBManager->getTrackList().size() >= (currentTrack)) { title.append(m_MBManager->getTrackList()[currentTrack-1].Title); length.append(m_MBManager->getTrackList()[currentTrack-1].Duration); } showTrackinfoLabel(title); m_popup = new TitlePopUp(this, QLatin1String( "popup" )); } else { showTrackinfoLabel(title); } } void KSCD::changeVolume(qreal value) { - //kDebug()<<"changeVolume enter "<setVolume(value); } void KSCD::configureShortcuts() { KShortcutsDialog::configure(m_actions, KShortcutsEditor::LetterShortcutsAllowed, this, true); } void KSCD::ejectShortcut() { QString result = QLatin1String( "eject" ); actionButton(result); } void KSCD::quitShortcut() { QString result = QLatin1String( "close" ); actionButton(result); } void KSCD::minimizeShortcut() { QString result = QLatin1String( "minimize" ); actionButton(result); } void KSCD::tracklistShortcut() { QString result = QLatin1String( "tracklist" ); actionButton(result); } void KSCD::muteShortcut() { QString def = QLatin1String( "default" ); if (!mute) { QString result = QLatin1String( "unmute" ); actionButton(result); emit(picture(result,def)); //mute = !mute; } else { QString result = QLatin1String( "mute" ); actionButton(result); emit(picture(result,def)); //mute = !mute; } } void KSCD::playShortcut() { QString def = QLatin1String( "default" ); if (!play) { QString result = QLatin1String( "play" ); actionButton(result); emit(picture(result,def)); //play = !play; } else { QString result = QLatin1String( "pause" ); actionButton(result); emit(picture(result,def)); //play = !play; } } void KSCD::randomShortcut() { QString def = QLatin1String( "default" ); if (!random) { QString result = QLatin1String( "p_random" ); actionButton(result); emit(picture(result,def)); emit(infoPanel(result)); //random = !random; } else { QString result = QLatin1String( "random" ); actionButton(result); emit(picture(result,def)); emit(infoPanel(result)); //random = !random; } } void KSCD::looptrackShortcut() { QString def = QLatin1String( "default" ); if (!looptrack) { QString result = QLatin1String( "looptrack" ); actionButton(result); emit(picture(result,def)); emit(infoPanel(result)); //looptrack = !looptrack; } else { QString result = QLatin1String( "loop" ); actionButton(result); emit(picture(result,def)); emit(infoPanel(result)); //looptrack = !looptrack; } } void KSCD::loopdiscShortcut() { QString def = QLatin1String( "default" ); if (!loopdisc) { QString result = QLatin1String( "loopdisc" ); actionButton(result); emit(picture(result,def)); emit(infoPanel(result)); //loopdisc = !loopdisc; } else { QString result = QLatin1String( "loop" ); actionButton(result); emit(picture(result,def)); emit(infoPanel(result)); //loopdisc = !loopdisc; } } void KSCD::volumeUpShortcut() { if (devices->getVolume()<=0.95) { m_volumeB->volumeShortcut(5.0); } } void KSCD::volumeDownShortcut() { if (devices->getVolume()>=0.05) { m_volumeB->volumeShortcut(-5.0); } } void KSCD::playTrack(int track) { QString result = QLatin1String( "play" ); QString def = QLatin1String( "default" ); - kDebug()<<"playtrack enter "<play(track); emit(picture(result,def)); restoreArtistLabel(); } /** * Link IHM with actions */ void KSCD::actionButton(const QString & name) { QString state = QLatin1String( "over" ); QString result; if (name == QLatin1String( "play" )) { if (!devices->getCD()) return; if( !devices->isDiscValid() || !devices->getCD()->isCdInserted()) { QString result; if(!devices->getCD()->isCdInserted()){ result = i18n("No disc"); showArtistLabel(result); } else{ result = i18n("Invalid disc"); showArtistLabel(result); } QTimer::singleShot(2000, this, SLOT(restoreArtistLabel())); } else { if((devices->getState() == StoppedState) || (devices->getState()) == PausedState) { - kDebug()<<"time total"<getTotalTime(); + qDebug()<<"time total"<getTotalTime(); devices->play(); // m_slider->stop(); // m_slider->setTotalTime(devices->getTotalTime()); // m_slider->setStep(devices->getTotalTime()); restoreTrackinfoLabel(); restoreArtistLabel(); } } emit(picture(name,state)); play = !play; } else if (name == QLatin1String( "pause" )) { /*if( !devices->isDiscValid() || !devices->getCD()->isCdInserted()) { if(!devices->getCD()->isCdInserted()) showArtistLabel(i18n("No disc")); else showArtistLabel(i18n("Invalid disc")); QTimer::singleShot(2000, this, SLOT(restoreArtistLabel())); } else{*/ if(devices->getState() == PlayingState) { devices->pause(); } /*}*/ emit(picture(name,state)); play = !play; } else if (name == QLatin1String( "next" )) { if( !devices->isDiscValid() || !devices->getCD()->isCdInserted()) { QString result; if(!devices->getCD()->isCdInserted()){ result = i18n("No disc"); showArtistLabel(result); } else{ result = i18n("Invalid disc"); showArtistLabel(result); } QTimer::singleShot(2000, this, SLOT(restoreArtistLabel())); } else { devices->nextTrack(); restoreTrackinfoLabel(); if((devices->getState() == StoppedState) || (devices->getState() == PausedState)) { devices->stop(false); // m_slider->stop(); } if ((devices->getState() == PlayingState)) { // m_slider->stop(); // m_slider->start(devices->getTotalTime()); devices->play(); } } emit(picture(name,state)); } else if(name == QLatin1String( "previous" )) { if( !devices->isDiscValid() || !devices->getCD()->isCdInserted()) { QString result; if(!devices->getCD()->isCdInserted()){ result = i18n("No disc"); showArtistLabel(result); } else{ result = i18n("Invalid disc"); showArtistLabel(result); } QTimer::singleShot(2000, this, SLOT(restoreArtistLabel())); } else { devices->prevTrack(); restoreTrackinfoLabel(); if((devices->getState() == StoppedState) || (devices->getState() == PausedState)) { devices->stop(false); // m_slider->stop(); } if ((devices->getState() == PlayingState)) { // m_slider->stop(); devices->play(); // m_slider->start(devices->getTotalTime()); } } emit(picture(name,state)); } else if(name == QLatin1String( "stop" )) { if ((devices->getState() == PlayingState)|| (devices->getState() == PausedState)) { devices->stop(); // m_slider->stop(); } emit(picture(name,state)); } else if (name == QLatin1String( "eject" )) { m_trackDlg->removeRowsTrackTable(); devices->eject(); emit(picture(name,state)); if ((devices->getState() == PlayingState)|| (devices->getState() == PausedState)) { devices->stop(); // m_slider->stop(); } } else if (name == QLatin1String( "mute" )) { devices->mute(false); emit(picture(name,state)); mute = !mute; } else if (name == QLatin1String( "unmute" )) { devices->mute(true); emit(picture(name,state)); mute = !mute; } else if (name == QLatin1String( "random" )) { devices->setRandom(false); emit(picture(name,state)); result = QLatin1String( "random" ); emit(infoPanel(result)); random = !random; } else if (name == QLatin1String( "p_random" )) { devices->setRandom(true); emit(picture(name,state)); result = QLatin1String( "p_random" ); emit(infoPanel(result)); random = !random; } else if (name == QLatin1String( "loop" )) { devices->setLoopMode(NoLoop); emit(picture(name,state)); result = QLatin1String( "loop" ); emit(infoPanel(result)); looptrack = false; loopdisc = false; } else if (name == QLatin1String( "looptrack" )) { devices->setLoopMode(LoopOne); emit(picture(name,state)); result = QLatin1String( "looptrack" ); emit(infoPanel(result)); looptrack = true; loopdisc = false; } else if (name == QLatin1String( "loopdisc" )) { devices->setLoopMode(LoopAll); emit(picture(name,state)); emit(infoPanel(name)); loopdisc = true; looptrack = false; } else if (name == QLatin1String( "minimize" )) { showMinimized (); emit(picture(name,state)); } else if (name == QLatin1String( "close" )) { close(); emit(picture(name,state)); } else if (name == QLatin1String( "tracklist" )) { if(m_stateTrackDialog == true) { - kDebug()<<"close track window"; + qDebug()<<"close track window"; closeTrackDialog(); } else { //createTrackDialog(m_cddbManager->getTrackList(),m_cddbManager->getDiscTitle()); QList list = m_MBManager->getTrackList(); QString title(m_MBManager->getDiscInfo().Title); createTrackDialog(list,title); - kDebug()<<"open track window"; + qDebug()<<"open track window"; } QString def = QLatin1String( "default" ); emit(picture(name,def)); } else if (name == QLatin1String( "configure" )) { optionsPreferences(); } } /** * Hourglass */ void KSCD::setHourglass() { this->setCursor(Qt::WaitCursor); QTimer::singleShot(8000, this, SLOT(unsetHourglass())); } void KSCD::unsetHourglass() { this->unsetCursor(); } /** * Configuration */ void KSCD::writeSettings() { // Prefs::self()->writeConfig(); } void KSCD::configureKeys() { KShortcutsDialog::configure(m_actions, KShortcutsEditor::LetterShortcutsAllowed, this, true); } /** * Accessors */ HWControler* KSCD::getDevices() const { return devices; } /** * Save state on session termination */ bool KSCD::saveState(QSessionManager& /*sm*/) { writeSettings(); KConfigGroup config(KApplication::kApplication()->sessionConfig(), i18nc("General option in the configuration dialog","General")); //config.writeEntry(i18n("Show"), isVisible()); return true; } void KSCD::optionsPreferences() { if ( KConfigDialog::showDialog( i18n("Settings") ) ) { return; } //KConfigDialog didn't find an instance of this dialog, so lets create it : KConfigDialog* dialog = new KConfigDialog( this, i18n("Settings"), Prefs::self() ); // Add the General Settings page QWidget *generalSettingsDlg = new QWidget; ui_general.setupUi(generalSettingsDlg); dialog->addPage(generalSettingsDlg, i18nc("General option in the configuration dialog","General"), QLatin1String( "kscd" )); QWidget *interfaceSettingsDlg = new QWidget; ui_interface.setupUi(interfaceSettingsDlg); //Filter on the skin url combo box - QString pathSkins=KStandardDirs::installPath("data") + QLatin1String( "/kscd/skin/" ); + QString pathSkins=QStandardPaths::standardLocations(QStandardPaths::DataLocation).last() + QLatin1String( "/kscd/skin/" ); QDir directory(pathSkins); QStringList filter; filter << QLatin1String( "*.svg" ); directory.setNameFilters(filter); QStringList list = directory.entryList(); ui_interface.kcfg_url->addItems(list); dialog->addPage(interfaceSettingsDlg, i18n("Appearance"), QLatin1String( "fill-color" )); connect(dialog, SIGNAL(settingsChanged(QString)), this, SLOT(updateSettings())); dialog->setAttribute( Qt::WA_DeleteOnClose ); //dialog->setHelp(QString(),QLatin1String( "kscd" )); dialog->show(); } void KSCD::updateSettings() { m_panel->setTextColor(Prefs::textColor()); - //kDebug()<<"color config:"<setTextSizeFont(Prefs::textFont()); - //kDebug()<<"font config:"<setEjectActivated(Prefs::ejectOnFinish()); - //kDebug()<<"eject setting:"<setEjectAct( Prefs::ejectOnFinish() ); QString skin; if(Prefs::url().startsWith(QLatin1Char( '/' ))) skin = Prefs::url(); else - skin = KStandardDirs::installPath("data") + QLatin1String( "kscd/skin/" ) + Prefs::url(); + skin = QStandardPaths::standardLocations(QStandardPaths::DataLocation).last() + QLatin1String( "kscd/skin/" ) + Prefs::url(); setNewSkin( skin ); } void KSCD::loadSettings() { - //setNewSkin( KStandardDirs::installPath("data") + "kscd/skin/" + Prefs::url() ); + //setNewSkin( QStandardPaths::standardLocations(QStandardPaths::DataLocation).last() + "kscd/skin/" + Prefs::url() ); m_panel->setTextColor(Prefs::textColor()); m_panel->setTextSizeFont(Prefs::textFont()); m_panel->setEjectAct(Prefs::ejectOnFinish()); devices->setEjectActivated(Prefs::ejectOnFinish()); } void KSCD::catchtime(qint64 pos){ setTime(pos); } /** * main() */ int main( int argc, char *argv[] ) { QApplication a(argc, argv); KLocalizedString::setApplicationDomain("kscd"); KAboutData aboutData("kscd", i18n("KsCD"), "2.0", i18n("KDE CD player"), KAboutLicense::GPL, i18n("(c) 2001, Dirk Försterling\n(c) 2003, Aaron J. Seigo"), QString(), i18n("http://www.kde.org")); aboutData.addCredit(i18n("Amine Bouchikhi"), i18n("Current maintainer, Solid/Phonon Upgrade, QDBus connection"),"bouchikhi.amine@gmail.com"); aboutData.addAuthor(i18n("Aaron J. Seigo"), i18n("Previous maintainer"), "aseigo@kde.org"); aboutData.addAuthor(i18n("Alexander Kern"),i18n("Workman library update, CDTEXT, CDDA"), "kernalex@kde.org"); aboutData.addAuthor(i18n("Bernd Johannes Wuebben"), QString(), "wuebben@kde.org"); aboutData.addAuthor(i18n("Dirk Försterling"), i18n("Workman library, previous maintainer"), "milliByte@gmx.net"); aboutData.addCredit(i18n("Wilfried Huss"), i18n("Patches galore")); aboutData.addCredit(i18n("Steven Grimm"), i18n("Workman library")); aboutData.addCredit(i18n("Sven Lueppken"), i18n("UI Work")); aboutData.addCredit(i18n("freedb.org"), i18n("Special thanks to freedb.org for providing a free CDDB-like CD database"), 0, "http://freedb.org"); QCommandLineParser* parser = new QCommandLineParser; parser->addHelpOption(); parser->addVersionOption(); parser->addOption(QCommandLineOption("s", QString())); parser->addOption(QCommandLineOption("start", i18n("Start playing"))); aboutData.setupCommandLine(parser); KDBusService service(KDBusService::Unique); KSCD *k = new KSCD(); k->setWindowTitle("KSCD"); k->show(); return a.exec(); } diff --git a/kscd.h b/kscd.h index 2215573..0bf1741 100644 --- a/kscd.h +++ b/kscd.h @@ -1,181 +1,180 @@ /* Kscd - A simple cd player for the KDE Project $Id: kscd.h 818722 2008-06-09 12:01:16Z krzywda $ Copyright (c) 1997 Bernd Johannes Wuebben Copyright (c) 2002 Aaron J. Seigo Copyright (c) 2004 Alexander Kern Copyright (c) 2008 Amine Bouchikhi 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, or (at your option) any later version. 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. */ #ifndef KSCD_H #define KSCD_H // Solid implementation #include #include #include #include #include #include #include #include #include // Phonon libs #include #include #include "gui/kscdwindow.h" #include "hwcontroler.h" #include "mbmanager.h" #include #include #include #include #include -#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "panel.h" #include "prefs.h" #include "ui_generalSettings.h" #include "ui_interfaceSettings.h" #include class KSCD : public KscdWindow, public KSessionManager { Q_OBJECT public: explicit KSCD(QWidget *parent = 0); ~KSCD(); virtual bool saveState(QSessionManager& sm); void writeSettings(); HWControler * getDevices() const; protected: void setupActions(); void setupContextMenu(); signals: void picture(const QString&,const QString&); void infoPanel(const QString&); public slots: void showContextMenu( const QPoint & ); void restoreArtistLabel(); void restoreTrackinfoLabel(); void changeVolume(qreal); void playTrack(int); void ejectShortcut(); void tracklistShortcut(); void muteShortcut(); void playShortcut(); void randomShortcut(); void looptrackShortcut(); void loopdiscShortcut(); void volumeUpShortcut(); void volumeDownShortcut(); void quitShortcut(); void minimizeShortcut(); void actionButton(const QString&); void catchtime(qint64 pos); //void setNewSkin(QString); void unsetHourglass(); void configureShortcuts(); /** * Open the config window */ void optionsPreferences(); void updateSettings(); void configureKeys(); void discLookup(); void discUpload(); void discLookupFinished(); private: HWControler* devices; MBManager* m_MBManager; bool mute; bool play; bool random; bool looptrack; bool loopdisc; QMenu *contextMenu; QAction* m_configureShortcutsAction; QAction* m_configureAction; QAction* m_playPauseAction; QAction* m_stopAction; QAction* m_nextAction; QAction* m_previousAction; QAction* m_ejectAction; QAction* m_randomAction; QAction* m_looptrackAction; QAction* m_loopdiscAction; QAction* m_tracklistAction; QAction* m_muteAction; QAction* m_downloadAction; QAction* m_uploadAction; QAction* m_CDDBWindowAction; QAction* m_volumeUpAction; QAction* m_volumeDownAction; QAction* m_quitAction; QAction* m_minimizeAction; KActionCollection * m_actions; void setHourglass(); // Settings. Ui::generalSettings ui_general; Ui::interfaceSettings ui_interface; /** * Load the last settings */ void loadSettings(); }; #endif diff --git a/kscd.kcfg b/kscd.kcfg index ad01572..c6f8daf 100644 --- a/kscd.kcfg +++ b/kscd.kcfg @@ -1,36 +1,36 @@ - KStandardDirs + QStandardPaths When this option is selected the CD will start playing automatically upon being inserted into the CD-ROM. false When this option is selected the CD will automatically eject when it is finished. false Change the color of the text in the panel #000000 Change the font of the text in the panel - KStandardDirs::installPath("data") + QLatin1String("kscd/skin/default.svg") + QStandardPaths::standardLocations(QStandardPaths::DataLocation).last() + QLatin1String("kscd/skin/default.svg") Change the skin of the application diff --git a/mbmanager.cpp b/mbmanager.cpp index 82ab921..8a085df 100644 --- a/mbmanager.cpp +++ b/mbmanager.cpp @@ -1,332 +1,333 @@ /* * Kscd - A simple cd player for the KDE Project * * Copyright (c) 1997 Bernd Johannes wuebben@math.cornell.edu * Copyright (c) 2002-2003 Aaron J. Seigo * Copyright (c) 2004 Alexander Kern * Copyright (c) 2003-2006 Richard Lärkäng * * -------------- * ISI KsCD Team : * -------------- * Stanislas KRZYWDA * Sovanramy Var * Bouchikhi Mohamed-Amine * Gastellu Sylvain * ----------------------------------------------------------------------------- * * 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, or (at your option) * any later version. * * 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 "mbmanager.h" -#include +#include +#include #include #include #include #include #include #include #include #include #include #include #include #include MBManager::MBManager():m_validInfo(true) { m_discid = discid_new(); } MBManager::~MBManager() { discid_free(m_discid); } static QString getTitle(MusicBrainz5::CRelease *release, MusicBrainz5::CMedium *medium) { QString title; if (!release) { return title; } title = QString::fromUtf8(release->Title().c_str()); if (medium && release->MediumList()->NumItems() > 1) { title = i18n("%1 (disc %2)", title, medium->Position()); } return title; } static QString getArtistFromArtistCredit(MusicBrainz5::CArtistCredit *artistCredit) { QString artist; MusicBrainz5::CNameCreditList *artistList = artistCredit->NameCreditList(); if (!artistList) { return artist; } for (int i = 0; i < artistList->NumItems(); i++) { MusicBrainz5::CNameCredit* name = artistList->Item(i); MusicBrainz5::CArtist* itemArtist = name->Artist(); if (!name->Name().empty()) { artist += QString::fromUtf8(name->Name().c_str()); } else { artist += QString::fromUtf8(itemArtist->Name().c_str()); } artist += QString::fromUtf8(name->JoinPhrase().c_str()); } return artist; } static QString getArtist(MusicBrainz5::CRelease *release) { QString artist; if (!release) { return artist; } MusicBrainz5::CArtistCredit *artistCredit = release->ArtistCredit(); return getArtistFromArtistCredit(artistCredit); } static QList unknownTracks(QString &discArtist, DiscId *m_discid) { QList tracks; MBTrackInfo track; for (int j = 1; j < discid_get_first_track_num(m_discid); j++) { track.Title = i18n("Unknown title"); track.Artist = discArtist; // Not an audio track track.Duration = 0; tracks << track; } for (int j = discid_get_first_track_num(m_discid); j <= discid_get_last_track_num(m_discid); j++) { track.Title = i18n("Unknown title"); track.Artist = discArtist; // time from mb library in sectors, 75 sectors = 1 second track.Duration = discid_get_track_length(m_discid, j) * 1000 / 75; tracks << track; } return tracks; } static QList getTracks(MusicBrainz5::CMedium *medium, QString &discArtist, DiscId *m_discid) { QList tracks; if (!medium) { return tracks; } MusicBrainz5::CTrackList *trackList = medium->TrackList(); if (!trackList) { return unknownTracks(discArtist, m_discid); } MBTrackInfo track; for (int i = 0; i < trackList->NumItems(); i++) { MusicBrainz5::CTrack *itemTrack = trackList->Item(i); MusicBrainz5::CRecording *recording = itemTrack->Recording(); if (recording && !itemTrack->ArtistCredit()) { track.Artist = getArtistFromArtistCredit(recording->ArtistCredit()); } else { track.Artist = getArtistFromArtistCredit(itemTrack->ArtistCredit()); } if(recording && itemTrack->Title().empty()) { track.Title = QString::fromUtf8(recording->Title().c_str()); } else { track.Title = QString::fromUtf8(itemTrack->Title().c_str()); } track.Duration = itemTrack->Length(); tracks << track; } return tracks; } static MusicBrainz5::CRelease *getRelease(MusicBrainz5::CQuery &query, std::string &discId, MusicBrainz5::CMetadata &metadata, MusicBrainz5::CMetadata &fullMetadata) { metadata = query.Query("discid", discId); // Check to see how many items were returned from the server if (!metadata.Disc() || !metadata.Disc()->ReleaseList()) { return 0; } MusicBrainz5::CReleaseList *results = metadata.Disc()->ReleaseList(); // TODO if multiple entries found if (results->NumItems() > 1) { - kDebug() << results->NumItems() << " entries found"; + qDebug() << results->NumItems() << " entries found"; } MusicBrainz5::CRelease *release; for (int i = 0; i < results->NumItems(); i++) { MusicBrainz5::CRelease *result = results->Item(i); MusicBrainz5::CQuery::tParamMap params; params["inc"] = "artists labels recordings release-groups url-rels " "discids artist-credits"; fullMetadata = query.Query("release", result->ID(), "", params); release = fullMetadata.Release(); if (release) { break; } } return release; } static MusicBrainz5::CMedium *getMedium(MusicBrainz5::CRelease *release, std::string &discId, MusicBrainz5::CMediumList &mediaList) { if (!release) { return 0; } // Find the specific media in the release mediaList = release->MediaMatchingDiscID(discId); MusicBrainz5::CMedium* medium = 0; for (int i = 0; i < mediaList.NumItems(); i++) { medium = mediaList.Item(i); if (medium) { break; } } return medium; } void MBManager::discLookup(const QString &device) { m_validInfo = true; MusicBrainz5::CQuery query("kscd"); int discid_ok = discid_read_sparse(m_discid, qPrintable(device), 0); if (discid_ok) { std::string discId(discid_get_id(m_discid)); try { MusicBrainz5::CMetadata metadata, fullMetadata; MusicBrainz5::CMediumList mediaList; MusicBrainz5::CRelease *release = getRelease(query, discId, metadata, fullMetadata); MusicBrainz5::CMedium *medium = getMedium(release, discId, mediaList); if (release && medium) { // Sets info m_discInfo.Title = getTitle(release, medium); m_discInfo.Artist = getArtist(release); m_trackList = getTracks(medium, m_discInfo.Artist, m_discid); } else { - kDebug() << "This CD was not found."; + qDebug() << "This CD was not found."; m_validInfo = false; } } catch (MusicBrainz5::CExceptionBase& error) { - kDebug() << "Connection Exception: '" << error.what() << "'"; - kDebug() << "LastResult: " << query.LastResult(); - kDebug() << "LastHTTPCode: " << query.LastHTTPCode(); - kDebug() << "LastErrorMessage: " << QString::fromUtf8(query.LastErrorMessage().c_str()); + qDebug() << "Connection Exception: '" << error.what() << "'"; + qDebug() << "LastResult: " << query.LastResult(); + qDebug() << "LastHTTPCode: " << query.LastHTTPCode(); + qDebug() << "LastErrorMessage: " << QString::fromUtf8(query.LastErrorMessage().c_str()); m_validInfo = false; } catch (...) { - kDebug() << "Caught Unknown Exception:"; + qDebug() << "Caught Unknown Exception:"; m_validInfo = false; } } else { m_validInfo = false; } if (!m_validInfo) { // If invalid data, fill the information with something // Sets info m_discInfo.Title = i18n("Unknown album"); m_discInfo.Artist = i18n("Unknown artist"); m_trackList.clear(); if (discid_ok) { m_trackList = unknownTracks(m_discInfo.Artist, m_discid); } } emit discLookupFinished(); } void MBManager::discUpload(const QString &device) { showArtistLabel(m_discInfo.Artist); const char *discid_device = device.isEmpty()? NULL : qPrintable(device); int ok = discid_read_sparse(m_discid, discid_device, 0); if (ok) { QString url = QString::fromUtf8(discid_get_submission_url(m_discid)); KToolInvocation::invokeBrowser(url); } else { - kDebug() << "Error: " << discid_get_error_msg(m_discid); + qDebug() << "Error: " << discid_get_error_msg(m_discid); } } diff --git a/mbmanager.h b/mbmanager.h index ea04153..e30e987 100644 --- a/mbmanager.h +++ b/mbmanager.h @@ -1,98 +1,97 @@ /* * Kscd - A simple cd player for the KDE Project * * Copyright (c) 1997 Bernd Johannes wuebben@math.cornell.edu * Copyright (c) 2002-2003 Aaron J. Seigo * Copyright (c) 2004 Alexander Kern * Copyright (c) 2003-2006 Richard Lärkäng * * -------------- * ISI KsCD Team : * -------------- * Stanislas KRZYWDA * Sovanramy Var * Bouchikhi Mohamed-Amine * Gastellu Sylvain * ----------------------------------------------------------------------------- * * 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, or (at your option) * any later version. * * 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. * */ #ifndef MBMANAGER_H #define MBMANAGER_H // KDE includes -#include -#include +#include // QT includes -#include -#include +#include +#include // musicbrainz discid #include struct DiscInfo { QString Title; QString Artist; }; struct MBTrackInfo { QString Title; QString Artist; int Duration; // in milliseconds }; class MBManager : public QObject { Q_OBJECT private: DiscInfo m_discInfo; /// Contains the album's information QList m_trackList; /// List of tracks information bool m_validInfo; /// Tells whether the lookup query succeeded DiscId *m_discid; public: MBManager(); ~MBManager(); /** * Getters/Setters */ /** Returns the disc information */ DiscInfo getDiscInfo() const { return this->m_discInfo; } QList getTrackList() const { return this->m_trackList; } bool isValidInfo() const { return this->m_validInfo; } public slots: /** Gets information about the disc inserted */ void discLookup(const QString& device); /** Uploads information */ void discUpload(const QString& device=QString()); signals: void showArtistLabel(QString&); void discLookupFinished(); }; #endif