diff options
Diffstat (limited to 'muse2')
-rw-r--r-- | muse2/muse/mixer/rack.cpp | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/muse2/muse/mixer/rack.cpp b/muse2/muse/mixer/rack.cpp index aa679d5f..7e8ac4ee 100644 --- a/muse2/muse/mixer/rack.cpp +++ b/muse2/muse/mixer/rack.cpp @@ -48,6 +48,8 @@ namespace MusEGui { +QString MUSE_MIME_TYPE = "text/x-muse-plugin"; + //--------------------------------------------------------- // class EffectRackDelegate //--------------------------------------------------------- @@ -517,14 +519,13 @@ void EffectRack::startDrag(int idx) QString xmlconf; xml.dump(xmlconf); - printf("[%s]\n", xmlconf.toLatin1().constData()); - - - QByteArray data(xmlconf.toLatin1().constData()); - //printf("sending %d [%s]\n", data.length(), xmlconf.toLatin1().constData()); QMimeData* md = new QMimeData(); - - md->setData("text/x-muse-plugin", data); + QByteArray data(xmlconf.toLatin1().constData()); + + if (MusEGlobal::debugMsg) + printf("Sending %d [%s]\n", data.length(), xmlconf.toLatin1().constData()); + + md->setData(MUSE_MIME_TYPE, data); QDrag* drag = new QDrag(this); drag->setMimeData(md); @@ -541,12 +542,12 @@ QStringList EffectRack::mimeTypes() const { QStringList mTypes; mTypes << "text/uri-list"; - mTypes << "text/x-muse-plugin"; + mTypes << MUSE_MIME_TYPE; return mTypes; } void EffectRack::dropEvent(QDropEvent *event) - { +{ QString text; QListWidgetItem *i = itemAt( event->pos() ); if (!i) @@ -585,10 +586,19 @@ void EffectRack::dropEvent(QDropEvent *event) } } - if(event->mimeData()->hasFormat("text/x-muse-plugin")) + if(event->mimeData()->hasFormat(MUSE_MIME_TYPE)) { - MusECore::Xml xml(event->mimeData()->data("text/x-muse-plugin").data()); + char *mimedata = new char[event->mimeData()->data(MUSE_MIME_TYPE).size() + 2]; + strcpy(mimedata, event->mimeData()->data(MUSE_MIME_TYPE).constData()); + MusECore::Xml xml(mimedata); + if (MusEGlobal::debugMsg) { + QString xmlconf; + xml.dump(xmlconf); + printf("received %d [%s]\n", event->mimeData()->data(MUSE_MIME_TYPE).size(), mimedata); + } + initPlugin(xml, idx); + delete mimedata; } else if (event->mimeData()->hasUrls()) @@ -617,7 +627,7 @@ void EffectRack::dropEvent(QDropEvent *event) } } } - } +} void EffectRack::dragEnterEvent(QDragEnterEvent *event) { |