summaryrefslogtreecommitdiff
path: root/muse2/muse/arranger/pcanvas.cpp
diff options
context:
space:
mode:
authorRobert Jonsson <spamatica@gmail.com>2012-09-30 21:53:03 +0000
committerRobert Jonsson <spamatica@gmail.com>2012-09-30 21:53:03 +0000
commite1a3d5b87883b5faadbd43326326d4c5aadc871d (patch)
treeecbb1a0aa3d5e05039ac5d08ad57bc1d056f072e /muse2/muse/arranger/pcanvas.cpp
parent6db72b766ea8bf781d0172a62f873104b2e7cab6 (diff)
various fixes and changes
Diffstat (limited to 'muse2/muse/arranger/pcanvas.cpp')
-rw-r--r--muse2/muse/arranger/pcanvas.cpp41
1 files changed, 7 insertions, 34 deletions
diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp
index 1afea012..3c3e6116 100644
--- a/muse2/muse/arranger/pcanvas.cpp
+++ b/muse2/muse/arranger/pcanvas.cpp
@@ -2829,40 +2829,13 @@ void PartCanvas::copy(MusECore::PartList* pl)
}
MusECore::Pos p(tick, true);
MusEGlobal::song->setPos(0, p);
-
- //---------------------------------------------------
- // read tmp file into QTextDrag Object
- //---------------------------------------------------
-
- fflush(tmp);
- struct stat f_stat;
- if (fstat(fileno(tmp), &f_stat) == -1) {
- fprintf(stderr, "PartCanvas::copy() fstat failed:<%s>\n",
- strerror(errno));
- fclose(tmp);
- return;
- }
- int n = f_stat.st_size;
- char* fbuf = (char*)mmap(0, n+1, PROT_READ|PROT_WRITE,
- MAP_PRIVATE, fileno(tmp), 0);
- fbuf[n] = 0;
-
- QByteArray data(fbuf);
- QMimeData* md = new QMimeData();
-
-
- if(midi && wave)
- md->setData("text/x-muse-mixedpartlist", data); // By T356. Support mixed .mpt files.
- else
- if(midi)
- md->setData("text/x-muse-midipartlist", data);
- else
- if(wave)
- md->setData("text/x-muse-wavepartlist", data);
-
- QApplication::clipboard()->setMimeData(md, QClipboard::Clipboard);
-
- munmap(fbuf, n);
+ QString mimeString = "text/x-muse-mixedpartlist";
+ if (!midi)
+ mimeString = "text/x-muse-wavepartlist";
+ else if (!wave)
+ mimeString = "text/x-muse-midipartlist";
+ QMimeData *mimeData = MusECore::file_to_mimedata(tmp, mimeString );
+ QApplication::clipboard()->setMimeData(mimeData, QClipboard::Clipboard);
fclose(tmp);
}