Commit 0978a74dc966758277843ef99dc616970543d683
1 parent
367ec95d
Fixed GUI bug
Showing
4 changed files
with
20 additions
and
14 deletions
openbr/gui/imageviewer.cpp
| @@ -24,7 +24,8 @@ | @@ -24,7 +24,8 @@ | ||
| 24 | 24 | ||
| 25 | /*** PUBLIC ***/ | 25 | /*** PUBLIC ***/ |
| 26 | br::ImageViewer::ImageViewer(QWidget *parent) | 26 | br::ImageViewer::ImageViewer(QWidget *parent) |
| 27 | - : QLabel(parent) | 27 | + : QLabel(parent), |
| 28 | + mutex(QMutex::Recursive) | ||
| 28 | { | 29 | { |
| 29 | setAlignment(Qt::AlignCenter); | 30 | setAlignment(Qt::AlignCenter); |
| 30 | setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); | 31 | setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); |
| @@ -40,38 +41,39 @@ void br::ImageViewer::setImage(const QString &file, bool async) | @@ -40,38 +41,39 @@ void br::ImageViewer::setImage(const QString &file, bool async) | ||
| 40 | QMutexLocker locker(&mutex); | 41 | QMutexLocker locker(&mutex); |
| 41 | if(file.isNull()) src = QImage(); // Gets rid of runtime FileEngine::open warning | 42 | if(file.isNull()) src = QImage(); // Gets rid of runtime FileEngine::open warning |
| 42 | else src = QImage(file); | 43 | else src = QImage(file); |
| 43 | - updatePixmap(async); | 44 | + updatePixmap(src, async); |
| 44 | } | 45 | } |
| 45 | 46 | ||
| 46 | void br::ImageViewer::setImage(const QImage &image, bool async) | 47 | void br::ImageViewer::setImage(const QImage &image, bool async) |
| 47 | { | 48 | { |
| 48 | QMutexLocker locker(&mutex); | 49 | QMutexLocker locker(&mutex); |
| 49 | src = image.copy(); | 50 | src = image.copy(); |
| 50 | - updatePixmap(async); | 51 | + updatePixmap(src, async); |
| 51 | } | 52 | } |
| 52 | 53 | ||
| 53 | void br::ImageViewer::setImage(const QPixmap &pixmap, bool async) | 54 | void br::ImageViewer::setImage(const QPixmap &pixmap, bool async) |
| 54 | { | 55 | { |
| 55 | QMutexLocker locker(&mutex); | 56 | QMutexLocker locker(&mutex); |
| 56 | src = pixmap.toImage(); | 57 | src = pixmap.toImage(); |
| 57 | - updatePixmap(async); | 58 | + updatePixmap(src, async); |
| 58 | } | 59 | } |
| 59 | 60 | ||
| 60 | /*** PRIVATE ***/ | 61 | /*** PRIVATE ***/ |
| 61 | -void br::ImageViewer::updatePixmap(bool async) | 62 | +void br::ImageViewer::updatePixmap(QImage image, bool async) |
| 62 | { | 63 | { |
| 64 | + // For the time being, disabling this is sufficient | ||
| 63 | if (async) { | 65 | if (async) { |
| 64 | - QTimer::singleShot(0, this, SLOT(updatePixmap())); | ||
| 65 | - return; | 66 | + //QTimer::singleShot(0, this, SLOT(updatePixmap(image))); |
| 67 | + //return; | ||
| 66 | } | 68 | } |
| 67 | 69 | ||
| 68 | - QMutexLocker locker(&mutex); | ||
| 69 | - if (src.isNull() || size().isNull()) { | 70 | + QMutexLocker locker(&mutex); |
| 71 | + if (image.isNull() || size().isNull()) { | ||
| 70 | QLabel::setPixmap(QPixmap()); | 72 | QLabel::setPixmap(QPixmap()); |
| 71 | QLabel::setText(defaultText); | 73 | QLabel::setText(defaultText); |
| 72 | } else { | 74 | } else { |
| 73 | QLabel::clear(); | 75 | QLabel::clear(); |
| 74 | - QLabel::setPixmap(QPixmap::fromImage(src.scaled(size(), Qt::KeepAspectRatio))); | 76 | + QLabel::setPixmap(QPixmap::fromImage(image.scaled(size(), Qt::KeepAspectRatio))); |
| 75 | } | 77 | } |
| 76 | } | 78 | } |
| 77 | 79 | ||
| @@ -98,5 +100,5 @@ void br::ImageViewer::resizeEvent(QResizeEvent *event) | @@ -98,5 +100,5 @@ void br::ImageViewer::resizeEvent(QResizeEvent *event) | ||
| 98 | { | 100 | { |
| 99 | QLabel::resizeEvent(event); | 101 | QLabel::resizeEvent(event); |
| 100 | event->accept(); | 102 | event->accept(); |
| 101 | - updatePixmap(); | 103 | + updatePixmap(src); |
| 102 | } | 104 | } |
openbr/gui/imageviewer.h
| @@ -56,7 +56,7 @@ protected slots: | @@ -56,7 +56,7 @@ protected slots: | ||
| 56 | void resizeEvent(QResizeEvent *event); | 56 | void resizeEvent(QResizeEvent *event); |
| 57 | 57 | ||
| 58 | private slots: | 58 | private slots: |
| 59 | - void updatePixmap(bool async = false); | 59 | + void updatePixmap(QImage image, bool async = false); |
| 60 | }; | 60 | }; |
| 61 | 61 | ||
| 62 | } // namespace br | 62 | } // namespace br |
openbr/plugins/format.cpp
| @@ -654,7 +654,7 @@ class xmlFormat : public Format | @@ -654,7 +654,7 @@ class xmlFormat : public Format | ||
| 654 | Template t; | 654 | Template t; |
| 655 | 655 | ||
| 656 | #ifndef BR_EMBEDDED | 656 | #ifndef BR_EMBEDDED |
| 657 | - QString fileName = file.get<QString>("path") + "/" + file.name; | 657 | + QString fileName = file.get<QString>("path") + file.name; |
| 658 | 658 | ||
| 659 | QDomDocument doc(fileName); | 659 | QDomDocument doc(fileName); |
| 660 | QFile f(fileName); | 660 | QFile f(fileName); |
share/openbr/cmake/InstallDependencies.cmake
| @@ -72,7 +72,11 @@ function(install_qt_misc) | @@ -72,7 +72,11 @@ function(install_qt_misc) | ||
| 72 | endif() | 72 | endif() |
| 73 | install(FILES ${_qt5Core_install_prefix}/bin/libGLESv2${BR_INSTALL_DEPENDENCIES_SUFFIX}.dll DESTINATION bin) | 73 | install(FILES ${_qt5Core_install_prefix}/bin/libGLESv2${BR_INSTALL_DEPENDENCIES_SUFFIX}.dll DESTINATION bin) |
| 74 | install(FILES ${_qt5Core_install_prefix}/bin/libEGL${BR_INSTALL_DEPENDENCIES_SUFFIX}.dll DESTINATION bin) | 74 | install(FILES ${_qt5Core_install_prefix}/bin/libEGL${BR_INSTALL_DEPENDENCIES_SUFFIX}.dll DESTINATION bin) |
| 75 | - # install(FILES ${_qt5Core_install_prefix}/bin/icuin49${BR_INSTALL_DEPENDENCIES_SUFFIX}.dll DESTINATION bin) | 75 | + install(FILES ${_qt5Core_install_prefix}/bin/icuin49${BR_INSTALL_DEPENDENCIES_SUFFIX}.dll DESTINATION bin) |
| 76 | + install(FILES ${_qt5Core_install_prefix}/bin/icuuc49${BR_INSTALL_DEPENDENCIES_SUFFIX}.dll DESTINATION bin) | ||
| 77 | + install(FILES ${_qt5Core_install_prefix}/bin/icudt49.dll DESTINATION bin) | ||
| 78 | + install(FILES ${_qt5Core_install_prefix}/bin/d3dcompiler_46.dll DESTINATION bin) | ||
| 79 | + install(FILES ${_qt5Core_install_prefix}/plugins/platforms/qwindows${BR_INSTALL_DEPENDENCIES_SUFFIX}.dll DESTINATION bin/platforms) | ||
| 76 | endif() | 80 | endif() |
| 77 | endfunction() | 81 | endfunction() |
| 78 | 82 |