mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-01 03:40:16 +02:00
Merge branch 'master' of github.com:tomahawk-player/tomahawk
This commit is contained in:
@@ -20,9 +20,12 @@
|
|||||||
#include "ui_audiocontrols.h"
|
#include "ui_audiocontrols.h"
|
||||||
|
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
|
#include <QDropEvent>
|
||||||
|
#include <QMouseEvent>
|
||||||
|
|
||||||
#include "audio/audioengine.h"
|
#include "audio/audioengine.h"
|
||||||
#include "viewmanager.h"
|
#include "viewmanager.h"
|
||||||
|
#include "playlist/playlistview.h"
|
||||||
#include "database/database.h"
|
#include "database/database.h"
|
||||||
#include "database/databasecommand_socialaction.h"
|
#include "database/databasecommand_socialaction.h"
|
||||||
|
|
||||||
@@ -31,6 +34,7 @@
|
|||||||
#include "utils/imagebutton.h"
|
#include "utils/imagebutton.h"
|
||||||
#include "utils/tomahawkutils.h"
|
#include "utils/tomahawkutils.h"
|
||||||
#include "utils/logger.h"
|
#include "utils/logger.h"
|
||||||
|
#include <globalactionmanager.h>
|
||||||
|
|
||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
|
||||||
@@ -44,6 +48,7 @@ AudioControls::AudioControls( QWidget* parent )
|
|||||||
, m_shuffled( false )
|
, m_shuffled( false )
|
||||||
{
|
{
|
||||||
ui->setupUi( this );
|
ui->setupUi( this );
|
||||||
|
setAcceptDrops( true );
|
||||||
|
|
||||||
ui->buttonAreaLayout->setSpacing( 2 );
|
ui->buttonAreaLayout->setSpacing( 2 );
|
||||||
|
|
||||||
@@ -503,6 +508,51 @@ AudioControls::onTrackClicked()
|
|||||||
ViewManager::instance()->showCurrentTrack();
|
ViewManager::instance()->showCurrentTrack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
AudioControls::dragEnterEvent( QDragEnterEvent* e )
|
||||||
|
{
|
||||||
|
if ( GlobalActionManager::instance()->acceptsMimeData( e->mimeData() ) )
|
||||||
|
e->acceptProposedAction();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
AudioControls::dragMoveEvent( QDragMoveEvent* e )
|
||||||
|
{
|
||||||
|
// if ( GlobalActionManager::instance()->acceptsMimeData( e->mimeData() ) )
|
||||||
|
// e->acceptProposedAction();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
AudioControls::dropEvent( QDropEvent* e )
|
||||||
|
{
|
||||||
|
tDebug() << "AudioControls got drop:" << e->mimeData()->formats();
|
||||||
|
if ( GlobalActionManager::instance()->acceptsMimeData( e->mimeData() ) )
|
||||||
|
{
|
||||||
|
connect( GlobalActionManager::instance(), SIGNAL( tracks( QList<Tomahawk::query_ptr> ) ), this, SLOT( droppedTracks( QList<Tomahawk::query_ptr> ) ) );
|
||||||
|
GlobalActionManager::instance()->tracksFromMimeData( e->mimeData() );
|
||||||
|
|
||||||
|
e->accept();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
AudioControls::droppedTracks( QList< query_ptr > tracks )
|
||||||
|
{
|
||||||
|
disconnect( GlobalActionManager::instance(), SIGNAL( tracks( QList<Tomahawk::query_ptr> ) ), this, SLOT( droppedTracks( QList<Tomahawk::query_ptr> ) ) );
|
||||||
|
|
||||||
|
if ( !tracks.isEmpty() )
|
||||||
|
{
|
||||||
|
// queue and play the first if nothign is playing
|
||||||
|
GlobalActionManager::instance()->handleOpenTrack( tracks.first() );
|
||||||
|
|
||||||
|
// just queue the rest
|
||||||
|
for ( int i = 1; i < tracks.size(); i++ )
|
||||||
|
{
|
||||||
|
ViewManager::instance()->queue()->model()->append( tracks[ i ] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AudioControls::onLoveButtonClicked( bool checked )
|
AudioControls::onLoveButtonClicked( bool checked )
|
||||||
|
@@ -25,6 +25,9 @@
|
|||||||
#include "playlistinterface.h"
|
#include "playlistinterface.h"
|
||||||
#include "infosystem/infosystem.h"
|
#include "infosystem/infosystem.h"
|
||||||
|
|
||||||
|
class QDropEvent;
|
||||||
|
class QDragEnterEvent;
|
||||||
|
class QDragMoveEvent;
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class AudioControls;
|
class AudioControls;
|
||||||
@@ -48,6 +51,9 @@ public slots:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void changeEvent( QEvent* e );
|
void changeEvent( QEvent* e );
|
||||||
|
void dragEnterEvent ( QDragEnterEvent* );
|
||||||
|
void dragMoveEvent ( QDragMoveEvent* );
|
||||||
|
void dropEvent ( QDropEvent* );
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onPlaybackStarted( const Tomahawk::result_ptr& result );
|
void onPlaybackStarted( const Tomahawk::result_ptr& result );
|
||||||
@@ -70,6 +76,7 @@ private slots:
|
|||||||
void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output );
|
void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output );
|
||||||
void infoSystemFinished( QString target );
|
void infoSystemFinished( QString target );
|
||||||
|
|
||||||
|
void droppedTracks ( QList<Tomahawk::query_ptr> );
|
||||||
private:
|
private:
|
||||||
Ui::AudioControls *ui;
|
Ui::AudioControls *ui;
|
||||||
|
|
||||||
|
@@ -66,6 +66,7 @@ public slots:
|
|||||||
|
|
||||||
Tomahawk::dynplaylist_ptr loadDynamicPlaylist( const QUrl& url, bool station );
|
Tomahawk::dynplaylist_ptr loadDynamicPlaylist( const QUrl& url, bool station );
|
||||||
|
|
||||||
|
void handleOpenTrack( const Tomahawk::query_ptr& qry );
|
||||||
signals:
|
signals:
|
||||||
/// QMimeData parsing results
|
/// QMimeData parsing results
|
||||||
void tracks( const QList< Tomahawk::query_ptr >& tracks );
|
void tracks( const QList< Tomahawk::query_ptr >& tracks );
|
||||||
@@ -75,8 +76,6 @@ private slots:
|
|||||||
void showPlaylist();
|
void showPlaylist();
|
||||||
|
|
||||||
void xspfCreated( const QByteArray& xspf );
|
void xspfCreated( const QByteArray& xspf );
|
||||||
|
|
||||||
void handleOpenTrack( const Tomahawk::query_ptr& qry );
|
|
||||||
private:
|
private:
|
||||||
explicit GlobalActionManager( QObject* parent = 0 );
|
explicit GlobalActionManager( QObject* parent = 0 );
|
||||||
void doBookmark( const Tomahawk::playlist_ptr& pl, const Tomahawk::query_ptr& q );
|
void doBookmark( const Tomahawk::playlist_ptr& pl, const Tomahawk::query_ptr& q );
|
||||||
|
@@ -250,7 +250,7 @@ TrackView::dragMoveEvent( QDragMoveEvent* event )
|
|||||||
|
|
||||||
// indicate that the item will be inserted above the current place
|
// indicate that the item will be inserted above the current place
|
||||||
const int gap = 5; // FIXME constant
|
const int gap = 5; // FIXME constant
|
||||||
m_dropRect = QRect( rect.left(), rect.top() - gap / 2, rect.width(), gap );
|
m_dropRect = QRect( 0, rect.top() - gap / 2, width(), gap );
|
||||||
|
|
||||||
event->acceptProposedAction();
|
event->acceptProposedAction();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user