From db7ebbf385be9507fe0a921365d7e5e00e7f9f41 Mon Sep 17 00:00:00 2001 From: Orcan Ogetbil Date: Sat, 18 Dec 2010 22:23:55 +0000 Subject: Fixed rack drag and drop. Display individual tooltip for each effect plugin in rack. --- muse2/ChangeLog | 2 ++ muse2/muse/mixer/rack.cpp | 26 ++++++++++++++------------ muse2/muse/mixer/rack.h | 8 ++++---- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/muse2/ChangeLog b/muse2/ChangeLog index e6c14612..498f9062 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -2,6 +2,8 @@ - Fixed transport shortcuts not working in some windows or situations. (Tim) Added event->ignore to PartCanvas::keyPress. Added setFocusPolicy() to WaveView, Master. Added (canvas or view)->setFocus() to WaveEdit, MasterEdit. Test OK. + - Fixed rack drag'n drop. Added individual tooltips for effects since the astrip might + be too narrow. (Orcan) 17.12.2010: - Fixed crash with song loaded then File->New. Marker view had non-existent items from cleared marker list. (Tim) - Some memory leak cleanups. Delete midiInstruments and midiDevices. (Tim) diff --git a/muse2/muse/mixer/rack.cpp b/muse2/muse/mixer/rack.cpp index 9dc5b517..54cc75b2 100644 --- a/muse2/muse/mixer/rack.cpp +++ b/muse2/muse/mixer/rack.cpp @@ -28,7 +28,6 @@ #include "gconfig.h" #include "plugin.h" #include "filedialog.h" -#include "config.h" //--------------------------------------------------------- // class RackSlot @@ -85,7 +84,6 @@ EffectRack::EffectRack(QWidget* parent, AudioTrack* t) this, SLOT(doubleClicked(QListWidgetItem*))); connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); - setToolTip(tr("effect rack")); setSpacing(0); QPalette qpal; qpal.setColor(QPalette::Base, QColor(palette().midlight().color())); @@ -97,8 +95,10 @@ EffectRack::EffectRack(QWidget* parent, AudioTrack* t) void EffectRack::updateContents() { for (int i = 0; i < PipelineDepth; ++i) { - item(i)->setText(track->efxPipe()->name(i)); + QString name = track->efxPipe()->name(i); + item(i)->setText(name); item(i)->setBackground(track->efxPipe()->isOn(i) ? palette().mid() : palette().dark()); + item(i)->setToolTip(name == QString("empty") ? tr("effect rack") : name ); } } @@ -414,15 +414,22 @@ void EffectRack::startDrag(int idx) drag->exec(Qt::CopyAction); } -void EffectRack::contentsDropEvent(QDropEvent * /*event*/)// prevent of compiler warning: unsued variable +Qt::DropActions EffectRack::supportedDropActions () const { + return Qt::CopyAction; + } + +QStringList EffectRack::mimeTypes() const + { + return QStringList("text/x-muse-plugin"); } void EffectRack::dropEvent(QDropEvent *event) { QString text; - //orcan-check//QListWidgetItem *i = itemAt( contentsToViewport(event->pos()) ); QListWidgetItem *i = itemAt( event->pos() ); + if (!i) + return; int idx = row(i); Pipeline* pipe = track->efxPipe(); @@ -438,7 +445,7 @@ void EffectRack::dropEvent(QDropEvent *event) Pipeline* spipe = ser->getTrack()->efxPipe(); if(!spipe) return; - //orcan-check//QListWidgetItem *i = ser->itemAt(contentsToViewport(ser->getDragPos())); + QListWidgetItem *i = ser->itemAt(ser->getDragPos()); int idx0 = ser->row(i); if (!(*spipe)[idx0] || @@ -498,10 +505,6 @@ void EffectRack::dragEnterEvent(QDragEnterEvent *event) event->acceptProposedAction(); // TODO CHECK Tim. } -void EffectRack::contentsDragEnterEvent(QDragEnterEvent * /*event*/)// prevent of compiler warning: unused parameter - { - } - void EffectRack::mousePressEvent(QMouseEvent *event) { if(event->button() & Qt::LeftButton) { @@ -527,7 +530,7 @@ void EffectRack::mouseMoveEvent(QMouseEvent *event) Pipeline* pipe = track->efxPipe(); if(!pipe) return; - //orcan-check//QListWidgetItem *i = itemAt(contentsToViewport(dragPos)); + QListWidgetItem *i = itemAt(dragPos); int idx0 = row(i); if (!(*pipe)[idx0]) @@ -535,7 +538,6 @@ void EffectRack::mouseMoveEvent(QMouseEvent *event) int distance = (dragPos-event->pos()).manhattanLength(); if (distance > QApplication::startDragDistance()) { - //orcan-check//QListWidgetItem *i = itemAt( contentsToViewport(event->pos()) ); QListWidgetItem *i = itemAt( event->pos() ); int idx = row(i); startDrag(idx); diff --git a/muse2/muse/mixer/rack.h b/muse2/muse/mixer/rack.h index fd3057d7..33c846bd 100644 --- a/muse2/muse/mixer/rack.h +++ b/muse2/muse/mixer/rack.h @@ -9,8 +9,6 @@ #ifndef __RACK_H__ #define __RACK_H__ -#include "xml.h" - #include class QDragEnterEvent; @@ -19,6 +17,7 @@ class QDropEvent; class QMouseEvent; class AudioTrack; +class Xml; //--------------------------------------------------------- // EffectRack @@ -46,10 +45,11 @@ class EffectRack : public QListWidget { protected: void dropEvent(QDropEvent *event); void dragEnterEvent(QDragEnterEvent *event); - void contentsDropEvent(QDropEvent *event); - void contentsDragEnterEvent(QDragEnterEvent *event); void mousePressEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event); + + QStringList mimeTypes() const; + Qt::DropActions supportedDropActions () const; public: EffectRack(QWidget*, AudioTrack* t); -- cgit v1.2.3