]> Nutra Git (v2) - gamesguru/feather.git/commitdiff
build: fix -DWITH_SCANNER=Off
authortobtoht <tob@featherwallet.org>
Sat, 30 Dec 2023 19:29:17 +0000 (20:29 +0100)
committertobtoht <tob@featherwallet.org>
Sat, 30 Dec 2023 19:30:30 +0000 (20:30 +0100)
12 files changed:
CMakeLists.txt
src/MainWindow.cpp
src/dialog/ViewOnlyDialog.cpp
src/qrcode/scanner/URDialog.cpp [moved from src/dialog/URDialog.cpp with 100% similarity]
src/qrcode/scanner/URDialog.h [moved from src/dialog/URDialog.h with 100% similarity]
src/qrcode/scanner/URDialog.ui [moved from src/dialog/URDialog.ui with 98% similarity]
src/qrcode/scanner/URWidget.cpp [moved from src/widgets/URWidget.cpp with 97% similarity]
src/qrcode/scanner/URWidget.h [moved from src/widgets/URWidget.h with 100% similarity]
src/qrcode/scanner/URWidget.ui [moved from src/widgets/URWidget.ui with 100% similarity]
src/wizard/PageWalletRestoreKeys.cpp
src/wizard/offline_tx_signing/OfflineTxSigningWizard.h
src/wizard/offline_tx_signing/PageOTS_Export.ui

index af35a3e205c9df1a3af89837318037c2cf1a3dd2..cc4d49fae6e6757572ef30c33c8c0c3080274942 100644 (file)
@@ -97,9 +97,11 @@ message(STATUS "libsodium: libraries at ${SODIUM_LIBRARY}")
 find_package(QREncode REQUIRED)
 
 # bc-ur
-find_path(BCUR_INCLUDE_DIR "bcur/bc-ur.hpp")
-find_library(BCUR_LIBRARY bcur)
-message(STATUS "bcur: libraries at ${BCUR_INCLUDE_DIR}")
+if(WITH_SCANNER)
+    find_path(BCUR_INCLUDE_DIR "bcur/bc-ur.hpp")
+    find_library(BCUR_LIBRARY bcur)
+    message(STATUS "bcur: libraries at ${BCUR_INCLUDE_DIR}")
+endif()
 
 # Polyseed
 find_package(Polyseed REQUIRED)
index 9d089a21b9a20e94c6a400a85037e22cad6d7b92..08e5904b1e1cf996423267eda6dbf68e8db9d67f 100644 (file)
@@ -38,7 +38,7 @@
 
 #ifdef WITH_SCANNER
 #include "wizard/offline_tx_signing/OfflineTxSigningWizard.h"
-#include "dialog/URDialog.h"
+#include "qrcode/scanner/URDialog.h"
 #endif
 
 #ifdef CHECK_UPDATES
