]> Nutra Git (v1) - gamesguru/feather.git/commitdiff
CMake: minimize dependencies for CHECK_UPDATES=Off, WITH_SCANNER=Off
authortobtoht <tob@featherwallet.org>
Wed, 19 Apr 2023 15:41:46 +0000 (17:41 +0200)
committertobtoht <tob@featherwallet.org>
Wed, 19 Apr 2023 15:41:46 +0000 (17:41 +0200)
12 files changed:
CMakeLists.txt
src/CMakeLists.txt
src/MainWindow.cpp
src/MainWindow.h
src/qrcode/utils/QrCodeUtils.cpp [moved from src/qrcode/QrCodeUtils.cpp with 100% similarity]
src/qrcode/utils/QrCodeUtils.h [moved from src/qrcode/QrCodeUtils.h with 100% similarity]
src/utils/updater/UpdateDialog.cpp [moved from src/dialog/UpdateDialog.cpp with 99% similarity]
src/utils/updater/UpdateDialog.h [moved from src/dialog/UpdateDialog.h with 97% similarity]
src/utils/updater/UpdateDialog.ui [moved from src/dialog/UpdateDialog.ui with 100% similarity]
src/utils/updater/Updater.cpp [moved from src/utils/Updater.cpp with 100% similarity]
src/utils/updater/Updater.h [moved from src/utils/Updater.h with 100% similarity]
src/widgets/PayToEdit.cpp

