build: fix -DWITH_SCANNER=Off

This commit is contained in:
tobtoht 2023-12-30 20:29:17 +01:00
parent 0ba22ea05b
commit dcbf24c5b0
No known key found for this signature in database
GPG key ID: E45B10DD027D2472
12 changed files with 24 additions and 20 deletions

View 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)

View 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() {

View 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"

View file

@ -115,7 +115,7 @@
<customwidget>
<class>URWidget</class>
<extends>QWidget</extends>
<header>widgets/URWidget.h</header>
<header>qrcode/scanner/URWidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>

View file

@ -4,9 +4,6 @@
#include "URWidget.h"
#include "ui_URWidget.h"
#include <QDesktopServices>
#include <QMenu>
#include "dialog/URSettingsDialog.h"
#include "utils/config.h"

View file

@ -11,9 +11,11 @@
#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() {

View file

@ -37,11 +37,6 @@ public:
Page_ImportOffline
};
enum Method {
UR = 0,
FILES,
};
explicit OfflineTxSigningWizard(QWidget *parent, Wallet *wallet, PendingTransaction *tx = nullptr);
~OfflineTxSigningWizard() override;

View file

@ -114,7 +114,7 @@
<customwidget>
<class>URWidget</class>
<extends>QWidget</extends>
<header>widgets/URWidget.h</header>
<header>qrcode/scanner/URWidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>