mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-22 13:43:11 +02:00
Port libtomahawk to the new cmake-build-in automoc. Requires cmake 2.8.6
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
PROJECT( tomahawk )
|
||||
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
|
||||
CMAKE_MINIMUM_REQUIRED( VERSION 2.8.6 )
|
||||
SET( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules" )
|
||||
|
||||
IF( ${CMAKE_VERSION} VERSION_GREATER 2.8.3 )
|
||||
|
@@ -35,6 +35,7 @@ set( libGuiSources
|
||||
jobview/JobStatusView.cpp
|
||||
jobview/JobStatusModel.cpp
|
||||
jobview/JobStatusDelegate.cpp
|
||||
jobview/JobStatusItem.cpp
|
||||
jobview/PipelineStatusItem.cpp
|
||||
jobview/TransferStatusItem.cpp
|
||||
jobview/LatchedStatusItem.cpp
|
||||
@@ -115,6 +116,7 @@ set( libGuiSources
|
||||
utils/proxystyle.cpp
|
||||
utils/tomahawkutilsgui.cpp
|
||||
|
||||
widgets/animatedcounterlabel.cpp
|
||||
widgets/checkdirtree.cpp
|
||||
widgets/querylabel.cpp
|
||||
widgets/imagebutton.cpp
|
||||
@@ -147,139 +149,6 @@ IF(QCA2_FOUND)
|
||||
set( libGuiSources ${libGuiSources} utils/groovesharkparser.cpp )
|
||||
ENDIF(QCA2_FOUND)
|
||||
|
||||
set( libGuiHeaders
|
||||
actioncollection.h
|
||||
|
||||
contextmenu.h
|
||||
dropjob.h
|
||||
viewmanager.h
|
||||
globalactionmanager.h
|
||||
LatchManager.h
|
||||
TomahawkSettingsGui.h
|
||||
|
||||
context/ContextPage.h
|
||||
context/ContextWidget.h
|
||||
context/pages/TopTracksContext.h
|
||||
context/pages/RelatedArtistsContext.h
|
||||
context/pages/WikipediaContext.h
|
||||
context/pages/WebContext.h
|
||||
|
||||
infobar/infobar.h
|
||||
|
||||
playlist/topbar/topbar.h
|
||||
playlist/topbar/clearbutton.h
|
||||
playlist/topbar/searchlineedit.h
|
||||
playlist/topbar/lineedit.h
|
||||
playlist/topbar/lineedit_p.h
|
||||
playlist/topbar/searchbutton.h
|
||||
|
||||
playlist/treemodel.h
|
||||
playlist/treeproxymodel.h
|
||||
playlist/treeproxymodelplaylistinterface.h
|
||||
playlist/treeheader.h
|
||||
playlist/treeitemdelegate.h
|
||||
playlist/collectionproxymodel.h
|
||||
playlist/collectionproxymodelplaylistinterface.h
|
||||
playlist/collectionflatmodel.h
|
||||
playlist/collectionview.h
|
||||
playlist/playlistmodel.h
|
||||
playlist/playlistproxymodel.h
|
||||
playlist/playlistproxymodelplaylistinterface.h
|
||||
playlist/playlistview.h
|
||||
playlist/playlistitemdelegate.h
|
||||
playlist/queueproxymodel.h
|
||||
playlist/queueproxymodelplaylistinterface.h
|
||||
playlist/queueview.h
|
||||
playlist/trackmodel.h
|
||||
playlist/trackmodelitem.h
|
||||
playlist/trackproxymodel.h
|
||||
playlist/trackproxymodelplaylistinterface.h
|
||||
playlist/trackview.h
|
||||
playlist/trackheader.h
|
||||
playlist/treemodelitem.h
|
||||
playlist/albumitem.h
|
||||
playlist/albummodel.h
|
||||
playlist/albumproxymodel.h
|
||||
playlist/albumproxymodelplaylistinterface.h
|
||||
playlist/albumitemdelegate.h
|
||||
playlist/albumview.h
|
||||
playlist/artistview.h
|
||||
playlist/customplaylistview.h
|
||||
playlist/ViewHeader.h
|
||||
|
||||
playlist/dynamic/DynamicPlaylist.h
|
||||
playlist/dynamic/GeneratorInterface.h
|
||||
playlist/dynamic/DynamicView.h
|
||||
playlist/dynamic/DynamicModel.h
|
||||
playlist/dynamic/echonest/EchonestGenerator.h
|
||||
playlist/dynamic/echonest/EchonestControl.h
|
||||
playlist/dynamic/echonest/EchonestSteerer.h
|
||||
playlist/dynamic/widgets/DynamicWidget.h
|
||||
playlist/dynamic/widgets/DynamicControlWrapper.h
|
||||
playlist/dynamic/widgets/DynamicControlList.h
|
||||
playlist/dynamic/widgets/ReadOrWriteWidget.h
|
||||
playlist/dynamic/widgets/MiscControlWidgets.h
|
||||
playlist/dynamic/widgets/CollapsibleControls.h
|
||||
playlist/dynamic/widgets/DynamicSetupWidget.h
|
||||
playlist/dynamic/widgets/LoadingSpinner.h
|
||||
|
||||
ExternalResolverGui.h
|
||||
resolvers/scriptresolver.h
|
||||
resolvers/qtscriptresolver.h
|
||||
|
||||
utils/widgetdragfilter.h
|
||||
utils/xspfgenerator.h
|
||||
utils/jspfloader.h
|
||||
utils/spotifyparser.h
|
||||
utils/m3uloader.h
|
||||
utils/itunesparser.h
|
||||
utils/rdioparser.h
|
||||
utils/shortenedlinkparser.h
|
||||
utils/dropjobnotifier.h
|
||||
|
||||
widgets/checkdirtree.h
|
||||
widgets/querylabel.h
|
||||
widgets/animatedcounterlabel.h
|
||||
widgets/imagebutton.h
|
||||
widgets/animatedsplitter.h
|
||||
widgets/elidedlabel.h
|
||||
widgets/newplaylistwidget.h
|
||||
widgets/searchwidget.h
|
||||
widgets/SeekSlider.h
|
||||
widgets/playlisttypeselectordlg.h
|
||||
widgets/welcomewidget.h
|
||||
widgets/whatshotwidget.h
|
||||
widgets/whatshotwidget_p.h
|
||||
widgets/ChartDataLoader.h
|
||||
widgets/RecentlyPlayedPlaylistsModel.h
|
||||
widgets/RecentPlaylistsModel.h
|
||||
widgets/OverlayButton.h
|
||||
widgets/overlaywidget.h
|
||||
widgets/HeaderLabel.h
|
||||
widgets/HeaderWidget.h
|
||||
widgets/combobox.h
|
||||
widgets/ToggleButton.h
|
||||
widgets/SocialPlaylistWidget.h
|
||||
widgets/infowidgets/sourceinfowidget.h
|
||||
widgets/infowidgets/ArtistInfoWidget.h
|
||||
widgets/infowidgets/ArtistInfoWidget_p.h
|
||||
widgets/infowidgets/AlbumInfoWidget.h
|
||||
widgets/Breadcrumb.h
|
||||
widgets/BreadcrumbButton.h
|
||||
|
||||
jobview/JobStatusView.h
|
||||
jobview/JobStatusModel.h
|
||||
jobview/JobStatusDelegate.h
|
||||
jobview/JobStatusItem.h
|
||||
jobview/PipelineStatusItem.h
|
||||
jobview/TransferStatusItem.h
|
||||
jobview/LatchedStatusItem.h
|
||||
jobview/ErrorStatusMessage.h
|
||||
jobview/IndexingJobItem.h
|
||||
|
||||
thirdparty/Qocoa/qsearchfield.h
|
||||
)
|
||||
|
||||
IF(QCA2_FOUND)
|
||||
set( libGuiHeaders ${libGuiHeaders} utils/groovesharkparser.h )
|
||||
ENDIF(QCA2_FOUND)
|
||||
@@ -295,6 +164,7 @@ set( libSources
|
||||
album.cpp
|
||||
albumplaylistinterface.cpp
|
||||
collection.cpp
|
||||
functimeout.cpp
|
||||
playlist.cpp
|
||||
playlistplaylistinterface.cpp
|
||||
resolver.cpp
|
||||
@@ -426,156 +296,6 @@ set( libSources
|
||||
thirdparty/kdsingleapplicationguard/kdlockedsharedmemorypointer.cpp
|
||||
)
|
||||
|
||||
set( libHeaders
|
||||
tomahawksettings.h
|
||||
sourcelist.h
|
||||
pipeline.h
|
||||
functimeout.h
|
||||
|
||||
playlistinterface.h
|
||||
|
||||
aclsystem.h
|
||||
collection.h
|
||||
query.h
|
||||
resolver.h
|
||||
ExternalResolver.h
|
||||
result.h
|
||||
source.h
|
||||
sourceplaylistinterface.h
|
||||
|
||||
artist.h
|
||||
artistplaylistinterface.h
|
||||
album.h
|
||||
albumplaylistinterface.h
|
||||
playlist.h
|
||||
playlistplaylistinterface.h
|
||||
viewpage.h
|
||||
|
||||
accounts/Account.h
|
||||
accounts/AccountManager.h
|
||||
accounts/AccountModel.h
|
||||
accounts/AccountModelFilterProxy.h
|
||||
accounts/ResolverAccount.h
|
||||
accounts/LastFmAccount.h
|
||||
accounts/LastFmConfig.h
|
||||
|
||||
EchonestCatalogSynchronizer.h
|
||||
|
||||
sip/SipPlugin.h
|
||||
sip/SipHandler.h
|
||||
sip/sipinfo.h
|
||||
|
||||
audio/audioengine.h
|
||||
|
||||
database/database.h
|
||||
database/fuzzyindex.h
|
||||
database/databaseworker.h
|
||||
database/databaseimpl.h
|
||||
database/databaseresolver.h
|
||||
database/databasecommand.h
|
||||
database/databasecommandloggable.h
|
||||
database/databasecommand_resolve.h
|
||||
database/databasecommand_allartists.h
|
||||
database/databasecommand_allalbums.h
|
||||
database/databasecommand_alltracks.h
|
||||
database/databasecommand_addfiles.h
|
||||
database/databasecommand_deletefiles.h
|
||||
database/databasecommand_dirmtimes.h
|
||||
database/databasecommand_filemtimes.h
|
||||
database/databasecommand_loadfiles.h
|
||||
database/databasecommand_logplayback.h
|
||||
database/databasecommand_addsource.h
|
||||
database/databasecommand_sourceoffline.h
|
||||
database/databasecommand_collectionstats.h
|
||||
database/databasecommand_loadplaylistentries.h
|
||||
database/databasecommand_modifyplaylist.h
|
||||
database/databasecommand_playbackhistory.h
|
||||
database/databasecommand_setplaylistrevision.h
|
||||
database/databasecommand_loadallplaylists.h
|
||||
database/databasecommand_loadallsortedplaylists.h
|
||||
database/databasecommand_loadallsources.h
|
||||
database/databasecommand_createplaylist.h
|
||||
database/databasecommand_deleteplaylist.h
|
||||
database/databasecommand_renameplaylist.h
|
||||
database/databasecommand_loadops.h
|
||||
database/databasecommand_updatesearchindex.h
|
||||
database/databasecollection.h
|
||||
database/localcollection.h
|
||||
database/databasecommand_setdynamicplaylistrevision.h
|
||||
database/databasecommand_createdynamicplaylist.h
|
||||
database/databasecommand_loaddynamicplaylist.h
|
||||
database/databasecommand_loaddynamicplaylistentries.h
|
||||
database/databasecommand_deletedynamicplaylist.h
|
||||
database/databasecommand_loadallautoplaylists.h
|
||||
database/databasecommand_loadallstations.h
|
||||
database/databasecommand_addclientauth.h
|
||||
database/databasecommand_clientauthvalid.h
|
||||
database/databasecommand_socialaction.h
|
||||
database/databasecommand_loadsocialactions.h
|
||||
database/databasecommand_genericselect.h
|
||||
database/databasecommand_setcollectionattributes.h
|
||||
database/databasecommand_collectionattributes.h
|
||||
database/databasecommand_trackattributes.h
|
||||
database/databasecommand_settrackattributes.h
|
||||
|
||||
infosystem/infosystem.h
|
||||
infosystem/infosystem.h
|
||||
infosystem/infosystemworker.h
|
||||
infosystem/infosystemcache.h
|
||||
|
||||
infosystem/infoplugins/generic/echonestplugin.h
|
||||
infosystem/infoplugins/generic/lastfmplugin.h
|
||||
infosystem/infoplugins/generic/chartsplugin.h
|
||||
infosystem/infoplugins/generic/spotifyPlugin.h
|
||||
infosystem/infoplugins/generic/hypemPlugin.h
|
||||
infosystem/infoplugins/generic/musixmatchplugin.h
|
||||
infosystem/infoplugins/generic/musicbrainzPlugin.h
|
||||
infosystem/infoplugins/generic/RoviPlugin.h
|
||||
|
||||
network/bufferiodevice.h
|
||||
network/msgprocessor.h
|
||||
network/remotecollection.h
|
||||
network/streamconnection.h
|
||||
network/dbsyncconnection.h
|
||||
network/servent.h
|
||||
network/connection.h
|
||||
network/controlconnection.h
|
||||
network/portfwdthread.h
|
||||
|
||||
playlist/PlaylistUpdaterInterface.h
|
||||
playlist/dynamic/DynamicPlaylist.h
|
||||
playlist/dynamic/GeneratorInterface.h
|
||||
playlist/dynamic/GeneratorFactory.h
|
||||
playlist/XspfUpdater.h
|
||||
playlist/dynamic/database/DatabaseGenerator.h
|
||||
playlist/dynamic/database/DatabaseControl.h
|
||||
playlist/dynamic/DynamicControl.h
|
||||
|
||||
thirdparty/kdsingleapplicationguard/kdsingleapplicationguard.h
|
||||
|
||||
utils/tomahawkutilsgui.h
|
||||
utils/xspfloader.h
|
||||
utils/qnr_iodevicestream.h
|
||||
)
|
||||
|
||||
set( libHeaders_NoMOC
|
||||
viewpage.h
|
||||
|
||||
accounts/Account.h
|
||||
|
||||
infosystem/infoplugins/unix/imageconverter.h
|
||||
|
||||
taghandlers/tag.h
|
||||
taghandlers/apetag.h
|
||||
taghandlers/asftag.h
|
||||
taghandlers/id3v1tag.h
|
||||
taghandlers/id3v2tag.h
|
||||
taghandlers/mp4tag.h
|
||||
taghandlers/oggtag.h
|
||||
|
||||
utils/tomahawkutils.h
|
||||
)
|
||||
|
||||
set( libUI ${libUI}
|
||||
widgets/playlisttypeselectordlg.ui
|
||||
widgets/newplaylistwidget.ui
|
||||
@@ -670,10 +390,6 @@ IF( APPLE )
|
||||
|
||||
SET_SOURCE_FILES_PROPERTIES(utils/tomahawkutils_mac.mm PROPERTIES COMPILE_FLAGS "-fvisibility=default")
|
||||
|
||||
SET( libHeaders ${libHeaders}
|
||||
infosystem/infoplugins/mac/adium.h
|
||||
infosystem/infoplugins/mac/adiumplugin.h )
|
||||
|
||||
SET( OS_SPECIFIC_LINK_LIBRARIES
|
||||
${OS_SPECIFIC_LINK_LIBRARIES}
|
||||
# System
|
||||
@@ -694,15 +410,14 @@ ENDIF(LIBLASTFM_FOUND)
|
||||
|
||||
IF(BUILD_GUI)
|
||||
LIST(APPEND libSources ${libGuiSources} )
|
||||
LIST(APPEND libHeaders ${libGuiHeaders} )
|
||||
ENDIF()
|
||||
|
||||
qt4_wrap_ui( libUI_H ${libUI} )
|
||||
qt4_wrap_cpp( libMoc ${libHeaders} )
|
||||
|
||||
SET( libSources ${libSources} ${libUI_H} ${libHeaders_NoMOC} )
|
||||
SET( libSources ${libSources} ${libUI_H} )
|
||||
|
||||
ADD_LIBRARY( tomahawklib SHARED ${libSources} ${libMoc} )
|
||||
ADD_LIBRARY( tomahawklib SHARED ${libSources})
|
||||
set_target_properties(tomahawklib PROPERTIES AUTOMOC TRUE)
|
||||
|
||||
IF(QCA2_FOUND)
|
||||
SET(LINK_LIBRARIES ${LINK_LIBRARIES} ${QCA2_LIBRARIES} )
|
||||
|
47
src/libtomahawk/functimeout.cpp
Normal file
47
src/libtomahawk/functimeout.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Tomahawk is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "functimeout.h"
|
||||
|
||||
#include <QTimer>
|
||||
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
|
||||
FuncTimeout::FuncTimeout( int ms, boost::function< void() > func, QObject* besafe )
|
||||
: m_func( func )
|
||||
, m_watch( QWeakPointer< QObject >( besafe ) )
|
||||
{
|
||||
//qDebug() << Q_FUNC_INFO;
|
||||
QTimer::singleShot( ms, this, SLOT( exec() ) );
|
||||
}
|
||||
|
||||
|
||||
FuncTimeout::~FuncTimeout()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void FuncTimeout::exec()
|
||||
{
|
||||
if( !m_watch.isNull() )
|
||||
m_func();
|
||||
this->deleteLater();
|
||||
}
|
@@ -20,7 +20,6 @@
|
||||
#define FUNCTIMEOUT_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QTimer>
|
||||
#include <QWeakPointer>
|
||||
|
||||
#include "boost/function.hpp"
|
||||
@@ -43,26 +42,12 @@ class DLLEXPORT FuncTimeout : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FuncTimeout( int ms, boost::function<void()> func, QObject* besafe )
|
||||
: m_func( func )
|
||||
, m_watch( QWeakPointer< QObject >( besafe ) )
|
||||
{
|
||||
//qDebug() << Q_FUNC_INFO;
|
||||
QTimer::singleShot( ms, this, SLOT( exec() ) );
|
||||
};
|
||||
FuncTimeout( int ms, boost::function<void()> func, QObject* besafe );
|
||||
|
||||
~FuncTimeout()
|
||||
{
|
||||
//qDebug() << Q_FUNC_INFO;
|
||||
};
|
||||
~FuncTimeout();
|
||||
|
||||
public slots:
|
||||
void exec()
|
||||
{
|
||||
if( !m_watch.isNull() )
|
||||
m_func();
|
||||
this->deleteLater();
|
||||
};
|
||||
void exec();
|
||||
|
||||
private:
|
||||
boost::function<void()> m_func;
|
||||
|
@@ -22,8 +22,9 @@
|
||||
#include "JobStatusItem.h"
|
||||
#include "dllmacro.h"
|
||||
|
||||
#include <QPixmap>
|
||||
|
||||
class QTimer;
|
||||
class QPixmap;
|
||||
|
||||
class DLLEXPORT ErrorStatusMessage : public JobStatusItem
|
||||
{
|
||||
|
@@ -20,6 +20,8 @@
|
||||
|
||||
#include "utils/tomahawkutils.h"
|
||||
|
||||
#include <QPixmap>
|
||||
|
||||
static QPixmap* s_indexIcon = 0;
|
||||
|
||||
|
||||
|
42
src/libtomahawk/jobview/JobStatusItem.cpp
Normal file
42
src/libtomahawk/jobview/JobStatusItem.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Tomahawk is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "JobStatusItem.h"
|
||||
|
||||
|
||||
JobStatusItem::JobStatusItem()
|
||||
: QObject()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
JobStatusItem::~JobStatusItem()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool JobStatusItem::allowMultiLine() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool JobStatusItem::collapseItem() const
|
||||
{
|
||||
return false;
|
||||
}
|
@@ -20,7 +20,8 @@
|
||||
#define JOB_STATUS_ITEM
|
||||
|
||||
#include <QObject>
|
||||
#include <QPixmap>
|
||||
|
||||
class QPixmap;
|
||||
|
||||
/**
|
||||
* Implement your own JobStatusItem if you want to add some sort of job status entry in the JobStatusView.
|
||||
@@ -37,8 +38,8 @@ class JobStatusItem : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit JobStatusItem() : QObject() {}
|
||||
virtual ~JobStatusItem() {}
|
||||
explicit JobStatusItem();
|
||||
virtual ~JobStatusItem();
|
||||
|
||||
virtual QString type() const = 0;
|
||||
|
||||
@@ -52,8 +53,8 @@ public:
|
||||
* instead of showing each individually. In this case, the right column from the item will be ignored
|
||||
* and a count will be shown instead.
|
||||
*/
|
||||
virtual bool collapseItem() const { return false; }
|
||||
virtual bool allowMultiLine() const { return false; }
|
||||
virtual bool collapseItem() const;
|
||||
virtual bool allowMultiLine() const;
|
||||
|
||||
signals:
|
||||
/// Ask for an update
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#include "JobStatusItem.h"
|
||||
#include "utils/logger.h"
|
||||
|
||||
#include <QPixmap>
|
||||
|
||||
JobStatusModel::JobStatusModel( QObject* parent )
|
||||
: QAbstractListModel ( parent )
|
||||
|
@@ -21,7 +21,9 @@
|
||||
|
||||
#include "JobStatusItem.h"
|
||||
#include "typedefs.h"
|
||||
|
||||
#include <QHash>
|
||||
#include <QPixmap>
|
||||
|
||||
class LatchedStatusManager;
|
||||
|
||||
|
@@ -22,6 +22,8 @@
|
||||
#include "jobview/JobStatusItem.h"
|
||||
#include "query.h"
|
||||
|
||||
#include <QPixmap>
|
||||
|
||||
class PipelineStatusItem : public JobStatusItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@@ -21,6 +21,8 @@
|
||||
|
||||
#include "JobStatusItem.h"
|
||||
|
||||
#include <QPixmap>
|
||||
|
||||
class StreamConnection;
|
||||
|
||||
class TransferStatusManager : public QObject
|
||||
|
@@ -28,6 +28,8 @@
|
||||
|
||||
#include "utils/logger.h"
|
||||
|
||||
#include "boost/bind.hpp"
|
||||
|
||||
#define DEFAULT_CONCURRENT_QUERIES 4
|
||||
#define MAX_CONCURRENT_QUERIES 16
|
||||
#define CLEANUP_TIMEOUT 5 * 60 * 1000
|
||||
|
@@ -27,7 +27,8 @@
|
||||
|
||||
#include <QObject>
|
||||
#include <QSet>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QStringList>
|
||||
#include <QPixmap>
|
||||
|
||||
class QNetworkReply;
|
||||
namespace Tomahawk
|
||||
|
106
src/libtomahawk/widgets/animatedcounterlabel.cpp
Normal file
106
src/libtomahawk/widgets/animatedcounterlabel.cpp
Normal file
@@ -0,0 +1,106 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Tomahawk is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "animatedcounterlabel.h"
|
||||
|
||||
|
||||
AnimatedCounterLabel::AnimatedCounterLabel(QWidget* parent, Qt::WindowFlags f)
|
||||
: QLabel( parent, f )
|
||||
, m_displayed( 0 )
|
||||
, m_val( 0 )
|
||||
, m_oldval( 0 )
|
||||
, m_format( "%L1" )
|
||||
{
|
||||
connect( &m_timer, SIGNAL( frameChanged( int ) ), SLOT( frame( int ) ) );
|
||||
connect( &m_timer, SIGNAL( finished() ), SLOT( showDiff() ) );
|
||||
}
|
||||
|
||||
|
||||
void AnimatedCounterLabel::setFormat(const QString& f)
|
||||
{
|
||||
m_format = f;
|
||||
setText( m_format.arg( m_displayed ) );
|
||||
}
|
||||
|
||||
|
||||
void AnimatedCounterLabel::setVisible(bool b)
|
||||
{
|
||||
QLabel::setVisible( b );
|
||||
if ( !m_diff.isNull() )
|
||||
m_diff.data()->setVisible( b );
|
||||
}
|
||||
|
||||
|
||||
void AnimatedCounterLabel::frame(int f)
|
||||
{
|
||||
m_displayed = f;
|
||||
QLabel::setText( m_format.arg( m_displayed ) );
|
||||
QLabel::update();
|
||||
}
|
||||
|
||||
|
||||
void AnimatedCounterLabel::setVal(unsigned int v)
|
||||
{
|
||||
if( v == m_val )
|
||||
return;
|
||||
|
||||
m_oldval = m_val;
|
||||
m_val = v;
|
||||
m_timer.stop();
|
||||
unsigned int dur = 1000;
|
||||
unsigned int r = abs( v - m_oldval );
|
||||
|
||||
if( r > 1000 ) dur = 1500;
|
||||
else if( r > 10000 ) dur = 2000;
|
||||
else if( r > 25000 ) dur = 2250;
|
||||
else if( r > 50000 ) dur = 2750;
|
||||
else if( r > 100000 ) dur = 3000;
|
||||
else if( r > 500000 ) dur = 5000;
|
||||
|
||||
m_timer.setDuration( dur );
|
||||
m_timer.setFrameRange( m_displayed, v );
|
||||
m_timer.setEasingCurve( QEasingCurve( QEasingCurve::OutCubic ) );
|
||||
m_timer.start();
|
||||
}
|
||||
|
||||
|
||||
void AnimatedCounterLabel::showDiff()
|
||||
{
|
||||
int differ = m_val - m_oldval;
|
||||
m_diff = new QLabel( QString("%1 %L2" ).arg( differ > 0 ? "+" : "" )
|
||||
.arg( (int)m_val - (int)m_oldval ),
|
||||
this->parentWidget() );
|
||||
|
||||
m_diff.data()->setStyleSheet( "font-size:9px; color:grey;" );
|
||||
m_diff.data()->move( QPoint( this->pos().x(), this->pos().y() ) );
|
||||
QPropertyAnimation* a = new QPropertyAnimation( m_diff.data(), "pos" );
|
||||
a->setEasingCurve( QEasingCurve( QEasingCurve::InQuad ) );
|
||||
a->setStartValue( m_diff.data()->pos() + QPoint( 0, -10 ) );
|
||||
a->setEndValue( QPoint( m_diff.data()->pos().x(), m_diff.data()->pos().y() - 25 ) );
|
||||
a->setDuration( 1000 );
|
||||
// qDebug() << "ANIMATING DIFF:" << a->startValue() << a->endValue();
|
||||
|
||||
connect( a, SIGNAL( finished() ), m_diff.data(), SLOT( hide() ) );
|
||||
connect( a, SIGNAL( finished() ), m_diff.data(), SLOT( deleteLater() ) );
|
||||
connect( a, SIGNAL( finished() ), a, SLOT( deleteLater() ) );
|
||||
|
||||
m_diff.data()->show();
|
||||
m_diff.data()->setVisible( this->isVisible() );
|
||||
a->start();
|
||||
}
|
@@ -32,86 +32,15 @@ class DLLEXPORT AnimatedCounterLabel : public QLabel
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AnimatedCounterLabel( QWidget* parent = 0, Qt::WindowFlags f = 0 )
|
||||
: QLabel( parent, f )
|
||||
, m_displayed( 0 )
|
||||
, m_val( 0 )
|
||||
, m_oldval( 0 )
|
||||
, m_format( "%L1" )
|
||||
{
|
||||
connect( &m_timer, SIGNAL( frameChanged( int ) ), SLOT( frame( int ) ) );
|
||||
connect( &m_timer, SIGNAL( finished() ), SLOT( showDiff() ) );
|
||||
}
|
||||
explicit AnimatedCounterLabel( QWidget* parent = 0, Qt::WindowFlags f = 0 );
|
||||
|
||||
void setFormat( const QString& f )
|
||||
{
|
||||
m_format = f;
|
||||
setText( m_format.arg( m_displayed ) );
|
||||
}
|
||||
void setFormat( const QString& f );
|
||||
|
||||
public slots:
|
||||
void setVisible( bool b )
|
||||
{
|
||||
QLabel::setVisible( b );
|
||||
if ( !m_diff.isNull() )
|
||||
m_diff.data()->setVisible( b );
|
||||
}
|
||||
|
||||
void frame( int f )
|
||||
{
|
||||
m_displayed = f;
|
||||
QLabel::setText( m_format.arg( m_displayed ) );
|
||||
QLabel::update();
|
||||
}
|
||||
|
||||
void setVal( unsigned int v )
|
||||
{
|
||||
if( v == m_val )
|
||||
return;
|
||||
|
||||
m_oldval = m_val;
|
||||
m_val = v;
|
||||
m_timer.stop();
|
||||
unsigned int dur = 1000;
|
||||
unsigned int r = abs( v - m_oldval );
|
||||
|
||||
if( r > 1000 ) dur = 1500;
|
||||
else if( r > 10000 ) dur = 2000;
|
||||
else if( r > 25000 ) dur = 2250;
|
||||
else if( r > 50000 ) dur = 2750;
|
||||
else if( r > 100000 ) dur = 3000;
|
||||
else if( r > 500000 ) dur = 5000;
|
||||
|
||||
m_timer.setDuration( dur );
|
||||
m_timer.setFrameRange( m_displayed, v );
|
||||
m_timer.setEasingCurve( QEasingCurve( QEasingCurve::OutCubic ) );
|
||||
m_timer.start();
|
||||
}
|
||||
|
||||
void showDiff()
|
||||
{
|
||||
int differ = m_val - m_oldval;
|
||||
m_diff = new QLabel( QString("%1 %L2" ).arg( differ > 0 ? "+" : "" )
|
||||
.arg( (int)m_val - (int)m_oldval ),
|
||||
this->parentWidget() );
|
||||
|
||||
m_diff.data()->setStyleSheet( "font-size:9px; color:grey;" );
|
||||
m_diff.data()->move( QPoint( this->pos().x(), this->pos().y() ) );
|
||||
QPropertyAnimation* a = new QPropertyAnimation( m_diff.data(), "pos" );
|
||||
a->setEasingCurve( QEasingCurve( QEasingCurve::InQuad ) );
|
||||
a->setStartValue( m_diff.data()->pos() + QPoint( 0, -10 ) );
|
||||
a->setEndValue( QPoint( m_diff.data()->pos().x(), m_diff.data()->pos().y() - 25 ) );
|
||||
a->setDuration( 1000 );
|
||||
// qDebug() << "ANIMATING DIFF:" << a->startValue() << a->endValue();
|
||||
|
||||
connect( a, SIGNAL( finished() ), m_diff.data(), SLOT( hide() ) );
|
||||
connect( a, SIGNAL( finished() ), m_diff.data(), SLOT( deleteLater() ) );
|
||||
connect( a, SIGNAL( finished() ), a, SLOT( deleteLater() ) );
|
||||
|
||||
m_diff.data()->show();
|
||||
m_diff.data()->setVisible( this->isVisible() );
|
||||
a->start();
|
||||
}
|
||||
void setVisible( bool b );
|
||||
void frame( int f );
|
||||
void setVal( unsigned int v );
|
||||
void showDiff();
|
||||
|
||||
private:
|
||||
QTimeLine m_timer;
|
||||
|
Reference in New Issue
Block a user