Commit 6de5c562 authored by Martin Tobias Holmedahl Sandsmark's avatar Martin Tobias Holmedahl Sandsmark
Browse files

Shut up libtiff

Only errors might actually have anything interesting in libtiff, so just
print those by default.
parent dc163d9b
......@@ -96,6 +96,16 @@ if(CFITSIO_FOUND)
set(HAVE_FITS true)
endif()
find_package(TIFF)
set_package_properties(TIFF PROPERTIES DESCRIPTION "Library for reading TIFF files"
URL "http://www.libtiff.org/"
TYPE OPTIONAL
PURPOSE "Disable uninteresting log messages from libtiff by default"
)
if (TIFF_FOUND)
set(HAVE_TIFF true)
endif()
find_package(KF5Kipi)
if (KF5Kipi_FOUND)
set(KIPI_FOUND true)
......
......@@ -99,6 +99,10 @@ if (KF5Kipi_FOUND)
target_link_libraries(gwenview KF5::Kipi)
endif()
if (HAVE_TIFF)
target_link_libraries(gwenview TIFF::TIFF)
endif()
if (APPLE)
# own plist template
set_target_properties (gwenview PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/MacOSXBundleInfo.plist.in)
......
......@@ -48,6 +48,29 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <../lib/imageformats/moc_fitsplugin.cpp>
#endif
// To shut up libtiff
#ifdef HAVE_TIFF
#include <QLoggingCategory>
#include <tiffio.h>
namespace {
Q_DECLARE_LOGGING_CATEGORY(LibTiffLog)
Q_LOGGING_CATEGORY(LibTiffLog, "gwenview.libtiff", QtWarningMsg)
static void handleTiffWarning(const char* mod, const char* fmt, va_list ap) {
qCDebug(LibTiffLog) << "Warning:" << mod << QString::vasprintf(fmt, ap);
}
static void handleTiffError(const char* mod, const char* fmt, va_list ap) {
// Since we're doing thumbnails, we don't really care about warnings by default either
qCWarning(LibTiffLog) << "Error" << mod << QString::vasprintf(fmt, ap);
}
} // namespace
#endif
class StartHelper
{
public:
......@@ -119,6 +142,11 @@ private:
int main(int argc, char *argv[])
{
#ifdef HAVE_TIFF
TIFFSetWarningHandler(handleTiffWarning);
TIFFSetErrorHandler(handleTiffError);
#endif
/**
* enable high dpi support
*/
......
......@@ -8,3 +8,4 @@
#cmakedefine HAVE_QTDBUS ${HAVE_QTDBUS}
#cmakedefine KF5Activities_FOUND 1
#cmakedefine KF5Purpose_FOUND 1
#cmakedefine HAVE_TIFF 1
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment