diff options
author | 2022-06-17 18:02:50 +0530 | |
---|---|---|
committer | 2022-06-17 19:16:49 +0530 | |
commit | 90210de2cdc7ee9bcfc35e6d6d803bbc787ad176 (patch) | |
tree | 1247868b8c3ca32a117b290c84df1bea840ab50e | |
parent | 48b9028f2f18e512c8ffe514e2fe89ae05528780 (diff) | |
download | whatsie-4.4.tar.gz whatsie-4.4.zip |
chore: install dicts using qmake4.4
-rw-r--r-- | snap/snapcraft.yaml | 4 | ||||
-rw-r--r-- | src/WhatsApp.pro | 28 | ||||
-rw-r--r-- | src/dictionaries.cpp | 20 |
3 files changed, 25 insertions, 27 deletions
diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 19ce2f3..85c7daf 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -99,8 +99,10 @@ parts: /opt/qt515/bin/qmake -install qinstall -exe whatsie ${SNAPCRAFT_PART_INSTALL}/usr/bin/whatsie strip ${SNAPCRAFT_PART_INSTALL}/usr/bin/whatsie + + mkdir -p ${SNAPCRAFT_PART_INSTALL}/usr/share/org.keshavnrj.ubuntu/WhatSie/ - cp -rf ${SNAPCRAFT_PART_BUILD}/qtwebengine_dictionaries ${SNAPCRAFT_PART_INSTALL}/usr/bin/ + cp -rf ${SNAPCRAFT_PART_BUILD}/qtwebengine_dictionaries ${SNAPCRAFT_PART_INSTALL}/usr/share/org.keshavnrj.ubuntu/WhatSie/ sed -i 's|Icon=.*|Icon=${SNAP}/meta/gui/icon.png|g' ${SNAPCRAFT_PART_SRC}/src/whatsie.desktop diff --git a/src/WhatsApp.pro b/src/WhatsApp.pro index 6263278..2d1e907 100644 --- a/src/WhatsApp.pro +++ b/src/WhatsApp.pro @@ -110,26 +110,9 @@ FORMS += \ rateapp.ui \ settingswidget.ui -DISTFILES += \ - dict/de/de-DE.aff \ - dict/de/de-DE.dic \ - dict/en/en-US.aff \ - dict/en/en-US.dic \ - dict/es/es.aff \ - dict/es/es.dic \ - dict/fr/fr.aff \ - dict/fr/fr.dic \ - dict/gb/en-GB.aff \ - dict/gb/en-GB.dic - qtPrepareTool(CONVERT_TOOL, qwebengine_convert_dict) -debug_and_release { - CONFIG(debug, debug|release): DICTIONARIES_DIR = debug/qtwebengine_dictionaries - else: DICTIONARIES_DIR = release/qtwebengine_dictionaries -} else { - DICTIONARIES_DIR = qtwebengine_dictionaries -} +DICTIONARIES_DIR = qtwebengine_dictionaries dict.files = $$files($$PWD/dictionaries/*.dic, true) @@ -152,11 +135,14 @@ DATADIR = $$PREFIX/share target.path = $$BINDIR +dicts.files = $${DICTIONARIES_DIR}/ +dicts.path = $$DATADIR/org.keshavnrj.ubuntu/WhatSie/ + icon.files = icons/whatsie.png -icon.path = $$DATADIR/icons/hicolor/512x512/apps/ +icon.path = $$DATADIR/icons/hicolor/512x512/apps/ desktop.files = whatsie.desktop -desktop.path = $$DATADIR/applications/ +desktop.path = $$DATADIR/applications/ -INSTALLS += target icon desktop +INSTALLS += target dicts icon desktop diff --git a/src/dictionaries.cpp b/src/dictionaries.cpp index 9538582..fc8e7c0 100644 --- a/src/dictionaries.cpp +++ b/src/dictionaries.cpp @@ -6,7 +6,6 @@ #include <QString> #include <QStringList> - QString DICTIONARY_FILE_SUFFIX = ".bdic"; Dictionaries::Dictionaries(QObject *parent) : QObject(parent) { @@ -24,18 +23,29 @@ QString Dictionaries::GetDictionaryPath() { return dict_path; } - // next look relative to the executable + QString dict_dir = "qtwebengine_dictionaries"; + + // inside appdata dir /usr/share/org/appname + QString appdata_path = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation).filter("/usr/share").first(); dict_path = - QCoreApplication::applicationDirPath() + "/qtwebengine_dictionaries"; + QString("%1/%2/%3/%4") + .arg(appdata_path,QApplication::organizationName(), + QApplication::applicationName(), dict_dir); + qDebug()<< dict_path; + if (QDir(dict_path).exists()) { + return dict_path; + } + // next look relative to the executable + dict_path = + QCoreApplication::applicationDirPath() + QDir::separator() + dict_dir; if (QDir(dict_path).exists()) { return dict_path; } // inside the installed Qt directories dict_path = QLibraryInfo::location(QLibraryInfo::DataPath) + - "/qtwebengine_dictionaries"; - + QDir::separator() + dict_dir; if (QDir(dict_path).exists()) { return dict_path; } |