mirror of
https://github.com/status-im/qzxing.git
synced 2025-01-11 11:34:35 +00:00
QQrDecoder example updated to Qt5
This commit is contained in:
parent
85d82f5903
commit
13720010fc
@ -41,7 +41,9 @@
|
||||
#include "QCameraControllerWidget.h"
|
||||
//#include <QDebug>
|
||||
#include <QCameraFlashControl>
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QMessageBox>
|
||||
#include <QStandardPaths>
|
||||
|
||||
/*****************************************************************************
|
||||
* QCameraControllerWidget
|
||||
@ -125,11 +127,17 @@ QCameraControllerWidget::QCameraControllerWidget(QWidget *parent) :
|
||||
|
||||
setLayout(hboxl);
|
||||
|
||||
QStringList list = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation);
|
||||
if(list.isEmpty())
|
||||
imagePath = qApp->applicationDirPath();
|
||||
else
|
||||
imagePath = list.at(0);
|
||||
|
||||
fileWatcher = new QFileSystemWatcher();
|
||||
fileWatcher->addPath(QDesktopServices::storageLocation(QDesktopServices::PicturesLocation));
|
||||
fileWatcher->addPath(imagePath);
|
||||
connect(fileWatcher, SIGNAL( directoryChanged (const QString &)), this, SLOT(deleteImage(const QString &)));
|
||||
|
||||
imageFolder = QDir(QDesktopServices::storageLocation(QDesktopServices::PicturesLocation));
|
||||
imageFolder = QDir(imagePath);
|
||||
QStringList filters;
|
||||
filters << "camera*";
|
||||
imageFolder.setNameFilters(filters);
|
||||
@ -280,6 +288,7 @@ void QCameraControllerWidget::captureImage()
|
||||
|
||||
void QCameraControllerWidget::onImageCaptured(int id, const QImage &preview)
|
||||
{
|
||||
Q_UNUSED(id);
|
||||
// m_stillImageCapture->cancelCapture();
|
||||
// showViewFinder = false;
|
||||
m_focusing = false;
|
||||
@ -291,6 +300,7 @@ void QCameraControllerWidget::onImageCaptured(int id, const QImage &preview)
|
||||
|
||||
void QCameraControllerWidget::deleteImage(const QString & folderPath)
|
||||
{
|
||||
Q_UNUSED(folderPath);
|
||||
//qdebug() << "Detected change to folder: " << folderPath;
|
||||
QStringList files = imageFolder.entryList(imageFolder.nameFilters());
|
||||
|
||||
@ -300,8 +310,7 @@ void QCameraControllerWidget::deleteImage(const QString & folderPath)
|
||||
//qdebug() << "Checking file: " << image;
|
||||
if(image.startsWith("camera"))
|
||||
{
|
||||
QString path(QDesktopServices::storageLocation(QDesktopServices::PicturesLocation));
|
||||
QDir pathDir(path);
|
||||
QDir pathDir(imagePath);
|
||||
pathDir.remove(image);
|
||||
//qdebug() << "file deleted: " << image;
|
||||
|
||||
@ -354,6 +363,7 @@ void QCameraControllerWidget::updateVideo()
|
||||
|
||||
void QCameraControllerWidget::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
//QMainWindow::paintEvent(event);
|
||||
|
||||
QPainter painter(this);
|
||||
|
@ -58,7 +58,7 @@
|
||||
|
||||
#include "myvideosurface.h"
|
||||
#include "button.h"
|
||||
|
||||
#include <QStackedWidget>
|
||||
|
||||
class QCameraControllerWidget: public QWidget, public VideoIF
|
||||
{
|
||||
@ -117,6 +117,7 @@ private:
|
||||
QCameraFocus* cameraFocus;
|
||||
QFileSystemWatcher* fileWatcher;
|
||||
QDir imageFolder;
|
||||
QString imagePath;
|
||||
};
|
||||
|
||||
#endif // QCAMERA_H
|
||||
|
@ -31,7 +31,7 @@
|
||||
#ifndef QQRDECODER_H
|
||||
#define QQRDECODER_H
|
||||
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QMainWindow>
|
||||
#include <QPixmap>
|
||||
#include "ui_QQrDecoder.h"
|
||||
#include <qzxing.h>
|
||||
|
@ -1,15 +1,9 @@
|
||||
TEMPLATE = app
|
||||
TARGET = QQrDecoder
|
||||
QT += core \
|
||||
gui \
|
||||
declarative
|
||||
QT += core gui multimedia widgets
|
||||
|
||||
VERSION = 2.0.0
|
||||
|
||||
CONFIG += mobility
|
||||
MOBILITY = multimedia #\
|
||||
#systeminfo
|
||||
|
||||
RESOURCES += resources.qrc
|
||||
|
||||
include(../../source/QZXing.pri)
|
||||
|
@ -46,7 +46,6 @@
|
||||
Button::Button(QWidget *parent, Qt::WindowFlags f) :
|
||||
QLabel(parent, f)
|
||||
{
|
||||
m_downPixmap = 0;
|
||||
m_disabled = false;
|
||||
m_toggled = false;
|
||||
m_toggle_enabled = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user