From 0978a74dc966758277843ef99dc616970543d683 Mon Sep 17 00:00:00 2001 From: Scott Klum Date: Tue, 11 Jun 2013 10:33:33 -0400 Subject: [PATCH] Fixed GUI bug --- openbr/gui/imageviewer.cpp | 24 +++++++++++++----------- openbr/gui/imageviewer.h | 2 +- openbr/plugins/format.cpp | 2 +- share/openbr/cmake/InstallDependencies.cmake | 6 +++++- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/openbr/gui/imageviewer.cpp b/openbr/gui/imageviewer.cpp index bd12452..c14bc5f 100644 --- a/openbr/gui/imageviewer.cpp +++ b/openbr/gui/imageviewer.cpp @@ -24,7 +24,8 @@ /*** PUBLIC ***/ br::ImageViewer::ImageViewer(QWidget *parent) - : QLabel(parent) + : QLabel(parent), + mutex(QMutex::Recursive) { setAlignment(Qt::AlignCenter); setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); @@ -40,38 +41,39 @@ void br::ImageViewer::setImage(const QString &file, bool async) QMutexLocker locker(&mutex); if(file.isNull()) src = QImage(); // Gets rid of runtime FileEngine::open warning else src = QImage(file); - updatePixmap(async); + updatePixmap(src, async); } void br::ImageViewer::setImage(const QImage &image, bool async) { QMutexLocker locker(&mutex); src = image.copy(); - updatePixmap(async); + updatePixmap(src, async); } void br::ImageViewer::setImage(const QPixmap &pixmap, bool async) { QMutexLocker locker(&mutex); src = pixmap.toImage(); - updatePixmap(async); + updatePixmap(src, async); } /*** PRIVATE ***/ -void br::ImageViewer::updatePixmap(bool async) +void br::ImageViewer::updatePixmap(QImage image, bool async) { + // For the time being, disabling this is sufficient if (async) { - QTimer::singleShot(0, this, SLOT(updatePixmap())); - return; + //QTimer::singleShot(0, this, SLOT(updatePixmap(image))); + //return; } - QMutexLocker locker(&mutex); - if (src.isNull() || size().isNull()) { + QMutexLocker locker(&mutex); + if (image.isNull() || size().isNull()) { QLabel::setPixmap(QPixmap()); QLabel::setText(defaultText); } else { QLabel::clear(); - QLabel::setPixmap(QPixmap::fromImage(src.scaled(size(), Qt::KeepAspectRatio))); + QLabel::setPixmap(QPixmap::fromImage(image.scaled(size(), Qt::KeepAspectRatio))); } } @@ -98,5 +100,5 @@ void br::ImageViewer::resizeEvent(QResizeEvent *event) { QLabel::resizeEvent(event); event->accept(); - updatePixmap(); + updatePixmap(src); } diff --git a/openbr/gui/imageviewer.h b/openbr/gui/imageviewer.h index 14f2071..e0467d2 100644 --- a/openbr/gui/imageviewer.h +++ b/openbr/gui/imageviewer.h @@ -56,7 +56,7 @@ protected slots: void resizeEvent(QResizeEvent *event); private slots: - void updatePixmap(bool async = false); + void updatePixmap(QImage image, bool async = false); }; } // namespace br diff --git a/openbr/plugins/format.cpp b/openbr/plugins/format.cpp index 2b3b04e..1dabd73 100644 --- a/openbr/plugins/format.cpp +++ b/openbr/plugins/format.cpp @@ -654,7 +654,7 @@ class xmlFormat : public Format Template t; #ifndef BR_EMBEDDED - QString fileName = file.get("path") + "/" + file.name; + QString fileName = file.get("path") + file.name; QDomDocument doc(fileName); QFile f(fileName); diff --git a/share/openbr/cmake/InstallDependencies.cmake b/share/openbr/cmake/InstallDependencies.cmake index fbcca17..3be973a 100644 --- a/share/openbr/cmake/InstallDependencies.cmake +++ b/share/openbr/cmake/InstallDependencies.cmake @@ -72,7 +72,11 @@ function(install_qt_misc) endif() install(FILES ${_qt5Core_install_prefix}/bin/libGLESv2${BR_INSTALL_DEPENDENCIES_SUFFIX}.dll DESTINATION bin) install(FILES ${_qt5Core_install_prefix}/bin/libEGL${BR_INSTALL_DEPENDENCIES_SUFFIX}.dll DESTINATION bin) - # install(FILES ${_qt5Core_install_prefix}/bin/icuin49${BR_INSTALL_DEPENDENCIES_SUFFIX}.dll DESTINATION bin) + install(FILES ${_qt5Core_install_prefix}/bin/icuin49${BR_INSTALL_DEPENDENCIES_SUFFIX}.dll DESTINATION bin) + install(FILES ${_qt5Core_install_prefix}/bin/icuuc49${BR_INSTALL_DEPENDENCIES_SUFFIX}.dll DESTINATION bin) + install(FILES ${_qt5Core_install_prefix}/bin/icudt49.dll DESTINATION bin) + install(FILES ${_qt5Core_install_prefix}/bin/d3dcompiler_46.dll DESTINATION bin) + install(FILES ${_qt5Core_install_prefix}/plugins/platforms/qwindows${BR_INSTALL_DEPENDENCIES_SUFFIX}.dll DESTINATION bin/platforms) endif() endfunction() -- libgit2 0.21.4