Mercurial > hg > sonic-visualiser
changeset 1460:8ca62b402846 3.0-integration
Fix accidental breakage of PNG export while adding SVG export
author | Chris Cannam |
---|---|
date | Tue, 03 Jan 2017 14:36:31 +0000 |
parents | 9a3684f1393b |
children | f5180edc5dda |
files | .hgsubstate main/MainWindow.cpp main/main.cpp |
diffstat | 3 files changed, 21 insertions(+), 54 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgsubstate Tue Jan 03 13:30:47 2017 +0000 +++ b/.hgsubstate Tue Jan 03 14:36:31 2017 +0000 @@ -6,7 +6,7 @@ 3768bdde6fdf866aa63fff5bde8d9fa64a8979ef dataquay 7d46098431f39c265e47254e420576559587b3fe icons/scalable 3257ddb6fff110cc88f3ffeaeefa0f29d5eb3b6f piper-cpp -5f67a29f0fc7f1b908f7cde4866173a7af337862 sv-dependency-builds +284acf908dcd9f5bdaf805a7f5aeaac1764b4604 sv-dependency-builds 022d6a9e6d75f77a693d31765faead2e578cf014 svapp 47768571681e9ef5a14dbfd066b7a1510580c53e svcore 67f437277069ed83664691fc179421fdbfe9ad70 svgui
--- a/main/MainWindow.cpp Tue Jan 03 13:30:47 2017 +0000 +++ b/main/MainWindow.cpp Tue Jan 03 14:36:31 2017 +0000 @@ -353,11 +353,6 @@ { if (!m_mainMenusCreated) { -#ifdef Q_OS_MAC - // Mac doesn't align menu labels when icons are shown: result is messy - QApplication::setAttribute(Qt::AA_DontShowIconsInMenus); -#endif - #ifdef Q_OS_LINUX // In Ubuntu 14.04 the window's menu bar goes missing entirely // if the user is running any desktop environment other than Unity @@ -2866,14 +2861,9 @@ Pane *pane = m_paneStack->getCurrentPane(); if (!pane) return; -//!!! QString path = getSaveFileName(FileFinder::ImageFile); -// if (path == "") return; -// if (QFileInfo(path).suffix() == "") path += ".png"; QString path = getSaveFileName(FileFinder::ImageFile); if (path == "") return; - if (QFileInfo(path).suffix() == "") path += ".svg"; - - bool scalable = true; //!!! + if (QFileInfo(path).suffix() == "") path += ".png"; bool haveSelection = m_viewManager && !m_viewManager->getSelections().empty(); @@ -2909,7 +2899,7 @@ settings.beginGroup("MainWindow"); int deflt = settings.value("lastimageexportregion", 0).toInt(); if (deflt == 2 && !haveSelection) deflt = 1; - if (deflt == 0 && !scalable && total.width() > 32767) deflt = 1; + if (deflt == 0 && total.width() > 32767) deflt = 1; ListInputDialog *lid = new ListInputDialog (this, tr("Select region to export"), @@ -2919,7 +2909,7 @@ if (!haveSelection) { lid->setItemAvailability(2, false); } - if (!scalable && total.width() > 32767) { // appears to be limit of a QImage + if (total.width() > 32767) { // appears to be limit of a QImage lid->setItemAvailability(0, false); lid->setFootnote(tr("Note: the whole pane is too wide to be exported as a single image.")); } @@ -2932,47 +2922,25 @@ settings.setValue("lastimageexportregion", deflt); - if (scalable) { - - bool result = false; - - if (item == items[0]) { - result = pane->renderToSvgFile(path ); - } else if (item == items[1]) { - result = pane->renderPartToSvgFile(path, - pane->getFirstVisibleFrame(), - pane->getLastVisibleFrame()); - } else if (haveSelection) { - result = pane->renderPartToSvgFile(path, sf0, sf1); - } - - if (!result) { - QMessageBox::critical(this, tr("Failed to save SVG file"), - tr("Failed to save SVG file %1").arg(path)); - } - - } else { - - QImage *image = 0; - - if (item == items[0]) { - image = pane->renderToNewImage(); - } else if (item == items[1]) { - image = pane->renderPartToNewImage(pane->getFirstVisibleFrame(), - pane->getLastVisibleFrame()); - } else if (haveSelection) { - image = pane->renderPartToNewImage(sf0, sf1); - } - - if (!image) return; - - if (!image->save(path, "PNG")) { - QMessageBox::critical(this, tr("Failed to save image file"), - tr("Failed to save image file %1").arg(path)); - } + QImage *image = 0; - delete image; + if (item == items[0]) { + image = pane->renderToNewImage(); + } else if (item == items[1]) { + image = pane->renderPartToNewImage(pane->getFirstVisibleFrame(), + pane->getLastVisibleFrame()); + } else if (haveSelection) { + image = pane->renderPartToNewImage(sf0, sf1); } + + if (!image) return; + + if (!image->save(path, "PNG")) { + QMessageBox::critical(this, tr("Failed to save image file"), + tr("Failed to save image file %1").arg(path)); + } + + delete image; } void
--- a/main/main.cpp Tue Jan 03 13:30:47 2017 +0000 +++ b/main/main.cpp Tue Jan 03 14:36:31 2017 +0000 @@ -279,7 +279,6 @@ settings.beginGroup("Preferences"); // Default to using Piper server; can change in preferences if (!settings.contains("run-vamp-plugins-in-process")) { - cerr << "setting does not exist yet" << endl; settings.setValue("run-vamp-plugins-in-process", false); } settings.endGroup();