mirror of
https://github.com/wownero/wowlet.git
synced 2026-10-17 15:21:30 +02:00
Enable webcam QR scanner
This commit is contained in:
@@ -14,6 +14,9 @@
|
||||
#if defined(WITH_SCANNER) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
#include "qrcode_scanner/QrCodeScanDialog.h"
|
||||
#include <QtMultimedia/QCameraInfo>
|
||||
#elif defined(WITH_SCANNER)
|
||||
#include "qrcode_scanner_qt6/QrCodeScanDialog.h"
|
||||
#include <QMediaDevices>
|
||||
#endif
|
||||
|
||||
SendWidget::SendWidget(QSharedPointer<AppContext> ctx, QWidget *parent)
|
||||
@@ -123,6 +126,17 @@ void SendWidget::scanClicked() {
|
||||
dialog->exec();
|
||||
ui->lineAddress->setText(dialog->decodedString);
|
||||
dialog->deleteLater();
|
||||
#elif defined(WITH_SCANNER)
|
||||
auto cameras = QMediaDevices::videoInputs();
|
||||
if (cameras.empty()) {
|
||||
QMessageBox::warning(this, "QR code scanner", "No available cameras found.");
|
||||
return;
|
||||
}
|
||||
|
||||
auto dialog = new QrCodeScanDialog(this);
|
||||
dialog->exec();
|
||||
ui->lineAddress->setText(dialog->decodedString);
|
||||
dialog->deleteLater();
|
||||
#else
|
||||
QMessageBox::warning(this, "QR scanner", "Feather was built without webcam QR scanner support.");
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user