1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-09-12 07:01:36 +02:00

Compare commits

..

1 Commits

Author SHA1 Message Date
Dominik Schmidt
018e4276a9 Allow creating basic data types from QtConcurrent::run
When QObjects are created from QtConcurrent::run they live in a pooled thread that doesn't handle events/signals/slots properly
2016-02-18 00:51:02 +01:00
22 changed files with 59 additions and 244 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

@@ -9,20 +9,19 @@ fi
rm -rvf vlc/
VLC_TARBALL="vlc-2.2.3.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* \

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="86px" height="86px" viewBox="0 0 86 86" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
<title>folder</title>
<description>Created with Sketch (http://www.bohemiancoding.com/sketch)</description>
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
<g id="folder" sketch:type="MSLayerGroup" transform="translate(0.000000, 13.000000)" fill="#000000">
<g id="Page-1" sketch:type="MSShapeGroup">
<path d="M84.1450038,10.4833376 C82.8248024,9.1092149 80.9427764,8.3195294 78.9789985,8.3195294 L72.233622,8.3195294 L34.4730823,8.3195294 L34.4730823,7.0184614 C34.4730823,3.1483061 31.3247762,0 27.4563602,0 L10.1441555,0 C6.27226058,0 3.12569415,3.1500456 3.12569415,7.0184614 L3.12569415,9.4918821 C1.2088801,10.761641 0,12.9237099 0,15.3362515 L0,54.4987445 C0,54.5057021 0,54.5178779 0.0017394,54.5265748 L0,54.5439688 C0,58.3897726 3.14656684,61.5154666 7.0184614,61.5154666 L72.2336242,61.5154666 C72.4736608,61.5154666 72.7102186,61.5050302 72.9432977,61.4789393 C72.9850432,61.4771999 73.028528,61.4650241 73.0702735,61.4615453 C73.2616071,61.4389332 73.4529406,61.4145816 73.6390559,61.3745755 C73.6686257,61.3693573 73.6947166,61.3606604 73.7242863,61.3519634 C73.9225774,61.3119573 74.1208685,61.2597754 74.3139414,61.200636 C74.3243778,61.1954178 74.3348142,61.191939 74.3452506,61.1884602 C76.756053,60.4300837 78.5998126,58.4123847 79.1059765,55.9198305 C79.1077159,55.912873 79.1077159,55.9024366 79.1077159,55.895479 C79.1512008,55.6937091 79.18251,55.4919392 79.2051221,55.2797329 C79.2103403,55.2240723 79.2155585,55.1684116 79.2190373,55.1092721 C79.2277343,55.0136054 79.2433888,54.9266356 79.2451282,54.8309688 L85.9539776,15.7937099 L85.9939837,15.4127822 C86.0705187,13.5587047 85.4147685,11.8086925 84.1450038,10.4833376 C84.1450038,10.4833376 85.4147685,11.8086925 84.1450038,10.4833376 L84.1450038,10.4833376" id="Shape"></path>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

View File

@@ -3,7 +3,6 @@
<file>data/images/collection_background.png</file>
<file>data/images/playlist_background.png</file>
<file>data/images/filter.svg</file>
<file>data/images/folder.svg</file>
<file>data/images/loved.svg</file>
<file>data/images/love.svg</file>
<file>data/images/not-loved.svg</file>
@@ -170,6 +169,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

@@ -37,9 +37,6 @@
#include "utils/ImageRegistry.h"
#include "utils/Logger.h"
#include <QDesktopServices>
#include <QFileInfo>
using namespace Tomahawk;
@@ -54,7 +51,7 @@ ContextMenu::ContextMenu( QWidget* parent )
m_sigmap = new QSignalMapper( this );
connect( m_sigmap, SIGNAL( mapped( int ) ), SLOT( onTriggered( int ) ) );
clear();
m_supportedActions = ActionPlay | ActionQueue | ActionPlaylist | ActionCopyLink | ActionLove | ActionStopAfter | ActionPage | ActionEditMetadata | ActionSend;
}
@@ -72,7 +69,7 @@ ContextMenu::clear()
m_albums.clear();
m_artists.clear();
m_supportedActions = ActionPlay | ActionQueue | ActionPlaylist | ActionCopyLink | ActionLove | ActionStopAfter | ActionPage | ActionEditMetadata | ActionSend | ActionOpenFileManager;
m_supportedActions = ActionPlay | ActionQueue | ActionPlaylist | ActionCopyLink | ActionLove | ActionStopAfter | ActionPage | ActionEditMetadata | ActionSend;
}
@@ -219,24 +216,10 @@ ContextMenu::setQueries( const QList<Tomahawk::query_ptr>& queries )
addSeparator();
if ( m_supportedActions & ActionCopyLink && itemCount() == 1 )
{
m_sigmap->setMapping( addAction( tr( "&Copy Track Link" ) ), ActionCopyLink );
}
if ( m_supportedActions & ActionOpenFileManager &&
queries.length() == 1 &&
queries.first()->numResults() &&
queries.first()->results().first()->resolvedByCollection() &&
queries.first()->results().first()->resolvedByCollection()->isLocal() )
{
m_sigmap->setMapping( addAction( ImageRegistry::instance()->icon( RESPATH "images/folder.svg" ),
tr( "Open Folder in File Manager..." ) ), ActionOpenFileManager );
}
if ( m_supportedActions & ActionEditMetadata && itemCount() == 1 )
{
m_sigmap->setMapping( addAction( tr( "Properties..." ) ), ActionEditMetadata );
}
addSeparator();
@@ -256,8 +239,6 @@ ContextMenu::setQueries( const QList<Tomahawk::query_ptr>& queries )
m_sigmap->setMapping( addAction( tr( "Mark as &Listened" ) ), ActionMarkListened );
}
addSeparator();
if ( m_supportedActions & ActionDelete )
m_sigmap->setMapping( addAction( queries.count() > 1 ? tr( "&Remove Items" ) : tr( "&Remove Item" ) ), ActionDelete );
@@ -413,15 +394,6 @@ ContextMenu::onTriggered( int action )
}
break;
case ActionOpenFileManager:
{
result_ptr result = m_queries.first()->results().first();
QString path = QFileInfo( result->url() ).path();
tLog() << Q_FUNC_INFO << "open directory" << path;
QDesktopServices::openUrl( path );
}
break;
default:
emit triggered( action );
}

