summaryrefslogtreecommitdiff
path: root/muse2/muse
diff options
context:
space:
mode:
authorOrcan Ogetbil <oget.fedora@gmail.com>2010-12-18 22:23:55 +0000
committerOrcan Ogetbil <oget.fedora@gmail.com>2010-12-18 22:23:55 +0000
commitdb7ebbf385be9507fe0a921365d7e5e00e7f9f41 (patch)
tree6acc5240d715beb319ef6525183a7715a3199a12 /muse2/muse
parent4303307cc65893980f350edac5a69e977170c14c (diff)
Fixed rack drag and drop. Display individual tooltip for each effect plugin in rack.
Diffstat (limited to 'muse2/muse')
-rw-r--r--muse2/muse/mixer/rack.cpp26
-rw-r--r--muse2/muse/mixer/rack.h8
2 files changed, 18 insertions, 16 deletions
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 <QListWidget>
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);