mirror of
https://github.com/wownero/wowlet.git
synced 2026-11-21 15:44:10 +01:00
build: fix -DWITH_SCANNER=Off
This commit is contained in:
@@ -1,96 +0,0 @@
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
// SPDX-FileCopyrightText: 2020-2023 The Monero Project
|
||||
|
||||
#include "URDialog.h"
|
||||
#include "ui_URDialog.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QInputDialog>
|
||||
|
||||
#include "utils/Utils.h"
|
||||
#include "WalletManager.h"
|
||||
|
||||
URDialog::URDialog(QWidget *parent)
|
||||
: WindowModalDialog(parent)
|
||||
, ui(new Ui::URDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
connect(ui->btn_loadFile, &QPushButton::clicked, [this]{
|
||||
QString fn = QFileDialog::getOpenFileName(this, "Load file", QDir::homePath(), "All Files (*)");
|
||||
if (fn.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QFile file(fn);
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
return;
|
||||
}
|
||||
|
||||
QByteArray qdata = file.readAll();
|
||||
std::string data = qdata.toStdString();
|
||||
file.close();
|
||||
|
||||
ui->widgetUR->setData("any", data);
|
||||
});
|
||||
|
||||
connect(ui->btn_loadClipboard, &QPushButton::clicked, [this]{
|
||||
QString qdata = Utils::copyFromClipboard();
|
||||
if (qdata.length() < 10) {
|
||||
Utils::showError(this, "Not enough data on clipboard to encode as UR");
|
||||
return;
|
||||
}
|
||||
|
||||
std::string data = qdata.toStdString();
|
||||
|
||||
ui->widgetUR->setData("any", data);
|
||||
});
|
||||
|
||||
connect(ui->tabWidget, &QTabWidget::currentChanged, [this](int index){
|
||||
if (index == 1) {
|
||||
ui->widgetScanner->startCapture(true);
|
||||
}
|
||||
});
|
||||
|
||||
connect(ui->widgetScanner, &QrCodeScanWidget::finished, [this](bool success){
|
||||
if (!success) {
|
||||
Utils::showError(this, "Unable to scan UR");
|
||||
ui->widgetScanner->reset();
|
||||
return;
|
||||
}
|
||||
|
||||
if (ui->radio_clipboard->isChecked()) {
|
||||
Utils::copyToClipboard(QString::fromStdString(ui->widgetScanner->getURData()));
|
||||
Utils::showInfo(this, "Data copied to clipboard");
|
||||
}
|
||||
else if (ui->radio_file->isChecked()) {
|
||||
QString fn = QFileDialog::getSaveFileName(this, "Save to file", QDir::homePath(), "ur_data");
|
||||
if (fn.isEmpty()) {
|
||||
ui->widgetScanner->reset();
|
||||
return;
|
||||
}
|
||||
|
||||
QFile file{fn};
|
||||
if (!file.open(QIODevice::WriteOnly)) {
|
||||
Utils::showError(this, "Failed to save file", QString("Could not open file %1 for writing").arg(fn));
|
||||
ui->widgetScanner->reset();
|
||||
return;
|
||||
}
|
||||
|
||||
std::string data = ui->widgetScanner->getURData();
|
||||
file.write(data.data(), data.size());
|
||||
file.close();
|
||||
|
||||
Utils::showInfo(this, "Successfully saved data to file");
|
||||
}
|
||||
|
||||
ui->widgetScanner->reset();
|
||||
});
|
||||
|
||||
ui->radio_file->setChecked(true);
|
||||
ui->tabWidget->setCurrentIndex(0);
|
||||
|
||||
this->resize(600, 700);
|
||||
}
|
||||
|
||||
URDialog::~URDialog() = default;
|
||||
@@ -1,28 +0,0 @@
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
// SPDX-FileCopyrightText: 2020-2023 The Monero Project
|
||||
|
||||
#ifndef FEATHER_URDIALOG_H
|
||||
#define FEATHER_URDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include "components.h"
|
||||
|
||||
namespace Ui {
|
||||
class URDialog;
|
||||
}
|
||||
|
||||
class URDialog : public WindowModalDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit URDialog(QWidget *parent);
|
||||
~URDialog() override;
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::URDialog> ui;
|
||||
};
|
||||
|
||||
|
||||
#endif //FEATHER_URDIALOG_H
|
||||
@@ -1,157 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>URDialog</class>
|
||||
<widget class="QDialog" name="URDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>788</width>
|
||||
<height>703</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Transmit UR</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tabSend">
|
||||
<attribute name="title">
|
||||
<string>Send</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="URWidget" name="widgetUR" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_loadFile">
|
||||
<property name="text">
|
||||
<string>Load file</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_loadClipboard">
|
||||
<property name="text">
|
||||
<string>Load from clipboard</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabReceive">
|
||||
<attribute name="title">
|
||||
<string>Receive</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QrCodeScanWidget" name="widgetScanner" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radio_clipboard">
|
||||
<property name="text">
|
||||
<string>Copy to clipboard</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radio_file">
|
||||
<property name="text">
|
||||
<string>Save to file</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QrCodeScanWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>qrcode/scanner/QrCodeScanWidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>URWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>widgets/URWidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>URDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>URDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user