1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-04 21:27:58 +02:00

* Moved audio, playlist, common utils & widgets into libtomahawk.

This commit is contained in:
Christian Muehlhaeuser
2011-01-17 09:12:27 +01:00
parent c0f87542b7
commit 350f470ab5
103 changed files with 458 additions and 324 deletions

View File

@@ -13,7 +13,7 @@ SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
#ADD_DEFINITIONS(-Wall -O2 -DNDEBUG) #ADD_DEFINITIONS(-Wall -O2 -DNDEBUG)
#ADD_DEFINITIONS(-fPIC) ADD_DEFINITIONS(-fPIC)
SET(AUDIO_LIBS "") SET(AUDIO_LIBS "")

View File

@@ -3,14 +3,11 @@
#define APP TomahawkApp::instance() #define APP TomahawkApp::instance()
#define RESPATH ":/data/"
#include "headlesscheck.h" #include "headlesscheck.h"
#include <QRegExp> #include <QRegExp>
#include <QFile> #include <QFile>
#include <QSettings> #include <QSettings>
#include <QNetworkAccessManager>
#include <QDir> #include <QDir>
#include "QxtHttpServerConnector" #include "QxtHttpServerConnector"
@@ -61,16 +58,12 @@ public:
static TomahawkApp* instance(); static TomahawkApp* instance();
AudioEngine* audioEngine() { return m_audioEngine; }
SipHandler* sipHandler() { return m_sipHandler; } SipHandler* sipHandler() { return m_sipHandler; }
QNetworkAccessManager* nam() { return m_nam; }
QNetworkProxy* proxy() { return m_proxy; }
Tomahawk::InfoSystem::InfoSystem* infoSystem() { return m_infoSystem; } Tomahawk::InfoSystem::InfoSystem* infoSystem() { return m_infoSystem; }
XMPPBot* xmppBot() { return m_xmppBot; } XMPPBot* xmppBot() { return m_xmppBot; }
#ifndef TOMAHAWK_HEADLESS #ifndef TOMAHAWK_HEADLESS
AudioControls* audioControls(); AudioControls* audioControls();
PlaylistManager* playlistManager();
TomahawkWindow* mainWindow() const { return m_mainwindow; } TomahawkWindow* mainWindow() const { return m_mainwindow; }
#endif #endif
@@ -107,9 +100,6 @@ private:
bool m_headless; bool m_headless;
QNetworkAccessManager* m_nam;
QNetworkProxy* m_proxy;
Tomahawk::InfoSystem::InfoSystem* m_infoSystem; Tomahawk::InfoSystem::InfoSystem* m_infoSystem;
QxtHttpServerConnector m_connector; QxtHttpServerConnector m_connector;

View File

