mirror of
https://github.com/feather-wallet/feather.git
synced 2025-03-21 06:28:55 +00:00
Send: don't open QrCodeScanDialog if no available cameras
This commit is contained in:
parent
a88425eb60
commit
1816abc150
2 changed files with 7 additions and 5 deletions
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
#ifdef WITH_SCANNER
|
#ifdef WITH_SCANNER
|
||||||
#include "qrcode_scanner/QrCodeScanDialog.h"
|
#include "qrcode_scanner/QrCodeScanDialog.h"
|
||||||
|
#include <QtMultimedia/QCameraInfo>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SendWidget::SendWidget(QSharedPointer<AppContext> ctx, QWidget *parent)
|
SendWidget::SendWidget(QSharedPointer<AppContext> ctx, QWidget *parent)
|
||||||
|
@ -112,6 +113,12 @@ void SendWidget::fillAddress(const QString &address) {
|
||||||
|
|
||||||
void SendWidget::scanClicked() {
|
void SendWidget::scanClicked() {
|
||||||
#ifdef WITH_SCANNER
|
#ifdef WITH_SCANNER
|
||||||
|
auto cameras = QCameraInfo::availableCameras();
|
||||||
|
if (cameras.count() < 1) {
|
||||||
|
QMessageBox::warning(this, "QR code scanner", "No available cameras found.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto *dialog = new QrCodeScanDialog(this);
|
auto *dialog = new QrCodeScanDialog(this);
|
||||||
dialog->exec();
|
dialog->exec();
|
||||||
ui->lineAddress->setText(dialog->decodedString);
|
ui->lineAddress->setText(dialog->decodedString);
|
||||||
|
|
|
@ -19,11 +19,6 @@ QrCodeScanDialog::QrCodeScanDialog(QWidget *parent)
|
||||||
ui->icon_warning->setPixmap(pixmap.scaledToWidth(32, Qt::SmoothTransformation));
|
ui->icon_warning->setPixmap(pixmap.scaledToWidth(32, Qt::SmoothTransformation));
|
||||||
|
|
||||||
m_cameras = QCameraInfo::availableCameras();
|
m_cameras = QCameraInfo::availableCameras();
|
||||||
if (m_cameras.count() < 1) {
|
|
||||||
QMessageBox::warning(parent, "QR code scanner", "No available cameras found.");
|
|
||||||
this->close();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const auto &camera : m_cameras) {
|
for (const auto &camera : m_cameras) {
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
|
Loading…
Reference in a new issue