From 1dece1e9e56e88fe6ff373f070e94d17b8c94736 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sat, 8 Aug 2015 11:22:51 +0300 Subject: [PATCH] make install. Corrected paths to translations. --HG-- branch : feature --- src/app/tape/mapplication.cpp | 86 ++++++++++++------------- src/app/valentina/core/vapplication.cpp | 24 +++++-- src/app/valentina/valentina.pro | 18 +++++- 3 files changed, 78 insertions(+), 50 deletions(-) diff --git a/src/app/tape/mapplication.cpp b/src/app/tape/mapplication.cpp index 72b7517f8..f1fc2b832 100644 --- a/src/app/tape/mapplication.cpp +++ b/src/app/tape/mapplication.cpp @@ -241,34 +241,40 @@ QString MApplication::translationsPath() const { return QApplication::applicationDirPath() + "/../../valentina/bin" + trPath; } -#else - #ifdef QT_DEBUG +#elif defined(Q_OS_MAC) + QDir dirBundle(QApplication::applicationDirPath() + QStringLiteral("/../Resources") + trPath); + if (dirBundle.exists()) + { + return dirBundle.absolutePath(); + } + else + { QDir dir(QApplication::applicationDirPath() + trPath); if (dir.exists()) { return dir.absolutePath(); } else - { - return QApplication::applicationDirPath() + "/../../valentina/bin" + trPath; - } - #else - QDir dir1(QApplication::applicationDirPath() + trPath); - if (dir1.exists()) - { - return dir1.absolutePath(); - } - - QDir dir2(QApplication::applicationDirPath() + "/../../valentina/bin" + trPath); - if (dir2.exists()) - { - return dir2.absolutePath(); - } - else { return QStringLiteral("/usr/share/valentina/translations"); } - #endif + } +#else // Unix + QDir dir1(QApplication::applicationDirPath() + trPath); + if (dir1.exists()) + { + return dir1.absolutePath(); + } + + QDir dir2(QApplication::applicationDirPath() + "/../../valentina/bin" + trPath); + if (dir2.exists()) + { + return dir2.absolutePath(); + } + else + { + return QStringLiteral("/usr/share/valentina/translations"); + } #endif } @@ -277,17 +283,15 @@ QString MApplication::diagramsPath() const { const QString dPath = QStringLiteral("/diagrams.rcc"); #ifdef Q_OS_WIN - QFileInfo file(QApplication::applicationDirPath() + dPath); - if (file.exists()) + return QApplication::applicationDirPath() + dPath; +#elif defined(Q_OS_MAC) + QFileInfo fileBundle(QApplication::applicationDirPath() + QStringLiteral("/../Resources") + dPath); + if (fileBundle.exists()) { - return file.absoluteFilePath(); + return fileBundle.absoluteFilePath(); } else { - return QApplication::applicationDirPath() + "../../app/tape/bin" + dPath; - } -#else - #ifdef QT_DEBUG QFileInfo file(QApplication::applicationDirPath() + dPath); if (file.exists()) { @@ -295,25 +299,19 @@ QString MApplication::diagramsPath() const } else { - return QApplication::applicationDirPath() + "../../app/tape/bin" + dPath; + return QStringLiteral("/usr/share/valentina") + dPath; } - #else - QFileInfo file1(QApplication::applicationDirPath() + dPath); - if (file1.exists()) - { - return file1.absoluteFilePath(); - } - - QFileInfo file2(QApplication::applicationDirPath() + "../../app/tape/bin" + dPath); - if (file2.exists()) - { - return file2.absoluteFilePath(); - } - else - { - return QStringLiteral("/usr/share/valentina"); - } - #endif + } +#else // Unix + QFileInfo file(QApplication::applicationDirPath() + dPath); + if (file.exists()) + { + return file.absoluteFilePath(); + } + else + { + return QStringLiteral("/usr/share/valentina") + dPath; + } #endif } diff --git a/src/app/valentina/core/vapplication.cpp b/src/app/valentina/core/vapplication.cpp index c36f2be0b..0e89e38b1 100644 --- a/src/app/valentina/core/vapplication.cpp +++ b/src/app/valentina/core/vapplication.cpp @@ -277,10 +277,14 @@ QString VApplication::translationsPath() const const QString trPath = QStringLiteral("/translations"); #ifdef Q_OS_WIN return QApplication::applicationDirPath() + trPath; -#else -#ifdef QT_DEBUG - return QApplication::applicationDirPath() + trPath; - #else +#elif defined(Q_OS_MAC) + QDir dirBundle(QApplication::applicationDirPath() + QStringLiteral("/../Resources") + trPath); + if (dirBundle.exists()) + { + return dirBundle.absolutePath(); + } + else + { QDir dir(QApplication::applicationDirPath() + trPath); if (dir.exists()) { @@ -290,7 +294,17 @@ QString VApplication::translationsPath() const { return QStringLiteral("/usr/share/valentina/translations"); } - #endif + } +#else // Unix + QDir dir(QApplication::applicationDirPath() + trPath); + if (dir.exists()) + { + return dir.absolutePath(); + } + else + { + return QStringLiteral("/usr/share/valentina/translations"); + } #endif } diff --git a/src/app/valentina/valentina.pro b/src/app/valentina/valentina.pro index dd350f794..224c1406c 100644 --- a/src/app/valentina/valentina.pro +++ b/src/app/valentina/valentina.pro @@ -988,6 +988,9 @@ unix{ # Path to bin file after installation target.path = $$PREFIX/bin + tape.path = $$PREFIX/bin + tape.files += $${OUT_PWD}/../tape/$${DESTDIR}/tape + # .desktop file desktop.path = $$DATADIR/applications/ desktop.files += ../../../dist/$${TARGET}.desktop @@ -1007,6 +1010,7 @@ unix{ INSTALLS += \ target \ + tape \ desktop \ pixmaps \ translations \ @@ -1788,6 +1792,9 @@ unix{ libraries.files += $${OUT_PWD}/../../libs/qmuparser/$${DESTDIR}/libqmuparser.2.dylib libraries.files += $${OUT_PWD}/../../libs/vpropertyexplorer/$${DESTDIR}/libvpropertyexplorer.1.dylib + tape.path = $$MACOS_DIR + tape.files += $${OUT_PWD}/../tape/$${DESTDIR}/tape + # Utility pdftops need for saving a layout image to PS and EPS formates. xpdf.path = $$MACOS_DIR xpdf.files += $${PWD}/../../../dist/macx/bin64/pdftops @@ -1799,10 +1806,16 @@ unix{ standard.path = $$RESOURCES_DIR/tables/standard/ standard.files = $$INSTALL_STANDARD_MEASHUREMENTS + # Copy to bundle standard measurements files + diagrams.path = $$RESOURCES_DIR/ + diagrams.files = $${OUT_PWD}/../tape/$${DESTDIR}/diagrams.rcc + QMAKE_BUNDLE_DATA += \ standard \ libraries \ - xpdf + tape \ + xpdf \ + diagrams } } @@ -1813,6 +1826,9 @@ win32{ package.files += \ $${OUT_PWD}/$${DESTDIR}/valentina.exe \ $${OUT_PWD}/$${DESTDIR}/valentina.exe.dbg \ + $${OUT_PWD}/../tape/$${DESTDIR}/tape.exe \ + $${OUT_PWD}/../tape/$${DESTDIR}/tape.exe.dbg \ + $${OUT_PWD}/../tape/$${DESTDIR}/diagrams.rcc \ $$PWD/../../../dist/win/valentina.ico \ $$PWD/../../../dist/win/curl.exe \ $$PWD/../../../dist/win/exchndl.dll \