mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-01 03:40:16 +02:00
* Moved audio, playlist, common utils & widgets into libtomahawk.
This commit is contained in:
@@ -13,7 +13,7 @@ SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
|
||||
#ADD_DEFINITIONS(-Wall -O2 -DNDEBUG)
|
||||
#ADD_DEFINITIONS(-fPIC)
|
||||
ADD_DEFINITIONS(-fPIC)
|
||||
|
||||
SET(AUDIO_LIBS "")
|
||||
|
||||
|
@@ -3,14 +3,11 @@
|
||||
|
||||
#define APP TomahawkApp::instance()
|
||||
|
||||
#define RESPATH ":/data/"
|
||||
|
||||
#include "headlesscheck.h"
|
||||
|
||||
#include <QRegExp>
|
||||
#include <QFile>
|
||||
#include <QSettings>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QDir>
|
||||
|
||||
#include "QxtHttpServerConnector"
|
||||
@@ -61,16 +58,12 @@ public:
|
||||
|
||||
static TomahawkApp* instance();
|
||||
|
||||
AudioEngine* audioEngine() { return m_audioEngine; }
|
||||
SipHandler* sipHandler() { return m_sipHandler; }
|
||||
QNetworkAccessManager* nam() { return m_nam; }
|
||||
QNetworkProxy* proxy() { return m_proxy; }
|
||||
Tomahawk::InfoSystem::InfoSystem* infoSystem() { return m_infoSystem; }
|
||||
XMPPBot* xmppBot() { return m_xmppBot; }
|
||||
|
||||
#ifndef TOMAHAWK_HEADLESS
|
||||
AudioControls* audioControls();
|
||||
PlaylistManager* playlistManager();
|
||||
TomahawkWindow* mainWindow() const { return m_mainwindow; }
|
||||
#endif
|
||||
|
||||
@@ -107,9 +100,6 @@ private:
|
||||
|
||||
bool m_headless;
|
||||
|
||||
QNetworkAccessManager* m_nam;
|
||||
QNetworkProxy* m_proxy;
|
||||
|
||||
Tomahawk::InfoSystem::InfoSystem* m_infoSystem;
|
||||
|
||||
QxtHttpServerConnector m_connector;
|
||||
|
@@ -27,13 +27,6 @@ SET( TOMAHAWK_INC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../include/" )
|
||||
#ENDFOREACH( moddir )
|
||||
|
||||
SET( tomahawkSources ${tomahawkSources}
|
||||
audio/madtranscode.cpp
|
||||
audio/vorbistranscode.cpp
|
||||
audio/flactranscode.cpp
|
||||
audio/audioengine.cpp
|
||||
|
||||
utils/tomahawkutils.cpp
|
||||
|
||||
sip/SipHandler.cpp
|
||||
|
||||
infosystem/infosystem.cpp
|
||||
@@ -52,36 +45,6 @@ SET( tomahawkSources ${tomahawkSources}
|
||||
)
|
||||
|
||||
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/sourcetreeitem.cpp
|
||||
sourcetree/sourcetreeitemwidget.cpp
|
||||
@@ -93,11 +56,6 @@ SET( tomahawkSourcesGui ${tomahawkSourcesGui}
|
||||
topbar/lineedit.cpp
|
||||
topbar/searchbutton.cpp
|
||||
|
||||
infowidgets/sourceinfowidget.cpp
|
||||
|
||||
widgets/newplaylistwidget.cpp
|
||||
widgets/welcomewidget.cpp
|
||||
|
||||
xspfloader.cpp
|
||||
transferview.cpp
|
||||
tomahawktrayicon.cpp
|
||||
@@ -110,12 +68,6 @@ SET( tomahawkHeaders ${tomahawkHeaders}
|
||||
"${TOMAHAWK_INC_DIR}/tomahawk/tomahawkapp.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
|
||||
|
||||
infosystem/infoplugins/echonestplugin.h
|
||||
@@ -130,36 +82,6 @@ SET( tomahawkHeaders ${tomahawkHeaders}
|
||||
)
|
||||
|
||||
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/sourcetreeitem.h
|
||||
sourcetree/sourcetreeitemwidget.h
|
||||
@@ -172,11 +94,6 @@ SET( tomahawkHeadersGui ${tomahawkHeadersGui}
|
||||
topbar/lineedit_p.h
|
||||
topbar/searchbutton.h
|
||||
|
||||
infowidgets/sourceinfowidget.h
|
||||
|
||||
widgets/newplaylistwidget.h
|
||||
widgets/welcomewidget.h
|
||||
|
||||
xspfloader.h
|
||||
transferview.h
|
||||
tomahawktrayicon.h
|
||||
@@ -193,10 +110,6 @@ SET( tomahawkUI ${tomahawkUI}
|
||||
audiocontrols.ui
|
||||
sourcetree/sourcetreeitemwidget.ui
|
||||
topbar/topbar.ui
|
||||
|
||||
infowidgets/sourceinfowidget.ui
|
||||
widgets/newplaylistwidget.ui
|
||||
widgets/welcomewidget.ui
|
||||
)
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
@@ -213,8 +126,8 @@ INCLUDE_DIRECTORIES(
|
||||
utils
|
||||
libtomahawk
|
||||
|
||||
../rtaudio
|
||||
../alsa-playback
|
||||
../rtaudio
|
||||
../qxt/qxtweb-standalone/qxtweb
|
||||
|
||||
/usr/include/taglib
|
||||
|
@@ -4,12 +4,12 @@
|
||||
#include <QNetworkReply>
|
||||
|
||||
#include "tomahawk/tomahawkapp.h"
|
||||
#include "album.h"
|
||||
#include "audio/audioengine.h"
|
||||
#include "playlist/playlistmanager.h"
|
||||
#include "utils/imagebutton.h"
|
||||
#include "utils/tomahawkutils.h"
|
||||
|
||||
#include "audioengine.h"
|
||||
#include "imagebutton.h"
|
||||
#include "playlist/playlistmanager.h"
|
||||
#include "album.h"
|
||||
|
||||
#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->setRange( 0, 100 );
|
||||
ui->volumeSlider->setValue( APP->audioEngine()->volume() );
|
||||
ui->volumeSlider->setValue( AudioEngine::instance()->volume() );
|
||||
ui->volumeSlider->setStyleSheet( "QSlider::groove::horizontal {"
|
||||
"margin: 5px; border-width: 3px;"
|
||||
"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_nextAction, SIGNAL( triggered() ), (QObject*)APP->audioEngine(), SLOT( next() ) ); */
|
||||
|
||||
connect( ui->volumeSlider, SIGNAL( valueChanged( int ) ), (QObject*)APP->audioEngine(), SLOT( setVolume( int ) ) );
|
||||
connect( ui->prevButton, SIGNAL( clicked() ), (QObject*)APP->audioEngine(), SLOT( previous() ) );
|
||||
connect( ui->playPauseButton, SIGNAL( clicked() ), (QObject*)APP->audioEngine(), SLOT( play() ) );
|
||||
connect( ui->pauseButton, SIGNAL( clicked() ), (QObject*)APP->audioEngine(), SLOT( pause() ) );
|
||||
connect( ui->nextButton, SIGNAL( clicked() ), (QObject*)APP->audioEngine(), SLOT( next() ) );
|
||||
connect( ui->volumeLowButton, SIGNAL( clicked() ), (QObject*)APP->audioEngine(), SLOT( lowerVolume() ) );
|
||||
connect( ui->volumeHighButton, SIGNAL( clicked() ), (QObject*)APP->audioEngine(), SLOT( raiseVolume() ) );
|
||||
connect( ui->volumeSlider, SIGNAL( valueChanged( int ) ), AudioEngine::instance(), SLOT( setVolume( int ) ) );
|
||||
connect( ui->prevButton, SIGNAL( clicked() ), AudioEngine::instance(), SLOT( previous() ) );
|
||||
connect( ui->playPauseButton, SIGNAL( clicked() ), AudioEngine::instance(), SLOT( play() ) );
|
||||
connect( ui->pauseButton, SIGNAL( clicked() ), AudioEngine::instance(), SLOT( pause() ) );
|
||||
connect( ui->nextButton, SIGNAL( clicked() ), AudioEngine::instance(), SLOT( next() ) );
|
||||
connect( ui->volumeLowButton, SIGNAL( clicked() ), AudioEngine::instance(), SLOT( lowerVolume() ) );
|
||||
connect( ui->volumeHighButton, SIGNAL( clicked() ), AudioEngine::instance(), SLOT( raiseVolume() ) );
|
||||
|
||||
connect( ui->repeatButton, SIGNAL( clicked() ), SLOT( onRepeatClicked() ) );
|
||||
connect( ui->shuffleButton, SIGNAL( clicked() ), SLOT( onShuffleClicked() ) );
|
||||
@@ -128,13 +128,13 @@ AudioControls::AudioControls( QWidget* parent )
|
||||
connect( ui->albumLabel, SIGNAL( clicked() ), SLOT( onAlbumClicked() ) );
|
||||
|
||||
// <From AudioEngine>
|
||||
connect( (QObject*)APP->audioEngine(), 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( (QObject*)APP->audioEngine(), SIGNAL( paused() ), SLOT( onPlaybackPaused() ) );
|
||||
connect( (QObject*)APP->audioEngine(), SIGNAL( resumed() ), SLOT( onPlaybackResumed() ) );
|
||||
connect( (QObject*)APP->audioEngine(), SIGNAL( stopped() ), SLOT( onPlaybackStopped() ) );
|
||||
connect( (QObject*)APP->audioEngine(), SIGNAL( timerSeconds( unsigned int ) ), SLOT( onPlaybackTimer( unsigned int ) ) );
|
||||
connect( (QObject*)APP->audioEngine(), SIGNAL( volumeChanged( int ) ), SLOT( onVolumeChanged( int ) ) );
|
||||
connect( AudioEngine::instance(), SIGNAL( loading( Tomahawk::result_ptr ) ), SLOT( onPlaybackLoading( Tomahawk::result_ptr ) ) );
|
||||
connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), SLOT( onPlaybackStarted( Tomahawk::result_ptr ) ) );
|
||||
connect( AudioEngine::instance(), SIGNAL( paused() ), SLOT( onPlaybackPaused() ) );
|
||||
connect( AudioEngine::instance(), SIGNAL( resumed() ), SLOT( onPlaybackResumed() ) );
|
||||
connect( AudioEngine::instance(), SIGNAL( stopped() ), SLOT( onPlaybackStopped() ) );
|
||||
connect( AudioEngine::instance(), SIGNAL( timerSeconds( unsigned int ) ), SLOT( onPlaybackTimer( unsigned int ) ) );
|
||||
connect( AudioEngine::instance(), SIGNAL( volumeChanged( int ) ), SLOT( onVolumeChanged( int ) ) );
|
||||
|
||||
m_defaultCover = QPixmap( RESPATH "images/no-album-art-placeholder.png" )
|
||||
.scaled( ui->coverImage->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
|
||||
@@ -200,7 +200,7 @@ AudioControls::onCoverArtDownloaded()
|
||||
{
|
||||
// Follow HTTP redirect
|
||||
QNetworkRequest req( redir );
|
||||
QNetworkReply* reply = APP->nam()->get( req );
|
||||
QNetworkReply* reply = TomahawkUtils::nam()->get( req );
|
||||
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";
|
||||
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() ) );
|
||||
}
|
||||
|
||||
@@ -359,21 +359,21 @@ AudioControls::onRepeatClicked()
|
||||
case PlaylistInterface::NoRepeat:
|
||||
{
|
||||
// switch to RepeatOne
|
||||
APP->playlistManager()->setRepeatMode( PlaylistInterface::RepeatOne );
|
||||
PlaylistManager::instance()->setRepeatMode( PlaylistInterface::RepeatOne );
|
||||
}
|
||||
break;
|
||||
|
||||
case PlaylistInterface::RepeatOne:
|
||||
{
|
||||
// switch to RepeatAll
|
||||
APP->playlistManager()->setRepeatMode( PlaylistInterface::RepeatAll );
|
||||
PlaylistManager::instance()->setRepeatMode( PlaylistInterface::RepeatAll );
|
||||
}
|
||||
break;
|
||||
|
||||
case PlaylistInterface::RepeatAll:
|
||||
{
|
||||
// switch to NoRepeat
|
||||
APP->playlistManager()->setRepeatMode( PlaylistInterface::NoRepeat );
|
||||
PlaylistManager::instance()->setRepeatMode( PlaylistInterface::NoRepeat );
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -408,19 +408,19 @@ AudioControls::onShuffleModeChanged( bool enabled )
|
||||
void
|
||||
AudioControls::onShuffleClicked()
|
||||
{
|
||||
APP->playlistManager()->setShuffled( m_shuffled ^ true );
|
||||
PlaylistManager::instance()->setShuffled( m_shuffled ^ true );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AudioControls::onTrackClicked()
|
||||
{
|
||||
APP->playlistManager()->showCurrentTrack();
|
||||
PlaylistManager::instance()->showCurrentTrack();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AudioControls::onAlbumClicked()
|
||||
{
|
||||
APP->playlistManager()->show( m_currentTrack->album() );
|
||||
PlaylistManager::instance()->show( m_currentTrack->album() );
|
||||
}
|
||||
|
@@ -492,12 +492,12 @@
|
||||
<customwidget>
|
||||
<class>ImageButton</class>
|
||||
<extends>QPushButton</extends>
|
||||
<header>imagebutton.h</header>
|
||||
<header>utils/imagebutton.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QueryLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>querylabel.h</header>
|
||||
<header>utils/querylabel.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
|
@@ -44,7 +44,7 @@ void MusixMatchPlugin::getInfo(const QString &caller, const InfoType type, const
|
||||
url.addQueryItem("apikey", m_apiKey);
|
||||
url.addQueryItem("q_artist", artist);
|
||||
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("origData", data);
|
||||
reply->setProperty("caller", caller);
|
||||
@@ -104,7 +104,7 @@ void MusixMatchPlugin::trackSearchSlot()
|
||||
QUrl url(requestString);
|
||||
url.addQueryItem("apikey", m_apiKey);
|
||||
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("customData", oldReply->property("customData"));
|
||||
newReply->setProperty("caller", oldReply->property("caller"));
|
||||
@@ -133,4 +133,4 @@ void MusixMatchPlugin::trackLyricsSlot()
|
||||
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 finished(reply->property("caller").toString(), Tomahawk::InfoSystem::InfoTrackLyrics);
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
project( tomahawklib )
|
||||
|
||||
SET( QT_USE_QTGUI TRUE )
|
||||
SET( QT_USE_QTSQL TRUE )
|
||||
SET( QT_USE_QTNETWORK TRUE )
|
||||
SET( QT_USE_QTXML TRUE )
|
||||
@@ -25,6 +26,11 @@ set( libSources
|
||||
|
||||
sip/SipPlugin.cpp
|
||||
|
||||
audio/madtranscode.cpp
|
||||
audio/vorbistranscode.cpp
|
||||
audio/flactranscode.cpp
|
||||
audio/audioengine.cpp
|
||||
|
||||
database/database.cpp
|
||||
database/databasecollection.cpp
|
||||
database/databaseworker.cpp
|
||||
@@ -54,6 +60,28 @@ set( libSources
|
||||
database/databasecommand_updatesearchindex.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/msgprocessor.cpp
|
||||
network/filetransferconnection.cpp
|
||||
@@ -63,6 +91,19 @@ set( libSources
|
||||
network/servent.cpp
|
||||
network/connection.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
|
||||
@@ -83,6 +124,12 @@ set( libHeaders
|
||||
|
||||
sip/SipPlugin.h
|
||||
|
||||
audio/transcodeinterface.h
|
||||
audio/madtranscode.h
|
||||
audio/vorbistranscode.h
|
||||
audio/flactranscode.h
|
||||
audio/audioengine.h
|
||||
|
||||
database/database.h
|
||||
database/databasecollection.h
|
||||
database/databaseworker.h
|
||||
@@ -121,6 +168,46 @@ set( libHeaders
|
||||
network/connection.h
|
||||
network/controlconnection.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} ..
|
||||
@@ -129,9 +216,15 @@ include_directories( . ${CMAKE_CURRENT_BINARY_DIR} ..
|
||||
../../include
|
||||
../network
|
||||
../../qxt/qxtweb-standalone/qxtweb
|
||||
../../rtaudio
|
||||
../../alsa-playback
|
||||
)
|
||||
|
||||
qt4_wrap_ui( libUI_H ${libUI} )
|
||||
qt4_wrap_cpp( libMoc ${libHeaders} )
|
||||
|
||||
SET( libSources ${libSources} ${libUI_H} )
|
||||
|
||||
add_library( tomahawklib SHARED ${libSources} ${libMoc} )
|
||||
|
||||
IF( WIN32 )
|
||||
@@ -143,6 +236,24 @@ SET( OS_SPECIFIC_LINK_LIBRARIES
|
||||
)
|
||||
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
|
||||
${QT_LIBRARIES}
|
||||
${OS_SPECIFIC_LINK_LIBRARIES}
|
||||
|
@@ -17,6 +17,15 @@
|
||||
#include "flactranscode.h"
|
||||
#endif
|
||||
|
||||
AudioEngine* AudioEngine::s_instance = 0;
|
||||
|
||||
|
||||
AudioEngine*
|
||||
AudioEngine::instance()
|
||||
{
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
|
||||
AudioEngine::AudioEngine()
|
||||
: QThread()
|
||||
@@ -26,6 +35,7 @@ AudioEngine::AudioEngine()
|
||||
, m_timeElapsed( 0 )
|
||||
, m_i( 0 )
|
||||
{
|
||||
s_instance = this;
|
||||
qDebug() << "Init AudioEngine";
|
||||
|
||||
moveToThread( this );
|
@@ -12,17 +12,21 @@
|
||||
#include "alsaplayback.h"
|
||||
#include "transcodeinterface.h"
|
||||
|
||||
#include "dllmacro.h"
|
||||
|
||||
#define AUDIO_VOLUME_STEP 5
|
||||
|
||||
class PlaylistInterface;
|
||||
|
||||
class AudioEngine : public QThread
|
||||
class DLLEXPORT AudioEngine : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum AudioErrorCode { StreamReadError, AudioDeviceError, DecodeError };
|
||||
|
||||
static AudioEngine* instance();
|
||||
|
||||
explicit AudioEngine();
|
||||
~AudioEngine();
|
||||
|
||||
@@ -104,6 +108,8 @@ private:
|
||||
|
||||
unsigned int m_timeElapsed;
|
||||
int m_i;
|
||||
|
||||
static AudioEngine* s_instance;
|
||||
};
|
||||
|
||||
#endif // AUDIOENGINE_H
|
@@ -15,10 +15,12 @@
|
||||
#include <QMutex>
|
||||
#include <QDebug>
|
||||
|
||||
#include "dllmacro.h"
|
||||
|
||||
#define FLAC_BUFFER 32768 * 36
|
||||
#define FLAC_BUFFER_PREFERRED 32768
|
||||
|
||||
class FLACTranscode : public TranscodeInterface , protected FLAC::Decoder::Stream
|
||||
class DLLEXPORT FLACTranscode : public TranscodeInterface , protected FLAC::Decoder::Stream
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@@ -14,10 +14,12 @@
|
||||
#include <QObject>
|
||||
#include <QMutex>
|
||||
|
||||
#include "dllmacro.h"
|
||||
|
||||
#define MP3_BUFFER 32768
|
||||
#define MP3_BUFFER_PREFERRED 32768
|
||||
|
||||
class MADTranscode : public TranscodeInterface
|
||||
class DLLEXPORT MADTranscode : public TranscodeInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@@ -6,7 +6,9 @@
|
||||
#include <QObject>
|
||||
#include <QMutex>
|
||||
|
||||
class TranscodeInterface : public QObject
|
||||
#include "dllmacro.h"
|
||||
|
||||
class DLLEXPORT TranscodeInterface : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@@ -15,11 +15,13 @@
|
||||
#include <QDebug>
|
||||
#include <QStringList>
|
||||
|
||||
#include "dllmacro.h"
|
||||
|
||||
// Must not be smaller than 8500 bytes!
|
||||
#define OGG_BUFFER 8500
|
||||
#define OGG_BUFFER_PREFERRED 32768
|
||||
|
||||
class VorbisTranscode : public TranscodeInterface
|
||||
class DLLEXPORT VorbisTranscode : public TranscodeInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@@ -8,7 +8,9 @@
|
||||
|
||||
#include "album.h"
|
||||
|
||||
class AlbumItem : public QObject
|
||||
#include "dllmacro.h"
|
||||
|
||||
class DLLEXPORT AlbumItem : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@@ -1,12 +1,14 @@
|
||||
#include "albumitemdelegate.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QPainter>
|
||||
#include <QAbstractItemView>
|
||||
|
||||
#include "query.h"
|
||||
#include "result.h"
|
||||
#include "tomahawk/tomahawkapp.h"
|
||||
|
||||
#include "utils/tomahawkutils.h"
|
||||
|
||||
#include "playlist/albumitem.h"
|
||||
#include "playlist/albumproxymodel.h"
|
||||
@@ -37,7 +39,7 @@ AlbumItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
||||
|
||||
QStyleOptionViewItemV4 opt = option;
|
||||
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 )
|
||||
{
|
@@ -3,9 +3,11 @@
|
||||
|
||||
#include <QStyledItemDelegate>
|
||||
|
||||
#include "dllmacro.h"
|
||||
|
||||
class AlbumProxyModel;
|
||||
|
||||
class AlbumItemDelegate : public QStyledItemDelegate
|
||||
class DLLEXPORT AlbumItemDelegate : public QStyledItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@@ -5,9 +5,10 @@
|
||||
#include <QMimeData>
|
||||
#include <QNetworkReply>
|
||||
|
||||
#include "tomahawk/tomahawkapp.h"
|
||||
#include "database/database.h"
|
||||
|
||||
#include "utils/tomahawkutils.h"
|
||||
|
||||
#define LASTFM_DEFAULT_COVER "http://cdn.last.fm/flatness/catalogue/noimage"
|
||||
|
||||
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";
|
||||
QNetworkRequest req( imgurl.arg( album->artist()->name() ).arg( album->name() ) );
|
||||
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( albumitem, SIGNAL( dataChanged() ), SLOT( onDataChanged() ) );
|
||||
@@ -313,7 +314,7 @@ AlbumModel::onCoverArtDownloaded()
|
||||
// Follow HTTP redirect
|
||||
QNetworkRequest req( redir );
|
||||
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() ) );
|
||||
}
|
||||
|
@@ -11,9 +11,11 @@
|
||||
|
||||
#include "albumitem.h"
|
||||
|
||||
#include "dllmacro.h"
|
||||
|
||||
class QMetaData;
|
||||
|
||||
class AlbumModel : public QAbstractItemModel
|
||||
class DLLEXPORT AlbumModel : public QAbstractItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@@ -6,7 +6,9 @@
|
||||
#include "playlistinterface.h"
|
||||
#include "playlist/albummodel.h"
|
||||
|
||||
class AlbumProxyModel : public QSortFilterProxyModel, public PlaylistInterface
|
||||
#include "dllmacro.h"
|
||||
|
||||
class DLLEXPORT AlbumProxyModel : public QSortFilterProxyModel, public PlaylistInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@@ -6,10 +6,9 @@
|
||||
#include <QPainter>
|
||||
#include <QScrollBar>
|
||||
|
||||
#include "tomahawk/tomahawkapp.h"
|
||||
#include "audioengine.h"
|
||||
#include "tomahawksettings.h"
|
||||
#include "audio/audioengine.h"
|
||||
|
||||
#include "tomahawksettings.h"
|
||||
#include "albumitemdelegate.h"
|
||||
#include "albummodel.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();
|
||||
// APP->audioEngine()->playItem( item->album().data(), item->album()->tracks().first()->results().first() );
|
||||
|
||||
APP->playlistManager()->show( item->album() );
|
||||
PlaylistManager::instance()->show( item->album() );
|
||||
}
|
||||
}
|
||||
|
@@ -4,10 +4,12 @@
|
||||
#include <QListView>
|
||||
#include <QSortFilterProxyModel>
|
||||
|
||||
#include "dllmacro.h"
|
||||
|
||||
class AlbumModel;
|
||||
class AlbumProxyModel;
|
||||
|
||||
class AlbumView : public QListView
|
||||
class DLLEXPORT AlbumView : public QListView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@@ -15,9 +15,11 @@
|
||||
|
||||
#include "database/databasecommand_alltracks.h"
|
||||
|
||||
#include "dllmacro.h"
|
||||
|
||||
class QMetaData;
|
||||
|
||||
class CollectionFlatModel : public TrackModel
|
||||
class DLLEXPORT CollectionFlatModel : public TrackModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@@ -12,9 +12,11 @@
|
||||
#include "playlist.h"
|
||||
#include "playlistinterface.h"
|
||||
|
||||
#include "dllmacro.h"
|
||||
|
||||
class QMetaData;
|
||||
|
||||
class CollectionModel : public QAbstractItemModel
|
||||
class DLLEXPORT CollectionModel : public QAbstractItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@@ -3,7 +3,9 @@
|
||||
|
||||
#include "trackproxymodel.h"
|
||||
|
||||
class CollectionProxyModel : public TrackProxyModel
|
||||
#include "dllmacro.h"
|
||||
|
||||
class DLLEXPORT CollectionProxyModel : public TrackProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@@ -3,10 +3,11 @@
|
||||
|
||||
#include <QMenu>
|
||||
|
||||
#include "tomahawk/tomahawkapp.h"
|
||||
#include "trackview.h"
|
||||
|
||||
class CollectionView : public TrackView
|
||||
#include "dllmacro.h"
|
||||
|
||||
class DLLEXPORT CollectionView : public TrackView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@@ -6,7 +6,6 @@
|
||||
|
||||
#include "query.h"
|
||||
#include "result.h"
|
||||
#include "tomahawk/tomahawkapp.h"
|
||||
|
||||
#include "playlist/plitem.h"
|
||||
#include "playlist/trackproxymodel.h"
|
@@ -3,9 +3,11 @@
|
||||
|
||||
#include <QStyledItemDelegate>
|
||||
|
||||
#include "dllmacro.h"
|
||||
|
||||
class TrackProxyModel;
|
||||
|
||||
class PlaylistItemDelegate : public QStyledItemDelegate
|
||||
class DLLEXPORT PlaylistItemDelegate : public QStyledItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@@ -19,10 +19,19 @@
|
||||
#include "sourcelist.h"
|
||||
#include "tomahawksettings.h"
|
||||
|
||||
#include "infowidgets/sourceinfowidget.h"
|
||||
#include "widgets/infowidgets/sourceinfowidget.h"
|
||||
|
||||
#define FILTER_TIMEOUT 280
|
||||
|
||||
PlaylistManager* PlaylistManager::s_instance = 0;
|
||||
|
||||
|
||||
PlaylistManager*
|
||||
PlaylistManager::instance()
|
||||
{
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
|
||||
PlaylistManager::PlaylistManager( QObject* parent )
|
||||
: QObject( parent )
|
||||
@@ -33,6 +42,7 @@ PlaylistManager::PlaylistManager( QObject* parent )
|
||||
, m_statsAvailable( false )
|
||||
, m_modesAvailable( false )
|
||||
{
|
||||
s_instance = this;
|
||||
m_stack = new QStackedWidget();
|
||||
|
||||
m_widget->setLayout( new QVBoxLayout() );
|
||||
@@ -46,7 +56,7 @@ PlaylistManager::PlaylistManager( QObject* parent )
|
||||
m_queueView = new QueueView( m_splitter );
|
||||
m_queueModel = new PlaylistModel( m_queueView );
|
||||
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->hide( 1, false );
|
||||
@@ -484,7 +494,7 @@ PlaylistManager::linkPlaylist()
|
||||
}
|
||||
|
||||
applyFilter();
|
||||
APP->audioEngine()->setPlaylist( m_currentInterface );
|
||||
AudioEngine::instance()->setPlaylist( m_currentInterface );
|
||||
|
||||
if ( m_currentInterface && m_statsAvailable )
|
||||
{
|
||||
@@ -544,7 +554,7 @@ PlaylistManager::showCurrentTrack()
|
||||
{
|
||||
unlinkPlaylist();
|
||||
|
||||
m_currentInterface = APP->audioEngine()->currentTrackPlaylist();
|
||||
m_currentInterface = AudioEngine::instance()->currentTrackPlaylist();
|
||||
|
||||
if ( m_currentInterface->widget() )
|
||||
m_stack->setCurrentWidget( m_currentInterface->widget() );
|
@@ -8,6 +8,8 @@
|
||||
#include "collection.h"
|
||||
#include "playlistinterface.h"
|
||||
|
||||
#include "dllmacro.h"
|
||||
|
||||
class AnimatedSplitter;
|
||||
class AlbumModel;
|
||||
class AlbumView;
|
||||
@@ -22,11 +24,13 @@ class TrackModel;
|
||||
class TrackView;
|
||||
class SourceInfoWidget;
|
||||
|
||||
class PlaylistManager : public QObject
|
||||
class DLLEXPORT PlaylistManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static PlaylistManager* instance();
|
||||
|
||||
explicit PlaylistManager( QObject* parent = 0 );
|
||||
~PlaylistManager();
|
||||
|
||||
@@ -116,6 +120,8 @@ private:
|
||||
|
||||
QTimer m_filterTimer;
|
||||
QString m_filter;
|
||||
|
||||
static PlaylistManager* s_instance;
|
||||
};
|
||||
|
||||
#endif // PLAYLISTMANAGER_H
|
@@ -6,16 +6,17 @@
|
||||
|
||||
#include "plitem.h"
|
||||
#include "trackmodel.h"
|
||||
#include "tomahawk/tomahawkapp.h"
|
||||
#include "collection.h"
|
||||
#include "query.h"
|
||||
#include "typedefs.h"
|
||||
#include "playlist.h"
|
||||
#include "playlistinterface.h"
|
||||
|
||||
#include "dllmacro.h"
|
||||
|
||||
class QMetaData;
|
||||
|
||||
class PlaylistModel : public TrackModel
|
||||
class DLLEXPORT PlaylistModel : public TrackModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@@ -3,7 +3,9 @@
|
||||
|
||||
#include "trackproxymodel.h"
|
||||
|
||||
class PlaylistProxyModel : public TrackProxyModel
|
||||
#include "dllmacro.h"
|
||||
|
||||
class DLLEXPORT PlaylistProxyModel : public TrackProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@@ -3,10 +3,11 @@
|
||||
|
||||
#include <QMenu>
|
||||
|
||||
#include "tomahawk/tomahawkapp.h"
|
||||
#include "trackview.h"
|
||||
|
||||
class PlaylistView : public TrackView
|
||||
#include "dllmacro.h"
|
||||
|
||||
class DLLEXPORT PlaylistView : public TrackView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@@ -8,7 +8,9 @@
|
||||
#include "query.h"
|
||||
#include "typedefs.h"
|
||||
|
||||
class PlItem : public QObject
|
||||
#include "dllmacro.h"
|
||||
|
||||
class DLLEXPORT PlItem : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@@ -2,7 +2,6 @@
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include "tomahawk/tomahawkapp.h"
|
||||
#include "playlist/playlistmanager.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
@@ -30,7 +29,7 @@ QueueProxyModel::siblingItem( int itemsAway )
|
||||
|
||||
qDebug() << "new rowcount:" << rowCount( QModelIndex() );
|
||||
if ( rowCount( QModelIndex() ) == 1 )
|
||||
APP->playlistManager()->hideQueue();
|
||||
PlaylistManager::instance()->hideQueue();
|
||||
|
||||
removeIndex( currentItem() );
|
||||
|
@@ -3,9 +3,11 @@
|
||||
|
||||
#include "playlistproxymodel.h"
|
||||
|
||||
#include "dllmacro.h"
|
||||
|
||||
class QMetaData;
|
||||
|
||||
class QueueProxyModel : public PlaylistProxyModel
|
||||
class DLLEXPORT QueueProxyModel : public PlaylistProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@@ -6,7 +6,9 @@
|
||||
#include "utils/animatedsplitter.h"
|
||||
#include "playlistview.h"
|
||||
|
||||
class QueueView : public AnimatedWidget
|
||||
#include "dllmacro.h"
|
||||
|
||||
class DLLEXPORT QueueView : public AnimatedWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@@ -4,7 +4,6 @@
|
||||
#include <QDebug>
|
||||
#include <QMenu>
|
||||
|
||||
#include "tomahawk/tomahawkapp.h"
|
||||
#include "tomahawksettings.h"
|
||||
#include "playlist/trackmodel.h"
|
||||
#include "playlist/trackview.h"
|
@@ -4,9 +4,11 @@
|
||||
#include <QHeaderView>
|
||||
#include <QSignalMapper>
|
||||
|
||||
#include "dllmacro.h"
|
||||
|
||||
class TrackView;
|
||||
|
||||
class TrackHeader : public QHeaderView
|
||||
class DLLEXPORT TrackHeader : public QHeaderView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@@ -4,7 +4,9 @@
|
||||
#include <QMimeData>
|
||||
#include <QTreeView>
|
||||
|
||||
#include "tomahawk/tomahawkapp.h"
|
||||
#include "audio/audioengine.h"
|
||||
#include "utils/tomahawkutils.h"
|
||||
|
||||
#include "album.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
@@ -17,8 +19,8 @@ TrackModel::TrackModel( QObject* parent )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
connect( (QObject*)APP->audioEngine(), 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( finished( Tomahawk::result_ptr ) ), SLOT( onPlaybackFinished( Tomahawk::result_ptr ) ), Qt::DirectConnection );
|
||||
connect( AudioEngine::instance(), SIGNAL( stopped() ), SLOT( onPlaybackStopped() ), Qt::DirectConnection );
|
||||
}
|
||||
|
||||
|
@@ -6,9 +6,11 @@
|
||||
#include "playlistinterface.h"
|
||||
#include "playlist/plitem.h"
|
||||
|
||||
#include "dllmacro.h"
|
||||
|
||||
class QMetaData;
|
||||
|
||||
class TrackModel : public QAbstractItemModel
|
||||
class DLLEXPORT TrackModel : public QAbstractItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@@ -6,7 +6,9 @@
|
||||
#include "playlistinterface.h"
|
||||
#include "playlist/trackmodel.h"
|
||||
|
||||
class TrackProxyModel : public QSortFilterProxyModel, public PlaylistInterface
|
||||
#include "dllmacro.h"
|
||||
|
||||
class DLLEXPORT TrackProxyModel : public QSortFilterProxyModel, public PlaylistInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@@ -5,11 +5,12 @@
|
||||
#include <QPainter>
|
||||
#include <QScrollBar>
|
||||
|
||||
#include "tomahawk/tomahawkapp.h"
|
||||
#include "playlist/trackheader.h"
|
||||
#include "playlist/playlistmanager.h"
|
||||
#include "playlist/queueview.h"
|
||||
#include "audioengine.h"
|
||||
#include "audio/audioengine.h"
|
||||
#include "utils/tomahawkutils.h"
|
||||
|
||||
#include "trackheader.h"
|
||||
#include "playlistmanager.h"
|
||||
#include "queueview.h"
|
||||
#include "trackmodel.h"
|
||||
#include "trackproxymodel.h"
|
||||
|
||||
@@ -94,7 +95,7 @@ TrackView::onItemActivated( const QModelIndex& index )
|
||||
{
|
||||
qDebug() << "Result activated:" << item->query()->toString() << item->query()->results().first()->url();
|
||||
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 ) );
|
||||
if ( item && item->query()->numResults() )
|
||||
{
|
||||
APP->playlistManager()->queue()->model()->append( item->query() );
|
||||
APP->playlistManager()->showQueue();
|
||||
PlaylistManager::instance()->queue()->model()->append( item->query() );
|
||||
PlaylistManager::instance()->showQueue();
|
||||
}
|
||||
}
|
||||
}
|
@@ -6,12 +6,14 @@
|
||||
|
||||
#include "playlistitemdelegate.h"
|
||||
|
||||
#include "dllmacro.h"
|
||||
|
||||
class PlaylistInterface;
|
||||
class TrackHeader;
|
||||
class TrackModel;
|
||||
class TrackProxyModel;
|
||||
|
||||
class TrackView : public QTreeView
|
||||
class DLLEXPORT TrackView : public QTreeView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@@ -5,9 +5,11 @@
|
||||
#include <QSplitter>
|
||||
#include <QTimeLine>
|
||||
|
||||
#include "dllmacro.h"
|
||||
|
||||
class AnimatedWidget;
|
||||
|
||||
class AnimatedSplitter : public QSplitter
|
||||
class DLLEXPORT AnimatedSplitter : public QSplitter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -44,7 +46,7 @@ private:
|
||||
QTimeLine* m_timeLine;
|
||||
};
|
||||
|
||||
class AnimatedWidget : public QWidget
|
||||
class DLLEXPORT AnimatedWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
@@ -4,7 +4,9 @@
|
||||
#include <QFrame>
|
||||
#include <QTime>
|
||||
|
||||
class ElidedLabel : public QFrame
|
||||
#include "dllmacro.h"
|
||||
|
||||
class DLLEXPORT ElidedLabel : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY( QString text READ text WRITE setText NOTIFY textChanged )
|
@@ -5,8 +5,9 @@
|
||||
#include <QIcon>
|
||||
#include <QMap>
|
||||
|
||||
#include "dllmacro.h"
|
||||
|
||||
class ImageButton : public QAbstractButton
|
||||
class DLLEXPORT ImageButton : public QAbstractButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@@ -4,7 +4,9 @@
|
||||
#include <QTreeView>
|
||||
#include <QProgressBar>
|
||||
|
||||
class ProgressTreeView : public QTreeView
|
||||
#include "dllmacro.h"
|
||||
|
||||
class DLLEXPORT ProgressTreeView : public QTreeView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@@ -4,7 +4,9 @@
|
||||
#include <QtGlobal>
|
||||
#include <QProxyStyle>
|
||||
|
||||
class ProxyStyle : public QProxyStyle
|
||||
#include "dllmacro.h"
|
||||
|
||||
class DLLEXPORT ProxyStyle : public QProxyStyle
|
||||
{
|
||||
public:
|
||||
ProxyStyle() {}
|
@@ -6,7 +6,9 @@
|
||||
|
||||
#include "result.h"
|
||||
|
||||
class QueryLabel : public QFrame
|
||||
#include "dllmacro.h"
|
||||
|
||||
class DLLEXPORT QueryLabel : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@@ -6,6 +6,7 @@
|
||||
#include <QDir>
|
||||
#include <QPainter>
|
||||
#include <QPixmap>
|
||||
#include <QNetworkAccessManager>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
@@ -273,4 +274,35 @@ createDragPixmap( int itemCount )
|
||||
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
|
33
src/libtomahawk/utils/tomahawkutils.h
Normal file
33
src/libtomahawk/utils/tomahawkutils.h
Normal 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
|
@@ -5,6 +5,8 @@
|
||||
#include <QPoint>
|
||||
#include <QWidget>
|
||||
|
||||
#include "dllmacro.h"
|
||||
|
||||
class QMouseEvent;
|
||||
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
|
||||
* translate into move events for the whole application.
|
||||
*/
|
||||
class WidgetDragFilter : public QObject
|
||||
class DLLEXPORT WidgetDragFilter : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
@@ -1,7 +1,6 @@
|
||||
#include "sourceinfowidget.h"
|
||||
#include "ui_sourceinfowidget.h"
|
||||
|
||||
#include "tomahawk/tomahawkapp.h"
|
||||
#include "utils/tomahawkutils.h"
|
||||
|
||||
#include "playlist/playlistmanager.h"
|
@@ -7,6 +7,8 @@
|
||||
#include "result.h"
|
||||
#include "playlistinterface.h"
|
||||
|
||||
#include "dllmacro.h"
|
||||
|
||||
class AlbumModel;
|
||||
class CollectionFlatModel;
|
||||
class PlaylistModel;
|
||||
@@ -16,7 +18,7 @@ namespace Ui
|
||||
class SourceInfoWidget;
|
||||
}
|
||||
|
||||
class SourceInfoWidget : public QWidget
|
||||
class DLLEXPORT SourceInfoWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@@ -120,17 +120,17 @@
|
||||
<customwidget>
|
||||
<class>PlaylistView</class>
|
||||
<extends>QTreeView</extends>
|
||||
<header>playlistview.h</header>
|
||||
<header>playlist/playlistview.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>CollectionView</class>
|
||||
<extends>QTreeView</extends>
|
||||
<header>collectionview.h</header>
|
||||
<header>playlist/collectionview.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>AlbumView</class>
|
||||
<extends>QListView</extends>
|
||||
<header>albumview.h</header>
|
||||
<header>playlist/albumview.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
@@ -4,7 +4,6 @@
|
||||
#include <QPushButton>
|
||||
#include <QDialogButtonBox>
|
||||
|
||||
#include "tomahawk/tomahawkapp.h"
|
||||
#include "utils/tomahawkutils.h"
|
||||
|
||||
#include "playlist/playlistmanager.h"
|
||||
@@ -118,7 +117,7 @@ NewPlaylistWidget::savePlaylist()
|
||||
playlist = Tomahawk::Playlist::create( SourceList::instance()->getLocal(), uuid(), ui->titleEdit->text(), "", "", false );
|
||||
playlist->createNewRevision( uuid(), playlist->currentrevision(), m_entries );
|
||||
|
||||
APP->playlistManager()->show( playlist );
|
||||
PlaylistManager::instance()->show( playlist );
|
||||
cancel();
|
||||
}
|
||||
|
@@ -8,6 +8,8 @@
|
||||
#include "result.h"
|
||||
#include "playlistinterface.h"
|
||||
|
||||
#include "dllmacro.h"
|
||||
|
||||
class PlaylistModel;
|
||||
|
||||
namespace Ui
|
||||
@@ -15,7 +17,7 @@ namespace Ui
|
||||
class NewPlaylistWidget;
|
||||
}
|
||||
|
||||
class NewPlaylistWidget : public QWidget
|
||||
class DLLEXPORT NewPlaylistWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@@ -103,7 +103,7 @@
|
||||
<customwidget>
|
||||
<class>PlaylistView</class>
|
||||
<extends>QTreeView</extends>
|
||||
<header>playlistview.h</header>
|
||||
<header>playlist/playlistview.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
@@ -1,7 +1,6 @@
|
||||
#include "welcomewidget.h"
|
||||
#include "ui_welcomewidget.h"
|
||||
|
||||
#include "tomahawk/tomahawkapp.h"
|
||||
#include "utils/tomahawkutils.h"
|
||||
|
||||
#include "playlist/playlistmanager.h"
|
||||
@@ -79,7 +78,7 @@ WelcomeWidget::onPlaylistActivated( QListWidgetItem* item )
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
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;
|
||||
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 )
|
||||
{
|
@@ -5,12 +5,15 @@
|
||||
#include <QListWidgetItem>
|
||||
#include <QStyledItemDelegate>
|
||||
|
||||
#include "tomahawk/tomahawkapp.h"
|
||||
#include "playlistinterface.h"
|
||||
|
||||
#include "playlist.h"
|
||||
#include "result.h"
|
||||
|
||||
#include "utils/tomahawkutils.h"
|
||||
|
||||
#include "dllmacro.h"
|
||||
|
||||
class PlaylistModel;
|
||||
|
||||
namespace Ui
|
||||
@@ -18,7 +21,7 @@ namespace Ui
|
||||
class WelcomeWidget;
|
||||
}
|
||||
|
||||
class PlaylistDelegate : public QStyledItemDelegate
|
||||
class DLLEXPORT PlaylistDelegate : public QStyledItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -37,7 +40,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class PlaylistWidgetItem : public QListWidgetItem
|
||||
class DLLEXPORT PlaylistWidgetItem : public QListWidgetItem
|
||||
{
|
||||
public:
|
||||
enum ItemRoles
|
||||
@@ -57,7 +60,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class WelcomeWidget : public QWidget
|
||||
class DLLEXPORT WelcomeWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@@ -64,7 +64,7 @@
|
||||
<customwidget>
|
||||
<class>PlaylistView</class>
|
||||
<extends>QTreeView</extends>
|
||||
<header>playlistview.h</header>
|
||||
<header>playlist/playlistview.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
@@ -52,8 +52,8 @@ Scrobbler::Scrobbler( QObject* parent )
|
||||
connect( TomahawkApp::instance(), SIGNAL( settingsChanged() ),
|
||||
SLOT( settingsChanged() ), Qt::QueuedConnection );
|
||||
|
||||
connect( TomahawkApp::instance()->audioEngine(), SIGNAL( timerSeconds( unsigned int ) ),
|
||||
SLOT( engineTick( unsigned int ) ), Qt::QueuedConnection );
|
||||
connect( AudioEngine::instance(), SIGNAL( timerSeconds( unsigned int ) ),
|
||||
SLOT( engineTick( unsigned int ) ), Qt::QueuedConnection );
|
||||
}
|
||||
|
||||
|
||||
|
@@ -303,9 +303,9 @@ ProxyDialog::saveSettings()
|
||||
return;
|
||||
|
||||
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 );
|
||||
QNetworkProxy* globalProxy = TomahawkApp::instance()->proxy();
|
||||
QNetworkProxy* globalProxy = TomahawkUtils::proxy();
|
||||
QNetworkProxy* oldProxy = globalProxy;
|
||||
globalProxy = new QNetworkProxy( proxy );
|
||||
if( oldProxy )
|
||||
|
@@ -9,7 +9,7 @@
|
||||
#include "query.h"
|
||||
#include "sourcelist.h"
|
||||
#include "sourcetreeitem.h"
|
||||
#include "imagebutton.h"
|
||||
#include "utils/imagebutton.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#include "database/database.h"
|
||||
#include "database/databasecommand_collectionstats.h"
|
||||
#include "network/dbsyncconnection.h"
|
||||
#include "playlistmanager.h"
|
||||
#include "playlist/playlistmanager.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
@@ -173,5 +173,5 @@ SourceTreeItemWidget::onOffline()
|
||||
void
|
||||
SourceTreeItemWidget::onInfoButtonClicked()
|
||||
{
|
||||
APP->playlistManager()->show( m_source );
|
||||
PlaylistManager::instance()->show( m_source );
|
||||
}
|
||||
|
@@ -182,17 +182,17 @@
|
||||
<customwidget>
|
||||
<class>ImageButton</class>
|
||||
<extends>QPushButton</extends>
|
||||
<header>imagebutton.h</header>
|
||||
<header>utils/imagebutton.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QueryLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>querylabel.h</header>
|
||||
<header>utils/querylabel.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ElidedLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>elidedlabel.h</header>
|
||||
<header>utils/elidedlabel.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#include "sourcetreeview.h"
|
||||
|
||||
#include "playlist.h"
|
||||
#include "collectionmodel.h"
|
||||
#include "playlistmanager.h"
|
||||
#include "playlist/collectionmodel.h"
|
||||
#include "playlist/playlistmanager.h"
|
||||
#include "sourcetreeitem.h"
|
||||
#include "sourcesmodel.h"
|
||||
#include "sourcelist.h"
|
||||
@@ -129,13 +129,13 @@ SourceTreeView::onItemActivated( const QModelIndex& index )
|
||||
{
|
||||
if ( item->source().isNull() )
|
||||
{
|
||||
APP->playlistManager()->showSuperCollection();
|
||||
PlaylistManager::instance()->showSuperCollection();
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "SourceTreeItem toggled:" << item->source()->userName();
|
||||
|
||||
APP->playlistManager()->show( item->source()->collection() );
|
||||
PlaylistManager::instance()->show( item->source()->collection() );
|
||||
// APP->playlistManager()->show( item->source() );
|
||||
}
|
||||
}
|
||||
@@ -147,7 +147,7 @@ SourceTreeView::onItemActivated( const QModelIndex& index )
|
||||
{
|
||||
qDebug() << "Playlist activated:" << playlist->title();
|
||||
|
||||
APP->playlistManager()->show( playlist );
|
||||
PlaylistManager::instance()->show( playlist );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -21,7 +21,7 @@
|
||||
#include "scriptresolver.h"
|
||||
#include "sourcelist.h"
|
||||
|
||||
#include "audioengine.h"
|
||||
#include "audio/audioengine.h"
|
||||
|
||||
#ifndef TOMAHAWK_HEADLESS
|
||||
#include "tomahawkwindow.h"
|
||||
@@ -102,8 +102,6 @@ using namespace Tomahawk;
|
||||
TomahawkApp::TomahawkApp( int& argc, char *argv[] )
|
||||
: TOMAHAWK_APPLICATION( argc, argv )
|
||||
, m_audioEngine( 0 )
|
||||
, m_nam( 0 )
|
||||
, m_proxy( 0 )
|
||||
, m_infoSystem( 0 )
|
||||
{
|
||||
qsrand( QTime( 0, 0, 0 ).secsTo( QTime::currentTime() ) );
|
||||
@@ -141,7 +139,7 @@ TomahawkApp::TomahawkApp( int& argc, char *argv[] )
|
||||
|
||||
#ifndef NO_LIBLASTFM
|
||||
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& ) ),
|
||||
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() ),
|
||||
m_scrobbler, SLOT( trackStopped() ), Qt::QueuedConnection );
|
||||
#else
|
||||
m_nam = new QNetworkAccessManager;
|
||||
TomahawkUtils::setNam( new QNetworkAccessManager );
|
||||
#endif
|
||||
|
||||
// Set up proxy
|
||||
if( TomahawkSettings::instance()->proxyType() != QNetworkProxy::NoProxy && !TomahawkSettings::instance()->proxyHost().isEmpty() )
|
||||
{
|
||||
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() );
|
||||
qDebug() << "Proxy type =" << QString::number( static_cast<int>(m_proxy->type()) );
|
||||
qDebug() << "Proxy host =" << m_proxy->hostName();
|
||||
QNetworkAccessManager* nam = TomahawkApp::instance()->nam();
|
||||
nam->setProxy( *m_proxy );
|
||||
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>(TomahawkUtils::proxy()->type()) );
|
||||
qDebug() << "Proxy host =" << TomahawkUtils::proxy()->hostName();
|
||||
TomahawkUtils::nam()->setProxy( *TomahawkUtils::proxy() );
|
||||
}
|
||||
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_infoSystem = new Tomahawk::InfoSystem::InfoSystem( this );
|
||||
@@ -230,13 +227,6 @@ TomahawkApp::audioControls()
|
||||
{
|
||||
return m_mainwindow->audioControls();
|
||||
}
|
||||
|
||||
|
||||
PlaylistManager*
|
||||
TomahawkApp::playlistManager()
|
||||
{
|
||||
return m_mainwindow->playlistManager();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
@@ -28,14 +28,14 @@ TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent )
|
||||
m_contextMenu->addSeparator();
|
||||
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_pauseAction, SIGNAL( triggered() ), (QObject*)APP->audioEngine(), SLOT( pause() ) );
|
||||
connect( m_stopAction, SIGNAL( triggered() ), (QObject*)APP->audioEngine(), SLOT( stop() ) );
|
||||
connect( m_prevAction, SIGNAL( triggered() ), (QObject*)APP->audioEngine(), SLOT( previous() ) );
|
||||
connect( m_nextAction, SIGNAL( triggered() ), (QObject*)APP->audioEngine(), SLOT( next() ) );
|
||||
connect( m_quitAction, SIGNAL( triggered() ), (QObject*)APP, SLOT( quit() ) );
|
||||
connect( m_playAction, SIGNAL( triggered() ), AudioEngine::instance(), SLOT( play() ) );
|
||||
connect( m_pauseAction, SIGNAL( triggered() ), AudioEngine::instance(), SLOT( pause() ) );
|
||||
connect( m_stopAction, SIGNAL( triggered() ), AudioEngine::instance(), SLOT( stop() ) );
|
||||
connect( m_prevAction, SIGNAL( triggered() ), AudioEngine::instance(), SLOT( previous() ) );
|
||||
connect( m_nextAction, SIGNAL( triggered() ), AudioEngine::instance(), SLOT( next() ) );
|
||||
connect( m_quitAction, SIGNAL( triggered() ), (QObject*)APP, SLOT( quit() ) );
|
||||
|
||||
connect( &m_animationTimer, SIGNAL( timeout() ), SLOT( onAnimationTimer() ) );
|
||||
connect( this, SIGNAL( activated( QSystemTrayIcon::ActivationReason ) ), SLOT( onActivated( QSystemTrayIcon::ActivationReason ) ) );
|
||||
@@ -142,11 +142,11 @@ TomahawkTrayIcon::event( QEvent* e )
|
||||
{
|
||||
if ( ((QWheelEvent*)e)->delta() > 0 )
|
||||
{
|
||||
APP->audioEngine()->raiseVolume();
|
||||
AudioEngine::instance()->raiseVolume();
|
||||
}
|
||||
else
|
||||
{
|
||||
APP->audioEngine()->lowerVolume();
|
||||
AudioEngine::instance()->lowerVolume();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@@ -16,26 +16,24 @@
|
||||
#include "playlist.h"
|
||||
#include "query.h"
|
||||
|
||||
#include "audio/audioengine.h"
|
||||
#include "database/database.h"
|
||||
#include "database/databasecommand_collectionstats.h"
|
||||
#include "topbar/topbar.h"
|
||||
|
||||
#include "network/controlconnection.h"
|
||||
#include "playlist/playlistmanager.h"
|
||||
#include "sip/SipHandler.h"
|
||||
|
||||
#include "topbar/topbar.h"
|
||||
#include "utils/proxystyle.h"
|
||||
#include "utils/widgetdragfilter.h"
|
||||
#include "widgets/newplaylistwidget.h"
|
||||
#include "widgets/welcomewidget.h"
|
||||
|
||||
#include "audiocontrols.h"
|
||||
#include "network/controlconnection.h"
|
||||
#include "database/database.h"
|
||||
#include "musicscanner.h"
|
||||
#include "playlistmanager.h"
|
||||
#include "proxystyle.h"
|
||||
#include "settingsdialog.h"
|
||||
#include "xspfloader.h"
|
||||
#include "proxystyle.h"
|
||||
#include "tomahawksettings.h"
|
||||
#include "tomahawktrayicon.h"
|
||||
#include "widgetdragfilter.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
@@ -45,7 +43,6 @@ TomahawkWindow::TomahawkWindow( QWidget* parent )
|
||||
, ui( new Ui::TomahawkWindow )
|
||||
, m_topbar( new TopBar( this ) )
|
||||
, m_audioControls( new AudioControls( this ) )
|
||||
, m_playlistManager( new PlaylistManager( this ) )
|
||||
, m_trayIcon( new TomahawkTrayIcon( this ) )
|
||||
{
|
||||
qApp->setStyle( new ProxyStyle() );
|
||||
@@ -55,10 +52,12 @@ TomahawkWindow::TomahawkWindow( QWidget* parent )
|
||||
setUnifiedTitleAndToolBarOnMac( true );
|
||||
#endif
|
||||
|
||||
new PlaylistManager( this );
|
||||
|
||||
ui->setupUi( this );
|
||||
|
||||
delete ui->playlistWidget;
|
||||
ui->splitter->addWidget( m_playlistManager->widget() );
|
||||
ui->splitter->addWidget( PlaylistManager::instance()->widget() );
|
||||
ui->splitter->setStretchFactor( 0, 1 );
|
||||
ui->splitter->setStretchFactor( 1, 3 );
|
||||
ui->splitter->setCollapsible( 1, false );
|
||||
@@ -81,7 +80,7 @@ TomahawkWindow::TomahawkWindow( QWidget* parent )
|
||||
loadSettings();
|
||||
setupSignals();
|
||||
|
||||
m_playlistManager->show( new WelcomeWidget() );
|
||||
PlaylistManager::instance()->show( new WelcomeWidget() );
|
||||
}
|
||||
|
||||
|
||||
@@ -118,45 +117,45 @@ TomahawkWindow::setupSignals()
|
||||
{
|
||||
// <Playlist>
|
||||
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 ) ) );
|
||||
|
||||
connect( playlistManager(), SIGNAL( numTracksChanged( unsigned int ) ),
|
||||
connect( PlaylistManager::instance(), SIGNAL( numTracksChanged( 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 ) ) );
|
||||
|
||||
connect( playlistManager(), SIGNAL( numShownChanged( unsigned int ) ),
|
||||
connect( PlaylistManager::instance(), SIGNAL( numShownChanged( unsigned int ) ),
|
||||
m_topbar, SLOT( setNumShown( unsigned int ) ) );
|
||||
|
||||
connect( m_topbar, SIGNAL( flatMode() ),
|
||||
playlistManager(), SLOT( setTableMode() ) );
|
||||
PlaylistManager::instance(), SLOT( setTableMode() ) );
|
||||
|
||||
connect( m_topbar, SIGNAL( artistMode() ),
|
||||
playlistManager(), SLOT( setTreeMode() ) );
|
||||
PlaylistManager::instance(), SLOT( setTreeMode() ) );
|
||||
|
||||
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 ) ) );
|
||||
|
||||
connect( playlistManager(), SIGNAL( modesAvailable( bool ) ),
|
||||
connect( PlaylistManager::instance(), SIGNAL( modesAvailable( bool ) ),
|
||||
m_topbar, SLOT( setModesVisible( bool ) ) );
|
||||
|
||||
// <From PlaylistManager>
|
||||
connect( playlistManager(), SIGNAL( repeatModeChanged( PlaylistInterface::RepeatMode ) ),
|
||||
connect( PlaylistManager::instance(), SIGNAL( repeatModeChanged( PlaylistInterface::RepeatMode ) ),
|
||||
m_audioControls, SLOT( onRepeatModeChanged( PlaylistInterface::RepeatMode ) ) );
|
||||
|
||||
connect( playlistManager(), SIGNAL( shuffleModeChanged( bool ) ),
|
||||
connect( PlaylistManager::instance(), SIGNAL( shuffleModeChanged( bool ) ),
|
||||
m_audioControls, SLOT( onShuffleModeChanged( bool ) ) );
|
||||
|
||||
// <From AudioEngine>
|
||||
connect( (QObject*)APP->audioEngine(), SIGNAL( loading( const Tomahawk::result_ptr& ) ),
|
||||
SLOT( onPlaybackLoading( const Tomahawk::result_ptr& ) ) );
|
||||
connect( AudioEngine::instance(), SIGNAL( loading( const Tomahawk::result_ptr& ) ),
|
||||
SLOT( onPlaybackLoading( const Tomahawk::result_ptr& ) ) );
|
||||
|
||||
// <Menu Items>
|
||||
connect( ui->actionPreferences, SIGNAL( triggered() ), SLOT( showSettingsDialog() ) );
|
||||
@@ -212,13 +211,6 @@ TomahawkWindow::closeEvent( QCloseEvent* e )
|
||||
}
|
||||
|
||||
|
||||
PlaylistManager*
|
||||
TomahawkWindow::playlistManager()
|
||||
{
|
||||
return m_playlistManager;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkWindow::showSettingsDialog()
|
||||
{
|
||||
@@ -325,7 +317,7 @@ TomahawkWindow::createPlaylist()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
playlistManager()->show( new NewPlaylistWidget() );
|
||||
PlaylistManager::instance()->show( new NewPlaylistWidget() );
|
||||
|
||||
/* bool ok;
|
||||
QString name = QInputDialog::getText( this, "Create New Playlist", "Name:", QLineEdit::Normal, "New Playlist", &ok );
|
||||
|
@@ -12,7 +12,6 @@
|
||||
class QAction;
|
||||
|
||||
class AudioControls;
|
||||
class PlaylistManager;
|
||||
class TopBar;
|
||||
class TomahawkTrayIcon;
|
||||
|
||||
@@ -29,7 +28,6 @@ public:
|
||||
TomahawkWindow( QWidget* parent = 0 );
|
||||
~TomahawkWindow();
|
||||
|
||||
PlaylistManager* playlistManager();
|
||||
AudioControls* audioControls() { return m_audioControls; }
|
||||
QStackedWidget* playlistStack();
|
||||
|
||||
@@ -70,7 +68,6 @@ private:
|
||||
Ui::TomahawkWindow* ui;
|
||||
TopBar* m_topbar;
|
||||
AudioControls* m_audioControls;
|
||||
PlaylistManager* m_playlistManager;
|
||||
TomahawkTrayIcon* m_trayIcon;
|
||||
QNetworkAccessManager m_nam;
|
||||
|
||||
|
@@ -170,7 +170,7 @@
|
||||
<customwidget>
|
||||
<class>AnimatedSplitter</class>
|
||||
<extends>QSplitter</extends>
|
||||
<header location="global">animatedsplitter.h</header>
|
||||
<header>utils/animatedsplitter.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
|
@@ -311,7 +311,7 @@
|
||||
<customwidget>
|
||||
<class>AnimatedCounterLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>animatedcounterlabel.h</header>
|
||||
<header>utils/animatedcounterlabel.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>SearchLineEdit</class>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user