Skip to content

Commit

Permalink
Added QR icon back
Browse files Browse the repository at this point in the history
  • Loading branch information
fdennis committed Sep 17, 2020
1 parent af47aa4 commit 39f0081
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
13 changes: 1 addition & 12 deletions qml/NewCredentialView.qml
Expand Up @@ -141,7 +141,6 @@ Flickable {

function scanQr(data) {
scanning = true
console.log(data)
yubiKey.parseQr(data, function (resp) {
scanning = false
if (resp.success) {
Expand All @@ -153,17 +152,6 @@ Flickable {
})
}

FileDialog {
id: dialog
title: "Dump logs to file"
onAccepted: {
fileName = file.toString()
fileName = fileName.replace(/^(file:\/{3})/,"")
console.log(fileName)
navigator.snackBar(ScreenShot.capture(fileName))
}
}

function addCredentialNoCopy() {
addCredential(true)
}
Expand Down Expand Up @@ -244,6 +232,7 @@ Flickable {

StyledImage {
id: qrImage
source: "../images/qr-monitor.svg"
color: primaryColor
opacity: lowEmphasis
iconWidth: 100
Expand Down
7 changes: 3 additions & 4 deletions screenshot.h
Expand Up @@ -25,22 +25,21 @@ class ScreenShot: public QObject
decoder.setSourceFilterType(QZXing::SourceFilter_ImageNormal);
decoder.setTryHarderBehaviour(QZXing::TryHarderBehaviour_ThoroughScanning | QZXing::TryHarderBehaviour_Rotate);

//trigger decode
QString result;
if (fileName == "") {
if (fileName == "") { // If user scans the screen
std::vector<double> scalefactor = {1, 1.25, 1.5, 2, 3, 0.85, 0.70, 0.50};
QImage newimage;
for (size_t i = 0; i < screenshots.size(); i++) {
QImage image(screenshots[i]);
for (double j : scalefactor) {
newimage = image.scaledToWidth(image.width() * j);
result = decoder.decodeImage(newimage, newimage.width(), newimage.height(), false);
if (result != "") {
if (result.contains("otpauth")) {
return result;
}
}
}
} else {
} else { // If user drag n drops a code
QImage image(fileName);
result = decoder.decodeImage(image, image.width(), image.height(), false);
}
Expand Down

0 comments on commit 39f0081

Please sign in to comment.