index 29a102008d6c48ac1d944e84ba12e2cf3b3fd264..4e5809e868019a492c91c191803df18d9211554b 100644 (file)
@@ -64,6 +64,9 @@ get_directory_property(UNBOUND_LIBRARY DIRECTORY "monero" DEFINITION UNBOUND_LIB
 get_directory_property(DEVICE_TREZOR_READY DIRECTORY "monero" DEFINITION DEVICE_TREZOR_READY)
 get_directory_property(TREZOR_DEP_LIBS DIRECTORY "monero" DEFINITION TREZOR_DEP_LIBS)
 
+# pthread
+find_package(Threads REQUIRED)
+
 # Easylogging
 include_directories(${EASYLOGGING_INCLUDE})
 link_directories(${EASYLOGGING_LIBRARY_DIRS})
@@ -75,22 +78,26 @@ message(STATUS "libsodium: libraries at ${SODIUM_LIBRARY}")
 # QrEncode
 find_package(QREncode REQUIRED)
 
-# ZBAR
-find_package(ZBAR REQUIRED)
-message(STATUS "libzbar: include dir at ${ZBAR_INCLUDE_DIR}")
-message(STATUS "libzbar: libraries at ${ZBAR_LIBRARIES}")
-
 # Polyseed
 find_package(Polyseed REQUIRED)
 if(Polyseed_SUBMODULE)
     add_subdirectory(src/third-party/polyseed EXCLUDE_FROM_ALL)
 endif()
 
+# ZBAR
+if(WITH_SCANNER)
+    find_package(ZBAR REQUIRED)
+    message(STATUS "libzbar: include dir at ${ZBAR_INCLUDE_DIR}")
+    message(STATUS "libzbar: libraries at ${ZBAR_LIBRARIES}")
+endif()
+
 # libzip
-set(ZLIB_USE_STATIC_LIBS "ON")
-find_package(ZLIB REQUIRED)
-find_path(LIBZIP_INCLUDE_DIRS zip.h)
-find_library(LIBZIP_LIBRARIES zip)
+if(CHECK_UPDATES)
+    set(ZLIB_USE_STATIC_LIBS "ON")
+    find_package(ZLIB REQUIRED)
+    find_path(LIBZIP_INCLUDE_DIRS zip.h)
+    find_library(LIBZIP_LIBRARIES zip)
+endif()
 
 # Boost
 if(DEBUG)
@@ -182,8 +189,6 @@ elseif(NOT MSVC AND NOT DEPENDS)
     set(EXTRA_LIBRARIES ${RT})
 endif()
 
-list(APPEND EXTRA_LIBRARIES ${CMAKE_DL_LIBS})
-
 if(APPLE)
     cmake_policy(SET CMP0042 NEW)
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=default -std=c++11")
index fd20683cf21942c32b38a8426e84be406a6e745a..242116386f916e0d9935f4c92b2a4aaf71e5bf16 100644 (file)
@@ -2,9 +2,6 @@ set(CMAKE_AUTOMOC ON)
 set(CMAKE_AUTOUIC ON)
 set(CMAKE_AUTORCC ON)
 
-# pthread
-find_package(Threads REQUIRED)
-
 set(QT_COMPONENTS
         Core
         Widgets
@@ -28,7 +25,9 @@ endif()
 set(QAPPLICATION_CLASS QApplication CACHE STRING "Inheritance class for SingleApplication")
 add_subdirectory(third-party/singleapplication)
 
-add_subdirectory(openpgp)
+if (CHECK_UPDATES)
+    add_subdirectory(openpgp)
+endif()
 
 qt_add_resources(RESOURCES assets.qrc assets_tor.qrc)
 
@@ -74,6 +73,18 @@ file(GLOB SOURCE_FILES
         "plugins/*/*.h"
         )
 
+if (CHECK_UPDATES)
+    file(GLOB UPDATER_FILES
+            "utils/updater/*.h"
+            "utils/updater/*.cpp")
+endif()
+
+if (WITH_SCANNER)
+    file(GLOB QRCODE_UTILS_FILES
+            "qrcode/utils/*.h"
+            "qrcode/utils/*.cpp")
+endif()
+
 if (WITH_SCANNER AND NOT Qt6_FOUND)
     file(GLOB SCANNER_FILES
             "qrcode/scanner/*.h"
@@ -87,6 +98,8 @@ if (WITH_SCANNER AND Qt6_FOUND)
 endif()
 
 list(APPEND SOURCE_FILES
+        ${UPDATER_FILES}
+        ${QRCODE_UTILS_FILES}
         ${SCANNER_FILES})
 
 set(EXECUTABLE_FLAG)
@@ -143,12 +156,12 @@ target_include_directories(feather PUBLIC
         ${QtWebSockets_INCLUDE_DIRS}
         ${LIBZIP_INCLUDE_DIRS}
         ${ZLIB_INCLUDE_DIRS}
-        ${ZBAR_INCLUDE_DIR}
         ${POLYSEED_INCLUDE_DIR}
 )
 
 if(WITH_SCANNER)
     target_include_directories(feather PUBLIC
+            ${ZBAR_INCLUDE_DIR}
             ${QtMultimedia_INCLUDE_DIRS}
             ${QtMultimediaWidgets_INCLUDE_DIRS}
     )
@@ -230,7 +243,6 @@ target_link_libraries(feather
         ringct
         ${Boost_LIBRARIES}
         ${OPENSSL_LIBRARIES}
-        ${CMAKE_DL_LIBS}
         ${EXTRA_LIBRARIES}
         Qt::Core
         Qt::Widgets
@@ -238,10 +250,8 @@ target_link_libraries(feather
         Qt::Network
         Qt::Svg
         Qt::WebSockets
-        openpgp
         Threads::Threads
         ${QRENCODE_LIBRARY}
-        ${ZBAR_LIBRARIES}
         ${POLYSEED_LIBRARY}
         SingleApplication::SingleApplication
         ${ICU_LIBRARIES}
@@ -249,6 +259,10 @@ target_link_libraries(feather
         ${ZLIB_LIBRARIES}
 )
 
+if(CHECK_UPDATES)
+    target_link_libraries(feather openpgp)
+endif()
+
 if(DEPENDS)
     target_link_libraries(feather ${ICONV_LIBRARIES})
 endif()
@@ -263,6 +277,7 @@ endif()
 
 if (WITH_SCANNER)
     target_link_libraries(feather
+            ${ZBAR_LIBRARIES}
             Qt::Multimedia
             Qt::MultimediaWidgets
     )
index 899cea52a8d63ec84d685cc8449a033f79f6c136..d5cb903e7c08c3605d3df516bcc61aa0d61462ef 100644 (file)
@@ -21,7 +21,6 @@
 #include "dialog/ViewOnlyDialog.h"
 #include "dialog/WalletInfoDialog.h"
 #include "dialog/WalletCacheDebugDialog.h"
-#include "dialog/UpdateDialog.h"
 #include "libwalletqt/AddressBook.h"
 #include "libwalletqt/CoinsInfo.h"
 #include "libwalletqt/Transfer.h"
 #include "utils/Icons.h"
 #include "utils/SemanticVersion.h"
 #include "utils/TorManager.h"
-#include "utils/Updater.h"
 #include "utils/WebsocketNotifier.h"
 
+#ifdef CHECK_UPDATES
+#include "utils/updater/UpdateDialog.h"
+#endif
 //#include "misc_log_ex.h"
 
 MainWindow::MainWindow(WindowManager *windowManager, Wallet *wallet, QWidget *parent)
@@ -55,7 +56,9 @@ MainWindow::MainWindow(WindowManager *windowManager, Wallet *wallet, QWidget *pa
     m_splashDialog = new SplashDialog(this);
     m_accountSwitcherDialog = new AccountSwitcherDialog(m_wallet, this);
 
+#ifdef CHECK_UPDATES
     m_updater = QSharedPointer<Updater>(new Updater(this));
+#endif
 
     this->restoreGeo();
 
@@ -70,7 +73,9 @@ MainWindow::MainWindow(WindowManager *windowManager, Wallet *wallet, QWidget *pa
     connect(websocketNotifier(), &WebsocketNotifier::BountyReceived, ui->bountiesWidget->model(), &BountiesModel::updateBounties);
     connect(websocketNotifier(), &WebsocketNotifier::RedditReceived, ui->redditWidget->model(), &RedditModel::updatePosts);
     connect(websocketNotifier(), &WebsocketNotifier::RevuoReceived, ui->revuoWidget, &RevuoWidget::updateItems);
+#ifdef CHECK_UPDATES
     connect(websocketNotifier(), &WebsocketNotifier::UpdatesReceived, m_updater.data(), &Updater::wsUpdatesReceived);
+#endif
 #ifdef HAS_XMRIG
     connect(websocketNotifier(), &WebsocketNotifier::XMRigDownloadsReceived, m_xmrig, &XMRigWidget::onDownloads);
 #endif
@@ -86,7 +91,9 @@ MainWindow::MainWindow(WindowManager *windowManager, Wallet *wallet, QWidget *pa
     connect(torManager(), &TorManager::connectionStateChanged, this, &MainWindow::onTorConnectionStateChanged);
     this->onTorConnectionStateChanged(torManager()->torConnected);
 
+#ifdef CHECK_UPDATES
     connect(m_updater.data(), &Updater::updateAvailable, this, &MainWindow::showUpdateNotification);
+#endif
 
     ColorScheme::updateFromWidget(this);
     QTimer::singleShot(1, [this]{this->updateWidgetIcons();});
@@ -1402,9 +1409,11 @@ void MainWindow::onHideUpdateNotifications(bool hidden) {
     if (hidden) {
         m_statusUpdateAvailable->hide();
     }
+#ifdef CHECK_UPDATES
     else if (m_updater->state == Updater::State::UPDATE_AVAILABLE) {
         m_statusUpdateAvailable->show();
     }
+#endif
 }
 
 void MainWindow::onTorConnectionStateChanged(bool connected) {
@@ -1419,6 +1428,7 @@ void MainWindow::onTorConnectionStateChanged(bool connected) {
 }
 
 void MainWindow::showUpdateNotification() {
+#ifdef CHECK_UPDATES
     if (config()->get(Config::hideUpdateNotifications).toBool()) {
         return;
     }
@@ -1432,12 +1442,15 @@ void MainWindow::showUpdateNotification() {
 
     m_statusUpdateAvailable->disconnect();
     connect(m_statusUpdateAvailable, &StatusBarButton::clicked, this, &MainWindow::showUpdateDialog);
+#endif
 }
 
 void MainWindow::showUpdateDialog() {
+#ifdef CHECK_UPDATES
     UpdateDialog updateDialog{this, m_updater};
     connect(&updateDialog, &UpdateDialog::restartWallet, m_windowManager, &WindowManager::restartApplication);
     updateDialog.exec();
+#endif
 }
 
 void MainWindow::onInitiateTransaction() {
index ca51f86d88d608386eb32fc2433b57533fbda4a4..f05000f904368660c2a8c8c197f19e9489e362ca 100644 (file)
@@ -31,7 +31,6 @@
 #include "utils/config.h"
 #include "utils/daemonrpc.h"
 #include "utils/EventFilter.h"
-#include "utils/Updater.h"
 #include "plugins/ccs/CCSWidget.h"
 #include "plugins/reddit/RedditWidget.h"
 #include "widgets/TickerWidget.h"
 
 #include "WindowManager.h"
 
+#ifdef CHECK_UPDATES
+#include "utils/updater/Updater.h"
+#endif
+
 #ifdef HAS_LOCALMONERO
 #include "plugins/localmonero/LocalMoneroWidget.h"
 #endif
@@ -294,7 +297,9 @@ private:
     EventFilter *m_eventFilter = nullptr;
     qint64 m_userLastActive = QDateTime::currentSecsSinceEpoch();
 
+#ifdef CHECK_UPDATES
     QSharedPointer<Updater> m_updater = nullptr;
+#endif
 };
 
 #endif // FEATHER_MAINWINDOW_H
similarity index 99%
rename from src/dialog/UpdateDialog.cpp
rename to src/utils/updater/UpdateDialog.cpp
index e11b5a06750a3d9e21fe387069f7e6501a027c44..da09d1902ac09b2fdcf1aa8e6f92e381fc7299a2 100644 (file)
@@ -10,7 +10,7 @@
 #include "utils/AsyncTask.h"
 #include "utils/Networking.h"
 #include "utils/NetworkManager.h"
-#include "utils/Updater.h"
+#include "utils/updater/Updater.h"
 #include "utils/Utils.h"
 #include "utils/SemanticVersion.h"
 
similarity index 97%
rename from src/dialog/UpdateDialog.h
rename to src/utils/updater/UpdateDialog.h
index 37791313a3d26706ed3538fe995ee9d412038162..bb06660f965003f7cfa1ab02758778a34ee82da1 100644 (file)
@@ -8,7 +8,7 @@
 #include <QNetworkReply>
 #include <QTimer>
 
-#include "utils/Updater.h"
+#include "utils/updater/Updater.h"
 
 namespace Ui {
     class UpdateDialog;
index 1e095eca78d923aa02c9018b09a0b82a5bc3ca6f..104144a89ec92f76c4e6a32c248acdaeb403b7e3 100644 (file)
 #include <QScrollBar>
 
 #include "libwalletqt/WalletManager.h"
-#include "qrcode/QrCodeUtils.h"
 #include "utils/Utils.h"
 
+#if defined(WITH_SCANNER)
+#include "qrcode/utils/QrCodeUtils.h"
+#endif
+
 PayToEdit::PayToEdit(QWidget *parent) : QPlainTextEdit(parent)
 {
     this->setFont(Utils::getMonospaceFont());
@@ -108,10 +111,12 @@ void PayToEdit::pasteEvent(const QMimeData *mimeData) {
         return;
     }
 
+#if defined(WITH_SCANNER)
     image.convertTo(QImage::Format_RGB32);
     QString result = QrCodeUtils::scanImage(image);
 
     dataPasted(result);
+#endif
 }
 
 void PayToEdit::checkText() {