summaryrefslogtreecommitdiff
path: root/muse2
diff options
context:
space:
mode:
authorrj <rj@rj>2013-11-18 22:28:37 +0100
committerrj <rj@rj>2013-11-18 22:28:37 +0100
commitab77f2c0824a97f0349b8ebda82858856409d6cd (patch)
treeb50961f464b6031625b3f001ec926582b13b9d89 /muse2
parent97a8e435576fe391543d11101f6cbc14ccc143e7 (diff)
fixed plugin drag&drop, cleanup
Diffstat (limited to 'muse2')
-rw-r--r--muse2/muse/mixer/rack.cpp21
1 files changed, 6 insertions, 15 deletions
diff --git a/muse2/muse/mixer/rack.cpp b/muse2/muse/mixer/rack.cpp
index 7e8ac4ee..473e247a 100644
--- a/muse2/muse/mixer/rack.cpp
+++ b/muse2/muse/mixer/rack.cpp
@@ -548,7 +548,6 @@ QStringList EffectRack::mimeTypes() const
void EffectRack::dropEvent(QDropEvent *event)
{
- QString text;
QListWidgetItem *i = itemAt( event->pos() );
if (!i)
return;
@@ -588,29 +587,22 @@ void EffectRack::dropEvent(QDropEvent *event)
if(event->mimeData()->hasFormat(MUSE_MIME_TYPE))
{
- 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);
- }
+ QByteArray mimeData = event->mimeData()->data(MUSE_MIME_TYPE).constData();
+ MusECore::Xml xml(mimeData.constData());
+ if (MusEGlobal::debugMsg)
+ printf("received %d [%s]\n", mimeData.size(), mimeData.constData());
initPlugin(xml, idx);
- delete mimedata;
}
- else
- if (event->mimeData()->hasUrls())
+ else if (event->mimeData()->hasUrls())
{
// Multiple urls not supported here. Grab the first one.
- text = event->mimeData()->urls()[0].path();
+ QString text = event->mimeData()->urls()[0].path();
if (text.endsWith(".pre", Qt::CaseInsensitive) ||
text.endsWith(".pre.gz", Qt::CaseInsensitive) ||
text.endsWith(".pre.bz2", Qt::CaseInsensitive))
{
- //bool popenFlag = false;
bool popenFlag;
FILE* fp = MusEGui::fileOpen(this, text, ".pre", "r", popenFlag, false, false);
if (fp)
@@ -618,7 +610,6 @@ void EffectRack::dropEvent(QDropEvent *event)
MusECore::Xml xml(fp);
initPlugin(xml, idx);
- // Added by T356.
if (popenFlag)
pclose(fp);
else