@@ -27,13 +27,6 @@ SET( TOMAHAWK_INC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../include/" )
#ENDFOREACH( moddir ) #ENDFOREACH( moddir )
SET( tomahawkSources ${tomahawkSources} SET( tomahawkSources ${tomahawkSources}
audio/madtranscode.cpp
audio/vorbistranscode.cpp
audio/flactranscode.cpp
audio/audioengine.cpp
utils/tomahawkutils.cpp
sip/SipHandler.cpp sip/SipHandler.cpp
infosystem/infosystem.cpp infosystem/infosystem.cpp
@@ -52,36 +45,6 @@ SET( tomahawkSources ${tomahawkSources}
) )
SET( tomahawkSourcesGui ${tomahawkSourcesGui} SET( tomahawkSourcesGui ${tomahawkSourcesGui}
utils/querylabel.cpp
utils/elidedlabel.cpp
utils/imagebutton.cpp
utils/progresstreeview.cpp
utils/proxystyle.cpp
utils/widgetdragfilter.cpp
utils/animatedsplitter.cpp
playlist/collectionmodel.cpp
playlist/collectionproxymodel.cpp
playlist/collectionflatmodel.cpp
playlist/collectionview.cpp
playlist/playlistmanager.cpp
playlist/plitem.cpp
playlist/playlistmodel.cpp
playlist/playlistproxymodel.cpp
playlist/playlistview.cpp
playlist/playlistitemdelegate.cpp
playlist/queueproxymodel.cpp
playlist/queueview.cpp
playlist/trackmodel.cpp
playlist/trackproxymodel.cpp
playlist/trackview.cpp
playlist/trackheader.cpp
playlist/albumitem.cpp
playlist/albummodel.cpp
playlist/albumproxymodel.cpp
playlist/albumitemdelegate.cpp
playlist/albumview.cpp
sourcetree/sourcesmodel.cpp sourcetree/sourcesmodel.cpp
sourcetree/sourcetreeitem.cpp sourcetree/sourcetreeitem.cpp
sourcetree/sourcetreeitemwidget.cpp sourcetree/sourcetreeitemwidget.cpp
@@ -93,11 +56,6 @@ SET( tomahawkSourcesGui ${tomahawkSourcesGui}
topbar/lineedit.cpp topbar/lineedit.cpp
topbar/searchbutton.cpp topbar/searchbutton.cpp
infowidgets/sourceinfowidget.cpp
widgets/newplaylistwidget.cpp
widgets/welcomewidget.cpp
xspfloader.cpp xspfloader.cpp
transferview.cpp transferview.cpp
tomahawktrayicon.cpp tomahawktrayicon.cpp
@@ -110,12 +68,6 @@ SET( tomahawkHeaders ${tomahawkHeaders}
"${TOMAHAWK_INC_DIR}/tomahawk/tomahawkapp.h" "${TOMAHAWK_INC_DIR}/tomahawk/tomahawkapp.h"
"${TOMAHAWK_INC_DIR}/tomahawk/infosystem.h" "${TOMAHAWK_INC_DIR}/tomahawk/infosystem.h"
audio/transcodeinterface.h
audio/madtranscode.h
audio/vorbistranscode.h
audio/flactranscode.h
audio/audioengine.h
sip/SipHandler.h sip/SipHandler.h
infosystem/infoplugins/echonestplugin.h infosystem/infoplugins/echonestplugin.h
@@ -130,36 +82,6 @@ SET( tomahawkHeaders ${tomahawkHeaders}
) )
SET( tomahawkHeadersGui ${tomahawkHeadersGui} SET( tomahawkHeadersGui ${tomahawkHeadersGui}
utils/querylabel.h
utils/elidedlabel.h
utils/animatedcounterlabel.h
utils/imagebutton.h
utils/progresstreeview.h
utils/widgetdragfilter.h
utils/animatedsplitter.h
playlist/collectionmodel.h
playlist/collectionproxymodel.h
playlist/collectionflatmodel.h
playlist/collectionview.h
playlist/playlistmanager.h
playlist/plitem.h
playlist/playlistmodel.h
playlist/playlistproxymodel.h
playlist/playlistview.h
playlist/playlistitemdelegate.h
playlist/queueproxymodel.h
playlist/queueview.h
playlist/trackmodel.h
playlist/trackproxymodel.h
playlist/trackview.h
playlist/trackheader.h
playlist/albumitem.h
playlist/albummodel.h
playlist/albumproxymodel.h
playlist/albumitemdelegate.h
playlist/albumview.h
sourcetree/sourcesmodel.h sourcetree/sourcesmodel.h
sourcetree/sourcetreeitem.h sourcetree/sourcetreeitem.h
sourcetree/sourcetreeitemwidget.h sourcetree/sourcetreeitemwidget.h
@@ -172,11 +94,6 @@ SET( tomahawkHeadersGui ${tomahawkHeadersGui}
topbar/lineedit_p.h topbar/lineedit_p.h
topbar/searchbutton.h topbar/searchbutton.h
infowidgets/sourceinfowidget.h
widgets/newplaylistwidget.h
widgets/welcomewidget.h
xspfloader.h xspfloader.h
transferview.h transferview.h
tomahawktrayicon.h tomahawktrayicon.h
@@ -193,10 +110,6 @@ SET( tomahawkUI ${tomahawkUI}
audiocontrols.ui audiocontrols.ui
sourcetree/sourcetreeitemwidget.ui sourcetree/sourcetreeitemwidget.ui
topbar/topbar.ui topbar/topbar.ui
infowidgets/sourceinfowidget.ui
widgets/newplaylistwidget.ui
widgets/welcomewidget.ui
) )
INCLUDE_DIRECTORIES( INCLUDE_DIRECTORIES(
@@ -213,8 +126,8 @@ INCLUDE_DIRECTORIES(
utils utils
libtomahawk libtomahawk
../rtaudio
../alsa-playback ../alsa-playback
../rtaudio
../qxt/qxtweb-standalone/qxtweb ../qxt/qxtweb-standalone/qxtweb
/usr/include/taglib /usr/include/taglib

View File

@@ -4,12 +4,12 @@
#include <QNetworkReply> #include <QNetworkReply>
#include "tomahawk/tomahawkapp.h" #include "tomahawk/tomahawkapp.h"
#include "album.h" #include "audio/audioengine.h"
#include "playlist/playlistmanager.h"
#include "utils/imagebutton.h"
#include "utils/tomahawkutils.h" #include "utils/tomahawkutils.h"
#include "audioengine.h" #include "album.h"
#include "imagebutton.h"
#include "playlist/playlistmanager.h"
#define LASTFM_DEFAULT_COVER "http://cdn.last.fm/flatness/catalogue/noimage" #define LASTFM_DEFAULT_COVER "http://cdn.last.fm/flatness/catalogue/noimage"
@@ -83,7 +83,7 @@ AudioControls::AudioControls( QWidget* parent )
ui->volumeSlider->setFixedHeight( 20 ); ui->volumeSlider->setFixedHeight( 20 );
ui->volumeSlider->setRange( 0, 100 ); ui->volumeSlider->setRange( 0, 100 );
ui->volumeSlider->setValue( APP->audioEngine()->volume() ); ui->volumeSlider->setValue( AudioEngine::instance()->volume() );
ui->volumeSlider->setStyleSheet( "QSlider::groove::horizontal {" ui->volumeSlider->setStyleSheet( "QSlider::groove::horizontal {"
"margin: 5px; border-width: 3px;" "margin: 5px; border-width: 3px;"
"border-image: url(" RESPATH "images/volume-slider-bkg.png) 3 3 3 3 stretch stretch;" "border-image: url(" RESPATH "images/volume-slider-bkg.png) 3 3 3 3 stretch stretch;"
@@ -113,13 +113,13 @@ AudioControls::AudioControls( QWidget* parent )
connect( m_prevAction, SIGNAL( triggered() ), (QObject*)APP->audioEngine(), SLOT( previous() ) ); connect( m_prevAction, SIGNAL( triggered() ), (QObject*)APP->audioEngine(), SLOT( previous() ) );
connect( m_nextAction, SIGNAL( triggered() ), (QObject*)APP->audioEngine(), SLOT( next() ) ); */ connect( m_nextAction, SIGNAL( triggered() ), (QObject*)APP->audioEngine(), SLOT( next() ) ); */
connect( ui->volumeSlider, SIGNAL( valueChanged( int ) ), (QObject*)APP->audioEngine(), SLOT( setVolume( int ) ) ); connect( ui->volumeSlider, SIGNAL( valueChanged( int ) ), AudioEngine::instance(), SLOT( setVolume( int ) ) );
connect( ui->prevButton, SIGNAL( clicked() ), (QObject*)APP->audioEngine(), SLOT( previous() ) ); connect( ui->prevButton, SIGNAL( clicked() ), AudioEngine::instance(), SLOT( previous() ) );
connect( ui->playPauseButton, SIGNAL( clicked() ), (QObject*)APP->audioEngine(), SLOT( play() ) ); connect( ui->playPauseButton, SIGNAL( clicked() ), AudioEngine::instance(), SLOT( play() ) );
connect( ui->pauseButton, SIGNAL( clicked() ), (QObject*)APP->audioEngine(), SLOT( pause() ) ); connect( ui->pauseButton, SIGNAL( clicked() ), AudioEngine::instance(), SLOT( pause() ) );
connect( ui->nextButton, SIGNAL( clicked() ), (QObject*)APP->audioEngine(), SLOT( next() ) ); connect( ui->nextButton, SIGNAL( clicked() ), AudioEngine::instance(), SLOT( next() ) );
connect( ui->volumeLowButton, SIGNAL( clicked() ), (QObject*)APP->audioEngine(), SLOT( lowerVolume() ) ); connect( ui->volumeLowButton, SIGNAL( clicked() ), AudioEngine::instance(), SLOT( lowerVolume() ) );
connect( ui->volumeHighButton, SIGNAL( clicked() ), (QObject*)APP->audioEngine(), SLOT( raiseVolume() ) ); connect( ui->volumeHighButton, SIGNAL( clicked() ), AudioEngine::instance(), SLOT( raiseVolume() ) );
connect( ui->repeatButton, SIGNAL( clicked() ), SLOT( onRepeatClicked() ) ); connect( ui->repeatButton, SIGNAL( clicked() ), SLOT( onRepeatClicked() ) );
connect( ui->shuffleButton, SIGNAL( clicked() ), SLOT( onShuffleClicked() ) ); connect( ui->shuffleButton, SIGNAL( clicked() ), SLOT( onShuffleClicked() ) );
@@ -128,13 +128,13 @@ AudioControls::AudioControls( QWidget* parent )
connect( ui->albumLabel, SIGNAL( clicked() ), SLOT( onAlbumClicked() ) ); connect( ui->albumLabel, SIGNAL( clicked() ), SLOT( onAlbumClicked() ) );
// <From AudioEngine> // <From AudioEngine>
connect( (QObject*)APP->audioEngine(), SIGNAL( loading( Tomahawk::result_ptr ) ), SLOT( onPlaybackLoading( Tomahawk::result_ptr ) ) ); connect( AudioEngine::instance(), SIGNAL( loading( Tomahawk::result_ptr ) ), SLOT( onPlaybackLoading( Tomahawk::result_ptr ) ) );
connect( (QObject*)APP->audioEngine(), SIGNAL( started( Tomahawk::result_ptr ) ), SLOT( onPlaybackStarted( Tomahawk::result_ptr ) ) ); connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), SLOT( onPlaybackStarted( Tomahawk::result_ptr ) ) );
connect( (QObject*)APP->audioEngine(), SIGNAL( paused() ), SLOT( onPlaybackPaused() ) ); connect( AudioEngine::instance(), SIGNAL( paused() ), SLOT( onPlaybackPaused() ) );
connect( (QObject*)APP->audioEngine(), SIGNAL( resumed() ), SLOT( onPlaybackResumed() ) ); connect( AudioEngine::instance(), SIGNAL( resumed() ), SLOT( onPlaybackResumed() ) );
connect( (QObject*)APP->audioEngine(), SIGNAL( stopped() ), SLOT( onPlaybackStopped() ) ); connect( AudioEngine::instance(), SIGNAL( stopped() ), SLOT( onPlaybackStopped() ) );
connect( (QObject*)APP->audioEngine(), SIGNAL( timerSeconds( unsigned int ) ), SLOT( onPlaybackTimer( unsigned int ) ) ); connect( AudioEngine::instance(), SIGNAL( timerSeconds( unsigned int ) ), SLOT( onPlaybackTimer( unsigned int ) ) );
connect( (QObject*)APP->audioEngine(), SIGNAL( volumeChanged( int ) ), SLOT( onVolumeChanged( int ) ) ); connect( AudioEngine::instance(), SIGNAL( volumeChanged( int ) ), SLOT( onVolumeChanged( int ) ) );
m_defaultCover = QPixmap( RESPATH "images/no-album-art-placeholder.png" ) m_defaultCover = QPixmap( RESPATH "images/no-album-art-placeholder.png" )
.scaled( ui->coverImage->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation ); .scaled( ui->coverImage->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
@@ -200,7 +200,7 @@ AudioControls::onCoverArtDownloaded()
{ {
// Follow HTTP redirect // Follow HTTP redirect
QNetworkRequest req( redir ); QNetworkRequest req( redir );
QNetworkReply* reply = APP->nam()->get( req ); QNetworkReply* reply = TomahawkUtils::nam()->get( req );
connect( reply, SIGNAL( finished() ), SLOT( onCoverArtDownloaded() ) ); connect( reply, SIGNAL( finished() ), SLOT( onCoverArtDownloaded() ) );
} }
@@ -217,7 +217,7 @@ AudioControls::onPlaybackStarted( const Tomahawk::result_ptr& result )
QString imgurl = "http://ws.audioscrobbler.com/2.0/?method=album.imageredirect&artist=%1&album=%2&size=medium&api_key=7a90f6672a04b809ee309af169f34b8b"; QString imgurl = "http://ws.audioscrobbler.com/2.0/?method=album.imageredirect&artist=%1&album=%2&size=medium&api_key=7a90f6672a04b809ee309af169f34b8b";
QNetworkRequest req( imgurl.arg( result->artist()->name() ).arg( result->album()->name() ) ); QNetworkRequest req( imgurl.arg( result->artist()->name() ).arg( result->album()->name() ) );
QNetworkReply* reply = APP->nam()->get( req ); QNetworkReply* reply = TomahawkUtils::nam()->get( req );
connect( reply, SIGNAL( finished() ), SLOT( onCoverArtDownloaded() ) ); connect( reply, SIGNAL( finished() ), SLOT( onCoverArtDownloaded() ) );
} }
@@ -359,21 +359,21 @@ AudioControls::onRepeatClicked()
case PlaylistInterface::NoRepeat: case PlaylistInterface::NoRepeat:
{ {
// switch to RepeatOne // switch to RepeatOne
APP->playlistManager()->setRepeatMode( PlaylistInterface::RepeatOne ); PlaylistManager::instance()->setRepeatMode( PlaylistInterface::RepeatOne );
} }
break; break;
case PlaylistInterface::RepeatOne: case PlaylistInterface::RepeatOne:
{ {
// switch to RepeatAll // switch to RepeatAll
APP->playlistManager()->setRepeatMode( PlaylistInterface::RepeatAll ); PlaylistManager::instance()->setRepeatMode( PlaylistInterface::RepeatAll );
} }
break; break;
case PlaylistInterface::RepeatAll: case PlaylistInterface::RepeatAll:
{ {
// switch to NoRepeat // switch to NoRepeat
APP->playlistManager()->setRepeatMode( PlaylistInterface::NoRepeat ); PlaylistManager::instance()->setRepeatMode( PlaylistInterface::NoRepeat );
} }
break; break;
@@ -408,19 +408,19 @@ AudioControls::onShuffleModeChanged( bool enabled )
void void
AudioControls::onShuffleClicked() AudioControls::onShuffleClicked()
{ {
APP->playlistManager()->setShuffled( m_shuffled ^ true ); PlaylistManager::instance()->setShuffled( m_shuffled ^ true );
} }
void void
AudioControls::onTrackClicked() AudioControls::onTrackClicked()
{ {
APP->playlistManager()->showCurrentTrack(); PlaylistManager::instance()->showCurrentTrack();
} }
void void
AudioControls::onAlbumClicked() AudioControls::onAlbumClicked()
{ {
APP->playlistManager()->show( m_currentTrack->album() ); PlaylistManager::instance()->show( m_currentTrack->album() );
} }

View File

@@ -492,12 +492,12 @@
<customwidget> <customwidget>
<class>ImageButton</class> <class>ImageButton</class>
<extends>QPushButton</extends> <extends>QPushButton</extends>
<header>imagebutton.h</header> <header>utils/imagebutton.h</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>QueryLabel</class> <class>QueryLabel</class>
<extends>QLabel</extends> <extends>QLabel</extends>
<header>querylabel.h</header> <header>utils/querylabel.h</header>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>

View File

@@ -44,7 +44,7 @@ void MusixMatchPlugin::getInfo(const QString &caller, const InfoType type, const
url.addQueryItem("apikey", m_apiKey); url.addQueryItem("apikey", m_apiKey);
url.addQueryItem("q_artist", artist); url.addQueryItem("q_artist", artist);
url.addQueryItem("q_track", track); url.addQueryItem("q_track", track);
QNetworkReply* reply = TomahawkApp::instance()->nam()->get(QNetworkRequest(url)); QNetworkReply* reply = TomahawkUtils::nam()->get(QNetworkRequest(url));
reply->setProperty("customData", QVariant::fromValue<Tomahawk::InfoSystem::InfoCustomDataHash>(customData)); reply->setProperty("customData", QVariant::fromValue<Tomahawk::InfoSystem::InfoCustomDataHash>(customData));
reply->setProperty("origData", data); reply->setProperty("origData", data);
reply->setProperty("caller", caller); reply->setProperty("caller", caller);
@@ -104,7 +104,7 @@ void MusixMatchPlugin::trackSearchSlot()
QUrl url(requestString); QUrl url(requestString);
url.addQueryItem("apikey", m_apiKey); url.addQueryItem("apikey", m_apiKey);
url.addQueryItem("track_id", track_id); url.addQueryItem("track_id", track_id);
QNetworkReply* newReply = TomahawkApp::instance()->nam()->get(QNetworkRequest(url)); QNetworkReply* newReply = TomahawkUtils::nam()->get(QNetworkRequest(url));
newReply->setProperty("origData", oldReply->property("origData")); newReply->setProperty("origData", oldReply->property("origData"));
newReply->setProperty("customData", oldReply->property("customData")); newReply->setProperty("customData", oldReply->property("customData"));
newReply->setProperty("caller", oldReply->property("caller")); newReply->setProperty("caller", oldReply->property("caller"));
@@ -133,4 +133,4 @@ void MusixMatchPlugin::trackLyricsSlot()
qDebug() << "Emitting lyrics: " << lyrics; qDebug() << "Emitting lyrics: " << lyrics;
emit info(reply->property("caller").toString(), Tomahawk::InfoSystem::InfoTrackLyrics, reply->property("origData"), QVariant(lyrics), reply->property("customData").value<Tomahawk::InfoSystem::InfoCustomDataHash>()); emit info(reply->property("caller").toString(), Tomahawk::InfoSystem::InfoTrackLyrics, reply->property("origData"), QVariant(lyrics), reply->property("customData").value<Tomahawk::InfoSystem::InfoCustomDataHash>());
emit finished(reply->property("caller").toString(), Tomahawk::InfoSystem::InfoTrackLyrics); emit finished(reply->property("caller").toString(), Tomahawk::InfoSystem::InfoTrackLyrics);
} }

View File

@@ -1,5 +1,6 @@
project( tomahawklib ) project( tomahawklib )
SET( QT_USE_QTGUI TRUE )
SET( QT_USE_QTSQL TRUE ) SET( QT_USE_QTSQL TRUE )
SET( QT_USE_QTNETWORK TRUE ) SET( QT_USE_QTNETWORK TRUE )
SET( QT_USE_QTXML TRUE ) SET( QT_USE_QTXML TRUE )
@@ -25,6 +26,11 @@ set( libSources
sip/SipPlugin.cpp sip/SipPlugin.cpp
audio/madtranscode.cpp
audio/vorbistranscode.cpp
audio/flactranscode.cpp
audio/audioengine.cpp
database/database.cpp database/database.cpp
database/databasecollection.cpp database/databasecollection.cpp
database/databaseworker.cpp database/databaseworker.cpp
@@ -54,6 +60,28 @@ set( libSources
database/databasecommand_updatesearchindex.cpp database/databasecommand_updatesearchindex.cpp
database/fuzzyindex.cpp database/fuzzyindex.cpp
playlist/collectionmodel.cpp
playlist/collectionproxymodel.cpp
playlist/collectionflatmodel.cpp
playlist/collectionview.cpp
playlist/playlistmanager.cpp
playlist/plitem.cpp
playlist/playlistmodel.cpp
playlist/playlistproxymodel.cpp
playlist/playlistview.cpp
playlist/playlistitemdelegate.cpp
playlist/queueproxymodel.cpp
playlist/queueview.cpp
playlist/trackmodel.cpp
playlist/trackproxymodel.cpp
playlist/trackview.cpp
playlist/trackheader.cpp
playlist/albumitem.cpp
playlist/albummodel.cpp
playlist/albumproxymodel.cpp
playlist/albumitemdelegate.cpp
playlist/albumview.cpp
network/bufferiodevice.cpp network/bufferiodevice.cpp
network/msgprocessor.cpp network/msgprocessor.cpp
network/filetransferconnection.cpp network/filetransferconnection.cpp
@@ -63,6 +91,19 @@ set( libSources
network/servent.cpp network/servent.cpp
network/connection.cpp network/connection.cpp
network/controlconnection.cpp network/controlconnection.cpp
utils/tomahawkutils.cpp
utils/querylabel.cpp
utils/elidedlabel.cpp
utils/imagebutton.cpp
utils/progresstreeview.cpp
utils/proxystyle.cpp
utils/widgetdragfilter.cpp
utils/animatedsplitter.cpp
widgets/newplaylistwidget.cpp
widgets/welcomewidget.cpp
widgets/infowidgets/sourceinfowidget.cpp
) )
set( libHeaders set( libHeaders
@@ -83,6 +124,12 @@ set( libHeaders
sip/SipPlugin.h sip/SipPlugin.h
audio/transcodeinterface.h
audio/madtranscode.h
audio/vorbistranscode.h
audio/flactranscode.h
audio/audioengine.h
database/database.h database/database.h
database/databasecollection.h database/databasecollection.h
database/databaseworker.h database/databaseworker.h
@@ -121,6 +168,46 @@ set( libHeaders
network/connection.h network/connection.h
network/controlconnection.h network/controlconnection.h
network/portfwdthread.h network/portfwdthread.h
playlist/collectionmodel.h
playlist/collectionproxymodel.h
playlist/collectionflatmodel.h
playlist/collectionview.h
playlist/playlistmanager.h
playlist/plitem.h
playlist/playlistmodel.h
playlist/playlistproxymodel.h
playlist/playlistview.h
playlist/playlistitemdelegate.h
playlist/queueproxymodel.h
playlist/queueview.h
playlist/trackmodel.h
playlist/trackproxymodel.h
playlist/trackview.h
playlist/trackheader.h
playlist/albumitem.h
playlist/albummodel.h
playlist/albumproxymodel.h
playlist/albumitemdelegate.h
playlist/albumview.h
utils/querylabel.h
utils/elidedlabel.h
utils/animatedcounterlabel.h
utils/imagebutton.h
utils/progresstreeview.h
utils/widgetdragfilter.h
utils/animatedsplitter.h
widgets/newplaylistwidget.h
widgets/welcomewidget.h
widgets/infowidgets/sourceinfowidget.h
)
set( libUI ${libUI}
widgets/newplaylistwidget.ui
widgets/welcomewidget.ui
widgets/infowidgets/sourceinfowidget.ui
) )
include_directories( . ${CMAKE_CURRENT_BINARY_DIR} .. include_directories( . ${CMAKE_CURRENT_BINARY_DIR} ..
@@ -129,9 +216,15 @@ include_directories( . ${CMAKE_CURRENT_BINARY_DIR} ..
../../include ../../include
../network ../network
../../qxt/qxtweb-standalone/qxtweb ../../qxt/qxtweb-standalone/qxtweb
../../rtaudio
../../alsa-playback
) )
qt4_wrap_ui( libUI_H ${libUI} )
qt4_wrap_cpp( libMoc ${libHeaders} ) qt4_wrap_cpp( libMoc ${libHeaders} )
SET( libSources ${libSources} ${libUI_H} )
add_library( tomahawklib SHARED ${libSources} ${libMoc} ) add_library( tomahawklib SHARED ${libSources} ${libMoc} )
IF( WIN32 ) IF( WIN32 )
@@ -143,6 +236,24 @@ SET( OS_SPECIFIC_LINK_LIBRARIES
) )
ENDIF( WIN32 ) ENDIF( WIN32 )
IF( APPLE )
SET( OS_SPECIFIC_LINK_LIBRARIES
${OS_SPECIFIC_LINK_LIBRARIES}
${COREAUDIO_LIBRARY}
${COREFOUNDATION_LIBRARY}
rtaudio
)
ENDIF( APPLE )
IF( UNIX AND NOT APPLE )
SET( OS_SPECIFIC_LINK_LIBRARIES
${OS_SPECIFIC_LINK_LIBRARIES}
alsaplayback
)
ENDIF( UNIX AND NOT APPLE )
target_link_libraries( tomahawklib target_link_libraries( tomahawklib
${QT_LIBRARIES} ${QT_LIBRARIES}
${OS_SPECIFIC_LINK_LIBRARIES} ${OS_SPECIFIC_LINK_LIBRARIES}

View File

@@ -17,6 +17,15 @@
#include "flactranscode.h" #include "flactranscode.h"
#endif #endif
AudioEngine* AudioEngine::s_instance = 0;
AudioEngine*
AudioEngine::instance()
{
return s_instance;
}
AudioEngine::AudioEngine() AudioEngine::AudioEngine()
: QThread() : QThread()
@@ -26,6 +35,7 @@ AudioEngine::AudioEngine()
, m_timeElapsed( 0 ) , m_timeElapsed( 0 )
, m_i( 0 ) , m_i( 0 )
{ {
s_instance = this;
qDebug() << "Init AudioEngine"; qDebug() << "Init AudioEngine";
moveToThread( this ); moveToThread( this );

View File

@@ -12,17 +12,21 @@
#include "alsaplayback.h" #include "alsaplayback.h"
#include "transcodeinterface.h" #include "transcodeinterface.h"
#include "dllmacro.h"
#define AUDIO_VOLUME_STEP 5 #define AUDIO_VOLUME_STEP 5
class PlaylistInterface; class PlaylistInterface;
class AudioEngine : public QThread class DLLEXPORT AudioEngine : public QThread
{ {
Q_OBJECT Q_OBJECT
public: public:
enum AudioErrorCode { StreamReadError, AudioDeviceError, DecodeError }; enum AudioErrorCode { StreamReadError, AudioDeviceError, DecodeError };
static AudioEngine* instance();
explicit AudioEngine(); explicit AudioEngine();
~AudioEngine(); ~AudioEngine();
@@ -104,6 +108,8 @@ private:
unsigned int m_timeElapsed; unsigned int m_timeElapsed;
int m_i; int m_i;
static AudioEngine* s_instance;
}; };
#endif // AUDIOENGINE_H #endif // AUDIOENGINE_H

View File

@@ -15,10 +15,12 @@
#include <QMutex> #include <QMutex>
#include <QDebug> #include <QDebug>
#include "dllmacro.h"
#define FLAC_BUFFER 32768 * 36 #define FLAC_BUFFER 32768 * 36
#define FLAC_BUFFER_PREFERRED 32768 #define FLAC_BUFFER_PREFERRED 32768
class FLACTranscode : public TranscodeInterface , protected FLAC::Decoder::Stream class DLLEXPORT FLACTranscode : public TranscodeInterface , protected FLAC::Decoder::Stream
{ {
Q_OBJECT Q_OBJECT

View File

@@ -14,10 +14,12 @@
#include <QObject> #include <QObject>
#include <QMutex> #include <QMutex>
#include "dllmacro.h"
#define MP3_BUFFER 32768 #define MP3_BUFFER 32768
#define MP3_BUFFER_PREFERRED 32768 #define MP3_BUFFER_PREFERRED 32768
class MADTranscode : public TranscodeInterface class DLLEXPORT MADTranscode : public TranscodeInterface
{ {
Q_OBJECT Q_OBJECT

View File

@@ -6,7 +6,9 @@
#include <QObject> #include <QObject>
#include <QMutex> #include <QMutex>
class TranscodeInterface : public QObject #include "dllmacro.h"
class DLLEXPORT TranscodeInterface : public QObject
{ {
Q_OBJECT Q_OBJECT

View File

@@ -15,11 +15,13 @@
#include <QDebug> #include <QDebug>
#include <QStringList> #include <QStringList>
#include "dllmacro.h"
// Must not be smaller than 8500 bytes! // Must not be smaller than 8500 bytes!
#define OGG_BUFFER 8500 #define OGG_BUFFER 8500
#define OGG_BUFFER_PREFERRED 32768 #define OGG_BUFFER_PREFERRED 32768
class VorbisTranscode : public TranscodeInterface class DLLEXPORT VorbisTranscode : public TranscodeInterface
{ {
Q_OBJECT Q_OBJECT

View File

@@ -8,7 +8,9 @@
#include "album.h" #include "album.h"
class AlbumItem : public QObject #include "dllmacro.h"
class DLLEXPORT AlbumItem : public QObject
{ {
Q_OBJECT Q_OBJECT

View File

@@ -1,12 +1,14 @@
#include "albumitemdelegate.h" #include "albumitemdelegate.h"
#include <QApplication>
#include <QDebug> #include <QDebug>
#include <QPainter> #include <QPainter>
#include <QAbstractItemView> #include <QAbstractItemView>
#include "query.h" #include "query.h"
#include "result.h" #include "result.h"
#include "tomahawk/tomahawkapp.h"
#include "utils/tomahawkutils.h"
#include "playlist/albumitem.h" #include "playlist/albumitem.h"
#include "playlist/albumproxymodel.h" #include "playlist/albumproxymodel.h"
@@ -37,7 +39,7 @@ AlbumItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
QStyleOptionViewItemV4 opt = option; QStyleOptionViewItemV4 opt = option;
initStyleOption( &opt, QModelIndex() ); initStyleOption( &opt, QModelIndex() );
APP->style()->drawControl( QStyle::CE_ItemViewItem, &opt, painter ); qApp->style()->drawControl( QStyle::CE_ItemViewItem, &opt, painter );
if ( option.state & QStyle::State_Selected ) if ( option.state & QStyle::State_Selected )
{ {

View File

@@ -3,9 +3,11 @@
#include <QStyledItemDelegate> #include <QStyledItemDelegate>
#include "dllmacro.h"
class AlbumProxyModel; class AlbumProxyModel;
class AlbumItemDelegate : public QStyledItemDelegate class DLLEXPORT AlbumItemDelegate : public QStyledItemDelegate
{ {
Q_OBJECT Q_OBJECT

View File

@@ -5,9 +5,10 @@
#include <QMimeData> #include <QMimeData>
#include <QNetworkReply> #include <QNetworkReply>
#include "tomahawk/tomahawkapp.h"
#include "database/database.h" #include "database/database.h"
#include "utils/tomahawkutils.h"
#define LASTFM_DEFAULT_COVER "http://cdn.last.fm/flatness/catalogue/noimage" #define LASTFM_DEFAULT_COVER "http://cdn.last.fm/flatness/catalogue/noimage"
using namespace Tomahawk; using namespace Tomahawk;
@@ -270,7 +271,7 @@ AlbumModel::onAlbumsAdded( const QList<Tomahawk::album_ptr>& albums, const Tomah
QString imgurl = "http://ws.audioscrobbler.com/2.0/?method=album.imageredirect&artist=%1&album=%2&size=large&api_key=7a90f6672a04b809ee309af169f34b8b"; QString imgurl = "http://ws.audioscrobbler.com/2.0/?method=album.imageredirect&artist=%1&album=%2&size=large&api_key=7a90f6672a04b809ee309af169f34b8b";
QNetworkRequest req( imgurl.arg( album->artist()->name() ).arg( album->name() ) ); QNetworkRequest req( imgurl.arg( album->artist()->name() ).arg( album->name() ) );
req.setAttribute( QNetworkRequest::User, (qlonglong)albumitem ); req.setAttribute( QNetworkRequest::User, (qlonglong)albumitem );
QNetworkReply* reply = APP->nam()->get( req ); QNetworkReply* reply = TomahawkUtils::nam()->get( req );
connect( reply, SIGNAL( finished() ), SLOT( onCoverArtDownloaded() ) ); connect( reply, SIGNAL( finished() ), SLOT( onCoverArtDownloaded() ) );
connect( albumitem, SIGNAL( dataChanged() ), SLOT( onDataChanged() ) ); connect( albumitem, SIGNAL( dataChanged() ), SLOT( onDataChanged() ) );
@@ -313,7 +314,7 @@ AlbumModel::onCoverArtDownloaded()
// Follow HTTP redirect // Follow HTTP redirect
QNetworkRequest req( redir ); QNetworkRequest req( redir );
req.setAttribute( QNetworkRequest::User, reply->request().attribute( QNetworkRequest::User ) ); req.setAttribute( QNetworkRequest::User, reply->request().attribute( QNetworkRequest::User ) );
QNetworkReply* reply = APP->nam()->get( req ); QNetworkReply* reply = TomahawkUtils::nam()->get( req );
connect( reply, SIGNAL( finished() ), SLOT( onCoverArtDownloaded() ) ); connect( reply, SIGNAL( finished() ), SLOT( onCoverArtDownloaded() ) );
} }

View File

@@ -11,9 +11,11 @@
#include "albumitem.h" #include "albumitem.h"
#include "dllmacro.h"
class QMetaData; class QMetaData;
class AlbumModel : public QAbstractItemModel class DLLEXPORT AlbumModel : public QAbstractItemModel
{ {
Q_OBJECT Q_OBJECT

View File

@@ -6,7 +6,9 @@
#include "playlistinterface.h" #include "playlistinterface.h"
#include "playlist/albummodel.h" #include "playlist/albummodel.h"
class AlbumProxyModel : public QSortFilterProxyModel, public PlaylistInterface #include "dllmacro.h"
class DLLEXPORT AlbumProxyModel : public QSortFilterProxyModel, public PlaylistInterface
{ {
Q_OBJECT Q_OBJECT

View File

@@ -6,10 +6,9 @@
#include <QPainter> #include <QPainter>
#include <QScrollBar> #include <QScrollBar>
#include "tomahawk/tomahawkapp.h" #include "audio/audioengine.h"
#include "audioengine.h"
#include "tomahawksettings.h"
#include "tomahawksettings.h"
#include "albumitemdelegate.h" #include "albumitemdelegate.h"
#include "albummodel.h" #include "albummodel.h"
#include "albumproxymodel.h" #include "albumproxymodel.h"
@@ -82,7 +81,7 @@ AlbumView::onItemActivated( const QModelIndex& index )
// qDebug() << "Result activated:" << item->album()->tracks().first()->toString() << item->album()->tracks().first()->results().first()->url(); // qDebug() << "Result activated:" << item->album()->tracks().first()->toString() << item->album()->tracks().first()->results().first()->url();
// APP->audioEngine()->playItem( item->album().data(), item->album()->tracks().first()->results().first() ); // APP->audioEngine()->playItem( item->album().data(), item->album()->tracks().first()->results().first() );
APP->playlistManager()->show( item->album() ); PlaylistManager::instance()->show( item->album() );
} }
} }

View File

@@ -4,10 +4,12 @@
#include <QListView> #include <QListView>
#include <QSortFilterProxyModel> #include <QSortFilterProxyModel>
#include "dllmacro.h"
class AlbumModel; class AlbumModel;
class AlbumProxyModel; class AlbumProxyModel;
class AlbumView : public QListView class DLLEXPORT AlbumView : public QListView
{ {
Q_OBJECT Q_OBJECT

View File

@@ -15,9 +15,11 @@
#include "database/databasecommand_alltracks.h" #include "database/databasecommand_alltracks.h"
#include "dllmacro.h"
class QMetaData; class QMetaData;
class CollectionFlatModel : public TrackModel class DLLEXPORT CollectionFlatModel : public TrackModel
{ {
Q_OBJECT Q_OBJECT

View File

@@ -12,9 +12,11 @@
#include "playlist.h" #include "playlist.h"
#include "playlistinterface.h" #include "playlistinterface.h"
#include "dllmacro.h"
class QMetaData; class QMetaData;
class CollectionModel : public QAbstractItemModel class DLLEXPORT CollectionModel : public QAbstractItemModel
{ {
Q_OBJECT Q_OBJECT

View File

@@ -3,7 +3,9 @@
#include "trackproxymodel.h" #include "trackproxymodel.h"
class CollectionProxyModel : public TrackProxyModel #include "dllmacro.h"
class DLLEXPORT CollectionProxyModel : public TrackProxyModel
{ {
Q_OBJECT Q_OBJECT

View File

@@ -3,10 +3,11 @@
#include <QMenu> #include <QMenu>
#include "tomahawk/tomahawkapp.h"
#include "trackview.h" #include "trackview.h"
class CollectionView : public TrackView #include "dllmacro.h"
class DLLEXPORT CollectionView : public TrackView
{ {
Q_OBJECT Q_OBJECT

View File

@@ -6,7 +6,6 @@
#include "query.h" #include "query.h"
#include "result.h" #include "result.h"
#include "tomahawk/tomahawkapp.h"
#include "playlist/plitem.h" #include "playlist/plitem.h"
#include "playlist/trackproxymodel.h" #include "playlist/trackproxymodel.h"

View File

@@ -3,9 +3,11 @@
#include <QStyledItemDelegate> #include <QStyledItemDelegate>
#include "dllmacro.h"
class TrackProxyModel; class TrackProxyModel;
class PlaylistItemDelegate : public QStyledItemDelegate class DLLEXPORT PlaylistItemDelegate : public QStyledItemDelegate
{ {
Q_OBJECT Q_OBJECT

View File

@@ -19,10 +19,19 @@
#include "sourcelist.h" #include "sourcelist.h"
#include "tomahawksettings.h" #include "tomahawksettings.h"
#include "infowidgets/sourceinfowidget.h" #include "widgets/infowidgets/sourceinfowidget.h"
#define FILTER_TIMEOUT 280 #define FILTER_TIMEOUT 280
PlaylistManager* PlaylistManager::s_instance = 0;
PlaylistManager*
PlaylistManager::instance()
{
return s_instance;
}
PlaylistManager::PlaylistManager( QObject* parent ) PlaylistManager::PlaylistManager( QObject* parent )
: QObject( parent ) : QObject( parent )
@@ -33,6 +42,7 @@ PlaylistManager::PlaylistManager( QObject* parent )
, m_statsAvailable( false ) , m_statsAvailable( false )
, m_modesAvailable( false ) , m_modesAvailable( false )
{ {
s_instance = this;
m_stack = new QStackedWidget(); m_stack = new QStackedWidget();
m_widget->setLayout( new QVBoxLayout() ); m_widget->setLayout( new QVBoxLayout() );
@@ -46,7 +56,7 @@ PlaylistManager::PlaylistManager( QObject* parent )
m_queueView = new QueueView( m_splitter ); m_queueView = new QueueView( m_splitter );
m_queueModel = new PlaylistModel( m_queueView ); m_queueModel = new PlaylistModel( m_queueView );
m_queueView->queue()->setModel( m_queueModel ); m_queueView->queue()->setModel( m_queueModel );
APP->audioEngine()->setQueue( m_queueView->queue()->proxyModel() ); AudioEngine::instance()->setQueue( m_queueView->queue()->proxyModel() );
m_splitter->addWidget( m_queueView ); m_splitter->addWidget( m_queueView );
m_splitter->hide( 1, false ); m_splitter->hide( 1, false );
@@ -484,7 +494,7 @@ PlaylistManager::linkPlaylist()
} }
applyFilter(); applyFilter();
APP->audioEngine()->setPlaylist( m_currentInterface ); AudioEngine::instance()->setPlaylist( m_currentInterface );
if ( m_currentInterface && m_statsAvailable ) if ( m_currentInterface && m_statsAvailable )
{ {
@@ -544,7 +554,7 @@ PlaylistManager::showCurrentTrack()
{ {
unlinkPlaylist(); unlinkPlaylist();
m_currentInterface = APP->audioEngine()->currentTrackPlaylist(); m_currentInterface = AudioEngine::instance()->currentTrackPlaylist();
if ( m_currentInterface->widget() ) if ( m_currentInterface->widget() )
m_stack->setCurrentWidget( m_currentInterface->widget() ); m_stack->setCurrentWidget( m_currentInterface->widget() );

View File

@@ -8,6 +8,8 @@
#include "collection.h" #include "collection.h"
#include "playlistinterface.h" #include "playlistinterface.h"
#include "dllmacro.h"
class AnimatedSplitter; class AnimatedSplitter;
class AlbumModel; class AlbumModel;
class AlbumView; class AlbumView;
@@ -22,11 +24,13 @@ class TrackModel;
class TrackView; class TrackView;
class SourceInfoWidget; class SourceInfoWidget;
class PlaylistManager : public QObject class DLLEXPORT PlaylistManager : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
static PlaylistManager* instance();
explicit PlaylistManager( QObject* parent = 0 ); explicit PlaylistManager( QObject* parent = 0 );
~PlaylistManager(); ~PlaylistManager();
@@ -116,6 +120,8 @@ private:
QTimer m_filterTimer; QTimer m_filterTimer;
QString m_filter; QString m_filter;
static PlaylistManager* s_instance;
}; };
#endif // PLAYLISTMANAGER_H #endif // PLAYLISTMANAGER_H

View File

@@ -6,16 +6,17 @@
#include "plitem.h" #include "plitem.h"
#include "trackmodel.h" #include "trackmodel.h"
#include "tomahawk/tomahawkapp.h"
#include "collection.h" #include "collection.h"
#include "query.h" #include "query.h"
#include "typedefs.h" #include "typedefs.h"
#include "playlist.h" #include "playlist.h"
#include "playlistinterface.h" #include "playlistinterface.h"
#include "dllmacro.h"
class QMetaData; class QMetaData;
class PlaylistModel : public TrackModel class DLLEXPORT PlaylistModel : public TrackModel
{ {
Q_OBJECT Q_OBJECT

View File

@@ -3,7 +3,9 @@
#include "trackproxymodel.h" #include "trackproxymodel.h"
class PlaylistProxyModel : public TrackProxyModel #include "dllmacro.h"
class DLLEXPORT PlaylistProxyModel : public TrackProxyModel
{ {
Q_OBJECT Q_OBJECT

View File

@@ -3,10 +3,11 @@
#include <QMenu> #include <QMenu>
#include "tomahawk/tomahawkapp.h"
#include "trackview.h" #include "trackview.h"
class PlaylistView : public TrackView #include "dllmacro.h"
class DLLEXPORT PlaylistView : public TrackView
{ {
Q_OBJECT Q_OBJECT

View File

@@ -8,7 +8,9 @@
#include "query.h" #include "query.h"
#include "typedefs.h" #include "typedefs.h"
class PlItem : public QObject #include "dllmacro.h"
class DLLEXPORT PlItem : public QObject
{ {
Q_OBJECT Q_OBJECT

View File

@@ -2,7 +2,6 @@
#include <QDebug> #include <QDebug>
#include "tomahawk/tomahawkapp.h"
#include "playlist/playlistmanager.h" #include "playlist/playlistmanager.h"
using namespace Tomahawk; using namespace Tomahawk;
@@ -30,7 +29,7 @@ QueueProxyModel::siblingItem( int itemsAway )
qDebug() << "new rowcount:" << rowCount( QModelIndex() ); qDebug() << "new rowcount:" << rowCount( QModelIndex() );
if ( rowCount( QModelIndex() ) == 1 ) if ( rowCount( QModelIndex() ) == 1 )
APP->playlistManager()->hideQueue(); PlaylistManager::instance()->hideQueue();
removeIndex( currentItem() ); removeIndex( currentItem() );

View File

@@ -3,9 +3,11 @@
#include "playlistproxymodel.h" #include "playlistproxymodel.h"
#include "dllmacro.h"
class QMetaData; class QMetaData;
class QueueProxyModel : public PlaylistProxyModel class DLLEXPORT QueueProxyModel : public PlaylistProxyModel
{ {
Q_OBJECT Q_OBJECT

View File

@@ -6,7 +6,9 @@
#include "utils/animatedsplitter.h" #include "utils/animatedsplitter.h"
#include "playlistview.h" #include "playlistview.h"
class QueueView : public AnimatedWidget #include "dllmacro.h"
class DLLEXPORT QueueView : public AnimatedWidget
{ {
Q_OBJECT Q_OBJECT

View File

@@ -4,7 +4,6 @@
#include <QDebug> #include <QDebug>
#include <QMenu> #include <QMenu>
#include "tomahawk/tomahawkapp.h"
#include "tomahawksettings.h" #include "tomahawksettings.h"
#include "playlist/trackmodel.h" #include "playlist/trackmodel.h"
#include "playlist/trackview.h" #include "playlist/trackview.h"

View File

@@ -4,9 +4,11 @@
#include <QHeaderView> #include <QHeaderView>
#include <QSignalMapper> #include <QSignalMapper>
#include "dllmacro.h"
class TrackView; class TrackView;
class TrackHeader : public QHeaderView class DLLEXPORT TrackHeader : public QHeaderView
{ {
Q_OBJECT Q_OBJECT

View File

@@ -4,7 +4,9 @@
#include <QMimeData> #include <QMimeData>
#include <QTreeView> #include <QTreeView>
#include "tomahawk/tomahawkapp.h" #include "audio/audioengine.h"
#include "utils/tomahawkutils.h"
#include "album.h" #include "album.h"
using namespace Tomahawk; using namespace Tomahawk;
@@ -17,8 +19,8 @@ TrackModel::TrackModel( QObject* parent )
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
connect( (QObject*)APP->audioEngine(), SIGNAL( finished( Tomahawk::result_ptr ) ), SLOT( onPlaybackFinished( Tomahawk::result_ptr ) ), Qt::DirectConnection ); connect( AudioEngine::instance(), SIGNAL( finished( Tomahawk::result_ptr ) ), SLOT( onPlaybackFinished( Tomahawk::result_ptr ) ), Qt::DirectConnection );
connect( (QObject*)APP->audioEngine(), SIGNAL( stopped() ), SLOT( onPlaybackStopped() ), Qt::DirectConnection ); connect( AudioEngine::instance(), SIGNAL( stopped() ), SLOT( onPlaybackStopped() ), Qt::DirectConnection );
} }

View File

@@ -6,9 +6,11 @@
#include "playlistinterface.h" #include "playlistinterface.h"
#include "playlist/plitem.h" #include "playlist/plitem.h"
#include "dllmacro.h"
class QMetaData; class QMetaData;
class TrackModel : public QAbstractItemModel class DLLEXPORT TrackModel : public QAbstractItemModel
{ {
Q_OBJECT Q_OBJECT

View File

@@ -6,7 +6,9 @@
#include "playlistinterface.h" #include "playlistinterface.h"
#include "playlist/trackmodel.h" #include "playlist/trackmodel.h"
class TrackProxyModel : public QSortFilterProxyModel, public PlaylistInterface #include "dllmacro.h"
class DLLEXPORT TrackProxyModel : public QSortFilterProxyModel, public PlaylistInterface
{ {
Q_OBJECT Q_OBJECT

View File

@@ -5,11 +5,12 @@
#include <QPainter> #include <QPainter>
#include <QScrollBar> #include <QScrollBar>
#include "tomahawk/tomahawkapp.h" #include "audio/audioengine.h"
#include "playlist/trackheader.h" #include "utils/tomahawkutils.h"
#include "playlist/playlistmanager.h"
#include "playlist/queueview.h" #include "trackheader.h"
#include "audioengine.h" #include "playlistmanager.h"
#include "queueview.h"
#include "trackmodel.h" #include "trackmodel.h"
#include "trackproxymodel.h" #include "trackproxymodel.h"
@@ -94,7 +95,7 @@ TrackView::onItemActivated( const QModelIndex& index )
{ {
qDebug() << "Result activated:" << item->query()->toString() << item->query()->results().first()->url(); qDebug() << "Result activated:" << item->query()->toString() << item->query()->results().first()->url();
m_proxyModel->setCurrentItem( index ); m_proxyModel->setCurrentItem( index );
APP->audioEngine()->playItem( m_proxyModel, item->query()->results().first() ); AudioEngine::instance()->playItem( m_proxyModel, item->query()->results().first() );
} }
} }
@@ -141,8 +142,8 @@ TrackView::addItemsToQueue()
PlItem* item = model()->itemFromIndex( proxyModel()->mapToSource( idx ) ); PlItem* item = model()->itemFromIndex( proxyModel()->mapToSource( idx ) );
if ( item && item->query()->numResults() ) if ( item && item->query()->numResults() )
{ {
APP->playlistManager()->queue()->model()->append( item->query() ); PlaylistManager::instance()->queue()->model()->append( item->query() );
APP->playlistManager()->showQueue(); PlaylistManager::instance()->showQueue();
} }
} }
} }

View File

@@ -6,12 +6,14 @@
#include "playlistitemdelegate.h" #include "playlistitemdelegate.h"
#include "dllmacro.h"
class PlaylistInterface; class PlaylistInterface;
class TrackHeader; class TrackHeader;
class TrackModel; class TrackModel;
class TrackProxyModel; class TrackProxyModel;
class TrackView : public QTreeView class DLLEXPORT TrackView : public QTreeView
{ {
Q_OBJECT Q_OBJECT

View File

@@ -5,9 +5,11 @@
#include <QSplitter> #include <QSplitter>
#include <QTimeLine> #include <QTimeLine>
#include "dllmacro.h"
class AnimatedWidget; class AnimatedWidget;
class AnimatedSplitter : public QSplitter class DLLEXPORT AnimatedSplitter : public QSplitter
{ {
Q_OBJECT Q_OBJECT
@@ -44,7 +46,7 @@ private:
QTimeLine* m_timeLine; QTimeLine* m_timeLine;
}; };
class AnimatedWidget : public QWidget class DLLEXPORT AnimatedWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:

View File

@@ -4,7 +4,9 @@
#include <QFrame> #include <QFrame>
#include <QTime> #include <QTime>
class ElidedLabel : public QFrame #include "dllmacro.h"
class DLLEXPORT ElidedLabel : public QFrame
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY( QString text READ text WRITE setText NOTIFY textChanged ) Q_PROPERTY( QString text READ text WRITE setText NOTIFY textChanged )

View File

@@ -5,8 +5,9 @@
#include <QIcon> #include <QIcon>
#include <QMap> #include <QMap>
#include "dllmacro.h"
class ImageButton : public QAbstractButton class DLLEXPORT ImageButton : public QAbstractButton
{ {
Q_OBJECT Q_OBJECT

View File

@@ -4,7 +4,9 @@
#include <QTreeView> #include <QTreeView>
#include <QProgressBar> #include <QProgressBar>
class ProgressTreeView : public QTreeView #include "dllmacro.h"
class DLLEXPORT ProgressTreeView : public QTreeView
{ {
Q_OBJECT Q_OBJECT

View File

@@ -4,7 +4,9 @@
#include <QtGlobal> #include <QtGlobal>
#include <QProxyStyle> #include <QProxyStyle>
class ProxyStyle : public QProxyStyle #include "dllmacro.h"
class DLLEXPORT ProxyStyle : public QProxyStyle
{ {
public: public:
ProxyStyle() {} ProxyStyle() {}

View File

@@ -6,7 +6,9 @@
#include "result.h" #include "result.h"
class QueryLabel : public QFrame #include "dllmacro.h"
class DLLEXPORT QueryLabel : public QFrame
{ {
Q_OBJECT Q_OBJECT

View File

@@ -6,6 +6,7 @@
#include <QDir> #include <QDir>
#include <QPainter> #include <QPainter>
#include <QPixmap> #include <QPixmap>
#include <QNetworkAccessManager>
#ifdef WIN32 #ifdef WIN32
#include <windows.h> #include <windows.h>
@@ -273,4 +274,35 @@ createDragPixmap( int itemCount )
return dragPixmap; return dragPixmap;
} }
QNetworkAccessManager* s_nam = 0;
QNetworkProxy* s_proxy = 0;
QNetworkAccessManager*
nam()
{
return s_nam;
}
QNetworkProxy*
proxy()
{
return s_proxy;
}
void
setNam( QNetworkAccessManager* nam )
{
s_nam = nam;
}
void
setProxy( QNetworkProxy* proxy )
{
s_proxy = proxy;
}
} // ns } // ns

View File

@@ -0,0 +1,33 @@
#ifndef TOMAHAWKUTILS_H
#define TOMAHAWKUTILS_H
#include "dllmacro.h"
#define RESPATH ":/data/"
class QDir;
class QDateTime;
class QString;
class QPixmap;
class QNetworkAccessManager;
class QNetworkProxy;
namespace TomahawkUtils
{
DLLEXPORT QDir appConfigDir();
DLLEXPORT QDir appDataDir();
DLLEXPORT QString timeToString( int seconds );
DLLEXPORT QString ageToString( const QDateTime& time );
DLLEXPORT QString filesizeToString( unsigned int size );
DLLEXPORT QPixmap createDragPixmap( int itemCount = 1 );
DLLEXPORT QNetworkAccessManager* nam();
DLLEXPORT QNetworkProxy* proxy();
DLLEXPORT void setNam( QNetworkAccessManager* nam );
DLLEXPORT void setProxy( QNetworkProxy* proxy );
}
#endif // TOMAHAWKUTILS_H

View File

@@ -5,6 +5,8 @@
#include <QPoint> #include <QPoint>
#include <QWidget> #include <QWidget>
#include "dllmacro.h"
class QMouseEvent; class QMouseEvent;
class QEvent; class QEvent;
@@ -12,7 +14,7 @@ class QEvent;
* This class encapsulates an event filter on a widget that lets any drag events over the widget * This class encapsulates an event filter on a widget that lets any drag events over the widget
* translate into move events for the whole application. * translate into move events for the whole application.
*/ */
class WidgetDragFilter : public QObject class DLLEXPORT WidgetDragFilter : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:

View File

@@ -1,7 +1,6 @@
#include "sourceinfowidget.h" #include "sourceinfowidget.h"
#include "ui_sourceinfowidget.h" #include "ui_sourceinfowidget.h"
#include "tomahawk/tomahawkapp.h"
#include "utils/tomahawkutils.h" #include "utils/tomahawkutils.h"
#include "playlist/playlistmanager.h" #include "playlist/playlistmanager.h"

View File

@@ -7,6 +7,8 @@
#include "result.h" #include "result.h"
#include "playlistinterface.h" #include "playlistinterface.h"
#include "dllmacro.h"
class AlbumModel; class AlbumModel;
class CollectionFlatModel; class CollectionFlatModel;
class PlaylistModel; class PlaylistModel;
@@ -16,7 +18,7 @@ namespace Ui
class SourceInfoWidget; class SourceInfoWidget;
} }
class SourceInfoWidget : public QWidget class DLLEXPORT SourceInfoWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT

View File

@@ -120,17 +120,17 @@
<customwidget> <customwidget>
<class>PlaylistView</class> <class>PlaylistView</class>
<extends>QTreeView</extends> <extends>QTreeView</extends>
<header>playlistview.h</header> <header>playlist/playlistview.h</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>CollectionView</class> <class>CollectionView</class>
<extends>QTreeView</extends> <extends>QTreeView</extends>
<header>collectionview.h</header> <header>playlist/collectionview.h</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>AlbumView</class> <class>AlbumView</class>
<extends>QListView</extends> <extends>QListView</extends>
<header>albumview.h</header> <header>playlist/albumview.h</header>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>

View File

@@ -4,7 +4,6 @@
#include <QPushButton> #include <QPushButton>
#include <QDialogButtonBox> #include <QDialogButtonBox>
#include "tomahawk/tomahawkapp.h"
#include "utils/tomahawkutils.h" #include "utils/tomahawkutils.h"
#include "playlist/playlistmanager.h" #include "playlist/playlistmanager.h"
@@ -118,7 +117,7 @@ NewPlaylistWidget::savePlaylist()
playlist = Tomahawk::Playlist::create( SourceList::instance()->getLocal(), uuid(), ui->titleEdit->text(), "", "", false ); playlist = Tomahawk::Playlist::create( SourceList::instance()->getLocal(), uuid(), ui->titleEdit->text(), "", "", false );
playlist->createNewRevision( uuid(), playlist->currentrevision(), m_entries ); playlist->createNewRevision( uuid(), playlist->currentrevision(), m_entries );
APP->playlistManager()->show( playlist ); PlaylistManager::instance()->show( playlist );
cancel(); cancel();
} }

View File

@@ -8,6 +8,8 @@
#include "result.h" #include "result.h"
#include "playlistinterface.h" #include "playlistinterface.h"
#include "dllmacro.h"
class PlaylistModel; class PlaylistModel;
namespace Ui namespace Ui
@@ -15,7 +17,7 @@ namespace Ui
class NewPlaylistWidget; class NewPlaylistWidget;
} }
class NewPlaylistWidget : public QWidget class DLLEXPORT NewPlaylistWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT

View File

@@ -103,7 +103,7 @@
<customwidget> <customwidget>
<class>PlaylistView</class> <class>PlaylistView</class>
<extends>QTreeView</extends> <extends>QTreeView</extends>
<header>playlistview.h</header> <header>playlist/playlistview.h</header>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>

View File

@@ -1,7 +1,6 @@
#include "welcomewidget.h" #include "welcomewidget.h"
#include "ui_welcomewidget.h" #include "ui_welcomewidget.h"
#include "tomahawk/tomahawkapp.h"
#include "utils/tomahawkutils.h" #include "utils/tomahawkutils.h"
#include "playlist/playlistmanager.h" #include "playlist/playlistmanager.h"
@@ -79,7 +78,7 @@ WelcomeWidget::onPlaylistActivated( QListWidgetItem* item )
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
PlaylistWidgetItem* pwi = dynamic_cast<PlaylistWidgetItem*>(item); PlaylistWidgetItem* pwi = dynamic_cast<PlaylistWidgetItem*>(item);
APP->playlistManager()->show( pwi->playlist() ); PlaylistManager::instance()->show( pwi->playlist() );
} }
@@ -146,7 +145,7 @@ PlaylistDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
{ {
QStyleOptionViewItemV4 opt = option; QStyleOptionViewItemV4 opt = option;
initStyleOption( &opt, QModelIndex() ); initStyleOption( &opt, QModelIndex() );
APP->style()->drawControl( QStyle::CE_ItemViewItem, &opt, painter ); qApp->style()->drawControl( QStyle::CE_ItemViewItem, &opt, painter );
if ( option.state & QStyle::State_Selected ) if ( option.state & QStyle::State_Selected )
{ {

View File

@@ -5,12 +5,15 @@
#include <QListWidgetItem> #include <QListWidgetItem>
#include <QStyledItemDelegate> #include <QStyledItemDelegate>
#include "tomahawk/tomahawkapp.h"
#include "playlistinterface.h" #include "playlistinterface.h"
#include "playlist.h" #include "playlist.h"
#include "result.h" #include "result.h"
#include "utils/tomahawkutils.h"
#include "dllmacro.h"
class PlaylistModel; class PlaylistModel;
namespace Ui namespace Ui
@@ -18,7 +21,7 @@ namespace Ui
class WelcomeWidget; class WelcomeWidget;
} }
class PlaylistDelegate : public QStyledItemDelegate class DLLEXPORT PlaylistDelegate : public QStyledItemDelegate
{ {
Q_OBJECT Q_OBJECT
@@ -37,7 +40,7 @@ private:
}; };
class PlaylistWidgetItem : public QListWidgetItem class DLLEXPORT PlaylistWidgetItem : public QListWidgetItem
{ {
public: public:
enum ItemRoles enum ItemRoles
@@ -57,7 +60,7 @@ private:
}; };
class WelcomeWidget : public QWidget class DLLEXPORT WelcomeWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT

View File

@@ -64,7 +64,7 @@
<customwidget> <customwidget>
<class>PlaylistView</class> <class>PlaylistView</class>
<extends>QTreeView</extends> <extends>QTreeView</extends>
<header>playlistview.h</header> <header>playlist/playlistview.h</header>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>

View File

@@ -52,8 +52,8 @@ Scrobbler::Scrobbler( QObject* parent )
connect( TomahawkApp::instance(), SIGNAL( settingsChanged() ), connect( TomahawkApp::instance(), SIGNAL( settingsChanged() ),
SLOT( settingsChanged() ), Qt::QueuedConnection ); SLOT( settingsChanged() ), Qt::QueuedConnection );
connect( TomahawkApp::instance()->audioEngine(), SIGNAL( timerSeconds( unsigned int ) ), connect( AudioEngine::instance(), SIGNAL( timerSeconds( unsigned int ) ),
SLOT( engineTick( unsigned int ) ), Qt::QueuedConnection ); SLOT( engineTick( unsigned int ) ), Qt::QueuedConnection );
} }

View File

@@ -303,9 +303,9 @@ ProxyDialog::saveSettings()
return; return;
QNetworkProxy proxy( static_cast<QNetworkProxy::ProxyType>(s->proxyType()), s->proxyHost(), s->proxyPort(), s->proxyUsername(), s->proxyPassword() ); QNetworkProxy proxy( static_cast<QNetworkProxy::ProxyType>(s->proxyType()), s->proxyHost(), s->proxyPort(), s->proxyUsername(), s->proxyPassword() );
QNetworkAccessManager* nam = TomahawkApp::instance()->nam(); QNetworkAccessManager* nam = TomahawkUtils::nam();
nam->setProxy( proxy ); nam->setProxy( proxy );
QNetworkProxy* globalProxy = TomahawkApp::instance()->proxy(); QNetworkProxy* globalProxy = TomahawkUtils::proxy();
QNetworkProxy* oldProxy = globalProxy; QNetworkProxy* oldProxy = globalProxy;
globalProxy = new QNetworkProxy( proxy ); globalProxy = new QNetworkProxy( proxy );
if( oldProxy ) if( oldProxy )

View File

@@ -9,7 +9,7 @@
#include "query.h" #include "query.h"
#include "sourcelist.h" #include "sourcelist.h"
#include "sourcetreeitem.h" #include "sourcetreeitem.h"
#include "imagebutton.h" #include "utils/imagebutton.h"
using namespace Tomahawk; using namespace Tomahawk;

View File

@@ -7,7 +7,7 @@
#include "database/database.h" #include "database/database.h"
#include "database/databasecommand_collectionstats.h" #include "database/databasecommand_collectionstats.h"
#include "network/dbsyncconnection.h" #include "network/dbsyncconnection.h"
#include "playlistmanager.h" #include "playlist/playlistmanager.h"
using namespace Tomahawk; using namespace Tomahawk;
@@ -173,5 +173,5 @@ SourceTreeItemWidget::onOffline()
void void
SourceTreeItemWidget::onInfoButtonClicked() SourceTreeItemWidget::onInfoButtonClicked()
{ {
APP->playlistManager()->show( m_source ); PlaylistManager::instance()->show( m_source );
} }

View File

@@ -182,17 +182,17 @@
<customwidget> <customwidget>
<class>ImageButton</class> <class>ImageButton</class>
<extends>QPushButton</extends> <extends>QPushButton</extends>
<header>imagebutton.h</header> <header>utils/imagebutton.h</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>QueryLabel</class> <class>QueryLabel</class>
<extends>QLabel</extends> <extends>QLabel</extends>
<header>querylabel.h</header> <header>utils/querylabel.h</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>ElidedLabel</class> <class>ElidedLabel</class>
<extends>QLabel</extends> <extends>QLabel</extends>
<header>elidedlabel.h</header> <header>utils/elidedlabel.h</header>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>

View File

@@ -1,8 +1,8 @@
#include "sourcetreeview.h" #include "sourcetreeview.h"
#include "playlist.h" #include "playlist.h"
#include "collectionmodel.h" #include "playlist/collectionmodel.h"
#include "playlistmanager.h" #include "playlist/playlistmanager.h"
#include "sourcetreeitem.h" #include "sourcetreeitem.h"
#include "sourcesmodel.h" #include "sourcesmodel.h"
#include "sourcelist.h" #include "sourcelist.h"
@@ -129,13 +129,13 @@ SourceTreeView::onItemActivated( const QModelIndex& index )
{ {
if ( item->source().isNull() ) if ( item->source().isNull() )
{ {
APP->playlistManager()->showSuperCollection(); PlaylistManager::instance()->showSuperCollection();
} }
else else
{ {
qDebug() << "SourceTreeItem toggled:" << item->source()->userName(); qDebug() << "SourceTreeItem toggled:" << item->source()->userName();
APP->playlistManager()->show( item->source()->collection() ); PlaylistManager::instance()->show( item->source()->collection() );
// APP->playlistManager()->show( item->source() ); // APP->playlistManager()->show( item->source() );
} }
} }
@@ -147,7 +147,7 @@ SourceTreeView::onItemActivated( const QModelIndex& index )
{ {
qDebug() << "Playlist activated:" << playlist->title(); qDebug() << "Playlist activated:" << playlist->title();
APP->playlistManager()->show( playlist ); PlaylistManager::instance()->show( playlist );
} }
} }
} }

View File

@@ -21,7 +21,7 @@
#include "scriptresolver.h" #include "scriptresolver.h"
#include "sourcelist.h" #include "sourcelist.h"
#include "audioengine.h" #include "audio/audioengine.h"
#ifndef TOMAHAWK_HEADLESS #ifndef TOMAHAWK_HEADLESS
#include "tomahawkwindow.h" #include "tomahawkwindow.h"
@@ -102,8 +102,6 @@ using namespace Tomahawk;
TomahawkApp::TomahawkApp( int& argc, char *argv[] ) TomahawkApp::TomahawkApp( int& argc, char *argv[] )
: TOMAHAWK_APPLICATION( argc, argv ) : TOMAHAWK_APPLICATION( argc, argv )
, m_audioEngine( 0 ) , m_audioEngine( 0 )
, m_nam( 0 )
, m_proxy( 0 )
, m_infoSystem( 0 ) , m_infoSystem( 0 )
{ {
qsrand( QTime( 0, 0, 0 ).secsTo( QTime::currentTime() ) ); qsrand( QTime( 0, 0, 0 ).secsTo( QTime::currentTime() ) );
@@ -141,7 +139,7 @@ TomahawkApp::TomahawkApp( int& argc, char *argv[] )
#ifndef NO_LIBLASTFM #ifndef NO_LIBLASTFM
m_scrobbler = new Scrobbler( this ); m_scrobbler = new Scrobbler( this );
m_nam = new lastfm::NetworkAccessManager( this ); TomahawkUtils::setNam( new lastfm::NetworkAccessManager( this ) );
connect( m_audioEngine, SIGNAL( started( const Tomahawk::result_ptr& ) ), connect( m_audioEngine, SIGNAL( started( const Tomahawk::result_ptr& ) ),
m_scrobbler, SLOT( trackStarted( const Tomahawk::result_ptr& ) ), Qt::QueuedConnection ); m_scrobbler, SLOT( trackStarted( const Tomahawk::result_ptr& ) ), Qt::QueuedConnection );
@@ -155,23 +153,22 @@ TomahawkApp::TomahawkApp( int& argc, char *argv[] )
connect( m_audioEngine, SIGNAL( stopped() ), connect( m_audioEngine, SIGNAL( stopped() ),
m_scrobbler, SLOT( trackStopped() ), Qt::QueuedConnection ); m_scrobbler, SLOT( trackStopped() ), Qt::QueuedConnection );
#else #else
m_nam = new QNetworkAccessManager; TomahawkUtils::setNam( new QNetworkAccessManager );
#endif #endif
// Set up proxy // Set up proxy
if( TomahawkSettings::instance()->proxyType() != QNetworkProxy::NoProxy && !TomahawkSettings::instance()->proxyHost().isEmpty() ) if( TomahawkSettings::instance()->proxyType() != QNetworkProxy::NoProxy && !TomahawkSettings::instance()->proxyHost().isEmpty() )
{ {
qDebug() << "Setting proxy to saved values"; qDebug() << "Setting proxy to saved values";
m_proxy = new QNetworkProxy( static_cast<QNetworkProxy::ProxyType>(TomahawkSettings::instance()->proxyType()), TomahawkSettings::instance()->proxyHost(), TomahawkSettings::instance()->proxyPort(), TomahawkSettings::instance()->proxyUsername(), TomahawkSettings::instance()->proxyPassword() ); TomahawkUtils::setProxy( new QNetworkProxy( static_cast<QNetworkProxy::ProxyType>(TomahawkSettings::instance()->proxyType()), TomahawkSettings::instance()->proxyHost(), TomahawkSettings::instance()->proxyPort(), TomahawkSettings::instance()->proxyUsername(), TomahawkSettings::instance()->proxyPassword() ) );
qDebug() << "Proxy type =" << QString::number( static_cast<int>(m_proxy->type()) ); qDebug() << "Proxy type =" << QString::number( static_cast<int>(TomahawkUtils::proxy()->type()) );
qDebug() << "Proxy host =" << m_proxy->hostName(); qDebug() << "Proxy host =" << TomahawkUtils::proxy()->hostName();
QNetworkAccessManager* nam = TomahawkApp::instance()->nam(); TomahawkUtils::nam()->setProxy( *TomahawkUtils::proxy() );
nam->setProxy( *m_proxy );
} }
else else
m_proxy = new QNetworkProxy( QNetworkProxy::NoProxy ); TomahawkUtils::setProxy( new QNetworkProxy( QNetworkProxy::NoProxy ) );
QNetworkProxy::setApplicationProxy( *m_proxy ); QNetworkProxy::setApplicationProxy( *TomahawkUtils::proxy() );
m_sipHandler = new SipHandler( this ); m_sipHandler = new SipHandler( this );
m_infoSystem = new Tomahawk::InfoSystem::InfoSystem( this ); m_infoSystem = new Tomahawk::InfoSystem::InfoSystem( this );
@@ -230,13 +227,6 @@ TomahawkApp::audioControls()
{ {
return m_mainwindow->audioControls(); return m_mainwindow->audioControls();
} }
PlaylistManager*
TomahawkApp::playlistManager()
{
return m_mainwindow->playlistManager();
}
#endif #endif

View File

@@ -28,14 +28,14 @@ TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent )
m_contextMenu->addSeparator(); m_contextMenu->addSeparator();
m_quitAction = m_contextMenu->addAction( tr( "Quit" ) ); m_quitAction = m_contextMenu->addAction( tr( "Quit" ) );
connect( (QObject*)APP->audioEngine(), SIGNAL( loading( Tomahawk::result_ptr ) ), SLOT( setResult( Tomahawk::result_ptr ) ) ); connect( AudioEngine::instance(), SIGNAL( loading( Tomahawk::result_ptr ) ), SLOT( setResult( Tomahawk::result_ptr ) ) );
connect( m_playAction, SIGNAL( triggered() ), (QObject*)APP->audioEngine(), SLOT( play() ) ); connect( m_playAction, SIGNAL( triggered() ), AudioEngine::instance(), SLOT( play() ) );
connect( m_pauseAction, SIGNAL( triggered() ), (QObject*)APP->audioEngine(), SLOT( pause() ) ); connect( m_pauseAction, SIGNAL( triggered() ), AudioEngine::instance(), SLOT( pause() ) );
connect( m_stopAction, SIGNAL( triggered() ), (QObject*)APP->audioEngine(), SLOT( stop() ) ); connect( m_stopAction, SIGNAL( triggered() ), AudioEngine::instance(), SLOT( stop() ) );
connect( m_prevAction, SIGNAL( triggered() ), (QObject*)APP->audioEngine(), SLOT( previous() ) ); connect( m_prevAction, SIGNAL( triggered() ), AudioEngine::instance(), SLOT( previous() ) );
connect( m_nextAction, SIGNAL( triggered() ), (QObject*)APP->audioEngine(), SLOT( next() ) ); connect( m_nextAction, SIGNAL( triggered() ), AudioEngine::instance(), SLOT( next() ) );
connect( m_quitAction, SIGNAL( triggered() ), (QObject*)APP, SLOT( quit() ) ); connect( m_quitAction, SIGNAL( triggered() ), (QObject*)APP, SLOT( quit() ) );
connect( &m_animationTimer, SIGNAL( timeout() ), SLOT( onAnimationTimer() ) ); connect( &m_animationTimer, SIGNAL( timeout() ), SLOT( onAnimationTimer() ) );
connect( this, SIGNAL( activated( QSystemTrayIcon::ActivationReason ) ), SLOT( onActivated( QSystemTrayIcon::ActivationReason ) ) ); connect( this, SIGNAL( activated( QSystemTrayIcon::ActivationReason ) ), SLOT( onActivated( QSystemTrayIcon::ActivationReason ) ) );
@@ -142,11 +142,11 @@ TomahawkTrayIcon::event( QEvent* e )
{ {
if ( ((QWheelEvent*)e)->delta() > 0 ) if ( ((QWheelEvent*)e)->delta() > 0 )
{ {
APP->audioEngine()->raiseVolume(); AudioEngine::instance()->raiseVolume();
} }
else else
{ {
APP->audioEngine()->lowerVolume(); AudioEngine::instance()->lowerVolume();
} }
return true; return true;

View File

@@ -16,26 +16,24 @@
#include "playlist.h" #include "playlist.h"
#include "query.h" #include "query.h"
#include "audio/audioengine.h"
#include "database/database.h"
#include "database/databasecommand_collectionstats.h" #include "database/databasecommand_collectionstats.h"
#include "topbar/topbar.h" #include "network/controlconnection.h"
#include "playlist/playlistmanager.h"
#include "sip/SipHandler.h" #include "sip/SipHandler.h"
#include "topbar/topbar.h"
#include "utils/proxystyle.h"
#include "utils/widgetdragfilter.h"
#include "widgets/newplaylistwidget.h" #include "widgets/newplaylistwidget.h"
#include "widgets/welcomewidget.h" #include "widgets/welcomewidget.h"
#include "audiocontrols.h" #include "audiocontrols.h"
#include "network/controlconnection.h"
#include "database/database.h"
#include "musicscanner.h" #include "musicscanner.h"
#include "playlistmanager.h"
#include "proxystyle.h"
#include "settingsdialog.h" #include "settingsdialog.h"
#include "xspfloader.h" #include "xspfloader.h"
#include "proxystyle.h"
#include "tomahawksettings.h" #include "tomahawksettings.h"
#include "tomahawktrayicon.h" #include "tomahawktrayicon.h"
#include "widgetdragfilter.h"
using namespace Tomahawk; using namespace Tomahawk;
@@ -45,7 +43,6 @@ TomahawkWindow::TomahawkWindow( QWidget* parent )
, ui( new Ui::TomahawkWindow ) , ui( new Ui::TomahawkWindow )
, m_topbar( new TopBar( this ) ) , m_topbar( new TopBar( this ) )
, m_audioControls( new AudioControls( this ) ) , m_audioControls( new AudioControls( this ) )
, m_playlistManager( new PlaylistManager( this ) )
, m_trayIcon( new TomahawkTrayIcon( this ) ) , m_trayIcon( new TomahawkTrayIcon( this ) )
{ {
qApp->setStyle( new ProxyStyle() ); qApp->setStyle( new ProxyStyle() );
@@ -55,10 +52,12 @@ TomahawkWindow::TomahawkWindow( QWidget* parent )
setUnifiedTitleAndToolBarOnMac( true ); setUnifiedTitleAndToolBarOnMac( true );
#endif #endif
new PlaylistManager( this );
ui->setupUi( this ); ui->setupUi( this );
delete ui->playlistWidget; delete ui->playlistWidget;
ui->splitter->addWidget( m_playlistManager->widget() ); ui->splitter->addWidget( PlaylistManager::instance()->widget() );
ui->splitter->setStretchFactor( 0, 1 ); ui->splitter->setStretchFactor( 0, 1 );
ui->splitter->setStretchFactor( 1, 3 ); ui->splitter->setStretchFactor( 1, 3 );
ui->splitter->setCollapsible( 1, false ); ui->splitter->setCollapsible( 1, false );
@@ -81,7 +80,7 @@ TomahawkWindow::TomahawkWindow( QWidget* parent )
loadSettings(); loadSettings();
setupSignals(); setupSignals();
m_playlistManager->show( new WelcomeWidget() ); PlaylistManager::instance()->show( new WelcomeWidget() );
} }
@@ -118,45 +117,45 @@ TomahawkWindow::setupSignals()
{ {
// <Playlist> // <Playlist>
connect( m_topbar, SIGNAL( filterTextChanged( const QString& ) ), connect( m_topbar, SIGNAL( filterTextChanged( const QString& ) ),
playlistManager(), SLOT( setFilter( const QString& ) ) ); PlaylistManager::instance(), SLOT( setFilter( const QString& ) ) );
connect( playlistManager(), SIGNAL( numSourcesChanged( unsigned int ) ), connect( PlaylistManager::instance(), SIGNAL( numSourcesChanged( unsigned int ) ),
m_topbar, SLOT( setNumSources( unsigned int ) ) ); m_topbar, SLOT( setNumSources( unsigned int ) ) );
connect( playlistManager(), SIGNAL( numTracksChanged( unsigned int ) ), connect( PlaylistManager::instance(), SIGNAL( numTracksChanged( unsigned int ) ),
m_topbar, SLOT( setNumTracks( unsigned int ) ) ); m_topbar, SLOT( setNumTracks( unsigned int ) ) );
connect( playlistManager(), SIGNAL( numArtistsChanged( unsigned int ) ), connect( PlaylistManager::instance(), SIGNAL( numArtistsChanged( unsigned int ) ),
m_topbar, SLOT( setNumArtists( unsigned int ) ) ); m_topbar, SLOT( setNumArtists( unsigned int ) ) );
connect( playlistManager(), SIGNAL( numShownChanged( unsigned int ) ), connect( PlaylistManager::instance(), SIGNAL( numShownChanged( unsigned int ) ),
m_topbar, SLOT( setNumShown( unsigned int ) ) ); m_topbar, SLOT( setNumShown( unsigned int ) ) );
connect( m_topbar, SIGNAL( flatMode() ), connect( m_topbar, SIGNAL( flatMode() ),
playlistManager(), SLOT( setTableMode() ) ); PlaylistManager::instance(), SLOT( setTableMode() ) );
connect( m_topbar, SIGNAL( artistMode() ), connect( m_topbar, SIGNAL( artistMode() ),
playlistManager(), SLOT( setTreeMode() ) ); PlaylistManager::instance(), SLOT( setTreeMode() ) );
connect( m_topbar, SIGNAL( albumMode() ), connect( m_topbar, SIGNAL( albumMode() ),
playlistManager(), SLOT( setAlbumMode() ) ); PlaylistManager::instance(), SLOT( setAlbumMode() ) );
connect( playlistManager(), SIGNAL( statsAvailable( bool ) ), connect( PlaylistManager::instance(), SIGNAL( statsAvailable( bool ) ),
m_topbar, SLOT( setStatsVisible( bool ) ) ); m_topbar, SLOT( setStatsVisible( bool ) ) );
connect( playlistManager(), SIGNAL( modesAvailable( bool ) ), connect( PlaylistManager::instance(), SIGNAL( modesAvailable( bool ) ),
m_topbar, SLOT( setModesVisible( bool ) ) ); m_topbar, SLOT( setModesVisible( bool ) ) );
// <From PlaylistManager> // <From PlaylistManager>
connect( playlistManager(), SIGNAL( repeatModeChanged( PlaylistInterface::RepeatMode ) ), connect( PlaylistManager::instance(), SIGNAL( repeatModeChanged( PlaylistInterface::RepeatMode ) ),
m_audioControls, SLOT( onRepeatModeChanged( PlaylistInterface::RepeatMode ) ) ); m_audioControls, SLOT( onRepeatModeChanged( PlaylistInterface::RepeatMode ) ) );
connect( playlistManager(), SIGNAL( shuffleModeChanged( bool ) ), connect( PlaylistManager::instance(), SIGNAL( shuffleModeChanged( bool ) ),
m_audioControls, SLOT( onShuffleModeChanged( bool ) ) ); m_audioControls, SLOT( onShuffleModeChanged( bool ) ) );
// <From AudioEngine> // <From AudioEngine>
connect( (QObject*)APP->audioEngine(), SIGNAL( loading( const Tomahawk::result_ptr& ) ), connect( AudioEngine::instance(), SIGNAL( loading( const Tomahawk::result_ptr& ) ),
SLOT( onPlaybackLoading( const Tomahawk::result_ptr& ) ) ); SLOT( onPlaybackLoading( const Tomahawk::result_ptr& ) ) );
// <Menu Items> // <Menu Items>
connect( ui->actionPreferences, SIGNAL( triggered() ), SLOT( showSettingsDialog() ) ); connect( ui->actionPreferences, SIGNAL( triggered() ), SLOT( showSettingsDialog() ) );
@@ -212,13 +211,6 @@ TomahawkWindow::closeEvent( QCloseEvent* e )
} }
PlaylistManager*
TomahawkWindow::playlistManager()
{
return m_playlistManager;
}
void void
TomahawkWindow::showSettingsDialog() TomahawkWindow::showSettingsDialog()
{ {
@@ -325,7 +317,7 @@ TomahawkWindow::createPlaylist()
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
playlistManager()->show( new NewPlaylistWidget() ); PlaylistManager::instance()->show( new NewPlaylistWidget() );
/* bool ok; /* bool ok;
QString name = QInputDialog::getText( this, "Create New Playlist", "Name:", QLineEdit::Normal, "New Playlist", &ok ); QString name = QInputDialog::getText( this, "Create New Playlist", "Name:", QLineEdit::Normal, "New Playlist", &ok );

View File

@@ -12,7 +12,6 @@
class QAction; class QAction;
class AudioControls; class AudioControls;
class PlaylistManager;
class TopBar; class TopBar;
class TomahawkTrayIcon; class TomahawkTrayIcon;
@@ -29,7 +28,6 @@ public:
TomahawkWindow( QWidget* parent = 0 ); TomahawkWindow( QWidget* parent = 0 );
~TomahawkWindow(); ~TomahawkWindow();
PlaylistManager* playlistManager();
AudioControls* audioControls() { return m_audioControls; } AudioControls* audioControls() { return m_audioControls; }
QStackedWidget* playlistStack(); QStackedWidget* playlistStack();
@@ -70,7 +68,6 @@ private:
Ui::TomahawkWindow* ui; Ui::TomahawkWindow* ui;
TopBar* m_topbar; TopBar* m_topbar;
AudioControls* m_audioControls; AudioControls* m_audioControls;
PlaylistManager* m_playlistManager;
TomahawkTrayIcon* m_trayIcon; TomahawkTrayIcon* m_trayIcon;
QNetworkAccessManager m_nam; QNetworkAccessManager m_nam;

View File

@@ -170,7 +170,7 @@
<customwidget> <customwidget>
<class>AnimatedSplitter</class> <class>AnimatedSplitter</class>
<extends>QSplitter</extends> <extends>QSplitter</extends>
<header location="global">animatedsplitter.h</header> <header>utils/animatedsplitter.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget> <customwidget>

View File

@@ -311,7 +311,7 @@
<customwidget> <customwidget>
<class>AnimatedCounterLabel</class> <class>AnimatedCounterLabel</class>
<extends>QLabel</extends> <extends>QLabel</extends>
<header>animatedcounterlabel.h</header> <header>utils/animatedcounterlabel.h</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>SearchLineEdit</class> <class>SearchLineEdit</class>

Some files were not shown because too many files have changed in this diff Show More