@@ -423,7 +423,7 @@ void MainWindow::initOffline() {
     });
 
     switch (conf()->get(Config::offlineTxSigningMethod).toInt()) {
-        case OfflineTxSigningWizard::Method::FILES:
+        case Config::OTSMethod::FileTransfer:
             ui->radio_airgapFiles->setChecked(true);
             break;
         default:
@@ -440,12 +440,12 @@ void MainWindow::initOffline() {
 
     connect(ui->radio_airgapFiles, &QCheckBox::toggled, [this] (bool checked){
         if (checked) {
-            conf()->set(Config::offlineTxSigningMethod, OfflineTxSigningWizard::Method::FILES);
+            conf()->set(Config::offlineTxSigningMethod, Config::OTSMethod::FileTransfer);
         }
     });
     connect(ui->radio_airgapUR, &QCheckBox::toggled, [this](bool checked) {
         if (checked) {
-            conf()->set(Config::offlineTxSigningMethod, OfflineTxSigningWizard::Method::UR);
+            conf()->set(Config::offlineTxSigningMethod, Config::OTSMethod::UnifiedResources);
         }
     });
 }
@@ -1310,8 +1310,12 @@ void MainWindow::showAddressChecker() {
 }
 
 void MainWindow::showURDialog() {
+#ifdef WITH_SCANNER
     URDialog dialog{this};
     dialog.exec();
+#else
+    Utils::showError(this, "Unable to open UR dialog", "Feather was built without webcam scanner support");
+#endif
 }
 
 void MainWindow::loadSignedTx() {
index 9276c6820800cc430daae0d55fb0560bf2d318e6..72d806fb3ae2dc1fa06eae6bb977b20028f8a125 100644 (file)
@@ -5,10 +5,8 @@
 #include "ui_ViewOnlyDialog.h"
 
 #include <QFileDialog>
-#include <QInputDialog>
 #include <QMessageBox>
 
-#include "URDialog.h"
 #include "utils/Utils.h"
 #include "WalletManager.h"
 #include "qrcode/QrCode.h"
similarity index 98%
rename from src/dialog/URDialog.ui
rename to src/qrcode/scanner/URDialog.ui
index aca80b7bae52583ea4b1e35853ad02f1269efa01..0026507f2e07d2f968c06abfc27c02e5f79c3e92 100644 (file)
   <customwidget>
    <class>URWidget</class>
    <extends>QWidget</extends>
-   <header>widgets/URWidget.h</header>
+   <header>qrcode/scanner/URWidget.h</header>
    <container>1</container>
   </customwidget>
  </customwidgets>
similarity index 97%
rename from src/widgets/URWidget.cpp
rename to src/qrcode/scanner/URWidget.cpp
index da1adb0bb66ded46dfa6d7642c8ce5a6d216b66e..139ab1ea7ac1878ac5dfccd23a37fe223447632b 100644 (file)
@@ -4,9 +4,6 @@
 #include "URWidget.h"
 #include "ui_URWidget.h"
 
-#include <QDesktopServices>
-#include <QMenu>
-
 #include "dialog/URSettingsDialog.h"
 #include "utils/config.h"
 
index f22c98f86e8aea903733d9abbbc6c96c1e71c709..beb236a029a4d05ea481b743f6a0c377fb5c155b 100644 (file)
 
 #include "WalletWizard.h"
 #include "constants.h"
-#include "dialog/URDialog.h"
 #include "libwalletqt/WalletManager.h"
+
+#ifdef WITH_SCANNER
 #include "scanner/QrCodeScanDialog.h"
+#endif
 
 PageWalletRestoreKeys::PageWalletRestoreKeys(WizardFields *fields, QWidget *parent)
     : QWizardPage(parent)
@@ -43,6 +45,8 @@ PageWalletRestoreKeys::PageWalletRestoreKeys(WizardFields *fields, QWidget *pare
 
     connect(ui->btnOptions, &QPushButton::clicked, this, &PageWalletRestoreKeys::onOptionsClicked);
     connect(ui->combo_walletType, &QComboBox::currentTextChanged, this, &PageWalletRestoreKeys::showInputLines);
+
+#ifdef WITH_SCANNER
     connect(ui->btn_scanUR, &QPushButton::clicked, [this] {
         QrCodeScanDialog dialog{this, false};
         dialog.exec();
@@ -66,6 +70,10 @@ PageWalletRestoreKeys::PageWalletRestoreKeys(WizardFields *fields, QWidget *pare
         m_fields->restoreHeight = doc["restoreHeight"].toInt();
         m_fields->walletName = doc["walletName"].toString() + "_view_only";
     });
+#else
+    ui->btn_scanUR->setEnabled(false);
+    ui->btn_scanUR->setToolTip("Can't scan QR code: Feather was built without webcam scanner support.");
+#endif
 }
 
 void PageWalletRestoreKeys::initializePage() {
index b3f72b0c88e68bc854adffe0dd295a186cb113b5..1523c504606a55e7ed800802e5365e13c34f4f2b 100644 (file)
@@ -37,11 +37,6 @@ public:
         Page_ImportOffline
     };
 
-    enum Method {
-        UR = 0,
-        FILES,
-    };
-    
     explicit OfflineTxSigningWizard(QWidget *parent, Wallet *wallet, PendingTransaction *tx = nullptr);
     ~OfflineTxSigningWizard() override;
 
index 1a33ad5f55e902fde3d8532864c9d7e83f1c03dd..d506e78472043b14491edfe1e9786e4cf5c1e215 100644 (file)
   <customwidget>
    <class>URWidget</class>
    <extends>QWidget</extends>
-   <header>widgets/URWidget.h</header>
+   <header>qrcode/scanner/URWidget.h</header>
    <container>1</container>
   </customwidget>
  </customwidgets>