mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-13 20:39:57 +01:00
Merge pull request #399 from tomahawk-player/things
Various download and branding improvements
This commit is contained in:
commit
dc80d19a08
@ -403,7 +403,7 @@ if( WIN32 )
|
||||
endif( WIN32 )
|
||||
|
||||
if( WIN32 OR APPLE )
|
||||
macro_optional_find_package(LibsnoreQt5 0.5.70 QUIET)
|
||||
macro_optional_find_package(LibsnoreQt5 0.6.0 QUIET)
|
||||
macro_log_feature(LibsnoreQt5_FOUND "Libsnore" "Library for notifications" "https://projects.kde.org/projects/playground/libs/snorenotify" FALSE "" "")
|
||||
endif()
|
||||
|
||||
|
@ -18,11 +18,10 @@
|
||||
!ifndef MINGW_ROOT
|
||||
!define MINGW_ROOT "/usr/i686-w64-mingw32/sys-root/mingw"
|
||||
!endif
|
||||
|
||||
!define APPLICATION_NAME "Tomahawk"
|
||||
!define TARGET_NAME "tomahawk"
|
||||
!define APPLICATION_NAME "@CPACK_PACKAGE_NAME@"
|
||||
!define TARGET_NAME "@CPACK_PACKAGE_TARGET_NAME@"
|
||||
;define app id needed for Windows 8 notifications
|
||||
!define AppUserModelId @TOMAHAWK_APPLICATION_PACKAGE_NAME@
|
||||
!define AppUserModelId "@TOMAHAWK_APPLICATION_PACKAGE_NAME@"
|
||||
|
||||
!define MINGW_BIN "${MINGW_ROOT}/bin"
|
||||
!define MINGW_LIB "${MINGW_ROOT}/lib"
|
||||
|
@ -13,7 +13,9 @@ SET( CPACK_PACKAGE_DESCRIPTION_SUMMARY ${TOMAHAWK_DESCRIPTION_SUMMARY} ) # Des
|
||||
SET( CPACK_PACKAGE_INSTALL_DIRECTORY ${TOMAHAWK_APPLICATION_NAME} ) # Installation directory on the target system -> C:\Program Files\fellody
|
||||
SET( CPACK_PACKAGE_INSTALL_REGISTRY_KEY ${TOMAHAWK_APPLICATION_NAME} ) # Registry key used when installing this project CMake 2.5.0
|
||||
SET( CPACK_PACKAGE_NAME ${TOMAHAWK_APPLICATION_NAME} ) # Package name, defaults to the project name
|
||||
SET( CPACK_PACKAGE_TARGET_NAME ${TOMAHAWK_TARGET_NAME} ) # Used to build library and executable names
|
||||
SET( CPACK_PACKAGE_VENDOR ${TOMAHAWK_ORGANIZATION_NAME} ) # Package vendor name
|
||||
SET( TOMAHAWK_APPLICATION_PACKAGE_NAME ${TOMAHAWK_APPLICATION_PACKAGE_NAME} )
|
||||
SET( CPACK_PACKAGE_VERSION_MAJOR ${TOMAHAWK_VERSION_MAJOR} )
|
||||
SET( CPACK_PACKAGE_VERSION_MINOR ${TOMAHAWK_VERSION_MINOR} )
|
||||
SET( CPACK_PACKAGE_VERSION_PATCH ${TOMAHAWK_VERSION_PATCH} )
|
||||
|
@ -24,13 +24,6 @@ include_directories(
|
||||
|
||||
add_definitions(-D_WEBSOCKETPP_CPP11_STL_)
|
||||
|
||||
if(APPLE)
|
||||
# http://stackoverflow.com/questions/7226753/osx-lion-xcode-4-1-how-do-i-setup-a-c0x-project/7236451#7236451
|
||||
add_definitions(-std=c++11 -stdlib=libc++ -U__STRICT_ANSI__)
|
||||
set(PLATFORM_SPECIFIC_LINK_LIBRARIES "/usr/lib/libc++.dylib")
|
||||
else()
|
||||
add_definitions(-std=c++0x)
|
||||
endif()
|
||||
|
||||
tomahawk_add_plugin(hatchet
|
||||
TYPE account
|
||||
|
@ -418,7 +418,7 @@ include_directories(
|
||||
${Boost_INCLUDE_DIR}
|
||||
|
||||
${LIBPORTFWD_INCLUDE_DIR}
|
||||
${QUAZIP_INCLUDE_DIR}
|
||||
${QUAZIP_INCLUDE_DIRS}
|
||||
${QTKEYCHAIN_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
|
@ -132,6 +132,8 @@ Result::deleteLater()
|
||||
void
|
||||
Result::onResolverRemoved( Tomahawk::Resolver* resolver )
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
if ( m_resolver.data() == resolver )
|
||||
{
|
||||
m_resolver = 0;
|
||||
@ -143,6 +145,8 @@ Result::onResolverRemoved( Tomahawk::Resolver* resolver )
|
||||
collection_ptr
|
||||
Result::resolvedByCollection() const
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
return m_collection;
|
||||
}
|
||||
|
||||
@ -150,6 +154,8 @@ Result::resolvedByCollection() const
|
||||
QString
|
||||
Result::url() const
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
return m_url;
|
||||
}
|
||||
|
||||
@ -157,6 +163,8 @@ Result::url() const
|
||||
bool
|
||||
Result::checked() const
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
return m_checked;
|
||||
}
|
||||
|
||||
@ -164,6 +172,8 @@ Result::checked() const
|
||||
bool
|
||||
Result::isPreview() const
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
return m_isPreview;
|
||||
}
|
||||
|
||||
@ -171,6 +181,8 @@ Result::isPreview() const
|
||||
QString
|
||||
Result::mimetype() const
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
return m_mimetype;
|
||||
}
|
||||
|
||||
@ -178,6 +190,8 @@ Result::mimetype() const
|
||||
RID
|
||||
Result::id() const
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
if ( m_rid.isEmpty() )
|
||||
m_rid = uuid();
|
||||
|
||||
@ -194,6 +208,8 @@ Result::isOnline() const
|
||||
}
|
||||
else
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
return !m_resolver.isNull();
|
||||
}
|
||||
}
|
||||
@ -214,24 +230,26 @@ Result::playable() const
|
||||
QVariant
|
||||
Result::toVariant() const
|
||||
{
|
||||
track_ptr t = track();
|
||||
|
||||
QVariantMap m;
|
||||
m.insert( "artist", m_track->artist() );
|
||||
m.insert( "album", m_track->album() );
|
||||
m.insert( "track", m_track->track() );
|
||||
m.insert( "artist", t->artist() );
|
||||
m.insert( "album", t->album() );
|
||||
m.insert( "track", t->track() );
|
||||
m.insert( "source", friendlySource() );
|
||||
m.insert( "mimetype", mimetype() );
|
||||
m.insert( "size", size() );
|
||||
m.insert( "bitrate", bitrate() );
|
||||
m.insert( "duration", m_track->duration() );
|
||||
m.insert( "duration", t->duration() );
|
||||
// m.insert( "score", score() );
|
||||
m.insert( "sid", id() );
|
||||
m.insert( "discnumber", m_track->discnumber() );
|
||||
m.insert( "albumpos", m_track->albumpos() );
|
||||
m.insert( "discnumber", t->discnumber() );
|
||||
m.insert( "albumpos", t->albumpos() );
|
||||
m.insert( "preview", isPreview() );
|
||||
m.insert( "purchaseUrl", purchaseUrl() );
|
||||
|
||||
if ( !m_track->composer().isEmpty() )
|
||||
m.insert( "composer", m_track->composer() );
|
||||
if ( !t->composer().isEmpty() )
|
||||
m.insert( "composer", t->composer() );
|
||||
|
||||
return m;
|
||||
}
|
||||
@ -240,20 +258,25 @@ Result::toVariant() const
|
||||
QString
|
||||
Result::toString() const
|
||||
{
|
||||
if ( m_track )
|
||||
m_mutex.lock();
|
||||
track_ptr track = m_track;
|
||||
QString url = m_url;
|
||||
m_mutex.unlock();
|
||||
|
||||
if ( track )
|
||||
{
|
||||
return QString( "Result(%1) %2 - %3%4 (%5)" )
|
||||
.arg( id() )
|
||||
.arg( m_track->artist() )
|
||||
.arg( m_track->track() )
|
||||
.arg( m_track->album().isEmpty() ? QString() : QString( " on %1" ).arg( m_track->album() ) )
|
||||
.arg( m_url );
|
||||
.arg( track->artist() )
|
||||
.arg( track->track() )
|
||||
.arg( track->album().isEmpty() ? QString() : QString( " on %1" ).arg( track->album() ) )
|
||||
.arg( url );
|
||||
}
|
||||
else
|
||||
{
|
||||
return QString( "Result(%1) (%2)" )
|
||||
.arg( id() )
|
||||
.arg( m_url );
|
||||
.arg( url );
|
||||
}
|
||||
}
|
||||
|
||||
@ -261,6 +284,8 @@ Result::toString() const
|
||||
Tomahawk::query_ptr
|
||||
Result::toQuery()
|
||||
{
|
||||
QMutexLocker l( &m_mutex );
|
||||
|
||||
if ( m_query.isNull() )
|
||||
{
|
||||
query_ptr query = Tomahawk::Query::get( m_track );
|
||||
@ -270,12 +295,15 @@ Result::toQuery()
|
||||
m_query = query->weakRef();
|
||||
|
||||
QList<Tomahawk::result_ptr> rl;
|
||||
rl << weakRef().toStrongRef();
|
||||
rl << m_ownRef.toStrongRef();
|
||||
m_mutex.unlock();
|
||||
query->addResults( rl );
|
||||
m_mutex.lock();
|
||||
query->setResolveFinished( true );
|
||||
return query;
|
||||
}
|
||||
|
||||
|
||||
return m_query.toStrongRef();
|
||||
}
|
||||
|
||||
@ -297,7 +325,10 @@ Result::onOffline()
|
||||
void
|
||||
Result::setResolvedByCollection( const Tomahawk::collection_ptr& collection , bool emitOnlineEvents )
|
||||
{
|
||||
m_mutex.lock();
|
||||
m_collection = collection;
|
||||
m_mutex.unlock();
|
||||
|
||||
if ( emitOnlineEvents )
|
||||
{
|
||||
Q_ASSERT( !collection.isNull() );
|
||||
@ -311,6 +342,8 @@ Result::setResolvedByCollection( const Tomahawk::collection_ptr& collection , bo
|
||||
void
|
||||
Result::setFriendlySource( const QString& s )
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
m_friendlySource = s;
|
||||
}
|
||||
|
||||
@ -318,6 +351,8 @@ Result::setFriendlySource( const QString& s )
|
||||
void
|
||||
Result::setPreview( bool isPreview )
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
m_isPreview = isPreview;
|
||||
}
|
||||
|
||||
@ -325,6 +360,8 @@ Result::setPreview( bool isPreview )
|
||||
void
|
||||
Result::setPurchaseUrl( const QString& u )
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
m_purchaseUrl = u;
|
||||
}
|
||||
|
||||
@ -332,6 +369,8 @@ Result::setPurchaseUrl( const QString& u )
|
||||
void
|
||||
Result::setLinkUrl( const QString& u )
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
m_linkUrl = u;
|
||||
}
|
||||
|
||||
@ -339,6 +378,8 @@ Result::setLinkUrl( const QString& u )
|
||||
void
|
||||
Result::setChecked( bool checked )
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
m_checked = checked;
|
||||
}
|
||||
|
||||
@ -346,6 +387,8 @@ Result::setChecked( bool checked )
|
||||
void
|
||||
Result::setMimetype( const QString& mimetype )
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
m_mimetype = mimetype;
|
||||
}
|
||||
|
||||
@ -353,6 +396,8 @@ Result::setMimetype( const QString& mimetype )
|
||||
void
|
||||
Result::setBitrate( unsigned int bitrate )
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
m_bitrate = bitrate;
|
||||
}
|
||||
|
||||
@ -360,6 +405,8 @@ Result::setBitrate( unsigned int bitrate )
|
||||
void
|
||||
Result::setSize( unsigned int size )
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
m_size = size;
|
||||
}
|
||||
|
||||
@ -367,6 +414,8 @@ Result::setSize( unsigned int size )
|
||||
void
|
||||
Result::setModificationTime( unsigned int modtime )
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
m_modtime = modtime;
|
||||
}
|
||||
|
||||
@ -374,6 +423,8 @@ Result::setModificationTime( unsigned int modtime )
|
||||
void
|
||||
Result::setTrack( const track_ptr& track )
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
m_track = track;
|
||||
}
|
||||
|
||||
@ -381,6 +432,8 @@ Result::setTrack( const track_ptr& track )
|
||||
unsigned int
|
||||
Result::fileId() const
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
return m_fileId;
|
||||
}
|
||||
|
||||
@ -390,6 +443,8 @@ Result::friendlySource() const
|
||||
{
|
||||
if ( resolvedByCollection().isNull() )
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
return m_friendlySource;
|
||||
}
|
||||
else
|
||||
@ -400,6 +455,8 @@ Result::friendlySource() const
|
||||
QString
|
||||
Result::purchaseUrl() const
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
return m_purchaseUrl;
|
||||
}
|
||||
|
||||
@ -407,6 +464,8 @@ Result::purchaseUrl() const
|
||||
QString
|
||||
Result::linkUrl() const
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
return m_linkUrl;
|
||||
}
|
||||
|
||||
@ -416,6 +475,8 @@ Result::sourceIcon( TomahawkUtils::ImageMode style, const QSize& desiredSize ) c
|
||||
{
|
||||
if ( resolvedByCollection().isNull() )
|
||||
{
|
||||
//QMutexLocker lock( &m_mutex );
|
||||
|
||||
const ExternalResolver* resolver = qobject_cast< ExternalResolver* >( m_resolver.data() );
|
||||
if ( !resolver )
|
||||
{
|
||||
@ -466,6 +527,8 @@ Result::sourceIcon( TomahawkUtils::ImageMode style, const QSize& desiredSize ) c
|
||||
unsigned int
|
||||
Result::bitrate() const
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
return m_bitrate;
|
||||
}
|
||||
|
||||
@ -473,6 +536,8 @@ Result::bitrate() const
|
||||
unsigned int
|
||||
Result::size() const
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
return m_size;
|
||||
}
|
||||
|
||||
@ -480,6 +545,8 @@ Result::size() const
|
||||
unsigned int
|
||||
Result::modificationTime() const
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
return m_modtime;
|
||||
}
|
||||
|
||||
@ -487,6 +554,8 @@ Result::modificationTime() const
|
||||
void
|
||||
Result::setFileId( unsigned int id )
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
m_fileId = id;
|
||||
}
|
||||
|
||||
@ -494,6 +563,8 @@ Result::setFileId( unsigned int id )
|
||||
Tomahawk::Resolver*
|
||||
Result::resolvedBy() const
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
if ( !m_collection.isNull() )
|
||||
return m_collection.data();
|
||||
|
||||
@ -504,12 +575,16 @@ Result::resolvedBy() const
|
||||
void
|
||||
Result::setResolvedByResolver( Tomahawk::Resolver* resolver )
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
m_resolver = QPointer< Tomahawk::Resolver >( resolver );
|
||||
}
|
||||
|
||||
|
||||
QPointer< Resolver > Result::resolvedByResolver() const
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
return m_resolver;
|
||||
}
|
||||
|
||||
@ -525,6 +600,8 @@ Result::doneEditing()
|
||||
track_ptr
|
||||
Result::track() const
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
return m_track;
|
||||
}
|
||||
|
||||
@ -532,7 +609,7 @@ Result::track() const
|
||||
QList< DownloadFormat >
|
||||
Result::downloadFormats() const
|
||||
{
|
||||
QMutexLocker lock( &s_mutex );
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
return m_formats;
|
||||
}
|
||||
@ -544,7 +621,7 @@ Result::setDownloadFormats( const QList<DownloadFormat>& formats )
|
||||
if ( formats.isEmpty() )
|
||||
return;
|
||||
|
||||
QMutexLocker lock( &s_mutex );
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
m_formats.clear();
|
||||
foreach ( const DownloadFormat& format, formats )
|
||||
@ -610,6 +687,8 @@ Result::onDownloadJobStateChanged( DownloadJob::TrackState newState, DownloadJob
|
||||
QWeakPointer<Result>
|
||||
Result::weakRef()
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
return m_ownRef;
|
||||
}
|
||||
|
||||
@ -617,5 +696,7 @@ Result::weakRef()
|
||||
void
|
||||
Result::setWeakRef( QWeakPointer<Result> weakRef )
|
||||
{
|
||||
QMutexLocker lock( &m_mutex );
|
||||
|
||||
m_ownRef = weakRef;
|
||||
}
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <QPixmap>
|
||||
#include <QPointer>
|
||||
#include <QVariant>
|
||||
#include <QMutex>
|
||||
|
||||
class MetadataEditor;
|
||||
|
||||
@ -161,6 +162,8 @@ private:
|
||||
explicit Result( const QString& url, const Tomahawk::track_ptr& track );
|
||||
explicit Result();
|
||||
|
||||
mutable QMutex m_mutex;
|
||||
|
||||
mutable RID m_rid;
|
||||
collection_wptr m_collection;
|
||||
QPointer< Tomahawk::Resolver > m_resolver;
|
||||
|
@ -79,7 +79,7 @@ ResolverAccountFactory::createFromPath( const QString& path )
|
||||
}
|
||||
|
||||
|
||||
Account*
|
||||
ResolverAccount*
|
||||
ResolverAccountFactory::createFromPath( const QString& path, const QString& factory, bool isAttica )
|
||||
{
|
||||
qDebug() << "Creating ResolverAccount from path:" << path << "is attica" << isAttica;
|
||||
@ -110,57 +110,8 @@ ResolverAccountFactory::createFromPath( const QString& path, const QString& fact
|
||||
|
||||
if ( pathInfo.suffix() == "axe" )
|
||||
{
|
||||
QString uniqueName = uuid();
|
||||
QDir dir( TomahawkUtils::extractScriptPayload( pathInfo.filePath(),
|
||||
uniqueName,
|
||||
MANUALRESOLVERS_DIR ) );
|
||||
if ( !( dir.exists() && dir.isReadable() ) ) //decompression fubar
|
||||
if ( !installAxe( realPath, configuration ) )
|
||||
{
|
||||
displayError( tr( "Resolver installation error: cannot open bundle." ) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( !dir.cd( "content" ) ) //more fubar
|
||||
{
|
||||
displayError( tr( "Resolver installation error: incomplete bundle." ) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
QString metadataFilePath = dir.absoluteFilePath( "metadata.json" );
|
||||
configuration = metadataFromJsonFile( metadataFilePath );
|
||||
|
||||
configuration[ "bundleDir" ] = uniqueName;
|
||||
|
||||
if ( !configuration[ "pluginName" ].isNull() && !configuration[ "pluginName" ].toString().isEmpty() )
|
||||
{
|
||||
dir.cdUp();
|
||||
if ( !dir.cdUp() ) //we're in MANUALRESOLVERS_DIR
|
||||
return 0;
|
||||
|
||||
QString name = configuration[ "pluginName" ].toString();
|
||||
|
||||
QString namePath = dir.absoluteFilePath( name );
|
||||
QFileInfo npI( namePath );
|
||||
|
||||
if ( npI.exists() && npI.isDir() )
|
||||
{
|
||||
TomahawkUtils::removeDirectory( namePath );
|
||||
}
|
||||
|
||||
dir.rename( uniqueName, name );
|
||||
|
||||
configuration[ "bundleDir" ] = name;
|
||||
|
||||
if ( !dir.cd( QString( "%1/content" ).arg( name ) ) ) //should work if it worked once
|
||||
return 0;
|
||||
}
|
||||
|
||||
expandPaths( dir, configuration );
|
||||
|
||||
realPath = configuration[ "path" ].toString();
|
||||
if ( realPath.isEmpty() )
|
||||
{
|
||||
displayError( tr( "Resolver installation error: bad metadata in bundle." ) );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -221,6 +172,71 @@ ResolverAccountFactory::createFromPath( const QString& path, const QString& fact
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
ResolverAccountFactory::installAxe( QString& realPath, QVariantHash& configuration )
|
||||
{
|
||||
const QFileInfo pathInfo( realPath );
|
||||
QString uniqueName = uuid();
|
||||
QDir dir( TomahawkUtils::extractScriptPayload( pathInfo.filePath(),
|
||||
uniqueName,
|
||||
MANUALRESOLVERS_DIR ) );
|
||||
if ( !( dir.exists() && dir.isReadable() ) ) //decompression fubar
|
||||
{
|
||||
JobStatusView::instance()->model()->addJob( new ErrorStatusMessage(
|
||||
tr( "Resolver installation error: cannot open bundle." ) ) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( !dir.cd( "content" ) ) //more fubar
|
||||
{
|
||||
JobStatusView::instance()->model()->addJob( new ErrorStatusMessage(
|
||||
tr( "Resolver installation error: incomplete bundle." ) ) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
QString metadataFilePath = dir.absoluteFilePath( "metadata.json" );
|
||||
configuration = metadataFromJsonFile( metadataFilePath );
|
||||
|
||||
configuration[ "bundleDir" ] = uniqueName;
|
||||
|
||||
if ( !configuration[ "pluginName" ].isNull() && !configuration[ "pluginName" ].toString().isEmpty() )
|
||||
{
|
||||
dir.cdUp();
|
||||
if ( !dir.cdUp() ) //we're in MANUALRESOLVERS_DIR
|
||||
return 0;
|
||||
|
||||
QString name = configuration[ "pluginName" ].toString();
|
||||
|
||||
QString namePath = dir.absoluteFilePath( name );
|
||||
QFileInfo npI( namePath );
|
||||
|
||||
if ( npI.exists() && npI.isDir() )
|
||||
{
|
||||
TomahawkUtils::removeDirectory( namePath );
|
||||
}
|
||||
|
||||
dir.rename( uniqueName, name );
|
||||
|
||||
configuration[ "bundleDir" ] = name;
|
||||
|
||||
if ( !dir.cd( QString( "%1/content" ).arg( name ) ) ) //should work if it worked once
|
||||
return 0;
|
||||
}
|
||||
|
||||
expandPaths( dir, configuration );
|
||||
|
||||
realPath = configuration[ "path" ].toString();
|
||||
if ( realPath.isEmpty() )
|
||||
{
|
||||
JobStatusView::instance()->model()->addJob( new ErrorStatusMessage(
|
||||
tr( "Resolver installation error: bad metadata in bundle." ) ) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
QVariantHash
|
||||
ResolverAccountFactory::metadataFromJsonFile( const QString& path )
|
||||
{
|
||||
|
@ -33,6 +33,8 @@ class ExternalResolverGui;
|
||||
|
||||
namespace Accounts {
|
||||
|
||||
class ResolverAccount;
|
||||
|
||||
class DLLEXPORT ResolverAccountFactory : public AccountFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -53,7 +55,10 @@ public:
|
||||
Account* createFromPath( const QString& path ) override;
|
||||
|
||||
// Internal use
|
||||
static Account* createFromPath( const QString& path, const QString& factoryId, bool isAttica );
|
||||
static ResolverAccount* createFromPath( const QString& path, const QString& factoryId, bool isAttica );
|
||||
// YES, non const parameters!
|
||||
static bool installAxe( QString& realPath, QVariantHash& configuration );
|
||||
|
||||
|
||||
private:
|
||||
static void displayError( const QString& error );
|
||||
|
@ -118,6 +118,10 @@ ColumnView::setModel( QAbstractItemModel* model )
|
||||
void
|
||||
ColumnView::setTreeModel( TreeModel* model )
|
||||
{
|
||||
// HACK: without setting a new preview widget, the old preview widget is shown in the first column while loading the artists.
|
||||
m_previewWidget = new ColumnViewPreviewWidget( this );
|
||||
setPreviewWidget( m_previewWidget );
|
||||
|
||||
m_model = model;
|
||||
|
||||
if ( m_proxyModel )
|
||||
|
@ -96,8 +96,10 @@ ContextView::ContextView( QWidget* parent, const QString& caption )
|
||||
|
||||
connect( m_captionLabel, SIGNAL( clicked() ), SIGNAL( closeClicked() ) );
|
||||
connect( m_trackView, SIGNAL( querySelected( Tomahawk::query_ptr ) ), SLOT( onQuerySelected( Tomahawk::query_ptr ) ) );
|
||||
connect( m_trackView, SIGNAL( querySelected( Tomahawk::query_ptr ) ), m_detailView, SLOT( setQuery( Tomahawk::query_ptr ) ) );
|
||||
connect( m_trackView, SIGNAL( modelChanged() ), SLOT( onModelChanged() ) );
|
||||
connect( m_trackView, SIGNAL( querySelected( Tomahawk::query_ptr ) ), m_detailView, SLOT( setQuery( Tomahawk::query_ptr ) ) );
|
||||
connect( m_detailView, SIGNAL( downloadAll() ), SLOT( onDownloadAll() ) );
|
||||
connect( m_detailView, SIGNAL( downloadCancel() ), SLOT( onDownloadCancel() ) );
|
||||
|
||||
TomahawkUtils::fixMargins( this );
|
||||
}
|
||||
|
@ -20,11 +20,15 @@
|
||||
#include "GridItemDelegate.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDesktopServices>
|
||||
#include <QPainter>
|
||||
#include <QAbstractItemView>
|
||||
#include <QMouseEvent>
|
||||
#include <QTimeLine>
|
||||
|
||||
#include "DownloadManager.h"
|
||||
#include "DownloadJob.h"
|
||||
|
||||
#include "Artist.h"
|
||||
#include "Query.h"
|
||||
#include "Result.h"
|
||||
@ -35,12 +39,14 @@
|
||||
#include "playlist/PlayableItem.h"
|
||||
#include "playlist/PlayableProxyModel.h"
|
||||
#include "widgets/HoverControls.h"
|
||||
#include "widgets/DropDownButton.h"
|
||||
#include "widgets/ImageButton.h"
|
||||
#include "utils/TomahawkStyle.h"
|
||||
#include "utils/TomahawkUtilsGui.h"
|
||||
#include "utils/PixmapDelegateFader.h"
|
||||
#include "utils/Closure.h"
|
||||
#include "utils/AnimatedSpinner.h"
|
||||
#include "utils/WebPopup.h"
|
||||
#include "utils/DpiScaler.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
@ -55,6 +61,7 @@ GridItemDelegate::GridItemDelegate( QAbstractItemView* parent, PlayableProxyMode
|
||||
, m_model( proxy )
|
||||
, m_itemWidth( 0 )
|
||||
, m_showPosition( false )
|
||||
, m_showBuyButtons( false )
|
||||
, m_wordWrapping( false )
|
||||
, m_margin( TomahawkUtils::DpiScaler::scaledY( parent, 32 ) )
|
||||
{
|
||||
@ -93,7 +100,8 @@ GridItemDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelInde
|
||||
if ( !m_wordWrapping )
|
||||
return QSize( m_itemWidth, m_itemWidth + fm.height() + m_margin * 0.8 );
|
||||
|
||||
return QSize( m_itemWidth, m_itemWidth + fm.height() + fms.height() + m_margin * 0.8 );
|
||||
const int buyButtonHeight = m_showBuyButtons ? 40 : 0;
|
||||
return QSize( m_itemWidth, m_itemWidth + fm.height() + fms.height() + buyButtonHeight + m_margin * 0.8 );
|
||||
}
|
||||
}
|
||||
|
||||
@ -275,6 +283,11 @@ GridItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
||||
painter->setFont( f );
|
||||
}
|
||||
|
||||
if ( m_showBuyButtons && !item->query().isNull() )
|
||||
{
|
||||
textRect.adjust( 0, 0, 0, -40 );
|
||||
}
|
||||
|
||||
to.setAlignment( Qt::AlignLeft | Qt::AlignTop );
|
||||
text = painter->fontMetrics().elidedText( top, Qt::ElideRight, textRect.width() - m_margin / 4 );
|
||||
painter->drawText( textRect, text, to );
|
||||
@ -286,6 +299,7 @@ GridItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
||||
}
|
||||
painter->restore();
|
||||
|
||||
painter->save();
|
||||
painter->setOpacity( 0.6 );
|
||||
painter->setFont( m_smallFont );
|
||||
|
||||
@ -304,6 +318,48 @@ GridItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
||||
|
||||
// Calculate rect of artist on-hover button click area
|
||||
m_artistNameRects[ index ] = painter->fontMetrics().boundingRect( textRect, Qt::AlignLeft | Qt::AlignBottom, text );
|
||||
painter->restore();
|
||||
|
||||
if ( m_showBuyButtons && !item->query().isNull() )
|
||||
{
|
||||
QRect r = textRect;
|
||||
r.setY( textRect.y() + textRect.height() + 8 );
|
||||
r.setHeight( 32 );
|
||||
m_buyButtonRects[ index ] = r;
|
||||
|
||||
QString text;
|
||||
if ( item->result() &&
|
||||
( ( !item->result()->downloadFormats().isEmpty() && !DownloadManager::instance()->localFileForDownload( item->result()->downloadFormats().first().url.toString() ).isEmpty() ) ||
|
||||
( item->result()->downloadJob() && item->result()->downloadJob()->state() == DownloadJob::Finished ) ) )
|
||||
{
|
||||
text = tr( "View in Finder" );
|
||||
}
|
||||
else if ( item->query() && item->query()->numResults( true ) && !item->query()->results().first()->downloadFormats().isEmpty() )
|
||||
{
|
||||
text = tr( "Download %1" ).arg( item->query()->results().first()->downloadFormats().first().extension.toUpper() );
|
||||
}
|
||||
else if ( item->query()->numResults( true ) && !item->query()->results().first()->purchaseUrl().isEmpty() )
|
||||
{
|
||||
text = tr( "Buy" );
|
||||
}
|
||||
|
||||
if ( !item->result() || !item->result()->downloadJob() )
|
||||
{
|
||||
if ( !text.isEmpty() )
|
||||
DropDownButton::drawPrimitive( painter, r, text, m_hoveringOverBuyButton == index, false );
|
||||
}
|
||||
else
|
||||
{
|
||||
painter->setPen( TomahawkStyle::PLAYLIST_PROGRESS_FOREGROUND.darker() );
|
||||
painter->setBrush( TomahawkStyle::PLAYLIST_PROGRESS_BACKGROUND );
|
||||
painter->drawRect( r.adjusted( 2, 2, -2, -2 ) );
|
||||
painter->setPen( TomahawkStyle::PLAYLIST_PROGRESS_FOREGROUND );
|
||||
painter->setBrush( TomahawkStyle::PLAYLIST_PROGRESS_FOREGROUND );
|
||||
QRect fillp = r.adjusted( 3, 3, -3, -3 );
|
||||
fillp.setWidth( float(fillp.width()) * ( float(item->result()->downloadJob()->progressPercentage()) / 100.0 ) );
|
||||
painter->drawRect( fillp );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
painter->restore();
|
||||
@ -362,6 +418,7 @@ GridItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, const Q
|
||||
const QMouseEvent* ev = static_cast< QMouseEvent* >( event );
|
||||
bool hoveringArtist = false;
|
||||
bool hoveringAlbum = false;
|
||||
bool hoveringBuyButton = false;
|
||||
if ( m_artistNameRects.contains( index ) )
|
||||
{
|
||||
const QRect artistNameRect = m_artistNameRects[ index ];
|
||||
@ -372,6 +429,11 @@ GridItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, const Q
|
||||
const QRect albumNameRect = m_albumNameRects[ index ];
|
||||
hoveringAlbum = albumNameRect.contains( ev->pos() );
|
||||
}
|
||||
if ( m_buyButtonRects.contains( index ) )
|
||||
{
|
||||
const QRect buyButtonRect = m_buyButtonRects[ index ];
|
||||
hoveringBuyButton = buyButtonRect.contains( ev->pos() );
|
||||
}
|
||||
|
||||
QRect coverRect = m_view->visualRect( index );
|
||||
coverRect.setHeight( coverRect.width() );
|
||||
@ -379,7 +441,7 @@ GridItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, const Q
|
||||
|
||||
if ( event->type() == QEvent::MouseMove )
|
||||
{
|
||||
if ( hoveringArtist || hoveringAlbum )
|
||||
if ( hoveringArtist || hoveringAlbum || hoveringBuyButton )
|
||||
m_view->setCursor( Qt::PointingHandCursor );
|
||||
else
|
||||
m_view->setCursor( Qt::ArrowCursor );
|
||||
@ -435,6 +497,17 @@ GridItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, const Q
|
||||
|
||||
emit updateIndex( index );
|
||||
}
|
||||
if ( m_hoveringOverBuyButton != index || ( !hoveringBuyButton && m_hoveringOverBuyButton.isValid() ) )
|
||||
{
|
||||
emit updateIndex( m_hoveringOverBuyButton );
|
||||
|
||||
if ( hoveringBuyButton )
|
||||
m_hoveringOverBuyButton = index;
|
||||
else
|
||||
m_hoveringOverBuyButton = QPersistentModelIndex();
|
||||
|
||||
emit updateIndex( index );
|
||||
}
|
||||
|
||||
if ( m_hoverIndex != index || !hoveringCover )
|
||||
{
|
||||
@ -544,6 +617,27 @@ GridItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, const Q
|
||||
}
|
||||
}
|
||||
|
||||
if ( hoveringBuyButton )
|
||||
{
|
||||
if ( event->type() == QEvent::MouseButtonRelease )
|
||||
{
|
||||
PlayableItem* item = m_model->sourceModel()->itemFromIndex( m_model->mapToSource( index ) );
|
||||
if ( !item )
|
||||
return false;
|
||||
|
||||
if ( item->query() && item->query()->numResults( true ) && !item->query()->results().first()->downloadFormats().isEmpty() )
|
||||
{
|
||||
m_view->edit( index );
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
WebPopup* popup = new WebPopup( item->query()->results().first()->purchaseUrl(), QSize( 400, 800 ) );
|
||||
connect( item->query()->results().first().data(), SIGNAL( destroyed() ), popup, SLOT( close() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -555,6 +649,7 @@ GridItemDelegate::modelChanged()
|
||||
m_albumNameRects.clear();
|
||||
m_hoveringOverArtist = QPersistentModelIndex();
|
||||
m_hoveringOverAlbum = QPersistentModelIndex();
|
||||
m_hoveringOverBuyButton = QPersistentModelIndex();
|
||||
m_hoverIndex = QPersistentModelIndex();
|
||||
|
||||
clearButtons();
|
||||
@ -687,6 +782,10 @@ GridItemDelegate::resetHoverIndex()
|
||||
idx = m_hoveringOverAlbum;
|
||||
m_hoveringOverAlbum = QPersistentModelIndex();
|
||||
doUpdateIndex( idx );
|
||||
|
||||
idx = m_hoveringOverBuyButton;
|
||||
m_hoveringOverBuyButton = QPersistentModelIndex();
|
||||
doUpdateIndex( idx );
|
||||
}
|
||||
|
||||
|
||||
@ -758,3 +857,97 @@ GridItemDelegate::eventFilter( QObject* obj, QEvent* event )
|
||||
else
|
||||
return QObject::eventFilter( obj, event );
|
||||
}
|
||||
|
||||
|
||||
QWidget*
|
||||
GridItemDelegate::createEditor( QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index ) const
|
||||
{
|
||||
PlayableItem* item = m_model->itemFromIndex( m_model->mapToSource( index ) );
|
||||
Q_ASSERT( item );
|
||||
|
||||
if ( item->result() && !item->result()->downloadFormats().isEmpty() &&
|
||||
!DownloadManager::instance()->localFileForDownload( item->result()->downloadFormats().first().url.toString() ).isEmpty() )
|
||||
{
|
||||
QDesktopServices::openUrl( QUrl::fromLocalFile( QFileInfo( DownloadManager::instance()->localFileForDownload( item->result()->downloadFormats().first().url.toString() ) ).absolutePath() ) );
|
||||
}
|
||||
else if ( item->result() && item->result()->downloadJob() && item->result()->downloadJob()->state() == DownloadJob::Finished )
|
||||
{
|
||||
QDesktopServices::openUrl( QUrl::fromLocalFile( QFileInfo( item->result()->downloadJob()->localFile() ).absolutePath() ) );
|
||||
}
|
||||
else if ( item->result() &&
|
||||
!item->result()->downloadFormats().isEmpty() && !item->result()->downloadJob() )
|
||||
{
|
||||
QStringList formats;
|
||||
foreach ( const DownloadFormat& format, item->result()->downloadFormats() )
|
||||
{
|
||||
formats << tr( "Download %1" ).arg( format.extension.toUpper() );
|
||||
}
|
||||
|
||||
DropDownButton* editor = new DropDownButton( parent );
|
||||
editor->addItems( formats );
|
||||
|
||||
NewClosure( editor, SIGNAL( clicked() ),
|
||||
const_cast<GridItemDelegate*>(this), SLOT( addDownloadJob( const QModelIndex&, QWidget* ) ), index, (QWidget*)editor );
|
||||
|
||||
NewClosure( editor, SIGNAL( activated( int ) ),
|
||||
const_cast<GridItemDelegate*>(this), SLOT( addDownloadJob( const QModelIndex&, QWidget* ) ), index, (QWidget*)editor );
|
||||
return editor;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
GridItemDelegate::addDownloadJob( const QModelIndex& index, QWidget* editor )
|
||||
{
|
||||
PlayableItem* item = m_model->itemFromIndex( m_model->mapToSource( index ) );
|
||||
Q_ASSERT( item );
|
||||
|
||||
m_view->closePersistentEditor( index );
|
||||
|
||||
DropDownButton* cb = static_cast< DropDownButton* >(editor);
|
||||
if ( !item->result()->downloadFormats().isEmpty() )
|
||||
DownloadManager::instance()->addJob( item->result()->toDownloadJob( item->result()->downloadFormats().at( cb->currentIndex() ) ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
GridItemDelegate::closeEditor( const QModelIndex& index, QWidget* editor )
|
||||
{
|
||||
PlayableItem* item = m_model->itemFromIndex( m_model->mapToSource( index ) );
|
||||
Q_ASSERT( item );
|
||||
|
||||
m_view->closePersistentEditor( index );
|
||||
|
||||
DropDownButton* cb = static_cast< DropDownButton* >(editor);
|
||||
editor->deleteLater();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
GridItemDelegate::updateEditorGeometry( QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index ) const
|
||||
{
|
||||
QStyledItemDelegate::updateEditorGeometry( editor, option, index );
|
||||
|
||||
DropDownButton* comboBox = static_cast<DropDownButton*>(editor);
|
||||
comboBox->resize( option.rect.size() - QSize( 8, 0 ) );
|
||||
comboBox->move( option.rect.x() + 4, option.rect.y() );
|
||||
|
||||
if ( m_downloadDropDownRects.contains( index ) )
|
||||
{
|
||||
editor->setGeometry( m_downloadDropDownRects.value( index ) );
|
||||
}
|
||||
|
||||
if ( !comboBox->property( "shownPopup" ).toBool() )
|
||||
{
|
||||
comboBox->showPopup();
|
||||
comboBox->setProperty( "shownPopup", true );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
GridItemDelegate::setModelData( QWidget* editor, QAbstractItemModel* model, const QModelIndex& index ) const
|
||||
{
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ public:
|
||||
|
||||
QSize itemSize() const;
|
||||
void setItemWidth( int width ) { m_itemWidth = width; }
|
||||
void setShowBuyButtons( bool enabled ) { m_showBuyButtons = enabled; }
|
||||
|
||||
public slots:
|
||||
void resetHoverIndex();
|
||||
@ -61,6 +62,10 @@ protected:
|
||||
bool editorEvent( QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index );
|
||||
bool eventFilter( QObject* obj, QEvent* event );
|
||||
|
||||
QWidget* createEditor( QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index ) const;
|
||||
void updateEditorGeometry( QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index ) const;
|
||||
void setModelData( QWidget* editor, QAbstractItemModel* model, const QModelIndex& index ) const;
|
||||
|
||||
signals:
|
||||
void updateIndex( const QModelIndex& idx );
|
||||
|
||||
@ -82,6 +87,9 @@ private slots:
|
||||
void fadingFrameChanged( const QPersistentModelIndex& );
|
||||
void fadingFrameFinished( const QPersistentModelIndex& );
|
||||
|
||||
void closeEditor( const QModelIndex& index, QWidget* editor );
|
||||
void addDownloadJob( const QModelIndex& index, QWidget* editor );
|
||||
|
||||
private:
|
||||
QTimeLine* createTimeline( QTimeLine::Direction direction, int startFrame = 0 );
|
||||
void clearButtons();
|
||||
@ -90,15 +98,19 @@ private:
|
||||
PlayableProxyModel* m_model;
|
||||
int m_itemWidth;
|
||||
bool m_showPosition;
|
||||
bool m_showBuyButtons;
|
||||
bool m_wordWrapping;
|
||||
|
||||
mutable QHash< QPersistentModelIndex, QRect > m_artistNameRects;
|
||||
mutable QHash< QPersistentModelIndex, QRect > m_albumNameRects;
|
||||
mutable QHash< QPersistentModelIndex, QRect > m_buyButtonRects;
|
||||
mutable QHash< QPersistentModelIndex, QRect > m_downloadDropDownRects;
|
||||
mutable QHash< QPersistentModelIndex, QSharedPointer< Tomahawk::PixmapDelegateFader > > m_covers;
|
||||
|
||||
QPersistentModelIndex m_hoverIndex;
|
||||
QPersistentModelIndex m_hoveringOverArtist;
|
||||
QPersistentModelIndex m_hoveringOverAlbum;
|
||||
QPersistentModelIndex m_hoveringOverBuyButton;
|
||||
|
||||
mutable QHash< QPersistentModelIndex, QWidget* > m_spinner;
|
||||
mutable QHash< QPersistentModelIndex, HoverControls* > m_hoverControls;
|
||||
|
@ -1027,7 +1027,7 @@ PlayableModel::appendAlbums( const QList< Tomahawk::album_ptr >& albums )
|
||||
void
|
||||
PlayableModel::appendAlbums( const Tomahawk::collection_ptr& collection )
|
||||
{
|
||||
emit loadingStarted();
|
||||
startLoading();
|
||||
insertAlbums( collection, rowCount( QModelIndex() ) );
|
||||
}
|
||||
|
||||
@ -1042,7 +1042,7 @@ PlayableModel::appendQueries( const QList< Tomahawk::query_ptr >& queries )
|
||||
void
|
||||
PlayableModel::appendTracks( const QList< Tomahawk::track_ptr >& tracks, const QList< Tomahawk::PlaybackLog >& logs )
|
||||
{
|
||||
emit loadingStarted();
|
||||
startLoading();
|
||||
QList< Tomahawk::query_ptr > queries;
|
||||
foreach ( const track_ptr& track, tracks )
|
||||
{
|
||||
@ -1056,7 +1056,7 @@ PlayableModel::appendTracks( const QList< Tomahawk::track_ptr >& tracks, const Q
|
||||
void
|
||||
PlayableModel::appendTracks( const Tomahawk::collection_ptr& collection )
|
||||
{
|
||||
emit loadingStarted();
|
||||
startLoading();
|
||||
insertTracks( collection, rowCount( QModelIndex() ) );
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <QAbstractTextDocumentLayout>
|
||||
#include <QApplication>
|
||||
#include <QDateTime>
|
||||
#include <QDesktopServices>
|
||||
#include <QMouseEvent>
|
||||
#include <QPainter>
|
||||
#include <QDesktopServices>
|
||||
@ -51,6 +52,7 @@
|
||||
#include "utils/Closure.h"
|
||||
#include "utils/TomahawkStyle.h"
|
||||
#include "utils/TomahawkUtilsGui.h"
|
||||
#include "utils/WebPopup.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
@ -123,16 +125,16 @@ PlaylistItemDelegate::createEditor( QWidget* parent, const QStyleOptionViewItem&
|
||||
PlayableItem* item = m_model->itemFromIndex( m_model->mapToSource( index ) );
|
||||
Q_ASSERT( item );
|
||||
|
||||
if ( index.column() == PlayableModel::Download && item->result() && !item->result()->downloadFormats().isEmpty() &&
|
||||
if ( /*index.column() == PlayableModel::Download &&*/ item->result() && !item->result()->downloadFormats().isEmpty() &&
|
||||
!DownloadManager::instance()->localFileForDownload( item->result()->downloadFormats().first().url.toString() ).isEmpty() )
|
||||
{
|
||||
QDesktopServices::openUrl( QUrl::fromLocalFile( QFileInfo( DownloadManager::instance()->localFileForDownload( item->result()->downloadFormats().first().url.toString() ) ).absolutePath() ) );
|
||||
}
|
||||
else if ( index.column() == PlayableModel::Download && item->result() && item->result()->downloadJob() && item->result()->downloadJob()->state() == DownloadJob::Finished )
|
||||
else if ( /*index.column() == PlayableModel::Download &&*/ item->result() && item->result()->downloadJob() && item->result()->downloadJob()->state() == DownloadJob::Finished )
|
||||
{
|
||||
QDesktopServices::openUrl( QUrl::fromLocalFile( QFileInfo( item->result()->downloadJob()->localFile() ).absolutePath() ) );
|
||||
}
|
||||
else if ( index.column() == PlayableModel::Download && item->result() &&
|
||||
else if ( /*index.column() == PlayableModel::Download &&*/ item->result() &&
|
||||
!item->result()->downloadFormats().isEmpty() && !item->result()->downloadJob() )
|
||||
{
|
||||
QStringList formats;
|
||||
@ -192,9 +194,14 @@ PlaylistItemDelegate::updateEditorGeometry( QWidget* editor, const QStyleOptionV
|
||||
comboBox->resize( option.rect.size() - QSize( 8, 0 ) );
|
||||
comboBox->move( option.rect.x() + 4, option.rect.y() );
|
||||
|
||||
if ( m_downloadDropDownRects.contains( index ) )
|
||||
{
|
||||
editor->setGeometry( m_downloadDropDownRects.value( index ) );
|
||||
}
|
||||
|
||||
if ( !comboBox->property( "shownPopup" ).toBool() )
|
||||
{
|
||||
// comboBox->showPopup();
|
||||
comboBox->showPopup();
|
||||
comboBox->setProperty( "shownPopup", true );
|
||||
}
|
||||
}
|
||||
@ -291,7 +298,8 @@ PlaylistItemDelegate::paintDetailed( QPainter* painter, const QStyleOptionViewIt
|
||||
}
|
||||
else if ( !item->result()->downloadJob() )
|
||||
{
|
||||
DropDownButton::drawPrimitive( painter, optc.rect, optc.currentText );
|
||||
DropDownButton::drawPrimitive( painter, optc.rect, optc.currentText, hoveringOver() == index, true );
|
||||
|
||||
/* QApplication::style()->drawComplexControl( QStyle::CC_ComboBox, &optc, painter, 0 );
|
||||
optc.rect.adjust( 4, 0, 0, 0 );
|
||||
QApplication::style()->drawControl( QStyle::CE_ComboBoxLabel, &optc, painter, 0 );*/
|
||||
@ -604,6 +612,7 @@ QRect
|
||||
PlaylistItemDelegate::drawTrack( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index, const QRect& rect, PlayableItem* item ) const
|
||||
{
|
||||
const track_ptr track = item->query()->track();
|
||||
const bool hasOnlineResults = ( item->query()->numResults( true ) > 0 );
|
||||
|
||||
painter->save();
|
||||
painter->setRenderHint( QPainter::TextAntialiasing );
|
||||
@ -630,21 +639,87 @@ PlaylistItemDelegate::drawTrack( QPainter* painter, const QStyleOptionViewItem&
|
||||
|
||||
QRect numberRect = QRect( r.x(), r.y(), numberWidth, r.height() );
|
||||
QRect extraRect = QRect( r.x() + r.width() - durationWidth, r.y(), durationWidth, r.height() );
|
||||
QRect stateRect;
|
||||
if ( option.state & QStyle::State_Selected || hoveringOver() == index )
|
||||
QRect stateRect = extraRect.adjusted( 0, 0, 0, 0 );
|
||||
|
||||
if ( option.state & QStyle::State_Selected || hoveringOver() == index )
|
||||
{
|
||||
int h = extraRect.height() / 3;
|
||||
|
||||
if ( track->loved() )
|
||||
{
|
||||
painter->save();
|
||||
painter->setOpacity( 0.5 );
|
||||
int h = extraRect.height() / 3;
|
||||
stateRect = extraRect.adjusted( -16, extraRect.height() / 2 - h / 2, 0, 0 );
|
||||
stateRect.setHeight( h );
|
||||
stateRect.setWidth( stateRect.height() );
|
||||
painter->drawPixmap( stateRect, ImageRegistry::instance()->pixmap( RESPATH "images/love.svg", stateRect.size() ) );
|
||||
QRect r = stateRect.adjusted( -16, extraRect.height() / 2 - h / 2, 0, 0 );
|
||||
r.setHeight( h );
|
||||
r.setWidth( r.height() );
|
||||
painter->drawPixmap( r, ImageRegistry::instance()->pixmap( RESPATH "images/love.svg", r.size() ) );
|
||||
painter->restore();
|
||||
|
||||
stateWidth = stateRect.width() + 16;
|
||||
stateWidth += r.width() + 16;
|
||||
}
|
||||
|
||||
if ( hasOnlineResults && !item->query()->results().first()->purchaseUrl().isEmpty() )
|
||||
{
|
||||
QRect r = stateRect.adjusted( -stateWidth -144, 6, 0, -6 );
|
||||
r.setWidth( 144 );
|
||||
DropDownButton::drawPrimitive( painter, r, tr( "Buy" ), m_hoveringOverBuyButton == index, false );
|
||||
|
||||
m_buyButtonRects[ index ] = r;
|
||||
|
||||
stateWidth += r.width() + 16;
|
||||
}
|
||||
}
|
||||
|
||||
if ( hasOnlineResults && !item->query()->results().first()->downloadFormats().isEmpty() )
|
||||
{
|
||||
painter->save();
|
||||
QStyleOptionComboBox optc;
|
||||
optc.rect = stateRect.adjusted( -stateWidth -144, 6, 0, -6 );
|
||||
optc.rect.setWidth( 144 );
|
||||
m_downloadDropDownRects[ index ] = optc.rect;
|
||||
stateWidth += optc.rect.width() + 16;
|
||||
optc.editable = false;
|
||||
optc.currentText = tr( "Download %1" ).arg( item->query()->results().first()->downloadFormats().first().extension.toUpper() );
|
||||
optc.palette = m_view->palette();
|
||||
|
||||
if ( option.state & QStyle::State_Selected && option.state & QStyle::State_Active )
|
||||
optc.state = QStyle::State_Active | QStyle::State_Selected | QStyle::State_Enabled;
|
||||
else
|
||||
optc.state = QStyle::State_Active | QStyle::State_Enabled;
|
||||
|
||||
if ( !DownloadManager::instance()->localFileForDownload( item->query()->results().first()->downloadFormats().first().url.toString() ).isEmpty() )
|
||||
{
|
||||
painter->setPen( optc.palette.text().color() );
|
||||
const QString text = painter->fontMetrics().elidedText( tr( "View in Finder" ), Qt::ElideRight, optc.rect.width() - 3 );
|
||||
painter->drawText( optc.rect, text, QTextOption( Qt::AlignCenter ) );
|
||||
}
|
||||
else if ( !item->query()->results().first()->downloadJob() )
|
||||
{
|
||||
DropDownButton::drawPrimitive( painter, optc.rect, optc.currentText, hoveringOver() == index, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( item->query()->results().first()->downloadJob()->state() == DownloadJob::Finished )
|
||||
{
|
||||
painter->setPen( optc.palette.text().color() );
|
||||
const QString text = painter->fontMetrics().elidedText( tr( "View in Finder" ), Qt::ElideRight, optc.rect.width() - 3 );
|
||||
painter->drawText( optc.rect, text, QTextOption( Qt::AlignCenter ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
painter->setPen( TomahawkStyle::PLAYLIST_PROGRESS_FOREGROUND.darker() );
|
||||
painter->setBrush( TomahawkStyle::PLAYLIST_PROGRESS_BACKGROUND );
|
||||
painter->drawRect( optc.rect.adjusted( 2, 2, -2, -2 ) );
|
||||
painter->setPen( TomahawkStyle::PLAYLIST_PROGRESS_FOREGROUND );
|
||||
painter->setBrush( TomahawkStyle::PLAYLIST_PROGRESS_FOREGROUND );
|
||||
QRect fillp = optc.rect.adjusted( 3, 3, -3, -3 );
|
||||
fillp.setWidth( float(fillp.width()) * ( float(item->query()->results().first()->downloadJob()->progressPercentage()) / 100.0 ) );
|
||||
painter->drawRect( fillp );
|
||||
}
|
||||
}
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
const int remWidth = r.width() - numberWidth - durationWidth;
|
||||
|
||||
QRect titleRect = QRect( numberRect.x() + numberRect.width(), r.y(), (double)remWidth * 0.5, r.height() );
|
||||
@ -708,6 +783,7 @@ PlaylistItemDelegate::drawTrack( QPainter* painter, const QStyleOptionViewItem&
|
||||
|
||||
int h = extraRect.height() / 2;
|
||||
QRect playIconRect = extraRect.adjusted( extraRect.width() - h - 8, h / 2, -8, -h / 2 );
|
||||
playIconRect.setWidth( playIconRect.height() );
|
||||
painter->drawPixmap( playIconRect, ImageRegistry::instance()->pixmap( RESPATH "images/play.svg", playIconRect.size() ) );
|
||||
|
||||
double duration = (double)AudioEngine::instance()->currentTrackTotalTime();
|
||||
@ -759,8 +835,11 @@ PlaylistItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, con
|
||||
bool hoveringArtist = false;
|
||||
bool hoveringInfo = false;
|
||||
bool hoveringLove = false;
|
||||
bool hoveringBuy = false;
|
||||
bool hoveringDownloadDropDown = false;
|
||||
Tomahawk::source_ptr hoveredAvatar;
|
||||
QRect hoveredAvatarRect;
|
||||
|
||||
if ( m_infoButtonRects.contains( index ) )
|
||||
{
|
||||
const QRect infoRect = m_infoButtonRects[ index ];
|
||||
@ -779,6 +858,18 @@ PlaylistItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, con
|
||||
const QMouseEvent* ev = static_cast< QMouseEvent* >( event );
|
||||
hoveringLove = loveRect.contains( ev->pos() );
|
||||
}
|
||||
if ( m_buyButtonRects.contains( index ) )
|
||||
{
|
||||
const QRect buyRect = m_buyButtonRects[ index ];
|
||||
const QMouseEvent* ev = static_cast< QMouseEvent* >( event );
|
||||
hoveringBuy = buyRect.contains( ev->pos() );
|
||||
}
|
||||
if ( m_downloadDropDownRects.contains( index ) )
|
||||
{
|
||||
const QRect downloadDropDownRect = m_downloadDropDownRects[ index ];
|
||||
const QMouseEvent* ev = static_cast< QMouseEvent* >( event );
|
||||
hoveringDownloadDropDown = downloadDropDownRect.contains( ev->pos() );
|
||||
}
|
||||
if ( m_avatarBoxRects.contains( index ) )
|
||||
{
|
||||
const QMouseEvent* ev = static_cast< QMouseEvent* >( event );
|
||||
@ -796,7 +887,7 @@ PlaylistItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, con
|
||||
|
||||
if ( event->type() == QEvent::MouseMove )
|
||||
{
|
||||
if ( hoveringInfo || hoveringLove || hoveringArtist )
|
||||
if ( hoveringInfo || hoveringLove || hoveringArtist || hoveringBuy )
|
||||
m_view->setCursor( Qt::PointingHandCursor );
|
||||
else
|
||||
m_view->setCursor( Qt::ArrowCursor );
|
||||
@ -820,6 +911,23 @@ PlaylistItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, con
|
||||
emit updateIndex( m_hoveringOverArtist );
|
||||
m_hoveringOverArtist = QModelIndex();
|
||||
}
|
||||
if ( hoveringBuy && m_hoveringOverBuyButton != index )
|
||||
{
|
||||
QPersistentModelIndex ti = m_hoveringOverBuyButton;
|
||||
m_hoveringOverBuyButton = index;
|
||||
|
||||
PlayableItem* item = m_model->sourceModel()->itemFromIndex( m_model->mapToSource( ti ) );
|
||||
item->requestRepaint();
|
||||
emit updateIndex( m_hoveringOverBuyButton );
|
||||
}
|
||||
if ( !hoveringBuy && m_hoveringOverBuyButton.isValid() )
|
||||
{
|
||||
QPersistentModelIndex ti = m_hoveringOverBuyButton;
|
||||
m_hoveringOverBuyButton = QModelIndex();
|
||||
|
||||
PlayableItem* item = m_model->sourceModel()->itemFromIndex( m_model->mapToSource( ti ) );
|
||||
item->requestRepaint();
|
||||
}
|
||||
|
||||
if ( m_hoveringOver != index )
|
||||
{
|
||||
@ -849,6 +957,11 @@ PlaylistItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, con
|
||||
{
|
||||
item->query()->queryTrack()->setLoved( !item->query()->queryTrack()->loved() );
|
||||
}
|
||||
else if ( hoveringBuy )
|
||||
{
|
||||
WebPopup* popup = new WebPopup( item->query()->results().first()->purchaseUrl(), QSize( 400, 800 ) );
|
||||
connect( item->query()->results().first().data(), SIGNAL( destroyed() ), popup, SLOT( close() ) );
|
||||
}
|
||||
else if ( hoveringInfo )
|
||||
{
|
||||
if ( m_model->style() == PlayableProxyModel::SingleColumn )
|
||||
@ -883,7 +996,7 @@ PlaylistItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, con
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( m_view->proxyModel()->style() == PlayableProxyModel::Locker && index.column() == PlayableModel::Download )
|
||||
else if ( ( m_view->proxyModel()->style() == PlayableProxyModel::Locker && index.column() == PlayableModel::Download ) || hoveringDownloadDropDown )
|
||||
{
|
||||
m_model->sourceModel()->setAllColumnsEditable( true );
|
||||
m_view->edit( index );
|
||||
@ -909,8 +1022,10 @@ PlaylistItemDelegate::resetHoverIndex()
|
||||
|
||||
m_hoveringOver = QModelIndex();
|
||||
m_hoveringOverArtist = QModelIndex();
|
||||
m_hoveringOverBuyButton = QModelIndex();
|
||||
m_infoButtonRects.clear();
|
||||
m_loveButtonRects.clear();
|
||||
m_buyButtonRects.clear();
|
||||
m_artistNameRects.clear();
|
||||
|
||||
QModelIndex itemIdx = m_model->mapToSource( idx );
|
||||
|
@ -116,10 +116,13 @@ private:
|
||||
mutable QHash< QPersistentModelIndex, QSharedPointer< Tomahawk::PixmapDelegateFader > > m_pixmaps;
|
||||
mutable QHash< QPersistentModelIndex, QRect > m_infoButtonRects;
|
||||
mutable QHash< QPersistentModelIndex, QRect > m_loveButtonRects;
|
||||
mutable QHash< QPersistentModelIndex, QRect > m_buyButtonRects;
|
||||
mutable QHash< QPersistentModelIndex, QRect > m_downloadDropDownRects;
|
||||
mutable QHash< QPersistentModelIndex, QRect > m_artistNameRects;
|
||||
mutable QHash< QPersistentModelIndex, QHash< Tomahawk::source_ptr, QRect > > m_avatarBoxRects;
|
||||
QPersistentModelIndex m_hoveringOver;
|
||||
QPersistentModelIndex m_hoveringOverArtist;
|
||||
QPersistentModelIndex m_hoveringOverBuyButton;
|
||||
mutable QPersistentModelIndex m_nowPlaying;
|
||||
|
||||
TrackView* m_view;
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "TrackDetailView.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QScrollArea>
|
||||
#include <QSizePolicy>
|
||||
#include <QVBoxLayout>
|
||||
@ -35,6 +36,7 @@
|
||||
#include "utils/ImageRegistry.h"
|
||||
#include "utils/TomahawkUtilsGui.h"
|
||||
#include "utils/Closure.h"
|
||||
#include "utils/WebPopup.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
@ -42,6 +44,7 @@ using namespace Tomahawk;
|
||||
TrackDetailView::TrackDetailView( QWidget* parent )
|
||||
: QWidget( parent )
|
||||
, DpiScaler( this )
|
||||
, m_buyButtonVisible( false )
|
||||
{
|
||||
setFixedWidth( scaledX( 200 ) );
|
||||
setContentsMargins( 0, 0, 0, 0 );
|
||||
@ -118,11 +121,21 @@ TrackDetailView::TrackDetailView( QWidget* parent )
|
||||
TomahawkStyle::styleScrollBar( m_resultsScrollArea->verticalScrollBar() );
|
||||
m_resultsScrollArea->hide();
|
||||
|
||||
m_buyButton = new QPushButton;
|
||||
m_buyButton->setStyleSheet( "QPushButton:hover { font-size: 12px; color: #ffffff; background: #000000; border-style: solid; border-radius: 0px; border-width: 2px; border-color: #2b2b2b; }"
|
||||
"QPushButton { font-size: 12px; color: #ffffff; background-color: #000000; border-style: solid; border-radius: 0px; border-width: 0px; }" );
|
||||
m_buyButton->setMinimumHeight( 30 );
|
||||
m_buyButton->setText( tr( "Buy Album" ) );
|
||||
m_buyButton->setVisible( false );
|
||||
connect( m_buyButton, SIGNAL( clicked() ), SLOT( onBuyButtonClicked() ) );
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout;
|
||||
TomahawkUtils::unmarginLayout( layout );
|
||||
layout->addWidget( m_playableCover );
|
||||
layout->addSpacerItem( new QSpacerItem( 0, 8, QSizePolicy::Minimum, QSizePolicy::Fixed ) );
|
||||
layout->addWidget( m_nameLabel );
|
||||
layout->addSpacerItem( new QSpacerItem( 0, 4, QSizePolicy::Minimum, QSizePolicy::Fixed ) );
|
||||
layout->addWidget( m_buyButton );
|
||||
layout->addWidget( m_dateLabel );
|
||||
layout->addWidget( m_infoBox );
|
||||
layout->addSpacerItem( new QSpacerItem( 0, 32, QSizePolicy::Minimum, QSizePolicy::Fixed ) );
|
||||
@ -134,6 +147,9 @@ TrackDetailView::TrackDetailView( QWidget* parent )
|
||||
|
||||
setLayout( layout );
|
||||
setQuery( query_ptr() );
|
||||
|
||||
connect( DownloadManager::instance(), SIGNAL( stateChanged( DownloadManager::DownloadManagerState, DownloadManager::DownloadManagerState ) ),
|
||||
SLOT( onDownloadManagerStateChanged( DownloadManager::DownloadManagerState, DownloadManager::DownloadManagerState ) ) );
|
||||
}
|
||||
|
||||
|
||||
@ -154,6 +170,10 @@ TrackDetailView::setQuery( const Tomahawk::query_ptr& query )
|
||||
{
|
||||
if ( m_query )
|
||||
{
|
||||
if ( m_query->track()->albumPtr() && !m_query->track()->albumPtr()->name().isEmpty() )
|
||||
{
|
||||
disconnect( m_query->track()->albumPtr().data(), SIGNAL( updated() ), this, SLOT( onAlbumUpdated() ) );
|
||||
}
|
||||
disconnect( m_query->track().data(), SIGNAL( updated() ), this, SLOT( onCoverUpdated() ) );
|
||||
disconnect( m_query->track().data(), SIGNAL( socialActionsLoaded() ), this, SLOT( onSocialActionsLoaded() ) );
|
||||
disconnect( m_query.data(), SIGNAL( resultsChanged() ), this, SLOT( onResultsChanged() ) );
|
||||
@ -164,6 +184,7 @@ TrackDetailView::setQuery( const Tomahawk::query_ptr& query )
|
||||
onResultsChanged();
|
||||
setSocialActions();
|
||||
onCoverUpdated();
|
||||
onAlbumUpdated();
|
||||
|
||||
if ( !query )
|
||||
{
|
||||
@ -174,20 +195,85 @@ TrackDetailView::setQuery( const Tomahawk::query_ptr& query )
|
||||
|
||||
m_dateLabel->setText( tr( "Unknown Release-Date" ) );
|
||||
|
||||
connect( m_query->track().data(), SIGNAL( updated() ), SLOT( onCoverUpdated() ) );
|
||||
connect( m_query->track().data(), SIGNAL( socialActionsLoaded() ), SLOT( onSocialActionsLoaded() ) );
|
||||
connect( m_query.data(), SIGNAL( resultsChanged() ), SLOT( onResultsChanged() ) );
|
||||
connect( m_query.data(), SIGNAL( resultsChanged() ), SLOT( onAlbumUpdated() ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TrackDetailView::onAlbumUpdated()
|
||||
{
|
||||
if ( !m_query )
|
||||
return;
|
||||
|
||||
if ( m_query->track()->albumPtr() && !m_query->track()->albumPtr()->name().isEmpty() )
|
||||
{
|
||||
m_nameLabel->setType( QueryLabel::Album );
|
||||
m_nameLabel->setAlbum( m_query->track()->albumPtr() );
|
||||
|
||||
connect( m_query->track()->albumPtr().data(), SIGNAL( updated() ), SLOT( onAlbumUpdated() ), Qt::UniqueConnection );
|
||||
|
||||
if ( m_buyButtonVisible )
|
||||
{
|
||||
if ( m_query->track()->albumPtr()->purchased() )
|
||||
{
|
||||
m_buyButton->setText( tr( "Download Album" ) );
|
||||
m_buyButton->setVisible( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_buyButton->setText( tr( "Buy Album" ) );
|
||||
m_buyButton->setVisible( !m_query->track()->albumPtr()->purchaseUrl().isEmpty() );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_nameLabel->setType( QueryLabel::Artist );
|
||||
m_nameLabel->setArtist( m_query->track()->artistPtr() );
|
||||
m_buyButton->setVisible( false );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TrackDetailView::onBuyButtonClicked()
|
||||
{
|
||||
if ( DownloadManager::instance()->state() == DownloadManager::Running )
|
||||
{
|
||||
emit downloadCancel();
|
||||
return;
|
||||
}
|
||||
|
||||
connect( m_query->track().data(), SIGNAL( updated() ), SLOT( onCoverUpdated() ) );
|
||||
connect( m_query->track().data(), SIGNAL( socialActionsLoaded() ), SLOT( onSocialActionsLoaded() ) );
|
||||
connect( m_query.data(), SIGNAL( resultsChanged() ), SLOT( onResultsChanged() ) );
|
||||
if ( m_query && m_query->track()->albumPtr() )
|
||||
{
|
||||
if ( m_query->track()->albumPtr()->purchased() )
|
||||
{
|
||||
emit downloadAll();
|
||||
}
|
||||
else
|
||||
{
|
||||
WebPopup* popup = new WebPopup( m_query->track()->albumPtr()->purchaseUrl(), QSize( 400, 800 ) );
|
||||
connect( m_query->track()->albumPtr().data(), SIGNAL( destroyed() ), popup, SLOT( close() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TrackDetailView::onDownloadManagerStateChanged( DownloadManager::DownloadManagerState newState, DownloadManager::DownloadManagerState oldState )
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO;
|
||||
if ( newState == DownloadManager::Running )
|
||||
{
|
||||
m_buyButton->setText( tr( "Cancel Download" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
onAlbumUpdated();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -304,3 +390,10 @@ TrackDetailView::onResultsChanged()
|
||||
m_resultsScrollArea->hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TrackDetailView::setBuyButtonVisible( bool visible )
|
||||
{
|
||||
m_buyButtonVisible = visible;
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include "Query.h"
|
||||
#include "utils/DpiScaler.h"
|
||||
#include "DownloadManager.h"
|
||||
#include "DllMacro.h"
|
||||
|
||||
class QLabel;
|
||||
@ -30,6 +31,7 @@ class CaptionLabel;
|
||||
class PlayableCover;
|
||||
class QueryLabel;
|
||||
class QScrollArea;
|
||||
class QPushButton;
|
||||
|
||||
class DLLEXPORT TrackDetailView : public QWidget, private TomahawkUtils::DpiScaler
|
||||
{
|
||||
@ -39,21 +41,29 @@ public:
|
||||
explicit TrackDetailView( QWidget* parent = 0 );
|
||||
~TrackDetailView();
|
||||
|
||||
void setBuyButtonVisible( bool visible );
|
||||
|
||||
public slots:
|
||||
virtual void setQuery( const Tomahawk::query_ptr& query );
|
||||
void setPlaylistInterface( const Tomahawk::playlistinterface_ptr& playlistInterface );
|
||||
|
||||
signals:
|
||||
void downloadAll();
|
||||
void downloadCancel();
|
||||
|
||||
protected:
|
||||
|
||||
protected slots:
|
||||
|
||||
private slots:
|
||||
void onAlbumUpdated();
|
||||
void onCoverUpdated();
|
||||
void onSocialActionsLoaded();
|
||||
void onResultsChanged();
|
||||
|
||||
void onBuyButtonClicked();
|
||||
void onDownloadManagerStateChanged( DownloadManager::DownloadManagerState newState, DownloadManager::DownloadManagerState oldState );
|
||||
|
||||
private:
|
||||
void setSocialActions();
|
||||
|
||||
@ -65,6 +75,8 @@ private:
|
||||
QLabel* m_lovedIcon;
|
||||
QLabel* m_lovedLabel;
|
||||
CaptionLabel* m_resultsBoxLabel;
|
||||
QPushButton* m_buyButton;
|
||||
bool m_buyButtonVisible;
|
||||
|
||||
QWidget* m_infoBox;
|
||||
QWidget* m_resultsBox;
|
||||
|
@ -23,7 +23,9 @@
|
||||
#include "PlayableModel.h"
|
||||
#include "PlayableProxyModel.h"
|
||||
#include "PlayableItem.h"
|
||||
#include "DownloadManager.h"
|
||||
#include "DropJob.h"
|
||||
#include "Result.h"
|
||||
#include "Source.h"
|
||||
#include "TomahawkSettings.h"
|
||||
#include "audio/AudioEngine.h"
|
||||
@ -773,6 +775,44 @@ TrackView::onCustomContextMenu( const QPoint& pos )
|
||||
m_contextMenu->setSupportedActions( m_contextMenu->supportedActions() | ContextMenu::ActionMarkListened
|
||||
| ContextMenu::ActionDelete );
|
||||
|
||||
if ( proxyModel()->style() != PlayableProxyModel::Collection )
|
||||
{
|
||||
bool allDownloaded = true;
|
||||
bool noneDownloadable = true;
|
||||
bool downloadable = false;
|
||||
foreach ( const QModelIndex& index, selectedIndexes() )
|
||||
{
|
||||
if ( index.column() )
|
||||
continue;
|
||||
|
||||
PlayableItem* item = proxyModel()->itemFromIndex( proxyModel()->mapToSource( index ) );
|
||||
|
||||
if( item->query()->results().isEmpty() )
|
||||
continue;
|
||||
|
||||
downloadable = !item->query()->results().first()->downloadFormats().isEmpty();
|
||||
if ( downloadable )
|
||||
{
|
||||
noneDownloadable = false;
|
||||
}
|
||||
|
||||
if ( downloadable && DownloadManager::instance()->localFileForDownload( item->query()->results().first()->downloadFormats().first().url.toString() ).isEmpty() )
|
||||
{
|
||||
allDownloaded = false;
|
||||
}
|
||||
|
||||
if ( !allDownloaded || !noneDownloadable )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !allDownloaded || !noneDownloadable )
|
||||
{
|
||||
m_contextMenu->setSupportedActions( m_contextMenu->supportedActions() | ContextMenu::ActionDownload );
|
||||
}
|
||||
}
|
||||
|
||||
QList<query_ptr> queries;
|
||||
foreach ( const QModelIndex& index, selectedIndexes() )
|
||||
{
|
||||
@ -804,6 +844,10 @@ TrackView::onMenuTriggered( int action )
|
||||
deleteSelectedItems();
|
||||
break;
|
||||
|
||||
case ContextMenu::ActionDownload:
|
||||
downloadSelectedItems();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -879,6 +923,30 @@ TrackView::deleteSelectedItems()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TrackView::downloadSelectedItems()
|
||||
{
|
||||
foreach ( const QModelIndex& index, selectedIndexes() )
|
||||
{
|
||||
if ( index.column() )
|
||||
continue;
|
||||
|
||||
PlayableItem* item = proxyModel()->itemFromIndex( proxyModel()->mapToSource( index ) );
|
||||
|
||||
if ( !item )
|
||||
continue;
|
||||
|
||||
if ( item->query()->results().isEmpty() || item->query()->results().first()->downloadFormats().isEmpty() )
|
||||
continue;
|
||||
|
||||
if ( !DownloadManager::instance()->localFileForDownload( item->query()->results().first()->downloadFormats().first().url.toString() ).isEmpty() )
|
||||
continue;
|
||||
|
||||
DownloadManager::instance()->addJob( item->result()->toDownloadJob( item->result()->downloadFormats().first() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TrackView::verifySize()
|
||||
{
|
||||
|
@ -89,6 +89,7 @@ public:
|
||||
public slots:
|
||||
virtual void onItemActivated( const QModelIndex& index );
|
||||
|
||||
virtual void downloadSelectedItems();
|
||||
virtual void deleteSelectedItems();
|
||||
|
||||
void playItem();
|
||||
|
@ -370,11 +370,17 @@ ScriptAccount::parseResultVariantList( const QVariantList& reslist )
|
||||
// rp->track()->setAttributes( attr );
|
||||
}
|
||||
|
||||
rp->setMimetype( m.value( "mimetype" ).toString() );
|
||||
if ( rp->mimetype().isEmpty() )
|
||||
|
||||
QString mimetype = m.value( "mimetype" ).toString();
|
||||
if ( mimetype.isEmpty() )
|
||||
{
|
||||
rp->setMimetype( TomahawkUtils::extensionToMimetype( m.value( "extension" ).toString() ) );
|
||||
Q_ASSERT( !rp->mimetype().isEmpty() );
|
||||
mimetype = TomahawkUtils::extensionToMimetype( m.value( "extension" ).toString() );
|
||||
}
|
||||
Q_ASSERT( !mimetype.isEmpty() );
|
||||
|
||||
if ( !mimetype.isEmpty() )
|
||||
{
|
||||
rp->setMimetype( mimetype );
|
||||
}
|
||||
|
||||
rp->setFriendlySource( name() );
|
||||
|
@ -99,7 +99,7 @@ ScriptEngine::sslErrorHandler( QNetworkReply* qnr, const QList<QSslError>& errli
|
||||
|
||||
QMessageBox question( TomahawkUtils::tomahawkWindow() );
|
||||
question.setWindowTitle( tr( "SSL Error" ) );
|
||||
question.setText( tr( "You have asked Tomahawk to connect securely to <b>%1</b>, but we can't confirm that your connection is secure:<br><br>"
|
||||
question.setText( tr( "You have asked %applicationName to connect securely to <b>%1</b>, but we can't confirm that your connection is secure:<br><br>"
|
||||
"<b>%2</b><br><br>"
|
||||
"Do you want to trust this connection?" )
|
||||
.arg( qnr->url().host() )
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "PluginLoader_p.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "TomahawkVersion.h"
|
||||
|
||||
#include "utils/Logger.h"
|
||||
|
||||
@ -153,7 +154,7 @@ PluginLoader::pluginFilenames( const QString& name ) const
|
||||
QStringList fileNames;
|
||||
foreach( const QString& extension, extensions )
|
||||
{
|
||||
fileNames << QString("libtomahawk_%1_%2.%3")
|
||||
fileNames << QString("lib" TOMAHAWK_TARGET_NAME "_%1_%2.%3")
|
||||
.arg( d_ptr->type )
|
||||
.arg( name )
|
||||
.arg( extension );
|
||||
@ -174,12 +175,8 @@ PluginLoader::pluginPaths( const QString& name ) const
|
||||
tDebug() << Q_FUNC_INFO << "Checking directory for" << type << "plugins:" << pluginDir.absolutePath();
|
||||
foreach ( QString fileName, pluginDir.entryList( pluginFilenames( name ), QDir::Files ) )
|
||||
{
|
||||
//TODO: do we really need to check this?!
|
||||
if ( fileName.startsWith( QString( "libtomahawk_%1" ).arg( type ) ) )
|
||||
{
|
||||
const QString path = pluginDir.absoluteFilePath( fileName );
|
||||
paths << path;
|
||||
}
|
||||
const QString path = pluginDir.absoluteFilePath( fileName );
|
||||
paths << path;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -211,11 +211,19 @@ TomahawkStyle::styleScrollBar( QScrollBar* scrollBar )
|
||||
void
|
||||
TomahawkStyle::loadFonts()
|
||||
{
|
||||
#ifdef Q_OS_MAC
|
||||
QDir dir( QCoreApplication::applicationDirPath() + "/../Resources/Fonts" );
|
||||
#else
|
||||
QDir dir( ":/data/fonts" );
|
||||
#endif
|
||||
foreach ( const QString& fileName, dir.entryList() )
|
||||
{
|
||||
tDebug( LOGVERBOSE ) << "Trying to add font resource:" << fileName;
|
||||
tDebug( LOGVERBOSE ) << "Trying to add font resource:" << dir.absolutePath() << fileName;
|
||||
#ifdef Q_OS_MAC
|
||||
const int id = QFontDatabase::addApplicationFont( dir.absolutePath() + "/" + fileName );
|
||||
#else
|
||||
const int id = QFontDatabase::addApplicationFont( ":/data/fonts/" + fileName );
|
||||
#endif
|
||||
if ( id >= 0 )
|
||||
{
|
||||
tDebug( LOGVERBOSE ) << "Added font:" << id << QFontDatabase::applicationFontFamilies( id ).first();
|
||||
|
@ -102,6 +102,7 @@ namespace TomahawkStyle
|
||||
|
||||
static const QColor PLAYLIST_BUTTON_BACKGROUND = QColor( "#111111" );
|
||||
static const QColor PLAYLIST_BUTTON_FOREGROUND = QColor( "#ffffff" );
|
||||
static const QColor PLAYLIST_BUTTON_HOVER_BACKGROUND = QColor( "#111111" );
|
||||
|
||||
static const QColor PLAYLIST_PROGRESS_BACKGROUND = QColor( "#ffffff" );
|
||||
static const QColor PLAYLIST_PROGRESS_FOREGROUND = QColor( "#E61878" );
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "Source.h"
|
||||
#include "MetaPlaylistInterface.h"
|
||||
#include "playlist/TrackView.h"
|
||||
#include "playlist/TrackDetailView.h"
|
||||
#include "widgets/BasicHeader.h"
|
||||
|
||||
#include "database/DatabaseCommand_AllTracks.h"
|
||||
@ -58,6 +59,7 @@ AlbumInfoWidget::AlbumInfoWidget( const Tomahawk::album_ptr& album, QWidget* par
|
||||
m_tracksModel->setMode( Mixed );
|
||||
|
||||
// We need to set the model on the view before loading the playlist, so spinners & co are connected
|
||||
ui->albumView->trackDetailView()->setBuyButtonVisible( true );
|
||||
ui->albumView->trackView()->setPlayableModel( m_tracksModel );
|
||||
ui->albumView->setCaption( tr( "Album Details" ) );
|
||||
|
||||
@ -186,4 +188,4 @@ AlbumInfoWidget::pixmap() const
|
||||
return Tomahawk::ViewPage::pixmap();
|
||||
else
|
||||
return m_pixmap;
|
||||
}
|
||||
}
|
@ -107,6 +107,7 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget*
|
||||
ui->topHits->setItemWidth( scaledX( 140 ) );
|
||||
ui->topHits->proxyModel()->setHideDupeItems( true );
|
||||
ui->topHits->delegate()->setWordWrapping( true );
|
||||
ui->topHits->delegate()->setShowBuyButtons( true );
|
||||
ui->topHits->setFixedHeight( ui->topHits->itemSize().height() + ui->topHits->spacing() * 2 );
|
||||
|
||||
m_topHitsModel = new PlayableModel( ui->topHits );
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "CollectionViewPage.h"
|
||||
|
||||
#include <QRadioButton>
|
||||
#include <QPushButton>
|
||||
#include <QStackedWidget>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
@ -32,7 +33,6 @@
|
||||
#include "playlist/GridView.h"
|
||||
#include "playlist/PlayableProxyModelPlaylistInterface.h"
|
||||
#include "resolvers/ScriptCollection.h"
|
||||
#include "DownloadManager.h"
|
||||
#include "TomahawkSettings.h"
|
||||
#include "utils/ImageRegistry.h"
|
||||
#include "utils/TomahawkStyle.h"
|
||||
@ -58,6 +58,7 @@ CollectionViewPage::CollectionViewPage( const Tomahawk::collection_ptr& collecti
|
||||
qRegisterMetaType< CollectionViewPageMode >( "CollectionViewPageMode" );
|
||||
|
||||
m_header->setBackground( ImageRegistry::instance()->pixmap( RESPATH "images/collection_background.png", QSize( 0, 0 ) ), false );
|
||||
|
||||
setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultCollection, TomahawkUtils::Original, QSize( 256, 256 ) ) );
|
||||
|
||||
m_columnView->proxyModel()->setStyle( PlayableProxyModel::SingleColumn );
|
||||
@ -78,8 +79,9 @@ CollectionViewPage::CollectionViewPage( const Tomahawk::collection_ptr& collecti
|
||||
m_trackView->setColumnHidden( trackViewProxyModel->mapSourceColumnToColumn( PlayableModel::Score ), true );
|
||||
m_trackView->setColumnHidden( trackViewProxyModel->mapSourceColumnToColumn( PlayableModel::Bitrate ), true );
|
||||
|
||||
|
||||
m_trackView->setGuid( QString( "trackview/flat" ) );
|
||||
m_trackView->setSortingEnabled( true );
|
||||
m_trackView->sortByColumn( 0, Qt::AscendingOrder );
|
||||
|
||||
{
|
||||
m_albumView->setAutoResize( false );
|
||||
@ -130,8 +132,11 @@ CollectionViewPage::CollectionViewPage( const Tomahawk::collection_ptr& collecti
|
||||
|
||||
if ( collection->backendType() == Collection::ScriptCollectionType )
|
||||
{
|
||||
QAbstractButton* downloadButton = m_header->addButton( tr( "Download All" ) );
|
||||
connect( downloadButton, SIGNAL( clicked() ), SLOT( onDownloadAll() ) );
|
||||
m_downloadAllButton = m_header->addButton( tr( "Download All" ) );
|
||||
connect( m_downloadAllButton, SIGNAL( clicked() ), SLOT( onDownloadAll() ) );
|
||||
|
||||
connect( DownloadManager::instance(), SIGNAL( stateChanged( DownloadManager::DownloadManagerState, DownloadManager::DownloadManagerState ) ),
|
||||
SLOT( onDownloadManagerStateChanged( DownloadManager::DownloadManagerState, DownloadManager::DownloadManagerState ) ) );
|
||||
|
||||
m_header->setRefreshVisible( true );
|
||||
connect( m_header, SIGNAL( refresh() ), SLOT( onCollectionChanged() ) );
|
||||
@ -200,8 +205,6 @@ CollectionViewPage::setFlatModel( PlayableModel* model )
|
||||
|
||||
m_flatModel = model;
|
||||
m_trackView->setPlayableModel( model );
|
||||
m_trackView->setSortingEnabled( true );
|
||||
m_trackView->sortByColumn( 0, Qt::AscendingOrder );
|
||||
|
||||
if ( oldModel )
|
||||
{
|
||||
@ -389,6 +392,8 @@ CollectionViewPage::restoreViewMode()
|
||||
} else {
|
||||
setCurrentMode( mode );
|
||||
}
|
||||
|
||||
onCollectionChanged();
|
||||
}
|
||||
|
||||
|
||||
@ -445,14 +450,40 @@ CollectionViewPage::onCollectionChanged()
|
||||
void
|
||||
CollectionViewPage::onDownloadAll()
|
||||
{
|
||||
for ( int i = 0; i < m_flatModel->rowCount( QModelIndex() ); i++ )
|
||||
if ( DownloadManager::instance()->state() == DownloadManager::Running )
|
||||
{
|
||||
PlayableItem* item = m_flatModel->itemFromIndex( m_flatModel->index( i, 0, QModelIndex() ) );
|
||||
if ( !item )
|
||||
continue;
|
||||
DownloadManager::instance()->cancelAll();
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( int i = 0; i < m_trackView->proxyModel()->rowCount( QModelIndex() ); i++ )
|
||||
{
|
||||
PlayableItem* item = m_trackView->proxyModel()->itemFromIndex( m_trackView->proxyModel()->mapToSource( m_trackView->proxyModel()->index( i, 0, QModelIndex() ) ) );
|
||||
if ( !item )
|
||||
continue;
|
||||
|
||||
if ( !item->result()->downloadFormats().isEmpty() )
|
||||
DownloadManager::instance()->addJob( item->result()->toDownloadJob( item->result()->downloadFormats().first() ) );
|
||||
QList< DownloadFormat > formats = item->query()->results().first()->downloadFormats();
|
||||
if ( formats.isEmpty() || !DownloadManager::instance()->localFileForDownload( formats.first().url.toString() ).isEmpty() )
|
||||
continue;
|
||||
|
||||
if ( !item->result()->downloadFormats().isEmpty() )
|
||||
DownloadManager::instance()->addJob( item->result()->toDownloadJob( item->result()->downloadFormats().first() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CollectionViewPage::onDownloadManagerStateChanged( DownloadManager::DownloadManagerState newState, DownloadManager::DownloadManagerState oldState )
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO;
|
||||
if ( newState == DownloadManager::Running )
|
||||
{
|
||||
m_downloadAllButton->setText( tr( "Cancel Download" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_downloadAllButton->setText( tr( "Download All" ) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -467,5 +498,14 @@ CollectionViewPage::isTemporaryPage() const
|
||||
bool
|
||||
CollectionViewPage::isBeingPlayed() const
|
||||
{
|
||||
return m_playlistInterface->hasChildInterface( AudioEngine::instance()->currentTrackPlaylist() );
|
||||
if ( !playlistInterface() )
|
||||
return false;
|
||||
|
||||
if ( playlistInterface() == AudioEngine::instance()->currentTrackPlaylist() )
|
||||
return true;
|
||||
|
||||
if ( playlistInterface()->hasChildInterface( AudioEngine::instance()->currentTrackPlaylist() ) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -22,8 +22,10 @@
|
||||
|
||||
#include "ViewPage.h"
|
||||
#include "PlaylistInterface.h"
|
||||
#include "DownloadManager.h"
|
||||
#include "DllMacro.h"
|
||||
|
||||
class QPushButton;
|
||||
class QStackedWidget;
|
||||
|
||||
class GridView;
|
||||
@ -83,10 +85,12 @@ private slots:
|
||||
void onCollectionChanged();
|
||||
|
||||
void onDownloadAll();
|
||||
void onDownloadManagerStateChanged( DownloadManager::DownloadManagerState newState, DownloadManager::DownloadManagerState oldState );
|
||||
|
||||
private:
|
||||
FilterHeader* m_header;
|
||||
QPixmap m_pixmap;
|
||||
QPushButton* m_downloadAllButton;
|
||||
|
||||
ColumnView* m_columnView;
|
||||
TrackView* m_trackView;
|
||||
|
@ -100,6 +100,7 @@ SearchWidget::SearchWidget( const QString& search, QWidget* parent )
|
||||
ui->tracks->setItemWidth( TomahawkUtils::DpiScaler::scaledX( this, 140 ) );
|
||||
// ui->tracks->proxyModel()->setHideDupeItems( true );
|
||||
ui->tracks->delegate()->setWordWrapping( true );
|
||||
ui->tracks->delegate()->setShowBuyButtons( true );
|
||||
ui->tracks->setFixedHeight( ui->tracks->itemSize().height() + ui->tracks->spacing() * 2 );
|
||||
|
||||
m_resultsModel = new PlayableModel( ui->tracks );
|
||||
|
@ -132,10 +132,16 @@ BasicHeader::setPixmap( const QPixmap& pixmap, bool tinted )
|
||||
}
|
||||
|
||||
|
||||
QAbstractButton*
|
||||
QPushButton*
|
||||
BasicHeader::addButton( const QString& text )
|
||||
{
|
||||
QPushButton* button = new QPushButton( this );
|
||||
|
||||
button->setStyleSheet( "QPushButton:hover { font-size: 12px; color: #2b2b2b; background: #f8f8f8; border-style: solid; border-radius: 0px; border-width: 2px; border-color: #2b2b2b; }"
|
||||
"QPushButton { font-size: 12px; color: #ffffff; background-color: #000000; border-style: solid; border-radius: 0px; border-width: 0px; }" );
|
||||
button->setMinimumHeight( 30 );
|
||||
button->setMinimumWidth( 132 );
|
||||
|
||||
button->setText( text );
|
||||
|
||||
ui->horizontalLayout->addSpacing( 8 );
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "widgets/BackgroundWidget.h"
|
||||
#include "DllMacro.h"
|
||||
|
||||
class QPushButton;
|
||||
class QLabel;
|
||||
class ElidedLabel;
|
||||
class QPaintEvent;
|
||||
@ -40,7 +41,7 @@ public:
|
||||
|
||||
QScopedPointer<Ui::HeaderWidget> ui;
|
||||
|
||||
QAbstractButton* addButton( const QString& text );
|
||||
QPushButton* addButton( const QString& text );
|
||||
|
||||
public slots:
|
||||
virtual void setCaption( const QString& s );
|
||||
|
@ -32,7 +32,9 @@ using namespace Tomahawk;
|
||||
|
||||
DropDownButton::DropDownButton( QWidget* parent )
|
||||
: QComboBox( parent )
|
||||
, m_hovering( false )
|
||||
{
|
||||
setAttribute( Qt::WA_Hover, true );
|
||||
}
|
||||
|
||||
|
||||
@ -46,44 +48,59 @@ DropDownButton::paintEvent( QPaintEvent* event )
|
||||
{
|
||||
// QComboBox::paintEvent( event );
|
||||
QPainter p( this );
|
||||
drawPrimitive( &p, contentsRect(), currentText() );
|
||||
|
||||
setupPainter( &p );
|
||||
|
||||
drawPrimitive( &p, contentsRect(), currentText(), m_hovering, true );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DropDownButton::drawPrimitive( QPainter* p, const QRect& rect, const QString& text )
|
||||
DropDownButton::drawPrimitive( QPainter* p, const QRect& rect, const QString& text, bool hovering, bool itemsAvailable )
|
||||
{
|
||||
p->save();
|
||||
|
||||
setupPainter( p );
|
||||
|
||||
p->setRenderHint( QPainter::TextAntialiasing );
|
||||
QRect r = rect.adjusted( 2, 2, -2, -2 );
|
||||
|
||||
p->setPen( TomahawkStyle::PLAYLIST_BUTTON_BACKGROUND.darker() );
|
||||
p->setBrush( TomahawkStyle::PLAYLIST_BUTTON_BACKGROUND );
|
||||
QColor bgColor = hovering ? TomahawkStyle::PLAYLIST_BUTTON_HOVER_BACKGROUND : TomahawkStyle::PLAYLIST_BUTTON_BACKGROUND;
|
||||
|
||||
p->setOpacity( 1.0 );
|
||||
p->setPen( bgColor );
|
||||
p->setBrush( bgColor );
|
||||
p->drawRect( r );
|
||||
|
||||
// paint divider
|
||||
p->setPen( TomahawkStyle::PLAYLIST_BUTTON_FOREGROUND );
|
||||
p->drawLine( QPoint( r.right() - 24, r.top() + 3 ), QPoint( r.right() - 24, r.bottom() - 3 ) );
|
||||
|
||||
int dropdownWidth = 0;
|
||||
|
||||
// paint drop-down arrow
|
||||
p->save();
|
||||
QPainterPath dropPath;
|
||||
dropPath.moveTo( QPointF( r.right() - 14, float(r.top()) + float(r.height()) * 0.5 - 1.5 ) );
|
||||
QPointF currentPosition = dropPath.currentPosition();
|
||||
dropPath.lineTo( currentPosition.x() + 6, currentPosition.y() );
|
||||
dropPath.lineTo( currentPosition.x() + 3, currentPosition.y() + 3 );
|
||||
dropPath.closeSubpath();
|
||||
p->setPen( TomahawkStyle::PLAYLIST_BUTTON_FOREGROUND );
|
||||
p->setBrush( TomahawkStyle::PLAYLIST_BUTTON_FOREGROUND );
|
||||
p->setRenderHint( QPainter::Antialiasing, false );
|
||||
p->drawPath( dropPath );
|
||||
p->restore();
|
||||
if ( itemsAvailable )
|
||||
{
|
||||
// paint divider
|
||||
p->drawLine( QPoint( r.right() - 24, r.top() + 3 ), QPoint( r.right() - 24, r.bottom() - 3 ) );
|
||||
|
||||
// paint drop-down arrow
|
||||
p->save();
|
||||
QPainterPath dropPath;
|
||||
dropPath.moveTo( QPointF( r.right() - 14, float(r.top()) + float(r.height()) * 0.5 - 1.5 ) );
|
||||
QPointF currentPosition = dropPath.currentPosition();
|
||||
dropPath.lineTo( currentPosition.x() + 6, currentPosition.y() );
|
||||
dropPath.lineTo( currentPosition.x() + 3, currentPosition.y() + 3 );
|
||||
dropPath.closeSubpath();
|
||||
p->setPen( TomahawkStyle::PLAYLIST_BUTTON_FOREGROUND );
|
||||
p->setBrush( TomahawkStyle::PLAYLIST_BUTTON_FOREGROUND );
|
||||
p->setRenderHint( QPainter::Antialiasing, false );
|
||||
p->drawPath( dropPath );
|
||||
p->restore();
|
||||
|
||||
dropdownWidth = 24;
|
||||
}
|
||||
|
||||
// paint label
|
||||
const QFontMetrics fm( p->font() );
|
||||
r.adjust( 0, 0, -24, 0 ); // center-align left of the divider
|
||||
p->drawText( r, Qt::AlignCenter, fm.elidedText( text, Qt::ElideRight, r.width() ) );
|
||||
r.adjust( 0, 0, -dropdownWidth, 0 ); // center-align left of the divider
|
||||
p->drawText( r, Qt::AlignCenter, fm.elidedText( text.toUpper(), Qt::ElideRight, r.width() ) );
|
||||
|
||||
p->restore();
|
||||
}
|
||||
@ -101,3 +118,29 @@ DropDownButton::mousePressEvent( QMouseEvent* event )
|
||||
event->accept();
|
||||
emit clicked();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DropDownButton::enterEvent( QEvent * event )
|
||||
{
|
||||
m_hovering = true;
|
||||
QWidget::enterEvent(event);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DropDownButton::leaveEvent( QEvent* event )
|
||||
{
|
||||
m_hovering = false;
|
||||
QWidget::leaveEvent(event);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DropDownButton::setupPainter( QPainter* p )
|
||||
{
|
||||
QFont f = p->font();
|
||||
f.setPointSize( TomahawkUtils::defaultFontSize() - 1 );
|
||||
f.setBold( true );
|
||||
p->setFont( f );
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
explicit DropDownButton( QWidget* parent = 0 );
|
||||
virtual ~DropDownButton();
|
||||
|
||||
static void drawPrimitive( QPainter* p, const QRect& rect, const QString& text );
|
||||
static void drawPrimitive( QPainter* p, const QRect& rect, const QString& text, bool hovering, bool itemsAvailable );
|
||||
|
||||
public slots:
|
||||
|
||||
@ -42,10 +42,15 @@ signals:
|
||||
protected:
|
||||
void paintEvent( QPaintEvent* event );
|
||||
void mousePressEvent( QMouseEvent* event );
|
||||
void enterEvent( QEvent* event );
|
||||
void leaveEvent( QEvent* event );
|
||||
|
||||
private slots:
|
||||
|
||||
private:
|
||||
static void setupPainter( QPainter* p );
|
||||
|
||||
bool m_hovering;
|
||||
};
|
||||
|
||||
#endif // DROPDOWNBUTTON_H
|
||||
|
@ -1,5 +1,3 @@
|
||||
SET( TOMAHAWK_LIBRARIES tomahawklib )
|
||||
|
||||
SET( OS_SPECIFIC_LINK_LIBRARIES
|
||||
${OS_SPECIFIC_LINK_LIBRARIES}
|
||||
${COREAUDIO_LIBRARY}
|
||||
|
@ -1,5 +1,3 @@
|
||||
set(TOMAHAWK_APPLICATION_TARGET "tomahawk-bin")
|
||||
|
||||
include( ECMAddAppIcon )
|
||||
|
||||
# SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" )
|
||||
@ -9,6 +7,8 @@ IF( NOT CMAKE_BUILD_TYPE STREQUAL "Release" AND NOT CMAKE_BUILD_TYPE STREQUAL "R
|
||||
MESSAGE( "Building in debug mode, enabling all debug updates" )
|
||||
ENDIF()
|
||||
|
||||
set(TOMAHAWK_APPLICATION_TARGET ${TOMAHAWK_TARGET_NAME}-bin)
|
||||
|
||||
# build plugins
|
||||
# use glob, but hardcoded list for now:
|
||||
#FILE( GLOB plugindirs "src/plugins/*" )
|
||||
@ -154,19 +154,18 @@ else()
|
||||
ecm_add_app_icon(tomahawkSources ICONS ${TOMAHAWK_ICONS})
|
||||
endif()
|
||||
|
||||
|
||||
qt_add_resources( RC_SRCS "../../resources.qrc" )
|
||||
|
||||
SET( final_src ${final_src} ${tomahawkUI_H} ${tomahawkMoc} ${tomahawkSources} ${RC_SRCS} )
|
||||
|
||||
if(APPLE)
|
||||
set(TOMAHAWK_RUNTIME_OUTPUT_NAME "Tomahawk")
|
||||
if(APPLE OR WIN32)
|
||||
set(TOMAHAWK_RUNTIME_OUTPUT_NAME "${TOMAHAWK_APPLICATION_NAME}")
|
||||
else()
|
||||
set(TOMAHAWK_RUNTIME_OUTPUT_NAME "tomahawk")
|
||||
set(TOMAHAWK_RUNTIME_OUTPUT_NAME "${TOMAHAWK_TARGET_NAME}")
|
||||
endif()
|
||||
|
||||
ADD_EXECUTABLE( ${TOMAHAWK_APPLICATION_TARGET} WIN32 MACOSX_BUNDLE ${final_src} )
|
||||
SET_TARGET_PROPERTIES(${TOMAHAWK_APPLICATION_TARGET}
|
||||
SET_TARGET_PROPERTIES( ${TOMAHAWK_APPLICATION_TARGET}
|
||||
PROPERTIES
|
||||
AUTOMOC TRUE
|
||||
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_BINARY_DIR}/Info.plist"
|
||||
@ -210,8 +209,7 @@ TARGET_LINK_LIBRARIES( ${TOMAHAWK_APPLICATION_TARGET}
|
||||
IF( APPLE )
|
||||
IF( HAVE_SPARKLE )
|
||||
MESSAGE("Sparkle Found, installing framekwork in bundle")
|
||||
INSTALL(DIRECTORY "${SPARKLE}/Versions/Current/Resources" DESTINATION "${CMAKE_BINARY_DIR}/Tomahawk.app/Contents/Frameworks/Sparkle.framework")
|
||||
|
||||
INSTALL(DIRECTORY "${SPARKLE}/Versions/Current/Resources" DESTINATION "${CMAKE_BINARY_DIR}/${TOMAHAWK_APPLICATION_NAME}.app/Contents/Frameworks/Sparkle.framework")
|
||||
ENDIF( HAVE_SPARKLE )
|
||||
ENDIF( APPLE )
|
||||
|
||||
|
@ -608,14 +608,14 @@ TomahawkApp::initSIP()
|
||||
void
|
||||
TomahawkApp::onShutdownDelayed()
|
||||
{
|
||||
QProgressDialog* d = new QProgressDialog( tr( "Tomahawk is updating the database. Please wait, this may take a minute!" ), QString(),
|
||||
QProgressDialog* d = new QProgressDialog( tr( "%applicationName is updating the database. Please wait, this may take a minute!" ), QString(),
|
||||
0, 0, 0, Qt::Tool
|
||||
| Qt::WindowTitleHint
|
||||
| Qt::CustomizeWindowHint );
|
||||
d->setModal( true );
|
||||
d->setAutoClose( false );
|
||||
d->setAutoReset( false );
|
||||
d->setWindowTitle( tr( "Tomahawk" ) );
|
||||
d->setWindowTitle( tr( "%applicationName" ) );
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
d->setAttribute( Qt::WA_MacAlwaysShowToolWindow );
|
||||
@ -642,7 +642,7 @@ TomahawkApp::onInfoSystemReady()
|
||||
{
|
||||
tDebug() << "Init MainWindow.";
|
||||
m_mainwindow = new TomahawkWindow();
|
||||
m_mainwindow->setWindowTitle( "Tomahawk" );
|
||||
m_mainwindow->setWindowTitle( tr( "%applicationName" ) );
|
||||
m_mainwindow->setObjectName( "TH_Main_Window" );
|
||||
if ( !arguments().contains( "--hide" ) )
|
||||
{
|
||||
|
@ -67,13 +67,15 @@ TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent )
|
||||
m_contextMenu->addSeparator();
|
||||
m_contextMenu->addAction( ac->getAction( "previousTrack" ) );
|
||||
m_contextMenu->addAction( ac->getAction( "nextTrack" ) );
|
||||
/*
|
||||
m_contextMenu->addSeparator();
|
||||
m_contextMenu->addAction( ActionCollection::instance()->getAction( "togglePrivacy" ) );
|
||||
*/
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
// On mac you can close the windows while leaving the app open. We then need a way to show the main window again
|
||||
m_contextMenu->addSeparator();
|
||||
m_showWindowAction = m_contextMenu->addAction( tr( "Hide Tomahawk Window" ) );
|
||||
m_showWindowAction = m_contextMenu->addAction( tr( "Hide %applicationName Window" ) );
|
||||
m_showWindowAction->setData( true );
|
||||
connect( m_showWindowAction, SIGNAL( triggered() ), this, SLOT( showWindow() ) );
|
||||
|
||||
@ -112,12 +114,12 @@ TomahawkTrayIcon::setShowHideWindow( bool show )
|
||||
{
|
||||
if ( show )
|
||||
{
|
||||
m_showWindowAction->setText( tr( "Hide Tomahawk Window" ) );
|
||||
m_showWindowAction->setText( tr( "Hide %applicationName Window" ) );
|
||||
m_showWindowAction->setData( show );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_showWindowAction->setText( tr( "Show Tomahawk Window" ) );
|
||||
m_showWindowAction->setText( tr( "Show %applicationName Window" ) );
|
||||
}
|
||||
|
||||
m_showWindowAction->setData( show );
|
||||
|
@ -84,6 +84,8 @@
|
||||
#include "dialogs/LoadPlaylistDialog.h"
|
||||
#include "utils/ImageRegistry.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/GuiHelpers.h"
|
||||
#include "libtomahawk/widgets/ImageButton.h"
|
||||
|
||||
#include "config.h"
|
||||
|
||||
@ -1269,11 +1271,11 @@ TomahawkWindow::showAboutTomahawk()
|
||||
QString head, desc;
|
||||
|
||||
#ifdef QT_DEBUG
|
||||
head = tr( "<h2><b>Tomahawk %1<br/>(%2)</h2>" )
|
||||
head = tr( "<h2><b>%applicationName %1<br/>(%2)</h2>" )
|
||||
.arg( TomahawkUtils::appFriendlyVersion() )
|
||||
.arg( qApp->applicationVersion() );
|
||||
#else
|
||||
head = tr( "<h2><b>Tomahawk %1</h2>" )
|
||||
head = tr( "<h2><b>%applicationName %1</h2>" )
|
||||
.arg( TomahawkUtils::appFriendlyVersion() );
|
||||
#endif
|
||||
|
||||
@ -1285,7 +1287,7 @@ TomahawkWindow::showAboutTomahawk()
|
||||
.arg( copyright )
|
||||
.arg( thanksto );
|
||||
|
||||
QMessageBox::about( this, tr( "About Tomahawk" ), head + desc );
|
||||
QMessageBox::about( this, tr( "About %applicationName" ), head + desc );
|
||||
}
|
||||
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Tomahawk</string>
|
||||
<string>%applicationName</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
|
@ -68,7 +68,7 @@ DiagnosticsDialog::updateLogView()
|
||||
{
|
||||
QString log;
|
||||
|
||||
log.append( QString( "TOMAHAWK DIAGNOSTICS LOG -%1 \n\n" ).arg( QDateTime::currentDateTime().toString() ) );
|
||||
log.append( QString( "%applicationName DIAGNOSTICS LOG -%1 \n\n" ).arg( QDateTime::currentDateTime().toString() ) );
|
||||
log.append( "TOMAHAWK-VERSION: " TOMAHAWK_VERSION "\n" );
|
||||
log.append( "PLATFORM: " TOMAHAWK_SYSTEM "\n");
|
||||
log.append( QString( "DBID: %1\n\n" ).arg( Tomahawk::Database::instance()->impl()->dbid() ) );
|
||||
|
@ -17,7 +17,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Tomahawk Diagnostics</string>
|
||||
<string>%applicationName Diagnostics</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="margin">
|
||||
|
@ -267,20 +267,20 @@ SettingsDialog::SettingsDialog(QObject *parent )
|
||||
// #endif
|
||||
|
||||
m_dialog->addTab( m_accountsWidget, TomahawkUtils::defaultPixmap( TomahawkUtils::AccountSettings ),
|
||||
tr( "Plug-Ins" ), tr( "Configure the accounts and services used by Tomahawk "
|
||||
tr( "Plug-Ins" ), tr( "Configure the accounts and services used by %applicationName "
|
||||
"to search and retrieve music, find your friends and "
|
||||
"update your status." ) );
|
||||
|
||||
m_dialog->addTab( m_collectionWidget, TomahawkUtils::defaultPixmap( TomahawkUtils::MusicSettings ),
|
||||
tr( "Collection" ), tr( "Manage how Tomahawk finds music on your computer." ) );
|
||||
tr( "Collection" ), tr( "Manage how %applicationName finds music on your computer." ) );
|
||||
|
||||
m_dialog->addTab( m_advancedWidget, TomahawkUtils::defaultPixmap( TomahawkUtils::AdvancedSettings ),
|
||||
tr( "Advanced" ), tr( "Configure Tomahawk's advanced settings, including "
|
||||
tr( "Advanced" ), tr( "Configure %applicationName advanced settings, including "
|
||||
"network connectivity settings, browser interaction "
|
||||
"and more." ) );
|
||||
|
||||
m_dialog->addTab( m_downloadsWidget, TomahawkUtils::defaultPixmap( TomahawkUtils::DownloadsSettings ),
|
||||
tr( "Downloads" ), tr( "Configure Tomahawk's integrated download manager." ) );
|
||||
tr( "Downloads" ), tr( "Configure %applicationName's integrated download manager." ) );
|
||||
|
||||
m_dialog->setCurrentIndex( 0 );
|
||||
|
||||
@ -333,7 +333,7 @@ SettingsDialog::saveSettings()
|
||||
s->sync();
|
||||
|
||||
if ( m_restartRequired )
|
||||
QMessageBox::information( 0, tr( "Information" ), tr( "Some changed settings will not take effect until Tomahawk is restarted" ) );
|
||||
QMessageBox::information( 0, tr( "Information" ), tr( "Some changed settings will not take effect until %applicationName is restarted" ) );
|
||||
|
||||
// m_collectionWidgetUi->dirTree->cleanup();
|
||||
|
||||
@ -586,9 +586,9 @@ SettingsDialog::openAccountConfig( Account* account, bool showDelete )
|
||||
void
|
||||
SettingsDialog::installFromFile()
|
||||
{
|
||||
const QString resolver = QFileDialog::getOpenFileName( m_accountsWidget, tr( "Install resolver from file" ),
|
||||
const QString resolver = QFileDialog::getOpenFileName( m_accountsWidget, tr( "Install plug-in from file" ),
|
||||
TomahawkSettings::instance()->scriptDefaultPath(),
|
||||
tr( "Tomahawk Resolvers (*.axe *.js);;"
|
||||
tr( "%applicationName Plug-Ins (*.axe *.js);;"
|
||||
"All files (*)" ),
|
||||
0,
|
||||
QFileDialog::ReadOnly );
|
||||
|
@ -177,7 +177,7 @@
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Allow web browsers to interact with Tomahawk (recommended)</string>
|
||||
<string>Allow web browsers to interact with %applicationName (recommended)</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
@ -190,7 +190,7 @@
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Allow other computers to interact with Tomahawk (not recommended yet)</string>
|
||||
<string>Allow other computers to interact with %applicationName (not recommended yet)</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
@ -203,7 +203,7 @@
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Send Tomahawk Crash Reports</string>
|
||||
<string>Send %applicationName Crash Reports</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
|
@ -50,7 +50,7 @@
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Due to the unique way Tomahawk works, your music files must at least have Artist & Title metadata/ID3 tags to be added to your Collection.</string>
|
||||
<string>Due to the unique way %applicationName works, your music files must at least have Artist & Title metadata/ID3 tags to be added to your Collection.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
|
@ -211,7 +211,7 @@
|
||||
#ifdef HAVE_SPARKLE
|
||||
- (void)updater:(SUUpdater *)updater willInstallUpdate:(SUAppcastItem *)update
|
||||
{
|
||||
tLog() << "NSApp in willInstallUpdate, deleting Phonon objects";
|
||||
// tLog() << "NSApp in willInstallUpdate, deleting Phonon objects";
|
||||
AudioEngine::instance()->stop();
|
||||
delete AudioEngine::instance();
|
||||
}
|
||||
|
@ -41,6 +41,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef WITH_CRASHREPORTER
|
||||
#include "TomahawkVersion.h"
|
||||
#include "libcrashreporter-handler/Handler.h"
|
||||
#endif
|
||||
|
||||
@ -186,7 +187,7 @@ main( int argc, char *argv[] )
|
||||
TomahawkApp a( argc, argv );
|
||||
|
||||
#ifdef WITH_CRASHREPORTER
|
||||
CrashReporter::Handler* handler = new CrashReporter::Handler( QDir::tempPath(), !TomahawkUtils::headless(), "tomahawk_crash_reporter" );
|
||||
CrashReporter::Handler* handler = new CrashReporter::Handler( QDir::tempPath(), !TomahawkUtils::headless(), TOMAHAWK_TARGET_NAME "_crash_reporter" );
|
||||
#endif
|
||||
|
||||
// MUST register StateHash ****before*** initing TomahawkSettingsGui as constructor of settings does upgrade before Gui subclass registers type
|
||||
|
@ -1,40 +1,21 @@
|
||||
set(TOMAHAWK_TOOL_DB_LIST_ARTISTS_TARGET ${TOMAHAWK_TARGET_NAME}-db-list-artists)
|
||||
|
||||
set( tomahawk_db_list_artists_src
|
||||
listartists.cpp
|
||||
)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_executable( tomahawk_db_list_artists_bin WIN32 MACOSX_BUNDLE
|
||||
add_executable( ${TOMAHAWK_TOOL_DB_LIST_ARTISTS_TARGET} WIN32 MACOSX_BUNDLE
|
||||
${tomahawk_db_list_artists_src} )
|
||||
set_target_properties( tomahawk_db_list_artists_bin
|
||||
set_target_properties( ${TOMAHAWK_TOOL_DB_LIST_ARTISTS_TARGET}
|
||||
PROPERTIES
|
||||
AUTOMOC TRUE
|
||||
RUNTIME_OUTPUT_NAME tomahawk-db-list-artists
|
||||
)
|
||||
target_link_libraries( tomahawk_db_list_artists_bin
|
||||
target_link_libraries( ${TOMAHAWK_TOOL_DB_LIST_ARTISTS_TARGET}
|
||||
${TOMAHAWK_LIBRARIES}
|
||||
)
|
||||
|
||||
qt5_use_modules(tomahawk_db_list_artists_bin Core)
|
||||
install( TARGETS tomahawk_db_list_artists_bin BUNDLE DESTINATION . RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} )
|
||||
|
||||
set( tomahawk_db_fuzzysearch_src
|
||||
fuzzysearch.cpp
|
||||
)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_executable( tomahawk_db_fuzzysearch_bin WIN32 MACOSX_BUNDLE
|
||||
${tomahawk_db_fuzzysearch_src} )
|
||||
set_target_properties( tomahawk_db_fuzzysearch_bin
|
||||
PROPERTIES
|
||||
AUTOMOC TRUE
|
||||
RUNTIME_OUTPUT_NAME tomahawk-db-fuzzysearch
|
||||
)
|
||||
target_link_libraries( tomahawk_db_fuzzysearch_bin
|
||||
${TOMAHAWK_LIBRARIES}
|
||||
)
|
||||
|
||||
qt5_use_modules(tomahawk_db_list_artists_bin Core)
|
||||
install( TARGETS tomahawk_db_list_artists_bin BUNDLE DESTINATION . RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} )
|
||||
qt5_use_modules(${TOMAHAWK_TOOL_DB_LIST_ARTISTS_TARGET} Core)
|
||||
install( TARGETS ${TOMAHAWK_TOOL_DB_LIST_ARTISTS_TARGET} BUNDLE DESTINATION . RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} )
|
||||
|
||||
|
@ -1,17 +1,19 @@
|
||||
set(TOMAHAWK_TOOL_MUSICSCAN_TARGET ${TOMAHAWK_TARGET_NAME}-musicscan)
|
||||
|
||||
set( tomahawk_test_musicscan_src
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable( tomahawk_test_musicscan_bin WIN32 MACOSX_BUNDLE
|
||||
add_executable( ${TOMAHAWK_TOOL_MUSICSCAN_TARGET} WIN32 MACOSX_BUNDLE
|
||||
${tomahawk_test_musicscan_src} )
|
||||
set_target_properties( tomahawk_test_musicscan_bin
|
||||
set_target_properties( ${TOMAHAWK_TOOL_MUSICSCAN_TARGET}
|
||||
PROPERTIES
|
||||
AUTOMOC TRUE
|
||||
RUNTIME_OUTPUT_NAME tomahawk-test-musicscan
|
||||
)
|
||||
target_link_libraries( tomahawk_test_musicscan_bin
|
||||
|
||||
target_link_libraries( ${TOMAHAWK_TOOL_MUSICSCAN_TARGET}
|
||||
${TOMAHAWK_LIBRARIES}
|
||||
)
|
||||
|
||||
qt5_use_modules(tomahawk_test_musicscan_bin Core Gui Network Widgets)
|
||||
install( TARGETS tomahawk_test_musicscan_bin BUNDLE DESTINATION . RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} )
|
||||
qt5_use_modules(${TOMAHAWK_TOOL_MUSICSCAN_TARGET} Core Gui Network Widgets)
|
||||
install( TARGETS ${TOMAHAWK_TOOL_MUSICSCAN_TARGET} BUNDLE DESTINATION . RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} )
|
||||
|
@ -6,5 +6,5 @@ tomahawk_add_plugin(charts
|
||||
UI
|
||||
ChartsWidget.ui
|
||||
LINK_LIBRARIES
|
||||
tomahawk-widgets
|
||||
${TOMAHAWK_WIDGETS_LIBRARIES}
|
||||
)
|
||||
|
@ -6,5 +6,5 @@ tomahawk_add_plugin(dashboard
|
||||
UI
|
||||
DashboardWidget.ui
|
||||
LINK_LIBRARIES
|
||||
tomahawk-widgets
|
||||
${TOMAHAWK_WIDGETS_LIBRARIES}
|
||||
)
|
||||
|
@ -6,5 +6,5 @@ tomahawk_add_plugin(newreleases
|
||||
UI
|
||||
NewReleasesWidget.ui
|
||||
LINK_LIBRARIES
|
||||
tomahawk-widgets
|
||||
${TOMAHAWK_WIDGETS_LIBRARIES}
|
||||
)
|
||||
|
@ -6,5 +6,5 @@ tomahawk_add_plugin(whatsnew_0_8
|
||||
UI
|
||||
WhatsNewWidget_0_8.ui
|
||||
LINK_LIBRARIES
|
||||
tomahawk-widgets
|
||||
${TOMAHAWK_WIDGETS_LIBRARIES}
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user