├── CMakeLists.txt ├── COPYING ├── MLBookProc ├── CMakeLists.txt ├── MLBookProc │ ├── COPYING │ ├── genre_groups.csv │ └── genres.csv ├── MLBookProcConfig.cmake.in ├── include │ ├── ARCHParser.h │ ├── AddBook.h │ ├── ArchEntry.h │ ├── ArchiveFileEntry.h │ ├── ArchiveRemoveEntry.h │ ├── AuxFunc.h │ ├── BaseKeeper.h │ ├── BookBaseEntry.h │ ├── BookInfo.h │ ├── BookInfoEntry.h │ ├── BookMarks.h │ ├── BookParseEntry.h │ ├── ByteOrder.h │ ├── CMakeLists.txt │ ├── CreateCollection.h │ ├── DCParser.h │ ├── DJVUParser.h │ ├── EPUBParser.h │ ├── ElectroBookInfoEntry.h │ ├── FB2Parser.h │ ├── FileParseEntry.h │ ├── FormatAnnotation.h │ ├── Genre.h │ ├── GenreGroup.h │ ├── Hasher.h │ ├── LibArchive.h │ ├── MLException.h │ ├── NotesBaseEntry.h │ ├── NotesKeeper.h │ ├── ODTParser.h │ ├── OmpLockGuard.h │ ├── OpenBook.h │ ├── PDFParser.h │ ├── PaperBookInfoEntry.h │ ├── RefreshCollection.h │ ├── RemoveBook.h │ ├── ReplaceTagItem.h │ ├── SelfRemovingPath.h │ ├── XMLParser.h │ └── XMLTag.h ├── omp_test │ ├── CMakeLists.txt │ └── main.cpp ├── src │ ├── ARCHParser.cpp │ ├── AddBook.cpp │ ├── ArchEntry.cpp │ ├── ArchiveFileEntry.cpp │ ├── ArchiveRemoveEntry.cpp │ ├── AuxFunc.cpp │ ├── BaseKeeper.cpp │ ├── BookBaseEntry.cpp │ ├── BookInfo.cpp │ ├── BookInfoEntry.cpp │ ├── BookMarks.cpp │ ├── BookParseEntry.cpp │ ├── ByteOrder.cpp │ ├── CMakeLists.txt │ ├── CreateCollection.cpp │ ├── DCParser.cpp │ ├── DJVUParser.cpp │ ├── EPUBParser.cpp │ ├── ElectroBookInfoEntry.cpp │ ├── FB2Parser.cpp │ ├── FileParseEntry.cpp │ ├── FormatAnnotation.cpp │ ├── Genre.cpp │ ├── GenreGroup.cpp │ ├── Hasher.cpp │ ├── LibArchive.cpp │ ├── MLException.cpp │ ├── NotesBaseEntry.cpp │ ├── NotesKeeper.cpp │ ├── ODTParser.cpp │ ├── OmpLockGuard.cpp │ ├── OpenBook.cpp │ ├── PDFParser.cpp │ ├── PaperBookInfoEntry.cpp │ ├── RefreshCollection.cpp │ ├── RemoveBook.cpp │ ├── ReplaceTagItem.cpp │ ├── SelfRemovingPath.cpp │ ├── XMLParser.cpp │ └── XMLTag.cpp └── stdexecution_test │ ├── CMakeLists.txt │ └── main.cpp ├── MLPluginIfc ├── CMakeLists.txt ├── MLPluginIfcConfig.cmake.in ├── examples │ ├── ExamplePlugin.cpp │ └── ExamplePlugin.h ├── include │ ├── CMakeLists.txt │ └── MLPlugin.h └── src │ ├── CMakeLists.txt │ └── MLPlugin.cpp ├── MyLibrary ├── COPYING ├── MLStyles.css └── mylibrary.svg ├── README.md ├── README_RU.md ├── include ├── AddBookGui.h ├── AddBookModelItem.h ├── BookInfoGui.h ├── BookMarksGui.h ├── BookMarksModelItem.h ├── BookMarksShow.h ├── CMakeLists.txt ├── CollectionCrProcessGui.h ├── CopyBookGui.h ├── CoverPixBuf.h ├── CreateCollectionGui.h ├── EditBookGenreModelItem.h ├── EditBookGui.h ├── EmptyCollectionGui.h ├── ExportCollectionGui.h ├── FullSizeCover.h ├── ImportCollectionGui.h ├── LeftGrid.h ├── MainWindow.h ├── MyLibraryApplication.h ├── NotesGui.h ├── PluginsKeeper.h ├── RefreshCollectionGui.h ├── RemoveBookGui.h ├── RemoveCollectionGui.h ├── RightGrid.h ├── SaveCover.h ├── SearchProcessGui.h ├── SearchResultModelItem.h ├── SearchResultModelItemAuth.h ├── SearchResultModelItemFL.h ├── SearchResultShow.h ├── SettingsWindow.h └── TransferBookGui.h ├── mylibrary.ico ├── mylibrary.svg ├── po └── MyLibrary.po ├── ru.mail.bobilev_yury.MyLibrary.desktop ├── ru.mail.bobilev_yury.MyLibrary.omp.desktop └── src ├── AddBookGui.cpp ├── AddBookModelItem.cpp ├── BookInfoGui.cpp ├── BookMarksGui.cpp ├── BookMarksModelItem.cpp ├── BookMarksShow.cpp ├── CMakeLists.txt ├── CollectionCrProcessGui.cpp ├── CopyBookGui.cpp ├── CoverPixBuf.cpp ├── CreateCollectionGui.cpp ├── EditBookGenreModelItem.cpp ├── EditBookGui.cpp ├── EmptyCollectionGui.cpp ├── ExportCollectionGui.cpp ├── FullSizeCover.cpp ├── ImportCollectionGui.cpp ├── LeftGrid.cpp ├── MainWindow.cpp ├── MyLibraryApplication.cpp ├── NotesGui.cpp ├── PluginsKeeper.cpp ├── RefreshCollectionGui.cpp ├── RemoveBookGui.cpp ├── RemoveCollectionGui.cpp ├── RightGrid.cpp ├── SaveCover.cpp ├── SearchProcessGui.cpp ├── SearchResultModelItem.cpp ├── SearchResultModelItemAuth.cpp ├── SearchResultModelItemFL.cpp ├── SearchResultShow.cpp ├── SettingsWindow.cpp ├── TransferBookGui.cpp └── main.cpp /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | 3 | project(MyLibrary VERSION 4.1 LANGUAGES CXX) 4 | 5 | set(CMAKE_CXX_STANDARD 17) 6 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 7 | 8 | option(USE_PLUGINS "Build with plugin support" OFF) 9 | 10 | find_package(PkgConfig REQUIRED) 11 | 12 | find_package(Intl REQUIRED) 13 | find_package(Gettext) 14 | 15 | pkg_check_modules(GTKMM REQUIRED IMPORTED_TARGET gtkmm-4.0) 16 | 17 | if(CMAKE_SYSTEM_NAME MATCHES "Linux") 18 | add_executable(mylibrary) 19 | elseif(CMAKE_SYSTEM_NAME MATCHES "Windows") 20 | add_executable(mylibrary WIN32) 21 | endif() 22 | 23 | add_subdirectory(src) 24 | add_subdirectory(include) 25 | add_subdirectory(MLBookProc) 26 | 27 | if(USE_OPENMP) 28 | try_compile(OMP_TEST "${CMAKE_BINARY_DIR}/omp_test" "${PROJECT_SOURCE_DIR}/MLBookProc/omp_test" OmpTest) 29 | if(OMP_TEST) 30 | message(STATUS "${PROJECT_NAME} will be built with OpenMP support") 31 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_OPENMP") 32 | else() 33 | set(USE_OPENMP OFF) 34 | message(WARNING "Compiler does not support some OpenMP features. ${PROJECT_NAME} will be built without OpenMP support.") 35 | try_compile(EXEC_TEST "${CMAKE_BINARY_DIR}/stdexecution_test" "${PROJECT_SOURCE_DIR}/MLBookProc/stdexecution_test" ExecTest) 36 | if(EXEC_TEST) 37 | find_package(TBB QUIET) 38 | if(TBB_FOUND) 39 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_TBB") 40 | endif() 41 | endif() 42 | endif() 43 | else() 44 | message(STATUS "${PROJECT_NAME} will be built without OpenMP support.") 45 | try_compile(EXEC_TEST "${CMAKE_BINARY_DIR}/stdexecution_test" "${PROJECT_SOURCE_DIR}/MLBookProc/stdexecution_test" ExecTest) 46 | if(EXEC_TEST) 47 | find_package(TBB QUIET) 48 | if(TBB_FOUND) 49 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_TBB") 50 | endif() 51 | endif() 52 | endif() 53 | 54 | if(GTKMM_VERSION VERSION_LESS "4.10") 55 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DML_GTK_OLD") 56 | endif() 57 | 58 | if(USE_PLUGINS) 59 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_PLUGINS") 60 | add_subdirectory(MLPluginIfc) 61 | target_include_directories(mylibrary PRIVATE MLPluginIfc/include) 62 | target_link_libraries(mlpluginifc PRIVATE mlbookproc) 63 | target_link_libraries(mylibrary PRIVATE mlpluginifc) 64 | 65 | if(CMAKE_SYSTEM_NAME MATCHES "Linux") 66 | target_link_libraries(mylibrary PRIVATE ${CMAKE_DL_LIBS}) 67 | endif() 68 | endif() 69 | 70 | target_include_directories(mylibrary 71 | PRIVATE MLBookProc/include 72 | PRIVATE include 73 | PRIVATE ${GTKMM_INCLUDE_DIRS} 74 | ) 75 | 76 | target_compile_options(mylibrary 77 | PRIVATE ${GTKMM_CFLAGS_OTHER} 78 | ) 79 | 80 | target_link_libraries(mylibrary 81 | PRIVATE mlbookproc 82 | PRIVATE ${GTKMM_LINK_LIBRARIES} 83 | ) 84 | 85 | target_link_options(mylibrary 86 | PRIVATE ${GTKMM_LDFLAGS_OTHER} 87 | ) 88 | 89 | include(GNUInstallDirs) 90 | 91 | install(TARGETS mylibrary 92 | RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" 93 | ) 94 | 95 | install(DIRECTORY MyLibrary DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}") 96 | 97 | if(CMAKE_SYSTEM_NAME MATCHES "Linux") 98 | if(OMP_TEST) 99 | install(FILES 100 | ru.mail.bobilev_yury.MyLibrary.omp.desktop DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications") 101 | else() 102 | install(FILES 103 | ru.mail.bobilev_yury.MyLibrary.desktop DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications") 104 | endif() 105 | install(FILES 106 | mylibrary.svg DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps") 107 | elseif(CMAKE_SYSTEM_NAME MATCHES "Windows") 108 | install(FILES 109 | mylibrary.ico DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/512x512/apps") 110 | endif() 111 | 112 | if(Gettext_FOUND) 113 | GETTEXT_PROCESS_PO_FILES("ru" ALL 114 | INSTALL_DESTINATION "${CMAKE_INSTALL_LOCALEDIR}" 115 | PO_FILES po/MyLibrary.po 116 | ) 117 | endif() 118 | 119 | 120 | -------------------------------------------------------------------------------- /MLBookProc/MLBookProc/genre_groups.csv: -------------------------------------------------------------------------------- 1 | en_EN;ru_RU Russian_Russia 2 | Adventure;Приключения 3 | Antique;Древняя литература 4 | Art, art criticism, design;Искусство, искусствоведение, дизайн 5 | Child;Детская литература 6 | Computers;Компьютеры 7 | Detective;Детективы 8 | Dramaturgy;Драматургия 9 | Economics, buisness, finance;Экономика, бизнес, финансы 10 | Engineering;Техника 11 | Fantasy;Фэнтези 12 | Folklore;Фольклор 13 | Foreign;Иностранная литература 14 | Geaography;География 15 | Home;Дом 16 | Humor;Юмор 17 | Love;Любовь 18 | Nonfiction;Документальная литература 19 | Other;Другое 20 | Poetry;Поэзия 21 | Prose;Проза 22 | Psychology;Психология 23 | Reference;Справочники 24 | Religion;Религия 25 | Science;Наука 26 | Science fiction;Научная фантастика 27 | Textbooks and manuals;Учебники и пособия 28 | -------------------------------------------------------------------------------- /MLBookProc/MLBookProcConfig.cmake.in: -------------------------------------------------------------------------------- 1 | @PACKAGE_INIT@ 2 | 3 | find_package(TBB QUIET) 4 | 5 | include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") 6 | 7 | check_required_components(@PROJECT_NAME@) 8 | -------------------------------------------------------------------------------- /MLBookProc/include/ARCHParser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef ARCHPARSER_H 18 | #define ARCHPARSER_H 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #ifndef USE_OPENMP 29 | #include 30 | #include 31 | #include 32 | #else 33 | #include 34 | #endif 35 | 36 | /*! 37 | * \brief The ARCHParser class. 38 | * 39 | * Class for archives parsing. In most cases you do not need to use this class 40 | * directly. Use CreateCollection or RefreshCollection instead. 41 | */ 42 | class ARCHParser : public LibArchive 43 | { 44 | public: 45 | /*! 46 | * \brief ARCHParser constructor. 47 | * \param af smart pointer to AuxFunc object. 48 | * \param rar_support if \a true, ARCHParser will parse rar archives, 49 | * otherwise not. 50 | */ 51 | ARCHParser(const std::shared_ptr &af, const bool &rar_support); 52 | 53 | /*! 54 | * \brief ARCHParser destructor. 55 | */ 56 | virtual ~ARCHParser(); 57 | 58 | /*! 59 | * \brief This method carries out actual parsing. 60 | * 61 | * Call this method to start archive parsing. 62 | * \param filepath absolute path to archive. 63 | * \return Vector of BookParseEntry objects. 64 | */ 65 | std::vector 66 | arch_parser(const std::filesystem::path &filepath); 67 | 68 | /*! 69 | * \brief Stops all operations. 70 | */ 71 | void 72 | stopAll(); 73 | 74 | private: 75 | void 76 | arch_process(const std::shared_ptr &a); 77 | 78 | void 79 | unpack_entry(const std::filesystem::path &ch_p, 80 | const std::shared_ptr &a, 81 | const std::shared_ptr &e); 82 | 83 | void 84 | check_for_fbd(); 85 | 86 | static void 87 | signalHandler(int sig); 88 | 89 | std::shared_ptr af; 90 | bool rar_support = false; 91 | 92 | std::vector result; 93 | std::vector fbd; 94 | 95 | std::vector archp_obj; 96 | 97 | #ifndef USE_OPENMP 98 | std::mutex archp_obj_mtx; 99 | std::atomic cancel; 100 | 101 | bool extra_run = false; 102 | std::mutex extra_run_mtx; 103 | std::condition_variable extra_run_var; 104 | #else 105 | bool cancel = false; 106 | omp_lock_t archp_obj_mtx; 107 | #endif 108 | 109 | std::filesystem::path arch_path; 110 | }; 111 | 112 | #endif // ARCHPARSER_H 113 | -------------------------------------------------------------------------------- /MLBookProc/include/ArchEntry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef ZIPFILEENTRY_H 18 | #define ZIPFILEENTRY_H 19 | 20 | #include 21 | #include 22 | 23 | /*! 24 | * \brief The ArchEntry class 25 | * 26 | * Auxiliary class for LibArchive. Contains some technical info about 27 | * compressed files and directories. In most cases you do not need to create 28 | * AcrhEntry objects yourself. 29 | */ 30 | class ArchEntry 31 | { 32 | public: 33 | /*! 34 | * \brief ArchEntry constructor. 35 | */ 36 | ArchEntry(); 37 | 38 | /*! 39 | * \brief ArchEntry copy constructor. 40 | */ 41 | ArchEntry(const ArchEntry &other); 42 | 43 | /*! 44 | * \brief ArchEntry move constructor. 45 | */ 46 | ArchEntry(ArchEntry &&other); 47 | 48 | /*! 49 | * \brief operator = 50 | */ 51 | ArchEntry & 52 | operator=(const ArchEntry &other); 53 | 54 | /*! 55 | * \brief operator = 56 | */ 57 | ArchEntry & 58 | operator=(ArchEntry &&other); 59 | 60 | /*! 61 | * \brief Size of unpacked entry object (if available, 0 otherwise). 62 | */ 63 | uint64_t size = 0; 64 | 65 | /*! 66 | * \brief Size of compressed object (if available, 0 otherwise). 67 | */ 68 | uint64_t compressed_size = 0; 69 | 70 | /*! 71 | * \brief Position of entry in archive file (if available, -1 otherwise). 72 | */ 73 | int64_t position = -1; 74 | 75 | /*! 76 | * \brief Path to file or directory in archive. 77 | */ 78 | std::string filename; 79 | }; 80 | 81 | #endif // ZIPFILEENTRY_H 82 | -------------------------------------------------------------------------------- /MLBookProc/include/ArchiveFileEntry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef ARCHIVEFILEENTRY_H 18 | #define ARCHIVEFILEENTRY_H 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | /*! 25 | * \brief The ArchiveFileEntry class. 26 | * 27 | * Auxiliary class for LibArchive methods. In most cases you do not need to 28 | * create it directly, use LibArchive::createArchFile() method instead. 29 | */ 30 | class ArchiveFileEntry 31 | { 32 | public: 33 | /*! 34 | * \brief ArchiveFileEntry constructor. 35 | */ 36 | ArchiveFileEntry(); 37 | 38 | /*! 39 | * \brief ArchiveFileEntry destructor. 40 | */ 41 | virtual ~ArchiveFileEntry(); 42 | 43 | /*! 44 | * \brief Archive file stream 45 | */ 46 | std::fstream file; 47 | 48 | /*! 49 | * \brief Archive file absolute path 50 | */ 51 | std::filesystem::path file_path; 52 | 53 | /*! 54 | * \brief Size of buffer to be used in file stream 55 | */ 56 | la_ssize_t buf_sz = 1048576; 57 | 58 | /*! 59 | * \brief Number of bites already read from archive file. 60 | */ 61 | la_ssize_t read_bytes = 0; 62 | 63 | /*! 64 | * \brief Archive file size 65 | */ 66 | la_ssize_t file_size = 0; 67 | 68 | /*! 69 | * \brief Buffer to be used in file stream 70 | */ 71 | char *read_buf = nullptr; 72 | }; 73 | 74 | #endif // ARCHIVEFILEENTRY_H 75 | -------------------------------------------------------------------------------- /MLBookProc/include/ArchiveRemoveEntry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef ARCHIVEREMOVEENTRY_H 18 | #define ARCHIVEREMOVEENTRY_H 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | /*! 25 | * \brief The ArchiveRemoveEntry class. 26 | * 27 | * Auxiliary class for LibArchive, to be used in case of removing files from 28 | * archives. In most cases you do not need to use it directly. 29 | */ 30 | class ArchiveRemoveEntry 31 | { 32 | public: 33 | /*! 34 | * \brief ArchiveRemoveEntry constructor. 35 | */ 36 | ArchiveRemoveEntry(); 37 | 38 | /*! 39 | * \brief ArchiveRemoveEntry destructor. 40 | */ 41 | virtual ~ArchiveRemoveEntry(); 42 | 43 | /*! 44 | * \brief ArchiveRemoveEntry copy constructor. 45 | */ 46 | ArchiveRemoveEntry(const ArchiveRemoveEntry &other); 47 | 48 | /*! 49 | * \brief ArchiveRemoveEntry move constructor. 50 | */ 51 | ArchiveRemoveEntry(ArchiveRemoveEntry &&other); 52 | 53 | /*! 54 | * \brief operator = 55 | */ 56 | ArchiveRemoveEntry & 57 | operator=(const ArchiveRemoveEntry &other); 58 | 59 | /*! 60 | * \brief operator = 61 | */ 62 | ArchiveRemoveEntry & 63 | operator=(ArchiveRemoveEntry &&other); 64 | 65 | /*! 66 | * \brief libarchive object, file to be removed from. 67 | */ 68 | std::shared_ptr a_read; 69 | 70 | /*! 71 | * \brief libarchive object for new archive. 72 | */ 73 | std::shared_ptr a_write; 74 | 75 | /*! 76 | * \brief ArchiveFileEntry object, file to be removed from. 77 | */ 78 | std::shared_ptr fl; 79 | }; 80 | 81 | #endif // ARCHIVEREMOVEENTRY_H 82 | -------------------------------------------------------------------------------- /MLBookProc/include/BookBaseEntry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef BOOKBASEENTRY_H 18 | #define BOOKBASEENTRY_H 19 | 20 | #include 21 | #include 22 | 23 | /*! 24 | * \brief The BookBaseEntry class. 25 | * 26 | * Auxiliary class, used to keep collections databases seacrh requests and 27 | * search results. 28 | */ 29 | class BookBaseEntry 30 | { 31 | public: 32 | /*! 33 | * \brief BookBaseEntry constructor. 34 | */ 35 | BookBaseEntry(); 36 | 37 | /*! 38 | * \brief BookBaseEntry copy constructor. 39 | */ 40 | BookBaseEntry(const BookBaseEntry &other); 41 | 42 | /*! 43 | * \brief BookBaseEntry move constructor. 44 | */ 45 | BookBaseEntry(BookBaseEntry &&other); 46 | 47 | /*! 48 | * \brief operator = 49 | */ 50 | BookBaseEntry & 51 | operator=(const BookBaseEntry &other); 52 | 53 | /*! 54 | * \brief operator = 55 | */ 56 | BookBaseEntry & 57 | operator=(BookBaseEntry &&other); 58 | 59 | /*! 60 | * \brief operator == 61 | */ 62 | bool 63 | operator==(const BookBaseEntry &other); 64 | 65 | /*! 66 | * \brief BookBaseEntry constructor. 67 | * \param bpe BookParseEntry object. 68 | * \param book_file_path absolute path to books file or archive. 69 | */ 70 | BookBaseEntry(const BookParseEntry &bpe, 71 | const std::filesystem::path &book_file_path); 72 | 73 | /*! 74 | * \brief Absolute path to book file or archive. 75 | */ 76 | std::filesystem::path file_path; 77 | 78 | /*! 79 | * \brief BookParseEntry object. 80 | */ 81 | BookParseEntry bpe; 82 | }; 83 | 84 | #endif // BOOKBASEENTRY_H 85 | -------------------------------------------------------------------------------- /MLBookProc/include/BookInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef BOOKINFO_H 18 | #define BOOKINFO_H 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | /*! 28 | * \brief The BookInfo class. 29 | * 30 | * This class contains methods to get extra information (like annotation, 31 | * cover, source paper book info, etc) from books. 32 | */ 33 | class BookInfo 34 | { 35 | public: 36 | /*! 37 | * \brief BookInfo constructor. 38 | * \param af smart pointer to AuxFunc object. 39 | */ 40 | BookInfo(const std::shared_ptr &af); 41 | 42 | /*! 43 | * \brief Retruns information about book. 44 | * 45 | * See also set_dpi(). 46 | * \param bbe search result, returned by BaseKeeper::searchBook() method. 47 | * \return Smart pointer to BookInfoEntry object containing various 48 | * information about book. 49 | */ 50 | std::shared_ptr 51 | get_book_info(const BookBaseEntry &bbe); 52 | 53 | /*! 54 | * \brief Sets DPI. 55 | * 56 | * This method should be called before get_book_info(). It sets DPI to display 58 | * books cover correctly. Default values are 72.0 and 72.0. It is not 59 | * compulsory to call this method, but it is highly recommended. 60 | * 61 | * \param h_dpi horizontal 62 | * HREF="https://en.wikipedia.org/wiki/Dots_per_inch">DPI. 63 | * \param v_dpi vertical 64 | * HREF="https://en.wikipedia.org/wiki/Dots_per_inch">DPI. 65 | */ 66 | void 67 | set_dpi(const double &h_dpi, const double &v_dpi); 68 | 69 | private: 70 | std::shared_ptr 71 | get_from_archive(const BookBaseEntry &bbe, const std::string &ext); 72 | 73 | bool 74 | compare_func(const ArchEntry &ent, const bool &encoding, 75 | const std::string &conv_nm, 76 | const std::filesystem::path &ch_fbd); 77 | 78 | std::shared_ptr af; 79 | double h_dpi = 72.0; 80 | double v_dpi = 72.0; 81 | }; 82 | 83 | #endif // BOOKINFO_H 84 | -------------------------------------------------------------------------------- /MLBookProc/include/BookInfoEntry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef BOOKINFOENTRY_H 18 | #define BOOKINFOENTRY_H 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | /*! 25 | * \brief The BookInfoEntry class. 26 | * 27 | * Auxiliary class keeping various extra information about book (see 28 | * BookInfo). 29 | */ 30 | class BookInfoEntry 31 | { 32 | public: 33 | /*! 34 | * \brief BookInfoEntry constructor. 35 | */ 36 | BookInfoEntry(); 37 | 38 | /*! 39 | * \brief BookInfoEntry destructor. 40 | */ 41 | virtual ~BookInfoEntry(); 42 | 43 | /*! 44 | * \brief BookInfoEntry copy constructor. 45 | */ 46 | BookInfoEntry(const BookInfoEntry &other); 47 | 48 | /*! 49 | * \brief BookInfoEntry move constructor. 50 | */ 51 | BookInfoEntry(BookInfoEntry &&other); 52 | 53 | /*! 54 | * \brief operator = 55 | */ 56 | BookInfoEntry & 57 | operator=(const BookInfoEntry &other); 58 | 59 | /*! 60 | * \brief operator = 61 | */ 62 | BookInfoEntry & 63 | operator=(BookInfoEntry &&other); 64 | 65 | /*! 66 | * \brief Book annotation. 67 | */ 68 | std::string annotation; 69 | 70 | /*! 71 | * \brief Book cover image. 72 | */ 73 | std::string cover; 74 | 75 | /*! 76 | * \brief The cover types enumerator. 77 | */ 78 | enum cover_types 79 | { 80 | base64, /*!< base64 image*/ 81 | file, /*!< various image files formats, like JPG*/ 82 | rgb, /*!< RGB image*/ 83 | rgba, /*!< RGBA image*/ 84 | error /*!< no image, default value*/ 85 | }; 86 | 87 | /*! 88 | * \brief Type of image. 89 | */ 90 | cover_types cover_type = cover_types::error; 91 | 92 | /*! 93 | * \brief Book language. 94 | */ 95 | std::string language; 96 | 97 | /*! 98 | * \brief Language of book source. 99 | */ 100 | std::string src_language; 101 | 102 | /*! 103 | * \brief Translator. 104 | */ 105 | std::string translator; 106 | 107 | /*! 108 | * \brief Pointer to PaperBookInfoEntry. 109 | */ 110 | PaperBookInfoEntry *paper = nullptr; 111 | 112 | /*! 113 | * \brief Various technical information about book file. See 114 | * ElectroBookInfoEntry. 115 | */ 116 | ElectroBookInfoEntry *electro = nullptr; 117 | 118 | /*! 119 | * \brief Number of bytes per row for RGB and RGBA images. 120 | */ 121 | int bytes_per_row = 0; 122 | }; 123 | 124 | #endif // BOOKINFOENTRY_H 125 | -------------------------------------------------------------------------------- /MLBookProc/include/BookMarks.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef BOOKMARKS_H 18 | #define BOOKMARKS_H 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #ifdef USE_OPENMP 26 | #include 27 | #else 28 | #include 29 | #endif 30 | 31 | /*! 32 | * \brief The BookMarks class. 33 | * 34 | * This class keeps and operates collection bookmarks. Path to bookmarks base 35 | * is "~/.local/share/MyLibrary/BookMarks/bookmarks". 36 | */ 37 | class BookMarks 38 | { 39 | public: 40 | /*! 41 | * \brief BookMarks constructor. 42 | * \param af smart pointer to AuxFunc object. 43 | */ 44 | BookMarks(const std::shared_ptr &af); 45 | 46 | /*! 47 | * \brief BookMarks destructor. 48 | */ 49 | virtual ~BookMarks(); 50 | 51 | /*! 52 | * \brief Creates bookmark. 53 | * 54 | * If bookmark already exists, returns 0, in case of success returns 1, 55 | * otherwise returns -1. 56 | * 57 | * \param col_name collection name book came from. 58 | * \param bbe BookBaseEntry got from BaseKeeper::searchBook(). 59 | * \return Error code. 60 | */ 61 | int 62 | createBookMark(const std::string &col_name, const BookBaseEntry &bbe); 63 | 64 | /*! 65 | * \brief Returns bookmarks. 66 | * \return Vector of bookmarks tuples. First element of tuple is collection 67 | * name, book came from. Second element is book entry. 68 | */ 69 | std::vector> 70 | getBookMarks(); 71 | 72 | /*! 73 | * \brief Removes bookmark. 74 | * 75 | * \param col_name collection name. 76 | * \param bbe book entry to be removed. 77 | */ 78 | void 79 | removeBookMark(const std::string &col_name, const BookBaseEntry &bbe); 80 | 81 | private: 82 | void 83 | loadBookMarks(); 84 | 85 | std::tuple 86 | parse_entry(const std::string &buf); 87 | 88 | // TODO remove legacy code in next releases 89 | std::tuple 90 | parse_entry_legacy(const std::string &buf); 91 | 92 | bool 93 | saveBookMarks(); 94 | 95 | std::string 96 | form_entry(const std::string &col_name, const BookBaseEntry &bbe); 97 | 98 | std::shared_ptr af; 99 | 100 | std::filesystem::path bookmp; 101 | 102 | std::vector> bookmarks; 103 | #ifndef USE_OPENMP 104 | std::mutex bookmarksmtx; 105 | #else 106 | omp_lock_t bookmarksmtx; 107 | #endif 108 | }; 109 | 110 | #endif // BOOKMARKS_H 111 | -------------------------------------------------------------------------------- /MLBookProc/include/BookParseEntry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef BOOKPARSEENTRY_H 18 | #define BOOKPARSEENTRY_H 19 | 20 | #include 21 | 22 | /*! 23 | * \brief The BookParseEntry class. 24 | * 25 | * Auxiliary class keeping relative path to book in file (in case of archive, 26 | * empty otherwise), book author(s), book name, book series, book genre(s), 27 | * date of book creation (if available). 28 | */ 29 | class BookParseEntry 30 | { 31 | public: 32 | /*! 33 | * \brief BookParseEntry constructor. 34 | */ 35 | BookParseEntry(); 36 | 37 | /*! 38 | * \brief BookParseEntry copy constructor. 39 | */ 40 | BookParseEntry(const BookParseEntry &other); 41 | 42 | /*! 43 | * \brief BookParseEntry move constructor. 44 | */ 45 | BookParseEntry(BookParseEntry &&other); 46 | 47 | /*! 48 | * \brief operator = 49 | */ 50 | BookParseEntry & 51 | operator=(const BookParseEntry &other); 52 | 53 | /*! 54 | * \brief operator = 55 | */ 56 | BookParseEntry & 57 | operator=(BookParseEntry &&other); 58 | 59 | /*! 60 | * \brief operator == 61 | */ 62 | bool 63 | operator==(const BookParseEntry &other); 64 | 65 | /*! 66 | * \brief Path to book in file (in case of archive, empty 67 | * otherwise). 68 | * 69 | * In case of "archive inside archive" situation "\n" (ASCII new line) symbol 70 | * used as separator. It means that path to book inside archive looks like 71 | * "\n\n\n" or 72 | * "\n". 73 | */ 74 | std::string book_path; 75 | 76 | /*! 77 | * \brief Book author (if any, empty otherwise). 78 | */ 79 | std::string book_author; 80 | 81 | /*! 82 | * \brief Book name. 83 | * 84 | * Must not be empty. If book name cannot be obtained from book metadata, 85 | * book file name will be used. 86 | */ 87 | std::string book_name; 88 | 89 | /*! 90 | * \brief Book series (if any, empty otherwise). 91 | */ 92 | std::string book_series; 93 | 94 | /*! 95 | * \brief Book genres(s) (if any, empty otherwise). 96 | * 97 | * List of genres separated by ", " sequence. 98 | */ 99 | std::string book_genre; 100 | 101 | /*! 102 | * \brief Book creation date (if available in metadata, empty otherwise). 103 | */ 104 | std::string book_date; 105 | }; 106 | 107 | #endif // BOOKPARSEENTRY_H 108 | -------------------------------------------------------------------------------- /MLBookProc/include/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources (mlbookproc 2 | PRIVATE AddBook.h 3 | PRIVATE ArchEntry.h 4 | PRIVATE ArchiveFileEntry.h 5 | PRIVATE ArchiveRemoveEntry.h 6 | PRIVATE ARCHParser.h 7 | PRIVATE AuxFunc.h 8 | PRIVATE BaseKeeper.h 9 | PRIVATE BookBaseEntry.h 10 | PRIVATE BookInfoEntry.h 11 | PRIVATE BookInfo.h 12 | PRIVATE BookMarks.h 13 | PRIVATE BookParseEntry.h 14 | PRIVATE ByteOrder.h 15 | PRIVATE CreateCollection.h 16 | PRIVATE DCParser.h 17 | PRIVATE DJVUParser.h 18 | PRIVATE ElectroBookInfoEntry.h 19 | PRIVATE EPUBParser.h 20 | PRIVATE FB2Parser.h 21 | PRIVATE FileParseEntry.h 22 | PRIVATE FormatAnnotation.h 23 | PRIVATE GenreGroup.h 24 | PRIVATE Genre.h 25 | PRIVATE Hasher.h 26 | PRIVATE LibArchive.h 27 | PRIVATE MLException.h 28 | PRIVATE NotesBaseEntry.h 29 | PRIVATE NotesKeeper.h 30 | PRIVATE ODTParser.h 31 | PRIVATE OpenBook.h 32 | PRIVATE PaperBookInfoEntry.h 33 | PRIVATE PDFParser.h 34 | PRIVATE RefreshCollection.h 35 | PRIVATE RemoveBook.h 36 | PRIVATE ReplaceTagItem.h 37 | PRIVATE SelfRemovingPath.h 38 | PRIVATE XMLParser.h 39 | PRIVATE XMLTag.h 40 | ) 41 | 42 | if(USE_OPENMP) 43 | target_sources(mlbookproc PRIVATE OmpLockGuard.h) 44 | endif() 45 | -------------------------------------------------------------------------------- /MLBookProc/include/DJVUParser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef DJVUPARSER_H 18 | #define DJVUPARSER_H 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | /*! 28 | * \brief The DJVUParser class. 29 | * 30 | * This class contains various methods for djvu books processing. In most cases 31 | * you do not need to use this class directly. Use CreateCollection, 32 | * RefreshCollection and BookInfo instead. 33 | */ 34 | class DJVUParser 35 | { 36 | public: 37 | /*! 38 | * \brief DJVUParser constructor. 39 | * \param af smart pointer to AuxFunc object. 40 | */ 41 | DJVUParser(const std::shared_ptr &af); 42 | 43 | /*! 44 | * \brief Parses djvu book. 45 | * \param filepath absolute path to djvu book. 46 | * \return BookParseEntry object. 47 | */ 48 | BookParseEntry 49 | djvu_parser(const std::filesystem::path &filepath); 50 | 51 | /*! 52 | * \brief Returns book info and book cover. 53 | * \param filepath absolute path to djvu book. 54 | * \return Smart pointer to BookInfoEntry object. 55 | */ 56 | std::shared_ptr 57 | djvu_book_info(const std::filesystem::path &filepath); 58 | 59 | private: 60 | bool 61 | handleDJVUmsgs(const std::shared_ptr &ctx, 62 | const std::shared_ptr &doc, 63 | const bool &wait = bool(true)); 64 | 65 | void 66 | getTag(const std::string &exp, const std::string &tag, std::string &line); 67 | 68 | std::shared_ptr af; 69 | }; 70 | 71 | #endif // DJVUPARSER_H 72 | -------------------------------------------------------------------------------- /MLBookProc/include/EPUBParser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef EPUBPARSER_H 18 | #define EPUBPARSER_H 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | /*! 34 | * \brief The EPUBParser class. 35 | * 36 | * This class contains various methods for epub books parsing. In most cases 37 | * you do not need to use this class directly. Use CreateCollection, 38 | * RefreshCollection and BookInfo instead. 39 | */ 40 | class EPUBParser : public XMLParser, public LibArchive 41 | { 42 | public: 43 | /*! 44 | * \brief EPUBParser constructor. 45 | * \param af smart pointer to AuxFunc object. 46 | */ 47 | EPUBParser(const std::shared_ptr &af); 48 | 49 | /*! 50 | * \brief EPUBParser destructor. 51 | */ 52 | virtual ~EPUBParser(); 53 | 54 | /*! 55 | * \brief Parses epub book. 56 | * \param filepath absolute path to epub file. 57 | * \return BookParseEntry object. 58 | */ 59 | BookParseEntry 60 | epub_parser(const std::filesystem::path &filepath); 61 | 62 | /*! 63 | * \brief Returns epub book info and cover. 64 | * \param filepath absolute path to epub file. 65 | * \return Smart pointer to BookInfoEntry object. 66 | */ 67 | std::shared_ptr 68 | epub_book_info(const std::filesystem::path &filepath); 69 | 70 | private: 71 | std::string 72 | epub_get_root_file_address(const std::filesystem::path &filepath, 73 | const std::vector &filenames); 74 | 75 | BookParseEntry 76 | epub_parse_root_file(const std::string &root_file_content); 77 | 78 | std::string 79 | epub_annotation(const std::string &root_file_content); 80 | 81 | std::string 82 | epub_cover_address(const std::string &root_file_content); 83 | 84 | void 85 | epub_language(const std::string &root_file_content, BookInfoEntry &result); 86 | 87 | void 88 | epub_translator(const std::string &root_file_content, BookInfoEntry &result); 89 | 90 | void 91 | epub_publisher(const std::string &root_file_content, BookInfoEntry &result); 92 | 93 | void 94 | epub_identifier(const std::string &root_file_content, BookInfoEntry &result); 95 | 96 | void 97 | epub_source(const std::string &root_file_content, BookInfoEntry &result); 98 | 99 | std::shared_ptr af; 100 | 101 | DCParser *dc; 102 | }; 103 | 104 | #endif // EPUBPARSER_H 105 | -------------------------------------------------------------------------------- /MLBookProc/include/ElectroBookInfoEntry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef ELECTROBOOKINFOENTRY_H 18 | #define ELECTROBOOKINFOENTRY_H 19 | 20 | #include 21 | 22 | /*! 23 | * \brief The ElectroBookInfoEntry class. 24 | * 25 | * Auxiliary class containing various technical info about digital book file. 26 | */ 27 | class ElectroBookInfoEntry 28 | { 29 | public: 30 | /*! 31 | * \brief ElectroBookInfoEntry constructor. 32 | */ 33 | ElectroBookInfoEntry(); 34 | 35 | /*! 36 | * \brief ElectroBookInfoEntry copy constructor. 37 | */ 38 | ElectroBookInfoEntry(const ElectroBookInfoEntry &other); 39 | 40 | /*! 41 | * \brief ElectroBookInfoEntry move constructor. 42 | */ 43 | ElectroBookInfoEntry(ElectroBookInfoEntry &&other); 44 | 45 | /*! 46 | * \brief operator = 47 | */ 48 | ElectroBookInfoEntry & 49 | operator=(const ElectroBookInfoEntry &other); 50 | 51 | /*! 52 | * \brief operator = 53 | */ 54 | ElectroBookInfoEntry & 55 | operator=(ElectroBookInfoEntry &&other); 56 | 57 | /*! 58 | * \brief Indicates if any information is available. 59 | */ 60 | bool available = false; 61 | 62 | /*! 63 | * \brief Author of file. 64 | */ 65 | std::string author; 66 | 67 | /*! 68 | * \brief Program used to create file. 69 | */ 70 | std::string program_used; 71 | 72 | /*! 73 | * \brief Date of file creation. 74 | */ 75 | std::string date; 76 | 77 | /*! 78 | * \brief Source URL if this document is a conversion of some other (online) 79 | * document. 80 | */ 81 | std::string src_url; 82 | 83 | /*! 84 | * \brief Author of the original (online) document, if this is a conversion. 85 | */ 86 | std::string src_ocr; 87 | 88 | /*! 89 | * \brief Unique file identifier. 90 | */ 91 | std::string id; 92 | 93 | /*! 94 | * \brief File version. 95 | */ 96 | std::string version; 97 | 98 | /*! 99 | * \brief History of file changes. 100 | */ 101 | std::string history; 102 | 103 | /*! 104 | * \brief File publisher. 105 | */ 106 | std::string publisher; 107 | }; 108 | 109 | #endif // ELECTROBOOKINFOENTRY_H 110 | -------------------------------------------------------------------------------- /MLBookProc/include/FB2Parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef FB2PARSER_H 18 | #define FB2PARSER_H 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | /*! 30 | * \brief The FB2Parser class. 31 | * 32 | * This class contains various methods for fb2 books parsing. In most cases you 33 | * do not need to use this class directly. Use CreateCollection, 34 | * RefreshCollection and BookInfo instead. 35 | */ 36 | class FB2Parser : public XMLParser 37 | { 38 | public: 39 | /*! 40 | * \brief FB2Parser constructor. 41 | * \param af smart pointer to AuxFunc object. 42 | */ 43 | FB2Parser(const std::shared_ptr &af); 44 | 45 | /*! 46 | * \brief Parses fb2 book. 47 | * 48 | * \note This method can throw MLException object in case of any errors. 49 | * \param book fb2 file content. 50 | * \return BookParseEntry object. 51 | */ 52 | BookParseEntry 53 | fb2_parser(const std::string &book); 54 | 55 | /*! 56 | * \brief Returns fb2 book info and cover. 57 | * \param book fb2 books file content. 58 | * \return Smart poiner to BookInfoEntry object. 59 | */ 60 | std::shared_ptr 61 | fb2_book_info(const std::string &book); 62 | 63 | private: 64 | BookParseEntry 65 | fb2_description(const std::string &book); 66 | 67 | std::string 68 | fb2_author(const std::string &book, const std::vector &author); 69 | 70 | std::string 71 | fb2_series(const std::vector &sequence); 72 | 73 | std::string 74 | fb2_genres(const std::string &book, const std::vector &genres); 75 | 76 | void 77 | fb2_annotation_decode(const std::string &book, std::string &result); 78 | 79 | void 80 | fb2_cover(const std::string &book, std::string &cover); 81 | 82 | void 83 | fb2_extra_info(const std::string &book, BookInfoEntry &result); 84 | 85 | void 86 | fb2_publisher_info(const std::string &book, BookInfoEntry &result); 87 | 88 | void 89 | fb2_electro_doc_info(const std::string &book, BookInfoEntry &result); 90 | 91 | void 92 | fb2_elctor_publisher(const std::string &book, const std::vector &tgv, 93 | BookInfoEntry &result); 94 | 95 | void 96 | recursiveGetTags(const std::string &book, const std::vector &tgv, 97 | std::string &result); 98 | 99 | std::shared_ptr af; 100 | }; 101 | 102 | #endif // FB2PARSER_H 103 | -------------------------------------------------------------------------------- /MLBookProc/include/FileParseEntry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef FILEPARSEENTRY_H 18 | #define FILEPARSEENTRY_H 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | /*! 25 | * \brief The FileParseEntry class. 26 | * 27 | * Auxiliary class, used in CreateCollection, RefreshCollection and BaseKeeper. 28 | * Contains collection file info. 29 | */ 30 | class FileParseEntry 31 | { 32 | public: 33 | /*! 34 | * \brief FileParseEntry constructor. 35 | */ 36 | FileParseEntry(); 37 | 38 | /*! 39 | * \brief FileParseEntry copy constructor. 40 | */ 41 | FileParseEntry(const FileParseEntry &other); 42 | 43 | /*! 44 | * \brief FileParseEntry move constructor. 45 | */ 46 | FileParseEntry(FileParseEntry &&other); 47 | 48 | /*! 49 | * \brief operator = 50 | */ 51 | FileParseEntry & 52 | operator=(const FileParseEntry &other); 53 | 54 | /*! 55 | * \brief operator = 56 | */ 57 | FileParseEntry & 58 | operator=(FileParseEntry &&other); 59 | 60 | /*! 61 | * \brief Relative path to file in collection. 62 | * 63 | * Path is relative to collection directory path. 64 | */ 65 | std::string file_rel_path; 66 | 67 | /*! 68 | * \brief File hash sum. 69 | * 70 | * Blake-256 algorithm currently used. 71 | */ 72 | std::string file_hash; 73 | 74 | /*! 75 | * \brief Contains books info. 76 | * 77 | * Vector containing information about books in file. 78 | */ 79 | std::vector books; 80 | }; 81 | 82 | #endif // FILEPARSEENTRY_H 83 | -------------------------------------------------------------------------------- /MLBookProc/include/FormatAnnotation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef FORMATANNOTATION_H 18 | #define FORMATANNOTATION_H 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | /*! 28 | * \brief The FormatAnnotation class. 29 | * 30 | * This class contains different methods for annotation processing. 31 | */ 32 | class FormatAnnotation : XMLParser 33 | { 34 | public: 35 | /*! 36 | * \brief FormatAnnotation constructor. 37 | * \param af smart pointer to AuxFunc object. 38 | */ 39 | FormatAnnotation(const std::shared_ptr &af); 40 | 41 | /*! 42 | * \brief Removes escape sequences from annotation. 43 | * 44 | * Removes ASCII symbols 46 | * 0 to 31 (inclusive) from annotation. Only exception is symbol 9 47 | * (horizontal tab). It will be replaced by 32 (space). Also removes extra 48 | * spaces from annotation beginning. 49 | * \param annotation UTF-8 annotation content string. 50 | */ 51 | void 52 | remove_escape_sequences(std::string &annotation); 53 | 54 | /*! 55 | * \brief Replaces XML tags. 56 | * 57 | * It is highly recommended to call setTagReplacementTable() method before 58 | * this method call (but it is not compulsory). If tag replacement table is 59 | * empty, all tags will be just removed. 60 | * \param annotation UTF-8 annotation content string. 61 | */ 62 | void 63 | replace_tags(std::string &annotation); 64 | 65 | /*! 66 | * \brief Cleans some sequences from annotation. 67 | * 68 | * Replaces "three spaces" by "two spaces" at the annotation beginning, 69 | * removes "\n" from annotation beginning, removes 0 - 32 ASCII symbols 71 | * from the annotation end. Also replaces "\n\n\n" sequences by "\n\n" in 72 | * whole annotation. 73 | * \param annotation UTF-8 annotation content string. 74 | */ 75 | void 76 | final_cleaning(std::string &annotation); 77 | 78 | /*! 79 | * \brief Simply removes all XML tags. 80 | * \param annotation UTF-8 annotation content string. 81 | */ 82 | void 83 | removeAllTags(std::string &annotation); 84 | 85 | /*! 86 | * \brief Sets tag replacement table. 87 | * 88 | * If you need to replace XML tags by your own tags or text, you should call 89 | * this method before replace_tags() call to set replacement table. 90 | * \param replacement_table vector containing ReplaceTagItem objects. 91 | */ 92 | void 93 | setTagReplacementTable(const std::vector &replacement_table); 94 | 95 | private: 96 | void 97 | replace_html(std::string &annotation, const std::string &sstr, 98 | const std::string &replacement); 99 | 100 | void 101 | recursiveReplacement(const std::vector &tgv, 102 | std::string &annotation); 103 | 104 | std::vector replacement_table; 105 | }; 106 | 107 | #endif // FORMATANNOTATION_H 108 | -------------------------------------------------------------------------------- /MLBookProc/include/Genre.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef GENRE_H 18 | #define GENRE_H 19 | 20 | #include 21 | 22 | /*! 23 | * \brief The Genre class. 24 | * 25 | * Auxiliary class containing translated genre element (see also 26 | * AuxFunc::get_genre_list() and GenreGroup). 27 | */ 28 | class Genre 29 | { 30 | public: 31 | /*! 32 | * \brief Genre constructor. 33 | */ 34 | Genre(); 35 | 36 | /*! 37 | * \brief Genre copy constructor. 38 | */ 39 | Genre(const Genre &other); 40 | 41 | /*! 42 | * \brief Genre move constructor. 43 | */ 44 | Genre(Genre &&other); 45 | 46 | /*! 47 | * \brief operator = 48 | */ 49 | Genre & 50 | operator=(const Genre &other); 51 | 52 | /*! 53 | * \brief operator = 54 | */ 55 | Genre & 56 | operator=(Genre &&other); 57 | 58 | /*! 59 | * \brief fb2 genre code. 60 | * 61 | * This code is usually valid for epub books also. 62 | */ 63 | std::string genre_code; 64 | 65 | /*! 66 | * \brief Translated human-readable genre name. 67 | * 68 | * If translation is not available, English genre name will be set. 69 | * For translations see "/MLBookProc/genres.csv" 70 | */ 71 | std::string genre_name; 72 | }; 73 | 74 | #endif // GENRE_H 75 | -------------------------------------------------------------------------------- /MLBookProc/include/GenreGroup.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef GENREGROUP_H 18 | #define GENREGROUP_H 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | /*! 25 | * \brief The GenreGroup class. 26 | * 27 | * Auxiliary class containing genre group (see also 28 | * AuxFunc::get_genre_list()). 29 | */ 30 | class GenreGroup 31 | { 32 | public: 33 | /*! 34 | * \brief GenreGroup constructor. 35 | */ 36 | GenreGroup(); 37 | 38 | /*! 39 | * \brief GenreGroup copy constructor. 40 | */ 41 | GenreGroup(const GenreGroup &other); 42 | 43 | /*! 44 | * \brief GenreGroup move constructor. 45 | */ 46 | GenreGroup(GenreGroup &&other); 47 | 48 | /*! 49 | * \brief operator = 50 | */ 51 | GenreGroup & 52 | operator=(const GenreGroup &other); 53 | 54 | /*! 55 | * \brief operator = 56 | */ 57 | GenreGroup & 58 | operator=(GenreGroup &&other); 59 | 60 | /*! 61 | * \brief Genre group code name. 62 | */ 63 | std::string group_code; 64 | 65 | /*! 66 | * \brief Translated human-readable genre group name. 67 | * 68 | * If translation is not available, English genre group name will be set. 69 | * For translations see "/MLBookProc/genre_groups.csv" 70 | */ 71 | std::string group_name; 72 | 73 | /*! 74 | * \brief List of group genres (see Genre). 75 | */ 76 | std::vector genres; 77 | }; 78 | 79 | #endif // GENREGROUP_H 80 | -------------------------------------------------------------------------------- /MLBookProc/include/Hasher.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef HASHER_H 18 | #define HASHER_H 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #ifndef USE_OPENMP 26 | #include 27 | #endif 28 | 29 | /*! 30 | * \brief The Hasher class. 31 | * 32 | * This class contains methods for hash sums creating (Blake-256 algorithm). 33 | */ 34 | class Hasher 35 | { 36 | public: 37 | /*! 38 | * \brief Hasher constructor. 39 | * \param af smart pointer to AuxFunc object. 40 | */ 41 | Hasher(const std::shared_ptr &af); 42 | 43 | /*! 44 | * \brief Creates hash sum for given buffer. 45 | * 46 | * \note This method can throw MLException in case of error. 47 | * \param buf source buffer. 48 | * \return 32 bytes of hash sum value. 49 | */ 50 | std::string 51 | buf_hashing(const std::string &buf); 52 | 53 | /*! 54 | * \brief Creates hash sum for given file. 55 | * 56 | * \note This method can throw MLException in case of error. 57 | * \param filepath absolute path to file to be hashed. 58 | * \return 32 bytes of hash sum value. 59 | */ 60 | std::string 61 | file_hashing(const std::filesystem::path &filepath); 62 | 63 | /*! 64 | * \brief Stops all operations. 65 | */ 66 | void 67 | cancelAll(); 68 | 69 | protected: 70 | #ifndef USE_OPENMP 71 | /*! 72 | * \brief Stops all operations if \a true. 73 | * 74 | * \warning Do not call or set this variable yourself! 75 | */ 76 | std::atomic cancel; 77 | #else 78 | /*! 79 | * \brief Stops all operations if \a true. 80 | * 81 | * \warning Do not call or set this variable yourself! 82 | */ 83 | bool cancel; 84 | #endif 85 | 86 | /*! 87 | * \brief Stop signal for heir classes. 88 | * 89 | * \warning Do not call or set this variable yourself! 90 | */ 91 | std::function stop_all_signal; 92 | 93 | private: 94 | std::shared_ptr af; 95 | }; 96 | 97 | #endif // HASHER_H 98 | -------------------------------------------------------------------------------- /MLBookProc/include/MLException.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef MLEXCEPTION_H 18 | #define MLEXCEPTION_H 19 | 20 | #include 21 | 22 | /*! 23 | * \brief The MLException class. 24 | * 25 | * This class is used as exception to indicate various errors. 26 | */ 27 | class MLException 28 | { 29 | public: 30 | /*! 31 | * \brief MLException constructor. 32 | */ 33 | MLException(); 34 | 35 | /*! 36 | * \brief MLException constructor. 37 | * \param msg message to be printed. 38 | */ 39 | MLException(const std::string &msg); 40 | 41 | /*! 42 | * \brief MLException copy constructor. 43 | */ 44 | MLException(const MLException &other); 45 | 46 | /*! 47 | * \brief MLException move constructor. 48 | */ 49 | MLException(MLException &&other); 50 | 51 | /*! 52 | * \brief operator = 53 | */ 54 | MLException & 55 | operator=(const MLException &other); 56 | 57 | /*! 58 | * \brief operator = 59 | */ 60 | MLException & 61 | operator=(MLException &&other); 62 | 63 | /*! 64 | * \brief Returns \a true if MLException contains message. 65 | */ 66 | operator bool(); 67 | 68 | /*! 69 | * \brief Returns error message. 70 | * \return Error info message. 71 | */ 72 | std::string 73 | what(); 74 | 75 | private: 76 | std::string msg; 77 | }; 78 | 79 | #endif // MLEXCEPTION_H 80 | -------------------------------------------------------------------------------- /MLBookProc/include/NotesBaseEntry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | #ifndef NOTESBASEENTRY_H 17 | #define NOTESBASEENTRY_H 18 | 19 | #include 20 | 21 | /*! 22 | * \brief The NotesBaseEntry class. 23 | * 24 | * Auxiliary class containing note info. In most cases you do not need to 25 | * create NotesBaseEntry object yourself (see NotesKeeper). 26 | */ 27 | class NotesBaseEntry 28 | { 29 | public: 30 | /*! 31 | * \brief NotesBaseEntry constructor. 32 | */ 33 | NotesBaseEntry(); 34 | 35 | /*! 36 | * \brief NotesBaseEntry constructor. 37 | * \param collection_name collection name. 38 | * \param book_file_full_path absolute path to book file. 39 | * \param book_path relative path to book in file (in case of archive, empty 40 | * otherwise). 41 | */ 42 | NotesBaseEntry(const std::string &collection_name, 43 | const std::filesystem::path &book_file_full_path, 44 | const std::string &book_path); 45 | 46 | /*! 47 | * \brief NotesBaseEntry copy constructor. 48 | */ 49 | NotesBaseEntry(const NotesBaseEntry &other); 50 | 51 | /*! 52 | * \brief NotesBaseEntry move constructor. 53 | */ 54 | NotesBaseEntry(NotesBaseEntry &&other); 55 | 56 | /*! 57 | * \brief operator = 58 | */ 59 | NotesBaseEntry & 60 | operator=(const NotesBaseEntry &other); 61 | 62 | /*! 63 | * \brief operator = 64 | */ 65 | NotesBaseEntry & 66 | operator=(NotesBaseEntry &&other); 67 | 68 | /*! 69 | * \brief operator == 70 | */ 71 | bool 72 | operator==(const NotesBaseEntry &other) const; 73 | 74 | /*! 75 | * \brief Collection name. 76 | */ 77 | std::string collection_name; 78 | 79 | /*! 80 | * \brief Absolute path to book file. 81 | */ 82 | std::filesystem::path book_file_full_path; 83 | 84 | /*! 85 | * \brief Relative path to book in file (in case of archive, empty 86 | * otherwise). 87 | */ 88 | std::string book_path; 89 | 90 | /*! 91 | * \brief Absolute path to note file. 92 | */ 93 | std::filesystem::path note_file_full_path; 94 | }; 95 | 96 | #endif // NOTESBASEENTRY_H 97 | -------------------------------------------------------------------------------- /MLBookProc/include/ODTParser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | #ifndef ODTPARSER_H 17 | #define ODTPARSER_H 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | /*! 27 | * \brief The ODTParser class 28 | * 29 | * This class contains methods for odt files processing. In most cases you do 30 | * not need to use this class directly. Use CreateCollection, RefreshCollection 31 | * and BookInfo instead. 32 | */ 33 | class ODTParser : public XMLParser, public LibArchive 34 | { 35 | public: 36 | /*! 37 | * \brief ODTParser constructor. 38 | * \param af smart pointer to AuxFunc object. 39 | */ 40 | ODTParser(const std::shared_ptr &af); 41 | 42 | /*! 43 | * \brief ODTParser destructor. 44 | */ 45 | virtual ~ODTParser(); 46 | 47 | /*! 48 | * \brief Parses odt files. 49 | * 50 | * This method can be used to obtain information from odt files. 51 | * 52 | * \note This method can throw MLException in case of some errors. 53 | * 54 | * \param odt_path absolute path to odt file. 55 | * \return BookParseEntry object. 56 | */ 57 | BookParseEntry 58 | odtParser(const std::filesystem::path &odt_path); 59 | 60 | /*! 61 | * \brief Gets some extra info from odt files. 62 | * 63 | * This method can be used to obtain odt file cover and some other info (see 64 | * BookInfoEntry) if such info is avaliable. 65 | * 66 | * \note This method can throw MLException in case of some errors. 67 | * \param odt_path absolute path to odt file. 68 | * \return Smart pointer to BookInfoEntry object. 69 | */ 70 | std::shared_ptr 71 | odtBookInfo(const std::filesystem::path &odt_path); 72 | 73 | private: 74 | std::shared_ptr af; 75 | 76 | DCParser *dc; 77 | }; 78 | 79 | #endif // ODTPARSER_H 80 | -------------------------------------------------------------------------------- /MLBookProc/include/OmpLockGuard.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | #ifndef OMPLOCKGUARD_H 17 | #define OMPLOCKGUARD_H 18 | 19 | #include 20 | 21 | /*! 22 | * \brief The OmpLockGuard class. 23 | * 24 | * Auxiliary class. Locks omp_lock_t variable on creation and unlocks it on 25 | * destruction. 26 | */ 27 | class OmpLockGuard 28 | { 29 | public: 30 | /*! 31 | * \brief OmpLockGuard constructor. 32 | * 33 | * \warning \b omp_mtx must be initialized (see omp_init_lock). 35 | * \param omp_mtx omp_lock_t variable. 36 | */ 37 | OmpLockGuard(omp_lock_t &omp_mtx); 38 | 39 | /*! 40 | * \brief OmpLockGuard destructor. 41 | */ 42 | virtual ~OmpLockGuard(); 43 | 44 | private: 45 | omp_lock_t *omp_mtx_ptr; 46 | }; 47 | 48 | #endif // OMPLOCKGUARD_H 49 | -------------------------------------------------------------------------------- /MLBookProc/include/OpenBook.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef OPENBOOK_H 18 | #define OPENBOOK_H 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | /*! 31 | * \brief The OpenBook class. 32 | * 33 | * This class contains methods for books "opening". 34 | */ 35 | class OpenBook 36 | { 37 | public: 38 | /*! 39 | * \brief OpenBook constructor. 40 | * \param af smart pointer to AuxFunc object. 41 | */ 42 | OpenBook(const std::shared_ptr &af); 43 | 44 | /*! 45 | * \brief Opens book. 46 | * 47 | * If book is in archive, unpacks book and returns absolute path to unpacked 48 | * file. Otherwise returns absolute path to book file. 49 | * 50 | * If \b copy is set to \a true and \b copy_path is not empty, creates 51 | * directory on \b copy_path and copies book to it. 52 | * 53 | * If \b find_fbd is set to \a true, will try to find and open fbd file 54 | * instead of book. 55 | * 56 | * If \b open_callback is not \a nullptr, calls it. 57 | * 58 | * \note This method can throw MLException in case of errors. 59 | * \param bbe BookBaseEntry object. 60 | * \param copy if set to \a true, copy of book file will be created. 61 | * \param copy_path absolute path to directory book to be copied to. 62 | * \param find_fbd if set to \a true, this method will try to find and open 63 | * fbd file instead of book. 64 | * \param open_callback method to be called at the end of all operations. \b 65 | * path argument is an absolute path to method work result. 66 | * \return Absolute path to book to be opened. 67 | */ 68 | std::filesystem::path 69 | open_book( 70 | const BookBaseEntry &bbe, const bool ©, 71 | const std::filesystem::path ©_path, const bool &find_fbd, 72 | std::function open_callback); 73 | 74 | private: 75 | std::filesystem::path 76 | open_archive(const BookBaseEntry &bbe, const std::string &ext, 77 | const std::filesystem::path ©_path, const bool &find_fbd); 78 | 79 | void 80 | correct_separators(std::vector &files); 81 | 82 | bool 83 | compare_func(const ArchEntry &ent, const bool &encoding, 84 | const std::string &conv_nm, 85 | const std::filesystem::path &ch_fbd); 86 | 87 | std::shared_ptr af; 88 | 89 | SelfRemovingPath reading; 90 | }; 91 | 92 | #endif // OPENBOOK_H 93 | -------------------------------------------------------------------------------- /MLBookProc/include/PDFParser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef PDFPARSER_H 18 | #define PDFPARSER_H 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | /*! 27 | * \brief The PDFParser class. 28 | * 29 | * This class contains methods for pdf book parsing, annotations and covers 30 | * obtaining. In most cases you do not need to use this class directly. Use 31 | * CreateCollection, RefreshCollection and BookInfo instead. 32 | */ 33 | class PDFParser 34 | { 35 | public: 36 | /*! 37 | * \brief PDFParser constructor. 38 | * \param af smart pointer to AuxFunc object. 39 | */ 40 | PDFParser(const std::shared_ptr &af); 41 | 42 | /*! 43 | * \brief Parses pdf file. 44 | * \param file pdf file content. 45 | * \return BookParseEntry object. 46 | */ 47 | BookParseEntry 48 | pdf_parser(const std::string &file); 49 | 50 | /*! 51 | * \brief Returns pdf book annotation and cover. 52 | * \param file pdf file content. 53 | * \param x_dpi horizontal DPI. 55 | * \param y_dpi vertical 56 | * DPI. 57 | * \return Smart pointer to BookInfoEntry object. 58 | */ 59 | std::shared_ptr 60 | pdf_annotation_n_cover(const std::string &file, const double &x_dpi, 61 | const double &y_dpi); 62 | 63 | private: 64 | std::shared_ptr af; 65 | }; 66 | 67 | #endif // PDFPARSER_H 68 | -------------------------------------------------------------------------------- /MLBookProc/include/PaperBookInfoEntry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef PAPERBOOKINFOENTRY_H 18 | #define PAPERBOOKINFOENTRY_H 19 | 20 | #include 21 | 22 | /*! 23 | * \brief The PaperBookInfoEntry class. 24 | * 25 | * Auxiliary class containing some information about paper book source (if 26 | * any). 27 | */ 28 | class PaperBookInfoEntry 29 | { 30 | public: 31 | /*! 32 | * \brief PaperBookInfoEntry constructor. 33 | */ 34 | PaperBookInfoEntry(); 35 | 36 | /*! 37 | * \brief PaperBookInfoEntry copy constructor. 38 | */ 39 | PaperBookInfoEntry(const PaperBookInfoEntry &other); 40 | 41 | /*! 42 | * \brief PaperBookInfoEntry move constructor. 43 | */ 44 | PaperBookInfoEntry(PaperBookInfoEntry &&other); 45 | 46 | /*! 47 | * \brief operator = 48 | */ 49 | PaperBookInfoEntry & 50 | operator=(const PaperBookInfoEntry &other); 51 | 52 | /*! 53 | * \brief operator = 54 | */ 55 | PaperBookInfoEntry & 56 | operator=(PaperBookInfoEntry &&other); 57 | 58 | /*! 59 | * \brief If paper book info is available, will be set to \a true. 60 | */ 61 | bool available = false; 62 | 63 | /*! 64 | * \brief Paper book name. 65 | */ 66 | std::string book_name; 67 | 68 | /*! 69 | * \brief Paper book publisher. 70 | */ 71 | std::string publisher; 72 | 73 | /*! 74 | * \brief City where paper book was published. 75 | */ 76 | std::string city; 77 | 78 | /*! 79 | * \brief Year of paper book publishing. 80 | */ 81 | std::string year; 82 | 83 | /*! 84 | * \brief ISBN of paper 85 | * book. 86 | */ 87 | std::string isbn; 88 | }; 89 | 90 | #endif // PAPERBOOKINFOENTRY_H 91 | -------------------------------------------------------------------------------- /MLBookProc/include/RemoveBook.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef REMOVEBOOK_H 18 | #define REMOVEBOOK_H 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | /*! 29 | * \brief The RemoveBook class. 30 | * 31 | * This class contains methods to carry out book removing from collection. 32 | */ 33 | class RemoveBook 34 | { 35 | public: 36 | /*! 37 | * \brief RemoveBook constructor. 38 | * \param af smart pointer to AuxFunc object. 39 | * \param bbe BookBaseEntry containing book info. 40 | * \param col_name collection name. 41 | * \param bookmarks BookMarks object. 42 | */ 43 | RemoveBook(const std::shared_ptr &af, const BookBaseEntry &bbe, 44 | const std::string &col_name, 45 | const std::shared_ptr &bookmarks); 46 | 47 | /*! 48 | * \brief Removes book. 49 | * 50 | * \note This method can throw MLException in case of errors. 51 | */ 52 | void 53 | removeBook(); 54 | 55 | private: 56 | std::filesystem::path 57 | archive_remove(const SelfRemovingPath &out_dir); 58 | 59 | std::shared_ptr af; 60 | BookBaseEntry bbe; 61 | std::string col_name; 62 | std::shared_ptr bookmarks; 63 | 64 | SelfRemovingPath keep_path; 65 | }; 66 | 67 | #endif // REMOVEBOOK_H 68 | -------------------------------------------------------------------------------- /MLBookProc/include/ReplaceTagItem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | #ifndef REPLACETAGITEM_H 17 | #define REPLACETAGITEM_H 18 | 19 | #include 20 | 21 | /*! 22 | * \brief The ReplaceTagItem class. 23 | * 24 | * Auxiliary class for FormatAnnotation (see 25 | * FormatAnnotation::setTagReplacementTable()). 26 | */ 27 | class ReplaceTagItem 28 | { 29 | public: 30 | /*! 31 | * \brief ReplaceTagItem constructor. 32 | */ 33 | ReplaceTagItem(); 34 | 35 | /*! 36 | * \brief ReplaceTagItem copy constructor. 37 | */ 38 | ReplaceTagItem(const ReplaceTagItem &other); 39 | 40 | /*! 41 | * \brief ReplaceTagItem move constructor. 42 | */ 43 | ReplaceTagItem(ReplaceTagItem &&other); 44 | 45 | /*! 46 | * \brief operator = 47 | */ 48 | ReplaceTagItem & 49 | operator=(const ReplaceTagItem &other); 50 | 51 | /*! 52 | * \brief operator = 53 | */ 54 | ReplaceTagItem & 55 | operator=(ReplaceTagItem &&other); 56 | 57 | /*! 58 | * \brief Id of tag to be replaced (see XMLTag::tag_id). 59 | */ 60 | std::string tag_to_replace; 61 | 62 | /*! 63 | * \brief Replacement for start tag element. 64 | */ 65 | std::string begin_replacement; 66 | 67 | /*! 68 | * \brief Replacement for end tag element. 69 | */ 70 | std::string end_replacement; 71 | }; 72 | 73 | #endif // REPLACETAGITEM_H 74 | -------------------------------------------------------------------------------- /MLBookProc/include/SelfRemovingPath.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef SELFREMOVINGPATH_H 18 | #define SELFREMOVINGPATH_H 19 | 20 | #include 21 | #ifndef USE_OPENMP 22 | #include 23 | #else 24 | #include 25 | #endif 26 | 27 | /*! 28 | * \brief The SelfRemovingPath class. 29 | * 30 | * Auxiliary class. Removes underlying path on destruction, if no any copies of 31 | * SelfRemovingPath object have been created. Removes path on last copy 32 | * destruction otherwise. 33 | */ 34 | class SelfRemovingPath 35 | { 36 | public: 37 | /*! 38 | * \brief SelfRemovingPath constructor. 39 | */ 40 | SelfRemovingPath(); 41 | 42 | /*! 43 | * \brief SelfRemovingPath destructor. 44 | */ 45 | virtual ~SelfRemovingPath(); 46 | 47 | /*! 48 | * \brief SelfRemovingPath copy constructor. 49 | */ 50 | SelfRemovingPath(const SelfRemovingPath &other); 51 | 52 | /*! 53 | * \brief SelfRemovingPath move constructor. 54 | */ 55 | SelfRemovingPath(SelfRemovingPath &&other); 56 | 57 | /*! 58 | * \brief operator = 59 | */ 60 | SelfRemovingPath & 61 | operator=(const SelfRemovingPath &other); 62 | 63 | /*! 64 | * \brief operator = 65 | */ 66 | SelfRemovingPath & 67 | operator=(SelfRemovingPath &&other); 68 | 69 | /*! 70 | * \brief operator = 71 | * \param path path to be removed on destruction. 72 | * \return Returns self. 73 | */ 74 | SelfRemovingPath & 75 | operator=(const std::filesystem::path &path); 76 | 77 | /*! 78 | * \brief SelfRemovingPath constructor. 79 | * \param path path to be removed on destruction. 80 | */ 81 | explicit SelfRemovingPath(const std::filesystem::path &path); 82 | 83 | /*! 84 | * \brief Path to be removed on destruction. 85 | */ 86 | std::filesystem::path path; 87 | 88 | private: 89 | void 90 | deleter(); 91 | 92 | #ifndef USE_OPENMP 93 | std::atomic *count; 94 | #else 95 | uint64_t *count; 96 | #endif 97 | }; 98 | 99 | #endif // SELFREMOVINGPATH_H 100 | -------------------------------------------------------------------------------- /MLBookProc/include/XMLTag.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef XMLTAG_H 18 | #define XMLTAG_H 19 | 20 | #include 21 | #include 22 | 23 | /*! 24 | * \brief The XMLTag class. 25 | * 26 | * Auxiliary class for XMLParser. Contains tag start element content, tag name, 27 | * index of tag content first byte in XML document and index 29 | * of content last byte. Also contains list of tags were found in tag content. 30 | */ 31 | class XMLTag 32 | { 33 | public: 34 | /*! 35 | * \brief XMLTag constructor. 36 | */ 37 | XMLTag(); 38 | 39 | /*! 40 | * \brief XMLTag copy constructor. 41 | */ 42 | XMLTag(const XMLTag &other); 43 | 44 | /*! 45 | * \brief operator = 46 | */ 47 | XMLTag & 48 | operator=(const XMLTag &other); 49 | 50 | /*! 51 | * \brief XMLTag move constructor. 52 | */ 53 | XMLTag(XMLTag &&other); 54 | 55 | /*! 56 | * \brief operator = 57 | */ 58 | XMLTag & 59 | operator=(XMLTag &&other); 60 | 61 | /*! 62 | * \brief Checks if tag has content. 63 | * 64 | * This method returns \a true, if \b content_start and \b content_end are 65 | * not equal to std::string::npos. 66 | * \return \a true if tag has content. 67 | */ 68 | bool 69 | hasContent() const; 70 | 71 | /*! 72 | * \brief Tag start element content. 73 | * 74 | * Tag start element content including opening "<" and closing ">" symbols. 75 | */ 76 | std::string element; 77 | 78 | /*! 79 | * \brief Tag name. 80 | */ 81 | std::string tag_id; 82 | 83 | /*! 84 | * \brief Index of first byte of tag content. 85 | * 86 | * Index of first byte of tag content in XML document. Start 88 | * of tag can be found by \b element size subtration from \b content_start. 89 | * If \b content_start value is equal to std::string::npos, it indicates 90 | * error on tag reading (even if tag does not have any content). 91 | */ 92 | std::string::size_type content_start; 93 | 94 | /*! 95 | * \brief Index of last byte of tag content. 96 | * 97 | * Index of last byte of tag content in XML document. Can be 99 | * equal to std::string::npos, if tag does not have content. 100 | */ 101 | std::string::size_type content_end; 102 | 103 | /*! 104 | * \brief List of XML tags, found in 106 | * tag content (if any). 107 | */ 108 | std::vector tag_list; 109 | }; 110 | 111 | #endif // XMLTAG_H 112 | -------------------------------------------------------------------------------- /MLBookProc/omp_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | 3 | project(OmpTest LANGUAGES CXX) 4 | 5 | set(CMAKE_CXX_STANDARD 17) 6 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 7 | 8 | find_package(OpenMP REQUIRED) 9 | 10 | add_executable(omp_test main.cpp) 11 | 12 | if(OpenMP_FOUND) 13 | target_include_directories(omp_test PRIVATE ${OpenMP_CXX_INCLUDE_DIRS}) 14 | target_compile_options(omp_test PRIVATE ${OpenMP_CXX_FLAGS}) 15 | target_link_libraries(omp_test PRIVATE ${OpenMP_CXX_LIBRARIES}) 16 | endif() 17 | -------------------------------------------------------------------------------- /MLBookProc/omp_test/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | #include 17 | #include 18 | 19 | int 20 | main() 21 | { 22 | #pragma omp parallel 23 | { 24 | #pragma omp masked 25 | { 26 | omp_event_handle_t event; 27 | #pragma omp task detach(event) 28 | { 29 | std::cout << "OpenMP task detach test" << std::endl; 30 | omp_fulfill_event(event); 31 | } 32 | } 33 | } 34 | 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /MLBookProc/src/ArchEntry.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #include 18 | 19 | ArchEntry::ArchEntry() 20 | { 21 | } 22 | 23 | ArchEntry::ArchEntry(const ArchEntry &other) 24 | { 25 | size = other.size; 26 | compressed_size = other.compressed_size; 27 | position = other.position; 28 | filename = other.filename; 29 | } 30 | 31 | ArchEntry & 32 | ArchEntry::operator=(const ArchEntry &other) 33 | { 34 | if(this != &other) 35 | { 36 | size = other.size; 37 | compressed_size = other.compressed_size; 38 | position = other.position; 39 | filename = other.filename; 40 | } 41 | return *this; 42 | } 43 | 44 | ArchEntry::ArchEntry(ArchEntry &&other) 45 | { 46 | size = other.size; 47 | compressed_size = other.compressed_size; 48 | position = other.position; 49 | filename = std::move(other.filename); 50 | } 51 | 52 | ArchEntry & 53 | ArchEntry::operator=(ArchEntry &&other) 54 | { 55 | if(this != &other) 56 | { 57 | size = other.size; 58 | compressed_size = other.compressed_size; 59 | position = other.position; 60 | filename = std::move(other.filename); 61 | } 62 | return *this; 63 | } 64 | -------------------------------------------------------------------------------- /MLBookProc/src/ArchiveFileEntry.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #include 18 | 19 | ArchiveFileEntry::ArchiveFileEntry() 20 | { 21 | 22 | } 23 | 24 | ArchiveFileEntry::~ArchiveFileEntry() 25 | { 26 | if(file.is_open()) 27 | { 28 | file.close(); 29 | } 30 | delete[] read_buf; 31 | } 32 | -------------------------------------------------------------------------------- /MLBookProc/src/ArchiveRemoveEntry.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #include 18 | 19 | ArchiveRemoveEntry::ArchiveRemoveEntry() 20 | { 21 | } 22 | 23 | ArchiveRemoveEntry::~ArchiveRemoveEntry() 24 | { 25 | a_read.reset(); 26 | a_write.reset(); 27 | } 28 | 29 | ArchiveRemoveEntry::ArchiveRemoveEntry(const ArchiveRemoveEntry &other) 30 | { 31 | a_read = other.a_read; 32 | a_write = other.a_write; 33 | fl = other.fl; 34 | } 35 | 36 | ArchiveRemoveEntry::ArchiveRemoveEntry(ArchiveRemoveEntry &&other) 37 | { 38 | a_read = std::move(other.a_read); 39 | a_write = std::move(other.a_write); 40 | fl = std::move(other.fl); 41 | } 42 | 43 | ArchiveRemoveEntry & 44 | ArchiveRemoveEntry::operator=(const ArchiveRemoveEntry &other) 45 | { 46 | if(this != &other) 47 | { 48 | a_read = other.a_read; 49 | a_write = other.a_write; 50 | fl = other.fl; 51 | } 52 | return *this; 53 | } 54 | 55 | ArchiveRemoveEntry & 56 | ArchiveRemoveEntry::operator=(ArchiveRemoveEntry &&other) 57 | { 58 | if(this != &other) 59 | { 60 | a_read = std::move(other.a_read); 61 | a_write = std::move(other.a_write); 62 | fl = std::move(other.fl); 63 | } 64 | return *this; 65 | } 66 | -------------------------------------------------------------------------------- /MLBookProc/src/BookBaseEntry.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #include 18 | 19 | BookBaseEntry::BookBaseEntry() 20 | { 21 | 22 | } 23 | 24 | BookBaseEntry::BookBaseEntry(const BookBaseEntry &other) 25 | { 26 | file_path = other.file_path; 27 | bpe = other.bpe; 28 | } 29 | 30 | BookBaseEntry& 31 | BookBaseEntry::operator =(const BookBaseEntry &other) 32 | { 33 | if(this != &other) 34 | { 35 | file_path = other.file_path; 36 | bpe = other.bpe; 37 | } 38 | return *this; 39 | } 40 | 41 | BookBaseEntry::BookBaseEntry(BookBaseEntry &&other) 42 | { 43 | file_path = std::move(other.file_path); 44 | bpe = std::move(other.bpe); 45 | } 46 | 47 | BookBaseEntry& 48 | BookBaseEntry::operator =(BookBaseEntry &&other) 49 | { 50 | if(this != &other) 51 | { 52 | file_path = std::move(other.file_path); 53 | bpe = std::move(other.bpe); 54 | } 55 | return *this; 56 | } 57 | 58 | BookBaseEntry::BookBaseEntry( 59 | const BookParseEntry &bpe, 60 | const std::filesystem::path &book_file_path) 61 | { 62 | file_path = book_file_path; 63 | this->bpe = bpe; 64 | } 65 | 66 | bool 67 | BookBaseEntry::operator ==(const BookBaseEntry &other) 68 | { 69 | if(file_path == other.file_path && bpe == other.bpe) 70 | { 71 | return true; 72 | } 73 | else 74 | { 75 | return false; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /MLBookProc/src/BookInfoEntry.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #include 18 | 19 | BookInfoEntry::BookInfoEntry() 20 | { 21 | paper = new PaperBookInfoEntry; 22 | electro = new ElectroBookInfoEntry; 23 | } 24 | 25 | BookInfoEntry::~BookInfoEntry() 26 | { 27 | delete paper; 28 | delete electro; 29 | } 30 | 31 | BookInfoEntry::BookInfoEntry(BookInfoEntry &&other) 32 | { 33 | annotation = std::move(other.annotation); 34 | cover = std::move(other.cover); 35 | cover_type = std::move(other.cover_type); 36 | language = std::move(other.language); 37 | src_language = std::move(other.src_language); 38 | translator = std::move(other.translator); 39 | paper = other.paper; 40 | other.paper = nullptr; 41 | electro = other.electro; 42 | other.electro = nullptr; 43 | bytes_per_row = other.bytes_per_row; 44 | } 45 | 46 | BookInfoEntry::BookInfoEntry(const BookInfoEntry &other) 47 | { 48 | annotation = other.annotation; 49 | cover = other.cover; 50 | cover_type = other.cover_type; 51 | language = other.language; 52 | src_language = other.src_language; 53 | translator = other.translator; 54 | paper = other.paper; 55 | electro = other.electro; 56 | bytes_per_row = other.bytes_per_row; 57 | } 58 | 59 | BookInfoEntry & 60 | BookInfoEntry::operator=(const BookInfoEntry &other) 61 | { 62 | if(this != &other) 63 | { 64 | annotation = other.annotation; 65 | cover = other.cover; 66 | cover_type = other.cover_type; 67 | language = other.language; 68 | src_language = other.src_language; 69 | translator = other.translator; 70 | paper = other.paper; 71 | electro = other.electro; 72 | bytes_per_row = other.bytes_per_row; 73 | } 74 | return *this; 75 | } 76 | 77 | BookInfoEntry & 78 | BookInfoEntry::operator=(BookInfoEntry &&other) 79 | { 80 | if(this != &other) 81 | { 82 | annotation = std::move(other.annotation); 83 | cover = std::move(other.cover); 84 | cover_type = std::move(other.cover_type); 85 | language = std::move(other.language); 86 | src_language = std::move(other.src_language); 87 | translator = std::move(other.translator); 88 | paper = other.paper; 89 | other.paper = nullptr; 90 | electro = other.electro; 91 | other.electro = nullptr; 92 | bytes_per_row = other.bytes_per_row; 93 | } 94 | return *this; 95 | } 96 | -------------------------------------------------------------------------------- /MLBookProc/src/BookParseEntry.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #include 18 | 19 | BookParseEntry::BookParseEntry() 20 | { 21 | 22 | } 23 | 24 | BookParseEntry::BookParseEntry(const BookParseEntry &other) 25 | { 26 | book_path = other.book_path; 27 | book_author = other.book_author; 28 | book_name = other.book_name; 29 | book_series = other.book_series; 30 | book_genre = other.book_genre; 31 | book_date = other.book_date; 32 | } 33 | 34 | BookParseEntry& 35 | BookParseEntry::operator =(const BookParseEntry &other) 36 | { 37 | if(this != &other) 38 | { 39 | book_path = other.book_path; 40 | book_author = other.book_author; 41 | book_name = other.book_name; 42 | book_series = other.book_series; 43 | book_genre = other.book_genre; 44 | book_date = other.book_date; 45 | } 46 | return *this; 47 | } 48 | 49 | bool 50 | BookParseEntry::operator ==(const BookParseEntry &other) 51 | { 52 | if(book_path == other.book_path) 53 | { 54 | return true; 55 | } 56 | else 57 | { 58 | return false; 59 | } 60 | } 61 | 62 | BookParseEntry::BookParseEntry(BookParseEntry &&other) 63 | { 64 | book_path = std::move(other.book_path); 65 | book_author = std::move(other.book_author); 66 | book_name = std::move(other.book_name); 67 | book_series = std::move(other.book_series); 68 | book_genre = std::move(other.book_genre); 69 | book_date = std::move(other.book_date); 70 | } 71 | 72 | BookParseEntry& 73 | BookParseEntry::operator =(BookParseEntry &&other) 74 | { 75 | if(this != &other) 76 | { 77 | book_path = std::move(other.book_path); 78 | book_author = std::move(other.book_author); 79 | book_name = std::move(other.book_name); 80 | book_series = std::move(other.book_series); 81 | book_genre = std::move(other.book_genre); 82 | book_date = std::move(other.book_date); 83 | } 84 | return *this; 85 | } 86 | -------------------------------------------------------------------------------- /MLBookProc/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources (mlbookproc 2 | PRIVATE AddBook.cpp 3 | PRIVATE ArchEntry.cpp 4 | PRIVATE ArchiveFileEntry.cpp 5 | PRIVATE ArchiveRemoveEntry.cpp 6 | PRIVATE ARCHParser.cpp 7 | PRIVATE AuxFunc.cpp 8 | PRIVATE BaseKeeper.cpp 9 | PRIVATE BookBaseEntry.cpp 10 | PRIVATE BookInfo.cpp 11 | PRIVATE BookInfoEntry.cpp 12 | PRIVATE BookMarks.cpp 13 | PRIVATE BookParseEntry.cpp 14 | PRIVATE ByteOrder.cpp 15 | PRIVATE CreateCollection.cpp 16 | PRIVATE DCParser.cpp 17 | PRIVATE DJVUParser.cpp 18 | PRIVATE ElectroBookInfoEntry.cpp 19 | PRIVATE EPUBParser.cpp 20 | PRIVATE FB2Parser.cpp 21 | PRIVATE FileParseEntry.cpp 22 | PRIVATE FormatAnnotation.cpp 23 | PRIVATE Genre.cpp 24 | PRIVATE GenreGroup.cpp 25 | PRIVATE Hasher.cpp 26 | PRIVATE LibArchive.cpp 27 | PRIVATE MLException.cpp 28 | PRIVATE NotesBaseEntry.cpp 29 | PRIVATE NotesKeeper.cpp 30 | PRIVATE ODTParser.cpp 31 | PRIVATE OpenBook.cpp 32 | PRIVATE PaperBookInfoEntry.cpp 33 | PRIVATE PDFParser.cpp 34 | PRIVATE RefreshCollection.cpp 35 | PRIVATE RemoveBook.cpp 36 | PRIVATE ReplaceTagItem.cpp 37 | PRIVATE SelfRemovingPath.cpp 38 | PRIVATE XMLParser.cpp 39 | PRIVATE XMLTag.cpp 40 | ) 41 | 42 | if(USE_OPENMP) 43 | target_sources(mlbookproc PRIVATE OmpLockGuard.cpp) 44 | endif() 45 | -------------------------------------------------------------------------------- /MLBookProc/src/ElectroBookInfoEntry.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #include 18 | 19 | ElectroBookInfoEntry::ElectroBookInfoEntry() 20 | { 21 | } 22 | 23 | ElectroBookInfoEntry::ElectroBookInfoEntry(const ElectroBookInfoEntry &other) 24 | { 25 | available = other.available; 26 | author = other.author; 27 | program_used = other.program_used; 28 | date = other.date; 29 | src_url = other.src_url; 30 | src_ocr = other.src_ocr; 31 | id = other.id; 32 | version = other.version; 33 | history = other.version; 34 | publisher = other.publisher; 35 | } 36 | 37 | ElectroBookInfoEntry::ElectroBookInfoEntry(ElectroBookInfoEntry &&other) 38 | { 39 | available = other.available; 40 | author = std::move(other.author); 41 | program_used = std::move(other.program_used); 42 | date = std::move(other.date); 43 | src_url = std::move(other.src_url); 44 | src_ocr = std::move(other.src_ocr); 45 | id = std::move(other.id); 46 | version = std::move(other.version); 47 | history = std::move(other.version); 48 | publisher = std::move(other.publisher); 49 | } 50 | 51 | ElectroBookInfoEntry & 52 | ElectroBookInfoEntry::operator=(const ElectroBookInfoEntry &other) 53 | { 54 | if(this != &other) 55 | { 56 | available = other.available; 57 | author = other.author; 58 | program_used = other.program_used; 59 | date = other.date; 60 | src_url = other.src_url; 61 | src_ocr = other.src_ocr; 62 | id = other.id; 63 | version = other.version; 64 | history = other.version; 65 | publisher = other.publisher; 66 | } 67 | return *this; 68 | } 69 | 70 | ElectroBookInfoEntry & 71 | ElectroBookInfoEntry::operator=(ElectroBookInfoEntry &&other) 72 | { 73 | if(this != &other) 74 | { 75 | available = other.available; 76 | author = std::move(other.author); 77 | program_used = std::move(other.program_used); 78 | date = std::move(other.date); 79 | src_url = std::move(other.src_url); 80 | src_ocr = std::move(other.src_ocr); 81 | id = std::move(other.id); 82 | version = std::move(other.version); 83 | history = std::move(other.version); 84 | publisher = std::move(other.publisher); 85 | } 86 | return *this; 87 | } 88 | -------------------------------------------------------------------------------- /MLBookProc/src/FileParseEntry.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #include 18 | 19 | FileParseEntry::FileParseEntry() 20 | { 21 | } 22 | 23 | FileParseEntry::FileParseEntry(const FileParseEntry &other) 24 | { 25 | file_rel_path = other.file_rel_path; 26 | file_hash = other.file_hash; 27 | books = other.books; 28 | } 29 | 30 | FileParseEntry & 31 | FileParseEntry::operator=(const FileParseEntry &other) 32 | { 33 | if(this != &other) 34 | { 35 | file_rel_path = other.file_rel_path; 36 | file_hash = other.file_hash; 37 | books = other.books; 38 | } 39 | return *this; 40 | } 41 | 42 | FileParseEntry::FileParseEntry(FileParseEntry &&other) 43 | { 44 | file_rel_path = std::move(other.file_rel_path); 45 | file_hash = std::move(other.file_hash); 46 | books = std::move(other.books); 47 | } 48 | 49 | FileParseEntry & 50 | FileParseEntry::operator=(FileParseEntry &&other) 51 | { 52 | if(this != &other) 53 | { 54 | file_rel_path = std::move(other.file_rel_path); 55 | file_hash = std::move(other.file_hash); 56 | books = std::move(other.books); 57 | } 58 | return *this; 59 | } 60 | -------------------------------------------------------------------------------- /MLBookProc/src/Genre.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #include 18 | 19 | Genre::Genre() 20 | { 21 | } 22 | 23 | Genre::Genre(const Genre &other) 24 | { 25 | genre_code = other.genre_code; 26 | genre_name = other.genre_name; 27 | } 28 | 29 | Genre & 30 | Genre::operator=(const Genre &other) 31 | { 32 | if(this != &other) 33 | { 34 | genre_code = other.genre_code; 35 | genre_name = other.genre_name; 36 | } 37 | return *this; 38 | } 39 | 40 | Genre::Genre(Genre &&other) 41 | { 42 | genre_code = std::move(other.genre_code); 43 | genre_name = std::move(other.genre_name); 44 | } 45 | 46 | Genre & 47 | Genre::operator=(Genre &&other) 48 | { 49 | if(this != &other) 50 | { 51 | genre_code = std::move(other.genre_code); 52 | genre_name = std::move(other.genre_name); 53 | } 54 | return *this; 55 | } 56 | -------------------------------------------------------------------------------- /MLBookProc/src/GenreGroup.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #include 18 | 19 | GenreGroup::GenreGroup() 20 | { 21 | } 22 | 23 | GenreGroup::GenreGroup(const GenreGroup &other) 24 | { 25 | group_code = other.group_code; 26 | group_name = other.group_name; 27 | genres = other.genres; 28 | } 29 | 30 | GenreGroup & 31 | GenreGroup::operator=(const GenreGroup &other) 32 | { 33 | if(this != &other) 34 | { 35 | group_code = other.group_code; 36 | group_name = other.group_name; 37 | genres = other.genres; 38 | } 39 | return *this; 40 | } 41 | 42 | GenreGroup::GenreGroup(GenreGroup &&other) 43 | { 44 | group_code = std::move(other.group_code); 45 | group_name = std::move(other.group_name); 46 | genres = std::move(other.genres); 47 | } 48 | 49 | GenreGroup & 50 | GenreGroup::operator=(GenreGroup &&other) 51 | { 52 | if(this != &other) 53 | { 54 | group_code = std::move(other.group_code); 55 | group_name = std::move(other.group_name); 56 | genres = std::move(other.genres); 57 | } 58 | return *this; 59 | } 60 | -------------------------------------------------------------------------------- /MLBookProc/src/MLException.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #include 18 | 19 | MLException::MLException() 20 | { 21 | } 22 | 23 | MLException::MLException(const std::string &msg) 24 | { 25 | this->msg = msg; 26 | } 27 | 28 | MLException::MLException(const MLException &other) 29 | { 30 | msg = other.msg; 31 | } 32 | 33 | MLException::MLException(MLException &&other) 34 | { 35 | msg = std::move(other.msg); 36 | } 37 | 38 | MLException & 39 | MLException::operator=(const MLException &other) 40 | { 41 | if(this != &other) 42 | { 43 | msg = other.msg; 44 | } 45 | return *this; 46 | } 47 | 48 | MLException & 49 | MLException::operator=(MLException &&other) 50 | { 51 | if(this != &other) 52 | { 53 | msg = std::move(other.msg); 54 | } 55 | return *this; 56 | } 57 | 58 | std::string 59 | MLException::what() 60 | { 61 | return msg; 62 | } 63 | 64 | MLException::operator bool() 65 | { 66 | return !msg.empty(); 67 | } 68 | -------------------------------------------------------------------------------- /MLBookProc/src/NotesBaseEntry.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | #include 17 | 18 | NotesBaseEntry::NotesBaseEntry() 19 | { 20 | } 21 | 22 | NotesBaseEntry::NotesBaseEntry( 23 | const std::string &collection_name, 24 | const std::filesystem::path &book_file_full_path, 25 | const std::string &book_path) 26 | { 27 | this->collection_name = collection_name; 28 | this->book_file_full_path = book_file_full_path; 29 | this->book_path = book_path; 30 | } 31 | 32 | NotesBaseEntry::NotesBaseEntry(const NotesBaseEntry &other) 33 | { 34 | collection_name = other.collection_name; 35 | book_file_full_path = other.book_file_full_path; 36 | book_path = other.book_path; 37 | note_file_full_path = other.note_file_full_path; 38 | } 39 | 40 | NotesBaseEntry::NotesBaseEntry(NotesBaseEntry &&other) 41 | { 42 | collection_name = std::move(other.collection_name); 43 | book_file_full_path = std::move(other.book_file_full_path); 44 | book_path = std::move(other.book_path); 45 | note_file_full_path = std::move(other.note_file_full_path); 46 | } 47 | 48 | NotesBaseEntry & 49 | NotesBaseEntry::operator=(const NotesBaseEntry &other) 50 | { 51 | if(this != &other) 52 | { 53 | collection_name = other.collection_name; 54 | book_file_full_path = other.book_file_full_path; 55 | book_path = other.book_path; 56 | note_file_full_path = other.note_file_full_path; 57 | } 58 | 59 | return *this; 60 | } 61 | 62 | bool 63 | NotesBaseEntry::operator==(const NotesBaseEntry &other) const 64 | { 65 | if(collection_name == other.collection_name) 66 | { 67 | if(book_file_full_path == other.book_file_full_path) 68 | { 69 | if(book_path == other.book_path) 70 | { 71 | return true; 72 | } 73 | else 74 | { 75 | return false; 76 | } 77 | } 78 | else 79 | { 80 | return false; 81 | } 82 | } 83 | else 84 | { 85 | return false; 86 | } 87 | } 88 | 89 | NotesBaseEntry & 90 | NotesBaseEntry::operator=(NotesBaseEntry &&other) 91 | { 92 | if(this != &other) 93 | { 94 | collection_name = std::move(other.collection_name); 95 | book_file_full_path = std::move(other.book_file_full_path); 96 | book_path = std::move(other.book_path); 97 | note_file_full_path = std::move(other.note_file_full_path); 98 | } 99 | 100 | return *this; 101 | } 102 | -------------------------------------------------------------------------------- /MLBookProc/src/OmpLockGuard.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | #include 17 | 18 | OmpLockGuard::OmpLockGuard(omp_lock_t &omp_mtx) 19 | { 20 | omp_mtx_ptr = &omp_mtx; 21 | omp_set_lock(omp_mtx_ptr); 22 | } 23 | 24 | OmpLockGuard::~OmpLockGuard() 25 | { 26 | omp_unset_lock(omp_mtx_ptr); 27 | } 28 | -------------------------------------------------------------------------------- /MLBookProc/src/PaperBookInfoEntry.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #include 18 | 19 | PaperBookInfoEntry::PaperBookInfoEntry() 20 | { 21 | } 22 | 23 | PaperBookInfoEntry::PaperBookInfoEntry(const PaperBookInfoEntry &other) 24 | { 25 | available = other.available; 26 | book_name = other.book_name; 27 | publisher = other.publisher; 28 | city = other.city; 29 | year = other.year; 30 | isbn = other.isbn; 31 | } 32 | 33 | PaperBookInfoEntry::PaperBookInfoEntry(PaperBookInfoEntry &&other) 34 | { 35 | available = std::move(other.available); 36 | book_name = std::move(other.book_name); 37 | publisher = std::move(other.publisher); 38 | city = std::move(other.city); 39 | year = std::move(other.year); 40 | isbn = std::move(other.isbn); 41 | } 42 | 43 | PaperBookInfoEntry & 44 | PaperBookInfoEntry::operator=(const PaperBookInfoEntry &other) 45 | { 46 | if(this != &other) 47 | { 48 | available = other.available; 49 | book_name = other.book_name; 50 | publisher = other.publisher; 51 | city = other.city; 52 | year = other.year; 53 | isbn = other.isbn; 54 | } 55 | return *this; 56 | } 57 | 58 | PaperBookInfoEntry & 59 | PaperBookInfoEntry::operator=(PaperBookInfoEntry &&other) 60 | { 61 | if(this != &other) 62 | { 63 | available = std::move(other.available); 64 | book_name = std::move(other.book_name); 65 | publisher = std::move(other.publisher); 66 | city = std::move(other.city); 67 | year = std::move(other.year); 68 | isbn = std::move(other.isbn); 69 | } 70 | return *this; 71 | } 72 | -------------------------------------------------------------------------------- /MLBookProc/src/ReplaceTagItem.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | #include 17 | 18 | ReplaceTagItem::ReplaceTagItem() 19 | { 20 | } 21 | 22 | ReplaceTagItem::ReplaceTagItem(const ReplaceTagItem &other) 23 | { 24 | tag_to_replace = other.tag_to_replace; 25 | begin_replacement = other.begin_replacement; 26 | end_replacement = other.end_replacement; 27 | } 28 | 29 | ReplaceTagItem::ReplaceTagItem(ReplaceTagItem &&other) 30 | { 31 | tag_to_replace = std::move(other.tag_to_replace); 32 | begin_replacement = std::move(other.begin_replacement); 33 | end_replacement = std::move(other.end_replacement); 34 | } 35 | 36 | ReplaceTagItem & 37 | ReplaceTagItem::operator=(const ReplaceTagItem &other) 38 | { 39 | if(this != &other) 40 | { 41 | tag_to_replace = other.tag_to_replace; 42 | begin_replacement = other.begin_replacement; 43 | end_replacement = other.end_replacement; 44 | } 45 | return *this; 46 | } 47 | 48 | ReplaceTagItem & 49 | ReplaceTagItem::operator=(ReplaceTagItem &&other) 50 | { 51 | if(this != &other) 52 | { 53 | tag_to_replace = std::move(other.tag_to_replace); 54 | begin_replacement = std::move(other.begin_replacement); 55 | end_replacement = std::move(other.end_replacement); 56 | } 57 | return *this; 58 | } 59 | -------------------------------------------------------------------------------- /MLBookProc/src/SelfRemovingPath.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #include 18 | 19 | SelfRemovingPath::SelfRemovingPath() 20 | { 21 | count = nullptr; 22 | } 23 | 24 | SelfRemovingPath::~SelfRemovingPath() 25 | { 26 | deleter(); 27 | } 28 | 29 | SelfRemovingPath::SelfRemovingPath(const SelfRemovingPath &other) 30 | { 31 | path = other.path; 32 | count = other.count; 33 | #ifndef USE_OPENMP 34 | count->store(count->load() + 1); 35 | #else 36 | #pragma omp atomic update 37 | *count = *count + 1; 38 | #endif 39 | } 40 | 41 | SelfRemovingPath::SelfRemovingPath(SelfRemovingPath &&other) 42 | { 43 | count = other.count; 44 | other.count = nullptr; 45 | path = std::move(other.path); 46 | } 47 | 48 | SelfRemovingPath & 49 | SelfRemovingPath::operator=(const SelfRemovingPath &other) 50 | { 51 | if(this != &other) 52 | { 53 | if(path != other.path) 54 | { 55 | deleter(); 56 | path = other.path; 57 | count = other.count; 58 | #ifndef USE_OPENMP 59 | count->store(count->load() + 1); 60 | #else 61 | #pragma omp atomic update 62 | *count = *count + 1; 63 | #endif 64 | } 65 | } 66 | return *this; 67 | } 68 | 69 | SelfRemovingPath & 70 | SelfRemovingPath::operator=(SelfRemovingPath &&other) 71 | { 72 | if(this != &other) 73 | { 74 | if(path != other.path) 75 | { 76 | deleter(); 77 | count = other.count; 78 | other.count = nullptr; 79 | path = std::move(other.path); 80 | } 81 | } 82 | return *this; 83 | } 84 | 85 | SelfRemovingPath & 86 | SelfRemovingPath::operator=(const std::filesystem::path &path) 87 | { 88 | if(this->path != path) 89 | { 90 | if(this->path != path) 91 | { 92 | deleter(); 93 | #ifndef USE_OPENMP 94 | count = new std::atomic; 95 | count->store(1); 96 | #else 97 | count = new uint64_t(1); 98 | #endif 99 | this->path = path; 100 | } 101 | } 102 | return *this; 103 | } 104 | 105 | SelfRemovingPath::SelfRemovingPath(const std::filesystem::path &path) 106 | { 107 | if(this->path != path) 108 | { 109 | #ifndef USE_OPENMP 110 | count = new std::atomic; 111 | count->store(1); 112 | #else 113 | count = new uint64_t(1); 114 | #endif 115 | this->path = path; 116 | } 117 | this->path = path; 118 | } 119 | 120 | void 121 | SelfRemovingPath::deleter() 122 | { 123 | if(count) 124 | { 125 | #ifndef USE_OPENMP 126 | count->store(count->load() - 1); 127 | if(count->load() == 0) 128 | { 129 | std::filesystem::remove_all(path); 130 | delete count; 131 | } 132 | #else 133 | uint64_t l_c; 134 | #pragma omp atomic capture 135 | { 136 | *count -= 1; 137 | l_c = *count; 138 | } 139 | if(l_c == 0) 140 | { 141 | std::filesystem::remove_all(path); 142 | delete count; 143 | } 144 | #endif 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /MLBookProc/src/XMLTag.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #include 18 | 19 | XMLTag::XMLTag() 20 | { 21 | content_start = std::string::npos; 22 | content_end = std::string::npos; 23 | } 24 | 25 | XMLTag::XMLTag(const XMLTag &other) 26 | { 27 | element = other.element; 28 | tag_id = other.tag_id; 29 | tag_list = other.tag_list; 30 | content_start = other.content_start; 31 | content_end = other.content_end; 32 | } 33 | 34 | XMLTag & 35 | XMLTag::operator=(const XMLTag &other) 36 | { 37 | if(this != &other) 38 | { 39 | element = other.element; 40 | tag_id = other.tag_id; 41 | tag_list = other.tag_list; 42 | content_start = other.content_start; 43 | content_end = other.content_end; 44 | } 45 | return *this; 46 | } 47 | 48 | bool 49 | XMLTag::hasContent() const 50 | { 51 | if(content_start != std::string::npos) 52 | { 53 | if(content_end != content_start && content_end != std::string::npos) 54 | { 55 | return true; 56 | } 57 | else 58 | { 59 | return false; 60 | } 61 | } 62 | else 63 | { 64 | return false; 65 | } 66 | } 67 | 68 | XMLTag::XMLTag(XMLTag &&other) 69 | { 70 | element = std::move(other.element); 71 | tag_id = std::move(other.tag_id); 72 | tag_list = std::move(other.tag_list); 73 | content_start = std::move(other.content_start); 74 | content_end = std::move(other.content_end); 75 | } 76 | 77 | XMLTag & 78 | XMLTag::operator=(XMLTag &&other) 79 | { 80 | if(this != &other) 81 | { 82 | element = std::move(other.element); 83 | tag_id = std::move(other.tag_id); 84 | content_start = std::move(other.content_start); 85 | content_end = std::move(other.content_end); 86 | } 87 | return *this; 88 | } 89 | -------------------------------------------------------------------------------- /MLBookProc/stdexecution_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | 3 | project(ExecTest LANGUAGES CXX) 4 | 5 | set(CMAKE_CXX_STANDARD 17) 6 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 7 | 8 | add_executable(stdexecution_test main.cpp) 9 | 10 | find_package(TBB QUIET) 11 | if(TBB_FOUND) 12 | target_link_libraries(stdexecution_test PRIVATE TBB::tbb) 13 | endif() 14 | -------------------------------------------------------------------------------- /MLBookProc/stdexecution_test/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | #include 17 | #include 18 | #include 19 | 20 | int 21 | main() 22 | { 23 | std::vector ch_v; 24 | ch_v.reserve(10); 25 | for(int i = 0; i < 1000; i++) 26 | { 27 | ch_v.push_back(i); 28 | } 29 | auto it = std::find(std::execution::par, ch_v.begin(), ch_v.end(), 500); 30 | if(it != ch_v.end()) 31 | { 32 | std::cout << "Value found" << std::endl; 33 | } 34 | return 0; 35 | } 36 | -------------------------------------------------------------------------------- /MLPluginIfc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | 3 | project(MLPluginIfc VERSION 1.0 LANGUAGES CXX) 4 | 5 | set(CMAKE_CXX_STANDARD 17) 6 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 7 | 8 | option(CREATE_HTML_DOCS_PLUGINIFC "Build html documentation for plugins" OFF) 9 | option(CREATE_PDF_DOCS_PLUGINIFC "Build pdf documentation for plugins" OFF) 10 | 11 | find_package(PkgConfig REQUIRED) 12 | 13 | if(CREATE_HTML_DOCS_PLUGINIFC OR CREATE_PDF_DOCS_PLUGINIFC) 14 | find_package(Doxygen REQUIRED OPTIONAL_COMPONENTS dot) 15 | endif() 16 | 17 | pkg_check_modules(GTKMM REQUIRED IMPORTED_TARGET gtkmm-4.0) 18 | 19 | if(BUILD_SHARED_LIBS) 20 | add_library(mlpluginifc SHARED) 21 | else() 22 | add_library(mlpluginifc STATIC) 23 | endif() 24 | 25 | set_target_properties(mlpluginifc PROPERTIES POSITION_INDEPENDENT_CODE True) 26 | 27 | if(BUILD_SHARED_LIBS) 28 | set_target_properties(mlpluginifc PROPERTIES 29 | VERSION ${PROJECT_VERSION} 30 | SOVERSION ${PROJECT_VERSION_MAJOR} 31 | ) 32 | endif() 33 | 34 | add_subdirectory(src) 35 | add_subdirectory(include) 36 | 37 | target_include_directories(mlpluginifc 38 | PRIVATE include 39 | PRIVATE ../MLBookProc/include 40 | PUBLIC ${GTKMM_INCLUDE_DIRS} 41 | ) 42 | 43 | target_compile_options(mlpluginifc 44 | PUBLIC ${GTKMM_CFLAGS_OTHER} 45 | ) 46 | 47 | target_link_libraries(mlpluginifc 48 | PRIVATE mlbookproc 49 | PUBLIC ${GTKMM_LINK_LIBRARIES} 50 | ) 51 | 52 | target_link_options(mlpluginifc 53 | PUBLIC ${GTKMM_LDFLAGS_OTHER} 54 | ) 55 | 56 | if(DOXYGEN_FOUND) 57 | if(CREATE_HTML_DOCS_PLUGINIFC) 58 | set(DOXYGEN_GENERATE_HTML YES) 59 | endif() 60 | if(CREATE_PDF_DOCS_PLUGINIFC) 61 | set(DOXYGEN_GENERATE_LATEX YES) 62 | set(DOXYGEN_USE_PDFLATEX YES) 63 | set(DOXYGEN_PDF_HYPERLINKS YES) 64 | endif() 65 | set(DOXYGEN_EXAMPLE_PATH "${CMAKE_CURRENT_SOURCE_DIR}") 66 | set(DOXYGEN_SHOW_USED_FILES NO) 67 | set(DOXYGEN_SHOW_FILES NO) 68 | 69 | doxygen_add_docs(doxygen_mlpluginifc 70 | ALL 71 | WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/include 72 | COMMENT "Generating documentation" 73 | ) 74 | 75 | if(CREATE_PDF_DOCS_PLUGINIFC) 76 | add_custom_command(TARGET doxygen_mlpluginifc 77 | POST_BUILD 78 | COMMAND make 79 | ARGS pdf -C "${CMAKE_CURRENT_BINARY_DIR}/latex" 80 | COMMENT "Generating pdf documentation" 81 | ) 82 | endif() 83 | endif() 84 | 85 | include(GNUInstallDirs) 86 | 87 | install(TARGETS mlpluginifc EXPORT "${PROJECT_NAME}Targets" 88 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} 89 | INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME} 90 | ) 91 | 92 | install(DIRECTORY include/ 93 | EXPORT "${PROJECT_NAME}Targets" 94 | DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME} 95 | FILES_MATCHING PATTERN "*.h" 96 | ) 97 | 98 | if(CREATE_HTML_DOCS_PLUGINIFC) 99 | install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/ 100 | DESTINATION ${CMAKE_INSTALL_DOCDIR}/html 101 | ) 102 | endif() 103 | 104 | if(CREATE_PDF_DOCS_PLUGINIFC) 105 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/latex/refman.pdf 106 | DESTINATION ${CMAKE_INSTALL_DOCDIR}/pdf 107 | ) 108 | endif() 109 | 110 | install(EXPORT "${PROJECT_NAME}Targets" 111 | NAMESPACE "${PROJECT_NAME}::" 112 | DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" 113 | ) 114 | 115 | include(CMakePackageConfigHelpers) 116 | 117 | write_basic_package_version_file("${PROJECT_NAME}ConfigVersion.cmake" 118 | VERSION ${mlpluginifc_VERSION} 119 | COMPATIBILITY AnyNewerVersion) 120 | 121 | configure_package_config_file(${PROJECT_NAME}Config.cmake.in 122 | "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" 123 | INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} 124 | ) 125 | 126 | install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" 127 | "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" 128 | DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" 129 | ) 130 | 131 | -------------------------------------------------------------------------------- /MLPluginIfc/MLPluginIfcConfig.cmake.in: -------------------------------------------------------------------------------- 1 | @PACKAGE_INIT@ 2 | 3 | include(CMakeFindDependencyMacro) 4 | 5 | find_dependency(MLBookProc) 6 | 7 | include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") 8 | 9 | check_required_components(@PROJECT_NAME@) 10 | -------------------------------------------------------------------------------- /MLPluginIfc/examples/ExamplePlugin.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | ExamplePlugin::ExamplePlugin(void *af_ptr) : MLPlugin(af_ptr) 6 | { 7 | plugin_name = "Example plugin"; 8 | plugin_description = "Small example plugin"; 9 | } 10 | 11 | void 12 | ExamplePlugin::createWindow(Gtk::Window *parent_window) 13 | { 14 | Gtk::Window *window = new Gtk::Window; 15 | window->set_application(parent_window->get_application()); 16 | window->set_title(plugin_name); 17 | window->set_name("MLwindow"); 18 | window->set_transient_for(*parent_window); 19 | window->set_modal(true); 20 | 21 | Gtk::Grid *grid = Gtk::make_managed(); 22 | grid->set_halign(Gtk::Align::FILL); 23 | grid->set_valign(Gtk::Align::FILL); 24 | window->set_child(*grid); 25 | 26 | Gtk::Label *lab = Gtk::make_managed(); 27 | lab->set_margin(5); 28 | lab->set_halign(Gtk::Align::START); 29 | lab->set_name("windowLabel"); 30 | lab->set_text("Example plugin"); 31 | grid->attach(*lab, 0, 0, 1, 1); 32 | 33 | window->signal_close_request().connect( 34 | [window] { 35 | std::unique_ptr win(window); 36 | win->set_visible(false); 37 | return true; 38 | }, 39 | false); 40 | 41 | window->present(); 42 | } 43 | -------------------------------------------------------------------------------- /MLPluginIfc/examples/ExamplePlugin.h: -------------------------------------------------------------------------------- 1 | #ifndef EXAMPLEPLUGIN_H 2 | #define EXAMPLEPLUGIN_H 3 | 4 | #include 5 | 6 | class ExamplePlugin : public MLPlugin 7 | { 8 | public: 9 | ExamplePlugin(void *af_ptr); 10 | 11 | void 12 | createWindow(Gtk::Window *parent_window) override; 13 | }; 14 | 15 | extern "C" 16 | { 17 | #ifdef __linux 18 | MLPlugin * 19 | create(void *af_ptr) 20 | { 21 | return new ExamplePlugin(af_ptr); 22 | } 23 | #endif 24 | #ifdef _WIN32 25 | __declspec(dllexport) MLPlugin * 26 | create(void *af_ptr) 27 | { 28 | return new ExamplePlugin(af_ptr); 29 | } 30 | #endif 31 | } 32 | #endif // EXAMPLEPLUGIN_H 33 | -------------------------------------------------------------------------------- /MLPluginIfc/include/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources (mlpluginifc 2 | PRIVATE MLPlugin.h 3 | ) 4 | -------------------------------------------------------------------------------- /MLPluginIfc/include/MLPlugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | #ifndef MLPLUGIN_H 17 | #define MLPLUGIN_H 18 | 19 | #include 20 | #include 21 | 22 | /*! 23 | * \mainpage MLPluginIfc 24 | * 25 | * \b MLPluginIfc library provides interfaces to create plugins for MyLibrary. 27 | * 28 | * To start add cmake package MLPluginIfc to your project. 29 | * 30 | * \code{.unparsed} 31 | * find_package(MLPluginIfc) 32 | * if(MLPluginIfc_FOUND) 33 | * target_include_directories(myproject 34 | * PRIVATE MLPluginIfc::mlpluginifc 35 | * PRIVATE MLBookProc::mlbookproc 36 | * ) 37 | * target_link_libraries(myproject 38 | * PRIVATE MLPluginIfc::mlpluginifc 39 | * PRIVATE MLBookProc::mlbookproc 40 | * ) 41 | * endif() 42 | * \endcode 43 | * 44 | * See MLPlugin for details and code example. 45 | */ 46 | 47 | /*! 48 | * \brief The MLPlugin class 49 | * 50 | * MLPlugin is base class for plugins creation. To create plugin inherit 51 | * your plugin base class from MLPlugin and override createWindow() method. 52 | * Also set #plugin_name and #plugin_description if needed. Your plugin base 53 | * header file must include C function create (see example). 54 | * 55 | * \include examples/ExamplePlugin.h 56 | * \include examples/ExamplePlugin.cpp 57 | */ 58 | class MLPlugin 59 | { 60 | public: 61 | /*! 62 | * \brief MLPlugin constructor 63 | * \param af_ptr pointer to std::shared_ptr object. 64 | */ 65 | MLPlugin(void *af_ptr); 66 | 67 | virtual ~MLPlugin(); 68 | 69 | /*! 70 | * \brief Virtual function. 71 | * 72 | * You should override this method to create your plugin window. New window 73 | * should be transient for parent_window. It is also strongly recommended to 74 | * make new window modal (see example in class description). 75 | * 76 | * \param parent_window pointer to parent window object 77 | */ 78 | virtual void 79 | createWindow(Gtk::Window *parent_window); 80 | 81 | /*! 82 | * \brief Returns plugin name if set. 83 | * \return Glib 85 | * string containing plugin name 86 | */ 87 | Glib::ustring 88 | getPluginName(); 89 | 90 | /*! 91 | * \brief Returns plugin description. 92 | * \return Glib 94 | * string containing plugin name 95 | */ 96 | Glib::ustring 97 | getPluginDescription(); 98 | 99 | protected: 100 | /*! 101 | * \brief Pointer to AuxFunc object. 102 | * 103 | * AuxFunc class contains various useful methods (see \b MLBookProc 104 | * documentation). 105 | */ 106 | std::shared_ptr af; 107 | 108 | /*! 109 | * \brief Plugin name 110 | */ 111 | Glib::ustring plugin_name; 112 | /*! 113 | * \brief Plugin description 114 | */ 115 | Glib::ustring plugin_description; 116 | }; 117 | 118 | #endif // MLPLUGIN_H 119 | -------------------------------------------------------------------------------- /MLPluginIfc/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources (mlpluginifc 2 | PRIVATE MLPlugin.cpp 3 | ) 4 | -------------------------------------------------------------------------------- /MLPluginIfc/src/MLPlugin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | #include 17 | 18 | void 19 | MLPlugin::createWindow(Gtk::Window *parent_window) 20 | { 21 | Gtk::Window *window = new Gtk::Window; 22 | window->set_application(parent_window->get_application()); 23 | window->set_name("Empty plugin window"); 24 | window->set_transient_for(*parent_window); 25 | window->set_name("MLwindow"); 26 | window->set_modal(true); 27 | 28 | window->signal_close_request().connect( 29 | [window] { 30 | std::unique_ptr win(window); 31 | win->set_visible(false); 32 | return true; 33 | }, 34 | false); 35 | 36 | window->present(); 37 | } 38 | 39 | Glib::ustring 40 | MLPlugin::getPluginName() 41 | { 42 | return plugin_name; 43 | } 44 | 45 | Glib::ustring 46 | MLPlugin::getPluginDescription() 47 | { 48 | return plugin_description; 49 | } 50 | 51 | MLPlugin::MLPlugin(void *af_ptr) 52 | { 53 | af = *reinterpret_cast *>(af_ptr); 54 | } 55 | 56 | MLPlugin::~MLPlugin() 57 | { 58 | } 59 | -------------------------------------------------------------------------------- /include/AddBookModelItem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef ADDBOOKMODELITEM_H 18 | #define ADDBOOKMODELITEM_H 19 | 20 | #include 21 | #include 22 | 23 | class AddBookModelItem : public Glib::Object 24 | { 25 | public: 26 | static Glib::RefPtr 27 | create(const std::string &source_path); 28 | 29 | std::string source_path; 30 | std::string collection_path; 31 | bool correct = true; 32 | bool out_of_col = false; 33 | bool conflict_names = false; 34 | 35 | protected: 36 | AddBookModelItem(const std::string &source_path); 37 | }; 38 | 39 | #endif // ADDBOOKMODELITEM_H 40 | -------------------------------------------------------------------------------- /include/BookInfoGui.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef BOOKINFOGUI_H 18 | #define BOOKINFOGUI_H 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | class BookInfoGui 38 | { 39 | public: 40 | BookInfoGui(const std::shared_ptr &af, Gtk::Window *parent_window); 41 | 42 | virtual ~BookInfoGui(); 43 | 44 | BookInfoGui(const std::shared_ptr &af, Gtk::Window *parent_window, 45 | const std::shared_ptr &bie); 46 | 47 | void 48 | creatWindow(const BookBaseEntry &bbe); 49 | 50 | private: 51 | Glib::ustring 52 | translate_genre(const std::string &genre_str); 53 | 54 | Glib::ustring 55 | translate_genre_func(std::string &genre, 56 | const std::vector &genre_list); 57 | 58 | void 59 | formBookSection(const BookBaseEntry &bbe, Gtk::Grid *grid, int &row_num); 60 | 61 | void 62 | formPaperBookInfoSection(const BookBaseEntry &bbe, Gtk::Grid *grid, 63 | int &row_num); 64 | 65 | void 66 | formEectordocInfoSection(const BookBaseEntry &bbe, Gtk::Grid *grid, 67 | int &row_num); 68 | 69 | void 70 | formFileSection(const BookBaseEntry &bbe, Gtk::Grid *grid, int &row_num); 71 | 72 | Gdk::Rectangle 73 | screen_size(); 74 | 75 | int 76 | cover_width(Gtk::ScrolledWindow *scrl); 77 | 78 | void 79 | cover_draw(const Cairo::RefPtr &cr, int width, int height); 80 | 81 | Glib::RefPtr 82 | cover_menu(); 83 | 84 | void 85 | show_cover_popup_menu(int num, double x, double y, 86 | Gtk::PopoverMenu *pop_menu); 87 | 88 | void 89 | cover_operations_action_group(Gtk::Window *win); 90 | 91 | void 92 | cover_full_size(Gtk::Window *win); 93 | 94 | void 95 | save_cover(Gtk::Window *win); 96 | 97 | void 98 | formReplacementTable(std::vector &replacement_table); 99 | 100 | std::shared_ptr af; 101 | Gtk::Window *parent_window = nullptr; 102 | 103 | BookInfo *bi = nullptr; 104 | 105 | std::shared_ptr bie; 106 | Glib::RefPtr cover_buf; 107 | }; 108 | 109 | #endif // BOOKINFOGUI_H 110 | -------------------------------------------------------------------------------- /include/BookMarksGui.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef BOOKMARKSGUI_H 18 | #define BOOKMARKSGUI_H 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | class BookMarksGui 32 | { 33 | public: 34 | BookMarksGui(const std::shared_ptr &af, 35 | const std::shared_ptr &bookmarks, 36 | const std::shared_ptr ¬es, 37 | Gtk::Window *main_window); 38 | 39 | virtual ~BookMarksGui(); 40 | 41 | void 42 | createWindow(); 43 | 44 | private: 45 | void 46 | loadWindowSizes(); 47 | 48 | void 49 | setWindowSizesByMonitor(); 50 | 51 | void 52 | saveWindowSizes(Gtk::Window *win); 53 | 54 | void 55 | slot_row_activated(guint pos); 56 | 57 | void 58 | creat_bookmarks_action_group(Gtk::Window *win); 59 | 60 | void 61 | confirmationDialog(Gtk::Window *win); 62 | 63 | Glib::RefPtr 64 | bookmark_menu(); 65 | 66 | void 67 | show_popup_menu(int num, double x, double y, Gtk::PopoverMenu *pop_menu); 68 | 69 | // TODO remove legacy in future releases 70 | void 71 | legacyWarning(Gtk::Window *win); 72 | 73 | std::shared_ptr af; 74 | std::shared_ptr bookmarks; 75 | std::shared_ptr notes; 76 | Gtk::Window *main_window = nullptr; 77 | 78 | int window_height = 0; 79 | int window_width = 0; 80 | 81 | BookMarksShow *bms = nullptr; 82 | 83 | Gtk::ColumnView *book_marks = nullptr; 84 | OpenBook *open_book = nullptr; 85 | }; 86 | 87 | #endif // BOOKMARKSGUI_H 88 | -------------------------------------------------------------------------------- /include/BookMarksModelItem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | #ifndef BOOKMARKSMODELITEM_H 17 | #define BOOKMARKSMODELITEM_H 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | #ifdef USE_OPENMP 25 | #include 26 | #else 27 | #include 28 | #endif 29 | 30 | class BookMarksModelItem : public Glib::Object 31 | { 32 | public: 33 | virtual ~BookMarksModelItem(); 34 | 35 | static Glib::RefPtr 36 | create(const std::string &coll_name, const BookBaseEntry &bbe); 37 | 38 | void 39 | addLabel(Gtk::Label *lab); 40 | 41 | void 42 | removeLabel(Gtk::Label *lab); 43 | 44 | void 45 | activateLabels(); 46 | 47 | void 48 | deactivateLabels(); 49 | 50 | std::tuple element; 51 | 52 | protected: 53 | BookMarksModelItem(const std::string &coll_name, const BookBaseEntry &bbe); 54 | 55 | std::vector labels; 56 | #ifndef USE_OPENMP 57 | std::mutex labels_mtx; 58 | #else 59 | omp_lock_t labels_mtx; 60 | #endif 61 | }; 62 | 63 | #endif // BOOKMARKSMODELITEM_H 64 | -------------------------------------------------------------------------------- /include/BookMarksShow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | #ifndef BOOKMARKSSHOW_H 17 | #define BOOKMARKSSHOW_H 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | class BookMarksShow 28 | { 29 | public: 30 | BookMarksShow(const std::shared_ptr &af, Gtk::ColumnView *bm_view); 31 | 32 | void 33 | showBookMarks( 34 | const std::vector> &bm_v); 35 | 36 | void 37 | selectItem(const Glib::RefPtr &item); 38 | 39 | Glib::RefPtr 40 | getSelectedItem(); 41 | 42 | void 43 | removeItem(const Glib::RefPtr &item); 44 | 45 | void 46 | filterBookmarks(const Glib::ustring &filter, const guint &variant); 47 | 48 | void 49 | setWidth(); 50 | 51 | // TODO remove legacy code in future releases 52 | std::function signal_legacy_bookmarks; 53 | 54 | private: 55 | Glib::RefPtr 56 | collectionColumn(); 57 | 58 | Glib::RefPtr 59 | authorColumn(); 60 | 61 | Glib::RefPtr 62 | bookColumn(); 63 | 64 | Glib::RefPtr 65 | seriesColumn(); 66 | 67 | Glib::RefPtr 68 | genreColumn(); 69 | 70 | Glib::RefPtr 71 | dateColumn(); 72 | 73 | void 74 | slotSetup(const Glib::RefPtr &item); 75 | 76 | void 77 | slotBind(const Glib::RefPtr &item, const int &variant); 78 | 79 | void 80 | slotUnbind(const Glib::RefPtr &item); 81 | 82 | Glib::ustring 83 | translate_genres(const std::string &genres); 84 | 85 | void 86 | append_genre(Glib::ustring &result, std::string &genre); 87 | 88 | Glib::ustring 89 | expressionSlot(const Glib::RefPtr &item, 90 | const int &variant); 91 | 92 | std::shared_ptr af; 93 | Gtk::ColumnView *bm_view; 94 | 95 | std::vector genre_list; 96 | 97 | Glib::RefPtr> model; 98 | 99 | Glib::RefPtr selected_item; 100 | 101 | Glib::RefPtr coll_filter; 102 | Glib::RefPtr auth_filter; 103 | Glib::RefPtr book_filter; 104 | Glib::RefPtr series_filter; 105 | Glib::RefPtr genre_filter; 106 | Glib::RefPtr date_filter; 107 | 108 | Glib::RefPtr filter_model; 109 | }; 110 | 111 | #endif // BOOKMARKSSHOW_H 112 | -------------------------------------------------------------------------------- /include/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources (mylibrary 2 | PRIVATE AddBookGui.h 3 | PRIVATE AddBookModelItem.h 4 | PRIVATE BookInfoGui.h 5 | PRIVATE BookMarksGui.h 6 | PRIVATE BookMarksModelItem.h 7 | PRIVATE BookMarksShow.h 8 | PRIVATE CollectionCrProcessGui.h 9 | PRIVATE CopyBookGui.h 10 | PRIVATE CoverPixBuf.h 11 | PRIVATE CreateCollectionGui.h 12 | PRIVATE EditBookGenreModelItem.h 13 | PRIVATE EditBookGui.h 14 | PRIVATE EmptyCollectionGui.h 15 | PRIVATE ExportCollectionGui.h 16 | PRIVATE FullSizeCover.h 17 | PRIVATE ImportCollectionGui.h 18 | PRIVATE LeftGrid.h 19 | PRIVATE MainWindow.h 20 | PRIVATE MyLibraryApplication.h 21 | PRIVATE NotesGui.h 22 | PRIVATE RefreshCollectionGui.h 23 | PRIVATE RemoveBookGui.h 24 | PRIVATE RemoveCollectionGui.h 25 | PRIVATE RightGrid.h 26 | PRIVATE SaveCover.h 27 | PRIVATE SearchProcessGui.h 28 | PRIVATE SearchResultModelItemAuth.h 29 | PRIVATE SearchResultModelItemFL.h 30 | PRIVATE SearchResultModelItem.h 31 | PRIVATE SearchResultShow.h 32 | PRIVATE SettingsWindow.h 33 | PRIVATE TransferBookGui.h 34 | ) 35 | 36 | if(USE_PLUGINS) 37 | target_sources(mylibrary 38 | PRIVATE PluginsKeeper.h 39 | ) 40 | endif() 41 | -------------------------------------------------------------------------------- /include/CollectionCrProcessGui.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef COLLECTIONCRPROCESSGUI_H 18 | #define COLLECTIONCRPROCESSGUI_H 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | class CollectionCrProcessGui 33 | { 34 | public: 35 | CollectionCrProcessGui(const std::shared_ptr &af, 36 | Gtk::Window *main_window, 37 | const std::filesystem::path &collection_path, 38 | const std::filesystem::path &books_path, 39 | const bool &rar_support, const std::string &num_thr); 40 | 41 | virtual ~CollectionCrProcessGui(); 42 | 43 | CollectionCrProcessGui(const std::shared_ptr &af, 44 | Gtk::Window *main_window, 45 | const std::string &coll_name, 46 | const std::string &num_thr, const bool &remove_empty, 47 | const bool &fast, const bool &refresh_bookmarks, 48 | const bool &rar_support, 49 | const std::shared_ptr &bookmarks); 50 | 51 | void 52 | createWindow(const int &variant); 53 | 54 | std::function add_new_collection; 55 | 56 | std::function collection_refreshed; 57 | 58 | private: 59 | void 60 | createProcessCreation(Gtk::Window *win); 61 | 62 | void 63 | createProcessRefresh(Gtk::Window *win); 64 | 65 | void 66 | finishInfo(Gtk::Window *win, const int &variant); 67 | 68 | std::function stop_ops; 69 | 70 | std::shared_ptr af; 71 | Gtk::Window *main_window = nullptr; 72 | std::filesystem::path collection_path; 73 | std::filesystem::path books_path; 74 | int thr_num = 1; 75 | std::shared_ptr bookmarks; 76 | 77 | std::string coll_name; 78 | 79 | Gtk::ProgressBar *creation_progress = nullptr; 80 | Gtk::Label *process_name = nullptr; 81 | Gtk::Button *cancel = nullptr; 82 | 83 | Glib::Dispatcher *pulse_disp = nullptr; 84 | Glib::Dispatcher *creation_finished_disp = nullptr; 85 | Glib::Dispatcher *new_collection_name_disp = nullptr; 86 | Glib::Dispatcher *total_files_disp = nullptr; 87 | Glib::Dispatcher *progress_disp = nullptr; 88 | 89 | Glib::Dispatcher *total_bytes_to_hash_disp = nullptr; 90 | Glib::Dispatcher *bytes_hashed_disp = nullptr; 91 | 92 | double total_bytes = 0.0; 93 | std::atomic progress_count; 94 | 95 | double total_bytes_to_hash = 0.0; 96 | double bytes_hashed = 0.0; 97 | 98 | bool remove_empty = false; 99 | bool fast_refresh = false; 100 | bool refresh_bookmarkse = false; 101 | bool rar_support = false; 102 | }; 103 | 104 | #endif // COLLECTIONCRPROCESSGUI_H 105 | -------------------------------------------------------------------------------- /include/CopyBookGui.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef COPYBOOKGUI_H 18 | #define COPYBOOKGUI_H 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #ifndef ML_GTK_OLD 27 | #include 28 | #else 29 | #include 30 | #endif 31 | 32 | class CopyBookGui 33 | { 34 | public: 35 | CopyBookGui(const std::shared_ptr &af, Gtk::Window *parent_window, 36 | const BookBaseEntry &bbe); 37 | 38 | void 39 | createWindow(); 40 | 41 | private: 42 | #ifndef ML_GTK_OLD 43 | void 44 | save_slot(const Glib::RefPtr &result, 45 | const Glib::RefPtr &fd); 46 | #else 47 | void 48 | save_slot(int resp, Gtk::FileChooserDialog *fd); 49 | #endif 50 | 51 | void 52 | copy_func(const Glib::RefPtr &fl); 53 | 54 | void 55 | result_dialog(const Glib::ustring &text); 56 | 57 | std::shared_ptr af; 58 | Gtk::Window *parent_window = nullptr; 59 | BookBaseEntry bbe; 60 | }; 61 | 62 | #endif // COPYBOOKGUI_H 63 | -------------------------------------------------------------------------------- /include/CoverPixBuf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef COVERPIXBUF_H 18 | #define COVERPIXBUF_H 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | class CoverPixBuf 25 | { 26 | public: 27 | CoverPixBuf(const std::shared_ptr &bie, const int &width, 28 | const int &height); 29 | 30 | CoverPixBuf(const std::shared_ptr &bie); 31 | 32 | CoverPixBuf(const CoverPixBuf &other); 33 | 34 | CoverPixBuf(CoverPixBuf &&other); 35 | 36 | CoverPixBuf & 37 | operator=(const CoverPixBuf &other); 38 | 39 | CoverPixBuf & 40 | operator=(CoverPixBuf &&other); 41 | 42 | operator Glib::RefPtr(); 43 | 44 | int 45 | get_width(); 46 | 47 | int 48 | get_height(); 49 | 50 | private: 51 | void 52 | createBuffer(); 53 | 54 | void 55 | createFromStream(const Glib::RefPtr &bytes); 56 | 57 | void 58 | createFromRgba(const bool &alpha); 59 | 60 | std::shared_ptr bie; 61 | 62 | Glib::RefPtr buffer; 63 | 64 | int width = -1; 65 | int height = -1; 66 | }; 67 | 68 | #endif // COVERPIXBUF_H 69 | -------------------------------------------------------------------------------- /include/CreateCollectionGui.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef CREATECOLLECTIONGUI_H 18 | #define CREATECOLLECTIONGUI_H 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #ifndef ML_GTK_OLD 29 | #include 30 | #else 31 | #include 32 | #endif 33 | 34 | class CreateCollectionGui 35 | { 36 | public: 37 | CreateCollectionGui(const std::shared_ptr &af, 38 | Gtk::Window *main_window); 39 | 40 | void 41 | createWindow(); 42 | 43 | std::function add_new_collection; 44 | 45 | private: 46 | void 47 | bookPathDialog(Gtk::Window *win); 48 | 49 | #ifndef ML_GTK_OLD 50 | void 51 | bookPathDialogSlot(const Glib::RefPtr &result, 52 | const Glib::RefPtr &fd); 53 | #else 54 | void 55 | bookPathDialogSlot(int resp, Gtk::FileChooserDialog *fd); 56 | #endif 57 | 58 | void 59 | checkInput(Gtk::Window *win); 60 | 61 | void 62 | errorDialog(Gtk::Window *win, const int &variant); 63 | 64 | std::shared_ptr af; 65 | Gtk::Window *main_window = nullptr; 66 | 67 | Gtk::Entry *collection_name = nullptr; 68 | 69 | Gtk::Entry *book_path = nullptr; 70 | 71 | Gtk::Entry *thread_num = nullptr; 72 | 73 | Gtk::CheckButton *disable_rar = nullptr; 74 | }; 75 | 76 | #endif // CREATECOLLECTIONGUI_H 77 | -------------------------------------------------------------------------------- /include/EditBookGenreModelItem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef EDITBOOKGENREMODELITEM_H 18 | #define EDITBOOKGENREMODELITEM_H 19 | 20 | #include 21 | #include 22 | 23 | class EditBookGenreModelItem : public Glib::Object 24 | { 25 | public: 26 | static Glib::RefPtr 27 | create(const std::string &genre_code, const std::string &genre_name); 28 | 29 | std::string genre_code; 30 | std::string genre_name; 31 | 32 | protected: 33 | EditBookGenreModelItem(const std::string &genre_code, 34 | const std::string &genre_name); 35 | }; 36 | 37 | #endif // EDITBOOKGENREMODELITEM_H 38 | -------------------------------------------------------------------------------- /include/EmptyCollectionGui.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef EMPTYCOLLECTIONGUI_H 18 | #define EMPTYCOLLECTIONGUI_H 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #ifndef ML_GTK_OLD 29 | #include 30 | #else 31 | #include 32 | #endif 33 | 34 | class EmptyCollectionGui 35 | { 36 | public: 37 | EmptyCollectionGui(const std::shared_ptr &af, 38 | Gtk::Window *parent_window); 39 | 40 | void 41 | createWindow(); 42 | 43 | std::function signal_success; 44 | 45 | private: 46 | void 47 | open_directory_dialog(Gtk::Window *win, Gtk::Entry *ent); 48 | 49 | #ifndef ML_GTK_OLD 50 | void 51 | open_directory_dialog_slot(const Glib::RefPtr &result, 52 | const Glib::RefPtr &fd, 53 | Gtk::Entry *ent); 54 | #else 55 | void 56 | open_directory_dialog_slot(int resp, Gtk::FileChooserDialog *fd, 57 | Gtk::Entry *ent); 58 | #endif 59 | 60 | void 61 | error_dialog(Gtk::Window *win, const int &variant); 62 | 63 | void 64 | check_function(Gtk::Window *win); 65 | 66 | void 67 | creat_collection(Gtk::Window *win, std::filesystem::path &col_base_path, 68 | const std::filesystem::path &books_p); 69 | 70 | void 71 | final_dialog(Gtk::Window *win); 72 | 73 | std::shared_ptr af; 74 | Gtk::Window *parent_window = nullptr; 75 | 76 | Gtk::Entry *col_name_ent = nullptr; 77 | Gtk::Entry *books_path_ent = nullptr; 78 | }; 79 | 80 | #endif // EMPTYCOLLECTIONGUI_H 81 | -------------------------------------------------------------------------------- /include/ExportCollectionGui.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef EXPORTCOLLECTIONGUI_H 18 | #define EXPORTCOLLECTIONGUI_H 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #ifndef ML_GTK_OLD 27 | #include 28 | #else 29 | #include 30 | #endif 31 | 32 | class ExportCollectionGui 33 | { 34 | public: 35 | ExportCollectionGui(const std::shared_ptr &af, 36 | Gtk::Window *parent_window); 37 | 38 | void 39 | createWindow(); 40 | 41 | private: 42 | Glib::RefPtr 43 | create_collections_list(); 44 | 45 | void 46 | export_file_dialog(Gtk::Window *win); 47 | 48 | #ifndef ML_GTK_OLD 49 | void 50 | export_file_dialog_slot(const Glib::RefPtr &result, 51 | const Glib::RefPtr &fd, 52 | Gtk::Window *win); 53 | #else 54 | void 55 | export_file_dialog_slot(int resp, Gtk::FileChooserDialog *fd, 56 | Gtk::Window *win); 57 | #endif 58 | 59 | void 60 | export_func(const std::filesystem::path &exp_p, Gtk::Window *win); 61 | 62 | void 63 | result_window(Gtk::Window *win, const int &variant); 64 | 65 | std::shared_ptr af; 66 | Gtk::Window *parent_window = nullptr; 67 | 68 | Gtk::DropDown *collection = nullptr; 69 | }; 70 | 71 | #endif // EXPORTCOLLECTIONGUI_H 72 | -------------------------------------------------------------------------------- /include/FullSizeCover.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef FULLSIZECOVER_H 18 | #define FULLSIZECOVER_H 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | class FullSizeCover 26 | { 27 | public: 28 | FullSizeCover(const std::shared_ptr &bie, 29 | Gtk::Window *parent_window); 30 | 31 | void 32 | createWindow(); 33 | 34 | private: 35 | void 36 | calculateSizes(); 37 | 38 | void 39 | cover_draw(const Cairo::RefPtr &cr, int width, int height); 40 | 41 | std::shared_ptr bie; 42 | Gtk::Window *parent_window = nullptr; 43 | 44 | Glib::RefPtr cover_buf; 45 | 46 | int width = 0; 47 | int height = 0; 48 | }; 49 | 50 | #endif // FULLSIZECOVER_H 51 | -------------------------------------------------------------------------------- /include/ImportCollectionGui.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef IMPORTCOLLECTIONGUI_H 18 | #define IMPORTCOLLECTIONGUI_H 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #ifndef ML_GTK_OLD 29 | #include 30 | #else 31 | #include 32 | #endif 33 | 34 | class ImportCollectionGui 35 | { 36 | public: 37 | ImportCollectionGui(const std::shared_ptr &af, 38 | Gtk::Window *parent_window); 39 | 40 | void 41 | createWindow(); 42 | 43 | std::function signal_success; 44 | 45 | private: 46 | void 47 | open_file_dialog(Gtk::Window *win, Gtk::Entry *ent, const int &variant); 48 | 49 | #ifndef ML_GTK_OLD 50 | void 51 | open_file_dialog_slot_base(const Glib::RefPtr &result, 52 | const Glib::RefPtr &fd, 53 | Gtk::Entry *ent); 54 | 55 | void 56 | open_file_dialog_slot_books(const Glib::RefPtr &result, 57 | const Glib::RefPtr &fd, 58 | Gtk::Entry *ent); 59 | #else 60 | void 61 | open_file_dialog_slot_base(int resp, Gtk::FileChooserDialog *fd, 62 | Gtk::Entry *ent); 63 | 64 | void 65 | open_file_dialog_slot_books(int resp, Gtk::FileChooserDialog *fd, 66 | Gtk::Entry *ent); 67 | #endif 68 | 69 | void 70 | error_dialog(Gtk::Window *win, const int &variant); 71 | 72 | void 73 | check_function(Gtk::Window *win); 74 | 75 | void 76 | import_collection(Gtk::Window *win, std::filesystem::path &col_base_path, 77 | const std::filesystem::path &base_p, 78 | const std::filesystem::path &books_p); 79 | 80 | void 81 | final_dialog(Gtk::Window *win); 82 | 83 | std::shared_ptr af; 84 | Gtk::Window *parent_window = nullptr; 85 | 86 | Gtk::Entry *col_name = nullptr; 87 | Gtk::Entry *base_path = nullptr; 88 | Gtk::Entry *books_path = nullptr; 89 | }; 90 | 91 | #endif // IMPORTCOLLECTIONGUI_H 92 | -------------------------------------------------------------------------------- /include/LeftGrid.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef LEFTGRID_H 18 | #define LEFTGRID_H 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | class LeftGrid 38 | { 39 | public: 40 | LeftGrid(const std::shared_ptr &af, Gtk::Window *main_window, 41 | const std::shared_ptr ¬es); 42 | 43 | virtual ~LeftGrid(); 44 | 45 | Gtk::Grid * 46 | createGrid(); 47 | 48 | Gtk::DropDown * 49 | get_collection_select(); 50 | 51 | void 52 | clear_all_search_fields(); 53 | 54 | void 55 | add_new_collection(const std::string &col_name); 56 | 57 | void 58 | clearCollectionBase(); 59 | 60 | bool 61 | reloadCollection(const std::string &col_name); 62 | 63 | void 64 | searchAuth(const std::string &auth); 65 | 66 | void 67 | reloadCollectionList(); 68 | 69 | std::function clear_search_result; 70 | 71 | std::function &result)> 72 | search_result_show; 73 | 74 | std::function &result)> 75 | search_result_show_files; 76 | 77 | std::function &result)> 78 | search_result_authors; 79 | 80 | private: 81 | Glib::RefPtr 82 | createCollectionsList(); 83 | 84 | void 85 | formAuthorSection(Gtk::Grid *grid, int &row); 86 | 87 | void 88 | formBookSection(Gtk::Grid *grid, int &row); 89 | 90 | void 91 | formSearchSection(Gtk::Grid *grid, int &row); 92 | 93 | void 94 | setGenrePopover(Gtk::MenuButton *genre_button); 95 | 96 | void 97 | setActiveCollection(); 98 | 99 | void 100 | saveActiveCollection(); 101 | 102 | void 103 | loadCollection(const guint &sel); 104 | 105 | void 106 | searchBook(); 107 | 108 | void 109 | showCollectionFiles(); 110 | 111 | void 112 | showCollectionAuthors(); 113 | 114 | void 115 | showBooksWithNotes(); 116 | 117 | Gtk::Grid * 118 | formGenreExpanderGrid(const std::vector &genre, Gtk::Popover *pop); 119 | 120 | std::shared_ptr af; 121 | Gtk::Window *main_window = nullptr; 122 | std::shared_ptr notes; 123 | 124 | Gtk::DropDown *collection_select = nullptr; 125 | 126 | Gtk::Entry *surname = nullptr; 127 | Gtk::Entry *name = nullptr; 128 | Gtk::Entry *sec_name = nullptr; 129 | Gtk::Entry *book_name = nullptr; 130 | Gtk::Entry *series = nullptr; 131 | Gtk::MenuButton *genre_button = nullptr; 132 | BaseKeeper *base_keeper = nullptr; 133 | 134 | Genre selected_genre; 135 | }; 136 | 137 | #endif // LEFTGRID_H 138 | -------------------------------------------------------------------------------- /include/MainWindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef MAINWINDOW_H 18 | #define MAINWINDOW_H 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #ifdef USE_PLUGINS 32 | #include 33 | #endif 34 | 35 | class MainWindow : public Gtk::ApplicationWindow 36 | { 37 | public: 38 | MainWindow(const std::shared_ptr &af); 39 | 40 | virtual ~MainWindow(); 41 | 42 | private: 43 | void 44 | formMainWindow(); 45 | 46 | void 47 | createMainMenuActionGroup(); 48 | 49 | Gtk::PopoverMenuBar * 50 | createMainMenu(); 51 | 52 | void 53 | setMainWindowSizes(); 54 | 55 | bool 56 | mainWindowCloseFunc(); 57 | 58 | void 59 | collectionRemoveSlot(const std::string &filename); 60 | 61 | std::string 62 | get_current_collection_name(); 63 | 64 | void 65 | about_dialog(); 66 | 67 | std::shared_ptr af; 68 | 69 | Gtk::Paned *main_pane = nullptr; 70 | 71 | LeftGrid *lg = nullptr; 72 | 73 | RightGrid *rg = nullptr; 74 | 75 | std::shared_ptr bookmarks; 76 | std::shared_ptr notes; 77 | 78 | std::filesystem::path mlbookproc_docs_path; 79 | std::filesystem::path mlpluginifc_docs_path; 80 | 81 | #ifdef USE_PLUGINS 82 | std::shared_ptr plugins_keeper; 83 | #endif 84 | }; 85 | 86 | #endif // MAINWINDOW_H 87 | -------------------------------------------------------------------------------- /include/MyLibraryApplication.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef MYLIBRARYAPPLICATION_H 18 | #define MYLIBRARYAPPLICATION_H 19 | 20 | #include 21 | #include 22 | 23 | class MyLibraryApplication : public Gtk::Application 24 | { 25 | public: 26 | virtual ~MyLibraryApplication(); 27 | 28 | static Glib::RefPtr 29 | create(const std::shared_ptr &af); 30 | 31 | protected: 32 | MyLibraryApplication(const std::shared_ptr &af); 33 | 34 | void 35 | on_activate() override; 36 | 37 | private: 38 | MainWindow * 39 | create_appwindow(); 40 | 41 | MainWindow *mw = nullptr; 42 | 43 | std::shared_ptr af; 44 | }; 45 | 46 | #endif // MYLIBRARYAPPLICATION_H 47 | -------------------------------------------------------------------------------- /include/NotesGui.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | #ifndef NOTESGUI_H 17 | #define NOTESGUI_H 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | class NotesGui 25 | { 26 | public: 27 | NotesGui(Gtk::Window *parent_window, 28 | const std::shared_ptr notes); 29 | 30 | void 31 | creatWindow(const std::string &collection_name, const BookBaseEntry &bbe); 32 | 33 | private: 34 | Gdk::Rectangle 35 | screen_size(); 36 | 37 | void 38 | confirmationDialog(); 39 | 40 | void 41 | closeDialog(); 42 | 43 | Gtk::Window *parent_window; 44 | std::shared_ptr notes; 45 | 46 | Gtk::Window *notes_window; 47 | NotesBaseEntry nbe; 48 | 49 | std::string note_buffer; 50 | 51 | Gtk::TextView *note_txt; 52 | }; 53 | 54 | #endif // NOTESGUI_H 55 | -------------------------------------------------------------------------------- /include/PluginsKeeper.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | #ifndef PLUGINSKEEPER_H 17 | #define PLUGINSKEEPER_H 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #ifdef __linux 27 | #include 28 | #endif 29 | #ifdef _WIN32 30 | #include 31 | #endif 32 | 33 | #ifndef ML_GTK_OLD 34 | #include 35 | #else 36 | #include 37 | #endif 38 | 39 | struct plugin 40 | { 41 | MLPlugin *plugin_ptr = nullptr; 42 | #ifdef __linux 43 | void *handle = nullptr; 44 | #endif 45 | #ifdef _WIN32 46 | HINSTANCE handle = nullptr; 47 | #endif 48 | std::filesystem::path plugin_path; 49 | Gtk::Widget *widg = nullptr; 50 | 51 | ~plugin() 52 | { 53 | delete plugin_ptr; 54 | if(handle) 55 | { 56 | #ifdef __linux 57 | int ch = dlclose(handle); 58 | if(ch != 0) 59 | { 60 | std::cout << "Plugin unloading error" << plugin_path << ": " 61 | << dlerror() << std::endl; 62 | } 63 | #endif 64 | #ifdef _WIN32 65 | FreeLibrary(handle); 66 | #endif 67 | } 68 | }; 69 | }; 70 | 71 | class PluginsKeeper 72 | { 73 | public: 74 | PluginsKeeper(Gtk::Window *parent_window, 75 | const std::shared_ptr &af); 76 | 77 | virtual ~PluginsKeeper(); 78 | 79 | void 80 | createWindow(); 81 | 82 | std::function signal_reload_collection_list; 83 | 84 | private: 85 | void 86 | setWindowSizes(); 87 | 88 | void 89 | loadPlugins(); 90 | 91 | void 92 | parseRawBase(const std::string &raw_base); 93 | 94 | void 95 | loadPlugin(const std::filesystem::path &pp); 96 | 97 | void 98 | savePlugins(); 99 | 100 | void 101 | removeConfirmationWindow(Gtk::Widget *widg, Gtk::Widget *flbx); 102 | 103 | void 104 | addPluginDialog(Gtk::Widget *flbx); 105 | 106 | #ifndef ML_GTK_OLD 107 | void 108 | addPluginDialogSlot(const Glib::RefPtr &result, 109 | const Glib::RefPtr &fd, 110 | Gtk::Widget *flbx); 111 | #else 112 | void 113 | addPluginDialogSlot(int respons_id, Gtk::FileChooserDialog *fd, 114 | Gtk::Widget *flbx); 115 | #endif 116 | 117 | void 118 | addPluginDialogSlotProc(const Glib::RefPtr &fl, 119 | Gtk::Widget *flbx); 120 | 121 | Gtk::Window *parent_window; 122 | std::shared_ptr af; 123 | 124 | Gtk::Window *main_window; 125 | 126 | std::vector> plugin_list; 127 | }; 128 | 129 | #endif // PLUGINSKEEPER_H 130 | -------------------------------------------------------------------------------- /include/RefreshCollectionGui.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef REFRESHCOLLECTIONGUI_H 18 | #define REFRESHCOLLECTIONGUI_H 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | class RefreshCollectionGui 33 | { 34 | public: 35 | RefreshCollectionGui(const std::shared_ptr &af, 36 | Gtk::Window *main_window, 37 | const std::shared_ptr &bookmarks, 38 | const std::shared_ptr ¬es); 39 | 40 | void 41 | createWindow(); 42 | 43 | std::function collection_refreshed; 44 | 45 | private: 46 | Glib::RefPtr 47 | createCollectionsList(); 48 | 49 | void 50 | confirmationDialog(Gtk::Window *win); 51 | 52 | void 53 | refreshCollection(Gtk::Window *win, Gtk::Window *parent_window); 54 | 55 | std::shared_ptr af; 56 | Gtk::Window *main_window = nullptr; 57 | std::shared_ptr bookmarks; 58 | std::shared_ptr notes; 59 | 60 | Gtk::DropDown *collection = nullptr; 61 | Gtk::Entry *num_threads = nullptr; 62 | Gtk::CheckButton *clean_empty = nullptr; 63 | Gtk::CheckButton *fast_refreshing = nullptr; 64 | Gtk::CheckButton *refresh_bookmarks = nullptr; 65 | Gtk::CheckButton *disable_rar = nullptr; 66 | 67 | bool reserve_notes = false; 68 | std::filesystem::path reserve_notes_directory; 69 | }; 70 | 71 | #endif // REFRESHCOLLECTIONGUI_H 72 | -------------------------------------------------------------------------------- /include/RemoveBookGui.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef REMOVEBOOKGUI_H 18 | #define REMOVEBOOKGUI_H 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | class RemoveBookGui 31 | { 32 | public: 33 | RemoveBookGui(const std::shared_ptr &af, Gtk::Window *parent_window, 34 | const BookBaseEntry &bbe, const std::string &col_name, 35 | const std::shared_ptr &bookmarks, 36 | const std::shared_ptr ¬es); 37 | 38 | void 39 | createWindow(); 40 | 41 | std::function remove_callback; 42 | 43 | private: 44 | void 45 | removeBookFunc(Gtk::Window *win); 46 | 47 | void 48 | removeFinished(Gtk::Window *win); 49 | 50 | std::shared_ptr af; 51 | Gtk::Window *parent_window = nullptr; 52 | BookBaseEntry bbe; 53 | std::string col_name; 54 | std::shared_ptr bookmarks; 55 | std::shared_ptr notes; 56 | 57 | std::shared_ptr remove_callback_disp; 58 | int remove_result = 0; 59 | 60 | bool notes_reserve = false; 61 | std::filesystem::path notes_reserve_path; 62 | }; 63 | 64 | #endif // REMOVEBOOKGUI_H 65 | -------------------------------------------------------------------------------- /include/RemoveCollectionGui.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef REMOVECOLLECTIONGUI_H 18 | #define REMOVECOLLECTIONGUI_H 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | class RemoveCollectionGui 30 | { 31 | public: 32 | RemoveCollectionGui(const std::shared_ptr &af, 33 | Gtk::Window *main_window, 34 | const std::shared_ptr ¬es); 35 | 36 | void 37 | createWindow(); 38 | 39 | std::function collection_removed; 40 | 41 | private: 42 | Glib::RefPtr 43 | formCollectionsModel(); 44 | 45 | void 46 | confirmationDialog(Gtk::Window *win); 47 | 48 | void 49 | successDialog(Gtk::Window *win, const std::string &filename); 50 | 51 | std::shared_ptr af; 52 | Gtk::Window *main_window = nullptr; 53 | std::shared_ptr notes; 54 | 55 | Gtk::DropDown *collection_name = nullptr; 56 | 57 | bool reserve_notes = false; 58 | std::filesystem::path reserve_notes_path; 59 | }; 60 | 61 | #endif // REMOVECOLLECTIONGUI_H 62 | -------------------------------------------------------------------------------- /include/SaveCover.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef SAVECOVER_H 18 | #define SAVECOVER_H 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #ifndef ML_GTK_OLD 28 | #include 29 | #else 30 | #include 31 | #endif 32 | 33 | class SaveCover 34 | { 35 | public: 36 | SaveCover(const std::shared_ptr &bie, 37 | Gtk::Window *parent_window); 38 | 39 | void 40 | createWindow(); 41 | 42 | private: 43 | Glib::RefPtr 44 | create_model(); 45 | 46 | void 47 | save_dialog(Gtk::Window *win); 48 | 49 | #ifndef ML_GTK_OLD 50 | void 51 | save_dialog_result(const Glib::RefPtr &result, 52 | const Glib::RefPtr &fd, 53 | Gtk::Window *win); 54 | #else 55 | void 56 | save_dialog_result(int resp, Gtk::FileChooserDialog *fd, Gtk::Window *win); 57 | #endif 58 | 59 | void 60 | saveFunc(Gtk::Window *win, const Glib::RefPtr &fl); 61 | 62 | std::shared_ptr bie; 63 | Gtk::Window *parent_window = nullptr; 64 | 65 | Gtk::DropDown *format = nullptr; 66 | }; 67 | 68 | #endif // SAVECOVER_H 69 | -------------------------------------------------------------------------------- /include/SearchProcessGui.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef SEARCHPROCESSGUI_H 18 | #define SEARCHPROCESSGUI_H 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | class SearchProcessGui 30 | { 31 | public: 32 | SearchProcessGui(BaseKeeper *bk, Gtk::Window *main_window); 33 | 34 | void 35 | createWindow(const BookBaseEntry &search); 36 | 37 | void 38 | createWindow(const std::string &collection_name, std::shared_ptr af, 39 | const int &variant); 40 | 41 | void 42 | createWindow(const std::vector ¬es); 43 | 44 | std::function &result)> 45 | search_result_show; 46 | 47 | std::function &result)> 48 | search_result_file; 49 | 50 | std::function &result)> 51 | search_result_authors; 52 | 53 | private: 54 | void 55 | startSearch(Gtk::Window *win, const BookBaseEntry &search); 56 | 57 | void 58 | copyFiles(Gtk::Window *win, const std::string &collection_name, 59 | std::shared_ptr af); 60 | 61 | void 62 | showAuthors(Gtk::Window *win, Gtk::ProgressBar *prog, Gtk::Label *lab, 63 | const std::string &collection_name); 64 | 65 | void 66 | showBooksWithNotes(Gtk::Window *win, 67 | const std::vector ¬es); 68 | 69 | BaseKeeper *bk = nullptr; 70 | Gtk::Window *main_window = nullptr; 71 | std::vector search_result; 72 | std::vector files; 73 | std::vector authors; 74 | }; 75 | 76 | #endif // SEARCHPROCESSGUI_H 77 | -------------------------------------------------------------------------------- /include/SearchResultModelItem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #ifndef SEARCHRESULTMODELITEM_H 18 | #define SEARCHRESULTMODELITEM_H 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #ifdef USE_OPENMP 26 | #include 27 | #else 28 | #include 29 | #endif 30 | 31 | class SearchResultModelItem : public Glib::Object 32 | { 33 | public: 34 | virtual ~SearchResultModelItem(); 35 | 36 | static Glib::RefPtr 37 | create(const BookBaseEntry &bbe); 38 | 39 | BookBaseEntry bbe; 40 | 41 | void 42 | addLabel(Gtk::Label *lab); 43 | 44 | void 45 | removeLabel(Gtk::Label *lab); 46 | 47 | void 48 | activateLabels(); 49 | 50 | void 51 | deactivateLabels(); 52 | 53 | protected: 54 | SearchResultModelItem(const BookBaseEntry &bbe); 55 | 56 | std::vector labels; 57 | #ifndef USE_OPENMP 58 | std::mutex labels_mtx; 59 | #else 60 | omp_lock_t labels_mtx; 61 | #endif 62 | }; 63 | 64 | #endif // SEARCHRESULTMODELITEM_H 65 | -------------------------------------------------------------------------------- /include/SearchResultModelItemAuth.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | #ifndef SEARCHRESULTMODELITEMAUTH_H 17 | #define SEARCHRESULTMODELITEMAUTH_H 18 | 19 | #include 20 | #include 21 | 22 | #ifdef USE_OPENMP 23 | #include 24 | #else 25 | #include 26 | #endif 27 | 28 | class SearchResultModelItemAuth : public Glib::Object 29 | { 30 | public: 31 | virtual ~SearchResultModelItemAuth(); 32 | 33 | static Glib::RefPtr 34 | create(const std::string &auth); 35 | 36 | std::string auth; 37 | 38 | void 39 | setLabel(Gtk::Label *lab); 40 | 41 | void 42 | unsetLabel(); 43 | 44 | void 45 | activateLab(); 46 | 47 | void 48 | deactivateLab(); 49 | 50 | protected: 51 | SearchResultModelItemAuth(const std::string &auth); 52 | 53 | Gtk::Label *l_lab = nullptr; 54 | 55 | #ifndef USE_OPENMP 56 | std::mutex l_lab_mtx; 57 | #else 58 | omp_lock_t l_lab_mtx; 59 | #endif 60 | }; 61 | 62 | #endif // SEARCHRESULTMODELITEMAUTH_H 63 | -------------------------------------------------------------------------------- /include/SearchResultModelItemFL.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | #ifndef SEARCHRESULTMODELITEMFL_H 17 | #define SEARCHRESULTMODELITEMFL_H 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | #ifdef USE_OPENMP 24 | #include 25 | #else 26 | #include 27 | #endif 28 | 29 | class SearchResultModelItemFL : public Glib::Object 30 | { 31 | public: 32 | virtual ~SearchResultModelItemFL(); 33 | 34 | static Glib::RefPtr 35 | create(const FileParseEntry &entry); 36 | 37 | FileParseEntry entry; 38 | 39 | void 40 | setLabel(Gtk::Label *lab); 41 | 42 | void 43 | unsetLabel(); 44 | 45 | void 46 | activateLab(); 47 | 48 | void 49 | deactivateLab(); 50 | 51 | protected: 52 | SearchResultModelItemFL(const FileParseEntry &entry); 53 | 54 | Gtk::Label *l_lab = nullptr; 55 | #ifndef USE_OPENMP 56 | std::mutex l_lab_mtx; 57 | #else 58 | omp_lock_t l_lab_mtx; 59 | #endif 60 | }; 61 | 62 | #endif // SEARCHRESULTMODELITEMFL_H 63 | -------------------------------------------------------------------------------- /include/SettingsWindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | #ifndef SETTINGSWINDOW_H 17 | #define SETTINGSWINDOW_H 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #ifndef ML_GTK_OLD 24 | #include 25 | #else 26 | #include 27 | #endif 28 | 29 | class SettingsWindow 30 | { 31 | public: 32 | SettingsWindow(const std::shared_ptr &af, 33 | Gtk::Window *parent_window); 34 | 35 | void 36 | createWindow(); 37 | 38 | private: 39 | Gtk::Widget * 40 | windowsSection(); 41 | 42 | enum widget_type 43 | { 44 | apply_button, 45 | cancel_button, 46 | operation_button, 47 | remove_button, 48 | combo_box, 49 | text_field, 50 | entry, 51 | label, 52 | main_menu, 53 | menu_button, 54 | error_label, 55 | warning_label, 56 | progress_bar, 57 | column_view, 58 | frames 59 | }; 60 | 61 | Gtk::Widget * 62 | formSection(const widget_type &wt); 63 | 64 | void 65 | readSettings(); 66 | 67 | void 68 | parseSettings(); 69 | 70 | struct setting 71 | { 72 | std::string attribute_id; 73 | std::string value; 74 | }; 75 | 76 | struct section 77 | { 78 | std::string section_id; 79 | std::vector settings; 80 | }; 81 | 82 | void 83 | parseSection(section &s, const std::string §ion_str); 84 | 85 | void 86 | applySettings(); 87 | 88 | void 89 | fileDialog(Gtk::Entry *ent); 90 | 91 | #ifndef ML_GTK_OLD 92 | void 93 | fileDialogSlot(const Glib::RefPtr &result, 94 | const Glib::RefPtr &fd, Gtk::Entry *ent); 95 | #else 96 | void 97 | fileDialogSlot(int respons_id, Gtk::FileChooserDialog *fd, Gtk::Entry *ent); 98 | #endif 99 | 100 | void 101 | windowSize(); 102 | 103 | std::shared_ptr af; 104 | Gtk::Window *parent_window; 105 | 106 | Gtk::Window *window; 107 | 108 | std::filesystem::path save_path; 109 | 110 | std::string source_settings; 111 | 112 | std::vector
settings_v; 113 | }; 114 | 115 | #endif // SETTINGSWINDOW_H 116 | -------------------------------------------------------------------------------- /mylibrary.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProfessorNavigator/mylibrary/9e81104ba60a259e0a36bd86d09352953cc62268/mylibrary.ico -------------------------------------------------------------------------------- /ru.mail.bobilev_yury.MyLibrary.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=MyLibrary 3 | Comment=Home librarian 4 | GenericName=MyLibrary 5 | Exec=mylibrary 6 | Icon=mylibrary 7 | Categories=Office; 8 | Terminal=false 9 | Type=Application 10 | Version=1.5 11 | Name[ru]=MyLibrary 12 | Comment[ru]=Домашний библиотекарь 13 | GenericName[ru]=MyLibrary 14 | Name[ru_RU]=MyLibrary 15 | -------------------------------------------------------------------------------- /ru.mail.bobilev_yury.MyLibrary.omp.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=MyLibrary 3 | Comment=Home librarian 4 | GenericName=MyLibrary 5 | Exec=env OMP_CANCELLATION=true mylibrary 6 | Icon=mylibrary 7 | Categories=Office; 8 | Terminal=false 9 | Type=Application 10 | Version=1.5 11 | Name[ru]=MyLibrary 12 | Comment[ru]=Домашний библиотекарь 13 | GenericName[ru]=MyLibrary 14 | Name[ru_RU]=MyLibrary 15 | -------------------------------------------------------------------------------- /src/AddBookModelItem.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #include 18 | 19 | AddBookModelItem::AddBookModelItem(const std::string &source_path) 20 | { 21 | this->source_path = source_path; 22 | } 23 | 24 | Glib::RefPtr 25 | AddBookModelItem::create(const std::string &source_path) 26 | { 27 | AddBookModelItem *item = new AddBookModelItem(source_path); 28 | return Glib::make_refptr_for_instance(item); 29 | } 30 | -------------------------------------------------------------------------------- /src/BookMarksModelItem.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | #include 17 | 18 | BookMarksModelItem::~BookMarksModelItem() 19 | { 20 | #ifdef USE_OPENMP 21 | omp_destroy_lock(&labels_mtx); 22 | #endif 23 | } 24 | 25 | Glib::RefPtr 26 | BookMarksModelItem::create(const std::string &coll_name, 27 | const BookBaseEntry &bbe) 28 | { 29 | BookMarksModelItem *item = new BookMarksModelItem(coll_name, bbe); 30 | return Glib::make_refptr_for_instance(item); 31 | } 32 | 33 | void 34 | BookMarksModelItem::addLabel(Gtk::Label *lab) 35 | { 36 | #ifndef USE_OPENMP 37 | labels_mtx.lock(); 38 | #else 39 | omp_set_lock(&labels_mtx); 40 | #endif 41 | auto it = std::find(labels.begin(), labels.end(), lab); 42 | if(it == labels.end()) 43 | { 44 | if(labels.capacity() == 0) 45 | { 46 | labels.reserve(6); 47 | } 48 | labels.push_back(lab); 49 | } 50 | #ifndef USE_OPENMP 51 | labels_mtx.unlock(); 52 | #else 53 | omp_unset_lock(&labels_mtx); 54 | #endif 55 | } 56 | 57 | void 58 | BookMarksModelItem::removeLabel(Gtk::Label *lab) 59 | { 60 | #ifndef USE_OPENMP 61 | labels_mtx.lock(); 62 | #else 63 | omp_set_lock(&labels_mtx); 64 | #endif 65 | auto it = std::find(labels.begin(), labels.end(), lab); 66 | if(it != labels.end()) 67 | { 68 | labels.erase(it); 69 | if(labels.size() == 0) 70 | { 71 | labels.shrink_to_fit(); 72 | } 73 | } 74 | #ifndef USE_OPENMP 75 | labels_mtx.unlock(); 76 | #else 77 | omp_unset_lock(&labels_mtx); 78 | #endif 79 | } 80 | 81 | void 82 | BookMarksModelItem::activateLabels() 83 | { 84 | #ifndef USE_OPENMP 85 | labels_mtx.lock(); 86 | #else 87 | omp_set_lock(&labels_mtx); 88 | #endif 89 | for(size_t i = 0; i < labels.size(); i++) 90 | { 91 | labels[i]->set_name("selectedLab"); 92 | } 93 | #ifndef USE_OPENMP 94 | labels_mtx.unlock(); 95 | #else 96 | omp_unset_lock(&labels_mtx); 97 | #endif 98 | } 99 | 100 | void 101 | BookMarksModelItem::deactivateLabels() 102 | { 103 | #ifndef USE_OPENMP 104 | labels_mtx.lock(); 105 | #else 106 | omp_set_lock(&labels_mtx); 107 | #endif 108 | for(size_t i = 0; i < labels.size(); i++) 109 | { 110 | labels[i]->set_name("windowLabel"); 111 | } 112 | #ifndef USE_OPENMP 113 | labels_mtx.unlock(); 114 | #else 115 | omp_unset_lock(&labels_mtx); 116 | #endif 117 | } 118 | 119 | BookMarksModelItem::BookMarksModelItem(const std::string &coll_name, 120 | const BookBaseEntry &bbe) 121 | { 122 | #ifdef USE_OPENMP 123 | omp_init_lock(&labels_mtx); 124 | #endif 125 | element = std::make_tuple(coll_name, bbe); 126 | } 127 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(mylibrary 2 | PRIVATE AddBookGui.cpp 3 | PRIVATE AddBookModelItem.cpp 4 | PRIVATE BookInfoGui.cpp 5 | PRIVATE BookMarksGui.cpp 6 | PRIVATE BookMarksModelItem.cpp 7 | PRIVATE BookMarksShow.cpp 8 | PRIVATE CollectionCrProcessGui.cpp 9 | PRIVATE CopyBookGui.cpp 10 | PRIVATE CoverPixBuf.cpp 11 | PRIVATE CreateCollectionGui.cpp 12 | PRIVATE EditBookGenreModelItem.cpp 13 | PRIVATE EditBookGui.cpp 14 | PRIVATE EmptyCollectionGui.cpp 15 | PRIVATE ExportCollectionGui.cpp 16 | PRIVATE FullSizeCover.cpp 17 | PRIVATE ImportCollectionGui.cpp 18 | PRIVATE LeftGrid.cpp 19 | PRIVATE main.cpp 20 | PRIVATE MainWindow.cpp 21 | PRIVATE MyLibraryApplication.cpp 22 | PRIVATE NotesGui.cpp 23 | PRIVATE RefreshCollectionGui.cpp 24 | PRIVATE RemoveBookGui.cpp 25 | PRIVATE RemoveCollectionGui.cpp 26 | PRIVATE RightGrid.cpp 27 | PRIVATE SaveCover.cpp 28 | PRIVATE SearchProcessGui.cpp 29 | PRIVATE SearchResultModelItem.cpp 30 | PRIVATE SearchResultModelItemAuth.cpp 31 | PRIVATE SearchResultModelItemFL.cpp 32 | PRIVATE SearchResultShow.cpp 33 | PRIVATE SettingsWindow.cpp 34 | PRIVATE TransferBookGui.cpp 35 | ) 36 | 37 | if(USE_PLUGINS) 38 | target_sources(mylibrary 39 | PRIVATE PluginsKeeper.cpp 40 | ) 41 | endif() 42 | -------------------------------------------------------------------------------- /src/EditBookGenreModelItem.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #include 18 | 19 | EditBookGenreModelItem::EditBookGenreModelItem(const std::string &genre_code, 20 | const std::string &genre_name) 21 | { 22 | this->genre_code = genre_code; 23 | this->genre_name = genre_name; 24 | } 25 | 26 | Glib::RefPtr 27 | EditBookGenreModelItem::create(const std::string &genre_code, 28 | const std::string &genre_name) 29 | { 30 | EditBookGenreModelItem *item = new EditBookGenreModelItem(genre_code, 31 | genre_name); 32 | return Glib::make_refptr_for_instance(item); 33 | } 34 | -------------------------------------------------------------------------------- /src/MyLibraryApplication.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #include 18 | 19 | #ifndef USE_OPENMP 20 | MyLibraryApplication::MyLibraryApplication(const std::shared_ptr &af) : 21 | Gtk::Application("ru.mail.bobilev_yury.MyLibrary") 22 | { 23 | this->af = af; 24 | } 25 | #else 26 | MyLibraryApplication::MyLibraryApplication(const std::shared_ptr &af) 27 | : Gtk::Application("ru.mail.bobilev_yury.MyLibrary.omp") 28 | { 29 | this->af = af; 30 | } 31 | #endif 32 | 33 | MyLibraryApplication::~MyLibraryApplication() 34 | { 35 | delete mw; 36 | } 37 | 38 | Glib::RefPtr 39 | MyLibraryApplication::create(const std::shared_ptr &af) 40 | { 41 | return Glib::make_refptr_for_instance( 42 | new MyLibraryApplication(af)); 43 | } 44 | 45 | MainWindow* 46 | MyLibraryApplication::create_appwindow() 47 | { 48 | mw = new MainWindow(af); 49 | add_window(*mw); 50 | mw->signal_hide().connect([this] 51 | { 52 | std::vector wv; 53 | wv = get_windows(); 54 | for(size_t i = 0; i < wv.size(); i++) 55 | { 56 | Gtk::Window *win = wv[i]; 57 | if(win != mw) 58 | { 59 | win->set_visible(false); 60 | delete win; 61 | } 62 | } 63 | }); 64 | 65 | return mw; 66 | } 67 | 68 | void 69 | MyLibraryApplication::on_activate() 70 | { 71 | std::vector winv; 72 | winv = get_windows(); 73 | if(winv.size() == 0) 74 | { 75 | auto appwin = create_appwindow(); 76 | appwin->present(); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/SearchResultModelItem.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | SearchResultModelItem::SearchResultModelItem(const BookBaseEntry &bbe) 21 | { 22 | #ifdef USE_OPENMP 23 | omp_init_lock(&labels_mtx); 24 | #endif 25 | this->bbe = bbe; 26 | } 27 | 28 | SearchResultModelItem::~SearchResultModelItem() 29 | { 30 | #ifdef USE_OPENMP 31 | omp_destroy_lock(&labels_mtx); 32 | #endif 33 | } 34 | 35 | Glib::RefPtr 36 | SearchResultModelItem::create(const BookBaseEntry &bbe) 37 | { 38 | SearchResultModelItem *item = new SearchResultModelItem(bbe); 39 | return Glib::make_refptr_for_instance(item); 40 | } 41 | 42 | void 43 | SearchResultModelItem::addLabel(Gtk::Label *lab) 44 | { 45 | #ifndef USE_OPENMP 46 | labels_mtx.lock(); 47 | #else 48 | omp_set_lock(&labels_mtx); 49 | #endif 50 | auto it = std::find(labels.begin(), labels.end(), lab); 51 | if(it == labels.end()) 52 | { 53 | if(labels.capacity() == 0) 54 | { 55 | labels.reserve(5); 56 | } 57 | labels.push_back(lab); 58 | } 59 | #ifndef USE_OPENMP 60 | labels_mtx.unlock(); 61 | #else 62 | omp_unset_lock(&labels_mtx); 63 | #endif 64 | } 65 | 66 | void 67 | SearchResultModelItem::removeLabel(Gtk::Label *lab) 68 | { 69 | #ifndef USE_OPENMP 70 | labels_mtx.lock(); 71 | #else 72 | omp_set_lock(&labels_mtx); 73 | #endif 74 | auto it = std::find(labels.begin(), labels.end(), lab); 75 | if(it != labels.end()) 76 | { 77 | labels.erase(it); 78 | if(labels.size() == 0) 79 | { 80 | labels.shrink_to_fit(); 81 | } 82 | } 83 | #ifndef USE_OPENMP 84 | labels_mtx.unlock(); 85 | #else 86 | omp_unset_lock(&labels_mtx); 87 | #endif 88 | } 89 | 90 | void 91 | SearchResultModelItem::activateLabels() 92 | { 93 | #ifndef USE_OPENMP 94 | labels_mtx.lock(); 95 | #else 96 | omp_set_lock(&labels_mtx); 97 | #endif 98 | for(size_t i = 0; i < labels.size(); i++) 99 | { 100 | labels[i]->set_name("selectedLab"); 101 | } 102 | #ifndef USE_OPENMP 103 | labels_mtx.unlock(); 104 | #else 105 | omp_unset_lock(&labels_mtx); 106 | #endif 107 | } 108 | 109 | void 110 | SearchResultModelItem::deactivateLabels() 111 | { 112 | #ifndef USE_OPENMP 113 | labels_mtx.lock(); 114 | #else 115 | omp_set_lock(&labels_mtx); 116 | #endif 117 | for(size_t i = 0; i < labels.size(); i++) 118 | { 119 | labels[i]->set_name("windowLabel"); 120 | } 121 | #ifndef USE_OPENMP 122 | labels_mtx.unlock(); 123 | #else 124 | omp_unset_lock(&labels_mtx); 125 | #endif 126 | } 127 | -------------------------------------------------------------------------------- /src/SearchResultModelItemAuth.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | #include 17 | 18 | SearchResultModelItemAuth::~SearchResultModelItemAuth() 19 | { 20 | #ifdef USE_OPENMP 21 | omp_destroy_lock(&l_lab_mtx); 22 | #endif 23 | } 24 | 25 | Glib::RefPtr 26 | SearchResultModelItemAuth::create(const std::string &auth) 27 | { 28 | SearchResultModelItemAuth *mli = new SearchResultModelItemAuth(auth); 29 | 30 | return Glib::make_refptr_for_instance(mli); 31 | } 32 | 33 | void 34 | SearchResultModelItemAuth::setLabel(Gtk::Label *lab) 35 | { 36 | #ifndef USE_OPENMP 37 | l_lab_mtx.lock(); 38 | l_lab = lab; 39 | l_lab_mtx.unlock(); 40 | #else 41 | omp_set_lock(&l_lab_mtx); 42 | l_lab = lab; 43 | omp_unset_lock(&l_lab_mtx); 44 | #endif 45 | } 46 | 47 | void 48 | SearchResultModelItemAuth::unsetLabel() 49 | { 50 | #ifndef USE_OPENMP 51 | l_lab_mtx.lock(); 52 | l_lab = nullptr; 53 | l_lab_mtx.unlock(); 54 | #else 55 | omp_set_lock(&l_lab_mtx); 56 | l_lab = nullptr; 57 | omp_unset_lock(&l_lab_mtx); 58 | #endif 59 | } 60 | 61 | void 62 | SearchResultModelItemAuth::activateLab() 63 | { 64 | #ifndef USE_OPENMP 65 | l_lab_mtx.lock(); 66 | #else 67 | omp_set_lock(&l_lab_mtx); 68 | #endif 69 | if(l_lab) 70 | { 71 | l_lab->set_name("selectedLab"); 72 | } 73 | #ifndef USE_OPENMP 74 | l_lab_mtx.unlock(); 75 | #else 76 | omp_unset_lock(&l_lab_mtx); 77 | #endif 78 | } 79 | 80 | void 81 | SearchResultModelItemAuth::deactivateLab() 82 | { 83 | #ifndef USE_OPENMP 84 | l_lab_mtx.lock(); 85 | #else 86 | omp_set_lock(&l_lab_mtx); 87 | #endif 88 | if(l_lab) 89 | { 90 | l_lab->set_name("windowLabel"); 91 | } 92 | #ifndef USE_OPENMP 93 | l_lab_mtx.unlock(); 94 | #else 95 | omp_unset_lock(&l_lab_mtx); 96 | #endif 97 | } 98 | 99 | SearchResultModelItemAuth::SearchResultModelItemAuth(const std::string &auth) 100 | { 101 | #ifdef USE_OPENMP 102 | omp_init_lock(&l_lab_mtx); 103 | #endif 104 | this->auth = auth; 105 | } 106 | -------------------------------------------------------------------------------- /src/SearchResultModelItemFL.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | #include 17 | 18 | SearchResultModelItemFL::~SearchResultModelItemFL() 19 | { 20 | #ifdef USE_OPENMP 21 | omp_destroy_lock(&l_lab_mtx); 22 | #endif 23 | } 24 | 25 | Glib::RefPtr 26 | SearchResultModelItemFL::create(const FileParseEntry &entry) 27 | { 28 | SearchResultModelItemFL *item = new SearchResultModelItemFL(entry); 29 | return Glib::make_refptr_for_instance(item); 30 | } 31 | 32 | void 33 | SearchResultModelItemFL::setLabel(Gtk::Label *lab) 34 | { 35 | #ifndef USE_OPENMP 36 | l_lab_mtx.lock(); 37 | l_lab = lab; 38 | l_lab_mtx.unlock(); 39 | #else 40 | omp_set_lock(&l_lab_mtx); 41 | l_lab = lab; 42 | omp_unset_lock(&l_lab_mtx); 43 | #endif 44 | } 45 | 46 | void 47 | SearchResultModelItemFL::unsetLabel() 48 | { 49 | #ifndef USE_OPENMP 50 | l_lab_mtx.lock(); 51 | l_lab = nullptr; 52 | l_lab_mtx.unlock(); 53 | #else 54 | omp_set_lock(&l_lab_mtx); 55 | l_lab = nullptr; 56 | omp_unset_lock(&l_lab_mtx); 57 | #endif 58 | } 59 | 60 | void 61 | SearchResultModelItemFL::activateLab() 62 | { 63 | #ifndef USE_OPENMP 64 | l_lab_mtx.lock(); 65 | #else 66 | omp_set_lock(&l_lab_mtx); 67 | #endif 68 | if(l_lab) 69 | { 70 | l_lab->set_name("selectedLab"); 71 | } 72 | #ifndef USE_OPENMP 73 | l_lab_mtx.unlock(); 74 | #else 75 | omp_unset_lock(&l_lab_mtx); 76 | #endif 77 | } 78 | 79 | void 80 | SearchResultModelItemFL::deactivateLab() 81 | { 82 | #ifndef USE_OPENMP 83 | l_lab_mtx.lock(); 84 | #else 85 | omp_set_lock(&l_lab_mtx); 86 | #endif 87 | if(l_lab) 88 | { 89 | l_lab->set_name("windowLabel"); 90 | } 91 | #ifndef USE_OPENMP 92 | l_lab_mtx.unlock(); 93 | #else 94 | omp_unset_lock(&l_lab_mtx); 95 | #endif 96 | } 97 | 98 | SearchResultModelItemFL::SearchResultModelItemFL(const FileParseEntry &entry) 99 | { 100 | #ifdef USE_OPENMP 101 | omp_init_lock(&l_lab_mtx); 102 | #endif 103 | this->entry = entry; 104 | } 105 | -------------------------------------------------------------------------------- /src/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022-2025 Yury Bobylev 3 | * 4 | * This program is free software: you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation, version 3. 7 | * 8 | * This program is distributed in the hope that it will be useful, but WITHOUT 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 | * more details. 12 | * 13 | * You should have received a copy of the GNU General Public License along with 14 | * this program. If not, see . 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | #ifdef USE_OPENMP 23 | #include 24 | #endif 25 | 26 | int 27 | main(int argc, char *argv[]) 28 | { 29 | std::shared_ptr af = AuxFunc::create(); 30 | 31 | if(af->get_activated()) 32 | { 33 | std::filesystem::path p = af->share_path(); 34 | p /= std::filesystem::u8path("locale"); 35 | char *report = bindtextdomain("MyLibrary", p.u8string().c_str()); 36 | if(report) 37 | { 38 | std::cout << "MyLibrary text domain path: " << report << std::endl; 39 | } 40 | report = bind_textdomain_codeset("MyLibrary", "UTF-8"); 41 | if(report) 42 | { 43 | std::cout << "MyLibrary codeset: " << report << std::endl; 44 | } 45 | report = textdomain("MyLibrary"); 46 | if(report) 47 | { 48 | std::cout << "MyLibrary text domain: " << report << std::endl; 49 | } 50 | 51 | int result; 52 | #ifdef USE_OPENMP 53 | #pragma omp parallel 54 | { 55 | #pragma omp masked 56 | { 57 | auto app = MyLibraryApplication::create(af); 58 | result = app->run(argc, argv); 59 | af.reset(); 60 | app.reset(); 61 | } 62 | } 63 | #else 64 | auto app = MyLibraryApplication::create(af); 65 | result = app->run(argc, argv); 66 | af.reset(); 67 | app.reset(); 68 | #endif 69 | return result; 70 | } 71 | else 72 | { 73 | std::cout << "MyLibrary: MLBookProc has not been initialized, " 74 | "finishing the application" 75 | << std::endl; 76 | af.reset(); 77 | return 1; 78 | } 79 | } 80 | --------------------------------------------------------------------------------