View File

@@ -37,22 +37,21 @@ Q_OBJECT
public:
enum MenuActions
{
ActionPlay = 1,
ActionQueue = 2,
ActionDelete = 4,
ActionCopyLink = 8,
ActionLove = 16,
ActionStopAfter = 32,
ActionPage = 64,
ActionTrackPage = 128,
ActionArtistPage = 256,
ActionAlbumPage = 512,
ActionEditMetadata = 1024,
ActionPlaylist = 2048,
ActionSend = 4096,
ActionMarkListened = 8192,
ActionDownload = 16384,
ActionOpenFileManager = 32768
ActionPlay = 1,
ActionQueue = 2,
ActionDelete = 4,
ActionCopyLink = 8,
ActionLove = 16,
ActionStopAfter = 32,
ActionPage = 64,
ActionTrackPage = 128,
ActionArtistPage = 256,
ActionAlbumPage = 512,
ActionEditMetadata = 1024,
ActionPlaylist = 2048,
ActionSend = 4096,
ActionMarkListened = 8192,
ActionDownload = 16384
};
explicit ContextMenu( QWidget* parent = 0 );

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

@@ -165,19 +165,12 @@ AudioEngine::AudioEngine()
d->s_instance = this;
tDebug() << "Init AudioEngine";
d->audioOutput = new AudioOutput( this );
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 );
}
@@ -466,8 +455,6 @@ AudioEngine::mute()
{
Q_D( AudioEngine );
d->audioOutput->setMuted( true );
emit volumeChanged( volume() );
}
@@ -476,8 +463,6 @@ AudioEngine::toggleMute()
{
Q_D( AudioEngine );
d->audioOutput->setMuted( !d->audioOutput->isMuted() );
emit volumeChanged( volume() );
}
@@ -577,12 +562,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();
@@ -972,9 +951,9 @@ AudioEngine::playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk:
void
AudioEngine::playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk::query_ptr& query )
{
if ( query->resolvingFinished() || query->numResults( true ) )
if ( query->resolvingFinished() )
{
if ( query->numResults( true ) )
if ( query->numResults() && query->results().first()->isOnline() )
{
playItem( playlist, query->results().first(), query );
return;
@@ -990,7 +969,7 @@ AudioEngine::playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk:
{
Pipeline::instance()->resolve( query );
NewClosure( query.data(), SIGNAL( resultsChanged() ),
NewClosure( query.data(), SIGNAL( resolvingFinished( bool ) ),
const_cast<AudioEngine*>(this), SLOT( playItem( Tomahawk::playlistinterface_ptr, Tomahawk::query_ptr ) ), playlist, query );
}
}

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 )
@@ -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,7 @@ 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
tDebug() << Q_FUNC_INFO << "Init OK";
}
@@ -179,28 +154,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 +302,6 @@ AudioOutput::setCurrentSource( MediaStream* stream )
}
bool
AudioOutput::isInitialized() const
{
return m_initialized;
}
AudioOutput::AudioState
AudioOutput::state() const
{
@@ -520,9 +466,11 @@ AudioOutput::setMuted( bool m )
tDebug() << Q_FUNC_INFO;
m_muted = m;
libvlc_audio_set_mute( m_vlcPlayer, m );
if ( !m_muted )
if ( m_muted )
{
libvlc_audio_set_volume( m_vlcPlayer, 0 );
}
else
{
libvlc_audio_set_volume( m_vlcPlayer, m_volume * 100.0 );
}
@@ -539,7 +487,7 @@ AudioOutput::volume() const
void
AudioOutput::setVolume( qreal vol )
{
tDebug() << Q_FUNC_INFO << vol << m_muted;
tDebug() << Q_FUNC_INFO;
m_volume = vol;
if ( !m_muted )
@@ -583,20 +531,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 +556,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

@@ -1371,10 +1371,7 @@ Servent::isIPWhitelisted( QHostAddress ip )
}
}
// Did something change in Qt 5? In Qt 5.5 Zeroconf does not work with this code ifdef'ed out
// @xhochy can you shed some light on this?
// #if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
// Qt4 cannot cope correctly with IPv4 addresses mapped into the IPv6
// address space
if ( ip.protocol() == QAbstractSocket::IPv6Protocol )
@@ -1400,7 +1397,7 @@ Servent::isIPWhitelisted( QHostAddress ip )
return isIPWhitelisted( addr );
}
}
// #endif
#endif
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "failure";
return false;

