From e38dc9d866113c87804699547b73fea114f4dd2c Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 18 Nov 2015 14:42:25 +0200 Subject: [PATCH] For avoiding error "dyld: Library not loaded" in Mac OS X we should create app bundle for Tape. I think if create bundle then make it full, not half made. The bundle also will be very usefull for testing Tape in Mac and in case if someone will want to use Tape like independent application. The main bundle still will have Tape inside. --HG-- branch : develop --- dist/macx/tape/Info.plist | 57 ++++ dist/macx/{ => valentina}/Info.plist | 0 .../tables/standard/GOST_man_ru.vst | 0 .../templates/template_all_measurements.vit | 0 src/app/tables.pri | 7 + src/app/tape/mapplication.cpp | 66 ---- src/app/tape/mapplication.h | 1 - src/app/tape/tape.pro | 304 ++++++++++-------- src/app/{valentina => }/translations.pri | 15 +- src/app/valentina/core/vapplication.cpp | 70 +--- src/app/valentina/core/vapplication.h | 1 - src/app/valentina/valentina.pro | 30 +- src/libs/vmisc/vabstractapplication.cpp | 56 ++++ src/libs/vmisc/vabstractapplication.h | 9 +- src/libs/vmisc/vcommonsettings.cpp | 41 +++ src/libs/vmisc/vcommonsettings.h | 2 +- src/libs/vmisc/vsettings.cpp | 41 --- src/libs/vmisc/vsettings.h | 2 - src/libs/vmisc/vtapesettings.cpp | 69 ---- src/libs/vmisc/vtapesettings.h | 2 - 20 files changed, 359 insertions(+), 414 deletions(-) create mode 100755 dist/macx/tape/Info.plist rename dist/macx/{ => valentina}/Info.plist (100%) rename src/app/{valentina/share/resources => share}/tables/standard/GOST_man_ru.vst (100%) rename src/app/{tape/share/resources => share/tables}/templates/template_all_measurements.vit (100%) create mode 100644 src/app/tables.pri rename src/app/{valentina => }/translations.pri (95%) diff --git a/dist/macx/tape/Info.plist b/dist/macx/tape/Info.plist new file mode 100755 index 000000000..9b2067329 --- /dev/null +++ b/dist/macx/tape/Info.plist @@ -0,0 +1,57 @@ + + + + + NSPrincipalClass + NSApplication + CFBundleIconFile + @ICON@ + CFBundlePackageType + APPL + NSHumanReadableCopyright + © 2013-2015, Valentina project + CFBundleSignature + @TYPEINFO@ + CFBundleExecutable + @EXECUTABLE@ + CFBundleIdentifier + org.valentinaproject.@EXECUTABLE@ + CFBundleShortVersionString + @SHORT_VERSION@ + CFBundleVersion + @FULL_VERSION@ + CFBundleInfoDictionaryVersion + 6.0 + CFBundleDocumentTypes + + + CFBundleTypeRole + Editor + CFBundleTypeIconFile + measurements + LSItemContentTypes + + org.valentinaproject.vit + + CFBundleTypeName + Valentina individual measurements + LSHandlerRank + Owner + + + CFBundleTypeRole + Editor + CFBundleTypeIconFile + measurements + LSItemContentTypes + + org.valentinaproject.vst + + CFBundleTypeName + Valentina standard measurements + LSHandlerRank + Owner + + + + diff --git a/dist/macx/Info.plist b/dist/macx/valentina/Info.plist similarity index 100% rename from dist/macx/Info.plist rename to dist/macx/valentina/Info.plist diff --git a/src/app/valentina/share/resources/tables/standard/GOST_man_ru.vst b/src/app/share/tables/standard/GOST_man_ru.vst similarity index 100% rename from src/app/valentina/share/resources/tables/standard/GOST_man_ru.vst rename to src/app/share/tables/standard/GOST_man_ru.vst diff --git a/src/app/tape/share/resources/templates/template_all_measurements.vit b/src/app/share/tables/templates/template_all_measurements.vit similarity index 100% rename from src/app/tape/share/resources/templates/template_all_measurements.vit rename to src/app/share/tables/templates/template_all_measurements.vit diff --git a/src/app/tables.pri b/src/app/tables.pri new file mode 100644 index 000000000..972cc3db8 --- /dev/null +++ b/src/app/tables.pri @@ -0,0 +1,7 @@ +# Keep path to all files with standard measurements we support right now +INSTALL_STANDARD_MEASHUREMENTS += $$PWD/share/tables/standard/GOST_man_ru.vst + +# Keep path to all template files we have right now +INSTALL_STANDARD_TEMPLATES += $$PWD/share/tables/templates/template_all_measurements.vit + +copyToDestdir($$INSTALL_STANDARD_MEASHUREMENTS, $$shell_path($${OUT_PWD}/$$DESTDIR/tables/standard)) diff --git a/src/app/tape/mapplication.cpp b/src/app/tape/mapplication.cpp index 0649aff8f..258b924b4 100644 --- a/src/app/tape/mapplication.cpp +++ b/src/app/tape/mapplication.cpp @@ -396,72 +396,6 @@ VTapeSettings *MApplication::TapeSettings() return qobject_cast(settings); } -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief translationsPath This function is implementation of the method VAbstractApplication::translationsPath. - */ -QString MApplication::translationsPath(const QString &locale) const -{ - const QString trPath = QStringLiteral("/translations"); -#ifdef Q_OS_WIN - Q_UNUSED(locale) - QDir dir(QApplication::applicationDirPath() + trPath); - if (dir.exists()) - { - return dir.absolutePath(); - } - else - { - return QApplication::applicationDirPath() + "/../../valentina/bin" + trPath; - } -#elif defined(Q_OS_MAC) - QString mainPath; - if (locale.isEmpty()) - { - mainPath = QApplication::applicationDirPath() + QLatin1Literal("/../Resources") + trPath; - } - else - { - mainPath = QApplication::applicationDirPath() + QLatin1Literal("/../Resources") + trPath + QLatin1Literal("/") - + locale + QLatin1Literal(".lproj"); - } - QDir dirBundle(mainPath); - if (dirBundle.exists()) - { - return dirBundle.absolutePath(); - } - else - { - QDir dir(QApplication::applicationDirPath() + trPath); - if (dir.exists()) - { - return dir.absolutePath(); - } - else - { - return QStringLiteral("/usr/share/valentina/translations"); - } - } -#else // Unix - Q_UNUSED(locale) - QDir dir1(QApplication::applicationDirPath() + trPath); - if (dir1.exists()) - { - return dir1.absolutePath(); - } - - QDir dir2(QApplication::applicationDirPath() + QLatin1Literal("/../../valentina/bin") + trPath); - if (dir2.exists()) - { - return dir2.absolutePath(); - } - else - { - return QStringLiteral("/usr/share/valentina/translations"); - } -#endif -} - //--------------------------------------------------------------------------------------------------------------------- QString MApplication::diagramsPath() const { diff --git a/src/app/tape/mapplication.h b/src/app/tape/mapplication.h index c7517b37c..a257e27c7 100644 --- a/src/app/tape/mapplication.h +++ b/src/app/tape/mapplication.h @@ -71,7 +71,6 @@ public: virtual void OpenSettings() Q_DECL_OVERRIDE; VTapeSettings *TapeSettings(); - virtual QString translationsPath(const QString &locale = QString()) const Q_DECL_OVERRIDE; QString diagramsPath() const; void ShowDataBase(); diff --git a/src/app/tape/tape.pro b/src/app/tape/tape.pro index 445a5c7e4..6945ed87c 100644 --- a/src/app/tape/tape.pro +++ b/src/app/tape/tape.pro @@ -18,10 +18,6 @@ TEMPLATE = app # Use out-of-source builds (shadow builds) CONFIG -= debug_and_release debug_and_release_target -macx { # No bundle for tape - CONFIG -= app_bundle -} - # We use C++11 standard CONFIG += c++11 @@ -44,11 +40,6 @@ RCC_DIR = rcc # Directory for files created uic UI_DIR = uic -macx{ - # logo on macx. - ICON = ../../../dist/Tape.icns -} - # Suport subdirectories. Just better project code tree. include(tape.pri) @@ -57,6 +48,178 @@ RESOURCES += \ DATA_RESOURCE = share/resources/diagrams.qrc # External Binary Resource +# The list helps to check that all files are exist. +# Don't forget to convert text to curves. +DIAGRAMS += \ + $${PWD}/share/resources/diagrams/Ap1.svg \ + $${PWD}/share/resources/diagrams/Ap2.svg \ + $${PWD}/share/resources/diagrams/Bp1.svg \ + $${PWD}/share/resources/diagrams/Bp2.svg \ + $${PWD}/share/resources/diagrams/Cp1.svg \ + $${PWD}/share/resources/diagrams/Cp2.svg \ + $${PWD}/share/resources/diagrams/Dp1.svg \ + $${PWD}/share/resources/diagrams/Dp2.svg \ + $${PWD}/share/resources/diagrams/Dp3.svg \ + $${PWD}/share/resources/diagrams/Ep1.svg \ + $${PWD}/share/resources/diagrams/Ep2.svg \ + $${PWD}/share/resources/diagrams/Fp1.svg \ + $${PWD}/share/resources/diagrams/Fp2.svg \ + $${PWD}/share/resources/diagrams/Fp3.svg \ + $${PWD}/share/resources/diagrams/Gp1.svg \ + $${PWD}/share/resources/diagrams/Gp2.svg \ + $${PWD}/share/resources/diagrams/Gp3.svg \ + $${PWD}/share/resources/diagrams/Gp4.svg \ + $${PWD}/share/resources/diagrams/Gp5.svg \ + $${PWD}/share/resources/diagrams/Gp6.svg \ + $${PWD}/share/resources/diagrams/Gp7.svg \ + $${PWD}/share/resources/diagrams/Gp8.svg \ + $${PWD}/share/resources/diagrams/Gp9.svg \ + $${PWD}/share/resources/diagrams/Hp1.svg \ + $${PWD}/share/resources/diagrams/Hp2.svg \ + $${PWD}/share/resources/diagrams/Hp3.svg \ + $${PWD}/share/resources/diagrams/Hp4.svg \ + $${PWD}/share/resources/diagrams/Hp5.svg \ + $${PWD}/share/resources/diagrams/Hp6.svg \ + $${PWD}/share/resources/diagrams/Hp7.svg \ + $${PWD}/share/resources/diagrams/Hp8.svg \ + $${PWD}/share/resources/diagrams/Hp9.svg \ + $${PWD}/share/resources/diagrams/Hp10.svg \ + $${PWD}/share/resources/diagrams/Hp11.svg \ + $${PWD}/share/resources/diagrams/Hp12.svg \ + $${PWD}/share/resources/diagrams/Hp13.svg \ + $${PWD}/share/resources/diagrams/Ip1.svg \ + $${PWD}/share/resources/diagrams/Ip2.svg \ + $${PWD}/share/resources/diagrams/Ip3.svg \ + $${PWD}/share/resources/diagrams/Ip4.svg \ + $${PWD}/share/resources/diagrams/Ip5.svg \ + $${PWD}/share/resources/diagrams/Ip6.svg \ + $${PWD}/share/resources/diagrams/Ip7.svg \ + $${PWD}/share/resources/diagrams/Jp1.svg \ + $${PWD}/share/resources/diagrams/Jp2.svg \ + $${PWD}/share/resources/diagrams/Jp3.svg \ + $${PWD}/share/resources/diagrams/Jp4.svg \ + $${PWD}/share/resources/diagrams/Jp5.svg \ + $${PWD}/share/resources/diagrams/Kp1.svg \ + $${PWD}/share/resources/diagrams/Kp2.svg \ + $${PWD}/share/resources/diagrams/Kp3.svg \ + $${PWD}/share/resources/diagrams/Kp4.svg \ + $${PWD}/share/resources/diagrams/Kp5.svg \ + $${PWD}/share/resources/diagrams/Kp6.svg \ + $${PWD}/share/resources/diagrams/Kp7.svg \ + $${PWD}/share/resources/diagrams/Kp8.svg \ + $${PWD}/share/resources/diagrams/Kp9.svg \ + $${PWD}/share/resources/diagrams/Kp10.svg \ + $${PWD}/share/resources/diagrams/Kp11.svg \ + $${PWD}/share/resources/diagrams/Lp1.svg \ + $${PWD}/share/resources/diagrams/Lp2.svg \ + $${PWD}/share/resources/diagrams/Lp3.svg \ + $${PWD}/share/resources/diagrams/Lp4.svg \ + $${PWD}/share/resources/diagrams/Lp5.svg \ + $${PWD}/share/resources/diagrams/Lp6.svg \ + $${PWD}/share/resources/diagrams/Lp7.svg \ + $${PWD}/share/resources/diagrams/Lp8.svg \ + $${PWD}/share/resources/diagrams/Lp9.svg \ + $${PWD}/share/resources/diagrams/Lp10.svg \ + $${PWD}/share/resources/diagrams/Mp1.svg \ + $${PWD}/share/resources/diagrams/Mp2.svg \ + $${PWD}/share/resources/diagrams/Mp3.svg \ + $${PWD}/share/resources/diagrams/Np1.svg \ + $${PWD}/share/resources/diagrams/Np2.svg \ + $${PWD}/share/resources/diagrams/Np3.svg \ + $${PWD}/share/resources/diagrams/Np4.svg \ + $${PWD}/share/resources/diagrams/Np5.svg \ + $${PWD}/share/resources/diagrams/Op1.svg \ + $${PWD}/share/resources/diagrams/Op2.svg \ + $${PWD}/share/resources/diagrams/Op3.svg \ + $${PWD}/share/resources/diagrams/Op4.svg \ + $${PWD}/share/resources/diagrams/Op5.svg \ + $${PWD}/share/resources/diagrams/Op6.svg \ + $${PWD}/share/resources/diagrams/Op7.svg \ + $${PWD}/share/resources/diagrams/Op8.svg \ + $${PWD}/share/resources/diagrams/Op9.svg \ + $${PWD}/share/resources/diagrams/Op10.svg \ + $${PWD}/share/resources/diagrams/Op11.svg \ + $${PWD}/share/resources/diagrams/Pp1.svg \ + $${PWD}/share/resources/diagrams/Pp2.svg \ + $${PWD}/share/resources/diagrams/Pp3.svg \ + $${PWD}/share/resources/diagrams/Pp4.svg \ + $${PWD}/share/resources/diagrams/Pp5.svg \ + $${PWD}/share/resources/diagrams/Pp6.svg \ + $${PWD}/share/resources/diagrams/Pp7.svg \ + $${PWD}/share/resources/diagrams/Pp8.svg \ + $${PWD}/share/resources/diagrams/Pp9.svg \ + $${PWD}/share/resources/diagrams/Pp10.svg \ + $${PWD}/share/resources/diagrams/Pp11.svg \ + $${PWD}/share/resources/diagrams/Pp12.svg \ + $${PWD}/share/resources/diagrams/Qp1.svg \ + $${PWD}/share/resources/diagrams/Qp2.svg \ + $${PWD}/share/resources/diagrams/Qp3.svg + +diagrams.name = resource diagrams +diagrams.CONFIG += no_link target_predeps +diagrams.depends = $$DIAGRAMS # expects a list of files +diagrams.input = DATA_RESOURCE # expects the name of a variable +diagrams.output = ${QMAKE_FILE_BASE}.rcc +diagrams.commands = $$shell_path($$[QT_INSTALL_BINS]/rcc) --binary --no-compress ${QMAKE_FILE_IN} -o $${OUT_PWD}/$${DESTDIR}/${QMAKE_FILE_OUT} + +QMAKE_EXTRA_COMPILERS += diagrams + +QMAKE_CLEAN += $${OUT_PWD}/$${DESTDIR}/diagrams.rcc + +# INSTALL_STANDARD_MEASHUREMENTS and INSTALL_STANDARD_TEMPLATES inside tables.pri +include(../tables.pri) +copyToDestdir($$INSTALL_STANDARD_TEMPLATES, $$shell_path($${OUT_PWD}/$${DESTDIR}/tables/templates)) +include(../translations.pri) + +macx{ + # Some macx stuff + QMAKE_MAC_SDK = macosx + + QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6 + # Path to resources in app bundle + #RESOURCES_DIR = "Contents/Resources" defined in translation.pri + FRAMEWORKS_DIR = "Contents/Frameworks" + MACOS_DIR = "Contents/MacOS" + # On macx we will use app bundle. Bundle doesn't need bin directory inside. + # See issue #166: Creating OSX Homebrew (Mac OS X package manager) formula. + target.path = $$MACOS_DIR + + #languages added inside translations.pri + + # Symlinks also good names for copying. Make will take origin file and copy them with using symlink name. + # For bundle this names more then enough. We don't need care much about libraries versions. + libraries.path = $$FRAMEWORKS_DIR + libraries.files += $${OUT_PWD}/../../libs/qmuparser/$${DESTDIR}/libqmuparser.2.dylib + libraries.files += $${OUT_PWD}/../../libs/vpropertyexplorer/$${DESTDIR}/libvpropertyexplorer.1.dylib + + # logo on macx. + ICON = $$PWD/../../../dist/Tape.icns + + QMAKE_INFO_PLIST = $$PWD/../../../dist/macx/tape/Info.plist + + # Copy to bundle standard measurements files + standard.path = $$RESOURCES_DIR/tables/standard/ + standard.files = $$INSTALL_STANDARD_MEASHUREMENTS + + # Copy to bundle templates files + templates.path = $$RESOURCES_DIR/tables/templates/ + templates.files = $$INSTALL_STANDARD_TEMPLATES + + # Copy to bundle standard measurements files + diagrams.path = $$RESOURCES_DIR/ + diagrams.files = $${OUT_PWD}/$${DESTDIR}/diagrams.rcc + + format.path = $$RESOURCES_DIR/ + format.files = $$PWD/../../../dist/macx/measurements.icns + + QMAKE_BUNDLE_DATA += \ + templates \ + standard \ + libraries \ + diagrams \ + format +} + # Compilation will fail without this files after we added them to this section. OTHER_FILES += \ share/resources/tapeicon/64x64/logo.ico \ # Tape's logo. @@ -258,124 +421,6 @@ else:unix: LIBS += -L$${OUT_PWD}/../../libs/vpropertyexplorer/$${DESTDIR} -lvpro INCLUDEPATH += $${PWD}/../../libs/vpropertyexplorer DEPENDPATH += $${PWD}/../../libs/vpropertyexplorer -# The list helps to check that all files are exist. -# Don't forget to convert text to curves. -DIAGRAMS += \ - $${PWD}/share/resources/diagrams/Ap1.svg \ - $${PWD}/share/resources/diagrams/Ap2.svg \ - $${PWD}/share/resources/diagrams/Bp1.svg \ - $${PWD}/share/resources/diagrams/Bp2.svg \ - $${PWD}/share/resources/diagrams/Cp1.svg \ - $${PWD}/share/resources/diagrams/Cp2.svg \ - $${PWD}/share/resources/diagrams/Dp1.svg \ - $${PWD}/share/resources/diagrams/Dp2.svg \ - $${PWD}/share/resources/diagrams/Dp3.svg \ - $${PWD}/share/resources/diagrams/Ep1.svg \ - $${PWD}/share/resources/diagrams/Ep2.svg \ - $${PWD}/share/resources/diagrams/Fp1.svg \ - $${PWD}/share/resources/diagrams/Fp2.svg \ - $${PWD}/share/resources/diagrams/Fp3.svg \ - $${PWD}/share/resources/diagrams/Gp1.svg \ - $${PWD}/share/resources/diagrams/Gp2.svg \ - $${PWD}/share/resources/diagrams/Gp3.svg \ - $${PWD}/share/resources/diagrams/Gp4.svg \ - $${PWD}/share/resources/diagrams/Gp5.svg \ - $${PWD}/share/resources/diagrams/Gp6.svg \ - $${PWD}/share/resources/diagrams/Gp7.svg \ - $${PWD}/share/resources/diagrams/Gp8.svg \ - $${PWD}/share/resources/diagrams/Gp9.svg \ - $${PWD}/share/resources/diagrams/Hp1.svg \ - $${PWD}/share/resources/diagrams/Hp2.svg \ - $${PWD}/share/resources/diagrams/Hp3.svg \ - $${PWD}/share/resources/diagrams/Hp4.svg \ - $${PWD}/share/resources/diagrams/Hp5.svg \ - $${PWD}/share/resources/diagrams/Hp6.svg \ - $${PWD}/share/resources/diagrams/Hp7.svg \ - $${PWD}/share/resources/diagrams/Hp8.svg \ - $${PWD}/share/resources/diagrams/Hp9.svg \ - $${PWD}/share/resources/diagrams/Hp10.svg \ - $${PWD}/share/resources/diagrams/Hp11.svg \ - $${PWD}/share/resources/diagrams/Hp12.svg \ - $${PWD}/share/resources/diagrams/Hp13.svg \ - $${PWD}/share/resources/diagrams/Ip1.svg \ - $${PWD}/share/resources/diagrams/Ip2.svg \ - $${PWD}/share/resources/diagrams/Ip3.svg \ - $${PWD}/share/resources/diagrams/Ip4.svg \ - $${PWD}/share/resources/diagrams/Ip5.svg \ - $${PWD}/share/resources/diagrams/Ip6.svg \ - $${PWD}/share/resources/diagrams/Ip7.svg \ - $${PWD}/share/resources/diagrams/Jp1.svg \ - $${PWD}/share/resources/diagrams/Jp2.svg \ - $${PWD}/share/resources/diagrams/Jp3.svg \ - $${PWD}/share/resources/diagrams/Jp4.svg \ - $${PWD}/share/resources/diagrams/Jp5.svg \ - $${PWD}/share/resources/diagrams/Kp1.svg \ - $${PWD}/share/resources/diagrams/Kp2.svg \ - $${PWD}/share/resources/diagrams/Kp3.svg \ - $${PWD}/share/resources/diagrams/Kp4.svg \ - $${PWD}/share/resources/diagrams/Kp5.svg \ - $${PWD}/share/resources/diagrams/Kp6.svg \ - $${PWD}/share/resources/diagrams/Kp7.svg \ - $${PWD}/share/resources/diagrams/Kp8.svg \ - $${PWD}/share/resources/diagrams/Kp9.svg \ - $${PWD}/share/resources/diagrams/Kp10.svg \ - $${PWD}/share/resources/diagrams/Kp11.svg \ - $${PWD}/share/resources/diagrams/Lp1.svg \ - $${PWD}/share/resources/diagrams/Lp2.svg \ - $${PWD}/share/resources/diagrams/Lp3.svg \ - $${PWD}/share/resources/diagrams/Lp4.svg \ - $${PWD}/share/resources/diagrams/Lp5.svg \ - $${PWD}/share/resources/diagrams/Lp6.svg \ - $${PWD}/share/resources/diagrams/Lp7.svg \ - $${PWD}/share/resources/diagrams/Lp8.svg \ - $${PWD}/share/resources/diagrams/Lp9.svg \ - $${PWD}/share/resources/diagrams/Lp10.svg \ - $${PWD}/share/resources/diagrams/Mp1.svg \ - $${PWD}/share/resources/diagrams/Mp2.svg \ - $${PWD}/share/resources/diagrams/Mp3.svg \ - $${PWD}/share/resources/diagrams/Np1.svg \ - $${PWD}/share/resources/diagrams/Np2.svg \ - $${PWD}/share/resources/diagrams/Np3.svg \ - $${PWD}/share/resources/diagrams/Np4.svg \ - $${PWD}/share/resources/diagrams/Np5.svg \ - $${PWD}/share/resources/diagrams/Op1.svg \ - $${PWD}/share/resources/diagrams/Op2.svg \ - $${PWD}/share/resources/diagrams/Op3.svg \ - $${PWD}/share/resources/diagrams/Op4.svg \ - $${PWD}/share/resources/diagrams/Op5.svg \ - $${PWD}/share/resources/diagrams/Op6.svg \ - $${PWD}/share/resources/diagrams/Op7.svg \ - $${PWD}/share/resources/diagrams/Op8.svg \ - $${PWD}/share/resources/diagrams/Op9.svg \ - $${PWD}/share/resources/diagrams/Op10.svg \ - $${PWD}/share/resources/diagrams/Op11.svg \ - $${PWD}/share/resources/diagrams/Pp1.svg \ - $${PWD}/share/resources/diagrams/Pp2.svg \ - $${PWD}/share/resources/diagrams/Pp3.svg \ - $${PWD}/share/resources/diagrams/Pp4.svg \ - $${PWD}/share/resources/diagrams/Pp5.svg \ - $${PWD}/share/resources/diagrams/Pp6.svg \ - $${PWD}/share/resources/diagrams/Pp7.svg \ - $${PWD}/share/resources/diagrams/Pp8.svg \ - $${PWD}/share/resources/diagrams/Pp9.svg \ - $${PWD}/share/resources/diagrams/Pp10.svg \ - $${PWD}/share/resources/diagrams/Pp11.svg \ - $${PWD}/share/resources/diagrams/Pp12.svg \ - $${PWD}/share/resources/diagrams/Qp1.svg \ - $${PWD}/share/resources/diagrams/Qp2.svg \ - $${PWD}/share/resources/diagrams/Qp3.svg - -diagrams.name = resource diagrams -diagrams.CONFIG += no_link target_predeps -diagrams.depends = $$DIAGRAMS # expects a list of files -diagrams.input = DATA_RESOURCE # expects the name of a variable -diagrams.output = ${QMAKE_FILE_BASE}.rcc -diagrams.commands = $$shell_path($$[QT_INSTALL_BINS]/rcc) --binary --no-compress ${QMAKE_FILE_IN} -o $${OUT_PWD}/$${DESTDIR}/${QMAKE_FILE_OUT} - -QMAKE_EXTRA_COMPILERS += diagrams - -QMAKE_CLEAN += $${OUT_PWD}/$${DESTDIR}/diagrams.rcc - noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols # do nothing } else { @@ -404,3 +449,8 @@ noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols } } } + +macx{ + # run macdeployqt to include all qt libraries in packet + QMAKE_POST_LINK += $$[QT_INSTALL_BINS]/macdeployqt $${OUT_PWD}/$${DESTDIR}/$${TARGET}.app +} diff --git a/src/app/valentina/translations.pri b/src/app/translations.pri similarity index 95% rename from src/app/valentina/translations.pri rename to src/app/translations.pri index 497ad8f75..b2dd2c44c 100755 --- a/src/app/valentina/translations.pri +++ b/src/app/translations.pri @@ -1,4 +1,4 @@ -TRANSLATIONS_PATH = ../../../share/translations +TRANSLATIONS_PATH = $${PWD}/../../share/translations # Add to this variable all translation files that you want install with program. # For generation *.qm file first you need create *.ts. @@ -46,8 +46,8 @@ for(_translation_name, INSTALL_TRANSLATIONS) { _translation_name_qm = $$basename(_translation_name) _translation_name_ts = $$section(_translation_name_qm, ".", 0, 0).ts - !exists($${PWD}/$$_translation_name) { - system($$shell_path($$[QT_INSTALL_BINS]/$$LRELEASE) $$shell_path($${PWD}/$${TRANSLATIONS_PATH}/$$_translation_name_ts) -qm $$shell_path($${PWD}/$$_translation_name)) + !exists($$_translation_name) { + system($$shell_path($$[QT_INSTALL_BINS]/$$LRELEASE) $$shell_path($${TRANSLATIONS_PATH}/$$_translation_name_ts) -qm $$shell_path($$_translation_name)) unix { exists($${OUT_PWD}/$$DESTDIR/valentina) { system(rm -fv $${OUT_PWD}/$$DESTDIR/valentina) # force to call linking @@ -57,15 +57,8 @@ for(_translation_name, INSTALL_TRANSLATIONS) { } } -for(DIR, INSTALL_TRANSLATIONS) { - #add these absolute paths to a variable which - #ends up as 'mkcommands = path1 path2 path3 ...' - - tr_path += $${PWD}/$$DIR -} - # Make possible run program even you do not install it. Seek files in local directory. -forceCopyToDestdir($$tr_path, $$shell_path($${OUT_PWD}/$$DESTDIR/translations)) +forceCopyToDestdir($$INSTALL_TRANSLATIONS, $$shell_path($${OUT_PWD}/$$DESTDIR/translations)) macx{ RESOURCES_DIR = "Contents/Resources" diff --git a/src/app/valentina/core/vapplication.cpp b/src/app/valentina/core/vapplication.cpp index 0e63fe33f..d57f0b52a 100644 --- a/src/app/valentina/core/vapplication.cpp +++ b/src/app/valentina/core/vapplication.cpp @@ -363,58 +363,6 @@ bool VApplication::notify(QObject *receiver, QEvent *event) return false; } -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief translationsPath This function is implementation of the method VAbstractApplication::translationsPath. - */ -QString VApplication::translationsPath(const QString &locale) const -{ - const QString trPath = QStringLiteral("/translations"); -#ifdef Q_OS_WIN - Q_UNUSED(locale) - return QApplication::applicationDirPath() + trPath; -#elif defined(Q_OS_MAC) - QString mainPath; - if (locale.isEmpty()) - { - mainPath = QApplication::applicationDirPath() + QLatin1Literal("/../Resources") + trPath; - } - else - { - mainPath = QApplication::applicationDirPath() + QLatin1Literal("/../Resources") + trPath + QLatin1Literal("/") - + locale + QLatin1Literal(".lproj"); - } - QDir dirBundle(mainPath); - if (dirBundle.exists()) - { - return dirBundle.absolutePath(); - } - else - { - QDir dir(QApplication::applicationDirPath() + trPath); - if (dir.exists()) - { - return dir.absolutePath(); - } - else - { - return QStringLiteral("/usr/share/valentina/translations"); - } - } -#else // Unix - Q_UNUSED(locale) - QDir dir(QApplication::applicationDirPath() + trPath); - if (dir.exists()) - { - return dir.absolutePath(); - } - else - { - return QStringLiteral("/usr/share/valentina/translations"); - } -#endif -} - //--------------------------------------------------------------------------------------------------------------------- QString VApplication::TapeFilePath() const { @@ -455,15 +403,15 @@ QString VApplication::TapeFilePath() const } else { - QFileInfo tapeFile(QApplication::applicationDirPath() + "/" + tape); - if (tapeFile.exists()) - { - return tapeFile.absoluteFilePath(); - } - else - { - return tape; - } + QFileInfo tapeFile(QApplication::applicationDirPath() + "/" + tape); + if (tapeFile.exists()) + { + return tapeFile.absoluteFilePath(); + } + else + { + return tape; + } } #endif } diff --git a/src/app/valentina/core/vapplication.h b/src/app/valentina/core/vapplication.h index 8c0b1e5ed..6be7f6c29 100644 --- a/src/app/valentina/core/vapplication.h +++ b/src/app/valentina/core/vapplication.h @@ -61,7 +61,6 @@ public: void InitOptions(); - virtual QString translationsPath(const QString &locale = QString()) const Q_DECL_OVERRIDE; QString TapeFilePath() const; QTimer *getAutoSaveTimer() const; diff --git a/src/app/valentina/valentina.pro b/src/app/valentina/valentina.pro index 6a91f0995..3a85f841c 100644 --- a/src/app/valentina/valentina.pro +++ b/src/app/valentina/valentina.pro @@ -183,18 +183,14 @@ message(Examples: $$[QT_INSTALL_EXAMPLES]) # Path to recource file. win32:RC_FILE = share/resources/valentina.rc -# Keep path to all files with standard measurements we support right now -INSTALL_STANDARD_MEASHUREMENTS += share/resources/tables/standard/GOST_man_ru.vst - -# Keep path to all template files we have right now -INSTALL_STANDARD_TEMPLATES += ../tape/share/resources/templates/template_all_measurements.vit +# INSTALL_STANDARD_MEASHUREMENTS and INSTALL_STANDARD_TEMPLATES inside tables.pri +include(../tables.pri) win32 { INSTALL_PDFTOPS += ../../../dist/win/pdftops.exe } -# TRANSLATIONS_PATH defined inside translations.pri -include(translations.pri) +include(../translations.pri) # Set "make install" command for Unix-like systems. unix{ @@ -274,7 +270,7 @@ unix{ # logo on macx. ICON = ../../../dist/Valentina.icns - QMAKE_INFO_PLIST = $$PWD/../../../dist/macx/Info.plist + QMAKE_INFO_PLIST = $$PWD/../../../dist/macx/valentina/Info.plist # Copy to bundle standard measurements files standard.path = $$RESOURCES_DIR/tables/standard/ @@ -455,22 +451,6 @@ win32:*-g++ { } } -for(DIR, INSTALL_STANDARD_MEASHUREMENTS) { - #add these absolute paths to a variable which - #ends up as 'mkcommands = path1 path2 path3 ...' - st_path += $${PWD}/$$DIR -} - -copyToDestdir($$st_path, $$shell_path($${OUT_PWD}/$$DESTDIR/tables/standard)) - -for(DIR, INSTALL_STANDARD_TEMPLATES) { - #add these absolute paths to a variable which - #ends up as 'mkcommands = path1 path2 path3 ...' - t_path += $${PWD}/$$DIR -} - -copyToDestdir($$t_path, $$shell_path($${OUT_PWD}/../tape/$${DESTDIR}/tables/templates)) - win32 { for(DIR, INSTALL_PDFTOPS) { #add these absolute paths to a variable which @@ -627,5 +607,5 @@ noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols macx{ # run macdeployqt to include all qt libraries in packet - QMAKE_POST_LINK += $$[QT_INSTALL_BINS]/macdeployqt $${OUT_PWD}/$${DESTDIR}/$${TARGET}.app -executable=$${OUT_PWD}/$${DESTDIR}/$${TARGET}.app/$$MACOS_DIR/tape + QMAKE_POST_LINK += $$[QT_INSTALL_BINS]/macdeployqt $${OUT_PWD}/$${DESTDIR}/$${TARGET}.app } diff --git a/src/libs/vmisc/vabstractapplication.cpp b/src/libs/vmisc/vabstractapplication.cpp index 0d5b42492..9b6044b7e 100644 --- a/src/libs/vmisc/vabstractapplication.cpp +++ b/src/libs/vmisc/vabstractapplication.cpp @@ -29,6 +29,7 @@ #include "vabstractapplication.h" #include "../vmisc/def.h" +#include #include #include #include @@ -75,6 +76,61 @@ VAbstractApplication::VAbstractApplication(int &argc, char **argv) VAbstractApplication::~VAbstractApplication() {} +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief translationsPath return path to the root directory that contain QM files. + * @param locale used only in Mac OS. If empty return path to the root directory. If not - return path to locale + * subdirectory inside an app bundle. + * @return path to a directory that contain QM files. + */ +QString VAbstractApplication::translationsPath(const QString &locale) const +{ + const QString trPath = QStringLiteral("/translations"); +#ifdef Q_OS_WIN + Q_UNUSED(locale) + return QApplication::applicationDirPath() + trPath; +#elif defined(Q_OS_MAC) + QString mainPath; + if (locale.isEmpty()) + { + mainPath = QApplication::applicationDirPath() + QLatin1Literal("/../Resources") + trPath; + } + else + { + mainPath = QApplication::applicationDirPath() + QLatin1Literal("/../Resources") + trPath + QLatin1Literal("/") + + locale + QLatin1Literal(".lproj"); + } + QDir dirBundle(mainPath); + if (dirBundle.exists()) + { + return dirBundle.absolutePath(); + } + else + { + QDir dir(QApplication::applicationDirPath() + trPath); + if (dir.exists()) + { + return dir.absolutePath(); + } + else + { + return QStringLiteral("/usr/share/valentina/translations"); + } + } +#else // Unix + Q_UNUSED(locale) + QDir dir(QApplication::applicationDirPath() + trPath); + if (dir.exists()) + { + return dir.absolutePath(); + } + else + { + return QStringLiteral("/usr/share/valentina/translations"); + } +#endif +} + //--------------------------------------------------------------------------------------------------------------------- MeasurementsType VAbstractApplication::patternType() const { diff --git a/src/libs/vmisc/vabstractapplication.h b/src/libs/vmisc/vabstractapplication.h index f1e54e06e..d51d1ef48 100644 --- a/src/libs/vmisc/vabstractapplication.h +++ b/src/libs/vmisc/vabstractapplication.h @@ -56,13 +56,8 @@ public: virtual ~VAbstractApplication() Q_DECL_OVERRIDE; virtual const VTranslateVars *TrVars()=0; - /** - * @brief translationsPath return path to the root directory that contain QM files. - * @param locale used only in Mac OS. If empty return path to the root directory. If not - return path to locale - * subdirectory inside an app bundle. - * @return path to a directory that contain QM files. - */ - virtual QString translationsPath(const QString &locale = QString()) const=0; + + QString translationsPath(const QString &locale = QString()) const; void LoadTranslation(const QString &locale); diff --git a/src/libs/vmisc/vcommonsettings.cpp b/src/libs/vmisc/vcommonsettings.cpp index 0a1540184..2093f1b50 100644 --- a/src/libs/vmisc/vcommonsettings.cpp +++ b/src/libs/vmisc/vcommonsettings.cpp @@ -71,6 +71,47 @@ VCommonSettings::VCommonSettings(Format format, Scope scope, const QString &orga :QSettings(format, scope, organization, application, parent) {} +//--------------------------------------------------------------------------------------------------------------------- +QString VCommonSettings::StandardTablesPath() const +{ + const QString stPath = QStringLiteral("/tables/standard"); +#ifdef Q_OS_WIN + return QApplication::applicationDirPath() + stPath; +#elif defined(Q_OS_MAC) + QDir dirBundle(QApplication::applicationDirPath() + QStringLiteral("/../Resources") + stPath); + if (dirBundle.exists()) + { + return dirBundle.absolutePath(); + } + else + { + QDir dir(QApplication::applicationDirPath() + stPath); + if (dir.exists()) + { + return dir.absolutePath(); + } + else + { + return QStringLiteral("/usr/share/valentina/tables/standard"); + } + } +#else // Unix + #ifdef QT_DEBUG + return QApplication::applicationDirPath() + stPath; + #else + QDir dir(QApplication::applicationDirPath() + stPath); + if (dir.exists()) + { + return dir.absolutePath(); + } + else + { + return QStringLiteral("/usr/share/valentina/tables/standard"); + } + #endif +#endif +} + //--------------------------------------------------------------------------------------------------------------------- QString VCommonSettings::GetPathIndividualMeasurements() const { diff --git a/src/libs/vmisc/vcommonsettings.h b/src/libs/vmisc/vcommonsettings.h index 99ec159ad..8cc2092de 100644 --- a/src/libs/vmisc/vcommonsettings.h +++ b/src/libs/vmisc/vcommonsettings.h @@ -39,7 +39,7 @@ public: VCommonSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(), QObject *parent = 0); - virtual QString StandardTablesPath()const=0 ; + QString StandardTablesPath() const; QString TemplatesPath() const; QString GetPathIndividualMeasurements() const; diff --git a/src/libs/vmisc/vsettings.cpp b/src/libs/vmisc/vsettings.cpp index e115e05d6..a0e94e241 100644 --- a/src/libs/vmisc/vsettings.cpp +++ b/src/libs/vmisc/vsettings.cpp @@ -560,44 +560,3 @@ void VSettings::SetIgnoreAllFields(bool value) { setValue(SettingIgnoreFields, value); } - -//--------------------------------------------------------------------------------------------------------------------- -QString VSettings::StandardTablesPath() const -{ - const QString stPath = QStringLiteral("/tables/standard"); -#ifdef Q_OS_WIN - return QApplication::applicationDirPath() + stPath; -#elif defined(Q_OS_MAC) - QDir dirBundle(QApplication::applicationDirPath() + QStringLiteral("/../Resources") + stPath); - if (dirBundle.exists()) - { - return dirBundle.absolutePath(); - } - else - { - QDir dir(QApplication::applicationDirPath() + stPath); - if (dir.exists()) - { - return dir.absolutePath(); - } - else - { - return QStringLiteral("/usr/share/valentina/tables/standard"); - } - } -#else // Unix - #ifdef QT_DEBUG - return QApplication::applicationDirPath() + stPath; - #else - QDir dir(QApplication::applicationDirPath() + stPath); - if (dir.exists()) - { - return dir.absolutePath(); - } - else - { - return QStringLiteral("/usr/share/valentina/tables/standard"); - } - #endif -#endif -} diff --git a/src/libs/vmisc/vsettings.h b/src/libs/vmisc/vsettings.h index 176d0df09..ade568104 100644 --- a/src/libs/vmisc/vsettings.h +++ b/src/libs/vmisc/vsettings.h @@ -41,8 +41,6 @@ public: VSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(), QObject *parent = 0); - virtual QString StandardTablesPath() const Q_DECL_OVERRIDE; - QString GetLabelLanguage() const; void SetLabelLanguage(const QString &value); diff --git a/src/libs/vmisc/vtapesettings.cpp b/src/libs/vmisc/vtapesettings.cpp index cc796986a..11f1023ee 100644 --- a/src/libs/vmisc/vtapesettings.cpp +++ b/src/libs/vmisc/vtapesettings.cpp @@ -40,75 +40,6 @@ VTapeSettings::VTapeSettings(Format format, Scope scope, const QString &organiza { } -//--------------------------------------------------------------------------------------------------------------------- -QString VTapeSettings::StandardTablesPath() const -{ - const QString stPath = QStringLiteral("/tables/standard"); -#ifdef Q_OS_WIN - QDir dir(QApplication::applicationDirPath() + stPath); - if (dir.exists()) - { - return dir.absolutePath(); - } - else - { - return QApplication::applicationDirPath() + "../../valentina/bin" + stPath; - } -#elif defined(Q_OS_MAC) - QDir dirBundle(QApplication::applicationDirPath() + QStringLiteral("/../Resources") + stPath); - if (dirBundle.exists()) - { - return dirBundle.absolutePath(); - } - else - { - QDir dir1(QApplication::applicationDirPath() + stPath); - if (dir1.exists()) - { - return dir1.absolutePath(); - } - - QDir dir2(QApplication::applicationDirPath() + "../../valentina/bin" + stPath); - if (dir2.exists()) - { - return dir2.absolutePath(); - } - else - { - return QStringLiteral("/usr/share/valentina/tables/standard"); - } - } -#else // Unix - #ifdef QT_DEBUG - QDir dir(QApplication::applicationDirPath() + stPath); - if (dir.exists()) - { - return dir.absolutePath(); - } - else - { - return QApplication::applicationDirPath() + "../../valentina/bin" + stPath; - } - #else - QDir dir1(QApplication::applicationDirPath() + stPath); - if (dir1.exists()) - { - return dir1.absolutePath(); - } - - QDir dir2(QApplication::applicationDirPath() + "../../valentina/bin" + stPath); - if (dir2.exists()) - { - return dir2.absolutePath(); - } - else - { - return QStringLiteral("/usr/share/valentina/tables/standard"); - } - #endif -#endif -} - //--------------------------------------------------------------------------------------------------------------------- QByteArray VTapeSettings::GetDataBaseGeometry() const { diff --git a/src/libs/vmisc/vtapesettings.h b/src/libs/vmisc/vtapesettings.h index f13e8f82a..275e09b73 100644 --- a/src/libs/vmisc/vtapesettings.h +++ b/src/libs/vmisc/vtapesettings.h @@ -38,8 +38,6 @@ public: VTapeSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(), QObject *parent = 0); - virtual QString StandardTablesPath()const Q_DECL_OVERRIDE; - QByteArray GetDataBaseGeometry() const; void SetDataBaseGeometry(const QByteArray &value);