diff --git a/CMakeLists.txt b/CMakeLists.txt index c5e92f4..c8111b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,28 +1,35 @@ -project(buho) cmake_minimum_required(VERSION 3.0) +set(BUHO_VERSION 1.0.0) +project(buho VERSION ${BUHO_VERSION}) find_package(ECM 1.7.0 REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${ECM_MODULE_PATH}) find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Qml Quick Sql Svg QuickControls2 Widgets WebView) find_package(KF5 REQUIRED COMPONENTS Config KIO Notifications I18n Attica SyntaxHighlighting) find_package(MauiKit REQUIRED) include(KDEInstallDirs) include(KDECompilerSettings NO_POLICY_SCOPE) include(KDECMakeSettings) include(ECMInstallIcons) -include(FeatureSummary) +include(ECMSetupVersion) include(ECMAddAppIcon) +include(FeatureSummary) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) #add_definitions( -Wall -O2 -fexceptions -std=c99) +ecm_setup_version(${BUHO_VERSION} + VARIABLE_PREFIX BUHO + VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/buho_version.h" + ) + if (ANDROID) find_package(Qt5 REQUIRED COMPONENTS AndroidExtras) endif() add_subdirectory(src) feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml deleted file mode 100644 index 0388a26..0000000 --- a/android/AndroidManifest.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/android_files/AndroidManifest.xml b/android_files/AndroidManifest.xml index 275b756..0388a26 100644 --- a/android_files/AndroidManifest.xml +++ b/android_files/AndroidManifest.xml @@ -1,98 +1,98 @@ - + - + diff --git a/android/build.gradle b/android_files/build.gradle similarity index 100% rename from android/build.gradle rename to android_files/build.gradle diff --git a/android/res/drawable/buho.png b/android_files/res/drawable/buho.png similarity index 100% rename from android/res/drawable/buho.png rename to android_files/res/drawable/buho.png diff --git a/buho.pro b/buho.pro index 2f4ded2..34631fb 100644 --- a/buho.pro +++ b/buho.pro @@ -1,90 +1,98 @@ QT += qml QT += quick QT += sql QT += widgets QT += quickcontrols2 CONFIG += ordered CONFIG += c++17 QMAKE_LINK += -nostdlib++ TARGET = buho TEMPLATE = app +VERSION_MAJOR = 1 +VERSION_MINOR = 0 +VERSION_BUILD = 0 + +VERSION = $${VERSION_MAJOR}.$${VERSION_MINOR}.$${VERSION_BUILD} + +DEFINES += BUHO_VERSION_STRING=\\\"$$VERSION\\\" + DESTDIR = $$OUT_PWD/ linux:unix:!android { } else:android { message(Building helpers for Android) QT += androidextras webview include($$PWD/3rdparty/kirigami/kirigami.pri) include($$PWD/3rdparty/mauikit/mauikit.pri) DEFINES += STATIC_KIRIGAMI } else { message("Unknown configuration") } include($$PWD/QGumboParser/QGumboParser.pri) DEFINES += QT_DEPRECATED_WARNINGS SOURCES += \ main.cpp \ src/db/db.cpp \ src/buho.cpp \ src/linker.cpp \ src/syncing/syncer.cpp \ src/utils/htmlparser.cpp \ src/models/notes/notes.cpp \ src/models/books/books.cpp \ src/models/books/booklet.cpp \ src/models/links/links.cpp \ src/providers/nextnote.cpp \ RESOURCES += \ qml.qrc \ assets/assets.qrc HEADERS += \ src/db/db.h \ src/buho.h \ src/syncing/syncer.h \ src/utils/owl.h \ src/linker.h \ src/utils/htmlparser.h \ src/models/notes/notes.h \ src/models/books/books.h \ src/models/books/booklet.h \ src/models/links/links.h \ src/providers/nextnote.h \ src/providers/abstractnotesprovider.h INCLUDEPATH += \ src/utils/ \ src/providers/ \ src/syncing/ \ src/ # Additional import path used to resolve QML modules in Qt Creator's code model QML_IMPORT_PATH = # Additional import path used to resolve QML modules just for Qt Quick Designer QML_DESIGNER_IMPORT_PATH = # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target DISTFILES += \ src/db/script.sql \ include($$PWD/install.pri) contains(ANDROID_TARGET_ARCH,armeabi-v7a) { ANDROID_PACKAGE_SOURCE_DIR = \ $$PWD/3rdparty/mauikit/src/android } diff --git a/src/org.kde.buho.desktop b/src/org.kde.buho.desktop index 75dae27..81662f4 100755 --- a/src/org.kde.buho.desktop +++ b/src/org.kde.buho.desktop @@ -1,13 +1,44 @@ [Desktop Entry] Name=Buho +Name[ca]=Buho +Name[es]=Buho +Name[nl]=Buho +Name[pt]=Buho +Name[sk]=Buho +Name[uk]=Буго +Name[x-test]=xxBuhoxx +Name[zh_TW]=Buho Comment=Note taking app +Comment[ca]=Aplicació per prendre notes +Comment[es]=Aplicación para tomar notas +Comment[nl]=Hulpprogramma voor het maken van notities +Comment[pt]=Aplicação de bloco de notas +Comment[sk]=Aplikácia na poznámky +Comment[uk]=Програма для роботи із нотатками +Comment[x-test]=xxNote taking appxx +Comment[zh_TW]=記事應用程式 TryExec=buho Exec=buho %U Keywords=notes;todo;nextcloud;maui; +Keywords[ca]=notes;todo;pendents;nextcloud;maui; +Keywords[es]=notas;pendiente;nextcloud;maui; +Keywords[nl]=notities;tedoen;nextcloud;maui; +Keywords[pt]=notas;tarefas;nextcloud;maui; +Keywords[uk]=notes;todo;nextcloud;maui;нотатки;завдання;записи;некстклауд;мауї; +Keywords[x-test]=xxnotesxx;xxtodoxx;xxnextcloudxx;xxmauixx; +Keywords[zh_TW]=notes;todo;nextcloud;maui;筆記;待辦事項; Terminal=false Type=Application Categories=Qt;KDE;Utility;TextTools;TextEditor;Todo;X-KDE-Utilities-Desktop; StartupNotify=true Icon=buho GenericName=Note Taker +GenericName[ca]=Prendre notes +GenericName[es]=Toma de notas +GenericName[nl]=Notitieboekje +GenericName[pt]=Bloco de Notas +GenericName[sk]=Ukladanie poznámok +GenericName[uk]=Записна книжка +GenericName[x-test]=xxNote Takerxx +GenericName[zh_TW]=記事工具 diff --git a/src/utils/owl.h b/src/utils/owl.h index 4068799..b50c540 100644 --- a/src/utils/owl.h +++ b/src/utils/owl.h @@ -1,145 +1,147 @@ #ifndef OWL_H #define OWL_H #include #include #include #include #include #include #include #include #include #include #include +#include "../buho_version.h" + namespace OWL { Q_NAMESPACE enum class TABLE : uint8_t { NOTES, NOTES_SYNC, BOOKS, BOOKLETS, BOOKLETS_SYNC, LINKS, NONE }; static const QMap TABLEMAP = { {TABLE::NOTES,"notes"}, {TABLE::NOTES_SYNC,"notes_sync"}, {TABLE::BOOKS,"books"}, {TABLE::BOOKLETS,"booklets"}, {TABLE::BOOKLETS_SYNC,"booklets_sync"}, {TABLE::LINKS,"links"}, }; // enum KEY : uint8_t // { // URL, // UPDATED, // ID, // TITLE, // BODY, // FAV, // COLOR, // ADD_DATE, // TAG, // PREVIEW, // IMAGE, // LINK, // PIN, // NONE // }; Q_ENUM_NS(KEY); // typedef QHash DB; // typedef QList DB_LIST; // static const DB KEYMAP = // { // {KEY::ID, "id"}, // {KEY::BODY, "body"}, // {KEY::UPDATED, "updated"}, // {KEY::TITLE, "title"}, // {KEY::URL, "url"}, // {KEY::FAV, "fav"}, // {KEY::PIN, "pin"}, // {KEY::COLOR, "color"}, // {KEY::ADD_DATE, "addDate"}, // {KEY::TAG, "tag"}, // {KEY::PREVIEW, "preview"}, // {KEY::IMAGE, "image"}, // {KEY::LINK, "link"} // }; // static const QHash MAPKEY = // { // {KEYMAP[KEY::ID], KEY::ID}, // {KEYMAP[KEY::BODY], KEY::BODY}, // {KEYMAP[KEY::UPDATED], KEY::UPDATED}, // {KEYMAP[KEY::TITLE], KEY::TITLE}, // {KEYMAP[KEY::URL], KEY::URL}, // {KEYMAP[KEY::FAV], KEY::FAV}, // {KEYMAP[KEY::PIN], KEY::PIN}, // {KEYMAP[KEY::COLOR], KEY::COLOR}, // {KEYMAP[KEY::ADD_DATE], KEY::ADD_DATE}, // {KEYMAP[KEY::TAG], KEY::TAG}, // {KEYMAP[KEY::PREVIEW], KEY::PREVIEW}, // {KEYMAP[KEY::IMAGE], KEY::IMAGE}, // {KEYMAP[KEY::LINK], KEY::LINK} // }; const QString CollectionDBPath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)+"/buho/"; const QString NotesPath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)+"/buho/notes/"; const QString BooksPath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)+"/buho/books/"; const QString LinksPath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)+"/buho/links/"; const QString App = "Buho"; - const QString version = "1.0"; + const QString version = BUHO_VERSION_STRING; const QString comment = "Notes taking and link collector manager"; const QString DBName = "collection.db"; inline void saveJson(QJsonDocument document, QString fileName) { QFile jsonFile(fileName); jsonFile.open(QFile::WriteOnly); jsonFile.write(document.toJson()); jsonFile.close(); } inline QVariantMap openJson(const QString &url) { QString val; QFile file; file.setFileName(url); file.open(QIODevice::ReadOnly | QIODevice::Text); val = file.readAll(); file.close(); QJsonDocument d = QJsonDocument::fromJson(val.toUtf8()); QJsonObject obj = d.object(); return obj.toVariantMap(); } inline QString saveImage(QByteArray array, const QString &path) { if(!array.isNull()&&!array.isEmpty()) { QImage img; img.loadFromData(array); QString name = path; name.replace("/", "-"); name.replace("&", "-"); QString format = "JPEG"; if (img.save(path+".jpg", format.toLatin1(), 100)) return path+".jpg"; else qDebug() << "couldn't save artwork"; }else qDebug()<<"array is empty"; return QString(); } } #endif // OWL_H