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

Compare commits

..

1 Commits

Author SHA1 Message Date
Dominik Schmidt
a366947270 Try to fix compilation with qt4 2016-02-21 10:27:48 +01:00
34 changed files with 91 additions and 300 deletions

View File

@@ -1,7 +1,6 @@
Version 0.9.0:
* Resolved various playback issues by switching to a new audio engine.
* Fixed collection sorting.
* Fixed volume/mute state not being reset correctly on startup.
Version 0.8.4:
* Fixed drag & drop issues on sidebar.

View File

@@ -46,7 +46,7 @@ CERT_SIGNER=$2
cd ..
if [ -f ~/sign_step.sh ];
then
~/sign_step.sh "$CERT_SIGNER" "${TARGET_NAME}.app"
~/sign_step.sh "$CERT_SIGNER" "${TARGET_NAME}.app" || true
fi
header "Creating DMG"

View File

@@ -9,20 +9,19 @@ fi
rm -rvf vlc/
VLC_TARBALL="vlc.tar.bz2"
echo "Download phonon archive..."
# wget -c "http://downloads.sourceforge.net/project/vlc/1.1.9/win32/vlc-1.1.9-win32.7z?r=http%3A%2F%2Fwww.videolan.org%2Fvlc%2Fdownload-windows.html&ts=1306272584&use_mirror=leaseweb"
# wget -c "http://download.tomahawk-player.org/tomahawk-vlc-0.1.zip"
# wget -c http://people.videolan.org/~jb/phonon/phonon-vlc-last.7z
# wget -c http://people.videolan.org/~jb/phonon/phonon_phonon-vlc_20111128.7z
wget -c "http://download.tomahawk-player.org/test/$VLC_TARBALL"
wget -c http://download.tomahawk-player.org/test/vlc.tar.bz2
echo "Extract binary..."
# 7z x phonon*.7z
# mv -v vlc-*/ vlc/
# unzip tomahawk-vlc-0.1.zip
tar xvjf "$VLC_TARBALL"
tar xvjf vlc.tar.bz2
# echo "Download phonon_vlc_no_video.dll..."
# wget -c http://people.videolan.org/~jb/phonon/phonon_vlc_no_video.dll
@@ -73,9 +72,7 @@ rm -rvf \
**/libi420* \
**/libi422* \
mux/ \
stream_filter/*dash* \
stream_filter/*smooth* \
stream_filter/*record* \
stream_filter/ \
**/libtheora_plugin* \
**/liblibbluray_plugin* \
**/libdtv_plugin* \

Binary file not shown.

View File

@@ -170,6 +170,5 @@
<file>data/images/downloadbutton.svg</file>
<file>data/images/nav-back.svg</file>
<file>data/images/nav-forward.svg</file>
<file>data/sounds/silence.ogg</file>
</qresource>
</RCC>

View File

@@ -24,7 +24,6 @@ tomahawk_add_library(${TOMAHAWK_PLAYDARAPI_LIBRARY_TARGET}
qtcertificateaddon
${GNUTLS_LIBRARIES}
EXPORT TomahawkLibraryDepends
EXPORT_MACRO TOMAHAWK_WIDGETS_EXPORT_PRO
VERSION ${TOMAHAWK_VERSION_SHORT}
)

View File

@@ -23,7 +23,7 @@
#include <QtCore/qglobal.h>
#ifndef TOMAHAWK_PLAYDARAPI_EXPORT
# if defined (TOMAHAWK_WIDGETS_EXPORT_PRO)
# if defined (tomahawk_playdarapi_EXPORTS)
# define TOMAHAWK_PLAYDARAPI_EXPORT Q_DECL_EXPORT
# else
# define TOMAHAWK_PLAYDARAPI_EXPORT Q_DECL_IMPORT

View File

@@ -13,6 +13,5 @@ tomahawk_add_library(${TOMAHAWK_WIDGETS_LIBRARY_TARGET}
SOURCES ${${TOMAHAWK_WIDGETS_LIBRARY_TARGET}_SOURCES}
UI ${${TOMAHAWK_WIDGETS_LIBRARY_TARGET}_UI}
EXPORT TomahawkLibraryDepends
EXPORT_MACRO TOMAHAWK_WIDGETS_EXPORT_PRO
VERSION ${TOMAHAWK_VERSION_SHORT}
)