View File

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

View File

@@ -42,7 +42,7 @@ ScriptJob*
ScriptLinkGeneratorPlugin::openLink( const QString& title, const QString& artist, const QString& album ) const
{
QVariantMap arguments;
arguments[ "track" ] = QVariant( title );
arguments[ "title" ] = QVariant( title );
arguments[ "artist" ] = QVariant( artist );
arguments[ "album" ] = QVariant( album );

View File

@@ -412,7 +412,7 @@ SettingsDialog::onCustomContextMenu( const QPoint& point )
void
SettingsDialog::onShowDebuggerForSelectedAccount()
{
ResolverAccount* account = qobject_cast< ResolverAccount* >( m_accountProxy->data( m_accountsWidgetUi->accountsView->currentIndex(), AccountModel::AccountData ).value< Tomahawk::Accounts::Account* >() );
ResolverAccount* account = m_accountProxy->data( m_accountsWidgetUi->accountsView->currentIndex(), AccountModel::AccountData ).value< ResolverAccount* >();
Tomahawk::JSResolver* jsResolver = qobject_cast< Tomahawk::JSResolver* >( account->resolver() );
jsResolver->scriptAccount()->showDebugger();
}

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();
}
@@ -796,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() )
{
@@ -829,8 +829,7 @@ SourceTreeView::dragMoveEvent( QDragMoveEvent* event )
case SourcesModel::CategoryAdd:
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:
@@ -846,28 +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 );
event->accept();
}
else
{
// tDebug() << Q_FUNC_INFO << "Ignoring";
event->ignore();
}
m_dropIndex = QPersistentModelIndex( index );
}
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 );
}