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
This commit is contained in:
Roman Telezhynskyi 2015-11-18 14:42:25 +02:00
parent 9ce9f45cd3
commit e38dc9d866
20 changed files with 359 additions and 414 deletions

57
dist/macx/tape/Info.plist vendored Executable file
View file

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>CFBundleIconFile</key>
<string>@ICON@</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>NSHumanReadableCopyright</key>
<string>© 2013-2015, Valentina project</string>
<key>CFBundleSignature</key>
<string>@TYPEINFO@</string>
<key>CFBundleExecutable</key>
<string>@EXECUTABLE@</string>
<key>CFBundleIdentifier</key>
<string>org.valentinaproject.@EXECUTABLE@</string>
<key>CFBundleShortVersionString</key>
<string>@SHORT_VERSION@</string>
<key>CFBundleVersion</key>
<string>@FULL_VERSION@</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleTypeIconFile</key>
<string>measurements</string>
<key>LSItemContentTypes</key>
<array>
<string>org.valentinaproject.vit</string>
</array>
<key>CFBundleTypeName</key>
<string>Valentina individual measurements</string>
<key>LSHandlerRank</key>
<string>Owner</string>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleTypeIconFile</key>
<string>measurements</string>
<key>LSItemContentTypes</key>
<array>
<string>org.valentinaproject.vst</string>
</array>
<key>CFBundleTypeName</key>
<string>Valentina standard measurements</string>
<key>LSHandlerRank</key>
<string>Owner</string>
</dict>
</array>
</dict>
</plist>

7
src/app/tables.pri Normal file
View file

@ -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))

View file