View File

@@ -23,7 +23,7 @@
#include <QtCore/qglobal.h>
#ifndef TOMAHAWK_WIDGETS_EXPORT
# if defined (TOMAHAWK_WIDGETS_EXPORT_PRO)
# if defined (tomahawk_widgets_EXPORTS)
# define TOMAHAWK_WIDGETS_EXPORT Q_DECL_EXPORT
# else
# define TOMAHAWK_WIDGETS_EXPORT Q_DECL_IMPORT

View File

@@ -223,10 +223,9 @@ ContextMenu::setQueries( const QList<Tomahawk::query_ptr>& queries )
m_sigmap->setMapping( addAction( tr( "&Copy Track Link" ) ), ActionCopyLink );
}
if ( m_supportedActions & ActionOpenFileManager &&
queries.length() == 1 &&
if ( m_supportedActions & ActionOpenFileManager && queries.length() == 1 &&
queries.first()->numResults() &&
queries.first()->results().first()->isLocal() )
queries.first()->results().first()->resolvedByCollection()->isLocal() )
{
m_sigmap->setMapping( addAction( ImageRegistry::instance()->icon( RESPATH "images/folder.svg" ),
tr( "Open Folder in File Manager..." ) ), ActionOpenFileManager );

View File

@@ -980,7 +980,7 @@ DropJob::removeRemoteSources()
foreach ( const Tomahawk::result_ptr& result, item->results() )
{
if ( !result->isLocal() )
if ( !result->resolvedByCollection().isNull() && !result->resolvedByCollection()->isLocal() )
{
list.append( item );
break;

View File

@@ -401,7 +401,7 @@ Query::resultSorter( const result_ptr& left, const result_ptr& right )
if ( ls == rs )
{
if ( right->isLocal() )
if ( right->resolvedByCollection() && right->resolvedByCollection()->isLocal() )
{
return false;
}

View File

@@ -234,13 +234,6 @@ Result::playable() const
}
bool
Result::isLocal() const
{
return resolvedByCollection().isNull() ? false : resolvedByCollection()->isLocal();
}
QVariant
Result::toVariant() const
{

View File

@@ -94,12 +94,6 @@ public:
bool isOnline() const;
bool playable() const;
/**
* @brief whether this result isLocal, i.e. resolved by a local collection
* @return isLocal
*/
bool isLocal() const;
QString url() const;
/**
* Has the given url been checked that it is accessible/valid.

View File

@@ -929,20 +929,6 @@ TomahawkSettings::setVolume( unsigned int volume )
}
bool
TomahawkSettings::muted() const
{
return value( "audio/muted" ).toBool();
}
void
TomahawkSettings::setMuted( bool muted )
{
setValue( "audio/muted", muted );
}
QString
TomahawkSettings::proxyHost() const
{

View File

@@ -107,9 +107,6 @@ public:
unsigned int volume() const;
void setVolume( unsigned int volume );
bool muted() const;
void setMuted( bool muted );
/// Playlist stuff
QByteArray playlistColumnSizes( const QString& playlistid ) const;
void setPlaylistColumnSizes( const QString& playlistid, const QByteArray& state );

View File

@@ -68,7 +68,6 @@ DelegateConfigWrapper::DelegateConfigWrapper( Tomahawk::Accounts::Account* accou
h->setContentsMargins( m_widget->contentsMargins() );
m_errorLabel->setAlignment( Qt::AlignCenter );
m_errorLabel->setWordWrap( true );
v->addWidget( m_errorLabel );
v->addLayout( h );

View File

@@ -167,17 +167,10 @@ AudioEngine::AudioEngine()
d->audioOutput = new AudioOutput( this );
connect( d->audioOutput, SIGNAL( initialized() ), this, SIGNAL( initialized() ) );
connect( d->audioOutput, SIGNAL( stateChanged( AudioOutput::AudioState, AudioOutput::AudioState ) ), d_func(), SLOT( onStateChanged( AudioOutput::AudioState, AudioOutput::AudioState ) ) );
connect( d->audioOutput, SIGNAL( tick( qint64 ) ), SLOT( timerTriggered( qint64 ) ) );
connect( d->audioOutput, SIGNAL( positionChanged( float ) ), SLOT( onPositionChanged( float ) ) );
connect( d->audioOutput, SIGNAL( volumeChanged( qreal ) ), SLOT( onVolumeChanged( qreal ) ) );
connect( d->audioOutput, SIGNAL( mutedChanged( bool ) ), SIGNAL( mutedChanged( bool ) ) );
if ( TomahawkSettings::instance()->muted() )
{
mute();
}
setVolume( TomahawkSettings::instance()->volume() );
qRegisterMetaType< AudioErrorCode >("AudioErrorCode");
@@ -190,7 +183,6 @@ AudioEngine::~AudioEngine()
tDebug() << Q_FUNC_INFO;
TomahawkSettings::instance()->setVolume( volume() );
TomahawkSettings::instance()->setMuted( isMuted() );
delete d_ptr;
}
@@ -297,11 +289,8 @@ AudioEngine::stop( AudioErrorCode errorCode )
if ( d->waitingOnNewTrack )
sendWaitingNotification();
if ( d->audioOutput->isInitialized() )
{
Tomahawk::InfoSystem::InfoPushData pushData( s_aeInfoIdentifier, Tomahawk::InfoSystem::InfoNowStopped, QVariant(), Tomahawk::InfoSystem::PushNoFlag );
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( pushData );
}
Tomahawk::InfoSystem::InfoPushData pushData( s_aeInfoIdentifier, Tomahawk::InfoSystem::InfoNowStopped, QVariant(), Tomahawk::InfoSystem::PushNoFlag );
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( pushData );
}
@@ -577,12 +566,6 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
Q_D( AudioEngine );
tDebug( LOGEXTRA ) << Q_FUNC_INFO << ( result.isNull() ? QString() : result->url() );
if ( !d->audioOutput->isInitialized() )
{
return;
}
if ( !result )
{
stop();

View File

@@ -149,8 +149,6 @@ public slots:
void setShuffled( bool enabled );
signals:
void initialized();
void loading( const Tomahawk::result_ptr track );
void started( const Tomahawk::result_ptr track );
void finished( const Tomahawk::result_ptr track );

View File

@@ -25,13 +25,11 @@
#include "audio/MediaStream.h"
#include "utils/Logger.h"
#include "utils/TomahawkUtils.h"
#include <QApplication>
#include <QVarLengthArray>
#include <QFile>
#include <QDir>
#include <QTimer>
#include <vlc/libvlc.h>
#include <vlc/libvlc_media.h>
@@ -60,7 +58,6 @@ AudioOutput::AudioOutput( QObject* parent )
, m_currentTime( 0 )
, m_totalTime( 0 )
, m_justSeeked( false )
, m_initialized( false )
, dspPluginCallback( nullptr )
, m_vlcInstance( nullptr )
, m_vlcPlayer( nullptr )
@@ -98,8 +95,8 @@ AudioOutput::AudioOutput( QObject* parent )
TOMAHAWK_APPLICATION_NAME "/" TOMAHAWK_VERSION );
// FIXME: icon is named tomahawk, so we need the lowercase application name
#if (LIBVLC_VERSION_INT >= LIBVLC_VERSION(2, 1, 0, 0))
libvlc_set_app_id( m_vlcInstance, TOMAHAWK_APPLICATION_PACKAGE_NAME,
TOMAHAWK_VERSION, TOMAHAWK_TARGET_NAME );
libvlc_set_app_id( m_vlcInstance, "org.tomahawk-player.desktop",
TOMAHAWK_VERSION, "tomahawk" );
#endif
m_vlcPlayer = libvlc_media_player_new( m_vlcInstance );
@@ -123,11 +120,6 @@ AudioOutput::AudioOutput( QObject* parent )
libvlc_MediaPlayerTitleChanged,
libvlc_MediaPlayerSnapshotTaken,
//libvlc_MediaPlayerLengthChanged,
#if (LIBVLC_VERSION_INT >= LIBVLC_VERSION(2, 2, 2, 0))
libvlc_MediaPlayerAudioVolume,
libvlc_MediaPlayerMuted,
libvlc_MediaPlayerUnmuted,
#endif
libvlc_MediaPlayerVout
};
const int eventCount = sizeof(events) / sizeof( *events );
@@ -136,24 +128,8 @@ AudioOutput::AudioOutput( QObject* parent )
libvlc_event_attach( manager, events[ i ], &AudioOutput::vlcEventCallback, this );
}
// HACK: play silent ogg file and set volume on that to workaround vlc not allowing to set volume before a file is played
m_silenceFile.setFileName( RESPATH "sounds/silence.ogg" );
Q_ASSERT( m_silenceFile.exists() );
Q_ASSERT( m_silenceFile.open( QIODevice::ReadOnly ) );
setCurrentSource( new MediaStream( &m_silenceFile, true ) );
libvlc_media_player_play( m_vlcPlayer );
#if QT_VERSION >= QT_VERSION_CHECK(5,4,0)
// if the silence file did not play for 15 secs, we pretend the AudioOutput is initialized, to allow proper error reporting
QTimer::singleShot( 15000, [&]()
{
if ( !m_initialized ) {
m_initialized = true;
emit initialized();
}
} );
#endif
m_muted = isMuted();
tDebug() << Q_FUNC_INFO << "Init OK";
}
@@ -179,28 +155,6 @@ AudioOutput::~AudioOutput()
}
void
AudioOutput::onInitVlcEvent( const libvlc_event_t* event )
{
switch ( event->type )
{
case libvlc_MediaPlayerTimeChanged:
setVolume( volume() );
setMuted( isMuted() );
m_initialized = true;
m_silenceFile.close();
tDebug() << Q_FUNC_INFO << "Init OK";
emit initialized();
break;
default:
break;
}
}
void
AudioOutput::setAutoDelete( bool ad )
{
@@ -349,13 +303,6 @@ AudioOutput::setCurrentSource( MediaStream* stream )
}
bool
AudioOutput::isInitialized() const
{
return m_initialized;
}
AudioOutput::AudioState
AudioOutput::state() const
{
@@ -510,7 +457,7 @@ AudioOutput::isSeekable() const
bool
AudioOutput::isMuted() const
{
return m_muted;
return libvlc_audio_get_mute( m_vlcPlayer );
}
@@ -583,20 +530,6 @@ AudioOutput::onVlcEvent( const libvlc_event_t* event )
// Don't call stop() here - it will deadlock libvlc
setState( Error );
break;
#if (LIBVLC_VERSION_INT >= LIBVLC_VERSION(2, 2, 2, 0))
case libvlc_MediaPlayerAudioVolume:
m_volume = event->u.media_player_audio_volume.volume;
emit volumeChanged( volume() );
break;
case libvlc_MediaPlayerMuted:
m_muted = true;
emit mutedChanged( true );
break;
case libvlc_MediaPlayerUnmuted:
m_muted = false;
emit mutedChanged( false );
break;
#endif
case libvlc_MediaPlayerNothingSpecial:
case libvlc_MediaPlayerOpening:
case libvlc_MediaPlayerBuffering:
@@ -622,14 +555,7 @@ AudioOutput::vlcEventCallback( const libvlc_event_t* event, void* opaque )
AudioOutput* that = reinterpret_cast < AudioOutput * > ( opaque );
Q_ASSERT( that );
if ( !that->isInitialized() )
{
that->onInitVlcEvent( event );
}
else
{
that->onVlcEvent( event );
}
that->onVlcEvent( event );
}

View File

@@ -25,8 +25,6 @@
#include "DllMacro.h"
#include "Typedefs.h"
#include <QFile>
#include <functional>
struct libvlc_instance_t;
@@ -46,7 +44,6 @@ public:
explicit AudioOutput( QObject* parent = nullptr );
~AudioOutput();
bool isInitialized() const;
AudioState state() const;
void setCurrentSource( const QUrl& stream );
@@ -75,16 +72,11 @@ public:
public slots:
signals:
void initialized();
void stateChanged( AudioOutput::AudioState, AudioOutput::AudioState );
void tick( qint64 );
void positionChanged( float );
void volumeChanged( qreal volume );
void mutedChanged( bool );
private:
void onInitVlcEvent( const libvlc_event_t* event );
void setState( AudioState state );
void setCurrentTime( qint64 time );
void setCurrentPosition( float position );
@@ -107,9 +99,6 @@ private:
qint64 m_totalTime;
bool m_justSeeked;
bool m_initialized;
QFile m_silenceFile;
std::function< void( int state, int frameNumber, float* samples, int nb_channels, int nb_samples ) > dspPluginCallback;
libvlc_instance_t* m_vlcInstance;

View File

@@ -41,16 +41,12 @@ MediaStream::MediaStream( const QUrl &url )
}
MediaStream::MediaStream( QIODevice* device, bool bufferingFinished )
MediaStream::MediaStream( QIODevice* device )
: QObject( nullptr )
, m_type( IODevice )
, m_ioDevice ( device )
, m_bufferingFinished( bufferingFinished )
{
if ( !bufferingFinished )
{
QObject::connect( m_ioDevice, SIGNAL( readChannelFinished() ), this, SLOT( bufferingFinished() ) );
}
QObject::connect( m_ioDevice, SIGNAL( readChannelFinished() ), this, SLOT( bufferingFinished() ) );
}

View File

@@ -42,7 +42,7 @@ public:
MediaStream( QObject* parent = nullptr );
explicit MediaStream( const QUrl &url );
explicit MediaStream( QIODevice* device, bool bufferingFinished = false );
explicit MediaStream( QIODevice* device );
virtual ~MediaStream();
MediaType type() const;

View File

@@ -240,7 +240,7 @@ MetadataEditor::loadResult( const Tomahawk::result_ptr& result )
return;
m_result = result;
setEditable( result->isLocal() );
setEditable( result->resolvedByCollection() && result->resolvedByCollection()->isLocal() );
setTitle( result->track()->track() );
setArtist( result->track()->artist() );
@@ -250,7 +250,7 @@ MetadataEditor::loadResult( const Tomahawk::result_ptr& result )
setYear( result->track()->year() );
setBitrate( result->bitrate() );
if ( result->isLocal() )
if ( result->resolvedByCollection() && result->resolvedByCollection()->isLocal() )
{
QString furl = m_result->url();
if ( furl.startsWith( "file://" ) )

View File

@@ -18,6 +18,12 @@
#include "TrackDetailView.h"
#include <QLabel>
#include <QPushButton>
#include <QScrollArea>
#include <QSizePolicy>
#include <QVBoxLayout>
#include "Album.h"
#include "Track.h"
#include "audio/AudioEngine.h"
@@ -33,13 +39,6 @@
#include "utils/WebPopup.h"
#include "utils/Logger.h"
#include <QLabel>
#include <QPushButton>
#include <QScrollArea>
#include <QSizePolicy>
#include <QVBoxLayout>
#include <QDesktopServices>
using namespace Tomahawk;
TrackDetailView::TrackDetailView( QWidget* parent )
@@ -220,44 +219,8 @@ TrackDetailView::onAlbumUpdated()
{
if ( m_query->track()->albumPtr()->purchased() )
{
m_allTracksAvailableLocally = true;
foreach( const query_ptr& currentQuery, m_playlistInterface->tracks() )
{
if ( currentQuery->results().isEmpty() )
{
m_allTracksAvailableLocally = false;
break;
}
else
{
m_allTracksAvailableLocally = false;
foreach ( const result_ptr& currentResult, currentQuery->results() )
{
QList< DownloadFormat > formats = currentResult->downloadFormats();
bool isDownloaded = formats.isEmpty() ? false : !DownloadManager::instance()->localFileForDownload( currentResult->downloadFormats().first().url.toString() ).isEmpty();
if ( currentResult->isLocal() || isDownloaded )
{
m_allTracksAvailableLocally = true;
break;
}
}
if ( !m_allTracksAvailableLocally )
{
break;
}
}
}
if ( m_allTracksAvailableLocally )
{
m_buyButton->setText( tr( "View in Folder" ) );
m_buyButton->setVisible( true );
}
else
{
m_buyButton->setText( tr( "Download Album" ) );
m_buyButton->setVisible( true );
}
m_buyButton->setText( tr( "Download Album" ) );
m_buyButton->setVisible( true );
}
else
{
@@ -288,32 +251,7 @@ TrackDetailView::onBuyButtonClicked()
{
if ( m_query->track()->albumPtr()->purchased() )
{
if ( m_allTracksAvailableLocally )
{
QString path;
foreach( const result_ptr& currentResult, m_query->results() ) {
if ( !currentResult->downloadFormats().isEmpty() )
{
path = DownloadManager::instance()->localFileForDownload( currentResult->downloadFormats().first().url.toString() );
}
if ( path.isEmpty() && currentResult->isLocal() )
{
path = currentResult->url();
}
if ( !path.isEmpty() )
{
QDesktopServices::openUrl( QFileInfo( path ).dir().path() );
break;
}
}
}
else
{
emit downloadAll();
}
emit downloadAll();
}
else
{

View File

@@ -77,7 +77,6 @@ private:
CaptionLabel* m_resultsBoxLabel;
QPushButton* m_buyButton;
bool m_buyButtonVisible;
bool m_allTracksAvailableLocally;
QWidget* m_infoBox;
QWidget* m_resultsBox;

View File

@@ -247,8 +247,8 @@ TreeProxyModel::filterAcceptsRow( int sourceRow, const QModelIndex& sourceParent
if ( !item->result()->isOnline() && ti->result()->isOnline() )
return false;
if ( ( !item->result()->isLocal() ) &&
!ti->result()->isLocal() )
if ( ( item->result()->resolvedByCollection().isNull() || !item->result()->resolvedByCollection()->isLocal() ) &&
!ti->result()->resolvedByCollection().isNull() && ti->result()->resolvedByCollection()->isLocal() )
{
return false;
}

View File

@@ -156,7 +156,6 @@ XspfUpdater::setAutoUpdate( bool autoUpdate )
emit changed();
}
void
XspfUpdater::setInterval( int intervalMsecs )
{

View File

@@ -57,12 +57,13 @@ CollectionViewPage::CollectionViewPage( const Tomahawk::collection_ptr& collecti
{
qRegisterMetaType< CollectionViewPageMode >( "CollectionViewPageMode" );
m_header->setBackground( ImageRegistry::instance()->pixmap( RESPATH "images/collection_background.png", QSize( 0, 0 ) ), true );
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 );
PlayableProxyModel* trackViewProxyModel = m_trackView->proxyModel();
if ( collection->backendType() == Collection::ScriptCollectionType )
{

View File

@@ -1,8 +1,8 @@
FILE( GLOB _icons "${CMAKE_SOURCE_DIR}/data/icons/*-tomahawk-icon.png" )
FILE( GLOB _icons "${CMAKE_SOURCE_DIR}/data/icons/tomahawk-icon-*.png" )
FOREACH( _file ${_icons} )
STRING( REPLACE "${CMAKE_SOURCE_DIR}/data/icons/" "" _res ${_file} )
STRING( REPLACE "-tomahawk-icon.png" "" _res ${_res} )
INSTALL( FILES ${_file} RENAME ${TOMAHAWK_TARGET_NAME}.png DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/${_res}/apps )
STRING( REPLACE "${CMAKE_SOURCE_DIR}/data/icons/tomahawk-icon-" "" _res ${_file} )
STRING( REPLACE ".png" "" _res ${_res} )
INSTALL( FILES ${_file} RENAME tomahawk.png DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/${_res}/apps )
ENDFOREACH( _file )
IF( WITH_UPOWER )
@@ -15,7 +15,6 @@ IF( WITH_GNOMESHORTCUTHANDLER )
SET( tomahawkSources ${tomahawkSources} linux/GnomeShortcutHandler.cpp )
ENDIF( WITH_GNOMESHORTCUTHANDLER )
INSTALL( FILES ${CMAKE_SOURCE_DIR}/data/icons/tomahawk-icon.svg RENAME ${TOMAHAWK_TARGET_NAME}.svg DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps )
INSTALL( FILES ${CMAKE_SOURCE_DIR}/admin/unix/tomahawk.desktop RENAME ${TOMAHAWK_TARGET_NAME}.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications )
INSTALL( FILES ${CMAKE_SOURCE_DIR}/data/icons/tomahawk-icon.svg RENAME tomahawk.svg DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps )
INSTALL( FILES ${CMAKE_SOURCE_DIR}/admin/unix/tomahawk.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications )

View File

@@ -167,7 +167,7 @@ main( int argc, char *argv[] )
QCA::Initializer init;
Q_UNUSED( init )
#ifdef Q_OS_MAC
#ifdef Q_OS_MAC
// Do Mac specific startup to get media keys working.
// This must go before QApplication initialisation.
Tomahawk::macMain();
@@ -253,11 +253,11 @@ main( int argc, char *argv[] )
#ifdef Q_OS_MAC
#ifdef Q_OS_MAC64
#ifdef Q_OS_MAC64
static pascal OSErr appleEventHandler( const AppleEvent* e, AppleEvent*, void* )
#elif defined Q_OS_MAC32
#elif defined Q_OS_MAC32
static pascal OSErr appleEventHandler( const AppleEvent* e, AppleEvent*, long )
#endif //Q_OS_MAC64/32
#endif //Q_OS_MAC64/32
{
OSType id = typeWildCard;
AEGetAttributePtr( e, keyEventIDAttr, typeType, 0, &id, sizeof( id ), 0 );

View File

@@ -447,6 +447,7 @@ SourceTreeView::deletePlaylist( const QModelIndex& idxIn )
m_popupDialog.data()->move( rightCenter.x() - m_popupDialog.data()->offset(), rightCenter.y() - m_popupDialog.data()->sizeHint().height() / 2. );
m_popupDialog.data()->show();
}
@@ -570,7 +571,7 @@ SourceTreeView::addToLocal()
// copy to a link and then generate a new playlist from that
// this way we cheaply regenerate the needed controls
ScriptJob* job = Utils::LinkGenerator::instance()->openLink( playlist );
if ( !job )
if( !job )
{
// No supported generator
return;
@@ -585,7 +586,7 @@ SourceTreeView::addToLocal()
// just create the new playlist with the same values
QList< query_ptr > queries;
foreach ( const plentry_ptr& e, playlist->entries() )
foreach( const plentry_ptr& e, playlist->entries() )
queries << e->query();
playlist_ptr newpl = Playlist::create( SourceList::instance()->getLocal(), uuid(), playlist->title(), playlist->info(), playlist->creator(), playlist->shared(), queries );
@@ -658,6 +659,7 @@ SourceTreeView::latchOff( const Tomahawk::source_ptr& source )
void
SourceTreeView::latchModeToggled( bool checked )
{
tDebug() << Q_FUNC_INFO << checked;
disconnect( this, SLOT( latchOff() ) );
if ( !m_contextMenuIndex.isValid() )
return;
@@ -754,7 +756,7 @@ SourceTreeView::onCustomContextMenu( const QPoint& pos )
customMenu.addActions( customActions );
customMenu.exec( mapToGlobal( pos ) );
}
m_contextMenuIndex = QModelIndex(); // we invalidate it because there's no active context menu
m_contextMenuIndex = QModelIndex(); //we invalidate it because there's no active context menu
}
@@ -795,21 +797,20 @@ SourceTreeView::dragMoveEvent( QDragMoveEvent* event )
{
QTreeView::dragMoveEvent( event );
bool accept = false;
if ( DropJob::isDropType( DropJob::Playlist, event->mimeData() ) )
{
// Don't highlight the drop for a playlist, as it won't get added to the playlist but created generally
event->setDropAction( Qt::CopyAction );
accept = true;
event->accept();
}
else if ( DropJob::acceptsMimeData( event->mimeData(), DropJob::Track, DropJob::Append ) )
{
bool accept = false;
setDirtyRegion( m_dropRect );
const QPoint pos = event->pos();
const QModelIndex index = indexAt( pos );
if ( index != m_dropIndex )
dataChanged( m_dropIndex, m_dropIndex );
dataChanged( m_dropIndex, m_dropIndex );
m_dropIndex = QPersistentModelIndex( index );
if ( index.isValid() )
{
@@ -826,10 +827,9 @@ SourceTreeView::dragMoveEvent( QDragMoveEvent* event )
{
case SourcesModel::StaticPlaylist:
case SourcesModel::CategoryAdd:
case SourcesModel::Source: // drop to send tracks to peers
case SourcesModel::Source: //drop to send tracks to peers
m_delegate->hovered( index, event->mimeData() );
if ( index != m_dropIndex )
dataChanged( index, index );
dataChanged( index, index );
break;
default:
@@ -845,30 +845,24 @@ SourceTreeView::dragMoveEvent( QDragMoveEvent* event )
m_dropRect = QRect();
}
if ( accept )
if ( accept || DropJob::isDropType( DropJob::Playlist, event->mimeData() ) )
{
// Playlists are accepted always since they can be dropped anywhere
//tDebug() << Q_FUNC_INFO << "Accepting";
event->setDropAction( Qt::CopyAction );
m_dropIndex = QPersistentModelIndex( index );
event->accept();
}
else
m_dropIndex = QPersistentModelIndex();
{
// tDebug() << Q_FUNC_INFO << "Ignoring";
event->ignore();
}
}
else if ( DropJob::acceptsMimeData( event->mimeData(), DropJob::Playlist | DropJob::Artist | DropJob::Album, DropJob::Create ) )
{
event->setDropAction( Qt::CopyAction );
accept = true;
}
if ( accept )
{
event->accept();
}
else
{
event->ignore();
}
setDirtyRegion( m_dropRect );
}
@@ -892,25 +886,26 @@ SourceTreeView::dropEvent( QDropEvent* event )
}*/
QTreeView::dropEvent( event );
if ( !event->isAccepted() )
if ( event->isAccepted() )
{
// if it's a playlist drop, accept it anywhere in the sourcetree by manually parsing it.
if ( DropJob::isDropType( DropJob::Playlist, event->mimeData() ) )
{
DropJob* dropThis = new DropJob;
dropThis->setDropTypes( DropJob::Playlist );
dropThis->setDropAction( DropJob::Create );
dropThis->parseMimeData( event->mimeData() );
tDebug() << Q_FUNC_INFO << "Ignoring accepted event!";
}
// if it's a playlist drop, accept it anywhere in the sourcetree by manually parsing it.
else if ( DropJob::isDropType( DropJob::Playlist, event->mimeData() ) )
{
DropJob* dropThis = new DropJob;
dropThis->setDropTypes( DropJob::Playlist );
dropThis->setDropAction( DropJob::Create );
dropThis->parseMimeData( event->mimeData() );
// Don't add it to the playlist under drop, it's a new playlist now
event->acceptProposedAction();
event->accept();
}
else if ( model()->dropMimeData( event->mimeData(), event->proposedAction(), index.row(), 0, index.parent() ) )
{
event->acceptProposedAction();
event->accept();
}
// Don't add it to the playlist under drop, it's a new playlist now
event->acceptProposedAction();
event->accept();
}
else if ( model()->dropMimeData( event->mimeData(), event->proposedAction(), index.row(), 0, index.parent() ) )
{
event->acceptProposedAction();
event->accept();
}
m_dragging = false;
@@ -949,8 +944,7 @@ SourceTreeView::keyPressEvent( QKeyEvent* event )
void
SourceTreeView::paintEvent( QPaintEvent* event )
{
/* Draw drag & drop hover background */
if ( m_dragging && !m_dropRect.isEmpty() && m_dropIndex.isValid() )
if ( m_dragging && !m_dropRect.isEmpty() )
{
QPainter painter( viewport() );
const QRect itemRect = visualRect( m_dropIndex );
@@ -967,6 +961,13 @@ SourceTreeView::paintEvent( QPaintEvent* event )
}
void
SourceTreeView::drawRow( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
{
QTreeView::drawRow( painter, option, index );
}
void
SourceTreeView::drawBranches( QPainter* /* painter */, const QRect& /* rect */, const QModelIndex& /* index */ ) const
{

View File

@@ -92,6 +92,7 @@ private slots:
void onPlaylistLinkReady( const QVariantMap& data );
protected:
void drawRow( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const;
void drawBranches( QPainter *painter, const QRect &rect, const QModelIndex &index ) const;
virtual void paintEvent( QPaintEvent* event );