diff options
author | 2022-06-17 18:02:50 +0530 | |
---|---|---|
committer | 2022-06-17 19:16:49 +0530 | |
commit | 90210de2cdc7ee9bcfc35e6d6d803bbc787ad176 (patch) | |
tree | 1247868b8c3ca32a117b290c84df1bea840ab50e /src | |
parent | 48b9028f2f18e512c8ffe514e2fe89ae05528780 (diff) | |
download | whatsie-90210de2cdc7ee9bcfc35e6d6d803bbc787ad176.tar.gz whatsie-90210de2cdc7ee9bcfc35e6d6d803bbc787ad176.zip |
chore: install dicts using qmake4.4
Diffstat (limited to 'src')
-rw-r--r-- | src/WhatsApp.pro | 28 | ||||
-rw-r--r-- | src/dictionaries.cpp | 20 |
2 files changed, 22 insertions, 26 deletions
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; } |