@ -396,72 +396,6 @@ VTapeSettings *MApplication::TapeSettings()
return qobject_cast<VTapeSettings *>(settings); return qobject_cast<VTapeSettings *>(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 QString MApplication::diagramsPath() const
{ {

View file

@ -71,7 +71,6 @@ public:
virtual void OpenSettings() Q_DECL_OVERRIDE; virtual void OpenSettings() Q_DECL_OVERRIDE;
VTapeSettings *TapeSettings(); VTapeSettings *TapeSettings();
virtual QString translationsPath(const QString &locale = QString()) const Q_DECL_OVERRIDE;
QString diagramsPath() const; QString diagramsPath() const;
void ShowDataBase(); void ShowDataBase();

View file

@ -18,10 +18,6 @@ TEMPLATE = app
# Use out-of-source builds (shadow builds) # Use out-of-source builds (shadow builds)
CONFIG -= debug_and_release debug_and_release_target CONFIG -= debug_and_release debug_and_release_target
macx { # No bundle for tape
CONFIG -= app_bundle
}
# We use C++11 standard # We use C++11 standard
CONFIG += c++11 CONFIG += c++11
@ -44,11 +40,6 @@ RCC_DIR = rcc
# Directory for files created uic # Directory for files created uic
UI_DIR = uic UI_DIR = uic
macx{
# logo on macx.
ICON = ../../../dist/Tape.icns
}
# Suport subdirectories. Just better project code tree. # Suport subdirectories. Just better project code tree.
include(tape.pri) include(tape.pri)
@ -57,6 +48,178 @@ RESOURCES += \
DATA_RESOURCE = share/resources/diagrams.qrc # External Binary Resource 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. # Compilation will fail without this files after we added them to this section.
OTHER_FILES += \ OTHER_FILES += \
share/resources/tapeicon/64x64/logo.ico \ # Tape's logo. 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 INCLUDEPATH += $${PWD}/../../libs/vpropertyexplorer
DEPENDPATH += $${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 noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols
# do nothing # do nothing
} else { } 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
}

View file

@ -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. # Add to this variable all translation files that you want install with program.
# For generation *.qm file first you need create *.ts. # 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_qm = $$basename(_translation_name)
_translation_name_ts = $$section(_translation_name_qm, ".", 0, 0).ts _translation_name_ts = $$section(_translation_name_qm, ".", 0, 0).ts
!exists($${PWD}/$$_translation_name) { !exists($$_translation_name) {
system($$shell_path($$[QT_INSTALL_BINS]/$$LRELEASE) $$shell_path($${PWD}/$${TRANSLATIONS_PATH}/$$_translation_name_ts) -qm $$shell_path($${PWD}/$$_translation_name)) system($$shell_path($$[QT_INSTALL_BINS]/$$LRELEASE) $$shell_path($${TRANSLATIONS_PATH}/$$_translation_name_ts) -qm $$shell_path($$_translation_name))
unix { unix {
exists($${OUT_PWD}/$$DESTDIR/valentina) { exists($${OUT_PWD}/$$DESTDIR/valentina) {
system(rm -fv $${OUT_PWD}/$$DESTDIR/valentina) # force to call linking 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. # 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{ macx{
RESOURCES_DIR = "Contents/Resources" RESOURCES_DIR = "Contents/Resources"

View file

@ -363,58 +363,6 @@ bool VApplication::notify(QObject *receiver, QEvent *event)
return false; 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 QString VApplication::TapeFilePath() const
{ {
@ -455,15 +403,15 @@ QString VApplication::TapeFilePath() const
} }
else else
{ {
QFileInfo tapeFile(QApplication::applicationDirPath() + "/" + tape); QFileInfo tapeFile(QApplication::applicationDirPath() + "/" + tape);
if (tapeFile.exists()) if (tapeFile.exists())
{ {
return tapeFile.absoluteFilePath(); return tapeFile.absoluteFilePath();
} }
else else
{ {
return tape; return tape;
} }
} }
#endif #endif
} }

View file

@ -61,7 +61,6 @@ public:
void InitOptions(); void InitOptions();
virtual QString translationsPath(const QString &locale = QString()) const Q_DECL_OVERRIDE;
QString TapeFilePath() const; QString TapeFilePath() const;
QTimer *getAutoSaveTimer() const; QTimer *getAutoSaveTimer() const;

View file

@ -183,18 +183,14 @@ message(Examples: $$[QT_INSTALL_EXAMPLES])
# Path to recource file. # Path to recource file.
win32:RC_FILE = share/resources/valentina.rc win32:RC_FILE = share/resources/valentina.rc
# Keep path to all files with standard measurements we support right now # INSTALL_STANDARD_MEASHUREMENTS and INSTALL_STANDARD_TEMPLATES inside tables.pri
INSTALL_STANDARD_MEASHUREMENTS += share/resources/tables/standard/GOST_man_ru.vst include(../tables.pri)
# Keep path to all template files we have right now
INSTALL_STANDARD_TEMPLATES += ../tape/share/resources/templates/template_all_measurements.vit
win32 { win32 {
INSTALL_PDFTOPS += ../../../dist/win/pdftops.exe 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. # Set "make install" command for Unix-like systems.
unix{ unix{
@ -274,7 +270,7 @@ unix{
# logo on macx. # logo on macx.
ICON = ../../../dist/Valentina.icns 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 # Copy to bundle standard measurements files
standard.path = $$RESOURCES_DIR/tables/standard/ 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 { win32 {
for(DIR, INSTALL_PDFTOPS) { for(DIR, INSTALL_PDFTOPS) {
#add these absolute paths to a variable which #add these absolute paths to a variable which
@ -627,5 +607,5 @@ noDebugSymbols{ # For enable run qmake with CONFIG+=noDebugSymbols
macx{ macx{
# run macdeployqt to include all qt libraries in packet # 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
} }

View file

@ -29,6 +29,7 @@
#include "vabstractapplication.h" #include "vabstractapplication.h"
#include "../vmisc/def.h" #include "../vmisc/def.h"
#include <QDir>
#include <QLibraryInfo> #include <QLibraryInfo>
#include <QLoggingCategory> #include <QLoggingCategory>
#include <QTranslator> #include <QTranslator>
@ -75,6 +76,61 @@ VAbstractApplication::VAbstractApplication(int &argc, char **argv)
VAbstractApplication::~VAbstractApplication() 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 MeasurementsType VAbstractApplication::patternType() const
{ {

View file

@ -56,13 +56,8 @@ public:
virtual ~VAbstractApplication() Q_DECL_OVERRIDE; virtual ~VAbstractApplication() Q_DECL_OVERRIDE;
virtual const VTranslateVars *TrVars()=0; virtual const VTranslateVars *TrVars()=0;
/**
* @brief translationsPath return path to the root directory that contain QM files. QString translationsPath(const QString &locale = QString()) const;
* @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;
void LoadTranslation(const QString &locale); void LoadTranslation(const QString &locale);

View file

@ -71,6 +71,47 @@ VCommonSettings::VCommonSettings(Format format, Scope scope, const QString &orga
:QSettings(format, scope, organization, application, parent) :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 QString VCommonSettings::GetPathIndividualMeasurements() const
{ {

View file

@ -39,7 +39,7 @@ public:
VCommonSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(), VCommonSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(),
QObject *parent = 0); QObject *parent = 0);
virtual QString StandardTablesPath()const=0 ; QString StandardTablesPath() const;
QString TemplatesPath() const; QString TemplatesPath() const;
QString GetPathIndividualMeasurements() const; QString GetPathIndividualMeasurements() const;

View file

@ -560,44 +560,3 @@ void VSettings::SetIgnoreAllFields(bool value)
{ {
setValue(SettingIgnoreFields, 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
}

View file

@ -41,8 +41,6 @@ public:
VSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(), VSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(),
QObject *parent = 0); QObject *parent = 0);
virtual QString StandardTablesPath() const Q_DECL_OVERRIDE;
QString GetLabelLanguage() const; QString GetLabelLanguage() const;
void SetLabelLanguage(const QString &value); void SetLabelLanguage(const QString &value);

View file

@ -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 QByteArray VTapeSettings::GetDataBaseGeometry() const
{ {

View file

@ -38,8 +38,6 @@ public:
VTapeSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(), VTapeSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(),
QObject *parent = 0); QObject *parent = 0);
virtual QString StandardTablesPath()const Q_DECL_OVERRIDE;
QByteArray GetDataBaseGeometry() const; QByteArray GetDataBaseGeometry() const;
void SetDataBaseGeometry(const QByteArray &value); void SetDataBaseGeometry(const QByteArray &value);