New Upstream Release - nomacs

Ready changes

Summary

Merged new upstream version: 3.17.2282+dfsg (was: 3.17.2206+dfsg).

Resulting package

Built on 2023-07-19T13:19 (took 13m10s)

The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:

apt install -t fresh-releases nomacs-dbgsymapt install -t fresh-releases nomacs-l10napt install -t fresh-releases nomacs

Lintian Result

Diff

diff --git a/.gitmodules b/.gitmodules
index 14bbe6a..2a0ba94 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,6 +1,3 @@
-[submodule "3rd-party/exiv2"]
-	path = 3rd-party/exiv2
-	url = https://github.com/nomacs/exiv2.git
 [submodule "3rd-party/expat"]
 	path = 3rd-party/expat
 	url = https://github.com/nomacs/expat.git
@@ -10,12 +7,15 @@
 [submodule "3rd-party/quazip"]
 	path = 3rd-party/quazip
 	url = https://github.com/nomacs/quazip.git
-[submodule "3rd-party/LibRaw"]
-	path = 3rd-party/LibRaw
-	url = https://github.com/nomacs/LibRaw.git
-[submodule "3rd-party/imageformats"]
-	path = 3rd-party/imageformats
-	url = https://github.com/nomacs/imageformats.git
 [submodule "ImageLounge/plugins"]
 	path = ImageLounge/plugins
-	url = https://github.com/nomacs/nomacs-plugins.git
\ No newline at end of file
+	url = https://github.com/nomacs/nomacs-plugins.git
+[submodule "3rd-party/exiv2"]
+	path = 3rd-party/exiv2
+	url = https://github.com/novomesk/exiv2-nomacs.git
+[submodule "3rd-party/imageformats"]
+	path = 3rd-party/imageformats
+	url = https://github.com/novomesk/nomacs-imageformats.git
+[submodule "3rd-party/LibRaw"]
+	path = 3rd-party/LibRaw
+	url = https://github.com/novomesk/nomacs-LibRaw.git
diff --git a/.travis.yml b/.travis.yml
index abae546..c9a0bb6 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -39,7 +39,7 @@ before_script:
   - if [ "$TRAVIS_OS_NAME" = "osx" ]; then CMAKE_ARGS="-DCMAKE_PREFIX_PATH=/usr/local/opt/qt5"; fi
 
   # Linux CMake paths (here we also test the minimal configuration)
-  - if [ "$TRAVIS_OS_NAME" = "linux" ]; then CMAKE_ARGS="-DCMAKE_PREFIX_PATH=/opt/qt55/bin/ -DENABLE_PLUGINS=OFF -DENABLE_QUAZIP=OFF"; fi
+  - if [ "$TRAVIS_OS_NAME" = "linux" ]; then CMAKE_ARGS="-DCMAKE_PREFIX_PATH=/opt/qt55/bin/ -DENABLE_QUAZIP=OFF"; fi
   - if [ "$TRAVIS_OS_NAME" = "linux" ]; then CMAKE_MINIMAL_ARGS="-DCMAKE_PREFIX_PATH=/opt/qt55/bin/ -DENABLE_PLUGINS=OFF -DENABLE_OPENCV=OFF -DENABLE_RAW=OFF -DENABLE_TIFF=OFF -DENABLE_QUAZIP=OFF"; fi
   
   - mkdir build
diff --git a/ImageLounge/CMakeLists.txt b/ImageLounge/CMakeLists.txt
index de9e80a..9371d0b 100644
--- a/ImageLounge/CMakeLists.txt
+++ b/ImageLounge/CMakeLists.txt
@@ -33,7 +33,7 @@ find_package(Python QUIET)
 # include macros needed
 include("cmake/Utils.cmake")
 
-set(QT5_MIN_VERSION 5.2.1)
+set(QT5_MIN_VERSION 5.15.0)
 
 # different compile options
 option(ENABLE_OPENCV "Compile with Opencv (needed for RAW and TIFF)" ON)
@@ -46,6 +46,7 @@ option(ENABLE_TRANSLATIONS "Compile Translations" ON)
 option(ENABLE_PLUGINS "Compile nomacs with plugin support" ON)
 option(ENABLE_HEIF "Compile nomacs with HEIF support" OFF)
 option(ENABLE_AVIF "Compile nomacs with AVIF support" OFF)
+option(ENABLE_JXL "Compile nomacs with JPEG XL support" OFF)
 option(ENABLE_CODE_COV "Run Code Coverage tests" OFF)
 option(USE_SYSTEM_QUAZIP "QuaZip will not be compiled from source" ON) # ignored by MSVC
 
@@ -74,8 +75,6 @@ elseif (MSVC)
         set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "${DEPENDENCY_PATH}/opencv/")
         set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "${DEPENDENCY_PATH}/quazip/")
         set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "${DEPENDENCY_PATH}/libraw/")
-        set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "${DEPENDENCY_PATH}/imageformats/libheif")
-        set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "${DEPENDENCY_PATH}/imageformats/libde265")
     endif()
 endif()
 
@@ -142,6 +141,8 @@ include_directories (
 )
 
 if (APPLE) # todo: somehow add this to Mac.cmake or MacBuildTarget.cmake
+	execute_process(COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_HEADERS OUTPUT_VARIABLE qt_install_headers)
+	include_directories (BEFORE ${qt_install_headers})
 	SET (NOMACS_SOURCES ${NOMACS_SOURCES} macosx/nomacs.icns)
 endif (APPLE)
 
diff --git a/ImageLounge/cmake/Mac.cmake b/ImageLounge/cmake/Mac.cmake
index c551158..b87bc0c 100644
--- a/ImageLounge/cmake/Mac.cmake
+++ b/ImageLounge/cmake/Mac.cmake
@@ -13,7 +13,7 @@ endif()
 find_package(PkgConfig)
 
 # search for exiv2
-pkg_check_modules(EXIV2  exiv2>=0.20)
+pkg_check_modules(EXIV2 REQUIRED exiv2>=0.27)
 message(STATUS "exiv2 version by pkg-config: ${EXIV2_VERSION}")
 
 find_file(HAVE_EXIV2_HPP exiv2/exiv2.hpp ${EXIV2_INCLUDE_DIRS})
diff --git a/ImageLounge/cmake/Unix.cmake b/ImageLounge/cmake/Unix.cmake
index 5567084..3ceb861 100644
--- a/ImageLounge/cmake/Unix.cmake
+++ b/ImageLounge/cmake/Unix.cmake
@@ -19,7 +19,7 @@ option(USE_SYSTEM_LIBQPSD "Use qpsd libary provided by system" OFF)
 find_package(PkgConfig)
 
 # search for exiv2
-pkg_check_modules(EXIV2  exiv2>=0.20)
+pkg_check_modules(EXIV2 REQUIRED exiv2>=0.27)
 message(STATUS "exiv2 version by pkg-config: ${EXIV2_VERSION}")
 
 find_file(HAVE_EXIV2_HPP exiv2/exiv2.hpp ${EXIV2_INCLUDE_DIRS})
@@ -102,14 +102,26 @@ unset(QT_ROOT CACHE)
 
 if(ENABLE_QUAZIP)
   if(USE_SYSTEM_QUAZIP)
-    SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
-
-    find_package(QuaZip5 QUIET)
-    if(NOT QUAZIP_FOUND)
-	    message(FATAL_ERROR "QUAZIP not found. It's mandatory when used with ENABLE_QUAZIP enabled, you can also disable USE_SYSTEM_QUAZIP")
-    else()
-	    add_definitions(-DWITH_QUAZIP)
-    endif()
+    # Let's try QuaZip1 first (it's the bright future)
+    find_package(QuaZip-Qt5 QUIET)
+    if (QuaZip-Qt5_FOUND)
+      message(STATUS "QUAZIP: QuaZip-1 for Qt5 found")
+      set(QUAZIP_LIBRARIES QuaZip::QuaZip)
+      add_definitions(-DWITH_QUAZIP1)
+    else ()
+      message(WARNING "QUAZIP: 1.x not found. Trying to find 0.x")
+      # QuaZip < 1.0. This leg can be removed (including cmake/FindQuaZip5.cmake)
+      # ater the final migration to 1.x in Linux distros
+      SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
+
+      find_package(QuaZip5 QUIET)
+      if(NOT QUAZIP_FOUND)
+        message(FATAL_ERROR "QUAZIP: even 0.x not found. It's mandatory when used with ENABLE_QUAZIP enabled, you can also disable USE_SYSTEM_QUAZIP")
+      endif()
+
+    endif (QuaZip-Qt5_FOUND)
+    # we have any QuaZip after all
+    add_definitions(-DWITH_QUAZIP)
   else()
     find_package(ZLIB REQUIRED)
     set(QUAZIP_INCLUDE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/quazip-0.7/quazip ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/quazip-0.7/)
diff --git a/ImageLounge/cmake/Win.cmake b/ImageLounge/cmake/Win.cmake
index ba7e9be..88dc684 100644
--- a/ImageLounge/cmake/Win.cmake
+++ b/ImageLounge/cmake/Win.cmake
@@ -15,7 +15,7 @@ file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Debug)
 file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Release)
 
 # add exiv2
-find_package(exiv2)
+find_package(exiv2 REQUIRED)
 
 # search for opencv
 unset(OpenCV_LIB_DIR_DBG CACHE)
diff --git a/ImageLounge/cmake/WinBuildTarget.cmake b/ImageLounge/cmake/WinBuildTarget.cmake
index c53589c..77ed05f 100644
--- a/ImageLounge/cmake/WinBuildTarget.cmake
+++ b/ImageLounge/cmake/WinBuildTarget.cmake
@@ -75,16 +75,16 @@ set(DELAY_DLL_NAMES
 
 # dear future me: sorry, for manually defining them - but I have no time right now
 set(DELAY_DLL_NAMES_DEBUG 
-	opencv_core430d.dll
-	opencv_imgproc430d.dll
+	opencv_core455d.dll
+	opencv_imgproc455d.dll
 	quazip5d.dll
 	Qt5WinExtrasd.dll
 	${DELAY_DLL_NAMES}
 	)
 
 set(DELAY_DLL_NAMES_RELEASE
-	opencv_core430.dll
-	opencv_imgproc430.dll
+	opencv_core455.dll
+	opencv_imgproc455.dll
 	quazip5.dll
 	Qt5WinExtras.dll
 	${DELAY_DLL_NAMES}
@@ -119,6 +119,16 @@ if (ENABLE_AVIF)
     file(DOWNLOAD "https://github.com/novomesk/qt-avif-image-plugin/releases/latest/download/qavif.dll" ${CMAKE_BINARY_DIR}/Release/imageformats/qavif.dll)
 endif()
 
+if (ENABLE_JXL)
+    file(DOWNLOAD "https://github.com/novomesk/qt-jpegxl-image-plugin/releases/latest/download/qjpegxl.dll" ${CMAKE_BINARY_DIR}/Release/imageformats/qjpegxl.dll)
+endif()
+
+if (ENABLE_HEIF)
+    file(DOWNLOAD "https://github.com/novomesk/qt-heic-image-plugin/releases/latest/download/kimg_heif.dll" ${CMAKE_BINARY_DIR}/Release/imageformats/kimg_heif.dll)
+    file(DOWNLOAD "https://github.com/novomesk/qt-heic-image-plugin/releases/latest/download/heif.dll" ${CMAKE_BINARY_DIR}/Release/heif.dll)
+    file(DOWNLOAD "https://github.com/novomesk/qt-heic-image-plugin/releases/latest/download/libde265.dll" ${CMAKE_BINARY_DIR}/Release/libde265.dll)
+endif()
+
 # copy additional Qt files
 # add image plugins
 file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Release/imageformats)
@@ -231,24 +241,6 @@ if(DLL_CORE_NAME)
 	set(NOMACS_CORE_LIB optimized ${CMAKE_BINARY_DIR}/libs/Release/${CORE_RELEASE_NAME}.lib debug  ${CMAKE_BINARY_DIR}/libs/Debug/${CORE_DEBUG_NAME}.lib)
 endif()
 
-if (ENABLE_HEIF)
-	find_package(libde265)
-	file(COPY ${LIBDE265_BUILD_PATH}/libde265/Release/libde265.dll DESTINATION ${CMAKE_BINARY_DIR}/Release/)
-	file(COPY ${LIBDE265_BUILD_PATH}/libde265/Release/libde265.dll DESTINATION ${CMAKE_BINARY_DIR}/RelWithDebInfo/)
-    
-    if (EXISTS ${LIBDE265_BUILD_PATH}/libde265/Debug/)
-        file(COPY ${LIBDE265_BUILD_PATH}/libde265/Debug/libde265.dll DESTINATION ${CMAKE_BINARY_DIR}/Debug/)
-    endif()
-
-	find_package(libheif)
-	file(COPY ${libheif_BUILD_PATH}/libheif/Release/heif.dll DESTINATION ${CMAKE_BINARY_DIR}/Release/)
-	file(COPY ${libheif_BUILD_PATH}/libheif/Release/heif.dll DESTINATION ${CMAKE_BINARY_DIR}/RelWithDebInfo/)
-    
-    if (EXISTS ${LIBDE265_BUILD_PATH}/libheif/Debug/)
-        file(COPY ${libheif_BUILD_PATH}/libheif/Debug/heif.dll DESTINATION ${CMAKE_BINARY_DIR}/Debug/)
-    endif ()
-endif()
-
 set(NOMACS_LIBS ${NOMACS_CORE_LIB})
 set(NOMACS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
 set(NOMACS_INCLUDE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/src/DkGui ${CMAKE_CURRENT_SOURCE_DIR}/src/DkCore ${CMAKE_CURRENT_SOURCE_DIR}/src/DkLoader ${CMAKE_BINARY_DIR})
diff --git a/ImageLounge/src/.clang-format b/ImageLounge/src/.clang-format
new file mode 100644
index 0000000..cf5ff2c
--- /dev/null
+++ b/ImageLounge/src/.clang-format
@@ -0,0 +1,88 @@
+---
+# SPDX-FileCopyrightText: 2019 Christoph Cullmann <cullmann@kde.org>
+# SPDX-FileCopyrightText: 2019 Gernot Gebhard <gebhard@absint.com>
+#
+# SPDX-License-Identifier: MIT
+
+# This file got automatically created by ECM, do not edit
+# See https://clang.llvm.org/docs/ClangFormatStyleOptions.html for the config options
+# and https://community.kde.org/Policies/Frameworks_Coding_Style#Clang-format_automatic_code_formatting
+# for clang-format tips & tricks
+---
+Language: JavaScript
+DisableFormat: true
+---
+
+# Style for C++
+Language: Cpp
+
+# base is WebKit coding style: https://webkit.org/code-style-guidelines/
+# below are only things set that diverge from this style!
+BasedOnStyle: WebKit
+
+# enforce C++11 (e.g. for std::vector<std::vector<lala>>
+Standard: Cpp11
+
+# 4 spaces indent
+TabWidth: 4
+
+# 2 * 80 wide lines
+ColumnLimit: 160
+
+# sort includes inside line separated groups
+SortIncludes: true
+
+# break before braces on function, namespace and class definitions.
+BreakBeforeBraces: Linux
+
+# CrlInstruction *a;
+PointerAlignment: Right
+
+# horizontally aligns arguments after an open bracket.
+AlignAfterOpenBracket: Align
+
+# don't move all parameters to new line
+AllowAllParametersOfDeclarationOnNextLine: false
+
+# no single line functions
+AllowShortFunctionsOnASingleLine: None
+
+# always break before you encounter multi line strings
+AlwaysBreakBeforeMultilineStrings: true
+
+# don't move arguments to own lines if they are not all on the same
+BinPackArguments: false
+
+# don't move parameters to own lines if they are not all on the same
+BinPackParameters: false
+
+# In case we have an if statement with multiple lines the operator should be at the beginning of the line
+# but we do not want to break assignments
+BreakBeforeBinaryOperators: NonAssignment
+
+# format C++11 braced lists like function calls
+Cpp11BracedListStyle: true
+
+# do not put a space before C++11 braced lists
+SpaceBeforeCpp11BracedList: false
+
+# remove empty lines
+KeepEmptyLinesAtTheStartOfBlocks: false
+
+# no namespace indentation to keep indent level low
+NamespaceIndentation: None
+
+# we use template< without space.
+SpaceAfterTemplateKeyword: false
+
+# Always break after template declaration
+AlwaysBreakTemplateDeclarations: true
+
+# macros for which the opening brace stays attached.
+ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH, forever, Q_FOREVER, QBENCHMARK, QBENCHMARK_ONCE , wl_resource_for_each, wl_resource_for_each_safe ]
+
+# keep lambda formatting multi-line if not empty
+AllowShortLambdasOnASingleLine: Empty
+
+# We do not want clang-format to put all arguments on a new line
+AllowAllArgumentsOnNextLine: false
diff --git a/ImageLounge/src/DkCore/DkActionManager.cpp b/ImageLounge/src/DkCore/DkActionManager.cpp
index f33dc96..f5094e1 100644
--- a/ImageLounge/src/DkCore/DkActionManager.cpp
+++ b/ImageLounge/src/DkCore/DkActionManager.cpp
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkActionManager.cpp
  Created on:	28.10.2015
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2015 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2015 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2015 Florian Kleber <florian@nomacs.org>
@@ -26,11 +26,11 @@
  *******************************************************************************************************/
 
 #include "DkActionManager.h"
-#include "DkSettings.h"
 #include "DkImageStorage.h"
-#include "DkUtils.h"
+#include "DkSettings.h"
 #include "DkStatusBar.h"
 #include "DkToolbars.h"
+#include "DkUtils.h"
 
 #include "DkDialog.h"
 #include "DkMenu.h"
@@ -40,1785 +40,1835 @@
 #endif
 
 #if defined(Q_OS_WIN) && !defined(SOCK_STREAM)
-#include <winsock2.h>	// needed since libraw 0.16
+#include <winsock2.h> // needed since libraw 0.16
 #endif
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QMenu>
-#include <QFileInfo>
-#include <QDir>
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QApplication>
 #include <QDebug>
+#include <QDir>
+#include <QFileInfo>
+#include <QMenu>
 #include <QProgressDialog>
 #include <QSvgRenderer>
 
 #ifdef Q_OS_WIN
 #include <QWinTaskbarProgress>
-#include <windows.h>
 #include <QtWin>
+#include <windows.h>
 #endif
-#pragma warning(pop)		// no warnings from includes - end
-
-namespace nmc {
+#pragma warning(pop) // no warnings from includes - end
 
+namespace nmc
+{
 
 // DkAppManager --------------------------------------------------------------------
-DkAppManager::DkAppManager(QWidget* parent) : QObject(parent) {
-
-	mDefaultNames.resize(app_idx_end);
-	mDefaultNames[app_photohsop]	= "PhotoshopAction";
-	mDefaultNames[app_picasa]		= "PicasaAction";
-	mDefaultNames[app_picasa_viewer]= "PicasaViewerAction";
-	mDefaultNames[app_irfan_view]	= "IrfanViewAction";
-	mDefaultNames[app_explorer]		= "ExplorerAction";
-
-	loadSettings();
-	if (mFirstTime)
-		findDefaultSoftware();
-
-	for (int idx = 0; idx < mApps.size(); idx++) {
-		assignIcon(mApps.at(idx));
-		connect(mApps.at(idx), SIGNAL(triggered()), this, SLOT(openTriggered()));
-	}
-}
-
-DkAppManager::~DkAppManager() {
-
-	// save settings
-	saveSettings();
-}
-
-void DkAppManager::saveSettings() const {
-
-	DefaultSettings settings;
-	settings.beginGroup("DkAppManager");
-	// clear it first
-	settings.remove("Apps");
-
-	settings.beginWriteArray("Apps");
-
-	for (int idx = 0; idx < mApps.size(); idx++) {
-		settings.setArrayIndex(idx);
-		settings.setValue("appName", mApps.at(idx)->text());
-		settings.setValue("appPath", mApps.at(idx)->toolTip());
-		settings.setValue("objectName", mApps.at(idx)->objectName());
-	}
-	settings.endArray();
-	settings.endGroup();
-}
-
-void DkAppManager::loadSettings() {
-
-	DefaultSettings settings;
-	settings.beginGroup("DkAppManager");
-
-	int size = settings.beginReadArray("Apps");
-	if (size > 0)
-		mFirstTime = false;
-
-	for (int idx = 0; idx < size; idx++) {
-		settings.setArrayIndex(idx);
-		QAction* action = new QAction(parent());
-		action->setText(settings.value("appName", "").toString());
-		action->setToolTip(settings.value("appPath", "").toString());
-		action->setObjectName(settings.value("objectName", "").toString());
-
-		// default shortcuts
-		if (action->objectName() == mDefaultNames[app_explorer])
-			action->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_E));
-
-		if (QFileInfo(action->toolTip()).exists() && !action->text().isEmpty())
-			mApps.append(action);
-		else
-			qDebug() << "could not locate: " << action->toolTip();
-
-	}
-	settings.endArray();
-	settings.endGroup();
-}
-
-QVector<QAction* > DkAppManager::getActions() const {
+DkAppManager::DkAppManager(QWidget *parent)
+    : QObject(parent)
+{
+    mDefaultNames.resize(app_idx_end);
+    mDefaultNames[app_photohsop] = "PhotoshopAction";
+    mDefaultNames[app_picasa] = "PicasaAction";
+    mDefaultNames[app_picasa_viewer] = "PicasaViewerAction";
+    mDefaultNames[app_irfan_view] = "IrfanViewAction";
+    mDefaultNames[app_explorer] = "ExplorerAction";
 
-	return mApps;
-}
-
-void DkAppManager::setActions(QVector<QAction* > actions) {
-
-	mApps = actions;
-	saveSettings();
-}
-
-QAction* DkAppManager::createAction(const QString& filePath) {
-
-	QFileInfo file(filePath);
-	if (!file.exists())
-		return 0;
-
-	QAction* newApp = new QAction(file.baseName(), parent());
-	newApp->setToolTip(QDir::fromNativeSeparators(file.filePath()));
-	assignIcon(newApp);
-	connect(newApp, SIGNAL(triggered()), this, SLOT(openTriggered()));
-
-	return newApp;
-}
-
-QAction* DkAppManager::findAction(const QString& appPath) const {
-
-	for (int idx = 0; idx < mApps.size(); idx++) {
-
-		if (mApps.at(idx)->toolTip() == appPath)
-			return mApps.at(idx);
-	}
-
-	return 0;
-}
-
-void DkAppManager::findDefaultSoftware() {
-
-	QString appPath;
-
-	// Photoshop
-	if (!containsApp(mApps, mDefaultNames[app_photohsop])) {
-		appPath = searchForSoftware("Adobe", "Photoshop", "ApplicationPath");
-		if (!appPath.isEmpty()) {
-			QAction* a = new QAction(QObject::tr("&Photoshop"), parent());
-			a->setToolTip(QDir::fromNativeSeparators(appPath));
-			a->setObjectName(mDefaultNames[app_photohsop]);
-			mApps.append(a);
-		}
-	}
-
-	if (!containsApp(mApps, mDefaultNames[app_picasa])) {
-		// Picasa
-		appPath = searchForSoftware("Google", "Picasa", "Directory");
-		if (!appPath.isEmpty()) {
-			QAction* a = new QAction(QObject::tr("Pic&asa"), parent());
-			a->setToolTip(QDir::fromNativeSeparators(appPath));
-			a->setObjectName(mDefaultNames[app_picasa]);
-			mApps.append(a);
-		}
-	}
-
-	if (!containsApp(mApps, mDefaultNames[app_picasa_viewer])) {
-		// Picasa Photo Viewer
-		appPath = searchForSoftware("Google", "Picasa", "Directory", "PicasaPhotoViewer.exe");
-		if (!appPath.isEmpty()) {
-			QAction* a = new QAction(QObject::tr("Picasa Ph&oto Viewer"), parent());
-			a->setToolTip(QDir::fromNativeSeparators(appPath));
-			a->setObjectName(mDefaultNames[app_picasa_viewer]);
-			mApps.append(a);
-		}
-	}
-
-	if (!containsApp(mApps, mDefaultNames[app_irfan_view])) {
-		// IrfanView
-		appPath = searchForSoftware("IrfanView", "shell");
-		if (!appPath.isEmpty()) {
-			QAction* a = new QAction(QObject::tr("&IrfanView"), parent());
-			a->setToolTip(QDir::fromNativeSeparators(appPath));
-			a->setObjectName(mDefaultNames[app_irfan_view]);
-			mApps.append(a);
-		}
-	}
-
-	if (!containsApp(mApps, mDefaultNames[app_explorer])) {
-		appPath = "C:/Windows/explorer.exe";
-		if (QFileInfo(appPath).exists()) {
-			QAction* a = new QAction(QObject::tr("&Explorer"), parent());
-			a->setToolTip(QDir::fromNativeSeparators(appPath));
-			a->setObjectName(mDefaultNames[app_explorer]);
-			mApps.append(a);
-		}
-	}
-}
-
-bool DkAppManager::containsApp(QVector<QAction* > apps, const QString& appName) const {
-
-	for (int idx = 0; idx < apps.size(); idx++)
-		if (apps.at(idx)->objectName() == appName)
-			return true;
-
-	return false;
-}
-
-void DkAppManager::assignIcon(QAction* app) const {
+    loadSettings();
+    if (mFirstTime)
+        findDefaultSoftware();
 
+    for (int idx = 0; idx < mApps.size(); idx++) {
+        assignIcon(mApps.at(idx));
+        connect(mApps.at(idx), SIGNAL(triggered()), this, SLOT(openTriggered()));
+    }
+}
+
+DkAppManager::~DkAppManager()
+{
+    // save settings
+    saveSettings();
+}
+
+void DkAppManager::saveSettings() const
+{
+    DefaultSettings settings;
+    settings.beginGroup("DkAppManager");
+    // clear it first
+    settings.remove("Apps");
+
+    settings.beginWriteArray("Apps");
+
+    for (int idx = 0; idx < mApps.size(); idx++) {
+        settings.setArrayIndex(idx);
+        settings.setValue("appName", mApps.at(idx)->text());
+        settings.setValue("appPath", mApps.at(idx)->toolTip());
+        settings.setValue("objectName", mApps.at(idx)->objectName());
+    }
+    settings.endArray();
+    settings.endGroup();
+}
+
+void DkAppManager::loadSettings()
+{
+    DefaultSettings settings;
+    settings.beginGroup("DkAppManager");
+
+    int size = settings.beginReadArray("Apps");
+    if (size > 0)
+        mFirstTime = false;
+
+    for (int idx = 0; idx < size; idx++) {
+        settings.setArrayIndex(idx);
+        QAction *action = new QAction(parent());
+        action->setText(settings.value("appName", "").toString());
+        action->setToolTip(settings.value("appPath", "").toString());
+        action->setObjectName(settings.value("objectName", "").toString());
+
+        // default shortcuts
+        if (action->objectName() == mDefaultNames[app_explorer])
+            action->setShortcut(QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_E));
+
+        if (QFileInfo(action->toolTip()).exists() && !action->text().isEmpty())
+            mApps.append(action);
+        else
+            qDebug() << "could not locate: " << action->toolTip();
+    }
+    settings.endArray();
+    settings.endGroup();
+}
+
+QVector<QAction *> DkAppManager::getActions() const
+{
+    return mApps;
+}
+
+void DkAppManager::setActions(QVector<QAction *> actions)
+{
+    mApps = actions;
+    saveSettings();
+}
+
+QAction *DkAppManager::createAction(const QString &filePath)
+{
+    QFileInfo file(filePath);
+    if (!file.exists())
+        return 0;
+
+    QAction *newApp = new QAction(file.baseName(), parent());
+    newApp->setToolTip(QDir::fromNativeSeparators(file.filePath()));
+    assignIcon(newApp);
+    connect(newApp, SIGNAL(triggered()), this, SLOT(openTriggered()));
+
+    return newApp;
+}
+
+QAction *DkAppManager::findAction(const QString &appPath) const
+{
+    for (int idx = 0; idx < mApps.size(); idx++) {
+        if (mApps.at(idx)->toolTip() == appPath)
+            return mApps.at(idx);
+    }
+
+    return 0;
+}
+
+void DkAppManager::findDefaultSoftware()
+{
+    QString appPath;
+
+    // Photoshop
+    if (!containsApp(mApps, mDefaultNames[app_photohsop])) {
+        appPath = searchForSoftware("Adobe", "Photoshop", "ApplicationPath");
+        if (!appPath.isEmpty()) {
+            QAction *a = new QAction(QObject::tr("&Photoshop"), parent());
+            a->setToolTip(QDir::fromNativeSeparators(appPath));
+            a->setObjectName(mDefaultNames[app_photohsop]);
+            mApps.append(a);
+        }
+    }
+
+    if (!containsApp(mApps, mDefaultNames[app_picasa])) {
+        // Picasa
+        appPath = searchForSoftware("Google", "Picasa", "Directory");
+        if (!appPath.isEmpty()) {
+            QAction *a = new QAction(QObject::tr("Pic&asa"), parent());
+            a->setToolTip(QDir::fromNativeSeparators(appPath));
+            a->setObjectName(mDefaultNames[app_picasa]);
+            mApps.append(a);
+        }
+    }
+
+    if (!containsApp(mApps, mDefaultNames[app_picasa_viewer])) {
+        // Picasa Photo Viewer
+        appPath = searchForSoftware("Google", "Picasa", "Directory", "PicasaPhotoViewer.exe");
+        if (!appPath.isEmpty()) {
+            QAction *a = new QAction(QObject::tr("Picasa Ph&oto Viewer"), parent());
+            a->setToolTip(QDir::fromNativeSeparators(appPath));
+            a->setObjectName(mDefaultNames[app_picasa_viewer]);
+            mApps.append(a);
+        }
+    }
+
+    if (!containsApp(mApps, mDefaultNames[app_irfan_view])) {
+        // IrfanView
+        appPath = searchForSoftware("IrfanView", "shell");
+        if (!appPath.isEmpty()) {
+            QAction *a = new QAction(QObject::tr("&IrfanView"), parent());
+            a->setToolTip(QDir::fromNativeSeparators(appPath));
+            a->setObjectName(mDefaultNames[app_irfan_view]);
+            mApps.append(a);
+        }
+    }
+
+    if (!containsApp(mApps, mDefaultNames[app_explorer])) {
+        appPath = "C:/Windows/explorer.exe";
+        if (QFileInfo(appPath).exists()) {
+            QAction *a = new QAction(QObject::tr("&Explorer"), parent());
+            a->setToolTip(QDir::fromNativeSeparators(appPath));
+            a->setObjectName(mDefaultNames[app_explorer]);
+            mApps.append(a);
+        }
+    }
+}
+
+bool DkAppManager::containsApp(QVector<QAction *> apps, const QString &appName) const
+{
+    for (int idx = 0; idx < apps.size(); idx++)
+        if (apps.at(idx)->objectName() == appName)
+            return true;
+
+    return false;
+}
+
+void DkAppManager::assignIcon(QAction *app) const
+{
 #ifdef Q_OS_WIN
 
-	if (!app) {
-		qDebug() << "SERIOUS problem here, I should assign an icon to a NULL pointer action";
-		return;
-	}
+    if (!app) {
+        qDebug() << "SERIOUS problem here, I should assign an icon to a NULL pointer action";
+        return;
+    }
 
-	QFileInfo file = app->toolTip();
+    QFileInfo file = app->toolTip();
 
-	if (!file.exists())
-		return;
+    if (!file.exists())
+        return;
 
-	// icon extraction should take between 2ms and 13ms
-	QPixmap appIcon;
-	QString winPath = QDir::toNativeSeparators(file.absoluteFilePath());
+    // icon extraction should take between 2ms and 13ms
+    QPixmap appIcon;
+    QString winPath = QDir::toNativeSeparators(file.absoluteFilePath());
 
-	WCHAR* wDirName = new WCHAR[winPath.length()+1];
+    WCHAR *wDirName = new WCHAR[winPath.length() + 1];
 
-	// CMakeLists.txt:
-	// if compile error that toWCharArray is not recognized:
-	// in msvc: Project Properties -> C/C++ -> Language -> Treat WChar_t as built-in type: set to No (/Zc:wchar_t-)
-	wDirName = (WCHAR*)winPath.utf16();
-	wDirName[winPath.length()] = L'\0';	// append null character
+    // CMakeLists.txt:
+    // if compile error that toWCharArray is not recognized:
+    // in msvc: Project Properties -> C/C++ -> Language -> Treat WChar_t as built-in type: set to No (/Zc:wchar_t-)
+    wDirName = (WCHAR *)winPath.utf16();
+    wDirName[winPath.length()] = L'\0'; // append null character
 
-	int nIcons = ExtractIconExW(wDirName, 0, NULL, NULL, 0);
+    int nIcons = ExtractIconExW(wDirName, 0, NULL, NULL, 0);
 
-	if (!nIcons)
-		return;
+    if (!nIcons)
+        return;
 
-	HICON largeIcon;
-	HICON smallIcon;
-	ExtractIconExW(wDirName, 0, &largeIcon, &smallIcon, 1);
+    HICON largeIcon;
+    HICON smallIcon;
+    ExtractIconExW(wDirName, 0, &largeIcon, &smallIcon, 1);
 
-	if (nIcons != 0 && smallIcon != NULL)
-		appIcon = QtWin::fromHICON(smallIcon);
+    if (nIcons != 0 && smallIcon != NULL)
+        appIcon = QtWin::fromHICON(smallIcon);
 
-	DestroyIcon(largeIcon);
-	DestroyIcon(smallIcon);
+    DestroyIcon(largeIcon);
+    DestroyIcon(smallIcon);
 
-	app->setIcon(appIcon);
+    app->setIcon(appIcon);
 
 #endif
-
 }
 
-QString DkAppManager::searchForSoftware(const QString& organization, const QString& application, const QString& pathKey, const QString& exeName) const {
-
-	//qDebug() << "searching for: " << organization;
-
-	// locate the settings entry
-	QSettings softwareSettings(QSettings::UserScope, organization, application);
-	QStringList keys = softwareSettings.allKeys();
-
-	QString appPath;
-
-	for (int idx = 0; idx < keys.length(); idx++) {
+QString DkAppManager::searchForSoftware(const QString &organization, const QString &application, const QString &pathKey, const QString &exeName) const
+{
+    // qDebug() << "searching for: " << organization;
 
-		// find the path
-		if (keys[idx].contains(pathKey)) {
-			appPath = softwareSettings.value(keys[idx]).toString();
-			break;
-		}
-	}
+    // locate the settings entry
+    QSettings softwareSettings(QSettings::UserScope, organization, application);
+    QStringList keys = softwareSettings.allKeys();
 
-	// if we did not find it -> return
-	if (appPath.isEmpty())
-		return appPath;
+    QString appPath;
 
-	if (exeName.isEmpty()) {
+    for (int idx = 0; idx < keys.length(); idx++) {
+        // find the path
+        if (keys[idx].contains(pathKey)) {
+            appPath = softwareSettings.value(keys[idx]).toString();
+            break;
+        }
+    }
 
-		// locate the exe
-		QDir appFile = appPath.replace("\"", "");	// the string must not have extra quotes
-		QFileInfoList apps = appFile.entryInfoList(QStringList() << "*.exe");
+    // if we did not find it -> return
+    if (appPath.isEmpty())
+        return appPath;
 
-		for (int idx = 0; idx < apps.size(); idx++) {
+    if (exeName.isEmpty()) {
+        // locate the exe
+        QDir appFile = appPath.replace("\"", ""); // the string must not have extra quotes
+        QFileInfoList apps = appFile.entryInfoList(QStringList() << "*.exe");
 
-			if (apps[idx].fileName().contains(application)) {
-				appPath = apps[idx].absoluteFilePath();
-				break;
-			}
-		}
-	}
-	else
-		appPath = QFileInfo(appPath, exeName).absoluteFilePath();	// for correct separators
+        for (int idx = 0; idx < apps.size(); idx++) {
+            if (apps[idx].fileName().contains(application)) {
+                appPath = apps[idx].absoluteFilePath();
+                break;
+            }
+        }
+    } else
+        appPath = QFileInfo(appPath, exeName).absoluteFilePath(); // for correct separators
 
-	if (!appPath.isEmpty())
-		qInfo() << "I found" << organization << "in:" << appPath;
+    if (!appPath.isEmpty())
+        qInfo() << "I found" << organization << "in:" << appPath;
 
-	return appPath;
+    return appPath;
 }
 
-void DkAppManager::openTriggered() const {
+void DkAppManager::openTriggered() const
+{
+    QAction *a = static_cast<QAction *>(QObject::sender());
 
-	QAction* a = static_cast<QAction*>(QObject::sender());
-
-	if (a)
-		openFileSignal(a);
+    if (a)
+        openFileSignal(a);
 }
 
 // DkActionManager --------------------------------------------------------------------
-DkActionManager::DkActionManager() {
-	init();
-}
-
-DkActionManager::~DkActionManager() {
-
-	qDebug() << "releasing...";
+DkActionManager::DkActionManager()
+{
+    init();
 }
 
-DkActionManager& DkActionManager::instance() { 
-
-	static DkActionManager inst;
-	return inst; 
-}
-
-QMenu* DkActionManager::createFileMenu(QWidget* parent /* = 0 */) {
-
-	mFileMenu = new QMenu(QObject::tr("&File"), parent);
-
-	mFileMenu->addAction(mFileActions[menu_file_open]);
-	mFileMenu->addAction(mFileActions[menu_file_open_dir]);
-	if (DkSettingsManager::param().global().extendedTabs)
-		mFileMenu->addAction(mFileActions[menu_file_open_list]);
-
-	// add open with menu
-	mFileMenu->addMenu(openWithMenu());
-	mFileMenu->addAction(mFileActions[menu_file_quick_launch]);
-
-	mFileMenu->addSeparator();
-	mFileMenu->addAction(mFileActions[menu_file_save]);
-	mFileMenu->addAction(mFileActions[menu_file_save_as]);
-	mFileMenu->addAction(mFileActions[menu_file_save_copy]);
-	if (DkSettingsManager::param().global().extendedTabs)
-		mFileMenu->addAction(mFileActions[menu_file_save_list]);
-	mFileMenu->addAction(mFileActions[menu_file_save_web]);
-	mFileMenu->addAction(mFileActions[menu_file_rename]);
-	mFileMenu->addSeparator();
-	mFileMenu->addAction(mFileActions[menu_file_show_recent]);
-	mFileMenu->addSeparator();
-	mFileMenu->addAction(mFileActions[menu_file_print]);
-	mFileMenu->addSeparator();
-
-	// add sort menu
-	mFileMenu->addMenu(sortMenu());
-	mFileMenu->addAction(mFileActions[menu_file_recursive]);
-	mFileMenu->addAction(mFileActions[menu_file_goto]);
-	mFileMenu->addAction(mFileActions[menu_file_find]);
-	mFileMenu->addAction(mFileActions[menu_file_reload]);
-	mFileMenu->addAction(mFileActions[menu_file_prev]);
-	mFileMenu->addAction(mFileActions[menu_file_next]);
-	mFileMenu->addSeparator();
-	mFileMenu->addAction(mFileActions[menu_file_new_instance]);
-	mFileMenu->addAction(mFileActions[menu_file_private_instance]);
-	mFileMenu->addAction(mFileActions[menu_file_exit]);
-
-	return mFileMenu;
-}
-
-QMenu * DkActionManager::createOpenWithMenu(QWidget* parent) {
-
-	mOpenWithMenu = new QMenu(QObject::tr("&Open With"), parent);
-	return updateOpenWithMenu();
-}
-
-QMenu* DkActionManager::updateOpenWithMenu() {
-	
-	mOpenWithMenu->clear();
-
-	QVector<QAction* > appActions = mAppManager->getActions();
-
-	assignCustomShortcuts(appActions);
-	mOpenWithMenu->addActions(appActions.toList());
-
-	if (!appActions.empty())
-		mOpenWithMenu->addSeparator();
-	mOpenWithMenu->addAction(mFileActions[menu_file_app_manager]);
-
-	return mOpenWithMenu;
+DkActionManager::~DkActionManager()
+{
+    qDebug() << "releasing...";
 }
 
-QMenu * DkActionManager::createSortMenu(QWidget * parent) {
-	
-	mSortMenu = new QMenu(QObject::tr("S&ort"), parent);
-	mSortMenu->addAction(mSortActions[menu_sort_filename]);
-	mSortMenu->addAction(mSortActions[menu_sort_date_created]);
-	mSortMenu->addAction(mSortActions[menu_sort_date_modified]);
-	mSortMenu->addAction(mSortActions[menu_sort_random]);
-	mSortMenu->addSeparator();
-	mSortMenu->addAction(mSortActions[menu_sort_ascending]);
-	mSortMenu->addAction(mSortActions[menu_sort_descending]);
-
-	return mSortMenu;
-}
-
-QMenu* DkActionManager::createViewMenu(QWidget* parent /* = 0 */) {
-
-	mViewMenu = new QMenu(QObject::tr("&View"), parent);
-
-	mViewMenu->addAction(mViewActions[menu_view_frameless]);
-	mViewMenu->addAction(mViewActions[menu_view_fullscreen]);
-	mViewMenu->addSeparator();
-
-	mViewMenu->addAction(mViewActions[menu_view_new_tab]);
-	mViewMenu->addAction(mViewActions[menu_view_close_tab]);
-	mViewMenu->addAction(mViewActions[menu_view_close_all_tabs]);
-
-	if (DkSettingsManager::param().global().extendedTabs)
-		mViewMenu->addAction(mViewActions[menu_view_first_tab]);
-	mViewMenu->addAction(mViewActions[menu_view_previous_tab]);
-	if (DkSettingsManager::param().global().extendedTabs)
-		mViewMenu->addAction(mViewActions[menu_view_goto_tab]);
-	mViewMenu->addAction(mViewActions[menu_view_next_tab]);
-	if (DkSettingsManager::param().global().extendedTabs)
-		mViewMenu->addAction(mViewActions[menu_view_last_tab]);
-	mViewMenu->addSeparator();
-
-	mViewMenu->addAction(mViewActions[menu_view_reset]);
-	mViewMenu->addAction(mViewActions[menu_view_100]);
-	mViewMenu->addAction(mViewActions[menu_view_fit_frame]);
-	mViewMenu->addAction(mViewActions[menu_view_zoom_in]);
-	mViewMenu->addAction(mViewActions[menu_view_zoom_out]);
-	mViewMenu->addSeparator();
-
-	mViewMenu->addAction(mViewActions[menu_view_tp_pattern]);
-	mViewMenu->addAction(mViewActions[menu_view_anti_aliasing]);
-	mViewMenu->addSeparator();
-
-	mViewMenu->addAction(mViewActions[menu_view_opacity_change]);
-	mViewMenu->addAction(mViewActions[menu_view_opacity_up]);
-	mViewMenu->addAction(mViewActions[menu_view_opacity_down]);
-	mViewMenu->addAction(mViewActions[menu_view_opacity_an]);
+DkActionManager &DkActionManager::instance()
+{
+    static DkActionManager inst;
+    return inst;
+}
+
+QMenu *DkActionManager::createFileMenu(QWidget *parent /* = 0 */)
+{
+    mFileMenu = new QMenu(QObject::tr("&File"), parent);
+
+    mFileMenu->addAction(mFileActions[menu_file_open]);
+    mFileMenu->addAction(mFileActions[menu_file_open_dir]);
+    if (DkSettingsManager::param().global().extendedTabs)
+        mFileMenu->addAction(mFileActions[menu_file_open_list]);
+
+    // add open with menu
+    mFileMenu->addMenu(openWithMenu());
+    mFileMenu->addAction(mFileActions[menu_file_quick_launch]);
+
+    mFileMenu->addSeparator();
+    mFileMenu->addAction(mFileActions[menu_file_save]);
+    mFileMenu->addAction(mFileActions[menu_file_save_as]);
+    mFileMenu->addAction(mFileActions[menu_file_save_copy]);
+    if (DkSettingsManager::param().global().extendedTabs)
+        mFileMenu->addAction(mFileActions[menu_file_save_list]);
+    mFileMenu->addAction(mFileActions[menu_file_save_web]);
+    mFileMenu->addAction(mFileActions[menu_file_rename]);
+    mFileMenu->addSeparator();
+    mFileMenu->addAction(mFileActions[menu_file_show_recent]);
+    mFileMenu->addSeparator();
+    mFileMenu->addAction(mFileActions[menu_file_print]);
+    mFileMenu->addSeparator();
+
+    // add sort menu
+    mFileMenu->addMenu(sortMenu());
+    mFileMenu->addAction(mFileActions[menu_file_recursive]);
+    mFileMenu->addAction(mFileActions[menu_file_goto]);
+    mFileMenu->addAction(mFileActions[menu_file_find]);
+    mFileMenu->addAction(mFileActions[menu_file_reload]);
+    mFileMenu->addAction(mFileActions[menu_file_prev]);
+    mFileMenu->addAction(mFileActions[menu_file_next]);
+    mFileMenu->addSeparator();
+    mFileMenu->addAction(mFileActions[menu_file_new_instance]);
+    mFileMenu->addAction(mFileActions[menu_file_private_instance]);
+    mFileMenu->addAction(mFileActions[menu_file_exit]);
+
+    return mFileMenu;
+}
+
+QMenu *DkActionManager::createOpenWithMenu(QWidget *parent)
+{
+    mOpenWithMenu = new QMenu(QObject::tr("&Open With"), parent);
+    return updateOpenWithMenu();
+}
+
+QMenu *DkActionManager::updateOpenWithMenu()
+{
+    mOpenWithMenu->clear();
+
+    QVector<QAction *> appActions = mAppManager->getActions();
+
+    assignCustomShortcuts(appActions);
+    mOpenWithMenu->addActions(appActions.toList());
+
+    if (!appActions.empty())
+        mOpenWithMenu->addSeparator();
+    mOpenWithMenu->addAction(mFileActions[menu_file_app_manager]);
+
+    return mOpenWithMenu;
+}
+
+QMenu *DkActionManager::createSortMenu(QWidget *parent)
+{
+    mSortMenu = new QMenu(QObject::tr("S&ort"), parent);
+    mSortMenu->addAction(mSortActions[menu_sort_filename]);
+    mSortMenu->addAction(mSortActions[menu_sort_file_size]);
+    mSortMenu->addAction(mSortActions[menu_sort_date_created]);
+    mSortMenu->addAction(mSortActions[menu_sort_date_modified]);
+    mSortMenu->addAction(mSortActions[menu_sort_random]);
+    mSortMenu->addSeparator();
+    mSortMenu->addAction(mSortActions[menu_sort_ascending]);
+    mSortMenu->addAction(mSortActions[menu_sort_descending]);
+
+    return mSortMenu;
+}
+
+QMenu *DkActionManager::createViewMenu(QWidget *parent /* = 0 */)
+{
+    mViewMenu = new QMenu(QObject::tr("&View"), parent);
+
+    mViewMenu->addAction(mViewActions[menu_view_frameless]);
+    mViewMenu->addAction(mViewActions[menu_view_fullscreen]);
+    mViewMenu->addSeparator();
+
+    mViewMenu->addAction(mViewActions[menu_view_new_tab]);
+    mViewMenu->addAction(mViewActions[menu_view_close_tab]);
+    mViewMenu->addAction(mViewActions[menu_view_close_all_tabs]);
+
+    if (DkSettingsManager::param().global().extendedTabs)
+        mViewMenu->addAction(mViewActions[menu_view_first_tab]);
+    mViewMenu->addAction(mViewActions[menu_view_previous_tab]);
+    if (DkSettingsManager::param().global().extendedTabs)
+        mViewMenu->addAction(mViewActions[menu_view_goto_tab]);
+    mViewMenu->addAction(mViewActions[menu_view_next_tab]);
+    if (DkSettingsManager::param().global().extendedTabs)
+        mViewMenu->addAction(mViewActions[menu_view_last_tab]);
+    mViewMenu->addSeparator();
+
+    mViewMenu->addAction(mViewActions[menu_view_reset]);
+    mViewMenu->addAction(mViewActions[menu_view_100]);
+    mViewMenu->addAction(mViewActions[menu_view_fit_frame]);
+    mViewMenu->addAction(mViewActions[menu_view_zoom_in]);
+    mViewMenu->addAction(mViewActions[menu_view_zoom_out]);
+    mViewMenu->addSeparator();
+
+    mViewMenu->addAction(mViewActions[menu_view_tp_pattern]);
+    mViewMenu->addAction(mViewActions[menu_view_anti_aliasing]);
+    mViewMenu->addSeparator();
+
+    mViewMenu->addAction(mViewActions[menu_view_opacity_change]);
+    mViewMenu->addAction(mViewActions[menu_view_opacity_up]);
+    mViewMenu->addAction(mViewActions[menu_view_opacity_down]);
+    mViewMenu->addAction(mViewActions[menu_view_opacity_an]);
 #ifdef Q_OS_WIN
-	mViewMenu->addAction(mViewActions[menu_view_lock_window]);
+    mViewMenu->addAction(mViewActions[menu_view_lock_window]);
 #endif
-	mViewMenu->addSeparator();
+    mViewMenu->addSeparator();
 
-	mViewMenu->addAction(mViewActions[menu_view_slideshow]);
-	mViewMenu->addAction(mViewActions[menu_view_movie_pause]);
-	mViewMenu->addAction(mViewActions[menu_view_movie_prev]);
-	mViewMenu->addAction(mViewActions[menu_view_movie_next]);
-	mViewMenu->addSeparator();
+    mViewMenu->addAction(mViewActions[menu_view_slideshow]);
+    mViewMenu->addAction(mViewActions[menu_view_movie_pause]);
+    mViewMenu->addAction(mViewActions[menu_view_movie_prev]);
+    mViewMenu->addAction(mViewActions[menu_view_movie_next]);
+    mViewMenu->addSeparator();
 
-	if (DkSettingsManager::param().app().currentAppMode == DkSettingsManager::param().mode_frameless) {
-		mViewMenu->addAction(mViewActions[menu_view_monitors]);
-		mViewMenu->addSeparator();
-	}
-	
-	mViewMenu->addAction(mViewActions[menu_view_gps_map]);
+    if (DkSettingsManager::param().app().currentAppMode == DkSettingsManager::param().mode_frameless) {
+        mViewMenu->addAction(mViewActions[menu_view_monitors]);
+        mViewMenu->addSeparator();
+    }
 
-	return mViewMenu;
-}
+    mViewMenu->addAction(mViewActions[menu_view_gps_map]);
 
-QMenu* DkActionManager::createEditMenu(QWidget* parent /* = 0 */) {
+    return mViewMenu;
+}
 
-	mEditMenu = new QMenu(QObject::tr("&Edit"), parent);
+QMenu *DkActionManager::createEditMenu(QWidget *parent /* = 0 */)
+{
+    mEditMenu = new QMenu(QObject::tr("&Edit"), parent);
 
-	mEditMenu->addAction(mEditActions[menu_edit_copy]);
-	mEditMenu->addAction(mEditActions[menu_edit_copy_buffer]);
-	mEditMenu->addAction(mEditActions[menu_edit_paste]);
-	mEditMenu->addAction(mEditActions[menu_edit_delete]);
-	mEditMenu->addSeparator();
-	mEditMenu->addAction(mEditActions[menu_edit_rotate_ccw]);
-	mEditMenu->addAction(mEditActions[menu_edit_rotate_cw]);
-	mEditMenu->addAction(mEditActions[menu_edit_rotate_180]);
-	mEditMenu->addSeparator();
-	mEditMenu->addAction(mEditActions[menu_edit_undo]);
-	mEditMenu->addAction(mEditActions[menu_edit_redo]);
-	mEditMenu->addSeparator();
-	mEditMenu->addAction(mEditActions[menu_edit_shortcuts]);
-	mEditMenu->addAction(mEditActions[menu_edit_preferences]);
+    mEditMenu->addAction(mEditActions[menu_edit_copy]);
+    mEditMenu->addAction(mEditActions[menu_edit_copy_buffer]);
+    mEditMenu->addAction(mEditActions[menu_edit_paste]);
+    mEditMenu->addAction(mEditActions[menu_edit_delete]);
+    mEditMenu->addSeparator();
+    mEditMenu->addAction(mEditActions[menu_edit_rotate_ccw]);
+    mEditMenu->addAction(mEditActions[menu_edit_rotate_cw]);
+    mEditMenu->addAction(mEditActions[menu_edit_rotate_180]);
+    mEditMenu->addSeparator();
+    mEditMenu->addAction(mEditActions[menu_edit_undo]);
+    mEditMenu->addAction(mEditActions[menu_edit_redo]);
+    mEditMenu->addSeparator();
+    mEditMenu->addAction(mEditActions[menu_edit_shortcuts]);
+    mEditMenu->addAction(mEditActions[menu_edit_preferences]);
 
-	return mEditMenu;
+    return mEditMenu;
 }
 
-QMenu * DkActionManager::createManipulatorMenu(QWidget * parent) {
-	
-	mManipulatorMenu = new QMenu(QObject::tr("&Adjustments"), parent);
-	
-	for (auto action : mManipulators.actions())
-		mManipulatorMenu->addAction(action);
+QMenu *DkActionManager::createManipulatorMenu(QWidget *parent)
+{
+    mManipulatorMenu = new QMenu(QObject::tr("&Adjustments"), parent);
 
-	mManipulatorMenu->addSeparator();
-	mManipulatorMenu->addAction(mEditActions[menu_edit_transform]);
-	mManipulatorMenu->addAction(mEditActions[menu_edit_crop]);
-	mManipulatorMenu->addSeparator();
-	mManipulatorMenu->addAction(mEditActions[menu_edit_image]);
+    for (auto action : mManipulators.actions())
+        mManipulatorMenu->addAction(action);
 
-	return mManipulatorMenu;
+    mManipulatorMenu->addSeparator();
+    mManipulatorMenu->addAction(mEditActions[menu_edit_transform]);
+    mManipulatorMenu->addAction(mEditActions[menu_edit_crop]);
+    mManipulatorMenu->addSeparator();
+    mManipulatorMenu->addAction(mEditActions[menu_edit_image]);
+
+    return mManipulatorMenu;
 }
 
-QMenu* DkActionManager::createPanelMenu(QWidget* parent) {
+QMenu *DkActionManager::createPanelMenu(QWidget *parent)
+{
+    mPanelMenu = new QMenu(QObject::tr("&Panels"), parent);
 
-	mPanelMenu = new QMenu(QObject::tr("&Panels"), parent);
-	
-	QMenu* toolsMenu = mPanelMenu->addMenu(QObject::tr("Tool&bars"));
-	toolsMenu->addAction(mPanelActions[menu_panel_menu]);
-	toolsMenu->addAction(mPanelActions[menu_panel_toolbar]);
-	toolsMenu->addAction(mPanelActions[menu_panel_statusbar]);
-	toolsMenu->addAction(mPanelActions[menu_panel_transfertoolbar]);
+    QMenu *toolsMenu = mPanelMenu->addMenu(QObject::tr("Tool&bars"));
+    toolsMenu->addAction(mPanelActions[menu_panel_menu]);
+    toolsMenu->addAction(mPanelActions[menu_panel_toolbar]);
+    toolsMenu->addAction(mPanelActions[menu_panel_statusbar]);
+    toolsMenu->addAction(mPanelActions[menu_panel_transfertoolbar]);
 
-	mPanelMenu->addAction(mPanelActions[menu_panel_explorer]);
-	mPanelMenu->addAction(mPanelActions[menu_panel_metadata_dock]);
-	mPanelMenu->addAction(mPanelActions[menu_panel_exif]);
-	mPanelMenu->addAction(mPanelActions[menu_panel_history]);
-	mPanelMenu->addAction(mPanelActions[menu_panel_preview]);
-	mPanelMenu->addAction(mPanelActions[menu_panel_thumbview]);
-	mPanelMenu->addAction(mPanelActions[menu_panel_scroller]);
-	mPanelMenu->addAction(mPanelActions[menu_panel_log]);
+    mPanelMenu->addAction(mPanelActions[menu_panel_explorer]);
+    mPanelMenu->addAction(mPanelActions[menu_panel_metadata_dock]);
+    mPanelMenu->addAction(mPanelActions[menu_panel_exif]);
+    mPanelMenu->addAction(mPanelActions[menu_panel_history]);
+    mPanelMenu->addAction(mPanelActions[menu_panel_preview]);
+    mPanelMenu->addAction(mPanelActions[menu_panel_thumbview]);
+    mPanelMenu->addAction(mPanelActions[menu_panel_scroller]);
+    mPanelMenu->addAction(mPanelActions[menu_panel_log]);
 
-	mPanelMenu->addSeparator();
+    mPanelMenu->addSeparator();
 
-	mPanelMenu->addAction(mPanelActions[menu_panel_overview]);
-	mPanelMenu->addAction(mPanelActions[menu_panel_player]);
-	mPanelMenu->addAction(mPanelActions[menu_panel_info]);
-	mPanelMenu->addAction(mPanelActions[menu_panel_histogram]);
-	mPanelMenu->addAction(mPanelActions[menu_panel_comment]);
+    mPanelMenu->addAction(mPanelActions[menu_panel_overview]);
+    mPanelMenu->addAction(mPanelActions[menu_panel_player]);
+    mPanelMenu->addAction(mPanelActions[menu_panel_info]);
+    mPanelMenu->addAction(mPanelActions[menu_panel_histogram]);
+    mPanelMenu->addAction(mPanelActions[menu_panel_comment]);
 
-	mPanelMenu->addSeparator();
-	mPanelMenu->addAction(mPanelActions[menu_panel_toggle]);
+    mPanelMenu->addSeparator();
+    mPanelMenu->addAction(mPanelActions[menu_panel_toggle]);
 
-	return mPanelMenu;
+    return mPanelMenu;
 }
 
-QMenu* DkActionManager::createToolsMenu(QWidget* parent /* = 0 */) {
+QMenu *DkActionManager::createToolsMenu(QWidget *parent /* = 0 */)
+{
+    mToolsMenu = new QMenu(QObject::tr("&Tools"), parent);
 
-	mToolsMenu = new QMenu(QObject::tr("&Tools"), parent);
-	
 #ifdef WITH_LIBTIFF
-	mToolsMenu->addAction(mToolsActions[menu_tools_export_tiff]);
+    mToolsMenu->addAction(mToolsActions[menu_tools_export_tiff]);
 #endif
 #ifdef WITH_QUAZIP
-	mToolsMenu->addAction(mToolsActions[menu_tools_extract_archive]);
+    mToolsMenu->addAction(mToolsActions[menu_tools_extract_archive]);
 #endif
 #ifdef WITH_OPENCV
-	mToolsMenu->addAction(mToolsActions[menu_tools_mosaic]);
+    mToolsMenu->addAction(mToolsActions[menu_tools_mosaic]);
 #endif
 #ifdef Q_OS_WIN
-	mToolsMenu->addAction(mToolsActions[menu_tools_wallpaper]);
-	mToolsMenu->addSeparator();
+    mToolsMenu->addAction(mToolsActions[menu_tools_wallpaper]);
+    mToolsMenu->addSeparator();
 #endif
-	mToolsMenu->addAction(mToolsActions[menu_tools_batch]);
-	mToolsMenu->addAction(mToolsActions[menu_tools_thumbs]);
-	mToolsMenu->addAction(mToolsActions[menu_tools_train_format]);
+    mToolsMenu->addAction(mToolsActions[menu_tools_batch]);
+    mToolsMenu->addAction(mToolsActions[menu_tools_thumbs]);
+    mToolsMenu->addAction(mToolsActions[menu_tools_train_format]);
 
-	return mToolsMenu;
+    return mToolsMenu;
 }
 
-QMenu* DkActionManager::createHelpMenu(QWidget* parent) {
-
-	mHelpMenu = new QMenu(QObject::tr("&?"), parent);
+QMenu *DkActionManager::createHelpMenu(QWidget *parent)
+{
+    mHelpMenu = new QMenu(QObject::tr("&?"), parent);
 
 #ifndef Q_OS_LINUX
-	mHelpMenu->addAction(mHelpActions[menu_help_update]);
+    mHelpMenu->addAction(mHelpActions[menu_help_update]);
 #endif // !Q_OS_LINUX
-	mHelpMenu->addAction(mHelpActions[menu_help_update_translation]);
-	mHelpMenu->addSeparator();
-	mHelpMenu->addAction(mHelpActions[menu_help_bug]);
-	mHelpMenu->addAction(mHelpActions[menu_help_documentation]);
-	mHelpMenu->addAction(mHelpActions[menu_help_about]);
-
-	return mHelpMenu;
-}
-
-QMenu* DkActionManager::createSyncMenu(QWidget * parent) {
-	
-	mSyncMenu = new QMenu(QObject::tr("&Sync"), parent);
-
-	// local host menu
-	mLocalMenu = new DkTcpMenu(QObject::tr("&Synchronize"), mSyncMenu);
-	mLocalMenu->showNoClientsFound(true);
-	
-	// add connect all action
-	mLocalMenu->addTcpAction(mSyncActions[menu_sync_connect_all]);
-
-	mSyncMenu->addMenu(mLocalMenu);
-	mSyncMenu->addAction(mSyncActions[menu_sync_view]);
-	mSyncMenu->addAction(mSyncActions[menu_sync_pos]);
-	mSyncMenu->addAction(mSyncActions[menu_sync_arrange]);
-	mSyncMenu->addAction(mSyncActions[menu_sync_all_actions]);
-
-	return mSyncMenu;
-}
-
-QMenu* DkActionManager::createContextMenu(QWidget* parent) {
-
-
-	mContextMenu = new QMenu(parent);
-
-	mContextMenu->addAction(mEditActions[menu_edit_copy_buffer]);
-	mContextMenu->addAction(mEditActions[menu_edit_copy]);
-	mContextMenu->addAction(mEditActions[menu_edit_copy_color]);
-	mContextMenu->addAction(mEditActions[menu_edit_paste]);
-	mContextMenu->addSeparator();
-
-	mContextMenu->addAction(mViewActions[menu_view_frameless]);
-	mContextMenu->addAction(mViewActions[menu_view_fullscreen]);
-	mContextMenu->addAction(mPanelActions[menu_panel_menu]);
-	mContextMenu->addSeparator();
-
-	if (DkSettingsManager::param().global().extendedTabs) {
-		mContextMenu->addAction(mViewActions[menu_view_first_tab]);
-		mContextMenu->addAction(mViewActions[menu_view_goto_tab]);
-		mContextMenu->addAction(mViewActions[menu_view_last_tab]);
-		mContextMenu->addSeparator();
-	}
-
-	QMenu* panelMenu = mContextMenu->addMenu(QObject::tr("&Panels"));
-	panelMenu->addAction(mPanelActions[menu_panel_toggle]);
-	panelMenu->addAction(mPanelActions[menu_panel_explorer]);
-	panelMenu->addAction(mPanelActions[menu_panel_metadata_dock]);
-	panelMenu->addAction(mPanelActions[menu_panel_preview]);
-	panelMenu->addAction(mPanelActions[menu_panel_thumbview]);
-	panelMenu->addAction(mPanelActions[menu_panel_scroller]);
-	panelMenu->addAction(mPanelActions[menu_panel_exif]);
-	panelMenu->addAction(mPanelActions[menu_panel_overview]);
-	panelMenu->addAction(mPanelActions[menu_panel_player]);
-	panelMenu->addAction(mPanelActions[menu_panel_info]);
-	panelMenu->addAction(mPanelActions[menu_panel_histogram]);
-	panelMenu->addAction(mPanelActions[menu_panel_comment]);
-
-	mContextMenu->addMenu(sortMenu());
-
-	QMenu* viewContextMenu = mContextMenu->addMenu(QObject::tr("&View"));
-	viewContextMenu->addAction(mViewActions[menu_view_fullscreen]);
-	viewContextMenu->addAction(mViewActions[menu_view_reset]);
-	viewContextMenu->addAction(mViewActions[menu_view_100]);
-	viewContextMenu->addAction(mViewActions[menu_view_fit_frame]);
-
-	QMenu* editContextMenu = mContextMenu->addMenu(QObject::tr("&Edit"));
-	editContextMenu->addAction(mEditActions[menu_edit_image]);
-	editContextMenu->addSeparator();
-	editContextMenu->addAction(mEditActions[menu_edit_undo]);
-	editContextMenu->addAction(mEditActions[menu_edit_redo]);
-	editContextMenu->addSeparator();
-	editContextMenu->addAction(mEditActions[menu_edit_rotate_cw]);
-	editContextMenu->addAction(mEditActions[menu_edit_rotate_ccw]);
-	editContextMenu->addAction(mEditActions[menu_edit_rotate_180]);
-	editContextMenu->addSeparator();
-	editContextMenu->addAction(mEditActions[menu_edit_transform]);
-	editContextMenu->addAction(mEditActions[menu_edit_crop]);
-	editContextMenu->addAction(mEditActions[menu_edit_delete]);
-
-	mContextMenu->addMenu(mOpenWithMenu);
-
-	mContextMenu->addSeparator();
-	mContextMenu->addAction(mEditActions[menu_edit_preferences]);
-
-	return mContextMenu;
+    mHelpMenu->addAction(mHelpActions[menu_help_update_translation]);
+    mHelpMenu->addSeparator();
+    mHelpMenu->addAction(mHelpActions[menu_help_bug]);
+    mHelpMenu->addAction(mHelpActions[menu_help_documentation]);
+    mHelpMenu->addAction(mHelpActions[menu_help_about]);
+
+    return mHelpMenu;
+}
+
+QMenu *DkActionManager::createSyncMenu(QWidget *parent)
+{
+    mSyncMenu = new QMenu(QObject::tr("&Sync"), parent);
+
+    // local host menu
+    mLocalMenu = new DkTcpMenu(QObject::tr("&Synchronize"), mSyncMenu);
+    mLocalMenu->showNoClientsFound(true);
+
+    // add connect all action
+    mLocalMenu->addTcpAction(mSyncActions[menu_sync_connect_all]);
+
+    mSyncMenu->addMenu(mLocalMenu);
+    mSyncMenu->addAction(mSyncActions[menu_sync_view]);
+    mSyncMenu->addAction(mSyncActions[menu_sync_pos]);
+    mSyncMenu->addAction(mSyncActions[menu_sync_arrange]);
+    mSyncMenu->addAction(mSyncActions[menu_sync_all_actions]);
+
+    return mSyncMenu;
+}
+
+QMenu *DkActionManager::createContextMenu(QWidget *parent)
+{
+    mContextMenu = new QMenu(parent);
+
+    mContextMenu->addAction(mEditActions[menu_edit_copy_buffer]);
+    mContextMenu->addAction(mEditActions[menu_edit_copy]);
+    mContextMenu->addAction(mEditActions[menu_edit_copy_color]);
+    mContextMenu->addAction(mEditActions[menu_edit_paste]);
+    mContextMenu->addSeparator();
+
+    mContextMenu->addAction(mViewActions[menu_view_frameless]);
+    mContextMenu->addAction(mViewActions[menu_view_fullscreen]);
+    mContextMenu->addAction(mPanelActions[menu_panel_menu]);
+    mContextMenu->addSeparator();
+
+    if (DkSettingsManager::param().global().extendedTabs) {
+        mContextMenu->addAction(mViewActions[menu_view_first_tab]);
+        mContextMenu->addAction(mViewActions[menu_view_goto_tab]);
+        mContextMenu->addAction(mViewActions[menu_view_last_tab]);
+        mContextMenu->addSeparator();
+    }
+
+    QMenu *panelMenu = mContextMenu->addMenu(QObject::tr("&Panels"));
+    panelMenu->addAction(mPanelActions[menu_panel_toggle]);
+    panelMenu->addAction(mPanelActions[menu_panel_explorer]);
+    panelMenu->addAction(mPanelActions[menu_panel_metadata_dock]);
+    panelMenu->addAction(mPanelActions[menu_panel_preview]);
+    panelMenu->addAction(mPanelActions[menu_panel_thumbview]);
+    panelMenu->addAction(mPanelActions[menu_panel_scroller]);
+    panelMenu->addAction(mPanelActions[menu_panel_exif]);
+    panelMenu->addAction(mPanelActions[menu_panel_overview]);
+    panelMenu->addAction(mPanelActions[menu_panel_player]);
+    panelMenu->addAction(mPanelActions[menu_panel_info]);
+    panelMenu->addAction(mPanelActions[menu_panel_histogram]);
+    panelMenu->addAction(mPanelActions[menu_panel_comment]);
+
+    mContextMenu->addMenu(sortMenu());
+
+    QMenu *viewContextMenu = mContextMenu->addMenu(QObject::tr("&View"));
+    viewContextMenu->addAction(mViewActions[menu_view_fullscreen]);
+    viewContextMenu->addAction(mViewActions[menu_view_reset]);
+    viewContextMenu->addAction(mViewActions[menu_view_100]);
+    viewContextMenu->addAction(mViewActions[menu_view_fit_frame]);
+
+    QMenu *editContextMenu = mContextMenu->addMenu(QObject::tr("&Edit"));
+    editContextMenu->addAction(mEditActions[menu_edit_image]);
+    editContextMenu->addSeparator();
+    editContextMenu->addAction(mEditActions[menu_edit_undo]);
+    editContextMenu->addAction(mEditActions[menu_edit_redo]);
+    editContextMenu->addSeparator();
+    editContextMenu->addAction(mEditActions[menu_edit_rotate_cw]);
+    editContextMenu->addAction(mEditActions[menu_edit_rotate_ccw]);
+    editContextMenu->addAction(mEditActions[menu_edit_rotate_180]);
+    editContextMenu->addSeparator();
+    editContextMenu->addAction(mEditActions[menu_edit_transform]);
+    editContextMenu->addAction(mEditActions[menu_edit_crop]);
+    editContextMenu->addAction(mEditActions[menu_edit_delete]);
+
+    mContextMenu->addMenu(mOpenWithMenu);
+
+    mContextMenu->addSeparator();
+    mContextMenu->addAction(mEditActions[menu_edit_preferences]);
+
+    return mContextMenu;
 }
 
 // TODO: fix that once and for all
-//QMenu* DkActionManager::pluginMenu(QWidget* parent) const {
-//	
+// QMenu* DkActionManager::pluginMenu(QWidget* parent) const {
+//
 //	if (!mPluginMenu)
 //		mPluginMenu = new QMenu(QObject::tr("&Plugins"), parent);
 //
 //	return mPluginMenu;
 //}
 
-QAction* DkActionManager::action(FileMenuActions action) const {
-	return mFileActions[action];
+QAction *DkActionManager::action(FileMenuActions action) const
+{
+    return mFileActions[action];
 }
 
-QAction* DkActionManager::action(SortMenuActions action) const {
-	return mSortActions[action];
+QAction *DkActionManager::action(SortMenuActions action) const
+{
+    return mSortActions[action];
 }
 
-QAction* DkActionManager::action(ViewMenuActions action) const {
-	return mViewActions[action];
+QAction *DkActionManager::action(ViewMenuActions action) const
+{
+    return mViewActions[action];
 }
 
-QAction* DkActionManager::action(EditMenuActions action) const {
-	return mEditActions[action];
+QAction *DkActionManager::action(EditMenuActions action) const
+{
+    return mEditActions[action];
 }
 
-QAction* DkActionManager::action(ToolsMenuActions action) const {
-	return mToolsActions[action];
+QAction *DkActionManager::action(ToolsMenuActions action) const
+{
+    return mToolsActions[action];
 }
 
-QAction* DkActionManager::action(PanelMenuActions action) const {
-	return mPanelActions[action];
+QAction *DkActionManager::action(PanelMenuActions action) const
+{
+    return mPanelActions[action];
 }
 
-QAction* DkActionManager::action(SyncMenuActions action) const {
-	return mSyncActions[action];
+QAction *DkActionManager::action(SyncMenuActions action) const
+{
+    return mSyncActions[action];
 }
 
-QAction* DkActionManager::action(HelpMenuActions action) const {
-	return mHelpActions[action];
+QAction *DkActionManager::action(HelpMenuActions action) const
+{
+    return mHelpActions[action];
 }
 
-QAction* DkActionManager::action(PluginMenuActions action) const {
-	return mPluginActions[action];
+QAction *DkActionManager::action(PluginMenuActions action) const
+{
+    return mPluginActions[action];
 }
 
-QAction* DkActionManager::action(HiddenActions action) const {
-	return mHiddenActions[action];
+QAction *DkActionManager::action(HiddenActions action) const
+{
+    return mHiddenActions[action];
 }
 
-QAction* DkActionManager::action(PreviewActions action) const {
-	return mPreviewActions[action];
+QAction *DkActionManager::action(PreviewActions action) const
+{
+    return mPreviewActions[action];
 }
 
-QIcon DkActionManager::icon(FileIcons icon) const {
-	return mFileIcons[icon];
+QIcon DkActionManager::icon(FileIcons icon) const
+{
+    return mFileIcons[icon];
 }
 
-QIcon DkActionManager::icon(ViewIcons icon) const {
-	return mViewIcons[icon];
+QIcon DkActionManager::icon(ViewIcons icon) const
+{
+    return mViewIcons[icon];
 }
 
-QIcon DkActionManager::icon(EditIcons icon) const {
-	return mEditIcons[icon];
+QIcon DkActionManager::icon(EditIcons icon) const
+{
+    return mEditIcons[icon];
 }
 
-QVector<QAction*> DkActionManager::fileActions() const {
-	return mFileActions;
+QVector<QAction *> DkActionManager::fileActions() const
+{
+    return mFileActions;
 }
 
-QVector<QAction*> DkActionManager::sortActions() const {
-	return mSortActions;
+QVector<QAction *> DkActionManager::sortActions() const
+{
+    return mSortActions;
 }
 
-QVector<QAction*> DkActionManager::openWithActions() const {
-	
-	if (!openWithMenu())
-		return QVector<QAction*>();
+QVector<QAction *> DkActionManager::openWithActions() const
+{
+    if (!openWithMenu())
+        return QVector<QAction *>();
 
-	QList<QAction* > openWithActionList = openWithMenu()->actions();
-	QVector<QAction* > owas;
+    QList<QAction *> openWithActionList = openWithMenu()->actions();
+    QVector<QAction *> owas;
 
-	// the separator creates a NULL action?! - remove it here...
-	for (auto a : openWithActionList)
-		if (!a->text().isNull())
-			owas << a;
-	
-	return owas;
-}
+    // the separator creates a NULL action?! - remove it here...
+    for (auto a : openWithActionList)
+        if (!a->text().isNull())
+            owas << a;
 
-QVector<QAction*> DkActionManager::viewActions() const {
-	return mViewActions;
+    return owas;
 }
 
-QVector<QAction*> DkActionManager::editActions() const {
-	return mEditActions;
+QVector<QAction *> DkActionManager::viewActions() const
+{
+    return mViewActions;
 }
 
-QVector<QAction*> DkActionManager::toolsActions() const {
-	return mToolsActions;
+QVector<QAction *> DkActionManager::editActions() const
+{
+    return mEditActions;
 }
 
-QVector<QAction*> DkActionManager::panelActions() const {
-	return mPanelActions;
+QVector<QAction *> DkActionManager::toolsActions() const
+{
+    return mToolsActions;
 }
 
-QVector<QAction*> DkActionManager::syncActions() const {
-	return mSyncActions;
+QVector<QAction *> DkActionManager::panelActions() const
+{
+    return mPanelActions;
 }
 
-QVector<QAction*> DkActionManager::helpActions() const {
-	return mHelpActions;
+QVector<QAction *> DkActionManager::syncActions() const
+{
+    return mSyncActions;
 }
 
-QVector<QAction*> DkActionManager::pluginActions() const {
-	return mPluginActions;
+QVector<QAction *> DkActionManager::helpActions() const
+{
+    return mHelpActions;
 }
 
-QVector<QAction*> DkActionManager::hiddenActions() const {
-	return mHiddenActions;
+QVector<QAction *> DkActionManager::pluginActions() const
+{
+    return mPluginActions;
 }
 
-QVector<QAction*> DkActionManager::previewActions() const {
-	return mPreviewActions;
+QVector<QAction *> DkActionManager::hiddenActions() const
+{
+    return mHiddenActions;
 }
 
-QVector<QAction*> DkActionManager::manipulatorActions() const {
-	return mManipulators.actions();
+QVector<QAction *> DkActionManager::previewActions() const
+{
+    return mPreviewActions;
 }
 
-DkAppManager* DkActionManager::appManager() const {
-	return mAppManager;
+QVector<QAction *> DkActionManager::manipulatorActions() const
+{
+    return mManipulators.actions();
 }
 
-DkPluginActionManager* DkActionManager::pluginActionManager() const {
-	return mPluginManager;
+DkAppManager *DkActionManager::appManager() const
+{
+    return mAppManager;
 }
 
-QMenu* DkActionManager::fileMenu() const {
-	return mFileMenu;
+DkPluginActionManager *DkActionManager::pluginActionManager() const
+{
+    return mPluginManager;
 }
 
-QMenu* DkActionManager::sortMenu() const {
-	return mSortMenu;
+QMenu *DkActionManager::fileMenu() const
+{
+    return mFileMenu;
 }
 
-QMenu* DkActionManager::openWithMenu() const {
-	return mOpenWithMenu;
+QMenu *DkActionManager::sortMenu() const
+{
+    return mSortMenu;
 }
 
-QMenu* DkActionManager::viewMenu() const {
-	return mViewMenu;
+QMenu *DkActionManager::openWithMenu() const
+{
+    return mOpenWithMenu;
 }
 
-QMenu* DkActionManager::editMenu() const {
-	return mEditMenu;
+QMenu *DkActionManager::viewMenu() const
+{
+    return mViewMenu;
 }
 
-QMenu* DkActionManager::toolsMenu() const {
-	return mToolsMenu;
+QMenu *DkActionManager::editMenu() const
+{
+    return mEditMenu;
 }
 
-QMenu* DkActionManager::panelMenu() const {
-	return mPanelMenu;
+QMenu *DkActionManager::toolsMenu() const
+{
+    return mToolsMenu;
 }
 
-QMenu* DkActionManager::helpMenu() const {
-	return mHelpMenu;
+QMenu *DkActionManager::panelMenu() const
+{
+    return mPanelMenu;
 }
 
-QMenu* DkActionManager::contextMenu() const {
-	return mContextMenu;
+QMenu *DkActionManager::helpMenu() const
+{
+    return mHelpMenu;
 }
 
-QMenu* DkActionManager::syncMenu() const {
-	return mSyncMenu;
+QMenu *DkActionManager::contextMenu() const
+{
+    return mContextMenu;
 }
 
-QMenu * DkActionManager::manipulatorMenu() const {
-	return mManipulatorMenu;
+QMenu *DkActionManager::syncMenu() const
+{
+    return mSyncMenu;
 }
 
-DkTcpMenu* DkActionManager::localMenu() const {
-	return mLocalMenu;
+QMenu *DkActionManager::manipulatorMenu() const
+{
+    return mManipulatorMenu;
 }
 
-DkManipulatorManager DkActionManager::manipulatorManager() const {
-	return mManipulators;
+DkTcpMenu *DkActionManager::localMenu() const
+{
+    return mLocalMenu;
 }
 
-void DkActionManager::createMenus(QWidget* parent) {
-
-	createSortMenu(parent);
-	createOpenWithMenu(parent);
-	createFileMenu(parent);
-	createViewMenu(parent);
-	createEditMenu(parent);
-	createManipulatorMenu(parent);
-	createToolsMenu(parent);
-	createPanelMenu(parent);
-	createSyncMenu(parent);
-	createHelpMenu(parent);
-	createContextMenu(parent);
+DkManipulatorManager DkActionManager::manipulatorManager() const
+{
+    return mManipulators;
 }
 
-void DkActionManager::init() {
+void DkActionManager::createMenus(QWidget *parent)
+{
+    createSortMenu(parent);
+    createOpenWithMenu(parent);
+    createFileMenu(parent);
+    createViewMenu(parent);
+    createEditMenu(parent);
+    createManipulatorMenu(parent);
+    createToolsMenu(parent);
+    createPanelMenu(parent);
+    createSyncMenu(parent);
+    createHelpMenu(parent);
+    createContextMenu(parent);
+}
 
-	mAppManager = new DkAppManager(DkUtils::getMainWindow());
+void DkActionManager::init()
+{
+    mAppManager = new DkAppManager(DkUtils::getMainWindow());
 
 #ifdef WITH_PLUGINS
-	mPluginManager = new DkPluginActionManager(DkUtils::getMainWindow());
+    mPluginManager = new DkPluginActionManager(DkUtils::getMainWindow());
 #endif
 
-	createIcons();
-}
-
-void DkActionManager::createIcons() {
-
-	mFileIcons.resize(icon_file_end);
-	mFileIcons[icon_file_dir] = DkImage::loadIcon(":/nomacs/img/dir.svg");
-	mFileIcons[icon_file_open] = DkImage::loadIcon(":/nomacs/img/open.svg");
-	mFileIcons[icon_file_save] = DkImage::loadIcon(":/nomacs/img/save.svg");
-	mFileIcons[icon_file_print] = DkImage::loadIcon(":/nomacs/img/print.svg");
-	mFileIcons[icon_file_open_large] = QIcon(":/nomacs/img/open.svg");
-	mFileIcons[icon_file_dir_large] = QIcon(":/nomacs/img/dir.svg");
-	mFileIcons[icon_file_prev] = DkImage::loadIcon(":/nomacs/img/previous.svg");
-	mFileIcons[icon_file_next] = DkImage::loadIcon(":/nomacs/img/next.svg");
-	mFileIcons[icon_file_filter] = DkImage::loadIcon();
-	mFileIcons[icon_file_filter].addPixmap(DkImage::loadIcon(":/nomacs/img/filter.svg"), QIcon::Normal, QIcon::On);
-	mFileIcons[icon_file_filter].addPixmap(DkImage::loadIcon(":/nomacs/img/filter-disabled.svg"), QIcon::Normal, QIcon::Off);
-	mFileIcons[icon_file_find] = DkImage::loadIcon(":/nomacs/img/find.svg");
-
-	mEditIcons.resize(icon_edit_end);
-	mEditIcons[icon_edit_image] = DkImage::loadIcon(":/nomacs/img/sliders.svg");
-	mEditIcons[icon_edit_rotate_cw] = DkImage::loadIcon(":/nomacs/img/rotate-cw.svg");
-	mEditIcons[icon_edit_rotate_ccw] = DkImage::loadIcon(":/nomacs/img/rotate-cc.svg");
-	mEditIcons[icon_edit_crop] = DkImage::loadIcon(":/nomacs/img/crop.svg");
-	mEditIcons[icon_edit_resize] = DkImage::loadIcon(":/nomacs/img/resize.svg");
-	mEditIcons[icon_edit_copy] = DkImage::loadIcon(":/nomacs/img/copy.svg");
-	mEditIcons[icon_edit_paste] = DkImage::loadIcon(":/nomacs/img/paste.svg");
-	mEditIcons[icon_edit_delete] = DkImage::loadIcon(":/nomacs/img/trash.svg");
-
-	mViewIcons.resize(icon_view_end);
-	mViewIcons[icon_view_fullscreen] = DkImage::loadIcon(":/nomacs/img/fullscreen.svg");
-	mViewIcons[icon_view_reset] = DkImage::loadIcon(":/nomacs/img/zoom-reset.svg");
-	mViewIcons[icon_view_100] = DkImage::loadIcon(":/nomacs/img/zoom-100.svg");
-	mViewIcons[icon_view_gps] = DkImage::loadIcon(":/nomacs/img/location.svg");
-	mViewIcons[icon_view_zoom_in] = DkImage::loadIcon(":/nomacs/img/zoom-in.svg");
-	mViewIcons[icon_view_zoom_out] = DkImage::loadIcon(":/nomacs/img/zoom-out.svg");
-
-	mViewIcons[icon_view_movie_play] = DkImage::loadIcon(":/nomacs/img/play.svg");
-	mViewIcons[icon_view_movie_play].addPixmap(DkImage::loadIcon(":/nomacs/img/play.svg"), QIcon::Normal, QIcon::On);
-	mViewIcons[icon_view_movie_play].addPixmap(DkImage::loadIcon(":/nomacs/img/pause.svg"), QIcon::Normal, QIcon::Off);
-	mViewIcons[icon_view_movie_prev] = DkImage::loadIcon(":/nomacs/img/previous.svg");
-	mViewIcons[icon_view_movie_next] = DkImage::loadIcon(":/nomacs/img/next.svg");
-}
-
-void DkActionManager::createActions(QWidget* parent) {
-
-	// file actions
-	mFileActions.resize(menu_file_end);
-
-	mFileActions[menu_file_open] = new QAction(mFileIcons[icon_file_open], QObject::tr("&Open"), parent);
-	mFileActions[menu_file_open]->setShortcuts(QKeySequence::Open);
-	mFileActions[menu_file_open]->setStatusTip(QObject::tr("Open an image"));
-
-	mFileActions[menu_file_open_dir] = new QAction(mFileIcons[icon_file_dir], QObject::tr("Open &Directory"), parent);
-	mFileActions[menu_file_open_dir]->setShortcut(QKeySequence(shortcut_open_dir));
-	mFileActions[menu_file_open_dir]->setStatusTip(QObject::tr("Open a directory and load its first image"));
-
-	mFileActions[menu_file_open_list] = new QAction(QObject::tr("&Open Tabs"), parent);
-	mFileActions[menu_file_open_list]->setStatusTip(QObject::tr("Open a texfile containing a list of filepaths, and open tabs for them"));
-
-	mFileActions[menu_file_quick_launch] = new QAction(QObject::tr("&Quick Launch"), parent);
-	mFileActions[menu_file_quick_launch]->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+    createIcons();
+}
+
+void DkActionManager::createIcons()
+{
+    mFileIcons.resize(icon_file_end);
+    mFileIcons[icon_file_dir] = DkImage::loadIcon(":/nomacs/img/dir.svg");
+    mFileIcons[icon_file_open] = DkImage::loadIcon(":/nomacs/img/open.svg");
+    mFileIcons[icon_file_save] = DkImage::loadIcon(":/nomacs/img/save.svg");
+    mFileIcons[icon_file_print] = DkImage::loadIcon(":/nomacs/img/print.svg");
+    mFileIcons[icon_file_open_large] = QIcon(":/nomacs/img/open.svg");
+    mFileIcons[icon_file_dir_large] = QIcon(":/nomacs/img/dir.svg");
+    mFileIcons[icon_file_prev] = DkImage::loadIcon(":/nomacs/img/previous.svg");
+    mFileIcons[icon_file_next] = DkImage::loadIcon(":/nomacs/img/next.svg");
+    mFileIcons[icon_file_filter] = DkImage::loadIcon();
+    mFileIcons[icon_file_filter].addPixmap(DkImage::loadIcon(":/nomacs/img/filter.svg"), QIcon::Normal, QIcon::On);
+    mFileIcons[icon_file_filter].addPixmap(DkImage::loadIcon(":/nomacs/img/filter-disabled.svg"), QIcon::Normal, QIcon::Off);
+    mFileIcons[icon_file_find] = DkImage::loadIcon(":/nomacs/img/find.svg");
+
+    mEditIcons.resize(icon_edit_end);
+    mEditIcons[icon_edit_image] = DkImage::loadIcon(":/nomacs/img/sliders.svg");
+    mEditIcons[icon_edit_rotate_cw] = DkImage::loadIcon(":/nomacs/img/rotate-cw.svg");
+    mEditIcons[icon_edit_rotate_ccw] = DkImage::loadIcon(":/nomacs/img/rotate-cc.svg");
+    mEditIcons[icon_edit_crop] = DkImage::loadIcon(":/nomacs/img/crop.svg");
+    mEditIcons[icon_edit_resize] = DkImage::loadIcon(":/nomacs/img/resize.svg");
+    mEditIcons[icon_edit_copy] = DkImage::loadIcon(":/nomacs/img/copy.svg");
+    mEditIcons[icon_edit_paste] = DkImage::loadIcon(":/nomacs/img/paste.svg");
+    mEditIcons[icon_edit_delete] = DkImage::loadIcon(":/nomacs/img/trash.svg");
+
+    mViewIcons.resize(icon_view_end);
+    mViewIcons[icon_view_fullscreen] = DkImage::loadIcon(":/nomacs/img/fullscreen.svg");
+    mViewIcons[icon_view_reset] = DkImage::loadIcon(":/nomacs/img/zoom-reset.svg");
+    mViewIcons[icon_view_100] = DkImage::loadIcon(":/nomacs/img/zoom-100.svg");
+    mViewIcons[icon_view_gps] = DkImage::loadIcon(":/nomacs/img/location.svg");
+    mViewIcons[icon_view_zoom_in] = DkImage::loadIcon(":/nomacs/img/zoom-in.svg");
+    mViewIcons[icon_view_zoom_out] = DkImage::loadIcon(":/nomacs/img/zoom-out.svg");
+
+    mViewIcons[icon_view_movie_play] = DkImage::loadIcon(":/nomacs/img/play.svg");
+    mViewIcons[icon_view_movie_play].addPixmap(DkImage::loadIcon(":/nomacs/img/play.svg"), QIcon::Normal, QIcon::On);
+    mViewIcons[icon_view_movie_play].addPixmap(DkImage::loadIcon(":/nomacs/img/pause.svg"), QIcon::Normal, QIcon::Off);
+    mViewIcons[icon_view_movie_prev] = DkImage::loadIcon(":/nomacs/img/previous.svg");
+    mViewIcons[icon_view_movie_next] = DkImage::loadIcon(":/nomacs/img/next.svg");
+}
+
+void DkActionManager::createActions(QWidget *parent)
+{
+    // file actions
+    mFileActions.resize(menu_file_end);
+
+    mFileActions[menu_file_open] = new QAction(mFileIcons[icon_file_open], QObject::tr("&Open"), parent);
+    mFileActions[menu_file_open]->setShortcuts(QKeySequence::Open);
+    mFileActions[menu_file_open]->setStatusTip(QObject::tr("Open an image"));
+
+    mFileActions[menu_file_open_dir] = new QAction(mFileIcons[icon_file_dir], QObject::tr("Open &Directory"), parent);
+    mFileActions[menu_file_open_dir]->setShortcut(QKeySequence(shortcut_open_dir));
+    mFileActions[menu_file_open_dir]->setStatusTip(QObject::tr("Open a directory and load its first image"));
+
+    mFileActions[menu_file_open_list] = new QAction(QObject::tr("&Open Tabs"), parent);
+    mFileActions[menu_file_open_list]->setStatusTip(QObject::tr("Open a texfile containing a list of filepaths, and open tabs for them"));
+
+    mFileActions[menu_file_quick_launch] = new QAction(QObject::tr("&Quick Launch"), parent);
+    mFileActions[menu_file_quick_launch]->setShortcutContext(Qt::WidgetWithChildrenShortcut);
 #ifdef Q_OS_WIN
-	mFileActions[menu_file_quick_launch]->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
+    mFileActions[menu_file_quick_launch]->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
 #else
-	mFileActions[menu_file_quick_launch]->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L));
+    mFileActions[menu_file_quick_launch]->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L));
 #endif
-	mFileActions[menu_file_app_manager] = new QAction(QObject::tr("&Manage Applications"), parent);
-	mFileActions[menu_file_app_manager]->setStatusTip(QObject::tr("Manage Applications which are Automatically Opened"));
-	mFileActions[menu_file_app_manager]->setShortcut(QKeySequence(shortcut_app_manager));
-
-	mFileActions[menu_file_rename] = new QAction(QObject::tr("Re&name"), parent);
-	mFileActions[menu_file_rename]->setShortcutContext(Qt::WidgetWithChildrenShortcut);
-	mFileActions[menu_file_rename]->setShortcut(QKeySequence(shortcut_rename));
-	mFileActions[menu_file_rename]->setStatusTip(QObject::tr("Rename an image"));
-
-	mFileActions[menu_file_goto] = new QAction(QObject::tr("&Go To"), parent);
-	mFileActions[menu_file_goto]->setShortcut(QKeySequence(shortcut_goto));
-	mFileActions[menu_file_goto]->setStatusTip(QObject::tr("Go To an image"));
-
-	mFileActions[menu_file_save] = new QAction(mFileIcons[icon_file_save], QObject::tr("&Save"), parent);
-	mFileActions[menu_file_save]->setShortcuts(QKeySequence::Save);
-	mFileActions[menu_file_save]->setStatusTip(QObject::tr("Save an image"));
-
-	mFileActions[menu_file_save_as] = new QAction(QObject::tr("S&ave As"), parent);
-	mFileActions[menu_file_save_as]->setShortcut(QKeySequence(shortcut_save_as));
-	mFileActions[menu_file_save_as]->setStatusTip(QObject::tr("Save an image as"));
-
-	mFileActions[menu_file_save_copy] = new QAction(QObject::tr("Sa&ve a Copy"), parent);
-	mFileActions[menu_file_save_copy]->setStatusTip(QObject::tr("Copy the Image"));
-
-	mFileActions[menu_file_save_list] = new QAction(QObject::tr("&Save Tabs"), parent);
-	mFileActions[menu_file_save_list]->setStatusTip(QObject::tr("Save a newline separated list of the filenames of the open tabs"));
-
-	mFileActions[menu_file_save_web] = new QAction(QObject::tr("&Save for Web"), parent);
-	mFileActions[menu_file_save_web]->setStatusTip(QObject::tr("Save an Image for Web Applications"));
-
-	mFileActions[menu_file_print] = new QAction(mFileIcons[icon_file_print], QObject::tr("&Print"), parent);
-	mFileActions[menu_file_print]->setShortcuts(QKeySequence::Print);
-	mFileActions[menu_file_print]->setStatusTip(QObject::tr("Print an image"));
-
-	mFileActions[menu_file_show_recent] = new QAction(QObject::tr("&Recent Files"), parent);
-	mFileActions[menu_file_show_recent]->setShortcut(QKeySequence(shortcut_recent_files));
-	mFileActions[menu_file_show_recent]->setCheckable(true);
-	mFileActions[menu_file_show_recent]->setChecked(false);
-	mFileActions[menu_file_show_recent]->setStatusTip(QObject::tr("Show Recent Files"));
-
-	mFileActions[menu_file_reload] = new QAction(QObject::tr("&Reload File"), parent);
-	mFileActions[menu_file_reload]->setShortcutContext(Qt::WidgetWithChildrenShortcut);
-	mFileActions[menu_file_reload]->setShortcut(QKeySequence(shortcut_reload));
-	mFileActions[menu_file_reload]->setStatusTip(QObject::tr("Reload File"));
-
-	mFileActions[menu_file_next] = new QAction(mFileIcons[icon_file_next], QObject::tr("Ne&xt File"), parent);
-	mFileActions[menu_file_next]->setShortcutContext(Qt::WidgetShortcut);
-	mFileActions[menu_file_next]->setShortcut(QKeySequence(shortcut_next_file));
-	mFileActions[menu_file_next]->setStatusTip(QObject::tr("Load next image"));
-
-	mFileActions[menu_file_prev] = new QAction(mFileIcons[icon_file_prev], QObject::tr("Pre&vious File"), parent);
-	mFileActions[menu_file_prev]->setShortcutContext(Qt::WidgetWithChildrenShortcut);
-	mFileActions[menu_file_prev]->setShortcut(QKeySequence(shortcut_prev_file));
-	mFileActions[menu_file_prev]->setStatusTip(QObject::tr("Load previous file"));
-
-	mFileActions[menu_file_new_instance] = new QAction(QObject::tr("St&art New Instance"), parent);
-	mFileActions[menu_file_new_instance]->setShortcut(QKeySequence(shortcut_new_instance));
-	mFileActions[menu_file_new_instance]->setStatusTip(QObject::tr("Open file in new instance"));
-
-	mFileActions[menu_file_private_instance] = new QAction(QObject::tr("St&art Private Instance"), parent);
-	mFileActions[menu_file_private_instance]->setShortcut(QKeySequence(shortcut_private_instance));
-	mFileActions[menu_file_private_instance]->setStatusTip(QObject::tr("Open private instance"));
-
-	mFileActions[menu_file_find] = new QAction(mFileIcons[icon_file_find], QObject::tr("&Find && Filter"), parent);
-	mFileActions[menu_file_find]->setShortcut(QKeySequence::Find);
-	mFileActions[menu_file_find]->setStatusTip(QObject::tr("Find an image"));
-
-	mFileActions[menu_file_recursive] = new QAction(QObject::tr("Scan Folder Re&cursive"), parent);
-	mFileActions[menu_file_recursive]->setStatusTip(QObject::tr("Step through Folder and Sub Folders"));
-	mFileActions[menu_file_recursive]->setCheckable(true);
-	mFileActions[menu_file_recursive]->setChecked(DkSettingsManager::param().global().scanSubFolders);
-
-	mFileActions[menu_file_exit] = new QAction(QObject::tr("&Exit"), parent);
-	mFileActions[menu_file_exit]->setStatusTip(QObject::tr("Exit"));
-
-	// sort actions
-	mSortActions.resize(menu_sort_end);
-
-	mSortActions[menu_sort_filename] = new QAction(QObject::tr("by &Filename"), parent);
-	mSortActions[menu_sort_filename]->setObjectName("menu_sort_filename");
-	mSortActions[menu_sort_filename]->setStatusTip(QObject::tr("Sort by Filename"));
-	mSortActions[menu_sort_filename]->setCheckable(true);
-	mSortActions[menu_sort_filename]->setChecked(DkSettingsManager::param().global().sortMode == DkSettings::sort_filename);
-
-	mSortActions[menu_sort_date_created] = new QAction(QObject::tr("by Date &Created"), parent);
-	mSortActions[menu_sort_date_created]->setObjectName("menu_sort_date_created");
-	mSortActions[menu_sort_date_created]->setStatusTip(QObject::tr("Sort by Date Created"));
-	mSortActions[menu_sort_date_created]->setCheckable(true);
-	mSortActions[menu_sort_date_created]->setChecked(DkSettingsManager::param().global().sortMode == DkSettings::sort_date_created);
-
-	mSortActions[menu_sort_date_modified] = new QAction(QObject::tr("by Date Modified"), parent);
-	mSortActions[menu_sort_date_modified]->setObjectName("menu_sort_date_modified");
-	mSortActions[menu_sort_date_modified]->setStatusTip(QObject::tr("Sort by Date Last Modified"));
-	mSortActions[menu_sort_date_modified]->setCheckable(true);
-	mSortActions[menu_sort_date_modified]->setChecked(DkSettingsManager::param().global().sortMode == DkSettings::sort_date_modified);
-
-	mSortActions[menu_sort_random] = new QAction(QObject::tr("Random"), parent);
-	mSortActions[menu_sort_random]->setObjectName("menu_sort_random");
-	mSortActions[menu_sort_random]->setStatusTip(QObject::tr("Sort in Random Order"));
-	mSortActions[menu_sort_random]->setCheckable(true);
-	mSortActions[menu_sort_random]->setChecked(DkSettingsManager::param().global().sortMode == DkSettings::sort_random);
-
-	mSortActions[menu_sort_ascending] = new QAction(QObject::tr("&Ascending"), parent);
-	mSortActions[menu_sort_ascending]->setObjectName("menu_sort_ascending");
-	mSortActions[menu_sort_ascending]->setStatusTip(QObject::tr("Sort in Ascending Order"));
-	mSortActions[menu_sort_ascending]->setCheckable(true);
-	mSortActions[menu_sort_ascending]->setChecked(DkSettingsManager::param().global().sortDir == Qt::AscendingOrder);
-
-	mSortActions[menu_sort_descending] = new QAction(QObject::tr("&Descending"), parent);
-	mSortActions[menu_sort_descending]->setObjectName("menu_sort_descending");
-	mSortActions[menu_sort_descending]->setStatusTip(QObject::tr("Sort in Descending Order"));
-	mSortActions[menu_sort_descending]->setCheckable(true);
-	mSortActions[menu_sort_descending]->setChecked(DkSettingsManager::param().global().sortDir == Qt::DescendingOrder);
-
-	// edit actions
-	mEditActions.resize(menu_edit_end);
-
-	mEditActions[menu_edit_rotate_cw] = new QAction(mEditIcons[icon_edit_rotate_cw], QObject::tr("9&0%1 Clockwise").arg(dk_degree_str), parent);
-	mEditActions[menu_edit_rotate_cw]->setShortcutContext(Qt::WidgetWithChildrenShortcut);
-	mEditActions[menu_edit_rotate_cw]->setShortcut(QKeySequence(shortcut_rotate_cw));
-	mEditActions[menu_edit_rotate_cw]->setStatusTip(QObject::tr("rotate the image 90%1 clockwise").arg(dk_degree_str));
-
-	mEditActions[menu_edit_rotate_ccw] = new QAction(mEditIcons[icon_edit_rotate_ccw], QObject::tr("&90%1 Counter Clockwise").arg(dk_degree_str), parent);
-	mEditActions[menu_edit_rotate_ccw]->setShortcutContext(Qt::WidgetWithChildrenShortcut);
-	mEditActions[menu_edit_rotate_ccw]->setShortcut(QKeySequence(shortcut_rotate_ccw));
-	mEditActions[menu_edit_rotate_ccw]->setStatusTip(QObject::tr("rotate the image 90%1 counter clockwise").arg(dk_degree_str));
-
-	mEditActions[menu_edit_rotate_180] = new QAction(QObject::tr("180%1").arg(dk_degree_str), parent);
-	mEditActions[menu_edit_rotate_180]->setStatusTip(QObject::tr("rotate the image by 180%1").arg(dk_degree_str));
-
-	mEditActions[menu_edit_undo] = new QAction(QObject::tr("&Undo"), parent);
-	mEditActions[menu_edit_undo]->setShortcutContext(Qt::WidgetWithChildrenShortcut);
-	mEditActions[menu_edit_undo]->setShortcut(QKeySequence::Undo);
-	mEditActions[menu_edit_undo]->setStatusTip(QObject::tr("Undo Last Action"));
-
-	mEditActions[menu_edit_redo] = new QAction(QObject::tr("&Redo"), parent);
-	mEditActions[menu_edit_redo]->setShortcutContext(Qt::WidgetWithChildrenShortcut);
-	mEditActions[menu_edit_redo]->setShortcut(QKeySequence::Redo);
-	mEditActions[menu_edit_redo]->setStatusTip(QObject::tr("Redo Last Action"));
-
-	mEditActions[menu_edit_copy] = new QAction(mEditIcons[icon_edit_copy], QObject::tr("&Copy"), parent);
-	mEditActions[menu_edit_copy]->setShortcutContext(Qt::WidgetWithChildrenShortcut);
-	mEditActions[menu_edit_copy]->setShortcut(QKeySequence::Copy);
-	mEditActions[menu_edit_copy]->setStatusTip(QObject::tr("copy image"));
-
-	mEditActions[menu_edit_copy_buffer] = new QAction(QObject::tr("Copy &Buffer"), parent);
-	mEditActions[menu_edit_copy_buffer]->setShortcutContext(Qt::WidgetWithChildrenShortcut);
-	mEditActions[menu_edit_copy_buffer]->setShortcut(shortcut_copy_buffer);
-	mEditActions[menu_edit_copy_buffer]->setStatusTip(QObject::tr("copy image"));
-
-	mEditActions[menu_edit_copy_color] = new QAction(QObject::tr("Copy Co&lor"), parent);
-	mEditActions[menu_edit_copy_color]->setShortcutContext(Qt::WidgetWithChildrenShortcut);
-	mEditActions[menu_edit_copy_color]->setShortcut(shortcut_copy_color);
-	mEditActions[menu_edit_copy_color]->setStatusTip(QObject::tr("copy pixel color value as HEX"));
-
-	QList<QKeySequence> pastScs;
-	pastScs.append(QKeySequence::Paste);
-	pastScs.append(shortcut_paste);
-	mEditActions[menu_edit_paste] = new QAction(mEditIcons[icon_edit_paste], QObject::tr("&Paste"), parent);
-	mEditActions[menu_edit_paste]->setShortcutContext(Qt::WidgetWithChildrenShortcut);
-	mEditActions[menu_edit_paste]->setShortcuts(pastScs);
-	mEditActions[menu_edit_paste]->setStatusTip(QObject::tr("paste image"));
-
-	mEditActions[menu_edit_delete] = new QAction(mEditIcons[icon_edit_delete], QObject::tr("&Delete"), parent);
-	mEditActions[menu_edit_delete]->setShortcutContext(Qt::WidgetWithChildrenShortcut);
-	mEditActions[menu_edit_delete]->setShortcut(QKeySequence::Delete);
-	mEditActions[menu_edit_delete]->setStatusTip(QObject::tr("delete current fileInfo"));
-
-	mEditActions[menu_edit_shortcuts] = new QAction(QObject::tr("&Keyboard Shortcuts"), parent);
-	mEditActions[menu_edit_shortcuts]->setShortcut(QKeySequence(shortcut_shortcuts));
-	mEditActions[menu_edit_shortcuts]->setStatusTip(QObject::tr("lets you customize your keyboard shortcuts"));
-
-	mEditActions[menu_edit_preferences] = new QAction(QObject::tr("&Settings"), parent);
-	mEditActions[menu_edit_preferences]->setShortcut(QKeySequence(shortcut_settings));
-	mEditActions[menu_edit_preferences]->setStatusTip(QObject::tr("settings"));
-
-	// image adjustments menu
-	mEditActions[menu_edit_image] = new QAction(mEditIcons[icon_edit_image], QObject::tr("Image &Adjustments"), parent);
-	mEditActions[menu_edit_image]->setShortcutContext(Qt::WidgetWithChildrenShortcut);
-	mEditActions[menu_edit_image]->setShortcut(QKeySequence(shortcut_edit_image));
-	mEditActions[menu_edit_image]->setStatusTip(QObject::tr("open image manipulation toolbox"));
-	mEditActions[menu_edit_image]->setCheckable(true);
-
-	mEditActions[menu_edit_transform] = new QAction(mEditIcons[icon_edit_resize], QObject::tr("R&esize Image"), parent);
-	mEditActions[menu_edit_transform]->setShortcutContext(Qt::WidgetWithChildrenShortcut);
-	mEditActions[menu_edit_transform]->setShortcut(shortcut_transform);
-	mEditActions[menu_edit_transform]->setStatusTip(QObject::tr("resize the current image"));
-
-	mEditActions[menu_edit_crop] = new QAction(mEditIcons[icon_edit_crop], QObject::tr("Cr&op Image"), parent);
-	mEditActions[menu_edit_crop]->setShortcutContext(Qt::WidgetWithChildrenShortcut);
-	mEditActions[menu_edit_crop]->setShortcut(shortcut_crop);
-	mEditActions[menu_edit_crop]->setStatusTip(QObject::tr("cut the current image"));
-	mEditActions[menu_edit_crop]->setCheckable(true);
-	mEditActions[menu_edit_crop]->setChecked(false);
-
-	// panel actions
-	mPanelActions.resize(menu_panel_end);
-	mPanelActions[menu_panel_menu] = new QAction(QObject::tr("Show &Menu"), parent);
-	mPanelActions[menu_panel_menu]->setStatusTip(QObject::tr("Hides the Menu and Shows it Again on ALT"));
-	mPanelActions[menu_panel_menu]->setCheckable(true);
-
-	mPanelActions[menu_panel_toolbar] = new QAction(QObject::tr("Tool&bar"), parent);
-	mPanelActions[menu_panel_toolbar]->setShortcut(QKeySequence(shortcut_show_toolbar));
-	mPanelActions[menu_panel_toolbar]->setStatusTip(QObject::tr("Show Toolbar"));
-	mPanelActions[menu_panel_toolbar]->setCheckable(true);
-
-	mPanelActions[menu_panel_statusbar] = new QAction(QObject::tr("&Statusbar"), parent);
-	mPanelActions[menu_panel_statusbar]->setShortcut(QKeySequence(shortcut_show_statusbar));
-	mPanelActions[menu_panel_statusbar]->setStatusTip(QObject::tr("Show Statusbar"));
-	mPanelActions[menu_panel_statusbar]->setCheckable(true);
-
-	mPanelActions[menu_panel_transfertoolbar] = new QAction(QObject::tr("&Pseudocolor Function"), parent);
-	mPanelActions[menu_panel_transfertoolbar]->setShortcut(QKeySequence(shortcut_show_transfer));
-	mPanelActions[menu_panel_transfertoolbar]->setStatusTip(QObject::tr("Show Pseudocolor Function"));
-	mPanelActions[menu_panel_transfertoolbar]->setCheckable(true);
-	mPanelActions[menu_panel_transfertoolbar]->setChecked(false);
-
-	mPanelActions[menu_panel_overview] = new QAction(QObject::tr("O&verview"), parent);
-	mPanelActions[menu_panel_overview]->setShortcut(QKeySequence(shortcut_show_overview));
-	mPanelActions[menu_panel_overview]->setStatusTip(QObject::tr("Shows the Zoom Overview"));
-	mPanelActions[menu_panel_overview]->setCheckable(true);
-	mPanelActions[menu_panel_overview]->setChecked(DkSettingsManager::param().app().showOverview.testBit(DkSettingsManager::param().app().currentAppMode));
-
-	mPanelActions[menu_panel_player] = new QAction(QObject::tr("Pla&yer"), parent);
-	mPanelActions[menu_panel_player]->setShortcut(QKeySequence(shortcut_show_player));
-	mPanelActions[menu_panel_player]->setStatusTip(QObject::tr("Shows the Slide Show Player"));
-	mPanelActions[menu_panel_player]->setCheckable(true);
-
-	mPanelActions[menu_panel_toggle] = new QAction(QObject::tr("&Hide All Panels"), parent);
-	mPanelActions[menu_panel_toggle]->setShortcut(QKeySequence(shortcut_toggle_panels));
-	mPanelActions[menu_panel_toggle]->setStatusTip(QObject::tr("Hide all panels"));
-	mPanelActions[menu_panel_toggle]->setCheckable(true);
-	mPanelActions[menu_panel_toggle]->setChecked(DkSettingsManager::param().app().hideAllPanels);
-
-	mPanelActions[menu_panel_explorer] = new QAction(QObject::tr("File &Explorer"), parent);
-	mPanelActions[menu_panel_explorer]->setShortcut(QKeySequence(shortcut_show_explorer));
-	mPanelActions[menu_panel_explorer]->setStatusTip(QObject::tr("Show File Explorer"));
-	mPanelActions[menu_panel_explorer]->setCheckable(true);
-
-	mPanelActions[menu_panel_metadata_dock] = new QAction(QObject::tr("Metadata &Info"), parent);
-	mPanelActions[menu_panel_metadata_dock]->setShortcut(QKeySequence(shortcut_show_metadata_dock));
-	mPanelActions[menu_panel_metadata_dock]->setStatusTip(QObject::tr("Show Metadata Info"));
-	mPanelActions[menu_panel_metadata_dock]->setCheckable(true);
-
-	mPanelActions[menu_panel_preview] = new QAction(QObject::tr("&Thumbnails"), parent);
-	mPanelActions[menu_panel_preview]->setShortcut(QKeySequence(shortcut_open_preview));
-	mPanelActions[menu_panel_preview]->setStatusTip(QObject::tr("Show Thumbnails"));
-	mPanelActions[menu_panel_preview]->setCheckable(true);
-
-	mPanelActions[menu_panel_thumbview] = new QAction(QObject::tr("&Thumbnail Preview"), parent);
-	mPanelActions[menu_panel_thumbview]->setShortcut(QKeySequence(shortcut_open_thumbview));
-	mPanelActions[menu_panel_thumbview]->setStatusTip(QObject::tr("Show Thumbnails Preview"));
-	mPanelActions[menu_panel_thumbview]->setCheckable(true);
-
-	mPanelActions[menu_panel_scroller] = new QAction(QObject::tr("&Folder Scrollbar"), parent);
-	mPanelActions[menu_panel_scroller]->setStatusTip(QObject::tr("Show Folder Scrollbar"));
-	mPanelActions[menu_panel_scroller]->setCheckable(true);
-
-	mPanelActions[menu_panel_exif] = new QAction(QObject::tr("&Metadata Ribbon"), parent);
-	mPanelActions[menu_panel_exif]->setShortcut(QKeySequence(shortcut_show_exif));
-	mPanelActions[menu_panel_exif]->setStatusTip(QObject::tr("Shows the Metadata Panel"));
-	mPanelActions[menu_panel_exif]->setCheckable(true);
-
-	mPanelActions[menu_panel_info] = new QAction(QObject::tr("File &Info"), parent);
-	mPanelActions[menu_panel_info]->setShortcut(QKeySequence(shortcut_show_info));
-	mPanelActions[menu_panel_info]->setStatusTip(QObject::tr("Shows the Info Panel"));
-	mPanelActions[menu_panel_info]->setCheckable(true);
-
-	mPanelActions[menu_panel_histogram] = new QAction(QObject::tr("&Histogram"), parent);
-	mPanelActions[menu_panel_histogram]->setShortcut(QKeySequence(shortcut_show_histogram));
-	mPanelActions[menu_panel_histogram]->setStatusTip(QObject::tr("Shows the Histogram Panel"));
-	mPanelActions[menu_panel_histogram]->setCheckable(true);
-
-	mPanelActions[menu_panel_comment] = new QAction(QObject::tr("Image &Notes"), parent);
-	mPanelActions[menu_panel_comment]->setShortcut(QKeySequence(shortcut_show_comment));
-	mPanelActions[menu_panel_comment]->setStatusTip(QObject::tr("Shows Image Notes"));
-	mPanelActions[menu_panel_comment]->setCheckable(true);
-
-	mPanelActions[menu_panel_history] = new QAction(QObject::tr("Edit &History"), parent);
-	mPanelActions[menu_panel_history]->setStatusTip(QObject::tr("Shows the edit history"));
-	mPanelActions[menu_panel_history]->setShortcut(QKeySequence(shortcut_show_history));
-	mPanelActions[menu_panel_history]->setCheckable(true);
-
-	mPanelActions[menu_panel_log] = new QAction(QObject::tr("Show &Log"), parent);
-	mPanelActions[menu_panel_log]->setStatusTip(QObject::tr("Shows the log window"));
-	mPanelActions[menu_panel_log]->setShortcut(QKeySequence(shortcut_show_log));
-	mPanelActions[menu_panel_log]->setCheckable(true);
-
-	// view actions
-	mViewActions.resize(menu_view_end);
-
-	mViewActions[menu_view_new_tab] = new QAction(QObject::tr("New &Tab"), parent);
-	mViewActions[menu_view_new_tab]->setShortcut(QKeySequence(shortcut_new_tab));
-	mViewActions[menu_view_new_tab]->setStatusTip(QObject::tr("Open a new tab"));
-
-	mViewActions[menu_view_close_tab] = new QAction(QObject::tr("&Close Tab"), parent);
-	mViewActions[menu_view_close_tab]->setShortcut(QKeySequence(shortcut_close_tab));
-	mViewActions[menu_view_close_tab]->setStatusTip(QObject::tr("Close current tab"));
-
-	mViewActions[menu_view_close_all_tabs] = new QAction(QObject::tr("&Close All Tabs"), parent);
-	mViewActions[menu_view_close_all_tabs]->setStatusTip(QObject::tr("Close all open tabs"));
-
-	mViewActions[menu_view_fit_frame] = new QAction(QObject::tr("&Fit Window to Image"), parent);
-	mViewActions[menu_view_fit_frame]->setShortcut(QKeySequence(shortcut_fit_frame));
-	mViewActions[menu_view_fit_frame]->setStatusTip(QObject::tr("Fit window to the image"));
-
-	mViewActions[menu_view_first_tab] = new QAction(QObject::tr("F&irst Tab"), parent);
-	mViewActions[menu_view_first_tab]->setStatusTip(QObject::tr("Switch to first tab"));
-
-	mViewActions[menu_view_previous_tab] = new QAction(QObject::tr("&Previous Tab"), parent);
-	mViewActions[menu_view_previous_tab]->setShortcut(QKeySequence(shortcut_previous_tab));
-	mViewActions[menu_view_previous_tab]->setStatusTip(QObject::tr("Switch to previous tab"));
-
-	mViewActions[menu_view_goto_tab] = new QAction(QObject::tr("&Go to Tab"), parent);
-	mViewActions[menu_view_goto_tab]->setStatusTip(QObject::tr("Go to tab by index"));
-
-	mViewActions[menu_view_next_tab] = new QAction(QObject::tr("&Next Tab"), parent);
-	mViewActions[menu_view_next_tab]->setShortcut(QKeySequence(shortcut_next_tab));
-	mViewActions[menu_view_next_tab]->setStatusTip(QObject::tr("Switch to next tab"));
-
-	mViewActions[menu_view_last_tab] = new QAction(QObject::tr("La&st Tab"), parent);
-	mViewActions[menu_view_last_tab]->setStatusTip(QObject::tr("Switch to last tab"));
-
-	QList<QKeySequence> scs;
-	scs.append(shortcut_full_screen_ff);
-	scs.append(shortcut_full_screen_ad);
-	mViewActions[menu_view_fullscreen] = new QAction(mViewIcons[icon_view_fullscreen], QObject::tr("Fu&ll Screen"), parent);
-	mViewActions[menu_view_fullscreen]->setShortcuts(scs);
-	mViewActions[menu_view_fullscreen]->setStatusTip(QObject::tr("Full Screen"));
-
-	mViewActions[menu_view_reset] = new QAction(mViewIcons[icon_view_reset], QObject::tr("&Fit Image to Window"), parent);
-	mViewActions[menu_view_reset]->setShortcut(QKeySequence(shortcut_reset_view));
-	mViewActions[menu_view_reset]->setStatusTip(QObject::tr("Zoom image to fit window"));
-
-	mViewActions[menu_view_100] = new QAction(mViewIcons[icon_view_100], QObject::tr("Show &100%"), parent);
-	mViewActions[menu_view_100]->setShortcut(QKeySequence(shortcut_zoom_full));
-	mViewActions[menu_view_100]->setStatusTip(QObject::tr("Shows the image at 100%"));
-
-	mViewActions[menu_view_zoom_in] = new QAction(mViewIcons[icon_view_zoom_in], QObject::tr("Zoom &In"), parent);
-	mViewActions[menu_view_zoom_in]->setShortcut(QKeySequence::ZoomIn);
-	mViewActions[menu_view_zoom_in]->setStatusTip(QObject::tr("zoom in"));
-
-	mViewActions[menu_view_zoom_out] = new QAction(mViewIcons[icon_view_zoom_out], QObject::tr("&Zoom Out"), parent);
-	mViewActions[menu_view_zoom_out]->setShortcut(QKeySequence::ZoomOut);
-	mViewActions[menu_view_zoom_out]->setStatusTip(QObject::tr("zoom out"));
-
-	mViewActions[menu_view_anti_aliasing] = new QAction(QObject::tr("&Anti Aliasing"), parent);
-	mViewActions[menu_view_anti_aliasing]->setShortcut(QKeySequence(shortcut_anti_aliasing));
-	mViewActions[menu_view_anti_aliasing]->setStatusTip(QObject::tr("if checked images are smoother"));
-	mViewActions[menu_view_anti_aliasing]->setCheckable(true);
-	mViewActions[menu_view_anti_aliasing]->setChecked(DkSettingsManager::param().display().antiAliasing);
-
-	mViewActions[menu_view_tp_pattern] = new QAction(QObject::tr("&Transparency Pattern"), parent);
-	mViewActions[menu_view_tp_pattern]->setShortcut(QKeySequence(shortcut_tp_pattern));
-	mViewActions[menu_view_tp_pattern]->setStatusTip(QObject::tr("if checked, a pattern will be displayed for transparent objects"));
-	mViewActions[menu_view_tp_pattern]->setCheckable(true);
-	mViewActions[menu_view_tp_pattern]->setChecked(DkSettingsManager::param().display().tpPattern);
-
-	mViewActions[menu_view_frameless] = new QAction(QObject::tr("&Frameless"), parent);
-	mViewActions[menu_view_frameless]->setShortcut(QKeySequence(shortcut_frameless));
-	mViewActions[menu_view_frameless]->setStatusTip(QObject::tr("shows a frameless window"));
-	mViewActions[menu_view_frameless]->setCheckable(true);
-	mViewActions[menu_view_frameless]->setChecked(false);
-
-	mViewActions[menu_view_opacity_change] = new QAction(QObject::tr("&Change Opacity"), parent);
-	mViewActions[menu_view_opacity_change]->setShortcut(QKeySequence(shortcut_opacity_change));
-	mViewActions[menu_view_opacity_change]->setStatusTip(QObject::tr("change the window opacity"));
-
-	mViewActions[menu_view_opacity_up] = new QAction(QObject::tr("Opacity &Up"), parent);
-	mViewActions[menu_view_opacity_up]->setShortcut(QKeySequence(shortcut_opacity_up));
-	mViewActions[menu_view_opacity_up]->setStatusTip(QObject::tr("changes the window opacity"));
-
-	mViewActions[menu_view_opacity_down] = new QAction(QObject::tr("Opacity &Down"), parent);
-	mViewActions[menu_view_opacity_down]->setShortcut(QKeySequence(shortcut_opacity_down));
-	mViewActions[menu_view_opacity_down]->setStatusTip(QObject::tr("changes the window opacity"));
-
-	mViewActions[menu_view_opacity_an] = new QAction(QObject::tr("To&ggle Opacity"), parent);
-	mViewActions[menu_view_opacity_an]->setShortcut(QKeySequence(shortcut_an_opacity));
-	mViewActions[menu_view_opacity_an]->setStatusTip(QObject::tr("toggle the window opacity"));
-
-	mViewActions[menu_view_lock_window] = new QAction(QObject::tr("Lock &Window"), parent);
-	mViewActions[menu_view_lock_window]->setShortcut(QKeySequence(shortcut_lock_window));
-	mViewActions[menu_view_lock_window]->setStatusTip(QObject::tr("lock the window"));
-	mViewActions[menu_view_lock_window]->setCheckable(true);
-	mViewActions[menu_view_lock_window]->setChecked(false);
-
-	mViewActions[menu_view_slideshow] = new QAction(QObject::tr("&Toggle Slideshow"), parent);
-	mViewActions[menu_view_slideshow]->setStatusTip(QObject::tr("Start/Pause the slideshow"));
-	mViewActions[menu_view_slideshow]->setShortcut(QKeySequence(shortcut_view_slideshow));
-
-	mViewActions[menu_view_movie_pause] = new QAction(mViewIcons[icon_view_movie_play], QObject::tr("&Pause Movie"), parent);
-	mViewActions[menu_view_movie_pause]->setStatusTip(QObject::tr("pause the current movie"));
-	mViewActions[menu_view_movie_pause]->setCheckable(true);
-	mViewActions[menu_view_movie_pause]->setChecked(false);
-
-	mViewActions[menu_view_movie_prev] = new QAction(mViewIcons[icon_view_movie_prev], QObject::tr("P&revious Frame"), parent);
-	mViewActions[menu_view_movie_prev]->setStatusTip(QObject::tr("show previous frame"));
-
-	mViewActions[menu_view_movie_next] = new QAction(mViewIcons[icon_view_movie_next], QObject::tr("&Next Frame"), parent);
-	mViewActions[menu_view_movie_next]->setStatusTip(QObject::tr("show next frame"));
-
-	mViewActions[menu_view_monitors] = new QAction(QObject::tr("Choose &Monitor"), parent);
-	mViewActions[menu_view_monitors]->setStatusTip(QObject::tr("Choose the Monitor to run nomacs"));
-
-	mViewActions[menu_view_gps_map] = new QAction(mViewIcons[icon_view_gps], QObject::tr("Show Image Location"), parent);
-	mViewActions[menu_view_gps_map]->setStatusTip(QObject::tr("shows where the image was taken in Google maps"));
-	mViewActions[menu_view_gps_map]->setEnabled(false);
-
-	// tools actions
-	mToolsActions.resize(menu_tools_end);
-
-	mToolsActions[menu_tools_thumbs] = new QAction(QObject::tr("Compute &Thumbnails"), parent);
-	mToolsActions[menu_tools_thumbs]->setStatusTip(QObject::tr("compute all thumbnails of the current folder"));
-	mToolsActions[menu_tools_thumbs]->setEnabled(false);
-
-	mToolsActions[menu_tools_filter] = new QAction(mFileIcons[icon_file_filter], QObject::tr("&Filter"), parent);
-	mToolsActions[menu_tools_filter]->setStatusTip(QObject::tr("Find an image"));
-	mToolsActions[menu_tools_filter]->setCheckable(true);
-	mToolsActions[menu_tools_filter]->setChecked(false);
-
-	mToolsActions[menu_tools_export_tiff] = new QAction(QObject::tr("Export Multipage &TIFF"), parent);
-	mToolsActions[menu_tools_export_tiff]->setStatusTip(QObject::tr("Export TIFF pages to multiple tiff files"));
-
-	mToolsActions[menu_tools_extract_archive] = new QAction(QObject::tr("Extract From Archive"), parent);
-	mToolsActions[menu_tools_extract_archive]->setStatusTip(QObject::tr("Extract images from an archive (%1)").arg(DkSettingsManager::param().app().containerRawFilters));
-	mToolsActions[menu_tools_extract_archive]->setShortcut(QKeySequence(shortcut_extract));
-
-	mToolsActions[menu_tools_mosaic] = new QAction(QObject::tr("&Mosaic Image"), parent);
-	mToolsActions[menu_tools_mosaic]->setStatusTip(QObject::tr("Create a Mosaic Image"));
-
-	mToolsActions[menu_tools_batch] = new QAction(QObject::tr("Batch Processing"), parent);
-	mToolsActions[menu_tools_batch]->setStatusTip(QObject::tr("Apply actions to multiple images"));
-	mToolsActions[menu_tools_batch]->setShortcut(QKeySequence(shortcut_batch_processing));
-
-	mToolsActions[menu_tools_wallpaper] = new QAction(QObject::tr("&Wallpaper"), parent);
-	mToolsActions[menu_tools_wallpaper]->setStatusTip(QObject::tr("set the current image as wallpaper"));
-
-	mToolsActions[menu_tools_train_format] = new QAction(QObject::tr("Add Image Format"), parent);
-	mToolsActions[menu_tools_train_format]->setStatusTip(QObject::tr("Add a new image format to nomacs"));
+    mFileActions[menu_file_app_manager] = new QAction(QObject::tr("&Manage Applications"), parent);
+    mFileActions[menu_file_app_manager]->setStatusTip(QObject::tr("Manage Applications which are Automatically Opened"));
+    mFileActions[menu_file_app_manager]->setShortcut(QKeySequence(shortcut_app_manager));
+
+    mFileActions[menu_file_rename] = new QAction(QObject::tr("Re&name"), parent);
+    mFileActions[menu_file_rename]->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+    mFileActions[menu_file_rename]->setShortcut(QKeySequence(shortcut_rename));
+    mFileActions[menu_file_rename]->setStatusTip(QObject::tr("Rename an image"));
+
+    mFileActions[menu_file_goto] = new QAction(QObject::tr("&Go To"), parent);
+    mFileActions[menu_file_goto]->setShortcut(QKeySequence(shortcut_goto));
+    mFileActions[menu_file_goto]->setStatusTip(QObject::tr("Go To an image"));
+
+    mFileActions[menu_file_save] = new QAction(mFileIcons[icon_file_save], QObject::tr("&Save"), parent);
+    mFileActions[menu_file_save]->setShortcuts(QKeySequence::Save);
+    mFileActions[menu_file_save]->setStatusTip(QObject::tr("Save an image"));
+
+    mFileActions[menu_file_save_as] = new QAction(QObject::tr("S&ave As"), parent);
+    mFileActions[menu_file_save_as]->setShortcut(QKeySequence(shortcut_save_as));
+    mFileActions[menu_file_save_as]->setStatusTip(QObject::tr("Save an image as"));
+
+    mFileActions[menu_file_save_copy] = new QAction(QObject::tr("Sa&ve a Copy"), parent);
+    mFileActions[menu_file_save_copy]->setStatusTip(QObject::tr("Copy the Image"));
+
+    mFileActions[menu_file_save_list] = new QAction(QObject::tr("&Save Tabs"), parent);
+    mFileActions[menu_file_save_list]->setStatusTip(QObject::tr("Save a newline separated list of the filenames of the open tabs"));
+
+    mFileActions[menu_file_save_web] = new QAction(QObject::tr("&Save for Web"), parent);
+    mFileActions[menu_file_save_web]->setStatusTip(QObject::tr("Save an Image for Web Applications"));
+
+    mFileActions[menu_file_print] = new QAction(mFileIcons[icon_file_print], QObject::tr("&Print"), parent);
+    mFileActions[menu_file_print]->setShortcuts(QKeySequence::Print);
+    mFileActions[menu_file_print]->setStatusTip(QObject::tr("Print an image"));
+
+    mFileActions[menu_file_show_recent] = new QAction(QObject::tr("&Recent Files"), parent);
+    mFileActions[menu_file_show_recent]->setShortcut(QKeySequence(shortcut_recent_files));
+    mFileActions[menu_file_show_recent]->setCheckable(true);
+    mFileActions[menu_file_show_recent]->setChecked(false);
+    mFileActions[menu_file_show_recent]->setStatusTip(QObject::tr("Show Recent Files"));
+
+    mFileActions[menu_file_reload] = new QAction(QObject::tr("&Reload File"), parent);
+    mFileActions[menu_file_reload]->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+    mFileActions[menu_file_reload]->setShortcut(QKeySequence(shortcut_reload));
+    mFileActions[menu_file_reload]->setStatusTip(QObject::tr("Reload File"));
+
+    mFileActions[menu_file_next] = new QAction(mFileIcons[icon_file_next], QObject::tr("Ne&xt File"), parent);
+    mFileActions[menu_file_next]->setShortcutContext(Qt::WidgetShortcut);
+    mFileActions[menu_file_next]->setShortcut(QKeySequence(shortcut_next_file));
+    mFileActions[menu_file_next]->setStatusTip(QObject::tr("Load next image"));
+
+    mFileActions[menu_file_prev] = new QAction(mFileIcons[icon_file_prev], QObject::tr("Pre&vious File"), parent);
+    mFileActions[menu_file_prev]->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+    mFileActions[menu_file_prev]->setShortcut(QKeySequence(shortcut_prev_file));
+    mFileActions[menu_file_prev]->setStatusTip(QObject::tr("Load previous file"));
+
+    mFileActions[menu_file_new_instance] = new QAction(QObject::tr("St&art New Instance"), parent);
+    mFileActions[menu_file_new_instance]->setShortcut(QKeySequence(shortcut_new_instance));
+    mFileActions[menu_file_new_instance]->setStatusTip(QObject::tr("Open file in new instance"));
+
+    mFileActions[menu_file_private_instance] = new QAction(QObject::tr("St&art Private Instance"), parent);
+    mFileActions[menu_file_private_instance]->setShortcut(QKeySequence(shortcut_private_instance));
+    mFileActions[menu_file_private_instance]->setStatusTip(QObject::tr("Open private instance"));
+
+    mFileActions[menu_file_find] = new QAction(mFileIcons[icon_file_find], QObject::tr("&Find && Filter"), parent);
+    mFileActions[menu_file_find]->setShortcut(QKeySequence::Find);
+    mFileActions[menu_file_find]->setStatusTip(QObject::tr("Find an image"));
+
+    mFileActions[menu_file_recursive] = new QAction(QObject::tr("Scan Folder Re&cursive"), parent);
+    mFileActions[menu_file_recursive]->setStatusTip(QObject::tr("Step through Folder and Sub Folders"));
+    mFileActions[menu_file_recursive]->setCheckable(true);
+    mFileActions[menu_file_recursive]->setChecked(DkSettingsManager::param().global().scanSubFolders);
+
+    mFileActions[menu_file_exit] = new QAction(QObject::tr("&Exit"), parent);
+    mFileActions[menu_file_exit]->setStatusTip(QObject::tr("Exit"));
+
+    // sort actions
+    mSortActions.resize(menu_sort_end);
+
+    mSortActions[menu_sort_filename] = new QAction(QObject::tr("by &Filename"), parent);
+    mSortActions[menu_sort_filename]->setObjectName("menu_sort_filename");
+    mSortActions[menu_sort_filename]->setStatusTip(QObject::tr("Sort by Filename"));
+    mSortActions[menu_sort_filename]->setCheckable(true);
+    mSortActions[menu_sort_filename]->setChecked(DkSettingsManager::param().global().sortMode == DkSettings::sort_filename);
+
+    mSortActions[menu_sort_file_size] = new QAction(QObject::tr("by File &Size"), parent);
+    mSortActions[menu_sort_file_size]->setObjectName("menu_sort_file_size");
+    mSortActions[menu_sort_file_size]->setStatusTip(QObject::tr("Sort by File Size"));
+    mSortActions[menu_sort_file_size]->setCheckable(true);
+    mSortActions[menu_sort_file_size]->setChecked(DkSettingsManager::param().global().sortMode == DkSettings::sort_file_size);
+
+    mSortActions[menu_sort_date_created] = new QAction(QObject::tr("by Date &Created"), parent);
+    mSortActions[menu_sort_date_created]->setObjectName("menu_sort_date_created");
+    mSortActions[menu_sort_date_created]->setStatusTip(QObject::tr("Sort by Date Created"));
+    mSortActions[menu_sort_date_created]->setCheckable(true);
+    mSortActions[menu_sort_date_created]->setChecked(DkSettingsManager::param().global().sortMode == DkSettings::sort_date_created);
+
+    mSortActions[menu_sort_date_modified] = new QAction(QObject::tr("by Date Modified"), parent);
+    mSortActions[menu_sort_date_modified]->setObjectName("menu_sort_date_modified");
+    mSortActions[menu_sort_date_modified]->setStatusTip(QObject::tr("Sort by Date Last Modified"));
+    mSortActions[menu_sort_date_modified]->setCheckable(true);
+    mSortActions[menu_sort_date_modified]->setChecked(DkSettingsManager::param().global().sortMode == DkSettings::sort_date_modified);
+
+    mSortActions[menu_sort_random] = new QAction(QObject::tr("Random"), parent);
+    mSortActions[menu_sort_random]->setObjectName("menu_sort_random");
+    mSortActions[menu_sort_random]->setStatusTip(QObject::tr("Sort in Random Order"));
+    mSortActions[menu_sort_random]->setCheckable(true);
+    mSortActions[menu_sort_random]->setChecked(DkSettingsManager::param().global().sortMode == DkSettings::sort_random);
+
+    mSortActions[menu_sort_ascending] = new QAction(QObject::tr("&Ascending"), parent);
+    mSortActions[menu_sort_ascending]->setObjectName("menu_sort_ascending");
+    mSortActions[menu_sort_ascending]->setStatusTip(QObject::tr("Sort in Ascending Order"));
+    mSortActions[menu_sort_ascending]->setCheckable(true);
+    mSortActions[menu_sort_ascending]->setChecked(DkSettingsManager::param().global().sortDir == Qt::AscendingOrder);
+
+    mSortActions[menu_sort_descending] = new QAction(QObject::tr("&Descending"), parent);
+    mSortActions[menu_sort_descending]->setObjectName("menu_sort_descending");
+    mSortActions[menu_sort_descending]->setStatusTip(QObject::tr("Sort in Descending Order"));
+    mSortActions[menu_sort_descending]->setCheckable(true);
+    mSortActions[menu_sort_descending]->setChecked(DkSettingsManager::param().global().sortDir == Qt::DescendingOrder);
+
+    // edit actions
+    mEditActions.resize(menu_edit_end);
+
+    mEditActions[menu_edit_rotate_cw] = new QAction(mEditIcons[icon_edit_rotate_cw], QObject::tr("9&0%1 Clockwise").arg(dk_degree_str), parent);
+    mEditActions[menu_edit_rotate_cw]->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+    mEditActions[menu_edit_rotate_cw]->setShortcut(QKeySequence(shortcut_rotate_cw));
+    mEditActions[menu_edit_rotate_cw]->setStatusTip(QObject::tr("rotate the image 90%1 clockwise").arg(dk_degree_str));
+
+    mEditActions[menu_edit_rotate_ccw] = new QAction(mEditIcons[icon_edit_rotate_ccw], QObject::tr("&90%1 Counter Clockwise").arg(dk_degree_str), parent);
+    mEditActions[menu_edit_rotate_ccw]->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+    mEditActions[menu_edit_rotate_ccw]->setShortcut(QKeySequence(shortcut_rotate_ccw));
+    mEditActions[menu_edit_rotate_ccw]->setStatusTip(QObject::tr("rotate the image 90%1 counter clockwise").arg(dk_degree_str));
+
+    mEditActions[menu_edit_rotate_180] = new QAction(QObject::tr("180%1").arg(dk_degree_str), parent);
+    mEditActions[menu_edit_rotate_180]->setStatusTip(QObject::tr("rotate the image by 180%1").arg(dk_degree_str));
+
+    mEditActions[menu_edit_undo] = new QAction(QObject::tr("&Undo"), parent);
+    mEditActions[menu_edit_undo]->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+    mEditActions[menu_edit_undo]->setShortcut(QKeySequence::Undo);
+    mEditActions[menu_edit_undo]->setStatusTip(QObject::tr("Undo Last Action"));
+
+    mEditActions[menu_edit_redo] = new QAction(QObject::tr("&Redo"), parent);
+    mEditActions[menu_edit_redo]->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+    mEditActions[menu_edit_redo]->setShortcut(QKeySequence::Redo);
+    mEditActions[menu_edit_redo]->setStatusTip(QObject::tr("Redo Last Action"));
+
+    mEditActions[menu_edit_copy] = new QAction(mEditIcons[icon_edit_copy], QObject::tr("&Copy"), parent);
+    mEditActions[menu_edit_copy]->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+    mEditActions[menu_edit_copy]->setShortcut(QKeySequence::Copy);
+    mEditActions[menu_edit_copy]->setStatusTip(QObject::tr("copy image"));
+
+    mEditActions[menu_edit_copy_buffer] = new QAction(QObject::tr("Copy &Buffer"), parent);
+    mEditActions[menu_edit_copy_buffer]->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+    mEditActions[menu_edit_copy_buffer]->setShortcut(shortcut_copy_buffer);
+    mEditActions[menu_edit_copy_buffer]->setStatusTip(QObject::tr("copy image"));
+
+    mEditActions[menu_edit_copy_color] = new QAction(QObject::tr("Copy Co&lor"), parent);
+    mEditActions[menu_edit_copy_color]->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+    mEditActions[menu_edit_copy_color]->setShortcut(shortcut_copy_color);
+    mEditActions[menu_edit_copy_color]->setStatusTip(QObject::tr("copy pixel color value as HEX"));
+
+    QList<QKeySequence> pastScs;
+    pastScs.append(QKeySequence::Paste);
+    pastScs.append(shortcut_paste);
+    mEditActions[menu_edit_paste] = new QAction(mEditIcons[icon_edit_paste], QObject::tr("&Paste"), parent);
+    mEditActions[menu_edit_paste]->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+    mEditActions[menu_edit_paste]->setShortcuts(pastScs);
+    mEditActions[menu_edit_paste]->setStatusTip(QObject::tr("paste image"));
+
+    mEditActions[menu_edit_delete] = new QAction(mEditIcons[icon_edit_delete], QObject::tr("&Delete"), parent);
+    mEditActions[menu_edit_delete]->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+    mEditActions[menu_edit_delete]->setShortcut(QKeySequence::Delete);
+    mEditActions[menu_edit_delete]->setStatusTip(QObject::tr("delete current fileInfo"));
+
+    mEditActions[menu_edit_shortcuts] = new QAction(QObject::tr("&Keyboard Shortcuts"), parent);
+    mEditActions[menu_edit_shortcuts]->setShortcut(QKeySequence(shortcut_shortcuts));
+    mEditActions[menu_edit_shortcuts]->setStatusTip(QObject::tr("lets you customize your keyboard shortcuts"));
+
+    mEditActions[menu_edit_preferences] = new QAction(QObject::tr("&Settings"), parent);
+    mEditActions[menu_edit_preferences]->setShortcut(QKeySequence(shortcut_settings));
+    mEditActions[menu_edit_preferences]->setStatusTip(QObject::tr("settings"));
+
+    // image adjustments menu
+    mEditActions[menu_edit_image] = new QAction(mEditIcons[icon_edit_image], QObject::tr("Image &Adjustments"), parent);
+    mEditActions[menu_edit_image]->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+    mEditActions[menu_edit_image]->setShortcut(QKeySequence(shortcut_edit_image));
+    mEditActions[menu_edit_image]->setStatusTip(QObject::tr("open image manipulation toolbox"));
+    mEditActions[menu_edit_image]->setCheckable(true);
+
+    mEditActions[menu_edit_transform] = new QAction(mEditIcons[icon_edit_resize], QObject::tr("R&esize Image"), parent);
+    mEditActions[menu_edit_transform]->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+    mEditActions[menu_edit_transform]->setShortcut(shortcut_transform);
+    mEditActions[menu_edit_transform]->setStatusTip(QObject::tr("resize the current image"));
+
+    mEditActions[menu_edit_crop] = new QAction(mEditIcons[icon_edit_crop], QObject::tr("Cr&op Image"), parent);
+    mEditActions[menu_edit_crop]->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+    mEditActions[menu_edit_crop]->setShortcut(shortcut_crop);
+    mEditActions[menu_edit_crop]->setStatusTip(QObject::tr("cut the current image"));
+    mEditActions[menu_edit_crop]->setCheckable(true);
+    mEditActions[menu_edit_crop]->setChecked(false);
+
+    // panel actions
+    mPanelActions.resize(menu_panel_end);
+    mPanelActions[menu_panel_menu] = new QAction(QObject::tr("Show &Menu"), parent);
+    mPanelActions[menu_panel_menu]->setStatusTip(QObject::tr("Hides the Menu and Shows it Again on ALT"));
+    mPanelActions[menu_panel_menu]->setCheckable(true);
+
+    mPanelActions[menu_panel_toolbar] = new QAction(QObject::tr("Tool&bar"), parent);
+    mPanelActions[menu_panel_toolbar]->setShortcut(QKeySequence(shortcut_show_toolbar));
+    mPanelActions[menu_panel_toolbar]->setStatusTip(QObject::tr("Show Toolbar"));
+    mPanelActions[menu_panel_toolbar]->setCheckable(true);
+
+    mPanelActions[menu_panel_statusbar] = new QAction(QObject::tr("&Statusbar"), parent);
+    mPanelActions[menu_panel_statusbar]->setShortcut(QKeySequence(shortcut_show_statusbar));
+    mPanelActions[menu_panel_statusbar]->setStatusTip(QObject::tr("Show Statusbar"));
+    mPanelActions[menu_panel_statusbar]->setCheckable(true);
+
+    mPanelActions[menu_panel_transfertoolbar] = new QAction(QObject::tr("&Pseudocolor Function"), parent);
+    mPanelActions[menu_panel_transfertoolbar]->setShortcut(QKeySequence(shortcut_show_transfer));
+    mPanelActions[menu_panel_transfertoolbar]->setStatusTip(QObject::tr("Show Pseudocolor Function"));
+    mPanelActions[menu_panel_transfertoolbar]->setCheckable(true);
+    mPanelActions[menu_panel_transfertoolbar]->setChecked(false);
+
+    mPanelActions[menu_panel_overview] = new QAction(QObject::tr("O&verview"), parent);
+    mPanelActions[menu_panel_overview]->setShortcut(QKeySequence(shortcut_show_overview));
+    mPanelActions[menu_panel_overview]->setStatusTip(QObject::tr("Shows the Zoom Overview"));
+    mPanelActions[menu_panel_overview]->setCheckable(true);
+    mPanelActions[menu_panel_overview]->setChecked(DkSettingsManager::param().app().showOverview.testBit(DkSettingsManager::param().app().currentAppMode));
+
+    mPanelActions[menu_panel_player] = new QAction(QObject::tr("Pla&yer"), parent);
+    mPanelActions[menu_panel_player]->setShortcut(QKeySequence(shortcut_show_player));
+    mPanelActions[menu_panel_player]->setStatusTip(QObject::tr("Shows the Slide Show Player"));
+    mPanelActions[menu_panel_player]->setCheckable(true);
+
+    mPanelActions[menu_panel_toggle] = new QAction(QObject::tr("&Hide All Panels"), parent);
+    mPanelActions[menu_panel_toggle]->setShortcut(QKeySequence(shortcut_toggle_panels));
+    mPanelActions[menu_panel_toggle]->setStatusTip(QObject::tr("Hide all panels"));
+    mPanelActions[menu_panel_toggle]->setCheckable(true);
+    mPanelActions[menu_panel_toggle]->setChecked(DkSettingsManager::param().app().hideAllPanels);
+
+    mPanelActions[menu_panel_explorer] = new QAction(QObject::tr("File &Explorer"), parent);
+    mPanelActions[menu_panel_explorer]->setShortcut(QKeySequence(shortcut_show_explorer));
+    mPanelActions[menu_panel_explorer]->setStatusTip(QObject::tr("Show File Explorer"));
+    mPanelActions[menu_panel_explorer]->setCheckable(true);
+
+    mPanelActions[menu_panel_metadata_dock] = new QAction(QObject::tr("Metadata &Info"), parent);
+    mPanelActions[menu_panel_metadata_dock]->setShortcut(QKeySequence(shortcut_show_metadata_dock));
+    mPanelActions[menu_panel_metadata_dock]->setStatusTip(QObject::tr("Show Metadata Info"));
+    mPanelActions[menu_panel_metadata_dock]->setCheckable(true);
+
+    mPanelActions[menu_panel_preview] = new QAction(QObject::tr("&Thumbnails"), parent);
+    mPanelActions[menu_panel_preview]->setShortcut(QKeySequence(shortcut_open_preview));
+    mPanelActions[menu_panel_preview]->setStatusTip(QObject::tr("Show Thumbnails"));
+    mPanelActions[menu_panel_preview]->setCheckable(true);
+
+    mPanelActions[menu_panel_thumbview] = new QAction(QObject::tr("&Thumbnail Preview"), parent);
+    mPanelActions[menu_panel_thumbview]->setShortcut(QKeySequence(shortcut_open_thumbview));
+    mPanelActions[menu_panel_thumbview]->setStatusTip(QObject::tr("Show Thumbnails Preview"));
+    mPanelActions[menu_panel_thumbview]->setCheckable(true);
+
+    mPanelActions[menu_panel_scroller] = new QAction(QObject::tr("&Folder Scrollbar"), parent);
+    mPanelActions[menu_panel_scroller]->setStatusTip(QObject::tr("Show Folder Scrollbar"));
+    mPanelActions[menu_panel_scroller]->setCheckable(true);
+
+    mPanelActions[menu_panel_exif] = new QAction(QObject::tr("&Metadata Ribbon"), parent);
+    mPanelActions[menu_panel_exif]->setShortcut(QKeySequence(shortcut_show_exif));
+    mPanelActions[menu_panel_exif]->setStatusTip(QObject::tr("Shows the Metadata Panel"));
+    mPanelActions[menu_panel_exif]->setCheckable(true);
+
+    mPanelActions[menu_panel_info] = new QAction(QObject::tr("File &Info"), parent);
+    mPanelActions[menu_panel_info]->setShortcut(QKeySequence(shortcut_show_info));
+    mPanelActions[menu_panel_info]->setStatusTip(QObject::tr("Shows the Info Panel"));
+    mPanelActions[menu_panel_info]->setCheckable(true);
+
+    mPanelActions[menu_panel_histogram] = new QAction(QObject::tr("&Histogram"), parent);
+    mPanelActions[menu_panel_histogram]->setShortcut(QKeySequence(shortcut_show_histogram));
+    mPanelActions[menu_panel_histogram]->setStatusTip(QObject::tr("Shows the Histogram Panel"));
+    mPanelActions[menu_panel_histogram]->setCheckable(true);
+
+    mPanelActions[menu_panel_comment] = new QAction(QObject::tr("Image &Notes"), parent);
+    mPanelActions[menu_panel_comment]->setShortcut(QKeySequence(shortcut_show_comment));
+    mPanelActions[menu_panel_comment]->setStatusTip(QObject::tr("Shows Image Notes"));
+    mPanelActions[menu_panel_comment]->setCheckable(true);
+
+    mPanelActions[menu_panel_history] = new QAction(QObject::tr("Edit &History"), parent);
+    mPanelActions[menu_panel_history]->setStatusTip(QObject::tr("Shows the edit history"));
+    mPanelActions[menu_panel_history]->setShortcut(QKeySequence(shortcut_show_history));
+    mPanelActions[menu_panel_history]->setCheckable(true);
+
+    mPanelActions[menu_panel_log] = new QAction(QObject::tr("Show &Log"), parent);
+    mPanelActions[menu_panel_log]->setStatusTip(QObject::tr("Shows the log window"));
+    mPanelActions[menu_panel_log]->setShortcut(QKeySequence(shortcut_show_log));
+    mPanelActions[menu_panel_log]->setCheckable(true);
+
+    // view actions
+    mViewActions.resize(menu_view_end);
+
+    mViewActions[menu_view_new_tab] = new QAction(QObject::tr("New &Tab"), parent);
+    mViewActions[menu_view_new_tab]->setShortcut(QKeySequence(shortcut_new_tab));
+    mViewActions[menu_view_new_tab]->setStatusTip(QObject::tr("Open a new tab"));
+
+    mViewActions[menu_view_close_tab] = new QAction(QObject::tr("&Close Tab"), parent);
+    mViewActions[menu_view_close_tab]->setShortcut(QKeySequence(shortcut_close_tab));
+    mViewActions[menu_view_close_tab]->setStatusTip(QObject::tr("Close current tab"));
+
+    mViewActions[menu_view_close_all_tabs] = new QAction(QObject::tr("&Close All Tabs"), parent);
+    mViewActions[menu_view_close_all_tabs]->setStatusTip(QObject::tr("Close all open tabs"));
+
+    mViewActions[menu_view_fit_frame] = new QAction(QObject::tr("&Fit Window to Image"), parent);
+    mViewActions[menu_view_fit_frame]->setShortcut(QKeySequence(shortcut_fit_frame));
+    mViewActions[menu_view_fit_frame]->setStatusTip(QObject::tr("Fit window to the image"));
+
+    mViewActions[menu_view_first_tab] = new QAction(QObject::tr("F&irst Tab"), parent);
+    mViewActions[menu_view_first_tab]->setStatusTip(QObject::tr("Switch to first tab"));
+
+    mViewActions[menu_view_previous_tab] = new QAction(QObject::tr("&Previous Tab"), parent);
+    mViewActions[menu_view_previous_tab]->setShortcut(QKeySequence(shortcut_previous_tab));
+    mViewActions[menu_view_previous_tab]->setStatusTip(QObject::tr("Switch to previous tab"));
+
+    mViewActions[menu_view_goto_tab] = new QAction(QObject::tr("&Go to Tab"), parent);
+    mViewActions[menu_view_goto_tab]->setStatusTip(QObject::tr("Go to tab by index"));
+
+    mViewActions[menu_view_next_tab] = new QAction(QObject::tr("&Next Tab"), parent);
+    mViewActions[menu_view_next_tab]->setShortcut(QKeySequence(shortcut_next_tab));
+    mViewActions[menu_view_next_tab]->setStatusTip(QObject::tr("Switch to next tab"));
+
+    mViewActions[menu_view_last_tab] = new QAction(QObject::tr("La&st Tab"), parent);
+    mViewActions[menu_view_last_tab]->setStatusTip(QObject::tr("Switch to last tab"));
+
+    QList<QKeySequence> scs;
+    scs.append(shortcut_full_screen_ff);
+    scs.append(shortcut_full_screen_ad);
+    mViewActions[menu_view_fullscreen] = new QAction(mViewIcons[icon_view_fullscreen], QObject::tr("Fu&ll Screen"), parent);
+    mViewActions[menu_view_fullscreen]->setShortcuts(scs);
+    mViewActions[menu_view_fullscreen]->setStatusTip(QObject::tr("Full Screen"));
+
+    mViewActions[menu_view_reset] = new QAction(mViewIcons[icon_view_reset], QObject::tr("&Fit Image to Window"), parent);
+    mViewActions[menu_view_reset]->setShortcut(QKeySequence(shortcut_reset_view));
+    mViewActions[menu_view_reset]->setStatusTip(QObject::tr("Zoom image to fit window"));
+
+    mViewActions[menu_view_100] = new QAction(mViewIcons[icon_view_100], QObject::tr("Show &100%"), parent);
+    mViewActions[menu_view_100]->setShortcut(QKeySequence(shortcut_zoom_full));
+    mViewActions[menu_view_100]->setStatusTip(QObject::tr("Shows the image at 100%"));
+
+    mViewActions[menu_view_zoom_in] = new QAction(mViewIcons[icon_view_zoom_in], QObject::tr("Zoom &In"), parent);
+    mViewActions[menu_view_zoom_in]->setShortcut(QKeySequence::ZoomIn);
+    mViewActions[menu_view_zoom_in]->setStatusTip(QObject::tr("zoom in"));
+
+    mViewActions[menu_view_zoom_out] = new QAction(mViewIcons[icon_view_zoom_out], QObject::tr("&Zoom Out"), parent);
+    mViewActions[menu_view_zoom_out]->setShortcut(QKeySequence::ZoomOut);
+    mViewActions[menu_view_zoom_out]->setStatusTip(QObject::tr("zoom out"));
+
+    mViewActions[menu_view_anti_aliasing] = new QAction(QObject::tr("&Anti Aliasing"), parent);
+    mViewActions[menu_view_anti_aliasing]->setShortcut(QKeySequence(shortcut_anti_aliasing));
+    mViewActions[menu_view_anti_aliasing]->setStatusTip(QObject::tr("if checked images are smoother"));
+    mViewActions[menu_view_anti_aliasing]->setCheckable(true);
+    mViewActions[menu_view_anti_aliasing]->setChecked(DkSettingsManager::param().display().antiAliasing);
+
+    mViewActions[menu_view_tp_pattern] = new QAction(QObject::tr("&Transparency Pattern"), parent);
+    mViewActions[menu_view_tp_pattern]->setShortcut(QKeySequence(shortcut_tp_pattern));
+    mViewActions[menu_view_tp_pattern]->setStatusTip(QObject::tr("if checked, a pattern will be displayed for transparent objects"));
+    mViewActions[menu_view_tp_pattern]->setCheckable(true);
+    mViewActions[menu_view_tp_pattern]->setChecked(DkSettingsManager::param().display().tpPattern);
+
+    mViewActions[menu_view_frameless] = new QAction(QObject::tr("&Frameless"), parent);
+    mViewActions[menu_view_frameless]->setShortcut(QKeySequence(shortcut_frameless));
+    mViewActions[menu_view_frameless]->setStatusTip(QObject::tr("shows a frameless window"));
+    mViewActions[menu_view_frameless]->setCheckable(true);
+    mViewActions[menu_view_frameless]->setChecked(false);
+
+    mViewActions[menu_view_opacity_change] = new QAction(QObject::tr("&Change Opacity"), parent);
+    mViewActions[menu_view_opacity_change]->setShortcut(QKeySequence(shortcut_opacity_change));
+    mViewActions[menu_view_opacity_change]->setStatusTip(QObject::tr("change the window opacity"));
+
+    mViewActions[menu_view_opacity_up] = new QAction(QObject::tr("Opacity &Up"), parent);
+    mViewActions[menu_view_opacity_up]->setShortcut(QKeySequence(shortcut_opacity_up));
+    mViewActions[menu_view_opacity_up]->setStatusTip(QObject::tr("changes the window opacity"));
+
+    mViewActions[menu_view_opacity_down] = new QAction(QObject::tr("Opacity &Down"), parent);
+    mViewActions[menu_view_opacity_down]->setShortcut(QKeySequence(shortcut_opacity_down));
+    mViewActions[menu_view_opacity_down]->setStatusTip(QObject::tr("changes the window opacity"));
+
+    mViewActions[menu_view_opacity_an] = new QAction(QObject::tr("To&ggle Opacity"), parent);
+    mViewActions[menu_view_opacity_an]->setShortcut(QKeySequence(shortcut_an_opacity));
+    mViewActions[menu_view_opacity_an]->setStatusTip(QObject::tr("toggle the window opacity"));
+
+    mViewActions[menu_view_lock_window] = new QAction(QObject::tr("Lock &Window"), parent);
+    mViewActions[menu_view_lock_window]->setShortcut(QKeySequence(shortcut_lock_window));
+    mViewActions[menu_view_lock_window]->setStatusTip(QObject::tr("lock the window"));
+    mViewActions[menu_view_lock_window]->setCheckable(true);
+    mViewActions[menu_view_lock_window]->setChecked(false);
+
+    mViewActions[menu_view_slideshow] = new QAction(QObject::tr("&Toggle Slideshow"), parent);
+    mViewActions[menu_view_slideshow]->setStatusTip(QObject::tr("Start/Pause the slideshow"));
+    mViewActions[menu_view_slideshow]->setShortcut(QKeySequence(shortcut_view_slideshow));
+
+    mViewActions[menu_view_movie_pause] = new QAction(mViewIcons[icon_view_movie_play], QObject::tr("&Pause Movie"), parent);
+    mViewActions[menu_view_movie_pause]->setStatusTip(QObject::tr("pause the current movie"));
+    mViewActions[menu_view_movie_pause]->setCheckable(true);
+    mViewActions[menu_view_movie_pause]->setChecked(false);
+
+    mViewActions[menu_view_movie_prev] = new QAction(mViewIcons[icon_view_movie_prev], QObject::tr("P&revious Frame"), parent);
+    mViewActions[menu_view_movie_prev]->setStatusTip(QObject::tr("show previous frame"));
+
+    mViewActions[menu_view_movie_next] = new QAction(mViewIcons[icon_view_movie_next], QObject::tr("&Next Frame"), parent);
+    mViewActions[menu_view_movie_next]->setStatusTip(QObject::tr("show next frame"));
+
+    mViewActions[menu_view_monitors] = new QAction(QObject::tr("Choose &Monitor"), parent);
+    mViewActions[menu_view_monitors]->setStatusTip(QObject::tr("Choose the Monitor to run nomacs"));
+
+    mViewActions[menu_view_gps_map] = new QAction(mViewIcons[icon_view_gps], QObject::tr("Show Image Location"), parent);
+    mViewActions[menu_view_gps_map]->setStatusTip(QObject::tr("shows where the image was taken in Google maps"));
+    mViewActions[menu_view_gps_map]->setEnabled(false);
+
+    // tools actions
+    mToolsActions.resize(menu_tools_end);
+
+    mToolsActions[menu_tools_thumbs] = new QAction(QObject::tr("Compute &Thumbnails"), parent);
+    mToolsActions[menu_tools_thumbs]->setStatusTip(QObject::tr("compute all thumbnails of the current folder"));
+    mToolsActions[menu_tools_thumbs]->setEnabled(false);
+
+    mToolsActions[menu_tools_filter] = new QAction(mFileIcons[icon_file_filter], QObject::tr("&Filter"), parent);
+    mToolsActions[menu_tools_filter]->setStatusTip(QObject::tr("Find an image"));
+    mToolsActions[menu_tools_filter]->setCheckable(true);
+    mToolsActions[menu_tools_filter]->setChecked(false);
+
+    mToolsActions[menu_tools_export_tiff] = new QAction(QObject::tr("Export Multipage &TIFF"), parent);
+    mToolsActions[menu_tools_export_tiff]->setStatusTip(QObject::tr("Export TIFF pages to multiple tiff files"));
+
+    mToolsActions[menu_tools_extract_archive] = new QAction(QObject::tr("Extract From Archive"), parent);
+    mToolsActions[menu_tools_extract_archive]->setStatusTip(
+        QObject::tr("Extract images from an archive (%1)").arg(DkSettingsManager::param().app().containerRawFilters));
+    mToolsActions[menu_tools_extract_archive]->setShortcut(QKeySequence(shortcut_extract));
+
+    mToolsActions[menu_tools_mosaic] = new QAction(QObject::tr("&Mosaic Image"), parent);
+    mToolsActions[menu_tools_mosaic]->setStatusTip(QObject::tr("Create a Mosaic Image"));
+
+    mToolsActions[menu_tools_batch] = new QAction(QObject::tr("Batch Processing"), parent);
+    mToolsActions[menu_tools_batch]->setStatusTip(QObject::tr("Apply actions to multiple images"));
+    mToolsActions[menu_tools_batch]->setShortcut(QKeySequence(shortcut_batch_processing));
+
+    mToolsActions[menu_tools_wallpaper] = new QAction(QObject::tr("&Wallpaper"), parent);
+    mToolsActions[menu_tools_wallpaper]->setStatusTip(QObject::tr("set the current image as wallpaper"));
 
-	// help menu
-	mHelpActions.resize(menu_help_end);
-	mHelpActions[menu_help_about] = new QAction(QObject::tr("&About Nomacs"), parent);
-	mHelpActions[menu_help_about]->setShortcut(QKeySequence(shortcut_show_help));
-	mHelpActions[menu_help_about]->setStatusTip(QObject::tr("about"));
+    mToolsActions[menu_tools_train_format] = new QAction(QObject::tr("Add Image Format"), parent);
+    mToolsActions[menu_tools_train_format]->setStatusTip(QObject::tr("Add a new image format to nomacs"));
 
-	mHelpActions[menu_help_documentation] = new QAction(QObject::tr("&Documentation"), parent);
-	mHelpActions[menu_help_documentation]->setStatusTip(QObject::tr("Online Documentation"));
+    // help menu
+    mHelpActions.resize(menu_help_end);
+    mHelpActions[menu_help_about] = new QAction(QObject::tr("&About Nomacs"), parent);
+    mHelpActions[menu_help_about]->setShortcut(QKeySequence(shortcut_show_help));
+    mHelpActions[menu_help_about]->setStatusTip(QObject::tr("about"));
+
+    mHelpActions[menu_help_documentation] = new QAction(QObject::tr("&Documentation"), parent);
+    mHelpActions[menu_help_documentation]->setStatusTip(QObject::tr("Online Documentation"));
 
-	mHelpActions[menu_help_bug] = new QAction(QObject::tr("&Report a Bug"), parent);
-	mHelpActions[menu_help_bug]->setStatusTip(QObject::tr("Report a Bug"));
+    mHelpActions[menu_help_bug] = new QAction(QObject::tr("&Report a Bug"), parent);
+    mHelpActions[menu_help_bug]->setStatusTip(QObject::tr("Report a Bug"));
 
-	mHelpActions[menu_help_update] = new QAction(QObject::tr("&Check for Updates"), parent);
-	mHelpActions[menu_help_update]->setStatusTip(QObject::tr("check for updates"));
-	mHelpActions[menu_help_update]->setDisabled(DkSettingsManager::param().sync().disableUpdateInteraction);
+    mHelpActions[menu_help_update] = new QAction(QObject::tr("&Check for Updates"), parent);
+    mHelpActions[menu_help_update]->setStatusTip(QObject::tr("check for updates"));
+    mHelpActions[menu_help_update]->setDisabled(DkSettingsManager::param().sync().disableUpdateInteraction);
 
-	mHelpActions[menu_help_update_translation] = new QAction(QObject::tr("&Update Translation"), parent);
-	mHelpActions[menu_help_update_translation]->setStatusTip(QObject::tr("Checks for a new version of the translations of the current language"));
-	mHelpActions[menu_help_update_translation]->setDisabled(DkSettingsManager::param().sync().disableUpdateInteraction);
+    mHelpActions[menu_help_update_translation] = new QAction(QObject::tr("&Update Translation"), parent);
+    mHelpActions[menu_help_update_translation]->setStatusTip(QObject::tr("Checks for a new version of the translations of the current language"));
+    mHelpActions[menu_help_update_translation]->setDisabled(DkSettingsManager::param().sync().disableUpdateInteraction);
 
-	// sync actions
-	mSyncActions.resize(menu_sync_end);
-	mSyncActions[menu_sync_view] = new QAction(QObject::tr("Synchronize &View"), parent);
-	mSyncActions[menu_sync_view]->setShortcut(QKeySequence(shortcut_sync));
-	mSyncActions[menu_sync_view]->setStatusTip(QObject::tr("synchronize the current view"));
-	mSyncActions[menu_sync_view]->setEnabled(false);
+    // sync actions
+    mSyncActions.resize(menu_sync_end);
+    mSyncActions[menu_sync_view] = new QAction(QObject::tr("Synchronize &View"), parent);
+    mSyncActions[menu_sync_view]->setShortcut(QKeySequence(shortcut_sync));
+    mSyncActions[menu_sync_view]->setStatusTip(QObject::tr("synchronize the current view"));
+    mSyncActions[menu_sync_view]->setEnabled(false);
 
-	mSyncActions[menu_sync_pos] = new QAction(QObject::tr("&Window Overlay"), parent);
-	mSyncActions[menu_sync_pos]->setShortcut(QKeySequence(shortcut_tab));
-	mSyncActions[menu_sync_pos]->setStatusTip(QObject::tr("toggle the window opacity"));
-	mSyncActions[menu_sync_pos]->setEnabled(false);
+    mSyncActions[menu_sync_pos] = new QAction(QObject::tr("&Window Overlay"), parent);
+    mSyncActions[menu_sync_pos]->setShortcut(QKeySequence(shortcut_tab));
+    mSyncActions[menu_sync_pos]->setStatusTip(QObject::tr("toggle the window opacity"));
+    mSyncActions[menu_sync_pos]->setEnabled(false);
 
-	mSyncActions[menu_sync_arrange] = new QAction(QObject::tr("Arrange Instances"), parent);
-	mSyncActions[menu_sync_arrange]->setShortcut(QKeySequence(shortcut_arrange));
-	mSyncActions[menu_sync_arrange]->setStatusTip(QObject::tr("arrange connected instances"));
-	mSyncActions[menu_sync_arrange]->setEnabled(false);
+    mSyncActions[menu_sync_arrange] = new QAction(QObject::tr("Arrange Instances"), parent);
+    mSyncActions[menu_sync_arrange]->setShortcut(QKeySequence(shortcut_arrange));
+    mSyncActions[menu_sync_arrange]->setStatusTip(QObject::tr("arrange connected instances"));
+    mSyncActions[menu_sync_arrange]->setEnabled(false);
 
-	mSyncActions[menu_sync_connect_all] = new QAction(QObject::tr("Connect &All"), parent);
-	mSyncActions[menu_sync_connect_all]->setShortcutContext(Qt::WidgetWithChildrenShortcut);
-	mSyncActions[menu_sync_connect_all]->setShortcut(QKeySequence(shortcut_connect_all));
-	mSyncActions[menu_sync_connect_all]->setStatusTip(QObject::tr("connect all instances"));
+    mSyncActions[menu_sync_connect_all] = new QAction(QObject::tr("Connect &All"), parent);
+    mSyncActions[menu_sync_connect_all]->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+    mSyncActions[menu_sync_connect_all]->setShortcut(QKeySequence(shortcut_connect_all));
+    mSyncActions[menu_sync_connect_all]->setStatusTip(QObject::tr("connect all instances"));
 
-	mSyncActions[menu_sync_all_actions] = new QAction(QObject::tr("&Sync All Actions"), parent);
-	mSyncActions[menu_sync_all_actions]->setStatusTip(QObject::tr("Transmit All Signals Automatically."));
-	mSyncActions[menu_sync_all_actions]->setCheckable(true);
-	mSyncActions[menu_sync_all_actions]->setChecked(DkSettingsManager::param().sync().syncActions);
+    mSyncActions[menu_sync_all_actions] = new QAction(QObject::tr("&Sync All Actions"), parent);
+    mSyncActions[menu_sync_all_actions]->setStatusTip(QObject::tr("Transmit All Signals Automatically."));
+    mSyncActions[menu_sync_all_actions]->setCheckable(true);
+    mSyncActions[menu_sync_all_actions]->setChecked(DkSettingsManager::param().sync().syncActions);
 
-	// plugin actions
-	mPluginActions.resize(menu_plugins_end);
-	mPluginActions[menu_plugin_manager] = new QAction(QObject::tr("&Plugin Manager"), parent);
-	mPluginActions[menu_plugin_manager]->setStatusTip(QObject::tr("manage installed plugins and download new ones"));
+    // plugin actions
+    mPluginActions.resize(menu_plugins_end);
+    mPluginActions[menu_plugin_manager] = new QAction(QObject::tr("&Plugin Manager"), parent);
+    mPluginActions[menu_plugin_manager]->setStatusTip(QObject::tr("manage installed plugins and download new ones"));
 
-	// preview actions
-	mPreviewActions.resize(actions_end);
+    // preview actions
+    mPreviewActions.resize(actions_end);
 
-	mPreviewActions[preview_select_all] = new QAction(QObject::tr("Select &All"), parent);
-	mPreviewActions[preview_select_all]->setShortcut(QKeySequence::SelectAll);
-	mPreviewActions[preview_select_all]->setCheckable(true);
+    mPreviewActions[preview_select_all] = new QAction(QObject::tr("Select &All"), parent);
+    mPreviewActions[preview_select_all]->setShortcut(QKeySequence::SelectAll);
+    mPreviewActions[preview_select_all]->setCheckable(true);
 
-	mPreviewActions[preview_zoom_in] = new QAction(DkImage::loadIcon(":/nomacs/img/zoom-in.svg"), QObject::tr("Zoom &In"), parent);
-	mPreviewActions[preview_zoom_in]->setShortcut(QKeySequence::ZoomIn);
+    mPreviewActions[preview_zoom_in] = new QAction(DkImage::loadIcon(":/nomacs/img/zoom-in.svg"), QObject::tr("Zoom &In"), parent);
+    mPreviewActions[preview_zoom_in]->setShortcut(QKeySequence::ZoomIn);
 
-	mPreviewActions[preview_zoom_out] = new QAction(DkImage::loadIcon(":/nomacs/img/zoom-out.svg"), QObject::tr("Zoom &Out"), parent);
-	mPreviewActions[preview_zoom_out]->setShortcut(QKeySequence::ZoomOut);
+    mPreviewActions[preview_zoom_out] = new QAction(DkImage::loadIcon(":/nomacs/img/zoom-out.svg"), QObject::tr("Zoom &Out"), parent);
+    mPreviewActions[preview_zoom_out]->setShortcut(QKeySequence::ZoomOut);
 
-	mPreviewActions[preview_display_squares] = new QAction(DkImage::loadIcon(":/nomacs/img/rects.svg"), QObject::tr("Display &Squares"), parent);
-	mPreviewActions[preview_display_squares]->setCheckable(true);
-	mPreviewActions[preview_display_squares]->setChecked(DkSettingsManager::param().display().displaySquaredThumbs);
+    mPreviewActions[preview_display_squares] = new QAction(DkImage::loadIcon(":/nomacs/img/rects.svg"), QObject::tr("Display &Squares"), parent);
+    mPreviewActions[preview_display_squares]->setCheckable(true);
+    mPreviewActions[preview_display_squares]->setChecked(DkSettingsManager::param().display().displaySquaredThumbs);
 
-	mPreviewActions[preview_show_labels] = new QAction(DkImage::loadIcon(":/nomacs/img/show-filename.svg"), QObject::tr("Show &Filename"), parent);
-	mPreviewActions[preview_show_labels]->setCheckable(true);
-	mPreviewActions[preview_show_labels]->setChecked(DkSettingsManager::param().display().showThumbLabel);
+    mPreviewActions[preview_show_labels] = new QAction(DkImage::loadIcon(":/nomacs/img/show-filename.svg"), QObject::tr("Show &Filename"), parent);
+    mPreviewActions[preview_show_labels]->setCheckable(true);
+    mPreviewActions[preview_show_labels]->setChecked(DkSettingsManager::param().display().showThumbLabel);
 
-	mPreviewActions[preview_filter] = new QAction(QObject::tr("&Filter"), parent);
-	mPreviewActions[preview_filter]->setShortcut(QKeySequence::Find);
+    mPreviewActions[preview_filter] = new QAction(QObject::tr("&Filter"), parent);
+    mPreviewActions[preview_filter]->setShortcut(QKeySequence::Find);
 
-	mPreviewActions[preview_delete] = new QAction(DkImage::loadIcon(":/nomacs/img/trash.svg"), QObject::tr("&Delete"), parent);
-	mPreviewActions[preview_delete]->setShortcut(QKeySequence::Delete);
+    mPreviewActions[preview_delete] = new QAction(DkImage::loadIcon(":/nomacs/img/trash.svg"), QObject::tr("&Delete"), parent);
+    mPreviewActions[preview_delete]->setShortcut(QKeySequence::Delete);
 
-	mPreviewActions[preview_copy] = new QAction(DkImage::loadIcon(":/nomacs/img/copy.svg"), QObject::tr("&Copy"), parent);
-	mPreviewActions[preview_copy]->setShortcut(QKeySequence::Copy);
+    mPreviewActions[preview_copy] = new QAction(DkImage::loadIcon(":/nomacs/img/copy.svg"), QObject::tr("&Copy"), parent);
+    mPreviewActions[preview_copy]->setShortcut(QKeySequence::Copy);
 
-	mPreviewActions[preview_paste] = new QAction(DkImage::loadIcon(":/nomacs/img/paste.svg"), QObject::tr("&Paste"), parent);
-	mPreviewActions[preview_paste]->setShortcut(QKeySequence::Paste);
+    mPreviewActions[preview_paste] = new QAction(DkImage::loadIcon(":/nomacs/img/paste.svg"), QObject::tr("&Paste"), parent);
+    mPreviewActions[preview_paste]->setShortcut(QKeySequence::Paste);
 
-	mPreviewActions[preview_rename] = new QAction(DkImage::loadIcon(":/nomacs/img/rename.svg"), QObject::tr("&Rename"), parent);
-	mPreviewActions[preview_rename]->setShortcut(QKeySequence(Qt::Key_F2));
+    mPreviewActions[preview_rename] = new QAction(DkImage::loadIcon(":/nomacs/img/rename.svg"), QObject::tr("&Rename"), parent);
+    mPreviewActions[preview_rename]->setShortcut(QKeySequence(Qt::Key_F2));
 
-	mPreviewActions[preview_batch] = new QAction(DkImage::loadIcon(":/nomacs/img/batch-processing.svg"), QObject::tr("&Batch Process"), parent);
-	mPreviewActions[preview_batch]->setToolTip(QObject::tr("Adds selected files to batch processing."));
-	mPreviewActions[preview_batch]->setShortcut(QKeySequence(Qt::Key_B));
+    mPreviewActions[preview_batch] = new QAction(DkImage::loadIcon(":/nomacs/img/batch-processing.svg"), QObject::tr("&Batch Process"), parent);
+    mPreviewActions[preview_batch]->setToolTip(QObject::tr("Adds selected files to batch processing."));
+    mPreviewActions[preview_batch]->setShortcut(QKeySequence(Qt::Key_B));
 
-	mPreviewActions[preview_print] = new QAction(DkImage::loadIcon(":/nomacs/img/print.svg"), QObject::tr("&Batch Print"), parent);
-	mPreviewActions[preview_print]->setToolTip(QObject::tr("Prints selected files."));
-	mPreviewActions[preview_print]->setShortcut(QKeySequence::Print);
+    mPreviewActions[preview_print] = new QAction(DkImage::loadIcon(":/nomacs/img/print.svg"), QObject::tr("&Batch Print"), parent);
+    mPreviewActions[preview_print]->setToolTip(QObject::tr("Prints selected files."));
+    mPreviewActions[preview_print]->setShortcut(QKeySequence::Print);
 
-	// hidden actions
-	mHiddenActions.resize(sc_end);
+    // hidden actions
+    mHiddenActions.resize(sc_end);
 
-	mHiddenActions[sc_test_img] = new QAction(QObject::QObject::tr("Lena"), parent);
-	mHiddenActions[sc_test_img]->setStatusTip(QObject::QObject::tr("Show test image"));
-	mHiddenActions[sc_test_img]->setShortcut(QKeySequence(shortcut_test_img));
+    mHiddenActions[sc_test_img] = new QAction(QObject::QObject::tr("Lena"), parent);
+    mHiddenActions[sc_test_img]->setStatusTip(QObject::QObject::tr("Show test image"));
+    mHiddenActions[sc_test_img]->setShortcut(QKeySequence(shortcut_test_img));
 
-	mHiddenActions[sc_test_rec] = new QAction(QObject::QObject::tr("All Images"), parent);
-	mHiddenActions[sc_test_rec]->setStatusTip(QObject::QObject::tr("Generates all images in the world"));
-	mHiddenActions[sc_test_rec]->setShortcut(QKeySequence(shortcut_test_rec));
+    mHiddenActions[sc_test_rec] = new QAction(QObject::QObject::tr("All Images"), parent);
+    mHiddenActions[sc_test_rec]->setStatusTip(QObject::QObject::tr("Generates all images in the world"));
+    mHiddenActions[sc_test_rec]->setShortcut(QKeySequence(shortcut_test_rec));
 
-	mHiddenActions[sc_test_pong] = new QAction(QObject::QObject::tr("Pong"), parent);
-	mHiddenActions[sc_test_pong]->setStatusTip(QObject::tr("Start pong"));
-	mHiddenActions[sc_test_pong]->setShortcut(QKeySequence(shortcut_test_pong));
+    mHiddenActions[sc_test_pong] = new QAction(QObject::QObject::tr("Pong"), parent);
+    mHiddenActions[sc_test_pong]->setStatusTip(QObject::tr("Start pong"));
+    mHiddenActions[sc_test_pong]->setShortcut(QKeySequence(shortcut_test_pong));
 
-	mHiddenActions[sc_first_file] = new QAction(QObject::tr("First File"), parent);
-	mHiddenActions[sc_first_file]->setStatusTip(QObject::tr("Jump to first file"));
-	mHiddenActions[sc_first_file]->setShortcut(QKeySequence(shortcut_first_file));
+    mHiddenActions[sc_first_file] = new QAction(QObject::tr("First File"), parent);
+    mHiddenActions[sc_first_file]->setStatusTip(QObject::tr("Jump to first file"));
+    mHiddenActions[sc_first_file]->setShortcut(QKeySequence(shortcut_first_file));
 
-	mHiddenActions[sc_last_file] = new QAction(QObject::tr("Last File"), parent);
-	mHiddenActions[sc_last_file]->setStatusTip(QObject::tr("Jump to the end of the current folder"));
-	mHiddenActions[sc_last_file]->setShortcut(QKeySequence(shortcut_last_file));
+    mHiddenActions[sc_last_file] = new QAction(QObject::tr("Last File"), parent);
+    mHiddenActions[sc_last_file]->setStatusTip(QObject::tr("Jump to the end of the current folder"));
+    mHiddenActions[sc_last_file]->setShortcut(QKeySequence(shortcut_last_file));
 
-	mHiddenActions[sc_skip_prev] = new QAction(QObject::tr("Skip Previous Images"), parent);
-	mHiddenActions[sc_skip_prev]->setStatusTip(QObject::tr("Jumps 10 images before the current image"));
-	mHiddenActions[sc_skip_prev]->setShortcut(QKeySequence(shortcut_skip_prev));
+    mHiddenActions[sc_skip_prev] = new QAction(QObject::tr("Skip Previous Images"), parent);
+    mHiddenActions[sc_skip_prev]->setStatusTip(QObject::tr("Jumps 10 images before the current image"));
+    mHiddenActions[sc_skip_prev]->setShortcut(QKeySequence(shortcut_skip_prev));
 
-	mHiddenActions[sc_skip_next] = new QAction(QObject::tr("Skip Next Images"), parent);
-	mHiddenActions[sc_skip_next]->setStatusTip(QObject::tr("Jumps 10 images after the current image"));
-	mHiddenActions[sc_skip_next]->setShortcut(QKeySequence(shortcut_skip_next));
+    mHiddenActions[sc_skip_next] = new QAction(QObject::tr("Skip Next Images"), parent);
+    mHiddenActions[sc_skip_next]->setStatusTip(QObject::tr("Jumps 10 images after the current image"));
+    mHiddenActions[sc_skip_next]->setShortcut(QKeySequence(shortcut_skip_next));
 
-	mHiddenActions[sc_first_file_sync] = new QAction(QObject::tr("First File Sync"), parent);
-	mHiddenActions[sc_first_file_sync]->setStatusTip(QObject::tr("Jump to first file"));
-	mHiddenActions[sc_first_file_sync]->setShortcut(QKeySequence(shortcut_first_file_sync));
+    mHiddenActions[sc_first_file_sync] = new QAction(QObject::tr("First File Sync"), parent);
+    mHiddenActions[sc_first_file_sync]->setStatusTip(QObject::tr("Jump to first file"));
+    mHiddenActions[sc_first_file_sync]->setShortcut(QKeySequence(shortcut_first_file_sync));
 
-	mHiddenActions[sc_last_file_sync] = new QAction(QObject::tr("Last File Sync"), parent);
-	mHiddenActions[sc_last_file_sync]->setStatusTip(QObject::tr("Jump to the end of the current folder"));
-	mHiddenActions[sc_last_file_sync]->setShortcut(QKeySequence(shortcut_last_file_sync));
+    mHiddenActions[sc_last_file_sync] = new QAction(QObject::tr("Last File Sync"), parent);
+    mHiddenActions[sc_last_file_sync]->setStatusTip(QObject::tr("Jump to the end of the current folder"));
+    mHiddenActions[sc_last_file_sync]->setShortcut(QKeySequence(shortcut_last_file_sync));
 
-	mHiddenActions[sc_skip_prev_sync] = new QAction(QObject::tr("Skip Previous Images Sync"), parent);
-	mHiddenActions[sc_skip_prev_sync]->setStatusTip(QObject::tr("Jumps 10 images before the current image"));
-	mHiddenActions[sc_skip_prev_sync]->setShortcut(QKeySequence(shortcut_skip_prev_sync));
+    mHiddenActions[sc_skip_prev_sync] = new QAction(QObject::tr("Skip Previous Images Sync"), parent);
+    mHiddenActions[sc_skip_prev_sync]->setStatusTip(QObject::tr("Jumps 10 images before the current image"));
+    mHiddenActions[sc_skip_prev_sync]->setShortcut(QKeySequence(shortcut_skip_prev_sync));
 
-	mHiddenActions[sc_skip_next_sync] = new QAction(QObject::tr("Skip Next Images Sync"), parent);
-	mHiddenActions[sc_skip_next_sync]->setStatusTip(QObject::tr("Jumps 10 images after the current image"));
-	mHiddenActions[sc_skip_next_sync]->setShortcut(QKeySequence(shortcut_skip_next_sync));
+    mHiddenActions[sc_skip_next_sync] = new QAction(QObject::tr("Skip Next Images Sync"), parent);
+    mHiddenActions[sc_skip_next_sync]->setStatusTip(QObject::tr("Jumps 10 images after the current image"));
+    mHiddenActions[sc_skip_next_sync]->setShortcut(QKeySequence(shortcut_skip_next_sync));
 
-	mHiddenActions[sc_delete_silent] = new QAction(QObject::tr("Delete File Silent"), parent);
-	mHiddenActions[sc_delete_silent]->setStatusTip(QObject::tr("Deletes a file without warning"));
-	mHiddenActions[sc_delete_silent]->setShortcut(QKeySequence(shortcut_delete_silent));
+    mHiddenActions[sc_delete_silent] = new QAction(QObject::tr("Delete File Silent"), parent);
+    mHiddenActions[sc_delete_silent]->setStatusTip(QObject::tr("Deletes a file without warning"));
+    mHiddenActions[sc_delete_silent]->setShortcut(QKeySequence(shortcut_delete_silent));
 
-	mHiddenActions[sc_star_rating_0] = new QAction(QObject::tr("Star Rating 0"), parent);
-	mHiddenActions[sc_star_rating_0]->setStatusTip(QObject::tr("Star rating which is saved to an image's metadata"));
-	mHiddenActions[sc_star_rating_0]->setShortcut(QKeySequence(shortcut_star_rating_0));
+    mHiddenActions[sc_star_rating_0] = new QAction(QObject::tr("Star Rating 0"), parent);
+    mHiddenActions[sc_star_rating_0]->setStatusTip(QObject::tr("Star rating which is saved to an image's metadata"));
+    mHiddenActions[sc_star_rating_0]->setShortcut(QKeySequence(shortcut_star_rating_0));
 
-	mHiddenActions[sc_star_rating_1] = new QAction(QObject::tr("Star Rating 1"), parent);
-	mHiddenActions[sc_star_rating_1]->setStatusTip(QObject::tr("Star rating which is saved to an image's metadata"));
-	mHiddenActions[sc_star_rating_1]->setShortcut(QKeySequence(shortcut_star_rating_1));
+    mHiddenActions[sc_star_rating_1] = new QAction(QObject::tr("Star Rating 1"), parent);
+    mHiddenActions[sc_star_rating_1]->setStatusTip(QObject::tr("Star rating which is saved to an image's metadata"));
+    mHiddenActions[sc_star_rating_1]->setShortcut(QKeySequence(shortcut_star_rating_1));
 
-	mHiddenActions[sc_star_rating_2] = new QAction(QObject::tr("Star Rating 2"), parent);
-	mHiddenActions[sc_star_rating_2]->setStatusTip(QObject::tr("Star rating which is saved to an image's metadata"));
-	mHiddenActions[sc_star_rating_2]->setShortcut(QKeySequence(shortcut_star_rating_2));
+    mHiddenActions[sc_star_rating_2] = new QAction(QObject::tr("Star Rating 2"), parent);
+    mHiddenActions[sc_star_rating_2]->setStatusTip(QObject::tr("Star rating which is saved to an image's metadata"));
+    mHiddenActions[sc_star_rating_2]->setShortcut(QKeySequence(shortcut_star_rating_2));
 
-	mHiddenActions[sc_star_rating_3] = new QAction(QObject::tr("Star Rating 3"), parent);
-	mHiddenActions[sc_star_rating_3]->setStatusTip(QObject::tr("Star rating which is saved to an image's metadata"));
-	mHiddenActions[sc_star_rating_3]->setShortcut(QKeySequence(shortcut_star_rating_3));
+    mHiddenActions[sc_star_rating_3] = new QAction(QObject::tr("Star Rating 3"), parent);
+    mHiddenActions[sc_star_rating_3]->setStatusTip(QObject::tr("Star rating which is saved to an image's metadata"));
+    mHiddenActions[sc_star_rating_3]->setShortcut(QKeySequence(shortcut_star_rating_3));
 
-	mHiddenActions[sc_star_rating_4] = new QAction(QObject::tr("Star Rating 4"), parent);
-	mHiddenActions[sc_star_rating_4]->setStatusTip(QObject::tr("Star rating which is saved to an image's metadata"));
-	mHiddenActions[sc_star_rating_4]->setShortcut(QKeySequence(shortcut_star_rating_4));
+    mHiddenActions[sc_star_rating_4] = new QAction(QObject::tr("Star Rating 4"), parent);
+    mHiddenActions[sc_star_rating_4]->setStatusTip(QObject::tr("Star rating which is saved to an image's metadata"));
+    mHiddenActions[sc_star_rating_4]->setShortcut(QKeySequence(shortcut_star_rating_4));
 
-	mHiddenActions[sc_star_rating_5] = new QAction(QObject::tr("Star Rating 5"), parent);
-	mHiddenActions[sc_star_rating_5]->setStatusTip(QObject::tr("Star rating which is saved to an image's metadata"));
-	mHiddenActions[sc_star_rating_5]->setShortcut(QKeySequence(shortcut_star_rating_5));
+    mHiddenActions[sc_star_rating_5] = new QAction(QObject::tr("Star Rating 5"), parent);
+    mHiddenActions[sc_star_rating_5]->setStatusTip(QObject::tr("Star rating which is saved to an image's metadata"));
+    mHiddenActions[sc_star_rating_5]->setShortcut(QKeySequence(shortcut_star_rating_5));
 
-	mHiddenActions[sc_pan_up] = new QAction(QObject::tr("Pan Image Up"), parent);
-	mHiddenActions[sc_pan_up]->setStatusTip(QObject::tr("Pans the image up if zoomed."));
-	mHiddenActions[sc_pan_up]->setShortcut(QKeySequence(shortcut_pan_up));
+    mHiddenActions[sc_pan_up] = new QAction(QObject::tr("Pan Image Up"), parent);
+    mHiddenActions[sc_pan_up]->setStatusTip(QObject::tr("Pans the image up if zoomed."));
+    mHiddenActions[sc_pan_up]->setShortcut(QKeySequence(shortcut_pan_up));
 
-	mHiddenActions[sc_pan_down] = new QAction(QObject::tr("Pan Image Down"), parent);
-	mHiddenActions[sc_pan_down]->setStatusTip(QObject::tr("Pans the image down if zoomed."));
-	mHiddenActions[sc_pan_down]->setShortcut(QKeySequence(shortcut_pan_down));
-
-	mHiddenActions[sc_pan_left] = new QAction(QObject::tr("Pan Image Left"), parent);
-	mHiddenActions[sc_pan_left]->setStatusTip(QObject::tr("Pans the image left if zoomed."));
-	mHiddenActions[sc_pan_left]->setShortcut(QKeySequence(shortcut_pan_left));
-
-	mHiddenActions[sc_pan_right] = new QAction(QObject::tr("Pan Image Right"), parent);
-	mHiddenActions[sc_pan_right]->setStatusTip(QObject::tr("Pans the image right if zoomed."));
-	mHiddenActions[sc_pan_right]->setShortcut(QKeySequence(shortcut_pan_right));
-
-	mManipulators.createManipulators(parent);
-
-	assignCustomShortcuts(allActions());
-
-	// automatically add status tip as tool tip
-	for (QAction* a : allActions()) {
-		a->setToolTip(a->statusTip());
-		a->setShortcutContext(Qt::WidgetWithChildrenShortcut);
-	}
-	
-	// trivial connects
-	QObject::connect(action(menu_panel_toggle), &QAction::triggered,
-		[](bool hide) { DkSettingsManager::param().app().hideAllPanels = hide; });
-
-	QObject::connect(action(menu_panel_statusbar), &QAction::triggered,
-		[](bool show) { DkStatusBarManager::instance().show(show); });
-
-	QObject::connect(action(menu_panel_toolbar), &QAction::triggered,
-		[](bool show) { DkToolBarManager::inst().showDefaultToolBar(show); });
-
-	QObject::connect(action(menu_sync_all_actions), &QAction::triggered,
-		[](bool sync) { DkSettingsManager::param().sync().syncActions = sync; });
-
-}
-
-QVector<QAction*> DkActionManager::allActions() const {
-
-	QVector<QAction*> all;
-	all += fileActions();
-	all += sortActions();
-	all += openWithActions();
-	all += viewActions();
-	all += editActions();
-	all += manipulatorActions();
-	all += toolsActions();
-	all += panelActions();
-	all += syncActions();
-	all += pluginActions();
-	all += helpActions();
-	all += previewActions();
-
-	all += hiddenActions();
-	
-	return all;
-}
-
-void DkActionManager::assignCustomShortcuts(QVector<QAction*> actions) const {
-
-	DefaultSettings settings;
-	settings.beginGroup("CustomShortcuts");
-
-	for (QAction* a : actions) {
-
-		if (!a) {
-			qWarning() << "NULL action detected!";
-			continue;
-		}
-
-		QString at = a->text().remove("&");
-		QString val = settings.value(at, "no-shortcut").toString();
-
-		if (val != "no-shortcut")
-			a->setShortcut(val);
-
-		// assign widget shortcuts to all of them
-		a->setShortcutContext(Qt::WidgetWithChildrenShortcut);
-	}
-
-	settings.endGroup();
-}
-
-void DkActionManager::enableImageActions(bool enable) const {
-	
-	action(DkActionManager::menu_file_save)->setEnabled(enable);
-	action(DkActionManager::menu_file_save_as)->setEnabled(enable);
-	action(DkActionManager::menu_file_save_copy)->setEnabled(enable);
-	action(DkActionManager::menu_file_save_list)->setEnabled(enable);
-	action(DkActionManager::menu_file_save_web)->setEnabled(enable);
-	action(DkActionManager::menu_file_rename)->setEnabled(enable);
-	action(DkActionManager::menu_file_print)->setEnabled(enable);
-	action(DkActionManager::menu_file_reload)->setEnabled(enable);
-	action(DkActionManager::menu_file_prev)->setEnabled(enable);
-	action(DkActionManager::menu_file_next)->setEnabled(enable);
-	action(DkActionManager::menu_file_goto)->setEnabled(enable);
-	action(DkActionManager::menu_file_find)->setEnabled(enable);
-
-	action(DkActionManager::menu_edit_rotate_cw)->setEnabled(enable);
-	action(DkActionManager::menu_edit_rotate_ccw)->setEnabled(enable);
-	action(DkActionManager::menu_edit_rotate_180)->setEnabled(enable);
-	action(DkActionManager::menu_edit_delete)->setEnabled(enable);
-	action(DkActionManager::menu_edit_transform)->setEnabled(enable);
-	action(DkActionManager::menu_edit_crop)->setEnabled(enable);
-	action(DkActionManager::menu_edit_copy)->setEnabled(enable);
-	action(DkActionManager::menu_edit_copy_buffer)->setEnabled(enable);
-	action(DkActionManager::menu_edit_copy_color)->setEnabled(enable);
-	action(DkActionManager::menu_edit_undo)->setEnabled(enable);
-	action(DkActionManager::menu_edit_redo)->setEnabled(enable);
-
-
-	action(DkActionManager::menu_panel_info)->setEnabled(enable);
+    mHiddenActions[sc_pan_down] = new QAction(QObject::tr("Pan Image Down"), parent);
+    mHiddenActions[sc_pan_down]->setStatusTip(QObject::tr("Pans the image down if zoomed."));
+    mHiddenActions[sc_pan_down]->setShortcut(QKeySequence(shortcut_pan_down));
+
+    mHiddenActions[sc_pan_left] = new QAction(QObject::tr("Pan Image Left"), parent);
+    mHiddenActions[sc_pan_left]->setStatusTip(QObject::tr("Pans the image left if zoomed."));
+    mHiddenActions[sc_pan_left]->setShortcut(QKeySequence(shortcut_pan_left));
+
+    mHiddenActions[sc_pan_right] = new QAction(QObject::tr("Pan Image Right"), parent);
+    mHiddenActions[sc_pan_right]->setStatusTip(QObject::tr("Pans the image right if zoomed."));
+    mHiddenActions[sc_pan_right]->setShortcut(QKeySequence(shortcut_pan_right));
+
+    mManipulators.createManipulators(parent);
+
+    assignCustomShortcuts(allActions());
+
+    // automatically add status tip as tool tip
+    for (QAction *a : allActions()) {
+        a->setToolTip(a->statusTip());
+        a->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+    }
+
+    // trivial connects
+    QObject::connect(action(menu_panel_toggle), &QAction::triggered, [](bool hide) {
+        DkSettingsManager::param().app().hideAllPanels = hide;
+    });
+
+    QObject::connect(action(menu_panel_statusbar), &QAction::triggered, [](bool show) {
+        DkStatusBarManager::instance().show(show);
+    });
+
+    QObject::connect(action(menu_panel_toolbar), &QAction::triggered, [](bool show) {
+        DkToolBarManager::inst().showDefaultToolBar(show);
+    });
+
+    QObject::connect(action(menu_sync_all_actions), &QAction::triggered, [](bool sync) {
+        DkSettingsManager::param().sync().syncActions = sync;
+    });
+}
+
+QVector<QAction *> DkActionManager::allActions() const
+{
+    QVector<QAction *> all;
+    all += fileActions();
+    all += sortActions();
+    all += openWithActions();
+    all += viewActions();
+    all += editActions();
+    all += manipulatorActions();
+    all += toolsActions();
+    all += panelActions();
+    all += syncActions();
+    all += pluginActions();
+    all += helpActions();
+    all += previewActions();
+
+    all += hiddenActions();
+
+    return all;
+}
+
+void DkActionManager::assignCustomShortcuts(QVector<QAction *> actions) const
+{
+    DefaultSettings settings;
+    settings.beginGroup("CustomShortcuts");
+
+    for (QAction *a : actions) {
+        if (!a) {
+            qWarning() << "NULL action detected!";
+            continue;
+        }
+
+        QString at = a->text().remove("&");
+        QString val = settings.value(at, "no-shortcut").toString();
+
+        if (val != "no-shortcut")
+            a->setShortcut(val);
+
+        // assign widget shortcuts to all of them
+        a->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+    }
+
+    settings.endGroup();
+}
+
+void DkActionManager::enableImageActions(bool enable) const
+{
+    action(DkActionManager::menu_file_save)->setEnabled(enable);
+    action(DkActionManager::menu_file_save_as)->setEnabled(enable);
+    action(DkActionManager::menu_file_save_copy)->setEnabled(enable);
+    action(DkActionManager::menu_file_save_list)->setEnabled(enable);
+    action(DkActionManager::menu_file_save_web)->setEnabled(enable);
+    action(DkActionManager::menu_file_rename)->setEnabled(enable);
+    action(DkActionManager::menu_file_print)->setEnabled(enable);
+    action(DkActionManager::menu_file_reload)->setEnabled(enable);
+    action(DkActionManager::menu_file_prev)->setEnabled(enable);
+    action(DkActionManager::menu_file_next)->setEnabled(enable);
+    action(DkActionManager::menu_file_goto)->setEnabled(enable);
+    action(DkActionManager::menu_file_find)->setEnabled(enable);
+
+    action(DkActionManager::menu_edit_rotate_cw)->setEnabled(enable);
+    action(DkActionManager::menu_edit_rotate_ccw)->setEnabled(enable);
+    action(DkActionManager::menu_edit_rotate_180)->setEnabled(enable);
+    action(DkActionManager::menu_edit_delete)->setEnabled(enable);
+    action(DkActionManager::menu_edit_transform)->setEnabled(enable);
+    action(DkActionManager::menu_edit_crop)->setEnabled(enable);
+    action(DkActionManager::menu_edit_copy)->setEnabled(enable);
+    action(DkActionManager::menu_edit_copy_buffer)->setEnabled(enable);
+    action(DkActionManager::menu_edit_copy_color)->setEnabled(enable);
+    action(DkActionManager::menu_edit_undo)->setEnabled(enable);
+    action(DkActionManager::menu_edit_redo)->setEnabled(enable);
+
+    action(DkActionManager::menu_panel_info)->setEnabled(enable);
 #ifdef WITH_OPENCV
-	action(DkActionManager::menu_panel_histogram)->setEnabled(enable);
+    action(DkActionManager::menu_panel_histogram)->setEnabled(enable);
 #else
-	action(DkActionManager::menu_panel_histogram)->setEnabled(false);
+    action(DkActionManager::menu_panel_histogram)->setEnabled(false);
 #endif
-	action(DkActionManager::menu_panel_scroller)->setEnabled(enable);
-	action(DkActionManager::menu_panel_comment)->setEnabled(enable);
-	action(DkActionManager::menu_panel_preview)->setEnabled(enable);
-	action(DkActionManager::menu_panel_exif)->setEnabled(enable);
-	action(DkActionManager::menu_panel_overview)->setEnabled(enable);
-	action(DkActionManager::menu_panel_player)->setEnabled(enable);
-	//action(DkActionManager::menu_panel_thumbview)->setEnabled(enable);	// if we don't disable the thumbnail preview, we can toggle it with SHIFT+T
-
-	action(DkActionManager::menu_view_slideshow)->setEnabled(enable);
-	action(DkActionManager::menu_view_fullscreen)->setEnabled(enable);
-	action(DkActionManager::menu_view_reset)->setEnabled(enable);
-	action(DkActionManager::menu_view_100)->setEnabled(enable);
-	action(DkActionManager::menu_view_fit_frame)->setEnabled(enable);
-	action(DkActionManager::menu_view_zoom_in)->setEnabled(enable);
-	action(DkActionManager::menu_view_zoom_out)->setEnabled(enable);
-	action(DkActionManager::menu_view_tp_pattern)->setEnabled(enable);
-	action(DkActionManager::menu_view_anti_aliasing)->setEnabled(enable);
-
-	action(DkActionManager::menu_tools_wallpaper)->setEnabled(enable);
-	action(DkActionManager::menu_tools_thumbs)->setEnabled(enable);
-
-	// hidden actions
-	action(DkActionManager::sc_skip_prev)->setEnabled(enable);
-	action(DkActionManager::sc_skip_prev_sync)->setEnabled(enable);
-	action(DkActionManager::sc_skip_next)->setEnabled(enable);
-	action(DkActionManager::sc_skip_next_sync)->setEnabled(enable);
-	action(DkActionManager::sc_first_file)->setEnabled(enable);
-	action(DkActionManager::sc_first_file_sync)->setEnabled(enable);
-	action(DkActionManager::sc_last_file)->setEnabled(enable);
-	action(DkActionManager::sc_last_file_sync)->setEnabled(enable);
-
-	// disable open with actions
-	for (QAction* a : DkActionManager::instance().appManager()->getActions())
-		a->setEnabled(enable);
-}
-
-void DkActionManager::enableMovieActions(bool enable) const {
-
-	DkSettingsManager::param().app().showMovieToolBar = enable;
-
-	action(DkActionManager::menu_view_movie_pause)->setEnabled(enable);
-	action(DkActionManager::menu_view_movie_prev)->setEnabled(enable);
-	action(DkActionManager::menu_view_movie_next)->setEnabled(enable);
-
-	action(DkActionManager::menu_view_movie_pause)->setChecked(false);
-
-	DkToolBarManager::inst().showMovieToolBar(enable);
+    action(DkActionManager::menu_panel_scroller)->setEnabled(enable);
+    action(DkActionManager::menu_panel_comment)->setEnabled(enable);
+    action(DkActionManager::menu_panel_preview)->setEnabled(enable);
+    action(DkActionManager::menu_panel_exif)->setEnabled(enable);
+    action(DkActionManager::menu_panel_overview)->setEnabled(enable);
+    action(DkActionManager::menu_panel_player)->setEnabled(enable);
+    // action(DkActionManager::menu_panel_thumbview)->setEnabled(enable);	// if we don't disable the thumbnail preview, we can toggle it with SHIFT+T
+
+    action(DkActionManager::menu_view_slideshow)->setEnabled(enable);
+    action(DkActionManager::menu_view_fullscreen)->setEnabled(enable);
+    action(DkActionManager::menu_view_reset)->setEnabled(enable);
+    action(DkActionManager::menu_view_100)->setEnabled(enable);
+    action(DkActionManager::menu_view_fit_frame)->setEnabled(enable);
+    action(DkActionManager::menu_view_zoom_in)->setEnabled(enable);
+    action(DkActionManager::menu_view_zoom_out)->setEnabled(enable);
+    action(DkActionManager::menu_view_tp_pattern)->setEnabled(enable);
+    action(DkActionManager::menu_view_anti_aliasing)->setEnabled(enable);
+
+    action(DkActionManager::menu_tools_wallpaper)->setEnabled(enable);
+    action(DkActionManager::menu_tools_thumbs)->setEnabled(enable);
+
+    // hidden actions
+    action(DkActionManager::sc_skip_prev)->setEnabled(enable);
+    action(DkActionManager::sc_skip_prev_sync)->setEnabled(enable);
+    action(DkActionManager::sc_skip_next)->setEnabled(enable);
+    action(DkActionManager::sc_skip_next_sync)->setEnabled(enable);
+    action(DkActionManager::sc_first_file)->setEnabled(enable);
+    action(DkActionManager::sc_first_file_sync)->setEnabled(enable);
+    action(DkActionManager::sc_last_file)->setEnabled(enable);
+    action(DkActionManager::sc_last_file_sync)->setEnabled(enable);
+
+    // disable open with actions
+    for (QAction *a : DkActionManager::instance().appManager()->getActions())
+        a->setEnabled(enable);
+}
+
+void DkActionManager::enableMovieActions(bool enable) const
+{
+    DkSettingsManager::param().app().showMovieToolBar = enable;
+
+    action(DkActionManager::menu_view_movie_pause)->setEnabled(enable);
+    action(DkActionManager::menu_view_movie_prev)->setEnabled(enable);
+    action(DkActionManager::menu_view_movie_next)->setEnabled(enable);
+
+    action(DkActionManager::menu_view_movie_pause)->setChecked(false);
+
+    DkToolBarManager::inst().showMovieToolBar(enable);
 }
 
 // DkGlobalProgress --------------------------------------------------------------------
-DkGlobalProgress::DkGlobalProgress() : showProgress(true) {
+DkGlobalProgress::DkGlobalProgress()
+    : showProgress(true)
+{
 #ifdef Q_OS_WIN
-	mProgress = new QWinTaskbarProgress(this);
+    mProgress = new QWinTaskbarProgress(this);
 #endif
 }
 
-DkGlobalProgress::~DkGlobalProgress() {}
-
-DkGlobalProgress& DkGlobalProgress::instance() { 
-
-	static DkGlobalProgress inst;
-	return inst; 
+DkGlobalProgress::~DkGlobalProgress()
+{
 }
 
-void DkGlobalProgress::start() {
+DkGlobalProgress &DkGlobalProgress::instance()
+{
+    static DkGlobalProgress inst;
+    return inst;
+}
 
+void DkGlobalProgress::start()
+{
 #ifdef Q_OS_WIN
 
-	if (!mProgress) {
-		qWarning() << "global progress bar is empty...";
-		return;
-	}
+    if (!mProgress) {
+        qWarning() << "global progress bar is empty...";
+        return;
+    }
 
-	mProgress->setVisible(true);
-	mProgress->setValue(0);
+    mProgress->setVisible(true);
+    mProgress->setValue(0);
 #endif
-
 }
 
-void DkGlobalProgress::stop() {
-
-	if (!mProgress)
-		return;
+void DkGlobalProgress::stop()
+{
+    if (!mProgress)
+        return;
 
 #ifdef Q_OS_WIN
-	mProgress->setVisible(false);
-	mProgress->setValue(0);
+    mProgress->setVisible(false);
+    mProgress->setValue(0);
 #endif
 }
 
-void DkGlobalProgress::setProgressValue(int value) {
-	
+void DkGlobalProgress::setProgressValue(int value)
+{
 #ifdef Q_OS_WIN
-	if (showProgress)
-		mProgress->setValue(value);
+    if (showProgress)
+        mProgress->setValue(value);
 #endif
 }
 
-QObject* DkGlobalProgress::progressObject() const {
-	return mProgress;
+QObject *DkGlobalProgress::progressObject() const
+{
+    return mProgress;
 }
 
 #ifdef Q_OS_WIN32
-void DkGlobalProgress::setProgressBar(QWinTaskbarProgress* progress) {
-	mProgress = progress;
+void DkGlobalProgress::setProgressBar(QWinTaskbarProgress *progress)
+{
+    mProgress = progress;
 }
 
-QWinTaskbarProgress* DkGlobalProgress::progressBar() {
-	return mProgress;
+QWinTaskbarProgress *DkGlobalProgress::progressBar()
+{
+    return mProgress;
 }
 #else
-QProgressDialog* DkGlobalProgress::progressBar() const {
-	return 0;
+QProgressDialog *DkGlobalProgress::progressBar() const
+{
+    return 0;
 }
 #endif
 
-
 }
diff --git a/ImageLounge/src/DkCore/DkActionManager.h b/ImageLounge/src/DkCore/DkActionManager.h
index 56ccddb..e0b3096 100644
--- a/ImageLounge/src/DkCore/DkActionManager.h
+++ b/ImageLounge/src/DkCore/DkActionManager.h
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkActionManager.h
  Created on:	28.10.2015
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2015 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2015 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2015 Florian Kleber <florian@nomacs.org>
@@ -27,13 +27,13 @@
 
 #pragma once
 
-#include "DkManipulators.h"
 #include "DkBaseWidgets.h"
+#include "DkManipulators.h"
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QObject>
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QAction>
-#pragma warning(pop)		// no warnings from includes - end
+#include <QObject>
+#pragma warning(pop) // no warnings from includes - end
 
 #ifndef DllCoreExport
 #ifdef DK_CORE_DLL_EXPORT
@@ -45,7 +45,7 @@
 #endif
 #endif
 
-#pragma warning(disable: 4251)	// TODO: remove
+#pragma warning(disable : 4251) // TODO: remove
 
 // Qt defines
 class QMenu;
@@ -53,595 +53,599 @@ class QMainWindow;
 class QWinTaskbarProgress;
 class QProgressDialog;
 
-namespace nmc {
-	
+namespace nmc
+{
+
 // nomacs defines
 class DkTcpMenu;
 class DkPluginActionManager;
 
-class DllCoreExport DkAppManager : public QObject {
-	Q_OBJECT
+class DllCoreExport DkAppManager : public QObject
+{
+    Q_OBJECT
 
 public:
-	DkAppManager(QWidget* parent = 0);
-	~DkAppManager();
+    DkAppManager(QWidget *parent = 0);
+    ~DkAppManager();
 
-	void setActions(QVector<QAction* > actions);
-	QVector<QAction* > getActions() const;
-	QAction* createAction(const QString& filePath);
-	QAction* findAction(const QString& appPath) const;
+    void setActions(QVector<QAction *> actions);
+    QVector<QAction *> getActions() const;
+    QAction *createAction(const QString &filePath);
+    QAction *findAction(const QString &appPath) const;
 
-	enum defaultAppIdx {
+    enum defaultAppIdx {
 
-		app_photohsop,
-		app_picasa,
-		app_picasa_viewer,
-		app_irfan_view,
-		app_explorer,
+        app_photohsop,
+        app_picasa,
+        app_picasa_viewer,
+        app_irfan_view,
+        app_explorer,
 
-		app_idx_end
-	};
+        app_idx_end
+    };
 
 public slots:
-	void openTriggered() const;
+    void openTriggered() const;
 
 signals:
-	void openFileSignal(QAction* action) const;
+    void openFileSignal(QAction *action) const;
 
 protected:
-	void saveSettings() const;
-	void loadSettings();
-	void assignIcon(QAction* app) const;
-	bool containsApp(QVector<QAction* > apps, const QString& appName) const;
+    void saveSettings() const;
+    void loadSettings();
+    void assignIcon(QAction *app) const;
+    bool containsApp(QVector<QAction *> apps, const QString &appName) const;
 
-	QString searchForSoftware(const QString& organization, const QString& application, const QString& pathKey = "", const QString& exeName = "") const;
-	void findDefaultSoftware();
+    QString searchForSoftware(const QString &organization, const QString &application, const QString &pathKey = "", const QString &exeName = "") const;
+    void findDefaultSoftware();
 
-	QVector<QString> mDefaultNames;
-	QVector<QAction* > mApps;
-	bool mFirstTime = true;
+    QVector<QString> mDefaultNames;
+    QVector<QAction *> mApps;
+    bool mFirstTime = true;
 };
 
-class DllCoreExport DkActionManager {
-
+class DllCoreExport DkActionManager
+{
 public:
-	static DkActionManager& instance();
-	~DkActionManager();
-
-	// singleton
-	DkActionManager(DkActionManager const&)		= delete;
-	void operator=(DkActionManager const&)		= delete;
-
-	enum FileMenuActions {
-		menu_file_open,
-		menu_file_open_dir,
-		menu_file_open_list,
-		menu_file_quick_launch,
-		menu_file_app_manager,
-		menu_file_save,
-		menu_file_save_as,
-		menu_file_save_copy,
-		menu_file_save_list,
-		menu_file_save_web,
-		menu_file_rename,
-		menu_file_goto,
-		menu_file_find,
-		menu_file_recursive,
-		menu_file_show_recent,
-		menu_file_print,
-		menu_file_reload,
-		menu_file_next,
-		menu_file_prev,
-		menu_file_new_instance,
-		menu_file_private_instance,
-		menu_file_exit,
-
-		menu_file_end,	// nothing beyond this point
-	};
-
-	enum SortMenuActions {
-
-		menu_sort_filename,
-		menu_sort_date_created,
-		menu_sort_date_modified,
-		menu_sort_random,
-		menu_sort_ascending,
-		menu_sort_descending,
-
-		menu_sort_end,
-	};
-
-	enum EditMenuActions {
-		menu_edit_image,
-		menu_edit_rotate_cw,
-		menu_edit_rotate_ccw,
-		menu_edit_rotate_180,
-		menu_edit_undo,
-		menu_edit_redo,
-		menu_edit_copy,
-		menu_edit_copy_buffer,
-		menu_edit_copy_color,
-		menu_edit_paste,
-		menu_edit_shortcuts,
-		menu_edit_preferences,
-		menu_edit_transform,
-		menu_edit_delete,
-		menu_edit_crop,
-
-		menu_edit_end,	// nothing beyond this point
-	};
-
-	enum ToolsMenuActions {
-		menu_tools_thumbs,
-		menu_tools_filter,
-		menu_tools_export_tiff,
-		menu_tools_extract_archive,
-		menu_tools_mosaic,
-		menu_tools_batch,
-		menu_tools_wallpaper,
-		menu_tools_train_format,
-
-		menu_tools_end,
-	};
-
-	enum PanelMenuActions {
-		menu_panel_toggle,
-		
-		menu_panel_menu,
-		menu_panel_toolbar,
-		menu_panel_statusbar,
-		menu_panel_transfertoolbar,
-
-		menu_panel_player,
-		menu_panel_preview,
-		menu_panel_thumbview,
-		menu_panel_scroller,
-		menu_panel_exif,
-		menu_panel_info,
-		menu_panel_histogram,
-		menu_panel_overview,
-		menu_panel_explorer,
-		menu_panel_metadata_dock,
-		menu_panel_comment,
-		menu_panel_history,
-		menu_panel_log,
-
-		menu_panel_end,
-	};
-
-	enum ViewMenuActions {
-		menu_view_fullscreen,
-		menu_view_reset,
-		menu_view_100,
-		menu_view_fit_frame,
-		menu_view_zoom_in,
-		menu_view_zoom_out,
-		menu_view_anti_aliasing,
-		menu_view_tp_pattern,
-		menu_view_frameless,
-
-		menu_view_new_tab,
-		menu_view_close_tab,
-		menu_view_close_all_tabs,
-		menu_view_first_tab,
-		menu_view_previous_tab,
-		menu_view_goto_tab,
-		menu_view_next_tab,
-		menu_view_last_tab,
-
-		menu_view_opacity_up,
-		menu_view_opacity_down,
-		menu_view_opacity_an,
-		menu_view_opacity_change,
-		menu_view_lock_window,
-		menu_view_gps_map,
-		menu_view_slideshow,
-		menu_view_movie_pause,
-		menu_view_movie_next,
-		menu_view_movie_prev,
-
-		menu_view_monitors,	// frameless only
-
-		menu_view_end,	// nothing beyond this point
-	};
-
-	enum SyncMenuActions {
-		menu_sync_view,
-		menu_sync_pos,
-		menu_sync_arrange,
-		menu_sync_connect_all,
-		menu_sync_all_actions,
-
-		menu_sync_end,	// nothing beyond this point
-	};
-
-	enum PluginMenuActions {
-		menu_plugin_manager,
-
-		menu_plugins_end,	// nothing beyond this point
-	};
-
-	enum HelpMenuActions{
-		menu_help_update,
-		menu_help_update_translation,
-		menu_help_bug,
-		menu_help_documentation,
-		menu_help_about,
-
-		menu_help_end,	// nothing beyond this point
-	};
-
-	enum HiddenActions {
-		sc_test_img,
-		sc_test_rec,
-		sc_test_pong,
-
-		sc_first_file,
-		sc_last_file,
-		sc_skip_prev,
-		sc_skip_next,
-		sc_skip_next_sync,
-		sc_skip_prev_sync,
-		sc_first_file_sync,
-		sc_last_file_sync,
-		sc_delete_silent,
-
-		sc_star_rating_0,
-		sc_star_rating_1,
-		sc_star_rating_2,
-		sc_star_rating_3,
-		sc_star_rating_4,
-		sc_star_rating_5,
-
-		sc_pan_up,
-		sc_pan_down,
-		sc_pan_left,
-		sc_pan_right,
-
-		sc_end,	// nothing beyond this point
-	};
-
-	enum PreviewActions {
-		preview_select_all,
-		preview_zoom_in,
-		preview_zoom_out,
-		preview_display_squares,
-		preview_show_labels,
-		preview_copy,
-		preview_paste,
-		preview_rename,
-		preview_delete,
-		preview_filter,
-		preview_batch,
-		preview_print,
-
-		actions_end
-	};
-
-	enum FileIcons {
-		icon_file_prev,
-		icon_file_next,
-		icon_file_dir,
-		icon_file_open,
-		icon_file_open_large,
-		icon_file_dir_large,
-		icon_file_save,
-		icon_file_print,
-		icon_file_filter,
-		icon_file_find,
-
-		icon_file_end,	// nothing beyond this point
-	};
-
-	enum EditIcons {
-		icon_edit_image,
-		icon_edit_rotate_cw,
-		icon_edit_rotate_ccw,
-		icon_edit_crop,
-		icon_edit_resize,
-		icon_edit_copy,
-		icon_edit_paste,
-		icon_edit_delete,
-
-		icon_edit_end,	// nothing beyond this point
-	};
-
-	enum ViewIcons {
-		icon_view_fullscreen,
-		icon_view_reset,
-		icon_view_100,
-		icon_view_gps,
-		icon_view_movie_play,
-		icon_view_movie_prev,
-		icon_view_movie_next,
-		icon_view_zoom_in,
-		icon_view_zoom_out,
-
-		icon_view_end,	// nothing beyond this point
-	};
-
-	// default nomacs shortcuts
-	// keyboard shortcuts
-	enum Shortcuts {	
-
-		// general
-		shortcut_esc			= Qt::Key_Escape,
-
-		// file
-		shortcut_open_preview	= Qt::Key_T,
-		shortcut_open_thumbview	= Qt::SHIFT + Qt::Key_T,
-		shortcut_open_dir		= Qt::CTRL + Qt::SHIFT + Qt::Key_O,
-		shortcut_app_manager	= Qt::CTRL + Qt::Key_M,
-		shortcut_save_as		= Qt::CTRL + Qt::SHIFT + Qt::Key_S,
-		shortcut_first_file		= Qt::Key_Home, 
-		shortcut_last_file		= Qt::Key_End,
-		shortcut_skip_prev		= Qt::Key_PageUp,
-		shortcut_skip_next		= Qt::Key_PageDown,
-		shortcut_prev_file		= Qt::Key_Left,
-		shortcut_next_file		= Qt::Key_Right,
-		shortcut_rename			= Qt::Key_F2,
-		shortcut_goto			= Qt::CTRL + Qt::Key_G,
-		shortcut_extract		= Qt::CTRL + Qt::Key_E,
-		shortcut_reload			= Qt::Key_F5,
-
-		shortcut_first_file_sync= Qt::ALT + Qt::Key_Home, 
-		shortcut_last_file_sync	= Qt::ALT + Qt::Key_End,
-		shortcut_skip_prev_sync	= Qt::ALT + Qt::Key_Left,
-		shortcut_skip_next_sync	= Qt::ALT + Qt::Key_Right,
-
-		shortcut_star_rating_0	= Qt::Key_0,
-		shortcut_star_rating_1	= Qt::Key_1,
-		shortcut_star_rating_2	= Qt::Key_2,
-		shortcut_star_rating_3	= Qt::Key_3,
-		shortcut_star_rating_4	= Qt::Key_4,
-		shortcut_star_rating_5	= Qt::Key_5,
-
-		// view
-		shortcut_new_tab		= Qt::CTRL + Qt::Key_T,
-		shortcut_close_tab		= Qt::CTRL + Qt::Key_W,
-		shortcut_next_tab		= Qt::CTRL + Qt::Key_Tab,
-		shortcut_previous_tab	= Qt::CTRL + Qt::SHIFT + Qt::Key_Tab,
-		shortcut_show_toolbar	= Qt::CTRL + Qt::Key_B,
-		shortcut_show_statusbar	= Qt::CTRL + Qt::Key_I,
-		shortcut_full_screen_ad	= Qt::CTRL + Qt::Key_L,
-		shortcut_show_transfer	= Qt::CTRL + Qt::Key_U,
+    static DkActionManager &instance();
+    ~DkActionManager();
+
+    // singleton
+    DkActionManager(DkActionManager const &) = delete;
+    void operator=(DkActionManager const &) = delete;
+
+    enum FileMenuActions {
+        menu_file_open,
+        menu_file_open_dir,
+        menu_file_open_list,
+        menu_file_quick_launch,
+        menu_file_app_manager,
+        menu_file_save,
+        menu_file_save_as,
+        menu_file_save_copy,
+        menu_file_save_list,
+        menu_file_save_web,
+        menu_file_rename,
+        menu_file_goto,
+        menu_file_find,
+        menu_file_recursive,
+        menu_file_show_recent,
+        menu_file_print,
+        menu_file_reload,
+        menu_file_next,
+        menu_file_prev,
+        menu_file_new_instance,
+        menu_file_private_instance,
+        menu_file_exit,
+
+        menu_file_end, // nothing beyond this point
+    };
+
+    enum SortMenuActions {
+
+        menu_sort_filename,
+        menu_sort_file_size,
+        menu_sort_date_created,
+        menu_sort_date_modified,
+        menu_sort_random,
+        menu_sort_ascending,
+        menu_sort_descending,
+
+        menu_sort_end,
+    };
+
+    enum EditMenuActions {
+        menu_edit_image,
+        menu_edit_rotate_cw,
+        menu_edit_rotate_ccw,
+        menu_edit_rotate_180,
+        menu_edit_undo,
+        menu_edit_redo,
+        menu_edit_copy,
+        menu_edit_copy_buffer,
+        menu_edit_copy_color,
+        menu_edit_paste,
+        menu_edit_shortcuts,
+        menu_edit_preferences,
+        menu_edit_transform,
+        menu_edit_delete,
+        menu_edit_crop,
+
+        menu_edit_end, // nothing beyond this point
+    };
+
+    enum ToolsMenuActions {
+        menu_tools_thumbs,
+        menu_tools_filter,
+        menu_tools_export_tiff,
+        menu_tools_extract_archive,
+        menu_tools_mosaic,
+        menu_tools_batch,
+        menu_tools_wallpaper,
+        menu_tools_train_format,
+
+        menu_tools_end,
+    };
+
+    enum PanelMenuActions {
+        menu_panel_toggle,
+
+        menu_panel_menu,
+        menu_panel_toolbar,
+        menu_panel_statusbar,
+        menu_panel_transfertoolbar,
+
+        menu_panel_player,
+        menu_panel_preview,
+        menu_panel_thumbview,
+        menu_panel_scroller,
+        menu_panel_exif,
+        menu_panel_info,
+        menu_panel_histogram,
+        menu_panel_overview,
+        menu_panel_explorer,
+        menu_panel_metadata_dock,
+        menu_panel_comment,
+        menu_panel_history,
+        menu_panel_log,
+
+        menu_panel_end,
+    };
+
+    enum ViewMenuActions {
+        menu_view_fullscreen,
+        menu_view_reset,
+        menu_view_100,
+        menu_view_fit_frame,
+        menu_view_zoom_in,
+        menu_view_zoom_out,
+        menu_view_anti_aliasing,
+        menu_view_tp_pattern,
+        menu_view_frameless,
+
+        menu_view_new_tab,
+        menu_view_close_tab,
+        menu_view_close_all_tabs,
+        menu_view_first_tab,
+        menu_view_previous_tab,
+        menu_view_goto_tab,
+        menu_view_next_tab,
+        menu_view_last_tab,
+
+        menu_view_opacity_up,
+        menu_view_opacity_down,
+        menu_view_opacity_an,
+        menu_view_opacity_change,
+        menu_view_lock_window,
+        menu_view_gps_map,
+        menu_view_slideshow,
+        menu_view_movie_pause,
+        menu_view_movie_next,
+        menu_view_movie_prev,
+
+        menu_view_monitors, // frameless only
+
+        menu_view_end, // nothing beyond this point
+    };
+
+    enum SyncMenuActions {
+        menu_sync_view,
+        menu_sync_pos,
+        menu_sync_arrange,
+        menu_sync_connect_all,
+        menu_sync_all_actions,
+
+        menu_sync_end, // nothing beyond this point
+    };
+
+    enum PluginMenuActions {
+        menu_plugin_manager,
+
+        menu_plugins_end, // nothing beyond this point
+    };
+
+    enum HelpMenuActions {
+        menu_help_update,
+        menu_help_update_translation,
+        menu_help_bug,
+        menu_help_documentation,
+        menu_help_about,
+
+        menu_help_end, // nothing beyond this point
+    };
+
+    enum HiddenActions {
+        sc_test_img,
+        sc_test_rec,
+        sc_test_pong,
+
+        sc_first_file,
+        sc_last_file,
+        sc_skip_prev,
+        sc_skip_next,
+        sc_skip_next_sync,
+        sc_skip_prev_sync,
+        sc_first_file_sync,
+        sc_last_file_sync,
+        sc_delete_silent,
+
+        sc_star_rating_0,
+        sc_star_rating_1,
+        sc_star_rating_2,
+        sc_star_rating_3,
+        sc_star_rating_4,
+        sc_star_rating_5,
+
+        sc_pan_up,
+        sc_pan_down,
+        sc_pan_left,
+        sc_pan_right,
+
+        sc_end, // nothing beyond this point
+    };
+
+    enum PreviewActions {
+        preview_select_all,
+        preview_zoom_in,
+        preview_zoom_out,
+        preview_display_squares,
+        preview_show_labels,
+        preview_copy,
+        preview_paste,
+        preview_rename,
+        preview_delete,
+        preview_filter,
+        preview_batch,
+        preview_print,
+
+        actions_end
+    };
+
+    enum FileIcons {
+        icon_file_prev,
+        icon_file_next,
+        icon_file_dir,
+        icon_file_open,
+        icon_file_open_large,
+        icon_file_dir_large,
+        icon_file_save,
+        icon_file_print,
+        icon_file_filter,
+        icon_file_find,
+
+        icon_file_end, // nothing beyond this point
+    };
+
+    enum EditIcons {
+        icon_edit_image,
+        icon_edit_rotate_cw,
+        icon_edit_rotate_ccw,
+        icon_edit_crop,
+        icon_edit_resize,
+        icon_edit_copy,
+        icon_edit_paste,
+        icon_edit_delete,
+
+        icon_edit_end, // nothing beyond this point
+    };
+
+    enum ViewIcons {
+        icon_view_fullscreen,
+        icon_view_reset,
+        icon_view_100,
+        icon_view_gps,
+        icon_view_movie_play,
+        icon_view_movie_prev,
+        icon_view_movie_next,
+        icon_view_zoom_in,
+        icon_view_zoom_out,
+
+        icon_view_end, // nothing beyond this point
+    };
+
+    // default nomacs shortcuts
+    // keyboard shortcuts
+    enum Shortcuts {
+
+        // general
+        shortcut_esc = Qt::Key_Escape,
+
+        // file
+        shortcut_open_preview = Qt::Key_T,
+        shortcut_open_thumbview = Qt::SHIFT | Qt::Key_T,
+        shortcut_open_dir = Qt::CTRL | Qt::SHIFT | Qt::Key_O,
+        shortcut_app_manager = Qt::CTRL | Qt::Key_M,
+        shortcut_save_as = Qt::CTRL | Qt::SHIFT | Qt::Key_S,
+        shortcut_first_file = Qt::Key_Home,
+        shortcut_last_file = Qt::Key_End,
+        shortcut_skip_prev = Qt::Key_PageUp,
+        shortcut_skip_next = Qt::Key_PageDown,
+        shortcut_prev_file = Qt::Key_Left,
+        shortcut_next_file = Qt::Key_Right,
+        shortcut_rename = Qt::Key_F2,
+        shortcut_goto = Qt::CTRL | Qt::Key_G,
+        shortcut_extract = Qt::CTRL | Qt::Key_E,
+        shortcut_reload = Qt::Key_F5,
+
+        shortcut_first_file_sync = Qt::ALT | Qt::Key_Home,
+        shortcut_last_file_sync = Qt::ALT | Qt::Key_End,
+        shortcut_skip_prev_sync = Qt::ALT | Qt::Key_Left,
+        shortcut_skip_next_sync = Qt::ALT | Qt::Key_Right,
+
+        shortcut_star_rating_0 = Qt::Key_0,
+        shortcut_star_rating_1 = Qt::Key_1,
+        shortcut_star_rating_2 = Qt::Key_2,
+        shortcut_star_rating_3 = Qt::Key_3,
+        shortcut_star_rating_4 = Qt::Key_4,
+        shortcut_star_rating_5 = Qt::Key_5,
+
+        // view
+        shortcut_new_tab = Qt::CTRL | Qt::Key_T,
+        shortcut_close_tab = Qt::CTRL | Qt::Key_W,
+        shortcut_show_toolbar = Qt::CTRL | Qt::Key_B,
+        shortcut_show_statusbar = Qt::CTRL | Qt::Key_I,
+        shortcut_full_screen_ad = Qt::CTRL | Qt::Key_L,
+        shortcut_show_transfer = Qt::CTRL | Qt::Key_U,
 #ifdef Q_OS_MAC
-		shortcut_full_screen_ff	= Qt::CTRL + Qt::Key_F,
-		shortcut_frameless		= Qt::CTRL + Qt::Key_R,
+        shortcut_next_tab = Qt::META | Qt::Key_Tab,
+        shortcut_previous_tab = Qt::META | Qt::SHIFT | Qt::Key_Tab,
+        shortcut_full_screen_ff = Qt::CTRL | Qt::Key_F,
+        shortcut_frameless = Qt::CTRL | Qt::Key_R,
 #else
-		shortcut_full_screen_ff	= Qt::Key_F11,
-		shortcut_frameless		= Qt::Key_F10,
+        shortcut_next_tab = Qt::CTRL | Qt::Key_Tab,
+        shortcut_previous_tab = Qt::CTRL | Qt::SHIFT | Qt::Key_Tab,
+        shortcut_full_screen_ff = Qt::Key_F11,
+        shortcut_frameless = Qt::Key_F10,
 #endif
-		shortcut_reset_view 	= Qt::CTRL + Qt::Key_0,
-		shortcut_zoom_full		= Qt::CTRL + Qt::Key_1,
-		shortcut_fit_frame		= Qt::CTRL + Qt::Key_2,
-		shortcut_show_overview	= Qt::Key_O,
-		shortcut_show_explorer	= Qt::Key_E,
-		shortcut_show_metadata_dock = Qt::ALT + Qt::Key_M,
-		shortcut_show_history	= Qt::CTRL + Qt::SHIFT + Qt::Key_H,
-		shortcut_show_log		= Qt::CTRL + Qt::ALT + Qt::Key_L,
-		shortcut_view_slideshow	= Qt::Key_Space,
-		shortcut_show_player	= Qt::Key_P,
-		shortcut_show_exif		= Qt::Key_M,
-		shortcut_show_info		= Qt::Key_I,
-		shortcut_show_histogram	= Qt::Key_H,
-		shortcut_show_comment	= Qt::Key_N,
-		shortcut_opacity_down	= Qt::CTRL + Qt::Key_J,
-		shortcut_opacity_up		= Qt::CTRL + Qt::SHIFT + Qt::Key_J,
-		shortcut_opacity_change	= Qt::ALT + Qt::SHIFT + Qt::Key_J,
-		shortcut_an_opacity		= Qt::ALT  + Qt::Key_J,
-		shortcut_new_instance	= Qt::CTRL + Qt::Key_N,
-		shortcut_private_instance = Qt::CTRL + Qt::ALT + Qt::Key_N,
-		shortcut_tp_pattern		= Qt::Key_B,
-		shortcut_anti_aliasing	= Qt::Key_A,
-		shortcut_lock_window	= Qt::CTRL + Qt::SHIFT + Qt::ALT + Qt::Key_B,
-		shortcut_recent_files	= Qt::CTRL + Qt::Key_H,
-		shortcut_toggle_panels	= Qt::Key_F,
-
-		// hidden viewport shortcuts
-		shortcut_pan_left	= Qt::CTRL + Qt::Key_Left,
-		shortcut_pan_right	= Qt::CTRL + Qt::Key_Right,
-		shortcut_pan_up		= Qt::CTRL + Qt::Key_Up,
-		shortcut_pan_down	= Qt::CTRL + Qt::Key_Down,
-
-		shortcut_zoom_in		= Qt::Key_Plus,
-		shortcut_zoom_out		= Qt::Key_Minus,
-		shortcut_zoom_in_alt	= Qt::Key_Up,
-		shortcut_zoom_out_alt	= Qt::Key_Down,
-
-		// edit
-		shortcut_edit_image		= Qt::Key_D,
-		shortcut_rotate_cw		= Qt::Key_R,
-		shortcut_rotate_ccw		= Qt::SHIFT + Qt::Key_R,
-		shortcut_transform		= Qt::CTRL + Qt::Key_R,
-		shortcut_manipulation   = Qt::CTRL + Qt::SHIFT + Qt::Key_M,
-		shortcut_paste			= Qt::Key_Insert,
-		shortcut_delete_silent	= Qt::SHIFT + Qt::Key_Delete,
-		shortcut_crop			= Qt::Key_C,
-		shortcut_copy_buffer	= Qt::CTRL + Qt::SHIFT + Qt::Key_C,
-		shortcut_copy_color		= Qt::CTRL + Qt::ALT + Qt::Key_C,
-
-		// tools
-		shortcut_batch_processing = Qt::CTRL + Qt::SHIFT + Qt::Key_B,
-
-		// tcp
-		shortcut_shortcuts		= Qt::CTRL + Qt::Key_K,
-		shortcut_settings		= Qt::CTRL + Qt::SHIFT + Qt::Key_P,
-		shortcut_sync			= Qt::CTRL + Qt::Key_D,
-		shortcut_tab			= Qt::ALT + Qt::Key_O,
-		shortcut_arrange		= Qt::ALT + Qt::Key_A,
-		shortcut_send_img		= Qt::ALT + Qt::Key_I,
-		shortcut_connect_all	= Qt::CTRL + Qt::Key_A,
-
-		// help
-		shortcut_show_help		= Qt::Key_F1,
-
-		// eggs
-		shortcut_test_pong		= Qt::CTRL + Qt::SHIFT + Qt::ALT + Qt::Key_P,
-		shortcut_test_img		= Qt::CTRL + Qt::SHIFT + Qt::ALT + Qt::Key_L,
-		shortcut_test_rec		= Qt::CTRL + Qt::SHIFT + Qt::ALT + Qt::Key_R,
-	};
-
-	QMenu* updateOpenWithMenu();
-
-	QMenu* fileMenu() const;
-	QMenu* sortMenu() const;
-	QMenu* openWithMenu() const;
-	QMenu* viewMenu() const;
-	QMenu* editMenu() const;
-	QMenu* manipulatorMenu() const;
-	QMenu* toolsMenu() const;
-	QMenu* panelMenu() const;
-	QMenu* helpMenu() const;
-	QMenu* contextMenu() const;
-	QMenu* syncMenu() const;
-	DkTcpMenu* localMenu() const;
-
-	DkManipulatorManager manipulatorManager() const;
-
-	void createActions(QWidget* parent);
-	void createMenus(QWidget* parent);
-	
-	QAction* action(FileMenuActions action) const;
-	QAction* action(SortMenuActions action) const;
-	QAction* action(ViewMenuActions action) const;
-	QAction* action(EditMenuActions action) const;
-	QAction* action(ToolsMenuActions action) const;
-	QAction* action(PanelMenuActions action) const;
-	QAction* action(SyncMenuActions action) const;
-	QAction* action(PluginMenuActions action) const;
-	QAction* action(HelpMenuActions action) const;
-	QAction* action(HiddenActions action) const;
-	QAction* action(PreviewActions action) const;
-
-	QIcon icon(FileIcons icon) const;
-	QIcon icon(ViewIcons icon) const;
-	QIcon icon(EditIcons icon) const;
-	
-	QVector<QAction *> fileActions() const;
-	QVector<QAction *> sortActions() const;
-	QVector<QAction *> openWithActions() const;
-	QVector<QAction *> viewActions() const;
-	QVector<QAction *> editActions() const;
-	QVector<QAction *> toolsActions() const;
-	QVector<QAction *> panelActions() const;
-	QVector<QAction *> syncActions() const;
-	QVector<QAction *> pluginActions() const;
-	QVector<QAction *> helpActions() const;
-	QVector<QAction *> previewActions() const;
-	QVector<QAction *> manipulatorActions() const;
-
-	QVector<QAction *> allActions() const;
-
-	QVector<QAction*> hiddenActions() const;	
-	DkAppManager* appManager() const;
-	DkPluginActionManager* pluginActionManager() const;
-
-	void assignCustomShortcuts(QVector<QAction*> actions) const;
-
-	void enableImageActions(bool enable = true) const;
-	void enableMovieActions(bool enable = true) const;
+        shortcut_reset_view = Qt::CTRL | Qt::Key_0,
+        shortcut_zoom_full = Qt::CTRL | Qt::Key_1,
+        shortcut_fit_frame = Qt::CTRL | Qt::Key_2,
+        shortcut_show_overview = Qt::Key_O,
+        shortcut_show_explorer = Qt::Key_E,
+        shortcut_show_metadata_dock = Qt::ALT | Qt::Key_M,
+        shortcut_show_history = Qt::CTRL | Qt::SHIFT | Qt::Key_H,
+        shortcut_show_log = Qt::CTRL | Qt::ALT | Qt::Key_L,
+        shortcut_view_slideshow = Qt::Key_Space,
+        shortcut_show_player = Qt::Key_P,
+        shortcut_show_exif = Qt::Key_M,
+        shortcut_show_info = Qt::Key_I,
+        shortcut_show_histogram = Qt::Key_H,
+        shortcut_show_comment = Qt::Key_N,
+        shortcut_opacity_down = Qt::CTRL | Qt::Key_J,
+        shortcut_opacity_up = Qt::CTRL | Qt::SHIFT | Qt::Key_J,
+        shortcut_opacity_change = Qt::ALT | Qt::SHIFT | Qt::Key_J,
+        shortcut_an_opacity = Qt::ALT | Qt::Key_J,
+        shortcut_new_instance = Qt::CTRL | Qt::Key_N,
+        shortcut_private_instance = Qt::CTRL | Qt::ALT | Qt::Key_N,
+        shortcut_tp_pattern = Qt::Key_B,
+        shortcut_anti_aliasing = Qt::Key_A,
+        shortcut_lock_window = Qt::CTRL | Qt::SHIFT | Qt::ALT | Qt::Key_B,
+        shortcut_recent_files = Qt::CTRL | Qt::Key_H,
+        shortcut_toggle_panels = Qt::Key_F,
+
+        // hidden viewport shortcuts
+        shortcut_pan_left = Qt::CTRL | Qt::Key_Left,
+        shortcut_pan_right = Qt::CTRL | Qt::Key_Right,
+        shortcut_pan_up = Qt::CTRL | Qt::Key_Up,
+        shortcut_pan_down = Qt::CTRL | Qt::Key_Down,
+
+        shortcut_zoom_in = Qt::Key_Plus,
+        shortcut_zoom_out = Qt::Key_Minus,
+        shortcut_zoom_in_alt = Qt::Key_Up,
+        shortcut_zoom_out_alt = Qt::Key_Down,
+
+        // edit
+        shortcut_edit_image = Qt::Key_D,
+        shortcut_rotate_cw = Qt::Key_R,
+        shortcut_rotate_ccw = Qt::SHIFT | Qt::Key_R,
+        shortcut_transform = Qt::CTRL | Qt::Key_R,
+        shortcut_manipulation = Qt::CTRL | Qt::SHIFT | Qt::Key_M,
+        shortcut_paste = Qt::Key_Insert,
+        shortcut_delete_silent = Qt::SHIFT | Qt::Key_Delete,
+        shortcut_crop = Qt::Key_C,
+        shortcut_copy_buffer = Qt::CTRL | Qt::SHIFT | Qt::Key_C,
+        shortcut_copy_color = Qt::CTRL | Qt::ALT | Qt::Key_C,
+
+        // tools
+        shortcut_batch_processing = Qt::CTRL | Qt::SHIFT | Qt::Key_B,
+
+        // tcp
+        shortcut_shortcuts = Qt::CTRL | Qt::Key_K,
+        shortcut_settings = Qt::CTRL | Qt::SHIFT | Qt::Key_P,
+        shortcut_sync = Qt::CTRL | Qt::Key_D,
+        shortcut_tab = Qt::ALT | Qt::Key_O,
+        shortcut_arrange = Qt::ALT | Qt::Key_A,
+        shortcut_send_img = Qt::ALT | Qt::Key_I,
+        shortcut_connect_all = Qt::CTRL | Qt::Key_A,
+
+        // help
+        shortcut_show_help = Qt::Key_F1,
+
+        // eggs
+        shortcut_test_pong = Qt::CTRL | Qt::SHIFT | Qt::ALT | Qt::Key_P,
+        shortcut_test_img = Qt::CTRL | Qt::SHIFT | Qt::ALT | Qt::Key_L,
+        shortcut_test_rec = Qt::CTRL | Qt::SHIFT | Qt::ALT | Qt::Key_R,
+    };
+
+    QMenu *updateOpenWithMenu();
+
+    QMenu *fileMenu() const;
+    QMenu *sortMenu() const;
+    QMenu *openWithMenu() const;
+    QMenu *viewMenu() const;
+    QMenu *editMenu() const;
+    QMenu *manipulatorMenu() const;
+    QMenu *toolsMenu() const;
+    QMenu *panelMenu() const;
+    QMenu *helpMenu() const;
+    QMenu *contextMenu() const;
+    QMenu *syncMenu() const;
+    DkTcpMenu *localMenu() const;
+
+    DkManipulatorManager manipulatorManager() const;
+
+    void createActions(QWidget *parent);
+    void createMenus(QWidget *parent);
+
+    QAction *action(FileMenuActions action) const;
+    QAction *action(SortMenuActions action) const;
+    QAction *action(ViewMenuActions action) const;
+    QAction *action(EditMenuActions action) const;
+    QAction *action(ToolsMenuActions action) const;
+    QAction *action(PanelMenuActions action) const;
+    QAction *action(SyncMenuActions action) const;
+    QAction *action(PluginMenuActions action) const;
+    QAction *action(HelpMenuActions action) const;
+    QAction *action(HiddenActions action) const;
+    QAction *action(PreviewActions action) const;
+
+    QIcon icon(FileIcons icon) const;
+    QIcon icon(ViewIcons icon) const;
+    QIcon icon(EditIcons icon) const;
+
+    QVector<QAction *> fileActions() const;
+    QVector<QAction *> sortActions() const;
+    QVector<QAction *> openWithActions() const;
+    QVector<QAction *> viewActions() const;
+    QVector<QAction *> editActions() const;
+    QVector<QAction *> toolsActions() const;
+    QVector<QAction *> panelActions() const;
+    QVector<QAction *> syncActions() const;
+    QVector<QAction *> pluginActions() const;
+    QVector<QAction *> helpActions() const;
+    QVector<QAction *> previewActions() const;
+    QVector<QAction *> manipulatorActions() const;
+
+    QVector<QAction *> allActions() const;
+
+    QVector<QAction *> hiddenActions() const;
+    DkAppManager *appManager() const;
+    DkPluginActionManager *pluginActionManager() const;
+
+    void assignCustomShortcuts(QVector<QAction *> actions) const;
+
+    void enableImageActions(bool enable = true) const;
+    void enableMovieActions(bool enable = true) const;
 
 protected:
-	DkActionManager();
-	
-	void init();
-	void createIcons();
-
-	QMenu* createFileMenu(QWidget* parent);
-	QMenu* createSortMenu(QWidget* parent);
-	QMenu* createOpenWithMenu(QWidget* parent);
-	QMenu* createViewMenu(QWidget* parent);
-	QMenu* createEditMenu(QWidget* parent);
-	QMenu* createManipulatorMenu(QWidget* parent);
-	QMenu* createToolsMenu(QWidget* parent);
-	QMenu* createPanelMenu(QWidget* parent);
-	QMenu* createHelpMenu(QWidget* parent);
-	QMenu* createContextMenu(QWidget* parent);
-	QMenu* createSyncMenu(QWidget* parent);
-
-	// actions
-	QVector<QAction *> mFileActions;
-	QVector<QAction *> mSortActions;
-	QVector<QAction *> mEditActions;
-	QVector<QAction *> mToolsActions;
-	QVector<QAction *> mPanelActions;
-	QVector<QAction *> mViewActions;
-	QVector<QAction *> mSyncActions;
-	QVector<QAction *> mPluginActions;
-	QVector<QAction *> mHelpActions;
-	QVector<QAction *> mPreviewActions;
-
-	QVector<QAction *> mHiddenActions;
-
-	DkManipulatorManager mManipulators;
-
-	// dynamic menus
-	QMenu* mFileMenu = 0;
-	QMenu* mOpenWithMenu = 0;
-	QMenu* mSortMenu = 0;
-	QMenu* mViewMenu = 0;
-	QMenu* mEditMenu = 0;
-	QMenu* mManipulatorMenu = 0;
-	QMenu* mToolsMenu = 0;
-	QMenu* mPanelMenu = 0;
-	QMenu* mHelpMenu = 0;
-	QMenu* mContextMenu = 0;
-	
-	// sync
-	QMenu* mSyncMenu = 0;
-	DkTcpMenu* mLocalMenu = 0;
-	   
-	// icons
-	QVector<QIcon> mFileIcons;
-	QVector<QIcon> mEditIcons;
-	QVector<QIcon> mViewIcons;
-	QVector<QIcon> mToolsIcons;
-
-	DkAppManager* mAppManager = 0;
-	DkPluginActionManager* mPluginManager = 0;
-
-	QSharedPointer<DkActionManager> inst;
+    DkActionManager();
+
+    void init();
+    void createIcons();
+
+    QMenu *createFileMenu(QWidget *parent);
+    QMenu *createSortMenu(QWidget *parent);
+    QMenu *createOpenWithMenu(QWidget *parent);
+    QMenu *createViewMenu(QWidget *parent);
+    QMenu *createEditMenu(QWidget *parent);
+    QMenu *createManipulatorMenu(QWidget *parent);
+    QMenu *createToolsMenu(QWidget *parent);
+    QMenu *createPanelMenu(QWidget *parent);
+    QMenu *createHelpMenu(QWidget *parent);
+    QMenu *createContextMenu(QWidget *parent);
+    QMenu *createSyncMenu(QWidget *parent);
+
+    // actions
+    QVector<QAction *> mFileActions;
+    QVector<QAction *> mSortActions;
+    QVector<QAction *> mEditActions;
+    QVector<QAction *> mToolsActions;
+    QVector<QAction *> mPanelActions;
+    QVector<QAction *> mViewActions;
+    QVector<QAction *> mSyncActions;
+    QVector<QAction *> mPluginActions;
+    QVector<QAction *> mHelpActions;
+    QVector<QAction *> mPreviewActions;
+
+    QVector<QAction *> mHiddenActions;
+
+    DkManipulatorManager mManipulators;
+
+    // dynamic menus
+    QMenu *mFileMenu = 0;
+    QMenu *mOpenWithMenu = 0;
+    QMenu *mSortMenu = 0;
+    QMenu *mViewMenu = 0;
+    QMenu *mEditMenu = 0;
+    QMenu *mManipulatorMenu = 0;
+    QMenu *mToolsMenu = 0;
+    QMenu *mPanelMenu = 0;
+    QMenu *mHelpMenu = 0;
+    QMenu *mContextMenu = 0;
+
+    // sync
+    QMenu *mSyncMenu = 0;
+    DkTcpMenu *mLocalMenu = 0;
+
+    // icons
+    QVector<QIcon> mFileIcons;
+    QVector<QIcon> mEditIcons;
+    QVector<QIcon> mViewIcons;
+    QVector<QIcon> mToolsIcons;
+
+    DkAppManager *mAppManager = 0;
+    DkPluginActionManager *mPluginManager = 0;
+
+    QSharedPointer<DkActionManager> inst;
 };
 
-class DllCoreExport DkGlobalProgress : public DkWidget {
-	Q_OBJECT
+class DllCoreExport DkGlobalProgress : public DkWidget
+{
+    Q_OBJECT
 
 public:
-	static DkGlobalProgress& instance();
-	~DkGlobalProgress();
+    static DkGlobalProgress &instance();
+    ~DkGlobalProgress();
 
-	// singleton
-	DkGlobalProgress(DkGlobalProgress const&)   = delete;
-	void operator=(DkGlobalProgress const&)		= delete;
+    // singleton
+    DkGlobalProgress(DkGlobalProgress const &) = delete;
+    void operator=(DkGlobalProgress const &) = delete;
 
-
-	QObject* progressObject() const;
-	void start();
-	void stop();
+    QObject *progressObject() const;
+    void start();
+    void stop();
 
 #ifdef Q_OS_WIN
-	void setProgressBar(QWinTaskbarProgress* progressbar);
-	QWinTaskbarProgress* progressBar();
+    void setProgressBar(QWinTaskbarProgress *progressbar);
+    QWinTaskbarProgress *progressBar();
 #else
-	QProgressDialog* progressBar() const;
+    QProgressDialog *progressBar() const;
 #endif
 
 public slots:
-	void setProgressValue(int value);
+    void setProgressValue(int value);
 
 private:
-	DkGlobalProgress();
+    DkGlobalProgress();
 
-	QSharedPointer<DkGlobalProgress> inst;
-	bool showProgress;
+    QSharedPointer<DkGlobalProgress> inst;
+    bool showProgress;
 
 #ifdef Q_OS_WIN
-	QWinTaskbarProgress* mProgress = 0;
+    QWinTaskbarProgress *mProgress = 0;
 #else
-	QProgressDialog* mProgress = 0;
+    QProgressDialog *mProgress = 0;
 #endif
 };
 
-
 }
diff --git a/ImageLounge/src/DkCore/DkBaseViewPort.cpp b/ImageLounge/src/DkCore/DkBaseViewPort.cpp
index 381c946..5920fe8 100644
--- a/ImageLounge/src/DkCore/DkBaseViewPort.cpp
+++ b/ImageLounge/src/DkCore/DkBaseViewPort.cpp
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkBaseViewPort.cpp
  Created on:	03.07.2013
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -28,779 +28,701 @@
 #include "DkBaseViewPort.h"
 #include "DkActionManager.h"
 #include "DkSettings.h"
-#include "DkUtils.h"
 #include "DkStatusBar.h"
+#include "DkUtils.h"
 
-#pragma warning(push, 0)	// no warnings from includes - begin
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QCoreApplication>
-#include <QTimer>
-#include <QMovie>
-#include <QShortcut>
 #include <QDebug>
-#include <QTimer>
-#include <QSvgRenderer>
 #include <QMainWindow>
+#include <QMovie>
 #include <QScrollBar>
+#include <QShortcut>
+#include <QSvgRenderer>
+#include <QTimer>
 
 // gestures
 #include <QSwipeGesture>
 
-#pragma warning(pop)		// no warnings from includes - end
+#pragma warning(pop) // no warnings from includes - end
 
-#include <float.h>
 #include <cassert>
+#include <float.h>
 
-namespace nmc {
-	
+namespace nmc
+{
 // DkBaseViewport --------------------------------------------------------------------
-DkBaseViewPort::DkBaseViewPort(QWidget *parent) : QGraphicsView(parent) {
+DkBaseViewPort::DkBaseViewPort(QWidget *parent)
+    : QGraphicsView(parent)
+{
+    grabGesture(Qt::PanGesture);
+    grabGesture(Qt::PinchGesture);
+    grabGesture(Qt::SwipeGesture);
+    setAttribute(Qt::WA_AcceptTouchEvents);
 
-	grabGesture(Qt::PanGesture);
-	grabGesture(Qt::PinchGesture);
-	grabGesture(Qt::SwipeGesture);
-	setAttribute(Qt::WA_AcceptTouchEvents);
+    mViewportRect = QRect(0, 0, width(), height());
 
-	mViewportRect = QRect(0, 0, width(), height());
+    mPanControl = QPointF(-1.0f, -1.0f);
 
-	mPanControl = QPointF(-1.0f, -1.0f);
+    mAltMod = DkSettingsManager::param().global().altMod;
+    mCtrlMod = DkSettingsManager::param().global().ctrlMod;
 
-	mAltMod = DkSettingsManager::param().global().altMod;
-	mCtrlMod = DkSettingsManager::param().global().ctrlMod;
+    mZoomTimer = new QTimer(this);
+    mZoomTimer->setSingleShot(true);
+    connect(mZoomTimer, SIGNAL(timeout()), this, SLOT(stopBlockZooming()));
+    connect(&mImgStorage, SIGNAL(imageUpdated()), this, SLOT(update()));
 
-	mZoomTimer = new QTimer(this);
-	mZoomTimer->setSingleShot(true);
-	connect(mZoomTimer, SIGNAL(timeout()), this, SLOT(stopBlockZooming()));
-	connect(&mImgStorage, SIGNAL(imageUpdated()), this, SLOT(update()));
+    mPattern.setTexture(QPixmap(":/nomacs/img/tp-pattern.png"));
 
-	mPattern.setTexture(QPixmap(":/nomacs/img/tp-pattern.png"));
+    if (DkSettingsManager::param().display().defaultBackgroundColor)
+        setObjectName("DkBaseViewPortDefaultColor");
+    else
+        setObjectName("DkBaseViewPort");
 
-	if (DkSettingsManager::param().display().defaultBackgroundColor)
-		setObjectName("DkBaseViewPortDefaultColor");		
-	else
-		setObjectName("DkBaseViewPort");
+    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
 
-	setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-	setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+    setMouseTracking(true);
 
-	setMouseTracking(true);
+    setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+    setMinimumSize(10, 10);
 
-	setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
-	setMinimumSize(10, 10);
-
-	// connect pan actions
-	const DkActionManager& am = DkActionManager::instance();
-	connect(am.action(DkActionManager::sc_pan_left), SIGNAL(triggered()), this, SLOT(panLeft()));
-	connect(am.action(DkActionManager::sc_pan_right), SIGNAL(triggered()), this, SLOT(panRight()));
-	connect(am.action(DkActionManager::sc_pan_up), SIGNAL(triggered()), this, SLOT(panUp()));
-	connect(am.action(DkActionManager::sc_pan_down), SIGNAL(triggered()), this, SLOT(panDown()));
-	
-	connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(scrollVertically(int)));
-	connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(scrollHorizontally(int)));
-
-	mHideCursorTimer = new QTimer(this);
-	mHideCursorTimer->setInterval(1000);
-	connect(mHideCursorTimer, SIGNAL(timeout()), this, SLOT(hideCursor()));
+    // connect pan actions
+    const DkActionManager &am = DkActionManager::instance();
+    connect(am.action(DkActionManager::sc_pan_left), SIGNAL(triggered()), this, SLOT(panLeft()));
+    connect(am.action(DkActionManager::sc_pan_right), SIGNAL(triggered()), this, SLOT(panRight()));
+    connect(am.action(DkActionManager::sc_pan_up), SIGNAL(triggered()), this, SLOT(panUp()));
+    connect(am.action(DkActionManager::sc_pan_down), SIGNAL(triggered()), this, SLOT(panDown()));
 
+    connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(scrollVertically(int)));
+    connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(scrollHorizontally(int)));
 
+    mHideCursorTimer = new QTimer(this);
+    mHideCursorTimer->setInterval(1000);
+    connect(mHideCursorTimer, SIGNAL(timeout()), this, SLOT(hideCursor()));
 }
 
-DkBaseViewPort::~DkBaseViewPort() {
+DkBaseViewPort::~DkBaseViewPort()
+{
 }
 
-void DkBaseViewPort::zoomConstraints(double minZoom, double maxZoom) {
-
-	mMinZoom = minZoom;
-	mMaxZoom = maxZoom;
+void DkBaseViewPort::zoomConstraints(double minZoom, double maxZoom)
+{
+    mMinZoom = minZoom;
+    mMaxZoom = maxZoom;
 }
 
 // zoom - pan --------------------------------------------------------------------
-void DkBaseViewPort::resetView() {
-
-	resetWorldMatrix();
-	changeCursor();
+void DkBaseViewPort::resetView()
+{
+    mWorldMatrix.reset();
+    changeCursor();
 
-	update();
+    update();
 }
 
-void DkBaseViewPort::fullView() {
+void DkBaseViewPort::fullView()
+{
+    mWorldMatrix.reset();
+    zoom(1.0 / mImgMatrix.m11());
+    changeCursor();
 
-	resetWorldMatrix();
-	zoom(1.0/mImgMatrix.m11());
-	changeCursor();
-
-	update();
+    update();
 }
 
-void DkBaseViewPort::togglePattern(bool show) {
-
-	DkSettingsManager::param().display().tpPattern = show;
-	update();
+void DkBaseViewPort::togglePattern(bool show)
+{
+    DkSettingsManager::param().display().tpPattern = show;
+    update();
 }
 
-void DkBaseViewPort::panLeft() {
-
-	float delta = -2*width()/(100.0f*(float)mWorldMatrix.m11());
-	moveView(QPointF(delta,0));
+void DkBaseViewPort::panLeft()
+{
+    float delta = -2 * width() / (100.0f * (float)mWorldMatrix.m11());
+    moveView(QPointF(delta, 0));
 }
 
-void DkBaseViewPort::panRight() {
-
-	float delta = 2*width()/(100.0f*(float)mWorldMatrix.m11());
-	moveView(QPointF(delta,0));
+void DkBaseViewPort::panRight()
+{
+    float delta = 2 * width() / (100.0f * (float)mWorldMatrix.m11());
+    moveView(QPointF(delta, 0));
 }
 
-void DkBaseViewPort::panUp() {
-
-	float delta = -2*height()/(100.0f*(float)mWorldMatrix.m11());
-	moveView(QPointF(0,delta));
+void DkBaseViewPort::panUp()
+{
+    float delta = -2 * height() / (100.0f * (float)mWorldMatrix.m11());
+    moveView(QPointF(0, delta));
 }
 
-void DkBaseViewPort::panDown() {
-
-	float delta = 2*height()/(100.0f*(float)mWorldMatrix.m11());
-	moveView(QPointF(0,delta));
+void DkBaseViewPort::panDown()
+{
+    float delta = 2 * height() / (100.0f * (float)mWorldMatrix.m11());
+    moveView(QPointF(0, delta));
 }
 
-void DkBaseViewPort::moveView(const QPointF& delta) {
-
-	QPointF lDelta = delta;
-	QRectF imgWorldRect = mWorldMatrix.mapRect(mImgViewRect);
-	if (imgWorldRect.width() < mViewportRect.width())
-		lDelta.setX(0);
-	if (imgWorldRect.height() < mViewportRect.height())
-		lDelta.setY(0);
+void DkBaseViewPort::moveView(const QPointF &delta)
+{
+    QPointF lDelta = delta;
+    QRectF imgWorldRect = mWorldMatrix.mapRect(mImgViewRect);
+    if (imgWorldRect.width() < width())
+        lDelta.setX(0);
+    if (imgWorldRect.height() < height())
+        lDelta.setY(0);
 
-	mWorldMatrix.translate(lDelta.x(), lDelta.y());
-	controlImagePosition();
-	update();
+    mWorldMatrix.translate(lDelta.x(), lDelta.y());
+    controlImagePosition();
+    update();
 }
 
-
-void DkBaseViewPort::zoomIn() {
-
-	zoomLeveled(1.5);
+void DkBaseViewPort::zoomIn()
+{
+    zoomLeveled(1.5);
 }
 
-void DkBaseViewPort::zoomOut() {
-
-	zoomLeveled(0.5);
+void DkBaseViewPort::zoomOut()
+{
+    zoomLeveled(0.5);
 }
 
-void DkBaseViewPort::zoomLeveled(double factor, const QPointF& center) {
-
-	factor = DkZoomConfig::instance().nextFactor(mWorldMatrix.m11()*mImgMatrix.m11(), factor);
-	zoom(factor, center);
+void DkBaseViewPort::zoomLeveled(double factor, const QPointF &center)
+{
+    factor = DkZoomConfig::instance().nextFactor(mWorldMatrix.m11() * mImgMatrix.m11(), factor);
+    zoom(factor, center);
 }
 
-void DkBaseViewPort::zoom(double factor, const QPointF& center, bool force) {
-
-	if (mImgStorage.isEmpty())
-		return;
-
-	// reset view & block if we pass the 'image fit to screen' on zoom out
-	if (mWorldMatrix.m11() > 1 && mWorldMatrix.m11()*factor < 1 && !force) {
-
-		mBlockZooming = true;
-		mZoomTimer->start(500);
-		resetView();
-		return;
-	}
+void DkBaseViewPort::zoom(double factor, const QPointF &center, bool force)
+{
+    if (mImgStorage.isEmpty())
+        return;
 
-	// reset view if we pass the 'image fit to screen' on zoom in
-	if (mWorldMatrix.m11() < 1 && mWorldMatrix.m11()*factor > 1 && !force) {
+    // limit zoom out ---
+    if (mWorldMatrix.m11() * factor < mMinZoom && factor < 1)
+        return;
 
-		resetView();
-		return;
-	}
+    // reset view & block if we pass the 'image fit to screen' on zoom out
+    if (mWorldMatrix.m11() > 1 && mWorldMatrix.m11() * factor < 1 && !force) {
+        mBlockZooming = true;
+        mZoomTimer->start(500);
+        resetView();
+        return;
+    }
 
-    //limit zoom out ---
-    if (mWorldMatrix.m11() * factor < mMinZoom && factor < 1)
+    // reset view if we pass the 'image fit to screen' on zoom in
+    if (mWorldMatrix.m11() < 1 && mWorldMatrix.m11() * factor > 1 && !force) {
+        resetView();
         return;
+    }
 
-    //limit zoom in ---
+    // limit zoom in ---
     if (mWorldMatrix.m11() * mImgMatrix.m11() > mMaxZoom && factor > 1)
         return;
 
     QPointF pos = center;
 
     // if no center assigned: zoom in at the image center
-	if (pos.x() == -1 || pos.y() == -1)
-		pos = mViewportRect.topLeft() + mImgViewRect.center();	// mViewPortRect is not at (0,0) for DkCropViewPort
-
-	zoomToPoint(factor, pos, mWorldMatrix);
-
-	controlImagePosition();
-	changeCursor();
-		
-	update();
-}
+    if (pos.x() == -1 || pos.y() == -1)
+        pos = mImgViewRect.center();
 
-void DkBaseViewPort::zoomToPoint(double factor, const QPointF & pos, QTransform & matrix) const {
+    zoomToPoint(factor, pos, mWorldMatrix);
 
-	//inverse the transform
-	double a, b;
-	matrix.inverted().map(pos.x(), pos.y(), &a, &b);
+    controlImagePosition();
+    changeCursor();
 
-	matrix.translate(a - factor * a, b - factor * b);
-	matrix.scale(factor, factor);
+    update();
 }
 
-void DkBaseViewPort::rotateTransform(QTransform& t, double angle, const QPointF& c) const {
+void DkBaseViewPort::zoomToPoint(double factor, const QPointF &pos, QTransform &matrix) const
+{
+    // inverse the transform
+    double a, b;
+    matrix.inverted().map(pos.x(), pos.y(), &a, &b);
 
-	if (angle != 0.0) {
-		
-		QPointF cc = c;
-
-		if (cc.isNull())
-			cc = mWorldMatrix.inverted().map(mViewportRect.center());
-
-		// rotate image around center...
-		t.translate(cc.x(), cc.y());
-		t.rotate(angle);
-		t.translate(-cc.x(), -cc.y());
-	}
+    matrix.translate(a - factor * a, b - factor * b);
+    matrix.scale(factor, factor);
 }
 
-QRect DkBaseViewPort::controlRect(const QRect& r) const {
-
-	QRect cr = r;
-
-	if (r.isNull()) {
-
-		// i.e. crop viewport sets pan control to 0
-		if (mPanControl.x() != -1 && mPanControl.y() != -1) {
-
-			cr.setTopLeft(mViewportRect.topLeft() + mPanControl.toPoint());
-			cr.setBottomRight(mViewportRect.bottomRight() - mPanControl.toPoint());
-		}
-		// we must not pan further if scrollbars are visible
-		else if (DkSettingsManager::instance().param().display().showScrollBars) {
-
-			cr = mViewportRect;
-		}
-		else {
-
-			// default behavior
-			cr = QRect(mViewportRect.center(), QSize(1, 1));
-		}
-	}
-
-	return cr;
-}
-
-void DkBaseViewPort::stopBlockZooming() {
-	mBlockZooming = false;
+void DkBaseViewPort::stopBlockZooming()
+{
+    mBlockZooming = false;
 }
 
 // set image --------------------------------------------------------------------
 #ifdef WITH_OPENCV
-void DkBaseViewPort::setImage(cv::Mat newImg) {
-
-	QImage imgQt = DkImage::mat2QImage(newImg);
-	setImage(imgQt);
+void DkBaseViewPort::setImage(cv::Mat newImg)
+{
+    QImage imgQt = DkImage::mat2QImage(newImg);
+    setImage(imgQt);
 }
 #endif
 
-void DkBaseViewPort::setImage(QImage newImg) {
+void DkBaseViewPort::setImage(QImage newImg)
+{
+    mImgStorage.setImage(newImg);
+    QRectF oldImgRect = mImgRect;
+    mImgRect = QRectF(QPoint(), getImageSize());
 
-	mImgStorage.setImage(newImg);
-	QRectF oldImgRect = mImgRect;
-	mImgRect = QRectF(QPoint(), getImageSize());
-	
-	if (!DkSettingsManager::param().display().keepZoom || mImgRect != oldImgRect)
-		resetWorldMatrix();
+    if (!DkSettingsManager::param().display().keepZoom || mImgRect != oldImgRect)
+        mWorldMatrix.reset();
 
-	updateImageMatrix();
-	update();
-	emit newImageSignal(&newImg);
+    updateImageMatrix();
+    update();
+    emit newImageSignal(&newImg);
 }
 
-void DkBaseViewPort::hideCursor() {
-
-	if (isFullScreen())
-		setCursor(Qt::BlankCursor);
+void DkBaseViewPort::hideCursor()
+{
+    if (isFullScreen())
+        setCursor(Qt::BlankCursor);
 }
 
-QImage DkBaseViewPort::getImage() const {
-	
-	if (mMovie && mMovie->isValid())
-		return mMovie->currentImage();
-	if (mSvg && mSvg->isValid() && !mImgViewRect.isEmpty()) {
-
-		QImage img(mImgViewRect.size().toSize(), QImage::Format_ARGB32);
-		img.fill(QColor(0, 0, 0, 0));
+QImage DkBaseViewPort::getImage() const
+{
+    if (mMovie && mMovie->isValid())
+        return mMovie->currentImage();
+    if (mSvg && mSvg->isValid() && !mImgViewRect.isEmpty()) {
+        QImage img(mImgViewRect.size().toSize(), QImage::Format_ARGB32);
+        img.fill(QColor(0, 0, 0, 0));
 
-		QPainter p(&img);
+        QPainter p(&img);
 
-		if (mSvg && mSvg->isValid()) {
-			mSvg->render(&p, mImgViewRect);
-		}
+        if (mSvg && mSvg->isValid()) {
+            mSvg->render(&p, mImgViewRect);
+        }
 
-		return img;
-	}
+        return img;
+    }
 
-	return mImgStorage.imageConst();
+    return mImgStorage.imageConst();
 }
 
-QSize DkBaseViewPort::getImageSize() const {
+QSize DkBaseViewPort::getImageSize() const
+{
+    if (mSvg) {
+        // qDebug() << "win: " << size() << "svg:" << mSvg->defaultSize() << "scaled:" << mSvg->defaultSize().scaled(size(), Qt::KeepAspectRatio);
+        return mSvg->defaultSize().scaled(size(), Qt::KeepAspectRatio);
+    }
 
-	if (mSvg) {
-		//qDebug() << "win: " << size() << "svg:" << mSvg->defaultSize() << "scaled:" << mSvg->defaultSize().scaled(size(), Qt::KeepAspectRatio);
-		return mSvg->defaultSize().scaled(size(), Qt::KeepAspectRatio);
-	}
-
-	return mImgStorage.size();
+    return mImgStorage.size();
 }
 
-QRectF DkBaseViewPort::getImageViewRect() const {
-
-	return mWorldMatrix.mapRect(mImgViewRect);
+QRectF DkBaseViewPort::getImageViewRect() const
+{
+    return mWorldMatrix.mapRect(mImgViewRect);
 }
 
-QImage DkBaseViewPort::getCurrentImageRegion() {
-
-	QRectF viewRect = QRectF(QPoint(), size());
-	viewRect = mWorldMatrix.inverted().mapRect(viewRect);
-	viewRect = mImgMatrix.inverted().mapRect(viewRect);
+QImage DkBaseViewPort::getCurrentImageRegion()
+{
+    QRectF viewRect = QRectF(QPoint(), size());
+    viewRect = mWorldMatrix.inverted().mapRect(viewRect);
+    viewRect = mImgMatrix.inverted().mapRect(viewRect);
 
-	QImage imgR(viewRect.size().toSize(), QImage::Format_ARGB32);
-	imgR.fill(0);
+    QImage imgR(viewRect.size().toSize(), QImage::Format_ARGB32);
+    imgR.fill(0);
 
-	QPainter painter(&imgR);
-	painter.drawImage(imgR.rect(), mImgStorage.image(), viewRect.toRect());
-	painter.end();
+    QPainter painter(&imgR);
+    painter.drawImage(imgR.rect(), mImgStorage.image(), viewRect.toRect());
+    painter.end();
 
-	return imgR;
+    return imgR;
 }
 
-bool DkBaseViewPort::unloadImage(bool) {
-
-	return true;
+bool DkBaseViewPort::unloadImage(bool)
+{
+    return true;
 }
 
 // events --------------------------------------------------------------------
-void DkBaseViewPort::paintEvent(QPaintEvent* event) {
-
-	QPainter painter(viewport());
-
-	if (!mImgStorage.isEmpty()) {
-
-		QTransform wt = mWorldMatrix;
-		rotateTransform(wt, mAngle);
+void DkBaseViewPort::paintEvent(QPaintEvent *event)
+{
+    QPainter painter(viewport());
 
-		painter.setWorldTransform(wt);
+    if (!mImgStorage.isEmpty()) {
+        painter.setWorldTransform(mWorldMatrix);
 
-		// don't interpolate - we have a sophisticated anti-aliasing methods
-		//// don't interpolate if we are forced to, at 100% or we exceed the maximal interpolation level
-		if (!mForceFastRendering && // force?
-			mImgMatrix.m11()*mWorldMatrix.m11()-DBL_EPSILON > 1.0 && // @100% ?
-			mImgMatrix.m11()*mWorldMatrix.m11() <= DkSettingsManager::param().display().interpolateZoomLevel/100.0) {	// > max zoom level
-				painter.setRenderHints(QPainter::SmoothPixmapTransform | QPainter::Antialiasing);
-		}
+        // don't interpolate - we have a sophisticated anti-aliasing methods
+        //// don't interpolate if we are forced to, at 100% or we exceed the maximal interpolation level
+        if (!mForceFastRendering && // force?
+            mImgMatrix.m11() * mWorldMatrix.m11() - DBL_EPSILON > 1.0 && // @100% ?
+            mImgMatrix.m11() * mWorldMatrix.m11() <= DkSettingsManager::param().display().interpolateZoomLevel / 100.0) { // > max zoom level
+            painter.setRenderHints(QPainter::SmoothPixmapTransform | QPainter::Antialiasing);
+        }
 
-		draw(painter);
-	}
+        draw(painter);
+    }
 
-	// propagate
-	QGraphicsView::paintEvent(event);
+    // propagate
+    QGraphicsView::paintEvent(event);
 }
 
-void DkBaseViewPort::resizeEvent(QResizeEvent *event) {
-
-	if (event->oldSize() == event->size())
-		return;
+void DkBaseViewPort::resizeEvent(QResizeEvent *event)
+{
+    if (event->oldSize() == event->size())
+        return;
 
-	mViewportRect = QRect(0, 0, event->size().width(), event->size().height());
+    mViewportRect = QRect(0, 0, event->size().width(), event->size().height());
 
-	updateImageMatrix();
-	centerImage();
-	changeCursor();
+    updateImageMatrix();
+    centerImage();
+    changeCursor();
 
-	return QGraphicsView::resizeEvent(event);
+    return QGraphicsView::resizeEvent(event);
 }
 
-bool DkBaseViewPort::event(QEvent *event) {
+bool DkBaseViewPort::event(QEvent *event)
+{
+    // TODO: check if we still need this
+    if (event->type() == QEvent::Gesture)
+        return gestureEvent(static_cast<QGestureEvent *>(event));
 
-	// TODO: check if we still need this
-	if (event->type() == QEvent::Gesture)
-		return gestureEvent(static_cast<QGestureEvent*>(event));
-
-	return QGraphicsView::event(event);
+    return QGraphicsView::event(event);
 }
 
-bool DkBaseViewPort::gestureEvent(QGestureEvent* event) {
+bool DkBaseViewPort::gestureEvent(QGestureEvent *event)
+{
+    if (QGesture *swipeG = event->gesture(Qt::SwipeGesture)) {
+        QSwipeGesture *swipe = static_cast<QSwipeGesture *>(swipeG);
 
-	if (QGesture *swipeG = event->gesture(Qt::SwipeGesture)) {
-		QSwipeGesture *swipe = static_cast<QSwipeGesture *>(swipeG);
+        // thanks qt documentation : )
+        if (swipe->state() == Qt::GestureFinished) {
+            if (swipe->horizontalDirection() == QSwipeGesture::Left || swipe->verticalDirection() == QSwipeGesture::Up)
+                qDebug() << "here comes the previous image function...";
+            else
+                qDebug() << "here comes the next image function...";
+        }
+        qDebug() << "swiping...";
+    } else if (QPinchGesture *pinch = static_cast<QPinchGesture *>(event->gesture(Qt::PinchGesture))) {
+        double scale = pinch->lastScaleFactor();
 
-		// thanks qt documentation : )
-		if (swipe->state() == Qt::GestureFinished) {
-			if (swipe->horizontalDirection() == QSwipeGesture::Left
-				|| swipe->verticalDirection() == QSwipeGesture::Up)
-				qDebug() << "here comes the previous image function...";
-			else
-				qDebug() << "here comes the next image function...";
-		}
-		qDebug() << "swiping...";
-	}
-	else if (QPinchGesture *pinch = static_cast<QPinchGesture*>(event->gesture(Qt::PinchGesture))) {
+        if (fabs(scale - 1.0) > FLT_EPSILON) {
+            zoom(scale, mapFromGlobal(pinch->centerPoint().toPoint()));
+        }
 
-#if QT_VERSION >= 0x050000
-		double scale = pinch->lastScaleFactor();
+        qDebug() << "[Qt] pinching...";
+    } else if (/*QGesture *pan = */ event->gesture(Qt::PanGesture)) {
+        qDebug() << "panning...";
+    } else
+        return false;
 
-		if (fabs(scale-1.0) > FLT_EPSILON) {
-			zoom(scale, mapFromGlobal(pinch->centerPoint().toPoint()));
-		}
-#endif
-		qDebug() << "[Qt] pinching...";
-	}
-	else if (/*QGesture *pan = */event->gesture(Qt::PanGesture)) {
-		qDebug() << "panning...";
-	}
-	else
-		return false;
-
-	return true;
+    return true;
 }
 
 // key events --------------------------------------------------------------------
-void DkBaseViewPort::keyPressEvent(QKeyEvent* event) {
-
-	// we want to change the behaviour on auto-repeat - so we cannot use QShortcuts here...
-	if (event->key() == DkActionManager::shortcut_zoom_in || event->key() == DkActionManager::shortcut_zoom_in_alt) {
-		zoom(event->isAutoRepeat() ? 1.1f : 1.5f);
-	}
-	if (event->key() == DkActionManager::shortcut_zoom_out || event->key() == DkActionManager::shortcut_zoom_out_alt) {
-		zoom(event->isAutoRepeat() ? 0.9f : 0.5f);
-	}
+void DkBaseViewPort::keyPressEvent(QKeyEvent *event)
+{
+    // we want to change the behaviour on auto-repeat - so we cannot use QShortcuts here...
+    if (event->key() == DkActionManager::shortcut_zoom_in || event->key() == DkActionManager::shortcut_zoom_in_alt) {
+        zoom(event->isAutoRepeat() ? 1.1f : 1.5f);
+    }
+    if (event->key() == DkActionManager::shortcut_zoom_out || event->key() == DkActionManager::shortcut_zoom_out_alt) {
+        zoom(event->isAutoRepeat() ? 0.9f : 0.5f);
+    }
 
-	QWidget::keyPressEvent(event);
+    QWidget::keyPressEvent(event);
 }
 
-void DkBaseViewPort::keyReleaseEvent(QKeyEvent* event) {
-
+void DkBaseViewPort::keyReleaseEvent(QKeyEvent *event)
+{
 #ifdef DK_CORE_DLL_EXPORT
-	if (!event->isAutoRepeat())
-		emit keyReleaseSignal(event);	// make key presses available
+    if (!event->isAutoRepeat())
+        emit keyReleaseSignal(event); // make key presses available
 #endif
 
-	QWidget::keyReleaseEvent(event);
+    QWidget::keyReleaseEvent(event);
 }
 
 // mouse events --------------------------------------------------------------------
-void DkBaseViewPort::mousePressEvent(QMouseEvent *event) {
-
-	// ok, start panning
-	if ((!mImgWithin || mWorldMatrix.m11() > 1) && !imageInside() && event->buttons() == Qt::LeftButton) {
-		setCursor(Qt::ClosedHandCursor);
-	}
+void DkBaseViewPort::mousePressEvent(QMouseEvent *event)
+{
+    // ok, start panning
+    if (mWorldMatrix.m11() > 1 && !imageInside() && event->buttons() == Qt::LeftButton) {
+        setCursor(Qt::ClosedHandCursor);
+    }
 
-	mPosGrab = event->pos();
+    mPosGrab = event->pos();
 
-	QWidget::mousePressEvent(event);
+    QWidget::mousePressEvent(event);
 }
 
-void DkBaseViewPort::mouseReleaseEvent(QMouseEvent *event) {
+void DkBaseViewPort::mouseReleaseEvent(QMouseEvent *event)
+{
+    if (mWorldMatrix.m11() > 1 && !imageInside())
+        setCursor(Qt::OpenHandCursor);
 
-	if ((!mImgWithin || mWorldMatrix.m11() > 1) && !imageInside())
-		setCursor(Qt::OpenHandCursor);
-
-	QWidget::mouseReleaseEvent(event);
+    QWidget::mouseReleaseEvent(event);
 }
 
-void DkBaseViewPort::mouseDoubleClickEvent(QMouseEvent *event) {
-
-	QCoreApplication::sendEvent(parentWidget(), event);
+void DkBaseViewPort::mouseDoubleClickEvent(QMouseEvent *event)
+{
+    QCoreApplication::sendEvent(parentWidget(), event);
 }
 
-void DkBaseViewPort::mouseMoveEvent(QMouseEvent *event) {
-
-	if ((!mImgWithin || mWorldMatrix.m11() > 1) && event->buttons() == Qt::LeftButton) {
+void DkBaseViewPort::mouseMoveEvent(QMouseEvent *event)
+{
+    if (mWorldMatrix.m11() > 1 && event->buttons() == Qt::LeftButton) {
+        QPointF cPos = event->pos();
+        QPointF dxy = (cPos - mPosGrab);
+        mPosGrab = cPos;
+        moveView(dxy / mWorldMatrix.m11());
+    }
+    if (event->buttons() != Qt::LeftButton && event->buttons() != Qt::RightButton) {
+        if (event->modifiers() == mCtrlMod && event->modifiers() != mAltMod) {
+            setCursor(Qt::CrossCursor);
+            // DkStatusBarManager::instance().show(true, false);
+        } else if (mWorldMatrix.m11() > 1 && !imageInside())
+            setCursor(Qt::OpenHandCursor);
+        else {
+            if (!DkSettingsManager::param().app().showStatusBar)
+                DkStatusBarManager::instance().show(false, false);
 
-		QPointF cPos = event->pos();
-		QPointF dxy = (cPos - mPosGrab);
-		mPosGrab = cPos;
-		moveView(dxy/mWorldMatrix.m11());
-	}
-	if (event->buttons() != Qt::LeftButton && event->buttons() != Qt::RightButton) {
+            if (cursor().shape() != Qt::ArrowCursor)
+                unsetCursor();
+        }
 
-		if (event->modifiers() == mCtrlMod && event->modifiers() != mAltMod) {
-			setCursor(Qt::CrossCursor);
-			//DkStatusBarManager::instance().show(true, false);
-		}
-		else if (mWorldMatrix.m11() > 1 && !imageInside())
-			setCursor(Qt::OpenHandCursor);
-		else {
+        if (isFullScreen())
+            mHideCursorTimer->start(3000);
+    }
 
-			if (!DkSettingsManager::param().app().showStatusBar)
-				DkStatusBarManager::instance().show(false, false);
-
-			 if (cursor().shape() != Qt::ArrowCursor)
-				unsetCursor();
-		}
-
-		if (isFullScreen())
-			mHideCursorTimer->start(3000);
-	}
-
-	QWidget::mouseMoveEvent(event);
+    QWidget::mouseMoveEvent(event);
 }
 
-void DkBaseViewPort::wheelEvent(QWheelEvent *event) {
-
-	double factor = -event->delta();
-	if (DkSettingsManager::param().display().invertZoom) factor *= -1.0;
+void DkBaseViewPort::wheelEvent(QWheelEvent *event)
+{
+    double factor = -event->angleDelta().y();
+    if (DkSettingsManager::param().display().invertZoom)
+        factor *= -1.0;
 
-	factor /= -1200.0;
-	factor += 1.0;
+    factor /= -1200.0;
+    factor += 1.0;
 
-	//qDebug() << "zoom factor..." << factor;
-	zoomLeveled(factor, event->pos());
+    // qDebug() << "zoom factor..." << factor;
+    zoomLeveled(factor, event->position());
 }
 
-void DkBaseViewPort::contextMenuEvent(QContextMenuEvent *event) {
-
-	// send this event to my parent...
-	QWidget::contextMenuEvent(event);
+void DkBaseViewPort::contextMenuEvent(QContextMenuEvent *event)
+{
+    // send this event to my parent...
+    QWidget::contextMenuEvent(event);
 }
 
 // protected functions --------------------------------------------------------------------
-void DkBaseViewPort::draw(QPainter & painter, double opacity) {
-
-	if (DkUtils::getMainWindow()->isFullScreen()) {
-		painter.setWorldMatrixEnabled(false);
-		painter.fillRect(QRect(QPoint(), size()), DkSettingsManager::param().slideShow().backgroundColor);
-		painter.setWorldMatrixEnabled(true);
-	}
-
-	if (backgroundBrush() != Qt::NoBrush) {
-		painter.setWorldMatrixEnabled(false);
-		painter.fillRect(QRect(QPoint(), size()), backgroundBrush());
-		painter.setWorldMatrixEnabled(true);
-	}
-
-	QRect displayRect = mWorldMatrix.mapRect(mImgViewRect).toRect();
-	QImage img = mImgStorage.image(displayRect.size());
-
-	// opacity == 1.0f -> do not show pattern if we crossfade two images
-	if (DkSettingsManager::param().display().tpPattern && img.hasAlphaChannel() && opacity == 1.0)
-		drawPattern(painter);
-
-	double oldOp = painter.opacity();
-	painter.setOpacity(opacity);
-
-	if (mSvg && mSvg->isValid()) {
-		mSvg->render(&painter, mImgViewRect);
-	}
-	else if (mMovie && mMovie->isValid()) {
-		painter.drawPixmap(mImgViewRect, mMovie->currentPixmap(), mMovie->frameRect());
-	}
-	else {
-
-		// if we have the exact level cached: render it directly
-		if (displayRect.width() == img.width() &&
-			displayRect.height() == img.height() && mAngle == 0.0) {
-
-			painter.setWorldMatrixEnabled(false);
-			painter.setRenderHint(QPainter::SmoothPixmapTransform, false);
-			painter.drawImage(displayRect, img, img.rect());
-			painter.setWorldMatrixEnabled(true);
-		}
-		else {
-			if (mImgMatrix.m11()*mWorldMatrix.m11() - std::numeric_limits<double>::epsilon() < 1.0)
-				painter.setRenderHint(QPainter::SmoothPixmapTransform, true);
-			painter.drawImage(mImgViewRect, img, img.rect());
-		}
-	}
-
-	painter.setOpacity(oldOp);
-}
-
-void DkBaseViewPort::drawPattern(QPainter & painter) const {
-
-	QBrush pt = mPattern;
-
-	// don't scale the pattern...
-	QTransform scaleIv;
-	scaleIv.scale(mWorldMatrix.m11(), mWorldMatrix.m22());
-	pt.setTransform(scaleIv.inverted());
-
-	painter.setPen(QPen(Qt::NoPen));	// no border
-	painter.setBrush(pt);
-	painter.drawRect(mImgViewRect);
-}
-
-bool DkBaseViewPort::imageInside() const {
-
-	QRect viewRect = mWorldMatrix.mapRect(mImgViewRect).toRect();
-	return (mImgWithin && mWorldMatrix.m11() <= 1.0f) || mViewportRect.contains(viewRect);
-}
-
-void DkBaseViewPort::updateImageMatrix() {
-
-	if (mImgStorage.isEmpty())
-		return;
-
-	QRectF oldImgRect = mImgViewRect;
-	QTransform oldImgMatrix = mImgMatrix;
-
-	mImgMatrix.reset();
-
-	QSize imgSize = getImageSize();
-
-	// if the image is smaller or zoom is active: paint the image as is
-	if (!mViewportRect.contains(mImgRect.toRect()))
-		mImgMatrix = getScaledImageMatrix();
-	else {
-		mImgMatrix.translate(
-			((float)mViewportRect.width()-imgSize.width())*0.5f, 
-			((float)mViewportRect.height()-imgSize.height())*0.5f);
-		mImgMatrix.scale(1.0f, 1.0f);
-	}
-
-	mImgViewRect = mImgMatrix.mapRect(mImgRect);
+void DkBaseViewPort::draw(QPainter &painter, double opacity)
+{
+    if (DkUtils::getMainWindow()->isFullScreen()) {
+        painter.setWorldMatrixEnabled(false);
+        painter.fillRect(QRect(QPoint(), size()), DkSettingsManager::param().slideShow().backgroundColor);
+        painter.setWorldMatrixEnabled(true);
+    }
+
+    if (backgroundBrush() != Qt::NoBrush) {
+        painter.setWorldMatrixEnabled(false);
+        painter.fillRect(QRect(QPoint(), size()), backgroundBrush());
+        painter.setWorldMatrixEnabled(true);
+    }
+
+    QRect displayRect = mWorldMatrix.mapRect(mImgViewRect).toRect();
+    QImage img = mImgStorage.image(displayRect.size());
+
+    // opacity == 1.0f -> do not show pattern if we crossfade two images
+    if (DkSettingsManager::param().display().tpPattern && img.hasAlphaChannel() && opacity == 1.0)
+        drawPattern(painter);
+
+    double oldOp = painter.opacity();
+    painter.setOpacity(opacity);
+
+    if (mSvg && mSvg->isValid()) {
+        mSvg->render(&painter, mImgViewRect);
+    } else if (mMovie && mMovie->isValid()) {
+        painter.drawPixmap(mImgViewRect, mMovie->currentPixmap(), mMovie->frameRect());
+    } else {
+        // if we have the exact level cached: render it directly
+        if (displayRect.width() == img.width() && displayRect.height() == img.height()) {
+            painter.setWorldMatrixEnabled(false);
+            painter.setRenderHint(QPainter::SmoothPixmapTransform, false);
+            painter.drawImage(displayRect, img, img.rect());
+            painter.setWorldMatrixEnabled(true);
+        } else {
+            if (mImgMatrix.m11() * mWorldMatrix.m11() - std::numeric_limits<double>::epsilon() < 1.0)
+                painter.setRenderHint(QPainter::SmoothPixmapTransform, true);
+            painter.drawImage(mImgViewRect, img, img.rect());
+        }
+    }
+
+    painter.setOpacity(oldOp);
+}
+
+void DkBaseViewPort::drawPattern(QPainter &painter) const
+{
+    QBrush pt = mPattern;
+
+    // don't scale the pattern...
+    QTransform scaleIv;
+    scaleIv.scale(mWorldMatrix.m11(), mWorldMatrix.m22());
+    pt.setTransform(scaleIv.inverted());
+
+    painter.setPen(QPen(Qt::NoPen)); // no border
+    painter.setBrush(pt);
+    painter.drawRect(mImgViewRect);
+}
+
+bool DkBaseViewPort::imageInside() const
+{
+    QRect viewRect = mWorldMatrix.mapRect(mImgViewRect).toRect();
+
+    return mWorldMatrix.m11() <= 1.0f || mViewportRect.contains(viewRect);
+}
+
+void DkBaseViewPort::updateImageMatrix()
+{
+    if (mImgStorage.isEmpty())
+        return;
 
-	// update world matrix
-	double scaleFactor = oldImgMatrix.m11()/mImgMatrix.m11();
+    QRectF oldImgRect = mImgViewRect;
+    QTransform oldImgMatrix = mImgMatrix;
 
-	// clamp it
-	if (qAbs(scaleFactor - 1.0) < 1e-4)
-		scaleFactor = 1.0;
+    mImgMatrix.reset();
 
-	double dx = oldImgRect.x()/scaleFactor-mImgViewRect.x();
-	double dy = oldImgRect.y()/scaleFactor-mImgViewRect.y();
+    QSize imgSize = getImageSize();
 
-	mWorldMatrix.scale(scaleFactor, scaleFactor);
-	mWorldMatrix.translate(dx, dy);
+    // if the image is smaller or zoom is active: paint the image as is
+    if (!mViewportRect.contains(mImgRect))
+        mImgMatrix = getScaledImageMatrix();
+    else {
+        mImgMatrix.translate((float)(width() - imgSize.width()) * 0.5f, (float)(height() - imgSize.height()) * 0.5f);
+        mImgMatrix.scale(1.0f, 1.0f);
+    }
+
+    mImgViewRect = mImgMatrix.mapRect(mImgRect);
+
+    // update world matrix
+    if (mWorldMatrix.m11() != 1) {
+        double scaleFactor = oldImgMatrix.m11() / mImgMatrix.m11();
+        double dx = oldImgRect.x() / scaleFactor - mImgViewRect.x();
+        double dy = oldImgRect.y() / scaleFactor - mImgViewRect.y();
+
+        mWorldMatrix.scale(scaleFactor, scaleFactor);
+        mWorldMatrix.translate(dx, dy);
+    }
 }
 
-void DkBaseViewPort::resetWorldMatrix() {
-
-	mWorldMatrix.reset();
-	mWorldMatrix.translate(mViewportRect.x(), mViewportRect.y());
-}
-
-QTransform DkBaseViewPort::getScaledImageMatrix() const {
-
-	QSize s = size();
-	if (!mViewportRect.isNull())
-		s = mViewportRect.size();
-
-	return getScaledImageMatrix(s);
+QTransform DkBaseViewPort::getScaledImageMatrix() const
+{
+    return getScaledImageMatrix(size());
 }
 
-QTransform DkBaseViewPort::getScaledImageMatrix(const QSize& size, bool center) const {
+QTransform DkBaseViewPort::getScaledImageMatrix(const QSize &size) const
+{
+    // the image resizes as we zoom
+    float ratioImg = (float)mImgRect.width() / (float)mImgRect.height();
+    float ratioWin = (float)size.width() / (float)size.height();
 
-	// the image resizes as we zoom
-	double ratioImg = (double)mImgRect.width()/mImgRect.height();
-	double ratioWin = (double)size.width()/size.height();
+    QTransform imgMatrix;
+    float s;
+    if (mImgRect.width() == 0 || mImgRect.height() == 0)
+        s = 1.0f;
+    else
+        s = (ratioImg > ratioWin) ? (float)size.width() / (float)mImgRect.width() : (float)size.height() / (float)mImgRect.height();
 
-	QTransform imgMatrix;
-	double scale = 1.0;
-	double wr = (double)size.width() / mImgRect.width();
-	double hr = (double)size.height() / mImgRect.height();
+    imgMatrix.scale(s, s);
 
-	if (mImgRect.isValid()) {
+    QRectF imgViewRect = imgMatrix.mapRect(mImgRect);
+    imgMatrix.translate((size.width() - imgViewRect.width()) * 0.5f / s, (size.height() - imgViewRect.height()) * 0.5f / s);
 
-		if (mImgWithin)
-			scale = (ratioImg > ratioWin) ? wr : hr;
-		else
-			scale = (ratioImg < ratioWin) ? wr : hr;
-
-	}
-
-	imgMatrix.scale(scale, scale);
-
-	QRectF imgViewRect = imgMatrix.mapRect(mImgRect);
-	
-	if (center) {
-		imgMatrix.translate(
-			(size.width()  - imgViewRect.width())  * 0.5 / scale,
-			(size.height() - imgViewRect.height()) * 0.5 / scale);
-	}
-
-	return imgMatrix;
+    return imgMatrix;
 }
 
-void DkBaseViewPort::controlImagePosition(const QRect& r) {
+void DkBaseViewPort::controlImagePosition(float lb, float ub)
+{
+    QRectF imgRectWorld = mWorldMatrix.mapRect(mImgViewRect);
 
-	QRectF imgRectWorld = mWorldMatrix.mapRect(mImgViewRect);
-	QRect cr = controlRect(r);
+    if (lb == -1 && ub == -1 && mPanControl.x() != -1 && mPanControl.y() != -1) {
+        lb = (float)mPanControl.x();
+        ub = (float)mPanControl.y();
+    }
+    // we must not pan further if scrollbars are visible
+    else if (lb == -1 && ub == -1 && DkSettingsManager::instance().param().display().showScrollBars) {
+        lb = 0.0f;
+        ub = 0.0f;
+    } else {
+        // default behavior
+        if (lb == -1)
+            lb = (float)mViewportRect.width() / 2.0f;
+        if (ub == -1)
+            ub = (float)mViewportRect.height() / 2.0f;
+    }
 
-	if (imgRectWorld.left() > cr.left() && imgRectWorld.width() >= cr.width())
-		mWorldMatrix.translate((cr.left()-imgRectWorld.left())/mWorldMatrix.m11(), 0);
+    if (imgRectWorld.left() > lb && imgRectWorld.width() > width())
+        mWorldMatrix.translate((lb - imgRectWorld.left()) / mWorldMatrix.m11(), 0);
 
-	if (imgRectWorld.top() > cr.top() && imgRectWorld.height() >= cr.height())
-		mWorldMatrix.translate(0, (cr.top()-imgRectWorld.top())/mWorldMatrix.m11());
+    if (imgRectWorld.top() > ub && imgRectWorld.height() > height())
+        mWorldMatrix.translate(0, (ub - imgRectWorld.top()) / mWorldMatrix.m11());
 
-	if (imgRectWorld.right() < cr.right() && imgRectWorld.width() >= cr.width())
-		mWorldMatrix.translate((cr.right()-imgRectWorld.right())/mWorldMatrix.m11(), 0);
+    if (imgRectWorld.right() < width() - lb && imgRectWorld.width() > width())
+        mWorldMatrix.translate(((width() - lb) - imgRectWorld.right()) / mWorldMatrix.m11(), 0);
 
-	if (imgRectWorld.bottom() < cr.bottom() && imgRectWorld.height() >= cr.height())
-		mWorldMatrix.translate(0, (cr.bottom()-imgRectWorld.bottom())/mWorldMatrix.m11());
+    if (imgRectWorld.bottom() < height() - ub && imgRectWorld.height() > height())
+        mWorldMatrix.translate(0, ((height() - ub) - imgRectWorld.bottom()) / mWorldMatrix.m11());
 
-	// update scene size (this is needed to make the scroll area work)
-	if (DkSettingsManager::instance().param().display().showScrollBars)
-		setSceneRect(getImageViewRect());
+    // update scene size (this is needed to make the scroll area work)
+    if (DkSettingsManager::instance().param().display().showScrollBars)
+        setSceneRect(getImageViewRect());
 
-	emit imageUpdated();
+    emit imageUpdated();
 }
 
-void DkBaseViewPort::centerImage() {
+void DkBaseViewPort::centerImage()
+{
+    QRectF imgWorldRect = mWorldMatrix.mapRect(mImgViewRect);
+    float dx, dy;
 
-	QRectF imgWorldRect = mWorldMatrix.mapRect(mImgViewRect);
-	float dx, dy;
+    // if black border - center the image
+    if (imgWorldRect.width() < (float)width()) {
+        dx = (float)((width() - imgWorldRect.width()) * 0.5f - mImgViewRect.x() * mWorldMatrix.m11());
+        dx = (dx - (float)mWorldMatrix.dx()) / (float)mWorldMatrix.m11();
+        mWorldMatrix.translate(dx, 0);
+    } else if (imgWorldRect.left() > 0)
+        mWorldMatrix.translate(-imgWorldRect.left() / mWorldMatrix.m11(), 0);
+    else if (imgWorldRect.right() < width())
+        mWorldMatrix.translate((width() - imgWorldRect.right()) / mWorldMatrix.m11(), 0);
 
-	// if black border - center the image
-	if (imgWorldRect.width() < (float)width()) {
-		dx = (float)((width()-imgWorldRect.width())*0.5f-mImgViewRect.x()*mWorldMatrix.m11());
-		dx = (dx-(float)mWorldMatrix.dx())/(float)mWorldMatrix.m11();
-		mWorldMatrix.translate(dx, 0);
-	}
-	else if (imgWorldRect.left() > 0)
-		mWorldMatrix.translate(-imgWorldRect.left()/mWorldMatrix.m11(), 0);
-	else if (imgWorldRect.right() < width())
-		mWorldMatrix.translate((width()-imgWorldRect.right())/mWorldMatrix.m11(), 0);
-
-	if (imgWorldRect.height() < height()) {
-		dy = (float)((height()-imgWorldRect.height())*0.5f-mImgViewRect.y()*mWorldMatrix.m22());
-		dy = (float)((dy-mWorldMatrix.dy())/mWorldMatrix.m22());
-		mWorldMatrix.translate(0, dy);
-	}
-	else if (imgWorldRect.top() > 0) {
-		mWorldMatrix.translate(0, -imgWorldRect.top()/mWorldMatrix.m22());
-	}
-	else if (imgWorldRect.bottom() < height()) {
-		mWorldMatrix.translate(0, (height()-imgWorldRect.bottom())/mWorldMatrix.m22());
-	}
+    if (imgWorldRect.height() < height()) {
+        dy = (float)((height() - imgWorldRect.height()) * 0.5f - mImgViewRect.y() * mWorldMatrix.m22());
+        dy = (float)((dy - mWorldMatrix.dy()) / mWorldMatrix.m22());
+        mWorldMatrix.translate(0, dy);
+    } else if (imgWorldRect.top() > 0) {
+        mWorldMatrix.translate(0, -imgWorldRect.top() / mWorldMatrix.m22());
+    } else if (imgWorldRect.bottom() < height()) {
+        mWorldMatrix.translate(0, (height() - imgWorldRect.bottom()) / mWorldMatrix.m22());
+    }
 }
 
-void DkBaseViewPort::changeCursor() {
-
-	if (mWorldMatrix.m11() > 1 && !imageInside())
-		setCursor(Qt::OpenHandCursor);
-	else
-		unsetCursor();
+void DkBaseViewPort::changeCursor()
+{
+    if (mWorldMatrix.m11() > 1 && !imageInside())
+        setCursor(Qt::OpenHandCursor);
+    else
+        unsetCursor();
 }
 
-void DkBaseViewPort::setBackgroundBrush(const QBrush &brush) {
-
-	QGraphicsView::setBackgroundBrush(brush);
+void DkBaseViewPort::setBackgroundBrush(const QBrush &brush)
+{
+    QGraphicsView::setBackgroundBrush(brush);
 }
 
-void DkBaseViewPort::scrollHorizontally(int val) {
-	moveView(QPointF(-val / mWorldMatrix.m11(), 0.0f));
+void DkBaseViewPort::scrollHorizontally(int val)
+{
+    moveView(QPointF(-val / mWorldMatrix.m11(), 0.0f));
 }
 
-void DkBaseViewPort::scrollVertically(int val) {
-	moveView(QPointF(0.0f, -val/mWorldMatrix.m11()));
+void DkBaseViewPort::scrollVertically(int val)
+{
+    moveView(QPointF(0.0f, -val / mWorldMatrix.m11()));
 }
 
 // Anna's first text:
-//gcfbxxxxxxxxxxxbxbbbcx
-//tggbeeeeeeeeeeecddddeebljlljl�
+// gcfbxxxxxxxxxxxbxbbbcx
+// tggbeeeeeeeeeeecddddeebljlljl�
 //
 //
-//rr45�[, mgd     7re � 8n484welkmsclsdmvcdsm wr., bpodsa0][gb b c
+// rr45�[, mgd     7re � 8n484welkmsclsdmvcdsm wr., bpodsa0][gb b c
 
 }
diff --git a/ImageLounge/src/DkCore/DkBaseViewPort.h b/ImageLounge/src/DkCore/DkBaseViewPort.h
index 86a77f4..22ba89f 100644
--- a/ImageLounge/src/DkCore/DkBaseViewPort.h
+++ b/ImageLounge/src/DkCore/DkBaseViewPort.h
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkBaseViewPort.h
  Created on:	03.07.2013
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -27,11 +27,11 @@
 
 #pragma once
 
-#pragma warning(push, 0)	// no warnings from includes - begin
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QGraphicsView>
-#pragma warning(pop)	// no warnings from includes - end
+#pragma warning(pop) // no warnings from includes - end
 
-#pragma warning(disable: 4251)	// TODO: remove
+#pragma warning(disable : 4251) // TODO: remove
 
 #include "DkImageStorage.h"
 #include "DkSettings.h"
@@ -52,162 +52,159 @@ class QShortcut;
 class QSvgRenderer;
 class QSettings;
 
-namespace nmc {
-
-class DllCoreExport DkBaseViewPort : public QGraphicsView {
-	Q_OBJECT
+namespace nmc
+{
+class DllCoreExport DkBaseViewPort : public QGraphicsView
+{
+    Q_OBJECT
 
 public:
-	
-	enum swipes{
-		no_swipe = 0, // dummy for now
-		next_image,
-		prev_image,
-		open_thumbs,
-		close_thumbs,
-		open_metadata,
-		close_metadata,
-		
-		swipes_end
-	};
-		
-	DkBaseViewPort(QWidget *parent = 0);
-	virtual ~DkBaseViewPort();
-
-	void zoomConstraints(double minZoom = 0.01, double maxZoom = 100.0);
-	virtual void zoom(double factor = 0.5, const QPointF& center = QPointF(-1,-1), bool force = false);
-	virtual void zoomLeveled(double factor = 0.5, const QPointF& center = QPointF(-1, -1));
-	
-	void setForceFastRendering(bool fastRendering = true) {
-		mForceFastRendering = fastRendering;
-	};
-	
-	/**
-	 * Returns the scale factor for 100%.
-	 * Note this factor is only valid for the current image.
-	 * @return float 
-	 **/ 
-	float get100Factor() {
-		
-		updateImageMatrix();
-		return 1.0f/(float)mImgMatrix.m11();
-	};
-
-	void setPanControl(QPointF panControl) {
-		mPanControl = panControl;
-	};
-	
-	virtual QTransform getWorldMatrix() { 
-		return mWorldMatrix;
-	};
-	virtual QRect getMainGeometry() {
-		return geometry();
-	};
-
-	QImage getCurrentImageRegion();
-
-	virtual DkImageStorage* getImageStorage() {
-		return &mImgStorage;
-	};
+    enum swipes {
+        no_swipe = 0, // dummy for now
+        next_image,
+        prev_image,
+        open_thumbs,
+        close_thumbs,
+        open_metadata,
+        close_metadata,
+
+        swipes_end
+    };
+
+    DkBaseViewPort(QWidget *parent = 0);
+    virtual ~DkBaseViewPort();
+
+    void zoomConstraints(double minZoom = 0.01, double maxZoom = 100.0);
+    virtual void zoom(double factor = 0.5, const QPointF &center = QPointF(-1, -1), bool force = false);
+    virtual void zoomLeveled(double factor = 0.5, const QPointF &center = QPointF(-1, -1));
+
+    void setForceFastRendering(bool fastRendering = true)
+    {
+        mForceFastRendering = fastRendering;
+    };
+
+    /**
+     * Returns the scale factor for 100%.
+     * Note this factor is only valid for the current image.
+     * @return float
+     **/
+    float get100Factor()
+    {
+        updateImageMatrix();
+        return 1.0f / (float)mImgMatrix.m11();
+    };
+
+    void setPanControl(QPointF panControl)
+    {
+        mPanControl = panControl;
+    };
+
+    virtual QTransform getWorldMatrix()
+    {
+        return mWorldMatrix;
+    };
+    virtual QRect getMainGeometry()
+    {
+        return geometry();
+    };
+
+    QImage getCurrentImageRegion();
+
+    virtual DkImageStorage *getImageStorage()
+    {
+        return &mImgStorage;
+    };
 
 #ifdef WITH_OPENCV
-	virtual void setImage(cv::Mat newImg);
+    virtual void setImage(cv::Mat newImg);
 #endif
 
-	virtual QImage getImage() const;
-	virtual QSize getImageSize() const;
-	virtual QRectF getImageViewRect() const;
-	virtual bool imageInside() const;
+    virtual QImage getImage() const;
+    virtual QSize getImageSize() const;
+    virtual QRectF getImageViewRect() const;
+    virtual bool imageInside() const;
 
 signals:
-	void newImageSignal(QImage* img) const;
-	void keyReleaseSignal(QKeyEvent* event) const;	// make key presses available
-	void imageUpdated() const;	// triggers on zoom/pan
+    void newImageSignal(QImage *img) const;
+    void keyReleaseSignal(QKeyEvent *event) const; // make key presses available
+    void imageUpdated() const; // triggers on zoom/pan
 
 public slots:
-	virtual void togglePattern(bool show);
-	virtual void panLeft();
-	virtual void panRight();
-	virtual void panUp();
-	virtual void panDown();
-	virtual void moveView(const QPointF&);
-	virtual void zoomIn();
-	virtual void zoomOut();
-	virtual void resetView();
-	virtual void fullView();
-	virtual void resizeEvent(QResizeEvent* event) override;
-	virtual void stopBlockZooming();
-	virtual void setBackgroundBrush(const QBrush &brush);
-	void scrollVertically(int val);
-	void scrollHorizontally(int val);
-
-	virtual bool unloadImage(bool fileChange = true);
-	virtual void setImage(QImage newImg);
-	void hideCursor();
-	
+    virtual void togglePattern(bool show);
+    virtual void panLeft();
+    virtual void panRight();
+    virtual void panUp();
+    virtual void panDown();
+    virtual void moveView(const QPointF &);
+    virtual void zoomIn();
+    virtual void zoomOut();
+    virtual void resetView();
+    virtual void fullView();
+    virtual void resizeEvent(QResizeEvent *event) override;
+    virtual void stopBlockZooming();
+    virtual void setBackgroundBrush(const QBrush &brush);
+    void scrollVertically(int val);
+    void scrollHorizontally(int val);
+
+    virtual bool unloadImage(bool fileChange = true);
+    virtual void setImage(QImage newImg);
+    void hideCursor();
+
 protected:
-	virtual bool event(QEvent *event) override;
-	virtual void keyPressEvent(QKeyEvent *event) override;
-	virtual void keyReleaseEvent(QKeyEvent *event) override;
-	virtual void mousePressEvent(QMouseEvent *event) override;
-	virtual void mouseReleaseEvent(QMouseEvent *event) override;
-	virtual void mouseMoveEvent(QMouseEvent *event) override;
-	virtual void wheelEvent(QWheelEvent *event) override;
-	virtual void mouseDoubleClickEvent(QMouseEvent *event) override;
-	virtual void contextMenuEvent(QContextMenuEvent *event) override;
-	virtual void paintEvent(QPaintEvent* event) override;
-
-	virtual bool gestureEvent(QGestureEvent* event);
-
-	QVector<QShortcut*> mShortcuts;		// TODO: add to actionManager
-
-	Qt::KeyboardModifier mAltMod;		// it makes sense to switch these modifiers on linux (alt + mouse moves windows there)
-	Qt::KeyboardModifier mCtrlMod;
-
-	DkImageStorage mImgStorage;
-	QSharedPointer<QMovie> mMovie;
-	QSharedPointer<QSvgRenderer> mSvg;
-	QBrush mPattern;
-
-	QTransform mImgMatrix;
-	QTransform mWorldMatrix;
-	QRectF mImgViewRect;
-	QRect mViewportRect;
-	QRectF mImgRect;
-	QTimer* mHideCursorTimer;
-
-	QPointF mPanControl;	// controls how far we can pan outside an image
-	QPointF mPosGrab;
-	double mMinZoom = 0.01;
-	double mMaxZoom = 100;
-
-	double mAngle = 0.0;
-	bool mImgWithin = true; // if set to true, the image will always be inside the viewport
-
-	// TODO: test if gestures are fully supported in Qt5 then remove this
-	float mLastZoom;
-	float mStartZoom;
-	int mSwipeGesture;
-
-	bool mForceFastRendering = false;
-	bool mBlockZooming = false;
-	QTimer* mZoomTimer;
-
-	// functions
-	virtual void draw(QPainter & painter, double opacity = 1.0);
-	virtual void drawPattern(QPainter & painter) const;
-	virtual void updateImageMatrix();
-	void resetWorldMatrix();
-	virtual QTransform getScaledImageMatrix() const;
-	virtual QTransform getScaledImageMatrix(const QSize& size, bool center = true) const;
-	virtual void controlImagePosition(const QRect& r = QRect());
-	virtual void centerImage();
-	virtual void changeCursor();
-	void zoomToPoint(double factor, const QPointF& pos, QTransform& matrix) const;
-
-	void rotateTransform(QTransform& t, double angle, const QPointF& c = QPointF()) const;
-
-	QRect controlRect(const QRect& r) const;
+    virtual bool event(QEvent *event) override;
+    virtual void keyPressEvent(QKeyEvent *event) override;
+    virtual void keyReleaseEvent(QKeyEvent *event) override;
+    virtual void mousePressEvent(QMouseEvent *event) override;
+    virtual void mouseReleaseEvent(QMouseEvent *event) override;
+    virtual void mouseMoveEvent(QMouseEvent *event) override;
+    virtual void wheelEvent(QWheelEvent *event) override;
+    virtual void mouseDoubleClickEvent(QMouseEvent *event) override;
+    virtual void contextMenuEvent(QContextMenuEvent *event) override;
+    virtual void paintEvent(QPaintEvent *event) override;
+
+    virtual bool gestureEvent(QGestureEvent *event);
+
+    QVector<QShortcut *> mShortcuts; // TODO: add to actionManager
+
+    Qt::KeyboardModifier mAltMod; // it makes sense to switch these modifiers on linux (alt + mouse moves windows there)
+    Qt::KeyboardModifier mCtrlMod;
+
+    DkImageStorage mImgStorage;
+    QSharedPointer<QMovie> mMovie;
+    QSharedPointer<QSvgRenderer> mSvg;
+    QBrush mPattern;
+
+    QTransform mImgMatrix;
+    QTransform mWorldMatrix;
+    QRectF mImgViewRect;
+    QRectF mViewportRect;
+    QRectF mImgRect;
+    QTimer *mHideCursorTimer;
+
+    QPointF mPanControl; // controls how far we can pan outside an image
+    QPointF mPosGrab;
+    double mMinZoom = 0.01;
+    double mMaxZoom = 100;
+
+    // TODO: test if gestures are fully supported in Qt5 then remove this
+    float mLastZoom;
+    float mStartZoom;
+    int mSwipeGesture;
+
+    bool mForceFastRendering = false;
+    bool mBlockZooming = false;
+    QTimer *mZoomTimer;
+
+    // functions
+    virtual void draw(QPainter &painter, double opacity = 1.0);
+    virtual void drawPattern(QPainter &painter) const;
+    virtual void updateImageMatrix();
+    virtual QTransform getScaledImageMatrix() const;
+    virtual QTransform getScaledImageMatrix(const QSize &size) const;
+    virtual void controlImagePosition(float lb = -1, float ub = -1);
+    virtual void centerImage();
+    virtual void changeCursor();
+    void zoomToPoint(double factor, const QPointF &pos, QTransform &matrix) const;
 };
 
 }
diff --git a/ImageLounge/src/DkCore/DkBasicLoader.cpp b/ImageLounge/src/DkCore/DkBasicLoader.cpp
index 7f9e889..77aa492 100644
--- a/ImageLounge/src/DkCore/DkBasicLoader.cpp
+++ b/ImageLounge/src/DkCore/DkBasicLoader.cpp
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkBasicLoader.cpp
  Created on:	21.02.2014
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2014 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2014 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2014 Florian Kleber <florian@nomacs.org>
@@ -27,41 +27,46 @@
 
 #include "DkBasicLoader.h"
 
-#include "DkMetaData.h"
 #include "DkImageContainer.h"
 #include "DkImageStorage.h"
+#include "DkMath.h"
+#include "DkMetaData.h"
 #include "DkSettings.h"
 #include "DkTimer.h"
-#include "DkMath.h"
-#include "DkUtils.h"	// just needed for qInfo() #ifdef
+#include "DkUtils.h" // just needed for qInfo() #ifdef
 
-#pragma warning(push, 0)        
-#include <QObject>
+#pragma warning(push, 0)
+#include <QBuffer>
+#include <QDebug>
 #include <QFileInfo>
+#include <QIcon>
 #include <QImage>
 #include <QImageReader>
 #include <QImageWriter>
-#include <QNetworkReply>
-#include <QBuffer>
 #include <QNetworkProxyFactory>
+#include <QNetworkReply>
+#include <QObject>
 #include <QPixmap>
-#include <QIcon>
-#include <QDebug>
+#include <QRegularExpression>
 #include <QtConcurrentRun>
 
-#include <qmath.h>
 #include <assert.h>
+#include <qmath.h>
 
 // quazip
 #ifdef WITH_QUAZIP
+#ifdef WITH_QUAZIP1
+#include <quazip/JlCompress.h>
+#else
 #include <quazip5/JlCompress.h>
 #endif
+#endif
 
 // opencv
 #ifdef WITH_OPENCV
 
 #ifdef Q_OS_WIN
-#pragma warning(disable: 4996)
+#pragma warning(disable : 4996)
 #endif
 
 #include "opencv2/core/core.hpp"
@@ -76,361 +81,385 @@
 #include <tif_config.h>
 #endif
 
-//#if defined(Q_OS_MAC) || defined(Q_OS_OPENBSD)
-// here we clash (typedef redefinition with different types ('long' vs 'int64_t' (aka 'long long'))) 
-// so we simply define our own int64 before including tiffio
+// #if defined(Q_OS_MAC) || defined(Q_OS_OPENBSD)
+//  here we clash (typedef redefinition with different types ('long' vs 'int64_t' (aka 'long long')))
+//  so we simply define our own int64 before including tiffio
 #define uint64 uint64_hack_
 #define int64 int64_hack_
-//#endif // defined(Q_OS_MAC) || defined(Q_OS_OPENBSD)
+// #endif // defined(Q_OS_MAC) || defined(Q_OS_OPENBSD)
 
 #include <tiffio.h>
-#include <tiffio.hxx>		// this is needed if you want to load tiffs from the buffer
+#include <tiffio.hxx> // this is needed if you want to load tiffs from the buffer
 
-//#if defined(Q_OS_MAC) || defined(Q_OS_OPENBSD)
+// #if defined(Q_OS_MAC) || defined(Q_OS_OPENBSD)
 #undef uint64
 #undef int64
-//#endif // defined(Q_OS_MAC) || defined(Q_OS_OPENBSD)
+// #endif // defined(Q_OS_MAC) || defined(Q_OS_OPENBSD)
 
-#endif //#ifdef WITH_LIBTIFF
+#endif // #ifdef WITH_LIBTIFF
 
-#endif //#ifdef WITH_OPENCV
+#endif // #ifdef WITH_OPENCV
 
 #ifdef Q_OS_WIN
 #include <olectl.h>
 #pragma comment(lib, "oleaut32.lib")
 
 #include <QtWin>
-#endif //#ifdef Q_OS_WIN
-
+#endif // #ifdef Q_OS_WIN
 
 #pragma warning(pop)
 
-namespace nmc {
-
+namespace nmc
+{
 // DkEditImage --------------------------------------------------------------------
-DkEditImage::DkEditImage(const QImage& img, const QString& editName) {
-	mImg = img;
-	mEditName = editName;
+
+DkEditImage::DkEditImage()
+    : mNewImg(false)
+    , mNewMetaData(false)
+{
+}
+DkEditImage::DkEditImage(const QImage &img, const QSharedPointer<DkMetaDataT> &metaData, const QString &editName)
+    : mImg(img)
+    , mMetaData(metaData)
+    , mEditName(editName)
+    , mNewImg(true)
+    , mNewMetaData(false)
+{
+    // history edit item with modified image
 }
 
-void DkEditImage::setImage(const QImage& img) {
-	mImg = img;
+DkEditImage::DkEditImage(const QSharedPointer<DkMetaDataT> &metaData, const QImage &img, const QString &editName)
+    : mImg(img)
+    , mMetaData(metaData)
+    , mEditName(editName)
+    , mNewImg(false)
+    , mNewMetaData(true)
+{
+    // history edit item with modified metadata
 }
 
-QImage DkEditImage::image() const {
-	return mImg;
+bool DkEditImage::hasImage() const
+{
+    // Every edit item has an image, but it may be the old/original one if only metadata has been edited
+    return !mImg.isNull();
 }
 
-QString DkEditImage::editName() const {
-	return mEditName;
+bool DkEditImage::hasMetaData() const
+{
+    if (mMetaData) {
+        return !mMetaData->isNull();
+    }
+    return false;
 }
 
-int DkEditImage::size() const {
-	
-	return qRound(DkImage::getBufferSizeFloat(mImg.size(), mImg.depth()));
+bool DkEditImage::hasNewImage() const
+{
+    return hasImage() && mNewImg;
 }
 
-// Basic loader and image edit class --------------------------------------------------------------------
-DkBasicLoader::DkBasicLoader(int mode) {
-	
-	mMode = mode;
-	mTraining = false;
-	mPageIdxDirty = false;
-	mNumPages = 1;
-	mPageIdx = 1;
-	mLoader = no_loader;
+bool DkEditImage::hasNewMetaData() const
+{
+    return hasMetaData() && mNewMetaData;
+}
 
-	mMetaData = QSharedPointer<DkMetaDataT>(new DkMetaDataT());
+void DkEditImage::setImage(const QImage &img)
+{
+    mImg = img;
 }
 
-bool DkBasicLoader::loadGeneral(const QString& filePath, bool loadMetaData, bool fast) {
+QImage DkEditImage::image() const
+{
+    return mImg;
+}
 
-	return loadGeneral(filePath, QSharedPointer<QByteArray>(), loadMetaData, fast);
+QSharedPointer<DkMetaDataT> DkEditImage::metaData() const
+{
+    return mMetaData;
+}
+
+QString DkEditImage::editName() const
+{
+    return mEditName;
+}
+
+int DkEditImage::size() const
+{
+    return qRound(DkImage::getBufferSizeFloat(mImg.size(), mImg.depth()));
+}
+
+// Basic loader and image edit class --------------------------------------------------------------------
+DkBasicLoader::DkBasicLoader(int mode)
+{
+    mMode = mode;
+    mTraining = false;
+    mPageIdxDirty = false;
+    mNumPages = 1;
+    mPageIdx = 1;
+    mLoader = no_loader;
+
+    mMetaData = QSharedPointer<DkMetaDataT>(new DkMetaDataT());
+}
+
+bool DkBasicLoader::loadGeneral(const QString &filePath, bool loadMetaData, bool fast)
+{
+    return loadGeneral(filePath, QSharedPointer<QByteArray>(), loadMetaData, fast);
 }
 /**
  * This function loads the images.
  * @param file the image file that should be loaded.
  * @return bool true if the image could be loaded.
- **/ 
-bool DkBasicLoader::loadGeneral(const QString& filePath, QSharedPointer<QByteArray> ba, bool loadMetaData, bool fast) {
-
-	DkTimer dt;
-	bool imgLoaded = false;
-	
-	mFile = DkUtils::resolveSymLink(filePath);
-	QFileInfo fInfo(mFile);	// resolved lnk
-	QString newSuffix = fInfo.suffix();
-
-	release();
-
-	if (mPageIdxDirty)
-		imgLoaded = loadPage();
-
-	// identify raw images:
-	//newSuffix.contains(QRegExp("(nef|crw|cr2|arw|rw2|mrw|dng)", Qt::CaseInsensitive)))
-
-	// this fixes an issue with the new jpg loader
-	// Qt considers an orientation of 0 as wrong and fails to load these jpgs
-	// however, the old nomacs wrote 0 if the orientation should be cleared
-	// so we simply adopt the memory here
-	if (loadMetaData && mMetaData) {
-
-		try {
-			mMetaData->readMetaData(filePath, ba);
-			
-#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
-			// this is a workaroung for old Qt5 versions where jpgs with 'illegal' orientation=0 were not loaded
-			if (!DkSettingsManager::param().metaData().ignoreExifOrientation) {
-				DkMetaDataT::ExifOrientationState orState = mMetaData->checkExifOrientation();
-				
-				if (orState == DkMetaDataT::or_illegal) {
-					mMetaData->clearOrientation();
-					mMetaData->saveMetaData(ba);
-					qWarning() << "deleting illegal EXIV orientation...";
-				}
-			}
-#endif
-		}
-		catch (...) {}	// ignore if we cannot read the metadata
-	}
-	else if (!mMetaData) {
-		qDebug() << "metaData is NULL!";
-	}
+ **/
+bool DkBasicLoader::loadGeneral(const QString &filePath, QSharedPointer<QByteArray> ba, bool loadMetaData, bool fast)
+{
+    DkTimer dt;
+    bool imgLoaded = false;
+
+    mFile = DkUtils::resolveSymLink(filePath);
+    QFileInfo fInfo(mFile); // resolved lnk
+    QString newSuffix = fInfo.suffix();
+
+    release();
+
+    if (mPageIdxDirty)
+        imgLoaded = loadPage();
+
+    // identify raw images:
+    // newSuffix.contains(QRegExp("(nef|crw|cr2|arw|rw2|mrw|dng)", Qt::CaseInsensitive)))
+
+    // this fixes an issue with the new jpg loader
+    // Qt considers an orientation of 0 as wrong and fails to load these jpgs
+    // however, the old nomacs wrote 0 if the orientation should be cleared
+    // so we simply adopt the memory here
+    if (loadMetaData && mMetaData) {
+        try {
+            mMetaData->readMetaData(filePath, ba);
+        } catch (...) {
+        } // ignore if we cannot read the metadata
+    } else if (!mMetaData) {
+        qDebug() << "metaData is NULL!";
+    }
 
-	QList<QByteArray> qtFormats = QImageReader::supportedImageFormats();
-	qtFormats << "jpe";	// fixes #435 - thumbnail gets loaded in the RAW loader
-	QString suf = fInfo.suffix().toLower();
+    QList<QByteArray> qtFormats = QImageReader::supportedImageFormats();
+    qtFormats << "jpe"; // fixes #435 - thumbnail gets loaded in the RAW loader
+    QString suf = fInfo.suffix().toLower();
 
-	QImage img;
+    QImage img;
 
     // load drif file
-    if (!imgLoaded && ("drif" == suf || "yuv" == suf || "raw" == suf)) 
+    if (!imgLoaded && ("drif" == suf || "yuv" == suf || "raw" == suf))
         imgLoaded = loadDrifFile(mFile, img, ba);
 
-	if (!imgLoaded && !fInfo.exists() && ba && !ba->isEmpty()) {
-		imgLoaded = img.loadFromData(*ba.data());
-
-		if (imgLoaded)
-			mLoader = qt_loader;
-	}
-
-	// load large icons
-	if (!imgLoaded && suf == "ico") {
-
-		QIcon icon(mFile);
-
-		if (!icon.isNull()) {
-			img = icon.pixmap(QSize(256, 256)).toImage();
-			imgLoaded = true;
-		}
-	}
-
-	// default Qt loader
-	// here we just try those formats that are officially supported
-	if (!imgLoaded && qtFormats.contains(suf.toStdString().c_str()) || suf.isEmpty()) {
-
-		// if image has Indexed8 + alpha channel -> we crash... sorry for that
-		if (!ba || ba->isEmpty())
-			imgLoaded = img.load(mFile, suf.toStdString().c_str());
-		else
-			imgLoaded = img.loadFromData(*ba.data(), suf.toStdString().c_str());	// toStdString() in order get 1 byte per char
-
-		if (imgLoaded) mLoader = qt_loader;
-	}
+    if (!imgLoaded && !fInfo.exists() && ba && !ba->isEmpty()) {
+        imgLoaded = img.loadFromData(*ba.data());
 
-	// OpenCV Tiff loader - supports jpg compressed tiffs
-	if (!imgLoaded && newSuffix.contains(QRegExp("(tif|tiff)", Qt::CaseInsensitive))) {
-
-		imgLoaded = loadTIFFile(mFile, img, ba);
-		
-		if (imgLoaded)	mLoader = tif_loader;
-	}
-
-	// PSD loader
-	if (!imgLoaded) {
-
-		imgLoaded = loadPSDFile(mFile, img, ba);
-		if (imgLoaded) mLoader = psd_loader;
-	}
-
-#if QT_VERSION < 0x050000	// >DIR: qt5 ships with webp : ) [23.4.2015 markus]
-	// WEBP loader
-	if (!imgLoaded) {
+        if (imgLoaded)
+            mLoader = qt_loader;
+    }
 
-		imgLoaded = loadWebPFile(file, ba);
-		if (imgLoaded) loader = webp_loader;
-	}
-#endif
+    // load large icons
+    if (!imgLoaded && suf == "ico") {
+        QIcon icon(mFile);
 
-	// RAW loader
-	if (!imgLoaded && !qtFormats.contains(suf.toStdString().c_str())) {
-		
-		// TODO: sometimes (e.g. _DSC6289.tif) strange opencv errors are thrown - catch them!
-		// load raw files
-		imgLoaded = loadRawFile(mFile, img, ba, fast);
-		if (imgLoaded) mLoader = raw_loader;
-	}
+        if (!icon.isNull()) {
+            img = icon.pixmap(QSize(256, 256)).toImage();
+            imgLoaded = true;
+        }
+    }
 
-	// TGA loader
-	if (!imgLoaded && newSuffix.contains(QRegExp("(tga)", Qt::CaseInsensitive))) {
+    // default Qt loader
+    // here we just try those formats that are officially supported
+    if (!imgLoaded && qtFormats.contains(suf.toStdString().c_str()) || suf.isEmpty()) {
+        // if image has Indexed8 + alpha channel -> we crash... sorry for that
+        if (!ba || ba->isEmpty())
+            imgLoaded = img.load(mFile, suf.toStdString().c_str());
+        else
+            imgLoaded = img.loadFromData(*ba.data(), suf.toStdString().c_str()); // toStdString() in order get 1 byte per char
+
+        if (imgLoaded)
+            mLoader = qt_loader;
+    }
 
-		imgLoaded = loadTgaFile(mFile, img, ba);
+    // OpenCV Tiff loader - supports jpg compressed tiffs
+    if (!imgLoaded && newSuffix.contains(QRegularExpression("(tif|tiff)", QRegularExpression::CaseInsensitiveOption))) {
+        imgLoaded = loadTIFFile(mFile, img, ba);
 
-		if (imgLoaded) mLoader = tga_loader;		// TODO: add tga loader
-	}
+        if (imgLoaded)
+            mLoader = tif_loader;
+    }
 
-	QByteArray lba;
+    // PSD loader
+    if (!imgLoaded) {
+        imgLoaded = loadPSDFile(mFile, img, ba);
+        if (imgLoaded)
+            mLoader = psd_loader;
+    }
 
-	// default Qt loader
-	if (!imgLoaded && !newSuffix.contains(QRegExp("(roh)", Qt::CaseInsensitive))) {
+    // RAW loader
+    if (!imgLoaded && !qtFormats.contains(suf.toStdString().c_str())) {
+        // TODO: sometimes (e.g. _DSC6289.tif) strange opencv errors are thrown - catch them!
+        // load raw files
+        imgLoaded = loadRawFile(mFile, img, ba, fast);
+        if (imgLoaded)
+            mLoader = raw_loader;
+    }
 
-		// if we first load files to buffers, we can additionally load images with wrong extensions (rainer bugfix : )
-		// TODO: add warning here
-		loadFileToBuffer(mFile, lba);
-		imgLoaded = img.loadFromData(lba);
-		
-		if (imgLoaded)
-			qWarning() << "The image seems to have a wrong extension";
-		
-		if (imgLoaded) mLoader = qt_loader;
-	} 
+    // TGA loader
+    if (!imgLoaded && newSuffix.contains(QRegularExpression("(tga)", QRegularExpression::CaseInsensitiveOption))) {
+        imgLoaded = loadTgaFile(mFile, img, ba);
 
-	// add marker to fix broken panorama images from SAMSUNG
-	// see: https://github.com/nomacs/nomacs/issues/254
-	if (!imgLoaded && newSuffix.contains(QRegExp("(jpg|jpeg|jpe)", Qt::CaseInsensitive))) {
+        if (imgLoaded)
+            mLoader = tga_loader; // TODO: add tga loader
+    }
 
-		// prefer external buffer
-		QByteArray baf = DkImage::fixSamsungPanorama(ba && !ba->isEmpty() ? *ba : lba);
+    QByteArray lba;
 
-		if (!baf.isEmpty())
-			imgLoaded = img.loadFromData(baf, suf.toStdString().c_str());
+    // default Qt loader
+    if (!imgLoaded && !newSuffix.contains(QRegularExpression("(roh)", QRegularExpression::CaseInsensitiveOption))) {
+        // if we first load files to buffers, we can additionally load images with wrong extensions (rainer bugfix : )
+        // TODO: add warning here
+        loadFileToBuffer(mFile, lba);
+        imgLoaded = img.loadFromData(lba);
 
-		if (imgLoaded) mLoader = qt_loader;
-	}
+        if (imgLoaded)
+            qWarning() << "The image seems to have a wrong extension";
 
-	// this loader is a bit buggy -> be carefull
-	if (!imgLoaded && newSuffix.contains(QRegExp("(roh)", Qt::CaseInsensitive))) {
-		
-		imgLoaded = loadRohFile(mFile, img, ba);
-		if (imgLoaded) mLoader = roh_loader;
-	} 
+        if (imgLoaded)
+            mLoader = qt_loader;
+    }
 
-	// this loader is for OpenCV cascade training files
-	if (!imgLoaded && newSuffix.contains(QRegExp("(vec)", Qt::CaseInsensitive))) {
+    // add marker to fix broken panorama images from SAMSUNG
+    // see: https://github.com/nomacs/nomacs/issues/254
+    if (!imgLoaded && newSuffix.contains(QRegularExpression("(jpg|jpeg|jpe)", QRegularExpression::CaseInsensitiveOption))) {
+        // prefer external buffer
+        QByteArray baf = DkImage::fixSamsungPanorama(ba && !ba->isEmpty() ? *ba : lba);
 
-		imgLoaded = loadOpenCVVecFile(mFile, img, ba);
-		if (imgLoaded) mLoader = roh_loader;
-	} 
+        if (!baf.isEmpty())
+            imgLoaded = img.loadFromData(baf, suf.toStdString().c_str());
 
-	// tiff things
-	if (imgLoaded && !mPageIdxDirty)
-		indexPages(mFile, ba);
-	mPageIdxDirty = false;
+        if (imgLoaded)
+            mLoader = qt_loader;
+    }
 
-	if (imgLoaded && loadMetaData && mMetaData) {
-		
-		try {
-			mMetaData->setQtValues(img);
-			int orientation = mMetaData->getOrientationDegree();
+    // this loader is a bit buggy -> be carefull
+    if (!imgLoaded && newSuffix.contains(QRegularExpression("(roh)", QRegularExpression::CaseInsensitiveOption))) {
+        imgLoaded = loadRohFile(mFile, img, ba);
+        if (imgLoaded)
+            mLoader = roh_loader;
+    }
 
-			if (orientation != -1 && !mMetaData->isTiff() && !DkSettingsManager::param().metaData().ignoreExifOrientation)
-				img = DkImage::rotate(img, orientation);
+    // this loader is for OpenCV cascade training files
+    if (!imgLoaded && newSuffix.contains(QRegularExpression("(vec)", QRegularExpression::CaseInsensitiveOption))) {
+        imgLoaded = loadOpenCVVecFile(mFile, img, ba);
+        if (imgLoaded)
+            mLoader = roh_loader;
+    }
 
-		} catch(...) {}	// ignore if we cannot read the metadata
-	}
-	else if (!mMetaData) {
-		qDebug() << "metaData is NULL!";
-	}
+    // tiff things
+    if (imgLoaded && !mPageIdxDirty)
+        indexPages(mFile, ba);
+    mPageIdxDirty = false;
+
+    if (imgLoaded && loadMetaData && mMetaData) {
+        try {
+            mMetaData->setQtValues(img);
+            int orientation = mMetaData->getOrientationDegree();
+
+            if (orientation != -1 && !mMetaData->isTiff() && !mMetaData->isAVIF() && !mMetaData->isHEIF() && !mMetaData->isJXL()
+                && !DkSettingsManager::param().metaData().ignoreExifOrientation) {
+                img = DkImage::rotateImage(img, orientation);
+            }
+
+        } catch (...) {
+        } // ignore if we cannot read the metadata
+    } else if (!mMetaData) {
+        qDebug() << "metaData is NULL!";
+    }
 
-	if (imgLoaded)
-		setEditImage(img, tr("Original Image"));
+    if (imgLoaded)
+        setEditImage(img, tr("Original Image"));
 
-	if (imgLoaded)
-		qInfo() << "[Basic Loader]" << filePath << "loaded in" << dt;
-	else
-		qWarning() << "[Basic Loader] could not load" << filePath;
+    if (imgLoaded)
+        qInfo() << "[Basic Loader]" << filePath << "loaded in" << dt;
+    else
+        qWarning() << "[Basic Loader] could not load" << filePath;
 
-	return imgLoaded;
+    return imgLoaded;
 }
 
 /**
  * Loads special RAW files that are generated by the Hamamatsu camera.
  * @param fileName the filename of the file to be loaded.
  * @return bool true if the file could be loaded.
- **/ 
-bool DkBasicLoader::loadRohFile(const QString& filePath, QImage& img, QSharedPointer<QByteArray> ba) const {
-
-	if (!ba)
-		ba = loadFileToBuffer(filePath);
-	if (!ba || ba->isEmpty())
-		return false;
-
-	bool imgLoaded = false;
-
-	int rohW = 4000;
-	int rohH = 2672;
-	unsigned char fByte;	// first byte
-	unsigned char sByte;	// second byte
-
-	try {
-		
-		const unsigned char* pData = (const unsigned char*)ba->constData();
-		unsigned char* buffer = new unsigned char[rohW*rohH];
-
-		if (!buffer)
-			return imgLoaded;
-
-		for (long long i = 0; i < (rohW*rohH); i++){
-		
-			fByte = pData[i*2];
-			sByte = pData[i*2+1];
-			fByte = fByte >> 4;
-			fByte = fByte & 15;
-			sByte = sByte << 4;
-			sByte = sByte & 240;
-
-			buffer[i] = (fByte | sByte);
-		
-		}
+ **/
+bool DkBasicLoader::loadRohFile(const QString &filePath, QImage &img, QSharedPointer<QByteArray> ba) const
+{
+    if (!ba)
+        ba = loadFileToBuffer(filePath);
+    if (!ba || ba->isEmpty())
+        return false;
+
+    bool imgLoaded = false;
+
+    int rohW = 4000;
+    int rohH = 2672;
+    unsigned char fByte; // first byte
+    unsigned char sByte; // second byte
+
+    try {
+        const unsigned char *pData = (const unsigned char *)ba->constData();
+        unsigned char *buffer = new unsigned char[rohW * rohH];
+
+        if (!buffer)
+            return imgLoaded;
+
+        for (long long i = 0; i < (rohW * rohH); i++) {
+            fByte = pData[i * 2];
+            sByte = pData[i * 2 + 1];
+            fByte = fByte >> 4;
+            fByte = fByte & 15;
+            sByte = sByte << 4;
+            sByte = sByte & 240;
+
+            buffer[i] = (fByte | sByte);
+        }
 
-		img = QImage(buffer, rohW, rohH, QImage::Format_Indexed8);
+        img = QImage(buffer, rohW, rohH, QImage::Format_Indexed8);
 
-		if (img.isNull())
-			return imgLoaded;
-		else
-			imgLoaded = true;
+        if (img.isNull())
+            return imgLoaded;
+        else
+            imgLoaded = true;
 
+        // img = img.copy();
+        QVector<QRgb> colorTable;
 
-		//img = img.copy();
-		QVector<QRgb> colorTable;
+        for (int i = 0; i < 256; i++)
+            colorTable.push_back(QColor(i, i, i).rgb());
 
-		for (int i = 0; i < 256; i++)
-			colorTable.push_back(QColor(i, i, i).rgb());
-		
-		img.setColorTable(colorTable);
+        img.setColorTable(colorTable);
 
-	} catch(...) {
-		imgLoaded = false;
-	}
+    } catch (...) {
+        imgLoaded = false;
+    }
 
-	//if (imgLoaded) {
-	//	setEditImage(img, tr("Original Image"));
-	//}
+    // if (imgLoaded) {
+    //	setEditImage(img, tr("Original Image"));
+    //}
 
-	return imgLoaded;
+    return imgLoaded;
 }
 
-bool nmc::DkBasicLoader::loadTgaFile(const QString & filePath, QImage & img, QSharedPointer<QByteArray> ba) const {
-	
-	if (!ba || ba->isEmpty())
-		ba = loadFileToBuffer(filePath);
+bool nmc::DkBasicLoader::loadTgaFile(const QString &filePath, QImage &img, QSharedPointer<QByteArray> ba) const
+{
+    if (!ba || ba->isEmpty())
+        ba = loadFileToBuffer(filePath);
 
-	tga::DkTgaLoader tl = tga::DkTgaLoader(ba);
+    tga::DkTgaLoader tl = tga::DkTgaLoader(ba);
 
-	bool success = tl.load();
-	img = tl.image();
+    bool success = tl.load();
+    img = tl.image();
 
-	return success;
+    return success;
 }
 
 /**
@@ -439,133 +468,132 @@ bool nmc::DkBasicLoader::loadTgaFile(const QString & filePath, QImage & img, QSh
  * order to enable RAW file loading.
  * @param ba the file loaded into a bytearray.
  * @return bool true if the file could be loaded.
- **/ 
-bool DkBasicLoader::loadRawFile(const QString& filePath, QImage& img, QSharedPointer<QByteArray> ba, bool fast) const {
-	
-	DkRawLoader rawLoader(filePath, mMetaData);
-	rawLoader.setLoadFast(fast);
+ **/
+bool DkBasicLoader::loadRawFile(const QString &filePath, QImage &img, QSharedPointer<QByteArray> ba, bool fast) const
+{
+    DkRawLoader rawLoader(filePath, mMetaData);
+    rawLoader.setLoadFast(fast);
 
-	bool success = rawLoader.load(ba);
+    bool success = rawLoader.load(ba);
 
-	if (success)
-		img = rawLoader.image();
+    if (success)
+        img = rawLoader.image();
 
-	return success;
+    return success;
 }
 
 #ifdef Q_OS_WIN
-bool DkBasicLoader::loadPSDFile(const QString&, QImage&, QSharedPointer<QByteArray>) const {
+bool DkBasicLoader::loadPSDFile(const QString &, QImage &, QSharedPointer<QByteArray>) const
+{
 #else
-bool DkBasicLoader::loadPSDFile(const QString& filePath, QImage& img, QSharedPointer<QByteArray> ba) const {
-
-	// load from file?
-	if (!ba || ba->isEmpty()) {
-		QFile file(filePath);
-		file.open(QIODevice::ReadOnly);
-
-		QPsdHandler psdHandler;
-		psdHandler.setDevice(&file);	// QFile is an IODevice
-		//psdHandler.setFormat(fileInfo.suffix().toLocal8Bit());
-
-		if (psdHandler.canRead(&file)) {
-			bool success = psdHandler.read(&img);
-			//setEditImage(img, tr("Original Image"));
-			
-			return success;
-		}
-	}
-	else {
-	
-		QBuffer buffer;
-		buffer.setData(*ba.data());
-		buffer.open(QIODevice::ReadOnly);
-
-		QPsdHandler psdHandler;
-		psdHandler.setDevice(&buffer);	// QFile is an IODevice
-		//psdHandler.setFormat(file.suffix().toLocal8Bit());
-
-		if (psdHandler.canRead(&buffer)) {
-			bool success = psdHandler.read(&img);
-			//setEditImage(img, tr("Original Image"));
-
-			return success;
-		}
-	}
+bool DkBasicLoader::loadPSDFile(const QString &filePath, QImage &img, QSharedPointer<QByteArray> ba) const
+{
+    // load from file?
+    if (!ba || ba->isEmpty()) {
+        QFile file(filePath);
+        file.open(QIODevice::ReadOnly);
+
+        QPsdHandler psdHandler;
+        psdHandler.setDevice(&file); // QFile is an IODevice
+        // psdHandler.setFormat(fileInfo.suffix().toLocal8Bit());
+
+        if (psdHandler.canRead(&file)) {
+            bool success = psdHandler.read(&img);
+            // setEditImage(img, tr("Original Image"));
+
+            return success;
+        }
+    } else {
+        QBuffer buffer;
+        buffer.setData(*ba.data());
+        buffer.open(QIODevice::ReadOnly);
+
+        QPsdHandler psdHandler;
+        psdHandler.setDevice(&buffer); // QFile is an IODevice
+        // psdHandler.setFormat(file.suffix().toLocal8Bit());
+
+        if (psdHandler.canRead(&buffer)) {
+            bool success = psdHandler.read(&img);
+            // setEditImage(img, tr("Original Image"));
+
+            return success;
+        }
+    }
 
 #endif // !Q_OS_WIN
-	return false;
+    return false;
 }
 
 #ifndef WITH_LIBTIFF
-bool DkBasicLoader::loadTIFFile(const QString&, QImage&, QSharedPointer<QByteArray>) const {
+bool DkBasicLoader::loadTIFFile(const QString &, QImage &, QSharedPointer<QByteArray>) const
+{
 #else
-bool DkBasicLoader::loadTIFFile(const QString& filePath, QImage& img, QSharedPointer<QByteArray> ba) const {
-
-	bool success = false;
-
-	// first turn off nasty warning/error dialogs - (we do the GUI : )
-	TIFFErrorHandler oldErrorHandler, oldWarningHandler;
-	oldWarningHandler = TIFFSetWarningHandler(NULL);
-	oldErrorHandler = TIFFSetErrorHandler(NULL);
+bool DkBasicLoader::loadTIFFile(const QString &filePath, QImage &img, QSharedPointer<QByteArray> ba) const
+{
+    bool success = false;
 
-	DkTimer dt;
-	TIFF* tiff = 0;
+    // first turn off nasty warning/error dialogs - (we do the GUI : )
+    TIFFErrorHandler oldErrorHandler, oldWarningHandler;
+    oldWarningHandler = TIFFSetWarningHandler(NULL);
+    oldErrorHandler = TIFFSetErrorHandler(NULL);
 
+    DkTimer dt;
+    TIFF *tiff = 0;
 
 // TODO: currently TIFFStreamOpen can only be linked on Windows?!
-#if QT_VERSION >= QT_VERSION_CHECK(5,5,0) && defined(Q_OS_WIN)
+#if defined(Q_OS_WIN)
 
-	std::istringstream is(ba ? ba->toStdString() : "");
+    std::istringstream is(ba ? ba->toStdString() : "");
 
-	if (ba) 
-		tiff = TIFFStreamOpen("MemTIFF", &is);
+    if (ba)
+        tiff = TIFFStreamOpen("MemTIFF", &is);
 
-	// fallback to direct loading
-	if (!tiff)
-		tiff = TIFFOpen(filePath.toLatin1(), "r");
+    // fallback to direct loading
+    if (!tiff)
+        tiff = TIFFOpen(filePath.toLatin1(), "r");
 
-	// loading from buffer allows us to load files with non-latin names
-	QSharedPointer<QByteArray> bal;
-	if (!tiff)
-		bal = loadFileToBuffer(filePath);
+    // loading from buffer allows us to load files with non-latin names
+    QSharedPointer<QByteArray> bal;
+    if (!tiff)
+        bal = loadFileToBuffer(filePath);
 
-	std::istringstream isl(bal ? bal->toStdString() : "");
+    std::istringstream isl(bal ? bal->toStdString() : "");
 
-	if (bal)
-		tiff = TIFFStreamOpen("MemTIFF", &isl);
+    if (bal)
+        tiff = TIFFStreamOpen("MemTIFF", &isl);
 #else
-	tiff = TIFFOpen(filePath.toLatin1(), "r");
+    tiff = TIFFOpen(filePath.toLatin1(), "r");
 #endif
 
-	if (!tiff)
-		return success;
+    if (!tiff)
+        return success;
 
-	uint32 width = 0;
-	uint32 height = 0;
+    uint32 width = 0;
+    uint32 height = 0;
 
-	TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &width);
-	TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &height);
+    TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &width);
+    TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &height);
 
-	// init the qImage
-	img = QImage(width, height, QImage::Format_ARGB32);
+    // init the qImage
+    img = QImage(width, height, QImage::Format_ARGB32);
 
-	const int stopOnError = 1;
-	success = TIFFReadRGBAImageOriented(tiff, width, height, reinterpret_cast<uint32 *>(img.bits()), ORIENTATION_TOPLEFT, stopOnError) != 0;
+    const int stopOnError = 1;
+    success = TIFFReadRGBAImageOriented(tiff, width, height, reinterpret_cast<uint32 *>(img.bits()), ORIENTATION_TOPLEFT, stopOnError) != 0;
 
-	if (success) {
-		for (uint32 y = 0; y<height; ++y)
-			convert32BitOrder(img.scanLine(y), width);
-	}
+    if (success) {
+        for (uint32 y = 0; y < height; ++y)
+            convert32BitOrder(img.scanLine(y), width);
+    }
 
-	TIFFClose(tiff);
+    TIFFClose(tiff);
 
-	TIFFSetWarningHandler(oldWarningHandler);
-	TIFFSetWarningHandler(oldErrorHandler);
+    TIFFSetWarningHandler(oldWarningHandler);
+    TIFFSetWarningHandler(oldErrorHandler);
 
-	return success;
+    return success;
 
 #endif // !WITH_LIBTIFF
-	return false;
+    return false;
 }
 
 #define DRIF_IMAGE_IMPL
@@ -573,8 +601,7 @@ bool DkBasicLoader::loadTIFFile(const QString& filePath, QImage& img, QSharedPoi
 
 bool isQtFmtCompatible(uint32_t f)
 {
-    switch (f)
-    {
+    switch (f) {
     case DRIF_FMT_RGB888:
     case DRIF_FMT_RGBA8888:
     case DRIF_FMT_GRAY:
@@ -586,1896 +613,2025 @@ bool isQtFmtCompatible(uint32_t f)
 
 uint32_t drif2qtfmt(uint32_t f)
 {
-    switch (f)
-    {
-    case DRIF_FMT_RGB888:  return QImage::Format_RGB888;
-    case DRIF_FMT_RGBA8888:  return QImage::Format_RGBA8888;
-
-	// grayscale 8 was added in Qt 5.4
-#if QT_VERSION >= 0x050500
-	case DRIF_FMT_GRAY:  return QImage::Format_Grayscale8;
-#endif
-
+    switch (f) {
+    case DRIF_FMT_RGB888:
+        return QImage::Format_RGB888;
+    case DRIF_FMT_RGBA8888:
+        return QImage::Format_RGBA8888;
+    case DRIF_FMT_GRAY:
+        return QImage::Format_Grayscale8;
     }
 
     return QImage::Format_Invalid;
 }
 
-bool DkBasicLoader::loadDrifFile(const QString& filePath, QImage& img, QSharedPointer<QByteArray> ba) const {
-
+bool DkBasicLoader::loadDrifFile(const QString &filePath, QImage &img, QSharedPointer<QByteArray> ba) const
+{
     bool success = false;
 
     uint32_t w;
     uint32_t h;
     uint32_t f;
 
-    uint8_t* imgBytes = drifLoadImg(filePath.toLatin1(), &w, &h, &f);
+    uint8_t *imgBytes = drifLoadImg(filePath.toLatin1(), &w, &h, &f);
 
     if (!imgBytes)
         return success;
-    
-    if (isQtFmtCompatible(f))
-    {
+
+    if (isQtFmtCompatible(f)) {
         img = QImage((int)w, (int)h, (QImage::Format)drif2qtfmt(f));
-        memcpy(reinterpret_cast<void*>(img.bits()), imgBytes, drifGetSize(w, h, f));
+        memcpy(reinterpret_cast<void *>(img.bits()), imgBytes, drifGetSize(w, h, f));
 
         success = true;
     }
 #ifdef WITH_OPENCV
-    else
-    {
+    else {
         img = QImage((int)w, (int)h, QImage::Format_RGB888);
 
-        switch (f)
-        {
-        case DRIF_FMT_BGR888:
-        {
+        switch (f) {
+        case DRIF_FMT_BGR888: {
             cv::Mat imgMat = cv::Mat((int)h, (int)w, CV_8UC3, imgBytes);
-            cv::Mat rgbMat = cv::Mat((int)h, (int)w, CV_8UC3, reinterpret_cast<uint8_t*>(img.bits()));
+            cv::Mat rgbMat = cv::Mat((int)h, (int)w, CV_8UC3, reinterpret_cast<uint8_t *>(img.bits()));
             cv::cvtColor(imgMat, rgbMat, CV_BGR2RGB);
 
             success = true;
-        }
-        break;
+        } break;
 
         case DRIF_FMT_RGB888P:
-        case DRIF_FMT_RGBA8888P:
-        {
+        case DRIF_FMT_RGBA8888P: {
             cv::Mat imgMatR = cv::Mat((int)h, (int)w, CV_8UC1, imgBytes);
             cv::Mat imgMatG = cv::Mat((int)h, (int)w, CV_8UC1, imgBytes + w * h);
             cv::Mat imgMatB = cv::Mat((int)h, (int)w, CV_8UC1, imgBytes + 2 * w * h);
-            cv::Mat rgbMat  = cv::Mat((int)h, (int)w, CV_8UC3, reinterpret_cast<uint8_t*>(img.bits()));
-            
-            std::vector<cv::Mat> imgMat{ imgMatR, imgMatG, imgMatB };
+            cv::Mat rgbMat = cv::Mat((int)h, (int)w, CV_8UC3, reinterpret_cast<uint8_t *>(img.bits()));
+
+            std::vector<cv::Mat> imgMat{imgMatR, imgMatG, imgMatB};
             cv::merge(imgMat, rgbMat);
 
             success = true;
-        }
-        break;
+        } break;
 
         case DRIF_FMT_BGR888P:
-        case DRIF_FMT_BGRA8888P:
-        {
+        case DRIF_FMT_BGRA8888P: {
             cv::Mat imgMatB = cv::Mat((int)h, (int)w, CV_8UC1, imgBytes);
             cv::Mat imgMatG = cv::Mat((int)h, (int)w, CV_8UC1, imgBytes + w * h);
             cv::Mat imgMatR = cv::Mat((int)h, (int)w, CV_8UC1, imgBytes + 2 * w * h);
-            cv::Mat rgbMat  = cv::Mat((int)h, (int)w, CV_8UC3, reinterpret_cast<uint8_t*>(img.bits()));
+            cv::Mat rgbMat = cv::Mat((int)h, (int)w, CV_8UC3, reinterpret_cast<uint8_t *>(img.bits()));
 
-            std::vector<cv::Mat> imgMat{ imgMatR, imgMatG, imgMatB };
+            std::vector<cv::Mat> imgMat{imgMatR, imgMatG, imgMatB};
             cv::merge(imgMat, rgbMat);
 
             success = true;
-        }
-        break;
+        } break;
 
-        case DRIF_FMT_BGRA8888:
-        {
+        case DRIF_FMT_BGRA8888: {
             cv::Mat imgMat = cv::Mat((int)h, (int)w, CV_8UC4, imgBytes);
-            cv::Mat rgbMat = cv::Mat((int)h, (int)w, CV_8UC3, reinterpret_cast<uint8_t*>(img.bits()));
+            cv::Mat rgbMat = cv::Mat((int)h, (int)w, CV_8UC3, reinterpret_cast<uint8_t *>(img.bits()));
             cv::cvtColor(imgMat, rgbMat, CV_BGR2RGB, 3);
 
             success = true;
-        }
-        break;
+        } break;
 
-        case DRIF_FMT_RGBA8888:
-        {
+        case DRIF_FMT_RGBA8888: {
             cv::Mat imgMat = cv::Mat((int)h, (int)w, CV_8UC4, imgBytes);
-            cv::Mat rgbMat = cv::Mat((int)h, (int)w, CV_8UC3, reinterpret_cast<uint8_t*>(img.bits()));
+            cv::Mat rgbMat = cv::Mat((int)h, (int)w, CV_8UC3, reinterpret_cast<uint8_t *>(img.bits()));
             cv::cvtColor(imgMat, rgbMat, CV_RGBA2RGB, 3);
 
             success = true;
-        }
-        break;
+        } break;
 
-        case DRIF_FMT_GRAY:
-        {
+        case DRIF_FMT_GRAY: {
             cv::Mat imgMat = cv::Mat((int)h, (int)w, CV_8UC1, imgBytes);
-            cv::Mat rgbMat = cv::Mat((int)h, (int)w, CV_8UC3, reinterpret_cast<uint8_t*>(img.bits()));
+            cv::Mat rgbMat = cv::Mat((int)h, (int)w, CV_8UC3, reinterpret_cast<uint8_t *>(img.bits()));
             cv::cvtColor(imgMat, rgbMat, CV_GRAY2RGB);
 
             success = true;
-        }
-        break;
+        } break;
 
-        case DRIF_FMT_YUV420P:
-        {
+        case DRIF_FMT_YUV420P: {
             cv::Mat imgMat = cv::Mat((int)h + h / 2, (int)w, CV_8UC1, imgBytes);
-            cv::Mat rgbMat = cv::Mat((int)h, (int)w, CV_8UC3, reinterpret_cast<uint8_t*>(img.bits()));
+            cv::Mat rgbMat = cv::Mat((int)h, (int)w, CV_8UC3, reinterpret_cast<uint8_t *>(img.bits()));
             cv::cvtColor(imgMat, rgbMat, CV_YUV2RGB_I420);
 
             success = true;
-        }
-        break;
+        } break;
 
-        case DRIF_FMT_YVU420P:
-        {
+        case DRIF_FMT_YVU420P: {
             cv::Mat imgMat = cv::Mat((int)h + h / 2, (int)w, CV_8UC1, imgBytes);
-            cv::Mat rgbMat = cv::Mat((int)h, (int)w, CV_8UC3, reinterpret_cast<uint8_t*>(img.bits()));
+            cv::Mat rgbMat = cv::Mat((int)h, (int)w, CV_8UC3, reinterpret_cast<uint8_t *>(img.bits()));
             cv::cvtColor(imgMat, rgbMat, CV_YUV2RGB_YV12);
 
             success = true;
-        }
-        break;
+        } break;
 
-        case DRIF_FMT_NV12:
-        {
+        case DRIF_FMT_NV12: {
             cv::Mat imgMat = cv::Mat((int)h + h / 2, (int)w, CV_8UC1, imgBytes);
-            cv::Mat rgbMat = cv::Mat((int)h, (int)w, CV_8UC3, reinterpret_cast<uint8_t*>(img.bits()));
+            cv::Mat rgbMat = cv::Mat((int)h, (int)w, CV_8UC3, reinterpret_cast<uint8_t *>(img.bits()));
             cv::cvtColor(imgMat, rgbMat, CV_YUV2RGB_NV12);
 
             success = true;
-        }
-        break;
+        } break;
 
-        case DRIF_FMT_NV21:
-        {
+        case DRIF_FMT_NV21: {
             cv::Mat imgMat = cv::Mat((int)h + h / 2, (int)w, CV_8UC1, imgBytes);
-            cv::Mat rgbMat = cv::Mat((int)h, (int)w, CV_8UC3, reinterpret_cast<uint8_t*>(img.bits()));
+            cv::Mat rgbMat = cv::Mat((int)h, (int)w, CV_8UC3, reinterpret_cast<uint8_t *>(img.bits()));
             cv::cvtColor(imgMat, rgbMat, CV_YUV2RGB_NV21);
 
             success = true;
-        }
-        break;
+        } break;
 
         default:
             success = false;
             break;
         }
-       
     }
 #endif
-   
+
     drifFreeImg(imgBytes);
 
     return success;
 }
 
-void DkBasicLoader::setImage(const QImage & img, const QString & editName, const QString & file) {
+void DkBasicLoader::setImage(const QImage &img, const QString &editName, const QString &file)
+{
+    mFile = file;
+    setEditImage(img, editName);
+}
 
-	mFile = file;
-	setEditImage(img, editName);
+void DkBasicLoader::pruneEditHistory()
+{
+    // delete all hidden edit states
+    for (int idx = mImages.size() - 1; idx > mImageIndex; idx--) {
+        mImages.pop_back();
+    }
 }
 
-void DkBasicLoader::setEditImage(const QImage& img, const QString& editName) {
+void DkBasicLoader::setEditImage(const QImage &img, const QString &editName)
+{
+    if (img.isNull())
+        return;
+
+    // delete all hidden edit states
+    pruneEditHistory();
 
-	if (img.isNull())
-		return;
+    // compute new history size
+    int historySize = 0;
+    for (const DkEditImage &e : mImages) {
+        historySize += e.size();
+    }
 
-	// delete all hidden edit states
-	for (int idx = mImages.size() - 1; idx > mImageIndex; idx--) {
-		mImages.pop_back();
-	}
+    // reset exif orientation after image edit
+    if (!mImages.isEmpty())
+        mMetaData->clearOrientation();
+    // new history item with new pixmap (and old or original metadata)
+    DkEditImage newImg(img, mMetaData->copy(), editName); // new image, old/unchanged metadata
 
-	// compute new history size
-	int historySize = 0;
-	for (const DkEditImage& e : mImages) {
-		historySize += e.size();
-	}
+    if (historySize + newImg.size() > DkSettingsManager::param().resources().historyMemory && mImages.size() > mMinHistorySize) {
+        mImages.removeAt(1);
+        qWarning() << "removing history image because it's too large:" << historySize + newImg.size() << "MB";
+    }
 
-	DkEditImage newImg(img, editName);
+    mImages.append(newImg);
+    mImageIndex = mImages.size() - 1; // set the index again to the last
+}
 
-	if (historySize + newImg.size() > DkSettingsManager::param().resources().historyMemory && mImages.size() > mMinHistorySize) {
-		mImages.removeAt(1);
-		qDebug() << "removing history image because it's too large:" << historySize + newImg.size() << "MB";
-	}
+void DkBasicLoader::setEditMetaData(const QSharedPointer<DkMetaDataT> &metaData, const QImage &img, const QString &editName)
+{
+    // delete all hidden edit states
+    pruneEditHistory();
 
-	mImages.append(newImg);
-	mImageIndex = mImages.size() - 1;	// set the index again to the last
+    // not removing second history item if oversized (see setEditImage())
+
+    // new history item with new metadata (and image, but hasNewImage() will be false)
+    DkEditImage newImg(metaData->copy(), img, editName); // new metadata, old/unchanged image
+
+    mImages.append(newImg);
+    mImageIndex = mImages.size() - 1; // set the index again to the last
 }
 
-QImage DkBasicLoader::image() const {
-	
-	if (mImages.empty())
-		return QImage();
+void DkBasicLoader::setEditMetaData(const QSharedPointer<DkMetaDataT> &metaData, const QString &editName)
+{
+    // Add history edit with new metadata (hasMetaData()), copying last or original image
+    QImage lastImg = image(); // copy last edit of pixmap (if any) to new history item
+    setEditMetaData(metaData, lastImg, editName);
+}
 
-	if (mImageIndex > mImages.size() || mImageIndex == -1) {
-		qWarning() << "Illegal image index: " << mImageIndex;
-		return mImages.last().image();
-	}
+void DkBasicLoader::setEditMetaData(const QString &editName)
+{
+    // Add history edit with edited metadata (hasMetaData()), copying last or original image
+    setEditMetaData(mMetaData, image(), editName);
+}
 
-	return mImages[mImageIndex].image();
+QImage DkBasicLoader::lastImage() const
+{
+    // Find and return the last/current version of the image (ready to be saved to disk)
+    // This is initially the first item (the original image) or the last one,
+    // excluding history items with images that only have modified metadata,
+    // for example, after rotating there'd be a history item with the rotated image
+    // but this rotated pixmap is for the gui only, it should not be saved.
+    for (int idx = mImageIndex; idx >= 0; idx--) {
+        if (mImages[idx].hasNewImage()) {
+            return mImages[idx].image();
+        }
+    }
+
+    return QImage();
 }
 
-void DkBasicLoader::undo() {
-	
-	if (mImageIndex > 0)
-		mImageIndex--;
+QImage DkBasicLoader::image() const
+{
+    return pixmap();
+}
+
+QImage DkBasicLoader::pixmap() const
+{
+    // This is sometimes called with an invalid index, for example, after navigating back and forth
+    // if the history has been edited (i.e., > 1 entry). Sometimes, the index is -1 and the history is empty,
+    // which means we have nothing to return (image requested but nothing loaded). (via ViewPort?)
+    if (mImageIndex < 0 || mImageIndex >= mImages.size()) {
+        if (mImages.isEmpty())
+            return QImage();
+        else
+            return mImages.last().image();
+    }
+    // Return current pixmap, which may contain modification from metadata changes like rotation
+    // This should not be used to write the image to disk, use image() instead.
+    return mImages.at(mImageIndex).image();
 }
 
-void DkBasicLoader::redo() {
+/**
+ * @brief Returns the pointer to the current metadata object which belongs to the loaded image.
+ *
+ * Note that this is a pointer, not a copy. After changing the metadata, it's necessary
+ * to call setEditMetaData(), passing an appropriate edit name, to add a history item (will be copied).
+ *
+ * @return QSharedPointer<DkMetaDataT>
+ */
+QSharedPointer<DkMetaDataT> DkBasicLoader::getMetaData() const
+{
+    QSharedPointer<DkMetaDataT> metaData(mMetaData);
+    return metaData;
+};
+
+QSharedPointer<DkMetaDataT> DkBasicLoader::lastMetaDataEdit(bool return_nullptr, bool return_orig) const
+{
+    QSharedPointer<DkMetaDataT> lastEdit; // null edit
+    if (return_orig) {
+        // Return original metadata only if requested (otherwise only return modified metadata)
+        lastEdit = mImages.first().metaData();
+    } else if (!return_nullptr) {
+        // Empty null object will be returned if no history item (with edited metadata) could be found
+        lastEdit = QSharedPointer<DkMetaDataT>(new DkMetaDataT());
+    }
 
-	if (mImageIndex < mImages.size()-1)
-		mImageIndex++;
+    // Get latest modified metadata item from history (or null)
+    for (int idx = mImageIndex; idx > 0; idx--) {
+        if (mImages[idx].hasNewMetaData()) {
+            lastEdit = mImages[idx].metaData();
+            break;
+        }
+    }
+
+    return lastEdit;
 }
 
-QVector<DkEditImage>* DkBasicLoader::history() {
-	return &mImages;
+bool DkBasicLoader::isImageEdited()
+{
+    for (int i = 1, ii = mImageIndex; i <= ii; i++) {
+        if (mImages[i].hasNewImage()) {
+            return true;
+        }
+    }
+    return false;
 }
 
-DkEditImage DkBasicLoader::lastEdit() const {
-	
-	assert(mImageIndex >= 0 && mImageIndex < mImages.size());
-	return mImages[mImageIndex];
+bool DkBasicLoader::isMetaDataEdited()
+{
+    for (int i = 1, ii = mImageIndex; i <= ii; i++) {
+        if (mImages[i].hasNewMetaData()) {
+            return true;
+        }
+    }
+    return false;
 }
 
-int DkBasicLoader::historyIndex() const {
-	return mImageIndex;
+void DkBasicLoader::undo()
+{
+    // Change history index (for image()...)
+    if (mImageIndex > 0)
+        mImageIndex--;
+
+    // Get last history item with modified metadata (up until new history index)
+    QSharedPointer<DkMetaDataT> metaData(mMetaData);
+    metaData = lastMetaDataEdit(false, true);
+    // Update our current metadata object, which is also used elsewhere (pointer)
+    // for example, see DkMetaDataWidgets/DkMetaDataHUD - or DkCommentWidget
+    mMetaData->update(metaData);
+
+    // Notify listeners about changed metadata
+    emit undoSignal();
+    emit resetMetaDataSignal();
 }
 
-void DkBasicLoader::setMinHistorySize(int size) {
-	mMinHistorySize = size;
+void DkBasicLoader::redo()
+{
+    // Change history index (for image()...)
+    if (mImageIndex < mImages.size() - 1)
+        mImageIndex++;
+
+    // Get last history item with modified metadata (up until new history index)
+    QSharedPointer<DkMetaDataT> metaData(mMetaData);
+    metaData = lastMetaDataEdit(false, true);
+    // Update our current metadata object, which is also used elsewhere (pointer)
+    // for example, see DkMetaDataWidgets/DkMetaDataHUD - or DkCommentWidget
+    mMetaData->update(metaData);
+
+    // Notify listeners about changed metadata
+    emit redoSignal();
+    emit resetMetaDataSignal();
 }
 
-void DkBasicLoader::setHistoryIndex(int idx) {
-	mImageIndex = idx;
+QVector<DkEditImage> *DkBasicLoader::history()
+{
+    return &mImages;
+}
+
+DkEditImage DkBasicLoader::lastEdit() const
+{
+    assert(mImageIndex >= 0 && mImageIndex < mImages.size());
+    return mImages[mImageIndex];
 }
 
-void DkBasicLoader::loadFileToBuffer(const QString& filePath, QByteArray& ba) const {
+int DkBasicLoader::historyIndex() const
+{
+    return mImageIndex;
+}
 
-	QFileInfo fi(filePath);
+void DkBasicLoader::setMinHistorySize(int size)
+{
+    mMinHistorySize = size;
+}
 
-	if (!fi.exists())
-		return;
+void DkBasicLoader::setHistoryIndex(int idx)
+{
+    mImageIndex = idx;
+    // TODO update mMetaData, see undo()
+}
+
+void DkBasicLoader::loadFileToBuffer(const QString &filePath, QByteArray &ba) const
+{
+    QFileInfo fi(filePath);
+
+    if (!fi.exists())
+        return;
 
 #ifdef WITH_QUAZIP
-	if (fi.dir().path().contains(DkZipContainer::zipMarker())) 
-		DkZipContainer::extractImage(DkZipContainer::decodeZipFile(filePath), DkZipContainer::decodeImageFile(filePath), ba);
+    if (fi.dir().path().contains(DkZipContainer::zipMarker()))
+        DkZipContainer::extractImage(DkZipContainer::decodeZipFile(filePath), DkZipContainer::decodeImageFile(filePath), ba);
 #endif
-	
-	QFile file(filePath);
-	file.open(QIODevice::ReadOnly);
 
-	ba = file.readAll();
-}
+    QFile file(filePath);
+    file.open(QIODevice::ReadOnly);
 
-QSharedPointer<QByteArray> DkBasicLoader::loadFileToBuffer(const QString& filePath) const {
+    ba = file.readAll();
+}
 
-	QFileInfo fi(filePath);
+QSharedPointer<QByteArray> DkBasicLoader::loadFileToBuffer(const QString &filePath) const
+{
+    QFileInfo fi(filePath);
 
 #ifdef WITH_QUAZIP
-	if (fi.dir().path().contains(DkZipContainer::zipMarker())) 
-		return DkZipContainer::extractImage(DkZipContainer::decodeZipFile(filePath), DkZipContainer::decodeImageFile(filePath));
+    if (fi.dir().path().contains(DkZipContainer::zipMarker()))
+        return DkZipContainer::extractImage(DkZipContainer::decodeZipFile(filePath), DkZipContainer::decodeImageFile(filePath));
 #endif
 
-	QFile file(filePath);
-	file.open(QIODevice::ReadOnly);
+    QFile file(filePath);
+    file.open(QIODevice::ReadOnly);
 
-	QSharedPointer<QByteArray> ba(new QByteArray(file.readAll()));
-	file.close();
+    QSharedPointer<QByteArray> ba(new QByteArray(file.readAll()));
+    file.close();
 
-	return ba;
+    return ba;
 }
 
-bool DkBasicLoader::writeBufferToFile(const QString& fileInfo, const QSharedPointer<QByteArray> ba) const {
-
-	if (!ba || ba->isEmpty())
-		return false;
+/**
+ * @brief writeBufferToFile() writes the passed in file buffer to the specified file.
+ *
+ * It's called by the save() routine, which saves the image to that file buffer
+ * and updates that file buffer to also contain exif data.
+ *
+ * @param fileInfo path to file to be written
+ * @param ba raw content to be written to file
+ */
+bool DkBasicLoader::writeBufferToFile(const QString &fileInfo, const QSharedPointer<QByteArray> ba) const
+{
+    if (!ba || ba->isEmpty())
+        return false;
 
-	QFile file(fileInfo);
-	file.open(QIODevice::WriteOnly);
-	qint64 bytesWritten = file.write(*ba.data(), ba->size());
-	file.close();
-	qDebug() << "[DkBasicLoader] buffer saved, bytes written: " << bytesWritten;
+    QFile file(fileInfo);
+    file.open(QIODevice::WriteOnly);
+    qint64 bytesWritten = file.write(*ba.data(), ba->size());
+    file.close();
+    qDebug() << "[DkBasicLoader] buffer saved, bytes written: " << bytesWritten;
 
-	if (!bytesWritten || bytesWritten == -1)
-		return false;
+    if (!bytesWritten || bytesWritten == -1)
+        return false;
 
-	return true;
+    return true;
 }
 
-void DkBasicLoader::indexPages(const QString& filePath, const QSharedPointer<QByteArray> ba) {
-
-	// reset counters
-	mNumPages = 1;
-	mPageIdx = 1;
+void DkBasicLoader::indexPages(const QString &filePath, const QSharedPointer<QByteArray> ba)
+{
+    // reset counters
+    mNumPages = 1;
+    mPageIdx = 1;
 
 #ifdef WITH_LIBTIFF
 
-	QFileInfo fInfo(filePath);
+    QFileInfo fInfo(filePath);
 
-	// for now we just support tiff's
-	if (!fInfo.suffix().contains(QRegExp("(tif|tiff)", Qt::CaseInsensitive)))
-		return;
+    // for now we just support tiff's
+    if (!fInfo.suffix().contains(QRegularExpression("(tif|tiff)", QRegularExpression::CaseInsensitiveOption)))
+        return;
 
-	// first turn off nasty warning/error dialogs - (we do the GUI : )
-	TIFFErrorHandler oldErrorHandler, oldWarningHandler;
-	oldWarningHandler = TIFFSetWarningHandler(NULL);
-	oldErrorHandler = TIFFSetErrorHandler(NULL); 
+    // first turn off nasty warning/error dialogs - (we do the GUI : )
+    TIFFErrorHandler oldErrorHandler, oldWarningHandler;
+    oldWarningHandler = TIFFSetWarningHandler(NULL);
+    oldErrorHandler = TIFFSetErrorHandler(NULL);
 
-	DkTimer dt;
-	TIFF* tiff = 0;
+    DkTimer dt;
+    TIFF *tiff = 0;
 
-#if QT_VERSION >= QT_VERSION_CHECK(5,5,0) && defined(Q_OS_WIN)
-	std::istringstream is(ba ? ba->toStdString() : "");
+#if defined(Q_OS_WIN)
+    std::istringstream is(ba ? ba->toStdString() : "");
 
-	if (ba)
-		tiff = TIFFStreamOpen("MemTIFF", &is);
+    if (ba)
+        tiff = TIFFStreamOpen("MemTIFF", &is);
 
-	// read from file
-	if (!tiff)
-		tiff = TIFFOpen(filePath.toLatin1(), "r");	// this->mFile was here before - not sure why
+    // read from file
+    if (!tiff)
+        tiff = TIFFOpen(filePath.toLatin1(), "r"); // this->mFile was here before - not sure why
 
-	// loading from buffer allows us to load files with non-latin names
-	QSharedPointer<QByteArray> bal;
-	if (!tiff)
-		bal = loadFileToBuffer(filePath);;
-	std::istringstream isl(bal ? bal->toStdString() : "");
+    // loading from buffer allows us to load files with non-latin names
+    QSharedPointer<QByteArray> bal;
+    if (!tiff)
+        bal = loadFileToBuffer(filePath);
+    ;
+    std::istringstream isl(bal ? bal->toStdString() : "");
 
-	if (bal)
-		tiff = TIFFStreamOpen("MemTIFF", &isl);
+    if (bal)
+        tiff = TIFFStreamOpen("MemTIFF", &isl);
 #else
-	// read from file
-	tiff = TIFFOpen(filePath.toLatin1(), "r");	// this->mFile was here before - not sure why
+    // read from file
+    tiff = TIFFOpen(filePath.toLatin1(), "r"); // this->mFile was here before - not sure why
 #endif
 
-	if (!tiff) 
-		return;
+    if (!tiff)
+        return;
 
-	// libtiff example
-	int dircount = 0;
+    // libtiff example
+    int dircount = 0;
 
-	do {
-		dircount++;
+    do {
+        dircount++;
 
-	} while (TIFFReadDirectory(tiff));
+    } while (TIFFReadDirectory(tiff));
 
-	mNumPages = dircount;
+    mNumPages = dircount;
 
-	if (mNumPages > 1)
-		mPageIdx = 1;
+    if (mNumPages > 1)
+        mPageIdx = 1;
 
-	qDebug() << dircount << " TIFF directories... " << dt;
-	TIFFClose(tiff);
+    qDebug() << dircount << " TIFF directories... " << dt;
+    TIFFClose(tiff);
 
-	TIFFSetWarningHandler(oldWarningHandler);
-	TIFFSetWarningHandler(oldErrorHandler);
+    TIFFSetWarningHandler(oldWarningHandler);
+    TIFFSetWarningHandler(oldErrorHandler);
 #else
-	Q_UNUSED(filePath);
+    Q_UNUSED(filePath);
 #endif
-
 }
 
-bool DkBasicLoader::loadPage(int skipIdx) {
-
-	bool imgLoaded = false;
+bool DkBasicLoader::loadPage(int skipIdx)
+{
+    bool imgLoaded = false;
 
-	mPageIdx += skipIdx;
+    mPageIdx += skipIdx;
 
-	// <= 1 since first page is loaded using qt
-	if (mPageIdx > mNumPages || mPageIdx <= 1)
-		return imgLoaded;
+    // <= 1 since first page is loaded using qt
+    if (mPageIdx > mNumPages || mPageIdx <= 1)
+        return imgLoaded;
 
-	return loadPageAt(mPageIdx);
+    return loadPageAt(mPageIdx);
 }
 
-bool DkBasicLoader::loadPageAt(int pageIdx) {
-
-	bool imgLoaded = false;
+bool DkBasicLoader::loadPageAt(int pageIdx)
+{
+    bool imgLoaded = false;
 
 #ifdef WITH_LIBTIFF
 
-	// <= 1 since first page is loaded using qt
-	if (pageIdx > mNumPages || pageIdx < 1)
-		return imgLoaded;
+    // <= 1 since first page is loaded using qt
+    if (pageIdx > mNumPages || pageIdx < 1)
+        return imgLoaded;
 
-	// first turn off nasty warning/error dialogs - (we do the GUI : )
-	TIFFErrorHandler oldErrorHandler, oldWarningHandler;
-	oldWarningHandler = TIFFSetWarningHandler(NULL);
-	oldErrorHandler = TIFFSetErrorHandler(NULL); 
+    // first turn off nasty warning/error dialogs - (we do the GUI : )
+    TIFFErrorHandler oldErrorHandler, oldWarningHandler;
+    oldWarningHandler = TIFFSetWarningHandler(NULL);
+    oldErrorHandler = TIFFSetErrorHandler(NULL);
 
-	DkTimer dt;
-	TIFF* tiff = TIFFOpen(mFile.toLatin1(), "r");
+    DkTimer dt;
+    TIFF *tiff = TIFFOpen(mFile.toLatin1(), "r");
 
-#if QT_VERSION >= QT_VERSION_CHECK(5,5,0) && defined(Q_OS_WIN)
+#if defined(Q_OS_WIN)
 
-	// loading from buffer allows us to load files with non-latin names
-	QSharedPointer<QByteArray> ba;
-	if (!tiff)
-		ba = loadFileToBuffer(mFile);
-	
-	std::istringstream is(ba ? ba->toStdString() : "");
-	if (ba)
-		tiff = TIFFStreamOpen("MemTIFF", &is);
-#endif
+    // loading from buffer allows us to load files with non-latin names
+    QSharedPointer<QByteArray> ba;
+    if (!tiff)
+        ba = loadFileToBuffer(mFile);
 
-	if (!tiff)
-		return imgLoaded;
+    std::istringstream is(ba ? ba->toStdString() : "");
+    if (ba)
+        tiff = TIFFStreamOpen("MemTIFF", &is);
+#endif
 
-	uint32 width = 0;
-	uint32 height = 0;
+    if (!tiff)
+        return imgLoaded;
 
-	// go to current directory
-	for (int idx = 1; idx < pageIdx; idx++) {
+    uint32 width = 0;
+    uint32 height = 0;
 
-		if (!TIFFReadDirectory(tiff))
-			return false;
-	}
-	TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &width);
-	TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &height);
+    // go to current directory
+    for (int idx = 1; idx < pageIdx; idx++) {
+        if (!TIFFReadDirectory(tiff))
+            return false;
+    }
+    TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &width);
+    TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &height);
 
-	// init the qImage
-	QImage img = QImage(width, height, QImage::Format_ARGB32);
+    // init the qImage
+    QImage img = QImage(width, height, QImage::Format_ARGB32);
 
-	const int stopOnError = 1;
-	imgLoaded = TIFFReadRGBAImageOriented(tiff, width, height, reinterpret_cast<uint32 *>(img.bits()), ORIENTATION_TOPLEFT, stopOnError) != 0;
+    const int stopOnError = 1;
+    imgLoaded = TIFFReadRGBAImageOriented(tiff, width, height, reinterpret_cast<uint32 *>(img.bits()), ORIENTATION_TOPLEFT, stopOnError) != 0;
 
-	if (imgLoaded) {
-		for (uint32 y=0; y<height; ++y)
-			convert32BitOrder(img.scanLine(y), width);
-	}
+    if (imgLoaded) {
+        for (uint32 y = 0; y < height; ++y)
+            convert32BitOrder(img.scanLine(y), width);
+    }
 
-	TIFFClose(tiff);
+    TIFFClose(tiff);
 
-	TIFFSetWarningHandler(oldWarningHandler);
-	TIFFSetWarningHandler(oldErrorHandler);
+    TIFFSetWarningHandler(oldWarningHandler);
+    TIFFSetWarningHandler(oldErrorHandler);
 
-	setEditImage(img, tr("Original Image"));
+    setEditImage(img, tr("Original Image"));
 #else
-	Q_UNUSED(pageIdx);
+    Q_UNUSED(pageIdx);
 #endif
 
-
-	return imgLoaded;
+    return imgLoaded;
 }
 
-bool DkBasicLoader::setPageIdx(int skipIdx) {
-
-	// do nothing if we don't have tiff pages
-	if (mNumPages <= 1)
-		return false;
+bool DkBasicLoader::setPageIdx(int skipIdx)
+{
+    // do nothing if we don't have tiff pages
+    if (mNumPages <= 1)
+        return false;
 
-	mPageIdxDirty = false;
+    mPageIdxDirty = false;
 
-	int newPageIdx = mPageIdx + skipIdx;
+    int newPageIdx = mPageIdx + skipIdx;
 
-	if (newPageIdx > 0 && newPageIdx <= mNumPages) {
-		mPageIdxDirty = true;
-		mPageIdx = newPageIdx;
-	}
+    if (newPageIdx > 0 && newPageIdx <= mNumPages) {
+        mPageIdxDirty = true;
+        mPageIdx = newPageIdx;
+    }
 
-	return mPageIdxDirty;
+    return mPageIdxDirty;
 }
 
-void DkBasicLoader::resetPageIdx() {
-
-	mPageIdxDirty = false;
-	mPageIdx = 1;
+void DkBasicLoader::resetPageIdx()
+{
+    mPageIdxDirty = false;
+    mPageIdx = 1;
 }
 
-void DkBasicLoader::convert32BitOrder(void *buffer, int width) const {
-
+void DkBasicLoader::convert32BitOrder(void *buffer, int width) const
+{
 #ifdef WITH_LIBTIFF
-	// code from Qt QTiffHandler
-	uint32 *target = reinterpret_cast<uint32 *>(buffer);
-	for (int32 x=0; x<width; ++x) {
-		uint32 p = target[x];
-		// convert between ARGB and ABGR
-		target[x] = (p & 0xff000000)
-			| ((p & 0x00ff0000) >> 16)
-			| (p & 0x0000ff00)
-			| ((p & 0x000000ff) << 16);
-	}
+    // code from Qt QTiffHandler
+    uint32 *target = reinterpret_cast<uint32 *>(buffer);
+    for (int32 x = 0; x < width; ++x) {
+        uint32 p = target[x];
+        // convert between ARGB and ABGR
+        target[x] = (p & 0xff000000) | ((p & 0x00ff0000) >> 16) | (p & 0x0000ff00) | ((p & 0x000000ff) << 16);
+    }
 #else
-	Q_UNUSED(buffer);
-	Q_UNUSED(width);
+    Q_UNUSED(buffer);
+    Q_UNUSED(width);
 #endif
 }
 
-QString DkBasicLoader::save(const QString& filePath, const QImage& img, int compression) {
-
-	QSharedPointer<QByteArray> ba;
-
-	DkTimer dt;
-	if (saveToBuffer(filePath, img, ba, compression) && ba) {
+/**
+ * @brief saves the image and its metadata to the specified file.
+ *
+ * It writes the image to a file buffer and then writes that buffer back to the original file.
+ * Modified metadata is saved afterwards.
+ *
+ * @param filePath target path to image file
+ * @param img source image to be written to file (may be converted along the way)
+ * @param compression compression flag for QImageWriter
+ */
+QString DkBasicLoader::save(const QString &filePath, const QImage &img, int compression)
+{
+    QSharedPointer<QByteArray> ba;
 
-		if (writeBufferToFile(filePath, ba)) {
-			qDebug() << "saving to" << filePath << "in" << dt;
-			return filePath;
-		}
-	}
+    DkTimer dt;
+    if (saveToBuffer(filePath, img, ba, compression) && ba) {
+        if (writeBufferToFile(filePath, ba)) {
+            qInfo() << "saved to" << filePath << "in" << dt;
+            return filePath;
+        }
+    }
 
-	return QString();
+    return QString();
 }
 
-bool DkBasicLoader::saveToBuffer(const QString& filePath, const QImage& img, QSharedPointer<QByteArray>& ba, int compression) const {
-
-	bool bufferCreated = false;
-
-	if (!ba) {
-		ba = QSharedPointer<QByteArray>(new QByteArray());
-		bufferCreated = true;
-	}
-
-	bool saved = false;
-
-	QFileInfo fInfo(filePath);
+/**
+ * @brief saveToBuffer() writes the image matrix img to the file buffer.
+ *
+ * The file path is used to convert the image based on the file suffix.
+ *
+ * @param filePath path to file to which this image will later be written, the suffix is relevant
+ * @param img image to be written to file buffer
+ * @param ba in-memory file buffer containing resulting file
+ * @param compression compression flag for QImageWriter
+ */
+bool DkBasicLoader::saveToBuffer(const QString &filePath, const QImage &img, QSharedPointer<QByteArray> &ba, int compression) const
+{
+    bool bufferCreated = false;
 
-	if (fInfo.suffix().contains("ico", Qt::CaseInsensitive)) {
-		saved = saveWindowsIcon(img, ba);
-	}
-#if QT_VERSION < 0x050000 // qt5 natively supports r/w webp
-	else if (fInfo.suffix().contains("webp", Qt::CaseInsensitive)) {
-		saved = saveWebPFile(img, ba, compression);
-	}
-#endif
-	else {
+    if (!ba) {
+        ba = QSharedPointer<QByteArray>(new QByteArray());
+        bufferCreated = true;
+    }
+    // copy current metadata object: mMetaData pointer may be reset in the background in the process
+    // and then it won't be saved because !isLoaded()... [2022-08, pse]
+    QSharedPointer<DkMetaDataT> metaData = mMetaData;
+
+    bool saved = false;
+
+    QFileInfo fInfo(filePath);
+
+    if (fInfo.suffix().contains("ico", Qt::CaseInsensitive)) {
+        saved = saveWindowsIcon(img, ba);
+    } else {
+        bool hasAlpha = DkImage::alphaChannelUsed(img);
+        QImage sImg = img;
+
+        // JPEG 2000 can only handle 32 or 8bit images
+        if (!hasAlpha && img.colorTable().empty() && !fInfo.suffix().contains(QRegularExpression("(avif|j2k|jp2|jpf|jpx|jxl|png)"))) {
+            sImg = sImg.convertToFormat(QImage::Format_RGB888);
+        } else if (fInfo.suffix().contains(QRegularExpression("(j2k|jp2|jpf|jpx)")) && sImg.depth() != 32 && sImg.depth() != 8) {
+            if (sImg.hasAlphaChannel()) {
+                sImg = sImg.convertToFormat(QImage::Format_ARGB32);
+            } else {
+                sImg = sImg.convertToFormat(QImage::Format_RGB32);
+            }
+        }
 
-		bool hasAlpha = DkImage::alphaChannelUsed(img);
-		QImage sImg = img;
+        if (fInfo.suffix().contains(QRegularExpression("(png)")))
+            compression = -1;
 
+        QBuffer fileBuffer(ba.data());
+        // size_t s = fileBuffer.size();
+        fileBuffer.open(QIODevice::WriteOnly);
+        QImageWriter *imgWriter = new QImageWriter(&fileBuffer, fInfo.suffix().toStdString().c_str());
 
-#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
-		// JPEG 2000 can only handle 32 or 8bit images
-		if (!hasAlpha && img.colorTable().empty() && !fInfo.suffix().contains(QRegExp("(j2k|jp2|jpf|jpx|png)"))) {
-			sImg = sImg.convertToFormat(QImage::Format_RGB888);
-		}
-		else if (fInfo.suffix().contains(QRegExp("(j2k|jp2|jpf|jpx)")) && sImg.depth() != 32 && sImg.depth() != 8) {
-			sImg = sImg.convertToFormat(QImage::Format_RGB32);
-		}
-#endif
+        if (compression >= 0) { // -1 -> use Qt's default
+            imgWriter->setCompression(compression);
+            imgWriter->setQuality(compression);
+        }
+        if (compression == -1 && imgWriter->format() == "jpg") {
+            imgWriter->setQuality(DkSettingsManager::instance().settings().app().defaultJpgQuality);
+        }
 
-		if (fInfo.suffix().contains(QRegExp("(png)")))
-			compression = -1;
-
-		QBuffer fileBuffer(ba.data());
-		//size_t s = fileBuffer.size();
-		fileBuffer.open(QIODevice::WriteOnly);
-		QImageWriter* imgWriter = new QImageWriter(&fileBuffer, fInfo.suffix().toStdString().c_str());
-		
-		if (compression >= 0) {	// -1 -> use Qt's default
-			imgWriter->setCompression(compression);
-			imgWriter->setQuality(compression);
-		}
-		if (compression == -1 && imgWriter->format() == "jpg") {
-			imgWriter->setQuality(DkSettingsManager::instance().settings().app().defaultJpgQuality);
-		}
-
-#if QT_VERSION >= 0x050500
-		imgWriter->setOptimizedWrite(true);			// this saves space TODO: user option here?
-		imgWriter->setProgressiveScanWrite(true);
-#endif
-		saved = imgWriter->write(sImg);
-		delete imgWriter;
-	}
+        imgWriter->setOptimizedWrite(true); // this saves space TODO: user option here?
+        imgWriter->setProgressiveScanWrite(true);
 
-	if (saved && mMetaData) {
-		
-		if (!mMetaData->isLoaded() || !mMetaData->hasMetaData()) {
+        saved = imgWriter->write(sImg); // hint: release() might run now, resetting mMetaData which is used below [2022-08, pse]
+        delete imgWriter;
+    }
 
-			if (!bufferCreated)
-				mMetaData->readMetaData(filePath, ba);
-			else
-				// if we created the buffere here - force loading metadata from the file
-				mMetaData->readMetaData(filePath);
-			}
+    if (saved && metaData) {
+        if (!metaData->isLoaded() || !metaData->hasMetaData()) {
+            if (!bufferCreated)
+                metaData->readMetaData(filePath, ba);
+            else
+                // if we created the buffere here - force loading metadata from the file
+                metaData->readMetaData(filePath);
+        }
 
-			if (mMetaData->isLoaded()) {
-			
-				try {
-					// be careful: here we actually lie about the constness
-					mMetaData->updateImageMetaData(img);
-					if (!mMetaData->saveMetaData(ba, true))
-						mMetaData->clearExifState();
-				} 
-				catch (...) {
-					// is it still throwing anything?
-					qInfo() << "Sorry, I could not save the meta data...";
-					// clear exif state here -> the 'dirty' flag would otherwise edit the original image (see #514)
-					mMetaData->clearExifState();
-				}
-			}
-	}
+        // If we have metadata for the image, save it
+        // If your images are saved without metadata, check if the metadata object is discarded or reset
+        // causing isLoaded() to return false (glitch on reload) - pse
+        if (metaData->isLoaded()) {
+            try {
+                // be careful: here we actually lie about the constness
+                metaData->updateImageMetaData(img, false); // set dimensions in exif (do not reset exif orientation)
+                if (!metaData->saveMetaData(ba, true))
+                    metaData->clearExifState();
+            } catch (...) {
+                // is it still throwing anything?
+                qInfo() << "Sorry, I could not save the meta data...";
+                // clear exif state here -> the 'dirty' flag would otherwise edit the original image (see #514)
+                metaData->clearExifState();
+            }
+        }
+    }
 
-	if (!saved)
-		emit errorDialogSignal(tr("Sorry, I could not save: %1").arg(fInfo.fileName()));
+    if (!saved)
+        emit errorDialogSignal(tr("Sorry, I could not save: %1").arg(fInfo.fileName()));
 
-	return saved;
+    return saved;
 }
 
-void DkBasicLoader::saveThumbToMetaData(const QString& filePath) {
-
-	QSharedPointer<QByteArray> ba;	// dummy
-	saveThumbToMetaData(filePath, ba);
+void DkBasicLoader::saveThumbToMetaData(const QString &filePath)
+{
+    QSharedPointer<QByteArray> ba; // dummy
+    saveThumbToMetaData(filePath, ba);
 }
 
-void DkBasicLoader::saveMetaData(const QString& filePath) {
+void DkBasicLoader::saveThumbToMetaData(const QString &filePath, QSharedPointer<QByteArray> &ba)
+{
+    if (!hasImage())
+        return;
 
-	QSharedPointer<QByteArray> ba;	// dummy
-	saveMetaData(filePath, ba);
+    mMetaData->setThumbnail(DkImage::createThumb(image()));
+    saveMetaData(filePath, ba);
 }
 
-void DkBasicLoader::saveThumbToMetaData(const QString& filePath, QSharedPointer<QByteArray>& ba) {
-	
-	if (!hasImage())
-		return;
-
-	mMetaData->setThumbnail(DkImage::createThumb(image()));
-	saveMetaData(filePath, ba);
+/**
+ * @brief this will write the current exif/metadata to the loaded file.
+ *
+ * It calls the other overload passing an empty buffer,
+ * so it'll load the buffer, save the exif data to the buffer
+ * and write the buffer back to the file.
+ *
+ * @param filePath path to current file to be updated
+ */
+void DkBasicLoader::saveMetaData(const QString &filePath)
+{
+    QSharedPointer<QByteArray> ba; // dummy
+    saveMetaData(filePath, ba);
 }
 
-void DkBasicLoader::saveMetaData(const QString& filePath, QSharedPointer<QByteArray>& ba) {
-
-	if (!ba)
-		ba = QSharedPointer<QByteArray>(new QByteArray());
+/**
+ * @brief writes metadata to the file on disk, if it's marked as dirty
+ *
+ * This routine will write new metadata to the file on disk if metadata is marked dirty.
+ * It does this by first loading the file into a buffer (unless a non-empty buffer is passed),
+ * then it calls the MetaData module to save the exif data to that buffer
+ * and finally, it writes the modified buffer to the file on disk.
+ * The MetaData module has an overload which does basically the same thing.
+ *
+ * See ImageLoader (regular workflow starts there) and ImageContainer.
+ *
+ * @param filePath path to image file
+ * @param ba file buffer to be saved (leave empty to work on the specified file as it is on disk)
+ */
+void DkBasicLoader::saveMetaData(const QString &filePath, QSharedPointer<QByteArray> &ba)
+{
+    if (!ba)
+        ba = QSharedPointer<QByteArray>(new QByteArray());
 
-	if (ba->isEmpty() && mMetaData->isDirty()) {
-		ba = loadFileToBuffer(filePath);
-	}
+    if (ba->isEmpty() && mMetaData->isDirty()) {
+        ba = loadFileToBuffer(filePath);
+    }
 
-	bool saved = false;
-	try {
-		saved = mMetaData->saveMetaData(ba);
-	} 
-	catch(...) {
-		qInfo() << "could not save metadata...";
-	}
-	
-	if (saved)
-		writeBufferToFile(filePath, ba);
+    // Update in-memory copy of file (ba) with new meta data
+    bool saved = false;
+    try {
+        saved = mMetaData->saveMetaData(ba);
+    } catch (...) {
+        qInfo() << "could not save metadata...";
+    }
 
+    // Write in-memory copy to specified file - use this overload only if you really need it
+    if (saved)
+        writeBufferToFile(filePath, ba);
 }
 
-bool DkBasicLoader::isContainer(const QString& filePath) {
-
-	QFileInfo fInfo(filePath);
-	if (!fInfo.isFile() || !fInfo.exists())
-		return false;
-
-	QString suffix = fInfo.suffix();
+bool DkBasicLoader::isContainer(const QString &filePath)
+{
+    QFileInfo fInfo(filePath);
+    if (!fInfo.isFile() || !fInfo.exists())
+        return false;
 
-	if (suffix.isEmpty())
-		return false;
+    QString suffix = fInfo.suffix();
 
-	for (int idx = 0; idx < DkSettingsManager::param().app().containerFilters.size(); idx++) {
+    if (suffix.isEmpty())
+        return false;
 
-		if (DkSettingsManager::param().app().containerFilters[idx].contains(suffix))
-			return true;
-	}
+    for (int idx = 0; idx < DkSettingsManager::param().app().containerFilters.size(); idx++) {
+        if (DkSettingsManager::param().app().containerFilters[idx].contains(suffix))
+            return true;
+    }
 
-	return false;
+    return false;
 }
 
 /**
- * Releases the currently loaded images.
- **/ 
-void DkBasicLoader::release(bool clear) {
-
-	// TODO: auto save routines here?
-	//qDebug() << file.fileName() << " released...";
-	saveMetaData(mFile);
+ * @brief releases the currently loaded images.
+ *
+ * Clears the history.
+ * Called by loadGeneral() and ImageContainer::clear().
+ *
+ * @note This will *not* silently auto-save your beautiful images.
+ * It was apparently intended to be used that way (it called saveMetaData(), like ~DkImageContainerT()).
+ * All changes should be explicitly committed, including exif notes.
+ * If you think this is wrong, a comment would be appreciated. See issue #799. PSE, 2022.
+ *
+ **/
+void DkBasicLoader::release()
+{
+    // TODO: auto save routines here?
+    // answer: no.
 
-	mImages.clear();
-	//metaData.clear();
-	
-	// TODO: where should we clear the metadata?
-	if (clear || !mMetaData->isDirty())
-		mMetaData = QSharedPointer<DkMetaDataT>(new DkMetaDataT());
+    mImages.clear(); // clear history
+    mImageIndex = -1;
 
+    // Unload metadata
+    mMetaData = QSharedPointer<DkMetaDataT>(new DkMetaDataT());
 }
 
 #ifdef Q_OS_WIN
-bool DkBasicLoader::saveWindowsIcon(const QString& filePath, const QImage& img) const {
-
-	QSharedPointer<QByteArray> ba;
-
-	if (saveWindowsIcon(img, ba) && ba && !ba->isEmpty()) {
+bool DkBasicLoader::saveWindowsIcon(const QString &filePath, const QImage &img) const
+{
+    QSharedPointer<QByteArray> ba;
 
-		writeBufferToFile(filePath, ba);
-		return true;
-	}
+    if (saveWindowsIcon(img, ba) && ba && !ba->isEmpty()) {
+        writeBufferToFile(filePath, ba);
+        return true;
+    }
 
-	return false;
+    return false;
 }
 
-struct ICONDIRENTRY
-{
-	UCHAR nWidth;
-	UCHAR nHeight;
-	UCHAR nNumColorsInPalette; // 0 if no palette
-	UCHAR nReserved; // should be 0
-	WORD nNumColorPlanes; // 0 or 1
-	WORD nBitsPerPixel;
-	ULONG nDataLength; // length in bytes
-	ULONG nOffset; // offset of BMP or PNG data from beginning of file
+struct ICONDIRENTRY {
+    UCHAR nWidth;
+    UCHAR nHeight;
+    UCHAR nNumColorsInPalette; // 0 if no palette
+    UCHAR nReserved; // should be 0
+    WORD nNumColorPlanes; // 0 or 1
+    WORD nBitsPerPixel;
+    ULONG nDataLength; // length in bytes
+    ULONG nOffset; // offset of BMP or PNG data from beginning of file
 };
 
-bool DkBasicLoader::saveWindowsIcon(const QImage& img, QSharedPointer<QByteArray>& ba) const {
-
-	// this code is an adopted version of:
-	// http://stackoverflow.com/questions/2289894/how-can-i-save-hicon-to-an-ico-file
-
-	if (!ba)
-		ba = QSharedPointer<QByteArray>(new QByteArray());
-
-	HICON hIcon = QtWin::toHICON(QPixmap::fromImage(img));
-	int nColorBits = 32;
-
-	QBuffer buffer(ba.data());
-	buffer.open(QIODevice::WriteOnly);
-
-	if (!hIcon)
-		return false;
-
-	HDC screenDevice = GetDC(0);
-
-	// Write header:
-	UCHAR icoHeader[6] = { 0, 0, 1, 0, 1, 0 }; // ICO file with 1 image
-	buffer.write((const char*)(&icoHeader), sizeof(icoHeader));
-
-	// Get information about icon:
-	ICONINFO iconInfo;
-	GetIconInfo(hIcon, &iconInfo);
-	HGDIOBJ handle1(iconInfo.hbmColor); // free bitmaps when function ends
-	BITMAPINFO bmInfo = { 0 };
-	bmInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
-	bmInfo.bmiHeader.biBitCount = 0;    // don't get the color table     
-	if (!GetDIBits(screenDevice, iconInfo.hbmColor, 0, 0, NULL, &bmInfo, DIB_RGB_COLORS))
-	{
-		return false;
-	}
-
-	// Allocate size of bitmap info header plus space for color table:
-	int nBmInfoSize = sizeof(BITMAPINFOHEADER);
-	if (nColorBits < 24)
-	{
-		nBmInfoSize += sizeof(RGBQUAD) * (int)(1 << nColorBits);
-	}
-
-	QSharedPointer<UCHAR> bitmapInfo(new UCHAR[nBmInfoSize]);
-	BITMAPINFO* pBmInfo = (BITMAPINFO*)bitmapInfo.data();
-	memcpy(pBmInfo, &bmInfo, sizeof(BITMAPINFOHEADER));
-
-	// Get bitmap data:
-	QSharedPointer<UCHAR> bits(new UCHAR[bmInfo.bmiHeader.biSizeImage]);
-	pBmInfo->bmiHeader.biBitCount = (WORD)nColorBits;
-	pBmInfo->bmiHeader.biCompression = BI_RGB;
-	if (!GetDIBits(screenDevice, iconInfo.hbmColor, 0, bmInfo.bmiHeader.biHeight, bits.data(), pBmInfo, DIB_RGB_COLORS))
-	{
-		return false;
-	}
-
-	// Get mask data:
-	BITMAPINFO maskInfo = { 0 };
-	maskInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
-	maskInfo.bmiHeader.biBitCount = 0;  // don't get the color table     
-	if (!GetDIBits(screenDevice, iconInfo.hbmMask, 0, 0, NULL, &maskInfo, DIB_RGB_COLORS))
-	{
-		return false;
-	}
-
-	QSharedPointer<UCHAR> maskBits(new UCHAR[maskInfo.bmiHeader.biSizeImage]);
-	QSharedPointer<UCHAR> maskInfoBytes(new UCHAR[sizeof(BITMAPINFO) + 2 * sizeof(RGBQUAD)]);
-	BITMAPINFO* pMaskInfo = (BITMAPINFO*)maskInfoBytes.data();
-	memcpy(pMaskInfo, &maskInfo, sizeof(maskInfo));
-	if (!GetDIBits(screenDevice, iconInfo.hbmMask, 0, maskInfo.bmiHeader.biHeight, maskBits.data(), pMaskInfo, DIB_RGB_COLORS))
-	{
-		return false;
-	}
-
-	// Write directory entry:
-	ICONDIRENTRY dir;
-	dir.nWidth = (UCHAR)pBmInfo->bmiHeader.biWidth;
-	dir.nHeight = (UCHAR)pBmInfo->bmiHeader.biHeight;
-	dir.nNumColorsInPalette = (nColorBits == 4 ? 16 : 0);
-	dir.nReserved = 0;
-	dir.nNumColorPlanes = 0;
-	dir.nBitsPerPixel = pBmInfo->bmiHeader.biBitCount;
-	dir.nDataLength = pBmInfo->bmiHeader.biSizeImage + pMaskInfo->bmiHeader.biSizeImage + nBmInfoSize;
-	dir.nOffset = sizeof(dir) + sizeof(icoHeader);
-	buffer.write((const char*)&dir, sizeof(dir));
-
-	// Write DIB header (including color table):
-	int nBitsSize = pBmInfo->bmiHeader.biSizeImage;
-	pBmInfo->bmiHeader.biHeight *= 2; // because the header is for both image and mask
-	pBmInfo->bmiHeader.biCompression = 0;
-	pBmInfo->bmiHeader.biSizeImage += pMaskInfo->bmiHeader.biSizeImage; // because the header is for both image and mask
-	buffer.write((const char*)&pBmInfo->bmiHeader, nBmInfoSize);
-
-	// Write image data:
-	buffer.write((const char*)bits.data(), nBitsSize);
-
-	// Write mask data:
-	buffer.write((const char*)maskBits.data(), pMaskInfo->bmiHeader.biSizeImage);
-
-	buffer.close();
-
-	DeleteObject(handle1);
-
-	return true;
-}
+bool DkBasicLoader::saveWindowsIcon(const QImage &img, QSharedPointer<QByteArray> &ba) const
+{
+    // this code is an adopted version of:
+    // http://stackoverflow.com/questions/2289894/how-can-i-save-hicon-to-an-ico-file
 
-#endif // #ifdef Q_OS_WIN
+    if (!ba)
+        ba = QSharedPointer<QByteArray>(new QByteArray());
 
-#ifdef WITH_OPENCV
+    HICON hIcon = QtWin::toHICON(QPixmap::fromImage(img));
+    int nColorBits = 32;
 
-cv::Mat DkBasicLoader::getImageCv() {
-	return cv::Mat();
-}
+    QBuffer buffer(ba.data());
+    buffer.open(QIODevice::WriteOnly);
 
-bool DkBasicLoader::loadOpenCVVecFile(const QString& filePath, QImage& img, QSharedPointer<QByteArray> ba, QSize s) const {
+    if (!hIcon)
+        return false;
 
-	if (!ba)
-		ba = QSharedPointer<QByteArray>(new QByteArray());
+    HDC screenDevice = GetDC(0);
 
-	// load from file?
-	if (ba->isEmpty())
-		ba = loadFileToBuffer(filePath);
+    // Write header:
+    UCHAR icoHeader[6] = {0, 0, 1, 0, 1, 0}; // ICO file with 1 image
+    buffer.write((const char *)(&icoHeader), sizeof(icoHeader));
 
-	if (ba->isEmpty())
-		return false;
+    // Get information about icon:
+    ICONINFO iconInfo;
+    GetIconInfo(hIcon, &iconInfo);
+    HGDIOBJ handle1(iconInfo.hbmColor); // free bitmaps when function ends
+    BITMAPINFO bmInfo = {0};
+    bmInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+    bmInfo.bmiHeader.biBitCount = 0; // don't get the color table
+    if (!GetDIBits(screenDevice, iconInfo.hbmColor, 0, 0, NULL, &bmInfo, DIB_RGB_COLORS)) {
+        return false;
+    }
 
-	// read header & get a pointer to the first image
-	int fileCount, vecSize;
-	const unsigned char* imgPtr = (const unsigned char*)ba->constData();
-	if (!readHeader(&imgPtr, fileCount, vecSize))
-		return false;
+    // Allocate size of bitmap info header plus space for color table:
+    int nBmInfoSize = sizeof(BITMAPINFOHEADER);
+    if (nColorBits < 24) {
+        nBmInfoSize += sizeof(RGBQUAD) * (int)(1 << nColorBits);
+    }
 
-	int guessedW = 0;
-	int guessedH = 0;
+    QSharedPointer<UCHAR> bitmapInfo(new UCHAR[nBmInfoSize]);
+    BITMAPINFO *pBmInfo = (BITMAPINFO *)bitmapInfo.data();
+    memcpy(pBmInfo, &bmInfo, sizeof(BITMAPINFOHEADER));
 
-	getPatchSizeFromFileName(QFileInfo(filePath).fileName(), guessedW, guessedH);
+    // Get bitmap data:
+    QSharedPointer<UCHAR> bits(new UCHAR[bmInfo.bmiHeader.biSizeImage]);
+    pBmInfo->bmiHeader.biBitCount = (WORD)nColorBits;
+    pBmInfo->bmiHeader.biCompression = BI_RGB;
+    if (!GetDIBits(screenDevice, iconInfo.hbmColor, 0, bmInfo.bmiHeader.biHeight, bits.data(), pBmInfo, DIB_RGB_COLORS)) {
+        return false;
+    }
 
-	qDebug() << "patch size from filename: " << guessedW << " x " << guessedH;
+    // Get mask data:
+    BITMAPINFO maskInfo = {0};
+    maskInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+    maskInfo.bmiHeader.biBitCount = 0; // don't get the color table
+    if (!GetDIBits(screenDevice, iconInfo.hbmMask, 0, 0, NULL, &maskInfo, DIB_RGB_COLORS)) {
+        return false;
+    }
 
-	if(vecSize > 0 && !guessedH && !guessedW) {
-		guessedW = qFloor(sqrt((float) vecSize));
-		if(guessedW > 0)
-			guessedH = vecSize/guessedW;
-	}
+    QSharedPointer<UCHAR> maskBits(new UCHAR[maskInfo.bmiHeader.biSizeImage]);
+    QSharedPointer<UCHAR> maskInfoBytes(new UCHAR[sizeof(BITMAPINFO) + 2 * sizeof(RGBQUAD)]);
+    BITMAPINFO *pMaskInfo = (BITMAPINFO *)maskInfoBytes.data();
+    memcpy(pMaskInfo, &maskInfo, sizeof(maskInfo));
+    if (!GetDIBits(screenDevice, iconInfo.hbmMask, 0, maskInfo.bmiHeader.biHeight, maskBits.data(), pMaskInfo, DIB_RGB_COLORS)) {
+        return false;
+    }
 
-	if(guessedW <= 0 || guessedH <= 0 || guessedW * guessedH != vecSize) {
+    // Write directory entry:
+    ICONDIRENTRY dir;
+    dir.nWidth = (UCHAR)pBmInfo->bmiHeader.biWidth;
+    dir.nHeight = (UCHAR)pBmInfo->bmiHeader.biHeight;
+    dir.nNumColorsInPalette = (nColorBits == 4 ? 16 : 0);
+    dir.nReserved = 0;
+    dir.nNumColorPlanes = 0;
+    dir.nBitsPerPixel = pBmInfo->bmiHeader.biBitCount;
+    dir.nDataLength = pBmInfo->bmiHeader.biSizeImage + pMaskInfo->bmiHeader.biSizeImage + nBmInfoSize;
+    dir.nOffset = sizeof(dir) + sizeof(icoHeader);
+    buffer.write((const char *)&dir, sizeof(dir));
 
-		// TODO: ask user
-		qDebug() << "dimensions do not match, patch size: " << guessedW << " x " << guessedH << " vecSize: " << vecSize;
-		return false;
-	}
+    // Write DIB header (including color table):
+    int nBitsSize = pBmInfo->bmiHeader.biSizeImage;
+    pBmInfo->bmiHeader.biHeight *= 2; // because the header is for both image and mask
+    pBmInfo->bmiHeader.biCompression = 0;
+    pBmInfo->bmiHeader.biSizeImage += pMaskInfo->bmiHeader.biSizeImage; // because the header is for both image and mask
+    buffer.write((const char *)&pBmInfo->bmiHeader, nBmInfoSize);
 
-	int fSize = ba->size();
-	int numElements = 0;
+    // Write image data:
+    buffer.write((const char *)bits.data(), nBitsSize);
 
-	// guess size
-	if (s.isEmpty()) {
-		double nEl = (fSize-64)/(vecSize*2);
-		nEl = (fSize-64-qCeil(nEl))/(vecSize*2)+1;	// opencv adds one byte per image - so we take care for this here
+    // Write mask data:
+    buffer.write((const char *)maskBits.data(), pMaskInfo->bmiHeader.biSizeImage);
 
-		if (qFloor(nEl) != qCeil(nEl))
-			return false;
-		numElements = qRound(nEl);
-	}
+    buffer.close();
 
-	double nRowsCols = sqrt(numElements);
-	int numCols = qCeil(nRowsCols);
-	int minusOneRow = (qFloor(nRowsCols) != qCeil(nRowsCols) && nRowsCols - qFloor(nRowsCols) < 0.5) ? 1 : 0;
+    DeleteObject(handle1);
 
-	cv::Mat allPatches((numCols-minusOneRow)*guessedH, numCols*guessedW, CV_8UC1, cv::Scalar(125));
+    return true;
+}
 
-	for (int idx = 0; idx < numElements; idx++) {
+#endif // #ifdef Q_OS_WIN
 
-		if (*imgPtr != 0) {
-			qDebug() << "skipping non-empty byte - there is something seriously wrong here!";
-			//return false;	// stop if the byte is non-empty -> otherwise we might read wrong memory
-		}
+#ifdef WITH_OPENCV
 
-		imgPtr++;	// there is an empty byte between images
-		cv::Mat cPatch = getPatch(&imgPtr, QSize(guessedW, guessedH));
-		cv::Mat cPatchAll = allPatches(cv::Rect(idx%numCols*guessedW, qFloor(idx/numCols)*guessedH, guessedW, guessedH));
+cv::Mat DkBasicLoader::getImageCv()
+{
+    return cv::Mat();
+}
 
-		if (!cPatchAll.empty())
-			cPatch.copyTo(cPatchAll);
-	}
+bool DkBasicLoader::loadOpenCVVecFile(const QString &filePath, QImage &img, QSharedPointer<QByteArray> ba, QSize s) const
+{
+    if (!ba)
+        ba = QSharedPointer<QByteArray>(new QByteArray());
 
-	img = DkImage::mat2QImage(allPatches);
-	img = img.convertToFormat(QImage::Format_ARGB32);
+    // load from file?
+    if (ba->isEmpty())
+        ba = loadFileToBuffer(filePath);
 
-	//setEditImage(img, tr("Original Image"));
+    if (ba->isEmpty())
+        return false;
 
-	return true;
-}
+    // read header & get a pointer to the first image
+    int fileCount, vecSize;
+    const unsigned char *imgPtr = (const unsigned char *)ba->constData();
+    if (!readHeader(&imgPtr, fileCount, vecSize))
+        return false;
 
-void DkBasicLoader::getPatchSizeFromFileName(const QString& fileName, int& width, int& height) const {
+    int guessedW = 0;
+    int guessedH = 0;
 
-	// parse patch size from file
-	QStringList sections = fileName.split(QRegExp("[-\\.]"));	
+    getPatchSizeFromFileName(QFileInfo(filePath).fileName(), guessedW, guessedH);
 
-	for (int idx = 0; idx < sections.size(); idx++) {
+    qDebug() << "patch size from filename: " << guessedW << " x " << guessedH;
 
-		QString tmpSec = sections[idx];
-		qDebug() << "section: " << tmpSec;
+    if (vecSize > 0 && !guessedH && !guessedW) {
+        guessedW = qFloor(sqrt((float)vecSize));
+        if (guessedW > 0)
+            guessedH = vecSize / guessedW;
+    }
 
-		if (tmpSec.contains("w"))
-			width = tmpSec.remove("w").toInt();
-		else if (tmpSec.contains("h"))
-			height = tmpSec.remove("h").toInt();
-	}
+    if (guessedW <= 0 || guessedH <= 0 || guessedW * guessedH != vecSize) {
+        // TODO: ask user
+        qDebug() << "dimensions do not match, patch size: " << guessedW << " x " << guessedH << " vecSize: " << vecSize;
+        return false;
+    }
 
-}
+    int fSize = ba->size();
+    int numElements = 0;
 
-bool DkBasicLoader::readHeader(const unsigned char** dataPtr, int& fileCount, int& vecSize) const {
+    // guess size
+    if (s.isEmpty()) {
+        double nEl = (fSize - 64) / (vecSize * 2);
+        nEl = (fSize - 64 - qCeil(nEl)) / (vecSize * 2) + 1; // opencv adds one byte per image - so we take care for this here
 
-	const int* pData = (const int*)*dataPtr;
-	fileCount = *pData; pData++;	// read file count
-	vecSize = *pData;				// read vec size
+        if (qFloor(nEl) != qCeil(nEl))
+            return false;
+        numElements = qRound(nEl);
+    }
 
-	qDebug() << "vec size: " << vecSize << " fileCount " << fileCount;
+    double nRowsCols = sqrt(numElements);
+    int numCols = qCeil(nRowsCols);
+    int minusOneRow = (qFloor(nRowsCols) != qCeil(nRowsCols) && nRowsCols - qFloor(nRowsCols) < 0.5) ? 1 : 0;
 
-	*dataPtr += 12;	// skip the first 12 (header) bytes
+    cv::Mat allPatches((numCols - minusOneRow) * guessedH, numCols * guessedW, CV_8UC1, cv::Scalar(125));
 
-	return true;
+    for (int idx = 0; idx < numElements; idx++) {
+        if (*imgPtr != 0) {
+            qDebug() << "skipping non-empty byte - there is something seriously wrong here!";
+            // return false;	// stop if the byte is non-empty -> otherwise we might read wrong memory
+        }
+
+        imgPtr++; // there is an empty byte between images
+        cv::Mat cPatch = getPatch(&imgPtr, QSize(guessedW, guessedH));
+        cv::Mat cPatchAll = allPatches(cv::Rect(idx % numCols * guessedW, qFloor(idx / numCols) * guessedH, guessedW, guessedH));
+
+        if (!cPatchAll.empty())
+            cPatch.copyTo(cPatchAll);
+    }
+
+    img = DkImage::mat2QImage(allPatches);
+    img = img.convertToFormat(QImage::Format_ARGB32);
+
+    // setEditImage(img, tr("Original Image"));
+
+    return true;
 }
 
-// the double pointer is here needed to additionally increase the pointer value
-cv::Mat DkBasicLoader::getPatch(const unsigned char** dataPtr, QSize patchSize) const {
+void DkBasicLoader::getPatchSizeFromFileName(const QString &fileName, int &width, int &height) const
+{
+    // parse patch size from file
+    QStringList sections = fileName.split(QRegularExpression("[-\\.]"));
+
+    for (int idx = 0; idx < sections.size(); idx++) {
+        QString tmpSec = sections[idx];
+        qDebug() << "section: " << tmpSec;
 
-	cv::Mat img8U(patchSize.height(), patchSize.width(), CV_8UC1, cv::Scalar(0));
+        if (tmpSec.contains("w"))
+            width = tmpSec.remove("w").toInt();
+        else if (tmpSec.contains("h"))
+            height = tmpSec.remove("h").toInt();
+    }
+}
 
-	// ok, take just the second byte
-	for (int rIdx = 0; rIdx < img8U.rows; rIdx++) {
+bool DkBasicLoader::readHeader(const unsigned char **dataPtr, int &fileCount, int &vecSize) const
+{
+    const int *pData = (const int *)*dataPtr;
+    fileCount = *pData;
+    pData++; // read file count
+    vecSize = *pData; // read vec size
 
-		unsigned char* ptr8U = img8U.ptr<unsigned char>(rIdx);
+    qDebug() << "vec size: " << vecSize << " fileCount " << fileCount;
 
-		for (int cIdx = 0; cIdx < img8U.cols; cIdx++) {
-			ptr8U[cIdx] = **dataPtr;
-			*dataPtr += 2;	// it is strange: opencv stores vec files as 16 bit but just use the 2nd byte
-		}
-	}
+    *dataPtr += 12; // skip the first 12 (header) bytes
 
-	return img8U;
+    return true;
 }
 
-int DkBasicLoader::mergeVecFiles(const QStringList& vecFilePaths, QString& saveFilePath) const {
+// the double pointer is here needed to additionally increase the pointer value
+cv::Mat DkBasicLoader::getPatch(const unsigned char **dataPtr, QSize patchSize) const
+{
+    cv::Mat img8U(patchSize.height(), patchSize.width(), CV_8UC1, cv::Scalar(0));
 
-	int lastVecSize = 0;
-	int totalFileCount = 0;
-	int vecCount = 0;
-	int pWidth = 0, pHeight = 0;
-	QByteArray vecBuffer;
+    // ok, take just the second byte
+    for (int rIdx = 0; rIdx < img8U.rows; rIdx++) {
+        unsigned char *ptr8U = img8U.ptr<unsigned char>(rIdx);
 
-	for (const QString& filePath : vecFilePaths) {
+        for (int cIdx = 0; cIdx < img8U.cols; cIdx++) {
+            ptr8U[cIdx] = **dataPtr;
+            *dataPtr += 2; // it is strange: opencv stores vec files as 16 bit but just use the 2nd byte
+        }
+    }
 
-		QFileInfo fInfo(filePath);
-		QSharedPointer<QByteArray> ba = loadFileToBuffer(filePath);
-		if (ba->isEmpty()){
-			qDebug() << "could not load: " << fInfo.fileName();
-			continue;
-		}
+    return img8U;
+}
 
-		int fileCount, vecSize;
-		const unsigned char* dataPtr = (const unsigned char*)ba->constData();
-		if (!readHeader(&dataPtr, fileCount, vecSize)) {
-			qDebug() << "could not read header, skipping: " << fInfo.fileName();
-			continue;
-		}
+int DkBasicLoader::mergeVecFiles(const QStringList &vecFilePaths, QString &saveFilePath) const
+{
+    int lastVecSize = 0;
+    int totalFileCount = 0;
+    int vecCount = 0;
+    int pWidth = 0, pHeight = 0;
+    QByteArray vecBuffer;
+
+    for (const QString &filePath : vecFilePaths) {
+        QFileInfo fInfo(filePath);
+        QSharedPointer<QByteArray> ba = loadFileToBuffer(filePath);
+        if (ba->isEmpty()) {
+            qDebug() << "could not load: " << fInfo.fileName();
+            continue;
+        }
 
-		if (lastVecSize && vecSize != lastVecSize) {
-			qDebug() << "wrong vec size, skipping: " << fInfo.fileName();
-			continue;
-		}
+        int fileCount, vecSize;
+        const unsigned char *dataPtr = (const unsigned char *)ba->constData();
+        if (!readHeader(&dataPtr, fileCount, vecSize)) {
+            qDebug() << "could not read header, skipping: " << fInfo.fileName();
+            continue;
+        }
 
-		vecBuffer.append((const char*)dataPtr, vecSize*fileCount*2+fileCount);	// +fileCount accounts for the '\0' bytes between the patches
+        if (lastVecSize && vecSize != lastVecSize) {
+            qDebug() << "wrong vec size, skipping: " << fInfo.fileName();
+            continue;
+        }
 
-		getPatchSizeFromFileName(fInfo.fileName(), pWidth, pHeight);
+        vecBuffer.append((const char *)dataPtr, vecSize * fileCount * 2 + fileCount); // +fileCount accounts for the '\0' bytes between the patches
 
-		totalFileCount += fileCount;
-		lastVecSize = vecSize;
+        getPatchSizeFromFileName(fInfo.fileName(), pWidth, pHeight);
 
-		vecCount++;
-	}
+        totalFileCount += fileCount;
+        lastVecSize = vecSize;
 
-	// don't save if we could not merge the files
-	if (!vecCount)
-		return vecCount;
+        vecCount++;
+    }
+
+    // don't save if we could not merge the files
+    if (!vecCount)
+        return vecCount;
 
-	unsigned int* header = new unsigned int[3];
-	header[0] = totalFileCount;
-	header[1] = lastVecSize;
-	header[2] = 0;
+    unsigned int *header = new unsigned int[3];
+    header[0] = totalFileCount;
+    header[1] = lastVecSize;
+    header[2] = 0;
 
-	vecBuffer.prepend((const char*) header, 3*sizeof(int));
+    vecBuffer.prepend((const char *)header, 3 * sizeof(int));
 
-	QFileInfo saveFileInfo(saveFilePath);
+    QFileInfo saveFileInfo(saveFilePath);
 
-	// append width, height if we don't know
-	if (pWidth && pHeight) {
-		QString whString = "-w" + QString::number(pWidth) + "-h" + QString::number(pHeight);
-		saveFileInfo = QFileInfo(saveFileInfo.absolutePath(), saveFileInfo.baseName() + whString + "." + saveFileInfo.suffix());
-	}
+    // append width, height if we don't know
+    if (pWidth && pHeight) {
+        QString whString = "-w" + QString::number(pWidth) + "-h" + QString::number(pHeight);
+        saveFileInfo = QFileInfo(saveFileInfo.absolutePath(), saveFileInfo.baseName() + whString + "." + saveFileInfo.suffix());
+    }
 
-	QFile file(saveFileInfo.absoluteFilePath());
-	file.open(QIODevice::WriteOnly);
-	file.write(vecBuffer);
-	file.close();
+    QFile file(saveFileInfo.absoluteFilePath());
+    file.open(QIODevice::WriteOnly);
+    file.write(vecBuffer);
+    file.close();
 
-	return vecCount;
+    return vecCount;
 }
 
 #endif // #ifdef WITH_OPENCV
 
 // FileDownloader --------------------------------------------------------------------
-FileDownloader::FileDownloader(const QUrl& imageUrl, const QString& filePath, QObject *parent) : QObject(parent) {
-	
-	mFilePath = filePath;
-	
-	QNetworkProxyQuery npq(QUrl("https://google.com"));
-	QList<QNetworkProxy> listOfProxies = QNetworkProxyFactory::systemProxyForQuery(npq);
-	if (!listOfProxies.empty() && listOfProxies[0].hostName() != "") {
-		mWebCtrl.setProxy(listOfProxies[0]);
-	}
+FileDownloader::FileDownloader(const QUrl &imageUrl, const QString &filePath, QObject *parent)
+    : QObject(parent)
+{
+    mFilePath = filePath;
 
-	connect(&mWebCtrl, SIGNAL(finished(QNetworkReply*)),
-		SLOT(fileDownloaded(QNetworkReply*)));
+    QNetworkProxyQuery npq(QUrl("https://google.com"));
+    QList<QNetworkProxy> listOfProxies = QNetworkProxyFactory::systemProxyForQuery(npq);
+    if (!listOfProxies.empty() && listOfProxies[0].hostName() != "") {
+        mWebCtrl.setProxy(listOfProxies[0]);
+    }
 
-	downloadFile(imageUrl);
-}
+    connect(&mWebCtrl, SIGNAL(finished(QNetworkReply *)), SLOT(fileDownloaded(QNetworkReply *)));
 
-FileDownloader::~FileDownloader() {
+    downloadFile(imageUrl);
 }
 
-void FileDownloader::downloadFile(const QUrl& url) {
-
-	QNetworkRequest request(url);
-	mWebCtrl.get(request);
-	mUrl = url;
+FileDownloader::~FileDownloader()
+{
 }
 
-void FileDownloader::saved() {
-
-	if (mSaveWatcher.result()) {
-		qInfo() << "downloaded image saved to" << mFilePath;
-		emit downloaded(mFilePath);
-	}
-	else {
-		qWarning() << "could not download file to " << mFilePath;
-	}
+void FileDownloader::downloadFile(const QUrl &url)
+{
+    QNetworkRequest request(url);
+    mWebCtrl.get(request);
+    mUrl = url;
 }
 
-bool FileDownloader::save(const QString& filePath, const QSharedPointer<QByteArray> data) {
+void FileDownloader::saved()
+{
+    if (mSaveWatcher.result()) {
+        qInfo() << "downloaded image saved to" << mFilePath;
+        emit downloaded(mFilePath);
+    } else {
+        qWarning() << "could not download file to " << mFilePath;
+    }
+}
 
-	if (!data) {
-		qWarning() << "cannot save file if data is NULL";
-		return false;
-	}
+bool FileDownloader::save(const QString &filePath, const QSharedPointer<QByteArray> data)
+{
+    if (!data) {
+        qWarning() << "cannot save file if data is NULL";
+        return false;
+    }
 
-	QFileInfo fi(filePath);
+    QFileInfo fi(filePath);
 
-	if (!fi.absoluteDir().exists())
-		QDir().mkpath(fi.absolutePath());
+    if (!fi.absoluteDir().exists())
+        QDir().mkpath(fi.absolutePath());
 
-	QFile f(filePath);
-	f.open(QIODevice::WriteOnly);
+    QFile f(filePath);
+    f.open(QIODevice::WriteOnly);
 
-	return f.write(*data);
+    return f.write(*data);
 }
 
-void FileDownloader::fileDownloaded(QNetworkReply* pReply) {
-
-	if (pReply->error() != QNetworkReply::NoError) {
-		qWarning() << "I could not download: " << mUrl;
-		qWarning() << pReply->errorString();
-	}
+void FileDownloader::fileDownloaded(QNetworkReply *pReply)
+{
+    if (pReply->error() != QNetworkReply::NoError) {
+        qWarning() << "I could not download: " << mUrl;
+        qWarning() << pReply->errorString();
+    }
 
-	mDownloadedData = QSharedPointer<QByteArray>(new QByteArray(pReply->readAll()));
-	//emit a signal
-	pReply->deleteLater();
+    mDownloadedData = QSharedPointer<QByteArray>(new QByteArray(pReply->readAll()));
+    // emit a signal
+    pReply->deleteLater();
 
-	// data only requested
-	if (mFilePath.isEmpty()) {
-		emit downloaded();
-	}
-	// ok save it
-	else {
-		connect(&mSaveWatcher, SIGNAL(finished()), this, SLOT(saved()), Qt::UniqueConnection);
-		mSaveWatcher.setFuture(QtConcurrent::run(&nmc::FileDownloader::save, mFilePath, mDownloadedData));
-	}
+    // data only requested
+    if (mFilePath.isEmpty()) {
+        emit downloaded();
+    }
+    // ok save it
+    else {
+        connect(&mSaveWatcher, SIGNAL(finished()), this, SLOT(saved()), Qt::UniqueConnection);
+        mSaveWatcher.setFuture(QtConcurrent::run(&nmc::FileDownloader::save, mFilePath, mDownloadedData));
+    }
 }
 
-QSharedPointer<QByteArray> FileDownloader::downloadedData() const {
-	return mDownloadedData;
+QSharedPointer<QByteArray> FileDownloader::downloadedData() const
+{
+    return mDownloadedData;
 }
 
-QUrl FileDownloader::getUrl() const {
-	return mUrl;
+QUrl FileDownloader::getUrl() const
+{
+    return mUrl;
 }
 
 #ifdef WITH_QUAZIP
 
 // DkZipContainer --------------------------------------------------------------------
-DkZipContainer::DkZipContainer(const QString& encodedFilePath) {
-
-	if (!encodedFilePath.isEmpty() && 
-		encodedFilePath.contains(mZipMarker)) {
-		mImageInZip = true;
-		mEncodedFilePath = encodedFilePath;
-		mZipFilePath = decodeZipFile(encodedFilePath);
-		mImageFileName = decodeImageFile(encodedFilePath);
-	}
-	else
-		mImageInZip = false;
+DkZipContainer::DkZipContainer(const QString &encodedFilePath)
+{
+    if (!encodedFilePath.isEmpty() && encodedFilePath.contains(mZipMarker)) {
+        mImageInZip = true;
+        mEncodedFilePath = encodedFilePath;
+        mZipFilePath = decodeZipFile(encodedFilePath);
+        mImageFileName = decodeImageFile(encodedFilePath);
+    } else
+        mImageInZip = false;
 }
 
-QString DkZipContainer::encodeZipFile(const QString& zipFile, const QString& imageFile) {
-
-	// if you think this code is unreadable, take a look at the old line:
-	//return QFileInfo(QDir(zipFile.absoluteFilePath() + mZipMarker + imageFile.left(imageFile.lastIndexOf("/") + 1).replace("/", mZipMarker)),(imageFile.lastIndexOf("/") < 0) ? imageFile : imageFile.right(imageFile.size() - imageFile.lastIndexOf("/") - 1));
+QString DkZipContainer::encodeZipFile(const QString &zipFile, const QString &imageFile)
+{
+    // if you think this code is unreadable, take a look at the old line:
+    // return QFileInfo(QDir(zipFile.absoluteFilePath() + mZipMarker + imageFile.left(imageFile.lastIndexOf("/") + 1).replace("/",
+    // mZipMarker)),(imageFile.lastIndexOf("/") < 0) ? imageFile : imageFile.right(imageFile.size() - imageFile.lastIndexOf("/") - 1));
 
-	QDir dir = QDir(zipFile + mZipMarker + imageFile.left(imageFile.lastIndexOf("/") + 1).replace("/", mZipMarker));
-	QString fileName = (imageFile.lastIndexOf("/") < 0) ? imageFile : imageFile.right(imageFile.size() - imageFile.lastIndexOf("/") - 1);
+    QDir dir = QDir(zipFile + mZipMarker + imageFile.left(imageFile.lastIndexOf("/") + 1).replace("/", mZipMarker));
+    QString fileName = (imageFile.lastIndexOf("/") < 0) ? imageFile : imageFile.right(imageFile.size() - imageFile.lastIndexOf("/") - 1);
 
-	return QFileInfo(dir, fileName).absoluteFilePath();
+    return QFileInfo(dir, fileName).absoluteFilePath();
 }
 
-QString DkZipContainer::decodeZipFile(const QString& encodedFileInfo) {
-
-	QString encodedDir = QFileInfo(encodedFileInfo).absolutePath();
+QString DkZipContainer::decodeZipFile(const QString &encodedFileInfo)
+{
+    QString encodedDir = QFileInfo(encodedFileInfo).absolutePath();
 
-	return encodedDir.left(encodedDir.indexOf(mZipMarker));
+    return encodedDir.left(encodedDir.indexOf(mZipMarker));
 }
 
-QString DkZipContainer::decodeImageFile(const QString& encodedFileInfo) {
-
-	// get relative zip path
-	QString tmp = encodedFileInfo.right(encodedFileInfo.size() - encodedFileInfo.indexOf(mZipMarker) - QString(mZipMarker).size());
-	tmp = tmp.replace(mZipMarker, "/");
-	tmp = tmp.replace("//", "/");
+QString DkZipContainer::decodeImageFile(const QString &encodedFileInfo)
+{
+    // get relative zip path
+    QString tmp = encodedFileInfo.right(encodedFileInfo.size() - encodedFileInfo.indexOf(mZipMarker) - QString(mZipMarker).size());
+    tmp = tmp.replace(mZipMarker, "/");
+    tmp = tmp.replace("//", "/");
 
-	// diem: this fixes an issue with images that are in a zip's root folder
-	if (tmp.startsWith("/"))
-		tmp = tmp.right(tmp.length()-1);
+    // diem: this fixes an issue with images that are in a zip's root folder
+    if (tmp.startsWith("/"))
+        tmp = tmp.right(tmp.length() - 1);
 
-	return tmp;
+    return tmp;
 }
 
-QSharedPointer<QByteArray> DkZipContainer::extractImage(const QString& zipFile, const QString& imageFile) {
-
-	QuaZip zip(zipFile);		
-	if(!zip.open(QuaZip::mdUnzip)) 
-		return QSharedPointer<QByteArray>(new QByteArray());
+QSharedPointer<QByteArray> DkZipContainer::extractImage(const QString &zipFile, const QString &imageFile)
+{
+    QuaZip zip(zipFile);
+    if (!zip.open(QuaZip::mdUnzip))
+        return QSharedPointer<QByteArray>(new QByteArray());
 
-	qDebug() << "DkZip::extractImage filePath: " << zipFile;
-	qDebug() << "3.0 image file" << imageFile;
+    qDebug() << "DkZip::extractImage filePath: " << zipFile;
+    qDebug() << "3.0 image file" << imageFile;
 
-	zip.setCurrentFile(imageFile);
-	QuaZipFile extractedFile(&zip);
-	if(!extractedFile.open(QIODevice::ReadOnly) || extractedFile.getZipError() != UNZ_OK) 
-		return QSharedPointer<QByteArray>(new QByteArray());
+    zip.setCurrentFile(imageFile);
+    QuaZipFile extractedFile(&zip);
+    if (!extractedFile.open(QIODevice::ReadOnly) || extractedFile.getZipError() != UNZ_OK)
+        return QSharedPointer<QByteArray>(new QByteArray());
 
-	QSharedPointer<QByteArray> ba(new QByteArray(extractedFile.readAll()));
-	extractedFile.close();
+    QSharedPointer<QByteArray> ba(new QByteArray(extractedFile.readAll()));
+    extractedFile.close();
 
-	zip.close();
+    zip.close();
 
-	return ba;
+    return ba;
 }
 
-void DkZipContainer::extractImage(const QString& zipFile, const QString& imageFile, QByteArray& ba) {
-
-	QuaZip zip(zipFile);		
-	if(!zip.open(QuaZip::mdUnzip)) 
-		return;
-
-	zip.setCurrentFile(imageFile);
-	QuaZipFile extractedFile(&zip);
-	if(!extractedFile.open(QIODevice::ReadOnly) || extractedFile.getZipError() != UNZ_OK) 
-		return;
+void DkZipContainer::extractImage(const QString &zipFile, const QString &imageFile, QByteArray &ba)
+{
+    QuaZip zip(zipFile);
+    if (!zip.open(QuaZip::mdUnzip))
+        return;
 
-	ba = QByteArray(extractedFile.readAll());
-	extractedFile.close();
+    zip.setCurrentFile(imageFile);
+    QuaZipFile extractedFile(&zip);
+    if (!extractedFile.open(QIODevice::ReadOnly) || extractedFile.getZipError() != UNZ_OK)
+        return;
 
-	zip.close();
+    ba = QByteArray(extractedFile.readAll());
+    extractedFile.close();
 
+    zip.close();
 }
 
-bool DkZipContainer::isZip() const {
-
-	return mImageInZip;
+bool DkZipContainer::isZip() const
+{
+    return mImageInZip;
 }
 
-QString DkZipContainer::getZipFilePath() const {
-
-	return mZipFilePath;
+QString DkZipContainer::getZipFilePath() const
+{
+    return mZipFilePath;
 }
 
-QString DkZipContainer::getImageFileName() const {
-
-	return mImageFileName;
+QString DkZipContainer::getImageFileName() const
+{
+    return mImageFileName;
 }
 
-QString DkZipContainer::getEncodedFilePath() const {
-
-	return mEncodedFilePath;
+QString DkZipContainer::getEncodedFilePath() const
+{
+    return mEncodedFilePath;
 }
 
-QString DkZipContainer::zipMarker() {
-
-	return mZipMarker;
+QString DkZipContainer::zipMarker()
+{
+    return mZipMarker;
 }
 
 #endif
 
 // DkRawLoader --------------------------------------------------------------------
-DkRawLoader::DkRawLoader(const QString & filePath, const QSharedPointer<DkMetaDataT>& metaData) {
-	mFilePath = filePath;
-	mMetaData = metaData;
+DkRawLoader::DkRawLoader(const QString &filePath, const QSharedPointer<DkMetaDataT> &metaData)
+{
+    mFilePath = filePath;
+    mMetaData = metaData;
 }
 
-bool DkRawLoader::isEmpty() const {
-	return mFilePath.isEmpty();
+bool DkRawLoader::isEmpty() const
+{
+    return mFilePath.isEmpty();
 }
 
-void DkRawLoader::setLoadFast(bool fast) {
-	mLoadFast = fast;
+void DkRawLoader::setLoadFast(bool fast)
+{
+    mLoadFast = fast;
 }
 
-bool DkRawLoader::load(const QSharedPointer<QByteArray> ba) {
-
-	DkTimer dt;
+bool DkRawLoader::load(const QSharedPointer<QByteArray> ba)
+{
+    DkTimer dt;
 
-	// try fetching the preview
-	if (loadPreview(ba))
-		return true;
+    // try fetching the preview
+    if (loadPreview(ba))
+        return true;
 
 #ifdef WITH_LIBRAW
-	
-	try {
 
-		// open the buffer
-		LibRaw iProcessor;
+    try {
+        // open the buffer
+        LibRaw iProcessor;
 
-		if (!openBuffer(ba, iProcessor)) {
-			qDebug() << "could not open buffer for" << mFilePath;
-			return false;
-		}
+        if (!openBuffer(ba, iProcessor)) {
+            qDebug() << "could not open buffer for" << mFilePath;
+            return false;
+        }
 
-		// check camera models for specific hacks
-		detectSpecialCamera(iProcessor);
+        // check camera models for specific hacks
+        detectSpecialCamera(iProcessor);
 
-		// try loading RAW preview
-		if (mLoadFast) {
-			mImg = loadPreviewRaw(iProcessor);
+        // try loading RAW preview
+        if (mLoadFast) {
+            mImg = loadPreviewRaw(iProcessor);
 
-			// are we done already?
-			if (!mImg.isNull())
-				return true;
-		}
+            // are we done already?
+            if (!mImg.isNull())
+                return true;
+        }
 
-		//unpack the data
-		int error = iProcessor.unpack();
-		if (std::strcmp(iProcessor.version(), "0.13.5") != 0)	// fixes a bug specific to libraw 13 - version call is UNTESTED
-			iProcessor.raw2image();
+        // unpack the data
+        int error = iProcessor.unpack();
+        if (std::strcmp(iProcessor.version(), "0.13.5") != 0) // fixes a bug specific to libraw 13 - version call is UNTESTED
+            iProcessor.raw2image();
 
-		if (error != LIBRAW_SUCCESS)
-			return false;
+        if (error != LIBRAW_SUCCESS)
+            return false;
 
-		// develop using libraw
-		if (mCamType == camera_unknown) {
-			error = iProcessor.dcraw_process();
+        // develop using libraw
+        if (mCamType == camera_unknown) {
+            error = iProcessor.dcraw_process();
 
-			auto rimg = iProcessor.dcraw_make_mem_image();
+            auto rimg = iProcessor.dcraw_make_mem_image();
 
-			if (rimg) {
+            if (rimg) {
+                mImg = QImage(rimg->data, rimg->width, rimg->height, rimg->width * 3, QImage::Format_RGB888);
+                mImg = mImg.copy(); // make a deep copy...
+                LibRaw::dcraw_clear_mem(rimg);
 
-				mImg = QImage(rimg->data, rimg->width, rimg->height, rimg->width * 3, QImage::Format_RGB888);
-				mImg = mImg.copy();		// make a deep copy...
-				LibRaw::dcraw_clear_mem(rimg);
+                return true;
+            }
+        }
 
-				return true;
-			}
-		}
+        // demosaic image
+        cv::Mat rawMat;
 
-		// demosaic image
-		cv::Mat rawMat;
+        if (iProcessor.imgdata.idata.filters)
+            rawMat = demosaic(iProcessor);
+        else
+            rawMat = prepareImg(iProcessor);
 
-		if (iProcessor.imgdata.idata.filters)
-			rawMat = demosaic(iProcessor);
-		else
-			rawMat = prepareImg(iProcessor);
+        // color correction + white balance
+        if (mIsChromatic) {
+            whiteBalance(iProcessor, rawMat);
+        }
 
-		// color correction + white balance
-		if (mIsChromatic) {
-			whiteBalance(iProcessor, rawMat);
-		}
-		
-		// gamma correction
-		gammaCorrection(iProcessor, rawMat);
+        // gamma correction
+        gammaCorrection(iProcessor, rawMat);
 
-		// reduce color noise
-		if (DkSettingsManager::param().resources().filterRawImages && mIsChromatic)
-			reduceColorNoise(iProcessor, rawMat);
+        // reduce color noise
+        if (DkSettingsManager::param().resources().filterRawImages && mIsChromatic)
+            reduceColorNoise(iProcessor, rawMat);
 
-		mImg = raw2Img(iProcessor, rawMat);
+        mImg = raw2Img(iProcessor, rawMat);
 
-		//qDebug() << "img size" << mImg.size();
-		//qDebug() << "raw mat size" << rawMat.rows << "x" << rawMat.cols;
-		iProcessor.recycle();
-		rawMat.release();
-	}
-	catch (...) {
-		qDebug() << "[RAW] error during processing...";
-		return false;
-	}
+        // qDebug() << "img size" << mImg.size();
+        // qDebug() << "raw mat size" << rawMat.rows << "x" << rawMat.cols;
+        iProcessor.recycle();
+        rawMat.release();
+    } catch (...) {
+        qDebug() << "[RAW] error during processing...";
+        return false;
+    }
 
-	qInfo() << "[RAW] loaded in " << dt;
+    qInfo() << "[RAW] loaded in " << dt;
 
 #endif
 
-	return !mImg.isNull();
+    return !mImg.isNull();
 }
 
-QImage DkRawLoader::image() const {
-	return mImg;
+QImage DkRawLoader::image() const
+{
+    return mImg;
 }
 
-bool DkRawLoader::loadPreview(const QSharedPointer<QByteArray>& ba) {
-
-	try {
-
-		// try to get preview image from exiv2
-		if (mMetaData) {
-			if (mLoadFast || DkSettingsManager::param().resources().loadRawThumb == DkSettings::raw_thumb_always ||
-				DkSettingsManager::param().resources().loadRawThumb == DkSettings::raw_thumb_if_large) {
-
-				mMetaData->readMetaData(mFilePath, ba);
-
-				int minWidth = 0;
-
-#ifdef WITH_LIBRAW	// if nomacs has libraw - we can still hope for a fallback -> otherwise try whatever we have here
-				if (DkSettingsManager::param().resources().loadRawThumb == DkSettings::raw_thumb_if_large)
-					minWidth = 1920;
+bool DkRawLoader::loadPreview(const QSharedPointer<QByteArray> &ba)
+{
+    try {
+        // try to get preview image from exiv2
+        if (mMetaData) {
+            if (mLoadFast || DkSettingsManager::param().resources().loadRawThumb == DkSettings::raw_thumb_always
+                || DkSettingsManager::param().resources().loadRawThumb == DkSettings::raw_thumb_if_large) {
+                mMetaData->readMetaData(mFilePath, ba);
+
+                int minWidth = 0;
+
+#ifdef WITH_LIBRAW // if nomacs has libraw - we can still hope for a fallback -> otherwise try whatever we have here
+                if (DkSettingsManager::param().resources().loadRawThumb == DkSettings::raw_thumb_if_large)
+                    minWidth = 1920;
 #endif
-				mImg = mMetaData->getPreviewImage(minWidth);
+                mImg = mMetaData->getPreviewImage(minWidth);
 
-				if (!mImg.isNull()) {
-					qDebug() << "[RAW] loaded with exiv2";
-					return true;
-				}
-			}
-		}
-	}
-	catch (...) {
-		qWarning() << "Exception caught during fetching RAW from thumbnail...";
-	}
+                if (!mImg.isNull()) {
+                    qDebug() << "[RAW] loaded with exiv2";
+                    return true;
+                }
+            }
+        }
+    } catch (...) {
+        qWarning() << "Exception caught during fetching RAW from thumbnail...";
+    }
 
-	return false;
+    return false;
 }
 
-
 #ifdef WITH_LIBRAW
 
 // here are some hints from earlier days...
 //// (-w) Use camera white balance, if possible (otherwise, fallback to auto_wb)
-//iProcessor.imgdata.params.use_camera_wb = 1;
+// iProcessor.imgdata.params.use_camera_wb = 1;
 //// (-a) Use automatic white balance obtained after averaging over the entire image
-//iProcessor.imgdata.params.use_auto_wb = 1;
+// iProcessor.imgdata.params.use_auto_wb = 1;
 //// (-q 3) Adaptive homogeneity-directed de-mosaicing algorithm (AHD)
-//iProcessor.imgdata.params.user_qual = 3;
-//iProcessor.imgdata.params.output_tiff = 1;
+// iProcessor.imgdata.params.user_qual = 3;
+// iProcessor.imgdata.params.output_tiff = 1;
 ////iProcessor.imgdata.params.four_color_rgb = 1;
 ////iProcessor.imgdata.params.output_color = 1; //sRGB  (0...raw)
 //// RAW data filtration mode during data unpacking and post-processing
-//iProcessor.imgdata.params.filtering_mode = LIBRAW_FILTERING_AUTOMATIC;
+// iProcessor.imgdata.params.filtering_mode = LIBRAW_FILTERING_AUTOMATIC;
 
+QImage DkRawLoader::loadPreviewRaw(LibRaw &iProcessor) const
+{
+    int tW = iProcessor.imgdata.thumbnail.twidth;
+
+    if (DkSettingsManager::param().resources().loadRawThumb == DkSettings::raw_thumb_always
+        || (DkSettingsManager::param().resources().loadRawThumb == DkSettings::raw_thumb_if_large && tW >= 1920)) {
+        // crashes here if image is broken
+        int err = iProcessor.unpack_thumb();
+        char *tPtr = iProcessor.imgdata.thumbnail.thumb;
+
+        if (!err && tPtr) {
+            QImage img;
+            img.loadFromData((const uchar *)tPtr, iProcessor.imgdata.thumbnail.tlength);
+
+            // we're good to go
+            if (!img.isNull()) {
+                qDebug() << "[RAW] I loaded the RAW's thumbnail";
+                return img;
+            } else
+                qDebug() << "RAW could not load the thumb";
+        } else
+            qDebug() << "error unpacking the thumb...";
+    }
 
-QImage DkRawLoader::loadPreviewRaw(LibRaw & iProcessor) const {
-	
-	int tW = iProcessor.imgdata.thumbnail.twidth;
-
-	if (DkSettingsManager::param().resources().loadRawThumb == DkSettings::raw_thumb_always ||
-		(DkSettingsManager::param().resources().loadRawThumb == DkSettings::raw_thumb_if_large && tW >= 1920)) {
+    // default: return nothing
+    return QImage();
+}
 
-		// crashes here if image is broken
-		int err = iProcessor.unpack_thumb();
-		char* tPtr = iProcessor.imgdata.thumbnail.thumb;
+bool DkRawLoader::openBuffer(const QSharedPointer<QByteArray> &ba, LibRaw &iProcessor) const
+{
+    int error = LIBRAW_DATA_ERROR;
+
+    QFileInfo fi(mFilePath);
+
+    // use iprocessor from libraw to read the data
+    // OK - so LibRaw 0.17 cannot identify iiq files in the buffer - so we load them from the file
+    if (fi.suffix().contains("iiq", Qt::CaseInsensitive) || !ba || ba->isEmpty()) {
+        error = iProcessor.open_file(mFilePath.toStdString().c_str());
+    } else {
+        // the buffer check is because:
+        // libraw has an error when loading buffers if the first 4 bytes encode as 'RIFF'
+        // and no data follows at all
+        if (ba->isEmpty() || ba->size() < 100)
+            return false;
+
+        error = iProcessor.open_buffer((void *)ba->constData(), ba->size());
+    }
 
-		if (!err && tPtr) {
+    return (error == LIBRAW_SUCCESS);
+}
 
-			QImage img;
-			img.loadFromData((const uchar*)tPtr, iProcessor.imgdata.thumbnail.tlength);
+void DkRawLoader::detectSpecialCamera(const LibRaw &iProcessor)
+{
+    if (QString(iProcessor.imgdata.idata.model) == "IQ260 Achromatic")
+        mIsChromatic = false;
 
-			// we're good to go
-			if (!img.isNull()) {
-				qDebug() << "[RAW] I loaded the RAW's thumbnail";
-				return img;
-			}
-			else
-				qDebug() << "RAW could not load the thumb";
-		}
-		else
-			qDebug() << "error unpacking the thumb...";
-	}
+    if (QString(iProcessor.imgdata.idata.model).contains("IQ260"))
+        mCamType = camera_iiq;
+    else if (QString(iProcessor.imgdata.idata.make).compare("Canon", Qt::CaseInsensitive))
+        mCamType = camera_canon;
 
-	// default: return nothing
-	return QImage();
+    // add your camera flag (for hacks) here
 }
 
-bool DkRawLoader::openBuffer(const QSharedPointer<QByteArray>& ba, LibRaw& iProcessor) const {
+cv::Mat DkRawLoader::demosaic(LibRaw &iProcessor) const
+{
+    cv::Mat rawMat = cv::Mat(iProcessor.imgdata.sizes.height, iProcessor.imgdata.sizes.width, CV_16UC1);
+    double dynamicRange = (double)(iProcessor.imgdata.color.maximum - iProcessor.imgdata.color.black);
 
-	int error = LIBRAW_DATA_ERROR;
+    // normalize all image values
+    for (int rIdx = 0; rIdx < rawMat.rows; rIdx++) {
+        unsigned short *ptrRaw = rawMat.ptr<unsigned short>(rIdx);
 
-	QFileInfo fi(mFilePath);
+        for (int cIdx = 0; cIdx < rawMat.cols; cIdx++) {
+            int colIdx = iProcessor.COLOR(rIdx, cIdx);
+            double val = (double)(iProcessor.imgdata.image[(rawMat.cols * rIdx) + cIdx][colIdx]);
 
-	//use iprocessor from libraw to read the data
-	// OK - so LibRaw 0.17 cannot identify iiq files in the buffer - so we load them from the file
-	if (fi.suffix().contains("iiq", Qt::CaseInsensitive) || !ba || ba->isEmpty()) {
-		error = iProcessor.open_file(mFilePath.toStdString().c_str());
-	}
-	else {
-		// the buffer check is because:
-		// libraw has an error when loading buffers if the first 4 bytes encode as 'RIFF'
-		// and no data follows at all
-		if (ba->isEmpty() || ba->size() < 100)
-			return false;
+            // normalize the value w.r.t the black point defined
+            val = (val - iProcessor.imgdata.color.black) / dynamicRange;
+            ptrRaw[cIdx] = clip<unsigned short>(val * USHRT_MAX); // for conversion to 16U
+        }
+    }
 
-		error = iProcessor.open_buffer((void*)ba->constData(), ba->size());
-	}
+    // no demosaicing
+    if (mIsChromatic) {
+        unsigned long type = (unsigned long)iProcessor.imgdata.idata.filters;
+        type = type & 255;
+
+        cv::Mat rgbImg;
+
+        // define bayer pattern
+        if (type == 180) {
+            cvtColor(rawMat, rgbImg, CV_BayerBG2RGB); // bitmask  10 11 01 00  -> 3(G) 2(B) 1(G) 0(R) ->	RG RG RG
+                                                      //													GB GB GB
+        } else if (type == 30) {
+            cvtColor(rawMat, rgbImg, CV_BayerRG2RGB); // bitmask  00 01 11 10	-> 0 1 3 2
+        } else if (type == 225) {
+            cvtColor(rawMat, rgbImg, CV_BayerGB2RGB); // bitmask  11 10 00 01
+        } else if (type == 75) {
+            cvtColor(rawMat, rgbImg, CV_BayerGR2RGB); // bitmask  01 00 10 11
+        } else {
+            qWarning() << "Wrong Bayer Pattern (not BG, RG, GB, GR)\n";
+            return cv::Mat();
+        }
 
-	return (error == LIBRAW_SUCCESS);
-}
+        rawMat = rgbImg;
+    }
 
-void DkRawLoader::detectSpecialCamera(const LibRaw & iProcessor) {
+    // 16U (1 or 3 channeled) Mat
+    return rawMat;
+}
 
-	if (QString(iProcessor.imgdata.idata.model) == "IQ260 Achromatic")
-		mIsChromatic = false;
-	
-	if (QString(iProcessor.imgdata.idata.model).contains("IQ260"))
-		mCamType = camera_iiq;
-	else if (QString(iProcessor.imgdata.idata.make).compare("Canon", Qt::CaseInsensitive))
-		mCamType = camera_canon;
+cv::Mat DkRawLoader::prepareImg(const LibRaw &iProcessor) const
+{
+    cv::Mat rawMat = cv::Mat(iProcessor.imgdata.sizes.height, iProcessor.imgdata.sizes.width, CV_16UC3, cv::Scalar(0));
+    double dynamicRange = (double)(iProcessor.imgdata.color.maximum - iProcessor.imgdata.color.black);
+
+    // normalization function
+    auto normalize = [&](double val) {
+        val = (val - iProcessor.imgdata.color.black) / dynamicRange;
+        return clip<unsigned short>(val * USHRT_MAX);
+    };
+
+    for (int rIdx = 0; rIdx < rawMat.rows; rIdx++) {
+        unsigned short *ptrI = rawMat.ptr<unsigned short>(rIdx);
+
+        for (int cIdx = 0; cIdx < rawMat.cols; cIdx++) {
+            *ptrI = normalize(iProcessor.imgdata.image[rawMat.cols * rIdx + cIdx][0]);
+            ptrI++;
+            *ptrI = normalize(iProcessor.imgdata.image[rawMat.cols * rIdx + cIdx][1]);
+            ptrI++;
+            *ptrI = normalize(iProcessor.imgdata.image[rawMat.cols * rIdx + cIdx][2]);
+            ptrI++;
+        }
+    }
 
-	// add your camera flag (for hacks) here
+    return rawMat;
 }
 
-cv::Mat DkRawLoader::demosaic(LibRaw & iProcessor) const {
+cv::Mat DkRawLoader::whiteMultipliers(const LibRaw &iProcessor) const
+{
+    // get camera white balance multipliers
+    cv::Mat wm(1, 4, CV_32FC1);
 
-	cv::Mat rawMat = cv::Mat(iProcessor.imgdata.sizes.height, iProcessor.imgdata.sizes.width, CV_16UC1);
-	double dynamicRange = (double)(iProcessor.imgdata.color.maximum - iProcessor.imgdata.color.black);
+    float *wmp = wm.ptr<float>();
 
-	// normalize all image values
-	for (int rIdx = 0; rIdx < rawMat.rows; rIdx++) {
-		unsigned short *ptrRaw = rawMat.ptr<unsigned short>(rIdx);
+    for (int idx = 0; idx < wm.cols; idx++)
+        wmp[idx] = iProcessor.imgdata.color.cam_mul[idx];
 
-		for (int cIdx = 0; cIdx < rawMat.cols; cIdx++) {
+    if (wmp[3] == 0)
+        wmp[3] = wmp[1]; // take green (usually its RGBG)
 
-			int colIdx = iProcessor.COLOR(rIdx, cIdx);
-			double val = (double)(iProcessor.imgdata.image[(rawMat.cols*rIdx) + cIdx][colIdx]);
-			
-			// normalize the value w.r.t the black point defined
-			val = (val - iProcessor.imgdata.color.black) / dynamicRange;
-			ptrRaw[cIdx] = clip<unsigned short>(val * USHRT_MAX);  // for conversion to 16U
-		}
-	}
+    // normalize white balance multipliers
+    float w = (float)cv::sum(wm)[0] / 4.0f;
+    float maxW = 1.0f;
 
-	// no demosaicing
-	if (mIsChromatic) {
+    // clipping according the camera model
+    // if w > 2.0 maxW is 256, otherwise 512
+    // tested empirically
+    // check if it can be defined by some metadata settings?
+    if (w > 2.0f)
+        maxW = 255.0f;
+    if (w > 2.0f && mCamType == camera_canon)
+        maxW = 511.0f; // some cameras would even need ~800 - why?
 
-		unsigned long type = (unsigned long)iProcessor.imgdata.idata.filters;
-		type = type & 255;
+    // normalize white point
+    wm /= maxW;
 
-		cv::Mat rgbImg;
+    // 1 x 4 32FC1 white balance vector
+    return wm;
+}
 
-		//define bayer pattern
-		if (type == 180) {
-			cvtColor(rawMat, rgbImg, CV_BayerBG2RGB);		//bitmask  10 11 01 00  -> 3(G) 2(B) 1(G) 0(R) ->	RG RG RG
-															//													GB GB GB
-		}
-		else if (type == 30) {
-			cvtColor(rawMat, rgbImg, CV_BayerRG2RGB);		//bitmask  00 01 11 10	-> 0 1 3 2
-		}
-		else if (type == 225) {
-			cvtColor(rawMat, rgbImg, CV_BayerGB2RGB);		//bitmask  11 10 00 01
-		}
-		else if (type == 75) {
-			cvtColor(rawMat, rgbImg, CV_BayerGR2RGB);		//bitmask  01 00 10 11
-		}
-		else {
-			qWarning() << "Wrong Bayer Pattern (not BG, RG, GB, GR)\n";
-			return cv::Mat();
-		}
-
-		rawMat = rgbImg;
-	}
-
-	// 16U (1 or 3 channeled) Mat
-	return rawMat;
-}
-
-cv::Mat DkRawLoader::prepareImg(const LibRaw & iProcessor) const {
-
-	cv::Mat rawMat = cv::Mat(iProcessor.imgdata.sizes.height, iProcessor.imgdata.sizes.width, CV_16UC3, cv::Scalar(0));
-	double dynamicRange = (double)(iProcessor.imgdata.color.maximum - iProcessor.imgdata.color.black);
-
-	// normalization function
-	auto normalize = [&](double val) { 
-	
-		val = (val - iProcessor.imgdata.color.black) / dynamicRange;
-		return clip<unsigned short>(val * USHRT_MAX);
-	};
-
-	for (int rIdx = 0; rIdx < rawMat.rows; rIdx++) {
-		unsigned short *ptrI = rawMat.ptr<unsigned short>(rIdx);
-
-		for (int cIdx = 0; cIdx < rawMat.cols; cIdx++) {
-
-			*ptrI = normalize(iProcessor.imgdata.image[rawMat.cols*rIdx + cIdx][0]);
-			ptrI++;
-			*ptrI = normalize(iProcessor.imgdata.image[rawMat.cols*rIdx + cIdx][1]);
-			ptrI++;
-			*ptrI = normalize(iProcessor.imgdata.image[rawMat.cols*rIdx + cIdx][2]);
-			ptrI++;
-		}
-	}
-
-	return rawMat;
-}
-
-cv::Mat DkRawLoader::whiteMultipliers(const LibRaw & iProcessor) const {
-	
-	// get camera white balance multipliers
-	cv::Mat wm(1, 4, CV_32FC1);
-	
-	float* wmp = wm.ptr<float>();
-
-	for (int idx = 0; idx < wm.cols; idx++)
-		wmp[idx] = iProcessor.imgdata.color.cam_mul[idx];
-
-	if (wmp[3] == 0)
-		wmp[3] = wmp[1];	// take green (usually its RGBG)
-
-	// normalize white balance multipliers
-	float w = (float)cv::sum(wm)[0] / 4.0f;
-	float maxW = 1.0f;
-
-	//clipping according the camera model
-	//if w > 2.0 maxW is 256, otherwise 512
-	//tested empirically
-	//check if it can be defined by some metadata settings?
-	if (w > 2.0f)
-		maxW = 255.0f;
-	if (w > 2.0f && mCamType == camera_canon)
-		maxW = 511.0f;	// some cameras would even need ~800 - why?
-
-	//normalize white point
-	wm /= maxW;
-
-	// 1 x 4 32FC1 white balance vector
-	return wm;
-}
-
-cv::Mat DkRawLoader::gammaTable(const LibRaw & iProcessor) const {
-	
-	// OK this is an instance of reverse engineering:
-	// we found out that the values of (at least) the PhaseOne's achromatic back have to be doubled
-	// our images are no close to what their software (Capture One does) - only the gamma correction
-	// seems to be slightly different... -> now we can load compressed IIQs that are not supported by PS : )
-	double cameraHackMlp = (QString(iProcessor.imgdata.idata.model) == "IQ260 Achromatic") ? 2.0 : 1.0;
-
-	//read gamma value and create gamma table	
-	double gamma = (double)iProcessor.imgdata.params.gamm[0];
-	
-	cv::Mat gmt(1, USHRT_MAX, CV_16UC1);
-	unsigned short* gmtp = gmt.ptr<unsigned short>();
-	
-	for (int idx = 0; idx < gmt.cols; idx++) {
-		gmtp[idx] = clip<unsigned short>(qRound((1.099*std::pow((double)idx / USHRT_MAX, gamma) - 0.099) * 255 * cameraHackMlp));
-	}
-
-	// a 1 x 65535 U16 gamma table
-	return gmt;
-}
-
-void DkRawLoader::whiteBalance(const LibRaw & iProcessor, cv::Mat & img) const {
-
-	// white balance must not be empty at this point
-	cv::Mat wb = whiteMultipliers(iProcessor);
-	const float* wbp = wb.ptr<float>();
-	assert(wb.cols == 4);
-
-	for (int rIdx = 0; rIdx < img.rows; rIdx++) {
-		
-		unsigned short *ptr = img.ptr<unsigned short>(rIdx);
-		
-		for (int cIdx = 0; cIdx < img.cols; cIdx++) {
-			
-			//apply white balance correction
-			unsigned short r = clip<unsigned short>(*ptr		* wbp[0]);
-			unsigned short g = clip<unsigned short>(*(ptr+1)	* wbp[1]);
-			unsigned short b = clip<unsigned short>(*(ptr+2)	* wbp[2]);
-
-			//apply color correction					
-			int cr = qRound(iProcessor.imgdata.color.rgb_cam[0][0] * r + 
-							iProcessor.imgdata.color.rgb_cam[0][1] * g + 
-							iProcessor.imgdata.color.rgb_cam[0][2] * b);
-			int cg = qRound(iProcessor.imgdata.color.rgb_cam[1][0] * r + 
-							iProcessor.imgdata.color.rgb_cam[1][1] * g + 
-							iProcessor.imgdata.color.rgb_cam[1][2] * b);
-			int cb = qRound(iProcessor.imgdata.color.rgb_cam[2][0] * r + 
-							iProcessor.imgdata.color.rgb_cam[2][1] * g + 
-							iProcessor.imgdata.color.rgb_cam[2][2] * b);
-
-			// clip & save color corrected values
-			*ptr = clip<unsigned short>(cr);
-			ptr++;
-			*ptr = clip<unsigned short>(cg);
-			ptr++;
-			*ptr = clip<unsigned short>(cb);
-			ptr++;
-		}
-	}
-}
+cv::Mat DkRawLoader::gammaTable(const LibRaw &iProcessor) const
+{
+    // OK this is an instance of reverse engineering:
+    // we found out that the values of (at least) the PhaseOne's achromatic back have to be doubled
+    // our images are no close to what their software (Capture One does) - only the gamma correction
+    // seems to be slightly different... -> now we can load compressed IIQs that are not supported by PS : )
+    double cameraHackMlp = (QString(iProcessor.imgdata.idata.model) == "IQ260 Achromatic") ? 2.0 : 1.0;
 
-void DkRawLoader::gammaCorrection(const LibRaw & iProcessor, cv::Mat& img) const {
+    // read gamma value and create gamma table
+    double gamma = (double)iProcessor.imgdata.params.gamm[0];
 
-	// white balance must not be empty at this point
-	cv::Mat gt = gammaTable(iProcessor);
-	const unsigned short* gammaLookup = gt.ptr<unsigned short>();
-	assert(gt.cols == USHRT_MAX);
-	
-	for (int rIdx = 0; rIdx < img.rows; rIdx++) {
-
-		unsigned short *ptr = img.ptr<unsigned short>(rIdx);
-
-		for (int cIdx = 0; cIdx < img.cols * img.channels(); cIdx++) {
-
-			// values close to 0 are treated linear
-			if (ptr[cIdx] <= 5)	// 0.018 * 255
-				ptr[cIdx] = (unsigned short)qRound(ptr[cIdx] * (double)iProcessor.imgdata.params.gamm[1] / 255.0);
-			else
-				ptr[cIdx] = gammaLookup[ptr[cIdx]];
-		}
-	}
-
-}
-
-void DkRawLoader::reduceColorNoise(const LibRaw & iProcessor, cv::Mat & img) const {
-
-	// filter color noise with a median filter
-	float isoSpeed = iProcessor.imgdata.other.iso_speed;
+    cv::Mat gmt(1, USHRT_MAX, CV_16UC1);
+    unsigned short *gmtp = gmt.ptr<unsigned short>();
 
-	if (isoSpeed > 0) {
+    for (int idx = 0; idx < gmt.cols; idx++) {
+        gmtp[idx] = clip<unsigned short>(qRound((1.099 * std::pow((double)idx / USHRT_MAX, gamma) - 0.099) * 255 * cameraHackMlp));
+    }
 
-		DkTimer dt;
+    // a 1 x 65535 U16 gamma table
+    return gmt;
+}
 
-		int winSize;
-		if (isoSpeed > 6400) 
-			winSize = 13;
-		else if (isoSpeed >= 3200) 
-			winSize = 11;
-		else if (isoSpeed >= 2500) 
-			winSize = 9;
-		else if (isoSpeed >= 400) 
-			winSize = 7;
-		else 
-			winSize = 5;
+void DkRawLoader::whiteBalance(const LibRaw &iProcessor, cv::Mat &img) const
+{
+    // white balance must not be empty at this point
+    cv::Mat wb = whiteMultipliers(iProcessor);
+    const float *wbp = wb.ptr<float>();
+    assert(wb.cols == 4);
+
+    for (int rIdx = 0; rIdx < img.rows; rIdx++) {
+        unsigned short *ptr = img.ptr<unsigned short>(rIdx);
+
+        for (int cIdx = 0; cIdx < img.cols; cIdx++) {
+            // apply white balance correction
+            unsigned short r = clip<unsigned short>(*ptr * wbp[0]);
+            unsigned short g = clip<unsigned short>(*(ptr + 1) * wbp[1]);
+            unsigned short b = clip<unsigned short>(*(ptr + 2) * wbp[2]);
+
+            // apply color correction
+            int cr =
+                qRound(iProcessor.imgdata.color.rgb_cam[0][0] * r + iProcessor.imgdata.color.rgb_cam[0][1] * g + iProcessor.imgdata.color.rgb_cam[0][2] * b);
+            int cg =
+                qRound(iProcessor.imgdata.color.rgb_cam[1][0] * r + iProcessor.imgdata.color.rgb_cam[1][1] * g + iProcessor.imgdata.color.rgb_cam[1][2] * b);
+            int cb =
+                qRound(iProcessor.imgdata.color.rgb_cam[2][0] * r + iProcessor.imgdata.color.rgb_cam[2][1] * g + iProcessor.imgdata.color.rgb_cam[2][2] * b);
+
+            // clip & save color corrected values
+            *ptr = clip<unsigned short>(cr);
+            ptr++;
+            *ptr = clip<unsigned short>(cg);
+            ptr++;
+            *ptr = clip<unsigned short>(cb);
+            ptr++;
+        }
+    }
+}
 
-		DkTimer dMed;
-		
-		// revert back to 8-bit image
-		img.convertTo(img, CV_8U);
+void DkRawLoader::gammaCorrection(const LibRaw &iProcessor, cv::Mat &img) const
+{
+    // white balance must not be empty at this point
+    cv::Mat gt = gammaTable(iProcessor);
+    const unsigned short *gammaLookup = gt.ptr<unsigned short>();
+    assert(gt.cols == USHRT_MAX);
+
+    for (int rIdx = 0; rIdx < img.rows; rIdx++) {
+        unsigned short *ptr = img.ptr<unsigned short>(rIdx);
+
+        for (int cIdx = 0; cIdx < img.cols * img.channels(); cIdx++) {
+            // values close to 0 are treated linear
+            if (ptr[cIdx] <= 5) // 0.018 * 255
+                ptr[cIdx] = (unsigned short)qRound(ptr[cIdx] * (double)iProcessor.imgdata.params.gamm[1] / 255.0);
+            else
+                ptr[cIdx] = gammaLookup[ptr[cIdx]];
+        }
+    }
+}
+
+void DkRawLoader::reduceColorNoise(const LibRaw &iProcessor, cv::Mat &img) const
+{
+    // filter color noise with a median filter
+    float isoSpeed = iProcessor.imgdata.other.iso_speed;
+
+    if (isoSpeed > 0) {
+        DkTimer dt;
+
+        int winSize;
+        if (isoSpeed > 6400)
+            winSize = 13;
+        else if (isoSpeed >= 3200)
+            winSize = 11;
+        else if (isoSpeed >= 2500)
+            winSize = 9;
+        else if (isoSpeed >= 400)
+            winSize = 7;
+        else
+            winSize = 5;
+
+        DkTimer dMed;
 
-		cv::cvtColor(img, img, CV_RGB2YCrCb);
+        // revert back to 8-bit image
+        img.convertTo(img, CV_8U);
 
-		std::vector<cv::Mat> imgCh;
-		cv::split(img, imgCh);
-		assert(imgCh.size() == 3);
+        cv::cvtColor(img, img, CV_RGB2YCrCb);
 
-		cv::medianBlur(imgCh[1], imgCh[1], winSize);
-		cv::medianBlur(imgCh[2], imgCh[2], winSize);
-
-		cv::merge(imgCh, img);
-		cv::cvtColor(img, img, CV_YCrCb2RGB);
-		qDebug() << "median blur takes:" << dt;
-	}
+        std::vector<cv::Mat> imgCh;
+        cv::split(img, imgCh);
+        assert(imgCh.size() == 3);
 
+        cv::medianBlur(imgCh[1], imgCh[1], winSize);
+        cv::medianBlur(imgCh[2], imgCh[2], winSize);
+
+        cv::merge(imgCh, img);
+        cv::cvtColor(img, img, CV_YCrCb2RGB);
+        qDebug() << "median blur takes:" << dt;
+    }
 }
 
-QImage DkRawLoader::raw2Img(const LibRaw & iProcessor, cv::Mat & img) const {
-	
-	//check the pixel aspect ratio of the raw image
-	if (iProcessor.imgdata.sizes.pixel_aspect != 1.0f)
-		cv::resize(img, img, cv::Size(), (double)iProcessor.imgdata.sizes.pixel_aspect, 1.0f);
-	
-	// revert back to 8-bit image
-	img.convertTo(img, CV_8U);
+QImage DkRawLoader::raw2Img(const LibRaw &iProcessor, cv::Mat &img) const
+{
+    // check the pixel aspect ratio of the raw image
+    if (iProcessor.imgdata.sizes.pixel_aspect != 1.0f)
+        cv::resize(img, img, cv::Size(), (double)iProcessor.imgdata.sizes.pixel_aspect, 1.0f);
 
-	// TODO: for now - fix this!
-	if (img.channels() == 1)
-		cv::cvtColor(img, img, CV_GRAY2RGB);
+    // revert back to 8-bit image
+    img.convertTo(img, CV_8U);
 
+    // TODO: for now - fix this!
+    if (img.channels() == 1)
+        cv::cvtColor(img, img, CV_GRAY2RGB);
 
-	return DkImage::mat2QImage(img);
+    return DkImage::mat2QImage(img);
 }
 
 #endif
 
-// -------------------------------------------------------------------- DkTgaLoader 
-namespace tga {
-	
-	DkTgaLoader::DkTgaLoader(QSharedPointer<QByteArray> ba) {
-
-		mBa = ba;
-	}
-
-	QImage DkTgaLoader::image() const {
-		return mImg;
-	}
-
-	bool DkTgaLoader::load() {
-		
-		if (!mBa || mBa->isEmpty())
-			return false;
-		
-		return load(mBa);
-	}
-
-	bool DkTgaLoader::load(QSharedPointer<QByteArray> ba) {
-		
-
-		// this code is from: http://www.paulbourke.net/dataformats/tga/
-		// thanks!
-		Header header;
-
-		const char* dataC = ba->data();
-
-		/* Display the header fields */
-		header.idlength = *dataC; dataC++;
-		header.colourmaptype = *dataC; dataC++;
-		header.datatypecode = *dataC; dataC++;
-
-		const short* dataS = (const short*)dataC;
-
-		header.colourmaporigin = *dataS; dataS++;
-		header.colourmaplength = *dataS; dataS++;
-		dataC = (const char*)dataS;
-		header.colourmapdepth = *dataC; dataC++;
-		dataS = (const short*)dataC;
-		header.x_origin = *dataS; dataS++;
-		header.y_origin = *dataS; dataS++;
-		header.width = *dataS; dataS++;
-		header.height = *dataS; dataS++;
-		dataC = (const char*)dataS;
-		header.bitsperpixel = *dataC; dataC++;
-		header.imagedescriptor = *dataC; dataC++;
+// -------------------------------------------------------------------- DkTgaLoader
+namespace tga
+{
+DkTgaLoader::DkTgaLoader(QSharedPointer<QByteArray> ba)
+{
+    mBa = ba;
+}
+
+QImage DkTgaLoader::image() const
+{
+    return mImg;
+}
+
+bool DkTgaLoader::load()
+{
+    if (!mBa || mBa->isEmpty())
+        return false;
+
+    return load(mBa);
+}
+
+bool DkTgaLoader::load(QSharedPointer<QByteArray> ba)
+{
+    // this code is from: http://www.paulbourke.net/dataformats/tga/
+    // thanks!
+    Header header;
+
+    const char *dataC = ba->data();
+
+    /* Display the header fields */
+    header.idlength = *dataC;
+    dataC++;
+    header.colourmaptype = *dataC;
+    dataC++;
+    header.datatypecode = *dataC;
+    dataC++;
+
+    const short *dataS = (const short *)dataC;
+
+    header.colourmaporigin = *dataS;
+    dataS++;
+    header.colourmaplength = *dataS;
+    dataS++;
+    dataC = (const char *)dataS;
+    header.colourmapdepth = *dataC;
+    dataC++;
+    dataS = (const short *)dataC;
+    header.x_origin = *dataS;
+    dataS++;
+    header.y_origin = *dataS;
+    dataS++;
+    header.width = *dataS;
+    dataS++;
+    header.height = *dataS;
+    dataS++;
+    dataC = (const char *)dataS;
+    header.bitsperpixel = *dataC;
+    dataC++;
+    header.imagedescriptor = *dataC;
+    dataC++;
 
 #ifdef _DEBUG
-		qDebug() << "TGA Header ------------------------------";
-		qDebug() << "ID length:         " << (int)header.idlength;
-		qDebug() << "Colourmap type:    " << (int)header.colourmaptype;
-		qDebug() << "Image type:        " << (int)header.datatypecode;
-		qDebug() << "Colour map offset: " << header.colourmaporigin;
-		qDebug() << "Colour map length: " << header.colourmaplength;
-		qDebug() << "Colour map depth:  " << (int)header.colourmapdepth;
-		qDebug() << "X origin:          " << header.x_origin;
-		qDebug() << "Y origin:          " << header.y_origin;
-		qDebug() << "Width:             " << header.width;
-		qDebug() << "Height:            " << header.height;
-		qDebug() << "Bits per pixel:    " << (int)header.bitsperpixel;
-		qDebug() << "Descriptor:        " << (int)header.imagedescriptor;
+    qDebug() << "TGA Header ------------------------------";
+    qDebug() << "ID length:         " << (int)header.idlength;
+    qDebug() << "Colourmap type:    " << (int)header.colourmaptype;
+    qDebug() << "Image type:        " << (int)header.datatypecode;
+    qDebug() << "Colour map offset: " << header.colourmaporigin;
+    qDebug() << "Colour map length: " << header.colourmaplength;
+    qDebug() << "Colour map depth:  " << (int)header.colourmapdepth;
+    qDebug() << "X origin:          " << header.x_origin;
+    qDebug() << "Y origin:          " << header.y_origin;
+    qDebug() << "Width:             " << header.width;
+    qDebug() << "Height:            " << header.height;
+    qDebug() << "Bits per pixel:    " << (int)header.bitsperpixel;
+    qDebug() << "Descriptor:        " << (int)header.imagedescriptor;
 #endif
 
-		/* What can we handle */
-		if (header.datatypecode != 2 && header.datatypecode != 10) {
-			qWarning() << "Can only handle image type 2 and 10";
-			return false;
-		}
-		
-		if (header.bitsperpixel != 16 &&
-			header.bitsperpixel != 24 && 
-			header.bitsperpixel != 32) {
-			qWarning() << "Can only handle pixel depths of 16, 24, and 32";
-			return false;
-		}
-
-		if (header.colourmaptype != 0 && header.colourmaptype != 1) {
-			qWarning() << "Can only handle colour map types of 0 and 1";
-			return false;
-		}
-
-		Pixel *pixels = new Pixel[header.width*header.height * sizeof(Pixel)];
-
-		if (!pixels) {
-			qWarning() << "TGA: could not allocate" << header.width*header.height * sizeof(Pixel)/1024 << "KB";
-			return false;
-		}
-
-		///* Skip over unnecessary stuff */
-		int skipover = header.idlength;
-		skipover += header.colourmaptype * header.colourmaplength;
-		dataC += skipover;
-		
-		/* Read the image */
-		int bytes2read = header.bitsperpixel / 8;	// save?
-		unsigned char p[5];
-		
-		for (int n = 0; n < header.width * header.height;) {
-			
-			if (header.datatypecode == 2) {                     /* Uncompressed */
-				
-				// TODO: out-of-bounds not checked here...
-				for (int bi = 0; bi < bytes2read; bi++, dataC++)
-					p[bi] = *dataC;
-				
-				mergeBytes(&(pixels[n]), p, bytes2read);
-				n++;
-			}
-			else if (header.datatypecode == 10) {             /* Compressed */
-				
-				for (int bi = 0; bi < bytes2read+1; bi++, dataC++)
-					p[bi] = *dataC;
-
-				int j = p[0] & 0x7f;
-				mergeBytes(&(pixels[n]), &(p[1]), bytes2read);
-				n++;
-				if (p[0] & 0x80) {         /* RLE chunk */
-					for (int i = 0; i < j; i++) {
-						mergeBytes(&(pixels[n]), &(p[1]), bytes2read);
-						n++;
-					}
-				}
-				else {                   /* Normal chunk */
-					for (int i = 0; i < j; i++) {
-
-						for (int bi = 0; bi < bytes2read; bi++, dataC++)
-							p[bi] = *dataC;
-
-						mergeBytes(&(pixels[n]), p, bytes2read);
-						n++;
-					}
-				}
-			}
-		}
-
-		mImg = QImage((uchar*)pixels, header.width, header.height, QImage::Format_ARGB32);
-		mImg = mImg.copy();
-
-		// I somehow expected the 5th bit to be 0x10 -> but Paul seems to have a 0th bit : )
-		if (!(header.imagedescriptor & 0x20))
-			mImg = mImg.mirrored();
-
-		delete[] pixels;
-
-		return true;
-	}
-
-	void DkTgaLoader::mergeBytes(Pixel * pixel, unsigned char * p, int bytes) const {
-		
-		if (bytes == 4) {
-			pixel->r = p[0];
-			pixel->g = p[1];
-			pixel->b = p[2];
-			pixel->a = p[3];
-		}
-		else if (bytes == 3) {
-			pixel->r = p[0];
-			pixel->g = p[1];
-			pixel->b = p[2];
-			pixel->a = 255;
-		}
-		else if (bytes == 2) {
-			pixel->r = (p[0] & 0x1f) << 3;
-			pixel->g = ((p[1] & 0x03) << 6) | ((p[0] & 0xe0) >> 2);
-			pixel->b = (p[1] & 0x7c) << 1;
-			pixel->a = 255;// (p[1] & 0x80);
-		}
-	}
+    /* What can we handle */
+    if (header.datatypecode != 2 && header.datatypecode != 10) {
+        qWarning() << "Can only handle image type 2 and 10";
+        return false;
+    }
+
+    if (header.bitsperpixel != 16 && header.bitsperpixel != 24 && header.bitsperpixel != 32) {
+        qWarning() << "Can only handle pixel depths of 16, 24, and 32";
+        return false;
+    }
+
+    if (header.colourmaptype != 0 && header.colourmaptype != 1) {
+        qWarning() << "Can only handle colour map types of 0 and 1";
+        return false;
+    }
+
+    Pixel *pixels = new Pixel[header.width * header.height * sizeof(Pixel)];
+
+    if (!pixels) {
+        qWarning() << "TGA: could not allocate" << header.width * header.height * sizeof(Pixel) / 1024 << "KB";
+        return false;
+    }
+
+    ///* Skip over unnecessary stuff */
+    int skipover = header.idlength;
+    skipover += header.colourmaptype * header.colourmaplength;
+    dataC += skipover;
+
+    /* Read the image */
+    int bytes2read = header.bitsperpixel / 8; // save?
+    unsigned char p[5];
+
+    for (int n = 0; n < header.width * header.height;) {
+        if (header.datatypecode == 2) { /* Uncompressed */
+
+            // TODO: out-of-bounds not checked here...
+            for (int bi = 0; bi < bytes2read; bi++, dataC++)
+                p[bi] = *dataC;
+
+            mergeBytes(&(pixels[n]), p, bytes2read);
+            n++;
+        } else if (header.datatypecode == 10) { /* Compressed */
+
+            for (int bi = 0; bi < bytes2read + 1; bi++, dataC++)
+                p[bi] = *dataC;
+
+            int j = p[0] & 0x7f;
+            mergeBytes(&(pixels[n]), &(p[1]), bytes2read);
+            n++;
+            if (p[0] & 0x80) { /* RLE chunk */
+                for (int i = 0; i < j; i++) {
+                    mergeBytes(&(pixels[n]), &(p[1]), bytes2read);
+                    n++;
+                }
+            } else { /* Normal chunk */
+                for (int i = 0; i < j; i++) {
+                    for (int bi = 0; bi < bytes2read; bi++, dataC++)
+                        p[bi] = *dataC;
+
+                    mergeBytes(&(pixels[n]), p, bytes2read);
+                    n++;
+                }
+            }
+        }
+    }
+
+    mImg = QImage((uchar *)pixels, header.width, header.height, QImage::Format_ARGB32);
+    mImg = mImg.copy();
+
+    // I somehow expected the 5th bit to be 0x10 -> but Paul seems to have a 0th bit : )
+    if (!(header.imagedescriptor & 0x20))
+        mImg = mImg.mirrored();
+
+    delete[] pixels;
+
+    return true;
+}
+
+void DkTgaLoader::mergeBytes(Pixel *pixel, unsigned char *p, int bytes) const
+{
+    if (bytes == 4) {
+        pixel->r = p[0];
+        pixel->g = p[1];
+        pixel->b = p[2];
+        pixel->a = p[3];
+    } else if (bytes == 3) {
+        pixel->r = p[0];
+        pixel->g = p[1];
+        pixel->b = p[2];
+        pixel->a = 255;
+    } else if (bytes == 2) {
+        pixel->r = (p[0] & 0x1f) << 3;
+        pixel->g = ((p[1] & 0x03) << 6) | ((p[0] & 0xe0) >> 2);
+        pixel->b = (p[1] & 0x7c) << 1;
+        pixel->a = 255; // (p[1] & 0x80);
+    }
+}
 }
 
 }
diff --git a/ImageLounge/src/DkCore/DkBasicLoader.h b/ImageLounge/src/DkCore/DkBasicLoader.h
index 64bb591..4e39064 100644
--- a/ImageLounge/src/DkCore/DkBasicLoader.h
+++ b/ImageLounge/src/DkCore/DkBasicLoader.h
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkBasicLoader.h
  Created on:	21.02.2014
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2014 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2014 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2014 Florian Kleber <florian@nomacs.org>
@@ -27,16 +27,16 @@
 
 #pragma once
 
-#pragma warning(push, 0)    
+#pragma warning(push, 0)
+#include <QFutureWatcher>
+#include <QImage>
 #include <QNetworkAccessManager>
 #include <QSharedPointer>
-#include <QFutureWatcher>
 #include <QUrl>
-#include <QImage>
 #pragma warning(pop)
 
-#pragma warning(disable: 4251)	// TODO: remove
-//#include "DkImageStorage.h"
+#pragma warning(disable : 4251) // TODO: remove
+// #include "DkImageStorage.h"
 
 #ifndef Q_OS_WIN
 #include "qpsdhandler.h"
@@ -46,7 +46,7 @@
 #ifdef WITH_OPENCV
 
 #ifdef Q_OS_WIN
-#pragma warning(disable: 4996)
+#pragma warning(disable : 4996)
 #endif
 
 #include <opencv2/imgproc/imgproc.hpp>
@@ -66,386 +66,428 @@
 class QNetworkReply;
 class LibRaw;
 
-namespace nmc {
-
+namespace nmc
+{
 class DkMetaDataT;
 
 #ifdef WITH_QUAZIP
-class DllCoreExport DkZipContainer {
-
+class DllCoreExport DkZipContainer
+{
 public:
-	DkZipContainer(const QString& fileName);
-
-	bool isZip() const;
-	QString getZipFilePath() const;
-	QString getImageFileName() const;
-	QString getEncodedFilePath() const;
-	static QString zipMarker();
-	static QSharedPointer<QByteArray> extractImage(const QString& zipFile, const QString& imageFile);
-	static void extractImage(const QString& zipFile, const QString& imageFile, QByteArray& ba);
-	static QString decodeZipFile(const QString& encodedFileInfo);
-	static QString decodeImageFile(const QString& encodedFileInfo);
-	static QString encodeZipFile(const QString& zipFile, const QString& imageFile);
+    DkZipContainer(const QString &fileName);
+
+    bool isZip() const;
+    QString getZipFilePath() const;
+    QString getImageFileName() const;
+    QString getEncodedFilePath() const;
+    static QString zipMarker();
+    static QSharedPointer<QByteArray> extractImage(const QString &zipFile, const QString &imageFile);
+    static void extractImage(const QString &zipFile, const QString &imageFile, QByteArray &ba);
+    static QString decodeZipFile(const QString &encodedFileInfo);
+    static QString decodeImageFile(const QString &encodedFileInfo);
+    static QString encodeZipFile(const QString &zipFile, const QString &imageFile);
 
 protected:
-	QString mEncodedFilePath;
-	QString mZipFilePath;
-	QString mImageFileName;
-	bool mImageInZip;
-	static QString mZipMarker;
+    QString mEncodedFilePath;
+    QString mZipFilePath;
+    QString mImageFileName;
+    bool mImageInZip;
+    static QString mZipMarker;
 };
 #endif
 
-class DllCoreExport DkEditImage {
-
+class DllCoreExport DkEditImage
+{
 public:
-	DkEditImage(const QImage& img = QImage(), const QString& editName = "");
-
-	void setImage(const QImage& img);
-	QImage image() const;
-	QString editName() const;
-	int size() const;
+    DkEditImage();
+    DkEditImage(const QImage &img, const QSharedPointer<DkMetaDataT> &metaData, const QString &editName = "");
+    DkEditImage(const QSharedPointer<DkMetaDataT> &metaData, const QImage &img, const QString &editName = "");
+
+    void setImage(const QImage &img);
+    QString editName() const;
+    QImage image() const;
+    bool hasImage() const;
+    bool hasMetaData() const;
+    bool hasNewImage() const;
+    bool hasNewMetaData() const;
+    QSharedPointer<DkMetaDataT> metaData() const;
+    int size() const;
 
 protected:
-	QImage mImg;
-	QString mEditName;
-
+    QString mEditName;
+    QImage mImg;
+    bool mNewImg;
+    bool mNewMetaData;
+    QSharedPointer<DkMetaDataT> mMetaData;
 };
 
-class DllCoreExport DkRawLoader {
-
+class DllCoreExport DkRawLoader
+{
 public:
-	DkRawLoader(const QString& filePath, const QSharedPointer<DkMetaDataT>& metaData);
+    DkRawLoader(const QString &filePath, const QSharedPointer<DkMetaDataT> &metaData);
 
-	bool isEmpty() const;
-	void setLoadFast(bool fast);
+    bool isEmpty() const;
+    void setLoadFast(bool fast);
 
-	bool load(const QSharedPointer<QByteArray> ba = QSharedPointer<QByteArray>());
+    bool load(const QSharedPointer<QByteArray> ba = QSharedPointer<QByteArray>());
 
-	QImage image() const;
+    QImage image() const;
 
 protected:
-	QString mFilePath;
-	QSharedPointer<DkMetaDataT> mMetaData;
+    QString mFilePath;
+    QSharedPointer<DkMetaDataT> mMetaData;
 
-	QImage mImg;
+    QImage mImg;
 
-	enum Cam {
-		camera_unknown = 0,
-		camera_iiq,
-		camera_canon,
+    enum Cam {
+        camera_unknown = 0,
+        camera_iiq,
+        camera_canon,
 
-		camera_end
-	};
+        camera_end
+    };
 
-	bool mLoadFast = false;
-	bool mIsChromatic = true;
-	Cam mCamType = camera_unknown;
+    bool mLoadFast = false;
+    bool mIsChromatic = true;
+    Cam mCamType = camera_unknown;
 
-	bool loadPreview(const QSharedPointer<QByteArray>& ba);
+    bool loadPreview(const QSharedPointer<QByteArray> &ba);
 
 #ifdef WITH_LIBRAW
-	cv::Mat mColorMat;
-	cv::Mat mGammaTable;
-	
-	QImage loadPreviewRaw(LibRaw& iProcessor) const;
-	bool openBuffer(const QSharedPointer<QByteArray>& ba, LibRaw& iProcessor) const;
-	void detectSpecialCamera(const LibRaw& iProcessor);
+    cv::Mat mColorMat;
+    cv::Mat mGammaTable;
 
-	cv::Mat demosaic(LibRaw& iProcessor) const;
-	cv::Mat prepareImg(const LibRaw& iProcessor) const;
+    QImage loadPreviewRaw(LibRaw &iProcessor) const;
+    bool openBuffer(const QSharedPointer<QByteArray> &ba, LibRaw &iProcessor) const;
+    void detectSpecialCamera(const LibRaw &iProcessor);
 
-	cv::Mat whiteMultipliers(const LibRaw& iProcessor) const;
-	cv::Mat gammaTable(const LibRaw& iProcessor) const;
+    cv::Mat demosaic(LibRaw &iProcessor) const;
+    cv::Mat prepareImg(const LibRaw &iProcessor) const;
 
-	void whiteBalance(const LibRaw& iProcessor, cv::Mat& img) const;
+    cv::Mat whiteMultipliers(const LibRaw &iProcessor) const;
+    cv::Mat gammaTable(const LibRaw &iProcessor) const;
 
-	void gammaCorrection(const LibRaw& iProcessor, cv::Mat& img) const;
+    void whiteBalance(const LibRaw &iProcessor, cv::Mat &img) const;
 
-	void reduceColorNoise(const LibRaw& iProcessor, cv::Mat& img) const;
+    void gammaCorrection(const LibRaw &iProcessor, cv::Mat &img) const;
 
-	QImage raw2Img(const LibRaw& iProcessor, cv::Mat& img) const;
+    void reduceColorNoise(const LibRaw &iProcessor, cv::Mat &img) const;
 
-	template <typename num>
-	num clip(double val) const {
+    QImage raw2Img(const LibRaw &iProcessor, cv::Mat &img) const;
 
-		int vr = qRound(val);
+    template<typename num>
+    num clip(double val) const
+    {
+        int vr = qRound(val);
 
-		// trust me I'm an engineer @ -2
-		// with -2 we do not get pink in oversaturated areas
-		if (vr > std::numeric_limits<num>::max())
-			vr = std::numeric_limits<num>::max()-2;
-		if (vr < 0)
-			vr = 0;
+        // trust me I'm an engineer @ -2
+        // with -2 we do not get pink in oversaturated areas
+        if (vr > std::numeric_limits<num>::max())
+            vr = std::numeric_limits<num>::max() - 2;
+        if (vr < 0)
+            vr = 0;
 
-		return static_cast<num>(vr);
-	}
+        return static_cast<num>(vr);
+    }
 #endif
 };
 
 /**
  * This class provides image loading and editing capabilities.
  * It additionally stores the currently loaded image.
- **/ 
-class DllCoreExport DkBasicLoader : public QObject {
-	Q_OBJECT
+ **/
+class DllCoreExport DkBasicLoader : public QObject
+{
+    Q_OBJECT
 
 public:
-
-	enum mode {
-		mode_default,
-		mode_mat_preferred,
-		mode_end
-	};
-
-	enum loaderID {
-		no_loader = 0,
-		qt_loader,
-		psd_loader,
-		webp_loader,
-		raw_loader,
-		roh_loader,
-		hdr_loader,
-		tif_loader,
-		tga_loader,
-	};
-
-	DkBasicLoader(int mode = mode_default);
-
-	~DkBasicLoader() {
-		release(true);
-	};
-
-	/**
-	 * Convenience function.
-	 **/
-	bool loadGeneral(const QString& filePath, bool loadMetaData = false, bool fast = true);
-
-	/**
-	 * Loads the image for the given file
-	 * @param file an image file
-	 * @param skipIdx the number of (internal) pages to be skipped
-	 * @return bool true if the image was loaded
-	 **/
-	bool loadGeneral(const QString& filePath, const QSharedPointer<QByteArray> ba, bool loadMetaData = false, bool fast = true);
-
-	/**
-	 * Loads the page requested (with respect to the current page)
-	 * @param skipIdx number of pages to skip
-	 * @return bool true if we could load the page requested
-	 **/
-	bool loadPage(int skipIdx = 0);
-	bool loadPageAt(int pageIdx = 0);
-
-	int getNumPages() const {
-		return mNumPages;
-	};
-
-	int getPageIdx() const {
-		return mPageIdx;
-	};
-
-	bool setPageIdx(int skipIdx);
-	void resetPageIdx();
-
-	QString save(const QString& filePath, const QImage& img, int compression = -1);
-	bool saveToBuffer(const QString& filePath, const QImage& img, QSharedPointer<QByteArray>& ba, int compression = -1) const;
-	void saveThumbToMetaData(const QString& filePath, QSharedPointer<QByteArray>& ba);
-	void saveMetaData(const QString& filePath, QSharedPointer<QByteArray>& ba);
-	void saveThumbToMetaData(const QString& filePath);
-	void saveMetaData(const QString& filePath);
-
-	static bool isContainer(const QString& filePath);
-
-	/**
-	 * Sets a new image (if edited outside the basicLoader class)
-	 * @param img the new image
-	 * @param file assigns the current file name
-	 **/
-	void setImage(const QImage& img, const QString& editName, const QString& file);
-	void setEditImage(const QImage& img, const QString& editName = "");
-
-	void setTraining(bool training) {
-		training = true;
-	};
-
-	bool getTraining() {
-		return mTraining;
-	};
-
-	int getLoader() {
-		return mLoader;
-	};
-
-	QSharedPointer<DkMetaDataT> getMetaData() const {
-		return mMetaData;
-	};
-
-	/**
-	 * Returns the 8-bit image, which is rendered.
-	 * @return QImage an 8bit image
-	 **/
-	QImage image() const;
-
-	QString getFile() {
-		return mFile;
-	};
-
-	bool isDirty() {
-		return mPageIdxDirty;
-	};
-
-	/**
-	 * Returns the current image size.
-	 * @return QSize the image size.
-	 **/
-	QSize size() {
-		return image().size();
-	};
-
-	/**
-	 * Returns true if an image is currently loaded.
-	 * @return bool true if an image is loaded.
-	 **/
-	bool hasImage() {
-		return !image().isNull();
-	};
-
-	void undo();
-	void redo();
-	QVector<DkEditImage>* history();
-	DkEditImage lastEdit() const;
-
-	void setMinHistorySize(int size);
-	void setHistoryIndex(int idx);
-	int historyIndex() const;
-
-	void loadFileToBuffer(const QString& filePath, QByteArray& ba) const;
-	QSharedPointer<QByteArray> loadFileToBuffer(const QString& filePath) const;
-	bool writeBufferToFile(const QString& fileInfo, const QSharedPointer<QByteArray> ba) const;
-
-	void release(bool clear = false);
-
+    enum mode { mode_default, mode_mat_preferred, mode_end };
+
+    enum loaderID {
+        no_loader = 0,
+        qt_loader,
+        psd_loader,
+        webp_loader,
+        raw_loader,
+        roh_loader,
+        hdr_loader,
+        tif_loader,
+        tga_loader,
+    };
+
+    DkBasicLoader(int mode = mode_default);
+
+    ~DkBasicLoader()
+    {
+        release();
+    };
+
+    /**
+     * Convenience function.
+     **/
+    bool loadGeneral(const QString &filePath, bool loadMetaData = false, bool fast = true);
+
+    /**
+     * Loads the image for the given file
+     * @param file an image file
+     * @param skipIdx the number of (internal) pages to be skipped
+     * @return bool true if the image was loaded
+     **/
+    bool loadGeneral(const QString &filePath, const QSharedPointer<QByteArray> ba, bool loadMetaData = false, bool fast = true);
+
+    /**
+     * Loads the page requested (with respect to the current page)
+     * @param skipIdx number of pages to skip
+     * @return bool true if we could load the page requested
+     **/
+    bool loadPage(int skipIdx = 0);
+    bool loadPageAt(int pageIdx = 0);
+
+    int getNumPages() const
+    {
+        return mNumPages;
+    };
+
+    int getPageIdx() const
+    {
+        return mPageIdx;
+    };
+
+    bool setPageIdx(int skipIdx);
+    void resetPageIdx();
+
+    QString save(const QString &filePath, const QImage &img, int compression = -1);
+    bool saveToBuffer(const QString &filePath, const QImage &img, QSharedPointer<QByteArray> &ba, int compression = -1) const;
+    void saveThumbToMetaData(const QString &filePath, QSharedPointer<QByteArray> &ba);
+    void saveMetaData(const QString &filePath, QSharedPointer<QByteArray> &ba);
+    void saveThumbToMetaData(const QString &filePath);
+    void saveMetaData(const QString &filePath);
+
+    static bool isContainer(const QString &filePath);
+
+    /**
+     * Sets a new image (if edited outside the basicLoader class)
+     * @param img the new image
+     * @param file assigns the current file name
+     **/
+    void setImage(const QImage &img, const QString &editName, const QString &file);
+    void pruneEditHistory();
+    void setEditImage(const QImage &img, const QString &editName = "");
+    void setEditMetaData(const QSharedPointer<DkMetaDataT> &metaData, const QImage &img, const QString &editName = "");
+    void setEditMetaData(const QSharedPointer<DkMetaDataT> &metaData, const QString &editName = "");
+    void setEditMetaData(const QString &editName);
+
+    void setTraining(bool training)
+    {
+        training = true;
+    };
+
+    bool getTraining()
+    {
+        return mTraining;
+    };
+
+    int getLoader()
+    {
+        return mLoader;
+    };
+
+    QSharedPointer<DkMetaDataT> getMetaData() const;
+
+    /**
+     * Returns the 8-bit image, which is rendered.
+     * @return QImage an 8bit image
+     **/
+    QImage image() const;
+    QImage lastImage() const;
+    QImage pixmap() const;
+
+    QSharedPointer<DkMetaDataT> lastMetaDataEdit(bool return_nullptr = true, bool return_orig = false) const;
+
+    bool isImageEdited();
+    bool isMetaDataEdited();
+
+    QString getFile() const
+    {
+        return mFile;
+    };
+
+    bool isDirty() const
+    {
+        return mPageIdxDirty;
+    };
+
+    /**
+     * Returns the current image size.
+     * @return QSize the image size.
+     **/
+    QSize size()
+    {
+        return image().size();
+    };
+
+    /**
+     * Returns true if an image is currently loaded.
+     * @return bool true if an image is loaded.
+     **/
+    bool hasImage()
+    {
+        return !image().isNull();
+    };
+
+    void undo();
+    void redo();
+    QVector<DkEditImage> *history();
+    DkEditImage lastEdit() const;
+
+    void setMinHistorySize(int size);
+    void setHistoryIndex(int idx);
+    int historyIndex() const;
+
+    void loadFileToBuffer(const QString &filePath, QByteArray &ba) const;
+    QSharedPointer<QByteArray> loadFileToBuffer(const QString &filePath) const;
+    bool writeBufferToFile(const QString &fileInfo, const QSharedPointer<QByteArray> ba) const;
+
+    void release();
 
 #ifdef WITH_OPENCV
-	cv::Mat getImageCv();
-	bool loadOpenCVVecFile(const QString& filePath, QImage& img, QSharedPointer<QByteArray> ba = QSharedPointer<QByteArray>(), QSize s = QSize()) const;
-	cv::Mat getPatch(const unsigned char** dataPtr, QSize patchSize) const;
-	int mergeVecFiles(const QStringList& vecFilePaths, QString& saveFileInfo) const;
-	bool readHeader(const unsigned char** dataPtr, int& fileCount, int& vecSize) const;
-	void getPatchSizeFromFileName(const QString& fileName, int& width, int& height) const;
+    cv::Mat getImageCv();
+    bool loadOpenCVVecFile(const QString &filePath, QImage &img, QSharedPointer<QByteArray> ba = QSharedPointer<QByteArray>(), QSize s = QSize()) const;
+    cv::Mat getPatch(const unsigned char **dataPtr, QSize patchSize) const;
+    int mergeVecFiles(const QStringList &vecFilePaths, QString &saveFileInfo) const;
+    bool readHeader(const unsigned char **dataPtr, int &fileCount, int &vecSize) const;
+    void getPatchSizeFromFileName(const QString &fileName, int &width, int &height) const;
 #else
-	bool loadOpenCVVecFile(const QString&, QImage&, QSharedPointer<QByteArray> = QSharedPointer<QByteArray>(), QSize = QSize()) { return false; };
-	int mergeVecFiles(const QStringList&, QString&) const { return 0; };
-	bool readHeader(const unsigned char**, int&, int&) const { return false; };
-	void getPatchSizeFromFileName(const QString&, int&, int&) const {};
+    bool loadOpenCVVecFile(const QString &, QImage &, QSharedPointer<QByteArray> = QSharedPointer<QByteArray>(), QSize = QSize())
+    {
+        return false;
+    };
+    int mergeVecFiles(const QStringList &, QString &) const
+    {
+        return 0;
+    };
+    bool readHeader(const unsigned char **, int &, int &) const
+    {
+        return false;
+    };
+    void getPatchSizeFromFileName(const QString &, int &, int &) const {};
 
 #endif
 
-	bool loadPSDFile(const QString& filePath, QImage& img, QSharedPointer<QByteArray> ba = QSharedPointer<QByteArray>()) const;
-	bool loadTIFFile(const QString& filePath, QImage& img, QSharedPointer<QByteArray> ba = QSharedPointer<QByteArray>()) const;
-    bool loadDrifFile(const QString& filePath, QImage& img, QSharedPointer<QByteArray> ba = QSharedPointer<QByteArray>()) const;
+    bool loadPSDFile(const QString &filePath, QImage &img, QSharedPointer<QByteArray> ba = QSharedPointer<QByteArray>()) const;
+    bool loadTIFFile(const QString &filePath, QImage &img, QSharedPointer<QByteArray> ba = QSharedPointer<QByteArray>()) const;
+    bool loadDrifFile(const QString &filePath, QImage &img, QSharedPointer<QByteArray> ba = QSharedPointer<QByteArray>()) const;
 
 #ifdef Q_OS_WIN
-	bool saveWindowsIcon(const QString& filePath, const QImage& img) const;
-	bool saveWindowsIcon(const QImage& img, QSharedPointer<QByteArray>& ba) const;
+    bool saveWindowsIcon(const QString &filePath, const QImage &img) const;
+    bool saveWindowsIcon(const QImage &img, QSharedPointer<QByteArray> &ba) const;
 #else
-	bool saveWindowsIcon(const QString& filePath, const QImage& img) const { return false; };
-	bool saveWindowsIcon(const QImage& img, QSharedPointer<QByteArray>& ba) const { return false; };
+    bool saveWindowsIcon(const QString &filePath, const QImage &img) const
+    {
+        return false;
+    };
+    bool saveWindowsIcon(const QImage &img, QSharedPointer<QByteArray> &ba) const
+    {
+        return false;
+    };
 #endif
 
 signals:
-	void errorDialogSignal(const QString& msg) const;
+    void errorDialogSignal(const QString &msg) const;
+
+    void undoSignal();
+    void redoSignal();
+    void resetMetaDataSignal();
 
 protected:
-	bool loadRohFile(const QString& filePath, QImage& img, QSharedPointer<QByteArray> ba = QSharedPointer<QByteArray>()) const;
-	bool loadTgaFile(const QString& filePath, QImage& img, QSharedPointer<QByteArray> ba = QSharedPointer<QByteArray>()) const;
-	bool loadRawFile(const QString& filePath, QImage& img, QSharedPointer<QByteArray> ba = QSharedPointer<QByteArray>(), bool fast = false) const;
-	void indexPages(const QString& filePath, const QSharedPointer<QByteArray> ba = QSharedPointer<QByteArray>());
-	void convert32BitOrder(void *buffer, int width) const;
-
-	int mLoader;
-	bool mTraining;
-	int mMode;
-	
-	QString mFile;
-	int mNumPages;
-	int mPageIdx;
-	bool mPageIdxDirty;
-	QSharedPointer<DkMetaDataT> mMetaData;
-	QVector<DkEditImage> mImages;
-	int mMinHistorySize = 2;
-	int mImageIndex = 0;
+    bool loadRohFile(const QString &filePath, QImage &img, QSharedPointer<QByteArray> ba = QSharedPointer<QByteArray>()) const;
+    bool loadTgaFile(const QString &filePath, QImage &img, QSharedPointer<QByteArray> ba = QSharedPointer<QByteArray>()) const;
+    bool loadRawFile(const QString &filePath, QImage &img, QSharedPointer<QByteArray> ba = QSharedPointer<QByteArray>(), bool fast = false) const;
+    void indexPages(const QString &filePath, const QSharedPointer<QByteArray> ba = QSharedPointer<QByteArray>());
+    void convert32BitOrder(void *buffer, int width) const;
+
+    int mLoader;
+    bool mTraining;
+    int mMode;
+
+    QString mFile;
+    int mNumPages;
+    int mPageIdx;
+    bool mPageIdxDirty;
+    QSharedPointer<DkMetaDataT> mMetaData;
+    QVector<DkEditImage> mImages;
+    int mMinHistorySize = 2;
+    int mImageIndex = 0;
 };
 
-namespace tga {
-	typedef struct {
-		unsigned char r, g, b, a;
-	} Pixel;
-
-	typedef struct {
-		char  idlength;
-		char  colourmaptype;
-		char  datatypecode;
-		short colourmaporigin;
-		short colourmaplength;
-		char  colourmapdepth;
-		short x_origin;
-		short y_origin;
-		short width;
-		short height;
-		char  bitsperpixel;
-		char  imagedescriptor;
-	} Header;
-
-	class DkTgaLoader {
-
-
-	public:
-		DkTgaLoader(QSharedPointer<QByteArray> ba = QSharedPointer<QByteArray>());
-
-		QImage image() const;
-		bool load();
-
-	private:
-		void mergeBytes(Pixel * pixel, unsigned char * p, int bytes) const;
-		bool load(QSharedPointer<QByteArray> ba);
-
-		QImage mImg;
-		QSharedPointer<QByteArray> mBa;
-	};
+namespace tga
+{
+typedef struct {
+    unsigned char r, g, b, a;
+} Pixel;
+
+typedef struct {
+    char idlength;
+    char colourmaptype;
+    char datatypecode;
+    short colourmaporigin;
+    short colourmaplength;
+    char colourmapdepth;
+    short x_origin;
+    short y_origin;
+    short width;
+    short height;
+    char bitsperpixel;
+    char imagedescriptor;
+} Header;
+
+class DkTgaLoader
+{
+public:
+    DkTgaLoader(QSharedPointer<QByteArray> ba = QSharedPointer<QByteArray>());
+
+    QImage image() const;
+    bool load();
+
+private:
+    void mergeBytes(Pixel *pixel, unsigned char *p, int bytes) const;
+    bool load(QSharedPointer<QByteArray> ba);
+
+    QImage mImg;
+    QSharedPointer<QByteArray> mBa;
+};
 };
 
 // file downloader from: http://qt-project.org/wiki/Download_Data_from_URL
-class FileDownloader : public QObject {
-	Q_OBJECT
+class FileDownloader : public QObject
+{
+    Q_OBJECT
 
 public:
-	explicit FileDownloader(const QUrl& imageUrl, const QString& filePath = "", QObject *parent = 0);
+    explicit FileDownloader(const QUrl &imageUrl, const QString &filePath = "", QObject *parent = 0);
 
-	virtual ~FileDownloader();
+    virtual ~FileDownloader();
 
-	QSharedPointer<QByteArray> downloadedData() const;
-	QUrl getUrl() const;
-	void downloadFile(const QUrl& url);
+    QSharedPointer<QByteArray> downloadedData() const;
+    QUrl getUrl() const;
+    void downloadFile(const QUrl &url);
 
 signals:
-	void downloaded(const QString& filePath = "");
+    void downloaded(const QString &filePath = "");
 
 private slots:
-	void fileDownloaded(QNetworkReply* pReply);
-	void saved();
+    void fileDownloaded(QNetworkReply *pReply);
+    void saved();
 
 private:
+    QNetworkAccessManager mWebCtrl;
+    QSharedPointer<QByteArray> mDownloadedData;
+    QUrl mUrl;
+    QString mFilePath;
 
-	QNetworkAccessManager mWebCtrl;
-	QSharedPointer<QByteArray> mDownloadedData;
-	QUrl mUrl;
-	QString mFilePath;
-
-	QFutureWatcher<bool> mSaveWatcher;
+    QFutureWatcher<bool> mSaveWatcher;
 
-	static bool save(const QString& filePath, const QSharedPointer<QByteArray> data);
+    static bool save(const QString &filePath, const QSharedPointer<QByteArray> data);
 };
 
 }
diff --git a/ImageLounge/src/DkCore/DkBasicWidgets.cpp b/ImageLounge/src/DkCore/DkBasicWidgets.cpp
index 789d668..44e3c59 100644
--- a/ImageLounge/src/DkCore/DkBasicWidgets.cpp
+++ b/ImageLounge/src/DkCore/DkBasicWidgets.cpp
@@ -27,774 +27,787 @@ related links:
 *******************************************************************************************************/
 
 #include "DkBasicWidgets.h"
-#include "DkUtils.h"
 #include "DkImageStorage.h"
 #include "DkSettings.h"
+#include "DkUtils.h"
 
 #include <cassert>
 
-#pragma warning(push, 0)	// no warnings from includes
-#include <QLabel>
-#include <QVBoxLayout>
-#include <QSpinBox>
-#include <QSlider>
-#include <QPushButton>
+#pragma warning(push, 0) // no warnings from includes
 #include <QColorDialog>
-#include <QPainter>
-#include <QMouseEvent>
+#include <QLabel>
+#include <QLineEdit>
 #include <QMenu>
+#include <QMouseEvent>
+#include <QPainter>
+#include <QPushButton>
+#include <QSlider>
+#include <QSpinBox>
+#include <QVBoxLayout>
 #include <QWidgetAction>
-#include <QLineEdit>
 #pragma warning(pop)
 
-namespace nmc {
+namespace nmc
+{
 
 // DkSlider --------------------------------------------------------------------
-DkSlider::DkSlider(QString title, QWidget* parent) : DkWidget(parent) {
+DkSlider::DkSlider(QString title, QWidget *parent)
+    : DkWidget(parent)
+{
+    createLayout();
 
-	createLayout();
+    // init
+    titleLabel->setText(title);
 
-	// init
-	titleLabel->setText(title);
-
-	// defaults
-	setMinimum(0);	
-	setMaximum(100);
-	setTickInterval(1);
-	setValue(50);
+    // defaults
+    setMinimum(0);
+    setMaximum(100);
+    setTickInterval(1);
+    setValue(50);
 }
 
-void DkSlider::createLayout() {
-
-	QVBoxLayout* layout = new QVBoxLayout(this);
-	layout->setSpacing(0);
-	layout->setContentsMargins(0,0,0,0);
+void DkSlider::createLayout()
+{
+    QVBoxLayout *layout = new QVBoxLayout(this);
+    layout->setSpacing(0);
+    layout->setContentsMargins(0, 0, 0, 0);
 
-	QWidget* dummy = new QWidget(this);
-	QHBoxLayout* titleLayout = new QHBoxLayout(dummy);
-	titleLayout->setContentsMargins(0,0,0,5);
+    QWidget *dummy = new QWidget(this);
+    QHBoxLayout *titleLayout = new QHBoxLayout(dummy);
+    titleLayout->setContentsMargins(0, 0, 0, 5);
 
-	QWidget* dummyBounds = new QWidget(this);
-	QHBoxLayout* boundsLayout = new QHBoxLayout(dummyBounds);
-	boundsLayout->setContentsMargins(0,0,0,0);
+    QWidget *dummyBounds = new QWidget(this);
+    QHBoxLayout *boundsLayout = new QHBoxLayout(dummyBounds);
+    boundsLayout->setContentsMargins(0, 0, 0, 0);
 
-	titleLabel = new QLabel(this);
+    titleLabel = new QLabel(this);
 
-	sliderBox = new QSpinBox(this);
+    sliderBox = new QSpinBox(this);
 
-	slider = new QSlider(this);
-	slider->setOrientation(Qt::Horizontal);
+    slider = new QSlider(this);
+    slider->setOrientation(Qt::Horizontal);
 
-	minValLabel = new QLabel(this);
-	maxValLabel = new QLabel(this);
+    minValLabel = new QLabel(this);
+    maxValLabel = new QLabel(this);
 
-	// hide min-max for now - delete in future releases...
-	minValLabel->hide();
-	maxValLabel->hide();
+    // hide min-max for now - delete in future releases...
+    minValLabel->hide();
+    maxValLabel->hide();
 
-	titleLayout->addWidget(titleLabel);
-	titleLayout->addStretch();
-	titleLayout->addWidget(sliderBox);
+    titleLayout->addWidget(titleLabel);
+    titleLayout->addStretch();
+    titleLayout->addWidget(sliderBox);
 
-	boundsLayout->addWidget(minValLabel);
-	boundsLayout->addStretch();
-	boundsLayout->addWidget(maxValLabel);
+    boundsLayout->addWidget(minValLabel);
+    boundsLayout->addStretch();
+    boundsLayout->addWidget(maxValLabel);
 
-	layout->addWidget(dummy);
-	layout->addWidget(slider);
-	layout->addWidget(dummyBounds);
+    layout->addWidget(dummy);
+    layout->addWidget(slider);
+    layout->addWidget(dummyBounds);
 
-	// connect
-	connect(slider, SIGNAL(valueChanged(int)), this, SLOT(setValue(int)));
-	connect(sliderBox, SIGNAL(valueChanged(int)), this, SLOT(setValue(int)));
+    // connect
+    connect(slider, SIGNAL(valueChanged(int)), this, SLOT(setValue(int)));
+    connect(sliderBox, SIGNAL(valueChanged(int)), this, SLOT(setValue(int)));
 }
 
-QSlider* DkSlider::getSlider() const {
-	return slider;
+QSlider *DkSlider::getSlider() const
+{
+    return slider;
 }
 
-void DkSlider::setMinimum(int minValue) {
-	slider->setMinimum(minValue);
-	sliderBox->setMinimum(minValue);
-	minValLabel->setText(QString::number(minValue));
+void DkSlider::setMinimum(int minValue)
+{
+    slider->setMinimum(minValue);
+    sliderBox->setMinimum(minValue);
+    minValLabel->setText(QString::number(minValue));
 }
 
-void DkSlider::setMaximum(int maxValue) {
-	slider->setMaximum(maxValue);
-	sliderBox->setMaximum(maxValue);
-	maxValLabel->setText(QString::number(maxValue));
+void DkSlider::setMaximum(int maxValue)
+{
+    slider->setMaximum(maxValue);
+    sliderBox->setMaximum(maxValue);
+    maxValLabel->setText(QString::number(maxValue));
 }
 
-void DkSlider::setTickInterval(int ticValue) {
-	slider->setTickInterval(ticValue);
+void DkSlider::setTickInterval(int ticValue)
+{
+    slider->setTickInterval(ticValue);
 }
 
-int DkSlider::value() const {
-	return slider->value();
+int DkSlider::value() const
+{
+    return slider->value();
 }
 
-void DkSlider::setFocus(Qt::FocusReason reason) {
-	sliderBox->setFocus(reason);
+void DkSlider::setFocus(Qt::FocusReason reason)
+{
+    sliderBox->setFocus(reason);
 }
 
-void DkSlider::setValue(int value) {
+void DkSlider::setValue(int value)
+{
+    slider->blockSignals(true);
+    slider->setValue(value);
+    slider->blockSignals(false);
 
-	slider->blockSignals(true);
-	slider->setValue(value);
-	slider->blockSignals(false);
+    sliderBox->blockSignals(true);
+    sliderBox->setValue(value);
+    sliderBox->blockSignals(false);
 
-	sliderBox->blockSignals(true);
-	sliderBox->setValue(value);
-	sliderBox->blockSignals(false);
-
-	emit valueChanged(value);
+    emit valueChanged(value);
 }
 
 // DkDoubleSlider --------------------------------------------------------------------
-DkDoubleSlider::DkDoubleSlider(const QString& title, QWidget* parent) : DkWidget(parent) {
-
-	createLayout();
+DkDoubleSlider::DkDoubleSlider(const QString &title, QWidget *parent)
+    : DkWidget(parent)
+{
+    createLayout();
 
-	// init
-	mTitleLabel->setText(title);
+    // init
+    mTitleLabel->setText(title);
 
-	// defaults
-	setMinimum(0.0);	
-	setMaximum(1.0);
-	setTickInterval(0.01);
-	setValue(0.5);
+    // defaults
+    setMinimum(0.0);
+    setMaximum(1.0);
+    setTickInterval(0.01);
+    setValue(0.5);
 }
 
-void DkDoubleSlider::createLayout() {
+void DkDoubleSlider::createLayout()
+{
+    QVBoxLayout *layout = new QVBoxLayout(this);
+    layout->setSpacing(0);
+    layout->setContentsMargins(0, 0, 0, 0);
 
-	QVBoxLayout* layout = new QVBoxLayout(this);
-	layout->setSpacing(0);
-	layout->setContentsMargins(0,0,0,0);
+    QWidget *dummy = new QWidget(this);
+    QHBoxLayout *titleLayout = new QHBoxLayout(dummy);
+    titleLayout->setContentsMargins(0, 0, 0, 5);
 
-	QWidget* dummy = new QWidget(this);
-	QHBoxLayout* titleLayout = new QHBoxLayout(dummy);
-	titleLayout->setContentsMargins(0,0,0,5);
+    mTitleLabel = new QLabel(this);
 
-	mTitleLabel = new QLabel(this);
+    mSliderBox = new QDoubleSpinBox(this);
 
-	mSliderBox = new QDoubleSpinBox(this);
+    mSlider = new QSlider(this);
+    mSlider->setOrientation(Qt::Horizontal);
 
-	mSlider = new QSlider(this);
-	mSlider->setOrientation(Qt::Horizontal);
+    titleLayout->addWidget(mTitleLabel);
+    titleLayout->addStretch();
+    titleLayout->addWidget(mSliderBox);
 
-	titleLayout->addWidget(mTitleLabel);
-	titleLayout->addStretch();
-	titleLayout->addWidget(mSliderBox);
+    layout->addWidget(dummy);
+    layout->addWidget(mSlider);
 
-	layout->addWidget(dummy);
-	layout->addWidget(mSlider);
-
-	// connect
-	connect(mSlider, SIGNAL(valueChanged(int)), this, SLOT(setIntValue(int)));
-	connect(mSliderBox, SIGNAL(valueChanged(double)), this, SLOT(setValue(double)));
+    // connect
+    connect(mSlider, SIGNAL(valueChanged(int)), this, SLOT(setIntValue(int)));
+    connect(mSliderBox, SIGNAL(valueChanged(double)), this, SLOT(setValue(double)));
 }
 
-int DkDoubleSlider::map(double val) const {
-	
-	double minv = 0.0, maxv = 0.0;
-
-	if (mCenter != 0.0) {
-		if (val > mCenter) {
-			minv = mCenter;
-			maxv = mSliderBox->maximum();
-		}
-		else {
-			minv = mCenter;
-			maxv = mSliderBox->minimum();
-		}
-	}
-	else {
-		minv = mSliderBox->minimum();
-		maxv = mSliderBox->maximum();
-	}
+int DkDoubleSlider::map(double val) const
+{
+    double minv = 0.0, maxv = 0.0;
 
-	// normalize
-	double nVal = (val - minv) / (maxv-minv);
+    if (mCenter != 0.0) {
+        if (val > mCenter) {
+            minv = mCenter;
+            maxv = mSliderBox->maximum();
+        } else {
+            minv = mCenter;
+            maxv = mSliderBox->minimum();
+        }
+    } else {
+        minv = mSliderBox->minimum();
+        maxv = mSliderBox->maximum();
+    }
 
-	if (mSliderInverted)
-		nVal = 1.0 - nVal;
+    // normalize
+    double nVal = (val - minv) / (maxv - minv);
 
-	double v = nVal * mSlider->maximum();
-	
-	if (mCenter != 0.0 && mSliderInverted)
-		v -= qRound(mSlider->maximum() / 2.0);
-	else if (mCenter != 0.0)
-		v += qRound(mSlider->maximum() / 2.0);
+    if (mSliderInverted)
+        nVal = 1.0 - nVal;
 
-	return qRound(v);
-}
-
-double DkDoubleSlider::mapInv(int val) const {
+    double v = nVal * mSlider->maximum();
 
-	if (mCenter == 0.0) {
+    if (mCenter != 0.0 && mSliderInverted)
+        v -= qRound(mSlider->maximum() / 2.0);
+    else if (mCenter != 0.0)
+        v += qRound(mSlider->maximum() / 2.0);
 
-		double minv = mSliderBox->minimum();
-		double maxv = mSliderBox->maximum();
+    return qRound(v);
+}
 
-		double nVal = val / (double)mSlider->maximum();
+double DkDoubleSlider::mapInv(int val) const
+{
+    if (mCenter == 0.0) {
+        double minv = mSliderBox->minimum();
+        double maxv = mSliderBox->maximum();
 
-		if (mSliderInverted)
-			nVal = 1.0 - nVal;
+        double nVal = val / (double)mSlider->maximum();
 
-		return nVal * (maxv - minv) + minv;
-	}
-	else {
+        if (mSliderInverted)
+            nVal = 1.0 - nVal;
 
-		double mc = mSlider->maximum() / 2.0;
-		bool left = val < mc;
+        return nVal * (maxv - minv) + minv;
+    } else {
+        double mc = mSlider->maximum() / 2.0;
+        bool left = val < mc;
 
-		if (mSliderInverted)
-			left = !left;
+        if (mSliderInverted)
+            left = !left;
 
-		double minv, maxv;
-		if (left) {
-			minv = mSliderBox->minimum();
-			maxv = mCenter;
-		}
-		else {
-			maxv = mSliderBox->maximum();
-			minv = mCenter;
-		}
+        double minv, maxv;
+        if (left) {
+            minv = mSliderBox->minimum();
+            maxv = mCenter;
+        } else {
+            maxv = mSliderBox->maximum();
+            minv = mCenter;
+        }
 
-		double nVal = val / (double)mc;
+        double nVal = val / (double)mc;
 
-		if (mSliderInverted)
-			nVal = 1.0 - nVal;
-		else
-			nVal -= 1.0;
+        if (mSliderInverted)
+            nVal = 1.0 - nVal;
+        else
+            nVal -= 1.0;
 
-		return nVal * (maxv - minv) + mCenter;
-	}
+        return nVal * (maxv - minv) + mCenter;
+    }
 }
 
-QSlider* DkDoubleSlider::getSlider() const {
-	return mSlider;
+QSlider *DkDoubleSlider::getSlider() const
+{
+    return mSlider;
 }
 
-void DkDoubleSlider::setMinimum(double minValue) {
-	mSliderBox->setMinimum(minValue);
+void DkDoubleSlider::setMinimum(double minValue)
+{
+    mSliderBox->setMinimum(minValue);
 }
 
-void DkDoubleSlider::setMaximum(double maxValue) {
-	mSliderBox->setMaximum(maxValue);
+void DkDoubleSlider::setMaximum(double maxValue)
+{
+    mSliderBox->setMaximum(maxValue);
 }
 
-void DkDoubleSlider::setCenterValue(double center) {
-	mCenter = center;
+void DkDoubleSlider::setCenterValue(double center)
+{
+    mCenter = center;
 }
 
-void DkDoubleSlider::setTickInterval(double ticValue) {
-	mSlider->setMaximum(qRound(1.0 / ticValue));
+void DkDoubleSlider::setTickInterval(double ticValue)
+{
+    mSlider->setMaximum(qRound(1.0 / ticValue));
 }
 
-double DkDoubleSlider::value() const {
-	return mSliderBox->value();
+double DkDoubleSlider::value() const
+{
+    return mSliderBox->value();
 }
 
-void DkDoubleSlider::setFocus(Qt::FocusReason reason) {
-	mSliderBox->setFocus(reason);
+void DkDoubleSlider::setFocus(Qt::FocusReason reason)
+{
+    mSliderBox->setFocus(reason);
 }
 
-void DkDoubleSlider::setSliderInverted(bool inverted) {
-	mSliderInverted = inverted;
+void DkDoubleSlider::setSliderInverted(bool inverted)
+{
+    mSliderInverted = inverted;
 }
 
-void DkDoubleSlider::setValue(double value) {
-
-	mSlider->blockSignals(true);
-	mSlider->setValue(map(value));
-	mSlider->blockSignals(false);
+void DkDoubleSlider::setValue(double value)
+{
+    mSlider->blockSignals(true);
+    mSlider->setValue(map(value));
+    mSlider->blockSignals(false);
 
-	mSliderBox->blockSignals(true);
-	mSliderBox->setValue(value);
-	mSliderBox->blockSignals(false);
+    mSliderBox->blockSignals(true);
+    mSliderBox->setValue(value);
+    mSliderBox->blockSignals(false);
 
-	emit valueChanged(value);
+    emit valueChanged(value);
 }
 
-void DkDoubleSlider::setIntValue(int value) {
+void DkDoubleSlider::setIntValue(int value)
+{
+    double sVal = mapInv(value);
 
-	double sVal = mapInv(value);
-	
-	mSlider->blockSignals(true);
-	mSlider->setValue(value);
-	mSlider->blockSignals(false);
+    mSlider->blockSignals(true);
+    mSlider->setValue(value);
+    mSlider->blockSignals(false);
 
-	mSliderBox->blockSignals(true);
-	mSliderBox->setValue(sVal);
-	mSliderBox->blockSignals(false);
+    mSliderBox->blockSignals(true);
+    mSliderBox->setValue(sVal);
+    mSliderBox->blockSignals(false);
 
-	emit valueChanged(sVal);
+    emit valueChanged(sVal);
 }
 
 // DkColorChooser ------------------------------------
-DkColorChooser::DkColorChooser(QColor defaultColor, QString text, QWidget* parent, Qt::WindowFlags flags) : DkWidget(parent, flags) {
-
-	this->defaultColor = defaultColor;
-	this->mText = text;
-
-	init();
+DkColorChooser::DkColorChooser(QColor defaultColor, QString text, QWidget *parent, Qt::WindowFlags flags)
+    : DkWidget(parent, flags)
+{
+    this->defaultColor = defaultColor;
+    this->mText = text;
 
+    init();
 }
 
-void DkColorChooser::init() {
+void DkColorChooser::init()
+{
+    mAccepted = false;
 
-	mAccepted = false;
+    colorDialog = new QColorDialog(this);
+    colorDialog->setObjectName("colorDialog");
+    colorDialog->setOption(QColorDialog::ShowAlphaChannel, true);
 
-	colorDialog = new QColorDialog(this);
-	colorDialog->setObjectName("colorDialog");
-	colorDialog->setOption(QColorDialog::ShowAlphaChannel, true);
+    QVBoxLayout *vLayout = new QVBoxLayout(this);
+    vLayout->setContentsMargins(11, 0, 11, 0);
 
-	QVBoxLayout* vLayout = new QVBoxLayout(this);
-	vLayout->setContentsMargins(11,0,11,0);
+    QLabel *colorLabel = new QLabel(mText, this);
+    colorButton = new QPushButton("", this);
+    colorButton->setFlat(true);
+    colorButton->setObjectName("colorButton");
+    colorButton->setAutoDefault(false);
 
-	QLabel* colorLabel = new QLabel(mText, this);
-	colorButton = new QPushButton("", this);
-	colorButton->setFlat(true);
-	colorButton->setObjectName("colorButton");
-	colorButton->setAutoDefault(false);
+    QPushButton *resetButton = new QPushButton(tr("Reset"), this);
+    resetButton->setObjectName("resetButton");
+    resetButton->setAutoDefault(false);
 
-	QPushButton* resetButton = new QPushButton(tr("Reset"), this);
-	resetButton->setObjectName("resetButton");
-	resetButton->setAutoDefault(false);
+    QWidget *colWidget = new QWidget(this);
+    QHBoxLayout *hLayout = new QHBoxLayout(colWidget);
+    hLayout->setContentsMargins(11, 0, 11, 0);
+    hLayout->setAlignment(Qt::AlignLeft);
 
-	QWidget* colWidget = new QWidget(this);
-	QHBoxLayout* hLayout = new QHBoxLayout(colWidget);
-	hLayout->setContentsMargins(11,0,11,0);
-	hLayout->setAlignment(Qt::AlignLeft);
+    hLayout->addWidget(colorButton);
+    hLayout->addWidget(resetButton);
 
-	hLayout->addWidget(colorButton);
-	hLayout->addWidget(resetButton);
+    vLayout->addWidget(colorLabel);
+    vLayout->addWidget(colWidget);
 
-	vLayout->addWidget(colorLabel);
-	vLayout->addWidget(colWidget);
-
-	setColor(defaultColor);
-	QMetaObject::connectSlotsByName(this);
+    setColor(defaultColor);
+    QMetaObject::connectSlotsByName(this);
 }
 
-bool DkColorChooser::isAccept() const {
-	return mAccepted;
+bool DkColorChooser::isAccept() const
+{
+    return mAccepted;
 }
 
-void DkColorChooser::enableAlpha(bool enable) {
-	colorDialog->setOption(QColorDialog::ShowAlphaChannel, enable);
+void DkColorChooser::enableAlpha(bool enable)
+{
+    colorDialog->setOption(QColorDialog::ShowAlphaChannel, enable);
 }
 
-void DkColorChooser::setColor(const QColor& color) {
-
-	colorDialog->setCurrentColor(color);
-	colorButton->setStyleSheet("QPushButton {background-color: " + DkUtils::colorToString(color) + "; border: 1px solid #888; min-height: 24px}");
-	if (mSettingColor)
-		*mSettingColor = color;
-
+void DkColorChooser::setColor(const QColor &color)
+{
+    colorDialog->setCurrentColor(color);
+    colorButton->setStyleSheet("QPushButton {background-color: " + DkUtils::colorToString(color) + "; border: 1px solid #888; min-height: 24px}");
+    if (mSettingColor)
+        *mSettingColor = color;
 }
 
-void DkColorChooser::setColor(QColor* color) {
-
-	if (color) {
-		mSettingColor = color;
-		setColor(*color);
-	}
+void DkColorChooser::setColor(QColor *color)
+{
+    if (color) {
+        mSettingColor = color;
+        setColor(*color);
+    }
 }
 
-
-QColor DkColorChooser::getColor() {
-	return colorDialog->currentColor();
+QColor DkColorChooser::getColor()
+{
+    return colorDialog->currentColor();
 }
 
-void DkColorChooser::on_resetButton_clicked() {
-	setColor(defaultColor);
-	emit resetClicked();
+void DkColorChooser::on_resetButton_clicked()
+{
+    setColor(defaultColor);
+    emit resetClicked();
 }
 
-void DkColorChooser::on_colorButton_clicked() {
-
-	// incorrect color? - see: https://bugreports.qt.io/browse/QTBUG-42988
-	colorDialog->show();
+void DkColorChooser::on_colorButton_clicked()
+{
+    // incorrect color? - see: https://bugreports.qt.io/browse/QTBUG-42988
+    colorDialog->show();
 }
 
-void DkColorChooser::on_colorDialog_accepted() {
-
-	setColor(colorDialog->currentColor());
-	mAccepted = true;
-	emit accepted();
+void DkColorChooser::on_colorDialog_accepted()
+{
+    setColor(colorDialog->currentColor());
+    mAccepted = true;
+    emit accepted();
 }
 
-// -------------------------------------------------------------------- DkColorEdit 
-DkColorEdit::DkColorEdit(const QColor& col, QWidget* parent) : DkWidget(parent) {
-	
-	createLayout();
-	setColor(col);
+// -------------------------------------------------------------------- DkColorEdit
+DkColorEdit::DkColorEdit(const QColor &col, QWidget *parent)
+    : DkWidget(parent)
+{
+    createLayout();
+    setColor(col);
 }
 
-void DkColorEdit::createLayout() {
-
-	mColBoxes.resize(c_end);
+void DkColorEdit::createLayout()
+{
+    mColBoxes.resize(c_end);
 
-	for (int idx = 0; idx < mColBoxes.size(); idx++) {
-		mColBoxes[idx] = new QSpinBox(this);
-		mColBoxes[idx]->setMinimum(0);
-		mColBoxes[idx]->setMaximum(255);
-		connect(mColBoxes[idx], SIGNAL(valueChanged(int)), this, SLOT(colorChanged()));
-	}
+    for (int idx = 0; idx < mColBoxes.size(); idx++) {
+        mColBoxes[idx] = new QSpinBox(this);
+        mColBoxes[idx]->setMinimum(0);
+        mColBoxes[idx]->setMaximum(255);
+        connect(mColBoxes[idx], SIGNAL(valueChanged(int)), this, SLOT(colorChanged()));
+    }
 
-	mColBoxes[r]->setPrefix("R: ");
-	mColBoxes[g]->setPrefix("G: ");
-	mColBoxes[b]->setPrefix("B: ");
+    mColBoxes[r]->setPrefix("R: ");
+    mColBoxes[g]->setPrefix("G: ");
+    mColBoxes[b]->setPrefix("B: ");
 
-	mColHash = new QLineEdit(this);
-	connect(mColHash, SIGNAL(textEdited(const QString&)), this, SLOT(hashChanged(const QString&)));
-	connect(mColHash, SIGNAL(editingFinished()), this, SLOT(hashEditFinished()));
+    mColHash = new QLineEdit(this);
+    connect(mColHash, SIGNAL(textEdited(const QString &)), this, SLOT(hashChanged(const QString &)));
+    connect(mColHash, SIGNAL(editingFinished()), this, SLOT(hashEditFinished()));
 
-	QGridLayout* gl = new QGridLayout(this);
-	gl->addWidget(mColBoxes[r], 1, 1);
-	gl->addWidget(mColBoxes[g], 2, 1);
-	gl->addWidget(mColBoxes[b], 3, 1);
-	gl->addWidget(mColHash, 4, 1);
+    QGridLayout *gl = new QGridLayout(this);
+    gl->addWidget(mColBoxes[r], 1, 1);
+    gl->addWidget(mColBoxes[g], 2, 1);
+    gl->addWidget(mColBoxes[b], 3, 1);
+    gl->addWidget(mColHash, 4, 1);
 }
 
-void DkColorEdit::setColor(const QColor & col) {
-	mColor = col;
+void DkColorEdit::setColor(const QColor &col)
+{
+    mColor = col;
 
-	mColBoxes[r]->setValue(col.red());
-	mColBoxes[g]->setValue(col.green());
-	mColBoxes[b]->setValue(col.blue());
+    mColBoxes[r]->setValue(col.red());
+    mColBoxes[g]->setValue(col.green());
+    mColBoxes[b]->setValue(col.blue());
 
-	mColHash->setText(mColor.name());
+    mColHash->setText(mColor.name());
 }
 
-QColor DkColorEdit::color() const {
-	return mColor;
+QColor DkColorEdit::color() const
+{
+    return mColor;
 }
 
-void DkColorEdit::colorChanged() {
+void DkColorEdit::colorChanged()
+{
+    mColor = QColor(mColBoxes[r]->value(), mColBoxes[g]->value(), mColBoxes[b]->value());
+    mColHash->setText(mColor.name());
 
-	mColor = QColor(mColBoxes[r]->value(), mColBoxes[g]->value(), mColBoxes[b]->value());
-	mColHash->setText(mColor.name());
-
-	emit newColor(mColor);
+    emit newColor(mColor);
 }
 
-void DkColorEdit::hashChanged(const QString& name) {
-
-	if (!name.startsWith("#"))
-		mColHash->setText("#" + mColHash->text());
+void DkColorEdit::hashChanged(const QString &name)
+{
+    if (!name.startsWith("#"))
+        mColHash->setText("#" + mColHash->text());
 }
 
-void DkColorEdit::hashEditFinished() {
+void DkColorEdit::hashEditFinished()
+{
+    QColor nc;
+    nc.setNamedColor(mColHash->text());
 
-	QColor nc;
-	nc.setNamedColor(mColHash->text());
-
-	if (nc.isValid()) {
-		setColor(nc);
-		emit newColor(nc);
-	}
-	else
-		mColHash->setText(mColor.name());
+    if (nc.isValid()) {
+        setColor(nc);
+        emit newColor(nc);
+    } else
+        mColHash->setText(mColor.name());
 }
 
-
-// -------------------------------------------------------------------- DkColorPane 
-DkColorPane::DkColorPane(QWidget* parent) : DkWidget(parent) {
-	mColor = QColor(255, 0, 0);
+// -------------------------------------------------------------------- DkColorPane
+DkColorPane::DkColorPane(QWidget *parent)
+    : DkWidget(parent)
+{
+    mColor = QColor(255, 0, 0);
 }
 
-QColor DkColorPane::color() const {
-	return pos2Color(mPos);
+QColor DkColorPane::color() const
+{
+    return pos2Color(mPos);
 }
 
-void DkColorPane::setHue(int hue) {
-	mColor.setHsvF(hue/360.0, mColor.saturationF(), mColor.valueF());
-	update();
-	emit colorSelected(color());
+void DkColorPane::setHue(int hue)
+{
+    mColor.setHsvF(hue / 360.0, mColor.saturationF(), mColor.valueF());
+    update();
+    emit colorSelected(color());
 }
 
-double DkColorPane::hue() const {
-	return mColor.hueF();
+double DkColorPane::hue() const
+{
+    return mColor.hueF();
 }
 
-void DkColorPane::setColor(const QColor & col) {
-	setHue(col.hue());
-	setPos(color2Pos(col));
+void DkColorPane::setColor(const QColor &col)
+{
+    setHue(col.hue());
+    setPos(color2Pos(col));
 }
 
-void DkColorPane::paintEvent(QPaintEvent * ev) {
+void DkColorPane::paintEvent(QPaintEvent *ev)
+{
+    QPainter p(this);
+    p.setPen(Qt::NoPen);
+    p.setRenderHint(QPainter::Antialiasing);
 
-	QPainter p(this);
-	p.setPen(Qt::NoPen);
-	p.setRenderHint(QPainter::Antialiasing);
+    // setup corners (white, pure color, black, black)
+    QColor c00, c01, c11, c10;
+    c00.setHsvF(mColor.hueF(), 0, 1);
+    c01.setHsvF(mColor.hueF(), 1, 1);
+    c10.setHsvF(mColor.hueF(), 0, 0);
+    c11.setHsvF(mColor.hueF(), 1, 0);
 
-	// setup corners (white, pure color, black, black)
-	QColor c00, c01, c11, c10;
-	c00.setHsvF(mColor.hueF(), 0, 1);
-	c01.setHsvF(mColor.hueF(), 1, 1);
-	c10.setHsvF(mColor.hueF(), 0, 0);
-	c11.setHsvF(mColor.hueF(), 1, 0);
+    int w = width();
+    int h = height();
 
-	int w = width();
-	int h = height();
+    // draw
+    for (int idx = 0; idx < h; idx++) {
+        QColor ccs = ipl(c00, c10, (double)idx / h);
+        QColor cce = ipl(c01, c11, (double)idx / h);
 
-	// draw
-	for (int idx = 0; idx < h; idx++) {
+        QLinearGradient g(QPoint(0, 0), QPoint(w, 0));
+        g.setColorAt(0, ccs);
+        g.setColorAt(1, cce);
 
-		QColor ccs = ipl(c00, c10, (double)idx / h);
-		QColor cce = ipl(c01, c11, (double)idx / h);
+        QRect r(0, idx, w, 1);
+        p.fillRect(r, g);
+    }
 
-		QLinearGradient g(QPoint(0, 0), QPoint(w, 0));
-		g.setColorAt(0, ccs);
-		g.setColorAt(1, cce);
-		
-		QRect r(0, idx, w, 1);
-		p.fillRect(r, g);
-	}
+    QColor c = color();
 
-	QColor c = color();
+    // draw current selection
+    QPen pen;
+    pen.setColor(brightness(c) < 0.5 ? Qt::white : Qt::black);
+    p.setPen(pen);
+    QRectF cPick(0, 0, 11, 11);
+    cPick.moveCenter(mPos);
+    p.drawEllipse(cPick);
 
-	// draw current selection
-	QPen pen;
-	pen.setColor(brightness(c) < 0.5 ? Qt::white : Qt::black);
-	p.setPen(pen);
-	QRectF cPick(0, 0, 11, 11);
-	cPick.moveCenter(mPos);
-	p.drawEllipse(cPick);
-
-	QWidget::paintEvent(ev);
+    QWidget::paintEvent(ev);
 }
 
-void DkColorPane::mouseMoveEvent(QMouseEvent * me) {
-
-	if (me->buttons() == Qt::LeftButton)
-		setPos(me->pos());
-	QWidget::mouseMoveEvent(me);
+void DkColorPane::mouseMoveEvent(QMouseEvent *me)
+{
+    if (me->buttons() == Qt::LeftButton)
+        setPos(me->pos());
+    QWidget::mouseMoveEvent(me);
 }
 
-void DkColorPane::mousePressEvent(QMouseEvent * me) {
-
-	if (me->button() == Qt::LeftButton)
-		setPos(me->pos());
-	QWidget::mousePressEvent(me);
+void DkColorPane::mousePressEvent(QMouseEvent *me)
+{
+    if (me->button() == Qt::LeftButton)
+        setPos(me->pos());
+    QWidget::mousePressEvent(me);
 }
 
-void DkColorPane::mouseReleaseEvent(QMouseEvent * me) {
-
-	if (me->button() == Qt::LeftButton)
-		setPos(me->pos());
-	QWidget::mouseReleaseEvent(me);
+void DkColorPane::mouseReleaseEvent(QMouseEvent *me)
+{
+    if (me->button() == Qt::LeftButton)
+        setPos(me->pos());
+    QWidget::mouseReleaseEvent(me);
 }
 
-void DkColorPane::resizeEvent(QResizeEvent * re) {
-
-	setPos(mPos);
-	QWidget::resizeEvent(re);
+void DkColorPane::resizeEvent(QResizeEvent *re)
+{
+    setPos(mPos);
+    QWidget::resizeEvent(re);
 }
 
-QPoint DkColorPane::color2Pos(const QColor & col) const {
-	
-	return QPoint(qRound(col.saturationF()*width()), qRound((1.0-col.valueF())*height()));
+QPoint DkColorPane::color2Pos(const QColor &col) const
+{
+    return QPoint(qRound(col.saturationF() * width()), qRound((1.0 - col.valueF()) * height()));
 }
 
-QColor DkColorPane::pos2Color(const QPoint & pos) const {
-
-	// setup corners (white, pure color, black, black)
-	QColor c00, c01, c11, c10;
-	c00.setHsvF(mColor.hueF(), 0, 1);
-	c01.setHsvF(mColor.hueF(), 1, 1);
-	c10.setHsvF(mColor.hueF(), 0, 0);
-	c11.setHsvF(mColor.hueF(), 1, 0);
+QColor DkColorPane::pos2Color(const QPoint &pos) const
+{
+    // setup corners (white, pure color, black, black)
+    QColor c00, c01, c11, c10;
+    c00.setHsvF(mColor.hueF(), 0, 1);
+    c01.setHsvF(mColor.hueF(), 1, 1);
+    c10.setHsvF(mColor.hueF(), 0, 0);
+    c11.setHsvF(mColor.hueF(), 1, 0);
 
-	QColor ccs = ipl(c00, c10, (double)pos.y()/height());
-	QColor cce = ipl(c01, c11, (double)pos.y()/height());
+    QColor ccs = ipl(c00, c10, (double)pos.y() / height());
+    QColor cce = ipl(c01, c11, (double)pos.y() / height());
 
-	return ipl(ccs, cce, (double)pos.x()/width());
+    return ipl(ccs, cce, (double)pos.x() / width());
 }
 
-QColor DkColorPane::ipl(const QColor& c0, const QColor& c1, double alpha) const {
+QColor DkColorPane::ipl(const QColor &c0, const QColor &c1, double alpha) const
+{
+    assert(alpha >= 0 && alpha <= 1.0);
 
-	assert(alpha >= 0 && alpha <= 1.0);
+    double r = c0.redF() * (1.0 - alpha) + c1.redF() * alpha;
+    double g = c0.greenF() * (1.0 - alpha) + c1.greenF() * alpha;
+    double b = c0.blueF() * (1.0 - alpha) + c1.blueF() * alpha;
 
-	double r = c0.redF() * (1.0 - alpha) + c1.redF() * alpha;
-	double g = c0.greenF() * (1.0 - alpha) + c1.greenF() * alpha;
-	double b = c0.blueF() * (1.0 - alpha) + c1.blueF() * alpha;
-
-	return QColor::fromRgbF(r, g, b);
+    return QColor::fromRgbF(r, g, b);
 }
 
-void DkColorPane::setPos(const QPoint & pos) {
-
-	mPos.setX(qMin(qMax(pos.x(), 0), width()));
-	mPos.setY(qMin(qMax(pos.y(), 0), height()));
+void DkColorPane::setPos(const QPoint &pos)
+{
+    mPos.setX(qMin(qMax(pos.x(), 0), width()));
+    mPos.setY(qMin(qMax(pos.y(), 0), height()));
 
-	update();
-	emit colorSelected(color());
+    update();
+    emit colorSelected(color());
 }
 
-double DkColorPane::brightness(const QColor & col) const {
-	
-	return std::sqrt(
-		col.redF() * col.redF() * 0.241 +
-		col.greenF() * col.greenF() * 0.691 +
-		col.blueF() * col.blueF() * 0.068
-		);
+double DkColorPane::brightness(const QColor &col) const
+{
+    return std::sqrt(col.redF() * col.redF() * 0.241 + col.greenF() * col.greenF() * 0.691 + col.blueF() * col.blueF() * 0.068);
 }
 
-// -------------------------------------------------------------------- DkColorPicker 
-DkColorPicker::DkColorPicker(QWidget* parent) : DkWidget(parent) {
-
-	createLayout();
-	QMetaObject::connectSlotsByName(this);
+// -------------------------------------------------------------------- DkColorPicker
+DkColorPicker::DkColorPicker(QWidget *parent)
+    : DkWidget(parent)
+{
+    createLayout();
+    QMetaObject::connectSlotsByName(this);
 }
 
-void DkColorPicker::createLayout() {
-
-	int bs = qRound(20 * DkSettingsManager::param().dpiScaleFactor());
+void DkColorPicker::createLayout()
+{
+    int bs = qRound(20 * DkSettingsManager::param().dpiScaleFactor());
 
-	// color pane
-	mColorPane = new DkColorPane(this);
-	mColorPane->setObjectName("mColorPane");
-	mColorPane->setBaseSize(100, 100);
-	mColorPane->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
+    // color pane
+    mColorPane = new DkColorPane(this);
+    mColorPane->setObjectName("mColorPane");
+    mColorPane->setBaseSize(100, 100);
+    mColorPane->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
 
-	// hue slider
-	QSlider* hueSlider = new QSlider(this);
-	hueSlider->setObjectName("cpHueSlider");
-	hueSlider->setMaximum(360);
-	hueSlider->setValue(360);
-	hueSlider->setFixedWidth(bs);
+    // hue slider
+    QSlider *hueSlider = new QSlider(this);
+    hueSlider->setObjectName("cpHueSlider");
+    hueSlider->setMaximum(360);
+    hueSlider->setValue(360);
+    hueSlider->setFixedWidth(bs);
 
-	// current color
-	mColorPreview = new QLabel("", this);
-	mColorPreview->setFixedHeight(bs);
+    // current color
+    mColorPreview = new QLabel("", this);
+    mColorPreview->setFixedHeight(bs);
 
-	QPushButton* mMenu = new QPushButton(DkImage::loadIcon(":/nomacs/img/bars.svg", QSize(bs, bs), Qt::white), "", this);
-	mMenu->setObjectName("flatWhite");
-	mMenu->setFlat(true);
-	mMenu->setFixedSize(bs, bs);
+    QPushButton *mMenu = new QPushButton(DkImage::loadIcon(":/nomacs/img/bars.svg", QSize(bs, bs), Qt::white), "", this);
+    mMenu->setObjectName("flatWhite");
+    mMenu->setFlat(true);
+    mMenu->setFixedSize(bs, bs);
 
-	QGridLayout* hb = new QGridLayout(this);
-	hb->setContentsMargins(0, 0, 0, 0);
-	hb->addWidget(mColorPane, 0, 0);
-	hb->addWidget(hueSlider, 0, 1);
-	hb->addWidget(mColorPreview, 1, 0);
-	hb->addWidget(mMenu, 1, 1);
+    QGridLayout *hb = new QGridLayout(this);
+    hb->setContentsMargins(0, 0, 0, 0);
+    hb->addWidget(mColorPane, 0, 0);
+    hb->addWidget(hueSlider, 0, 1);
+    hb->addWidget(mColorPreview, 1, 0);
+    hb->addWidget(mMenu, 1, 1);
 
-	connect(hueSlider, SIGNAL(valueChanged(int)), mColorPane, SLOT(setHue(int)));
-	connect(mColorPane, SIGNAL(colorSelected(const QColor&)), this, SIGNAL(colorSelected(const QColor&)));
-	connect(mColorPane, SIGNAL(colorSelected(const QColor&)), this, SLOT(setColor(const QColor&)));
-	connect(mMenu, SIGNAL(clicked()), this, SLOT(showMenu()));
+    connect(hueSlider, SIGNAL(valueChanged(int)), mColorPane, SLOT(setHue(int)));
+    connect(mColorPane, SIGNAL(colorSelected(const QColor &)), this, SIGNAL(colorSelected(const QColor &)));
+    connect(mColorPane, SIGNAL(colorSelected(const QColor &)), this, SLOT(setColor(const QColor &)));
+    connect(mMenu, SIGNAL(clicked()), this, SLOT(showMenu()));
 
-	setColor(mColorPane->color());
+    setColor(mColorPane->color());
 }
 
-void DkColorPicker::showMenu(const QPoint & pos) {
+void DkColorPicker::showMenu(const QPoint &pos)
+{
+    if (!mContextMenu) {
+        mContextMenu = new QMenu(this);
+        mColorEdit = new DkColorEdit(color(), this);
+        connect(mColorEdit, SIGNAL(newColor(const QColor &)), this, SLOT(setColor(const QColor &)));
+        connect(mColorEdit, SIGNAL(newColor(const QColor &)), mColorPane, SLOT(setColor(const QColor &)));
 
-	if (!mContextMenu) {
+        QWidgetAction *a = new QWidgetAction(this);
+        a->setDefaultWidget(mColorEdit);
+        mContextMenu->addAction(a);
+    }
 
-		mContextMenu = new QMenu(this);
-		mColorEdit = new DkColorEdit(color(), this);
-		connect(mColorEdit, SIGNAL(newColor(const QColor&)), this, SLOT(setColor(const QColor&)));
-		connect(mColorEdit, SIGNAL(newColor(const QColor&)), mColorPane, SLOT(setColor(const QColor&)));
-
-		QWidgetAction* a = new QWidgetAction(this);
-		a->setDefaultWidget(mColorEdit);
-		mContextMenu->addAction(a);
-	}
-
-	mColorEdit->setColor(color());
-	mContextMenu->exec(!pos.isNull() ? pos : mapToGlobal(geometry().bottomRight()));
+    mColorEdit->setColor(color());
+    mContextMenu->exec(!pos.isNull() ? pos : mapToGlobal(geometry().bottomRight()));
 }
 
-void DkColorPicker::setColor(const QColor& col) {
-
-	mColorPreview->setStyleSheet("background-color: " + DkUtils::colorToString(col));
+void DkColorPicker::setColor(const QColor &col)
+{
+    mColorPreview->setStyleSheet("background-color: " + DkUtils::colorToString(col));
 }
 
-QColor DkColorPicker::color() const {
-
-	return mColorPane->color();
+QColor DkColorPicker::color() const
+{
+    return mColorPane->color();
 }
 
-void DkColorPicker::contextMenuEvent(QContextMenuEvent * cme) {
+void DkColorPicker::contextMenuEvent(QContextMenuEvent *cme)
+{
+    showMenu(cme->globalPos());
 
-	showMenu(cme->globalPos());
-
-	// do not propagate
-	//QWidget::contextMenuEvent(cme);
+    // do not propagate
+    // QWidget::contextMenuEvent(cme);
 }
 
-
-// -------------------------------------------------------------------- DkRectWidget 
-DkRectWidget::DkRectWidget(const QRect& r, QWidget* parent) : DkWidget(parent) {
-
-	createLayout();
-	setRect(r);
+// -------------------------------------------------------------------- DkRectWidget
+DkRectWidget::DkRectWidget(const QRect &r, QWidget *parent)
+    : DkWidget(parent)
+{
+    createLayout();
+    setRect(r);
 }
 
-void DkRectWidget::setRect(const QRect & r) {
-
-	blockSignals(true);
-	mSpCropRect[crop_x]->setValue(r.x());
-	mSpCropRect[crop_y]->setValue(r.y());
-	mSpCropRect[crop_width]->setValue(r.width());
-	mSpCropRect[crop_height]->setValue(r.height());
-	blockSignals(false);
+void DkRectWidget::setRect(const QRect &r)
+{
+    blockSignals(true);
+    mSpCropRect[crop_x]->setValue(r.x());
+    mSpCropRect[crop_y]->setValue(r.y());
+    mSpCropRect[crop_width]->setValue(r.width());
+    mSpCropRect[crop_height]->setValue(r.height());
+    blockSignals(false);
 }
 
-QRect DkRectWidget::rect() const {
-	return QRect(mSpCropRect[crop_x]->value(),
-		mSpCropRect[crop_y]->value(),
-		mSpCropRect[crop_width]->value(),
-		mSpCropRect[crop_height]->value());
+QRect DkRectWidget::rect() const
+{
+    return QRect(mSpCropRect[crop_x]->value(), mSpCropRect[crop_y]->value(), mSpCropRect[crop_width]->value(), mSpCropRect[crop_height]->value());
 }
 
-void DkRectWidget::updateRect() {
-
-	emit updateRectSignal(rect());
+void DkRectWidget::updateRect()
+{
+    emit updateRectSignal(rect());
 }
 
-void DkRectWidget::createLayout() {
-
-	mSpCropRect.resize(crop_end);
+void DkRectWidget::createLayout()
+{
+    mSpCropRect.resize(crop_end);
 
-	QLabel* lbCropX = new QLabel(tr("x:"));
-	mSpCropRect[crop_x] = new QSpinBox(this);
-	lbCropX->setBuddy(mSpCropRect[crop_x]);
+    QLabel *lbCropX = new QLabel(tr("x:"));
+    mSpCropRect[crop_x] = new QSpinBox(this);
+    lbCropX->setBuddy(mSpCropRect[crop_x]);
 
-	QLabel* lbCropY = new QLabel(tr("y:"));
-	mSpCropRect[crop_y] = new QSpinBox(this);
-	lbCropY->setBuddy(mSpCropRect[crop_y]);
+    QLabel *lbCropY = new QLabel(tr("y:"));
+    mSpCropRect[crop_y] = new QSpinBox(this);
+    lbCropY->setBuddy(mSpCropRect[crop_y]);
 
-	QLabel* lbCropWidth = new QLabel(tr("width:"));
-	mSpCropRect[crop_width] = new QSpinBox(this);
-	lbCropWidth->setBuddy(mSpCropRect[crop_width]);
+    QLabel *lbCropWidth = new QLabel(tr("width:"));
+    mSpCropRect[crop_width] = new QSpinBox(this);
+    lbCropWidth->setBuddy(mSpCropRect[crop_width]);
 
-	QLabel* lbCropHeight = new QLabel(tr("height:"));
-	mSpCropRect[crop_height] = new QSpinBox(this);
-	lbCropHeight->setBuddy(mSpCropRect[crop_height]);
+    QLabel *lbCropHeight = new QLabel(tr("height:"));
+    mSpCropRect[crop_height] = new QSpinBox(this);
+    lbCropHeight->setBuddy(mSpCropRect[crop_height]);
 
-	for (QSpinBox* sp : mSpCropRect) {
-		sp->setSuffix(tr(" px"));
-		sp->setMinimum(0);
-		sp->setMaximum(100000);
-		connect(sp, SIGNAL(valueChanged(int)), this, SLOT(updateRect()));
-	}
+    for (QSpinBox *sp : mSpCropRect) {
+        sp->setSuffix(tr(" px"));
+        sp->setMinimum(0);
+        sp->setMaximum(100000);
+        connect(sp, SIGNAL(valueChanged(int)), this, SLOT(updateRect()));
+    }
 
-	QHBoxLayout* cropLayout = new QHBoxLayout(this);
-	cropLayout->setMargin(0);
-	cropLayout->addWidget(lbCropX);
-	cropLayout->addWidget(mSpCropRect[crop_x]);
-	cropLayout->addWidget(lbCropY);
-	cropLayout->addWidget(mSpCropRect[crop_y]);
-	cropLayout->addWidget(lbCropWidth);
-	cropLayout->addWidget(mSpCropRect[crop_width]);
-	cropLayout->addWidget(lbCropHeight);
-	cropLayout->addWidget(mSpCropRect[crop_height]);
+    QHBoxLayout *cropLayout = new QHBoxLayout(this);
+    cropLayout->setContentsMargins(0, 0, 0, 0);
+    cropLayout->addWidget(lbCropX);
+    cropLayout->addWidget(mSpCropRect[crop_x]);
+    cropLayout->addWidget(lbCropY);
+    cropLayout->addWidget(mSpCropRect[crop_y]);
+    cropLayout->addWidget(lbCropWidth);
+    cropLayout->addWidget(mSpCropRect[crop_width]);
+    cropLayout->addWidget(lbCropHeight);
+    cropLayout->addWidget(mSpCropRect[crop_height]);
 }
 
-}
\ No newline at end of file
+}
diff --git a/ImageLounge/src/DkCore/DkBasicWidgets.h b/ImageLounge/src/DkCore/DkBasicWidgets.h
index 7d3aaf8..c56bc95 100644
--- a/ImageLounge/src/DkCore/DkBasicWidgets.h
+++ b/ImageLounge/src/DkCore/DkBasicWidgets.h
@@ -1,6 +1,6 @@
 /*******************************************************************************************************
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2016 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2016 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2016 Florian Kleber <florian@nomacs.org>
@@ -30,11 +30,11 @@
 
 #include "DkBaseWidgets.h"
 
-#pragma warning(push, 0)	// no warnings from includes
+#pragma warning(push, 0) // no warnings from includes
 #include <QWidget>
 #pragma warning(pop)
 
-#pragma warning(disable: 4251)	// TODO: remove
+#pragma warning(disable : 4251) // TODO: remove
 
 #ifndef DllCoreExport
 #ifdef DK_CORE_DLL_EXPORT
@@ -56,231 +56,237 @@ class QPushButton;
 class QMenu;
 class QLineEdit;
 
-namespace nmc {
+namespace nmc
+{
 
 // nomacs defines
 
-class DllCoreExport DkSlider : public DkWidget {
-	Q_OBJECT
+class DllCoreExport DkSlider : public DkWidget
+{
+    Q_OBJECT
 
 public:
-	DkSlider(QString title = "", QWidget* parent = 0);
+    DkSlider(QString title = "", QWidget *parent = 0);
 
-	QSlider* getSlider() const;
-	void setMinimum(int minValue);
-	void setMaximum(int maxValue);
-	void setTickInterval(int ticValue);
-	int value() const;
-	void setFocus(Qt::FocusReason reason);
+    QSlider *getSlider() const;
+    void setMinimum(int minValue);
+    void setMaximum(int maxValue);
+    void setTickInterval(int ticValue);
+    int value() const;
+    void setFocus(Qt::FocusReason reason);
 
 public slots:
-	void setValue(int value);
+    void setValue(int value);
 
 signals:
-	void sliderMoved(int value);
-	void valueChanged(int value);
+    void sliderMoved(int value);
+    void valueChanged(int value);
 
 protected:
-	void createLayout();
+    void createLayout();
 
-	QLabel* titleLabel;
-	QLabel* minValLabel;
-	QLabel* maxValLabel;
-	QSlider* slider;
-	QSpinBox* sliderBox;
+    QLabel *titleLabel;
+    QLabel *minValLabel;
+    QLabel *maxValLabel;
+    QSlider *slider;
+    QSpinBox *sliderBox;
 };
 
-class DllCoreExport DkDoubleSlider : public DkWidget {
-	Q_OBJECT
+class DllCoreExport DkDoubleSlider : public DkWidget
+{
+    Q_OBJECT
 
 public:
-	DkDoubleSlider(const QString& title = "", QWidget* parent = 0);
+    DkDoubleSlider(const QString &title = "", QWidget *parent = 0);
 
-	QSlider* getSlider() const;
-	void setMinimum(double minValue);
-	void setMaximum(double maxValue);
-	void setCenterValue(double center);
-	void setTickInterval(double ticValue);
-	double value() const;
-	void setFocus(Qt::FocusReason reason);
-	void setSliderInverted(bool inverted);
+    QSlider *getSlider() const;
+    void setMinimum(double minValue);
+    void setMaximum(double maxValue);
+    void setCenterValue(double center);
+    void setTickInterval(double ticValue);
+    double value() const;
+    void setFocus(Qt::FocusReason reason);
+    void setSliderInverted(bool inverted);
 
 public slots:
-	void setValue(double value);
-	void setIntValue(int value);
+    void setValue(double value);
+    void setIntValue(int value);
 
 signals:
-	void sliderMoved(double value);
-	void valueChanged(double value);
+    void sliderMoved(double value);
+    void valueChanged(double value);
 
 protected:
-	void createLayout();
-	int map(double val) const;
-	double mapInv(int val) const;
-
-	QLabel* mTitleLabel;
-	QSlider* mSlider;
-	QDoubleSpinBox* mSliderBox;
-	bool mSliderInverted = false;
-	double mCenter = 0;
+    void createLayout();
+    int map(double val) const;
+    double mapInv(int val) const;
+
+    QLabel *mTitleLabel;
+    QSlider *mSlider;
+    QDoubleSpinBox *mSliderBox;
+    bool mSliderInverted = false;
+    double mCenter = 0;
 };
 
-class DllCoreExport DkColorChooser : public DkWidget {
-	Q_OBJECT
+class DllCoreExport DkColorChooser : public DkWidget
+{
+    Q_OBJECT
 
 public:
-	DkColorChooser(QColor defaultColor = QColor(), QString text = "Color", QWidget* parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
-	virtual ~DkColorChooser() {};
+    DkColorChooser(QColor defaultColor = QColor(), QString text = "Color", QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
+    virtual ~DkColorChooser(){};
 
-	void setColor(const QColor& color);
-	void setColor(QColor* color);
-	QColor getColor();
-	bool isAccept() const;
-	void enableAlpha(bool enable = true);
+    void setColor(const QColor &color);
+    void setColor(QColor *color);
+    QColor getColor();
+    bool isAccept() const;
+    void enableAlpha(bool enable = true);
 
 public slots:
-	void on_resetButton_clicked();
-	void on_colorButton_clicked();
-	void on_colorDialog_accepted();
+    void on_resetButton_clicked();
+    void on_colorButton_clicked();
+    void on_colorDialog_accepted();
 
 signals:
-	void resetClicked();
-	void accepted();
+    void resetClicked();
+    void accepted();
 
 protected:
-	QColorDialog* colorDialog = 0;
-	QPushButton* colorButton = 0;
-
-	QColor defaultColor;
-	QColor* mSettingColor = 0;
-	QString mText;
-	bool mAccepted = false;
+    QColorDialog *colorDialog = 0;
+    QPushButton *colorButton = 0;
 
-	void init();
+    QColor defaultColor;
+    QColor *mSettingColor = 0;
+    QString mText;
+    bool mAccepted = false;
 
+    void init();
 };
 
-class DllCoreExport DkColorEdit : public DkWidget {
-	Q_OBJECT
+class DllCoreExport DkColorEdit : public DkWidget
+{
+    Q_OBJECT
 
 public:
-	DkColorEdit(const QColor& col = QColor(), QWidget* parent = 0);
+    DkColorEdit(const QColor &col = QColor(), QWidget *parent = 0);
 
-	void setColor(const QColor& col);
-	QColor color() const;
+    void setColor(const QColor &col);
+    QColor color() const;
 
 signals:
-	void newColor(const QColor& col);
+    void newColor(const QColor &col);
 
 public slots:
-	void colorChanged();
-	void hashChanged(const QString& name);
-	void hashEditFinished();
+    void colorChanged();
+    void hashChanged(const QString &name);
+    void hashEditFinished();
 
 protected:
-	void createLayout();
+    void createLayout();
 
-	enum cols {
-		r = 0,
-		g,
-		b,
+    enum cols {
+        r = 0,
+        g,
+        b,
 
-		c_end
-	};
+        c_end
+    };
 
-	QVector<QSpinBox*> mColBoxes;
-	QLineEdit* mColHash;
-	QColor mColor;
+    QVector<QSpinBox *> mColBoxes;
+    QLineEdit *mColHash;
+    QColor mColor;
 };
 
-class DllCoreExport DkColorPane : public DkWidget {
-	Q_OBJECT
+class DllCoreExport DkColorPane : public DkWidget
+{
+    Q_OBJECT
 
 public:
-	DkColorPane(QWidget* parent = 0);
+    DkColorPane(QWidget *parent = 0);
 
-	QColor color() const;
-	double hue() const;
+    QColor color() const;
+    double hue() const;
 
 signals:
-	void colorSelected(const QColor& col) const;
+    void colorSelected(const QColor &col) const;
 
 public slots:
-	void setHue(int hue);
-	void setColor(const QColor& col);
+    void setHue(int hue);
+    void setColor(const QColor &col);
 
 protected:
-	void paintEvent(QPaintEvent* ev) override;
-	void mouseMoveEvent(QMouseEvent* me) override;
-	void mouseReleaseEvent(QMouseEvent* me) override;
-	void mousePressEvent(QMouseEvent* me) override;
-	void resizeEvent(QResizeEvent* re) override;
-	
-	QPoint color2Pos(const QColor& col) const;
-	QColor pos2Color(const QPoint& pos) const;
-	QColor ipl(const QColor& c0, const QColor& c1, double alpha) const;
-	void setPos(const QPoint& pos);
-
-	double brightness(const QColor& col) const;
-
-	QColor mColor = QColor(255, 0, 0);
-	QPoint mPos = QPoint(0, 0);
+    void paintEvent(QPaintEvent *ev) override;
+    void mouseMoveEvent(QMouseEvent *me) override;
+    void mouseReleaseEvent(QMouseEvent *me) override;
+    void mousePressEvent(QMouseEvent *me) override;
+    void resizeEvent(QResizeEvent *re) override;
+
+    QPoint color2Pos(const QColor &col) const;
+    QColor pos2Color(const QPoint &pos) const;
+    QColor ipl(const QColor &c0, const QColor &c1, double alpha) const;
+    void setPos(const QPoint &pos);
+
+    double brightness(const QColor &col) const;
+
+    QColor mColor = QColor(255, 0, 0);
+    QPoint mPos = QPoint(0, 0);
 };
 
-class DllCoreExport DkColorPicker : public DkWidget {
-	Q_OBJECT
+class DllCoreExport DkColorPicker : public DkWidget
+{
+    Q_OBJECT
 
 public:
-	DkColorPicker(QWidget* parent = 0);
+    DkColorPicker(QWidget *parent = 0);
 
-	QColor color() const;
+    QColor color() const;
 
 signals:
-	void colorSelected(const QColor& col);
+    void colorSelected(const QColor &col);
 
 public slots:
-	void setColor(const QColor& col);
-	void showMenu(const QPoint& pos = QPoint());
+    void setColor(const QColor &col);
+    void showMenu(const QPoint &pos = QPoint());
 
 protected:
-	void contextMenuEvent(QContextMenuEvent* cme) override;
-	void createLayout();
+    void contextMenuEvent(QContextMenuEvent *cme) override;
+    void createLayout();
 
-	DkColorPane* mColorPane = 0;
-	QLabel* mColorPreview = 0;
-	QMenu* mContextMenu = 0;
-	DkColorEdit* mColorEdit = 0;
+    DkColorPane *mColorPane = 0;
+    QLabel *mColorPreview = 0;
+    QMenu *mContextMenu = 0;
+    DkColorEdit *mColorEdit = 0;
 };
 
-class DllCoreExport DkRectWidget : public DkWidget {
-	Q_OBJECT
+class DllCoreExport DkRectWidget : public DkWidget
+{
+    Q_OBJECT
 
 public:
-	DkRectWidget(const QRect& r = QRect(), QWidget* parent = 0);
+    DkRectWidget(const QRect &r = QRect(), QWidget *parent = 0);
 
-	QRect rect() const;
+    QRect rect() const;
 
 public slots:
-	void setRect(const QRect& r);
-	void updateRect();
+    void setRect(const QRect &r);
+    void updateRect();
 
 signals:
-	void updateRectSignal(const QRect& r) const;
+    void updateRectSignal(const QRect &r) const;
 
 protected:
-	void createLayout();
-
-	enum {
-		crop_x = 0,
-		crop_y,
-		crop_width,
-		crop_height,
+    void createLayout();
 
-		crop_end
-	};
+    enum {
+        crop_x = 0,
+        crop_y,
+        crop_width,
+        crop_height,
 
-	QVector<QSpinBox*> mSpCropRect;
+        crop_end
+    };
 
+    QVector<QSpinBox *> mSpCropRect;
 };
 
 }
\ No newline at end of file
diff --git a/ImageLounge/src/DkCore/DkBatchInfo.cpp b/ImageLounge/src/DkCore/DkBatchInfo.cpp
index 7af3886..98ae534 100644
--- a/ImageLounge/src/DkCore/DkBatchInfo.cpp
+++ b/ImageLounge/src/DkCore/DkBatchInfo.cpp
@@ -1,6 +1,6 @@
 /*******************************************************************************************************
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2016 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2016 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2016 Florian Kleber <florian@nomacs.org>
@@ -28,17 +28,18 @@
 
 #include "DkBatchInfo.h"
 
-#pragma warning(push, 0)	// no warnings from includes
-#include <QFileInfo>
-#include <QSharedPointer>
-#include <QVector>
+#pragma warning(push, 0) // no warnings from includes
 #include <QDebug>
-#include <QUuid>
 #include <QDir>
+#include <QFileInfo>
 #include <QSettings>
+#include <QSharedPointer>
+#include <QUuid>
+#include <QVector>
 #pragma warning(pop)
 
-namespace nmc {
+namespace nmc
+{
 
 /// <summary>
 /// Initializes a new instance of the <see cref="DkBatchInfo" /> class.
@@ -50,81 +51,87 @@ namespace nmc {
 /// <param name="id">The processing module ID (e.g. runID of plugin).</param>
 /// <param name="filePath">The image file path.</param>
 /// DkBatchInfo --------------------------------------------------------------------
-DkBatchInfo::DkBatchInfo(const QString& id, const QString& filePath) {
-	mId = id;
-	mFilePath = filePath;
+DkBatchInfo::DkBatchInfo(const QString &id, const QString &filePath)
+{
+    mId = id;
+    mFilePath = filePath;
 }
 
-QDataStream& operator<<(QDataStream& s, const DkBatchInfo& b) {
-
-	// this makes the operator<< virtual (stroustrup)
-	s << b.toString();	// for now show children too
-	return s;
+QDataStream &operator<<(QDataStream &s, const DkBatchInfo &b)
+{
+    // this makes the operator<< virtual (stroustrup)
+    s << b.toString(); // for now show children too
+    return s;
 }
 
-QDebug operator<<(QDebug d, const DkBatchInfo& b) {
-
-	d << qPrintable(b.toString());
-	return d;
+QDebug operator<<(QDebug d, const DkBatchInfo &b)
+{
+    d << qPrintable(b.toString());
+    return d;
 }
 
-
 /// <summary>
 /// Determines whether this instance is empty.
 /// </summary>
 /// <returns>true if the file path is empty</returns>
-bool DkBatchInfo::isEmpty() const {
-	return mFilePath.isEmpty();
+bool DkBatchInfo::isEmpty() const
+{
+    return mFilePath.isEmpty();
 }
 
 /// <summary>
 /// File path of the corresponding image.
 /// </summary>
 /// <returns></returns>
-QString DkBatchInfo::filePath() const {
-	return mFilePath;
+QString DkBatchInfo::filePath() const
+{
+    return mFilePath;
 }
 
 /// <summary>
 /// QFileInfo with the current file path.
 /// </summary>
 /// <returns></returns>
-QFileInfo DkBatchInfo::fileInfo() const {
-	return QFileInfo(mFilePath);
+QFileInfo DkBatchInfo::fileInfo() const
+{
+    return QFileInfo(mFilePath);
 }
 
 /// <summary>
 /// Sets the file path.
 /// </summary>
 /// <param name="filePath">The path to the image file which is being processed.</param>
-void DkBatchInfo::setFilePath(const QString & filePath) {
-	mFilePath = filePath;
+void DkBatchInfo::setFilePath(const QString &filePath)
+{
+    mFilePath = filePath;
 }
 
 /// <summary>
 /// A unique identifier of the processing module (e.g. runID of plugins).
 /// </summary>
 /// <param name="id">The identifier.</param>
-void DkBatchInfo::setId(const QString & id) {
-	mId = id;
+void DkBatchInfo::setId(const QString &id)
+{
+    mId = id;
 }
 
 /// <summary>
 /// ID of the processing module.
 /// </summary>
 /// <returns></returns>
-QString DkBatchInfo::id() const {
-	return mId;
+QString DkBatchInfo::id() const
+{
+    return mId;
 }
 
-QString DkBatchInfo::toString() const {
-	
-	QString msg;
-	msg += "[DkBatchInfo] ";
-	msg += "id: " + id() + " ";
-	msg += "path: " + filePath() + " ";
-	
-	return msg;
+QString DkBatchInfo::toString() const
+{
+    QString msg;
+    msg += "[DkBatchInfo] ";
+    msg += "id: " + id() + " ";
+    msg += "path: " + filePath() + " ";
+
+    return msg;
 }
 
 /// <summary>
@@ -135,121 +142,137 @@ QString DkBatchInfo::toString() const {
 /// <param name="infos">The infos.</param>
 /// <param name="id">The ID.</param>
 /// <returns>Filtered Batch Infos for a specified module which has runID id.</returns>
-QVector<QSharedPointer<DkBatchInfo> > DkBatchInfo::filter(const QVector<QSharedPointer<DkBatchInfo>>& infos, const QString & id) {
-	
-	QVector<QSharedPointer<DkBatchInfo> > fInfos;
+QVector<QSharedPointer<DkBatchInfo>> DkBatchInfo::filter(const QVector<QSharedPointer<DkBatchInfo>> &infos, const QString &id)
+{
+    QVector<QSharedPointer<DkBatchInfo>> fInfos;
 
-	for (auto cInfo : infos) {
+    for (auto cInfo : infos) {
+        if (cInfo && cInfo->id() == id)
+            fInfos << cInfo;
+    }
 
-		if (cInfo && cInfo->id() == id)
-			fInfos << cInfo;
-	}
-	
-	return fInfos;
+    return fInfos;
 }
 
-DkSaveInfo::DkSaveInfo(const QString& filePathIn, const QString& filePathOut) {
-	
-	mFilePathIn = filePathIn;
-	mFilePathOut = filePathOut;
+DkSaveInfo::DkSaveInfo(const QString &filePathIn, const QString &filePathOut)
+{
+    mFilePathIn = filePathIn;
+    mFilePathOut = filePathOut;
 }
 
-void DkSaveInfo::createBackupFilePath() {
-
-	QFileInfo buFile(mFilePathOut);
-	mBackupPath = QFileInfo(buFile.absolutePath(), buFile.baseName() + QUuid::createUuid().toString() + "." + buFile.suffix()).absoluteFilePath();
+void DkSaveInfo::createBackupFilePath()
+{
+    QFileInfo buFile(mFilePathOut);
+    mBackupPath = QFileInfo(buFile.absolutePath(), buFile.baseName() + QUuid::createUuid().toString() + "." + buFile.suffix()).absoluteFilePath();
 }
 
-void DkSaveInfo::clearBackupFilePath() {
-	mBackupPath = QString();
+void DkSaveInfo::clearBackupFilePath()
+{
+    mBackupPath = QString();
 }
 
-void DkSaveInfo::loadSettings(QSettings & settings) {
+void DkSaveInfo::loadSettings(QSettings &settings)
+{
+    settings.beginGroup("SaveInfo");
+    mCompression = settings.value("Compression", mCompression).toInt();
+    mMode = (DkSaveInfo::OverwriteMode)settings.value("Mode", mMode).toInt();
+    mDeleteOriginal = settings.value("DeleteOriginal", mDeleteOriginal).toBool();
+    mInputDirIsOutputDir = settings.value("InputDirIsOutputDir", mInputDirIsOutputDir).toBool();
 
-	settings.beginGroup("SaveInfo");
-	mCompression = settings.value("Compression", mCompression).toInt();
-	mMode = (DkSaveInfo::OverwriteMode)settings.value("Mode", mMode).toInt();
-	mDeleteOriginal = settings.value("DeleteOriginal", mDeleteOriginal).toBool();
-	mInputDirIsOutputDir = settings.value("InputDirIsOutputDir", mInputDirIsOutputDir).toBool();
-
-	settings.endGroup();
+    settings.endGroup();
 }
 
-void DkSaveInfo::saveSettings(QSettings & settings) const {
-
-	settings.beginGroup("SaveInfo");
+void DkSaveInfo::saveSettings(QSettings &settings) const
+{
+    settings.beginGroup("SaveInfo");
 
-	settings.setValue("Compression", mCompression);
-	settings.setValue("Mode", mMode);
-	settings.setValue("DeleteOriginal", mDeleteOriginal);
-	settings.setValue("InputDirIsOutputDir", mInputDirIsOutputDir);
+    settings.setValue("Compression", mCompression);
+    settings.setValue("Mode", mMode);
+    settings.setValue("DeleteOriginal", mDeleteOriginal);
+    settings.setValue("InputDirIsOutputDir", mInputDirIsOutputDir);
 
-	settings.endGroup();
+    settings.endGroup();
 }
 
-void DkSaveInfo::setInputFilePath(const QString & inputFilePath) {
-	mFilePathIn = inputFilePath;
+void DkSaveInfo::setInputFilePath(const QString &inputFilePath)
+{
+    mFilePathIn = inputFilePath;
 }
 
-void DkSaveInfo::setOutputFilePath(const QString & outputFilePath) {
-	mFilePathOut = outputFilePath;
-	clearBackupFilePath();
+void DkSaveInfo::setOutputFilePath(const QString &outputFilePath)
+{
+    mFilePathOut = outputFilePath;
+    clearBackupFilePath();
 }
 
-void DkSaveInfo::setMode(OverwriteMode mode) {
-	mMode = mode;
+void DkSaveInfo::setMode(OverwriteMode mode)
+{
+    mMode = mode;
 }
 
-void DkSaveInfo::setDeleteOriginal(bool deleteOriginal) {
-	mDeleteOriginal = deleteOriginal;
+void DkSaveInfo::setDeleteOriginal(bool deleteOriginal)
+{
+    mDeleteOriginal = deleteOriginal;
 }
 
-void DkSaveInfo::setCompression(int compression) {
-	mCompression = compression;
+void DkSaveInfo::setCompression(int compression)
+{
+    mCompression = compression;
 }
 
-void DkSaveInfo::setInputDirIsOutputDir(bool isOutputDir) {
-	mInputDirIsOutputDir = isOutputDir;
+void DkSaveInfo::setInputDirIsOutputDir(bool isOutputDir)
+{
+    mInputDirIsOutputDir = isOutputDir;
 }
 
-QString DkSaveInfo::inputFilePath() const {
-	return mFilePathIn;
+QString DkSaveInfo::inputFilePath() const
+{
+    return mFilePathIn;
 }
 
-QString DkSaveInfo::outputFilePath() const {
-	return mFilePathOut;
+QString DkSaveInfo::outputFilePath() const
+{
+    return mFilePathOut;
 }
 
-QString DkSaveInfo::backupFilePath() const {
-	return mBackupPath;
+QString DkSaveInfo::backupFilePath() const
+{
+    return mBackupPath;
 }
 
-QFileInfo DkSaveInfo::inputFileInfo() const {
-	return QFileInfo(mFilePathIn);
+QFileInfo DkSaveInfo::inputFileInfo() const
+{
+    return QFileInfo(mFilePathIn);
 }
 
-QFileInfo DkSaveInfo::outputFileInfo() const {
-	return QFileInfo(mFilePathOut);
+QFileInfo DkSaveInfo::outputFileInfo() const
+{
+    return QFileInfo(mFilePathOut);
 }
 
-QFileInfo DkSaveInfo::backupFileInfo() const {
-	return QFileInfo(mBackupPath);
+QFileInfo DkSaveInfo::backupFileInfo() const
+{
+    return QFileInfo(mBackupPath);
 }
 
-DkSaveInfo::OverwriteMode DkSaveInfo::mode() const {
-	return mMode;
+DkSaveInfo::OverwriteMode DkSaveInfo::mode() const
+{
+    return mMode;
 }
 
-bool DkSaveInfo::isDeleteOriginal() const {
-	return mDeleteOriginal;
+bool DkSaveInfo::isDeleteOriginal() const
+{
+    return mDeleteOriginal;
 }
 
-bool DkSaveInfo::isInputDirOutputDir() const {
-	return mInputDirIsOutputDir;
+bool DkSaveInfo::isInputDirOutputDir() const
+{
+    return mInputDirIsOutputDir;
 }
 
-int DkSaveInfo::compression() const {
-	return mCompression;
+int DkSaveInfo::compression() const
+{
+    return mCompression;
 }
 
 }
\ No newline at end of file
diff --git a/ImageLounge/src/DkCore/DkBatchInfo.h b/ImageLounge/src/DkCore/DkBatchInfo.h
index f8532d3..6113acd 100644
--- a/ImageLounge/src/DkCore/DkBatchInfo.h
+++ b/ImageLounge/src/DkCore/DkBatchInfo.h
@@ -1,6 +1,6 @@
 /*******************************************************************************************************
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2016 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2016 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2016 Florian Kleber <florian@nomacs.org>
@@ -28,7 +28,7 @@
 
 #pragma once
 
-#pragma warning(push, 0)	// no warnings from includes
+#pragma warning(push, 0) // no warnings from includes
 #include <QObject>
 #pragma warning(pop)
 
@@ -46,86 +46,85 @@
 class QFileInfo;
 class QSettings;
 
-namespace nmc {
+namespace nmc
+{
 
 // nomacs defines
 
-class DllCoreExport DkBatchInfo {
-
+class DllCoreExport DkBatchInfo
+{
 public:
-	DkBatchInfo(const QString& id = QString(), const QString& filePath = QString());
+    DkBatchInfo(const QString &id = QString(), const QString &filePath = QString());
 
-	virtual bool isEmpty() const;
-	
-	virtual QString filePath() const;
-	virtual QFileInfo fileInfo() const;
-	virtual void setFilePath(const QString& filePath);
+    virtual bool isEmpty() const;
 
-	virtual void setId(const QString& id);
-	virtual QString id() const;
+    virtual QString filePath() const;
+    virtual QFileInfo fileInfo() const;
+    virtual void setFilePath(const QString &filePath);
 
-	QString toString() const;
+    virtual void setId(const QString &id);
+    virtual QString id() const;
 
-	static QVector<QSharedPointer<DkBatchInfo> > filter(const QVector<QSharedPointer<DkBatchInfo> >& infos, const QString& id);
-	friend DllCoreExport QDataStream& operator<<(QDataStream& s, const DkBatchInfo& b);
-	friend DllCoreExport QDebug operator<< (QDebug d, const DkBatchInfo &b);
+    QString toString() const;
 
-private:
-	QString mFilePath;
-	QString mId;
+    static QVector<QSharedPointer<DkBatchInfo>> filter(const QVector<QSharedPointer<DkBatchInfo>> &infos, const QString &id);
+    friend DllCoreExport QDataStream &operator<<(QDataStream &s, const DkBatchInfo &b);
+    friend DllCoreExport QDebug operator<<(QDebug d, const DkBatchInfo &b);
 
+private:
+    QString mFilePath;
+    QString mId;
 };
 
-class DllCoreExport DkSaveInfo {
-
+class DllCoreExport DkSaveInfo
+{
 public:
-	DkSaveInfo(const QString& filePathIn = QString(), const QString& filePathOut = QString());
+    DkSaveInfo(const QString &filePathIn = QString(), const QString &filePathOut = QString());
 
-	enum OverwriteMode {
-		mode_skip_existing			= 0x00,
-		mode_overwrite				= 0x01,
-		mode_do_not_save_output		= 0x02,
+    enum OverwriteMode {
+        mode_skip_existing = 0x00,
+        mode_overwrite = 0x01,
+        mode_do_not_save_output = 0x02,
 
-		mode_end
-	};
+        mode_end
+    };
 
-	void loadSettings(QSettings& settings);
-	void saveSettings(QSettings& settings) const;
+    void loadSettings(QSettings &settings);
+    void saveSettings(QSettings &settings) const;
 
-	void setInputFilePath(const QString& inputFilePath);
-	void setOutputFilePath(const QString& outputFilePath);
+    void setInputFilePath(const QString &inputFilePath);
+    void setOutputFilePath(const QString &outputFilePath);
 
-	void setMode(OverwriteMode mode);
-	void setDeleteOriginal(bool deleteOriginal);
-	void setCompression(int compression);
-	void setInputDirIsOutputDir(bool isOutputDir);
+    void setMode(OverwriteMode mode);
+    void setDeleteOriginal(bool deleteOriginal);
+    void setCompression(int compression);
+    void setInputDirIsOutputDir(bool isOutputDir);
 
-	QString inputFilePath() const;
-	QString outputFilePath() const;
-	QString backupFilePath() const;
+    QString inputFilePath() const;
+    QString outputFilePath() const;
+    QString backupFilePath() const;
 
-	QFileInfo inputFileInfo() const;
-	QFileInfo outputFileInfo() const;
-	QFileInfo backupFileInfo() const;
+    QFileInfo inputFileInfo() const;
+    QFileInfo outputFileInfo() const;
+    QFileInfo backupFileInfo() const;
 
-	OverwriteMode mode() const;
-	bool isDeleteOriginal() const;
-	bool isInputDirOutputDir() const;
-	int compression() const;
+    OverwriteMode mode() const;
+    bool isDeleteOriginal() const;
+    bool isInputDirOutputDir() const;
+    int compression() const;
 
-	void createBackupFilePath();
-	void clearBackupFilePath();
+    void createBackupFilePath();
+    void clearBackupFilePath();
 
 private:
-	QString mFilePathIn;
-	QString mFilePathOut;
-	QString mBackupPath;
-
-	OverwriteMode mMode = mode_skip_existing;
-	int mCompression = -1;
-	bool mDeleteOriginal = false;
-	bool mInputDirIsOutputDir = false;
-
+    QString mFilePathIn;
+    QString mFilePathOut;
+    QString mBackupPath;
+
+    OverwriteMode mMode = mode_skip_existing;
+    int mCompression = -1;
+    bool mDeleteOriginal = false;
+    bool mInputDirIsOutputDir = false;
 };
 
 }
diff --git a/ImageLounge/src/DkCore/DkDependencyResolver.cpp b/ImageLounge/src/DkCore/DkDependencyResolver.cpp
index 82baa6b..b29379d 100644
--- a/ImageLounge/src/DkCore/DkDependencyResolver.cpp
+++ b/ImageLounge/src/DkCore/DkDependencyResolver.cpp
@@ -27,141 +27,141 @@
 
 #include "DkDependencyResolver.h"
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QFile>
-#include <QDebug>
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QByteArrayMatcher>
+#include <QDebug>
+#include <QFile>
 #include <QFileInfo>
-#pragma warning(pop)		// no warnings from includes - end
+#include <limits>
+#pragma warning(pop) // no warnings from includes - end
 
-namespace nmc {
+namespace nmc
+{
 
-DkDllDependency::DkDllDependency(const QString & filePath) {
-	mFilePath = filePath;
+DkDllDependency::DkDllDependency(const QString &filePath)
+{
+    mFilePath = filePath;
 }
 
-bool DkDllDependency::findDependencies() {
-	
-	if (mFilePath.isEmpty()) {
-		qWarning() << "cannot find dependenies - dll path is empty...";
-		return false;
-	}
+bool DkDllDependency::findDependencies()
+{
+    if (mFilePath.isEmpty()) {
+        qWarning() << "cannot find dependenies - dll path is empty...";
+        return false;
+    }
 
-	QFile dllFile(mFilePath);
+    QFile dllFile(mFilePath);
 
-	if (!dllFile.open(QIODevice::ReadOnly)) {
-		qWarning() << "cannot open" << mFilePath << "for read...";
-		return false;
-	}
+    if (!dllFile.open(QIODevice::ReadOnly)) {
+        qWarning() << "cannot open" << mFilePath << "for read...";
+        return false;
+    }
 
-	mDependencies.clear();
+    mDependencies.clear();
 
-	QByteArray ba(dllFile.readAll());
-	dllFile.close();
+    QByteArray ba(dllFile.readAll());
+    dllFile.close();
 
-	QString myName = QFileInfo(mFilePath).fileName();
-	QVector<int> dllLocations = markerLocations(ba, marker());
+    QString myName = QFileInfo(mFilePath).fileName();
+    QVector<int> dllLocations = markerLocations(ba, marker());
 
-	for (int l : dllLocations) {
-		
-		QString n = resolveName(ba, l);
+    for (int l : dllLocations) {
+        QString n = resolveName(ba, l);
 
-		if (!n.isEmpty() && n != myName) {
-			mDependencies << n;
-		}
-		else if (n.isEmpty())
-			qWarning() << "I could not resolve the name at location" << l;
-	}
+        if (!n.isEmpty() && n != myName) {
+            mDependencies << n;
+        } else if (n.isEmpty())
+            qWarning() << "I could not resolve the name at location" << l;
+    }
 
-	return true;
+    return true;
 }
 
-QStringList DkDllDependency::filteredDependencies() const {
-	
-	QStringList fd;
-	QRegExp re(filter());
-
-	for (const QString& n : mDependencies) {
-		
-		if (re.exactMatch(n)) {
-			fd << n;
-		}
-	}
-	
-	return fd;
+QStringList DkDllDependency::filteredDependencies() const
+{
+    QStringList fd;
+    QRegExp re(filter());
+
+    for (const QString &n : mDependencies) {
+        if (re.exactMatch(n)) {
+            fd << n;
+        }
+    }
+
+    return fd;
 }
 
-QStringList DkDllDependency::dependencies() const {
-	return mDependencies;
+QStringList DkDllDependency::dependencies() const
+{
+    return mDependencies;
 }
 
-QString DkDllDependency::filePath() const {
-	return mFilePath;
+QString DkDllDependency::filePath() const
+{
+    return mFilePath;
 }
 
-QString DkDllDependency::filter() {
-	
-	static QString filter = "(opencv.*|Read.*|libDk.*)";
+QString DkDllDependency::filter()
+{
+    static QString filter = "(opencv.*|Read.*|libDk.*)";
 
-	return filter;
+    return filter;
 }
 
-QByteArray DkDllDependency::marker() {
-	
-	static QByteArray m(".dll");
-	return m;
+QByteArray DkDllDependency::marker()
+{
+    static QByteArray m(".dll");
+    return m;
 }
 
-QVector<int> DkDllDependency::markerLocations(const QByteArray & ba, const QByteArray & marker) const {
-	
-	QByteArrayMatcher matcher(marker);
-	QVector<int> locations;
+QVector<int> DkDllDependency::markerLocations(const QByteArray &ba, const QByteArray &marker) const
+{
+    QByteArrayMatcher matcher(marker);
+    QVector<int> locations;
+
+    for (int offset = 0; offset < ba.size();) {
+        int idx = matcher.indexIn(ba, offset);
 
-	for (int offset = 0; offset < ba.size(); ) {
-		
-		int idx = matcher.indexIn(ba, offset);
+        if (idx == -1)
+            break;
 
-		if (idx == -1)
-			break;
+        offset = idx + 1;
+        locations << idx;
+    }
 
-		offset = idx+1;
-		locations << idx;
-	}
-	
-	return locations;
+    return locations;
 }
 
-QString DkDllDependency::resolveName(const QByteArray & ba, int location) const {
-
-	// dll names are terminated with NULL on both sides - so find their index...
-	int start = -1;
-	for (int idx = location; idx > 0; idx--) {
-		
-		if (isStopCharacter(ba[idx])) {
-			start = idx;
-			break;
-		}
-	}
-
-	if (start == -1)
-		return QString();
-
-	int end = -1;
-	for (int idx = location; idx < ba.size(); idx++) {
-		
-		if (isStopCharacter(ba[idx])) {
-			end = idx;
-			break;
-		}
-	}
-
-	QString name(ba.mid(start+1, end - start));
-
-	return name;
+QString DkDllDependency::resolveName(const QByteArray &ba, int location) const
+{
+    // dll names are terminated with NULL on both sides - so find their index...
+    int start = -1;
+    for (int idx = location; idx > 0; idx--) {
+        if (isStopCharacter(ba[idx])) {
+            start = idx;
+            break;
+        }
+    }
+
+    if (start == -1)
+        return QString();
+
+    int end = -1;
+    for (int idx = location; idx < ba.size(); idx++) {
+        if (isStopCharacter(ba[idx])) {
+            end = idx;
+            break;
+        }
+    }
+
+    QString name(ba.mid(start + 1, end - start));
+
+    return name;
 }
 
-bool DkDllDependency::isStopCharacter(const char& val) const {
-	return val == '\0' || val == '\u0001' || val == '\u0003' || val == '\u0006';	// NULL || SOH || ETX || ACK
+bool DkDllDependency::isStopCharacter(const char &val) const
+{
+    return val == '\0' || val == '\u0001' || val == '\u0003' || val == '\u0006'; // NULL || SOH || ETX || ACK
 }
 
 }
diff --git a/ImageLounge/src/DkCore/DkDependencyResolver.h b/ImageLounge/src/DkCore/DkDependencyResolver.h
index 1181da6..b4b4470 100644
--- a/ImageLounge/src/DkCore/DkDependencyResolver.h
+++ b/ImageLounge/src/DkCore/DkDependencyResolver.h
@@ -27,10 +27,10 @@
 
 #pragma once
 
-#pragma warning(push, 0)	// no warnings from includes - begin
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QString>
 #include <QStringList>
-#pragma warning(pop)		// no warnings from includes - end
+#pragma warning(pop) // no warnings from includes - end
 
 #ifndef DllCoreExport
 #ifdef DK_CORE_DLL_EXPORT
@@ -42,33 +42,34 @@
 #endif
 #endif
 
-#pragma warning(disable: 4251)	// TODO: remove
+#pragma warning(disable : 4251) // TODO: remove
 
 // Qt defines
 
-namespace nmc {
-
-class DllCoreExport DkDllDependency {
+namespace nmc
+{
 
+class DllCoreExport DkDllDependency
+{
 public:
-	DkDllDependency(const QString& filePath);
+    DkDllDependency(const QString &filePath);
 
-	bool findDependencies();
+    bool findDependencies();
 
-	QStringList filteredDependencies() const;
-	QStringList dependencies() const;
-	QString filePath() const;
+    QStringList filteredDependencies() const;
+    QStringList dependencies() const;
+    QString filePath() const;
 
-	static QString filter();
-	static QByteArray marker();
+    static QString filter();
+    static QByteArray marker();
 
 protected:
-	QString mFilePath;
-	QStringList mDependencies;
+    QString mFilePath;
+    QStringList mDependencies;
 
-	QVector<int> markerLocations(const QByteArray& ba, const QByteArray& marker) const;
-	QString resolveName(const QByteArray& ba, int location) const;
-	bool isStopCharacter(const char& val) const;
+    QVector<int> markerLocations(const QByteArray &ba, const QByteArray &marker) const;
+    QString resolveName(const QByteArray &ba, int location) const;
+    bool isStopCharacter(const char &val) const;
 };
 
 }
diff --git a/ImageLounge/src/DkCore/DkImageContainer.cpp b/ImageLounge/src/DkCore/DkImageContainer.cpp
index 810994d..ebe0fc1 100644
--- a/ImageLounge/src/DkCore/DkImageContainer.cpp
+++ b/ImageLounge/src/DkCore/DkImageContainer.cpp
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkImageContainer.cpp
  Created on:	21.02.2014
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2014 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2014 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2014 Florian Kleber <florian@nomacs.org>
@@ -26,30 +26,33 @@
  *******************************************************************************************************/
 
 #include "DkImageContainer.h"
+#include "DkBasicLoader.h"
 #include "DkImageStorage.h"
 #include "DkMetaData.h"
-#include "DkThumbs.h"
-#include "DkBasicLoader.h"
 #include "DkSettings.h"
-#include "DkUtils.h"
+#include "DkThumbs.h"
 #include "DkTimer.h"
+#include "DkUtils.h"
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QObject>
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QImage>
+#include <QObject>
 #include <QtConcurrentRun>
 
 // quazip
 #ifdef WITH_QUAZIP
+#ifdef WITH_QUAZIP1
+#include <quazip/JlCompress.h>
+#else
 #include <quazip5/JlCompress.h>
 #endif
-#pragma warning(pop)		// no warnings from includes - end
-
-#pragma warning(disable: 4251)	// TODO: remove
-
+#endif
+#pragma warning(pop) // no warnings from includes - end
 
-namespace nmc {
+#pragma warning(disable : 4251) // TODO: remove
 
+namespace nmc
+{
 #ifdef WITH_QUAZIP
 QString DkZipContainer::mZipMarker = "dIrChAr";
 #endif
@@ -58,83 +61,85 @@ QString DkZipContainer::mZipMarker = "dIrChAr";
 /**
  * Creates a DkImageContainer.
  * This class is the basic image management class.
- * @param fileInfo the file of the given 
- **/ 
-DkImageContainer::DkImageContainer(const QString& filePath) {
-	
-	setFilePath(filePath);
-	init();
+ * @param fileInfo the file of the given
+ **/
+DkImageContainer::DkImageContainer(const QString &filePath)
+{
+    setFilePath(filePath);
+    init();
 }
 
-DkImageContainer::~DkImageContainer() {
+DkImageContainer::~DkImageContainer()
+{
 }
 
-void DkImageContainer::init() {
-
-	mEdited = false;
-	mSelected = false;
-
-	// always keep in mind that a file does not exist
-	if (!mEdited && mLoadState != exists_not)
-		mLoadState = not_loaded;
+void DkImageContainer::init()
+{
+    mEdited = false;
+    mSelected = false;
 
+    // always keep in mind that a file does not exist
+    if (!mEdited && mLoadState != exists_not)
+        mLoadState = not_loaded;
 }
 
-bool DkImageContainer::operator==(const DkImageContainer& ric) const {
-	return mFilePath == ric.filePath();
+bool DkImageContainer::operator==(const DkImageContainer &ric) const
+{
+    return mFilePath == ric.filePath();
 }
 
-bool DkImageContainer::operator<=(const DkImageContainer& o) const {
-
-	if (*this == o)
-		return true;
+bool DkImageContainer::operator<=(const DkImageContainer &o) const
+{
+    if (*this == o)
+        return true;
 
-	return *this < o;
+    return *this < o;
 }
 
-bool DkImageContainer::operator<(const DkImageContainer& o) const {
-
-	return imageContainerLessThan(*this, o);
+bool DkImageContainer::operator<(const DkImageContainer &o) const
+{
+    return imageContainerLessThan(*this, o);
 }
 
-bool DkImageContainer::operator>(const DkImageContainer& o) const {
-
-	return !imageContainerLessThan(*this, o);
+bool DkImageContainer::operator>(const DkImageContainer &o) const
+{
+    return !imageContainerLessThan(*this, o);
 }
 
-bool DkImageContainer::operator>=(const DkImageContainer& o) const {
+bool DkImageContainer::operator>=(const DkImageContainer &o) const
+{
+    if (*this == o)
+        return true;
 
-	if (*this == o)
-		return true;
-
-	return !imageContainerLessThan(*this, o);
+    return !imageContainerLessThan(*this, o);
 }
 
-
-void DkImageContainer::clear() {
-
-	if (mLoader)
-		mLoader->release();
-	if (mFileBuffer)
-		mFileBuffer->clear();
-	init();
+void DkImageContainer::clear()
+{
+    if (mLoader)
+        mLoader->release();
+    if (mFileBuffer)
+        mFileBuffer->clear();
+    init();
 }
 
-void DkImageContainer::undo() {
-
-	getLoader()->undo();
+void DkImageContainer::undo()
+{
+    getLoader()->undo();
 }
 
-void DkImageContainer::redo() {
-
-	getLoader()->redo();
+void DkImageContainer::redo()
+{
+    getLoader()->redo();
 }
 
-void DkImageContainer::setHistoryIndex(int idx) {
-	getLoader()->setHistoryIndex(idx);
+void DkImageContainer::setHistoryIndex(int idx)
+{
+    getLoader()->setHistoryIndex(idx);
 }
 
-void DkImageContainer::cropImage(const DkRotatingRect& rect, const QColor& col, bool cropToMetadata) {
+void DkImageContainer::cropImage(const DkRotatingRect &rect, const QColor &col, bool cropToMetadata)
+{
     if (!cropToMetadata) {
         QImage cropped = DkImage::cropToImage(image(), rect, col);
         setImage(cropped, QObject::tr("Cropped"));
@@ -143,928 +148,949 @@ void DkImageContainer::cropImage(const DkRotatingRect& rect, const QColor& col,
         getMetaData()->saveRectToXMP(rect, image().size());
 }
 
-void DkImageContainer::cropImage(const QRect& rect, const QTransform& t, const QColor& col) {
-
-	QImage cropped = DkImage::cropToImage(image(), rect, t, col);
-	setImage(cropped, QObject::tr("Cropped"));
-	getMetaData()->clearXMPRect();
+QFileInfo DkImageContainer::fileInfo() const
+{
+    return mFileInfo;
 }
 
-QFileInfo DkImageContainer::fileInfo() const {
-	return mFileInfo;
+QString DkImageContainer::filePath() const
+{
+    return mFilePath;
 }
 
-QString DkImageContainer::filePath() const {
-
-	return mFilePath;
-}
-
-QString DkImageContainer::dirPath() const {
-	
-	if (!mFileInfo.isFile())
-		return "";
+QString DkImageContainer::dirPath() const
+{
+    if (!mFileInfo.isFile())
+        return "";
 
 #ifdef WITH_QUAZIP
-	if (mZipData && mZipData->isZip())
-		mZipData->getZipFilePath();
+    if (mZipData && mZipData->isZip())
+        mZipData->getZipFilePath();
 #endif
 
-	return mFileInfo.absolutePath();
+    return mFileInfo.absolutePath();
 }
 
-QString DkImageContainer::fileName() const {
-
-	return mFileInfo.fileName();
+QString DkImageContainer::fileName() const
+{
+    return mFileInfo.fileName();
 }
 
-bool DkImageContainer::isFromZip() {
-
+bool DkImageContainer::isFromZip()
+{
 #ifdef WITH_QUAZIP
-	return getZipData() && getZipData()->isZip();
+    return getZipData() && getZipData()->isZip();
 #else
-	return false;
+    return false;
 #endif
 }
 
-bool DkImageContainer::exists() {
-
+bool DkImageContainer::exists()
+{
 #ifdef WITH_QUAZIP
 
-	if (isFromZip())
-		return true;
+    if (isFromZip())
+        return true;
 #endif
 
-	return QFileInfo(mFilePath).exists();
-}
-
-QString DkImageContainer::getTitleAttribute() const {
-
-	if (!mLoader || mLoader->getNumPages() <= 1)
-		return QString();
-
-	QString attr = "[" + QString::number(mLoader->getPageIdx()) + "/" + 
-		QString::number(mLoader->getNumPages()) + "]";
-
-	return attr;
+    return QFileInfo(mFilePath).exists();
 }
 
-QSharedPointer<DkBasicLoader> DkImageContainer::getLoader() {
+QString DkImageContainer::getTitleAttribute() const
+{
+    if (!mLoader || mLoader->getNumPages() <= 1)
+        return QString();
 
-	if (!mLoader) {
-		mLoader = QSharedPointer<DkBasicLoader>(new DkBasicLoader());
-	}
+    QString attr = "[" + QString::number(mLoader->getPageIdx()) + "/" + QString::number(mLoader->getNumPages()) + "]";
 
-	return mLoader;
+    return attr;
 }
 
-QSharedPointer<DkMetaDataT> DkImageContainer::getMetaData() {
+QSharedPointer<DkBasicLoader> DkImageContainer::getLoader()
+{
+    if (!mLoader) {
+        mLoader = QSharedPointer<DkBasicLoader>(new DkBasicLoader());
+    }
 
-	return getLoader()->getMetaData();
+    return mLoader;
 }
 
-QSharedPointer<DkThumbNailT> DkImageContainer::getThumb() {
-
-	if (!mThumb) {
-#ifdef WITH_QUAZIP	
-		if(isFromZip()) 
-			mThumb = QSharedPointer<DkThumbNailT>(new DkThumbNailT(getZipData()->getEncodedFilePath()));
-		else
-			mThumb = QSharedPointer<DkThumbNailT>(new DkThumbNailT(mFilePath));
+/**
+ * @brief Returns the pointer to the current metadata object, see DkBasicLoader::getMetaData().
+ *
+ * @return QSharedPointer<DkMetaDataT>
+ */
+QSharedPointer<DkMetaDataT> DkImageContainer::getMetaData()
+{
+    return getLoader()->getMetaData();
+}
+
+QSharedPointer<DkThumbNailT> DkImageContainer::getThumb()
+{
+    if (!mThumb) {
+#ifdef WITH_QUAZIP
+        if (isFromZip())
+            mThumb = QSharedPointer<DkThumbNailT>(new DkThumbNailT(getZipData()->getEncodedFilePath()));
+        else
+            mThumb = QSharedPointer<DkThumbNailT>(new DkThumbNailT(mFilePath));
 #else
-		mThumb = QSharedPointer<DkThumbNailT>(new DkThumbNailT(mFilePath));
-#endif	
-	}
+        mThumb = QSharedPointer<DkThumbNailT>(new DkThumbNailT(mFilePath));
+#endif
+    }
 
-	return mThumb;
+    return mThumb;
 }
 
-QSharedPointer<DkImageContainerT> DkImageContainerT::fromImageContainer(QSharedPointer<DkImageContainer> imgC) {
+QSharedPointer<DkImageContainerT> DkImageContainerT::fromImageContainer(QSharedPointer<DkImageContainer> imgC)
+{
+    if (!imgC)
+        return QSharedPointer<DkImageContainerT>();
 
-	if (!imgC)
-		return QSharedPointer<DkImageContainerT>();
+    QSharedPointer<DkImageContainerT> imgCT = QSharedPointer<DkImageContainerT>(new DkImageContainerT(imgC->filePath()));
 
-	QSharedPointer<DkImageContainerT> imgCT = QSharedPointer<DkImageContainerT>(new DkImageContainerT(imgC->filePath()));
-	
-	imgCT->mLoader = imgC->getLoader();
-	imgCT->mEdited = imgC->isEdited();
-	imgCT->mSelected = imgC->isSelected();
-	imgCT->mThumb = imgC->getThumb();
-	imgCT->mLoadState = imgC->getLoadState();
-	imgCT->mFileBuffer = imgC->getFileBuffer();
+    imgCT->mLoader = imgC->getLoader();
+    imgCT->mEdited = imgC->isEdited();
+    imgCT->mSelected = imgC->isSelected();
+    imgCT->mThumb = imgC->getThumb();
+    imgCT->mLoadState = imgC->getLoadState();
+    imgCT->mFileBuffer = imgC->getFileBuffer();
 
-	return imgCT;
+    return imgCT;
 }
 
-QSharedPointer<QByteArray> DkImageContainer::getFileBuffer() {
+QSharedPointer<QByteArray> DkImageContainer::getFileBuffer()
+{
+    if (!mFileBuffer) {
+        mFileBuffer = QSharedPointer<QByteArray>(new QByteArray());
+    }
 
-	if (!mFileBuffer) {
-		mFileBuffer = QSharedPointer<QByteArray>(new QByteArray());
-	}
-
-	return mFileBuffer;
+    return mFileBuffer;
 }
 
-float DkImageContainer::getMemoryUsage() const {
+float DkImageContainer::getMemoryUsage() const
+{
+    if (!mLoader)
+        return 0;
 
-	if (!mLoader)
-		return 0;
+    float memSize = mFileBuffer ? mFileBuffer->size() / (1024.0f * 1024.0f) : 0;
+    memSize += DkImage::getBufferSizeFloat(mLoader->image().size(), mLoader->image().depth());
 
-	float memSize = mFileBuffer ? mFileBuffer->size()/(1024.0f*1024.0f) : 0;
-	memSize += DkImage::getBufferSizeFloat(mLoader->image().size(), mLoader->image().depth());
+    return memSize;
+}
 
-	return memSize;
+float DkImageContainer::getFileSize() const
+{
+    return QFileInfo(mFilePath).size() / (1024.0f * 1024.0f);
 }
 
-float DkImageContainer::getFileSize() const {
+DkRotatingRect DkImageContainer::cropRect()
+{
+    QSharedPointer<DkMetaDataT> metaData = getMetaData();
 
-	return QFileInfo(mFilePath).size()/(1024.0f*1024.0f);
-}
+    if (metaData) {
+        return metaData->getXMPRect(image().size());
+    } else
+        qWarning() << "empty crop rect because there are no metadata...";
 
-DkRotatingRect DkImageContainer::cropRect() {
+    return DkRotatingRect();
+}
 
-	QSharedPointer<DkMetaDataT> metaData = getMetaData();
+QImage DkImageContainer::image()
+{
+    if (getLoader()->image().isNull() && getLoadState() == not_loaded)
+        loadImage();
 
-	if (metaData) {
-		return metaData->getXMPRect(image().size());
-	}
-	else
-		qWarning() << "empty crop rect because there are no metadata...";
+    return mLoader->pixmap(); // current pixmap (rotated pixmap after exif rotation)
+}
 
-	return DkRotatingRect();
+QImage DkImageContainer::pixmap()
+{
+    return mLoader->pixmap();
 }
 
+QImage DkImageContainer::imageScaledToHeight(int height)
+{
+    // check cash first
+    for (const QImage &img : scaledImages) {
+        if (img.height() == height)
+            return img;
+    }
 
-QImage DkImageContainer::image() {
+    // cache it
+    QImage sImg = image().scaledToHeight(height, Qt::SmoothTransformation);
+    scaledImages << sImg;
 
-	if (getLoader()->image().isNull() && getLoadState() == not_loaded)
-		loadImage();
+    // clean up
+    if (scaledImages.size() > 10)
+        scaledImages.pop_front();
 
-	return mLoader->image();
+    return sImg;
 }
 
-QImage DkImageContainer::imageScaledToHeight(int height) {
-
-	// check cash first
-	for (const QImage& img : scaledImages) {
-		if (img.height() == height)
-			return img;
-	}
+QImage DkImageContainer::imageScaledToWidth(int width)
+{
+    // check cache first
+    for (const QImage &img : scaledImages) {
+        if (img.width() == width)
+            return img;
+    }
 
-	// cache it
-	QImage sImg = image().scaledToHeight(height, Qt::SmoothTransformation);
-	scaledImages << sImg;
+    // cache it
+    QImage sImg = image().scaledToWidth(width, Qt::SmoothTransformation);
+    scaledImages << sImg;
 
-	// clean up
-	if (scaledImages.size() > 10)
-		scaledImages.pop_front();
+    // clean up
+    if (scaledImages.size() > 10)
+        scaledImages.pop_front();
 
-	return sImg;
+    return sImg;
 }
 
-QImage DkImageContainer::imageScaledToWidth(int width) {
+void DkImageContainer::setImage(const QImage &img, const QString &editName)
+{
+    getLoader()->setEditImage(img, editName);
+    mEdited = true;
+}
 
-	// check cache first
-	for (const QImage& img : scaledImages) {
-		if (img.width() == width)
-			return img;
-	}
+void DkImageContainer::setImage(const QImage &img, const QString &editName, const QString &filePath)
+{
+    scaledImages.clear(); // invalid now
 
-	// cache it
-	QImage sImg = image().scaledToWidth(width, Qt::SmoothTransformation);
-	scaledImages << sImg;
+    setFilePath(mFilePath);
+    getLoader()->setImage(img, editName, filePath); // set new image
+    mEdited = true;
+}
 
-	// clean up
-	if (scaledImages.size() > 10)
-		scaledImages.pop_front();
+void DkImageContainer::setMetaData(QSharedPointer<DkMetaDataT> editedMetaData, const QImage &img, const QString &editName)
+{
+    // Add edit history entry with explicitly edited metadata (hasMetaData()) and implicitly modified image
+    // how about a signal?
 
-	return sImg;
+    getLoader()->setEditMetaData(editedMetaData, img, editName);
+    mEdited = true;
 }
 
-void DkImageContainer::setImage(const QImage& img, const QString& editName) {
+void DkImageContainer::setMetaData(QSharedPointer<DkMetaDataT> editedMetaData, const QString &editName)
+{
+    // Add edit history entry with explicitly edited metadata (hasMetaData()) and implicitly modified image
+    // how about a signal?
 
-	setImage(img, editName, mFilePath);
+    getLoader()->setEditMetaData(editedMetaData, editName);
+    mEdited = true;
 }
 
-void DkImageContainer::setImage(const QImage& img, const QString& editName, const QString& filePath) {
+void DkImageContainer::setMetaData(const QString &editName)
+{
+    // Add edit history entry with explicitly edited metadata (hasMetaData()) and implicitly modified image
 
-	scaledImages.clear();	// invalid now
-
-	setFilePath(mFilePath);
-	getLoader()->setImage(img, editName, filePath);
-	mEdited = true;
+    getLoader()->setEditMetaData(editName);
+    mEdited = true;
 }
 
-void DkImageContainer::setFilePath(const QString& filePath) {
-
-	mFilePath = filePath;
-	mFileInfo = filePath;
+void DkImageContainer::setFilePath(const QString &filePath)
+{
+    mFilePath = filePath;
+    mFileInfo = filePath;
 
 #ifdef Q_OS_WIN
-#if QT_VERSION < 0x050000
-	mFileNameStr = fileName().toStdWString();
-#else
-	mFileNameStr = DkUtils::qStringToStdWString(fileName());
-#endif
+    mFileNameStr = DkUtils::qStringToStdWString(fileName());
 #endif
-
 }
 
-bool DkImageContainer::hasImage() const {
-
-	if (!mLoader)
-		return false;
+bool DkImageContainer::hasImage() const
+{
+    if (!mLoader)
+        return false;
 
-	return mLoader->hasImage();
+    return mLoader->hasImage();
 }
 
-bool DkImageContainer::hasMovie() const {
-
-	QString newSuffix = QFileInfo(filePath()).suffix();
-	return newSuffix.contains(QRegExp("(avifs|gif|mng|webp)", Qt::CaseInsensitive)) != 0;
+bool DkImageContainer::hasMovie() const
+{
+    QString newSuffix = QFileInfo(filePath()).suffix();
+    return newSuffix.contains(QRegExp("(apng|avif|gif|jxl|mng|webp)", Qt::CaseInsensitive)) != 0;
 }
 
-bool DkImageContainer::hasSvg() const {
-
-	QString newSuffix = QFileInfo(filePath()).suffix();
-	return newSuffix.contains(QRegExp("(svg)", Qt::CaseInsensitive)) != 0;
+bool DkImageContainer::hasSvg() const
+{
+    QString newSuffix = QFileInfo(filePath()).suffix();
+    return newSuffix.contains(QRegExp("(svg)", Qt::CaseInsensitive)) != 0;
 }
 
-int DkImageContainer::getLoadState() const {
-
-	return mLoadState;
+int DkImageContainer::getLoadState() const
+{
+    return mLoadState;
 }
 
-bool DkImageContainer::loadImage() {
-
-	if (!QFileInfo(mFileInfo).exists())
-		return false;
+bool DkImageContainer::loadImage()
+{
+    if (!QFileInfo(mFileInfo).exists())
+        return false;
 
-	if (getFileBuffer()->isEmpty())
-		mFileBuffer = loadFileToBuffer(mFilePath);
+    if (getFileBuffer()->isEmpty())
+        mFileBuffer = loadFileToBuffer(mFilePath);
 
-	mLoader = loadImageIntern(mFilePath, getLoader(), mFileBuffer);
+    mLoader = loadImageIntern(mFilePath, getLoader(), mFileBuffer);
 
-	return mLoader->hasImage();
+    return mLoader->hasImage();
 }
 
-bool DkImageContainer::saveImage(const QString& filePath, int compression /* = -1 */) {
-	return saveImage(filePath, getLoader()->image(), compression);
+bool DkImageContainer::saveImage(const QString &filePath, int compression /* = -1 */)
+{
+    return saveImage(filePath, getLoader()->lastImage(), compression);
 }
 
-bool DkImageContainer::saveImage(const QString& filePath, const QImage saveImg, int compression /* = -1 */) {
-
-	QFileInfo saveFile = saveImageIntern(filePath, getLoader(), saveImg, compression);
+bool DkImageContainer::saveImage(const QString &filePath, const QImage saveImg, int compression /* = -1 */)
+{
+    QFileInfo saveFile = saveImageIntern(filePath, getLoader(), saveImg, compression);
 
-	saveFile.refresh();
-	qDebug() << "save file: " << saveFile.absoluteFilePath();
+    saveFile.refresh();
+    qDebug() << "save file: " << saveFile.absoluteFilePath();
 
-	return saveFile.exists() && saveFile.isFile();
+    return saveFile.exists() && saveFile.isFile();
 }
 
-QSharedPointer<QByteArray> DkImageContainer::loadFileToBuffer(const QString& filePath) {
+QSharedPointer<QByteArray> DkImageContainer::loadFileToBuffer(const QString &filePath)
+{
+    QFileInfo fInfo = filePath;
 
-	QFileInfo fInfo = filePath;
-
-	if (fInfo.isSymLink())
-		fInfo = fInfo.symLinkTarget();
+    if (fInfo.isSymLink())
+        fInfo = fInfo.symLinkTarget();
 
 #ifdef WITH_QUAZIP
-	if (isFromZip()) 
-		return getZipData()->extractImage(getZipData()->getZipFilePath(), getZipData()->getImageFileName());
+    if (isFromZip())
+        return getZipData()->extractImage(getZipData()->getZipFilePath(), getZipData()->getImageFileName());
 #endif
 
-	if (fInfo.suffix().contains("psd")) {	// for now just psd's are not cached because their file might be way larger than the part we need to read
-		return QSharedPointer<QByteArray>(new QByteArray());
-	}
+    if (fInfo.suffix().contains("psd")) { // for now just psd's are not cached because their file might be way larger than the part we need to read
+        return QSharedPointer<QByteArray>(new QByteArray());
+    }
 
-	QFile file(fInfo.absoluteFilePath());
-	file.open(QIODevice::ReadOnly);
+    QFile file(fInfo.absoluteFilePath());
+    file.open(QIODevice::ReadOnly);
 
-	QSharedPointer<QByteArray> ba(new QByteArray(file.readAll()));
-	file.close();
+    QSharedPointer<QByteArray> ba(new QByteArray(file.readAll()));
+    file.close();
 
-	return ba;
+    return ba;
 }
 
+QSharedPointer<DkBasicLoader>
+DkImageContainer::loadImageIntern(const QString &filePath, QSharedPointer<DkBasicLoader> loader, const QSharedPointer<QByteArray> fileBuffer)
+{
+    try {
+        loader->loadGeneral(filePath, fileBuffer, true, false);
+    } catch (...) {
+        qWarning() << "Unknown error in DkImageContainer::lfoadImageIntern";
+    }
 
-QSharedPointer<DkBasicLoader> DkImageContainer::loadImageIntern(const QString& filePath, QSharedPointer<DkBasicLoader> loader, const QSharedPointer<QByteArray> fileBuffer) {
-
-	try {
-		loader->loadGeneral(filePath, fileBuffer, true, false);
-	} catch (...) {
-		qWarning() << "Unknown error in DkImageContainer::lfoadImageIntern";
-	}
-
-	return loader;
+    return loader;
 }
 
-QString DkImageContainer::saveImageIntern(const QString& filePath, QSharedPointer<DkBasicLoader> loader, QImage saveImg, int compression) {
-
-	return loader->save(filePath, saveImg, compression);
+QString DkImageContainer::saveImageIntern(const QString &filePath, QSharedPointer<DkBasicLoader> loader, QImage saveImg, int compression)
+{
+    return loader->save(filePath, saveImg, compression);
 }
 
-void DkImageContainer::saveMetaData() {
+void DkImageContainer::saveMetaData()
+{
+    if (!mLoader)
+        return;
 
-	if (!mLoader)
-		return;
-
-	saveMetaDataIntern(mFilePath, mLoader, mFileBuffer);
+    saveMetaDataIntern(mFilePath, mLoader, mFileBuffer);
 }
 
-void DkImageContainer::saveMetaDataIntern(const QString& filePath, QSharedPointer<DkBasicLoader> loader, QSharedPointer<QByteArray> fileBuffer) {
-
-	loader->saveMetaData(filePath, fileBuffer);
+void DkImageContainer::saveMetaDataIntern(const QString &filePath, QSharedPointer<DkBasicLoader> loader, QSharedPointer<QByteArray> fileBuffer)
+{
+    // TODO this shouldn't be used without notifying the user, see issue #799
+    loader->saveMetaData(filePath, fileBuffer);
 }
 
-void DkImageContainer::setEdited(bool edited) {
-	mEdited = edited;
+void DkImageContainer::setEdited(bool edited /* = true */)
+{
+    mEdited = edited;
 }
 
-bool DkImageContainer::isEdited() const {
-
-	return mEdited;
+bool DkImageContainer::isEdited() const
+{
+    return mEdited;
 }
 
-bool DkImageContainer::isSelected() const {
-
-	return mSelected;
+bool DkImageContainer::isSelected() const
+{
+    return mSelected;
 }
 
-bool DkImageContainer::setPageIdx(int skipIdx) {
-
-	return getLoader()->setPageIdx(skipIdx);
+bool DkImageContainer::setPageIdx(int skipIdx)
+{
+    return getLoader()->setPageIdx(skipIdx);
 }
 
-
 #ifdef WITH_QUAZIP
-QSharedPointer<DkZipContainer> DkImageContainer::getZipData() {
-
-	if (!mZipData) {
-		mZipData = QSharedPointer<DkZipContainer>(new DkZipContainer(mFilePath));
-		if (mZipData->isZip()) {
-			setFilePath(mZipData->getImageFileName());
-			//mFileInfo = mZipData->getZipFilePath();
-			qDebug() << "new fileInfoPath: " << mFileInfo.absoluteFilePath();
-		}
-	}
-
-	return mZipData;
+QSharedPointer<DkZipContainer> DkImageContainer::getZipData()
+{
+    if (!mZipData) {
+        mZipData = QSharedPointer<DkZipContainer>(new DkZipContainer(mFilePath));
+        if (mZipData->isZip()) {
+            setFilePath(mZipData->getImageFileName());
+            // mFileInfo = mZipData->getZipFilePath();
+            qDebug() << "new fileInfoPath: " << mFileInfo.absoluteFilePath();
+        }
+    }
+
+    return mZipData;
 }
 #endif
 #ifdef Q_OS_WIN
-std::wstring DkImageContainer::getFileNameWStr() const {
-	
-	return mFileNameStr;
+std::wstring DkImageContainer::getFileNameWStr() const
+{
+    return mFileNameStr;
 }
 #endif
 
-bool imageContainerLessThanPtr(const QSharedPointer<DkImageContainer> l, const QSharedPointer<DkImageContainer> r) {
+bool imageContainerLessThanPtr(const QSharedPointer<DkImageContainer> l, const QSharedPointer<DkImageContainer> r)
+{
+    if (!l || !r)
+        return false;
 
-	if (!l || !r)
-		return false;
-
-	return imageContainerLessThan(*l, *r);
+    return imageContainerLessThan(*l, *r);
 }
 
-bool imageContainerLessThan(const DkImageContainer& l, const DkImageContainer& r) {
-
-	switch(DkSettingsManager::param().global().sortMode) {
-
-	case DkSettings::sort_filename:
+bool imageContainerLessThan(const DkImageContainer &l, const DkImageContainer &r)
+{
+    switch (DkSettingsManager::param().global().sortMode) {
+    case DkSettings::sort_filename:
 #ifdef Q_OS_WIN
-		// not beautiful if you take a look at the code, but:
-		// time on Win8 with compFilename:
-		//		WinAPI, indexed ( 73872 ) files in:  " 92 ms"
-		//		[DkImageLoader]  73872  containers created in  " 1.825 sec"
-		//		[DkImageLoader] after sorting:  " 52.246 sec"
-		// time on Win8 with direct wCompLogic:
-		//		WinAPI, indexed ( 73872 ) files in:  " 63 ms"
-		//		[DkImageLoader]  73872  containers created in  " 1.203 sec"
-		//		[DkImageLoader] after sorting:  " 14.407 sec"
-		if (DkSettingsManager::param().global().sortDir == DkSettings::sort_ascending)
-			return DkUtils::wCompLogic(l.getFileNameWStr(), r.getFileNameWStr());
-		else
-			return !DkUtils::wCompLogic(l.getFileNameWStr(), r.getFileNameWStr());
-		break;
+        // not beautiful if you take a look at the code, but:
+        // time on Win8 with compFilename:
+        //		WinAPI, indexed ( 73872 ) files in:  " 92 ms"
+        //		[DkImageLoader]  73872  containers created in  " 1.825 sec"
+        //		[DkImageLoader] after sorting:  " 52.246 sec"
+        // time on Win8 with direct wCompLogic:
+        //		WinAPI, indexed ( 73872 ) files in:  " 63 ms"
+        //		[DkImageLoader]  73872  containers created in  " 1.203 sec"
+        //		[DkImageLoader] after sorting:  " 14.407 sec"
+        if (DkSettingsManager::param().global().sortDir == DkSettings::sort_ascending)
+            return DkUtils::wCompLogic(l.getFileNameWStr(), r.getFileNameWStr());
+        else
+            return !DkUtils::wCompLogic(l.getFileNameWStr(), r.getFileNameWStr());
 #else
-		if (DkSettingsManager::param().global().sortDir == DkSettings::sort_ascending)
-			return DkUtils::compFilename(l.fileInfo(), r.fileInfo());
-		else
-			return DkUtils::compFilenameInv(l.fileInfo(), r.fileInfo());
-		break;
+        if (DkSettingsManager::param().global().sortDir == DkSettings::sort_ascending)
+            return DkUtils::compFilename(l.fileInfo(), r.fileInfo());
+        else
+            return DkUtils::compFilenameInv(l.fileInfo(), r.fileInfo());
 #endif
 
-	case DkSettings::sort_date_created:
-		if (DkSettingsManager::param().global().sortDir == DkSettings::sort_ascending)
-			return DkUtils::compDateCreated(l.fileInfo(), r.fileInfo());
-		else
-			return DkUtils::compDateCreatedInv(l.fileInfo(), r.fileInfo());
-		break;
+    case DkSettings::sort_date_created:
+        if (DkSettingsManager::param().global().sortDir == DkSettings::sort_ascending)
+            return DkUtils::compDateCreated(l.fileInfo(), r.fileInfo());
+        else
+            return DkUtils::compDateCreatedInv(l.fileInfo(), r.fileInfo());
 
-	case DkSettings::sort_date_modified:
-		if (DkSettingsManager::param().global().sortDir == DkSettings::sort_ascending)
-			return DkUtils::compDateModified(l.fileInfo(), r.fileInfo());
-		else
-			return DkUtils::compDateModifiedInv(l.fileInfo(), r.fileInfo());
+    case DkSettings::sort_file_size:
+        if (DkSettingsManager::param().global().sortDir == DkSettings::sort_ascending)
+            return DkUtils::compFileSize(l.fileInfo(), r.fileInfo());
+        else
+            return DkUtils::compFileSizeInv(l.fileInfo(), r.fileInfo());
 
-	case DkSettings::sort_random:
-		return DkUtils::compRandom(l.fileInfo(), r.fileInfo());
+    case DkSettings::sort_date_modified:
+        if (DkSettingsManager::param().global().sortDir == DkSettings::sort_ascending)
+            return DkUtils::compDateModified(l.fileInfo(), r.fileInfo());
+        else
+            return DkUtils::compDateModifiedInv(l.fileInfo(), r.fileInfo());
 
-	default:
-		// filename
-		return DkUtils::compFilename(l.fileInfo(), r.fileInfo());
-	}
-	
+    case DkSettings::sort_random:
+        return DkUtils::compRandom(l.fileInfo(), r.fileInfo());
+
+    default:
+        // filename
+        return DkUtils::compFilename(l.fileInfo(), r.fileInfo());
+    }
 }
 
 // DkImageContainerT --------------------------------------------------------------------
-DkImageContainerT::DkImageContainerT(const QString& filePath) : DkImageContainer(filePath) {
-	
-	// our file watcher
-	mFileUpdateTimer.setSingleShot(false);
-	mFileUpdateTimer.setInterval(500);
+DkImageContainerT::DkImageContainerT(const QString &filePath)
+    : DkImageContainer(filePath)
+{
+    // our file watcher
+    mFileUpdateTimer.setSingleShot(false);
+    mFileUpdateTimer.setInterval(500);
 
-	connect(&mFileUpdateTimer, SIGNAL(timeout()), this, SLOT(checkForFileUpdates()), Qt::UniqueConnection);
-	//connect(&metaDataWatcher, SIGNAL(finished()), this, SLOT(metaDataLoaded()));
+    connect(&mFileUpdateTimer, SIGNAL(timeout()), this, SLOT(checkForFileUpdates()), Qt::UniqueConnection);
+    // connect(&metaDataWatcher, SIGNAL(finished()), this, SLOT(metaDataLoaded()));
 }
 
-DkImageContainerT::~DkImageContainerT() {
-	
-	mBufferWatcher.blockSignals(true);
-	mBufferWatcher.cancel();
-	mImageWatcher.blockSignals(true);
-	mImageWatcher.cancel();
+DkImageContainerT::~DkImageContainerT()
+{
+    mBufferWatcher.blockSignals(true);
+    mBufferWatcher.cancel();
+    mImageWatcher.blockSignals(true);
+    mImageWatcher.cancel();
 
-	saveMetaData();
+    // This dtor is where saveMetaData() used to be called, which called the "dangerous" overload of saveMetaData(),
+    // which is dangerous because it updates the file. We consider this to be a bug.
+    // The other place where the file was silently updated in the background was the release() routine, called on unload.
+    // All changes should be explicitly committed, including exif notes.
+    // See issue #799. [2022, PSE]
 
-	// we have to wait here
-	mSaveMetaDataWatcher.blockSignals(true);
-	mSaveImageWatcher.blockSignals(true);
+    // we have to wait here
+    mSaveMetaDataWatcher.blockSignals(true);
+    mSaveImageWatcher.blockSignals(true);
 }
 
-void DkImageContainerT::clear() {
-
-	cancel();
+void DkImageContainerT::clear()
+{
+    cancel();
 
-	if (mFetchingImage || mFetchingBuffer)
-		return;
+    if (mFetchingImage || mFetchingBuffer)
+        return;
 
-	DkImageContainer::clear();
+    DkImageContainer::clear();
 }
 
-void DkImageContainerT::checkForFileUpdates() {
-
+void DkImageContainerT::checkForFileUpdates()
+{
 #ifdef WITH_QUAZIP
-	if(isFromZip()) 
-		setFilePath(getZipData()->getZipFilePath());
+    if (isFromZip())
+        setFilePath(getZipData()->getZipFilePath());
 #endif
 
-	QDateTime modifiedBefore = fileInfo().lastModified();
-	mFileInfo.refresh();
-	
-	bool changed = false;
-
-	// if image exists_not don't do this
-	if (!mFileInfo.exists() && mLoadState == loaded) {
-		changed = true;
-	}
+    QDateTime modifiedBefore = fileInfo().lastModified();
+    mFileInfo.refresh();
 
-	if (mWaitForUpdate != update_loading && mFileInfo.lastModified() != modifiedBefore)
-		mWaitForUpdate = update_pending;
+    bool changed = false;
 
-#ifdef WITH_QUAZIP
-	if(isFromZip()) 
-		setFilePath(getZipData()->getImageFileName());
-#endif
+    // if image exists_not don't do this
+    if (!mFileInfo.exists() && mLoadState == loaded) {
+        changed = true;
+    }
 
-	if (changed) {
-		mFileUpdateTimer.stop();
-		if (DkSettingsManager::param().global().askToSaveDeletedFiles) {
-			mEdited = changed;
-			emit fileLoadedSignal(true);
-		}
-		return;
-	}
-
-	// we use our own file watcher, since the qt watcher
-	// uses locks to check for updates. this might
-	// be more accurate. however, the locks are pretty nasty
-	// if the user e.g. wants to delete the file while watching
-	// it in nomacs
-	if (mWaitForUpdate == update_pending && mFileInfo.isReadable()) {
-	
-		mWaitForUpdate = update_loading;
-		
-		// do not update edited files
-		if (!isEdited())
-			loadImageThreaded(true);
-		else
-			qInfo() << "I would update now - but the image is edited...";
-	}
-}
-
-bool DkImageContainerT::loadImageThreaded(bool force) {
+    if (mWaitForUpdate != update_loading && mFileInfo.lastModified() != modifiedBefore)
+        mWaitForUpdate = update_pending;
 
 #ifdef WITH_QUAZIP
-	//zip archives: get zip file fileInfo for checks
-	if(isFromZip()) 
-		setFilePath(getZipData()->getZipFilePath());
+    if (isFromZip())
+        setFilePath(getZipData()->getImageFileName());
 #endif
-	
-	// check file for updates
-	QFileInfo fileInfo = filePath();
-	QDateTime modifiedBefore = fileInfo.lastModified();
-	fileInfo.refresh();
-
-	if (force || fileInfo.lastModified() != modifiedBefore || getLoader()->isDirty()) {
-		qDebug() << "updating image...";
-		getThumb()->setImage(QImage());
-		clear();
-	}
-
-	// null file?
-	if (fileInfo.fileName().isEmpty() || !fileInfo.exists()) {
-
-		QString msg = tr("Sorry, the file: %1 does not exist... ").arg(fileName());
-		emit showInfoSignal(msg);
-		mLoadState = exists_not;
-		return false;
-	}
-	else if (!fileInfo.permission(QFile::ReadUser)) {
-
-		QString msg = tr("Sorry, you are not allowed to read: %1").arg(fileName());
-		emit showInfoSignal(msg);
-		mLoadState = exists_not;
-		return false;
-	}
 
+    if (changed) {
+        mFileUpdateTimer.stop();
+        if (DkSettingsManager::param().global().askToSaveDeletedFiles) {
+            mEdited = changed;
+            emit fileLoadedSignal(true);
+        }
+        return;
+    }
+
+    // we use our own file watcher, since the qt watcher
+    // uses locks to check for updates. this might
+    // be more accurate. however, the locks are pretty nasty
+    // if the user e.g. wants to delete the file while watching
+    // it in nomacs
+    if (mWaitForUpdate == update_pending && mFileInfo.isReadable()) {
+        mWaitForUpdate = update_loading;
+
+        // do not update edited files
+        if (!isEdited())
+            loadImageThreaded(true);
+        else
+            qInfo() << "I would update now - but the image is edited...";
+    }
+}
+
+bool DkImageContainerT::loadImageThreaded(bool force)
+{
 #ifdef WITH_QUAZIP
-	//zip archives: use the image file info from now on
-	if(isFromZip()) 
-		setFilePath(getZipData()->getImageFileName());
+    // zip archives: get zip file fileInfo for checks
+    if (isFromZip())
+        setFilePath(getZipData()->getZipFilePath());
 #endif
-	
-	mLoadState = loading;
-	fetchFile();
-	return true;
-}
-
-void DkImageContainerT::fetchFile() {
-	
-	if (mFetchingBuffer && getLoadState() == loading_canceled) {
-		mLoadState = loading;	// uncancel loading - we had another call
-		return;
-	}
-	if (mFetchingImage)
-		mImageWatcher.waitForFinished();
-	// I think we missed to return here
-	if (mFetchingBuffer)
-		return;
-
-	// ignore doubled calls
-	if (mFileBuffer && !mFileBuffer->isEmpty()) {
-		bufferLoaded();
-		return;
-	}
-
-	mFetchingBuffer = true;	// saves the threaded call
-	connect(&mBufferWatcher, SIGNAL(finished()), this, SLOT(bufferLoaded()), Qt::UniqueConnection);
-
-	mBufferWatcher.setFuture(QtConcurrent::run(this, 
-		&nmc::DkImageContainerT::loadFileToBuffer, filePath()));
-}
-
-void DkImageContainerT::bufferLoaded() {
-
-	mFetchingBuffer = false;
-
-	if (!mBufferWatcher.isCanceled())
-		mFileBuffer = mBufferWatcher.result();
-
-	if (getLoadState() == loading)
-		fetchImage();
-	else if (getLoadState() == loading_canceled) {
-		mLoadState = not_loaded;
-		clear();
-		return;
-	}
-}
-
-void DkImageContainerT::fetchImage() {
-
-	if (mFetchingBuffer)
-		mBufferWatcher.waitForFinished();
-
-	if (mFetchingImage) {
-		mLoadState = loading;
-		return;
-	}
 
-	if (getLoader()->hasImage() || /*!fileBuffer || fileBuffer->isEmpty() ||*/ mLoadState == exists_not) {
-		loadingFinished();
-		return;
-	}
-	
-	qInfoClean() << "loading " << filePath();
-	mFetchingImage = true;
+    // check file for updates
+    QFileInfo fileInfo = filePath();
+    QDateTime modifiedBefore = fileInfo.lastModified();
+    fileInfo.refresh();
+
+    if (force || fileInfo.lastModified() != modifiedBefore || getLoader()->isDirty()) {
+        qDebug() << "updating image...";
+        getThumb()->setImage(QImage());
+        clear();
+    }
+
+    // null file?
+    if (fileInfo.fileName().isEmpty() || !fileInfo.exists()) {
+        QString msg = tr("Sorry, the file: %1 does not exist... ").arg(fileName());
+        emit showInfoSignal(msg);
+        mLoadState = exists_not;
+        return false;
+    } else if (!fileInfo.permission(QFile::ReadUser)) {
+        QString msg = tr("Sorry, you are not allowed to read: %1").arg(fileName());
+        emit showInfoSignal(msg);
+        mLoadState = exists_not;
+        return false;
+    }
 
-	connect(&mImageWatcher, SIGNAL(finished()), this, SLOT(imageLoaded()), Qt::UniqueConnection);
+#ifdef WITH_QUAZIP
+    // zip archives: use the image file info from now on
+    if (isFromZip())
+        setFilePath(getZipData()->getImageFileName());
+#endif
 
-	mImageWatcher.setFuture(QtConcurrent::run(this, 
-		&nmc::DkImageContainerT::loadImageIntern, filePath(), mLoader, mFileBuffer));
+    mLoadState = loading;
+    fetchFile();
+    return true;
 }
 
-void DkImageContainerT::imageLoaded() {
-
-	mFetchingImage = false;
-
-	if (getLoadState() == loading_canceled) {
-		mLoadState = not_loaded;
-		clear();
-		return;
-	}
+void DkImageContainerT::fetchFile()
+{
+    if (mFetchingBuffer && getLoadState() == loading_canceled) {
+        mLoadState = loading; // uncancel loading - we had another call
+        return;
+    }
+    if (mFetchingImage)
+        mImageWatcher.waitForFinished();
+    // I think we missed to return here
+    if (mFetchingBuffer)
+        return;
+
+    // ignore doubled calls
+    if (mFileBuffer && !mFileBuffer->isEmpty()) {
+        bufferLoaded();
+        return;
+    }
+
+    mFetchingBuffer = true; // saves the threaded call
+    connect(&mBufferWatcher, SIGNAL(finished()), this, SLOT(bufferLoaded()), Qt::UniqueConnection);
+
+    mBufferWatcher.setFuture(QtConcurrent::run(this, &nmc::DkImageContainerT::loadFileToBuffer, filePath()));
+}
+
+void DkImageContainerT::bufferLoaded()
+{
+    mFetchingBuffer = false;
+
+    if (!mBufferWatcher.isCanceled())
+        mFileBuffer = mBufferWatcher.result();
+
+    if (getLoadState() == loading)
+        fetchImage();
+    else if (getLoadState() == loading_canceled) {
+        mLoadState = not_loaded;
+        clear();
+        return;
+    }
+}
+
+void DkImageContainerT::fetchImage()
+{
+    if (mFetchingBuffer)
+        mBufferWatcher.waitForFinished();
+
+    if (mFetchingImage) {
+        mLoadState = loading;
+        return;
+    }
+
+    if (getLoader()->hasImage() || /*!fileBuffer || fileBuffer->isEmpty() ||*/ mLoadState == exists_not) {
+        loadingFinished();
+        return;
+    }
+
+    qInfoClean() << "loading " << filePath();
+    mFetchingImage = true;
+
+    connect(&mImageWatcher, SIGNAL(finished()), this, SLOT(imageLoaded()), Qt::UniqueConnection);
+
+    mImageWatcher.setFuture(QtConcurrent::run(this, &nmc::DkImageContainerT::loadImageIntern, filePath(), mLoader, mFileBuffer));
+}
+
+void DkImageContainerT::imageLoaded()
+{
+    mFetchingImage = false;
+
+    if (getLoadState() == loading_canceled) {
+        mLoadState = not_loaded;
+        clear();
+        return;
+    }
+
+    // deliver image
+    mLoader = mImageWatcher.result();
+
+    loadingFinished();
+}
+
+void DkImageContainerT::loadingFinished()
+{
+    DkTimer dt;
+
+    if (getLoadState() == loading_canceled) {
+        mLoadState = not_loaded;
+        clear();
+        return;
+    }
+
+    // fix the update states
+    if (mWaitForUpdate != update_idle) {
+        if (!getLoader()->hasImage()) {
+            mWaitForUpdate = update_pending;
+            mLoadState = not_loaded;
+            qInfo() << "could not load while updating - is somebody writing to the file?";
+            return;
+        } else {
+            emit showInfoSignal(tr("updated..."));
+            mWaitForUpdate = update_idle;
+        }
+    }
+
+    if (!getLoader()->hasImage()) {
+        mFileUpdateTimer.stop();
+        mEdited = false;
+        QString msg = tr("Sorry, I could not load: %1").arg(fileName());
+        emit showInfoSignal(msg);
+        emit fileLoadedSignal(false);
+        mLoadState = exists_not;
+        return;
+    } else if (!getThumb()->hasImage()) {
+        getThumb()->setImage(getLoader()->image());
+    }
 
-	// deliver image
-	mLoader = mImageWatcher.result();
-
-	loadingFinished();
-}
+    // clear file buffer if it exceeds a certain size?! e.g. psd files
+    if (mFileBuffer) {
+        double bs = mFileBuffer->size() / (1024.0f * 1024.0f);
 
-void DkImageContainerT::loadingFinished() {
+        // if the file buffer is more than 5MB - we check if we need to delete it
+        if (bs > 5 && bs > DkSettingsManager::param().resources().cacheMemory * 0.5f)
+            mFileBuffer->clear();
+    }
 
-	DkTimer dt;
+    mLoadState = loaded;
+    emit fileLoadedSignal(true);
+}
+
+void DkImageContainerT::downloadFile(const QUrl &url)
+{
+    if (!mFileDownloader) {
+        QString savePath = DkSettingsManager::param().global().tmpPath;
+
+        if (!QFileInfo(savePath).exists())
+            savePath = QDir::tempPath() + "/nomacs";
+
+        QFileInfo saveFile(savePath, DkUtils::nowString() + " " + DkUtils::fileNameFromUrl(url));
+
+        mFileDownloader = QSharedPointer<FileDownloader>(new FileDownloader(url, saveFile.absoluteFilePath(), this));
+        connect(mFileDownloader.data(), SIGNAL(downloaded(const QString &)), this, SLOT(fileDownloaded(const QString &)), Qt::UniqueConnection);
+        qDebug() << "trying to download: " << url;
+    } else
+        mFileDownloader->downloadFile(url);
+}
 
-	if (getLoadState() == loading_canceled) {
-		mLoadState = not_loaded;
-		clear();
-		return;
-	}
+void DkImageContainerT::fileDownloaded(const QString &filePath)
+{
+    if (!mFileDownloader) {
+        qDebug() << "empty fileDownloader, where it should not be";
+        emit fileLoadedSignal(false);
+        return;
+    }
 
-	// fix the update states
-	if (mWaitForUpdate != update_idle) {
-			
-		if (!getLoader()->hasImage()) {
-			mWaitForUpdate = update_pending;
-			mLoadState = not_loaded;
-			qInfo() << "could not load while updating - is somebody writing to the file?";
-			return;
-		}
-		else {
-			emit showInfoSignal(tr("updated..."));
-			mWaitForUpdate = update_idle;
-		}
-	}
+    mFileBuffer = mFileDownloader->downloadedData();
 
-	if (!getLoader()->hasImage()) {
-		mFileUpdateTimer.stop();
-		mEdited = false;
-		QString msg = tr("Sorry, I could not load: %1").arg(fileName());
-		emit showInfoSignal(msg);
-		emit fileLoadedSignal(false);
-		mLoadState = exists_not;
-		return;
-	}
-	else if (!getThumb()->hasImage()) {
-		getThumb()->setImage(getLoader()->image());
-	}
+    if (!mFileBuffer || mFileBuffer->isEmpty()) {
+        qDebug() << mFileDownloader->getUrl() << " not downloaded...";
+        mEdited = false;
+        emit showInfoSignal(tr("Sorry, I could not download:\n%1").arg(mFileDownloader->getUrl().toString()));
+        emit fileLoadedSignal(false);
+        mLoadState = exists_not;
+        return;
+    }
 
-	// clear file buffer if it exceeds a certain size?! e.g. psd files
-	if (mFileBuffer) {
+    mDownloaded = true;
 
-		double bs = mFileBuffer->size() / (1024.0f * 1024.0f);
+    if (filePath.isEmpty())
+        setFilePath(mFileDownloader->getUrl().toString().split("/").last());
+    else
+        setFilePath(filePath);
 
-		// if the file buffer is more than 5MB - we check if we need to delete it
-		if (bs > 5 && bs > DkSettingsManager::param().resources().cacheMemory * 0.5f)
-			mFileBuffer->clear();
-	}
-	
-	mLoadState = loaded;
-	emit fileLoadedSignal(true);
+    fetchImage();
 }
 
-void DkImageContainerT::downloadFile(const QUrl& url) {
-
-	if (!mFileDownloader) {
-
-		QString savePath = DkSettingsManager::param().global().tmpPath;
+void DkImageContainerT::cancel()
+{
+    if (mLoadState != loading)
+        return;
 
-		if (!QFileInfo(savePath).exists())
-			savePath = QDir::tempPath() + "/nomacs";
-		
-		QFileInfo saveFile(savePath, DkUtils::nowString() + " " + DkUtils::fileNameFromUrl(url));
-
-		mFileDownloader = QSharedPointer<FileDownloader>(new FileDownloader(url, saveFile.absoluteFilePath(), this));
-		connect(mFileDownloader.data(), SIGNAL(downloaded(const QString&)), this, SLOT(fileDownloaded(const QString&)), Qt::UniqueConnection);
-		qDebug() << "trying to download: " << url;
-	}
-	else
-		mFileDownloader->downloadFile(url);
+    mLoadState = loading_canceled;
 }
 
-void DkImageContainerT::fileDownloaded(const QString& filePath) {
-
-	if (!mFileDownloader) {
-		qDebug() << "empty fileDownloader, where it should not be";
-		emit fileLoadedSignal(false);
-		return;
-	}
-
-	mFileBuffer = mFileDownloader->downloadedData();
-
-	if (!mFileBuffer || mFileBuffer->isEmpty()) {
-		qDebug() << mFileDownloader->getUrl() << " not downloaded...";
-		mEdited = false;
-		emit showInfoSignal(tr("Sorry, I could not download:\n%1").arg(mFileDownloader->getUrl().toString()));
-		emit fileLoadedSignal(false);
-		mLoadState = exists_not;
-		return;
-	}
+void DkImageContainerT::receiveUpdates(QObject *obj, bool connectSignals /* = true */)
+{
+    // !selected - do not connect twice
+    if (connectSignals && !mSelected) {
+        connect(this, SIGNAL(errorDialogSignal(const QString &)), obj, SLOT(errorDialog(const QString &)), Qt::UniqueConnection);
+        connect(this, SIGNAL(fileLoadedSignal(bool)), obj, SLOT(imageLoaded(bool)), Qt::UniqueConnection);
+        connect(this, SIGNAL(showInfoSignal(const QString &, int, int)), obj, SIGNAL(showInfoSignal(const QString &, int, int)), Qt::UniqueConnection);
+        connect(this, SIGNAL(fileSavedSignal(const QString &, bool, bool)), obj, SLOT(imageSaved(const QString &, bool, bool)), Qt::UniqueConnection);
+        connect(this, SIGNAL(imageUpdatedSignal()), obj, SLOT(currentImageUpdated()), Qt::UniqueConnection);
+        mFileUpdateTimer.start();
+    } else if (!connectSignals) {
+        disconnect(this, SIGNAL(errorDialogSignal(const QString &)), obj, SLOT(errorDialog(const QString &)));
+        disconnect(this, SIGNAL(fileLoadedSignal(bool)), obj, SLOT(imageLoaded(bool)));
+        disconnect(this, SIGNAL(showInfoSignal(const QString &, int, int)), obj, SIGNAL(showInfoSignal(const QString &, int, int)));
+        disconnect(this, SIGNAL(fileSavedSignal(const QString &, bool, bool)), obj, SLOT(imageSaved(const QString &, bool, bool)));
+        disconnect(this, SIGNAL(imageUpdatedSignal()), obj, SLOT(currentImageUpdated()));
+        mFileUpdateTimer.stop();
+    }
 
-	mDownloaded = true;
-
-	if (filePath.isEmpty())
-		setFilePath(mFileDownloader->getUrl().toString().split("/").last());
-	else
-		setFilePath(filePath);
-	
-	fetchImage();
-}
-
-void DkImageContainerT::cancel() {
-
-	if (mLoadState != loading)
-		return;
-
-	mLoadState = loading_canceled;
+    mSelected = connectSignals;
 }
 
-void DkImageContainerT::receiveUpdates(QObject* obj, bool connectSignals /* = true */) {
-
-	// !selected - do not connect twice
-	if (connectSignals && !mSelected) {
-		connect(this, SIGNAL(errorDialogSignal(const QString&)), obj, SLOT(errorDialog(const QString&)), Qt::UniqueConnection);
-		connect(this, SIGNAL(fileLoadedSignal(bool)), obj, SLOT(imageLoaded(bool)), Qt::UniqueConnection);
-		connect(this, SIGNAL(showInfoSignal(const QString&, int, int)), obj, SIGNAL(showInfoSignal(const QString&, int, int)), Qt::UniqueConnection);
-		connect(this, SIGNAL(fileSavedSignal(const QString&, bool, bool)), obj, SLOT(imageSaved(const QString&, bool, bool)), Qt::UniqueConnection);
-		connect(this, SIGNAL(imageUpdatedSignal()), obj, SLOT(currentImageUpdated()), Qt::UniqueConnection);
-		mFileUpdateTimer.start();
-	}
-	else if (!connectSignals) {
-		disconnect(this, SIGNAL(errorDialogSignal(const QString&)), obj, SLOT(errorDialog(const QString&)));
-		disconnect(this, SIGNAL(fileLoadedSignal(bool)), obj, SLOT(imageLoaded(bool)));
-		disconnect(this, SIGNAL(showInfoSignal(const QString&, int, int)), obj, SIGNAL(showInfoSignal(const QString&, int, int)));
-		disconnect(this, SIGNAL(fileSavedSignal(const QString&, bool, bool)), obj, SLOT(imageSaved(const QString&, bool, bool)));
-		disconnect(this, SIGNAL(imageUpdatedSignal()), obj, SLOT(currentImageUpdated()));
-		mFileUpdateTimer.stop();
-	}
-
-	mSelected = connectSignals;
+void DkImageContainerT::saveMetaDataThreaded(const QString &filePath)
+{
+    if (!exists() || (getLoader()->getMetaData() && !getLoader()->getMetaData()->isDirty()))
+        return;
 
+    mFileUpdateTimer.stop();
+    QFuture<void> future = QtConcurrent::run(this, &nmc::DkImageContainerT::saveMetaDataIntern, filePath, getLoader(), getFileBuffer());
 }
 
-void DkImageContainerT::saveMetaDataThreaded() {
-
-	if (!exists() || (getLoader()->getMetaData() && !getLoader()->getMetaData()->isDirty()))
-		return;
-
-	mFileUpdateTimer.stop();
-	QFuture<void> future = QtConcurrent::run(this, 
-		&nmc::DkImageContainerT::saveMetaDataIntern, filePath(), getLoader(), getFileBuffer());
-
+void DkImageContainerT::saveMetaDataThreaded()
+{
+    saveMetaDataThreaded(filePath());
 }
 
-bool DkImageContainerT::saveImageThreaded(const QString& filePath, int compression /* = -1 */) {
-
-	return saveImageThreaded(filePath, getLoader()->image(), compression);
+bool DkImageContainerT::saveImageThreaded(const QString &filePath, int compression /* = -1 */)
+{
+    return saveImageThreaded(filePath, getLoader()->lastImage(), compression);
 }
 
-bool DkImageContainerT::saveImageThreaded(const QString& filePath, const QImage saveImg, int compression /* = -1 */) {
-
-	mSaveImageWatcher.waitForFinished();
+bool DkImageContainerT::saveImageThreaded(const QString &filePath, const QImage saveImg, int compression /* = -1 */)
+{
+    mSaveImageWatcher.waitForFinished();
 
-	QFileInfo fInfo = filePath;
+    QFileInfo fInfo = filePath;
 
-	if (saveImg.isNull()) {
-		QString msg = tr("I can't save an empty file, sorry...\n");
-		emit errorDialogSignal(msg);
-		return false;
-	}
-	if (!fInfo.absoluteDir().exists()) {
-		QString msg = tr("Sorry, the directory: %1  does not exist\n").arg(filePath);
-		emit errorDialogSignal(msg);
-		return false;
-	}
-	if (fInfo.exists() && !fInfo.isWritable()) {
-		QString msg = tr("Sorry, I can't write to the file: %1").arg(fInfo.fileName());
-		emit errorDialogSignal(msg);
-		return false;
-	}
+    if (saveImg.isNull()) {
+        QString msg = tr("I can't save an empty file, sorry...\n");
+        emit errorDialogSignal(msg);
+        return false;
+    }
+    if (!fInfo.absoluteDir().exists()) {
+        QString msg = tr("Sorry, the directory: %1  does not exist\n").arg(filePath);
+        emit errorDialogSignal(msg);
+        return false;
+    }
+    if (fInfo.exists() && !fInfo.isWritable()) {
+        QString msg = tr("Sorry, I can't write to the file: %1").arg(fInfo.fileName());
+        emit errorDialogSignal(msg);
+        return false;
+    }
 
-	qDebug() << "attempting to save: " << filePath;
+    qDebug() << "attempting to save: " << filePath;
 
-	mFileUpdateTimer.stop();
-	connect(&mSaveImageWatcher, SIGNAL(finished()), this, SLOT(savingFinished()), Qt::UniqueConnection);
+    mFileUpdateTimer.stop();
+    connect(&mSaveImageWatcher, SIGNAL(finished()), this, SLOT(savingFinished()), Qt::UniqueConnection);
 
-	mSaveImageWatcher.setFuture(QtConcurrent::run(this, 
-		&nmc::DkImageContainerT::saveImageIntern, filePath, mLoader, saveImg, compression));
+    mSaveImageWatcher.setFuture(QtConcurrent::run(this, &nmc::DkImageContainerT::saveImageIntern, filePath, mLoader, saveImg, compression));
 
-	return true;
+    return true;
 }
 
-void DkImageContainerT::savingFinished() {
+void DkImageContainerT::savingFinished()
+{
+    QString savePath = mSaveImageWatcher.result();
 
-	QString savePath = mSaveImageWatcher.result();
-	
-	QFileInfo sInfo = savePath;
-	sInfo.refresh();
-	qDebug() << "save file: " << savePath;
-	
-	if (!sInfo.exists() || !sInfo.isFile())
-		emit fileSavedSignal(savePath, false);
-	else {
-		//// reset thumb - loadImageThreaded should do it anyway
-		//thumb = QSharedPointer<DkThumbNailT>(new DkThumbNailT(saveFile, loader->image()));
+    QFileInfo sInfo = savePath;
+    sInfo.refresh();
+    qDebug() << "save file: " << savePath;
 
-		if (mFileBuffer)
-			mFileBuffer->clear();	// do a complete clear?
-		
-		if (DkSettingsManager::param().resources().loadSavedImage == DkSettings::ls_load || 
-			filePath().isEmpty() || dirPath() == sInfo.absolutePath()) {
-			setFilePath(savePath);
+    if (!sInfo.exists() || !sInfo.isFile())
+        emit fileSavedSignal(savePath, false);
+    else {
+        //// reset thumb - loadImageThreaded should do it anyway
+        // thumb = QSharedPointer<DkThumbNailT>(new DkThumbNailT(saveFile, loader->image()));
 
-			emit fileSavedSignal(savePath, true, false);
-		}
-		else {
-			emit fileSavedSignal(savePath);
-		}
+        if (mFileBuffer)
+            mFileBuffer->clear(); // do a complete clear?
 
-		mEdited = false;
-		mDownloaded = false;
-		if (mSelected) {
-			loadImageThreaded(true);	// force a reload
-			mFileUpdateTimer.start();
-		}
-	}
-}
+        if (DkSettingsManager::param().resources().loadSavedImage == DkSettings::ls_load || filePath().isEmpty() || dirPath() == sInfo.absolutePath()) {
+            setFilePath(savePath);
 
-QSharedPointer<QByteArray> DkImageContainerT::loadFileToBuffer(const QString& filePath) {
+            emit fileSavedSignal(savePath, true, false);
+        } else {
+            emit fileSavedSignal(savePath);
+        }
 
-	return DkImageContainer::loadFileToBuffer(filePath);
+        mEdited = false;
+        mDownloaded = false;
+        if (mSelected) {
+            loadImageThreaded(true); // force a reload
+            mFileUpdateTimer.start();
+        }
+    }
 }
 
-QSharedPointer<DkBasicLoader> DkImageContainerT::loadImageIntern(const QString& filePath, QSharedPointer<DkBasicLoader> loader, const QSharedPointer<QByteArray> fileBuffer) {
-
-	return DkImageContainer::loadImageIntern(filePath, loader, fileBuffer);
+QSharedPointer<QByteArray> DkImageContainerT::loadFileToBuffer(const QString &filePath)
+{
+    return DkImageContainer::loadFileToBuffer(filePath);
 }
 
-QString DkImageContainerT::saveImageIntern(const QString& filePath, QSharedPointer<DkBasicLoader> loader, QImage saveImg, int compression) {
-
-	return DkImageContainer::saveImageIntern(filePath, loader, saveImg, compression);
+QSharedPointer<DkBasicLoader>
+DkImageContainerT::loadImageIntern(const QString &filePath, QSharedPointer<DkBasicLoader> loader, const QSharedPointer<QByteArray> fileBuffer)
+{
+    return DkImageContainer::loadImageIntern(filePath, loader, fileBuffer);
 }
 
-void DkImageContainerT::saveMetaDataIntern(const QString& filePath, QSharedPointer<DkBasicLoader> loader, QSharedPointer<QByteArray> fileBuffer) {
-
-	return DkImageContainer::saveMetaDataIntern(filePath, loader, fileBuffer);
+QString DkImageContainerT::saveImageIntern(const QString &filePath, QSharedPointer<DkBasicLoader> loader, QImage saveImg, int compression)
+{
+    return DkImageContainer::saveImageIntern(filePath, loader, saveImg, compression);
 }
 
-QSharedPointer<DkBasicLoader> DkImageContainerT::getLoader() {
+void DkImageContainerT::saveMetaDataIntern(const QString &filePath, QSharedPointer<DkBasicLoader> loader, QSharedPointer<QByteArray> fileBuffer)
+{
+    return DkImageContainer::saveMetaDataIntern(filePath, loader, fileBuffer);
+}
 
-	if (!mLoader) {
-		DkImageContainer::getLoader();
-		connect(mLoader.data(), SIGNAL(errorDialogSignal(const QString&)), this, SIGNAL(errorDialogSignal(const QString&)));
-	}
+QSharedPointer<DkBasicLoader> DkImageContainerT::getLoader()
+{
+    if (!mLoader) {
+        DkImageContainer::getLoader();
+        connect(mLoader.data(), SIGNAL(errorDialogSignal(const QString &)), this, SIGNAL(errorDialogSignal(const QString &)));
+    }
 
-	return mLoader;
+    return mLoader;
 }
 
-QSharedPointer<DkThumbNailT> DkImageContainerT::getThumb() {
-
-	if (!mThumb) {
-		DkImageContainer::getThumb();
-		connect(mThumb.data(), SIGNAL(thumbLoadedSignal(bool)), this, SIGNAL(thumbLoadedSignal(bool)));
-	}
+QSharedPointer<DkThumbNailT> DkImageContainerT::getThumb()
+{
+    if (!mThumb) {
+        DkImageContainer::getThumb();
+        connect(mThumb.data(), SIGNAL(thumbLoadedSignal(bool)), this, SIGNAL(thumbLoadedSignal(bool)));
+    }
 
-	return mThumb;
+    return mThumb;
 }
 
-bool DkImageContainerT::isFileDownloaded() const {
-
-	return mDownloaded;
+bool DkImageContainerT::isFileDownloaded() const
+{
+    return mDownloaded;
 }
 
-void DkImageContainerT::undo() {
-	DkImageContainer::undo();
-	emit imageUpdatedSignal();
+void DkImageContainerT::undo()
+{
+    DkImageContainer::undo();
+    emit imageUpdatedSignal();
 }
 
-void DkImageContainerT::redo() {
-	DkImageContainer::redo();
-	emit imageUpdatedSignal();
+void DkImageContainerT::redo()
+{
+    DkImageContainer::redo();
+    emit imageUpdatedSignal();
 }
 
-void DkImageContainerT::setHistoryIndex(int idx) {
-	DkImageContainer::setHistoryIndex(idx);
-	emit imageUpdatedSignal();
+void DkImageContainerT::setHistoryIndex(int idx)
+{
+    DkImageContainer::setHistoryIndex(idx);
+    emit imageUpdatedSignal();
 }
 
 }
diff --git a/ImageLounge/src/DkCore/DkImageContainer.h b/ImageLounge/src/DkCore/DkImageContainer.h
index 02c707f..f4da469 100644
--- a/ImageLounge/src/DkCore/DkImageContainer.h
+++ b/ImageLounge/src/DkCore/DkImageContainer.h
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkImageContainer.h
  Created on:	21.02.2014
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2014 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2014 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2014 Florian Kleber <florian@nomacs.org>
@@ -27,13 +27,13 @@
 
 #pragma once
 
-#pragma warning(push, 0)	// no warnings from includes - begin
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QFutureWatcher>
-#include <QTimer>
 #include <QSharedPointer>
-#pragma warning(pop)		// no warnings from includes - end
+#include <QTimer>
+#pragma warning(pop) // no warnings from includes - end
 
-#pragma warning(disable: 4251)	// TODO: remove
+#pragma warning(disable : 4251) // TODO: remove
 
 #ifndef DllCoreExport
 #ifdef DK_CORE_DLL_EXPORT
@@ -47,8 +47,8 @@
 
 #include "DkThumbs.h"
 
-namespace nmc {
-
+namespace nmc
+{
 // nomacs defines
 class DkBasicLoader;
 class DkMetaDataT;
@@ -56,183 +56,188 @@ class DkZipContainer;
 class FileDownloader;
 class DkRotatingRect;
 
-class DllCoreExport DkImageContainer {
-
+class DllCoreExport DkImageContainer
+{
 public:
-	enum {
-		loading_canceled = -3,
-		loading = -2,
-		exists_not = -1,
-		not_loaded,
-		loaded,
-	};
-
-	DkImageContainer(const QString& filePath);
-	virtual ~DkImageContainer();
-	bool operator==(const DkImageContainer& ric) const;
-	bool operator< (const DkImageContainer& o) const;
-	bool operator<= (const DkImageContainer& o) const;
-	bool operator> (const DkImageContainer& o) const;
-	bool operator>= (const DkImageContainer& o) const;
-
-	QImage image();
-	QImage imageScaledToHeight(int height);
-	QImage imageScaledToWidth(int width);
-
-	bool hasImage() const;
-	bool hasSvg() const;
-	bool hasMovie() const;
-
-	int getLoadState() const;
-	QFileInfo fileInfo() const;
-	QString filePath() const;
-	QString dirPath() const;
-	QString fileName() const;
-	bool isFromZip();
-	bool isEdited() const;
-	bool isSelected() const;
-	void setEdited(bool edited);
-	QString getTitleAttribute() const;
-	float getMemoryUsage() const;
-	float getFileSize() const;
-
-	virtual QSharedPointer<DkBasicLoader> getLoader();
-	virtual QSharedPointer<DkMetaDataT> getMetaData();
-	virtual QSharedPointer<DkThumbNailT> getThumb();
-	virtual QSharedPointer<QByteArray> getFileBuffer();
+    enum {
+        loading_canceled = -3,
+        loading = -2,
+        exists_not = -1,
+        not_loaded,
+        loaded,
+    };
+
+    DkImageContainer(const QString &filePath);
+    virtual ~DkImageContainer();
+    bool operator==(const DkImageContainer &ric) const;
+    bool operator<(const DkImageContainer &o) const;
+    bool operator<=(const DkImageContainer &o) const;
+    bool operator>(const DkImageContainer &o) const;
+    bool operator>=(const DkImageContainer &o) const;
+
+    QImage image();
+    QImage pixmap();
+    QImage imageScaledToHeight(int height);
+    QImage imageScaledToWidth(int width);
+
+    bool hasImage() const;
+    bool hasSvg() const;
+    bool hasMovie() const;
+
+    int getLoadState() const;
+    QFileInfo fileInfo() const;
+    QString filePath() const;
+    QString dirPath() const;
+    QString fileName() const;
+    bool isFromZip();
+    bool isEdited() const;
+    bool isSelected() const;
+    void setEdited(bool edited = true);
+    QString getTitleAttribute() const;
+    float getMemoryUsage() const;
+    float getFileSize() const;
+
+    virtual QSharedPointer<DkBasicLoader> getLoader();
+    virtual QSharedPointer<DkMetaDataT> getMetaData();
+    virtual QSharedPointer<DkThumbNailT> getThumb();
+    virtual QSharedPointer<QByteArray> getFileBuffer();
 #ifdef WITH_QUAZIP
-	QSharedPointer<DkZipContainer> getZipData();
+    QSharedPointer<DkZipContainer> getZipData();
 #endif
 #ifdef Q_OS_WIN
-	std::wstring getFileNameWStr() const;
+    std::wstring getFileNameWStr() const;
 #endif
 
-	bool exists();
-	bool setPageIdx(int skipIdx);
-
-	QSharedPointer<QByteArray> loadFileToBuffer(const QString& filePath);
-	bool loadImage();
-	void setImage(const QImage& img, const QString& editName);
-	void setImage(const QImage& img, const QString& editName, const QString& filePath);
-	bool saveImage(const QString& filePath, const QImage saveImg, int compression = -1);
-	bool saveImage(const QString& filePath, int compression = -1);
-	void saveMetaData();
-	virtual void clear();
-	virtual void undo();
-	virtual void redo();
-	virtual void setHistoryIndex(int idx);
-    void cropImage(const DkRotatingRect& rect, const QColor& col, bool cropToMetadata);
-    void cropImage(const QRect& rect, const QTransform& t, const QColor& col = QColor(0,0,0,0));
-	DkRotatingRect cropRect();
+    bool exists();
+    bool setPageIdx(int skipIdx);
+
+    QSharedPointer<QByteArray> loadFileToBuffer(const QString &filePath);
+    bool loadImage();
+    void setImage(const QImage &img, const QString &editName);
+    void setImage(const QImage &img, const QString &editName, const QString &filePath);
+    void setMetaData(QSharedPointer<DkMetaDataT> editedMetaData, const QImage &img, const QString &editName);
+    void setMetaData(QSharedPointer<DkMetaDataT> editedMetaData, const QString &editName);
+    void setMetaData(const QString &editName);
+    bool saveImage(const QString &filePath, const QImage saveImg, int compression = -1);
+    bool saveImage(const QString &filePath, int compression = -1);
+    void saveMetaData();
+    virtual void clear();
+    virtual void undo();
+    virtual void redo();
+    virtual void setHistoryIndex(int idx);
+    void cropImage(const DkRotatingRect &rect, const QColor &col, bool cropToMetadata);
+    DkRotatingRect cropRect();
 
 protected:
-	QSharedPointer<DkBasicLoader> loadImageIntern(const QString& filePath, QSharedPointer<DkBasicLoader> loader, const QSharedPointer<QByteArray> fileBuffer);
-	void saveMetaDataIntern(const QString& filePath, QSharedPointer<DkBasicLoader> loader, QSharedPointer<QByteArray> fileBuffer = QSharedPointer<QByteArray>());
-	QString saveImageIntern(const QString& filePath, QSharedPointer<DkBasicLoader> loader, QImage saveImg, int compression);
-	void setFilePath(const QString& filePath);
-	void init();
+    QSharedPointer<DkBasicLoader> loadImageIntern(const QString &filePath, QSharedPointer<DkBasicLoader> loader, const QSharedPointer<QByteArray> fileBuffer);
+    void
+    saveMetaDataIntern(const QString &filePath, QSharedPointer<DkBasicLoader> loader, QSharedPointer<QByteArray> fileBuffer = QSharedPointer<QByteArray>());
+    QString saveImageIntern(const QString &filePath, QSharedPointer<DkBasicLoader> loader, QImage saveImg, int compression);
+    void setFilePath(const QString &filePath);
+    void init();
 
-	QSharedPointer<QByteArray> mFileBuffer;
-	QSharedPointer<DkBasicLoader> mLoader;
-	QSharedPointer<DkThumbNailT> mThumb;
+    QSharedPointer<QByteArray> mFileBuffer;
+    QSharedPointer<DkBasicLoader> mLoader;
+    QSharedPointer<DkThumbNailT> mThumb;
 
-	int mLoadState	= not_loaded;
-	bool mEdited	= false;
-	bool mSelected	= false;
+    int mLoadState = not_loaded;
+    bool mEdited = false;
+    bool mSelected = false;
 
-	QFileInfo mFileInfo;
-	QVector<QImage> scaledImages;
+    QFileInfo mFileInfo;
+    QVector<QImage> scaledImages;
 
-#ifdef WITH_QUAZIP	
-	QSharedPointer<DkZipContainer> mZipData;
+#ifdef WITH_QUAZIP
+    QSharedPointer<DkZipContainer> mZipData;
 #endif
 #ifdef Q_OS_WIN
-	std::wstring mFileNameStr;	// speeds up sorting of filenames on windows
+    std::wstring mFileNameStr; // speeds up sorting of filenames on windows
 #endif
 
 private:
-	QString mFilePath;
-
+    QString mFilePath;
 };
 
-bool imageContainerLessThan(const DkImageContainer& l, const DkImageContainer& r);
+bool imageContainerLessThan(const DkImageContainer &l, const DkImageContainer &r);
 bool imageContainerLessThanPtr(const QSharedPointer<DkImageContainer> l, const QSharedPointer<DkImageContainer> r);
 
-class DllCoreExport DkImageContainerT : public QObject, public DkImageContainer {
-	Q_OBJECT
+class DllCoreExport DkImageContainerT : public QObject, public DkImageContainer
+{
+    Q_OBJECT
 
 public:
-	DkImageContainerT(const QString& filePath);
-	virtual ~DkImageContainerT();
-
-	void fetchFile();
-	void cancel();
-	void clear() override;
-	void receiveUpdates(QObject* obj, bool connectSignals = true);
-	void downloadFile(const QUrl& url);
-
-	bool loadImageThreaded(bool force = false);
-	bool saveImageThreaded(const QString& filePath, const QImage saveImg, int compression = -1);
-	bool saveImageThreaded(const QString& filePath, int compression = -1);
-	void saveMetaDataThreaded();
-	bool isFileDownloaded() const;
-
-	virtual QSharedPointer<DkBasicLoader> getLoader() override;
-	virtual QSharedPointer<DkThumbNailT> getThumb() override;
-	static QSharedPointer<DkImageContainerT> fromImageContainer(QSharedPointer<DkImageContainer> imgC);
-
-	virtual void undo() override;
-	virtual void redo() override;
-	virtual void setHistoryIndex(int idx) override;
+    DkImageContainerT(const QString &filePath);
+    virtual ~DkImageContainerT();
+
+    void fetchFile();
+    void cancel();
+    void clear() override;
+    void receiveUpdates(QObject *obj, bool connectSignals = true);
+    void downloadFile(const QUrl &url);
+
+    bool loadImageThreaded(bool force = false);
+    bool saveImageThreaded(const QString &filePath, const QImage saveImg, int compression = -1);
+    bool saveImageThreaded(const QString &filePath, int compression = -1);
+    void saveMetaDataThreaded(const QString &filePath);
+    void saveMetaDataThreaded();
+    bool isFileDownloaded() const;
+
+    virtual QSharedPointer<DkBasicLoader> getLoader() override;
+    virtual QSharedPointer<DkThumbNailT> getThumb() override;
+    static QSharedPointer<DkImageContainerT> fromImageContainer(QSharedPointer<DkImageContainer> imgC);
+
+    virtual void undo() override;
+    virtual void redo() override;
+    virtual void setHistoryIndex(int idx) override;
 
 signals:
-	void fileLoadedSignal(bool loaded = true) const;
-	void fileSavedSignal(const QString& fileInfo, bool saved = true, bool loadToTab = true) const;
-	void showInfoSignal(const QString& msg, int time = 3000, int position = 0) const;
-	void errorDialogSignal(const QString& msg) const;
-	void thumbLoadedSignal(bool loaded = true) const;
-	void imageUpdatedSignal() const;
+    void fileLoadedSignal(bool loaded = true) const;
+    void fileSavedSignal(const QString &fileInfo, bool saved = true, bool loadToTab = true) const;
+    void showInfoSignal(const QString &msg, int time = 3000, int position = 0) const;
+    void errorDialogSignal(const QString &msg) const;
+    void thumbLoadedSignal(bool loaded = true) const;
+    void imageUpdatedSignal() const;
 
 public slots:
-	void checkForFileUpdates(); 
+    void checkForFileUpdates();
 
 protected slots:
-	void bufferLoaded();
-	void imageLoaded();
-	void savingFinished();
-	void loadingFinished();
-	void fileDownloaded(const QString& filePath);
+    void bufferLoaded();
+    void imageLoaded();
+    void savingFinished();
+    void loadingFinished();
+    void fileDownloaded(const QString &filePath);
 
 protected:
-	void fetchImage();
-	
-	QSharedPointer<QByteArray> loadFileToBuffer(const QString& filePath);
-	QSharedPointer<DkBasicLoader> loadImageIntern(const QString& filePath, QSharedPointer<DkBasicLoader> loader, const QSharedPointer<QByteArray> fileBuffer);
-	QString saveImageIntern(const QString& filePath, QSharedPointer<DkBasicLoader> loader, QImage saveImg, int compression);
-	void saveMetaDataIntern(const QString& filePath, QSharedPointer<DkBasicLoader> loader, QSharedPointer<QByteArray> fileBuffer);
-	
-	QFutureWatcher<QSharedPointer<QByteArray> > mBufferWatcher;
-	QFutureWatcher<QSharedPointer<DkBasicLoader> > mImageWatcher;
-	QFutureWatcher<QString> mSaveImageWatcher;
-	QFutureWatcher<bool> mSaveMetaDataWatcher;
-
-	QSharedPointer<FileDownloader> mFileDownloader;
-
-	enum UpdateStates {
-		update_idle,
-		update_pending,
-		update_loading,
-
-		update_end
-	};
-
-	int mWaitForUpdate = false;
-
-	bool mFetchingImage = false;
-	bool mFetchingBuffer = false;
-	bool mDownloaded = false;
-
-	QTimer mFileUpdateTimer;
+    void fetchImage();
+
+    QSharedPointer<QByteArray> loadFileToBuffer(const QString &filePath);
+    QSharedPointer<DkBasicLoader> loadImageIntern(const QString &filePath, QSharedPointer<DkBasicLoader> loader, const QSharedPointer<QByteArray> fileBuffer);
+    QString saveImageIntern(const QString &filePath, QSharedPointer<DkBasicLoader> loader, QImage saveImg, int compression);
+    void saveMetaDataIntern(const QString &filePath, QSharedPointer<DkBasicLoader> loader, QSharedPointer<QByteArray> fileBuffer);
+
+    QFutureWatcher<QSharedPointer<QByteArray>> mBufferWatcher;
+    QFutureWatcher<QSharedPointer<DkBasicLoader>> mImageWatcher;
+    QFutureWatcher<QString> mSaveImageWatcher;
+    QFutureWatcher<bool> mSaveMetaDataWatcher;
+
+    QSharedPointer<FileDownloader> mFileDownloader;
+
+    enum UpdateStates {
+        update_idle,
+        update_pending,
+        update_loading,
+
+        update_end
+    };
+
+    int mWaitForUpdate = false;
+
+    bool mFetchingImage = false;
+    bool mFetchingBuffer = false;
+    bool mDownloaded = false;
+
+    QTimer mFileUpdateTimer;
 };
 
 }
diff --git a/ImageLounge/src/DkCore/DkImageLoader.cpp b/ImageLounge/src/DkCore/DkImageLoader.cpp
index 09d25d2..d05f80a 100644
--- a/ImageLounge/src/DkCore/DkImageLoader.cpp
+++ b/ImageLounge/src/DkCore/DkImageLoader.cpp
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkImage.cpp
  Created on:	21.04.2011
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -27,123 +27,127 @@
 
 #include "DkImageLoader.h"
 
-#include "DkMessageBox.h"
-#include "DkSettings.h"
-#include "DkTimer.h"
-#include "DkThumbs.h"
-#include "DkImageStorage.h"
+#include "DkActionManager.h"
 #include "DkBasicLoader.h"
-#include "DkMetaData.h"
+#include "DkDialog.h"
 #include "DkImageContainer.h"
+#include "DkImageStorage.h"
 #include "DkMessageBox.h"
+#include "DkMetaData.h"
 #include "DkSaveDialog.h"
-#include "DkUtils.h"
+#include "DkSettings.h"
 #include "DkStatusBar.h"
-#include "DkActionManager.h"
-#include "DkDialog.h"
+#include "DkThumbs.h"
+#include "DkTimer.h"
+#include "DkUtils.h"
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QWidget>
-#include <QImageWriter>
-#include <QFileSystemWatcher>
-#include <QFileInfo>
-#include <QFile>
-#include <QSettings>
-#include <QImageReader>
-#include <QDir>
-#include <QThread>
+#pragma warning(push, 0) // no warnings from includes - begin
+#include <QApplication>
 #include <QBuffer>
-#include <QStringBuilder>
+#include <QByteArray>
+#include <QCoreApplication>
 #include <QDebug>
-#include <QMutex>
+#include <QDesktopServices>
+#include <QDir>
+#include <QDirIterator>
+#include <QFile>
+#include <QFileDialog>
 #include <QFileIconProvider>
-#include <QStringList>
+#include <QFileInfo>
+#include <QFileSystemWatcher>
+#include <QImageReader>
+#include <QImageWriter>
 #include <QMessageBox>
-#include <QDirIterator>
+#include <QMovie>
+#include <QMutex>
+#include <QPainter>
+#include <QPluginLoader>
 #include <QProgressDialog>
 #include <QReadLocker>
-#include <QWriteLocker>
 #include <QReadWriteLock>
+#include <QSettings>
+#include <QStandardPaths>
+#include <QStringBuilder>
+#include <QStringList>
+#include <QThread>
 #include <QTimer>
-#include <QMovie>
-#include <QByteArray>
-#include <QCoreApplication>
-#include <QApplication>
-#include <QPluginLoader>
-#include <QFileDialog>
-#include <QPainter>
-#include <qmath.h>
+#include <QWidget>
+#include <QWriteLocker>
 #include <QtConcurrentRun>
-#include <QStandardPaths>
-#include <QDesktopServices>
+#include <qmath.h>
 
 // quazip
 #ifdef WITH_QUAZIP
+#ifdef WITH_QUAZIP1
+#include <quazip/JlCompress.h>
+#else
 #include <quazip5/JlCompress.h>
 #endif
+#endif
 
 // opencv
 #ifdef WITH_OPENCV
 
 #ifdef Q_OS_WIN
-#pragma warning(disable: 4996)
+#pragma warning(disable : 4996)
+#endif
 #endif
-#endif 
 
 #ifdef WITH_LIBRAW
 #include <libraw/libraw.h>
 #elif defined(Q_OS_WIN) && !defined(SOCK_STREAM)
-#include <winsock2.h>	// needed since libraw 0.16
+#include <winsock2.h> // needed since libraw 0.16
 #endif
 
-#pragma warning(pop)	// no warnings from includes - end
+#pragma warning(pop) // no warnings from includes - end
 
-namespace nmc {
+namespace nmc
+{
 
 // DkImageLoader -> is nomacs file handling routine --------------------------------------------------------------------
 /**
  * Default constructor.
  * Creates a DkImageLoader instance with a given file.
  * @param file the file to be loaded.
- **/ 
-DkImageLoader::DkImageLoader(const QString& filePath) {
-
-	qRegisterMetaType<QFileInfo>("QFileInfo");
+ **/
+DkImageLoader::DkImageLoader(const QString &filePath)
+{
+    qRegisterMetaType<QFileInfo>("QFileInfo");
 
-	mDirWatcher = new QFileSystemWatcher(this);
-	connect(mDirWatcher, SIGNAL(directoryChanged(QString)), this, SLOT(directoryChanged(QString)));
+    mDirWatcher = new QFileSystemWatcher(this);
+    connect(mDirWatcher, SIGNAL(directoryChanged(QString)), this, SLOT(directoryChanged(QString)));
 
-	mSortingIsDirty = false;
-	mSortingImages = false;
+    mSortingIsDirty = false;
+    mSortingImages = false;
 
-	connect(&mCreateImageWatcher, SIGNAL(finished()), this, SLOT(imagesSorted()));
+    connect(&mCreateImageWatcher, SIGNAL(finished()), this, SLOT(imagesSorted()));
 
-	mDelayedUpdateTimer.setSingleShot(true);
-	connect(&mDelayedUpdateTimer, SIGNAL(timeout()), this, SLOT(directoryChanged()));
+    mDelayedUpdateTimer.setSingleShot(true);
+    connect(&mDelayedUpdateTimer, SIGNAL(timeout()), this, SLOT(directoryChanged()));
 
     connect(DkActionManager::instance().action(DkActionManager::menu_file_save_copy), SIGNAL(triggered()), this, SLOT(copyUserFile()));
     connect(DkActionManager::instance().action(DkActionManager::menu_edit_undo), SIGNAL(triggered()), this, SLOT(undo()));
-	connect(DkActionManager::instance().action(DkActionManager::menu_edit_redo), SIGNAL(triggered()), this, SLOT(redo()));
-	connect(DkActionManager::instance().action(DkActionManager::menu_view_gps_map), SIGNAL(triggered()), this, SLOT(showOnMap()));
-	connect(DkActionManager::instance().action(DkActionManager::sc_delete_silent), SIGNAL(triggered()), this, SLOT(deleteFile()), Qt::UniqueConnection);
+    connect(DkActionManager::instance().action(DkActionManager::menu_edit_redo), SIGNAL(triggered()), this, SLOT(redo()));
+    connect(DkActionManager::instance().action(DkActionManager::menu_view_gps_map), SIGNAL(triggered()), this, SLOT(showOnMap()));
+    connect(DkActionManager::instance().action(DkActionManager::sc_delete_silent), SIGNAL(triggered()), this, SLOT(deleteFile()), Qt::UniqueConnection);
+
+    // saveDir = DkSettingsManager::param().global().lastSaveDir;	// loading save dir is obsolete ?!
 
-	//saveDir = DkSettingsManager::param().global().lastSaveDir;	// loading save dir is obsolete ?!
-	 
-	QFileInfo fInfo(filePath);
+    QFileInfo fInfo(filePath);
 
-	if (fInfo.exists())
-		loadDir(fInfo.absolutePath());
-	else
-		mCurrentDir = DkSettingsManager::param().global().lastDir;
+    if (fInfo.exists())
+        loadDir(fInfo.absolutePath());
+    else
+        mCurrentDir = DkSettingsManager::param().global().lastDir;
 }
 
 /**
  * Default destructor.
- **/ 
-DkImageLoader::~DkImageLoader() {
-	
-	if (mCreateImageWatcher.isRunning())
-		mCreateImageWatcher.blockSignals(true);
+ **/
+DkImageLoader::~DkImageLoader()
+{
+    if (mCreateImageWatcher.isRunning())
+        mCreateImageWatcher.blockSignals(true);
 }
 
 /**
@@ -151,257 +155,256 @@ DkImageLoader::~DkImageLoader() {
  * Calling this method makes the loader forget
  * about the current directory. It also destroys
  * the currently loaded image.
- **/ 
-void DkImageLoader::clearPath() {
-
-	// lastFileLoaded must exist
-	if (mCurrentImage && mCurrentImage->exists()) {
-		mCurrentImage->receiveUpdates(this, false);
-		mLastImageLoaded = mCurrentImage;
-		mImages.clear();
-
-		// only clear the current image if it exists
-		mCurrentImage.clear();
-	}
+ **/
+void DkImageLoader::clearPath()
+{
+    // lastFileLoaded must exist
+    if (mCurrentImage && mCurrentImage->exists()) {
+        mCurrentImage->receiveUpdates(this, false);
+        mLastImageLoaded = mCurrentImage;
+        mImages.clear();
+
+        // only clear the current image if it exists
+        mCurrentImage.clear();
+    }
 }
 
 #ifdef WITH_QUAZIP
 /**
  * Loads a given zip archive and the first image in it.
  * @param zipFile the archive to be loaded.
- **/ 
-bool DkImageLoader::loadZipArchive(const QString& zipPath) {
-
-	QStringList fileNameList = JlCompress::getFileList(zipPath);
-	
-	// remove the * in fileFilters
-	QStringList fileFiltersClean = DkSettingsManager::param().app().browseFilters;
-	for (int idx = 0; idx < fileFiltersClean.size(); idx++)
-		fileFiltersClean[idx].replace("*", "");
-
-	QStringList fileList;
-	for (int idx = 0; idx < fileNameList.size(); idx++) {
-		
-		for (int idxFilter = 0; idxFilter < fileFiltersClean.size(); idxFilter++) {
-
-			if (fileNameList.at(idx).contains(fileFiltersClean[idxFilter], Qt::CaseInsensitive)) {
-				fileList.append(fileNameList.at(idx));
-				break;
-			}
-		}
-	}
+ **/
+bool DkImageLoader::loadZipArchive(const QString &zipPath)
+{
+    QStringList fileNameList = JlCompress::getFileList(zipPath);
+
+    // remove the * in fileFilters
+    QStringList fileFiltersClean = DkSettingsManager::param().app().browseFilters;
+    for (int idx = 0; idx < fileFiltersClean.size(); idx++)
+        fileFiltersClean[idx].replace("*", "");
+
+    QStringList fileList;
+    for (int idx = 0; idx < fileNameList.size(); idx++) {
+        for (int idxFilter = 0; idxFilter < fileFiltersClean.size(); idxFilter++) {
+            if (fileNameList.at(idx).contains(fileFiltersClean[idxFilter], Qt::CaseInsensitive)) {
+                fileList.append(fileNameList.at(idx));
+                break;
+            }
+        }
+    }
 
-	QFileInfoList fileInfoList;
-	//encode both the input zip file and the output image into a single fileInfo
-	for (const QString& filePath : fileList)
-		fileInfoList.append(DkZipContainer::encodeZipFile(zipPath, filePath));
+    QFileInfoList fileInfoList;
+    // encode both the input zip file and the output image into a single fileInfo
+    for (const QString &filePath : fileList)
+        fileInfoList.append(DkZipContainer::encodeZipFile(zipPath, filePath));
 
-	QFileInfo zipInfo(zipPath);
+    QFileInfo zipInfo(zipPath);
 
-	// zip archives could not contain known image formats
-	if (fileInfoList.empty()) {
-		emit showInfoSignal(tr("%1 \n does not contain any image").arg(zipInfo.fileName()), 4000);	// stop mShowing
-		return false;
-	}
+    // zip archives could not contain known image formats
+    if (fileInfoList.empty()) {
+        emit showInfoSignal(tr("%1 \n does not contain any image").arg(zipInfo.fileName()), 4000); // stop mShowing
+        return false;
+    }
 
-	createImages(fileInfoList);
+    createImages(fileInfoList);
 
-	emit updateDirSignal(mImages);
-	mCurrentDir = zipInfo.absolutePath();
+    emit updateDirSignal(mImages);
+    mCurrentDir = zipInfo.absolutePath();
 
-	qDebug() << "ZIP FOLDER set: " << mCurrentDir;
+    qDebug() << "ZIP FOLDER set: " << mCurrentDir;
 
-	return true;
+    return true;
 }
 #endif
 
 /**
  * Loads a given directory.
  * @param newDir the directory to be loaded.
- **/ 
-bool DkImageLoader::loadDir(const QString& newDirPath, bool scanRecursive) {
-
-	//if (creatingImages) {
-	//	//emit showInfoSignal(tr("Indexing folder..."), 4000);	// stop showing
-	//	return false;
-	//}
-
-	DkTimer dt;
-	
-	// folder changed signal was emitted
-	if (mFolderUpdated && newDirPath == mCurrentDir) {
-		
-		mFolderUpdated = false;
-		QFileInfoList files = getFilteredFileInfoList(newDirPath, mIgnoreKeywords, mKeywords, mFolderFilterString);		// this line takes seconds if you have lots of files and slow loading (e.g. network)
-
-		// might get empty too (e.g. someone deletes all images)
- 		if (files.empty()) {
-			emit showInfoSignal(tr("%1 \n does not contain any image").arg(newDirPath), 4000);	// stop showing
-			mImages.clear();
-			emit updateDirSignal(mImages);
-			return false;
-		}
-
-		// disabled threaded sorting - people didn't like it (#484 and #460)
-		//if (files.size() > 2000) {
-		//	createImages(files, false);
-		//	sortImagesThreaded(images);
-		//}
-		//else
-			createImages(files, true);
-
-		qDebug() << "getting file list.....";
-	}
-	// new folder is loaded
-	else if ((newDirPath != mCurrentDir || mImages.empty()) && !newDirPath.isEmpty() && QDir(newDirPath).exists()) {
-
-		QFileInfoList files;
-
-		//newDir.setNameFilters(DkSettingsManager::param().app().fileFilters);
-		//newDir.setSorting(QDir::LocaleAware);		// TODO: extend
-
-		// update save directory
-		mCurrentDir = newDirPath;
-		mFolderUpdated = false;
-
-		mFolderFilterString.clear();	// delete key words -> otherwise user may be confused
-
-		if (scanRecursive && DkSettingsManager::param().global().scanSubFolders)
-			files = updateSubFolders(mCurrentDir);
-		else 
-			files = getFilteredFileInfoList(mCurrentDir, mIgnoreKeywords, mKeywords, mFolderFilterString);		// this line takes seconds if you have lots of files and slow loading (e.g. network)
+ **/
+bool DkImageLoader::loadDir(const QString &newDirPath, bool scanRecursive)
+{
+    // if (creatingImages) {
+    //	//emit showInfoSignal(tr("Indexing folder..."), 4000);	// stop showing
+    //	return false;
+    // }
+
+    DkTimer dt;
+
+    // folder changed signal was emitted
+    if (mFolderUpdated && newDirPath == mCurrentDir) {
+        mFolderUpdated = false;
+        QFileInfoList files = getFilteredFileInfoList(newDirPath,
+                                                      mIgnoreKeywords,
+                                                      mKeywords,
+                                                      mFolderFilterString); // this line takes seconds if you have lots of files and slow loading (e.g. network)
+
+        // might get empty too (e.g. someone deletes all images)
+        if (files.empty()) {
+            emit showInfoSignal(tr("%1 \n does not contain any image").arg(newDirPath), 4000); // stop showing
+            mImages.clear();
+            emit updateDirSignal(mImages);
+            return false;
+        }
 
-		if (files.empty()) {
-			emit showInfoSignal(tr("%1 \n does not contain any image").arg(mCurrentDir), 4000);	// stop showing
-			return false;
-		}
+        // disabled threaded sorting - people didn't like it (#484 and #460)
+        // if (files.size() > 2000) {
+        //	createImages(files, false);
+        //	sortImagesThreaded(images);
+        //}
+        // else
+        createImages(files, true);
 
-		// ok new folder, this should speed-up loading
-		mImages.clear();
-		
-		//// TODO: creating ~120 000 images takes about 2 secs
-		//// but sorting (just filenames) takes ages (on windows)
-		//// so we should fix this using 2 strategies: 
-		//// - thread the image creation process
-		//// - while loading (if the user wants to move in the folder) we could display some message (e.g. indexing dir)
-		//if (files.size() > 2000) {
-		//	createImages(files, false);
-		//	sortImagesThreaded(mImages);
-		//}
-		//else
-			createImages(files, true);
+        qDebug() << "getting file list.....";
+    }
+    // new folder is loaded
+    else if ((newDirPath != mCurrentDir || mImages.empty()) && !newDirPath.isEmpty() && QDir(newDirPath).exists()) {
+        QFileInfoList files;
+
+        // newDir.setNameFilters(DkSettingsManager::param().app().fileFilters);
+        // newDir.setSorting(QDir::LocaleAware);		// TODO: extend
+
+        // update save directory
+        mCurrentDir = newDirPath;
+        mFolderUpdated = false;
+
+        mFolderFilterString.clear(); // delete key words -> otherwise user may be confused
+
+        if (scanRecursive && DkSettingsManager::param().global().scanSubFolders)
+            files = updateSubFolders(mCurrentDir);
+        else
+            files = getFilteredFileInfoList(mCurrentDir,
+                                            mIgnoreKeywords,
+                                            mKeywords,
+                                            mFolderFilterString); // this line takes seconds if you have lots of files and slow loading (e.g. network)
+
+        if (files.empty()) {
+            emit showInfoSignal(tr("%1 \n does not contain any image").arg(mCurrentDir), 4000); // stop showing
+            return false;
+        }
 
-		qInfoClean() << newDirPath << " [" << mImages.size() << "] indexed in " << dt;
-	}
-	//else
-	//	qDebug() << "ignoring... old dir: " << dir.absolutePath() << " newDir: " << newDir << " file size: " << images.size();
+        // ok new folder, this should speed-up loading
+        mImages.clear();
+
+        //// TODO: creating ~120 000 images takes about 2 secs
+        //// but sorting (just filenames) takes ages (on windows)
+        //// so we should fix this using 2 strategies:
+        //// - thread the image creation process
+        //// - while loading (if the user wants to move in the folder) we could display some message (e.g. indexing dir)
+        // if (files.size() > 2000) {
+        //	createImages(files, false);
+        //	sortImagesThreaded(mImages);
+        // }
+        // else
+        createImages(files, true);
+
+        qInfoClean() << newDirPath << " [" << mImages.size() << "] indexed in " << dt;
+    }
+    // else
+    //	qDebug() << "ignoring... old dir: " << dir.absolutePath() << " newDir: " << newDir << " file size: " << images.size();
 
-	return true;
+    return true;
 }
 
-void DkImageLoader::sortImagesThreaded(QVector<QSharedPointer<DkImageContainerT > > images) {
-
-	if (mSortingImages) {
-		mSortingIsDirty = true;
-		return;
-	}
+void DkImageLoader::sortImagesThreaded(QVector<QSharedPointer<DkImageContainerT>> images)
+{
+    if (mSortingImages) {
+        mSortingIsDirty = true;
+        return;
+    }
 
-	mSortingIsDirty = false;
-	mSortingImages = true;
-	mCreateImageWatcher.setFuture(QtConcurrent::run(this, 
-		&nmc::DkImageLoader::sortImages, images));
+    mSortingIsDirty = false;
+    mSortingImages = true;
+    mCreateImageWatcher.setFuture(QtConcurrent::run(this, &nmc::DkImageLoader::sortImages, images));
 
-	qDebug() << "sorting images threaded...";
+    qDebug() << "sorting images threaded...";
 }
 
-void DkImageLoader::imagesSorted() {
+void DkImageLoader::imagesSorted()
+{
+    mSortingImages = false;
+    mImages = mCreateImageWatcher.result();
 
-	mSortingImages = false;
-	mImages = mCreateImageWatcher.result();
-
-	if (mSortingIsDirty) {
-		qDebug() << "re-sorting because it's dirty...";
-		sortImagesThreaded(mImages);
-		return;
-	}
+    if (mSortingIsDirty) {
+        qDebug() << "re-sorting because it's dirty...";
+        sortImagesThreaded(mImages);
+        return;
+    }
 
-	emit updateDirSignal(mImages);
+    emit updateDirSignal(mImages);
 
-	if (mDirWatcher) {
-		if (!mDirWatcher->directories().isEmpty())
-			mDirWatcher->removePaths(mDirWatcher->directories());
-		mDirWatcher->addPath(mCurrentDir);
-	}
+    if (mDirWatcher) {
+        if (!mDirWatcher->directories().isEmpty())
+            mDirWatcher->removePaths(mDirWatcher->directories());
+        mDirWatcher->addPath(mCurrentDir);
+    }
 
-	qDebug() << "images sorted...";
+    qDebug() << "images sorted...";
 }
 
-void DkImageLoader::createImages(const QFileInfoList& files, bool sort) {
-
-	// TODO: change files to QStringList
-	DkTimer dt;
-	QVector<QSharedPointer<DkImageContainerT > > oldImages = mImages;
-	mImages.clear();
-
-	QDate today = QDate::currentDate();
-
-	for (const QFileInfo& f : files) {
+void DkImageLoader::createImages(const QFileInfoList &files, bool sort)
+{
+    // TODO: change files to QStringList
+    DkTimer dt;
+    QVector<QSharedPointer<DkImageContainerT>> oldImages = mImages;
+    mImages.clear();
 
-		const QString& fp = f.absoluteFilePath();
-		int oIdx = findFileIdx(fp, oldImages);
+    QDate today = QDate::currentDate();
 
-		// NOTE: we had this here: oIdx != -1 && QFileInfo(oldImages.at(oIdx)->filePath()).lastModified() == f.lastModified())
-		// however, that did not detect file changes & slowed down the process - so I removed it...
-		mImages << ((oIdx != -1) ? oldImages.at(oIdx) : QSharedPointer<DkImageContainerT >(new DkImageContainerT(fp)));
-	}
-	qInfo() << "[DkImageLoader]" << mImages.size() << "containers created in" << dt;
+    for (const QFileInfo &f : files) {
+        const QString &fp = f.absoluteFilePath();
+        int oIdx = findFileIdx(fp, oldImages);
 
-	if (sort) {
-		qSort(mImages.begin(), mImages.end(), imageContainerLessThanPtr);
-		qInfo() << "[DkImageLoader] after sorting: " << dt;
+        // NOTE: we had this here: oIdx != -1 && QFileInfo(oldImages.at(oIdx)->filePath()).lastModified() == f.lastModified())
+        // however, that did not detect file changes & slowed down the process - so I removed it...
+        mImages << ((oIdx != -1) ? oldImages.at(oIdx) : QSharedPointer<DkImageContainerT>(new DkImageContainerT(fp)));
+    }
+    qInfo() << "[DkImageLoader]" << mImages.size() << "containers created in" << dt;
 
-		emit updateDirSignal(mImages);
+    if (sort) {
+        std::sort(mImages.begin(), mImages.end(), imageContainerLessThanPtr);
+        qInfo() << "[DkImageLoader] after sorting: " << dt;
 
-		if (mDirWatcher) {
-			if (!mDirWatcher->directories().isEmpty())
-				mDirWatcher->removePaths(mDirWatcher->directories());
-			mDirWatcher->addPath(mCurrentDir);
-		}
-	}
+        emit updateDirSignal(mImages);
 
+        if (mDirWatcher) {
+            if (!mDirWatcher->directories().isEmpty())
+                mDirWatcher->removePaths(mDirWatcher->directories());
+            mDirWatcher->addPath(mCurrentDir);
+        }
+    }
 }
 
-QVector<QSharedPointer<DkImageContainerT > > DkImageLoader::sortImages(QVector<QSharedPointer<DkImageContainerT > > images) const {
-
-	qSort(images.begin(), images.end(), imageContainerLessThanPtr);
-	return images;
+QVector<QSharedPointer<DkImageContainerT>> DkImageLoader::sortImages(QVector<QSharedPointer<DkImageContainerT>> images) const
+{
+    std::sort(images.begin(), images.end(), imageContainerLessThanPtr);
+    return images;
 }
 
 /**
  * Loads the ancesting or subsequent file.
  * @param skipIdx the number of files that should be skipped after/before the current file.
  * @param silent if true, no status information will be displayed.
- **/ 
-void DkImageLoader::changeFile(int skipIdx) {
-
-	//if (!img.isNull() && !file.exists())
-	//	return;
-	//if (!file.exists() && !virtualFile.exists()) {
-	//	qDebug() << virtualFile.absoluteFilePath() << "does not exist...!!!";
-	//	return;
-	//}
-
-	if (skipIdx == 0) {
-		reloadImage();
-		return;
-	}
+ **/
+void DkImageLoader::changeFile(int skipIdx)
+{
+    // if (!img.isNull() && !file.exists())
+    //	return;
+    // if (!file.exists() && !virtualFile.exists()) {
+    //	qDebug() << virtualFile.absoluteFilePath() << "does not exist...!!!";
+    //	return;
+    // }
+
+    if (skipIdx == 0) {
+        reloadImage();
+        return;
+    }
 
-	// update dir
-	loadDir(mCurrentDir);
+    // update dir
+    loadDir(mCurrentDir);
 
-	QSharedPointer<DkImageContainerT> imgC = getSkippedImage(skipIdx);
+    QSharedPointer<DkImageContainerT> imgC = getSkippedImage(skipIdx);
 
-	load(imgC);
+    load(imgC);
 }
 
 /**
@@ -409,914 +412,912 @@ void DkImageLoader::changeFile(int skipIdx) {
  * @param skipIdx the number of files to be skipped from the current file.
  * @param silent if true, no status information will be displayed.
  * @return QFileInfo the file info of the demanded file
- **/ 
-QSharedPointer<DkImageContainerT> DkImageLoader::getSkippedImage(int skipIdx, bool searchFile, bool recursive) {
-
-	QSharedPointer<DkImageContainerT> imgC;
-
-	if (!mCurrentImage)
-		return imgC;
-
-	DkTimer dt;
-
-
-	// load a page (e.g. within a tiff file)
-	if (mCurrentImage->setPageIdx(skipIdx))
-		return mCurrentImage;
-
-	//if (searchFile && currentImage->file().absoluteDir() != dir.absolutePath()) {
-	//	qDebug() << "loading new dir: " << currentImage->file().absolutePath();
-	//	qDebug() << "old dir: " << dir.absolutePath();
-	
-	if (!recursive)
-		loadDir(mCurrentImage->dirPath(), false);
-
-	// locate the current file
-	int newFileIdx = 0;
-	
-	if (searchFile) mTmpFileIdx = 0;
-
-	//qDebug() << "virtual file " << virtualFile.absoluteFilePath();
-	//qDebug() << "file" << file.absoluteFilePath();
-
-	//if (virtualExists || file.exists()) {
-
-	if (searchFile) {
+ **/
+QSharedPointer<DkImageContainerT> DkImageLoader::getSkippedImage(int skipIdx, bool searchFile, bool recursive)
+{
+    QSharedPointer<DkImageContainerT> imgC;
 
-		QString file = (mCurrentImage->exists()) ? mCurrentImage->filePath() : mCurrentDir;
+    if (!mCurrentImage)
+        return imgC;
 
-		mTmpFileIdx = findFileIdx(file, mImages);
+    DkTimer dt;
 
-		// could not locate the file -> it was deleted?!
-		if (mTmpFileIdx == -1) {
+    // load a page (e.g. within a tiff file)
+    if (mCurrentImage->setPageIdx(skipIdx))
+        return mCurrentImage;
 
-			mTmpFileIdx = 0;
-			for (; mTmpFileIdx < mImages.size(); mTmpFileIdx++) {
+    // if (searchFile && currentImage->file().absoluteDir() != dir.absolutePath()) {
+    //	qDebug() << "loading new dir: " << currentImage->file().absolutePath();
+    //	qDebug() << "old dir: " << dir.absolutePath();
 
-				if (*(mCurrentImage.data()) < *(mImages[mTmpFileIdx].data()))
-					break;
-			}
+    if (!recursive)
+        loadDir(mCurrentImage->dirPath(), false);
 
-			if (skipIdx > 0)
-				mTmpFileIdx--;	// -1 because the current file does not exist
-			if (mImages.size() == mTmpFileIdx)	// could not locate file - resize
-				mTmpFileIdx = 0;
+    // locate the current file
+    int newFileIdx = 0;
 
-		}		
+    if (searchFile)
+        mTmpFileIdx = 0;
 
-	}
-	newFileIdx = mTmpFileIdx + skipIdx;
+    // qDebug() << "virtual file " << virtualFile.absoluteFilePath();
+    // qDebug() << "file" << file.absoluteFilePath();
 
-	//qDebug() << "subfolders: " << DkSettingsManager::param().global().scanSubFolders << "subfolder size: " << (subFolders.size() > 1);
+    // if (virtualExists || file.exists()) {
 
-	if (DkSettingsManager::param().global().scanSubFolders && mSubFolders.size() > 1 && (newFileIdx < 0 || newFileIdx >= mImages.size())) {
+    if (searchFile) {
+        QString file = (mCurrentImage->exists()) ? mCurrentImage->filePath() : mCurrentDir;
 
-		int folderIdx = 0;
+        mTmpFileIdx = findFileIdx(file, mImages);
 
-		// locate folder
-		for (int idx = 0; idx < mSubFolders.size(); idx++) {
-			if (mSubFolders[idx] == mCurrentDir) {
-				folderIdx = idx;
-				break;
-			}
-		}
+        // could not locate the file -> it was deleted?!
+        if (mTmpFileIdx == -1) {
+            mTmpFileIdx = 0;
+            for (; mTmpFileIdx < mImages.size(); mTmpFileIdx++) {
+                if (*(mCurrentImage.data()) < *(mImages[mTmpFileIdx].data()))
+                    break;
+            }
 
-		if (newFileIdx < 0)
-			folderIdx = getPrevFolderIdx(folderIdx);
-		else
-			folderIdx = getNextFolderIdx(folderIdx);
+            if (skipIdx > 0)
+                mTmpFileIdx--; // -1 because the current file does not exist
+            if (mImages.size() == mTmpFileIdx) // could not locate file - resize
+                mTmpFileIdx = 0;
+        }
+    }
+    newFileIdx = mTmpFileIdx + skipIdx;
 
-		qDebug() << "new folder idx: " << folderIdx;
-			
-		//if (DkSettingsManager::param().global().loop)
-		//	folderIdx %= subFolders.size();
+    // qDebug() << "subfolders: " << DkSettingsManager::param().global().scanSubFolders << "subfolder size: " << (subFolders.size() > 1);
 
-		if (folderIdx >= 0 && folderIdx < mSubFolders.size()) {
-				
-			int oldFileSize = mImages.size();
-			loadDir(mSubFolders[folderIdx], false);	// don't scan recursive again
-			qDebug() << "loading new folder: " << mSubFolders[folderIdx];
+    if (DkSettingsManager::param().global().scanSubFolders && mSubFolders.size() > 1 && (newFileIdx < 0 || newFileIdx >= mImages.size())) {
+        int folderIdx = 0;
 
-			if (newFileIdx >= oldFileSize) {
-				newFileIdx -= oldFileSize;
-				mTmpFileIdx = 0;
-				qDebug() << "new skip idx: " << newFileIdx << "cFileIdx: " << mTmpFileIdx << " -----------------------------";
-				getSkippedImage(newFileIdx, false, true);
-			}
-			else if (newFileIdx < 0) {
-				newFileIdx += mTmpFileIdx;
-				mTmpFileIdx = mImages.size()-1;
-				qDebug() << "new skip idx: " << newFileIdx << "cFileIdx: " << mTmpFileIdx << " -----------------------------";
-				getSkippedImage(newFileIdx, false, true);
-			}
-		}
-		//// dir up
-		//else if (folderIdx == subFolders.size()) {
+        // locate folder
+        for (int idx = 0; idx < mSubFolders.size(); idx++) {
+            if (mSubFolders[idx] == mCurrentDir) {
+                folderIdx = idx;
+                break;
+            }
+        }
 
-		//	qDebug() << "going one up";
-		//	dir.cd("..");
-		//	loadDir(dir, false);	// don't scan recursive again
-		//	newFileIdx += cFileIdx;
-		//	cFileIdx = 0;
-		//	getChangedFileInfo(newFileIdx, silent, false);
-		//}
-		//// get root files
-		//else if (folderIdx < 0) {
-		//	loadDir(dir, false);
-		//}
-
-	}
+        if (newFileIdx < 0)
+            folderIdx = getPrevFolderIdx(folderIdx);
+        else
+            folderIdx = getNextFolderIdx(folderIdx);
+
+        qDebug() << "new folder idx: " << folderIdx;
+
+        // if (DkSettingsManager::param().global().loop)
+        //	folderIdx %= subFolders.size();
+
+        if (folderIdx >= 0 && folderIdx < mSubFolders.size()) {
+            int oldFileSize = mImages.size();
+            loadDir(mSubFolders[folderIdx], false); // don't scan recursive again
+            qDebug() << "loading new folder: " << mSubFolders[folderIdx];
+
+            if (newFileIdx >= oldFileSize) {
+                newFileIdx -= oldFileSize;
+                mTmpFileIdx = 0;
+                qDebug() << "new skip idx: " << newFileIdx << "cFileIdx: " << mTmpFileIdx << " -----------------------------";
+                getSkippedImage(newFileIdx, false, true);
+            } else if (newFileIdx < 0) {
+                newFileIdx += mTmpFileIdx;
+                mTmpFileIdx = mImages.size() - 1;
+                qDebug() << "new skip idx: " << newFileIdx << "cFileIdx: " << mTmpFileIdx << " -----------------------------";
+                getSkippedImage(newFileIdx, false, true);
+            }
+        }
+        //// dir up
+        // else if (folderIdx == subFolders.size()) {
+
+        //	qDebug() << "going one up";
+        //	dir.cd("..");
+        //	loadDir(dir, false);	// don't scan recursive again
+        //	newFileIdx += cFileIdx;
+        //	cFileIdx = 0;
+        //	getChangedFileInfo(newFileIdx, silent, false);
+        //}
+        //// get root files
+        // else if (folderIdx < 0) {
+        //	loadDir(dir, false);
+        // }
+    }
 
 #ifdef WITH_QUAZIP
-	if (mCurrentImage && (newFileIdx < 0 || newFileIdx >= mImages.size()) && mCurrentImage->isFromZip() && mCurrentImage->getZipData()) {
-
-		// load the zip again and go on from there
-		setCurrentImage(QSharedPointer<DkImageContainerT>(new DkImageContainerT(mCurrentImage->getZipData()->getZipFilePath())));
+    if (mCurrentImage && (newFileIdx < 0 || newFileIdx >= mImages.size()) && mCurrentImage->isFromZip() && mCurrentImage->getZipData()) {
+        // load the zip again and go on from there
+        setCurrentImage(QSharedPointer<DkImageContainerT>(new DkImageContainerT(mCurrentImage->getZipData()->getZipFilePath())));
 
-		if (newFileIdx >= mImages.size())
-			newFileIdx -= mImages.size() - 1;
+        if (newFileIdx >= mImages.size())
+            newFileIdx -= mImages.size() - 1;
 
-		return getSkippedImage(newFileIdx);
-	}
+        return getSkippedImage(newFileIdx);
+    }
 #endif
 
-	// this should never happen!
-	if (mImages.empty()) {
-		qDebug() << "file list is empty, where it should not be";
-		return imgC;
-	}
-
-	// loop the directory
-	if (DkSettingsManager::param().global().loop) {
-		newFileIdx %= mImages.size();
+    // this should never happen!
+    if (mImages.empty()) {
+        qDebug() << "file list is empty, where it should not be";
+        return imgC;
+    }
 
-		while (newFileIdx < 0)	// should be hit once
-			newFileIdx = mImages.size() + newFileIdx;
+    // loop the directory
+    if (DkSettingsManager::param().global().loop) {
+        newFileIdx %= mImages.size();
 
-	}
-	// clip to pos1 if skipIdx < -1
-	else if (mTmpFileIdx > 0 && newFileIdx < 0) {
-		newFileIdx = 0;
-	}
-	// clip to end if skipIdx > 1
-	else if (mTmpFileIdx < mImages.size()-1 && newFileIdx >= mImages.size()) {
-		newFileIdx = mImages.size()-1;
-	}
-	// tell user that there is nothing left to display
-	else if (newFileIdx < 0) {
+        while (newFileIdx < 0) // should be hit once
+            newFileIdx = mImages.size() + newFileIdx;
 
-		// TODO: find an elegant way to switch back to the zip folder
-		QString msg = tr("You have reached the beginning");
-		showInfoSignal(msg, 1000);
-		return imgC;
-	}
-	// tell user that there is nothing left to display
-	else if (newFileIdx >= mImages.size()) {
-		QString msg = tr("You have reached the end");
-			
-		if (!DkSettingsManager::param().global().loop)
-			emit setPlayer(false);
+    }
+    // clip to pos1 if skipIdx < -1
+    else if (mTmpFileIdx > 0 && newFileIdx < 0) {
+        newFileIdx = 0;
+    }
+    // clip to end if skipIdx > 1
+    else if (mTmpFileIdx < mImages.size() - 1 && newFileIdx >= mImages.size()) {
+        newFileIdx = mImages.size() - 1;
+    }
+    // tell user that there is nothing left to display
+    else if (newFileIdx < 0) {
+        // TODO: find an elegant way to switch back to the zip folder
+        QString msg = tr("You have reached the beginning");
+        showInfoSignal(msg, 1000);
+        return imgC;
+    }
+    // tell user that there is nothing left to display
+    else if (newFileIdx >= mImages.size()) {
+        QString msg = tr("You have reached the end");
 
-		showInfoSignal(msg, 1000);
-		return imgC;
-	}
+        if (!DkSettingsManager::param().global().loop)
+            emit setPlayer(false);
 
-	mTmpFileIdx = newFileIdx;
+        showInfoSignal(msg, 1000);
+        return imgC;
+    }
 
-	if (newFileIdx >= 0 && newFileIdx < mImages.size())
-		imgC = mImages.at(newFileIdx);
+    mTmpFileIdx = newFileIdx;
 
+    if (newFileIdx >= 0 && newFileIdx < mImages.size())
+        imgC = mImages.at(newFileIdx);
 
-	// file requested becomes current file
-	return imgC;
-	
+    // file requested becomes current file
+    return imgC;
 }
 
-
 /**
-* Loads the file at index idx.
-* @param idx the file index of the file which should be loaded.
-**/ 
-void DkImageLoader::loadFileAt(int idx) {
-
-	//if (basicLoader.hasImage() && !file.exists())
-	//	return;
-
-	if (mCurrentImage)
-		qDebug() << "current image: " << mCurrentImage->filePath();
-	else
-		qDebug() << "current image is NULL";
-
-	QDir cDir(mCurrentDir);
-
-	if (mCurrentImage && !cDir.exists())
-		loadDir(mCurrentImage->dirPath());
-
-	if(mImages.empty())
-		return;
-
-	if (cDir.exists()) {
-
-		if (idx == -1) {
-			idx = mImages.size()-1;
-		}
-		else if (DkSettingsManager::param().global().loop) {
-			idx %= mImages.size();
-
-			while (idx < 0)
-				idx = mImages.size() + idx;
+ * Loads the file at index idx.
+ * @param idx the file index of the file which should be loaded.
+ **/
+void DkImageLoader::loadFileAt(int idx)
+{
+    // if (basicLoader.hasImage() && !file.exists())
+    //	return;
 
-		}
-		else if (idx < 0 && !DkSettingsManager::param().global().loop) {
-			QString msg = tr("You have reached the beginning");
-			emit showInfoSignal(msg, 1000);
-			return;
-		}
-		else if (idx >= mImages.size()) {
-			QString msg = tr("You have reached the end");
-			if (!DkSettingsManager::param().global().loop)
-				emit(setPlayer(false));
-			emit showInfoSignal(msg, 1000);
-			return;
-		}
-	}
+    if (mCurrentImage)
+        qDebug() << "current image: " << mCurrentImage->filePath();
+    else
+        qDebug() << "current image is NULL";
+
+    QDir cDir(mCurrentDir);
+
+    if (mCurrentImage && !cDir.exists())
+        loadDir(mCurrentImage->dirPath());
+
+    if (mImages.empty())
+        return;
+
+    if (cDir.exists()) {
+        if (idx == -1) {
+            idx = mImages.size() - 1;
+        } else if (DkSettingsManager::param().global().loop) {
+            idx %= mImages.size();
+
+            while (idx < 0)
+                idx = mImages.size() + idx;
+
+        } else if (idx < 0 && !DkSettingsManager::param().global().loop) {
+            QString msg = tr("You have reached the beginning");
+            emit showInfoSignal(msg, 1000);
+            return;
+        } else if (idx >= mImages.size()) {
+            QString msg = tr("You have reached the end");
+            if (!DkSettingsManager::param().global().loop)
+                emit(setPlayer(false));
+            emit showInfoSignal(msg, 1000);
+            return;
+        }
+    }
 
-	// file requested becomes current file
-	setCurrentImage(mImages.at(idx));
+    // file requested becomes current file
+    setCurrentImage(mImages.at(idx));
 
-	load(mCurrentImage);
+    load(mCurrentImage);
 }
 
-QSharedPointer<DkImageContainerT> DkImageLoader::findOrCreateFile(const QString& filePath) const {
-
-	QSharedPointer<DkImageContainerT> imgC = findFile(filePath);
+QSharedPointer<DkImageContainerT> DkImageLoader::findOrCreateFile(const QString &filePath) const
+{
+    QSharedPointer<DkImageContainerT> imgC = findFile(filePath);
 
-	if (!imgC)
-		imgC = QSharedPointer<DkImageContainerT>(new DkImageContainerT(filePath));
+    if (!imgC)
+        imgC = QSharedPointer<DkImageContainerT>(new DkImageContainerT(filePath));
 
-	return imgC;
+    return imgC;
 }
 
-QSharedPointer<DkImageContainerT> DkImageLoader::findFile(const QString& filePath) const {
-
-	// if one image is from zip than all should be
-	// for images in zip the "images[idx]->file() == file" comparison somahow does not work
-	if(mImages.size() > 0) {
-
-		if (mImages[0]->isFromZip()) {
-			int idx = findFileIdx(filePath, mImages);
-			if (idx < 0) 
-				return QSharedPointer<DkImageContainerT>();
-			else 
-				return mImages[idx];
-		}
-	}
-
-	for (int idx = 0; idx < mImages.size(); idx++) {
+QSharedPointer<DkImageContainerT> DkImageLoader::findFile(const QString &filePath) const
+{
+    // if one image is from zip than all should be
+    // for images in zip the "images[idx]->file() == file" comparison somahow does not work
+    if (mImages.size() > 0) {
+        if (mImages[0]->isFromZip()) {
+            int idx = findFileIdx(filePath, mImages);
+            if (idx < 0)
+                return QSharedPointer<DkImageContainerT>();
+            else
+                return mImages[idx];
+        }
+    }
 
-		if (mImages[idx]->filePath() == filePath)
-			return mImages[idx];
-	}
+    for (int idx = 0; idx < mImages.size(); idx++) {
+        if (mImages[idx]->filePath() == filePath)
+            return mImages[idx];
+    }
 
-	return QSharedPointer<DkImageContainerT>();
+    return QSharedPointer<DkImageContainerT>();
 }
 
-int DkImageLoader::findFileIdx(const QString& filePath, const QVector<QSharedPointer<DkImageContainerT> >& images) const {
-
-	// this seems a bit bizare...
-	// however, in converting the string from a fileInfo - we quarantee that the separators are the same (/ vs \)
-	QString lFilePath = filePath;
-	lFilePath.replace("\\", QDir::separator());
-
-	for (int idx = 0; idx < images.size(); idx++) {
+int DkImageLoader::findFileIdx(const QString &filePath, const QVector<QSharedPointer<DkImageContainerT>> &images) const
+{
+    // this seems a bit bizare...
+    // however, in converting the string from a fileInfo - we quarantee that the separators are the same (/ vs \)
+    QString lFilePath = filePath;
+    lFilePath.replace("\\", QDir::separator());
 
-		if (images[idx]->filePath() == lFilePath)
-			return idx;
-	}
+    for (int idx = 0; idx < images.size(); idx++) {
+        if (images[idx]->filePath() == lFilePath)
+            return idx;
+    }
 
-	return -1;
+    return -1;
 }
 
-QStringList DkImageLoader::getFileNames() const {
-
-	QStringList fileNames;
+QStringList DkImageLoader::getFileNames() const
+{
+    QStringList fileNames;
 
-	for (int idx = 0; idx < mImages.size(); idx++)
-		fileNames.append(QFileInfo(mImages[idx]->filePath()).fileName());
+    for (int idx = 0; idx < mImages.size(); idx++)
+        fileNames.append(QFileInfo(mImages[idx]->filePath()).fileName());
 
-	return fileNames;
+    return fileNames;
 }
 
-QVector<QSharedPointer<DkImageContainerT> > DkImageLoader::getImages() {
-
-	loadDir(mCurrentDir);
-	return mImages;
+QVector<QSharedPointer<DkImageContainerT>> DkImageLoader::getImages()
+{
+    loadDir(mCurrentDir);
+    return mImages;
 }
 
-void DkImageLoader::setImages(QVector<QSharedPointer<DkImageContainerT> > images) {
-
-	mImages = images;
-	emit updateDirSignal(images);
+void DkImageLoader::setImages(QVector<QSharedPointer<DkImageContainerT>> images)
+{
+    mImages = images;
+    emit updateDirSignal(images);
 }
 
 /**
  * Loads the first file of the current directory.
- **/ 
-void DkImageLoader::firstFile() {
-
-	loadFileAt(0);
+ **/
+void DkImageLoader::firstFile()
+{
+    loadFileAt(0);
 }
 
 /**
  * Loads the last file of the current directory.
- **/ 
-void DkImageLoader::lastFile() {
-	
-	loadFileAt(-1);
-}
-
-bool DkImageLoader::unloadFile() {
-
-	if (!mCurrentImage)
-		return true;
-
-	// if we are either in rc or remote display mode & the directory does not exist - we received an image, so don't ask the user
-	if (mCurrentImage->isEdited()) {
-		DkMessageBox* msgBox = new DkMessageBox(
-			QMessageBox::Question, 
-			tr("Save Image"), 
-			tr("Do you want to save changes to:\n%1").arg(QFileInfo(mCurrentImage->filePath()).fileName()), 
-			(QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel), 
-			DkUtils::getMainWindow());
-
-		msgBox->setDefaultButton(QMessageBox::No);
-		msgBox->setObjectName("saveEditDialog");
-
-		int answer = msgBox->exec();
-
-		if (answer == QMessageBox::Accepted || answer == QMessageBox::Yes) {
-			
-			if (DkUtils::isSavable(mCurrentImage->fileInfo().fileName()))
-				mCurrentImage->saveImageThreaded(mCurrentImage->filePath());
-			else
-				saveUserFileAs(mCurrentImage->image(), false);	// we loose all metadata here - right?
-		}
-		else if (answer != QMessageBox::No) {	// only 'No' will discard the changes
-			return false;
-		}
-	}
+ **/
+void DkImageLoader::lastFile()
+{
+    loadFileAt(-1);
+}
+
+bool DkImageLoader::unloadFile()
+{
+    if (!mCurrentImage)
+        return true;
+
+    // if we are either in rc or remote display mode & the directory does not exist - we received an image, so don't ask the user
+    if (mCurrentImage->isEdited()) {
+        DkMessageBox *msgBox = new DkMessageBox(QMessageBox::Question,
+                                                tr("Save Image"),
+                                                tr("Do you want to save changes to:\n%1").arg(QFileInfo(mCurrentImage->filePath()).fileName()),
+                                                (QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel),
+                                                DkUtils::getMainWindow());
+
+        msgBox->setDefaultButton(QMessageBox::No);
+        msgBox->setObjectName("saveEditDialog");
+
+        int answer = msgBox->exec();
+
+        // Save image if pixmap edited (lastImageEdit); otherwise save only metadata if metadata edited
+        bool imgEdited = mCurrentImage->getLoader()->isImageEdited();
+        bool metaEdited = mCurrentImage->getLoader()->isMetaDataEdited();
+
+        if (answer == QMessageBox::Accepted || answer == QMessageBox::Yes) {
+            if (DkUtils::isSavable(mCurrentImage->fileInfo().fileName())) {
+                if (imgEdited)
+                    mCurrentImage->saveImageThreaded(mCurrentImage->filePath());
+                else if (metaEdited)
+                    mCurrentImage->saveMetaData();
+            } else {
+                saveUserFileAs(mCurrentImage->image(), false); // we loose all metadata here - right?
+            }
+
+        } else if (answer != QMessageBox::No) { // only 'No' will discard the changes
+            return false;
+        }
+    }
 
-	return true;
+    return true;
 }
 
 /**
  * Convenience function see @activate.
- **/ 
-void DkImageLoader::deactivate() {
-
-	activate(false);
+ **/
+void DkImageLoader::deactivate()
+{
+    activate(false);
 }
 
-
 /**
  * Activates or deactivates the loader.
  * If activated, the directory is indexed & the current image is loaded.
  * If deactivated, the image list & the current image are deleted which
  * should save some memory. In addition, all signals are mBlocked.
  * @param isActive if true, the loader is activated
- **/ 
-void DkImageLoader::activate(bool isActive /* = true */) {
-
-	if (!isActive) {
-		// go to sleep - schlofand wöhlar ihr camölar
-		blockSignals(true);
-		clearPath();
-	}
-	else if (!mCurrentImage) {
-		// wake up again
-		blockSignals(false);
-		setCurrentImage(mLastImageLoaded);
-	}
-	else
-		emit updateDirSignal(mImages);
-}
-
-void DkImageLoader::setCurrentImage(QSharedPointer<DkImageContainerT> newImg) {
-
-	// force index folder if we dir out of the zip
-	if (mCurrentImage && newImg && mCurrentImage->isFromZip() && !newImg->isFromZip())
-		mFolderUpdated = true;
-
-	if (signalsBlocked()) {
-		mCurrentImage = newImg;
-		return;
-	}
+ **/
+void DkImageLoader::activate(bool isActive /* = true */)
+{
+    if (!isActive) {
+        // go to sleep - schlofand wöhlar ihr camölar
+        blockSignals(true);
+        clearPath();
+    } else if (!mCurrentImage) {
+        // wake up again
+        blockSignals(false);
+        setCurrentImage(mLastImageLoaded);
+    } else
+        emit updateDirSignal(mImages);
+}
+
+void DkImageLoader::setCurrentImage(QSharedPointer<DkImageContainerT> newImg)
+{
+    // force index folder if we dir out of the zip
+    if (mCurrentImage && newImg && mCurrentImage->isFromZip() && !newImg->isFromZip())
+        mFolderUpdated = true;
+
+    if (signalsBlocked()) {
+        mCurrentImage = newImg;
+        return;
+    }
 
-	if (newImg)
-		loadDir(newImg->dirPath());
-	//else
-	//	qDebug() << "empty image assigned";
-	
-	// if the file stays the same, we just want to update the pointer
-	bool updatePointer = newImg && mCurrentImage && newImg->filePath() == mCurrentImage->filePath();
+    if (newImg)
+        loadDir(newImg->dirPath());
+    // else
+    //	qDebug() << "empty image assigned"; // TODO
 
-	// cancel action if the image is currently loading
-	if (DkSettingsManager::param().resources().waitForLastImg &&
-		mCurrentImage && mCurrentImage->getLoadState() == DkImageContainerT::loading && 
-		newImg && newImg->dirPath() == mCurrentImage->dirPath())
-		return;
+    // if the file stays the same, we just want to update the pointer
+    bool updatePointer = newImg && mCurrentImage && newImg->filePath() == mCurrentImage->filePath();
 
-	if (mCurrentImage) {
+    // cancel action if the image is currently loading
+    if (DkSettingsManager::param().resources().waitForLastImg && mCurrentImage && mCurrentImage->getLoadState() == DkImageContainerT::loading && newImg
+        && newImg->dirPath() == mCurrentImage->dirPath())
+        return;
 
-		// do we load a new image?
-		if (!updatePointer) {
-			mCurrentImage->cancel();
+    if (mCurrentImage) {
+        // do we load a new image?
+        if (!updatePointer) {
+            mCurrentImage->cancel();
 
-			if (mCurrentImage->getLoadState() == DkImageContainer::loading_canceled)
-				emit showInfoSignal(newImg->fileName(), 3000, 1);
+            if (mCurrentImage->getLoadState() == DkImageContainer::loading_canceled)
+                emit showInfoSignal(newImg->fileName(), 3000, 1);
 
-			// this causes a crash 
-			// because the release will trigger the saving of
-			// metadata (in a different thread) - and
-			// the auto_ptr does not like that at all
-			// anyhow we don't need to save the metadata twice
-			//currentImage->saveMetaDataThreaded();
+            // this causes a crash
+            // because the release will trigger the saving of
+            // metadata (in a different thread) - and
+            // the auto_ptr does not like that at all
+            // anyhow we don't need to save the metadata twice
+            // currentImage->saveMetaDataThreaded();
 
-			if (!DkSettingsManager::param().resources().cacheMemory)
-				mCurrentImage->clear();
+            if (!DkSettingsManager::param().resources().cacheMemory)
+                mCurrentImage->clear();
 
-			mCurrentImage->getLoader()->resetPageIdx();
-		}
-		mCurrentImage->receiveUpdates(this, false);	// reset updates
-	}
+            mCurrentImage->getLoader()->resetPageIdx();
+        }
+        mCurrentImage->receiveUpdates(this, false); // reset updates
+    }
 
-	mCurrentImage = newImg;
+    mCurrentImage = newImg;
 
-	if (mCurrentImage)
-		mCurrentImage->receiveUpdates(this);
+    if (mCurrentImage)
+        mCurrentImage->receiveUpdates(this);
 }
 
-void DkImageLoader::reloadImage() {
-
-	if(!mCurrentImage)
-		return;
+void DkImageLoader::reloadImage()
+{
+    if (!mCurrentImage)
+        return;
 
-	if (!mCurrentImage->exists()) {
-		// message when reloaded
-		QString msg = tr("sorry, %1 does not exist anymore...").arg(mCurrentImage->fileName());
-		emit showInfoSignal(msg, 4000);
-		return;
-	}
+    if (!mCurrentImage->exists()) {
+        // message when reloaded
+        QString msg = tr("sorry, %1 does not exist anymore...").arg(mCurrentImage->fileName());
+        emit showInfoSignal(msg, 4000);
+        return;
+    }
 
-	mCurrentDir = "";
-	mImages.clear();
-	mCurrentImage->clear();
-	setCurrentImage(mCurrentImage);
-	loadDir(mCurrentImage->dirPath());
-	load(mCurrentImage);
+    mCurrentDir = "";
+    mImages.clear();
+    mCurrentImage->clear();
+    setCurrentImage(mCurrentImage);
+    loadDir(mCurrentImage->dirPath());
+    load(mCurrentImage);
 }
 
-void DkImageLoader::showOnMap() {
-
-	QSharedPointer<DkMetaDataT> metaData = getCurrentImage()->getMetaData();
+void DkImageLoader::showOnMap()
+{
+    QSharedPointer<DkMetaDataT> metaData = getCurrentImage()->getMetaData();
 
-	if (!DkMetaDataHelper::getInstance().hasGPS(metaData)) {
-		emit showInfoSignal(tr("Sorry, I could not find the GPS coordinates..."));
-		return;
-	}
+    if (!DkMetaDataHelper::getInstance().hasGPS(metaData)) {
+        emit showInfoSignal(tr("Sorry, I could not find the GPS coordinates..."));
+        return;
+    }
 
-	QDesktopServices::openUrl(QUrl(DkMetaDataHelper::getInstance().getGpsCoordinates(metaData)));
+    QDesktopServices::openUrl(QUrl(DkMetaDataHelper::getInstance().getGpsCoordinates(metaData)));
 }
 
-void DkImageLoader::load(const QString& filePath) {
-
-	bool hasZipMarker = false;
+void DkImageLoader::load(const QString &filePath)
+{
+    bool hasZipMarker = false;
 
 #ifdef WITH_QUAZIP
-	hasZipMarker = filePath.contains(DkZipContainer::zipMarker()) != 0;
+    hasZipMarker = filePath.contains(DkZipContainer::zipMarker()) != 0;
 #endif
 
-	if (QFileInfo(filePath).isFile() || hasZipMarker) {
-		QSharedPointer<DkImageContainerT> newImg = findOrCreateFile(filePath);
-		setCurrentImage(newImg);
-		load(mCurrentImage);
-	}
-	else
-		firstFile();
-	
-	// if here is a folder upate bug - this was before -- if (QFileInfo(filePath).isFile() || hasZipMarker) { 
-	loadDir(QFileInfo(filePath).absolutePath());
-}
+    if (QFileInfo(filePath).isFile() || hasZipMarker) {
+        QSharedPointer<DkImageContainerT> newImg = findOrCreateFile(filePath);
+        setCurrentImage(newImg);
+        load(mCurrentImage);
+    } else
+        firstFile();
 
-void DkImageLoader::load(QSharedPointer<DkImageContainerT> image /* = QSharedPointer<DkImageContainerT> */) {
+    // if here is a folder upate bug - this was before -- if (QFileInfo(filePath).isFile() || hasZipMarker) {
+    loadDir(QFileInfo(filePath).absolutePath());
+}
 
-	if (!image)
-		return;
+void DkImageLoader::load(QSharedPointer<DkImageContainerT> image /* = QSharedPointer<DkImageContainerT> */)
+{
+    if (!image)
+        return;
 
 #ifdef WITH_QUAZIP
-	bool isZipArchive = DkBasicLoader::isContainer(image->filePath());
+    bool isZipArchive = DkBasicLoader::isContainer(image->filePath());
 
-	if (isZipArchive) {
-		loadZipArchive(image->filePath());
-		firstFile();
-		return;
-	}
+    if (isZipArchive) {
+        loadZipArchive(image->filePath());
+        firstFile();
+        return;
+    }
 #endif
 
-	setCurrentImage(image);
+    setCurrentImage(image);
 
-	if (mCurrentImage && mCurrentImage->getLoadState() == DkImageContainerT::loading)
-		return;
+    if (mCurrentImage && mCurrentImage->getLoadState() == DkImageContainerT::loading)
+        return;
 
-	emit updateSpinnerSignalDelayed(true);
-	bool loaded = mCurrentImage->loadImageThreaded();	// loads file threaded
-	
-	if (!loaded)
-		emit updateSpinnerSignalDelayed(false);
+    emit updateSpinnerSignalDelayed(true);
+    bool loaded = mCurrentImage->loadImageThreaded(); // loads file threaded
 
-	// if loaded is false, we definitively know that the file does not exist -> early exception here?
-}
+    if (!loaded)
+        emit updateSpinnerSignalDelayed(false);
 
-void DkImageLoader::imageLoaded(bool loaded /* = false */) {
-	
-	emit updateSpinnerSignalDelayed(false);
+    // if loaded is false, we definitively know that the file does not exist -> early exception here?
+}
 
-	if (!mCurrentImage) {
-		return;
-	}
+void DkImageLoader::imageLoaded(bool loaded /* = false */)
+{
+    emit updateSpinnerSignalDelayed(false);
 
-	emit imageLoadedSignal(mCurrentImage, loaded);
+    if (!mCurrentImage) {
+        return;
+    }
 
-	if (!loaded)
-		return;
+    emit imageLoadedSignal(mCurrentImage, loaded);
 
-	emit imageUpdatedSignal(mCurrentImage);
+    if (!loaded)
+        return;
 
-	if (mCurrentImage) {
-		// this signal is needed by the folder scrollbar
-		int idx = findFileIdx(mCurrentImage->filePath(), mImages);
-		emit imageUpdatedSignal(idx);
-	}
+    emit imageUpdatedSignal(mCurrentImage);
 
-	QApplication::sendPostedEvents();	// force an event post here
+    if (mCurrentImage) {
+        // this signal is needed by the folder scrollbar
+        int idx = findFileIdx(mCurrentImage->filePath(), mImages);
+        emit imageUpdatedSignal(idx);
+    }
 
-	updateCacher(mCurrentImage);
-	updateHistory();
+    QApplication::sendPostedEvents(); // force an event post here
 
-	if (mCurrentImage)
-		emit imageHasGPSSignal(DkMetaDataHelper::getInstance().hasGPS(mCurrentImage->getMetaData()));
+    updateCacher(mCurrentImage);
+    updateHistory();
 
-	// update status bar info
-	if (mCurrentImage && !mImages.empty() && mImages.indexOf(mCurrentImage) >= 0)
-		DkStatusBarManager::instance().setMessage(tr("%1 of %2").arg(mImages.indexOf(mCurrentImage)+1).arg(mImages.size()), DkStatusBar::status_filenumber_info);
-	else
-		DkStatusBarManager::instance().setMessage("", DkStatusBar::status_filenumber_info);
+    if (mCurrentImage)
+        emit imageHasGPSSignal(DkMetaDataHelper::getInstance().hasGPS(mCurrentImage->getMetaData()));
 
+    // update status bar info
+    if (mCurrentImage && !mImages.empty() && mImages.indexOf(mCurrentImage) >= 0)
+        DkStatusBarManager::instance().setMessage(tr("%1 of %2").arg(mImages.indexOf(mCurrentImage) + 1).arg(mImages.size()),
+                                                  DkStatusBar::status_filenumber_info);
+    else
+        DkStatusBarManager::instance().setMessage("", DkStatusBar::status_filenumber_info);
 }
 
-void DkImageLoader::downloadFile(const QUrl& url) {
-
-	QSharedPointer<DkImageContainerT> newImg = findOrCreateFile(QString());
-	setCurrentImage(newImg);
-	newImg->downloadFile(url);
-	emit updateSpinnerSignalDelayed(true);
+void DkImageLoader::downloadFile(const QUrl &url)
+{
+    QSharedPointer<DkImageContainerT> newImg = findOrCreateFile(QString());
+    setCurrentImage(newImg);
+    newImg->downloadFile(url);
+    emit updateSpinnerSignalDelayed(true);
 }
 
 /**
  * Saves a temporary file to the folder specified in DkSettingsManager.
  * @param img the image (which was in most cases pasted to nomacs)
- **/ 
-QString DkImageLoader::saveTempFile(const QImage& img, const QString& name, const QString& fileExt, bool force, bool threaded) {
-
-	QString filePath = DkSettingsManager::param().global().tmpPath;
-	QFileInfo fInfo(filePath + QDir::separator());
-
-	if (!force && (filePath.isEmpty() || !fInfo.exists())) {
-		
-		if (!filePath.isEmpty())
-			qWarning() << filePath << "does not exist";
-		return QString();
-	}
-	else if (filePath.isEmpty() || !fInfo.exists()) {
-
-		fInfo = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
-
-		if (!fInfo.isDir()) {
-			// load system default open dialog
-			QString dirName = QFileDialog::getExistingDirectory(
-				DkUtils::getMainWindow(), 
-				tr("Save Directory"), 
-				getDirPath(),
-				QFileDialog::ShowDirsOnly | DkDialog::fileDialogOptions()
-			);
-
-			fInfo = dirName + QDir::separator();
+ **/
+QString DkImageLoader::saveTempFile(const QImage &img, const QString &name, const QString &fileExt, bool force, bool threaded)
+{
+    QString filePath = DkSettingsManager::param().global().tmpPath;
+    QFileInfo fInfo(filePath + QDir::separator());
+
+    if (!force && (filePath.isEmpty() || !fInfo.exists())) {
+        if (!filePath.isEmpty())
+            qWarning() << filePath << "does not exist";
+        return QString();
+    } else if (filePath.isEmpty() || !fInfo.exists()) {
+        fInfo = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
+
+        if (!fInfo.isDir()) {
+            // load system default open dialog
+            QString dirName = QFileDialog::getExistingDirectory(DkUtils::getMainWindow(),
+                                                                tr("Save Directory"),
+                                                                getDirPath(),
+                                                                QFileDialog::ShowDirsOnly | DkDialog::fileDialogOptions());
+
+            fInfo = dirName + QDir::separator();
+
+            if (!fInfo.exists())
+                return QString();
+        }
+    }
 
-			if (!fInfo.exists())
-				return QString();
-		}
-	}
+    qInfo() << "saving to: " << fInfo.absolutePath();
 
-	qInfo() << "saving to: " << fInfo.absolutePath();
-	
-	QString fileName = name + "-" + DkUtils::nowString() + fileExt;
-	fInfo = QFileInfo(fInfo.absolutePath(), fileName);
+    QString fileName = name + "-" + DkUtils::nowString() + fileExt;
+    fInfo = QFileInfo(fInfo.absolutePath(), fileName);
 
-	if (!fInfo.exists()) {
-			
-		saveFile(fInfo.absoluteFilePath(), img, "", -1, threaded);
-		return fInfo.absoluteFilePath();
-	}
+    if (!fInfo.exists()) {
+        saveFile(fInfo.absoluteFilePath(), img, "", -1, threaded);
+        return fInfo.absoluteFilePath();
+    }
 
-	return QString();
+    return QString();
 }
 
-void DkImageLoader::saveFileWeb(const QImage& saveImg) {
-	
-	QWidget* dialogParent = DkUtils::getMainWindow();
-	QString saveName;
-	QFileInfo saveFileInfo;
+void DkImageLoader::saveFileWeb(const QImage &saveImg)
+{
+    QWidget *dialogParent = DkUtils::getMainWindow();
+    QString saveName;
+    QFileInfo saveFileInfo;
 
-	if (hasFile()) {
-		saveFileInfo = QFileInfo(getSavePath(), fileName());
-		qDebug() << "save path: " << saveFileInfo.absoluteFilePath();
-	}
-
-	bool imgHasAlpha = DkImage::alphaChannelUsed(saveImg);
+    if (hasFile()) {
+        saveFileInfo = QFileInfo(getSavePath(), fileName());
+        qDebug() << "save path: " << saveFileInfo.absoluteFilePath();
+    }
 
-	QString suffix = imgHasAlpha ? ".png" : ".jpg";
-	QString saveFilterGui;
+    bool imgHasAlpha = DkImage::alphaChannelUsed(saveImg);
 
-	for (int idx = 0; idx < DkSettingsManager::param().app().saveFilters.size(); idx++) {
+    QString suffix = imgHasAlpha ? ".png" : ".jpg";
+    QString saveFilterGui;
 
-		if (DkSettingsManager::param().app().saveFilters.at(idx).contains(suffix)) {
-			saveFilterGui = DkSettingsManager::param().app().saveFilters.at(idx);
-			break;
-		}
-	}
+    for (int idx = 0; idx < DkSettingsManager::param().app().saveFilters.size(); idx++) {
+        if (DkSettingsManager::param().app().saveFilters.at(idx).contains(suffix)) {
+            saveFilterGui = DkSettingsManager::param().app().saveFilters.at(idx);
+            break;
+        }
+    }
 
-	if (saveFileInfo.exists())
-		saveFileInfo = QFileInfo(saveFileInfo.absolutePath(), saveFileInfo.baseName() + suffix);
+    if (saveFileInfo.exists())
+        saveFileInfo = QFileInfo(saveFileInfo.absolutePath(), saveFileInfo.baseName() + suffix);
 
-	QString fileName = QFileDialog::getSaveFileName(
-		dialogParent, 
-		tr("Save File %1").arg(saveName),
-		saveFileInfo.absoluteFilePath(), 
-		saveFilterGui,
-		nullptr,
-		DkDialog::fileDialogOptions()
-	);
+    QString fileName = QFileDialog::getSaveFileName(dialogParent,
+                                                    tr("Save File %1").arg(saveName),
+                                                    saveFileInfo.absoluteFilePath(),
+                                                    saveFilterGui,
+                                                    nullptr,
+                                                    DkDialog::fileDialogOptions());
 
-	if (fileName.isEmpty())
-		return;
+    if (fileName.isEmpty())
+        return;
 
-	DkCompressDialog* jpgDialog = new DkCompressDialog(dialogParent);
-	jpgDialog->setDialogMode(DkCompressDialog::web_dialog);
-	jpgDialog->imageHasAlpha(imgHasAlpha);
-	jpgDialog->setImage(saveImg);
+    DkCompressDialog *jpgDialog = new DkCompressDialog(dialogParent);
+    jpgDialog->setDialogMode(DkCompressDialog::web_dialog);
+    jpgDialog->imageHasAlpha(imgHasAlpha);
+    jpgDialog->setImage(saveImg);
 
-	if (!jpgDialog->exec())
-		return;
+    if (!jpgDialog->exec())
+        return;
 
-	QImage rImg = saveImg;
-	float factor = jpgDialog->getResizeFactor();
-	if (factor != -1)
-		rImg = DkImage::resizeImage(rImg, QSize(), factor, DkImage::ipl_area);
+    QImage rImg = saveImg;
+    float factor = jpgDialog->getResizeFactor();
+    if (factor != -1)
+        rImg = DkImage::resizeImage(rImg, QSize(), factor, DkImage::ipl_area);
 
-	saveFile(fileName, rImg, suffix, jpgDialog->getCompression());
+    saveFile(fileName, rImg, suffix, jpgDialog->getCompression());
 
-	jpgDialog->deleteLater();
+    jpgDialog->deleteLater();
 }
 
-void DkImageLoader::copyUserFile() {
-    
-	// the subsequent modals destroy the active window
-    QWidget* dialogParent = DkUtils::getMainWindow();
-	QString saveName;
+void DkImageLoader::copyUserFile()
+{
+    // the subsequent modals destroy the active window
+    QWidget *dialogParent = DkUtils::getMainWindow();
+    QString saveName;
 
-	auto imgC = getCurrentImage();
+    auto imgC = getCurrentImage();
 
     if (hasFile() && imgC) {
-
         int filterIdx = -1;
 
-		QString extension = imgC->fileInfo().suffix();
+        QString extension = imgC->fileInfo().suffix();
 
-		// retrieve the extension name (that's more user friendly)
-		QStringList sF = DkSettingsManager::param().app().openFilters;
-		QRegExp exp = QRegExp("*." + extension + "*", Qt::CaseInsensitive);
-		exp.setPatternSyntax(QRegExp::Wildcard);
+        // retrieve the extension name (that's more user friendly)
+        QStringList sF = DkSettingsManager::param().app().openFilters;
+        QRegExp exp = QRegExp("*." + extension + "*", Qt::CaseInsensitive);
+        exp.setPatternSyntax(QRegExp::Wildcard);
 
-		for (int idx = 1; idx < sF.size(); idx++) {
-
-			if (exp.exactMatch(sF.at(idx))) {
-				extension = sF.at(idx);
-				filterIdx = idx;
-				break;
-			}
-		}
+        for (int idx = 1; idx < sF.size(); idx++) {
+            if (exp.exactMatch(sF.at(idx))) {
+                extension = sF.at(idx);
+                filterIdx = idx;
+                break;
+            }
+        }
 
-		QString saveName = QFileInfo(getCopyPath(), imgC->fileName()).absoluteFilePath();
+        QString saveName = QFileInfo(getCopyPath(), imgC->fileName()).absoluteFilePath();
 
-		saveName = QFileDialog::getSaveFileName(
-			dialogParent,
-			tr("Save File %1").arg(saveName),
-			saveName,
-			extension,
-			nullptr,
-			DkDialog::fileDialogOptions()
-		);
+        saveName = QFileDialog::getSaveFileName(dialogParent, tr("Save File %1").arg(saveName), saveName, extension, nullptr, DkDialog::fileDialogOptions());
 
         if (saveName.isEmpty())
-			return;
+            return;
 
-		qDebug() << fileName() << "->" << saveName;
+        qDebug() << fileName() << "->" << saveName;
 
-		if (QFile::copy(imgC->filePath(), saveName)) {
-			mCopyDir = QFileInfo(saveName).absolutePath();
+        if (QFile::copy(imgC->filePath(), saveName)) {
+            mCopyDir = QFileInfo(saveName).absolutePath();
             qInfo() << fileName() << "copied to" << saveName;
-        }
-		else {
+        } else {
             emit showInfoSignal(tr("Sorry, I could not copy the image..."));
         }
-		
     }
 }
 
-void DkImageLoader::saveUserFileAs(const QImage& saveImg, bool silent) {
-
-	// the subsequent modals destroy the active window
-	QWidget* dialogParent = DkUtils::getMainWindow();
-
-	QString selectedFilter;
-	QString saveName = fileName();
-	QFileInfo saveFileInfo;
+void DkImageLoader::saveUserFileAs(const QImage &saveImg, bool silent)
+{
+    // TODO glitch if (!mCurrentImage->getMetaData()->isLoaded()); see rotateImage()
 
-	if (hasFile()) {
+    // the subsequent modals destroy the active window
+    QWidget *dialogParent = DkUtils::getMainWindow();
 
-		saveFileInfo = QFileInfo(getSavePath(), fileName());
+    QString selectedFilter;
+    QString saveName = fileName();
+    QFileInfo saveFileInfo;
 
-		int filterIdx = -1;
+    if (hasFile()) {
+        saveFileInfo = QFileInfo(getSavePath(), fileName());
 
-		QStringList sF = DkSettingsManager::param().app().saveFilters;
-		//qDebug() << sF;
+        int filterIdx = -1;
 
-		QRegExp exp = QRegExp("*." + saveFileInfo.suffix() + "*", Qt::CaseInsensitive);
-		exp.setPatternSyntax(QRegExp::Wildcard);
+        QStringList sF = DkSettingsManager::param().app().saveFilters;
+        // qDebug() << sF;
 
-		for (int idx = 0; idx < sF.size(); idx++) {
+        QRegExp exp = QRegExp("*." + saveFileInfo.suffix() + "*", Qt::CaseInsensitive);
+        exp.setPatternSyntax(QRegExp::Wildcard);
 
-			if (exp.exactMatch(sF.at(idx))) {
-				selectedFilter = sF.at(idx);
-				filterIdx = idx;
-				break;
-			}
-		}
+        for (int idx = 0; idx < sF.size(); idx++) {
+            if (exp.exactMatch(sF.at(idx))) {
+                selectedFilter = sF.at(idx);
+                filterIdx = idx;
+                break;
+            }
+        }
 
-		if (filterIdx == -1)
-			saveName.remove("." + saveFileInfo.suffix());
-	}
+        if (filterIdx == -1)
+            saveName.remove("." + saveFileInfo.suffix());
+    }
 
-	QString fileName;
+    QString fileName;
 
-	int answer = QDialog::Rejected;
+    int answer = QDialog::Rejected;
 
-	// don't ask the user if save was hit & the file format is supported for saving
-	if (silent && !selectedFilter.isEmpty() && isEdited()) {
-		fileName = filePath();
-		DkMessageBox* msg = new DkMessageBox(QMessageBox::Question, tr("Overwrite File"), 
-			tr("Do you want to overwrite:\n%1?").arg(fileName), 
-			(QMessageBox::Yes | QMessageBox::No), dialogParent);
-		msg->setObjectName("overwriteDialog");
+    // don't ask the user if save was hit & the file format is supported for saving
+    if (silent && !selectedFilter.isEmpty() && isEdited()) {
+        fileName = filePath();
+        DkMessageBox *msg = new DkMessageBox(QMessageBox::Question,
+                                             tr("Overwrite File"),
+                                             tr("Do you want to overwrite:\n%1?").arg(fileName),
+                                             (QMessageBox::Yes | QMessageBox::No),
+                                             dialogParent);
+        msg->setObjectName("overwriteDialog");
 
-		answer = msg->exec();
+        answer = msg->exec();
+    }
+    if (answer == QDialog::Rejected || answer == QMessageBox::No) {
+        // note: basename removes the whole file name from the first dot...
+        QString savePath = (!selectedFilter.isEmpty()) ? saveFileInfo.absoluteFilePath() : QFileInfo(saveFileInfo.absoluteDir(), saveName).absoluteFilePath();
+
+        fileName = QFileDialog::getSaveFileName(dialogParent,
+                                                tr("Save File %1").arg(saveName),
+                                                savePath,
+                                                DkSettingsManager::param().app().saveFilters.join(";;"),
+                                                &selectedFilter,
+                                                DkDialog::fileDialogOptions());
+    }
 
-	}
-	if (answer == QDialog::Rejected || answer == QMessageBox::No) {
-		// note: basename removes the whole file name from the first dot...
-		QString savePath = (!selectedFilter.isEmpty()) ? saveFileInfo.absoluteFilePath() : QFileInfo(saveFileInfo.absoluteDir(), saveName).absoluteFilePath();
+    if (fileName.isEmpty())
+        return;
 
-		fileName = QFileDialog::getSaveFileName(
-			dialogParent, 
-			tr("Save File %1").arg(saveName),
-			savePath, 
-			DkSettingsManager::param().app().saveFilters.join(";;"), 
-			&selectedFilter,
-			DkDialog::fileDialogOptions()
-		);
-	}
+    QString ext = QFileInfo(fileName).suffix();
 
-	if (fileName.isEmpty())
-		return;
+    if (!ext.isEmpty() && !selectedFilter.contains(ext)) {
+        QStringList sF = DkSettingsManager::param().app().saveFilters;
 
-	QString ext = QFileInfo(fileName).suffix();
+        for (int idx = 0; idx < sF.size(); idx++) {
+            if (sF.at(idx).contains(ext)) {
+                selectedFilter = sF.at(idx);
+                break;
+            }
+        }
+    }
 
-	if (!ext.isEmpty() && !selectedFilter.contains(ext)) {
+    QFileInfo sFile = QFileInfo(fileName);
+    int compression = -1; // default value
+
+    // Save only metadata if image itself hasn't been edited (after exif rotation)
+    bool sameFile = fileName == filePath();
+    bool imgEdited = mCurrentImage->getLoader()->isImageEdited();
+    bool metaEdited = mCurrentImage->getLoader()->isMetaDataEdited();
+    if (!imgEdited && metaEdited && sameFile) {
+        // Save metadata only
+        mCurrentImage->saveMetaData(); // DkBasicLoader::saveMetaData() (otherwise called after saving)
+
+        // Notify listeners about saved image
+        setCurrentImage(mCurrentImage);
+        mCurrentImage->setEdited(false);
+        emit imageLoadedSignal(mCurrentImage, true);
+        emit imageUpdatedSignal(mCurrentImage);
+
+        // Skip the rest which is only relevant when re-encoding/saving the image
+        return;
+    }
+    // Saving image normally, clear exif rotation flag to prevent double rotation
+    mCurrentImage->getLoader()->getMetaData()->clearOrientation();
+    // Below are the compress/encode routines; at the end of a long call chain (saveIntern internSave Threaded)
+    // saveToBuffer() is responsible for adding the exif data to the image buffer soup
+    // which is then written to the specified file.
 
-		QStringList sF = DkSettingsManager::param().app().saveFilters;
+    DkCompressDialog *jpgDialog = 0;
+    QImage lSaveImg = saveImg;
 
-		for (int idx = 0; idx < sF.size(); idx++) {
+    DkTifDialog *tifDialog = 0;
 
-			if (sF.at(idx).contains(ext)) {
-				selectedFilter = sF.at(idx);
-				break;
-			}
-		}
-	}
+    if (selectedFilter.contains("jxl")) {
+        // jxl has to be before old jpeg to avoid triggering jpg_dialog for .JXL format
+        if (!jpgDialog)
+            jpgDialog = new DkCompressDialog(dialogParent);
 
-	QFileInfo sFile = QFileInfo(fileName);
-	int compression = -1;	// default value
+        jpgDialog->setDialogMode(DkCompressDialog::jxl_dialog);
+        jpgDialog->setImage(saveImg);
 
-	DkCompressDialog* jpgDialog = 0;
-	QImage lSaveImg = saveImg;
+        if (!jpgDialog->exec()) {
+            jpgDialog->deleteLater();
+            return;
+        }
 
-	if (selectedFilter.contains(QRegExp("(jpg|jpeg|j2k|jp2|jpf|jpx)", Qt::CaseInsensitive))) {
-		
-		if (!jpgDialog)
-			jpgDialog = new DkCompressDialog(dialogParent);
+        compression = jpgDialog->getCompression();
 
-		if (selectedFilter.contains(QRegExp("(j2k|jp2|jpf|jpx)")))
-			jpgDialog->setDialogMode(DkCompressDialog::j2k_dialog);
-		else
-			jpgDialog->setDialogMode(DkCompressDialog::jpg_dialog);
+    } else if (selectedFilter.contains(QRegExp("(j2k|jp2|jpf|jpx)", Qt::CaseInsensitive))) {
+        if (!jpgDialog)
+            jpgDialog = new DkCompressDialog(dialogParent);
 
-		jpgDialog->imageHasAlpha(saveImg.hasAlphaChannel());
-		jpgDialog->setImage(saveImg);
-		jpgDialog->setMinimumSize(450, 150);
+        jpgDialog->setDialogMode(DkCompressDialog::j2k_dialog);
 
-		if (!jpgDialog->exec()) {
-			jpgDialog->deleteLater();
-			return;
-		}
+        jpgDialog->setImage(saveImg);
+        jpgDialog->setMinimumSize(450, 150);
 
-		compression = jpgDialog->getCompression();
+        if (!jpgDialog->exec()) {
+            jpgDialog->deleteLater();
+            return;
+        }
 
-		if (saveImg.hasAlphaChannel()) {
+        compression = jpgDialog->getCompression();
 
-			QRect imgRect = QRect(QPoint(), saveImg.size());
-			QImage tmpImg = QImage(saveImg.size(), QImage::Format_RGB32);
-			QPainter painter(&tmpImg);
-			painter.fillRect(imgRect, jpgDialog->getBackgroundColor());
-			painter.drawImage(imgRect, saveImg, imgRect);
+    } else if (selectedFilter.contains(QRegExp("(jpg|jpeg)", Qt::CaseInsensitive))) {
+        if (!jpgDialog)
+            jpgDialog = new DkCompressDialog(dialogParent);
 
-			lSaveImg = tmpImg;
-		}
-	}
+        jpgDialog->setDialogMode(DkCompressDialog::jpg_dialog);
 
-	if (selectedFilter.contains("webp")) {
+        jpgDialog->imageHasAlpha(saveImg.hasAlphaChannel());
+        jpgDialog->setImage(saveImg);
+        jpgDialog->setMinimumSize(450, 150);
 
-		if (!jpgDialog)
-			jpgDialog = new DkCompressDialog(dialogParent);
+        if (!jpgDialog->exec()) {
+            jpgDialog->deleteLater();
+            return;
+        }
 
-		jpgDialog->setDialogMode(DkCompressDialog::webp_dialog);
-		jpgDialog->setImage(saveImg);
+        compression = jpgDialog->getCompression();
 
-		if (!jpgDialog->exec()) {
-			jpgDialog->deleteLater();
-			return;
-		}
+        if (saveImg.hasAlphaChannel()) {
+            QRect imgRect = QRect(QPoint(), saveImg.size());
+            QImage tmpImg = QImage(saveImg.size(), QImage::Format_RGB32);
+            QPainter painter(&tmpImg);
+            painter.fillRect(imgRect, jpgDialog->getBackgroundColor());
+            painter.drawImage(imgRect, saveImg, imgRect);
 
-		compression = jpgDialog->getCompression();
-	}
+            lSaveImg = tmpImg;
+        }
 
-	if (selectedFilter.contains("avif")) {
+    } else if (selectedFilter.contains("webp")) {
+        if (!jpgDialog)
+            jpgDialog = new DkCompressDialog(dialogParent);
 
-		if (!jpgDialog)
-			jpgDialog = new DkCompressDialog(dialogParent);
+        jpgDialog->setDialogMode(DkCompressDialog::webp_dialog);
+        jpgDialog->setImage(saveImg);
 
-		jpgDialog->setDialogMode(DkCompressDialog::avif_dialog);
-		jpgDialog->setImage(saveImg);
+        if (!jpgDialog->exec()) {
+            jpgDialog->deleteLater();
+            return;
+        }
 
-		if (!jpgDialog->exec()) {
-			jpgDialog->deleteLater();
-			return;
-		}
+        compression = jpgDialog->getCompression();
 
-		compression = jpgDialog->getCompression();
-	}
+    } else if (selectedFilter.contains("avif")) {
+        if (!jpgDialog)
+            jpgDialog = new DkCompressDialog(dialogParent);
 
-	DkTifDialog* tifDialog = 0;
+        jpgDialog->setDialogMode(DkCompressDialog::avif_dialog);
+        jpgDialog->setImage(saveImg);
 
-	if (selectedFilter.contains("tif")) {
+        if (!jpgDialog->exec()) {
+            jpgDialog->deleteLater();
+            return;
+        }
 
-		if (!tifDialog)
-			tifDialog = new DkTifDialog(dialogParent);
+        compression = jpgDialog->getCompression();
 
-		if (!tifDialog->exec()) {
-			tifDialog->deleteLater();
-			return;
-		}
+    } else if (selectedFilter.contains("tif")) {
+        if (!tifDialog)
+            tifDialog = new DkTifDialog(dialogParent);
 
-		compression = tifDialog->getCompression();
-	}
+        if (!tifDialog->exec()) {
+            tifDialog->deleteLater();
+            return;
+        }
 
-	saveFile(sFile.absoluteFilePath(), lSaveImg, selectedFilter, compression);
+        compression = tifDialog->getCompression();
+    }
 
-	if (tifDialog)
-		tifDialog->deleteLater();
-	if (jpgDialog)
-		jpgDialog->deleteLater();
+    saveFile(sFile.absoluteFilePath(), lSaveImg, selectedFilter, compression);
 
+    if (tifDialog)
+        tifDialog->deleteLater();
+    if (jpgDialog)
+        jpgDialog->deleteLater();
 }
 
 /**
@@ -1326,211 +1327,212 @@ void DkImageLoader::saveUserFileAs(const QImage& saveImg, bool silent) {
  * @param fileFilter the file extension (e.g. *.jpg)
  * @param saveImg the image to be saved
  * @param compression the compression method (for jpg, tif)
- **/ 
-void DkImageLoader::saveFile(const QString& filePath, const QImage& saveImg, const QString& fileFilter, int compression, bool threaded) {
-	
-	QSharedPointer<DkImageContainerT> imgC = (mCurrentImage) ? mCurrentImage : findOrCreateFile(filePath);
-	setCurrentImage(imgC);
-
-	if (saveImg.isNull() && (!mCurrentImage || !mCurrentImage->hasImage()))
-		emit showInfoSignal(tr("Sorry, I cannot save an empty image..."));
-
-	// if the user did not specify the suffix - append the suffix of the file filter
-	QString newSuffix = QFileInfo(filePath).suffix();
-	QString lFilePath = filePath;
-	if (newSuffix == "") {
-		
-		QString lFileFilter = fileFilter;
-		newSuffix = lFileFilter.remove(0, fileFilter.indexOf("."));
-		printf("new suffix: %s\n", newSuffix.toStdString().c_str());
-
-		int endSuffix = -1;
-		if (newSuffix.indexOf(")") == -1)
-			endSuffix =  newSuffix.indexOf(" ");
-		else if (newSuffix.indexOf(" ") == -1)
-			endSuffix =  newSuffix.indexOf(")");
-		else
-			endSuffix = qMin(newSuffix.indexOf(")"), newSuffix.indexOf(" "));
-
-		lFilePath.append(newSuffix.left(endSuffix));
-	}
-
-	emit updateSpinnerSignalDelayed(true);
-	QImage sImg = (saveImg.isNull()) ? imgC->image() : saveImg;
-
-	mDirWatcher->blockSignals(true);
-	bool saveStarted = (threaded) ? imgC->saveImageThreaded(lFilePath, sImg, compression) : imgC->saveImage(lFilePath, sImg, compression);
-
-	if (!saveStarted) {
-		imageSaved(QString(), false);
-	}
-	else if (saveStarted && !threaded) {
-		imageSaved(lFilePath);
-	}
-}
-
-void DkImageLoader::imageSaved(const QString& filePath, bool saved, bool loadToTab) {
-
-	emit updateSpinnerSignalDelayed(false);
-	mDirWatcher->blockSignals(false);
-
-	QFileInfo fInfo(filePath);
-	if (!fInfo.exists() || !fInfo.isFile() || !saved)
-		return;
-
-	if (DkSettingsManager::instance().param().resources().loadSavedImage == DkSettings::ls_load_to_tab && loadToTab) {
-		emit loadImageToTab(filePath);
-	}
-	else if (DkSettingsManager::instance().param().resources().loadSavedImage == DkSettings::ls_load) {
-		emit imageLoadedSignal(mCurrentImage, true);
-		emit imageUpdatedSignal(mCurrentImage);
-		qDebug() << "image updated: " << mCurrentImage->fileName();
-	}
-	else {
-		mFolderUpdated = true;
-		loadDir(mCurrentImage->dirPath());
-	}
+ **/
+void DkImageLoader::saveFile(const QString &filePath, const QImage &saveImg, const QString &fileFilter, int compression, bool threaded)
+{
+    QSharedPointer<DkImageContainerT> imgC = (mCurrentImage) ? mCurrentImage : findOrCreateFile(filePath);
+    setCurrentImage(imgC);
+
+    if (saveImg.isNull() && (!mCurrentImage || !mCurrentImage->hasImage()))
+        emit showInfoSignal(tr("Sorry, I cannot save an empty image..."));
+
+    // if the user did not specify the suffix - append the suffix of the file filter
+    QString newSuffix = QFileInfo(filePath).suffix();
+    QString lFilePath = filePath;
+    if (newSuffix == "") {
+        QString lFileFilter = fileFilter;
+        newSuffix = lFileFilter.remove(0, fileFilter.indexOf("."));
+        printf("new suffix: %s\n", newSuffix.toStdString().c_str());
+
+        int endSuffix = -1;
+        if (newSuffix.indexOf(")") == -1)
+            endSuffix = newSuffix.indexOf(" ");
+        else if (newSuffix.indexOf(" ") == -1)
+            endSuffix = newSuffix.indexOf(")");
+        else
+            endSuffix = qMin(newSuffix.indexOf(")"), newSuffix.indexOf(" "));
+
+        lFilePath.append(newSuffix.left(endSuffix));
+    }
+
+    emit updateSpinnerSignalDelayed(true);
+    QImage sImg = (saveImg.isNull()) ? imgC->image() : saveImg;
+
+    mDirWatcher->blockSignals(true);
+    bool saveStarted = (threaded) ? imgC->saveImageThreaded(lFilePath, sImg, compression) : imgC->saveImage(lFilePath, sImg, compression);
+
+    if (!saveStarted) {
+        imageSaved(QString(), false);
+    } else if (saveStarted && !threaded) {
+        imageSaved(lFilePath);
+    }
+}
+
+void DkImageLoader::imageSaved(const QString &filePath, bool saved, bool loadToTab)
+{
+    emit updateSpinnerSignalDelayed(false);
+    mDirWatcher->blockSignals(false);
+
+    QFileInfo fInfo(filePath);
+    if (!fInfo.exists() || !fInfo.isFile() || !saved)
+        return;
+
+    if (DkSettingsManager::instance().param().resources().loadSavedImage == DkSettings::ls_load_to_tab && loadToTab) {
+        emit loadImageToTab(filePath);
+    } else if (DkSettingsManager::instance().param().resources().loadSavedImage == DkSettings::ls_load) {
+        emit imageLoadedSignal(mCurrentImage, true);
+        emit imageUpdatedSignal(mCurrentImage);
+        qDebug() << "image updated: " << mCurrentImage->fileName();
+    } else {
+        mFolderUpdated = true;
+        loadDir(mCurrentImage->dirPath());
+    }
 }
 
 /**
  * Updates the file history.
  * The file history stores the last 10 folders.
- **/ 
-void DkImageLoader::updateHistory() {
-
-	if (!DkSettingsManager::param().global().logRecentFiles || DkSettingsManager::param().app().privateMode)
-		return;
-
-	if (!mCurrentImage || mCurrentImage->hasImage() != DkImageContainer::loaded || !mCurrentImage->exists())
-		return;
+ **/
+void DkImageLoader::updateHistory()
+{
+    if (!DkSettingsManager::param().global().logRecentFiles || DkSettingsManager::param().app().privateMode)
+        return;
 
-	QFileInfo file = mCurrentImage->filePath();
+    if (!mCurrentImage || mCurrentImage->hasImage() != DkImageContainer::loaded || !mCurrentImage->exists())
+        return;
 
-	// sync with other instances
-	DefaultSettings settings;
-	settings.beginGroup("GlobalSettings");
-	QStringList rFolders = settings.value("recentFolders", DkSettingsManager::param().global().recentFolders).toStringList();
-	QStringList rFiles = settings.value("recentFiles", DkSettingsManager::param().global().recentFiles).toStringList();
-	settings.endGroup();
+    QFileInfo file = mCurrentImage->filePath();
 
-	rFiles.removeAll(file.absoluteFilePath());
-	rFolders.removeAll(file.absolutePath());
+    // sync with other instances
+    DefaultSettings settings;
+    settings.beginGroup("GlobalSettings");
+    QStringList rFolders = settings.value("recentFolders", DkSettingsManager::param().global().recentFolders).toStringList();
+    QStringList rFiles = settings.value("recentFiles", DkSettingsManager::param().global().recentFiles).toStringList();
+    settings.endGroup();
 
-	QStringList tmpRecentFiles;
+    rFiles.removeAll(file.absoluteFilePath());
+    rFolders.removeAll(file.absolutePath());
 
-	// try to collect images from different folders
-	for (const QString& cFile : DkSettingsManager::param().global().recentFiles) {
-		
-		QFileInfo fi(cFile);
+    QStringList tmpRecentFiles;
 
-		if (fi.absolutePath() == file.absolutePath())
-			tmpRecentFiles.append(cFile);
-	}
+    // try to collect images from different folders
+    for (const QString &cFile : DkSettingsManager::param().global().recentFiles) {
+        QFileInfo fi(cFile);
 
-	// maximum 5 most recent images from the same folder
-	for (int idx = tmpRecentFiles.size()-1; idx > 3; idx--) {
-		rFiles.removeAll(tmpRecentFiles.at(idx));
-	}
+        if (fi.absolutePath() == file.absolutePath())
+            tmpRecentFiles.append(cFile);
+    }
 
-	rFiles.push_front(file.absoluteFilePath());
-	rFolders.push_front(file.absolutePath());
+    // maximum 5 most recent images from the same folder
+    for (int idx = tmpRecentFiles.size() - 1; idx > 3; idx--) {
+        rFiles.removeAll(tmpRecentFiles.at(idx));
+    }
 
-	rFiles.removeDuplicates();
-	rFolders.removeDuplicates();
+    rFiles.push_front(file.absoluteFilePath());
+    rFolders.push_front(file.absolutePath());
 
-	for (int idx = 0; idx < rFiles.size()-DkSettingsManager::param().global().numFiles-10; idx++)
-		rFiles.pop_back();
+    rFiles.removeDuplicates();
+    rFolders.removeDuplicates();
 
-	for (int idx = 0; idx < rFolders.size()-DkSettingsManager::param().global().numFiles-10; idx++)
-		rFolders.pop_back();
+    for (int idx = 0; idx < rFiles.size() - DkSettingsManager::param().global().numFiles - 10; idx++)
+        rFiles.pop_back();
 
-	// sync with other instances
-	settings.beginGroup("GlobalSettings");
-	settings.setValue("recentFolders", rFolders);
-	settings.setValue("recentFiles", rFiles);
-	settings.endGroup();
+    for (int idx = 0; idx < rFolders.size() - DkSettingsManager::param().global().numFiles - 10; idx++)
+        rFolders.pop_back();
 
-	// update
-	DkSettingsManager::param().global().lastDir = file.absolutePath();
-	DkSettingsManager::param().global().recentFiles = rFiles;
-	DkSettingsManager::param().global().recentFolders = rFolders;
+    // sync with other instances
+    settings.beginGroup("GlobalSettings");
+    settings.setValue("recentFolders", rFolders);
+    settings.setValue("recentFiles", rFiles);
+    settings.endGroup();
 
+    // update
+    DkSettingsManager::param().global().lastDir = file.absolutePath();
+    DkSettingsManager::param().global().recentFiles = rFiles;
+    DkSettingsManager::param().global().recentFolders = rFolders;
 
-	//DkSettings s = DkSettings();
-	//s.save();
+    // DkSettings s = DkSettings();
+    // s.save();
 }
 
 // image manipulation --------------------------------------------------------------------
 /**
  * Deletes the currently loaded file.
- **/ 
-bool DkImageLoader::deleteFile() {
-	
-	if (mCurrentImage && mCurrentImage->exists()) {
-
-		QString fileName = mCurrentImage->fileName();
-
-		if (DkUtils::moveToTrash(mCurrentImage->filePath())) {
-			QSharedPointer<DkImageContainerT> imgC = getSkippedImage(1);
-			load(imgC);
-			emit showInfoSignal(tr("%1 deleted...").arg(fileName));
-			return true;
-		}
-		else
-			emit showInfoSignal(tr("Sorry, I could not delete: %1").arg(fileName));
-	}
+ **/
+bool DkImageLoader::deleteFile()
+{
+    if (mCurrentImage && mCurrentImage->exists()) {
+        QString fileName = mCurrentImage->fileName();
+
+        if (DkUtils::moveToTrash(mCurrentImage->filePath())) {
+            QSharedPointer<DkImageContainerT> imgC = getSkippedImage(1);
+            load(imgC);
+            emit showInfoSignal(tr("%1 deleted...").arg(fileName));
+            return true;
+        } else
+            emit showInfoSignal(tr("Sorry, I could not delete: %1").arg(fileName));
+    }
 
-	return false;
+    return false;
 }
 
 /**
- * Rotates the image.
- * First, we try to set the rotation flag in the metadata
- * (this is the fastest way to rotate an image).
- * If this does not work, the image matrix is rotated.
+ * @brief rotates the image.
+ *
+ * First, we try to set the rotation flag in the metadata.
+ * That wouldn't work if the image has no meta data, like a bmp file for example.
+ * Then, the image matrix is rotated.
+ *
  * @param angle the rotation angle in degree.
- **/ 
-void DkImageLoader::rotateImage(double angle) {
-
-	qDebug() << "rotating image...";
-
-	if (!mCurrentImage || !mCurrentImage->hasImage()) {
-		qDebug() << "sorry, loader has no image";
-		return;
-	}
-
-	QImage img = DkImage::rotate(mCurrentImage->image(), qRound(angle));
-
-	QImage thumb = DkImage::createThumb(mCurrentImage->image());
-	mCurrentImage->getThumb()->setImage(thumb);
+ **/
+void DkImageLoader::rotateImage(double angle)
+{
+    qDebug() << "rotating image...";
 
-	QSharedPointer<DkMetaDataT> metaData = mCurrentImage->getMetaData();
-	bool metaDataSet = false;
+    if (!mCurrentImage || !mCurrentImage->hasImage()) {
+        qDebug() << "sorry, loader has no image";
+        return;
+    }
 
-	if (metaData->hasMetaData() && DkSettingsManager::param().metaData().saveExifOrientation) {
-		try {
-			if (!metaData->isJpg())
-				metaData->setThumbnail(thumb);
-			metaData->setOrientation(qRound(angle));
-			metaDataSet = true;
+    QImage img = DkImage::rotateImage(mCurrentImage->pixmap(), qRound(angle));
 
-			// if that is working out, we need to set the image without changing the history
-			QVector<DkEditImage>* imgs = mCurrentImage->getLoader()->history();
+    QImage thumb = DkImage::createThumb(mCurrentImage->pixmap());
+    mCurrentImage->getThumb()->setImage(thumb);
 
-			if (!imgs->isEmpty()) {
-				imgs->last().setImage(img);
-			}
+    QSharedPointer<DkMetaDataT> metaData = mCurrentImage->getMetaData(); // via ImageContainer, BasicLoader
+    bool metaDataSet = false;
 
-		}
-		catch (...) {
-		}
-	}
+    if (metaData->hasMetaData() && DkSettingsManager::param().metaData().saveExifOrientation) {
+        try {
+            // Set orientation in exif data
+            if (!metaData->isJpg())
+                metaData->setThumbnail(thumb);
+            metaData->setOrientation(qRound(angle));
+            metaDataSet = true;
 
-	if (!metaDataSet) {
-		setImage(img, tr("Rotated"), mCurrentImage->filePath());
-	}
+        } catch (...) {
+        }
+    }
 
-	emit imageUpdatedSignal(mCurrentImage);
+    if (metaDataSet) {
+        // Add history item with edited metadata (exif rotation)
+        mCurrentImage->setMetaData(metaData, img, tr("Rotated")); // new edit with modified metadata
+        setImageUpdated();
+    } else {
+        // Update the image itself, along with the history and everything
+        // In other words, the rotated image is saved to the history and the edit flag is set
+        // the exif rotation flag will be reset when adding the new image to the history (BasicLoader)
+        mCurrentImage->setImage(img, tr("Rotated")); // new edit with rotated pixmap (clears orientation)
+        setImageUpdated();
+        // TODO There's a glitch when rotating/changing the image after switching back from settings
+        // which causes the containers to be reloaded. If we call the local setImage() overload,
+        // the metadata object will be reset causing the image to be saved without modified metadata on Save.
+        // With the call above, no metadata is lost, but when navigating away, confirming save on unload
+        // and navigating back, the previous image may still appear (loaded while/before async save).
+        // TODO a) prevent metadata reset without also resetting the gui; b) send signal after save
+        // to reload the saved image (in the other container); c) don't load x while saving x ...
+        // [2022-09, pse]
+    }
 }
 
 /**
@@ -1540,325 +1542,317 @@ void DkImageLoader::rotateImage(double angle) {
  * This function restores these files.
  * @param fileInfo the file to be restored.
  * @return bool true if the file could be restored.
- **/ 
-bool DkImageLoader::restoreFile(const QString& filePath) {
-
-	QFileInfo fInfo(filePath);
-	QStringList files = fInfo.dir().entryList();
-	QString fileName = fInfo.fileName();
-	QRegExp filePattern(fileName + "[0-9]+");
-	QString backupFileName;
-
-	// if exif crashed it saved a backup file with the format: filename.png1232
-	for (int idx = 0; idx < files.size(); idx++) {
-
-		if (filePattern.exactMatch(files[idx])) {
-			backupFileName = files[idx];
-			break;
-		}
-	}
-
-	if (backupFileName.isEmpty()) {
-		qDebug() << "I could not locate the backup file...";
-		return true;
-	}
-
-	// delete the destroyed file
-	QFile file(filePath);
-	QFile backupFile(fInfo.absolutePath() + QDir::separator() + backupFileName);
-
-	if (file.size() == 0 || file.size() <= backupFile.size()) {
-		
-		if (!file.remove()) {
-
-			// ok I did not destroy the original file - so delete the back-up
-			// -> this reverts the file - but otherwise we spam to the disk 
-			// actions reverted here include meta data saving
-			if (file.size() != 0)
-				return backupFile.remove();
-
-			qDebug() << "I could not remove the file...";
-			return false;
-		}
-	}
-	else {
-		
-		qDebug() << "non-empty file: " << fileName << " I won't delete it...";
-		qDebug() << "file size: " << file.size() << " back-up file size: " << backupFile.size();
-		return false;
-	}
-
-	// now 
-	return backupFile.rename(fInfo.absoluteFilePath());
-}
+ **/
+bool DkImageLoader::restoreFile(const QString &filePath)
+{
+    QFileInfo fInfo(filePath);
+    QStringList files = fInfo.dir().entryList();
+    QString fileName = fInfo.fileName();
+    QRegExp filePattern(fileName + "[0-9]+");
+    QString backupFileName;
+
+    // if exif crashed it saved a backup file with the format: filename.png1232
+    for (int idx = 0; idx < files.size(); idx++) {
+        if (filePattern.exactMatch(files[idx])) {
+            backupFileName = files[idx];
+            break;
+        }
+    }
 
-/**
- * Reloads the file index if the directory was edited.
- * @param path the path to the current directory
- **/ 
-void DkImageLoader::directoryChanged(const QString& path) {
+    if (backupFileName.isEmpty()) {
+        qDebug() << "I could not locate the backup file...";
+        return true;
+    }
 
-	if (path.isEmpty() || path == mCurrentDir) {
+    // delete the destroyed file
+    QFile file(filePath);
+    QFile backupFile(fInfo.absolutePath() + QDir::separator() + backupFileName);
 
-		mFolderUpdated = true;
-		
-		// guarantee, that only every XX seconds a folder update occurs
-		// think of a folder where 100s of files are written to...
-		// as this could be pretty fast, the thumbsloader (& whoever) would create a 
-		// greater offset and slow down the system
-		if ((path.isEmpty() && mTimerBlockedUpdate) || (!path.isEmpty() && !mDelayedUpdateTimer.isActive())) {
+    if (file.size() == 0 || file.size() <= backupFile.size()) {
+        if (!file.remove()) {
+            // ok I did not destroy the original file - so delete the back-up
+            // -> this reverts the file - but otherwise we spam to the disk
+            // actions reverted here include meta data saving
+            if (file.size() != 0)
+                return backupFile.remove();
 
-			loadDir(mCurrentDir, false);
-			mTimerBlockedUpdate = false;
+            qDebug() << "I could not remove the file...";
+            return false;
+        }
+    } else {
+        qDebug() << "non-empty file: " << fileName << " I won't delete it...";
+        qDebug() << "file size: " << file.size() << " back-up file size: " << backupFile.size();
+        return false;
+    }
 
-			if (!path.isEmpty())
-				mDelayedUpdateTimer.start(1000);
-		}
-		else
-			mTimerBlockedUpdate = true;
-	}
-	
+    // now
+    return backupFile.rename(fInfo.absoluteFilePath());
+}
+
+/**
+ * Reloads the file index if the directory was edited.
+ * @param path the path to the current directory
+ **/
+void DkImageLoader::directoryChanged(const QString &path)
+{
+    if (path.isEmpty() || path == mCurrentDir) {
+        mFolderUpdated = true;
+
+        // guarantee, that only every XX seconds a folder update occurs
+        // think of a folder where 100s of files are written to...
+        // as this could be pretty fast, the thumbsloader (& whoever) would create a
+        // greater offset and slow down the system
+        if ((path.isEmpty() && mTimerBlockedUpdate) || (!path.isEmpty() && !mDelayedUpdateTimer.isActive())) {
+            loadDir(mCurrentDir, false);
+            mTimerBlockedUpdate = false;
+
+            if (!path.isEmpty())
+                mDelayedUpdateTimer.start(1000);
+        } else
+            mTimerBlockedUpdate = true;
+    }
 }
 
 /**
  * Returns true if a file was specified.
  * @return bool true if a file name/path was specified
- **/ 
-bool DkImageLoader::hasFile() const {
-
-	return mCurrentImage && mCurrentImage->exists();
+ **/
+bool DkImageLoader::hasFile() const
+{
+    return mCurrentImage && mCurrentImage->exists();
 }
 
-bool DkImageLoader::hasMovie() const {
+bool DkImageLoader::hasMovie() const
+{
+    if (!mCurrentImage || !mCurrentImage->exists())
+        return false;
 
-	if (!mCurrentImage || !mCurrentImage->exists())
-		return false;
-
-	return mCurrentImage->hasMovie();
+    return mCurrentImage->hasMovie();
 }
 
-bool DkImageLoader::hasSvg() const {
-
-	if (!mCurrentImage || !mCurrentImage->exists())
-		return false;
+bool DkImageLoader::hasSvg() const
+{
+    if (!mCurrentImage || !mCurrentImage->exists())
+        return false;
 
-	return mCurrentImage->hasSvg();
+    return mCurrentImage->hasSvg();
 }
 
 /**
  * Returns the currently loaded file information.
  * @return QFileInfo the current file info
- **/ 
-QString DkImageLoader::filePath() const {
-
-	if (!mCurrentImage)
-		return QString();
+ **/
+QString DkImageLoader::filePath() const
+{
+    if (!mCurrentImage)
+        return QString();
 
-	
-	return mCurrentImage->filePath();
+    return mCurrentImage->filePath();
 }
 
-QSharedPointer<DkImageContainerT> DkImageLoader::getCurrentImage() const {
-
-	return mCurrentImage;
+QSharedPointer<DkImageContainerT> DkImageLoader::getCurrentImage() const
+{
+    return mCurrentImage;
 }
 
-QSharedPointer<DkImageContainerT> DkImageLoader::getLastImage() const {
-
-	return mLastImageLoaded;
+QSharedPointer<DkImageContainerT> DkImageLoader::getLastImage() const
+{
+    return mLastImageLoaded;
 }
 
 /**
  * Returns the currently loaded directory.
  * @return QDir the currently loaded directory.
- **/ 
-QString DkImageLoader::getDirPath() const {
-
-	return mCurrentDir;
+ **/
+QString DkImageLoader::getDirPath() const
+{
+    return mCurrentDir;
 }
 
-QStringList DkImageLoader::getFoldersRecursive(const QString& dirPath) {
+QStringList DkImageLoader::getFoldersRecursive(const QString &dirPath)
+{
+    // DkTimer dt;
+    QStringList subFolders;
+    // qDebug() << "scanning recursively: " << dir.absolutePath();
+
+    if (DkSettingsManager::param().global().scanSubFolders) {
+        QDirIterator dirs(dirPath, QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks, QDirIterator::Subdirectories);
 
-	//DkTimer dt;
-	QStringList subFolders;
-	//qDebug() << "scanning recursively: " << dir.absolutePath();
+        int nFolders = 0;
+        while (dirs.hasNext()) {
+            dirs.next();
+            subFolders << dirs.filePath();
+            nFolders++;
 
-	if (DkSettingsManager::param().global().scanSubFolders) {
+            if (nFolders > 100)
+                break;
 
-		QDirIterator dirs(dirPath, QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks, QDirIterator::Subdirectories);
-	
-		int nFolders = 0;
-		while (dirs.hasNext()) {
-			dirs.next();
-			subFolders << dirs.filePath();
-			nFolders++;
+            // getFoldersRecursive(dirs.filePath(), subFolders);
+            // qDebug() << "loop: " << dirs.filePath();
+        }
+    }
 
-			if (nFolders > 100)
-				break;
-			
-			//getFoldersRecursive(dirs.filePath(), subFolders);
-			//qDebug() << "loop: " << dirs.filePath();
-		}
-	}	
+    subFolders << dirPath;
 
-	subFolders << dirPath;
+    std::sort(subFolders.begin(), subFolders.end(), DkUtils::compLogicQString);
 
-	qSort(subFolders.begin(), subFolders.end(), DkUtils::compLogicQString);
+    qDebug() << dirPath << "loaded recursively...";
 
-	qDebug() << dirPath << "loaded recursively...";
-	
-	//qDebug() << "scanning folders recursively took me: " << QString::fromStdString(dt.getTotal());
-	return subFolders;
+    // qDebug() << "scanning folders recursively took me: " << QString::fromStdString(dt.getTotal());
+    return subFolders;
 }
 
-QFileInfoList DkImageLoader::updateSubFolders(const QString& rootDirPath) {
-	
-	mSubFolders = getFoldersRecursive(rootDirPath);
-	QFileInfoList files;
-	qDebug() << mSubFolders;
+QFileInfoList DkImageLoader::updateSubFolders(const QString &rootDirPath)
+{
+    mSubFolders = getFoldersRecursive(rootDirPath);
+    QFileInfoList files;
+    qDebug() << mSubFolders;
 
-	// find the first subfolder that has images
-	for (int idx = 0; idx < mSubFolders.size(); idx++) {
-		mCurrentDir = mSubFolders[idx];
-		files = getFilteredFileInfoList(mCurrentDir, mIgnoreKeywords, mKeywords);		// this line takes seconds if you have lots of files and slow loading (e.g. network)
-		if (!files.empty())
-			break;
-	}
+    // find the first subfolder that has images
+    for (int idx = 0; idx < mSubFolders.size(); idx++) {
+        mCurrentDir = mSubFolders[idx];
+        files = getFilteredFileInfoList(mCurrentDir,
+                                        mIgnoreKeywords,
+                                        mKeywords); // this line takes seconds if you have lots of files and slow loading (e.g. network)
+        if (!files.empty())
+            break;
+    }
 
-	return files;
+    return files;
 }
 
-int DkImageLoader::getNextFolderIdx(int folderIdx) {
-	
-	int nextIdx = -1;
+int DkImageLoader::getNextFolderIdx(int folderIdx)
+{
+    int nextIdx = -1;
 
-	if (mSubFolders.empty())
-		return nextIdx;
+    if (mSubFolders.empty())
+        return nextIdx;
 
-	// find the first sub folder that has images
-	for (int idx = 1; idx < mSubFolders.size(); idx++) {
-		
-		int tmpNextIdx = folderIdx + idx;
+    // find the first sub folder that has images
+    for (int idx = 1; idx < mSubFolders.size(); idx++) {
+        int tmpNextIdx = folderIdx + idx;
 
-		if (DkSettingsManager::param().global().loop)
-			tmpNextIdx %= mSubFolders.size();
-		else if (tmpNextIdx >= mSubFolders.size())
-			return -1;
+        if (DkSettingsManager::param().global().loop)
+            tmpNextIdx %= mSubFolders.size();
+        else if (tmpNextIdx >= mSubFolders.size())
+            return -1;
 
-		QDir cDir = mSubFolders[tmpNextIdx];
-		QFileInfoList cFiles = getFilteredFileInfoList(cDir.absolutePath(), mIgnoreKeywords, mKeywords);		// this line takes seconds if you have lots of files and slow loading (e.g. network)
-		if (!cFiles.empty()) {
-			nextIdx = tmpNextIdx;
-			break;
-		}
-	}
+        QDir cDir = mSubFolders[tmpNextIdx];
+        QFileInfoList cFiles = getFilteredFileInfoList(cDir.absolutePath(),
+                                                       mIgnoreKeywords,
+                                                       mKeywords); // this line takes seconds if you have lots of files and slow loading (e.g. network)
+        if (!cFiles.empty()) {
+            nextIdx = tmpNextIdx;
+            break;
+        }
+    }
 
-	return nextIdx;
+    return nextIdx;
 }
 
-int DkImageLoader::getPrevFolderIdx(int folderIdx) {
-	
-	int prevIdx = -1;
+int DkImageLoader::getPrevFolderIdx(int folderIdx)
+{
+    int prevIdx = -1;
 
-	if (mSubFolders.empty())
-		return prevIdx;
+    if (mSubFolders.empty())
+        return prevIdx;
 
-	// find the first sub folder that has images
-	for (int idx = 1; idx < mSubFolders.size(); idx++) {
+    // find the first sub folder that has images
+    for (int idx = 1; idx < mSubFolders.size(); idx++) {
+        int tmpPrevIdx = folderIdx - idx;
 
-		int tmpPrevIdx = folderIdx - idx;
+        if (DkSettingsManager::param().global().loop && tmpPrevIdx < 0)
+            tmpPrevIdx += mSubFolders.size();
+        else if (tmpPrevIdx < 0)
+            return -1;
 
-		if (DkSettingsManager::param().global().loop && tmpPrevIdx < 0)
-			tmpPrevIdx += mSubFolders.size();
-		else if (tmpPrevIdx < 0)
-			return -1;
-
-		QDir cDir = mSubFolders[tmpPrevIdx];
-		QFileInfoList cFiles = getFilteredFileInfoList(cDir.absolutePath(), mIgnoreKeywords, mKeywords);		// this line takes seconds if you have lots of files and slow loading (e.g. network)
-		if (!cFiles.empty()) {
-			prevIdx = tmpPrevIdx;
-			break;
-		}
-	}
+        QDir cDir = mSubFolders[tmpPrevIdx];
+        QFileInfoList cFiles = getFilteredFileInfoList(cDir.absolutePath(),
+                                                       mIgnoreKeywords,
+                                                       mKeywords); // this line takes seconds if you have lots of files and slow loading (e.g. network)
+        if (!cFiles.empty()) {
+            prevIdx = tmpPrevIdx;
+            break;
+        }
+    }
 
-	return prevIdx;
+    return prevIdx;
 }
 
-void DkImageLoader::errorDialog(const QString& msg) const {
-
-	QMessageBox errorDialog(qApp->activeWindow());
-	errorDialog.setWindowTitle(tr("Error"));
-	errorDialog.setIcon(QMessageBox::Critical);
-	errorDialog.setText(msg);
-	errorDialog.show();
+void DkImageLoader::errorDialog(const QString &msg) const
+{
+    QMessageBox errorDialog(qApp->activeWindow());
+    errorDialog.setWindowTitle(tr("Error"));
+    errorDialog.setIcon(QMessageBox::Critical);
+    errorDialog.setText(msg);
+    errorDialog.show();
 
-	errorDialog.exec();
+    errorDialog.exec();
 }
 
-void DkImageLoader::updateCacher(QSharedPointer<DkImageContainerT> imgC) {
-
-	if (!imgC || !DkSettingsManager::param().resources().cacheMemory)
-		return;
-
-	DkTimer dt;
-
-	//// no caching? delete all
-	//if (!DkSettingsManager::param().resources().cacheMemory) {
-	//	for (int idx = 0; idx < images.size(); idx++) {
-	//		images.at(idx)->clear();
-	//	}
-	//	return;
-	//}
-
-	int cIdx = findFileIdx(imgC->filePath(), mImages);
-	double mem = 0;
-	double totalMem = 0;
+void DkImageLoader::updateCacher(QSharedPointer<DkImageContainerT> imgC)
+{
+    if (!imgC || !DkSettingsManager::param().resources().cacheMemory)
+        return;
 
-	if (cIdx == -1) {
-		qWarning() << "WARNING: image not found for caching!";
-		return;
-	}
+    DkTimer dt;
 
-	for (int idx = 0; idx < mImages.size(); idx++) {
+    //// no caching? delete all
+    // if (!DkSettingsManager::param().resources().cacheMemory) {
+    //	for (int idx = 0; idx < images.size(); idx++) {
+    //		images.at(idx)->clear();
+    //	}
+    //	return;
+    // }
 
-		auto cImg = mImages.at(idx);
+    int cIdx = findFileIdx(imgC->filePath(), mImages);
+    double mem = 0;
+    double totalMem = 0;
 
-		// clear images if they are edited
-		if (idx != cIdx && cImg->isEdited()) {
-			cImg->clear();
-			continue;
-		}
+    if (cIdx == -1) {
+        qWarning() << "WARNING: image not found for caching!";
+        return;
+    }
 
-		// do not count the last & the current image
-		if (idx > cIdx && idx <= cIdx+DkSettingsManager::param().resources().maxImagesCached)
-			mem += cImg->getMemoryUsage();
-		else if (abs(cIdx-idx) > 1) {
-			cImg->clear();
-			if (cImg->hasImage())
-				qDebug() << "[Cacher]" << cImg->filePath() << "freed";
+    for (int idx = 0; idx < mImages.size(); idx++) {
+        auto cImg = mImages.at(idx);
 
-			continue;
-		}
-		else
-			totalMem += cImg->getMemoryUsage();
+        // clear images if they are edited
+        if (idx != cIdx && cImg->isEdited()) {
+            cImg->clear();
+            continue;
+        }
 
-		// ignore the last and current one
-		if (idx == cIdx-1 || idx == cIdx) {
-			continue;
-		}
-		// fully load the next image
-		else if (idx == cIdx+1 && mem < DkSettingsManager::param().resources().cacheMemory && mImages.at(idx)->getLoadState() == DkImageContainerT::not_loaded) {
-			cImg->loadImageThreaded();
-			qDebug() << "[Cacher] " <<cImg->filePath() << " fully cached...";
-		}
-		else if (idx > cIdx && idx < cIdx+DkSettingsManager::param().resources().maxImagesCached-2 && mem < DkSettingsManager::param().resources().cacheMemory && mImages.at(idx)->getLoadState() == DkImageContainerT::not_loaded) {
-			//dt.getIvl();
-			mImages.at(idx)->fetchFile();		// TODO: crash detected here
-			qDebug() << "[Cacher] " << cImg->filePath() << " file fetched...";
-		}
-	}
+        // do not count the last & the current image
+        if (idx > cIdx && idx <= cIdx + DkSettingsManager::param().resources().maxImagesCached)
+            mem += cImg->getMemoryUsage();
+        else if (abs(cIdx - idx) > 1) {
+            cImg->clear();
+            if (cImg->hasImage())
+                qDebug() << "[Cacher]" << cImg->filePath() << "freed";
+
+            continue;
+        } else
+            totalMem += cImg->getMemoryUsage();
+
+        // ignore the last and current one
+        if (idx == cIdx - 1 || idx == cIdx) {
+            continue;
+        }
+        // fully load the next image
+        else if (idx == cIdx + 1 && mem < DkSettingsManager::param().resources().cacheMemory
+                 && mImages.at(idx)->getLoadState() == DkImageContainerT::not_loaded) {
+            cImg->loadImageThreaded();
+            qDebug() << "[Cacher] " << cImg->filePath() << " fully cached...";
+        } else if (idx > cIdx && idx < cIdx + DkSettingsManager::param().resources().maxImagesCached - 2
+                   && mem < DkSettingsManager::param().resources().cacheMemory && mImages.at(idx)->getLoadState() == DkImageContainerT::not_loaded) {
+            // dt.getIvl();
+            mImages.at(idx)->fetchFile(); // TODO: crash detected here
+            qDebug() << "[Cacher] " << cImg->filePath() << " file fetched...";
+        }
+    }
 
-	qDebug() << "[Cacher] created in" << dt << "(" << mem + totalMem << "MB)";
+    qDebug() << "[Cacher] created in" << dt << "(" << mem + totalMem << "MB)";
 }
 
 /**
@@ -1870,166 +1864,159 @@ void DkImageLoader::updateCacher(QSharedPointer<DkImageContainerT> imgC) {
  * @param ignoreKeywords if one of these keywords is in the file name, the file will be ignored.
  * @param keywords if one of these keywords is not in the file name, the file will be ignored.
  * @return QStringList all filtered files of the current directory.
- **/ 
-QFileInfoList DkImageLoader::getFilteredFileInfoList(const QString& dirPath, QStringList ignoreKeywords, QStringList keywords, QString folderKeywords) {
-
-	DkTimer dt;
+ **/
+QFileInfoList DkImageLoader::getFilteredFileInfoList(const QString &dirPath, QStringList ignoreKeywords, QStringList keywords, QString folderKeywords)
+{
+    DkTimer dt;
 
-	if (dirPath.isEmpty())
-		return QFileInfoList();
+    if (dirPath.isEmpty())
+        return QFileInfoList();
 
 #ifdef Q_OS_WIN
 
-	QString winPath = QDir::toNativeSeparators(dirPath) + "\\*.*";
+    QString winPath = QDir::toNativeSeparators(dirPath) + "\\*.*";
 
-	const wchar_t* fname = reinterpret_cast<const wchar_t *>(winPath.utf16());
+    const wchar_t *fname = reinterpret_cast<const wchar_t *>(winPath.utf16());
 
-	WIN32_FIND_DATAW findFileData;
-	HANDLE MyHandle = FindFirstFileW(fname, &findFileData);
+    WIN32_FIND_DATAW findFileData;
+    HANDLE MyHandle = FindFirstFileW(fname, &findFileData);
 
-	std::vector<std::wstring> fileNameList;
-	std::wstring fileName;
+    std::vector<std::wstring> fileNameList;
+    std::wstring fileName;
 
-	if( MyHandle != INVALID_HANDLE_VALUE) {
-		
-		do {
+    if (MyHandle != INVALID_HANDLE_VALUE) {
+        do {
+            fileName = findFileData.cFileName;
+            fileNameList.push_back(fileName); // TODO: sort correct according to numbers
+        } while (FindNextFileW(MyHandle, &findFileData) != 0);
+    }
 
-			fileName = findFileData.cFileName;
-			fileNameList.push_back(fileName);	// TODO: sort correct according to numbers
-		} while(FindNextFileW(MyHandle, &findFileData) != 0);
-	}
+    FindClose(MyHandle);
 
-	FindClose(MyHandle);
-	
-	// remove the * in fileFilters
-	QStringList fileFiltersClean = DkSettingsManager::param().app().browseFilters;
-	for (QString& filter : fileFiltersClean)
-		filter.replace("*", "");
-	
-	//qDebug() << "browse filters: " << DkSettingsManager::param().app().browseFilters;
+    // remove the * in fileFilters
+    QStringList fileFiltersClean = DkSettingsManager::param().app().browseFilters;
+    for (QString &filter : fileFiltersClean)
+        filter.replace("*", "");
 
-	QStringList fileList;
-	std::vector<std::wstring>::iterator lIter = fileNameList.begin();
+    // qDebug() << "browse filters: " << DkSettingsManager::param().app().browseFilters;
 
-	// convert to QStringList
-	for (unsigned int idx = 0; idx < fileNameList.size(); idx++, lIter++) {
-		
-		QString qFilename = DkUtils::stdWStringToQString(*lIter);
+    QStringList fileList;
+    std::vector<std::wstring>::iterator lIter = fileNameList.begin();
 
-		// believe it or not, but this is 10 times faster than QRegExp
-		// drawback: we also get files that contain *.jpg*
-		for (int i = 0; i < fileFiltersClean.size(); i++) {
+    // convert to QStringList
+    for (unsigned int idx = 0; idx < fileNameList.size(); idx++, lIter++) {
+        QString qFilename = DkUtils::stdWStringToQString(*lIter);
 
-			if (qFilename.contains(fileFiltersClean[i], Qt::CaseInsensitive)) {
-				fileList.append(qFilename);
-				break;
-			}
-		}
-	}
+        // believe it or not, but this is 10 times faster than QRegExp
+        // drawback: we also get files that contain *.jpg*
+        for (int i = 0; i < fileFiltersClean.size(); i++) {
+            if (qFilename.contains(fileFiltersClean[i], Qt::CaseInsensitive)) {
+                fileList.append(qFilename);
+                break;
+            }
+        }
+    }
 
-	qInfoClean() << "WinAPI, indexed (" << fileList.size() <<") files in: " << dt;
+    qInfoClean() << "WinAPI, indexed (" << fileList.size() << ") files in: " << dt;
 #else
 
-	// true file list
-	QDir tmpDir(dirPath);
-	tmpDir.setSorting(QDir::LocaleAware);
-	QStringList fileList = tmpDir.entryList(DkSettingsManager::param().app().browseFilters);
+    // true file list
+    QDir tmpDir(dirPath);
+    tmpDir.setSorting(QDir::LocaleAware);
+    QStringList fileList = tmpDir.entryList(DkSettingsManager::param().app().browseFilters);
 
 #endif
 
-	// append files with no suffix
-	QDir cDir(dirPath);
-	QStringList allFiles = cDir.entryList();
-	QStringList noSuffixFiles;
+    // append files with no suffix
+    QDir cDir(dirPath);
+    QStringList allFiles = cDir.entryList();
+    QStringList noSuffixFiles;
 
-	for (const QString& name : allFiles) {
-		
-		if (!name.contains(".") && DkUtils::isValid(QFileInfo(dirPath, name))) {
-			fileList << name;
-		}
-	}
+    for (const QString &name : allFiles) {
+        if (!name.contains(".") && DkUtils::isValid(QFileInfo(dirPath, name))) {
+            fileList << name;
+        }
+    }
 
-	// remove files that contain ignore keywords
-	for (int idx = 0; idx < ignoreKeywords.size(); idx++) {
-		QRegExp exp = QRegExp("^((?!" + ignoreKeywords[idx] + ").)*$");
-		exp.setCaseSensitivity(Qt::CaseInsensitive);
-		fileList = fileList.filter(exp);
-	}
+    // remove files that contain ignore keywords
+    for (int idx = 0; idx < ignoreKeywords.size(); idx++) {
+        QRegExp exp = QRegExp("^((?!" + ignoreKeywords[idx] + ").)*$");
+        exp.setCaseSensitivity(Qt::CaseInsensitive);
+        fileList = fileList.filter(exp);
+    }
 
-	for (int idx = 0; idx < keywords.size(); idx++) {
-		fileList = fileList.filter(keywords[idx], Qt::CaseInsensitive);
-	}
+    for (int idx = 0; idx < keywords.size(); idx++) {
+        fileList = fileList.filter(keywords[idx], Qt::CaseInsensitive);
+    }
+
+    if (folderKeywords != "") {
+        QStringList filterList = fileList;
+        fileList = DkUtils::filterStringList(folderKeywords, filterList);
+    }
 
-	if (folderKeywords != "") {
-		QStringList filterList = fileList;
-		fileList = DkUtils::filterStringList(folderKeywords, filterList);
-	}
+    if (DkSettingsManager::param().resources().filterDuplicats) {
+        QString preferredExtension = DkSettingsManager::param().resources().preferredExtension;
+        preferredExtension = preferredExtension.replace("*.", "");
+        qDebug() << "preferred extension: " << preferredExtension;
 
-	if (DkSettingsManager::param().resources().filterDuplicats) {
+        QStringList resultList = fileList;
+        fileList.clear();
 
-		QString preferredExtension = DkSettingsManager::param().resources().preferredExtension;
-		preferredExtension = preferredExtension.replace("*.", "");
-		qDebug() << "preferred extension: " << preferredExtension;
+        for (int idx = 0; idx < resultList.size(); idx++) {
+            QFileInfo cFName = QFileInfo(resultList.at(idx));
 
-		QStringList resultList = fileList;
-		fileList.clear();
-		
-		for (int idx = 0; idx < resultList.size(); idx++) {
-			
-			QFileInfo cFName = QFileInfo(resultList.at(idx));
+            if (preferredExtension.compare(cFName.suffix(), Qt::CaseInsensitive) == 0) {
+                fileList.append(resultList.at(idx));
+                continue;
+            }
 
-			if (preferredExtension.compare(cFName.suffix(), Qt::CaseInsensitive) == 0) {
-				fileList.append(resultList.at(idx));
-				continue;
-			}
+            QString cFBase = cFName.baseName();
+            bool remove = false;
 
-			QString cFBase = cFName.baseName();
-			bool remove = false;
+            for (int cIdx = 0; cIdx < resultList.size(); cIdx++) {
+                QString ccBase = QFileInfo(resultList.at(cIdx)).baseName();
 
-			for (int cIdx = 0; cIdx < resultList.size(); cIdx++) {
+                if (cIdx != idx && ccBase == cFBase && resultList.at(cIdx).contains(preferredExtension, Qt::CaseInsensitive)) {
+                    remove = true;
+                    break;
+                }
+            }
 
-				QString ccBase = QFileInfo(resultList.at(cIdx)).baseName();
+            if (!remove)
+                fileList.append(resultList.at(idx));
+        }
+    }
 
-				if (cIdx != idx && ccBase == cFBase && resultList.at(cIdx).contains(preferredExtension, Qt::CaseInsensitive)) {
-					remove = true;
-					break;
-				}
-			}
-			
-			if (!remove)
-				fileList.append(resultList.at(idx));
-		}
-	}
+    // fileList = sort(fileList, dir);
 
-	//fileList = sort(fileList, dir);
+    QFileInfoList fileInfoList;
 
-	QFileInfoList fileInfoList;
-	
-	for (int idx = 0; idx < fileList.size(); idx++)
-		fileInfoList.append(QFileInfo(mCurrentDir, fileList.at(idx)));
+    for (int idx = 0; idx < fileList.size(); idx++)
+        fileInfoList.append(QFileInfo(mCurrentDir, fileList.at(idx)));
 
-	return fileInfoList;
+    return fileInfoList;
 }
 
-void DkImageLoader::sort() {
-	
-	qSort(mImages.begin(), mImages.end(), imageContainerLessThanPtr);
-	emit updateDirSignal(mImages);
+void DkImageLoader::sort()
+{
+    std::sort(mImages.begin(), mImages.end(), imageContainerLessThanPtr);
+    emit updateDirSignal(mImages);
 }
 
-void DkImageLoader::currentImageUpdated() const {
-
-	if (mCurrentImage.isNull())
-		return;
+void DkImageLoader::currentImageUpdated() const
+{
+    if (mCurrentImage.isNull())
+        return;
 
-	emit imageUpdatedSignal(mCurrentImage);
+    emit imageUpdatedSignal(mCurrentImage);
 }
 
 /**
  * Returns the directory where files are copied to.
  * @return QDir the directory where the user copied the last file to.
  **/
-QString DkImageLoader::getCopyPath() const {
+QString DkImageLoader::getCopyPath() const
+{
     if (mCopyDir.isEmpty() || !QDir(mCopyDir).exists())
         return mCurrentDir;
     else
@@ -2039,177 +2026,211 @@ QString DkImageLoader::getCopyPath() const {
 /**
  * Returns the directory where files are saved to.
  * @return QDir the directory where the user saved the last file to.
- **/ 
-QString DkImageLoader::getSavePath() const {
-
-	if (mSaveDir.isEmpty() || !QDir(mSaveDir).exists())
-		return mCurrentDir;
-	else
-		return mSaveDir;
+ **/
+QString DkImageLoader::getSavePath() const
+{
+    if (mSaveDir.isEmpty() || !QDir(mSaveDir).exists())
+        return mCurrentDir;
+    else
+        return mSaveDir;
 }
 
 /**
-* Returns if an image is loaded currently.
-* @return bool true if an image is loaded.
-**/ 
-bool DkImageLoader::hasImage() const {
-		
-	return mCurrentImage && mCurrentImage->hasImage();
+ * Returns if an image is loaded currently.
+ * @return bool true if an image is loaded.
+ **/
+bool DkImageLoader::hasImage() const
+{
+    return mCurrentImage && mCurrentImage->hasImage();
 }
 
-bool DkImageLoader::isEdited() const {
-	return mCurrentImage && mCurrentImage->isEdited();
+bool DkImageLoader::isEdited() const
+{
+    return mCurrentImage && mCurrentImage->isEdited();
 }
 
-int DkImageLoader::numFiles() const {
-	return mImages.size();
+int DkImageLoader::numFiles() const
+{
+    return mImages.size();
 }
 
-void DkImageLoader::undo() {
+void DkImageLoader::undo()
+{
+    if (!mCurrentImage)
+        return;
 
-	if (!mCurrentImage)
-		return;
-
-	mCurrentImage->undo();
+    mCurrentImage->undo();
 }
 
-void DkImageLoader::redo() {
-
-	if (!mCurrentImage)
-		return;
+void DkImageLoader::redo()
+{
+    if (!mCurrentImage)
+        return;
 
-	mCurrentImage->redo();
+    mCurrentImage->redo();
 }
 
 /**
-	* Returns the currently loaded image.
-	* @return QImage the current image
-	**/ 
-QImage DkImageLoader::getImage() {
-		
-	if (!mCurrentImage)
-		return QImage();
+ * Returns the currently loaded image.
+ * @return QImage the current image
+ **/
+QImage DkImageLoader::getImage()
+{
+    if (!mCurrentImage)
+        return QImage();
 
-	return mCurrentImage->image();
+    return mCurrentImage->image();
 }
 
-bool DkImageLoader::dirtyTiff() {
-
-	if (!mCurrentImage)
-		return false;
+/**
+ * @brief Returns the currently loaded pixmap. May differ from the image returned by getImage()
+ * in case the pixmap represents a meta modification, like after rotating it.
+ * This is primarily meant to be displayed in the gui.
+ *  When saving to disk, the actual image as returned by getImage() should be used.
+ *
+ * @return QImage
+ */
+QImage DkImageLoader::getPixmap()
+{
+    if (!mCurrentImage)
+        return QImage();
 
-	return mCurrentImage->getLoader()->isDirty();
+    // return mCurrentImage->pixmap();
+    return mCurrentImage->getLoader()->pixmap();
 }
 
-QStringList DkImageLoader::ignoreKeywords() const {
-	return mIgnoreKeywords;
-}
+bool DkImageLoader::dirtyTiff()
+{
+    if (!mCurrentImage)
+        return false;
 
-void DkImageLoader::setIgnoreKeywords(const QStringList& ignoreKeywords) {
-	mIgnoreKeywords = ignoreKeywords;
+    return mCurrentImage->getLoader()->isDirty();
 }
 
-void DkImageLoader::appendIgnoreKeyword(const QString& keyword) {
-	mIgnoreKeywords.append(keyword);
+QStringList DkImageLoader::ignoreKeywords() const
+{
+    return mIgnoreKeywords;
 }
 
-QStringList DkImageLoader::keywords() const {
-	return mKeywords;
+void DkImageLoader::setIgnoreKeywords(const QStringList &ignoreKeywords)
+{
+    mIgnoreKeywords = ignoreKeywords;
 }
 
-void DkImageLoader::setKeywords(const QStringList& keywords) {
-	mKeywords = keywords;
+void DkImageLoader::appendIgnoreKeyword(const QString &keyword)
+{
+    mIgnoreKeywords.append(keyword);
 }
 
-void DkImageLoader::appendKeyword(const QString& keyword) {
-	mKeywords.append(keyword);
+QStringList DkImageLoader::keywords() const
+{
+    return mKeywords;
 }
 
-void DkImageLoader::loadLastDir() {
-
-	if (DkSettingsManager::param().global().recentFolders.empty())
-		return;
+void DkImageLoader::setKeywords(const QStringList &keywords)
+{
+    mKeywords = keywords;
+}
 
-	setDir(DkSettingsManager::param().global().recentFolders[0]);
+void DkImageLoader::appendKeyword(const QString &keyword)
+{
+    mKeywords.append(keyword);
 }
 
-void DkImageLoader::setFolderFilters(const QStringList& filter) {
+void DkImageLoader::loadLastDir()
+{
+    if (DkSettingsManager::param().global().recentFolders.empty())
+        return;
 
-	setFolderFilter(filter.join(" "));
+    setDir(DkSettingsManager::param().global().recentFolders[0]);
 }
 
-void DkImageLoader::setFolderFilter(const QString& filter) {
+void DkImageLoader::setFolderFilters(const QStringList &filter)
+{
+    setFolderFilter(filter.join(" "));
+}
 
-	mFolderFilterString = filter;
-	mFolderUpdated = true;
-	loadDir(mCurrentDir);	// simulate a folder update operation
+void DkImageLoader::setFolderFilter(const QString &filter)
+{
+    mFolderFilterString = filter;
+    mFolderUpdated = true;
+    loadDir(mCurrentDir); // simulate a folder update operation
 }
 
-QString DkImageLoader::getFolderFilter() {
-	return mFolderFilterString;
+QString DkImageLoader::getFolderFilter()
+{
+    return mFolderFilterString;
 }
 
-QStringList DkImageLoader::getFolderFilters() {
-	return mFolderFilterString.split(" ");
+QStringList DkImageLoader::getFolderFilters()
+{
+    return mFolderFilterString.split(" ");
 }
 
 /**
  * Sets the current directory to dir.
  * @param dir the directory to be loaded.
- **/ 
-void DkImageLoader::setDir(const QString& dir) {
+ **/
+void DkImageLoader::setDir(const QString &dir)
+{
+    // QDir oldDir = file.absoluteDir();
 
-	//QDir oldDir = file.absoluteDir();
-	
-	bool valid = loadDir(dir);
+    bool valid = loadDir(dir);
 
-	if (valid)
-		firstFile();
+    if (valid)
+        firstFile();
 }
 
 /**
  * Sets a new save directory.
  * @param dir the new save directory.
- **/ 
-void DkImageLoader::setSaveDir(const QString& dirPath) {
-	mSaveDir = dirPath;
+ **/
+void DkImageLoader::setSaveDir(const QString &dirPath)
+{
+    mSaveDir = dirPath;
 }
 
 /**
- * Sets the current image to img.
+ * Sets the current image to a new image container.
  * @param img the loader's new image.
- **/ 
-QSharedPointer<DkImageContainerT> DkImageLoader::setImage(const QImage& img, const QString& editName, const QString& editFilePath) {
-	
-	qDebug() << "edited file: " << editFilePath;
+ **/
+QSharedPointer<DkImageContainerT> DkImageLoader::setImage(const QImage &img, const QString &editName, const QString &editFilePath)
+{
+    qDebug() << "edited file: " << editFilePath;
+
+    QSharedPointer<DkImageContainerT> newImg = findOrCreateFile(editFilePath);
+    newImg->setImage(img, editName, editFilePath);
 
-	QSharedPointer<DkImageContainerT> newImg = findOrCreateFile(editFilePath);
-	newImg->setImage(img, editName, editFilePath);
-	
-	setCurrentImage(newImg);
-	emit imageUpdatedSignal(mCurrentImage);
+    setCurrentImage(newImg);
+    emit imageUpdatedSignal(mCurrentImage);
 
-	return newImg;
+    return newImg;
 }
- 
-QSharedPointer<DkImageContainerT> DkImageLoader::setImage(QSharedPointer<DkImageContainerT> img) {
 
-	setCurrentImage(img);
-	emit imageUpdatedSignal(mCurrentImage);
+QSharedPointer<DkImageContainerT> DkImageLoader::setImage(QSharedPointer<DkImageContainerT> img)
+{
+    setCurrentImage(img);
+    emit imageUpdatedSignal(mCurrentImage);
 
-	return img;
+    return img;
+}
+
+void DkImageLoader::setImageUpdated()
+{
+    mCurrentImage->setEdited();
+    emit imageUpdatedSignal(mCurrentImage);
 }
 
 /**
  * Returns the current file name.
  * @return QString the file name of the currently loaded file.
- **/ 
-QString DkImageLoader::fileName() const {
-	
-	if (!mCurrentImage || !mCurrentImage->exists())
-		return QString();
-	
-	return mCurrentImage->fileName();
+ **/
+QString DkImageLoader::fileName() const
+{
+    if (!mCurrentImage || !mCurrentImage->exists())
+        return QString();
+
+    return mCurrentImage->fileName();
 }
 
-}
\ No newline at end of file
+}
diff --git a/ImageLounge/src/DkCore/DkImageLoader.h b/ImageLounge/src/DkCore/DkImageLoader.h
index 2cc3a8a..a522860 100644
--- a/ImageLounge/src/DkCore/DkImageLoader.h
+++ b/ImageLounge/src/DkCore/DkImageLoader.h
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkImageLoader.h
  Created on:	21.04.2011
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -27,10 +27,10 @@
 
 #pragma once
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QTimer>
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QImage>
-#pragma warning(pop)	// no warnings from includes - end
+#include <QTimer>
+#pragma warning(pop) // no warnings from includes - end
 
 #ifndef DllCoreExport
 #ifdef DK_CORE_DLL_EXPORT
@@ -46,14 +46,15 @@
 #include "DkImageContainer.h"
 
 #ifdef Q_OS_LINUX
-	typedef  unsigned char byte;
+typedef unsigned char byte;
 #endif
 
 // Qt defines
 class QFileSystemWatcher;
 class QUrl;
 
-namespace nmc {
+namespace nmc
+{
 
 /**
  * This class is a basic image loader class.
@@ -61,150 +62,154 @@ namespace nmc {
  * holds the currently displayed image,
  * calls the load routines
  * and saves the image or the image metadata.
- **/ 
-class DllCoreExport DkImageLoader : public QObject {
-	Q_OBJECT
+ **/
+class DllCoreExport DkImageLoader : public QObject
+{
+    Q_OBJECT
 
 public:
-
-	DkImageLoader(const QString& filePath = QString());
-	virtual ~DkImageLoader();
-
-	static QStringList getFoldersRecursive(const QString& dirPath);
-	QFileInfoList updateSubFolders(const QString& rootDirPath);
-	QFileInfoList getFilteredFileInfoList(const QString& dirPath, QStringList ignoreKeywords = QStringList(), QStringList keywords = QStringList(), QString folderKeywords = QString());
-
-	void rotateImage(double angle);
-	QSharedPointer<DkImageContainerT> getCurrentImage() const;
-	QSharedPointer<DkImageContainerT> getLastImage() const;
-	QString filePath() const;
-	QStringList getFileNames() const;
-
-	QVector<QSharedPointer<DkImageContainerT> > getImages();
-	void setImages(QVector<QSharedPointer<DkImageContainerT> > images);
-	QSharedPointer<DkImageContainerT> setImage(const QImage& img, const QString& editName, const QString& editFilePath = QString());
-	QSharedPointer<DkImageContainerT> setImage(QSharedPointer<DkImageContainerT> img);
-	void setCurrentImage(QSharedPointer<DkImageContainerT> newImg);
-	void sort();
-
-	// file selection
-	void firstFile();
-	void lastFile();
-	void clearPath();
-	void loadLastDir();
-	QSharedPointer<DkImageContainerT> getSkippedImage(int skipIdx, bool searchFile = true, bool recursive = false);
-
-	QString getDirPath() const;
-	QString getSavePath() const;
-	QString getCopyPath() const;
-	void setDir(const QString& dir);
-	void setSaveDir(const QString& dir);
-	
-	QSharedPointer<DkImageContainerT> findOrCreateFile(const QString& filePath) const;
-	QSharedPointer<DkImageContainerT> findFile(const QString& filePath) const;
-	int findFileIdx(const QString& filePath, const QVector<QSharedPointer<DkImageContainerT> >& images) const;
-	
-	bool hasFile() const;
-	bool hasMovie() const;
-	bool hasSvg() const;
-	QString fileName() const;
-
-	void deactivate();
-	void activate(bool isActive = true);
-	bool hasImage() const;
-	bool isEdited() const;
-	int numFiles() const;
-	QImage getImage();
-	bool dirtyTiff();
-
-	QStringList ignoreKeywords() const;
-	void setIgnoreKeywords(const QStringList& ignoreKeywords);
-	void appendIgnoreKeyword(const QString& keyword);
-
-	QStringList keywords() const;
-	void setKeywords(const QStringList& ignoreKeywords);
-	void appendKeyword(const QString& keyword);
-
-	static bool restoreFile(const QString &filePath);
+    DkImageLoader(const QString &filePath = QString());
+    virtual ~DkImageLoader();
+
+    static QStringList getFoldersRecursive(const QString &dirPath);
+    QFileInfoList updateSubFolders(const QString &rootDirPath);
+    QFileInfoList getFilteredFileInfoList(const QString &dirPath,
+                                          QStringList ignoreKeywords = QStringList(),
+                                          QStringList keywords = QStringList(),
+                                          QString folderKeywords = QString());
+
+    void rotateImage(double angle);
+    QSharedPointer<DkImageContainerT> getCurrentImage() const;
+    QSharedPointer<DkImageContainerT> getLastImage() const;
+    QString filePath() const;
+    QStringList getFileNames() const;
+
+    QVector<QSharedPointer<DkImageContainerT>> getImages();
+    void setImages(QVector<QSharedPointer<DkImageContainerT>> images);
+    QSharedPointer<DkImageContainerT> setImage(const QImage &img, const QString &editName, const QString &editFilePath = QString());
+    QSharedPointer<DkImageContainerT> setImage(QSharedPointer<DkImageContainerT> img);
+    void setImageUpdated();
+    void setCurrentImage(QSharedPointer<DkImageContainerT> newImg);
+    void sort();
+
+    // file selection
+    void firstFile();
+    void lastFile();
+    void clearPath();
+    void loadLastDir();
+    QSharedPointer<DkImageContainerT> getSkippedImage(int skipIdx, bool searchFile = true, bool recursive = false);
+
+    QString getDirPath() const;
+    QString getSavePath() const;
+    QString getCopyPath() const;
+    void setDir(const QString &dir);
+    void setSaveDir(const QString &dir);
+
+    QSharedPointer<DkImageContainerT> findOrCreateFile(const QString &filePath) const;
+    QSharedPointer<DkImageContainerT> findFile(const QString &filePath) const;
+    int findFileIdx(const QString &filePath, const QVector<QSharedPointer<DkImageContainerT>> &images) const;
+
+    bool hasFile() const;
+    bool hasMovie() const;
+    bool hasSvg() const;
+    QString fileName() const;
+
+    void deactivate();
+    void activate(bool isActive = true);
+    bool hasImage() const;
+    bool isEdited() const;
+    int numFiles() const;
+    QImage getImage();
+    QImage getPixmap();
+    bool dirtyTiff();
+
+    QStringList ignoreKeywords() const;
+    void setIgnoreKeywords(const QStringList &ignoreKeywords);
+    void appendIgnoreKeyword(const QString &keyword);
+
+    QStringList keywords() const;
+    void setKeywords(const QStringList &ignoreKeywords);
+    void appendKeyword(const QString &keyword);
+
+    static bool restoreFile(const QString &filePath);
 
 #ifdef WITH_QUAZIP
-	bool loadZipArchive(const QString& zipPath);
+    bool loadZipArchive(const QString &zipPath);
 #endif
 
 signals:
-	void updateSpinnerSignalDelayed(bool start = false, int timeDelayed = 700) const;
-	void setPlayer(bool play) const;
-
-	// new signals
-	void imageUpdatedSignal(QSharedPointer<DkImageContainerT> image) const;
-	void imageUpdatedSignal(int idx) const;	// folder scrollbar needs that
-	void imageLoadedSignal(QSharedPointer<DkImageContainerT> image, bool loaded = true) const;
-	void showInfoSignal(const QString& msg, int time = 3000, int position = 0) const;
-	void updateDirSignal(QVector<QSharedPointer<DkImageContainerT> > images) const;
-	void imageHasGPSSignal(bool hasGPS) const;
-	void loadImageToTab(const QString& filePath) const;
+    void updateSpinnerSignalDelayed(bool start = false, int timeDelayed = 700) const;
+    void setPlayer(bool play) const;
+
+    // new signals
+    void imageUpdatedSignal(QSharedPointer<DkImageContainerT> image) const;
+    void imageUpdatedSignal(int idx) const; // folder scrollbar needs that
+    void imageLoadedSignal(QSharedPointer<DkImageContainerT> image, bool loaded = true) const;
+    void showInfoSignal(const QString &msg, int time = 3000, int position = 0) const;
+    void updateDirSignal(QVector<QSharedPointer<DkImageContainerT>> images) const;
+    void imageHasGPSSignal(bool hasGPS) const;
+    void loadImageToTab(const QString &filePath) const;
 
 public slots:
-	void undo();
-	void redo();
-	void changeFile(int skipIdx);
-	void directoryChanged(const QString& path = QString());
-	void saveFileWeb(const QImage& saveImg);
-	void saveUserFileAs(const QImage& saveImg, bool silent);
-	void copyUserFile();
-	void saveFile(const QString& filename, const QImage& saveImg = QImage(), const QString& fileFilter = "", int compression = -1, bool threaded = true);
-	void load(QSharedPointer<DkImageContainerT> image = QSharedPointer<DkImageContainerT>());
-	void load(const QString& filePath);
-	void downloadFile(const QUrl& url);
-	bool deleteFile();
-	QString saveTempFile(const QImage& img, const QString& name = "img", const QString& fileExt = ".png", bool force = false, bool threaded = true);
-	void setFolderFilter(const QString& filter);
-	void setFolderFilters(const QStringList& filters);
-	QString getFolderFilter();
-	QStringList getFolderFilters();
-	bool loadDir(const QString& newDirPath, bool scanRecursive = true);
-	void errorDialog(const QString& msg) const;
-	void loadFileAt(int idx);
-
-	// new slots
-	void currentImageUpdated() const;
-	void imageLoaded(bool loaded = false);
-	void imageSaved(const QString& file, bool saved = true, bool loadToTab = true);
-	void imagesSorted();
-	bool unloadFile();
-	void reloadImage();
-	void showOnMap();
+    void undo();
+    void redo();
+    void changeFile(int skipIdx);
+    void directoryChanged(const QString &path = QString());
+    void saveFileWeb(const QImage &saveImg);
+    void saveUserFileAs(const QImage &saveImg, bool silent);
+    void copyUserFile();
+    void saveFile(const QString &filename, const QImage &saveImg = QImage(), const QString &fileFilter = "", int compression = -1, bool threaded = true);
+    void load(QSharedPointer<DkImageContainerT> image = QSharedPointer<DkImageContainerT>());
+    void load(const QString &filePath);
+    void downloadFile(const QUrl &url);
+    bool deleteFile();
+    QString saveTempFile(const QImage &img, const QString &name = "img", const QString &fileExt = ".png", bool force = false, bool threaded = true);
+    void setFolderFilter(const QString &filter);
+    void setFolderFilters(const QStringList &filters);
+    QString getFolderFilter();
+    QStringList getFolderFilters();
+    bool loadDir(const QString &newDirPath, bool scanRecursive = true);
+    void errorDialog(const QString &msg) const;
+    void loadFileAt(int idx);
+
+    // new slots
+    void currentImageUpdated() const;
+    void imageLoaded(bool loaded = false);
+    void imageSaved(const QString &file, bool saved = true, bool loadToTab = true);
+    void imagesSorted();
+    bool unloadFile();
+    void reloadImage();
+    void showOnMap();
 
 protected:
-	// functions
-	void updateCacher(QSharedPointer<DkImageContainerT> imgC);
-	int getNextFolderIdx(int folderIdx);
-	int getPrevFolderIdx(int folderIdx);
-	void updateHistory();
-	void sortImagesThreaded(QVector<QSharedPointer<DkImageContainerT > > images);
-	void createImages(const QFileInfoList& files, bool sort = true);
-	QVector<QSharedPointer<DkImageContainerT > > sortImages(QVector<QSharedPointer<DkImageContainerT > > images) const;
-
-	QStringList mIgnoreKeywords;
-	QStringList mKeywords;
-	QString mFolderFilterString;		// are deleted if a new folder is opened
-
-	QTimer mDelayedUpdateTimer;
-	bool mTimerBlockedUpdate = false;
-	QString mCurrentDir;
-	QString mSaveDir;
-	QString mCopyDir;
-	QFileSystemWatcher* mDirWatcher = 0;
-	QStringList mSubFolders;
-	QVector<QSharedPointer<DkImageContainerT > > mImages;
-	QSharedPointer<DkImageContainerT > mCurrentImage;
-	QSharedPointer<DkImageContainerT > mLastImageLoaded;
-	bool mFolderUpdated = false;
-	int mTmpFileIdx = 0;
-	bool mSortingImages = false;
-	bool mSortingIsDirty = false;
-	QFutureWatcher<QVector<QSharedPointer<DkImageContainerT > > > mCreateImageWatcher;
-
+    // functions
+    void updateCacher(QSharedPointer<DkImageContainerT> imgC);
+    int getNextFolderIdx(int folderIdx);
+    int getPrevFolderIdx(int folderIdx);
+    void updateHistory();
+    void sortImagesThreaded(QVector<QSharedPointer<DkImageContainerT>> images);
+    void createImages(const QFileInfoList &files, bool sort = true);
+    QVector<QSharedPointer<DkImageContainerT>> sortImages(QVector<QSharedPointer<DkImageContainerT>> images) const;
+
+    QStringList mIgnoreKeywords;
+    QStringList mKeywords;
+    QString mFolderFilterString; // are deleted if a new folder is opened
+
+    QTimer mDelayedUpdateTimer;
+    bool mTimerBlockedUpdate = false;
+    QString mCurrentDir;
+    QString mSaveDir;
+    QString mCopyDir;
+    QFileSystemWatcher *mDirWatcher = 0;
+    QStringList mSubFolders;
+    QVector<QSharedPointer<DkImageContainerT>> mImages;
+    QSharedPointer<DkImageContainerT> mCurrentImage;
+    QSharedPointer<DkImageContainerT> mLastImageLoaded;
+    bool mFolderUpdated = false;
+    int mTmpFileIdx = 0;
+    bool mSortingImages = false;
+    bool mSortingIsDirty = false;
+    QFutureWatcher<QVector<QSharedPointer<DkImageContainerT>>> mCreateImageWatcher;
 };
 
 }
\ No newline at end of file
diff --git a/ImageLounge/src/DkCore/DkImageStorage.cpp b/ImageLounge/src/DkCore/DkImageStorage.cpp
index 757233e..119caf6 100644
--- a/ImageLounge/src/DkCore/DkImageStorage.cpp
+++ b/ImageLounge/src/DkCore/DkImageStorage.cpp
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkImageStorage.cpp
  Created on:	12.07.2013
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -27,37 +27,37 @@
 
 #include "DkImageStorage.h"
 #include "DkActionManager.h"
-#include "DkSettings.h"
-#include "DkTimer.h"
 #include "DkMath.h"
+#include "DkSettings.h"
 #include "DkThumbs.h"
+#include "DkTimer.h"
 
-#pragma warning(push, 0)	// no warnings from includes - begin
+#pragma warning(push, 0) // no warnings from includes - begin
+#include <QBitmap>
 #include <QDebug>
-#include <QtConcurrentRun>
-#include <QPixmap>
 #include <QPainter>
-#include <QBitmap>
-#include <qmath.h>
+#include <QPixmap>
 #include <QSvgRenderer>
 #include <QTimer>
-#pragma warning(pop)		// no warnings from includes - end
+#include <QtConcurrentRun>
+#include <qmath.h>
+#pragma warning(pop) // no warnings from includes - end
 
 #if defined(Q_OS_WIN) && !defined(SOCK_STREAM)
-#include <winsock2.h>	// needed since libraw 0.16
+#include <winsock2.h> // needed since libraw 0.16
 #endif
-namespace nmc {
-
+namespace nmc
+{
 // DkImage --------------------------------------------------------------------
 
 /**
  * Returns a string with the buffer size of an image.
  * @param img a QImage
  * @return QString a human readable string containing the buffer size
- **/ 
-QString DkImage::getBufferSize(const QImage& img) {
-
-	return getBufferSize(img.size(), img.depth());
+ **/
+QString DkImage::getBufferSize(const QImage &img)
+{
+    return getBufferSize(img.size(), img.depth());
 }
 
 /**
@@ -65,25 +65,22 @@ QString DkImage::getBufferSize(const QImage& img) {
  * @param imgSize the image size
  * @param depth the image depth
  * @return QString a human readable string containing the buffer size
- **/ 
-QString DkImage::getBufferSize(const QSize& imgSize, const int depth) {
-
-	double size = (double)imgSize.width() * (double)imgSize.height() * (double)(depth/8.0f);
-	QString sizeStr;
-	qDebug() << "dimension: " << size;
-
-	if (size >= 1024*1024*1024) {
-		return QString::number(size/(1024.0f*1024.0f*1024.0f), 'f', 2) + " GB";
-	}
-	else if (size >= 1024*1024) {
-		return QString::number(size/(1024.0f*1024.0f), 'f', 2) + " MB";
-	}
-	else if (size >= 1024) {
-		return QString::number(size/1024.0f, 'f', 2) + " KB";
-	}
-	else {
-		return QString::number(size, 'f', 2) + " B";
-	}
+ **/
+QString DkImage::getBufferSize(const QSize &imgSize, const int depth)
+{
+    double size = (double)imgSize.width() * (double)imgSize.height() * (double)(depth / 8.0f);
+    QString sizeStr;
+    qDebug() << "dimension: " << size;
+
+    if (size >= 1024 * 1024 * 1024) {
+        return QString::number(size / (1024.0f * 1024.0f * 1024.0f), 'f', 2) + " GB";
+    } else if (size >= 1024 * 1024) {
+        return QString::number(size / (1024.0f * 1024.0f), 'f', 2) + " MB";
+    } else if (size >= 1024) {
+        return QString::number(size / 1024.0f, 'f', 2) + " KB";
+    } else {
+        return QString::number(size, 'f', 2) + " B";
+    }
 }
 
 /**
@@ -91,13 +88,13 @@ QString DkImage::getBufferSize(const QSize& imgSize, const int depth) {
  * @param imgSize the image size
  * @param depth the image depth
  * @return buffer size in MB
- **/ 
-float DkImage::getBufferSizeFloat(const QSize& imgSize, const int depth) {
+ **/
+float DkImage::getBufferSizeFloat(const QSize &imgSize, const int depth)
+{
+    double size = (double)imgSize.width() * (double)imgSize.height() * (double)(depth / 8.0f);
+    QString sizeStr;
 
-	double size = (double)imgSize.width() * (double)imgSize.height() * (double)(depth/8.0f);
-	QString sizeStr;
-
-	return (float)size/(1024.0f*1024.0f);
+    return (float)size / (1024.0f * 1024.0f);
 }
 
 /**
@@ -107,1548 +104,1502 @@ float DkImage::getBufferSizeFloat(const QSize& imgSize, const int depth) {
  * @param factor the resize factor
  * @param interpolation the interpolation method
  * @return QImage the resized image
- **/ 
-QImage DkImage::resizeImage(const QImage& img, const QSize& newSize, double factor /* = 1.0 */, int interpolation /* = ipl_cubic */, bool correctGamma /* = true */) {
-
-	QSize nSize = newSize;
-
-	// nothing to do
-	if (img.size() == nSize && factor == 1.0)
-		return img;
-
-	if (factor != 1.0)
-		nSize = QSize(qRound(img.width()*factor), qRound(img.height()*factor));
-
-	if (nSize.width() < 1 || nSize.height() < 1) {
-		return QImage();
-	}
-
-	Qt::TransformationMode iplQt = Qt::FastTransformation;
-	switch(interpolation) {
-	case ipl_nearest:	
-	case ipl_area:		iplQt = Qt::FastTransformation; break;
-	case ipl_linear:	
-	case ipl_cubic:		
-	case ipl_lanczos:	iplQt = Qt::SmoothTransformation; break;
-	}
+ **/
+QImage
+DkImage::resizeImage(const QImage &img, const QSize &newSize, double factor /* = 1.0 */, int interpolation /* = ipl_cubic */, bool correctGamma /* = true */)
+{
+    QSize nSize = newSize;
+
+    // nothing to do
+    if (img.size() == nSize && factor == 1.0)
+        return img;
+
+    if (factor != 1.0)
+        nSize = QSize(qRound(img.width() * factor), qRound(img.height() * factor));
+
+    if (nSize.width() < 1 || nSize.height() < 1) {
+        return QImage();
+    }
+
+    Qt::TransformationMode iplQt = Qt::FastTransformation;
+    switch (interpolation) {
+    case ipl_nearest:
+    case ipl_area:
+        iplQt = Qt::FastTransformation;
+        break;
+    case ipl_linear:
+    case ipl_cubic:
+    case ipl_lanczos:
+        iplQt = Qt::SmoothTransformation;
+        break;
+    }
 #ifdef WITH_OPENCV
 
-	int ipl = CV_INTER_CUBIC;
-	switch(interpolation) {
-	case ipl_nearest:	ipl = CV_INTER_NN; break;
-	case ipl_area:		ipl = CV_INTER_AREA; break;
-	case ipl_linear:	ipl = CV_INTER_LINEAR; break;
-	case ipl_cubic:		ipl = CV_INTER_CUBIC; break;
-	case ipl_lanczos:	ipl = CV_INTER_LANCZOS4; break;
-	}
-
-	try {
-		
-		QImage qImg;
-		cv::Mat resizeImage = DkImage::qImage2Mat(img);
-		
-		if (correctGamma) {
-			resizeImage.convertTo(resizeImage, CV_16U, USHRT_MAX/255.0f);
-			DkImage::gammaToLinear(resizeImage);
-		}
-
-		// is the image convertible?
-		if (resizeImage.empty()) {
-			qImg = img.scaled(newSize, Qt::IgnoreAspectRatio, iplQt);
-		}
-		else {
-
-			cv::Mat tmp;
-			cv::resize(resizeImage, tmp, cv::Size(nSize.width(), nSize.height()), 0, 0, ipl);
-			resizeImage = tmp;
-			
-			if (correctGamma) {
-				DkImage::linearToGamma(resizeImage);
-				resizeImage.convertTo(resizeImage, CV_8U, 255.0f/USHRT_MAX);
-			}
-
-			qImg = DkImage::mat2QImage(resizeImage);
-		}
-
-		if (!img.colorTable().isEmpty())
-			qImg.setColorTable(img.colorTable());
-
-		return qImg;
-
-	} 
-	catch (std::exception se) {
-		return QImage();
-	}
+    int ipl = CV_INTER_CUBIC;
+    switch (interpolation) {
+    case ipl_nearest:
+        ipl = CV_INTER_NN;
+        break;
+    case ipl_area:
+        ipl = CV_INTER_AREA;
+        break;
+    case ipl_linear:
+        ipl = CV_INTER_LINEAR;
+        break;
+    case ipl_cubic:
+        ipl = CV_INTER_CUBIC;
+        break;
+    case ipl_lanczos:
+        ipl = CV_INTER_LANCZOS4;
+        break;
+    }
+
+    try {
+        QImage qImg;
+        cv::Mat resizeImage = DkImage::qImage2Mat(img);
+
+        if (correctGamma) {
+            resizeImage.convertTo(resizeImage, CV_16U, USHRT_MAX / 255.0f);
+            DkImage::gammaToLinear(resizeImage);
+        }
+
+        // is the image convertible?
+        if (resizeImage.empty()) {
+            qImg = img.scaled(newSize, Qt::IgnoreAspectRatio, iplQt);
+        } else {
+            cv::Mat tmp;
+            cv::resize(resizeImage, tmp, cv::Size(nSize.width(), nSize.height()), 0, 0, ipl);
+            resizeImage = tmp;
+
+            if (correctGamma) {
+                DkImage::linearToGamma(resizeImage);
+                resizeImage.convertTo(resizeImage, CV_8U, 255.0f / USHRT_MAX);
+            }
+
+            qImg = DkImage::mat2QImage(resizeImage);
+        }
+
+        if (!img.colorTable().isEmpty())
+            qImg.setColorTable(img.colorTable());
+
+        return qImg;
+
+    } catch (std::exception se) {
+        return QImage();
+    }
 
 #else
 
-	QImage qImg = img.copy();
-	
-	if (correctGamma)
-		DkImage::gammaToLinear(qImg);
-	qImg.scaled(nSize, Qt::IgnoreAspectRatio, iplQt);
-	
-	if (correctGamma)
-		DkImage::linearToGamma(qImg);
-	return qImg;
-#endif
-}
-	
-bool DkImage::alphaChannelUsed(const QImage& img) {
+    QImage qImg = img.copy();
 
-	if (img.format() != QImage::Format_ARGB32 && img.format() != QImage::Format_ARGB32)
-		return false;
+    if (correctGamma)
+        DkImage::gammaToLinear(qImg);
+    qImg.scaled(nSize, Qt::IgnoreAspectRatio, iplQt);
 
-	// number of used bytes per line
-	int bpl = (img.width() * img.depth() + 7) / 8;
-	int pad = img.bytesPerLine() - bpl;
-	const uchar* ptr = img.bits();
+    if (correctGamma)
+        DkImage::linearToGamma(qImg);
+    return qImg;
+#endif
+}
 
-	for (int rIdx = 0; rIdx < img.height(); rIdx++) {
+bool DkImage::alphaChannelUsed(const QImage &img)
+{
+    if (img.format() != QImage::Format_ARGB32 && img.format() != QImage::Format_ARGB32)
+        return false;
 
-		for (int cIdx = 0; cIdx < bpl; cIdx++, ptr++) {
+    // number of used bytes per line
+    int bpl = (img.width() * img.depth() + 7) / 8;
+    int pad = img.bytesPerLine() - bpl;
+    const uchar *ptr = img.bits();
 
-			if (cIdx % 4 == 3 && *ptr != 255)
-				return true;
-		}
+    for (int rIdx = 0; rIdx < img.height(); rIdx++) {
+        for (int cIdx = 0; cIdx < bpl; cIdx++, ptr++) {
+            if (cIdx % 4 == 3 && *ptr != 255)
+                return true;
+        }
 
-		ptr += pad;
-	}
+        ptr += pad;
+    }
 
-	return false;
+    return false;
 }
 
-QImage DkImage::thresholdImage(const QImage & img, double thr, bool color) {
-
-	if (img.isNull())
-		return img;
-
-	DkTimer dt;
+QImage DkImage::thresholdImage(const QImage &img, double thr, bool color)
+{
+    if (img.isNull())
+        return img;
 
-	QImage tImg = color ? img.copy() : grayscaleImage(img);
+    DkTimer dt;
 
-	// number of bytes per line used
-	int bpl = (tImg.width() * tImg.depth() + 7) / 8;
-	int pad = tImg.bytesPerLine() - bpl;
+    QImage tImg = color ? img.copy() : grayscaleImage(img);
 
-	uchar* mPtr = tImg.bits();
+    // number of bytes per line used
+    int bpl = (tImg.width() * tImg.depth() + 7) / 8;
+    int pad = tImg.bytesPerLine() - bpl;
 
-	for (int rIdx = 0; rIdx < tImg.height(); rIdx++) {
+    uchar *mPtr = tImg.bits();
 
-		for (int cIdx = 0; cIdx < bpl; cIdx++, mPtr++) {
-			*mPtr = *mPtr > thr ? 255 : 0;
-		}
-		mPtr += pad;
-	}
+    for (int rIdx = 0; rIdx < tImg.height(); rIdx++) {
+        for (int cIdx = 0; cIdx < bpl; cIdx++, mPtr++) {
+            *mPtr = *mPtr > thr ? 255 : 0;
+        }
+        mPtr += pad;
+    }
 
-	qDebug() << "thresholding takes: " << dt;
+    qDebug() << "thresholding takes: " << dt;
 
-	return tImg;
+    return tImg;
 }
 
-QImage DkImage::rotateSimple(const QImage & img, double angle) {
-
-	if (angle == 0 || angle == -1)
-		return img;
-
-	QTransform rotationMatrix;
-	rotationMatrix.rotate(angle);
-	QImage rImg = img.transformed(rotationMatrix);
-
-	return rImg;
+QImage DkImage::rotateImage(const QImage &img, double angle)
+{
+    // compute new image size
+    DkVector nSl((float)img.width(), (float)img.height());
+    DkVector nSr = nSl;
+    double angleRad = angle * DK_DEG2RAD;
+
+    // size left
+    nSl.rotate(angleRad);
+    nSl.abs();
+
+    // size right
+    nSr.swap();
+    nSr.rotate(angleRad);
+    nSr.abs();
+    nSr.swap();
+
+    DkVector ns = nSl.maxVec(nSr);
+    QSize newSize((int)ns.width, (int)ns.height);
+
+    // create image
+    QImage imgR(newSize, QImage::Format_RGBA8888);
+    imgR.fill(Qt::transparent);
+
+    // create transformation
+    QTransform trans;
+    trans.translate(imgR.width() / 2, imgR.height() / 2);
+    trans.rotate(angle);
+    trans.translate(-img.width() / 2, -img.height() / 2);
+
+    // render
+    QPainter p(&imgR);
+    p.setRenderHint(QPainter::SmoothPixmapTransform);
+    p.setTransform(trans);
+    p.drawImage(QPoint(), img);
+
+    return imgR;
 }
 
-QImage DkImage::rotate(const QImage & img, double angle) {
-
-	if (qAbs(angle) == 90 || qAbs(angle) == 180 || angle == 0)
-		return rotateSimple(img, angle);
-
-	// compute new image size
-	DkVector nSl((float)img.width(), (float)img.height());
-	DkVector nSr = nSl;
-	double angleRad = angle*DK_DEG2RAD;
-	
-	// size left
-	nSl.rotate(angleRad);
-	nSl.abs();
-
-	// size right
-	nSr.swap();
-	nSr.rotate(angleRad);
-	nSr.abs();
-	nSr.swap();
-	
-	DkVector ns = nSl.maxVec(nSr);
-	QSize newSize((int)ns.width, (int)ns.height);
-
-	// create image
-	QImage imgR(newSize, QImage::Format_RGBA8888);
-	imgR.fill(Qt::transparent);
-
-	// create transformation
-	QTransform trans; 
-	trans.translate(imgR.width()/2, imgR.height()/2); 
-	trans.rotate(angle); 
-	trans.translate(-img.width()/2, -img.height()/2);
-
-	// render
-	QPainter p(&imgR);
-	p.setRenderHint(QPainter::SmoothPixmapTransform);
-	p.setTransform(trans);
-	p.drawImage(QPoint(), img);
-
-	return imgR;
-}
-
-QImage DkImage::grayscaleImage(const QImage & img) {
-
-	QImage imgR;
+QImage DkImage::grayscaleImage(const QImage &img)
+{
+    QImage imgR;
 
 #ifdef WITH_OPENCV
 
-	cv::Mat cvImg = DkImage::qImage2Mat(img);
-	cv::cvtColor(cvImg, cvImg, CV_RGB2Lab);
+    cv::Mat cvImg = DkImage::qImage2Mat(img);
+    cv::cvtColor(cvImg, cvImg, CV_RGB2Lab);
 
-	std::vector<cv::Mat> imgs;
-	cv::split(cvImg, imgs);
+    std::vector<cv::Mat> imgs;
+    cv::split(cvImg, imgs);
 
-	// get the luminance channel
-	if (!imgs.empty())
-		cvImg = imgs[0];
+    // get the luminance channel
+    if (!imgs.empty())
+        cvImg = imgs[0];
 
-	// convert it back for the painter
-	cv::cvtColor(cvImg, cvImg, CV_GRAY2RGB);
+    // convert it back for the painter
+    cv::cvtColor(cvImg, cvImg, CV_GRAY2RGB);
 
-	imgR = DkImage::mat2QImage(cvImg);
+    imgR = DkImage::mat2QImage(cvImg);
 #else
 
-	QVector<QRgb> table(256);
-	for(int i=0;i<256;++i)
-		table[i]=qRgb(i,i,i);
+    QVector<QRgb> table(256);
+    for (int i = 0; i < 256; ++i)
+        table[i] = qRgb(i, i, i);
 
-	imgR = img.convertToFormat(QImage::Format_Indexed8,table);
+    imgR = img.convertToFormat(QImage::Format_Indexed8, table);
 #endif
 
-	return imgR;
+    return imgR;
 }
 
-template <typename numFmt>
-QVector<numFmt> DkImage::getLinear2GammaTable(int maxVal) {
-
-	QVector<numFmt> gammaTable;
-	double a = 0.055;
-
-	for (int idx = 0; idx <= maxVal; idx++) {
-
-		double i = idx/(double)maxVal;
-		if (i <= 0.0031308) {
-			gammaTable.append((numFmt)(qRound(i*12.92*(double)maxVal)));
-		}
-		else {
-			gammaTable.append((numFmt)(qRound(((1+a)*pow(i,1/2.4)-a)*(double)maxVal)));
-		}
-	}
-
-	return gammaTable;
+template<typename numFmt>
+QVector<numFmt> DkImage::getLinear2GammaTable(int maxVal)
+{
+    QVector<numFmt> gammaTable;
+    double a = 0.055;
+
+    for (int idx = 0; idx <= maxVal; idx++) {
+        double i = idx / (double)maxVal;
+        if (i <= 0.0031308) {
+            gammaTable.append((numFmt)(qRound(i * 12.92 * (double)maxVal)));
+        } else {
+            gammaTable.append((numFmt)(qRound(((1 + a) * pow(i, 1 / 2.4) - a) * (double)maxVal)));
+        }
+    }
+
+    return gammaTable;
 }
 
-template <typename numFmt>
-QVector<numFmt> DkImage::getGamma2LinearTable(int maxVal) {
-
-	// the formula should be:
-	// i = px/255
-	// i <= 0.04045 -> i/12.92
-	// i > 0.04045 -> (i+0.055)/(1+0.055)^2.4
-	QVector<numFmt> gammaTable;
-	double a = 0.055;
-
-	for (int idx = 0; idx <= maxVal; idx++) {
-
-		double i = idx/(double)maxVal;
-		if (i <= 0.04045) {
-			gammaTable.append((numFmt)(qRound(i/12.92*maxVal)));
-		}
-		else {
-			gammaTable.append(pow((i+a)/(1+a),2.4)*maxVal > 0 ? (numFmt)(pow((i+a)/(1+a),2.4)*maxVal) : 0);
-		}
-	}
-
-	return gammaTable;
+template<typename numFmt>
+QVector<numFmt> DkImage::getGamma2LinearTable(int maxVal)
+{
+    // the formula should be:
+    // i = px/255
+    // i <= 0.04045 -> i/12.92
+    // i > 0.04045 -> (i+0.055)/(1+0.055)^2.4
+    QVector<numFmt> gammaTable;
+    double a = 0.055;
+
+    for (int idx = 0; idx <= maxVal; idx++) {
+        double i = idx / (double)maxVal;
+        if (i <= 0.04045) {
+            gammaTable.append((numFmt)(qRound(i / 12.92 * maxVal)));
+        } else {
+            gammaTable.append(pow((i + a) / (1 + a), 2.4) * maxVal > 0 ? (numFmt)(pow((i + a) / (1 + a), 2.4) * maxVal) : 0);
+        }
+    }
+
+    return gammaTable;
 }
 
-void DkImage::gammaToLinear(QImage& img) {
-
-	QVector<uchar> gt = getGamma2LinearTable<uchar>(255);
-	mapGammaTable(img, gt);
+void DkImage::gammaToLinear(QImage &img)
+{
+    QVector<uchar> gt = getGamma2LinearTable<uchar>(255);
+    mapGammaTable(img, gt);
 }
 
-void DkImage::linearToGamma(QImage& img) {
-
-	QVector<uchar> gt = getLinear2GammaTable<uchar>(255);
-	mapGammaTable(img, gt);
+void DkImage::linearToGamma(QImage &img)
+{
+    QVector<uchar> gt = getLinear2GammaTable<uchar>(255);
+    mapGammaTable(img, gt);
 }
 
-void DkImage::mapGammaTable(QImage& img, const QVector<uchar>& gammaTable) {
-
-	DkTimer dt;
+void DkImage::mapGammaTable(QImage &img, const QVector<uchar> &gammaTable)
+{
+    DkTimer dt;
 
-	// number of bytes per line used
-	int bpl = (img.width() * img.depth() + 7) / 8;
-	int pad = img.bytesPerLine() - bpl;
+    // number of bytes per line used
+    int bpl = (img.width() * img.depth() + 7) / 8;
+    int pad = img.bytesPerLine() - bpl;
 
-	//int channels = (img.hasAlphaChannel() || img.format() == QImage::Format_RGB32) ? 4 : 3;
+    // int channels = (img.hasAlphaChannel() || img.format() == QImage::Format_RGB32) ? 4 : 3;
 
-	uchar* mPtr = img.bits();
+    uchar *mPtr = img.bits();
 
-	for (int rIdx = 0; rIdx < img.height(); rIdx++) {
+    for (int rIdx = 0; rIdx < img.height(); rIdx++) {
+        for (int cIdx = 0; cIdx < bpl; cIdx++, mPtr++) {
+            if (*mPtr < 0 || *mPtr > gammaTable.size()) {
+                qDebug() << "WRONG VALUE: " << *mPtr;
+                continue;
+            }
+            if ((int)gammaTable[*mPtr] < 0 || (int)gammaTable[*mPtr] > USHRT_MAX) {
+                qDebug() << "WRONG VALUE: " << *mPtr;
+                continue;
+            }
 
-		for (int cIdx = 0; cIdx < bpl; cIdx++, mPtr++) {
+            *mPtr = gammaTable[*mPtr];
+        }
+        mPtr += pad;
+    }
 
-			if (*mPtr < 0 || *mPtr > gammaTable.size()) {
-				qDebug() << "WRONG VALUE: " << *mPtr;
-				continue;
-			}
-			if ((int)gammaTable[*mPtr] < 0 || (int)gammaTable[*mPtr] > USHRT_MAX) {
-				qDebug() << "WRONG VALUE: " << *mPtr;
-				continue;
-			}
-
-			*mPtr = gammaTable[*mPtr];
-		}
-		mPtr += pad;
-	}
-
-	qDebug() << "gamma computation takes: " << dt;
+    qDebug() << "gamma computation takes: " << dt;
 }
 
-QImage DkImage::normImage(const QImage& img) {
+QImage DkImage::normImage(const QImage &img)
+{
+    QImage imgN = img.copy();
+    normImage(imgN);
 
-	QImage imgN = img.copy();
-	normImage(imgN);
-
-	return imgN;
+    return imgN;
 }
 
-bool DkImage::normImage(QImage& img) {
-
-	uchar maxVal = 0;
-	uchar minVal = 255;
-
-	// number of used bytes per line
-	int bpl = (img.width() * img.depth() + 7) / 8;
-	int pad = img.bytesPerLine() - bpl;
-	uchar* mPtr = img.bits();
-	bool hasAlpha = img.hasAlphaChannel() || img.format() == QImage::Format_RGB32;
-
-	for (int rIdx = 0; rIdx < img.height(); rIdx++) {
-		
-		for (int cIdx = 0; cIdx < bpl; cIdx++, mPtr++) {
-			
-			if (hasAlpha && cIdx % 4 == 3)
-				continue;
-
-			if (*mPtr > maxVal)
-				maxVal = *mPtr;
-			if (*mPtr < minVal)
-				minVal = *mPtr;
-		}
-		
-		mPtr += pad;
-	}
-
-	if ((minVal == 0 && maxVal == 255) || maxVal-minVal == 0)
-		return false;
-
-	uchar* ptr = img.bits();
-	
-	for (int rIdx = 0; rIdx < img.height(); rIdx++) {
-	
-		for (int cIdx = 0; cIdx < bpl; cIdx++, ptr++) {
-
-			if (hasAlpha && cIdx % 4 == 3)
-				continue;
-
-			*ptr = (uchar)qRound(255.0f*(*ptr-minVal)/(maxVal-minVal));
-		}
-		
-		ptr += pad;
-	}
-
-	return true;
-
-}
-
-QImage DkImage::autoAdjustImage(const QImage& img) {
-
-	QImage imgA = img.copy();
-	autoAdjustImage(imgA);
-
-	return imgA;
-}
-
-bool DkImage::autoAdjustImage(QImage& img) {
-
-	//return DkImage::unsharpMask(img, 30.0f, 1.5f);
-
-	DkTimer dt;
-	qDebug() << "[Auto Adjust] image format: " << img.format();
+bool DkImage::normImage(QImage &img)
+{
+    uchar maxVal = 0;
+    uchar minVal = 255;
 
-	// for grayscale image - normalize is the same
-	if (img.format() <= QImage::Format_Indexed8) {
-		qDebug() << "[Auto Adjust] Grayscale - switching to Normalize: " << img.format();
-		return normImage(img);
-	}
-	else if (img.format() != QImage::Format_ARGB32 && img.format() != QImage::Format_ARGB32 && 
-		img.format() != QImage::Format_RGB32 && img.format() != QImage::Format_RGB888) {
-		qDebug() << "[Auto Adjust] Format not supported: " << img.format();
-		return false;
-	}
+    // number of used bytes per line
+    int bpl = (img.width() * img.depth() + 7) / 8;
+    int pad = img.bytesPerLine() - bpl;
+    uchar *mPtr = img.bits();
+    bool hasAlpha = img.hasAlphaChannel() || img.format() == QImage::Format_RGB32;
 
-	int channels = (img.hasAlphaChannel() || img.format() == QImage::Format_RGB32) ? 4 : 3;
+    for (int rIdx = 0; rIdx < img.height(); rIdx++) {
+        for (int cIdx = 0; cIdx < bpl; cIdx++, mPtr++) {
+            if (hasAlpha && cIdx % 4 == 3)
+                continue;
 
-	uchar maxR = 0,		maxG = 0,	maxB = 0;
-	uchar minR = 255,	minG = 255, minB = 255;
+            if (*mPtr > maxVal)
+                maxVal = *mPtr;
+            if (*mPtr < minVal)
+                minVal = *mPtr;
+        }
 
-	// number of bytes per line used
-	int bpl = (img.width() * img.depth() + 7) / 8;
-	int pad = img.bytesPerLine() - bpl;
+        mPtr += pad;
+    }
 
-	uchar* mPtr = img.bits();
-	uchar r,g,b;
+    if ((minVal == 0 && maxVal == 255) || maxVal - minVal == 0)
+        return false;
 
-	int histR[256] = {0};
-	int histG[256] = {0};
-	int histB[256] = {0};
+    uchar *ptr = img.bits();
 
-	for (int rIdx = 0; rIdx < img.height(); rIdx++) {
+    for (int rIdx = 0; rIdx < img.height(); rIdx++) {
+        for (int cIdx = 0; cIdx < bpl; cIdx++, ptr++) {
+            if (hasAlpha && cIdx % 4 == 3)
+                continue;
 
-		for (int cIdx = 0; cIdx < bpl; ) {
+            *ptr = (uchar)qRound(255.0f * (*ptr - minVal) / (maxVal - minVal));
+        }
 
-			r = *mPtr; mPtr++;
-			g = *mPtr; mPtr++;
-			b = *mPtr; mPtr++;
-			cIdx += 3;
+        ptr += pad;
+    }
 
-			if (r > maxR)	maxR = r;
-			if (r < minR)	minR = r;
-
-			if (g > maxG)	maxG = g;
-			if (g < minG)	minG = g;
-
-			if (b > maxB)	maxB = b;
-			if (b < minB)	minB = b;
-
-			histR[r]++;
-			histG[g]++;
-			histB[b]++;
-
-
-			// ?? strange but I would expect the alpha channel to be the first (big endian?)
-			if (channels == 4) {
-				mPtr++;
-				cIdx++;
-			}
-
-		}
-		mPtr += pad;
-	}
-
-	QColor ignoreChannel;
-	bool ignoreR = maxR-minR == 0 || maxR-minR == 255;
-	bool ignoreG = maxR-minR == 0 || maxG-minG == 255;
-	bool ignoreB = maxR-minR == 0 || maxB-minB == 255;
-
-	uchar* ptr = img.bits();
-
-	if (ignoreR) {
-		maxR = findHistPeak(histR);
-		ignoreR = maxR-minR == 0 || maxR-minR == 255;
-	}
-	if (ignoreG) {
-		maxG = findHistPeak(histG);
-		ignoreG = maxG-minG == 0 || maxG-minG == 255;
-	}
-	if (ignoreB) {
-		maxB = findHistPeak(histB);
-		ignoreB = maxB-minB == 0 || maxB-minB == 255;
-	}
-
-	//qDebug() << "red max: " << maxR << " min: " << minR << " ignored: " << ignoreR;
-	//qDebug() << "green max: " << maxG << " min: " << minG << " ignored: " << ignoreG;
-	//qDebug() << "blue max: " << maxB << " min: " << minB << " ignored: " << ignoreB;
-	//qDebug() << "computed in: " << dt;
-
-	if (ignoreR && ignoreG && ignoreB) {
-		qDebug() << "[Auto Adjust] There is no need to adjust the image";
-		return false;
-	}
-
-	for (int rIdx = 0; rIdx < img.height(); rIdx++) {
-
-		for (int cIdx = 0; cIdx < bpl; ) {
-
-			// don't check values - speed (but you see under-/overflows anyway)
-			if (!ignoreR && *ptr < maxR)
-				*ptr = (uchar)qRound(255.0f*((float)*ptr-minR)/(maxR-minR));
-			else if (!ignoreR)
-				*ptr = 255;
-
-			ptr++;
-			cIdx++;
-
-			if (!ignoreG && *ptr < maxG)
-				*ptr = (uchar)qRound(255.0f*((float)*ptr-minG)/(maxG-minG));
-			else if (!ignoreG)
-				*ptr = 255;
-
-			ptr++;
-			cIdx++;
-
-			if (!ignoreB && *ptr < maxB)
-				*ptr = (uchar)qRound(255.0f*((float)*ptr-minB)/(maxB-minB));
-			else if (!ignoreB)
-				*ptr = 255;
-			ptr++;
-			cIdx++;
-
-			if (channels == 4) {
-				ptr++;
-				cIdx++;
-			}
-
-		}
-		ptr += pad;
-	}
-
-	qDebug() << "[Auto Adjust] image adjusted in: " << dt;
-	
-	return true;
+    return true;
 }
 
-uchar DkImage::findHistPeak(const int* hist, float quantile) {
-
-	int histArea = 0;
-
-	for (int idx = 0; idx < 256; idx++)
-		histArea += hist[idx];
+QImage DkImage::autoAdjustImage(const QImage &img)
+{
+    QImage imgA = img.copy();
+    autoAdjustImage(imgA);
 
-	int sumBins = 0;
-
-	for (int idx = 255; idx >= 0; idx--) {
-
-		sumBins += hist[idx];
-		
-		if (sumBins/(float)histArea > quantile) {
-			qDebug() << "max bin: " << idx;
-			return (uchar)idx;
-		}
-
-	}
-
-	qDebug() << "no max bin found... sum: " << sumBins;
-
-	return 255;
+    return imgA;
 }
 
-QPixmap DkImage::makeSquare(const QPixmap & pm) {
-
-	QRect r(QPoint(), pm.size());
-
-	if (r.width() > r.height()) {
-		r.setX(qFloor((r.width()-r.height())*0.5f));
-		r.setWidth(r.height());
-	}
-	else {
-		r.setY(qFloor((r.height()-r.width())*0.5f));
-		r.setHeight(r.width());
-	}
-
-	return pm.copy(r);
+bool DkImage::autoAdjustImage(QImage &img)
+{
+    // return DkImage::unsharpMask(img, 30.0f, 1.5f);
+
+    DkTimer dt;
+    qDebug() << "[Auto Adjust] image format: " << img.format();
+
+    // for grayscale image - normalize is the same
+    if (img.format() <= QImage::Format_Indexed8) {
+        qDebug() << "[Auto Adjust] Grayscale - switching to Normalize: " << img.format();
+        return normImage(img);
+    } else if (img.format() != QImage::Format_ARGB32 && img.format() != QImage::Format_ARGB32 && img.format() != QImage::Format_RGB32
+               && img.format() != QImage::Format_RGB888) {
+        qDebug() << "[Auto Adjust] Format not supported: " << img.format();
+        return false;
+    }
+
+    int channels = (img.hasAlphaChannel() || img.format() == QImage::Format_RGB32) ? 4 : 3;
+
+    uchar maxR = 0, maxG = 0, maxB = 0;
+    uchar minR = 255, minG = 255, minB = 255;
+
+    // number of bytes per line used
+    int bpl = (img.width() * img.depth() + 7) / 8;
+    int pad = img.bytesPerLine() - bpl;
+
+    uchar *mPtr = img.bits();
+    uchar r, g, b;
+
+    int histR[256] = {0};
+    int histG[256] = {0};
+    int histB[256] = {0};
+
+    for (int rIdx = 0; rIdx < img.height(); rIdx++) {
+        for (int cIdx = 0; cIdx < bpl;) {
+            r = *mPtr;
+            mPtr++;
+            g = *mPtr;
+            mPtr++;
+            b = *mPtr;
+            mPtr++;
+            cIdx += 3;
+
+            if (r > maxR)
+                maxR = r;
+            if (r < minR)
+                minR = r;
+
+            if (g > maxG)
+                maxG = g;
+            if (g < minG)
+                minG = g;
+
+            if (b > maxB)
+                maxB = b;
+            if (b < minB)
+                minB = b;
+
+            histR[r]++;
+            histG[g]++;
+            histB[b]++;
+
+            // ?? strange but I would expect the alpha channel to be the first (big endian?)
+            if (channels == 4) {
+                mPtr++;
+                cIdx++;
+            }
+        }
+        mPtr += pad;
+    }
+
+    QColor ignoreChannel;
+    bool ignoreR = maxR - minR == 0 || maxR - minR == 255;
+    bool ignoreG = maxR - minR == 0 || maxG - minG == 255;
+    bool ignoreB = maxR - minR == 0 || maxB - minB == 255;
+
+    uchar *ptr = img.bits();
+
+    if (ignoreR) {
+        maxR = findHistPeak(histR);
+        ignoreR = maxR - minR == 0 || maxR - minR == 255;
+    }
+    if (ignoreG) {
+        maxG = findHistPeak(histG);
+        ignoreG = maxG - minG == 0 || maxG - minG == 255;
+    }
+    if (ignoreB) {
+        maxB = findHistPeak(histB);
+        ignoreB = maxB - minB == 0 || maxB - minB == 255;
+    }
+
+    // qDebug() << "red max: " << maxR << " min: " << minR << " ignored: " << ignoreR;
+    // qDebug() << "green max: " << maxG << " min: " << minG << " ignored: " << ignoreG;
+    // qDebug() << "blue max: " << maxB << " min: " << minB << " ignored: " << ignoreB;
+    // qDebug() << "computed in: " << dt;
+
+    if (ignoreR && ignoreG && ignoreB) {
+        qDebug() << "[Auto Adjust] There is no need to adjust the image";
+        return false;
+    }
+
+    for (int rIdx = 0; rIdx < img.height(); rIdx++) {
+        for (int cIdx = 0; cIdx < bpl;) {
+            // don't check values - speed (but you see under-/overflows anyway)
+            if (!ignoreR && *ptr < maxR)
+                *ptr = (uchar)qRound(255.0f * ((float)*ptr - minR) / (maxR - minR));
+            else if (!ignoreR)
+                *ptr = 255;
+
+            ptr++;
+            cIdx++;
+
+            if (!ignoreG && *ptr < maxG)
+                *ptr = (uchar)qRound(255.0f * ((float)*ptr - minG) / (maxG - minG));
+            else if (!ignoreG)
+                *ptr = 255;
+
+            ptr++;
+            cIdx++;
+
+            if (!ignoreB && *ptr < maxB)
+                *ptr = (uchar)qRound(255.0f * ((float)*ptr - minB) / (maxB - minB));
+            else if (!ignoreB)
+                *ptr = 255;
+            ptr++;
+            cIdx++;
+
+            if (channels == 4) {
+                ptr++;
+                cIdx++;
+            }
+        }
+        ptr += pad;
+    }
+
+    qDebug() << "[Auto Adjust] image adjusted in: " << dt;
+
+    return true;
 }
 
-QPixmap DkImage::merge(const QVector<QImage>& imgs) {
+uchar DkImage::findHistPeak(const int *hist, float quantile)
+{
+    int histArea = 0;
 
-	if (imgs.size() > 10) {
-		qWarning() << "DkImage::merge is built for a small amount of images, you gave me: " << imgs.size();
-	}
+    for (int idx = 0; idx < 256; idx++)
+        histArea += hist[idx];
 
-	QPixmap pm;
-	int margin = 10;
-	int x = 0;
-	QPainter p;
+    int sumBins = 0;
 
-	for (const QImage& img : imgs) {
+    for (int idx = 255; idx >= 0; idx--) {
+        sumBins += hist[idx];
 
-		// init on first
-		if (pm.isNull()) {
-			pm = QPixmap(img.height()*imgs.size() + margin*(imgs.size()-1), img.height());
-			pm.fill(QColor(0,0,0,0));
-			
-			p.begin(&pm);
-		}
+        if (sumBins / (float)histArea > quantile) {
+            qDebug() << "max bin: " << idx;
+            return (uchar)idx;
+        }
+    }
 
-		QPixmap cpm = DkImage::makeSquare(QPixmap::fromImage(img));
-		QRect r(QPoint(x, 0), QSize(pm.height(), pm.height()));
-		p.drawPixmap(r, cpm);
-		x += r.width() + margin;
-	}
+    qDebug() << "no max bin found... sum: " << sumBins;
 
-	return pm;
+    return 255;
 }
 
-QImage DkImage::cropToImage(const QImage& src, const QRect& cropRect, const QTransform& t, const QColor& fillColor) {
-
-	// illegal?
-	if (cropRect.width() <= 0 || cropRect.height() <= 0)
-		return src;
+QPixmap DkImage::makeSquare(const QPixmap &pm)
+{
+    QRect r(QPoint(), pm.size());
 
-	QImage img = QImage(cropRect.width(), cropRect.height(), QImage::Format_ARGB32);
-	img.fill(fillColor.rgba());
+    if (r.width() > r.height()) {
+        r.setX(qFloor((r.width() - r.height()) * 0.5f));
+        r.setWidth(r.height());
+    } else {
+        r.setY(qFloor((r.height() - r.width()) * 0.5f));
+        r.setHeight(r.width());
+    }
 
-	// render the image into the new coordinate system
-	QPainter painter(&img);
-	painter.setWorldTransform(t);
-
-	// for rotated rects we want perfect anti-aliasing
-	if (t.isRotating())
-		painter.setRenderHints(QPainter::SmoothPixmapTransform | QPainter::Antialiasing);
-
-	painter.drawImage(QRect(QPoint(), src.size()), src, QRect(QPoint(), src.size()));
-	painter.end();
-
-	return img;
+    return pm.copy(r);
 }
 
-QImage DkImage::cropToImage(const QImage & src, const DkRotatingRect & rect, const QColor & fillColor) {
+QPixmap DkImage::merge(const QVector<QImage> &imgs)
+{
+    if (imgs.size() > 10) {
+        qWarning() << "DkImage::merge is built for a small amount of images, you gave me: " << imgs.size();
+    }
+
+    QPixmap pm;
+    int margin = 10;
+    int x = 0;
+    QPainter p;
+
+    for (const QImage &img : imgs) {
+        // init on first
+        if (pm.isNull()) {
+            pm = QPixmap(img.height() * imgs.size() + margin * (imgs.size() - 1), img.height());
+            pm.fill(QColor(0, 0, 0, 0));
+
+            p.begin(&pm);
+        }
+
+        QPixmap cpm = DkImage::makeSquare(QPixmap::fromImage(img));
+        QRect r(QPoint(x, 0), QSize(pm.height(), pm.height()));
+        p.drawPixmap(r, cpm);
+        x += r.width() + margin;
+    }
+
+    return pm;
+}
 
-	QTransform tForm; 
-	QPointF cImgSize;
-	rect.getTransform(tForm, cImgSize);
+QImage DkImage::cropToImage(const QImage &src, const DkRotatingRect &rect, const QColor &fillColor)
+{
+    QTransform tForm;
+    QPointF cImgSize;
+    rect.getTransform(tForm, cImgSize);
 
-	// illegal?
-	if (cImgSize.x() < 0.5f || cImgSize.y() < 0.5f)
-		return src;
+    // illegal?
+    if (cImgSize.x() < 0.5f || cImgSize.y() < 0.5f)
+        return src;
 
-	double angle = DkMath::normAngleRad(rect.getAngle(), 0, CV_PI*0.5);
-	double minD = qMin(std::abs(angle), std::abs(angle-CV_PI*0.5));
+    double angle = DkMath::normAngleRad(rect.getAngle(), 0, CV_PI * 0.5);
+    double minD = qMin(std::abs(angle), std::abs(angle - CV_PI * 0.5));
 
-	QImage img = QImage(qRound(cImgSize.x()), qRound(cImgSize.y()), QImage::Format_ARGB32);
-	img.fill(fillColor.rgba());
+    QImage img = QImage(qRound(cImgSize.x()), qRound(cImgSize.y()), QImage::Format_ARGB32);
+    img.fill(fillColor.rgba());
 
-	// render the image into the new coordinate system
-	QPainter painter(&img);
-	painter.setWorldTransform(tForm);
+    // render the image into the new coordinate system
+    QPainter painter(&img);
+    painter.setWorldTransform(tForm);
 
-	// for rotated rects we want perfect anti-aliasing
-	if (minD > FLT_EPSILON)
-		painter.setRenderHints(QPainter::SmoothPixmapTransform | QPainter::Antialiasing);
+    // for rotated rects we want perfect anti-aliasing
+    if (minD > FLT_EPSILON)
+        painter.setRenderHints(QPainter::SmoothPixmapTransform | QPainter::Antialiasing);
 
-	painter.drawImage(QRect(QPoint(), src.size()), src, QRect(QPoint(), src.size()));
-	painter.end();
+    painter.drawImage(QRect(QPoint(), src.size()), src, QRect(QPoint(), src.size()));
+    painter.end();
 
-	return img;
+    return img;
 }
 
-QImage DkImage::hueSaturation(const QImage & src, int hue, int sat, int brightness) {
-	
-	// nothing to do?
-	if (hue == 0 && sat == 0 && brightness == 0)
-		return src;
+QImage DkImage::hueSaturation(const QImage &src, int hue, int sat, int brightness)
+{
+    // nothing to do?
+    if (hue == 0 && sat == 0 && brightness == 0)
+        return src;
 
-	QImage imgR;
+    QImage imgR;
 
 #ifdef WITH_OPENCV
 
-	// normalize brightness/saturation
-	int brightnessN = qRound(brightness / 100.0 * 255.0);
-	double satN = sat / 100.0 + 1.0;
+    // normalize brightness/saturation
+    int brightnessN = qRound(brightness / 100.0 * 255.0);
+    double satN = sat / 100.0 + 1.0;
 
-	cv::Mat hsvImg = DkImage::qImage2Mat(src);
-	
-	if (hsvImg.channels() > 3)
-		cv::cvtColor(hsvImg, hsvImg, CV_RGBA2BGR);
+    cv::Mat hsvImg = DkImage::qImage2Mat(src);
 
-	cv::cvtColor(hsvImg, hsvImg, CV_BGR2HSV);
+    if (hsvImg.channels() > 3)
+        cv::cvtColor(hsvImg, hsvImg, CV_RGBA2BGR);
 
-	// apply hue/saturation changes
-	for (int rIdx = 0; rIdx < hsvImg.rows; rIdx++) {
+    cv::cvtColor(hsvImg, hsvImg, CV_BGR2HSV);
 
-		unsigned char* iPtr = hsvImg.ptr<unsigned char>(rIdx);
+    // apply hue/saturation changes
+    for (int rIdx = 0; rIdx < hsvImg.rows; rIdx++) {
+        unsigned char *iPtr = hsvImg.ptr<unsigned char>(rIdx);
 
-		for (int cIdx = 0; cIdx < hsvImg.cols*3; cIdx+=3) {
+        for (int cIdx = 0; cIdx < hsvImg.cols * 3; cIdx += 3) {
+            // adopt hue
+            int h = iPtr[cIdx] + hue;
+            if (h < 0)
+                h += 180;
+            if (h >= 180)
+                h -= 180;
 
-			// adopt hue
-			int h = iPtr[cIdx] + hue;
-			if (h < 0)		h += 180;
-			if (h >= 180)	h -= 180;
+            iPtr[cIdx] = (unsigned char)h;
 
-			iPtr[cIdx] = (unsigned char)h;
+            // adopt value
+            int v = iPtr[cIdx + 2] + brightnessN;
+            if (v < 0)
+                v = 0;
+            if (v > 255)
+                v = 255;
+            iPtr[cIdx + 2] = (unsigned char)v;
 
-			// adopt value
-			int v = iPtr[cIdx + 2] + brightnessN;
-			if (v < 0)		v = 0;
-			if (v > 255) 	v = 255;
-			iPtr[cIdx + 2] = (unsigned char)v;
+            // adopt saturation
+            int s = qRound(iPtr[cIdx + 1] * satN);
+            if (s < 0)
+                s = 0;
+            if (s > 255)
+                s = 255;
+            iPtr[cIdx + 1] = (unsigned char)s;
+        }
+    }
 
-			// adopt saturation
-			int s = qRound(iPtr[cIdx + 1] * satN);
-			if (s < 0)		s = 0;
-			if (s > 255) 	s = 255;
-			iPtr[cIdx + 1] = (unsigned char)s;
-		}
-	}
-	
-	cv::cvtColor(hsvImg, hsvImg, CV_HSV2BGR);
-	imgR = DkImage::mat2QImage(hsvImg);
+    cv::cvtColor(hsvImg, hsvImg, CV_HSV2BGR);
+    imgR = DkImage::mat2QImage(hsvImg);
 
 #endif // WITH_OPENCV
-	
-	return imgR;
-}
 
-QImage DkImage::exposure(const QImage & src, double exposure, double offset, double gamma) {
+    return imgR;
+}
 
-	if (exposure == 0.0 && offset == 0.0 && gamma == 1.0)
-		return src;
+QImage DkImage::exposure(const QImage &src, double exposure, double offset, double gamma)
+{
+    if (exposure == 0.0 && offset == 0.0 && gamma == 1.0)
+        return src;
 
-	QImage imgR;
+    QImage imgR;
 #ifdef WITH_OPENCV
 
-	cv::Mat rgbImg = DkImage::qImage2Mat(src);
-	rgbImg.convertTo(rgbImg, CV_16U, 256, offset*std::numeric_limits<unsigned short>::max());
+    cv::Mat rgbImg = DkImage::qImage2Mat(src);
+    rgbImg.convertTo(rgbImg, CV_16U, 256, offset * std::numeric_limits<unsigned short>::max());
 
-	if (rgbImg.channels() > 3)
-		cv::cvtColor(rgbImg, rgbImg, CV_RGBA2BGR);
+    if (rgbImg.channels() > 3)
+        cv::cvtColor(rgbImg, rgbImg, CV_RGBA2BGR);
 
-	if (exposure != 0.0)
-		rgbImg = exposureMat(rgbImg, exposure);
+    if (exposure != 0.0)
+        rgbImg = exposureMat(rgbImg, exposure);
 
-	if (gamma != 1.0)
-		rgbImg = gammaMat(rgbImg, gamma);
+    if (gamma != 1.0)
+        rgbImg = gammaMat(rgbImg, gamma);
 
-	rgbImg.convertTo(rgbImg, CV_8U, 1.0/256.0);
-	imgR = DkImage::mat2QImage(rgbImg);
+    rgbImg.convertTo(rgbImg, CV_8U, 1.0 / 256.0);
+    imgR = DkImage::mat2QImage(rgbImg);
 
 #endif // WITH_OPENCV
 
-	return imgR;
+    return imgR;
 }
 
-QImage DkImage::bgColor(const QImage & src, const QColor & col) {
-
-	QImage dst(src.size(), QImage::Format_RGB32);
-	dst.fill(col);
+QImage DkImage::bgColor(const QImage &src, const QColor &col)
+{
+    QImage dst(src.size(), QImage::Format_RGB32);
+    dst.fill(col);
 
-	QPainter p(&dst);
-	p.drawImage(QPoint(0, 0), src);
+    QPainter p(&dst);
+    p.drawImage(QPoint(0, 0), src);
 
-	return dst;
+    return dst;
 }
 
-QByteArray DkImage::extractImageFromDataStream(const QByteArray & ba, const QByteArray & beginSignature, const QByteArray & endSignature, bool debugOutput) {
-	
-	
-	int bIdx = ba.indexOf(beginSignature);
+QByteArray DkImage::extractImageFromDataStream(const QByteArray &ba, const QByteArray &beginSignature, const QByteArray &endSignature, bool debugOutput)
+{
+    int bIdx = ba.indexOf(beginSignature);
 
-	if (bIdx == -1) {
-		qDebug() << "[ExtractImage] could not locate" << beginSignature;
-		return QByteArray();
-	}
+    if (bIdx == -1) {
+        qDebug() << "[ExtractImage] could not locate" << beginSignature;
+        return QByteArray();
+    }
 
-	int eIdx = ba.indexOf(endSignature, bIdx);
+    int eIdx = ba.indexOf(endSignature, bIdx);
 
-	if (eIdx == -1) {
-		qDebug() << "[ExtractImage] could not locate" << endSignature;
-		return QByteArray();
-	}
+    if (eIdx == -1) {
+        qDebug() << "[ExtractImage] could not locate" << endSignature;
+        return QByteArray();
+    }
 
-	QByteArray bac = ba.mid(bIdx, eIdx + endSignature.size() - bIdx);
+    QByteArray bac = ba.mid(bIdx, eIdx + endSignature.size() - bIdx);
 
-	if (debugOutput) {
-		qDebug() << "extracting image from stream...";
-		qDebug() << "cropping: [" << bIdx << eIdx << "]";
-		qDebug() << "original size: " << ba.size()/1024.0 << "KB" << "new size: " << bac.size()/1024.0 << "KB" << "difference:" << (ba.size()-bac.size())/1024 << "KB";
-	}
+    if (debugOutput) {
+        qDebug() << "extracting image from stream...";
+        qDebug() << "cropping: [" << bIdx << eIdx << "]";
+        qDebug() << "original size: " << ba.size() / 1024.0 << "KB"
+                 << "new size: " << bac.size() / 1024.0 << "KB"
+                 << "difference:" << (ba.size() - bac.size()) / 1024 << "KB";
+    }
 
-	return bac;
+    return bac;
 }
 
-QByteArray DkImage::fixSamsungPanorama(QByteArray & ba) {
-
-	// this code is based on python code from bcyrill
-	// see: https://gist.github.com/bcyrill/e59fda6c7ffe23c7c4b08a990804b269
-	// it fixes SAMSUNG panorama images that are not standard conformant by adding an EOI marker to the QByteArray
-	// see also: https://github.com/nomacs/nomacs/issues/254
-
-	if (ba.size() < 8)
-		return QByteArray();
+QByteArray DkImage::fixSamsungPanorama(QByteArray &ba)
+{
+    // this code is based on python code from bcyrill
+    // see: https://gist.github.com/bcyrill/e59fda6c7ffe23c7c4b08a990804b269
+    // it fixes SAMSUNG panorama images that are not standard conformant by adding an EOI marker to the QByteArray
+    // see also: https://github.com/nomacs/nomacs/issues/254
 
-	QByteArray trailer = ba.right(4);
+    if (ba.size() < 8)
+        return QByteArray();
 
-	// is it a samsung panorama jpg?
-	if (trailer != QByteArray("SEFT"))
-		return QByteArray();
+    QByteArray trailer = ba.right(4);
 
-	// TODO saveify:
-	int sefhPos = intFromByteArray(ba, ba.size() - 8) + 8;
-	trailer = ba.right(sefhPos);
+    // is it a samsung panorama jpg?
+    if (trailer != QByteArray("SEFT"))
+        return QByteArray();
 
-	// trailer starts with "SEFH"?
-	if (trailer.left(4) != QByteArray("SEFH"))
-		return QByteArray();
+    // TODO saveify:
+    int sefhPos = intFromByteArray(ba, ba.size() - 8) + 8;
+    trailer = ba.right(sefhPos);
 
-	int endPos = ba.size();
-	int dirPos = endPos - sefhPos;
+    // trailer starts with "SEFH"?
+    if (trailer.left(4) != QByteArray("SEFH"))
+        return QByteArray();
 
-	int count = intFromByteArray(trailer, 8);
+    int endPos = ba.size();
+    int dirPos = endPos - sefhPos;
 
-	int firstBlock = 0;
-	bool isPano = false;
+    int count = intFromByteArray(trailer, 8);
 
-	for (int idx = 0; idx < count; idx++) {
+    int firstBlock = 0;
+    bool isPano = false;
 
-		int e = 12 + 12 * idx;
+    for (int idx = 0; idx < count; idx++) {
+        int e = 12 + 12 * idx;
 
-		int noff = intFromByteArray(trailer, e + 4);
-		int size = intFromByteArray(trailer, e + 8);
+        int noff = intFromByteArray(trailer, e + 4);
+        int size = intFromByteArray(trailer, e + 8);
 
-		if (firstBlock < noff)
-			firstBlock = noff;
+        if (firstBlock < noff)
+            firstBlock = noff;
 
-		QByteArray cdata = ba.mid(dirPos - noff, size);
+        QByteArray cdata = ba.mid(dirPos - noff, size);
 
-		int eoff = intFromByteArray(cdata, 4);
-		QString pi = cdata.mid(8, eoff);
+        int eoff = intFromByteArray(cdata, 4);
+        QString pi = cdata.mid(8, eoff);
 
-		if (pi == "Panorama_Shot_Info")
-			isPano = true;
-	}
+        if (pi == "Panorama_Shot_Info")
+            isPano = true;
+    }
 
-	if (!isPano)
-		return QByteArray();
+    if (!isPano)
+        return QByteArray();
 
-	int dataPos = dirPos - firstBlock;
+    int dataPos = dirPos - firstBlock;
 
-	// ok, append the missing marker
-	QByteArray nb;
-	nb.append(ba.left(dataPos));
-	nb.append(QByteArray("\xff\xd9"));
-	nb.append(ba.right(dataPos));
-	qDebug() << "SAMSUNG panorma fix: EOI marker injected";
-
-	return nb;
+    // ok, append the missing marker
+    QByteArray nb;
+    nb.append(ba.left(dataPos));
+    nb.append(QByteArray("\xff\xd9"));
+    nb.append(ba.right(dataPos));
+    qDebug() << "SAMSUNG panorma fix: EOI marker injected";
 
+    return nb;
 }
 
-int DkImage::intFromByteArray(const QByteArray & ba, int pos) {
-
-	// TODO saveify:
-	QByteArray tmp = ba.mid(pos, 4);
-	const int* val = (const int*)(tmp.constData());
+int DkImage::intFromByteArray(const QByteArray &ba, int pos)
+{
+    // TODO saveify:
+    QByteArray tmp = ba.mid(pos, 4);
+    const int *val = (const int *)(tmp.constData());
 
-	return *val;
+    return *val;
 }
 
 #ifdef WITH_OPENCV
-cv::Mat DkImage::exposureMat(const cv::Mat& src, double exposure) {
-
-	int maxVal = std::numeric_limits<unsigned short>::max();
-	cv::Mat lut(1, maxVal+1, CV_16UC1);
-
-	double smooth = 0.5;
-	double cStops = std::log(exposure) / std::log(2.0);
-	double range = cStops*2.0;
-	double linRange = std::pow(2.0, range);
-	double x1 = (maxVal + 1.0) / linRange - 1.0;
-	double y1 = x1 * exposure;
-	double y2 = maxVal * (1.0 + (1.0 - smooth) * (exposure - 1.0));
-	double sq3x = std::pow(x1*x1 * maxVal, 1.0 / 3.0);
-	double B = (y2 - y1 + exposure * (3.0*x1 - 3.0*sq3x)) / (maxVal + 2.0*x1 - 3.0*sq3x);
-	double A = (exposure - B) * 3.0 * std::pow(x1*x1, 1.0 / 3.0);
-	double CC = y2 - A * std::pow(maxVal, 1.0 / 3.0) - B*maxVal;
-
-	for (int rIdx = 0; rIdx < lut.rows; rIdx++) {
-
-		unsigned short* ptrLut = lut.ptr<unsigned short>(rIdx);
-
-		for (int cIdx = 0; cIdx < lut.cols; cIdx++) {
-
-			double val = cIdx;
-			double valE = 0.0;
-
-			if (exposure < 1.0) {
-				valE = val * std::exp(exposure/10.0);	// /10 - make it slower -> we go down till -20
-			}
-			else if (cIdx < x1) {
-				valE = val * exposure ;
-			}
-			else {
-				valE = A * std::pow(val, 1.0 / 3.0) + B*val + CC;
-			}
-
-			if (valE < 0)
-				ptrLut[cIdx] = 0;
-			else if (valE > maxVal)
-				ptrLut[cIdx] = (unsigned short)maxVal;
-			else
-				ptrLut[cIdx] = (unsigned short)qRound(valE);
-		}
-	}
-
-	return applyLUT(src, lut);
+cv::Mat DkImage::exposureMat(const cv::Mat &src, double exposure)
+{
+    int maxVal = std::numeric_limits<unsigned short>::max();
+    cv::Mat lut(1, maxVal + 1, CV_16UC1);
+
+    double smooth = 0.5;
+    double cStops = std::log(exposure) / std::log(2.0);
+    double range = cStops * 2.0;
+    double linRange = std::pow(2.0, range);
+    double x1 = (maxVal + 1.0) / linRange - 1.0;
+    double y1 = x1 * exposure;
+    double y2 = maxVal * (1.0 + (1.0 - smooth) * (exposure - 1.0));
+    double sq3x = std::pow(x1 * x1 * maxVal, 1.0 / 3.0);
+    double B = (y2 - y1 + exposure * (3.0 * x1 - 3.0 * sq3x)) / (maxVal + 2.0 * x1 - 3.0 * sq3x);
+    double A = (exposure - B) * 3.0 * std::pow(x1 * x1, 1.0 / 3.0);
+    double CC = y2 - A * std::pow(maxVal, 1.0 / 3.0) - B * maxVal;
+
+    for (int rIdx = 0; rIdx < lut.rows; rIdx++) {
+        unsigned short *ptrLut = lut.ptr<unsigned short>(rIdx);
+
+        for (int cIdx = 0; cIdx < lut.cols; cIdx++) {
+            double val = cIdx;
+            double valE = 0.0;
+
+            if (exposure < 1.0) {
+                valE = val * std::exp(exposure / 10.0); // /10 - make it slower -> we go down till -20
+            } else if (cIdx < x1) {
+                valE = val * exposure;
+            } else {
+                valE = A * std::pow(val, 1.0 / 3.0) + B * val + CC;
+            }
+
+            if (valE < 0)
+                ptrLut[cIdx] = 0;
+            else if (valE > maxVal)
+                ptrLut[cIdx] = (unsigned short)maxVal;
+            else
+                ptrLut[cIdx] = (unsigned short)qRound(valE);
+        }
+    }
+
+    return applyLUT(src, lut);
 }
 
-cv::Mat DkImage::gammaMat(const cv::Mat& src, double gamma) {
-
-	int maxVal = std::numeric_limits<unsigned short>::max();
-	cv::Mat lut(1, maxVal+1, CV_16UC1);
+cv::Mat DkImage::gammaMat(const cv::Mat &src, double gamma)
+{
+    int maxVal = std::numeric_limits<unsigned short>::max();
+    cv::Mat lut(1, maxVal + 1, CV_16UC1);
 
-	for (int rIdx = 0; rIdx < lut.rows; rIdx++) {
+    for (int rIdx = 0; rIdx < lut.rows; rIdx++) {
+        unsigned short *ptrLut = lut.ptr<unsigned short>(rIdx);
 
-		unsigned short* ptrLut = lut.ptr<unsigned short>(rIdx);
+        for (int cIdx = 0; cIdx < lut.cols; cIdx++) {
+            double val = std::pow((double)cIdx / maxVal, 1.0 / gamma) * maxVal;
+            ptrLut[cIdx] = (unsigned short)qRound(val);
+        }
+    }
 
-		for (int cIdx = 0; cIdx < lut.cols; cIdx++) {
+    return applyLUT(src, lut);
+}
 
-			double val = std::pow((double)cIdx / maxVal, 1.0 / gamma) * maxVal;
-			ptrLut[cIdx] = (unsigned short)qRound(val);
-		}
-	}
+cv::Mat DkImage::applyLUT(const cv::Mat &src, const cv::Mat &lut)
+{
+    if (src.depth() != lut.depth()) {
+        qCritical() << "cannot apply LUT!";
+        return cv::Mat();
+    }
 
-	return applyLUT(src, lut);
-}
+    cv::Mat dst = src.clone();
+    const unsigned short *lutPtr = lut.ptr<unsigned short>();
 
-cv::Mat DkImage::applyLUT(const cv::Mat& src, const cv::Mat& lut) {
+    for (int rIdx = 0; rIdx < src.rows; rIdx++) {
+        unsigned short *dPtr = dst.ptr<unsigned short>(rIdx);
 
-	if (src.depth() != lut.depth()) {
-		qCritical() << "cannot apply LUT!";
-		return cv::Mat();
-	}
+        for (int cIdx = 0; cIdx < src.cols * src.channels(); cIdx++) {
+            assert(dPtr[cIdx] >= 0 && dPtr[cIdx] < lut.cols);
+            dPtr[cIdx] = lutPtr[dPtr[cIdx]];
+        }
+    }
 
-	cv::Mat dst = src.clone();
-	const unsigned short* lutPtr = lut.ptr<unsigned short>();
+    return dst;
+}
+#endif // WITH_OPENCV
 
-	for (int rIdx = 0; rIdx < src.rows; rIdx++) {
+QPixmap DkImage::colorizePixmap(const QPixmap &icon, const QColor &col, float opacity)
+{
+    if (icon.isNull())
+        return icon;
 
-		unsigned short* dPtr = dst.ptr<unsigned short>(rIdx);
+    QPixmap glow = icon.copy();
+    QPixmap sGlow = glow.copy();
+    sGlow.fill(col);
 
-		for (int cIdx = 0; cIdx < src.cols*src.channels(); cIdx++) {
-			assert(dPtr[cIdx] >= 0 && dPtr[cIdx] < lut.cols);
-			dPtr[cIdx] = lutPtr[dPtr[cIdx]];
-		}
-	}
+    QPainter painter(&glow);
+    painter.setRenderHint(QPainter::SmoothPixmapTransform);
+    painter.setCompositionMode(QPainter::CompositionMode_SourceIn); // check if this is the right composition mode
+    painter.setOpacity(opacity);
+    painter.drawPixmap(glow.rect(), sGlow);
 
-	return dst;
+    return glow;
 }
-#endif // WITH_OPENCV
 
-QPixmap DkImage::colorizePixmap(const QPixmap& icon, const QColor& col, float opacity) {
+QPixmap DkImage::loadIcon(const QString &filePath, const QSize &size, const QColor &col)
+{
+    if (filePath.isEmpty())
+        return QPixmap();
 
-	if (icon.isNull())
-		return icon;
+    QSize s = size * DkSettingsManager::param().dpiScaleFactor();
+    if (size.isEmpty()) {
+        int eis = DkSettingsManager::param().effectiveIconSize();
+        s = QSize(eis, eis);
+    }
 
-	QPixmap glow = icon.copy();
-	QPixmap sGlow = glow.copy();
-	sGlow.fill(col);
+    QPixmap icon = loadFromSvg(filePath, s);
 
-	QPainter painter(&glow);
-	painter.setRenderHint(QPainter::SmoothPixmapTransform);
-	painter.setCompositionMode(QPainter::CompositionMode_SourceIn);	// check if this is the right composition mode
-	painter.setOpacity(opacity);
-	painter.drawPixmap(glow.rect(), sGlow);
+    QColor c = (col.isValid()) ? col : DkSettingsManager::param().display().iconColor;
 
-	return glow;
-}
+    if (c.alpha() != 0)
+        icon = colorizePixmap(icon, c);
 
-QPixmap DkImage::loadIcon(const QString & filePath, const QSize& size, const QColor& col) {
-	
-	if (filePath.isEmpty())
-		return QPixmap();
+    return icon;
+}
 
-	QSize s = size * DkSettingsManager::param().dpiScaleFactor();
-	if (size.isEmpty()) {
-		int eis = DkSettingsManager::param().effectiveIconSize();
-		s = QSize(eis, eis);
-	}
+QPixmap DkImage::loadIcon(const QString &filePath, const QColor &col, const QSize &size)
+{
+    QSize is = size;
 
-	QPixmap icon = loadFromSvg(filePath, s);
-	
-	QColor c = (col.isValid()) ? col : DkSettingsManager::param().display().iconColor;
+    if (is.isNull()) {
+        int s = DkSettingsManager::param().effectiveIconSize();
+        is = QSize(s, s);
+    }
 
-	if (c.alpha() != 0)
-		icon = colorizePixmap(icon, c);
+    QPixmap icon = loadFromSvg(filePath, is);
+    icon = colorizePixmap(icon, col);
 
-	return icon;
+    return icon;
 }
 
-QPixmap DkImage::loadFromSvg(const QString & filePath, const QSize & size) {
+QPixmap DkImage::loadFromSvg(const QString &filePath, const QSize &size)
+{
+    QSharedPointer<QSvgRenderer> svg(new QSvgRenderer(filePath));
 
-	QSharedPointer<QSvgRenderer> svg(new QSvgRenderer(filePath));
-	
-	QPixmap pm(size);
-	pm.fill(QColor(0, 0, 0, 0));	// clear background
+    QPixmap pm(size);
+    pm.fill(QColor(0, 0, 0, 0)); // clear background
 
-	QPainter p(&pm);
-	svg->render(&p);
+    QPainter p(&pm);
+    svg->render(&p);
 
-	return pm;
+    return pm;
 }
 
-
 #ifdef WITH_OPENCV
 
 /**
  * Converts a QImage to a Mat
  * @param img formats supported: ARGB32 | RGB32 | RGB888 | Indexed8
  * @return cv::Mat the corresponding Mat
- **/ 
-cv::Mat DkImage::qImage2Mat(const QImage& img) {
-
-	cv::Mat mat2;
-	QImage cImg;	// must be initialized here!	(otherwise the data is lost before clone())
-
-	try {
-		//if (img.format() == QImage::Format_RGB32)
-		//	qDebug() << "we have an RGB32 in memory...";
-
-		if (img.format() == QImage::Format_ARGB32 || img.format() == QImage::Format_RGB32) {
-			mat2 = cv::Mat(img.height(), img.width(), CV_8UC4, (uchar*)img.bits(), img.bytesPerLine());
-			//qDebug() << "ARGB32 or RGB32";
-		}
-		else if (img.format() == QImage::Format_RGB888) {
-			mat2 = cv::Mat(img.height(), img.width(), CV_8UC3, (uchar*)img.bits(), img.bytesPerLine());
-			//qDebug() << "RGB888";
-		}
-		//// converting to indexed8 causes bugs in the qpainter
-		//// see: http://qt-project.org/doc/qt-4.8/qimage.html
-		//else if (img.format() == QImage::Format_Indexed8) {
-		//	mat2 = Mat(img.height(), img.width(), CV_8UC1, (uchar*)img.bits(), img.bytesPerLine());
-		//	//qDebug() << "indexed...";
-		//}
-		else {
-			//qDebug() << "image flag: " << img.format();
-			cImg = img.convertToFormat(QImage::Format_ARGB32);
-			mat2 = cv::Mat(cImg.height(), cImg.width(), CV_8UC4, (uchar*)cImg.bits(), cImg.bytesPerLine());
-			//qDebug() << "I need to convert the QImage to ARGB32";
-		}
-
-		mat2 = mat2.clone();	// we need to own the pointer
-	}
-	catch (...) {	// something went seriously wrong (e.g. out of memory)
-		//DkNoMacs::dialog(QObject::tr("Sorry, could not convert image."));
-		qDebug() << "[DkImage::qImage2Mat] could not convert image - something is seriously wrong down here...";
-
-	}
-
-	return mat2; 
+ **/
+cv::Mat DkImage::qImage2Mat(const QImage &img)
+{
+    cv::Mat mat2;
+    QImage cImg; // must be initialized here!	(otherwise the data is lost before clone())
+
+    try {
+        // if (img.format() == QImage::Format_RGB32)
+        //	qDebug() << "we have an RGB32 in memory...";
+
+        if (img.format() == QImage::Format_ARGB32 || img.format() == QImage::Format_RGB32) {
+            mat2 = cv::Mat(img.height(), img.width(), CV_8UC4, (uchar *)img.bits(), img.bytesPerLine());
+            // qDebug() << "ARGB32 or RGB32";
+        } else if (img.format() == QImage::Format_RGB888) {
+            mat2 = cv::Mat(img.height(), img.width(), CV_8UC3, (uchar *)img.bits(), img.bytesPerLine());
+            // qDebug() << "RGB888";
+        }
+        //// converting to indexed8 causes bugs in the qpainter
+        //// see: http://qt-project.org/doc/qt-4.8/qimage.html
+        // else if (img.format() == QImage::Format_Indexed8) {
+        //	mat2 = Mat(img.height(), img.width(), CV_8UC1, (uchar*)img.bits(), img.bytesPerLine());
+        //	//qDebug() << "indexed...";
+        // }
+        else {
+            // qDebug() << "image flag: " << img.format();
+            cImg = img.convertToFormat(QImage::Format_ARGB32);
+            mat2 = cv::Mat(cImg.height(), cImg.width(), CV_8UC4, (uchar *)cImg.bits(), cImg.bytesPerLine());
+            // qDebug() << "I need to convert the QImage to ARGB32";
+        }
+
+        mat2 = mat2.clone(); // we need to own the pointer
+    } catch (...) { // something went seriously wrong (e.g. out of memory)
+        // DkNoMacs::dialog(QObject::tr("Sorry, could not convert image."));
+        qDebug() << "[DkImage::qImage2Mat] could not convert image - something is seriously wrong down here...";
+    }
+
+    return mat2;
 }
 
 /**
  * Converts a cv::Mat to a QImage.
  * @param img supported formats CV8UC1 | CV_8UC3 | CV_8UC4
  * @return QImage the corresponding QImage
- **/ 
-QImage DkImage::mat2QImage(cv::Mat img) {
-
-	QImage qImg;
-
-	// since Mat header is copied, a new buffer should be allocated (check this!)
-	if (img.depth() == CV_32F)
-		img.convertTo(img, CV_8U, 255);
-
-	if (img.type() == CV_8UC1) {
-		qImg = QImage(img.data, (int)img.cols, (int)img.rows, (int)img.step, QImage::Format_Indexed8);	// opencv uses size_t for scaling in x64 applications
-		//Mat tmp;
-		//cvtColor(img, tmp, CV_GRAY2RGB);	// Qt does not support writing to index8 images
-		//img = tmp;
-	}
-	if (img.type() == CV_8UC3) {
-			
-		//cv::cvtColor(img, img, CV_RGB2BGR);
-		qImg = QImage(img.data, (int)img.cols, (int)img.rows, (int)img.step, QImage::Format_RGB888);
-	}
-	if (img.type() == CV_8UC4) {
-		qImg = QImage(img.data, (int)img.cols, (int)img.rows, (int)img.step, QImage::Format_ARGB32);
-	}
-
-	qImg = qImg.copy();
-
-	return qImg;
+ **/
+QImage DkImage::mat2QImage(cv::Mat img)
+{
+    QImage qImg;
+
+    // since Mat header is copied, a new buffer should be allocated (check this!)
+    if (img.depth() == CV_32F)
+        img.convertTo(img, CV_8U, 255);
+
+    if (img.type() == CV_8UC1) {
+        qImg = QImage(img.data, (int)img.cols, (int)img.rows, (int)img.step, QImage::Format_Indexed8); // opencv uses size_t for scaling in x64 applications
+        // Mat tmp;
+        // cvtColor(img, tmp, CV_GRAY2RGB);	// Qt does not support writing to index8 images
+        // img = tmp;
+    }
+    if (img.type() == CV_8UC3) {
+        // cv::cvtColor(img, img, CV_RGB2BGR);
+        qImg = QImage(img.data, (int)img.cols, (int)img.rows, (int)img.step, QImage::Format_RGB888);
+    }
+    if (img.type() == CV_8UC4) {
+        qImg = QImage(img.data, (int)img.cols, (int)img.rows, (int)img.step, QImage::Format_ARGB32);
+    }
+
+    qImg = qImg.copy();
+
+    return qImg;
 }
 
-cv::Mat DkImage::get1DGauss(double sigma) {
-
-	// correct -> checked with matlab reference
-	int kernelsize = qCeil(sigma*3*2)+1;
-	if (kernelsize < 3) kernelsize = 3;
-	if ((kernelsize % 2) != 1) kernelsize+=1;
-
-	cv::Mat gKernel = cv::Mat(1, kernelsize, CV_32F);
-	float* kernelPtr = gKernel.ptr<float>();
+cv::Mat DkImage::get1DGauss(double sigma)
+{
+    // correct -> checked with matlab reference
+    int kernelsize = qCeil(sigma * 3 * 2) + 1;
+    if (kernelsize < 3)
+        kernelsize = 3;
+    if ((kernelsize % 2) != 1)
+        kernelsize += 1;
 
-	for (int idx = 0, x = -qFloor(kernelsize/2); idx < kernelsize; idx++,x++) {
+    cv::Mat gKernel = cv::Mat(1, kernelsize, CV_32F);
+    float *kernelPtr = gKernel.ptr<float>();
 
-		kernelPtr[idx] = (float)(exp(-(x*x)/(2*sigma*sigma)));	// 1/(sqrt(2pi)*sigma) -> discrete normalization
-	}
+    for (int idx = 0, x = -qFloor(kernelsize / 2); idx < kernelsize; idx++, x++) {
+        kernelPtr[idx] = (float)(exp(-(x * x) / (2 * sigma * sigma))); // 1/(sqrt(2pi)*sigma) -> discrete normalization
+    }
 
-	if (sum(gKernel).val[0] != 0)
-		gKernel *= 1.0f/sum(gKernel).val[0];
-	else
-		qWarning() << "The kernel sum is zero\n";
+    if (sum(gKernel).val[0] != 0)
+        gKernel *= 1.0f / sum(gKernel).val[0];
+    else
+        qWarning() << "The kernel sum is zero\n";
 
-	return gKernel;
+    return gKernel;
 }
 
-void DkImage::linearToGamma(cv::Mat& img) {
-
-	QVector<unsigned short> gt = getLinear2GammaTable<unsigned short>();
-	mapGammaTable(img, gt);
+void DkImage::linearToGamma(cv::Mat &img)
+{
+    QVector<unsigned short> gt = getLinear2GammaTable<unsigned short>();
+    mapGammaTable(img, gt);
 }
 
-void DkImage::gammaToLinear(cv::Mat& img) {
-
-	QVector<unsigned short> gt = getGamma2LinearTable<unsigned short>();
-	mapGammaTable(img, gt);
+void DkImage::gammaToLinear(cv::Mat &img)
+{
+    QVector<unsigned short> gt = getGamma2LinearTable<unsigned short>();
+    mapGammaTable(img, gt);
 }
 
-void DkImage::mapGammaTable(cv::Mat& img, const QVector<unsigned short>& gammaTable) {
-
-	DkTimer dt;
-
-	for (int rIdx = 0; rIdx < img.rows; rIdx++) {
-
-		unsigned short* mPtr = img.ptr<unsigned short>(rIdx);
-
-		for (int cIdx = 0; cIdx < img.cols; cIdx++) {
-
-			for (int channelIdx = 0; channelIdx < img.channels(); channelIdx++, mPtr++) {
-
-				if (*mPtr < 0 || *mPtr > gammaTable.size()) {
-					qDebug() << "WRONG VALUE: " << *mPtr;
-					continue;
-				}
-				if ((int)gammaTable[*mPtr] < 0 || (int)gammaTable[*mPtr] > USHRT_MAX) {
-					qDebug() << "WRONG VALUE: " << *mPtr;
-					continue;
-				}
-
-				*mPtr = gammaTable[*mPtr];
-			}
-		}
-	}
-
-	qDebug() << "gamma computation takes: " << dt;
+void DkImage::mapGammaTable(cv::Mat &img, const QVector<unsigned short> &gammaTable)
+{
+    DkTimer dt;
+
+    for (int rIdx = 0; rIdx < img.rows; rIdx++) {
+        unsigned short *mPtr = img.ptr<unsigned short>(rIdx);
+
+        for (int cIdx = 0; cIdx < img.cols; cIdx++) {
+            for (int channelIdx = 0; channelIdx < img.channels(); channelIdx++, mPtr++) {
+                if (*mPtr < 0 || *mPtr > gammaTable.size()) {
+                    qDebug() << "WRONG VALUE: " << *mPtr;
+                    continue;
+                }
+                if ((int)gammaTable[*mPtr] < 0 || (int)gammaTable[*mPtr] > USHRT_MAX) {
+                    qDebug() << "WRONG VALUE: " << *mPtr;
+                    continue;
+                }
+
+                *mPtr = gammaTable[*mPtr];
+            }
+        }
+    }
+
+    qDebug() << "gamma computation takes: " << dt;
 }
 
-void DkImage::logPolar(const cv::Mat& src, cv::Mat& dst, cv::Point2d center, double scaleLog, double angle, double scale) {
-
-	cv::Mat mapx, mapy;
+void DkImage::logPolar(const cv::Mat &src, cv::Mat &dst, cv::Point2d center, double scaleLog, double angle, double scale)
+{
+    cv::Mat mapx, mapy;
 
-	cv::Size ssize, dsize;
-	ssize = src.size();
-	dsize = dst.size();
+    cv::Size ssize, dsize;
+    ssize = src.size();
+    dsize = dst.size();
 
-	mapx = cv::Mat(dsize.height, dsize.width, CV_32F);
-	mapy = cv::Mat(dsize.height, dsize.width, CV_32F);
+    mapx = cv::Mat(dsize.height, dsize.width, CV_32F);
+    mapy = cv::Mat(dsize.height, dsize.width, CV_32F);
 
-	double xDist = dst.cols - center.x;
-	double yDist = dst.rows - center.y;
+    double xDist = dst.cols - center.x;
+    double yDist = dst.rows - center.y;
 
-	double radius = std::sqrt(xDist*xDist + yDist*yDist);
+    double radius = std::sqrt(xDist * xDist + yDist * yDist);
 
-	scale *= src.cols / std::log(radius / scaleLog + 1.0);
+    scale *= src.cols / std::log(radius / scaleLog + 1.0);
 
-	int x, y;
-	cv::Mat bufx, bufy, bufp, bufa;
-	double ascale = ssize.height / (2 * CV_PI);
-	cv::AutoBuffer<float> _buf(4 * dsize.width);
-	float* buf = _buf;
+    int x, y;
+    cv::Mat bufx, bufy, bufp, bufa;
+    double ascale = ssize.height / (2 * CV_PI);
+    cv::AutoBuffer<float> _buf(4 * dsize.width);
+    float *buf = _buf;
 
-	bufx = cv::Mat(1, dsize.width, CV_32F, buf);
-	bufy = cv::Mat(1, dsize.width, CV_32F, buf + dsize.width);
-	bufp = cv::Mat(1, dsize.width, CV_32F, buf + dsize.width * 2);
-	bufa = cv::Mat(1, dsize.width, CV_32F, buf + dsize.width * 3);
+    bufx = cv::Mat(1, dsize.width, CV_32F, buf);
+    bufy = cv::Mat(1, dsize.width, CV_32F, buf + dsize.width);
+    bufp = cv::Mat(1, dsize.width, CV_32F, buf + dsize.width * 2);
+    bufa = cv::Mat(1, dsize.width, CV_32F, buf + dsize.width * 3);
 
-	for (x = 0; x < dsize.width; x++)
-		bufx.ptr<float>()[x] = (float)(x - center.x);
+    for (x = 0; x < dsize.width; x++)
+        bufx.ptr<float>()[x] = (float)(x - center.x);
 
-	for (y = 0; y < dsize.height; y++) {
-		float* mx = mapx.ptr<float>(y);
-		float* my = mapy.ptr<float>(y);
+    for (y = 0; y < dsize.height; y++) {
+        float *mx = mapx.ptr<float>(y);
+        float *my = mapy.ptr<float>(y);
 
-		for (x = 0; x < dsize.width; x++)
-			bufy.ptr<float>()[x] = (float)(y - center.y);
+        for (x = 0; x < dsize.width; x++)
+            bufy.ptr<float>()[x] = (float)(y - center.y);
 
-		cv::cartToPolar(bufx, bufy, bufp, bufa);
+        cv::cartToPolar(bufx, bufy, bufp, bufa);
 
-		for (x = 0; x < dsize.width; x++) {
-			bufp.ptr<float>()[x] /= (float)scaleLog;
-			bufp.ptr<float>()[x] += 1.0f;
-		}
+        for (x = 0; x < dsize.width; x++) {
+            bufp.ptr<float>()[x] /= (float)scaleLog;
+            bufp.ptr<float>()[x] += 1.0f;
+        }
 
-		cv::log(bufp, bufp);
+        cv::log(bufp, bufp);
 
-		for (x = 0; x < dsize.width; x++) {
-			double rho = bufp.ptr<float>()[x] * scale;
-			double phi = bufa.ptr<float>()[x] + angle;
+        for (x = 0; x < dsize.width; x++) {
+            double rho = bufp.ptr<float>()[x] * scale;
+            double phi = bufa.ptr<float>()[x] + angle;
 
-			if (phi < 0)
-				phi += 2 * CV_PI;
-			else if (phi > 2 * CV_PI)
-				phi -= 2 * CV_PI;
+            if (phi < 0)
+                phi += 2 * CV_PI;
+            else if (phi > 2 * CV_PI)
+                phi -= 2 * CV_PI;
 
-			phi *= ascale;
+            phi *= ascale;
 
-			//qDebug() << "phi: " << bufa.data.fl[x];
+            // qDebug() << "phi: " << bufa.data.fl[x];
 
-			mx[x] = (float)rho;
-			my[x] = (float)phi;
-		}
-	}
+            mx[x] = (float)rho;
+            my[x] = (float)phi;
+        }
+    }
 
-	cv::remap(src, dst, mapx, mapy, CV_INTER_AREA, IPL_BORDER_REPLICATE);
+    cv::remap(src, dst, mapx, mapy, CV_INTER_AREA, IPL_BORDER_REPLICATE);
 }
 
-void DkImage::tinyPlanet(QImage& img, double scaleLog, double angle, QSize s, bool invert /* = false */) {
+void DkImage::tinyPlanet(QImage &img, double scaleLog, double angle, QSize s, bool invert /* = false */)
+{
+    QTransform rotationMatrix;
+    rotationMatrix.rotate((invert) ? (double)-90 : (double)90);
+    img = img.transformed(rotationMatrix);
 
-	QTransform rotationMatrix;
-	rotationMatrix.rotate((invert) ? (double)-90 : (double)90);
-	img = img.transformed(rotationMatrix);
+    // make square
+    img = img.scaled(s, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
 
-	// make square
-	img = img.scaled(s, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
+    cv::Mat mImg = DkImage::qImage2Mat(img);
 
-	cv::Mat mImg = DkImage::qImage2Mat(img);
+    qDebug() << "scale log: " << scaleLog << " inverted: " << invert;
+    logPolar(mImg, mImg, cv::Point2d(mImg.cols * 0.5, mImg.rows * 0.5), scaleLog, angle);
 
-	qDebug() << "scale log: " << scaleLog << " inverted: " << invert;
-	logPolar(mImg, mImg, cv::Point2d(mImg.cols*0.5, mImg.rows*0.5), scaleLog, angle);
-
-	img = DkImage::mat2QImage(mImg);
+    img = DkImage::mat2QImage(mImg);
 }
 
 #endif
 
-bool DkImage::gaussianBlur(QImage& img, float sigma) {
-
+bool DkImage::gaussianBlur(QImage &img, float sigma)
+{
 #ifdef WITH_OPENCV
-	DkTimer dt;
-	cv::Mat imgCv = DkImage::qImage2Mat(img);
+    DkTimer dt;
+    cv::Mat imgCv = DkImage::qImage2Mat(img);
 
-	cv::Mat imgG;
-	cv::Mat gx = cv::getGaussianKernel(qRound(4 * sigma + 1), sigma);
-	cv::Mat gy = gx.t();
-	cv::sepFilter2D(imgCv, imgG, CV_8U, gx, gy);
-	img = DkImage::mat2QImage(imgG);
+    cv::Mat imgG;
+    cv::Mat gx = cv::getGaussianKernel(qRound(4 * sigma + 1), sigma);
+    cv::Mat gy = gx.t();
+    cv::sepFilter2D(imgCv, imgG, CV_8U, gx, gy);
+    img = DkImage::mat2QImage(imgG);
 
-	qDebug() << "gaussian blur takes: " << dt;
+    qDebug() << "gaussian blur takes: " << dt;
 #else
-	Q_UNUSED(img);
-	Q_UNUSED(sigma);
+    Q_UNUSED(img);
+    Q_UNUSED(sigma);
 #endif
 
-	return true;
+    return true;
 }
 
-bool DkImage::unsharpMask(QImage& img, float sigma, float weight) {
-
+bool DkImage::unsharpMask(QImage &img, float sigma, float weight)
+{
 #ifdef WITH_OPENCV
-	DkTimer dt;
-	//DkImage::gammaToLinear(img);
-	cv::Mat imgCv = DkImage::qImage2Mat(img);
-
-	cv::Mat imgG;
-	cv::Mat gx = cv::getGaussianKernel(qRound(4*sigma+1), sigma);
-	cv::Mat gy = gx.t();
-	cv::sepFilter2D(imgCv, imgG, CV_8U, gx, gy);
-	//cv::GaussianBlur(imgCv, imgG, cv::Size(4*sigma+1, 4*sigma+1), sigma);		// this is awesomely slow
-	cv::addWeighted(imgCv, weight, imgG, 1-weight, 0, imgCv);
-	img = DkImage::mat2QImage(imgCv);
-
-	qDebug() << "unsharp mask takes: " << dt;
-	//DkImage::linearToGamma(img);
+    DkTimer dt;
+    // DkImage::gammaToLinear(img);
+    cv::Mat imgCv = DkImage::qImage2Mat(img);
+
+    cv::Mat imgG;
+    cv::Mat gx = cv::getGaussianKernel(qRound(4 * sigma + 1), sigma);
+    cv::Mat gy = gx.t();
+    cv::sepFilter2D(imgCv, imgG, CV_8U, gx, gy);
+    // cv::GaussianBlur(imgCv, imgG, cv::Size(4*sigma+1, 4*sigma+1), sigma);		// this is awesomely slow
+    cv::addWeighted(imgCv, weight, imgG, 1 - weight, 0, imgCv);
+    img = DkImage::mat2QImage(imgCv);
+
+    qDebug() << "unsharp mask takes: " << dt;
+    // DkImage::linearToGamma(img);
 #else
-	Q_UNUSED(img);
-	Q_UNUSED(sigma);
-	Q_UNUSED(weight);
+    Q_UNUSED(img);
+    Q_UNUSED(sigma);
+    Q_UNUSED(weight);
 #endif
 
-	return true;
+    return true;
 }
 
-QImage DkImage::createThumb(const QImage& image, int maxSize) {
-
-	if (image.isNull())
-		return image;
-
-	int maxThumbSize = maxSize == -1 ? (int)(max_thumb_size * DkSettingsManager::param().dpiScaleFactor()) : maxSize;
-	int imgW = image.width();
-	int imgH = image.height();
-
-	if (imgW > maxThumbSize || imgH > maxThumbSize) {
-		if (imgW > imgH) {
-			imgH = qRound((float)maxThumbSize / imgW * imgH);
-			imgW = maxThumbSize;
-		} 
-		else if (imgW < imgH) {
-			imgW = qRound((float)maxThumbSize / imgH * imgW);
-			imgH = maxThumbSize;
-		}
-		else {
-			imgW = maxThumbSize;
-			imgH = maxThumbSize;
-		}
-	}
-
-	// fast downscaling
-	QImage thumb = image.scaled(QSize(imgW*2, imgH*2), Qt::KeepAspectRatio, Qt::FastTransformation);
-	thumb = thumb.scaled(QSize(imgW, imgH), Qt::KeepAspectRatio, Qt::SmoothTransformation);
-
-	//qDebug() << "thumb size in createThumb: " << thumb.size() << " format: " << thumb.format();
-
-	return thumb;
+QImage DkImage::createThumb(const QImage &image, int maxSize)
+{
+    if (image.isNull())
+        return image;
+
+    int maxThumbSize = maxSize == -1 ? (int)(max_thumb_size * DkSettingsManager::param().dpiScaleFactor()) : maxSize;
+    int imgW = image.width();
+    int imgH = image.height();
+
+    if (imgW > maxThumbSize || imgH > maxThumbSize) {
+        if (imgW > imgH) {
+            imgH = qRound((float)maxThumbSize / imgW * imgH);
+            imgW = maxThumbSize;
+        } else if (imgW < imgH) {
+            imgW = qRound((float)maxThumbSize / imgH * imgW);
+            imgH = maxThumbSize;
+        } else {
+            imgW = maxThumbSize;
+            imgH = maxThumbSize;
+        }
+    }
+
+    // fast downscaling
+    QImage thumb = image.scaled(QSize(imgW * 2, imgH * 2), Qt::KeepAspectRatio, Qt::FastTransformation);
+    thumb = thumb.scaled(QSize(imgW, imgH), Qt::KeepAspectRatio, Qt::SmoothTransformation);
+
+    // qDebug() << "thumb size in createThumb: " << thumb.size() << " format: " << thumb.format();
+
+    return thumb;
 }
 
 // NOTE: this is just for fun (all images in the world : )
-bool DkImage::addToImage(QImage& img, unsigned char val) {
-
-	// number of bytes per line used
-	int bpl = (img.width() * img.depth() + 7) / 8;
-	int pad = img.bytesPerLine() - bpl;
-	uchar* ptr = img.bits();
-	bool done = false;
-
-	for (int rIdx = 0; rIdx < img.height(); rIdx++) {
-
-		for (int cIdx = 0; cIdx < bpl; cIdx++) {
-
-			// add it & we're done
-			if (*ptr <= 255-val) {
-				*ptr += val;
-				done = true;
-				break;
-			}
-
-			int ov = *ptr+(int)val;	// compute the overflow
-			val = (char)(ov-255);
-
-			*ptr = val;
-			ptr++;
-		}
-
-		if (done)
-			break;
-
-		ptr += pad;
-	}
-
-	return done;
+bool DkImage::addToImage(QImage &img, unsigned char val)
+{
+    // number of bytes per line used
+    int bpl = (img.width() * img.depth() + 7) / 8;
+    int pad = img.bytesPerLine() - bpl;
+    uchar *ptr = img.bits();
+    bool done = false;
+
+    for (int rIdx = 0; rIdx < img.height(); rIdx++) {
+        for (int cIdx = 0; cIdx < bpl; cIdx++) {
+            // add it & we're done
+            if (*ptr <= 255 - val) {
+                *ptr += val;
+                done = true;
+                break;
+            }
+
+            int ov = *ptr + (int)val; // compute the overflow
+            val = (char)(ov - 255);
+
+            *ptr = val;
+            ptr++;
+        }
+
+        if (done)
+            break;
+
+        ptr += pad;
+    }
+
+    return done;
 }
 
-QColor DkImage::getMeanColor(const QImage& img) {
-
-	// some speed-up params
-	int nC = qRound(img.depth()/8.0f);
-	int rStep = qRound(img.height()/100.0f)+1;
-	int cStep = qRound(img.width()/100.0f)+1;
-	int numCols = 42;
-
-	int offset = (nC > 1) ? 1 : 0;	// no offset for grayscale images
-	QMap<QRgb, int> colLookup;
-	int maxColCount = 0;
-	QRgb maxCol = 0;
-
-	for (int rIdx = 0; rIdx < img.height(); rIdx += rStep) {
-
-		const unsigned char* pixel = img.constScanLine(rIdx);
-
-		for (int cIdx = 0; cIdx < img.width()*nC; cIdx += cStep*nC) {
-
-			QColor cColC(qRound(pixel[cIdx+2*offset]/255.0f*numCols), 
-				qRound(pixel[cIdx+offset]/255.0f*numCols), 
-				qRound(pixel[cIdx]/255.0f*numCols));
-			QRgb cCol = cColC.rgb();
-
-			//// skip black
-			//if (cColC.saturation() < 10)
-			//	continue;
-			if (qRed(cCol) < 3 && qGreen(cCol) < 3 && qBlue(cCol) < 3)
-				continue;
-			if (qRed(cCol) > numCols-3 && qGreen(cCol) > numCols-3 && qBlue(cCol) > numCols-3)
-				continue;
-
-			if (colLookup.contains(cCol)) {
-				colLookup[cCol]++;
-			}
-			else
-				colLookup[cCol] = 1;
-
-			if (colLookup[cCol] > maxColCount) {
-				maxCol = cCol;
-				maxColCount = colLookup[cCol];
-			}
-		}
-	}
-
-	if (maxColCount > 0)
-		return QColor(qRound((float)qRed(maxCol)/numCols*255), qRound((float)qGreen(maxCol)/numCols*255), qRound((float)qBlue(maxCol)/numCols*255));
-	else
-		return DkSettingsManager::param().display().hudBgColor;
+QColor DkImage::getMeanColor(const QImage &img)
+{
+    // some speed-up params
+    int nC = qRound(img.depth() / 8.0f);
+    int rStep = qRound(img.height() / 100.0f) + 1;
+    int cStep = qRound(img.width() / 100.0f) + 1;
+    int numCols = 42;
+
+    int offset = (nC > 1) ? 1 : 0; // no offset for grayscale images
+    QMap<QRgb, int> colLookup;
+    int maxColCount = 0;
+    QRgb maxCol = 0;
+
+    for (int rIdx = 0; rIdx < img.height(); rIdx += rStep) {
+        const unsigned char *pixel = img.constScanLine(rIdx);
+
+        for (int cIdx = 0; cIdx < img.width() * nC; cIdx += cStep * nC) {
+            QColor cColC(qRound(pixel[cIdx + 2 * offset] / 255.0f * numCols),
+                         qRound(pixel[cIdx + offset] / 255.0f * numCols),
+                         qRound(pixel[cIdx] / 255.0f * numCols));
+            QRgb cCol = cColC.rgb();
+
+            //// skip black
+            // if (cColC.saturation() < 10)
+            //	continue;
+            if (qRed(cCol) < 3 && qGreen(cCol) < 3 && qBlue(cCol) < 3)
+                continue;
+            if (qRed(cCol) > numCols - 3 && qGreen(cCol) > numCols - 3 && qBlue(cCol) > numCols - 3)
+                continue;
+
+            if (colLookup.contains(cCol)) {
+                colLookup[cCol]++;
+            } else
+                colLookup[cCol] = 1;
+
+            if (colLookup[cCol] > maxColCount) {
+                maxCol = cCol;
+                maxColCount = colLookup[cCol];
+            }
+        }
+    }
+
+    if (maxColCount > 0)
+        return QColor(qRound((float)qRed(maxCol) / numCols * 255), qRound((float)qGreen(maxCol) / numCols * 255), qRound((float)qBlue(maxCol) / numCols * 255));
+    else
+        return DkSettingsManager::param().display().hudBgColor;
 }
 
-
 // DkImageStorage --------------------------------------------------------------------
-DkImageStorage::DkImageStorage(const QImage& img) {
-
-	mImg = img;
-
-	mWaitTimer = new QTimer(this);
-	mWaitTimer->setSingleShot(true);
-	mWaitTimer->setInterval(100);
-	
-	init();
-
-	connect(mWaitTimer, SIGNAL(timeout()), this, SLOT(compute()), Qt::UniqueConnection);
-	connect(&mFutureWatcher, SIGNAL(finished()), this, SLOT(imageComputed()), Qt::UniqueConnection);
-	connect(DkActionManager::instance().action(DkActionManager::menu_view_anti_aliasing), SIGNAL(toggled(bool)), this, SLOT(antiAliasingChanged(bool)), Qt::UniqueConnection);
+DkImageStorage::DkImageStorage(const QImage &img)
+{
+    mImg = img;
+
+    mWaitTimer = new QTimer(this);
+    mWaitTimer->setSingleShot(true);
+    mWaitTimer->setInterval(100);
+
+    init();
+
+    connect(mWaitTimer, SIGNAL(timeout()), this, SLOT(compute()), Qt::UniqueConnection);
+    connect(&mFutureWatcher, SIGNAL(finished()), this, SLOT(imageComputed()), Qt::UniqueConnection);
+    connect(DkActionManager::instance().action(DkActionManager::menu_view_anti_aliasing),
+            SIGNAL(toggled(bool)),
+            this,
+            SLOT(antiAliasingChanged(bool)),
+            Qt::UniqueConnection);
 }
 
-void DkImageStorage::init() {
-
-	mComputeState = l_not_computed;
-	mScaledImg = QImage();
-	mWaitTimer->stop();
-	mSize = QSize();
+void DkImageStorage::init()
+{
+    mComputeState = l_not_computed;
+    mScaledImg = QImage();
+    mWaitTimer->stop();
+    mSize = QSize();
 }
 
-void DkImageStorage::setImage(const QImage& img) {
+void DkImageStorage::setImage(const QImage &img)
+{
+    init();
+    mImg = img;
 
-	init();
-	mImg = img;
-
-	mComputeState = l_cancelled;
+    mComputeState = l_cancelled;
 }
 
-void DkImageStorage::antiAliasingChanged(bool antiAliasing) {
-
-	DkSettingsManager::param().display().antiAliasing = antiAliasing;
+void DkImageStorage::antiAliasingChanged(bool antiAliasing)
+{
+    DkSettingsManager::param().display().antiAliasing = antiAliasing;
 
-	if (!antiAliasing)
-		init();
-
-	emit infoSignal((antiAliasing) ? tr("Anti Aliasing Enabled") : tr("Anti Aliasing Disabled"));
-	emit imageUpdated();
+    if (!antiAliasing)
+        init();
 
+    emit infoSignal((antiAliasing) ? tr("Anti Aliasing Enabled") : tr("Anti Aliasing Disabled"));
+    emit imageUpdated();
 }
 
-QImage DkImageStorage::imageConst() const {
-	return mImg;
+QImage DkImageStorage::imageConst() const
+{
+    return mImg;
 }
 
-QImage DkImageStorage::image(const QSize& size) {
-
-	if (size.isEmpty() || 
-		mImg.isNull() ||
-		!DkSettingsManager::param().display().antiAliasing ||	// user disabled?
-		mImg.size().width() < size.width()						// scale factor > 1?
-		)
-		return mImg;
-
-	if (mScaledImg.size() == size)
-		return mScaledImg;
-
-	if (mComputeState != l_computing) {
-		// trigger a new computation
-		init();
-		mSize = size;
-		mWaitTimer->start();
-	}
-
-	// currently no alternative is available
-	return mImg;
+QImage DkImageStorage::image(const QSize &size)
+{
+    if (size.isEmpty() || mImg.isNull() || !DkSettingsManager::param().display().antiAliasing || // user disabled?
+        mImg.size().width() < size.width() // scale factor > 1?
+    )
+        return mImg;
+
+    if (mScaledImg.size() == size)
+        return mScaledImg;
+
+    if (mComputeState != l_computing) {
+        // trigger a new computation
+        init();
+        mSize = size;
+        mWaitTimer->start();
+    }
+
+    // currently no alternative is available
+    return mImg;
 }
 
-void DkImageStorage::cancel() {
-	mComputeState = l_cancelled;
+void DkImageStorage::cancel()
+{
+    mComputeState = l_cancelled;
 }
 
-void DkImageStorage::compute() {
-
-	if (mComputeState == l_computed) {
-		emit imageUpdated();
-		qDebug() << "image is up-to-date in DkImageStorage::compute...";
-		return;
-	}
+void DkImageStorage::compute()
+{
+    if (mComputeState == l_computed) {
+        emit imageUpdated();
+        qDebug() << "image is up-to-date in DkImageStorage::compute...";
+        return;
+    }
 
-	if (mComputeState == l_computing)	// don't compute twice
-		return;
+    if (mComputeState == l_computing) // don't compute twice
+        return;
 
-	mComputeState = l_computing;
+    mComputeState = l_computing;
 
-	mFutureWatcher.setFuture(QtConcurrent::run(this, &nmc::DkImageStorage::computeIntern, mImg, mSize));
+    mFutureWatcher.setFuture(QtConcurrent::run(this, &nmc::DkImageStorage::computeIntern, mImg, mSize));
 }
 
-QImage DkImageStorage::computeIntern(const QImage & src, const QSize& size) {
+QImage DkImageStorage::computeIntern(const QImage &src, const QSize &size)
+{
+    // should not happen
+    if (size.width() >= mImg.width()) {
+        qWarning() << "DkImageStorage::computeIntern was called without a need...";
+        return src;
+    }
 
-	// should not happen
-	if (size.width() >= mImg.width()) {
-		qWarning() << "DkImageStorage::computeIntern was called without a need...";
-		return src;
-	}
+    DkTimer dt;
+    QImage resizedImg = src;
 
-	DkTimer dt;
-	QImage resizedImg = src;
+    if (!DkSettingsManager::param().display().highQualityAntiAliasing) {
+        QSize cs = src.size();
 
-	if (!DkSettingsManager::param().display().highQualityAntiAliasing) {
-		QSize cs = src.size();
+        // fast down sampling until the image is twice times full HD
+        while (qMin(cs.width(), cs.height()) > 2 * 4000) {
+            cs *= 0.5;
+        }
 
-		// fast down sampling until the image is twice times full HD
-		while (qMin(cs.width(), cs.height()) > 2 * 4000) {
-			cs *= 0.5;
-		}
+        // for extreme panorama images the Qt scaling crashes (if we have a width > 30000) so we simply
+        if (cs != mImg.size()) {
+            resizedImg = resizedImg.scaled(cs, Qt::KeepAspectRatio, Qt::FastTransformation);
+        }
+    }
 
-		// for extreme panorama images the Qt scaling crashes (if we have a width > 30000) so we simply 
-		if (cs != mImg.size()) {
-			resizedImg = resizedImg.scaled(cs, Qt::KeepAspectRatio, Qt::FastTransformation);
-		}
-	}
+    QSize s = mSize;
 
-	QSize s = mSize;
-
-	if (s.height() == 0)
-		s.setHeight(1);
-	if (s.width() == 0)
-		s.setWidth(1);
+    if (s.height() == 0)
+        s.setHeight(1);
+    if (s.width() == 0)
+        s.setWidth(1);
 
 #ifdef WITH_OPENCV
-	try {
-		cv::Mat rImgCv = DkImage::qImage2Mat(resizedImg);
-		cv::Mat tmp;
-		cv::resize(rImgCv, tmp, cv::Size(s.width(), s.height()), 0, 0, CV_INTER_AREA);
-		resizedImg = DkImage::mat2QImage(tmp);
-	}
-	catch (...) {
-		qWarning() << "DkImageStorage: OpenCV exception caught while resizing...";
-	}
+    try {
+        cv::Mat rImgCv = DkImage::qImage2Mat(resizedImg);
+        cv::Mat tmp;
+        cv::resize(rImgCv, tmp, cv::Size(s.width(), s.height()), 0, 0, CV_INTER_AREA);
+        resizedImg = DkImage::mat2QImage(tmp);
+    } catch (...) {
+        qWarning() << "DkImageStorage: OpenCV exception caught while resizing...";
+    }
 #else
-	resizedImg = resizedImg.scaled(s, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+    resizedImg = resizedImg.scaled(s, Qt::KeepAspectRatio, Qt::SmoothTransformation);
 #endif
 
-	return resizedImg;
+    return resizedImg;
 }
 
-void DkImageStorage::imageComputed() {
-
-	if (mComputeState == l_cancelled) {
-		mComputeState = l_not_computed;
-		return;
-	}
+void DkImageStorage::imageComputed()
+{
+    if (mComputeState == l_cancelled) {
+        mComputeState = l_not_computed;
+        return;
+    }
 
-	mScaledImg = mFutureWatcher.result();
+    mScaledImg = mFutureWatcher.result();
 
-	mComputeState = (mScaledImg.isNull()) ? l_empty : l_computed;
+    mComputeState = (mScaledImg.isNull()) ? l_empty : l_computed;
 
-	if (mComputeState == l_computed)
-		emit imageUpdated();
-	else
-		qWarning() << "could not compute interpolated image...";
+    if (mComputeState == l_computed)
+        emit imageUpdated();
+    else
+        qWarning() << "could not compute interpolated image...";
 }
 }
diff --git a/ImageLounge/src/DkCore/DkImageStorage.h b/ImageLounge/src/DkCore/DkImageStorage.h
index 7340677..691cfce 100644
--- a/ImageLounge/src/DkCore/DkImageStorage.h
+++ b/ImageLounge/src/DkCore/DkImageStorage.h
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkImageStorage.h
  Created on:	12.07.2013
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -27,12 +27,12 @@
 
 #pragma once
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QImage>
-#include <QVector>
-#include <QObject>
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QColor>
 #include <QFutureWatcher>
+#include <QImage>
+#include <QObject>
+#include <QVector>
 
 // opencv
 #ifdef WITH_OPENCV
@@ -40,11 +40,11 @@
 #include "opencv2/imgproc/imgproc.hpp"
 #include "opencv2/imgproc/imgproc_c.h"
 #endif
-#pragma warning(pop)		// no warnings from includes - end
+#pragma warning(pop) // no warnings from includes - end
 
 #ifdef Q_OS_WIN
-#pragma warning(disable: 4251)	// TODO: remove
-#pragma warning(disable: 4714)	// Qt's force inline
+#pragma warning(disable : 4251) // TODO: remove
+#pragma warning(disable : 4714) // Qt's force inline
 #endif
 
 #if defined(__GNUC__) && defined(Q_OS_MAC) || defined(__clang__)
@@ -68,146 +68,140 @@ class QSize;
 class QColor;
 class QTimer;
 
-namespace nmc {
-
+namespace nmc
+{
 class DkRotatingRect;
 
 /**
  * DkImage holds some basic image processing
  * methods that are generally needed.
- **/ 
-class DllCoreExport DkImage {
-
+ **/
+class DllCoreExport DkImage
+{
 public:
-
-	/**< interpolation mapping OpenCV -> Qt */
-	enum {
-		ipl_nearest, 
-		ipl_area, 
-		ipl_linear, 
-		ipl_cubic, 
-		ipl_lanczos, 
-		ipl_end};
+    /**< interpolation mapping OpenCV -> Qt */
+    enum { ipl_nearest, ipl_area, ipl_linear, ipl_cubic, ipl_lanczos, ipl_end };
 
 #ifdef WITH_OPENCV
-	static cv::Mat qImage2Mat(const QImage& img);
-	static QImage mat2QImage(cv::Mat img);
-	static cv::Mat get1DGauss(double sigma);
-	static void mapGammaTable(cv::Mat& img, const QVector<unsigned short>& gammaTable);
-	static void gammaToLinear(cv::Mat& img);
-	static void linearToGamma(cv::Mat& img);
-	static void logPolar(const cv::Mat& src, cv::Mat& dst, cv::Point2d center, double scaleLog, double angle, double scale = 1.0);
-	static void tinyPlanet(QImage& img, double scaleLog, double angle, QSize s, bool invert = false);
+    static cv::Mat qImage2Mat(const QImage &img);
+    static QImage mat2QImage(cv::Mat img);
+    static cv::Mat get1DGauss(double sigma);
+    static void mapGammaTable(cv::Mat &img, const QVector<unsigned short> &gammaTable);
+    static void gammaToLinear(cv::Mat &img);
+    static void linearToGamma(cv::Mat &img);
+    static void logPolar(const cv::Mat &src, cv::Mat &dst, cv::Point2d center, double scaleLog, double angle, double scale = 1.0);
+    static void tinyPlanet(QImage &img, double scaleLog, double angle, QSize s, bool invert = false);
 #endif
 
-	static QString getBufferSize(const QImage& img);
-	static QString getBufferSize(const QSize& imgSize, const int depth);
-	static float getBufferSizeFloat(const QSize& imgSize, const int depth);
-	static QImage resizeImage(const QImage& img, const QSize& newSize, double factor = 1.0, int interpolation = ipl_cubic, bool correctGamma = true);
-
-	template <typename numFmt>
-	static QVector<numFmt> getGamma2LinearTable(int maxVal = USHRT_MAX);
-	template <typename numFmt>
-	static QVector<numFmt> getLinear2GammaTable(int maxVal = USHRT_MAX);
-	static void gammaToLinear(QImage& img);
-	static void linearToGamma(QImage& img);
-	static void mapGammaTable(QImage& img, const QVector<uchar>& gammaTable);
-	static QImage normImage(const QImage& img);
-	static bool normImage(QImage& img);
-	static QImage autoAdjustImage(const QImage& img);
-	static bool autoAdjustImage(QImage& img);
-	static bool gaussianBlur(QImage& img, float sigma = 20.0f);
-	static bool unsharpMask(QImage& img, float sigma = 20.0f, float weight = 1.5f);
-	static bool alphaChannelUsed(const QImage& img);
-	static QImage thresholdImage(const QImage& img, double thr, bool color = false);
-	static QImage rotate(const QImage& img, double angle);
-	static QImage grayscaleImage(const QImage& img);
-	static QPixmap colorizePixmap(const QPixmap& icon, const QColor& col, float opacity = 1.0f);
-	static QPixmap loadIcon(const QString& filePath = QString(), const QSize& size = QSize(), const QColor& col = QColor());
-	static QPixmap loadFromSvg(const QString& filePath, const QSize& size);
-	static QImage createThumb(const QImage& img, const int maxSize = -1);
-	static bool addToImage(QImage& img, unsigned char val = 1);
-	static QColor getMeanColor(const QImage& img);
-	static uchar findHistPeak(const int* hist, float quantile = 0.005f);
-	static QPixmap makeSquare(const QPixmap& pm);
-	static QPixmap merge(const QVector<QImage>& imgs);
-	static QImage cropToImage(const QImage& src, const QRect& cropRect, const QTransform& t, const QColor& fillColor = QColor());
-	static QImage cropToImage(const QImage& src, const DkRotatingRect& rect, const QColor& fillColor = QColor());
-	static QImage hueSaturation(const QImage& src, int hue, int sat, int brightness);
-	static QImage exposure(const QImage& src, double exposure, double offset, double gamma);
-	static QImage bgColor(const QImage& src, const QColor& col);
-	static QByteArray extractImageFromDataStream(const QByteArray& ba, const QByteArray& beginSignature = "‰PNG", const QByteArray& endSignature = "END®B`‚", bool debugOutput = false);
-	static QByteArray fixSamsungPanorama(QByteArray& ba);
-	static int intFromByteArray(const QByteArray& ba, int pos);
-	
+    static QString getBufferSize(const QImage &img);
+    static QString getBufferSize(const QSize &imgSize, const int depth);
+    static float getBufferSizeFloat(const QSize &imgSize, const int depth);
+    static QImage resizeImage(const QImage &img, const QSize &newSize, double factor = 1.0, int interpolation = ipl_cubic, bool correctGamma = true);
+
+    template<typename numFmt>
+    static QVector<numFmt> getGamma2LinearTable(int maxVal = USHRT_MAX);
+    template<typename numFmt>
+    static QVector<numFmt> getLinear2GammaTable(int maxVal = USHRT_MAX);
+    static void gammaToLinear(QImage &img);
+    static void linearToGamma(QImage &img);
+    static void mapGammaTable(QImage &img, const QVector<uchar> &gammaTable);
+    static QImage normImage(const QImage &img);
+    static bool normImage(QImage &img);
+    static QImage autoAdjustImage(const QImage &img);
+    static bool autoAdjustImage(QImage &img);
+    static bool gaussianBlur(QImage &img, float sigma = 20.0f);
+    static bool unsharpMask(QImage &img, float sigma = 20.0f, float weight = 1.5f);
+    static bool alphaChannelUsed(const QImage &img);
+    static QImage thresholdImage(const QImage &img, double thr, bool color = false);
+    static QImage rotateImage(const QImage &img, double angle);
+    static QImage grayscaleImage(const QImage &img);
+    static QPixmap colorizePixmap(const QPixmap &icon, const QColor &col, float opacity = 1.0f);
+    static QPixmap loadIcon(const QString &filePath = QString(), const QSize &size = QSize(), const QColor &col = QColor());
+    static QPixmap loadIcon(const QString &filePath, const QColor &col, const QSize &size = QSize());
+    static QPixmap loadFromSvg(const QString &filePath, const QSize &size);
+    static QImage createThumb(const QImage &img, const int maxSize = -1);
+    static bool addToImage(QImage &img, unsigned char val = 1);
+    static QColor getMeanColor(const QImage &img);
+    static uchar findHistPeak(const int *hist, float quantile = 0.005f);
+    static QPixmap makeSquare(const QPixmap &pm);
+    static QPixmap merge(const QVector<QImage> &imgs);
+    static QImage cropToImage(const QImage &src, const DkRotatingRect &rect, const QColor &fillColor = QColor());
+    static QImage hueSaturation(const QImage &src, int hue, int sat, int brightness);
+    static QImage exposure(const QImage &src, double exposure, double offset, double gamma);
+    static QImage bgColor(const QImage &src, const QColor &col);
+    static QByteArray extractImageFromDataStream(const QByteArray &ba,
+                                                 const QByteArray &beginSignature = "‰PNG",
+                                                 const QByteArray &endSignature = "END®B`‚",
+                                                 bool debugOutput = false);
+    static QByteArray fixSamsungPanorama(QByteArray &ba);
+    static int intFromByteArray(const QByteArray &ba, int pos);
+
 #ifdef WITH_OPENCV
-	static cv::Mat exposureMat(const cv::Mat& src, double exposure);
-	static cv::Mat gammaMat(const cv::Mat& src, double gmma);
-	static cv::Mat applyLUT(const cv::Mat& src, const cv::Mat& lut);
+    static cv::Mat exposureMat(const cv::Mat &src, double exposure);
+    static cv::Mat gammaMat(const cv::Mat &src, double gmma);
+    static cv::Mat applyLUT(const cv::Mat &src, const cv::Mat &lut);
 #endif // WITH_OPENCV
-
-private:
-	static QImage rotateSimple(const QImage& img, double angle);
-	
 };
 
-class DllCoreExport DkImageStorage : public QObject {
-	Q_OBJECT
+class DllCoreExport DkImageStorage : public QObject
+{
+    Q_OBJECT
 
 public:
-	DkImageStorage(const QImage& img = QImage());
+    DkImageStorage(const QImage &img = QImage());
 
-	enum ComputeState {
-		l_not_computed,
-		l_computing,
-		l_computed,
-		l_empty,
-		l_cancelled,
+    enum ComputeState {
+        l_not_computed,
+        l_computing,
+        l_computed,
+        l_empty,
+        l_cancelled,
 
-		l_end
-	};
+        l_end
+    };
 
-	bool isEmpty() const {
-		return mImg.isNull();
-	};
+    bool isEmpty() const
+    {
+        return mImg.isNull();
+    };
 
-	QSize size() const {
-		return mImg.size();
-	};
+    QSize size() const
+    {
+        return mImg.size();
+    };
 
-	void setImage(const QImage& img);
-	QImage imageConst() const;
-	QImage image(const QSize& size = QSize());
-	void cancel();
+    void setImage(const QImage &img);
+    QImage imageConst() const;
+    QImage image(const QSize &size = QSize());
+    void cancel();
 
 public slots:
-	void antiAliasingChanged(bool antiAliasing);
-	void imageComputed();
-	void compute();
+    void antiAliasingChanged(bool antiAliasing);
+    void imageComputed();
+    void compute();
 
 signals:
-	void imageUpdated() const;
-	void infoSignal(const QString& msg) const;
+    void imageUpdated() const;
+    void infoSignal(const QString &msg) const;
 
 protected:
-	QImage mImg;
-	QImage mScaledImg;
-	QSize mSize;
-
-	QTimer* mWaitTimer = 0;
-	QFutureWatcher<QImage> mFutureWatcher;
+    QImage mImg;
+    QImage mScaledImg;
+    QSize mSize;
 
-	ComputeState mComputeState = l_not_computed;
+    QTimer *mWaitTimer = 0;
+    QFutureWatcher<QImage> mFutureWatcher;
 
-	QImage computeIntern(const QImage& src, const QSize& size);
-	void init();
+    ComputeState mComputeState = l_not_computed;
 
+    QImage computeIntern(const QImage &src, const QSize &size);
+    void init();
 };
 //
-//class DllCoreExport DkImageStorage : public QObject {
+// class DllCoreExport DkImageStorage : public QObject {
 //	Q_OBJECT
 //
-//public:
+// public:
 //	DkImageStorage(const QImage& img = QImage());
 //
 //	void setImage(const QImage& img);
@@ -217,15 +211,15 @@ protected:
 //		return !mImg.isNull();
 //	}
 //
-//public slots:
+// public slots:
 //	void antiAliasingChanged(bool antiAliasing);
 //	void computeImage(double scale);
 //
-//signals:
+// signals:
 //	void imageUpdated() const;
 //	void infoSignal(const QString& msg) const;
 //
-//protected:
+// protected:
 //	QImage mImg;
 //	QVector<QImage> mImgs;
 //
diff --git a/ImageLounge/src/DkCore/DkManipulators.cpp b/ImageLounge/src/DkCore/DkManipulators.cpp
index 67949fa..18ace67 100644
--- a/ImageLounge/src/DkCore/DkManipulators.cpp
+++ b/ImageLounge/src/DkCore/DkManipulators.cpp
@@ -1,6 +1,6 @@
 /*******************************************************************************************************
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2016 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2016 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2016 Florian Kleber <florian@nomacs.org>
@@ -29,271 +29,288 @@
 #include "DkManipulators.h"
 #include "DkManipulatorsIpl.h"
 
-#include "DkImageStorage.h"
 #include "DkImageContainer.h"
+#include "DkImageStorage.h"
 #include "DkSettings.h"
 
-#pragma warning(push, 0)	// no warnings from includes
+#pragma warning(push, 0) // no warnings from includes
 #include <QSharedPointer>
 #include <QWidget>
 #pragma warning(pop)
 
-namespace nmc {
+namespace nmc
+{
 
 // DkBaseManipulator --------------------------------------------------------------------
-DkBaseManipulator::DkBaseManipulator(QAction * action) {
-	
-	mAction = action;
-	
-	// add default icon
-	if (mAction->icon().isNull()) {
-		QSize size(22, 22);
-		mAction->setIcon(DkImage::loadIcon(":/nomacs/img/sliders.svg", size));
-	}
+DkBaseManipulator::DkBaseManipulator(QAction *action)
+{
+    mAction = action;
+
+    // add default icon
+    if (mAction->icon().isNull()) {
+        QSize size(22, 22);
+        mAction->setIcon(DkImage::loadIcon(":/nomacs/img/sliders.svg", size));
+    }
 }
 
-QString DkBaseManipulator::name() const {
-	QString text = mAction->iconText();
-	return text.remove("&");
+QString DkBaseManipulator::name() const
+{
+    QString text = mAction->iconText();
+    return text.remove("&");
 }
 
-QAction* DkBaseManipulator::action() const {
-	return mAction;
+QAction *DkBaseManipulator::action() const
+{
+    return mAction;
 }
 
-QIcon DkBaseManipulator::icon() const {
-	return mAction->icon();
+QIcon DkBaseManipulator::icon() const
+{
+    return mAction->icon();
 }
 
 // DkManipulatorManager --------------------------------------------------------------------
-DkManipulatorManager::DkManipulatorManager() {
+DkManipulatorManager::DkManipulatorManager()
+{
 }
 
-void DkManipulatorManager::createManipulators(QWidget* parent) {
-
-	if (!mManipulators.empty())
-		return;
-
-	QVector<QSharedPointer<DkBaseManipulator> > mpls;
-	mpls.resize(m_ext_end);
-
-	QSize size(22, 22);
-
-	// grayscale
-	QAction* action;
-	action = new QAction(DkImage::loadIcon(":/nomacs/img/grayscale.svg", size), QObject::tr("&Grayscale"), parent);
-	action->setStatusTip(QObject::tr("Convert to Grayscale"));
-	mpls[m_grayscale] = QSharedPointer<DkGrayScaleManipulator>::create(action);
-
-	// auto adjust
-	action = new QAction(DkImage::loadIcon(":/nomacs/img/auto-adjust.svg", size), QObject::tr("&Auto Adjust"), parent);
-	action->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_L);
-	action->setStatusTip(QObject::tr("Auto Adjust Image Contrast and Color Balance"));
-	mpls[m_auto_adjust] = QSharedPointer<DkAutoAdjustManipulator>::create(action);
-
-	// normalize
-	action = new QAction(DkImage::loadIcon(":/nomacs/img/normalize.svg", size), QObject::tr("Nor&malize Image"), parent);
-	action->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_N);
-	action->setStatusTip(QObject::tr("Normalize the Image"));
-	mpls[m_normalize] = QSharedPointer<DkNormalizeManipulator>::create(action);
-
-	// flip horizontal
-	action = new QAction(DkImage::loadIcon(":/nomacs/img/flip-horizontal.svg", size), QObject::tr("Flip &Horizontal"), parent);
-	action->setStatusTip(QObject::tr("Flip Image Horizontally"));
-	mpls[m_flip_h] = QSharedPointer<DkFlipHManipulator>::create(action);
-
-	// flip vertical
-	action = new QAction(DkImage::loadIcon(":/nomacs/img/flip-vertical.svg", size), QObject::tr("Flip &Vertical"), parent);
-	action->setStatusTip(QObject::tr("Flip Image Vertically"));
-	mpls[m_flip_v] = QSharedPointer<DkFlipVManipulator>::create(action);
-
-	// invert image
-	action = new QAction(DkImage::loadIcon(":/nomacs/img/invert.svg", size), QObject::tr("&Invert Image"), parent);
-	action->setStatusTip(QObject::tr("Invert the Image"));
-	mpls[m_invert] = QSharedPointer<DkInvertManipulator>::create(action);
-
-	// extended --------------------------------------------------------------------
-	// tiny planet
-	action = new QAction(DkImage::loadIcon(":/nomacs/img/tiny-planet.svg", size), QObject::tr("&Tiny Planet..."), parent);
-	action->setStatusTip(QObject::tr("Create a Tiny Planet"));
-	mpls[m_tiny_planet] = QSharedPointer<DkTinyPlanetManipulator>::create(action);
-
-	// tiny planet
-	action = new QAction(DkImage::loadIcon(":/nomacs/img/bucket.svg", size), QObject::tr("&Background Color..."), parent);
-	action->setStatusTip(QObject::tr("Add a background color"));
-	mpls[m_color] = QSharedPointer<DkColorManipulator>::create(action);
-
-	// blur
-	action = new QAction(DkImage::loadIcon(":/nomacs/img/blur.svg", size), QObject::tr("&Blur..."), parent);
-	action->setStatusTip(QObject::tr("Blur the image"));
-	mpls[m_blur] = QSharedPointer<DkBlurManipulator>::create(action);
-
-	// unsharp mask
-	action = new QAction(DkImage::loadIcon(":/nomacs/img/sharpen.svg", size), QObject::tr("&Sharpen..."), parent);
-	action->setStatusTip(QObject::tr("Sharpens the image by applying an unsharp mask"));
-	mpls[m_unsharp_mask] = QSharedPointer<DkUnsharpMaskManipulator>::create(action);
-
-	// rotate
-	action = new QAction(DkImage::loadIcon(":/nomacs/img/rotate-cc.svg", size), QObject::tr("&Rotate..."), parent);
-	action->setStatusTip(QObject::tr("Rotate the image"));
-	mpls[m_rotate] = QSharedPointer<DkRotateManipulator>::create(action);
-
-	// resize
-	action = new QAction(DkImage::loadIcon(":/nomacs/img/resize.svg", size), QObject::tr("&Resize..."), parent);
-	action->setStatusTip(QObject::tr("Resize the image"));
-	mpls[m_resize] = QSharedPointer<DkResizeManipulator>::create(action);
-
-	// threshold
-	action = new QAction(DkImage::loadIcon(":/nomacs/img/threshold.svg", size), QObject::tr("&Threshold..."), parent);
-	action->setStatusTip(QObject::tr("Threshold the image"));
-	mpls[m_threshold] = QSharedPointer<DkThresholdManipulator>::create(action);
-
-	// hue/saturation
-	action = new QAction(DkImage::loadIcon(":/nomacs/img/sliders.svg", size), QObject::tr("&Hue/Saturation..."), parent);
-	action->setStatusTip(QObject::tr("Change Hue and Saturation"));
-	mpls[m_hue] = QSharedPointer<DkHueManipulator>::create(action);
-
-	// exposure
-	action = new QAction(DkImage::loadIcon(":/nomacs/img/exposure.svg", size), QObject::tr("&Exposure..."), parent);
-	action->setStatusTip(QObject::tr("Change the Exposure and Gamma"));
-	mpls[m_exposure] = QSharedPointer<DkExposureManipulator>::create(action);
-
-	mManipulators = mpls;
+void DkManipulatorManager::createManipulators(QWidget *parent)
+{
+    if (!mManipulators.empty())
+        return;
+
+    QVector<QSharedPointer<DkBaseManipulator>> mpls;
+    mpls.resize(m_ext_end);
+
+    QSize size(22, 22);
+
+    // grayscale
+    QAction *action;
+    action = new QAction(DkImage::loadIcon(":/nomacs/img/grayscale.svg", size), QObject::tr("&Grayscale"), parent);
+    action->setStatusTip(QObject::tr("Convert to Grayscale"));
+    mpls[m_grayscale] = QSharedPointer<DkGrayScaleManipulator>::create(action);
+
+    // auto adjust
+    action = new QAction(DkImage::loadIcon(":/nomacs/img/auto-adjust.svg", size), QObject::tr("&Auto Adjust"), parent);
+    action->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_L);
+    action->setStatusTip(QObject::tr("Auto Adjust Image Contrast and Color Balance"));
+    mpls[m_auto_adjust] = QSharedPointer<DkAutoAdjustManipulator>::create(action);
+
+    // normalize
+    action = new QAction(DkImage::loadIcon(":/nomacs/img/normalize.svg", size), QObject::tr("Nor&malize Image"), parent);
+    action->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_N);
+    action->setStatusTip(QObject::tr("Normalize the Image"));
+    mpls[m_normalize] = QSharedPointer<DkNormalizeManipulator>::create(action);
+
+    // flip horizontal
+    action = new QAction(DkImage::loadIcon(":/nomacs/img/flip-horizontal.svg", size), QObject::tr("Flip &Horizontal"), parent);
+    action->setStatusTip(QObject::tr("Flip Image Horizontally"));
+    mpls[m_flip_h] = QSharedPointer<DkFlipHManipulator>::create(action);
+
+    // flip vertical
+    action = new QAction(DkImage::loadIcon(":/nomacs/img/flip-vertical.svg", size), QObject::tr("Flip &Vertical"), parent);
+    action->setStatusTip(QObject::tr("Flip Image Vertically"));
+    mpls[m_flip_v] = QSharedPointer<DkFlipVManipulator>::create(action);
+
+    // invert image
+    action = new QAction(DkImage::loadIcon(":/nomacs/img/invert.svg", size), QObject::tr("&Invert Image"), parent);
+    action->setStatusTip(QObject::tr("Invert the Image"));
+    mpls[m_invert] = QSharedPointer<DkInvertManipulator>::create(action);
+
+    // extended --------------------------------------------------------------------
+    // tiny planet
+    action = new QAction(DkImage::loadIcon(":/nomacs/img/tiny-planet.svg", size), QObject::tr("&Tiny Planet..."), parent);
+    action->setStatusTip(QObject::tr("Create a Tiny Planet"));
+    mpls[m_tiny_planet] = QSharedPointer<DkTinyPlanetManipulator>::create(action);
+
+    // tiny planet
+    action = new QAction(DkImage::loadIcon(":/nomacs/img/bucket.svg", size), QObject::tr("&Background Color..."), parent);
+    action->setStatusTip(QObject::tr("Add a background color"));
+    mpls[m_color] = QSharedPointer<DkColorManipulator>::create(action);
+
+    // blur
+    action = new QAction(DkImage::loadIcon(":/nomacs/img/blur.svg", size), QObject::tr("&Blur..."), parent);
+    action->setStatusTip(QObject::tr("Blur the image"));
+    mpls[m_blur] = QSharedPointer<DkBlurManipulator>::create(action);
+
+    // unsharp mask
+    action = new QAction(DkImage::loadIcon(":/nomacs/img/sharpen.svg", size), QObject::tr("&Sharpen..."), parent);
+    action->setStatusTip(QObject::tr("Sharpens the image by applying an unsharp mask"));
+    mpls[m_unsharp_mask] = QSharedPointer<DkUnsharpMaskManipulator>::create(action);
+
+    // rotate
+    action = new QAction(DkImage::loadIcon(":/nomacs/img/rotate-cc.svg", size), QObject::tr("&Rotate..."), parent);
+    action->setStatusTip(QObject::tr("Rotate the image"));
+    mpls[m_rotate] = QSharedPointer<DkRotateManipulator>::create(action);
+
+    // resize
+    action = new QAction(DkImage::loadIcon(":/nomacs/img/resize.svg", size), QObject::tr("&Resize..."), parent);
+    action->setStatusTip(QObject::tr("Resize the image"));
+    mpls[m_resize] = QSharedPointer<DkResizeManipulator>::create(action);
+
+    // threshold
+    action = new QAction(DkImage::loadIcon(":/nomacs/img/threshold.svg", size), QObject::tr("&Threshold..."), parent);
+    action->setStatusTip(QObject::tr("Threshold the image"));
+    mpls[m_threshold] = QSharedPointer<DkThresholdManipulator>::create(action);
+
+    // hue/saturation
+    action = new QAction(DkImage::loadIcon(":/nomacs/img/sliders.svg", size), QObject::tr("&Hue/Saturation..."), parent);
+    action->setStatusTip(QObject::tr("Change Hue and Saturation"));
+    mpls[m_hue] = QSharedPointer<DkHueManipulator>::create(action);
+
+    // exposure
+    action = new QAction(DkImage::loadIcon(":/nomacs/img/exposure.svg", size), QObject::tr("&Exposure..."), parent);
+    action->setStatusTip(QObject::tr("Change the Exposure and Gamma"));
+    mpls[m_exposure] = QSharedPointer<DkExposureManipulator>::create(action);
+
+    mManipulators = mpls;
 }
 
-QVector<QAction*> DkManipulatorManager::actions() const {
-	
-	QVector<QAction*> aVec;
+QVector<QAction *> DkManipulatorManager::actions() const
+{
+    QVector<QAction *> aVec;
 
-	for (auto m : mManipulators)
-		aVec << m->action();
-	
-	return aVec;
-}
+    for (auto m : mManipulators)
+        aVec << m->action();
 
-QStringList DkManipulatorManager::names() const {
-	
-	QStringList cNames;
-	for (auto mpl : mManipulators)
-		cNames << mpl->name();
-	
-	return cNames;
+    return aVec;
 }
 
-QSharedPointer<DkBaseManipulatorExt> DkManipulatorManager::manipulatorExt(const ManipulatorExtId & mId) const {
-	return qSharedPointerCast<DkBaseManipulatorExt>(mManipulators[mId]);
+QStringList DkManipulatorManager::names() const
+{
+    QStringList cNames;
+    for (auto mpl : mManipulators)
+        cNames << mpl->name();
+
+    return cNames;
 }
 
-QSharedPointer<DkBaseManipulator> DkManipulatorManager::manipulator(const ManipulatorId & mId) const {
-	return mManipulators[mId];
+QSharedPointer<DkBaseManipulatorExt> DkManipulatorManager::manipulatorExt(const ManipulatorExtId &mId) const
+{
+    return qSharedPointerCast<DkBaseManipulatorExt>(mManipulators[mId]);
 }
 
-QSharedPointer<DkBaseManipulator> DkManipulatorManager::manipulator(const QAction * action) const {
+QSharedPointer<DkBaseManipulator> DkManipulatorManager::manipulator(const ManipulatorId &mId) const
+{
+    return mManipulators[mId];
+}
 
-	for (const QSharedPointer<DkBaseManipulator>& m : mManipulators) {
-		if (m->action() == action)
-			return m;
-	}
+QSharedPointer<DkBaseManipulator> DkManipulatorManager::manipulator(const QAction *action) const
+{
+    for (const QSharedPointer<DkBaseManipulator> &m : mManipulators) {
+        if (m->action() == action)
+            return m;
+    }
 
-	if (action)
-		qWarning() << "no manipulator matches" << action;
+    if (action)
+        qWarning() << "no manipulator matches" << action;
 
-	return QSharedPointer<DkBaseManipulator>();
+    return QSharedPointer<DkBaseManipulator>();
 }
 
-QSharedPointer<DkBaseManipulator> DkManipulatorManager::manipulator(const QString& name) const {
-
-	for (const QSharedPointer<DkBaseManipulator>& m : mManipulators) {
-		if (m->name() == name)
-			return m;
-	}
+QSharedPointer<DkBaseManipulator> DkManipulatorManager::manipulator(const QString &name) const
+{
+    for (const QSharedPointer<DkBaseManipulator> &m : mManipulators) {
+        if (m->name() == name)
+            return m;
+    }
 
-	qWarning() << "no manipulator matches" << name;
+    qWarning() << "no manipulator matches" << name;
 
-	return QSharedPointer<DkBaseManipulator>();
+    return QSharedPointer<DkBaseManipulator>();
 }
 
-QVector<QSharedPointer<DkBaseManipulator>> DkManipulatorManager::manipulators() const {
-	return mManipulators;
+QVector<QSharedPointer<DkBaseManipulator>> DkManipulatorManager::manipulators() const
+{
+    return mManipulators;
 }
 
-int DkManipulatorManager::numSelected() const {
+int DkManipulatorManager::numSelected() const
+{
+    int nSel = 0;
+    for (auto mpl : mManipulators) {
+        if (mpl->isSelected())
+            nSel++;
+    }
 
-	int nSel = 0;
-	for (auto mpl : mManipulators) {
-		if (mpl->isSelected())
-			nSel++;
-	}
-
-	return nSel;
+    return nSel;
 }
 
-void DkManipulatorManager::loadSettings(QSettings & settings) {
-
-	settings.beginGroup("Manipulators");
+void DkManipulatorManager::loadSettings(QSettings &settings)
+{
+    settings.beginGroup("Manipulators");
 
-	DkManipulatorManager::createManipulators(0);
+    DkManipulatorManager::createManipulators(0);
 
-	for (auto mpl : mManipulators)
-		mpl->loadSettings(settings);
+    for (auto mpl : mManipulators)
+        mpl->loadSettings(settings);
 
-	settings.endGroup();
+    settings.endGroup();
 }
 
-void DkManipulatorManager::saveSettings(QSettings & settings) const {
-
-	settings.beginGroup("Manipulators");
+void DkManipulatorManager::saveSettings(QSettings &settings) const
+{
+    settings.beginGroup("Manipulators");
 
-	for (auto mpl : mManipulators)
-		mpl->saveSettings(settings);
+    for (auto mpl : mManipulators)
+        mpl->saveSettings(settings);
 
-	settings.endGroup();
+    settings.endGroup();
 }
 
-void DkBaseManipulator::setSelected(bool select) {
-	mIsSelected = select;
+void DkBaseManipulator::setSelected(bool select)
+{
+    mIsSelected = select;
 }
 
-bool DkBaseManipulator::isSelected() const {
-	return mIsSelected;
+bool DkBaseManipulator::isSelected() const
+{
+    return mIsSelected;
 }
 
-QString DkBaseManipulator::errorMessage() const {
-	return "";
+QString DkBaseManipulator::errorMessage() const
+{
+    return "";
 }
 
-void DkBaseManipulator::saveSettings(QSettings & settings) {
-
-	settings.beginGroup(name());
-	settings.setValue("selected", isSelected());
-	settings.endGroup();
+void DkBaseManipulator::saveSettings(QSettings &settings)
+{
+    settings.beginGroup(name());
+    settings.setValue("selected", isSelected());
+    settings.endGroup();
 }
 
-void DkBaseManipulator::loadSettings(QSettings & settings) {
-
-	settings.beginGroup(name());
-	mIsSelected = settings.value("selected", isSelected()).toBool();
-	settings.endGroup();
+void DkBaseManipulator::loadSettings(QSettings &settings)
+{
+    settings.beginGroup(name());
+    mIsSelected = settings.value("selected", isSelected()).toBool();
+    settings.endGroup();
 }
 
 // DkBaseMainpulatorExt --------------------------------------------------------------------
-DkBaseManipulatorExt::DkBaseManipulatorExt(QAction * action) : DkBaseManipulator(action) {
+DkBaseManipulatorExt::DkBaseManipulatorExt(QAction *action)
+    : DkBaseManipulator(action)
+{
 }
 
-void DkBaseManipulatorExt::setWidget(QWidget * widget) {
-	mWidget = widget;
+void DkBaseManipulatorExt::setWidget(QWidget *widget)
+{
+    mWidget = widget;
 }
 
-QWidget * DkBaseManipulatorExt::widget() const {
-	return mWidget;
+QWidget *DkBaseManipulatorExt::widget() const
+{
+    return mWidget;
 }
 
-void DkBaseManipulatorExt::setDirty(bool dirty) {
-	mDirty = dirty;
+void DkBaseManipulatorExt::setDirty(bool dirty)
+{
+    mDirty = dirty;
 }
 
-bool DkBaseManipulatorExt::isDirty() const {
-	return mDirty;
+bool DkBaseManipulatorExt::isDirty() const
+{
+    return mDirty;
 }
 
-}
\ No newline at end of file
+}
diff --git a/ImageLounge/src/DkCore/DkManipulators.h b/ImageLounge/src/DkCore/DkManipulators.h
index 22bfce8..fab0323 100644
--- a/ImageLounge/src/DkCore/DkManipulators.h
+++ b/ImageLounge/src/DkCore/DkManipulators.h
@@ -1,6 +1,6 @@
 /*******************************************************************************************************
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2016 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2016 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2016 Florian Kleber <florian@nomacs.org>
@@ -28,12 +28,12 @@
 
 #pragma once
 
-#pragma warning(push, 0)	// no warnings from includes
+#pragma warning(push, 0) // no warnings from includes
 #include <QAction>
 #include <QSettings>
 #pragma warning(pop)
 
-#pragma warning(disable: 4251)	// TODO: remove
+#pragma warning(disable : 4251) // TODO: remove
 
 #ifndef DllCoreExport
 #ifdef DK_CORE_DLL_EXPORT
@@ -47,7 +47,8 @@
 
 // Qt defines
 
-namespace nmc {
+namespace nmc
+{
 
 // nomacs defines
 class DkImageContainer;
@@ -59,27 +60,27 @@ class DkImageContainer;
 /// If this class is extended, batch processing
 /// can make use of it too.
 /// </summary>
-class DllCoreExport DkBaseManipulator {
-
+class DllCoreExport DkBaseManipulator
+{
 public:
-	DkBaseManipulator(QAction* action = 0);
+    DkBaseManipulator(QAction *action = 0);
 
-	QString name() const;
-	QAction* action() const;
-	QIcon icon() const;
+    QString name() const;
+    QAction *action() const;
+    QIcon icon() const;
 
-	void setSelected(bool select);
-	bool isSelected() const;
+    void setSelected(bool select);
+    bool isSelected() const;
 
-	virtual QString errorMessage() const = 0;
-	virtual QImage apply(const QImage& img) const = 0;
+    virtual QString errorMessage() const = 0;
+    virtual QImage apply(const QImage &img) const = 0;
 
-	virtual void saveSettings(QSettings& settings);
-	virtual void loadSettings(QSettings& settings);
+    virtual void saveSettings(QSettings &settings);
+    virtual void loadSettings(QSettings &settings);
 
 private:
-	QAction* mAction = 0;
-	bool mIsSelected = false;
+    QAction *mAction = 0;
+    bool mIsSelected = false;
 };
 
 /// <summary>
@@ -89,71 +90,71 @@ private:
 /// the settings.
 /// </summary>
 /// <seealso cref="DkBaseManipulator" />
-class DllCoreExport DkBaseManipulatorExt : public DkBaseManipulator {
-
+class DllCoreExport DkBaseManipulatorExt : public DkBaseManipulator
+{
 public:
-	DkBaseManipulatorExt(QAction* action);
+    DkBaseManipulatorExt(QAction *action);
 
-	void setWidget(QWidget* widget);
-	QWidget* widget() const;
+    void setWidget(QWidget *widget);
+    QWidget *widget() const;
 
-	void setDirty(bool dirty);
-	bool isDirty() const;
+    void setDirty(bool dirty);
+    bool isDirty() const;
 
 private:
-	bool mDirty = false;
-	QWidget* mWidget = 0;
+    bool mDirty = false;
+    QWidget *mWidget = 0;
 };
 
-class DllCoreExport DkManipulatorManager {
-
+class DllCoreExport DkManipulatorManager
+{
 public:
-	DkManipulatorManager();
-
-	// simple manipulators
-	enum ManipulatorId {
-		m_grayscale = 0,
-		m_auto_adjust,
-		m_normalize,
-		m_invert,
-		m_flip_h,
-		m_flip_v,
-
-		m_end
-	};
-
-	// extended manipulators
-	enum ManipulatorExtId {
-		m_rotate = m_end,
-		m_resize,
-		m_threshold,
-		m_color,
-		m_hue,
-		m_exposure, 
-		m_tiny_planet,
-		m_blur,
-		m_unsharp_mask,
-		
-		m_ext_end
-	};
-
-	void createManipulators(QWidget* parent);
-
-	QVector<QAction*> actions() const;
-	QStringList names() const;
-	
-	QSharedPointer<DkBaseManipulatorExt> manipulatorExt(const ManipulatorExtId& mId) const;
-	QSharedPointer<DkBaseManipulator> manipulator(const ManipulatorId& mId) const;
-	QSharedPointer<DkBaseManipulator> manipulator(const QAction* action) const;
-	QSharedPointer<DkBaseManipulator> manipulator(const QString& name) const;
-	QVector<QSharedPointer<DkBaseManipulator> > manipulators() const;
-
-	int numSelected() const;
-
-	void loadSettings(QSettings & settings);
-	void saveSettings(QSettings & settings) const;
+    DkManipulatorManager();
+
+    // simple manipulators
+    enum ManipulatorId {
+        m_grayscale = 0,
+        m_auto_adjust,
+        m_normalize,
+        m_invert,
+        m_flip_h,
+        m_flip_v,
+
+        m_end
+    };
+
+    // extended manipulators
+    enum ManipulatorExtId {
+        m_rotate = m_end,
+        m_resize,
+        m_threshold,
+        m_color,
+        m_hue,
+        m_exposure,
+        m_tiny_planet,
+        m_blur,
+        m_unsharp_mask,
+
+        m_ext_end
+    };
+
+    void createManipulators(QWidget *parent);
+
+    QVector<QAction *> actions() const;
+    QStringList names() const;
+
+    QSharedPointer<DkBaseManipulatorExt> manipulatorExt(const ManipulatorExtId &mId) const;
+    QSharedPointer<DkBaseManipulator> manipulator(const ManipulatorId &mId) const;
+    QSharedPointer<DkBaseManipulator> manipulator(const QAction *action) const;
+    QSharedPointer<DkBaseManipulator> manipulator(const QString &name) const;
+    QVector<QSharedPointer<DkBaseManipulator>> manipulators() const;
+
+    int numSelected() const;
+
+    void loadSettings(QSettings &settings);
+    void saveSettings(QSettings &settings) const;
 
 private:
-	QVector<QSharedPointer<DkBaseManipulator> > mManipulators;
+    QVector<QSharedPointer<DkBaseManipulator>> mManipulators;
 };
 }
\ No newline at end of file
diff --git a/ImageLounge/src/DkCore/DkManipulatorsIpl.cpp b/ImageLounge/src/DkCore/DkManipulatorsIpl.cpp
index b8c7a36..eb8935c 100644
--- a/ImageLounge/src/DkCore/DkManipulatorsIpl.cpp
+++ b/ImageLounge/src/DkCore/DkManipulatorsIpl.cpp
@@ -1,6 +1,6 @@
 /*******************************************************************************************************
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2016 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2016 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2016 Florian Kleber <florian@nomacs.org>
@@ -31,470 +31,540 @@
 #include "DkImageStorage.h"
 #include "DkMath.h"
 
-#pragma warning(push, 0)	// no warnings from includes
-#include <QSharedPointer>
+#pragma warning(push, 0) // no warnings from includes
 #include <QDebug>
+#include <QSharedPointer>
 #pragma warning(pop)
 
-namespace nmc {
+namespace nmc
+{
 
 // DkGrayScaleManipulator --------------------------------------------------------------------
-DkGrayScaleManipulator::DkGrayScaleManipulator(QAction * action) : DkBaseManipulator(action) {
+DkGrayScaleManipulator::DkGrayScaleManipulator(QAction *action)
+    : DkBaseManipulator(action)
+{
 }
 
-QImage DkGrayScaleManipulator::apply(const QImage& img) const {
+QImage DkGrayScaleManipulator::apply(const QImage &img) const
+{
+    if (img.isNull())
+        return img;
 
-	if (img.isNull())
-		return img;
-
-	return DkImage::grayscaleImage(img);
+    return DkImage::grayscaleImage(img);
 }
 
-QString DkGrayScaleManipulator::errorMessage() const {
-	return QObject::tr("Could not convert to grayscale");
+QString DkGrayScaleManipulator::errorMessage() const
+{
+    return QObject::tr("Could not convert to grayscale");
 }
 
 // DkAutoAdjustManipulator --------------------------------------------------------------------
-DkAutoAdjustManipulator::DkAutoAdjustManipulator(QAction * action) : DkBaseManipulator(action) {
+DkAutoAdjustManipulator::DkAutoAdjustManipulator(QAction *action)
+    : DkBaseManipulator(action)
+{
 }
 
-QImage DkAutoAdjustManipulator::apply(const QImage & img) const {
-	
-	QImage imgR = img;
-	if (DkImage::autoAdjustImage(imgR))
-		return imgR;
+QImage DkAutoAdjustManipulator::apply(const QImage &img) const
+{
+    QImage imgR = img;
+    if (DkImage::autoAdjustImage(imgR))
+        return imgR;
 
-	return QImage();
+    return QImage();
 }
 
-QString DkAutoAdjustManipulator::errorMessage() const {
-	return QString(QObject::tr("Cannot auto adjust"));
+QString DkAutoAdjustManipulator::errorMessage() const
+{
+    return QString(QObject::tr("Cannot auto adjust"));
 }
 
 // DkNormalizeManipulator --------------------------------------------------------------------
-DkNormalizeManipulator::DkNormalizeManipulator(QAction * action) : DkBaseManipulator(action) {
+DkNormalizeManipulator::DkNormalizeManipulator(QAction *action)
+    : DkBaseManipulator(action)
+{
 }
 
-QImage DkNormalizeManipulator::apply(const QImage & img) const {
-	
-	QImage imgR = img;
-	if (DkImage::normImage(imgR)) {
-		return imgR;
-	}
+QImage DkNormalizeManipulator::apply(const QImage &img) const
+{
+    QImage imgR = img;
+    if (DkImage::normImage(imgR)) {
+        return imgR;
+    }
 
-	return QImage();
+    return QImage();
 }
 
-QString DkNormalizeManipulator::errorMessage() const {
-	return QObject::tr("The Image is Already Normalized...");
+QString DkNormalizeManipulator::errorMessage() const
+{
+    return QObject::tr("The Image is Already Normalized...");
 }
 
 // DkInvertManipulator --------------------------------------------------------------------
-DkInvertManipulator::DkInvertManipulator(QAction * action) : DkBaseManipulator(action) {
+DkInvertManipulator::DkInvertManipulator(QAction *action)
+    : DkBaseManipulator(action)
+{
 }
 
-QImage DkInvertManipulator::apply(const QImage & img) const {
-	
-	QImage imgR = img;
-	imgR.invertPixels();
-	return imgR;
+QImage DkInvertManipulator::apply(const QImage &img) const
+{
+    QImage imgR = img;
+    imgR.invertPixels();
+    return imgR;
 }
 
-QString DkInvertManipulator::errorMessage() const {
-	return QObject::tr("Cannot invert image");
+QString DkInvertManipulator::errorMessage() const
+{
+    return QObject::tr("Cannot invert image");
 }
 
 // Flip Horizontally --------------------------------------------------------------------
-DkFlipHManipulator::DkFlipHManipulator(QAction * action) : DkBaseManipulator(action) {
+DkFlipHManipulator::DkFlipHManipulator(QAction *action)
+    : DkBaseManipulator(action)
+{
 }
 
-QImage DkFlipHManipulator::apply(const QImage & img) const {
-	
-	return img.mirrored(true, false);
+QImage DkFlipHManipulator::apply(const QImage &img) const
+{
+    return img.mirrored(true, false);
 }
 
-QString DkFlipHManipulator::errorMessage() const {
-	return QObject::tr("Cannot flip image");
+QString DkFlipHManipulator::errorMessage() const
+{
+    return QObject::tr("Cannot flip image");
 }
 
 // Flip Vertically --------------------------------------------------------------------
-DkFlipVManipulator::DkFlipVManipulator(QAction * action) : DkBaseManipulator(action) {
+DkFlipVManipulator::DkFlipVManipulator(QAction *action)
+    : DkBaseManipulator(action)
+{
 }
 
-QImage DkFlipVManipulator::apply(const QImage & img) const {
-	return img.mirrored(false, true);
+QImage DkFlipVManipulator::apply(const QImage &img) const
+{
+    return img.mirrored(false, true);
 }
 
-QString DkFlipVManipulator::errorMessage() const {
-	return QObject::tr("Cannot flip image");
+QString DkFlipVManipulator::errorMessage() const
+{
+    return QObject::tr("Cannot flip image");
 }
 
 // DkTinyPlanetManipulator --------------------------------------------------------------------
-DkTinyPlanetManipulator::DkTinyPlanetManipulator(QAction * action) : DkBaseManipulatorExt(action) {
+DkTinyPlanetManipulator::DkTinyPlanetManipulator(QAction *action)
+    : DkBaseManipulatorExt(action)
+{
 }
 
-QImage DkTinyPlanetManipulator::apply(const QImage & img) const {
-
+QImage DkTinyPlanetManipulator::apply(const QImage &img) const
+{
 #ifdef WITH_OPENCV
-	int ms = qMax(img.width(), img.height());
-	QSize s(ms, ms);
+    int ms = qMax(img.width(), img.height());
+    QSize s(ms, ms);
 
-	QImage imgR = img.copy();
-	DkImage::tinyPlanet(imgR, size(), angle()*DK_DEG2RAD, s, inverted());
-	return imgR;
+    QImage imgR = img.copy();
+    DkImage::tinyPlanet(imgR, size(), angle() * DK_DEG2RAD, s, inverted());
+    return imgR;
 #else
-	Q_UNUSED(img);
-	return QImage();	// trigger warning
+    Q_UNUSED(img);
+    return QImage(); // trigger warning
 #endif
 }
 
-QString DkTinyPlanetManipulator::errorMessage() const {
-	return QObject::tr("Sorry, I could not create a tiny planet");
+QString DkTinyPlanetManipulator::errorMessage() const
+{
+    return QObject::tr("Sorry, I could not create a tiny planet");
 }
 
-void DkTinyPlanetManipulator::setAngle(int angle) {
-
-	if (angle == mAngle)
-		return;
+void DkTinyPlanetManipulator::setAngle(int angle)
+{
+    if (angle == mAngle)
+        return;
 
-	mAngle = angle;
-	action()->trigger();
+    mAngle = angle;
+    action()->trigger();
 }
 
-int DkTinyPlanetManipulator::angle() const {
-	return mAngle;
+int DkTinyPlanetManipulator::angle() const
+{
+    return mAngle;
 }
 
-void DkTinyPlanetManipulator::setSize(int size) {
+void DkTinyPlanetManipulator::setSize(int size)
+{
+    if (mSize == size)
+        return;
 
-	if (mSize == size)
-		return;
-
-	mSize = size;
-	action()->trigger();
+    mSize = size;
+    action()->trigger();
 }
 
-int DkTinyPlanetManipulator::size() const {
-	return mSize;
+int DkTinyPlanetManipulator::size() const
+{
+    return mSize;
 }
 
-void DkTinyPlanetManipulator::setInverted(bool inverted) {
-
-	if (mInverted == inverted)
-		return;
+void DkTinyPlanetManipulator::setInverted(bool inverted)
+{
+    if (mInverted == inverted)
+        return;
 
-	mInverted = inverted;
-	action()->trigger();
+    mInverted = inverted;
+    action()->trigger();
 }
 
-bool DkTinyPlanetManipulator::inverted() const {
-	return mInverted;
+bool DkTinyPlanetManipulator::inverted() const
+{
+    return mInverted;
 }
 
 // DkUnsharpMaskManipulator --------------------------------------------------------------------
-DkBlurManipulator::DkBlurManipulator(QAction* action) : DkBaseManipulatorExt(action) {
+DkBlurManipulator::DkBlurManipulator(QAction *action)
+    : DkBaseManipulatorExt(action)
+{
 }
 
-QImage DkBlurManipulator::apply(const QImage& img) const {
-
-	QImage imgC = img.copy();
-	DkImage::gaussianBlur(imgC, (float)sigma());
-	return imgC;
+QImage DkBlurManipulator::apply(const QImage &img) const
+{
+    QImage imgC = img.copy();
+    DkImage::gaussianBlur(imgC, (float)sigma());
+    return imgC;
 }
 
-QString DkBlurManipulator::errorMessage() const {
-	
-	// so give me coffee & TV
-	return QObject::tr("Cannot blur image");
+QString DkBlurManipulator::errorMessage() const
+{
+    // so give me coffee & TV
+    return QObject::tr("Cannot blur image");
 }
 
-void DkBlurManipulator::setSigma(int sigma) {
+void DkBlurManipulator::setSigma(int sigma)
+{
+    if (mSigma == sigma)
+        return;
 
-	if (mSigma == sigma)
-		return;
-
-	mSigma = sigma;
-	action()->trigger();
+    mSigma = sigma;
+    action()->trigger();
 }
 
-int DkBlurManipulator::sigma() const {
-	return mSigma;
+int DkBlurManipulator::sigma() const
+{
+    return mSigma;
 }
 
 // DkUnsharpMaskManipulator --------------------------------------------------------------------
-DkUnsharpMaskManipulator::DkUnsharpMaskManipulator(QAction * action) : DkBaseManipulatorExt(action) {
+DkUnsharpMaskManipulator::DkUnsharpMaskManipulator(QAction *action)
+    : DkBaseManipulatorExt(action)
+{
 }
 
-QImage DkUnsharpMaskManipulator::apply(const QImage & img) const {
-
-	QImage imgC = img.copy();
-	DkImage::unsharpMask(imgC, (float)sigma(), 1.0f+amount()/100.0f);
-	return imgC;
+QImage DkUnsharpMaskManipulator::apply(const QImage &img) const
+{
+    QImage imgC = img.copy();
+    DkImage::unsharpMask(imgC, (float)sigma(), 1.0f + amount() / 100.0f);
+    return imgC;
 }
 
-QString DkUnsharpMaskManipulator::errorMessage() const {
-	return QObject::tr("Cannot sharpen image");
+QString DkUnsharpMaskManipulator::errorMessage() const
+{
+    return QObject::tr("Cannot sharpen image");
 }
 
-void DkUnsharpMaskManipulator::setSigma(int sigma) {
-
-	if (mSigma == sigma)
-		return;
+void DkUnsharpMaskManipulator::setSigma(int sigma)
+{
+    if (mSigma == sigma)
+        return;
 
-	mSigma = sigma;
-	action()->trigger();
+    mSigma = sigma;
+    action()->trigger();
 }
 
-int DkUnsharpMaskManipulator::sigma() const {
-	return mSigma;
+int DkUnsharpMaskManipulator::sigma() const
+{
+    return mSigma;
 }
 
-void DkUnsharpMaskManipulator::setAmount(int amount) {
+void DkUnsharpMaskManipulator::setAmount(int amount)
+{
+    if (mAmount == amount)
+        return;
 
-	if (mAmount == amount)
-		return;
-
-	mAmount = amount;
-	action()->trigger();
+    mAmount = amount;
+    action()->trigger();
 }
 
-int DkUnsharpMaskManipulator::amount() const {
-	return mAmount;
+int DkUnsharpMaskManipulator::amount() const
+{
+    return mAmount;
 }
 
 // Rotate Manipulator --------------------------------------------------------------------
-DkRotateManipulator::DkRotateManipulator(QAction * action) : DkBaseManipulatorExt(action) {
+DkRotateManipulator::DkRotateManipulator(QAction *action)
+    : DkBaseManipulatorExt(action)
+{
 }
 
-QImage DkRotateManipulator::apply(const QImage & img) const {
-	return DkImage::rotate(img, angle());
+QImage DkRotateManipulator::apply(const QImage &img) const
+{
+    return DkImage::rotateImage(img, angle());
 }
 
-QString DkRotateManipulator::errorMessage() const {
-	return QObject::tr("Cannot rotate image");
+QString DkRotateManipulator::errorMessage() const
+{
+    return QObject::tr("Cannot rotate image");
 }
 
-void DkRotateManipulator::setAngle(int angle) {
-	
-	if (angle == mAngle)
-		return;
+void DkRotateManipulator::setAngle(int angle)
+{
+    if (angle == mAngle)
+        return;
 
-	mAngle = angle;
-	action()->trigger();
+    mAngle = angle;
+    action()->trigger();
 }
 
-int DkRotateManipulator::angle() const {
-	return mAngle;
+int DkRotateManipulator::angle() const
+{
+    return mAngle;
 }
 
-// -------------------------------------------------------------------- DkResizeManipulator 
-DkResizeManipulator::DkResizeManipulator(QAction * action) : DkBaseManipulatorExt(action) {
+// -------------------------------------------------------------------- DkResizeManipulator
+DkResizeManipulator::DkResizeManipulator(QAction *action)
+    : DkBaseManipulatorExt(action)
+{
 }
 
-QImage DkResizeManipulator::apply(const QImage & img) const {
-
-	if (mScaleFactor == 1.0)
-		return img;
+QImage DkResizeManipulator::apply(const QImage &img) const
+{
+    if (mScaleFactor == 1.0)
+        return img;
 
-	return DkImage::resizeImage(img, QSize(), mScaleFactor, mInterpolation, mCorrectGamma);
+    return DkImage::resizeImage(img, QSize(), mScaleFactor, mInterpolation, mCorrectGamma);
 }
 
-QString DkResizeManipulator::errorMessage() const {
-	return QObject::tr("Cannot resize image");
+QString DkResizeManipulator::errorMessage() const
+{
+    return QObject::tr("Cannot resize image");
 }
 
-void DkResizeManipulator::setScaleFactor(double sf) {
-	mScaleFactor = sf;
-	action()->trigger();
+void DkResizeManipulator::setScaleFactor(double sf)
+{
+    mScaleFactor = sf;
+    action()->trigger();
 }
 
-double DkResizeManipulator::scaleFactor() const {
-	return mScaleFactor;
+double DkResizeManipulator::scaleFactor() const
+{
+    return mScaleFactor;
 }
 
-void DkResizeManipulator::setInterpolation(int ipl) {
-	mInterpolation = ipl;
-	action()->trigger();
+void DkResizeManipulator::setInterpolation(int ipl)
+{
+    mInterpolation = ipl;
+    action()->trigger();
 }
 
-int DkResizeManipulator::interpolation() const {
-	return mInterpolation;
+int DkResizeManipulator::interpolation() const
+{
+    return mInterpolation;
 }
 
-void DkResizeManipulator::setCorrectGamma(bool cg) {
-	mCorrectGamma = cg;
-	action()->trigger();
+void DkResizeManipulator::setCorrectGamma(bool cg)
+{
+    mCorrectGamma = cg;
+    action()->trigger();
 }
 
-bool DkResizeManipulator::correctGamma() const {
-	return mCorrectGamma;
+bool DkResizeManipulator::correctGamma() const
+{
+    return mCorrectGamma;
 }
 
-
 // Rotate Manipulator --------------------------------------------------------------------
-DkThresholdManipulator::DkThresholdManipulator(QAction * action) : DkBaseManipulatorExt(action) {
+DkThresholdManipulator::DkThresholdManipulator(QAction *action)
+    : DkBaseManipulatorExt(action)
+{
 }
 
-QImage DkThresholdManipulator::apply(const QImage & img) const {
-	
-	return DkImage::thresholdImage(img, threshold(), color());
+QImage DkThresholdManipulator::apply(const QImage &img) const
+{
+    return DkImage::thresholdImage(img, threshold(), color());
 }
 
-QString DkThresholdManipulator::errorMessage() const {
-	return QObject::tr("Cannot threshold image");
+QString DkThresholdManipulator::errorMessage() const
+{
+    return QObject::tr("Cannot threshold image");
 }
 
-void DkThresholdManipulator::setThreshold(int thr) {
+void DkThresholdManipulator::setThreshold(int thr)
+{
+    if (thr == mThreshold)
+        return;
 
-	if (thr == mThreshold)
-		return;
-
-	mThreshold = thr;
-	action()->trigger();
+    mThreshold = thr;
+    action()->trigger();
 }
 
-int DkThresholdManipulator::threshold() const {
-	return mThreshold;
+int DkThresholdManipulator::threshold() const
+{
+    return mThreshold;
 }
 
-void DkThresholdManipulator::setColor(bool col) {
-
-	if (col == mColor)
-		return;
+void DkThresholdManipulator::setColor(bool col)
+{
+    if (col == mColor)
+        return;
 
-	mColor = col;
-	action()->trigger();
+    mColor = col;
+    action()->trigger();
 }
 
-bool DkThresholdManipulator::color() const {
-	return mColor;
+bool DkThresholdManipulator::color() const
+{
+    return mColor;
 }
 
 // DkHueManipulator --------------------------------------------------------------------
-DkHueManipulator::DkHueManipulator(QAction * action) : DkBaseManipulatorExt(action) {
+DkHueManipulator::DkHueManipulator(QAction *action)
+    : DkBaseManipulatorExt(action)
+{
 }
 
-QImage DkHueManipulator::apply(const QImage & img) const {
-	return DkImage::hueSaturation(img, hue(), saturation(), value());
+QImage DkHueManipulator::apply(const QImage &img) const
+{
+    return DkImage::hueSaturation(img, hue(), saturation(), value());
 }
 
-QString DkHueManipulator::errorMessage() const {
-	return QObject::tr("Cannot change Hue/Saturation");
+QString DkHueManipulator::errorMessage() const
+{
+    return QObject::tr("Cannot change Hue/Saturation");
 }
 
-void DkHueManipulator::setHue(int hue) {
-	
-	if (mHue == hue)
-		return;
-	
-	mHue = hue;
-	action()->trigger();
-}
+void DkHueManipulator::setHue(int hue)
+{
+    if (mHue == hue)
+        return;
 
-int DkHueManipulator::hue() const {
-	return mHue;
+    mHue = hue;
+    action()->trigger();
 }
 
-void DkHueManipulator::setSaturation(int sat) {
+int DkHueManipulator::hue() const
+{
+    return mHue;
+}
 
-	if (mSat == sat)
-		return;
+void DkHueManipulator::setSaturation(int sat)
+{
+    if (mSat == sat)
+        return;
 
-	mSat = sat;
-	action()->trigger();
+    mSat = sat;
+    action()->trigger();
 }
 
-int DkHueManipulator::saturation() const {
-	return mSat;
+int DkHueManipulator::saturation() const
+{
+    return mSat;
 }
 
-void DkHueManipulator::setValue(int val) {
-
-	if (mValue == val)
-		return;
+void DkHueManipulator::setValue(int val)
+{
+    if (mValue == val)
+        return;
 
-	mValue = val;
-	action()->trigger();
+    mValue = val;
+    action()->trigger();
 }
 
-int DkHueManipulator::value() const {
-	return mValue;
+int DkHueManipulator::value() const
+{
+    return mValue;
 }
 
-DkExposureManipulator::DkExposureManipulator(QAction * action) : DkBaseManipulatorExt(action) {
+DkExposureManipulator::DkExposureManipulator(QAction *action)
+    : DkBaseManipulatorExt(action)
+{
 }
 
-QImage DkExposureManipulator::apply(const QImage & img) const {
-	return DkImage::exposure(img, exposure(), offset(), gamma());
+QImage DkExposureManipulator::apply(const QImage &img) const
+{
+    return DkImage::exposure(img, exposure(), offset(), gamma());
 }
 
-QString DkExposureManipulator::errorMessage() const {
-	return QObject::tr("Cannot apply exposure");
+QString DkExposureManipulator::errorMessage() const
+{
+    return QObject::tr("Cannot apply exposure");
 }
 
-void DkExposureManipulator::setExposure(double exposure) {
-
-	if (mExposure == exposure)
-		return;
+void DkExposureManipulator::setExposure(double exposure)
+{
+    if (mExposure == exposure)
+        return;
 
-	mExposure = exposure;
-	action()->trigger();
+    mExposure = exposure;
+    action()->trigger();
 }
 
-double DkExposureManipulator::exposure() const {
-	return mExposure;
+double DkExposureManipulator::exposure() const
+{
+    return mExposure;
 }
 
-void DkExposureManipulator::setOffset(double offset) {
+void DkExposureManipulator::setOffset(double offset)
+{
+    if (mOffset == offset)
+        return;
 
-	if (mOffset == offset)
-		return;
-
-	mOffset = offset;
-	action()->trigger();
+    mOffset = offset;
+    action()->trigger();
 }
 
-double DkExposureManipulator::offset() const {
-	return mOffset;
+double DkExposureManipulator::offset() const
+{
+    return mOffset;
 }
 
-void DkExposureManipulator::setGamma(double gamma) {
-
-	if (mGamma == gamma)
-		return;
+void DkExposureManipulator::setGamma(double gamma)
+{
+    if (mGamma == gamma)
+        return;
 
-	mGamma = gamma;
-	action()->trigger();
+    mGamma = gamma;
+    action()->trigger();
 }
 
-double DkExposureManipulator::gamma() const {
-	return mGamma;
+double DkExposureManipulator::gamma() const
+{
+    return mGamma;
 }
 
-// -------------------------------------------------------------------- DkColorManipulator 
-DkColorManipulator::DkColorManipulator(QAction * action) : DkBaseManipulatorExt(action) {
+// -------------------------------------------------------------------- DkColorManipulator
+DkColorManipulator::DkColorManipulator(QAction *action)
+    : DkBaseManipulatorExt(action)
+{
 }
 
-QImage DkColorManipulator::apply(const QImage & img) const {
-	
-	return DkImage::bgColor(img, color());
+QImage DkColorManipulator::apply(const QImage &img) const
+{
+    return DkImage::bgColor(img, color());
 }
 
-QString DkColorManipulator::errorMessage() const {
-	return QObject::tr("Cannot draw background color");
+QString DkColorManipulator::errorMessage() const
+{
+    return QObject::tr("Cannot draw background color");
 }
 
-void DkColorManipulator::setColor(const QColor & col) {
-	
-	if (mColor == col)
-		return;
-	
-	mColor = col;
-	action()->trigger();
+void DkColorManipulator::setColor(const QColor &col)
+{
+    if (mColor == col)
+        return;
+
+    mColor = col;
+    action()->trigger();
 }
 
-QColor DkColorManipulator::color() const {
-	return mColor;
+QColor DkColorManipulator::color() const
+{
+    return mColor;
 }
 
 }
\ No newline at end of file
diff --git a/ImageLounge/src/DkCore/DkManipulatorsIpl.h b/ImageLounge/src/DkCore/DkManipulatorsIpl.h
index 500e7d8..d3e7989 100644
--- a/ImageLounge/src/DkCore/DkManipulatorsIpl.h
+++ b/ImageLounge/src/DkCore/DkManipulatorsIpl.h
@@ -1,6 +1,6 @@
 /*******************************************************************************************************
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2016 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2016 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2016 Florian Kleber <florian@nomacs.org>
@@ -30,11 +30,11 @@
 
 #include "DkManipulators.h"
 
-#pragma warning(push, 0)	// no warnings from includes
+#pragma warning(push, 0) // no warnings from includes
 #include <QAction>
 #pragma warning(pop)
 
-#pragma warning(disable: 4251)	// TODO: remove
+#pragma warning(disable : 4251) // TODO: remove
 
 #ifndef DllCoreExport
 #ifdef DK_CORE_DLL_EXPORT
@@ -48,237 +48,238 @@
 
 // Qt defines
 
-namespace nmc {
+namespace nmc
+{
 
 // nomacs defines
 
-class DkGrayScaleManipulator : public DkBaseManipulator {
-
+class DkGrayScaleManipulator : public DkBaseManipulator
+{
 public:
-	DkGrayScaleManipulator(QAction* action = 0);
+    DkGrayScaleManipulator(QAction *action = 0);
 
-	QImage apply(const QImage& img) const override;
-	QString errorMessage() const override;
+    QImage apply(const QImage &img) const override;
+    QString errorMessage() const override;
 };
 
-class DkAutoAdjustManipulator : public DkBaseManipulator {
-
+class DkAutoAdjustManipulator : public DkBaseManipulator
+{
 public:
-	DkAutoAdjustManipulator(QAction* action = 0);
+    DkAutoAdjustManipulator(QAction *action = 0);
 
-	QImage apply(const QImage& img) const override;
-	QString errorMessage() const override;
+    QImage apply(const QImage &img) const override;
+    QString errorMessage() const override;
 };
 
-class DkNormalizeManipulator : public DkBaseManipulator {
-
+class DkNormalizeManipulator : public DkBaseManipulator
+{
 public:
-	DkNormalizeManipulator(QAction* action = 0);
+    DkNormalizeManipulator(QAction *action = 0);
 
-	QImage apply(const QImage& img) const override;
-	QString errorMessage() const override;
+    QImage apply(const QImage &img) const override;
+    QString errorMessage() const override;
 };
 
-class DkInvertManipulator : public DkBaseManipulator {
-
+class DkInvertManipulator : public DkBaseManipulator
+{
 public:
-	DkInvertManipulator(QAction* action = 0);
+    DkInvertManipulator(QAction *action = 0);
 
-	QImage apply(const QImage& img) const override;
-	QString errorMessage() const override;
+    QImage apply(const QImage &img) const override;
+    QString errorMessage() const override;
 };
 
-class DkFlipHManipulator : public DkBaseManipulator {
-
+class DkFlipHManipulator : public DkBaseManipulator
+{
 public:
-	DkFlipHManipulator(QAction* action = 0);
+    DkFlipHManipulator(QAction *action = 0);
 
-	QImage apply(const QImage& img) const override;
-	QString errorMessage() const override;
+    QImage apply(const QImage &img) const override;
+    QString errorMessage() const override;
 };
 
-class DkFlipVManipulator : public DkBaseManipulator {
-
+class DkFlipVManipulator : public DkBaseManipulator
+{
 public:
-	DkFlipVManipulator(QAction* action = 0);
+    DkFlipVManipulator(QAction *action = 0);
 
-	QImage apply(const QImage& img) const override;
-	QString errorMessage() const override;
+    QImage apply(const QImage &img) const override;
+    QString errorMessage() const override;
 };
 
 // Extended --------------------------------------------------------------------
-class DllCoreExport DkTinyPlanetManipulator : public DkBaseManipulatorExt {
-
+class DllCoreExport DkTinyPlanetManipulator : public DkBaseManipulatorExt
+{
 public:
-	DkTinyPlanetManipulator(QAction* action);
+    DkTinyPlanetManipulator(QAction *action);
 
-	QImage apply(const QImage& img) const override;
-	QString errorMessage() const override;
+    QImage apply(const QImage &img) const override;
+    QString errorMessage() const override;
 
-	void setSize(int size);
-	int size() const;
+    void setSize(int size);
+    int size() const;
 
-	void setAngle(int angle);
-	int angle() const;
+    void setAngle(int angle);
+    int angle() const;
 
-	void setInverted(bool invert);
-	bool inverted() const;
+    void setInverted(bool invert);
+    bool inverted() const;
 
 private:
-	int mSize = 30;
-	int mAngle = 0;
-	bool mInverted = false;
+    int mSize = 30;
+    int mAngle = 0;
+    bool mInverted = false;
 };
 
-class DllCoreExport DkColorManipulator : public DkBaseManipulatorExt {
-
+class DllCoreExport DkColorManipulator : public DkBaseManipulatorExt
+{
 public:
-	DkColorManipulator(QAction* action);
+    DkColorManipulator(QAction *action);
 
-	QImage apply(const QImage& img) const override;
-	QString errorMessage() const override;
+    QImage apply(const QImage &img) const override;
+    QString errorMessage() const override;
 
-	void setColor(const QColor& col);
-	QColor color() const;
+    void setColor(const QColor &col);
+    QColor color() const;
 
 private:
-	QColor mColor = Qt::white;
+    QColor mColor = Qt::white;
 };
 
-class DllCoreExport DkBlurManipulator : public DkBaseManipulatorExt {
-
+class DllCoreExport DkBlurManipulator : public DkBaseManipulatorExt
+{
 public:
-	DkBlurManipulator(QAction* action);
+    DkBlurManipulator(QAction *action);
 
-	QImage apply(const QImage& img) const override;
-	QString errorMessage() const override;
+    QImage apply(const QImage &img) const override;
+    QString errorMessage() const override;
 
-	void setSigma(int sigma);
-	int sigma() const;
+    void setSigma(int sigma);
+    int sigma() const;
 
 private:
-	int mSigma = 5;
+    int mSigma = 5;
 };
 
-class DllCoreExport DkUnsharpMaskManipulator : public DkBaseManipulatorExt {
-
+class DllCoreExport DkUnsharpMaskManipulator : public DkBaseManipulatorExt
+{
 public:
-	DkUnsharpMaskManipulator(QAction* action);
+    DkUnsharpMaskManipulator(QAction *action);
 
-	QImage apply(const QImage& img) const override;
-	QString errorMessage() const override;
+    QImage apply(const QImage &img) const override;
+    QString errorMessage() const override;
 
-	void setSigma(int sigma);
-	int sigma() const;
+    void setSigma(int sigma);
+    int sigma() const;
 
-	void setAmount(int amount);
-	int amount() const;
+    void setAmount(int amount);
+    int amount() const;
 
 private:
-	int mSigma = 30;
-	int mAmount = 15;
+    int mSigma = 30;
+    int mAmount = 15;
 };
 
-class DllCoreExport DkRotateManipulator : public DkBaseManipulatorExt {
-
+class DllCoreExport DkRotateManipulator : public DkBaseManipulatorExt
+{
 public:
-	DkRotateManipulator(QAction* action);
+    DkRotateManipulator(QAction *action);
 
-	QImage apply(const QImage& img) const override;
-	QString errorMessage() const override;
+    QImage apply(const QImage &img) const override;
+    QString errorMessage() const override;
 
-	void setAngle(int angle);
-	int angle() const;
+    void setAngle(int angle);
+    int angle() const;
 
 private:
-	int mAngle = 0;
+    int mAngle = 0;
 };
 
-class DllCoreExport DkResizeManipulator : public DkBaseManipulatorExt {
-
+class DllCoreExport DkResizeManipulator : public DkBaseManipulatorExt
+{
 public:
-	DkResizeManipulator(QAction* action);
+    DkResizeManipulator(QAction *action);
 
-	QImage apply(const QImage& img) const override;
-	QString errorMessage() const override;
+    QImage apply(const QImage &img) const override;
+    QString errorMessage() const override;
 
-	void setScaleFactor(double sf);
-	double scaleFactor() const;
+    void setScaleFactor(double sf);
+    double scaleFactor() const;
 
-	void setInterpolation(int ipl);
-	int interpolation() const;
+    void setInterpolation(int ipl);
+    int interpolation() const;
 
-	void setCorrectGamma(bool ug);
-	bool correctGamma() const;
+    void setCorrectGamma(bool ug);
+    bool correctGamma() const;
 
 private:
-	double mScaleFactor = 1.0;
-	int mInterpolation = 1;
-	bool mCorrectGamma = false;
+    double mScaleFactor = 1.0;
+    int mInterpolation = 1;
+    bool mCorrectGamma = false;
 };
 
-class DllCoreExport DkThresholdManipulator : public DkBaseManipulatorExt {
-
+class DllCoreExport DkThresholdManipulator : public DkBaseManipulatorExt
+{
 public:
-	DkThresholdManipulator(QAction* action);
+    DkThresholdManipulator(QAction *action);
 
-	QImage apply(const QImage& img) const override;
-	QString errorMessage() const override;
+    QImage apply(const QImage &img) const override;
+    QString errorMessage() const override;
 
-	void setThreshold(int thr);
-	int threshold() const;
+    void setThreshold(int thr);
+    int threshold() const;
 
-	void setColor(bool col);
-	bool color() const;
+    void setColor(bool col);
+    bool color() const;
 
 private:
-	int mThreshold = 128;
-	bool mColor = false;
+    int mThreshold = 128;
+    bool mColor = false;
 };
 
-class DllCoreExport DkHueManipulator : public DkBaseManipulatorExt {
-
+class DllCoreExport DkHueManipulator : public DkBaseManipulatorExt
+{
 public:
-	DkHueManipulator(QAction* action);
+    DkHueManipulator(QAction *action);
 
-	QImage apply(const QImage& img) const override;
-	QString errorMessage() const override;
+    QImage apply(const QImage &img) const override;
+    QString errorMessage() const override;
 
-	void setHue(int hue);
-	int hue() const;
+    void setHue(int hue);
+    int hue() const;
 
-	void setSaturation(int sat);
-	int saturation() const;
+    void setSaturation(int sat);
+    int saturation() const;
 
-	void setValue(int val);
-	int value() const;
+    void setValue(int val);
+    int value() const;
 
 private:
-	int mHue = 0;
-	int mSat = 0;
-	int mValue = 0;
+    int mHue = 0;
+    int mSat = 0;
+    int mValue = 0;
 };
 
-class DllCoreExport DkExposureManipulator : public DkBaseManipulatorExt {
-
+class DllCoreExport DkExposureManipulator : public DkBaseManipulatorExt
+{
 public:
-	DkExposureManipulator(QAction* action);
+    DkExposureManipulator(QAction *action);
 
-	QImage apply(const QImage& img) const override;
-	QString errorMessage() const override;
+    QImage apply(const QImage &img) const override;
+    QString errorMessage() const override;
 
-	void setExposure(double exposure);
-	double exposure() const;
+    void setExposure(double exposure);
+    double exposure() const;
 
-	void setOffset(double offset);
-	double offset() const;
+    void setOffset(double offset);
+    double offset() const;
 
-	void setGamma(double gamma);
-	double gamma() const;
+    void setGamma(double gamma);
+    double gamma() const;
 
 private:
-	double mExposure = 0.0;
-	double mOffset = 0.0;
-	double mGamma = 1.0;
+    double mExposure = 0.0;
+    double mOffset = 0.0;
+    double mGamma = 1.0;
 };
 }
\ No newline at end of file
diff --git a/ImageLounge/src/DkCore/DkMath.cpp b/ImageLounge/src/DkCore/DkMath.cpp
index 908cf41..202bc10 100644
--- a/ImageLounge/src/DkCore/DkMath.cpp
+++ b/ImageLounge/src/DkCore/DkMath.cpp
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkMath.cpp
  Created on:	22.03.2010
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -27,414 +27,399 @@
 
 #include "DkMath.h"
 
-#pragma warning(push, 0)	// no warnings from includes - begin
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QCursor>
 #include <QTransform>
-#pragma warning(pop)		// no warnings from includes - end
+#pragma warning(pop) // no warnings from includes - end
 
-
-namespace nmc {
+namespace nmc
+{
 
 // DkRotatingRect --------------------------------------------------------------------
-DkRotatingRect::DkRotatingRect(QRectF rect) {
-
-	if (rect.isEmpty()) {
-
-		for (int idx = 0; idx < 4; idx++)
-			mRect.push_back(QPointF());
-	}
-	else
-		mRect = rect;
-
+DkRotatingRect::DkRotatingRect(QRectF rect)
+{
+    if (rect.isEmpty()) {
+        for (int idx = 0; idx < 4; idx++)
+            mRect.push_back(QPointF());
+    } else
+        mRect = rect;
 }
 
-DkRotatingRect::~DkRotatingRect() {}
-
-bool DkRotatingRect::isEmpty() const {
-
-	if (mRect.size() < 4)
-		return true;
-
-	QPointF lp = mRect[0]; 
-	for (int idx = 1; idx < mRect.size(); idx++) {
-
-		if (lp != mRect[idx]) {
-			return false;
-		}
-		lp = mRect[idx];
-	}
-	return true;
+DkRotatingRect::~DkRotatingRect()
+{
 }
 
-void DkRotatingRect::setAllCorners(QPointF &p) {
-
-	for (int idx = 0; idx < mRect.size(); idx++)
-		mRect[idx] = p;
-
+bool DkRotatingRect::isEmpty() const
+{
+    if (mRect.size() < 4)
+        return true;
+
+    QPointF lp = mRect[0];
+    for (int idx = 1; idx < mRect.size(); idx++) {
+        if (lp != mRect[idx]) {
+            return false;
+        }
+        lp = mRect[idx];
+    }
+    return true;
 }
 
-DkVector DkRotatingRect::getDiagonal(int cIdx) const {
-
-	DkVector c0 = mRect[cIdx % 4];
-	DkVector c2 = mRect[(cIdx+2) % 4];
-
-	return c2 - c0;
+void DkRotatingRect::setAllCorners(QPointF &p)
+{
+    for (int idx = 0; idx < mRect.size(); idx++)
+        mRect[idx] = p;
 }
 
-QCursor DkRotatingRect::cpCursor(int idx) {
-
-	double angle = 0;
-
-	if (idx >= 0 && idx < 4) {
-
-		// this seems a bit complicated...
-		// however the points are not necessarily stored in clockwise order...
-		DkVector e1 = mRect[(idx+1) % 4] - mRect[idx];
-		DkVector e2 = mRect[(idx+3) % mRect.size()] - mRect[idx];
-		e1.normalize();
-		e2.normalize();
-		DkVector rv = e1-e2;
-		rv = rv.normalVec();
-		angle = rv.angle();
-	}
-	else {
-		DkVector edge = mRect[(idx+1) % 4] - mRect[idx % 4];
-		angle = edge.normalVec().angle();	// the angle of the normal vector
-	}
-
-	angle = DkMath::normAngleRad(angle, -CV_PI/8.0, 7.0*CV_PI/8.0);
-
-	if (angle > 5.0*CV_PI/8.0)
-		return QCursor(Qt::SizeBDiagCursor);
-	else if (angle > 3.0*CV_PI/8.0)
-		return QCursor(Qt::SizeVerCursor);
-	else if (angle > CV_PI/8.0)
-		return QCursor(Qt::SizeFDiagCursor);
-	else
-		return QCursor(Qt::SizeHorCursor);
+DkVector DkRotatingRect::getDiagonal(int cIdx) const
+{
+    DkVector c0 = mRect[cIdx % 4];
+    DkVector c2 = mRect[(cIdx + 2) % 4];
 
+    return c2 - c0;
 }
 
-void DkRotatingRect::updateCorner(int cIdx, QPointF nC, DkVector oldDiag) {
-
-	// index does not exist
-	if (cIdx < 0 || cIdx >= mRect.size()*2)
-		return;
-
-	if (mRect[(cIdx+1) % 4] == mRect[(cIdx+3) % 4]) {
-		QPointF oC = mRect[(cIdx+2) % 4];	// opposite corner
-		mRect[cIdx] = nC;
-		mRect[(cIdx+1) % 4] = QPointF(nC.x(), oC.y());
-		mRect[(cIdx+3) % 4] = QPointF(oC.x(), nC.y());
-	}
-	// these indices indicate the control points on edges
-	else if (cIdx >= 4 && cIdx < 8) {
-
-		DkVector c0 = mRect[cIdx % 4];
-		DkVector n = (mRect[(cIdx+1) % 4] - c0).normalVec();
-		n.normalize();
-
-		// compute the offset vector
-		DkVector oV = n * n.scalarProduct(nC-c0);
-
-		mRect[cIdx % 4] = (mRect[cIdx % 4] + oV).toQPointF();
-		mRect[(cIdx+1) % 4] = (mRect[(cIdx+1) % 4] + oV).toQPointF();
-	}
-	else {
-
-		// we have to update the n-1 and n+1 corner
-		DkVector cN = nC;
-		DkVector c0 = mRect[cIdx];
-		DkVector c1 = mRect[(cIdx+1) % 4];
-		DkVector c2 = mRect[(cIdx+2) % 4];
-		DkVector c3 = mRect[(cIdx+3) % 4];
-
-		if (!oldDiag.isEmpty()) {
-			DkVector dN = oldDiag.normalVec();
-			dN.normalize();
-
-			float d = dN*(cN-c2);
-			cN += (dN*-d);
-		}
-
-		// new diagonal
-		float diagLength = (c2-cN).norm();
-		float diagAngle = (float)(c2-cN).angle();
-
-		// compute the idx-1 corner
-		float c1Angle = (float)(c1-c0).angle();
-		float newLength = cos(c1Angle - diagAngle)*diagLength;
-		DkVector nc1 = DkVector((newLength), 0);
-		nc1.rotate(-c1Angle);
-
-		// compute the idx-3 corner
-		float c3Angle = (float)(c3-c0).angle();
-		newLength = cos(c3Angle - diagAngle)*diagLength;
-		DkVector nc3 = DkVector((newLength), 0);
-		nc3.rotate(-c3Angle);
-
-		mRect[(cIdx+1) % 4] = (nc1+cN).toQPointF();			
-		mRect[(cIdx+3) % 4] = (nc3+cN).toQPointF();
-		mRect[cIdx] = cN.toQPointF();
-	}
-
+QCursor DkRotatingRect::cpCursor(int idx)
+{
+    double angle = 0;
+
+    if (idx >= 0 && idx < 4) {
+        // this seems a bit complicated...
+        // however the points are not necessarily stored in clockwise order...
+        DkVector e1 = mRect[(idx + 1) % 4] - mRect[idx];
+        DkVector e2 = mRect[(idx + 3) % mRect.size()] - mRect[idx];
+        e1.normalize();
+        e2.normalize();
+        DkVector rv = e1 - e2;
+        rv = rv.normalVec();
+        angle = rv.angle();
+    } else {
+        DkVector edge = mRect[(idx + 1) % 4] - mRect[idx % 4];
+        angle = edge.normalVec().angle(); // the angle of the normal vector
+    }
+
+    angle = DkMath::normAngleRad(angle, -CV_PI / 8.0, 7.0 * CV_PI / 8.0);
+
+    if (angle > 5.0 * CV_PI / 8.0)
+        return QCursor(Qt::SizeBDiagCursor);
+    else if (angle > 3.0 * CV_PI / 8.0)
+        return QCursor(Qt::SizeVerCursor);
+    else if (angle > CV_PI / 8.0)
+        return QCursor(Qt::SizeFDiagCursor);
+    else
+        return QCursor(Qt::SizeHorCursor);
 }
 
-const QPolygonF& DkRotatingRect::getPoly() const {
-
-	return mRect;
+void DkRotatingRect::updateCorner(int cIdx, QPointF nC, DkVector oldDiag)
+{
+    // index does not exist
+    if (cIdx < 0 || cIdx >= mRect.size() * 2)
+        return;
+
+    if (mRect[(cIdx + 1) % 4] == mRect[(cIdx + 3) % 4]) {
+        QPointF oC = mRect[(cIdx + 2) % 4]; // opposite corner
+        mRect[cIdx] = nC;
+        mRect[(cIdx + 1) % 4] = QPointF(nC.x(), oC.y());
+        mRect[(cIdx + 3) % 4] = QPointF(oC.x(), nC.y());
+    }
+    // these indices indicate the control points on edges
+    else if (cIdx >= 4 && cIdx < 8) {
+        DkVector c0 = mRect[cIdx % 4];
+        DkVector n = (mRect[(cIdx + 1) % 4] - c0).normalVec();
+        n.normalize();
+
+        // compute the offset vector
+        DkVector oV = n * n.scalarProduct(nC - c0);
+
+        mRect[cIdx % 4] = (mRect[cIdx % 4] + oV).toQPointF();
+        mRect[(cIdx + 1) % 4] = (mRect[(cIdx + 1) % 4] + oV).toQPointF();
+    } else {
+        // we have to update the n-1 and n+1 corner
+        DkVector cN = nC;
+        DkVector c0 = mRect[cIdx];
+        DkVector c1 = mRect[(cIdx + 1) % 4];
+        DkVector c2 = mRect[(cIdx + 2) % 4];
+        DkVector c3 = mRect[(cIdx + 3) % 4];
+
+        if (!oldDiag.isEmpty()) {
+            DkVector dN = oldDiag.normalVec();
+            dN.normalize();
+
+            float d = dN * (cN - c2);
+            cN += (dN * -d);
+        }
+
+        // new diagonal
+        float diagLength = (c2 - cN).norm();
+        float diagAngle = (float)(c2 - cN).angle();
+
+        // compute the idx-1 corner
+        float c1Angle = (float)(c1 - c0).angle();
+        float newLength = cos(c1Angle - diagAngle) * diagLength;
+        DkVector nc1 = DkVector((newLength), 0);
+        nc1.rotate(-c1Angle);
+
+        // compute the idx-3 corner
+        float c3Angle = (float)(c3 - c0).angle();
+        newLength = cos(c3Angle - diagAngle) * diagLength;
+        DkVector nc3 = DkVector((newLength), 0);
+        nc3.rotate(-c3Angle);
+
+        mRect[(cIdx + 1) % 4] = (nc1 + cN).toQPointF();
+        mRect[(cIdx + 3) % 4] = (nc3 + cN).toQPointF();
+        mRect[cIdx] = cN.toQPointF();
+    }
 }
 
-void DkRotatingRect::setPoly(QPolygonF &poly) {
+const QPolygonF &DkRotatingRect::getPoly() const
+{
+    return mRect;
+}
 
-	mRect = poly;
+void DkRotatingRect::setPoly(QPolygonF &poly)
+{
+    mRect = poly;
 }
 
-QPolygonF DkRotatingRect::getClosedPoly() {
+QPolygonF DkRotatingRect::getClosedPoly()
+{
+    if (mRect.isEmpty())
+        return QPolygonF();
 
-	if (mRect.isEmpty())
-		return QPolygonF();
+    QPolygonF closedPoly = mRect;
+    closedPoly.push_back(closedPoly[0]);
 
-	QPolygonF closedPoly = mRect;
-	closedPoly.push_back(closedPoly[0]);
-	
-	return closedPoly;
+    return closedPoly;
 }
 
-QPointF DkRotatingRect::getCenter() const {
-
-	if (mRect.empty())
-		return QPointF();
+QPointF DkRotatingRect::getCenter() const
+{
+    if (mRect.empty())
+        return QPointF();
 
-	DkVector c1 = mRect[0];
-	DkVector c2 = mRect[2];
+    DkVector c1 = mRect[0];
+    DkVector c2 = mRect[2];
 
-	return ((c2-c1)*0.5f + c1).toQPointF();
+    return ((c2 - c1) * 0.5f + c1).toQPointF();
 }
 
-QPointF DkRotatingRect::getTopLeft() const {
-	
-	DkVector v = mRect[0];
-	v = v.minVec(mRect[1]);
-	v = v.minVec(mRect[2]);
-	v = v.minVec(mRect[3]);
-	
-	return v.toQPointF();
+QPointF DkRotatingRect::getTopLeft() const
+{
+    DkVector v = mRect[0];
+    v = v.minVec(mRect[1]);
+    v = v.minVec(mRect[2]);
+    v = v.minVec(mRect[3]);
+
+    return v.toQPointF();
 }
 
-void DkRotatingRect::setSize(const QSizeF & s) {
+void DkRotatingRect::setSize(const QSizeF &s)
+{
+    double angle = getAngle() - CV_PI * 0.5;
 
-	double angle = getAngle()-CV_PI*0.5;
+    QRectF r;
+    r.setSize(s);
+    r.moveCenter(getCenter());
 
-	QRectF r;
-	r.setSize(s);
-	r.moveCenter(getCenter());
+    mRect = r;
 
-	mRect = r;
-	
-	// assigning a QRectF to a QPolygonF results in a closed polygon - but we want it to be open so remove the last point
-	mRect.pop_back();
+    // assigning a QRectF to a QPolygonF results in a closed polygon - but we want it to be open so remove the last point
+    mRect.pop_back();
 
-	rotate(angle);
+    rotate(angle);
 }
 
-QSize DkRotatingRect::size() const {
-	
-	QPolygonF p = getPoly();
+QSize DkRotatingRect::size() const
+{
+    QPolygonF p = getPoly();
 
-	// default upper left corner is 0
-	DkVector xV = DkVector(mRect[3] - mRect[0]).round();
-	DkVector yV = DkVector(mRect[1] - mRect[0]).round();
+    // default upper left corner is 0
+    DkVector xV = DkVector(mRect[3] - mRect[0]).round();
+    DkVector yV = DkVector(mRect[1] - mRect[0]).round();
 
-	QPointF ul = QPointF(qRound(mRect[0].x()), qRound(mRect[0].y()));
-	QPointF s = QPointF(xV.norm(), yV.norm());
+    QPointF ul = QPointF(qRound(mRect[0].x()), qRound(mRect[0].y()));
+    QPointF s = QPointF(xV.norm(), yV.norm());
 
-	double angle = xV.angle();
-	angle = DkMath::normAngleRad(angle, -CV_PI, CV_PI);
+    double angle = xV.angle();
+    angle = DkMath::normAngleRad(angle, -CV_PI, CV_PI);
 
-	// switch width/height for /\ and \/ quadrants
-	if (std::abs(angle) > CV_PI*0.25 && std::abs(angle) < CV_PI*0.75) {
-		double x = s.x();
-		s.setX(s.y());
-		s.setY(x);
-	}
+    // switch width/height for /\ and \/ quadrants
+    if (std::abs(angle) > CV_PI * 0.25 && std::abs(angle) < CV_PI * 0.75) {
+        double x = s.x();
+        s.setX(s.y());
+        s.setY(x);
+    }
 
-	return QSize(qRound(s.x()), qRound(s.y()));
+    return QSize(qRound(s.x()), qRound(s.y()));
 }
 
-void DkRotatingRect::setCenter(const QPointF& center) {
-
-	if (mRect.empty())
-		return;
-
-	DkVector diff = getCenter() - center;
+void DkRotatingRect::setCenter(const QPointF &center)
+{
+    if (mRect.empty())
+        return;
 
-	for (int idx = 0; idx < mRect.size(); idx++) {
+    DkVector diff = getCenter() - center;
 
-		mRect[idx] = mRect[idx] - diff.toQPointF();
-	}
+    for (int idx = 0; idx < mRect.size(); idx++) {
+        mRect[idx] = mRect[idx] - diff.toQPointF();
+    }
 }
 
-double DkRotatingRect::getAngle() const {
-
-	// default upper left corner is 0
-	DkVector xV = mRect[1] - mRect[0];
-	return xV.angle();
+double DkRotatingRect::getAngle() const
+{
+    // default upper left corner is 0
+    DkVector xV = mRect[1] - mRect[0];
+    return xV.angle();
 }
 
-float DkRotatingRect::getAngleDeg() const {
-
-	float sAngle = (float)(getAngle()*DK_RAD2DEG);
+float DkRotatingRect::getAngleDeg() const
+{
+    float sAngle = (float)(getAngle() * DK_RAD2DEG);
 
-	while (sAngle > 90)
-		sAngle -= 180;
-	while (sAngle < -90)
-		sAngle += 180;
+    while (sAngle > 90)
+        sAngle -= 180;
+    while (sAngle < -90)
+        sAngle += 180;
 
-	sAngle = qRound(sAngle*100)/100.0f;	// round to 2 digits
+    sAngle = qRound(sAngle * 100) / 100.0f; // round to 2 digits
 
-	return sAngle;
+    return sAngle;
 }
 
-void DkRotatingRect::getTransform(QTransform& tForm, QPointF& size) const {
-
-	if (mRect.size() < 4)
-		return;
-
-	// default upper left corner is 0
-	DkVector xV = DkVector(mRect[3] - mRect[0]).round();
-	DkVector yV = DkVector(mRect[1] - mRect[0]).round();
-
-	QPointF ul = QPointF(qRound(mRect[0].x()), qRound(mRect[0].y()));
-	size = QPointF(xV.norm(), yV.norm());
-
-	double angle = xV.angle();
-	angle = DkMath::normAngleRad(angle, -CV_PI, CV_PI);
-
-	// switch width/height for /\ and \/ quadrants
-	if (std::abs(angle) > CV_PI*0.25 && std::abs(angle) < CV_PI*0.75) {
-		float x = (float)size.x();
-		size.setX(size.y());
-		size.setY(x);
-	}
-
-	// invariance -> user does not want to make a difference between an upside down mRect
-	if (angle > CV_PI*0.25 && angle < CV_PI*0.75) {
-		angle -= CV_PI*0.5;
-		ul = mRect[1];
-	}
-	else if (angle > -CV_PI*0.75 && angle < -CV_PI*0.25) {
-		angle += CV_PI*0.5;
-		ul = mRect[3];
-	}
-	else if (angle >= CV_PI*0.75 || angle <= -CV_PI*0.75) {
-		angle += CV_PI;
-		ul = mRect[2];
-	}
-
-	tForm.rotateRadians(-angle);
-	tForm.translate(qRound(-ul.x()), qRound(-ul.y()));	// round guarantees that pixels are not interpolated
-
+void DkRotatingRect::getTransform(QTransform &tForm, QPointF &size) const
+{
+    if (mRect.size() < 4)
+        return;
+
+    // default upper left corner is 0
+    DkVector xV = DkVector(mRect[3] - mRect[0]).round();
+    DkVector yV = DkVector(mRect[1] - mRect[0]).round();
+
+    QPointF ul = QPointF(qRound(mRect[0].x()), qRound(mRect[0].y()));
+    size = QPointF(xV.norm(), yV.norm());
+
+    double angle = xV.angle();
+    angle = DkMath::normAngleRad(angle, -CV_PI, CV_PI);
+
+    // switch width/height for /\ and \/ quadrants
+    if (std::abs(angle) > CV_PI * 0.25 && std::abs(angle) < CV_PI * 0.75) {
+        float x = (float)size.x();
+        size.setX(size.y());
+        size.setY(x);
+    }
+
+    // invariance -> user does not want to make a difference between an upside down mRect
+    if (angle > CV_PI * 0.25 && angle < CV_PI * 0.75) {
+        angle -= CV_PI * 0.5;
+        ul = mRect[1];
+    } else if (angle > -CV_PI * 0.75 && angle < -CV_PI * 0.25) {
+        angle += CV_PI * 0.5;
+        ul = mRect[3];
+    } else if (angle >= CV_PI * 0.75 || angle <= -CV_PI * 0.75) {
+        angle += CV_PI;
+        ul = mRect[2];
+    }
+
+    tForm.rotateRadians(-angle);
+    tForm.translate(qRound(-ul.x()), qRound(-ul.y())); // round guarantees that pixels are not interpolated
 }
 
-QRectF DkRotatingRect::toExifRect(const QSize & size) const {
-	
-	// TODO: if the angle is > 0 I get issues (photoshop has the same interpretation as we do)
-	QPointF center = getCenter();
-
-	QPolygonF polygon = getPoly();
-	DkVector vec;
-	double angle = getAngle();
-
-	for (int i = 0; i < 4; i++) {
-		// We need the second quadrant, but I do not know why... just tried it out.
-		vec = polygon[i] - center;
-		if (vec.x <= 0 && vec.y > 0)
-			break;
-	}
-
-	vec.rotate(angle * 2);
-	vec.abs();
-
-	float top = (float) center.y() - vec.y;
-	float bottom = (float) center.y() + vec.y;
-	float left = (float) center.x() - vec.x;
-	float right = (float) center.x() + vec.x;
-
-	// Normalize the coordinates:
-	top /= size.height();
-	bottom /= size.height();
-	left /= size.width();
-	right /= size.width();
-
-	return QRectF(QPointF(left, top), QSizeF(right - left, bottom - top));
+QRectF DkRotatingRect::toExifRect(const QSize &size) const
+{
+    // TODO: if the angle is > 0 I get issues (photoshop has the same interpretation as we do)
+    QPointF center = getCenter();
+
+    QPolygonF polygon = getPoly();
+    DkVector vec;
+    double angle = getAngle();
+
+    for (int i = 0; i < 4; i++) {
+        // We need the second quadrant, but I do not know why... just tried it out.
+        vec = polygon[i] - center;
+        if (vec.x <= 0 && vec.y > 0)
+            break;
+    }
+
+    vec.rotate(angle * 2);
+    vec.abs();
+
+    float top = (float)center.y() - vec.y;
+    float bottom = (float)center.y() + vec.y;
+    float left = (float)center.x() - vec.x;
+    float right = (float)center.x() + vec.x;
+
+    // Normalize the coordinates:
+    top /= size.height();
+    bottom /= size.height();
+    left /= size.width();
+    right /= size.width();
+
+    return QRectF(QPointF(left, top), QSizeF(right - left, bottom - top));
 }
 
-DkRotatingRect DkRotatingRect::fromExifRect(const QRectF& rect, const QSize& size, double angle) {
+DkRotatingRect DkRotatingRect::fromExifRect(const QRectF &rect, const QSize &size, double angle)
+{
+    double a = CV_PI * 0.5 - angle;
 
-	double a = CV_PI*0.5 - angle;
+    QRectF rt(rect.left() * size.width(), rect.top() * size.height(), rect.width() * size.width(), rect.height() * size.height());
 
-	QRectF rt(rect.left()*size.width(), rect.top()*size.height(), rect.width()*size.width(), rect.height()*size.height());
-	
-	// 
-	DkVector ul = rt.topLeft()-rt.center();
-	ul.rotate(-a);
+    //
+    DkVector ul = rt.topLeft() - rt.center();
+    ul.rotate(-a);
 
-	QSizeF s(std::abs(ul.x * 2.0f), std::abs(ul.y * 2.0f));
-	
-	QRectF rts(QPoint(), s);
-	rts.moveCenter(rt.center());
+    QSizeF s(std::abs(ul.x * 2.0f), std::abs(ul.y * 2.0f));
 
-	DkRotatingRect rr(rts);
-	rr.rotate(-a);
+    QRectF rts(QPoint(), s);
+    rts.moveCenter(rt.center());
 
-	return rr;
-}
+    DkRotatingRect rr(rts);
+    rr.rotate(-a);
 
-void DkRotatingRect::transform(const QTransform & translation, const QTransform & rotation) {
-
-	// apply transform
-	QPolygonF p = mRect;
-	p = translation.map(p);
-	p = rotation.map(p); 
-	p = translation.inverted().map(p);
-
-	// Check the order or vertexes
-	float signedArea = (float)((p[1].x() - p[0].x()) * (p[2].y() - p[0].y()) - (p[1].y()- p[0].y()) * (p[2].x() - p[0].x()));
-	// If it's wrong, just change it
-	if (signedArea > 0) {
-		QPointF tmp = p[1];
-		p[1] = p[3];
-		p[3] = tmp;
-	}
-
-	// update corners
-	setPoly(p);
+    return rr;
 }
 
-void DkRotatingRect::rotate(double angle) {
-
-	QPointF c = getCenter();
+void DkRotatingRect::transform(const QTransform &translation, const QTransform &rotation)
+{
+    // apply transform
+    QPolygonF p = mRect;
+    p = translation.map(p);
+    p = rotation.map(p);
+    p = translation.inverted().map(p);
+
+    // Check the order or vertexes
+    float signedArea = (float)((p[1].x() - p[0].x()) * (p[2].y() - p[0].y()) - (p[1].y() - p[0].y()) * (p[2].x() - p[0].x()));
+    // If it's wrong, just change it
+    if (signedArea > 0) {
+        QPointF tmp = p[1];
+        p[1] = p[3];
+        p[3] = tmp;
+    }
+
+    // update corners
+    setPoly(p);
+}
 
-	QTransform tt;
-	tt.translate(-c.x(), -c.y());
+void DkRotatingRect::rotate(double angle)
+{
+    QPointF c = getCenter();
 
-	QTransform rt;
-	rt.rotateRadians(angle-getAngle());
+    QTransform tt;
+    tt.translate(-c.x(), -c.y());
 
-	transform(tt, rt);
+    QTransform rt;
+    rt.rotateRadians(angle - getAngle());
 
+    transform(tt, rt);
 }
 
-std::ostream& DkRotatingRect::put(std::ostream& s) {
-
-	s << "DkRotatingRect: ";
-	for (int idx = 0; idx < mRect.size(); idx++) {
-		DkVector vec = DkVector(mRect[idx]);
-		s << vec << ", ";
-	}
+std::ostream &DkRotatingRect::put(std::ostream &s)
+{
+    s << "DkRotatingRect: ";
+    for (int idx = 0; idx < mRect.size(); idx++) {
+        DkVector vec = DkVector(mRect[idx]);
+        s << vec << ", ";
+    }
 
-	return s;
+    return s;
 }
 
 }
diff --git a/ImageLounge/src/DkCore/DkMath.h b/ImageLounge/src/DkCore/DkMath.h
index c37ef23..fd3dd61 100644
--- a/ImageLounge/src/DkCore/DkMath.h
+++ b/ImageLounge/src/DkCore/DkMath.h
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkMath.h
  Created on:	25.02.2010
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -27,34 +27,34 @@
 
 #pragma once
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <cmath>
-#include <float.h>
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QDebug>
 #include <QPointF>
 #include <QPolygonF>
-#pragma warning(pop)		// no warnings from includes - end
+#include <cmath>
+#include <float.h>
+#pragma warning(pop) // no warnings from includes - end
 
 #ifdef QT_NO_DEBUG_OUTPUT
-#pragma warning(disable: 4127)		// no 'conditional expression is constant' if qDebug() messages are removed
+#pragma warning(disable : 4127) // no 'conditional expression is constant' if qDebug() messages are removed
 #endif
 
 #ifdef WITH_OPENCV
 
 #ifdef Q_OS_WIN
-#pragma warning(disable: 4996)
+#pragma warning(disable : 4996)
 #endif
 
 #include "opencv2/core/core.hpp"
 #else
 
-//#define int64 long long;
+// #define int64 long long;
 #define CV_PI 3.141592653589793238462643383279
 
 #endif
 
-#define DK_DEG2RAD	0.017453292519943
-#define DK_RAD2DEG 	57.295779513082323
+#define DK_DEG2RAD 0.017453292519943
+#define DK_RAD2DEG 57.295779513082323
 
 // no min max macros for windows...
 #undef min
@@ -72,811 +72,828 @@
 
 // Qt defines
 
-namespace nmc {
+namespace nmc
+{
 
-/** 
+/**
  * Provides useful mathematical functions.
  **/
-class DkMath {
-
+class DkMath
+{
 public:
-	
-	/** 
-	 * Divides the integer by 2.
-	 * @param val the integer value.
-	 * @return the half integer (floor(val)).
-	 **/
-	static int halfInt(int val) {
-		return (val >> 1);
-	}
-
-	/**
-	 * Returns the greatest common divisor (GGT).
-	 * Where a must be greater than b.
-	 * @param a the greater number.
-	 * @param b the smaller number.
-	 * @return int the greatest common divisor.
-	 **/ 
-	static int gcd(int a, int b) {
-		// zu deutsch: ggt
-
-		if (b==0)
-			return a;
-		else
-			return gcd(b, a%b);
-	}
-
-	/**
-	 * Computes the normalized angle in radians.
-	 * The normalized angle is in this case defined as the
-	 * corresponding angle within [0 pi].
-	 * @param angle an angle in radians.
-	 * @return the normalized angle in radians within [0 pi].
-	 **/
-	static double normAngleRad(double angle) {
-
-		// this could be a bottleneck
-		if (std::abs(angle) > 1000)
-			return angle;
-
-		while (angle < 0)
-			angle += 2*CV_PI;
-		while (angle >= 2*CV_PI)
-			angle -= 2*CV_PI;
-
-		return angle;
-	}
-
-	/**
-	 * Computes the normalized angle within startIvl and endIvl.
-	 * @param angle the angle in radians.
-	 * @param startIvl the interval's lower bound.
-	 * @param endIvl the interval's upper bound.
-	 * @return the angle within [startIvl endIvl)
-	 **/
-	static double normAngleRad(double angle, double startIvl, double endIvl) {
-
-		// this could be a bottleneck
-		if (std::abs(angle) > 1000)
-			return angle;
-
-		while(angle <= startIvl)
-			angle += endIvl-startIvl;
-		while(angle > endIvl)
-			angle -= endIvl-startIvl;
-
-		return angle;
-	}
-
-	/**
-	 * Computes the normalized angle within startIvl and endIvl.
-	 * @param angle the angle in radians.
-	 * @param startIvl the interval's lower bound.
-	 * @param endIvl the interval's upper bound.
-	 * @return the angle within [startIvl endIvl)
-	 **/
-	static float normAngleRad(float angle, float startIvl, float endIvl) {
-
-		// this could be a bottleneck
-		if (std::abs(angle) > 1000)
-			return angle;
-
-		while(angle <= startIvl)
-			angle += endIvl-startIvl;
-		while(angle > endIvl)
-			angle -= endIvl-startIvl;
-
-		return angle;
-	}
-
-	/**
-	 * Computes the normalized angle in radians.
-	 * The normalized angle is in this case defined as the
-	 * corresponding angle within [0 pi].
-	 * @param angle an angle in radians.
-	 * @return the normalized angle in radians within [0 pi].
-	 **/
-	static float normAngleRad(float angle) {
-
-		// this could be a bottleneck
-		if (std::abs(angle) > 1000)
-			return angle;
-
-		while (angle < 0)
-			angle += 2*(float)CV_PI;
-		while (angle >= 2.0*CV_PI)
-			angle -= 2*(float)CV_PI;
-
-		return angle;
-	}
-
-	static float getReadableAngle(double angle) {
-
-		double sAngle = angle*DK_RAD2DEG;
-
-		while (sAngle > 90)
-			sAngle -= 180;
-		while (sAngle < -90)
-			sAngle += 180;
-
-		sAngle = qRound(sAngle*100)/100.0f;
-
-		return (float)sAngle;
-	}
-
-	static double distAngle(const double angle1, const double angle2) {
-
-		double nAngle1 = normAngleRad(angle1);
-		double nAngle2 = normAngleRad(angle2);
-
-		double angle = std::abs(nAngle1 - nAngle2);
-
-		return (angle > CV_PI) ? 2*CV_PI - angle : angle;
-	}
-
-	/**
-	 * Check if a number is a power of two.
-	 * @param ps a positive integer
-	 * @return true if ps is a power of two.
-	 **/
-	static bool isPowerOfTwo(unsigned int ps) {
-
-		// count the bit set, see: http://tekpool.wordpress.com/category/bit-count/
-		unsigned int bC;
-
-		bC = ps - ((ps >> 1) & 033333333333) - ((ps >> 2) & 011111111111);
-		bC = ((bC + (bC >> 3)) & 030707070707) % 63;
-
-		return bC == 1;
-	}
-
-	static float getNextPowerOfTwoDivisior(float factor) {
-
-		int iv = qRound(1.0f/factor);
-		int pt = getNextPowerOfTwo(iv);
-
-		// if the number is not yet a power of two or pt is one
-		if (pt != iv && pt != 1)
-			pt = pt >> 1;
-
-		return (float)pt;
-	}
-
-	/**
-	 * Returns the next power of two.
-	 * @param val a number for which the next power of two needs to be computed.
-	 * @return the next power of two for val.
-	 **/
-	static int getNextPowerOfTwo(int val) {
-
-		int pt = 1;
-		while (val > pt)
-			pt = pt << 1;	// *2
-
-		return pt;
-	}
-
-	/**
-	 * Returns the value of f(x,sigma) where f is a gaussian.
-	 * @param sigma of the gaussian distribution.
-	 * @param x param of the gaussian.
-	 * @return f(x,sigma) .
-	 **/
-	static float getGaussian(float sigma, float x) {
-
-		return 1/sqrt(2*(float)CV_PI*sigma*sigma) * exp(-(x*x)/(2*sigma*sigma));
-	}
-
-	template <typename numFmt>
-	static numFmt sq(numFmt x) {
-		
-		return x*x;
-	}
-
-	template <typename numFmt>
-	static double log2(numFmt x) {
-
-		return log((double)x)/log(2.0);
-	}
-
-
+    /**
+     * Divides the integer by 2.
+     * @param val the integer value.
+     * @return the half integer (floor(val)).
+     **/
+    static int halfInt(int val)
+    {
+        return (val >> 1);
+    }
+
+    /**
+     * Returns the greatest common divisor (GGT).
+     * Where a must be greater than b.
+     * @param a the greater number.
+     * @param b the smaller number.
+     * @return int the greatest common divisor.
+     **/
+    static int gcd(int a, int b)
+    {
+        // zu deutsch: ggt
+
+        if (b == 0)
+            return a;
+        else
+            return gcd(b, a % b);
+    }
+
+    /**
+     * Computes the normalized angle in radians.
+     * The normalized angle is in this case defined as the
+     * corresponding angle within [0 pi].
+     * @param angle an angle in radians.
+     * @return the normalized angle in radians within [0 pi].
+     **/
+    static double normAngleRad(double angle)
+    {
+        // this could be a bottleneck
+        if (std::abs(angle) > 1000)
+            return angle;
+
+        while (angle < 0)
+            angle += 2 * CV_PI;
+        while (angle >= 2 * CV_PI)
+            angle -= 2 * CV_PI;
+
+        return angle;
+    }
+
+    /**
+     * Computes the normalized angle within startIvl and endIvl.
+     * @param angle the angle in radians.
+     * @param startIvl the interval's lower bound.
+     * @param endIvl the interval's upper bound.
+     * @return the angle within [startIvl endIvl)
+     **/
+    static double normAngleRad(double angle, double startIvl, double endIvl)
+    {
+        // this could be a bottleneck
+        if (std::abs(angle) > 1000)
+            return angle;
+
+        while (angle <= startIvl)
+            angle += endIvl - startIvl;
+        while (angle > endIvl)
+            angle -= endIvl - startIvl;
+
+        return angle;
+    }
+
+    /**
+     * Computes the normalized angle within startIvl and endIvl.
+     * @param angle the angle in radians.
+     * @param startIvl the interval's lower bound.
+     * @param endIvl the interval's upper bound.
+     * @return the angle within [startIvl endIvl)
+     **/
+    static float normAngleRad(float angle, float startIvl, float endIvl)
+    {
+        // this could be a bottleneck
+        if (std::abs(angle) > 1000)
+            return angle;
+
+        while (angle <= startIvl)
+            angle += endIvl - startIvl;
+        while (angle > endIvl)
+            angle -= endIvl - startIvl;
+
+        return angle;
+    }
+
+    /**
+     * Computes the normalized angle in radians.
+     * The normalized angle is in this case defined as the
+     * corresponding angle within [0 pi].
+     * @param angle an angle in radians.
+     * @return the normalized angle in radians within [0 pi].
+     **/
+    static float normAngleRad(float angle)
+    {
+        // this could be a bottleneck
+        if (std::abs(angle) > 1000)
+            return angle;
+
+        while (angle < 0)
+            angle += 2 * (float)CV_PI;
+        while (angle >= 2.0 * CV_PI)
+            angle -= 2 * (float)CV_PI;
+
+        return angle;
+    }
+
+    static float getReadableAngle(double angle)
+    {
+        double sAngle = angle * DK_RAD2DEG;
+
+        while (sAngle > 90)
+            sAngle -= 180;
+        while (sAngle < -90)
+            sAngle += 180;
+
+        sAngle = qRound(sAngle * 100) / 100.0f;
+
+        return (float)sAngle;
+    }
+
+    static double distAngle(const double angle1, const double angle2)
+    {
+        double nAngle1 = normAngleRad(angle1);
+        double nAngle2 = normAngleRad(angle2);
+
+        double angle = std::abs(nAngle1 - nAngle2);
+
+        return (angle > CV_PI) ? 2 * CV_PI - angle : angle;
+    }
+
+    /**
+     * Check if a number is a power of two.
+     * @param ps a positive integer
+     * @return true if ps is a power of two.
+     **/
+    static bool isPowerOfTwo(unsigned int ps)
+    {
+        // count the bit set, see: http://tekpool.wordpress.com/category/bit-count/
+        unsigned int bC;
+
+        bC = ps - ((ps >> 1) & 033333333333) - ((ps >> 2) & 011111111111);
+        bC = ((bC + (bC >> 3)) & 030707070707) % 63;
+
+        return bC == 1;
+    }
+
+    static float getNextPowerOfTwoDivisior(float factor)
+    {
+        int iv = qRound(1.0f / factor);
+        int pt = getNextPowerOfTwo(iv);
+
+        // if the number is not yet a power of two or pt is one
+        if (pt != iv && pt != 1)
+            pt = pt >> 1;
+
+        return (float)pt;
+    }
+
+    /**
+     * Returns the next power of two.
+     * @param val a number for which the next power of two needs to be computed.
+     * @return the next power of two for val.
+     **/
+    static int getNextPowerOfTwo(int val)
+    {
+        int pt = 1;
+        while (val > pt)
+            pt = pt << 1; // *2
+
+        return pt;
+    }
+
+    /**
+     * Returns the value of f(x,sigma) where f is a gaussian.
+     * @param sigma of the gaussian distribution.
+     * @param x param of the gaussian.
+     * @return f(x,sigma) .
+     **/
+    static float getGaussian(float sigma, float x)
+    {
+        return 1 / sqrt(2 * (float)CV_PI * sigma * sigma) * exp(-(x * x) / (2 * sigma * sigma));
+    }
+
+    template<typename numFmt>
+    static numFmt sq(numFmt x)
+    {
+        return x * x;
+    }
+
+    template<typename numFmt>
+    static double log2(numFmt x)
+    {
+        return log((double)x) / log(2.0);
+    }
 };
 
 /**
  * A simple 2D vector class.
  */
-class DllCoreExport DkVector {
-
+class DllCoreExport DkVector
+{
 public:
-	
-	union {
-		float x;		/**< the vector's x-coordinate*/
-		float width;	/**< the vector's x-coordinate*/
-		float r;		/**< radius for log-polar coordinates or red channel*/
-		float h;		/**< hue channel*/
-	};
-	
-	union {
-		float y;		/**< the vector's y-coordinate*/
-		float height;	/**< the vector's y-coordinate*/
-		float theta;	/**< angle for log-polar coordinates*/
-		float g;		/**< green channel*/
-		float l;		/**< luminance channel*/
-	};
-	
-	/** 
-	 * Default constructor.
-	 **/
-	DkVector() : x(0), y(0) {};
-
-	/** 
-	 * Initializes an object.
-	 * @param x the vector's x-coordinate.
-	 * @param y the vector's y-coordinate.
-	 **/
-	DkVector(float x, float y) {
-		this->x = x;
-		this->y = y;
-	};
+    union {
+        float x; /**< the vector's x-coordinate*/
+        float width; /**< the vector's x-coordinate*/
+        float r; /**< radius for log-polar coordinates or red channel*/
+        float h; /**< hue channel*/
+    };
+
+    union {
+        float y; /**< the vector's y-coordinate*/
+        float height; /**< the vector's y-coordinate*/
+        float theta; /**< angle for log-polar coordinates*/
+        float g; /**< green channel*/
+        float l; /**< luminance channel*/
+    };
+
+    /**
+     * Default constructor.
+     **/
+    DkVector()
+        : x(0)
+        , y(0){};
+
+    /**
+     * Initializes an object.
+     * @param x the vector's x-coordinate.
+     * @param y the vector's y-coordinate.
+     **/
+    DkVector(float x, float y)
+    {
+        this->x = x;
+        this->y = y;
+    };
 
 #ifdef WITH_OPENCV
-	/**
-	 * Initializes an object by means of the OpenCV size.
-	 * @param s the size.
-	 **/
-	DkVector(cv::Size s) {
-		this->width  = (float)s.width;
-		this->height = (float)s.height;
-	};
-
-	/**
-	 * Initializes a Vector by means of a OpenCV Point.
-	 * @param p the point
-	 **/
-	DkVector(cv::Point2f p) {
-		this->x = p.x;
-		this->y = p.y;
-	};
-
-	/**
-	 * Initializes a Vector by means of a OpenCV Point.
-	 * @param p the point
-	 **/
-	DkVector(cv::Point p) {
-		this->x = (float)p.x;
-		this->y = (float)p.y;
-	};
+    /**
+     * Initializes an object by means of the OpenCV size.
+     * @param s the size.
+     **/
+    DkVector(cv::Size s)
+    {
+        this->width = (float)s.width;
+        this->height = (float)s.height;
+    };
+
+    /**
+     * Initializes a Vector by means of a OpenCV Point.
+     * @param p the point
+     **/
+    DkVector(cv::Point2f p)
+    {
+        this->x = p.x;
+        this->y = p.y;
+    };
+
+    /**
+     * Initializes a Vector by means of a OpenCV Point.
+     * @param p the point
+     **/
+    DkVector(cv::Point p)
+    {
+        this->x = (float)p.x;
+        this->y = (float)p.y;
+    };
 #endif
 
-	/**
-	 * Initializes the vector by means of a QPointF.
-	 * @param p a QPointF
-	 **/ 
-	DkVector(QPointF p) {
-		this->x = (float)p.x();
-		this->y = (float)p.y();
-	};
-
-	/** 
-	 * Default destructor.
-	 **/
-	virtual ~DkVector() {};
-
-	/**
-	 * Compares two vectors.
-	 * @return true if both vectors have the same coordinates
-	 */
-	virtual bool operator== (const DkVector &vec) const {
-
-		return (this->x == vec.x && this->y == vec.y);
-	};
-
-	/**
-	 * Compares two vectors.
-	 * @return true if both either the x or y coordinates of both
-	 * vectors are not the same.
-	 */
-	virtual bool operator!= (const DkVector &vec) const {
-
-		return (this->x != vec.x || this->y != vec.y);
-	};
-
-	/**
-	 * Decides which vector is smaller.
-	 * If y is < vec.y the function returns true.
-	 * Solely if y == vec.y the x coordinates are compared.
-	 * @param vec the vector to compare this instance with.
-	 * @return true if y < vec.y or y == vec.y && x < vec.y.
-	 **/
-	virtual bool operator< (const DkVector &vec) const {
-
-		if (y != vec.y)
-			return y < vec.y;
-		else
-			return x < vec.x;
-	};
-
-	/**  
-	 * Adds vector to the current vector.
-	 * @param vec the vector to be added
-	 */
-	virtual void operator+= (const DkVector &vec) {
-
-		this->x += vec.x;
-		this->y += vec.y;
-	};
-
-	/** 
-	 * Adds a scalar to the current vector.
-	 * @param scalar the scalar which should be added
-	 */
-	virtual void operator+= (const float &scalar) {
-
-		this->x += scalar;
-		this->y += scalar;
-	};
-
-	/** 
-	 * Computes the direction vector between this vector and vec.
-	 * Computes the direction vector pointing to the current vector
-	 * and replacing it.
-	 */
-	virtual void operator-= (const DkVector &vec) {
-
-		this->x -= vec.x;
-		this->y -= vec.y;
-	};
-	
-	/** 
-	 * Subtracts a scalar from the current vector.
-	 * @param scalar the scalar which should be subtracted.
-	 */
-	virtual void operator-= (const float &scalar) {
-		
-		this->x -= scalar;
-		this->y -= scalar;
-	};
-
-	/** 
-	 * Scalar product.
-	 * @param vec a vector which should be considered for the scalar product.
-	 * @return the scalar product of vec and the current vector.
-	 */ 
-	virtual float operator* (const DkVector &vec) const {
-
-		return this->x*vec.x + this->y*vec.y;
-	};
-
-	/** 
-	 * Scalar multiplication.
-	 * @param scalar a scalar.
-	 */
-	virtual void operator*= (const float scalar) {
-		
-		this->x *= scalar;
-		this->y *= scalar;
-	};
-
-	/** 
-	 * Scalar division.
-	 * @param scalar a scalar.
-	 */
-	virtual void operator/= (const float scalar) {
-		this->x /= scalar;
-		this->y /= scalar;
-	};
-
-	// friends ----------------
-
-	/** 
-	 * Adds a vector to the current vector.
-	 * @param vec the vector which should be added
-	 * @return the addition of the current and the given vector.
-	 */
-	friend DkVector operator+ (const DkVector &vec, const DkVector &vec2) {
-
-		return DkVector(vec.x+vec2.x, vec.y+vec2.y);
-	};
-
-	/** 
-	 * Adds a scalar to the current vector.
-	 * @param scalar the scalar which should be added
-	 * @return the addition of the current vector and the scalar given.
-	 */
-	friend DkVector operator+ (const DkVector &vec, const float &scalar) {
-
-		return DkVector(vec.x+scalar, vec.y+scalar);
-	};
-
-	/** 
-	 * Adds a scalar to the current vector.
-	 * @param scalar the scalar which should be added
-	 * @return the addition of the current vector and the scalar given.
-	 */
-	friend DkVector operator+ (const float &scalar, const DkVector &vec) {
-
-		return DkVector(vec.x+scalar, vec.y+scalar);
-	};
-
-	/** 
-	 * Computes the direction vector between the given vector and vec.
-	 * The direction vector C is computed by means of: C = B-A
-	 * where B is the current vector.
-	 * @param vec the basis vector A.
-	 * @return a direction vector that points from @param vec to the 
-	 * current vector.
-	 */
-	friend DkVector operator- (const DkVector &vec, const DkVector &vec2) {
-
-		return DkVector(vec.x-vec2.x, vec.y-vec2.y);
-	};
-
-	/** 
-	 * Subtracts a scalar from the current vector.
-	 * @param scalar the scalar which should be subtracted.
-	 * @return the subtraction of the current vector and the scalar given.
-	 */
-	friend DkVector operator- (const DkVector vec, const float &scalar) {
-
-		return DkVector(vec.x-scalar, vec.y-scalar);
-	};
-
-	/** 
-	 * Subtracts the vector from a scalar.
-	 * @param scalar the scalar which should be subtracted.
-	 * @return the subtraction of the current vector and the scalar given.
-	 */
-	friend DkVector operator- (const float &scalar, const DkVector vec) {
-
-		return DkVector(scalar-vec.x, scalar-vec.y);
-	};
-
-	/** 
-	 * Scalar multiplication.
-	 * @param scalar a scalar.
-	 * @return the current vector multiplied by a scalar.
-	 */
-	friend DkVector operator* (const DkVector& vec, const float scalar) {
-
-		return DkVector(vec.x*scalar, vec.y*scalar);
-	};
-
-	/** 
-	 * Scalar multiplication.
-	 * @param scalar a scalar.
-	 * @return the current vector multiplied by a scalar.
-	 */
-	friend DkVector operator* (const float &scalar, const DkVector& vec) {
-
-		return DkVector(vec.x*scalar, vec.y*scalar);
-	};
-
-	/** 
-	 * Scalar division.
-	 * @param vec a vector which shall be divided.
-	 * @param scalar a scalar.
-	 * @return the current vector divided by a scalar.
-	 */
-	friend DkVector operator/ (const DkVector &vec, const float &scalar) {
-
-		return DkVector(vec.x/scalar, vec.y/scalar);
-	};
-
-	/** 
-	 * Scalar division.
-	 * @param scalar a scalar.
-	 * @param vec a vector which shall be divided.
-	 * @return the current vector divided by a scalar.
-	 */
-	friend DkVector operator/ (const float &scalar, const DkVector &vec) {
-
-		return DkVector(scalar/vec.x, scalar/vec.y);
-	};
-
-	/**
-	 * Writes the vector r coordinates to the outputstream s.
-	 * @param s the outputstream
-	 * @param r the vector
-	 * @return friend std::ostream& the modified outputstream
-	 **/ 
-	friend std::ostream& operator<<(std::ostream& s, DkVector& r){
-
-		return r.put(s);
-	};
-
-	/**
-	 * Writes the vector coordinates to the stream s.
-	 * @param s the output stream
-	 * @return std::ostream& the output stream with the coordinates.
-	 **/ 
-	virtual std::ostream& put(std::ostream& s) {
-
-		return s << "[" << x << ", " << y << "]";
-	};
-
-	bool isEmpty() const {
-
-		return x == 0 && y == 0;
-	};
-
-
-	/**
-	 * Returns the largest coordinate.
-	 * @return float the largest coordinate
-	 **/ 
-	virtual float maxCoord() {
-
-		return qMax(x, y);
-	};
-
-	/**
-	 * Returns the largest coordinate.
-	 * @return float the largest coordinate.
-	 **/ 
-	virtual float minCoord() const {
-
-		return qMin(x, y);
-	};
-
-	/**
-	 * Creates a new vector having the
-	 * maximum coordinates of both vectors.
-	 * Thus: n.x = max(this.x, vec.x).
-	 * @param vec the second vector.
-	 * @return a vector having the maximum 
-	 * coordinates of both vectors.
-	 **/
-	virtual DkVector maxVec(const DkVector vec) const {
-
-		return DkVector(qMax(x, vec.x), qMax(y, vec.y));
-	}
-
-	/**
-	 * Creates a new vector having the
-	 * minimum coordinates of both vectors.
-	 * Thus: n.x = min(this.x, vec.x).
-	 * @param vec the second vector.
-	 * @return a vector having the minimum
-	 * coordinates of both vectors.
-	 **/
-	virtual DkVector minVec(const DkVector vec) const{
-
-		return DkVector(qMin(x, vec.x), qMin(y, vec.y));
-	}
-
-	/**
-	 * Swaps the coordinates of a vector.
-	 **/
-	void swap() {
-		float xtmp = x;
-		x = y;
-		y = xtmp;
-	}
-
-	/** 
-	* Returns the angle between two vectors
-	*  @param vec vector
-	*  @return the angle between two vectors
-	*/
-	double angle(const DkVector &vec) const {
-		return acos(cosv(vec));
-	};
-
-	double cosv(const DkVector& vec) const {
-		return (this->x*vec.x + this->y*vec.y) / (sqrt(this->x*this->x + this->y*this->y)*sqrt(vec.x*vec.x + vec.y*vec.y));
-	};
-
-	/**
-	 * Returns the vector's angle in radians.
-	 * The angle is computed by: atan2(y,x).
-	 * @return the vector's angle in radians.
-	 **/
-	double angle() const {
-		return atan2(y, x);
-	};
-
-	/**
-	 * Rotates the vector by a specified angle in radians.
-	 * The rotation matrix is: R(-theta) = [cos sin; -sin cos]
-	 * @param angle the rotation angle in radians.
-	 **/
-	void rotate(double angle) {
-		
-		float xtmp = x;
-		x = (float) ( xtmp*cos(angle)+y*sin(angle));
-		y = (float) (-xtmp*sin(angle)+y*cos(angle));
-	};
-
-	/**
-	 * Computes the absolute value of both coordinates.
-	 **/
-	virtual void abs() {
-
-		x = fabs(x);
-		y = fabs(y);
-	};
-
-	/**
-	 * Clips the vector's coordinates to the bounds given.
-	 * @param maxBound the maximum bound.
-	 * @param minBound the minimum bound.
-	 **/
-	virtual void clipTo(float maxBound = 1.0f, float minBound = 0.0f) {
-
-		if (minBound > maxBound) {
-			qDebug() << "[DkVector3] maxBound < minBound: " << maxBound << " < " << minBound;
-			return;
-		}
-
-		if (x > maxBound)		x = maxBound;
-		else if (x < minBound)	x = minBound;
-		if (y > maxBound)		y = maxBound;
-		else if (y < minBound)	y = minBound;
-
-	};
-
-	/**
-	* Clips the vector's coordinates to the bounds given.
-	* @param maxBound the maximum bound.
-	* @param minBound the minimum bound.
-	**/
-	virtual void clipTo(const DkVector& maxBound) {
-
-		if (maxBound.x < 0  || maxBound.y < 0) {
-
-			DkVector nonConst = maxBound;
-			//qWarning() << "[WARNING] clipTo maxBound < 0: " << nonConst.toString();
-			return;
-		}
-
-		maxVec(DkVector(0.0f,0.0f));
-		minVec(maxBound);
-	};
-	
-	/** 
-	 * Normal vector.
-	 * @return a vector which is normal to the current vector
-	 * (rotated by 90� counter clockwise).
-	 */
-	DkVector normalVec() const {
-
-		return DkVector(-y, x);
-	};
-
-	/** 
-	 * The vector norm.
-	 * @return the vector norm of the current vector.
-	 */
-	virtual float norm() const{
-		
-		return sqrt(this->x*this->x + this->y*this->y);
-	}
-
-	/** 
-	 * Normalizes the vector.
-	 * After normalization the vector's magnitude is |v| = 1
-	 */
-	virtual void normalize() {
-		float n = norm();
-		x /= n; 
-		y /= n;
-	};
-
-	/** Returns euclidean distance between two vectors
-	 *  @param vec vector
-	 *  @return the euclidean distance
-	 */
-	virtual float euclideanDistance(const DkVector &vec) {
-		return sqrt((this->x - vec.x)*(this->x - vec.x) + (this->y - vec.y)*(this->y - vec.y));
-	};
-	
-
-	/** 
-	 * Scalar product.
-	 * @param vec a vector which should be considered for the scalar product.
-	 * @return the scalar product of vec and the current vector.
-	 */ 
-	virtual float scalarProduct(const DkVector vec) const {
-
-		return this->x*vec.x + this->y*vec.y;
-	};
-
-	virtual DkVector round() const {
-		return DkVector((float)qRound(x), (float)qRound(y));
-	} 
-
-	///** 
-	// * String containing the vector's values.
-	// * @return a String representing the vector's coordinates: <x, y>
-	// */
-	//virtual std::string toString();
-
-	/** 
-	 * Slope of a line connecting two vectors. 
-	 * start point is the actual vector, end point the parameter vector
-	 * @param vec a vector which should be considered for the slope.
-	 * @return the slope between the two points.
-	 */ 
-	float slope(DkVector vec) {
-		return (vec.x - this->x) != 0 ? (vec.y - this->y) / (vec.x - this->x) : FLT_MAX;
-	}
-
-	virtual QPointF toQPointF() const {
-		return QPointF(x, y);
-	};
-
-	DkVector mul(const DkVector& vec) const {
-		return DkVector(x*vec.x, y*vec.y);
-	};
+    /**
+     * Initializes the vector by means of a QPointF.
+     * @param p a QPointF
+     **/
+    DkVector(QPointF p)
+    {
+        this->x = (float)p.x();
+        this->y = (float)p.y();
+    };
+
+    /**
+     * Default destructor.
+     **/
+    virtual ~DkVector(){};
+
+    /**
+     * Compares two vectors.
+     * @return true if both vectors have the same coordinates
+     */
+    virtual bool operator==(const DkVector &vec) const
+    {
+        return (this->x == vec.x && this->y == vec.y);
+    };
+
+    /**
+     * Compares two vectors.
+     * @return true if both either the x or y coordinates of both
+     * vectors are not the same.
+     */
+    virtual bool operator!=(const DkVector &vec) const
+    {
+        return (this->x != vec.x || this->y != vec.y);
+    };
+
+    /**
+     * Decides which vector is smaller.
+     * If y is < vec.y the function returns true.
+     * Solely if y == vec.y the x coordinates are compared.
+     * @param vec the vector to compare this instance with.
+     * @return true if y < vec.y or y == vec.y && x < vec.y.
+     **/
+    virtual bool operator<(const DkVector &vec) const
+    {
+        if (y != vec.y)
+            return y < vec.y;
+        else
+            return x < vec.x;
+    };
+
+    /**
+     * Adds vector to the current vector.
+     * @param vec the vector to be added
+     */
+    virtual void operator+=(const DkVector &vec)
+    {
+        this->x += vec.x;
+        this->y += vec.y;
+    };
+
+    /**
+     * Adds a scalar to the current vector.
+     * @param scalar the scalar which should be added
+     */
+    virtual void operator+=(const float &scalar)
+    {
+        this->x += scalar;
+        this->y += scalar;
+    };
+
+    /**
+     * Computes the direction vector between this vector and vec.
+     * Computes the direction vector pointing to the current vector
+     * and replacing it.
+     */
+    virtual void operator-=(const DkVector &vec)
+    {
+        this->x -= vec.x;
+        this->y -= vec.y;
+    };
+
+    /**
+     * Subtracts a scalar from the current vector.
+     * @param scalar the scalar which should be subtracted.
+     */
+    virtual void operator-=(const float &scalar)
+    {
+        this->x -= scalar;
+        this->y -= scalar;
+    };
+
+    /**
+     * Scalar product.
+     * @param vec a vector which should be considered for the scalar product.
+     * @return the scalar product of vec and the current vector.
+     */
+    virtual float operator*(const DkVector &vec) const
+    {
+        return this->x * vec.x + this->y * vec.y;
+    };
+
+    /**
+     * Scalar multiplication.
+     * @param scalar a scalar.
+     */
+    virtual void operator*=(const float scalar)
+    {
+        this->x *= scalar;
+        this->y *= scalar;
+    };
+
+    /**
+     * Scalar division.
+     * @param scalar a scalar.
+     */
+    virtual void operator/=(const float scalar)
+    {
+        this->x /= scalar;
+        this->y /= scalar;
+    };
+
+    // friends ----------------
+
+    /**
+     * Adds a vector to the current vector.
+     * @param vec the vector which should be added
+     * @return the addition of the current and the given vector.
+     */
+    friend DkVector operator+(const DkVector &vec, const DkVector &vec2)
+    {
+        return DkVector(vec.x + vec2.x, vec.y + vec2.y);
+    };
+
+    /**
+     * Adds a scalar to the current vector.
+     * @param scalar the scalar which should be added
+     * @return the addition of the current vector and the scalar given.
+     */
+    friend DkVector operator+(const DkVector &vec, const float &scalar)
+    {
+        return DkVector(vec.x + scalar, vec.y + scalar);
+    };
+
+    /**
+     * Adds a scalar to the current vector.
+     * @param scalar the scalar which should be added
+     * @return the addition of the current vector and the scalar given.
+     */
+    friend DkVector operator+(const float &scalar, const DkVector &vec)
+    {
+        return DkVector(vec.x + scalar, vec.y + scalar);
+    };
+
+    /**
+     * Computes the direction vector between the given vector and vec.
+     * The direction vector C is computed by means of: C = B-A
+     * where B is the current vector.
+     * @param vec the basis vector A.
+     * @return a direction vector that points from @param vec to the
+     * current vector.
+     */
+    friend DkVector operator-(const DkVector &vec, const DkVector &vec2)
+    {
+        return DkVector(vec.x - vec2.x, vec.y - vec2.y);
+    };
+
+    /**
+     * Subtracts a scalar from the current vector.
+     * @param scalar the scalar which should be subtracted.
+     * @return the subtraction of the current vector and the scalar given.
+     */
+    friend DkVector operator-(const DkVector vec, const float &scalar)
+    {
+        return DkVector(vec.x - scalar, vec.y - scalar);
+    };
+
+    /**
+     * Subtracts the vector from a scalar.
+     * @param scalar the scalar which should be subtracted.
+     * @return the subtraction of the current vector and the scalar given.
+     */
+    friend DkVector operator-(const float &scalar, const DkVector vec)
+    {
+        return DkVector(scalar - vec.x, scalar - vec.y);
+    };
+
+    /**
+     * Scalar multiplication.
+     * @param scalar a scalar.
+     * @return the current vector multiplied by a scalar.
+     */
+    friend DkVector operator*(const DkVector &vec, const float scalar)
+    {
+        return DkVector(vec.x * scalar, vec.y * scalar);
+    };
+
+    /**
+     * Scalar multiplication.
+     * @param scalar a scalar.
+     * @return the current vector multiplied by a scalar.
+     */
+    friend DkVector operator*(const float &scalar, const DkVector &vec)
+    {
+        return DkVector(vec.x * scalar, vec.y * scalar);
+    };
+
+    /**
+     * Scalar division.
+     * @param vec a vector which shall be divided.
+     * @param scalar a scalar.
+     * @return the current vector divided by a scalar.
+     */
+    friend DkVector operator/(const DkVector &vec, const float &scalar)
+    {
+        return DkVector(vec.x / scalar, vec.y / scalar);
+    };
+
+    /**
+     * Scalar division.
+     * @param scalar a scalar.
+     * @param vec a vector which shall be divided.
+     * @return the current vector divided by a scalar.
+     */
+    friend DkVector operator/(const float &scalar, const DkVector &vec)
+    {
+        return DkVector(scalar / vec.x, scalar / vec.y);
+    };
+
+    /**
+     * Writes the vector r coordinates to the outputstream s.
+     * @param s the outputstream
+     * @param r the vector
+     * @return friend std::ostream& the modified outputstream
+     **/
+    friend std::ostream &operator<<(std::ostream &s, DkVector &r)
+    {
+        return r.put(s);
+    };
+
+    /**
+     * Writes the vector coordinates to the stream s.
+     * @param s the output stream
+     * @return std::ostream& the output stream with the coordinates.
+     **/
+    virtual std::ostream &put(std::ostream &s)
+    {
+        return s << "[" << x << ", " << y << "]";
+    };
+
+    bool isEmpty() const
+    {
+        return x == 0 && y == 0;
+    };
+
+    /**
+     * Returns the largest coordinate.
+     * @return float the largest coordinate
+     **/
+    virtual float maxCoord()
+    {
+        return qMax(x, y);
+    };
+
+    /**
+     * Returns the largest coordinate.
+     * @return float the largest coordinate.
+     **/
+    virtual float minCoord() const
+    {
+        return qMin(x, y);
+    };
+
+    /**
+     * Creates a new vector having the
+     * maximum coordinates of both vectors.
+     * Thus: n.x = max(this.x, vec.x).
+     * @param vec the second vector.
+     * @return a vector having the maximum
+     * coordinates of both vectors.
+     **/
+    virtual DkVector maxVec(const DkVector vec) const
+    {
+        return DkVector(qMax(x, vec.x), qMax(y, vec.y));
+    }
+
+    /**
+     * Creates a new vector having the
+     * minimum coordinates of both vectors.
+     * Thus: n.x = min(this.x, vec.x).
+     * @param vec the second vector.
+     * @return a vector having the minimum
+     * coordinates of both vectors.
+     **/
+    virtual DkVector minVec(const DkVector vec) const
+    {
+        return DkVector(qMin(x, vec.x), qMin(y, vec.y));
+    }
+
+    /**
+     * Swaps the coordinates of a vector.
+     **/
+    void swap()
+    {
+        float xtmp = x;
+        x = y;
+        y = xtmp;
+    }
+
+    /**
+     * Returns the angle between two vectors
+     *  @param vec vector
+     *  @return the angle between two vectors
+     */
+    double angle(const DkVector &vec) const
+    {
+        return acos(cosv(vec));
+    };
+
+    double cosv(const DkVector &vec) const
+    {
+        return (this->x * vec.x + this->y * vec.y) / (sqrt(this->x * this->x + this->y * this->y) * sqrt(vec.x * vec.x + vec.y * vec.y));
+    };
+
+    /**
+     * Returns the vector's angle in radians.
+     * The angle is computed by: atan2(y,x).
+     * @return the vector's angle in radians.
+     **/
+    double angle() const
+    {
+        return atan2(y, x);
+    };
+
+    /**
+     * Rotates the vector by a specified angle in radians.
+     * The rotation matrix is: R(-theta) = [cos sin; -sin cos]
+     * @param angle the rotation angle in radians.
+     **/
+    void rotate(double angle)
+    {
+        float xtmp = x;
+        x = (float)(xtmp * cos(angle) + y * sin(angle));
+        y = (float)(-xtmp * sin(angle) + y * cos(angle));
+    };
+
+    /**
+     * Computes the absolute value of both coordinates.
+     **/
+    virtual void abs()
+    {
+        x = fabs(x);
+        y = fabs(y);
+    };
+
+    /**
+     * Clips the vector's coordinates to the bounds given.
+     * @param maxBound the maximum bound.
+     * @param minBound the minimum bound.
+     **/
+    virtual void clipTo(float maxBound = 1.0f, float minBound = 0.0f)
+    {
+        if (minBound > maxBound) {
+            qDebug() << "[DkVector3] maxBound < minBound: " << maxBound << " < " << minBound;
+            return;
+        }
+
+        if (x > maxBound)
+            x = maxBound;
+        else if (x < minBound)
+            x = minBound;
+        if (y > maxBound)
+            y = maxBound;
+        else if (y < minBound)
+            y = minBound;
+    };
+
+    /**
+     * Clips the vector's coordinates to the bounds given.
+     * @param maxBound the maximum bound.
+     * @param minBound the minimum bound.
+     **/
+    virtual void clipTo(const DkVector &maxBound)
+    {
+        if (maxBound.x < 0 || maxBound.y < 0) {
+            DkVector nonConst = maxBound;
+            // qWarning() << "[WARNING] clipTo maxBound < 0: " << nonConst.toString();
+            return;
+        }
+
+        maxVec(DkVector(0.0f, 0.0f));
+        minVec(maxBound);
+    };
+
+    /**
+     * Normal vector.
+     * @return a vector which is normal to the current vector
+     * (rotated by 90� counter clockwise).
+     */
+    DkVector normalVec() const
+    {
+        return DkVector(-y, x);
+    };
+
+    /**
+     * The vector norm.
+     * @return the vector norm of the current vector.
+     */
+    virtual float norm() const
+    {
+        return sqrt(this->x * this->x + this->y * this->y);
+    }
+
+    /**
+     * Normalizes the vector.
+     * After normalization the vector's magnitude is |v| = 1
+     */
+    virtual void normalize()
+    {
+        float n = norm();
+        x /= n;
+        y /= n;
+    };
+
+    /** Returns euclidean distance between two vectors
+     *  @param vec vector
+     *  @return the euclidean distance
+     */
+    virtual float euclideanDistance(const DkVector &vec)
+    {
+        return sqrt((this->x - vec.x) * (this->x - vec.x) + (this->y - vec.y) * (this->y - vec.y));
+    };
+
+    /**
+     * Scalar product.
+     * @param vec a vector which should be considered for the scalar product.
+     * @return the scalar product of vec and the current vector.
+     */
+    virtual float scalarProduct(const DkVector vec) const
+    {
+        return this->x * vec.x + this->y * vec.y;
+    };
+
+    virtual DkVector round() const
+    {
+        return DkVector((float)qRound(x), (float)qRound(y));
+    }
+
+    ///**
+    // * String containing the vector's values.
+    // * @return a String representing the vector's coordinates: <x, y>
+    // */
+    // virtual std::string toString();
+
+    /**
+     * Slope of a line connecting two vectors.
+     * start point is the actual vector, end point the parameter vector
+     * @param vec a vector which should be considered for the slope.
+     * @return the slope between the two points.
+     */
+    float slope(DkVector vec)
+    {
+        return (vec.x - this->x) != 0 ? (vec.y - this->y) / (vec.x - this->x) : FLT_MAX;
+    }
+
+    virtual QPointF toQPointF() const
+    {
+        return QPointF(x, y);
+    };
+
+    DkVector mul(const DkVector &vec) const
+    {
+        return DkVector(x * vec.x, y * vec.y);
+    };
 
 #ifdef WITH_OPENCV
-	/**
-	 * Convert DkVector to cv::Point.
-	 * @return a cv::Point having the vector's coordinates.
-	 **/
-	virtual cv::Point getCvPoint32f() const {
-
-		return cv::Point_<float>(x, y);
-	};
-
-	/**
-	 * Convert DkVector to cv::Point.
-	 * The vectors coordinates are rounded.
-	 * @return a cv::Point having the vector's coordinates.
-	 **/
-	virtual cv::Point getCvPoint() const {
-
-		return cv::Point(qRound(x), qRound(y));
-	};
-
-	/**
-	 * Convert DkVector to cv::Size.
-	 * The vector coordinates are rounded.
-	 * @return a cv::Size having the vector's coordinates.
-	 **/
-	cv::Size getCvSize() const {
-
-		return cv::Size(qRound(width), qRound(height));
-	}
+    /**
+     * Convert DkVector to cv::Point.
+     * @return a cv::Point having the vector's coordinates.
+     **/
+    virtual cv::Point getCvPoint32f() const
+    {
+        return cv::Point_<float>(x, y);
+    };
+
+    /**
+     * Convert DkVector to cv::Point.
+     * The vectors coordinates are rounded.
+     * @return a cv::Point having the vector's coordinates.
+     **/
+    virtual cv::Point getCvPoint() const
+    {
+        return cv::Point(qRound(x), qRound(y));
+    };
+
+    /**
+     * Convert DkVector to cv::Size.
+     * The vector coordinates are rounded.
+     * @return a cv::Size having the vector's coordinates.
+     **/
+    cv::Size getCvSize() const
+    {
+        return cv::Size(qRound(width), qRound(height));
+    }
 #endif
 };
 
-class DllCoreExport DkRotatingRect {
-
+class DllCoreExport DkRotatingRect
+{
 public:
-	DkRotatingRect(QRectF rect = QRectF());
-	virtual ~DkRotatingRect();
-
-	friend std::ostream& operator<<(std::ostream& s, DkRotatingRect& r) {
-		return r.put(s);
-	};
-
-	bool isEmpty() const;
-	void setAllCorners(QPointF &p);
-	DkVector getDiagonal(int cIdx) const;
-	QCursor cpCursor(int idx);
-	void updateCorner(int cIdx, QPointF nC, DkVector oldDiag = DkVector());
-	const QPolygonF& getPoly() const;
-	void setPoly(QPolygonF &poly);
-	QPolygonF getClosedPoly();
-	QPointF getCenter() const;
-	QPointF getTopLeft() const;
-	void setSize(const QSizeF& s);
-	QSize size() const;
-	void setCenter(const QPointF& center);
-	double getAngle() const;
-	float getAngleDeg() const;
-	void getTransform(QTransform& tForm, QPointF& size) const;
-	QRectF toExifRect(const QSize& size) const;
-	static DkRotatingRect fromExifRect(const QRectF& rect, const QSize& size, double angle);
-	void transform(const QTransform& translation, const QTransform& rotation);
-	void rotate(double angle);
+    DkRotatingRect(QRectF rect = QRectF());
+    virtual ~DkRotatingRect();
+
+    friend std::ostream &operator<<(std::ostream &s, DkRotatingRect &r)
+    {
+        return r.put(s);
+    };
+
+    bool isEmpty() const;
+    void setAllCorners(QPointF &p);
+    DkVector getDiagonal(int cIdx) const;
+    QCursor cpCursor(int idx);
+    void updateCorner(int cIdx, QPointF nC, DkVector oldDiag = DkVector());
+    const QPolygonF &getPoly() const;
+    void setPoly(QPolygonF &poly);
+    QPolygonF getClosedPoly();
+    QPointF getCenter() const;
+    QPointF getTopLeft() const;
+    void setSize(const QSizeF &s);
+    QSize size() const;
+    void setCenter(const QPointF &center);
+    double getAngle() const;
+    float getAngleDeg() const;
+    void getTransform(QTransform &tForm, QPointF &size) const;
+    QRectF toExifRect(const QSize &size) const;
+    static DkRotatingRect fromExifRect(const QRectF &rect, const QSize &size, double angle);
+    void transform(const QTransform &translation, const QTransform &rotation);
+    void rotate(double angle);
 
 protected:
+    virtual std::ostream &put(std::ostream &s);
 
-	virtual std::ostream& put(std::ostream& s);
-
-	QPolygonF mRect;
+    QPolygonF mRect;
 };
 
 }
diff --git a/ImageLounge/src/DkCore/DkMessageBox.cpp b/ImageLounge/src/DkCore/DkMessageBox.cpp
index e0a600d..4348fcf 100644
--- a/ImageLounge/src/DkCore/DkMessageBox.cpp
+++ b/ImageLounge/src/DkCore/DkMessageBox.cpp
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkMessageBox.cpp
  Created on:	28.03.2014
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2014 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2014 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2014 Florian Kleber <florian@nomacs.org>
@@ -28,235 +28,226 @@
 #include "DkMessageBox.h"
 #include "DkSettings.h"
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QDialogButtonBox>
+#pragma warning(push, 0) // no warnings from includes - begin
+#include <QApplication>
 #include <QCheckBox>
-#include <QSettings>
-#include <QLabel>
-#include <QStyle>
-#include <QGridLayout>
 #include <QDebug>
-#include <QApplication>
 #include <QDesktopWidget>
-#include <QPushButton>
+#include <QDialogButtonBox>
+#include <QGridLayout>
 #include <QGuiApplication>
+#include <QLabel>
+#include <QPushButton>
 #include <QScreen>
-#pragma warning(pop)		// no warnings from includes - end
+#include <QSettings>
+#include <QStyle>
+#pragma warning(pop) // no warnings from includes - end
 
 #ifdef QT_NO_DEBUG_OUTPUT
-#pragma warning(disable: 4127)		// no 'conditional expression is constant' if qDebug() messages are removed
+#pragma warning(disable : 4127) // no 'conditional expression is constant' if qDebug() messages are removed
 #endif
 
-namespace nmc {
+namespace nmc
+{
 
 // DkMessageBox --------------------------------------------------------------------
-DkMessageBox::DkMessageBox(QMessageBox::Icon icon, 
-	const QString& title, 
-	const QString& text, 
-	QMessageBox::StandardButtons buttons /* = QMessageBox::NoButton */, 
-	QWidget* parent /* = 0 */, 
-	Qt::WindowFlags f /* = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint */) : QDialog(parent, f) {
-
-		createLayout(icon, text, buttons);
-		setWindowTitle(title);
-
+DkMessageBox::DkMessageBox(QMessageBox::Icon icon,
+                           const QString &title,
+                           const QString &text,
+                           QMessageBox::StandardButtons buttons /* = QMessageBox::NoButton */,
+                           QWidget *parent /* = 0 */,
+                           Qt::WindowFlags f /* = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint */)
+    : QDialog(parent, f)
+{
+    createLayout(icon, text, buttons);
+    setWindowTitle(title);
 }
 
-DkMessageBox::DkMessageBox(QWidget* parent /* = 0 */) : QDialog(parent) {
-
-	createLayout(QMessageBox::NoIcon, "", QMessageBox::NoButton);
-	setWindowTitle(tr("Error"));
+DkMessageBox::DkMessageBox(QWidget *parent /* = 0 */)
+    : QDialog(parent)
+{
+    createLayout(QMessageBox::NoIcon, "", QMessageBox::NoButton);
+    setWindowTitle(tr("Error"));
 }
 
-DkMessageBox::~DkMessageBox() {
-	
-	// save settings
-	DefaultSettings settings;
-	settings.beginGroup("DkDialog");
-	settings.setValue(objectName(), !showAgain->isChecked());
-	settings.endGroup();
+DkMessageBox::~DkMessageBox()
+{
+    // save settings
+    DefaultSettings settings;
+    settings.beginGroup("DkDialog");
+    settings.setValue(objectName(), !showAgain->isChecked());
+    settings.endGroup();
 }
 
-void DkMessageBox::createLayout(const QMessageBox::Icon& userIcon, const QString& userText, QMessageBox::StandardButtons buttons) {
-
-	setAttribute(Qt::WA_DeleteOnClose, true);
+void DkMessageBox::createLayout(const QMessageBox::Icon &userIcon, const QString &userText, QMessageBox::StandardButtons buttons)
+{
+    setAttribute(Qt::WA_DeleteOnClose, true);
 
-	//schamlos von qmessagebox.cpp geklaut
-	textLabel = new QLabel(userText);
-	textLabel->setTextInteractionFlags(Qt::TextInteractionFlags(style()->styleHint(QStyle::SH_MessageBox_TextInteractionFlags, 0, this)));
+    // schamlos von qmessagebox.cpp geklaut
+    textLabel = new QLabel(userText);
+    textLabel->setTextInteractionFlags(Qt::TextInteractionFlags(style()->styleHint(QStyle::SH_MessageBox_TextInteractionFlags, 0, this)));
 
-	textLabel->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
-	textLabel->setOpenExternalLinks(true);
+    textLabel->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
+    textLabel->setOpenExternalLinks(true);
 #if defined(Q_OS_MAC)
-	textLabel->setContentsMargins(16, 0, 0, 0);
+    textLabel->setContentsMargins(16, 0, 0, 0);
 #else
-	textLabel->setContentsMargins(2, 0, 0, 0);
-	textLabel->setIndent(9);
+    textLabel->setContentsMargins(2, 0, 0, 0);
+    textLabel->setIndent(9);
 #endif
-	icon = userIcon;
-	iconLabel = new QLabel;
-	iconLabel->setPixmap(QMessageBox::standardIcon((QMessageBox::Icon)icon));
-	iconLabel->setObjectName(QLatin1String("iconLabel"));
-	iconLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
-
-	showAgain = new QCheckBox(tr("Remember my choice"));
-	showAgain->setChecked(true);
-
-	buttonBox = new QDialogButtonBox;
-	buttonBox->setObjectName(QLatin1String("buttonBox"));
-	buttonBox->setCenterButtons(style()->styleHint(QStyle::SH_MessageBox_CenterButtons, 0, this) != 0);
-	QObject::connect(buttonBox, SIGNAL(clicked(QAbstractButton*)),
-		this, SLOT(buttonClicked(QAbstractButton*)));
-
-	buttonBox->setStandardButtons(QDialogButtonBox::StandardButtons(int(buttons)));
-	
-	QGridLayout *grid = new QGridLayout;
+    icon = userIcon;
+    iconLabel = new QLabel;
+    iconLabel->setPixmap(QMessageBox::standardIcon((QMessageBox::Icon)icon));
+    iconLabel->setObjectName(QLatin1String("iconLabel"));
+    iconLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+
+    showAgain = new QCheckBox(tr("Remember my choice"));
+    showAgain->setChecked(true);
+
+    buttonBox = new QDialogButtonBox;
+    buttonBox->setObjectName(QLatin1String("buttonBox"));
+    buttonBox->setCenterButtons(style()->styleHint(QStyle::SH_MessageBox_CenterButtons, 0, this) != 0);
+    QObject::connect(buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *)));
+
+    buttonBox->setStandardButtons(QDialogButtonBox::StandardButtons(int(buttons)));
+
+    QGridLayout *grid = new QGridLayout;
 #ifndef Q_OS_MAC
-	grid->addWidget(iconLabel, 0, 0, 2, 1, Qt::AlignTop);
-	grid->addWidget(textLabel, 0, 1, 1, 1);
-	grid->addWidget(showAgain, 2, 1, 1, 2);
-	grid->addWidget(buttonBox, 3, 0, 1, 2);
+    grid->addWidget(iconLabel, 0, 0, 2, 1, Qt::AlignTop);
+    grid->addWidget(textLabel, 0, 1, 1, 1);
+    grid->addWidget(showAgain, 2, 1, 1, 2);
+    grid->addWidget(buttonBox, 3, 0, 1, 2);
 #else
-	grid->setMargin(0);
-	grid->setVerticalSpacing(8);
-	grid->setHorizontalSpacing(0);
-	setContentsMargins(24, 15, 24, 20);
-	grid->addWidget(iconLabel, 0, 0, 2, 1, Qt::AlignTop | Qt::AlignLeft);
-	grid->addWidget(textLabel, 0, 1, 1, 1);
-	// -- leave space for information label --
-	grid->setRowStretch(1, 100);
-	grid->setRowMinimumHeight(2, 6);
-	grid->addWidget(buttonBox, 3, 1, 1, 1);
+    grid->setMargin(0);
+    grid->setVerticalSpacing(8);
+    grid->setHorizontalSpacing(0);
+    setContentsMargins(24, 15, 24, 20);
+    grid->addWidget(iconLabel, 0, 0, 2, 1, Qt::AlignTop | Qt::AlignLeft);
+    grid->addWidget(textLabel, 0, 1, 1, 1);
+    // -- leave space for information label --
+    grid->setRowStretch(1, 100);
+    grid->setRowMinimumHeight(2, 6);
+    grid->addWidget(buttonBox, 3, 1, 1, 1);
 #endif
 
-	//grid->setSizeConstraint(QLayout::SetNoConstraint);
-	setLayout(grid);
+    // grid->setSizeConstraint(QLayout::SetNoConstraint);
+    setLayout(grid);
 
-	setModal(true);
+    setModal(true);
 
 #ifdef Q_OS_MAC
-	QFont f = font();
-	f.setBold(true);
-	textLabel->setFont(f);
+    QFont f = font();
+    f.setBold(true);
+    textLabel->setFont(f);
 #endif
-
 }
 
-void DkMessageBox::setVisible(bool visible) {
-
-
-	if (visible)
-		adjustSize();
+void DkMessageBox::setVisible(bool visible)
+{
+    if (visible)
+        adjustSize();
 
-	QDialog::setVisible(visible);
+    QDialog::setVisible(visible);
 }
 
-int DkMessageBox::exec() {
+int DkMessageBox::exec()
+{
+    QString objName = objectName();
 
-	QString objName = objectName();
+    DefaultSettings settings;
+    settings.beginGroup("DkDialog");
+    bool show = settings.value(objName, true).toBool();
+    int answer = settings.value(objName + "-answer", QDialog::Accepted).toInt();
+    settings.endGroup();
+    showAgain->setChecked(!show);
 
-	DefaultSettings settings;
-	settings.beginGroup("DkDialog");
-	bool show = settings.value(objName, true).toBool();
-	int answer = settings.value(objName + "-answer", QDialog::Accepted).toInt();
-	settings.endGroup();
-	showAgain->setChecked(!show);
+    if (!show)
+        return answer;
 
-	if (!show)
-		return answer;
+    answer = QDialog::exec(); // destroys dialog - be careful with what you do afterwards
 
-	answer = QDialog::exec();	// destroys dialog - be careful with what you do afterwards
+    settings.beginGroup("DkDialog");
+    if (answer != QMessageBox::NoButton && answer != QMessageBox::Cancel) {
+        // save show again
+        settings.setValue(objName + "-answer", answer);
+    } else
+        settings.setValue(objName, true);
+    settings.endGroup();
 
-	settings.beginGroup("DkDialog");
-	if (answer != QMessageBox::NoButton && answer != QMessageBox::Cancel) {
-		// save show again
-		settings.setValue(objName + "-answer", answer);
-	}
-	else
-		settings.setValue(objName, true);
-	settings.endGroup();
-
-	return answer;
+    return answer;
 }
 
-void DkMessageBox::setDefaultButton(QMessageBox::StandardButton button) {
-	
-	QPushButton* b = buttonBox->button(QDialogButtonBox::StandardButton(button));
+void DkMessageBox::setDefaultButton(QMessageBox::StandardButton button)
+{
+    QPushButton *b = buttonBox->button(QDialogButtonBox::StandardButton(button));
 
-	if (!b)
-		return;
+    if (!b)
+        return;
 
-	b->setDefault(true);
-	b->setFocus();
+    b->setDefault(true);
+    b->setFocus();
 }
 
-void DkMessageBox::setButtonText(QMessageBox::StandardButton button, const QString &text) {
-	
-	if (QAbstractButton *abstractButton = buttonBox->button(QDialogButtonBox::StandardButton(button)))
-		abstractButton->setText(text);
+void DkMessageBox::setButtonText(QMessageBox::StandardButton button, const QString &text)
+{
+    if (QAbstractButton *abstractButton = buttonBox->button(QDialogButtonBox::StandardButton(button)))
+        abstractButton->setText(text);
 }
 
-
-void DkMessageBox::buttonClicked(QAbstractButton* button) {
-
-	int ret = buttonBox->standardButton(button);
-	done(ret); // does not trigger closeEvent
+void DkMessageBox::buttonClicked(QAbstractButton *button)
+{
+    int ret = buttonBox->standardButton(button);
+    done(ret); // does not trigger closeEvent
 }
 
-void DkMessageBox::updateSize() {
-
-	if (!isVisible())
-		return;
+void DkMessageBox::updateSize()
+{
+    if (!isVisible())
+        return;
 
-	QFontMetrics fm(QApplication::font("QMdiSubWindowTitleBar"));
+    QFontMetrics fm(QApplication::font("QMdiSubWindowTitleBar"));
 
-#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
-	QSize screenSize = QApplication::desktop()->availableGeometry(QCursor::pos()).size();
-	int textWidth = fm.width(windowTitle()) + 50;
-#else
-	QScreen* screen = QGuiApplication::screenAt(QCursor::pos());
-	QSize screenSize = screen ? screen->size() : QSize(1024, 768);	// diem: be safe
-	int textWidth = fm.horizontalAdvance(windowTitle()) + 50;
-#endif
+    QScreen *screen = QGuiApplication::screenAt(QCursor::pos());
+    QSize screenSize = screen ? screen->size() : QSize(1024, 768); // diem: be safe
+    int textWidth = fm.horizontalAdvance(windowTitle()) + 50;
 
 #if defined(Q_OS_WINCE)
-	// the width of the screen, less the window border.
-	int hardLimit = screenSize.width() - (frameGeometry().width() - geometry().width());
+    // the width of the screen, less the window border.
+    int hardLimit = screenSize.width() - (frameGeometry().width() - geometry().width());
 #else
-	int hardLimit = qMin(screenSize.width() - 480, 1000); // can never get bigger than this
-	// on small screens allows the messagebox be the same size as the screen
-	if (screenSize.width() <= 1024)
-		hardLimit = screenSize.width();
+    int hardLimit = qMin(screenSize.width() - 480, 1000); // can never get bigger than this
+    // on small screens allows the messagebox be the same size as the screen
+    if (screenSize.width() <= 1024)
+        hardLimit = screenSize.width();
 #endif
 #ifdef Q_OS_MAC
-	int softLimit = qMin(screenSize.width()/2, 420);
+    int softLimit = qMin(screenSize.width() / 2, 420);
 #else
-	// note: ideally on windows, hard and soft limits but it breaks compat
+        // note: ideally on windows, hard and soft limits but it breaks compat
 #ifndef Q_OS_WINCE
-	int softLimit = qMin(screenSize.width()/2, 500);
+    int softLimit = qMin(screenSize.width() / 2, 500);
 #else
-	int softLimit = qMin(screenSize.width() * 3 / 4, 500);
-#endif //Q_OS_WINCE
+    int softLimit = qMin(screenSize.width() * 3 / 4, 500);
+#endif // Q_OS_WINCE
 #endif
 
-	textLabel->setWordWrap(false); // makes the label return min size
-	int width = minimumWidth();
+    textLabel->setWordWrap(false); // makes the label return min size
+    int width = minimumWidth();
 
-	if (width > softLimit) {
-		textLabel->setWordWrap(true);
-		width = qMax(softLimit, minimumWidth());
+    if (width > softLimit) {
+        textLabel->setWordWrap(true);
+        width = qMax(softLimit, minimumWidth());
 
-		if (width > hardLimit)
-			width = hardLimit;
-	}
+        if (width > hardLimit)
+            width = hardLimit;
+    }
 
-	int windowTitleWidth = qMin(textWidth, hardLimit);
-	if (windowTitleWidth > width)
-		width = windowTitleWidth;
-
-	this->setFixedSize(width, minimumHeight());
-	QCoreApplication::removePostedEvents(this, QEvent::LayoutRequest);
+    int windowTitleWidth = qMin(textWidth, hardLimit);
+    if (windowTitleWidth > width)
+        width = windowTitleWidth;
 
+    this->setFixedSize(width, minimumHeight());
+    QCoreApplication::removePostedEvents(this, QEvent::LayoutRequest);
 }
 
-}
\ No newline at end of file
+}
diff --git a/ImageLounge/src/DkCore/DkMessageBox.h b/ImageLounge/src/DkCore/DkMessageBox.h
index f1cb017..a047fec 100644
--- a/ImageLounge/src/DkCore/DkMessageBox.h
+++ b/ImageLounge/src/DkCore/DkMessageBox.h
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkMessageBox.h
  Created on:	28.03.2014
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2014 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2014 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2014 Florian Kleber <florian@nomacs.org>
@@ -27,10 +27,10 @@
 
 #pragma once
 
-#pragma warning(push, 0)	// no warnings from includes - begin
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QDialog>
 #include <QMessageBox>
-#pragma warning(pop)		// no warnings from includes - end
+#pragma warning(pop) // no warnings from includes - end
 
 #ifndef DllCoreExport
 #ifdef DK_CORE_DLL_EXPORT
@@ -46,40 +46,41 @@
 class QDialogButtonBox;
 class QCheckBox;
 
-namespace nmc {
+namespace nmc
+{
 
-class DllCoreExport DkMessageBox : public QDialog {
-	Q_OBJECT
+class DllCoreExport DkMessageBox : public QDialog
+{
+    Q_OBJECT
 
 public:
-	DkMessageBox(QMessageBox::Icon icon, 
-		const QString& title, 
-		const QString& text, 
-		QMessageBox::StandardButtons buttons = QMessageBox::NoButton,
-		QWidget* parent = 0, 
-		Qt::WindowFlags f = Qt::Dialog);
-	DkMessageBox(QWidget* parent = 0);
+    DkMessageBox(QMessageBox::Icon icon,
+                 const QString &title,
+                 const QString &text,
+                 QMessageBox::StandardButtons buttons = QMessageBox::NoButton,
+                 QWidget *parent = 0,
+                 Qt::WindowFlags f = Qt::Dialog);
+    DkMessageBox(QWidget *parent = 0);
 
-	~DkMessageBox();
+    ~DkMessageBox();
 
-	virtual void setVisible(bool visible) override;
-	void setDefaultButton(QMessageBox::StandardButton button);
-	void setButtonText(QMessageBox::StandardButton button, const QString &text);
+    virtual void setVisible(bool visible) override;
+    void setDefaultButton(QMessageBox::StandardButton button);
+    void setButtonText(QMessageBox::StandardButton button, const QString &text);
 
 public slots:
-	void buttonClicked(QAbstractButton* button);
-	int exec() override;
+    void buttonClicked(QAbstractButton *button);
+    int exec() override;
 
 protected:
-
-	QLabel* iconLabel;
-	QLabel* textLabel;
-	QMessageBox::Icon icon;
-	QDialogButtonBox* buttonBox;
-	QCheckBox* showAgain;
-
-	void createLayout(const QMessageBox::Icon& userIcon, const QString& userText, QMessageBox::StandardButtons buttons);
-	void updateSize();
+    QLabel *iconLabel;
+    QLabel *textLabel;
+    QMessageBox::Icon icon;
+    QDialogButtonBox *buttonBox;
+    QCheckBox *showAgain;
+
+    void createLayout(const QMessageBox::Icon &userIcon, const QString &userText, QMessageBox::StandardButtons buttons);
+    void updateSize();
 };
 
 }
\ No newline at end of file
diff --git a/ImageLounge/src/DkCore/DkMetaData.cpp b/ImageLounge/src/DkCore/DkMetaData.cpp
index bf1d111..ae6a34e 100644
--- a/ImageLounge/src/DkCore/DkMetaData.cpp
+++ b/ImageLounge/src/DkCore/DkMetaData.cpp
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkMetaData.cpp
  Created on:	19.04.2013
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -26,1868 +26,1955 @@
  *******************************************************************************************************/
 
 #include "DkMetaData.h"
-#include "DkUtils.h"
-#include "DkMath.h"
 #include "DkImageStorage.h"
+#include "DkMath.h"
 #include "DkSettings.h"
 #include "DkTimer.h"
+#include "DkUtils.h"
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QTranslator>
-#include <QObject>
-#include <QImage>
-#include <QDebug>
+#pragma warning(push, 0) // no warnings from includes - begin
+#include <QApplication>
 #include <QBuffer>
+#include <QDebug>
+#include <QImage>
+#include <QObject>
+#include <QRegularExpression>
+#include <QTranslator>
 #include <QVector2D>
-#include <QApplication>
-#pragma warning(pop)		// no warnings from includes - end
+#pragma warning(pop) // no warnings from includes - end
 
 #include <iostream>
 
-namespace nmc {
-
+namespace nmc
+{
 // DkMetaDataT --------------------------------------------------------------------
-DkMetaDataT::DkMetaDataT() {
-
-	mExifState = not_loaded;
-}
-
-void DkMetaDataT::readMetaData(const QString& filePath, QSharedPointer<QByteArray> ba) {
-
-	if (mUseSidecar) {
-		loadSidecar(filePath);
-		return;
-	}
-
-	mFilePath = filePath;
-	QFileInfo fileInfo(filePath);
-
-	try {
-		if (!ba || ba->isEmpty()) {
-
-			// we used to have a few ugly lines here, just to get unicode files loaded
-			// since we load 99% through the buffer & we cannot use /Zc:wchar_t- (as of Qt5.10)
-			// I removed these lines - so if we don't have the buffer, we can only load the metadata
-			// of files that use std::string literals in their path
-			std::string strFilePath = (fileInfo.isSymLink()) ? fileInfo.symLinkTarget().toStdString() : filePath.toStdString();
-			mExifImg = Exiv2::ImageFactory::open(strFilePath);
-		}
-		else {
-			Exiv2::BasicIo::AutoPtr exifBuffer(new Exiv2::MemIo((const byte*)ba->constData(), ba->size()));
-			mExifImg = Exiv2::ImageFactory::open(exifBuffer);
-		}
-	} 
-	catch (...) {
-		// TODO: check crashes here
-		mExifState = no_data;
-		//qDebug() << "[Exiv2] could not open file for exif data";
-		return;
-	}
-	
-
-	if (mExifImg.get() == 0) {
-		mExifState = no_data;
-		qDebug() << "[Exiv2] image could not be opened for exif data extraction";
-		return;
-	}
-
-	try {
-		mExifImg->readMetadata();
+DkMetaDataT::DkMetaDataT()
+{
+    mExifState = not_loaded;
+}
+
+bool DkMetaDataT::isNull()
+{
+    return !mExifImg.get();
+}
+
+QSharedPointer<DkMetaDataT> DkMetaDataT::copy() const
+{
+    // Copy Exiv2::Image object
+    QSharedPointer<DkMetaDataT> metaDataN(new DkMetaDataT());
+    metaDataN->mFilePath = mFilePath;
+    metaDataN->mExifState = mExifState;
+
+    if (mExifImg.get() != 0) {
+        // ImageFactory::create(type) may crash even if old Image object has that type
+        try {
+            // Load new Exiv2::Image object
+            int i_type = mExifImg->imageType();
+            metaDataN->mExifImg = Exiv2::ImageFactory::create(i_type);
+            // Copy exif data from old object into new object
+            Exiv2::ExifData data = mExifImg->exifData();
+            metaDataN->mExifImg->setExifData(data); // explicit copy of list<Exifdatum>
+            metaDataN->mExifState = dirty;
+        } catch (...) {
+            metaDataN->mExifState = no_data;
+        }
+    }
+
+    return metaDataN;
+}
+
+/**
+ * @brief Updates exif data to match that of other.
+ *
+ * @param other
+ */
+void DkMetaDataT::update(const QSharedPointer<DkMetaDataT> &other)
+{
+    QSharedPointer<DkMetaDataT> src(other);
+    // Copy exif data (to this instance), reading from src
+    mExifImg->setExifData(src->mExifImg->exifData()); // explicit copy of list<Exifdatum>
+}
+
+void DkMetaDataT::readMetaData(const QString &filePath, QSharedPointer<QByteArray> ba)
+{
+    if (mUseSidecar) {
+        loadSidecar(filePath);
+        return;
+    }
+
+    mFilePath = filePath;
+    QFileInfo fileInfo(filePath);
+
+    try {
+        if (!ba || ba->isEmpty()) {
+            // we used to have a few ugly lines here, just to get unicode files loaded
+            // since we load 99% through the buffer & we cannot use /Zc:wchar_t- (as of Qt5.10)
+            // I removed these lines - so if we don't have the buffer, we can only load the metadata
+            // of files that use std::string literals in their path
+            std::string strFilePath = (fileInfo.isSymLink()) ? fileInfo.symLinkTarget().toStdString() : filePath.toStdString();
+            mExifImg = Exiv2::ImageFactory::open(strFilePath);
+        } else {
+            Exiv2::BasicIo::AutoPtr exifBuffer(new Exiv2::MemIo((const byte *)ba->constData(), ba->size()));
+            mExifImg = Exiv2::ImageFactory::open(exifBuffer);
+        }
+    } catch (...) {
+        // TODO: check crashes here
+        mExifState = no_data;
+        // qDebug() << "[Exiv2] could not open file for exif data";
+        qInfo() << "[Exiv2] could not load Exif data from file:" << filePath;
+        return;
+    }
+
+    if (mExifImg.get() == 0) {
+        mExifState = no_data;
+        qDebug() << "[Exiv2] image could not be opened for exif data extraction";
+        return;
+    }
+
+    try {
+        mExifImg->readMetadata();
+
+        if (!mExifImg->good()) {
+            qDebug() << "[Exiv2] metadata could not be read";
+            mExifState = no_data;
+            return;
+        }
+
+    } catch (...) {
+        mExifState = no_data;
+        qDebug() << "[Exiv2] could not read metadata (exception)";
+        return;
+    }
+
+    // qDebug() << "[Exiv2] metadata loaded";
+    mExifState = loaded;
+
+    // printMetaData();
+}
+
+/**
+ * @brief saveMetaData() reloads the specified file and updates that file with the modified exif data.
+ *
+ * Note that this changes the file (again).
+ * It's a wrapper around the real saveMetaData() function, which works with an in-memory copy.
+ *
+ * @param filePath path to the file to be read and updated
+ * @param force update file even if no exif data has been changed
+ */
+bool DkMetaDataT::saveMetaData(const QString &filePath, bool force)
+{
+    if (mExifState != loaded && mExifState != dirty)
+        return false;
+
+    // Open image file for reading, read whole file into memory
+    QFile file(filePath);
+    file.open(QFile::ReadOnly);
+    QSharedPointer<QByteArray> ba(new QByteArray(file.readAll()));
+    file.close();
+
+    // Write modified metadata (from this instance) to mExifImg and then to ba (in-memory image file)
+    bool saved = saveMetaData(ba, force);
+    if (!saved) {
+        qDebug() << "[DkMetaDataT] could not save: " << QFileInfo(filePath).fileName();
+        return saved;
+    } else if (ba->isEmpty()) {
+        qDebug() << "[DkMetaDataT] could not save: " << QFileInfo(filePath).fileName() << " empty Buffer!";
+        return false;
+    }
+
+    // Open image file for WRITING, save it with modified metadata
+    file.open(QFile::WriteOnly);
+    file.write(ba->data(), ba->size());
+    file.close();
+
+    qInfo() << "[DkMetaDataT] I saved: " << ba->size() << " bytes";
+
+    return true;
+}
+
+/**
+ * @brief saveMetaData() updates the exif record of an in-memory copy of the image file
+ *
+ * It takes a copy of the file, as a byte array reference, and creates a new copy
+ * with the new exif data. The reference pointer is changed to point to this new copy.
+ * The caller is expected to write this new copy to disk or whatever.
+ *
+ * @param ba in-memory copy of the file to be updated
+ * @param force update file even if no exif data has been changed
+ */
+bool DkMetaDataT::saveMetaData(QSharedPointer<QByteArray> &ba, bool force)
+{
+    if (!ba)
+        return false;
+
+    if (!force && mExifState != dirty)
+        return false;
+    else if (mExifState == not_loaded || mExifState == no_data)
+        return false;
+
+    // Get exif sections from currently loaded image (old exif object)
+    Exiv2::ExifData &exifData = mExifImg->exifData();
+    Exiv2::XmpData &xmpData = mExifImg->xmpData();
+    Exiv2::IptcData &iptcData = mExifImg->iptcData();
+
+    Exiv2::Image::AutoPtr exifImgN;
+    Exiv2::MemIo::AutoPtr exifMem;
+
+    try {
+        // Load new exif object (based on byte array of raw image file, see overload)
+        exifMem = Exiv2::MemIo::AutoPtr(new Exiv2::MemIo((byte *)ba->data(), ba->size()));
+        exifImgN = Exiv2::ImageFactory::open(exifMem);
+    } catch (...) {
+        qDebug() << "could not open image for exif data";
+        return false;
+    }
+
+    if (exifImgN.get() == 0) {
+        qDebug() << "image could not be opened for exif data extraction";
+        return false;
+    }
+
+    exifImgN->readMetadata();
+
+    // Update new exif object, copy changes made to the old exif object (loaded image)
+    exifImgN->setExifData(exifData);
+    exifImgN->setXmpData(xmpData);
+    exifImgN->setIptcData(iptcData);
+
+    exifImgN->writeMetadata(); // TODO: CIMG6206.jpg crashes here...
+
+    // Copy image + new exif and return temporary object as byte array
+    // The calling function should then write it back to the file
+    Exiv2::DataBuf exifBuf = exifImgN->io().read((long)exifImgN->io().size());
+    if (exifBuf.pData_) {
+        QSharedPointer<QByteArray> tmp = QSharedPointer<QByteArray>(new QByteArray((const char *)exifBuf.pData_, exifBuf.size_));
+
+        if (tmp->size() > qRound(ba->size() * 0.5f))
+            ba = tmp;
+        else
+            return false; // catch exif bug - observed e.g. for hasselblad RAW (3fr) files - see: Bug #995 (http://dev.exiv2.org/issues/995)
+    } else
+        return false;
+
+    // Replace old exif object with new one and clear "dirty" flag
+    mExifImg = exifImgN;
+    mExifState = loaded;
+
+    return true;
+}
+
+QString DkMetaDataT::getDescription() const
+{
+    QString description;
+
+    if (mExifState != loaded && mExifState != dirty)
+        return description;
+
+    try {
+        Exiv2::ExifData &exifData = mExifImg->exifData();
+
+        if (!exifData.empty()) {
+            Exiv2::ExifKey key = Exiv2::ExifKey("Exif.Image.ImageDescription");
+            Exiv2::ExifData::iterator pos = exifData.findKey(key);
+
+            if (pos != exifData.end() && pos->count() != 0) {
+                description = exiv2ToQString(pos->toString());
+            }
+        }
+    } catch (...) {
+        qDebug() << "[DkMetaDataT] Error: could not load description";
+        return description;
+    }
+
+    return description;
+}
+
+int DkMetaDataT::getOrientationDegree() const
+{
+    if (mExifState != loaded && mExifState != dirty)
+        return 0;
+
+    int orientation = 0;
+
+    try {
+        Exiv2::ExifData &exifData = mExifImg->exifData();
+
+        if (!exifData.empty()) {
+            Exiv2::ExifKey key = Exiv2::ExifKey("Exif.Image.Orientation");
+            Exiv2::ExifData::iterator pos = exifData.findKey(key);
+
+            if (pos != exifData.end() && pos->count() != 0) {
+                Exiv2::Value::AutoPtr v = pos->getValue();
+                orientation = (int)pos->toFloat();
+
+                switch (orientation) {
+                case 6:
+                    orientation = 90;
+                    break;
+                case 7:
+                    orientation = 90;
+                    break;
+                case 3:
+                    orientation = 180;
+                    break;
+                case 4:
+                    orientation = 180;
+                    break;
+                case 8:
+                    orientation = -90;
+                    break;
+                case 5:
+                    orientation = -90;
+                    break;
+                case 1:
+                    orientation = 0;
+                    break;
+                default:
+                    orientation = -1;
+                    break;
+                }
+            }
+        }
+    } catch (...) {
+        return 0;
+    }
+
+    return orientation;
+}
+
+DkMetaDataT::ExifOrientationState DkMetaDataT::checkExifOrientation() const
+{
+    if (mExifState != loaded && mExifState != dirty)
+        return or_not_set;
+
+    QString orStr = getNativeExifValue("Exif.Image.Orientation", false);
+
+    if (orStr.isEmpty())
+        return or_not_set;
+
+    bool ok = false;
+    int orientation = orStr.toInt(&ok);
 
-		if (!mExifImg->good()) {
-			qDebug() << "[Exiv2] metadata could not be read";
-			mExifState = no_data;
-			return;
-		}
+    // orientation must be integer
+    if (!ok)
+        return or_illegal;
 
-	} catch (...) {
-		mExifState = no_data;
-		qDebug() << "[Exiv2] could not read metadata (exception)";
-		return;
-	}
-	
-	//qDebug() << "[Exiv2] metadata loaded";
-	mExifState = loaded;
-
-	//printMetaData();
+    // according to the specs only values between 0 and 8 are valid
+    if (orientation > 0 && orientation <= 8)
+        return or_valid;
+
+    return or_illegal;
+}
+
+int DkMetaDataT::getRating() const
+{
+    if (mExifState != loaded && mExifState != dirty)
+        return -1;
+
+    float exifRating = -1;
+    float xmpRating = -1;
+    float fRating = 0;
+
+    Exiv2::ExifData &exifData = mExifImg->exifData(); // Exif.Image.Rating  - short
+    Exiv2::XmpData &xmpData = mExifImg->xmpData(); // Xmp.xmp.Rating - text
+
+    // get Rating of Exif Tag
+    if (!exifData.empty()) {
+        Exiv2::ExifKey key = Exiv2::ExifKey("Exif.Image.Rating");
+        Exiv2::ExifData::iterator pos = exifData.findKey(key);
+
+        if (pos != exifData.end() && pos->count() != 0) {
+            Exiv2::Value::AutoPtr v = pos->getValue();
+            exifRating = v->toFloat();
+        }
+    }
+
+    // get Rating of Xmp Tag
+    if (!xmpData.empty()) {
+        Exiv2::XmpKey key = Exiv2::XmpKey("Xmp.xmp.Rating");
+        Exiv2::XmpData::iterator pos = xmpData.findKey(key);
+
+        // xmp Rating tag
+        if (pos != xmpData.end() && pos->count() != 0) {
+            Exiv2::Value::AutoPtr v = pos->getValue();
+            xmpRating = v->toFloat();
+        }
+
+        // if xmpRating not found, try to find MicrosoftPhoto Rating tag
+        if (xmpRating == -1) {
+            key = Exiv2::XmpKey("Xmp.MicrosoftPhoto.Rating");
+            pos = xmpData.findKey(key);
+            if (pos != xmpData.end() && pos->count() != 0) {
+                Exiv2::Value::AutoPtr v = pos->getValue();
+                xmpRating = v->toFloat();
+            }
+        }
+    }
+
+    if (xmpRating == -1.0f && exifRating != -1.0f)
+        fRating = exifRating;
+    else if (xmpRating != -1.0f && exifRating == -1.0f)
+        fRating = xmpRating;
+    else
+        fRating = exifRating;
 
+    return qRound(fRating);
 }
 
-bool DkMetaDataT::saveMetaData(const QString& filePath, bool force) {
-
-	if (mExifState != loaded && mExifState != dirty)
-		return false;
-
-	QFile file(filePath);
-	file.open(QFile::ReadOnly);
-	
-	QSharedPointer<QByteArray> ba(new QByteArray(file.readAll()));
-	file.close();
-	bool saved = saveMetaData(ba, force);
-	if (!saved) {
-		qDebug() << "[DkMetaDataT] could not save: " << QFileInfo(filePath).fileName();
-		return saved;
-	}
-	else if (ba->isEmpty()) {
-		qDebug() << "[DkMetaDataT] could not save: " << QFileInfo(filePath).fileName() << " empty Buffer!";
-		return false;
-	}
-
-	file.open(QFile::WriteOnly);
-	file.write(ba->data(), ba->size());
-	file.close();
-
-	qDebug() << "[DkMetaDataT] I saved: " << ba->size() << " bytes";
-
-	return true;
-}
-
-bool DkMetaDataT::saveMetaData(QSharedPointer<QByteArray>& ba, bool force) {
-
-	if (!ba)
-		return false;
-
-	if (!force && mExifState != dirty)
-		return false;
-	else if (mExifState == not_loaded || mExifState == no_data)
-		return false;
-
-	Exiv2::ExifData &exifData = mExifImg->exifData();
-	Exiv2::XmpData &xmpData = mExifImg->xmpData();
-	Exiv2::IptcData &iptcData = mExifImg->iptcData();
+QSize DkMetaDataT::getImageSize() const
+{
+    QSize size;
 
-	Exiv2::Image::AutoPtr exifImgN;
-	Exiv2::MemIo::AutoPtr exifMem;
+    if (mExifState != loaded && mExifState != dirty)
+        return size;
 
-	try {
+    bool ok = false;
+    int width = getNativeExifValue("Exif.Photo.PixelXDimension", false).toInt(&ok);
 
-		exifMem = Exiv2::MemIo::AutoPtr(new Exiv2::MemIo((byte*)ba->data(), ba->size()));
-		exifImgN = Exiv2::ImageFactory::open(exifMem);
-	} 
-	catch (...) {
+    if (!ok)
+        return size;
 
-		qDebug() << "could not open image for exif data";
-		return false;
-	}
+    int height = getNativeExifValue("Exif.Photo.PixelYDimension", false).toInt(&ok);
 
-	if (exifImgN.get() == 0) {
-		qDebug() << "image could not be opened for exif data extraction";
-		return false;
-	}
+    if (!ok)
+        return size;
 
-
-	exifImgN->readMetadata();
-
-	exifImgN->setExifData(exifData);
-	exifImgN->setXmpData(xmpData);
-	exifImgN->setIptcData(iptcData);
-
-	exifImgN->writeMetadata();		// TODO: CIMG6206.jpg crashes here...
-
-	// now get the data again
-	Exiv2::DataBuf exifBuf = exifImgN->io().read((long)exifImgN->io().size());
-	if (exifBuf.pData_) {
-		QSharedPointer<QByteArray> tmp = QSharedPointer<QByteArray>(new QByteArray((const char*)exifBuf.pData_, exifBuf.size_));
-
-		if (tmp->size() > qRound(ba->size()*0.5f))
-			ba = tmp;
-		else
-			return false;	// catch exif bug - observed e.g. for hasselblad RAW (3fr) files - see: Bug #995 (http://dev.exiv2.org/issues/995)
-	}
-	else
-		return false;
-
-	mExifImg = exifImgN;
-	mExifState = loaded;
-
-	return true;
+    return QSize(width, height);
 }
 
-QString DkMetaDataT::getDescription() const {
+QString DkMetaDataT::getNativeExifValue(const QString &key, bool humanReadable) const
+{
+    QString info;
 
-	QString description;
+    if (mExifState != loaded && mExifState != dirty)
+        return info;
 
-	if (mExifState != loaded && mExifState != dirty)
-		return description;
+    Exiv2::ExifData &exifData = mExifImg->exifData();
 
-	try {
-		Exiv2::ExifData &exifData = mExifImg->exifData();
+    if (!exifData.empty()) {
+        Exiv2::ExifData::iterator pos;
 
-		if (!exifData.empty()) {
+        try {
+            Exiv2::ExifKey ekey = Exiv2::ExifKey(key.toStdString());
+            pos = exifData.findKey(ekey);
 
-			Exiv2::ExifKey key = Exiv2::ExifKey("Exif.Image.ImageDescription");
-			Exiv2::ExifData::iterator pos = exifData.findKey(key);
+        } catch (...) {
+            return info;
+        }
 
-			if (pos != exifData.end() && pos->count() != 0) {
-				description = exiv2ToQString(pos->toString());
-			}
-		}
-	}
-	catch (...) {
+        if (pos != exifData.end() && pos->count() != 0) {
+            if (pos->count() < 2000) { // diem: this is about performance - adobe obviously embeds whole images into tiff exiv data
 
-		qDebug() << "[DkMetaDataT] Error: could not load description";
-		return description;
-	}
+                // qDebug() << "pos count: " << pos->count();
+                // Exiv2::Value::AutoPtr v = pos->getValue();
+                if (humanReadable) {
+                    std::stringstream ss;
+                    ss << *pos;
+                    info = exiv2ToQString(ss.str());
+                } else {
+                    info = exiv2ToQString(pos->toString());
+                }
 
-	return description;
+            } else {
+                info = QObject::tr("<data too large to display>");
+            }
+        }
+    }
 
+    return info;
 }
 
-int DkMetaDataT::getOrientationDegree() const {
-
-	if (mExifState != loaded && mExifState != dirty)
-		return 0;
-
-	int orientation = 0;
-
-	try {
-		Exiv2::ExifData &exifData = mExifImg->exifData();
-
-		if (!exifData.empty()) {
-
-			Exiv2::ExifKey key = Exiv2::ExifKey("Exif.Image.Orientation");
-			Exiv2::ExifData::iterator pos = exifData.findKey(key);
-
-			if (pos != exifData.end() && pos->count() != 0) {
-			
-				Exiv2::Value::AutoPtr v = pos->getValue();
-				orientation = (int)pos->toFloat();
-
-				switch (orientation) {
-				case 6:		orientation = 90;	break;
-				case 7:		orientation = 90;	break;
-				case 3:		orientation = 180;	break;
-				case 4:		orientation = 180;	break;
-				case 8:		orientation = -90;	break;
-				case 5:		orientation = -90;	break;
-				case 1:		orientation = 0; 	break;
-				default:	orientation = -1;	break;
-				}	
-			}
-		}
-	}
-	catch(...) {
-		return 0;
-	}
-
-	return orientation;
-}
+QString DkMetaDataT::getXmpValue(const QString &key) const
+{
+    QString info;
 
-DkMetaDataT::ExifOrientationState DkMetaDataT::checkExifOrientation() const {
+    if (mExifState != loaded && mExifState != dirty)
+        return info;
 
-	if (mExifState != loaded && mExifState != dirty)
-		return or_not_set;
+    Exiv2::XmpData &xmpData = mExifImg->xmpData();
 
-	QString orStr = getNativeExifValue("Exif.Image.Orientation");
+    if (!xmpData.empty()) {
+        Exiv2::XmpData::iterator pos;
 
-	if (orStr.isEmpty())
-		return or_not_set;
+        try {
+            Exiv2::XmpKey ekey = Exiv2::XmpKey(key.toStdString());
+            pos = xmpData.findKey(ekey);
 
-	bool ok = false;
-	int orientation = orStr.toInt(&ok);
-	
-	// orientation must be integer
-	if (!ok)
-		return or_illegal;
+        } catch (...) {
+            return info;
+        }
 
-	// according to the specs only values between 0 and 8 are valid
-	if (orientation > 0 && orientation <= 8)
-		return or_valid;
+        if (pos != xmpData.end() && pos->count() != 0) {
+            Exiv2::Value::AutoPtr v = pos->getValue();
+            info = exiv2ToQString(pos->toString());
+        }
+    }
 
-	return or_illegal;
+    return info;
 }
 
-int DkMetaDataT::getRating() const {
-	
-	if (mExifState != loaded && mExifState != dirty)
-		return -1;
-
-	float exifRating = -1;
-	float xmpRating = -1;
-	float fRating = 0;
-
-	Exiv2::ExifData &exifData = mExifImg->exifData();		//Exif.Image.Rating  - short
-	Exiv2::XmpData &xmpData = mExifImg->xmpData();			//Xmp.xmp.Rating - text
-
-	//get Rating of Exif Tag
-	if (!exifData.empty()) {
-		Exiv2::ExifKey key = Exiv2::ExifKey("Exif.Image.Rating");
-		Exiv2::ExifData::iterator pos = exifData.findKey(key);
+QString DkMetaDataT::getExifValue(const QString &key) const
+{
+    QString info;
 
-		if (pos != exifData.end() && pos->count() != 0) {
-			Exiv2::Value::AutoPtr v = pos->getValue();
-			exifRating = v->toFloat();
-		}
-	}
+    if (mExifState != loaded && mExifState != dirty)
+        return info;
 
-	//get Rating of Xmp Tag
-	if (!xmpData.empty()) {
-		Exiv2::XmpKey key = Exiv2::XmpKey("Xmp.xmp.Rating");
-		Exiv2::XmpData::iterator pos = xmpData.findKey(key);
+    Exiv2::ExifData &exifData = mExifImg->exifData();
+    std::string sKey = key.toStdString();
 
-		//xmp Rating tag
-		if (pos != xmpData.end() && pos->count() != 0) {
-			Exiv2::Value::AutoPtr v = pos->getValue();
-			xmpRating = v->toFloat();
-		}
-
-		//if xmpRating not found, try to find MicrosoftPhoto Rating tag
-		if (xmpRating == -1) {
-			key = Exiv2::XmpKey("Xmp.MicrosoftPhoto.Rating");
-			pos = xmpData.findKey(key);
-			if (pos != xmpData.end() && pos->count() != 0) {
-				Exiv2::Value::AutoPtr v = pos->getValue();
-				xmpRating = v->toFloat();
-			}
-		}
-	}
-
-	if (xmpRating == -1.0f && exifRating != -1.0f)
-		fRating = exifRating;
-	else if (xmpRating != -1.0f && exifRating == -1.0f)
-		fRating = xmpRating;
-	else
-		fRating = exifRating;
-
-	return qRound(fRating);
-}
+    if (!exifData.empty()) {
+        Exiv2::ExifData::iterator pos;
 
-QSize DkMetaDataT::getImageSize() const {
+        try {
+            Exiv2::ExifKey ekey = Exiv2::ExifKey("Exif.Image." + sKey);
+            pos = exifData.findKey(ekey);
 
-	QSize size;
+            if (pos == exifData.end() || pos->count() == 0) {
+                Exiv2::ExifKey lEkey = Exiv2::ExifKey("Exif.Photo." + sKey);
+                pos = exifData.findKey(lEkey);
+            }
+        } catch (...) {
+            try {
+                sKey = "Exif.Photo." + sKey;
+                Exiv2::ExifKey ekey = Exiv2::ExifKey(sKey);
+                pos = exifData.findKey(ekey);
+            } catch (...) {
+                return "";
+            }
+        }
 
-	if (mExifState != loaded && mExifState != dirty)
-		return size;
+        if (pos != exifData.end() && pos->count() != 0) {
+            // Exiv2::Value::AutoPtr v = pos->getValue();
+            info = exiv2ToQString(pos->toString());
+        }
+    }
+
+    return info;
+}
+
+QString DkMetaDataT::getIptcValue(const QString &key) const
+{
+    QString info;
+
+    if (mExifState != loaded && mExifState != dirty)
+        return info;
 
-	bool ok = false;
-	int width = getNativeExifValue("Exif.Photo.PixelXDimension").toInt(&ok);
+    Exiv2::IptcData &iptcData = mExifImg->iptcData();
 
-	if (!ok)
-		return size;
+    if (!iptcData.empty()) {
+        Exiv2::IptcData::iterator pos;
 
-	int height = getNativeExifValue("Exif.Photo.PixelYDimension").toInt(&ok);
+        try {
+            Exiv2::IptcKey ekey = Exiv2::IptcKey(key.toStdString());
+            pos = iptcData.findKey(ekey);
+        } catch (...) {
+            return info;
+        }
 
-	if (!ok)
-		return size;
+        if (pos != iptcData.end() && pos->count() != 0) {
+            Exiv2::Value::AutoPtr v = pos->getValue();
+            info = exiv2ToQString(pos->toString());
+        }
+    }
 
-	return QSize(width, height);
+    return info;
 }
 
-QString DkMetaDataT::getNativeExifValue(const QString& key) const {
+void DkMetaDataT::getFileMetaData(QStringList &fileKeys, QStringList &fileValues) const
+{
+    QFileInfo fileInfo(mFilePath);
+    fileKeys.append(QObject::tr("Filename"));
+    fileValues.append(fileInfo.fileName());
 
-	QString info;
+    fileKeys.append(QObject::tr("Path"));
+    fileValues.append(fileInfo.absolutePath());
 
-	if (mExifState != loaded && mExifState != dirty)
-		return info;
+    if (fileInfo.isSymLink()) {
+        fileKeys.append(QObject::tr("Target"));
+        fileValues.append(fileInfo.symLinkTarget());
+    }
 
-	Exiv2::ExifData &exifData = mExifImg->exifData();
+    fileKeys.append(QObject::tr("Size"));
+    fileValues.append(DkUtils::readableByte((float)fileInfo.size()));
 
-	if (!exifData.empty()) {
+    // date group
+    fileKeys.append(QObject::tr("Date") + "." + QObject::tr("Created"));
+    fileValues.append(fileInfo.birthTime().toString());
 
-		Exiv2::ExifData::iterator pos;
+    fileKeys.append(QObject::tr("Date") + "." + QObject::tr("Last Modified"));
+    fileValues.append(fileInfo.lastModified().toString());
 
-		try {
-			Exiv2::ExifKey ekey = Exiv2::ExifKey(key.toStdString());
-			pos = exifData.findKey(ekey);
-
-		} catch(...) {
-			return info;
-		}
-
-		if (pos != exifData.end() && pos->count() != 0) {
-			
-			if (pos->count () < 2000) {	// diem: this is about performance - adobe obviously embeds whole images into tiff exiv data 
-
-				//qDebug() << "pos count: " << pos->count();
-				//Exiv2::Value::AutoPtr v = pos->getValue();
-				info = exiv2ToQString(pos->toString());
-
-			}
-			else {
-				info = QObject::tr("<data too large to display>");
-			}
-		}
-			
-	}
-
-	return info;
-
-}
+    fileKeys.append(QObject::tr("Date") + "." + QObject::tr("Last Read"));
+    fileValues.append(fileInfo.lastRead().toString());
 
-QString DkMetaDataT::getXmpValue(const QString& key) const {
+    if (!fileInfo.owner().isEmpty()) {
+        fileKeys.append(QObject::tr("Owner"));
+        fileValues.append(fileInfo.owner());
+    }
 
-	QString info;
+    fileKeys.append(QObject::tr("OwnerID"));
+    fileValues.append(QString::number(fileInfo.ownerId()));
 
-	if (mExifState != loaded && mExifState != dirty)
-		return info;
+    if (!fileInfo.group().isEmpty()) {
+        fileKeys.append(QObject::tr("Group"));
+        fileValues.append(fileInfo.group());
+    }
 
-	Exiv2::XmpData &xmpData = mExifImg->xmpData();
+    QString permissionString;
+    fileKeys.append(QObject::tr("Permissions") + "." + QObject::tr("Owner"));
+    permissionString += fileInfo.permissions() & QFile::ReadOwner ? "r" : "-";
+    permissionString += fileInfo.permissions() & QFile::WriteOwner ? "w" : "-";
+    permissionString += fileInfo.permissions() & QFile::ExeOwner ? "x" : "-";
+    fileValues.append(permissionString);
 
-	if (!xmpData.empty()) {
+    permissionString = "";
+    fileKeys.append(QObject::tr("Permissions") + "." + QObject::tr("User"));
+    permissionString += fileInfo.permissions() & QFile::ReadUser ? "r" : "-";
+    permissionString += fileInfo.permissions() & QFile::WriteUser ? "w" : "-";
+    permissionString += fileInfo.permissions() & QFile::ExeUser ? "x" : "-";
+    fileValues.append(permissionString);
 
-		Exiv2::XmpData::iterator pos;
+    permissionString = "";
+    fileKeys.append(QObject::tr("Permissions") + "." + QObject::tr("Group"));
+    permissionString += fileInfo.permissions() & QFile::ReadGroup ? "r" : "-";
+    permissionString += fileInfo.permissions() & QFile::WriteGroup ? "w" : "-";
+    permissionString += fileInfo.permissions() & QFile::ExeGroup ? "x" : "-";
+    fileValues.append(permissionString);
 
-		try {
-			Exiv2::XmpKey ekey = Exiv2::XmpKey(key.toStdString());
-			pos = xmpData.findKey(ekey);
+    permissionString = "";
+    fileKeys.append(QObject::tr("Permissions") + "." + QObject::tr("Other"));
+    permissionString += fileInfo.permissions() & QFile::ReadOther ? "r" : "-";
+    permissionString += fileInfo.permissions() & QFile::WriteOther ? "w" : "-";
+    permissionString += fileInfo.permissions() & QFile::ExeOther ? "x" : "-";
+    fileValues.append(permissionString);
 
-		} catch(...) {
-			return info;
-		}
+    QStringList tmpKeys;
 
-		if (pos != xmpData.end() && pos->count() != 0) {
-			Exiv2::Value::AutoPtr v = pos->getValue();
-			info = exiv2ToQString(pos->toString());
-		}
-	}
+    // full file keys are needed to create the hierarchy
+    for (int idx = 0; idx < fileKeys.size(); idx++) {
+        tmpKeys.append(QObject::tr("File") + "." + fileKeys.at(idx));
+    }
 
-	return info;
+    fileKeys = tmpKeys;
 }
 
+void DkMetaDataT::getAllMetaData(QStringList &keys, QStringList &values) const
+{
+    QStringList exifKeys = getExifKeys();
 
-QString DkMetaDataT::getExifValue(const QString& key) const {
+    for (int idx = 0; idx < exifKeys.size(); idx++) {
+        QString cKey = exifKeys.at(idx);
+        QString exifValue = getNativeExifValue(cKey, true);
 
-	QString info;
+        keys.append(cKey);
+        values.append(exifValue);
+    }
 
-	if (mExifState != loaded && mExifState != dirty)
-		return info;
+    QStringList iptcKeys = getIptcKeys();
 
-	Exiv2::ExifData &exifData = mExifImg->exifData();
-	std::string sKey = key.toStdString();
+    for (int idx = 0; idx < iptcKeys.size(); idx++) {
+        QString cKey = iptcKeys.at(idx);
+        QString exifValue = getIptcValue(iptcKeys.at(idx));
 
-	if (!exifData.empty()) {
+        keys.append(cKey);
+        values.append(exifValue);
+    }
 
-		Exiv2::ExifData::iterator pos;
+    QStringList xmpKeys = getXmpKeys();
 
-		try {
-			Exiv2::ExifKey ekey = Exiv2::ExifKey("Exif.Image." + sKey);
-			pos = exifData.findKey(ekey);
+    for (int idx = 0; idx < xmpKeys.size(); idx++) {
+        QString cKey = xmpKeys.at(idx);
+        QString exifValue = getXmpValue(xmpKeys.at(idx));
 
-			if (pos == exifData.end() || pos->count() == 0) {
-				Exiv2::ExifKey lEkey = Exiv2::ExifKey("Exif.Photo." + sKey);	
-				pos = exifData.findKey(lEkey);
-			}
-		} catch(...) {
-			try {
-				sKey = "Exif.Photo." + sKey;
-				Exiv2::ExifKey ekey = Exiv2::ExifKey(sKey);	
-				pos = exifData.findKey(ekey);
-			} catch (... ) {
-				return "";
-			}
-		}
+        keys.append(cKey);
+        values.append(exifValue);
+    }
 
-		if (pos != exifData.end() && pos->count() != 0) {
-			//Exiv2::Value::AutoPtr v = pos->getValue();
-			info = exiv2ToQString(pos->toString());
-		}
-	}
+    QStringList qtKeys = getQtKeys();
 
-
-	return info;
+    for (QString cKey : qtKeys) {
+        keys.append(cKey);
+        values.append(getQtValue(cKey));
+    }
 }
 
-QString DkMetaDataT::getIptcValue(const QString& key) const {
-
-	QString info;
+QImage DkMetaDataT::getThumbnail() const
+{
+    QImage qThumb;
 
-	if (mExifState != loaded && mExifState != dirty)
-		return info;
+    if (mExifState != loaded && mExifState != dirty)
+        return qThumb;
 
-	Exiv2::IptcData &iptcData = mExifImg->iptcData();
+    Exiv2::ExifData &exifData = mExifImg->exifData();
 
-	if (!iptcData.empty()) {
+    if (exifData.empty())
+        return qThumb;
 
-		Exiv2::IptcData::iterator pos;
+    try {
+        Exiv2::ExifThumb thumb(exifData);
+        Exiv2::DataBuf buffer = thumb.copy();
 
-		try {
-			Exiv2::IptcKey ekey = Exiv2::IptcKey(key.toStdString());
-			pos = iptcData.findKey(ekey);
-		} catch (...) {
-			return info;
-		}
+        QByteArray ba = QByteArray((char *)buffer.pData_, buffer.size_);
+        qThumb.loadFromData(ba);
+    } catch (...) {
+        qDebug() << "Sorry, I could not load the thumb from the exif data...";
+    }
 
-		if (pos != iptcData.end() && pos->count() != 0) {
-			Exiv2::Value::AutoPtr v = pos->getValue();
-			info = exiv2ToQString(pos->toString());
-		}
-	}
-
-	return info;
+    return qThumb;
 }
 
-void DkMetaDataT::getFileMetaData(QStringList& fileKeys, QStringList& fileValues) const {
-
-	QFileInfo fileInfo(mFilePath);
-	fileKeys.append(QObject::tr("Filename"));
-	fileValues.append(fileInfo.fileName());
-
-	fileKeys.append(QObject::tr("Path"));
-	fileValues.append(fileInfo.absolutePath());
-
-	if (fileInfo.isSymLink()) {
-		fileKeys.append(QObject::tr("Target"));
-		fileValues.append(fileInfo.symLinkTarget());
-	}
-
-	fileKeys.append(QObject::tr("Size"));
-	fileValues.append(DkUtils::readableByte((float)fileInfo.size()));
-
-	// date group
-	fileKeys.append(QObject::tr("Date") + "." + QObject::tr("Created"));
-	fileValues.append(fileInfo.created().toString(Qt::SystemLocaleDate));
+QImage DkMetaDataT::getPreviewImage(int minPreviewWidth) const
+{
+    QImage qImg;
 
-	fileKeys.append(QObject::tr("Date") + "." + QObject::tr("Last Modified"));
-	fileValues.append(fileInfo.lastModified().toString(Qt::SystemLocaleDate));
+    if (mExifState != loaded && mExifState != dirty)
+        return qImg;
 
-	fileKeys.append(QObject::tr("Date") + "." + QObject::tr("Last Read"));
-	fileValues.append(fileInfo.lastRead().toString(Qt::SystemLocaleDate));
+    Exiv2::ExifData &exifData = mExifImg->exifData();
 
-	if (!fileInfo.owner().isEmpty()) {
-		fileKeys.append(QObject::tr("Owner"));
-		fileValues.append(fileInfo.owner());
-	}
+    if (exifData.empty())
+        return qImg;
 
-	fileKeys.append(QObject::tr("OwnerID"));
-	fileValues.append(QString::number(fileInfo.ownerId()));
+    try {
+        Exiv2::PreviewManager loader(*mExifImg);
+        Exiv2::PreviewPropertiesList pList = loader.getPreviewProperties();
 
-	if (!fileInfo.group().isEmpty()) {
-		fileKeys.append(QObject::tr("Group"));
-		fileValues.append(fileInfo.group());
-	}
+        int maxWidth = 0;
+        int mIdx = -1;
 
-	QString permissionString;
-	fileKeys.append(QObject::tr("Permissions") + "." + QObject::tr("Owner"));
-	permissionString += fileInfo.permissions() & QFile::ReadOwner	? "r" : "-";
-	permissionString += fileInfo.permissions() & QFile::WriteOwner	? "w" : "-";
-	permissionString += fileInfo.permissions() & QFile::ExeOwner	? "x" : "-";
-	fileValues.append(permissionString);
+        // select the largest preview image
+        for (size_t idx = 0; idx < pList.size(); idx++) {
+            if (pList[idx].width_ > (uint32_t)maxWidth && pList[idx].width_ > (uint32_t)minPreviewWidth) {
+                mIdx = (int)idx;
+                maxWidth = pList[idx].width_;
+            }
+        }
 
-	permissionString = "";
-	fileKeys.append(QObject::tr("Permissions") + "." + QObject::tr("User"));
-	permissionString += fileInfo.permissions() & QFile::ReadUser	? "r" : "-";
-	permissionString += fileInfo.permissions() & QFile::WriteUser	? "w" : "-";
-	permissionString += fileInfo.permissions() & QFile::ExeUser		? "x" : "-";
-	fileValues.append(permissionString);
+        if (mIdx == -1)
+            return qImg;
 
-	permissionString = "";
-	fileKeys.append(QObject::tr("Permissions") + "." + QObject::tr("Group"));
-	permissionString += fileInfo.permissions() & QFile::ReadGroup	? "r" : "-";
-	permissionString += fileInfo.permissions() & QFile::WriteGroup	? "w" : "-";
-	permissionString += fileInfo.permissions() & QFile::ExeGroup	? "x" : "-";
-	fileValues.append(permissionString);
+        // Get the selected preview image
+        Exiv2::PreviewImage preview = loader.getPreviewImage(pList[mIdx]);
 
-	permissionString = "";
-	fileKeys.append(QObject::tr("Permissions") + "." + QObject::tr("Other"));
-	permissionString += fileInfo.permissions() & QFile::ReadOther	? "r" : "-";
-	permissionString += fileInfo.permissions() & QFile::WriteOther	? "w" : "-";
-	permissionString += fileInfo.permissions() & QFile::ExeOther	? "x" : "-";
-	fileValues.append(permissionString);
+        QByteArray ba((const char *)preview.pData(), preview.size());
+        if (!qImg.loadFromData(ba))
+            return QImage();
+    } catch (...) {
+        qDebug() << "Sorry, I could not load the thumb from the exif data...";
+    }
 
-	QStringList tmpKeys;
-
-	// full file keys are needed to create the hierarchy
-	for (int idx = 0; idx < fileKeys.size(); idx++) {
-		tmpKeys.append(QObject::tr("File") + "." + fileKeys.at(idx));
-	}
-
-	fileKeys = tmpKeys;
+    return qImg;
 }
 
-void DkMetaDataT::getAllMetaData(QStringList& keys, QStringList& values) const {
-
-	QStringList exifKeys = getExifKeys();
-
-	for (int idx = 0; idx < exifKeys.size(); idx++) {
-
-		QString cKey = exifKeys.at(idx);
-		QString exifValue = getNativeExifValue(cKey);
-
-		keys.append(cKey);
-		values.append(exifValue);
-	}
-
-	QStringList iptcKeys = getIptcKeys();
-
-	for (int idx = 0; idx < iptcKeys.size(); idx++) {
-
-		QString cKey = iptcKeys.at(idx);
-		QString exifValue = getIptcValue(iptcKeys.at(idx));
-
-		keys.append(cKey);
-		values.append(exifValue);
-	}
-
-	QStringList xmpKeys = getXmpKeys();
-
-	for (int idx = 0; idx < xmpKeys.size(); idx++) {
-
-		QString cKey = xmpKeys.at(idx);
-		QString exifValue = getXmpValue(xmpKeys.at(idx));
-
-		keys.append(cKey);
-		values.append(exifValue);
-	}
-
-	QStringList qtKeys = getQtKeys();
-
-	for (QString cKey : qtKeys) {
-
-		keys.append(cKey);
-		values.append(getQtValue(cKey));
-	}
+void DkMetaDataT::setUseSidecar(bool useSidecar)
+{
+    mUseSidecar = useSidecar;
 }
 
-QImage DkMetaDataT::getThumbnail() const {
-
-	QImage qThumb;
-
-	if (mExifState != loaded && mExifState != dirty)
-		return qThumb;
-
-	Exiv2::ExifData &exifData = mExifImg->exifData();
-
-	if (exifData.empty())
-		return qThumb;
-
-	try {
-		Exiv2::ExifThumb thumb(exifData);
-		Exiv2::DataBuf buffer = thumb.copy();
-
-		QByteArray ba = QByteArray((char*)buffer.pData_, buffer.size_);
-		qThumb.loadFromData(ba);
-	}
-	catch (...) {
-		qDebug() << "Sorry, I could not load the thumb from the exif data...";
-	}
-
-	return qThumb;
+bool DkMetaDataT::useSidecar() const
+{
+    return mUseSidecar;
 }
 
-QImage DkMetaDataT::getPreviewImage(int minPreviewWidth) const {
-
-	QImage qImg;
-
-	if (mExifState != loaded && mExifState != dirty)
-		return qImg;
-
-	Exiv2::ExifData &exifData = mExifImg->exifData();
-
-	if (exifData.empty())
-		return qImg;
-
-	try {
-
-		Exiv2::PreviewManager loader(*mExifImg);
-		Exiv2::PreviewPropertiesList pList = loader.getPreviewProperties();
-
-		int maxWidth = 0;
-		int mIdx = -1;
-
-		// select the largest preview image
-		for (size_t idx = 0; idx < pList.size(); idx++) {
-			
-			if (pList[idx].width_ > (uint32_t)maxWidth && pList[idx].width_ > (uint32_t)minPreviewWidth) {
-				mIdx = (int)idx;
-				maxWidth = pList[idx].width_;
-			}
-		}
-
-		if (mIdx == -1)
-			return qImg;
-		
-		// Get the selected preview image
-		Exiv2::PreviewImage preview = loader.getPreviewImage(pList[mIdx]);
-
-		QByteArray ba((const char*)preview.pData(), preview.size());
-		if (!qImg.loadFromData(ba))
-			return QImage();
-	}
-	catch (...) {
-		qDebug() << "Sorry, I could not load the thumb from the exif data...";
-	}
-
-	return qImg;
+bool DkMetaDataT::hasMetaData() const
+{
+    return !(mExifState == no_data || mExifState == not_loaded);
 }
 
-void DkMetaDataT::setUseSidecar(bool useSidecar) {
-	
-	mUseSidecar = useSidecar;
+bool DkMetaDataT::isLoaded() const
+{
+    return mExifState == loaded || mExifState == dirty || mExifState == no_data;
 }
 
-bool DkMetaDataT::useSidecar() const {
-
-	return mUseSidecar;
+bool DkMetaDataT::isTiff() const
+{
+    QString newSuffix = QFileInfo(mFilePath).suffix();
+    return newSuffix.contains(QRegularExpression("(tif|tiff)", QRegularExpression::CaseInsensitiveOption)) != 0;
 }
 
-
-bool DkMetaDataT::hasMetaData() const {
-
-	return !(mExifState == no_data || mExifState == not_loaded);
+bool DkMetaDataT::isJpg() const
+{
+    QString newSuffix = QFileInfo(mFilePath).suffix();
+    return newSuffix.contains(QRegularExpression("(jpg|jpeg)", QRegularExpression::CaseInsensitiveOption)) != 0;
 }
 
-bool DkMetaDataT::isLoaded() const {
-
-	return mExifState == loaded || mExifState == dirty || mExifState == no_data;
+bool DkMetaDataT::isRaw() const
+{
+    QString newSuffix = QFileInfo(mFilePath).suffix();
+    return newSuffix.contains(QRegularExpression("(nef|crw|cr2|arw)", QRegularExpression::CaseInsensitiveOption)) != 0;
 }
 
-bool DkMetaDataT::isTiff() const {
-
-	QString newSuffix = QFileInfo(mFilePath).suffix();
-	return newSuffix.contains(QRegExp("(tif|tiff)", Qt::CaseInsensitive)) != 0;
+bool DkMetaDataT::isAVIF() const
+{
+    QString newSuffix = QFileInfo(mFilePath).suffix();
+    return newSuffix.contains(QRegularExpression("(avif)", QRegularExpression::CaseInsensitiveOption)) != 0;
 }
 
-bool DkMetaDataT::isJpg() const {
-
-	QString newSuffix = QFileInfo(mFilePath).suffix();
-	return newSuffix.contains(QRegExp("(jpg|jpeg)", Qt::CaseInsensitive)) != 0;
+bool DkMetaDataT::isHEIF() const
+{
+    QString newSuffix = QFileInfo(mFilePath).suffix();
+    return newSuffix.contains(QRegularExpression("(heic|heif)", QRegularExpression::CaseInsensitiveOption)) != 0;
 }
 
-bool DkMetaDataT::isRaw() const {
-
-	QString newSuffix = QFileInfo(mFilePath).suffix();
-	return newSuffix.contains(QRegExp("(nef|crw|cr2|arw)", Qt::CaseInsensitive)) != 0;
+bool DkMetaDataT::isJXL() const
+{
+    QString newSuffix = QFileInfo(mFilePath).suffix();
+    return newSuffix.contains(QRegularExpression("(jxl)", QRegularExpression::CaseInsensitiveOption)) != 0;
 }
 
-bool DkMetaDataT::isDirty() const {
-
-	return mExifState == dirty;
+bool DkMetaDataT::isDirty() const
+{
+    return mExifState == dirty;
 }
 
-QStringList DkMetaDataT::getExifKeys() const {
-
-	QStringList exifKeys;
-
-	if (mExifState != loaded && mExifState != dirty)
-		return exifKeys;
+QStringList DkMetaDataT::getExifKeys() const
+{
+    QStringList exifKeys;
 
-	Exiv2::ExifData &exifData = mExifImg->exifData();
+    if (mExifState != loaded && mExifState != dirty)
+        return exifKeys;
 
-	if (exifData.empty()) {
-		return exifKeys;
-	} else {
+    Exiv2::ExifData &exifData = mExifImg->exifData();
 
-		for (Exiv2::Exifdatum i : exifData) {
+    if (exifData.empty()) {
+        return exifKeys;
+    } else {
+        for (Exiv2::Exifdatum i : exifData) {
+            std::string tmp = i.key();
+            exifKeys << QString::fromStdString(tmp);
 
-			std::string tmp = i.key();
-			exifKeys << QString::fromStdString(tmp);
+            // qDebug() << QString::fromStdString(tmp);
+        }
+    }
 
-			//qDebug() << QString::fromStdString(tmp);
-		}
-	}
-
-	return exifKeys;
+    return exifKeys;
 }
 
-QStringList DkMetaDataT::getXmpKeys() const {
-
-	QStringList xmpKeys;
-
-	if (mExifState != loaded && mExifState != dirty)
-		return xmpKeys;
-
-	Exiv2::XmpData &xmpData = mExifImg->xmpData();
-	Exiv2::XmpData::const_iterator end = xmpData.end();
+QStringList DkMetaDataT::getXmpKeys() const
+{
+    QStringList xmpKeys;
 
-	if (xmpData.empty()) {
-		return xmpKeys;
+    if (mExifState != loaded && mExifState != dirty)
+        return xmpKeys;
 
-	} else {
+    Exiv2::XmpData &xmpData = mExifImg->xmpData();
+    Exiv2::XmpData::const_iterator end = xmpData.end();
 
-		for (Exiv2::XmpData::const_iterator i = xmpData.begin(); i != end; ++i) {
+    if (xmpData.empty()) {
+        return xmpKeys;
 
-			std::string tmp = i->key();
-			xmpKeys << QString::fromStdString(tmp);
-		}
-	}
+    } else {
+        for (Exiv2::XmpData::const_iterator i = xmpData.begin(); i != end; ++i) {
+            std::string tmp = i->key();
+            xmpKeys << QString::fromStdString(tmp);
+        }
+    }
 
-	return xmpKeys;
+    return xmpKeys;
 }
 
+QStringList DkMetaDataT::getIptcKeys() const
+{
+    QStringList iptcKeys;
 
-QStringList DkMetaDataT::getIptcKeys() const {
+    if (mExifState != loaded && mExifState != dirty)
+        return iptcKeys;
 
-	QStringList iptcKeys;
-	
-	if (mExifState != loaded && mExifState != dirty)
-		return iptcKeys;
+    Exiv2::IptcData &iptcData = mExifImg->iptcData();
+    Exiv2::IptcData::iterator endI = iptcData.end();
 
-	Exiv2::IptcData &iptcData = mExifImg->iptcData();
-	Exiv2::IptcData::iterator endI = iptcData.end();
+    if (iptcData.empty())
+        return iptcKeys;
 
-	if (iptcData.empty())
-		return iptcKeys;
+    for (Exiv2::IptcData::iterator md = iptcData.begin(); md != endI; ++md) {
+        std::string tmp = md->key();
+        iptcKeys << QString::fromStdString(tmp);
+    }
 
-	for (Exiv2::IptcData::iterator md = iptcData.begin(); md != endI; ++md) {
-
-		std::string tmp = md->key();
-		iptcKeys << QString::fromStdString(tmp);
-	}
-
-	return iptcKeys;
+    return iptcKeys;
 }
 
-QStringList DkMetaDataT::getExifValues() const {
-
-	QStringList exifValues;
+QStringList DkMetaDataT::getExifValues() const
+{
+    QStringList exifValues;
 
-	if (mExifState != loaded && mExifState != dirty)
-		return QStringList();
+    if (mExifState != loaded && mExifState != dirty)
+        return QStringList();
 
-	Exiv2::ExifData &exifData = mExifImg->exifData();
-	Exiv2::ExifData::const_iterator end = exifData.end();
+    Exiv2::ExifData &exifData = mExifImg->exifData();
+    Exiv2::ExifData::const_iterator end = exifData.end();
 
-	if (exifData.empty())
-		return exifValues;
+    if (exifData.empty())
+        return exifValues;
 
-	for (Exiv2::ExifData::const_iterator i = exifData.begin(); i != end; ++i) {
+    for (Exiv2::ExifData::const_iterator i = exifData.begin(); i != end; ++i) {
+        std::string tmp = i->value().toString();
+        QString info = exiv2ToQString(tmp);
+        exifValues << info;
+    }
 
-		std::string tmp = i->value().toString();
-		QString info = exiv2ToQString(tmp); 
-		exifValues << info; 
-	}
-
-	return exifValues;
-}
-
-QStringList DkMetaDataT::getIptcValues() const {
-	
-	QStringList iptcValues;
-
-	if (mExifState != loaded && mExifState != dirty)
-		return iptcValues;
-
-	Exiv2::IptcData &iptcData = mExifImg->iptcData();
-	Exiv2::IptcData::iterator endI = iptcData.end();
-
-	if (iptcData.empty())
-		return iptcValues;
-	for (Exiv2::IptcData::iterator md = iptcData.begin(); md != endI; ++md) {
-
-		std::string tmp = md->value().toString();
-		iptcValues << exiv2ToQString(tmp);
-	}
-
-	return iptcValues;
-}
-
-void DkMetaDataT::setQtValues(const QImage& cImg) {
-
-	QStringList qtKeysInit = cImg.textKeys();
-
-	for (QString cKey : qtKeysInit) {
-
-		if (!cKey.isEmpty() && cKey != "Raw profile type exif") {
-			QString val = cImg.text(cKey).size() < 5000 ? cImg.text(cKey) : QObject::tr("<data too large to display>");
-
-			if (!val.isEmpty()) {
-				mQtValues.append(val);
-				mQtKeys.append(cKey);
-			}
-		}
-	}
-}
-
-QString DkMetaDataT::getQtValue(const QString& key) const {
-
-	int idx = mQtKeys.indexOf(key);
-
-	if (idx >= 0 && idx < mQtValues.size())
-		return mQtValues.at(idx);
-
-	return QString();
-}
-
-
-QStringList DkMetaDataT::getQtKeys() const {
-
-	return mQtKeys;
+    return exifValues;
 }
 
-QStringList DkMetaDataT::getQtValues() const {
-	
-	return mQtValues;
-}
-
-
-void DkMetaDataT::setThumbnail(QImage thumb) {
-
-	if (mExifState == not_loaded || mExifState == no_data) 
-		return;
-
-	try {
-		Exiv2::ExifData exifData = mExifImg->exifData();
-
-		if (exifData.empty())
-			exifData = Exiv2::ExifData();
-
-		// ok, let's try to save the thumbnail...
-		Exiv2::ExifThumb eThumb(exifData);
+QStringList DkMetaDataT::getIptcValues() const
+{
+    QStringList iptcValues;
 
-		QByteArray ba;
-		QBuffer buffer(&ba);
-		buffer.open(QIODevice::WriteOnly);
-		thumb.save(&buffer, "JPEG");	// here we destroy the alpha channel of thumbnails
+    if (mExifState != loaded && mExifState != dirty)
+        return iptcValues;
 
-		try {
-			// whipe all exif data of the thumbnail
-			Exiv2::MemIo::AutoPtr exifBufferThumb(new Exiv2::MemIo((const byte*)ba.constData(), ba.size()));
-			Exiv2::Image::AutoPtr exifImgThumb = Exiv2::ImageFactory::open(exifBufferThumb);
+    Exiv2::IptcData &iptcData = mExifImg->iptcData();
+    Exiv2::IptcData::iterator endI = iptcData.end();
 
-			if (exifImgThumb.get() != 0 && exifImgThumb->good())
-				exifImgThumb->clearExifData();
-		}
-		catch (...) {
-			qDebug() << "could not clear the thumbnail exif info";
-		}
+    if (iptcData.empty())
+        return iptcValues;
+    for (Exiv2::IptcData::iterator md = iptcData.begin(); md != endI; ++md) {
+        std::string tmp = md->value().toString();
+        iptcValues << exiv2ToQString(tmp);
+    }
 
-		eThumb.erase();	// erase all thumbnails
-		eThumb.setJpegThumbnail((Exiv2::byte *)ba.data(), ba.size());
-
-		mExifImg->setExifData(exifData);
-		mExifState = dirty;
-
-	} catch (...) {
-		qDebug() << "I could not save the thumbnail...";
-	}
+    return iptcValues;
 }
 
-QVector2D DkMetaDataT::getResolution() const {
-
-
-	QVector2D resV = QVector2D(72,72);
-	QString xRes, yRes;
-
-	try {
-
-		if (hasMetaData()) {
-			xRes = getExifValue("XResolution");
-			QStringList res;
-			res = xRes.split("/");
-
-			if (res.size() != 2) 
-				return resV;
-
-			if (res.at(0).toFloat() != 0 && res.at(1).toFloat() != 0)
-				resV.setX(res.at(0).toFloat()/res.at(1).toFloat());
+void DkMetaDataT::setQtValues(const QImage &cImg)
+{
+    QStringList qtKeysInit = cImg.textKeys();
 
-			yRes = getExifValue("YResolution");
-			res = yRes.split("/");
+    for (QString cKey : qtKeysInit) {
+        if (!cKey.isEmpty() && cKey != "Raw profile type exif") {
+            QString val = cImg.text(cKey).size() < 5000 ? cImg.text(cKey) : QObject::tr("<data too large to display>");
 
-			//qDebug() << "Resolution"  << xRes << " " << yRes;
-			if (res.size() != 2)
-				return resV;
-
-			if (res.at(0).toFloat() != 0 && res.at(1).toFloat() != 0)
-				resV.setY(res.at(0).toFloat()/res.at(1).toFloat());
-		}
-	} catch (...) {
-		qDebug() << "could not load Exif resolution, set to 72dpi";
-	}
-
-	return resV;
+            if (!val.isEmpty()) {
+                mQtValues.append(val);
+                mQtKeys.append(cKey);
+            }
+        }
+    }
 }
 
-void DkMetaDataT::setResolution(const QVector2D& res) {
+QString DkMetaDataT::getQtValue(const QString &key) const
+{
+    int idx = mQtKeys.indexOf(key);
 
-	if (getResolution() == res)
-		return;
+    if (idx >= 0 && idx < mQtValues.size())
+        return mQtValues.at(idx);
 
-	QString x,y;
-	x.setNum(res.x());
-	y.setNum(res.y());
-	x=x+"/1";
-	y=y+"/1";
-
-	setExifValue("Exif.Image.XResolution",x);
-	setExifValue("Exif.Image.YResolution",y);
+    return QString();
 }
 
-void DkMetaDataT::clearOrientation() {
-
-	if (mExifState == not_loaded || mExifState == no_data)
-		return;
-
-	setExifValue("Exif.Image.Orientation", "1");	// we wrote "0" here - that was against the standard!
+QStringList DkMetaDataT::getQtKeys() const
+{
+    return mQtKeys;
 }
 
-void DkMetaDataT::clearExifState() {
-	
-	if (mExifState == dirty)
-		mExifState = loaded;
+QStringList DkMetaDataT::getQtValues() const
+{
+    return mQtValues;
 }
 
-void DkMetaDataT::setOrientation(int o) {
-
-	if (mExifState == not_loaded || mExifState == no_data)
-		return;
-
-	if (o!=90 && o!=-90 && o!=180 && o!=0 && o!=270)
-		return;
+void DkMetaDataT::setThumbnail(QImage thumb)
+{
+    if (mExifState == not_loaded || mExifState == no_data)
+        return;
 
-	if (o==-180) o=180;
-	if (o== 270) o=-90;
+    try {
+        Exiv2::ExifData exifData = mExifImg->exifData();
 
-	int orientation = 1;
+        if (exifData.empty())
+            exifData = Exiv2::ExifData();
 
-	Exiv2::ExifData& exifData = mExifImg->exifData();
-	Exiv2::ExifKey key = Exiv2::ExifKey("Exif.Image.Orientation");
+        // ok, let's try to save the thumbnail...
+        Exiv2::ExifThumb eThumb(exifData);
 
-	// this does not really work -> *.bmp images
-	if (exifData.empty())
-		exifData["Exif.Image.Orientation"] = uint16_t(1);
+        QByteArray ba;
+        QBuffer buffer(&ba);
+        buffer.open(QIODevice::WriteOnly);
+        thumb.save(&buffer, "JPEG"); // here we destroy the alpha channel of thumbnails
 
-	Exiv2::ExifData::iterator pos = exifData.findKey(key);
+        try {
+            // whipe all exif data of the thumbnail
+            Exiv2::MemIo::AutoPtr exifBufferThumb(new Exiv2::MemIo((const byte *)ba.constData(), ba.size()));
+            Exiv2::Image::AutoPtr exifImgThumb = Exiv2::ImageFactory::open(exifBufferThumb);
 
-	if (pos == exifData.end() || pos->count() == 0) {
-		exifData["Exif.Image.Orientation"] = uint16_t(1);
+            if (exifImgThumb.get() != 0 && exifImgThumb->good())
+                exifImgThumb->clearExifData();
+        } catch (...) {
+            qDebug() << "could not clear the thumbnail exif info";
+        }
 
-		pos = exifData.findKey(key);
-	}
+        eThumb.erase(); // erase all thumbnails
+        eThumb.setJpegThumbnail((Exiv2::byte *)ba.data(), ba.size());
 
-	Exiv2::Value::AutoPtr v = pos->getValue();
-	Exiv2::UShortValue* prv = dynamic_cast<Exiv2::UShortValue*>(v.release());
-	if (!prv) return;
+        mExifImg->setExifData(exifData);
+        mExifState = dirty;
 
-	Exiv2::UShortValue::AutoPtr rv = Exiv2::UShortValue::AutoPtr(prv);
-	if (rv->value_.empty())	return;
-
-	orientation = (int) rv->value_[0];
-	if (orientation <= 0 || orientation > 8) orientation = 1;
-
-	switch (orientation) {
-	case 1: if (o!=0) orientation = (o == -90) ? 8 : (o==90 ? 6 : 3);
-		break;
-	case 2: if (o!=0) orientation = (o == -90) ? 5 : (o==90 ? 7 : 4);
-		break;
-	case 3: if (o!=0) orientation = (o == -90) ? 6 : (o==90 ? 8 : 1);
-		break;
-	case 4: if (o!=0) orientation = (o == -90) ? 7 : (o==90 ? 5 : 2);
-		break;
-	case 5: if (o!=0) orientation = (o == -90) ? 4 : (o==90 ? 2 : 7);
-		break;
-	case 6: if (o!=0) orientation = (o == -90) ? 1 : (o==90 ? 3 : 8);
-		break;
-	case 7: if (o!=0) orientation = (o == -90) ? 2 : (o==90 ? 4 : 5);
-		break;
-	case 8: if (o!=0) orientation = (o == -90) ? 3 : (o==90 ? 1 : 6);
-		break;
-	}
-	rv->value_[0] = (unsigned short) orientation;
-	pos->setValue(rv.get());
-
-	mExifImg->setExifData(exifData);
-
-	mExifState = dirty;
-}
-
-bool DkMetaDataT::setDescription(const QString& description) {
-
-	if (mExifState == not_loaded || mExifState == no_data)
-		return false;
-
-	return setExifValue("Exif.Image.ImageDescription", description.toUtf8());
+    } catch (...) {
+        qDebug() << "I could not save the thumbnail...";
+    }
 }
 
-void DkMetaDataT::setRating(int r) {
+QVector2D DkMetaDataT::getResolution() const
+{
+    QVector2D resV = QVector2D(72, 72);
+    QString xRes, yRes;
 
-	if (mExifState == not_loaded || mExifState == no_data || getRating() == r)
-		return;
+    try {
+        if (hasMetaData()) {
+            xRes = getExifValue("XResolution");
+            QStringList res;
+            res = xRes.split("/");
 
-	std::string sRating, sRatingPercent;
+            if (res.size() != 2)
+                return resV;
 
-	if (r == 5)  {		sRating = "5"; sRatingPercent = "99";}
-	else if (r==4) {	sRating = "4"; sRatingPercent = "75";}
-	else if (r==3) {	sRating = "3"; sRatingPercent = "50";}
-	else if (r==2) {	sRating = "2"; sRatingPercent = "25";}
-	else if (r==1) {	sRating = "1"; sRatingPercent = "1";}
-	else {r=0;}
+            if (res.at(0).toFloat() != 0 && res.at(1).toFloat() != 0)
+                resV.setX(res.at(0).toFloat() / res.at(1).toFloat());
 
-	Exiv2::ExifData &exifData = mExifImg->exifData();		//Exif.Image.Rating  - short
-	Exiv2::XmpData &xmpData = mExifImg->xmpData();			//Xmp.xmp.Rating - text
+            yRes = getExifValue("YResolution");
+            res = yRes.split("/");
 
-	if (r > 0) {
-		exifData["Exif.Image.Rating"] = uint16_t(r);
-		exifData["Exif.Image.RatingPercent"] = uint16_t(r);
+            // qDebug() << "Resolution"  << xRes << " " << yRes;
+            if (res.size() != 2)
+                return resV;
 
-		Exiv2::Value::AutoPtr v = Exiv2::Value::create(Exiv2::xmpText);
-		v->read(sRating);
-		xmpData.add(Exiv2::XmpKey("Xmp.xmp.Rating"), v.get());
-		v->read(sRatingPercent);
-		xmpData.add(Exiv2::XmpKey("Xmp.MicrosoftPhoto.Rating"), v.get());
-	} 
-	else {
+            if (res.at(0).toFloat() != 0 && res.at(1).toFloat() != 0)
+                resV.setY(res.at(0).toFloat() / res.at(1).toFloat());
+        }
+    } catch (...) {
+        qDebug() << "could not load Exif resolution, set to 72dpi";
+    }
 
-		Exiv2::ExifKey key = Exiv2::ExifKey("Exif.Image.Rating");
-		Exiv2::ExifData::iterator pos = exifData.findKey(key);
-		if (pos != exifData.end()) exifData.erase(pos);
-
-		key = Exiv2::ExifKey("Exif.Image.RatingPercent");
-		pos = exifData.findKey(key);
-		if (pos != exifData.end()) exifData.erase(pos);
-
-		Exiv2::XmpKey key2 = Exiv2::XmpKey("Xmp.xmp.Rating");
-		Exiv2::XmpData::iterator pos2 = xmpData.findKey(key2);
-		if (pos2 != xmpData.end()) xmpData.erase(pos2);
-
-		key2 = Exiv2::XmpKey("Xmp.MicrosoftPhoto.Rating");
-		pos2 = xmpData.findKey(key2);
-		if (pos2 != xmpData.end()) xmpData.erase(pos2);
-	}
-
-	try {
-		mExifImg->setExifData(exifData);
-		mExifImg->setXmpData(xmpData);
-
-		mExifState = dirty;
-	}
-	catch (...) {
-		qDebug() << "[WARNING] I could not set the exif data for this image format...";
-	}
+    return resV;
 }
 
-bool DkMetaDataT::updateImageMetaData(const QImage& img) {
-
-	bool success = true;
-
-	success &= setExifValue("Exif.Image.ImageWidth", QString::number(img.width()));
-	success &= setExifValue("Exif.Image.ImageLength", QString::number(img.height()));
-	success &= setExifValue("Exif.Image.ProcessingSoftware", qApp->organizationName() + " - " + qApp->applicationName() + " " + qApp->applicationVersion());
-
-	// TODO: convert Date Time to Date Time Original and set new Date Time
-		
-	clearOrientation();
-	
-	// NOTE: exiv crashes for some images (i.e. \exif-crash\0125-results.png)
-	// if the thumbnail's max size is > 200px
-	setThumbnail(DkImage::createThumb(img, 200));
-
-	return success;
+void DkMetaDataT::setResolution(const QVector2D &res)
+{
+    if (getResolution() == res)
+        return;
+
+    QString x, y;
+    x.setNum(res.x());
+    y.setNum(res.y());
+    x = x + "/1";
+    y = y + "/1";
+
+    setExifValue("Exif.Image.XResolution", x);
+    setExifValue("Exif.Image.YResolution", y);
 }
 
-bool DkMetaDataT::setExifValue(QString key, QString taginfo) {
-
-	bool setExifSuccessfull = false;
-
-	if (mExifState == not_loaded || mExifState == no_data)
-		return false;
-
-	try {
-
-		if (mExifImg->checkMode(Exiv2::mdExif) != Exiv2::amReadWrite &&
-			mExifImg->checkMode(Exiv2::mdExif) != Exiv2::amWrite)
-			return false;
-
-		Exiv2::ExifData &exifData = mExifImg->exifData();
-
+void DkMetaDataT::clearOrientation()
+{
+    if (mExifState == not_loaded || mExifState == no_data)
+        return;
+
+    setExifValue("Exif.Image.Orientation", "1"); // we wrote "0" here - that was against the standard!
+}
+
+void DkMetaDataT::clearExifState()
+{
+    if (mExifState == dirty)
+        mExifState = loaded;
+}
+
+void DkMetaDataT::setOrientation(int o)
+{
+    if (mExifState == not_loaded || mExifState == no_data)
+        return;
+
+    if (o != 90 && o != -90 && o != 180 && o != 0 && o != 270)
+        return;
+
+    if (o == -180)
+        o = 180;
+    if (o == 270)
+        o = -90;
+
+    int orientation = 1;
+
+    Exiv2::ExifData &exifData = mExifImg->exifData();
+    Exiv2::ExifKey key = Exiv2::ExifKey("Exif.Image.Orientation");
+
+    // this does not really work -> *.bmp images
+    if (exifData.empty())
+        exifData["Exif.Image.Orientation"] = uint16_t(1);
+
+    Exiv2::ExifData::iterator pos = exifData.findKey(key);
+
+    if (pos == exifData.end() || pos->count() == 0) {
+        exifData["Exif.Image.Orientation"] = uint16_t(1);
+        pos = exifData.findKey(key);
+    }
+
+    Exiv2::Value::AutoPtr v = pos->getValue();
+    Exiv2::UShortValue *prv = dynamic_cast<Exiv2::UShortValue *>(v.release());
+    if (!prv)
+        return;
+
+    Exiv2::UShortValue::AutoPtr rv = Exiv2::UShortValue::AutoPtr(prv);
+    if (rv->value_.empty())
+        return;
+
+    orientation = (int)rv->value_[0];
+    if (orientation <= 0 || orientation > 8)
+        orientation = 1;
+
+    switch (orientation) {
+    case 1:
+        if (o != 0)
+            orientation = (o == -90) ? 8 : (o == 90 ? 6 : 3);
+        break;
+    case 2:
+        if (o != 0)
+            orientation = (o == -90) ? 5 : (o == 90 ? 7 : 4);
+        break;
+    case 3:
+        if (o != 0)
+            orientation = (o == -90) ? 6 : (o == 90 ? 8 : 1);
+        break;
+    case 4:
+        if (o != 0)
+            orientation = (o == -90) ? 7 : (o == 90 ? 5 : 2);
+        break;
+    case 5:
+        if (o != 0)
+            orientation = (o == -90) ? 4 : (o == 90 ? 2 : 7);
+        break;
+    case 6:
+        if (o != 0)
+            orientation = (o == -90) ? 1 : (o == 90 ? 3 : 8);
+        break;
+    case 7:
+        if (o != 0)
+            orientation = (o == -90) ? 2 : (o == 90 ? 4 : 5);
+        break;
+    case 8:
+        if (o != 0)
+            orientation = (o == -90) ? 3 : (o == 90 ? 1 : 6);
+        break;
+    }
+    rv->value_[0] = (unsigned short)orientation;
+    pos->setValue(rv.get());
+
+    mExifImg->setExifData(exifData);
+
+    mExifState = dirty;
+}
+
+bool DkMetaDataT::setDescription(const QString &description)
+{
+    if (mExifState == not_loaded || mExifState == no_data)
+        return false;
+
+    return setExifValue("Exif.Image.ImageDescription", description.toUtf8());
+}
+
+void DkMetaDataT::setRating(int r)
+{
+    if (mExifState == not_loaded || mExifState == no_data || getRating() == r)
+        return;
+
+    std::string sRating, sRatingPercent;
+
+    if (r == 5) {
+        sRating = "5";
+        sRatingPercent = "99";
+    } else if (r == 4) {
+        sRating = "4";
+        sRatingPercent = "75";
+    } else if (r == 3) {
+        sRating = "3";
+        sRatingPercent = "50";
+    } else if (r == 2) {
+        sRating = "2";
+        sRatingPercent = "25";
+    } else if (r == 1) {
+        sRating = "1";
+        sRatingPercent = "1";
+    } else {
+        r = 0;
+    }
+
+    Exiv2::ExifData &exifData = mExifImg->exifData(); // Exif.Image.Rating  - short
+    Exiv2::XmpData &xmpData = mExifImg->xmpData(); // Xmp.xmp.Rating - text
+
+    if (r > 0) {
+        exifData["Exif.Image.Rating"] = uint16_t(r);
+        exifData["Exif.Image.RatingPercent"] = uint16_t(r);
+
+        Exiv2::Value::AutoPtr v = Exiv2::Value::create(Exiv2::xmpText);
+        v->read(sRating);
+        xmpData.add(Exiv2::XmpKey("Xmp.xmp.Rating"), v.get());
+        v->read(sRatingPercent);
+        xmpData.add(Exiv2::XmpKey("Xmp.MicrosoftPhoto.Rating"), v.get());
+    } else {
+        Exiv2::ExifKey key = Exiv2::ExifKey("Exif.Image.Rating");
+        Exiv2::ExifData::iterator pos = exifData.findKey(key);
+        if (pos != exifData.end())
+            exifData.erase(pos);
+
+        key = Exiv2::ExifKey("Exif.Image.RatingPercent");
+        pos = exifData.findKey(key);
+        if (pos != exifData.end())
+            exifData.erase(pos);
+
+        Exiv2::XmpKey key2 = Exiv2::XmpKey("Xmp.xmp.Rating");
+        Exiv2::XmpData::iterator pos2 = xmpData.findKey(key2);
+        if (pos2 != xmpData.end())
+            xmpData.erase(pos2);
+
+        key2 = Exiv2::XmpKey("Xmp.MicrosoftPhoto.Rating");
+        pos2 = xmpData.findKey(key2);
+        if (pos2 != xmpData.end())
+            xmpData.erase(pos2);
+    }
+
+    try {
+        mExifImg->setExifData(exifData);
+        mExifImg->setXmpData(xmpData);
+
+        mExifState = dirty;
+    } catch (...) {
+        qDebug() << "[WARNING] I could not set the exif data for this image format...";
+    }
+}
+
+bool DkMetaDataT::updateImageMetaData(const QImage &img, bool reset_orientation)
+{
+    bool success = true;
+
+    success &= setExifValue("Exif.Image.ImageWidth", QString::number(img.width()));
+    success &= setExifValue("Exif.Image.ImageLength", QString::number(img.height()));
+    success &= setExifValue("Exif.Image.ProcessingSoftware", qApp->organizationName() + " - " + qApp->applicationName() + " " + qApp->applicationVersion());
+
+    // TODO: convert Date Time to Date Time Original and set new Date Time
+
+    if (reset_orientation)
+        clearOrientation();
+
+    // NOTE: exiv crashes for some images (i.e. \exif-crash\0125-results.png)
+    // if the thumbnail's max size is > 200px
+    setThumbnail(DkImage::createThumb(img, 200));
+
+    return success;
+}
+
+bool DkMetaDataT::setExifValue(QString key, QString taginfo)
+{
+    bool setExifSuccessfull = false;
+
+    if (mExifState == not_loaded || mExifState == no_data)
+        return false;
+
+    try {
+        if (mExifImg->checkMode(Exiv2::mdExif) != Exiv2::amReadWrite && mExifImg->checkMode(Exiv2::mdExif) != Exiv2::amWrite)
+            return false;
+
+        Exiv2::ExifData &exifData = mExifImg->exifData();
+
+        if (!exifData.empty() && getExifKeys().contains(key)) {
+            Exiv2::Exifdatum &tag = exifData[key.toStdString()];
+
+            // TODO: save utf8 strings
+            // QByteArray ba = taginfo.toUtf8();
+            // Exiv2::DataValue val((const byte*)ba.data(), taginfo.size(), Exiv2::ByteOrder::bigEndian, Exiv2::TypeId::unsignedByte);
+
+            // tag.setValue(&val);
+            if (!tag.setValue(taginfo.toStdString())) {
+                mExifState = dirty;
+                setExifSuccessfull = true;
+            }
+        } else {
+            Exiv2::ExifKey exivKey(key.toStdString());
+            Exiv2::Exifdatum tag(exivKey);
+            if (!tag.setValue(taginfo.toStdString())) {
+                mExifState = dirty;
+                setExifSuccessfull = true;
+            }
 
-		if (!exifData.empty() && getExifKeys().contains(key)) {
+            exifData.add(tag);
+        }
+    } catch (...) {
+        setExifSuccessfull = false;
+    }
 
-			Exiv2::Exifdatum& tag = exifData[key.toStdString()];
-
-			// TODO: save utf8 strings
-			//QByteArray ba = taginfo.toUtf8();
-			//Exiv2::DataValue val((const byte*)ba.data(), taginfo.size(), Exiv2::ByteOrder::bigEndian, Exiv2::TypeId::unsignedByte);
-
-			//tag.setValue(&val);
-			if (!tag.setValue(taginfo.toStdString())) {
-				mExifState = dirty;
-				setExifSuccessfull = true;
-			}
-		}
-		else {
-
-			Exiv2::ExifKey exivKey(key.toStdString());
-			Exiv2::Exifdatum tag(exivKey);
-			if (!tag.setValue(taginfo.toStdString())) {
-				mExifState = dirty;
-				setExifSuccessfull = true;
-			}
-
-			exifData.add(tag);
-		}
-	}
-	catch (...) {
-		setExifSuccessfull = false;
-	}
-
-	return setExifSuccessfull;
+    return setExifSuccessfull;
 }
 
-QString DkMetaDataT::exiv2ToQString(std::string exifString) {
+QString DkMetaDataT::exiv2ToQString(std::string exifString)
+{
+    const char *prefix_ascii1 = "charset=\"ASCII\" ";
+    const char *prefix_ascii2 = "charset=Ascii ";
+    const char *prefix_Unicode = "charset=Unicode ";
+    QString info;
 
-	QString info;
+    const size_t input_size = exifString.size();
 
-	if (QString::fromStdString(exifString).contains("charset=\"ASCII\"", Qt::CaseInsensitive)) {
-		info = QString::fromLocal8Bit((char*)(exifString.c_str()), (int)exifString.size());
-		info = info.replace("charset=\"ASCII\" ", "", Qt::CaseInsensitive);
-	}
-	else {
-		info = QString::fromUtf8((char*)(exifString.c_str()), (int)exifString.size());
-	}
+    if (QString::fromStdString(exifString).startsWith(prefix_ascii1, Qt::CaseInsensitive)) {
+        const size_t prefix1_size = strlen(prefix_ascii1);
+        if (input_size > prefix1_size) {
+            info = QString::fromLocal8Bit(exifString.c_str() + prefix1_size, int(input_size - prefix1_size));
+        }
+    } else if (QString::fromStdString(exifString).startsWith(prefix_ascii2, Qt::CaseInsensitive)) {
+        const size_t prefix2_size = strlen(prefix_ascii2);
+        if (input_size > prefix2_size) {
+            info = QString::fromLocal8Bit(exifString.c_str() + prefix2_size, int(input_size - prefix2_size));
+        }
+    } else if (QString::fromStdString(exifString).startsWith(prefix_Unicode, Qt::CaseInsensitive)) {
+        const size_t prefixunicode_size = strlen(prefix_Unicode);
+        if (input_size > prefixunicode_size) {
+            info = QString::fromUtf8(exifString.c_str() + prefixunicode_size, int(input_size - prefixunicode_size));
+        }
+    } else if (input_size > 0) {
+        info = QString::fromUtf8(exifString.c_str(), (int)input_size);
+    }
 
-	return info;
+    return info;
 }
 
-void DkMetaDataT::printMetaData() const {
-
-	if (mExifState != loaded && mExifState != dirty)
-		return;
-
-	Exiv2::XmpData &xmpData = mExifImg->xmpData();
+void DkMetaDataT::printMetaData() const
+{
+    if (mExifState != loaded && mExifState != dirty)
+        return;
 
-	qDebug() << "Exif------------------------------------------------------------------";
+    Exiv2::XmpData &xmpData = mExifImg->xmpData();
 
-	QStringList exifKeys = getExifKeys();
+    qDebug() << "Exif------------------------------------------------------------------";
 
-	for (int idx = 0; idx < exifKeys.size(); idx++)
-		qDebug() << exifKeys.at(idx) << " is " << getNativeExifValue(exifKeys.at(idx));
+    QStringList exifKeys = getExifKeys();
 
-	qDebug() << "IPTC------------------------------------------------------------------";
+    for (int idx = 0; idx < exifKeys.size(); idx++)
+        qDebug() << exifKeys.at(idx) << " is " << getNativeExifValue(exifKeys.at(idx), true);
 
-	QStringList iptcKeys = getIptcKeys();
+    qDebug() << "IPTC------------------------------------------------------------------";
 
-	for (int idx = 0; idx < iptcKeys.size(); idx++)
-		qDebug() << iptcKeys.at(idx) << " is " << getIptcValue(iptcKeys.at(idx));
+    QStringList iptcKeys = getIptcKeys();
 
-	qDebug() << "XMP------------------------------------------------------------------";
+    for (int idx = 0; idx < iptcKeys.size(); idx++)
+        qDebug() << iptcKeys.at(idx) << " is " << getIptcValue(iptcKeys.at(idx));
 
-	Exiv2::XmpData::iterator endI3 = xmpData.end();
-	for (Exiv2::XmpData::iterator md = xmpData.begin(); md != endI3; ++md) {
-		std::cout << std::setw(44) << std::setfill(' ') << std::left
-			<< md->key() << " "
-			<< "0x" << std::setw(4) << std::setfill('0') << std::right
-			<< std::hex << md->tag() << " "
-			<< std::setw(9) << std::setfill(' ') << std::left
-			<< md->typeName() << " "
-			<< std::dec << std::setw(3)
-			<< std::setfill(' ') << std::right
-			<< md->count() << "  "
-			<< std::dec << md->value()
-			<< std::endl;
-	}
+    qDebug() << "XMP------------------------------------------------------------------";
 
+    Exiv2::XmpData::iterator endI3 = xmpData.end();
+    for (Exiv2::XmpData::iterator md = xmpData.begin(); md != endI3; ++md) {
+        std::cout << std::setw(44) << std::setfill(' ') << std::left << md->key() << " "
+                  << "0x" << std::setw(4) << std::setfill('0') << std::right << std::hex << md->tag() << " " << std::setw(9) << std::setfill(' ') << std::left
+                  << md->typeName() << " " << std::dec << std::setw(3) << std::setfill(' ') << std::right << md->count() << "  " << std::dec << md->value()
+                  << std::endl;
+    }
 
-	std::string xmpPacket;
-	if (0 != Exiv2::XmpParser::encode(xmpPacket, xmpData)) {
-		qCritical() << "Failed to serialize XMP data";
-	}
-	std::cout << xmpPacket << "\n";
+    std::string xmpPacket;
+    if (0 != Exiv2::XmpParser::encode(xmpPacket, xmpData)) {
+        qCritical() << "Failed to serialize XMP data";
+    }
+    std::cout << xmpPacket << "\n";
 }
 
-bool DkMetaDataT::saveRectToXMP(const DkRotatingRect& rect, const QSize& size) {
+bool DkMetaDataT::saveRectToXMP(const DkRotatingRect &rect, const QSize &size)
+{
+    if (mExifState != loaded && mExifState != dirty)
+        return false;
 
-	if (mExifState != loaded && mExifState != dirty)
-		return false;
+    Exiv2::XmpData xmpData = mExifImg->xmpData();
 
-	Exiv2::XmpData xmpData = mExifImg->xmpData();
+    QRectF r = rect.toExifRect(size);
 
-	QRectF r = rect.toExifRect(size);
+    double angle = rect.getAngle();
+    angle = DkMath::normAngleRad(angle, -CV_PI * 0.25, CV_PI * 0.25) * DK_RAD2DEG;
 
-	double angle = rect.getAngle();
-	angle = DkMath::normAngleRad(angle, -CV_PI*0.25, CV_PI*0.25) * DK_RAD2DEG;
+    // Set the cropping coordinates here in percentage:
+    setXMPValue(xmpData, "Xmp.crs.CropTop", QString::number(r.top()));
+    setXMPValue(xmpData, "Xmp.crs.CropLeft", QString::number(r.left()));
+    setXMPValue(xmpData, "Xmp.crs.CropBottom", QString::number(r.bottom()));
+    setXMPValue(xmpData, "Xmp.crs.CropRight", QString::number(r.right()));
 
-	// Set the cropping coordinates here in percentage:
-	setXMPValue(xmpData, "Xmp.crs.CropTop", QString::number(r.top()));
-	setXMPValue(xmpData, "Xmp.crs.CropLeft", QString::number(r.left()));
-	setXMPValue(xmpData, "Xmp.crs.CropBottom", QString::number(r.bottom()));
-	setXMPValue(xmpData, "Xmp.crs.CropRight", QString::number(r.right()));
+    setXMPValue(xmpData, "Xmp.crs.CropAngle", QString::number(angle));
 
-	setXMPValue(xmpData, "Xmp.crs.CropAngle", QString::number(angle));
+    setXMPValue(xmpData, "Xmp.crs.HasCrop", "True");
+    // These key values are set by camera raw automatically, but I have found no documentation for them:
+    setXMPValue(xmpData, "Xmp.crs.CropConstrainToWarp", "1");
+    setXMPValue(xmpData, "Xmp.crs.crs:AlreadyApplied", "False"); // is this crs.crs: correct??
 
-	setXMPValue(xmpData, "Xmp.crs.HasCrop", "True");
-	// These key values are set by camera raw automatically, but I have found no documentation for them:
-	setXMPValue(xmpData, "Xmp.crs.CropConstrainToWarp", "1");
-	setXMPValue(xmpData, "Xmp.crs.crs:AlreadyApplied", "False");	// is this crs.crs: correct??
+    // Save the crop coordinates to the sidecar file:
+    try {
+        mExifImg->setXmpData(xmpData);
+        mExifState = dirty;
 
-	// Save the crop coordinates to the sidecar file:
-	try {
-		mExifImg->setXmpData(xmpData);
-		mExifState = dirty;
+        qInfo() << r << "written to XMP";
 
-		qInfo() << r << "written to XMP";
+    } catch (...) {
+        qWarning() << "[WARNING] I could not set the exif data for this image format...";
+    }
 
-	}
-	catch (...) {
-		qWarning() << "[WARNING] I could not set the exif data for this image format...";
-	}
-
-	return true;
+    return true;
 }
 
-bool DkMetaDataT::clearXMPRect() {
-
-	if (mExifState != loaded && mExifState != dirty)
-		return false;
+bool DkMetaDataT::clearXMPRect()
+{
+    if (mExifState != loaded && mExifState != dirty)
+        return false;
 
-	Exiv2::XmpData xmpData = mExifImg->xmpData();
-	setXMPValue(xmpData, "Xmp.crs.HasCrop", "False");
-	mExifImg->setXmpData(xmpData);
-	mExifState = dirty;
+    Exiv2::XmpData xmpData = mExifImg->xmpData();
+    setXMPValue(xmpData, "Xmp.crs.HasCrop", "False");
+    mExifImg->setXmpData(xmpData);
+    mExifState = dirty;
 
-	return true;
+    return true;
 }
 
-DkRotatingRect DkMetaDataT::getXMPRect(const QSize& size) const {
+DkRotatingRect DkMetaDataT::getXMPRect(const QSize &size) const
+{
+    if (mExifState != loaded && mExifState != dirty)
+        return DkRotatingRect();
 
-	if (mExifState != loaded && mExifState != dirty)
-		return DkRotatingRect();
+    // pretend it's not here if it is already applied
+    QString applied = getXmpValue("Xmp.crs.AlreadyApplied");
+    QString hasCrop = getXmpValue("Xmp.crs.HasCrop");
+    if (applied.compare("true", Qt::CaseInsensitive) == 0 || // compare is 0 if the strings are the same
+        hasCrop.compare("true", Qt::CaseInsensitive) != 0)
+        return DkRotatingRect();
 
-	// pretend it's not here if it is already applied
-	QString applied = getXmpValue("Xmp.crs.AlreadyApplied");
-	QString hasCrop = getXmpValue("Xmp.crs.HasCrop");
-	if (applied.compare("true", Qt::CaseInsensitive) == 0 ||	// compare is 0 if the strings are the same
-		hasCrop.compare("true", Qt::CaseInsensitive) != 0)
-		return DkRotatingRect();
+    Exiv2::XmpData xmpData = mExifImg->xmpData();
+    double top = getXmpValue("Xmp.crs.CropTop").toDouble();
+    double bottom = getXmpValue("Xmp.crs.CropBottom").toDouble();
+    double left = getXmpValue("Xmp.crs.CropLeft").toDouble();
+    double right = getXmpValue("Xmp.crs.CropRight").toDouble();
 
-	Exiv2::XmpData xmpData = mExifImg->xmpData();
-	double top		= getXmpValue("Xmp.crs.CropTop").toDouble();
-	double bottom	= getXmpValue("Xmp.crs.CropBottom").toDouble();
-	double left		= getXmpValue("Xmp.crs.CropLeft").toDouble();
-	double right	= getXmpValue("Xmp.crs.CropRight").toDouble();
+    double angle = getXmpValue("Xmp.crs.CropAngle").toDouble();
 
-	double angle = getXmpValue("Xmp.crs.CropAngle").toDouble();
+    QRectF r(left, top, right - left, bottom - top);
+    DkRotatingRect rr = DkRotatingRect::fromExifRect(r, size, angle * DK_DEG2RAD);
 
-	QRectF r(left, top, right-left, bottom-top);
-	DkRotatingRect rr = DkRotatingRect::fromExifRect(r, size, angle*DK_DEG2RAD);
-
-	return DkRotatingRect(rr);
+    return DkRotatingRect(rr);
 }
 
-Exiv2::Image::AutoPtr DkMetaDataT::loadSidecar(const QString& filePath) const {
-
-	Exiv2::Image::AutoPtr xmpImg;
+Exiv2::Image::AutoPtr DkMetaDataT::loadSidecar(const QString &filePath) const
+{
+    Exiv2::Image::AutoPtr xmpImg;
 
-	//TODO: check if the file type supports xmp
+    // TODO: check if the file type supports xmp
 
-	// Create the path to the XMP file:	
-	QString dir = filePath;
-	QString ext = QFileInfo(filePath).suffix();
-	QString xmpPath = dir.left(dir.length() - ext.length() - 1);
-	QString xmpExt = ".xmp";
-	QString xmpFilePath = xmpPath + xmpExt;
+    // Create the path to the XMP file:
+    QString dir = filePath;
+    QString ext = QFileInfo(filePath).suffix();
+    QString xmpPath = dir.left(dir.length() - ext.length() - 1);
+    QString xmpExt = ".xmp";
+    QString xmpFilePath = xmpPath + xmpExt;
 
-	QFileInfo xmpFileInfo = QFileInfo(xmpFilePath);
+    QFileInfo xmpFileInfo = QFileInfo(xmpFilePath);
 
-	qDebug() << "XMP sidecar path: " << xmpFilePath;
+    qDebug() << "XMP sidecar path: " << xmpFilePath;
 
-	if (xmpFileInfo.exists()) {
-		try {
-			xmpImg = Exiv2::ImageFactory::open(xmpFilePath.toStdString());
-			xmpImg->readMetadata();
-		}
-		catch (...) {
-			qWarning() << "Could not read xmp from: " << xmpFilePath;
-		}
-	}
-	if (!xmpImg.get()) {
+    if (xmpFileInfo.exists()) {
+        try {
+            xmpImg = Exiv2::ImageFactory::open(xmpFilePath.toStdString());
+            xmpImg->readMetadata();
+        } catch (...) {
+            qWarning() << "Could not read xmp from: " << xmpFilePath;
+        }
+    }
+    if (!xmpImg.get()) {
+        // We can only load sidecar files whose paths use std::string literals (no unicode here)
+        // Create a new XMP sidecar, unfortunately this one has fewer attributes than the adobe version:
+        xmpImg = Exiv2::ImageFactory::create(Exiv2::ImageType::xmp, xmpFilePath.toStdString());
 
-		// We can only load sidecar files whose paths use std::string literals (no unicode here)
-		// Create a new XMP sidecar, unfortunately this one has fewer attributes than the adobe version:	
-		xmpImg = Exiv2::ImageFactory::create(Exiv2::ImageType::xmp, xmpFilePath.toStdString());
+        xmpImg->setMetadata(*mExifImg);
+        xmpImg->writeMetadata(); // we need that to add xmp afterwards - but why?
+    }
 
-		xmpImg->setMetadata(*mExifImg);
-		xmpImg->writeMetadata();	// we need that to add xmp afterwards - but why?
-	}
-
-	return xmpImg;
+    return xmpImg;
 }
 
-bool DkMetaDataT::setXMPValue(Exiv2::XmpData& xmpData, QString xmpKey, QString xmpValue) {
-
-	bool setXMPValueSuccessful = false;
+bool DkMetaDataT::setXMPValue(Exiv2::XmpData &xmpData, QString xmpKey, QString xmpValue)
+{
+    bool setXMPValueSuccessful = false;
 
-	//if (!xmpData.empty()) {
+    // if (!xmpData.empty()) {
 
-		Exiv2::XmpKey key = Exiv2::XmpKey(xmpKey.toStdString());
-		Exiv2::XmpData::iterator pos = xmpData.findKey(key);
+    Exiv2::XmpKey key = Exiv2::XmpKey(xmpKey.toStdString());
+    Exiv2::XmpData::iterator pos = xmpData.findKey(key);
 
-		//Update the tag if it is set:
-		if (pos != xmpData.end() && pos->count() != 0) {
-			//sidecarXmpData.erase(pos);
-			if (!pos->setValue(xmpValue.toStdString())) 
-				setXMPValueSuccessful = true;
-		}
-		else {
-			Exiv2::Value::AutoPtr v = Exiv2::Value::create(Exiv2::xmpText);
-			if (!v->read(xmpValue.toStdString())) {
-				if (!xmpData.add(Exiv2::XmpKey(key), v.get()))
-					setXMPValueSuccessful = true;
-			}
-			
-		}
-	//}
-
-	return setXMPValueSuccessful;
+    // Update the tag if it is set:
+    if (pos != xmpData.end() && pos->count() != 0) {
+        // sidecarXmpData.erase(pos);
+        if (!pos->setValue(xmpValue.toStdString()))
+            setXMPValueSuccessful = true;
+    } else {
+        Exiv2::Value::AutoPtr v = Exiv2::Value::create(Exiv2::xmpText);
+        if (!v->read(xmpValue.toStdString())) {
+            if (!xmpData.add(Exiv2::XmpKey(key), v.get()))
+                setXMPValueSuccessful = true;
+        }
+    }
+    //}
 
+    return setXMPValueSuccessful;
 }
 
 // DkMetaDataHelper --------------------------------------------------------------------
-void DkMetaDataHelper::init() {
-
-	mCamSearchTags.append("ImageSize");
-	mCamSearchTags.append("Orientation");
-	mCamSearchTags.append("Make");
-	mCamSearchTags.append("Model");
-	mCamSearchTags.append("ApertureValue");
-	mCamSearchTags.append("ISOSpeedRatings");
-	mCamSearchTags.append("Flash");
-	mCamSearchTags.append("FocalLength");
-	mCamSearchTags.append("ExposureMode");
-	mCamSearchTags.append("ExposureTime");
-	mCamSearchTags.append("Compression");
-
-	mDescSearchTags.append("Rating");
-	mDescSearchTags.append("UserComment");
-	mDescSearchTags.append("DateTime");
-	mDescSearchTags.append("DateTimeOriginal");
-	mDescSearchTags.append("ImageDescription");
-	mDescSearchTags.append("Byline");
-	mDescSearchTags.append("BylineTitle");
-	mDescSearchTags.append("City");
-	mDescSearchTags.append("Country");
-	mDescSearchTags.append("Headline");
-	mDescSearchTags.append("Caption");
-	mDescSearchTags.append("CopyRight");
-	mDescSearchTags.append("Keywords");
-	mDescSearchTags.append("Path");
-	mDescSearchTags.append("FileSize");
-
-	for (int i = 0; i  < DkSettingsManager::param().translatedCamData().size(); i++) 
-		mTranslatedCamTags << qApp->translate("nmc::DkMetaData", DkSettingsManager::param().translatedCamData().at(i).toLatin1());
-
-	for (int i = 0; i  < DkSettingsManager::param().translatedDescriptionData().size(); i++)
-		mTranslatedDescTags << qApp->translate("nmc::DkMetaData", DkSettingsManager::param().translatedDescriptionData().at(i).toLatin1());
-
-	mExposureModes.append(QObject::tr("not defined"));
-	mExposureModes.append(QObject::tr("manual"));
-	mExposureModes.append(QObject::tr("normal"));
-	mExposureModes.append(QObject::tr("aperture priority"));
-	mExposureModes.append(QObject::tr("shutter priority"));
-	mExposureModes.append(QObject::tr("program creative"));
-	mExposureModes.append(QObject::tr("high-speed program"));
-	mExposureModes.append(QObject::tr("portrait mode"));
-	mExposureModes.append(QObject::tr("landscape mode"));
-
-	// flash mapping is taken from: http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html#Flash
-	mFlashModes.insert(0x0, QObject::tr("No Flash"));
-	mFlashModes.insert(0x1, QObject::tr("Fired"));
-	mFlashModes.insert(0x5, QObject::tr("Fired, Return not detected"));
-	mFlashModes.insert(0x7, QObject::tr("Fired, Return detected"));
-	mFlashModes.insert(0x8, QObject::tr("On, Did not fire"));
-	mFlashModes.insert(0x9, QObject::tr("On, Fired"));
-	mFlashModes.insert(0xd, QObject::tr("On, Return not detected"));
-	mFlashModes.insert(0xf, QObject::tr("On, Return detected"));
-	mFlashModes.insert(0x10, QObject::tr("Off, Did not fire"));
-	mFlashModes.insert(0x14, QObject::tr("Off, Did not fire, Return not detected"));
-	mFlashModes.insert(0x18, QObject::tr("Auto, Did not fire"));
-	mFlashModes.insert(0x19, QObject::tr("Auto, Fired"));
-	mFlashModes.insert(0x1d, QObject::tr("Auto, Fired, Return not detected"));
-	mFlashModes.insert(0x1f, QObject::tr("Auto, Fired, Return detected"));
-	mFlashModes.insert(0x20, QObject::tr("No flash function"));
-	mFlashModes.insert(0x30, QObject::tr("Off, No flash function"));
-	mFlashModes.insert(0x41, QObject::tr("Fired, Red-eye reduction"));
-	mFlashModes.insert(0x45, QObject::tr("Fired, Red-eye reduction, Return not detected"));
-	mFlashModes.insert(0x47, QObject::tr("Fired, Red-eye reduction, Return detected"));
-	mFlashModes.insert(0x49, QObject::tr("On, Red-eye reduction"));
-	mFlashModes.insert(0x4d, QObject::tr("On, Red-eye reduction, Return not detected"));
-	mFlashModes.insert(0x4f, QObject::tr("On, Red-eye reduction, Return detected"));
-	mFlashModes.insert(0x50, QObject::tr("Off, Red-eye reduction"));
-	mFlashModes.insert(0x58, QObject::tr("Auto, Did not fire, Red-eye reduction"));
-	mFlashModes.insert(0x59, QObject::tr("Auto, Fired, Red-eye reduction"));
-	mFlashModes.insert(0x5d, QObject::tr("Auto, Fired, Red-eye reduction, Return not detected"));
-	mFlashModes.insert(0x5f, QObject::tr("Auto, Fired, Red-eye reduction, Return detected"));
-
-	// compression mapping taken from: https://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html#Compression
-	mCompressionModes.insert(1, QObject::tr("Uncompressed"));
-	mCompressionModes.insert(2, QObject::tr("CCITT 1D"));
-	mCompressionModes.insert(3, QObject::tr("T4/Group 3 Fax"));
-	mCompressionModes.insert(4, QObject::tr("T6/Group 4 Fax"));
-	mCompressionModes.insert(5, QObject::tr("LZW"));
-	mCompressionModes.insert(6, QObject::tr("JPEG (old-style)"));
-	mCompressionModes.insert(7, QObject::tr("JPEG"));
-	mCompressionModes.insert(8, QObject::tr("Adobe Deflate"));
-	mCompressionModes.insert(9, QObject::tr("JBIG B&W"));
-	mCompressionModes.insert(10, QObject::tr("JBIG Color"));
-	mCompressionModes.insert(99, QObject::tr("JPEG"));
-	mCompressionModes.insert(262, QObject::tr("Kodak 262"));
-	mCompressionModes.insert(32766, QObject::tr("Next"));
-	mCompressionModes.insert(32767, QObject::tr("Sony ARW Compressed"));
-	mCompressionModes.insert(32769, QObject::tr("Packed RAW"));
-	mCompressionModes.insert(32770, QObject::tr("Samsung SRW Compressed"));
-	mCompressionModes.insert(32771, QObject::tr("CCIRLEW"));
-	mCompressionModes.insert(32772, QObject::tr("Samsung SRW Compressed 2"));
-	mCompressionModes.insert(32773, QObject::tr("PackBits"));
-	mCompressionModes.insert(32809, QObject::tr("Thunderscan"));
-	mCompressionModes.insert(32867, QObject::tr("Kodak KDC Compressed"));
-	mCompressionModes.insert(32895, QObject::tr("IT8CTPAD"));
-	mCompressionModes.insert(32896, QObject::tr("IT8LW"));
-	mCompressionModes.insert(32897, QObject::tr("IT8MP"));
-	mCompressionModes.insert(32898, QObject::tr("IT8BL"));
-	mCompressionModes.insert(32908, QObject::tr("PixarFilm"));
-	mCompressionModes.insert(32909, QObject::tr("PixarLog"));
-	mCompressionModes.insert(32946, QObject::tr("Deflate"));
-	mCompressionModes.insert(32947, QObject::tr("DCS"));
-	mCompressionModes.insert(33003, QObject::tr("Aperio JPEG 2000 YCbCr"));
-	mCompressionModes.insert(33005, QObject::tr("Aperio JPEG 2000 RGB"));
-	mCompressionModes.insert(34661, QObject::tr("JBIG"));
-	mCompressionModes.insert(34676, QObject::tr("SGILog"));
-	mCompressionModes.insert(34677, QObject::tr("SGILog24"));
-	mCompressionModes.insert(34712, QObject::tr("JPEG 2000"));
-	mCompressionModes.insert(34713, QObject::tr("Nikon NEF Compressed"));
-	mCompressionModes.insert(34715, QObject::tr("JBIG2 TIFF FX"));
-	mCompressionModes.insert(34718, QObject::tr("Microsoft Document Imaging(MDI) Binary Level Codec"));
-	mCompressionModes.insert(34719, QObject::tr("Microsoft Document Imaging(MDI) Progressive Transform Codec"));
-	mCompressionModes.insert(34720, QObject::tr("Microsoft Document Imaging(MDI) Vector"));
-	mCompressionModes.insert(34887, QObject::tr("ESRI Lerc"));
-	mCompressionModes.insert(34892, QObject::tr("Lossy JPEG"));
-	mCompressionModes.insert(34925, QObject::tr("LZMA2"));
-	mCompressionModes.insert(34926, QObject::tr("Zstd"));
-	mCompressionModes.insert(34927, QObject::tr("WebP"));
-	mCompressionModes.insert(34933, QObject::tr("PNG"));
-	mCompressionModes.insert(34934, QObject::tr("JPEG XR"));
-	mCompressionModes.insert(65000, QObject::tr("Kodak DCR Compressed"));
-	mCompressionModes.insert(65535, QObject::tr("Pentax PEF Compressed"));
-
-}
-
-QString DkMetaDataHelper::getApertureValue(QSharedPointer<DkMetaDataT> metaData) const {
-
-	QString key = mCamSearchTags.at(key_aperture); 
-
-	QString value = metaData->getExifValue(key);
-	QStringList sList = value.split('/');
-
-	if (sList.size() == 2) {
-		double val = pow(1.4142, sList[0].toDouble()/sList[1].toDouble());	// see the exif documentation (e.g. http://www.media.mit.edu/pia/Research/deepview/exif.html)
-		value = QString::fromStdString(DkUtils::stringify(val,1));
-	}
-
-	// just divide the fnumber
-	if (value.isEmpty()) {
-		value = metaData->getExifValue("FNumber");	// try alternative tag
-		value = DkUtils::resolveFraction(value);
-	}
-
-	return value;
-}
-
-QString DkMetaDataHelper::getFocalLength(QSharedPointer<DkMetaDataT> metaData) const {
-
-	// focal length
-	QString key = mCamSearchTags.at(key_focal_length);
-
-	QString value = metaData->getExifValue(key);
-
-	float v = convertRational(value);
-
-	if (v != -1)
-		value = QString::number(v) + " mm";
-
-	return value;
-}
-
-QString DkMetaDataHelper::getExposureTime(QSharedPointer<DkMetaDataT> metaData) const {
-
-	QString key = mCamSearchTags.at(key_exposure_time);
-	QString value = metaData->getExifValue(key);
-	QStringList sList = value.split('/');
-
-	if (sList.size() == 2) {
-		int nom = sList[0].toInt();		// nominator
-		int denom = sList[1].toInt();	// denominator
-
-		// if exposure time is less than a second -> compute the gcd for nice values (1/500 instead of 2/1000)
-		if (nom <= denom && nom != 0) {
-			int gcd = DkMath::gcd(denom, nom);
-			value = QString::number(nom/gcd) + QString("/") + QString::number(denom/gcd);
-		}
-		else
-			value = QString::fromStdString(DkUtils::stringify((float)nom/(float)denom,1));
-
-		value += " sec";
-	}
-
-	return value;
-}
-
-QString DkMetaDataHelper::getExposureMode(QSharedPointer<DkMetaDataT> metaData) const {
+void DkMetaDataHelper::init()
+{
+    mCamSearchTags.append("ImageSize");
+    mCamSearchTags.append("Orientation");
+    mCamSearchTags.append("Make");
+    mCamSearchTags.append("Model");
+    mCamSearchTags.append("ApertureValue");
+    mCamSearchTags.append("ISOSpeedRatings");
+    mCamSearchTags.append("Flash");
+    mCamSearchTags.append("FocalLength");
+    mCamSearchTags.append("ExposureMode");
+    mCamSearchTags.append("ExposureTime");
+    mCamSearchTags.append("Compression");
+
+    mDescSearchTags.append("Rating");
+    mDescSearchTags.append("UserComment");
+    mDescSearchTags.append("DateTime");
+    mDescSearchTags.append("DateTimeOriginal");
+    mDescSearchTags.append("ImageDescription");
+    mDescSearchTags.append("Byline");
+    mDescSearchTags.append("BylineTitle");
+    mDescSearchTags.append("City");
+    mDescSearchTags.append("Country");
+    mDescSearchTags.append("Headline");
+    mDescSearchTags.append("Caption");
+    mDescSearchTags.append("CopyRight");
+    mDescSearchTags.append("Keywords");
+    mDescSearchTags.append("Path");
+    mDescSearchTags.append("FileSize");
+
+    for (int i = 0; i < DkSettingsManager::param().translatedCamData().size(); i++)
+        mTranslatedCamTags << qApp->translate("nmc::DkMetaData", DkSettingsManager::param().translatedCamData().at(i).toLatin1());
+
+    for (int i = 0; i < DkSettingsManager::param().translatedDescriptionData().size(); i++)
+        mTranslatedDescTags << qApp->translate("nmc::DkMetaData", DkSettingsManager::param().translatedDescriptionData().at(i).toLatin1());
+
+    mExposureModes.append(QObject::tr("not defined"));
+    mExposureModes.append(QObject::tr("manual"));
+    mExposureModes.append(QObject::tr("normal"));
+    mExposureModes.append(QObject::tr("aperture priority"));
+    mExposureModes.append(QObject::tr("shutter priority"));
+    mExposureModes.append(QObject::tr("program creative"));
+    mExposureModes.append(QObject::tr("high-speed program"));
+    mExposureModes.append(QObject::tr("portrait mode"));
+    mExposureModes.append(QObject::tr("landscape mode"));
+
+    // flash mapping is taken from: http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html#Flash
+    mFlashModes.insert(0x0, QObject::tr("No Flash"));
+    mFlashModes.insert(0x1, QObject::tr("Fired"));
+    mFlashModes.insert(0x5, QObject::tr("Fired, Return not detected"));
+    mFlashModes.insert(0x7, QObject::tr("Fired, Return detected"));
+    mFlashModes.insert(0x8, QObject::tr("On, Did not fire"));
+    mFlashModes.insert(0x9, QObject::tr("On, Fired"));
+    mFlashModes.insert(0xd, QObject::tr("On, Return not detected"));
+    mFlashModes.insert(0xf, QObject::tr("On, Return detected"));
+    mFlashModes.insert(0x10, QObject::tr("Off, Did not fire"));
+    mFlashModes.insert(0x14, QObject::tr("Off, Did not fire, Return not detected"));
+    mFlashModes.insert(0x18, QObject::tr("Auto, Did not fire"));
+    mFlashModes.insert(0x19, QObject::tr("Auto, Fired"));
+    mFlashModes.insert(0x1d, QObject::tr("Auto, Fired, Return not detected"));
+    mFlashModes.insert(0x1f, QObject::tr("Auto, Fired, Return detected"));
+    mFlashModes.insert(0x20, QObject::tr("No flash function"));
+    mFlashModes.insert(0x30, QObject::tr("Off, No flash function"));
+    mFlashModes.insert(0x41, QObject::tr("Fired, Red-eye reduction"));
+    mFlashModes.insert(0x45, QObject::tr("Fired, Red-eye reduction, Return not detected"));
+    mFlashModes.insert(0x47, QObject::tr("Fired, Red-eye reduction, Return detected"));
+    mFlashModes.insert(0x49, QObject::tr("On, Red-eye reduction"));
+    mFlashModes.insert(0x4d, QObject::tr("On, Red-eye reduction, Return not detected"));
+    mFlashModes.insert(0x4f, QObject::tr("On, Red-eye reduction, Return detected"));
+    mFlashModes.insert(0x50, QObject::tr("Off, Red-eye reduction"));
+    mFlashModes.insert(0x58, QObject::tr("Auto, Did not fire, Red-eye reduction"));
+    mFlashModes.insert(0x59, QObject::tr("Auto, Fired, Red-eye reduction"));
+    mFlashModes.insert(0x5d, QObject::tr("Auto, Fired, Red-eye reduction, Return not detected"));
+    mFlashModes.insert(0x5f, QObject::tr("Auto, Fired, Red-eye reduction, Return detected"));
+
+    // compression mapping taken from: https://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html#Compression
+    mCompressionModes.insert(1, QObject::tr("Uncompressed"));
+    mCompressionModes.insert(2, QObject::tr("CCITT 1D"));
+    mCompressionModes.insert(3, QObject::tr("T4/Group 3 Fax"));
+    mCompressionModes.insert(4, QObject::tr("T6/Group 4 Fax"));
+    mCompressionModes.insert(5, QObject::tr("LZW"));
+    mCompressionModes.insert(6, QObject::tr("JPEG (old-style)"));
+    mCompressionModes.insert(7, QObject::tr("JPEG"));
+    mCompressionModes.insert(8, QObject::tr("Adobe Deflate"));
+    mCompressionModes.insert(9, QObject::tr("JBIG B&W"));
+    mCompressionModes.insert(10, QObject::tr("JBIG Color"));
+    mCompressionModes.insert(99, QObject::tr("JPEG"));
+    mCompressionModes.insert(262, QObject::tr("Kodak 262"));
+    mCompressionModes.insert(32766, QObject::tr("Next"));
+    mCompressionModes.insert(32767, QObject::tr("Sony ARW Compressed"));
+    mCompressionModes.insert(32769, QObject::tr("Packed RAW"));
+    mCompressionModes.insert(32770, QObject::tr("Samsung SRW Compressed"));
+    mCompressionModes.insert(32771, QObject::tr("CCIRLEW"));
+    mCompressionModes.insert(32772, QObject::tr("Samsung SRW Compressed 2"));
+    mCompressionModes.insert(32773, QObject::tr("PackBits"));
+    mCompressionModes.insert(32809, QObject::tr("Thunderscan"));
+    mCompressionModes.insert(32867, QObject::tr("Kodak KDC Compressed"));
+    mCompressionModes.insert(32895, QObject::tr("IT8CTPAD"));
+    mCompressionModes.insert(32896, QObject::tr("IT8LW"));
+    mCompressionModes.insert(32897, QObject::tr("IT8MP"));
+    mCompressionModes.insert(32898, QObject::tr("IT8BL"));
+    mCompressionModes.insert(32908, QObject::tr("PixarFilm"));
+    mCompressionModes.insert(32909, QObject::tr("PixarLog"));
+    mCompressionModes.insert(32946, QObject::tr("Deflate"));
+    mCompressionModes.insert(32947, QObject::tr("DCS"));
+    mCompressionModes.insert(33003, QObject::tr("Aperio JPEG 2000 YCbCr"));
+    mCompressionModes.insert(33005, QObject::tr("Aperio JPEG 2000 RGB"));
+    mCompressionModes.insert(34661, QObject::tr("JBIG"));
+    mCompressionModes.insert(34676, QObject::tr("SGILog"));
+    mCompressionModes.insert(34677, QObject::tr("SGILog24"));
+    mCompressionModes.insert(34712, QObject::tr("JPEG 2000"));
+    mCompressionModes.insert(34713, QObject::tr("Nikon NEF Compressed"));
+    mCompressionModes.insert(34715, QObject::tr("JBIG2 TIFF FX"));
+    mCompressionModes.insert(34718, QObject::tr("Microsoft Document Imaging(MDI) Binary Level Codec"));
+    mCompressionModes.insert(34719, QObject::tr("Microsoft Document Imaging(MDI) Progressive Transform Codec"));
+    mCompressionModes.insert(34720, QObject::tr("Microsoft Document Imaging(MDI) Vector"));
+    mCompressionModes.insert(34887, QObject::tr("ESRI Lerc"));
+    mCompressionModes.insert(34892, QObject::tr("Lossy JPEG"));
+    mCompressionModes.insert(34925, QObject::tr("LZMA2"));
+    mCompressionModes.insert(34926, QObject::tr("Zstd"));
+    mCompressionModes.insert(34927, QObject::tr("WebP"));
+    mCompressionModes.insert(34933, QObject::tr("PNG"));
+    mCompressionModes.insert(34934, QObject::tr("JPEG XR"));
+    mCompressionModes.insert(65000, QObject::tr("Kodak DCR Compressed"));
+    mCompressionModes.insert(65535, QObject::tr("Pentax PEF Compressed"));
+}
+
+QString DkMetaDataHelper::getApertureValue(QSharedPointer<DkMetaDataT> metaData) const
+{
+    QString key = mCamSearchTags.at(key_aperture);
+
+    QString value = metaData->getExifValue(key);
+    QStringList sList = value.split('/');
+
+    if (sList.size() == 2) {
+        double val =
+            pow(1.4142,
+                sList[0].toDouble() / sList[1].toDouble()); // see the exif documentation (e.g. http://www.media.mit.edu/pia/Research/deepview/exif.html)
+        value = QString::fromStdString(DkUtils::stringify(val, 1));
+    }
+
+    // just divide the fnumber
+    if (value.isEmpty()) {
+        value = metaData->getExifValue("FNumber"); // try alternative tag
+        value = DkUtils::resolveFraction(value);
+    }
+
+    return value;
+}
+
+QString DkMetaDataHelper::getFocalLength(QSharedPointer<DkMetaDataT> metaData) const
+{
+    // focal length
+    QString key = mCamSearchTags.at(key_focal_length);
+
+    QString value = metaData->getExifValue(key);
+
+    float v = convertRational(value);
+
+    if (v != -1)
+        value = QString::number(v) + " mm";
+
+    return value;
+}
+
+QString DkMetaDataHelper::getExposureTime(QSharedPointer<DkMetaDataT> metaData) const
+{
+    QString key = mCamSearchTags.at(key_exposure_time);
+    QString value = metaData->getExifValue(key);
+    QStringList sList = value.split('/');
+
+    if (sList.size() == 2) {
+        int nom = sList[0].toInt(); // nominator
+        int denom = sList[1].toInt(); // denominator
+
+        // if exposure time is less than a second -> normalize to get nice values (1/500 instead of 2/1000)
+        if (nom <= denom && nom != 0) {
+            // fixes #496
+            double nd = (double)denom / nom;
+            value = QString("1/") + QString::number(qRound(nd));
+        } else
+            value = QString::fromStdString(DkUtils::stringify((float)nom / (float)denom, 1));
+
+        value += " sec";
+    }
+
+    return value;
+}
+
+QString DkMetaDataHelper::getExposureMode(QSharedPointer<DkMetaDataT> metaData) const
+{
+    QString key = mCamSearchTags.at(key_exposure_mode);
+    QString value = metaData->getExifValue(key);
+    int mode = value.toInt();
+
+    if (mode >= 0 && mode < mExposureModes.size())
+        value = mExposureModes[mode];
+
+    return value;
+}
+
+QString DkMetaDataHelper::getFlashMode(QSharedPointer<DkMetaDataT> metaData) const
+{
+    QString key = mCamSearchTags.at(key_flash);
+    QString value = metaData->getExifValue(key);
+    unsigned int mode = value.toUInt();
+
+    if (mode < (unsigned int)mFlashModes.size())
+        value = mFlashModes[mode];
+    else {
+        value = mFlashModes.first(); // assuming no flash to be first
+        qWarning() << "illegal flash mode dected: " << mode;
+    }
 
-	QString key = mCamSearchTags.at(key_exposure_mode);
-	QString value = metaData->getExifValue(key);
-	int mode = value.toInt();
-
-	if (mode >= 0 && mode < mExposureModes.size())
-		value = mExposureModes[mode];
-
-	return value;
-}
-
-QString DkMetaDataHelper::getFlashMode(QSharedPointer<DkMetaDataT> metaData) const {
-
-	QString key = mCamSearchTags.at(key_flash);
-	QString value = metaData->getExifValue(key);
-	unsigned int mode = value.toUInt();
-
-	if (mode < (unsigned int)mFlashModes.size())
-		value = mFlashModes[mode];
-	else {
-		value = mFlashModes.first();	// assuming no flash to be first
-		qWarning() << "illegal flash mode dected: " << mode;
-	}
-
-	return value;
+    return value;
 }
 
-QString DkMetaDataHelper::getCompression(QSharedPointer<DkMetaDataT> metaData) const {
+QString DkMetaDataHelper::getCompression(QSharedPointer<DkMetaDataT> metaData) const
+{
+    int cmpKey = metaData->getExifValue(mCamSearchTags[key_compression]).toInt();
+    QString value = mCompressionModes.value(cmpKey, "");
 
-	int cmpKey = metaData->getExifValue(mCamSearchTags[key_compression]).toInt();
-	QString value = mCompressionModes.value(cmpKey, "");
-	
-	// show raw data if we can't map it
-	if (value.isEmpty())
-		value = QString::number(cmpKey);
+    // show raw data if we can't map it
+    if (value.isEmpty())
+        value = QString::number(cmpKey);
 
-	return value;
+    return value;
 }
 
-QString DkMetaDataHelper::getGpsAltitude(const QString& val) const {
-
-	QString rVal = val;
-	float v = convertRational(val);
-
-	if (v != -1)
-		rVal = QString::number(v) + " m";
-
-	return rVal;
-}
-
-QString DkMetaDataHelper::getGpsCoordinates(QSharedPointer<DkMetaDataT> metaData) const {
-
-	QString Lat, LatRef, Lon, LonRef, gpsInfo;
-	QStringList help;
-
-	try {
-
-		if (metaData->hasMetaData()) {
-			//metaData = DkImageLoader::imgMetaData;
-			Lat = metaData->getNativeExifValue("Exif.GPSInfo.GPSLatitude");
-			LatRef = metaData->getNativeExifValue("Exif.GPSInfo.GPSLatitudeRef");
-			Lon = metaData->getNativeExifValue("Exif.GPSInfo.GPSLongitude");
-			LonRef = metaData->getNativeExifValue("Exif.GPSInfo.GPSLongitudeRef");
-			//example url
-			//http://maps.google.com/maps?q=N+48�+8'+31.940001''+E16�+15'+35.009998''
+QString DkMetaDataHelper::getGpsAltitude(const QString &val) const
+{
+    QString rVal = val;
+    float v = convertRational(val);
 
-			gpsInfo = "http://maps.google.com/maps?q=";
+    if (v != -1)
+        rVal = QString::number(v) + " m";
 
-			QString latStr = convertGpsCoordinates(Lat).join("+");
-			QString lonStr = convertGpsCoordinates(Lon).join("+");
-			if (latStr.isEmpty() || lonStr.isEmpty())
-				return "";
-			gpsInfo += "+" + LatRef + "+" + latStr;
-			gpsInfo += "+" + LonRef + "+" + lonStr;
-
-		}
-
-	} catch (...) {
-		gpsInfo = "";
-		//qDebug() << "could not load Exif GPS information";
-	}
-
-	return gpsInfo;
+    return rVal;
 }
 
-QStringList DkMetaDataHelper::convertGpsCoordinates(const QString& coordString) const {
-
-	QStringList gpsInfo;
-	QStringList entries = coordString.split(" ");
+QString DkMetaDataHelper::getGpsCoordinates(QSharedPointer<DkMetaDataT> metaData) const
+{
+    QString Lat, LatRef, Lon, LonRef, gpsInfo;
+    QStringList help;
 
-	for (int i = 0; i < entries.size(); i++) {
-		
-		float val1, val2;
-		QString valS;
-		QStringList coordP;
-		
-		valS = entries.at(i);
-		coordP = valS.split("/");
-		if (coordP.size() != 2)
-			return QStringList();
+    try {
+        if (metaData->hasMetaData()) {
+            // metaData = DkImageLoader::imgMetaData;
+            Lat = metaData->getNativeExifValue("Exif.GPSInfo.GPSLatitude", false);
+            LatRef = metaData->getNativeExifValue("Exif.GPSInfo.GPSLatitudeRef", false);
+            Lon = metaData->getNativeExifValue("Exif.GPSInfo.GPSLongitude", false);
+            LonRef = metaData->getNativeExifValue("Exif.GPSInfo.GPSLongitudeRef", false);
+            // example url
+            // http://maps.google.com/maps?q=N48+8'+31.940001''+E16+15'+35.009998''
 
-		val1 = coordP.at(0).toFloat();
-		val2 = coordP.at(1).toFloat();
-		val1 = val2 != 0 ? val1/val2 : val1;
+            gpsInfo = "http://maps.google.com/maps?q=";
 
-		if (i==0) {
-			valS.setNum((int)val1);
-			gpsInfo.append(valS + dk_degree_str);
-		}
-		if (i==1) {
-			if (val2 > 1)							
-				valS.setNum(val1, 'f', 6);
-			else
-				valS.setNum((int)val1);
-			gpsInfo.append(valS + "'");
-		}
-		if (i==2) {
-			if (val1 != 0) {
-				valS.setNum(val1, 'f', 6);
-				gpsInfo.append(valS + "''");
-			}
-		}
-	}
+            QString latStr = convertGpsCoordinates(Lat).join("+");
+            QString lonStr = convertGpsCoordinates(Lon).join("+");
+            if (latStr.isEmpty() || lonStr.isEmpty())
+                return "";
+            gpsInfo += "+" + LatRef + "+" + latStr;
+            gpsInfo += "+" + LonRef + "+" + lonStr;
+        }
+
+    } catch (...) {
+        gpsInfo = "";
+        // qDebug() << "could not load Exif GPS information";
+    }
+
+    return gpsInfo;
+}
+
+QStringList DkMetaDataHelper::convertGpsCoordinates(const QString &coordString) const
+{
+    QStringList gpsInfo;
+    QStringList entries = coordString.split(" ");
+
+    for (int i = 0; i < entries.size(); i++) {
+        float val1, val2;
+        QString valS;
+        QStringList coordP;
+
+        valS = entries.at(i);
+        coordP = valS.split("/");
+        if (coordP.size() != 2)
+            return QStringList();
+
+        val1 = coordP.at(0).toFloat();
+        val2 = coordP.at(1).toFloat();
+        val1 = val2 != 0 ? val1 / val2 : val1;
+
+        if (i == 0) {
+            valS.setNum((int)val1);
+            gpsInfo.append(valS + dk_degree_str);
+        }
+        if (i == 1) {
+            if (val2 > 1)
+                valS.setNum(val1, 'f', 6);
+            else
+                valS.setNum((int)val1);
+            gpsInfo.append(valS + "'");
+        }
+        if (i == 2) {
+            if (val1 != 0) {
+                valS.setNum(val1, 'f', 6);
+                gpsInfo.append(valS + "''");
+            }
+        }
+    }
 
-	return gpsInfo;
+    return gpsInfo;
 }
 
-float DkMetaDataHelper::convertRational(const QString& val) const {
+float DkMetaDataHelper::convertRational(const QString &val) const
+{
+    float rVal = -1;
+    QStringList sList = val.split('/');
 
-	float rVal = -1;
-	QStringList sList = val.split('/');
+    if (sList.size() == 2) {
+        bool ok1 = false;
+        bool ok2 = false;
 
-	if (sList.size() == 2) {
-		bool ok1 = false;
-		bool ok2 = false;
+        rVal = sList[0].toFloat(&ok1) / sList[1].toFloat(&ok2);
 
-		rVal = sList[0].toFloat(&ok1)/sList[1].toFloat(&ok2);
+        if (!ok1 || !ok2)
+            rVal = -1;
+    }
 
-		if (!ok1 || !ok2)
-			rVal = -1;
-	}
-
-	return rVal;
+    return rVal;
 }
 
-QString DkMetaDataHelper::translateKey(const QString& key) const {
-
-	QString translatedKey = key;
+QString DkMetaDataHelper::translateKey(const QString &key) const
+{
+    QString translatedKey = key;
 
-	int keyIdx = mCamSearchTags.indexOf(key);
-	if (keyIdx != -1)
-		translatedKey = mTranslatedCamTags.at(keyIdx);
+    int keyIdx = mCamSearchTags.indexOf(key);
+    if (keyIdx != -1)
+        translatedKey = mTranslatedCamTags.at(keyIdx);
 
-	keyIdx = mDescSearchTags.indexOf(key);
-	if (keyIdx != -1)
-		translatedKey = mTranslatedDescTags.at(keyIdx);
-
-	return translatedKey;
-}
+    keyIdx = mDescSearchTags.indexOf(key);
+    if (keyIdx != -1)
+        translatedKey = mTranslatedDescTags.at(keyIdx);
 
-QString DkMetaDataHelper::resolveSpecialValue(QSharedPointer<DkMetaDataT> metaData, const QString& key, const QString& value) const {
+    return translatedKey;
+}
 
-	QString rValue = value;
+QString DkMetaDataHelper::resolveSpecialValue(QSharedPointer<DkMetaDataT> metaData, const QString &key, const QString &value) const
+{
+    QString rValue = value;
 
-	if (key == mCamSearchTags[key_aperture] || key == "FNumber") {
-		rValue = getApertureValue(metaData);
-	}
-	else if (key == mCamSearchTags[key_focal_length]) {
-		rValue = getFocalLength(metaData);
-	}
-	else if (key == mCamSearchTags[key_exposure_time]) {
-		rValue = getExposureTime(metaData);
-	}
-	else if (key == mCamSearchTags[key_exposure_mode]) {
-		rValue = getExposureMode(metaData);						
-	} 
-	else if (key == mCamSearchTags[key_flash]) {
-		rValue = getFlashMode(metaData);
-	}
-	else if (key == mCamSearchTags[key_compression]) {
-		rValue = getCompression(metaData);
-	}
-	else if (key == "GPSLatitude" || key == "GPSLongitude") {
-		rValue = convertGpsCoordinates(value).join(" ");
-	}
-	else if (key == "GPSAltitude") {
-		rValue = getGpsAltitude(value);
-	}
-	else if (value.contains("charset=")) {
+    if (key == mCamSearchTags[key_aperture] || key == "FNumber") {
+        rValue = getApertureValue(metaData);
+    } else if (key == mCamSearchTags[key_focal_length]) {
+        rValue = getFocalLength(metaData);
+    } else if (key == mCamSearchTags[key_exposure_time]) {
+        rValue = getExposureTime(metaData);
+    } else if (key == mCamSearchTags[key_exposure_mode]) {
+        rValue = getExposureMode(metaData);
+    } else if (key == mCamSearchTags[key_flash]) {
+        rValue = getFlashMode(metaData);
+    } else if (key == mCamSearchTags[key_compression]) {
+        rValue = getCompression(metaData);
+    } else if (key == "GPSLatitude" || key == "GPSLongitude") {
+        rValue = convertGpsCoordinates(value).join(" ");
+    } else if (key == "GPSAltitude") {
+        rValue = getGpsAltitude(value);
+    } else if (value.contains("charset=")) {
+        if (value.contains("charset=\"unicode\"", Qt::CaseInsensitive)) {
+            rValue = rValue.replace("charset=\"unicode\" ", "", Qt::CaseInsensitive);
 
-		if (value.contains("charset=\"unicode\"", Qt::CaseInsensitive)) {
-			rValue = rValue.replace("charset=\"unicode\" ", "", Qt::CaseInsensitive);
+            //// try to set the BOM ourselves (Note the string would not be released yet
+            // ushort* utfStr = new ushort[rValue.size()+2];
+            // utfStr[0] = 0xFF;
+            // utfStr[1] = 0xFE;
+            // utfStr = utfStr+2;
+            //
+            // utfStr = (ushort*)(rValue.data());
 
-			//// try to set the BOM ourselves (Note the string would not be released yet
-			//ushort* utfStr = new ushort[rValue.size()+2];
-			//utfStr[0] = 0xFF;
-			//utfStr[1] = 0xFE;
-			//utfStr = utfStr+2;
-			//
-			//utfStr = (ushort*)(rValue.data());
-			
-			qDebug() << "UNICODE conversion started...";
-			rValue = QString::fromUtf16((ushort*)(rValue.data()), rValue.size());
-		}
-	}
-	else {
-		rValue = DkUtils::resolveFraction(rValue);	// resolve fractions
-	}
+            qDebug() << "UNICODE conversion started...";
+            rValue = QString::fromUtf16((ushort *)(rValue.data()), rValue.size());
+        }
+    } else {
+        rValue = DkUtils::resolveFraction(rValue); // resolve fractions
+    }
 
-	return rValue;
+    return rValue;
 }
 
-bool DkMetaDataHelper::hasGPS(QSharedPointer<DkMetaDataT> metaData) const {
-
-	return !getGpsCoordinates(metaData).isEmpty();
+bool DkMetaDataHelper::hasGPS(QSharedPointer<DkMetaDataT> metaData) const
+{
+    return !getGpsCoordinates(metaData).isEmpty();
 }
 
-QStringList DkMetaDataHelper::getCamSearchTags() const {
-
-	return mCamSearchTags;
+QStringList DkMetaDataHelper::getCamSearchTags() const
+{
+    return mCamSearchTags;
 }
 
-QStringList DkMetaDataHelper::getDescSearchTags() const {
-
-	return mDescSearchTags;
+QStringList DkMetaDataHelper::getDescSearchTags() const
+{
+    return mDescSearchTags;
 }
 
-QStringList DkMetaDataHelper::getTranslatedCamTags() const {
-
-	return mTranslatedCamTags;
+QStringList DkMetaDataHelper::getTranslatedCamTags() const
+{
+    return mTranslatedCamTags;
 }
 
-QStringList DkMetaDataHelper::getTranslatedDescTags() const {
-
-	return mTranslatedDescTags;
+QStringList DkMetaDataHelper::getTranslatedDescTags() const
+{
+    return mTranslatedDescTags;
 }
 
-QStringList DkMetaDataHelper::getAllExposureModes() const {
-
-	return mExposureModes;
+QStringList DkMetaDataHelper::getAllExposureModes() const
+{
+    return mExposureModes;
 }
 
-QMap<int, QString> DkMetaDataHelper::getAllFlashModes() const {
-
-	return mFlashModes;
+QMap<int, QString> DkMetaDataHelper::getAllFlashModes() const
+{
+    return mFlashModes;
 }
 
-// make XmpParser thread-save
+// make XmpParser thread-save and enable support for ISO BMFF formats (AVIF, HEIF, JXL)
 // see http://exiv2.org/doc/classExiv2_1_1XmpParser.html#aea661a7039adb5a748eb7639c8ce9294
-void DkMetaDataHelper::initialize() {
-
-	DkTimer dt;
-
-	//struct XmpLock {
-	//	CRITICAL_SECTION cs;
-	//	XmpLock() { InitializeCriticalSection(&cs); }
-	//	~XmpLock() { DeleteCriticalSection(&cs); }
-	//	static void LockUnlock(void* pData, bool fLock) {
-	//		XmpLock* pThis = reinterpret_cast<XmpLock*>(pData);
-	//		if (pThis) {
-
-	//			if (fLock) {
-	//				EnterCriticalSection(&pThis->cs);
-	//				qDebug() << "locking -------------------------";
-	//			}
-	//			else {
-	//				LeaveCriticalSection(&pThis->cs);
-	//				qDebug() << "unlocking ------------------------";
-	//			}
-	//		}
-	//	}
-	//} xmpLock;
-
-	//Exiv2::XmpParser::initialize(XmpLock::LockUnlock, &xmpLock);
-	Exiv2::XmpParser::initialize();
-	qDebug() << "initializing the xmp parser takes" << dt;
+void DkMetaDataHelper::initialize()
+{
+    DkTimer dt;
+
+    // struct XmpLock {
+    //	CRITICAL_SECTION cs;
+    //	XmpLock() { InitializeCriticalSection(&cs); }
+    //	~XmpLock() { DeleteCriticalSection(&cs); }
+    //	static void LockUnlock(void* pData, bool fLock) {
+    //		XmpLock* pThis = reinterpret_cast<XmpLock*>(pData);
+    //		if (pThis) {
+
+    //			if (fLock) {
+    //				EnterCriticalSection(&pThis->cs);
+    //				qDebug() << "locking -------------------------";
+    //			}
+    //			else {
+    //				LeaveCriticalSection(&pThis->cs);
+    //				qDebug() << "unlocking ------------------------";
+    //			}
+    //		}
+    //	}
+    //} xmpLock;
+
+    // Exiv2::XmpParser::initialize(XmpLock::LockUnlock, &xmpLock);
+    Exiv2::XmpParser::initialize();
+    qDebug() << "initializing the xmp parser takes" << dt;
+
+#ifdef EXV_ENABLE_BMFF
+    if (Exiv2::enableBMFF(true)) {
+        qInfo() << "Metadata support for BMFF formats is active.";
+    } else {
+        qInfo() << "Exiv2 was built without metadata support for BMFF formats.";
+    }
+#else
+    qInfo() << "Metadata support for AVIF, HEIF and JPEG XL formats is not available.";
+#endif
 }
 
 }
diff --git a/ImageLounge/src/DkCore/DkMetaData.h b/ImageLounge/src/DkCore/DkMetaData.h
index c1f73c9..c6d6233 100644
--- a/ImageLounge/src/DkCore/DkMetaData.h
+++ b/ImageLounge/src/DkCore/DkMetaData.h
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkMetaData.h
  Created on:	19.04.2013
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -27,12 +27,12 @@
 
 #pragma once
 
-#pragma warning(push, 0)	// no warnings from includes - begin
+#pragma warning(push, 0) // no warnings from includes - begin
+#include <QMap>
 #include <QSharedPointer>
 #include <QStringList>
-#include <QMap>
 
-//code for metadata crop:
+// code for metadata crop:
 #include "DkMath.h"
 
 #if defined(__clang__)
@@ -48,15 +48,18 @@
 #define _WINSOCKAPI_
 #endif
 
-#include <exiv2/xmpsidecar.hpp>
 #include <exiv2/image.hpp>
 #include <exiv2/preview.hpp>
+#include <exiv2/xmpsidecar.hpp>
+#ifdef EXV_ENABLE_BMFF
+#include <exiv2/bmffimage.hpp>
+#endif
 #include <iomanip>
 
 #endif
 #pragma warning(pop)
 
-#pragma warning(disable: 4251)	// TODO: remove
+#pragma warning(disable : 4251) // TODO: remove
 
 #ifndef DllCoreExport
 #ifdef DK_CORE_DLL_EXPORT
@@ -77,160 +80,166 @@ typedef unsigned char byte;
 class QVector2D;
 class QImage;
 
-namespace nmc {
-
-class DllCoreExport DkMetaDataT {
-
+namespace nmc
+{
+class DllCoreExport DkMetaDataT
+{
 public:
-	DkMetaDataT();
-
-
-	enum ExifOrientationState {
-		or_illegal = -1,
-		or_not_set,
-		or_valid,
-	};
-
-	void readMetaData(const QString& filePath, QSharedPointer<QByteArray> ba = QSharedPointer<QByteArray>());
-	bool saveMetaData(const QString& filePath, bool force = false);
-	bool saveMetaData(QSharedPointer<QByteArray>& ba, bool force = false);
-
-	int getOrientationDegree() const;
-	ExifOrientationState checkExifOrientation() const;
-	int getRating() const;
-	QSize getImageSize() const;
-	QString getDescription() const;
-	QVector2D getResolution() const;
-	QString getNativeExifValue(const QString& key) const;
-	QString getXmpValue(const QString& key) const;
-	QString getExifValue(const QString& key) const;
-	QString getIptcValue(const QString& key) const;
-	QString getQtValue(const QString& key) const;
-	QImage getThumbnail() const;
-	QImage getPreviewImage(int minPreviewWidth = 0) const;
-	QStringList getExifKeys() const;
-	QStringList getExifValues() const;
-	QStringList getIptcKeys() const;
-	QStringList getQtKeys() const;
-	QStringList getQtValues() const;
-	QStringList getIptcValues() const;
-	QStringList getXmpKeys() const;
-
-	void getFileMetaData(QStringList& fileKeys, QStringList& fileValues) const;
-	void getAllMetaData(QStringList& keys, QStringList& values) const;
-	void setResolution(const QVector2D& res);
-	void clearOrientation();
-	void clearExifState();
-	void setOrientation(int o);
-	void setRating(int r);
-	bool setDescription(const QString& description);
-	bool setExifValue(QString key, QString taginfo);
-	bool updateImageMetaData(const QImage& img);
-	void setThumbnail(QImage thumb);
-	void setQtValues(const QImage& cImg);
-	static QString exiv2ToQString(std::string exifString);
-	void setUseSidecar(bool useSideCar = false);
-
-	bool hasMetaData() const;
-	bool isLoaded() const;
-	bool isTiff() const;
-	bool isJpg() const;
-	bool isRaw() const;
-	bool isDirty() const;
-	bool useSidecar() const;
-	void printMetaData() const; //only for debug
-
-	//code for metadata crop:
-	bool saveRectToXMP(const DkRotatingRect& rect, const QSize& imgSize);
-	bool clearXMPRect();
-	DkRotatingRect getXMPRect(const QSize& size) const;
-	bool setXMPValue(Exiv2::XmpData& xmpData, QString xmpKey, QString xmpValue);
+    DkMetaDataT();
+    bool isNull();
+    QSharedPointer<DkMetaDataT> copy() const;
+    void update(const QSharedPointer<DkMetaDataT> &other);
+
+    enum ExifOrientationState {
+        or_illegal = -1,
+        or_not_set,
+        or_valid,
+    };
+
+    void readMetaData(const QString &filePath, QSharedPointer<QByteArray> ba = QSharedPointer<QByteArray>());
+    bool saveMetaData(const QString &filePath, bool force = false);
+    bool saveMetaData(QSharedPointer<QByteArray> &ba, bool force = false);
+
+    int getOrientationDegree() const;
+    ExifOrientationState checkExifOrientation() const;
+    int getRating() const;
+    QSize getImageSize() const;
+    QString getDescription() const;
+    QVector2D getResolution() const;
+    QString getNativeExifValue(const QString &key, bool humanReadable) const;
+    QString getXmpValue(const QString &key) const;
+    QString getExifValue(const QString &key) const;
+    QString getIptcValue(const QString &key) const;
+    QString getQtValue(const QString &key) const;
+    QImage getThumbnail() const;
+    QImage getPreviewImage(int minPreviewWidth = 0) const;
+    QStringList getExifKeys() const;
+    QStringList getExifValues() const;
+    QStringList getIptcKeys() const;
+    QStringList getQtKeys() const;
+    QStringList getQtValues() const;
+    QStringList getIptcValues() const;
+    QStringList getXmpKeys() const;
+
+    void getFileMetaData(QStringList &fileKeys, QStringList &fileValues) const;
+    void getAllMetaData(QStringList &keys, QStringList &values) const;
+    void setResolution(const QVector2D &res);
+    void clearOrientation();
+    void clearExifState();
+    void setOrientation(int o);
+    void setRating(int r);
+    bool setDescription(const QString &description);
+    bool setExifValue(QString key, QString taginfo);
+    bool updateImageMetaData(const QImage &img, bool reset_orientation = true);
+    void setThumbnail(QImage thumb);
+    void setQtValues(const QImage &cImg);
+    static QString exiv2ToQString(std::string exifString);
+    void setUseSidecar(bool useSideCar = false);
+
+    bool hasMetaData() const;
+    bool isLoaded() const;
+    bool isTiff() const;
+    bool isJpg() const;
+    bool isRaw() const;
+    bool isAVIF() const;
+    bool isHEIF() const;
+    bool isJXL() const;
+    bool isDirty() const;
+    bool useSidecar() const;
+    void printMetaData() const; // only for debug
+
+    // code for metadata crop:
+    bool saveRectToXMP(const DkRotatingRect &rect, const QSize &imgSize);
+    bool clearXMPRect();
+    DkRotatingRect getXMPRect(const QSize &size) const;
+    bool setXMPValue(Exiv2::XmpData &xmpData, QString xmpKey, QString xmpValue);
 
 protected:
-	
-	Exiv2::Image::AutoPtr loadSidecar(const QString& filePath) const;
-
-	enum {
-		not_loaded,
-		no_data,
-		loaded,
-		dirty,
-	};
-
-	Exiv2::Image::AutoPtr mExifImg;
-	QString mFilePath;
-	QStringList mQtKeys;
-	QStringList mQtValues;
-
-	int mExifState = not_loaded;
-	bool mUseSidecar = false;
+    Exiv2::Image::AutoPtr loadSidecar(const QString &filePath) const;
+
+    enum {
+        not_loaded,
+        no_data,
+        loaded,
+        dirty,
+    };
+
+    Exiv2::Image::AutoPtr mExifImg; // TODO std::unique_ptr<Exiv2::Image> (and all other *::AutoPtr)
+    QString mFilePath;
+    QStringList mQtKeys;
+    QStringList mQtValues;
+
+    int mExifState = not_loaded;
+    bool mUseSidecar = false;
 };
 
-class DllCoreExport DkMetaDataHelper {
-
+class DllCoreExport DkMetaDataHelper
+{
 public:
-
-	static DkMetaDataHelper& getInstance() {
-
-		static DkMetaDataHelper instance;
-		return instance;
-	}
-
-	//enums for checkboxes - divide in camera data and description
-	enum ExifKeys {
-		key_size,
-		key_orientation,
-		key_make,
-		key_model,
-		key_aperture,
-		key_iso,
-		key_flash,
-		key_focal_length,
-		key_exposure_mode,
-		key_exposure_time,
-		key_compression,
-
-		key_end
-	};
-
-	QString getApertureValue(QSharedPointer<DkMetaDataT> metaData) const;
-	QString getFocalLength(QSharedPointer<DkMetaDataT> metaData) const;
-	QString getExposureTime(QSharedPointer<DkMetaDataT> metaData) const;
-	QString getExposureMode(QSharedPointer<DkMetaDataT> metaData) const;
-	QString getFlashMode(QSharedPointer<DkMetaDataT> metaData) const;
-	QString getCompression(QSharedPointer<DkMetaDataT> metaData) const;
-	QString getGpsCoordinates(QSharedPointer<DkMetaDataT> metaData) const;
-	QString getGpsAltitude(const QString& val) const;
-	QStringList convertGpsCoordinates(const QString& coordString) const;
-	float convertRational(const QString& val) const;
-	bool hasGPS(QSharedPointer<DkMetaDataT> metaData) const;
-	QString translateKey(const QString& key) const;
-	QString resolveSpecialValue(QSharedPointer<DkMetaDataT> metaData, const QString& key, const QString& value) const;
-
-	QStringList getCamSearchTags() const;
-	QStringList getDescSearchTags() const;
-	QStringList getTranslatedCamTags() const;
-	QStringList getTranslatedDescTags() const;
-	QStringList getAllExposureModes() const;
-	QMap<int, QString> getAllFlashModes() const;
-
-	static void initialize();
+    static DkMetaDataHelper &getInstance()
+    {
+        static DkMetaDataHelper instance;
+        return instance;
+    }
+
+    // enums for checkboxes - divide in camera data and description
+    enum ExifKeys {
+        key_size,
+        key_orientation,
+        key_make,
+        key_model,
+        key_aperture,
+        key_iso,
+        key_flash,
+        key_focal_length,
+        key_exposure_mode,
+        key_exposure_time,
+        key_compression,
+
+        key_end
+    };
+
+    QString getApertureValue(QSharedPointer<DkMetaDataT> metaData) const;
+    QString getFocalLength(QSharedPointer<DkMetaDataT> metaData) const;
+    QString getExposureTime(QSharedPointer<DkMetaDataT> metaData) const;
+    QString getExposureMode(QSharedPointer<DkMetaDataT> metaData) const;
+    QString getFlashMode(QSharedPointer<DkMetaDataT> metaData) const;
+    QString getCompression(QSharedPointer<DkMetaDataT> metaData) const;
+    QString getGpsCoordinates(QSharedPointer<DkMetaDataT> metaData) const;
+    QString getGpsAltitude(const QString &val) const;
+    QStringList convertGpsCoordinates(const QString &coordString) const;
+    float convertRational(const QString &val) const;
+    bool hasGPS(QSharedPointer<DkMetaDataT> metaData) const;
+    QString translateKey(const QString &key) const;
+    QString resolveSpecialValue(QSharedPointer<DkMetaDataT> metaData, const QString &key, const QString &value) const;
+
+    QStringList getCamSearchTags() const;
+    QStringList getDescSearchTags() const;
+    QStringList getTranslatedCamTags() const;
+    QStringList getTranslatedDescTags() const;
+    QStringList getAllExposureModes() const;
+    QMap<int, QString> getAllFlashModes() const;
+
+    static void initialize();
 
 protected:
-	DkMetaDataHelper() { init(); };
-	DkMetaDataHelper(DkMetaDataHelper const&);		// hide
-	void operator=(DkMetaDataHelper const&);		// hide
-	void init();
-
-	QStringList mCamSearchTags;
-	QStringList mDescSearchTags;
-
-	QStringList mTranslatedCamTags;
-	QStringList mTranslatedDescTags;
-
-	QStringList mExposureModes;
-	QMap<int, QString> mFlashModes;
-	QMap<int, QString> mCompressionModes;
+    DkMetaDataHelper()
+    {
+        init();
+    };
+    DkMetaDataHelper(DkMetaDataHelper const &); // hide
+    void operator=(DkMetaDataHelper const &); // hide
+    void init();
+
+    QStringList mCamSearchTags;
+    QStringList mDescSearchTags;
+
+    QStringList mTranslatedCamTags;
+    QStringList mTranslatedDescTags;
+
+    QStringList mExposureModes;
+    QMap<int, QString> mFlashModes;
+    QMap<int, QString> mCompressionModes;
 };
 
 }
diff --git a/ImageLounge/src/DkCore/DkPluginInterface.h b/ImageLounge/src/DkCore/DkPluginInterface.h
index 9ba170e..fb0537d 100644
--- a/ImageLounge/src/DkCore/DkPluginInterface.h
+++ b/ImageLounge/src/DkCore/DkPluginInterface.h
@@ -27,21 +27,21 @@
 
 #pragma once
 
-#include "DkImageContainer.h"
+#include "DkBaseWidgets.h"
 #include "DkBatchInfo.h"
+#include "DkImageContainer.h"
 #include "DkSettings.h"
-#include "DkBaseWidgets.h"
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QStringList>
-#include <QString>
-#include <QImage>
-#include <QGraphicsView>
-#include <QFileInfo>
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QApplication>
+#include <QFileInfo>
+#include <QGraphicsView>
+#include <QImage>
 #include <QMainWindow>
 #include <QSettings>
-#pragma warning(pop)		// no warnings from includes - end
+#include <QString>
+#include <QStringList>
+#pragma warning(pop) // no warnings from includes - end
 
 #ifndef DllCoreExport
 #ifdef DK_CORE_DLL_EXPORT
@@ -53,179 +53,202 @@
 #endif
 #endif
 
-namespace nmc {
+namespace nmc
+{
 
 class DkPluginViewPort;
 
-class DkPluginInterface {
-
+class DkPluginInterface
+{
 public:
+    enum ifTypes {
+        interface_basic = 0,
+        interface_batch,
+        interface_viewport,
 
-	enum ifTypes {
-		interface_basic = 0,
-		interface_batch,
-		interface_viewport,
-
-		inteface_end,
-	};
+        inteface_end,
+    };
 
-	virtual ~DkPluginInterface() {}
+    virtual ~DkPluginInterface()
+    {
+    }
 
     virtual QImage image() const = 0;
 
-	virtual QList<QAction*> createActions(QWidget*) { return QList<QAction*>(); };
-	virtual QList<QAction*> pluginActions()	const { return QList<QAction*>(); };
-	virtual int interfaceType() const { return interface_basic; };
-	virtual bool closesOnImageChange() const { return true; };
-	
-	
-	/// <summary>
-	/// The plugin's compute function.
-	/// NOTE: it needs to be const for we run it with multiple threads.
-	/// </summary>
-	/// <param name="runID">The run identifier.</param>
-	/// <param name="imgC">The image container to be processed.</param>
-	/// <returns>A processed image container</returns>
-	virtual QSharedPointer<DkImageContainer> runPlugin(
-		const QString &runID = QString(), 
-		QSharedPointer<DkImageContainer> imgC = QSharedPointer<DkImageContainer>()) const = 0;
-	
-	QMainWindow* getMainWindow() const {
-
-		QWidgetList widgets = QApplication::topLevelWidgets();
-		QMainWindow* win = 0;
-
-		for (int idx = 0; idx < widgets.size(); idx++) {
-
-			if (widgets.at(idx)->inherits("QMainWindow")) {
-				win = qobject_cast<QMainWindow*>(widgets.at(idx));
-				break;
-			}
-		}
-
-		return win;
-	};
-
+    virtual QList<QAction *> createActions(QWidget *)
+    {
+        return QList<QAction *>();
+    };
+    virtual QList<QAction *> pluginActions() const
+    {
+        return QList<QAction *>();
+    };
+    virtual int interfaceType() const
+    {
+        return interface_basic;
+    };
+    virtual bool closesOnImageChange() const
+    {
+        return true;
+    };
+
+    /// <summary>
+    /// The plugin's compute function.
+    /// NOTE: it needs to be const for we run it with multiple threads.
+    /// </summary>
+    /// <param name="runID">The run identifier.</param>
+    /// <param name="imgC">The image container to be processed.</param>
+    /// <returns>A processed image container</returns>
+    virtual QSharedPointer<DkImageContainer> runPlugin(const QString &runID = QString(),
+                                                       QSharedPointer<DkImageContainer> imgC = QSharedPointer<DkImageContainer>()) const = 0;
+
+    QMainWindow *getMainWindow() const
+    {
+        QWidgetList widgets = QApplication::topLevelWidgets();
+        QMainWindow *win = 0;
+
+        for (int idx = 0; idx < widgets.size(); idx++) {
+            if (widgets.at(idx)->inherits("QMainWindow")) {
+                win = qobject_cast<QMainWindow *>(widgets.at(idx));
+                break;
+            }
+        }
+
+        return win;
+    };
 };
 
-class DkBatchPluginInterface : public DkPluginInterface {
-
+class DkBatchPluginInterface : public DkPluginInterface
+{
 public:
-	virtual int interfaceType() const { return interface_batch; };
-
-	virtual QSharedPointer<DkImageContainer> runPlugin(
-		const QString & runID = QString(),
-		QSharedPointer<DkImageContainer> imgC = QSharedPointer<DkImageContainer>()) const {
-		
-		QSharedPointer<DkBatchInfo> dummy;
-		DkSaveInfo saveInfo;
-
-		if (imgC) {
-			saveInfo.setInputFilePath(imgC->filePath());
-			saveInfo.setOutputFilePath(imgC->filePath());
-			saveInfo.setInputDirIsOutputDir(true);
-		}
-
-		return runPlugin(runID, imgC, saveInfo, dummy);
-	};
-
-	virtual QSharedPointer<DkImageContainer> runPlugin(
-		const QString & runID,
-		QSharedPointer<DkImageContainer> imgC,
-		const DkSaveInfo& saveInfo,
-		QSharedPointer<DkBatchInfo>& batchInfo) const = 0;
-
-	virtual void preLoadPlugin() const = 0;	// is called before batch processing
-	virtual void postLoadPlugin(const QVector<QSharedPointer<DkBatchInfo> > & batchInfo) const = 0;	// is called after batch processing
-
-	virtual QString name() const = 0;	// is needed for settings
-	virtual QString settingsFilePath() const { return DkSettingsManager::param().settingsPath(); };
-	
-	void loadSettings(const QString& settingsPath = "") {
-
-		QString sp = settingsPath.isEmpty() ? settingsFilePath() : settingsPath;
-		QSettings settings(sp, QSettings::IniFormat);
-		loadSettings(settings);
-	};
-	void saveSettings(const QString& settingsPath = "") {
-		QString sp = settingsPath.isEmpty() ? settingsFilePath() : settingsPath;
-		QSettings settings(sp, QSettings::IniFormat);
-		saveSettings(settings);
-	};
-	
-	virtual void loadSettings(QSettings&) {};			// dummy
-	virtual void saveSettings(QSettings&) const {};		// dummy
+    virtual int interfaceType() const
+    {
+        return interface_batch;
+    };
+
+    virtual QSharedPointer<DkImageContainer> runPlugin(const QString &runID = QString(),
+                                                       QSharedPointer<DkImageContainer> imgC = QSharedPointer<DkImageContainer>()) const
+    {
+        QSharedPointer<DkBatchInfo> dummy;
+        DkSaveInfo saveInfo;
+
+        if (imgC) {
+            saveInfo.setInputFilePath(imgC->filePath());
+            saveInfo.setOutputFilePath(imgC->filePath());
+            saveInfo.setInputDirIsOutputDir(true);
+        }
+
+        return runPlugin(runID, imgC, saveInfo, dummy);
+    };
+
+    virtual QSharedPointer<DkImageContainer>
+    runPlugin(const QString &runID, QSharedPointer<DkImageContainer> imgC, const DkSaveInfo &saveInfo, QSharedPointer<DkBatchInfo> &batchInfo) const = 0;
+
+    virtual void preLoadPlugin() const = 0; // is called before batch processing
+    virtual void postLoadPlugin(const QVector<QSharedPointer<DkBatchInfo>> &batchInfo) const = 0; // is called after batch processing
+
+    virtual QString name() const = 0; // is needed for settings
+    virtual QString settingsFilePath() const
+    {
+        return DkSettingsManager::param().settingsPath();
+    };
+
+    void loadSettings(const QString &settingsPath = "")
+    {
+        QString sp = settingsPath.isEmpty() ? settingsFilePath() : settingsPath;
+        QSettings settings(sp, QSettings::IniFormat);
+        loadSettings(settings);
+    };
+    void saveSettings(const QString &settingsPath = "")
+    {
+        QString sp = settingsPath.isEmpty() ? settingsFilePath() : settingsPath;
+        QSettings settings(sp, QSettings::IniFormat);
+        saveSettings(settings);
+    };
+
+    virtual void loadSettings(QSettings &){}; // dummy
+    virtual void saveSettings(QSettings &) const {}; // dummy
 };
 
-class DkViewPortInterface : public DkPluginInterface {
-	
+class DkViewPortInterface : public DkPluginInterface
+{
 public:
-
-	virtual int interfaceType()  const {return interface_viewport;};
-	
-	// return false here if you have a simple viewport (no children)
-	// and you want the user to be able to e.g. scroll thumbs while your plugin is active
-	virtual bool hideHUD() const { return true; };
-
-	virtual bool createViewPort(QWidget* parent) = 0;
-	virtual DkPluginViewPort* getViewPort() = 0;
-
-	virtual void setVisible(bool visible) = 0;
+    virtual int interfaceType() const
+    {
+        return interface_viewport;
+    };
+
+    // return false here if you have a simple viewport (no children)
+    // and you want the user to be able to e.g. scroll thumbs while your plugin is active
+    virtual bool hideHUD() const
+    {
+        return true;
+    };
+
+    virtual bool createViewPort(QWidget *parent) = 0;
+    virtual DkPluginViewPort *getViewPort() = 0;
+
+    virtual void setVisible(bool visible) = 0;
 };
 
-class DllCoreExport DkPluginViewPort : public DkWidget {
-	Q_OBJECT
+class DllCoreExport DkPluginViewPort : public DkWidget
+{
+    Q_OBJECT
 
 public:
-	DkPluginViewPort(QWidget* parent = 0, Qt::WindowFlags flags = Qt::WindowFlags()) : DkWidget(parent, flags) {
-		
-		setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
-		//setStyleSheet("QGraphicsView{background-color: QColor(100,0,0,20); border: 1px solid #FFFFFF;}");
-	};
+    DkPluginViewPort(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags())
+        : DkWidget(parent, flags)
+    {
+        setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+        // setStyleSheet("QGraphicsView{background-color: QColor(100,0,0,20); border: 1px solid #FFFFFF;}");
+    };
 
-	void setWorldMatrix(QTransform* worldMatrix) {
-		mWorldMatrix = worldMatrix;
-	};
+    void setWorldMatrix(QTransform *worldMatrix)
+    {
+        mWorldMatrix = worldMatrix;
+    };
 
-	void setImgMatrix(QTransform* imgMatrix) {
-		mImgMatrix = imgMatrix;
-	};
+    void setImgMatrix(QTransform *imgMatrix)
+    {
+        mImgMatrix = imgMatrix;
+    };
 
-	virtual void updateImageContainer(QSharedPointer<DkImageContainerT> imgC) {	};	// dummy
+    virtual void updateImageContainer(QSharedPointer<DkImageContainerT> imgC){}; // dummy
 
 signals:
-	void closePlugin(bool askForSaving = false) const;
-	void loadFile(const QString& filePath) const;
-	void loadImage(const QImage& image) const;
-	void showInfo(const QString& msg) const;
+    void closePlugin(bool askForSaving = false) const;
+    void loadFile(const QString &filePath) const;
+    void loadImage(const QImage &image) const;
+    void showInfo(const QString &msg) const;
 
 protected:
-	virtual void closeEvent(QCloseEvent *event) {
-		emit closePlugin();
-		QWidget::closeEvent(event);
-	};
+    virtual void closeEvent(QCloseEvent *event)
+    {
+        emit closePlugin();
+        QWidget::closeEvent(event);
+    };
 
-	virtual QPointF mapToImage(const QPointF& pos) const {
-		
-		if (!mWorldMatrix || !mImgMatrix)
-			return pos;
-		
-		QPointF imgPos = mWorldMatrix->inverted().map(pos);
-		imgPos = mImgMatrix->inverted().map(imgPos);
+    virtual QPointF mapToImage(const QPointF &pos) const
+    {
+        if (!mWorldMatrix || !mImgMatrix)
+            return pos;
 
-		return imgPos;
-	};
+        QPointF imgPos = mWorldMatrix->inverted().map(pos);
+        imgPos = mImgMatrix->inverted().map(imgPos);
 
-	virtual QPointF mapToViewport(const QPointF& pos) const {
+        return imgPos;
+    };
 
-		if (!mWorldMatrix)
-			return pos;
+    virtual QPointF mapToViewport(const QPointF &pos) const
+    {
+        if (!mWorldMatrix)
+            return pos;
 
-		return mWorldMatrix->inverted().map(pos);
-	};
+        return mWorldMatrix->inverted().map(pos);
+    };
 
-	QTransform* mWorldMatrix = 0;
-	QTransform* mImgMatrix = 0;
+    QTransform *mWorldMatrix = 0;
+    QTransform *mImgMatrix = 0;
 };
 
 }
diff --git a/ImageLounge/src/DkCore/DkPluginManager.cpp b/ImageLounge/src/DkCore/DkPluginManager.cpp
index a7a180b..8025108 100644
--- a/ImageLounge/src/DkCore/DkPluginManager.cpp
+++ b/ImageLounge/src/DkCore/DkPluginManager.cpp
@@ -26,1471 +26,1480 @@
  *******************************************************************************************************/
 
 #include "DkPluginManager.h"
-#include "DkSettings.h"
 #include "DkActionManager.h"
-#include "DkUpdater.h"
-#include "DkUtils.h"
 #include "DkDependencyResolver.h"
+#include "DkSettings.h"
 #include "DkTimer.h"
+#include "DkUpdater.h"
+#include "DkUtils.h"
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QWidget>
-#include <QSlider>
-#include <QSpinBox>
-#include <QTextEdit>
-#include <QProgressDialog>
-#include <QTabWidget>
-#include <QPluginLoader>
-#include <QHeaderView>
-#include <QSortFilterProxyModel>
-#include <QScrollBar>
-#include <QTableView>
-#include <QXmlStreamReader>
-#include <QVBoxLayout>
-#include <QPushButton>
+#pragma warning(push, 0) // no warnings from includes - begin
+#include <QAction>
 #include <QDebug>
 #include <QDir>
-#include <QSettings>
-#include <QMessageBox>
+#include <QHeaderView>
+#include <QJsonValue>
+#include <QLibraryInfo>
 #include <QLineEdit>
-#include <QSortFilterProxyModel>
+#include <QMenu>
+#include <QMessageBox>
 #include <QMouseEvent>
 #include <QNetworkAccessManager>
-#include <QNetworkRequest>
-#include <QNetworkReply>
 #include <QNetworkProxyFactory>
-#include <QAction>
-#include <QMenu>
-#include <QJsonValue>
-#include <QLibraryInfo>
-#pragma warning(pop)		// no warnings from includes - end
+#include <QNetworkReply>
+#include <QNetworkRequest>
+#include <QPluginLoader>
+#include <QProgressDialog>
+#include <QPushButton>
+#include <QRegularExpression>
+#include <QScrollBar>
+#include <QSettings>
+#include <QSlider>
+#include <QSortFilterProxyModel>
+#include <QSpinBox>
+#include <QTabWidget>
+#include <QTableView>
+#include <QTextEdit>
+#include <QVBoxLayout>
+#include <QWidget>
+#include <QXmlStreamReader>
+#pragma warning(pop) // no warnings from includes - end
 
 #ifdef QT_NO_DEBUG_OUTPUT
-#pragma warning(disable: 4127)		// no 'conditional expression is constant' if qDebug() messages are removed
+#pragma warning(disable : 4127) // no 'conditional expression is constant' if qDebug() messages are removed
 #endif
 
-namespace nmc {
+namespace nmc
+{
 
 // DkLibrary --------------------------------------------------------------------
-DkLibrary::DkLibrary(const QString& name) {
-	mName = name;
+DkLibrary::DkLibrary(const QString &name)
+{
+    mName = name;
 }
 
-QString DkLibrary::fullPath() const {
-	return mFullPath;
+QString DkLibrary::fullPath() const
+{
+    return mFullPath;
 }
 
-QString DkLibrary::name() const {
-	return mName;
+QString DkLibrary::name() const
+{
+    return mName;
 }
 
-bool DkLibrary::isLoaded() const {
-
-	if (mLib)
-		return mLib->isLoaded();
+bool DkLibrary::isLoaded() const
+{
+    if (mLib)
+        return mLib->isLoaded();
 
-	return false;
+    return false;
 }
 
-bool DkLibrary::load() {
-
-	QString suffix;
-	QString prefix;
+bool DkLibrary::load()
+{
+    QString suffix;
+    QString prefix;
 
 #if defined(Q_OS_LINUX) // TODO: add your operating system if libs are prefixed
-	prefix = "lib";
+    prefix = "lib";
 #endif
 
-	mLib = QSharedPointer<QLibrary>(new QLibrary());
-
-	for (const QString& libPath : QCoreApplication::libraryPaths()) {
+    mLib = QSharedPointer<QLibrary>(new QLibrary());
 
-		QString fullPath = libPath + QDir::separator() + prefix + mName + suffix;
-		mLib->setFileName(fullPath);
-		mLib->load();
+    for (const QString &libPath : QCoreApplication::libraryPaths()) {
+        QString fullPath = libPath + QDir::separator() + prefix + mName + suffix;
+        mLib->setFileName(fullPath);
+        mLib->load();
 
-		if (mLib->isLoaded()) {
-			mFullPath = fullPath;
-			break;
-		}
-
-		// just needed for windows dlls
-		if (QFileInfo(fullPath).exists())
-			mFullPath = fullPath;
-	}
+        if (mLib->isLoaded()) {
+            mFullPath = fullPath;
+            break;
+        }
 
-	// if we could find the library but not load it, there is probably a dependency missing...
-	if (!mLib->isLoaded() && !mFullPath.isEmpty()) {
+        // just needed for windows dlls
+        if (QFileInfo(fullPath).exists())
+            mFullPath = fullPath;
+    }
 
-		mDependencies = loadDependencies();
+    // if we could find the library but not load it, there is probably a dependency missing...
+    if (!mLib->isLoaded() && !mFullPath.isEmpty()) {
+        mDependencies = loadDependencies();
 
-		mLib->setFileName(mFullPath);
-		return mLib->load();
-	}
-	else if (!mLib->isLoaded())
-		return false;
+        mLib->setFileName(mFullPath);
+        return mLib->load();
+    } else if (!mLib->isLoaded())
+        return false;
 
-	return true;
+    return true;
 }
 
-bool DkLibrary::uninstall() {
+bool DkLibrary::uninstall()
+{
+    if (mLib)
+        mLib->unload();
 
-	if (mLib)
-		mLib->unload();
-
-	return QFile::remove(fullPath());
+    return QFile::remove(fullPath());
 }
 
-QVector<DkLibrary> DkLibrary::loadDependencies() const {
-	
-	QVector<DkLibrary> dependencies;
-	DkDllDependency d(mFullPath);
+QVector<DkLibrary> DkLibrary::loadDependencies() const
+{
+    QVector<DkLibrary> dependencies;
+    DkDllDependency d(mFullPath);
 
-	if (!d.findDependencies()) {
-		qDebug() << "sorry, but I could not find dependencies of" << mName;
-		return dependencies;
-	}
+    if (!d.findDependencies()) {
+        qDebug() << "sorry, but I could not find dependencies of" << mName;
+        return dependencies;
+    }
 
-	// debug:
-	//qInfo() << name() << "has these dependencies: " << d.dependencies();
-	
-	QStringList fd = d.filteredDependencies();
+    // debug:
+    // qInfo() << name() << "has these dependencies: " << d.dependencies();
 
-	for (const QString& n : fd) {
-		DkLibrary lib(n);
-		if (lib.load()) {
-			dependencies << lib;
-			//qInfo() << lib.name() << "loaded for" << name();
-		}
-		else
-			qWarning() << "could not load" << lib.name() << "which is needed for" << name();
-	}
+    QStringList fd = d.filteredDependencies();
 
-	return dependencies;
+    for (const QString &n : fd) {
+        DkLibrary lib(n);
+        if (lib.load()) {
+            dependencies << lib;
+            // qInfo() << lib.name() << "loaded for" << name();
+        } else
+            qWarning() << "could not load" << lib.name() << "which is needed for" << name();
+    }
+
+    return dependencies;
 }
 
 // DkPluginContainer --------------------------------------------------------------------
-DkPluginContainer::DkPluginContainer(const QString& pluginPath) {
-
-	mPluginPath = pluginPath;
-	mLoader = QSharedPointer<QPluginLoader>(new QPluginLoader(mPluginPath));
-	loadJson();
+DkPluginContainer::DkPluginContainer(const QString &pluginPath)
+{
+    mPluginPath = pluginPath;
+    mLoader = QSharedPointer<QPluginLoader>(new QPluginLoader(mPluginPath));
+    loadJson();
 }
 
-DkPluginContainer::~DkPluginContainer() {
+DkPluginContainer::~DkPluginContainer()
+{
 }
 
-bool operator<(const QSharedPointer<DkPluginContainer>& l, const QSharedPointer<DkPluginContainer>& r) {
+bool operator<(const QSharedPointer<DkPluginContainer> &l, const QSharedPointer<DkPluginContainer> &r)
+{
+    if (!l || !r)
+        return false;
 
-	if (!l || !r)
-		return false;
-
-	return l->pluginName() < r->pluginName();
+    return l->pluginName() < r->pluginName();
 }
 
-void DkPluginContainer::setActive(bool active) {
-	
-	mActive = active;
-
-	DkPluginInterface* p = plugin();
-	if (p && p->interfaceType() == DkPluginInterface::interface_viewport) {
+void DkPluginContainer::setActive(bool active)
+{
+    mActive = active;
 
-		DkViewPortInterface* vPlugin = pluginViewPort();
+    DkPluginInterface *p = plugin();
+    if (p && p->interfaceType() == DkPluginInterface::interface_viewport) {
+        DkViewPortInterface *vPlugin = pluginViewPort();
 
-		if (!vPlugin)
-			return;
+        if (!vPlugin)
+            return;
 
-		vPlugin->setVisible(false);
-	}
+        vPlugin->setVisible(false);
+    }
 }
 
-bool DkPluginContainer::isActive() const {
-	return mActive;
+bool DkPluginContainer::isActive() const
+{
+    return mActive;
 }
 
-bool DkPluginContainer::isLoaded() const {
-	return mLoader->isLoaded();
+bool DkPluginContainer::isLoaded() const
+{
+    return mLoader->isLoaded();
 }
 
-bool DkPluginContainer::load() {
-
-	DkTimer dt;
+bool DkPluginContainer::load()
+{
+    DkTimer dt;
 
-	if (!isValid()) {
-		
-		// inform that we have found a dll that does not fit what we expect
-		if (!mPluginPath.contains("opencv") && !mPluginPath.contains("Read"))
+    if (!isValid()) {
+        // inform that we have found a dll that does not fit what we expect
+        if (!mPluginPath.contains("opencv") && !mPluginPath.contains("Read"))
 #ifdef Q_OS_WIN
-			if (mPluginPath.contains("dll"))
+            if (mPluginPath.contains("dll"))
 #endif
-			qInfo() << "Invalid: " << mPluginPath;
-		return false;
-	}
-	else {
-
-		QString fn = QFileInfo(mLoader->fileName()).fileName();
+                qInfo() << "Invalid: " << mPluginPath;
+        return false;
+    } else {
+        QString fn = QFileInfo(mLoader->fileName()).fileName();
 
 #ifdef Q_OS_WIN
-		// ok - load it's dependencies first
-		DkLibrary l(fn);
-		l.load();
+        // ok - load it's dependencies first
+        DkLibrary l(fn);
+        l.load();
 #endif
 
-		if (!mLoader->load()) {
-			qWarning() << "Could not load:" << fn;
-			qInfo() << "name: " << mPluginName;
-			qInfo() << "modified: " << mDateModified.toString("dd-MM-yyyy");
-			qInfo() << "error: " << mLoader->errorString();
-			return false;
-		}
-	}
-
-	if (pluginViewPort())
-		mType = type_viewport;
-	else if (batchPlugin()) {
-		// load the settings
-		mType = type_batch;
-		batchPlugin()->loadSettings();
-	}
-	else if (plugin())
-		mType = type_simple;
-	else {
-		qWarning() << "could not initialize: " << mPluginPath << "unknown interface";
-		return false;
-	}
+        if (!mLoader->load()) {
+            qWarning() << "Could not load:" << fn;
+            qInfo() << "name: " << mPluginName;
+            qInfo() << "modified: " << mDateModified.toString("dd-MM-yyyy");
+            qInfo() << "error: " << mLoader->errorString();
+            return false;
+        }
+    }
 
-	if (mType != type_unknown) {
-		// init actions
-		plugin()->createActions(DkUtils::getMainWindow());
-		createMenu();
-	}
+    if (pluginViewPort())
+        mType = type_viewport;
+    else if (batchPlugin()) {
+        // load the settings
+        mType = type_batch;
+        batchPlugin()->loadSettings();
+    } else if (plugin())
+        mType = type_simple;
+    else {
+        qWarning() << "could not initialize: " << mPluginPath << "unknown interface";
+        return false;
+    }
 
-	qInfo() << mPluginPath << "loaded in" << dt;
-	return true;
+    if (mType != type_unknown) {
+        // init actions
+        plugin()->createActions(DkUtils::getMainWindow());
+        createMenu();
+    }
 
+    qInfo() << mPluginPath << "loaded in" << dt;
+    return true;
 }
 
-bool DkPluginContainer::uninstall() {
-
-	mLoader->unload();
-	// NOTE: dependencies are not removed yet -> they might be used by other plugins
+bool DkPluginContainer::uninstall()
+{
+    mLoader->unload();
+    // NOTE: dependencies are not removed yet -> they might be used by other plugins
 
-	return QFile::remove(mPluginPath);
+    return QFile::remove(mPluginPath);
 }
 
-void DkPluginContainer::createMenu() {
+void DkPluginContainer::createMenu()
+{
+    DkPluginInterface *p = plugin();
 
-	DkPluginInterface* p = plugin();
+    // empty menu if we do not have any actions
+    if (!p || p->pluginActions().empty())
+        return;
 
-	// empty menu if we do not have any actions
-	if (!p || p->pluginActions().empty())
-		return;
+    mPluginMenu = new QMenu(pluginName(), DkUtils::getMainWindow());
 
-	mPluginMenu = new QMenu(pluginName(), DkUtils::getMainWindow());
-
-	for (auto action : p->pluginActions()) {
-		mPluginMenu->addAction(action);
-		connect(action, SIGNAL(triggered()), this, SLOT(run()), Qt::UniqueConnection);
-	}
+    for (auto action : p->pluginActions()) {
+        mPluginMenu->addAction(action);
+        connect(action, SIGNAL(triggered()), this, SLOT(run()), Qt::UniqueConnection);
+    }
 }
 
-void DkPluginContainer::loadJson() {
-
-	QJsonObject metaData = mLoader->metaData();
-	QStringList keys = metaData.keys();
-
-	for (const QString& key : keys) {
-
-		if (key == "MetaData")
-			loadMetaData(metaData.value(key));
-		else if (key == "IID" && metaData.value(key).toString().contains("com.nomacs.ImageLounge"))
-			mIsValid = true;
-#ifndef _DEBUG	// warn if we have a debug & are not in debug ourselves
-		else if (key == "debug") {
-			bool isDebug = metaData.value(key).toBool();
-			if (isDebug)
-				qWarning() << "I cannot load a debug dll since I am compiled in release!";
-		}
+void DkPluginContainer::loadJson()
+{
+    QJsonObject metaData = mLoader->metaData();
+    QStringList keys = metaData.keys();
+
+    for (const QString &key : keys) {
+        if (key == "MetaData")
+            loadMetaData(metaData.value(key));
+        else if (key == "IID" && metaData.value(key).toString().contains("com.nomacs.ImageLounge"))
+            mIsValid = true;
+#ifndef _DEBUG // warn if we have a debug & are not in debug ourselves
+        else if (key == "debug") {
+            bool isDebug = metaData.value(key).toBool();
+            if (isDebug)
+                qWarning() << "I cannot load a debug dll since I am compiled in release!";
+        }
 #endif
 
-		//qDebug() << key << "|" << metaData.value(key);
-	}
+        // qDebug() << key << "|" << metaData.value(key);
+    }
 }
 
-void DkPluginContainer::loadMetaData(const QJsonValue& val) {
-
-	// we expect something like this...
-	//{
-	//		"PluginName" 	: [ "BinarizationPlugin" ],
-	//		"AuthorName" 	: [ "Markus Diem" ],
-	//		"Company"		: [ "Computer Vision Lab" ],
-	//		"DateCreated" 	: [ "04.02.2016" ],
-	//		"DateModified" 	: [ "04.02.2016" ],
-	//		"Description"	: [ "Document Binarization Plugin" ],
-	//		"StatusTip" 	: [ "Applies e.g. the Su et al. binarzation to an image." ]
-	//}
-
-	QJsonObject metaData = val.toObject();
-	QStringList keys = metaData.keys();
-
-	for (const QString& key : keys) {
-
-		if (key == "PluginName")
-			mPluginName = metaData.value(key).toString();
-		else if (key == "AuthorName")
-			mAuthorName = metaData.value(key).toString();
-		else if (key == "Company")
-			mCompany = metaData.value(key).toString();
-		else if (key == "DateCreated")
-			mDateCreated = QDate::fromString(metaData.value(key).toString(), "yyyy-MM-dd");
-		else if (key == "DateModified")
-			mDateModified = QDate::fromString(metaData.value(key).toString(), "yyyy-MM-dd");
-		else if (key == "Description")
-			mDescription = metaData.value(key).toString();
-		else if (key == "Tagline")
-			mTagline = metaData.value(key).toString();
-		else if (key == "Version")
-			mVersion = metaData.value(key).toString();
-		else if (key == "PluginId") {
-			mId = metaData.value(key).toString();
-		}
-		else
-			qWarning() << "unknown key" << key << "|" << metaData.value(key);
-
-		//qDebug() << "parsing:" << key << "|" << metaData.value(key);
-	}
-
-	if (!isValid() && !keys.empty()) {
-		qWarning() << "invalid plugin - missing the PluginName in the json metadata...";
-	}
+void DkPluginContainer::loadMetaData(const QJsonValue &val)
+{
+    // we expect something like this...
+    //{
+    //		"PluginName" 	: [ "BinarizationPlugin" ],
+    //		"AuthorName" 	: [ "Markus Diem" ],
+    //		"Company"		: [ "Computer Vision Lab" ],
+    //		"DateCreated" 	: [ "04.02.2016" ],
+    //		"DateModified" 	: [ "04.02.2016" ],
+    //		"Description"	: [ "Document Binarization Plugin" ],
+    //		"StatusTip" 	: [ "Applies e.g. the Su et al. binarzation to an image." ]
+    //}
+
+    QJsonObject metaData = val.toObject();
+    QStringList keys = metaData.keys();
+
+    for (const QString &key : keys) {
+        if (key == "PluginName")
+            mPluginName = metaData.value(key).toString();
+        else if (key == "AuthorName")
+            mAuthorName = metaData.value(key).toString();
+        else if (key == "Company")
+            mCompany = metaData.value(key).toString();
+        else if (key == "DateCreated")
+            mDateCreated = QDate::fromString(metaData.value(key).toString(), "yyyy-MM-dd");
+        else if (key == "DateModified")
+            mDateModified = QDate::fromString(metaData.value(key).toString(), "yyyy-MM-dd");
+        else if (key == "Description")
+            mDescription = metaData.value(key).toString();
+        else if (key == "Tagline")
+            mTagline = metaData.value(key).toString();
+        else if (key == "Version")
+            mVersion = metaData.value(key).toString();
+        else if (key == "PluginId") {
+            mId = metaData.value(key).toString();
+        } else
+            qWarning() << "unknown key" << key << "|" << metaData.value(key);
+
+        // qDebug() << "parsing:" << key << "|" << metaData.value(key);
+    }
 
+    if (!isValid() && !keys.empty()) {
+        qWarning() << "invalid plugin - missing the PluginName in the json metadata...";
+    }
 }
 
-void DkPluginContainer::run() {
-
-	DkPluginInterface* p = plugin();
-
-	if (p && p->interfaceType() == DkPluginInterface::interface_viewport) {
+void DkPluginContainer::run()
+{
+    DkPluginInterface *p = plugin();
 
+    if (p && p->interfaceType() == DkPluginInterface::interface_viewport) {
         // init viewport (if no image is there already)
-		emit DkActionManager::instance().pluginActionManager()->showViewPort();
-
-		DkViewPortInterface* vPlugin = pluginViewPort();
-		mActive = true;
+        emit DkActionManager::instance().pluginActionManager()->showViewPort();
 
-		if(!vPlugin)
-			return;
+        DkViewPortInterface *vPlugin = pluginViewPort();
+        mActive = true;
 
-		if (!vPlugin->getViewPort())
-			vPlugin->createViewPort(vPlugin->getMainWindow());
+        if (!vPlugin)
+            return;
 
-		if (!vPlugin->getViewPort()) {
-			qWarning() << "NULL viewport detected in" << mPluginName;
-			return;
-		}
-		
-		vPlugin->setVisible(true);
-		emit runPlugin(vPlugin, false);
-	}
-	else if (p && (p->interfaceType() == DkPluginInterface::interface_basic || p->interfaceType() == DkPluginInterface::interface_batch)) {
+        if (!vPlugin->getViewPort())
+            vPlugin->createViewPort(vPlugin->getMainWindow());
 
-		QAction* a = qobject_cast<QAction*>(QObject::sender());
+        if (!vPlugin->getViewPort()) {
+            qWarning() << "NULL viewport detected in" << mPluginName;
+            return;
+        }
 
-		if (a)
-			emit runPlugin(this, a->data().toString());
-	}
-	else
-		qWarning() << "plugin with illegal interface detected in DkPluginContainer::run()";
+        vPlugin->setVisible(true);
+        emit runPlugin(vPlugin, false);
+    } else if (p && (p->interfaceType() == DkPluginInterface::interface_basic || p->interfaceType() == DkPluginInterface::interface_batch)) {
+        QAction *a = qobject_cast<QAction *>(QObject::sender());
 
+        if (a)
+            emit runPlugin(this, a->data().toString());
+    } else
+        qWarning() << "plugin with illegal interface detected in DkPluginContainer::run()";
 }
 
-bool DkPluginContainer::isValid() const {
-	return mIsValid;
+bool DkPluginContainer::isValid() const
+{
+    return mIsValid;
 }
 
-QString DkPluginContainer::pluginPath() const{
-	return mPluginPath;
+QString DkPluginContainer::pluginPath() const
+{
+    return mPluginPath;
 }
 
-QString DkPluginContainer::pluginName() const {
-	return mPluginName;
+QString DkPluginContainer::pluginName() const
+{
+    return mPluginName;
 }
 
-QString DkPluginContainer::authorName() const {
-	return mAuthorName;
+QString DkPluginContainer::authorName() const
+{
+    return mAuthorName;
 }
 
-QString DkPluginContainer::company() const {
-	return mCompany;
+QString DkPluginContainer::company() const
+{
+    return mCompany;
 }
 
-QString DkPluginContainer::version() const {
-	return mVersion;
+QString DkPluginContainer::version() const
+{
+    return mVersion;
 }
 
-QString DkPluginContainer::description() const {
-	return mDescription;
+QString DkPluginContainer::description() const
+{
+    return mDescription;
 }
 
-QString DkPluginContainer::fullDescription() const {
+QString DkPluginContainer::fullDescription() const
+{
+    QString trAuthor = tr("Author:");
+    QString trCompany = tr("Company:");
+    QString trCreated = tr("Created:");
+    QString trModified = tr("Last Modified:");
 
-	QString trAuthor = tr("Author:");
-	QString trCompany = tr("Company:");
-	QString trCreated = tr("Created:");
-	QString trModified = tr("Last Modified:");
+    QString fs;
 
-	QString fs;
+    fs += "<h3>" + pluginName() + "</h3>";
 
-	fs += "<h3>" + pluginName() + "</h3>";
+    if (!tagline().isEmpty())
+        fs += "<i>" + tagline() + "</i>";
+    fs += "<p>" + mDescription + "</p>";
+    fs += "<b>" + trAuthor + "</b> " + mAuthorName + "<br>";
 
-	if (!tagline().isEmpty())
-		fs += "<i>" + tagline() + "</i>";
-	fs += "<p>" + mDescription + "</p>";
-	fs += "<b>" + trAuthor + "</b> " + mAuthorName + "<br>";
+    if (!company().isEmpty())
+        fs += "<b>" + trCompany + "</b> " + company() + "<br>";
 
-	if (!company().isEmpty())
-		fs += "<b>" + trCompany + "</b> " + company() + "<br>";
+    fs += "<b>" + trCreated + "</b> " + mDateCreated.toString() + "<br>";
+    fs += "<b>" + trModified + "</b> " + mDateModified.toString() + "<br>";
 
-	fs += "<b>" + trCreated		+ "</b> " + mDateCreated.toString(Qt::LocalDate) + "<br>";
-	fs += "<b>" + trModified	+ "</b> " + mDateModified.toString(Qt::LocalDate) + "<br>";
-
-	return fs;
+    return fs;
 }
 
-QString DkPluginContainer::tagline() const {
-	return mTagline;
+QString DkPluginContainer::tagline() const
+{
+    return mTagline;
 }
 
-QString DkPluginContainer::id() const {
-	return mId;
+QString DkPluginContainer::id() const
+{
+    return mId;
 }
 
-QDate DkPluginContainer::dateCreated() const {
-	return mDateCreated;
+QDate DkPluginContainer::dateCreated() const
+{
+    return mDateCreated;
 }
 
-QDate DkPluginContainer::dateModified() const {
-	return mDateModified;
+QDate DkPluginContainer::dateModified() const
+{
+    return mDateModified;
 }
 
-QMenu * DkPluginContainer::pluginMenu() const {
-	return mPluginMenu;
+QMenu *DkPluginContainer::pluginMenu() const
+{
+    return mPluginMenu;
 }
 
-QSharedPointer<QPluginLoader> DkPluginContainer::loader() const {
-	return mLoader;
+QSharedPointer<QPluginLoader> DkPluginContainer::loader() const
+{
+    return mLoader;
 }
 
-DkPluginInterface* DkPluginContainer::plugin() const {
-
-	// is everything fine here??
-	if (!mLoader)
-		return 0;
+DkPluginInterface *DkPluginContainer::plugin() const
+{
+    // is everything fine here??
+    if (!mLoader)
+        return 0;
 
-	DkPluginInterface* pi = qobject_cast<DkPluginInterface*>(mLoader->instance());
+    DkPluginInterface *pi = qobject_cast<DkPluginInterface *>(mLoader->instance());
 
-	if (!pi && pluginViewPort())
-		return pluginViewPort();
-	else if (!pi && batchPlugin())
-		return batchPlugin();
+    if (!pi && pluginViewPort())
+        return pluginViewPort();
+    else if (!pi && batchPlugin())
+        return batchPlugin();
 
-	return pi;
+    return pi;
 }
 
-DkBatchPluginInterface* DkPluginContainer::batchPlugin() const {
+DkBatchPluginInterface *DkPluginContainer::batchPlugin() const
+{
+    // is everything fine here??
+    if (!mLoader)
+        return 0;
 
-	// is everything fine here??
-	if (!mLoader)
-		return 0;
-
-	return qobject_cast<DkBatchPluginInterface*>(mLoader->instance());
+    return qobject_cast<DkBatchPluginInterface *>(mLoader->instance());
 }
 
-DkViewPortInterface* DkPluginContainer::pluginViewPort() const {
-
-	// is everything fine here??
-	if (!mLoader)
-		return 0;
+DkViewPortInterface *DkPluginContainer::pluginViewPort() const
+{
+    // is everything fine here??
+    if (!mLoader)
+        return 0;
 
-	return qobject_cast<DkViewPortInterface*>(mLoader->instance());
+    return qobject_cast<DkViewPortInterface *>(mLoader->instance());
 }
 
-QString DkPluginContainer::actionNameToRunId(const QString & actionName) const {
+QString DkPluginContainer::actionNameToRunId(const QString &actionName) const
+{
+    if (!plugin())
+        return QString();
 
-	if (!plugin())
-		return QString();
-
-	QList<QAction*> actions = plugin()->pluginActions();
-	for (const QAction* a : actions) {
-		if (a->text() == actionName)
-			return a->data().toString();
-	}
+    QList<QAction *> actions = plugin()->pluginActions();
+    for (const QAction *a : actions) {
+        if (a->text() == actionName)
+            return a->data().toString();
+    }
 
-	return QString();
+    return QString();
 }
 
 /**********************************************************************************
-* Plugin manager dialog
-**********************************************************************************/
-DkPluginManagerDialog::DkPluginManagerDialog(QWidget* parent) : QDialog(parent) {
-	init();
+ * Plugin manager dialog
+ **********************************************************************************/
+DkPluginManagerDialog::DkPluginManagerDialog(QWidget *parent)
+    : QDialog(parent)
+{
+    init();
 }
 
-DkPluginManagerDialog::~DkPluginManagerDialog() {}
+DkPluginManagerDialog::~DkPluginManagerDialog()
+{
+}
 
 /**
-* initialize plugin manager dialog - set sizes
+ * initialize plugin manager dialog - set sizes
  **/
-void DkPluginManagerDialog::init() {
+void DkPluginManagerDialog::init()
+{
+    dialogWidth = 700;
+    dialogHeight = 500;
 
-	dialogWidth = 700;
-	dialogHeight = 500;
-
-	setWindowTitle(tr("Plugin Manager"));
-	setMinimumSize(dialogWidth, dialogHeight);
-	createLayout();
+    setWindowTitle(tr("Plugin Manager"));
+    setMinimumSize(dialogWidth, dialogHeight);
+    createLayout();
 }
 
 /*
-* create plugin manager dialog layout
+ * create plugin manager dialog layout
  **/
-void DkPluginManagerDialog::createLayout() {
-
-	tableWidgetInstalled = new DkPluginTableWidget(this);
+void DkPluginManagerDialog::createLayout()
+{
+    tableWidgetInstalled = new DkPluginTableWidget(this);
 
-	QPushButton* buttonClose = new QPushButton(tr("&Close"));
-	connect(buttonClose, SIGNAL(clicked()), this, SLOT(closePressed()));
-	buttonClose->setDefault(true);
+    QPushButton *buttonClose = new QPushButton(tr("&Close"));
+    connect(buttonClose, SIGNAL(clicked()), this, SLOT(closePressed()));
+    buttonClose->setDefault(true);
 
-	QWidget* dummy = new QWidget(this);
-	QHBoxLayout* hLayout = new QHBoxLayout(dummy);
-	hLayout->setAlignment(Qt::AlignRight);
-	hLayout->addWidget(buttonClose);
+    QWidget *dummy = new QWidget(this);
+    QHBoxLayout *hLayout = new QHBoxLayout(dummy);
+    hLayout->setAlignment(Qt::AlignRight);
+    hLayout->addWidget(buttonClose);
 
-
-	QVBoxLayout* layout = new QVBoxLayout(this);
-	layout->addWidget(tableWidgetInstalled);
-	layout->addWidget(dummy);
+    QVBoxLayout *layout = new QVBoxLayout(this);
+    layout->addWidget(tableWidgetInstalled);
+    layout->addWidget(dummy);
 }
 
-
-void DkPluginManagerDialog::closePressed() {
-
-	close();
+void DkPluginManagerDialog::closePressed()
+{
+    close();
 }
 
-void DkPluginManagerDialog::showEvent(QShowEvent* ev) {
-
-	qDebug() << "show event called...";
-	DkPluginManager::instance().loadPlugins();
+void DkPluginManagerDialog::showEvent(QShowEvent *ev)
+{
+    qDebug() << "show event called...";
+    DkPluginManager::instance().loadPlugins();
 
-	tableWidgetInstalled->clearTableFilters();
-	tableWidgetInstalled->updateInstalledModel();
+    tableWidgetInstalled->clearTableFilters();
+    tableWidgetInstalled->updateInstalledModel();
 
-	QDialog::showEvent(ev);
+    QDialog::showEvent(ev);
 }
 
-void DkPluginManagerDialog::deleteInstance(QSharedPointer<DkPluginContainer> plugin) {
-
-	DkPluginManager::instance().removePlugin(plugin);
+void DkPluginManagerDialog::deleteInstance(QSharedPointer<DkPluginContainer> plugin)
+{
+    DkPluginManager::instance().removePlugin(plugin);
 }
 
-QMap<QString, QString> DkPluginManagerDialog::getPreviouslyInstalledPlugins() {
-
-	return previouslyInstalledPlugins;
+QMap<QString, QString> DkPluginManagerDialog::getPreviouslyInstalledPlugins()
+{
+    return previouslyInstalledPlugins;
 }
 
 /**********************************************************************************
  * DkPluginTableWidget : Widget with table views containing plugin data
  **********************************************************************************/
-DkPluginTableWidget::DkPluginTableWidget(QWidget* parent) : DkWidget(parent) {
-
-	createLayout();
-	QMetaObject::connectSlotsByName(this);
+DkPluginTableWidget::DkPluginTableWidget(QWidget *parent)
+    : DkWidget(parent)
+{
+    createLayout();
+    QMetaObject::connectSlotsByName(this);
 }
 
-DkPluginTableWidget::~DkPluginTableWidget() {
+DkPluginTableWidget::~DkPluginTableWidget()
+{
 }
 
 // create the main layout of the plugin manager
-void DkPluginTableWidget::createLayout() {
-
-	// search line edit and update button
-	mFilterEdit = new QLineEdit(this);
-	mFilterEdit->setPlaceholderText(tr("Search plugins"));
-	connect(mFilterEdit, SIGNAL(textChanged(QString)), this, SLOT(filterTextChanged()));
-
-	//QPushButton* updateButton = new QPushButton(tr("Add or Remove Plugins"), this);
-	//updateButton->setObjectName("updateButton");
-	//if (DkSettingsManager::param().isPortable())
-	//	updateButton->hide();
-
-	QWidget* searchWidget = new QWidget(this);
-	QHBoxLayout* sLayout = new QHBoxLayout(searchWidget);
-	sLayout->setContentsMargins(0, 0, 0, 0);
-	sLayout->addWidget(mFilterEdit);
-	//sLayout->addStretch();
-	//sLayout->addWidget(updateButton);
-
-	// main table
+void DkPluginTableWidget::createLayout()
+{
+    // search line edit and update button
+    mFilterEdit = new QLineEdit(this);
+    mFilterEdit->setPlaceholderText(tr("Search plugins"));
+    connect(mFilterEdit, SIGNAL(textChanged(QString)), this, SLOT(filterTextChanged()));
+
+    // QPushButton* updateButton = new QPushButton(tr("Add or Remove Plugins"), this);
+    // updateButton->setObjectName("updateButton");
+    // if (DkSettingsManager::param().isPortable())
+    //	updateButton->hide();
+
+    QWidget *searchWidget = new QWidget(this);
+    QHBoxLayout *sLayout = new QHBoxLayout(searchWidget);
+    sLayout->setContentsMargins(0, 0, 0, 0);
+    sLayout->addWidget(mFilterEdit);
+    // sLayout->addStretch();
+    // sLayout->addWidget(updateButton);
+
+    // main table
     mTableView = new QTableView(this);
-	mProxyModel = new QSortFilterProxyModel(this);
+    mProxyModel = new QSortFilterProxyModel(this);
     mProxyModel->setDynamicSortFilter(true);
 
-	mModel = new DkInstalledPluginsModel(this);
-	mProxyModel->setSourceModel(mModel);
-	mTableView->setModel(mProxyModel);
-	mTableView->resizeColumnsToContents();
-	mTableView->setColumnWidth(ip_column_name, qMax(mTableView->columnWidth(ip_column_name), 300));
-	mTableView->setColumnWidth(ip_column_version, qMax(mTableView->columnWidth(ip_column_version), 80));
+    mModel = new DkInstalledPluginsModel(this);
+    mProxyModel->setSourceModel(mModel);
+    mTableView->setModel(mProxyModel);
+    mTableView->resizeColumnsToContents();
+    mTableView->setColumnWidth(ip_column_name, qMax(mTableView->columnWidth(ip_column_name), 300));
+    mTableView->setColumnWidth(ip_column_version, qMax(mTableView->columnWidth(ip_column_version), 80));
 
-	mTableView->resizeRowsToContents();
+    mTableView->resizeRowsToContents();
     mTableView->horizontalHeader()->setStretchLastSection(true);
     mTableView->setSortingEnabled(true);
-	mTableView->sortByColumn(ip_column_name, Qt::AscendingOrder);
+    mTableView->sortByColumn(ip_column_name, Qt::AscendingOrder);
     mTableView->setSelectionBehavior(QAbstractItemView::SelectRows);
     mTableView->verticalHeader()->hide();
     mTableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
     mTableView->setSelectionMode(QAbstractItemView::SingleSelection);
-	mTableView->setAlternatingRowColors(true);
-
-	if (DkSettingsManager::instance().param().isPortable()) {
-		DkPushButtonDelegate* buttonDelegate = new DkPushButtonDelegate(mTableView);
-		mTableView->setItemDelegateForColumn(ip_column_uninstall, buttonDelegate);
-		connect(buttonDelegate, SIGNAL(buttonClicked(QModelIndex)), this, SLOT(uninstallPlugin(QModelIndex)));
-	}
-
-	DkDescriptionEdit* descriptionEdit = new DkDescriptionEdit(mModel, mProxyModel, mTableView->selectionModel(), this);
-	connect(mTableView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)), descriptionEdit, SLOT(selectionChanged(const QItemSelection &, const QItemSelection &)));
-	connect(mProxyModel, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), descriptionEdit, SLOT(dataChanged(const QModelIndex &, const QModelIndex &)));
-
-	DkDescriptionImage* descriptionImg = new DkDescriptionImage(mModel, mProxyModel, mTableView->selectionModel(), this);
-	connect(mTableView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)), descriptionImg, SLOT(selectionChanged(const QItemSelection &, const QItemSelection &)));
-	connect(mProxyModel, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), descriptionImg, SLOT(dataChanged(const QModelIndex &, const QModelIndex &)));
+    mTableView->setAlternatingRowColors(true);
 
-	QWidget* descWidget = new QWidget(this);
-	QHBoxLayout* dLayout = new QHBoxLayout(descWidget);
-	dLayout->setContentsMargins(0, 0, 0, 0);
-	dLayout->addWidget(descriptionEdit);
-	dLayout->addWidget(descriptionImg);
-
-	QVBoxLayout* layout = new QVBoxLayout(this);
-	layout->addWidget(searchWidget);
-	layout->addWidget(mTableView);
-	layout->addWidget(descWidget);
-}
+    if (DkSettingsManager::instance().param().isPortable()) {
+        DkPushButtonDelegate *buttonDelegate = new DkPushButtonDelegate(mTableView);
+        mTableView->setItemDelegateForColumn(ip_column_uninstall, buttonDelegate);
+        connect(buttonDelegate, SIGNAL(buttonClicked(QModelIndex)), this, SLOT(uninstallPlugin(QModelIndex)));
+    }
 
-//void DkPluginTableWidget::on_updateButton_clicked() {
+    DkDescriptionEdit *descriptionEdit = new DkDescriptionEdit(mModel, mProxyModel, mTableView->selectionModel(), this);
+    connect(mTableView->selectionModel(),
+            SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
+            descriptionEdit,
+            SLOT(selectionChanged(const QItemSelection &, const QItemSelection &)));
+    connect(mProxyModel,
+            SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)),
+            descriptionEdit,
+            SLOT(dataChanged(const QModelIndex &, const QModelIndex &)));
+
+    DkDescriptionImage *descriptionImg = new DkDescriptionImage(mModel, mProxyModel, mTableView->selectionModel(), this);
+    connect(mTableView->selectionModel(),
+            SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
+            descriptionImg,
+            SLOT(selectionChanged(const QItemSelection &, const QItemSelection &)));
+    connect(mProxyModel,
+            SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)),
+            descriptionImg,
+            SLOT(dataChanged(const QModelIndex &, const QModelIndex &)));
+
+    QWidget *descWidget = new QWidget(this);
+    QHBoxLayout *dLayout = new QHBoxLayout(descWidget);
+    dLayout->setContentsMargins(0, 0, 0, 0);
+    dLayout->addWidget(descriptionEdit);
+    dLayout->addWidget(descriptionImg);
+
+    QVBoxLayout *layout = new QVBoxLayout(this);
+    layout->addWidget(searchWidget);
+    layout->addWidget(mTableView);
+    layout->addWidget(descWidget);
+}
+
+// void DkPluginTableWidget::on_updateButton_clicked() {
 //
 //	// TODO!
 //	//DkInstallUpdater::updateNomacs("--manage-packages");
-//}
-
-void DkPluginTableWidget::reloadPlugins() {
+// }
 
-	DkPluginManager::instance().reload();
-	updateInstalledModel();
+void DkPluginTableWidget::reloadPlugins()
+{
+    DkPluginManager::instance().reload();
+    updateInstalledModel();
 }
 
-void DkPluginTableWidget::filterTextChanged() {
-
-	QRegExp regExp(mFilterEdit->text(), Qt::CaseInsensitive, QRegExp::FixedString);
-	mProxyModel->setFilterRegExp(regExp);
-	mTableView->resizeRowsToContents();
+void DkPluginTableWidget::filterTextChanged()
+{
+    QRegularExpression regExp(mFilterEdit->text(), QRegularExpression::CaseInsensitiveOption);
+    mProxyModel->setFilterRegularExpression(regExp);
+    mTableView->resizeRowsToContents();
 }
 
-void DkPluginTableWidget::uninstallPlugin(const QModelIndex &index) {
-
-	int selectedRow = mProxyModel->mapToSource(index).row();
+void DkPluginTableWidget::uninstallPlugin(const QModelIndex &index)
+{
+    int selectedRow = mProxyModel->mapToSource(index).row();
 
-	if (selectedRow < 0 || selectedRow > DkPluginManager::instance().getPlugins().size()) {
-		qWarning() << "illegal row in uninstall plugin: " << selectedRow;
-		return;
-	}
+    if (selectedRow < 0 || selectedRow > DkPluginManager::instance().getPlugins().size()) {
+        qWarning() << "illegal row in uninstall plugin: " << selectedRow;
+        return;
+    }
 
-	QSharedPointer<DkPluginContainer> plugin = DkPluginManager::instance().getPlugins().at(selectedRow);
+    QSharedPointer<DkPluginContainer> plugin = DkPluginManager::instance().getPlugins().at(selectedRow);
 
-	if (!plugin) {
-		qWarning() << "plugin is NULL... aborting uninstall";
-		return;
-	}
+    if (!plugin) {
+        qWarning() << "plugin is NULL... aborting uninstall";
+        return;
+    }
 
-	bool removed = DkPluginManager::instance().deletePlugin(plugin);
+    bool removed = DkPluginManager::instance().deletePlugin(plugin);
 
-	if (!removed)
-		return;
+    if (!removed)
+        return;
 
-	//updateInstalledModel();	// !!! update model before deleting the interface
+    // updateInstalledModel();	// !!! update model before deleting the interface
 
-	mTableView->model()->removeRow(index.row());
-	//emit dataChanged(index, index);
+    mTableView->model()->removeRow(index.row());
+    // emit dataChanged(index, index);
 
-	mTableView->resizeRowsToContents();
+    mTableView->resizeRowsToContents();
 }
 
-void DkPluginTableWidget::clearTableFilters(){
-
-	mFilterEdit->clear();
-	mFilterEdit->setFocus();
+void DkPluginTableWidget::clearTableFilters()
+{
+    mFilterEdit->clear();
+    mFilterEdit->setFocus();
 }
 
-
-//update models if new plugins are installed or copied into the folder
-void DkPluginTableWidget::updateInstalledModel() {
-
-	clearTableFilters();
-	//mTableView->relo;
+// update models if new plugins are installed or copied into the folder
+void DkPluginTableWidget::updateInstalledModel()
+{
+    clearTableFilters();
+    // mTableView->relo;
 }
 
 //**********************************************************************************
-//DkInstalledPluginsModel : Model managing installed plugins data in the table
+// DkInstalledPluginsModel : Model managing installed plugins data in the table
 //**********************************************************************************
-DkInstalledPluginsModel::DkInstalledPluginsModel(QObject *parent) : QAbstractTableModel(parent) {
-
-	mParentTable = static_cast<DkPluginTableWidget*>(parent);
+DkInstalledPluginsModel::DkInstalledPluginsModel(QObject *parent)
+    : QAbstractTableModel(parent)
+{
+    mParentTable = static_cast<DkPluginTableWidget *>(parent);
 }
 
-int DkInstalledPluginsModel::rowCount(const QModelIndex&) const {
-
-	return DkPluginManager::instance().getPlugins().size();
+int DkInstalledPluginsModel::rowCount(const QModelIndex &) const
+{
+    return DkPluginManager::instance().getPlugins().size();
 }
 
-int DkInstalledPluginsModel::columnCount(const QModelIndex&) const {
-
-	return DkSettingsManager::param().isPortable() ? ip_column_size : ip_column_size-1;
+int DkInstalledPluginsModel::columnCount(const QModelIndex &) const
+{
+    return DkSettingsManager::param().isPortable() ? ip_column_size : ip_column_size - 1;
 }
 
-QVariant DkInstalledPluginsModel::data(const QModelIndex &index, int role) const {
-
-	if (!index.isValid()) {
-		return QVariant();
-	}
+QVariant DkInstalledPluginsModel::data(const QModelIndex &index, int role) const
+{
+    if (!index.isValid()) {
+        return QVariant();
+    }
 
-	const QVector<QSharedPointer<DkPluginContainer> >& plugins = DkPluginManager::instance().getPlugins();
+    const QVector<QSharedPointer<DkPluginContainer>> &plugins = DkPluginManager::instance().getPlugins();
 
-	if (index.row() >= plugins.size() || index.row() < 0) {
-		return QVariant();
-	}
+    if (index.row() >= plugins.size() || index.row() < 0) {
+        return QVariant();
+    }
 
     if (role == Qt::DisplayRole) {
-
-		QSharedPointer<DkPluginContainer> plugin = plugins.at(index.row());
+        QSharedPointer<DkPluginContainer> plugin = plugins.at(index.row());
         if (index.column() == ip_column_name) {
-			return plugin->pluginName();
-		}
-        else if (index.column() == ip_column_version) {
-			return plugin->version();
-		}
-		else if (index.column() == ip_column_uninstall)
-			return QString(tr("Uninstall"));
+            return plugin->pluginName();
+        } else if (index.column() == ip_column_version) {
+            return plugin->version();
+        } else if (index.column() == ip_column_uninstall)
+            return QString(tr("Uninstall"));
     }
 
     return QVariant();
 }
 
-QVariant DkInstalledPluginsModel::headerData(int section, Qt::Orientation orientation, int role) const {
-
-    if (role != Qt::DisplayRole) return QVariant();
+QVariant DkInstalledPluginsModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+    if (role != Qt::DisplayRole)
+        return QVariant();
 
     if (orientation == Qt::Horizontal) {
         switch (section) {
-            case ip_column_name:
-                return tr("Name");
-            case ip_column_version:
-                return tr("Version");
-			case ip_column_uninstall:
-				return tr("Uninstall plugin");
-            default:
-                return QVariant();
+        case ip_column_name:
+            return tr("Name");
+        case ip_column_version:
+            return tr("Version");
+        case ip_column_uninstall:
+            return tr("Uninstall plugin");
+        default:
+            return QVariant();
         }
     }
     return QVariant();
 }
 
-Qt::ItemFlags DkInstalledPluginsModel::flags(const QModelIndex &index) const {
-
+Qt::ItemFlags DkInstalledPluginsModel::flags(const QModelIndex &index) const
+{
     if (!index.isValid())
         return Qt::ItemIsEnabled;
 
-	return QAbstractTableModel::flags(index);
+    return QAbstractTableModel::flags(index);
 }
 
-bool DkInstalledPluginsModel::removeRows(int position, int rows, const QModelIndex & index) {
-
-	beginRemoveRows(QModelIndex(), position, position+rows-1);
-	endRemoveRows();
+bool DkInstalledPluginsModel::removeRows(int position, int rows, const QModelIndex &index)
+{
+    beginRemoveRows(QModelIndex(), position, position + rows - 1);
+    endRemoveRows();
 
-	emit dataChanged(index, index);
+    emit dataChanged(index, index);
 
-	return true;
+    return true;
 }
 
-
-void DkInstalledPluginsModel::setDataToInsert(QSharedPointer<DkPluginContainer> newData) {
-
-	mPluginToInsert = newData;
+void DkInstalledPluginsModel::setDataToInsert(QSharedPointer<DkPluginContainer> newData)
+{
+    mPluginToInsert = newData;
 }
 
 //*********************************************************************************
-//DkCheckBoxDelegate : delagete for checkbox only column in the model
+// DkCheckBoxDelegate : delagete for checkbox only column in the model
 //*********************************************************************************
 
-static QRect CheckBoxRect(const QStyleOptionViewItem &viewItemStyleOptions) {
-
-	QStyleOptionButton checkBoxStyleOption;
-	QRect checkBoxRect = QApplication::style()->subElementRect(QStyle::SE_CheckBoxIndicator, &checkBoxStyleOption);
-	QPoint checkBoxPoint(viewItemStyleOptions.rect.x() + viewItemStyleOptions.rect.width() / 2 - checkBoxRect.width() / 2,
+static QRect CheckBoxRect(const QStyleOptionViewItem &viewItemStyleOptions)
+{
+    QStyleOptionButton checkBoxStyleOption;
+    QRect checkBoxRect = QApplication::style()->subElementRect(QStyle::SE_CheckBoxIndicator, &checkBoxStyleOption);
+    QPoint checkBoxPoint(viewItemStyleOptions.rect.x() + viewItemStyleOptions.rect.width() / 2 - checkBoxRect.width() / 2,
                          viewItemStyleOptions.rect.y() + viewItemStyleOptions.rect.height() / 2 - checkBoxRect.height() / 2);
-	return QRect(checkBoxPoint, checkBoxRect.size());
+    return QRect(checkBoxPoint, checkBoxRect.size());
 }
 
-DkPluginCheckBoxDelegate::DkPluginCheckBoxDelegate(QObject *parent) : QStyledItemDelegate(parent) {
-
-	mParentTable = static_cast<QTableView*>(parent);
+DkPluginCheckBoxDelegate::DkPluginCheckBoxDelegate(QObject *parent)
+    : QStyledItemDelegate(parent)
+{
+    mParentTable = static_cast<QTableView *>(parent);
 }
 
-void DkPluginCheckBoxDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const {
-
-	if (option.state & QStyle::State_Selected) {
-		if (mParentTable->hasFocus()) painter->fillRect(option.rect, option.palette.highlight());
-		else  painter->fillRect(option.rect, option.palette.background());
-	}
-	//else if (index.row() % 2 == 1) painter->fillRect(option.rect, option.palette.alternateBase());	// already done automatically
+void DkPluginCheckBoxDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
+{
+    if (option.state & QStyle::State_Selected) {
+        if (mParentTable->hasFocus())
+            painter->fillRect(option.rect, option.palette.highlight());
+        else
+            painter->fillRect(option.rect, option.palette.window());
+    }
+    // else if (index.row() % 2 == 1) painter->fillRect(option.rect, option.palette.alternateBase());	// already done automatically
 
-	bool checked = index.model()->data(index, Qt::DisplayRole).toBool();
+    bool checked = index.model()->data(index, Qt::DisplayRole).toBool();
 
-	QStyleOptionButton checkBoxStyleOption;
-	checkBoxStyleOption.state |= QStyle::State_Enabled;
-	if (checked) {
-		checkBoxStyleOption.state |= QStyle::State_On;
-	} else {
-		checkBoxStyleOption.state |= QStyle::State_Off;
-	}
-	checkBoxStyleOption.rect = CheckBoxRect(option);
+    QStyleOptionButton checkBoxStyleOption;
+    checkBoxStyleOption.state |= QStyle::State_Enabled;
+    if (checked) {
+        checkBoxStyleOption.state |= QStyle::State_On;
+    } else {
+        checkBoxStyleOption.state |= QStyle::State_Off;
+    }
+    checkBoxStyleOption.rect = CheckBoxRect(option);
 
-	QApplication::style()->drawControl(QStyle::CE_CheckBox, &checkBoxStyleOption, painter);
+    QApplication::style()->drawControl(QStyle::CE_CheckBox, &checkBoxStyleOption, painter);
 }
 
-bool DkPluginCheckBoxDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) {
-
-	if ((event->type() == QEvent::MouseButtonRelease) || (event->type() == QEvent::MouseButtonDblClick)) {
-		QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
-		if (mouseEvent->button() != Qt::LeftButton || !CheckBoxRect(option).contains(mouseEvent->pos())) {
-			return false;
-		}
-		if (event->type() == QEvent::MouseButtonDblClick) {
-			return true;
-		}
-	}
-	else if (event->type() == QEvent::KeyPress) {
-		if (static_cast<QKeyEvent*>(event)->key() != Qt::Key_Space && static_cast<QKeyEvent*>(event)->key() != Qt::Key_Select) {
-			return false;
-		}
-	}
-	else return false;
+bool DkPluginCheckBoxDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index)
+{
+    if ((event->type() == QEvent::MouseButtonRelease) || (event->type() == QEvent::MouseButtonDblClick)) {
+        QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
+        if (mouseEvent->button() != Qt::LeftButton || !CheckBoxRect(option).contains(mouseEvent->pos())) {
+            return false;
+        }
+        if (event->type() == QEvent::MouseButtonDblClick) {
+            return true;
+        }
+    } else if (event->type() == QEvent::KeyPress) {
+        if (static_cast<QKeyEvent *>(event)->key() != Qt::Key_Space && static_cast<QKeyEvent *>(event)->key() != Qt::Key_Select) {
+            return false;
+        }
+    } else
+        return false;
 
-	bool checked = index.model()->data(index, Qt::DisplayRole).toBool();
-	return model->setData(index, !checked, Qt::EditRole);
+    bool checked = index.model()->data(index, Qt::DisplayRole).toBool();
+    return model->setData(index, !checked, Qt::EditRole);
 }
 
-
-
 //*********************************************************************************
-//DkPushButtonDelegate : delagete for uninstall column in the model
+// DkPushButtonDelegate : delagete for uninstall column in the model
 //*********************************************************************************
 
-static QRect PushButtonRect(const QStyleOptionViewItem &viewItemStyleOptions) {
-
-
-	QRect pushButtonRect = viewItemStyleOptions.rect;
-	//pushButtonRect.setHeight(pushButtonRect.height() - 2);
-	//pushButtonRect.setWidth(pushButtonRect.width() - 2);
-	QPoint pushButtonPoint(viewItemStyleOptions.rect.x() + viewItemStyleOptions.rect.width() / 2 - pushButtonRect.width() / 2,
-                         viewItemStyleOptions.rect.y() + viewItemStyleOptions.rect.height() / 2 - pushButtonRect.height() / 2);
-	return QRect(pushButtonPoint, pushButtonRect.size());
-}
-
-DkPushButtonDelegate::DkPushButtonDelegate(QObject *parent) : QStyledItemDelegate(parent) {
-
-	mParentTable = static_cast<QTableView*>(parent);
-}
-
-void DkPushButtonDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const {
-
-	if (option.state & QStyle::State_Selected) {
-		if (mParentTable->hasFocus()) painter->fillRect(option.rect, option.palette.highlight());
-		else  painter->fillRect(option.rect, option.palette.background());
-	}
+static QRect PushButtonRect(const QStyleOptionViewItem &viewItemStyleOptions)
+{
+    QRect pushButtonRect = viewItemStyleOptions.rect;
+    // pushButtonRect.setHeight(pushButtonRect.height() - 2);
+    // pushButtonRect.setWidth(pushButtonRect.width() - 2);
+    QPoint pushButtonPoint(viewItemStyleOptions.rect.x() + viewItemStyleOptions.rect.width() / 2 - pushButtonRect.width() / 2,
+                           viewItemStyleOptions.rect.y() + viewItemStyleOptions.rect.height() / 2 - pushButtonRect.height() / 2);
+    return QRect(pushButtonPoint, pushButtonRect.size());
+}
+
+DkPushButtonDelegate::DkPushButtonDelegate(QObject *parent)
+    : QStyledItemDelegate(parent)
+{
+    mParentTable = static_cast<QTableView *>(parent);
+}
+
+void DkPushButtonDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
+{
+    if (option.state & QStyle::State_Selected) {
+        if (mParentTable->hasFocus())
+            painter->fillRect(option.rect, option.palette.highlight());
+        else
+            painter->fillRect(option.rect, option.palette.window());
+    }
 
-	QStyleOptionButton pushButtonStyleOption;
-	pushButtonStyleOption.text = index.model()->data(index, Qt::DisplayRole).toString();
-	if (mCRow == index.row()) pushButtonStyleOption.state = mPushButonState | QStyle::State_Enabled;
-	else pushButtonStyleOption.state = QStyle::State_Enabled;
-	pushButtonStyleOption.rect = PushButtonRect(option);
+    QStyleOptionButton pushButtonStyleOption;
+    pushButtonStyleOption.text = index.model()->data(index, Qt::DisplayRole).toString();
+    if (mCRow == index.row())
+        pushButtonStyleOption.state = mPushButonState | QStyle::State_Enabled;
+    else
+        pushButtonStyleOption.state = QStyle::State_Enabled;
+    pushButtonStyleOption.rect = PushButtonRect(option);
 
-	QApplication::style()->drawControl(QStyle::CE_PushButton, &pushButtonStyleOption, painter);
+    QApplication::style()->drawControl(QStyle::CE_PushButton, &pushButtonStyleOption, painter);
 }
 
-bool DkPushButtonDelegate::editorEvent(QEvent *event, QAbstractItemModel*, const QStyleOptionViewItem &option, const QModelIndex &index) {
-
-	if ((event->type() == QEvent::MouseButtonRelease) || (event->type() == QEvent::MouseButtonPress)) {
-
-		QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
-		if (mouseEvent->button() != Qt::LeftButton || !PushButtonRect(option).contains(mouseEvent->pos())) {
-			mPushButonState = QStyle::State_Raised;
-			return false;
-		}
-	}
-	else if (event->type() == QEvent::KeyPress) {
-		if (static_cast<QKeyEvent*>(event)->key() != Qt::Key_Space && static_cast<QKeyEvent*>(event)->key() != Qt::Key_Select) {
-			mPushButonState = QStyle::State_Raised;
-			return false;
-		}
-	}
-	else {
-		mPushButonState = QStyle::State_Raised;
-		return false;
-	}
+bool DkPushButtonDelegate::editorEvent(QEvent *event, QAbstractItemModel *, const QStyleOptionViewItem &option, const QModelIndex &index)
+{
+    if ((event->type() == QEvent::MouseButtonRelease) || (event->type() == QEvent::MouseButtonPress)) {
+        QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
+        if (mouseEvent->button() != Qt::LeftButton || !PushButtonRect(option).contains(mouseEvent->pos())) {
+            mPushButonState = QStyle::State_Raised;
+            return false;
+        }
+    } else if (event->type() == QEvent::KeyPress) {
+        if (static_cast<QKeyEvent *>(event)->key() != Qt::Key_Space && static_cast<QKeyEvent *>(event)->key() != Qt::Key_Select) {
+            mPushButonState = QStyle::State_Raised;
+            return false;
+        }
+    } else {
+        mPushButonState = QStyle::State_Raised;
+        return false;
+    }
 
-    if(event->type() == QEvent::MouseButtonPress) {
-		mPushButonState = QStyle::State_Sunken;
-		mCRow = index.row();
-	}
-	else if( event->type() == QEvent::MouseButtonRelease) {
-		mPushButonState = QStyle::State_Raised;
+    if (event->type() == QEvent::MouseButtonPress) {
+        mPushButonState = QStyle::State_Sunken;
+        mCRow = index.row();
+    } else if (event->type() == QEvent::MouseButtonRelease) {
+        mPushButonState = QStyle::State_Raised;
         emit buttonClicked(index);
     }
     return true;
-
 }
 
-
 //**********************************************************************************
 // DkDescriptionEdit : text edit connected to tableView selection and models
 //**********************************************************************************
-DkDescriptionEdit::DkDescriptionEdit(QAbstractTableModel* data, QSortFilterProxyModel* proxy, QItemSelectionModel* selection, QWidget *parent) : QTextEdit(parent) {
-
-	mParentTable = static_cast<DkPluginTableWidget*>(parent);
-	mDataModel = data;
-	mProxyModel = proxy;
-	mSelectionModel = selection;
-	setReadOnly(true);
-}
-
-void DkDescriptionEdit::updateText() {
-
-	if (mSelectionModel->selection().indexes().empty()) {
-		setText("");
-		return;
-	}
+DkDescriptionEdit::DkDescriptionEdit(QAbstractTableModel *data, QSortFilterProxyModel *proxy, QItemSelectionModel *selection, QWidget *parent)
+    : QTextEdit(parent)
+{
+    mParentTable = static_cast<DkPluginTableWidget *>(parent);
+    mDataModel = data;
+    mProxyModel = proxy;
+    mSelectionModel = selection;
+    setReadOnly(true);
+}
+
+void DkDescriptionEdit::updateText()
+{
+    if (mSelectionModel->selection().indexes().empty()) {
+        setText("");
+        return;
+    }
 
-	QString text;
-	QModelIndex sourceIndex = mProxyModel->mapToSource(mSelectionModel->selection().indexes().first());
+    QString text;
+    QModelIndex sourceIndex = mProxyModel->mapToSource(mSelectionModel->selection().indexes().first());
 
-	const QVector<QSharedPointer<DkPluginContainer> >& plugins = DkPluginManager::instance().getPlugins();
-	QSharedPointer<DkPluginContainer> plugin = plugins.at(sourceIndex.row());
-	if (plugin)
-		text = plugin->fullDescription();
+    const QVector<QSharedPointer<DkPluginContainer>> &plugins = DkPluginManager::instance().getPlugins();
+    QSharedPointer<DkPluginContainer> plugin = plugins.at(sourceIndex.row());
+    if (plugin)
+        text = plugin->fullDescription();
 
-	if (text.isNull())
-		text = tr("No metadata available!");
-	setText(text);
+    if (text.isNull())
+        text = tr("No metadata available!");
+    setText(text);
 }
 
-void DkDescriptionEdit::dataChanged(const QModelIndex&, const QModelIndex&) {
-
-	updateText();
+void DkDescriptionEdit::dataChanged(const QModelIndex &, const QModelIndex &)
+{
+    updateText();
 }
 
-void DkDescriptionEdit::selectionChanged(const QItemSelection&, const QItemSelection&) {
-
-	updateText();
+void DkDescriptionEdit::selectionChanged(const QItemSelection &, const QItemSelection &)
+{
+    updateText();
 }
 
-
 //**********************************************************************************
-//DkDescriptionImage : image label connected to tableView selection and models
+// DkDescriptionImage : image label connected to tableView selection and models
 //**********************************************************************************
 
-DkDescriptionImage::DkDescriptionImage(QAbstractTableModel* data, QSortFilterProxyModel* proxy, QItemSelectionModel* selection, QWidget *parent) : QLabel(parent) {
-
-	mParentTable = static_cast<DkPluginTableWidget*>(parent);
-	mDataModel = data;
-	mProxyModel = proxy;
-	mSelectionModel = selection;
-	mDefaultImage = QPixmap(":/nomacs/img/plugin-banner.svg");
-	setPixmap(mDefaultImage);
+DkDescriptionImage::DkDescriptionImage(QAbstractTableModel *data, QSortFilterProxyModel *proxy, QItemSelectionModel *selection, QWidget *parent)
+    : QLabel(parent)
+{
+    mParentTable = static_cast<DkPluginTableWidget *>(parent);
+    mDataModel = data;
+    mProxyModel = proxy;
+    mSelectionModel = selection;
+    mDefaultImage = QPixmap(":/nomacs/img/plugin-banner.svg");
+    setPixmap(mDefaultImage);
+}
+
+void DkDescriptionImage::updateImage()
+{
+    switch (mSelectionModel->selection().indexes().count()) {
+    case 0:
+        setPixmap(mDefaultImage);
+        break;
+    default:
+        QModelIndex sourceIndex = mProxyModel->mapToSource(mSelectionModel->selection().indexes().first());
+        QImage img;
+        const QVector<QSharedPointer<DkPluginContainer>> &plugins = DkPluginManager::instance().getPlugins();
+        QSharedPointer<DkPluginContainer> plugin = plugins.at(sourceIndex.row());
+
+        if (plugin && plugin->plugin())
+            img = plugin->plugin()->image();
+        if (!img.isNull())
+            setPixmap(QPixmap::fromImage(img));
+        else
+            setPixmap(mDefaultImage);
+        break;
+    }
 }
 
-void DkDescriptionImage::updateImage() {
-
-	switch(mSelectionModel->selection().indexes().count())
-	{
-		case 0:
-			setPixmap(mDefaultImage);
-			break;
-		default:
-			QModelIndex sourceIndex = mProxyModel->mapToSource(mSelectionModel->selection().indexes().first());
-			QImage img;
-			const QVector<QSharedPointer<DkPluginContainer> >& plugins = DkPluginManager::instance().getPlugins();
-			QSharedPointer<DkPluginContainer> plugin = plugins.at(sourceIndex.row());
-
-			if (plugin && plugin->plugin())
-				img = plugin->plugin()->image();
-			if (!img.isNull())
-				setPixmap(QPixmap::fromImage(img));
-			else
-				setPixmap(mDefaultImage);
-			break;
-	}
+void DkDescriptionImage::dataChanged(const QModelIndex &, const QModelIndex &)
+{
+    updateImage();
 }
 
-void DkDescriptionImage::dataChanged(const QModelIndex&, const QModelIndex&) {
-
-	updateImage();
-}
-
-void DkDescriptionImage::selectionChanged(const QItemSelection&, const QItemSelection&) {
-
-	updateImage();
+void DkDescriptionImage::selectionChanged(const QItemSelection &, const QItemSelection &)
+{
+    updateImage();
 }
 
 // DkPluginManager --------------------------------------------------------------------
-DkPluginManager & DkPluginManager::instance() {
-
-	static DkPluginManager inst;
-	return inst;
+DkPluginManager &DkPluginManager::instance()
+{
+    static DkPluginManager inst;
+    return inst;
 }
 
-DkPluginManager::DkPluginManager() {
-
-	//loadPlugins();
+DkPluginManager::DkPluginManager()
+{
+    // loadPlugins();
 }
 
-DkPluginManager::~DkPluginManager() {
+DkPluginManager::~DkPluginManager()
+{
 }
 
-//returns map with id and interface
-QVector<QSharedPointer<DkPluginContainer> >  DkPluginManager::getPlugins() const {
-
-	return mPlugins;
+// returns map with id and interface
+QVector<QSharedPointer<DkPluginContainer>> DkPluginManager::getPlugins() const
+{
+    return mPlugins;
 }
 
-void DkPluginManager::reload() {
-	clear();
-	loadPlugins();
+void DkPluginManager::reload()
+{
+    clear();
+    loadPlugins();
 }
 
-void DkPluginManager::removePlugin(QSharedPointer<DkPluginContainer> plugin) {
-
-	if (plugin)
-		mPlugins.remove(mPlugins.indexOf(plugin));
-	else
-		qWarning() << "Could not delete plugin - it is NULL";
-
+void DkPluginManager::removePlugin(QSharedPointer<DkPluginContainer> plugin)
+{
+    if (plugin)
+        mPlugins.remove(mPlugins.indexOf(plugin));
+    else
+        qWarning() << "Could not delete plugin - it is NULL";
 }
 
-bool DkPluginManager::deletePlugin(QSharedPointer<DkPluginContainer> plugin) {
-
-	if (plugin) {
+bool DkPluginManager::deletePlugin(QSharedPointer<DkPluginContainer> plugin)
+{
+    if (plugin) {
+        mPlugins.remove(mPlugins.indexOf(plugin));
 
-		mPlugins.remove(mPlugins.indexOf(plugin));
-
-		if (!plugin->uninstall()) {
-			qDebug() << "Failed to delete plugin file!";
-			QMessageBox::critical(
-				DkUtils::getMainWindow(), 
-				QObject::tr("Plugin Manager"), 
-				QObject::tr("The dll could not be deleted!\nPlease restart nomacs and try again."));
-			return false;
-		}
-		else
-			return true;
-	}
+        if (!plugin->uninstall()) {
+            qDebug() << "Failed to delete plugin file!";
+            QMessageBox::critical(DkUtils::getMainWindow(),
+                                  QObject::tr("Plugin Manager"),
+                                  QObject::tr("The dll could not be deleted!\nPlease restart nomacs and try again."));
+            return false;
+        } else
+            return true;
+    }
 
-	return false;
+    return false;
 }
 
-void DkPluginManager::clear() {
-	mPlugins.clear();
+void DkPluginManager::clear()
+{
+    mPlugins.clear();
 }
 
-//Loads enabled plugins (i.e. when the menu is first hit)
-void DkPluginManager::loadPlugins() {
-
-	//// DEBUG --------------------------------------------------------------------
-	//nmc::DkDependencyWalker dw("C:/VSProjects/READ/nomacs/build2015-x64/Debug/plugins/writerIdentificationPlugin.dll");
-	//if (!dw.findDependencies())
-	//	qWarning() << "could not find dependencies for" << dw.filePath();
-
-	//qDebug() << "all dependencies:" << dw.dependencies();
-	//qDebug() << "filtered dependencies:" << dw.filteredDependencies();
+// Loads enabled plugins (i.e. when the menu is first hit)
+void DkPluginManager::loadPlugins()
+{
+    //// DEBUG --------------------------------------------------------------------
+    // nmc::DkDependencyWalker dw("C:/VSProjects/READ/nomacs/build2015-x64/Debug/plugins/writerIdentificationPlugin.dll");
+    // if (!dw.findDependencies())
+    //	qWarning() << "could not find dependencies for" << dw.filePath();
 
-	//return 0;
-	//// DEBUG --------------------------------------------------------------------
+    // qDebug() << "all dependencies:" << dw.dependencies();
+    // qDebug() << "filtered dependencies:" << dw.filteredDependencies();
 
-	// do not load twice
-	if (!mPlugins.empty())
-		return;
+    // return 0;
+    //// DEBUG --------------------------------------------------------------------
 
-	DkTimer dt;
+    // do not load twice
+    if (!mPlugins.empty())
+        return;
 
-	QStringList loadedPluginFileNames = QStringList();
-	QStringList libPaths = QCoreApplication::libraryPaths();
-	libPaths.append(QCoreApplication::applicationDirPath() + "/plugins");
+    DkTimer dt;
 
-	for (const QString& cPath : libPaths) {
+    QStringList loadedPluginFileNames = QStringList();
+    QStringList libPaths = QCoreApplication::libraryPaths();
+    libPaths.append(QCoreApplication::applicationDirPath() + "/plugins");
 
-		// skip the nomacs dir
-		if (cPath == QApplication::applicationDirPath())
-			continue;
+    for (const QString &cPath : libPaths) {
+        // skip the nomacs dir
+        if (cPath == QApplication::applicationDirPath())
+            continue;
 
-		// skip image plugins
-		if (cPath.contains("imageformats"))
-			continue;
+        // skip image plugins
+        if (cPath.contains("imageformats"))
+            continue;
 
-		QDir pluginsDir(cPath);
+        QDir pluginsDir(cPath);
 
-		for (const QString& fileName : pluginsDir.entryList(QDir::Files)) {
-			DkTimer dtt;
+        for (const QString &fileName : pluginsDir.entryList(QDir::Files)) {
+            DkTimer dtt;
 #ifdef Q_OS_LINUX
-			// needed because of symbolic links of sonames
-			QFileInfo file(pluginsDir.absoluteFilePath(fileName));
-			if(file.isSymLink())
-				continue;
+            // needed because of symbolic links of sonames
+            QFileInfo file(pluginsDir.absoluteFilePath(fileName));
+            if (file.isSymLink())
+                continue;
 #elif defined(Q_OS_WIN)
-			if (!fileName.contains(".dll"))
-				continue;
+            if (!fileName.contains(".dll"))
+                continue;
 
 #endif
-			QString shortFileName = fileName.split("/").last();
-			if (!loadedPluginFileNames.contains(shortFileName)) { // prevent double loading of the same plugin
-				if (singlePluginLoad(pluginsDir.absoluteFilePath(fileName)))
-					loadedPluginFileNames.append(shortFileName);
-			}
-			//else
-			//	qDebug() << "rejected since it is twice: " << shortFileName;
-		}
-	}
+            QString shortFileName = fileName.split("/").last();
+            if (!loadedPluginFileNames.contains(shortFileName)) { // prevent double loading of the same plugin
+                if (singlePluginLoad(pluginsDir.absoluteFilePath(fileName)))
+                    loadedPluginFileNames.append(shortFileName);
+            }
+            // else
+            //	qDebug() << "rejected since it is twice: " << shortFileName;
+        }
+    }
 
-	qSort(mPlugins.begin(), mPlugins.end());// , &DkPluginContainer::operator<);
-	qInfo() << mPlugins.size() << "plugins loaded in" << dt;
+    std::sort(mPlugins.begin(), mPlugins.end()); // , &DkPluginContainer::operator<);
+    qInfo() << mPlugins.size() << "plugins loaded in" << dt;
 
-	if (mPlugins.empty())
-		qInfo() << "I was searching these paths" << libPaths;
+    if (mPlugins.empty())
+        qInfo() << "I was searching these paths" << libPaths;
 }
 
 /**
-* Loads one plugin from file fileName
-* @param fileName
-**/
-bool DkPluginManager::singlePluginLoad(const QString& filePath) {
-
-	if (isBlackListed(filePath))
-		return false;
+ * Loads one plugin from file fileName
+ * @param fileName
+ **/
+bool DkPluginManager::singlePluginLoad(const QString &filePath)
+{
+    if (isBlackListed(filePath))
+        return false;
 
-	DkTimer dt;
-	QSharedPointer<DkPluginContainer> plugin = QSharedPointer<DkPluginContainer>(new DkPluginContainer(filePath));
-	if (plugin->load())
-		mPlugins.append(plugin);
+    DkTimer dt;
+    QSharedPointer<DkPluginContainer> plugin = QSharedPointer<DkPluginContainer>(new DkPluginContainer(filePath));
+    if (plugin->load())
+        mPlugins.append(plugin);
 
-	return plugin->isLoaded();
+    return plugin->isLoaded();
 }
 
-QSharedPointer<DkPluginContainer> DkPluginManager::getPluginByName(const QString & pluginName) const {
-
-	for (auto p : mPlugins) {
-
-		if (p && pluginName == p->pluginName())
-			return p;
-	}
+QSharedPointer<DkPluginContainer> DkPluginManager::getPluginByName(const QString &pluginName) const
+{
+    for (auto p : mPlugins) {
+        if (p && pluginName == p->pluginName())
+            return p;
+    }
 
-	return QSharedPointer<DkPluginContainer>();
+    return QSharedPointer<DkPluginContainer>();
 }
 
-QSharedPointer<DkPluginContainer> DkPluginManager::getPluginByPath(const QString & path) const {
-
-	for (auto p : mPlugins) {
-
-		if (p && path == p->pluginPath())
-			return p;
-	}
+QSharedPointer<DkPluginContainer> DkPluginManager::getPluginByPath(const QString &path) const
+{
+    for (auto p : mPlugins) {
+        if (p && path == p->pluginPath())
+            return p;
+    }
 
-	return QSharedPointer<DkPluginContainer>();
+    return QSharedPointer<DkPluginContainer>();
 }
 
-QVector<QSharedPointer<DkPluginContainer> > DkPluginManager::getBasicPlugins() const {
-
-	QVector<QSharedPointer<DkPluginContainer> > plugins;
-
-	for (auto plugin : mPlugins) {
+QVector<QSharedPointer<DkPluginContainer>> DkPluginManager::getBasicPlugins() const
+{
+    QVector<QSharedPointer<DkPluginContainer>> plugins;
 
-		DkPluginInterface* p = plugin->plugin();
+    for (auto plugin : mPlugins) {
+        DkPluginInterface *p = plugin->plugin();
 
-		if (p && p->interfaceType() == DkPluginInterface::interface_basic) {
-			plugins.append(plugin);
-		}
-	}
+        if (p && p->interfaceType() == DkPluginInterface::interface_basic) {
+            plugins.append(plugin);
+        }
+    }
 
-	return plugins;
+    return plugins;
 }
 
-QVector<QSharedPointer<DkPluginContainer> > DkPluginManager::getBatchPlugins() const {
-
-	QVector<QSharedPointer<DkPluginContainer> > plugins;
-
-	for (auto plugin : mPlugins) {
+QVector<QSharedPointer<DkPluginContainer>> DkPluginManager::getBatchPlugins() const
+{
+    QVector<QSharedPointer<DkPluginContainer>> plugins;
 
-		DkPluginInterface* p = plugin->plugin();
+    for (auto plugin : mPlugins) {
+        DkPluginInterface *p = plugin->plugin();
 
-		if (p &&
-			(p->interfaceType() == DkPluginInterface::interface_basic ||
-			 p->interfaceType() == DkPluginInterface::interface_batch)) {
-			plugins.append(plugin);
-		}
-	}
+        if (p && (p->interfaceType() == DkPluginInterface::interface_basic || p->interfaceType() == DkPluginInterface::interface_batch)) {
+            plugins.append(plugin);
+        }
+    }
 
-	return plugins;
+    return plugins;
 }
 
-QSharedPointer<DkPluginContainer> DkPluginManager::getRunningPlugin() const {
-
-	for (auto plugin : mPlugins) {
-		if (plugin->isActive())
-			return plugin;
-	}
+QSharedPointer<DkPluginContainer> DkPluginManager::getRunningPlugin() const
+{
+    for (auto plugin : mPlugins) {
+        if (plugin->isActive())
+            return plugin;
+    }
 
-	return QSharedPointer<DkPluginContainer>();
+    return QSharedPointer<DkPluginContainer>();
 }
 
-void DkPluginManager::clearRunningPlugin() {
-
-	for (auto plugin : mPlugins)
-		plugin->setActive(false);
+void DkPluginManager::clearRunningPlugin()
+{
+    for (auto plugin : mPlugins)
+        plugin->setActive(false);
 }
 
-void DkPluginManager::runPlugin(QSharedPointer<DkPluginContainer> plugin) {
-
-	if (getRunningPlugin()) {
+void DkPluginManager::runPlugin(QSharedPointer<DkPluginContainer> plugin)
+{
+    if (getRunningPlugin()) {
+        // the plugin is not closed in time
+        QMessageBox infoDialog(DkUtils::getMainWindow());
+        infoDialog.setWindowTitle(QObject::tr("Close plugin"));
+        infoDialog.setIcon(QMessageBox::Information);
+        infoDialog.setText(QObject::tr("Please close the currently opened plugin."));
+        infoDialog.show();
 
-		// the plugin is not closed in time
-		QMessageBox infoDialog(DkUtils::getMainWindow());
-		infoDialog.setWindowTitle(QObject::tr("Close plugin"));
-		infoDialog.setIcon(QMessageBox::Information);
-		infoDialog.setText(QObject::tr("Please close the currently opened plugin."));
-		infoDialog.show();
+        infoDialog.exec();
 
-		infoDialog.exec();
-
-		//TODO: dialog with yes/no - unload plugin if user wants to
-	}
+        // TODO: dialog with yes/no - unload plugin if user wants to
+    }
 
-	plugin->setActive();
+    plugin->setActive();
 }
 
-bool DkPluginManager::isBlackListed(const QString & pluginPath) const {
+bool DkPluginManager::isBlackListed(const QString &pluginPath) const
+{
+    QString fileName = QFileInfo(pluginPath).fileName();
 
-	QString fileName = QFileInfo(pluginPath).fileName();
+    for (const QString &filter : blackList())
+        if (pluginPath.contains(filter))
+            return true;
 
-	for (const QString& filter : blackList())
-		if (pluginPath.contains(filter))
-			return true;
-
-	return false;
+    return false;
 }
 
-QStringList DkPluginManager::blackList() {
-	return QStringList() << "opencv";
+QStringList DkPluginManager::blackList()
+{
+    return QStringList() << "opencv";
 }
 
-void DkPluginManager::createPluginsPath() {
-
+void DkPluginManager::createPluginsPath()
+{
 #ifdef WITH_PLUGINS
-	// initialize plugin paths -----------------------------------------
+    // initialize plugin paths -----------------------------------------
 #ifdef Q_OS_WIN
-	QDir pluginsDir = QCoreApplication::applicationDirPath() + "/plugins";
+    QDir pluginsDir = QCoreApplication::applicationDirPath() + "/plugins";
 #else
-	QDir pluginsDir = QLibraryInfo::location(QLibraryInfo::LibrariesPath) +  "/nomacs-plugins/";
+    QDir pluginsDir = QLibraryInfo::location(QLibraryInfo::LibrariesPath) + "/nomacs-plugins/";
 #endif // Q_OS_WIN
 
-	if (!pluginsDir.exists())
-		pluginsDir.mkpath(pluginsDir.absolutePath());
+    if (!pluginsDir.exists())
+        pluginsDir.mkpath(pluginsDir.absolutePath());
 
-	nmc::DkSettingsManager::param().global().pluginsDir = pluginsDir.absolutePath();
-	qInfo() << "plugins dir set to: " << nmc::DkSettingsManager::param().global().pluginsDir;
+    nmc::DkSettingsManager::param().global().pluginsDir = pluginsDir.absolutePath();
+    qInfo() << "plugins dir set to: " << nmc::DkSettingsManager::param().global().pluginsDir;
 
-	QCoreApplication::addLibraryPath(nmc::DkSettingsManager::param().global().pluginsDir);
-	QCoreApplication::addLibraryPath("./imageformats");
+    QCoreApplication::addLibraryPath(nmc::DkSettingsManager::param().global().pluginsDir);
+    QCoreApplication::addLibraryPath("./imageformats");
 
 #endif // WITH_PLUGINS
 }
 
 // DkPluginActionManager --------------------------------------------------------------------
-DkPluginActionManager::DkPluginActionManager(QObject* parent) : QObject(parent) {
-
-	assignCustomPluginShortcuts();
-}
-
-void DkPluginActionManager::assignCustomPluginShortcuts() {
-
-	DefaultSettings settings;
-	settings.beginGroup("CustomPluginShortcuts");
-	QStringList psKeys = settings.allKeys();
-	settings.endGroup();
-
-	if (psKeys.size() > 0) {
-
-		settings.beginGroup("CustomShortcuts");
-
-		mPluginDummyActions = QVector<QAction *>();
-
-		for (int i = 0; i< psKeys.size(); i++) {
-
-			QAction* action = new QAction(psKeys.at(i), this);
-			QString val = settings.value(psKeys.at(i), "no-shortcut").toString();
-			if (val != "no-shortcut")
-				action->setShortcut(val);
-			connect(action, SIGNAL(triggered()), this, SLOT(runPluginFromShortcut()));
-			// assign widget shortcuts to all of them
-			action->setShortcutContext(Qt::WidgetWithChildrenShortcut);
-			mPluginDummyActions.append(action);
-		}
+DkPluginActionManager::DkPluginActionManager(QObject *parent)
+    : QObject(parent)
+{
+    assignCustomPluginShortcuts();
+}
+
+void DkPluginActionManager::assignCustomPluginShortcuts()
+{
+    DefaultSettings settings;
+    settings.beginGroup("CustomPluginShortcuts");
+    QStringList psKeys = settings.allKeys();
+    settings.endGroup();
+
+    if (psKeys.size() > 0) {
+        settings.beginGroup("CustomShortcuts");
+
+        mPluginDummyActions = QVector<QAction *>();
+
+        for (int i = 0; i < psKeys.size(); i++) {
+            QAction *action = new QAction(psKeys.at(i), this);
+            QString val = settings.value(psKeys.at(i), "no-shortcut").toString();
+            if (val != "no-shortcut")
+                action->setShortcut(val);
+            connect(action, SIGNAL(triggered()), this, SLOT(runPluginFromShortcut()));
+            // assign widget shortcuts to all of them
+            action->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+            mPluginDummyActions.append(action);
+        }
 
-		settings.endGroup();
-	}
+        settings.endGroup();
+    }
 }
 
-void DkPluginActionManager::setMenu(QMenu* menu) {
-	mMenu = menu;
-	connect(mMenu, SIGNAL(aboutToShow()), this, SLOT(updateMenu()));
+void DkPluginActionManager::setMenu(QMenu *menu)
+{
+    mMenu = menu;
+    connect(mMenu, SIGNAL(aboutToShow()), this, SLOT(updateMenu()));
 }
 
-QMenu* DkPluginActionManager::menu() const {
-	return mMenu;
+QMenu *DkPluginActionManager::menu() const
+{
+    return mMenu;
 }
 
-QVector<QAction*> DkPluginActionManager::pluginDummyActions() const {
-	return mPluginDummyActions;
+QVector<QAction *> DkPluginActionManager::pluginDummyActions() const
+{
+    return mPluginDummyActions;
 }
 
-QVector<QAction*> DkPluginActionManager::pluginActions() const {
-	return mPluginActions;
+QVector<QAction *> DkPluginActionManager::pluginActions() const
+{
+    return mPluginActions;
 }
 
-QVector<QMenu*> DkPluginActionManager::pluginSubMenus() const {
-	return mPluginSubMenus;
+QVector<QMenu *> DkPluginActionManager::pluginSubMenus() const
+{
+    return mPluginSubMenus;
 }
 
-void DkPluginActionManager::updateMenu() {
-	qDebug() << "CREATING plugin menu";
-
-	if (!mMenu) {
-		qWarning() << "plugin menu is NULL where it should not be!";
-	}
-
-	DkPluginManager::instance().loadPlugins();
-	QVector<QSharedPointer<DkPluginContainer> > plugins = DkPluginManager::instance().getPlugins();
+void DkPluginActionManager::updateMenu()
+{
+    qDebug() << "CREATING plugin menu";
 
-	if (plugins.empty()) {
-		//mPluginActions.resize(DkActionManager::menu_plugins_end);
-		mPluginActions = DkActionManager::instance().pluginActions();
-	}
-	mMenu->clear();
+    if (!mMenu) {
+        qWarning() << "plugin menu is NULL where it should not be!";
+    }
 
-	for (auto p : plugins) {
-		connect(p.data(), SIGNAL(runPlugin(DkViewPortInterface*, bool)), this, SIGNAL(runPlugin(DkViewPortInterface*, bool)), Qt::UniqueConnection);
-		connect(p.data(), SIGNAL(runPlugin(DkPluginContainer*, const QString&)), this, SIGNAL(runPlugin(DkPluginContainer*, const QString&)), Qt::UniqueConnection);
-	}
+    DkPluginManager::instance().loadPlugins();
+    QVector<QSharedPointer<DkPluginContainer>> plugins = DkPluginManager::instance().getPlugins();
 
-	if (plugins.isEmpty()) { // no  plugins
-		mMenu->addAction(mPluginActions[DkActionManager::menu_plugin_manager]);
-		mPluginActions.resize(DkActionManager::menu_plugin_manager);		// reduce the size again
-	}
-	else {
-		// delete old plugin actions
-		for (int idx = mPluginActions.size(); idx > DkActionManager::menu_plugins_end; idx--) {
-			mPluginActions.pop_back();
-		}
-		addPluginsToMenu();
-	}
+    if (plugins.empty()) {
+        // mPluginActions.resize(DkActionManager::menu_plugins_end);
+        mPluginActions = DkActionManager::instance().pluginActions();
+    }
+    mMenu->clear();
+
+    for (auto p : plugins) {
+        connect(p.data(), SIGNAL(runPlugin(DkViewPortInterface *, bool)), this, SIGNAL(runPlugin(DkViewPortInterface *, bool)), Qt::UniqueConnection);
+        connect(p.data(),
+                SIGNAL(runPlugin(DkPluginContainer *, const QString &)),
+                this,
+                SIGNAL(runPlugin(DkPluginContainer *, const QString &)),
+                Qt::UniqueConnection);
+    }
 
+    if (plugins.isEmpty()) { // no  plugins
+        mMenu->addAction(mPluginActions[DkActionManager::menu_plugin_manager]);
+        mPluginActions.resize(DkActionManager::menu_plugin_manager); // reduce the size again
+    } else {
+        // delete old plugin actions
+        for (int idx = mPluginActions.size(); idx > DkActionManager::menu_plugins_end; idx--) {
+            mPluginActions.pop_back();
+        }
+        addPluginsToMenu();
+    }
 }
 
 /**
-* Creates the plugin menu when it is not empty
-* called in DkNoMacs::createPluginsMenu()
-**/
-void DkPluginActionManager::addPluginsToMenu() {
-
- 	QVector<QSharedPointer<DkPluginContainer> > loadedPlugins = DkPluginManager::instance().getPlugins();
-	qSort(loadedPlugins);
-
-	mPluginSubMenus.clear();
-
-	QStringList pluginMenu = QStringList();
-
-	for (auto plugin : loadedPlugins) {
-
-		DkPluginInterface* pi = plugin->plugin();
-
-		if (pi && plugin->pluginMenu()) {
-			QList<QAction*> actions = pi->createActions(DkUtils::getMainWindow());
-			mPluginSubMenus.append(plugin->pluginMenu());
-			mMenu->addMenu(plugin->pluginMenu());
-		}
-		else if (pi) {
-			QAction* a = new QAction(plugin->pluginName(), this);
-			a->setData(plugin->id());
-			mPluginActions.append(a);
-			mMenu->addAction(a);
-			connect(a, SIGNAL(triggered()), plugin.data(), SLOT(run()));
-		}
-	}
+ * Creates the plugin menu when it is not empty
+ * called in DkNoMacs::createPluginsMenu()
+ **/
+void DkPluginActionManager::addPluginsToMenu()
+{
+    QVector<QSharedPointer<DkPluginContainer>> loadedPlugins = DkPluginManager::instance().getPlugins();
+    std::sort(loadedPlugins.begin(), loadedPlugins.end());
+
+    mPluginSubMenus.clear();
+
+    QStringList pluginMenu = QStringList();
+
+    for (auto plugin : loadedPlugins) {
+        DkPluginInterface *pi = plugin->plugin();
+
+        if (pi && plugin->pluginMenu()) {
+            QList<QAction *> actions = pi->createActions(DkUtils::getMainWindow());
+            mPluginSubMenus.append(plugin->pluginMenu());
+            mMenu->addMenu(plugin->pluginMenu());
+        } else if (pi) {
+            QAction *a = new QAction(plugin->pluginName(), this);
+            a->setData(plugin->id());
+            mPluginActions.append(a);
+            mMenu->addAction(a);
+            connect(a, SIGNAL(triggered()), plugin.data(), SLOT(run()));
+        }
+    }
 
-	mMenu->addSeparator();
-	mMenu->addAction(DkActionManager::instance().action(DkActionManager::menu_plugin_manager));
+    mMenu->addSeparator();
+    mMenu->addAction(DkActionManager::instance().action(DkActionManager::menu_plugin_manager));
 
-	QVector<QAction*> allPluginActions = mPluginActions;
+    QVector<QAction *> allPluginActions = mPluginActions;
 
-	for (const QMenu* m : mPluginSubMenus) {
-		allPluginActions << m->actions().toVector();
-	}
+    for (const QMenu *m : mPluginSubMenus) {
+        allPluginActions << m->actions().toVector();
+    }
 
-	DkActionManager::instance().assignCustomShortcuts(allPluginActions);
-	savePluginActions(allPluginActions);
+    DkActionManager::instance().assignCustomShortcuts(allPluginActions);
+    savePluginActions(allPluginActions);
 }
 
-void DkPluginActionManager::runPluginFromShortcut() {
-
-	qDebug() << "running plugin shortcut...";
+void DkPluginActionManager::runPluginFromShortcut()
+{
+    qDebug() << "running plugin shortcut...";
 
-	QAction* action = qobject_cast<QAction*>(sender());
-	QString actionName = action->text();
+    QAction *action = qobject_cast<QAction *>(sender());
+    QString actionName = action->text();
 
-	updateMenu();
+    updateMenu();
 
-	QVector<QAction*> allPluginActions = mPluginActions;
+    QVector<QAction *> allPluginActions = mPluginActions;
 
-	for (const QMenu* m : mPluginSubMenus) {
-		allPluginActions << m->actions().toVector();
-	}
+    for (const QMenu *m : mPluginSubMenus) {
+        allPluginActions << m->actions().toVector();
+    }
 
-	// this method fails if two plugins have the same action name!!
-	for (int i = 0; i < allPluginActions.size(); i++)
-		if (allPluginActions.at(i)->text().compare(actionName) == 0) {
-			allPluginActions.at(i)->trigger();
-			break;
-		}
+    // this method fails if two plugins have the same action name!!
+    for (int i = 0; i < allPluginActions.size(); i++)
+        if (allPluginActions.at(i)->text().compare(actionName) == 0) {
+            allPluginActions.at(i)->trigger();
+            break;
+        }
 }
 
-void DkPluginActionManager::savePluginActions(QVector<QAction *> actions) const {
-
-	DefaultSettings settings;
-	settings.beginGroup("CustomPluginShortcuts");
-	settings.remove("");
-	for (int i = 0; i < actions.size(); i++)
-		settings.setValue(actions.at(i)->text(), actions.at(i)->text());
-	settings.endGroup();
+void DkPluginActionManager::savePluginActions(QVector<QAction *> actions) const
+{
+    DefaultSettings settings;
+    settings.beginGroup("CustomPluginShortcuts");
+    settings.remove("");
+    for (int i = 0; i < actions.size(); i++)
+        settings.setValue(actions.at(i)->text(), actions.at(i)->text());
+    settings.endGroup();
 }
 
 }
diff --git a/ImageLounge/src/DkCore/DkPluginManager.h b/ImageLounge/src/DkCore/DkPluginManager.h
index a3af2aa..dde1328 100644
--- a/ImageLounge/src/DkCore/DkPluginManager.h
+++ b/ImageLounge/src/DkCore/DkPluginManager.h
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkPluginManager.h
  Created on:	20.05.2013
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -27,16 +27,16 @@
 
 #pragma once
 
-#pragma warning(push, 0)	// no warnings from includes - begin
+#pragma warning(push, 0) // no warnings from includes - begin
+#include <QAbstractTableModel>
+#include <QDate>
 #include <QDialog>
+#include <QLabel>
+#include <QLibrary>
 #include <QMap>
-#include <QAbstractTableModel>
 #include <QStyledItemDelegate>
 #include <QTextEdit>
-#include <QLabel>
-#include <QDate>
-#include <QLibrary>
-#pragma warning(pop)		// no warnings from includes - end
+#pragma warning(pop) // no warnings from includes - end
 
 #include "DkPluginInterface.h"
 
@@ -52,7 +52,8 @@ class QProgressDialog;
 class QSortFilterProxyModel;
 class QJsonValue;
 
-namespace nmc {
+namespace nmc
+{
 
 // nomacs defines
 class DkPluginTableWidget;
@@ -60,254 +61,258 @@ class DkInstalledPluginsModel;
 class DkPluginDownloader;
 
 enum installedPluginsColumns {
-	ip_column_name,
-	ip_column_version,
-	ip_column_uninstall,
-	ip_column_size,
+    ip_column_name,
+    ip_column_version,
+    ip_column_uninstall,
+    ip_column_size,
 };
 
-class DkLibrary {
-
+class DkLibrary
+{
 public:
-	DkLibrary(const QString& name = QString());
+    DkLibrary(const QString &name = QString());
 
-	QString fullPath() const;
-	QString name() const;
+    QString fullPath() const;
+    QString name() const;
 
-	bool isLoaded() const;
+    bool isLoaded() const;
 
-	bool load();
-	bool uninstall();
+    bool load();
+    bool uninstall();
 
 protected:
-	QString mFullPath;
-	QString mName;
+    QString mFullPath;
+    QString mName;
+
+    QSharedPointer<QLibrary> mLib;
+    QVector<DkLibrary> mDependencies;
 
-	QSharedPointer<QLibrary> mLib;
-	QVector<DkLibrary> mDependencies;
-	
-	QVector<DkLibrary> loadDependencies() const;
+    QVector<DkLibrary> loadDependencies() const;
 };
 
-class DllCoreExport DkPluginContainer : public QObject {
-	Q_OBJECT
+class DllCoreExport DkPluginContainer : public QObject
+{
+    Q_OBJECT
 
 public:
-	DkPluginContainer(const QString& pluginPath);
-	~DkPluginContainer();
-
-	enum PluginType {
-		type_unknown = 0,
-		type_simple,
-		type_batch,
-		type_viewport,
-		
-		type_end
-	};
-
-	friend bool operator<(const QSharedPointer<DkPluginContainer> & l, const QSharedPointer<DkPluginContainer> & r);
-
-	void setActive(bool active = true);
-	bool isActive() const;
-
-	bool isValid() const;
-	bool isLoaded() const;
-	bool load();
-	bool uninstall();
-
-	// attributes
-	QString pluginPath() const;
-	QString pluginName() const;
-	QString authorName() const;
-	QString company() const;
-	QString version() const;
-	QString description() const;
-	QString fullDescription() const;
-	QString tagline() const;
-	QString id() const;
-	
-	QDate dateCreated() const;
-	QDate dateModified() const;
-
-	QMenu* pluginMenu() const;
-
-	QSharedPointer<QPluginLoader> loader() const;
-	DkPluginInterface* plugin() const;
-	DkBatchPluginInterface* batchPlugin() const;
-	DkViewPortInterface* pluginViewPort() const;
-	QString actionNameToRunId(const QString& actionName) const;
+    DkPluginContainer(const QString &pluginPath);
+    ~DkPluginContainer();
+
+    enum PluginType {
+        type_unknown = 0,
+        type_simple,
+        type_batch,
+        type_viewport,
+
+        type_end
+    };
+
+    friend bool operator<(const QSharedPointer<DkPluginContainer> &l, const QSharedPointer<DkPluginContainer> &r);
+
+    void setActive(bool active = true);
+    bool isActive() const;
+
+    bool isValid() const;
+    bool isLoaded() const;
+    bool load();
+    bool uninstall();
+
+    // attributes
+    QString pluginPath() const;
+    QString pluginName() const;
+    QString authorName() const;
+    QString company() const;
+    QString version() const;
+    QString description() const;
+    QString fullDescription() const;
+    QString tagline() const;
+    QString id() const;
+
+    QDate dateCreated() const;
+    QDate dateModified() const;
+
+    QMenu *pluginMenu() const;
+
+    QSharedPointer<QPluginLoader> loader() const;
+    DkPluginInterface *plugin() const;
+    DkBatchPluginInterface *batchPlugin() const;
+    DkViewPortInterface *pluginViewPort() const;
+    QString actionNameToRunId(const QString &actionName) const;
 
 signals:
-	void runPlugin(DkViewPortInterface* viewport, bool close) const;
-	void runPlugin(DkPluginContainer* plugin, const QString& key) const;
+    void runPlugin(DkViewPortInterface *viewport, bool close) const;
+    void runPlugin(DkPluginContainer *plugin, const QString &key) const;
 
 public slots:
-	void run();
+    void run();
 
 protected:
-	QString mPluginPath;
-	QString mPluginName;
-	QString mAuthorName;
-	QString mCompany;
-	QString mDescription;
-	QString mVersion;
-	QString mTagline;
-	QString mId;
+    QString mPluginPath;
+    QString mPluginName;
+    QString mAuthorName;
+    QString mCompany;
+    QString mDescription;
+    QString mVersion;
+    QString mTagline;
+    QString mId;
 
-	QDate mDateCreated;
-	QDate mDateModified;
+    QDate mDateCreated;
+    QDate mDateModified;
 
-	bool mActive = false;
-	bool mIsValid = false;
+    bool mActive = false;
+    bool mIsValid = false;
 
-	PluginType mType = type_unknown;
+    PluginType mType = type_unknown;
 
-	QMenu* mPluginMenu = 0;
+    QMenu *mPluginMenu = 0;
 
-	QSharedPointer<QPluginLoader> mLoader = QSharedPointer<QPluginLoader>();
+    QSharedPointer<QPluginLoader> mLoader = QSharedPointer<QPluginLoader>();
 
-	void createMenu();
-	void loadJson();
-	void loadMetaData(const QJsonValue& val);
+    void createMenu();
+    void loadJson();
+    void loadMetaData(const QJsonValue &val);
 };
 
-class DllCoreExport DkPluginActionManager : public QObject {
-	Q_OBJECT
+class DllCoreExport DkPluginActionManager : public QObject
+{
+    Q_OBJECT
 
 public:
-	DkPluginActionManager(QObject* parent = 0);
+    DkPluginActionManager(QObject *parent = 0);
 
-	void setMenu(QMenu* menu);
-	QMenu* menu() const;
+    void setMenu(QMenu *menu);
+    QMenu *menu() const;
 
-	QVector<QAction*> pluginDummyActions() const;
-	QVector<QAction*> pluginActions() const;
-	QVector<QMenu*> pluginSubMenus() const;
+    QVector<QAction *> pluginDummyActions() const;
+    QVector<QAction *> pluginActions() const;
+    QVector<QMenu *> pluginSubMenus() const;
 
-	static void createPluginsPath();
+    static void createPluginsPath();
 
 public slots:
-	//void runLoadedPlugin();
-	void runPluginFromShortcut();
-	void addPluginsToMenu();
-	void updateMenu();
+    // void runLoadedPlugin();
+    void runPluginFromShortcut();
+    void addPluginsToMenu();
+    void updateMenu();
 
 signals:
-	void runPlugin(DkViewPortInterface* plugin, bool close) const;
-	void runPlugin(DkPluginContainer* plugin, const QString& key) const;
-	void applyPluginChanges(bool askForSaving) const;
-	void showViewPort() const;
+    void runPlugin(DkViewPortInterface *plugin, bool close) const;
+    void runPlugin(DkPluginContainer *plugin, const QString &key) const;
+    void applyPluginChanges(bool askForSaving) const;
+    void showViewPort() const;
 
 protected:
-	void assignCustomPluginShortcuts();
-	void savePluginActions(QVector<QAction *> actions) const;
+    void assignCustomPluginShortcuts();
+    void savePluginActions(QVector<QAction *> actions) const;
 
-	QVector<QAction *> mPluginActions;
-	QVector<QAction *> mPluginDummyActions;
-	QMenu* mMenu = 0;
-	QVector<QMenu*> mPluginSubMenus;
+    QVector<QAction *> mPluginActions;
+    QVector<QAction *> mPluginDummyActions;
+    QMenu *mMenu = 0;
+    QVector<QMenu *> mPluginSubMenus;
 };
 
-class DllCoreExport DkPluginManager {
-
+class DllCoreExport DkPluginManager
+{
 public:
-	static DkPluginManager& instance();
-	~DkPluginManager();
-
-	// singleton
-	DkPluginManager(DkPluginManager const&)		= delete;
-	void operator=(DkPluginManager const&)		= delete;
-	
-	QVector<QSharedPointer<DkPluginContainer> > getPlugins() const;
-	QSharedPointer<DkPluginContainer> getPluginByName(const QString& pluginName) const;
-	QSharedPointer<DkPluginContainer> getPluginByPath(const QString& path) const;
-	
-	void reload();
-	void removePlugin(QSharedPointer<DkPluginContainer> plugin);
-	bool deletePlugin(QSharedPointer<DkPluginContainer> plugin);
-	void clear();
-
-	void loadPlugins();
-
-	bool singlePluginLoad(const QString& filePath);
-
-	QVector<QSharedPointer<DkPluginContainer> > getBasicPlugins() const;
-	QVector<QSharedPointer<DkPluginContainer> > getBatchPlugins() const;
-
-	// functions for active plugin
-	void clearRunningPlugin();
-	QSharedPointer<DkPluginContainer> getRunningPlugin() const;
-	void runPlugin(QSharedPointer<DkPluginContainer> plugin);
-
-	bool isBlackListed(const QString& pluginPath) const;
-	static QStringList blackList();
-	static void createPluginsPath();
+    static DkPluginManager &instance();
+    ~DkPluginManager();
+
+    // singleton
+    DkPluginManager(DkPluginManager const &) = delete;
+    void operator=(DkPluginManager const &) = delete;
+
+    QVector<QSharedPointer<DkPluginContainer>> getPlugins() const;
+    QSharedPointer<DkPluginContainer> getPluginByName(const QString &pluginName) const;
+    QSharedPointer<DkPluginContainer> getPluginByPath(const QString &path) const;
+
+    void reload();
+    void removePlugin(QSharedPointer<DkPluginContainer> plugin);
+    bool deletePlugin(QSharedPointer<DkPluginContainer> plugin);
+    void clear();
+
+    void loadPlugins();
+
+    bool singlePluginLoad(const QString &filePath);
+
+    QVector<QSharedPointer<DkPluginContainer>> getBasicPlugins() const;
+    QVector<QSharedPointer<DkPluginContainer>> getBatchPlugins() const;
+
+    // functions for active plugin
+    void clearRunningPlugin();
+    QSharedPointer<DkPluginContainer> getRunningPlugin() const;
+    void runPlugin(QSharedPointer<DkPluginContainer> plugin);
+
+    bool isBlackListed(const QString &pluginPath) const;
+    static QStringList blackList();
+    static void createPluginsPath();
 
 private:
-	DkPluginManager();
-	
-	QVector<QSharedPointer<DkPluginContainer> > mPlugins;
+    DkPluginManager();
+
+    QVector<QSharedPointer<DkPluginContainer>> mPlugins;
 };
 
 // Plug-in manager dialog for enabling/disabling plug-ins and downloading new ones
-class DllCoreExport DkPluginManagerDialog : public QDialog {
-	Q_OBJECT
+class DllCoreExport DkPluginManagerDialog : public QDialog
+{
+    Q_OBJECT
 
 public:
-	DkPluginManagerDialog(QWidget* parent = 0);
-	~DkPluginManagerDialog();
-		
-	void deleteInstance(QSharedPointer<DkPluginContainer> plugin);
-	QMap<QString, QString> getPreviouslyInstalledPlugins();
+    DkPluginManagerDialog(QWidget *parent = 0);
+    ~DkPluginManagerDialog();
+
+    void deleteInstance(QSharedPointer<DkPluginContainer> plugin);
+    QMap<QString, QString> getPreviouslyInstalledPlugins();
 
 protected slots:
-	void closePressed();
+    void closePressed();
 
 protected:
-	int dialogWidth;
-	int dialogHeight;
-	
-	DkPluginTableWidget* tableWidgetInstalled;
-	QMap<QString, QString> previouslyInstalledPlugins;
-
-	void init();
-	void createLayout();
-	void showEvent(QShowEvent *event) override;
+    int dialogWidth;
+    int dialogHeight;
+
+    DkPluginTableWidget *tableWidgetInstalled;
+    QMap<QString, QString> previouslyInstalledPlugins;
+
+    void init();
+    void createLayout();
+    void showEvent(QShowEvent *event) override;
 };
 
 // widget with all plug-in information
-class DkPluginTableWidget: public DkWidget {
+class DkPluginTableWidget : public DkWidget
+{
+    Q_OBJECT
 
-Q_OBJECT
+public:
+    DkPluginTableWidget(QWidget *parent);
+    ~DkPluginTableWidget();
 
-public:    
-	DkPluginTableWidget(QWidget* parent);
-	~DkPluginTableWidget();
+    void clearTableFilters();
+    void updateInstalledModel();
 
-	void clearTableFilters();
-	void updateInstalledModel();
-	
 public slots:
-	void uninstallPlugin(const QModelIndex &index);
-	void reloadPlugins();
+    void uninstallPlugin(const QModelIndex &index);
+    void reloadPlugins();
 
 private:
-	void createLayout();
+    void createLayout();
 
-	DkPluginManagerDialog* mPluginManager = 0;
-	QSortFilterProxyModel* mProxyModel = 0;
-	QAbstractTableModel* mModel = 0;
-	QTableView* mTableView = 0;
-	QLineEdit* mFilterEdit = 0;
+    DkPluginManagerDialog *mPluginManager = 0;
+    QSortFilterProxyModel *mProxyModel = 0;
+    QAbstractTableModel *mModel = 0;
+    QTableView *mTableView = 0;
+    QLineEdit *mFilterEdit = 0;
 
 protected slots:
-	void filterTextChanged();
-	//void on_updateButton_clicked();
+    void filterTextChanged();
+    // void on_updateButton_clicked();
 };
 
-// model for the table in the installed plug-ins tab 
-class DkInstalledPluginsModel : public QAbstractTableModel {
-	Q_OBJECT
+// model for the table in the installed plug-ins tab
+class DkInstalledPluginsModel : public QAbstractTableModel
+{
+    Q_OBJECT
 
 public:
     DkInstalledPluginsModel(QObject *parent = 0);
@@ -317,86 +322,87 @@ public:
     QVariant data(const QModelIndex &index, int role) const override;
     QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
     Qt::ItemFlags flags(const QModelIndex &index) const override;
-	bool removeRows(int position, int rows, const QModelIndex &index=QModelIndex()) override;
-		
-	void setDataToInsert(QSharedPointer<DkPluginContainer> newData);
-	
-private:
-	QSharedPointer<DkPluginContainer> mPluginToInsert;
-	DkPluginTableWidget* mParentTable = 0;
+    bool removeRows(int position, int rows, const QModelIndex &index = QModelIndex()) override;
+
+    void setDataToInsert(QSharedPointer<DkPluginContainer> newData);
 
+private:
+    QSharedPointer<DkPluginContainer> mPluginToInsert;
+    DkPluginTableWidget *mParentTable = 0;
 };
 
 // checkbox delegate based on code from http://stackoverflow.com/questions/3363190/qt-qtableview-how-to-have-a-checkbox-only-column
-class DkPluginCheckBoxDelegate : public QStyledItemDelegate {
-	Q_OBJECT
+class DkPluginCheckBoxDelegate : public QStyledItemDelegate
+{
+    Q_OBJECT
 
 public:
-	DkPluginCheckBoxDelegate(QObject *parent = 0);
-	void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
-	bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index);
+    DkPluginCheckBoxDelegate(QObject *parent = 0);
+    void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
+    bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index);
 
 private:
-	QTableView* mParentTable = 0;
+    QTableView *mParentTable = 0;
 };
 
 // pushbutton delegate : adds mButtons in the table column
-class DkPushButtonDelegate : public QStyledItemDelegate {
-	Q_OBJECT
+class DkPushButtonDelegate : public QStyledItemDelegate
+{
+    Q_OBJECT
 
 public:
-	DkPushButtonDelegate(QObject *parent = 0);
-	void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
-	bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index);
+    DkPushButtonDelegate(QObject *parent = 0);
+    void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
+    bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index);
 
 signals:
     void buttonClicked(const QModelIndex &index) const;
 
 private:
-	QTableView* mParentTable = 0;
-	int mCRow = -1;
-	QStyle::State mPushButonState = QStyle::State_Enabled;
+    QTableView *mParentTable = 0;
+    int mCRow = -1;
+    QStyle::State mPushButonState = QStyle::State_Enabled;
 };
 
 // text edit connected to tables selection
-class DkDescriptionEdit : public QTextEdit {
-
-Q_OBJECT
+class DkDescriptionEdit : public QTextEdit
+{
+    Q_OBJECT
 
 public:
-	DkDescriptionEdit(QAbstractTableModel* data, QSortFilterProxyModel* proxy, QItemSelectionModel* selection, QWidget *parent = 0);
+    DkDescriptionEdit(QAbstractTableModel *data, QSortFilterProxyModel *proxy, QItemSelectionModel *selection, QWidget *parent = 0);
 
 protected slots:
-	void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
-	void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
+    void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
+    void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
 
 private:
-	QAbstractTableModel* mDataModel = 0;
-	QSortFilterProxyModel* mProxyModel = 0;
-	QItemSelectionModel* mSelectionModel = 0;
-	DkPluginTableWidget* mParentTable = 0;
-	void updateText();
+    QAbstractTableModel *mDataModel = 0;
+    QSortFilterProxyModel *mProxyModel = 0;
+    QItemSelectionModel *mSelectionModel = 0;
+    DkPluginTableWidget *mParentTable = 0;
+    void updateText();
 };
 
 // label connected to table selections
-class DkDescriptionImage : public QLabel {
-
-Q_OBJECT
+class DkDescriptionImage : public QLabel
+{
+    Q_OBJECT
 
 public:
-	DkDescriptionImage(QAbstractTableModel* data, QSortFilterProxyModel* proxy, QItemSelectionModel* selection, QWidget *parent = 0);
+    DkDescriptionImage(QAbstractTableModel *data, QSortFilterProxyModel *proxy, QItemSelectionModel *selection, QWidget *parent = 0);
 
 protected slots:
-	void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
-	void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
+    void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
+    void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
 
 private:
-	QAbstractTableModel* mDataModel = 0;
-	QSortFilterProxyModel* mProxyModel = 0;
-	QItemSelectionModel* mSelectionModel = 0;
-	DkPluginTableWidget* mParentTable = 0;
-	QPixmap mDefaultImage;
-	void updateImage();
+    QAbstractTableModel *mDataModel = 0;
+    QSortFilterProxyModel *mProxyModel = 0;
+    QItemSelectionModel *mSelectionModel = 0;
+    DkPluginTableWidget *mParentTable = 0;
+    QPixmap mDefaultImage;
+    void updateImage();
 };
 
 }
diff --git a/ImageLounge/src/DkCore/DkProcess.cpp b/ImageLounge/src/DkCore/DkProcess.cpp
index 018ddf6..b06191b 100644
--- a/ImageLounge/src/DkCore/DkProcess.cpp
+++ b/ImageLounge/src/DkCore/DkProcess.cpp
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkProcess.cpp
  Created on:	27.12.2014
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2014 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2014 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2014 Florian Kleber <florian@nomacs.org>
@@ -26,27 +26,28 @@
  *******************************************************************************************************/
 
 #include "DkProcess.h"
-#include "DkUtils.h"
 #include "DkImageContainer.h"
 #include "DkImageStorage.h"
+#include "DkManipulators.h"
+#include "DkMath.h"
 #include "DkPluginManager.h"
 #include "DkSettings.h"
-#include "DkMath.h"
-#include "DkManipulators.h"
 #include "DkTimer.h"
+#include "DkUtils.h"
 
 #include "DkMetaData.h"
 
-#pragma warning(push, 0)	// no warnings from includes - begin
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QFuture>
 #include <QFutureWatcher>
-#include <QtConcurrentMap>
 #include <QWidget>
-#pragma warning(pop)		// no warnings from includes - end
+#include <QtConcurrentMap>
+#pragma warning(pop) // no warnings from includes - end
 
 #include <cassert>
 
-namespace nmc {
+namespace nmc
+{
 
 /// <summary>
 /// Generic compute method for DkBatch Info <see cref="DkBatchInfo"/>.
@@ -59,9 +60,12 @@ namespace nmc {
 /// <returns>
 /// true on success
 /// </returns>
-bool DkAbstractBatch::compute(QSharedPointer<DkImageContainer> container, const DkSaveInfo& , QStringList& logStrings, QVector<QSharedPointer<DkBatchInfo> >&) const {
-
-	return compute(container, logStrings);
+bool DkAbstractBatch::compute(QSharedPointer<DkImageContainer> container,
+                              const DkSaveInfo &,
+                              QStringList &logStrings,
+                              QVector<QSharedPointer<DkBatchInfo>> &) const
+{
+    return compute(container, logStrings);
 }
 
 /// <summary>
@@ -72,1288 +76,1250 @@ bool DkAbstractBatch::compute(QSharedPointer<DkImageContainer> container, const
 /// <param name="container">Container the image container to be processed.</param>
 /// <param name="logStrings">log strings.</param>
 /// <returns>true on success</returns>
-bool DkAbstractBatch::compute(QSharedPointer<DkImageContainer> container, QStringList& logStrings) const {
-	
-	QImage img = container->image();
-	
-	bool isOk = compute(img, logStrings);
+bool DkAbstractBatch::compute(QSharedPointer<DkImageContainer> container, QStringList &logStrings) const
+{
+    QImage img = container->image();
 
-	if (isOk)
-		container->setImage(img, QObject::tr("Batch Action"));
+    bool isOk = compute(img, logStrings);
 
-	return isOk;
-}
+    if (isOk)
+        container->setImage(img, QObject::tr("Batch Action"));
 
-QString DkAbstractBatch::settingsName() const {
-	
-	// make name() settings friendly
-	QString sn = name();
-	sn.replace("[", "");
-	sn.replace("]", "");
-	sn.replace(" ", "");
-	
-	return sn;
+    return isOk;
 }
 
-QSharedPointer<DkAbstractBatch> DkAbstractBatch::createFromName(const QString& settingsName) {
+QString DkAbstractBatch::settingsName() const
+{
+    // make name() settings friendly
+    QString sn = name();
+    sn.replace("[", "");
+    sn.replace("]", "");
+    sn.replace(" ", "");
 
-	QSharedPointer<DkAbstractBatch> batch;
-	batch = QSharedPointer<DkBatchTransform>::create();
+    return sn;
+}
+
+QSharedPointer<DkAbstractBatch> DkAbstractBatch::createFromName(const QString &settingsName)
+{
+    QSharedPointer<DkAbstractBatch> batch;
+    batch = QSharedPointer<DkBatchTransform>::create();
 
-	if (batch->settingsName() == settingsName)
-		return batch;
+    if (batch->settingsName() == settingsName)
+        return batch;
 
-	batch = QSharedPointer<DkManipulatorBatch>::create();
+    batch = QSharedPointer<DkManipulatorBatch>::create();
 
-	if (batch->settingsName() == settingsName)
-		return batch;
+    if (batch->settingsName() == settingsName)
+        return batch;
 
 #ifdef WITH_PLUGINS
-	batch = QSharedPointer<DkPluginBatch>::create();
+    batch = QSharedPointer<DkPluginBatch>::create();
 
-	if (batch->settingsName() == settingsName)
-		return batch;
+    if (batch->settingsName() == settingsName)
+        return batch;
 #endif
 
-	qCritical() << "cannot instantiate batch, illegal settings name: " << settingsName;
-	return QSharedPointer<DkAbstractBatch>();
+    qCritical() << "cannot instantiate batch, illegal settings name: " << settingsName;
+    return QSharedPointer<DkAbstractBatch>();
 }
 
 // DkTransformBatch --------------------------------------------------------------------
-DkBatchTransform::DkBatchTransform() {
-	mResizeIplMethod = DkImage::ipl_area;	// define here because of includes
-}
-
-QString DkBatchTransform::name() const {
-	return QObject::tr("[Transform Batch]");
+DkBatchTransform::DkBatchTransform()
+{
+    mResizeIplMethod = DkImage::ipl_area; // define here because of includes
+}
+
+QString DkBatchTransform::name() const
+{
+    return QObject::tr("[Transform Batch]");
 }
 
-void DkBatchTransform::setProperties(		
-	int angle, 
-	bool cropFromMetadata,
-	QRect cropRect,
-	float scaleFactor, 
-	const ResizeMode& mode /*= resize_mode_default*/, 
-	const ResizeProperty& prop /*= resize_prop_default*/, 
-	int iplMethod /*= DkImage::ipl_area*/, 
-	bool correctGamma /*= false*/) {
-	
-	mAngle = angle;
-	mCropFromMetadata = cropFromMetadata;
-	mCropRect = cropRect;
+void DkBatchTransform::setProperties(int angle,
+                                     bool cropFromMetadata,
+                                     QRect cropRect,
+                                     float scaleFactor,
+                                     const ResizeMode &mode /*= resize_mode_default*/,
+                                     const ResizeProperty &prop /*= resize_prop_default*/,
+                                     int iplMethod /*= DkImage::ipl_area*/,
+                                     bool correctGamma /*= false*/)
+{
+    mAngle = angle;
+    mCropFromMetadata = cropFromMetadata;
+    mCropRect = cropRect;
 
-	mResizeScaleFactor = scaleFactor;
-	mResizeMode = mode;
-	mResizeProperty = prop;
-	mResizeIplMethod = iplMethod;
-	mResizeCorrectGamma = correctGamma;
+    mResizeScaleFactor = scaleFactor;
+    mResizeMode = mode;
+    mResizeProperty = prop;
+    mResizeIplMethod = iplMethod;
+    mResizeCorrectGamma = correctGamma;
 }
 
-void DkBatchTransform::saveSettings(QSettings & settings) const {
-
-	settings.beginGroup(settingsName());
-	settings.setValue("Angle", mAngle);
-	settings.setValue("CropFromMetadata", mCropFromMetadata);
-	settings.setValue("CropRectangle", rectToString(mCropRect));
+void DkBatchTransform::saveSettings(QSettings &settings) const
+{
+    settings.beginGroup(settingsName());
+    settings.setValue("Angle", mAngle);
+    settings.setValue("CropFromMetadata", mCropFromMetadata);
+    settings.setValue("CropRectangle", rectToString(mCropRect));
 
-	// resize
-	settings.setValue("ScaleFactor", mResizeScaleFactor);
-	settings.setValue("Mode", mResizeMode);
-	settings.setValue("Property", mResizeProperty);
-	settings.setValue("IplMethod", mResizeIplMethod);
-	settings.setValue("CorrectGamma", mResizeCorrectGamma);
+    // resize
+    settings.setValue("ScaleFactor", mResizeScaleFactor);
+    settings.setValue("Mode", mResizeMode);
+    settings.setValue("Property", mResizeProperty);
+    settings.setValue("IplMethod", mResizeIplMethod);
+    settings.setValue("CorrectGamma", mResizeCorrectGamma);
 
-	settings.endGroup();
+    settings.endGroup();
 }
 
-void DkBatchTransform::loadSettings(QSettings & settings) {
+void DkBatchTransform::loadSettings(QSettings &settings)
+{
+    settings.beginGroup(settingsName());
+    mAngle = settings.value("Angle", mAngle).toInt();
+    mCropFromMetadata = settings.value("CropFromMetadata", mCropFromMetadata).toBool();
+    mCropRect = stringToRect(settings.value("CropRectangle", mCropRect).toString());
 
-	settings.beginGroup(settingsName());
-	mAngle = settings.value("Angle", mAngle).toInt();
-	mCropFromMetadata = settings.value("CropFromMetadata", mCropFromMetadata).toBool();
-	mCropRect = stringToRect(settings.value("CropRectangle", mCropRect).toString());
-
-	mResizeScaleFactor	= settings.value("ScaleFactor", mResizeScaleFactor).toFloat();
-	mResizeMode			= (ResizeMode)settings.value("Mode", mResizeMode).toInt();
-	mResizeProperty		= (ResizeProperty)settings.value("Property", mResizeProperty).toInt();
-	mResizeIplMethod	= settings.value("IplMethod", mResizeIplMethod).toInt();
-	mResizeCorrectGamma	= settings.value("Correct Gamma", mResizeCorrectGamma).toBool();
-	settings.endGroup();
+    mResizeScaleFactor = settings.value("ScaleFactor", mResizeScaleFactor).toFloat();
+    mResizeMode = (ResizeMode)settings.value("Mode", mResizeMode).toInt();
+    mResizeProperty = (ResizeProperty)settings.value("Property", mResizeProperty).toInt();
+    mResizeIplMethod = settings.value("IplMethod", mResizeIplMethod).toInt();
+    mResizeCorrectGamma = settings.value("Correct Gamma", mResizeCorrectGamma).toBool();
+    settings.endGroup();
 }
 
-bool DkBatchTransform::isResizeActive() const {
-	
-	if (mResizeMode != resize_mode_default)
-		return true;
+bool DkBatchTransform::isResizeActive() const
+{
+    if (mResizeMode != resize_mode_default)
+        return true;
 
-	if (mResizeScaleFactor != 1.0f)
-		return true;
+    if (mResizeScaleFactor != 1.0f)
+        return true;
 
-	return false;
+    return false;
 }
 
-QString DkBatchTransform::rectToString(const QRect & r) const {
-	
-	QString str;
-	str += QString::number(r.x()) + ",";
-	str += QString::number(r.y()) + ",";
-	str += QString::number(r.width()) + ",";
-	str += QString::number(r.height());
-	
-	return str;
+QString DkBatchTransform::rectToString(const QRect &r) const
+{
+    QString str;
+    str += QString::number(r.x()) + ",";
+    str += QString::number(r.y()) + ",";
+    str += QString::number(r.width()) + ",";
+    str += QString::number(r.height());
+
+    return str;
 }
 
-QRect DkBatchTransform::stringToRect(const QString & s) const {
-	
-	QStringList sl = s.split(",");
+QRect DkBatchTransform::stringToRect(const QString &s) const
+{
+    QStringList sl = s.split(",");
 
-	if (sl.size() != 4) {
-		qWarning() << "could not parse rect from" << s;
-		return QRect();
-	}
-	
-	QRect rect;
+    if (sl.size() != 4) {
+        qWarning() << "could not parse rect from" << s;
+        return QRect();
+    }
 
-	bool okX, okY, okW, okH = false;
-	rect.setX(sl[0].toInt(&okX));
-	rect.setY(sl[1].toInt(&okY));
-	rect.setWidth(sl[2].toInt(&okW));
-	rect.setHeight(sl[3].toInt(&okH));
+    QRect rect;
 
-	if (!okX || !okY || !okW || !okH) {
-		qWarning() << "could not parse rect from" << s;
-		return QRect();
-	}
-	
-	return rect;
-}
+    bool okX, okY, okW, okH = false;
+    rect.setX(sl[0].toInt(&okX));
+    rect.setY(sl[1].toInt(&okY));
+    rect.setWidth(sl[2].toInt(&okW));
+    rect.setHeight(sl[3].toInt(&okH));
 
-bool DkBatchTransform::isActive() const {
+    if (!okX || !okY || !okW || !okH) {
+        qWarning() << "could not parse rect from" << s;
+        return QRect();
+    }
 
-	return mAngle != 0 || mCropFromMetadata || cropFromRectangle() || isResizeActive();
+    return rect;
 }
 
-int DkBatchTransform::angle() const {
-	return mAngle;
+bool DkBatchTransform::isActive() const
+{
+    return mAngle != 0 || mCropFromMetadata || cropFromRectangle() || isResizeActive();
 }
 
-bool DkBatchTransform::cropMetatdata() const {
-	return mCropFromMetadata;
+int DkBatchTransform::angle() const
+{
+    return mAngle;
 }
 
-bool DkBatchTransform::cropFromRectangle() const {
-	return !mCropRect.isEmpty();
+bool DkBatchTransform::cropMetatdata() const
+{
+    return mCropFromMetadata;
 }
 
-QRect DkBatchTransform::cropRectangle() const {
-	return mCropRect;
+bool DkBatchTransform::cropFromRectangle() const
+{
+    return !mCropRect.isEmpty();
 }
 
-DkBatchTransform::ResizeMode DkBatchTransform::mode() const {
-	return mResizeMode;
+QRect DkBatchTransform::cropRectangle() const
+{
+    return mCropRect;
 }
 
-DkBatchTransform::ResizeProperty DkBatchTransform::prop() const {
-	return mResizeProperty;
+DkBatchTransform::ResizeMode DkBatchTransform::mode() const
+{
+    return mResizeMode;
 }
 
-int DkBatchTransform::iplMethod() const {
-	return mResizeIplMethod;
+DkBatchTransform::ResizeProperty DkBatchTransform::prop() const
+{
+    return mResizeProperty;
 }
 
-float DkBatchTransform::scaleFactor() const {
-	return mResizeScaleFactor;
+int DkBatchTransform::iplMethod() const
+{
+    return mResizeIplMethod;
 }
 
-bool DkBatchTransform::correctGamma() const {
-	return mResizeCorrectGamma;
+float DkBatchTransform::scaleFactor() const
+{
+    return mResizeScaleFactor;
 }
 
-bool DkBatchTransform::compute(QSharedPointer<DkImageContainer> container, QStringList& logStrings) const {
-
-	
-	if (!isActive()) {
-		logStrings.append(QObject::tr("%1 inactive -> skipping").arg(name()));
-		return true;
-	}
-
-	DkRotatingRect rect = container->cropRect();
-	if (mCropFromMetadata) {
-		if (!rect.isEmpty())
-			container->cropImage(rect, QColor(), false);
-	}
-	
-	QImage img = container->image();
-	QImage tmpImg;
-
-	// resize
-	if (isResizeActive()) {
-		QSize size;
-		float sf = 1.0f;
-
-		if (prepareProperties(img.size(), size, sf, logStrings))
-			tmpImg = DkImage::resizeImage(img, size, sf, mResizeIplMethod, mResizeCorrectGamma);
-		else
-			tmpImg = img;
-	}
-	else
-		tmpImg = img;
-
-	// rotate
-	if (mAngle != 0) {
-		QTransform rotationMatrix;
-		rotationMatrix.rotate((double)mAngle);
-		tmpImg = tmpImg.transformed(rotationMatrix);
-	}
-
-	// crop from rectangle
-	if (cropFromRectangle()) {
-		QRect r = mCropRect.intersected(container->image().rect());
-		tmpImg = tmpImg.copy(r);
-	}
+bool DkBatchTransform::correctGamma() const
+{
+    return mResizeCorrectGamma;
+}
 
-	// logs
-	if (!tmpImg.isNull()) {
-	
-		container->setImage(tmpImg, QObject::tr("transformed"));
+bool DkBatchTransform::compute(QSharedPointer<DkImageContainer> container, QStringList &logStrings) const
+{
+    if (!isActive()) {
+        logStrings.append(QObject::tr("%1 inactive -> skipping").arg(name()));
+        return true;
+    }
 
-		if (rect.isEmpty() && mCropFromMetadata)
-			logStrings.append(QObject::tr("%1 image transformed.").arg(name()));
-		else if (isResizeActive()) {
-			if (mResizeMode == resize_mode_default)
-				logStrings.append(QObject::tr("%1 image resized, scale factor: %2%").arg(name()).arg(mResizeScaleFactor*100.0f));
-			else
-				logStrings.append(QObject::tr("%1 image resized, new side: %2 px").arg(name()).arg(mResizeScaleFactor));
-		}
-		else
-			logStrings.append(QObject::tr("%1 image transformed and cropped.").arg(name()));
+    DkRotatingRect rect = container->cropRect();
+    if (mCropFromMetadata) {
+        if (!rect.isEmpty())
+            container->cropImage(rect, QColor(), false);
+    }
 
-	}
-	else {
-		logStrings.append(QObject::tr("%1 error, could not transform image.").arg(name()));
-		return false;
-	}
+    QImage img = container->image();
+    QImage tmpImg;
 
-	return true;
-}
+    // resize
+    if (isResizeActive()) {
+        QSize size;
+        float sf = 1.0f;
 
-bool DkBatchTransform::prepareProperties(const QSize& imgSize, QSize& size, float& scaleFactor, QStringList& logStrings) const {
+        if (prepareProperties(img.size(), size, sf, logStrings))
+            tmpImg = DkImage::resizeImage(img, size, sf, mResizeIplMethod, mResizeCorrectGamma);
+        else
+            tmpImg = img;
+    } else
+        tmpImg = img;
 
-	float sf = 1.0f;
-	QSize normalizedSize = imgSize; 
+    // rotate
+    if (mAngle != 0) {
+        QTransform rotationMatrix;
+        rotationMatrix.rotate((double)mAngle);
+        tmpImg = tmpImg.transformed(rotationMatrix);
+    }
 
-	if (mResizeMode == resize_mode_default) {
-		scaleFactor = mResizeScaleFactor;
-		return true;
-	}
-	else if (mResizeMode == resize_mode_long_side) {
+    // crop from rectangle
+    if (cropFromRectangle()) {
+        QRect r = mCropRect.intersected(container->image().rect());
+        tmpImg = tmpImg.copy(r);
+    }
 
-		if (imgSize.width() < imgSize.height())
-			normalizedSize.transpose();
-	}
-	else if (mResizeMode == resize_mode_short_side) {
+    // logs
+    if (!tmpImg.isNull()) {
+        container->setImage(tmpImg, QObject::tr("transformed"));
 
-		if (imgSize.width() > imgSize.height())
-			normalizedSize.transpose();
-	}
-	else if (mResizeMode == resize_mode_height)
-		normalizedSize.transpose();
+        if (rect.isEmpty() && mCropFromMetadata)
+            logStrings.append(QObject::tr("%1 image transformed.").arg(name()));
+        else if (isResizeActive()) {
+            if (mResizeMode == resize_mode_default)
+                logStrings.append(QObject::tr("%1 image resized, scale factor: %2%").arg(name()).arg(mResizeScaleFactor * 100.0f));
+            else
+                logStrings.append(QObject::tr("%1 image resized, new side: %2 px").arg(name()).arg(mResizeScaleFactor));
+        } else
+            logStrings.append(QObject::tr("%1 image transformed and cropped.").arg(name()));
 
-	sf = mResizeScaleFactor/normalizedSize.width();
+    } else {
+        logStrings.append(QObject::tr("%1 error, could not transform image.").arg(name()));
+        return false;
+    }
 
-	if (sf > 1.0 && mResizeProperty == resize_prop_decrease_only) {
-
-		logStrings.append(QObject::tr("%1 I need to increase the image size, but the option is set to 'decrease only' -> skipping.").arg(name()));
-		return false;
-	}
-	else if (sf < 1.0f && mResizeProperty == resize_prop_increase_only) {
-		logStrings.append(QObject::tr("%1 I need to decrease the image size, but the option is set to 'increase only' -> skipping.").arg(name()));
-		return false;
-	}
-	else if (sf == 1.0f) {
-		logStrings.append(QObject::tr("%1 image size matches scale factor -> skipping.").arg(name()));
-		return false;
-	}
-
-	size.setWidth(qRound(mResizeScaleFactor));
-	size.setHeight(qRound(sf*normalizedSize.height()));
-
-	if (normalizedSize != imgSize)
-		size.transpose();
-
-	return true;
+    return true;
 }
 
+bool DkBatchTransform::prepareProperties(const QSize &imgSize, QSize &size, float &scaleFactor, QStringList &logStrings) const
+{
+    float sf = 1.0f;
+    QSize normalizedSize = imgSize;
 
+    if (mResizeMode == resize_mode_default) {
+        scaleFactor = mResizeScaleFactor;
+        return true;
+    } else if (mResizeMode == resize_mode_long_side) {
+        if (imgSize.width() < imgSize.height())
+            normalizedSize.transpose();
+    } else if (mResizeMode == resize_mode_short_side) {
+        if (imgSize.width() > imgSize.height())
+            normalizedSize.transpose();
+    } else if (mResizeMode == resize_mode_height)
+        normalizedSize.transpose();
+
+    sf = mResizeScaleFactor / normalizedSize.width();
+
+    if (sf > 1.0 && mResizeProperty == resize_prop_decrease_only) {
+        logStrings.append(QObject::tr("%1 I need to increase the image size, but the option is set to 'decrease only' -> skipping.").arg(name()));
+        return false;
+    } else if (sf < 1.0f && mResizeProperty == resize_prop_increase_only) {
+        logStrings.append(QObject::tr("%1 I need to decrease the image size, but the option is set to 'increase only' -> skipping.").arg(name()));
+        return false;
+    } else if (sf == 1.0f) {
+        logStrings.append(QObject::tr("%1 image size matches scale factor -> skipping.").arg(name()));
+        return false;
+    }
+
+    size.setWidth(qRound(mResizeScaleFactor));
+    size.setHeight(qRound(sf * normalizedSize.height()));
+
+    if (normalizedSize != imgSize)
+        size.transpose();
+
+    return true;
+}
 
 // DkManipulatorBatch --------------------------------------------------------------------
-DkManipulatorBatch::DkManipulatorBatch() {
-
+DkManipulatorBatch::DkManipulatorBatch()
+{
 }
 
-void DkManipulatorBatch::saveSettings(QSettings & settings) const {
-
-	settings.beginGroup(settingsName());
-	mManager.saveSettings(settings);
-	settings.endGroup();
+void DkManipulatorBatch::saveSettings(QSettings &settings) const
+{
+    settings.beginGroup(settingsName());
+    mManager.saveSettings(settings);
+    settings.endGroup();
 }
 
-void DkManipulatorBatch::loadSettings(QSettings & settings) {
-
-	settings.beginGroup(settingsName());
-	mManager.loadSettings(settings);
-	settings.endGroup();
+void DkManipulatorBatch::loadSettings(QSettings &settings)
+{
+    settings.beginGroup(settingsName());
+    mManager.loadSettings(settings);
+    settings.endGroup();
 }
 
-void DkManipulatorBatch::setProperties(const DkManipulatorManager& manager) {
-	mManager = manager;
+void DkManipulatorBatch::setProperties(const DkManipulatorManager &manager)
+{
+    mManager = manager;
 }
 
-bool DkManipulatorBatch::compute(QSharedPointer<DkImageContainer> container, QStringList & logStrings) const {
+bool DkManipulatorBatch::compute(QSharedPointer<DkImageContainer> container, QStringList &logStrings) const
+{
+    if (!isActive()) {
+        logStrings.append(QObject::tr("%1 inactive -> skipping").arg(name()));
+        return true;
+    }
 
-	if (!isActive()) {
-		logStrings.append(QObject::tr("%1 inactive -> skipping").arg(name()));
-		return true;
-	}
+    if (container && container->hasImage()) {
+        for (const QSharedPointer<DkBaseManipulator> &mpl : mManager.manipulators()) {
+            if (mpl->isSelected()) {
+                QImage img = mpl->apply(container->image());
+                if (!img.isNull()) {
+                    container->setImage(img, mpl->name());
+                    logStrings.append(QObject::tr("%1 %2 applied.").arg(name()).arg(mpl->name()));
+                } else
+                    logStrings.append(QObject::tr("%1 Cannot apply %2.").arg(name()).arg(mpl->name()));
+            }
+        }
+    }
 
-	if (container && container->hasImage()) {
-		for (const QSharedPointer<DkBaseManipulator>& mpl : mManager.manipulators()) {
+    if (!container || !container->hasImage()) {
+        logStrings.append(QObject::tr("%1 error, could not apply image adjustments.").arg(name()));
+        return false;
+    }
 
-			if (mpl->isSelected()) {
-				QImage img = mpl->apply(container->image());
-				if (!img.isNull()) {
-					container->setImage(img, mpl->name());
-					logStrings.append(QObject::tr("%1 %2 applied.").arg(name()).arg(mpl->name()));
-				}
-				else
-					logStrings.append(QObject::tr("%1 Cannot apply %2.").arg(name()).arg(mpl->name()));
-			}
-		}
-	}
-	
-	if (!container || !container->hasImage()) {
-		logStrings.append(QObject::tr("%1 error, could not apply image adjustments.").arg(name()));
-		return false;
-	}
-
-	return true;
+    return true;
 }
 
-QString DkManipulatorBatch::name() const {
-	return QObject::tr("[Adjustment Batch]");
+QString DkManipulatorBatch::name() const
+{
+    return QObject::tr("[Adjustment Batch]");
 }
 
-bool DkManipulatorBatch::isActive() const {
-	return mManager.numSelected() > 0;
+bool DkManipulatorBatch::isActive() const
+{
+    return mManager.numSelected() > 0;
 }
 
-DkManipulatorManager DkManipulatorBatch::manager() const {
-	return mManager;
+DkManipulatorManager DkManipulatorBatch::manager() const
+{
+    return mManager;
 }
 
 #ifdef WITH_PLUGINS
 // DkPluginBatch --------------------------------------------------------------------
-DkPluginBatch::DkPluginBatch() {
+DkPluginBatch::DkPluginBatch()
+{
 }
 
-void DkPluginBatch::setProperties(const QStringList & pluginList) {
-	mPluginList = pluginList;
+void DkPluginBatch::setProperties(const QStringList &pluginList)
+{
+    mPluginList = pluginList;
 }
 
-void DkPluginBatch::saveSettings(QSettings & settings) const {
-
-	settings.beginGroup(settingsName());
-	settings.setValue("pluginList", mPluginList.join(";"));
+void DkPluginBatch::saveSettings(QSettings &settings) const
+{
+    settings.beginGroup(settingsName());
+    settings.setValue("pluginList", mPluginList.join(";"));
 
-	for (const QSharedPointer<DkPluginContainer> plugin : mPlugins) {
+    for (const QSharedPointer<DkPluginContainer> plugin : mPlugins) {
+        if (!plugin)
+            continue;
 
-		if (!plugin)
-			continue;
+        DkBatchPluginInterface *bPlugin = plugin->batchPlugin();
 
-		DkBatchPluginInterface* bPlugin = plugin->batchPlugin();
-		
-		if (bPlugin) {
-			bPlugin->saveSettings(settings);
-		}
-		else
-			qWarning() << "Illegal plugin detected: " << plugin->pluginName();
-	}
+        if (bPlugin) {
+            bPlugin->saveSettings(settings);
+        } else
+            qWarning() << "Illegal plugin detected: " << plugin->pluginName();
+    }
 
-	settings.endGroup();
+    settings.endGroup();
 }
 
-void DkPluginBatch::loadSettings(QSettings & settings) {
+void DkPluginBatch::loadSettings(QSettings &settings)
+{
+    settings.beginGroup(settingsName());
+    mPluginList = settings.value("pluginList", mPluginList).toString().split(";");
 
-	settings.beginGroup(settingsName());
-	mPluginList = settings.value("pluginList", mPluginList).toString().split(";");
+    loadAllPlugins();
 
-	loadAllPlugins();
+    for (QSharedPointer<DkPluginContainer> plugin : mPlugins) {
+        if (!plugin)
+            continue;
 
-	for (QSharedPointer<DkPluginContainer> plugin : mPlugins) {
+        DkBatchPluginInterface *bPlugin = plugin->batchPlugin();
 
-		if (!plugin)
-			continue;
+        if (bPlugin) {
+            assert(bPlugin);
+            bPlugin->loadSettings(settings);
+        }
+    }
 
-		DkBatchPluginInterface* bPlugin = plugin->batchPlugin();
-		
-		if (bPlugin) {
-			assert(bPlugin);
-			bPlugin->loadSettings(settings);
-		}
-	}
-
-	settings.endGroup();
+    settings.endGroup();
 }
 
-
-void DkPluginBatch::preLoad() {
-
-	loadAllPlugins();
+void DkPluginBatch::preLoad()
+{
+    loadAllPlugins();
 }
 
-void DkPluginBatch::postLoad(const QVector<QSharedPointer<DkBatchInfo> >& batchInfo) const {
-
-	for (int idx = 0; idx < mPlugins.size(); idx++) {
+void DkPluginBatch::postLoad(const QVector<QSharedPointer<DkBatchInfo>> &batchInfo) const
+{
+    for (int idx = 0; idx < mPlugins.size(); idx++) {
+        QSharedPointer<DkPluginContainer> pluginContainer = mPlugins[idx];
+        QString runID = mRunIDs[idx];
 
-		QSharedPointer<DkPluginContainer> pluginContainer = mPlugins[idx];
-		QString runID = mRunIDs[idx];
+        if (pluginContainer) {
+            // get plugin
+            DkBatchPluginInterface *plugin = pluginContainer->batchPlugin();
 
-		if (pluginContainer) {
-	
-			// get plugin
-			DkBatchPluginInterface* plugin = pluginContainer->batchPlugin();
+            qDebug() << "[POST LOAD]" << pluginContainer->pluginName() << "id:" << runID;
+            QVector<QSharedPointer<DkBatchInfo>> fInfos = DkBatchInfo::filter(batchInfo, runID);
 
-			qDebug() << "[POST LOAD]" << pluginContainer->pluginName() << "id:" << runID;
-			QVector<QSharedPointer<DkBatchInfo> > fInfos = DkBatchInfo::filter(batchInfo, runID);
-
-			// check if it is ok
-			if (plugin) {
-				plugin->postLoadPlugin(fInfos);
-			}
-		}
-	}
+            // check if it is ok
+            if (plugin) {
+                plugin->postLoadPlugin(fInfos);
+            }
+        }
+    }
 }
 
-bool DkPluginBatch::compute(
-	QSharedPointer<DkImageContainer> container, 
-	const DkSaveInfo& saveInfo,
-	QStringList& logStrings, 
-	QVector<QSharedPointer<DkBatchInfo> >& batchInfos) const {
-
-	if (!isActive()) {
-		logStrings.append(QObject::tr("%1 inactive -> skipping").arg(name()));
-		return true;
-	}
+bool DkPluginBatch::compute(QSharedPointer<DkImageContainer> container,
+                            const DkSaveInfo &saveInfo,
+                            QStringList &logStrings,
+                            QVector<QSharedPointer<DkBatchInfo>> &batchInfos) const
+{
+    if (!isActive()) {
+        logStrings.append(QObject::tr("%1 inactive -> skipping").arg(name()));
+        return true;
+    }
 
-	for (int idx = 0; idx < mPlugins.size(); idx++) {
+    for (int idx = 0; idx < mPlugins.size(); idx++) {
+        QSharedPointer<DkPluginContainer> pluginContainer = mPlugins[idx];
+        QString runID = mRunIDs[idx];
 
-		QSharedPointer<DkPluginContainer> pluginContainer = mPlugins[idx];
-		QString runID = mRunIDs[idx];
+        if (pluginContainer) {
+            // get plugin
+            DkPluginInterface *plugin = pluginContainer->plugin();
 
-		if (pluginContainer) {
-			// get plugin
-			DkPluginInterface* plugin = pluginContainer->plugin();
+            // check if it is ok
+            if (plugin && (plugin->interfaceType() == DkPluginInterface::interface_basic || plugin->interfaceType() == DkPluginInterface::interface_batch)) {
+                // apply the plugin
+                QSharedPointer<DkImageContainer> result;
 
-			// check if it is ok
-			if ( plugin && 
-				(plugin->interfaceType() == DkPluginInterface::interface_basic || 
-				 plugin->interfaceType() == DkPluginInterface::interface_batch)) {
+                if (plugin->interfaceType() == DkPluginInterface::interface_basic)
+                    result = plugin->runPlugin(runID, container);
+                else if (plugin->interfaceType() == DkPluginInterface::interface_batch) {
+                    DkBatchPluginInterface *bPlugin = pluginContainer->batchPlugin();
+                    QSharedPointer<DkBatchInfo> info;
 
-				// apply the plugin
-				QSharedPointer<DkImageContainer> result;
-				
-				if (plugin->interfaceType() == DkPluginInterface::interface_basic)
-					result = plugin->runPlugin(runID, container);
-				else if (plugin->interfaceType() == DkPluginInterface::interface_batch) {
+                    if (bPlugin)
+                        result = bPlugin->runPlugin(runID, container, saveInfo, info);
+                    else
+                        logStrings.append(QObject::tr("%1 Cannot cast batch plugin %2.").arg(name()).arg(pluginContainer->pluginName()));
 
-					DkBatchPluginInterface* bPlugin = pluginContainer->batchPlugin();
-					QSharedPointer<DkBatchInfo> info;
+                    batchInfos << info;
+                }
 
-					if (bPlugin)
-						result = bPlugin->runPlugin(runID, container, saveInfo, info);
-					else 
-						logStrings.append(QObject::tr("%1 Cannot cast batch plugin %2.").arg(name()).arg(pluginContainer->pluginName()));
+                if (result && result->hasImage())
+                    container = result;
+                else
+                    logStrings.append(QObject::tr("%1 Cannot apply %2.").arg(name()).arg(pluginContainer->pluginName()));
+            } else
+                logStrings.append(QObject::tr("%1 illegal plugin interface: %2").arg(name()).arg(pluginContainer->pluginName()));
+        } else
+            logStrings.append(QObject::tr("%1 Cannot apply plugin because it is NULL.").arg(name()));
+    }
 
-					batchInfos << info;
-				}
+    if (!container || !container->hasImage()) {
+        logStrings.append(QObject::tr("%1 error, could not apply plugins.").arg(name()));
+        return false;
+    } else
+        logStrings.append(QObject::tr("%1 plugins applied.").arg(name()));
 
-				if (result && result->hasImage())
-					container = result;
-				else
-					logStrings.append(QObject::tr("%1 Cannot apply %2.").arg(name()).arg(pluginContainer->pluginName()));
-			}
-			else
-				logStrings.append(QObject::tr("%1 illegal plugin interface: %2").arg(name()).arg(pluginContainer->pluginName()));
-		}
-		else 
-			logStrings.append(QObject::tr("%1 Cannot apply plugin because it is NULL.").arg(name()));
-	}
-
-	if (!container || !container->hasImage()) {
-		logStrings.append(QObject::tr("%1 error, could not apply plugins.").arg(name()));
-		return false;
-	}
-	else
-		logStrings.append(QObject::tr("%1 plugins applied.").arg(name()));
-
-	return true;
+    return true;
 }
 
-QString DkPluginBatch::name() const {
-	return QObject::tr("[Plugin Batch]");
+QString DkPluginBatch::name() const
+{
+    return QObject::tr("[Plugin Batch]");
 }
 
-bool DkPluginBatch::isActive() const {
-	
-	return !mPluginList.empty();
+bool DkPluginBatch::isActive() const
+{
+    return !mPluginList.empty();
 }
 
-QStringList DkPluginBatch::pluginList() const {
-	return mPluginList;
+QStringList DkPluginBatch::pluginList() const
+{
+    return mPluginList;
 }
 
-void DkPluginBatch::loadAllPlugins() {
-
-	// already loaded?
-	if (mPlugins.size() == mPluginList.size())
-		return;
-
-	// manager cares that they are not loaded twice
-	// we need to load them here for CMD inputs
-	DkPluginManager::instance().loadPlugins();
+void DkPluginBatch::loadAllPlugins()
+{
+    // already loaded?
+    if (mPlugins.size() == mPluginList.size())
+        return;
 
-	QString runId;
+    // manager cares that they are not loaded twice
+    // we need to load them here for CMD inputs
+    DkPluginManager::instance().loadPlugins();
+
+    QString runId;
 
-	for (const QString& cPluginString : mPluginList) {
+    for (const QString &cPluginString : mPluginList) {
+        // load plugin
+        QSharedPointer<DkPluginContainer> pluginContainer;
+        QString runID;
+        loadPlugin(cPluginString, pluginContainer, runID);
+        mPlugins << pluginContainer; // also add the empty ones...
+        mRunIDs << runID;
 
-		// load plugin
-		QSharedPointer<DkPluginContainer> pluginContainer;
-		QString runID;
-		loadPlugin(cPluginString, pluginContainer, runID);
-		mPlugins << pluginContainer;	// also add the empty ones...
-		mRunIDs << runID;
+        if (pluginContainer) {
+            qDebug() << "loading" << pluginContainer->pluginName() << "id:" << runID;
+
+            // get plugin
+            DkBatchPluginInterface *plugin = pluginContainer->batchPlugin();
 
-		if (pluginContainer) {
-
-			qDebug() << "loading" << pluginContainer->pluginName() << "id:" << runID;
-
-			// get plugin
-			DkBatchPluginInterface* plugin = pluginContainer->batchPlugin();
-
-			// check if it is ok
-			if (plugin) {
-				plugin->preLoadPlugin();
-			}
-		}
-		else
-			qWarning() << "could not load: " << cPluginString;
-	}
+            // check if it is ok
+            if (plugin) {
+                plugin->preLoadPlugin();
+            }
+        } else
+            qWarning() << "could not load: " << cPluginString;
+    }
 }
 
-void DkPluginBatch::loadPlugin(const QString & pluginString, QSharedPointer<DkPluginContainer> & plugin, QString& runID) const {
-
-	QString uiSeparator = " | ";
+void DkPluginBatch::loadPlugin(const QString &pluginString, QSharedPointer<DkPluginContainer> &plugin, QString &runID) const
+{
+    QString uiSeparator = " | ";
 
-	QStringList ids = pluginString.split(uiSeparator);
+    QStringList ids = pluginString.split(uiSeparator);
 
-	if (ids.size() != 2) {
-		qWarning() << "plugin string does not match:" << pluginString;
-	}
-	else {
-		plugin = DkPluginManager::instance().getPluginByName(ids[0]);
+    if (ids.size() != 2) {
+        qWarning() << "plugin string does not match:" << pluginString;
+    } else {
+        plugin = DkPluginManager::instance().getPluginByName(ids[0]);
 
-		if (plugin)
-			runID = plugin->actionNameToRunId(ids[1]);
-	}
+        if (plugin)
+            runID = plugin->actionNameToRunId(ids[1]);
+    }
 }
 #endif
 
 // DkBatchProcess --------------------------------------------------------------------
-DkBatchProcess::DkBatchProcess(const DkSaveInfo& saveInfo) {
-	mSaveInfo = saveInfo;
+DkBatchProcess::DkBatchProcess(const DkSaveInfo &saveInfo)
+{
+    mSaveInfo = saveInfo;
 }
 
-void DkBatchProcess::setProcessChain(const QVector<QSharedPointer<DkAbstractBatch> > processes) {
-
-	mProcessFunctions = processes;
-}
-
-QString DkBatchProcess::inputFile() const {
-
-	return mSaveInfo.inputFilePath();
+void DkBatchProcess::setProcessChain(const QVector<QSharedPointer<DkAbstractBatch>> processes)
+{
+    mProcessFunctions = processes;
 }
 
-QString DkBatchProcess::outputFile() const {
-
-	return mSaveInfo.outputFilePath();
+QString DkBatchProcess::inputFile() const
+{
+    return mSaveInfo.inputFilePath();
 }
 
-QVector<QSharedPointer<DkBatchInfo> > DkBatchProcess::batchInfo() const {
-
-	return mInfos;
+QString DkBatchProcess::outputFile() const
+{
+    return mSaveInfo.outputFilePath();
 }
 
-bool DkBatchProcess::hasFailed() const {
-
-	return mFailure != 0;
-}
-
-bool DkBatchProcess::wasProcessed() const {
-	
-	return mIsProcessed;
-}
-
-bool DkBatchProcess::compute() {
-
-	mIsProcessed = true;
-
-	QFileInfo fInfoIn(mSaveInfo.inputFilePath());
-	QFileInfo fInfoOut(mSaveInfo.outputFilePath());
-
-	// check errors
-	if ((mSaveInfo.mode() & DkSaveInfo::mode_do_not_save_output) == 0 && // do not save is not set
-		(fInfoOut.exists() && mSaveInfo.mode() == DkSaveInfo::mode_skip_existing)) {
-		mLogStrings.append(QObject::tr("%1 already exists -> skipping (check 'overwrite' if you want to overwrite the file)").arg(mSaveInfo.outputFilePath()));
-		mFailure++;
-		return mFailure == 0;
-	}
-	else if (!fInfoIn.exists()) {
-		mLogStrings.append(QObject::tr("Error: input file does not exist"));
-		mLogStrings.append(QObject::tr("Input: %1").arg(mSaveInfo.inputFilePath()));
-		mFailure++;
-		return mFailure == 0;
-	}
-	else if (mSaveInfo.inputFilePath() == mSaveInfo.outputFilePath() && mProcessFunctions.empty()) {
-		mLogStrings.append(QObject::tr("Skipping: nothing to do here."));
-		mFailure++;
-		return mFailure == 0;
-	}
-	
-	// rename operation?
-	if (mProcessFunctions.empty() && 
-		mSaveInfo.inputFilePath() == mSaveInfo.outputFilePath() && 
-		fInfoIn.suffix() == fInfoOut.suffix()) {
-		if (!renameFile())
-			mFailure++;
-		return mFailure == 0;
-	}
-	// copy operation?
-	else if (mProcessFunctions.empty() && fInfoIn.suffix() == fInfoOut.suffix()) {
-		if (!copyFile())
-			mFailure++;
-		else
-			deleteOriginalFile();
-
-		return mFailure == 0;
-	}
-
-	// do the work
-	process();
-
-	// delete the original file if the user requested it
-	deleteOriginalFile();
-
-	return mFailure == 0;
+QVector<QSharedPointer<DkBatchInfo>> DkBatchProcess::batchInfo() const
+{
+    return mInfos;
 }
 
-QStringList DkBatchProcess::getLog() const {
-
-	return mLogStrings;
+bool DkBatchProcess::hasFailed() const
+{
+    return mFailure != 0;
 }
 
-bool DkBatchProcess::process() {
-
-	mLogStrings.append(QObject::tr("processing %1").arg(mSaveInfo.inputFilePath()));
-
-	QSharedPointer<DkImageContainer> imgC(new DkImageContainer(mSaveInfo.inputFilePath()));
-
-	if (!imgC->loadImage() || imgC->image().isNull()) {
-		mLogStrings.append(QObject::tr("Error while loading..."));
-		mFailure++;
-		return false;
-	}
-
-	for (QSharedPointer<DkAbstractBatch> batch : mProcessFunctions) {
-
-		if (!batch) {
-			mLogStrings.append(QObject::tr("Error: cannot process a NULL function."));
-			continue;
-		}
-
-		QVector<QSharedPointer<DkBatchInfo> > cInfos;
-		if (!batch->compute(imgC, mSaveInfo, mLogStrings, cInfos)) {
-			mLogStrings.append(QObject::tr("%1 failed").arg(batch->name()));
-			mFailure++;
-		}
-
-		mInfos << cInfos;
-	}
-
-	// report we could not back-up & break here
-	if (!prepareDeleteExisting()) {
-		mFailure++;
-		return false;
-	}
-
-	// early break
-	if (mSaveInfo.mode() & DkSaveInfo::mode_do_not_save_output) {
-		mLogStrings.append(QObject::tr("%1 not saved - option 'Do not Save' is checked...").arg(mSaveInfo.outputFilePath()));
-		return true;
-	}
-
-	// udpate metadata
-	if (updateMetaData(imgC->getMetaData().data()))
-		mLogStrings.append(QObject::tr("Original filename added to Exif"));
-
-	// save the image
-	if (imgC->saveImage(mSaveInfo.outputFilePath(), mSaveInfo.compression())) {
-		mLogStrings.append(QObject::tr("%1 saved...").arg(mSaveInfo.outputFilePath()));
-	}
-	else {
-		mLogStrings.append(QObject::tr("Could not save: %1").arg(mSaveInfo.outputFilePath()));
-		mFailure++;
-	}
-
-	if (!deleteOrRestoreExisting()) {
-		mFailure++;
-		return false;
-	}
-
-	return true;
+bool DkBatchProcess::wasProcessed() const
+{
+    return mIsProcessed;
 }
 
-bool DkBatchProcess::renameFile() {
+bool DkBatchProcess::compute()
+{
+    mIsProcessed = true;
 
-	if (QFileInfo(mSaveInfo.outputFilePath()).exists()) {
-		mLogStrings.append(QObject::tr("Error: could not rename file, the target file exists already."));
-		return false;
-	}
+    QFileInfo fInfoIn(mSaveInfo.inputFilePath());
+    QFileInfo fInfoOut(mSaveInfo.outputFilePath());
 
-	QFile file(mSaveInfo.inputFilePath());
+    // check errors
+    if ((mSaveInfo.mode() & DkSaveInfo::mode_do_not_save_output) == 0 && // do not save is not set
+        (fInfoOut.exists() && mSaveInfo.mode() == DkSaveInfo::mode_skip_existing)) {
+        mLogStrings.append(QObject::tr("%1 already exists -> skipping (check 'overwrite' if you want to overwrite the file)").arg(mSaveInfo.outputFilePath()));
+        mFailure++;
+        return mFailure == 0;
+    } else if (!fInfoIn.exists()) {
+        mLogStrings.append(QObject::tr("Error: input file does not exist"));
+        mLogStrings.append(QObject::tr("Input: %1").arg(mSaveInfo.inputFilePath()));
+        mFailure++;
+        return mFailure == 0;
+    } else if (mSaveInfo.inputFilePath() == mSaveInfo.outputFilePath() && mProcessFunctions.empty()) {
+        mLogStrings.append(QObject::tr("Skipping: nothing to do here."));
+        mFailure++;
+        return mFailure == 0;
+    }
 
-	QSharedPointer<DkMetaDataT> md(new DkMetaDataT());
-	md->readMetaData(mSaveInfo.inputFilePath());
+    // rename operation?
+    if (mProcessFunctions.empty() && mSaveInfo.inputFilePath() == mSaveInfo.outputFilePath() && fInfoIn.suffix() == fInfoOut.suffix()) {
+        if (!renameFile())
+            mFailure++;
+        return mFailure == 0;
+    }
+    // copy operation?
+    else if (mProcessFunctions.empty() && fInfoIn.suffix() == fInfoOut.suffix()) {
+        if (!copyFile())
+            mFailure++;
+        else
+            deleteOriginalFile();
+
+        return mFailure == 0;
+    }
 
-	if (updateMetaData(md.data())) {
-		if (md->saveMetaData(mSaveInfo.inputFilePath()))
-			mLogStrings.append(QObject::tr("Original filename added to Exif"));
-	}
+    // do the work
+    process();
 
-	// Note: if two images are renamed at the same time to the same name, one image is lost -> see Qt comment Race Condition
-	if (!file.rename(mSaveInfo.outputFilePath())) {
-		mLogStrings.append(QObject::tr("Error: could not rename file"));
-		mLogStrings.append(file.errorString());
-		return false;
-	}
-	else
-		mLogStrings.append(QObject::tr("Renaming: %1 -> %2").arg(mSaveInfo.inputFilePath()).arg(mSaveInfo.outputFilePath()));
+    // delete the original file if the user requested it
+    deleteOriginalFile();
 
-	return true;
+    return mFailure == 0;
 }
 
-bool DkBatchProcess::updateMetaData(DkMetaDataT * md) {
-	
-	if (!md)
-		return false;
-
-	if (!md->isLoaded())
-		return false;
-
-	QString ifn = mSaveInfo.inputFileInfo().fileName();
-	if (ifn != mSaveInfo.outputFileInfo().fileName() &&
-		md->getExifValue("ImageDescription").isEmpty()) {
-
-		if (md->setExifValue("Exif.Image.ImageDescription", ifn))
-			return true;
-	}
-
-	return false;
+QStringList DkBatchProcess::getLog() const
+{
+    return mLogStrings;
 }
 
-bool DkBatchProcess::copyFile() {
+bool DkBatchProcess::process()
+{
+    mLogStrings.append(QObject::tr("processing %1").arg(mSaveInfo.inputFilePath()));
 
-	QFile file(mSaveInfo.inputFilePath());
+    QSharedPointer<DkImageContainer> imgC(new DkImageContainer(mSaveInfo.inputFilePath()));
 
-	if (mSaveInfo.mode() == DkSaveInfo::mode_do_not_save_output) {
-		mLogStrings.append(QObject::tr("I should copy the file, but 'Do not Save' is checked - so I will do nothing..."));
-		return false;
-	}
+    if (!imgC->loadImage() || imgC->image().isNull()) {
+        mLogStrings.append(QObject::tr("Error while loading..."));
+        mFailure++;
+        return false;
+    }
 
-	// report we could not back-up & break here
-	if (!prepareDeleteExisting()) {
-		mFailure++;
-		return false;
-	}
+    for (QSharedPointer<DkAbstractBatch> batch : mProcessFunctions) {
+        if (!batch) {
+            mLogStrings.append(QObject::tr("Error: cannot process a NULL function."));
+            continue;
+        }
 
-	QSharedPointer<DkMetaDataT> md(new DkMetaDataT());
-	md->readMetaData(mSaveInfo.inputFilePath());
+        QVector<QSharedPointer<DkBatchInfo>> cInfos;
+        if (!batch->compute(imgC, mSaveInfo, mLogStrings, cInfos)) {
+            mLogStrings.append(QObject::tr("%1 failed").arg(batch->name()));
+            mFailure++;
+        }
 
-	bool exifUpdated = updateMetaData(md.data());
+        mInfos << cInfos;
+    }
+
+    // report we could not back-up & break here
+    if (!prepareDeleteExisting()) {
+        mFailure++;
+        return false;
+    }
+
+    // early break
+    if (mSaveInfo.mode() & DkSaveInfo::mode_do_not_save_output) {
+        mLogStrings.append(QObject::tr("%1 not saved - option 'Do not Save' is checked...").arg(mSaveInfo.outputFilePath()));
+        return true;
+    }
+
+    // udpate metadata
+    if (updateMetaData(imgC->getMetaData().data()))
+        mLogStrings.append(QObject::tr("Original filename added to Exif"));
+
+    // save the image
+    if (imgC->saveImage(mSaveInfo.outputFilePath(), mSaveInfo.compression())) {
+        mLogStrings.append(QObject::tr("%1 saved...").arg(mSaveInfo.outputFilePath()));
+    } else {
+        mLogStrings.append(QObject::tr("Could not save: %1").arg(mSaveInfo.outputFilePath()));
+        mFailure++;
+    }
+
+    if (!deleteOrRestoreExisting()) {
+        mFailure++;
+        return false;
+    }
+
+    return true;
+}
+
+bool DkBatchProcess::renameFile()
+{
+    if (QFileInfo(mSaveInfo.outputFilePath()).exists()) {
+        mLogStrings.append(QObject::tr("Error: could not rename file, the target file exists already."));
+        return false;
+    }
+
+    QFile file(mSaveInfo.inputFilePath());
+
+    QSharedPointer<DkMetaDataT> md(new DkMetaDataT());
+    md->readMetaData(mSaveInfo.inputFilePath());
+
+    if (updateMetaData(md.data())) {
+        if (md->saveMetaData(mSaveInfo.inputFilePath()))
+            mLogStrings.append(QObject::tr("Original filename added to Exif"));
+    }
 
-	if (!file.copy(mSaveInfo.outputFilePath())) {
-		mLogStrings.append(QObject::tr("Error: could not copy file"));
-		mLogStrings.append(QObject::tr("Input: %1").arg(mSaveInfo.inputFilePath()));
-		mLogStrings.append(QObject::tr("Output: %1").arg(mSaveInfo.outputFilePath()));
-		mLogStrings.append(file.errorString());
-		return false;
-	}
-	else {
-		if (exifUpdated && md->saveMetaData(mSaveInfo.outputFilePath()))
-			mLogStrings.append(QObject::tr("Original filename added to Exif"));
+    // Note: if two images are renamed at the same time to the same name, one image is lost -> see Qt comment Race Condition
+    if (!file.rename(mSaveInfo.outputFilePath())) {
+        mLogStrings.append(QObject::tr("Error: could not rename file"));
+        mLogStrings.append(file.errorString());
+        return false;
+    } else
+        mLogStrings.append(QObject::tr("Renaming: %1 -> %2").arg(mSaveInfo.inputFilePath()).arg(mSaveInfo.outputFilePath()));
 
-		mLogStrings.append(QObject::tr("Copying: %1 -> %2").arg(mSaveInfo.inputFilePath()).arg(mSaveInfo.outputFilePath()));
-	}
-
-	if (!deleteOrRestoreExisting()) {
-		mFailure++;
-		return false;
-	}
-
-	return true;
+    return true;
 }
 
-bool DkBatchProcess::prepareDeleteExisting() {
+bool DkBatchProcess::updateMetaData(DkMetaDataT *md)
+{
+    if (!md)
+        return false;
+
+    if (!md->isLoaded())
+        return false;
+
+    QString ifn = mSaveInfo.inputFileInfo().fileName();
+    if (ifn != mSaveInfo.outputFileInfo().fileName() && md->getExifValue("ImageDescription").isEmpty()) {
+        if (md->setExifValue("Exif.Image.ImageDescription", ifn))
+            return true;
+    }
+
+    return false;
+}
+
+bool DkBatchProcess::copyFile()
+{
+    QFile file(mSaveInfo.inputFilePath());
+
+    if (mSaveInfo.mode() == DkSaveInfo::mode_do_not_save_output) {
+        mLogStrings.append(QObject::tr("I should copy the file, but 'Do not Save' is checked - so I will do nothing..."));
+        return false;
+    }
+
+    // report we could not back-up & break here
+    if (!prepareDeleteExisting()) {
+        mFailure++;
+        return false;
+    }
+
+    QSharedPointer<DkMetaDataT> md(new DkMetaDataT());
+    md->readMetaData(mSaveInfo.inputFilePath());
+
+    bool exifUpdated = updateMetaData(md.data());
+
+    if (!file.copy(mSaveInfo.outputFilePath())) {
+        mLogStrings.append(QObject::tr("Error: could not copy file"));
+        mLogStrings.append(QObject::tr("Input: %1").arg(mSaveInfo.inputFilePath()));
+        mLogStrings.append(QObject::tr("Output: %1").arg(mSaveInfo.outputFilePath()));
+        mLogStrings.append(file.errorString());
+        return false;
+    } else {
+        if (exifUpdated && md->saveMetaData(mSaveInfo.outputFilePath()))
+            mLogStrings.append(QObject::tr("Original filename added to Exif"));
+
+        mLogStrings.append(QObject::tr("Copying: %1 -> %2").arg(mSaveInfo.inputFilePath()).arg(mSaveInfo.outputFilePath()));
+    }
+
+    if (!deleteOrRestoreExisting()) {
+        mFailure++;
+        return false;
+    }
 
-	if (QFileInfo(mSaveInfo.outputFilePath()).exists() && mSaveInfo.mode() == DkSaveInfo::mode_overwrite) {
+    return true;
+}
+
+bool DkBatchProcess::prepareDeleteExisting()
+{
+    if (QFileInfo(mSaveInfo.outputFilePath()).exists() && mSaveInfo.mode() == DkSaveInfo::mode_overwrite) {
+        mSaveInfo.createBackupFilePath();
 
-		mSaveInfo.createBackupFilePath();
+        // check the uniqueness : )
+        if (QFileInfo(mSaveInfo.backupFilePath()).exists()) {
+            mLogStrings.append(QObject::tr("Error: back-up (%1) file already exists").arg(mSaveInfo.backupFilePath()));
+            mSaveInfo.clearBackupFilePath();
+            return false;
+        }
 
-		// check the uniqueness : )
-		if (QFileInfo(mSaveInfo.backupFilePath()).exists()) {
-			mLogStrings.append(QObject::tr("Error: back-up (%1) file already exists").arg(mSaveInfo.backupFilePath()));
-			mSaveInfo.clearBackupFilePath();
-			return false;
-		}
+        QFile file(mSaveInfo.outputFilePath());
 
-		QFile file(mSaveInfo.outputFilePath());
+        if (!file.rename(mSaveInfo.backupFilePath())) {
+            mLogStrings.append(QObject::tr("Error: could not rename existing file to %1").arg(mSaveInfo.backupFilePath()));
+            mLogStrings.append(file.errorString());
+            mSaveInfo.clearBackupFilePath();
+            return false;
+        }
+    }
 
-		if (!file.rename(mSaveInfo.backupFilePath())) {
-			mLogStrings.append(QObject::tr("Error: could not rename existing file to %1").arg(mSaveInfo.backupFilePath()));
-			mLogStrings.append(file.errorString());
-			mSaveInfo.clearBackupFilePath();
-			return false;
-		}
-	}
-
-	return true;
-}
+    return true;
+}
 
-bool DkBatchProcess::deleteOrRestoreExisting() {
+bool DkBatchProcess::deleteOrRestoreExisting()
+{
+    QFileInfo outInfo(mSaveInfo.outputFilePath());
 
-	QFileInfo outInfo(mSaveInfo.outputFilePath());
+    if (outInfo.exists() && !mSaveInfo.backupFilePath().isEmpty() && mSaveInfo.backupFileInfo().exists()) {
+        QFile file(mSaveInfo.backupFilePath());
+
+        if (!file.remove()) {
+            mLogStrings.append(QObject::tr("Error: could not delete existing file"));
+            mLogStrings.append(file.errorString());
+            return false;
+        }
+    }
+    // fall-back
+    else if (!outInfo.exists()) {
+        QFile file(mSaveInfo.backupFilePath());
 
-	if (outInfo.exists() && !mSaveInfo.backupFilePath().isEmpty() && mSaveInfo.backupFileInfo().exists()) {
-		QFile file(mSaveInfo.backupFilePath());
-
-		if (!file.remove()) {
-			mLogStrings.append(QObject::tr("Error: could not delete existing file"));
-			mLogStrings.append(file.errorString());
-			return false;
-		}
-	}
-	// fall-back
-	else if (!outInfo.exists()) {
-		
-		QFile file(mSaveInfo.backupFilePath());
-
-		if (!file.rename(mSaveInfo.outputFilePath())) {
-			mLogStrings.append(QObject::tr("Ui - a lot of things went wrong. Your original file can be found here: %1").arg(mSaveInfo.backupFilePath()));
-			mLogStrings.append(file.errorString());
-			return false;
-		}
-		else {
-			mLogStrings.append(QObject::tr("I could not save to %1 so I restored the original file.").arg(mSaveInfo.outputFilePath()));
-		}
-	}
-
-	return true;
+        if (!file.rename(mSaveInfo.outputFilePath())) {
+            mLogStrings.append(QObject::tr("Ui - a lot of things went wrong. Your original file can be found here: %1").arg(mSaveInfo.backupFilePath()));
+            mLogStrings.append(file.errorString());
+            return false;
+        } else {
+            mLogStrings.append(QObject::tr("I could not save to %1 so I restored the original file.").arg(mSaveInfo.outputFilePath()));
+        }
+    }
+
+    return true;
 }
 
-bool DkBatchProcess::deleteOriginalFile() {
-
-	if (mSaveInfo.inputFilePath() == mSaveInfo.outputFilePath())
-		return true;
-
-	if (!mFailure && mSaveInfo.isDeleteOriginal()) {
-		QFile oFile(mSaveInfo.inputFilePath());
-
-		if (oFile.remove())
-			mLogStrings.append(QObject::tr("%1 deleted.").arg(mSaveInfo.inputFilePath()));
-		else {
-			mFailure++;
-			mLogStrings.append(QObject::tr("I could not delete %1").arg(mSaveInfo.inputFilePath()));
-			return false;
-		}
-	}
-	else if (mFailure)
-		mLogStrings.append(QObject::tr("I did not delete the original because I detected %1 failure(s).").arg(mFailure));
-
-	return true;
+bool DkBatchProcess::deleteOriginalFile()
+{
+    if (mSaveInfo.inputFilePath() == mSaveInfo.outputFilePath())
+        return true;
+
+    if (!mFailure && mSaveInfo.isDeleteOriginal()) {
+        QFile oFile(mSaveInfo.inputFilePath());
+
+        if (oFile.remove())
+            mLogStrings.append(QObject::tr("%1 deleted.").arg(mSaveInfo.inputFilePath()));
+        else {
+            mFailure++;
+            mLogStrings.append(QObject::tr("I could not delete %1").arg(mSaveInfo.inputFilePath()));
+            return false;
+        }
+    } else if (mFailure)
+        mLogStrings.append(QObject::tr("I did not delete the original because I detected %1 failure(s).").arg(mFailure));
+
+    return true;
 }
 
 // DkBatchConfig --------------------------------------------------------------------
-DkBatchConfig::DkBatchConfig(const QStringList& fileList, const QString& outputDir, const QString& fileNamePattern) {
-
-	mFileList = fileList;
-	mOutputDirPath = outputDir;
-	mFileNamePattern = fileNamePattern;
-	
+DkBatchConfig::DkBatchConfig(const QStringList &fileList, const QString &outputDir, const QString &fileNamePattern)
+{
+    mFileList = fileList;
+    mOutputDirPath = outputDir;
+    mFileNamePattern = fileNamePattern;
 }
 
-bool DkBatchConfig::isOk() const {
-
-	if (mOutputDirPath.isEmpty())
-		return false;
+bool DkBatchConfig::isOk() const
+{
+    if (mOutputDirPath.isEmpty())
+        return false;
 
-	QDir oDir(mOutputDirPath);
+    QDir oDir(mOutputDirPath);
 
-	if (!oDir.exists()) {
-		if (!oDir.mkpath("."))
-			return false;	// output dir does not exist & I cannot create it
-	}
+    if (!oDir.exists()) {
+        if (!oDir.mkpath("."))
+            return false; // output dir does not exist & I cannot create it
+    }
 
-	if (mFileList.empty())
-		return false;
+    if (mFileList.empty())
+        return false;
 
-	if (mFileNamePattern.isEmpty())
-		return false;
+    if (mFileNamePattern.isEmpty())
+        return false;
 
-	return true;
+    return true;
 }
 
-
 // DkBatchProcessing --------------------------------------------------------------------
-DkBatchProcessing::DkBatchProcessing(const DkBatchConfig& config, QWidget* parent /*= 0*/) : QObject(parent) {
-
-	mBatchConfig = config;
+DkBatchProcessing::DkBatchProcessing(const DkBatchConfig &config, QWidget *parent /*= 0*/)
+    : QObject(parent)
+{
+    mBatchConfig = config;
 
-	connect(&mBatchWatcher, SIGNAL(progressValueChanged(int)), this, SIGNAL(progressValueChanged(int)));
-	connect(&mBatchWatcher, SIGNAL(finished()), this, SIGNAL(finished()));
+    connect(&mBatchWatcher, SIGNAL(progressValueChanged(int)), this, SIGNAL(progressValueChanged(int)));
+    connect(&mBatchWatcher, SIGNAL(finished()), this, SIGNAL(finished()));
 }
 
-void DkBatchProcessing::init() {
+void DkBatchProcessing::init()
+{
+    mBatchItems.clear();
 
-	mBatchItems.clear();
-	
-	QStringList fileList = mBatchConfig.getFileList();
+    QStringList fileList = mBatchConfig.getFileList();
 
-	for (int idx = 0; idx < fileList.size(); idx++) {
+    for (int idx = 0; idx < fileList.size(); idx++) {
+        DkSaveInfo si = mBatchConfig.saveInfo();
 
-		DkSaveInfo si = mBatchConfig.saveInfo();
+        QFileInfo cFileInfo = QFileInfo(fileList.at(idx));
+        QString outDir = si.isInputDirOutputDir() ? cFileInfo.absolutePath() : mBatchConfig.getOutputDirPath();
 
-		QFileInfo cFileInfo = QFileInfo(fileList.at(idx));
-		QString outDir = si.isInputDirOutputDir() ? cFileInfo.absolutePath() : mBatchConfig.getOutputDirPath();
+        DkFileNameConverter converter(cFileInfo.fileName(), mBatchConfig.getFileNamePattern(), idx);
+        QString outputFilePath = QFileInfo(outDir, converter.getConvertedFileName()).absoluteFilePath();
 
-		DkFileNameConverter converter(cFileInfo.fileName(), mBatchConfig.getFileNamePattern(), idx);
-		QString outputFilePath = QFileInfo(outDir, converter.getConvertedFileName()).absoluteFilePath();
+        // set input/output file path
+        si.setInputFilePath(fileList.at(idx));
+        si.setOutputFilePath(outputFilePath);
 
-		// set input/output file path
-		si.setInputFilePath(fileList.at(idx));
-		si.setOutputFilePath(outputFilePath);
+        DkBatchProcess cProcess(si);
+        cProcess.setProcessChain(mBatchConfig.getProcessFunctions());
 
-		DkBatchProcess cProcess(si);
-		cProcess.setProcessChain(mBatchConfig.getProcessFunctions());
-
-		mBatchItems.push_back(cProcess);
-	}
+        mBatchItems.push_back(cProcess);
+    }
 }
 
-void DkBatchConfig::saveSettings(QSettings & settings) const {
-
-	settings.beginGroup("General");		// this general group could be removed in future releases
-	settings.setValue("FileList", mFileList.join(";"));
-	settings.setValue("OutputDirPath", mOutputDirPath);
-	settings.setValue("FileNamePattern", mFileNamePattern);
+void DkBatchConfig::saveSettings(QSettings &settings) const
+{
+    settings.beginGroup("General"); // this general group could be removed in future releases
+    settings.setValue("FileList", mFileList.join(";"));
+    settings.setValue("OutputDirPath", mOutputDirPath);
+    settings.setValue("FileNamePattern", mFileNamePattern);
 
-	mSaveInfo.saveSettings(settings);
+    mSaveInfo.saveSettings(settings);
 
-	for (auto pf : mProcessFunctions)
-		pf->saveSettings(settings);
+    for (auto pf : mProcessFunctions)
+        pf->saveSettings(settings);
 
-	settings.endGroup();
+    settings.endGroup();
 }
 
-void DkBatchConfig::loadSettings(QSettings & settings) {
+void DkBatchConfig::loadSettings(QSettings &settings)
+{
+    settings.beginGroup("General");
+    mFileList = settings.value("FileList", mFileList).toString().split(";");
+    mOutputDirPath = settings.value("OutputDirPath", mOutputDirPath).toString();
+    mFileNamePattern = settings.value("FileNamePattern", mFileNamePattern).toString();
 
-	settings.beginGroup("General");
-	mFileList = settings.value("FileList", mFileList).toString().split(";");
-	mOutputDirPath = settings.value("OutputDirPath", mOutputDirPath).toString();
-	mFileNamePattern = settings.value("FileNamePattern", mFileNamePattern).toString();
+    mSaveInfo.loadSettings(settings);
 
-	mSaveInfo.loadSettings(settings);
+    QStringList groups = settings.childGroups();
 
-	QStringList groups = settings.childGroups();
-	
-	for (const QString& name : groups) {
+    for (const QString &name : groups) {
+        // known groups that are not batch processes
+        if (name == "SaveInfo")
+            continue;
 
-		// known groups that are not batch processes
-		if (name == "SaveInfo")
-			continue;
+        QSharedPointer<DkAbstractBatch> batch = DkAbstractBatch::createFromName(name);
 
-		QSharedPointer<DkAbstractBatch> batch = DkAbstractBatch::createFromName(name);
+        // if it is valid - append the process
+        if (batch) {
+            batch->loadSettings(settings);
+            mProcessFunctions << batch;
+        }
+    }
 
-		// if it is valid - append the process
-		if (batch) {
-			batch->loadSettings(settings);
-			mProcessFunctions << batch;
-		}
-	}
+    for (auto pf : mProcessFunctions)
+        pf->saveSettings(settings);
 
-	for (auto pf : mProcessFunctions)
-		pf->saveSettings(settings);
-
-	settings.endGroup();
+    settings.endGroup();
 }
 
-void DkBatchProcessing::compute() {
-
-	init();
+void DkBatchProcessing::compute()
+{
+    init();
 
-	qDebug() << "computing...";
+    qDebug() << "computing...";
 
-	if (mBatchWatcher.isRunning())
-		mBatchWatcher.waitForFinished();
+    if (mBatchWatcher.isRunning())
+        mBatchWatcher.waitForFinished();
 
-	QFuture<void> future = QtConcurrent::map(mBatchItems, &nmc::DkBatchProcessing::computeItem);
-	mBatchWatcher.setFuture(future);
+    QFuture<void> future = QtConcurrent::map(mBatchItems, &nmc::DkBatchProcessing::computeItem);
+    mBatchWatcher.setFuture(future);
 }
 
-bool DkBatchProcessing::computeItem(DkBatchProcess& item) {
-
-	return item.compute();
+bool DkBatchProcessing::computeItem(DkBatchProcess &item)
+{
+    return item.compute();
 }
 
-void DkBatchProcessing::postLoad() {
-
-	// collect batch infos
-	QVector<QSharedPointer<DkBatchInfo> > batchInfo;
+void DkBatchProcessing::postLoad()
+{
+    // collect batch infos
+    QVector<QSharedPointer<DkBatchInfo>> batchInfo;
 
-	for (DkBatchProcess batch : mBatchItems) {
-		batchInfo << batch.batchInfo();
-	}
+    for (DkBatchProcess batch : mBatchItems) {
+        batchInfo << batch.batchInfo();
+    }
 
-	for (QSharedPointer<DkAbstractBatch> fun : mBatchConfig.getProcessFunctions()) {
-		fun->postLoad(batchInfo);
-	}
+    for (QSharedPointer<DkAbstractBatch> fun : mBatchConfig.getProcessFunctions()) {
+        fun->postLoad(batchInfo);
+    }
 }
 
-void DkBatchProcessing::computeBatch(const QString& settingsPath, const QString& logPath) {
-
-	DkTimer dt;
-	DkBatchConfig bc = DkBatchProfile::loadProfile(settingsPath);
-
-	// guarantee that the output path exists
-	if (!QDir().mkpath(bc.getOutputDirPath())) {
-		qCritical() << "Could not create:" << bc.getOutputDirPath();
-		return;
-	}
+void DkBatchProcessing::computeBatch(const QString &settingsPath, const QString &logPath)
+{
+    DkTimer dt;
+    DkBatchConfig bc = DkBatchProfile::loadProfile(settingsPath);
 
-	QSharedPointer<nmc::DkBatchProcessing> process(new nmc::DkBatchProcessing());
-	process->setBatchConfig(bc);
-	process->compute();
+    // guarantee that the output path exists
+    if (!QDir().mkpath(bc.getOutputDirPath())) {
+        qCritical() << "Could not create:" << bc.getOutputDirPath();
+        return;
+    }
 
-	process->waitForFinished();	// block
+    QSharedPointer<nmc::DkBatchProcessing> process(new nmc::DkBatchProcessing());
+    process->setBatchConfig(bc);
+    process->compute();
 
-	qInfo() << "batch finished with" << process->getNumFailures() << "errors in" << dt;
+    process->waitForFinished(); // block
 
-	if (!logPath.isEmpty()) {
+    qInfo() << "batch finished with" << process->getNumFailures() << "errors in" << dt;
 
-		QFileInfo fi(logPath);
+    if (!logPath.isEmpty()) {
+        QFileInfo fi(logPath);
 
-		QDir().mkpath(fi.absolutePath());
+        QDir().mkpath(fi.absolutePath());
 
-		QFile file(logPath);
-		if (!file.open(QIODevice::WriteOnly))
-			qWarning() << "Sorry, I could not write to" << logPath;
-		else {
-			QStringList log = process->getLog();
-			QTextStream s(&file);
-			for (const QString& line : log)
-				s << line << '\n';
-			qInfo() << "log written to: " << logPath;
-		}
-	}
+        QFile file(logPath);
+        if (!file.open(QIODevice::WriteOnly))
+            qWarning() << "Sorry, I could not write to" << logPath;
+        else {
+            QStringList log = process->getLog();
+            QTextStream s(&file);
+            for (const QString &line : log)
+                s << line << '\n';
+            qInfo() << "log written to: " << logPath;
+        }
+    }
 }
 
+QStringList DkBatchProcessing::getLog() const
+{
+    QStringList log;
 
-QStringList DkBatchProcessing::getLog() const {
+    for (DkBatchProcess batch : mBatchItems) {
+        log << batch.getLog();
+        log << ""; // add empty line between images
+    }
 
-	QStringList log;
-
-	for (DkBatchProcess batch : mBatchItems) {
-
-		log << batch.getLog();
-		log << "";	// add empty line between images
-	}
-
-	return log;
+    return log;
 }
 
-int DkBatchProcessing::getNumFailures() const {
-
-	int numFailures = 0;
+int DkBatchProcessing::getNumFailures() const
+{
+    int numFailures = 0;
 
-	for (DkBatchProcess batch : mBatchItems) {
-		
-		if (batch.hasFailed())
-			numFailures++;
-	}
+    for (DkBatchProcess batch : mBatchItems) {
+        if (batch.hasFailed())
+            numFailures++;
+    }
 
-	return numFailures;
+    return numFailures;
 }
 
-int DkBatchProcessing::getNumProcessed() const {
+int DkBatchProcessing::getNumProcessed() const
+{
+    int numProcessed = 0;
 
-	int numProcessed = 0;
+    for (DkBatchProcess batch : mBatchItems) {
+        if (batch.wasProcessed())
+            numProcessed++;
+    }
 
-	for (DkBatchProcess batch : mBatchItems) {
-
-		if (batch.wasProcessed())
-			numProcessed++;
-	}
-
-	return numProcessed;
+    return numProcessed;
 }
 
-QList<int> DkBatchProcessing::getCurrentResults() {
-
-	if (mResList.empty()) {
-		for (int idx = 0; idx < mBatchItems.size(); idx++)
-			mResList.append(batch_item_not_computed);
-	}
-
-	for (int idx = 0; idx < mResList.size(); idx++) {
+QList<int> DkBatchProcessing::getCurrentResults()
+{
+    if (mResList.empty()) {
+        for (int idx = 0; idx < mBatchItems.size(); idx++)
+            mResList.append(batch_item_not_computed);
+    }
 
-		if (mResList.at(idx) != batch_item_not_computed)
-			continue;
+    for (int idx = 0; idx < mResList.size(); idx++) {
+        if (mResList.at(idx) != batch_item_not_computed)
+            continue;
 
-		if (mBatchItems.at(idx).wasProcessed())
-			mResList[idx] = mBatchItems.at(idx).hasFailed() ? batch_item_failed : batch_item_succeeded;
-	}
+        if (mBatchItems.at(idx).wasProcessed())
+            mResList[idx] = mBatchItems.at(idx).hasFailed() ? batch_item_failed : batch_item_succeeded;
+    }
 
-	return mResList;
+    return mResList;
 }
 
-QStringList DkBatchProcessing::getResultList() const {
+QStringList DkBatchProcessing::getResultList() const
+{
+    QStringList results;
 
-	QStringList results;
+    for (DkBatchProcess batch : mBatchItems) {
+        if (batch.wasProcessed())
+            results.append(getBatchSummary(batch));
+    }
 
-	for (DkBatchProcess batch : mBatchItems) {
-
-		if (batch.wasProcessed())
-			results.append(getBatchSummary(batch));
-	}
-
-	return results;
+    return results;
 }
 
-QString DkBatchProcessing::getBatchSummary(const DkBatchProcess& batch) const {
+QString DkBatchProcessing::getBatchSummary(const DkBatchProcess &batch) const
+{
+    QString res = batch.inputFile() + "\t";
 
-	QString res = batch.inputFile() + "\t";
+    if (!batch.hasFailed())
+        res += " <span style=\" color:#00aa00;\">" + tr("[OK]") + "</span>";
+    else
+        res += " <span style=\" color:#aa0000;\">" + tr("[FAIL]") + "</span>";
 
-	if (!batch.hasFailed())
-		res += " <span style=\" color:#00aa00;\">" + tr("[OK]") + "</span>";
-	else
-		res += " <span style=\" color:#aa0000;\">" + tr("[FAIL]") + "</span>";
-
-	return res;
+    return res;
 }
 
-void DkBatchProcessing::waitForFinished() {
-	mBatchWatcher.waitForFinished();
+void DkBatchProcessing::waitForFinished()
+{
+    mBatchWatcher.waitForFinished();
 }
 
-int DkBatchProcessing::getNumItems() const {
-
-	return mBatchItems.size();
+int DkBatchProcessing::getNumItems() const
+{
+    return mBatchItems.size();
 }
 
-bool DkBatchProcessing::isComputing() const {
-
-	return mBatchWatcher.isRunning();
+bool DkBatchProcessing::isComputing() const
+{
+    return mBatchWatcher.isRunning();
 }
 
-void DkBatchProcessing::cancel() {
-
-	mBatchWatcher.cancel();
+void DkBatchProcessing::cancel()
+{
+    mBatchWatcher.cancel();
 }
 
 // DkBatchProfile --------------------------------------------------------------------
-QString DkBatchProfile::ext = "pnm";	// profile file extension
+QString DkBatchProfile::ext = "pnm"; // profile file extension
 
-DkBatchProfile::DkBatchProfile(const QString& profileDir) {
-
-	mProfileDir = (profileDir.isEmpty()) ? defaultProfilePath() : profileDir;
+DkBatchProfile::DkBatchProfile(const QString &profileDir)
+{
+    mProfileDir = (profileDir.isEmpty()) ? defaultProfilePath() : profileDir;
 }
 
-DkBatchConfig DkBatchProfile::loadProfile(const QString & profilePath) {
-
-	QFileInfo fi(profilePath);
-	if (!fi.exists() || !fi.isFile()) {
-		qInfo() << "cannot read profile from:" << profilePath;
-		return DkBatchConfig();
-	}
+DkBatchConfig DkBatchProfile::loadProfile(const QString &profilePath)
+{
+    QFileInfo fi(profilePath);
+    if (!fi.exists() || !fi.isFile()) {
+        qInfo() << "cannot read profile from:" << profilePath;
+        return DkBatchConfig();
+    }
 
-	QSettings s(profilePath, QSettings::IniFormat);
-	DkBatchConfig bc;
-	bc.loadSettings(s);
+    QSettings s(profilePath, QSettings::IniFormat);
+    DkBatchConfig bc;
+    bc.loadSettings(s);
 
-	return bc;
+    return bc;
 }
 
-bool DkBatchProfile::saveProfile(const QString & profilePath, const DkBatchConfig & batchConfig) {
-	
-	QSettings s(profilePath, QSettings::IniFormat);
-	s.clear();
-	batchConfig.saveSettings(s);
+bool DkBatchProfile::saveProfile(const QString &profilePath, const DkBatchConfig &batchConfig)
+{
+    QSettings s(profilePath, QSettings::IniFormat);
+    s.clear();
+    batchConfig.saveSettings(s);
 
-	return true;
+    return true;
 }
 
-QString DkBatchProfile::defaultProfilePath() {
-
-	return DkUtils::getAppDataPath() + QDir::separator() + "Profiles";
+QString DkBatchProfile::defaultProfilePath()
+{
+    return DkUtils::getAppDataPath() + QDir::separator() + "Profiles";
 }
 
-QString DkBatchProfile::profileNameToPath(const QString & profileName) {
-	return defaultProfilePath() + QDir::separator() + profileName + "." + ext;
+QString DkBatchProfile::profileNameToPath(const QString &profileName)
+{
+    return defaultProfilePath() + QDir::separator() + profileName + "." + ext;
 }
 
-QStringList DkBatchProfile::profileNames() {
-
-	if (mProfilePaths.empty())
-		mProfilePaths = index(mProfileDir);
+QStringList DkBatchProfile::profileNames()
+{
+    if (mProfilePaths.empty())
+        mProfilePaths = index(mProfileDir);
 
-	QStringList userNames;
-	for (const QString& p : mProfilePaths)
-		userNames << makeUserFriendly(p);
+    QStringList userNames;
+    for (const QString &p : mProfilePaths)
+        userNames << makeUserFriendly(p);
 
-	return userNames;
+    return userNames;
 }
 
-QStringList DkBatchProfile::index(const QString & profileDir) const {
-
-	QStringList exts;
-	exts << "*." + ext;
+QStringList DkBatchProfile::index(const QString &profileDir) const
+{
+    QStringList exts;
+    exts << "*." + ext;
 
-	QDir pd(profileDir);
-	QStringList profiles = pd.entryList(exts, QDir::Files, QDir::Name);
+    QDir pd(profileDir);
+    QStringList profiles = pd.entryList(exts, QDir::Files, QDir::Name);
 
-	qDebug() << "I have found these profiles: " << profiles;
-	if (profiles.empty())
-		qInfo() << "no profiles found in" << profileDir;
+    qDebug() << "I have found these profiles: " << profiles;
+    if (profiles.empty())
+        qInfo() << "no profiles found in" << profileDir;
 
-	return profiles;
+    return profiles;
 }
 
-QString DkBatchProfile::makeUserFriendly(const QString & profilePath) {
-	
-	QString pName = QFileInfo(profilePath).baseName();
-	return pName;
+QString DkBatchProfile::makeUserFriendly(const QString &profilePath)
+{
+    QString pName = QFileInfo(profilePath).baseName();
+    return pName;
 }
 
-QString DkBatchProfile::extension() {
-	return ext;
+QString DkBatchProfile::extension()
+{
+    return ext;
 }
 
 }
\ No newline at end of file
diff --git a/ImageLounge/src/DkCore/DkProcess.h b/ImageLounge/src/DkCore/DkProcess.h
index 8d0f9d0..64b9a00 100644
--- a/ImageLounge/src/DkCore/DkProcess.h
+++ b/ImageLounge/src/DkCore/DkProcess.h
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkProcess.h
  Created on:	27.12.2014
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2014 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2014 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2014 Florian Kleber <florian@nomacs.org>
@@ -27,19 +27,19 @@
 
 #pragma once
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QSharedPointer>
-#include <QFutureWatcher>
-#include <QFileInfo>
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QDir>
+#include <QFileInfo>
+#include <QFutureWatcher>
+#include <QSharedPointer>
 #include <QStringList>
 #include <QUrl>
-#pragma warning(pop)		// no warnings from includes - end
+#pragma warning(pop) // no warnings from includes - end
 
 #include "DkBatchInfo.h"
 #include "DkManipulators.h"
 
-#pragma warning(disable: 4251)	// TODO: remove
+#pragma warning(disable : 4251) // TODO: remove
 
 #ifndef DllCoreExport
 #ifdef DK_CORE_DLL_EXPORT
@@ -55,7 +55,8 @@
 class QImage;
 class QSettings;
 
-namespace nmc {
+namespace nmc
+{
 
 // nomacs defines
 class DkImageContainer;
@@ -63,307 +64,344 @@ class DkPluginContainer;
 class DkBaseManipulator;
 class DkMetaDataT;
 
-class DllCoreExport DkAbstractBatch {
-
+class DllCoreExport DkAbstractBatch
+{
 public:
-	DkAbstractBatch() {};
-
-	virtual void setProperties(...) {};
-	virtual void saveSettings(QSettings&) const {};
-	virtual void loadSettings(QSettings&) {};
-	virtual bool compute(
-		QSharedPointer<DkImageContainer> container, 
-		const DkSaveInfo& saveInfo, 
-		QStringList& logStrings, 
-		QVector<QSharedPointer<DkBatchInfo> >& batchInfos) const;
-	virtual bool compute(QSharedPointer<DkImageContainer> container, QStringList& logStrings) const;
-	virtual bool compute(QImage&, QStringList&) const { return true; };
-	virtual bool isActive() const { return false; };
-	virtual void postLoad(const QVector<QSharedPointer<DkBatchInfo> >&) const {};
-
-	virtual QString name() const {return "Abstract Batch";};
-	QString settingsName() const;
-
-	static QSharedPointer<DkAbstractBatch> createFromName(const QString& settingsName);
+    DkAbstractBatch(){};
+
+    virtual void setProperties(...){};
+    virtual void saveSettings(QSettings &) const {};
+    virtual void loadSettings(QSettings &){};
+    virtual bool compute(QSharedPointer<DkImageContainer> container,
+                         const DkSaveInfo &saveInfo,
+                         QStringList &logStrings,
+                         QVector<QSharedPointer<DkBatchInfo>> &batchInfos) const;
+    virtual bool compute(QSharedPointer<DkImageContainer> container, QStringList &logStrings) const;
+    virtual bool compute(QImage &, QStringList &) const
+    {
+        return true;
+    };
+    virtual bool isActive() const
+    {
+        return false;
+    };
+    virtual void postLoad(const QVector<QSharedPointer<DkBatchInfo>> &) const {};
+
+    virtual QString name() const
+    {
+        return "Abstract Batch";
+    };
+    QString settingsName() const;
+
+    static QSharedPointer<DkAbstractBatch> createFromName(const QString &settingsName);
 
 private:
-	// ok, this is important:
-	// we are using the abstract class to process specialized items
-	// if we allow copy operations - we get slicing issues
-	// so we just allow pointers to the batch processing functions.
-	// but pointers result in threading issues - so we just use
-	// QSharedPointers -> problem solved : )
-	DkAbstractBatch(const DkAbstractBatch& o);
-	DkAbstractBatch& operator=( const DkAbstractBatch& o);
-
+    // ok, this is important:
+    // we are using the abstract class to process specialized items
+    // if we allow copy operations - we get slicing issues
+    // so we just allow pointers to the batch processing functions.
+    // but pointers result in threading issues - so we just use
+    // QSharedPointers -> problem solved : )
+    DkAbstractBatch(const DkAbstractBatch &o);
+    DkAbstractBatch &operator=(const DkAbstractBatch &o);
 };
 
 #ifdef WITH_PLUGINS
-class DllCoreExport DkPluginBatch : public DkAbstractBatch {
-
+class DllCoreExport DkPluginBatch : public DkAbstractBatch
+{
 public:
-	DkPluginBatch();
-
-	virtual void saveSettings(QSettings& settings) const override;
-	virtual void loadSettings(QSettings& settings) override;
-
-	virtual void preLoad();
-	virtual void postLoad(const QVector<QSharedPointer<DkBatchInfo> >& batchInfo) const override;
-	virtual void setProperties(const QStringList& pluginList);
-	virtual bool compute(
-		QSharedPointer<DkImageContainer> container, 
-		const DkSaveInfo& saveInfo, 
-		QStringList& logStrings, 
-		QVector<QSharedPointer<DkBatchInfo> >& batchInfos) const override;
-	virtual QString name() const override;
-	virtual bool isActive() const override;
-	virtual QStringList pluginList() const;
+    DkPluginBatch();
+
+    virtual void saveSettings(QSettings &settings) const override;
+    virtual void loadSettings(QSettings &settings) override;
+
+    virtual void preLoad();
+    virtual void postLoad(const QVector<QSharedPointer<DkBatchInfo>> &batchInfo) const override;
+    virtual void setProperties(const QStringList &pluginList);
+    virtual bool compute(QSharedPointer<DkImageContainer> container,
+                         const DkSaveInfo &saveInfo,
+                         QStringList &logStrings,
+                         QVector<QSharedPointer<DkBatchInfo>> &batchInfos) const override;
+    virtual QString name() const override;
+    virtual bool isActive() const override;
+    virtual QStringList pluginList() const;
 
 protected:
-	void loadAllPlugins();
-	void loadPlugin(const QString& pluginString, QSharedPointer<DkPluginContainer>& plugin, QString& runID) const;
+    void loadAllPlugins();
+    void loadPlugin(const QString &pluginString, QSharedPointer<DkPluginContainer> &plugin, QString &runID) const;
 
-	QVector<QSharedPointer<DkPluginContainer> > mPlugins;
-	QStringList mRunIDs;
-	QStringList mPluginList;
+    QVector<QSharedPointer<DkPluginContainer>> mPlugins;
+    QStringList mRunIDs;
+    QStringList mPluginList;
 };
 #endif
 
-class DllCoreExport DkManipulatorBatch : public DkAbstractBatch {
-
+class DllCoreExport DkManipulatorBatch : public DkAbstractBatch
+{
 public:
-	DkManipulatorBatch();
+    DkManipulatorBatch();
 
-	virtual void saveSettings(QSettings& settings) const override;
-	virtual void loadSettings(QSettings& settings) override;
+    virtual void saveSettings(QSettings &settings) const override;
+    virtual void loadSettings(QSettings &settings) override;
 
-	virtual void setProperties(const DkManipulatorManager& manager);
-	virtual bool compute(
-		QSharedPointer<DkImageContainer> container, 
-		QStringList& logStrings) const override;
-	virtual QString name() const override;
-	virtual bool isActive() const override;
+    virtual void setProperties(const DkManipulatorManager &manager);
+    virtual bool compute(QSharedPointer<DkImageContainer> container, QStringList &logStrings) const override;
+    virtual QString name() const override;
+    virtual bool isActive() const override;
 
-	DkManipulatorManager manager() const;
+    DkManipulatorManager manager() const;
 
 protected:
-	DkManipulatorManager mManager;
+    DkManipulatorManager mManager;
 };
 
-class DllCoreExport DkBatchTransform : public DkAbstractBatch {
-
+class DllCoreExport DkBatchTransform : public DkAbstractBatch
+{
 public:
-	DkBatchTransform();
-
-	enum ResizeMode {
-		resize_mode_default,
-		resize_mode_long_side,
-		resize_mode_short_side,
-		resize_mode_width,
-		resize_mode_height,
-
-		resize_mode_end
-	};
-
-	enum ResizeProperty {
-		resize_prop_default,
-		resize_prop_decrease_only,
-		resize_prop_increase_only,
-
-		resize_prop_end
-	};
-
-	virtual void saveSettings(QSettings& settings) const override;
-	virtual void loadSettings(QSettings& settings) override;
-
-	virtual void setProperties(
-		int angle, 
-		bool cropFromMetadata,
-		QRect cropRect,
-		float scaleFactor, 
-		const ResizeMode& mode = resize_mode_default, 
-		const ResizeProperty& prop = resize_prop_default, 
-		int iplMethod = 1/*DkImage::ipl_area*/, 
-		bool correctGamma = false
-		);
-
-	virtual bool compute(QSharedPointer<DkImageContainer> container, QStringList& logStrings) const override;
-	virtual QString name() const override;
-	virtual bool isActive() const override;
-
-	int angle() const;
-	bool cropMetatdata() const;
-	bool cropFromRectangle() const;
-	QRect cropRectangle() const;
-
-	// resize
-	ResizeMode mode() const;
-	ResizeProperty prop() const;
-	int iplMethod() const;
-	float scaleFactor() const;
-	bool correctGamma() const;
+    DkBatchTransform();
+
+    enum ResizeMode {
+        resize_mode_default,
+        resize_mode_long_side,
+        resize_mode_short_side,
+        resize_mode_width,
+        resize_mode_height,
+
+        resize_mode_end
+    };
+
+    enum ResizeProperty {
+        resize_prop_default,
+        resize_prop_decrease_only,
+        resize_prop_increase_only,
+
+        resize_prop_end
+    };
+
+    virtual void saveSettings(QSettings &settings) const override;
+    virtual void loadSettings(QSettings &settings) override;
+
+    virtual void setProperties(int angle,
+                               bool cropFromMetadata,
+                               QRect cropRect,
+                               float scaleFactor,
+                               const ResizeMode &mode = resize_mode_default,
+                               const ResizeProperty &prop = resize_prop_default,
+                               int iplMethod = 1 /*DkImage::ipl_area*/,
+                               bool correctGamma = false);
+
+    virtual bool compute(QSharedPointer<DkImageContainer> container, QStringList &logStrings) const override;
+    virtual QString name() const override;
+    virtual bool isActive() const override;
+
+    int angle() const;
+    bool cropMetatdata() const;
+    bool cropFromRectangle() const;
+    QRect cropRectangle() const;
+
+    // resize
+    ResizeMode mode() const;
+    ResizeProperty prop() const;
+    int iplMethod() const;
+    float scaleFactor() const;
+    bool correctGamma() const;
 
 protected:
-	bool prepareProperties(const QSize& imgSize, QSize& size, float& scaleFactor, QStringList& logStrings) const;
-	bool isResizeActive() const;
-	QString rectToString(const QRect& r) const;
-	QRect stringToRect(const QString& s) const;
-
-	int mAngle = 0;
-	bool mCropFromMetadata = false;
-
-	ResizeMode mResizeMode = resize_mode_default;
-	ResizeProperty mResizeProperty = resize_prop_default;
-	float mResizeScaleFactor = 1.0f;
-	int mResizeIplMethod = 0;
-	bool mResizeCorrectGamma = false;
-	
-	QRect mCropRect;
-};
+    bool prepareProperties(const QSize &imgSize, QSize &size, float &scaleFactor, QStringList &logStrings) const;
+    bool isResizeActive() const;
+    QString rectToString(const QRect &r) const;
+    QRect stringToRect(const QString &s) const;
 
-class DllCoreExport DkBatchProcess {
+    int mAngle = 0;
+    bool mCropFromMetadata = false;
 
+    ResizeMode mResizeMode = resize_mode_default;
+    ResizeProperty mResizeProperty = resize_prop_default;
+    float mResizeScaleFactor = 1.0f;
+    int mResizeIplMethod = 0;
+    bool mResizeCorrectGamma = false;
+
+    QRect mCropRect;
+};
+
+class DllCoreExport DkBatchProcess
+{
 public:
-	DkBatchProcess(const DkSaveInfo& saveInfo = DkSaveInfo());
+    DkBatchProcess(const DkSaveInfo &saveInfo = DkSaveInfo());
 
-	void setProcessChain(const QVector<QSharedPointer<DkAbstractBatch> > processes);
-	bool compute();	// do the work
-	QStringList getLog() const;
-	bool hasFailed() const;
-	bool wasProcessed() const;
-	QString inputFile() const;
-	QString outputFile() const;
+    void setProcessChain(const QVector<QSharedPointer<DkAbstractBatch>> processes);
+    bool compute(); // do the work
+    QStringList getLog() const;
+    bool hasFailed() const;
+    bool wasProcessed() const;
+    QString inputFile() const;
+    QString outputFile() const;
 
-	QVector<QSharedPointer<DkBatchInfo> > batchInfo() const;
+    QVector<QSharedPointer<DkBatchInfo>> batchInfo() const;
 
 protected:
-	bool process();
-	bool prepareDeleteExisting();
-	bool deleteOrRestoreExisting();
-	bool deleteOriginalFile();
-	bool copyFile();
-	bool renameFile();
-	bool updateMetaData(DkMetaDataT* md);
-
-	DkSaveInfo mSaveInfo;
-	int mFailure = 0;
-	bool mIsProcessed = false;
-
-	QVector<QSharedPointer<DkBatchInfo> > mInfos;
-	QVector<QSharedPointer<DkAbstractBatch> > mProcessFunctions;
-	QStringList mLogStrings;
+    bool process();
+    bool prepareDeleteExisting();
+    bool deleteOrRestoreExisting();
+    bool deleteOriginalFile();
+    bool copyFile();
+    bool renameFile();
+    bool updateMetaData(DkMetaDataT *md);
+
+    DkSaveInfo mSaveInfo;
+    int mFailure = 0;
+    bool mIsProcessed = false;
+
+    QVector<QSharedPointer<DkBatchInfo>> mInfos;
+    QVector<QSharedPointer<DkAbstractBatch>> mProcessFunctions;
+    QStringList mLogStrings;
 };
 
-class DllCoreExport DkBatchConfig {
-
+class DllCoreExport DkBatchConfig
+{
 public:
-	DkBatchConfig() { };
-	DkBatchConfig(const QStringList& fileList, const QString& outputDir, const QString& fileNamePattern);
+    DkBatchConfig(){};
+    DkBatchConfig(const QStringList &fileList, const QString &outputDir, const QString &fileNamePattern);
+
+    virtual void saveSettings(QSettings &settings) const;
+    virtual void loadSettings(QSettings &settings);
+
+    bool isOk() const;
+
+    void setFileList(const QStringList &fileList)
+    {
+        mFileList = fileList;
+    };
+    void setOutputDir(const QString &outputDir)
+    {
+        mOutputDirPath = outputDir;
+    };
+    void setFileNamePattern(const QString &pattern)
+    {
+        mFileNamePattern = pattern;
+    };
+    void setProcessFunctions(const QVector<QSharedPointer<DkAbstractBatch>> &processFunctions)
+    {
+        mProcessFunctions = processFunctions;
+    };
+    void setSaveInfo(const DkSaveInfo &saveInfo)
+    {
+        mSaveInfo = saveInfo;
+    };
+
+    QStringList getFileList() const
+    {
+        return mFileList;
+    };
+    QString getOutputDirPath() const
+    {
+        return mOutputDirPath;
+    };
+    QString getFileNamePattern() const
+    {
+        return mFileNamePattern;
+    };
+    QVector<QSharedPointer<DkAbstractBatch>> getProcessFunctions() const
+    {
+        return mProcessFunctions;
+    };
+    DkSaveInfo saveInfo() const
+    {
+        return mSaveInfo;
+    };
 
-	virtual void saveSettings(QSettings& settings) const;
-	virtual void loadSettings(QSettings& settings);
-
-	bool isOk() const;
-
-	void setFileList(const QStringList& fileList) { mFileList = fileList; };
-	void setOutputDir(const QString& outputDir) { mOutputDirPath = outputDir; };
-	void setFileNamePattern(const QString& pattern) { mFileNamePattern = pattern; };
-	void setProcessFunctions(const QVector<QSharedPointer<DkAbstractBatch> >& processFunctions) { mProcessFunctions = processFunctions; };
-	void setSaveInfo(const DkSaveInfo& saveInfo) { mSaveInfo = saveInfo; };
+protected:
+    DkSaveInfo mSaveInfo;
 
-	QStringList getFileList() const { return mFileList; };
-	QString getOutputDirPath() const { return mOutputDirPath; };
-	QString getFileNamePattern() const { return mFileNamePattern; };
-	QVector<QSharedPointer<DkAbstractBatch> > getProcessFunctions() const { return mProcessFunctions; };
-	DkSaveInfo saveInfo() const { return mSaveInfo; };
+    QStringList mFileList;
+    QString mOutputDirPath;
+    QString mFileNamePattern;
 
-protected:
-	
-	DkSaveInfo mSaveInfo;
-
-	QStringList mFileList;
-	QString mOutputDirPath;
-	QString mFileNamePattern;
-	
-	QVector<QSharedPointer<DkAbstractBatch> > mProcessFunctions;
+    QVector<QSharedPointer<DkAbstractBatch>> mProcessFunctions;
 };
 
-class DllCoreExport DkBatchProcessing : public QObject {
-	Q_OBJECT
+class DllCoreExport DkBatchProcessing : public QObject
+{
+    Q_OBJECT
 
 public:
+    enum {
+        batch_item_failed,
+        batch_item_succeeded,
+        batch_item_not_computed,
+
+        batch_item_end
+    };
 
-	enum {
-		batch_item_failed,
-		batch_item_succeeded,
-		batch_item_not_computed,
+    DkBatchProcessing(const DkBatchConfig &config = DkBatchConfig(), QWidget *parent = 0);
 
-		batch_item_end
-	};
+    void compute();
+    static bool computeItem(DkBatchProcess &item);
 
-	DkBatchProcessing(const DkBatchConfig& config = DkBatchConfig(), QWidget* parent = 0);
+    QStringList getLog() const;
+    int getNumFailures() const;
+    int getNumItems() const;
+    int getNumProcessed() const;
 
-	void compute();
-	static bool computeItem(DkBatchProcess& item);
-	
-	QStringList getLog() const;
-	int getNumFailures() const;
-	int getNumItems() const;
-	int getNumProcessed() const;
-	
-	bool isComputing() const;
-	QList<int> getCurrentResults();
-	QStringList getResultList() const;
-	QString getBatchSummary(const DkBatchProcess& batch) const;
-	void waitForFinished();
+    bool isComputing() const;
+    QList<int> getCurrentResults();
+    QStringList getResultList() const;
+    QString getBatchSummary(const DkBatchProcess &batch) const;
+    void waitForFinished();
 
-	// getter, setter
-	void setBatchConfig(const DkBatchConfig& config) { mBatchConfig = config; };
-	DkBatchConfig getBatchConfig() const { return mBatchConfig; };
+    // getter, setter
+    void setBatchConfig(const DkBatchConfig &config)
+    {
+        mBatchConfig = config;
+    };
+    DkBatchConfig getBatchConfig() const
+    {
+        return mBatchConfig;
+    };
 
-	void postLoad();
+    void postLoad();
 
-	static void computeBatch(const QString& settingsPath, const QString& logPath);
+    static void computeBatch(const QString &settingsPath, const QString &logPath);
 
 public slots:
-	// user interaction
-	void cancel();
+    // user interaction
+    void cancel();
 
 signals:
-	void progressValueChanged(int idx);
-	void finished();
+    void progressValueChanged(int idx);
+    void finished();
 
 protected:
-	DkBatchConfig mBatchConfig;
-	QVector<DkBatchProcess> mBatchItems;
-	QList<int> mResList;
-	
-	// threading
-	QFutureWatcher<void> mBatchWatcher;
-	
-	void init();
-};
+    DkBatchConfig mBatchConfig;
+    QVector<DkBatchProcess> mBatchItems;
+    QList<int> mResList;
 
-class DllCoreExport DkBatchProfile {
+    // threading
+    QFutureWatcher<void> mBatchWatcher;
 
+    void init();
+};
+
+class DllCoreExport DkBatchProfile
+{
 public:
-	DkBatchProfile(const QString& profileDir = QString());
-	
-	static DkBatchConfig loadProfile(const QString& profilePath);
-	static bool saveProfile(const QString& profilePath, const DkBatchConfig& batchConfig);
-	static QString defaultProfilePath();
-	static QString profileNameToPath(const QString& profileName);
-	static QString makeUserFriendly(const QString& profilePath);
-	static QString extension();
+    DkBatchProfile(const QString &profileDir = QString());
+
+    static DkBatchConfig loadProfile(const QString &profilePath);
+    static bool saveProfile(const QString &profilePath, const DkBatchConfig &batchConfig);
+    static QString defaultProfilePath();
+    static QString profileNameToPath(const QString &profileName);
+    static QString makeUserFriendly(const QString &profilePath);
+    static QString extension();
 
-	QStringList profileNames();
+    QStringList profileNames();
 
 protected:
-	QStringList index(const QString& profileDir) const;
+    QStringList index(const QString &profileDir) const;
 
-	QString mProfileDir;
-	QStringList mProfilePaths;
-	static QString ext;
+    QString mProfileDir;
+    QStringList mProfilePaths;
+    static QString ext;
 };
 
 }
\ No newline at end of file
diff --git a/ImageLounge/src/DkCore/DkSaveDialog.cpp b/ImageLounge/src/DkCore/DkSaveDialog.cpp
index 061124d..82d9922 100644
--- a/ImageLounge/src/DkCore/DkSaveDialog.cpp
+++ b/ImageLounge/src/DkCore/DkSaveDialog.cpp
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkSaveDialog.cpp
  Created on:	03.07.2013
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -26,487 +26,495 @@
  *******************************************************************************************************/
 
 #include "DkSaveDialog.h"
-#include "DkUtils.h"
-#include "DkBasicWidgets.h"
-#include "DkBasicLoader.h"
 #include "DkBaseViewPort.h"
+#include "DkBasicLoader.h"
+#include "DkBasicWidgets.h"
 #include "DkSettings.h"
+#include "DkUtils.h"
 
-#pragma warning(push, 0)	// no warnings from includes - begin
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QBuffer>
-#include <QDialogButtonBox>
-#include <QGroupBox>
 #include <QButtonGroup>
-#include <QVBoxLayout>
-#include <QRadioButton>
-#include <QPushButton>
 #include <QCheckBox>
-#include <QSettings>
 #include <QComboBox>
 #include <QDebug>
+#include <QDialogButtonBox>
+#include <QGroupBox>
 #include <QLabel>
-#pragma warning(pop)		// no warnings from includes - end
+#include <QPushButton>
+#include <QRadioButton>
+#include <QSettings>
+#include <QVBoxLayout>
+#pragma warning(pop) // no warnings from includes - end
 
-namespace nmc {
+namespace nmc
+{
 
 // tiff dialog --------------------------------------------------------------------
-DkTifDialog::DkTifDialog(QWidget* parent, Qt::WindowFlags flags) : QDialog(parent, flags) {
-	init();
+DkTifDialog::DkTifDialog(QWidget *parent, Qt::WindowFlags flags)
+    : QDialog(parent, flags)
+{
+    init();
 }
 
-void DkTifDialog::init() {
-
-	isOk = false;
-	setWindowTitle("TIF compression");
-	//setFixedSize(270, 146);
-	setLayout(new QVBoxLayout(this));
-
-	//QWidget* buttonWidget = new QWidget(this);
-	QGroupBox* buttonWidget = new QGroupBox(tr("TIF compression"), this);
-	QVBoxLayout* vBox = new QVBoxLayout(buttonWidget);
-	QButtonGroup* bGroup = new QButtonGroup(buttonWidget);
-	noCompressionButton = new QRadioButton( tr("&no compression"), this);
-	compressionButton = new QRadioButton(tr("&LZW compression (lossless)"), this);
-	compressionButton->setChecked(true);
-	bGroup->addButton(noCompressionButton);
-	bGroup->addButton(compressionButton);
-
-	vBox->addWidget(noCompressionButton);
-	vBox->addWidget(compressionButton);
-
-	// mButtons
-	QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
-	buttons->button(QDialogButtonBox::Ok)->setText(tr("&OK"));
-	buttons->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel"));
-	connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
-	connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
-
-	layout()->addWidget(buttonWidget);
-	layout()->addWidget(buttons);
+void DkTifDialog::init()
+{
+    isOk = false;
+    setWindowTitle("TIF compression");
+    // setFixedSize(270, 146);
+    setLayout(new QVBoxLayout(this));
+
+    // QWidget* buttonWidget = new QWidget(this);
+    QGroupBox *buttonWidget = new QGroupBox(tr("TIF compression"), this);
+    QVBoxLayout *vBox = new QVBoxLayout(buttonWidget);
+    QButtonGroup *bGroup = new QButtonGroup(buttonWidget);
+    noCompressionButton = new QRadioButton(tr("&no compression"), this);
+    compressionButton = new QRadioButton(tr("&LZW compression (lossless)"), this);
+    compressionButton->setChecked(true);
+    bGroup->addButton(noCompressionButton);
+    bGroup->addButton(compressionButton);
+
+    vBox->addWidget(noCompressionButton);
+    vBox->addWidget(compressionButton);
+
+    // mButtons
+    QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
+    buttons->button(QDialogButtonBox::Ok)->setText(tr("&OK"));
+    buttons->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel"));
+    connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
+    connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
+
+    layout()->addWidget(buttonWidget);
+    layout()->addWidget(buttons);
 }
 
-int DkTifDialog::getCompression() const {
-
-	return (noCompressionButton->isChecked()) ? 0 : 1;
+int DkTifDialog::getCompression() const
+{
+    return (noCompressionButton->isChecked()) ? 0 : 1;
 }
 
 // DkCompressionDialog --------------------------------------------------------------------
-DkCompressDialog::DkCompressDialog(QWidget* parent, Qt::WindowFlags flags) : QDialog(parent, flags) {
-
-	setObjectName("DkCompressionDialog");
-
-	// define compression values that suit your image format
-	mImgQuality.resize(end_quality);
-	mImgQuality[best_quality]	= 100;
-	mImgQuality[high_quality]	= 97;
-	mImgQuality[medium_quality] = 90;
-	mImgQuality[low_quality]	= 80;
-	mImgQuality[bad_quality]	= 60;
-
-	mAvifImgQuality.resize(end_quality);
-	mAvifImgQuality[best_quality]	= 100;
-	mAvifImgQuality[high_quality]	= 80;
-	mAvifImgQuality[medium_quality] = 60;
-	mAvifImgQuality[low_quality]	= 40;
-	mAvifImgQuality[bad_quality]	= 20;
-
-	createLayout();
-	init();
-
-	resize(DkUtils::getInitialDialogSize());
+DkCompressDialog::DkCompressDialog(QWidget *parent, Qt::WindowFlags flags)
+    : QDialog(parent, flags)
+{
+    setObjectName("DkCompressionDialog");
+
+    // define compression values that suit your image format
+    mImgQuality.resize(end_quality);
+    mImgQuality[best_quality] = 100;
+    mImgQuality[high_quality] = 97;
+    mImgQuality[medium_quality] = 90;
+    mImgQuality[low_quality] = 80;
+    mImgQuality[bad_quality] = 60;
+
+    mAvifImgQuality.resize(end_quality);
+    mAvifImgQuality[best_quality] = 100;
+    mAvifImgQuality[high_quality] = 80;
+    mAvifImgQuality[medium_quality] = 60;
+    mAvifImgQuality[low_quality] = 40;
+    mAvifImgQuality[bad_quality] = 20;
+
+    createLayout();
+    init();
+
+    resize(DkUtils::getInitialDialogSize());
 }
 
-DkCompressDialog::~DkCompressDialog() {
-	
-	// save settings
-	saveSettings();
+DkCompressDialog::~DkCompressDialog()
+{
+    // save settings
+    saveSettings();
 }
 
-void DkCompressDialog::saveSettings() {
+void DkCompressDialog::saveSettings()
+{
+    DefaultSettings settings;
+    settings.beginGroup(objectName());
+    settings.setValue("CompressionCombo" + QString::number(mDialogMode), mCompressionCombo->currentIndex());
 
-	DefaultSettings settings;
-	settings.beginGroup(objectName());
-	settings.setValue("CompressionCombo" + QString::number(mDialogMode), mCompressionCombo->currentIndex());
-	
-	if (mDialogMode != webp_dialog)
-		settings.setValue("bgCompressionColor" + QString::number(mDialogMode), getBackgroundColor().rgba());
-	settings.endGroup();
+    if (mDialogMode != webp_dialog)
+        settings.setValue("bgCompressionColor" + QString::number(mDialogMode), getBackgroundColor().rgba());
+    settings.endGroup();
 }
 
+void DkCompressDialog::loadSettings()
+{
+    DefaultSettings settings;
+    settings.beginGroup(objectName());
 
-void DkCompressDialog::loadSettings() {
-
-	DefaultSettings settings;
-	settings.beginGroup(objectName());
-
-	mBgCol = settings.value("bgCompressionColor" + QString::number(mDialogMode), QColor(255,255,255).rgba()).toInt();
-	int cIdx = settings.value("CompressionCombo" + QString::number(mDialogMode), 0).toInt();
+    mBgCol = settings.value("bgCompressionColor" + QString::number(mDialogMode), QColor(255, 255, 255).rgba()).toInt();
+    int cIdx = settings.value("CompressionCombo" + QString::number(mDialogMode), 0).toInt();
 
-	if (cIdx >= 0 && cIdx < mCompressionCombo->count())
-		mCompressionCombo->setCurrentIndex(cIdx);
-	mColChooser->setColor(mBgCol);
-	newBgCol();
-	settings.endGroup();
+    if (cIdx >= 0 && cIdx < mCompressionCombo->count())
+        mCompressionCombo->setCurrentIndex(cIdx);
+    mColChooser->setColor(mBgCol);
+    newBgCol();
+    settings.endGroup();
 }
 
-void DkCompressDialog::resizeEvent(QResizeEvent * ev) {
-
-	drawPreview();
-	QDialog::resizeEvent(ev);
+void DkCompressDialog::resizeEvent(QResizeEvent *ev)
+{
+    drawPreview();
+    QDialog::resizeEvent(ev);
 }
 
-void DkCompressDialog::init() {
-
-	mHasAlpha = false;
-
-	auto updateQuality = [&](const QVector<int>& values) {
-
-		for (int idx = 0; idx < end_quality; idx++) {
-			Q_ASSERT(idx < values.size());
-			mCompressionCombo->setItemData(idx, values[idx]);
-		}
-	};
-
-	// default compression quality
-	updateQuality(mImgQuality);
-
-	if (mDialogMode == jpg_dialog || mDialogMode == j2k_dialog) {
-
-		if (mDialogMode == jpg_dialog)
-			setWindowTitle(tr("JPG Settings"));
-		else
-			setWindowTitle(tr("J2K Settings"));
-
-		mCompressionCombo->show();
-		mColChooser->show();
-		mCbLossless->hide();
-		mSizeCombo->hide();
-		mCompressionCombo->setEnabled(true);
-	}
-	else if (mDialogMode == webp_dialog) {
-		setWindowTitle(tr("WebP Settings"));
-		mColChooser->setEnabled(false);
-		mCompressionCombo->show();
-		mColChooser->show();
-
-#if QT_VERSION < 0x050000
-		mCbLossless->show();
-#endif
-		mSizeCombo->hide();
-		losslessCompression(mCbLossless->isChecked());
-	}
-	else if (mDialogMode == avif_dialog) {
-		setWindowTitle(tr("AVIF Settings"));
-
-		mSizeCombo->hide();
-		mCompressionCombo->show();
-		mCompressionCombo->setEnabled(true);
-		mColChooser->hide();
-		mCbLossless->hide();
-		//AVIF use different quality scale
-		updateQuality(mAvifImgQuality);
-	}
-	else if (mDialogMode == web_dialog) {
-
-		setWindowTitle(tr("Save for Web"));
-
-		mSizeCombo->show();
-		mCompressionCombo->hide();
-		mColChooser->hide();
-		mCbLossless->hide();
-	}
-	loadSettings();
-
+void DkCompressDialog::init()
+{
+    mHasAlpha = false;
+
+    auto updateQuality = [&](const QVector<int> &values) {
+        for (int idx = 0; idx < end_quality; idx++) {
+            Q_ASSERT(idx < values.size());
+            mCompressionCombo->setItemData(idx, values[idx]);
+        }
+    };
+
+    // default compression quality
+    updateQuality(mImgQuality);
+
+    if (mDialogMode == jpg_dialog || mDialogMode == j2k_dialog) {
+        if (mDialogMode == jpg_dialog)
+            setWindowTitle(tr("JPG Settings"));
+        else
+            setWindowTitle(tr("J2K Settings"));
+
+        mCompressionCombo->show();
+        mColChooser->show();
+        mCbLossless->hide();
+        mSizeCombo->hide();
+        mCompressionCombo->setEnabled(true);
+    } else if (mDialogMode == webp_dialog) {
+        setWindowTitle(tr("WebP Settings"));
+        mColChooser->setEnabled(false);
+        mCompressionCombo->show();
+        mColChooser->show();
+
+        mSizeCombo->hide();
+        losslessCompression(mCbLossless->isChecked());
+    } else if (mDialogMode == avif_dialog) {
+        setWindowTitle(tr("AVIF Settings"));
+
+        mSizeCombo->hide();
+        mCompressionCombo->show();
+        mCompressionCombo->setEnabled(true);
+        mColChooser->hide();
+        mCbLossless->hide();
+        // AVIF use different quality scale
+        updateQuality(mAvifImgQuality);
+    } else if (mDialogMode == jxl_dialog) {
+        setWindowTitle(tr("JXL Settings"));
+
+        mSizeCombo->hide();
+        mCompressionCombo->show();
+        mCompressionCombo->setEnabled(true);
+        mColChooser->hide();
+        mCbLossless->hide();
+    } else if (mDialogMode == web_dialog) {
+        setWindowTitle(tr("Save for Web"));
+
+        mSizeCombo->show();
+        mCompressionCombo->hide();
+        mColChooser->hide();
+        mCbLossless->hide();
+    }
+    loadSettings();
 }
 
-void DkCompressDialog::createLayout() {
-
-	QLabel* origLabelText = new QLabel(tr("Original"), this);
-	origLabelText->setAlignment(Qt::AlignHCenter);
-	QLabel* newLabel = new QLabel(tr("New"), this);
-	newLabel->setAlignment(Qt::AlignHCenter);
-
-	// shows the original image
-	mOrigView = new DkBaseViewPort(this);
-	mOrigView->setForceFastRendering(true);
-	mOrigView->setPanControl(QPointF(0.0f, 0.0f));
-	connect(mOrigView, SIGNAL(imageUpdated()), this, SLOT(drawPreview()));
-
-	//// maybe we should report this: 
-	//// if a stylesheet (with border) is set, the var
-	//// cornerPaintingRect in QAbstractScrollArea (which we don't even need : )
-	//// is invalid which blocks re-paints unless the widget gets a focus...
-	//origView->setStyleSheet("QViewPort{border: 1px solid #888;}");
-
-	// shows the preview
-	mPreviewLabel = new QLabel(this);
-	mPreviewLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Ignored);
-
-	// size combo for web
-	mSizeCombo = new QComboBox(this);
-	mSizeCombo->addItem(tr("Small  (800 x 600)"), 800);
-	mSizeCombo->addItem(tr("Medium (1024 x 786)"), 1024);
-	mSizeCombo->addItem(tr("Large  (1920 x 1080)"), 1920);
-	mSizeCombo->addItem(tr("Original Size"), -1);
-	connect(mSizeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changeSizeWeb(int)));
-
-	// compression quality is set in ::init()
-	mCompressionCombo = new QComboBox(this);
-	mCompressionCombo->addItem(tr("Best Quality"));
-	mCompressionCombo->addItem(tr("High Quality"));
-	mCompressionCombo->addItem(tr("Medium Quality"));
-	mCompressionCombo->addItem(tr("Low Quality"));
-	mCompressionCombo->addItem(tr("Bad Quality"));
-	mCompressionCombo->setCurrentIndex(1);
-	connect(mCompressionCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(drawPreview()));
-
-	// lossless
-	mCbLossless = new QCheckBox(tr("Lossless Compression"), this);
-	connect(mCbLossless, SIGNAL(toggled(bool)), this, SLOT(losslessCompression(bool)));
-
-	mPreviewSizeLabel = new QLabel();
-	mPreviewSizeLabel->setAlignment(Qt::AlignRight);
-
-	// color chooser
-	mColChooser = new DkColorChooser(mBgCol, tr("Background Color"), this);
-	mColChooser->setVisible(mHasAlpha);
-	mColChooser->enableAlpha(false);
-	connect(mColChooser, SIGNAL(accepted()), this, SLOT(newBgCol()));
-
-	QWidget* previewWidget = new QWidget(this);
-	QGridLayout* previewLayout = new QGridLayout(previewWidget);
-	previewLayout->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
-	previewLayout->setColumnStretch(0,1);
-	previewLayout->setColumnStretch(1,1);
-
-	previewLayout->addWidget(origLabelText, 0, 0);
-	previewLayout->addWidget(newLabel, 0, 1);
-	previewLayout->addWidget(mOrigView, 1, 0);
-	previewLayout->addWidget(mPreviewLabel, 1, 1);
-	previewLayout->addWidget(mCompressionCombo, 2, 0);
-	previewLayout->addWidget(mColChooser, 2, 1, 1, 3);
-	previewLayout->addWidget(mCbLossless, 3, 0);
-	previewLayout->addWidget(mSizeCombo, 4, 0);
-	previewLayout->addWidget(mPreviewSizeLabel, 5, 1);
-
-	// mButtons
-	QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
-	buttons->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel"));
-	buttons->button(QDialogButtonBox::Cancel)->setAutoDefault(false);
-	buttons->button(QDialogButtonBox::Ok)->setAutoDefault(true);
-	buttons->button(QDialogButtonBox::Ok)->setText(tr("&OK"));
-	connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
-	connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
-
-	QVBoxLayout* layout = new QVBoxLayout(this);
-	layout->addWidget(previewWidget);
-	layout->addWidget(buttons);
-
-	mCompressionCombo->setFocus();
-
+void DkCompressDialog::createLayout()
+{
+    QLabel *origLabelText = new QLabel(tr("Original"), this);
+    origLabelText->setAlignment(Qt::AlignHCenter);
+    QLabel *newLabel = new QLabel(tr("New"), this);
+    newLabel->setAlignment(Qt::AlignHCenter);
+
+    // shows the original image
+    mOrigView = new DkBaseViewPort(this);
+    mOrigView->setForceFastRendering(true);
+    mOrigView->setPanControl(QPointF(0.0f, 0.0f));
+    connect(mOrigView, SIGNAL(imageUpdated()), this, SLOT(drawPreview()));
+
+    //// maybe we should report this:
+    //// if a stylesheet (with border) is set, the var
+    //// cornerPaintingRect in QAbstractScrollArea (which we don't even need : )
+    //// is invalid which blocks re-paints unless the widget gets a focus...
+    // origView->setStyleSheet("QViewPort{border: 1px solid #888;}");
+
+    // shows the preview
+    mPreviewLabel = new QLabel(this);
+    mPreviewLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Ignored);
+
+    // size combo for web
+    mSizeCombo = new QComboBox(this);
+    mSizeCombo->addItem(tr("Small  (800 x 600)"), 800);
+    mSizeCombo->addItem(tr("Medium (1024 x 786)"), 1024);
+    mSizeCombo->addItem(tr("Large  (1920 x 1080)"), 1920);
+    mSizeCombo->addItem(tr("Original Size"), -1);
+    connect(mSizeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changeSizeWeb(int)));
+
+    // compression quality is set in ::init()
+    mCompressionCombo = new QComboBox(this);
+    mCompressionCombo->addItem(tr("Best Quality"));
+    mCompressionCombo->addItem(tr("High Quality"));
+    mCompressionCombo->addItem(tr("Medium Quality"));
+    mCompressionCombo->addItem(tr("Low Quality"));
+    mCompressionCombo->addItem(tr("Bad Quality"));
+    mCompressionCombo->setCurrentIndex(1);
+    connect(mCompressionCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(drawPreview()));
+
+    // lossless
+    mCbLossless = new QCheckBox(tr("Lossless Compression"), this);
+    connect(mCbLossless, SIGNAL(toggled(bool)), this, SLOT(losslessCompression(bool)));
+
+    mPreviewSizeLabel = new QLabel();
+    mPreviewSizeLabel->setAlignment(Qt::AlignRight);
+
+    // color chooser
+    mColChooser = new DkColorChooser(mBgCol, tr("Background Color"), this);
+    mColChooser->setVisible(mHasAlpha);
+    mColChooser->enableAlpha(false);
+    connect(mColChooser, SIGNAL(accepted()), this, SLOT(newBgCol()));
+
+    QWidget *previewWidget = new QWidget(this);
+    QGridLayout *previewLayout = new QGridLayout(previewWidget);
+    previewLayout->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
+    previewLayout->setColumnStretch(0, 1);
+    previewLayout->setColumnStretch(1, 1);
+
+    previewLayout->addWidget(origLabelText, 0, 0);
+    previewLayout->addWidget(newLabel, 0, 1);
+    previewLayout->addWidget(mOrigView, 1, 0);
+    previewLayout->addWidget(mPreviewLabel, 1, 1);
+    previewLayout->addWidget(mCompressionCombo, 2, 0);
+    previewLayout->addWidget(mColChooser, 2, 1, 1, 3);
+    previewLayout->addWidget(mCbLossless, 3, 0);
+    previewLayout->addWidget(mSizeCombo, 4, 0);
+    previewLayout->addWidget(mPreviewSizeLabel, 5, 1);
+
+    // mButtons
+    QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
+    buttons->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel"));
+    buttons->button(QDialogButtonBox::Cancel)->setAutoDefault(false);
+    buttons->button(QDialogButtonBox::Ok)->setAutoDefault(true);
+    buttons->button(QDialogButtonBox::Ok)->setText(tr("&OK"));
+    connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
+    connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
+
+    QVBoxLayout *layout = new QVBoxLayout(this);
+    layout->addWidget(previewWidget);
+    layout->addWidget(buttons);
+
+    mCompressionCombo->setFocus();
 }
 
-void DkCompressDialog::updateSnippets() {
-
-	if (mImg.isNull() || !isVisible())
-		return;
-
-	mOrigView->setImage(mImg);
-	mOrigView->fullView();
-	mOrigView->zoomConstraints(mOrigView->get100Factor());
+void DkCompressDialog::updateSnippets()
+{
+    if (mImg.isNull() || !isVisible())
+        return;
 
+    mOrigView->setImage(mImg);
+    mOrigView->fullView();
+    mOrigView->zoomConstraints(mOrigView->get100Factor());
 }
 
-void DkCompressDialog::drawPreview() {
-
-	if (mImg.isNull() || !isVisible())
-		return;
-
-	QImage origImg = mOrigView->getCurrentImageRegion();
-	mNewImg = QImage(origImg.size(), QImage::Format_ARGB32);
-
-	if ((mDialogMode == jpg_dialog || mDialogMode == j2k_dialog) && mHasAlpha)
-		mNewImg.fill(mBgCol.rgb());
-	else if ((mDialogMode == jpg_dialog || mDialogMode == web_dialog) && !mHasAlpha)
-		mNewImg.fill(palette().color(QPalette::Background).rgb());
-	else
-		mNewImg.fill(QColor(0,0,0,0).rgba());
-	 
-	QPainter bgPainter(&mNewImg);
-	bgPainter.drawImage(origImg.rect(), origImg, origImg.rect());
-	bgPainter.end();
-
-	if (mDialogMode == jpg_dialog) {
-		// pre-compute the jpg compression
-		QByteArray ba;
-		QBuffer buffer(&ba);
-		buffer.open(QIODevice::ReadWrite);
-		mNewImg.save(&buffer, "JPG", getCompression());
-		mNewImg.loadFromData(ba, "JPG");
-		updateFileSizeLabel((float)ba.size(), origImg.size());
-	}
-	else if (mDialogMode == j2k_dialog) {
-		// pre-compute the jpg compression
-		QByteArray ba;
-		QBuffer buffer(&ba);
-		buffer.open(QIODevice::ReadWrite);
-		mNewImg.save(&buffer, "J2K", getCompression());
-		mNewImg.loadFromData(ba, "J2K");
-		updateFileSizeLabel((float)ba.size(), origImg.size());
-		qDebug() << "using j2k...";
-	}
-	else if (mDialogMode == webp_dialog && getCompression() != -1) {
-		// pre-compute the jpg compression
-		QByteArray ba;
-		QBuffer buffer(&ba);
-		buffer.open(QIODevice::ReadWrite);
-		mNewImg.save(&buffer, "WEBP", getCompression());
-		mNewImg.loadFromData(ba, "WEBP");
-		updateFileSizeLabel((float)ba.size(), origImg.size());
-		qDebug() << "using webp...";
-	}
-	else if (mDialogMode == avif_dialog) {
-		QByteArray ba;
-		QBuffer buffer(&ba);
-		buffer.open(QIODevice::WriteOnly);
-		mNewImg.save(&buffer, "AVIF", getCompression());
-		buffer.close();
-		mNewImg.loadFromData(ba, "AVIF");
-		updateFileSizeLabel((float)ba.size(), origImg.size());
-		qDebug() << "using avif...";
-	}
-	else if (mDialogMode == web_dialog) {
-
-		float factor = getResizeFactor();
-		if (factor != -1)
-			mNewImg = DkImage::resizeImage(mNewImg, QSize(), factor, DkImage::ipl_area);
-
-		if (!mHasAlpha) {
-			// pre-compute the jpg compression
-			QByteArray ba;
-			QBuffer buffer(&ba);
-			buffer.open(QIODevice::ReadWrite);
-			mNewImg.save(&buffer, "JPG", getCompression());
-			mNewImg.loadFromData(ba, "JPG");
-			updateFileSizeLabel((float)ba.size(), origImg.size(), factor);
-		}
-		else {
-			// pre-compute the png compression
-			QByteArray ba;
-			QBuffer buffer(&ba);
-			buffer.open(QIODevice::ReadWrite);
-			mNewImg.save(&buffer, "PNG");
-			mNewImg.loadFromData(ba, "PNG");
-			updateFileSizeLabel((float)ba.size(), origImg.size(), factor);
-		}
-	}
-	else
-		updateFileSizeLabel();
-
-	//previewLabel->setScaledContents(true);
-	QImage img = mNewImg.scaled(mPreviewLabel->size(), Qt::KeepAspectRatio, Qt::FastTransformation);
-	mPreviewLabel->setPixmap(QPixmap::fromImage(img));
+void DkCompressDialog::drawPreview()
+{
+    if (mImg.isNull() || !isVisible())
+        return;
+
+    QImage origImg = mOrigView->getCurrentImageRegion();
+    mNewImg = QImage(origImg.size(), QImage::Format_ARGB32);
+
+    if ((mDialogMode == jpg_dialog || mDialogMode == j2k_dialog) && mHasAlpha)
+        mNewImg.fill(mBgCol.rgb());
+    else if ((mDialogMode == jpg_dialog || mDialogMode == web_dialog) && !mHasAlpha)
+        mNewImg.fill(palette().color(QPalette::Background).rgb());
+    else
+        mNewImg.fill(QColor(0, 0, 0, 0).rgba());
+
+    QPainter bgPainter(&mNewImg);
+    bgPainter.drawImage(origImg.rect(), origImg, origImg.rect());
+    bgPainter.end();
+
+    if (mDialogMode == jpg_dialog) {
+        // pre-compute the jpg compression
+        QByteArray ba;
+        QBuffer buffer(&ba);
+        buffer.open(QIODevice::ReadWrite);
+        mNewImg.save(&buffer, "JPG", getCompression());
+        mNewImg.loadFromData(ba, "JPG");
+        updateFileSizeLabel((float)ba.size(), origImg.size());
+    } else if (mDialogMode == j2k_dialog) {
+        // pre-compute the jpg compression
+        QByteArray ba;
+        QBuffer buffer(&ba);
+        buffer.open(QIODevice::ReadWrite);
+        mNewImg.save(&buffer, "J2K", getCompression());
+        mNewImg.loadFromData(ba, "J2K");
+        updateFileSizeLabel((float)ba.size(), origImg.size());
+        qDebug() << "using j2k...";
+    } else if (mDialogMode == webp_dialog && getCompression() != -1) {
+        // pre-compute the jpg compression
+        QByteArray ba;
+        QBuffer buffer(&ba);
+        buffer.open(QIODevice::ReadWrite);
+        mNewImg.save(&buffer, "WEBP", getCompression());
+        mNewImg.loadFromData(ba, "WEBP");
+        updateFileSizeLabel((float)ba.size(), origImg.size());
+        qDebug() << "using webp...";
+    } else if (mDialogMode == avif_dialog) {
+        QByteArray ba;
+        QBuffer buffer(&ba);
+        buffer.open(QIODevice::WriteOnly);
+        mNewImg.save(&buffer, "AVIF", getCompression());
+        buffer.close();
+        mNewImg.loadFromData(ba, "AVIF");
+        updateFileSizeLabel((float)ba.size(), origImg.size());
+        qDebug() << "using avif...";
+    } else if (mDialogMode == jxl_dialog) {
+        QByteArray ba;
+        QBuffer buffer(&ba);
+        buffer.open(QIODevice::WriteOnly);
+        mNewImg.save(&buffer, "JXL", getCompression());
+        buffer.close();
+        mNewImg.loadFromData(ba, "JXL");
+        updateFileSizeLabel((float)ba.size(), origImg.size());
+        qDebug() << "using jxl...";
+    } else if (mDialogMode == web_dialog) {
+        float factor = getResizeFactor();
+        if (factor != -1)
+            mNewImg = DkImage::resizeImage(mNewImg, QSize(), factor, DkImage::ipl_area);
+
+        if (!mHasAlpha) {
+            // pre-compute the jpg compression
+            QByteArray ba;
+            QBuffer buffer(&ba);
+            buffer.open(QIODevice::ReadWrite);
+            mNewImg.save(&buffer, "JPG", getCompression());
+            mNewImg.loadFromData(ba, "JPG");
+            updateFileSizeLabel((float)ba.size(), origImg.size(), factor);
+        } else {
+            // pre-compute the png compression
+            QByteArray ba;
+            QBuffer buffer(&ba);
+            buffer.open(QIODevice::ReadWrite);
+            mNewImg.save(&buffer, "PNG");
+            mNewImg.loadFromData(ba, "PNG");
+            updateFileSizeLabel((float)ba.size(), origImg.size(), factor);
+        }
+    } else
+        updateFileSizeLabel();
+
+    // previewLabel->setScaledContents(true);
+    QImage img = mNewImg.scaled(mPreviewLabel->size(), Qt::KeepAspectRatio, Qt::FastTransformation);
+    mPreviewLabel->setPixmap(QPixmap::fromImage(img));
 }
 
-void DkCompressDialog::updateFileSizeLabel(float bufferSize, QSize bufferImgSize, float factor) {
+void DkCompressDialog::updateFileSizeLabel(float bufferSize, QSize bufferImgSize, float factor)
+{
+    if (bufferImgSize.isEmpty())
+        bufferImgSize = mNewImg.size();
 
-	if (bufferImgSize.isEmpty())
-		bufferImgSize = mNewImg.size();
+    if (mImg.isNull() || bufferSize == -1 || bufferImgSize.isNull()) {
+        mPreviewSizeLabel->setText(tr("File Size: --"));
+        mPreviewSizeLabel->setEnabled(false);
+        return;
+    }
+    mPreviewSizeLabel->setEnabled(true);
 
-	if (mImg.isNull() || bufferSize == -1 || bufferImgSize.isNull()) {
-		mPreviewSizeLabel->setText(tr("File Size: --"));
-		mPreviewSizeLabel->setEnabled(false);
-		return;
-	}
-	mPreviewSizeLabel->setEnabled(true);
+    if (factor == -1.0f)
+        factor = 1.0f;
 
-	if (factor == -1.0f)
-		factor = 1.0f;
+    float depth = (mDialogMode == jpg_dialog || mDialogMode == j2k_dialog || (mDialogMode == web_dialog && mHasAlpha))
+        ? 24.0f
+        : (float)mImg.depth(); // jpg uses always 24 bit
 
-	float depth = (mDialogMode == jpg_dialog || mDialogMode == j2k_dialog || (mDialogMode == web_dialog && mHasAlpha)) ? 24.0f : (float)mImg.depth();	// jpg uses always 24 bit
-	
-	float rawBufferSize = bufferImgSize.width()*bufferImgSize.height()*depth/8.0f;
-	float rawImgSize = factor*(mImg.width()*mImg.height()*depth/8.0f);
+    float rawBufferSize = bufferImgSize.width() * bufferImgSize.height() * depth / 8.0f;
+    float rawImgSize = factor * (mImg.width() * mImg.height() * depth / 8.0f);
 
-	mPreviewSizeLabel->setText(tr("File Size: ~%1").arg(DkUtils::readableByte(rawImgSize*bufferSize/rawBufferSize)));
+    mPreviewSizeLabel->setText(tr("File Size: ~%1").arg(DkUtils::readableByte(rawImgSize * bufferSize / rawBufferSize)));
 }
 
-void DkCompressDialog::imageHasAlpha(bool hasAlpha) {
-	mHasAlpha = hasAlpha;
-	mColChooser->setVisible(hasAlpha);
+void DkCompressDialog::imageHasAlpha(bool hasAlpha)
+{
+    mHasAlpha = hasAlpha;
+    mColChooser->setVisible(hasAlpha);
 }
 
-QColor DkCompressDialog::getBackgroundColor() const {
-	return mBgCol;
+QColor DkCompressDialog::getBackgroundColor() const
+{
+    return mBgCol;
 }
 
-int DkCompressDialog::getCompression() {
+int DkCompressDialog::getCompression()
+{
+    int compression = -1;
+    if ((mDialogMode == jpg_dialog || !mCbLossless->isChecked()) && mDialogMode != web_dialog)
+        compression = mCompressionCombo->itemData(mCompressionCombo->currentIndex()).toInt();
+    else if (mDialogMode == web_dialog)
+        compression = 80;
 
-	int compression = -1;
-	if ((mDialogMode == jpg_dialog || !mCbLossless->isChecked()) && mDialogMode != web_dialog)
-		compression = mCompressionCombo->itemData(mCompressionCombo->currentIndex()).toInt();
-	else if (mDialogMode == web_dialog)
-		compression = 80;
-
-	return compression;
+    return compression;
 }
 
-float DkCompressDialog::getResizeFactor() {
-
-	float factor = -1;
-	float finalEdge = (float)mSizeCombo->itemData(mSizeCombo->currentIndex()).toInt();
-	float maxEdge = (float)std::max(mImg.width(), mImg.height());
+float DkCompressDialog::getResizeFactor()
+{
+    float factor = -1;
+    float finalEdge = (float)mSizeCombo->itemData(mSizeCombo->currentIndex()).toInt();
+    float maxEdge = (float)std::max(mImg.width(), mImg.height());
 
-	if (finalEdge != -1 && maxEdge > finalEdge)
-		factor = finalEdge/maxEdge;
+    if (finalEdge != -1 && maxEdge > finalEdge)
+        factor = finalEdge / maxEdge;
 
-	return factor;
+    return factor;
 }
 
-void DkCompressDialog::setImage(const QImage& img) {
-	mImg = img;
-	updateSnippets();
-	drawPreview();
+void DkCompressDialog::setImage(const QImage &img)
+{
+    mImg = img;
+    updateSnippets();
+    drawPreview();
 }
 
-void DkCompressDialog::setDialogMode(int dialogMode) {
-	mDialogMode = dialogMode;
-	init();
+void DkCompressDialog::setDialogMode(int dialogMode)
+{
+    mDialogMode = dialogMode;
+    init();
 }
 
-void DkCompressDialog::accept() {
+void DkCompressDialog::accept()
+{
+    saveSettings();
 
-	saveSettings();
-
-	QDialog::accept();
+    QDialog::accept();
 }
 
 // slots
-void DkCompressDialog::setVisible(bool visible) {
-
-	QDialog::setVisible(visible);
-
-	if (visible) {
-		updateSnippets();
-		drawPreview();
-		mOrigView->zoomConstraints(mOrigView->get100Factor());
-	}
+void DkCompressDialog::setVisible(bool visible)
+{
+    QDialog::setVisible(visible);
+
+    if (visible) {
+        updateSnippets();
+        drawPreview();
+        mOrigView->zoomConstraints(mOrigView->get100Factor());
+    }
 }
 
-void DkCompressDialog::newBgCol() {
-	
-	mBgCol = mColChooser->getColor();
-	drawPreview();
+void DkCompressDialog::newBgCol()
+{
+    mBgCol = mColChooser->getColor();
+    drawPreview();
 }
 
-void DkCompressDialog::losslessCompression(bool lossless) {
-
-	mCompressionCombo->setEnabled(!lossless);
-	drawPreview();
+void DkCompressDialog::losslessCompression(bool lossless)
+{
+    mCompressionCombo->setEnabled(!lossless);
+    drawPreview();
 }
 
-void DkCompressDialog::changeSizeWeb(int) {
-	drawPreview();
+void DkCompressDialog::changeSizeWeb(int)
+{
+    drawPreview();
 }
 
 }
diff --git a/ImageLounge/src/DkCore/DkSaveDialog.h b/ImageLounge/src/DkCore/DkSaveDialog.h
index 22ca149..31556b0 100644
--- a/ImageLounge/src/DkCore/DkSaveDialog.h
+++ b/ImageLounge/src/DkCore/DkSaveDialog.h
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkSaveDialog.h
  Created on:	03.07.2013
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -27,9 +27,9 @@
 
 #pragma once
 
-#pragma warning(push, 0)	// no warnings from includes - begin
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QDialog>
-#pragma warning(pop)		// no warnings from includes - end
+#pragma warning(pop) // no warnings from includes - end
 
 #ifndef DllCoreExport
 #ifdef DK_CORE_DLL_EXPORT
@@ -41,7 +41,7 @@
 #endif
 #endif
 
-#pragma warning(disable: 4251)	// TODO: remove
+#pragma warning(disable : 4251) // TODO: remove
 
 // Qt defines
 class QRadioButton;
@@ -49,101 +49,103 @@ class QCheckBox;
 class QLabel;
 class QComboBox;
 
-namespace nmc {
+namespace nmc
+{
 
 // nomacs defines
 class DkSlider;
 class DkColorChooser;
 class DkBaseViewPort;
 
-class DllCoreExport DkTifDialog : public QDialog {
-	Q_OBJECT
+class DllCoreExport DkTifDialog : public QDialog
+{
+    Q_OBJECT
 
 public:
-	DkTifDialog(QWidget* parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
+    DkTifDialog(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
 
-	int getCompression() const;
+    int getCompression() const;
 
 protected:
-	void init();
-	QRadioButton* noCompressionButton;
-	QRadioButton* compressionButton;
-	bool isOk;
-
+    void init();
+    QRadioButton *noCompressionButton;
+    QRadioButton *compressionButton;
+    bool isOk;
 };
 
-class DllCoreExport DkCompressDialog : public QDialog {
-	Q_OBJECT
+class DllCoreExport DkCompressDialog : public QDialog
+{
+    Q_OBJECT
 
 public:
-
-	enum {
-		jpg_dialog,
-		j2k_dialog,
-		webp_dialog,
-		web_dialog,
-		avif_dialog,
-
-		dialog_end
-	};
-
-	DkCompressDialog(QWidget* parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
-	virtual ~DkCompressDialog();
-
-	void imageHasAlpha(bool hasAlpha);
-	QColor getBackgroundColor() const;
-	int getCompression();
-	float getResizeFactor();
-	void setImage(const QImage& img);
-	void setDialogMode(int dialogMode);
-	virtual void accept() override;
+    enum {
+        jpg_dialog,
+        j2k_dialog,
+        webp_dialog,
+        web_dialog,
+        avif_dialog,
+        jxl_dialog,
+
+        dialog_end
+    };
+
+    DkCompressDialog(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
+    virtual ~DkCompressDialog();
+
+    void imageHasAlpha(bool hasAlpha);
+    QColor getBackgroundColor() const;
+    int getCompression();
+    float getResizeFactor();
+    void setImage(const QImage &img);
+    void setDialogMode(int dialogMode);
+    virtual void accept() override;
 
 public slots:
-	void setVisible(bool visible) override;
+    void setVisible(bool visible) override;
 
 protected slots:
-	void newBgCol();
-	void losslessCompression(bool lossless);
-	void changeSizeWeb(int);
-	void drawPreview();
-	void updateFileSizeLabel(float bufferSize = -1, QSize bufferImgSize = QSize(), float factor = -1);
-	
+    void newBgCol();
+    void losslessCompression(bool lossless);
+    void changeSizeWeb(int);
+    void drawPreview();
+    void updateFileSizeLabel(float bufferSize = -1, QSize bufferImgSize = QSize(), float factor = -1);
+
 protected:
-	void init();
-	void createLayout();
-	void updateSnippets();
-	void saveSettings();
-	void loadSettings();
-	void resizeEvent(QResizeEvent *ev) override;
-
-	enum {
-		best_quality = 0,
-		high_quality,
-		medium_quality,
-		low_quality,
-		bad_quality,
-
-		end_quality
-	};
-
-	QVector<int> mImgQuality;
-	QVector<int> mAvifImgQuality;
-
-	int mDialogMode = jpg_dialog;
-	bool mHasAlpha = false;
-	QColor mBgCol = QColor(255, 255, 255);
-
-	QCheckBox* mCbLossless = 0;
-	//DkSlider* mSlider = 0;
-	DkColorChooser* mColChooser = 0;
-	QLabel* mPreviewLabel = 0;
-	QLabel* mPreviewSizeLabel = 0;
-	DkBaseViewPort* mOrigView = 0;
-	QComboBox* mSizeCombo = 0;
-	QComboBox* mCompressionCombo = 0;
-
-	QImage mImg;
-	QImage mNewImg;
+    void init();
+    void createLayout();
+    void updateSnippets();
+    void saveSettings();
+    void loadSettings();
+    void resizeEvent(QResizeEvent *ev) override;
+
+    enum {
+        best_quality = 0,
+        high_quality,
+        medium_quality,
+        low_quality,
+        bad_quality,
+
+        end_quality
+    };
+
+    QVector<int> mImgQuality;
+    QVector<int> mAvifImgQuality;
+
+    int mDialogMode = jpg_dialog;
+    bool mHasAlpha = false;
+    QColor mBgCol = QColor(255, 255, 255);
+
+    QCheckBox *mCbLossless = 0;
+    // DkSlider* mSlider = 0;
+    DkColorChooser *mColChooser = 0;
+    QLabel *mPreviewLabel = 0;
+    QLabel *mPreviewSizeLabel = 0;
+    DkBaseViewPort *mOrigView = 0;
+    QComboBox *mSizeCombo = 0;
+    QComboBox *mCompressionCombo = 0;
+
+    QImage mImg;
+    QImage mNewImg;
 };
 
 }
diff --git a/ImageLounge/src/DkCore/DkSettings.cpp b/ImageLounge/src/DkCore/DkSettings.cpp
index 0b7d86d..d2ce1c8 100644
--- a/ImageLounge/src/DkCore/DkSettings.cpp
+++ b/ImageLounge/src/DkCore/DkSettings.cpp
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkSettings.cpp
  Created on:	07.07.2011
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2016 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2016 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2016 Florian Kleber <florian@nomacs.org>
@@ -28,1701 +28,1706 @@
 #include "DkSettings.h"
 #include "DkUtils.h"
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <iostream>
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <cassert>
+#include <iostream>
 
-#include <QImageReader>
-#include <QScreen>
+#include <QAbstractTableModel>
+#include <QApplication>
+#include <QDebug>
 #include <QDesktopServices>
-#include <QTranslator>
+#include <QDir>
 #include <QFileInfo>
-#include <QDebug>
-#include <QTableView>
-#include <QStandardItemModel>
+#include <QImageReader>
+#include <QScreen>
 #include <QStandardItem>
-#include <QAbstractTableModel>
+#include <QStandardItemModel>
+#include <QStandardPaths>
 #include <QStyledItemDelegate>
-#include <QDir>
-#include <QApplication>
+#include <QTableView>
 #include <QThreadPool>
+#include <QTranslator>
 
 #ifdef Q_OS_WIN
 #include "Shobjidl.h"
 #endif
-#pragma warning(pop)		// no warnings from includes - end
-
-namespace nmc {
-
-DkSettings::DkSettings() {
-
-	// cache settings path
-	mSettingsPath = settingsPath();
-	init();
-}
-
-void DkSettings::init() {
-	scamDataDesc = QStringList() << 
-		QT_TRANSLATE_NOOP("nmc::DkMetaData","Image Size") <<
-		QT_TRANSLATE_NOOP("nmc::DkMetaData","Orientation") <<
-		QT_TRANSLATE_NOOP("nmc::DkMetaData","Make") <<
-		QT_TRANSLATE_NOOP("nmc::DkMetaData","Model") <<
-		QT_TRANSLATE_NOOP("nmc::DkMetaData","Aperture Value") <<
-		QT_TRANSLATE_NOOP("nmc::DkMetaData","ISO") <<
-		QT_TRANSLATE_NOOP("nmc::DkMetaData","Flash") <<
-		QT_TRANSLATE_NOOP("nmc::DkMetaData","Focal Length") <<
-		QT_TRANSLATE_NOOP("nmc::DkMetaData","Exposure Mode") <<
-		QT_TRANSLATE_NOOP("nmc::DkMetaData","Exposure Time") <<
-		QT_TRANSLATE_NOOP("nmc::DkMetaData", "Compression");
-
-	sdescriptionDesc = QStringList() <<
-		QT_TRANSLATE_NOOP("nmc::DkMetaData","Rating") <<
-		QT_TRANSLATE_NOOP("nmc::DkMetaData","User Comment") << 
-		QT_TRANSLATE_NOOP("nmc::DkMetaData","Date Time") <<
-		QT_TRANSLATE_NOOP("nmc::DkMetaData","Date Time Original") <<
-		QT_TRANSLATE_NOOP("nmc::DkMetaData","Image Description") <<
-		QT_TRANSLATE_NOOP("nmc::DkMetaData","Creator") <<
-		QT_TRANSLATE_NOOP("nmc::DkMetaData","Creator Title") <<
-		QT_TRANSLATE_NOOP("nmc::DkMetaData","City") <<
-		QT_TRANSLATE_NOOP("nmc::DkMetaData","Country") <<
-		QT_TRANSLATE_NOOP("nmc::DkMetaData","Headline") <<
-		QT_TRANSLATE_NOOP("nmc::DkMetaData","Caption") <<
-		QT_TRANSLATE_NOOP("nmc::DkMetaData","Copyright") <<
-		QT_TRANSLATE_NOOP("nmc::DkMetaData","Keywords") <<
-		QT_TRANSLATE_NOOP("nmc::DkMetaData","Path") <<
-		QT_TRANSLATE_NOOP("nmc::DkMetaData","File Size");
-}
-
-double DkSettings::dpiScaleFactor(QWidget *widget) const {
-    
-	double dpi = 96.0;
+#pragma warning(pop) // no warnings from includes - end
+
+namespace nmc
+{
+
+DkSettings::DkSettings()
+{
+    // cache settings path
+    mSettingsPath = settingsPath();
+    init();
+}
+
+void DkSettings::init()
+{
+    scamDataDesc = QStringList() << QT_TRANSLATE_NOOP("nmc::DkMetaData", "Image Size") << QT_TRANSLATE_NOOP("nmc::DkMetaData", "Orientation")
+                                 << QT_TRANSLATE_NOOP("nmc::DkMetaData", "Make") << QT_TRANSLATE_NOOP("nmc::DkMetaData", "Model")
+                                 << QT_TRANSLATE_NOOP("nmc::DkMetaData", "Aperture Value") << QT_TRANSLATE_NOOP("nmc::DkMetaData", "ISO")
+                                 << QT_TRANSLATE_NOOP("nmc::DkMetaData", "Flash") << QT_TRANSLATE_NOOP("nmc::DkMetaData", "Focal Length")
+                                 << QT_TRANSLATE_NOOP("nmc::DkMetaData", "Exposure Mode") << QT_TRANSLATE_NOOP("nmc::DkMetaData", "Exposure Time")
+                                 << QT_TRANSLATE_NOOP("nmc::DkMetaData", "Compression");
+
+    sdescriptionDesc = QStringList() << QT_TRANSLATE_NOOP("nmc::DkMetaData", "Rating") << QT_TRANSLATE_NOOP("nmc::DkMetaData", "User Comment")
+                                     << QT_TRANSLATE_NOOP("nmc::DkMetaData", "Date Time") << QT_TRANSLATE_NOOP("nmc::DkMetaData", "Date Time Original")
+                                     << QT_TRANSLATE_NOOP("nmc::DkMetaData", "Image Description") << QT_TRANSLATE_NOOP("nmc::DkMetaData", "Creator")
+                                     << QT_TRANSLATE_NOOP("nmc::DkMetaData", "Creator Title") << QT_TRANSLATE_NOOP("nmc::DkMetaData", "City")
+                                     << QT_TRANSLATE_NOOP("nmc::DkMetaData", "Country") << QT_TRANSLATE_NOOP("nmc::DkMetaData", "Headline")
+                                     << QT_TRANSLATE_NOOP("nmc::DkMetaData", "Caption") << QT_TRANSLATE_NOOP("nmc::DkMetaData", "Copyright")
+                                     << QT_TRANSLATE_NOOP("nmc::DkMetaData", "Keywords") << QT_TRANSLATE_NOOP("nmc::DkMetaData", "Path")
+                                     << QT_TRANSLATE_NOOP("nmc::DkMetaData", "File Size");
+}
+
+double DkSettings::dpiScaleFactor(QWidget *widget) const
+{
+    double dpi = 96.0;
     if (widget) {
-        dpi = (double) widget->logicalDpiX();
+        dpi = (double)widget->logicalDpiX();
     } else {
-        QList<QScreen*> screens = QApplication::screens();
-        for(const QScreen* s : screens) {
-            if (s->logicalDotsPerInch() > dpi) 
-				dpi = s->logicalDotsPerInch();
+        QList<QScreen *> screens = QApplication::screens();
+        for (const QScreen *s : screens) {
+            if (s->logicalDotsPerInch() > dpi)
+                dpi = s->logicalDotsPerInch();
         }
     }
-    if (dpi < 96.0) dpi = 96.0;
+    if (dpi < 96.0)
+        dpi = 96.0;
     return dpi / 96.0;
 }
 
-int DkSettings::effectiveIconSize(QWidget *widget) const {
+int DkSettings::effectiveIconSize(QWidget *widget) const
+{
     return qRound(display_p.iconSize * dpiScaleFactor(widget));
 }
 
-int DkSettings::effectiveThumbSize(QWidget *widget) const {
+int DkSettings::effectiveThumbSize(QWidget *widget) const
+{
     return qRound(display_p.thumbSize * dpiScaleFactor(widget));
 }
 
-int DkSettings::effectiveThumbPreviewSize(QWidget *widget) const {
+int DkSettings::effectiveThumbPreviewSize(QWidget *widget) const
+{
     return qRound(display_p.thumbPreviewSize * dpiScaleFactor(widget));
 }
 
-QStringList DkSettings::translatedCamData() const {
-	return scamDataDesc;
-}
-
-QStringList DkSettings::translatedDescriptionData() const {
-	return sdescriptionDesc;
-}
-
-void DkSettings::initFileFilters() {
-
-	if (!app_p.openFilters.empty())
-		return;
-
-	QList<QByteArray> qtFormats = QImageReader::supportedImageFormats();
-
-	// formats we can save
-	if (qtFormats.contains("png"))		app_p.saveFilters.append("PNG (*.png)");
-	if (qtFormats.contains("jpg"))		app_p.saveFilters.append("JPEG (*.jpg *.jpeg *.jpe)");
-	if (qtFormats.contains("jp2"))		app_p.saveFilters.append("JPEG 2000 (*.jp2 *.j2k *.jpf *.jpx *.jpm *.jpgx)");
-	if (qtFormats.contains("tif"))		app_p.saveFilters.append("TIFF (*.tif *.tiff)");
-	if (qtFormats.contains("bmp"))		app_p.saveFilters.append("Windows Bitmap (*.bmp)");
-	if (qtFormats.contains("ppm"))		app_p.saveFilters.append("Portable Pixmap (*.ppm)");
-	if (qtFormats.contains("xbm"))		app_p.saveFilters.append("X11 Bitmap (*.xbm)");
-	if (qtFormats.contains("xpm"))		app_p.saveFilters.append("X11 Pixmap (*.xpm)");
-	if (qtFormats.contains("dds"))		app_p.saveFilters.append("Direct Draw Surface (*.dds)");
-	if (qtFormats.contains("wbmp"))		app_p.saveFilters.append("Wireless Bitmap (*.wbmp)");
-	//if (qtFormats.contains("icns"))		app_p.saveFilters.append("Apple Icon Image (*.icns)");
-
-	if (qtFormats.contains("webp"))		app_p.saveFilters.append("WebP (*.webp)");
-	if (qtFormats.contains("avif"))		app_p.saveFilters.append("AV1 Image File Format (*.avif)");
+QStringList DkSettings::translatedCamData() const
+{
+    return scamDataDesc;
+}
+
+QStringList DkSettings::translatedDescriptionData() const
+{
+    return sdescriptionDesc;
+}
+
+void DkSettings::initFileFilters()
+{
+    if (!app_p.openFilters.empty())
+        return;
+
+    QList<QByteArray> qtFormats = QImageReader::supportedImageFormats();
+
+    // formats we can save
+    if (qtFormats.contains("png"))
+        app_p.saveFilters.append("PNG (*.png)");
+    if (qtFormats.contains("jpg"))
+        app_p.saveFilters.append("JPEG (*.jpg *.jpeg *.jpe)");
+    if (qtFormats.contains("jp2"))
+        app_p.saveFilters.append("JPEG 2000 (*.jp2 *.j2k *.jpf *.jpx *.jpm *.jpgx)");
+    if (qtFormats.contains("jxl"))
+        app_p.saveFilters.append("JPEG XL (*.jxl)");
+    if (qtFormats.contains("tif"))
+        app_p.saveFilters.append("TIFF (*.tif *.tiff)");
+    if (qtFormats.contains("bmp"))
+        app_p.saveFilters.append("Windows Bitmap (*.bmp)");
+    if (qtFormats.contains("ppm"))
+        app_p.saveFilters.append("Portable Pixmap (*.ppm)");
+    if (qtFormats.contains("xbm"))
+        app_p.saveFilters.append("X11 Bitmap (*.xbm)");
+    if (qtFormats.contains("xpm"))
+        app_p.saveFilters.append("X11 Pixmap (*.xpm)");
+    if (qtFormats.contains("dds"))
+        app_p.saveFilters.append("Direct Draw Surface (*.dds)");
+    if (qtFormats.contains("wbmp"))
+        app_p.saveFilters.append("Wireless Bitmap (*.wbmp)");
+    // if (qtFormats.contains("icns"))		app_p.saveFilters.append("Apple Icon Image (*.icns)");
+
+    if (qtFormats.contains("webp"))
+        app_p.saveFilters.append("WebP (*.webp)");
+    if (qtFormats.contains("avif"))
+        app_p.saveFilters.append("AV1 Image File Format (*.avif)");
 
 #ifdef Q_OS_WIN
-	if (qtFormats.contains("ico"))		app_p.saveFilters.append("Icon Files (*.ico)");
+    if (qtFormats.contains("ico"))
+        app_p.saveFilters.append("Icon Files (*.ico)");
 #endif
 
-	// formats we can load
-	app_p.openFilters += app_p.saveFilters;
-	if (qtFormats.contains("gif"))		app_p.openFilters.append("Graphic Interchange Format (*.gif)");
-	if (qtFormats.contains("pbm"))		app_p.openFilters.append("Portable Bitmap (*.pbm)");
-	if (qtFormats.contains("pgm"))		app_p.openFilters.append("Portable Graymap (*.pgm)");
-	if (qtFormats.contains("tga"))		app_p.openFilters.append("Truvision Graphics Adapter (*.tga)");
-	if (qtFormats.contains("mng"))		app_p.openFilters.append("Multi-Image Network Graphics (*.mng)");
-	if (qtFormats.contains("cur"))		app_p.openFilters.append("Windows Cursor Files (*.cur)");
-	if (qtFormats.contains("icns"))		app_p.openFilters.append("Apple Icon Image (*.icns)");
-	if (qtFormats.contains("svgz"))		app_p.openFilters.append("Scalable Vector Graphics (*.svg *.svgz)");
-	if (qtFormats.contains("avifs"))	app_p.openFilters.append("AVIF image sequence (*.avifs)");
+    // formats we can load
+    app_p.openFilters += app_p.saveFilters;
+    if (qtFormats.contains("gif"))
+        app_p.openFilters.append("Graphic Interchange Format (*.gif)");
+    if (qtFormats.contains("pbm"))
+        app_p.openFilters.append("Portable Bitmap (*.pbm)");
+    if (qtFormats.contains("pgm"))
+        app_p.openFilters.append("Portable Graymap (*.pgm)");
+    if (qtFormats.contains("tga"))
+        app_p.openFilters.append("Truvision Graphics Adapter (*.tga)");
+    if (qtFormats.contains("mng"))
+        app_p.openFilters.append("Multi-Image Network Graphics (*.mng)");
+    if (qtFormats.contains("cur"))
+        app_p.openFilters.append("Windows Cursor Files (*.cur)");
+    if (qtFormats.contains("icns"))
+        app_p.openFilters.append("Apple Icon Image (*.icns)");
+    if (qtFormats.contains("svgz"))
+        app_p.openFilters.append("Scalable Vector Graphics (*.svg *.svgz)");
+    if (qtFormats.contains("avifs"))
+        app_p.openFilters.append("AVIF image sequence (*.avifs)");
+    if (qtFormats.contains("apng"))
+        app_p.openFilters.append("Animated Portable Network Graphics (*.apng)");
 
 #ifndef Q_OS_WIN
-	if (qtFormats.contains("ico"))		app_p.openFilters.append("Icon Files (*.ico)");
+    if (qtFormats.contains("ico"))
+        app_p.openFilters.append("Icon Files (*.ico)");
 #endif
 
 #ifdef WITH_LIBRAW
-	// raw format
-	app_p.rawFilters.append("Nikon Raw (*.nef *.nrw)");
-	app_p.rawFilters.append("Canon Raw (*.crw *.cr2 *.cr3)");
-	app_p.rawFilters.append("Sony Raw (*.arw)");
-	app_p.rawFilters.append("Digital Negativ (*.dng)");
-	app_p.rawFilters.append("Panasonic Raw (*.raw *.rw2)");
-	app_p.rawFilters.append("Minolta Raw (*.mrw)");
-	app_p.rawFilters.append("Samsung Raw (*.srw)");
-	app_p.rawFilters.append("Olympus Raw (*.orf)");
-	app_p.rawFilters.append("Hasselblad Raw (*.3fr)");
-	app_p.rawFilters.append("Sigma Raw (*.x3f)");
-	app_p.rawFilters.append("Leaf Raw (*.mos)");
-	app_p.rawFilters.append("Pentax Raw (*.pef)");
-	app_p.rawFilters.append("Phase One (*.iiq)");
-	app_p.rawFilters.append("Fujifilm Raw (*.raf)");
-
-	app_p.openFilters += app_p.rawFilters;
+    // raw format
+    app_p.rawFilters.append("Nikon Raw (*.nef *.nrw)");
+    app_p.rawFilters.append("Canon Raw (*.crw *.cr2 *.cr3)");
+    app_p.rawFilters.append("Sony Raw (*.arw)");
+    app_p.rawFilters.append("Digital Negativ (*.dng)");
+    app_p.rawFilters.append("Panasonic Raw (*.raw *.rw2)");
+    app_p.rawFilters.append("Minolta Raw (*.mrw)");
+    app_p.rawFilters.append("Samsung Raw (*.srw)");
+    app_p.rawFilters.append("Olympus Raw (*.orf)");
+    app_p.rawFilters.append("Hasselblad Raw (*.3fr)");
+    app_p.rawFilters.append("Sigma Raw (*.x3f)");
+    app_p.rawFilters.append("Leaf Raw (*.mos)");
+    app_p.rawFilters.append("Pentax Raw (*.pef)");
+    app_p.rawFilters.append("Phase One (*.iiq)");
+    app_p.rawFilters.append("Fujifilm Raw (*.raf)");
+
+    app_p.openFilters += app_p.rawFilters;
 #endif
 
-	// stereo formats
-	app_p.openFilters.append("JPEG Stereo (*.jps)");
-	app_p.openFilters.append("PNG Stereo (*.pns)");
-	app_p.openFilters.append("Multi Picture Object (*.mpo)");
+    // stereo formats
+    app_p.openFilters.append("JPEG Stereo (*.jps)");
+    app_p.openFilters.append("PNG Stereo (*.pns)");
+    app_p.openFilters.append("Multi Picture Object (*.mpo)");
 
-	// other formats
-	app_p.openFilters.append("Adobe Photoshop (*.psd)");
-	app_p.openFilters.append("Large Document Format (*.psb)");
+    // other formats
+    app_p.openFilters.append("Adobe Photoshop (*.psd)");
+    app_p.openFilters.append("Large Document Format (*.psb)");
 
-	// archive formats
-	app_p.containerFilters.append("ZIP Archive (*.zip)");
-	app_p.containerFilters.append("Microsoft Word Document (*.docx)");
-	app_p.containerFilters.append("Microsoft PowerPoint Document (*.pptx)");
-	app_p.containerFilters.append("Microsoft Excel Document (*.xlsx)");
-	app_p.containerFilters.append("Comic Book Archive (*.cbz)");
-	app_p.containerFilters.append("Krita (*.kra)");
-	
-	app_p.openFilters += app_p.containerFilters;
+    // archive formats
+    app_p.containerFilters.append("ZIP Archive (*.zip)");
+    app_p.containerFilters.append("Microsoft Word Document (*.docx)");
+    app_p.containerFilters.append("Microsoft PowerPoint Document (*.pptx)");
+    app_p.containerFilters.append("Microsoft Excel Document (*.xlsx)");
+    app_p.containerFilters.append("Comic Book Archive (*.cbz)");
+    app_p.containerFilters.append("Krita (*.kra)");
 
-	app_p.containerRawFilters = "*.docx *.pptx *.xlsx *.zip";
+    app_p.openFilters += app_p.containerFilters;
+
+    app_p.containerRawFilters = "*.docx *.pptx *.xlsx *.zip";
 
     // exif filter as reported in #518 - afaik this is not a standard (typically it contains jpg/tiff)
     app_p.openFilters.append("EXIF (*.exif)");
 
-	// finally: fabians filter & OpenCV vecs
-	app_p.openFilters.append("OpenCV Haar Training (*.vec)");
-	app_p.openFilters.append("Rohkost (*.roh)");
+    // finally: fabians filter & OpenCV vecs
+    app_p.openFilters.append("OpenCV Haar Training (*.vec)");
+    app_p.openFilters.append("Rohkost (*.roh)");
 
     // drif images
     app_p.openFilters.append("Developers Raw Image Format (*.drif)");
 
-	// load user filters
-	DefaultSettings settings;
-	app_p.openFilters += settings.value("ResourceSettings/userFilters", QStringList()).toStringList();
+    // load user filters
+    DefaultSettings settings;
+    app_p.openFilters += settings.value("ResourceSettings/userFilters", QStringList()).toStringList();
 
-	for (int idx = 0; idx < app_p.openFilters.size(); idx++) {
+    for (int idx = 0; idx < app_p.openFilters.size(); idx++) {
+        QString cFilter = app_p.openFilters[idx];
+        cFilter = cFilter.section(QRegularExpression("(\\(|\\))"), 1);
+        cFilter = cFilter.replace(")", "");
+        app_p.fileFilters += cFilter.split(" ");
+    }
 
-		QString cFilter = app_p.openFilters[idx];
-		cFilter = cFilter.section(QRegExp("(\\(|\\))"), 1);
-		cFilter = cFilter.replace(")", "");
-		app_p.fileFilters += cFilter.split(" ");
-	}
-
-	QString allFilters = app_p.fileFilters.join(" ");
-
-	// add unknown formats from Qt plugins
-	for (int idx = 0; idx < qtFormats.size(); idx++) {
-
-		if (!allFilters.contains(qtFormats.at(idx))) {
-			app_p.openFilters.append("Image Format (*." + qtFormats.at(idx) + ")");
-			app_p.fileFilters.append("*." + qtFormats.at(idx));
-		}
-	}
-
-	app_p.openFilters.prepend("Image Files (" + app_p.fileFilters.join(" ") + ")");
-
-//#ifdef Q_OS_WIN
-//	app_p.fileFilters.append("*.lnk");
-//#endif
-
-}
-
-void DkSettings::loadTranslation(const QString& fileName, QTranslator& translator) {
-
-	QStringList translationDirs = getTranslationDirs();
-
-	for (int idx = 0; idx < translationDirs.size(); idx++) {
-
-		if (translator.load(fileName, translationDirs[idx])) {
-			qDebugClean() << "translation loaded from: " << translationDirs[idx] << "/" << fileName;
-			break;
-		}
-	}
-}
-
-QStringList DkSettings::getTranslationDirs() {
-	
-	QStringList trDirs;
-	trDirs << DkUtils::getTranslationPath();
-	trDirs << qApp->applicationDirPath();
-	
-	QStringList rDirs;
-	rDirs << qApp->applicationDirPath();
-	rDirs << QStandardPaths::standardLocations(QStandardPaths::DataLocation);
-
-	for (const QString& d : rDirs)
-		trDirs << d + QDir::separator() + "translations";
-
-	trDirs.removeDuplicates();
-
-	return trDirs;
-}
-
-void DkSettings::load() {
-
-	DefaultSettings s;
-	load(s);
-}
-
-void DkSettings::load(QSettings& settings, bool defaults) {
-
-	applyDefaultsFromFile();	// copies entries from "default.ini" to the user settings file
-	setToDefaultSettings();
-	qInfoClean() << "loading settings from: " << settings.fileName();
-
-	settings.beginGroup("AppSettings");
-
-	app_p.showMenuBar = settings.value("showMenuBar", app_p.showMenuBar).toBool();
-	app_p.showToolBar = settings.value("showToolBar", app_p.showToolBar).toBool();
-	app_p.showStatusBar = settings.value("showStatusBar", app_p.showStatusBar).toBool();
-	
-	QBitArray tmpShow = settings.value("showFileInfoLabel", app_p.showFileInfoLabel).toBitArray();
-	if (tmpShow.size() == app_p.showFileInfoLabel.size())	
-		app_p.showFileInfoLabel = tmpShow;
-	tmpShow = settings.value("showScroller", app_p.showScroller).toBitArray();
-	if (tmpShow.size() == app_p.showScroller.size())	
-		app_p.showScroller = tmpShow;
-	tmpShow = settings.value("showFilePreview", app_p.showFilePreview).toBitArray();
-	if (tmpShow.size() == app_p.showFilePreview.size())	
-		app_p.showFilePreview = tmpShow;
-	tmpShow = settings.value("showMetaData", app_p.showMetaData).toBitArray();
-	if (tmpShow.size() == app_p.showMetaData.size())	
-		app_p.showMetaData = tmpShow;
-	tmpShow = settings.value("showPlayer", app_p.showPlayer).toBitArray();
-	if (tmpShow.size() == app_p.showPlayer.size())	
-		app_p.showPlayer = tmpShow;
-	tmpShow = settings.value("showHistogram", app_p.showHistogram).toBitArray();
-	if (tmpShow.size() == app_p.showHistogram.size())	
-		app_p.showHistogram = tmpShow;
-	tmpShow = settings.value("showOverview", app_p.showOverview).toBitArray();
-	if (tmpShow.size() == app_p.showOverview.size())	
-		app_p.showOverview = tmpShow;
-	tmpShow = settings.value("showComment", app_p.showComment).toBitArray();
-	if (tmpShow.size() == app_p.showComment.size())	
-		app_p.showComment = tmpShow;
-	tmpShow = settings.value("showExplorer", app_p.showExplorer).toBitArray();
-	if (tmpShow.size() == app_p.showExplorer.size())	
-		app_p.showExplorer = tmpShow;
-	tmpShow = settings.value("showMetaDataDock", app_p.showMetaDataDock).toBitArray();
-	if (tmpShow.size() == app_p.showMetaDataDock.size())	
-		app_p.showMetaDataDock = tmpShow;
-	tmpShow = settings.value("showEditDock", app_p.showEditDock).toBitArray();
-	if (tmpShow.size() == app_p.showEditDock.size())	
-		app_p.showEditDock = tmpShow;
-	tmpShow = settings.value("showHistoryDock", app_p.showHistoryDock).toBitArray();
-	if (tmpShow.size() == app_p.showHistoryDock.size())	
-		app_p.showHistoryDock = tmpShow;
-	tmpShow = settings.value("showLogDock", app_p.showLogDock).toBitArray();
-	if (tmpShow.size() == app_p.showLogDock.size())
-		app_p.showLogDock = tmpShow;
-
-	app_p.hideAllPanels = settings.value("hideAllPanels", app_p.hideAllPanels).toBool();
-	app_p.closeOnEsc = settings.value("closeOnEsc", app_p.closeOnEsc).toBool();
-	app_p.showRecentFiles = settings.value("showRecentFiles", app_p.showRecentFiles).toBool();
-	app_p.useLogFile = settings.value("useLogFile", app_p.useLogFile).toBool();
-	app_p.defaultJpgQuality = settings.value("defaultJpgQuality", app_p.defaultJpgQuality).toInt();
-
-	QStringList tmpFileFilters = app_p.fileFilters;
-	QStringList tmpContainerFilters = app_p.containerRawFilters.split(" ");
-	for (int idx = 0; idx < tmpContainerFilters.size(); idx++) {
-		tmpFileFilters.removeAll(tmpContainerFilters.at(idx));
-	}
-	app_p.browseFilters = settings.value("browseFilters", tmpFileFilters).toStringList();
-
-	// double-check (if user removes all filters he can't browse anymore - so override this case)
-	if (app_p.browseFilters.empty())
-		app_p.browseFilters = tmpFileFilters;
-
-	app_p.registerFilters = settings.value("registerFilters", app_p.registerFilters).toStringList();
-	app_p.advancedSettings = settings.value("advancedSettings", app_p.advancedSettings).toBool();
-
-	settings.endGroup();
-	// Global Settings --------------------------------------------------------------------
-	settings.beginGroup("GlobalSettings");
-
-	global_p.skipImgs = settings.value("skipImgs", global_p.skipImgs).toInt();
-	global_p.checkOpenDuplicates = settings.value("checkOpenDuplicates", global_p.checkOpenDuplicates).toBool();
-	global_p.extendedTabs = settings.value("extendedTabs", global_p.extendedTabs).toBool();
-
-	global_p.loop = settings.value("loop", global_p.loop).toBool();
-	global_p.scanSubFolders = settings.value("scanRecursive", global_p.scanSubFolders).toBool();
-	global_p.lastDir = settings.value("lastDir", global_p.lastDir).toString();
-	global_p.searchHistory = settings.value("searchHistory", global_p.searchHistory).toStringList();
-	global_p.recentFolders = settings.value("recentFolders", global_p.recentFolders).toStringList();
-	global_p.pinnedFiles = settings.value("pinnedFiles", global_p.pinnedFiles).toStringList();
-	global_p.recentFiles = settings.value("recentFiles", global_p.recentFiles).toStringList();
-	global_p.logRecentFiles = settings.value("logRecentFiles", global_p.logRecentFiles).toBool();
-	global_p.askToSaveDeletedFiles = settings.value("askToSaveDeletedFiles", global_p.askToSaveDeletedFiles).toBool();
-	global_p.tmpPath = settings.value("tmpPath", global_p.tmpPath).toString();
-	global_p.language = settings.value("language", global_p.language).toString();
-	global_p.numThreads = settings.value("numThreads", global_p.numThreads).toInt();
-
-	global_p.sortMode = settings.value("sortMode", global_p.sortMode).toInt();
-	global_p.sortDir = settings.value("sortDir", global_p.sortDir).toInt();
-	global_p.setupPath = settings.value("setupPath", global_p.setupPath).toString();
-	global_p.setupVersion = settings.value("setupVersion", global_p.setupVersion).toString();
-	global_p.zoomOnWheel = settings.value("zoomOnWheel", global_p.zoomOnWheel).toBool();
-	global_p.horZoomSkips = settings.value("horZoomSkips", global_p.horZoomSkips).toBool();
-	global_p.doubleClickForFullscreen = settings.value("doubleClickForFullscreen", global_p.doubleClickForFullscreen).toBool();
-	global_p.showBgImage = settings.value("showBgImage", global_p.showBgImage).toBool();
-
-	settings.endGroup();
-	// Display Settings --------------------------------------------------------------------
-	settings.beginGroup("DisplaySettings");
-
-	display_p.keepZoom = settings.value("keepZoom", display_p.keepZoom).toInt();
-	display_p.invertZoom = settings.value("invertZoom", display_p.invertZoom).toBool();
-	display_p.zoomToFit = settings.value("zoomToFit", display_p.zoomToFit).toBool();
-	display_p.highlightColor = QColor::fromRgba(settings.value("highlightColorRGBA", display_p.highlightColor.rgba()).toInt());
-	display_p.hudBgColor = QColor::fromRgba(settings.value("bgColorWidgetRGBA", display_p.hudBgColor.rgba()).toInt());
-	display_p.hudFgdColor = QColor::fromRgba(settings.value("fontColorRGBA", display_p.hudFgdColor.rgba()).toInt());
-	display_p.bgColor = QColor::fromRgba(settings.value("bgColorNoMacsRGBA", display_p.bgColor.rgba()).toInt());
-	display_p.iconColor = QColor::fromRgba(settings.value("iconColorRGBA", display_p.iconColor.rgba()).toInt());
-	display_p.bgColorFrameless = QColor::fromRgba(settings.value("bgColorFramelessRGBA", display_p.bgColorFrameless.rgba()).toInt());
-	display_p.thumbSize = settings.value("thumbSize", display_p.thumbSize).toInt();
-	display_p.iconSize = settings.value("iconSize", display_p.iconSize).toInt();
-	display_p.thumbPreviewSize = settings.value("thumbPreviewSize", display_p.thumbPreviewSize).toInt();
-	//display_p.saveThumb = settings.value("saveThumb", display_p.saveThumb).toBool();
-	display_p.antiAliasing = settings.value("antiAliasing", display_p.antiAliasing).toBool();
-	display_p.highQualityAntiAliasing = settings.value("highQualityAntiAliasing", display_p.highQualityAntiAliasing).toBool();
-	display_p.showCrop = settings.value("showCrop", display_p.showCrop).toBool();
-	display_p.histogramStyle = settings.value("histogramStyle", display_p.histogramStyle).toInt();
-	display_p.tpPattern = settings.value("tpPattern", display_p.tpPattern).toBool();
-	display_p.showNavigation = settings.value("showNavigation", display_p.showNavigation).toBool();
-	display_p.themeName = settings.value("themeName312", display_p.themeName).toString();
-	display_p.showBorder = settings.value("showBorder", display_p.showBorder).toBool();
-	display_p.displaySquaredThumbs = settings.value("displaySquaredThumbs", display_p.displaySquaredThumbs).toBool();
-	display_p.showThumbLabel = settings.value("showThumbLabel", display_p.showThumbLabel).toBool();
-	display_p.showScrollBars = settings.value("showScrollBars", display_p.showScrollBars).toBool();
-	display_p.animationDuration = settings.value("fadeSec", display_p.animationDuration).toFloat();
-	display_p.alwaysAnimate = settings.value("alwaysAnimate", display_p.alwaysAnimate).toBool();
-	display_p.transition = (TransitionMode)settings.value("transition", display_p.transition).toInt();
-	display_p.defaultBackgroundColor = settings.value("useDefaultColor", display_p.defaultBackgroundColor).toBool();
-	display_p.defaultIconColor = settings.value("defaultIconColor", display_p.defaultIconColor).toBool();
-	display_p.interpolateZoomLevel = settings.value("interpolateZoomlevel", display_p.interpolateZoomLevel).toInt();
-
-	settings.endGroup();
-	// MetaData Settings --------------------------------------------------------------------
-	settings.beginGroup("MetaDataSettings");
-
-	meta_p.ignoreExifOrientation = settings.value("ignoreExifOrientation", meta_p.ignoreExifOrientation).toBool();
-	meta_p.saveExifOrientation = settings.value("saveExifOrientation", meta_p.saveExifOrientation).toBool();
-
-	settings.endGroup();
-	// SlideShow Settings --------------------------------------------------------------------
-	settings.beginGroup("SlideShowSettings");
-
-	slideShow_p.filter = settings.value("filter", slideShow_p.filter).toInt();
-	slideShow_p.time = settings.value("time", slideShow_p.time).toFloat();
-	slideShow_p.showPlayer = settings.value("showPlayer", slideShow_p.showPlayer).toBool();
-	slideShow_p.moveSpeed = settings.value("moveSpeed", slideShow_p.moveSpeed).toFloat();
-	slideShow_p.backgroundColor = QColor::fromRgba(settings.value("backgroundColorRGBA", slideShow_p.backgroundColor.rgba()).toInt());
-	slideShow_p.silentFullscreen = settings.value("silentFullscreen", slideShow_p.silentFullscreen).toBool();
-	QBitArray tmpDisplay = settings.value("display", slideShow_p.display).toBitArray();
-
-	if (tmpDisplay.size() == slideShow_p.display.size())
-		slideShow_p.display = tmpDisplay;
-
-	settings.endGroup();
-	// Synchronize Settings --------------------------------------------------------------------
-	settings.beginGroup("SynchronizeSettings");
-
-	sync_p.checkForUpdates = settings.value("checkForUpdates", sync_p.checkForUpdates).toBool();
-	sync_p.disableUpdateInteraction = settings.value("disableUpdateInteraction", sync_p.disableUpdateInteraction).toBool();
-	sync_p.updateDialogShown = settings.value("updateDialogShown", sync_p.updateDialogShown).toBool();
-	sync_p.lastUpdateCheck = settings.value("lastUpdateCheck", sync_p.lastUpdateCheck).toDate();
-	sync_p.syncAbsoluteTransform = settings.value("syncAbsoluteTransform", sync_p.syncAbsoluteTransform).toBool();
-	sync_p.switchModifier = settings.value("switchModifier", sync_p.switchModifier).toBool();
-	sync_p.syncActions = settings.value("syncActions", sync_p.syncActions).toBool();
-
-	settings.endGroup();
-	// Resource Settings --------------------------------------------------------------------
-	settings.beginGroup("ResourceSettings");
-
-	resources_p.cacheMemory = settings.value("cacheMemory", resources_p.cacheMemory).toFloat();
-	resources_p.historyMemory = settings.value("historyMemory", resources_p.historyMemory).toFloat();
-	resources_p.nativeDialog = settings.value("nativeDialog", resources_p.nativeDialog).toBool();
-	resources_p.maxImagesCached = settings.value("maxImagesCached", resources_p.maxImagesCached).toInt();
-	resources_p.waitForLastImg = settings.value("waitForLastImg", resources_p.waitForLastImg).toBool();
-	resources_p.filterRawImages = settings.value("filterRawImages", resources_p.filterRawImages).toBool();	
-	resources_p.loadRawThumb = settings.value("loadRawThumb", resources_p.loadRawThumb).toInt();	
-	resources_p.filterDuplicats = settings.value("filterDuplicates", resources_p.filterDuplicats).toBool();
-	resources_p.preferredExtension = settings.value("preferredExtension", resources_p.preferredExtension).toString();	
-	resources_p.gammaCorrection = settings.value("gammaCorrection", resources_p.gammaCorrection).toBool();
-	resources_p.loadSavedImage = settings.value("loadSavedImage", resources_p.loadSavedImage).toInt();
-
-	if (sync_p.switchModifier) {
-		global_p.altMod = Qt::ControlModifier;
-		global_p.ctrlMod = Qt::AltModifier;
-	}
-	else {
-		global_p.altMod = Qt::AltModifier;
-		global_p.ctrlMod = Qt::ControlModifier;
-	}
-
-	settings.endGroup();
-
-	if (global_p.numThreads != -1)
-		QThreadPool::globalInstance()->setMaxThreadCount(global_p.numThreads);
-	else
-		global_p.numThreads = QThreadPool::globalInstance()->maxThreadCount();
-
-	// keep loaded settings in mind
-	if (defaults) {
-		app_d = app_p;
-		global_d = global_p;
-		display_d = display_p;
-		slideShow_d = slideShow_p;
-		sync_d = sync_p;
-		meta_d = meta_p;
-		resources_d = resources_p;
-	}
-}
-
-void DkSettings::save(bool force) {
-	DefaultSettings s;
-	save(s, force);
-}
-
-void DkSettings::save(QSettings& settings, bool force) {
-		
-	if (DkSettingsManager::param().app().privateMode)
-		return;
-
-	settings.beginGroup("AppSettings");
-	if (force ||app_p.showMenuBar != app_d.showMenuBar)
-		settings.setValue("showMenuBar", app_p.showMenuBar);
-
-	if (app_p.currentAppMode != mode_frameless && app_p.currentAppMode != mode_frameless_fullscreen) {
-		
-		if (force ||app_p.showToolBar != app_d.showToolBar)
-			settings.setValue("showToolBar", app_p.showToolBar);
-
-		if (force ||app_p.showStatusBar != app_d.showStatusBar)
-			settings.setValue("showStatusBar", app_p.showStatusBar);
-	}
-
-	if (force ||app_p.showFileInfoLabel != app_d.showFileInfoLabel)
-		settings.setValue("showFileInfoLabel", app_p.showFileInfoLabel);
-	if (force ||app_p.showFilePreview != app_d.showFilePreview)
-		settings.setValue("showFilePreview", app_p.showFilePreview);
-	if (force ||app_p.showScroller != app_d.showScroller)
-		settings.setValue("showScroller", app_p.showScroller);
-	if (force ||app_p.showMetaData != app_d.showMetaData)
-		settings.setValue("showMetaData", app_p.showMetaData);
-	if (force ||app_p.showPlayer != app_d.showPlayer)
-		settings.setValue("showPlayer", app_p.showPlayer);
-	if (force ||app_p.showHistogram != app_d.showHistogram)
-		settings.setValue("showHistogram", app_p.showHistogram);
-	if (force ||app_p.showComment != app_d.showComment)
-		settings.setValue("showComment", app_p.showComment);
-	if (force ||app_p.showOverview != app_d.showOverview)
-		settings.setValue("showOverview", app_p.showOverview);
-	if (force ||app_p.showExplorer != app_d.showExplorer)
-		settings.setValue("showExplorer", app_p.showExplorer);
-	if (force ||app_p.showMetaDataDock != app_d.showMetaDataDock)
-		settings.setValue("showMetaDataDock", app_p.showMetaDataDock);
-	if (force ||app_p.showEditDock != app_d.showEditDock)
-		settings.setValue("showEditDock", app_p.showEditDock);
-	if (force ||app_p.showHistoryDock != app_d.showHistoryDock)
-		settings.setValue("showHistoryDock", app_p.showHistoryDock);
-	if (force || app_p.showLogDock != app_d.showLogDock)
-		settings.setValue("showLogDock", app_p.showLogDock);
-	if (force || app_p.hideAllPanels != app_d.hideAllPanels)
-		settings.setValue("hideAllPanels", app_p.hideAllPanels);
-	if (force ||app_p.advancedSettings != app_d.advancedSettings)
-		settings.setValue("advancedSettings", app_p.advancedSettings);
-	if (force ||app_p.closeOnEsc != app_d.closeOnEsc)
-		settings.setValue("closeOnEsc", app_p.closeOnEsc);
-	if (force ||app_p.showRecentFiles != app_d.showRecentFiles)
-		settings.setValue("showRecentFiles", app_p.showRecentFiles);
-	if (force ||app_p.useLogFile != app_d.useLogFile)
-		settings.setValue("useLogFile", app_p.useLogFile);
-	if (force ||app_p.browseFilters != app_d.browseFilters)
-		settings.setValue("browseFilters", app_p.browseFilters);
-	if (force ||app_p.registerFilters != app_d.registerFilters)
-		settings.setValue("registerFilters", app_p.registerFilters);
-
-	// always save (user setting)
-	settings.setValue("defaultJpgQuality", app_p.defaultJpgQuality);
-	settings.setValue("appMode", app_p.appMode);
-	settings.setValue("currentAppMode", app_p.currentAppMode);
-
-	settings.endGroup();
-	// Global Settings --------------------------------------------------------------------
-	settings.beginGroup("GlobalSettings");
-
-	if (force ||global_p.skipImgs != global_d.skipImgs)
-		settings.setValue("skipImgs",global_p.skipImgs);
-	if (force ||global_p.checkOpenDuplicates != global_d.checkOpenDuplicates)
-		settings.setValue("checkOpenDuplicates",global_p.checkOpenDuplicates);
-	if (force ||global_p.extendedTabs != global_d.extendedTabs)
-		settings.setValue("extendedTabs", global_p.extendedTabs);
-	if (force ||global_p.loop != global_d.loop)
-		settings.setValue("loop",global_p.loop);
-	if (force ||global_p.scanSubFolders != global_d.scanSubFolders)
-		settings.setValue("scanRecursive",global_p.scanSubFolders);
-	if (force ||global_p.lastDir != global_d.lastDir)
-		settings.setValue("lastDir", global_p.lastDir);
-	if (force ||global_p.searchHistory != global_d.searchHistory)
-		settings.setValue("searchHistory", global_p.searchHistory);
-	if (force ||global_p.recentFolders != global_d.recentFolders)
-		settings.setValue("recentFolders", global_p.recentFolders);
-	if (force ||global_p.recentFiles != global_d.recentFiles)
-		settings.setValue("recentFiles", global_p.recentFiles);
-	if (force || global_p.pinnedFiles != global_d.pinnedFiles)
-		settings.setValue("pinnedFiles", global_p.pinnedFiles);
-	if (force ||global_p.logRecentFiles != global_d.logRecentFiles)
-		settings.setValue("logRecentFiles", global_p.logRecentFiles);
-	if (force ||global_p.askToSaveDeletedFiles != global_d.askToSaveDeletedFiles)
-		settings.setValue("askToSaveDeletedFiles", global_p.askToSaveDeletedFiles);
-	if (force ||global_p.tmpPath != global_d.tmpPath)
-		settings.setValue("tmpPath", global_p.tmpPath);
-	if (force ||global_p.language != global_d.language)
-		settings.setValue("language", global_p.language);
-	if (force ||global_p.numThreads != global_d.numThreads)
-		settings.setValue("numThreads", global_p.numThreads);
-	if (force ||global_p.sortMode != global_d.sortMode)
-		settings.setValue("sortMode", global_p.sortMode);
-	if (force ||global_p.sortDir != global_d.sortDir)
-		settings.setValue("sortDir", global_p.sortDir);
-	if (force ||global_p.setupPath != global_d.setupPath)
-		settings.setValue("setupPath", global_p.setupPath);
-	if (force ||global_p.setupVersion != global_d.setupVersion)
-		settings.setValue("setupVersion", global_p.setupVersion);
-	if (force ||global_p.zoomOnWheel != global_d.zoomOnWheel)
-		settings.setValue("zoomOnWheel", global_p.zoomOnWheel);
-	if (force ||global_p.horZoomSkips != global_d.horZoomSkips)
-		settings.setValue("horZoomSkips", global_p.horZoomSkips);
-	if (force ||global_p.doubleClickForFullscreen != global_d.doubleClickForFullscreen)
-		settings.setValue("doubleClickForFullscreen", global_p.doubleClickForFullscreen);
-	if (force ||global_p.showBgImage != global_d.showBgImage)
-		settings.setValue("showBgImage", global_p.showBgImage);
-
-	settings.endGroup();
-	// Display Settings --------------------------------------------------------------------
-	settings.beginGroup("DisplaySettings");
-
-	if (force ||display_p.keepZoom != display_d.keepZoom)
-		settings.setValue("keepZoom",display_p.keepZoom);
-	if (force ||display_p.invertZoom != display_d.invertZoom)
-		settings.setValue("invertZoom",display_p.invertZoom);
-	if (force ||display_p.zoomToFit != display_d.zoomToFit)
-		settings.setValue("zoomToFit",display_p.zoomToFit);
-	if (force ||display_p.highlightColor != display_d.highlightColor)
-		settings.setValue("highlightColorRGBA", display_p.highlightColor.rgba());
-	if (force ||display_p.hudBgColor != display_d.hudBgColor)
-		settings.setValue("bgColorWidgetRGBA", display_p.hudBgColor.rgba());
-	if (force ||display_p.hudFgdColor != display_d.hudFgdColor)
-		settings.setValue("fontColorRGBA", display_p.hudFgdColor.rgba());
-	if (force || display_p.bgColor != display_d.bgColor)
-		settings.setValue("bgColorNoMacsRGBA", display_p.bgColor.rgba());
-	if (force ||display_p.iconColor != display_d.iconColor)
-		settings.setValue("iconColorRGBA", display_p.iconColor.rgba());
-	if (force ||display_p.bgColorFrameless != display_d.bgColorFrameless)
-		settings.setValue("bgColorFramelessRGBA", display_p.bgColorFrameless.rgba());
-	if (force ||display_p.thumbSize != display_d.thumbSize)
-		settings.setValue("thumbSize", display_p.thumbSize);
-	if (force ||display_p.iconSize != display_d.iconSize)
-		settings.setValue("iconSize", display_p.iconSize);
-	if (force ||display_p.thumbPreviewSize != display_d.thumbPreviewSize)
-		settings.setValue("thumbPreviewSize", display_p.thumbPreviewSize);
-	//if (force ||display_p.saveThumb != display_d.saveThumb)
-	//	settings.setValue("saveThumb", display_p.saveThumb);
-	if (force ||display_p.antiAliasing != display_d.antiAliasing)
-		settings.setValue("antiAliasing", display_p.antiAliasing);
-	if (force || display_p.highQualityAntiAliasing != display_d.highQualityAntiAliasing)
-		settings.setValue("highQualityAntiAliasing", display_p.highQualityAntiAliasing);
-	if (force ||display_p.showCrop != display_d.showCrop)
-		settings.setValue("showCrop", display_p.showCrop);
-	if (force ||display_p.histogramStyle != display_d.histogramStyle)
-		settings.setValue("histogramStyle", display_p.histogramStyle);
-	if (force ||display_p.tpPattern != display_d.tpPattern)
-		settings.setValue("tpPattern", display_p.tpPattern);
-	if (force || display_p.showNavigation != display_d.showNavigation)
-		settings.setValue("showNavigation", display_p.showNavigation);
-	if (force || display_p.themeName != display_d.themeName)
-		settings.setValue("themeName312", display_p.themeName);
-	if (force ||display_p.showBorder != display_d.showBorder)
-		settings.setValue("showBorder", display_p.showBorder);
-	if (force ||display_p.displaySquaredThumbs != display_d.displaySquaredThumbs)
-		settings.setValue("displaySquaredThumbs", display_p.displaySquaredThumbs);
-	if (force ||display_p.showThumbLabel != display_d.showThumbLabel)
-		settings.setValue("showThumbLabel", display_p.showThumbLabel);
-	if (force || display_p.showScrollBars != display_d.showScrollBars)
-		settings.setValue("showScrollBars", display_p.showScrollBars);
-	if (force ||display_p.alwaysAnimate != display_d.alwaysAnimate)
-		settings.setValue("alwaysAnimate", display_p.alwaysAnimate);
-	if (force ||display_p.animationDuration != display_d.animationDuration)
-		settings.setValue("fadeSec", display_p.animationDuration);
-	if (force ||display_p.transition != display_d.transition)
-		settings.setValue("transition", display_p.transition);
-	if (force ||display_p.defaultBackgroundColor != display_d.defaultBackgroundColor)
-		settings.setValue("useDefaultColor", display_p.defaultBackgroundColor);
-	if (force ||display_p.defaultIconColor != display_d.defaultIconColor)
-		settings.setValue("defaultIconColor", display_p.defaultIconColor);
-	if (force ||display_p.interpolateZoomLevel != display_d.interpolateZoomLevel)
-		settings.setValue("interpolateZoomlevel", display_p.interpolateZoomLevel);
-
-	settings.endGroup();
-	// MetaData Settings --------------------------------------------------------------------
-	settings.beginGroup("MetaDataSettings");
-	
-	if (force ||meta_p.ignoreExifOrientation != meta_d.ignoreExifOrientation)
-		settings.setValue("ignoreExifOrientation", meta_p.ignoreExifOrientation);
-	if (force ||meta_p.saveExifOrientation != meta_d.saveExifOrientation)
-		settings.setValue("saveExifOrientation", meta_p.saveExifOrientation);
-
-	settings.endGroup();
-	// SlideShow Settings --------------------------------------------------------------------
-	settings.beginGroup("SlideShowSettings");
-
-	if (force ||slideShow_p.filter != slideShow_d.filter)
-		settings.setValue("filter", slideShow_p.filter);
-	if (force ||slideShow_p.time != slideShow_d.time)
-		settings.setValue("time", slideShow_p.time);
-	if (force || slideShow_p.showPlayer != slideShow_d.showPlayer)
-		settings.setValue("showPlayer", slideShow_p.showPlayer);
-	if (force ||slideShow_p.moveSpeed != slideShow_d.moveSpeed)
-		settings.setValue("moveSpeed", slideShow_p.moveSpeed);
-	if (force ||slideShow_p.display != slideShow_d.display)
-		settings.setValue("display", slideShow_p.display);
-	if (force ||slideShow_p.backgroundColor != slideShow_d.backgroundColor)
-		settings.setValue("backgroundColorRGBA", slideShow_p.backgroundColor.rgba());
-	if (force ||slideShow_p.silentFullscreen != slideShow_d.silentFullscreen)
-		settings.setValue("silentFullscreen", slideShow_p.silentFullscreen);
-
-	settings.endGroup();
-	// Sync Settings --------------------------------------------------------------------
-	settings.beginGroup("SynchronizeSettings");
-
-	//if (force ||sync_p.checkForUpdates != sync_d.checkForUpdates)
-		settings.setValue("checkForUpdates", sync_p.checkForUpdates);
-	//if (force || sync_p.disableUpdateInteraction != sync_d.disableUpdateInteraction)
-		settings.setValue("disableUpdateInteraction", sync_p.disableUpdateInteraction);
-	if (force ||sync_p.updateDialogShown != sync_d.updateDialogShown)
-		settings.setValue("updateDialogShown", sync_p.updateDialogShown);
-	if (force ||sync_p.lastUpdateCheck != sync_d.lastUpdateCheck)
-		settings.setValue("lastUpdateCheck", sync_p.lastUpdateCheck);
-	if (force ||sync_p.syncAbsoluteTransform != sync_d.syncAbsoluteTransform)
-		settings.setValue("syncAbsoluteTransform", sync_p.syncAbsoluteTransform);
-	if (force ||sync_p.switchModifier != sync_d.switchModifier)
-		settings.setValue("switchModifier", sync_p.switchModifier);
-	if (force ||sync_p.syncActions != sync_d.syncActions)
-		settings.setValue("syncActions", sync_p.syncActions);
-
-	settings.endGroup();
-	// Resource Settings --------------------------------------------------------------------
-	settings.beginGroup("ResourceSettings");
-
-	if (force ||resources_p.cacheMemory != resources_d.cacheMemory)
-		settings.setValue("cacheMemory", resources_p.cacheMemory);
-	if (force ||resources_p.historyMemory != resources_d.historyMemory)
-		settings.setValue("historyMemory", resources_p.historyMemory);
-	if (force || resources_p.nativeDialog != resources_d.nativeDialog)
-		settings.setValue("nativeDialog", resources_p.nativeDialog);
-	if (force ||resources_p.maxImagesCached != resources_d.maxImagesCached)
-		settings.setValue("maxImagesCached", resources_p.maxImagesCached);
-	if (force ||resources_p.waitForLastImg != resources_d.waitForLastImg)
-		settings.setValue("waitForLastImg", resources_p.waitForLastImg);
-	if (force ||resources_p.filterRawImages != resources_d.filterRawImages)
-		settings.setValue("filterRawImages", resources_p.filterRawImages);
-	if (force ||resources_p.loadRawThumb != resources_d.loadRawThumb)
-		settings.setValue("loadRawThumb", resources_p.loadRawThumb);
-	if (force ||resources_p.filterDuplicats != resources_d.filterDuplicats)
-		settings.setValue("filterDuplicates", resources_p.filterDuplicats);
-	if (force ||resources_p.preferredExtension != resources_d.preferredExtension)
-		settings.setValue("preferredExtension", resources_p.preferredExtension);
-	if (force ||resources_p.gammaCorrection != resources_d.gammaCorrection)
-		settings.setValue("gammaCorrection", resources_p.gammaCorrection);
-	if (force || resources_p.loadSavedImage != resources_d.loadSavedImage)
-		settings.setValue("loadSavedImage", resources_p.loadSavedImage);
-
-	settings.endGroup();
-
-	// keep loaded settings in mind
-	app_d = app_p;
-	global_d = global_p;
-	display_d = display_p;
-	slideShow_d = slideShow_p;
-	sync_d = sync_p;
-	meta_d = meta_p;
-	resources_d = resources_p;
-
-	qDebug() << "settings saved to" << settingsPath();
-}
-
-void DkSettings::setToDefaultSettings() {
-
-	app_p.showToolBar = true;
-	app_p.showStatusBar = false;
-	app_p.showMovieToolBar = false;
-	app_p.showFileInfoLabel = QBitArray(mode_end, false);
-	app_p.showFilePreview = QBitArray(mode_end, false);
-	app_p.showScroller = QBitArray(mode_end, false);
-	app_p.showMetaData = QBitArray(mode_end, false);
-	app_p.showPlayer = QBitArray(mode_end, false);
-	app_p.showHistogram = QBitArray(mode_end, false);
-	app_p.showComment = QBitArray(mode_end, false);
-	app_p.showOverview = QBitArray(mode_end, false);
-	app_p.showExplorer = QBitArray(mode_end, false);
-	app_p.showMetaDataDock = QBitArray(mode_end, false);
-	app_p.showEditDock = QBitArray(mode_end, false);
-	app_p.showHistoryDock = QBitArray(mode_end, false);
-	app_p.showLogDock = QBitArray(mode_end, false);
-	app_p.advancedSettings = false;
-	app_p.closeOnEsc = false;
-	app_p.hideAllPanels = false;
-	app_p.showRecentFiles = true;
-	app_p.browseFilters = QStringList();
-	app_p.showMenuBar = true;
-	app_p.useLogFile = false;
-
-	// now set default show options
-	app_p.showFileInfoLabel.setBit(mode_default, false);
-	app_p.showFileInfoLabel.setBit(mode_contrast, false);
-
-	app_p.appMode = 0;
-	app_p.privateMode = false;
-	app_p.defaultJpgQuality = 97;
-
-	global_p.skipImgs = 10;
-	global_p.numFiles = 50;
-	global_p.checkOpenDuplicates = true;
-	global_p.extendedTabs = false;
-	global_p.loop = true;
-	global_p.scanSubFolders = false;
-	global_p.lastDir = QString();
-	global_p.lastSaveDir = QString();
-	global_p.recentFiles = QStringList();
-	global_p.pinnedFiles = QStringList();
-	global_p.searchHistory = QStringList();
-	global_p.recentFolders = QStringList();
-	global_p.logRecentFiles = true;
-	global_p.askToSaveDeletedFiles = false;
-	global_p.tmpPath = "";
-	global_p.language = "en";
-	global_p.setupPath = "";
-	global_p.setupVersion = "";
-	global_p.numThreads = -1;
-	global_p.sortMode = sort_filename;
-	global_p.sortDir = sort_ascending;
-	global_p.zoomOnWheel = true;
-	global_p.horZoomSkips = true;
-	global_p.doubleClickForFullscreen = true;
-	global_p.showBgImage = true;
+    QString allFilters = app_p.fileFilters.join(" ");
 
-#ifdef Q_OS_LINUX
-	sync_p.switchModifier = true;
-	global_p.altMod = Qt::ControlModifier;
-	global_p.ctrlMod = Qt::AltModifier;
-#else
-	sync_p.switchModifier = false;
-	global_p.altMod = Qt::AltModifier;
-	global_p.ctrlMod = Qt::ControlModifier;
-#endif
+    // add unknown formats from Qt plugins
+    for (int idx = 0; idx < qtFormats.size(); idx++) {
+        if (!allFilters.contains(qtFormats.at(idx))) {
+            app_p.openFilters.append("Image Format (*." + qtFormats.at(idx) + ")");
+            app_p.fileFilters.append("*." + qtFormats.at(idx));
+        }
+    }
 
-	display_p.keepZoom = zoom_keep_same_size;
-	display_p.invertZoom = false;
-	display_p.zoomToFit = false;
-	display_p.highlightColor = QColor(0, 204, 255);
-	display_p.hudBgColor = QColor(0, 0, 0, 100);
-	display_p.hudFgdColor = QColor(255, 255, 255);
-	display_p.bgColor = QColor(100, 100, 100, 255);
-	display_p.iconColor = QColor(100,100,100,255);
-	display_p.bgColorFrameless = QColor(0, 0, 0, 180);
-	display_p.thumbSize = 64;
-	display_p.iconSize = 16;
-	display_p.thumbPreviewSize = 64;
-	display_p.antiAliasing = true;
-	display_p.highQualityAntiAliasing = false;
-	display_p.showCrop = false;
-	display_p.histogramStyle = 0; // DkHistogram::DisplayMode::histogram_mode_simple
-	display_p.tpPattern = false;
-	display_p.showNavigation = true;
-	display_p.themeName = "Light-Theme.css";
-	display_p.showBorder = false;
-	display_p.displaySquaredThumbs = true;
-	display_p.showThumbLabel = false;
-	display_p.showScrollBars = false;
-	display_p.animationDuration = 0.5f;
-	display_p.alwaysAnimate = false;
-	display_p.transition = trans_swipe;
-	display_p.defaultBackgroundColor = true;
-	display_p.defaultIconColor = true;
-	display_p.interpolateZoomLevel = 200;
+    app_p.openFilters.prepend("Image Files (" + app_p.fileFilters.join(" ") + ")");
 
-	slideShow_p.filter = 0;
-	slideShow_p.time = 3.0;
-	slideShow_p.showPlayer = true;
-	slideShow_p.moveSpeed = 0;		// TODO: set to 1 for finishing slideshow
-	slideShow_p.display = QBitArray(display_end, true);
-	slideShow_p.backgroundColor = QColor(51, 51, 51, 255);
-	slideShow_p.silentFullscreen = true;
+    // #ifdef Q_OS_WIN
+    //	app_p.fileFilters.append("*.lnk");
+    // #endif
+}
 
-	meta_p.saveExifOrientation = true;
-	meta_p.ignoreExifOrientation = false;
+void DkSettings::loadTranslation(const QString &fileName, QTranslator &translator)
+{
+    QStringList translationDirs = getTranslationDirs();
 
-	sync_p.checkForUpdates = !isPortable();	// installed version should only check for updates by default
-	sync_p.disableUpdateInteraction = isPortable();	// installed version should only check for updates by default
-	sync_p.updateDialogShown = false;
-	sync_p.lastUpdateCheck = QDate(2018, 7, 14);	// ; )
-	sync_p.syncAbsoluteTransform = true;
-	sync_p.syncActions = false;
+    for (int idx = 0; idx < translationDirs.size(); idx++) {
+        if (translator.load(fileName, translationDirs[idx])) {
+            qDebugClean() << "translation loaded from: " << translationDirs[idx] << "/" << fileName;
+            break;
+        }
+    }
+}
+
+QStringList DkSettings::getTranslationDirs()
+{
+    QStringList trDirs;
+    trDirs << DkUtils::getTranslationPath();
+    trDirs << qApp->applicationDirPath();
+
+    QStringList rDirs;
+    rDirs << qApp->applicationDirPath();
+    rDirs << QStandardPaths::standardLocations(QStandardPaths::AppLocalDataLocation);
+
+    for (const QString &d : rDirs)
+        trDirs << d + QDir::separator() + "translations";
+
+    trDirs.removeDuplicates();
+
+    return trDirs;
+}
+
+void DkSettings::load()
+{
+    DefaultSettings s;
+    load(s);
+}
+
+void DkSettings::load(QSettings &settings, bool defaults)
+{
+    applyDefaultsFromFile(); // copies entries from "default.ini" to the user settings file
+    setToDefaultSettings();
+    qInfoClean() << "loading settings from: " << settings.fileName();
+
+    settings.beginGroup("AppSettings");
+
+    app_p.showMenuBar = settings.value("showMenuBar", app_p.showMenuBar).toBool();
+    app_p.showToolBar = settings.value("showToolBar", app_p.showToolBar).toBool();
+    app_p.showStatusBar = settings.value("showStatusBar", app_p.showStatusBar).toBool();
+
+    QBitArray tmpShow = settings.value("showFileInfoLabel", app_p.showFileInfoLabel).toBitArray();
+    if (tmpShow.size() == app_p.showFileInfoLabel.size())
+        app_p.showFileInfoLabel = tmpShow;
+    tmpShow = settings.value("showScroller", app_p.showScroller).toBitArray();
+    if (tmpShow.size() == app_p.showScroller.size())
+        app_p.showScroller = tmpShow;
+    tmpShow = settings.value("showFilePreview", app_p.showFilePreview).toBitArray();
+    if (tmpShow.size() == app_p.showFilePreview.size())
+        app_p.showFilePreview = tmpShow;
+    tmpShow = settings.value("showMetaData", app_p.showMetaData).toBitArray();
+    if (tmpShow.size() == app_p.showMetaData.size())
+        app_p.showMetaData = tmpShow;
+    tmpShow = settings.value("showPlayer", app_p.showPlayer).toBitArray();
+    if (tmpShow.size() == app_p.showPlayer.size())
+        app_p.showPlayer = tmpShow;
+    tmpShow = settings.value("showHistogram", app_p.showHistogram).toBitArray();
+    if (tmpShow.size() == app_p.showHistogram.size())
+        app_p.showHistogram = tmpShow;
+    tmpShow = settings.value("showOverview", app_p.showOverview).toBitArray();
+    if (tmpShow.size() == app_p.showOverview.size())
+        app_p.showOverview = tmpShow;
+    tmpShow = settings.value("showComment", app_p.showComment).toBitArray();
+    if (tmpShow.size() == app_p.showComment.size())
+        app_p.showComment = tmpShow;
+    tmpShow = settings.value("showExplorer", app_p.showExplorer).toBitArray();
+    if (tmpShow.size() == app_p.showExplorer.size())
+        app_p.showExplorer = tmpShow;
+    tmpShow = settings.value("showMetaDataDock", app_p.showMetaDataDock).toBitArray();
+    if (tmpShow.size() == app_p.showMetaDataDock.size())
+        app_p.showMetaDataDock = tmpShow;
+    tmpShow = settings.value("showEditDock", app_p.showEditDock).toBitArray();
+    if (tmpShow.size() == app_p.showEditDock.size())
+        app_p.showEditDock = tmpShow;
+    tmpShow = settings.value("showHistoryDock", app_p.showHistoryDock).toBitArray();
+    if (tmpShow.size() == app_p.showHistoryDock.size())
+        app_p.showHistoryDock = tmpShow;
+    tmpShow = settings.value("showLogDock", app_p.showLogDock).toBitArray();
+    if (tmpShow.size() == app_p.showLogDock.size())
+        app_p.showLogDock = tmpShow;
+
+    app_p.hideAllPanels = settings.value("hideAllPanels", app_p.hideAllPanels).toBool();
+    app_p.closeOnEsc = settings.value("closeOnEsc", app_p.closeOnEsc).toBool();
+    app_p.showRecentFiles = settings.value("showRecentFiles", app_p.showRecentFiles).toBool();
+    app_p.useLogFile = settings.value("useLogFile", app_p.useLogFile).toBool();
+    app_p.defaultJpgQuality = settings.value("defaultJpgQuality", app_p.defaultJpgQuality).toInt();
+
+    QStringList tmpFileFilters = app_p.fileFilters;
+    QStringList tmpContainerFilters = app_p.containerRawFilters.split(" ");
+    for (int idx = 0; idx < tmpContainerFilters.size(); idx++) {
+        tmpFileFilters.removeAll(tmpContainerFilters.at(idx));
+    }
+    app_p.browseFilters = settings.value("browseFilters", tmpFileFilters).toStringList();
+
+    // double-check (if user removes all filters he can't browse anymore - so override this case)
+    if (app_p.browseFilters.empty())
+        app_p.browseFilters = tmpFileFilters;
+
+    app_p.registerFilters = settings.value("registerFilters", app_p.registerFilters).toStringList();
+    app_p.advancedSettings = settings.value("advancedSettings", app_p.advancedSettings).toBool();
+
+    settings.endGroup();
+    // Global Settings --------------------------------------------------------------------
+    settings.beginGroup("GlobalSettings");
+
+    global_p.skipImgs = settings.value("skipImgs", global_p.skipImgs).toInt();
+    global_p.checkOpenDuplicates = settings.value("checkOpenDuplicates", global_p.checkOpenDuplicates).toBool();
+    global_p.extendedTabs = settings.value("extendedTabs", global_p.extendedTabs).toBool();
+
+    global_p.loop = settings.value("loop", global_p.loop).toBool();
+    global_p.scanSubFolders = settings.value("scanRecursive", global_p.scanSubFolders).toBool();
+    global_p.lastDir = settings.value("lastDir", global_p.lastDir).toString();
+    global_p.searchHistory = settings.value("searchHistory", global_p.searchHistory).toStringList();
+    global_p.recentFolders = settings.value("recentFolders", global_p.recentFolders).toStringList();
+    global_p.pinnedFiles = settings.value("pinnedFiles", global_p.pinnedFiles).toStringList();
+    global_p.recentFiles = settings.value("recentFiles", global_p.recentFiles).toStringList();
+    global_p.logRecentFiles = settings.value("logRecentFiles", global_p.logRecentFiles).toBool();
+    global_p.askToSaveDeletedFiles = settings.value("askToSaveDeletedFiles", global_p.askToSaveDeletedFiles).toBool();
+    global_p.tmpPath = settings.value("tmpPath", global_p.tmpPath).toString();
+    global_p.language = settings.value("language", global_p.language).toString();
+    global_p.numThreads = settings.value("numThreads", global_p.numThreads).toInt();
+
+    global_p.sortMode = settings.value("sortMode", global_p.sortMode).toInt();
+    global_p.sortDir = settings.value("sortDir", global_p.sortDir).toInt();
+    global_p.setupPath = settings.value("setupPath", global_p.setupPath).toString();
+    global_p.setupVersion = settings.value("setupVersion", global_p.setupVersion).toString();
+    global_p.zoomOnWheel = settings.value("zoomOnWheel", global_p.zoomOnWheel).toBool();
+    global_p.horZoomSkips = settings.value("horZoomSkips", global_p.horZoomSkips).toBool();
+    global_p.doubleClickForFullscreen = settings.value("doubleClickForFullscreen", global_p.doubleClickForFullscreen).toBool();
+    global_p.showBgImage = settings.value("showBgImage", global_p.showBgImage).toBool();
+
+    settings.endGroup();
+    // Display Settings --------------------------------------------------------------------
+    settings.beginGroup("DisplaySettings");
+
+    display_p.keepZoom = settings.value("keepZoom", display_p.keepZoom).toInt();
+    display_p.invertZoom = settings.value("invertZoom", display_p.invertZoom).toBool();
+    display_p.zoomToFit = settings.value("zoomToFit", display_p.zoomToFit).toBool();
+    display_p.highlightColor = QColor::fromRgba(settings.value("highlightColorRGBA", display_p.highlightColor.rgba()).toInt());
+    display_p.hudBgColor = QColor::fromRgba(settings.value("bgColorWidgetRGBA", display_p.hudBgColor.rgba()).toInt());
+    display_p.hudFgdColor = QColor::fromRgba(settings.value("fontColorRGBA", display_p.hudFgdColor.rgba()).toInt());
+    display_p.bgColor = QColor::fromRgba(settings.value("bgColorNoMacsRGBA", display_p.bgColor.rgba()).toInt());
+    display_p.iconColor = QColor::fromRgba(settings.value("iconColorRGBA", display_p.iconColor.rgba()).toInt());
+    display_p.bgColorFrameless = QColor::fromRgba(settings.value("bgColorFramelessRGBA", display_p.bgColorFrameless.rgba()).toInt());
+    display_p.thumbSize = settings.value("thumbSize", display_p.thumbSize).toInt();
+    display_p.iconSize = settings.value("iconSize", display_p.iconSize).toInt();
+    display_p.thumbPreviewSize = settings.value("thumbPreviewSize", display_p.thumbPreviewSize).toInt();
+    // display_p.saveThumb = settings.value("saveThumb", display_p.saveThumb).toBool();
+    display_p.antiAliasing = settings.value("antiAliasing", display_p.antiAliasing).toBool();
+    display_p.highQualityAntiAliasing = settings.value("highQualityAntiAliasing", display_p.highQualityAntiAliasing).toBool();
+    display_p.showCrop = settings.value("showCrop", display_p.showCrop).toBool();
+    display_p.histogramStyle = settings.value("histogramStyle", display_p.histogramStyle).toInt();
+    display_p.tpPattern = settings.value("tpPattern", display_p.tpPattern).toBool();
+    display_p.showNavigation = settings.value("showNavigation", display_p.showNavigation).toBool();
+    display_p.themeName = settings.value("themeName312", display_p.themeName).toString();
+    display_p.showBorder = settings.value("showBorder", display_p.showBorder).toBool();
+    display_p.displaySquaredThumbs = settings.value("displaySquaredThumbs", display_p.displaySquaredThumbs).toBool();
+    display_p.showThumbLabel = settings.value("showThumbLabel", display_p.showThumbLabel).toBool();
+    display_p.showScrollBars = settings.value("showScrollBars", display_p.showScrollBars).toBool();
+    display_p.animationDuration = settings.value("fadeSec", display_p.animationDuration).toFloat();
+    display_p.alwaysAnimate = settings.value("alwaysAnimate", display_p.alwaysAnimate).toBool();
+    display_p.transition = (TransitionMode)settings.value("transition", display_p.transition).toInt();
+    display_p.defaultBackgroundColor = settings.value("useDefaultColor", display_p.defaultBackgroundColor).toBool();
+    display_p.defaultIconColor = settings.value("defaultIconColor", display_p.defaultIconColor).toBool();
+    display_p.interpolateZoomLevel = settings.value("interpolateZoomlevel", display_p.interpolateZoomLevel).toInt();
+
+    settings.endGroup();
+    // MetaData Settings --------------------------------------------------------------------
+    settings.beginGroup("MetaDataSettings");
+
+    meta_p.ignoreExifOrientation = settings.value("ignoreExifOrientation", meta_p.ignoreExifOrientation).toBool();
+    meta_p.saveExifOrientation = settings.value("saveExifOrientation", meta_p.saveExifOrientation).toBool();
+
+    settings.endGroup();
+    // SlideShow Settings --------------------------------------------------------------------
+    settings.beginGroup("SlideShowSettings");
+
+    slideShow_p.filter = settings.value("filter", slideShow_p.filter).toInt();
+    slideShow_p.time = settings.value("time", slideShow_p.time).toFloat();
+    slideShow_p.showPlayer = settings.value("showPlayer", slideShow_p.showPlayer).toBool();
+    slideShow_p.moveSpeed = settings.value("moveSpeed", slideShow_p.moveSpeed).toFloat();
+    slideShow_p.backgroundColor = QColor::fromRgba(settings.value("backgroundColorRGBA", slideShow_p.backgroundColor.rgba()).toInt());
+    slideShow_p.silentFullscreen = settings.value("silentFullscreen", slideShow_p.silentFullscreen).toBool();
+    QBitArray tmpDisplay = settings.value("display", slideShow_p.display).toBitArray();
+
+    if (tmpDisplay.size() == slideShow_p.display.size())
+        slideShow_p.display = tmpDisplay;
+
+    settings.endGroup();
+    // Synchronize Settings --------------------------------------------------------------------
+    settings.beginGroup("SynchronizeSettings");
+
+    sync_p.checkForUpdates = settings.value("checkForUpdates", sync_p.checkForUpdates).toBool();
+    sync_p.disableUpdateInteraction = settings.value("disableUpdateInteraction", sync_p.disableUpdateInteraction).toBool();
+    sync_p.updateDialogShown = settings.value("updateDialogShown", sync_p.updateDialogShown).toBool();
+    sync_p.lastUpdateCheck = settings.value("lastUpdateCheck", sync_p.lastUpdateCheck).toDate();
+    sync_p.syncAbsoluteTransform = settings.value("syncAbsoluteTransform", sync_p.syncAbsoluteTransform).toBool();
+    sync_p.switchModifier = settings.value("switchModifier", sync_p.switchModifier).toBool();
+    sync_p.syncActions = settings.value("syncActions", sync_p.syncActions).toBool();
+
+    settings.endGroup();
+    // Resource Settings --------------------------------------------------------------------
+    settings.beginGroup("ResourceSettings");
+
+    resources_p.cacheMemory = settings.value("cacheMemory", resources_p.cacheMemory).toFloat();
+    resources_p.historyMemory = settings.value("historyMemory", resources_p.historyMemory).toFloat();
+    resources_p.nativeDialog = settings.value("nativeDialog", resources_p.nativeDialog).toBool();
+    resources_p.maxImagesCached = settings.value("maxImagesCached", resources_p.maxImagesCached).toInt();
+    resources_p.waitForLastImg = settings.value("waitForLastImg", resources_p.waitForLastImg).toBool();
+    resources_p.filterRawImages = settings.value("filterRawImages", resources_p.filterRawImages).toBool();
+    resources_p.loadRawThumb = settings.value("loadRawThumb", resources_p.loadRawThumb).toInt();
+    resources_p.filterDuplicats = settings.value("filterDuplicates", resources_p.filterDuplicats).toBool();
+    resources_p.preferredExtension = settings.value("preferredExtension", resources_p.preferredExtension).toString();
+    resources_p.gammaCorrection = settings.value("gammaCorrection", resources_p.gammaCorrection).toBool();
+    resources_p.loadSavedImage = settings.value("loadSavedImage", resources_p.loadSavedImage).toInt();
+
+    if (sync_p.switchModifier) {
+        global_p.altMod = Qt::ControlModifier;
+        global_p.ctrlMod = Qt::AltModifier;
+    } else {
+        global_p.altMod = Qt::AltModifier;
+        global_p.ctrlMod = Qt::ControlModifier;
+    }
 
-	resources_p.cacheMemory = 256;
-	resources_p.historyMemory = 128;
-	resources_p.nativeDialog = true;
-	resources_p.maxImagesCached = 5;
-	resources_p.filterRawImages = true;
-	resources_p.loadRawThumb = raw_thumb_always;
-	resources_p.filterDuplicats = false;
-	resources_p.preferredExtension = "*.jpg";
-	resources_p.gammaCorrection = true;
-	resources_p.loadSavedImage = ls_load_to_tab;
-	resources_p.waitForLastImg = true;
+    settings.endGroup();
+
+    if (global_p.numThreads != -1)
+        QThreadPool::globalInstance()->setMaxThreadCount(global_p.numThreads);
+    else
+        global_p.numThreads = QThreadPool::globalInstance()->maxThreadCount();
+
+    // keep loaded settings in mind
+    if (defaults) {
+        app_d = app_p;
+        global_d = global_p;
+        display_d = display_p;
+        slideShow_d = slideShow_p;
+        sync_d = sync_p;
+        meta_d = meta_p;
+        resources_d = resources_p;
+    }
+}
 
-	qDebug() << "ok... default settings are set";
+void DkSettings::save(bool force)
+{
+    DefaultSettings s;
+    save(s, force);
 }
 
-void DkSettings::applyDefaultsFromFile() {
+void DkSettings::save(QSettings &settings, bool force)
+{
+    if (DkSettingsManager::param().app().privateMode)
+        return;
 
-	DefaultSettings ds;
+    settings.beginGroup("AppSettings");
+    if (force || app_p.showMenuBar != app_d.showMenuBar)
+        settings.setValue("showMenuBar", app_p.showMenuBar);
 
-	if (ds.value("firstTime", true).toBool()) {
+    if (app_p.currentAppMode != mode_frameless && app_p.currentAppMode != mode_frameless_fullscreen) {
+        if (force || app_p.showToolBar != app_d.showToolBar)
+            settings.setValue("showToolBar", app_p.showToolBar);
 
-		QString dsf = getDefaultSettingsFile();
-		if (!QFileInfo(dsf).exists()) {
-			qInfo() << "I could not find the default settings file: " << dsf;
-		}
+        if (force || app_p.showStatusBar != app_d.showStatusBar)
+            settings.setValue("showStatusBar", app_p.showStatusBar);
+    }
 
-		QSettings defaultSettings(dsf, QSettings::IniFormat);
-		copySettings(defaultSettings, ds);
+    if (force || app_p.showFileInfoLabel != app_d.showFileInfoLabel)
+        settings.setValue("showFileInfoLabel", app_p.showFileInfoLabel);
+    if (force || app_p.showFilePreview != app_d.showFilePreview)
+        settings.setValue("showFilePreview", app_p.showFilePreview);
+    if (force || app_p.showScroller != app_d.showScroller)
+        settings.setValue("showScroller", app_p.showScroller);
+    if (force || app_p.showMetaData != app_d.showMetaData)
+        settings.setValue("showMetaData", app_p.showMetaData);
+    if (force || app_p.showPlayer != app_d.showPlayer)
+        settings.setValue("showPlayer", app_p.showPlayer);
+    if (force || app_p.showHistogram != app_d.showHistogram)
+        settings.setValue("showHistogram", app_p.showHistogram);
+    if (force || app_p.showComment != app_d.showComment)
+        settings.setValue("showComment", app_p.showComment);
+    if (force || app_p.showOverview != app_d.showOverview)
+        settings.setValue("showOverview", app_p.showOverview);
+    if (force || app_p.showExplorer != app_d.showExplorer)
+        settings.setValue("showExplorer", app_p.showExplorer);
+    if (force || app_p.showMetaDataDock != app_d.showMetaDataDock)
+        settings.setValue("showMetaDataDock", app_p.showMetaDataDock);
+    if (force || app_p.showEditDock != app_d.showEditDock)
+        settings.setValue("showEditDock", app_p.showEditDock);
+    if (force || app_p.showHistoryDock != app_d.showHistoryDock)
+        settings.setValue("showHistoryDock", app_p.showHistoryDock);
+    if (force || app_p.showLogDock != app_d.showLogDock)
+        settings.setValue("showLogDock", app_p.showLogDock);
+    if (force || app_p.hideAllPanels != app_d.hideAllPanels)
+        settings.setValue("hideAllPanels", app_p.hideAllPanels);
+    if (force || app_p.advancedSettings != app_d.advancedSettings)
+        settings.setValue("advancedSettings", app_p.advancedSettings);
+    if (force || app_p.closeOnEsc != app_d.closeOnEsc)
+        settings.setValue("closeOnEsc", app_p.closeOnEsc);
+    if (force || app_p.showRecentFiles != app_d.showRecentFiles)
+        settings.setValue("showRecentFiles", app_p.showRecentFiles);
+    if (force || app_p.useLogFile != app_d.useLogFile)
+        settings.setValue("useLogFile", app_p.useLogFile);
+    if (force || app_p.browseFilters != app_d.browseFilters)
+        settings.setValue("browseFilters", app_p.browseFilters);
+    if (force || app_p.registerFilters != app_d.registerFilters)
+        settings.setValue("registerFilters", app_p.registerFilters);
+
+    // always save (user setting)
+    settings.setValue("defaultJpgQuality", app_p.defaultJpgQuality);
+    settings.setValue("appMode", app_p.appMode);
+    settings.setValue("currentAppMode", app_p.currentAppMode);
+
+    settings.endGroup();
+    // Global Settings --------------------------------------------------------------------
+    settings.beginGroup("GlobalSettings");
+
+    if (force || global_p.skipImgs != global_d.skipImgs)
+        settings.setValue("skipImgs", global_p.skipImgs);
+    if (force || global_p.checkOpenDuplicates != global_d.checkOpenDuplicates)
+        settings.setValue("checkOpenDuplicates", global_p.checkOpenDuplicates);
+    if (force || global_p.extendedTabs != global_d.extendedTabs)
+        settings.setValue("extendedTabs", global_p.extendedTabs);
+    if (force || global_p.loop != global_d.loop)
+        settings.setValue("loop", global_p.loop);
+    if (force || global_p.scanSubFolders != global_d.scanSubFolders)
+        settings.setValue("scanRecursive", global_p.scanSubFolders);
+    if (force || global_p.lastDir != global_d.lastDir)
+        settings.setValue("lastDir", global_p.lastDir);
+    if (force || global_p.searchHistory != global_d.searchHistory)
+        settings.setValue("searchHistory", global_p.searchHistory);
+    if (force || global_p.recentFolders != global_d.recentFolders)
+        settings.setValue("recentFolders", global_p.recentFolders);
+    if (force || global_p.recentFiles != global_d.recentFiles)
+        settings.setValue("recentFiles", global_p.recentFiles);
+    if (force || global_p.pinnedFiles != global_d.pinnedFiles)
+        settings.setValue("pinnedFiles", global_p.pinnedFiles);
+    if (force || global_p.logRecentFiles != global_d.logRecentFiles)
+        settings.setValue("logRecentFiles", global_p.logRecentFiles);
+    if (force || global_p.askToSaveDeletedFiles != global_d.askToSaveDeletedFiles)
+        settings.setValue("askToSaveDeletedFiles", global_p.askToSaveDeletedFiles);
+    if (force || global_p.tmpPath != global_d.tmpPath)
+        settings.setValue("tmpPath", global_p.tmpPath);
+    if (force || global_p.language != global_d.language)
+        settings.setValue("language", global_p.language);
+    if (force || global_p.numThreads != global_d.numThreads)
+        settings.setValue("numThreads", global_p.numThreads);
+    if (force || global_p.sortMode != global_d.sortMode)
+        settings.setValue("sortMode", global_p.sortMode);
+    if (force || global_p.sortDir != global_d.sortDir)
+        settings.setValue("sortDir", global_p.sortDir);
+    if (force || global_p.setupPath != global_d.setupPath)
+        settings.setValue("setupPath", global_p.setupPath);
+    if (force || global_p.setupVersion != global_d.setupVersion)
+        settings.setValue("setupVersion", global_p.setupVersion);
+    if (force || global_p.zoomOnWheel != global_d.zoomOnWheel)
+        settings.setValue("zoomOnWheel", global_p.zoomOnWheel);
+    if (force || global_p.horZoomSkips != global_d.horZoomSkips)
+        settings.setValue("horZoomSkips", global_p.horZoomSkips);
+    if (force || global_p.doubleClickForFullscreen != global_d.doubleClickForFullscreen)
+        settings.setValue("doubleClickForFullscreen", global_p.doubleClickForFullscreen);
+    if (force || global_p.showBgImage != global_d.showBgImage)
+        settings.setValue("showBgImage", global_p.showBgImage);
+
+    settings.endGroup();
+    // Display Settings --------------------------------------------------------------------
+    settings.beginGroup("DisplaySettings");
+
+    if (force || display_p.keepZoom != display_d.keepZoom)
+        settings.setValue("keepZoom", display_p.keepZoom);
+    if (force || display_p.invertZoom != display_d.invertZoom)
+        settings.setValue("invertZoom", display_p.invertZoom);
+    if (force || display_p.zoomToFit != display_d.zoomToFit)
+        settings.setValue("zoomToFit", display_p.zoomToFit);
+    if (force || display_p.highlightColor != display_d.highlightColor)
+        settings.setValue("highlightColorRGBA", display_p.highlightColor.rgba());
+    if (force || display_p.hudBgColor != display_d.hudBgColor)
+        settings.setValue("bgColorWidgetRGBA", display_p.hudBgColor.rgba());
+    if (force || display_p.hudFgdColor != display_d.hudFgdColor)
+        settings.setValue("fontColorRGBA", display_p.hudFgdColor.rgba());
+    if (force || display_p.bgColor != display_d.bgColor)
+        settings.setValue("bgColorNoMacsRGBA", display_p.bgColor.rgba());
+    if (force || display_p.iconColor != display_d.iconColor)
+        settings.setValue("iconColorRGBA", display_p.iconColor.rgba());
+    if (force || display_p.bgColorFrameless != display_d.bgColorFrameless)
+        settings.setValue("bgColorFramelessRGBA", display_p.bgColorFrameless.rgba());
+    if (force || display_p.thumbSize != display_d.thumbSize)
+        settings.setValue("thumbSize", display_p.thumbSize);
+    if (force || display_p.iconSize != display_d.iconSize)
+        settings.setValue("iconSize", display_p.iconSize);
+    if (force || display_p.thumbPreviewSize != display_d.thumbPreviewSize)
+        settings.setValue("thumbPreviewSize", display_p.thumbPreviewSize);
+    // if (force ||display_p.saveThumb != display_d.saveThumb)
+    //	settings.setValue("saveThumb", display_p.saveThumb);
+    if (force || display_p.antiAliasing != display_d.antiAliasing)
+        settings.setValue("antiAliasing", display_p.antiAliasing);
+    if (force || display_p.highQualityAntiAliasing != display_d.highQualityAntiAliasing)
+        settings.setValue("highQualityAntiAliasing", display_p.highQualityAntiAliasing);
+    if (force || display_p.showCrop != display_d.showCrop)
+        settings.setValue("showCrop", display_p.showCrop);
+    if (force || display_p.histogramStyle != display_d.histogramStyle)
+        settings.setValue("histogramStyle", display_p.histogramStyle);
+    if (force || display_p.tpPattern != display_d.tpPattern)
+        settings.setValue("tpPattern", display_p.tpPattern);
+    if (force || display_p.showNavigation != display_d.showNavigation)
+        settings.setValue("showNavigation", display_p.showNavigation);
+    if (force || display_p.themeName != display_d.themeName)
+        settings.setValue("themeName312", display_p.themeName);
+    if (force || display_p.showBorder != display_d.showBorder)
+        settings.setValue("showBorder", display_p.showBorder);
+    if (force || display_p.displaySquaredThumbs != display_d.displaySquaredThumbs)
+        settings.setValue("displaySquaredThumbs", display_p.displaySquaredThumbs);
+    if (force || display_p.showThumbLabel != display_d.showThumbLabel)
+        settings.setValue("showThumbLabel", display_p.showThumbLabel);
+    if (force || display_p.showScrollBars != display_d.showScrollBars)
+        settings.setValue("showScrollBars", display_p.showScrollBars);
+    if (force || display_p.alwaysAnimate != display_d.alwaysAnimate)
+        settings.setValue("alwaysAnimate", display_p.alwaysAnimate);
+    if (force || display_p.animationDuration != display_d.animationDuration)
+        settings.setValue("fadeSec", display_p.animationDuration);
+    if (force || display_p.transition != display_d.transition)
+        settings.setValue("transition", display_p.transition);
+    if (force || display_p.defaultBackgroundColor != display_d.defaultBackgroundColor)
+        settings.setValue("useDefaultColor", display_p.defaultBackgroundColor);
+    if (force || display_p.defaultIconColor != display_d.defaultIconColor)
+        settings.setValue("defaultIconColor", display_p.defaultIconColor);
+    if (force || display_p.interpolateZoomLevel != display_d.interpolateZoomLevel)
+        settings.setValue("interpolateZoomlevel", display_p.interpolateZoomLevel);
+
+    settings.endGroup();
+    // MetaData Settings --------------------------------------------------------------------
+    settings.beginGroup("MetaDataSettings");
+
+    if (force || meta_p.ignoreExifOrientation != meta_d.ignoreExifOrientation)
+        settings.setValue("ignoreExifOrientation", meta_p.ignoreExifOrientation);
+    if (force || meta_p.saveExifOrientation != meta_d.saveExifOrientation)
+        settings.setValue("saveExifOrientation", meta_p.saveExifOrientation);
+
+    settings.endGroup();
+    // SlideShow Settings --------------------------------------------------------------------
+    settings.beginGroup("SlideShowSettings");
+
+    if (force || slideShow_p.filter != slideShow_d.filter)
+        settings.setValue("filter", slideShow_p.filter);
+    if (force || slideShow_p.time != slideShow_d.time)
+        settings.setValue("time", slideShow_p.time);
+    if (force || slideShow_p.showPlayer != slideShow_d.showPlayer)
+        settings.setValue("showPlayer", slideShow_p.showPlayer);
+    if (force || slideShow_p.moveSpeed != slideShow_d.moveSpeed)
+        settings.setValue("moveSpeed", slideShow_p.moveSpeed);
+    if (force || slideShow_p.display != slideShow_d.display)
+        settings.setValue("display", slideShow_p.display);
+    if (force || slideShow_p.backgroundColor != slideShow_d.backgroundColor)
+        settings.setValue("backgroundColorRGBA", slideShow_p.backgroundColor.rgba());
+    if (force || slideShow_p.silentFullscreen != slideShow_d.silentFullscreen)
+        settings.setValue("silentFullscreen", slideShow_p.silentFullscreen);
+
+    settings.endGroup();
+    // Sync Settings --------------------------------------------------------------------
+    settings.beginGroup("SynchronizeSettings");
+
+    // if (force ||sync_p.checkForUpdates != sync_d.checkForUpdates)
+    settings.setValue("checkForUpdates", sync_p.checkForUpdates);
+    // if (force || sync_p.disableUpdateInteraction != sync_d.disableUpdateInteraction)
+    settings.setValue("disableUpdateInteraction", sync_p.disableUpdateInteraction);
+    if (force || sync_p.updateDialogShown != sync_d.updateDialogShown)
+        settings.setValue("updateDialogShown", sync_p.updateDialogShown);
+    if (force || sync_p.lastUpdateCheck != sync_d.lastUpdateCheck)
+        settings.setValue("lastUpdateCheck", sync_p.lastUpdateCheck);
+    if (force || sync_p.syncAbsoluteTransform != sync_d.syncAbsoluteTransform)
+        settings.setValue("syncAbsoluteTransform", sync_p.syncAbsoluteTransform);
+    if (force || sync_p.switchModifier != sync_d.switchModifier)
+        settings.setValue("switchModifier", sync_p.switchModifier);
+    if (force || sync_p.syncActions != sync_d.syncActions)
+        settings.setValue("syncActions", sync_p.syncActions);
+
+    settings.endGroup();
+    // Resource Settings --------------------------------------------------------------------
+    settings.beginGroup("ResourceSettings");
+
+    if (force || resources_p.cacheMemory != resources_d.cacheMemory)
+        settings.setValue("cacheMemory", resources_p.cacheMemory);
+    if (force || resources_p.historyMemory != resources_d.historyMemory)
+        settings.setValue("historyMemory", resources_p.historyMemory);
+    if (force || resources_p.nativeDialog != resources_d.nativeDialog)
+        settings.setValue("nativeDialog", resources_p.nativeDialog);
+    if (force || resources_p.maxImagesCached != resources_d.maxImagesCached)
+        settings.setValue("maxImagesCached", resources_p.maxImagesCached);
+    if (force || resources_p.waitForLastImg != resources_d.waitForLastImg)
+        settings.setValue("waitForLastImg", resources_p.waitForLastImg);
+    if (force || resources_p.filterRawImages != resources_d.filterRawImages)
+        settings.setValue("filterRawImages", resources_p.filterRawImages);
+    if (force || resources_p.loadRawThumb != resources_d.loadRawThumb)
+        settings.setValue("loadRawThumb", resources_p.loadRawThumb);
+    if (force || resources_p.filterDuplicats != resources_d.filterDuplicats)
+        settings.setValue("filterDuplicates", resources_p.filterDuplicats);
+    if (force || resources_p.preferredExtension != resources_d.preferredExtension)
+        settings.setValue("preferredExtension", resources_p.preferredExtension);
+    if (force || resources_p.gammaCorrection != resources_d.gammaCorrection)
+        settings.setValue("gammaCorrection", resources_p.gammaCorrection);
+    if (force || resources_p.loadSavedImage != resources_d.loadSavedImage)
+        settings.setValue("loadSavedImage", resources_p.loadSavedImage);
+
+    settings.endGroup();
+
+    // keep loaded settings in mind
+    app_d = app_p;
+    global_d = global_p;
+    display_d = display_p;
+    slideShow_d = slideShow_p;
+    sync_d = sync_p;
+    meta_d = meta_p;
+    resources_d = resources_p;
+
+    qDebug() << "settings saved to" << settingsPath();
+}
+
+void DkSettings::setToDefaultSettings()
+{
+    app_p.showToolBar = true;
+    app_p.showStatusBar = false;
+    app_p.showMovieToolBar = false;
+    app_p.showFileInfoLabel = QBitArray(mode_end, false);
+    app_p.showFilePreview = QBitArray(mode_end, false);
+    app_p.showScroller = QBitArray(mode_end, false);
+    app_p.showMetaData = QBitArray(mode_end, false);
+    app_p.showPlayer = QBitArray(mode_end, false);
+    app_p.showHistogram = QBitArray(mode_end, false);
+    app_p.showComment = QBitArray(mode_end, false);
+    app_p.showOverview = QBitArray(mode_end, false);
+    app_p.showExplorer = QBitArray(mode_end, false);
+    app_p.showMetaDataDock = QBitArray(mode_end, false);
+    app_p.showEditDock = QBitArray(mode_end, false);
+    app_p.showHistoryDock = QBitArray(mode_end, false);
+    app_p.showLogDock = QBitArray(mode_end, false);
+    app_p.advancedSettings = false;
+    app_p.closeOnEsc = false;
+    app_p.hideAllPanels = false;
+    app_p.showRecentFiles = true;
+    app_p.browseFilters = QStringList();
+    app_p.showMenuBar = true;
+    app_p.useLogFile = false;
+
+    // now set default show options
+    app_p.showFileInfoLabel.setBit(mode_default, false);
+    app_p.showFileInfoLabel.setBit(mode_contrast, false);
+
+    app_p.appMode = 0;
+    app_p.privateMode = false;
+    app_p.defaultJpgQuality = 97;
+
+    global_p.skipImgs = 10;
+    global_p.numFiles = 50;
+    global_p.checkOpenDuplicates = true;
+    global_p.extendedTabs = false;
+    global_p.loop = true;
+    global_p.scanSubFolders = false;
+    global_p.lastDir = QString();
+    global_p.lastSaveDir = QString();
+    global_p.recentFiles = QStringList();
+    global_p.pinnedFiles = QStringList();
+    global_p.searchHistory = QStringList();
+    global_p.recentFolders = QStringList();
+    global_p.logRecentFiles = true;
+    global_p.askToSaveDeletedFiles = false;
+    global_p.tmpPath = "";
+    global_p.language = "en";
+    global_p.setupPath = "";
+    global_p.setupVersion = "";
+    global_p.numThreads = -1;
+    global_p.sortMode = sort_filename;
+    global_p.sortDir = sort_ascending;
+    global_p.zoomOnWheel = true;
+    global_p.horZoomSkips = true;
+    global_p.doubleClickForFullscreen = true;
+    global_p.showBgImage = true;
 
-		ds.setValue("firstTime", false);
+#ifdef Q_OS_LINUX
+    sync_p.switchModifier = true;
+    global_p.altMod = Qt::ControlModifier;
+    global_p.ctrlMod = Qt::AltModifier;
+#else
+    sync_p.switchModifier = false;
+    global_p.altMod = Qt::AltModifier;
+    global_p.ctrlMod = Qt::ControlModifier;
+#endif
 
-		qInfo() << "defaults loaded from" << dsf;
-	}
-}
+    display_p.keepZoom = zoom_keep_same_size;
+    display_p.invertZoom = false;
+    display_p.zoomToFit = false;
+    display_p.highlightColor = QColor(0, 204, 255);
+    display_p.hudBgColor = QColor(0, 0, 0, 100);
+    display_p.hudFgdColor = QColor(255, 255, 255);
+    display_p.bgColor = QColor(100, 100, 100, 255);
+    display_p.iconColor = QColor(100, 100, 100, 255);
+    display_p.bgColorFrameless = QColor(0, 0, 0, 180);
+    display_p.thumbSize = 64;
+    display_p.iconSize = 16;
+    display_p.thumbPreviewSize = 64;
+    display_p.antiAliasing = true;
+    display_p.highQualityAntiAliasing = false;
+    display_p.showCrop = false;
+    display_p.histogramStyle = 0; // DkHistogram::DisplayMode::histogram_mode_simple
+    display_p.tpPattern = false;
+    display_p.showNavigation = true;
+    display_p.themeName = "Light-Theme.css";
+    display_p.showBorder = false;
+    display_p.displaySquaredThumbs = true;
+    display_p.showThumbLabel = false;
+    display_p.showScrollBars = false;
+    display_p.animationDuration = 0.5f;
+    display_p.alwaysAnimate = false;
+    display_p.transition = trans_swipe;
+    display_p.defaultBackgroundColor = true;
+    display_p.defaultIconColor = true;
+    display_p.interpolateZoomLevel = 200;
+
+    slideShow_p.filter = 0;
+    slideShow_p.time = 3.0;
+    slideShow_p.showPlayer = true;
+    slideShow_p.moveSpeed = 0; // TODO: set to 1 for finishing slideshow
+    slideShow_p.display = QBitArray(display_end, true);
+    slideShow_p.backgroundColor = QColor(51, 51, 51, 255);
+    slideShow_p.silentFullscreen = true;
+
+    meta_p.saveExifOrientation = true;
+    meta_p.ignoreExifOrientation = false;
+
+    sync_p.checkForUpdates = !isPortable(); // installed version should only check for updates by default
+    sync_p.disableUpdateInteraction = isPortable(); // installed version should only check for updates by default
+    sync_p.updateDialogShown = false;
+    sync_p.lastUpdateCheck = QDate(2018, 7, 14); // ; )
+    sync_p.syncAbsoluteTransform = true;
+    sync_p.syncActions = false;
+
+    resources_p.cacheMemory = 256;
+    resources_p.historyMemory = 128;
+    resources_p.nativeDialog = true;
+    resources_p.maxImagesCached = 5;
+    resources_p.filterRawImages = true;
+    resources_p.loadRawThumb = raw_thumb_always;
+    resources_p.filterDuplicats = false;
+    resources_p.preferredExtension = "*.jpg";
+    resources_p.gammaCorrection = true;
+    resources_p.loadSavedImage = ls_load_to_tab;
+    resources_p.waitForLastImg = true;
+
+    qDebug() << "ok... default settings are set";
+}
+
+void DkSettings::applyDefaultsFromFile()
+{
+    DefaultSettings ds;
+
+    if (ds.value("firstTime", true).toBool()) {
+        QString dsf = getDefaultSettingsFile();
+        if (!QFileInfo(dsf).exists()) {
+            qInfo() << "I could not find the default settings file: " << dsf;
+        }
 
-void DkSettings::copySettings(const QSettings & src, QSettings & dst) const {
+        QSettings defaultSettings(dsf, QSettings::IniFormat);
+        copySettings(defaultSettings, ds);
 
-	// copy default settings
-	if (src.allKeys().count() > 0) {
-		QStringList keys = src.allKeys();
+        ds.setValue("firstTime", false);
 
-		for (const QString& key : keys) {
-			dst.setValue(key, src.value(key));
-		}
-	}
+        qInfo() << "defaults loaded from" << dsf;
+    }
 }
 
-QString DkSettings::getDefaultSettingsFile() const {
+void DkSettings::copySettings(const QSettings &src, QSettings &dst) const
+{
+    // copy default settings
+    if (src.allKeys().count() > 0) {
+        QStringList keys = src.allKeys();
 
-	return QFileInfo(QCoreApplication::applicationDirPath(), "default.ini").absoluteFilePath();
+        for (const QString &key : keys) {
+            dst.setValue(key, src.value(key));
+        }
+    }
 }
 
-void DkSettings::setNumThreads(int numThreads) {
-
-	if (numThreads != global_p.numThreads) {
-		global_p.numThreads = numThreads;
-		QThreadPool::globalInstance()->setMaxThreadCount(numThreads);
-	}
+QString DkSettings::getDefaultSettingsFile() const
+{
+    return QFileInfo(QCoreApplication::applicationDirPath(), "default.ini").absoluteFilePath();
 }
 
-bool DkSettings::isPortable() {
-	
-	QFileInfo fi(QCoreApplication::applicationDirPath(), "settings.ini");
-	return fi.absoluteFilePath() == settingsPath();
+void DkSettings::setNumThreads(int numThreads)
+{
+    if (numThreads != global_p.numThreads) {
+        global_p.numThreads = numThreads;
+        QThreadPool::globalInstance()->setMaxThreadCount(numThreads);
+    }
 }
 
-QString DkSettings::settingsPath() const {
+bool DkSettings::isPortable()
+{
+    QFileInfo fi(QCoreApplication::applicationDirPath(), "settings.ini");
+    return fi.absoluteFilePath() == settingsPath();
+}
 
-	if (!mSettingsPath.isEmpty())
-		return mSettingsPath;
+QString DkSettings::settingsPath() const
+{
+    if (!mSettingsPath.isEmpty())
+        return mSettingsPath;
 
-	QFileInfo fi(QCoreApplication::applicationDirPath(), "settings.ini");
+    QFileInfo fi(QCoreApplication::applicationDirPath(), "settings.ini");
 
-	if (fi.exists())
-		return fi.absoluteFilePath();
+    if (fi.exists())
+        return fi.absoluteFilePath();
 
-	fi = QFileInfo(DkUtils::getAppDataPath(), "settings.ini");
+    fi = QFileInfo(DkUtils::getAppDataPath(), "settings.ini");
 
-	return fi.absoluteFilePath();
+    return fi.absoluteFilePath();
 }
 
-DkSettings::App & DkSettings::app() {
-	return app_p;
+DkSettings::App &DkSettings::app()
+{
+    return app_p;
 }
 
-DkSettings::Global & DkSettings::global() {
-	return global_p;
+DkSettings::Global &DkSettings::global()
+{
+    return global_p;
 }
 
-DkSettings::Display & DkSettings::display() {
-	return display_p;
+DkSettings::Display &DkSettings::display()
+{
+    return display_p;
 }
 
-DkSettings::SlideShow & DkSettings::slideShow() {
-	return slideShow_p;
+DkSettings::SlideShow &DkSettings::slideShow()
+{
+    return slideShow_p;
 }
 
-DkSettings::Sync & DkSettings::sync() {
-	return sync_p;
+DkSettings::Sync &DkSettings::sync()
+{
+    return sync_p;
 }
 
-DkSettings::MetaData & DkSettings::metaData() {
-	return meta_p;
+DkSettings::MetaData &DkSettings::metaData()
+{
+    return meta_p;
 }
 
-DkSettings::Resources & DkSettings::resources() {
-	return resources_p;
+DkSettings::Resources &DkSettings::resources()
+{
+    return resources_p;
 }
 
-DkSettingsManager::DkSettingsManager() {
-	
-	mParams = new DkSettings();
+DkSettingsManager::DkSettingsManager()
+{
+    mParams = new DkSettings();
 }
 
-DkSettingsManager& DkSettingsManager::instance() { 
-	static DkSettingsManager inst;
-	return inst; 
+DkSettingsManager &DkSettingsManager::instance()
+{
+    static DkSettingsManager inst;
+    return inst;
 }
 
-DkSettingsManager::~DkSettingsManager() {
-
-	if (mParams) {
-		delete mParams;
-		mParams = 0;
-	}
+DkSettingsManager::~DkSettingsManager()
+{
+    if (mParams) {
+        delete mParams;
+        mParams = 0;
+    }
 }
 
-DkSettings& DkSettingsManager::param() {
-	return instance().settings();
+DkSettings &DkSettingsManager::param()
+{
+    return instance().settings();
 }
 
-DkSettings& DkSettingsManager::settings() {
-	return *mParams;
+DkSettings &DkSettingsManager::settings()
+{
+    return *mParams;
 }
 
-void DkSettingsManager::init() {
-	
-	// init settings
-	param().initFileFilters();
-	DefaultSettings settings;
+void DkSettingsManager::init()
+{
+    // init settings
+    param().initFileFilters();
+    DefaultSettings settings;
+
+    param().load(settings, true); // load defaults
+
+    int mode = settings.value("AppSettings/appMode", param().app().appMode).toInt();
+    param().app().currentAppMode = mode;
 
-	param().load(settings, true);	// load defaults
+    // init debug
+    DkUtils::initializeDebug();
 
-	int mode = settings.value("AppSettings/appMode", param().app().appMode).toInt();
-	param().app().currentAppMode = mode;
+    if (nmc::DkSettingsManager::param().app().useLogFile)
+        std::cout << "log is saved to: " << nmc::DkUtils::getLogFilePath().toStdString() << std::endl;
 
-	// init debug
-	DkUtils::initializeDebug();
+    qInfo() << "Hi there";
+    qInfoClean() << "my name is " << QApplication::organizationName() << " | " << QApplication::applicationName() << " v" << QApplication::applicationVersion()
+                 << (nmc::DkSettingsManager::param().isPortable() ? " (portable)" : " (installed)");
+}
 
-	if (nmc::DkSettingsManager::param().app().useLogFile)
-		std::cout << "log is saved to: " << nmc::DkUtils::getLogFilePath().toStdString() << std::endl;
+void DkSettingsManager::importSettings(const QString &settingsPath)
+{
+    QSettings settings(settingsPath, QSettings::IniFormat);
+    param().load(settings);
+    param().save(true);
 
-	qInfo() << "Hi there";
-	qInfoClean() << "my name is " << QApplication::organizationName() << " | " << QApplication::applicationName() 
-		<< " v" << QApplication::applicationVersion() << (nmc::DkSettingsManager::param().isPortable() ? " (portable)" : " (installed)");
+    qInfo() << "settings imported...";
 }
 
-void DkSettingsManager::importSettings(const QString & settingsPath) {
+// -------------------------------------------------------------------- DkFileFilterHandling
+void DkFileFilterHandling::registerFileAssociations()
+{
+    DkFileFilterHandling fh;
+
+    // register file associations
+    QStringList rFilters = DkSettingsManager::param().app().openFilters;
+
+    // do not register containers such as *.pptx *.zip
+    for (const QString &filter : DkSettingsManager::param().app().containerFilters)
+        rFilters.removeAll(filter);
 
-	QSettings settings(settingsPath, QSettings::IniFormat);
-	param().load(settings);
-	param().save(true);
+    for (const QString &filter : rFilters) {
+        // remove the icon file -> otherwise icons might be destroyed (e.g. acrobat)
+        if (!filter.contains("ico")) {
+            fh.registerFileType(filter, QObject::tr("Image"), true);
+            qInfo() << "registering" << filter;
+        }
+    }
 
-	qInfo() << "settings imported...";
+    qInfo() << "files registered...";
 }
 
-// -------------------------------------------------------------------- DkFileFilterHandling 
-void DkFileFilterHandling::registerFileAssociations() {
+void DkFileFilterHandling::registerNomacs(bool showDefaultApps)
+{
+#ifdef Q_OS_WIN
 
-	DkFileFilterHandling fh;
+    // do not register if nomacs is portable
+    if (DkSettingsManager::param().isPortable() && !showDefaultApps)
+        return;
 
-	// register file associations
-	QStringList rFilters = DkSettingsManager::param().app().openFilters;
+    // TODO: this is still not working for me on win8??
+    QString capName = "Capabilities";
+    QString capPath = "Software\\" + QApplication::organizationName() + "\\" + QApplication::applicationName() + "\\" + capName;
+    QSettings settings("HKEY_CURRENT_USER\\" + capPath, QSettings::NativeFormat);
 
-	// do not register containers such as *.pptx *.zip
-	for (const QString& filter : DkSettingsManager::param().app().containerFilters)
-		rFilters.removeAll(filter);
+    settings.setValue("ApplicationDescription", QObject::tr("nomacs - Image Lounge is a lightweight image viewer."));
+    settings.setValue("ApplicationName", QApplication::organizationName() + " " + QApplication::applicationName());
+    settings.setValue("ApplicationIcon", QApplication::applicationFilePath() + ",0");
 
-	for (const QString& filter : rFilters) {
+    settings.beginGroup("FileAssociations");
+    QStringList rFilters = DkSettingsManager::param().app().openFilters;
 
-		// remove the icon file -> otherwise icons might be destroyed (e.g. acrobat)
-		if (!filter.contains("ico")) {
-			fh.registerFileType(filter, QObject::tr("Image"), true);
-			qInfo() << "registering" << filter;
-		}
-	}
+    for (int idx = 0; idx < DkSettingsManager::param().app().containerFilters.size(); idx++)
+        rFilters.removeAll(DkSettingsManager::param().app().containerFilters.at(idx));
 
-	qInfo() << "files registered...";
+    for (int idx = 0; idx < rFilters.size(); idx++) {
+        // remove the icon file -> otherwise icons might be destroyed (e.g. acrobat)
+        if (!rFilters.at(idx).contains("ico")) {
+            QStringList extList = getExtensions(rFilters.at(idx));
 
-}
+            for (QString cExt : extList)
+                settings.setValue(cExt, "nomacs" + cExt + ".3");
+        }
+    }
+    settings.endGroup();
 
-void DkFileFilterHandling::registerNomacs(bool showDefaultApps) {
+    QString softwarePath = "HKEY_CURRENT_USER\\Software\\";
+    QSettings wsettings(softwarePath, QSettings::NativeFormat);
 
-#ifdef Q_OS_WIN
-	
-	// do not register if nomacs is portable
-	if (DkSettingsManager::param().isPortable() && !showDefaultApps)
-		return;
-
-	// TODO: this is still not working for me on win8??
-	QString capName = "Capabilities";
-	QString capPath = "Software\\" + QApplication::organizationName() + "\\" + QApplication::applicationName() + "\\" + capName;
-	QSettings settings("HKEY_CURRENT_USER\\" + capPath, QSettings::NativeFormat);
-
-	settings.setValue("ApplicationDescription", QObject::tr("nomacs - Image Lounge is a lightweight image viewer."));
-	settings.setValue("ApplicationName", QApplication::organizationName() + " " + QApplication::applicationName());
-	settings.setValue("ApplicationIcon", QApplication::applicationFilePath() + ",0");
-
-	settings.beginGroup("FileAssociations");
-	QStringList rFilters = DkSettingsManager::param().app().openFilters;
-
-	for (int idx = 0; idx < DkSettingsManager::param().app().containerFilters.size(); idx++)
-		rFilters.removeAll(DkSettingsManager::param().app().containerFilters.at(idx));
-
-	for (int idx = 0; idx < rFilters.size(); idx++) {
-
-		// remove the icon file -> otherwise icons might be destroyed (e.g. acrobat)
-		if (!rFilters.at(idx).contains("ico")) {	
-			QStringList extList = getExtensions(rFilters.at(idx));
-			
-			for (QString cExt : extList)
-				settings.setValue(cExt, "nomacs" + cExt + ".3");
-		}
-	}
-	settings.endGroup();
-	
-	QString softwarePath = "HKEY_CURRENT_USER\\Software\\";
-	QSettings wsettings(softwarePath, QSettings::NativeFormat);
-
-	wsettings.beginGroup("RegisteredApplications");
-	wsettings.setValue("nomacs.ImageLounge." + QApplication::applicationVersion(), capPath);
-	wsettings.endGroup();
-
-	qDebug() << "nomacs registered ============================";
-
-	if (showDefaultApps) {
-		showDefaultSoftware();
-	}
-#endif
+    wsettings.beginGroup("RegisteredApplications");
+    wsettings.setValue("nomacs.ImageLounge." + QApplication::applicationVersion(), capPath);
+    wsettings.endGroup();
 
-}
+    qDebug() << "nomacs registered ============================";
 
-void DkFileFilterHandling::showDefaultSoftware() const {
+    if (showDefaultApps) {
+        showDefaultSoftware();
+    }
+#endif
+}
 
+void DkFileFilterHandling::showDefaultSoftware() const
+{
 #ifdef Q_OS_WIN
-	IApplicationActivationManager* manager = 0;
-	CoCreateInstance(CLSID_ApplicationActivationManager,
-		0,
-		CLSCTX_LOCAL_SERVER,
-		IID_IApplicationActivationManager,
-		(LPVOID*)&manager);
-
-	if (manager) {
-		DWORD pid = GetCurrentProcessId();
-		manager->ActivateApplication(
-			L"windows.immersivecontrolpanel_cw5n1h2txyewy"
-			L"!microsoft.windows.immersivecontrolpanel",
-			L"page=SettingsPageAppsDefaults", AO_NONE, &pid);
-		qDebug() << "launching application registration...";
-	}
+    IApplicationActivationManager *manager = 0;
+    CoCreateInstance(CLSID_ApplicationActivationManager, 0, CLSCTX_LOCAL_SERVER, IID_IApplicationActivationManager, (LPVOID *)&manager);
+
+    if (manager) {
+        DWORD pid = GetCurrentProcessId();
+        manager->ActivateApplication(
+            L"windows.immersivecontrolpanel_cw5n1h2txyewy"
+            L"!microsoft.windows.immersivecontrolpanel",
+            L"page=SettingsPageAppsDefaults",
+            AO_NONE,
+            &pid);
+        qDebug() << "launching application registration...";
+    }
 #endif
 }
 
-QString DkFileFilterHandling::registerProgID(const QString& ext, const QString& friendlyName, bool add) {
-
+QString DkFileFilterHandling::registerProgID(const QString &ext, const QString &friendlyName, bool add)
+{
 #ifdef Q_OS_WIN
 
-	QString nomacsPath = "HKEY_CURRENT_USER\\SOFTWARE\\Classes\\";
-	QString nomacsKey = "nomacs" + ext + ".3";
-
-	QSettings settings(nomacsPath, QSettings::NativeFormat);
-	
-	if (add) {
-	
-		QString iconID = getIconID(ext);
-
-		settings.beginGroup(nomacsKey);
-		settings.setValue("Default", friendlyName);
-		//settings.setValue("AppUserModelID", "nomacs.ImageLounge");
-		//settings.setValue("EditFlags", 1);
-		//settings.setValue("CurVer", nomacsKey);
-		settings.beginGroup("DefaultIcon");
-		settings.setValue("Default",QDir::toNativeSeparators(QCoreApplication::applicationFilePath()) + "," + iconID);
-		settings.endGroup();
-		settings.beginGroup("shell");
-		settings.beginGroup("open");
-		settings.beginGroup("command");
-		settings.setValue("Default", "\"" + QDir::toNativeSeparators(QCoreApplication::applicationFilePath()) + "\" \"%1\"");
-		settings.endGroup();
-		settings.endGroup();
-		settings.endGroup();
-
-		//qDebug() << nomacsKey << " written";
-	}
-	else
-		settings.remove(nomacsKey);
-
-	return nomacsKey;
+    QString nomacsPath = "HKEY_CURRENT_USER\\SOFTWARE\\Classes\\";
+    QString nomacsKey = "nomacs" + ext + ".3";
+
+    QSettings settings(nomacsPath, QSettings::NativeFormat);
+
+    if (add) {
+        QString iconID = getIconID(ext);
+
+        settings.beginGroup(nomacsKey);
+        settings.setValue("Default", friendlyName);
+        // settings.setValue("AppUserModelID", "nomacs.ImageLounge");
+        // settings.setValue("EditFlags", 1);
+        // settings.setValue("CurVer", nomacsKey);
+        settings.beginGroup("DefaultIcon");
+        settings.setValue("Default", QDir::toNativeSeparators(QCoreApplication::applicationFilePath()) + "," + iconID);
+        settings.endGroup();
+        settings.beginGroup("shell");
+        settings.beginGroup("open");
+        settings.beginGroup("command");
+        settings.setValue("Default", "\"" + QDir::toNativeSeparators(QCoreApplication::applicationFilePath()) + "\" \"%1\"");
+        settings.endGroup();
+        settings.endGroup();
+        settings.endGroup();
+
+        // qDebug() << nomacsKey << " written";
+    } else
+        settings.remove(nomacsKey);
+
+    return nomacsKey;
 #else
-	return QString();
+    return QString();
 #endif
 }
 
-QString DkFileFilterHandling::getIconID(const QString& ext) const {
-
-	//qDebug() << "ID: " << ext;
-	if (ext.contains(".jpg") || ext.contains(".jpeg")) {
-		return "1";
-	}
-	else if (ext.contains(".gif") || ext.contains(".mng")) {
-		return "2";
-	}
-	else if (ext.contains(".png")) {
-		return "3";
-	}
-	else if (ext.contains(".tif") || ext.contains(".tiff") || ext.contains(".bmp") || ext.contains(".pgm") || ext.contains(".webp")) {
-		return "4";
-	}
-	else if (!DkSettingsManager::param().app().rawFilters.filter(ext).empty()) {
-		return "5";
-	}
-	else
-		return "0";
-}
-
-void DkFileFilterHandling::registerExtension(const QString& ext, const QString& progKey, bool add) {
-
+QString DkFileFilterHandling::getIconID(const QString &ext) const
+{
+    // qDebug() << "ID: " << ext;
+    if (ext.contains(".jpg") || ext.contains(".jpeg")) {
+        return "1";
+    } else if (ext.contains(".gif") || ext.contains(".mng")) {
+        return "2";
+    } else if (ext.contains(".png")) {
+        return "3";
+    } else if (ext.contains(".tif") || ext.contains(".tiff") || ext.contains(".bmp") || ext.contains(".pgm") || ext.contains(".webp")) {
+        return "4";
+    } else if (!DkSettingsManager::param().app().rawFilters.filter(ext).empty()) {
+        return "5";
+    } else
+        return "0";
+}
+
+void DkFileFilterHandling::registerExtension(const QString &ext, const QString &progKey, bool add)
+{
 #ifdef Q_OS_WIN
 
-	QSettings settings2("HKEY_CURRENT_USER\\SOFTWARE\\Classes\\", QSettings::NativeFormat);
-	settings2.beginGroup(ext);
-	//if (add)
-	//	settings2.setValue("Default", progKey);	
-	settings2.beginGroup("OpenWithProgIds");
-	//settings.beginGroup("nomacs.exe");
-
-	if (add)
-		settings2.setValue(progKey, "");	// tell system that nomacs can handle this file type
-	else
-		settings2.remove(progKey);
+    QSettings settings2("HKEY_CURRENT_USER\\SOFTWARE\\Classes\\", QSettings::NativeFormat);
+    settings2.beginGroup(ext);
+    // if (add)
+    //	settings2.setValue("Default", progKey);
+    settings2.beginGroup("OpenWithProgIds");
+    // settings.beginGroup("nomacs.exe");
+
+    if (add)
+        settings2.setValue(progKey, ""); // tell system that nomacs can handle this file type
+    else
+        settings2.remove(progKey);
 #endif
 }
 
-void DkFileFilterHandling::registerFileType(const QString& filterString, const QString& attribute, bool add) {
-
+void DkFileFilterHandling::registerFileType(const QString &filterString, const QString &attribute, bool add)
+{
 #ifdef Q_OS_WIN
 
-	if (DkSettingsManager::param().app().privateMode)
-		return;
-	
-	QString friendlyName;
-	QStringList extList = getExtensions(filterString, friendlyName);
-	friendlyName += attribute;
+    if (DkSettingsManager::param().app().privateMode)
+        return;
 
-	// register a new progID
-	QString progKey = registerProgID(extList.at(0), friendlyName, add);
+    QString friendlyName;
+    QStringList extList = getExtensions(filterString, friendlyName);
+    friendlyName += attribute;
 
-	// register the extension
-	for (int idx = 0; idx < extList.size(); idx++) {
+    // register a new progID
+    QString progKey = registerProgID(extList.at(0), friendlyName, add);
 
-		//qDebug() << "registering: " << extList.at(idx);
+    // register the extension
+    for (int idx = 0; idx < extList.size(); idx++) {
+        // qDebug() << "registering: " << extList.at(idx);
 
-		registerExtension(extList.at(idx), progKey, add);
-		registerDefaultApp(extList.at(idx), progKey, add);
-		setAsDefaultApp(extList.at(idx), progKey, add);		// this is not working on Win8
-	}
+        registerExtension(extList.at(idx), progKey, add);
+        registerDefaultApp(extList.at(idx), progKey, add);
+        setAsDefaultApp(extList.at(idx), progKey, add); // this is not working on Win8
+    }
 
 #endif
 }
 
-QStringList DkFileFilterHandling::getExtensions(const QString& filter) const {
-
-	QString dummy;
-	return getExtensions(filter, dummy);
+QStringList DkFileFilterHandling::getExtensions(const QString &filter) const
+{
+    QString dummy;
+    return getExtensions(filter, dummy);
 }
 
-QStringList DkFileFilterHandling::getExtensions(const QString& filter, QString& friendlyName) const {
-
-	QStringList tmp = filter.split("(");
+QStringList DkFileFilterHandling::getExtensions(const QString &filter, QString &friendlyName) const
+{
+    QStringList tmp = filter.split("(");
 
-	if (tmp.size() != 2) {
-		qDebug() << "WARNING: wrong filter string!";
-		return QStringList();
-	}
+    if (tmp.size() != 2) {
+        qDebug() << "WARNING: wrong filter string!";
+        return QStringList();
+    }
 
-	friendlyName = tmp.at(0);
-	QString filters = tmp.at(1);
-	filters.replace(")", "");
-	filters.replace("*", "");
+    friendlyName = tmp.at(0);
+    QString filters = tmp.at(1);
+    filters.replace(")", "");
+    filters.replace("*", "");
 
-	QStringList extList = filters.split(" ");
+    QStringList extList = filters.split(" ");
 
-	if (extList.empty()) {
-		qDebug() << "nothing to do here, not registering: " << filter;
-		return QStringList();
-	}
+    if (extList.empty()) {
+        qDebug() << "nothing to do here, not registering: " << filter;
+        return QStringList();
+    }
 
-	return extList;
+    return extList;
 }
 
-void DkFileFilterHandling::registerDefaultApp(const QString& ext, const QString&, bool add) {
-
+void DkFileFilterHandling::registerDefaultApp(const QString &ext, const QString &, bool add)
+{
 #ifdef Q_OS_WIN
 
-	QSettings settings("HKEY_CURRENT_USER\\Software\\Classes\\Applications\\nomacs.exe", QSettings::NativeFormat);
-	
-	if (add) {
-		settings.beginGroup("SupportedTypes");
-		settings.setValue(ext, "");
-		//qDebug() << ext << "registered...";
-	}
-	else
-		settings.remove(ext);
-#endif
+    QSettings settings("HKEY_CURRENT_USER\\Software\\Classes\\Applications\\nomacs.exe", QSettings::NativeFormat);
 
+    if (add) {
+        settings.beginGroup("SupportedTypes");
+        settings.setValue(ext, "");
+        // qDebug() << ext << "registered...";
+    } else
+        settings.remove(ext);
+#endif
 }
 
-void DkFileFilterHandling::setAsDefaultApp(const QString& ext, const QString& progKey, bool add) {
-
+void DkFileFilterHandling::setAsDefaultApp(const QString &ext, const QString &progKey, bool add)
+{
 #ifdef Q_OS_WIN
-	
-	QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts", QSettings::NativeFormat);
-	settings.beginGroup(ext);
-
-	if (add) {
-		// windows 7 only
-		settings.beginGroup("UserChoice");
-		settings.setValue("ProgId", progKey);
-		settings.endGroup();
-
-		settings.beginGroup("OpenWithProgids");
-		settings.setValue("nomacs" + ext + ".3","");
-		//qDebug() << "default app set";
-	}
-	else
-		settings.setValue("Default", "");
-#endif
 
+    QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts", QSettings::NativeFormat);
+    settings.beginGroup(ext);
+
+    if (add) {
+        // windows 7 only
+        settings.beginGroup("UserChoice");
+        settings.setValue("ProgId", progKey);
+        settings.endGroup();
+
+        settings.beginGroup("OpenWithProgids");
+        settings.setValue("nomacs" + ext + ".3", "");
+        // qDebug() << "default app set";
+    } else
+        settings.setValue("Default", "");
+#endif
 }
 
 // -------------------------------------------------------------------- DefaultSettings
 #ifdef Q_OS_WIN
 // read the settings from a file on Windows
-DefaultSettings::DefaultSettings() : QSettings(DkSettingsManager::instance().param().settingsPath(), QSettings::IniFormat) {}
+DefaultSettings::DefaultSettings()
+    : QSettings(DkSettingsManager::instance().param().settingsPath(), QSettings::IniFormat)
+{
+}
 #else
-DefaultSettings::DefaultSettings() : QSettings() {}
+DefaultSettings::DefaultSettings()
+    : QSettings()
+{
+}
 #endif
 
-// -------------------------------------------------------------------- DkThemeManager 
-QStringList DkThemeManager::getAvailableThemes() const {
-	
-	QDir td(themeDir());
-	td.setNameFilters(QStringList() << "*.css");
+// -------------------------------------------------------------------- DkThemeManager
+QStringList DkThemeManager::getAvailableThemes() const
+{
+    QDir td(themeDir());
+    td.setNameFilters(QStringList() << "*.css");
 
-	QStringList themes = td.entryList(QDir::Files, QDir::Name);
+    QStringList themes = td.entryList(QDir::Files, QDir::Name);
 
-	return themes;
+    return themes;
 }
 
-QString DkThemeManager::getCurrentThemeName() const {
-	return DkSettingsManager::param().display().themeName;
+QString DkThemeManager::getCurrentThemeName() const
+{
+    return DkSettingsManager::param().display().themeName;
 }
 
-QString DkThemeManager::themeDir() const {
-
-	QStringList paths;
-	paths << QCoreApplication::applicationDirPath();
-	paths << QStandardPaths::standardLocations(QStandardPaths::DataLocation);
+QString DkThemeManager::themeDir() const
+{
+    QStringList paths;
+    paths << QCoreApplication::applicationDirPath();
+    paths << QStandardPaths::standardLocations(QStandardPaths::AppLocalDataLocation);
 
-	QDir themeDir;
+    QDir themeDir;
 
-	for (const QString& p : paths) {
-		themeDir = QDir(p + QDir::separator() + "themes");
+    for (const QString &p : paths) {
+        themeDir = QDir(p + QDir::separator() + "themes");
 
-		if (themeDir.exists())
-			break;
-	}
+        if (themeDir.exists())
+            break;
+    }
 
-	return themeDir.absolutePath();
+    return themeDir.absolutePath();
 }
 
-void DkThemeManager::setCurrentTheme(const QString & themeName) const {
-	DkSettingsManager::param().display().themeName = themeName;
+void DkThemeManager::setCurrentTheme(const QString &themeName) const
+{
+    DkSettingsManager::param().display().themeName = themeName;
 }
 
-QString DkThemeManager::loadTheme(const QString & themeName) const {
-
-	QString cssString;
-	QFileInfo tfi(themeDir(), themeName);
-	QFile theme(tfi.absoluteFilePath());
-
-	if (theme.open(QFile::ReadOnly)) {
+QString DkThemeManager::loadTheme(const QString &themeName) const
+{
+    QString cssString;
+    QFileInfo tfi(themeDir(), themeName);
+    QFile theme(tfi.absoluteFilePath());
 
-		QString ts = theme.readAll();
-		cssString = parseColors(ts);
-		cssString = cssString.trimmed();
+    if (theme.open(QFile::ReadOnly)) {
+        QString ts = theme.readAll();
+        cssString = parseColors(ts);
+        cssString = cssString.trimmed();
 
-		qInfo() << "theme loaded from" << tfi.absoluteFilePath();
-	}
-	else
-		qInfo() << "could not load theme from" << tfi.absoluteFilePath();
+        qInfo() << "theme loaded from" << tfi.absoluteFilePath();
+    } else
+        qInfo() << "could not load theme from" << tfi.absoluteFilePath();
 
-	return cssString;
+    return cssString;
 }
 
-QString DkThemeManager::loadStylesheet() const {
+QString DkThemeManager::loadStylesheet() const
+{
+    QString cssString;
 
-	QString cssString;
+    QFileInfo cssInfo(":/nomacs/stylesheet.css");
+    QFile file(cssInfo.absoluteFilePath());
 
-	//QFileInfo cssInfo("C:/coding/nomacs/nomacs-only/ImageLounge/src/stylesheet.css");
-	QFileInfo cssInfo(":/nomacs/stylesheet.css");
-	QFile file(cssInfo.absoluteFilePath());
+    if (file.open(QFile::ReadOnly)) {
+        cssString = file.readAll();
+        cssString = replaceColors(cssString);
 
-	if (file.open(QFile::ReadOnly)) {
-
-		cssString = file.readAll();
-		cssString = replaceColors(cssString);
+        qInfo() << "CSS loaded from: " << cssInfo.absoluteFilePath();
+    }
 
-		qInfo() << "CSS loaded from: " << cssInfo.absoluteFilePath();
-	}
-	
-	file.close();
+    file.close();
 
-	return cssString;
+    return cssString;
 }
 
-void DkThemeManager::applyTheme() const {
-	
-	// add theme
-	QString cssString = loadTheme(getCurrentThemeName());
-
-	DkSettings::Display& dp = DkSettingsManager::param().display();
-
-	// NOTE: it is important, that default.css does not contain
-	// any line of code except for the color definitions
-	// otherwise, we change the default palette here...
-	if (!cssString.isEmpty()) {
+void DkThemeManager::applyTheme() const
+{
+    // add theme
+    QString cssString = loadTheme(getCurrentThemeName());
 
-		cssString = replaceColors(cssString);
+    DkSettings::Display &dp = DkSettingsManager::param().display();
 
-		QPalette p = qApp->palette();
+    // NOTE: it is important, that default.css does not contain
+    // any line of code except for the color definitions
+    // otherwise, we change the default palette here...
+    if (!cssString.isEmpty()) {
+        cssString = replaceColors(cssString);
 
-		if (dp.themeBgdColor != QPalette().color(QPalette::Window)) {
-			p.setColor(QPalette::Window, dp.themeBgdColor);
-			p.setColor(QPalette::Base, dp.themeBgdColor);
-		}
+        QPalette p = qApp->palette();
 
-		p.setColor(QPalette::WindowText, dp.themeFgdColor);
-		p.setColor(QPalette::ButtonText, dp.themeFgdColor);
+        if (dp.themeBgdColor != QPalette().color(QPalette::Window)) {
+            p.setColor(QPalette::Window, dp.themeBgdColor);
+            p.setColor(QPalette::Base, dp.themeBgdColor);
+        }
 
-		//p.setColor(QPalette::Button, QColor(0, 0, 0));
+        p.setColor(QPalette::WindowText, dp.themeFgdColor);
+        p.setColor(QPalette::ButtonText, dp.themeFgdColor);
 
-		qApp->setPalette(p);
-	}
+        // p.setColor(QPalette::Button, QColor(0, 0, 0));
 
-	QString cs = loadStylesheet();
-	cs += cssString;
+        qApp->setPalette(p);
+    }
 
-	qApp->setStyleSheet(cs);
-}
+    QString cs = loadStylesheet();
+    cs += cssString;
 
-QString DkThemeManager::cleanThemeName(const QString & theme) const {
-	
-	QString t = theme;
-	t = t.replace(".css", "");
-	t = t.replace("-", " ");
-	
-	return t;
+    qApp->setStyleSheet(cs);
 }
 
-QStringList DkThemeManager::cleanThemeNames(const QStringList & themes) const {
-
-	QStringList ctn;
-
-	for (const QString& t : themes)
-		ctn << cleanThemeName(t);
+QString DkThemeManager::cleanThemeName(const QString &theme) const
+{
+    QString t = theme;
+    t = t.replace(".css", "");
+    t = t.replace("-", " ");
 
-	return ctn;
+    return t;
 }
 
-QString DkThemeManager::parseColors(const QString & styleSheet) const {
+QStringList DkThemeManager::cleanThemeNames(const QStringList &themes) const
+{
+    QStringList ctn;
 
-	QStringList cs = styleSheet.split("--nomacs-color-def");
+    for (const QString &t : themes)
+        ctn << cleanThemeName(t);
 
-	if (cs.size() == 3) {
-
-		// we expect something like this:
-		/* overload color settings of nomacs */
-		//	--nomacs-color-def
-		//		HIGHLIGHT_COLOR:	#ff0;
-		//		WINDOW_COLOR:		#333;
-		//	--nomacs-color-def
-		QStringList cols = cs[1].split(";");
-
-		for (auto str : cols) {
-
-			str = str.simplified();
+    return ctn;
+}
 
-			// igonre blanks
-			if (str.isEmpty())
-				continue;
+QString DkThemeManager::parseColors(const QString &styleSheet) const
+{
+    QStringList cs = styleSheet.split("--nomacs-color-def");
 
-			QStringList kv = str.split(":");
+    if (cs.size() == 3) {
+        // we expect something like this:
+        /* overload color settings of nomacs */
+        //	--nomacs-color-def
+        //		HIGHLIGHT_COLOR:	#ff0;
+        //		WINDOW_COLOR:		#333;
+        //	--nomacs-color-def
+        QStringList cols = cs[1].split(";");
 
-			if (kv.size() != 2) {
-				qWarning() << "could not parse color from" << str;
-				qWarning() << "I expected a line like this: HUD_BACKGROUND_COLOR: #f00;";
-				continue;
-			}
+        for (auto str : cols) {
+            str = str.simplified();
 
-			QString cc = kv[1].simplified();
+            // igonre blanks
+            if (str.isEmpty())
+                continue;
 
-			if (kv[0] == "HIGHLIGHT_COLOR" && cc != "default")
-				DkSettingsManager::param().display().highlightColor.setNamedColor(cc);
-			else if (kv[0] == "HUD_BACKGROUND_COLOR" && cc != "default")
-				DkSettingsManager::param().display().hudBgColor.setNamedColor(cc);
-			else if (kv[0] == "HUD_FOREGROUND_COLOR" && cc != "default")
-				DkSettingsManager::param().display().hudFgdColor.setNamedColor(cc);
-			else if (kv[0] == "BACKGROUND_COLOR") {
+            QStringList kv = str.split(":");
 
-				QColor c;
-				c.setNamedColor(cc);
+            if (kv.size() != 2) {
+                qWarning() << "could not parse color from" << str;
+                qWarning() << "I expected a line like this: HUD_BACKGROUND_COLOR: #f00;";
+                continue;
+            }
 
-				if (cc == "default")
-					c = QPalette().color(QPalette::Window);
-					
-				if (DkSettingsManager::param().display().defaultBackgroundColor)
-						DkSettingsManager::param().display().bgColor = c;
-				DkSettingsManager::param().display().themeBgdColor = c;
-			}
-			else if (kv[0] == "FOREGROUND_COLOR" && cc != "default")
-				DkSettingsManager::param().display().themeFgdColor.setNamedColor(cc);
-			else if (kv[0] == "ICON_COLOR" && cc != "default") {
-				if (DkSettingsManager::param().display().defaultIconColor)
-					DkSettingsManager::param().display().iconColor.setNamedColor(cc);
-			}
-			else if (cc != "default")
-				qWarning() << "could not parse color:" << str;
-		}
+            QString cc = kv[1].simplified();
 
-		return cs[0] + cs[2];
-	}
+            if (kv[0] == "HIGHLIGHT_COLOR" && cc != "default")
+                DkSettingsManager::param().display().highlightColor.setNamedColor(cc);
+            else if (kv[0] == "HUD_BACKGROUND_COLOR" && cc != "default")
+                DkSettingsManager::param().display().hudBgColor.setNamedColor(cc);
+            else if (kv[0] == "HUD_FOREGROUND_COLOR" && cc != "default")
+                DkSettingsManager::param().display().hudFgdColor.setNamedColor(cc);
+            else if (kv[0] == "BACKGROUND_COLOR") {
+                QColor c;
+                c.setNamedColor(cc);
 
-	return styleSheet;
-}
+                if (cc == "default")
+                    c = QPalette().color(QPalette::Window);
 
-QString DkThemeManager::replaceColors(const QString & cssString) const {
-	
-	QString cs = cssString;
+                if (DkSettingsManager::param().display().defaultBackgroundColor)
+                    DkSettingsManager::param().display().bgColor = c;
+                DkSettingsManager::param().display().themeBgdColor = c;
+            } else if (kv[0] == "FOREGROUND_COLOR" && cc != "default")
+                DkSettingsManager::param().display().themeFgdColor.setNamedColor(cc);
+            else if (kv[0] == "ICON_COLOR" && cc != "default") {
+                if (DkSettingsManager::param().display().defaultIconColor)
+                    DkSettingsManager::param().display().iconColor.setNamedColor(cc);
+            } else if (cc != "default")
+                qWarning() << "could not parse color:" << str;
+        }
 
-	QColor hc = DkSettingsManager::param().display().highlightColor;
-	hc.setAlpha(150);
+        return cs[0] + cs[2];
+    }
 
-	// replace color placeholders
-	cs.replace("HIGHLIGHT_COLOR", DkUtils::colorToString(DkSettingsManager::param().display().highlightColor));
-	cs.replace("HIGHLIGHT_LIGHT", DkUtils::colorToString(hc));
-	cs.replace("HUD_BACKGROUND_COLOR", DkUtils::colorToString(DkSettingsManager::param().display().hudBgColor));
-	cs.replace("HUD_FOREGROUND_COLOR", DkUtils::colorToString(DkSettingsManager::param().display().hudFgdColor));
-	cs.replace("BACKGROUND_COLOR", DkUtils::colorToString(DkSettingsManager::param().display().bgColor));
-	cs.replace("FOREGROUND_COLOR", DkUtils::colorToString(DkSettingsManager::param().display().themeFgdColor));
-	cs.replace("WINDOW_COLOR", DkUtils::colorToString(QPalette().color(QPalette::Window)));
-	
-	return cs;
+    return styleSheet;
 }
 
-// -------------------------------------------------------------------- DkZoomConfig 
-DkZoomConfig::DkZoomConfig() {
+QString DkThemeManager::replaceColors(const QString &cssString) const
+{
+    QString cs = cssString;
 
-	mLevels = defaultLevels();
+    QColor hc = DkSettingsManager::param().display().highlightColor;
+    hc.setAlpha(150);
 
-	DefaultSettings ds;
-	loadSettings(ds);
-}
+    // replace color placeholders
+    cs.replace("HIGHLIGHT_COLOR", DkUtils::colorToString(DkSettingsManager::param().display().highlightColor));
+    cs.replace("HIGHLIGHT_LIGHT", DkUtils::colorToString(hc));
+    cs.replace("HUD_BACKGROUND_COLOR", DkUtils::colorToString(DkSettingsManager::param().display().hudBgColor));
+    cs.replace("HUD_FOREGROUND_COLOR", DkUtils::colorToString(DkSettingsManager::param().display().hudFgdColor));
+    cs.replace("BACKGROUND_COLOR", DkUtils::colorToString(DkSettingsManager::param().display().bgColor));
+    cs.replace("FOREGROUND_COLOR", DkUtils::colorToString(DkSettingsManager::param().display().themeFgdColor));
+    cs.replace("WINDOW_COLOR", DkUtils::colorToString(QPalette().color(QPalette::Window)));
 
-DkZoomConfig& DkZoomConfig::instance() {
-	static DkZoomConfig inst;
-	return inst;
+    return cs;
 }
 
-DkZoomConfig::~DkZoomConfig() {
+// -------------------------------------------------------------------- DkZoomConfig
+DkZoomConfig::DkZoomConfig()
+{
+    mLevels = defaultLevels();
 
-	DefaultSettings ds;
-	saveSettings(ds);
+    DefaultSettings ds;
+    loadSettings(ds);
 }
 
-double DkZoomConfig::nextFactor(double currentFactor, double delta) const {
-
-	// do nothing?
-	if (!mUseLevels)
-		return delta;
-
-	assert(currentFactor != 0.0);
-
-	if (currentFactor == 0.0)
-		return 1.0;
-
-	if (delta > 1) {
-		for (double l : mLevels) {
-
-			if (currentFactor < l) {
-				return l / currentFactor;
-			}
-		}
-	}
-	else if (delta < 1) {
-
-		for (int idx = mLevels.size() - 1; idx >= 0; idx--) {
-
-			if (currentFactor > mLevels[idx]) {
-				return mLevels[idx] / currentFactor;
-			}
-		}
-	}
-
-	// do nothing
-	return 1.0;
+DkZoomConfig &DkZoomConfig::instance()
+{
+    static DkZoomConfig inst;
+    return inst;
 }
 
-QVector<double> DkZoomConfig::defaultLevels() const {
-
-	QVector<double> levels;
-
-	levels << 0.0001;
-	levels << 0.001;
-	levels << 0.01;
-	levels << 0.05;
-	levels << 0.1;
-	levels << 0.125;
-	levels << 0.166;
-	levels << 0.25;
-	levels << 0.333;
-	levels << 0.5;
-	levels << 0.66;
-	levels << 1;
-	levels << 1.5;
-	levels << 2;
-	levels << 3;
-	levels << 4;
-	levels << 5;
-	levels << 6;
-	levels << 7;
-	levels << 8;
-	levels << 12;
-	levels << 16;
-	levels << 32;
-	levels << 64;
-	levels << 128;
-
-	return levels;
+DkZoomConfig::~DkZoomConfig()
+{
+    DefaultSettings ds;
+    saveSettings(ds);
 }
 
-bool DkZoomConfig::useLevels() const {
-	return mUseLevels;
-}
+double DkZoomConfig::nextFactor(double currentFactor, double delta) const
+{
+    // do nothing?
+    if (!mUseLevels)
+        return delta;
 
-void DkZoomConfig::setUseLevels(bool useLevels) {
-	mUseLevels = useLevels;
-}
+    assert(currentFactor != 0.0);
 
-bool DkZoomConfig::setLevels(const QString & levelStr) {
+    if (currentFactor == 0.0)
+        return 1.0;
 
-	QVector<double> levels;
-	QStringList levelList = levelStr.split(",");
+    if (delta > 1) {
+        for (double l : mLevels) {
+            if (currentFactor < l) {
+                return l / currentFactor;
+            }
+        }
+    } else if (delta < 1) {
+        for (int idx = mLevels.size() - 1; idx >= 0; idx--) {
+            if (currentFactor > mLevels[idx]) {
+                return mLevels[idx] / currentFactor;
+            }
+        }
+    }
 
-	bool ok = false;
-	for (const QString& s : levelList) {
-		levels << s.toDouble(&ok);
-		if (!ok)
-			break;
-	}
+    // do nothing
+    return 1.0;
+}
+
+QVector<double> DkZoomConfig::defaultLevels() const
+{
+    QVector<double> levels;
+
+    levels << 0.0001;
+    levels << 0.001;
+    levels << 0.01;
+    levels << 0.05;
+    levels << 0.1;
+    levels << 0.125;
+    levels << 0.166;
+    levels << 0.25;
+    levels << 0.333;
+    levels << 0.5;
+    levels << 0.66;
+    levels << 1;
+    levels << 1.5;
+    levels << 2;
+    levels << 3;
+    levels << 4;
+    levels << 5;
+    levels << 6;
+    levels << 7;
+    levels << 8;
+    levels << 12;
+    levels << 16;
+    levels << 32;
+    levels << 64;
+    levels << 128;
+
+    return levels;
+}
+
+bool DkZoomConfig::useLevels() const
+{
+    return mUseLevels;
+}
+
+void DkZoomConfig::setUseLevels(bool useLevels)
+{
+    mUseLevels = useLevels;
+}
+
+bool DkZoomConfig::setLevels(const QString &levelStr)
+{
+    QVector<double> levels;
+    QStringList levelList = levelStr.split(",");
+
+    bool ok = false;
+    for (const QString &s : levelList) {
+        levels << s.toDouble(&ok);
+        if (!ok)
+            break;
+    }
 
-	if (ok && checkLevels(levels)) {
-		mLevels = levels;
-		return true;
-	}
-	
-	return false;
-}
+    if (ok && checkLevels(levels)) {
+        mLevels = levels;
+        return true;
+    }
 
-QString DkZoomConfig::levelsToString() const {
-	
-	QStringList levelStr;
-	for (double l : mLevels)
-		levelStr << QString::number(l);
-	
-	return levelStr.join(",");
+    return false;
 }
 
-void DkZoomConfig::setLevelsToDefault() {
+QString DkZoomConfig::levelsToString() const
+{
+    QStringList levelStr;
+    for (double l : mLevels)
+        levelStr << QString::number(l);
 
-	mLevels = defaultLevels();
+    return levelStr.join(",");
 }
 
-bool DkZoomConfig::checkLevels(const QVector<double>& levels) {
+void DkZoomConfig::setLevelsToDefault()
+{
+    mLevels = defaultLevels();
+}
 
-	if (levels.isEmpty())
-		return false;
+bool DkZoomConfig::checkLevels(const QVector<double> &levels)
+{
+    if (levels.isEmpty())
+        return false;
 
-	double last = 0;
+    double last = 0;
 
-	// levels must be monotonically increasing
-	for (double l : levels) {
-		if (l < last)
-			return false;
-	}
+    // levels must be monotonically increasing
+    for (double l : levels) {
+        if (l < last)
+            return false;
+    }
 
-	return true;
+    return true;
 }
 
-void DkZoomConfig::loadSettings(QSettings & settings) {
+void DkZoomConfig::loadSettings(QSettings &settings)
+{
+    settings.beginGroup("zooming");
+    QString levelStr = settings.value("zoomLevels").toString();
+    mUseLevels = settings.value("useLevels").toBool();
+    settings.endGroup();
 
-	settings.beginGroup("zooming");
-	QString levelStr = settings.value("zoomLevels").toString();
-	mUseLevels = settings.value("useLevels").toBool();
-	settings.endGroup();
-
-	if (!setLevels(levelStr))
-		qWarning() << "illegal zoom levels when loading from settings:" << levelStr;
+    if (!setLevels(levelStr))
+        qWarning() << "illegal zoom levels when loading from settings:" << levelStr;
 }
 
-void DkZoomConfig::saveSettings(QSettings & settings) const {
-
-	settings.beginGroup("zooming");
-	settings.setValue("zoomLevels", levelsToString());
-	settings.setValue("useLevels", mUseLevels);
-	settings.endGroup();
+void DkZoomConfig::saveSettings(QSettings &settings) const
+{
+    settings.beginGroup("zooming");
+    settings.setValue("zoomLevels", levelsToString());
+    settings.setValue("useLevels", mUseLevels);
+    settings.endGroup();
 }
 
 }
diff --git a/ImageLounge/src/DkCore/DkSettings.h b/ImageLounge/src/DkCore/DkSettings.h
index d361980..b6f8512 100644
--- a/ImageLounge/src/DkCore/DkSettings.h
+++ b/ImageLounge/src/DkCore/DkSettings.h
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkSettings.h
  Created on:	07.07.2011
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -27,16 +27,16 @@
 
 #pragma once
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QSettings>
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QBitArray>
 #include <QColor>
 #include <QDate>
+#include <QSettings>
 #include <QSharedPointer>
 #include <QVector>
-#pragma warning(pop)	// no warnings from includes - end
+#pragma warning(pop) // no warnings from includes - end
 
-#pragma warning(disable: 4251)	// TODO: remove
+#pragma warning(disable : 4251) // TODO: remove
 
 #ifndef DllCoreExport
 #ifdef DK_CORE_DLL_EXPORT
@@ -51,395 +51,396 @@
 class QFileInfo;
 class QTranslator;
 
-namespace nmc {
-
-class DllCoreExport DefaultSettings : public QSettings {
+namespace nmc
+{
 
+class DllCoreExport DefaultSettings : public QSettings
+{
 public:
-	DefaultSettings();
+    DefaultSettings();
 };
 
-class DllCoreExport DkFileFilterHandling {
-
+class DllCoreExport DkFileFilterHandling
+{
 public:
-	DkFileFilterHandling() {};
-	void registerNomacs(bool showDefaultApps = false);
-	void registerFileType(const QString& filterString, const QString& attribute, bool add);
-	void showDefaultSoftware() const;
+    DkFileFilterHandling(){};
+    void registerNomacs(bool showDefaultApps = false);
+    void registerFileType(const QString &filterString, const QString &attribute, bool add);
+    void showDefaultSoftware() const;
 
-	static void registerFileAssociations();
+    static void registerFileAssociations();
 
 protected:
-	QString registerProgID(const QString& ext, const QString& friendlyName, bool add);
-	void registerExtension(const QString& ext, const QString& progKey, bool add);
-	void setAsDefaultApp(const QString& ext, const QString& progKey, bool defaultApp);
-	void registerDefaultApp(const QString& ext, const QString& progKey, bool defaultApp);
-	QString getIconID(const QString& ext) const;
-
-	QStringList getExtensions(const QString& filter) const;
-	QStringList getExtensions(const QString& filter, QString& friendlyName) const;
+    QString registerProgID(const QString &ext, const QString &friendlyName, bool add);
+    void registerExtension(const QString &ext, const QString &progKey, bool add);
+    void setAsDefaultApp(const QString &ext, const QString &progKey, bool defaultApp);
+    void registerDefaultApp(const QString &ext, const QString &progKey, bool defaultApp);
+    QString getIconID(const QString &ext) const;
+
+    QStringList getExtensions(const QString &filter) const;
+    QStringList getExtensions(const QString &filter, QString &friendlyName) const;
 };
 
-class DllCoreExport DkThemeManager {
-
+class DllCoreExport DkThemeManager
+{
 public:
-	DkThemeManager() {};
+    DkThemeManager(){};
 
-	QStringList getAvailableThemes() const;
-	QString getCurrentThemeName() const;
-	QString themeDir() const;
+    QStringList getAvailableThemes() const;
+    QString getCurrentThemeName() const;
+    QString themeDir() const;
 
-	void setCurrentTheme(const QString& themeName) const;
-	QString loadTheme(const QString& themeName) const;
-	
-	QString loadStylesheet() const;
-	void applyTheme() const;
+    void setCurrentTheme(const QString &themeName) const;
+    QString loadTheme(const QString &themeName) const;
 
-	QString cleanThemeName(const QString& theme) const;
-	QStringList cleanThemeNames(const QStringList& themes) const;
+    QString loadStylesheet() const;
+    void applyTheme() const;
+
+    QString cleanThemeName(const QString &theme) const;
+    QStringList cleanThemeNames(const QStringList &themes) const;
 
 protected:
-	QString parseColors(const QString & styleSheet) const;
-	QString replaceColors(const QString & cssString) const;
+    QString parseColors(const QString &styleSheet) const;
+    QString replaceColors(const QString &cssString) const;
 };
 
-class DllCoreExport DkSettings {
-
+class DllCoreExport DkSettings
+{
 public:
-	DkSettings();
-
-	enum modes {
-		mode_default = 0,
-		mode_frameless,
-		mode_contrast,
-		mode_default_fullscreen,
-		mode_frameless_fullscreen,
-		mode_contrast_fullscreen,
-		mode_end,
-	};
-
-	enum sortMode {
-		sort_filename,
-		sort_date_created,
-		sort_date_modified,
-		sort_random,
-		sort_end,
-	};
-
-	enum sortDir {
-		sort_ascending,
-		sort_descending,
-
-		sort_dir_end,
-	};
-
-	enum rawThumb {
-		raw_thumb_always,
-		raw_thumb_if_large,
-		raw_thumb_never,
-
-		raw_thumb_end,
-	};
-
-	enum keepZoom {
-		zoom_always_keep,
-		zoom_keep_same_size,
-		zoom_never_keep,
-
-		zoom_end,
-	};
-
-	enum TransitionMode {
-		trans_appear,
-		trans_fade,
-		trans_swipe,
-
-		trans_end
-	};
-
-	enum LoadSaveMode {
-		ls_load,
-		ls_load_to_tab,
-		ls_do_nothing,
-
-		ls,end
-	};
-
-	struct App {
-		bool showToolBar;
-		bool showMenuBar;
-		bool showStatusBar;
-		bool showMovieToolBar;
-		QBitArray showFilePreview;
-		QBitArray showFileInfoLabel;
-		QBitArray showPlayer;
-		QBitArray showMetaData;
-		QBitArray showHistogram;
-		QBitArray showOverview;
-		QBitArray showScroller;
-		QBitArray showComment;
-		QBitArray showExplorer;
-		QBitArray showMetaDataDock;
-		QBitArray showEditDock;
-		QBitArray showHistoryDock;
-		QBitArray showLogDock;
-		bool showRecentFiles;
-		bool useLogFile;
-		int appMode;
-		int currentAppMode;
-		bool privateMode;
-		bool advancedSettings;
-		bool closeOnEsc;
-		bool hideAllPanels;
-
-		int defaultJpgQuality;
-
-		QStringList browseFilters;
-		QStringList registerFilters;
-
-		QStringList fileFilters;	// just the filters
-		QStringList openFilters;	// for open dialog
-		QStringList saveFilters;	// for save dialog
-		QStringList rawFilters;
-		QStringList containerFilters;
-		QString containerRawFilters;
-	};
-
-	struct Display {
-		int keepZoom;
-		bool zoomToFit;
-		bool invertZoom;
-		bool tpPattern;
-		bool showNavigation;
-		QString themeName;
-		QColor highlightColor;
-		QColor hudBgColor;
-		QColor bgColor;
-		QColor bgColorFrameless;
-		QColor hudFgdColor;
-		QColor iconColor;
-
-		// theme colors
-		QColor themeFgdColor;
-		QColor themeBgdColor;
-
-		bool defaultBackgroundColor;
-		bool defaultIconColor;
-		int thumbSize;
-		int iconSize;
-		int thumbPreviewSize;
-		//bool saveThumb;
-		int interpolateZoomLevel;
-		bool showCrop;
-		bool antiAliasing;
-		bool highQualityAntiAliasing;
-		bool showBorder;
-		bool displaySquaredThumbs;
-		bool showThumbLabel;
-		bool showScrollBars;
-		
-		TransitionMode transition;
-		bool alwaysAnimate;
-		float animationDuration;
-
-		int histogramStyle;
-	};
-
-	struct Global {
-		int skipImgs;
-		int numFiles;
-		bool loop;
-		bool scanSubFolders;
-
-		QString lastDir;
-		QString lastSaveDir;
-		QStringList recentFiles;
-		QStringList recentFolders;
-		QStringList pinnedFiles;
-		bool logRecentFiles;
-		bool checkOpenDuplicates;
-		bool extendedTabs;
-		bool askToSaveDeletedFiles;
-		QString tmpPath;
-		QString language;
-		QStringList searchHistory;
-		
-		Qt::KeyboardModifier altMod;
-		Qt::KeyboardModifier ctrlMod;
-		bool zoomOnWheel;
-		bool horZoomSkips;
-		bool doubleClickForFullscreen;
-		bool showBgImage;
-
-		QString setupPath;
-		QString setupVersion;
-		int numThreads;
-
-		int sortMode;
-		int sortDir;
-		QString pluginsDir;
-	};
-
-	struct SlideShow {
-		int filter;
-		float time;
-		bool showPlayer;
-		bool silentFullscreen;
-		QBitArray display;
-		QColor backgroundColor;
-		float moveSpeed;
-	};
-	struct Sync {
-		bool checkForUpdates;
-		bool updateDialogShown;
-		bool disableUpdateInteraction;
-		QDate lastUpdateCheck;
-		bool syncAbsoluteTransform;
-		bool switchModifier;
-		bool syncActions;
-	};
-	struct MetaData {
-		bool ignoreExifOrientation;
-		bool saveExifOrientation;
-	};
-		
-	struct Resources {
-		float cacheMemory;
-		float historyMemory;
-		bool nativeDialog;
-		int maxImagesCached;
-		bool waitForLastImg;
-		bool filterRawImages;
-		bool filterDuplicats;
-		int loadRawThumb;
-		QString preferredExtension;
-		bool gammaCorrection;
-		int loadSavedImage;
-	};
-
-	enum DisplayItems{
-		display_file_name,
-		display_creation_date,
-		display_file_rating,
-
-		display_end
-	};
-
-	QStringList translatedCamData() const;
-	QStringList translatedDescriptionData() const;
-
-	void initFileFilters();
-	void loadTranslation(const QString& fileName, QTranslator& translator);
-	QStringList getTranslationDirs();
-
-	void load();
-	void load(QSettings& settings, bool defaults = false);
-	void save(bool force = false);
-	void save(QSettings& settings, bool force = false);
-	void setToDefaultSettings();
-	void setNumThreads(int numThreads);
-
-	bool isPortable();
-	QString settingsPath() const;
-
-	double dpiScaleFactor(QWidget *w = 0) const;
-	int effectiveIconSize(QWidget *w = 0) const;
-	int effectiveThumbSize(QWidget *w = 0) const;
-	int effectiveThumbPreviewSize(QWidget *w = 0) const;
-
-	App& app();
-	Global& global();
-	Display& display();
-	SlideShow& slideShow();
-	Sync& sync();
-	MetaData& metaData();
-	Resources& resources();
+    DkSettings();
+
+    enum modes {
+        mode_default = 0,
+        mode_frameless,
+        mode_contrast,
+        mode_default_fullscreen,
+        mode_frameless_fullscreen,
+        mode_contrast_fullscreen,
+        mode_end,
+    };
+
+    enum sortMode {
+        sort_filename,
+        sort_file_size,
+        sort_date_created,
+        sort_date_modified,
+        sort_random,
+        sort_end,
+    };
+
+    enum sortDir {
+        sort_ascending,
+        sort_descending,
+
+        sort_dir_end,
+    };
+
+    enum rawThumb {
+        raw_thumb_always,
+        raw_thumb_if_large,
+        raw_thumb_never,
+
+        raw_thumb_end,
+    };
+
+    enum keepZoom {
+        zoom_always_keep,
+        zoom_keep_same_size,
+        zoom_never_keep,
+
+        zoom_end,
+    };
+
+    enum TransitionMode {
+        trans_appear,
+        trans_fade,
+        trans_swipe,
+
+        trans_end
+    };
+
+    enum LoadSaveMode {
+        ls_load,
+        ls_load_to_tab,
+        ls_do_nothing,
+
+        ls,
+        end
+    };
+
+    struct App {
+        bool showToolBar;
+        bool showMenuBar;
+        bool showStatusBar;
+        bool showMovieToolBar;
+        QBitArray showFilePreview;
+        QBitArray showFileInfoLabel;
+        QBitArray showPlayer;
+        QBitArray showMetaData;
+        QBitArray showHistogram;
+        QBitArray showOverview;
+        QBitArray showScroller;
+        QBitArray showComment;
+        QBitArray showExplorer;
+        QBitArray showMetaDataDock;
+        QBitArray showEditDock;
+        QBitArray showHistoryDock;
+        QBitArray showLogDock;
+        bool showRecentFiles;
+        bool useLogFile;
+        int appMode;
+        int currentAppMode;
+        bool privateMode;
+        bool advancedSettings;
+        bool closeOnEsc;
+        bool hideAllPanels;
+
+        int defaultJpgQuality;
+
+        QStringList browseFilters;
+        QStringList registerFilters;
+
+        QStringList fileFilters; // just the filters
+        QStringList openFilters; // for open dialog
+        QStringList saveFilters; // for save dialog
+        QStringList rawFilters;
+        QStringList containerFilters;
+        QString containerRawFilters;
+    };
+
+    struct Display {
+        int keepZoom;
+        bool zoomToFit;
+        bool invertZoom;
+        bool tpPattern;
+        bool showNavigation;
+        QString themeName;
+        QColor highlightColor;
+        QColor hudBgColor;
+        QColor bgColor;
+        QColor bgColorFrameless;
+        QColor hudFgdColor;
+        QColor iconColor;
+
+        // theme colors
+        QColor themeFgdColor;
+        QColor themeBgdColor;
+
+        bool defaultBackgroundColor;
+        bool defaultIconColor;
+        int thumbSize;
+        int iconSize;
+        int thumbPreviewSize;
+        // bool saveThumb;
+        int interpolateZoomLevel;
+        bool showCrop;
+        bool antiAliasing;
+        bool highQualityAntiAliasing;
+        bool showBorder;
+        bool displaySquaredThumbs;
+        bool showThumbLabel;
+        bool showScrollBars;
+
+        TransitionMode transition;
+        bool alwaysAnimate;
+        float animationDuration;
+
+        int histogramStyle;
+    };
+
+    struct Global {
+        int skipImgs;
+        int numFiles;
+        bool loop;
+        bool scanSubFolders;
+
+        QString lastDir;
+        QString lastSaveDir;
+        QStringList recentFiles;
+        QStringList recentFolders;
+        QStringList pinnedFiles;
+        bool logRecentFiles;
+        bool checkOpenDuplicates;
+        bool extendedTabs;
+        bool askToSaveDeletedFiles;
+        QString tmpPath;
+        QString language;
+        QStringList searchHistory;
+
+        Qt::KeyboardModifier altMod;
+        Qt::KeyboardModifier ctrlMod;
+        bool zoomOnWheel;
+        bool horZoomSkips;
+        bool doubleClickForFullscreen;
+        bool showBgImage;
+
+        QString setupPath;
+        QString setupVersion;
+        int numThreads;
+
+        int sortMode;
+        int sortDir;
+        QString pluginsDir;
+    };
+
+    struct SlideShow {
+        int filter;
+        float time;
+        bool showPlayer;
+        bool silentFullscreen;
+        QBitArray display;
+        QColor backgroundColor;
+        float moveSpeed;
+    };
+    struct Sync {
+        bool checkForUpdates;
+        bool updateDialogShown;
+        bool disableUpdateInteraction;
+        QDate lastUpdateCheck;
+        bool syncAbsoluteTransform;
+        bool switchModifier;
+        bool syncActions;
+    };
+    struct MetaData {
+        bool ignoreExifOrientation;
+        bool saveExifOrientation;
+    };
+
+    struct Resources {
+        float cacheMemory;
+        float historyMemory;
+        bool nativeDialog;
+        int maxImagesCached;
+        bool waitForLastImg;
+        bool filterRawImages;
+        bool filterDuplicats;
+        int loadRawThumb;
+        QString preferredExtension;
+        bool gammaCorrection;
+        int loadSavedImage;
+    };
+
+    enum DisplayItems {
+        display_file_name,
+        display_creation_date,
+        display_file_rating,
+
+        display_end
+    };
+
+    QStringList translatedCamData() const;
+    QStringList translatedDescriptionData() const;
+
+    void initFileFilters();
+    void loadTranslation(const QString &fileName, QTranslator &translator);
+    QStringList getTranslationDirs();
+
+    void load();
+    void load(QSettings &settings, bool defaults = false);
+    void save(bool force = false);
+    void save(QSettings &settings, bool force = false);
+    void setToDefaultSettings();
+    void setNumThreads(int numThreads);
+
+    bool isPortable();
+    QString settingsPath() const;
+
+    double dpiScaleFactor(QWidget *w = 0) const;
+    int effectiveIconSize(QWidget *w = 0) const;
+    int effectiveThumbSize(QWidget *w = 0) const;
+    int effectiveThumbPreviewSize(QWidget *w = 0) const;
+
+    App &app();
+    Global &global();
+    Display &display();
+    SlideShow &slideShow();
+    Sync &sync();
+    MetaData &metaData();
+    Resources &resources();
 
 protected:
-	QStringList scamDataDesc;
-	QStringList sdescriptionDesc;
-
-	App app_p;
-	Global global_p;
-	Display display_p;
-	SlideShow slideShow_p;
-	Sync sync_p;
-	MetaData meta_p;
-	Resources resources_p;
-
-	App app_d;
-	Global global_d;
-	Display display_d;
-	SlideShow slideShow_d;
-	Sync sync_d;
-	MetaData meta_d;
-	Resources resources_d;
-
-	void init();
-
-	void applyDefaultsFromFile();
-	void copySettings(const QSettings& src, QSettings& dst) const;
-	QString getDefaultSettingsFile() const;
-
-	QString mSettingsPath;
+    QStringList scamDataDesc;
+    QStringList sdescriptionDesc;
+
+    App app_p;
+    Global global_p;
+    Display display_p;
+    SlideShow slideShow_p;
+    Sync sync_p;
+    MetaData meta_p;
+    Resources resources_p;
+
+    App app_d;
+    Global global_d;
+    Display display_d;
+    SlideShow slideShow_d;
+    Sync sync_d;
+    MetaData meta_d;
+    Resources resources_d;
+
+    void init();
+
+    void applyDefaultsFromFile();
+    void copySettings(const QSettings &src, QSettings &dst) const;
+    QString getDefaultSettingsFile() const;
+
+    QString mSettingsPath;
 };
 
-class DllCoreExport DkSettingsManager {
-
+class DllCoreExport DkSettingsManager
+{
 public:
-	static DkSettingsManager& instance();
-	~DkSettingsManager();
+    static DkSettingsManager &instance();
+    ~DkSettingsManager();
 
-	// singleton
-	DkSettingsManager(DkSettingsManager const&)		= delete;
-	void operator=(DkSettingsManager const&)		= delete;
+    // singleton
+    DkSettingsManager(DkSettingsManager const &) = delete;
+    void operator=(DkSettingsManager const &) = delete;
 
-	static DkSettings& param();		// convenience
-	//QSettings& qSettings();
-	DkSettings& settings();			// rename
-	void init();
+    static DkSettings &param(); // convenience
+    // QSettings& qSettings();
+    DkSettings &settings(); // rename
+    void init();
 
-	static void importSettings(const QString& settingsPath);
+    static void importSettings(const QString &settingsPath);
 
 private:
-	DkSettingsManager();
+    DkSettingsManager();
 
-	//QSettings* mSettings = 0;
-	DkSettings* mParams = 0;
+    // QSettings* mSettings = 0;
+    DkSettings *mParams = 0;
 };
 
-class DkZoomConfig {
-
+class DkZoomConfig
+{
 public:
-	static DkZoomConfig& instance();
-	~DkZoomConfig();
+    static DkZoomConfig &instance();
+    ~DkZoomConfig();
 
-	// singleton
-	DkZoomConfig(DkZoomConfig const&) = delete;
-	void operator=(DkZoomConfig const&) = delete;
+    // singleton
+    DkZoomConfig(DkZoomConfig const &) = delete;
+    void operator=(DkZoomConfig const &) = delete;
 
-	double nextFactor(double currentFactor, double delta) const;
-	QVector<double> defaultLevels() const;
+    double nextFactor(double currentFactor, double delta) const;
+    QVector<double> defaultLevels() const;
 
-	bool useLevels() const;
-	void setUseLevels(bool useLevels);
+    bool useLevels() const;
+    void setUseLevels(bool useLevels);
 
-	bool setLevels(const QString& levelStr);
-	QString levelsToString() const;
+    bool setLevels(const QString &levelStr);
+    QString levelsToString() const;
 
-	void setLevelsToDefault();
+    void setLevelsToDefault();
 
-	static bool checkLevels(const QVector<double>& levels);
+    static bool checkLevels(const QVector<double> &levels);
 
 private:
+    QVector<double> mLevels;
+    bool mUseLevels = false;
 
-	QVector<double> mLevels;
-	bool mUseLevels = false;
-
-	DkZoomConfig();
-	void loadSettings(QSettings& settings);
-	void saveSettings(QSettings& settings) const;
-
+    DkZoomConfig();
+    void loadSettings(QSettings &settings);
+    void saveSettings(QSettings &settings) const;
 };
 
 }
diff --git a/ImageLounge/src/DkCore/DkStatusBar.cpp b/ImageLounge/src/DkCore/DkStatusBar.cpp
index f5bfd86..43e3a64 100644
--- a/ImageLounge/src/DkCore/DkStatusBar.cpp
+++ b/ImageLounge/src/DkCore/DkStatusBar.cpp
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkStatusBar.cpp
  Created on:	12.01.2016
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2016 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2016 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2016 Florian Kleber <florian@nomacs.org>
@@ -27,79 +27,83 @@
 
 #include "DkStatusBar.h"
 
-#include "DkSettings.h"
 #include "DkActionManager.h"
+#include "DkSettings.h"
 
-#pragma warning(push, 0)	// no warnings from includes - begin
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QLabel>
-#pragma warning(pop)		// no warnings from includes - end
+#pragma warning(pop) // no warnings from includes - end
 
-namespace nmc {
+namespace nmc
+{
 
-DkStatusBar::DkStatusBar(QWidget* parent) : QStatusBar(parent) {
-	createLayout();
+DkStatusBar::DkStatusBar(QWidget *parent)
+    : QStatusBar(parent)
+{
+    createLayout();
 }
 
-void DkStatusBar::createLayout() {
-
-	mLabels.resize(status_end);
-	setObjectName("DkStatusBar");
+void DkStatusBar::createLayout()
+{
+    mLabels.resize(status_end);
+    setObjectName("DkStatusBar");
 
-	for (int idx = 0; idx < mLabels.size(); idx++) {
-		mLabels[idx] = new QLabel(this);
-		mLabels[idx]->setObjectName("statusBarLabel");
-		mLabels[idx]->hide();
+    for (int idx = 0; idx < mLabels.size(); idx++) {
+        mLabels[idx] = new QLabel(this);
+        mLabels[idx]->setObjectName("statusBarLabel");
+        mLabels[idx]->hide();
 
-		if (idx == 0) {
-			//mLabels[idx]->setToolTip(tr("CTRL activates the crosshair cursor"));
-			addWidget(mLabels[idx]);
-		}
-		else
-			addPermanentWidget(mLabels[idx]);
-	}
+        if (idx == 0) {
+            // mLabels[idx]->setToolTip(tr("CTRL activates the crosshair cursor"));
+            addWidget(mLabels[idx]);
+        } else
+            addPermanentWidget(mLabels[idx]);
+    }
 
-	hide();
+    hide();
 }
 
-void DkStatusBar::setMessage(const QString& msg, StatusLabel which) {
+void DkStatusBar::setMessage(const QString &msg, StatusLabel which)
+{
+    if (which < 0 || which >= mLabels.size())
+        return;
 
-	if (which < 0 || which >= mLabels.size())
-		return;
-
-	mLabels[which]->setVisible(!msg.isEmpty());
-	mLabels[which]->setText(msg);
+    mLabels[which]->setVisible(!msg.isEmpty());
+    mLabels[which]->setText(msg);
 }
 
 // DkStatusBarManager --------------------------------------------------------------------
-DkStatusBarManager::DkStatusBarManager() {
-
-	mStatusBar = new DkStatusBar();
+DkStatusBarManager::DkStatusBarManager()
+{
+    mStatusBar = new DkStatusBar();
 }
 
-DkStatusBarManager& DkStatusBarManager::instance() {
-
-	static DkStatusBarManager inst;
-	return inst;
+DkStatusBarManager &DkStatusBarManager::instance()
+{
+    static DkStatusBarManager inst;
+    return inst;
 }
 
-void DkStatusBarManager::setMessage(const QString& msg, DkStatusBar::StatusLabel which) {
-	mStatusBar->setMessage(msg, which);
+void DkStatusBarManager::setMessage(const QString &msg, DkStatusBar::StatusLabel which)
+{
+    mStatusBar->setMessage(msg, which);
 }
 
-void DkStatusBarManager::show(bool show, bool permanent) {
-
-	if (statusbar()->isVisible() == show)
-		return;
+void DkStatusBarManager::show(bool show, bool permanent)
+{
+    if (statusbar()->isVisible() == show)
+        return;
 
-	if (permanent)
-		DkSettingsManager::param().app().showStatusBar = show;
-	DkActionManager::instance().action(DkActionManager::menu_panel_statusbar)->setChecked(DkSettingsManager::param().app().showStatusBar);
+    if (permanent)
+        DkSettingsManager::param().app().showStatusBar = show;
+    DkActionManager::instance().action(DkActionManager::menu_panel_statusbar)->setChecked(DkSettingsManager::param().app().showStatusBar);
 
-	statusbar()->setVisible(show);
+    statusbar()->setVisible(show);
 }
 
-DkStatusBar* DkStatusBarManager::statusbar() {
-	return mStatusBar;
+DkStatusBar *DkStatusBarManager::statusbar()
+{
+    return mStatusBar;
 }
 
 }
diff --git a/ImageLounge/src/DkCore/DkStatusBar.h b/ImageLounge/src/DkCore/DkStatusBar.h
index 81a47da..1ba9d61 100644
--- a/ImageLounge/src/DkCore/DkStatusBar.h
+++ b/ImageLounge/src/DkCore/DkStatusBar.h
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkStatusBar.h
  Created on:	12.01.2016
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2016 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2016 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2016 Florian Kleber <florian@nomacs.org>
@@ -27,11 +27,11 @@
 
 #pragma once
 
-#pragma warning(push, 0)	// no warnings from includes - begin
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QStatusBar>
 #pragma warning(pop)
 
-#pragma warning(disable: 4251)	// TODO: remove
+#pragma warning(disable : 4251) // TODO: remove
 
 #ifndef DllCoreExport
 #ifdef DK_CORE_DLL_EXPORT
@@ -46,56 +46,56 @@
 // Qt defines
 class QLabel;
 
-namespace nmc {
-
+namespace nmc
+{
 
-class DllCoreExport DkStatusBar : public QStatusBar {
-	Q_OBJECT
+class DllCoreExport DkStatusBar : public QStatusBar
+{
+    Q_OBJECT
 
 public:
-	DkStatusBar(QWidget* parent = 0);
-	~DkStatusBar() {};
+    DkStatusBar(QWidget *parent = 0);
+    ~DkStatusBar(){};
 
-	enum StatusLabel {
-		status_pixel_info,	// the first is special (left)
+    enum StatusLabel {
+        status_pixel_info, // the first is special (left)
 
-		status_file_info,
-		status_dimension_info,
-		status_format_info,
-		status_zoom_info,
-		status_filenumber_info,
-		status_filesize_info,
-		status_time_info,
+        status_file_info,
+        status_dimension_info,
+        status_format_info,
+        status_zoom_info,
+        status_filenumber_info,
+        status_filesize_info,
+        status_time_info,
 
-		status_end,
-	};
+        status_end,
+    };
 
-	void setMessage(const QString& msg, StatusLabel which = status_pixel_info);
+    void setMessage(const QString &msg, StatusLabel which = status_pixel_info);
 
 protected:
+    void createLayout();
 
-	void createLayout();
-
-	QVector<QLabel*> mLabels;
+    QVector<QLabel *> mLabels;
 };
 
-class DllCoreExport DkStatusBarManager {
-
+class DllCoreExport DkStatusBarManager
+{
 public:
-	static DkStatusBarManager& instance();
+    static DkStatusBarManager &instance();
 
-	// singleton
-	DkStatusBarManager(DkStatusBarManager const&)   = delete;
-	void operator=(DkStatusBarManager const&)		= delete;
+    // singleton
+    DkStatusBarManager(DkStatusBarManager const &) = delete;
+    void operator=(DkStatusBarManager const &) = delete;
 
-	void show(bool show, bool permanent = true);
-	DkStatusBar* statusbar();
-	void setMessage(const QString& msg, DkStatusBar::StatusLabel which = DkStatusBar::status_pixel_info);
+    void show(bool show, bool permanent = true);
+    DkStatusBar *statusbar();
+    void setMessage(const QString &msg, DkStatusBar::StatusLabel which = DkStatusBar::status_pixel_info);
 
 private:
-	DkStatusBarManager();
+    DkStatusBarManager();
 
-	DkStatusBar* mStatusBar = 0;
+    DkStatusBar *mStatusBar = 0;
 };
 
 }
diff --git a/ImageLounge/src/DkCore/DkThumbs.cpp b/ImageLounge/src/DkCore/DkThumbs.cpp
index af79347..c29dbbf 100644
--- a/ImageLounge/src/DkCore/DkThumbs.cpp
+++ b/ImageLounge/src/DkCore/DkThumbs.cpp
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkThumbs.cpp
  Created on:	19.04.2013
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -26,50 +26,54 @@
  *******************************************************************************************************/
 
 #include "DkThumbs.h"
-#include "DkTimer.h"
-#include "DkSettings.h"
-#include "DkImageStorage.h"
 #include "DkBasicLoader.h"
+#include "DkImageStorage.h"
 #include "DkMetaData.h"
+#include "DkSettings.h"
+#include "DkTimer.h"
 #include "DkUtils.h"
 
-#pragma warning(push, 0)	// no warnings from includes - begin
+#pragma warning(push, 0) // no warnings from includes - begin
+#include <QBuffer>
 #include <QFileInfo>
-#include <QStringList>
-#include <QMutex>
 #include <QImageReader>
-#include <QtConcurrentRun>
-#include <QTimer>
-#include <QBuffer>
+#include <QMutex>
+#include <QStringList>
 #include <QThreadPool>
-#pragma warning(pop)		// no warnings from includes - end
+#include <QTimer>
+#include <QtConcurrentRun>
+#pragma warning(pop) // no warnings from includes - end
 
-namespace nmc {
+namespace nmc
+{
 
 /**
-* Default constructor.
-* @param file the corresponding file
-* @param img the thumbnail image
-**/ 
-DkThumbNail::DkThumbNail(const QString& filePath, const QImage& img) {
-	mImg = DkImage::createThumb(img);
-	mFile = filePath;
-	mMaxThumbSize = qRound(max_thumb_size * DkSettingsManager::param().dpiScaleFactor());
-	mImgExists = true;
+ * Default constructor.
+ * @param file the corresponding file
+ * @param img the thumbnail image
+ **/
+DkThumbNail::DkThumbNail(const QString &filePath, const QImage &img)
+{
+    mImg = DkImage::createThumb(img);
+    mFile = filePath;
+    mMaxThumbSize = qRound(max_thumb_size * DkSettingsManager::param().dpiScaleFactor());
+    mImgExists = true;
 }
 
-DkThumbNail::~DkThumbNail() {}
+DkThumbNail::~DkThumbNail()
+{
+}
 
 /**
  * Loads the thumbnail.
  * @param forceLoad flag for loading/saving the thumbnail from exif only.
- **/ 
-void DkThumbNail::compute(int forceLoad) {
-
-	// this is so complicated to be thread-safe
-	// if we use member vars in the thread and the object gets deleted during thread execution we crash...
-	mImg = computeIntern(mFile, QSharedPointer<QByteArray>(), forceLoad, mMaxThumbSize);
-	mImg = DkImage::createThumb(mImg);
+ **/
+void DkThumbNail::compute(int forceLoad)
+{
+    // this is so complicated to be thread-safe
+    // if we use member vars in the thread and the object gets deleted during thread execution we crash...
+    mImg = computeIntern(mFile, QSharedPointer<QByteArray>(), forceLoad, mMaxThumbSize);
+    mImg = DkImage::createThumb(mImg);
 }
 
 /**
@@ -83,306 +87,281 @@ void DkThumbNail::compute(int forceLoad) {
  * @param minThumbSize the minimal thumbnail size to be loaded
  * @return QImage the loaded image. Null if no image
  * could be loaded at all.
- **/ 
-QImage DkThumbNail::computeIntern(const QString& filePath, const QSharedPointer<QByteArray> ba, 
-								  int forceLoad, int maxThumbSize) {
-	
-	DkTimer dt;
-	//qDebug() << "[thumb] file: " << filePath;
-
-	// see if we can read the thumbnail from the exif data
-	QImage thumb;
-	DkMetaDataT metaData;
-
-	QSharedPointer<QByteArray> baZip = QSharedPointer<QByteArray>();
+ **/
+QImage DkThumbNail::computeIntern(const QString &filePath, const QSharedPointer<QByteArray> ba, int forceLoad, int maxThumbSize)
+{
+    DkTimer dt;
+    // qDebug() << "[thumb] file: " << filePath;
+
+    // see if we can read the thumbnail from the exif data
+    QImage thumb;
+    DkMetaDataT metaData;
+
+    QSharedPointer<QByteArray> baZip = QSharedPointer<QByteArray>();
 #ifdef WITH_QUAZIP
-	if (QFileInfo(mFile).dir().path().contains(DkZipContainer::zipMarker())) 
-		baZip = DkZipContainer::extractImage(DkZipContainer::decodeZipFile(filePath), DkZipContainer::decodeImageFile(filePath));
+    if (QFileInfo(mFile).dir().path().contains(DkZipContainer::zipMarker()))
+        baZip = DkZipContainer::extractImage(DkZipContainer::decodeZipFile(filePath), DkZipContainer::decodeImageFile(filePath));
 #endif
-	try {
-		// [DIEM] READ  build crashed here 09.06.2016
-		if (baZip && !baZip->isEmpty())	
-			metaData.readMetaData(filePath, baZip);
-		else if (!ba || ba->isEmpty())
-			metaData.readMetaData(filePath);
-		else
-			metaData.readMetaData(filePath, ba);
-
-		// read the full image if we want to create new thumbnails
-		if (forceLoad != force_save_thumb)
-			thumb = metaData.getThumbnail();
-	}
-	catch(...) {
-		// do nothing - we'll load the full file
-	}
-	removeBlackBorder(thumb);
-
-	bool exifThumb = !thumb.isNull();
-
-	QFileInfo fInfo(filePath);
-	QString lFilePath = fInfo.isSymLink() ? fInfo.symLinkTarget() : filePath;
-	fInfo = lFilePath;
-
-	// diem: do_not_force is the generic load - so also rescale these
-	bool rescale = forceLoad == do_not_force;
-
-	if ((forceLoad != force_exif_thumb || fInfo.size() < 1e5) &&
-		(thumb.isNull() ||
-		 forceLoad == force_full_thumb ||
-		 forceLoad == force_save_thumb)) { // braces
-
-		// try to read the image
-		DkBasicLoader loader;
-
-		if (baZip && !baZip->isEmpty()) {
-			if (loader.loadGeneral(lFilePath, baZip, true, true))
-				thumb = loader.image();
-		}
-		else {
-			if (loader.loadGeneral(lFilePath, ba, true, true))
-				thumb = loader.image();
-		}
-	}
-
-	if (thumb.isNull() && forceLoad == force_exif_thumb)
-		return QImage();
-
-	// the image is not scaled correctly yet
-	if (rescale && !thumb.isNull()) {
-
-		int w = thumb.width();
-		int h = thumb.height();
-
-		if (w > maxThumbSize || h > maxThumbSize) {
-			if (w > h) {
-				h = qRound((double)maxThumbSize / w * h);
-				w = maxThumbSize;
-			} 
-			else if (w < h) {
-				w = qRound((double)maxThumbSize / h * w);
-				h = maxThumbSize;
-			}
-			else {
-				w = maxThumbSize;
-				h = maxThumbSize;
-			}
-		}
-
-		// scale
-		thumb = thumb.scaled(QSize(w*2, h*2), Qt::KeepAspectRatio, Qt::FastTransformation);
-		thumb = thumb.scaled(QSize(w, h), Qt::KeepAspectRatio, Qt::SmoothTransformation);
-	}
-
-	int orientation = metaData.getOrientationDegree();
-
-	if (orientation != -1 && orientation != 0 && (metaData.isJpg() || metaData.isRaw())) {
-		QTransform rotationMatrix;
-		rotationMatrix.rotate((double)orientation);
-		thumb = thumb.transformed(rotationMatrix);
-	}
-
-	// save the thumbnail if the caller either forces it, or the save thumb is requested and the image did not have any before
-	if (forceLoad == force_save_thumb || (forceLoad == save_thumb && !exifThumb)) {
-		
-		try {
-
-			QImage sThumb = thumb.copy();
-			if (orientation != -1 && orientation != 0) {
-				QTransform rotationMatrix;
-				rotationMatrix.rotate(-(double)orientation);
-				sThumb = sThumb.transformed(rotationMatrix);
-			}
-
-			metaData.updateImageMetaData(sThumb);
-
-			if (!ba || ba->isEmpty())
-				metaData.saveMetaData(lFilePath);
-			else
-				metaData.saveMetaData(lFilePath, ba);
-
-			qDebug() << "[thumb] saved to exif data";
-		}
-		catch(...) {
-			qWarning() << "Sorry, I could not save the metadata";
-		}
-	}
-	// if (!thumb.isNull())
-	// 	qInfoClean() << "[thumb] " << fInfo.fileName() << " (" << thumb.width() << " x " << thumb.height() << ") loaded in " << dt << ((exifThumb) ? " from EXIV" : " from File");
-
-	return thumb;
+    try {
+        // [DIEM] READ  build crashed here 09.06.2016
+        if (baZip && !baZip->isEmpty())
+            metaData.readMetaData(filePath, baZip);
+        else if (!ba || ba->isEmpty())
+            metaData.readMetaData(filePath);
+        else
+            metaData.readMetaData(filePath, ba);
+
+        // read the full image if we want to create new thumbnails
+        if (forceLoad != force_save_thumb)
+            thumb = metaData.getThumbnail();
+    } catch (...) {
+        // do nothing - we'll load the full file
+    }
+    removeBlackBorder(thumb);
+
+    bool exifThumb = !thumb.isNull();
+    int orientation = metaData.getOrientationDegree();
+
+    if (exifThumb && (metaData.isAVIF() || metaData.isHEIF() || metaData.isJXL()) && orientation != -1 && orientation != 0) {
+        // do not rotate together with full image but rotate Exif thumb only
+        QTransform rotationMatrix;
+        rotationMatrix.rotate((double)orientation);
+        thumb = thumb.transformed(rotationMatrix);
+    }
+
+    QFileInfo fInfo(filePath);
+    QString lFilePath = fInfo.isSymLink() ? fInfo.symLinkTarget() : filePath;
+    fInfo = lFilePath;
+
+    // diem: do_not_force is the generic load - so also rescale these
+    bool rescale = forceLoad == do_not_force;
+
+    if ((forceLoad != force_exif_thumb || fInfo.size() < 1e5) && (thumb.isNull() || forceLoad == force_full_thumb || forceLoad == force_save_thumb)) { // braces
+
+        // try to read the image
+        DkBasicLoader loader;
+
+        if (baZip && !baZip->isEmpty()) {
+            if (loader.loadGeneral(lFilePath, baZip, true, true))
+                thumb = loader.image();
+        } else {
+            if (loader.loadGeneral(lFilePath, ba, true, true))
+                thumb = loader.image();
+        }
+    }
+
+    if (thumb.isNull() && forceLoad == force_exif_thumb)
+        return QImage();
+
+    // the image is not scaled correctly yet
+    if (rescale && !thumb.isNull()) {
+        int w = thumb.width();
+        int h = thumb.height();
+
+        if (w > maxThumbSize || h > maxThumbSize) {
+            if (w > h) {
+                h = qRound((double)maxThumbSize / w * h);
+                w = maxThumbSize;
+            } else if (w < h) {
+                w = qRound((double)maxThumbSize / h * w);
+                h = maxThumbSize;
+            } else {
+                w = maxThumbSize;
+                h = maxThumbSize;
+            }
+        }
+
+        // scale
+        thumb = thumb.scaled(QSize(w * 2, h * 2), Qt::KeepAspectRatio, Qt::FastTransformation);
+        thumb = thumb.scaled(QSize(w, h), Qt::KeepAspectRatio, Qt::SmoothTransformation);
+    }
+
+    if (orientation != -1 && orientation != 0 && (metaData.isJpg() || metaData.isRaw())) {
+        QTransform rotationMatrix;
+        rotationMatrix.rotate((double)orientation);
+        thumb = thumb.transformed(rotationMatrix);
+    }
+
+    // save the thumbnail if the caller either forces it, or the save thumb is requested and the image did not have any before
+    if (forceLoad == force_save_thumb || (forceLoad == save_thumb && !exifThumb)) {
+        try {
+            QImage sThumb = thumb.copy();
+            if (orientation != -1 && orientation != 0) {
+                QTransform rotationMatrix;
+                rotationMatrix.rotate(-(double)orientation);
+                sThumb = sThumb.transformed(rotationMatrix);
+            }
+
+            metaData.updateImageMetaData(sThumb);
+
+            if (!ba || ba->isEmpty())
+                metaData.saveMetaData(lFilePath);
+            else
+                metaData.saveMetaData(lFilePath, ba);
+
+            qDebug() << "[thumb] saved to exif data";
+        } catch (...) {
+            qWarning() << "Sorry, I could not save the metadata";
+        }
+    }
+    // if (!thumb.isNull())
+    // 	qInfoClean() << "[thumb] " << fInfo.fileName() << " (" << thumb.width() << " x " << thumb.height() << ") loaded in " << dt << ((exifThumb) ? " from
+    // EXIV" : " from File");
+
+    return thumb;
 }
 
 /**
  * Removes potential black borders.
  * These borders can be found e.g. in Nikon One images (16:9 vs 4:3)
  * @param img the image whose borders are removed.
- **/ 
-void DkThumbNail::removeBlackBorder(QImage& img) {
-
-	int rIdx = 0;
-	bool nonblack = false;
-	
-	for ( ; rIdx < qRound(img.height()*0.1); rIdx++) {
-
-		const QRgb* pixel = (QRgb*)(img.constScanLine(rIdx));
-
-		for (int cIdx = 0; cIdx < img.width(); cIdx++, pixel++) {
-
-			// > 50 due to jpeg (normally we would want it to be != 0)
-			if (qRed(*pixel) > 50 || qBlue(*pixel) > 50 || qGreen(*pixel) > 50) {
-				nonblack = true;
-				break;
-			}
-		}
-
-		if (nonblack)
-			break;
-	}
-
-	// non black border?
-	if (rIdx == -1 || rIdx > 15)
-		return;
-
-	int rIdxB = img.height()-1;
-	nonblack = false;
-
-	for ( ; rIdxB >= qRound(img.height()*0.9f); rIdxB--) {
-
-		const QRgb* pixel = (QRgb*)(img.constScanLine(rIdxB));
-
-		for (int cIdx = 0; cIdx < img.width(); cIdx++, pixel++) {
-
-			if (qRed(*pixel) > 50 || qBlue(*pixel) > 50 || qGreen(*pixel) > 50) {
-				nonblack = true;
-				break;
-			}
-		}
-
-		if (nonblack) {
-			rIdxB--;
-			break;
-		}
-	}
-
-	// remove black borders
-	if (rIdx < rIdxB)
-		img = img.copy(0, rIdx, img.width(), rIdxB-rIdx);
-
+ **/
+void DkThumbNail::removeBlackBorder(QImage &img)
+{
+    int rIdx = 0;
+    bool nonblack = false;
+
+    for (; rIdx < qRound(img.height() * 0.1); rIdx++) {
+        const QRgb *pixel = (QRgb *)(img.constScanLine(rIdx));
+
+        for (int cIdx = 0; cIdx < img.width(); cIdx++, pixel++) {
+            // > 50 due to jpeg (normally we would want it to be != 0)
+            if (qRed(*pixel) > 50 || qBlue(*pixel) > 50 || qGreen(*pixel) > 50) {
+                nonblack = true;
+                break;
+            }
+        }
+
+        if (nonblack)
+            break;
+    }
+
+    // non black border?
+    if (rIdx == -1 || rIdx > 15)
+        return;
+
+    int rIdxB = img.height() - 1;
+    nonblack = false;
+
+    for (; rIdxB >= qRound(img.height() * 0.9f); rIdxB--) {
+        const QRgb *pixel = (QRgb *)(img.constScanLine(rIdxB));
+
+        for (int cIdx = 0; cIdx < img.width(); cIdx++, pixel++) {
+            if (qRed(*pixel) > 50 || qBlue(*pixel) > 50 || qGreen(*pixel) > 50) {
+                nonblack = true;
+                break;
+            }
+        }
+
+        if (nonblack) {
+            rIdxB--;
+            break;
+        }
+    }
+
+    // remove black borders
+    if (rIdx < rIdxB)
+        img = img.copy(0, rIdx, img.width(), rIdxB - rIdx);
 }
 
 /**
  * Creates a thumbnail from the image provided and stores it internally.
  * @param img the image to be converted to a thumbnail
- **/ 
-void DkThumbNail::setImage(const QImage img) {
-	
-	mImg = DkImage::createThumb(img);
+ **/
+void DkThumbNail::setImage(const QImage img)
+{
+    mImg = DkImage::createThumb(img);
 }
 
 /**
  * This class provides threaded access to image thumbnails.
  * @param file the thumbnail's file
  * @param img optional: a thumb image.
- **/ 
-DkThumbNailT::DkThumbNailT(const QString& filePath, const QImage& img) : DkThumbNail(filePath, img) {
-
-	mFetching = false;
-	mForceLoad = do_not_force;
+ **/
+DkThumbNailT::DkThumbNailT(const QString &filePath, const QImage &img)
+    : DkThumbNail(filePath, img)
+{
+    mFetching = false;
+    mForceLoad = do_not_force;
 }
 
-DkThumbNailT::~DkThumbNailT() {
-
-	mThumbWatcher.blockSignals(true);
-	mThumbWatcher.cancel();
+DkThumbNailT::~DkThumbNailT()
+{
+    mThumbWatcher.blockSignals(true);
+    mThumbWatcher.cancel();
 }
 
-bool DkThumbNailT::fetchThumb(int forceLoad /* = false */,  QSharedPointer<QByteArray> ba) {
+bool DkThumbNailT::fetchThumb(int forceLoad /* = false */, QSharedPointer<QByteArray> ba)
+{
+    if (forceLoad == force_full_thumb || forceLoad == force_save_thumb || forceLoad == save_thumb)
+        mImg = QImage();
 
-	if (forceLoad == force_full_thumb || forceLoad == force_save_thumb || forceLoad == save_thumb)
-		mImg = QImage();
+    if (!mImg.isNull() || !mImgExists || mFetching)
+        return false;
 
-	if (!mImg.isNull() || !mImgExists || mFetching)
-		return false;
+    // check if we can load the file
+    // though if it might seem over engineered: it is much faster cascading it here
+    if (!DkUtils::hasValidSuffix(getFilePath()) && !QFileInfo(getFilePath()).suffix().isEmpty() && !DkUtils::isValid(getFilePath()))
+        return false;
 
-	// check if we can load the file
-	// though if it might seem over engineered: it is much faster cascading it here
-	if (!DkUtils::hasValidSuffix(getFilePath()) && 
-		!QFileInfo(getFilePath()).suffix().isEmpty() &&
-		!DkUtils::isValid(getFilePath()))
-		return false;
+    // we have to do our own bool here
+    // watcher.isRunning() returns false if the thread is waiting in the pool
+    mFetching = true;
+    mForceLoad = forceLoad;
 
-	// we have to do our own bool here
-	// watcher.isRunning() returns false if the thread is waiting in the pool
-	mFetching = true;
-	mForceLoad = forceLoad;
+    connect(&mThumbWatcher, SIGNAL(finished()), this, SLOT(thumbLoaded()), Qt::UniqueConnection);
 
-	connect(&mThumbWatcher, SIGNAL(finished()), this, SLOT(thumbLoaded()), Qt::UniqueConnection);
+    mThumbWatcher.setFuture(QtConcurrent::run(DkThumbsThreadPool::pool(), // load thumbnails on their dedicated pool
+                                              this,
+                                              &nmc::DkThumbNailT::computeCall,
+                                              mFile,
+                                              ba,
+                                              forceLoad,
+                                              mMaxThumbSize));
 
-	mThumbWatcher.setFuture(QtConcurrent::run(
-#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
-		DkThumbsThreadPool::pool(),		// load thumbnails on their dedicated pool
-#endif
-		this, 
-		&nmc::DkThumbNailT::computeCall, 
-		mFile, 
-		ba, 
-		forceLoad, 
-		mMaxThumbSize));
-
-	return true;
+    return true;
 }
 
-
-QImage DkThumbNailT::computeCall(const QString& filePath, QSharedPointer<QByteArray> ba, int forceLoad, int maxThumbSize) {
-
-	QImage thumb = DkThumbNail::computeIntern(filePath, ba, forceLoad, maxThumbSize);
-	return DkImage::createThumb(thumb);
+QImage DkThumbNailT::computeCall(const QString &filePath, QSharedPointer<QByteArray> ba, int forceLoad, int maxThumbSize)
+{
+    QImage thumb = DkThumbNail::computeIntern(filePath, ba, forceLoad, maxThumbSize);
+    return DkImage::createThumb(thumb);
 }
 
-void DkThumbNailT::thumbLoaded() {
-	
-	QFuture<QImage> future = mThumbWatcher.future();
+void DkThumbNailT::thumbLoaded()
+{
+    QFuture<QImage> future = mThumbWatcher.future();
+
+    mImg = future.result();
 
-	mImg = future.result();
-	
-	if (mImg.isNull() && mForceLoad != force_exif_thumb)
-		mImgExists = false;
+    if (mImg.isNull() && mForceLoad != force_exif_thumb)
+        mImgExists = false;
 
-	mFetching = false;
-	emit thumbLoadedSignal(!mImg.isNull());
+    mFetching = false;
+    emit thumbLoadedSignal(!mImg.isNull());
 }
 
 // DkThumbsThreadPool --------------------------------------------------------------------
-DkThumbsThreadPool::DkThumbsThreadPool() {
-	
-#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
-	mPool = new QThreadPool();
-	mPool->setMaxThreadCount(qMax(mPool->maxThreadCount() - 2, 1));
-#endif
+DkThumbsThreadPool::DkThumbsThreadPool()
+{
+    mPool = new QThreadPool();
+    mPool->setMaxThreadCount(qMax(mPool->maxThreadCount() - 2, 1));
 }
 
-DkThumbsThreadPool& DkThumbsThreadPool::instance() {
-
-	static DkThumbsThreadPool inst;
-	return inst;
+DkThumbsThreadPool &DkThumbsThreadPool::instance()
+{
+    static DkThumbsThreadPool inst;
+    return inst;
 }
 
-QThreadPool* DkThumbsThreadPool::pool() {
-	
-#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
-	return instance().mPool;
-#else
-	return QThreadPool::globalInstance();
-#endif
+QThreadPool *DkThumbsThreadPool::pool()
+{
+    return instance().mPool;
 }
 
-void DkThumbsThreadPool::clear() {
-
-#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
-	pool()->clear();
-#endif
-
+void DkThumbsThreadPool::clear()
+{
+    pool()->clear();
 }
 
-
 }
diff --git a/ImageLounge/src/DkCore/DkThumbs.h b/ImageLounge/src/DkCore/DkThumbs.h
index 73d3731..d352ee3 100644
--- a/ImageLounge/src/DkCore/DkThumbs.h
+++ b/ImageLounge/src/DkCore/DkThumbs.h
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkThumbs.h
  Created on:	19.04.2013
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -27,16 +27,16 @@
 
 #pragma once
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QFutureWatcher>
-#include <QSharedPointer>
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QColor>
 #include <QDir>
-#include <QThread>
+#include <QFutureWatcher>
 #include <QImage>
-#pragma warning(pop)		// no warnings from includes - end
+#include <QSharedPointer>
+#include <QThread>
+#pragma warning(pop) // no warnings from includes - end
 
-#pragma warning(disable: 4251)	// TODO: remove
+#pragma warning(disable : 4251) // TODO: remove
 
 #ifndef DllCoreExport
 #ifdef DK_CORE_DLL_EXPORT
@@ -50,170 +50,176 @@
 
 class QThreadPool;
 
-namespace nmc {
+namespace nmc
+{
 
 #define max_thumb_size 400
 
 /**
  * This class holds thumbnails.
- **/ 
-class DllCoreExport DkThumbNail {
-
+ **/
+class DllCoreExport DkThumbNail
+{
 public:
-	enum {
-		loading = -2,
-		exists_not = -1,
-		not_loaded,
-		loaded,
-	};
-	
-	/**
-	 * Default constructor.
-	 * @param file the corresponding file
-	 * @param img the thumbnail image
-	 **/ 
-	DkThumbNail(const QString& filePath = QString(), const QImage& img = QImage());
-
-	/**
-	 * Default destructor.
-	 * @return 
-	 **/ 
-	virtual ~DkThumbNail();
-
-	friend bool operator==(const DkThumbNail& lt, const DkThumbNail& rt) {
-
-		return lt.mFile == rt.mFile;
-	};
-
-	/**
-	 * Sets the thumbnail image.
-	 * @param img the thumbnail
-	 **/ 
-	virtual void setImage(const QImage img);
-
-	void removeBlackBorder(QImage& img);
-
-	/**
-	 * Returns the thumbnail.
-	 * @return QImage the thumbnail.
-	 **/ 
-	QImage getImage() const {
-		
-		return mImg;
-	};
-
-	/**
-	 * Returns the file information.
-	 * @return QFileInfo the thumbnail file
-	 **/ 
-	QString getFilePath() const {
-		return mFile;
-	};
-
-	void compute(int forceLoad = do_not_force);
-
-	/**
-	 * Returns whether the thumbnail was loaded, or does not exist.
-	 * @return int a status (loaded | not loaded | exists not)
-	 **/ 
-	int hasImage() const {
-		
-		if (!mImg.isNull())
-			return loaded;
-		else if (mImg.isNull() && mImgExists)
-			return not_loaded;
-		else
-			return exists_not;
-	};
-
-	void setMaxThumbSize(int maxSize) {
-		mMaxThumbSize = maxSize;
-	};
-
-	int getMaxThumbSize() const {
-		return mMaxThumbSize;
-	};
-
-	/**
-	 * Manipulates the file loaded status.
-	 * @param exists a status (loaded | not loaded | exists not)
-	 **/ 
-	void setImgExists(bool exists) {
-		mImgExists = exists;
-	};
-
-	enum {
-		do_not_force,
-		force_exif_thumb,
-		force_full_thumb,
-		save_thumb,
-		force_save_thumb,
-	};
+    enum {
+        loading = -2,
+        exists_not = -1,
+        not_loaded,
+        loaded,
+    };
+
+    /**
+     * Default constructor.
+     * @param file the corresponding file
+     * @param img the thumbnail image
+     **/
+    DkThumbNail(const QString &filePath = QString(), const QImage &img = QImage());
+
+    /**
+     * Default destructor.
+     * @return
+     **/
+    virtual ~DkThumbNail();
+
+    friend bool operator==(const DkThumbNail &lt, const DkThumbNail &rt)
+    {
+        return lt.mFile == rt.mFile;
+    };
+
+    /**
+     * Sets the thumbnail image.
+     * @param img the thumbnail
+     **/
+    virtual void setImage(const QImage img);
+
+    void removeBlackBorder(QImage &img);
+
+    /**
+     * Returns the thumbnail.
+     * @return QImage the thumbnail.
+     **/
+    QImage getImage() const
+    {
+        return mImg;
+    };
+
+    /**
+     * Returns the file information.
+     * @return QFileInfo the thumbnail file
+     **/
+    QString getFilePath() const
+    {
+        return mFile;
+    };
+
+    void compute(int forceLoad = do_not_force);
+
+    /**
+     * Returns whether the thumbnail was loaded, or does not exist.
+     * @return int a status (loaded | not loaded | exists not)
+     **/
+    int hasImage() const
+    {
+        if (!mImg.isNull())
+            return loaded;
+        else if (mImg.isNull() && mImgExists)
+            return not_loaded;
+        else
+            return exists_not;
+    };
+
+    void setMaxThumbSize(int maxSize)
+    {
+        mMaxThumbSize = maxSize;
+    };
+
+    int getMaxThumbSize() const
+    {
+        return mMaxThumbSize;
+    };
+
+    /**
+     * Manipulates the file loaded status.
+     * @param exists a status (loaded | not loaded | exists not)
+     **/
+    void setImgExists(bool exists)
+    {
+        mImgExists = exists;
+    };
+
+    enum {
+        do_not_force,
+        force_exif_thumb,
+        force_full_thumb,
+        save_thumb,
+        force_save_thumb,
+    };
 
 protected:
-	QImage computeIntern(const QString& file, QSharedPointer<QByteArray> ba, int forceLoad, int maxThumbSize);
+    QImage computeIntern(const QString &file, QSharedPointer<QByteArray> ba, int forceLoad, int maxThumbSize);
 
-	QImage mImg;
-	QString mFile;
-	//int s;
-	bool mImgExists;
-	int mMaxThumbSize;
+    QImage mImg;
+    QString mFile;
+    // int s;
+    bool mImgExists;
+    int mMaxThumbSize;
 };
 
-class DllCoreExport DkThumbNailT : public QObject, public DkThumbNail {
-	Q_OBJECT
+class DllCoreExport DkThumbNailT : public QObject, public DkThumbNail
+{
+    Q_OBJECT
 
 public:
-	DkThumbNailT(const QString& mFile = QString(), const QImage& mImg = QImage());
-	~DkThumbNailT();
-
-	bool fetchThumb(int forceLoad = do_not_force, QSharedPointer<QByteArray> ba = QSharedPointer<QByteArray>());
-
-	/**
-	 * Returns whether the thumbnail was loaded, or does not exist.
-	 * @return int a status (loaded | not loaded | exists not | loading)
-	 **/ 
-	int hasImage() const {
-		
-		if (mThumbWatcher.isRunning())
-			return loading;
-		else
-			return DkThumbNail::hasImage();
-	};
-
-	void setImage(const QImage img) {
-		DkThumbNail::setImage(img);
-		emit thumbLoadedSignal(true);
-	};
+    DkThumbNailT(const QString &mFile = QString(), const QImage &mImg = QImage());
+    ~DkThumbNailT();
+
+    bool fetchThumb(int forceLoad = do_not_force, QSharedPointer<QByteArray> ba = QSharedPointer<QByteArray>());
+
+    /**
+     * Returns whether the thumbnail was loaded, or does not exist.
+     * @return int a status (loaded | not loaded | exists not | loading)
+     **/
+    int hasImage() const
+    {
+        if (mThumbWatcher.isRunning())
+            return loading;
+        else
+            return DkThumbNail::hasImage();
+    };
+
+    void setImage(const QImage img)
+    {
+        DkThumbNail::setImage(img);
+        emit thumbLoadedSignal(true);
+    };
 
 signals:
-	void thumbLoadedSignal(bool loaded = true);
+    void thumbLoadedSignal(bool loaded = true);
 
 protected slots:
-	void thumbLoaded();
+    void thumbLoaded();
 
 protected:
-	QImage computeCall(const QString& filePath, QSharedPointer<QByteArray> ba, int forceLoad, int maxThumbSize);
+    QImage computeCall(const QString &filePath, QSharedPointer<QByteArray> ba, int forceLoad, int maxThumbSize);
 
-	QFutureWatcher<QImage> mThumbWatcher;
-	bool mFetching;
-	int mForceLoad;
+    QFutureWatcher<QImage> mThumbWatcher;
+    bool mFetching;
+    int mForceLoad;
 };
 
-class DkThumbsThreadPool {
-
+class DkThumbsThreadPool
+{
 public:
-	static DkThumbsThreadPool& instance();
+    static DkThumbsThreadPool &instance();
 
-	static QThreadPool* pool();
-	static void clear();
+    static QThreadPool *pool();
+    static void clear();
 
 private:
-	DkThumbsThreadPool();
-	DkThumbsThreadPool(const DkThumbsThreadPool&);
+    DkThumbsThreadPool();
+    DkThumbsThreadPool(const DkThumbsThreadPool &);
 
-	QThreadPool* mPool;
+    QThreadPool *mPool;
 };
 
-
 }
diff --git a/ImageLounge/src/DkCore/DkTimer.cpp b/ImageLounge/src/DkCore/DkTimer.cpp
index 7b69378..e564bd1 100644
--- a/ImageLounge/src/DkCore/DkTimer.cpp
+++ b/ImageLounge/src/DkCore/DkTimer.cpp
@@ -27,100 +27,107 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 #include "DkTimer.h"
 
-#include "DkUtils.h"
 #include "DkMath.h"
 #include "DkTimer.h"
+#include "DkUtils.h"
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QString>
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QDebug>
+#include <QString>
 #include <qmath.h>
-#pragma warning(pop)		// no warnings from includes - end
+#pragma warning(pop) // no warnings from includes - end
 
-namespace nmc {
+namespace nmc
+{
 
 // DkTimer --------------------------------------------------------------------
 /**
-* Initializes the class and stops the clock.
-**/
-DkTimer::DkTimer() {
-	mTimer.start();
+ * Initializes the class and stops the clock.
+ **/
+DkTimer::DkTimer()
+{
+    mTimer.start();
 }
 
-QDataStream& operator<<(QDataStream& s, const DkTimer& t) {
-
-	// this makes the operator<< virtual (stroustrup)
-	return t.put(s);
+QDataStream &operator<<(QDataStream &s, const DkTimer &t)
+{
+    // this makes the operator<< virtual (stroustrup)
+    return t.put(s);
 }
 
-QDebug operator<<(QDebug d, const DkTimer& timer) {
-
-	d << qPrintable(timer.stringifyTime(timer.elapsed()));
-	return d;
+QDebug operator<<(QDebug d, const DkTimer &timer)
+{
+    d << qPrintable(timer.stringifyTime(timer.elapsed()));
+    return d;
 }
 
 /**
-* Returns a string with the total time interval.
-* The time interval is measured from the time,
-* the object was initialized.
-* @return the time in seconds or milliseconds.
-**/
-QString DkTimer::getTotal() const {
-
-	return qPrintable(stringifyTime(mTimer.elapsed()));
+ * Returns a string with the total time interval.
+ * The time interval is measured from the time,
+ * the object was initialized.
+ * @return the time in seconds or milliseconds.
+ **/
+QString DkTimer::getTotal() const
+{
+    return qPrintable(stringifyTime(mTimer.elapsed()));
 }
 
-QDataStream& DkTimer::put(QDataStream& s) const {
-
-	s << stringifyTime(mTimer.elapsed());
+QDataStream &DkTimer::put(QDataStream &s) const
+{
+    s << stringifyTime(mTimer.elapsed());
 
-	return s;
+    return s;
 }
 
 /**
-* Converts time to QString.
-* @param ct current time interval
-* @return QString the time interval as string
-**/ 
-QString DkTimer::stringifyTime(int ct) const {
-
-	if (ct < 2000)
-		return QString::number(ct) + " ms";
-
-	int v = qRound(ct / 1000.0);
-	int sec = v % 60;	v = qRound(v / 60.0);
-	int min = v % 60;	v = qRound(v / 60.0);
-	int h = v % 24;		v = qRound(v / 24.0);
-	int d = v;
-
-	QString ds = QString::number(d);
-	QString hs = QString::number(h);
-	QString mins = QString::number(min);
-	QString secs = QString::number(sec);
-
-	if (ct < 60000)
-		return secs + " sec";
-
-	if (min < 10)
-		mins = "0" + mins;
-	if (sec < 10)
-		secs = "0" + secs;
-	if (h < 10)
-		hs = "0" + hs;
-
-	if (ct < 3600000)
-		return mins + ":" + secs;
-	if (d == 0)
-		return hs + ":" + mins + ":" + secs;
-
-	return ds + "days" + hs + ":" + mins + ":" + secs;
+ * Converts time to QString.
+ * @param ct current time interval
+ * @return QString the time interval as string
+ **/
+QString DkTimer::stringifyTime(int ct) const
+{
+    if (ct < 2000)
+        return QString::number(ct) + " ms";
+
+    int v = qRound(ct / 1000.0);
+    int sec = v % 60;
+    v = qRound(v / 60.0);
+    int min = v % 60;
+    v = qRound(v / 60.0);
+    int h = v % 24;
+    v = qRound(v / 24.0);
+    int d = v;
+
+    QString ds = QString::number(d);
+    QString hs = QString::number(h);
+    QString mins = QString::number(min);
+    QString secs = QString::number(sec);
+
+    if (ct < 60000)
+        return secs + " sec";
+
+    if (min < 10)
+        mins = "0" + mins;
+    if (sec < 10)
+        secs = "0" + secs;
+    if (h < 10)
+        hs = "0" + hs;
+
+    if (ct < 3600000)
+        return mins + ":" + secs;
+    if (d == 0)
+        return hs + ":" + mins + ":" + secs;
+
+    return ds + "days" + hs + ":" + mins + ":" + secs;
 }
 
-void DkTimer::start() {
-	mTimer.restart();
+void DkTimer::start()
+{
+    mTimer.restart();
 }
 
-int DkTimer::elapsed() const {
-	return mTimer.elapsed();
+int DkTimer::elapsed() const
+{
+    return mTimer.elapsed();
 }
 }
\ No newline at end of file
diff --git a/ImageLounge/src/DkCore/DkTimer.h b/ImageLounge/src/DkCore/DkTimer.h
index ba28add..8253000 100644
--- a/ImageLounge/src/DkCore/DkTimer.h
+++ b/ImageLounge/src/DkCore/DkTimer.h
@@ -28,10 +28,10 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #pragma once
 #include <time.h>
 
-#pragma warning(push, 0)	// no warnings from includes - begin
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QObject>
 #include <QTime>
-#pragma warning(pop)		// no warnings from includes - end
+#pragma warning(pop) // no warnings from includes - end
 
 #ifndef DllCoreExport
 #ifdef DK_CORE_DLL_EXPORT
@@ -43,36 +43,38 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #endif
 #endif
 
-namespace nmc {
+namespace nmc
+{
 
 /**
  * A small class which measures the time.
  * This class is designed to measure the time of a method, especially
  * intervals and the total time can be measured.
  **/
-class DllCoreExport DkTimer : public QObject {
-	Q_OBJECT
+class DllCoreExport DkTimer : public QObject
+{
+    Q_OBJECT
 
 public:
-
-	/**
-	* Initializes the class and stops the clock.
-	**/
-	DkTimer();
-	virtual ~DkTimer() {}
-
-	friend DllCoreExport QDataStream& operator<<(QDataStream& s, const DkTimer& t);
-	friend DllCoreExport QDebug operator<< (QDebug d, const DkTimer &timer);
-
-	QString getTotal() const;
-	virtual QDataStream& put(QDataStream& s) const;
-	QString stringifyTime(int ct) const;
-	int elapsed() const;
-	void start();
+    /**
+     * Initializes the class and stops the clock.
+     **/
+    DkTimer();
+    virtual ~DkTimer()
+    {
+    }
+
+    friend DllCoreExport QDataStream &operator<<(QDataStream &s, const DkTimer &t);
+    friend DllCoreExport QDebug operator<<(QDebug d, const DkTimer &timer);
+
+    QString getTotal() const;
+    virtual QDataStream &put(QDataStream &s) const;
+    QString stringifyTime(int ct) const;
+    int elapsed() const;
+    void start();
 
 protected:
-
-	QTime mTimer;
+    QTime mTimer;
 };
 
 }
diff --git a/ImageLounge/src/DkCore/DkUpdater.cpp b/ImageLounge/src/DkCore/DkUpdater.cpp
index 382994b..b485c29 100644
--- a/ImageLounge/src/DkCore/DkUpdater.cpp
+++ b/ImageLounge/src/DkCore/DkUpdater.cpp
@@ -1,6 +1,6 @@
 /*******************************************************************************************************
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2016 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2016 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2016 Florian Kleber <florian@nomacs.org>
@@ -32,21 +32,22 @@
 #include "DkTimer.h"
 #include "DkUtils.h"
 
-#pragma warning(push, 0)	// no warnings from includes
-#include <QVector>
+#pragma warning(push, 0) // no warnings from includes
+#include <QApplication>
+#include <QCoreApplication>
 #include <QDebug>
-#include <QXmlStreamReader>
-#include <QNetworkProxyQuery>
+#include <QDir>
 #include <QFile>
-#include <QCoreApplication>
-#include <QMessageBox>
-#include <QApplication>
-#include <QPushButton>
 #include <QFileInfo>
+#include <QMessageBox>
 #include <QNetworkCookieJar>
-#include <QDir>
+#include <QNetworkProxyQuery>
 #include <QProcess>
+#include <QPushButton>
 #include <QStandardPaths>
+#include <QStringView>
+#include <QVector>
+#include <QXmlStreamReader>
 
 #ifdef Q_OS_WIN
 #include <windows.h>
@@ -54,477 +55,487 @@
 
 #pragma warning(pop)
 
-namespace nmc {
+namespace nmc
+{
 
 // DkPackage --------------------------------------------------------------------
-DkPackage::DkPackage(const QString& name, const QString& version) {
-	mName = name;
-	mVersion = version;
+DkPackage::DkPackage(const QString &name, const QString &version)
+{
+    mName = name;
+    mVersion = version;
 }
 
-bool DkPackage::isEmpty() const {
-	return mName.isEmpty();
+bool DkPackage::isEmpty() const
+{
+    return mName.isEmpty();
 }
 
-bool DkPackage::operator==(const DkPackage& o) const {
-
-	return mName == o.name();
+bool DkPackage::operator==(const DkPackage &o) const
+{
+    return mName == o.name();
 }
 
-QString DkPackage::version() const {
-	return mVersion;
+QString DkPackage::version() const
+{
+    return mVersion;
 }
 
-QString DkPackage::name() const {
-	return mName;
+QString DkPackage::name() const
+{
+    return mName;
 }
 
 // DkXmlUpdateChecker --------------------------------------------------------------------
-DkXmlUpdateChecker::DkXmlUpdateChecker() {
+DkXmlUpdateChecker::DkXmlUpdateChecker()
+{
 }
 
-QVector<DkPackage> DkXmlUpdateChecker::updatesAvailable(QXmlStreamReader& localXml, QXmlStreamReader& remoteXml) const {
-
-	QVector<DkPackage> localPackages = parse(localXml);
-	QVector<DkPackage> remotePackages = parse(remoteXml);
-	QVector<DkPackage> updatePackages;
-
-	for (const DkPackage& p : localPackages) {
+QVector<DkPackage> DkXmlUpdateChecker::updatesAvailable(QXmlStreamReader &localXml, QXmlStreamReader &remoteXml) const
+{
+    QVector<DkPackage> localPackages = parse(localXml);
+    QVector<DkPackage> remotePackages = parse(remoteXml);
+    QVector<DkPackage> updatePackages;
 
-		int idx = remotePackages.indexOf(p);
+    for (const DkPackage &p : localPackages) {
+        int idx = remotePackages.indexOf(p);
 
-		if (idx != -1) {
-			bool isEqual = remotePackages[idx].version() == p.version();
-			qDebug() << "checking" << p.name() << "v" << p.version();
+        if (idx != -1) {
+            bool isEqual = remotePackages[idx].version() == p.version();
+            qDebug() << "checking" << p.name() << "v" << p.version();
 
-			if (!isEqual)	// we assume that the remote is _always_ newer than the local version
-				updatePackages.append(remotePackages[idx]);
-			else
-				qDebug() << "up-to-date";
-		}
-		else
-			qDebug() << "I could not find" << p.name() << "in the repository";
-	}
+            if (!isEqual) // we assume that the remote is _always_ newer than the local version
+                updatePackages.append(remotePackages[idx]);
+            else
+                qDebug() << "up-to-date";
+        } else
+            qDebug() << "I could not find" << p.name() << "in the repository";
+    }
 
-	if (localPackages.empty() || remotePackages.empty())
-		qDebug() << "WARNING: I could not find any packages. local (" << localPackages.size() << ") remote (" << remotePackages.size() << ")";
+    if (localPackages.empty() || remotePackages.empty())
+        qDebug() << "WARNING: I could not find any packages. local (" << localPackages.size() << ") remote (" << remotePackages.size() << ")";
 
-	return updatePackages;
+    return updatePackages;
 }
 
-QVector<DkPackage> DkXmlUpdateChecker::parse(QXmlStreamReader& reader) const {
-
-	QVector<DkPackage> packages;
-	QString pName;
-
-	while (!reader.atEnd()) {
-
-		// e.g. <Name>nomacs</Name>
-		if (reader.tokenType() == QXmlStreamReader::StartElement && reader.qualifiedName() == "Name") {
-			reader.readNext();
-			pName = reader.text().toString();
-		}
-		// e.g. <Version>3.0.0-3</Version>
-		else if (reader.tokenType() == QXmlStreamReader::StartElement && reader.qualifiedName() == "Version") {
-			reader.readNext();
-
-			if (!pName.isEmpty()) {
-				packages.append(DkPackage(pName, reader.text().toString()));
-				pName = "";	// reset
-			}
-			else {
-				qWarning() << "version: " << reader.text().toString() << "without a valid package name detected";
-			}
-		}
-
-		reader.readNext();
-	}
-
-	return packages;
+QVector<DkPackage> DkXmlUpdateChecker::parse(QXmlStreamReader &reader) const
+{
+    QVector<DkPackage> packages;
+    QString pName;
+
+    while (!reader.atEnd()) {
+        // e.g. <Name>nomacs</Name>
+        if (reader.tokenType() == QXmlStreamReader::StartElement && reader.qualifiedName().toString() == "Name") {
+            reader.readNext();
+            pName = reader.text().toString();
+        }
+        // e.g. <Version>3.0.0-3</Version>
+        else if (reader.tokenType() == QXmlStreamReader::StartElement && reader.qualifiedName().toString() == "Version") {
+            reader.readNext();
+
+            if (!pName.isEmpty()) {
+                packages.append(DkPackage(pName, reader.text().toString()));
+                pName = ""; // reset
+            } else {
+                qWarning() << "version: " << reader.text().toString() << "without a valid package name detected";
+            }
+        }
+
+        reader.readNext();
+    }
+
+    return packages;
 }
 
 // DkUpdater  --------------------------------------------------------------------
-DkUpdater::DkUpdater(QObject* parent) : QObject(parent) {
-
-	silent = true;
-	mCookie = new QNetworkCookieJar(this);
-	mAccessManagerSetup.setCookieJar(mCookie);
-	connect(&mAccessManagerSetup, SIGNAL(finished(QNetworkReply*)), this, SLOT(downloadFinishedSlot(QNetworkReply*)));
-	mUpdateAborted = false;
+DkUpdater::DkUpdater(QObject *parent)
+    : QObject(parent)
+{
+    silent = true;
+    mCookie = new QNetworkCookieJar(this);
+    mAccessManagerSetup.setCookieJar(mCookie);
+    connect(&mAccessManagerSetup, SIGNAL(finished(QNetworkReply *)), this, SLOT(downloadFinishedSlot(QNetworkReply *)));
+    mUpdateAborted = false;
 }
 
-void DkUpdater::checkForUpdates() {
-
-	if (DkSettingsManager::param().sync().disableUpdateInteraction) {
-		QMessageBox::critical(
-			DkUtils::getMainWindow(), 
-			tr("Updates Disabled"), 
-			tr("nomacs updates are disabled.\nPlease contact your system administrator for further information."), 
-			QMessageBox::Ok);
-		return;
-	}
+void DkUpdater::checkForUpdates()
+{
+    if (DkSettingsManager::param().sync().disableUpdateInteraction) {
+        QMessageBox::critical(DkUtils::getMainWindow(),
+                              tr("Updates Disabled"),
+                              tr("nomacs updates are disabled.\nPlease contact your system administrator for further information."),
+                              QMessageBox::Ok);
+        return;
+    }
 
-	DkSettingsManager::param().sync().lastUpdateCheck = QDate::currentDate();
-	DkSettingsManager::param().save();
+    DkSettingsManager::param().sync().lastUpdateCheck = QDate::currentDate();
+    DkSettingsManager::param().save();
 
 #ifdef Q_OS_WIN
-	QUrl url ("http://nomacs.org/version/version_win_stable");
+    QUrl url("http://nomacs.org/version/version_win_stable");
 #elif defined Q_OS_LINUX
-	QUrl url ("http://nomacs.org/version/version_linux");
+    QUrl url("http://nomacs.org/version/version_linux");
 #elif defined Q_OS_MAC
-	QUrl url ("http://nomacs.org/version/version_mac_stable");
+    QUrl url("http://nomacs.org/version/version_mac_stable");
 #else
-	QUrl url ("http://nomacs.org/version/version");
+    QUrl url("http://nomacs.org/version/version");
 #endif
 
-	// the proxy settings take > 2 sec on Win7
-	// that is why proxy settings are only set
-	// for manual updates
-	if (!silent) {
-		DkTimer dt;
-		QNetworkProxyQuery npq(QUrl("http://www.google.com"));
-		QList<QNetworkProxy> listOfProxies = QNetworkProxyFactory::systemProxyForQuery(npq);
-
-		if (!listOfProxies.empty() && listOfProxies[0].hostName() != "") {
-			mAccessManagerSetup.setProxy(listOfProxies[0]);
-			mAccessManagerVersion.setProxy(listOfProxies[0]);
-		}
-		qDebug() << "checking for proxy takes: " << dt;
-	}
-
-	qDebug() << "checking for updates";
-	connect(&mAccessManagerVersion, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));	
-	mReply = mAccessManagerVersion.get(QNetworkRequest(url));
-	connect(mReply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(replyError(QNetworkReply::NetworkError)));
+    // the proxy settings take > 2 sec on Win7
+    // that is why proxy settings are only set
+    // for manual updates
+    if (!silent) {
+        DkTimer dt;
+        QNetworkProxyQuery npq(QUrl("http://www.google.com"));
+        QList<QNetworkProxy> listOfProxies = QNetworkProxyFactory::systemProxyForQuery(npq);
+
+        if (!listOfProxies.empty() && listOfProxies[0].hostName() != "") {
+            mAccessManagerSetup.setProxy(listOfProxies[0]);
+            mAccessManagerVersion.setProxy(listOfProxies[0]);
+        }
+        qDebug() << "checking for proxy takes: " << dt;
+    }
+
+    qDebug() << "checking for updates";
+    connect(&mAccessManagerVersion, SIGNAL(finished(QNetworkReply *)), this, SLOT(replyFinished(QNetworkReply *)));
+    mReply = mAccessManagerVersion.get(QNetworkRequest(url));
+    connect(mReply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(replyError(QNetworkReply::NetworkError)));
 }
 
-void DkUpdater::replyFinished(QNetworkReply* reply) {
-
-	if (reply->error())
-		return;
-
-	QString replyData = reply->readAll();
-
-	QStringList sl = replyData.split('\n', QString::SkipEmptyParts);
-
-	QString version, x64, x86, url, mac, XPx86;
-	for(int i = 0; i < sl.length();i++) {
-		QStringList values = sl[i].split(" ");
-		if (values[0] == "version") 
-			version = values[1];
-		else if (values[0] == "x64")
-			x64 = values[1];
-		else if (values[0] == "XPx86")
-			XPx86 = values[1];
-		else if (values[0] == "x86")
-			x86 = values[1];
-		else if (values[0] == "mac")
-			mac = values[1];
-	}
-
+void DkUpdater::replyFinished(QNetworkReply *reply)
+{
+    if (reply->error())
+        return;
+
+    QString replyData = reply->readAll();
+
+    QStringList sl = replyData.split('\n', Qt::SkipEmptyParts);
+
+    QString version, x64, x86, url, mac, XPx86;
+    for (int i = 0; i < sl.length(); i++) {
+        QStringList values = sl[i].split(" ");
+        if (values[0] == "version")
+            version = values[1];
+        else if (values[0] == "x64")
+            x64 = values[1];
+        else if (values[0] == "XPx86")
+            XPx86 = values[1];
+        else if (values[0] == "x86")
+            x86 = values[1];
+        else if (values[0] == "mac")
+            mac = values[1];
+    }
 
 #if _MSC_VER == 1600
-	url = XPx86;	// for WinXP packages
+    url = XPx86; // for WinXP packages
 #elif defined _WIN64
-	url = x64;
+    url = x64;
 #elif _WIN32
-	url = x86;
+    url = x86;
 #elif defined Q_OS_MAC
-	url = mac;
-#endif 
-
-	qDebug() << "version:" << version;
-	qDebug() << "x64:" << x64;
-	qDebug() << "x86:" << x86;
-	qDebug() << "mac:" << mac;
-
-	if ((!version.isEmpty() && !x64.isEmpty()) || !x86.isEmpty()) {		
-		QStringList cVersion = QApplication::applicationVersion().split('.');
-		QStringList nVersion = version.split('.');
-
-		if (cVersion.size() < 3 || nVersion.size() < 3) {
-			qDebug() << "sorry, I could not parse the version number...";
-
-			if (!silent)
-				emit showUpdaterMessage(tr("sorry, I could not check for newer versions"), tr("Updates"));
-
-			return;
-		}
-
-		if (nVersion[0].toInt() > cVersion[0].toInt()  ||	// major release
-		   (nVersion[0].toInt() == cVersion[0].toInt() &&	// major release
-			nVersion[1].toInt() > cVersion[1].toInt()) ||	// minor release
-		   (nVersion[0].toInt() == cVersion[0].toInt() &&	// major release
-			nVersion[1].toInt() == cVersion[1].toInt() &&	// minor release
-			nVersion[2].toInt() >  cVersion[2].toInt())) {	// minor-minor release
-
-			QString msg = tr("A new version") + " (" + sl[0] + ") " + tr("is available");
-			msg = msg + "<br>" + tr("Do you want to download and install it now?");
-			msg = msg + "<br>" + tr("For more information see ") + " <a href=\"https://nomacs.org\">https://nomacs.org</a>";
-			mNomacsSetupUrl = url;
-			mSetupVersion = version;
-			qDebug() << "nomacs setup url:" << mNomacsSetupUrl;
-
-			if (!url.isEmpty())
-				emit displayUpdateDialog(msg, tr("updates")); 
-		}
-		else if (!silent)
-			emit showUpdaterMessage(tr("nomacs is up-to-date"), tr("updates"));
-	}
+    url = mac;
+#endif
 
+    qDebug() << "version:" << version;
+    qDebug() << "x64:" << x64;
+    qDebug() << "x86:" << x86;
+    qDebug() << "mac:" << mac;
+
+    if ((!version.isEmpty() && !x64.isEmpty()) || !x86.isEmpty()) {
+        QStringList cVersion = QApplication::applicationVersion().split('.');
+        QStringList nVersion = version.split('.');
+
+        if (cVersion.size() < 3 || nVersion.size() < 3) {
+            qDebug() << "sorry, I could not parse the version number...";
+
+            if (!silent)
+                emit showUpdaterMessage(tr("sorry, I could not check for newer versions"), tr("Updates"));
+
+            return;
+        }
+
+        if (nVersion[0].toInt() > cVersion[0].toInt() || // major release
+            (nVersion[0].toInt() == cVersion[0].toInt() && // major release
+             nVersion[1].toInt() > cVersion[1].toInt())
+            || // minor release
+            (nVersion[0].toInt() == cVersion[0].toInt() && // major release
+             nVersion[1].toInt() == cVersion[1].toInt() && // minor release
+             nVersion[2].toInt() > cVersion[2].toInt())) { // minor-minor release
+
+            QString msg = tr("A new version") + " (" + sl[0] + ") " + tr("is available");
+            msg = msg + "<br>" + tr("Do you want to download and install it now?");
+            msg = msg + "<br>" + tr("For more information see ") + " <a href=\"https://nomacs.org\">https://nomacs.org</a>";
+            mNomacsSetupUrl = url;
+            mSetupVersion = version;
+            qDebug() << "nomacs setup url:" << mNomacsSetupUrl;
+
+            if (!url.isEmpty())
+                emit displayUpdateDialog(msg, tr("updates"));
+        } else if (!silent)
+            emit showUpdaterMessage(tr("nomacs is up-to-date"), tr("updates"));
+    }
 }
 
-void DkUpdater::startDownload(QUrl downloadUrl) {
-
-	if (downloadUrl.isEmpty())
-		emit showUpdaterMessage(tr("sorry, unable to download the new version"), tr("updates"));
+void DkUpdater::startDownload(QUrl downloadUrl)
+{
+    if (downloadUrl.isEmpty())
+        emit showUpdaterMessage(tr("sorry, unable to download the new version"), tr("updates"));
 
-	qDebug() << "-----------------------------------------------------";
-	qDebug() << "starting to download update from " << downloadUrl ;
+    qDebug() << "-----------------------------------------------------";
+    qDebug() << "starting to download update from " << downloadUrl;
 
-	//updateAborted = false;	// reset - it may have been canceled before
-	QNetworkRequest req(downloadUrl);
-	req.setRawHeader("User-Agent", "Auto-Updater");
-	mReply = mAccessManagerSetup.get(req);
-	connect(mReply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(updateDownloadProgress(qint64, qint64)));
+    // updateAborted = false;	// reset - it may have been canceled before
+    QNetworkRequest req(downloadUrl);
+    req.setRawHeader("User-Agent", "Auto-Updater");
+    mReply = mAccessManagerSetup.get(req);
+    connect(mReply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(updateDownloadProgress(qint64, qint64)));
 }
 
-void DkUpdater::downloadFinishedSlot(QNetworkReply* data) {
-	QUrl redirect = data->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
-	if (!redirect.isEmpty() ) {
-		qDebug() << "redirecting: " << redirect;
-		startDownload(redirect);
-		return;
-	}
-
-	if (!mUpdateAborted) {
-		QString basename = "nomacs-setup";
-		QString extension = ".msi";
-		QString absoluteFilePath = QDir::tempPath() + "/" + basename + extension;
-		if (QFile::exists(absoluteFilePath)) {
-			qDebug() << "File already exists - searching for new name";
-			// already exists, don't overwrite
-			int i = 0;
-			while (QFile::exists(absoluteFilePath)) {
-				absoluteFilePath = QDir::tempPath() + "/" + basename + "-" + QString::number(i) + extension;
-				++i;
-			}
-		}
-
-		QFile file(absoluteFilePath);
-		if (!file.open(QIODevice::WriteOnly)) {
-			qDebug()  << "Could not open " << QFileInfo(file).absoluteFilePath() << "for writing";
-			return;
-		}
-
-		file.write(data->readAll());
-		qDebug() << "saved new version: " << " " << QFileInfo(file).absoluteFilePath();
-
-		file.close();
-
-		DkSettingsManager::param().global().setupVersion = mSetupVersion;
-		DkSettingsManager::param().global().setupPath = absoluteFilePath;
-		DkSettingsManager::param().save();
-
-		emit downloadFinished(absoluteFilePath);
-	}
-	mUpdateAborted = false;
-	qDebug() << "downloadFinishedSlot complete";
+void DkUpdater::downloadFinishedSlot(QNetworkReply *data)
+{
+    QUrl redirect = data->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
+    if (!redirect.isEmpty()) {
+        qDebug() << "redirecting: " << redirect;
+        startDownload(redirect);
+        return;
+    }
+
+    if (!mUpdateAborted) {
+        QString basename = "nomacs-setup";
+        QString extension = ".msi";
+        QString absoluteFilePath = QDir::tempPath() + "/" + basename + extension;
+        if (QFile::exists(absoluteFilePath)) {
+            qDebug() << "File already exists - searching for new name";
+            // already exists, don't overwrite
+            int i = 0;
+            while (QFile::exists(absoluteFilePath)) {
+                absoluteFilePath = QDir::tempPath() + "/" + basename + "-" + QString::number(i) + extension;
+                ++i;
+            }
+        }
+
+        QFile file(absoluteFilePath);
+        if (!file.open(QIODevice::WriteOnly)) {
+            qDebug() << "Could not open " << QFileInfo(file).absoluteFilePath() << "for writing";
+            return;
+        }
+
+        file.write(data->readAll());
+        qDebug() << "saved new version: "
+                 << " " << QFileInfo(file).absoluteFilePath();
+
+        file.close();
+
+        DkSettingsManager::param().global().setupVersion = mSetupVersion;
+        DkSettingsManager::param().global().setupPath = absoluteFilePath;
+        DkSettingsManager::param().save();
+
+        emit downloadFinished(absoluteFilePath);
+    }
+    mUpdateAborted = false;
+    qDebug() << "downloadFinishedSlot complete";
 }
 
-void DkUpdater::performUpdate() {
-	if(mNomacsSetupUrl.isEmpty())
-		qDebug() << "unable to perform update because the nomacsSetupUrl is empty";
-	else
-		startDownload(mNomacsSetupUrl);
+void DkUpdater::performUpdate()
+{
+    if (mNomacsSetupUrl.isEmpty())
+        qDebug() << "unable to perform update because the nomacsSetupUrl is empty";
+    else
+        startDownload(mNomacsSetupUrl);
 }
 
-void DkUpdater::cancelUpdate()  {
-	qDebug() << "abort update";
-	mUpdateAborted = true; 
-	mReply->abort(); 
+void DkUpdater::cancelUpdate()
+{
+    qDebug() << "abort update";
+    mUpdateAborted = true;
+    mReply->abort();
 }
 
-void DkUpdater::replyError(QNetworkReply::NetworkError) {
-	if (!silent)
-		emit showUpdaterMessage(tr("Unable to connect to server ... please try again later"), tr("updates"));
+void DkUpdater::replyError(QNetworkReply::NetworkError)
+{
+    if (!silent)
+        emit showUpdaterMessage(tr("Unable to connect to server ... please try again later"), tr("updates"));
 }
 
 // DkTranslationUpdater --------------------------------------------------------------------
-DkTranslationUpdater::DkTranslationUpdater(bool silent, QObject* parent) : QObject(parent) {
-
-	this->silent = silent;
-	connect(&mAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));
-
-	updateAborted = false;
-	updateAbortedQt = false;
+DkTranslationUpdater::DkTranslationUpdater(bool silent, QObject *parent)
+    : QObject(parent)
+{
+    this->silent = silent;
+    connect(&mAccessManager, SIGNAL(finished(QNetworkReply *)), this, SLOT(replyFinished(QNetworkReply *)));
+
+    updateAborted = false;
+    updateAbortedQt = false;
 }
 
-void DkTranslationUpdater::checkForUpdates() {
-
-	if (DkSettingsManager::param().sync().disableUpdateInteraction) {
-		QMessageBox::critical(
-			DkUtils::getMainWindow(),
-			tr("Updates Disabled"),
-			tr("nomacs updates are disabled.\nPlease contact your system administrator for further information."),
-			QMessageBox::Ok);
-		return;
-	}
-
-	mTotal = -1;
-	mTotalQt = -1;
-	mReceived = 0;
-	mReceivedQt = 0;
-	updateAborted = false;
-	updateAbortedQt = false;
-
-	// that line takes 2 secs on win7!
-	QNetworkProxyQuery npq(QUrl("http://www.google.com"));
-	QList<QNetworkProxy> listOfProxies = QNetworkProxyFactory::systemProxyForQuery(npq);
-	if (!listOfProxies.empty() && listOfProxies[0].hostName() != "") {
-		mAccessManager.setProxy(listOfProxies[0]);
-	}
-
-	QUrl url ("http://nomacs.org/translations/" + DkSettingsManager::param().global().language + "/nomacs_" + DkSettingsManager::param().global().language + ".qm");
-	qInfo() << "checking for new translations at " << url;
-	mReply = mAccessManager.get(QNetworkRequest(url));
-	connect(mReply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(updateDownloadProgress(qint64, qint64)));
-
-	url=QUrl("http://nomacs.org/translations/qt/qt_" + DkSettingsManager::param().global().language + ".qm");
-	qDebug() << "checking for new translations at " << url;
-	mReplyQt = mAccessManager.get(QNetworkRequest(url));
-	connect(mReplyQt, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(updateDownloadProgressQt(qint64, qint64)));
+void DkTranslationUpdater::checkForUpdates()
+{
+    if (DkSettingsManager::param().sync().disableUpdateInteraction) {
+        QMessageBox::critical(DkUtils::getMainWindow(),
+                              tr("Updates Disabled"),
+                              tr("nomacs updates are disabled.\nPlease contact your system administrator for further information."),
+                              QMessageBox::Ok);
+        return;
+    }
+
+    mTotal = -1;
+    mTotalQt = -1;
+    mReceived = 0;
+    mReceivedQt = 0;
+    updateAborted = false;
+    updateAbortedQt = false;
+
+    // that line takes 2 secs on win7!
+    QNetworkProxyQuery npq(QUrl("http://www.google.com"));
+    QList<QNetworkProxy> listOfProxies = QNetworkProxyFactory::systemProxyForQuery(npq);
+    if (!listOfProxies.empty() && listOfProxies[0].hostName() != "") {
+        mAccessManager.setProxy(listOfProxies[0]);
+    }
+
+    QUrl url("http://nomacs.org/translations/" + DkSettingsManager::param().global().language + "/nomacs_" + DkSettingsManager::param().global().language
+             + ".qm");
+    qInfo() << "checking for new translations at " << url;
+    mReply = mAccessManager.get(QNetworkRequest(url));
+    connect(mReply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(updateDownloadProgress(qint64, qint64)));
+
+    url = QUrl("http://nomacs.org/translations/qt/qt_" + DkSettingsManager::param().global().language + ".qm");
+    qDebug() << "checking for new translations at " << url;
+    mReplyQt = mAccessManager.get(QNetworkRequest(url));
+    connect(mReplyQt, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(updateDownloadProgressQt(qint64, qint64)));
 }
 
-void DkTranslationUpdater::replyFinished(QNetworkReply* reply) {
-
-	bool qtTranslation = false;
-	if (reply->url().toString().contains("qt_"))
-		qtTranslation = true;
-
-	if (updateAbortedQt && updateAborted) {
-		emit downloadFinished();
-		return;
-	}
-
-	if (reply->error() == QNetworkReply::OperationCanceledError)
-		return;
-
-	if (reply->error()) {
-		qDebug() << "network reply error : url: " << reply->url();
-		if (!qtTranslation && !silent)
-			emit showUpdaterMessage(tr("Unable to download translation"), tr("update")); 
-		return;
-	}
-
-	QDateTime lastModifiedRemote = reply->header(QNetworkRequest::LastModifiedHeader).toDateTime();
-
-	QDir storageLocation = DkUtils::getTranslationPath();
-	QString translationName = qtTranslation ? "qt_"+ DkSettingsManager::param().global().language + ".qm" : "nomacs_"+ DkSettingsManager::param().global().language + ".qm";
-
-	if (isRemoteFileNewer(lastModifiedRemote, translationName)) {
-		QString basename = qtTranslation ? "qt_" + DkSettingsManager::param().global().language : "nomacs_" + DkSettingsManager::param().global().language;
-		QString extension = ".qm";
-
-		if (!storageLocation.exists()) {
-			if (!storageLocation.mkpath(storageLocation.absolutePath())) {
-				qDebug() << "unable to create storage location ... aborting";
-				if (!qtTranslation && !silent)
-					emit showUpdaterMessage(tr("Unable to update translation"), tr("update")); 
-				return;
-			}
-		}
-
-		QString absoluteFilePath = storageLocation.absolutePath() + "/" + basename + extension;
-		if (QFile::exists(absoluteFilePath)) {
-			qInfo() << "File already exists - overwriting";
-		}
-
-		QFile file(absoluteFilePath);
-		if (!file.open(QIODevice::WriteOnly)) {
-			qWarning()  << "Could not open " << QFileInfo(file).absoluteFilePath() << "for writing";
-			return;
-		}
-
-		file.write(reply->readAll());
-		qDebug() << "saved new translation: " << " " << QFileInfo(file).absoluteFilePath();
-
-		file.close();
-
-		if (!qtTranslation && !silent)
-			emit showUpdaterMessage(tr("Translation updated"), tr("update")); 
-		qDebug() << "translation updated";
-	} else {
-		qDebug() << "no newer translations available";
-		if (!silent)
-			emit showUpdaterMessage(tr("No newer translations found"), tr("update")); 
-	}
-	if (reply->isFinished() && mReplyQt->isFinished()) {
-		qDebug() << "emitting downloadFinished";
-		emit downloadFinished();
-	}
-
+void DkTranslationUpdater::replyFinished(QNetworkReply *reply)
+{
+    bool qtTranslation = false;
+    if (reply->url().toString().contains("qt_"))
+        qtTranslation = true;
+
+    if (updateAbortedQt && updateAborted) {
+        emit downloadFinished();
+        return;
+    }
+
+    if (reply->error() == QNetworkReply::OperationCanceledError)
+        return;
+
+    if (reply->error()) {
+        qDebug() << "network reply error : url: " << reply->url();
+        if (!qtTranslation && !silent)
+            emit showUpdaterMessage(tr("Unable to download translation"), tr("update"));
+        return;
+    }
+
+    QDateTime lastModifiedRemote = reply->header(QNetworkRequest::LastModifiedHeader).toDateTime();
+
+    QDir storageLocation = DkUtils::getTranslationPath();
+    QString translationName =
+        qtTranslation ? "qt_" + DkSettingsManager::param().global().language + ".qm" : "nomacs_" + DkSettingsManager::param().global().language + ".qm";
+
+    if (isRemoteFileNewer(lastModifiedRemote, translationName)) {
+        QString basename = qtTranslation ? "qt_" + DkSettingsManager::param().global().language : "nomacs_" + DkSettingsManager::param().global().language;
+        QString extension = ".qm";
+
+        if (!storageLocation.exists()) {
+            if (!storageLocation.mkpath(storageLocation.absolutePath())) {
+                qDebug() << "unable to create storage location ... aborting";
+                if (!qtTranslation && !silent)
+                    emit showUpdaterMessage(tr("Unable to update translation"), tr("update"));
+                return;
+            }
+        }
+
+        QString absoluteFilePath = storageLocation.absolutePath() + "/" + basename + extension;
+        if (QFile::exists(absoluteFilePath)) {
+            qInfo() << "File already exists - overwriting";
+        }
+
+        QFile file(absoluteFilePath);
+        if (!file.open(QIODevice::WriteOnly)) {
+            qWarning() << "Could not open " << QFileInfo(file).absoluteFilePath() << "for writing";
+            return;
+        }
+
+        file.write(reply->readAll());
+        qDebug() << "saved new translation: "
+                 << " " << QFileInfo(file).absoluteFilePath();
+
+        file.close();
+
+        if (!qtTranslation && !silent)
+            emit showUpdaterMessage(tr("Translation updated"), tr("update"));
+        qDebug() << "translation updated";
+    } else {
+        qDebug() << "no newer translations available";
+        if (!silent)
+            emit showUpdaterMessage(tr("No newer translations found"), tr("update"));
+    }
+    if (reply->isFinished() && mReplyQt->isFinished()) {
+        qDebug() << "emitting downloadFinished";
+        emit downloadFinished();
+    }
 }
 
-void DkTranslationUpdater::updateDownloadProgress(qint64 received, qint64 total) {
-	if (total == -1)  // if file does not exist 
-		return;
-
-	QDateTime lastModifiedRemote = mReply->header(QNetworkRequest::LastModifiedHeader).toDateTime();
-
-	QString translationName = "nomacs_"+ DkSettingsManager::param().global().language + ".qm";
-	qDebug() << "isRemoteFileNewer:" << isRemoteFileNewer(lastModifiedRemote, translationName);
-	if (!isRemoteFileNewer(lastModifiedRemote, translationName)) {
-		updateAborted = true;
-		this->mTotal = 0;
-		this->mReceived = 0;
-		mReply->abort();
-		return;
-	}
-
-	this->mReceived = received;
-	this->mTotal  = total;
-	qDebug() << "total:" << total;
-	emit downloadProgress(this->mReceived + this->mReceivedQt, this->mTotal + this->mTotalQt); 
+void DkTranslationUpdater::updateDownloadProgress(qint64 received, qint64 total)
+{
+    if (total == -1) // if file does not exist
+        return;
+
+    QDateTime lastModifiedRemote = mReply->header(QNetworkRequest::LastModifiedHeader).toDateTime();
+
+    QString translationName = "nomacs_" + DkSettingsManager::param().global().language + ".qm";
+    qDebug() << "isRemoteFileNewer:" << isRemoteFileNewer(lastModifiedRemote, translationName);
+    if (!isRemoteFileNewer(lastModifiedRemote, translationName)) {
+        updateAborted = true;
+        this->mTotal = 0;
+        this->mReceived = 0;
+        mReply->abort();
+        return;
+    }
+
+    this->mReceived = received;
+    this->mTotal = total;
+    qDebug() << "total:" << total;
+    emit downloadProgress(this->mReceived + this->mReceivedQt, this->mTotal + this->mTotalQt);
 }
 
-void DkTranslationUpdater::updateDownloadProgressQt(qint64 received, qint64 total) {
-	if (total == -1)  // if file does not exist 
-		return;
-
-	QDateTime lastModifiedRemote = mReplyQt->header(QNetworkRequest::LastModifiedHeader).toDateTime();
-	QString translationName = "qt_"+ DkSettingsManager::param().global().language + ".qm";
-	qDebug() << "isRemoteFileNewer:" << isRemoteFileNewer(lastModifiedRemote, translationName);
-	if (!isRemoteFileNewer(lastModifiedRemote, translationName)) {
-		updateAbortedQt = true;
-		this->mTotalQt = 0;
-		this->mReceivedQt = 0;
-		mReplyQt->abort();
-		return;
-	}
-
-	this->mReceivedQt = received;
-	this->mTotalQt = total;
-	qDebug() << "totalQt:" << mTotalQt;
-	emit downloadProgress(this->mReceived + this->mReceivedQt, this->mTotal + this->mTotalQt); 
+void DkTranslationUpdater::updateDownloadProgressQt(qint64 received, qint64 total)
+{
+    if (total == -1) // if file does not exist
+        return;
+
+    QDateTime lastModifiedRemote = mReplyQt->header(QNetworkRequest::LastModifiedHeader).toDateTime();
+    QString translationName = "qt_" + DkSettingsManager::param().global().language + ".qm";
+    qDebug() << "isRemoteFileNewer:" << isRemoteFileNewer(lastModifiedRemote, translationName);
+    if (!isRemoteFileNewer(lastModifiedRemote, translationName)) {
+        updateAbortedQt = true;
+        this->mTotalQt = 0;
+        this->mReceivedQt = 0;
+        mReplyQt->abort();
+        return;
+    }
+
+    this->mReceivedQt = received;
+    this->mTotalQt = total;
+    qDebug() << "totalQt:" << mTotalQt;
+    emit downloadProgress(this->mReceived + this->mReceivedQt, this->mTotal + this->mTotalQt);
 }
 
-bool DkTranslationUpdater::isRemoteFileNewer(QDateTime lastModifiedRemote, const QString& localTranslationName) {
-	
-	if (!lastModifiedRemote.isValid())
-		return false;
+bool DkTranslationUpdater::isRemoteFileNewer(QDateTime lastModifiedRemote, const QString &localTranslationName)
+{
+    if (!lastModifiedRemote.isValid())
+        return false;
 
-	QString trPath = DkUtils::getTranslationPath();
-	QFileInfo trFile(trPath, localTranslationName);
-	
-	return !trFile.exists() || (QFileInfo(trFile).lastModified() < lastModifiedRemote);
+    QString trPath = DkUtils::getTranslationPath();
+    QFileInfo trFile(trPath, localTranslationName);
+
+    return !trFile.exists() || (QFileInfo(trFile).lastModified() < lastModifiedRemote);
 }
 
-void DkTranslationUpdater::cancelUpdate() {
-	mReply->abort(); 
-	mReplyQt->abort();
-	updateAborted = true;
-	updateAbortedQt = true;
+void DkTranslationUpdater::cancelUpdate()
+{
+    mReply->abort();
+    mReplyQt->abort();
+    updateAborted = true;
+    updateAbortedQt = true;
 }
 
-}
\ No newline at end of file
+}
diff --git a/ImageLounge/src/DkCore/DkUpdater.h b/ImageLounge/src/DkCore/DkUpdater.h
index cb458cd..3319ee0 100644
--- a/ImageLounge/src/DkCore/DkUpdater.h
+++ b/ImageLounge/src/DkCore/DkUpdater.h
@@ -1,6 +1,6 @@
 /*******************************************************************************************************
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2016 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2016 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2016 Florian Kleber <florian@nomacs.org>
@@ -28,10 +28,10 @@
 
 #pragma once
 
-#pragma warning(push, 0)	// no warnings from includes
-#include <QString>
-#include <QObject>
+#pragma warning(push, 0) // no warnings from includes
 #include <QNetworkReply>
+#include <QObject>
+#include <QString>
 #pragma warning(pop)
 
 #ifndef DllCoreExport
@@ -48,101 +48,107 @@
 class QXmlStreamReader;
 class QNetworkAccessManager;
 
-namespace nmc {
+namespace nmc
+{
 
 // nomacs defines
-class DkPackage {
-
+class DkPackage
+{
 public:
-	DkPackage(const QString& name = "", const QString& version = "");
+    DkPackage(const QString &name = "", const QString &version = "");
 
-	bool isEmpty() const;
-	bool operator==(const DkPackage& o) const;
+    bool isEmpty() const;
+    bool operator==(const DkPackage &o) const;
 
-	QString name() const;
-	QString version() const;
+    QString name() const;
+    QString version() const;
 
 protected:
-	QString mName;
-	QString mVersion;
+    QString mName;
+    QString mVersion;
 };
 
-class DkXmlUpdateChecker {
-
+class DkXmlUpdateChecker
+{
 public:
-	DkXmlUpdateChecker();
+    DkXmlUpdateChecker();
 
-	QVector<DkPackage> updatesAvailable(QXmlStreamReader& localXml, QXmlStreamReader& remoteXml) const;
+    QVector<DkPackage> updatesAvailable(QXmlStreamReader &localXml, QXmlStreamReader &remoteXml) const;
 
 protected:
-	QVector<DkPackage> parse(QXmlStreamReader& reader) const;
+    QVector<DkPackage> parse(QXmlStreamReader &reader) const;
 };
 
-class DllCoreExport DkUpdater : public QObject {
-	Q_OBJECT
+class DllCoreExport DkUpdater : public QObject
+{
+    Q_OBJECT
 
 public:
-	bool silent;
+    bool silent;
 
-	DkUpdater(QObject* parent = 0);
+    DkUpdater(QObject *parent = 0);
 
 public slots:
-	void checkForUpdates();
-	void replyFinished(QNetworkReply*);
-	void replyError(QNetworkReply::NetworkError);
-	void performUpdate();
-	void downloadFinishedSlot(QNetworkReply* data);
-	void updateDownloadProgress(qint64 received, qint64 total) { emit downloadProgress(received, total); };
-	void cancelUpdate();
+    void checkForUpdates();
+    void replyFinished(QNetworkReply *);
+    void replyError(QNetworkReply::NetworkError);
+    void performUpdate();
+    void downloadFinishedSlot(QNetworkReply *data);
+    void updateDownloadProgress(qint64 received, qint64 total)
+    {
+        emit downloadProgress(received, total);
+    };
+    void cancelUpdate();
 
 signals:
-	void displayUpdateDialog(const QString& msg, const QString& title) const;
-	void showUpdaterMessage(const QString& msg, const QString& title) const;
-	void downloadFinished(const QString& filePath) const;
-	void downloadProgress(qint64, qint64) const;
+    void displayUpdateDialog(const QString &msg, const QString &title) const;
+    void showUpdaterMessage(const QString &msg, const QString &title) const;
+    void downloadFinished(const QString &filePath) const;
+    void downloadProgress(qint64, qint64) const;
 
 protected:
-	void startDownload(QUrl downloadUrl);
+    void startDownload(QUrl downloadUrl);
 
-	QNetworkAccessManager mAccessManagerVersion;
-	QNetworkAccessManager mAccessManagerSetup;
+    QNetworkAccessManager mAccessManagerVersion;
+    QNetworkAccessManager mAccessManagerSetup;
 
-	QNetworkReply* mReply = 0;
-	QNetworkCookieJar* mCookie = 0;
+    QNetworkReply *mReply = 0;
+    QNetworkCookieJar *mCookie = 0;
 
-	QUrl mNomacsSetupUrl;
-	QString mSetupVersion;
-	bool mUpdateAborted = false;
+    QUrl mNomacsSetupUrl;
+    QString mSetupVersion;
+    bool mUpdateAborted = false;
 };
 
-class DllCoreExport DkTranslationUpdater : public QObject {
-	Q_OBJECT
+class DllCoreExport DkTranslationUpdater : public QObject
+{
+    Q_OBJECT
 
 public:
-	DkTranslationUpdater(bool silent = false, QObject* parent = 0);
-	bool silent;
+    DkTranslationUpdater(bool silent = false, QObject *parent = 0);
+    bool silent;
 
 public slots:
-	virtual void checkForUpdates();
-	virtual void replyFinished(QNetworkReply*);
-	void updateDownloadProgress(qint64 received, qint64 total);
-	void updateDownloadProgressQt(qint64 received, qint64 total);
-	void cancelUpdate();
+    virtual void checkForUpdates();
+    virtual void replyFinished(QNetworkReply *);
+    void updateDownloadProgress(qint64 received, qint64 total);
+    void updateDownloadProgressQt(qint64 received, qint64 total);
+    void cancelUpdate();
 
 signals:
-	void translationUpdated();
-	void showUpdaterMessage(const QString&, const QString&);
-	void downloadProgress(qint64, qint64);
-	void downloadFinished();
+    void translationUpdated();
+    void showUpdaterMessage(const QString &, const QString &);
+    void downloadProgress(qint64, qint64);
+    void downloadFinished();
 
 private:
-	bool isRemoteFileNewer(QDateTime lastModifiedRemote, const QString& localTranslationName);
-	bool updateAborted, updateAbortedQt;
+    bool isRemoteFileNewer(QDateTime lastModifiedRemote, const QString &localTranslationName);
+    bool updateAborted, updateAbortedQt;
 
-	qint64 mTotal, mTotalQt, mReceived, mReceivedQt;
-	QNetworkAccessManager mAccessManager;
-	QNetworkReply* mReply = 0;
-	QNetworkReply* mReplyQt = 0;
+    qint64 mTotal, mTotalQt, mReceived, mReceivedQt;
+    QNetworkAccessManager mAccessManager;
+    QNetworkReply *mReply = 0;
+    QNetworkReply *mReplyQt = 0;
 };
 
 }
\ No newline at end of file
diff --git a/ImageLounge/src/DkCore/DkUtils.cpp b/ImageLounge/src/DkCore/DkUtils.cpp
index 3dcab59..781d2c2 100644
--- a/ImageLounge/src/DkCore/DkUtils.cpp
+++ b/ImageLounge/src/DkCore/DkUtils.cpp
@@ -27,8 +27,8 @@
 
 #include "DkUtils.h"
 #include "DkMath.h"
-#include "DkSettings.h"
 #include "DkNoMacs.h"
+#include "DkSettings.h"
 #include "DkViewPort.h"
 
 #if defined(Q_OS_LINUX) && !defined(Q_OS_OPENBSD)
@@ -39,204 +39,199 @@
 #include <cassert>
 #endif
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QString>
-#include <QFileInfo>
-#include <QDate>
-#include <QRegExp>
-#include <QStringList>
+#pragma warning(push, 0) // no warnings from includes - begin
+#include <QApplication>
 #include <QColor>
-#include <QPixmap>
-#include <QPainter>
-#include <QFuture>
-#include <QtConcurrentRun>
-#include <QDir>
 #include <QComboBox>
 #include <QCoreApplication>
-#include <QTranslator>
-#include <QUrl>
-#include <QStandardPaths>
-#include <QApplication>
+#include <QDate>
+#include <QDir>
+#include <QFileInfo>
+#include <QFuture>
 #include <QMainWindow>
+#include <QMimeDatabase>
 #include <QMouseEvent>
+#include <QPainter>
+#include <QPixmap>
+#include <QRandomGenerator>
+#include <QStandardPaths>
+#include <QString>
+#include <QStringList>
+#include <QTranslator>
+#include <QUrl>
+#include <QtConcurrentRun>
 #include <qmath.h>
-#include <QMimeDatabase>
 
 #include <QSystemSemaphore>
-#pragma warning(pop)		// no warnings from includes - end
+#pragma warning(pop) // no warnings from includes - end
 
 #if defined(Q_OS_WIN) && !defined(SOCK_STREAM)
-#include <winsock2.h>	// needed since libraw 0.16
+#include <winsock2.h> // needed since libraw 0.16
 #endif
 
 #ifdef Q_OS_WIN
 #include "shlwapi.h"
-#pragma comment (lib, "shlwapi.lib")
+#pragma comment(lib, "shlwapi.lib")
 #endif
 
-#if QT_VERSION >= 0x050500 && !defined(QT_NO_DEBUG_OUTPUT)
+#if !defined(QT_NO_DEBUG_OUTPUT)
 
-QDebug qDebugClean() {
-	 return qDebug().noquote().nospace();
+QDebug qDebugClean()
+{
+    return qDebug().noquote().nospace();
 }
 
-QDebug qInfoClean() {
-	return qInfo().noquote().nospace();
+QDebug qInfoClean()
+{
+    return qInfo().noquote().nospace();
 }
-QDebug qWarningClean() {
-	return qWarning().noquote().nospace();
+QDebug qWarningClean()
+{
+    return qWarning().noquote().nospace();
 }
 #endif
 
-namespace nmc {
-
+namespace nmc
+{
 
 // code based on: http://stackoverflow.com/questions/8565430/complete-these-3-methods-with-linux-and-mac-code-memory-info-platform-independe
-double DkMemory::getTotalMemory() {
-
-	double mem = -1;
+double DkMemory::getTotalMemory()
+{
+    double mem = -1;
 
 #ifdef Q_OS_WIN
 
-	MEMORYSTATUSEX MemoryStatus;
-	ZeroMemory(&MemoryStatus, sizeof(MEMORYSTATUSEX));
-	MemoryStatus.dwLength = sizeof(MEMORYSTATUSEX);
+    MEMORYSTATUSEX MemoryStatus;
+    ZeroMemory(&MemoryStatus, sizeof(MEMORYSTATUSEX));
+    MemoryStatus.dwLength = sizeof(MEMORYSTATUSEX);
 
-	if (GlobalMemoryStatusEx(&MemoryStatus)) {
-		mem = (double)MemoryStatus.ullTotalPhys;
-	}
+    if (GlobalMemoryStatusEx(&MemoryStatus)) {
+        mem = (double)MemoryStatus.ullTotalPhys;
+    }
 
 #elif defined Q_OS_LINUX and not defined(Q_OS_OPENBSD)
 
-	struct sysinfo info;
-
-	if (!sysinfo(&info))
-		mem = info.totalram;
+    struct sysinfo info;
 
+    if (!sysinfo(&info))
+        mem = info.totalram;
 
 #elif defined Q_OS_MAC
-	// TODO: could somebody (with a mac please add the corresponding calls?
+    // TODO: could somebody (with a mac please add the corresponding calls?
 #endif
 
-	// convert to MB
-	if (mem > 0)
-		mem /= (1024*1024);
+    // convert to MB
+    if (mem > 0)
+        mem /= (1024 * 1024);
 
-	return mem;
+    return mem;
 }
 
-double DkMemory::getFreeMemory() {
-
-	double mem = -1;
-
+double DkMemory::getFreeMemory()
+{
+    double mem = -1;
 
 #ifdef Q_OS_WIN
 
-	MEMORYSTATUSEX MemoryStatus;
+    MEMORYSTATUSEX MemoryStatus;
 
-	ZeroMemory(&MemoryStatus, sizeof(MEMORYSTATUSEX));
-	MemoryStatus.dwLength = sizeof(MEMORYSTATUSEX);
+    ZeroMemory(&MemoryStatus, sizeof(MEMORYSTATUSEX));
+    MemoryStatus.dwLength = sizeof(MEMORYSTATUSEX);
 
-	if (GlobalMemoryStatusEx(&MemoryStatus)) {
-		mem = (double)MemoryStatus.ullAvailPhys;
-	}
+    if (GlobalMemoryStatusEx(&MemoryStatus)) {
+        mem = (double)MemoryStatus.ullAvailPhys;
+    }
 
 #elif defined Q_OS_LINUX and not defined(Q_OS_OPENBSD)
 
-	struct sysinfo info;
+    struct sysinfo info;
 
-	if (!sysinfo(&info))
-		mem = info.freeram;
+    if (!sysinfo(&info))
+        mem = info.freeram;
 
 #elif defined Q_OS_MAC
 
-	// TODO: could somebody with a mac please add the corresponding calls?
+    // TODO: could somebody with a mac please add the corresponding calls?
 
 #endif
 
-	// convert to MB
-	if (mem > 0)
-		mem /= (1024*1024);
+    // convert to MB
+    if (mem > 0)
+        mem /= (1024 * 1024);
 
-	return mem;
+    return mem;
 }
 
 // DkUtils --------------------------------------------------------------------
 #ifdef Q_OS_WIN
 
-bool DkUtils::wCompLogic(const std::wstring & lhs, const std::wstring & rhs) {
-	return StrCmpLogicalW(lhs.c_str(),rhs.c_str()) < 0;
+bool DkUtils::wCompLogic(const std::wstring &lhs, const std::wstring &rhs)
+{
+    return StrCmpLogicalW(lhs.c_str(), rhs.c_str()) < 0;
 }
 
-bool DkUtils::compLogicQString(const QString & lhs, const QString & rhs) {
-#if QT_VERSION < 0x050000
-	return wCompLogic(lhs.toStdWString(), rhs.toStdWString());
-#else
-	return wCompLogic(qStringToStdWString(lhs), qStringToStdWString(rhs));
-#endif
+bool DkUtils::compLogicQString(const QString &lhs, const QString &rhs)
+{
+    return wCompLogic(qStringToStdWString(lhs), qStringToStdWString(rhs));
 }
 
 #else // !Q_OS_WIN
 
-bool DkUtils::compLogicQString(const QString & lhs, const QString & rhs) {
-
-	return naturalCompare(lhs, rhs, Qt::CaseInsensitive);
-}
-
-#endif //!Q_OS_WIN
-
-bool DkUtils::naturalCompare(const QString &s1, const QString &s2, Qt::CaseSensitivity cs) {
-
-	int sIdx = 0;
-
-	// the first value is the most significant bit
-	// so we try to find the first difference in the strings
-	// this gives us an advantage:
-	// img1 and img10 are sorted correctly since the string compare
-	// does here what it should
-	// img4 and img10 are also sorted correctly since 4 < 10
-	// in addition we don't get into troubles with large numbers
-	// as we skip identical values...
-	for (; sIdx < s1.length() && sIdx < s2.length(); sIdx++)
-		if (s1[sIdx] != s2[sIdx])
-			break;
-
-	// if both values start with a digit
-	if (sIdx < s1.length() && sIdx < s2.length() && s1[sIdx].isDigit() && s2[sIdx].isDigit()) {
-
-		QString prefix = "";
-
-		// if the number has zeros we get into troubles:
-		// 101 and 12 result in '01' and '2'
-		// for double sort this means: 01 < 2 (though 101 > 12)
-		// so we simply search the last non zero number that was equal and prepend that
-		// if there is no such number (e.g. img001 vs img101) we are fine already
-		// this fixes #469
-		if (s1[sIdx] == '0' || s2[sIdx] == '0') {
-
-			for (int idx = sIdx-1; idx >= 0; idx--) {
-
-				if (s1[idx] != '0' && s1[idx].isDigit()) {	// find the last non-zero number (just check one string they are the same)
-					prefix = s1[idx];
-					break;
-				}
-				else if (s1[idx] != '0')
-					break;
-			}
-		}
+bool DkUtils::compLogicQString(const QString &lhs, const QString &rhs)
+{
+    return naturalCompare(lhs, rhs, Qt::CaseInsensitive);
+}
+
+#endif //! Q_OS_WIN
+
+bool DkUtils::naturalCompare(const QString &s1, const QString &s2, Qt::CaseSensitivity cs)
+{
+    int sIdx = 0;
+
+    // the first value is the most significant bit
+    // so we try to find the first difference in the strings
+    // this gives us an advantage:
+    // img1 and img10 are sorted correctly since the string compare
+    // does here what it should
+    // img4 and img10 are also sorted correctly since 4 < 10
+    // in addition we don't get into troubles with large numbers
+    // as we skip identical values...
+    for (; sIdx < s1.length() && sIdx < s2.length(); sIdx++)
+        if (s1[sIdx] != s2[sIdx])
+            break;
+
+    // if both values start with a digit
+    if (sIdx < s1.length() && sIdx < s2.length() && s1[sIdx].isDigit() && s2[sIdx].isDigit()) {
+        QString prefix = "";
+
+        // if the number has zeros we get into troubles:
+        // 101 and 12 result in '01' and '2'
+        // for double sort this means: 01 < 2 (though 101 > 12)
+        // so we simply search the last non zero number that was equal and prepend that
+        // if there is no such number (e.g. img001 vs img101) we are fine already
+        // this fixes #469
+        if (s1[sIdx] == '0' || s2[sIdx] == '0') {
+            for (int idx = sIdx - 1; idx >= 0; idx--) {
+                if (s1[idx] != '0' && s1[idx].isDigit()) { // find the last non-zero number (just check one string they are the same)
+                    prefix = s1[idx];
+                    break;
+                } else if (s1[idx] != '0')
+                    break;
+            }
+        }
 
-		QString cs1 = prefix + getLongestNumber(s1, sIdx);
-		QString cs2 = prefix + getLongestNumber(s2, sIdx);
+        QString cs1 = prefix + getLongestNumber(s1, sIdx);
+        QString cs2 = prefix + getLongestNumber(s2, sIdx);
 
-		double n1 = cs1.toDouble();
-		double n2 = cs2.toDouble();
+        double n1 = cs1.toDouble();
+        double n2 = cs2.toDouble();
 
-		if (n1 != n2)
-			return n1 < n2;
-	}
+        if (n1 != n2)
+            return n1 < n2;
+    }
 
-	// we're good to go with a string compare here...
-	return QString::compare(s1, s2, cs) < 0;
+    // we're good to go with a string compare here...
+    return QString::compare(s1, s2, cs) < 0;
 }
 
 /// <summary>
@@ -244,138 +239,143 @@ bool DkUtils::naturalCompare(const QString &s1, const QString &s2, Qt::CaseSensi
 /// </summary>
 /// <param name="filePath">The file path of the (potential) sym link.</param>
 /// <returns>If the file is no link, its path is returned.</returns>
-QString DkUtils::resolveSymLink(const QString & filePath) {
-	
-	QString rFilePath = filePath;
-
-	QFileInfo fInfo(filePath);
-
-	if (fInfo.isSymLink()) {
-		rFilePath = fInfo.symLinkTarget();
-	}
-	// check if files < 1 kb contain a link
-	else if (fInfo.size() < 1000) {
-
-		QFile file(filePath);
+QString DkUtils::resolveSymLink(const QString &filePath)
+{
+    QString rFilePath = filePath;
 
-		// silently ignore not readable files here
-		if (file.open(QIODevice::ReadOnly)) {
+    QFileInfo fInfo(filePath);
 
-			QTextStream txt(&file);
-
-			while (!txt.atEnd()) {
-
-				// is there an absolute path?
-				QString cl = txt.readLine();
-
-				if (cl.isEmpty())
-					continue;
-
-				QFileInfo fi(cl);
-				if (fi.exists() && fi.isFile() && DkUtils::hasValidSuffix(fi.fileName())) {
-					rFilePath = fi.absoluteFilePath();
-					break;
-				}
-
-				// is there a relative path?
-				fi = QFileInfo(fInfo.absolutePath() + QDir::separator() + cl);
-				if (fi.exists() && fi.isFile() && DkUtils::hasValidSuffix(fi.fileName())) {
-					rFilePath = fi.absoluteFilePath();
-					break;
-				}
-			}
-		}
+    if (fInfo.isSymLink()) {
+        rFilePath = fInfo.symLinkTarget();
+    }
+    // check if files < 1 kb contain a link
+    else if (fInfo.size() < 1000) {
+        QFile file(filePath);
+
+        // silently ignore not readable files here
+        if (file.open(QIODevice::ReadOnly)) {
+            QTextStream txt(&file);
+
+            while (!txt.atEnd()) {
+                // is there an absolute path?
+                QString cl = txt.readLine();
+
+                if (cl.isEmpty())
+                    continue;
+
+                QFileInfo fi(cl);
+                if (fi.exists() && fi.isFile() && DkUtils::hasValidSuffix(fi.fileName())) {
+                    rFilePath = fi.absoluteFilePath();
+                    break;
+                }
+
+                // is there a relative path?
+                fi = QFileInfo(fInfo.absolutePath() + QDir::separator() + cl);
+                if (fi.exists() && fi.isFile() && DkUtils::hasValidSuffix(fi.fileName())) {
+                    rFilePath = fi.absoluteFilePath();
+                    break;
+                }
+            }
+        }
 
-		file.close();
-	}
+        file.close();
+    }
 
-	return rFilePath;
+    return rFilePath;
 }
 
-QString DkUtils::getLongestNumber(const QString& str, int startIdx) {
-
-	int idx;
-
-	for (idx = startIdx; idx < str.length(); idx++) {
+QString DkUtils::getLongestNumber(const QString &str, int startIdx)
+{
+    int idx;
 
-		if (!str[idx].isDigit())
-			break;
-	}
+    for (idx = startIdx; idx < str.length(); idx++) {
+        if (!str[idx].isDigit())
+            break;
+    }
 
-	return str.mid(startIdx, idx-startIdx);
+    return str.mid(startIdx, idx - startIdx);
 }
 
-bool DkUtils::compDateCreated(const QFileInfo& lhf, const QFileInfo& rhf) {
-
-	return lhf.created() < rhf.created();
+bool DkUtils::compDateCreated(const QFileInfo &lhf, const QFileInfo &rhf)
+{
+    return lhf.birthTime() < rhf.birthTime();
 }
 
-bool DkUtils::compDateCreatedInv(const QFileInfo& lhf, const QFileInfo& rhf) {
-
-	return !compDateCreated(lhf, rhf);
+bool DkUtils::compDateCreatedInv(const QFileInfo &lhf, const QFileInfo &rhf)
+{
+    return !compDateCreated(lhf, rhf);
 }
 
-bool DkUtils::compDateModified(const QFileInfo& lhf, const QFileInfo& rhf) {
-
-	return lhf.lastModified() < rhf.lastModified();
+bool DkUtils::compDateModified(const QFileInfo &lhf, const QFileInfo &rhf)
+{
+    return lhf.lastModified() < rhf.lastModified();
 }
 
-bool DkUtils::compDateModifiedInv(const QFileInfo& lhf, const QFileInfo& rhf) {
-
-	return !compDateModified(lhf, rhf);
+bool DkUtils::compDateModifiedInv(const QFileInfo &lhf, const QFileInfo &rhf)
+{
+    return !compDateModified(lhf, rhf);
 }
 
-bool DkUtils::compFilename(const QFileInfo& lhf, const QFileInfo& rhf) {
-
-	return compLogicQString(lhf.fileName(), rhf.fileName());
+bool DkUtils::compFilename(const QFileInfo &lhf, const QFileInfo &rhf)
+{
+    return compLogicQString(lhf.fileName(), rhf.fileName());
 }
 
-bool DkUtils::compFilenameInv(const QFileInfo& lhf, const QFileInfo& rhf) {
-
-	return !compFilename(lhf, rhf);
+bool DkUtils::compFilenameInv(const QFileInfo &lhf, const QFileInfo &rhf)
+{
+    return !compFilename(lhf, rhf);
 }
 
-bool DkUtils::compRandom(const QFileInfo&, const QFileInfo&) {
-
-	return qrand() % 2 != 0;
+bool DkUtils::compFileSize(const QFileInfo &lhf, const QFileInfo &rhf)
+{
+    return lhf.size() < rhf.size();
 }
 
-void DkUtils::addLanguages(QComboBox* langCombo, QStringList& languages) {
+bool DkUtils::compFileSizeInv(const QFileInfo &lhf, const QFileInfo &rhf)
+{
+    return !compFileSize(lhf, rhf);
+}
 
-	QDir qmDir = qApp->applicationDirPath();
+bool DkUtils::compRandom(const QFileInfo &, const QFileInfo &)
+{
+    return QRandomGenerator::global()->generate() % 2 != 0;
+}
 
-	// find all translations
-	QStringList translationDirs = DkSettingsManager::param().getTranslationDirs();
-	QStringList fileNames;
+void DkUtils::addLanguages(QComboBox *langCombo, QStringList &languages)
+{
+    QDir qmDir = qApp->applicationDirPath();
 
-	for (int idx = 0; idx < translationDirs.size(); idx++) {
-		fileNames += QDir(translationDirs[idx]).entryList(QStringList("nomacs_*.qm"));
-	}
+    // find all translations
+    QStringList translationDirs = DkSettingsManager::param().getTranslationDirs();
+    QStringList fileNames;
 
-	langCombo->addItem("English");
-	languages << "en";
+    for (int idx = 0; idx < translationDirs.size(); idx++) {
+        fileNames += QDir(translationDirs[idx]).entryList(QStringList("nomacs_*.qm"));
+    }
 
-	for (int i = 0; i < fileNames.size(); ++i) {
-		QString locale = fileNames[i];
-		locale.remove(0, locale.indexOf('_') + 1);
-		locale.chop(3);
+    langCombo->addItem("English");
+    languages << "en";
 
-		QTranslator translator;
-		DkSettingsManager::param().loadTranslation(fileNames[i], translator);
+    for (int i = 0; i < fileNames.size(); ++i) {
+        QString locale = fileNames[i];
+        locale.remove(0, locale.indexOf('_') + 1);
+        locale.chop(3);
 
-		//: this should be the name of the language in which nomacs is translated to
-		QString language = translator.translate("nmc::DkGlobalSettingsWidget", "English");
-		if (language.isEmpty())
-			continue;
+        QTranslator translator;
+        DkSettingsManager::param().loadTranslation(fileNames[i], translator);
 
-		langCombo->addItem(language);
-		languages << locale;
-	}
+        //: this should be the name of the language in which nomacs is translated to
+        QString language = translator.translate("nmc::DkGlobalSettingsWidget", "English");
+        if (language.isEmpty())
+            continue;
 
-	langCombo->setCurrentIndex(languages.indexOf(DkSettingsManager::param().global().language));
-	if (langCombo->currentIndex() == -1) // set index to English if language has not been found
-		langCombo->setCurrentIndex(0);
+        langCombo->addItem(language);
+        languages << locale;
+    }
 
+    langCombo->setCurrentIndex(languages.indexOf(DkSettingsManager::param().global().language));
+    if (langCombo->currentIndex() == -1) // set index to English if language has not been found
+        langCombo->setCurrentIndex(0);
 }
 
 /// <summary>
@@ -386,165 +386,146 @@ void DkUtils::addLanguages(QComboBox* langCombo, QStringList& languages) {
 /// <param name="type">The message type (QtDebugMsg are not written to the log).</param>
 /// <param name=""></param>
 /// <param name="msg">The message.</param>
-void qtMessageOutput(QtMsgType type, const QMessageLogContext &, const QString &msg) {
-
-	if (!DkSettingsManager::param().app().useLogFile)
-		return;
-
-	DkUtils::logToFile(type, msg);
-}
-
-void DkUtils::logToFile(QtMsgType type, const QString &msg) {
-
-#if QT_VERSION >= 0x050500
-
-	static QString filePath;
-
-	if (filePath.isEmpty())
-		filePath = DkUtils::getLogFilePath();
-
-	QString txt;
-
-	switch (type) {
-	case QtDebugMsg:
-		return;	// ignore debug messages
-		break;
-	case QtInfoMsg:
-		txt = msg;
-		break;
-	case QtWarningMsg:
-		txt = "[Warning] " + msg;
-		break;
-	case QtCriticalMsg:
-		txt = "[Critical] " + msg;
-		break;
-	case QtFatalMsg:
-		txt = "[FATAL] " + msg;
-		break;
-	default:
-		//txt = "unknown message type: " + QString::number(type) + msg;
-		return;
-	}
+void qtMessageOutput(QtMsgType type, const QMessageLogContext &, const QString &msg)
+{
+    if (!DkSettingsManager::param().app().useLogFile)
+        return;
+
+    DkUtils::logToFile(type, msg);
+}
+
+void DkUtils::logToFile(QtMsgType type, const QString &msg)
+{
+    static QString filePath;
+
+    if (filePath.isEmpty())
+        filePath = DkUtils::getLogFilePath();
+
+    QString txt;
+
+    switch (type) {
+    case QtDebugMsg:
+        return; // ignore debug messages
+        break;
+    case QtInfoMsg:
+        txt = msg;
+        break;
+    case QtWarningMsg:
+        txt = "[Warning] " + msg;
+        break;
+    case QtCriticalMsg:
+        txt = "[Critical] " + msg;
+        break;
+    case QtFatalMsg:
+        txt = "[FATAL] " + msg;
+        break;
+    default:
+        // txt = "unknown message type: " + QString::number(type) + msg;
+        return;
+    }
 
-	QFile outFile(filePath);
-	if (!outFile.open(QIODevice::WriteOnly | QIODevice::Append))
-		printf("cannot open %s for logging\n", filePath.toStdString().c_str());
+    QFile outFile(filePath);
+    if (!outFile.open(QIODevice::WriteOnly | QIODevice::Append))
+        printf("cannot open %s for logging\n", filePath.toStdString().c_str());
 
-	QTextStream ts(&outFile);
-	ts << txt << endl;
-#endif
+    QTextStream ts(&outFile);
+    ts << txt << Qt::endl;
 }
 
-void DkUtils::initializeDebug() {
-
-	if (DkSettingsManager::param().app().useLogFile)
-		qInstallMessageHandler(qtMessageOutput);
+void DkUtils::initializeDebug()
+{
+    if (DkSettingsManager::param().app().useLogFile)
+        qInstallMessageHandler(qtMessageOutput);
 
-	// format console
-	QString p = "%{if-info}[INFO] %{endif}%{if-warning}[WARNING] %{endif}%{if-critical}[CRITICAL] %{endif}%{if-fatal}[ERROR] %{endif}%{message}";
-	qSetMessagePattern(p);
+    // format console
+    QString p = "%{if-info}[INFO] %{endif}%{if-warning}[WARNING] %{endif}%{if-critical}[CRITICAL] %{endif}%{if-fatal}[ERROR] %{endif}%{message}";
+    qSetMessagePattern(p);
 }
 
-QString DkUtils::getLogFilePath() {
+QString DkUtils::getLogFilePath()
+{
+    QString logPath = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
+    QString now = QDateTime::currentDateTime().toString("yyyy-MM-dd HH-mm-ss");
 
-	QString logPath = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
-	QString now = QDateTime::currentDateTime().toString("yyyy-MM-dd HH-mm-ss");
+    static QFileInfo fileInfo(logPath, "nomacs-" + now + "-log.txt");
 
-	static QFileInfo fileInfo(logPath, "nomacs-" + now + "-log.txt");
-
-	return fileInfo.absoluteFilePath();
+    return fileInfo.absoluteFilePath();
 }
 
-QString DkUtils::getAppDataPath() {
-
-	QString appPath;
+QString DkUtils::getAppDataPath()
+{
+    QString appPath;
 
-#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
-	// this gives us a roaming profile on windows
-	appPath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
-#elif QT_VERSION >= 0x050000
-	appPath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation);
+    // this gives us a roaming profile on windows
+    appPath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
 
-	// make our own folder - AppDataLocation already does this...
-	appPath += QDir::separator() + QCoreApplication::organizationName();
-#else
-	appPath = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
-	// make our own folder
-	appPath += QDir::separator() + QCoreApplication::organizationName();
-#endif
+    if (!QDir().mkpath(appPath))
+        qWarning() << "I could not create" << appPath;
 
-	
-	if (!QDir().mkpath(appPath))
-		qWarning() << "I could not create" << appPath;
-
-	return appPath;
+    return appPath;
 }
 
-QString DkUtils::getTranslationPath() {
-
-	QString trPath;
+QString DkUtils::getTranslationPath()
+{
+    QString trPath;
 
-	if (DkSettingsManager::param().isPortable())
-		trPath = QCoreApplication::applicationDirPath();
-	else
-		trPath = DkUtils::getAppDataPath();
+    if (DkSettingsManager::param().isPortable())
+        trPath = QCoreApplication::applicationDirPath();
+    else
+        trPath = DkUtils::getAppDataPath();
 
-	trPath += QDir::separator() + QString("translations");
+    trPath += QDir::separator() + QString("translations");
 
-	if (!QDir().mkpath(trPath))
-		qWarning() << "I could not create" << trPath;
+    if (!QDir().mkpath(trPath))
+        qWarning() << "I could not create" << trPath;
 
-	return trPath;
+    return trPath;
 }
 
-QWidget * DkUtils::getMainWindow() {
-
-	QWidgetList widgets = QApplication::topLevelWidgets();
+QWidget *DkUtils::getMainWindow()
+{
+    QWidgetList widgets = QApplication::topLevelWidgets();
 
-	QMainWindow* win = 0;
+    QMainWindow *win = 0;
 
-	for (int idx = 0; idx < widgets.size(); idx++) {
-
-		if (widgets.at(idx)->inherits("QMainWindow")) {
-			win = qobject_cast<QMainWindow*>(widgets.at(idx));
-			break;
-		}
-	}
+    for (int idx = 0; idx < widgets.size(); idx++) {
+        if (widgets.at(idx)->inherits("QMainWindow")) {
+            win = qobject_cast<QMainWindow *>(widgets.at(idx));
+            break;
+        }
+    }
 
-	return win;
+    return win;
 }
 
-QSize DkUtils::getInitialDialogSize() {
-
-	auto win = getMainWindow();
+QSize DkUtils::getInitialDialogSize()
+{
+    auto win = getMainWindow();
 
-	if (!win)
-		return QSize(1024, 768);
+    if (!win)
+        return QSize(1024, 768);
 
-	double width = qMax(win->width() * 0.8, 600.0);
-	double height = qMax(width * 9 / 16, 450.0);
-	QSize s(qRound(width), qRound(height));
+    double width = qMax(win->width() * 0.8, 600.0);
+    double height = qMax(width * 9 / 16, 450.0);
+    QSize s(qRound(width), qRound(height));
 
-	return s;
+    return s;
 }
 
-void DkUtils::mSleep(int ms) {
-
+void DkUtils::mSleep(int ms)
+{
 #ifdef Q_OS_WIN
-	Sleep(uint(ms));
+    Sleep(uint(ms));
 #else
-	struct timespec ts = { ms / 1000, (ms % 1000) * 1000 * 1000 };
-	nanosleep(&ts, NULL);
+    struct timespec ts = {ms / 1000, (ms % 1000) * 1000 * 1000};
+    nanosleep(&ts, NULL);
 #endif
-
 }
 
-
-bool DkUtils::exists(const QFileInfo& file, int waitMs) {
-
-	QFuture<bool> future = QtConcurrent::run(
-#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
-		// TODO: if we have a lot of mounted files (windows) in the history
+bool DkUtils::exists(const QFileInfo &file, int waitMs)
+{
+    QFuture<bool> future = QtConcurrent::run(
+        // TODO: if we have a lot of mounted files (windows) in the history
         // we can potentially exhaust the pool & image loading has
         // to wait for these exists
         // I now only moved it to the thumbnail pool which does
@@ -552,60 +533,61 @@ bool DkUtils::exists(const QFileInfo& file, int waitMs) {
         // we could
         // - create a dedicated pool for exists
         // - create a dedicated pool for image loading
-        DkThumbsThreadPool::pool(),		// hook it to the thumbs pool
-#endif
-		&DkUtils::checkFile, file);
+        DkThumbsThreadPool::pool(), // hook it to the thumbs pool
+        &DkUtils::checkFile,
+        file);
 
-	for (int idx = 0; idx < waitMs; idx++) {
-		if (future.isFinished())
-			break;
+    for (int idx = 0; idx < waitMs; idx++) {
+        if (future.isFinished())
+            break;
 
-		//qDebug() << "you are trying the new exists method... - you are modern!";
+        // qDebug() << "you are trying the new exists method... - you are modern!";
 
-		mSleep(1);
-	}
+        mSleep(1);
+    }
 
-	//future.cancel();
+    // future.cancel();
 
-	// assume file is not existing if it took longer than waitMs
-	return (future.isFinished()) ? future : false;
+    // assume file is not existing if it took longer than waitMs
+    return (future.isFinished()) ? future.result() : false;
 }
 
-bool DkUtils::checkFile(const QFileInfo& file) {
-
-	return file.exists();
+bool DkUtils::checkFile(const QFileInfo &file)
+{
+    return file.exists();
 }
 
-QFileInfo DkUtils::urlToLocalFile(const QUrl& url) {
+QFileInfo DkUtils::urlToLocalFile(const QUrl &url)
+{
+    QUrl lurl = QUrl::fromUserInput(url.toString());
 
-	QUrl lurl = QUrl::fromUserInput(url.toString());
+    // try manual conversion first, this fixes the DSC#josef.jpg problems (url fragments)
+    QString fString = lurl.toString();
+    fString = fString.replace("file:///", "");
 
-	// try manual conversion first, this fixes the DSC#josef.jpg problems (url fragments)
-	QString fString = lurl.toString();
-	fString = fString.replace("file:///", "");
+    QFileInfo file = QFileInfo(fString);
+    if (!file.exists()) // try an alternative conversion
+        file = QFileInfo(lurl.toLocalFile());
 
-	QFileInfo file = QFileInfo(fString);
-	if (!file.exists())	// try an alternative conversion
-		file = QFileInfo(lurl.toLocalFile());
-
-	return file;
+    return file;
 }
 
-QString DkUtils::fileNameFromUrl(const QUrl& url) {
-	
-	QString name(url.toString());
+QString DkUtils::fileNameFromUrl(const QUrl &url)
+{
+    QString name(url.toString());
+
+    // get Tweety.svg from https://upload.wikimedia.org/wikipedia/en/0/02/Tweety.svg
+    name = name.split("/").last();
+    // get 100919-snoop-dogg-feature.jpg from
+    // https://thenypost.files.wordpress.com/2019/10/100919-snoop-dogg-feature.jpg?quality=90&strip=all&w=618&h=410&crop=1
+    name = name.split("?").first();
 
-	// get Tweety.svg from https://upload.wikimedia.org/wikipedia/en/0/02/Tweety.svg
-	name = name.split("/").last(); 
-	// get 100919-snoop-dogg-feature.jpg from https://thenypost.files.wordpress.com/2019/10/100919-snoop-dogg-feature.jpg?quality=90&strip=all&w=618&h=410&crop=1
-	name = name.split("?").first(); 
-	
-	return name;
+    return name;
 }
 
-QString DkUtils::nowString() {
-	
-	return QDateTime::currentDateTime().toString("yyyy-MM-dd hh.mm.ss");
+QString DkUtils::nowString()
+{
+    return QDateTime::currentDateTime().toString("yyyy-MM-dd hh.mm.ss");
 }
 
 /**
@@ -613,18 +595,20 @@ QString DkUtils::nowString() {
  * @param file is an existing file.
  * @return true, if file exists and has content we support, false otherwise.
  */
-bool isValidByContent(const QFileInfo& file) {
-
-    if(!file.exists()) return false;
-    if(!file.isFile()) return false;
+bool isValidByContent(const QFileInfo &file)
+{
+    if (!file.exists())
+        return false;
+    if (!file.isFile())
+        return false;
 
     QMimeDatabase mimeDb;
     QMimeType fileMimeType = mimeDb.mimeTypeForFile(file, QMimeDatabase::MatchContent);
 
-    for(QString sfx: fileMimeType.suffixes()) {
+    for (QString sfx : fileMimeType.suffixes()) {
         QString tryFilename = file.fileName() + QString(".") + sfx;
 
-        if(DkUtils::hasValidSuffix(tryFilename)) {
+        if (DkUtils::hasValidSuffix(tryFilename)) {
             return true;
         }
     }
@@ -636,393 +620,324 @@ bool isValidByContent(const QFileInfo& file) {
  * @param fileInfo the file info of the file to be validated.
  * @return bool true if the file format is supported.
  **/
-bool DkUtils::isValid(const QFileInfo& fileInfo) {
+bool DkUtils::isValid(const QFileInfo &fileInfo)
+{
+    QFileInfo fInfo = fileInfo;
+    QString fileName = fInfo.fileName();
 
-	QFileInfo fInfo = fileInfo;
-	QString fileName = fInfo.fileName();
-
-	if (fInfo.isSymLink())
-		fInfo = fileInfo.symLinkTarget();
+    if (fInfo.isSymLink())
+        fInfo = QFileInfo(fileInfo.symLinkTarget());
 
     if (!fInfo.exists()) {
-		return false;
-    } 
-	else if (hasValidSuffix(fInfo.fileName()))  {
-		return true;
-    } 
-	else if (isValidByContent(fInfo))  {
-		return true;
+        return false;
+    } else if (hasValidSuffix(fInfo.fileName())) {
+        return true;
+    } else if (isValidByContent(fInfo)) {
+        return true;
     }
 
     return false;
 }
 
-bool DkUtils::isSavable(const QString & fileName) {
-	
-	QStringList cleanSaveFilters = suffixOnly(DkSettingsManager::param().app().saveFilters);
-
-	for (const QString& cFilter : cleanSaveFilters) {
+bool DkUtils::isSavable(const QString &fileName)
+{
+    QStringList cleanSaveFilters = suffixOnly(DkSettingsManager::param().app().saveFilters);
 
-		QRegExp exp = QRegExp(cFilter, Qt::CaseInsensitive);
-		exp.setPatternSyntax(QRegExp::Wildcard);
+    for (const QString &cFilter : cleanSaveFilters) {
+        QRegExp exp = QRegExp(cFilter, Qt::CaseInsensitive);
+        exp.setPatternSyntax(QRegExp::Wildcard);
 
-		qDebug() << "checking extension: " << exp;
+        qDebug() << "checking extension: " << exp;
 
-		if (exp.exactMatch(fileName))
-			return true;
-	}
+        if (exp.exactMatch(fileName))
+            return true;
+    }
 
-	return false;
+    return false;
 }
 
-bool DkUtils::hasValidSuffix(const QString& fileName) {
-
-	for (int idx = 0; idx < DkSettingsManager::param().app().fileFilters.size(); idx++) {
-
-		QRegExp exp = QRegExp(DkSettingsManager::param().app().fileFilters.at(idx), Qt::CaseInsensitive);
-		exp.setPatternSyntax(QRegExp::Wildcard);
-		if (exp.exactMatch(fileName))
-			return true;
-	}
+bool DkUtils::hasValidSuffix(const QString &fileName)
+{
+    for (int idx = 0; idx < DkSettingsManager::param().app().fileFilters.size(); idx++) {
+        QRegExp exp = QRegExp(DkSettingsManager::param().app().fileFilters.at(idx), Qt::CaseInsensitive);
+        exp.setPatternSyntax(QRegExp::Wildcard);
+        if (exp.exactMatch(fileName))
+            return true;
+    }
 
-	return false;
+    return false;
 }
 
-QStringList DkUtils::suffixOnly(const QStringList & fileFilters) {
-
-	// converts a user readable file filter (e.g. WebP (*.webp)) to a suffix only filter
-	QStringList cleanedFilters;
+QStringList DkUtils::suffixOnly(const QStringList &fileFilters)
+{
+    // converts a user readable file filter (e.g. WebP (*.webp)) to a suffix only filter
+    QStringList cleanedFilters;
 
-	for (QString cFilter : fileFilters) {
-		
-		cFilter = cFilter.section(QRegExp("(\\(|\\))"), 1);
-		cFilter = cFilter.replace(")", "");
-		cleanedFilters += cFilter.split(" ");
-	}
+    for (QString cFilter : fileFilters) {
+        cFilter = cFilter.section(QRegularExpression("(\\(|\\))"), 1);
+        cFilter = cFilter.replace(")", "");
+        cleanedFilters += cFilter.split(" ");
+    }
 
-	return cleanedFilters;
+    return cleanedFilters;
 }
 
-QDateTime DkUtils::getConvertableDate(const QString& date) {
-
-	QDateTime dateCreated;
-	QStringList dateSplit = date.split(QRegExp("[/: \t]"));
-
-	if (date.count(":") != 4 /*|| date.count(QRegExp("\t")) != 1*/)
-		return dateCreated;
+QDateTime DkUtils::getConvertableDate(const QString &date)
+{
+    QDateTime dateCreated;
+    QStringList dateSplit = date.split(QRegularExpression("[/: \t]"));
 
-	if (dateSplit.size() >= 3) {
+    if (date.count(":") != 4 /*|| date.count(QRegExp("\t")) != 1*/)
+        return dateCreated;
 
-		int y = dateSplit[0].toInt();
-		int m = dateSplit[1].toInt();
-		int d = dateSplit[2].toInt();
+    if (dateSplit.size() >= 3) {
+        int y = dateSplit[0].toInt();
+        int m = dateSplit[1].toInt();
+        int d = dateSplit[2].toInt();
 
-		if (y == 0 || m == 0 || d == 0)
-			return dateCreated;
+        if (y == 0 || m == 0 || d == 0)
+            return dateCreated;
 
-		QDate dateV = QDate(y, m, d);
-		QTime time;
+        QDate dateV = QDate(y, m, d);
+        QTime time;
 
-		if (dateSplit.size() >= 6)
-			time = QTime(dateSplit[3].toInt(), dateSplit[4].toInt(), dateSplit[5].toInt());
+        if (dateSplit.size() >= 6)
+            time = QTime(dateSplit[3].toInt(), dateSplit[4].toInt(), dateSplit[5].toInt());
 
-		dateCreated = QDateTime(dateV, time);
-	}
-
-	return dateCreated;
-}
-
-QDateTime DkUtils::convertDate(const QString& date, const QFileInfo& file) {
-
-	// convert date
-	QDateTime dateCreated;
-	QStringList dateSplit = date.split(QRegExp("[/: \t]"));
-
-	if (dateSplit.size() >= 3) {
-
-		QDate dateV = QDate(dateSplit[0].toInt(), dateSplit[1].toInt(), dateSplit[2].toInt());
-		QTime time;
-
-		if (dateSplit.size() >= 6)
-			time = QTime(dateSplit[3].toInt(), dateSplit[4].toInt(), dateSplit[5].toInt());
-
-		dateCreated = QDateTime(dateV, time);
-	}
-	else if (file.exists())
-		dateCreated = file.created();
+        dateCreated = QDateTime(dateV, time);
+    }
 
-	return dateCreated;
+    return dateCreated;
 }
 
-QString DkUtils::convertDateString(const QString& date, const QFileInfo& file) {
+QDateTime DkUtils::convertDate(const QString &date, const QFileInfo &file)
+{
+    // convert date
+    QDateTime dateCreated;
+    QStringList dateSplit = date.split(QRegularExpression("[/: \t]"));
 
-	// convert date
-	QString dateConverted;
-	QStringList dateSplit = date.split(QRegExp("[/: \t]"));
+    if (dateSplit.size() >= 3) {
+        QDate dateV = QDate(dateSplit[0].toInt(), dateSplit[1].toInt(), dateSplit[2].toInt());
+        QTime time;
 
-	if (dateSplit.size() >= 3) {
+        if (dateSplit.size() >= 6)
+            time = QTime(dateSplit[3].toInt(), dateSplit[4].toInt(), dateSplit[5].toInt());
 
-		QDate dateV = QDate(dateSplit[0].toInt(), dateSplit[1].toInt(), dateSplit[2].toInt());
-		dateConverted = dateV.toString(Qt::SystemLocaleShortDate);
+        dateCreated = QDateTime(dateV, time);
+    } else if (file.exists())
+        dateCreated = file.birthTime();
 
-		if (dateSplit.size() >= 6) {
-			QTime time = QTime(dateSplit[3].toInt(), dateSplit[4].toInt(), dateSplit[5].toInt());
-			dateConverted += " " + time.toString(Qt::SystemLocaleShortDate);
-		}
-	}
-	else if (file.exists()) {
-		QDateTime dateCreated = file.created();
-		dateConverted += dateCreated.toString(Qt::SystemLocaleShortDate);
-	}
-	else
-		dateConverted = "unknown date";
-
-	return dateConverted;
+    return dateCreated;
 }
 
-QString DkUtils::formatToString(int format) {
+QString DkUtils::convertDateString(const QString &date, const QFileInfo &file)
+{
+    // convert date
+    QString dateConverted;
+    QStringList dateSplit = date.split(QRegularExpression("[/: \t]"));
 
-	QString msg;
+    if (dateSplit.size() >= 3) {
+        QDate dateV = QDate(dateSplit[0].toInt(), dateSplit[1].toInt(), dateSplit[2].toInt());
+        dateConverted = dateV.toString();
 
-	switch (format) {
-	case QImage::Format_Mono:
-	case QImage::Format_MonoLSB:					msg = QObject::tr("Binary"); break;
-	case QImage::Format_Indexed8:					msg = QObject::tr("Indexed 8-bit"); break;
-	case QImage::Format_RGBX8888:
-	case QImage::Format_RGBA8888_Premultiplied:
-#if QT_VERSION >= 0x050500
-	case QImage::Format_RGB30:
-#endif
-	case QImage::Format_RGB32:						msg = QObject::tr("RGB 32-bit"); break;
-	case QImage::Format_ARGB32_Premultiplied:
-	case QImage::Format_RGBA8888:
-#if QT_VERSION >= 0x050500
-	case QImage::Format_A2RGB30_Premultiplied:
-#endif
-	case QImage::Format_ARGB32:						msg = QObject::tr("ARGB 32-bit"); break;
-	case QImage::Format_RGB555:
-	case QImage::Format_RGB444:
-	case QImage::Format_RGB16:						msg = QObject::tr("RGB 16-bit"); break;
-	case QImage::Format_ARGB6666_Premultiplied:
-	case QImage::Format_ARGB8555_Premultiplied:
-	case QImage::Format_ARGB8565_Premultiplied:		msg = QObject::tr("ARGB 24-bit"); break;
-	case QImage::Format_RGB888:
-	case QImage::Format_RGB666:						msg = QObject::tr("RGB 24-bit"); break;
-	case QImage::Format_ARGB4444_Premultiplied:		msg = QObject::tr("ARGB 16-bit"); break;
-
-#if QT_VERSION >= 0x050500
-	case QImage::Format_BGR30:						msg = QObject::tr("BGR 32-bit"); break;
-	case QImage::Format_A2BGR30_Premultiplied:		msg = QObject::tr("ABGR 32-bit"); break;
-	case QImage::Format_Grayscale8:					msg = QObject::tr("Grayscale 8-bit"); break;
-	case QImage::Format_Alpha8:						msg = QObject::tr("Alpha 8-bit"); break;
-#endif
-	}
+        if (dateSplit.size() >= 6) {
+            QTime time = QTime(dateSplit[3].toInt(), dateSplit[4].toInt(), dateSplit[5].toInt());
+            dateConverted += " " + time.toString();
+        }
+    } else if (file.exists()) {
+        QDateTime dateCreated = file.birthTime();
+        dateConverted += dateCreated.toString();
+    } else
+        dateConverted = "unknown date";
+
+    return dateConverted;
+}
+
+QString DkUtils::formatToString(int format)
+{
+    QString msg;
+
+    switch (format) {
+    case QImage::Format_Mono:
+    case QImage::Format_MonoLSB:
+        msg = QObject::tr("Binary");
+        break;
+    case QImage::Format_Indexed8:
+        msg = QObject::tr("Indexed 8-bit");
+        break;
+    case QImage::Format_RGBX8888:
+    case QImage::Format_RGBA8888_Premultiplied:
+    case QImage::Format_RGB30:
+    case QImage::Format_RGB32:
+        msg = QObject::tr("RGB 32-bit");
+        break;
+    case QImage::Format_ARGB32_Premultiplied:
+    case QImage::Format_RGBA8888:
+    case QImage::Format_A2RGB30_Premultiplied:
+    case QImage::Format_ARGB32:
+        msg = QObject::tr("ARGB 32-bit");
+        break;
+    case QImage::Format_RGB555:
+    case QImage::Format_RGB444:
+    case QImage::Format_RGB16:
+        msg = QObject::tr("RGB 16-bit");
+        break;
+    case QImage::Format_ARGB6666_Premultiplied:
+    case QImage::Format_ARGB8555_Premultiplied:
+    case QImage::Format_ARGB8565_Premultiplied:
+        msg = QObject::tr("ARGB 24-bit");
+        break;
+    case QImage::Format_RGB888:
+    case QImage::Format_RGB666:
+        msg = QObject::tr("RGB 24-bit");
+        break;
+    case QImage::Format_ARGB4444_Premultiplied:
+        msg = QObject::tr("ARGB 16-bit");
+        break;
+
+    case QImage::Format_BGR30:
+        msg = QObject::tr("BGR 32-bit");
+        break;
+    case QImage::Format_A2BGR30_Premultiplied:
+        msg = QObject::tr("ABGR 32-bit");
+        break;
+    case QImage::Format_Grayscale8:
+        msg = QObject::tr("Grayscale 8-bit");
+        break;
+    case QImage::Format_Alpha8:
+        msg = QObject::tr("Alpha 8-bit");
+        break;
+    }
 
-	return msg;
+    return msg;
 }
 
-QString DkUtils::colorToString(const QColor& col) {
-
-	return "rgba(" + QString::number(col.red()) + "," + QString::number(col.green()) + "," + QString::number(col.blue()) + "," + QString::number((float)col.alpha()/255.0f*100.0f) + "%)";
+QString DkUtils::colorToString(const QColor &col)
+{
+    return "rgba(" + QString::number(col.red()) + "," + QString::number(col.green()) + "," + QString::number(col.blue()) + ","
+        + QString::number((float)col.alpha() / 255.0f * 100.0f) + "%)";
 }
 
-QStringList DkUtils::filterStringList(const QString& query, const QStringList& list) {
+QStringList DkUtils::filterStringList(const QString &query, const QStringList &list)
+{
+    // white space is the magic thingy
+    QStringList queries = query.split(" ");
+    QStringList resultList = list;
 
-	// white space is the magic thingy
-	QStringList queries = query.split(" ");
-	QStringList resultList = list;
-
-	for (int idx = 0; idx < queries.size(); idx++) {
-		// Detect and correct special case where a space is leading or trailing the search term - this should be significant
-		if (idx == 0 && queries.size() > 1 && queries[idx].size() == 0) queries[idx] = " " + queries[idx + 1];
-		if (idx == queries.size() - 1 && queries.size() > 2 && queries[idx].size() == 0) queries[idx] = queries[idx - 1] + " ";
-		// The queries will be repeated, but this is okay - it will just be matched both with and without the space. 
-		resultList = resultList.filter(queries[idx], Qt::CaseInsensitive);
-		qDebug() << "query: " << queries[idx];
-	}
+    for (int idx = 0; idx < queries.size(); idx++) {
+        // Detect and correct special case where a space is leading or trailing the search term - this should be significant
+        if (idx == 0 && queries.size() > 1 && queries[idx].size() == 0)
+            queries[idx] = " " + queries[idx + 1];
+        if (idx == queries.size() - 1 && queries.size() > 2 && queries[idx].size() == 0)
+            queries[idx] = queries[idx - 1] + " ";
+        // The queries will be repeated, but this is okay - it will just be matched both with and without the space.
+        resultList = resultList.filter(queries[idx], Qt::CaseInsensitive);
+        qDebug() << "query: " << queries[idx];
+    }
 
-	// if string match returns nothing -> try a regexp
-	if (resultList.empty()) {
-		QRegExp regExp(query);
-		resultList = list.filter(regExp);
+    // if string match returns nothing -> try a regexp
+    if (resultList.empty()) {
+        QRegularExpression regExp(query);
+        resultList = list.filter(regExp);
 
-		if (resultList.empty()) {
-			regExp.setPatternSyntax(QRegExp::Wildcard);
-			resultList = list.filter(regExp);
-		}
-	}
+        if (resultList.empty()) {
+            QString wildcardExp = QRegularExpression::wildcardToRegularExpression(query);
+            QRegularExpression re(QRegularExpression::anchoredPattern(wildcardExp), QRegularExpression::CaseInsensitiveOption);
+            resultList = list.filter(re);
+        }
+    }
 
-	return resultList;
+    return resultList;
 }
 
-bool DkUtils::moveToTrash(const QString& filePath) {
-
-	QFileInfo fileInfo(filePath);
-
-	// delete links
-	if (fileInfo.isSymLink()) {
-		QFile fh(filePath);
-		return fh.remove();
-	}
-
-	if (!fileInfo.exists()) {
-		qDebug() << "Sorry, I cannot delete a non-existing file: " << filePath;
-		return false;
-	}
-
-#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
-
-	// wohooooo - moveToTrash finally made it into Qt : )
-	QFile file(filePath);
-	return file.moveToTrash();
-
-	// code is based on:http://stackoverflow.com/questions/17964439/move-files-to-trash-recycle-bin-in-qt
-#elif defined(Q_OS_WIN)
-
-	std::wstring winPath = (fileInfo.isSymLink()) ? qStringToStdWString(fileInfo.symLinkTarget()) : qStringToStdWString(filePath);
-	winPath.append(1, L'\0');	// path string must be double nul-terminated
-
-	SHFILEOPSTRUCTW shfos = {};
-	shfos.hwnd = nullptr;		// handle to window that will own generated windows, if applicable
-	shfos.wFunc = FO_DELETE;
-	shfos.pFrom = winPath.c_str();
-	shfos.pTo = nullptr;		// not used for deletion operations
-	shfos.fFlags = FOF_ALLOWUNDO | FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT; // use the recycle bin
-
-	const int retVal = SHFileOperationW(&shfos);
-
-	return retVal == 0;		// true if no error code
-
-#elif defined(Q_OS_LINUX)
-
-	// TODO (or not): currently if no one ever deleted something, /share/Trash does not exist -> should we create it?
-	QString trashFilePath = QDir::homePath() + "/.local/share/Trash/files/";    // trash file path contain delete files
-	QString trashFileName = fileInfo.fileName();
-	qInfo() << "deleting to: " << trashFilePath + fileInfo.fileName();
-
-	QFile file(filePath);
-
-	auto createTrashInfo = [&](const QString& filePath) {
-
-		QString trashInfoPath = QDir::homePath() + "/.local/share/Trash/info/";    // trash file path contain delete files
-		QFile ti(trashInfoPath + trashFileName + ".trashinfo");
-
-		if (ti.open(QIODevice::WriteOnly | QIODevice::Text)) {
-			QTextStream stream(&ti);
-			stream << "[Trash Info]\n";
-			stream << "Path=" << filePath << "\n";
-			stream << "DeletionDate=" << QDateTime::currentDateTime().toString("yyyy-MM-ddThh:mm:ss") << "\n";
-			ti.close();
-
-		}
-		else {
-			qWarning() << "could not write trash info...";
-		}
-	};
-
-	bool deleted = false;
-
-	// move to trash
-	if (file.rename(trashFilePath + trashFileName)) {
-		deleted = true;
-	}
-	else {
-		// ok - a file with the same name exists in the trash -> add date-time
-		// fixes #493
-		trashFileName = fileInfo.fileName() + DkUtils::nowString();
-		deleted = file.rename(trashFilePath + trashFileName);
-	}
-
-
-	if (deleted) {
-		createTrashInfo(filePath);
-		return true;
-	}
-	else
-		return false;
-
-#else
-	QFile fileHandle(filePath);
-	return fileHandle.remove();
-#endif
-
-	return false;	// should never be hit
-}
+bool DkUtils::moveToTrash(const QString &filePath)
+{
+    QFileInfo fileInfo(filePath);
 
-QString DkUtils::readableByte(float bytes) {
+    // delete links
+    if (fileInfo.isSymLink()) {
+        QFile fh(filePath);
+        return fh.remove();
+    }
 
-	if (bytes >= 1024*1024*1024) {
-		return QString::number(bytes/(1024.0f*1024.0f*1024.0f), 'f', 2) + " GB";
-	}
-	else if (bytes >= 1024*1024) {
-		return QString::number(bytes/(1024.0f*1024.0f), 'f', 2) + " MB";
-	}
-	else if (bytes >= 1024) {
-		return QString::number(bytes/1024.0f, 'f', 2) + " KB";
-	}
-	else {
-		return QString::number(bytes, 'f', 2) + " B";
-	}
+    if (!fileInfo.exists()) {
+        qDebug() << "Sorry, I cannot delete a non-existing file: " << filePath;
+        return false;
+    }
 
+    // wohooooo - moveToTrash finally made it into Qt : )
+    QFile file(filePath);
+    return file.moveToTrash();
+}
+
+QString DkUtils::readableByte(float bytes)
+{
+    if (bytes >= 1024 * 1024 * 1024) {
+        return QString::number(bytes / (1024.0f * 1024.0f * 1024.0f), 'f', 2) + " GB";
+    } else if (bytes >= 1024 * 1024) {
+        return QString::number(bytes / (1024.0f * 1024.0f), 'f', 2) + " MB";
+    } else if (bytes >= 1024) {
+        return QString::number(bytes / 1024.0f, 'f', 2) + " KB";
+    } else {
+        return QString::number(bytes, 'f', 2) + " B";
+    }
 }
 
-QString DkUtils::cleanFraction(const QString& frac) {
+QString DkUtils::cleanFraction(const QString &frac)
+{
+    QStringList sList = frac.split('/');
+    QString cleanFrac = frac;
 
-	QStringList sList = frac.split('/');
-	QString cleanFrac = frac;
+    if (sList.size() == 2) {
+        int nom = sList[0].toInt(); // nominator
+        int denom = sList[1].toInt(); // denominator
 
-	if (sList.size() == 2) {
-		int nom = sList[0].toInt();		// nominator
-		int denom = sList[1].toInt();	// denominator
+        // if exposure time is less than a second -> compute the gcd for nice values (1/500 instead of 2/1000)
+        if (nom != 0 && denom != 0) {
+            int gcd = DkMath::gcd(denom, nom);
+            cleanFrac = QString::number(nom / gcd);
 
-		// if exposure time is less than a second -> compute the gcd for nice values (1/500 instead of 2/1000)
-		if (nom != 0 && denom != 0) {
-			int gcd = DkMath::gcd(denom, nom);
-			cleanFrac = QString::number(nom/gcd);
+            // do not show fractions like 9/1 -> it is more natural to write 9 in these cases
+            if (denom / gcd != 1)
+                cleanFrac += QString("/") + QString::number(denom / gcd);
 
-			// do not show fractions like 9/1 -> it is more natural to write 9 in these cases
-			if (denom/gcd != 1)
-				 cleanFrac += QString("/") + QString::number(denom/gcd);
-
-			qDebug() << frac << " >> " << cleanFrac;
-		}
-	}
+            qDebug() << frac << " >> " << cleanFrac;
+        }
+    }
 
-	return cleanFrac;
+    return cleanFrac;
 }
 
-QString DkUtils::resolveFraction(const QString& frac) {
-
-	QString result = frac;
-	QStringList sList = frac.split('/');
+QString DkUtils::resolveFraction(const QString &frac)
+{
+    QString result = frac;
+    QStringList sList = frac.split('/');
 
-	if (sList.size() == 2) {
+    if (sList.size() == 2) {
+        bool nok = false;
+        bool dok = false;
+        int nom = sList[0].toInt(&nok);
+        int denom = sList[1].toInt(&dok);
 
-		bool nok = false;
-		bool dok = false;
-		int nom = sList[0].toInt(&nok);
-		int denom = sList[1].toInt(&dok);
-
-		if (nok && dok && denom)
-			result = QString::number((double)nom/denom);
-	}
+        if (nok && dok && denom)
+            result = QString::number((double)nom / denom);
+    }
 
-	return result;
+    return result;
 }
 
-QList<QUrl> DkUtils::findUrlsInTextNewline(QString text){
+QList<QUrl> DkUtils::findUrlsInTextNewline(QString text)
+{
     QList<QUrl> urls;
-    QStringList lines = text.split(QRegExp("\n|\r\n|\r"));
+    QStringList lines = text.split(QRegularExpression("\n|\r\n|\r"));
     for (QString fp : lines) {
-        
-		// fixes urls for windows - yes that actually annoys me
-		fp = fp.replace("\\", "/");
-		
-		QUrl url(fp);
-
-		if (url.isValid()) {
-            
-			if (url.isRelative()){
+        // fixes urls for windows - yes that actually annoys me
+        fp = fp.replace("\\", "/");
+
+        QUrl url(fp);
+
+        if (url.isValid()) {
+            if (url.isRelative()) {
                 url.setScheme("file");
             }
 
@@ -1032,31 +947,32 @@ QList<QUrl> DkUtils::findUrlsInTextNewline(QString text){
     return urls;
 }
 
-
 // code from: http://stackoverflow.com/questions/5625884/conversion-of-stdwstring-to-qstring-throws-linker-error
-std::wstring DkUtils::qStringToStdWString(const QString &str) {
+std::wstring DkUtils::qStringToStdWString(const QString &str)
+{
 #ifdef _MSC_VER
-	return std::wstring((const wchar_t *)str.utf16());
+    return std::wstring((const wchar_t *)str.utf16());
 #else
-	return str.toStdWString();
+    return str.toStdWString();
 #endif
 }
 
 // code from: http://stackoverflow.com/questions/5625884/conversion-of-stdwstring-to-qstring-throws-linker-error
-QString DkUtils::stdWStringToQString(const std::wstring &str) {
+QString DkUtils::stdWStringToQString(const std::wstring &str)
+{
 #ifdef _MSC_VER
-	return QString::fromUtf16((const ushort *)str.c_str());
+    return QString::fromUtf16((const ushort *)str.c_str());
 #else
-	return QString::fromStdWString(str);
+    return QString::fromStdWString(str);
 #endif
 }
 
 // DkConvertFileName --------------------------------------------------------------------
-DkFileNameConverter::DkFileNameConverter(const QString& fileName, const QString& pattern, int cIdx) {
-
-	this->mFileName = fileName;
-	this->mPattern = pattern;
-	this->mCIdx = cIdx;
+DkFileNameConverter::DkFileNameConverter(const QString &fileName, const QString &pattern, int cIdx)
+{
+    this->mFileName = fileName;
+    this->mPattern = pattern;
+    this->mCIdx = cIdx;
 }
 
 /**
@@ -1072,289 +988,294 @@ DkFileNameConverter::DkFileNameConverter(const QString& fileName, const QString&
  * some-fixed-name-<c:1><d:3>.<old>
  * @return QString
  **/
-QString DkFileNameConverter::getConvertedFileName() {
-
-	QString newFileName = mPattern;
-	QRegExp rx("<.*>");
-	rx.setMinimal(true);
-
-	while (rx.indexIn(newFileName) != -1) {
-		QString tag = rx.cap();
-		QString res = "";
-
-		if (tag.contains("<c:"))
-			res = resolveFilename(tag);
-		else if (tag.contains("<d:"))
-			res = resolveIdx(tag);
-		else if (tag.contains("<old>"))
-			res = resolveExt(tag);
-
-		// replace() replaces all matches - so if two tags are the very same, we save a little computing
-		newFileName = newFileName.replace(tag, res);
-
-	}
+QString DkFileNameConverter::getConvertedFileName()
+{
+    QString newFileName = mPattern;
+    QRegExp rx("<.*>");
+    rx.setMinimal(true);
+
+    while (rx.indexIn(newFileName) != -1) {
+        QString tag = rx.cap();
+        QString res = "";
+
+        if (tag.contains("<c:"))
+            res = resolveFilename(tag);
+        else if (tag.contains("<d:"))
+            res = resolveIdx(tag);
+        else if (tag.contains("<old>"))
+            res = resolveExt(tag);
+
+        // replace() replaces all matches - so if two tags are the very same, we save a little computing
+        newFileName = newFileName.replace(tag, res);
+    }
 
-	return newFileName;
+    return newFileName;
 }
 
-QString DkFileNameConverter::resolveFilename(const QString& tag) const {
+QString DkFileNameConverter::resolveFilename(const QString &tag) const
+{
+    QString result = mFileName;
 
-	QString result = mFileName;
+    // remove extension (Qt's QFileInfo.baseName() does a bad job if you have filenames with dots)
+    result = result.replace("." + QFileInfo(mFileName).suffix(), "");
 
-	// remove extension (Qt's QFileInfo.baseName() does a bad job if you have filenames with dots)
-	result = result.replace("." + QFileInfo(mFileName).suffix(), "");
+    int attr = getIntAttribute(tag);
 
-	int attr = getIntAttribute(tag);
+    if (attr == 1)
+        result = result.toLower();
+    else if (attr == 2)
+        result = result.toUpper();
 
-	if (attr == 1)
-		result = result.toLower();
-	else if (attr == 2)
-		result = result.toUpper();
-
-	return result;
+    return result;
 }
 
-QString DkFileNameConverter::resolveIdx(const QString& tag) const {
-
-	QString result = "";
+QString DkFileNameConverter::resolveIdx(const QString &tag) const
+{
+    QString result = "";
 
-	// append zeros
-	int numZeros = getIntAttribute(tag);
-	int startIdx = getIntAttribute(tag, 2);
-	int fIdx = startIdx+mCIdx;
+    // append zeros
+    int numZeros = getIntAttribute(tag);
+    int startIdx = getIntAttribute(tag, 2);
+    int fIdx = startIdx + mCIdx;
 
-	if (numZeros > 0) {
+    if (numZeros > 0) {
+        // if fIdx <= 0, log10 must not be evaluated
+        int cNumZeros = fIdx > 0 ? numZeros - qFloor(std::log10(fIdx)) : numZeros;
 
-		// if fIdx <= 0, log10 must not be evaluated
-		int cNumZeros = fIdx > 0 ? numZeros - qFloor(std::log10(fIdx)) : numZeros;
-
-		// zero padding
-		for (int idx = 0; idx < cNumZeros; idx++) {
-			result += "0";
-		}
-	}
+        // zero padding
+        for (int idx = 0; idx < cNumZeros; idx++) {
+            result += "0";
+        }
+    }
 
-	result += QString::number(fIdx);
+    result += QString::number(fIdx);
 
-	return result;
+    return result;
 }
 
-QString DkFileNameConverter::resolveExt(const QString&) const {
+QString DkFileNameConverter::resolveExt(const QString &) const
+{
+    QString result = QFileInfo(mFileName).suffix();
 
-	QString result = QFileInfo(mFileName).suffix();
-
-	return result;
+    return result;
 }
 
-int DkFileNameConverter::getIntAttribute(const QString& tag, int idx) const {
-
-	int attr = 0;
+int DkFileNameConverter::getIntAttribute(const QString &tag, int idx) const
+{
+    int attr = 0;
 
-	QStringList num = tag.split(":");
+    QStringList num = tag.split(":");
 
-	if (num.length() > idx) {
-		QString attrStr = num.at(idx);
-		attrStr.replace(">", "");
-		attr = attrStr.toInt();
+    if (num.length() > idx) {
+        QString attrStr = num.at(idx);
+        attrStr.replace(">", "");
+        attr = attrStr.toInt();
 
-		// no negative idx
-		if (attr < 0)
-			return 0;
-	}
+        // no negative idx
+        if (attr < 0)
+            return 0;
+    }
 
-	return attr;
+    return attr;
 }
 
 // TreeItem --------------------------------------------------------------------
-TreeItem::TreeItem(const QVector<QVariant> &data, TreeItem *parent) {
-	parentItem = parent;
-	itemData = data;
+TreeItem::TreeItem(const QVector<QVariant> &data, TreeItem *parent)
+{
+    parentItem = parent;
+    itemData = data;
 }
 
-TreeItem::~TreeItem() {
-	clear();
+TreeItem::~TreeItem()
+{
+    clear();
 }
 
-void TreeItem::clear() {
-	qDeleteAll(childItems);
-	childItems.clear();
+void TreeItem::clear()
+{
+    qDeleteAll(childItems);
+    childItems.clear();
 }
 
-void TreeItem::remove(int rowIdx) {
-	
-	if (rowIdx < childCount()) {
-		delete childItems[rowIdx];
-		childItems.remove(rowIdx);
-	}
+void TreeItem::remove(int rowIdx)
+{
+    if (rowIdx < childCount()) {
+        delete childItems[rowIdx];
+        childItems.remove(rowIdx);
+    }
 }
 
-void TreeItem::appendChild(TreeItem *item) {
-	childItems.append(item);
+void TreeItem::appendChild(TreeItem *item)
+{
+    childItems.append(item);
 }
 
-bool TreeItem::contains(const QRegExp& regExp, int column, bool recursive) const {
+bool TreeItem::contains(const QRegularExpression &regExp, int column, bool recursive) const
+{
+    bool found = false;
 
-	bool found = false;
+    if (column == -1) {
+        for (int idx = 0; idx < columnCount(); idx++)
+            if (contains(regExp, idx))
+                return true;
 
-	if (column == -1) {
-
-		for (int idx = 0; idx < columnCount(); idx++)
-			if (contains(regExp, idx))
-				return true;
-
-		return false;
-	}
+        return false;
+    }
 
-	found = data(column).toString().contains(regExp);
+    found = data(column).toString().contains(regExp);
 
-	// if the parent contains the key, I am valid too
-	TreeItem* p = parent();
-	if (!found && p)
-		found = p->contains(regExp, column, false);	// the parent must not check its kid's again
+    // if the parent contains the key, I am valid too
+    TreeItem *p = parent();
+    if (!found && p)
+        found = p->contains(regExp, column, false); // the parent must not check its kid's again
 
-	// if a child contains the key, I am valid too
-	if (!found && recursive) {
-		for (int idx = 0; idx < childCount(); idx++) {
-			assert(child(idx));
-			found = child(idx)->contains(regExp, column, recursive);
+    // if a child contains the key, I am valid too
+    if (!found && recursive) {
+        for (int idx = 0; idx < childCount(); idx++) {
+            assert(child(idx));
+            found = child(idx)->contains(regExp, column, recursive);
 
-			if (found)
-				break;
-		}
-	}
+            if (found)
+                break;
+        }
+    }
 
-	return found;
+    return found;
 }
 
-TreeItem* TreeItem::child(int row) const {
+TreeItem *TreeItem::child(int row) const
+{
+    if (row < 0 || row >= childItems.size())
+        return 0;
 
-	if (row < 0 || row >= childItems.size())
-		return 0;
-
-	return childItems[row];
+    return childItems[row];
 }
 
-int TreeItem::childCount() const {
-	return childItems.size();
+int TreeItem::childCount() const
+{
+    return childItems.size();
 }
 
-int TreeItem::row() const {
-
-	if (parentItem)
-		return parentItem->childItems.indexOf(const_cast<TreeItem*>(this));
+int TreeItem::row() const
+{
+    if (parentItem)
+        return parentItem->childItems.indexOf(const_cast<TreeItem *>(this));
 
-	return 0;
+    return 0;
 }
 
-int TreeItem::columnCount() const {
+int TreeItem::columnCount() const
+{
+    int columns = itemData.size();
 
-	int columns = itemData.size();
+    for (int idx = 0; idx < childItems.size(); idx++)
+        columns = qMax(columns, childItems[idx]->columnCount());
 
-	for (int idx = 0; idx < childItems.size(); idx++)
-		columns = qMax(columns, childItems[idx]->columnCount());
-
-	return columns;
+    return columns;
 }
 
-QVariant TreeItem::data(int column) const {
-	
-	if (column >= itemData.size())
-		return QVariant();
-	
-	return itemData.value(column);
-}
+QVariant TreeItem::data(int column) const
+{
+    if (column >= itemData.size())
+        return QVariant();
 
-void TreeItem::setData(const QVariant& value, int column) {
+    return itemData.value(column);
+}
 
-	if (column < 0 || column >= itemData.size())
-		return;
+void TreeItem::setData(const QVariant &value, int column)
+{
+    if (column < 0 || column >= itemData.size())
+        return;
 
-	//qDebug() << "replacing: " << itemData[0] << " with: " << value;
-	itemData.replace(column, value);
+    // qDebug() << "replacing: " << itemData[0] << " with: " << value;
+    itemData.replace(column, value);
 }
 
-TreeItem* TreeItem::find(const QVariant& value, int column) {
+TreeItem *TreeItem::find(const QVariant &value, int column)
+{
+    if (column < 0)
+        return 0;
 
-	if (column < 0)
-		return 0;
+    if (column < itemData.size() && itemData[column] == value)
+        return this;
 
-	if (column < itemData.size() && itemData[column] == value)
-		return this;
+    for (int idx = 0; idx < childItems.size(); idx++)
+        if (TreeItem *child = childItems[idx]->find(value, column))
+            return child;
 
-	for (int idx = 0; idx < childItems.size(); idx++)
-		if (TreeItem* child = childItems[idx]->find(value, column))
-			return child;
-
-	return 0;
+    return 0;
 }
 
-QStringList TreeItem::parentList() const {
-
-	QStringList pl;
-	parentList(pl);
+QStringList TreeItem::parentList() const
+{
+    QStringList pl;
+    parentList(pl);
 
-	return pl;
+    return pl;
 }
 
-void TreeItem::parentList(QStringList& parentKeys) const {
-
-	if (parent()) {
-		parent()->parentList(parentKeys);
-		parentKeys << parent()->data(0).toString();
-	}
+void TreeItem::parentList(QStringList &parentKeys) const
+{
+    if (parent()) {
+        parent()->parentList(parentKeys);
+        parentKeys << parent()->data(0).toString();
+    }
 }
 
-TreeItem* TreeItem::parent() const {
-	return parentItem;
+TreeItem *TreeItem::parent() const
+{
+    return parentItem;
 }
 
-void TreeItem::setParent(TreeItem* parent) {
-	parentItem = parent;
+void TreeItem::setParent(TreeItem *parent)
+{
+    parentItem = parent;
 }
 
-bool TabMiddleMouseCloser::eventFilter(QObject *obj, QEvent *event) {
-	if (event->type() == QEvent::MouseButtonRelease) {
-		QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
-		if (mouseEvent->button() == Qt::MidButton) {
-			auto tabbar = static_cast<QTabBar *>(obj);
-			for (int i = 0; i < tabbar->count(); i++) {
-				QRect tabrect = tabbar->tabRect(i);
-				if (tabrect.contains(mouseEvent->pos()))
-					callback(i);
-			}
-			return true;
-		}	
-	}
-
+bool TabMiddleMouseCloser::eventFilter(QObject *obj, QEvent *event)
+{
+    if (event->type() == QEvent::MouseButtonRelease) {
+        QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
+        if (mouseEvent->button() == Qt::MiddleButton) {
+            auto tabbar = static_cast<QTabBar *>(obj);
+            for (int i = 0; i < tabbar->count(); i++) {
+                QRect tabrect = tabbar->tabRect(i);
+                if (tabrect.contains(mouseEvent->pos()))
+                    callback(i);
+            }
+            return true;
+        }
+    }
 
-	return QObject::eventFilter(obj, event);
+    return QObject::eventFilter(obj, event);
 }
 
 // DkRunGuard --------------------------------------------------------------------
-DkRunGuard::DkRunGuard() : mSharedMem(mSharedMemKey) {
-
-	QSystemSemaphore lock(mLockKey, 1);
-	lock.acquire();
-
-	{
-		// this fixes unix issues if the first instance crashes
-		// see here for details: https://habrahabr.ru/post/173281/
-		QSharedMemory fix(mSharedMemKey);
-		fix.attach();
-	}
+DkRunGuard::DkRunGuard()
+    : mSharedMem(mSharedMemKey)
+{
+    QSystemSemaphore lock(mLockKey, 1);
+    lock.acquire();
+
+    {
+        // this fixes unix issues if the first instance crashes
+        // see here for details: https://habrahabr.ru/post/173281/
+        QSharedMemory fix(mSharedMemKey);
+        fix.attach();
+    }
 
-	lock.release();
+    lock.release();
 }
 
-DkRunGuard::~DkRunGuard() {
-
-	QSystemSemaphore lock(mLockKey, 1);
-	lock.acquire();
+DkRunGuard::~DkRunGuard()
+{
+    QSystemSemaphore lock(mLockKey, 1);
+    lock.acquire();
 
-	if (mSharedMem.isAttached())
-		mSharedMem.detach();
+    if (mSharedMem.isAttached())
+        mSharedMem.detach();
 
-	lock.release();
+    lock.release();
 }
 
 /// <summary>
@@ -1362,20 +1283,20 @@ DkRunGuard::~DkRunGuard() {
 /// If it's the first instance, a shared memory block is created.
 /// </summary>
 /// <returns>true if this is the first instance</returns>
-bool DkRunGuard::tryRunning() {
-
-	QSystemSemaphore lock(mLockKey, 1);
-	lock.acquire();
+bool DkRunGuard::tryRunning()
+{
+    QSystemSemaphore lock(mLockKey, 1);
+    lock.acquire();
 
-	// check if we can attach to the shared memory
-	// if not: we are the first
-	bool attached = mSharedMem.attach();
-	if (!attached)
-		mSharedMem.create(sizeof(quint64));
+    // check if we can attach to the shared memory
+    // if not: we are the first
+    bool attached = mSharedMem.attach();
+    if (!attached)
+        mSharedMem.create(sizeof(quint64));
 
-	lock.release();
+    lock.release();
 
-	return !attached;
+    return !attached;
 }
 
 }
diff --git a/ImageLounge/src/DkCore/DkUtils.h b/ImageLounge/src/DkCore/DkUtils.h
index e767aac..7422e77 100644
--- a/ImageLounge/src/DkCore/DkUtils.h
+++ b/ImageLounge/src/DkCore/DkUtils.h
@@ -30,37 +30,38 @@
 #include <functional>
 #include <math.h>
 
-#pragma warning(push, 0)	// no warnings from includes - begin
+#pragma warning(push, 0) // no warnings from includes - begin
+#include <QDebug>
 #include <QFileInfo>
+#include <QRegExp>
 #include <QVector>
-#include <QDebug>
 
 #include <QSharedMemory>
-#pragma warning(pop)		// no warnings from includes - end
+#pragma warning(pop) // no warnings from includes - end
 
-#pragma warning(disable: 4251)	// dll interface missing
-#pragma warning(disable: 4714)	// Qt's force inline
+#pragma warning(disable : 4251) // dll interface missing
+#pragma warning(disable : 4714) // Qt's force inline
 
-#include <assert.h>		// convenience for minimal builds
+#include <assert.h> // convenience for minimal builds
 
 #ifdef QT_NO_DEBUG_OUTPUT
-#pragma warning(disable: 4127)		// no 'conditional expression is constant' if qDebug() messages are removed
+#pragma warning(disable : 4127) // no 'conditional expression is constant' if qDebug() messages are removed
 #endif
 
 #ifndef Q_OS_WIN
-	#include <time.h>
+#include <time.h>
 #endif
 
 #ifdef WITH_OPENCV
 
 #ifdef Q_OS_WIN
-#pragma warning(disable: 4996)
+#pragma warning(disable : 4996)
 #endif
 
 #include "opencv2/core/core.hpp"
 #else
 
-//#define int64 long long;
+// #define int64 long long;
 #include <sstream>
 #define CV_PI 3.141592653589793238462643383279
 #endif
@@ -75,7 +76,7 @@
 #endif
 #endif
 
-#if QT_VERSION >= 0x050500 && !defined(QT_NO_DEBUG_OUTPUT)
+#if !defined(QT_NO_DEBUG_OUTPUT)
 DllCoreExport QDebug qDebugClean();
 DllCoreExport QDebug qInfoClean();
 DllCoreExport QDebug qWarningClean();
@@ -85,10 +86,6 @@ DllCoreExport QDebug qWarningClean();
 #define qWarningClean() qDebug()
 #endif
 
-#if QT_VERSION < 0x050500
-#define qInfo() qDebug() 
-#endif
-
 #define __FILENAME__ (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)
 
 // fixes Qt's damn no latin1 on tr() policy
@@ -99,7 +96,8 @@ class QComboBox;
 class QColor;
 class QUrl;
 
-namespace nmc {
+namespace nmc
+{
 
 // nomacs defines
 class TreeItem;
@@ -107,437 +105,433 @@ class TreeItem;
 /**
  * This class contains general functions which are useful.
  **/
-class DllCoreExport DkUtils {
-
+class DllCoreExport DkUtils
+{
 private:
-
 public:
-
 #ifdef Q_OS_WIN
 
-	/**
-	 * Logical string compare function.
-	 * This function is used to sort:
-	 * a1.png
-	 * a2.png
-	 * a10.png
-	 * instead of:
-	 * a1.png
-	 * a10.png
-	 * a2.png
-	 * @param lhs left string
-	 * @param rhs right string
-	 * @return bool true if left string < right string
-	 **/
-	static bool wCompLogic(const std::wstring & lhs, const std::wstring & rhs);
+    /**
+     * Logical string compare function.
+     * This function is used to sort:
+     * a1.png
+     * a2.png
+     * a10.png
+     * instead of:
+     * a1.png
+     * a10.png
+     * a2.png
+     * @param lhs left string
+     * @param rhs right string
+     * @return bool true if left string < right string
+     **/
+    static bool wCompLogic(const std::wstring &lhs, const std::wstring &rhs);
 #endif
 
-	static bool compLogicQString(const QString & lhs, const QString & rhs);
-
-	static bool compFilename(const QFileInfo & lhf, const QFileInfo & rhf);
-
-	static bool compFilenameInv(const QFileInfo & lhf, const QFileInfo & rhf);
-
-	static bool compDateCreated(const QFileInfo& lhf, const QFileInfo& rhf);
-
-	static bool compDateCreatedInv(const QFileInfo& lhf, const QFileInfo& rhf);
+    static bool compLogicQString(const QString &lhs, const QString &rhs);
 
-	static bool compDateModified(const QFileInfo& lhf, const QFileInfo& rhf);
+    static bool compFilename(const QFileInfo &lhf, const QFileInfo &rhf);
 
-	static bool compDateModifiedInv(const QFileInfo& lhf, const QFileInfo& rhf);
+    static bool compFilenameInv(const QFileInfo &lhf, const QFileInfo &rhf);
 
-	static bool compRandom(const QFileInfo& lhf, const QFileInfo& rhf);
+    static bool compFileSize(const QFileInfo &lhf, const QFileInfo &rhf);
 
-	static bool naturalCompare(const QString& s1, const QString& s2, Qt::CaseSensitivity cs = Qt::CaseSensitive);
+    static bool compFileSizeInv(const QFileInfo &lhf, const QFileInfo &rhf);
 
-	static QString resolveSymLink(const QString& filePath);
+    static bool compDateCreated(const QFileInfo &lhf, const QFileInfo &rhf);
 
-	static QString getLongestNumber(const QString& str, int startIdx = 0);
+    static bool compDateCreatedInv(const QFileInfo &lhf, const QFileInfo &rhf);
 
-	static void addLanguages(QComboBox* langCombo, QStringList& languages);
+    static bool compDateModified(const QFileInfo &lhf, const QFileInfo &rhf);
 
-	static void initializeDebug();
-
-	static void logToFile(QtMsgType type, const QString &msg);
-
-	static QString getLogFilePath();
-
-	static QString getAppDataPath();
-
-	static QString getTranslationPath();
-
-	static QWidget* getMainWindow();
-
-	static QSize getInitialDialogSize();
-
-	/**
-	 * Sleeps n ms.
-	 * This function is based on the QTest::qSleep(int ms)
-	 * @param ms time to sleep
-	 **/
-	static void mSleep(int ms);
-
-	/**
-	 * Fast file exists method.
-	 * This function seems to be a bit unnecessary, however
-	 * at least windows has long (> 10 sec) timeouts if a
-	 * network drive is disconnected and you want to find
-	 * a file on that network. This function calls the normal
-	 * file.exists() but returns false if a timeout > waitMs
-	 * is reached.
-	 * @param file the file to check
-	 * @param waitMs time in milli seconds to wait for file.exists()
-	 * @return bool true if the file exists
-	 **/
-	static bool exists(const QFileInfo& file, int waitMs = 10);
-	static bool checkFile(const QFileInfo& file);
-	static QFileInfo urlToLocalFile(const QUrl& url);
-	static QString fileNameFromUrl(const QUrl& url);
-	static QString nowString();
-	static QString colorToString(const QColor& col);
-	static QString readableByte(float bytes);
-	static QStringList filterStringList(const QString& query, const QStringList& list);
-	static bool moveToTrash(const QString& filePath);
-	static QList<QUrl> findUrlsInTextNewline(QString text);
-
-#ifdef WITH_OPENCV
-	/**
-	 * Prints a matrix to the standard output.
-	 * This is especially useful for copy and pasting e.g.
-	 * histograms to matlab and visualizing them there.
-	 * @param src an image CV_32FC1.
-	 * @param varName the variable name for Matlab.
-	 **/
-	static void printMat(const cv::Mat src, const char* varName) {
-
-		if (src.depth() != CV_32FC1) {
-			//qDebug() << "I could not visualize the mat: " << QString::fromAscii(varName);
-			return;
-		}
-
-		printf("%s = %s", varName, printMat(src).c_str());
-
-	}
-
-	/**
-	 * Prints a matrix to the standard output.
-	 * This is especially useful for copy and pasting e.g.
-	 * histograms to matlab and visualizing them there.
-	 * @param src an image CV_32FC1.
-	 * @param varName the variable name for Matlab.
-	 **/
-	static std::string printMat(const cv::Mat src) {
-
-		if (src.depth() != CV_32FC1) {
-
-			//qDebug() << "I could not visualize the mat: " << QString::fromStdString(DkUtils::getMatInfo(src));
-			return "";
-		}
-
-		std::string msg = " [";	// matlab...
-
-		int cnt = 0;
-
-		for (int rIdx = 0; rIdx < src.rows; rIdx++) {
-
-			const float* srcPtr = src.ptr<float>(rIdx);
-
-			for (int cIdx = 0; cIdx < src.cols; cIdx++, cnt++) {
-
-
-				msg += DkUtils::stringify(srcPtr[cIdx], 3);
-
-				msg += (cIdx < src.cols-1) ? " " : "; "; // next row matlab?
-
-				if (cnt % 7 == 0)
-					msg += "...\n";
-			}
-
-		}
-		msg += "];\n";
-
-		return msg;
-	}
-
-	/**
-	 * Prints the cv::Mat's attributes to the standard output.
-	 * The cv::Mat's attributes are: size, depth, number of channels and
-	 * dynamic range.
-	 * @param img an image (if it has more than one channel, the dynamic range
-	 * is not displayed)
-	 * @param varname the name of the matrix
-	 **/
-	static void getMatInfo(cv::Mat img, std::string varname) {
-
-		printf("%s: %s\n", varname.c_str(), getMatInfo(img).c_str());
-	}
-
-	/**
-	 * Converts the cv::Mat's attributes to a string.
-	 * The cv::Mat's attributes are: size, depth, number of channels and
-	 * dynamic range.
-	 * @param img an image (if it has more than one channel, the dynamic range
-	 * is not converted).
-	 * @return a string with the cv::Mat's attributes.
-	 **/
-	static std::string getMatInfo(cv::Mat img) {
-
-		std::string info = "\n\nimage info:\n";
-
-		if (img.empty()) {
-			info += "   <empty image>\n";
-			return info;
-		}
-
-		info += "   " + DkUtils::stringify(img.rows) + " x " + DkUtils::stringify(img.cols) + " (rows x cols)\n";
-		info += "   channels: " + DkUtils::stringify(img.channels()) + "\n";
-
-		int depth = img.depth();
-		info += "   depth: ";
-		switch (depth) {
-		case CV_8U:
-			info += "CV_8U";
-			break;
-		case CV_32F:
-			info += "CV_32F";
-			break;
-		case CV_16S:
-			info += "CV_16S";
-			break;
-		case CV_16U:
-			info += "CV_16U";
-			break;
-		case CV_32S:
-			info += "CV_32S";
-			break;
-		case CV_64F:
-			info += "CV_64F";
-			break;
-		default:
-			info += "unknown";
-			break;
-		}
-
-		if (img.channels() == 1) {
-			info += "\n   dynamic range: ";
-
-			double min, max;
-			minMaxLoc(img, &min, &max);
-			info += "[" + DkUtils::stringify(min) + " " + DkUtils::stringify(max) + "]\n";
-		}
-		else if (img.channels() > 1) {
-			info += "\n   dynamic range: ";
-
-			double min, max;
-			minMaxLoc(img, &min, &max);
-			info += "[" + DkUtils::stringify(min) + " " + DkUtils::stringify(max) + "]\n";
-		}
-		else
-			info += "\n";
-
-		return info;
-
-	}
-#endif
+    static bool compDateModifiedInv(const QFileInfo &lhf, const QFileInfo &rhf);
 
-	/**
-	 * Appends an attribute name to the filename given.
-	 * generates: image0001.tif -> img0001_mask.tif
-	 * @param fName the filename with extension.
-	 * @param ext the new file extension if it is "" the old extension is used.
-	 * @param attribute the attribute which extends the filename.
-	 * @return the generated filename.
-	 **/
-	static std::string createFileName(std::string fName, std::string attribute, std::string ext = "") {
+    static bool compRandom(const QFileInfo &lhf, const QFileInfo &rhf);
 
-		if (ext == "") ext = fName.substr(fName.length()-4, fName.length()); // use the old extension
+    static bool naturalCompare(const QString &s1, const QString &s2, Qt::CaseSensitivity cs = Qt::CaseSensitive);
 
-		// generate: img0001.tif -> img0001_mask.tif
-		return fName.substr(0, fName.length()-4) + attribute + ext;
-	}
+    static QString resolveSymLink(const QString &filePath);
 
-	static std::string removeExtension(std::string fName) {
+    static QString getLongestNumber(const QString &str, int startIdx = 0);
 
-		return fName.substr(0, fName.find_last_of("."));
-	}
+    static void addLanguages(QComboBox *langCombo, QStringList &languages);
 
-	static std::string getFileNameFromPath(std::string fName) {
-		return fName.substr(fName.find_last_of("/")+1); //TODO: Schiach!!
-	}
+    static void initializeDebug();
 
-	/**
-	 * Converts a number to a string.
-	 * @throws an exception if number is not a number.
-	 * @param number any number.
-	 * @return a string representing the number.
-	 **/
-	template <typename numFmt>
-	static std::string stringify(numFmt number) {
+    static void logToFile(QtMsgType type, const QString &msg);
 
-		std::stringstream stream;
-		if (! (stream << number)) {
-			std::string msg = "Sorry, I could not cast it to a string";
-			//throw DkCastException(msg, __LINE__, __FILE__);
-			printf("%s", msg.c_str());	// TODO: we need a solution for DkSnippet here...
-		}
+    static QString getLogFilePath();
 
-		return stream.str();
-	}
+    static QString getAppDataPath();
 
-	/**
-	 * Converts a number to a string.
-	 * @throws an exception if number is not a number.
-	 * @param number any number.
-	 * @param n the number of decimal places.
-	 * @return a string representing the number.
-	 **/
-	template <typename numFmt>
-	static std::string stringify(numFmt number, double n) {
+    static QString getTranslationPath();
 
-		int rounded = qRound(number * pow(10,n));
+    static QWidget *getMainWindow();
 
-		return stringify(rounded/pow(10,n));
-	}
+    static QSize getInitialDialogSize();
 
-	static bool isValid(const QFileInfo& fileInfo);
-	static bool isSavable(const QString& fileName);
-	static bool hasValidSuffix(const QString& fileName);
-	static QStringList suffixOnly(const QStringList& fileFilters);
-	static QDateTime getConvertableDate(const QString& date);
-	static QDateTime convertDate(const QString& date, const QFileInfo& file = QFileInfo());
-	static QString convertDateString(const QString& date, const QFileInfo& file = QFileInfo());
-	static QString formatToString(int format);
-	static QString cleanFraction(const QString& frac);
-	static QString resolveFraction(const QString& frac);
-	static std::wstring qStringToStdWString(const QString &str);
-	static QString stdWStringToQString(const std::wstring &str);
+    /**
+     * Sleeps n ms.
+     * This function is based on the QTest::qSleep(int ms)
+     * @param ms time to sleep
+     **/
+    static void mSleep(int ms);
 
-	static std::string stringTrim(const std::string str) {
+    /**
+     * Fast file exists method.
+     * This function seems to be a bit unnecessary, however
+     * at least windows has long (> 10 sec) timeouts if a
+     * network drive is disconnected and you want to find
+     * a file on that network. This function calls the normal
+     * file.exists() but returns false if a timeout > waitMs
+     * is reached.
+     * @param file the file to check
+     * @param waitMs time in milli seconds to wait for file.exists()
+     * @return bool true if the file exists
+     **/
+    static bool exists(const QFileInfo &file, int waitMs = 10);
+    static bool checkFile(const QFileInfo &file);
+    static QFileInfo urlToLocalFile(const QUrl &url);
+    static QString fileNameFromUrl(const QUrl &url);
+    static QString nowString();
+    static QString colorToString(const QColor &col);
+    static QString readableByte(float bytes);
+    static QStringList filterStringList(const QString &query, const QStringList &list);
+    static bool moveToTrash(const QString &filePath);
+    static QList<QUrl> findUrlsInTextNewline(QString text);
 
+#ifdef WITH_OPENCV
+    /**
+     * Prints a matrix to the standard output.
+     * This is especially useful for copy and pasting e.g.
+     * histograms to matlab and visualizing them there.
+     * @param src an image CV_32FC1.
+     * @param varName the variable name for Matlab.
+     **/
+    static void printMat(const cv::Mat src, const char *varName)
+    {
+        if (src.depth() != CV_32FC1) {
+            // qDebug() << "I could not visualize the mat: " << QString::fromAscii(varName);
+            return;
+        }
+
+        printf("%s = %s", varName, printMat(src).c_str());
+    }
+
+    /**
+     * Prints a matrix to the standard output.
+     * This is especially useful for copy and pasting e.g.
+     * histograms to matlab and visualizing them there.
+     * @param src an image CV_32FC1.
+     * @param varName the variable name for Matlab.
+     **/
+    static std::string printMat(const cv::Mat src)
+    {
+        if (src.depth() != CV_32FC1) {
+            // qDebug() << "I could not visualize the mat: " << QString::fromStdString(DkUtils::getMatInfo(src));
+            return "";
+        }
+
+        std::string msg = " ["; // matlab...
+
+        int cnt = 0;
+
+        for (int rIdx = 0; rIdx < src.rows; rIdx++) {
+            const float *srcPtr = src.ptr<float>(rIdx);
+
+            for (int cIdx = 0; cIdx < src.cols; cIdx++, cnt++) {
+                msg += DkUtils::stringify(srcPtr[cIdx], 3);
+
+                msg += (cIdx < src.cols - 1) ? " " : "; "; // next row matlab?
+
+                if (cnt % 7 == 0)
+                    msg += "...\n";
+            }
+        }
+        msg += "];\n";
+
+        return msg;
+    }
+
+    /**
+     * Prints the cv::Mat's attributes to the standard output.
+     * The cv::Mat's attributes are: size, depth, number of channels and
+     * dynamic range.
+     * @param img an image (if it has more than one channel, the dynamic range
+     * is not displayed)
+     * @param varname the name of the matrix
+     **/
+    static void getMatInfo(cv::Mat img, std::string varname)
+    {
+        printf("%s: %s\n", varname.c_str(), getMatInfo(img).c_str());
+    }
+
+    /**
+     * Converts the cv::Mat's attributes to a string.
+     * The cv::Mat's attributes are: size, depth, number of channels and
+     * dynamic range.
+     * @param img an image (if it has more than one channel, the dynamic range
+     * is not converted).
+     * @return a string with the cv::Mat's attributes.
+     **/
+    static std::string getMatInfo(cv::Mat img)
+    {
+        std::string info = "\n\nimage info:\n";
+
+        if (img.empty()) {
+            info += "   <empty image>\n";
+            return info;
+        }
+
+        info += "   " + DkUtils::stringify(img.rows) + " x " + DkUtils::stringify(img.cols) + " (rows x cols)\n";
+        info += "   channels: " + DkUtils::stringify(img.channels()) + "\n";
+
+        int depth = img.depth();
+        info += "   depth: ";
+        switch (depth) {
+        case CV_8U:
+            info += "CV_8U";
+            break;
+        case CV_32F:
+            info += "CV_32F";
+            break;
+        case CV_16S:
+            info += "CV_16S";
+            break;
+        case CV_16U:
+            info += "CV_16U";
+            break;
+        case CV_32S:
+            info += "CV_32S";
+            break;
+        case CV_64F:
+            info += "CV_64F";
+            break;
+        default:
+            info += "unknown";
+            break;
+        }
+
+        if (img.channels() == 1) {
+            info += "\n   dynamic range: ";
+
+            double min, max;
+            minMaxLoc(img, &min, &max);
+            info += "[" + DkUtils::stringify(min) + " " + DkUtils::stringify(max) + "]\n";
+        } else if (img.channels() > 1) {
+            info += "\n   dynamic range: ";
+
+            double min, max;
+            minMaxLoc(img, &min, &max);
+            info += "[" + DkUtils::stringify(min) + " " + DkUtils::stringify(max) + "]\n";
+        } else
+            info += "\n";
+
+        return info;
+    }
+#endif
 
-		std::string strT = str;
-
-		if (strT.length() <= 1) return strT;	// .empty() may result in errors
-
-		// remove whitespace
-		size_t b = strT.find_first_not_of(" ");
-		size_t e = strT.find_last_not_of(" ");
-		strT = strT.substr(b, e+1);
-
-		if (strT.length() <= 1) return strT;	// nothing to trim left
-
-		// remove tabs
-		b = strT.find_first_not_of("\t");
-		e = strT.find_last_not_of("\t");
-		strT = strT.substr(b, e+1);
-
-		return strT;
-	};
-
-	static std::string stringRemove(const std::string str, const std::string repStr) {
-
-		std::string strR = str;
-
-		if (strR.length() <= 1) return strR;
-
-		size_t pos = 0;
-
-		while ((pos = strR.find_first_of(repStr)) < strR.npos) {
-
-			strR.erase(pos, repStr.length());
-		}
-
-		return strR;
-	};
-
+    /**
+     * Appends an attribute name to the filename given.
+     * generates: image0001.tif -> img0001_mask.tif
+     * @param fName the filename with extension.
+     * @param ext the new file extension if it is "" the old extension is used.
+     * @param attribute the attribute which extends the filename.
+     * @return the generated filename.
+     **/
+    static std::string createFileName(std::string fName, std::string attribute, std::string ext = "")
+    {
+        if (ext == "")
+            ext = fName.substr(fName.length() - 4, fName.length()); // use the old extension
+
+        // generate: img0001.tif -> img0001_mask.tif
+        return fName.substr(0, fName.length() - 4) + attribute + ext;
+    }
+
+    static std::string removeExtension(std::string fName)
+    {
+        return fName.substr(0, fName.find_last_of("."));
+    }
+
+    static std::string getFileNameFromPath(std::string fName)
+    {
+        return fName.substr(fName.find_last_of("/") + 1); // TODO: Schiach!!
+    }
+
+    /**
+     * Converts a number to a string.
+     * @throws an exception if number is not a number.
+     * @param number any number.
+     * @return a string representing the number.
+     **/
+    template<typename numFmt>
+    static std::string stringify(numFmt number)
+    {
+        std::stringstream stream;
+        if (!(stream << number)) {
+            std::string msg = "Sorry, I could not cast it to a string";
+            // throw DkCastException(msg, __LINE__, __FILE__);
+            printf("%s", msg.c_str()); // TODO: we need a solution for DkSnippet here...
+        }
+
+        return stream.str();
+    }
+
+    /**
+     * Converts a number to a string.
+     * @throws an exception if number is not a number.
+     * @param number any number.
+     * @param n the number of decimal places.
+     * @return a string representing the number.
+     **/
+    template<typename numFmt>
+    static std::string stringify(numFmt number, double n)
+    {
+        int rounded = qRound(number * pow(10, n));
+
+        return stringify(rounded / pow(10, n));
+    }
+
+    static bool isValid(const QFileInfo &fileInfo);
+    static bool isSavable(const QString &fileName);
+    static bool hasValidSuffix(const QString &fileName);
+    static QStringList suffixOnly(const QStringList &fileFilters);
+    static QDateTime getConvertableDate(const QString &date);
+    static QDateTime convertDate(const QString &date, const QFileInfo &file = QFileInfo());
+    static QString convertDateString(const QString &date, const QFileInfo &file = QFileInfo());
+    static QString formatToString(int format);
+    static QString cleanFraction(const QString &frac);
+    static QString resolveFraction(const QString &frac);
+    static std::wstring qStringToStdWString(const QString &str);
+    static QString stdWStringToQString(const std::wstring &str);
+
+    static std::string stringTrim(const std::string str)
+    {
+        std::string strT = str;
+
+        if (strT.length() <= 1)
+            return strT; // .empty() may result in errors
+
+        // remove whitespace
+        size_t b = strT.find_first_not_of(" ");
+        size_t e = strT.find_last_not_of(" ");
+        strT = strT.substr(b, e + 1);
+
+        if (strT.length() <= 1)
+            return strT; // nothing to trim left
+
+        // remove tabs
+        b = strT.find_first_not_of("\t");
+        e = strT.find_last_not_of("\t");
+        strT = strT.substr(b, e + 1);
+
+        return strT;
+    };
+
+    static std::string stringRemove(const std::string str, const std::string repStr)
+    {
+        std::string strR = str;
+
+        if (strR.length() <= 1)
+            return strR;
+
+        size_t pos = 0;
+
+        while ((pos = strR.find_first_of(repStr)) < strR.npos) {
+            strR.erase(pos, repStr.length());
+        }
+
+        return strR;
+    };
 };
 
-class DllCoreExport DkMemory {
-
+class DllCoreExport DkMemory
+{
 public:
-
-	static double getTotalMemory();
-	static double getFreeMemory();
+    static double getTotalMemory();
+    static double getFreeMemory();
 };
 
-class DllCoreExport DkFileNameConverter {
-
+class DllCoreExport DkFileNameConverter
+{
 public:
-	DkFileNameConverter(const QString& fileName, const QString& pattern, int cIdx);
+    DkFileNameConverter(const QString &fileName, const QString &pattern, int cIdx);
 
-	QString getConvertedFileName();
+    QString getConvertedFileName();
 
 protected:
-	QString resolveFilename(const QString& tag) const;
-	QString resolveIdx(const QString& tag) const;
-	QString resolveExt(const QString& tag) const;
-	int getIntAttribute(const QString& tag, int idx = 1) const;
-
-	QString mFileName;
-	QString mPattern;
-	int mCIdx;
+    QString resolveFilename(const QString &tag) const;
+    QString resolveIdx(const QString &tag) const;
+    QString resolveExt(const QString &tag) const;
+    int getIntAttribute(const QString &tag, int idx = 1) const;
+
+    QString mFileName;
+    QString mPattern;
+    int mCIdx;
 };
 
 // from: http://stackoverflow.com/questions/5006547/qt-best-practice-for-a-single-instance-app-protection
-class DllCoreExport DkRunGuard {
-
+class DllCoreExport DkRunGuard
+{
 public:
-	DkRunGuard();
-	~DkRunGuard();
+    DkRunGuard();
+    ~DkRunGuard();
 
-	bool tryRunning();
+    bool tryRunning();
 
 private:
-	QString mSharedMemKey = "nomacs | run guard shared memory";
-	QString mLockKey = "nomacs | run guard semaphore";
-	
-	QSharedMemory mSharedMem; /* gcc cannot deal with this: = mSharedMemKey;*/
+    QString mSharedMemKey = "nomacs | run guard shared memory";
+    QString mLockKey = "nomacs | run guard semaphore";
 
-	Q_DISABLE_COPY(DkRunGuard)
+    QSharedMemory mSharedMem; /* gcc cannot deal with this: = mSharedMemKey;*/
+
+    Q_DISABLE_COPY(DkRunGuard)
 };
 
 // from: http://qt-project.org/doc/qt-4.8/itemviews-simpletreemodel.html
-class DllCoreExport TreeItem {
-
+class DllCoreExport TreeItem
+{
 public:
-	TreeItem(const QVector<QVariant> &data, TreeItem *parent = 0);
-	~TreeItem();
+    TreeItem(const QVector<QVariant> &data, TreeItem *parent = 0);
+    ~TreeItem();
 
-	void appendChild(TreeItem *child);
+    void appendChild(TreeItem *child);
 
-	bool contains(const QRegExp& regExp, int column = 0, bool recursive = true) const;
+    bool contains(const QRegularExpression &regExp, int column = 0, bool recursive = true) const;
 
-	TreeItem* child(int row) const;
-	int childCount() const;
-	int columnCount() const;
-	QVariant data(int column) const;
-	void setData(const QVariant& value, int column);
-	int row() const;
-	TreeItem* parent() const;
-	TreeItem* find(const QVariant& value, int column);
+    TreeItem *child(int row) const;
+    int childCount() const;
+    int columnCount() const;
+    QVariant data(int column) const;
+    void setData(const QVariant &value, int column);
+    int row() const;
+    TreeItem *parent() const;
+    TreeItem *find(const QVariant &value, int column);
 
-	QStringList parentList() const;
-	void setParent(TreeItem* parent);
-	void clear();
-	void remove(int rowIdx);
+    QStringList parentList() const;
+    void setParent(TreeItem *parent);
+    void clear();
+    void remove(int rowIdx);
 
 private:
-	QVector<TreeItem*> childItems;
-	QVector<QVariant> itemData;
-	TreeItem *parentItem = 0;
+    QVector<TreeItem *> childItems;
+    QVector<QVariant> itemData;
+    TreeItem *parentItem = 0;
 
-	void parentList(QStringList& parentKeys) const;
+    void parentList(QStringList &parentKeys) const;
 };
 
-class DllCoreExport TabMiddleMouseCloser : public QObject {
-	Q_OBJECT
+class DllCoreExport TabMiddleMouseCloser : public QObject
+{
+    Q_OBJECT
 
 public:
-	TabMiddleMouseCloser(std::function<void(int)> callback) : callback(callback) {};
+    TabMiddleMouseCloser(std::function<void(int)> callback)
+        : callback(callback){};
 
 protected:
-	std::function<void(int)> callback;
-	bool eventFilter(QObject *obj, QEvent *event) override;
+    std::function<void(int)> callback;
+    bool eventFilter(QObject *obj, QEvent *event) override;
 };
 
 }
diff --git a/ImageLounge/src/DkGui/DkBaseWidgets.cpp b/ImageLounge/src/DkGui/DkBaseWidgets.cpp
index d50936f..e546b1e 100644
--- a/ImageLounge/src/DkGui/DkBaseWidgets.cpp
+++ b/ImageLounge/src/DkGui/DkBaseWidgets.cpp
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkBaseWidgets.cpp
  Created on:	11.02.2015
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2015 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2015 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2015 Florian Kleber <florian@nomacs.org>
@@ -26,638 +26,658 @@
  *******************************************************************************************************/
 
 #include "DkBaseWidgets.h"
+#include "DkActionManager.h"
 #include "DkSettings.h"
 #include "DkUtils.h"
-#include "DkActionManager.h"
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QGraphicsEffect>
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QAction>
+#include <QComboBox>
 #include <QDebug>
-#include <QTimer>
-#include <QPainter>
-#include <QStyleOption>
 #include <QEvent>
-#include <QScrollBar>
-#include <QPushButton>
-#include <QComboBox>
+#include <QGraphicsEffect>
 #include <QHBoxLayout>
 #include <QInputDialog>
 #include <QMessageBox>
-#pragma warning(pop)	// no warnings from includes - end
-
-namespace nmc {
-
-DkWidget::DkWidget(QWidget* parent, Qt::WindowFlags flags) : QWidget(parent, flags) {
-}
-
-void DkWidget::paintEvent(QPaintEvent* event) {
-
-	// fixes stylesheets which are not applied to custom widgets
-	QStyleOption opt;
-	opt.init(this);
-	QPainter p(this);
-	style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
+#include <QPainter>
+#include <QPushButton>
+#include <QScrollBar>
+#include <QStyleOption>
+#include <QTimer>
+#pragma warning(pop) // no warnings from includes - end
 
-	QWidget::paintEvent(event);
+namespace nmc
+{
+DkWidget::DkWidget(QWidget *parent, Qt::WindowFlags flags)
+    : QWidget(parent, flags)
+{
 }
 
 // -------------------------------------------------------------------- DkFadeWidget
-DkFadeWidget::DkFadeWidget(QWidget* parent, Qt::WindowFlags flags) : DkWidget(parent, flags) {
-	init();
+DkFadeWidget::DkFadeWidget(QWidget *parent, Qt::WindowFlags flags)
+    : DkWidget(parent, flags)
+{
+    init();
 }
 
-void DkFadeWidget::init() {
-
-	setMouseTracking(true);
+void DkFadeWidget::init()
+{
+    setMouseTracking(true);
 
-	mShowing = false;
-	mHiding = false;
-	mBlocked = false;
-	mDisplaySettingsBits = 0;
-	mOpacityEffect = 0;
+    mShowing = false;
+    mHiding = false;
+    mBlocked = false;
+    mDisplaySettingsBits = 0;
+    mOpacityEffect = 0;
 
-	// painter problems if the widget is a child of another that has the same graphicseffect
-	// widget starts on hide
-	mOpacityEffect = new QGraphicsOpacityEffect(this);
-	mOpacityEffect->setOpacity(0);
-	mOpacityEffect->setEnabled(false);
-	setGraphicsEffect(mOpacityEffect);
+    // painter problems if the widget is a child of another that has the same graphicseffect
+    // widget starts on hide
+    mOpacityEffect = new QGraphicsOpacityEffect(this);
+    mOpacityEffect->setOpacity(0);
+    mOpacityEffect->setEnabled(false);
+    setGraphicsEffect(mOpacityEffect);
 
-	setVisible(false);
+    setVisible(false);
 }
 
-void DkFadeWidget::registerAction(QAction* action) {
-	mAction = action;
-}
+void DkFadeWidget::paintEvent(QPaintEvent *event)
+{
+    // fixes stylesheets which are not applied to custom widgets
+    QStyleOption opt;
+    opt.initFrom(this);
+    QPainter p(this);
+    style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
 
-void DkFadeWidget::block(bool blocked) {
-	mBlocked = blocked;
-	setVisible(false);
+    QWidget::paintEvent(event);
 }
 
-void DkFadeWidget::setDisplaySettings(QBitArray* displayBits) {
-	mDisplaySettingsBits = displayBits;
+void DkFadeWidget::registerAction(QAction *action)
+{
+    mAction = action;
 }
 
-bool DkFadeWidget::getCurrentDisplaySetting() {
+void DkFadeWidget::block(bool blocked)
+{
+    mBlocked = blocked;
+    setVisible(false);
+}
 
+void DkFadeWidget::setDisplaySettings(QBitArray *displayBits)
+{
+    mDisplaySettingsBits = displayBits;
+}
 
-	if (!mDisplaySettingsBits)
-		return false;
+bool DkFadeWidget::getCurrentDisplaySetting()
+{
+    if (!mDisplaySettingsBits)
+        return false;
 
-	if (DkSettingsManager::param().app().currentAppMode < 0 || DkSettingsManager::param().app().currentAppMode >= mDisplaySettingsBits->size()) {
-		qDebug() << "[WARNING] illegal app mode: " << DkSettingsManager::param().app().currentAppMode;
-		return false;
-	}
+    if (DkSettingsManager::param().app().currentAppMode < 0 || DkSettingsManager::param().app().currentAppMode >= mDisplaySettingsBits->size()) {
+        qDebug() << "[WARNING] illegal app mode: " << DkSettingsManager::param().app().currentAppMode;
+        return false;
+    }
 
-	return mDisplaySettingsBits->testBit(DkSettingsManager::param().app().currentAppMode);
+    return mDisplaySettingsBits->testBit(DkSettingsManager::param().app().currentAppMode);
 }
 
-bool DkFadeWidget::isHiding() const {
-	return mHiding;
+bool DkFadeWidget::isHiding() const
+{
+    return mHiding;
 }
 
-void DkFadeWidget::show(bool saveSetting) {
-
-	// here is a strange problem if you add a DkFadeWidget to another DkFadeWidget -> painters crash
-	if (!mBlocked && !mShowing) {
-		mHiding = false;
-		mShowing = true;
-		setVisible(true, saveSetting);
-		animateOpacityUp();
-	}
+void DkFadeWidget::show(bool saveSetting)
+{
+    // here is a strange problem if you add a DkFadeWidget to another DkFadeWidget -> painters crash
+    if (!mBlocked && !mShowing) {
+        mHiding = false;
+        mShowing = true;
+        setVisible(true, saveSetting);
+        animateOpacityUp();
+    }
 }
 
-void DkFadeWidget::hide(bool saveSetting) {
+void DkFadeWidget::hide(bool saveSetting)
+{
+    if (!mHiding) {
+        mHiding = true;
+        mShowing = false;
+        animateOpacityDown();
 
-	if (!mHiding) {
-		mHiding = true;
-		mShowing = false;
-		animateOpacityDown();
-
-		// set display bit here too -> since the final call to setVisible takes a few seconds
-		if (saveSetting && mDisplaySettingsBits && mDisplaySettingsBits->size() > DkSettingsManager::param().app().currentAppMode) {
-			mDisplaySettingsBits->setBit(DkSettingsManager::param().app().currentAppMode, false);
-		}
-	}
+        // set display bit here too -> since the final call to setVisible takes a few seconds
+        if (saveSetting && mDisplaySettingsBits && mDisplaySettingsBits->size() > DkSettingsManager::param().app().currentAppMode) {
+            mDisplaySettingsBits->setBit(DkSettingsManager::param().app().currentAppMode, false);
+        }
+    }
 }
 
-void DkFadeWidget::setVisible(bool visible, bool saveSetting) {
-
-	if (mBlocked) {
-		QWidget::setVisible(false);
-		return;
-	}
+void DkFadeWidget::setVisible(bool visible, bool saveSetting)
+{
+    if (mBlocked) {
+        QWidget::setVisible(false);
+        return;
+    }
 
-	if (visible && !isVisible() && !mShowing)
-		mOpacityEffect->setOpacity(100);
+    if (visible && !isVisible() && !mShowing)
+        mOpacityEffect->setOpacity(100);
 
-	QWidget::setVisible(visible);
-	
-	if (mAction) {
-		mAction->blockSignals(true);
-		mAction->setChecked(visible);
-		mAction->blockSignals(false);
-	}
+    QWidget::setVisible(visible);
 
-	if (saveSetting && mDisplaySettingsBits && mDisplaySettingsBits->size() > DkSettingsManager::param().app().currentAppMode) {
-		mDisplaySettingsBits->setBit(DkSettingsManager::param().app().currentAppMode, true);
-	}
+    if (mAction) {
+        mAction->blockSignals(true);
+        mAction->setChecked(visible);
+        mAction->blockSignals(false);
+    }
 
+    if (saveSetting && mDisplaySettingsBits && mDisplaySettingsBits->size() > DkSettingsManager::param().app().currentAppMode) {
+        mDisplaySettingsBits->setBit(DkSettingsManager::param().app().currentAppMode, true);
+    }
 }
 
-void DkFadeWidget::animateOpacityUp() {
+void DkFadeWidget::animateOpacityUp()
+{
+    if (!mShowing)
+        return;
 
-	if (!mShowing)
-		return;
+    mOpacityEffect->setEnabled(true);
+    if (mOpacityEffect->opacity() >= 1.0f || !mShowing) {
+        mOpacityEffect->setOpacity(1.0f);
+        mShowing = false;
+        mOpacityEffect->setEnabled(false);
+        return;
+    }
 
-	mOpacityEffect->setEnabled(true);
-	if (mOpacityEffect->opacity() >= 1.0f || !mShowing) {
-		mOpacityEffect->setOpacity(1.0f);
-		mShowing = false;
-		mOpacityEffect->setEnabled(false);
-		return;
-	}
-
-	QTimer::singleShot(20, this, SLOT(animateOpacityUp()));
-	mOpacityEffect->setOpacity(mOpacityEffect->opacity()+0.05);
+    QTimer::singleShot(20, this, SLOT(animateOpacityUp()));
+    mOpacityEffect->setOpacity(mOpacityEffect->opacity() + 0.05);
 }
 
-void DkFadeWidget::animateOpacityDown() {
-
-	if (!mHiding)
-		return;
+void DkFadeWidget::animateOpacityDown()
+{
+    if (!mHiding)
+        return;
 
-	mOpacityEffect->setEnabled(true);
-	if (mOpacityEffect->opacity() <= 0.0f) {
-		mOpacityEffect->setOpacity(0.0f);
-		mHiding = false;
-		setVisible(false, false);	// finally hide the widget
-		mOpacityEffect->setEnabled(false);
-		return;
-	}
+    mOpacityEffect->setEnabled(true);
+    if (mOpacityEffect->opacity() <= 0.0f) {
+        mOpacityEffect->setOpacity(0.0f);
+        mHiding = false;
+        setVisible(false, false); // finally hide the widget
+        mOpacityEffect->setEnabled(false);
+        return;
+    }
 
-	QTimer::singleShot(20, this, SLOT(animateOpacityDown()));
-	mOpacityEffect->setOpacity(mOpacityEffect->opacity()-0.05);
+    QTimer::singleShot(20, this, SLOT(animateOpacityDown()));
+    mOpacityEffect->setOpacity(mOpacityEffect->opacity() - 0.05);
 }
 
 // DkNamedWidget --------------------------------------------------------------------
-DkNamedWidget::DkNamedWidget(const QString& name, QWidget* parent) : DkFadeWidget(parent) {
-	mName = name;
+DkNamedWidget::DkNamedWidget(const QString &name, QWidget *parent)
+    : DkFadeWidget(parent)
+{
+    mName = name;
 }
 
-QString DkNamedWidget::name() const {
-	return mName;
+QString DkNamedWidget::name() const
+{
+    return mName;
 }
 
 // DkLabel --------------------------------------------------------------------
-DkLabel::DkLabel(QWidget* parent, const QString& text) : QLabel(text, parent) {
-
-	setMouseTracking(true);
-	mParent = parent;
-	mText = text;
-	init();
-	hide();
+DkLabel::DkLabel(QWidget *parent, const QString &text)
+    : QLabel(text, parent)
+{
+    setMouseTracking(true);
+    mParent = parent;
+    mText = text;
+    init();
+    hide();
 }
 
-DkLabel::~DkLabel() {
+DkLabel::~DkLabel()
+{
 }
 
-void DkLabel::init() {
-
-	mTime = -1;
-	mFixedWidth = -1;
-	mFontSize = 12;
-	mTextCol = DkSettingsManager::param().display().hudFgdColor;
-	mBlocked = false;
+void DkLabel::init()
+{
+    mTime = -1;
+    mFixedWidth = -1;
+    mFontSize = 12;
+    mTextCol = DkSettingsManager::param().display().hudFgdColor;
+    mBlocked = false;
 
-	mTimer.setSingleShot(true);
-	connect(&mTimer, SIGNAL(timeout()), this, SLOT(hide()));
+    mTimer.setSingleShot(true);
+    connect(&mTimer, SIGNAL(timeout()), this, SLOT(hide()));
 
-	// default look and feel
-	QFont font;
-	font.setPointSize(mFontSize);
-	QLabel::setFont(font);
-	QLabel::setTextInteractionFlags(Qt::TextSelectableByMouse);
+    // default look and feel
+    QFont font;
+    font.setPointSize(mFontSize);
+    QLabel::setFont(font);
+    QLabel::setTextInteractionFlags(Qt::TextSelectableByMouse);
 
-	QLabel::setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
-	updateStyleSheet();
+    QLabel::setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
+    updateStyleSheet();
 }
 
-void DkLabel::hide() {
-	mTime = 0;
-	QLabel::hide();
+void DkLabel::hide()
+{
+    mTime = 0;
+    QLabel::hide();
 }
 
-void DkLabel::setText(const QString& msg, int time) {
+void DkLabel::setText(const QString &msg, int time)
+{
+    mText = msg;
+    mTime = time;
 
-	mText = msg;
-	mTime = time;
+    if (!mTime || msg.isEmpty()) {
+        hide();
+        return;
+    }
 
-	if (!mTime || msg.isEmpty()) {
-		hide();
-		return;
-	}
+    setTextToLabel();
+    show();
 
-	setTextToLabel();
-	show();
-
-	if (time != -1)
-		mTimer.start(time);
+    if (time != -1)
+        mTimer.start(time);
 }
 
-void DkLabel::showTimed(int time) {
-
-	mTime = time;
+void DkLabel::showTimed(int time)
+{
+    mTime = time;
 
-	if (!time) {
-		hide();
-		return;
-	}
+    if (!time) {
+        hide();
+        return;
+    }
 
-	show();
-
-	if (time != -1)
-		mTimer.start(time);
+    show();
 
+    if (time != -1)
+        mTimer.start(time);
 }
 
-
-QString DkLabel::getText() {
-	return mText;
+QString DkLabel::getText()
+{
+    return mText;
 }
 
-void DkLabel::setFontSize(int fontSize) {
+void DkLabel::setFontSize(int fontSize)
+{
+    mFontSize = fontSize;
 
-	mFontSize = fontSize; 
-
-	QFont font;
-	font.setPointSize(fontSize);
-	QLabel::setFont(font);
-	QLabel::adjustSize();
+    QFont font;
+    font.setPointSize(fontSize);
+    QLabel::setFont(font);
+    QLabel::adjustSize();
 }
 
-void DkLabel::stop() {
-	mTimer.stop();
-	hide();
+void DkLabel::stop()
+{
+    mTimer.stop();
+    hide();
 }
 
-void DkLabel::updateStyleSheet() {
-	QLabel::setStyleSheet("QLabel{color: " + mTextCol.name() + "; margin: " + 
-		QString::number(mMargin.y()) + "px " +
-		QString::number(mMargin.x()) + "px " +
-		QString::number(mMargin.y()) + "px " +
-		QString::number(mMargin.x()) + "px;}");
+void DkLabel::updateStyleSheet()
+{
+    QLabel::setStyleSheet("QLabel{color: " + mTextCol.name() + "; margin: " + QString::number(mMargin.y()) + "px " + QString::number(mMargin.x()) + "px "
+                          + QString::number(mMargin.y()) + "px " + QString::number(mMargin.x()) + "px;}");
 }
 
-void DkLabel::paintEvent(QPaintEvent *event) {
-
-	if (mBlocked || !mTime)	// guarantee that the label is hidden after the time is up
-		return;
+void DkLabel::paintEvent(QPaintEvent *event)
+{
+    if (mBlocked || !mTime) // guarantee that the label is hidden after the time is up
+        return;
 
-	QPainter painter(this);
-	draw(&painter);
-	painter.end();
+    QPainter painter(this);
+    draw(&painter);
+    painter.end();
 
-	QLabel::paintEvent(event);
+    QLabel::paintEvent(event);
 }
 
-void DkLabel::draw(QPainter* painter) {
-
-	drawBackground(painter);
+void DkLabel::draw(QPainter *painter)
+{
+    drawBackground(painter);
 }
 
-void DkLabel::setFixedWidth(int fixedWidth) {
-
-	mFixedWidth = fixedWidth;
-	setTextToLabel();
+void DkLabel::setFixedWidth(int fixedWidth)
+{
+    mFixedWidth = fixedWidth;
+    setTextToLabel();
 }
 
-void DkLabel::setTextToLabel() {
-
-	if (mFixedWidth == -1) {
-		QLabel::setText(mText);
-		QLabel::adjustSize();
-	}
-	else {
-		setToolTip(mText);
-		QLabel::setText(fontMetrics().elidedText(mText, Qt::ElideRight, mFixedWidth-2*mMargin.x()));
-		QLabel::resize(mFixedWidth, height());
-	}
-
+void DkLabel::setTextToLabel()
+{
+    if (mFixedWidth == -1) {
+        QLabel::setText(mText);
+        QLabel::adjustSize();
+    } else {
+        setToolTip(mText);
+        QLabel::setText(fontMetrics().elidedText(mText, Qt::ElideRight, mFixedWidth - 2 * mMargin.x()));
+        QLabel::resize(mFixedWidth, height());
+    }
 }
 
-DkLabelBg::DkLabelBg(QWidget* parent, const QString& text) : DkLabel(parent, text) {
-
-	setAttribute(Qt::WA_TransparentForMouseEvents);	// labels should forward mouse events
-	setObjectName("DkLabelBg");
+DkLabelBg::DkLabelBg(QWidget *parent, const QString &text)
+    : DkLabel(parent, text)
+{
+    setAttribute(Qt::WA_TransparentForMouseEvents); // labels should forward mouse events
+    setObjectName("DkLabelBg");
 }
 
 // DkElidedLabel --------------------------------------------------------------------
 DkElidedLabel::DkElidedLabel(QWidget *parent, const QString &text)
-	: QLabel("", parent) {
-	setText(text);
-	setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum);
+    : QLabel("", parent)
+{
+    setText(text);
+    setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum);
 }
 
-void DkElidedLabel::setText(QString text) {
-	content = text;
-	updateElision();
+void DkElidedLabel::setText(QString text)
+{
+    content = text;
+    updateElision();
 }
 
-void DkElidedLabel::resizeEvent(QResizeEvent *event) {
-	updateElision();
-	QLabel::resizeEvent(event);
+void DkElidedLabel::resizeEvent(QResizeEvent *event)
+{
+    updateElision();
+    QLabel::resizeEvent(event);
 }
 
-void DkElidedLabel::updateElision() {
-	QFontMetrics metrix(font());
-	QString clippedText = metrix.elidedText(content, Qt::ElideRight, width());
-	QLabel::setText(clippedText);
+void DkElidedLabel::updateElision()
+{
+    QFontMetrics metrix(font());
+    QString clippedText = metrix.elidedText(content, Qt::ElideRight, width());
+    QLabel::setText(clippedText);
 }
 
-QSize DkElidedLabel::minimumSizeHint() {
-	return QSize(0, QLabel::minimumSizeHint().height());
+QSize DkElidedLabel::minimumSizeHint()
+{
+    return QSize(0, QLabel::minimumSizeHint().height());
 }
 
-QSize DkElidedLabel::minimumSize() {
-	return QSize(0, QLabel::minimumSize().height());
+QSize DkElidedLabel::minimumSize()
+{
+    return QSize(0, QLabel::minimumSize().height());
 }
 
-int DkElidedLabel::minimumWidth() {
-	return 0;
+int DkElidedLabel::minimumWidth()
+{
+    return 0;
 }
 
 // DkFadeLabel --------------------------------------------------------------------
-DkFadeLabel::DkFadeLabel(QWidget* parent, const QString& text) : DkLabel(parent, text) {
-	init();
+DkFadeLabel::DkFadeLabel(QWidget *parent, const QString &text)
+    : DkLabel(parent, text)
+{
+    init();
 }
 
-void DkFadeLabel::init() {
-
-	showing = false;
-	hiding = false;
-	mBlocked = false;
-	displaySettingsBits = 0;
+void DkFadeLabel::init()
+{
+    showing = false;
+    hiding = false;
+    mBlocked = false;
+    displaySettingsBits = 0;
 
-	// widget starts on hide
-	opacityEffect = new QGraphicsOpacityEffect(this);
-	opacityEffect->setOpacity(0);
-	opacityEffect->setEnabled(false);	// default disabled -> otherwise we get problems with children having the same effect
-	setGraphicsEffect(opacityEffect);
+    // widget starts on hide
+    opacityEffect = new QGraphicsOpacityEffect(this);
+    opacityEffect->setOpacity(0);
+    opacityEffect->setEnabled(false); // default disabled -> otherwise we get problems with children having the same effect
+    setGraphicsEffect(opacityEffect);
 
-	setVisible(false);
+    setVisible(false);
 }
 
-void DkFadeLabel::block(bool blocked) {
-	mBlocked = blocked;
-	setVisible(false);
+void DkFadeLabel::block(bool blocked)
+{
+    mBlocked = blocked;
+    setVisible(false);
 }
 
-void DkFadeLabel::registerAction(QAction* action) {
-
-	mAction = action;
+void DkFadeLabel::registerAction(QAction *action)
+{
+    mAction = action;
 }
 
-void DkFadeLabel::setDisplaySettings(QBitArray* displayBits) {
-	displaySettingsBits = displayBits;
+void DkFadeLabel::setDisplaySettings(QBitArray *displayBits)
+{
+    displaySettingsBits = displayBits;
 }
 
-bool DkFadeLabel::getCurrentDisplaySetting() {
-
-	if (!displaySettingsBits)
-		return false;
+bool DkFadeLabel::getCurrentDisplaySetting()
+{
+    if (!displaySettingsBits)
+        return false;
 
-	if (DkSettingsManager::param().app().currentAppMode < 0 || DkSettingsManager::param().app().currentAppMode >= displaySettingsBits->size()) {
-		qDebug() << "[WARNING] illegal app mode: " << DkSettingsManager::param().app().currentAppMode;
-		return false;
-	}
+    if (DkSettingsManager::param().app().currentAppMode < 0 || DkSettingsManager::param().app().currentAppMode >= displaySettingsBits->size()) {
+        qDebug() << "[WARNING] illegal app mode: " << DkSettingsManager::param().app().currentAppMode;
+        return false;
+    }
 
-	return displaySettingsBits->testBit(DkSettingsManager::param().app().currentAppMode);
+    return displaySettingsBits->testBit(DkSettingsManager::param().app().currentAppMode);
 }
 
-void DkFadeLabel::show(bool saveSettings) {
-
-	if (!mBlocked && !showing) {
-		hiding = false;
-		showing = true;
-		setVisible(true, saveSettings);
-		animateOpacityUp();
-	}
+void DkFadeLabel::show(bool saveSettings)
+{
+    if (!mBlocked && !showing) {
+        hiding = false;
+        showing = true;
+        setVisible(true, saveSettings);
+        animateOpacityUp();
+    }
 }
 
-void DkFadeLabel::hide(bool saveSettings) {
-
-	if (!hiding) {
-		hiding = true;
-		showing = false;
-		animateOpacityDown();
-	}
+void DkFadeLabel::hide(bool saveSettings)
+{
+    if (!hiding) {
+        hiding = true;
+        showing = false;
+        animateOpacityDown();
+    }
 
-	if (saveSettings && displaySettingsBits && displaySettingsBits->size() > DkSettingsManager::param().app().currentAppMode) {
-		displaySettingsBits->setBit(DkSettingsManager::param().app().currentAppMode, false);
-	}
+    if (saveSettings && displaySettingsBits && displaySettingsBits->size() > DkSettingsManager::param().app().currentAppMode) {
+        displaySettingsBits->setBit(DkSettingsManager::param().app().currentAppMode, false);
+    }
 }
 
-void DkFadeLabel::setVisible(bool visible, bool saveSettings) {
-
-	if (mBlocked) {
-		DkLabel::setVisible(false);
-		return;
-	}
-
-	if (visible && !isVisible() && !showing)
-		opacityEffect->setOpacity(100);
+void DkFadeLabel::setVisible(bool visible, bool saveSettings)
+{
+    if (mBlocked) {
+        DkLabel::setVisible(false);
+        return;
+    }
 
-	if (mAction) {
-		mAction->blockSignals(true);
-		mAction->setChecked(visible);
-		mAction->blockSignals(false);
-	}
+    if (visible && !isVisible() && !showing)
+        opacityEffect->setOpacity(100);
 
-	DkLabel::setVisible(visible);
+    if (mAction) {
+        mAction->blockSignals(true);
+        mAction->setChecked(visible);
+        mAction->blockSignals(false);
+    }
 
-	if (saveSettings && displaySettingsBits && displaySettingsBits->size() > DkSettingsManager::param().app().currentAppMode) {
-		displaySettingsBits->setBit(DkSettingsManager::param().app().currentAppMode, visible);
-	}
+    DkLabel::setVisible(visible);
 
+    if (saveSettings && displaySettingsBits && displaySettingsBits->size() > DkSettingsManager::param().app().currentAppMode) {
+        displaySettingsBits->setBit(DkSettingsManager::param().app().currentAppMode, visible);
+    }
 }
 
-void DkFadeLabel::animateOpacityUp() {
+void DkFadeLabel::animateOpacityUp()
+{
+    if (!showing)
+        return;
 
-	if (!showing)
-		return;
+    opacityEffect->setEnabled(true);
+    if (opacityEffect->opacity() >= 1.0f || !showing) {
+        opacityEffect->setOpacity(1.0f);
+        opacityEffect->setEnabled(false);
+        showing = false;
+        return;
+    }
 
-	opacityEffect->setEnabled(true);
-	if (opacityEffect->opacity() >= 1.0f || !showing) {
-		opacityEffect->setOpacity(1.0f);
-		opacityEffect->setEnabled(false);
-		showing = false;
-		return;
-	}
-
-	QTimer::singleShot(20, this, SLOT(animateOpacityUp()));
-	opacityEffect->setOpacity(opacityEffect->opacity()+0.05);
+    QTimer::singleShot(20, this, SLOT(animateOpacityUp()));
+    opacityEffect->setOpacity(opacityEffect->opacity() + 0.05);
 }
 
-void DkFadeLabel::animateOpacityDown() {
-
-	if (!hiding)
-		return;
+void DkFadeLabel::animateOpacityDown()
+{
+    if (!hiding)
+        return;
 
-	opacityEffect->setEnabled(true);
-	if (opacityEffect->opacity() <= 0.0f) {
-		opacityEffect->setOpacity(0.0f);
-		hiding = false;
-		opacityEffect->setEnabled(false);
-		setVisible(false, false);	// finally hide the widget
-		return;
-	}
+    opacityEffect->setEnabled(true);
+    if (opacityEffect->opacity() <= 0.0f) {
+        opacityEffect->setOpacity(0.0f);
+        hiding = false;
+        opacityEffect->setEnabled(false);
+        setVisible(false, false); // finally hide the widget
+        return;
+    }
 
-	QTimer::singleShot(20, this, SLOT(animateOpacityDown()));
-	opacityEffect->setOpacity(opacityEffect->opacity()-0.05);
+    QTimer::singleShot(20, this, SLOT(animateOpacityDown()));
+    opacityEffect->setOpacity(opacityEffect->opacity() - 0.05);
 }
 
 // DkDockWidget --------------------------------------------------------------------
-DkDockWidget::DkDockWidget(const QString& title, QWidget* parent /* = 0 */, Qt::WindowFlags flags /* = 0 */ ) : QDockWidget(title, parent, flags) {
-	displaySettingsBits = 0;
-	setObjectName("DkDockWidget");
+DkDockWidget::DkDockWidget(const QString &title, QWidget *parent /* = 0 */, Qt::WindowFlags flags /* = 0 */)
+    : QDockWidget(title, parent, flags)
+{
+    displaySettingsBits = 0;
+    setObjectName("DkDockWidget");
 }
 
-DkDockWidget::~DkDockWidget() {
+DkDockWidget::~DkDockWidget()
+{
 }
 
-void DkDockWidget::registerAction(QAction* action) {
-	
-	mAction = action;
+void DkDockWidget::registerAction(QAction *action)
+{
+    mAction = action;
 }
 
-void DkDockWidget::setDisplaySettings(QBitArray* displayBits) {
-	displaySettingsBits = displayBits;
+void DkDockWidget::setDisplaySettings(QBitArray *displayBits)
+{
+    displaySettingsBits = displayBits;
 }
 
-bool DkDockWidget::getCurrentDisplaySetting() const {
+bool DkDockWidget::getCurrentDisplaySetting() const
+{
+    if (!displaySettingsBits)
+        return false;
 
-	if (!displaySettingsBits)
-		return false;
-
-	return testDisplaySettings(*displaySettingsBits);
+    return testDisplaySettings(*displaySettingsBits);
 }
 
-bool DkDockWidget::testDisplaySettings(const QBitArray& displaySettingsBits) {
-
-	if (DkSettingsManager::param().app().currentAppMode < 0 || DkSettingsManager::param().app().currentAppMode >= displaySettingsBits.size()) {
-		qDebug() << "[WARNING] illegal app mode: " << DkSettingsManager::param().app().currentAppMode;
-		return false;
-	}
+bool DkDockWidget::testDisplaySettings(const QBitArray &displaySettingsBits)
+{
+    if (DkSettingsManager::param().app().currentAppMode < 0 || DkSettingsManager::param().app().currentAppMode >= displaySettingsBits.size()) {
+        qDebug() << "[WARNING] illegal app mode: " << DkSettingsManager::param().app().currentAppMode;
+        return false;
+    }
 
-	return displaySettingsBits.testBit(DkSettingsManager::param().app().currentAppMode);
+    return displaySettingsBits.testBit(DkSettingsManager::param().app().currentAppMode);
 }
 
-void DkDockWidget::setVisible(bool visible, bool saveSetting) {
+void DkDockWidget::setVisible(bool visible, bool saveSetting)
+{
+    QDockWidget::setVisible(visible);
 
-	QDockWidget::setVisible(visible);
-	
-	if (mAction) {
+    if (mAction) {
+        mAction->blockSignals(true);
+        mAction->setChecked(visible);
+        mAction->blockSignals(false);
+    }
 
-		mAction->blockSignals(true);
-		mAction->setChecked(visible);
-		mAction->blockSignals(false);
-	}
-
-	if (saveSetting && displaySettingsBits && displaySettingsBits->size() > DkSettingsManager::param().app().currentAppMode) {
-		displaySettingsBits->setBit(DkSettingsManager::param().app().currentAppMode, visible);
-	}
+    if (saveSetting && displaySettingsBits && displaySettingsBits->size() > DkSettingsManager::param().app().currentAppMode) {
+        displaySettingsBits->setBit(DkSettingsManager::param().app().currentAppMode, visible);
+    }
 }
 
-void DkDockWidget::closeEvent(QCloseEvent* event) {
-
-	setVisible(false);
+void DkDockWidget::closeEvent(QCloseEvent *event)
+{
+    setVisible(false);
 
-	QDockWidget::closeEvent(event);
+    QDockWidget::closeEvent(event);
 }
 
-Qt::DockWidgetArea DkDockWidget::getDockLocationSettings(const Qt::DockWidgetArea& defaultArea) const {
-	
-	DefaultSettings settings;
-	Qt::DockWidgetArea location = (Qt::DockWidgetArea)settings.value(objectName(), defaultArea).toInt();
+Qt::DockWidgetArea DkDockWidget::getDockLocationSettings(const Qt::DockWidgetArea &defaultArea) const
+{
+    DefaultSettings settings;
+    Qt::DockWidgetArea location = (Qt::DockWidgetArea)settings.value(objectName(), defaultArea).toInt();
 
-	return location;
+    return location;
 }
 
 // DkResizableScrollArea --------------------------------------------------------------------
-DkResizableScrollArea::DkResizableScrollArea(QWidget * parent /* = 0 */) : QScrollArea(parent) {
-
+DkResizableScrollArea::DkResizableScrollArea(QWidget *parent /* = 0 */)
+    : QScrollArea(parent)
+{
 }
 
-bool DkResizableScrollArea::eventFilter(QObject * o, QEvent * e) {
-
-	if(widget() && o == widget() && e->type() == QEvent::Resize) {
+bool DkResizableScrollArea::eventFilter(QObject *o, QEvent *e)
+{
+    if (widget() && o == widget() && e->type() == QEvent::Resize) {
+        updateSize();
+    }
 
-		updateSize();
-	}
-
-	return false;
+    return false;
 }
 
-void DkResizableScrollArea::updateSize() {
-
-	if (!widget())
-		return;
+void DkResizableScrollArea::updateSize()
+{
+    if (!widget())
+        return;
 
-	updateGeometry();
+    updateGeometry();
 
-	if (verticalScrollBarPolicy() == Qt::ScrollBarAlwaysOff) {
-		
-		int height = widget()->minimumSizeHint().height();
+    if (verticalScrollBarPolicy() == Qt::ScrollBarAlwaysOff) {
+        int height = widget()->minimumSizeHint().height();
 
-		if (horizontalScrollBar()->isVisible())
-			height += horizontalScrollBar()->height();
-		setMinimumHeight(height);
-	}
-	if (horizontalScrollBarPolicy() == Qt::ScrollBarAlwaysOff) {
-	
-		int width = widget()->minimumSizeHint().width();
+        if (horizontalScrollBar()->isVisible())
+            height += horizontalScrollBar()->height();
+        setMinimumHeight(height);
+    }
+    if (horizontalScrollBarPolicy() == Qt::ScrollBarAlwaysOff) {
+        int width = widget()->minimumSizeHint().width();
 
-		if (verticalScrollBar()->isVisible())
-			width += verticalScrollBar()->height();
-		setMinimumWidth(width);
-	}
+        if (verticalScrollBar()->isVisible())
+            width += verticalScrollBar()->height();
+        setMinimumWidth(width);
+    }
 }
 
-QSize DkResizableScrollArea::sizeHint() const {
+QSize DkResizableScrollArea::sizeHint() const
+{
+    if (!widget())
+        return QScrollArea::sizeHint();
 
-	if (!widget())
-		return QScrollArea::sizeHint();
+    widget()->updateGeometry();
 
-	widget()->updateGeometry();
+    QSize s = QScrollArea::sizeHint();
+    QSize ws = widget()->sizeHint();
 
-	QSize s = QScrollArea::sizeHint();
-	QSize ws = widget()->sizeHint();
+    if (verticalScrollBarPolicy() == Qt::ScrollBarAlwaysOff)
+        s.setHeight(ws.height());
+    if (horizontalScrollBarPolicy() == Qt::ScrollBarAlwaysOff)
+        s.setWidth(ws.width());
 
-	if (verticalScrollBarPolicy() == Qt::ScrollBarAlwaysOff)
-		s.setHeight(ws.height());
-	if (horizontalScrollBarPolicy() == Qt::ScrollBarAlwaysOff)
-		s.setWidth(ws.width());
-
-	return s;
+    return s;
 }
 
-QSize DkResizableScrollArea::minimumSizeHint() const {
-
-	if (!widget())
-		return QScrollArea::minimumSizeHint();
+QSize DkResizableScrollArea::minimumSizeHint() const
+{
+    if (!widget())
+        return QScrollArea::minimumSizeHint();
 
-	QSize s = QScrollArea::minimumSizeHint();
-	QSize ws = widget()->minimumSizeHint();
+    QSize s = QScrollArea::minimumSizeHint();
+    QSize ws = widget()->minimumSizeHint();
 
-	if (verticalScrollBarPolicy() == Qt::ScrollBarAlwaysOff)
-		s.setHeight(ws.height());
-	if (horizontalScrollBarPolicy() == Qt::ScrollBarAlwaysOff)
-		s.setWidth(ws.width());
+    if (verticalScrollBarPolicy() == Qt::ScrollBarAlwaysOff)
+        s.setHeight(ws.height());
+    if (horizontalScrollBarPolicy() == Qt::ScrollBarAlwaysOff)
+        s.setWidth(ws.width());
 
-	return s;
+    return s;
 }
 
 }
diff --git a/ImageLounge/src/DkGui/DkBaseWidgets.h b/ImageLounge/src/DkGui/DkBaseWidgets.h
index c40fdd0..799d4db 100644
--- a/ImageLounge/src/DkGui/DkBaseWidgets.h
+++ b/ImageLounge/src/DkGui/DkBaseWidgets.h
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkBaseWidgets.h
  Created on:	11.02.2015
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2015 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2015 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2015 Florian Kleber <florian@nomacs.org>
@@ -27,13 +27,13 @@
 
 #pragma once
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QWidget>
-#include <QLabel>
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QDockWidget>
+#include <QLabel>
 #include <QScrollArea>
 #include <QTimer>
-#pragma warning(pop)	// no warnings from includes - end
+#include <QWidget>
+#pragma warning(pop) // no warnings from includes - end
 
 #ifndef DllCoreExport
 #ifdef DK_CORE_DLL_EXPORT
@@ -51,152 +51,158 @@ class QGraphicsOpacityEffect;
 class QPushButton;
 class QComboBox;
 
-namespace nmc {
-
-class DllCoreExport DkWidget : public QWidget {
-	Q_OBJECT
+namespace nmc
+{
+class DllCoreExport DkWidget : public QWidget
+{
+    Q_OBJECT
 
 public:
-	DkWidget(QWidget* parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
-
-protected:
-	void paintEvent(QPaintEvent* event) override;
-
+    DkWidget(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
 };
 
-class DllCoreExport DkFadeWidget : public DkWidget {
-	Q_OBJECT
+class DllCoreExport DkFadeWidget : public DkWidget
+{
+    Q_OBJECT
 
 public:
-	DkFadeWidget(QWidget* parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
+    DkFadeWidget(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
 
-	void registerAction(QAction* action);
-	void block(bool blocked);
-	void setDisplaySettings(QBitArray* displayBits);
-	bool getCurrentDisplaySetting();
-	bool isHiding() const;
+    void registerAction(QAction *action);
+    void block(bool blocked);
+    void setDisplaySettings(QBitArray *displayBits);
+    bool getCurrentDisplaySetting();
+    bool isHiding() const;
 
-	enum {
-		pos_west,
-		pos_north,
-		pos_east,
-		pos_south,
-		pos_dock_hor,
-		pos_dock_ver,
+    enum {
+        pos_west,
+        pos_north,
+        pos_east,
+        pos_south,
+        pos_dock_hor,
+        pos_dock_ver,
 
-		pos_end,
-	};
+        pos_end,
+    };
 
 public slots:
-	virtual void show(bool saveSetting = true);
-	virtual void hide(bool saveSetting = true);
-	virtual void setVisible(bool visible, bool saveSetting = true);
+    virtual void show(bool saveSetting = true);
+    virtual void hide(bool saveSetting = true);
+    virtual void setVisible(bool visible, bool saveSetting = true);
 
-	void animateOpacityUp();
-	void animateOpacityDown();
+    void animateOpacityUp();
+    void animateOpacityDown();
 
 protected:
+    bool mBlocked;
+    bool mHiding;
+    bool mShowing;
 
-	bool mBlocked;
-	bool mHiding;
-	bool mShowing;
+    QGraphicsOpacityEffect *mOpacityEffect;
+    QBitArray *mDisplaySettingsBits;
+    QAction *mAction = 0;
 
-	QGraphicsOpacityEffect* mOpacityEffect;
-	QBitArray* mDisplaySettingsBits;
-	QAction* mAction = 0;
-
-	// functions
-	void init();
+    // functions
+    void init();
+    void paintEvent(QPaintEvent *event) override;
 };
 
-class DllCoreExport DkNamedWidget : public DkFadeWidget {
-	Q_OBJECT
+class DllCoreExport DkNamedWidget : public DkFadeWidget
+{
+    Q_OBJECT
 
 public:
-	DkNamedWidget(const QString& name, QWidget* parent);
+    DkNamedWidget(const QString &name, QWidget *parent);
 
-	QString name() const;
+    QString name() const;
 
 protected:
-	QString mName;
+    QString mName;
 };
 
-class DllCoreExport DkLabel : public QLabel {
-	Q_OBJECT
+class DllCoreExport DkLabel : public QLabel
+{
+    Q_OBJECT
 
 public:
-	DkLabel(QWidget* parent = 0, const QString& text = QString());
-	virtual ~DkLabel();
-
-	virtual void showTimed(int time = 3000);
-	virtual void setText(const QString& msg, int time = 3000);
-	QString getText();
-	void setFontSize(int fontSize);
-	void stop();
-	void setFixedWidth(int fixedWidth);
-
-	void block(bool blocked) {
-		mBlocked = blocked;
-	};
-	
-	void setMargin(const QPoint& margin) {
-		mMargin = margin;
-		updateStyleSheet();
-	};
+    DkLabel(QWidget *parent = 0, const QString &text = QString());
+    virtual ~DkLabel();
+
+    virtual void showTimed(int time = 3000);
+    virtual void setText(const QString &msg, int time = 3000);
+    QString getText();
+    void setFontSize(int fontSize);
+    void stop();
+    void setFixedWidth(int fixedWidth);
+
+    void block(bool blocked)
+    {
+        mBlocked = blocked;
+    };
+
+    void setMargin(const QPoint &margin)
+    {
+        mMargin = margin;
+        updateStyleSheet();
+    };
 
 public slots:
-	virtual void hide();
+    virtual void hide();
 
 protected:
-	QWidget* mParent;
-	QTimer mTimer;
-	QString mText;
-	QColor mTextCol;
-	int mDefaultTime;
-	int mFontSize;
-	int mTime;
-	int mFixedWidth;
-	QPoint mMargin;
-	bool mBlocked;
-
-	// functions
-	virtual void init();
-	void paintEvent(QPaintEvent *event) override;
-	virtual void draw(QPainter* painter);
-
-	// for my children...
-	virtual void drawBackground(QPainter*) {};
-	virtual void setTextToLabel();
-	virtual void updateStyleSheet();
+    QWidget *mParent;
+    QTimer mTimer;
+    QString mText;
+    QColor mTextCol;
+    int mDefaultTime;
+    int mFontSize;
+    int mTime;
+    int mFixedWidth;
+    QPoint mMargin;
+    bool mBlocked;
+
+    // functions
+    virtual void init();
+    virtual void paintEvent(QPaintEvent *event) override;
+    virtual void draw(QPainter *painter);
+
+    // for my children...
+    virtual void drawBackground(QPainter *){};
+    virtual void setTextToLabel();
+    virtual void updateStyleSheet();
 };
 
-class DllCoreExport DkElidedLabel : public QLabel {
-	Q_OBJECT
+class DllCoreExport DkElidedLabel : public QLabel
+{
+    Q_OBJECT
 
 public:
-	DkElidedLabel(QWidget *parent = 0, const QString &text = QString());
+    DkElidedLabel(QWidget *parent = 0, const QString &text = QString());
 
-	void setText(QString text);
-	QString text() const { return content; }
-	QSize minimumSizeHint();
-	QSize minimumSize();
-	int minimumWidth();
+    void setText(QString text);
+    QString text() const
+    {
+        return content;
+    }
+    QSize minimumSizeHint();
+    QSize minimumSize();
+    int minimumWidth();
 
 protected:
-	void resizeEvent(QResizeEvent *event);
+    void resizeEvent(QResizeEvent *event);
 
 private:
-	void updateElision();
-	QString content;
+    void updateElision();
+    QString content;
 };
 
-class DkLabelBg : public DkLabel {
-	Q_OBJECT
+class DkLabelBg : public DkLabel
+{
+    Q_OBJECT
 
 public:
-	DkLabelBg(QWidget* parent = 0, const QString& text = QString());
-	virtual ~DkLabelBg() {};
-
+    DkLabelBg(QWidget *parent = 0, const QString &text = QString());
+    virtual ~DkLabelBg(){};
 };
 
 /**
@@ -205,79 +211,78 @@ public:
  * we need this class too, since we cannot derive from DkLabel & DkFadeWidget
  * at the same time -> both have QObject as common base class.
  **/
-class DkFadeLabel : public DkLabel {
-	Q_OBJECT
+class DkFadeLabel : public DkLabel
+{
+    Q_OBJECT
 
 public:
-	DkFadeLabel(QWidget* parent = 0, const QString& text = QString());
+    DkFadeLabel(QWidget *parent = 0, const QString &text = QString());
 
-	void block(bool blocked);
-	void registerAction(QAction* action);
-	void setDisplaySettings(QBitArray* displayBits);
-	bool getCurrentDisplaySetting();
+    void block(bool blocked);
+    void registerAction(QAction *action);
+    void setDisplaySettings(QBitArray *displayBits);
+    bool getCurrentDisplaySetting();
 
 public slots:
-	virtual void show(bool saveSetting = true);
-	virtual void hide(bool saveSetting = true);
-	virtual void setVisible(bool visible, bool saveSetting = true);
+    virtual void show(bool saveSetting = true);
+    virtual void hide(bool saveSetting = true);
+    virtual void setVisible(bool visible, bool saveSetting = true);
 
 protected slots:
-	void animateOpacityUp();
-	void animateOpacityDown();
+    void animateOpacityUp();
+    void animateOpacityDown();
 
 protected:
+    bool hiding;
+    bool showing;
+    QBitArray *displaySettingsBits;
 
-	bool hiding;
-	bool showing;
-	QBitArray* displaySettingsBits;
+    QAction *mAction = 0;
 
-	QAction* mAction = 0;
-
-	QGraphicsOpacityEffect *opacityEffect;
-
-	// functions
-	void init();
+    QGraphicsOpacityEffect *opacityEffect;
 
+    // functions
+    void init();
 };
 
-class DllCoreExport DkDockWidget : public QDockWidget {
-	Q_OBJECT
+class DllCoreExport DkDockWidget : public QDockWidget
+{
+    Q_OBJECT
 
 public:
-	DkDockWidget(const QString& title, QWidget* parent = 0, Qt::WindowFlags flags = Qt::WindowFlags() );
-	~DkDockWidget();
+    DkDockWidget(const QString &title, QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
+    ~DkDockWidget();
 
-	void registerAction(QAction* action);
-	void setDisplaySettings(QBitArray* displayBits);
-	bool getCurrentDisplaySetting() const;
-	static bool testDisplaySettings(const QBitArray& displaySettingsBits);
-	Qt::DockWidgetArea getDockLocationSettings(const Qt::DockWidgetArea& defaultArea) const;
+    void registerAction(QAction *action);
+    void setDisplaySettings(QBitArray *displayBits);
+    bool getCurrentDisplaySetting() const;
+    static bool testDisplaySettings(const QBitArray &displaySettingsBits);
+    Qt::DockWidgetArea getDockLocationSettings(const Qt::DockWidgetArea &defaultArea) const;
 
 public slots:
-	virtual void setVisible(bool visible, bool saveSetting = true);
+    virtual void setVisible(bool visible, bool saveSetting = true);
 
 protected:
-	virtual void closeEvent(QCloseEvent* event) override;
+    virtual void closeEvent(QCloseEvent *event) override;
 
-	QBitArray* displaySettingsBits;
-	QAction* mAction = 0;
+    QBitArray *displaySettingsBits;
+    QAction *mAction = 0;
 };
 
-class DllCoreExport DkResizableScrollArea : public QScrollArea {
-	Q_OBJECT
+class DllCoreExport DkResizableScrollArea : public QScrollArea
+{
+    Q_OBJECT
 
 public:
-	DkResizableScrollArea(QWidget * parent = 0);
+    DkResizableScrollArea(QWidget *parent = 0);
 
-	void updateSize();
+    void updateSize();
 
-	virtual QSize sizeHint() const;
-	virtual QSize minimumSizeHint() const;
+    virtual QSize sizeHint() const;
+    virtual QSize minimumSizeHint() const;
 
 protected:
-	bool eventFilter(QObject * o, QEvent * e);
-
+    bool eventFilter(QObject *o, QEvent *e);
 };
 
-
 }
diff --git a/ImageLounge/src/DkGui/DkBatch.cpp b/ImageLounge/src/DkGui/DkBatch.cpp
index aff9767..688cf2a 100644
--- a/ImageLounge/src/DkGui/DkBatch.cpp
+++ b/ImageLounge/src/DkGui/DkBatch.cpp
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkNoMacs.cpp
  Created on:	26.10.2014
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2014 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2014 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2014 Florian Kleber <florian@nomacs.org>
@@ -26,2941 +26,2966 @@
  *******************************************************************************************************/
 
 #include "DkBatch.h"
-#include "DkProcess.h"
+#include "DkActionManager.h"
+#include "DkBasicWidgets.h"
 #include "DkDialog.h"
-#include "DkWidgets.h"
-#include "DkThumbsWidgets.h"
-#include "DkUtils.h"
 #include "DkImageLoader.h"
-#include "DkSettings.h"
-#include "DkMessageBox.h"
-#include "DkPluginManager.h"
-#include "DkActionManager.h"
 #include "DkImageStorage.h"
 #include "DkManipulatorWidgets.h"
-#include "DkSettingsWidget.h"
+#include "DkMessageBox.h"
 #include "DkPluginInterface.h"
-#include "DkBasicWidgets.h"
+#include "DkPluginManager.h"
+#include "DkProcess.h"
+#include "DkSettings.h"
+#include "DkSettingsWidget.h"
+#include "DkThumbsWidgets.h"
+#include "DkUtils.h"
+#include "DkWidgets.h"
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QLabel>
-#include <QListView>
-#include <QTreeView>
-#include <QLineEdit>
-#include <QFileDialog>
-#include <QGroupBox>
-#include <QComboBox>
+#pragma warning(push, 0) // no warnings from includes - begin
+#include <QAction>
+#include <QApplication>
 #include <QButtonGroup>
-#include <QProgressBar>
-#include <QTextEdit>
 #include <QCheckBox>
+#include <QComboBox>
 #include <QDoubleSpinBox>
+#include <QDropEvent>
+#include <QFileDialog>
+#include <QGroupBox>
 #include <QHBoxLayout>
-#include <QRadioButton>
+#include <QHeaderView>
+#include <QInputDialog>
+#include <QLabel>
+#include <QLineEdit>
+#include <QListView>
+#include <QListWidget>
 #include <QMessageBox>
-#include <QApplication>
-#include <QTextBlock>
-#include <QDropEvent>
 #include <QMimeData>
+#include <QProgressBar>
+#include <QRadioButton>
 #include <QSplitter>
-#include <QListWidget>
-#include <QAction>
 #include <QStackedLayout>
-#include <QInputDialog>
-#include <QStandardPaths>
-#include <QStandardItemModel>
 #include <QStandardItem>
-#include <QHeaderView>
-#pragma warning(pop)		// no warnings from includes - end
+#include <QStandardItemModel>
+#include <QStandardPaths>
+#include <QTextBlock>
+#include <QTextEdit>
+#include <QTreeView>
+#pragma warning(pop) // no warnings from includes - end
 
-namespace nmc {
+namespace nmc
+{
 
 // DkBatchTabButton --------------------------------------------------------------------
-DkBatchTabButton::DkBatchTabButton(const QString& title, const QString& info, QWidget* parent) : QPushButton(title, parent) {
-
-	// TODO: add info
-	mInfo = info;
-	setFlat(true);
-	setCheckable(true);
+DkBatchTabButton::DkBatchTabButton(const QString &title, const QString &info, QWidget *parent)
+    : QPushButton(title, parent)
+{
+    // TODO: add info
+    mInfo = info;
+    setFlat(true);
+    setCheckable(true);
 }
 
-void DkBatchTabButton::setInfo(const QString& info) {
-	mInfo = info;
-	update();
+void DkBatchTabButton::setInfo(const QString &info)
+{
+    mInfo = info;
+    update();
 
-	emit infoChanged(mInfo);
+    emit infoChanged(mInfo);
 }
 
-QString DkBatchTabButton::info() const {
-	return mInfo;
+QString DkBatchTabButton::info() const
+{
+    return mInfo;
 }
 
-void DkBatchTabButton::paintEvent(QPaintEvent *event) {
-
-	QPushButton::paintEvent(event);
-
-	// fixes stylesheets which are not applied to custom widgets
-	QStyleOption opt;
-	opt.init(this);
-	QPainter p(this);
-	//style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
+void DkBatchTabButton::paintEvent(QPaintEvent *event)
+{
+    QPushButton::paintEvent(event);
 
-	QFont f;
-	f.setPointSize(9);
-	f.setItalic(true);
-	p.setFont(f);
+    // fixes stylesheets which are not applied to custom widgets
+    QStyleOption opt;
+    opt.initFrom(this);
+    QPainter p(this);
+    // style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
 
-	// change opacity
-	QColor c = p.pen().color();
-	c.setAlpha(200);
-	QPen fPen = p.pen();
-	fPen.setColor(c);
-	p.setPen(fPen);
+    QFont f;
+    f.setPointSize(9);
+    f.setItalic(true);
+    p.setFont(f);
 
-	p.drawText(QPoint(25, 50), mInfo);
+    // change opacity
+    QColor c = p.pen().color();
+    c.setAlpha(200);
+    QPen fPen = p.pen();
+    fPen.setColor(c);
+    p.setPen(fPen);
 
+    p.drawText(QPoint(25, 50), mInfo);
 }
 
 // DkBatchContainer --------------------------------------------------------------------
-DkBatchContainer::DkBatchContainer(const QString& titleString, const QString& headerString, QWidget* parent) : QObject(parent) {
-	
-	mHeaderButton = new DkBatchTabButton(titleString, headerString, parent);
-	createLayout();
+DkBatchContainer::DkBatchContainer(const QString &titleString, const QString &headerString, QWidget *parent)
+    : QObject(parent)
+{
+    mHeaderButton = new DkBatchTabButton(titleString, headerString, parent);
+    createLayout();
 }
 
-void DkBatchContainer::createLayout() {
-
+void DkBatchContainer::createLayout()
+{
 }
 
-void DkBatchContainer::setContentWidget(QWidget* batchContent) {
-	
-	mBatchContent = dynamic_cast<DkBatchContent*>(batchContent);
+void DkBatchContainer::setContentWidget(QWidget *batchContent)
+{
+    mBatchContent = dynamic_cast<DkBatchContent *>(batchContent);
 
-	connect(mHeaderButton, SIGNAL(toggled(bool)), this, SLOT(showContent(bool)));
-	connect(batchContent, SIGNAL(newHeaderText(const QString&)), mHeaderButton, SLOT(setInfo(const QString&)));
+    connect(mHeaderButton, SIGNAL(toggled(bool)), this, SLOT(showContent(bool)));
+    connect(batchContent, SIGNAL(newHeaderText(const QString &)), mHeaderButton, SLOT(setInfo(const QString &)));
 }
 
-QWidget* DkBatchContainer::contentWidget() const {
-	
-	return dynamic_cast<QWidget*>(mBatchContent);
+QWidget *DkBatchContainer::contentWidget() const
+{
+    return dynamic_cast<QWidget *>(mBatchContent);
 }
 
-DkBatchContent * DkBatchContainer::batchContent() const {
-	return mBatchContent;
+DkBatchContent *DkBatchContainer::batchContent() const
+{
+    return mBatchContent;
 }
 
-DkBatchTabButton* DkBatchContainer::headerWidget() const {
-
-	return mHeaderButton;
+DkBatchTabButton *DkBatchContainer::headerWidget() const
+{
+    return mHeaderButton;
 }
 
-void DkBatchContainer::showContent(bool show) const {
-
-	if (show)
-		emit showSignal();
+void DkBatchContainer::showContent(bool show) const
+{
+    if (show)
+        emit showSignal();
 
-	//mShowButton->click();
-	//contentWidget()->setVisible(show);
+    // mShowButton->click();
+    // contentWidget()->setVisible(show);
 }
 
-//void DkBatchContainer::setTitle(const QString& titleString) {
+// void DkBatchContainer::setTitle(const QString& titleString) {
 //	mTitleString = titleString;
 //	mTitleLabel->setText(titleString);
-//}
+// }
 //
-//void DkBatchContainer::setHeader(const QString& headerString) {
+// void DkBatchContainer::setHeader(const QString& headerString) {
 //	mHeaderString = headerString;
 //	mHeaderLabel->setText(headerString);
-//}
+// }
 
 // DkInputTextEdit --------------------------------------------------------------------
-DkInputTextEdit::DkInputTextEdit(QWidget* parent /* = 0 */) : QTextEdit(parent) {
-
-	setAcceptDrops(true);
-	connect(this, SIGNAL(textChanged()), this, SIGNAL(fileListChangedSignal()));
+DkInputTextEdit::DkInputTextEdit(QWidget *parent /* = 0 */)
+    : QTextEdit(parent)
+{
+    setAcceptDrops(true);
+    connect(this, SIGNAL(textChanged()), this, SIGNAL(fileListChangedSignal()));
 }
 
-void DkInputTextEdit::appendFiles(const QStringList& fileList) {
-
-	QStringList cFileList = getFileList();
-	QStringList newFiles;
+void DkInputTextEdit::appendFiles(const QStringList &fileList)
+{
+    QStringList cFileList = getFileList();
+    QStringList newFiles;
 
-	// unique!
-	for (const QString& cStr : fileList) {
+    // unique!
+    for (const QString &cStr : fileList) {
+        if (!cFileList.contains(cStr))
+            newFiles.append(cStr);
+    }
 
-		if (!cFileList.contains(cStr))
-			newFiles.append(cStr);
-	}
-
-	if (!newFiles.empty()) {
-		append(newFiles.join("\n"));
-		fileListChangedSignal();
-	}
+    if (!newFiles.empty()) {
+        append(newFiles.join("\n"));
+        fileListChangedSignal();
+    }
 }
 
-void DkInputTextEdit::appendDir(const QString& newDir, bool recursive) {
-
-	if (recursive) {
-		qDebug() << "adding recursive...";
-		QDir tmpDir = newDir;
-		QFileInfoList subDirs = tmpDir.entryInfoList(QDir::NoDotAndDotDot | QDir::Dirs);
+void DkInputTextEdit::appendDir(const QString &newDir, bool recursive)
+{
+    if (recursive) {
+        qDebug() << "adding recursive...";
+        QDir tmpDir = newDir;
+        QFileInfoList subDirs = tmpDir.entryInfoList(QDir::NoDotAndDotDot | QDir::Dirs);
 
-		for (QFileInfo cDir : subDirs)
-			appendDir(cDir.absoluteFilePath(), recursive);
-	}
+        for (QFileInfo cDir : subDirs)
+            appendDir(cDir.absoluteFilePath(), recursive);
+    }
 
-	QDir tmpDir = newDir;
-	tmpDir.setSorting(QDir::LocaleAware);
-	QFileInfoList fileList = tmpDir.entryInfoList(DkSettingsManager::param().app().fileFilters);
-	QStringList strFileList;
+    QDir tmpDir = newDir;
+    tmpDir.setSorting(QDir::LocaleAware);
+    QFileInfoList fileList = tmpDir.entryInfoList(DkSettingsManager::param().app().fileFilters);
+    QStringList strFileList;
 
-	for (QFileInfo entry : fileList) {
-		strFileList.append(entry.absoluteFilePath());
-	}
+    for (QFileInfo entry : fileList) {
+        strFileList.append(entry.absoluteFilePath());
+    }
 
-	qDebug() << "appending " << strFileList.size() << " files";
+    qDebug() << "appending " << strFileList.size() << " files";
 
-	appendFiles(strFileList);
+    appendFiles(strFileList);
 }
 
-void DkInputTextEdit::appendFromMime(const QMimeData* mimeData, bool recursive) {
-
-	if (!mimeData || !mimeData->hasUrls())
-		return;
+void DkInputTextEdit::appendFromMime(const QMimeData *mimeData, bool recursive)
+{
+    if (!mimeData || !mimeData->hasUrls())
+        return;
 
-	QStringList cFiles;
+    QStringList cFiles;
 
-	for (QUrl url : mimeData->urls()) {
+    for (QUrl url : mimeData->urls()) {
+        QFileInfo cFile = DkUtils::urlToLocalFile(url);
 
-		QFileInfo cFile = DkUtils::urlToLocalFile(url);
+        if (cFile.isDir())
+            appendDir(cFile.absoluteFilePath(), recursive);
+        else if (cFile.exists() && DkUtils::isValid(cFile))
+            cFiles.append(cFile.absoluteFilePath());
+    }
 
-		if (cFile.isDir())
-			appendDir(cFile.absoluteFilePath(), recursive);
-		else if (cFile.exists() && DkUtils::isValid(cFile))
-			cFiles.append(cFile.absoluteFilePath());
-	}
-
-	if (!cFiles.empty())
-		appendFiles(cFiles);
+    if (!cFiles.empty())
+        appendFiles(cFiles);
 }
 
-void DkInputTextEdit::insertFromMimeData(const QMimeData* mimeData) {
-
-	appendFromMime(mimeData);
-	QTextEdit::insertFromMimeData(mimeData);
+void DkInputTextEdit::insertFromMimeData(const QMimeData *mimeData)
+{
+    appendFromMime(mimeData);
+    QTextEdit::insertFromMimeData(mimeData);
 }
 
-void DkInputTextEdit::dragEnterEvent(QDragEnterEvent *event) {
+void DkInputTextEdit::dragEnterEvent(QDragEnterEvent *event)
+{
+    QTextEdit::dragEnterEvent(event);
 
-	QTextEdit::dragEnterEvent(event);
-
-	if (event->source() == this)
-		event->acceptProposedAction();
-	else if (event->mimeData()->hasUrls())
-		event->acceptProposedAction();
+    if (event->source() == this)
+        event->acceptProposedAction();
+    else if (event->mimeData()->hasUrls())
+        event->acceptProposedAction();
 }
 
-void DkInputTextEdit::dragMoveEvent(QDragMoveEvent *event) {
-
-	QTextEdit::dragMoveEvent(event);
+void DkInputTextEdit::dragMoveEvent(QDragMoveEvent *event)
+{
+    QTextEdit::dragMoveEvent(event);
 
-	if (event->source() == this)
-		event->acceptProposedAction();
-	else if (event->mimeData()->hasUrls())
-		event->acceptProposedAction();
+    if (event->source() == this)
+        event->acceptProposedAction();
+    else if (event->mimeData()->hasUrls())
+        event->acceptProposedAction();
 }
 
+void DkInputTextEdit::dropEvent(QDropEvent *event)
+{
+    if (event->source() == this) {
+        event->accept();
+        return;
+    }
 
-void DkInputTextEdit::dropEvent(QDropEvent *event) {
-	
-	if (event->source() == this) {
-		event->accept();
-		return;
-	}
+    appendFromMime(event->mimeData(), (event->keyboardModifiers() & Qt::ControlModifier) != 0);
 
-	appendFromMime(event->mimeData(), (event->keyboardModifiers() & Qt::ControlModifier) != 0);
-
-	// do not propagate!
-	//QTextEdit::dropEvent(event);
+    // do not propagate!
+    // QTextEdit::dropEvent(event);
 }
 
-QStringList DkInputTextEdit::getFileList() const {
-
-	QStringList fileList;
-	QString textString;
-	QTextStream textStream(&textString);
-	textStream << toPlainText();
+QStringList DkInputTextEdit::getFileList() const
+{
+    QStringList fileList;
+    QString textString;
+    QTextStream textStream(&textString);
+    textStream << toPlainText();
 
-	QString line;
-	do
-	{
-		line = textStream.readLine();	// we don't want to get into troubles with carriage returns of different OS
-		if (!line.isNull() && !line.trimmed().isEmpty())
-			fileList.append(line);
-	} while(!line.isNull());
+    QString line;
+    do {
+        line = textStream.readLine(); // we don't want to get into troubles with carriage returns of different OS
+        if (!line.isNull() && !line.trimmed().isEmpty())
+            fileList.append(line);
+    } while (!line.isNull());
 
-	return fileList;
+    return fileList;
 }
 
-void DkInputTextEdit::clear() {
-	
-	mResultList.clear();
-	QTextEdit::clear();
+void DkInputTextEdit::clear()
+{
+    mResultList.clear();
+    QTextEdit::clear();
 }
 
-QString DkInputTextEdit::firstDirPath() const {
-	
-	QStringList fl = getFileList();
+QString DkInputTextEdit::firstDirPath() const
+{
+    QStringList fl = getFileList();
 
-	if (fl.isEmpty())
-		return "";
-	
-	return QFileInfo(fl[0]).absolutePath();
+    if (fl.isEmpty())
+        return "";
+
+    return QFileInfo(fl[0]).absolutePath();
 }
 
 // File Selection --------------------------------------------------------------------
-DkBatchInput::DkBatchInput(QWidget* parent /* = 0 */, Qt::WindowFlags f /* = 0 */) : DkWidget(parent, f) {
-
-	setObjectName("DkBatchInput");
-	createLayout();
-	setMinimumHeight(300);
-
+DkBatchInput::DkBatchInput(QWidget *parent /* = 0 */, Qt::WindowFlags f /* = 0 */)
+    : DkWidget(parent, f)
+{
+    setObjectName("DkBatchInput");
+    createLayout();
+    setMinimumHeight(300);
 }
 
-void DkBatchInput::createLayout() {
-	
-	mDirectoryEdit = new DkDirectoryEdit(this);
+void DkBatchInput::createLayout()
+{
+    mDirectoryEdit = new DkDirectoryEdit(this);
 
-	QWidget* upperWidget = new QWidget(this);
-	QGridLayout* upperWidgetLayout = new QGridLayout(upperWidget);
-	upperWidgetLayout->setContentsMargins(0,0,0,0);
-	upperWidgetLayout->addWidget(mDirectoryEdit, 0, 1);
+    QWidget *upperWidget = new QWidget(this);
+    QGridLayout *upperWidgetLayout = new QGridLayout(upperWidget);
+    upperWidgetLayout->setContentsMargins(0, 0, 0, 0);
+    upperWidgetLayout->addWidget(mDirectoryEdit, 0, 1);
 
-	mInputTextEdit = new DkInputTextEdit(this);
+    mInputTextEdit = new DkInputTextEdit(this);
 
-	mResultTextEdit = new QTextEdit(this);
-	mResultTextEdit->setReadOnly(true);
-	mResultTextEdit->setVisible(false);
+    mResultTextEdit = new QTextEdit(this);
+    mResultTextEdit->setReadOnly(true);
+    mResultTextEdit->setVisible(false);
 
-	mThumbScrollWidget = new DkThumbScrollWidget(this);
-	mThumbScrollWidget->setVisible(true);
-	mThumbScrollWidget->getThumbWidget()->setImageLoader(mLoader);
+    mThumbScrollWidget = new DkThumbScrollWidget(this);
+    mThumbScrollWidget->setVisible(true);
+    mThumbScrollWidget->getThumbWidget()->setImageLoader(mLoader);
 
-	// add explorer
-	mExplorer = new DkExplorer(tr("File Explorer"));
-	mExplorer->getModel()->setFilter(QDir::Dirs|QDir::Drives|QDir::NoDotAndDotDot|QDir::AllDirs);
-	mExplorer->getModel()->setNameFilters(QStringList());
-	mExplorer->setMaximumWidth(300);
+    // add explorer
+    mExplorer = new DkExplorer(tr("File Explorer"));
+    mExplorer->getModel()->setFilter(QDir::Dirs | QDir::Drives | QDir::NoDotAndDotDot | QDir::AllDirs);
+    mExplorer->getModel()->setNameFilters(QStringList());
+    mExplorer->setMaximumWidth(300);
 
-	QStringList folders = DkSettingsManager::param().global().recentFiles;
+    QStringList folders = DkSettingsManager::param().global().recentFiles;
 
-	if (folders.size() > 0)
-		mExplorer->setCurrentPath(folders[0]);
+    if (folders.size() > 0)
+        mExplorer->setCurrentPath(folders[0]);
 
-	// tab widget
-	mInputTabs = new QTabWidget(this);
-	mInputTabs->addTab(mThumbScrollWidget, DkImage::loadIcon(":/nomacs/img/rects.svg"), tr("Thumbnails"));
-	mInputTabs->addTab(mInputTextEdit, DkImage::loadIcon(":/nomacs/img/bars.svg"), tr("File List"));
+    // tab widget
+    mInputTabs = new QTabWidget(this);
+    mInputTabs->addTab(mThumbScrollWidget, DkImage::loadIcon(":/nomacs/img/rects.svg"), tr("Thumbnails"));
+    mInputTabs->addTab(mInputTextEdit, DkImage::loadIcon(":/nomacs/img/bars.svg"), tr("File List"));
 
-	QGridLayout* widgetLayout = new QGridLayout(this);
-	widgetLayout->setContentsMargins(0, 0, 0, 0);
-	widgetLayout->addWidget(mExplorer, 0, 0, 2, 1);
-	widgetLayout->addWidget(upperWidget, 0, 1);
-	widgetLayout->addWidget(mInputTabs, 1, 1);
-	setLayout(widgetLayout);
+    QGridLayout *widgetLayout = new QGridLayout(this);
+    widgetLayout->setContentsMargins(0, 0, 0, 0);
+    widgetLayout->addWidget(mExplorer, 0, 0, 2, 1);
+    widgetLayout->addWidget(upperWidget, 0, 1);
+    widgetLayout->addWidget(mInputTabs, 1, 1);
+    setLayout(widgetLayout);
 
-	connect(mThumbScrollWidget->getThumbWidget(), SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
-	connect(mThumbScrollWidget, SIGNAL(batchProcessFilesSignal(const QStringList&)), mInputTextEdit, SLOT(appendFiles(const QStringList&)));
-	connect(mThumbScrollWidget, SIGNAL(updateDirSignal(const QString&)), this, SLOT(setDir(const QString&)));
-	connect(mThumbScrollWidget, SIGNAL(filterChangedSignal(const QString &)), mLoader.data(), SLOT(setFolderFilter(const QString&)), Qt::UniqueConnection);
-	
-	connect(mInputTextEdit, SIGNAL(fileListChangedSignal()), this, SLOT(selectionChanged()));
+    connect(mThumbScrollWidget->getThumbWidget(), SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
+    connect(mThumbScrollWidget, SIGNAL(batchProcessFilesSignal(const QStringList &)), mInputTextEdit, SLOT(appendFiles(const QStringList &)));
+    connect(mThumbScrollWidget, SIGNAL(updateDirSignal(const QString &)), this, SLOT(setDir(const QString &)));
+    connect(mThumbScrollWidget, SIGNAL(filterChangedSignal(const QString &)), mLoader.data(), SLOT(setFolderFilter(const QString &)), Qt::UniqueConnection);
 
-	connect(mDirectoryEdit, SIGNAL(textChanged(const QString&)), this, SLOT(parameterChanged()));
-	connect(mDirectoryEdit, SIGNAL(directoryChanged(const QString&)), this, SLOT(setDir(const QString&)));
-	connect(mExplorer, SIGNAL(openDir(const QString&)), this, SLOT(setDir(const QString&)));
-	connect(mLoader.data(), SIGNAL(updateDirSignal(QVector<QSharedPointer<DkImageContainerT> >)), mThumbScrollWidget, SLOT(updateThumbs(QVector<QSharedPointer<DkImageContainerT> >)));
+    connect(mInputTextEdit, SIGNAL(fileListChangedSignal()), this, SLOT(selectionChanged()));
 
+    connect(mDirectoryEdit, SIGNAL(textChanged(const QString &)), this, SLOT(parameterChanged()));
+    connect(mDirectoryEdit, SIGNAL(directoryChanged(const QString &)), this, SLOT(setDir(const QString &)));
+    connect(mExplorer, SIGNAL(openDir(const QString &)), this, SLOT(setDir(const QString &)));
+    connect(mLoader.data(),
+            SIGNAL(updateDirSignal(QVector<QSharedPointer<DkImageContainerT>>)),
+            mThumbScrollWidget,
+            SLOT(updateThumbs(QVector<QSharedPointer<DkImageContainerT>>)));
 }
 
-void DkBatchInput::applyDefault() {
-	
-	mInputTextEdit->clear();
-	selectionChanged();
+void DkBatchInput::applyDefault()
+{
+    mInputTextEdit->clear();
+    selectionChanged();
 }
 
-void DkBatchInput::changeTab(int tabIdx) const {
+void DkBatchInput::changeTab(int tabIdx) const
+{
+    if (tabIdx < 0 || tabIdx >= mInputTabs->count())
+        return;
 
-	if (tabIdx < 0 || tabIdx >= mInputTabs->count())
-		return;
-
-	mInputTabs->setCurrentIndex(tabIdx);
+    mInputTabs->setCurrentIndex(tabIdx);
 }
 
-void DkBatchInput::updateDir(QVector<QSharedPointer<DkImageContainerT> > thumbs) {
-	emit updateDirSignal(thumbs);
+void DkBatchInput::updateDir(QVector<QSharedPointer<DkImageContainerT>> thumbs)
+{
+    emit updateDirSignal(thumbs);
 }
 
-void DkBatchInput::setVisible(bool visible) {
-
-	QWidget::setVisible(visible);
-	mThumbScrollWidget->getThumbWidget()->updateLayout();
+void DkBatchInput::setVisible(bool visible)
+{
+    QWidget::setVisible(visible);
+    mThumbScrollWidget->getThumbWidget()->updateLayout();
 }
 
-void DkBatchInput::browse() {
+void DkBatchInput::browse()
+{
+    // load system default open dialog
+    QString dirName =
+        QFileDialog::getExistingDirectory(this, tr("Open an Image Directory"), mCDirPath, QFileDialog::ShowDirsOnly | DkDialog::fileDialogOptions());
 
-	// load system default open dialog
-	QString dirName = QFileDialog::getExistingDirectory(
-		this, 
-		tr("Open an Image Directory"),
-		mCDirPath,
-		QFileDialog::ShowDirsOnly | DkDialog::fileDialogOptions()
-	);
+    if (dirName.isEmpty())
+        return;
 
-	if (dirName.isEmpty())
-		return;
-
-	setDir(dirName);
+    setDir(dirName);
 }
 
-QString DkBatchInput::getDir() const {
-
-	return mDirectoryEdit->existsDirectory() ? QDir(mDirectoryEdit->text()).absolutePath() : "";
+QString DkBatchInput::getDir() const
+{
+    return mDirectoryEdit->existsDirectory() ? QDir(mDirectoryEdit->text()).absolutePath() : "";
 }
 
-QStringList DkBatchInput::getSelectedFiles() const {
-	
-	QStringList textList = mInputTextEdit->getFileList();
+QStringList DkBatchInput::getSelectedFiles() const
+{
+    QStringList textList = mInputTextEdit->getFileList();
 
-	if (textList.empty())
-		return mThumbScrollWidget->getThumbWidget()->getSelectedFiles();
-	else
-		return textList;
+    if (textList.empty())
+        return mThumbScrollWidget->getThumbWidget()->getSelectedFiles();
+    else
+        return textList;
 }
 
-QStringList DkBatchInput::getSelectedFilesBatch() {
-
-	QStringList textList = mInputTextEdit->getFileList();
+QStringList DkBatchInput::getSelectedFilesBatch()
+{
+    QStringList textList = mInputTextEdit->getFileList();
 
-	if (textList.empty()) {
-		textList = mThumbScrollWidget->getThumbWidget()->getSelectedFiles();
-		mInputTextEdit->appendFiles(textList);
-	}
+    if (textList.empty()) {
+        textList = mThumbScrollWidget->getThumbWidget()->getSelectedFiles();
+        mInputTextEdit->appendFiles(textList);
+    }
 
-	return textList;
+    return textList;
 }
 
-
-DkInputTextEdit* DkBatchInput::getInputEdit() const {
-
-	return mInputTextEdit;
+DkInputTextEdit *DkBatchInput::getInputEdit() const
+{
+    return mInputTextEdit;
 }
 
-void DkBatchInput::setFileInfo(QFileInfo file) {
-
-	setDir(file.absoluteFilePath());
+void DkBatchInput::setFileInfo(QFileInfo file)
+{
+    setDir(file.absoluteFilePath());
 }
 
-void DkBatchInput::setDir(const QString& dirPath) {
-
-	mExplorer->setCurrentPath(dirPath);
+void DkBatchInput::setDir(const QString &dirPath)
+{
+    mExplorer->setCurrentPath(dirPath);
 
-	mCDirPath = dirPath;
-	qDebug() << "setting directory to:" << dirPath;
-	mDirectoryEdit->setText(mCDirPath);
-	emit newHeaderText(mCDirPath);
-	emit updateInputDir(mCDirPath);
-	mLoader->loadDir(mCDirPath, false);
-	mThumbScrollWidget->updateThumbs(mLoader->getImages());
+    mCDirPath = dirPath;
+    qDebug() << "setting directory to:" << dirPath;
+    mDirectoryEdit->setText(mCDirPath);
+    emit newHeaderText(mCDirPath);
+    emit updateInputDir(mCDirPath);
+    mLoader->loadDir(mCDirPath, false);
+    mThumbScrollWidget->updateThumbs(mLoader->getImages());
 }
 
-void DkBatchInput::selectionChanged() {
-
-	QString msg;
-	if (getSelectedFiles().empty())
-		msg = tr("No Files Selected");
-	else if (getSelectedFiles().size() == 1)
-		msg = tr("%1 File Selected").arg(getSelectedFiles().size());
-	else
-		msg = tr("%1 Files Selected").arg(getSelectedFiles().size());
-	
+void DkBatchInput::selectionChanged()
+{
+    QString msg;
+    if (getSelectedFiles().empty())
+        msg = tr("No Files Selected");
+    else if (getSelectedFiles().size() == 1)
+        msg = tr("%1 File Selected").arg(getSelectedFiles().size());
+    else
+        msg = tr("%1 Files Selected").arg(getSelectedFiles().size());
 
-	QString d = mInputTextEdit->firstDirPath();
+    QString d = mInputTextEdit->firstDirPath();
 
-	if (!d.isEmpty() && mCDirPath != d)
-		setDir(d);
-
-	emit newHeaderText(msg);
-	emit changed();
-}
+    if (!d.isEmpty() && mCDirPath != d)
+        setDir(d);
 
-void DkBatchInput::parameterChanged() {
-	
-	QString newDirPath = mDirectoryEdit->text();
-		
-	if (QDir(newDirPath).exists() && newDirPath != mCDirPath) {
-		setDir(newDirPath);
-		emit changed();
-	}
+    emit newHeaderText(msg);
+    emit changed();
 }
 
-void DkBatchInput::setResults(const QStringList& results) {
+void DkBatchInput::parameterChanged()
+{
+    QString newDirPath = mDirectoryEdit->text();
 
-	if (mInputTabs->count() < 3) {
-		mInputTabs->addTab(mResultTextEdit, tr("Results"));
-	}
-
-	mResultTextEdit->clear();
-	mResultTextEdit->setHtml(results.join("<br> "));
-	QTextCursor c = mResultTextEdit->textCursor();
-	c.movePosition(QTextCursor::End);
-	mResultTextEdit->setTextCursor(c);
-	mResultTextEdit->setVisible(true);
+    if (QDir(newDirPath).exists() && newDirPath != mCDirPath) {
+        setDir(newDirPath);
+        emit changed();
+    }
 }
 
-void DkBatchInput::startProcessing() {
-
-	if (mInputTabs->count() < 3) {
-		mInputTabs->addTab(mResultTextEdit, tr("Results"));
-	}
+void DkBatchInput::setResults(const QStringList &results)
+{
+    if (mInputTabs->count() < 3) {
+        mInputTabs->addTab(mResultTextEdit, tr("Results"));
+    }
 
-	changeTab(tab_results);
-	mInputTextEdit->setEnabled(false);
-	mResultTextEdit->clear();
+    mResultTextEdit->clear();
+    mResultTextEdit->setHtml(results.join("<br> "));
+    QTextCursor c = mResultTextEdit->textCursor();
+    c.movePosition(QTextCursor::End);
+    mResultTextEdit->setTextCursor(c);
+    mResultTextEdit->setVisible(true);
 }
 
-void DkBatchInput::stopProcessing() {
+void DkBatchInput::startProcessing()
+{
+    if (mInputTabs->count() < 3) {
+        mInputTabs->addTab(mResultTextEdit, tr("Results"));
+    }
 
-	//mInputTextEdit->clear();
-	mInputTextEdit->setEnabled(true);
+    changeTab(tab_results);
+    mInputTextEdit->setEnabled(false);
+    mResultTextEdit->clear();
 }
 
-// DkFileNameWdiget --------------------------------------------------------------------
-DkFilenameWidget::DkFilenameWidget(QWidget* parent) : DkWidget(parent) {
-
-	createLayout();
-	showOnlyFilename();
-}
-
-void DkFilenameWidget::createLayout() {
-	
-	mLayout = new QGridLayout(this);
-	mLayout->setContentsMargins(0,0,0,5);
-	setMaximumWidth(500);
-
-	mCbType = new QComboBox(this);
-	mCbType->setSizeAdjustPolicy(QComboBox::AdjustToContents);
-	mCbType->insertItem(fileNameTypes_fileName, tr("Current Filename"));
-	mCbType->insertItem(fileNameTypes_Text, tr("Text"));
-	mCbType->insertItem(fileNameTypes_Number, tr("Number"));
-	connect(mCbType, SIGNAL(currentIndexChanged(int)), this, SLOT(typeCBChanged(int)));
-	connect(mCbType, SIGNAL(currentIndexChanged(int)), this, SLOT(checkForUserInput()));
-	connect(mCbType, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed()));
-
-	mCbCase = new QComboBox(this);
-	mCbCase->addItem(tr("Keep Case"));
-	mCbCase->addItem(tr("To lowercase"));
-	mCbCase->addItem(tr("To UPPERCASE"));
-	connect(mCbCase, SIGNAL(currentIndexChanged(int)), this, SLOT(checkForUserInput()));
-	connect(mCbCase, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed()));
-
-	mSbNumber = new QSpinBox(this);
-	mSbNumber->setValue(1);
-	mSbNumber->setMinimum(0);
-	mSbNumber->setMaximum(999);	// changes - if cbDigits->setCurrentIndex() is changed!
-	connect(mSbNumber, SIGNAL(valueChanged(int)), this, SIGNAL(changed()));
-
-	mCbDigits = new QComboBox(this);
-	mCbDigits->addItem(tr("1 digit"));
-	mCbDigits->addItem(tr("2 digits"));
-	mCbDigits->addItem(tr("3 digits"));
-	mCbDigits->addItem(tr("4 digits"));
-	mCbDigits->addItem(tr("5 digits"));
-	mCbDigits->setCurrentIndex(2);	// see sBNumber->setMaximum()
-	connect(mCbDigits, SIGNAL(currentIndexChanged(int)), this, SLOT(digitCBChanged(int)));
-
-	mLeText = new QLineEdit(this);
-	connect(mCbCase, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed()));
-	connect(mLeText, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed()));
-
-	mPbPlus = new QPushButton("+", this);
-	mPbPlus->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
-	mPbPlus->setMinimumSize(10,10);
-	mPbPlus->setMaximumSize(30,30);
-	mPbMinus = new QPushButton("-", this);
-	mPbMinus->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
-	mPbMinus->setMinimumSize(10,10);
-	mPbMinus->setMaximumSize(30,30);
-	connect(mPbPlus, SIGNAL(clicked()), this, SLOT(pbPlusPressed()));
-	connect(mPbMinus, SIGNAL(clicked()), this, SLOT(pbMinusPressed()));
-	connect(mPbPlus, SIGNAL(clicked()), this, SIGNAL(changed()));
-	connect(mPbMinus, SIGNAL(clicked()), this, SIGNAL(changed()));
-}
-
-void DkFilenameWidget::typeCBChanged(int index) {
-	switch (index) {
-		case fileNameTypes_fileName: {showOnlyFilename(); break;};
-		case fileNameTypes_Text: {showOnlyText(); break;};
-		case fileNameTypes_Number: {showOnlyNumber(); break;};
-		default:
-			break;
-	}
-}
-
-void DkFilenameWidget::showOnlyFilename() {
-	mCbCase->show();
-
-	mSbNumber->hide();
-	mCbDigits->hide();
-	mLeText->hide();
-
-	mLayout->addWidget(mCbType, 0, fileNameWidget_type);
-	mLayout->addWidget(mCbCase, 0, fileNameWidget_input1);
-	//curLayout->addWidget(new QWidget(this), 0, fileNameWidget_input2 );
-	mLayout->addWidget(mPbPlus, 0, fileNameWidget_plus);
-	mLayout->addWidget(mPbMinus, 0, fileNameWidget_minus);
-
-}
-
-void DkFilenameWidget::showOnlyNumber() {
-	mSbNumber->show();
-	mCbDigits->show();
-
-	mCbCase->hide();
-	mLeText->hide();
-
-	mLayout->addWidget(mCbType, 0, fileNameWidget_type);
-	mLayout->addWidget(mSbNumber, 0, fileNameWidget_input1);
-	mLayout->addWidget(mCbDigits, 0, fileNameWidget_input2);
-	mLayout->addWidget(mPbPlus, 0, fileNameWidget_plus);
-	mLayout->addWidget(mPbMinus, 0, fileNameWidget_minus);
-}
-
-void DkFilenameWidget::showOnlyText() {
-	mLeText->show();
-
-	mSbNumber->hide();
-	mCbDigits->hide();
-	mCbCase->hide();
-	
-
-	mLayout->addWidget(mCbType, 0, fileNameWidget_type);
-	mLayout->addWidget(mLeText, 0, fileNameWidget_input1);
-	//curLayout->addWidget(new QWidget(this), 0, fileNameWidget_input2);
-	mLayout->addWidget(mPbPlus, 0, fileNameWidget_plus);
-	mLayout->addWidget(mPbMinus, 0, fileNameWidget_minus);
-}
-
-void DkFilenameWidget::pbPlusPressed() {
-	emit plusPressed(this);
-}
-
-void DkFilenameWidget::pbMinusPressed() {
-	emit minusPressed(this);
-}
-
-void DkFilenameWidget::enableMinusButton(bool enable) {
-	mPbMinus->setEnabled(enable);
-}
-
-void DkFilenameWidget::enablePlusButton(bool enable) {
-	mPbPlus->setEnabled(enable);
+void DkBatchInput::stopProcessing()
+{
+    // mInputTextEdit->clear();
+    mInputTextEdit->setEnabled(true);
 }
 
-void DkFilenameWidget::checkForUserInput() {
-	if(mCbType->currentIndex() == 0 && mCbCase->currentIndex() == 0)
-		hasChanged = false;
-	else
-		hasChanged = true;
-	//emit changed();
-}
-
-void DkFilenameWidget::digitCBChanged(int index) {
-	mSbNumber->setMaximum(qRound(pow(10, index+1)-1));
-	emit changed();
-}
-
-QString DkFilenameWidget::getTag() const {
-
-	QString tag;
-
-	switch (mCbType->currentIndex()) {
-		
-	case fileNameTypes_Number: 
-		{
-			tag += "<d:"; 
-			tag += QString::number(mCbDigits->currentIndex());	// is sensitive to the index
-			tag += ":" + QString::number(mSbNumber->value());
-			tag += ">";
-			break;
-		}
-	case fileNameTypes_fileName: 
-		{
-			tag += "<c:"; 
-			tag += QString::number(mCbCase->currentIndex());	// is sensitive to the index
-			tag += ">";
-			break;
-		}
-	case fileNameTypes_Text:
-		{
-			tag += mLeText->text();
-		}
-	}
+// DkFileNameWdiget --------------------------------------------------------------------
+DkFilenameWidget::DkFilenameWidget(QWidget *parent)
+    : DkWidget(parent)
+{
+    createLayout();
+    showOnlyFilename();
+}
+
+void DkFilenameWidget::createLayout()
+{
+    mLayout = new QGridLayout(this);
+    mLayout->setContentsMargins(0, 0, 0, 5);
+    setMaximumWidth(500);
+
+    mCbType = new QComboBox(this);
+    mCbType->setSizeAdjustPolicy(QComboBox::AdjustToContents);
+    mCbType->insertItem(fileNameTypes_fileName, tr("Current Filename"));
+    mCbType->insertItem(fileNameTypes_Text, tr("Text"));
+    mCbType->insertItem(fileNameTypes_Number, tr("Number"));
+    connect(mCbType, SIGNAL(currentIndexChanged(int)), this, SLOT(typeCBChanged(int)));
+    connect(mCbType, SIGNAL(currentIndexChanged(int)), this, SLOT(checkForUserInput()));
+    connect(mCbType, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed()));
+
+    mCbCase = new QComboBox(this);
+    mCbCase->addItem(tr("Keep Case"));
+    mCbCase->addItem(tr("To lowercase"));
+    mCbCase->addItem(tr("To UPPERCASE"));
+    connect(mCbCase, SIGNAL(currentIndexChanged(int)), this, SLOT(checkForUserInput()));
+    connect(mCbCase, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed()));
+
+    mSbNumber = new QSpinBox(this);
+    mSbNumber->setValue(1);
+    mSbNumber->setMinimum(0);
+    mSbNumber->setMaximum(999); // changes - if cbDigits->setCurrentIndex() is changed!
+    connect(mSbNumber, SIGNAL(valueChanged(int)), this, SIGNAL(changed()));
+
+    mCbDigits = new QComboBox(this);
+    mCbDigits->addItem(tr("1 digit"));
+    mCbDigits->addItem(tr("2 digits"));
+    mCbDigits->addItem(tr("3 digits"));
+    mCbDigits->addItem(tr("4 digits"));
+    mCbDigits->addItem(tr("5 digits"));
+    mCbDigits->setCurrentIndex(2); // see sBNumber->setMaximum()
+    connect(mCbDigits, SIGNAL(currentIndexChanged(int)), this, SLOT(digitCBChanged(int)));
+
+    mLeText = new QLineEdit(this);
+    connect(mCbCase, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed()));
+    connect(mLeText, SIGNAL(textChanged(const QString &)), this, SIGNAL(changed()));
+
+    mPbPlus = new QPushButton("+", this);
+    mPbPlus->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
+    mPbPlus->setMinimumSize(10, 10);
+    mPbPlus->setMaximumSize(30, 30);
+    mPbMinus = new QPushButton("-", this);
+    mPbMinus->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
+    mPbMinus->setMinimumSize(10, 10);
+    mPbMinus->setMaximumSize(30, 30);
+    connect(mPbPlus, SIGNAL(clicked()), this, SLOT(pbPlusPressed()));
+    connect(mPbMinus, SIGNAL(clicked()), this, SLOT(pbMinusPressed()));
+    connect(mPbPlus, SIGNAL(clicked()), this, SIGNAL(changed()));
+    connect(mPbMinus, SIGNAL(clicked()), this, SIGNAL(changed()));
+}
+
+void DkFilenameWidget::typeCBChanged(int index)
+{
+    switch (index) {
+    case fileNameTypes_fileName: {
+        showOnlyFilename();
+        break;
+    };
+    case fileNameTypes_Text: {
+        showOnlyText();
+        break;
+    };
+    case fileNameTypes_Number: {
+        showOnlyNumber();
+        break;
+    };
+    default:
+        break;
+    }
+}
+
+void DkFilenameWidget::showOnlyFilename()
+{
+    mCbCase->show();
+
+    mSbNumber->hide();
+    mCbDigits->hide();
+    mLeText->hide();
+
+    mLayout->addWidget(mCbType, 0, fileNameWidget_type);
+    mLayout->addWidget(mCbCase, 0, fileNameWidget_input1);
+    // curLayout->addWidget(new QWidget(this), 0, fileNameWidget_input2 );
+    mLayout->addWidget(mPbPlus, 0, fileNameWidget_plus);
+    mLayout->addWidget(mPbMinus, 0, fileNameWidget_minus);
+}
+
+void DkFilenameWidget::showOnlyNumber()
+{
+    mSbNumber->show();
+    mCbDigits->show();
+
+    mCbCase->hide();
+    mLeText->hide();
+
+    mLayout->addWidget(mCbType, 0, fileNameWidget_type);
+    mLayout->addWidget(mSbNumber, 0, fileNameWidget_input1);
+    mLayout->addWidget(mCbDigits, 0, fileNameWidget_input2);
+    mLayout->addWidget(mPbPlus, 0, fileNameWidget_plus);
+    mLayout->addWidget(mPbMinus, 0, fileNameWidget_minus);
+}
+
+void DkFilenameWidget::showOnlyText()
+{
+    mLeText->show();
+
+    mSbNumber->hide();
+    mCbDigits->hide();
+    mCbCase->hide();
+
+    mLayout->addWidget(mCbType, 0, fileNameWidget_type);
+    mLayout->addWidget(mLeText, 0, fileNameWidget_input1);
+    // curLayout->addWidget(new QWidget(this), 0, fileNameWidget_input2);
+    mLayout->addWidget(mPbPlus, 0, fileNameWidget_plus);
+    mLayout->addWidget(mPbMinus, 0, fileNameWidget_minus);
+}
+
+void DkFilenameWidget::pbPlusPressed()
+{
+    emit plusPressed(this);
+}
+
+void DkFilenameWidget::pbMinusPressed()
+{
+    emit minusPressed(this);
+}
+
+void DkFilenameWidget::enableMinusButton(bool enable)
+{
+    mPbMinus->setEnabled(enable);
+}
+
+void DkFilenameWidget::enablePlusButton(bool enable)
+{
+    mPbPlus->setEnabled(enable);
+}
+
+void DkFilenameWidget::checkForUserInput()
+{
+    if (mCbType->currentIndex() == 0 && mCbCase->currentIndex() == 0)
+        hasChanged = false;
+    else
+        hasChanged = true;
+    // emit changed();
+}
+
+void DkFilenameWidget::digitCBChanged(int index)
+{
+    mSbNumber->setMaximum(qRound(pow(10, index + 1) - 1));
+    emit changed();
+}
+
+QString DkFilenameWidget::getTag() const
+{
+    QString tag;
+
+    switch (mCbType->currentIndex()) {
+    case fileNameTypes_Number: {
+        tag += "<d:";
+        tag += QString::number(mCbDigits->currentIndex()); // is sensitive to the index
+        tag += ":" + QString::number(mSbNumber->value());
+        tag += ">";
+        break;
+    }
+    case fileNameTypes_fileName: {
+        tag += "<c:";
+        tag += QString::number(mCbCase->currentIndex()); // is sensitive to the index
+        tag += ">";
+        break;
+    }
+    case fileNameTypes_Text: {
+        tag += mLeText->text();
+    }
+    }
 
-	return tag;
+    return tag;
 }
 
-bool DkFilenameWidget::setTag(const QString & tag) {
-
-	QString cTag = tag;
-	QStringList cmds = cTag.split(":");
-
-	if (cmds.size() == 1) {
-		mCbType->setCurrentIndex(fileNameTypes_Text);
-		mLeText->setText(tag);
-	}
-	else {
+bool DkFilenameWidget::setTag(const QString &tag)
+{
+    QString cTag = tag;
+    QStringList cmds = cTag.split(":");
 
-		if (cmds[0] == "c") {
-			mCbType->setCurrentIndex(fileNameTypes_fileName);
-			mCbCase->setCurrentIndex(cmds[1].toInt());
-		}
-		else if (cmds[0] == "d") {
-			mCbType->setCurrentIndex(fileNameTypes_Number);
-			mCbDigits->setCurrentIndex(cmds[1].toInt());
-			mSbNumber->setValue(cmds[2].toInt());
-		}
-		else {
-			qWarning() << "cannot parse" << cmds;
-			return false;
-		}
-	}
+    if (cmds.size() == 1) {
+        mCbType->setCurrentIndex(fileNameTypes_Text);
+        mLeText->setText(tag);
+    } else {
+        if (cmds[0] == "c") {
+            mCbType->setCurrentIndex(fileNameTypes_fileName);
+            mCbCase->setCurrentIndex(cmds[1].toInt());
+        } else if (cmds[0] == "d") {
+            mCbType->setCurrentIndex(fileNameTypes_Number);
+            mCbDigits->setCurrentIndex(cmds[1].toInt());
+            mSbNumber->setValue(cmds[2].toInt());
+        } else {
+            qWarning() << "cannot parse" << cmds;
+            return false;
+        }
+    }
 
-	return true;
+    return true;
 }
 
 // DkBatchOutput --------------------------------------------------------------------
-DkBatchOutput::DkBatchOutput(QWidget* parent , Qt::WindowFlags f ) : DkWidget(parent, f) {
-
-	setObjectName("DkBatchOutput");
-	createLayout();
-}
-
-void DkBatchOutput::createLayout() {
-
-	// Output Directory Groupbox
-	QLabel* outDirLabel = new QLabel(tr("Output Directory"), this);
-	outDirLabel->setObjectName("subTitle");
-
-	mOutputBrowseButton = new QPushButton(tr("Browse"));
-	mOutputlineEdit = new DkDirectoryEdit(this);
-	mOutputlineEdit->setPlaceholderText(tr("Select a Directory"));
-	connect(mOutputBrowseButton , SIGNAL(clicked()), this, SLOT(browse()));
-	connect(mOutputlineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(setDir(const QString&)));
-
-	// overwrite existing
-	mCbOverwriteExisting = new QCheckBox(tr("Overwrite Existing Files"));
-	mCbOverwriteExisting->setToolTip(tr("If checked, existing files are overwritten.\nThis option might destroy your images - so be careful!"));
-	connect(mCbOverwriteExisting, SIGNAL(clicked()), this, SIGNAL(changed()));
-
-	// overwrite existing
-	mCbDoNotSave = new QCheckBox(tr("Do not Save Output Images"));
-	mCbDoNotSave->setToolTip(tr("If checked, output images are not saved at all.\nThis option is only useful if plugins save sidecar files - so be careful!"));
-	connect(mCbDoNotSave, SIGNAL(clicked()), this, SIGNAL(changed()));
-
-	// Use Input Folder
-	mCbUseInput = new QCheckBox(tr("Use Input Folder"));
-	mCbUseInput->setToolTip(tr("If checked, the batch is applied to the input folder - so be careful!"));
-	connect(mCbUseInput, SIGNAL(clicked(bool)), this, SLOT(useInputFolderChanged(bool)));
-
-	// delete original
-	mCbDeleteOriginal = new QCheckBox(tr("Delete Input Files"));
-	mCbDeleteOriginal->setToolTip(tr("If checked, the original file will be deleted if the conversion was successful.\n So be careful!"));
-
-	QWidget* cbWidget = new QWidget(this);
-	QVBoxLayout* cbLayout = new QVBoxLayout(cbWidget);
-	cbLayout->setContentsMargins(0,0,0,0);
-	cbLayout->addWidget(mCbUseInput);
-	cbLayout->addWidget(mCbOverwriteExisting);
-	cbLayout->addWidget(mCbDoNotSave);
-	cbLayout->addWidget(mCbDeleteOriginal);
-
-	QWidget* outDirWidget = new QWidget(this);
-	QGridLayout* outDirLayout = new QGridLayout(outDirWidget);
-	//outDirLayout->setContentsMargins(0, 0, 0, 0);
-	outDirLayout->addWidget(mOutputBrowseButton, 0, 0);
-	outDirLayout->addWidget(mOutputlineEdit, 0, 1);
-	outDirLayout->addWidget(cbWidget, 1, 0);
-
-	// Filename Groupbox
-	QLabel* fileNameLabel = new QLabel(tr("Filename"), this);
-	fileNameLabel->setObjectName("subTitle");
-
-	QWidget* fileNameWidget = new QWidget(this);
-	mFilenameVBLayout = new QVBoxLayout(fileNameWidget);
-	mFilenameVBLayout->setSpacing(0);
-	
-	DkFilenameWidget* fwidget = new DkFilenameWidget(this);
-	fwidget->enableMinusButton(false);
-	mFilenameWidgets.push_back(fwidget);
-	mFilenameVBLayout->addWidget(fwidget);
-	connect(fwidget, SIGNAL(plusPressed(DkFilenameWidget*)), this, SLOT(plusPressed(DkFilenameWidget*)));
-	connect(fwidget, SIGNAL(minusPressed(DkFilenameWidget*)), this, SLOT(minusPressed(DkFilenameWidget*)));
-	connect(fwidget, SIGNAL(changed()), this, SLOT(parameterChanged()));
-
-	QWidget* extensionWidget = new QWidget(this);
-	QHBoxLayout* extensionLayout = new QHBoxLayout(extensionWidget);
-	extensionLayout->setAlignment(Qt::AlignLeft);
-	//extensionLayout->setSpacing(0);
-	extensionLayout->setContentsMargins(0,0,0,0);
-	mCbExtension = new QComboBox(this);
-	mCbExtension->addItem(tr("Keep Extension"));
-	mCbExtension->addItem(tr("Convert To"));
-	connect(mCbExtension, SIGNAL(currentIndexChanged(int)), this, SLOT(extensionCBChanged(int)));
-
-	mCbNewExtension = new QComboBox(this);
-	mCbNewExtension->addItems(DkSettingsManager::param().app().saveFilters);
-	mCbNewExtension->setFixedWidth(150);
-	mCbNewExtension->setEnabled(false);
-	connect(mCbNewExtension, SIGNAL(currentIndexChanged(int)), this, SLOT(parameterChanged()));
-
-	mCbCompression = new QComboBox(this);
-	mCbCompression->addItem(tr("Best Quality"), 100);
-	mCbCompression->addItem(tr("High Quality"), 97);
-	mCbCompression->addItem(tr("Medium Quality"), 90);
-	mCbCompression->addItem(tr("Low Quality"), 80);
-	mCbCompression->addItem(tr("Bad Quality"), 60);
-	mCbCompression->setCurrentIndex(1);
-	mCbCompression->setEnabled(false);
-
-	extensionLayout->addWidget(mCbExtension);
-	extensionLayout->addWidget(mCbNewExtension);
-	extensionLayout->addWidget(mCbCompression);
-	//extensionLayout->addStretch();
-	mFilenameVBLayout->addWidget(extensionWidget);
-	
-	QLabel* previewLabel = new QLabel(tr("Preview"), this);
-	previewLabel->setObjectName("subTitle");
-
-	QLabel* oldLabel = new QLabel(tr("Old Filename: "));
-	oldLabel->setObjectName("FileNamePreviewLabel");
-	mOldFileNameLabel = new QLabel("");
-	mOldFileNameLabel->setObjectName("FileNamePreviewLabel");
-
-	QLabel* newLabel = new QLabel(tr("New Filename: "));
-	newLabel->setObjectName("FileNamePreviewLabel");
-	mNewFileNameLabel = new QLabel("");
-	mNewFileNameLabel->setObjectName("FileNamePreviewLabel");
-
-	// Preview Widget
-	QWidget* previewWidget = new QWidget(this);
-	QGridLayout* previewGBLayout = new QGridLayout(previewWidget);
-	//previewWidget->hide();	// show if more than 1 file is selected
-	previewGBLayout->addWidget(oldLabel, 0, 0);
-	previewGBLayout->addWidget(mOldFileNameLabel, 0, 1);
-	previewGBLayout->addWidget(newLabel, 1, 0);
-	previewGBLayout->addWidget(mNewFileNameLabel, 1, 1);
-	previewGBLayout->setColumnStretch(3, 10);
-	previewGBLayout->setAlignment(Qt::AlignTop);
-	
-	QGridLayout* contentLayout = new QGridLayout(this);
-	contentLayout->setContentsMargins(0, 0, 0, 0);
-	contentLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
-	contentLayout->addWidget(outDirLabel, 2, 0);
-	contentLayout->addWidget(outDirWidget, 3, 0);
-	contentLayout->addWidget(fileNameLabel, 4, 0);
-	contentLayout->addWidget(fileNameWidget, 5, 0);
-	contentLayout->addWidget(previewLabel, 6, 0);
-	contentLayout->addWidget(previewWidget, 7, 0);
-	setLayout(contentLayout);
-}
-
-void DkBatchOutput::browse() {
-
-	QString dirGuess = (mOutputlineEdit->text().isEmpty()) ? mInputDirectory : mOutputlineEdit->text();
-	
-	// load system default open dialog
-	QString dirName = QFileDialog::getExistingDirectory(
-		this, 
-		tr("Open an Image Directory"),
-		dirGuess,
-		QFileDialog::ShowDirsOnly | DkDialog::fileDialogOptions()
-	);
+DkBatchOutput::DkBatchOutput(QWidget *parent, Qt::WindowFlags f)
+    : DkWidget(parent, f)
+{
+    setObjectName("DkBatchOutput");
+    createLayout();
+}
+
+void DkBatchOutput::createLayout()
+{
+    // Output Directory Groupbox
+    QLabel *outDirLabel = new QLabel(tr("Output Directory"), this);
+    outDirLabel->setObjectName("subTitle");
+
+    mOutputBrowseButton = new QPushButton(tr("Browse"));
+    mOutputlineEdit = new DkDirectoryEdit(this);
+    mOutputlineEdit->setPlaceholderText(tr("Select a Directory"));
+    connect(mOutputBrowseButton, SIGNAL(clicked()), this, SLOT(browse()));
+    connect(mOutputlineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(setDir(const QString &)));
+
+    // overwrite existing
+    mCbOverwriteExisting = new QCheckBox(tr("Overwrite Existing Files"));
+    mCbOverwriteExisting->setToolTip(tr("If checked, existing files are overwritten.\nThis option might destroy your images - so be careful!"));
+    connect(mCbOverwriteExisting, SIGNAL(clicked()), this, SIGNAL(changed()));
+
+    // overwrite existing
+    mCbDoNotSave = new QCheckBox(tr("Do not Save Output Images"));
+    mCbDoNotSave->setToolTip(tr("If checked, output images are not saved at all.\nThis option is only useful if plugins save sidecar files - so be careful!"));
+    connect(mCbDoNotSave, SIGNAL(clicked()), this, SIGNAL(changed()));
+
+    // Use Input Folder
+    mCbUseInput = new QCheckBox(tr("Use Input Folder"));
+    mCbUseInput->setToolTip(tr("If checked, the batch is applied to the input folder - so be careful!"));
+    connect(mCbUseInput, SIGNAL(clicked(bool)), this, SLOT(useInputFolderChanged(bool)));
+
+    // delete original
+    mCbDeleteOriginal = new QCheckBox(tr("Delete Input Files"));
+    mCbDeleteOriginal->setToolTip(tr("If checked, the original file will be deleted if the conversion was successful.\n So be careful!"));
+
+    QWidget *cbWidget = new QWidget(this);
+    QVBoxLayout *cbLayout = new QVBoxLayout(cbWidget);
+    cbLayout->setContentsMargins(0, 0, 0, 0);
+    cbLayout->addWidget(mCbUseInput);
+    cbLayout->addWidget(mCbOverwriteExisting);
+    cbLayout->addWidget(mCbDoNotSave);
+    cbLayout->addWidget(mCbDeleteOriginal);
+
+    QWidget *outDirWidget = new QWidget(this);
+    QGridLayout *outDirLayout = new QGridLayout(outDirWidget);
+    // outDirLayout->setContentsMargins(0, 0, 0, 0);
+    outDirLayout->addWidget(mOutputBrowseButton, 0, 0);
+    outDirLayout->addWidget(mOutputlineEdit, 0, 1);
+    outDirLayout->addWidget(cbWidget, 1, 0);
+
+    // Filename Groupbox
+    QLabel *fileNameLabel = new QLabel(tr("Filename"), this);
+    fileNameLabel->setObjectName("subTitle");
+
+    QWidget *fileNameWidget = new QWidget(this);
+    mFilenameVBLayout = new QVBoxLayout(fileNameWidget);
+    mFilenameVBLayout->setSpacing(0);
+
+    DkFilenameWidget *fwidget = new DkFilenameWidget(this);
+    fwidget->enableMinusButton(false);
+    mFilenameWidgets.push_back(fwidget);
+    mFilenameVBLayout->addWidget(fwidget);
+    connect(fwidget, SIGNAL(plusPressed(DkFilenameWidget *)), this, SLOT(plusPressed(DkFilenameWidget *)));
+    connect(fwidget, SIGNAL(minusPressed(DkFilenameWidget *)), this, SLOT(minusPressed(DkFilenameWidget *)));
+    connect(fwidget, SIGNAL(changed()), this, SLOT(parameterChanged()));
+
+    QWidget *extensionWidget = new QWidget(this);
+    QHBoxLayout *extensionLayout = new QHBoxLayout(extensionWidget);
+    extensionLayout->setAlignment(Qt::AlignLeft);
+    // extensionLayout->setSpacing(0);
+    extensionLayout->setContentsMargins(0, 0, 0, 0);
+    mCbExtension = new QComboBox(this);
+    mCbExtension->addItem(tr("Keep Extension"));
+    mCbExtension->addItem(tr("Convert To"));
+    connect(mCbExtension, SIGNAL(currentIndexChanged(int)), this, SLOT(extensionCBChanged(int)));
+
+    mCbNewExtension = new QComboBox(this);
+    mCbNewExtension->addItems(DkSettingsManager::param().app().saveFilters);
+    mCbNewExtension->setFixedWidth(150);
+    mCbNewExtension->setEnabled(false);
+    connect(mCbNewExtension, SIGNAL(currentIndexChanged(int)), this, SLOT(parameterChanged()));
+
+    mCbCompression = new QComboBox(this);
+    updateCBCompression();
+    mCbCompression->setEnabled(false);
+
+    extensionLayout->addWidget(mCbExtension);
+    extensionLayout->addWidget(mCbNewExtension);
+    extensionLayout->addWidget(mCbCompression);
+    // extensionLayout->addStretch();
+    mFilenameVBLayout->addWidget(extensionWidget);
+
+    QLabel *previewLabel = new QLabel(tr("Preview"), this);
+    previewLabel->setObjectName("subTitle");
+
+    QLabel *oldLabel = new QLabel(tr("Old Filename: "));
+    oldLabel->setObjectName("FileNamePreviewLabel");
+    mOldFileNameLabel = new QLabel("");
+    mOldFileNameLabel->setObjectName("FileNamePreviewLabel");
+
+    QLabel *newLabel = new QLabel(tr("New Filename: "));
+    newLabel->setObjectName("FileNamePreviewLabel");
+    mNewFileNameLabel = new QLabel("");
+    mNewFileNameLabel->setObjectName("FileNamePreviewLabel");
+
+    // Preview Widget
+    QWidget *previewWidget = new QWidget(this);
+    QGridLayout *previewGBLayout = new QGridLayout(previewWidget);
+    // previewWidget->hide();	// show if more than 1 file is selected
+    previewGBLayout->addWidget(oldLabel, 0, 0);
+    previewGBLayout->addWidget(mOldFileNameLabel, 0, 1);
+    previewGBLayout->addWidget(newLabel, 1, 0);
+    previewGBLayout->addWidget(mNewFileNameLabel, 1, 1);
+    previewGBLayout->setColumnStretch(3, 10);
+    previewGBLayout->setAlignment(Qt::AlignTop);
+
+    QGridLayout *contentLayout = new QGridLayout(this);
+    contentLayout->setContentsMargins(0, 0, 0, 0);
+    contentLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
+    contentLayout->addWidget(outDirLabel, 2, 0);
+    contentLayout->addWidget(outDirWidget, 3, 0);
+    contentLayout->addWidget(fileNameLabel, 4, 0);
+    contentLayout->addWidget(fileNameWidget, 5, 0);
+    contentLayout->addWidget(previewLabel, 6, 0);
+    contentLayout->addWidget(previewWidget, 7, 0);
+    setLayout(contentLayout);
+}
+
+void DkBatchOutput::updateCBCompression()
+{
+    const QString quality_label[5] = {tr("Best Quality"), tr("High Quality"), tr("Medium Quality"), tr("Low Quality"), tr("Bad Quality")};
+    int quality[5];
+
+    const QString extStr = mCbNewExtension->currentText();
+    if (extStr.contains(QRegularExpression("(avif)", QRegularExpression::CaseInsensitiveOption))) {
+        quality[0] = 100;
+        quality[1] = 80;
+        quality[2] = 60;
+        quality[3] = 40;
+        quality[4] = 20;
+    } else { // quality used for JPG and other formats
+        quality[0] = 100;
+        quality[1] = 97;
+        quality[2] = 90;
+        quality[3] = 80;
+        quality[4] = 60;
+    }
+
+    int previous_index = mCbCompression->currentIndex();
+
+    mCbCompression->clear();
+    for (int index = 0; index < 5; index++) {
+        mCbCompression->insertItem(index, quality_label[index], quality[index]);
+    }
+
+    if (previous_index == -1) {
+        mCbCompression->setCurrentIndex(1);
+    } else {
+        mCbCompression->setCurrentIndex(previous_index);
+    }
+}
+
+void DkBatchOutput::browse()
+{
+    QString dirGuess = (mOutputlineEdit->text().isEmpty()) ? mInputDirectory : mOutputlineEdit->text();
+
+    // load system default open dialog
+    QString dirName =
+        QFileDialog::getExistingDirectory(this, tr("Open an Image Directory"), dirGuess, QFileDialog::ShowDirsOnly | DkDialog::fileDialogOptions());
+
+    if (dirName.isEmpty())
+        return;
 
-	if (dirName.isEmpty())
-		return;
-
-	setDir(dirName);
+    setDir(dirName);
 }
 
-void DkBatchOutput::setDir(const QString& dirPath, bool updateLineEdit) {
+void DkBatchOutput::setDir(const QString &dirPath, bool updateLineEdit)
+{
+    mOutputDirectory = dirPath;
+    emit newHeaderText(dirPath);
 
-	mOutputDirectory = dirPath;
-	emit newHeaderText(dirPath);
-	
-	if (updateLineEdit)
-		mOutputlineEdit->setText(dirPath);
+    if (updateLineEdit)
+        mOutputlineEdit->setText(dirPath);
 }
 
-void DkBatchOutput::setInputDir(const QString& dirPath) {
-	mInputDirectory = dirPath;
+void DkBatchOutput::setInputDir(const QString &dirPath)
+{
+    mInputDirectory = dirPath;
 
-	if (mCbUseInput->isChecked())
-		setDir(mInputDirectory);
+    if (mCbUseInput->isChecked())
+        setDir(mInputDirectory);
 }
 
-void DkBatchOutput::useInputFolderChanged(bool checked) {
-
-	mOutputlineEdit->setEnabled(!checked);
-	mOutputBrowseButton->setEnabled(!checked);
+void DkBatchOutput::useInputFolderChanged(bool checked)
+{
+    mOutputlineEdit->setEnabled(!checked);
+    mOutputBrowseButton->setEnabled(!checked);
 
-	if (checked)
-		setDir(mInputDirectory);
+    if (checked)
+        setDir(mInputDirectory);
 }
 
-void DkBatchOutput::plusPressed(DkFilenameWidget* widget, const QString& tag) {
-
-	DkFilenameWidget* fw = createFilenameWidget(tag);
+void DkBatchOutput::plusPressed(DkFilenameWidget *widget, const QString &tag)
+{
+    DkFilenameWidget *fw = createFilenameWidget(tag);
 
-	int index = mFilenameVBLayout->indexOf(widget);
-	mFilenameWidgets.insert(index + 1, fw);
-	if (mFilenameWidgets.size() > 4) {
-		for (int i = 0; i  < mFilenameWidgets.size(); i++)
-			mFilenameWidgets[i]->enablePlusButton(false);
-	}
-	mFilenameVBLayout->insertWidget(index + 1, fw); // append to current widget
+    int index = mFilenameVBLayout->indexOf(widget);
+    mFilenameWidgets.insert(index + 1, fw);
+    if (mFilenameWidgets.size() > 4) {
+        for (int i = 0; i < mFilenameWidgets.size(); i++)
+            mFilenameWidgets[i]->enablePlusButton(false);
+    }
+    mFilenameVBLayout->insertWidget(index + 1, fw); // append to current widget
 
-	parameterChanged();
+    parameterChanged();
 }
 
-void DkBatchOutput::addFilenameWidget(const QString& tag) {
-
-	DkFilenameWidget* fw = createFilenameWidget(tag);
-	mFilenameWidgets.append(fw);
-	mFilenameVBLayout->insertWidget(mFilenameWidgets.size()-1, fw); // append to current widget
+void DkBatchOutput::addFilenameWidget(const QString &tag)
+{
+    DkFilenameWidget *fw = createFilenameWidget(tag);
+    mFilenameWidgets.append(fw);
+    mFilenameVBLayout->insertWidget(mFilenameWidgets.size() - 1, fw); // append to current widget
 }
 
-DkFilenameWidget * DkBatchOutput::createFilenameWidget(const QString & tag) {
-
-	DkFilenameWidget* fw = new DkFilenameWidget(this);
-	fw->setTag(tag);
+DkFilenameWidget *DkBatchOutput::createFilenameWidget(const QString &tag)
+{
+    DkFilenameWidget *fw = new DkFilenameWidget(this);
+    fw->setTag(tag);
 
-	connect(fw, SIGNAL(plusPressed(DkFilenameWidget*)), this, SLOT(plusPressed(DkFilenameWidget*)));
-	connect(fw, SIGNAL(minusPressed(DkFilenameWidget*)), this, SLOT(minusPressed(DkFilenameWidget*)));
-	connect(fw, SIGNAL(changed()), this, SLOT(parameterChanged()));
+    connect(fw, SIGNAL(plusPressed(DkFilenameWidget *)), this, SLOT(plusPressed(DkFilenameWidget *)));
+    connect(fw, SIGNAL(minusPressed(DkFilenameWidget *)), this, SLOT(minusPressed(DkFilenameWidget *)));
+    connect(fw, SIGNAL(changed()), this, SLOT(parameterChanged()));
 
-	return fw;
+    return fw;
 }
 
-void DkBatchOutput::minusPressed(DkFilenameWidget* widget) {
-	
-	mFilenameVBLayout->removeWidget(widget);
-	mFilenameWidgets.remove(mFilenameWidgets.indexOf(widget));
-	if (mFilenameWidgets.size() <= 4) {
-		for (int i = 0; i  < mFilenameWidgets.size(); i++)
-			mFilenameWidgets[i]->enablePlusButton(true);
-	}
+void DkBatchOutput::minusPressed(DkFilenameWidget *widget)
+{
+    mFilenameVBLayout->removeWidget(widget);
+    mFilenameWidgets.remove(mFilenameWidgets.indexOf(widget));
+    if (mFilenameWidgets.size() <= 4) {
+        for (int i = 0; i < mFilenameWidgets.size(); i++)
+            mFilenameWidgets[i]->enablePlusButton(true);
+    }
 
-	widget->hide();
+    widget->hide();
 
-	parameterChanged();
+    parameterChanged();
 }
 
-void DkBatchOutput::extensionCBChanged(int index) {
-	
-	mCbNewExtension->setEnabled(index > 0);
-	parameterChanged();
+void DkBatchOutput::extensionCBChanged(int index)
+{
+    mCbNewExtension->setEnabled(index > 0);
+    parameterChanged();
 }
 
-
-bool DkBatchOutput::hasUserInput() const {
-	// TODO add output directory 
-	return mFilenameWidgets.size() > 1 || mFilenameWidgets[0]->hasUserInput() || mCbExtension->currentIndex() == 1;
+bool DkBatchOutput::hasUserInput() const
+{
+    // TODO add output directory
+    return mFilenameWidgets.size() > 1 || mFilenameWidgets[0]->hasUserInput() || mCbExtension->currentIndex() == 1;
 }
 
-void DkBatchOutput::parameterChanged() {
-
-	// enable/disable compression combo
-	QString extStr = mCbNewExtension->currentText();
-	mCbCompression->setEnabled(extStr.contains(QRegExp("(jpg|jp2|webp)", Qt::CaseInsensitive)));
+void DkBatchOutput::parameterChanged()
+{
+    // enable/disable compression combo
+    QString extStr = mCbNewExtension->currentText();
+    mCbCompression->setEnabled(extStr.contains(QRegularExpression("(avif|jpg|jp2|jxl|webp)", QRegularExpression::CaseInsensitiveOption)));
 
-	updateFileLabelPreview();
-	emit changed();
+    updateCBCompression();
+    updateFileLabelPreview();
+    emit changed();
 }
 
-void DkBatchOutput::updateFileLabelPreview() {
-
-	if (mExampleName.isEmpty())
-		return;
+void DkBatchOutput::updateFileLabelPreview()
+{
+    if (mExampleName.isEmpty())
+        return;
 
-	DkFileNameConverter converter(mExampleName, getFilePattern(), 0);
+    DkFileNameConverter converter(mExampleName, getFilePattern(), 0);
 
-	mOldFileNameLabel->setText(mExampleName);
-	mNewFileNameLabel->setText(converter.getConvertedFileName());
+    mOldFileNameLabel->setText(mExampleName);
+    mNewFileNameLabel->setText(converter.getConvertedFileName());
 }
 
-QString DkBatchOutput::getOutputDirectory() {
-	return mOutputlineEdit->text();
+QString DkBatchOutput::getOutputDirectory()
+{
+    return mOutputlineEdit->text();
 }
 
-QString DkBatchOutput::getFilePattern() {
-
-	QString pattern = "";
-
-	for (int idx = 0; idx < mFilenameWidgets.size(); idx++)
-		pattern += mFilenameWidgets.at(idx)->getTag();	
+QString DkBatchOutput::getFilePattern()
+{
+    QString pattern = "";
 
-	if (mCbExtension->currentIndex() == 0) {
-		pattern += ".<old>";
-	}
-	else {
-		QString ext = mCbNewExtension->itemText(mCbNewExtension->currentIndex());
+    for (int idx = 0; idx < mFilenameWidgets.size(); idx++)
+        pattern += mFilenameWidgets.at(idx)->getTag();
 
-		QStringList tmp = ext.split("(");
+    if (mCbExtension->currentIndex() == 0) {
+        pattern += ".<old>";
+    } else {
+        QString ext = mCbNewExtension->itemText(mCbNewExtension->currentIndex());
 
-		if (tmp.size() == 2) {
+        QStringList tmp = ext.split("(");
 
-			QString filters = tmp.at(1);
-			filters.replace(")", "");
-			filters.replace("*", "");
+        if (tmp.size() == 2) {
+            QString filters = tmp.at(1);
+            filters.replace(")", "");
+            filters.replace("*", "");
 
-			QStringList extList = filters.split(" ");
+            QStringList extList = filters.split(" ");
 
-			if (!extList.empty())
-				pattern += extList[0];
-		}
-	}
+            if (!extList.empty())
+                pattern += extList[0];
+        }
+    }
 
-	return pattern;
+    return pattern;
 }
 
-void DkBatchOutput::loadFilePattern(const QString & pattern) {
+void DkBatchOutput::loadFilePattern(const QString &pattern)
+{
+    QStringList nameList = pattern.split(".");
+    QString ext = nameList.last();
 
-	QStringList nameList = pattern.split(".");
-	QString ext = nameList.last();
+    QString p = pattern;
+    p = p.replace("." + ext, ""); // remove extension
+    p = p.replace(">", "<");
 
-	QString p = pattern;
-	p = p.replace("." + ext, "");		// remove extension
-	p = p.replace(">", "<");
-		
-	QStringList cmdsRaw = p.split("<");
-	QStringList cmds;
+    QStringList cmdsRaw = p.split("<");
+    QStringList cmds;
 
-	for (const QString& c : cmdsRaw) {
-		if (!c.trimmed().isEmpty())
-			cmds << c;
-	}
+    for (const QString &c : cmdsRaw) {
+        if (!c.trimmed().isEmpty())
+            cmds << c;
+    }
 
-	// uff - first is special
-	if (!cmds.empty() && !mFilenameWidgets.empty()) {
-		mFilenameWidgets.first()->setTag(cmds.first());
-		cmds.pop_front();
-	}
+    // uff - first is special
+    if (!cmds.empty() && !mFilenameWidgets.empty()) {
+        mFilenameWidgets.first()->setTag(cmds.first());
+        cmds.pop_front();
+    }
 
-	for (const QString& c : cmds) {
+    for (const QString &c : cmds) {
+        if (c.isEmpty())
+            continue;
 
-		if (c.isEmpty())
-			continue;
-		
-		qDebug() << "processing: " << c;
-		addFilenameWidget(c);
-	}
+        qDebug() << "processing: " << c;
+        addFilenameWidget(c);
+    }
 
-	if (ext != "<old>") {
-		mCbExtension->setCurrentIndex(1);
-		int idx = mCbNewExtension->findText(ext, Qt::MatchContains);
-		mCbNewExtension->setCurrentIndex(idx);
-	}
-	else {
-		mCbExtension->setCurrentIndex(0);
-	}
+    if (ext != "<old>") {
+        mCbExtension->setCurrentIndex(1);
+        int idx = mCbNewExtension->findText(ext, Qt::MatchContains);
+        mCbNewExtension->setCurrentIndex(idx);
+    } else {
+        mCbExtension->setCurrentIndex(0);
+    }
 }
 
-int DkBatchOutput::getCompression() const {
+int DkBatchOutput::getCompression() const
+{
+    if (!mCbCompression->isEnabled())
+        return -1;
 
-	if (!mCbCompression->isEnabled())
-		return -1;
-
-	return mCbCompression->itemData(mCbCompression->currentIndex()).toInt();
+    return mCbCompression->itemData(mCbCompression->currentIndex()).toInt();
 }
 
-void DkBatchOutput::applyDefault() {
-
-	mCbUseInput->setChecked(false);
-	mCbDeleteOriginal->setChecked(false);
-	mCbOverwriteExisting->setChecked(false);
-	mCbDoNotSave->setChecked(false);
-	mCbExtension->setCurrentIndex(0);
-	mCbNewExtension->setCurrentIndex(0);
-	mCbCompression->setCurrentIndex(0);
-	mOutputDirectory = "";
-	mInputDirectory = "";
-	mHUserInput = false;
-	mRUserInput = false;
+void DkBatchOutput::applyDefault()
+{
+    mCbUseInput->setChecked(false);
+    mCbDeleteOriginal->setChecked(false);
+    mCbOverwriteExisting->setChecked(false);
+    mCbDoNotSave->setChecked(false);
+    mCbExtension->setCurrentIndex(0);
+    mCbNewExtension->setCurrentIndex(0);
+    mCbCompression->setCurrentIndex(0);
+    mOutputDirectory = "";
+    mInputDirectory = "";
+    mHUserInput = false;
+    mRUserInput = false;
 
-	// remove all but the first
-	for (int idx = mFilenameWidgets.size()-1; idx > 0; idx--) {
-		mFilenameWidgets[idx]->deleteLater();
-		mFilenameWidgets.pop_back();
-	}
+    // remove all but the first
+    for (int idx = mFilenameWidgets.size() - 1; idx > 0; idx--) {
+        mFilenameWidgets[idx]->deleteLater();
+        mFilenameWidgets.pop_back();
+    }
 
-	if (!mFilenameWidgets.empty()) {
-		mFilenameWidgets[0]->setTag("c:0");	// current filename
-	}
-	else
-		qWarning() << "no filename widgets...";
+    if (!mFilenameWidgets.empty()) {
+        mFilenameWidgets[0]->setTag("c:0"); // current filename
+    } else
+        qWarning() << "no filename widgets...";
 
-	mOutputlineEdit->setText(mOutputDirectory);
+    mOutputlineEdit->setText(mOutputDirectory);
 }
 
-void DkBatchOutput::loadProperties(const DkBatchConfig & config) {
+void DkBatchOutput::loadProperties(const DkBatchConfig &config)
+{
+    DkSaveInfo si = config.saveInfo();
+    mCbOverwriteExisting->setChecked((si.mode() & DkSaveInfo::mode_overwrite) != 0);
+    mCbDoNotSave->setChecked((si.mode() & DkSaveInfo::mode_do_not_save_output) != 0);
+    mCbDeleteOriginal->setChecked(si.isDeleteOriginal());
+    mCbUseInput->setChecked(si.isInputDirOutputDir());
+    mOutputlineEdit->setText(config.getOutputDirPath());
 
-	DkSaveInfo si = config.saveInfo();
-	mCbOverwriteExisting->setChecked((si.mode() & DkSaveInfo::mode_overwrite) != 0);
-	mCbDoNotSave->setChecked((si.mode() & DkSaveInfo::mode_do_not_save_output) != 0);
-	mCbDeleteOriginal->setChecked(si.isDeleteOriginal());
-	mCbUseInput->setChecked(si.isInputDirOutputDir());
-	mOutputlineEdit->setText(config.getOutputDirPath());
-	
-	int c = si.compression();
+    int c = si.compression();
 
-	for (int idx = 0; idx < mCbCompression->count(); idx++) {
-		if (mCbCompression->itemData(idx).toInt() == c) {
-			mCbCompression->setCurrentIndex(idx);
-			break;
-		}
-	}
+    for (int idx = 0; idx < mCbCompression->count(); idx++) {
+        if (mCbCompression->itemData(idx).toInt() == c) {
+            mCbCompression->setCurrentIndex(idx);
+            break;
+        }
+    }
 
-	loadFilePattern(config.getFileNamePattern());
+    loadFilePattern(config.getFileNamePattern());
 
-	parameterChanged();
+    parameterChanged();
 }
 
-DkSaveInfo::OverwriteMode DkBatchOutput::overwriteMode() const {
-
-	DkSaveInfo::OverwriteMode mode = DkSaveInfo::mode_skip_existing;
+DkSaveInfo::OverwriteMode DkBatchOutput::overwriteMode() const
+{
+    DkSaveInfo::OverwriteMode mode = DkSaveInfo::mode_skip_existing;
 
-	if (mCbOverwriteExisting->isChecked())
-		mode = (DkSaveInfo::OverwriteMode)(mode | DkSaveInfo::mode_overwrite);
-	if (mCbDoNotSave->isChecked())
-		mode = (DkSaveInfo::OverwriteMode)(mode | DkSaveInfo::mode_do_not_save_output);
+    if (mCbOverwriteExisting->isChecked())
+        mode = (DkSaveInfo::OverwriteMode)(mode | DkSaveInfo::mode_overwrite);
+    if (mCbDoNotSave->isChecked())
+        mode = (DkSaveInfo::OverwriteMode)(mode | DkSaveInfo::mode_do_not_save_output);
 
-	return mode;
+    return mode;
 }
 
-bool DkBatchOutput::useInputDir() const {
-	return mCbUseInput->isChecked();
+bool DkBatchOutput::useInputDir() const
+{
+    return mCbUseInput->isChecked();
 }
 
-bool DkBatchOutput::deleteOriginal() const {
-
-	return mCbDeleteOriginal->isChecked();
+bool DkBatchOutput::deleteOriginal() const
+{
+    return mCbDeleteOriginal->isChecked();
 }
 
-void DkBatchOutput::setExampleFilename(const QString& exampleName) {
-
-	mExampleName = exampleName;
-	updateFileLabelPreview();
+void DkBatchOutput::setExampleFilename(const QString &exampleName)
+{
+    mExampleName = exampleName;
+    updateFileLabelPreview();
 }
 
 // DkProfileSummaryWidget --------------------------------------------------------------------
-DkProfileSummaryWidget::DkProfileSummaryWidget(QWidget* parent) : DkFadeWidget(parent) {
-	createLayout();
-	setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
-	QMetaObject::connectSlotsByName(this);
-}
-
-void DkProfileSummaryWidget::setProfile(const QString& profileName, const DkBatchConfig & config) {
-
-	mTitle->setText(tr("Summary: ") + profileName);
-	mNumFiles->setText(QString::number(config.getFileList().size()) + " "  + tr("Files"));
-	mOutputDir->setText(config.getOutputDirPath());
-	
-	QString functions;
-	for (QSharedPointer<DkAbstractBatch> cf : config.getProcessFunctions()) {
-
-		functions += cf->name() + "\n";
-	}
-	mFunctions->setText(functions);
-
-}
-
-void DkProfileSummaryWidget::on_deleteButton_clicked() {
-	emit deleteCurrentProfile();
-}
-
-void DkProfileSummaryWidget::on_updateButton_clicked() {
-	emit updateCurrentProfile();
-}
-
-void DkProfileSummaryWidget::on_exportButton_clicked() {
-	emit exportCurrentProfile();
-}
-
-void DkProfileSummaryWidget::createLayout() {
-
-	mTitle = new QLabel("", this);
-	mTitle->setObjectName("subTitle");
-
-	QLabel* numFilesTitle = new QLabel(tr("Input"), this);
-	numFilesTitle->setObjectName("summaryMeta");
-	mNumFiles = new QLabel(this);
-
-	QLabel* outputDirTitle = new QLabel(tr("Output"), this);
-	outputDirTitle->setObjectName("summaryMeta");
-	mOutputDir = new QLabel(this);
-
-	QLabel* functionsTitle = new QLabel(tr("Functions"), this);
-	functionsTitle->setObjectName("summaryMeta");
-	mFunctions = new QLabel(this);
-
-	QWidget* sw = new QWidget(this);
-	QGridLayout* summaryLayout = new QGridLayout(sw);
-	summaryLayout->setContentsMargins(0, 0, 0, 0);
-	summaryLayout->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
-	summaryLayout->addWidget(mTitle, 1, 1, 1, 3);
-	summaryLayout->addWidget(numFilesTitle, 2, 1);
-	summaryLayout->addWidget(mNumFiles, 2, 2);
-	summaryLayout->addWidget(outputDirTitle, 3, 1);
-	summaryLayout->addWidget(mOutputDir, 3, 2);
-	summaryLayout->addWidget(functionsTitle, 4, 1);
-	summaryLayout->addWidget(mFunctions, 4, 2);
-
-	QPushButton* updateButton = new QPushButton(DkImage::loadIcon(":/nomacs/img/save.svg"), "", this);
-	updateButton->setObjectName("updateButton");
-	//updateButton->setFlat(true);
-	updateButton->setToolTip(tr("Update"));
-
-	QPushButton* deleteButton = new QPushButton(DkImage::loadIcon(":/nomacs/img/trash.svg"), "", this);
-	deleteButton->setObjectName("deleteButton");
-	//deleteButton->setFlat(true);
-	deleteButton->setToolTip(tr("Delete"));
-
-	QPushButton* exportButton = new QPushButton(DkImage::loadIcon(":/nomacs/img/export.svg"), "", this);
-	exportButton->setObjectName("exportButton");
-	//exportButton->setFlat(true);
-	exportButton->setToolTip(tr("Export"));
-
-	QWidget* bw = new QWidget(this);
-	QHBoxLayout* bLayout = new QHBoxLayout(bw);
-	bLayout->setContentsMargins(0, 0, 0, 0);
-	bLayout->setAlignment(Qt::AlignRight);
-	bLayout->addWidget(updateButton);
-	bLayout->addWidget(exportButton);
-	bLayout->addWidget(deleteButton);
-
-	QVBoxLayout* layout = new QVBoxLayout(this);
-	layout->addWidget(sw);
-	layout->addWidget(bw);
+DkProfileSummaryWidget::DkProfileSummaryWidget(QWidget *parent)
+    : DkFadeWidget(parent)
+{
+    createLayout();
+    setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
+    QMetaObject::connectSlotsByName(this);
+}
+
+void DkProfileSummaryWidget::setProfile(const QString &profileName, const DkBatchConfig &config)
+{
+    mTitle->setText(tr("Summary: ") + profileName);
+    mNumFiles->setText(QString::number(config.getFileList().size()) + " " + tr("Files"));
+    mOutputDir->setText(config.getOutputDirPath());
+
+    QString functions;
+    for (QSharedPointer<DkAbstractBatch> cf : config.getProcessFunctions()) {
+        functions += cf->name() + "\n";
+    }
+    mFunctions->setText(functions);
+}
+
+void DkProfileSummaryWidget::on_deleteButton_clicked()
+{
+    emit deleteCurrentProfile();
+}
+
+void DkProfileSummaryWidget::on_updateButton_clicked()
+{
+    emit updateCurrentProfile();
+}
+
+void DkProfileSummaryWidget::on_exportButton_clicked()
+{
+    emit exportCurrentProfile();
+}
+
+void DkProfileSummaryWidget::createLayout()
+{
+    mTitle = new QLabel("", this);
+    mTitle->setObjectName("subTitle");
+
+    QLabel *numFilesTitle = new QLabel(tr("Input"), this);
+    numFilesTitle->setObjectName("summaryMeta");
+    mNumFiles = new QLabel(this);
+
+    QLabel *outputDirTitle = new QLabel(tr("Output"), this);
+    outputDirTitle->setObjectName("summaryMeta");
+    mOutputDir = new QLabel(this);
+
+    QLabel *functionsTitle = new QLabel(tr("Functions"), this);
+    functionsTitle->setObjectName("summaryMeta");
+    mFunctions = new QLabel(this);
+
+    QWidget *sw = new QWidget(this);
+    QGridLayout *summaryLayout = new QGridLayout(sw);
+    summaryLayout->setContentsMargins(0, 0, 0, 0);
+    summaryLayout->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
+    summaryLayout->addWidget(mTitle, 1, 1, 1, 3);
+    summaryLayout->addWidget(numFilesTitle, 2, 1);
+    summaryLayout->addWidget(mNumFiles, 2, 2);
+    summaryLayout->addWidget(outputDirTitle, 3, 1);
+    summaryLayout->addWidget(mOutputDir, 3, 2);
+    summaryLayout->addWidget(functionsTitle, 4, 1);
+    summaryLayout->addWidget(mFunctions, 4, 2);
+
+    QPushButton *updateButton = new QPushButton(DkImage::loadIcon(":/nomacs/img/save.svg"), "", this);
+    updateButton->setObjectName("updateButton");
+    // updateButton->setFlat(true);
+    updateButton->setToolTip(tr("Update"));
+
+    QPushButton *deleteButton = new QPushButton(DkImage::loadIcon(":/nomacs/img/trash.svg"), "", this);
+    deleteButton->setObjectName("deleteButton");
+    // deleteButton->setFlat(true);
+    deleteButton->setToolTip(tr("Delete"));
+
+    QPushButton *exportButton = new QPushButton(DkImage::loadIcon(":/nomacs/img/export.svg"), "", this);
+    exportButton->setObjectName("exportButton");
+    // exportButton->setFlat(true);
+    exportButton->setToolTip(tr("Export"));
+
+    QWidget *bw = new QWidget(this);
+    QHBoxLayout *bLayout = new QHBoxLayout(bw);
+    bLayout->setContentsMargins(0, 0, 0, 0);
+    bLayout->setAlignment(Qt::AlignRight);
+    bLayout->addWidget(updateButton);
+    bLayout->addWidget(exportButton);
+    bLayout->addWidget(deleteButton);
+
+    QVBoxLayout *layout = new QVBoxLayout(this);
+    layout->addWidget(sw);
+    layout->addWidget(bw);
 }
 
-
 // DkProfileWidget --------------------------------------------------------------------
-DkProfileWidget::DkProfileWidget(QWidget* parent, Qt::WindowFlags f) : DkWidget(parent, f) {
-
-	createLayout();
-	QMetaObject::connectSlotsByName(this);
+DkProfileWidget::DkProfileWidget(QWidget *parent, Qt::WindowFlags f)
+    : DkWidget(parent, f)
+{
+    createLayout();
+    QMetaObject::connectSlotsByName(this);
 }
 
-void DkProfileWidget::createLayout() {
-
-	mProfileList = new QListWidget(this);
-	mProfileList->setObjectName("profileList");
+void DkProfileWidget::createLayout()
+{
+    mProfileList = new QListWidget(this);
+    mProfileList->setObjectName("profileList");
 
-	mSummary = new DkProfileSummaryWidget(this);
+    mSummary = new DkProfileSummaryWidget(this);
 
-	// buttons
-	QPushButton* saveButton = new QPushButton(tr("Create New Profile"), this);
-	saveButton->setObjectName("saveButton");
+    // buttons
+    QPushButton *saveButton = new QPushButton(tr("Create New Profile"), this);
+    saveButton->setObjectName("saveButton");
 
-	QPushButton* resetButton = new QPushButton(tr("Apply Default"), this);
-	resetButton->setObjectName("resetButton");
+    QPushButton *resetButton = new QPushButton(tr("Apply Default"), this);
+    resetButton->setObjectName("resetButton");
 
-	QWidget* buttonWidget = new QWidget(this);
-	QHBoxLayout* bLayout = new QHBoxLayout(buttonWidget);
-	bLayout->setContentsMargins(0, 0, 0, 0);
-	bLayout->setAlignment(Qt::AlignLeft);
-	bLayout->addWidget(saveButton);
-	bLayout->addWidget(resetButton);
+    QWidget *buttonWidget = new QWidget(this);
+    QHBoxLayout *bLayout = new QHBoxLayout(buttonWidget);
+    bLayout->setContentsMargins(0, 0, 0, 0);
+    bLayout->setAlignment(Qt::AlignLeft);
+    bLayout->addWidget(saveButton);
+    bLayout->addWidget(resetButton);
 
-	QWidget* descWidget = new QWidget(this);
-	QVBoxLayout* descLayout = new QVBoxLayout(descWidget);
-	descLayout->setContentsMargins(0, 0, 0, 0);
-	descLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
-	descLayout->addWidget(mSummary);
-	descLayout->addWidget(buttonWidget);
+    QWidget *descWidget = new QWidget(this);
+    QVBoxLayout *descLayout = new QVBoxLayout(descWidget);
+    descLayout->setContentsMargins(0, 0, 0, 0);
+    descLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
+    descLayout->addWidget(mSummary);
+    descLayout->addWidget(buttonWidget);
 
-	QHBoxLayout* layout = new QHBoxLayout(this);
-	layout->setContentsMargins(0, 0, 0, 0);
-	layout->addWidget(mProfileList);
-	layout->addWidget(descWidget);
+    QHBoxLayout *layout = new QHBoxLayout(this);
+    layout->setContentsMargins(0, 0, 0, 0);
+    layout->addWidget(mProfileList);
+    layout->addWidget(descWidget);
 
-	updateProfileList();
+    updateProfileList();
 
-	connect(mSummary, SIGNAL(updateCurrentProfile()), this, SLOT(updateCurrentProfile()));
-	connect(mSummary, SIGNAL(deleteCurrentProfile()), this, SLOT(deleteCurrentProfile()));
-	connect(mSummary, SIGNAL(exportCurrentProfile()), this, SLOT(exportCurrentProfile()));
+    connect(mSummary, SIGNAL(updateCurrentProfile()), this, SLOT(updateCurrentProfile()));
+    connect(mSummary, SIGNAL(deleteCurrentProfile()), this, SLOT(deleteCurrentProfile()));
+    connect(mSummary, SIGNAL(exportCurrentProfile()), this, SLOT(exportCurrentProfile()));
 }
 
-bool DkProfileWidget::hasUserInput() const {
-	return false;
+bool DkProfileWidget::hasUserInput() const
+{
+    return false;
 }
 
-bool DkProfileWidget::requiresUserInput() const {
-	return false;
+bool DkProfileWidget::requiresUserInput() const
+{
+    return false;
 }
 
-void DkProfileWidget::applyDefault() {
-	emit newHeaderText(tr("inactive"));
+void DkProfileWidget::applyDefault()
+{
+    emit newHeaderText(tr("inactive"));
 }
 
-void DkProfileWidget::profileSaved(const QString& profileName) {
+void DkProfileWidget::profileSaved(const QString &profileName)
+{
+    updateProfileList();
 
-	updateProfileList();
+    QList<QListWidgetItem *> items = mProfileList->findItems(profileName, Qt::MatchExactly);
 
-	QList<QListWidgetItem*> items = mProfileList->findItems(profileName, Qt::MatchExactly);
-	
-	for (auto i : items)
-		i->setSelected(true);
+    for (auto i : items)
+        i->setSelected(true);
 }
 
-void DkProfileWidget::on_profileList_itemSelectionChanged() {
-
-	changeProfile(currentProfile());
+void DkProfileWidget::on_profileList_itemSelectionChanged()
+{
+    changeProfile(currentProfile());
 }
 
-void DkProfileWidget::updateProfileList() {
-
-	mProfileList->clear();
+void DkProfileWidget::updateProfileList()
+{
+    mProfileList->clear();
 
-	DkBatchProfile bp;
-	QStringList pn = bp.profileNames();
+    DkBatchProfile bp;
+    QStringList pn = bp.profileNames();
 
-	mProfileList->addItem(tr("Default"));
+    mProfileList->addItem(tr("Default"));
 
-	for (const QString& p : pn) {
-		mProfileList->addItem(p);
-	}
+    for (const QString &p : pn) {
+        mProfileList->addItem(p);
+    }
 }
 
-void DkProfileWidget::changeProfile(const QString & profileName) {
-	
-	// is the default profile selected?
-	if (profileName.isEmpty() || (mProfileList->count() > 0 && mProfileList->item(0)->text() == profileName)) {
-		loadDefaultProfile();
-		return;
-	}
+void DkProfileWidget::changeProfile(const QString &profileName)
+{
+    // is the default profile selected?
+    if (profileName.isEmpty() || (mProfileList->count() > 0 && mProfileList->item(0)->text() == profileName)) {
+        loadDefaultProfile();
+        return;
+    }
 
-	QString profilePath = DkBatchProfile::profileNameToPath(profileName);
-	DkBatchConfig bc = DkBatchProfile::loadProfile(profilePath);
-	mSummary->setProfile(profileName, bc);
-	mSummary->show();
+    QString profilePath = DkBatchProfile::profileNameToPath(profileName);
+    DkBatchConfig bc = DkBatchProfile::loadProfile(profilePath);
+    mSummary->setProfile(profileName, bc);
+    mSummary->show();
 
-	emit loadProfileSignal(profilePath);
-	emit newHeaderText(profileName);
+    emit loadProfileSignal(profilePath);
+    emit newHeaderText(profileName);
 }
 
-void DkProfileWidget::loadDefaultProfile() {
+void DkProfileWidget::loadDefaultProfile()
+{
+    // select default profile
+    if (mProfileList->count() > 0)
+        mProfileList->item(0)->setSelected(true);
 
-	// select default profile
-	if (mProfileList->count() > 0)
-		mProfileList->item(0)->setSelected(true);
-
-	mSummary->hide();
-	emit newHeaderText(tr("inactive"));
-	emit applyDefaultSignal();
+    mSummary->hide();
+    emit newHeaderText(tr("inactive"));
+    emit applyDefaultSignal();
 }
 
-QString DkProfileWidget::currentProfile() const {
-	
-	QString profileName;
+QString DkProfileWidget::currentProfile() const
+{
+    QString profileName;
 
-	for (auto pItem : mProfileList->selectedItems()) {
-		profileName = pItem->text();
-	}
+    for (auto pItem : mProfileList->selectedItems()) {
+        profileName = pItem->text();
+    }
 
-	return profileName;
+    return profileName;
 }
 
-void DkProfileWidget::on_saveButton_clicked() {
-
-	saveProfile();
+void DkProfileWidget::on_saveButton_clicked()
+{
+    saveProfile();
 }
 
-void DkProfileWidget::on_resetButton_clicked() {
-
-	loadDefaultProfile();
+void DkProfileWidget::on_resetButton_clicked()
+{
+    loadDefaultProfile();
 }
 
-void DkProfileWidget::updateCurrentProfile() {
-	emit saveProfileSignal(DkBatchProfile::profileNameToPath(currentProfile()));
+void DkProfileWidget::updateCurrentProfile()
+{
+    emit saveProfileSignal(DkBatchProfile::profileNameToPath(currentProfile()));
 }
 
-void DkProfileWidget::deleteCurrentProfile() {
+void DkProfileWidget::deleteCurrentProfile()
+{
+    QFile profile(DkBatchProfile::profileNameToPath(currentProfile()));
 
-	QFile profile(DkBatchProfile::profileNameToPath(currentProfile()));
-	
-	if (!profile.remove()) {
-		QMessageBox::critical(
-			this, 
-			tr("Deleting Profile"), 
-			tr("Sorry, I cannot delete %1").arg(currentProfile()), 
-			QMessageBox::Ok);
-		return;
-	}
+    if (!profile.remove()) {
+        QMessageBox::critical(this, tr("Deleting Profile"), tr("Sorry, I cannot delete %1").arg(currentProfile()), QMessageBox::Ok);
+        return;
+    }
 
-	updateProfileList();
-	loadDefaultProfile();
+    updateProfileList();
+    loadDefaultProfile();
 }
 
-void DkProfileWidget::exportCurrentProfile() {
+void DkProfileWidget::exportCurrentProfile()
+{
+    QString expPath = QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + QDir::separator() + currentProfile() + "." + DkBatchProfile::extension();
 
-	QString expPath =
-		QStandardPaths::writableLocation(QStandardPaths::HomeLocation) +
-		QDir::separator() + currentProfile() +
-		"." + DkBatchProfile::extension();
+    QString sPath = QFileDialog::getSaveFileName(this,
+                                                 tr("Export Batch Profile"),
+                                                 expPath,
+                                                 tr("nomacs Batch Profile (*.%1)").arg(DkBatchProfile::extension()),
+                                                 nullptr,
+                                                 DkDialog::fileDialogOptions());
 
-	QString sPath = QFileDialog::getSaveFileName(
-		this, 
-		tr("Export Batch Profile"), 
-		expPath,
-		tr("nomacs Batch Profile (*.%1)").arg(DkBatchProfile::extension()),
-		nullptr,
-		DkDialog::fileDialogOptions()
-		);
-
-	emit saveProfileSignal(sPath);
+    emit saveProfileSignal(sPath);
 }
 
-void DkProfileWidget::saveProfile() {
-
-	// default mode is overwrite (UI is asking anyway)
-	QString cn = currentProfile();
-	QString dName = cn.isEmpty() || cn == mProfileList->item(0)->text() ? "Profile 1" : cn;
+void DkProfileWidget::saveProfile()
+{
+    // default mode is overwrite (UI is asking anyway)
+    QString cn = currentProfile();
+    QString dName = cn.isEmpty() || cn == mProfileList->item(0)->text() ? "Profile 1" : cn;
 
-	bool ok;
-	QString text = QInputDialog::getText(this, tr("Profile Name"),
-		tr("Profile Name:"), QLineEdit::Normal,
-		dName, &ok);
+    bool ok;
+    QString text = QInputDialog::getText(this, tr("Profile Name"), tr("Profile Name:"), QLineEdit::Normal, dName, &ok);
 
-	if (!ok || text.isEmpty())
-		return;	// user canceled
+    if (!ok || text.isEmpty())
+        return; // user canceled
 
-	// is the profile name unique?
-	if (!mProfileList->findItems(text, Qt::MatchExactly).isEmpty()) {
+    // is the profile name unique?
+    if (!mProfileList->findItems(text, Qt::MatchExactly).isEmpty()) {
+        QMessageBox::StandardButton button =
+            QMessageBox::information(this, tr("Profile Already Exists"), tr("Do you want to overwrite %1?").arg(text), QMessageBox::Yes | QMessageBox::No);
 
-		QMessageBox::StandardButton button = QMessageBox::information(
-			this, 
-			tr("Profile Already Exists"), 
-			tr("Do you want to overwrite %1?").arg(text), 
-			QMessageBox::Yes | QMessageBox::No);
+        if (button == QMessageBox::No) {
+            saveProfile(); // start over
+            return;
+        }
+    }
 
-		if (button == QMessageBox::No) {
-			saveProfile(); // start over
-			return;
-		}
-	}
-	
-	emit saveProfileSignal(DkBatchProfile::profileNameToPath(text));
+    emit saveProfileSignal(DkBatchProfile::profileNameToPath(text));
 }
 
 #ifdef WITH_PLUGINS
 // DkBatchPlugin --------------------------------------------------------------------
-DkBatchPluginWidget::DkBatchPluginWidget(QWidget* parent /* = 0 */, Qt::WindowFlags f /* = 0 */) : DkWidget(parent, f) {
-
-	//mSettings = DkSettingsManager::instance().qSettings();
-	DkPluginManager::instance().loadPlugins();
-	createLayout();
-
-	connect(mSettingsEditor, SIGNAL(changeSettingSignal(const QString&, const QVariant&, const QStringList&)), 
-		this, SLOT(changeSetting(const QString&, const QVariant&, const QStringList&)));
-	connect(mSettingsEditor, SIGNAL(removeSettingSignal(const QString&, const QStringList&)), 
-		this, SLOT(removeSetting(const QString&, const QStringList&)));
+DkBatchPluginWidget::DkBatchPluginWidget(QWidget *parent /* = 0 */, Qt::WindowFlags f /* = 0 */)
+    : DkWidget(parent, f)
+{
+    // mSettings = DkSettingsManager::instance().qSettings();
+    DkPluginManager::instance().loadPlugins();
+    createLayout();
 
+    connect(mSettingsEditor,
+            SIGNAL(changeSettingSignal(const QString &, const QVariant &, const QStringList &)),
+            this,
+            SLOT(changeSetting(const QString &, const QVariant &, const QStringList &)));
+    connect(mSettingsEditor,
+            SIGNAL(removeSettingSignal(const QString &, const QStringList &)),
+            this,
+            SLOT(removeSetting(const QString &, const QStringList &)));
 }
 
-void DkBatchPluginWidget::transferProperties(QSharedPointer<DkPluginBatch> batchPlugin) const {
-
-	QVector<QSharedPointer<DkPluginContainer> > plugins = DkPluginManager::instance().getBatchPlugins();
+void DkBatchPluginWidget::transferProperties(QSharedPointer<DkPluginBatch> batchPlugin) const
+{
+    QVector<QSharedPointer<DkPluginContainer>> plugins = DkPluginManager::instance().getBatchPlugins();
 
-	//// I don't like const casts
-	//// BUT: load settings effectively only opens groups (which is not const)
-	//QSettings& settings = const_cast<QSettings&>(mSettings);
+    //// I don't like const casts
+    //// BUT: load settings effectively only opens groups (which is not const)
+    // QSettings& settings = const_cast<QSettings&>(mSettings);
 
-	//for (auto p : plugins) {
-	//
-	//	if (p->batchPlugin()) {
-	//		// the const ca
-	//		p->batchPlugin()->loadSettings(settings);
-	//	}
-	//}
+    // for (auto p : plugins) {
+    //
+    //	if (p->batchPlugin()) {
+    //		// the const ca
+    //		p->batchPlugin()->loadSettings(settings);
+    //	}
+    // }
 
-	QStringList pluginList = selectedPlugins();
-	batchPlugin->setProperties(pluginList);
+    QStringList pluginList = selectedPlugins();
+    batchPlugin->setProperties(pluginList);
 }
 
-void DkBatchPluginWidget::createLayout() {
+void DkBatchPluginWidget::createLayout()
+{
+    QLabel *listLabel = new QLabel(tr("Select Plugins"));
+    listLabel->setObjectName("subTitle");
 
-	QLabel* listLabel = new QLabel(tr("Select Plugins"));
-	listLabel->setObjectName("subTitle");
+    mModel = new QStandardItemModel(this);
 
-	mModel = new QStandardItemModel(this);
+    QTreeView *pluginList = new QTreeView(this);
+    pluginList->setModel(mModel);
+    pluginList->header()->hide();
 
-	QTreeView* pluginList = new QTreeView(this);
-	pluginList->setModel(mModel);
-	pluginList->header()->hide();
+    // settings
+    mSettingsTitle = new QLabel(this);
+    mSettingsTitle->setObjectName("subTitle");
 
-	// settings
-	mSettingsTitle = new QLabel(this);
-	mSettingsTitle->setObjectName("subTitle");
+    mSettingsEditor = new DkSettingsWidget(this);
+    mSettingsEditor->hide();
 
-	mSettingsEditor = new DkSettingsWidget(this);
-	mSettingsEditor->hide();
+    addPlugins(mModel);
 
-	addPlugins(mModel);
+    QGridLayout *layout = new QGridLayout(this);
+    layout->setContentsMargins(0, 0, 0, 0);
+    layout->addWidget(listLabel, 0, 0);
+    layout->addWidget(mSettingsTitle, 0, 1);
+    layout->addWidget(pluginList, 1, 0);
+    layout->addWidget(mSettingsEditor, 1, 1);
 
-	QGridLayout* layout = new QGridLayout(this);
-	layout->setContentsMargins(0, 0, 0, 0);
-	layout->addWidget(listLabel, 0, 0);
-	layout->addWidget(mSettingsTitle, 0, 1);
-	layout->addWidget(pluginList, 1, 0);
-	layout->addWidget(mSettingsEditor, 1, 1);
-
-	connect(mModel, SIGNAL(itemChanged(QStandardItem*)), this, SLOT(itemChanged(QStandardItem*)));
-	connect(pluginList->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)), this, SLOT(selectionChanged(const QItemSelection&)));
+    connect(mModel, SIGNAL(itemChanged(QStandardItem *)), this, SLOT(itemChanged(QStandardItem *)));
+    connect(pluginList->selectionModel(),
+            SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
+            this,
+            SLOT(selectionChanged(const QItemSelection &)));
 }
 
-bool DkBatchPluginWidget::loadProperties(QSharedPointer<DkPluginBatch> batchPlugin) {
-
-	if (!batchPlugin) {
-		qWarning() << "cannot load properties, DkPluginBatch is NULL";
-		return false;
-	}
+bool DkBatchPluginWidget::loadProperties(QSharedPointer<DkPluginBatch> batchPlugin)
+{
+    if (!batchPlugin) {
+        qWarning() << "cannot load properties, DkPluginBatch is NULL";
+        return false;
+    }
 
-	mModel->blockSignals(true);
-	QStringList sPlugins = batchPlugin->pluginList();
+    mModel->blockSignals(true);
+    QStringList sPlugins = batchPlugin->pluginList();
 
-	for (int pIdx = 0; pIdx < mModel->rowCount(); pIdx++) {
+    for (int pIdx = 0; pIdx < mModel->rowCount(); pIdx++) {
+        QStandardItem *pItem = mModel->item(pIdx);
 
-		QStandardItem* pItem = mModel->item(pIdx);
-	
-		for (int idx = 0; idx < pItem->rowCount(); idx++) {
-		
-			// see if the plugin is contained in the plugin list
-			QStandardItem* item = pItem->child(idx);
-			QString key = item->data(Qt::UserRole).toString() + " | " + item->text();
-			item->setCheckState(sPlugins.contains(key) ? Qt::Checked : Qt::Unchecked);
-		}
-	}
-	mModel->blockSignals(false);
-	updateHeader();
+        for (int idx = 0; idx < pItem->rowCount(); idx++) {
+            // see if the plugin is contained in the plugin list
+            QStandardItem *item = pItem->child(idx);
+            QString key = item->data(Qt::UserRole).toString() + " | " + item->text();
+            item->setCheckState(sPlugins.contains(key) ? Qt::Checked : Qt::Unchecked);
+        }
+    }
+    mModel->blockSignals(false);
+    updateHeader();
 
-	return true;
+    return true;
 }
 
-void DkBatchPluginWidget::itemChanged(QStandardItem* item) {
+void DkBatchPluginWidget::itemChanged(QStandardItem *item)
+{
+    if (!item)
+        return;
 
-	if (!item)
-		return;
+    if (item->checkState() == Qt::Checked)
+        selectPlugin(item->data(Qt::UserRole).toString());
 
-	if (item->checkState() == Qt::Checked)
-		selectPlugin(item->data(Qt::UserRole).toString());
-
-	updateHeader();
+    updateHeader();
 }
 
-bool DkBatchPluginWidget::hasUserInput() const {
-	return !selectedPlugins().isEmpty();
+bool DkBatchPluginWidget::hasUserInput() const
+{
+    return !selectedPlugins().isEmpty();
 }
 
-bool DkBatchPluginWidget::requiresUserInput() const {
-	return false;
+bool DkBatchPluginWidget::requiresUserInput() const
+{
+    return false;
 }
 
-void DkBatchPluginWidget::applyDefault() {
-
-	mSettings.clear();
-
-	QStringList selectedPlugins;
+void DkBatchPluginWidget::applyDefault()
+{
+    mSettings.clear();
 
-	for (int pIdx = 0; pIdx < mModel->rowCount(); pIdx++) {
+    QStringList selectedPlugins;
 
-		QStandardItem* pItem = mModel->item(pIdx);
+    for (int pIdx = 0; pIdx < mModel->rowCount(); pIdx++) {
+        QStandardItem *pItem = mModel->item(pIdx);
 
-		for (int idx = 0; idx < pItem->rowCount(); idx++) {
-			pItem->child(idx)->setCheckState(Qt::Unchecked);
-		}
-	}
-
-	selectPlugin("");
-	updateHeader();
-}
+        for (int idx = 0; idx < pItem->rowCount(); idx++) {
+            pItem->child(idx)->setCheckState(Qt::Unchecked);
+        }
+    }
 
-void DkBatchPluginWidget::setSettingsPath(const QString & settingsPath) {
-	mSettings = QSharedPointer<QSettings>(new QSettings(settingsPath, QSettings::IniFormat));
-	
-	// choose the correct sub-group
-	mSettings->beginGroup("General");
-	mSettings->beginGroup("PluginBatch");
+    selectPlugin("");
+    updateHeader();
 }
 
-void DkBatchPluginWidget::selectionChanged(const QItemSelection & selected) {
+void DkBatchPluginWidget::setSettingsPath(const QString &settingsPath)
+{
+    mSettings = QSharedPointer<QSettings>(new QSettings(settingsPath, QSettings::IniFormat));
 
-	for (auto mIdx : selected.indexes()) {
-
-		QStandardItem* item;
+    // choose the correct sub-group
+    mSettings->beginGroup("General");
+    mSettings->beginGroup("PluginBatch");
+}
 
-		if (mIdx.parent().isValid()) {
-			item = mModel->item(mIdx.parent().row());
-			item = item->child(mIdx.row());
-		}
-		else
-			item = mModel->item(mIdx.row());
+void DkBatchPluginWidget::selectionChanged(const QItemSelection &selected)
+{
+    for (auto mIdx : selected.indexes()) {
+        QStandardItem *item;
 
-		if (!item)
-			continue;
+        if (mIdx.parent().isValid()) {
+            item = mModel->item(mIdx.parent().row());
+            item = item->child(mIdx.row());
+        } else
+            item = mModel->item(mIdx.row());
 
-		selectPlugin(item->data(Qt::UserRole).toString());
-	}
+        if (!item)
+            continue;
 
+        selectPlugin(item->data(Qt::UserRole).toString());
+    }
 }
 
-void DkBatchPluginWidget::addPlugins(QStandardItemModel* model) const {
-
-	if (!model)
-		return;
+void DkBatchPluginWidget::addPlugins(QStandardItemModel *model) const
+{
+    if (!model)
+        return;
 
-	QVector<QSharedPointer<DkPluginContainer> > plugins = DkPluginManager::instance().getBatchPlugins();
+    QVector<QSharedPointer<DkPluginContainer>> plugins = DkPluginManager::instance().getBatchPlugins();
 
-	for (auto p : plugins) {
+    for (auto p : plugins) {
+        QStandardItem *mPluginItem = new QStandardItem(p->pluginName());
+        mPluginItem->setEditable(false);
+        mPluginItem->setCheckable(false);
+        // mPluginItem->setAutoTristate(true);
+        mPluginItem->setData(p->pluginName(), Qt::UserRole);
+        mModel->appendRow(mPluginItem);
 
-		QStandardItem* mPluginItem = new QStandardItem(p->pluginName());
-		mPluginItem->setEditable(false);
-		mPluginItem->setCheckable(false);
-		//mPluginItem->setAutoTristate(true);
-		mPluginItem->setData(p->pluginName(), Qt::UserRole);
-		mModel->appendRow(mPluginItem);
+        QList<QAction *> actions = p->plugin()->pluginActions();
 
-		QList<QAction*> actions = p->plugin()->pluginActions();
-
-		for (const QAction* a : actions) {
-			QStandardItem* item = new QStandardItem(a->icon(), a->text());
-			item->setEditable(false);
-			item->setCheckable(true);
-			item->setData(p->pluginName(), Qt::UserRole);
-			mPluginItem->appendRow(item);
-		}
-	}
+        for (const QAction *a : actions) {
+            QStandardItem *item = new QStandardItem(a->icon(), a->text());
+            item->setEditable(false);
+            item->setCheckable(true);
+            item->setData(p->pluginName(), Qt::UserRole);
+            mPluginItem->appendRow(item);
+        }
+    }
 }
 
-void DkBatchPluginWidget::selectPlugin(const QString & pluginName) {
-
-	mCurrentPlugin = 0;	// unset
-	QSharedPointer<DkPluginContainer> plugin = DkPluginManager::instance().getPluginByName(pluginName);
+void DkBatchPluginWidget::selectPlugin(const QString &pluginName)
+{
+    mCurrentPlugin = 0; // unset
+    QSharedPointer<DkPluginContainer> plugin = DkPluginManager::instance().getPluginByName(pluginName);
 
-	if (!plugin || !plugin->batchPlugin()) {
-		mSettingsTitle->setText("");
-		mSettingsTitle->hide();
-		mSettingsEditor->hide();
-		return;
-	}
+    if (!plugin || !plugin->batchPlugin()) {
+        mSettingsTitle->setText("");
+        mSettingsTitle->hide();
+        mSettingsEditor->hide();
+        return;
+    }
 
-	mCurrentPlugin = plugin->batchPlugin();
+    mCurrentPlugin = plugin->batchPlugin();
 
-	QSharedPointer<QSettings> s = settings();
-	DkSettingsGroup g = DkSettingsGroup::fromSettings(*s, mCurrentPlugin->name());
+    QSharedPointer<QSettings> s = settings();
+    DkSettingsGroup g = DkSettingsGroup::fromSettings(*s, mCurrentPlugin->name());
 
-	if (!g.isEmpty()) {
-		mSettingsTitle->setText(plugin->pluginName() + tr(" Settings"));
-		mSettingsTitle->show();
+    if (!g.isEmpty()) {
+        mSettingsTitle->setText(plugin->pluginName() + tr(" Settings"));
+        mSettingsTitle->show();
 
-		mSettingsEditor->clear();
-		mSettingsEditor->addSettingsGroup(g);
-		mSettingsEditor->expandAll();
-		mSettingsEditor->show();
-	}
-	else {
-		mSettingsTitle->setText("");
-		mSettingsTitle->hide();
-		mSettingsEditor->hide();
-	}
+        mSettingsEditor->clear();
+        mSettingsEditor->addSettingsGroup(g);
+        mSettingsEditor->expandAll();
+        mSettingsEditor->show();
+    } else {
+        mSettingsTitle->setText("");
+        mSettingsTitle->hide();
+        mSettingsEditor->hide();
+    }
 }
 
-void DkBatchPluginWidget::changeSetting(const QString& key, const QVariant& value, const QStringList& groups) const {
+void DkBatchPluginWidget::changeSetting(const QString &key, const QVariant &value, const QStringList &groups) const
+{
+    if (!mCurrentPlugin) {
+        qWarning() << "cannot change settings if no plugin is selected";
+        return;
+    }
 
-	if (!mCurrentPlugin) {
-		qWarning() << "cannot change settings if no plugin is selected";
-		return;
-	}
-
-	QSharedPointer<QSettings> s = settings();
-	DkSettingsWidget::changeSetting(*s, key, value, groups);
-	mCurrentPlugin->loadSettings(*s);	// update
+    QSharedPointer<QSettings> s = settings();
+    DkSettingsWidget::changeSetting(*s, key, value, groups);
+    mCurrentPlugin->loadSettings(*s); // update
 }
 
-void DkBatchPluginWidget::removeSetting(const QString& key, const QStringList& groups) const {
-
-	if (!mCurrentPlugin) {
-		qWarning() << "cannot delete settings if no plugin is selected";
-		return;
-	}
+void DkBatchPluginWidget::removeSetting(const QString &key, const QStringList &groups) const
+{
+    if (!mCurrentPlugin) {
+        qWarning() << "cannot delete settings if no plugin is selected";
+        return;
+    }
 
-	QSharedPointer<QSettings> s = settings();
-	DkSettingsWidget::removeSetting(*s, key, groups);
-	mCurrentPlugin->loadSettings(*s);	// update
+    QSharedPointer<QSettings> s = settings();
+    DkSettingsWidget::removeSetting(*s, key, groups);
+    mCurrentPlugin->loadSettings(*s); // update
 }
 
+QStringList DkBatchPluginWidget::selectedPlugins(bool selected) const
+{
+    QStringList selectedPlugins;
 
-QStringList DkBatchPluginWidget::selectedPlugins(bool selected) const {
-
-	QStringList selectedPlugins;
+    for (int pIdx = 0; pIdx < mModel->rowCount(); pIdx++) {
+        QStandardItem *pItem = mModel->item(pIdx);
 
-	for (int pIdx = 0; pIdx < mModel->rowCount(); pIdx++) {
+        for (int idx = 0; idx < pItem->rowCount(); idx++) {
+            QStandardItem *item = pItem->child(idx);
+            if (!selected || item->checkState() == Qt::Checked)
+                selectedPlugins << item->data(Qt::UserRole).toString() + " | " + item->text();
+        }
+    }
 
-		QStandardItem* pItem = mModel->item(pIdx);
-		
-		for (int idx = 0; idx < pItem->rowCount(); idx++) {
-			
-			QStandardItem* item = pItem->child(idx);
-			if (!selected || item->checkState() == Qt::Checked)
-				selectedPlugins << item->data(Qt::UserRole).toString() + " | " + item->text();
-		}
-	}
-
-	return selectedPlugins;
+    return selectedPlugins;
 }
 
-QSharedPointer<QSettings> DkBatchPluginWidget::settings() const {
-
-	if (mSettings)
-		return mSettings;
+QSharedPointer<QSettings> DkBatchPluginWidget::settings() const
+{
+    if (mSettings)
+        return mSettings;
 
-	if (mCurrentPlugin)
-		return QSharedPointer<QSettings>(new QSettings(mCurrentPlugin->settingsFilePath(), QSettings::IniFormat));
-
-	qWarning() << "DkBatchPluginWidget: I need to default the settings...";
-	return QSharedPointer<QSettings>(new DefaultSettings());
+    if (mCurrentPlugin)
+        return QSharedPointer<QSettings>(new QSettings(mCurrentPlugin->settingsFilePath(), QSettings::IniFormat));
+
+    qWarning() << "DkBatchPluginWidget: I need to default the settings...";
+    return QSharedPointer<QSettings>(new DefaultSettings());
 }
 
-void DkBatchPluginWidget::updateHeader() const {
-	
-	int c = selectedPlugins().size();
-	if (!c)
-		emit newHeaderText(tr("inactive"));
-	else
-		emit newHeaderText(tr("%1 plugins selected").arg(c));
+void DkBatchPluginWidget::updateHeader() const
+{
+    int c = selectedPlugins().size();
+    if (!c)
+        emit newHeaderText(tr("inactive"));
+    else
+        emit newHeaderText(tr("%1 plugins selected").arg(c));
 }
 #endif
 
 // DkBatchManipulatorWidget --------------------------------------------------------------------
-DkBatchManipulatorWidget::DkBatchManipulatorWidget(QWidget* parent /* = 0 */, Qt::WindowFlags f /* = 0 */) : DkWidget(parent, f) {
-
-	mManager.createManipulators(this);
-	createLayout();
-	addSettingsWidgets(mManager);
-}
-
-void DkBatchManipulatorWidget::createLayout() {
-
-	QLabel* listLabel = new QLabel(tr("Select Image Adjustments"));
-	listLabel->setObjectName("subTitle");
+DkBatchManipulatorWidget::DkBatchManipulatorWidget(QWidget *parent /* = 0 */, Qt::WindowFlags f /* = 0 */)
+    : DkWidget(parent, f)
+{
+    mManager.createManipulators(this);
+    createLayout();
+    addSettingsWidgets(mManager);
+}
+
+void DkBatchManipulatorWidget::createLayout()
+{
+    QLabel *listLabel = new QLabel(tr("Select Image Adjustments"));
+    listLabel->setObjectName("subTitle");
+
+    mModel = new QStandardItemModel(this);
 
-	mModel = new QStandardItemModel(this);
+    int idx = 0;
+    for (auto mpl : mManager.manipulators()) {
+        QStandardItem *item = new QStandardItem(mpl->action()->icon(), mpl->name());
+        item->setEditable(false);
+        item->setCheckable(true);
 
-	int idx = 0;
-	for (auto mpl : mManager.manipulators()) {
+        mModel->setItem(idx, item);
+        idx++;
+    }
 
-		QStandardItem * item = new QStandardItem(mpl->action()->icon(), mpl->name());
-		item->setEditable(false);
-		item->setCheckable(true);
+    QListView *manipulatorList = new QListView(this);
+    manipulatorList->setModel(mModel);
 
-		mModel->setItem(idx, item); 
-		idx++;
-	}
+    // settings
+    mSettingsTitle = new QLabel(this);
+    mSettingsTitle->setObjectName("subTitle");
 
-	QListView* manipulatorList = new QListView(this);
-	manipulatorList->setModel(mModel);
+    QWidget *settingsWidget = new QWidget(this);
+    mSettingsLayout = new QVBoxLayout(settingsWidget);
+    mSettingsLayout->setContentsMargins(0, 0, 0, 0);
+    mSettingsLayout->setAlignment(Qt::AlignTop);
 
-	// settings
-	mSettingsTitle = new QLabel(this);
-	mSettingsTitle->setObjectName("subTitle");
+    mPreviewLabel = new QLabel(this);
+    mPreviewLabel->setAlignment(Qt::AlignHCenter);
+    mPreviewLabel->hide();
 
-	QWidget* settingsWidget = new QWidget(this);
-	mSettingsLayout = new QVBoxLayout(settingsWidget);
-	mSettingsLayout->setContentsMargins(0, 0, 0, 0);
-	mSettingsLayout->setAlignment(Qt::AlignTop);
+    QWidget *rightWidget = new QWidget(this);
+    QVBoxLayout *rLayout = new QVBoxLayout(rightWidget);
+    rLayout->setContentsMargins(0, 0, 0, 0);
+    rLayout->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
+    rLayout->addWidget(settingsWidget);
+    rLayout->addWidget(mPreviewLabel);
 
-	mPreviewLabel = new QLabel(this);
-	mPreviewLabel->setAlignment(Qt::AlignHCenter);
-	mPreviewLabel->hide();
+    QGridLayout *layout = new QGridLayout(this);
+    // layout->setAlignment(Qt::AlignHCenter);
+    layout->setContentsMargins(0, 0, 0, 0);
+    layout->addWidget(listLabel, 0, 0);
+    layout->addWidget(mSettingsTitle, 0, 1);
+    layout->addWidget(manipulatorList, 1, 0);
+    layout->addWidget(rightWidget, 1, 1);
 
-	QWidget* rightWidget = new QWidget(this);
-	QVBoxLayout* rLayout = new QVBoxLayout(rightWidget);
-	rLayout->setContentsMargins(0, 0, 0, 0);
-	rLayout->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
-	rLayout->addWidget(settingsWidget);
-	rLayout->addWidget(mPreviewLabel);
-
-	QGridLayout* layout = new QGridLayout(this);
-	//layout->setAlignment(Qt::AlignHCenter);
-	layout->setContentsMargins(0, 0, 0, 0);
-	layout->addWidget(listLabel,		0, 0);
-	layout->addWidget(mSettingsTitle,	0, 1);
-	layout->addWidget(manipulatorList,	1, 0);
-	layout->addWidget(rightWidget,		1, 1);
-	
-	connect(mModel, SIGNAL(itemChanged(QStandardItem*)), this, SLOT(itemChanged(QStandardItem*)));
-	connect(manipulatorList->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)), this, SLOT(selectionChanged(const QItemSelection&)));
+    connect(mModel, SIGNAL(itemChanged(QStandardItem *)), this, SLOT(itemChanged(QStandardItem *)));
+    connect(manipulatorList->selectionModel(),
+            SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
+            this,
+            SLOT(selectionChanged(const QItemSelection &)));
 }
 
-void DkBatchManipulatorWidget::addSettingsWidgets(DkManipulatorManager & manager) {
-
-	for (auto w : mMplWidgets) {
-		mSettingsLayout->removeWidget(w);
-		delete w;
-	}
+void DkBatchManipulatorWidget::addSettingsWidgets(DkManipulatorManager &manager)
+{
+    for (auto w : mMplWidgets) {
+        mSettingsLayout->removeWidget(w);
+        delete w;
+    }
 
-	mMplWidgets.clear();	// TODO: delete the old ones now?
+    mMplWidgets.clear(); // TODO: delete the old ones now?
 
-	mMplWidgets << new DkTinyPlanetWidget(manager.manipulatorExt(DkManipulatorManager::m_tiny_planet), this);
-	mMplWidgets << new DkBlurWidget(manager.manipulatorExt(DkManipulatorManager::m_blur), this);
-	mMplWidgets << new DkUnsharpMaskWidget(manager.manipulatorExt(DkManipulatorManager::m_unsharp_mask), this);
-	mMplWidgets << new DkRotateWidget(manager.manipulatorExt(DkManipulatorManager::m_rotate), this);
-	mMplWidgets << new DkThresholdWidget(manager.manipulatorExt(DkManipulatorManager::m_threshold), this);
-	mMplWidgets << new DkHueWidget(manager.manipulatorExt(DkManipulatorManager::m_hue), this);
-	mMplWidgets << new DkExposureWidget(manager.manipulatorExt(DkManipulatorManager::m_exposure), this);
-	mMplWidgets << new DkColorWidget(manager.manipulatorExt(DkManipulatorManager::m_color), this);
-	mMplWidgets << new DkResizeWidget(manager.manipulatorExt(DkManipulatorManager::m_resize), this);
+    mMplWidgets << new DkTinyPlanetWidget(manager.manipulatorExt(DkManipulatorManager::m_tiny_planet), this);
+    mMplWidgets << new DkBlurWidget(manager.manipulatorExt(DkManipulatorManager::m_blur), this);
+    mMplWidgets << new DkUnsharpMaskWidget(manager.manipulatorExt(DkManipulatorManager::m_unsharp_mask), this);
+    mMplWidgets << new DkRotateWidget(manager.manipulatorExt(DkManipulatorManager::m_rotate), this);
+    mMplWidgets << new DkThresholdWidget(manager.manipulatorExt(DkManipulatorManager::m_threshold), this);
+    mMplWidgets << new DkHueWidget(manager.manipulatorExt(DkManipulatorManager::m_hue), this);
+    mMplWidgets << new DkExposureWidget(manager.manipulatorExt(DkManipulatorManager::m_exposure), this);
+    mMplWidgets << new DkColorWidget(manager.manipulatorExt(DkManipulatorManager::m_color), this);
+    mMplWidgets << new DkResizeWidget(manager.manipulatorExt(DkManipulatorManager::m_resize), this);
 
-	for (QWidget* w : mMplWidgets)
-		mSettingsLayout->addWidget(w);
-
-	for (QAction* a : manager.actions())
-		connect(a, SIGNAL(triggered()), this, SLOT(selectManipulator()), Qt::UniqueConnection);
+    for (QWidget *w : mMplWidgets)
+        mSettingsLayout->addWidget(w);
 
+    for (QAction *a : manager.actions())
+        connect(a, SIGNAL(triggered()), this, SLOT(selectManipulator()), Qt::UniqueConnection);
 }
 
-bool DkBatchManipulatorWidget::loadProperties(QSharedPointer<DkManipulatorBatch> batchManipulators) {
-
-	if (!batchManipulators) {
-		qWarning() << "cannot load properties, DkManipulatorBatch is NULL";
-		return false;
-	}
+bool DkBatchManipulatorWidget::loadProperties(QSharedPointer<DkManipulatorBatch> batchManipulators)
+{
+    if (!batchManipulators) {
+        qWarning() << "cannot load properties, DkManipulatorBatch is NULL";
+        return false;
+    }
 
-	setManager(batchManipulators->manager());
-	addSettingsWidgets(mManager);
+    setManager(batchManipulators->manager());
+    addSettingsWidgets(mManager);
 
-	return true;
+    return true;
 }
 
-void DkBatchManipulatorWidget::setManager(const DkManipulatorManager& manager) {
+void DkBatchManipulatorWidget::setManager(const DkManipulatorManager &manager)
+{
+    mManager = manager;
+    addSettingsWidgets(mManager);
 
-	mManager = manager;
-	addSettingsWidgets(mManager);
+    for (const QSharedPointer<DkBaseManipulator> &mpl : mManager.manipulators()) {
+        auto items = mModel->findItems(mpl->name());
 
-	for (const QSharedPointer<DkBaseManipulator>& mpl : mManager.manipulators()) {
-		auto items = mModel->findItems(mpl->name());
-
-		for (auto i : items)
-			i->setCheckState(mpl->isSelected() ? Qt::Checked : Qt::Unchecked);
-	}
+        for (auto i : items)
+            i->setCheckState(mpl->isSelected() ? Qt::Checked : Qt::Unchecked);
+    }
 }
 
-void DkBatchManipulatorWidget::transferProperties(QSharedPointer<DkManipulatorBatch> batchManipulator) const {
-
-	batchManipulator->setProperties(mManager);
+void DkBatchManipulatorWidget::transferProperties(QSharedPointer<DkManipulatorBatch> batchManipulator) const
+{
+    batchManipulator->setProperties(mManager);
 }
 
-bool DkBatchManipulatorWidget::hasUserInput() const {
-	
-	return mManager.numSelected() > 0;
+bool DkBatchManipulatorWidget::hasUserInput() const
+{
+    return mManager.numSelected() > 0;
 }
 
-bool DkBatchManipulatorWidget::requiresUserInput() const {
-	return false;
+bool DkBatchManipulatorWidget::requiresUserInput() const
+{
+    return false;
 }
 
-void DkBatchManipulatorWidget::applyDefault() {
-
-	for (int rIdx = 0; rIdx < mModel->rowCount(); rIdx++) {
-		mModel->item(rIdx)->setCheckState(Qt::Unchecked);
-	}
+void DkBatchManipulatorWidget::applyDefault()
+{
+    for (int rIdx = 0; rIdx < mModel->rowCount(); rIdx++) {
+        mModel->item(rIdx)->setCheckState(Qt::Unchecked);
+    }
 }
 
-void DkBatchManipulatorWidget::setExampleFile(const QString & filePath) {
-	
-	mPreviewPath = filePath;
-	mPreview = QImage();
+void DkBatchManipulatorWidget::setExampleFile(const QString &filePath)
+{
+    mPreviewPath = filePath;
+    mPreview = QImage();
 }
 
-void DkBatchManipulatorWidget::selectionChanged(const QItemSelection & selected) {
+void DkBatchManipulatorWidget::selectionChanged(const QItemSelection &selected)
+{
+    for (auto mIdx : selected.indexes()) {
+        QStandardItem *item = mModel->item(mIdx.row());
 
-	for (auto mIdx : selected.indexes()) {
+        if (!item)
+            continue;
 
-		QStandardItem* item = mModel->item(mIdx.row());
-		
-		if (!item)
-			continue;
+        selectManipulator(mManager.manipulator(item->text()));
+    }
 
-		selectManipulator(mManager.manipulator(item->text()));
-	}
-	
-	//qDebug() << "selection changed...";
+    // qDebug() << "selection changed...";
 }
 
-void DkBatchManipulatorWidget::selectManipulator(QSharedPointer<DkBaseManipulator> mpl) {
+void DkBatchManipulatorWidget::selectManipulator(QSharedPointer<DkBaseManipulator> mpl)
+{
+    for (auto w : mMplWidgets)
+        w->hide();
 
-	for (auto w : mMplWidgets)
-		w->hide();
+    auto mplExt = qSharedPointerDynamicCast<DkBaseManipulatorExt>(mpl);
 
-	auto mplExt = qSharedPointerDynamicCast<DkBaseManipulatorExt>(mpl);
+    if (!mplExt)
+        return;
 
-	if (!mplExt)
-		return;
-	
-	if (!mplExt->widget()) {
-		qCritical() << mpl->name() << "does not have a corresponding UI";
-		Q_ASSERT(mplExt->widget());	// bang
-		return;
-	}
+    if (!mplExt->widget()) {
+        qCritical() << mpl->name() << "does not have a corresponding UI";
+        Q_ASSERT(mplExt->widget()); // bang
+        return;
+    }
 
-	mSettingsTitle->setText(mplExt->name());
-	mSettingsTitle->show();
-	mplExt->widget()->show();
+    mSettingsTitle->setText(mplExt->name());
+    mSettingsTitle->show();
+    mplExt->widget()->show();
 
-	if (!mplExt)
-		mSettingsTitle->hide();
+    if (!mplExt)
+        mSettingsTitle->hide();
 
-	// load the preview
-	if (!mPreviewPath.isEmpty() && mPreview.isNull()) {
-		DkBasicLoader bl;
-		if (bl.loadGeneral(mPreviewPath)) {
-			QImage img = bl.image();
+    // load the preview
+    if (!mPreviewPath.isEmpty() && mPreview.isNull()) {
+        DkBasicLoader bl;
+        if (bl.loadGeneral(mPreviewPath)) {
+            QImage img = bl.image();
 
-			if (img.height() > img.width())
-				img = img.scaledToHeight(qMin(img.height(), mMaxPreview));
-			else
-				img = img.scaledToWidth(qMin(img.width(), mMaxPreview));
+            if (img.height() > img.width())
+                img = img.scaledToHeight(qMin(img.height(), mMaxPreview));
+            else
+                img = img.scaledToWidth(qMin(img.width(), mMaxPreview));
 
-			mPreview = img;
-		}
-		else
-			qInfo() << "could not load" << mPreviewPath << "for preview...";
-	}
+            mPreview = img;
+        } else
+            qInfo() << "could not load" << mPreviewPath << "for preview...";
+    }
 
-	// update preview
-	if (!mPreview.isNull()) {
-		mPreviewLabel->setPixmap(QPixmap::fromImage(mpl->apply(mPreview)));
-		mPreviewLabel->show();
-	}
-	else
-		mPreviewLabel->hide();
+    // update preview
+    if (!mPreview.isNull()) {
+        mPreviewLabel->setPixmap(QPixmap::fromImage(mpl->apply(mPreview)));
+        mPreviewLabel->show();
+    } else
+        mPreviewLabel->hide();
 }
 
-void DkBatchManipulatorWidget::selectManipulator() {
+void DkBatchManipulatorWidget::selectManipulator()
+{
+    QAction *action = dynamic_cast<QAction *>(QObject::sender());
+    QSharedPointer<DkBaseManipulator> mpl = mManager.manipulator(action);
 
-	QAction* action = dynamic_cast<QAction*>(QObject::sender());
-	QSharedPointer<DkBaseManipulator> mpl = mManager.manipulator(action);
-
-	if (mpl && action->isChecked())
-		selectManipulator(mpl);
+    if (mpl && action->isChecked())
+        selectManipulator(mpl);
 }
 
-void DkBatchManipulatorWidget::itemChanged(QStandardItem * item) {
-
-	auto mpl = mManager.manipulator(item->text());
+void DkBatchManipulatorWidget::itemChanged(QStandardItem *item)
+{
+    auto mpl = mManager.manipulator(item->text());
 
-	if (!mpl) {
-		qCritical() << "could not cast item in DkBatchManipulatorWidget!";
-		return;
-	}
+    if (!mpl) {
+        qCritical() << "could not cast item in DkBatchManipulatorWidget!";
+        return;
+    }
 
-	mpl->setSelected(item->checkState() == Qt::Checked);
-	selectManipulator(mpl);
+    mpl->setSelected(item->checkState() == Qt::Checked);
+    selectManipulator(mpl);
 
-	updateHeader();
-	//qDebug() << "item: " << item->text();
+    updateHeader();
+    // qDebug() << "item: " << item->text();
 }
 
-void DkBatchManipulatorWidget::updateHeader() const {
-
-	int c = mManager.numSelected();
-	if (!c)
-		emit newHeaderText(tr("inactive"));
-	else
-		emit newHeaderText(tr("%1 manipulators selected").arg(c));
-
+void DkBatchManipulatorWidget::updateHeader() const
+{
+    int c = mManager.numSelected();
+    if (!c)
+        emit newHeaderText(tr("inactive"));
+    else
+        emit newHeaderText(tr("%1 manipulators selected").arg(c));
 }
 
 // DkBatchTransform --------------------------------------------------------------------
-DkBatchTransformWidget::DkBatchTransformWidget(QWidget* parent /* = 0 */, Qt::WindowFlags f /* = 0 */) : DkWidget(parent, f) {
-
-	createLayout();
-	applyDefault();
-}
-
-void DkBatchTransformWidget::createLayout() {
-
-	// resize
-	QLabel* resizeLabel = new QLabel(tr("Resize"), this);
-	resizeLabel->setObjectName("subTitle");
-
-	mResizeComboMode = new QComboBox(this);
-	QStringList modeItems;
-	modeItems << tr("Percent") << tr("Long Side") << tr("Short Side") << tr("Width") << tr("Height");
-	mResizeComboMode->addItems(modeItems);
-
-	mResizeSbPercent = new QDoubleSpinBox(this);
-	mResizeSbPercent->setSuffix(tr("%"));
-	mResizeSbPercent->setMaximum(1000);
-	mResizeSbPercent->setMinimum(0.1);
-
-	mResizeSbPx = new QSpinBox(this);
-	mResizeSbPx->setSuffix(tr(" px"));
-	mResizeSbPx->setMaximum(SHRT_MAX);
-	mResizeSbPx->setMinimum(1);
-
-	mResizeComboProperties = new QComboBox(this);
-	QStringList propertyItems;
-	propertyItems << tr("Transform All") << tr("Shrink Only") << tr("Enlarge Only");
-	mResizeComboProperties->addItems(propertyItems);
-
-	QWidget* resizeWidget = new QWidget(this);
-	QHBoxLayout* resizeLayout = new QHBoxLayout(resizeWidget);
-	resizeLayout->setContentsMargins(0, 0, 0, 0);
-	resizeLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
-	resizeLayout->addWidget(mResizeComboMode);
-	resizeLayout->addWidget(mResizeSbPercent);
-	resizeLayout->addWidget(mResizeSbPx);
-	resizeLayout->addWidget(mResizeComboProperties);
-	resizeLayout->addStretch();
-
-	// rotation
-	QLabel* rotateLabel = new QLabel(tr("Orientation"), this);
-	rotateLabel->setObjectName("subTitle");
-
-	mRbRotate0 = new QRadioButton(tr("Do &Not Rotate"));
-	mRbRotate0->setChecked(true);
-	mRbRotateLeft = new QRadioButton(tr("90%1 Counter Clockwise").arg(dk_degree_str));
-	mRbRotateRight = new QRadioButton(tr("90%1 Clockwise").arg(dk_degree_str));
-	mRbRotate180 = new QRadioButton(tr("180%1").arg(dk_degree_str));
-
-	mRotateGroup = new QButtonGroup(this);
-
-	mRotateGroup->addButton(mRbRotate0);
-	mRotateGroup->addButton(mRbRotateLeft);
-	mRotateGroup->addButton(mRbRotateRight);
-	mRotateGroup->addButton(mRbRotate180);
-
-	QLabel* transformLabel = new QLabel(tr("Transformations"), this);
-	transformLabel->setObjectName("subTitle");
-
-	mCbCropMetadata = new QCheckBox(tr("&Crop from Metadata"));
-
-	// crop rectangle
-	mCbCropRectangle = new QCheckBox(tr("&Crop Rectangle"));
-	mCropRectWidget = new DkRectWidget(QRect(), this);
-
-	QGridLayout* layout = new QGridLayout(this);
-	layout->setContentsMargins(0, 0, 0, 0);
-	layout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
-	layout->addWidget(resizeLabel, 0, 0);
-	layout->addWidget(resizeWidget, 1, 0);
-	layout->addWidget(rotateLabel, 2, 0);
-	layout->addWidget(mRbRotate0, 3, 0);
-	layout->addWidget(mRbRotateRight, 4, 0);
-	layout->addWidget(mRbRotateLeft, 5, 0);
-	layout->addWidget(mRbRotate180, 6, 0);
-
-	layout->addWidget(transformLabel, 7, 0);
-	layout->addWidget(mCbCropMetadata, 8, 0);
-	layout->setColumnStretch(3, 10);
-	layout->addWidget(mCbCropRectangle, 9, 0);
-	layout->setColumnStretch(3, 10);
-	layout->addWidget(mCropRectWidget, 10, 0);
-
-	connect(mResizeComboMode, SIGNAL(currentIndexChanged(int)), this, SLOT(modeChanged()));
-	connect(mResizeSbPercent, SIGNAL(valueChanged(double)), this, SLOT(updateHeader()));
-	connect(mResizeSbPx, SIGNAL(valueChanged(int)), this, SLOT(updateHeader()));
-
-	connect(mRotateGroup, SIGNAL(buttonClicked(int)), this, SLOT(updateHeader()));
-	connect(mCbCropMetadata, SIGNAL(clicked()), this, SLOT(updateHeader()));
-	connect(mCbCropRectangle, SIGNAL(clicked()), this, SLOT(updateHeader()));
-}
-
-void DkBatchTransformWidget::applyDefault() {
-
-	mRbRotate0->setChecked(true);
-	mCbCropMetadata->setChecked(false);
-	mCbCropRectangle->setChecked(false);
-	mCropRectWidget->setRect(QRect());
-
-	mResizeSbPercent->setValue(100.0);
-	mResizeSbPx->setValue(1920);
-	mResizeComboMode->setCurrentIndex(0);
-	mResizeComboProperties->setCurrentIndex(0);
-	modeChanged();	// init gui
-
-	updateHeader();
-}
-
-bool DkBatchTransformWidget::hasUserInput() const {
-	
-	return 
-		!mRbRotate0->isChecked() || 
-		mCbCropMetadata->isChecked() || 
-		mCbCropRectangle->isChecked() ||
-		!(mResizeComboMode->currentIndex() == DkBatchTransform::resize_mode_default && mResizeSbPercent->value() == 100.0);
-}
-
-bool DkBatchTransformWidget::requiresUserInput() const {
-
-	return false;
-}
-
-void DkBatchTransformWidget::updateHeader() const {
-
-	if (!hasUserInput())
-		emit newHeaderText(tr("inactive"));
-	else {
-		
-		QString txt;
-
-		if (mResizeComboMode->currentIndex() == DkBatchTransform::resize_mode_default && mResizeSbPercent->value() != 100.0) {
-			txt += tr("Resize by: %1%").arg(QString::number(mResizeSbPercent->value()));
-		}
-
-		if (mResizeComboMode->currentIndex() != DkBatchTransform::resize_mode_default) {
-			txt += tr("Resize %1 to: %2 px").arg(mResizeComboMode->itemText(mResizeComboMode->currentIndex())).arg(QString::number(mResizeSbPx->value()));
-		}
-
-		if (getAngle() != 0) {
-			if (!txt.isEmpty())
-				txt += " | ";
-			txt += tr("Rotating by: %1").arg(getAngle());
-		}
-
-		if (mCbCropMetadata->isChecked() || mCbCropRectangle->isChecked()) {
-			if (!txt.isEmpty())
-				txt += " | ";
-			txt += tr("Crop");
-		}
-
-		emit newHeaderText(txt);
-	}
-}
-
-void DkBatchTransformWidget::modeChanged() {
-
-	if (mResizeComboMode->currentIndex() == DkBatchTransform::resize_mode_default) {
-		mResizeSbPx->hide();
-		mResizeSbPercent->show();
-		mResizeComboProperties->hide();
-		updateHeader();
-	}
-	else {
-		mResizeSbPx->show();
-		mResizeSbPercent->hide();
-		mResizeComboProperties->show();
-		updateHeader();
-	}
-}
-
-void DkBatchTransformWidget::transferProperties(QSharedPointer<DkBatchTransform> batchTransform) const {
-
-	if (mResizeComboMode->currentIndex() == DkBatchTransform::resize_mode_default) {
-		batchTransform->setProperties(
-			getAngle(), 
-			mCbCropMetadata->isChecked(),
-			mCbCropRectangle->isChecked() ? cropRect() : QRect(),
-			(float)mResizeSbPercent->value()/100.0f, 
-			(DkBatchTransform::ResizeMode)mResizeComboMode->currentIndex());
-	}
-	else {
-		batchTransform->setProperties(
-			getAngle(), 
-			mCbCropMetadata->isChecked(),
-			mCbCropRectangle->isChecked() ? cropRect() : QRect(),
-			(float)mResizeSbPx->value(), 
-			(DkBatchTransform::ResizeMode)mResizeComboMode->currentIndex(), 
-			(DkBatchTransform::ResizeProperty)mResizeComboProperties->currentIndex());
-	}
-
-}
-
-bool DkBatchTransformWidget::loadProperties(QSharedPointer<DkBatchTransform> batchTransform) {
-	
-	if (!batchTransform) {
-		qWarning() << "cannot load settings, DkBatchTransform is NULL";
-		return false;
-	}
-
-	bool errored = false;
-
-	switch (batchTransform->angle()) {
-	case -90:	mRbRotateLeft->setChecked(true); break;
-	case 90:	mRbRotateLeft->setChecked(true); break;
-	case 180:	mRbRotateLeft->setChecked(true); break;
-	case 0:	break;	// nothing todo
-	default: errored = true;
-	}
-
-	// crop
-	mCbCropMetadata->setChecked(batchTransform->cropMetatdata());
-
-	mCbCropRectangle->setChecked(batchTransform->cropFromRectangle());
-	mCropRectWidget->setRect(batchTransform->cropRectangle());
-
-	// resize
-	mResizeComboMode->setCurrentIndex(batchTransform->mode());
-	mResizeComboProperties->setCurrentIndex(batchTransform->prop());
-
-	float sf = batchTransform->scaleFactor();
-	if (batchTransform->mode() == DkBatchTransform::resize_mode_default)
-		mResizeSbPercent->setValue(sf*100.0f);
-	else
-		mResizeSbPx->setValue(qRound(sf));
-	modeChanged();
-	updateHeader();
-
-	return !errored;
-}
-
-int DkBatchTransformWidget::getAngle() const {
-
-	if (mRbRotate0->isChecked())
-		return 0;
-	else if (mRbRotateLeft->isChecked())
-		return -90;
-	else if (mRbRotateRight->isChecked())
-		return 90;
-	else if (mRbRotate180->isChecked())
-		return 180;
-
-	return 0;
-}
-
-QRect DkBatchTransformWidget::cropRect() const {
-	return mCropRectWidget->rect();
+DkBatchTransformWidget::DkBatchTransformWidget(QWidget *parent /* = 0 */, Qt::WindowFlags f /* = 0 */)
+    : DkWidget(parent, f)
+{
+    createLayout();
+    applyDefault();
+}
+
+void DkBatchTransformWidget::createLayout()
+{
+    // resize
+    QLabel *resizeLabel = new QLabel(tr("Resize"), this);
+    resizeLabel->setObjectName("subTitle");
+
+    mResizeComboMode = new QComboBox(this);
+    QStringList modeItems;
+    modeItems << tr("Percent") << tr("Long Side") << tr("Short Side") << tr("Width") << tr("Height");
+    mResizeComboMode->addItems(modeItems);
+
+    mResizeSbPercent = new QDoubleSpinBox(this);
+    mResizeSbPercent->setSuffix(tr("%"));
+    mResizeSbPercent->setMaximum(1000);
+    mResizeSbPercent->setMinimum(0.1);
+
+    mResizeSbPx = new QSpinBox(this);
+    mResizeSbPx->setSuffix(tr(" px"));
+    mResizeSbPx->setMaximum(SHRT_MAX);
+    mResizeSbPx->setMinimum(1);
+
+    mResizeComboProperties = new QComboBox(this);
+    QStringList propertyItems;
+    propertyItems << tr("Transform All") << tr("Shrink Only") << tr("Enlarge Only");
+    mResizeComboProperties->addItems(propertyItems);
+
+    QWidget *resizeWidget = new QWidget(this);
+    QHBoxLayout *resizeLayout = new QHBoxLayout(resizeWidget);
+    resizeLayout->setContentsMargins(0, 0, 0, 0);
+    resizeLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
+    resizeLayout->addWidget(mResizeComboMode);
+    resizeLayout->addWidget(mResizeSbPercent);
+    resizeLayout->addWidget(mResizeSbPx);
+    resizeLayout->addWidget(mResizeComboProperties);
+    resizeLayout->addStretch();
+
+    // rotation
+    QLabel *rotateLabel = new QLabel(tr("Orientation"), this);
+    rotateLabel->setObjectName("subTitle");
+
+    mRbRotate0 = new QRadioButton(tr("Do &Not Rotate"));
+    mRbRotate0->setChecked(true);
+    mRbRotateLeft = new QRadioButton(tr("90%1 Counter Clockwise").arg(dk_degree_str));
+    mRbRotateRight = new QRadioButton(tr("90%1 Clockwise").arg(dk_degree_str));
+    mRbRotate180 = new QRadioButton(tr("180%1").arg(dk_degree_str));
+
+    mRotateGroup = new QButtonGroup(this);
+
+    mRotateGroup->addButton(mRbRotate0);
+    mRotateGroup->addButton(mRbRotateLeft);
+    mRotateGroup->addButton(mRbRotateRight);
+    mRotateGroup->addButton(mRbRotate180);
+
+    QLabel *transformLabel = new QLabel(tr("Transformations"), this);
+    transformLabel->setObjectName("subTitle");
+
+    mCbCropMetadata = new QCheckBox(tr("&Crop from Metadata"));
+
+    // crop rectangle
+    mCbCropRectangle = new QCheckBox(tr("&Crop Rectangle"));
+    mCropRectWidget = new DkRectWidget(QRect(), this);
+
+    QGridLayout *layout = new QGridLayout(this);
+    layout->setContentsMargins(0, 0, 0, 0);
+    layout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
+    layout->addWidget(resizeLabel, 0, 0);
+    layout->addWidget(resizeWidget, 1, 0);
+    layout->addWidget(rotateLabel, 2, 0);
+    layout->addWidget(mRbRotate0, 3, 0);
+    layout->addWidget(mRbRotateRight, 4, 0);
+    layout->addWidget(mRbRotateLeft, 5, 0);
+    layout->addWidget(mRbRotate180, 6, 0);
+
+    layout->addWidget(transformLabel, 7, 0);
+    layout->addWidget(mCbCropMetadata, 8, 0);
+    layout->setColumnStretch(3, 10);
+    layout->addWidget(mCbCropRectangle, 9, 0);
+    layout->setColumnStretch(3, 10);
+    layout->addWidget(mCropRectWidget, 10, 0);
+
+    connect(mResizeComboMode, SIGNAL(currentIndexChanged(int)), this, SLOT(modeChanged()));
+    connect(mResizeSbPercent, SIGNAL(valueChanged(double)), this, SLOT(updateHeader()));
+    connect(mResizeSbPx, SIGNAL(valueChanged(int)), this, SLOT(updateHeader()));
+
+    connect(mRotateGroup, SIGNAL(buttonClicked(int)), this, SLOT(updateHeader()));
+    connect(mCbCropMetadata, SIGNAL(clicked()), this, SLOT(updateHeader()));
+    connect(mCbCropRectangle, SIGNAL(clicked()), this, SLOT(updateHeader()));
+}
+
+void DkBatchTransformWidget::applyDefault()
+{
+    mRbRotate0->setChecked(true);
+    mCbCropMetadata->setChecked(false);
+    mCbCropRectangle->setChecked(false);
+    mCropRectWidget->setRect(QRect());
+
+    mResizeSbPercent->setValue(100.0);
+    mResizeSbPx->setValue(1920);
+    mResizeComboMode->setCurrentIndex(0);
+    mResizeComboProperties->setCurrentIndex(0);
+    modeChanged(); // init gui
+
+    updateHeader();
+}
+
+bool DkBatchTransformWidget::hasUserInput() const
+{
+    return !mRbRotate0->isChecked() || mCbCropMetadata->isChecked() || mCbCropRectangle->isChecked()
+        || !(mResizeComboMode->currentIndex() == DkBatchTransform::resize_mode_default && mResizeSbPercent->value() == 100.0);
+}
+
+bool DkBatchTransformWidget::requiresUserInput() const
+{
+    return false;
+}
+
+void DkBatchTransformWidget::updateHeader() const
+{
+    if (!hasUserInput())
+        emit newHeaderText(tr("inactive"));
+    else {
+        QString txt;
+
+        if (mResizeComboMode->currentIndex() == DkBatchTransform::resize_mode_default && mResizeSbPercent->value() != 100.0) {
+            txt += tr("Resize by: %1%").arg(QString::number(mResizeSbPercent->value()));
+        }
+
+        if (mResizeComboMode->currentIndex() != DkBatchTransform::resize_mode_default) {
+            txt += tr("Resize %1 to: %2 px").arg(mResizeComboMode->itemText(mResizeComboMode->currentIndex())).arg(QString::number(mResizeSbPx->value()));
+        }
+
+        if (getAngle() != 0) {
+            if (!txt.isEmpty())
+                txt += " | ";
+            txt += tr("Rotating by: %1").arg(getAngle());
+        }
+
+        if (mCbCropMetadata->isChecked() || mCbCropRectangle->isChecked()) {
+            if (!txt.isEmpty())
+                txt += " | ";
+            txt += tr("Crop");
+        }
+
+        emit newHeaderText(txt);
+    }
+}
+
+void DkBatchTransformWidget::modeChanged()
+{
+    if (mResizeComboMode->currentIndex() == DkBatchTransform::resize_mode_default) {
+        mResizeSbPx->hide();
+        mResizeSbPercent->show();
+        mResizeComboProperties->hide();
+        updateHeader();
+    } else {
+        mResizeSbPx->show();
+        mResizeSbPercent->hide();
+        mResizeComboProperties->show();
+        updateHeader();
+    }
+}
+
+void DkBatchTransformWidget::transferProperties(QSharedPointer<DkBatchTransform> batchTransform) const
+{
+    if (mResizeComboMode->currentIndex() == DkBatchTransform::resize_mode_default) {
+        batchTransform->setProperties(getAngle(),
+                                      mCbCropMetadata->isChecked(),
+                                      mCbCropRectangle->isChecked() ? cropRect() : QRect(),
+                                      (float)mResizeSbPercent->value() / 100.0f,
+                                      (DkBatchTransform::ResizeMode)mResizeComboMode->currentIndex());
+    } else {
+        batchTransform->setProperties(getAngle(),
+                                      mCbCropMetadata->isChecked(),
+                                      mCbCropRectangle->isChecked() ? cropRect() : QRect(),
+                                      (float)mResizeSbPx->value(),
+                                      (DkBatchTransform::ResizeMode)mResizeComboMode->currentIndex(),
+                                      (DkBatchTransform::ResizeProperty)mResizeComboProperties->currentIndex());
+    }
+}
+
+bool DkBatchTransformWidget::loadProperties(QSharedPointer<DkBatchTransform> batchTransform)
+{
+    if (!batchTransform) {
+        qWarning() << "cannot load settings, DkBatchTransform is NULL";
+        return false;
+    }
+
+    bool errored = false;
+
+    switch (batchTransform->angle()) {
+    case -90:
+        mRbRotateLeft->setChecked(true);
+        break;
+    case 90:
+        mRbRotateLeft->setChecked(true);
+        break;
+    case 180:
+        mRbRotateLeft->setChecked(true);
+        break;
+    case 0:
+        break; // nothing todo
+    default:
+        errored = true;
+    }
+
+    // crop
+    mCbCropMetadata->setChecked(batchTransform->cropMetatdata());
+
+    mCbCropRectangle->setChecked(batchTransform->cropFromRectangle());
+    mCropRectWidget->setRect(batchTransform->cropRectangle());
+
+    // resize
+    mResizeComboMode->setCurrentIndex(batchTransform->mode());
+    mResizeComboProperties->setCurrentIndex(batchTransform->prop());
+
+    float sf = batchTransform->scaleFactor();
+    if (batchTransform->mode() == DkBatchTransform::resize_mode_default)
+        mResizeSbPercent->setValue(sf * 100.0f);
+    else
+        mResizeSbPx->setValue(qRound(sf));
+    modeChanged();
+    updateHeader();
+
+    return !errored;
+}
+
+int DkBatchTransformWidget::getAngle() const
+{
+    if (mRbRotate0->isChecked())
+        return 0;
+    else if (mRbRotateLeft->isChecked())
+        return -90;
+    else if (mRbRotateRight->isChecked())
+        return 90;
+    else if (mRbRotate180->isChecked())
+        return 180;
+
+    return 0;
+}
+
+QRect DkBatchTransformWidget::cropRect() const
+{
+    return mCropRectWidget->rect();
 }
 
 // Batch Buttons --------------------------------------------------------------------
-DkBatchButtonsWidget::DkBatchButtonsWidget(QWidget* parent) : DkFadeWidget(parent) {
-	createLayout();
-	setPaused();
+DkBatchButtonsWidget::DkBatchButtonsWidget(QWidget *parent)
+    : DkFadeWidget(parent)
+{
+    createLayout();
+    setPaused();
 }
 
-void DkBatchButtonsWidget::createLayout() {
+void DkBatchButtonsWidget::createLayout()
+{
+    // play - pause button
+    QSize s(32, 32);
+    QIcon icon;
+    QPixmap pm(DkImage::loadIcon(":/nomacs/img/play.svg", QColor(255, 255, 255), s));
+    icon.addPixmap(pm, QIcon::Normal, QIcon::Off);
+    pm = DkImage::loadIcon(":/nomacs/img/stop.svg", QColor(255, 255, 255), s);
+    icon.addPixmap(pm, QIcon::Normal, QIcon::On);
 
-	// play - pause button
-	QSize s(32, 32);
-	QIcon icon;
-	QPixmap pm(DkImage::loadIcon(":/nomacs/img/play.svg", s, QColor(255, 255, 255)));
-	icon.addPixmap(pm, QIcon::Normal, QIcon::Off);
-	pm = DkImage::loadIcon(":/nomacs/img/stop.svg", s, QColor(255, 255, 255));
-	icon.addPixmap(pm, QIcon::Normal, QIcon::On);
+    mPlayButton = new QPushButton(icon, "", this);
+    mPlayButton->setIconSize(pm.size());
+    mPlayButton->setCheckable(true);
+    mPlayButton->setFlat(true);
+    mPlayButton->setShortcut(Qt::ALT + Qt::Key_Return);
+    mPlayButton->setToolTip(tr("Start/Cancel Batch Processing (%1)").arg(mPlayButton->shortcut().toString()));
 
-	mPlayButton = new QPushButton(icon, "", this);
-	mPlayButton->setIconSize(pm.size());
-	mPlayButton->setCheckable(true);
-	mPlayButton->setFlat(true);
-	mPlayButton->setShortcut(Qt::ALT + Qt::Key_Return);
-	mPlayButton->setToolTip(tr("Start/Cancel Batch Processing (%1)").arg(mPlayButton->shortcut().toString()));
+    icon = QIcon();
+    pm = QPixmap(DkImage::loadIcon(":/nomacs/img/bars.svg", QColor(255, 255, 255), s));
+    icon.addPixmap(pm, QIcon::Normal, QIcon::On);
+    pm = QPixmap(DkImage::loadIcon(":/nomacs/img/bars.svg", QColor(100, 100, 100), s));
+    icon.addPixmap(pm, QIcon::Disabled, QIcon::On);
 
-	icon = QIcon();
-	pm = QPixmap(DkImage::loadIcon(":/nomacs/img/bars.svg", s, QColor(255, 255, 255)));
-	icon.addPixmap(pm, QIcon::Normal, QIcon::On);
-	pm = QPixmap(DkImage::loadIcon(":/nomacs/img/bars.svg", s, QColor(100, 100, 100)));
-	icon.addPixmap(pm, QIcon::Disabled, QIcon::On);
+    mLogButton = new QPushButton(icon, "", this);
+    mLogButton->setIconSize(pm.size());
+    mLogButton->setFlat(true);
+    mLogButton->setEnabled(false);
 
-	mLogButton = new QPushButton(icon, "", this);
-	mLogButton->setIconSize(pm.size());
-	mLogButton->setFlat(true);
-	mLogButton->setEnabled(false);
-	
-	// connect
-	connect(mPlayButton, SIGNAL(clicked(bool)), this, SIGNAL(playSignal(bool)));
-	connect(mLogButton, SIGNAL(clicked()), this, SIGNAL(showLogSignal()));
+    // connect
+    connect(mPlayButton, SIGNAL(clicked(bool)), this, SIGNAL(playSignal(bool)));
+    connect(mLogButton, SIGNAL(clicked()), this, SIGNAL(showLogSignal()));
 
-	QHBoxLayout* layout = new QHBoxLayout(this);
-	layout->addWidget(mPlayButton);
-	layout->addWidget(mLogButton);
+    QHBoxLayout *layout = new QHBoxLayout(this);
+    layout->addWidget(mPlayButton);
+    layout->addWidget(mLogButton);
 }
 
-void DkBatchButtonsWidget::setPaused(bool paused) {
-	mPlayButton->setChecked(!paused);
+void DkBatchButtonsWidget::setPaused(bool paused)
+{
+    mPlayButton->setChecked(!paused);
 }
 
-QPushButton * DkBatchButtonsWidget::logButton() {
-	return mLogButton;
+QPushButton *DkBatchButtonsWidget::logButton()
+{
+    return mLogButton;
 }
 
-QPushButton * DkBatchButtonsWidget::playButton() {
-	return mPlayButton;
+QPushButton *DkBatchButtonsWidget::playButton()
+{
+    return mPlayButton;
 }
 
 // DkBatchInfo --------------------------------------------------------------------
-DkBatchInfoWidget::DkBatchInfoWidget(QWidget* parent) : DkFadeWidget(parent) {
-	createLayout();
-}
-
-void DkBatchInfoWidget::createLayout() {
-
-	mInfo = new QLabel(this);
-	mInfo->setObjectName("BatchInfo");
-
-	mIcon = new QLabel(this);
-	
-	QHBoxLayout* layout = new QHBoxLayout(this);
-	layout->setAlignment(Qt::AlignLeft);
-	layout->addWidget(mIcon);
-	layout->addWidget(mInfo);
-}
-
-void DkBatchInfoWidget::setInfo(const QString& message, const InfoMode& mode) {
-
-	if (message == "")
-		hide();
-	else
-		show();
-
-	QPixmap pm;
-	switch (mode) {
-	case info_warning:	pm = QIcon(":/nomacs/img/warning.svg").pixmap(24);	break;
-	case info_critical:	pm = QIcon(":/nomacs/img/warning.svg").pixmap(24);	break;
-	default:			pm = QIcon(":/nomacs/img/info.svg").pixmap(24);		break;
-	}
-	pm = DkImage::colorizePixmap(pm, QColor(255, 255, 255));
-	mIcon->setPixmap(pm);
-
-	mInfo->setText(message);
+DkBatchInfoWidget::DkBatchInfoWidget(QWidget *parent)
+    : DkFadeWidget(parent)
+{
+    createLayout();
+}
+
+void DkBatchInfoWidget::createLayout()
+{
+    mInfo = new QLabel(this);
+    mInfo->setObjectName("BatchInfo");
+
+    mIcon = new QLabel(this);
+
+    QHBoxLayout *layout = new QHBoxLayout(this);
+    layout->setAlignment(Qt::AlignLeft);
+    layout->addWidget(mIcon);
+    layout->addWidget(mInfo);
+}
+
+void DkBatchInfoWidget::setInfo(const QString &message, const InfoMode &mode)
+{
+    if (message == "")
+        hide();
+    else
+        show();
+
+    QPixmap pm;
+    switch (mode) {
+    case info_warning:
+        pm = QIcon(":/nomacs/img/warning.svg").pixmap(24);
+        break;
+    case info_critical:
+        pm = QIcon(":/nomacs/img/warning.svg").pixmap(24);
+        break;
+    default:
+        pm = QIcon(":/nomacs/img/info.svg").pixmap(24);
+        break;
+    }
+    pm = DkImage::colorizePixmap(pm, QColor(255, 255, 255));
+    mIcon->setPixmap(pm);
+
+    mInfo->setText(message);
 }
 
 // Batch Widget --------------------------------------------------------------------
-DkBatchWidget::DkBatchWidget(const QString& currentDirectory, QWidget* parent /* = 0 */) : DkFadeWidget(parent) {
-	
-	mCurrentDirectory = currentDirectory;
-	mBatchProcessing = new DkBatchProcessing(DkBatchConfig(), this);
+DkBatchWidget::DkBatchWidget(const QString &currentDirectory, QWidget *parent /* = 0 */)
+    : DkFadeWidget(parent)
+{
+    mCurrentDirectory = currentDirectory;
+    mBatchProcessing = new DkBatchProcessing(DkBatchConfig(), this);
 
-	connect(mBatchProcessing, SIGNAL(progressValueChanged(int)), this, SLOT(updateProgress(int)));
-	connect(mBatchProcessing, SIGNAL(finished()), this, SLOT(processingFinished()));
+    connect(mBatchProcessing, SIGNAL(progressValueChanged(int)), this, SLOT(updateProgress(int)));
+    connect(mBatchProcessing, SIGNAL(finished()), this, SLOT(processingFinished()));
 
-	createLayout();
+    createLayout();
 
-	connect(inputWidget(), SIGNAL(updateInputDir(const QString&)), outputWidget(), SLOT(setInputDir(const QString&)));
-	connect(&mLogUpdateTimer, SIGNAL(timeout()), this, SLOT(updateLog()));
-	connect(profileWidget(), SIGNAL(saveProfileSignal(const QString&)), this, SLOT(saveProfile(const QString&)));
-	connect(profileWidget(), SIGNAL(loadProfileSignal(const QString&)), this, SLOT(loadProfile(const QString&)));
-	connect(profileWidget(), SIGNAL(applyDefaultSignal()), this, SLOT(applyDefault()));
+    connect(inputWidget(), SIGNAL(updateInputDir(const QString &)), outputWidget(), SLOT(setInputDir(const QString &)));
+    connect(&mLogUpdateTimer, SIGNAL(timeout()), this, SLOT(updateLog()));
+    connect(profileWidget(), SIGNAL(saveProfileSignal(const QString &)), this, SLOT(saveProfile(const QString &)));
+    connect(profileWidget(), SIGNAL(loadProfileSignal(const QString &)), this, SLOT(loadProfile(const QString &)));
+    connect(profileWidget(), SIGNAL(applyDefaultSignal()), this, SLOT(applyDefault()));
 
-	inputWidget()->setDir(currentDirectory);
-	outputWidget()->setInputDir(currentDirectory);
+    inputWidget()->setDir(currentDirectory);
+    outputWidget()->setInputDir(currentDirectory);
 
-	// change tabs with page up page down
-	QAction* nextAction = new QAction(tr("next"), this);
-	nextAction->setShortcut(Qt::Key_PageDown);
-	connect(nextAction, SIGNAL(triggered()), this, SLOT(nextTab()));
-	addAction(nextAction);
+    // change tabs with page up page down
+    QAction *nextAction = new QAction(tr("next"), this);
+    nextAction->setShortcut(Qt::Key_PageDown);
+    connect(nextAction, SIGNAL(triggered()), this, SLOT(nextTab()));
+    addAction(nextAction);
 
-	QAction* previousAction = new QAction(tr("previous"), this);
-	previousAction->setShortcut(Qt::Key_PageUp);
-	previousAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
-	connect(previousAction, SIGNAL(triggered()), this, SLOT(previousTab()));
-	addAction(previousAction);
+    QAction *previousAction = new QAction(tr("previous"), this);
+    previousAction->setShortcut(Qt::Key_PageUp);
+    previousAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+    connect(previousAction, SIGNAL(triggered()), this, SLOT(previousTab()));
+    addAction(previousAction);
 }
 
-DkBatchWidget::~DkBatchWidget() {
-
-	// close cancels the current process
-	if (!cancel())
-		mBatchProcessing->waitForFinished();
+DkBatchWidget::~DkBatchWidget()
+{
+    // close cancels the current process
+    if (!cancel())
+        mBatchProcessing->waitForFinished();
 }
 
-void DkBatchWidget::createLayout() {
+void DkBatchWidget::createLayout()
+{
+    // setStyleSheet("QWidget{border: 1px solid #000000;}");
 
-	//setStyleSheet("QWidget{border: 1px solid #000000;}");
+    mWidgets.resize(batchWidgets_end);
 
-	mWidgets.resize(batchWidgets_end);
+    // Input Directory
+    mWidgets[batch_input] = new DkBatchContainer(tr("Input"), tr("no files selected"), this);
+    mWidgets[batch_input]->setContentWidget(new DkBatchInput(this));
+    inputWidget()->setDir(mCurrentDirectory);
 
-	// Input Directory
-	mWidgets[batch_input] = new DkBatchContainer(tr("Input"), tr("no files selected"), this);
-	mWidgets[batch_input]->setContentWidget(new DkBatchInput(this));
-	inputWidget()->setDir(mCurrentDirectory);
+    // fold content
+    mWidgets[batch_manipulator] = new DkBatchContainer(tr("Adjustments"), tr("inactive"), this);
+    mWidgets[batch_manipulator]->setContentWidget(new DkBatchManipulatorWidget(this));
 
-	// fold content
-	mWidgets[batch_manipulator] = new DkBatchContainer(tr("Adjustments"), tr("inactive"), this);
-	mWidgets[batch_manipulator]->setContentWidget(new DkBatchManipulatorWidget(this));
-
-	mWidgets[batch_transform] = new DkBatchContainer(tr("Transform"), tr("inactive"), this);
-	mWidgets[batch_transform]->setContentWidget(new DkBatchTransformWidget(this));
+    mWidgets[batch_transform] = new DkBatchContainer(tr("Transform"), tr("inactive"), this);
+    mWidgets[batch_transform]->setContentWidget(new DkBatchTransformWidget(this));
 
 #ifdef WITH_PLUGINS
-	mWidgets[batch_plugin] = new DkBatchContainer(tr("Plugins"), tr("inactive"), this);
-	mWidgets[batch_plugin]->setContentWidget(new DkBatchPluginWidget(this));
+    mWidgets[batch_plugin] = new DkBatchContainer(tr("Plugins"), tr("inactive"), this);
+    mWidgets[batch_plugin]->setContentWidget(new DkBatchPluginWidget(this));
 #endif
 
-	mWidgets[batch_output] = new DkBatchContainer(tr("Output"), tr("not set"), this);
-	mWidgets[batch_output]->setContentWidget(new DkBatchOutput(this));
-
-	// profiles
-	mWidgets[batch_profile] = new DkBatchContainer(tr("Profiles"), tr("inactive"), this);
-	mWidgets[batch_profile]->setContentWidget(new DkProfileWidget(this));
-
-	mProgressBar = new DkProgressBar(this);
-	mProgressBar->setVisible(false);
-	mProgressBar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);	// progressbar is greedy otherwise
-
-	QWidget* centralWidget = new QWidget(this);
-	mCentralLayout = new QStackedLayout(centralWidget);
-	mCentralLayout->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter);
-	for (DkBatchContainer* w : mWidgets) {
-		if (!w)
-			continue;
-		mCentralLayout->addWidget(w->contentWidget());
-		connect(w, SIGNAL(showSignal()), this, SLOT(changeWidget()));
-	}
-
-	connect(mWidgets[batch_input]->contentWidget(), SIGNAL(changed()), this, SLOT(widgetChanged()));
-	connect(mWidgets[batch_output]->contentWidget(), SIGNAL(changed()), this, SLOT(widgetChanged())); 
-
-	mContentTitle = new QLabel("", this);
-	mContentTitle->setObjectName("batchContentTitle");
-	mContentInfo = new QLabel("", this);
-	mContentInfo->setObjectName("batchContentInfo");
-
-	QWidget* contentWidget = new QWidget(this);
-	QVBoxLayout* dialogLayout = new QVBoxLayout(contentWidget);
-	dialogLayout->addWidget(mContentTitle);
-	dialogLayout->addWidget(mContentInfo);
-	dialogLayout->addWidget(centralWidget);		// almost everything
-	//dialogLayout->addStretch(10);
-	//dialogLayout->addWidget(mButtons);
-
-	// the tabs left
-	QWidget* tabWidget = new QWidget(this);
-	tabWidget->setObjectName("DkBatchTabs");
-
-	QVBoxLayout* tabLayout = new QVBoxLayout(tabWidget);
-	tabLayout->setAlignment(Qt::AlignTop);
-	tabLayout->setContentsMargins(0, 0, 0, 0);
-	tabLayout->setSpacing(0);
-
-	// tab buttons must be checked exclusively
-	QButtonGroup* tabGroup = new QButtonGroup(this);
-
-	for (DkBatchContainer* w : mWidgets) {
-
-		if (!w)
-			continue;
-		tabLayout->addWidget(w->headerWidget());
-		tabGroup->addButton(w->headerWidget());
-	}
-
-	mInfoWidget = new DkBatchInfoWidget(this);
+    mWidgets[batch_output] = new DkBatchContainer(tr("Output"), tr("not set"), this);
+    mWidgets[batch_output]->setContentWidget(new DkBatchOutput(this));
+
+    // profiles
+    mWidgets[batch_profile] = new DkBatchContainer(tr("Profiles"), tr("inactive"), this);
+    mWidgets[batch_profile]->setContentWidget(new DkProfileWidget(this));
+
+    mProgressBar = new DkProgressBar(this);
+    mProgressBar->setVisible(false);
+    mProgressBar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); // progressbar is greedy otherwise
+
+    QWidget *centralWidget = new QWidget(this);
+    mCentralLayout = new QStackedLayout(centralWidget);
+    mCentralLayout->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter);
+    for (DkBatchContainer *w : mWidgets) {
+        if (!w)
+            continue;
+        mCentralLayout->addWidget(w->contentWidget());
+        connect(w, SIGNAL(showSignal()), this, SLOT(changeWidget()));
+    }
+
+    connect(mWidgets[batch_input]->contentWidget(), SIGNAL(changed()), this, SLOT(widgetChanged()));
+    connect(mWidgets[batch_output]->contentWidget(), SIGNAL(changed()), this, SLOT(widgetChanged()));
+
+    mContentTitle = new QLabel("", this);
+    mContentTitle->setObjectName("batchContentTitle");
+    mContentInfo = new QLabel("", this);
+    mContentInfo->setObjectName("batchContentInfo");
+
+    QWidget *contentWidget = new QWidget(this);
+    QVBoxLayout *dialogLayout = new QVBoxLayout(contentWidget);
+    dialogLayout->addWidget(mContentTitle);
+    dialogLayout->addWidget(mContentInfo);
+    dialogLayout->addWidget(centralWidget); // almost everything
+    // dialogLayout->addStretch(10);
+    // dialogLayout->addWidget(mButtons);
 
-	mButtonWidget = new DkBatchButtonsWidget(this);
-	mButtonWidget->show();
-	tabLayout->addStretch();
-	tabLayout->addWidget(mInfoWidget);
-	tabLayout->addWidget(mProgressBar);
-	tabLayout->addWidget(mButtonWidget);
+    // the tabs left
+    QWidget *tabWidget = new QWidget(this);
+    tabWidget->setObjectName("DkBatchTabs");
 
-	DkResizableScrollArea* tabScroller = new DkResizableScrollArea(this);
-	tabScroller->setWidgetResizable(true);
-	tabScroller->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
-	tabScroller->setWidget(tabWidget);
-	tabScroller->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+    QVBoxLayout *tabLayout = new QVBoxLayout(tabWidget);
+    tabLayout->setAlignment(Qt::AlignTop);
+    tabLayout->setContentsMargins(0, 0, 0, 0);
+    tabLayout->setSpacing(0);
 
-	DkResizableScrollArea* contentScroller = new DkResizableScrollArea(this);
-	contentScroller->setWidgetResizable(true);
-	contentScroller->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
-	contentScroller->setWidget(contentWidget);
-	//contentScroller->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+    // tab buttons must be checked exclusively
+    QButtonGroup *tabGroup = new QButtonGroup(this);
 
-	QHBoxLayout* layout = new QHBoxLayout(this);
-	layout->setContentsMargins(0, 0, 0, 0);
-	layout->addWidget(tabScroller);
-	layout->addWidget(contentScroller);
+    for (DkBatchContainer *w : mWidgets) {
+        if (!w)
+            continue;
+        tabLayout->addWidget(w->headerWidget());
+        tabGroup->addButton(w->headerWidget());
+    }
 
-	// open the first tab
-	if (!mWidgets.empty())
-		mWidgets[0]->headerWidget()->click();
+    mInfoWidget = new DkBatchInfoWidget(this);
 
-	connect(mButtonWidget, SIGNAL(playSignal(bool)), this, SLOT(toggleBatch(bool)));
-	connect(mButtonWidget, SIGNAL(showLogSignal()), this, SLOT(showLog()));
-	connect(this, SIGNAL(infoSignal(const QString&, const DkBatchInfoWidget::InfoMode&)), mInfoWidget, SLOT(setInfo(const QString&, const DkBatchInfoWidget::InfoMode&)));
-}
+    mButtonWidget = new DkBatchButtonsWidget(this);
+    mButtonWidget->show();
+    tabLayout->addStretch();
+    tabLayout->addWidget(mInfoWidget);
+    tabLayout->addWidget(mProgressBar);
+    tabLayout->addWidget(mButtonWidget);
 
-DkBatchInput* DkBatchWidget::inputWidget() const {
+    DkResizableScrollArea *tabScroller = new DkResizableScrollArea(this);
+    tabScroller->setWidgetResizable(true);
+    tabScroller->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
+    tabScroller->setWidget(tabWidget);
+    tabScroller->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
 
-	DkBatchInput* w = dynamic_cast<DkBatchInput*>(mWidgets[batch_input]->contentWidget());
-	if (!w)
-		qCritical() << "cannot cast to DkBatchInput";
+    DkResizableScrollArea *contentScroller = new DkResizableScrollArea(this);
+    contentScroller->setWidgetResizable(true);
+    contentScroller->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
+    contentScroller->setWidget(contentWidget);
+    // contentScroller->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
 
-	return w;
-}
+    QHBoxLayout *layout = new QHBoxLayout(this);
+    layout->setContentsMargins(0, 0, 0, 0);
+    layout->addWidget(tabScroller);
+    layout->addWidget(contentScroller);
 
-DkBatchOutput* DkBatchWidget::outputWidget() const {
-	
-	DkBatchOutput* w = dynamic_cast<DkBatchOutput*>(mWidgets[batch_output]->contentWidget());
-	if (!w)
-		qCritical() << "cannot cast to DkBatchOutput";
+    // open the first tab
+    if (!mWidgets.empty())
+        mWidgets[0]->headerWidget()->click();
 
-	return w;
+    connect(mButtonWidget, SIGNAL(playSignal(bool)), this, SLOT(toggleBatch(bool)));
+    connect(mButtonWidget, SIGNAL(showLogSignal()), this, SLOT(showLog()));
+    connect(this,
+            SIGNAL(infoSignal(const QString &, const DkBatchInfoWidget::InfoMode &)),
+            mInfoWidget,
+            SLOT(setInfo(const QString &, const DkBatchInfoWidget::InfoMode &)));
 }
 
-DkBatchManipulatorWidget* DkBatchWidget::manipulatorWidget() const {
+DkBatchInput *DkBatchWidget::inputWidget() const
+{
+    DkBatchInput *w = dynamic_cast<DkBatchInput *>(mWidgets[batch_input]->contentWidget());
+    if (!w)
+        qCritical() << "cannot cast to DkBatchInput";
 
-	DkBatchManipulatorWidget* w = dynamic_cast<DkBatchManipulatorWidget*>(mWidgets[batch_manipulator]->contentWidget());
-	if (!w)
-		qCritical() << "cannot cast to DkBatchManipulatorWidget";
+    return w;
+}
+
+DkBatchOutput *DkBatchWidget::outputWidget() const
+{
+    DkBatchOutput *w = dynamic_cast<DkBatchOutput *>(mWidgets[batch_output]->contentWidget());
+    if (!w)
+        qCritical() << "cannot cast to DkBatchOutput";
+
+    return w;
+}
+
+DkBatchManipulatorWidget *DkBatchWidget::manipulatorWidget() const
+{
+    DkBatchManipulatorWidget *w = dynamic_cast<DkBatchManipulatorWidget *>(mWidgets[batch_manipulator]->contentWidget());
+    if (!w)
+        qCritical() << "cannot cast to DkBatchManipulatorWidget";
 
-	return w;
+    return w;
 }
 
-DkProfileWidget* DkBatchWidget::profileWidget() const {
-	DkProfileWidget* w = dynamic_cast<DkProfileWidget*>(mWidgets[batch_profile]->contentWidget());
-	if (!w)
-		qCritical() << "cannot cast to DkBatchProfileWidget";
-
-	return w;
+DkProfileWidget *DkBatchWidget::profileWidget() const
+{
+    DkProfileWidget *w = dynamic_cast<DkProfileWidget *>(mWidgets[batch_profile]->contentWidget());
+    if (!w)
+        qCritical() << "cannot cast to DkBatchProfileWidget";
 
+    return w;
 }
 
 #ifdef WITH_PLUGINS
-DkBatchPluginWidget* DkBatchWidget::pluginWidget() const {
-
-	DkBatchPluginWidget* w = dynamic_cast<DkBatchPluginWidget*>(mWidgets[batch_plugin]->contentWidget());
-	if (!w)
-		qCritical() << "cannot cast to DkBatchPluginWidget";
-
-	return w;
+DkBatchPluginWidget *DkBatchWidget::pluginWidget() const
+{
+    DkBatchPluginWidget *w = dynamic_cast<DkBatchPluginWidget *>(mWidgets[batch_plugin]->contentWidget());
+    if (!w)
+        qCritical() << "cannot cast to DkBatchPluginWidget";
 
+    return w;
 }
 #endif
 
-DkBatchTransformWidget* DkBatchWidget::transformWidget() const {
-
-	DkBatchTransformWidget* w = dynamic_cast<DkBatchTransformWidget*>(mWidgets[batch_transform]->contentWidget());
-
-	if (!w)
-		qCritical() << "cannot cast to DkBatchTransformWidget";
-
-	return w;
-}
-
-
-void DkBatchWidget::toggleBatch(bool start) {
-
-	if (start)
-		startBatch();
-	else
-		cancel();
-}
-
-void DkBatchWidget::startBatch() {
-
-	const DkBatchConfig& bc = createBatchConfig();
-
-	if (!bc.isOk()) {
-		mButtonWidget->setPaused();
-		qWarning() << "could not create batch config...";
-		return;
-	}
-
-	mBatchProcessing->setBatchConfig(bc);
-
-	// reopen the input widget to show the status
-	if (!mWidgets.empty())
-		mWidgets[0]->headerWidget()->click();
-
-	startProcessing();
-	mBatchProcessing->compute();
-}
-
-DkBatchConfig DkBatchWidget::createBatchConfig(bool strict) const {
-
-	//QMainWindow* mw = DkActionManager::instance().getMainWindow();
-
-	// check if we are good to go
-	if (strict && inputWidget()->getSelectedFiles().empty()) {
-		emit infoSignal(tr("Please select files for processing."), DkBatchInfoWidget::InfoMode::info_warning);
-		//QMessageBox::information(mw, tr("Wrong Configuration"), tr("Please select files for processing."), QMessageBox::Ok, QMessageBox::Ok);
-		return DkBatchConfig();
-	}
-
-	if (!outputWidget()) {
-		qDebug() << "FATAL ERROR: could not cast output widget";
-		emit infoSignal(tr("I am missing a widget."), DkBatchInfoWidget::InfoMode::info_critical);
-		//QMessageBox::critical(mw, tr("Fatal Error"), tr("I am missing a widget."), QMessageBox::Ok, QMessageBox::Ok);
-		return DkBatchConfig();
-	}
-
-	if (strict && mWidgets[batch_output] && mWidgets[batch_input])  {
-		bool outputChanged = outputWidget()->hasUserInput();
-		QString inputDirPath = inputWidget()->getDir();
-		QString outputDirPath = outputWidget()->getOutputDirectory();
-
-		
-		if (!outputChanged && inputDirPath.toLower() == outputDirPath.toLower() && 
-			!(outputWidget()->overwriteMode() & DkSaveInfo::mode_overwrite ||
-			 outputWidget()->overwriteMode() & DkSaveInfo::mode_do_not_save_output)) {
-			emit infoSignal(tr("Please check 'Overwrite Existing Files' or choose a different output directory."));
-			//QMessageBox::information(mw, tr("Wrong Configuration"), 
-			//	tr("Please check 'Overwrite Existing Files' or choose a different output directory."), 
-			//	QMessageBox::Ok, QMessageBox::Ok);
-			return DkBatchConfig();
-		}
-	}
-
-
-	DkSaveInfo si;
-	si.setMode(outputWidget()->overwriteMode());
-	si.setDeleteOriginal(outputWidget()->deleteOriginal());
-	si.setInputDirIsOutputDir(outputWidget()->useInputDir());
-	si.setCompression(outputWidget()->getCompression());
-
-	DkBatchConfig config(inputWidget()->getSelectedFilesBatch(), outputWidget()->getOutputDirectory(), outputWidget()->getFilePattern());
-	config.setSaveInfo(si);
-
-	if (!config.getOutputDirPath().isEmpty() && !QDir(config.getOutputDirPath()).exists()) {
-
-		DkMessageBox* msgBox = new DkMessageBox(
-			QMessageBox::Question, tr("Create Output Directory"), 
-			tr("Should I create:\n%1").arg(config.getOutputDirPath()), 
-			(QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel), 
-			DkUtils::getMainWindow());
-
-		msgBox->setDefaultButton(QMessageBox::Yes);
-		msgBox->setObjectName("batchOutputDirDialog");
-
-		int answer = msgBox->exec();
-
-		if (answer != QMessageBox::Accepted && answer != QMessageBox::Yes) {
-			return DkBatchConfig();
-		}
-	}
-
-	if (strict && !config.isOk()) {
-
-		if (config.getOutputDirPath().isEmpty()) {
-			emit infoSignal(tr("Please select an output directory."), DkBatchInfoWidget::InfoMode::info_warning);
-			//QMessageBox::information(mw, tr("Info"), tr("Please select an output directory."), QMessageBox::Ok, QMessageBox::Ok);
-			return DkBatchConfig();
-		}
-		else if (!QDir(config.getOutputDirPath()).exists()) {
-			emit infoSignal(tr("Sorry, I cannot create %1.").arg(config.getOutputDirPath()), DkBatchInfoWidget::InfoMode::info_critical);
-			//QMessageBox::critical(mw, tr("Error"), tr("Sorry, I cannot create %1.").arg(config.getOutputDirPath()), QMessageBox::Ok, QMessageBox::Ok);
-			return DkBatchConfig();
-		}
-		else if (config.getFileList().empty()) {
-			emit infoSignal(tr("Sorry, I cannot find files to process."), DkBatchInfoWidget::InfoMode::info_critical);
-			//QMessageBox::critical(mw, tr("Error"), tr("Sorry, I cannot find files to process."), QMessageBox::Ok, QMessageBox::Ok);
-			return DkBatchConfig();
-		}
-		else if (config.getFileNamePattern().isEmpty()) {
-			emit infoSignal(tr("Sorry, the file pattern is empty."), DkBatchInfoWidget::InfoMode::info_critical);
-			//QMessageBox::critical(mw, tr("Error"), tr("Sorry, the file pattern is empty."), QMessageBox::Ok, QMessageBox::Ok);
-			return DkBatchConfig();
-		}
-		//else if (config.getOutputDir() == QDir()) {
-		//	QMessageBox::information(this, tr("Input Missing"), tr("Please choose a valid output directory\n%1").arg(config.getOutputDir().absolutePath()), QMessageBox::Ok, QMessageBox::Ok);
-		//	return;
-		//}
-
-		qDebug() << "config not ok - canceling";
-		emit infoSignal(tr("Sorry, I cannot start processing - please check the configuration."), DkBatchInfoWidget::InfoMode::info_critical);
-		//QMessageBox::critical(mw, tr("Fatal Error"), tr("Sorry, I cannot start processing - please check the configuration."), QMessageBox::Ok, QMessageBox::Ok);
-		return DkBatchConfig();
-	}
-
-	// create processing functions
-	QSharedPointer<DkManipulatorBatch> manipulatorBatch(new DkManipulatorBatch);
-	manipulatorWidget()->transferProperties(manipulatorBatch);
-
-	// create processing functions
-	QSharedPointer<DkBatchTransform> transformBatch(new DkBatchTransform);
-	transformWidget()->transferProperties(transformBatch);
+DkBatchTransformWidget *DkBatchWidget::transformWidget() const
+{
+    DkBatchTransformWidget *w = dynamic_cast<DkBatchTransformWidget *>(mWidgets[batch_transform]->contentWidget());
+
+    if (!w)
+        qCritical() << "cannot cast to DkBatchTransformWidget";
+
+    return w;
+}
+
+void DkBatchWidget::toggleBatch(bool start)
+{
+    if (start)
+        startBatch();
+    else
+        cancel();
+}
+
+void DkBatchWidget::startBatch()
+{
+    const DkBatchConfig &bc = createBatchConfig();
+
+    if (!bc.isOk()) {
+        mButtonWidget->setPaused();
+        qWarning() << "could not create batch config...";
+        return;
+    }
+
+    mBatchProcessing->setBatchConfig(bc);
+
+    // reopen the input widget to show the status
+    if (!mWidgets.empty())
+        mWidgets[0]->headerWidget()->click();
+
+    startProcessing();
+    mBatchProcessing->compute();
+}
+
+DkBatchConfig DkBatchWidget::createBatchConfig(bool strict) const
+{
+    // QMainWindow* mw = DkActionManager::instance().getMainWindow();
+
+    // check if we are good to go
+    if (strict && inputWidget()->getSelectedFiles().empty()) {
+        emit infoSignal(tr("Please select files for processing."), DkBatchInfoWidget::InfoMode::info_warning);
+        // QMessageBox::information(mw, tr("Wrong Configuration"), tr("Please select files for processing."), QMessageBox::Ok, QMessageBox::Ok);
+        return DkBatchConfig();
+    }
+
+    if (!outputWidget()) {
+        qDebug() << "FATAL ERROR: could not cast output widget";
+        emit infoSignal(tr("I am missing a widget."), DkBatchInfoWidget::InfoMode::info_critical);
+        // QMessageBox::critical(mw, tr("Fatal Error"), tr("I am missing a widget."), QMessageBox::Ok, QMessageBox::Ok);
+        return DkBatchConfig();
+    }
+
+    if (strict && mWidgets[batch_output] && mWidgets[batch_input]) {
+        bool outputChanged = outputWidget()->hasUserInput();
+        QString inputDirPath = inputWidget()->getDir();
+        QString outputDirPath = outputWidget()->getOutputDirectory();
+
+        if (!outputChanged && inputDirPath.toLower() == outputDirPath.toLower()
+            && !(outputWidget()->overwriteMode() & DkSaveInfo::mode_overwrite || outputWidget()->overwriteMode() & DkSaveInfo::mode_do_not_save_output)) {
+            emit infoSignal(tr("Please check 'Overwrite Existing Files' or choose a different output directory."));
+            // QMessageBox::information(mw, tr("Wrong Configuration"),
+            //	tr("Please check 'Overwrite Existing Files' or choose a different output directory."),
+            //	QMessageBox::Ok, QMessageBox::Ok);
+            return DkBatchConfig();
+        }
+    }
+
+    DkSaveInfo si;
+    si.setMode(outputWidget()->overwriteMode());
+    si.setDeleteOriginal(outputWidget()->deleteOriginal());
+    si.setInputDirIsOutputDir(outputWidget()->useInputDir());
+    si.setCompression(outputWidget()->getCompression());
+
+    DkBatchConfig config(inputWidget()->getSelectedFilesBatch(), outputWidget()->getOutputDirectory(), outputWidget()->getFilePattern());
+    config.setSaveInfo(si);
+
+    if (!config.getOutputDirPath().isEmpty() && !QDir(config.getOutputDirPath()).exists()) {
+        DkMessageBox *msgBox = new DkMessageBox(QMessageBox::Question,
+                                                tr("Create Output Directory"),
+                                                tr("Should I create:\n%1").arg(config.getOutputDirPath()),
+                                                (QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel),
+                                                DkUtils::getMainWindow());
+
+        msgBox->setDefaultButton(QMessageBox::Yes);
+        msgBox->setObjectName("batchOutputDirDialog");
+
+        int answer = msgBox->exec();
+
+        if (answer != QMessageBox::Accepted && answer != QMessageBox::Yes) {
+            return DkBatchConfig();
+        }
+    }
+
+    if (strict && !config.isOk()) {
+        if (config.getOutputDirPath().isEmpty()) {
+            emit infoSignal(tr("Please select an output directory."), DkBatchInfoWidget::InfoMode::info_warning);
+            // QMessageBox::information(mw, tr("Info"), tr("Please select an output directory."), QMessageBox::Ok, QMessageBox::Ok);
+            return DkBatchConfig();
+        } else if (!QDir(config.getOutputDirPath()).exists()) {
+            emit infoSignal(tr("Sorry, I cannot create %1.").arg(config.getOutputDirPath()), DkBatchInfoWidget::InfoMode::info_critical);
+            // QMessageBox::critical(mw, tr("Error"), tr("Sorry, I cannot create %1.").arg(config.getOutputDirPath()), QMessageBox::Ok, QMessageBox::Ok);
+            return DkBatchConfig();
+        } else if (config.getFileList().empty()) {
+            emit infoSignal(tr("Sorry, I cannot find files to process."), DkBatchInfoWidget::InfoMode::info_critical);
+            // QMessageBox::critical(mw, tr("Error"), tr("Sorry, I cannot find files to process."), QMessageBox::Ok, QMessageBox::Ok);
+            return DkBatchConfig();
+        } else if (config.getFileNamePattern().isEmpty()) {
+            emit infoSignal(tr("Sorry, the file pattern is empty."), DkBatchInfoWidget::InfoMode::info_critical);
+            // QMessageBox::critical(mw, tr("Error"), tr("Sorry, the file pattern is empty."), QMessageBox::Ok, QMessageBox::Ok);
+            return DkBatchConfig();
+        }
+        // else if (config.getOutputDir() == QDir()) {
+        //	QMessageBox::information(this, tr("Input Missing"), tr("Please choose a valid output directory\n%1").arg(config.getOutputDir().absolutePath()),
+        // QMessageBox::Ok, QMessageBox::Ok); 	return;
+        // }
+
+        qDebug() << "config not ok - canceling";
+        emit infoSignal(tr("Sorry, I cannot start processing - please check the configuration."), DkBatchInfoWidget::InfoMode::info_critical);
+        // QMessageBox::critical(mw, tr("Fatal Error"), tr("Sorry, I cannot start processing - please check the configuration."), QMessageBox::Ok,
+        // QMessageBox::Ok);
+        return DkBatchConfig();
+    }
+
+    // create processing functions
+    QSharedPointer<DkManipulatorBatch> manipulatorBatch(new DkManipulatorBatch);
+    manipulatorWidget()->transferProperties(manipulatorBatch);
+
+    // create processing functions
+    QSharedPointer<DkBatchTransform> transformBatch(new DkBatchTransform);
+    transformWidget()->transferProperties(transformBatch);
 
 #ifdef WITH_PLUGINS
-	// create processing functions
-	QSharedPointer<DkPluginBatch> pluginBatch(new DkPluginBatch);
-	pluginWidget()->transferProperties(pluginBatch);
+    // create processing functions
+    QSharedPointer<DkPluginBatch> pluginBatch(new DkPluginBatch);
+    pluginWidget()->transferProperties(pluginBatch);
 #endif
 
-	QVector<QSharedPointer<DkAbstractBatch> > processFunctions;
+    QVector<QSharedPointer<DkAbstractBatch>> processFunctions;
 
-	if (manipulatorBatch->isActive())
-		processFunctions.append(manipulatorBatch);
+    if (manipulatorBatch->isActive())
+        processFunctions.append(manipulatorBatch);
 
-	if (transformBatch->isActive())
-		processFunctions.append(transformBatch);
+    if (transformBatch->isActive())
+        processFunctions.append(transformBatch);
 
 #ifdef WITH_PLUGINS
-	if (pluginBatch->isActive()) {
-		processFunctions.append(pluginBatch);
-		pluginBatch->preLoad();
-	}
+    if (pluginBatch->isActive()) {
+        processFunctions.append(pluginBatch);
+        pluginBatch->preLoad();
+    }
 #endif
 
-	config.setProcessFunctions(processFunctions);
+    config.setProcessFunctions(processFunctions);
 
-	return config;
+    return config;
 }
 
-bool DkBatchWidget::cancel() {
-
-	if (mBatchProcessing->isComputing()) {
-		emit infoSignal(tr("Canceling..."), DkBatchInfoWidget::InfoMode::info_message);
-		mBatchProcessing->cancel();
-		//mButtonWidget->playButton()->setEnabled(false);
-		//stopProcessing();
-		return false;
-	}
+bool DkBatchWidget::cancel()
+{
+    if (mBatchProcessing->isComputing()) {
+        emit infoSignal(tr("Canceling..."), DkBatchInfoWidget::InfoMode::info_message);
+        mBatchProcessing->cancel();
+        // mButtonWidget->playButton()->setEnabled(false);
+        // stopProcessing();
+        return false;
+    }
 
-	return true;
+    return true;
 }
 
-void DkBatchWidget::processingFinished() {
-
-	stopProcessing();
-
+void DkBatchWidget::processingFinished()
+{
+    stopProcessing();
 }
 
-void DkBatchWidget::startProcessing() {
+void DkBatchWidget::startProcessing()
+{
+    inputWidget()->startProcessing();
+    mInfoWidget->setInfo("");
 
-	inputWidget()->startProcessing();
-	mInfoWidget->setInfo("");
+    // mProgressBar->setFixedWidth(100);
+    qDebug() << "progressbar width: " << mProgressBar->width();
+    mProgressBar->show();
+    mProgressBar->reset();
+    mProgressBar->setMaximum(inputWidget()->getSelectedFiles().size());
+    mProgressBar->setTextVisible(false);
+    mButtonWidget->logButton()->setEnabled(false);
+    mButtonWidget->setPaused(false);
 
-	//mProgressBar->setFixedWidth(100);
-	qDebug() << "progressbar width: " << mProgressBar->width();
-	mProgressBar->show();
-	mProgressBar->reset();
-	mProgressBar->setMaximum(inputWidget()->getSelectedFiles().size());
-	mProgressBar->setTextVisible(false);
-	mButtonWidget->logButton()->setEnabled(false);
-	mButtonWidget->setPaused(false);
+    DkGlobalProgress::instance().start();
 
-	DkGlobalProgress::instance().start();
-
-	mLogUpdateTimer.start(1000);
+    mLogUpdateTimer.start(1000);
 }
 
-void DkBatchWidget::stopProcessing() {
+void DkBatchWidget::stopProcessing()
+{
+    inputWidget()->stopProcessing();
 
-	inputWidget()->stopProcessing();
+    if (mBatchProcessing)
+        mBatchProcessing->postLoad();
 
-	if (mBatchProcessing)
-		mBatchProcessing->postLoad();
+    DkGlobalProgress::instance().stop();
 
-	DkGlobalProgress::instance().stop();
+    mProgressBar->hide();
+    mProgressBar->reset();
+    mButtonWidget->logButton()->setEnabled(true);
+    mButtonWidget->setPaused(true);
 
-	mProgressBar->hide();
-	mProgressBar->reset();
-	mButtonWidget->logButton()->setEnabled(true);
-	mButtonWidget->setPaused(true);
-	
-	int numFailures = mBatchProcessing->getNumFailures();
-	int numProcessed = mBatchProcessing->getNumProcessed();
-	int numItems = mBatchProcessing->getNumItems();
+    int numFailures = mBatchProcessing->getNumFailures();
+    int numProcessed = mBatchProcessing->getNumProcessed();
+    int numItems = mBatchProcessing->getNumItems();
 
-	DkBatchInfoWidget::InfoMode im = (numFailures > 0) ? DkBatchInfoWidget::InfoMode::info_warning : DkBatchInfoWidget::InfoMode::info_message;
-	mInfoWidget->setInfo(tr("%1/%2 files processed... %3 failed.").arg(numProcessed).arg(numItems).arg(numFailures), im);
+    DkBatchInfoWidget::InfoMode im = (numFailures > 0) ? DkBatchInfoWidget::InfoMode::info_warning : DkBatchInfoWidget::InfoMode::info_message;
+    mInfoWidget->setInfo(tr("%1/%2 files processed... %3 failed.").arg(numProcessed).arg(numItems).arg(numFailures), im);
 
-	mLogNeedsUpdate = false;
-	mLogUpdateTimer.stop();
+    mLogNeedsUpdate = false;
+    mLogUpdateTimer.stop();
 
-	updateLog();
+    updateLog();
 }
 
-void DkBatchWidget::updateLog() {
-
-	inputWidget()->setResults(mBatchProcessing->getResultList());
+void DkBatchWidget::updateLog()
+{
+    inputWidget()->setResults(mBatchProcessing->getResultList());
 }
 
-void DkBatchWidget::updateProgress(int progress) {
-
-	mProgressBar->setValue(progress);
-	mLogNeedsUpdate = true;
+void DkBatchWidget::updateProgress(int progress)
+{
+    mProgressBar->setValue(progress);
+    mLogNeedsUpdate = true;
 
-	DkGlobalProgress::instance().setProgressValue(qRound((double)progress / inputWidget()->getSelectedFiles().size()*100));
+    DkGlobalProgress::instance().setProgressValue(qRound((double)progress / inputWidget()->getSelectedFiles().size() * 100));
 }
 
-void DkBatchWidget::showLog() {
+void DkBatchWidget::showLog()
+{
+    QStringList log = mBatchProcessing->getLog();
 
-	QStringList log = mBatchProcessing->getLog();
+    DkTextDialog *textDialog = new DkTextDialog(this);
+    textDialog->setWindowTitle(tr("Batch Log"));
+    textDialog->getTextEdit()->setReadOnly(true);
+    textDialog->setText(log);
 
-	DkTextDialog* textDialog = new DkTextDialog(this);
-	textDialog->setWindowTitle(tr("Batch Log"));
-	textDialog->getTextEdit()->setReadOnly(true);
-	textDialog->setText(log);
-
-	textDialog->exec();
+    textDialog->exec();
 }
 
-void DkBatchWidget::setSelectedFiles(const QStringList& selFiles) {
-
-	if (!selFiles.empty()) {
-		inputWidget()->getInputEdit()->appendFiles(selFiles);
-		inputWidget()->changeTab(DkBatchInput::tab_text_input);
-	}
+void DkBatchWidget::setSelectedFiles(const QStringList &selFiles)
+{
+    if (!selFiles.empty()) {
+        inputWidget()->getInputEdit()->appendFiles(selFiles);
+        inputWidget()->changeTab(DkBatchInput::tab_text_input);
+    }
 }
 
-void DkBatchWidget::changeWidget(DkBatchContainer* widget) {
+void DkBatchWidget::changeWidget(DkBatchContainer *widget)
+{
+    if (!widget)
+        widget = dynamic_cast<DkBatchContainer *>(sender());
 
-	if (!widget)
-		widget = dynamic_cast<DkBatchContainer*>(sender());
-
-	if (!widget) {
-		qWarning() << "changeWidget() called with NULL widget";
-		return;
-	}
-
-	for (DkBatchContainer* cw : mWidgets) {
-
-		if (cw == widget) {
-			mCentralLayout->setCurrentWidget(cw->contentWidget());
-			mContentTitle->setText(cw->headerWidget()->text());
-			mContentInfo->setText(cw->headerWidget()->info());
-			cw->headerWidget()->setChecked(true);
-			connect(cw->headerWidget(), SIGNAL(infoChanged(const QString&)), mContentInfo, SLOT(setText(const QString&)), Qt::UniqueConnection);
-		}
-	}
+    if (!widget) {
+        qWarning() << "changeWidget() called with NULL widget";
+        return;
+    }
 
+    for (DkBatchContainer *cw : mWidgets) {
+        if (cw == widget) {
+            mCentralLayout->setCurrentWidget(cw->contentWidget());
+            mContentTitle->setText(cw->headerWidget()->text());
+            mContentInfo->setText(cw->headerWidget()->info());
+            cw->headerWidget()->setChecked(true);
+            connect(cw->headerWidget(), SIGNAL(infoChanged(const QString &)), mContentInfo, SLOT(setText(const QString &)), Qt::UniqueConnection);
+        }
+    }
 }
 
-void DkBatchWidget::nextTab() {
+void DkBatchWidget::nextTab()
+{
+    int idx = mCentralLayout->currentIndex() + 1;
+    idx %= mWidgets.size();
 
-	int idx = mCentralLayout->currentIndex() + 1;
-	idx %= mWidgets.size();
-
-	changeWidget(mWidgets[idx]);
+    changeWidget(mWidgets[idx]);
 }
 
-void DkBatchWidget::previousTab() {
-
-	int idx = mCentralLayout->currentIndex() - 1;
-	if (idx < 0)
-		idx = mWidgets.size()-1;
+void DkBatchWidget::previousTab()
+{
+    int idx = mCentralLayout->currentIndex() - 1;
+    if (idx < 0)
+        idx = mWidgets.size() - 1;
 
-	changeWidget(mWidgets[idx]);
+    changeWidget(mWidgets[idx]);
 }
 
-void DkBatchWidget::saveProfile(const QString & profilePath) const {
+void DkBatchWidget::saveProfile(const QString &profilePath) const
+{
+    DkBatchConfig bc = createBatchConfig(false); // false: no input/output must be profided
 
-	DkBatchConfig bc = createBatchConfig(false);	// false: no input/output must be profided
+    // if (!bc.isOk()) {
+    //	QMessageBox::critical(DkActionManager::instance().getMainWindow(), tr("Error"), tr("Sorry, I cannot save the settings, since they are incomplete..."));
+    //	return;
+    // }
 
-	//if (!bc.isOk()) {
-	//	QMessageBox::critical(DkActionManager::instance().getMainWindow(), tr("Error"), tr("Sorry, I cannot save the settings, since they are incomplete..."));
-	//	return;
-	//}
+    // allow saving without functions (i.e. image conversions)
+    // if (bc.getProcessFunctions().empty()) {
+    //	QMessageBox::information(DkUtils::getMainWindow(), tr("Save Profile"), tr("Cannot save empty profile."));
+    //	return;
+    //}
 
-	// allow saving without functions (i.e. image conversions)
-	//if (bc.getProcessFunctions().empty()) {
-	//	QMessageBox::information(DkUtils::getMainWindow(), tr("Save Profile"), tr("Cannot save empty profile."));
-	//	return;
-	//}
+    if (!DkBatchProfile::saveProfile(profilePath, bc)) {
+        QMessageBox::critical(DkUtils::getMainWindow(), tr("Error"), tr("Sorry, I cannot save the settings..."));
+        return;
+    } else
+        qInfo() << "batch profile written to: " << profilePath;
 
-	if (!DkBatchProfile::saveProfile(profilePath, bc)) {
-		QMessageBox::critical(DkUtils::getMainWindow(), tr("Error"), tr("Sorry, I cannot save the settings..."));
-		return;
-	}
-	else
-		qInfo() << "batch profile written to: " << profilePath;
-
-	profileWidget()->profileSaved(DkBatchProfile::makeUserFriendly(profilePath));
+    profileWidget()->profileSaved(DkBatchProfile::makeUserFriendly(profilePath));
 }
 
-void DkBatchWidget::loadProfile(const QString & profilePath) {
-
-	DkBatchConfig bc = DkBatchProfile::loadProfile(profilePath);
-
-	// allow loading without functions (i.e. image conversions)
-	//if (bc.getProcessFunctions().empty()) {
-	//	
-	//	QMessageBox::critical(DkUtils::getMainWindow(), 
-	//		tr("Error Loading Profile"), 
-	//		tr("Sorry, I cannot load batch settings from: \n%1").arg(profilePath));
-	//	return;
-	//}
-
-	applyDefault();
-
-	if (!bc.getFileList().empty())
-		setSelectedFiles(bc.getFileList());
+void DkBatchWidget::loadProfile(const QString &profilePath)
+{
+    DkBatchConfig bc = DkBatchProfile::loadProfile(profilePath);
 
-	outputWidget()->loadProperties(bc);
-
-	int warnings = 0;
-	auto functions = bc.getProcessFunctions();
-	for (QSharedPointer<DkAbstractBatch> cf : functions) {
-
-		if (!cf) {
-			qWarning() << "processing function is NULL - ignoring";
-			continue;
-		}
-		// apply manipulator batch settings
-		else if (QSharedPointer<DkManipulatorBatch> mf = qSharedPointerDynamicCast<DkManipulatorBatch>(cf)) {
-			if (!manipulatorWidget()->loadProperties(mf)) {
-				warnings++;
-			}
-		}
-		// apply transform batch settings
-		else if (QSharedPointer<DkBatchTransform> tf = qSharedPointerDynamicCast<DkBatchTransform>(cf)) {
-			if (!transformWidget()->loadProperties(tf)) {
-				warnings++;
-			}
-		}
+    // allow loading without functions (i.e. image conversions)
+    // if (bc.getProcessFunctions().empty()) {
+    //
+    //	QMessageBox::critical(DkUtils::getMainWindow(),
+    //		tr("Error Loading Profile"),
+    //		tr("Sorry, I cannot load batch settings from: \n%1").arg(profilePath));
+    //	return;
+    //}
+
+    applyDefault();
+
+    if (!bc.getFileList().empty())
+        setSelectedFiles(bc.getFileList());
+
+    outputWidget()->loadProperties(bc);
+
+    int warnings = 0;
+    auto functions = bc.getProcessFunctions();
+    for (QSharedPointer<DkAbstractBatch> cf : functions) {
+        if (!cf) {
+            qWarning() << "processing function is NULL - ignoring";
+            continue;
+        }
+        // apply manipulator batch settings
+        else if (QSharedPointer<DkManipulatorBatch> mf = qSharedPointerDynamicCast<DkManipulatorBatch>(cf)) {
+            if (!manipulatorWidget()->loadProperties(mf)) {
+                warnings++;
+            }
+        }
+        // apply transform batch settings
+        else if (QSharedPointer<DkBatchTransform> tf = qSharedPointerDynamicCast<DkBatchTransform>(cf)) {
+            if (!transformWidget()->loadProperties(tf)) {
+                warnings++;
+            }
+        }
 #ifdef WITH_PLUGINS
-		// apply plugin batch settings
-		else if (QSharedPointer<DkPluginBatch> pf = qSharedPointerDynamicCast<DkPluginBatch>(cf)) {
-			if (!pluginWidget()->loadProperties(pf)) {
-				warnings++;
-			}
-			pluginWidget()->setSettingsPath(profilePath);
-		}
+        // apply plugin batch settings
+        else if (QSharedPointer<DkPluginBatch> pf = qSharedPointerDynamicCast<DkPluginBatch>(cf)) {
+            if (!pluginWidget()->loadProperties(pf)) {
+                warnings++;
+            }
+            pluginWidget()->setSettingsPath(profilePath);
+        }
 #endif
-		else {
-			qWarning() << "illegal processing function: " << cf->name() << " - ignoring";
-			warnings++;
-		}
-	}
-
-	// TODO: feedback 
-	qInfo() << "settings loaded with" << warnings << "warnings";
+        else {
+            qWarning() << "illegal processing function: " << cf->name() << " - ignoring";
+            warnings++;
+        }
+    }
 
+    // TODO: feedback
+    qInfo() << "settings loaded with" << warnings << "warnings";
 }
 
-void DkBatchWidget::applyDefault() {
-
-	for (DkBatchContainer* bc : mWidgets)
-		bc->batchContent()->applyDefault();
+void DkBatchWidget::applyDefault()
+{
+    for (DkBatchContainer *bc : mWidgets)
+        bc->batchContent()->applyDefault();
 }
 
-void DkBatchWidget::widgetChanged() {
-	
-	if (mWidgets[batch_output] && mWidgets[batch_input])  {
-		QString inputDirPath = dynamic_cast<DkBatchInput*>(mWidgets[batch_input]->contentWidget())->getDir();
-		QString outputDirPath = dynamic_cast<DkBatchOutput*>(mWidgets[batch_output]->contentWidget())->getOutputDirectory();
-	
-		// TODO: shouldn't we enable it always?
-		//mButtonWidget->playButton()->setEnabled(inputDirPath == "" || outputDirPath == "");
-	}
+void DkBatchWidget::widgetChanged()
+{
+    if (mWidgets[batch_output] && mWidgets[batch_input]) {
+        QString inputDirPath = dynamic_cast<DkBatchInput *>(mWidgets[batch_input]->contentWidget())->getDir();
+        QString outputDirPath = dynamic_cast<DkBatchOutput *>(mWidgets[batch_output]->contentWidget())->getOutputDirectory();
 
-	if (!inputWidget()->getSelectedFiles().isEmpty()) {
+        // TODO: shouldn't we enable it always?
+        // mButtonWidget->playButton()->setEnabled(inputDirPath == "" || outputDirPath == "");
+    }
 
-		QUrl url = inputWidget()->getSelectedFiles().first();
-		QString fString = url.toString();
-		fString = fString.replace("file:///", "");
+    if (!inputWidget()->getSelectedFiles().isEmpty()) {
+        QUrl url = inputWidget()->getSelectedFiles().first();
+        QString fString = url.toString();
+        fString = fString.replace("file:///", "");
 
-		QFileInfo cFileInfo = QFileInfo(fString);
-		if (!cFileInfo.exists())	// try an alternative conversion
-			cFileInfo = QFileInfo(url.toLocalFile());
+        QFileInfo cFileInfo = QFileInfo(fString);
+        if (!cFileInfo.exists()) // try an alternative conversion
+            cFileInfo = QFileInfo(url.toLocalFile());
 
-		outputWidget()->setExampleFilename(cFileInfo.fileName());
-		manipulatorWidget()->setExampleFile(cFileInfo.filePath());
-		mButtonWidget->playButton()->setEnabled(true);
-	}
+        outputWidget()->setExampleFilename(cFileInfo.fileName());
+        manipulatorWidget()->setExampleFile(cFileInfo.filePath());
+        mButtonWidget->playButton()->setEnabled(true);
+    }
 }
 
 }
diff --git a/ImageLounge/src/DkGui/DkBatch.h b/ImageLounge/src/DkGui/DkBatch.h
index 1b0a4fe..e3b40bc 100644
--- a/ImageLounge/src/DkGui/DkBatch.h
+++ b/ImageLounge/src/DkGui/DkBatch.h
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
 DkNoMacs.h
 Created on:	26.10.2014
- 
+
 nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
 Copyright (C) 2011-2014 Markus Diem <markus@nomacs.org>
 Copyright (C) 2011-2014 Stefan Fiel <stefan@nomacs.org>
 Copyright (C) 2011-2014 Florian Kleber <florian@nomacs.org>
@@ -26,18 +26,18 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *******************************************************************************************************/
 #pragma once
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QWidget>
-#include <QUrl>
-#include <QTextEdit>
-#include <QPushButton>
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QItemSelection>
-#pragma warning(pop)		// no warnings from includes - end
+#include <QPushButton>
+#include <QTextEdit>
+#include <QUrl>
+#include <QWidget>
+#pragma warning(pop) // no warnings from includes - end
 
-#include "DkImageContainer.h"
-#include "DkImageLoader.h"
 #include "DkBaseWidgets.h"
 #include "DkBatchInfo.h"
+#include "DkImageContainer.h"
+#include "DkImageLoader.h"
 #include "DkManipulators.h"
 
 // Qt defines
@@ -61,25 +61,26 @@ class QStackedLayout;
 class QStandardItem;
 class QStandardItemModel;
 
-namespace nmc {
+namespace nmc
+{
 
 // TODO: these enums are global - they should be put into the respective classes
 enum fileNameTypes {
-	fileNameTypes_fileName,
-	fileNameTypes_Number,
-	fileNameTypes_Text,
+    fileNameTypes_fileName,
+    fileNameTypes_Number,
+    fileNameTypes_Text,
 
-	fileNameTypes_end
+    fileNameTypes_end
 };
 
 enum fileNameWidget {
-	fileNameWidget_type,
-	fileNameWidget_input1,
-	fileNameWidget_input2,
-	fileNameWidget_plus,
-	fileNameWidget_minus,
+    fileNameWidget_type,
+    fileNameWidget_input1,
+    fileNameWidget_input2,
+    fileNameWidget_plus,
+    fileNameWidget_minus,
 
-	fileNameWidget_end
+    fileNameWidget_end
 };
 
 // nomacs defines
@@ -100,570 +101,591 @@ class DkSettingsWidget;
 class DkBatchPluginInterface;
 class DkRectWidget;
 
-class DkBatchContent {
-
+class DkBatchContent
+{
 public:
-	virtual bool hasUserInput() const = 0;
-	virtual bool requiresUserInput() const = 0;
-	virtual void applyDefault() = 0;
+    virtual bool hasUserInput() const = 0;
+    virtual bool requiresUserInput() const = 0;
+    virtual void applyDefault() = 0;
 };
 
-class DkBatchTabButton : public QPushButton {
-	Q_OBJECT
+class DkBatchTabButton : public QPushButton
+{
+    Q_OBJECT
 
 public:
-	DkBatchTabButton(const QString& title, const QString& info = QString(), QWidget* parent = 0);
+    DkBatchTabButton(const QString &title, const QString &info = QString(), QWidget *parent = 0);
 
-	QString info() const;
+    QString info() const;
 
 public slots:
-	void setInfo(const QString& info);
+    void setInfo(const QString &info);
 
 signals:
-	void infoChanged(const QString& msg) const;
+    void infoChanged(const QString &msg) const;
 
 protected:
-	void paintEvent(QPaintEvent* event) override;
+    void paintEvent(QPaintEvent *event) override;
 
-	QString mInfo;
+    QString mInfo;
 };
 
-class DkBatchContainer : public QObject {
-	Q_OBJECT
+class DkBatchContainer : public QObject
+{
+    Q_OBJECT
 
 public:
-	DkBatchContainer(const QString& titleString, const QString& headerString, QWidget* parent = 0);
-	
-	void setContentWidget(QWidget* batchContent);
-	QWidget* contentWidget() const;
-	DkBatchContent* batchContent() const;
-	DkBatchTabButton* headerWidget() const;
+    DkBatchContainer(const QString &titleString, const QString &headerString, QWidget *parent = 0);
+
+    void setContentWidget(QWidget *batchContent);
+    QWidget *contentWidget() const;
+    DkBatchContent *batchContent() const;
+    DkBatchTabButton *headerWidget() const;
 
 public slots:
-	void showContent(bool show) const;
+    void showContent(bool show) const;
 
 signals:
-	void showSignal() const;
+    void showSignal() const;
 
 protected:
-	virtual void createLayout();
+    virtual void createLayout();
 
-	DkBatchTabButton* mHeaderButton = 0;
-	DkBatchContent* mBatchContent = 0;
+    DkBatchTabButton *mHeaderButton = 0;
+    DkBatchContent *mBatchContent = 0;
 };
 
-class DkInputTextEdit : public QTextEdit {
-	Q_OBJECT
+class DkInputTextEdit : public QTextEdit
+{
+    Q_OBJECT
 
 public:
-	DkInputTextEdit(QWidget* parent = 0);
+    DkInputTextEdit(QWidget *parent = 0);
 
-	QStringList getFileList() const;
-	void appendDir(const QString& newDir, bool recursive = false);
-	void insertFromMimeData(const QMimeData *src) override;
-	void clear();
-	QString firstDirPath() const;
+    QStringList getFileList() const;
+    void appendDir(const QString &newDir, bool recursive = false);
+    void insertFromMimeData(const QMimeData *src) override;
+    void clear();
+    QString firstDirPath() const;
 
 signals:
-	void fileListChangedSignal() const;
+    void fileListChangedSignal() const;
 
 public slots:
-	void appendFiles(const QStringList& fileList);
+    void appendFiles(const QStringList &fileList);
 
 protected:
-	void dropEvent(QDropEvent *event) override;
-	void dragEnterEvent(QDragEnterEvent *event) override;
-	void dragMoveEvent(QDragMoveEvent *event) override;
-	void appendFromMime(const QMimeData* mimeData, bool recursive = false);
+    void dropEvent(QDropEvent *event) override;
+    void dragEnterEvent(QDragEnterEvent *event) override;
+    void dragMoveEvent(QDragMoveEvent *event) override;
+    void appendFromMime(const QMimeData *mimeData, bool recursive = false);
 
-	QList<int> mResultList;
+    QList<int> mResultList;
 };
 
-class DkBatchInput : public DkWidget, public DkBatchContent  {
-	Q_OBJECT
+class DkBatchInput : public DkWidget, public DkBatchContent
+{
+    Q_OBJECT
 
 public:
-
-	enum {
-		tab_thumbs = 0,
-		tab_text_input,
-		tab_results,
-
-		tab_end
-	};
-
-	DkBatchInput(QWidget* parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
-
-	QString getDir() const;
-	QStringList getSelectedFiles() const;
-	QStringList getSelectedFilesBatch();
-	DkInputTextEdit* getInputEdit() const;
-
-	virtual bool hasUserInput() const override {return mHUserInput;};
-	virtual bool requiresUserInput() const override {return mRUserInput;};
-	virtual void applyDefault() override;
-
-	void changeTab(int tabIdx) const;
-	void startProcessing();
-	void stopProcessing();
-	void setResults(const QStringList& results);
+    enum {
+        tab_thumbs = 0,
+        tab_text_input,
+        tab_results,
+
+        tab_end
+    };
+
+    DkBatchInput(QWidget *parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
+
+    QString getDir() const;
+    QStringList getSelectedFiles() const;
+    QStringList getSelectedFilesBatch();
+    DkInputTextEdit *getInputEdit() const;
+
+    virtual bool hasUserInput() const override
+    {
+        return mHUserInput;
+    };
+    virtual bool requiresUserInput() const override
+    {
+        return mRUserInput;
+    };
+    virtual void applyDefault() override;
+
+    void changeTab(int tabIdx) const;
+    void startProcessing();
+    void stopProcessing();
+    void setResults(const QStringList &results);
 
 public slots:
-	void setDir(const QString& dirPath);
-	void browse();
-	void updateDir(QVector<QSharedPointer<DkImageContainerT> >);
-	void setVisible(bool visible) override;
-	void parameterChanged();
-	void selectionChanged();
-	void setFileInfo(QFileInfo file);
+    void setDir(const QString &dirPath);
+    void browse();
+    void updateDir(QVector<QSharedPointer<DkImageContainerT>>);
+    void setVisible(bool visible) override;
+    void parameterChanged();
+    void selectionChanged();
+    void setFileInfo(QFileInfo file);
 
 signals:
-	void updateDirSignal(QVector<QSharedPointer<DkImageContainerT> >) const;
-	void newHeaderText(const QString&) const;
-	void updateInputDir(const QString&) const;
-	void changed() const;
+    void updateDirSignal(QVector<QSharedPointer<DkImageContainerT>>) const;
+    void newHeaderText(const QString &) const;
+    void updateInputDir(const QString &) const;
+    void changed() const;
 
 protected:
-	virtual void createLayout();
-
-	QString mCDirPath;
-	QListView* mFileWidget = 0;
-	DkThumbScrollWidget* mThumbScrollWidget = 0;
-	DkInputTextEdit* mInputTextEdit = 0;
-	QTextEdit* mResultTextEdit = 0;
-	DkExplorer* mExplorer = 0;
-	DkDirectoryEdit* mDirectoryEdit = 0;
-	QTabWidget* mInputTabs = 0;
-	QSharedPointer<DkImageLoader> mLoader = QSharedPointer<DkImageLoader>(new DkImageLoader());
+    virtual void createLayout();
+
+    QString mCDirPath;
+    QListView *mFileWidget = 0;
+    DkThumbScrollWidget *mThumbScrollWidget = 0;
+    DkInputTextEdit *mInputTextEdit = 0;
+    QTextEdit *mResultTextEdit = 0;
+    DkExplorer *mExplorer = 0;
+    DkDirectoryEdit *mDirectoryEdit = 0;
+    QTabWidget *mInputTabs = 0;
+    QSharedPointer<DkImageLoader> mLoader = QSharedPointer<DkImageLoader>(new DkImageLoader());
 
 private:
-	bool mHUserInput = false;
-	bool mRUserInput = false;
-
+    bool mHUserInput = false;
+    bool mRUserInput = false;
 };
 
-class DkFilenameWidget : public DkWidget {
-	Q_OBJECT
+class DkFilenameWidget : public DkWidget
+{
+    Q_OBJECT
 
-public:	
-	DkFilenameWidget(QWidget* parent = 0);
-	void enableMinusButton(bool enable);
-	void enablePlusButton(bool enable);
-	bool hasUserInput() const {return hasChanged;};
-	QString getTag() const;
-	bool setTag(const QString& tag);
+public:
+    DkFilenameWidget(QWidget *parent = 0);
+    void enableMinusButton(bool enable);
+    void enablePlusButton(bool enable);
+    bool hasUserInput() const
+    {
+        return hasChanged;
+    };
+    QString getTag() const;
+    bool setTag(const QString &tag);
 
 signals:
-	void plusPressed(DkFilenameWidget*) const;
-	void minusPressed(DkFilenameWidget*) const;
-	void changed() const;
+    void plusPressed(DkFilenameWidget *) const;
+    void minusPressed(DkFilenameWidget *) const;
+    void changed() const;
 
 private slots:
-	void typeCBChanged(int index);
-	void pbPlusPressed();
-	void pbMinusPressed();
-	void checkForUserInput();
-	void digitCBChanged(int index);
+    void typeCBChanged(int index);
+    void pbPlusPressed();
+    void pbMinusPressed();
+    void checkForUserInput();
+    void digitCBChanged(int index);
 
 private:
-	void createLayout();
-	void showOnlyText();
-	void showOnlyNumber();
-	void showOnlyFilename();
+    void createLayout();
+    void showOnlyText();
+    void showOnlyNumber();
+    void showOnlyFilename();
 
-	QComboBox* mCbType = 0;
-		
-	QLineEdit* mLeText = 0;
-	QComboBox* mCbCase = 0;
+    QComboBox *mCbType = 0;
 
-	QSpinBox* mSbNumber = 0;
-	QComboBox* mCbDigits = 0;
-		
-	QPushButton* mPbPlus = 0;
-	QPushButton* mPbMinus = 0;
+    QLineEdit *mLeText = 0;
+    QComboBox *mCbCase = 0;
 
-	QGridLayout* mLayout = 0;
+    QSpinBox *mSbNumber = 0;
+    QComboBox *mCbDigits = 0;
 
-	bool hasChanged = false;
+    QPushButton *mPbPlus = 0;
+    QPushButton *mPbMinus = 0;
+
+    QGridLayout *mLayout = 0;
+
+    bool hasChanged = false;
 };
 
-class DkBatchOutput : public DkWidget, public DkBatchContent {
-Q_OBJECT
+class DkBatchOutput : public DkWidget, public DkBatchContent
+{
+    Q_OBJECT
 
 public:
-	DkBatchOutput(QWidget* parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
-
-	virtual bool hasUserInput() const override;
-	virtual bool requiresUserInput() const override {return mRUserInput;};
-	void applyDefault() override;
-	void loadProperties(const DkBatchConfig& config);
-
-	DkSaveInfo::OverwriteMode overwriteMode() const;
-	int getCompression() const;
-	bool useInputDir() const;
-	bool deleteOriginal() const;
-	QString getOutputDirectory();
-	QString getFilePattern();
-	void loadFilePattern(const QString& pattern);
-	void setExampleFilename(const QString& exampleName);
+    DkBatchOutput(QWidget *parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
+
+    virtual bool hasUserInput() const override;
+    virtual bool requiresUserInput() const override
+    {
+        return mRUserInput;
+    };
+    void applyDefault() override;
+    void loadProperties(const DkBatchConfig &config);
+
+    DkSaveInfo::OverwriteMode overwriteMode() const;
+    int getCompression() const;
+    bool useInputDir() const;
+    bool deleteOriginal() const;
+    QString getOutputDirectory();
+    QString getFilePattern();
+    void loadFilePattern(const QString &pattern);
+    void setExampleFilename(const QString &exampleName);
 
 signals:
-	void newHeaderText(const QString&) const;
-	void changed() const;
+    void newHeaderText(const QString &) const;
+    void changed() const;
 
 public slots:
-	void setInputDir(const QString& dirPath);
+    void setInputDir(const QString &dirPath);
 
 protected slots:
-	void browse();
-	void plusPressed(DkFilenameWidget* widget, const QString& tag = QString());
-	void minusPressed(DkFilenameWidget* widget);
-	void extensionCBChanged(int index);
-	void parameterChanged();
-	void updateFileLabelPreview();
-	void useInputFolderChanged(bool checked);
-	void setDir(const QString& dirPath, bool updateLineEdit = true);
+    void browse();
+    void plusPressed(DkFilenameWidget *widget, const QString &tag = QString());
+    void minusPressed(DkFilenameWidget *widget);
+    void extensionCBChanged(int index);
+    void parameterChanged();
+    void updateFileLabelPreview();
+    void useInputFolderChanged(bool checked);
+    void setDir(const QString &dirPath, bool updateLineEdit = true);
 
 protected:
-	virtual void createLayout();
-	DkFilenameWidget* createFilenameWidget(const QString& tag = QString());
-	void addFilenameWidget(const QString& tag = QString());
+    virtual void createLayout();
+    virtual void updateCBCompression();
+    DkFilenameWidget *createFilenameWidget(const QString &tag = QString());
+    void addFilenameWidget(const QString &tag = QString());
 
 private:
-
-	bool mHUserInput = false;
-	bool mRUserInput = false;
-	QString mOutputDirectory;
-	QString mInputDirectory;
-	QVector<DkFilenameWidget*> mFilenameWidgets;
-	DkDirectoryEdit* mOutputlineEdit = 0;
-	QVBoxLayout* mFilenameVBLayout = 0;
-	QCheckBox* mCbOverwriteExisting = 0;
-	QCheckBox* mCbDoNotSave = 0;
-	QCheckBox* mCbUseInput = 0;
-	QCheckBox* mCbDeleteOriginal = 0;
-	QPushButton* mOutputBrowseButton = 0;
-
-	QComboBox* mCbExtension = 0;
-	QComboBox* mCbNewExtension = 0;
-	QComboBox* mCbCompression = 0;
-	QLabel* mOldFileNameLabel = 0;
-	QLabel* mNewFileNameLabel = 0;
-	QString mExampleName = 0;
-
+    bool mHUserInput = false;
+    bool mRUserInput = false;
+    QString mOutputDirectory;
+    QString mInputDirectory;
+    QVector<DkFilenameWidget *> mFilenameWidgets;
+    DkDirectoryEdit *mOutputlineEdit = 0;
+    QVBoxLayout *mFilenameVBLayout = 0;
+    QCheckBox *mCbOverwriteExisting = 0;
+    QCheckBox *mCbDoNotSave = 0;
+    QCheckBox *mCbUseInput = 0;
+    QCheckBox *mCbDeleteOriginal = 0;
+    QPushButton *mOutputBrowseButton = 0;
+
+    QComboBox *mCbExtension = 0;
+    QComboBox *mCbNewExtension = 0;
+    QComboBox *mCbCompression = 0;
+    QLabel *mOldFileNameLabel = 0;
+    QLabel *mNewFileNameLabel = 0;
+    QString mExampleName = 0;
 };
 
-class DkProfileSummaryWidget : public DkFadeWidget {
-	Q_OBJECT
+class DkProfileSummaryWidget : public DkFadeWidget
+{
+    Q_OBJECT
 
 public:
-	DkProfileSummaryWidget(QWidget* parent = 0);
+    DkProfileSummaryWidget(QWidget *parent = 0);
 
-	void setProfile(const QString& name, const DkBatchConfig& config);
+    void setProfile(const QString &name, const DkBatchConfig &config);
 
 public slots:
-	void on_deleteButton_clicked();
-	void on_updateButton_clicked();
-	void on_exportButton_clicked();
+    void on_deleteButton_clicked();
+    void on_updateButton_clicked();
+    void on_exportButton_clicked();
 
 signals:
-	void deleteCurrentProfile() const;
-	void updateCurrentProfile() const;
-	void exportCurrentProfile() const;
+    void deleteCurrentProfile() const;
+    void updateCurrentProfile() const;
+    void exportCurrentProfile() const;
 
 protected:
-	void createLayout();
+    void createLayout();
 
-	QLabel* mTitle = 0;
-	QLabel* mNumFiles = 0;
-	QLabel* mOutputDir = 0;
-	QLabel* mFunctions = 0;
+    QLabel *mTitle = 0;
+    QLabel *mNumFiles = 0;
+    QLabel *mOutputDir = 0;
+    QLabel *mFunctions = 0;
 };
 
-class DkProfileWidget : public DkWidget, public DkBatchContent {
-	Q_OBJECT
+class DkProfileWidget : public DkWidget, public DkBatchContent
+{
+    Q_OBJECT
 
 public:
-	DkProfileWidget(QWidget* parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
+    DkProfileWidget(QWidget *parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
 
-	//void transferProperties(QSharedPointer<DkResizeBatch> batchResize) const;
-	bool hasUserInput() const override;
-	bool requiresUserInput() const override;
-	void applyDefault() override;
-	void profileSaved(const QString& profileName);
+    // void transferProperties(QSharedPointer<DkResizeBatch> batchResize) const;
+    bool hasUserInput() const override;
+    bool requiresUserInput() const override;
+    void applyDefault() override;
+    void profileSaved(const QString &profileName);
 
 public slots:
-	void on_profileList_itemSelectionChanged();
-	void on_saveButton_clicked();
-	void on_resetButton_clicked();
+    void on_profileList_itemSelectionChanged();
+    void on_saveButton_clicked();
+    void on_resetButton_clicked();
 
-	void updateCurrentProfile();
-	void deleteCurrentProfile();
-	void exportCurrentProfile();
+    void updateCurrentProfile();
+    void deleteCurrentProfile();
+    void exportCurrentProfile();
 
 signals:
-	void newHeaderText(const QString& txt) const;
-	void loadProfileSignal(const QString& profilePath) const;
-	void saveProfileSignal(const QString& profilePath) const;
-	void applyDefaultSignal() const;
+    void newHeaderText(const QString &txt) const;
+    void loadProfileSignal(const QString &profilePath) const;
+    void saveProfileSignal(const QString &profilePath) const;
+    void applyDefaultSignal() const;
 
 protected:
-	void createLayout();
-	void saveProfile();
-	void updateProfileList();
-	void changeProfile(const QString& profileName);
-	QString currentProfile() const;
-	void loadDefaultProfile();
-
-	QListWidget* mProfileList = 0;
-	DkProfileSummaryWidget* mSummary = 0;
+    void createLayout();
+    void saveProfile();
+    void updateProfileList();
+    void changeProfile(const QString &profileName);
+    QString currentProfile() const;
+    void loadDefaultProfile();
+
+    QListWidget *mProfileList = 0;
+    DkProfileSummaryWidget *mSummary = 0;
 };
 
-
 #ifdef WITH_PLUGINS
-class DkBatchPluginWidget : public DkWidget, public DkBatchContent {
-	Q_OBJECT
+class DkBatchPluginWidget : public DkWidget, public DkBatchContent
+{
+    Q_OBJECT
 
 public:
-	DkBatchPluginWidget(QWidget* parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
+    DkBatchPluginWidget(QWidget *parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
 
-	void transferProperties(QSharedPointer<DkPluginBatch> batchPlugin) const;
-	bool loadProperties(QSharedPointer<DkPluginBatch> batchPlugin);
-	bool hasUserInput() const override;
-	bool requiresUserInput() const override;
-	void applyDefault() override;
-	void setSettingsPath(const QString& settingsPath);
+    void transferProperties(QSharedPointer<DkPluginBatch> batchPlugin) const;
+    bool loadProperties(QSharedPointer<DkPluginBatch> batchPlugin);
+    bool hasUserInput() const override;
+    bool requiresUserInput() const override;
+    void applyDefault() override;
+    void setSettingsPath(const QString &settingsPath);
 
 public slots:
-	void itemChanged(QStandardItem * item);
-	void selectionChanged(const QItemSelection &selected);
+    void itemChanged(QStandardItem *item);
+    void selectionChanged(const QItemSelection &selected);
 
-	void changeSetting(const QString& key, const QVariant& value, const QStringList& parentList) const;
-	void removeSetting(const QString& key, const QStringList& parentList) const;
+    void changeSetting(const QString &key, const QVariant &value, const QStringList &parentList) const;
+    void removeSetting(const QString &key, const QStringList &parentList) const;
 
 signals:
-	void newHeaderText(const QString& txt) const;
+    void newHeaderText(const QString &txt) const;
 
 public slots:
-	void updateHeader() const;
+    void updateHeader() const;
 
 protected:
-	void createLayout();
-	void addPlugins(QStandardItemModel* model) const;
-	void selectPlugin(const QString& pluginName);
-	QStringList selectedPlugins(bool selected = true) const;
-	QSharedPointer<QSettings> settings() const;
-
-	QStandardItemModel* mModel = 0;
-	DkSettingsWidget* mSettingsEditor = 0;
-	QLabel* mSettingsTitle = 0;
-	QSharedPointer<QSettings> mSettings;
-	DkBatchPluginInterface* mCurrentPlugin = 0;
+    void createLayout();
+    void addPlugins(QStandardItemModel *model) const;
+    void selectPlugin(const QString &pluginName);
+    QStringList selectedPlugins(bool selected = true) const;
+    QSharedPointer<QSettings> settings() const;
+
+    QStandardItemModel *mModel = 0;
+    DkSettingsWidget *mSettingsEditor = 0;
+    QLabel *mSettingsTitle = 0;
+    QSharedPointer<QSettings> mSettings;
+    DkBatchPluginInterface *mCurrentPlugin = 0;
 };
 #endif
 
-class DkBatchManipulatorWidget : public DkWidget, public DkBatchContent {
-	Q_OBJECT
+class DkBatchManipulatorWidget : public DkWidget, public DkBatchContent
+{
+    Q_OBJECT
 
 public:
-	DkBatchManipulatorWidget(QWidget* parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
+    DkBatchManipulatorWidget(QWidget *parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
 
-	void transferProperties(QSharedPointer<DkManipulatorBatch> batchPlugin) const;
-	bool loadProperties(QSharedPointer<DkManipulatorBatch> batchPlugin);
-	bool hasUserInput() const override;
-	bool requiresUserInput() const override;
-	void applyDefault() override;
-	void setExampleFile(const QString& filePath);
+    void transferProperties(QSharedPointer<DkManipulatorBatch> batchPlugin) const;
+    bool loadProperties(QSharedPointer<DkManipulatorBatch> batchPlugin);
+    bool hasUserInput() const override;
+    bool requiresUserInput() const override;
+    void applyDefault() override;
+    void setExampleFile(const QString &filePath);
 
 public slots:
-	void itemChanged(QStandardItem * item);
-	void selectionChanged(const QItemSelection &selected);
-	void selectManipulator(QSharedPointer<DkBaseManipulator> mpl);
-	void selectManipulator();
+    void itemChanged(QStandardItem *item);
+    void selectionChanged(const QItemSelection &selected);
+    void selectManipulator(QSharedPointer<DkBaseManipulator> mpl);
+    void selectManipulator();
 
 signals:
-	void newHeaderText(const QString& txt) const;
+    void newHeaderText(const QString &txt) const;
 
 public slots:
-	void updateHeader() const;
+    void updateHeader() const;
 
 protected:
-	void createLayout();
-	void addSettingsWidgets(DkManipulatorManager& manager);
-	void setManager(const DkManipulatorManager& manager);
-
-	QStandardItemModel* mModel = 0;
-	DkManipulatorManager mManager;
-	QVector<QWidget*> mMplWidgets;
-	QVBoxLayout* mSettingsLayout = 0;
-	QLabel* mSettingsTitle = 0;
-	QLabel* mPreviewLabel = 0;
-	QString mPreviewPath;
-	QImage mPreview;
-	int mMaxPreview = 300;
+    void createLayout();
+    void addSettingsWidgets(DkManipulatorManager &manager);
+    void setManager(const DkManipulatorManager &manager);
+
+    QStandardItemModel *mModel = 0;
+    DkManipulatorManager mManager;
+    QVector<QWidget *> mMplWidgets;
+    QVBoxLayout *mSettingsLayout = 0;
+    QLabel *mSettingsTitle = 0;
+    QLabel *mPreviewLabel = 0;
+    QString mPreviewPath;
+    QImage mPreview;
+    int mMaxPreview = 300;
 };
 
-class DkBatchTransformWidget : public DkWidget, public DkBatchContent {
-	Q_OBJECT
+class DkBatchTransformWidget : public DkWidget, public DkBatchContent
+{
+    Q_OBJECT
 
 public:
-	DkBatchTransformWidget(QWidget* parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
+    DkBatchTransformWidget(QWidget *parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
 
-	void transferProperties(QSharedPointer<DkBatchTransform> batchTransform) const;
-	bool loadProperties(QSharedPointer<DkBatchTransform> batchTransform);
-	bool hasUserInput() const override;
-	bool requiresUserInput() const override;
-	void applyDefault() override;
+    void transferProperties(QSharedPointer<DkBatchTransform> batchTransform) const;
+    bool loadProperties(QSharedPointer<DkBatchTransform> batchTransform);
+    bool hasUserInput() const override;
+    bool requiresUserInput() const override;
+    void applyDefault() override;
 
 public slots:
-	void updateHeader() const;
-	void modeChanged();
+    void updateHeader() const;
+    void modeChanged();
 
 signals:
-	void newHeaderText(const QString& txt) const;
+    void newHeaderText(const QString &txt) const;
 
 protected:
-	void createLayout();
-	int getAngle() const;
-	QRect cropRect() const;
-
-	QButtonGroup* mRotateGroup = 0;
-	QRadioButton* mRbRotate0 = 0;
-	QRadioButton* mRbRotateLeft = 0;
-	QRadioButton* mRbRotateRight = 0;
-	QRadioButton* mRbRotate180 = 0;
+    void createLayout();
+    int getAngle() const;
+    QRect cropRect() const;
 
-	QCheckBox* mCbCropMetadata = 0;
+    QButtonGroup *mRotateGroup = 0;
+    QRadioButton *mRbRotate0 = 0;
+    QRadioButton *mRbRotateLeft = 0;
+    QRadioButton *mRbRotateRight = 0;
+    QRadioButton *mRbRotate180 = 0;
 
-	QCheckBox* mCbCropRectangle = 0;
-	DkRectWidget* mCropRectWidget = 0;
+    QCheckBox *mCbCropMetadata = 0;
 
-	QComboBox* mResizeComboMode;
-	QComboBox* mResizeComboProperties;
-	QSpinBox* mResizeSbPx;
-	QDoubleSpinBox* mResizeSbPercent;
+    QCheckBox *mCbCropRectangle = 0;
+    DkRectWidget *mCropRectWidget = 0;
 
+    QComboBox *mResizeComboMode;
+    QComboBox *mResizeComboProperties;
+    QSpinBox *mResizeSbPx;
+    QDoubleSpinBox *mResizeSbPercent;
 };
 
-class DkBatchButtonsWidget : public DkFadeWidget {
-	Q_OBJECT
+class DkBatchButtonsWidget : public DkFadeWidget
+{
+    Q_OBJECT
 
 public:
-	DkBatchButtonsWidget(QWidget* parent = 0);
+    DkBatchButtonsWidget(QWidget *parent = 0);
 
-	void setPaused(bool paused = true);
-	QPushButton* logButton();
-	QPushButton* playButton();
+    void setPaused(bool paused = true);
+    QPushButton *logButton();
+    QPushButton *playButton();
 
 signals:
-	void playSignal(bool play = true) const;
-	void showLogSignal() const;
+    void playSignal(bool play = true) const;
+    void showLogSignal() const;
 
 protected:
-	void createLayout();
+    void createLayout();
 
-	QPushButton* mPlayButton = 0;
-	QPushButton* mLogButton = 0;
+    QPushButton *mPlayButton = 0;
+    QPushButton *mLogButton = 0;
 };
 
-class DkBatchInfoWidget : public DkFadeWidget {
-	Q_OBJECT
+class DkBatchInfoWidget : public DkFadeWidget
+{
+    Q_OBJECT
 
 public:
-	DkBatchInfoWidget(QWidget* parent);
+    DkBatchInfoWidget(QWidget *parent);
 
-	enum InfoMode {
-		info_message,
-		info_warning,
-		info_critical,
+    enum InfoMode {
+        info_message,
+        info_warning,
+        info_critical,
 
-		info_end
-	};
+        info_end
+    };
 
 public slots:
-	void setInfo(const QString& message, const DkBatchInfoWidget::InfoMode& mode = DkBatchInfoWidget::InfoMode::info_message);
+    void setInfo(const QString &message, const DkBatchInfoWidget::InfoMode &mode = DkBatchInfoWidget::InfoMode::info_message);
 
 protected:
-	void createLayout();
+    void createLayout();
 
-	QLabel* mInfo = 0;
-	QLabel* mIcon = 0;
+    QLabel *mInfo = 0;
+    QLabel *mIcon = 0;
 };
 
-class DkBatchWidget : public DkFadeWidget {
-	Q_OBJECT
+class DkBatchWidget : public DkFadeWidget
+{
+    Q_OBJECT
 
 public:
-	DkBatchWidget(const QString& currentDirectory = QString(), QWidget* parent = 0);
-	~DkBatchWidget();
+    DkBatchWidget(const QString &currentDirectory = QString(), QWidget *parent = 0);
+    ~DkBatchWidget();
 
-	enum batchWidgets {
-		batch_input,
-		batch_manipulator,
-		batch_transform,
-		batch_plugin,
-		batch_output,
-		batch_profile,
+    enum batchWidgets {
+        batch_input,
+        batch_manipulator,
+        batch_transform,
+        batch_plugin,
+        batch_output,
+        batch_profile,
 
-		batchWidgets_end
-	};
+        batchWidgets_end
+    };
 
-	bool cancel();
+    bool cancel();
 
 public slots:
-	void toggleBatch(bool start);
-	void widgetChanged();
-	void showLog();
-	void processingFinished();
-	void updateProgress(int progress);
-	void updateLog();
-	void setSelectedFiles(const QStringList& selFiles);
-	void changeWidget(DkBatchContainer* widget = 0);
-	void nextTab();
-	void previousTab();
-	void saveProfile(const QString& profilePath) const;
-	void loadProfile(const QString& profilePath);
-	void applyDefault();
+    void toggleBatch(bool start);
+    void widgetChanged();
+    void showLog();
+    void processingFinished();
+    void updateProgress(int progress);
+    void updateLog();
+    void setSelectedFiles(const QStringList &selFiles);
+    void changeWidget(DkBatchContainer *widget = 0);
+    void nextTab();
+    void previousTab();
+    void saveProfile(const QString &profilePath) const;
+    void loadProfile(const QString &profilePath);
+    void applyDefault();
 
 signals:
-	void infoSignal(const QString& message, const DkBatchInfoWidget::InfoMode& mode = DkBatchInfoWidget::InfoMode::info_message) const;
+    void infoSignal(const QString &message, const DkBatchInfoWidget::InfoMode &mode = DkBatchInfoWidget::InfoMode::info_message) const;
 
 protected:
-	void createLayout();
-	DkBatchConfig createBatchConfig(bool strict = true) const;
-	void startProcessing();
-	void stopProcessing();
-	void startBatch();
-	DkBatchInput* inputWidget() const;
-	DkBatchOutput* outputWidget() const;
-	DkBatchManipulatorWidget* manipulatorWidget() const;
-	DkProfileWidget* profileWidget() const;
-	DkBatchTransformWidget* transformWidget() const;
+    void createLayout();
+    DkBatchConfig createBatchConfig(bool strict = true) const;
+    void startProcessing();
+    void stopProcessing();
+    void startBatch();
+    DkBatchInput *inputWidget() const;
+    DkBatchOutput *outputWidget() const;
+    DkBatchManipulatorWidget *manipulatorWidget() const;
+    DkProfileWidget *profileWidget() const;
+    DkBatchTransformWidget *transformWidget() const;
 
 #ifdef WITH_PLUGINS
-	DkBatchPluginWidget* pluginWidget() const;
+    DkBatchPluginWidget *pluginWidget() const;
 #endif
 
-	QVector<DkBatchContainer*> mWidgets;
-		
-	QStackedLayout* mCentralLayout = 0;
-	int mCurrentIndex = 0;
+    QVector<DkBatchContainer *> mWidgets;
+
+    QStackedLayout *mCentralLayout = 0;
+    int mCurrentIndex = 0;
+
+    QString mCurrentDirectory;
 
-	QString mCurrentDirectory;
+    DkBatchProcessing *mBatchProcessing = 0;
 
-	DkBatchProcessing* mBatchProcessing = 0;
+    // info/controls
+    DkBatchInfoWidget *mInfoWidget = 0;
+    DkProgressBar *mProgressBar = 0;
+    DkBatchButtonsWidget *mButtonWidget = 0;
 
-	// info/controls
-	DkBatchInfoWidget* mInfoWidget = 0;
-	DkProgressBar* mProgressBar = 0;
-	DkBatchButtonsWidget* mButtonWidget = 0;
-	
-	QTimer mLogUpdateTimer;
-	bool mLogNeedsUpdate = false;
+    QTimer mLogUpdateTimer;
+    bool mLogNeedsUpdate = false;
 
-	// title
-	QLabel* mContentTitle = 0;
-	QLabel* mContentInfo = 0;
+    // title
+    QLabel *mContentTitle = 0;
+    QLabel *mContentInfo = 0;
 };
 
 }
diff --git a/ImageLounge/src/DkGui/DkCentralWidget.cpp b/ImageLounge/src/DkGui/DkCentralWidget.cpp
index 0c34368..0449558 100644
--- a/ImageLounge/src/DkGui/DkCentralWidget.cpp
+++ b/ImageLounge/src/DkGui/DkCentralWidget.cpp
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkCentralWidget.cpp
  Created on:	14.11.2014
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -27,1205 +27,1125 @@
 
 #include "DkCentralWidget.h"
 
-#include "DkControlWidget.h"
-#include "DkViewPort.h"
-#include "DkMessageBox.h"
-#include "DkThumbsWidgets.h"
-#include "DkThumbs.h"
+#include "DkActionManager.h"
 #include "DkBasicLoader.h"
-#include "DkImageContainer.h"
 #include "DkBatch.h"
-#include "DkUtils.h"
+#include "DkControlWidget.h"
+#include "DkDialog.h"
+#include "DkImageContainer.h"
 #include "DkImageLoader.h"
+#include "DkMessageBox.h"
+#include "DkPreferenceWidgets.h"
 #include "DkSettings.h"
+#include "DkThumbs.h"
+#include "DkThumbsWidgets.h"
+#include "DkUtils.h"
+#include "DkViewPort.h"
 #include "DkWidgets.h"
-#include "DkActionManager.h"
-#include "DkPreferenceWidgets.h"
-#include "DkDialog.h"
-#include "DkCropWidgets.h"
 
 #ifdef WITH_PLUGINS
 #include "DkPluginManager.h"
 #endif
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QFileDialog>
-#include <QClipboard>
-#include <QStackedLayout>
-#include <QMimeData>
-#include <QTabBar>
-#include <QSettings>
-#include <QIcon>
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QApplication>
+#include <QClipboard>
 #include <QDesktopWidget>
 #include <QDragEnterEvent>
-#include <QStandardPaths>
+#include <QFileDialog>
+#include <QIcon>
 #include <QInputDialog>
-#pragma warning(pop)		// no warnings from includes - end
-
-namespace nmc {
-
-DkTabInfo::DkTabInfo(const QSharedPointer<DkImageContainerT> imgC, int idx, QObject* parent) : QObject(parent) {
+#include <QMimeData>
+#include <QSettings>
+#include <QStackedLayout>
+#include <QStandardPaths>
+#include <QTabBar>
+#pragma warning(pop) // no warnings from includes - end
 
-	mImageLoader = QSharedPointer<DkImageLoader>(new DkImageLoader());
+namespace nmc
+{
+DkTabInfo::DkTabInfo(const QSharedPointer<DkImageContainerT> imgC, int idx, QObject *parent)
+    : QObject(parent)
+{
+    mImageLoader = QSharedPointer<DkImageLoader>(new DkImageLoader());
 
-	if (!imgC)
-		deactivate();
-	mImageLoader->setCurrentImage(imgC);
+    if (!imgC)
+        deactivate();
+    mImageLoader->setCurrentImage(imgC);
 
-	if (imgC)
-		mTabMode = tab_single_image;
-	mTabIdx = idx;
-	mFilePath = getFilePath();
+    if (imgC)
+        mTabMode = tab_single_image;
+    mTabIdx = idx;
+    mFilePath = getFilePath();
 }
 
-DkTabInfo::DkTabInfo(TabMode mode, int idx, QObject* parent) : QObject(parent) {
+DkTabInfo::DkTabInfo(TabMode mode, int idx, QObject *parent)
+    : QObject(parent)
+{
+    mImageLoader = QSharedPointer<DkImageLoader>(new DkImageLoader());
+    deactivate();
 
-	mImageLoader = QSharedPointer<DkImageLoader>(new DkImageLoader());
-	deactivate();
-	
-	mTabMode = mode;
-	mTabIdx = idx;
+    mTabMode = mode;
+    mTabIdx = idx;
 }
 
-DkTabInfo::~DkTabInfo() {
-	//qDebug() << "tab at: " << mTabIdx << " released...";
+DkTabInfo::~DkTabInfo()
+{
+    // qDebug() << "tab at: " << mTabIdx << " released...";
 }
 
-bool DkTabInfo::operator ==(const DkTabInfo& o) const {
-
-	return mTabIdx == o.mTabIdx;
+bool DkTabInfo::operator==(const DkTabInfo &o) const
+{
+    return mTabIdx == o.mTabIdx;
 }
 
-void DkTabInfo::loadSettings(const QSettings& settings) {
+void DkTabInfo::loadSettings(const QSettings &settings)
+{
+    QString file = settings.value("tabFileInfo", "").toString();
+    int tabSetting = settings.value("tabMode", tab_single_image).toInt();
 
-	QString file = settings.value("tabFileInfo", "").toString();
-	int tabSetting = settings.value("tabMode", tab_single_image).toInt();
-
-	if(tabSetting < TabMode::tab_end){
-		mTabMode = static_cast<enum TabMode>(tabSetting);
-	}else{
-		mTabMode = tab_single_image;
-	}
+    if (tabSetting < TabMode::tab_end) {
+        mTabMode = static_cast<enum TabMode>(tabSetting);
+    } else {
+        mTabMode = tab_single_image;
+    }
 
-	if (QFileInfo(file).exists())
-		mImageLoader->setCurrentImage(QSharedPointer<DkImageContainerT>(new DkImageContainerT(file)));
+    if (QFileInfo(file).exists())
+        mImageLoader->setCurrentImage(QSharedPointer<DkImageContainerT>(new DkImageContainerT(file)));
 }
 
-void DkTabInfo::saveSettings(QSettings& settings) const {
-
-	QSharedPointer<DkImageContainerT> imgC;
-	if (mImageLoader->getCurrentImage())
-		imgC = mImageLoader->getCurrentImage();
-	else
-		imgC = mImageLoader->getLastImage();
+void DkTabInfo::saveSettings(QSettings &settings) const
+{
+    QSharedPointer<DkImageContainerT> imgC;
+    if (mImageLoader->getCurrentImage())
+        imgC = mImageLoader->getCurrentImage();
+    else
+        imgC = mImageLoader->getLastImage();
 
-	if (imgC)
-		settings.setValue("tabFileInfo", imgC->filePath());
-	settings.setValue("tabMode", mTabMode);
+    if (imgC)
+        settings.setValue("tabFileInfo", imgC->filePath());
+    settings.setValue("tabMode", mTabMode);
 }
 
-void DkTabInfo::setFilePath(const QString& filePath) {
-
-	mImageLoader->setCurrentImage(QSharedPointer<DkImageContainerT>(new DkImageContainerT(filePath)));
-	setMode(tab_single_image);
-	mFilePath = filePath;
+void DkTabInfo::setFilePath(const QString &filePath)
+{
+    mImageLoader->setCurrentImage(QSharedPointer<DkImageContainerT>(new DkImageContainerT(filePath)));
+    setMode(tab_single_image);
+    mFilePath = filePath;
 }
 
-bool DkTabInfo::setDirPath(const QString& dirPath) {
-	
-	QFileInfo di(dirPath);
-	if(!di.isDir())
-		return false;
+bool DkTabInfo::setDirPath(const QString &dirPath)
+{
+    QFileInfo di(dirPath);
+    if (!di.isDir())
+        return false;
 
-	bool dirIsLoaded = mImageLoader->loadDir(dirPath);
-	if(dirIsLoaded) {
-		setMode(tab_thumb_preview);
-		return true;
-	}
+    bool dirIsLoaded = mImageLoader->loadDir(dirPath);
+    if (dirIsLoaded) {
+        setMode(tab_thumb_preview);
+        return true;
+    }
 
-	return false;
+    return false;
 }
 
-QString DkTabInfo::getFilePath() const {
-
-	return (mImageLoader->getCurrentImage()) ? mImageLoader->getCurrentImage()->filePath() : mFilePath;
+QString DkTabInfo::getFilePath() const
+{
+    return (mImageLoader->getCurrentImage()) ? mImageLoader->getCurrentImage()->filePath() : mFilePath;
 }
 
-void DkTabInfo::setTabIdx(int tabIdx) {
-
-	mTabIdx = tabIdx;
+void DkTabInfo::setTabIdx(int tabIdx)
+{
+    mTabIdx = tabIdx;
 }
 
-int DkTabInfo::getTabIdx() const {
-
-	return mTabIdx;
+int DkTabInfo::getTabIdx() const
+{
+    return mTabIdx;
 }
 
-void DkTabInfo::setImage(QSharedPointer<DkImageContainerT> imgC) {
-	
-	mImageLoader->setCurrentImage(imgC);
-	
-	if (imgC)
-		mTabMode = tab_single_image;
-	mFilePath = getFilePath();
-}
+void DkTabInfo::setImage(QSharedPointer<DkImageContainerT> imgC)
+{
+    mImageLoader->setCurrentImage(imgC);
 
-QSharedPointer<DkImageLoader> DkTabInfo::getImageLoader() const {
-
-	return mImageLoader;
+    if (imgC)
+        mTabMode = tab_single_image;
+    mFilePath = getFilePath();
 }
 
-void DkTabInfo::deactivate() {
-
-	activate(false);
+QSharedPointer<DkImageLoader> DkTabInfo::getImageLoader() const
+{
+    return mImageLoader;
 }
 
-void DkTabInfo::activate(bool isActive) {
-	
-	if (mImageLoader)
-		mImageLoader->activate(isActive);
+void DkTabInfo::deactivate()
+{
+    activate(false);
 }
 
-QSharedPointer<DkImageContainerT> DkTabInfo::getImage() const {
+void DkTabInfo::activate(bool isActive)
+{
+    if (mImageLoader)
+        mImageLoader->activate(isActive);
+}
 
-	if (!mImageLoader)
-		return QSharedPointer<DkImageContainerT>();
+QSharedPointer<DkImageContainerT> DkTabInfo::getImage() const
+{
+    if (!mImageLoader)
+        return QSharedPointer<DkImageContainerT>();
 
-	return mImageLoader->getCurrentImage();
+    return mImageLoader->getCurrentImage();
 }
 
-QIcon DkTabInfo::getIcon() {
-	
-	QIcon icon;
+QIcon DkTabInfo::getIcon()
+{
+    QIcon icon;
 
-	if (mTabMode == tab_thumb_preview)
-		return DkImage::loadIcon(":/nomacs/img/rects.svg");
-	else if (mTabMode == tab_recent_files)
-		return DkImage::loadIcon(":/nomacs/img/bars.svg");
-	else if (mTabMode == tab_preferences)
-		return DkImage::loadIcon(":/nomacs/img/settings.svg");
-	else if (mTabMode == tab_batch)
-		return DkImage::loadIcon(":/nomacs/img/batch-processing.svg");
-	else if (mTabMode == tab_crop)
-		return DkImage::loadIcon(":/nomacs/img/crop.svg");
+    if (mTabMode == tab_thumb_preview)
+        return DkImage::loadIcon(":/nomacs/img/rects.svg");
+    else if (mTabMode == tab_recent_files)
+        return DkImage::loadIcon(":/nomacs/img/bars.svg");
+    else if (mTabMode == tab_preferences)
+        return DkImage::loadIcon(":/nomacs/img/settings.svg");
+    else if (mTabMode == tab_batch)
+        return DkImage::loadIcon(":/nomacs/img/batch-processing.svg");
 
-	if (!mImageLoader->getCurrentImage())
-		return icon;
+    if (!mImageLoader->getCurrentImage())
+        return icon;
 
-	QSharedPointer<DkThumbNailT> thumb = mImageLoader->getCurrentImage()->getThumb();
+    QSharedPointer<DkThumbNailT> thumb = mImageLoader->getCurrentImage()->getThumb();
 
-	if (!thumb)
-		return icon;
+    if (!thumb)
+        return icon;
 
-	QImage img = thumb->getImage();
+    QImage img = thumb->getImage();
 
-	if (!img.isNull())
-		icon = QPixmap::fromImage(img);
+    if (!img.isNull())
+        icon = QPixmap::fromImage(img);
 
-	return icon;
+    return icon;
 }
 
-QString DkTabInfo::getTabText() const {
-
+QString DkTabInfo::getTabText() const
+{
+    QString tabText(QObject::tr("New Tab"));
 
-	QString tabText(QObject::tr("New Tab"));
+    if (mTabMode == tab_thumb_preview)
+        return QObject::tr("Thumbnail Preview");
+    else if (mTabMode == tab_recent_files)
+        return QObject::tr("Recent Files");
+    else if (mTabMode == tab_preferences)
+        return QObject::tr("Settings");
+    else if (mTabMode == tab_batch)
+        return QObject::tr("Batch");
 
-	if (mTabMode == tab_thumb_preview)
-		return QObject::tr("Thumbnail Preview");
-	else if (mTabMode == tab_recent_files)
-		return QObject::tr("Recent Files");
-	else if (mTabMode == tab_preferences)
-		return QObject::tr("Settings");
-	else if (mTabMode == tab_batch)
-		return QObject::tr("Batch");
-	else if (mTabMode == tab_crop)
-		return QObject::tr("Crop");
+    QSharedPointer<DkImageContainerT> imgC = mImageLoader->getCurrentImage();
 
-	QSharedPointer<DkImageContainerT> imgC = mImageLoader->getCurrentImage();
+    if (!imgC)
+        imgC = mImageLoader->getLastImage();
 
-	if (!imgC)
-		imgC = mImageLoader->getLastImage();
+    if (imgC) {
+        tabText = QFileInfo(imgC->filePath()).fileName();
 
-	if (imgC) {
-
-		tabText = QFileInfo(imgC->filePath()).fileName();
-		
-		if (imgC->isEdited())
-			tabText += "*";
-	}
+        if (imgC->isEdited())
+            tabText += "*";
+    }
 
-	return tabText;
+    return tabText;
 }
 
-enum DkTabInfo::TabMode DkTabInfo::getMode() const {
-
-	return mTabMode;
+enum DkTabInfo::TabMode DkTabInfo::getMode() const
+{
+    return mTabMode;
 }
 
-void DkTabInfo::setMode(int mode) {
-
-	if(mode < TabMode::tab_end)
-		mTabMode = static_cast<enum TabMode>(mode);
+void DkTabInfo::setMode(int mode)
+{
+    if (mode < TabMode::tab_end)
+        mTabMode = static_cast<enum TabMode>(mode);
 }
 
 // DkCenteralWidget --------------------------------------------------------------------
-DkCentralWidget::DkCentralWidget(QWidget* parent) : DkWidget(parent) {
-
-	setObjectName("DkCentralWidget");
-	createLayout();
-	setAcceptDrops(true);
-
-	DkActionManager& am = DkActionManager::instance();
-	connect(am.action(DkActionManager::menu_view_new_tab), SIGNAL(triggered()), this, SLOT(addTab()));
-	connect(am.action(DkActionManager::menu_view_close_tab), SIGNAL(triggered()), this, SLOT(removeTab()));
-	connect(am.action(DkActionManager::menu_view_close_all_tabs), &QAction::triggered, this, [this]() { clearAllTabs(); });
-	connect(am.action(DkActionManager::menu_view_first_tab), &QAction::triggered, this, [this]() { setActiveTab(0); });
-	connect(am.action(DkActionManager::menu_view_previous_tab), SIGNAL(triggered()), this, SLOT(previousTab()));
-	connect(am.action(DkActionManager::menu_edit_paste), SIGNAL(triggered()), this, SLOT(pasteImage()));
-
-	connect(am.action(DkActionManager::menu_view_goto_tab), &QAction::triggered, this, [this]() {
-		bool ok = false;
-		int idx = QInputDialog::getInt(this, tr("Go to Tab"), tr("Go to tab number: "), getActiveTab()+1, 1, getTabs().count(), 1, &ok);
-
-		if (ok)
-			setActiveTab(idx-1);
-	});
-	connect(am.action(DkActionManager::menu_view_next_tab), SIGNAL(triggered()), this, SLOT(nextTab()));
-	connect(am.action(DkActionManager::menu_view_last_tab), &QAction::triggered, this, [this]() { setActiveTab(getTabs().count()-1); });
-	connect(am.action(DkActionManager::menu_tools_batch), SIGNAL(triggered()), this, SLOT(openBatch()));
-	connect(am.action(DkActionManager::menu_edit_crop), SIGNAL(triggered()), this, SLOT(openCrop()));
-	connect(am.action(DkActionManager::menu_panel_thumbview), SIGNAL(triggered(bool)), this, SLOT(showThumbView(bool)));
+DkCentralWidget::DkCentralWidget(QWidget *parent)
+    : DkWidget(parent)
+{
+    setObjectName("DkCentralWidget");
+    createLayout();
+    setAcceptDrops(true);
+
+    DkActionManager &am = DkActionManager::instance();
+    connect(am.action(DkActionManager::menu_view_new_tab), SIGNAL(triggered()), this, SLOT(addTab()));
+    connect(am.action(DkActionManager::menu_view_close_tab), SIGNAL(triggered()), this, SLOT(removeTab()));
+    connect(am.action(DkActionManager::menu_view_close_all_tabs), &QAction::triggered, this, [this]() {
+        clearAllTabs();
+    });
+    connect(am.action(DkActionManager::menu_view_first_tab), &QAction::triggered, this, [this]() {
+        setActiveTab(0);
+    });
+    connect(am.action(DkActionManager::menu_view_previous_tab), SIGNAL(triggered()), this, SLOT(previousTab()));
+    connect(am.action(DkActionManager::menu_edit_paste), SIGNAL(triggered()), this, SLOT(pasteImage()));
+
+    connect(am.action(DkActionManager::menu_view_goto_tab), &QAction::triggered, this, [this]() {
+        bool ok = false;
+        int idx = QInputDialog::getInt(this, tr("Go to Tab"), tr("Go to tab number: "), getActiveTab() + 1, 1, getTabs().count(), 1, &ok);
+
+        if (ok)
+            setActiveTab(idx - 1);
+    });
+    connect(am.action(DkActionManager::menu_view_next_tab), SIGNAL(triggered()), this, SLOT(nextTab()));
+    connect(am.action(DkActionManager::menu_view_last_tab), &QAction::triggered, this, [this]() {
+        setActiveTab(getTabs().count() - 1);
+    });
+    connect(am.action(DkActionManager::menu_tools_batch), SIGNAL(triggered()), this, SLOT(openBatch()));
+    connect(am.action(DkActionManager::menu_panel_thumbview), SIGNAL(triggered(bool)), this, SLOT(showThumbView(bool)));
 
 #ifdef WITH_PLUGINS
-	if (am.pluginActionManager()) 
-		connect(am.pluginActionManager(), SIGNAL(showViewPort()), this, SLOT(showViewPort()));
+    if (am.pluginActionManager())
+        connect(am.pluginActionManager(), SIGNAL(showViewPort()), this, SLOT(showViewPort()));
 #endif
 
-	// runs in the background & will be deleted with this widget...
-	DkDialogManager* dm = new DkDialogManager(this);
-	dm->setCentralWidget(this);
+    // runs in the background & will be deleted with this widget...
+    DkDialogManager *dm = new DkDialogManager(this);
+    dm->setCentralWidget(this);
 }
 
-DkCentralWidget::~DkCentralWidget() {
+DkCentralWidget::~DkCentralWidget()
+{
 }
 
-void DkCentralWidget::createLayout() {
-	
-	// add actions
-	DkActionManager& am = DkActionManager::instance();
-
-	mTabbar = new QTabBar(this);
-	mTabbar->setShape(QTabBar::RoundedNorth);
-	mTabbar->setElideMode(Qt::TextElideMode::ElideRight);
-	mTabbar->setUsesScrollButtons(true);
-	mTabbar->setTabsClosable(true);
-	mTabbar->setMovable(true);
-	mTabbar->installEventFilter(new TabMiddleMouseCloser([this](int idx) { removeTab(idx); }));
-	mTabbar->hide();
+void DkCentralWidget::createLayout()
+{
+    // add actions
+    DkActionManager &am = DkActionManager::instance();
 
-	mProgressBar = new DkProgressBar(this);
-	mProgressBar->hide();
+    mTabbar = new QTabBar(this);
+    mTabbar->setShape(QTabBar::RoundedNorth);
+    mTabbar->setElideMode(Qt::TextElideMode::ElideRight);
+    mTabbar->setUsesScrollButtons(true);
+    mTabbar->setTabsClosable(true);
+    mTabbar->setMovable(true);
+    mTabbar->installEventFilter(new TabMiddleMouseCloser([this](int idx) {
+        removeTab(idx);
+    }));
+    mTabbar->hide();
 
-	mWidgets.resize(widget_end);
-	mWidgets[viewport_widget] = 0;
-	mWidgets[recent_files_widget] = 0;
-	mWidgets[thumbs_widget] = 0;
-	mWidgets[preference_widget] = 0;
+    mProgressBar = new DkProgressBar(this);
+    mProgressBar->hide();
 
-	QWidget* viewWidget = new QWidget(this);
-	mViewLayout = new QStackedLayout(viewWidget);
+    mWidgets.resize(widget_end);
+    mWidgets[viewport_widget] = 0;
+    mWidgets[recent_files_widget] = 0;
+    mWidgets[thumbs_widget] = 0;
+    mWidgets[preference_widget] = 0;
 
-	QVBoxLayout* vbLayout = new QVBoxLayout(this);
-	vbLayout->setContentsMargins(0,0,0,0);
-	vbLayout->setSpacing(0);
-	vbLayout->addWidget(mTabbar);
-	vbLayout->addWidget(mProgressBar);
-	vbLayout->addWidget(viewWidget);
+    QWidget *viewWidget = new QWidget(this);
+    mViewLayout = new QStackedLayout(viewWidget);
 
-	// connections
-	connect(mTabbar, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged(int)));
-	connect(mTabbar, SIGNAL(tabCloseRequested(int)), this, SLOT(tabCloseRequested(int)));
-	connect(mTabbar, SIGNAL(tabMoved(int, int)), this, SLOT(tabMoved(int, int)));
+    QVBoxLayout *vbLayout = new QVBoxLayout(this);
+    vbLayout->setContentsMargins(0, 0, 0, 0);
+    vbLayout->setSpacing(0);
+    vbLayout->addWidget(mTabbar);
+    vbLayout->addWidget(mProgressBar);
+    vbLayout->addWidget(viewWidget);
 
-	connect(this, SIGNAL(imageHasGPSSignal(bool)), DkActionManager::instance().action(DkActionManager::menu_view_gps_map), SLOT(setEnabled(bool)));
+    // connections
+    connect(mTabbar, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged(int)));
+    connect(mTabbar, SIGNAL(tabCloseRequested(int)), this, SLOT(tabCloseRequested(int)));
+    connect(mTabbar, SIGNAL(tabMoved(int, int)), this, SLOT(tabMoved(int, int)));
 
-	// preferences
-	connect(am.action(DkActionManager::menu_edit_preferences), SIGNAL(triggered()), this, SLOT(openPreferences()));
+    connect(this, SIGNAL(imageHasGPSSignal(bool)), DkActionManager::instance().action(DkActionManager::menu_view_gps_map), SLOT(setEnabled(bool)));
 
+    // preferences
+    connect(am.action(DkActionManager::menu_edit_preferences), SIGNAL(triggered()), this, SLOT(openPreferences()));
 }
 
-void DkCentralWidget::saveSettings(bool saveTabs) const {
-
-	DefaultSettings settings;
-
-	settings.beginGroup(objectName());
-	settings.remove("Tabs");
+void DkCentralWidget::saveSettings(bool saveTabs) const
+{
+    DefaultSettings settings;
 
-	// user wants to store tabs
-	if (saveTabs) {
+    settings.beginGroup(objectName());
+    settings.remove("Tabs");
 
-		settings.beginWriteArray("Tabs");
-
-		for (int idx = 0; idx < mTabInfos.size(); idx++) {
-			settings.setArrayIndex(idx);
-			mTabInfos.at(idx)->saveSettings(settings);
-		}
-		settings.endArray();
-	}
-	settings.endGroup();
+    // user wants to store tabs
+    if (saveTabs) {
+        settings.beginWriteArray("Tabs");
 
+        for (int idx = 0; idx < mTabInfos.size(); idx++) {
+            settings.setArrayIndex(idx);
+            mTabInfos.at(idx)->saveSettings(settings);
+        }
+        settings.endArray();
+    }
+    settings.endGroup();
 }
 
-void DkCentralWidget::loadSettings() {
-
-	QVector<QSharedPointer<DkTabInfo> > tabInfos;
+void DkCentralWidget::loadSettings()
+{
+    QVector<QSharedPointer<DkTabInfo>> tabInfos;
 
-	DefaultSettings settings;
+    DefaultSettings settings;
 
-	settings.beginGroup(objectName());
+    settings.beginGroup(objectName());
 
-	int size = settings.beginReadArray("Tabs");
-	for (int idx = 0; idx < size; idx++) {
-		settings.setArrayIndex(idx);
-
-		QSharedPointer<DkTabInfo> tabInfo = QSharedPointer<DkTabInfo>(new DkTabInfo());
-		tabInfo->loadSettings(settings);
-		tabInfo->setTabIdx(idx);
-		tabInfos.append(tabInfo);
-	}
-
-	settings.endArray();
-	settings.endGroup();
-
-	setTabList(tabInfos);
-
-	if (tabInfos.empty()) {
-		QSharedPointer<DkTabInfo> info = QSharedPointer<DkTabInfo>(new DkTabInfo());
-		info->setMode(DkTabInfo::tab_empty);
-		info->setTabIdx(0);
-		addTab(info);
-	}
-
-}
-
-bool DkCentralWidget::hasViewPort() const {
-	return mWidgets[viewport_widget] != 0;
-}
+    int size = settings.beginReadArray("Tabs");
+    for (int idx = 0; idx < size; idx++) {
+        settings.setArrayIndex(idx);
 
-DkViewPort* DkCentralWidget::getViewPort() const {
-
-	if (!mWidgets[viewport_widget])
-		qWarning() << "danger zone: viewport is queried before its initialization";
+        QSharedPointer<DkTabInfo> tabInfo = QSharedPointer<DkTabInfo>(new DkTabInfo());
+        tabInfo->loadSettings(settings);
+        tabInfo->setTabIdx(idx);
+        tabInfos.append(tabInfo);
+    }
 
-	return dynamic_cast<DkViewPort*>(mWidgets[viewport_widget]);
-}
+    settings.endArray();
+    settings.endGroup();
 
-DkThumbScrollWidget* DkCentralWidget::getThumbScrollWidget() const {
+    setTabList(tabInfos);
 
-	return dynamic_cast<DkThumbScrollWidget*>(mWidgets[thumbs_widget]);
+    if (tabInfos.empty()) {
+        QSharedPointer<DkTabInfo> info = QSharedPointer<DkTabInfo>(new DkTabInfo());
+        info->setMode(DkTabInfo::tab_empty);
+        info->setTabIdx(0);
+        addTab(info);
+    }
 }
 
-void DkCentralWidget::currentTabChanged(int idx) {
-
-	if (idx < 0 || idx >= mTabInfos.size())
-		return;
-
-	updateLoader(mTabInfos.at(idx)->getImageLoader());
-	
-	if (getThumbScrollWidget())
-		getThumbScrollWidget()->clear();
-
-	mTabInfos.at(idx)->activate();
-	QSharedPointer<DkImageContainerT> imgC = mTabInfos.at(idx)->getImage();
-
-	if (imgC && mTabInfos.at(idx)->getMode() == DkTabInfo::tab_single_image) {
-		mTabInfos.at(idx)->getImageLoader()->load(imgC);
-		showViewPort();
-	}
-	else if (mTabInfos.at(idx)->getMode() == DkTabInfo::tab_thumb_preview) {
-		showThumbView();
-	}
-	else if (mTabInfos.at(idx)->getMode() == DkTabInfo::tab_recent_files) {
-		showRecentFiles();
-	}
-	else if (mTabInfos.at(idx)->getMode() == DkTabInfo::tab_preferences) {
-		showPreferences();
-	}
-	else if (mTabInfos.at(idx)->getMode() == DkTabInfo::tab_batch) {
-		showBatch();
-	}
-	else if (mTabInfos.at(idx)->getMode() == DkTabInfo::tab_crop) {
-		showCrop();
-	}
-
+bool DkCentralWidget::hasViewPort() const
+{
+    return mWidgets[viewport_widget] != 0;
 }
 
-void DkCentralWidget::updateLoader(QSharedPointer<DkImageLoader> loader) const {
-	
-	for (int tIdx = 0; tIdx < mTabInfos.size(); tIdx++) {
-
-		QSharedPointer<DkImageLoader> l = mTabInfos.at(tIdx)->getImageLoader();
-
-		if (l != loader)
-			mTabInfos.at(tIdx)->deactivate();
-
-		disconnect(loader.data(), SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)), this, SLOT(imageLoaded(QSharedPointer<DkImageContainerT>)));
-		disconnect(loader.data(), SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)), this, SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)));
-		disconnect(loader.data(), SIGNAL(imageLoadedSignal(QSharedPointer<DkImageContainerT>)), this, SIGNAL(imageLoadedSignal(QSharedPointer<DkImageContainerT>)));
-		disconnect(loader.data(), SIGNAL(imageHasGPSSignal(bool)), this, SIGNAL(imageHasGPSSignal(bool)));
-		disconnect(loader.data(), SIGNAL(updateSpinnerSignalDelayed(bool, int)), this, SLOT(showProgress(bool, int)));
-		disconnect(loader.data(), SIGNAL(loadImageToTab(const QString&)), this, SLOT(loadFileToTab(const QString&)));
-	}
+DkViewPort *DkCentralWidget::getViewPort() const
+{
+    if (!mWidgets[viewport_widget])
+        qWarning() << "danger zone: viewport is queried before its initialization";
 
-	if (!loader)
-		return;
-
-	if (hasViewPort())
-		getViewPort()->setImageLoader(loader);
-	connect(loader.data(), SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)), this, SLOT(imageLoaded(QSharedPointer<DkImageContainerT>)), Qt::UniqueConnection);
-	connect(loader.data(), SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)), this, SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)), Qt::UniqueConnection);
-	connect(loader.data(), SIGNAL(imageLoadedSignal(QSharedPointer<DkImageContainerT>)), this, SIGNAL(imageLoadedSignal(QSharedPointer<DkImageContainerT>)), Qt::UniqueConnection);
-	connect(loader.data(), SIGNAL(imageHasGPSSignal(bool)), this, SIGNAL(imageHasGPSSignal(bool)), Qt::UniqueConnection);
-	connect(loader.data(), SIGNAL(updateSpinnerSignalDelayed(bool, int)), this, SLOT(showProgress(bool, int)), Qt::UniqueConnection);
-	connect(loader.data(), SIGNAL(loadImageToTab(const QString&)), this, SLOT(loadFileToTab(const QString&)), Qt::UniqueConnection);
+    return dynamic_cast<DkViewPort *>(mWidgets[viewport_widget]);
 }
 
-void DkCentralWidget::paintEvent(QPaintEvent *) {
-	
-	QStyleOption opt;
-	opt.init(this);
-	QPainter p(this);
-	style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
+DkThumbScrollWidget *DkCentralWidget::getThumbScrollWidget() const
+{
+    return dynamic_cast<DkThumbScrollWidget *>(mWidgets[thumbs_widget]);
 }
 
-DkPreferenceWidget* DkCentralWidget::createPreferences() {
-
-	// add preference widget ------------------------------
-	DkActionManager& am = DkActionManager::instance();
-	DkPreferenceWidget* pw = new DkPreferenceWidget(this);
-	connect(pw, SIGNAL(restartSignal()), this, SLOT(restart()), Qt::UniqueConnection);
-
-	// add actions
-	pw->addActions(am.viewActions().toList());
-	pw->addActions(am.editActions().toList());
-	pw->addActions(am.helpActions().toList());
-	pw->addActions(am.hiddenActions().toList());
-
-	QSize s(22, 22);
-
-	// general preferences
-	DkPreferenceTabWidget* tab = new DkPreferenceTabWidget(DkImage::loadIcon(":/nomacs/img/settings.svg", s), tr("General"), this);
-	DkGeneralPreference* gp = new DkGeneralPreference(this);
-	tab->setWidget(gp);
-	pw->addTabWidget(tab);
-
-	// display preferences
-	tab = new DkPreferenceTabWidget(DkImage::loadIcon(":/nomacs/img/display.svg", s), tr("Display"), this);
-	DkDisplayPreference* dp = new DkDisplayPreference(this);
-	tab->setWidget(dp);
-	pw->addTabWidget(tab);
-
-	// file preferences
-	tab = new DkPreferenceTabWidget(DkImage::loadIcon(":/nomacs/img/dir.svg", s), tr("File"), this);
-	DkFilePreference* fp = new DkFilePreference(this);
-	tab->setWidget(fp);
-	pw->addTabWidget(tab);
-
-	// file association preferences
-	tab = new DkPreferenceTabWidget(DkImage::loadIcon(":/nomacs/img/nomacs-bg.svg", s), tr("File Associations"), this);
-	DkFileAssociationsPreference* fap = new DkFileAssociationsPreference(this);
-	tab->setWidget(fap);
-	pw->addTabWidget(tab);
-
-	// advanced preferences
-	tab = new DkPreferenceTabWidget(DkImage::loadIcon(":/nomacs/img/advanced-settings.svg", s), tr("Advanced"), this);
-	DkAdvancedPreference* ap = new DkAdvancedPreference(this);
-	tab->setWidget(ap);
-	pw->addTabWidget(tab);
-
-	// file association preferences
-	tab = new DkPreferenceTabWidget(DkImage::loadIcon(":/nomacs/img/sliders.svg", s), tr("Editor"), this);
-	DkEditorPreference* ep = new DkEditorPreference(this);
-	tab->setWidget(ep);
-	pw->addTabWidget(tab);
-
-	// add preference widget ------------------------------
-
-	return pw;
-}
-
-DkRecentFilesWidget * DkCentralWidget::createRecentFiles() {
-	
-	DkActionManager& am = DkActionManager::instance();
-	DkRecentFilesWidget* rw = new DkRecentFilesWidget(this);
-	rw->registerAction(DkActionManager::instance().action(DkActionManager::menu_file_show_recent));
-
-	// add actions
-	rw->addActions(am.fileActions().toList());
-	rw->addActions(am.viewActions().toList());
-	rw->addActions(am.editActions().toList());
-	rw->addActions(am.sortActions().toList());
-	rw->addActions(am.toolsActions().toList());
-	rw->addActions(am.panelActions().toList());
-	rw->addActions(am.syncActions().toList());
-	rw->addActions(am.pluginActions().toList());
-	rw->addActions(am.helpActions().toList());
-	rw->addActions(am.hiddenActions().toList());
-
-	connect(rw, SIGNAL(loadFileSignal(const QString&, bool)), this, SLOT(loadFile(const QString&, bool)));
-	connect(rw, SIGNAL(loadDirSignal(const QString&)), this, SLOT(loadDirToTab(const QString&)));
+void DkCentralWidget::currentTabChanged(int idx)
+{
+    if (idx < 0 || idx >= mTabInfos.size())
+        return;
 
-	return rw;
+    updateLoader(mTabInfos.at(idx)->getImageLoader());
+
+    if (getThumbScrollWidget())
+        getThumbScrollWidget()->clear();
+
+    mTabInfos.at(idx)->activate();
+    QSharedPointer<DkImageContainerT> imgC = mTabInfos.at(idx)->getImage();
+
+    if (imgC && mTabInfos.at(idx)->getMode() == DkTabInfo::tab_single_image) {
+        mTabInfos.at(idx)->getImageLoader()->load(imgC);
+        showViewPort();
+    } else if (mTabInfos.at(idx)->getMode() == DkTabInfo::tab_thumb_preview) {
+        showThumbView();
+    } else if (mTabInfos.at(idx)->getMode() == DkTabInfo::tab_recent_files) {
+        showRecentFiles();
+    } else if (mTabInfos.at(idx)->getMode() == DkTabInfo::tab_preferences) {
+        showPreferences();
+    } else if (mTabInfos.at(idx)->getMode() == DkTabInfo::tab_batch) {
+        showBatch();
+    }
 }
 
-DkThumbScrollWidget* DkCentralWidget::createThumbScrollWidget() {
-
-	DkThumbScrollWidget* thumbScrollWidget = new DkThumbScrollWidget(this);
-	thumbScrollWidget->getThumbWidget()->setBackgroundBrush(DkSettingsManager::param().slideShow().backgroundColor);
-	thumbScrollWidget->registerAction(DkActionManager::instance().action(DkActionManager::menu_panel_thumbview));
-
-	DkActionManager& am = DkActionManager::instance();
-	thumbScrollWidget->addActions(am.fileActions().toList());
-	thumbScrollWidget->addActions(am.viewActions().toList());
-	thumbScrollWidget->addActions(am.editActions().toList());
-	thumbScrollWidget->addActions(am.sortActions().toList());
-	thumbScrollWidget->addActions(am.toolsActions().toList());
-	thumbScrollWidget->addActions(am.panelActions().toList());
-	//thumbScrollWidget->addActions(am.syncActions().toList());
-	thumbScrollWidget->addActions(am.pluginActions().toList());
-	thumbScrollWidget->addActions(am.helpActions().toList());
-	thumbScrollWidget->addActions(am.hiddenActions().toList());
-
-	// thumbnail preview widget
-	connect(thumbScrollWidget->getThumbWidget(), SIGNAL(loadFileSignal(const QString&, bool)), this, SLOT(loadFile(const QString&, bool)));
-	connect(thumbScrollWidget, SIGNAL(batchProcessFilesSignal(const QStringList&)), this, SLOT(openBatch(const QStringList&)));
+void DkCentralWidget::updateLoader(QSharedPointer<DkImageLoader> loader) const
+{
+    for (int tIdx = 0; tIdx < mTabInfos.size(); tIdx++) {
+        QSharedPointer<DkImageLoader> l = mTabInfos.at(tIdx)->getImageLoader();
+
+        if (l != loader)
+            mTabInfos.at(tIdx)->deactivate();
+
+        disconnect(loader.data(), SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)), this, SLOT(imageLoaded(QSharedPointer<DkImageContainerT>)));
+        disconnect(loader.data(),
+                   SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)),
+                   this,
+                   SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)));
+        disconnect(loader.data(),
+                   SIGNAL(imageLoadedSignal(QSharedPointer<DkImageContainerT>)),
+                   this,
+                   SIGNAL(imageLoadedSignal(QSharedPointer<DkImageContainerT>)));
+        disconnect(loader.data(), SIGNAL(imageHasGPSSignal(bool)), this, SIGNAL(imageHasGPSSignal(bool)));
+        disconnect(loader.data(), SIGNAL(updateSpinnerSignalDelayed(bool, int)), this, SLOT(showProgress(bool, int)));
+        disconnect(loader.data(), SIGNAL(loadImageToTab(const QString &)), this, SLOT(loadFileToTab(const QString &)));
+    }
 
-	return thumbScrollWidget;
-}
+    if (!loader)
+        return;
 
-void DkCentralWidget::createViewPort() {
+    if (hasViewPort())
+        getViewPort()->setImageLoader(loader);
+    connect(loader.data(),
+            SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)),
+            this,
+            SLOT(imageLoaded(QSharedPointer<DkImageContainerT>)),
+            Qt::UniqueConnection);
+    connect(loader.data(),
+            SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)),
+            this,
+            SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)),
+            Qt::UniqueConnection);
+    connect(loader.data(),
+            SIGNAL(imageLoadedSignal(QSharedPointer<DkImageContainerT>)),
+            this,
+            SIGNAL(imageLoadedSignal(QSharedPointer<DkImageContainerT>)),
+            Qt::UniqueConnection);
+    connect(loader.data(), SIGNAL(imageHasGPSSignal(bool)), this, SIGNAL(imageHasGPSSignal(bool)), Qt::UniqueConnection);
+    connect(loader.data(), SIGNAL(updateSpinnerSignalDelayed(bool, int)), this, SLOT(showProgress(bool, int)), Qt::UniqueConnection);
+    connect(loader.data(), SIGNAL(loadImageToTab(const QString &)), this, SLOT(loadFileToTab(const QString &)), Qt::UniqueConnection);
+}
+
+void DkCentralWidget::paintEvent(QPaintEvent *)
+{
+    QStyleOption opt;
+    opt.init(this);
+    QPainter p(this);
+    style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
+}
+
+DkPreferenceWidget *DkCentralWidget::createPreferences()
+{
+    // add preference widget ------------------------------
+    DkActionManager &am = DkActionManager::instance();
+    DkPreferenceWidget *pw = new DkPreferenceWidget(this);
+    connect(pw, SIGNAL(restartSignal()), this, SLOT(restart()), Qt::UniqueConnection);
+
+    // add actions
+    pw->addActions(am.viewActions().toList());
+    pw->addActions(am.editActions().toList());
+    pw->addActions(am.helpActions().toList());
+    pw->addActions(am.hiddenActions().toList());
+
+    QSize s(22, 22);
+
+    // general preferences
+    DkPreferenceTabWidget *tab = new DkPreferenceTabWidget(DkImage::loadIcon(":/nomacs/img/settings.svg", s), tr("General"), this);
+    DkGeneralPreference *gp = new DkGeneralPreference(this);
+    tab->setWidget(gp);
+    pw->addTabWidget(tab);
+
+    // display preferences
+    tab = new DkPreferenceTabWidget(DkImage::loadIcon(":/nomacs/img/display.svg", s), tr("Display"), this);
+    DkDisplayPreference *dp = new DkDisplayPreference(this);
+    tab->setWidget(dp);
+    pw->addTabWidget(tab);
+
+    // file preferences
+    tab = new DkPreferenceTabWidget(DkImage::loadIcon(":/nomacs/img/dir.svg", s), tr("File"), this);
+    DkFilePreference *fp = new DkFilePreference(this);
+    tab->setWidget(fp);
+    pw->addTabWidget(tab);
+
+    // file association preferences
+    tab = new DkPreferenceTabWidget(DkImage::loadIcon(":/nomacs/img/nomacs-bg.svg", s), tr("File Associations"), this);
+    DkFileAssociationsPreference *fap = new DkFileAssociationsPreference(this);
+    tab->setWidget(fap);
+    pw->addTabWidget(tab);
+
+    // advanced preferences
+    tab = new DkPreferenceTabWidget(DkImage::loadIcon(":/nomacs/img/advanced-settings.svg", s), tr("Advanced"), this);
+    DkAdvancedPreference *ap = new DkAdvancedPreference(this);
+    tab->setWidget(ap);
+    pw->addTabWidget(tab);
+
+    // file association preferences
+    tab = new DkPreferenceTabWidget(DkImage::loadIcon(":/nomacs/img/sliders.svg", s), tr("Editor"), this);
+    DkEditorPreference *ep = new DkEditorPreference(this);
+    tab->setWidget(ep);
+    pw->addTabWidget(tab);
+
+    // add preference widget ------------------------------
+
+    return pw;
+}
+
+DkRecentFilesWidget *DkCentralWidget::createRecentFiles()
+{
+    DkActionManager &am = DkActionManager::instance();
+    DkRecentFilesWidget *rw = new DkRecentFilesWidget(this);
+    rw->registerAction(DkActionManager::instance().action(DkActionManager::menu_file_show_recent));
+
+    // add actions
+    rw->addActions(am.fileActions().toList());
+    rw->addActions(am.viewActions().toList());
+    rw->addActions(am.editActions().toList());
+    rw->addActions(am.sortActions().toList());
+    rw->addActions(am.toolsActions().toList());
+    rw->addActions(am.panelActions().toList());
+    rw->addActions(am.syncActions().toList());
+    rw->addActions(am.pluginActions().toList());
+    rw->addActions(am.helpActions().toList());
+    rw->addActions(am.hiddenActions().toList());
+
+    connect(rw, SIGNAL(loadFileSignal(const QString &, bool)), this, SLOT(loadFile(const QString &, bool)));
+    connect(rw, SIGNAL(loadDirSignal(const QString &)), this, SLOT(loadDirToTab(const QString &)));
+
+    return rw;
+}
+
+DkThumbScrollWidget *DkCentralWidget::createThumbScrollWidget()
+{
+    DkThumbScrollWidget *thumbScrollWidget = new DkThumbScrollWidget(this);
+    thumbScrollWidget->getThumbWidget()->setBackgroundBrush(DkSettingsManager::param().slideShow().backgroundColor);
+    thumbScrollWidget->registerAction(DkActionManager::instance().action(DkActionManager::menu_panel_thumbview));
+
+    DkActionManager &am = DkActionManager::instance();
+    thumbScrollWidget->addActions(am.fileActions().toList());
+    thumbScrollWidget->addActions(am.viewActions().toList());
+    thumbScrollWidget->addActions(am.editActions().toList());
+    thumbScrollWidget->addActions(am.sortActions().toList());
+    thumbScrollWidget->addActions(am.toolsActions().toList());
+    thumbScrollWidget->addActions(am.panelActions().toList());
+    // thumbScrollWidget->addActions(am.syncActions().toList());
+    thumbScrollWidget->addActions(am.pluginActions().toList());
+    thumbScrollWidget->addActions(am.helpActions().toList());
+    thumbScrollWidget->addActions(am.hiddenActions().toList());
+
+    // thumbnail preview widget
+    connect(thumbScrollWidget->getThumbWidget(), SIGNAL(loadFileSignal(const QString &, bool)), this, SLOT(loadFile(const QString &, bool)));
+    connect(thumbScrollWidget, SIGNAL(batchProcessFilesSignal(const QStringList &)), this, SLOT(openBatch(const QStringList &)));
+
+    return thumbScrollWidget;
+}
+
+void DkCentralWidget::createViewPort()
+{
+    if (hasViewPort()) {
+        qDebug() << "viewport already created...";
+        return;
+    }
 
-	if (hasViewPort()) {
-		qDebug() << "viewport already created...";
-		return;
-	}
+    DkViewPort *vp = 0;
 
-	DkViewPort* vp = 0;
+    if (parent() && parent()->objectName() == "DkNoMacsFrameless")
+        vp = new DkViewPortFrameless(this);
+    else if (parent() && parent()->objectName() == "DkNoMacsContrast")
+        vp = new DkViewPortContrast(this);
+    else
+        vp = new DkViewPort(this);
 
-	if (parent() && parent()->objectName() == "DkNoMacsFrameless")
-		vp = new DkViewPortFrameless(this);
-	else if (parent() && parent()->objectName() == "DkNoMacsContrast")
-		vp = new DkViewPortContrast(this);
-	else
-		vp = new DkViewPort(this);
-	
-	if (mTabbar->currentIndex() != -1)
-		vp->setImageLoader(mTabInfos[mTabbar->currentIndex()]->getImageLoader());
-	connect(vp, SIGNAL(addTabSignal(const QString&)), this, SLOT(addTab(const QString&)));
-	connect(vp, SIGNAL(showProgress(bool, int)), this, SLOT(showProgress(bool, int)));
+    if (mTabbar->currentIndex() != -1)
+        vp->setImageLoader(mTabInfos[mTabbar->currentIndex()]->getImageLoader());
+    connect(vp, SIGNAL(addTabSignal(const QString &)), this, SLOT(addTab(const QString &)));
+    connect(vp, SIGNAL(showProgress(bool, int)), this, SLOT(showProgress(bool, int)));
 
-	mWidgets[viewport_widget] = vp;
-	mViewLayout->insertWidget(viewport_widget, mWidgets[viewport_widget]);
+    mWidgets[viewport_widget] = vp;
+    mViewLayout->insertWidget(viewport_widget, mWidgets[viewport_widget]);
 }
 
-void DkCentralWidget::tabCloseRequested(int idx) {
-
-	if (idx < 0 && idx >= mTabInfos.size())
-		return;
+void DkCentralWidget::tabCloseRequested(int idx)
+{
+    if (idx < 0 && idx >= mTabInfos.size())
+        return;
 
-	removeTab(idx);
+    removeTab(idx);
 }
 
-void DkCentralWidget::tabMoved(int from, int to) {
-
-	QSharedPointer<DkTabInfo> tabInfo = mTabInfos.at(from);
-	mTabInfos.remove(from);
-	mTabInfos.insert(to, tabInfo);
+void DkCentralWidget::tabMoved(int from, int to)
+{
+    QSharedPointer<DkTabInfo> tabInfo = mTabInfos.at(from);
+    mTabInfos.remove(from);
+    mTabInfos.insert(to, tabInfo);
 
-	updateTabIdx();
+    updateTabIdx();
 }
 
-void DkCentralWidget::setTabList(QVector<QSharedPointer<DkTabInfo> > tabInfos, int activeIndex /* = -1 */) {
+void DkCentralWidget::setTabList(QVector<QSharedPointer<DkTabInfo>> tabInfos, int activeIndex /* = -1 */)
+{
+    mTabInfos = tabInfos;
 
-	mTabInfos = tabInfos;
-	
-	for (QSharedPointer<DkTabInfo>& tabInfo : tabInfos)
-		mTabbar->addTab(tabInfo->getTabText());
-	
-	if (activeIndex == -1)
-		activeIndex = tabInfos.size()-1;
+    for (QSharedPointer<DkTabInfo> &tabInfo : tabInfos)
+        mTabbar->addTab(tabInfo->getTabText());
 
-	mTabbar->setCurrentIndex(activeIndex);
+    if (activeIndex == -1)
+        activeIndex = tabInfos.size() - 1;
 
-	if (tabInfos.size() > 1)
-		mTabbar->show();
+    mTabbar->setCurrentIndex(activeIndex);
 
+    if (tabInfos.size() > 1)
+        mTabbar->show();
 }
 
-void DkCentralWidget::addTab(const QString& filePath, int idx /* = -1 */, bool background) {
-
-	QSharedPointer<DkImageContainerT> imgC = QSharedPointer<DkImageContainerT>(new DkImageContainerT(filePath));
-	addTab(imgC, idx, background);
+void DkCentralWidget::addTab(const QString &filePath, int idx /* = -1 */, bool background)
+{
+    QSharedPointer<DkImageContainerT> imgC = QSharedPointer<DkImageContainerT>(new DkImageContainerT(filePath));
+    addTab(imgC, idx, background);
 }
 
-void DkCentralWidget::addTab(QSharedPointer<DkImageContainerT> imgC, int idx /* = -1 */, bool background) {
-
-	if (idx == -1)
-		idx = mTabInfos.size();
+void DkCentralWidget::addTab(QSharedPointer<DkImageContainerT> imgC, int idx /* = -1 */, bool background)
+{
+    if (idx == -1)
+        idx = mTabInfos.size();
 
-	QSharedPointer<DkTabInfo> tabInfo = QSharedPointer<DkTabInfo>(new DkTabInfo(imgC, idx));
-	addTab(tabInfo, background);
+    QSharedPointer<DkTabInfo> tabInfo = QSharedPointer<DkTabInfo>(new DkTabInfo(imgC, idx));
+    addTab(tabInfo, background);
 }
 
-void DkCentralWidget::addTab(QSharedPointer<DkTabInfo> tabInfo, bool background) {
+void DkCentralWidget::addTab(QSharedPointer<DkTabInfo> tabInfo, bool background)
+{
+    mTabInfos.push_back(tabInfo);
+    mTabbar->addTab(tabInfo->getTabText());
 
-	mTabInfos.push_back(tabInfo);
-	mTabbar->addTab(tabInfo->getTabText());
-	
-	if (!background)
-		mTabbar->setCurrentIndex(tabInfo->getTabIdx());
+    if (!background)
+        mTabbar->setCurrentIndex(tabInfo->getTabIdx());
 
-	if (mTabInfos.size() > 1)
-		mTabbar->show();
+    if (mTabInfos.size() > 1)
+        mTabbar->show();
 
-	// TODO: add a plus button
-	//// Create button what must be placed in tabs row
-	//QToolButton* tb = new QToolButton();
-	//tb->setText("+");
-	//// Add empty, not enabled tab to tabWidget
-	//tabbar->addTab("");
-	//tabbar->setTabEnabled(0, false);
-	//// Add tab button to current tab. Button will be enabled, but tab -- not
-	//
-	//tabbar->setTabButton(0, QTabBar::RightSide, tb);
+    // TODO: add a plus button
+    //// Create button what must be placed in tabs row
+    // QToolButton* tb = new QToolButton();
+    // tb->setText("+");
+    //// Add empty, not enabled tab to tabWidget
+    // tabbar->addTab("");
+    // tabbar->setTabEnabled(0, false);
+    //// Add tab button to current tab. Button will be enabled, but tab -- not
+    //
+    // tabbar->setTabButton(0, QTabBar::RightSide, tb);
 }
 
-void DkCentralWidget::removeTab(int tabIdx) {
+void DkCentralWidget::removeTab(int tabIdx)
+{
+    if (tabIdx == -1)
+        tabIdx = mTabbar->currentIndex();
 
-	if (tabIdx == -1)
-		tabIdx = mTabbar->currentIndex();
+    // if user requests close on batch while processing - cancel batch
+    if (mTabInfos[tabIdx]->getMode() == DkTabInfo::tab_batch) {
+        DkBatchWidget *bw = dynamic_cast<DkBatchWidget *>(mWidgets[batch_widget]);
 
-	// if user requests close on batch while processing - cancel batch
-	if (mTabInfos[tabIdx]->getMode() == DkTabInfo::tab_batch) {
-		DkBatchWidget* bw = dynamic_cast<DkBatchWidget*>(mWidgets[batch_widget]);
-
-		if (bw)
-			bw->close();
-	}
-
-	mTabInfos.remove(tabIdx);
-	mTabbar->removeTab(tabIdx);
-	updateTabIdx();
-
-	switchWidget(mTabbar->currentIndex());
-
-	if (mTabInfos.size() == 0) { // Make sure we have at least one tab
-		addTab();
-		imageUpdatedSignal(mTabInfos.at(0)->getImage());
-		return;
-	}
-
-	if (mTabInfos.size() <= 1)
-		mTabbar->hide();
-}
+        if (bw)
+            bw->close();
+    }
 
-void DkCentralWidget::clearAllTabs() {
+    mTabInfos.remove(tabIdx);
+    mTabbar->removeTab(tabIdx);
+    updateTabIdx();
 
-	int count = getTabs().count();
-	for (int idx = 0; idx < count; idx++)
-		removeTab();
-}
+    switchWidget(mTabbar->currentIndex());
 
-void DkCentralWidget::updateTab(QSharedPointer<DkTabInfo> tabInfo) {
+    if (mTabInfos.size() == 0) { // Make sure we have at least one tab
+        addTab();
+        imageUpdatedSignal(mTabInfos.at(0)->getImage());
+        return;
+    }
 
-	//qDebug() << tabInfo->getTabText() << " set at tab location: " << tabInfo->getTabIdx();
-	mTabbar->setTabText(tabInfo->getTabIdx(), tabInfo->getTabText());
-	mTabbar->setTabIcon(tabInfo->getTabIdx(), tabInfo->getIcon());
+    if (mTabInfos.size() <= 1)
+        mTabbar->hide();
 }
 
-void DkCentralWidget::updateTabIdx() {
-
-	for (int idx = 0; idx < mTabInfos.size(); idx++) {
-		mTabInfos[idx]->setTabIdx(idx);
-	}
+void DkCentralWidget::clearAllTabs()
+{
+    int count = getTabs().count();
+    for (int idx = 0; idx < count; idx++)
+        removeTab();
 }
 
-void DkCentralWidget::nextTab() const {
-	int idx = mTabbar->currentIndex();
-	idx++;
-	setActiveTab(idx);
+void DkCentralWidget::updateTab(QSharedPointer<DkTabInfo> tabInfo)
+{
+    // qDebug() << tabInfo->getTabText() << " set at tab location: " << tabInfo->getTabIdx();
+    mTabbar->setTabText(tabInfo->getTabIdx(), tabInfo->getTabText());
+    mTabbar->setTabIcon(tabInfo->getTabIdx(), tabInfo->getIcon());
 }
 
-void DkCentralWidget::previousTab() const {
-	int idx = mTabbar->currentIndex();
-	idx--;
-	setActiveTab(idx);
+void DkCentralWidget::updateTabIdx()
+{
+    for (int idx = 0; idx < mTabInfos.size(); idx++) {
+        mTabInfos[idx]->setTabIdx(idx);
+    }
 }
 
-void DkCentralWidget::setActiveTab(int idx) const {
-	
-	if (mTabInfos.size() < 2)
-		return;
-
-	if (idx < 0)
-		idx = mTabInfos.size() - 1;
-
-	idx %= mTabInfos.size();
-	mTabbar->setCurrentIndex(idx);
+void DkCentralWidget::nextTab() const
+{
+    int idx = mTabbar->currentIndex();
+    idx++;
+    setActiveTab(idx);
 }
 
-int DkCentralWidget::getActiveTab() {
-	return mTabbar->currentIndex();
+void DkCentralWidget::previousTab() const
+{
+    int idx = mTabbar->currentIndex();
+    idx--;
+    setActiveTab(idx);
 }
 
-void DkCentralWidget::imageLoaded(QSharedPointer<DkImageContainerT> img) {
-
-	int idx = mTabbar->currentIndex();
+void DkCentralWidget::setActiveTab(int idx) const
+{
+    if (mTabInfos.size() < 2)
+        return;
 
-	if (idx == -1) {
-		addTab(img, 0);
-	}
-	else if (idx > mTabInfos.size())
-		addTab(img, idx);
-	else {
-		QSharedPointer<DkTabInfo> tabInfo = mTabInfos[idx];
-		tabInfo->setImage(img);
+    if (idx < 0)
+        idx = mTabInfos.size() - 1;
 
-		updateTab(tabInfo);
-		switchWidget(tabInfo->getMode());
-	}
+    idx %= mTabInfos.size();
+    mTabbar->setCurrentIndex(idx);
 }
 
-QVector<QSharedPointer<DkTabInfo> > DkCentralWidget::getTabs() const {
-
-	return mTabInfos;
+int DkCentralWidget::getActiveTab()
+{
+    return mTabbar->currentIndex();
 }
 
-void DkCentralWidget::showThumbView(bool show) {
-
-	if (mTabInfos.empty())
-		return;
-
-	QSharedPointer<DkTabInfo> tabInfo = mTabInfos[mTabbar->currentIndex()];
-
-	if (show) {
-
-		if (!getThumbScrollWidget()) {
-			mWidgets[thumbs_widget] = createThumbScrollWidget();
-			mViewLayout->insertWidget(thumbs_widget, mWidgets[thumbs_widget]);
-		}
-
-		tabInfo->setMode(DkTabInfo::tab_thumb_preview);
-		switchWidget(thumbs_widget);
-		tabInfo->activate();
-		showViewPort(false);
+void DkCentralWidget::imageLoaded(QSharedPointer<DkImageContainerT> img)
+{
+    int idx = mTabbar->currentIndex();
 
-		// should be definitely true
-		if (auto tw = getThumbScrollWidget()) {
-			tw->updateThumbs(tabInfo->getImageLoader()->getImages());
-			tw->getThumbWidget()->setImageLoader(tabInfo->getImageLoader());
+    if (idx == -1) {
+        addTab(img, 0);
+    } else if (idx > mTabInfos.size())
+        addTab(img, idx);
+    else {
+        QSharedPointer<DkTabInfo> tabInfo = mTabInfos[idx];
+        tabInfo->setImage(img);
 
-			if (tabInfo->getImage())
-				tw->getThumbWidget()->ensureVisible(tabInfo->getImage());
-
-			//mViewport->connectLoader(tabInfo->getImageLoader(), false);
-			connect(tw, SIGNAL(updateDirSignal(const QString&)), tabInfo->getImageLoader().data(), SLOT(loadDir(const QString&)), Qt::UniqueConnection);
-			connect(tw, SIGNAL(filterChangedSignal(const QString &)), tabInfo->getImageLoader().data(), SLOT(setFolderFilter(const QString&)), Qt::UniqueConnection);
-		}
-
-	}
-	else {
-
-		if (auto tw = getThumbScrollWidget()) {
-			disconnect(tw, SIGNAL(updateDirSignal(const QString&)), tabInfo->getImageLoader().data(), SLOT(loadDir(const QString&)));
-			disconnect(tw, SIGNAL(filterChangedSignal(const QString &)), tabInfo->getImageLoader().data(), SLOT(setFolderFilter(const QString&)));
-		}
-		//mViewport->connectLoader(tabInfo->getImageLoader(), true);
-		showViewPort(true);	// TODO: this triggers switchWidget - but switchWidget might also trigger showThumbView(false)
-	}
+        updateTab(tabInfo);
+        switchWidget(tabInfo->getMode());
+    }
 }
 
-void DkCentralWidget::showViewPort(bool show /* = true */) {
-
-	if (show) {
-		if (!hasViewPort())
-			createViewPort();
-		
-		switchWidget(mWidgets[viewport_widget]);
-		if (getCurrentImage())
-			getViewPort()->setImage(getCurrentImage()->image());
-	}
-	else if (hasViewPort())
-		getViewPort()->deactivate();
+QVector<QSharedPointer<DkTabInfo>> DkCentralWidget::getTabs() const
+{
+    return mTabInfos;
 }
 
-void DkCentralWidget::showRecentFiles(bool show) {
-
-	if (show) {
-
-		// create the preferences...
-		if (!mWidgets[recent_files_widget]) {
-			mWidgets[recent_files_widget] = createRecentFiles();
-			mViewLayout->insertWidget(recent_files_widget, mWidgets[recent_files_widget]);
-		}
-
-		switchWidget(mWidgets[recent_files_widget]);
-	}
-	else {
-		// toggle back to image
-		showViewPort();
-	}
-}
+void DkCentralWidget::showThumbView(bool show)
+{
+    if (mTabInfos.empty())
+        return;
 
-void DkCentralWidget::openPreferences() {
+    QSharedPointer<DkTabInfo> tabInfo = mTabInfos[mTabbar->currentIndex()];
 
-	// switch to tab if already opened
-	for (QSharedPointer<DkTabInfo> tabInfo : mTabInfos) {
+    if (show) {
+        if (!getThumbScrollWidget()) {
+            mWidgets[thumbs_widget] = createThumbScrollWidget();
+            mViewLayout->insertWidget(thumbs_widget, mWidgets[thumbs_widget]);
+        }
 
-		if (tabInfo->getMode() == DkTabInfo::tab_preferences) {
-			mTabbar->setCurrentIndex(tabInfo->getTabIdx());
-			return;
-		}
-	}
+        tabInfo->setMode(DkTabInfo::tab_thumb_preview);
+        switchWidget(thumbs_widget);
+        tabInfo->activate();
+        showViewPort(false);
+
+        // should be definitely true
+        if (auto tw = getThumbScrollWidget()) {
+            tw->updateThumbs(tabInfo->getImageLoader()->getImages());
+            tw->getThumbWidget()->setImageLoader(tabInfo->getImageLoader());
+
+            if (tabInfo->getImage())
+                tw->getThumbWidget()->ensureVisible(tabInfo->getImage());
+
+            // mViewport->connectLoader(tabInfo->getImageLoader(), false);
+            connect(tw, SIGNAL(updateDirSignal(const QString &)), tabInfo->getImageLoader().data(), SLOT(loadDir(const QString &)), Qt::UniqueConnection);
+            connect(tw,
+                    SIGNAL(filterChangedSignal(const QString &)),
+                    tabInfo->getImageLoader().data(),
+                    SLOT(setFolderFilter(const QString &)),
+                    Qt::UniqueConnection);
+        }
 
-	QSharedPointer<DkTabInfo> info(new DkTabInfo(DkTabInfo::tab_preferences, mTabInfos.size()));
-	addTab(info);
+    } else {
+        if (auto tw = getThumbScrollWidget()) {
+            disconnect(tw, SIGNAL(updateDirSignal(const QString &)), tabInfo->getImageLoader().data(), SLOT(loadDir(const QString &)));
+            disconnect(tw, SIGNAL(filterChangedSignal(const QString &)), tabInfo->getImageLoader().data(), SLOT(setFolderFilter(const QString &)));
+        }
+        // mViewport->connectLoader(tabInfo->getImageLoader(), true);
+        showViewPort(true); // TODO: this triggers switchWidget - but switchWidget might also trigger showThumbView(false)
+    }
 }
 
-void DkCentralWidget::showPreferences(bool show) {
+void DkCentralWidget::showViewPort(bool show /* = true */)
+{
+    if (show) {
+        if (!hasViewPort())
+            createViewPort();
 
-	if (show) {
-
-		// create the preferences...
-		if (!mWidgets[preference_widget]) {
-			mWidgets[preference_widget] = createPreferences();
-			mViewLayout->insertWidget(preference_widget, mWidgets[preference_widget]);
-			connect(mWidgets[preference_widget], SIGNAL(restartSignal()), this, SLOT(restart()), Qt::UniqueConnection);
-		}
-		
-		switchWidget(mWidgets[preference_widget]);
-	}
+        switchWidget(mWidgets[viewport_widget]);
+        if (getCurrentImage())
+            getViewPort()->setImage(getCurrentImage()->image());
+    } else if (hasViewPort())
+        getViewPort()->deactivate();
 }
 
-DkBatchWidget* DkCentralWidget::createBatch() {
-	
-	auto bw = new DkBatchWidget(getCurrentDir(), this);
+void DkCentralWidget::showRecentFiles(bool show)
+{
+    if (show) {
+        // create the preferences...
+        if (!mWidgets[recent_files_widget]) {
+            mWidgets[recent_files_widget] = createRecentFiles();
+            mViewLayout->insertWidget(recent_files_widget, mWidgets[recent_files_widget]);
+        }
 
-	// add actions
-	DkActionManager& am = DkActionManager::instance();
-	bw->addActions(am.viewActions().toList());
-	bw->addActions(am.panelActions().toList());
-	
-	return bw;
+        switchWidget(mWidgets[recent_files_widget]);
+    } else {
+        // toggle back to image
+        showViewPort();
+    }
 }
 
-DkCropViewPort* DkCentralWidget::createCrop() {
-
-	auto cw = new DkCropViewPort(this);
-
-	// add actions
-	DkActionManager& am = DkActionManager::instance();
-	cw->addActions(am.viewActions().toList());
-	cw->addActions(am.editActions().toList());
-	connect(cw, &DkCropViewPort::closeSignal, this, 
-		[&]() {
-			// close crop
-			for (const auto& t : mTabInfos) {
-				if (t->getMode() == DkTabInfo::TabMode::tab_crop) {
-					removeTab(t->getTabIdx());
-				}
-			}
-		});
+void DkCentralWidget::openPreferences()
+{
+    // switch to tab if already opened
+    for (QSharedPointer<DkTabInfo> tabInfo : mTabInfos) {
+        if (tabInfo->getMode() == DkTabInfo::tab_preferences) {
+            mTabbar->setCurrentIndex(tabInfo->getTabIdx());
+            return;
+        }
+    }
 
-	return cw;
+    QSharedPointer<DkTabInfo> info(new DkTabInfo(DkTabInfo::tab_preferences, mTabInfos.size()));
+    addTab(info);
 }
 
-void DkCentralWidget::openBatch(const QStringList& selectedFiles) {
-
-	// switch to tab if already opened
-	for (QSharedPointer<DkTabInfo> tabInfo : mTabInfos) {
-
-		if (tabInfo->getMode() == DkTabInfo::tab_batch) {
-			mTabbar->setCurrentIndex(tabInfo->getTabIdx());
-			return;
-		}
-	}
-
-	QSharedPointer<DkTabInfo> info(new DkTabInfo(DkTabInfo::tab_batch, mTabInfos.size()));
-	addTab(info);
-
-	// create the batch dialog...
-	if (!mWidgets[batch_widget]) {
-		createBatch();
-		mViewLayout->insertWidget(batch_widget, mWidgets[batch_widget]);
-	}
-
-	DkBatchWidget* bw = dynamic_cast<DkBatchWidget*>(mWidgets[batch_widget]);
-
-	if (!bw) {
-		qWarning() << "batch widget is NULL where it should not be!";
-		return;
-	}
+void DkCentralWidget::showPreferences(bool show)
+{
+    if (show) {
+        // create the preferences...
+        if (!mWidgets[preference_widget]) {
+            mWidgets[preference_widget] = createPreferences();
+            mViewLayout->insertWidget(preference_widget, mWidgets[preference_widget]);
+            connect(mWidgets[preference_widget], SIGNAL(restartSignal()), this, SLOT(restart()), Qt::UniqueConnection);
+        }
 
-	bw->setSelectedFiles(selectedFiles);
+        switchWidget(mWidgets[preference_widget]);
+    }
 }
 
-void DkCentralWidget::showBatch(bool show) {
+DkBatchWidget *DkCentralWidget::createBatch()
+{
+    auto bw = new DkBatchWidget(getCurrentDir(), this);
 
-	if (show) {
-		
-		if (!mWidgets[batch_widget]) {
-			mWidgets[batch_widget] = createBatch();
-			mViewLayout->insertWidget(batch_widget, mWidgets[batch_widget]);
-		}
-		
-		switchWidget(mWidgets[batch_widget]);
+    // add actions
+    DkActionManager &am = DkActionManager::instance();
+    bw->addActions(am.viewActions().toList());
+    bw->addActions(am.panelActions().toList());
 
-		mWidgets[batch_widget]->show();
-	}
+    return bw;
 }
 
-void DkCentralWidget::openCrop() {
-
-	auto imgC = getCurrentImage();
-
-	if (!imgC) {
-		qDebug() << "cannot crop if the image is empty...";
-		return;
-	}
-
-	// switch to tab if already opened
-	for (QSharedPointer<DkTabInfo> tabInfo : mTabInfos) {
-
-		if (tabInfo->getMode() == DkTabInfo::tab_batch) {
-			mTabbar->setCurrentIndex(tabInfo->getTabIdx());
-			return;
-		}
-	}
+void DkCentralWidget::openBatch(const QStringList &selectedFiles)
+{
+    // switch to tab if already opened
+    for (QSharedPointer<DkTabInfo> tabInfo : mTabInfos) {
+        if (tabInfo->getMode() == DkTabInfo::tab_batch) {
+            mTabbar->setCurrentIndex(tabInfo->getTabIdx());
+            return;
+        }
+    }
 
-	QSharedPointer<DkTabInfo> info(new DkTabInfo(DkTabInfo::tab_crop, mTabInfos.size()));
-	addTab(info);
+    QSharedPointer<DkTabInfo> info(new DkTabInfo(DkTabInfo::tab_batch, mTabInfos.size()));
+    addTab(info);
 
-	// create the crop dialog...
-	if (!mWidgets[crop_widget]) {
-		createCrop();
-		mViewLayout->insertWidget(crop_widget, mWidgets[crop_widget]);
-	}
+    // create the batch dialog...
+    if (!mWidgets[batch_widget]) {
+        createBatch();
+        mViewLayout->insertWidget(batch_widget, mWidgets[batch_widget]);
+    }
 
-	auto cw = dynamic_cast<DkCropViewPort*>(mWidgets[crop_widget]);
+    DkBatchWidget *bw = dynamic_cast<DkBatchWidget *>(mWidgets[batch_widget]);
 
-	if (!cw) {
-		qWarning() << "batch widget is NULL where it should not be!";
-		return;
-	}
+    if (!bw) {
+        qWarning() << "batch widget is NULL where it should not be!";
+        return;
+    }
 
-	cw->setImageContainer(imgC);
+    bw->setSelectedFiles(selectedFiles);
 }
 
-void DkCentralWidget::showCrop(bool show) {
-
-	if (show) {
-
-		if (!mWidgets[crop_widget]) {
-			mWidgets[crop_widget] = createCrop();
-			mViewLayout->insertWidget(crop_widget, mWidgets[crop_widget]);
-		}
+void DkCentralWidget::showBatch(bool show)
+{
+    if (show) {
+        if (!mWidgets[batch_widget]) {
+            mWidgets[batch_widget] = createBatch();
+            mViewLayout->insertWidget(batch_widget, mWidgets[batch_widget]);
+        }
 
-		switchWidget(mWidgets[crop_widget]);
+        switchWidget(mWidgets[batch_widget]);
 
-		mWidgets[crop_widget]->show();
-	}
+        mWidgets[batch_widget]->show();
+    }
 }
 
-void DkCentralWidget::showTabs(bool show) {
+void DkCentralWidget::showTabs(bool show)
+{
+    if (show && mTabInfos.size() > 1)
+        mTabbar->show();
+    else
+        mTabbar->hide();
+}
+
+void DkCentralWidget::switchWidget(int widget)
+{
+    if (widget == DkTabInfo::tab_single_image)
+        switchWidget(mWidgets[viewport_widget]);
+    else if (widget == DkTabInfo::tab_thumb_preview)
+        switchWidget(mWidgets[thumbs_widget]);
+    else if (widget == DkTabInfo::tab_preferences)
+        switchWidget(mWidgets[preference_widget]);
+    else if (widget == DkTabInfo::tab_recent_files)
+        switchWidget(mWidgets[recent_files_widget]);
+    else if (widget == DkTabInfo::tab_batch)
+        switchWidget(mWidgets[batch_widget]);
+    else
+        qDebug() << "Sorry, I cannot switch to widget: " << widget;
+}
+
+void DkCentralWidget::switchWidget(QWidget *widget)
+{
+    if (mViewLayout->currentWidget() == widget && mTabInfos[mTabbar->currentIndex()]->getMode() != DkTabInfo::tab_empty)
+        return;
 
-	if (show && mTabInfos.size() > 1)
-		mTabbar->show();
-	else
-		mTabbar->hide();
+    if (widget)
+        mViewLayout->setCurrentWidget(widget);
+    else
+        mViewLayout->setCurrentWidget(mWidgets[viewport_widget]);
+
+    if (!mTabInfos.isEmpty()) {
+        int mode = DkTabInfo::tab_single_image;
+
+        if (widget == mWidgets[thumbs_widget])
+            mode = DkTabInfo::tab_thumb_preview;
+        else if (widget == mWidgets[recent_files_widget])
+            mode = DkTabInfo::tab_recent_files;
+        else if (widget == mWidgets[preference_widget])
+            mode = DkTabInfo::tab_preferences;
+        else if (widget == mWidgets[batch_widget])
+            mode = DkTabInfo::tab_batch;
+
+        mTabInfos[mTabbar->currentIndex()]->setMode(mode);
+        updateTab(mTabInfos[mTabbar->currentIndex()]);
+    }
 }
 
-void DkCentralWidget::switchWidget(int widget) {
+int DkCentralWidget::currentViewMode() const
+{
+    if (mTabInfos.empty())
+        return DkTabInfo::tab_empty;
 
-	if (widget == DkTabInfo::tab_single_image)
-		switchWidget(mWidgets[viewport_widget]);
-	else if (widget == DkTabInfo::tab_thumb_preview)
-		switchWidget(mWidgets[thumbs_widget]);
-	else if (widget == DkTabInfo::tab_preferences)
-		switchWidget(mWidgets[preference_widget]);
-	else if (widget == DkTabInfo::tab_recent_files)
-		switchWidget(mWidgets[recent_files_widget]);
-	else if (widget == DkTabInfo::tab_batch)
-		switchWidget(mWidgets[batch_widget]);
-	else
-		qDebug() << "Sorry, I cannot switch to widget: " << widget;
+    return mTabInfos[mTabbar->currentIndex()]->getMode();
 }
 
-void DkCentralWidget::switchWidget(QWidget* widget) {
-
-	if (mViewLayout->currentWidget() == widget && 
-		mTabInfos[mTabbar->currentIndex()]->getMode() != DkTabInfo::tab_empty)
-		return;
+void DkCentralWidget::restart() const
+{
+    // safe settings first - since the intention of a restart is often a global settings change
+    DkSettingsManager::param().save();
 
-	// crop tab is always closed if focus is lost
-	if (mViewLayout->currentWidget() == mWidgets[crop_widget]) {
+    QString exe = QApplication::applicationFilePath();
+    QStringList args;
 
-		auto cw = dynamic_cast<DkCropViewPort*>(mWidgets[crop_widget]);
-		cw->askBeforeClose();
-	}
+    if (getCurrentImage())
+        args.append(getCurrentImage()->filePath());
 
-	if (widget)
-		mViewLayout->setCurrentWidget(widget);
-	else
-		mViewLayout->setCurrentWidget(mWidgets[viewport_widget]);
+    QProcess p;
+    bool started = p.startDetached(exe, args);
 
-	if (!mTabInfos.isEmpty()) {
-		
-		int mode = DkTabInfo::tab_single_image;
-
-		if (widget == mWidgets[thumbs_widget])
-			mode = DkTabInfo::tab_thumb_preview;
-		else if (widget == mWidgets[recent_files_widget])
-			mode = DkTabInfo::tab_recent_files;
-		else if (widget == mWidgets[preference_widget])
-			mode = DkTabInfo::tab_preferences;
-		else if (widget == mWidgets[batch_widget])
-			mode = DkTabInfo::tab_batch;
-		else if (widget == mWidgets[crop_widget])
-			mode = DkTabInfo::tab_crop;
-
-		mTabInfos[mTabbar->currentIndex()]->setMode(mode);
-		updateTab(mTabInfos[mTabbar->currentIndex()]);
-	}
+    // close me if the new instance started
+    if (started)
+        QApplication::closeAllWindows();
 }
 
-int DkCentralWidget::currentViewMode() const {
-
-	if (mTabInfos.empty())
-		return DkTabInfo::tab_empty;
-
-	return mTabInfos[mTabbar->currentIndex()]->getMode();
+void DkCentralWidget::showProgress(bool show, int time)
+{
+    mProgressBar->setVisibleTimed(show, time);
 }
 
-void DkCentralWidget::restart() const {
-
-	// safe settings first - since the intention of a restart is often a global settings change
-	DkSettingsManager::param().save();
-
-	QString exe = QApplication::applicationFilePath();
-	QStringList args;
-
-	if (getCurrentImage())
-		args.append(getCurrentImage()->filePath());
-
-	QProcess p;
-	bool started = p.startDetached(exe, args);
-
-	// close me if the new instance started
-	if (started)
-		QApplication::closeAllWindows();
+void DkCentralWidget::startSlideshow(bool start) const
+{
+    getViewPort()->getController()->startSlideshow(start);
 }
 
-void DkCentralWidget::showProgress(bool show, int time) {
+void DkCentralWidget::setInfo(const QString &msg) const
+{
+    if (hasViewPort())
+        getViewPort()->getController()->setInfo(msg);
 
-	mProgressBar->setVisibleTimed(show, time);
+    qInfo() << msg;
 }
 
-void DkCentralWidget::startSlideshow(bool start) const {
+QSharedPointer<DkImageContainerT> DkCentralWidget::getCurrentImage() const
+{
+    if (mTabInfos.empty())
+        return QSharedPointer<DkImageContainerT>();
 
-	getViewPort()->getController()->startSlideshow(start);
+    return mTabInfos[mTabbar->currentIndex()]->getImage();
 }
 
-void DkCentralWidget::setInfo(const QString & msg) const {
+QString DkCentralWidget::getCurrentFilePath() const
+{
+    if (!getCurrentImage())
+        return QString();
 
-	if (hasViewPort())
-		getViewPort()->getController()->setInfo(msg);
-	
-	qInfo() << msg;
+    return getCurrentImage()->filePath();
 }
 
-QSharedPointer<DkImageContainerT> DkCentralWidget::getCurrentImage() const {
-
-	if (mTabInfos.empty())
-		return QSharedPointer<DkImageContainerT>();
+QSharedPointer<DkImageLoader> DkCentralWidget::getCurrentImageLoader() const
+{
+    if (mTabInfos.empty())
+        return QSharedPointer<DkImageLoader>();
 
-	return mTabInfos[mTabbar->currentIndex()]->getImage();
+    return mTabInfos[mTabbar->currentIndex()]->getImageLoader();
 }
 
-QString DkCentralWidget::getCurrentFilePath() const {
+bool DkCentralWidget::requestClose() const
+{
+    if (hasViewPort())
+        return getViewPort()->unloadImage(true);
 
-	if (!getCurrentImage())
-		return QString();
-
-	return getCurrentImage()->filePath();
+    return true;
 }
 
-QSharedPointer<DkImageLoader> DkCentralWidget::getCurrentImageLoader() const {
+QString DkCentralWidget::getCurrentDir() const
+{
+    QString cDir = mTabInfos[mTabbar->currentIndex()]->getImageLoader()->getDirPath();
 
-	if (mTabInfos.empty())
-		return QSharedPointer<DkImageLoader>();
+    // load the picture folder if there is no recent directory
+    if (cDir.isEmpty())
+        cDir = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
 
-	return mTabInfos[mTabbar->currentIndex()]->getImageLoader();
-}
-
-bool DkCentralWidget::requestClose() const {
-	
-	if (hasViewPort())
-		return getViewPort()->unloadImage(true);
-	
-	return true;
-}
-
-QString DkCentralWidget::getCurrentDir() const {
-
-	QString cDir = mTabInfos[mTabbar->currentIndex()]->getImageLoader()->getDirPath();
-
-	// load the picture folder if there is no recent directory
-	if (cDir.isEmpty())
-		cDir = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
-
-	return cDir;
+    return cDir;
 }
 
 // DropEvents --------------------------------------------------------------------
-void DkCentralWidget::dragEnterEvent(QDragEnterEvent *event) {
+void DkCentralWidget::dragEnterEvent(QDragEnterEvent *event)
+{
+    printf("[DkCentralWidget] drag enter event\n");
 
-	printf("[DkCentralWidget] drag enter event\n");
-
-	if (event->mimeData()->hasUrls() ||
-		event->mimeData()->hasImage()) {
-		event->acceptProposedAction();
-	}
-	QWidget::dragEnterEvent(event);
+    if (event->mimeData()->hasUrls() || event->mimeData()->hasImage()) {
+        event->acceptProposedAction();
+    }
+    QWidget::dragEnterEvent(event);
 }
 
-void DkCentralWidget::loadDir(const QString& filePath) {
-
-	if (mTabInfos[mTabbar->currentIndex()]->getMode() == DkTabInfo::tab_thumb_preview && getThumbScrollWidget())
-		getThumbScrollWidget()->setDir(filePath);
-	else {
-		if (!hasViewPort())
-			createViewPort();
-		getViewPort()->loadFile(filePath);
-	}
+void DkCentralWidget::loadDir(const QString &filePath)
+{
+    if (mTabInfos[mTabbar->currentIndex()]->getMode() == DkTabInfo::tab_thumb_preview && getThumbScrollWidget())
+        getThumbScrollWidget()->setDir(filePath);
+    else {
+        if (!hasViewPort())
+            createViewPort();
+        getViewPort()->loadFile(filePath);
+    }
 }
 
-void DkCentralWidget::loadFileToTab(const QString& filePath) {
-
-	loadFile(filePath, true);
+void DkCentralWidget::loadFileToTab(const QString &filePath)
+{
+    loadFile(filePath, true);
 }
 
-void DkCentralWidget::loadFile(const QString& filePath, bool newTab) {
-
-	if (!newTab) {
+void DkCentralWidget::loadFile(const QString &filePath, bool newTab)
+{
+    if (!newTab) {
+        if (!hasViewPort())
+            createViewPort();
 
-		if (!hasViewPort())
-			createViewPort();
-
-		getViewPort()->loadFile(filePath);
-		return;
-	}
+        getViewPort()->loadFile(filePath);
+        return;
+    }
 
     // no tab to reuse -> create a new tab
     addTab(filePath, -1, mTabInfos.size() > 0);
@@ -1235,213 +1155,194 @@ void DkCentralWidget::loadFile(const QString& filePath, bool newTab) {
  * @brief loadDirToTab loads a directory path into the current tab.
  * @param dirPath the directory to load
  */
-void DkCentralWidget::loadDirToTab(const QString& dirPath) {
-
-    if (mTabInfos.size() > 1 ||
-        (!mTabInfos.empty()
-         && mTabInfos.at(0)->getMode() != DkTabInfo::tab_empty
-         && mTabInfos.at(0)->getMode() != DkTabInfo::tab_recent_files
-         && mTabInfos.at(0)->getMode() != DkTabInfo::tab_single_image
-         && mTabInfos.at(0)->getMode() != DkTabInfo::tab_thumb_preview)) {
-
+void DkCentralWidget::loadDirToTab(const QString &dirPath)
+{
+    if (mTabInfos.size() > 1
+        || (!mTabInfos.empty() && mTabInfos.at(0)->getMode() != DkTabInfo::tab_empty && mTabInfos.at(0)->getMode() != DkTabInfo::tab_recent_files
+            && mTabInfos.at(0)->getMode() != DkTabInfo::tab_single_image && mTabInfos.at(0)->getMode() != DkTabInfo::tab_thumb_preview)) {
         addTab();
     }
 
     QSharedPointer<DkTabInfo> targetTab = mTabInfos[mTabbar->currentIndex()];
-	QFileInfo di(dirPath);
+    QFileInfo di(dirPath);
 
-	if(di.isDir()) {
-		//try to load the dir
-		bool dirIsLoaded = targetTab->setDirPath(dirPath);
+    if (di.isDir()) {
+        // try to load the dir
+        bool dirIsLoaded = targetTab->setDirPath(dirPath);
 
-        if(dirIsLoaded){
-            //show the directory in overview mode
+        if (dirIsLoaded) {
+            // show the directory in overview mode
             targetTab->setMode(DkTabInfo::tab_thumb_preview);
             showThumbView();
             return;
         }
     }
 
-	setInfo(tr("I could not load \"%1\"").arg(dirPath));
+    setInfo(tr("I could not load \"%1\"").arg(dirPath));
 }
 
 /** loadUrls() loads a list of valid urls.
  * @param maxUrlsToLoad determines the maximum
  */
-void DkCentralWidget::loadUrls(const QList<QUrl>& urls, int maxUrlsToLoad) {
-    
-	if(urls.size() == 0)
+void DkCentralWidget::loadUrls(const QList<QUrl> &urls, int maxUrlsToLoad)
+{
+    if (urls.size() == 0)
         return;
 
-    if(urls.size() > maxUrlsToLoad)
-		qWarning() << "Too many urls found, I will only load the first" << maxUrlsToLoad;
+    if (urls.size() > maxUrlsToLoad)
+        qWarning() << "Too many urls found, I will only load the first" << maxUrlsToLoad;
 
-	if (urls.size() == 1)
-		loadUrl(urls[0], false);
-	else {
-
-		for (const QUrl& url : urls)
-			loadUrl(url, true);
-	}
+    if (urls.size() == 1)
+        loadUrl(urls[0], false);
+    else {
+        for (const QUrl &url : urls)
+            loadUrl(url, true);
+    }
 }
 
 /** loadUrl() loads a single valid url
-*  @param loadInTab: if true, replace the currently active image, so it exists.
-*/
-void DkCentralWidget::loadUrl(const QUrl& url, bool newTab) {
-	Q_ASSERT(url.isValid());
-
-	QString fp = url.toString();
-
-	// allow drops from VSCode (i.e. images in README files)
-	if (fp.startsWith("vscode-resource:/"))
-		fp = fp.remove("vscode-resource:/");
-
-	// url.toString fixes windows "C:/" vs "C:\"
-	QFileInfo fi(fp);
-
-	if (!fi.exists()) {
-		fi = QFileInfo(url.toLocalFile());
-	}
-
-	auto display = [&](QString msg) {
-		setInfo(msg);
-	};
-
-	if (fi.exists()) {
-
-		if (fi.isFile()) {
-			
-			// load a local file
-			if (DkUtils::isValid(fi)) {
-				loadFile(fi.filePath(), newTab);
-			}
-			else {
-				display(tr("Unable to load file \"%1\"").arg(fi.canonicalPath()));
-			}
-		}
-		else if (fi.isDir()) {
-			// load a directory as thmbnail view
-			loadDirToTab(fi.filePath());
-		}
-		else {
-			display(tr("\"%1\" cannot be loaded").arg(fi.canonicalPath()));
-		}
-	}
-	else {
-
-        // is this the right way to do it?
-		addTab();
+ *  @param loadInTab: if true, replace the currently active image, so it exists.
+ */
+void DkCentralWidget::loadUrl(const QUrl &url, bool newTab)
+{
+    Q_ASSERT(url.isValid());
 
-		//load a remote url
-		QSharedPointer<DkTabInfo> targetTab = mTabInfos[mTabbar->currentIndex()];
-		display(tr("downloading \"%1\"").arg(url.toDisplayString()));
-		targetTab->getImageLoader()->downloadFile(url);
-	}
-}
+    QString fp = url.toString();
 
-void DkCentralWidget::pasteImage() {
+    // allow drops from VSCode (i.e. images in README files)
+    if (fp.startsWith("vscode-resource:/"))
+        fp = fp.remove("vscode-resource:/");
 
-	qDebug() << "pasting...";
+    // url.toString fixes windows "C:/" vs "C:\"
+    QFileInfo fi(fp);
 
-	QClipboard* clipboard = QApplication::clipboard();
+    if (!fi.exists()) {
+        fi = QFileInfo(url.toLocalFile());
+    }
 
-	if (!loadFromMime(clipboard->mimeData()))
-		setInfo("Clipboard has no image...");
+    auto display = [&](QString msg) {
+        setInfo(msg);
+    };
+
+    if (fi.exists()) {
+        if (fi.isFile()) {
+            // load a local file
+            if (DkUtils::isValid(fi)) {
+                loadFile(fi.filePath(), newTab);
+            } else {
+                display(tr("Unable to load file \"%1\"").arg(fi.canonicalPath()));
+            }
+        } else if (fi.isDir()) {
+            // load a directory as thmbnail view
+            loadDirToTab(fi.filePath());
+        } else {
+            display(tr("\"%1\" cannot be loaded").arg(fi.canonicalPath()));
+        }
+    } else {
+        // is this the right way to do it?
+        addTab();
 
+        // load a remote url
+        QSharedPointer<DkTabInfo> targetTab = mTabInfos[mTabbar->currentIndex()];
+        display(tr("downloading \"%1\"").arg(url.toDisplayString()));
+        targetTab->getImageLoader()->downloadFile(url);
+    }
 }
 
-void DkCentralWidget::dropEvent(QDropEvent *event) {
+void DkCentralWidget::pasteImage()
+{
+    qDebug() << "pasting...";
 
-	if (event->source() == this || (hasViewPort() && event->source() == getViewPort())) {
-		event->accept();
-		return;
-	}
+    QClipboard *clipboard = QApplication::clipboard();
 
-	if (!loadFromMime(event->mimeData()))
-		setInfo(tr("Sorry, I could not drop the content."));
+    if (!loadFromMime(clipboard->mimeData()))
+        setInfo("Clipboard has no image...");
 }
 
+void DkCentralWidget::dropEvent(QDropEvent *event)
+{
+    if (event->source() == this || (hasViewPort() && event->source() == getViewPort())) {
+        event->accept();
+        return;
+    }
 
-bool DkCentralWidget::loadFromMime(const QMimeData* mimeData) {
+    if (!loadFromMime(event->mimeData()))
+        setInfo(tr("Sorry, I could not drop the content."));
+}
 
+bool DkCentralWidget::loadFromMime(const QMimeData *mimeData)
+{
     if (!mimeData)
         return false;
 
-	if (!hasViewPort())
-		createViewPort();
+    if (!hasViewPort())
+        createViewPort();
 
     QStringList mimeFmts = mimeData->formats();
 
-	// try to load an image
-	QImage dropImg;
+    // try to load an image
+    QImage dropImg;
 
-	// first see if we have MS mime data
-	// since i.e. outlook also add thumbnails, we try to first load the high quality stuff
-	for (const QString& fmt : mimeFmts) {
-	
-		//qDebugClean() << "mime format:" << fmt << " " << mimeData->data(fmt).size()/1024.0 << "KB";
+    // first see if we have MS mime data
+    // since i.e. outlook also add thumbnails, we try to first load the high quality stuff
+    for (const QString &fmt : mimeFmts) {
+        // qDebugClean() << "mime format:" << fmt << " " << mimeData->data(fmt).size()/1024.0 << "KB";
 
-		if (fmt.contains("Office Drawing Shape Format")) {
+        if (fmt.contains("Office Drawing Shape Format")) {
+            // try to get rid of all decorations
+            QSharedPointer<QByteArray> ba(new QByteArray(DkImage::extractImageFromDataStream(mimeData->data(fmt))));
 
-			// try to get rid of all decorations
-			QSharedPointer<QByteArray> ba(new QByteArray(DkImage::extractImageFromDataStream(mimeData->data(fmt))));
+            if (!ba->isEmpty()) {
+                DkBasicLoader bl;
+                bl.loadGeneral("", ba);
 
-			if (!ba->isEmpty()) {
-				DkBasicLoader bl;
-				bl.loadGeneral("", ba);
+                dropImg = bl.image();
 
-				dropImg = bl.image();
-
-				if (!dropImg.isNull())
-					qDebug() << "image loaded from MS data";
-				break;
-			}
-		}
-	}
+                if (!dropImg.isNull())
+                    qDebug() << "image loaded from MS data";
+                break;
+            }
+        }
+    }
 
     // parse mime data. get a non-empty list of urls. url is the first.
     QList<QUrl> urls;
 
-	if (mimeFmts.contains("text/uri-list")) {
-		//we got a list of uris
-		//mimeData has both urls and text (empty string. at least for dolphin 16.04.3)
-		for (QUrl u : mimeData->urls()) {
-
-			QFileInfo f = DkUtils::urlToLocalFile(u);
+    if (mimeFmts.contains("text/uri-list")) {
+        // we got a list of uris
+        // mimeData has both urls and text (empty string. at least for dolphin 16.04.3)
+        for (QUrl u : mimeData->urls()) {
+            QFileInfo f = DkUtils::urlToLocalFile(u);
 
-			if (u.isValid() && DkUtils::isValid(f))
-				urls.append(u);
-		}
-	}
-    else if (mimeData->formats().contains("text/plain")) {
-        //we got text data. maybe it is a list of urls
+            if (u.isValid() && DkUtils::isValid(f))
+                urls.append(u);
+        }
+    } else if (mimeData->formats().contains("text/plain")) {
+        // we got text data. maybe it is a list of urls
         urls = DkUtils::findUrlsInTextNewline(mimeData->text());
     }
-	// load from image buffer
-	else if (dropImg.isNull() && mimeData->hasImage()) {
-		// we got an image buffer
-		dropImg = qvariant_cast<QImage>(mimeData->imageData());
-		qInfo() << "Qt image loaded from mime";
-	}
-	else {
-		qDebug() << "Sorry, I could not handle the clipboard data:" << mimeData->formats();
-	}
-
-	if (!dropImg.isNull()) {
-
-		getViewPort()->loadImage(dropImg);
-		return true;
-	}
-
-    if(urls.size() == 0) {
+    // load from image buffer
+    else if (dropImg.isNull() && mimeData->hasImage()) {
+        // we got an image buffer
+        dropImg = qvariant_cast<QImage>(mimeData->imageData());
+        qInfo() << "Qt image loaded from mime";
+    } else {
+        qDebug() << "Sorry, I could not handle the clipboard data:" << mimeData->formats();
+    }
+
+    if (!dropImg.isNull()) {
+        getViewPort()->loadImage(dropImg);
+        return true;
+    }
+
+    if (urls.size() == 0) {
         return false;
     }
 
 #ifdef _DEBUG
     // At this point we have a non empty list of valid urls we can load
     qDebug() << urls.size() << " files dropped:";
-    for (const QUrl& url: urls) {
+    for (const QUrl &url : urls) {
         QString fname = url.toLocalFile();
         QFileInfo file(fname);
         qDebug() << QString("url [%1]: %2 %3")
@@ -1466,35 +1367,29 @@ bool DkCentralWidget::loadFromMime(const QMimeData* mimeData) {
     return false;
 }
 
-
 /** load a number of Cascade Trainig files */
-bool DkCentralWidget::loadCascadeTrainingFiles(QList<QUrl> urls) {
-    
-	QStringList vecFiles;
+bool DkCentralWidget::loadCascadeTrainingFiles(QList<QUrl> urls)
+{
+    QStringList vecFiles;
 
     if (urls.size() > 1 && urls.at(0).toLocalFile().endsWith("vec")) {
-
         for (int idx = 0; idx < urls.size(); idx++)
             vecFiles.append(urls.at(idx).toLocalFile());
 
         // ask user for filename
-        QString sPath(
-			QFileDialog::getSaveFileName(
-				this, 
-				tr("Save File"),
-				QFileInfo(vecFiles.first()).absolutePath(), 
-				"Cascade Training File (*.vec)",
-				nullptr,
-				DkDialog::fileDialogOptions()
-			)
-		);
+        QString sPath(QFileDialog::getSaveFileName(this,
+                                                   tr("Save File"),
+                                                   QFileInfo(vecFiles.first()).absolutePath(),
+                                                   "Cascade Training File (*.vec)",
+                                                   nullptr,
+                                                   DkDialog::fileDialogOptions()));
 
         DkBasicLoader loader;
         int numFiles = loader.mergeVecFiles(vecFiles, sPath);
 
         if (numFiles) {
             loadFile(sPath);
-			setInfo(tr("%1 vec files merged").arg(numFiles));
+            setInfo(tr("%1 vec files merged").arg(numFiles));
             return true;
         }
     }
diff --git a/ImageLounge/src/DkGui/DkCentralWidget.h b/ImageLounge/src/DkGui/DkCentralWidget.h
index 0ef3779..981915f 100644
--- a/ImageLounge/src/DkGui/DkCentralWidget.h
+++ b/ImageLounge/src/DkGui/DkCentralWidget.h
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkCentralWidget.cpp
  Created on:	14.11.2014
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -27,14 +27,14 @@
 
 #pragma once
 
-#pragma warning(push, 0)	// no warnings from includes - begin
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QWidget>
-#pragma warning(pop)		// no warnings from includes - end
+#pragma warning(pop) // no warnings from includes - end
 
-#include "DkImageContainer.h"
 #include "DkBaseWidgets.h"
+#include "DkImageContainer.h"
 
-#pragma warning(disable: 4251)	// TODO: remove
+#pragma warning(disable : 4251) // TODO: remove
 
 #ifndef DllCoreExport
 #ifdef DK_CORE_DLL_EXPORT
@@ -52,176 +52,171 @@ class QMimeData;
 class QSettings;
 class QStackedLayout;
 
-namespace nmc {
-
+namespace nmc
+{
 // nomacs defines
 class DkImageLoader;
 class DkViewPort;
 class DkPreferenceWidget;
 class DkProgressBar;
 class DkBatchWidget;
-class DkCropViewPort;
 
-class DllCoreExport DkTabInfo : public QObject {
-	Q_OBJECT
+class DllCoreExport DkTabInfo : public QObject
+{
+    Q_OBJECT
 
 public:
+    enum TabMode {
+        tab_single_image,
+        tab_thumb_preview,
+        tab_recent_files,
+        tab_preferences,
+        tab_batch,
 
-	enum TabMode {
-		tab_single_image,
-		tab_thumb_preview,
-		tab_recent_files,
-		tab_preferences,
-		tab_batch,
-		tab_crop,
+        tab_empty,
 
-		tab_empty,
+        tab_end
+    };
 
-		tab_end
-	};
+    DkTabInfo(const QSharedPointer<DkImageContainerT> imgC = QSharedPointer<DkImageContainerT>(), int idx = -1, QObject *parent = 0);
+    DkTabInfo(TabMode mode, int idx = -1, QObject *parent = 0);
+    ~DkTabInfo();
 
-	DkTabInfo(const QSharedPointer<DkImageContainerT> imgC = QSharedPointer<DkImageContainerT>(), int idx = -1, QObject* parent = 0);
-	DkTabInfo(TabMode mode, int idx = -1, QObject* parent = 0);
-	~DkTabInfo();
+    bool operator==(const DkTabInfo &o) const;
 
-	bool operator==(const DkTabInfo& o) const;
+    QString getFilePath() const;
+    void setFilePath(const QString &filePath);
+    bool setDirPath(const QString &dirPath);
 
-	QString getFilePath() const;
-	void setFilePath(const QString& filePath);
-	bool setDirPath(const QString& dirPath);
+    QSharedPointer<DkImageContainerT> getImage() const;
+    void setImage(QSharedPointer<DkImageContainerT> imgC);
 
-	QSharedPointer<DkImageContainerT> getImage() const;
-	void setImage(QSharedPointer<DkImageContainerT> imgC);
+    QSharedPointer<DkImageLoader> getImageLoader() const;
 
-	QSharedPointer<DkImageLoader> getImageLoader() const;
+    void deactivate();
+    void activate(bool isActive = true);
 
-	void deactivate();
-	void activate(bool isActive = true);
+    int getTabIdx() const;
+    void setTabIdx(int idx);
 
-	int getTabIdx() const;
-	void setTabIdx(int idx);
-	
-	void loadSettings(const QSettings& settings);
-	void saveSettings(QSettings& settings) const;
+    void loadSettings(const QSettings &settings);
+    void saveSettings(QSettings &settings) const;
 
-	QIcon getIcon();
-	QString getTabText() const;
+    QIcon getIcon();
+    QString getTabText() const;
 
-	TabMode getMode() const;
-	void setMode(int mode);
+    TabMode getMode() const;
+    void setMode(int mode);
 
 protected:
-	QSharedPointer<DkImageLoader> mImageLoader;
-	int mTabIdx = 0;
-	enum TabMode mTabMode = tab_recent_files;
-	QString mFilePath = "";
+    QSharedPointer<DkImageLoader> mImageLoader;
+    int mTabIdx = 0;
+    enum TabMode mTabMode = tab_recent_files;
+    QString mFilePath = "";
 };
 
 class DkViewPort;
 class DkThumbScrollWidget;
 class DkRecentFilesWidget;
 
-class DllCoreExport DkCentralWidget : public DkWidget {
-	Q_OBJECT
+class DllCoreExport DkCentralWidget : public DkWidget
+{
+    Q_OBJECT
 
 public:
-	DkCentralWidget(QWidget* parent = 0);
-	~DkCentralWidget();
-
-	bool hasViewPort() const;
-	DkViewPort* getViewPort() const;
-	DkThumbScrollWidget* getThumbScrollWidget() const;
-	QString getCurrentDir() const;
-
-	void clearAllTabs();
-	void setActiveTab(int idx) const;
-	int getActiveTab();
-	void updateTab(QSharedPointer<DkTabInfo> tabInfo);
-	QVector<QSharedPointer<DkTabInfo> > getTabs() const;
-	void loadSettings();
-	void saveSettings(bool clearTabs = false) const;
-	int currentViewMode() const;
-	QSharedPointer<DkImageContainerT> getCurrentImage() const;
-	QString getCurrentFilePath() const;
-	QSharedPointer<DkImageLoader> getCurrentImageLoader() const;
-	bool requestClose() const;
+    DkCentralWidget(QWidget *parent = 0);
+    ~DkCentralWidget();
+
+    bool hasViewPort() const;
+    DkViewPort *getViewPort() const;
+    DkThumbScrollWidget *getThumbScrollWidget() const;
+    QString getCurrentDir() const;
+
+    void clearAllTabs();
+    void setActiveTab(int idx) const;
+    int getActiveTab();
+    void updateTab(QSharedPointer<DkTabInfo> tabInfo);
+    QVector<QSharedPointer<DkTabInfo>> getTabs() const;
+    void loadSettings();
+    void saveSettings(bool clearTabs = false) const;
+    int currentViewMode() const;
+    QSharedPointer<DkImageContainerT> getCurrentImage() const;
+    QString getCurrentFilePath() const;
+    QSharedPointer<DkImageLoader> getCurrentImageLoader() const;
+    bool requestClose() const;
 
 signals:
-	void imageUpdatedSignal(QSharedPointer<DkImageContainerT>) const;
-	void imageLoadedSignal(QSharedPointer<DkImageContainerT>) const;
-	void imageHasGPSSignal(bool) const;
-	
+    void imageUpdatedSignal(QSharedPointer<DkImageContainerT>) const;
+    void imageLoadedSignal(QSharedPointer<DkImageContainerT>) const;
+    void imageHasGPSSignal(bool) const;
+
 public slots:
-	void imageLoaded(QSharedPointer<DkImageContainerT> img);
-	void currentTabChanged(int idx);
-	void tabCloseRequested(int idx);
-	void tabMoved(int from, int to);
-	void setTabList(QVector<QSharedPointer<DkTabInfo> > tabInfos, int activeIndex = -1);
-	void addTab(QSharedPointer<DkImageContainerT> imgC = QSharedPointer<DkImageContainerT>(), int tabIdx = -1, bool background = false);
-	void addTab(const QString& filePath, int idx = -1, bool background = false);
-	void addTab(const QSharedPointer<DkTabInfo> tabInfo, bool background = false);
-	void removeTab(int tabIdx = -1);
-	void nextTab() const;
-	void previousTab() const;
-	void showThumbView(bool show = true);
-	void showViewPort(bool show = true);
-	void showRecentFiles(bool show = true);
-	void showPreferences(bool show = true);
-	void showTabs(bool show = true);
-	void pasteImage();
-	void loadFileToTab(const QString& filePath);
-	void loadFile(const QString& filePath, bool newTab = false);
-	void loadDir(const QString& filePath);
-	void loadDirToTab(const QString& dirPath);
-	void loadUrl(const QUrl& urls, bool newTab = false);
-	void loadUrls(const QList<QUrl>& urls, const int maxUrlsToLoad = 20);
-	void openBatch(const QStringList& selectedFiles = QStringList());
-	void showBatch(bool show = true);
-	void openCrop();
-	void showCrop(bool show = true);	// hide function?!
-	void openPreferences();
-	void restart() const;
-	void showProgress(bool show, int time = -1);
-	void startSlideshow(bool start = true) const;
-	void setInfo(const QString& msg) const;
+    void imageLoaded(QSharedPointer<DkImageContainerT> img);
+    void currentTabChanged(int idx);
+    void tabCloseRequested(int idx);
+    void tabMoved(int from, int to);
+    void setTabList(QVector<QSharedPointer<DkTabInfo>> tabInfos, int activeIndex = -1);
+    void addTab(QSharedPointer<DkImageContainerT> imgC = QSharedPointer<DkImageContainerT>(), int tabIdx = -1, bool background = false);
+    void addTab(const QString &filePath, int idx = -1, bool background = false);
+    void addTab(const QSharedPointer<DkTabInfo> tabInfo, bool background = false);
+    void removeTab(int tabIdx = -1);
+    void nextTab() const;
+    void previousTab() const;
+    void showThumbView(bool show = true);
+    void showViewPort(bool show = true);
+    void showRecentFiles(bool show = true);
+    void showPreferences(bool show = true);
+    void showTabs(bool show = true);
+    void pasteImage();
+    void loadFileToTab(const QString &filePath);
+    void loadFile(const QString &filePath, bool newTab = false);
+    void loadDir(const QString &filePath);
+    void loadDirToTab(const QString &dirPath);
+    void loadUrl(const QUrl &urls, bool newTab = false);
+    void loadUrls(const QList<QUrl> &urls, const int maxUrlsToLoad = 20);
+    void openBatch(const QStringList &selectedFiles = QStringList());
+    void showBatch(bool show = true);
+    void openPreferences();
+    void restart() const;
+    void showProgress(bool show, int time = -1);
+    void startSlideshow(bool start = true) const;
+    void setInfo(const QString &msg) const;
 
 protected:
-	QTabBar* mTabbar = 0;
-	DkProgressBar* mProgressBar = 0;
-	QVector<QSharedPointer<DkTabInfo> > mTabInfos;
-
-	QVector<QWidget*> mWidgets;
-	QStackedLayout* mViewLayout = 0;
-
-	void dropEvent(QDropEvent *event) override;
-	void dragEnterEvent(QDragEnterEvent *event) override;
-	void paintEvent(QPaintEvent* ev) override;
-
-	void createLayout();
-	void updateTabIdx();
-	void switchWidget(int widget);
-	void switchWidget(QWidget* widget = 0);
-	bool loadFromMime(const QMimeData* mimeData);
-	bool loadCascadeTrainingFiles(QList<QUrl> urls);
-	void updateLoader(QSharedPointer<DkImageLoader> loader) const;
-
-	DkPreferenceWidget* createPreferences();
-	DkRecentFilesWidget* createRecentFiles();
-	DkThumbScrollWidget* createThumbScrollWidget();
-	DkBatchWidget* createBatch();
-	DkCropViewPort* createCrop();
-	void createViewPort();
-
-	enum {
-		viewport_widget,
-		thumbs_widget,
-		recent_files_widget,
-		preference_widget,
-		batch_widget,
-		crop_widget,
-
-		widget_end
-	};
+    QTabBar *mTabbar = 0;
+    DkProgressBar *mProgressBar = 0;
+    QVector<QSharedPointer<DkTabInfo>> mTabInfos;
+
+    QVector<QWidget *> mWidgets;
+    QStackedLayout *mViewLayout = 0;
+
+    void dropEvent(QDropEvent *event) override;
+    void dragEnterEvent(QDragEnterEvent *event) override;
+    void paintEvent(QPaintEvent *ev) override;
+
+    void createLayout();
+    void updateTabIdx();
+    void switchWidget(int widget);
+    void switchWidget(QWidget *widget = 0);
+    bool loadFromMime(const QMimeData *mimeData);
+    bool loadCascadeTrainingFiles(QList<QUrl> urls);
+    void updateLoader(QSharedPointer<DkImageLoader> loader) const;
+
+    DkPreferenceWidget *createPreferences();
+    DkRecentFilesWidget *createRecentFiles();
+    DkThumbScrollWidget *createThumbScrollWidget();
+    DkBatchWidget *createBatch();
+    void createViewPort();
+
+    enum {
+        viewport_widget,
+        thumbs_widget,
+        recent_files_widget,
+        preference_widget,
+        batch_widget,
+
+        widget_end
+    };
 };
 
 }
diff --git a/ImageLounge/src/DkGui/DkConnection.cpp b/ImageLounge/src/DkGui/DkConnection.cpp
index e10b80a..f635855 100644
--- a/ImageLounge/src/DkGui/DkConnection.cpp
+++ b/ImageLounge/src/DkGui/DkConnection.cpp
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkConnection.cpp
  Created on:	20.07.2011
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -28,522 +28,547 @@
 #include "DkConnection.h"
 #include "DkSettings.h"
 
-#pragma warning(push, 0)	// no warnings from includes - begin
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QBuffer>
 #include <QByteArray>
-#include <QTimer>
+#include <QDebug>
 #include <QHostInfo>
 #include <QThread>
-#include <QDebug>
-#pragma warning(pop)		// no warnings from includes - end
+#include <QTimer>
+#pragma warning(pop) // no warnings from includes - end
 
-namespace nmc {
+namespace nmc
+{
 
 // DkConnection --------------------------------------------------------------------
 
-DkConnection::DkConnection(QObject* parent) : QTcpSocket(parent) {
-	
-	mNumBytesForCurrentDataType = -1;
-	mIsGreetingMessageSent = false;	
-	mIsSynchronizeMessageSent = false;
-	connectionCreated = false;
-	mSynchronizedTimer = new QTimer(this);
+DkConnection::DkConnection(QObject *parent)
+    : QTcpSocket(parent)
+{
+    mNumBytesForCurrentDataType = -1;
+    mIsGreetingMessageSent = false;
+    mIsSynchronizeMessageSent = false;
+    connectionCreated = false;
+    mSynchronizedTimer = new QTimer(this);
 
-	connect(mSynchronizedTimer, SIGNAL(timeout()), this, SLOT(synchronizedTimerTimeout()));
-	connect(this, SIGNAL(readyRead()), this, SLOT(processReadyRead()));
+    connect(mSynchronizedTimer, SIGNAL(timeout()), this, SLOT(synchronizedTimerTimeout()));
+    connect(this, SIGNAL(readyRead()), this, SLOT(processReadyRead()));
 
-	setReadBufferSize(MaxBufferSize);
+    setReadBufferSize(MaxBufferSize);
 }
 
-void DkConnection::setTitle(const QString& newTitle) {
-	mCurrentTitle = newTitle;
+void DkConnection::setTitle(const QString &newTitle)
+{
+    mCurrentTitle = newTitle;
 }
 
-void DkConnection::sendStartSynchronizeMessage() {
-	//qDebug() << "sending Synchronize Message to " << this->peerName() << ":" << this->peerPort();
-	if (mIsSynchronizeMessageSent == false) // initialize sync message, not the response
-		mSynchronizedTimer->start(1000);
-
-	QByteArray ba;
-	QDataStream ds(&ba, QIODevice::ReadWrite);
-	ds << quint16(mSynchronizedPeersServerPorts.size());
-	for (int i = 0; i < mSynchronizedPeersServerPorts.size(); i++) {
-		qDebug() << "mSynchronizedPeersServerPorts: " << mSynchronizedPeersServerPorts[i];
-		ds << mSynchronizedPeersServerPorts[i];
-	}
-	//QByteArray data = "SYNCHRONIZE" + SeparatorToken + QByteArray::number(synchronize.size()) + SeparatorToken + synchronize;
-	QByteArray data = "STARTSYNCHRONIZE";
-	data.append(SeparatorToken).append(QByteArray::number(ba.size())).append(SeparatorToken).append(ba);
-	qDebug() << "sending startsynchronize:" << data;
-	if (write(data) == data.size())
-		mIsSynchronizeMessageSent = true;
+void DkConnection::sendStartSynchronizeMessage()
+{
+    // qDebug() << "sending Synchronize Message to " << this->peerName() << ":" << this->peerPort();
+    if (mIsSynchronizeMessageSent == false) // initialize sync message, not the response
+        mSynchronizedTimer->start(1000);
+
+    QByteArray ba;
+    QDataStream ds(&ba, QIODevice::ReadWrite);
+    ds << quint16(mSynchronizedPeersServerPorts.size());
+    for (int i = 0; i < mSynchronizedPeersServerPorts.size(); i++) {
+        qDebug() << "mSynchronizedPeersServerPorts: " << mSynchronizedPeersServerPorts[i];
+        ds << mSynchronizedPeersServerPorts[i];
+    }
+    // QByteArray data = "SYNCHRONIZE" + SeparatorToken + QByteArray::number(synchronize.size()) + SeparatorToken + synchronize;
+    QByteArray data = "STARTSYNCHRONIZE";
+    data.append(SeparatorToken).append(QByteArray::number(ba.size())).append(SeparatorToken).append(ba);
+    qDebug() << "sending startsynchronize:" << data;
+    if (write(data) == data.size())
+        mIsSynchronizeMessageSent = true;
 }
 
-void DkConnection::sendStopSynchronizeMessage() {
-	if (mState == Synchronized) { // only send message if connection is synchronized
-		//qDebug() << "sending disable synchronize Message to " << this->peerName() << ":" << this->peerPort();
-		QByteArray synchronize = "disable synchronizing";
-		//QByteArray data = "DISABLESYNCHRONIZE" + SeparatorToken + QByteArray::number(synchronize.size()) + SeparatorToken + synchronize;
-		QByteArray data = "STOPSYNCHRONIZE";
-		data.append(SeparatorToken).append(QByteArray::number(synchronize.size())).append(SeparatorToken).append(synchronize);
-		if (write(data) == data.size())
-			mIsSynchronizeMessageSent = false;
-		mState=ReadyForUse;
-	}
+void DkConnection::sendStopSynchronizeMessage()
+{
+    if (mState == Synchronized) { // only send message if connection is synchronized
+        // qDebug() << "sending disable synchronize Message to " << this->peerName() << ":" << this->peerPort();
+        QByteArray synchronize = "disable synchronizing";
+        // QByteArray data = "DISABLESYNCHRONIZE" + SeparatorToken + QByteArray::number(synchronize.size()) + SeparatorToken + synchronize;
+        QByteArray data = "STOPSYNCHRONIZE";
+        data.append(SeparatorToken).append(QByteArray::number(synchronize.size())).append(SeparatorToken).append(synchronize);
+        if (write(data) == data.size())
+            mIsSynchronizeMessageSent = false;
+        mState = ReadyForUse;
+    }
 }
 
-void DkConnection::sendNewTitleMessage(const QString& newtitle) {
-	mCurrentTitle = newtitle;
-	//qDebug() << "sending new Title (\"" << newtitle << "\") Message to " << this->peerName() << ":" << this->peerPort();
+void DkConnection::sendNewTitleMessage(const QString &newtitle)
+{
+    mCurrentTitle = newtitle;
+    // qDebug() << "sending new Title (\"" << newtitle << "\") Message to " << this->peerName() << ":" << this->peerPort();
 
-	QByteArray newTitleBA=newtitle.toUtf8();
-	//QByteArray data = "NEWTITLE" + SeparatorToken + QByteArray::number(newTitleBA.size()) + SeparatorToken + newTitleBA;
-	QByteArray data = "NEWTITLE";
-	data.append(SeparatorToken).append(QByteArray::number(newTitleBA.size())).append(SeparatorToken).append(newTitleBA);
-	write(data);
+    QByteArray newTitleBA = newtitle.toUtf8();
+    // QByteArray data = "NEWTITLE" + SeparatorToken + QByteArray::number(newTitleBA.size()) + SeparatorToken + newTitleBA;
+    QByteArray data = "NEWTITLE";
+    data.append(SeparatorToken).append(QByteArray::number(newTitleBA.size())).append(SeparatorToken).append(newTitleBA);
+    write(data);
 }
 
-void DkConnection::sendNewPositionMessage(QRect position, bool opacity, bool overlaid) {
-	//qDebug() << "sending new Position to " << this->peerName() << ":" << this->peerPort();
-	QByteArray ba;
-	QDataStream ds(&ba, QIODevice::ReadWrite);
-	ds << position;
-	ds << opacity;
-	ds << overlaid;
-
-	//QByteArray data = "NEWTITLE" + SeparatorToken + QByteArray::number(ba.size()) + SeparatorToken + ba;
-	QByteArray data = "NEWPOSITION";
-	data.append(SeparatorToken).append(QByteArray::number(ba.size())).append(SeparatorToken).append(ba);
-	write(data);
+void DkConnection::sendNewPositionMessage(QRect position, bool opacity, bool overlaid)
+{
+    // qDebug() << "sending new Position to " << this->peerName() << ":" << this->peerPort();
+    QByteArray ba;
+    QDataStream ds(&ba, QIODevice::ReadWrite);
+    ds << position;
+    ds << opacity;
+    ds << overlaid;
+
+    // QByteArray data = "NEWTITLE" + SeparatorToken + QByteArray::number(ba.size()) + SeparatorToken + ba;
+    QByteArray data = "NEWPOSITION";
+    data.append(SeparatorToken).append(QByteArray::number(ba.size())).append(SeparatorToken).append(ba);
+    write(data);
 }
 
-void DkConnection::sendNewTransformMessage(QTransform transform, QTransform imgTransform, QPointF canvasSize) {
-	//qDebug() << "sending new Transform Message to " << this->peerName() << ":" << this->peerPort();
-	QByteArray ba;
-	QDataStream ds(&ba, QIODevice::ReadWrite);
-	ds << transform;
-	ds << imgTransform;
-	ds << canvasSize;
-
-	//QByteArray data = "NEWTRANSFORM" + SeparatorToken + QByteArray::number(ba.size()) + SeparatorToken + ba;
-	QByteArray data = "NEWTRANSFORM";
-	data.append(SeparatorToken).append(QByteArray::number(ba.size())).append(SeparatorToken).append(ba);
-	write(data);
+void DkConnection::sendNewTransformMessage(QTransform transform, QTransform imgTransform, QPointF canvasSize)
+{
+    // qDebug() << "sending new Transform Message to " << this->peerName() << ":" << this->peerPort();
+    QByteArray ba;
+    QDataStream ds(&ba, QIODevice::ReadWrite);
+    ds << transform;
+    ds << imgTransform;
+    ds << canvasSize;
+
+    // QByteArray data = "NEWTRANSFORM" + SeparatorToken + QByteArray::number(ba.size()) + SeparatorToken + ba;
+    QByteArray data = "NEWTRANSFORM";
+    data.append(SeparatorToken).append(QByteArray::number(ba.size())).append(SeparatorToken).append(ba);
+    write(data);
 }
 
-void DkConnection::sendNewFileMessage(qint16 op, const QString& filename) {
-	//qDebug() << "sending new File Message to " << this->peerName() << ":" << this->peerPort();
-	QByteArray ba;
-	QDataStream ds(&ba, QIODevice::ReadWrite);
-	ds << op;
-	ds << filename;
-	QByteArray data = "NEWFILE";
-	data.append(SeparatorToken).append(QByteArray::number(ba.size())).append(SeparatorToken).append(ba);
-	write(data);
+void DkConnection::sendNewFileMessage(qint16 op, const QString &filename)
+{
+    // qDebug() << "sending new File Message to " << this->peerName() << ":" << this->peerPort();
+    QByteArray ba;
+    QDataStream ds(&ba, QIODevice::ReadWrite);
+    ds << op;
+    ds << filename;
+    QByteArray data = "NEWFILE";
+    data.append(SeparatorToken).append(QByteArray::number(ba.size())).append(SeparatorToken).append(ba);
+    write(data);
 }
 
-void DkConnection::sendNewGoodbyeMessage() {
-	//qDebug() << "sending good bye to " << peerName() << ":" << this->peerPort();
+void DkConnection::sendNewGoodbyeMessage()
+{
+    // qDebug() << "sending good bye to " << peerName() << ":" << this->peerPort();
 
-	QByteArray ba = "GoodBye";  // scherz?
-	QByteArray data = "GOODBYE";
-	data.append(SeparatorToken).append(QByteArray::number(ba.size())).append(SeparatorToken).append(ba);
-	write(data);
-	waitForBytesWritten();
+    QByteArray ba = "GoodBye"; // scherz?
+    QByteArray data = "GOODBYE";
+    data.append(SeparatorToken).append(QByteArray::number(ba.size())).append(SeparatorToken).append(ba);
+    write(data);
+    waitForBytesWritten();
 }
 
-void DkConnection::synchronizedPeersListChanged(QList<quint16> newList) {
-	mSynchronizedPeersServerPorts = newList;
+void DkConnection::synchronizedPeersListChanged(QList<quint16> newList)
+{
+    mSynchronizedPeersServerPorts = newList;
 }
 
-bool DkConnection::readProtocolHeader() {
-	QByteArray greetingBA = QByteArray("GREETING").append(SeparatorToken);
-	QByteArray synchronizeBA = QByteArray("STARTSYNCHRONIZE").append(SeparatorToken);
-	QByteArray disableSynchronizeBA = QByteArray("STOPSYNCHRONIZE").append(SeparatorToken);
-	QByteArray newtitleBA = QByteArray("NEWTITLE").append(SeparatorToken);
-	QByteArray newtransformBA = QByteArray("NEWTRANSFORM").append(SeparatorToken);
-	QByteArray newpositionBA = QByteArray("NEWPOSITION").append(SeparatorToken);
-	QByteArray newFileBA = QByteArray("NEWFILE").append(SeparatorToken);
-	QByteArray goodbyeBA = QByteArray("GOODBYE").append(SeparatorToken);
-
-	if (mBuffer == greetingBA) {
-		//qDebug() << "Greeting received from:" << this->peerAddress() << ":" << this->peerPort();
-		mCurrentDataType = Greeting;
-	} else if (mBuffer == synchronizeBA) {
-		//qDebug() << "Synchronize received from:" << this->peerAddress() << ":" << this->peerPort();
-		mCurrentDataType = startSynchronize;
-	} else if (mBuffer == disableSynchronizeBA) {
-		//qDebug() << "StopSynchronize received from:" << this->peerAddress() << ":" << this->peerPort();
-		mCurrentDataType = stopSynchronize;
-	} else if (mBuffer == newtitleBA) {
-		//qDebug() << "New Title received from:" << this->peerAddress() << ":" << this->peerPort();
-		mCurrentDataType = newTitle;
-	} else if (mBuffer == newtransformBA) {
-		//qDebug() << "New Transform received from:" << this->peerAddress() << ":" << this->peerPort();
-		mCurrentDataType = newTransform;
-	} else if (mBuffer == newpositionBA) {
-		//qDebug() << "New Position received from:" << this->peerAddress() << ":" << this->peerPort();
-		mCurrentDataType = newPosition;
-	} else if (mBuffer == newFileBA) {
-		//qDebug() << "New File received from:" << this->peerAddress() << ":" << this->peerPort();
-		mCurrentDataType = newFile;
-	} else if (mBuffer == goodbyeBA) {
-		//qDebug() << "Goodbye received from:" << this->peerAddress() << ":" << this->peerPort();
-		mCurrentDataType = GoodBye;
-	} else {
-		qDebug() << QString(mBuffer);
-		qDebug() << "Undefined received from:" << this->peerAddress() << ":" << this->peerPort();
-		mCurrentDataType = Undefined;
-		//abort();
-		//return false;
-		return true;
-	}
-
-	mBuffer.clear();
-	mNumBytesForCurrentDataType = dataLengthForCurrentDataType();
-	return true;
+bool DkConnection::readProtocolHeader()
+{
+    QByteArray greetingBA = QByteArray("GREETING").append(SeparatorToken);
+    QByteArray synchronizeBA = QByteArray("STARTSYNCHRONIZE").append(SeparatorToken);
+    QByteArray disableSynchronizeBA = QByteArray("STOPSYNCHRONIZE").append(SeparatorToken);
+    QByteArray newtitleBA = QByteArray("NEWTITLE").append(SeparatorToken);
+    QByteArray newtransformBA = QByteArray("NEWTRANSFORM").append(SeparatorToken);
+    QByteArray newpositionBA = QByteArray("NEWPOSITION").append(SeparatorToken);
+    QByteArray newFileBA = QByteArray("NEWFILE").append(SeparatorToken);
+    QByteArray goodbyeBA = QByteArray("GOODBYE").append(SeparatorToken);
+
+    if (mBuffer == greetingBA) {
+        // qDebug() << "Greeting received from:" << this->peerAddress() << ":" << this->peerPort();
+        mCurrentDataType = Greeting;
+    } else if (mBuffer == synchronizeBA) {
+        // qDebug() << "Synchronize received from:" << this->peerAddress() << ":" << this->peerPort();
+        mCurrentDataType = startSynchronize;
+    } else if (mBuffer == disableSynchronizeBA) {
+        // qDebug() << "StopSynchronize received from:" << this->peerAddress() << ":" << this->peerPort();
+        mCurrentDataType = stopSynchronize;
+    } else if (mBuffer == newtitleBA) {
+        // qDebug() << "New Title received from:" << this->peerAddress() << ":" << this->peerPort();
+        mCurrentDataType = newTitle;
+    } else if (mBuffer == newtransformBA) {
+        // qDebug() << "New Transform received from:" << this->peerAddress() << ":" << this->peerPort();
+        mCurrentDataType = newTransform;
+    } else if (mBuffer == newpositionBA) {
+        // qDebug() << "New Position received from:" << this->peerAddress() << ":" << this->peerPort();
+        mCurrentDataType = newPosition;
+    } else if (mBuffer == newFileBA) {
+        // qDebug() << "New File received from:" << this->peerAddress() << ":" << this->peerPort();
+        mCurrentDataType = newFile;
+    } else if (mBuffer == goodbyeBA) {
+        // qDebug() << "Goodbye received from:" << this->peerAddress() << ":" << this->peerPort();
+        mCurrentDataType = GoodBye;
+    } else {
+        qDebug() << QString(mBuffer);
+        qDebug() << "Undefined received from:" << this->peerAddress() << ":" << this->peerPort();
+        mCurrentDataType = Undefined;
+        // abort();
+        // return false;
+        return true;
+    }
+
+    mBuffer.clear();
+    mNumBytesForCurrentDataType = dataLengthForCurrentDataType();
+    return true;
 }
 
-int DkConnection::readDataIntoBuffer(int maxSize) {
-	if (maxSize > MaxBufferSize)
-		return 0;
-
-	int numBytesBeforeRead = mBuffer.size();
-	if (numBytesBeforeRead == MaxBufferSize) {
-		qDebug() << "DkConnection::readDataIntoBuffer: Connection aborted";
-		abort();
-		return 0;
-	}
-
-	while (bytesAvailable() > 0 && mBuffer.size() < maxSize) {
-		mBuffer.append(read(1));
-		if (mBuffer.endsWith(SeparatorToken)) {
-			break;
-		}
-	}
-	return mBuffer.size() - numBytesBeforeRead;
+int DkConnection::readDataIntoBuffer(int maxSize)
+{
+    if (maxSize > MaxBufferSize)
+        return 0;
+
+    int numBytesBeforeRead = mBuffer.size();
+    if (numBytesBeforeRead == MaxBufferSize) {
+        qDebug() << "DkConnection::readDataIntoBuffer: Connection aborted";
+        abort();
+        return 0;
+    }
+
+    while (bytesAvailable() > 0 && mBuffer.size() < maxSize) {
+        mBuffer.append(read(1));
+        if (mBuffer.endsWith(SeparatorToken)) {
+            break;
+        }
+    }
+    return mBuffer.size() - numBytesBeforeRead;
 }
 
-bool DkConnection::hasEnoughData() {
-	if (mNumBytesForCurrentDataType <= 0) {
-		mNumBytesForCurrentDataType = dataLengthForCurrentDataType();
-	}
-	
-	//qDebug() << "numBytesForCurrentDataType:" << numBytesForCurrentDataType;
-	//qDebug() << "bytesAvailable:" << bytesAvailable();
-	//qDebug() << "buffer size:" << buffer.size();
-	
-	if (bytesAvailable() < mNumBytesForCurrentDataType || mNumBytesForCurrentDataType <= 0) {
-		return false;
-	}
-
-	return true;
-}
+bool DkConnection::hasEnoughData()
+{
+    if (mNumBytesForCurrentDataType <= 0) {
+        mNumBytesForCurrentDataType = dataLengthForCurrentDataType();
+    }
 
-int DkConnection::dataLengthForCurrentDataType() {
-	if (bytesAvailable() <= 0 || readDataIntoBuffer() <= 0 || !mBuffer.endsWith(SeparatorToken))
-		return 0;
+    // qDebug() << "numBytesForCurrentDataType:" << numBytesForCurrentDataType;
+    // qDebug() << "bytesAvailable:" << bytesAvailable();
+    // qDebug() << "buffer size:" << buffer.size();
 
-	mBuffer.chop(1);
-	int number = mBuffer.toInt();
-	mBuffer.clear();
-	return number;
-}
+    if (bytesAvailable() < mNumBytesForCurrentDataType || mNumBytesForCurrentDataType <= 0) {
+        return false;
+    }
 
-void DkConnection::processReadyRead() {
-	if (readDataIntoBuffer() <= 0)
-		return;
-	if (!readProtocolHeader())
-		return;
-	checkState();
-
-	readWhileBytesAvailable();
+    return true;
 }
 
-void DkConnection::checkState() {
-	
-	if (mState == WaitingForGreeting) {
-		if (mCurrentDataType != Greeting) {
-			abort();
-			return;
-		}
-
-		if (!hasEnoughData())
-			return;
-
-		mBuffer = read(mNumBytesForCurrentDataType);
-		if (mBuffer.size() != mNumBytesForCurrentDataType) {
-			abort();
-			return;
-		}
-
-		if (!isValid()) {
-			abort();
-			return;
-		}
-
-		if (!mIsGreetingMessageSent)
-			sendGreetingMessage(mCurrentTitle);
-
-		mState = ReadyForUse;
-		mPortOfPeer = peerPort(); // save peer port ... otherwise connections where this instance is server can not be removed from peerList
-
-		readGreetingMessage();
-
-		mBuffer.clear();
-		mNumBytesForCurrentDataType = 0;
-		mCurrentDataType = Undefined;
-		return;
-	}
-
-	if (mState==ReadyForUse && mCurrentDataType == startSynchronize) {
-		if (!hasEnoughData())
-			return;
-
-		mBuffer = read(mNumBytesForCurrentDataType);
-		if (mBuffer.size() != mNumBytesForCurrentDataType) {
-			abort();
-			return;
-		}
-
-		QDataStream ds(mBuffer);
-		QList<quint16> synchronizedPeersOfOtherInstance;
-		quint16 numberOfSynchronizedPeers;
-		ds >> numberOfSynchronizedPeers;
-
-		//qDebug() << "other client is sychronized with: ";
-		for (int i=0; i < numberOfSynchronizedPeers; i++) {
-			quint16 peerId;
-			ds >> peerId;
-			synchronizedPeersOfOtherInstance.push_back(peerId);
-			//qDebug() << peerId;
-		}
-		mCurrentDataType = Undefined;
-		mNumBytesForCurrentDataType = 0;
-		mBuffer.clear();
-
-		if (!isValid()) {
-			abort();
-			return;
-		}
-
-		mState = Synchronized;
-		if (!mIsSynchronizeMessageSent)
-			sendStartSynchronizeMessage();
-
-		mSynchronizedTimer->stop();
-		emit connectionStartSynchronize(synchronizedPeersOfOtherInstance, this);
-		return;
-	}
-
-	if (mState==Synchronized && mCurrentDataType == stopSynchronize) {
-		mState=ReadyForUse;
-		this->mIsSynchronizeMessageSent=false;
-		emit connectionStopSynchronize(this);
-		mBuffer = read(mNumBytesForCurrentDataType);
-		if (mBuffer.size() != mNumBytesForCurrentDataType) {
-			abort();
-			return;
-		}
-
-		mCurrentDataType = Undefined;
-		mNumBytesForCurrentDataType = 0;
-		mBuffer.clear();
-
-		return;
-	}
-
-	if (mCurrentDataType == GoodBye) {
-		//qDebug() << "received GoodBye from " << peerAddress() << ":" << peerPort();
-		emit connectionGoodBye(this);
-		mCurrentDataType = Undefined;
-		mNumBytesForCurrentDataType = 0;
-		mBuffer.clear();
-		abort();
-		return;
-	}
-}
+int DkConnection::dataLengthForCurrentDataType()
+{
+    if (bytesAvailable() <= 0 || readDataIntoBuffer() <= 0 || !mBuffer.endsWith(SeparatorToken))
+        return 0;
 
-void DkConnection::readWhileBytesAvailable() {
-	do {
-		if (mCurrentDataType == Undefined) {
-			if (readDataIntoBuffer() <= 0)
-				return;
-			if (!readProtocolHeader())
-				return;
-			checkState();
-		}
-		if (!hasEnoughData()) {
-			return;
-		}
-
-		mBuffer = read(mNumBytesForCurrentDataType);
-		if (mBuffer.size() != mNumBytesForCurrentDataType) {
-			abort();
-			return;
-		}
-		processData();
-
-	} while (bytesAvailable() > 0);
+    mBuffer.chop(1);
+    int number = mBuffer.toInt();
+    mBuffer.clear();
+    return number;
 }
 
-bool DkConnection::readDataTypeIntoBuffer() {
-	mBuffer = read(mNumBytesForCurrentDataType);
-	if (mBuffer.size() != mNumBytesForCurrentDataType) {
-		abort();
-		return false;
-	}
-	return true;
+void DkConnection::processReadyRead()
+{
+    if (readDataIntoBuffer() <= 0)
+        return;
+    if (!readProtocolHeader())
+        return;
+    checkState();
 
+    readWhileBytesAvailable();
 }
 
-void DkConnection::processData() {
-	switch (mCurrentDataType) {
-	case newTitle:
-		emit connectionTitleHasChanged(this, QString::fromUtf8(mBuffer));
-		break;
-	case newPosition: {
-		if (mState == Synchronized) {
-			QRect rect;
-			bool opacity;
-			bool overlaid;
-			QDataStream ds(mBuffer);
-			ds >> rect;
-			ds >> opacity;
-			ds >> overlaid;
-			emit connectionNewPosition(this, rect, opacity, overlaid);
-		}
-		break;}
-	case newTransform: {
-		if (mState == Synchronized) {
-			QTransform transform;
-			QTransform imgTransform;
-			QPointF canvasSize;
-			QDataStream dsTransform(mBuffer);
-			dsTransform >> transform;
-			dsTransform >> imgTransform;
-			dsTransform >> canvasSize;
-			emit connectionNewTransform(this, transform, imgTransform, canvasSize);
-		}
-		break;}
-	case newFile: {
-		if (mState == Synchronized) {
-			qint16 op;
-			QString filename;
-
-			QDataStream dsTransform(mBuffer);
-			dsTransform >> op;
-			dsTransform >> filename;
-			emit connectionNewFile(this, op, filename);
-		}
-		break;}
-	default:
-		break;
-	}
-
-	mCurrentDataType = Undefined;
-	mNumBytesForCurrentDataType = 0;
-	mBuffer.clear();
+void DkConnection::checkState()
+{
+    if (mState == WaitingForGreeting) {
+        if (mCurrentDataType != Greeting) {
+            abort();
+            return;
+        }
+
+        if (!hasEnoughData())
+            return;
+
+        mBuffer = read(mNumBytesForCurrentDataType);
+        if (mBuffer.size() != mNumBytesForCurrentDataType) {
+            abort();
+            return;
+        }
+
+        if (!isValid()) {
+            abort();
+            return;
+        }
+
+        if (!mIsGreetingMessageSent)
+            sendGreetingMessage(mCurrentTitle);
+
+        mState = ReadyForUse;
+        mPortOfPeer = peerPort(); // save peer port ... otherwise connections where this instance is server can not be removed from peerList
+
+        readGreetingMessage();
+
+        mBuffer.clear();
+        mNumBytesForCurrentDataType = 0;
+        mCurrentDataType = Undefined;
+        return;
+    }
+
+    if (mState == ReadyForUse && mCurrentDataType == startSynchronize) {
+        if (!hasEnoughData())
+            return;
+
+        mBuffer = read(mNumBytesForCurrentDataType);
+        if (mBuffer.size() != mNumBytesForCurrentDataType) {
+            abort();
+            return;
+        }
+
+        QDataStream ds(mBuffer);
+        QList<quint16> synchronizedPeersOfOtherInstance;
+        quint16 numberOfSynchronizedPeers;
+        ds >> numberOfSynchronizedPeers;
+
+        // qDebug() << "other client is sychronized with: ";
+        for (int i = 0; i < numberOfSynchronizedPeers; i++) {
+            quint16 peerId;
+            ds >> peerId;
+            synchronizedPeersOfOtherInstance.push_back(peerId);
+            // qDebug() << peerId;
+        }
+        mCurrentDataType = Undefined;
+        mNumBytesForCurrentDataType = 0;
+        mBuffer.clear();
+
+        if (!isValid()) {
+            abort();
+            return;
+        }
+
+        mState = Synchronized;
+        if (!mIsSynchronizeMessageSent)
+            sendStartSynchronizeMessage();
+
+        mSynchronizedTimer->stop();
+        emit connectionStartSynchronize(synchronizedPeersOfOtherInstance, this);
+        return;
+    }
+
+    if (mState == Synchronized && mCurrentDataType == stopSynchronize) {
+        mState = ReadyForUse;
+        this->mIsSynchronizeMessageSent = false;
+        emit connectionStopSynchronize(this);
+        mBuffer = read(mNumBytesForCurrentDataType);
+        if (mBuffer.size() != mNumBytesForCurrentDataType) {
+            abort();
+            return;
+        }
+
+        mCurrentDataType = Undefined;
+        mNumBytesForCurrentDataType = 0;
+        mBuffer.clear();
+
+        return;
+    }
+
+    if (mCurrentDataType == GoodBye) {
+        // qDebug() << "received GoodBye from " << peerAddress() << ":" << peerPort();
+        emit connectionGoodBye(this);
+        mCurrentDataType = Undefined;
+        mNumBytesForCurrentDataType = 0;
+        mBuffer.clear();
+        abort();
+        return;
+    }
 }
 
-void DkConnection::synchronizedTimerTimeout() {
-	mSynchronizedTimer->stop();
-	emit connectionStopSynchronize(this);
+void DkConnection::readWhileBytesAvailable()
+{
+    do {
+        if (mCurrentDataType == Undefined) {
+            if (readDataIntoBuffer() <= 0)
+                return;
+            if (!readProtocolHeader())
+                return;
+            checkState();
+        }
+        if (!hasEnoughData()) {
+            return;
+        }
+
+        mBuffer = read(mNumBytesForCurrentDataType);
+        if (mBuffer.size() != mNumBytesForCurrentDataType) {
+            abort();
+            return;
+        }
+        processData();
+
+    } while (bytesAvailable() > 0);
 }
 
-// DkLocalConnection --------------------------------------------------------------------
-DkLocalConnection::DkLocalConnection(QObject* parent/* =0 */) : DkConnection(parent) {
+bool DkConnection::readDataTypeIntoBuffer()
+{
+    mBuffer = read(mNumBytesForCurrentDataType);
+    if (mBuffer.size() != mNumBytesForCurrentDataType) {
+        abort();
+        return false;
+    }
+    return true;
 }
 
+void DkConnection::processData()
+{
+    switch (mCurrentDataType) {
+    case newTitle:
+        emit connectionTitleHasChanged(this, QString::fromUtf8(mBuffer));
+        break;
+    case newPosition: {
+        if (mState == Synchronized) {
+            QRect rect;
+            bool opacity;
+            bool overlaid;
+            QDataStream ds(mBuffer);
+            ds >> rect;
+            ds >> opacity;
+            ds >> overlaid;
+            emit connectionNewPosition(this, rect, opacity, overlaid);
+        }
+        break;
+    }
+    case newTransform: {
+        if (mState == Synchronized) {
+            QTransform transform;
+            QTransform imgTransform;
+            QPointF canvasSize;
+            QDataStream dsTransform(mBuffer);
+            dsTransform >> transform;
+            dsTransform >> imgTransform;
+            dsTransform >> canvasSize;
+            emit connectionNewTransform(this, transform, imgTransform, canvasSize);
+        }
+        break;
+    }
+    case newFile: {
+        if (mState == Synchronized) {
+            qint16 op;
+            QString filename;
+
+            QDataStream dsTransform(mBuffer);
+            dsTransform >> op;
+            dsTransform >> filename;
+            emit connectionNewFile(this, op, filename);
+        }
+        break;
+    }
+    default:
+        break;
+    }
+
+    mCurrentDataType = Undefined;
+    mNumBytesForCurrentDataType = 0;
+    mBuffer.clear();
+}
 
-void DkLocalConnection::processReadyRead() {
-	if (mCurrentLocalDataType == Quit) { // long message (copied from lan connection) -> does this work here correctly?
-		readWhileBytesAvailable();
-		return;
-	}
-
-	//if (readDataIntoBuffer() <= 0)
-	//	return;
-	//if (!readProtocolHeader())
-	//	return;
-
-	DkConnection::processReadyRead();
+void DkConnection::synchronizedTimerTimeout()
+{
+    mSynchronizedTimer->stop();
+    emit connectionStopSynchronize(this);
 }
 
-void DkLocalConnection::processData() {
-	
-	if (mCurrentLocalDataType == Quit) {
-		emit connectionQuitReceived();
-	}
-	
-	DkConnection::processData();
+// DkLocalConnection --------------------------------------------------------------------
+DkLocalConnection::DkLocalConnection(QObject *parent /* =0 */)
+    : DkConnection(parent)
+{
 }
 
-bool DkLocalConnection::readProtocolHeader() {
-	QByteArray quitBA = QByteArray("QUIT").append(SeparatorToken);
+void DkLocalConnection::processReadyRead()
+{
+    if (mCurrentLocalDataType == Quit) { // long message (copied from lan connection) -> does this work here correctly?
+        readWhileBytesAvailable();
+        return;
+    }
 
-	if (mBuffer == quitBA) {
-		mCurrentLocalDataType = Quit;
-	} else {
-		return DkConnection::readProtocolHeader();
-	}
+    // if (readDataIntoBuffer() <= 0)
+    //	return;
+    // if (!readProtocolHeader())
+    //	return;
 
-	mBuffer.clear();
-	mNumBytesForCurrentDataType = dataLengthForCurrentDataType();
-	return true;
+    DkConnection::processReadyRead();
 }
 
+void DkLocalConnection::processData()
+{
+    if (mCurrentLocalDataType == Quit) {
+        emit connectionQuitReceived();
+    }
 
-void DkLocalConnection::sendGreetingMessage(const QString& currentTitle) {
-	
-	mCurrentTitle = currentTitle;
-	QByteArray ba;
-	QDataStream ds(&ba, QIODevice::ReadWrite);
-	ds << mLocalTcpServerPort;
-	ds << mCurrentTitle;
-
-	//qDebug() << "title: " << mCurrentTitle;
-	//qDebug() << "local tcp: " << mLocalTcpServerPort;
-	//qDebug() << "peer id: " << mPeerId;
-
-	QByteArray data = "GREETING";
-	data.append(SeparatorToken);
-	data.append(QByteArray::number(ba.size()));
-	data.append(SeparatorToken);
-	data.append(ba);
+    DkConnection::processData();
+}
 
-	//qDebug() << "greeting message: " << data;
+bool DkLocalConnection::readProtocolHeader()
+{
+    QByteArray quitBA = QByteArray("QUIT").append(SeparatorToken);
 
-	if (write(data) == data.size()) {
-		mIsGreetingMessageSent = true;
-	}
+    if (mBuffer == quitBA) {
+        mCurrentLocalDataType = Quit;
+    } else {
+        return DkConnection::readProtocolHeader();
+    }
 
+    mBuffer.clear();
+    mNumBytesForCurrentDataType = dataLengthForCurrentDataType();
+    return true;
 }
 
-void DkLocalConnection::readGreetingMessage() {
-	QString title;
-	QDataStream ds(mBuffer);
-	ds >> this->mPeerServerPort;
-	ds >> title;
-
-	//qDebug() << "emitting readyForUse";
-	emit connectionReadyForUse(mPeerServerPort, title, this);
+void DkLocalConnection::sendGreetingMessage(const QString &currentTitle)
+{
+    mCurrentTitle = currentTitle;
+    QByteArray ba;
+    QDataStream ds(&ba, QIODevice::ReadWrite);
+    ds << mLocalTcpServerPort;
+    ds << mCurrentTitle;
+
+    // qDebug() << "title: " << mCurrentTitle;
+    // qDebug() << "local tcp: " << mLocalTcpServerPort;
+    // qDebug() << "peer id: " << mPeerId;
+
+    QByteArray data = "GREETING";
+    data.append(SeparatorToken);
+    data.append(QByteArray::number(ba.size()));
+    data.append(SeparatorToken);
+    data.append(ba);
+
+    // qDebug() << "greeting message: " << data;
+
+    if (write(data) == data.size()) {
+        mIsGreetingMessageSent = true;
+    }
 }
 
-void DkLocalConnection::sendQuitMessage() {
-	QByteArray ba;
-	QDataStream ds(&ba, QIODevice::ReadWrite);
-	ds << "updating";
+void DkLocalConnection::readGreetingMessage()
+{
+    QString title;
+    QDataStream ds(mBuffer);
+    ds >> this->mPeerServerPort;
+    ds >> title;
 
-	QByteArray data = "QUIT";
-	data.append(SeparatorToken);
-	data.append(QByteArray::number(ba.size()));
-	data.append(SeparatorToken);
-	data.append(ba);
+    // qDebug() << "emitting readyForUse";
+    emit connectionReadyForUse(mPeerServerPort, title, this);
+}
 
-	if (write(data) == data.size()) {
-		mIsGreetingMessageSent = true;
-	}
+void DkLocalConnection::sendQuitMessage()
+{
+    QByteArray ba;
+    QDataStream ds(&ba, QIODevice::ReadWrite);
+    ds << "updating";
+
+    QByteArray data = "QUIT";
+    data.append(SeparatorToken);
+    data.append(QByteArray::number(ba.size()));
+    data.append(SeparatorToken);
+    data.append(ba);
+
+    if (write(data) == data.size()) {
+        mIsGreetingMessageSent = true;
+    }
 }
 
 }
diff --git a/ImageLounge/src/DkGui/DkConnection.h b/ImageLounge/src/DkGui/DkConnection.h
index 1201083..4a64bae 100644
--- a/ImageLounge/src/DkGui/DkConnection.h
+++ b/ImageLounge/src/DkGui/DkConnection.h
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkConnection.h
  Created on:	20.07.2011
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -27,18 +27,18 @@
 
 #pragma once
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QTcpSocket>
-#include <QRect>
-#include <QTransform>
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QHostAddress>
 #include <QImage>
-#pragma warning(pop)		// no warnings from includes - end
+#include <QRect>
+#include <QTcpSocket>
+#include <QTransform>
+#pragma warning(pop) // no warnings from includes - end
 
-#pragma warning(disable: 4251)
+#pragma warning(disable : 4251)
 
 #ifdef QT_NO_DEBUG_OUTPUT
-#pragma warning(disable: 4127)		// no 'conditional expression is constant' if qDebug() messages are removed
+#pragma warning(disable : 4127) // no 'conditional expression is constant' if qDebug() messages are removed
 #endif
 
 #ifndef DllCoreExport
@@ -54,138 +54,139 @@
 // Qt defines
 class QTimer;
 
-namespace nmc {
+namespace nmc
+{
 
 static const int MaxBufferSize = 102400000;
 static const char SeparatorToken = '<';
 
-class DllCoreExport DkConnection : public QTcpSocket {
-	Q_OBJECT
-
-	public:
-		DkConnection(QObject* parent=0);
-		~DkConnection() {
-			//qDebug() << "connection destructed...";
-		};
-
-		void release() {
-			sendNewGoodbyeMessage();
-		};
-
-		quint16 getPeerPort() { return mPortOfPeer;};
-		quint16 getPeerId() {return mPeerId;};
-		void setPeerId(quint16 peerId) { mPeerId = peerId;};
-		void setTitle(const QString& newTitle);
-
-		bool connectionCreated;
-
-	signals:
-		void connectionReadyForUse(quint16 peerServerPort, const QString& title, DkConnection* connection) const;
-		void connectionStartSynchronize(QList<quint16> synchronizedPeersOfOtherClient, DkConnection* connection) const;
-		void connectionStopSynchronize(DkConnection* connection) const;
-		void connectionTitleHasChanged(DkConnection* connection, const QString& newTitle) const;
-		void connectionNewPosition(DkConnection* connection, QRect position, bool opacity, bool overlaid) const;
-		void connectionNewTransform(DkConnection* connection, QTransform transform, QTransform imgTransform, QPointF canvasSize) const;
-		void connectionNewFile(DkConnection* connection, qint16 op, const QString& filename) const;
-		void connectionGoodBye(DkConnection* connection) const;
-		void connectionShowStatusMessage(DkConnection* connection, const QString& msg) const;
-
-	public slots:
-		virtual void sendGreetingMessage(const QString& currenTitle) = 0;
-		void sendStartSynchronizeMessage();
-		void sendStopSynchronizeMessage();
-		void sendNewTitleMessage(const QString& newtitle);
-		virtual void sendNewPositionMessage(QRect position, bool opacity, bool overlaid);
-		virtual void sendNewTransformMessage(QTransform transform, QTransform imgTransform, QPointF canvasSize);
-		virtual void sendNewFileMessage(qint16 op, const QString& filename);
-		void sendNewGoodbyeMessage();
-		void synchronizedPeersListChanged(QList<quint16> newList);
-
-
-	protected:
-		enum ConnectionState {
-			WaitingForGreeting,
-			ReadyForUse,
-			Synchronized
-		};
-		enum DataType {
-			Greeting,
-			startSynchronize,
-			stopSynchronize,
-			newTitle,
-			newPosition,
-			newTransform,
-			newFile,
-			GoodBye,
-			Undefined
-		};
-
-		virtual bool readProtocolHeader();
-		virtual void checkState();
-		int readDataIntoBuffer(int maxSize = MaxBufferSize);
-		bool readDataTypeIntoBuffer();
-		virtual void processData();
-		virtual void readWhileBytesAvailable();
-		virtual void readGreetingMessage() = 0;
-		bool hasEnoughData();
-		int dataLengthForCurrentDataType();
-		virtual bool allowedToSynchronize() {return true;};
-
-		ConnectionState mState = WaitingForGreeting; 
-		DataType mCurrentDataType = Undefined; 
-		QByteArray mBuffer;
-		QString mCurrentTitle;
-		int mNumBytesForCurrentDataType = 0;
-		quint16 mPortOfPeer = 0;  
-		quint16 mPeerServerPort = 0;
-		bool mIsGreetingMessageSent = false;
-		bool mIsSynchronizeMessageSent = false;
-
-	protected slots:
-		virtual void processReadyRead();
-
-	private slots:
-		void synchronizedTimerTimeout();
-
-	protected:
-
-		QTimer* mSynchronizedTimer;
-		QList<quint16> mSynchronizedPeersServerPorts;
-		quint16 mPeerId;
+class DllCoreExport DkConnection : public QTcpSocket
+{
+    Q_OBJECT
+
+public:
+    DkConnection(QObject *parent = 0);
+    ~DkConnection(){
+        // qDebug() << "connection destructed...";
+    };
+
+    void release()
+    {
+        sendNewGoodbyeMessage();
+    };
+
+    quint16 getPeerPort()
+    {
+        return mPortOfPeer;
+    };
+    quint16 getPeerId()
+    {
+        return mPeerId;
+    };
+    void setPeerId(quint16 peerId)
+    {
+        mPeerId = peerId;
+    };
+    void setTitle(const QString &newTitle);
+
+    bool connectionCreated;
+
+signals:
+    void connectionReadyForUse(quint16 peerServerPort, const QString &title, DkConnection *connection) const;
+    void connectionStartSynchronize(QList<quint16> synchronizedPeersOfOtherClient, DkConnection *connection) const;
+    void connectionStopSynchronize(DkConnection *connection) const;
+    void connectionTitleHasChanged(DkConnection *connection, const QString &newTitle) const;
+    void connectionNewPosition(DkConnection *connection, QRect position, bool opacity, bool overlaid) const;
+    void connectionNewTransform(DkConnection *connection, QTransform transform, QTransform imgTransform, QPointF canvasSize) const;
+    void connectionNewFile(DkConnection *connection, qint16 op, const QString &filename) const;
+    void connectionGoodBye(DkConnection *connection) const;
+    void connectionShowStatusMessage(DkConnection *connection, const QString &msg) const;
+
+public slots:
+    virtual void sendGreetingMessage(const QString &currenTitle) = 0;
+    void sendStartSynchronizeMessage();
+    void sendStopSynchronizeMessage();
+    void sendNewTitleMessage(const QString &newtitle);
+    virtual void sendNewPositionMessage(QRect position, bool opacity, bool overlaid);
+    virtual void sendNewTransformMessage(QTransform transform, QTransform imgTransform, QPointF canvasSize);
+    virtual void sendNewFileMessage(qint16 op, const QString &filename);
+    void sendNewGoodbyeMessage();
+    void synchronizedPeersListChanged(QList<quint16> newList);
+
+protected:
+    enum ConnectionState { WaitingForGreeting, ReadyForUse, Synchronized };
+    enum DataType { Greeting, startSynchronize, stopSynchronize, newTitle, newPosition, newTransform, newFile, GoodBye, Undefined };
+
+    virtual bool readProtocolHeader();
+    virtual void checkState();
+    int readDataIntoBuffer(int maxSize = MaxBufferSize);
+    bool readDataTypeIntoBuffer();
+    virtual void processData();
+    virtual void readWhileBytesAvailable();
+    virtual void readGreetingMessage() = 0;
+    bool hasEnoughData();
+    int dataLengthForCurrentDataType();
+    virtual bool allowedToSynchronize()
+    {
+        return true;
+    };
+
+    ConnectionState mState = WaitingForGreeting;
+    DataType mCurrentDataType = Undefined;
+    QByteArray mBuffer;
+    QString mCurrentTitle;
+    int mNumBytesForCurrentDataType = 0;
+    quint16 mPortOfPeer = 0;
+    quint16 mPeerServerPort = 0;
+    bool mIsGreetingMessageSent = false;
+    bool mIsSynchronizeMessageSent = false;
+
+protected slots:
+    virtual void processReadyRead();
+
+private slots:
+    void synchronizedTimerTimeout();
+
+protected:
+    QTimer *mSynchronizedTimer;
+    QList<quint16> mSynchronizedPeersServerPorts;
+    quint16 mPeerId;
 };
 
-class DllCoreExport DkLocalConnection : public DkConnection {
-	Q_OBJECT
+class DllCoreExport DkLocalConnection : public DkConnection
+{
+    Q_OBJECT
 
-	public:
-		DkLocalConnection(QObject* parent=0);
+public:
+    DkLocalConnection(QObject *parent = 0);
 
-		quint16 getLocalTcpServerPort() { return mLocalTcpServerPort;};
-		void setLocalTcpServerPort(quint16 localTcpServerPort) { mLocalTcpServerPort = localTcpServerPort;};
-		void sendGreetingMessage(const QString& currentTitle);
-		
+    quint16 getLocalTcpServerPort()
+    {
+        return mLocalTcpServerPort;
+    };
+    void setLocalTcpServerPort(quint16 localTcpServerPort)
+    {
+        mLocalTcpServerPort = localTcpServerPort;
+    };
+    void sendGreetingMessage(const QString &currentTitle);
 
-	signals:
-		void connectionQuitReceived();
+signals:
+    void connectionQuitReceived();
 
-	protected slots:
-		void processReadyRead();
-		void processData();
-		void sendQuitMessage();
+protected slots:
+    void processReadyRead();
+    void processData();
+    void sendQuitMessage();
 
-	protected:
-		enum LocalDataType {
-			Quit,
-			Undefined
-		};
+protected:
+    enum LocalDataType { Quit, Undefined };
 
-	private:
-		bool readProtocolHeader();
-		void readGreetingMessage();
+private:
+    bool readProtocolHeader();
+    void readGreetingMessage();
 
-		quint16 mLocalTcpServerPort;
-		LocalDataType mCurrentLocalDataType = Undefined;
+    quint16 mLocalTcpServerPort;
+    LocalDataType mCurrentLocalDataType = Undefined;
 };
 
 }
-
diff --git a/ImageLounge/src/DkGui/DkControlWidget.cpp b/ImageLounge/src/DkGui/DkControlWidget.cpp
index b0dca56..445cdeb 100644
--- a/ImageLounge/src/DkGui/DkControlWidget.cpp
+++ b/ImageLounge/src/DkGui/DkControlWidget.cpp
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkControlWidget.cpp
  Created on:	31.08.2015
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -27,819 +27,841 @@
 
 #include "DkControlWidget.h"
 
-#include "DkViewPort.h"
-#include "DkWidgets.h"
-#include "DkThumbsWidgets.h"
-#include "DkMetaDataWidgets.h"
+#include "DkActionManager.h"
+#include "DkMessageBox.h"
 #include "DkMetaData.h"
-#include "DkSettings.h"
+#include "DkMetaDataWidgets.h"
 #include "DkPluginInterface.h"
-#include "DkToolbars.h"
 #include "DkPluginManager.h"
-#include "DkMessageBox.h"
-#include "DkActionManager.h"
+#include "DkSettings.h"
+#include "DkThumbsWidgets.h"
+#include "DkToolbars.h"
+#include "DkViewPort.h"
+#include "DkWidgets.h"
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QStackedLayout>
-#include <QSharedPointer>
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QGridLayout>
-#include <QTransform>
 #include <QMouseEvent>
-#pragma warning(pop)		// no warnings from includes - end
-
-namespace nmc {
+#include <QSharedPointer>
+#include <QStackedLayout>
+#include <QTransform>
+#pragma warning(pop) // no warnings from includes - end
 
+namespace nmc
+{
 // DkControlWidget --------------------------------------------------------------------
-DkControlWidget::DkControlWidget(DkViewPort *parent, Qt::WindowFlags flags) : DkWidget(parent, flags) {
-
-	mViewport = parent;
-	setObjectName("DkControlWidget");
-
-	// TODO: add lazy initialization here
-	// thumbnails, metadata
-	mFilePreview = new DkFilePreview(this, flags);
-	mMetaDataInfo = new DkMetaDataHUD(this);
-	mZoomWidget = new DkZoomWidget(this);
-	mPlayer = new DkPlayer(this);
-	mPlayer->setMaximumHeight(90);
-
-	mFolderScroll = new DkFolderScrollBar(this);
-
-	// file info - overview
-	mFileInfoLabel = new DkFileInfoLabel(this);
-	mRatingLabel = new DkRatingLabelBg(2, this, flags);
-	mCommentWidget = new DkCommentWidget(this);
-
-	// delayed info
-	mDelayedInfo = new DkDelayedMessage(this);
-
-	// info labels
-	mBottomLabel = new DkLabelBg(this, "");
-	mBottomLeftLabel = new DkLabelBg(this, "");
-
-	// wheel label
-	QPixmap wp = QPixmap(":/nomacs/img/thumbs-move.svg");
-
-	mWheelButton = new QLabel(this);
-	mWheelButton->setAttribute(Qt::WA_TransparentForMouseEvents);
-	mWheelButton->setPixmap(wp);
-	mWheelButton->adjustSize();
-	mWheelButton->hide();
-
-	// image histogram
-	mHistogram = new DkHistogram(this);
-	
-	init();
-	connectWidgets();
-
-	// add mousetracking to all widgets which allows the mViewport for status updates
-	QObjectList widgets = children();
-	for (int idx = 0; idx < widgets.size(); idx++) {
-		if (QWidget* w = qobject_cast<QWidget*>(widgets.at(idx))) {
-			w->setMouseTracking(true);
-		}
-	}
-}
-
-void DkControlWidget::init() {
-
-	// debug: show invisible widgets
-	setFocusPolicy(Qt::StrongFocus);
-	setFocus(Qt::TabFocusReason);
-	setMouseTracking(true);
-
-	// connect widgets with their settings
-	mFilePreview->setDisplaySettings(&DkSettingsManager::param().app().showFilePreview);
-	mMetaDataInfo->setDisplaySettings(&DkSettingsManager::param().app().showMetaData);
-	mFileInfoLabel->setDisplaySettings(&DkSettingsManager::param().app().showFileInfoLabel);
-	mPlayer->setDisplaySettings(&DkSettingsManager::param().app().showPlayer);
-	mHistogram->setDisplaySettings(&DkSettingsManager::param().app().showHistogram);
-	mCommentWidget->setDisplaySettings(&DkSettingsManager::param().app().showComment);
-	mZoomWidget->setDisplaySettings(&DkSettingsManager::param().app().showOverview);
-	mFolderScroll->setDisplaySettings(&DkSettingsManager::param().app().showScroller);
-
-	// some adjustments
-	mBottomLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
-	mBottomLeftLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
-	mRatingLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
-	mZoomWidget->setContentsMargins(10, 10, 0, 0);
-	mCommentWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
-
-	// register actions
-	DkActionManager& am = DkActionManager::instance();
-	mFilePreview->registerAction(am.action(DkActionManager::menu_panel_preview));
-	mMetaDataInfo->registerAction(am.action(DkActionManager::menu_panel_exif));
-	mPlayer->registerAction(am.action(DkActionManager::menu_panel_player));
-	mFileInfoLabel->registerAction(am.action(DkActionManager::menu_panel_info));
-	mHistogram->registerAction(am.action(DkActionManager::menu_panel_histogram));
-	mCommentWidget->registerAction(am.action(DkActionManager::menu_panel_comment));
-	mFolderScroll->registerAction(am.action(DkActionManager::menu_panel_scroller));
-
-	// dummy - needed for three equal columns @markus: do not delete!
-	QWidget* dw = new QWidget(this);
-	dw->setMouseTracking(true);
-	QBoxLayout* dLayout = new QBoxLayout(QBoxLayout::LeftToRight, dw);
-	dLayout->setContentsMargins(0,0,0,0);
-	dLayout->addWidget(mBottomLabel);
-	dLayout->addStretch();
-
-	// zoom widget
-	QWidget* bw = new QWidget(this);
-	bw->setMouseTracking(true);
-	//bw->setMinimumHeight(40);
-	//bw->setMaximumHeight(80);
-	QVBoxLayout* zLayout = new QVBoxLayout(bw);
-	zLayout->setAlignment(Qt::AlignBottom);
-	zLayout->setContentsMargins(0,0,0,20);
-	zLayout->setSpacing(0);
-	zLayout->addWidget(mBottomLabel);
-	zLayout->addWidget(mBottomLeftLabel);
-	zLayout->addWidget(mCommentWidget);
-
-	// left column widget
-	QWidget* leftWidget = new QWidget(this);
-	leftWidget->setMouseTracking(true);
-	QBoxLayout* ulLayout = new QBoxLayout(QBoxLayout::TopToBottom, leftWidget);
-	ulLayout->setContentsMargins(0,0,0,0);
-	ulLayout->setSpacing(0);
-	ulLayout->addWidget(mZoomWidget);
-	ulLayout->addStretch();
-	ulLayout->addWidget(bw);
-	ulLayout->addWidget(dw);
-
-	// center column
-	QWidget* center = new QWidget(this);
-	center->setMouseTracking(true);
-	QVBoxLayout* cLayout = new QVBoxLayout(center);
-	cLayout->setContentsMargins(0,0,0,0);
-	cLayout->setAlignment(Qt::AlignBottom);
-	cLayout->addWidget(mPlayer);
-	
-	// rating widget
-	QWidget* rw = new QWidget(this);
-	rw->setMouseTracking(true);
-	rw->setMinimumSize(0,0);
-	QBoxLayout* rLayout = new QBoxLayout(QBoxLayout::RightToLeft, rw);
-	rLayout->setContentsMargins(0,0,0,17);
-	rLayout->addWidget(mRatingLabel);
-	rLayout->addStretch();
-
-	// file info
-	QWidget* fw = new QWidget(this);
-	fw->setContentsMargins(0,0,0,30);
-	fw->setMouseTracking(true);
-	fw->setMinimumSize(0,0);
-	QBoxLayout* rwLayout = new QBoxLayout(QBoxLayout::RightToLeft, fw);
-	rwLayout->setContentsMargins(0,0,0,0);
-	rwLayout->addWidget(mFileInfoLabel);
-	rwLayout->addStretch();
-
-	// right column
-	QWidget* hw = new QWidget(this);
-	hw->setContentsMargins(0,10,10,0);
-	hw->setMouseTracking(true);
-	QBoxLayout* hwLayout = new QBoxLayout(QBoxLayout::RightToLeft, hw);
-	hwLayout->setContentsMargins(0,0,0,0);
-	hwLayout->addWidget(mHistogram);
-	hwLayout->addStretch();
-
-	// right column
-	QWidget* rightWidget = new QWidget(this);
-	rightWidget->setMouseTracking(true);
-	QBoxLayout* lrLayout = new QBoxLayout(QBoxLayout::TopToBottom, rightWidget);
-	lrLayout->setContentsMargins(0,0,0,0);
-	lrLayout->addWidget(hw);
-	lrLayout->addStretch();
-	lrLayout->addWidget(fw);
-	lrLayout->addWidget(rw);
-	
-	// init main widgets
-	mWidgets.resize(widget_end);
-	mWidgets[hud_widget] = new QWidget(this);
-
-	// global controller layout
-	mHudLayout = new QGridLayout(mWidgets[hud_widget]);
-	mHudLayout->setContentsMargins(0,0,0,0);
-	mHudLayout->setSpacing(0);
-
-	//hudLayout->addWidget(thumbWidget, 0, 0);
-
-	// add elements
-	changeThumbNailPosition(mFilePreview->getWindowPosition());
-	changeMetaDataPosition(mMetaDataInfo->getWindowPosition());
-	//hudLayout->addWidget(filePreview, top_thumbs, left_thumbs, 1, hor_pos_end);
-	mHudLayout->addWidget(leftWidget, ver_center, left, 1, 1);
-	mHudLayout->addWidget(center, ver_center, hor_center, 1, 1);
-	mHudLayout->addWidget(rightWidget, ver_center, right, 1, 1);
-	mHudLayout->addWidget(mFolderScroll, top_scroll, left_thumbs, 1, hor_pos_end);
-
-	mLayout = new QStackedLayout(this);
-	mLayout->setContentsMargins(0,0,0,0);
-	
-	for (int idx = 0; idx < mWidgets.size(); idx++)
-		mLayout->addWidget(mWidgets[idx]);
-
-	//// debug code...
-	//centerLabel->setText("ich bin richtig...", -1);
-	//bottomLeftLabel->setText("topLeft label...", -1);
-	//spinnerLabel->show();
-	
-	show();
-}
-
-void DkControlWidget::connectWidgets() {
-
-	if (!mViewport)
-		return;
-
-	// thumbs widget
-	connect(mFilePreview, SIGNAL(loadFileSignal(const QString&)), mViewport, SLOT(loadFile(const QString&)));
-	connect(mFilePreview, SIGNAL(changeFileSignal(int)), mViewport, SLOT(loadFileFast(int)));
-	connect(mFilePreview, SIGNAL(positionChangeSignal(int)), this, SLOT(changeThumbNailPosition(int)));
-
-	// metadata widget
-	connect(mMetaDataInfo, SIGNAL(positionChangeSignal(int)), this, SLOT(changeMetaDataPosition(int)));
-
-	// overview
-	connect(mZoomWidget->getOverview(), SIGNAL(moveViewSignal(const QPointF&)), mViewport, SLOT(moveView(const QPointF&)));
-	connect(mZoomWidget->getOverview(), SIGNAL(sendTransformSignal()), mViewport, SLOT(tcpSynchronize()));
-
-	// zoom widget
-	connect(mZoomWidget, SIGNAL(zoomSignal(double)), mViewport, SLOT(zoomTo(double)));
-	connect(mViewport, SIGNAL(zoomSignal(double)), mZoomWidget, SLOT(updateZoom(double)));
-
-	// waiting
-	connect(mDelayedInfo, SIGNAL(infoSignal(const QString&, int)), this, SLOT(setInfo(const QString&, int)));
-	
-	// rating
-	connect(mFileInfoLabel->getRatingLabel(), SIGNAL(newRatingSignal(int)), this, SLOT(updateRating(int)));
-	connect(mRatingLabel, SIGNAL(newRatingSignal(int)), this, SLOT(updateRating(int)));
-	//connect(ratingLabel, SIGNAL(newRatingSignal(int)), metaDataInfo, SLOT(setRating(int)));
-
-	// playing
-	connect(mPlayer, SIGNAL(previousSignal()), mViewport, SLOT(loadPrevFileFast()));
-	connect(mPlayer, SIGNAL(nextSignal()), mViewport, SLOT(loadNextFileFast()));
-
-	// comment widget
-	connect(mCommentWidget, SIGNAL(showInfoSignal(const QString&)), this, SLOT(setInfo(const QString&)));
-
-	// mViewport
-	connect(mViewport, SIGNAL(infoSignal(const QString&)), this, SLOT(setInfo(const QString&)));
-
-	DkActionManager& am = DkActionManager::instance();
-
-	// plugins
-	if (am.pluginActionManager()) {
-		connect(am.pluginActionManager(), SIGNAL(runPlugin(DkViewPortInterface*, bool)), this, SLOT(setPluginWidget(DkViewPortInterface*, bool)));
-		connect(am.pluginActionManager(), SIGNAL(applyPluginChanges(bool)), this, SLOT(applyPluginChanges(bool)));
-	}
-
-	// actions
-	connect(am.action(DkActionManager::menu_panel_overview), SIGNAL(toggled(bool)), this, SLOT(showOverview(bool)));
-	connect(am.action(DkActionManager::menu_panel_player), SIGNAL(toggled(bool)), this, SLOT(showPlayer(bool)));
-	connect(am.action(DkActionManager::menu_panel_preview), SIGNAL(toggled(bool)), this, SLOT(showPreview(bool)));
-	connect(am.action(DkActionManager::menu_panel_scroller), SIGNAL(toggled(bool)), this, SLOT(showScroller(bool)));
-	connect(am.action(DkActionManager::menu_panel_exif), SIGNAL(toggled(bool)), this, SLOT(showMetaData(bool)));
-	connect(am.action(DkActionManager::menu_panel_info), SIGNAL(toggled(bool)), this, SLOT(showFileInfo(bool)));
-	connect(am.action(DkActionManager::menu_panel_histogram), SIGNAL(toggled(bool)), this, SLOT(showHistogram(bool)));
-	connect(am.action(DkActionManager::menu_panel_comment), SIGNAL(toggled(bool)), this, SLOT(showCommentWidget(bool)));
-	connect(am.action(DkActionManager::menu_panel_toggle), SIGNAL(toggled(bool)), this, SLOT(toggleHUD(bool)));
-}
-
-void DkControlWidget::update() {
-
-	mZoomWidget->update();
-
-	QWidget::update();
-}
-
-void DkControlWidget::showWidgetsSettings() {
-
-	if (mViewport->getImage().isNull()) {
-		showPreview(false);
-		showScroller(false);
-		showMetaData(false);
-		showFileInfo(false);
-		showPlayer(false);
-		showOverview(false);
-		showHistogram(false);
-		showCommentWidget(false);
-		return;
-	}
-
-	// do not show if hide panels is checked
-	if (DkActionManager::instance().action(DkActionManager::menu_panel_toggle)->isChecked())
-		return;
-
-	//qDebug() << "current app mode: " << DkSettingsManager::param().app().currentAppMode;
-
-	showOverview(mZoomWidget->getCurrentDisplaySetting());
-	showPreview(mFilePreview->getCurrentDisplaySetting());
-	showMetaData(mMetaDataInfo->getCurrentDisplaySetting());
-	showFileInfo(mFileInfoLabel->getCurrentDisplaySetting());
-	showPlayer(mPlayer->getCurrentDisplaySetting());
-	showHistogram(mHistogram->getCurrentDisplaySetting());
-	showCommentWidget(mCommentWidget->getCurrentDisplaySetting());
-	showScroller(mFolderScroll->getCurrentDisplaySetting());
-}
-
-void DkControlWidget::toggleHUD(bool hide) {
-	
-	if (hide)
-		setWidgetsVisible(false, false);
-	else	
-		showWidgetsSettings();
-}
-
-void DkControlWidget::setWidgetsVisible(bool visible, bool saveSettings) {
-
-	mFilePreview->setVisible(visible, saveSettings);
-	mFolderScroll->setVisible(visible, saveSettings);
-	mMetaDataInfo->setVisible(visible, saveSettings);
-	mFileInfoLabel->setVisible(visible, saveSettings);
-	mPlayer->setVisible(visible, saveSettings);
-	mZoomWidget->setVisible(visible, saveSettings);
-	mHistogram->setVisible(visible, saveSettings);
-	mCommentWidget->setVisible(visible, saveSettings);
-}
-
-void DkControlWidget::showPreview(bool visible) {
-
-	if (!mFilePreview)
-		return;
-
-	if (visible && !mFilePreview->isVisible())
-		mFilePreview->show();
-	else if (!visible && mFilePreview->isVisible())
-		mFilePreview->hide(!mViewport->getImage().isNull());	// do not save settings if we have no image in the viewport
-}
-
-void DkControlWidget::showScroller(bool visible) {
-
-	if (!mFolderScroll)
-		return;
-
-	if (visible && !mFolderScroll->isVisible())
-		mFolderScroll->show();
-	else if (!visible && mFolderScroll->isVisible())
-		mFolderScroll->hide(!mViewport->getImage().isNull());	// do not save settings if we have no image in the viewport
-}
-
-void DkControlWidget::showMetaData(bool visible) {
-
-	if (!mMetaDataInfo)
-		return;
-
-	if (visible && !mMetaDataInfo->isVisible()) {
-		mMetaDataInfo->show();
-		qDebug() << "showing metadata...";
-	}
-	else if (!visible && mMetaDataInfo->isVisible())
-		mMetaDataInfo->hide(!mViewport->getImage().isNull());	// do not save settings if we have no image in the viewport
-}
-
-void DkControlWidget::showFileInfo(bool visible) {
-
-	if (!mFileInfoLabel)
-		return;
-
-	if (visible && !mFileInfoLabel->isVisible()) {
-		mFileInfoLabel->show();
-		mRatingLabel->block(mFileInfoLabel->isVisible());
-	}
-	else if (!visible && mFileInfoLabel->isVisible()) {
-		mFileInfoLabel->hide(!mViewport->getImage().isNull());	// do not save settings if we have no image in the viewport
-		mRatingLabel->block(false);
-	}
+DkControlWidget::DkControlWidget(DkViewPort *parent, Qt::WindowFlags flags)
+    : DkWidget(parent, flags)
+{
+    mViewport = parent;
+    setObjectName("DkControlWidget");
+
+    // cropping
+    // TODO: add lazy initialization here
+    mCropWidget = new DkCropWidget(QRectF(), this);
+
+    // thumbnails, metadata
+    mFilePreview = new DkFilePreview(this, flags);
+    mMetaDataInfo = new DkMetaDataHUD(this);
+    mZoomWidget = new DkZoomWidget(this);
+    mPlayer = new DkPlayer(this);
+    mPlayer->setMaximumHeight(90);
+
+    mFolderScroll = new DkFolderScrollBar(this);
+
+    // file info - overview
+    mFileInfoLabel = new DkFileInfoLabel(this);
+    mRatingLabel = new DkRatingLabelBg(2, this, flags);
+    mCommentWidget = new DkCommentWidget(this);
+
+    // delayed info
+    mDelayedInfo = new DkDelayedMessage(this); // TODO: make a nice constructor
+
+    // info labels
+    mBottomLabel = new DkLabelBg(this, "");
+    mBottomLeftLabel = new DkLabelBg(this, "");
+
+    // wheel label
+    QPixmap wp = QPixmap(":/nomacs/img/thumbs-move.svg");
+
+    mWheelButton = new QLabel(this);
+    mWheelButton->setAttribute(Qt::WA_TransparentForMouseEvents);
+    mWheelButton->setPixmap(wp);
+    mWheelButton->adjustSize();
+    mWheelButton->hide();
+
+    // image histogram
+    mHistogram = new DkHistogram(this);
+
+    init();
+    connectWidgets();
+
+    // add mousetracking to all widgets which allows the mViewport for status updates
+    QObjectList widgets = children();
+    for (int idx = 0; idx < widgets.size(); idx++) {
+        if (QWidget *w = qobject_cast<QWidget *>(widgets.at(idx))) {
+            w->setMouseTracking(true);
+        }
+    }
+}
+
+void DkControlWidget::init()
+{
+    // debug: show invisible widgets
+    setFocusPolicy(Qt::StrongFocus);
+    setFocus(Qt::TabFocusReason);
+    setMouseTracking(true);
+
+    // connect widgets with their settings
+    mFilePreview->setDisplaySettings(&DkSettingsManager::param().app().showFilePreview);
+    mMetaDataInfo->setDisplaySettings(&DkSettingsManager::param().app().showMetaData);
+    mFileInfoLabel->setDisplaySettings(&DkSettingsManager::param().app().showFileInfoLabel);
+    mPlayer->setDisplaySettings(&DkSettingsManager::param().app().showPlayer);
+    mHistogram->setDisplaySettings(&DkSettingsManager::param().app().showHistogram);
+    mCommentWidget->setDisplaySettings(&DkSettingsManager::param().app().showComment);
+    mZoomWidget->setDisplaySettings(&DkSettingsManager::param().app().showOverview);
+    mFolderScroll->setDisplaySettings(&DkSettingsManager::param().app().showScroller);
+
+    // some adjustments
+    mBottomLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+    mBottomLeftLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+    mRatingLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+    mZoomWidget->setContentsMargins(10, 10, 0, 0);
+    mCropWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+    mCommentWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+
+    // register actions
+    DkActionManager &am = DkActionManager::instance();
+    mFilePreview->registerAction(am.action(DkActionManager::menu_panel_preview));
+    mMetaDataInfo->registerAction(am.action(DkActionManager::menu_panel_exif));
+    mPlayer->registerAction(am.action(DkActionManager::menu_panel_player));
+    mCropWidget->registerAction(am.action(DkActionManager::menu_edit_crop));
+    mFileInfoLabel->registerAction(am.action(DkActionManager::menu_panel_info));
+    mHistogram->registerAction(am.action(DkActionManager::menu_panel_histogram));
+    mCommentWidget->registerAction(am.action(DkActionManager::menu_panel_comment));
+    mFolderScroll->registerAction(am.action(DkActionManager::menu_panel_scroller));
+
+    // dummy - needed for three equal columns @markus: do not delete!
+    QWidget *dw = new QWidget(this);
+    dw->setMouseTracking(true);
+    QBoxLayout *dLayout = new QBoxLayout(QBoxLayout::LeftToRight, dw);
+    dLayout->setContentsMargins(0, 0, 0, 0);
+    dLayout->addWidget(mBottomLabel);
+    dLayout->addStretch();
+
+    // zoom widget
+    QWidget *bw = new QWidget(this);
+    bw->setMouseTracking(true);
+    // bw->setMinimumHeight(40);
+    // bw->setMaximumHeight(80);
+    QVBoxLayout *zLayout = new QVBoxLayout(bw);
+    zLayout->setAlignment(Qt::AlignBottom);
+    zLayout->setContentsMargins(0, 0, 0, 20);
+    zLayout->setSpacing(0);
+    zLayout->addWidget(mBottomLabel);
+    zLayout->addWidget(mBottomLeftLabel);
+    zLayout->addWidget(mCommentWidget);
+
+    // left column widget
+    QWidget *leftWidget = new QWidget(this);
+    leftWidget->setMouseTracking(true);
+    QBoxLayout *ulLayout = new QBoxLayout(QBoxLayout::TopToBottom, leftWidget);
+    ulLayout->setContentsMargins(0, 0, 0, 0);
+    ulLayout->setSpacing(0);
+    ulLayout->addWidget(mZoomWidget);
+    ulLayout->addStretch();
+    ulLayout->addWidget(bw);
+    ulLayout->addWidget(dw);
+
+    // center column
+    QWidget *center = new QWidget(this);
+    center->setMouseTracking(true);
+    QVBoxLayout *cLayout = new QVBoxLayout(center);
+    cLayout->setContentsMargins(0, 0, 0, 0);
+    cLayout->setAlignment(Qt::AlignBottom);
+    cLayout->addWidget(mPlayer);
+
+    // rating widget
+    QWidget *rw = new QWidget(this);
+    rw->setMouseTracking(true);
+    rw->setMinimumSize(0, 0);
+    QBoxLayout *rLayout = new QBoxLayout(QBoxLayout::RightToLeft, rw);
+    rLayout->setContentsMargins(0, 0, 0, 17);
+    rLayout->addWidget(mRatingLabel);
+    rLayout->addStretch();
+
+    // file info
+    QWidget *fw = new QWidget(this);
+    fw->setContentsMargins(0, 0, 0, 30);
+    fw->setMouseTracking(true);
+    fw->setMinimumSize(0, 0);
+    QBoxLayout *rwLayout = new QBoxLayout(QBoxLayout::RightToLeft, fw);
+    rwLayout->setContentsMargins(0, 0, 0, 0);
+    rwLayout->addWidget(mFileInfoLabel);
+    rwLayout->addStretch();
+
+    // right column
+    QWidget *hw = new QWidget(this);
+    hw->setContentsMargins(0, 10, 10, 0);
+    hw->setMouseTracking(true);
+    QBoxLayout *hwLayout = new QBoxLayout(QBoxLayout::RightToLeft, hw);
+    hwLayout->setContentsMargins(0, 0, 0, 0);
+    hwLayout->addWidget(mHistogram);
+    hwLayout->addStretch();
+
+    // right column
+    QWidget *rightWidget = new QWidget(this);
+    rightWidget->setMouseTracking(true);
+    QBoxLayout *lrLayout = new QBoxLayout(QBoxLayout::TopToBottom, rightWidget);
+    lrLayout->setContentsMargins(0, 0, 0, 0);
+    lrLayout->addWidget(hw);
+    lrLayout->addStretch();
+    lrLayout->addWidget(fw);
+    lrLayout->addWidget(rw);
+
+    // init main widgets
+    mWidgets.resize(widget_end);
+    mWidgets[hud_widget] = new QWidget(this);
+    mWidgets[crop_widget] = mCropWidget;
+
+    // global controller layout
+    mHudLayout = new QGridLayout(mWidgets[hud_widget]);
+    mHudLayout->setContentsMargins(0, 0, 0, 0);
+    mHudLayout->setSpacing(0);
+
+    // hudLayout->addWidget(thumbWidget, 0, 0);
+
+    // add elements
+    changeThumbNailPosition(mFilePreview->getWindowPosition());
+    changeMetaDataPosition(mMetaDataInfo->getWindowPosition());
+    // hudLayout->addWidget(filePreview, top_thumbs, left_thumbs, 1, hor_pos_end);
+    mHudLayout->addWidget(leftWidget, ver_center, left, 1, 1);
+    mHudLayout->addWidget(center, ver_center, hor_center, 1, 1);
+    mHudLayout->addWidget(rightWidget, ver_center, right, 1, 1);
+    mHudLayout->addWidget(mFolderScroll, top_scroll, left_thumbs, 1, hor_pos_end);
+
+    //// we need to put everything into extra widgets (which are exclusive) in order to handle the mouse events correctly
+    // QHBoxLayout* editLayout = new QHBoxLayout(widgets[crop_widget]);
+    // editLayout->setContentsMargins(0,0,0,0);
+    // editLayout->addWidget(cropWidget);
+
+    mLayout = new QStackedLayout(this);
+    mLayout->setContentsMargins(0, 0, 0, 0);
+
+    for (int idx = 0; idx < mWidgets.size(); idx++)
+        mLayout->addWidget(mWidgets[idx]);
+
+    //// debug code...
+    // centerLabel->setText("ich bin richtig...", -1);
+    // bottomLeftLabel->setText("topLeft label...", -1);
+    // spinnerLabel->show();
+
+    show();
+}
+
+void DkControlWidget::connectWidgets()
+{
+    if (!mViewport)
+        return;
+
+    // thumbs widget
+    connect(mFilePreview, SIGNAL(loadFileSignal(const QString &)), mViewport, SLOT(loadFile(const QString &)));
+    connect(mFilePreview, SIGNAL(changeFileSignal(int)), mViewport, SLOT(loadFileFast(int)));
+    connect(mFilePreview, SIGNAL(positionChangeSignal(int)), this, SLOT(changeThumbNailPosition(int)));
+
+    // metadata widget
+    connect(mMetaDataInfo, SIGNAL(positionChangeSignal(int)), this, SLOT(changeMetaDataPosition(int)));
+
+    // overview
+    connect(mZoomWidget->getOverview(), SIGNAL(moveViewSignal(const QPointF &)), mViewport, SLOT(moveView(const QPointF &)));
+    connect(mZoomWidget->getOverview(), SIGNAL(sendTransformSignal()), mViewport, SLOT(tcpSynchronize()));
+
+    // zoom widget
+    connect(mZoomWidget, SIGNAL(zoomSignal(double)), mViewport, SLOT(zoomTo(double)));
+    connect(mViewport, SIGNAL(zoomSignal(double)), mZoomWidget, SLOT(updateZoom(double)));
+
+    // waiting
+    connect(mDelayedInfo, SIGNAL(infoSignal(const QString &, int)), this, SLOT(setInfo(const QString &, int)));
+
+    // rating
+    connect(mFileInfoLabel->getRatingLabel(), SIGNAL(newRatingSignal(int)), this, SLOT(updateRating(int)));
+    connect(mRatingLabel, SIGNAL(newRatingSignal(int)), this, SLOT(updateRating(int)));
+    // connect(ratingLabel, SIGNAL(newRatingSignal(int)), metaDataInfo, SLOT(setRating(int)));
+
+    // playing
+    connect(mPlayer, SIGNAL(previousSignal()), mViewport, SLOT(loadPrevFileFast()));
+    connect(mPlayer, SIGNAL(nextSignal()), mViewport, SLOT(loadNextFileFast()));
+
+    // cropping
+    connect(mCropWidget,
+            SIGNAL(cropImageSignal(const DkRotatingRect &, const QColor &, bool)),
+            mViewport,
+            SLOT(cropImage(const DkRotatingRect &, const QColor &, bool)));
+    connect(mCropWidget, SIGNAL(hideSignal()), this, SLOT(hideCrop()));
+
+    // comment widget
+    connect(mCommentWidget, SIGNAL(showInfoSignal(const QString &)), this, SLOT(setInfo(const QString &)));
+    connect(mCommentWidget, SIGNAL(commentSavedSignal()), this, SLOT(setCommentSaved()));
+    connect(this, SIGNAL(imageUpdatedSignal()), mCommentWidget, SLOT(resetComment()));
+
+    // mViewport
+    connect(mViewport, SIGNAL(infoSignal(const QString &)), this, SLOT(setInfo(const QString &)));
+
+    DkActionManager &am = DkActionManager::instance();
+
+    // plugins
+    if (am.pluginActionManager()) {
+        connect(am.pluginActionManager(), SIGNAL(runPlugin(DkViewPortInterface *, bool)), this, SLOT(setPluginWidget(DkViewPortInterface *, bool)));
+        connect(am.pluginActionManager(), SIGNAL(applyPluginChanges(bool)), this, SLOT(applyPluginChanges(bool)));
+    }
+
+    // actions
+    connect(am.action(DkActionManager::menu_edit_crop), SIGNAL(triggered(bool)), this, SLOT(showCrop(bool)));
+    connect(am.action(DkActionManager::menu_panel_overview), SIGNAL(toggled(bool)), this, SLOT(showOverview(bool)));
+    connect(am.action(DkActionManager::menu_panel_player), SIGNAL(toggled(bool)), this, SLOT(showPlayer(bool)));
+    connect(am.action(DkActionManager::menu_panel_preview), SIGNAL(toggled(bool)), this, SLOT(showPreview(bool)));
+    connect(am.action(DkActionManager::menu_panel_scroller), SIGNAL(toggled(bool)), this, SLOT(showScroller(bool)));
+    connect(am.action(DkActionManager::menu_panel_exif), SIGNAL(toggled(bool)), this, SLOT(showMetaData(bool)));
+    connect(am.action(DkActionManager::menu_panel_info), SIGNAL(toggled(bool)), this, SLOT(showFileInfo(bool)));
+    connect(am.action(DkActionManager::menu_panel_histogram), SIGNAL(toggled(bool)), this, SLOT(showHistogram(bool)));
+    connect(am.action(DkActionManager::menu_panel_comment), SIGNAL(toggled(bool)), this, SLOT(showCommentWidget(bool)));
+    connect(am.action(DkActionManager::menu_panel_toggle), SIGNAL(toggled(bool)), this, SLOT(toggleHUD(bool)));
+}
+
+void DkControlWidget::setCommentSaved()
+{
+    mViewport->imageContainer()->setMetaData(tr("File comment"));
+}
+
+void DkControlWidget::update()
+{
+    mZoomWidget->update();
+
+    QWidget::update();
+}
+
+void DkControlWidget::showWidgetsSettings()
+{
+    if (mViewport->getImage().isNull()) {
+        showPreview(false);
+        showScroller(false);
+        showMetaData(false);
+        showFileInfo(false);
+        showPlayer(false);
+        showOverview(false);
+        showHistogram(false);
+        showCommentWidget(false);
+        return;
+    }
+
+    // do not show if hide panels is checked
+    if (DkActionManager::instance().action(DkActionManager::menu_panel_toggle)->isChecked())
+        return;
+
+    // qDebug() << "current app mode: " << DkSettingsManager::param().app().currentAppMode;
+
+    showOverview(mZoomWidget->getCurrentDisplaySetting());
+    showPreview(mFilePreview->getCurrentDisplaySetting());
+    showMetaData(mMetaDataInfo->getCurrentDisplaySetting());
+    showFileInfo(mFileInfoLabel->getCurrentDisplaySetting());
+    showPlayer(mPlayer->getCurrentDisplaySetting());
+    showHistogram(mHistogram->getCurrentDisplaySetting());
+    showCommentWidget(mCommentWidget->getCurrentDisplaySetting());
+    showScroller(mFolderScroll->getCurrentDisplaySetting());
+}
+
+void DkControlWidget::toggleHUD(bool hide)
+{
+    if (hide)
+        setWidgetsVisible(false, false);
+    else
+        showWidgetsSettings();
+}
+
+void DkControlWidget::setWidgetsVisible(bool visible, bool saveSettings)
+{
+    mFilePreview->setVisible(visible, saveSettings);
+    mFolderScroll->setVisible(visible, saveSettings);
+    mMetaDataInfo->setVisible(visible, saveSettings);
+    mFileInfoLabel->setVisible(visible, saveSettings);
+    mPlayer->setVisible(visible, saveSettings);
+    mZoomWidget->setVisible(visible, saveSettings);
+    mHistogram->setVisible(visible, saveSettings);
+    mCommentWidget->setVisible(visible, saveSettings);
+}
+
+void DkControlWidget::showPreview(bool visible)
+{
+    if (!mFilePreview)
+        return;
+
+    if (visible && !mFilePreview->isVisible())
+        mFilePreview->show();
+    else if (!visible && mFilePreview->isVisible())
+        mFilePreview->hide(!mViewport->getImage().isNull()); // do not save settings if we have no image in the viewport
+}
+
+void DkControlWidget::showScroller(bool visible)
+{
+    if (!mFolderScroll)
+        return;
+
+    if (visible && !mFolderScroll->isVisible())
+        mFolderScroll->show();
+    else if (!visible && mFolderScroll->isVisible())
+        mFolderScroll->hide(!mViewport->getImage().isNull()); // do not save settings if we have no image in the viewport
+}
+
+void DkControlWidget::showMetaData(bool visible)
+{
+    if (!mMetaDataInfo)
+        return;
+
+    if (visible && !mMetaDataInfo->isVisible()) {
+        mMetaDataInfo->show();
+        qDebug() << "showing metadata...";
+    } else if (!visible && mMetaDataInfo->isVisible())
+        mMetaDataInfo->hide(!mViewport->getImage().isNull()); // do not save settings if we have no image in the viewport
+}
+
+void DkControlWidget::showFileInfo(bool visible)
+{
+    if (!mFileInfoLabel)
+        return;
+
+    if (visible && !mFileInfoLabel->isVisible()) {
+        mFileInfoLabel->show();
+        mRatingLabel->block(mFileInfoLabel->isVisible());
+    } else if (!visible && mFileInfoLabel->isVisible()) {
+        mFileInfoLabel->hide(!mViewport->getImage().isNull()); // do not save settings if we have no image in the viewport
+        mRatingLabel->block(false);
+    }
+}
+
+void DkControlWidget::showPlayer(bool visible)
+{
+    if (!mPlayer)
+        return;
+
+    if (visible)
+        mPlayer->show();
+    else
+        mPlayer->hide(!mViewport->getImage().isNull()); // do not save settings if we have no image in the viewport
+}
+
+void DkControlWidget::startSlideshow(bool start)
+{
+    mPlayer->play(start);
 }
 
-void DkControlWidget::showPlayer(bool visible) {
-
-	if (!mPlayer)
-		return;
-
-	if (visible)
-		mPlayer->show();
-	else
-		mPlayer->hide(!mViewport->getImage().isNull());	// do not save settings if we have no image in the viewport
+void DkControlWidget::showOverview(bool visible)
+{
+    if (!mZoomWidget)
+        return;
+
+    if (visible && !mZoomWidget->isVisible()) {
+        mZoomWidget->show();
+    } else if (!visible && mZoomWidget->isVisible()) {
+        mZoomWidget->hide(!mViewport->getImage().isNull()); // do not save settings if we have no image in the mViewport
+    }
 }
 
-void DkControlWidget::startSlideshow(bool start) {
-
-	mPlayer->play(start);
+void DkControlWidget::hideCrop(bool hide /* = true */)
+{
+    showCrop(!hide);
 }
-
-void DkControlWidget::showOverview(bool visible) {
-
-	if (!mZoomWidget)
-		return;
-
-	if (visible && !mZoomWidget->isVisible()) {		
-		mZoomWidget->show();
-	}
-	else if (!visible && mZoomWidget->isVisible()) {
-		mZoomWidget->hide(!mViewport->getImage().isNull());	// do not save settings if we have no image in the mViewport
-	}
-
+
+void DkControlWidget::showCrop(bool visible)
+{
+    if (visible) {
+        mCropWidget->reset();
+        switchWidget(mWidgets[crop_widget]);
+        connect(mCropWidget->getToolbar(), SIGNAL(colorSignal(const QBrush &)), mViewport, SLOT(setBackgroundBrush(const QBrush &)));
+    } else
+        switchWidget();
 }
 
-void DkControlWidget::showHistogram(bool visible) {
-	
-	if (!mHistogram)
-		return;
+void DkControlWidget::showHistogram(bool visible)
+{
+    if (!mHistogram)
+        return;
 
-	if (visible && !mHistogram->isVisible()) {
-		mHistogram->show();
-		if(!mViewport->getImage().isNull()) mHistogram->drawHistogram(mViewport->getImage());
-		else  mHistogram->clearHistogram();
-	}
-	else if (!visible && mHistogram->isVisible()) {
-		mHistogram->hide(!mViewport->getImage().isNull());	// do not save settings if we have no image in the mViewport
-	}
+    if (visible && !mHistogram->isVisible()) {
+        mHistogram->show();
+        if (!mViewport->getImage().isNull())
+            mHistogram->drawHistogram(mViewport->getImage());
+        else
+            mHistogram->clearHistogram();
+    } else if (!visible && mHistogram->isVisible()) {
+        mHistogram->hide(!mViewport->getImage().isNull()); // do not save settings if we have no image in the mViewport
+    }
 }
 
-void DkControlWidget::showCommentWidget(bool visible) {
-
-	if (!mCommentWidget)
-		return;
+void DkControlWidget::showCommentWidget(bool visible)
+{
+    if (!mCommentWidget)
+        return;
 
-	if (visible && !mCommentWidget->isVisible()) {
-		mCommentWidget->show();
-	}
-	else if (!visible && mCommentWidget->isVisible()) {
-		mCommentWidget->hide(!mViewport->getImage().isNull());	// do not save settings if we have no image in the mViewport
-	}
+    if (visible && !mCommentWidget->isVisible()) {
+        mCommentWidget->show();
+    } else if (!visible && mCommentWidget->isVisible()) {
+        mCommentWidget->hide(!mViewport->getImage().isNull()); // do not save settings if we have no image in the mViewport
+    }
 }
 
-void DkControlWidget::switchWidget(QWidget* widget) {
+void DkControlWidget::switchWidget(QWidget *widget)
+{
+    if (mLayout->currentWidget() == widget || (!widget && mLayout->currentWidget() == mWidgets[hud_widget]))
+        return;
 
-	if (mLayout->currentWidget() == widget || (!widget && mLayout->currentWidget() == mWidgets[hud_widget]))
-		return;
+    if (widget != mWidgets[hud_widget])
+        applyPluginChanges(true);
 
-	if (widget != mWidgets[hud_widget])
-		applyPluginChanges(true);
+    if (widget)
+        mLayout->setCurrentWidget(widget);
+    else
+        mLayout->setCurrentWidget(mWidgets[hud_widget]);
 
-	if (widget)
-		mLayout->setCurrentWidget(widget);
-	else
-		mLayout->setCurrentWidget(mWidgets[hud_widget]);
-
-	//if (mLayout->currentWidget())
-	//	qDebug() << "changed to widget: " << mLayout->currentWidget();
-
-	// ok, this is really nasty... however, the pImagfileInfo layout is destroyed otherwise
-	if (mLayout->currentIndex() == hud_widget && mFileInfoLabel->isVisible()) {
-		mFileInfoLabel->setVisible(false);
-		showFileInfo(true);
-	}
+    // if (mLayout->currentWidget())
+    //	qDebug() << "changed to widget: " << mLayout->currentWidget();
 
+    // ok, this is really nasty... however, the pImagfileInfo layout is destroyed otherwise
+    if (mLayout->currentIndex() == hud_widget && mFileInfoLabel->isVisible()) {
+        mFileInfoLabel->setVisible(false);
+        showFileInfo(true);
+    }
 }
 
-bool DkControlWidget::closePlugin(bool askForSaving, bool force) {
-
+bool DkControlWidget::closePlugin(bool askForSaving, bool force)
+{
 #ifdef WITH_PLUGINS
 
-	QSharedPointer<DkPluginContainer> plugin = DkPluginManager::instance().getRunningPlugin();
+    QSharedPointer<DkPluginContainer> plugin = DkPluginManager::instance().getRunningPlugin();
 
-	if (!plugin)
-		return true;
-	
-	DkViewPortInterface* vPlugin = plugin->pluginViewPort();
+    if (!plugin)
+        return true;
 
-	if (!vPlugin) 
-		return true;
+    DkViewPortInterface *vPlugin = plugin->pluginViewPort();
 
-	// this is that complicated because we do not want plugins to have threaded containers - this could get weird
-	QSharedPointer<DkImageContainerT> pluginImage;
+    if (!vPlugin)
+        return true;
 
-	if (!force) {
-		
-		if (mViewport->imageContainer()) {
+    // this is that complicated because we do not want plugins to have threaded containers - this could get weird
+    QSharedPointer<DkImageContainerT> pluginImage;
 
-			bool applyChanges = true;
+    if (!force) {
+        if (mViewport->imageContainer()) {
+            bool applyChanges = true;
 
-			if (askForSaving) {
+            if (askForSaving) {
+                DkMessageBox *msgBox =
+                    new DkMessageBox(QMessageBox::Question, tr("Closing Plugin"), tr("Apply plugin changes?"), QMessageBox::Yes | QMessageBox::No, this);
+                msgBox->setDefaultButton(QMessageBox::Yes);
+                msgBox->setObjectName("SavePluginChanges");
 
-				DkMessageBox* msgBox = new DkMessageBox(
-					QMessageBox::Question,
-					tr("Closing Plugin"),
-					tr("Apply plugin changes?"),
-					QMessageBox::Yes | QMessageBox::No,
-					this);
-				msgBox->setDefaultButton(QMessageBox::Yes);
-				msgBox->setObjectName("SavePluginChanges");
+                int answer = msgBox->exec();
+                applyChanges = (answer == QMessageBox::Accepted || answer == QMessageBox::Yes);
+            }
 
-				int answer = msgBox->exec();
-				applyChanges = (answer == QMessageBox::Accepted || answer == QMessageBox::Yes);
-			}
+            if (applyChanges)
+                pluginImage = DkImageContainerT::fromImageContainer(vPlugin->runPlugin("", mViewport->imageContainer()));
+        } else
+            qDebug() << "[DkControlWidget] I cannot close a plugin if the image container is NULL";
+    }
 
-			if (applyChanges)
-				pluginImage = DkImageContainerT::fromImageContainer(vPlugin->runPlugin("", mViewport->imageContainer()));
-		}
-		else
-			qDebug() << "[DkControlWidget] I cannot close a plugin if the image container is NULL";
-	}
+    setPluginWidget(vPlugin, true);
+    plugin->setActive(false); // handles states
 
-	setPluginWidget(vPlugin, true);
-	plugin->setActive(false);		// handles states
+    if (!force && pluginImage) {
+        mViewport->setEditedImage(pluginImage);
+        return false;
+    }
 
-	if (!force && pluginImage) {
-		mViewport->setEditedImage(pluginImage);
-		return false;
-	}
-
-	return true;
+    return true;
 #else
-	Q_UNUSED(askForSaving);
-	Q_UNUSED(force);
+    Q_UNUSED(askForSaving);
+    Q_UNUSED(force);
 
-	return false;
+    return false;
 #endif // WITH_PLUGINS
 }
 
-bool DkControlWidget::applyPluginChanges(bool askForSaving) {
-
+bool DkControlWidget::applyPluginChanges(bool askForSaving)
+{
 #ifdef WITH_PLUGINS
-	QSharedPointer<DkPluginContainer> plugin = DkPluginManager::instance().getRunningPlugin();
+    QSharedPointer<DkPluginContainer> plugin = DkPluginManager::instance().getRunningPlugin();
 
-	if (!plugin)
-		return true;
+    if (!plugin)
+        return true;
 
-	// does the plugin want to be closed on image changes?
-	if (!plugin->plugin()->closesOnImageChange())
-		return true;
+    // does the plugin want to be closed on image changes?
+    if (!plugin->plugin()->closesOnImageChange())
+        return true;
 
-	return closePlugin(askForSaving);
+    return closePlugin(askForSaving);
 #else
-	Q_UNUSED(askForSaving);
+    Q_UNUSED(askForSaving);
 
-	return true;
+    return true;
 #endif // WITH_PLUGINS
 }
 
-void DkControlWidget::setPluginWidget(DkViewPortInterface* pluginWidget, bool removeWidget) {
+void DkControlWidget::setPluginWidget(DkViewPortInterface *pluginWidget, bool removeWidget)
+{
+    mPluginViewport = pluginWidget->getViewPort();
 
-	mPluginViewport = pluginWidget->getViewPort();
+    if (!mPluginViewport) {
+        qDebug() << "cannot set plugin widget since the viewport is NULL" << pluginWidget;
+        return;
+    }
 
-	if (!mPluginViewport) {
-		qDebug() << "cannot set plugin widget since the viewport is NULL" << pluginWidget;
-		return;
-	}
+    if (!removeWidget) {
+        mPluginViewport->setWorldMatrix(mViewport->getWorldMatrixPtr());
+        mPluginViewport->setImgMatrix(mViewport->getImageMatrixPtr());
+        mPluginViewport->updateImageContainer(mViewport->imageContainer());
 
-	if (!removeWidget) {
-		mPluginViewport->setWorldMatrix(mViewport->getWorldMatrixPtr());
-		mPluginViewport->setImgMatrix(mViewport->getImageMatrixPtr());
-		mPluginViewport->updateImageContainer(mViewport->imageContainer());
+        connect(mPluginViewport, SIGNAL(closePlugin(bool)), this, SLOT(closePlugin(bool)), Qt::UniqueConnection);
+        connect(mPluginViewport, SIGNAL(loadFile(const QString &)), mViewport, SLOT(loadFile(const QString &)), Qt::UniqueConnection);
+        connect(mPluginViewport, SIGNAL(loadImage(const QImage &)), mViewport, SLOT(setImage(const QImage &)), Qt::UniqueConnection);
+        connect(mPluginViewport, SIGNAL(showInfo(const QString &)), this, SLOT(setInfo(const QString &)), Qt::UniqueConnection);
+    }
 
-		connect(mPluginViewport, SIGNAL(closePlugin(bool)), this, SLOT(closePlugin(bool)), Qt::UniqueConnection);
-		connect(mPluginViewport, SIGNAL(loadFile(const QString&)), mViewport, SLOT(loadFile(const QString&)), Qt::UniqueConnection);
-		connect(mPluginViewport, SIGNAL(loadImage(const QImage&)), mViewport, SLOT(setImage(const QImage&)), Qt::UniqueConnection);
-		connect(mPluginViewport, SIGNAL(showInfo(const QString&)), this, SLOT(setInfo(const QString&)), Qt::UniqueConnection);
-	}
+    setAttribute(Qt::WA_TransparentForMouseEvents, !removeWidget && pluginWidget->hideHUD());
 
-	setAttribute(Qt::WA_TransparentForMouseEvents, !removeWidget && pluginWidget->hideHUD());
-	
-	if (pluginWidget->hideHUD() && !removeWidget) {
-		setWidgetsVisible(false, false);
-	}
-	else if (pluginWidget->hideHUD())
-		showWidgetsSettings();
+    if (pluginWidget->hideHUD() && !removeWidget) {
+        setWidgetsVisible(false, false);
+    } else if (pluginWidget->hideHUD())
+        showWidgetsSettings();
 
-	mViewport->setPaintWidget(dynamic_cast<QWidget*>(mPluginViewport), removeWidget);
+    mViewport->setPaintWidget(dynamic_cast<QWidget *>(mPluginViewport), removeWidget);
 
-	if (removeWidget) {
-		mPluginViewport = 0;
-	}
+    if (removeWidget) {
+        mPluginViewport = 0;
+    }
 }
 
-void DkControlWidget::updateImage(QSharedPointer<DkImageContainerT> imgC) {
+void DkControlWidget::updateImage(QSharedPointer<DkImageContainerT> imgC)
+{
+    mImgC = imgC;
 
-	mImgC = imgC;
+    if (mPluginViewport)
+        mPluginViewport->updateImageContainer(imgC);
 
-	if (mPluginViewport)
-		mPluginViewport->updateImageContainer(imgC);
+    if (!imgC)
+        return;
 
-	if (!imgC)
-		return;
+    QSharedPointer<DkMetaDataT> metaData = imgC->getMetaData();
 
-	QSharedPointer<DkMetaDataT> metaData = imgC->getMetaData();
-
-	QString dateString = metaData->getExifValue("DateTimeOriginal");
-	mFileInfoLabel->updateInfo(imgC->filePath(), "", dateString, metaData->getRating());
-	mFileInfoLabel->setEdited(imgC->isEdited());
-	mCommentWidget->setMetaData(metaData);
-	updateRating(metaData->getRating());
+    QString dateString = metaData->getExifValue("DateTimeOriginal");
+    mFileInfoLabel->updateInfo(imgC->filePath(), "", dateString, metaData->getRating());
+    mFileInfoLabel->setEdited(imgC->isEdited());
+    mCommentWidget->setMetaData(metaData); // reset
+    updateRating(metaData->getRating());
 
+    connect(imgC.get(), SIGNAL(imageUpdatedSignal()), this, SIGNAL(imageUpdatedSignal()));
 }
 
-void DkControlWidget::setInfo(const QString& msg, int time, int location) {
-
-	if (location == bottom_left_label && mBottomLabel)
-		mBottomLabel->setText(msg, time);
-	else if (location == top_left_label && mBottomLeftLabel)
-		mBottomLeftLabel->setText(msg, time);
+void DkControlWidget::setInfo(const QString &msg, int time, int location)
+{
+    if (location == bottom_left_label && mBottomLabel)
+        mBottomLabel->setText(msg, time);
+    else if (location == top_left_label && mBottomLeftLabel)
+        mBottomLeftLabel->setText(msg, time);
 
-	update();
+    update();
 }
 
-void DkControlWidget::setInfoDelayed(const QString& msg, bool start, int delayTime) {
-
-	if (start)
-		mDelayedInfo->setInfo(msg, delayTime);
-	else
-		mDelayedInfo->stop();
+void DkControlWidget::setInfoDelayed(const QString &msg, bool start, int delayTime)
+{
+    if (start)
+        mDelayedInfo->setInfo(msg, delayTime);
+    else
+        mDelayedInfo->stop();
 }
 
-void DkControlWidget::changeMetaDataPosition(int pos) {
-
-	if (pos == DkFadeWidget::pos_west) {
-		mHudLayout->addWidget(mMetaDataInfo, top_metadata, left_metadata, bottom_metadata-top_metadata, 1);	
-	}
-	else if (pos == DkFadeWidget::pos_east) {
-		mHudLayout->addWidget(mMetaDataInfo, top_metadata, right_metadata, bottom_metadata-top_metadata, 1);	
-	}
-	else if (pos == DkFadeWidget::pos_north) {
-		mHudLayout->addWidget(mMetaDataInfo, top_metadata, left_metadata, 1, hor_pos_end-2);	
-	}
-	else if (pos == DkFadeWidget::pos_south) {
-		mHudLayout->addWidget(mMetaDataInfo, bottom_metadata, left_metadata, 1, hor_pos_end-2);	
-	}
+void DkControlWidget::changeMetaDataPosition(int pos)
+{
+    if (pos == DkFadeWidget::pos_west) {
+        mHudLayout->addWidget(mMetaDataInfo, top_metadata, left_metadata, bottom_metadata - top_metadata, 1);
+    } else if (pos == DkFadeWidget::pos_east) {
+        mHudLayout->addWidget(mMetaDataInfo, top_metadata, right_metadata, bottom_metadata - top_metadata, 1);
+    } else if (pos == DkFadeWidget::pos_north) {
+        mHudLayout->addWidget(mMetaDataInfo, top_metadata, left_metadata, 1, hor_pos_end - 2);
+    } else if (pos == DkFadeWidget::pos_south) {
+        mHudLayout->addWidget(mMetaDataInfo, bottom_metadata, left_metadata, 1, hor_pos_end - 2);
+    }
 }
 
-void DkControlWidget::changeThumbNailPosition(int pos) {
-
-	if (pos == DkFadeWidget::pos_west) {
-		mHudLayout->addWidget(mFilePreview, top_thumbs, left_thumbs, ver_pos_end, 1);	
-	}
-	else if (pos == DkFadeWidget::pos_east) {
-		mHudLayout->addWidget(mFilePreview, top_thumbs, right_thumbs, ver_pos_end, 1);	
-	}
-	else if (pos == DkFadeWidget::pos_north) {
-		mHudLayout->addWidget(mFilePreview, top_thumbs, left_thumbs, 1, hor_pos_end);	
-	}
-	else if (pos == DkFadeWidget::pos_south) {
-		mHudLayout->addWidget(mFilePreview, bottom_thumbs, left_thumbs, 1, hor_pos_end);	
-	}
-	else 
-		mFilePreview->hide();
-
+void DkControlWidget::changeThumbNailPosition(int pos)
+{
+    if (pos == DkFadeWidget::pos_west) {
+        mHudLayout->addWidget(mFilePreview, top_thumbs, left_thumbs, ver_pos_end, 1);
+    } else if (pos == DkFadeWidget::pos_east) {
+        mHudLayout->addWidget(mFilePreview, top_thumbs, right_thumbs, ver_pos_end, 1);
+    } else if (pos == DkFadeWidget::pos_north) {
+        mHudLayout->addWidget(mFilePreview, top_thumbs, left_thumbs, 1, hor_pos_end);
+    } else if (pos == DkFadeWidget::pos_south) {
+        mHudLayout->addWidget(mFilePreview, bottom_thumbs, left_thumbs, 1, hor_pos_end);
+    } else
+        mFilePreview->hide();
 }
 
-void DkControlWidget::stopLabels() {
-
-	mBottomLeftLabel->stop();
-	mBottomLabel->stop();
-	// TODO
-	//mProgressBar->hide();
+void DkControlWidget::stopLabels()
+{
+    mBottomLeftLabel->stop();
+    mBottomLabel->stop();
+    // TODO
+    // mProgressBar->hide();
 
-	switchWidget();
+    switchWidget();
 }
 
-void DkControlWidget::settingsChanged() {
-
-	if (mFileInfoLabel && mFileInfoLabel->isVisible()) {
-		showFileInfo(false);	// just a hack but all states are preserved this way
-		showFileInfo(true);
-	}
-
+void DkControlWidget::settingsChanged()
+{
+    if (mFileInfoLabel && mFileInfoLabel->isVisible()) {
+        showFileInfo(false); // just a hack but all states are preserved this way
+        showFileInfo(true);
+    }
 }
 
-void DkControlWidget::setTransforms(QTransform* worldMatrix, QTransform* imgMatrix) {
-
-	mZoomWidget->getOverview()->setTransforms(worldMatrix, imgMatrix);
-}
+void DkControlWidget::updateRating(int rating)
+{
+    if (!mImgC)
+        return;
 
-void DkControlWidget::updateRating(int rating) {
+    mRatingLabel->setRating(rating);
 
-	if (!mImgC)
-		return;
+    if (mFileInfoLabel)
+        mFileInfoLabel->updateRating(rating);
 
-	mRatingLabel->setRating(rating);
-
-	if (mFileInfoLabel)
-		mFileInfoLabel->updateRating(rating);
-
-	QSharedPointer<DkMetaDataT> metaDataInfo = mImgC->getMetaData();
-	metaDataInfo->setRating(rating);
+    QSharedPointer<DkMetaDataT> metaDataInfo = mImgC->getMetaData();
+    metaDataInfo->setRating(rating);
 }
 
-void DkControlWidget::imageLoaded(bool) {
-
-	showWidgetsSettings();
+void DkControlWidget::imageLoaded(bool)
+{
+    showWidgetsSettings();
 }
 
-void DkControlWidget::setFullScreen(bool fullscreen) {
-
-	showWidgetsSettings();
+void DkControlWidget::setFullScreen(bool fullscreen)
+{
+    showWidgetsSettings();
 
-	if (DkSettingsManager::param().slideShow().showPlayer &&
-		fullscreen &&
-		!mPlayer->isVisible())
-		mPlayer->show(3000);
+    if (DkSettingsManager::param().slideShow().showPlayer && fullscreen && !mPlayer->isVisible())
+        mPlayer->show(3000);
 }
 
-DkMetaDataHUD * DkControlWidget::getMetaDataWidget() const {
-	return mMetaDataInfo;
+DkMetaDataHUD *DkControlWidget::getMetaDataWidget() const
+{
+    return mMetaDataInfo;
 }
 
-DkCommentWidget * DkControlWidget::getCommentWidget() const {
-	return mCommentWidget;
+DkCommentWidget *DkControlWidget::getCommentWidget() const
+{
+    return mCommentWidget;
 }
 
-DkOverview * DkControlWidget::getOverview() const {
-	return mZoomWidget->getOverview();
+DkOverview *DkControlWidget::getOverview() const
+{
+    return mZoomWidget->getOverview();
 }
 
-DkZoomWidget * DkControlWidget::getZoomWidget() const {
-	return mZoomWidget;
+DkZoomWidget *DkControlWidget::getZoomWidget() const
+{
+    return mZoomWidget;
 }
 
-DkPlayer * DkControlWidget::getPlayer() const {
-	return mPlayer;
+DkPlayer *DkControlWidget::getPlayer() const
+{
+    return mPlayer;
 }
 
-DkFileInfoLabel * DkControlWidget::getFileInfoLabel() const {
-	return mFileInfoLabel;
+DkFileInfoLabel *DkControlWidget::getFileInfoLabel() const
+{
+    return mFileInfoLabel;
 }
 
-DkHistogram * DkControlWidget::getHistogram() const {
-	return mHistogram;
-}
-
-DkFilePreview * DkControlWidget::getFilePreview() const {
-	return mFilePreview;
-}
-
-DkFolderScrollBar * DkControlWidget::getScroller() const {
-	return mFolderScroll;
-}
-
-// DkControlWidget - Events --------------------------------------------------------------------
-void DkControlWidget::mousePressEvent(QMouseEvent *event) {
-
-	mEnterPos = event->pos();
-
-	if (mFilePreview && mFilePreview->isVisible() && event->buttons() == Qt::MiddleButton) {
-
-		QTimer* mImgTimer = mFilePreview->getMoveImageTimer();
-		mImgTimer->start(1);
-
-		// show icon
-		mWheelButton->move(event->pos().x()-16, event->pos().y()-16);
-		mWheelButton->show();
-	}
-
-	if (mPluginViewport)
-		QCoreApplication::sendEvent(mPluginViewport, event);
-	else
-		QWidget::mousePressEvent(event);
-
+DkHistogram *DkControlWidget::getHistogram() const
+{
+    return mHistogram;
 }
 
-void DkControlWidget::mouseReleaseEvent(QMouseEvent *event) {
-
-	if (mFilePreview && mFilePreview->isVisible()) {
-		mFilePreview->setCurrentDx(0);
-		QTimer* mImgTimer = mFilePreview->getMoveImageTimer();
-		mImgTimer->stop();
-		mWheelButton->hide();
-	}
-
-	if (mPluginViewport)
-		QCoreApplication::sendEvent(mPluginViewport, event);
-	else
-		QWidget::mouseReleaseEvent(event);
+DkCropWidget *DkControlWidget::getCropWidget() const
+{
+    return mCropWidget;
 }
 
-void DkControlWidget::mouseMoveEvent(QMouseEvent *event) {
-
-	// scroll thumbs preview
-	if (mFilePreview && mFilePreview->isVisible() && event->buttons() == Qt::MiddleButton) {
-		
-		float dx = (float)std::fabs(mEnterPos.x() - event->pos().x())*0.015f;
-		dx = std::exp(dx);
-		if (mEnterPos.x() - event->pos().x() < 0)
-			dx = -dx;
-
-		mFilePreview->setCurrentDx(dx);	// update dx
-	}
-
-	if (mPluginViewport)
-		QCoreApplication::sendEvent(mPluginViewport, event);
-	else
-		QWidget::mouseMoveEvent(event);
+DkFilePreview *DkControlWidget::getFilePreview() const
+{
+    return mFilePreview;
 }
 
-
-
-void DkControlWidget::keyPressEvent(QKeyEvent *event) {
-	
-	QWidget::keyPressEvent(event);
+DkFolderScrollBar *DkControlWidget::getScroller() const
+{
+    return mFolderScroll;
 }
 
-void DkControlWidget::keyReleaseEvent(QKeyEvent *event) {
-
-	QWidget::keyReleaseEvent(event);
+// DkControlWidget - Events --------------------------------------------------------------------
+void DkControlWidget::mousePressEvent(QMouseEvent *event)
+{
+    mEnterPos = event->pos();
+
+    if (mFilePreview && mFilePreview->isVisible() && event->buttons() == Qt::MiddleButton) {
+        QTimer *mImgTimer = mFilePreview->getMoveImageTimer();
+        mImgTimer->start(1);
+
+        // show icon
+        mWheelButton->move(event->pos().x() - 16, event->pos().y() - 16);
+        mWheelButton->show();
+    }
+
+    if (mPluginViewport)
+        QCoreApplication::sendEvent(mPluginViewport, event);
+    else
+        QWidget::mousePressEvent(event);
+}
+
+void DkControlWidget::mouseReleaseEvent(QMouseEvent *event)
+{
+    if (mFilePreview && mFilePreview->isVisible()) {
+        mFilePreview->setCurrentDx(0);
+        QTimer *mImgTimer = mFilePreview->getMoveImageTimer();
+        mImgTimer->stop();
+        mWheelButton->hide();
+    }
+
+    if (mPluginViewport)
+        QCoreApplication::sendEvent(mPluginViewport, event);
+    else
+        QWidget::mouseReleaseEvent(event);
+}
+
+void DkControlWidget::mouseMoveEvent(QMouseEvent *event)
+{
+    // scroll thumbs preview
+    if (mFilePreview && mFilePreview->isVisible() && event->buttons() == Qt::MiddleButton) {
+        float dx = (float)std::fabs(mEnterPos.x() - event->pos().x()) * 0.015f;
+        dx = std::exp(dx);
+        if (mEnterPos.x() - event->pos().x() < 0)
+            dx = -dx;
+
+        mFilePreview->setCurrentDx(dx); // update dx
+    }
+
+    if (mPluginViewport)
+        QCoreApplication::sendEvent(mPluginViewport, event);
+    else
+        QWidget::mouseMoveEvent(event);
+}
+
+void DkControlWidget::keyPressEvent(QKeyEvent *event)
+{
+    QWidget::keyPressEvent(event);
+}
+
+void DkControlWidget::keyReleaseEvent(QKeyEvent *event)
+{
+    QWidget::keyReleaseEvent(event);
 }
 
 }
diff --git a/ImageLounge/src/DkGui/DkControlWidget.h b/ImageLounge/src/DkGui/DkControlWidget.h
index 9dc02a5..87dba22 100644
--- a/ImageLounge/src/DkGui/DkControlWidget.h
+++ b/ImageLounge/src/DkGui/DkControlWidget.h
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkControlWidget.h
  Created on:	31.08.2015
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -27,13 +27,13 @@
 
 #pragma once
 
-#include "DkImageContainer.h"
 #include "DkBaseWidgets.h"
+#include "DkImageContainer.h"
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QWidget>
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QSharedPointer>
-#pragma warning(pop)		// no warnings from includes - end
+#include <QWidget>
+#pragma warning(pop) // no warnings from includes - end
 
 #ifndef DllCoreExport
 #ifdef DK_CORE_DLL_EXPORT
@@ -45,23 +45,23 @@
 #endif
 #endif
 
-
 #ifdef Q_OS_WIN
-#pragma warning(disable: 4251)	// TODO: remove
+#pragma warning(disable : 4251) // TODO: remove
 #endif
 
 class QStackedLayout;
 class QGridLayout;
 class QLabel;
 
-namespace nmc {
-
+namespace nmc
+{
 // some dummies
 class DkFilePreview;
 class DkThumbScrollWidget;
 class DkMetaDataHUD;
 class DkCommentWidget;
 class DkViewPort;
+class DkCropWidget;
 class DkZoomWidget;
 class DkPlayer;
 class DkFolderScrollBar;
@@ -76,123 +76,126 @@ class DkDelayedInfo;
 class DkOverview;
 class DkViewPortInterface;
 
-class DllCoreExport DkControlWidget : public DkWidget {
-	Q_OBJECT
+class DllCoreExport DkControlWidget : public DkWidget
+{
+    Q_OBJECT
 
 public:
-	
-	enum VerPos {top_scroll = 0, top_thumbs, top_metadata, top_info, ver_center, bottom_info, bottom, bottom_metadata, bottom_thumbs, ver_pos_end};
-	enum HorPos {left_thumbs = 0, left_metadata, left, hor_center, right, right_metadata, right_thumbs, hor_pos_end};
-
-	enum InfoPos {
-		bottom_left_label,
-		bottom_right_label,
-		top_left_label
-	};
+    enum VerPos { top_scroll = 0, top_thumbs, top_metadata, top_info, ver_center, bottom_info, bottom, bottom_metadata, bottom_thumbs, ver_pos_end };
+    enum HorPos { left_thumbs = 0, left_metadata, left, hor_center, right, right_metadata, right_thumbs, hor_pos_end };
 
-	enum Widgets {
-		last_widget = -1,
-		hud_widget,
+    enum InfoPos { bottom_left_label, bottom_right_label, top_left_label };
 
-		widget_end
-	};
+    enum Widgets {
+        last_widget = -1,
+        hud_widget,
+        crop_widget,
 
-	DkControlWidget(DkViewPort *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
-	virtual ~DkControlWidget() {};
+        widget_end
+    };
 
-	void setFullScreen(bool fullscreen);
+    DkControlWidget(DkViewPort *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
+    virtual ~DkControlWidget(){};
 
-	DkFilePreview* getFilePreview() const;
-	DkFolderScrollBar* getScroller() const;
-	DkMetaDataHUD* getMetaDataWidget() const;
-	DkCommentWidget* getCommentWidget() const;
-	DkOverview* getOverview() const;
-	DkZoomWidget* getZoomWidget() const;
-	DkPlayer* getPlayer() const;
-	DkFileInfoLabel* getFileInfoLabel() const;
-	DkHistogram* getHistogram() const;
+    void setFullScreen(bool fullscreen);
 
-	void stopLabels();
-	void showWidgetsSettings();
-	void setWidgetsVisible(bool visible, bool saveSettings = false);
+    DkFilePreview *getFilePreview() const;
+    DkFolderScrollBar *getScroller() const;
+    DkMetaDataHUD *getMetaDataWidget() const;
+    DkCommentWidget *getCommentWidget() const;
+    DkOverview *getOverview() const;
+    DkZoomWidget *getZoomWidget() const;
+    DkPlayer *getPlayer() const;
+    DkFileInfoLabel *getFileInfoLabel() const;
+    DkHistogram *getHistogram() const;
+    DkCropWidget *getCropWidget() const;
 
-	void settingsChanged();
+    void stopLabels();
+    void showWidgetsSettings();
+    void setWidgetsVisible(bool visible, bool saveSettings = false);
 
-	void setTransforms(QTransform* worldMatrix, QTransform* imgMatrix);
+    void settingsChanged();
 
 public slots:
-	void toggleHUD(bool hide);
-	void showPreview(bool visible);
-	void showMetaData(bool visible);
-	void showFileInfo(bool visible);
-	void showPlayer(bool visible);
-	void startSlideshow(bool start = true);
-	void showOverview(bool visible);
-	void showHistogram(bool visible);
-	void showCommentWidget(bool visible);
-	void switchWidget(QWidget* widget = 0);
-	void changeMetaDataPosition(int pos);
-	void changeThumbNailPosition(int pos);
-	void showScroller(bool visible);
-	void setPluginWidget(DkViewPortInterface* pluginWidget, bool removeWidget);
-
-	bool closePlugin(bool askForSaving, bool force = false);
-	bool applyPluginChanges(bool askForSaving);
-
-	void updateImage(QSharedPointer<DkImageContainerT> imgC);
-	void setInfo(const QString& msg, int time = 3000, int location = bottom_left_label);
-	virtual void setInfoDelayed(const QString& msg, bool start = false, int delayTime = 1000);
-	void updateRating(int rating);
-
-	void imageLoaded(bool loaded);
-
-	void update();
+    void toggleHUD(bool hide);
+    void showPreview(bool visible);
+    void showMetaData(bool visible);
+    void showFileInfo(bool visible);
+    void showPlayer(bool visible);
+    void startSlideshow(bool start = true);
+    void hideCrop(bool hide = true);
+    void showCrop(bool visible);
+    void showOverview(bool visible);
+    void showHistogram(bool visible);
+    void showCommentWidget(bool visible);
+    void switchWidget(QWidget *widget = 0);
+    void changeMetaDataPosition(int pos);
+    void changeThumbNailPosition(int pos);
+    void showScroller(bool visible);
+    void setPluginWidget(DkViewPortInterface *pluginWidget, bool removeWidget);
+
+    bool closePlugin(bool askForSaving, bool force = false);
+    bool applyPluginChanges(bool askForSaving);
+
+    void updateImage(QSharedPointer<DkImageContainerT> imgC);
+    void setInfo(const QString &msg, int time = 3000, int location = bottom_left_label);
+    virtual void setInfoDelayed(const QString &msg, bool start = false, int delayTime = 1000);
+    void updateRating(int rating);
+
+    void imageLoaded(bool loaded);
+
+    void update();
+
+signals:
+    void imageUpdatedSignal();
+
+protected slots:
+    void setCommentSaved();
 
 protected:
+    // events
+    void mousePressEvent(QMouseEvent *event) override;
+    void mouseReleaseEvent(QMouseEvent *event) override;
+    void mouseMoveEvent(QMouseEvent *event) override;
 
-	// events
-	void mousePressEvent(QMouseEvent *event) override;
-	void mouseReleaseEvent(QMouseEvent *event) override;
-	void mouseMoveEvent(QMouseEvent *event) override;
+    void keyPressEvent(QKeyEvent *event) override;
+    void keyReleaseEvent(QKeyEvent *event) override;
 
-	void keyPressEvent(QKeyEvent *event) override;
-	void keyReleaseEvent(QKeyEvent *event) override;
+    // functions
+    void init();
+    void connectWidgets();
 
-	// functions
-	void init();
-	void connectWidgets();
-	
-	// layout (switching of HUD contexts)
-	QVector<QWidget*> mWidgets;
-	QStackedLayout* mLayout;
-	QGridLayout* mHudLayout;
+    // layout (switching of HUD contexts)
+    QVector<QWidget *> mWidgets;
+    QStackedLayout *mLayout;
+    QGridLayout *mHudLayout;
 
-	DkViewPort* mViewport;
+    DkViewPort *mViewport;
+    DkCropWidget *mCropWidget;
 
-	DkFilePreview* mFilePreview;
-	DkMetaDataHUD* mMetaDataInfo;
-	DkCommentWidget* mCommentWidget;
-	DkZoomWidget* mZoomWidget;
-	DkPlayer* mPlayer;
-	DkHistogram* mHistogram;
-	
-	DkFolderScrollBar* mFolderScroll;
-	DkFileInfoLabel* mFileInfoLabel;
-	DkRatingLabelBg* mRatingLabel;
+    DkFilePreview *mFilePreview;
+    DkMetaDataHUD *mMetaDataInfo;
+    DkCommentWidget *mCommentWidget;
+    DkZoomWidget *mZoomWidget;
+    DkPlayer *mPlayer;
+    DkHistogram *mHistogram;
 
-	DkDelayedMessage* mDelayedInfo;
+    DkFolderScrollBar *mFolderScroll;
+    DkFileInfoLabel *mFileInfoLabel;
+    DkRatingLabelBg *mRatingLabel;
 
-	DkLabelBg* mBottomLabel;
-	DkLabelBg* mBottomLeftLabel;
+    DkDelayedMessage *mDelayedInfo;
 
-	DkPluginViewPort* mPluginViewport = 0;
+    DkLabelBg *mBottomLabel;
+    DkLabelBg *mBottomLeftLabel;
 
-	QSharedPointer<DkImageContainerT> mImgC;
+    DkPluginViewPort *mPluginViewport = 0;
 
-	QLabel* mWheelButton;
+    QSharedPointer<DkImageContainerT> mImgC;
 
-	QPointF mEnterPos;
+    QLabel *mWheelButton;
 
+    QPointF mEnterPos;
 };
 
 }
diff --git a/ImageLounge/src/DkGui/DkCropWidgets.cpp b/ImageLounge/src/DkGui/DkCropWidgets.cpp
deleted file mode 100644
index b3e8cec..0000000
--- a/ImageLounge/src/DkGui/DkCropWidgets.cpp
+++ /dev/null
@@ -1,942 +0,0 @@
-/*******************************************************************************************************
- nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
- Copyright (C) 2011-2016 Markus Diem <markus@nomacs.org>
- Copyright (C) 2011-2016 Stefan Fiel <stefan@nomacs.org>
- Copyright (C) 2011-2016 Florian Kleber <florian@nomacs.org>
-
- This file is part of nomacs.
-
- nomacs is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- nomacs is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
- related links:
- [1] http://www.nomacs.org/
- [2] https://github.com/nomacs/
- [3] http://download.nomacs.org
- *******************************************************************************************************/
-
-#include "DkCropWidgets.h"
-
-#include "DkBasicWidgets.h"
-#include "DkSettings.h"
-#include "DkUtils.h"
-#include "DkMath.h"
-#include "DkImageContainer.h"
-#include "DkActionManager.h"
-#include "DkBasicLoader.h"
-
-#pragma warning(push, 0)	// no warnings from includes
-#include <QPainter>
-#include <QPainterPath>
-#include <QDebug>
-#include <QMouseEvent>
-#include <QComboBox>
-#include <QPushButton>
-#include <QMessageBox>
-
-#include <QMainWindow>
-#include <QHBoxLayout>
-#include <QSlider>
-#pragma warning(pop)
-
-namespace nmc {
-
-// DkCropViewPort --------------------------------------------------------------------
-DkCropViewPort::DkCropViewPort(QWidget* parent /* = 0*/) : DkBaseViewPort(parent) {
-
-	mViewportRect = canvas();
-	mPanControl = QPointF(0, 0);
-	mMinZoom = 1.0;
-	mImgWithin = false;
-
-	mCropArea.setWorldMatrix(&mWorldMatrix);
-	mCropArea.setImageRect(&mImgViewRect);
-
-	DkActionManager& am = DkActionManager::instance();
-
-	connect(am.action(DkActionManager::menu_edit_rotate_cw), SIGNAL(triggered()), this, SLOT(rotateCW()));
-	connect(am.action(DkActionManager::menu_edit_rotate_ccw), SIGNAL(triggered()), this, SLOT(rotateCCW()));
-	connect(am.action(DkActionManager::menu_edit_rotate_180), SIGNAL(triggered()), this, SLOT(rotate180()));
-
-	connect(am.action(DkActionManager::menu_view_reset), SIGNAL(triggered()), this, SLOT(resetView()));
-	connect(am.action(DkActionManager::menu_view_100), SIGNAL(triggered()), this, SLOT(fullView()));
-	connect(am.action(DkActionManager::menu_view_zoom_in), SIGNAL(triggered()), this, SLOT(zoomIn()));
-	connect(am.action(DkActionManager::menu_view_zoom_out), SIGNAL(triggered()), this, SLOT(zoomOut()));
-	connect(am.action(DkActionManager::menu_view_tp_pattern), SIGNAL(toggled(bool)), this, SLOT(togglePattern(bool)));
-}
-
-void DkCropViewPort::mouseDoubleClickEvent(QMouseEvent* ev) {
-
-    crop();
-    QWidget::mouseDoubleClickEvent(ev);
-}
-
-void DkCropViewPort::mouseMoveEvent(QMouseEvent* ev) {
-
-
-	if (ev->buttons() & Qt::LeftButton) {
-
-		if (mCropArea.currentHandle() != DkCropArea::h_move)
-			mCropArea.update(ev->pos());
-		
-		update();
-
-		mLastMousePos = ev->pos();
-	}
-
-	// propagate moves
-	if (mCropArea.currentHandle() == DkCropArea::h_move) {
-
-		ev->ignore();
-		DkBaseViewPort::mouseMoveEvent(ev);
-	} 
-	else {
-		QCursor c = mCropArea.cursor(ev->pos());
-		setCursor(c);
-	}
-}
-
-void DkCropViewPort::mousePressEvent(QMouseEvent* ev) {
-
-	mLastMousePos = ev->pos();
-	mCropArea.updateHandle(ev->pos());
-	
-	// propagate moves
-	if (mCropArea.currentHandle() == DkCropArea::h_move)
-		DkBaseViewPort::mousePressEvent(ev);
-}
-
-void DkCropViewPort::mouseReleaseEvent(QMouseEvent* ev) {
-
-	mCropArea.resetHandle();
-
-	// propagate moves
-	if (mCropArea.currentHandle() == DkCropArea::h_move)
-		DkBaseViewPort::mouseReleaseEvent(ev);
-
-	recenter();
-}
-
-void DkCropViewPort::paintEvent(QPaintEvent* pe) {
-	
-	DkBaseViewPort::paintEvent(pe);
-
-	// create path
-	QPainterPath path;
-	QRect canvas(
-		geometry().x() - mStyle.pen().width(),
-		geometry().y() - mStyle.pen().width(),
-		geometry().width() + 2*mStyle.pen().width(),
-		geometry().height() + 2*mStyle.pen().width()
-		);
-	path.addRect(canvas);
-
-	QRectF crop = mCropArea.rect();
-	path.addRect(crop);
-
-	// init painter
-	QPainter painter(viewport());
-
-	painter.setPen(mStyle.pen());
-	painter.setBrush(mStyle.bgBrush());
-	painter.setRenderHint(QPainter::Antialiasing);
-
-	painter.drawPath(path);
-
-	// draw guides
-	auto drawGuides = [&](int N = 3) {
-
-		for (int idx = 0; idx < N; idx++) {
-
-			// vertical lines
-			double l = crop.left() + crop.width() / N * idx;
-			QLineF line(QPointF(l, crop.top()), QPointF(l, crop.bottom()));
-			painter.drawLine(line);
-
-			// horizontal lines
-			l = crop.top() + crop.height() / N * idx;
-			line = QLineF(QPointF(crop.left(), l), QPointF(crop.right(), l));
-			painter.drawLine(line);
-		}
-	};
-
-	// highlight rectangle's corner
-	auto drawCorners = [&](const QRectF& r, double width = 30) {
-
-		painter.setPen(mStyle.cornerPen());
-
-		QPointF p = r.topLeft();
-		painter.drawLine(p, QPointF(p.x() + width, p.y()));
-		painter.drawLine(p, QPointF(p.x(), p.y() + width));
-
-		p = r.topRight();
-		painter.drawLine(p, QPointF(p.x() - width, p.y()));
-		painter.drawLine(p, QPointF(p.x(), p.y() + width));
-
-		p = r.bottomRight();
-		painter.drawLine(p, QPointF(p.x() - width, p.y()));
-		painter.drawLine(p, QPointF(p.x(), p.y() - width));
-
-		p = r.bottomLeft();
-		painter.drawLine(p, QPointF(p.x() + width, p.y()));
-		painter.drawLine(p, QPointF(p.x(), p.y() - width));
-	};
-
-	// draw decorations
-	drawGuides(mIsRotating ? 10 : 3);
-	drawCorners(crop);
-
-	//// debug vis remove! -------------------------
-	//painter.setBrush(Qt::NoBrush);
-
-	//QPen debug;
-	//debug.setColor(QColor(201, 60, 140));
-	//debug.setWidth(3);
-	//debug.setStyle(Qt::DashLine);
-	//painter.setPen(debug);
-	////painter.drawRect(mCropArea.imgViewRect());
-
-	////QTransform t = mCropArea.transformCropToRect(winRect());
-	////QRectF tr = t.mapRect(crop);
-	////painter.drawRect(tr);
-	//painter.drawRect(mViewportRect);
-	//// debug vis remove! -------------------------
-}
-
-void DkCropViewPort::resizeEvent(QResizeEvent* re) {
-
-	if (re->oldSize() == re->size())
-		return;
-
-	updateViewRect(canvas());
-	recenter();
-
-	return QGraphicsView::resizeEvent(re);
-}
-
-void DkCropViewPort::controlImagePosition(const QRect& r) {
-
-	QRect cr = controlRect(r);
-	
-	QRect imgr = mWorldMatrix.mapRect(mImgViewRect).toRect();
-
-	if (imgr.left() > cr.left())
-		mWorldMatrix.translate(((double)cr.left() - imgr.left()) / mWorldMatrix.m11(), 0);
-
-	if (imgr.top() > cr.top())
-		mWorldMatrix.translate(0, ((double)cr.top() - imgr.top()) / mWorldMatrix.m11());
-
-	if (imgr.right() < cr.right())
-		mWorldMatrix.translate(((double)cr.right() - imgr.right()) / mWorldMatrix.m11(), 0);
-
-	if (imgr.bottom() < cr.bottom())
-		mWorldMatrix.translate(0, ((double)cr.bottom() - imgr.bottom()) / mWorldMatrix.m11());
-
-	// update scene size (this is needed to make the scroll area work)
-	if (DkSettingsManager::instance().param().display().showScrollBars)
-		setSceneRect(getImageViewRect());
-}
-
-QRect DkCropViewPort::canvas(int margin) const {
-
-	return QRect(
-		margin,
-		margin,
-		width() - 2*margin,
-		height() - 2*margin
-	);
-}
-
-void DkCropViewPort::updateViewRect(const QRect& r) {
-
-	if (r == mViewportRect)
-		return;
-
-	mViewportRect = r;
-	updateImageMatrix();
-	changeCursor();
-}
-
-QTransform DkCropViewPort::getScaledImageMatrix() const {
-
-	QSize s = size();
-	if (!mViewportRect.isNull())
-		s = mViewportRect.size();
-
-	return DkBaseViewPort::getScaledImageMatrix(s);
-}
-
-void DkCropViewPort::recenter() {
-
-	mCropArea.recenter(canvas());
-	updateViewRect(mCropArea.rect());
-	//controlImagePosition(); // TODO: do we need that?
-
-	update();
-}
-
-void DkCropViewPort::askBeforeClose() {
-
-	if (!mIsDirty)
-		return;
-
-	QMessageBox* msg = new QMessageBox(QMessageBox::Question, tr("Crop Image"),
-		tr("Do you want to apply cropping?"),
-		(QMessageBox::Yes | QMessageBox::No), this);
-	msg->setButtonText(QMessageBox::Yes, tr("&Crop"));
-	msg->setButtonText(QMessageBox::No, tr("&Don't Crop"));
-
-	int answer = msg->exec();
-	applyCrop(answer == QMessageBox::Yes);
-}
-
-void DkCropViewPort::setImageContainer(const QSharedPointer<DkImageContainerT>& img) {
-	mImage = img;
-
-	if (img) {
-		DkBaseViewPort::setImage(mImage->image());
-		reset();
-	}
-}
-
-void DkCropViewPort::applyCrop(bool apply) {
-
-	if (apply)
-		crop();
-
-	// close
-	mIsDirty = false;
-	emit closeSignal();
-}
-
-void DkCropViewPort::crop() {
-
-	qDebug() << "cropping for you sir...";
-
-	if (!mImage) {
-		qWarning() << "cannot crop NULL image...";
-		return;
-	}
-
-	QRect r = mCropArea.rect();
-	r = mWorldMatrix.inverted().mapRect(r);
-	r = mImgMatrix.inverted().mapRect(r);
-
-	if (mCropArea.isActive() || mAngle != 0.0) {
-		QTransform t;
-		t.translate(-r.left(), -r.top());
-		rotateTransform(t, mAngle, r.center());
-
-		mImage->cropImage(r, t);
-	}
-}
-
-void DkCropViewPort::rotateCW() {
-
-	rotateWithReset(90);
-}
-
-void DkCropViewPort::rotateCCW() {
-
-	rotateWithReset(-90);
-}
-
-void DkCropViewPort::rotate180() {
-
-	rotateWithReset(180);
-}
-
-void DkCropViewPort::rotateWithReset(double angle) {
-
-	if (!mImage)
-		return;
-
-	QImage img = DkImage::rotate(mImage->image(), angle);
-	mImage->setImage(img, tr("Rotated"));
-
-	DkBaseViewPort::setImage(mImage->image());
-	reset();
-}
-
-
-void DkCropViewPort::reset() {
-
-	mCropArea.reset();
-	recenter();
-	resetWorldMatrix();
-	emit resetSignal();
-	mIsDirty = true;
-}
-
-void DkCropViewPort::setWorldTransform(QTransform* worldMatrix) {
-	mCropArea.setWorldMatrix(worldMatrix);
-}
-
-void DkCropViewPort::setImageRect(const QRectF* rect) {
-    mCropArea.setImageRect(rect);
-}
-
-void DkCropViewPort::setVisible(bool visible) {
-
-	if (!isVisible() && visible) {
-		
-		if (!mCropDock) {
-			mCropDock = new QDockWidget(this);
-			mCropDock->setContentsMargins(0, 0, 0, 0);
-			mCropDock->setObjectName("cropDock");
-			mCropDock->setTitleBarWidget(new QWidget());
-
-			DkCropToolBar* ctb = new DkCropToolBar(this);
-			connect(ctb, &DkCropToolBar::rotateSignal, this, &DkCropViewPort::rotate);
-			connect(ctb, &DkCropToolBar::aspectRatioSignal, this, &DkCropViewPort::setAspectRatio);
-			connect(ctb, &DkCropToolBar::flipSignal, this, &DkCropViewPort::flip);
-			connect(ctb, &DkCropToolBar::isRotatingSignal, this, 
-				[&](bool r) {
-					mIsRotating = r; 
-					update(); 
-				});
-			connect(ctb, &DkCropToolBar::closeSignal, this, &DkCropViewPort::applyCrop);
-			connect(this, &DkCropViewPort::resetSignal, ctb, &DkCropToolBar::reset);
-
-			mCropDock->setWidget(ctb);
-		}
-
-		auto w = dynamic_cast<QMainWindow*>(DkUtils::getMainWindow());
-		if (w) {
-			w->addDockWidget(Qt::BottomDockWidgetArea, mCropDock);
-		}
-	}
-
-	if (mCropDock)
-		mCropDock->setVisible(visible);
-
-	DkBaseViewPort::setVisible(visible);
-}
-
-void DkCropViewPort::rotate(double angle) {
-	
-	mAngle = angle;
-	update();
-}
-
-void DkCropViewPort::setAspectRatio(const DkCropArea::Ratio& ratio) {
-
-	mCropArea.setAspectRatio(ratio);
-	recenter();
-}
-
-void DkCropViewPort::flip() {
-	
-	mCropArea.flip();
-	recenter();
-}
-
-bool DkCropArea::isActive() const {
-
-	const QRect& r = rect();
-
-	return qRound(r.width() / mWorldMatrix->m11()) != qRound(mImgViewRect->width()) ||
-		qRound(r.height() / mWorldMatrix->m11()) != qRound(mImgViewRect->height());
-}
-
-void DkCropArea::setWorldMatrix(QTransform* matrix) {
-    mWorldMatrix = matrix;
-}
-
-void DkCropArea::setImageRect(const QRectF* rect) {
-    
-	Q_ASSERT(rect);
-	mImgViewRect = rect;
-}
-
-QRect DkCropArea::rect() const {
-	
-	// init the crop rect
-	if (mCropRect.isNull()) {
-
-		Q_ASSERT(mWorldMatrix);
-		Q_ASSERT(mImgViewRect != nullptr);
-		mCropRect = mWorldMatrix->mapRect(*mImgViewRect).toRect();
-	}
-
-	return mCropRect;
-}
-
-DkCropArea::Handle DkCropArea::getHandle(const QPoint& pos, int proximity) const {
-	
-	if (mCurrentHandle != h_no_handle)
-		return mCurrentHandle;
-
-	int pxs = proximity * proximity;
-	QRect r = rect();
-
-	// squared euclidean distance
-	auto dist = [](const QPoint& p1, const QPoint& p2) {
-
-		int dx = p1.x() - p2.x();
-		int dy = p1.y() - p2.y();
-
-		return dx * dx + dy * dy;
-	};
-
-	if (dist(r.topLeft(), pos) < pxs)
-		return Handle::h_top_left;
-	else if (dist(r.bottomRight(), pos) < pxs)
-		return Handle::h_bottom_right;
-	else if (dist(r.topRight(), pos) < pxs)
-		return Handle::h_top_right;
-	else if (dist(r.bottomLeft(), pos) < pxs)
-		return Handle::h_bottom_left;
-	else if (qAbs(r.left() - pos.x()) < proximity)
-		return Handle::h_left;
-	else if (qAbs(r.right() - pos.x()) < proximity)
-		return Handle::h_right;
-	else if (qAbs(r.top() - pos.y()) < proximity)
-		return Handle::h_top;
-	else if (qAbs(r.bottom() - pos.y()) < proximity)
-		return Handle::h_bottom;
-	else if (r.contains(pos))
-		return Handle::h_move;
-
-	return Handle::h_no_handle;
-}
-
-//QPointF DkCropArea::mapToImage(const QPoint& pos) const {
-//	Q_ASSERT(mWorldMatrix);
-//	return mWorldMatrix->inverted().map(pos);
-//}
-
-void DkCropArea::updateHandle(const QPoint& pos) {
-
-	mCurrentHandle = getHandle(pos);
-}
-
-void DkCropArea::resetHandle() {
-	mCurrentHandle = h_no_handle;
-}
-
-QCursor DkCropArea::cursor(const QPoint& pos) const {
-	
-	Handle h = getHandle(pos);
-
-	if (h == h_top_left ||
-		h == h_bottom_right) {
-		return Qt::SizeFDiagCursor;
-	}
-	else if (h == h_top_right ||
-		h == h_bottom_left) {
-		return Qt::SizeBDiagCursor;
-	}
-	else if (h == h_left ||
-		h == h_right) {
-		return Qt::SizeHorCursor;
-	}
-	else if (h == h_top ||
-		h == h_bottom) {
-		return Qt::SizeVerCursor;
-	}
-	else if (h == h_move) {
-		return Qt::OpenHandCursor;
-	}
-
-	return QCursor();
-}
-
-DkCropArea::Handle DkCropArea::currentHandle() const {
-	return mCurrentHandle;
-}
-
-void DkCropArea::setAspectRatio(const DkCropArea::Ratio& r) {
-
-	mRatio = r;
-
-	// don't do anything
-	if (r == r_free)
-		return;
-
-	QRect nr = rect();
-	clip(nr);
-	applyRatio(nr, toRatio(r));
-
-	// center it
-	mCropRect = moveCenterTo(mCropRect, nr);
-}
-
-void DkCropArea::applyRatio(QRect& r, double ratio) const {
-	
-	bool landscape = r.width() >= r.height();
-
-	// the new rect should always be smaller...
-	if (ratio <= 1) {
-		landscape = !landscape;
-		ratio = 1.0 / ratio;
-	}
-
-	int cl = landscape ? r.width() : r.height();
-	int ns = qRound(cl/ratio);
-
-	if (landscape) {
-		r.setHeight(ns);
-	}
-	else {
-		r.setWidth(ns);
-	}
-}
-
-void DkCropArea::flip() {
-
-	QRect nr = rect();
-
-	int ow = nr.width();
-	nr.setWidth(nr.height());
-	nr.setHeight(ow);
-
-	double ratio = (double)nr.width() / nr.height();
-
-	// TODO: there is still an issue with clipping (if you flip from full view 3 times)
-	if (clip(nr)) {
-		applyRatio(nr, ratio);
-	}
-
-	mCropRect = moveCenterTo(mCropRect, nr);
-}
-
-double DkCropArea::toRatio(const DkCropArea::Ratio& r) {
-
-	switch (r) {
-	case Ratio::r_square:
-		return 1.0;
-	case Ratio::r_original:
-		return mOriginalRatio;
-	case Ratio::r_16_9:
-		return 16 / 9.0;
-	case Ratio::r_4_3:
-		return 4 / 3.0;
-	case Ratio::r_3_2:
-		return 3 / 2.0;
-	}
-
-	qWarning() << "illegal ratio: " << r;
-
-	return 1.0;
-}
-
-bool DkCropArea::clip(QRect& r) const {
-
-	QRect o = mWorldMatrix->mapRect(*mImgViewRect).toRect();
-	o = o.intersected(r);
-
-	if (o != r) {
-		r = o;
-		return true;
-	}
-
-	return false;
-}
-
-QRect DkCropArea::moveCenterTo(const QRect& from, const QRect& to) const {
-
-	QRect r = to;
-	QPoint dxy = from.center() - to.center();
-	r.moveCenter(to.center()+dxy);
-
-	return r;
-}
-
-void DkCropArea::move(const QPoint& dxy) {
-
-	mCropRect.moveCenter(mCropRect.center()-dxy);
-}
-
-//void DkCropArea::rotate(double angle) {
-//
-//	Q_ASSERT(mImgViewRect);
-//	Q_ASSERT(mWorldMatrix);
-//	
-//	QPointF c = mCropRect.center();
-//
-//	//// rotate image around center...
-//	//mWorldMatrix->translate(c.x(), c.y());
-//	//mWorldMatrix->rotate(angle + getAngle());
-//	//mWorldMatrix->translate(-c.x(), -c.y());
-//}
-
-void DkCropArea::reset() {
-
-	mCurrentHandle = Handle::h_no_handle;
-	mCropRect = QRect();
-	mOriginalRatio = (double)mImgViewRect->width() / mImgViewRect->height();
-}
-
-void DkCropArea::recenter(const QRectF& target) {
-
-	if (target.isNull())
-		return;
-
-	QTransform t = transformCropToRect(target);
-
-	mCropRect = t.mapRect(rect());
-	*mWorldMatrix = *mWorldMatrix * t;
-}
-
-QTransform DkCropArea::transformCropToRect(const QRectF& target) const {
-
-	QRectF crop = rect();
-
-	if (crop.isNull())
-		return QTransform();
-
-	double scale = qMin(target.width() / crop.width(), target.height() / crop.height());
-
-	if (scale == 0.0)
-		return QTransform();
-
-	QTransform t;
-	t.scale(scale, scale);
-
-	QRectF cs = t.mapRect(crop);
-	QPointF dxy(target.center() - cs.center());
-	dxy /= scale;
-
-	t.translate(dxy.x(), dxy.y());
-
-	return t;
-}
-
-bool DkCropArea::isLandscape() const {
-
-	const QRect r = rect();
-	return r.width() >= r.height();
-}
-
-void DkCropArea::update(const QPoint& pos) {
-
-	if (mCurrentHandle == h_no_handle)
-		return;
-
-	// enforce aspect ratios
-	auto enforce = [&](const QPoint& p, const QPoint& origin, bool principalDiagonal = true) -> QPoint {
-
-		if (mRatio == Ratio::r_free)
-			return p;
-
-		float ar = (float)toRatio(mRatio);
-
-		if (!principalDiagonal)
-			ar *= -1.0f;
-
-		// normalized diagonal
-		DkVector d = isLandscape() ? DkVector(ar, 1) : DkVector(1, ar);
-		d /= d.norm();
-
-		// project p onto the diagonal
-		DkVector pv = DkVector(p) - DkVector(origin);
-		DkVector lp = d * pv.scalarProduct(d);
-
-		return lp.toQPointF().toPoint() + origin;
-	};
-
-	auto clip = [&](QPoint& p) -> bool {
-
-		QPoint src = p;
-
-		// keep position within the image
-		QRect ir = mWorldMatrix->mapRect(*mImgViewRect).toRect();
-		if (p.x() > ir.right())
-			p.setX(ir.right());
-		if (p.x() < ir.left())
-			p.setX(ir.left());
-		if (p.y() > ir.bottom())
-			p.setY(ir.bottom());
-		if (p.y() < ir.top())
-			p.setY(ir.top());
-
-		return src != p;
-	};
-
-	QPoint p = pos;
-
-	// fix the other coordinate
-	switch (mCurrentHandle) {
-	case Handle::h_left:
-		p.setY(mCropRect.bottom()); break;
-	case Handle::h_right:
-		p.setY(mCropRect.bottom()); break;
-	case Handle::h_top:
-		p.setX(mCropRect.right()); break;
-	case Handle::h_bottom:
-		p.setX(mCropRect.right()); break;
-	default: break;
-		// do nothing...
-	}
-
-	// update corners
-	switch (mCurrentHandle) {
-
-	case Handle::h_top_left: {
-		p = enforce(p, mCropRect.bottomRight());
-		if (!clip(p) || mRatio == Ratio::r_free)
-			mCropRect.setTopLeft(p);
-		break;
-	}
-	case Handle::h_top:
-	case Handle::h_top_right: {
-		p = enforce(p, mCropRect.bottomLeft(), false);
-		if (!clip(p) || mRatio == Ratio::r_free)
-			mCropRect.setTopRight(p);
-		break;
-	}
-	case Handle::h_bottom:
-	case Handle::h_right:
-	case Handle::h_bottom_right: {
-		p = enforce(p, mCropRect.topLeft());
-		if (!clip(p) || mRatio == Ratio::r_free)
-			mCropRect.setBottomRight(p);
-		break;
-	}
-	case Handle::h_left:
-	case Handle::h_bottom_left: {
-		p = enforce(p, mCropRect.topRight(), false);
-		if (!clip(p) || mRatio == Ratio::r_free)
-			mCropRect.setBottomLeft(p);
-		break;
-	}
-	}
-
-	if (!mCropRect.isValid()) {
-		mCropRect.setWidth(qMax(mCropRect.width(), 1));
-		mCropRect.setHeight(qMax(mCropRect.height(), 1));
-	}
-}
-
-// -------------------------------------------------------------------- DkCropStyle 
-DkCropStyle::DkCropStyle(const QColor& dark, const QColor& light) {
-
-	mDarkColor = dark;
-	mLightColor = light;
-}
-
-QBrush DkCropStyle::bgBrush() const {
-
-	QColor bb = mDarkColor;
-	bb.setAlpha(qRound(mOpacity * 255));
-
-	return bb;
-}
-
-QColor DkCropStyle::lightColor() const {
-	return mLightColor;
-}
-
-QPen DkCropStyle::pen() const {
-
-	QPen p(mLightColor, mLineWidth);
-	p.setCosmetic(true);
-
-	return p;
-}
-
-QPen DkCropStyle::cornerPen() const {
-
-	QPen p(mLightColor, mLineWidth*2);
-	p.setCosmetic(true);
-
-	return p;
-}
-
-DkCropToolBar::DkCropToolBar(QWidget* parent) : DkWidget(parent) {
-
-	createLayout();
-	QMetaObject::connectSlotsByName(this);
-}
-
-void DkCropToolBar::createLayout() {
-
-	setObjectName("darkManipulator");
-
-	QPixmap i = DkImage::loadIcon(":/nomacs/img/crop.svg", QSize(32, 32), QColor(255,255,255));
-	QPushButton* applyButton = new QPushButton(i, tr("Apply"), this);
-	applyButton->setStatusTip(tr("closes the crop view, and applies cropping to the image (ENTER)"));
-	applyButton->setShortcut(Qt::Key_Return);
-	applyButton->setObjectName("dark");
-
-	i = DkImage::loadIcon(":/nomacs/img/close.svg", QSize(32, 32), QColor(255, 255, 255));
-	QPushButton* cancelButton = new QPushButton(i, tr("Cancel"), this);
-	cancelButton->setStatusTip(tr("closes the crop view, leaving the image unchanged (ESC)"));
-	cancelButton->setShortcut(Qt::Key_Escape);
-	cancelButton->setObjectName("dark");
-
-	mAngleSlider = new DkDoubleSlider(tr("Rotate"), this);
-	mAngleSlider->setObjectName("darkManipulator");
-	mAngleSlider->setTickInterval(1 / 90.0);
-	mAngleSlider->setMinimum(-45);
-	mAngleSlider->setMaximum(45);
-	mAngleSlider->setValue(0.0);
-	mAngleSlider->setMaximumWidth(400);
-
-	mRatioBox = new QComboBox(this);
-	mRatioBox->setObjectName("ratioBox");
-
-	// dear future me: we can use this with C++20:
-	// using enum DkCropArea;
-	i = DkImage::loadIcon(":/nomacs/img/aspect-ratio.svg", QSize(32, 32), QColor(255, 255, 255));
-	mRatioBox->addItem(i, tr("Aspect Ratio"), DkCropArea::Ratio::r_free);
-	mRatioBox->addItem(tr("Free"), DkCropArea::Ratio::r_free);
-	mRatioBox->addItem(tr("Original"), DkCropArea::Ratio::r_original);
-	mRatioBox->addItem(tr("Square"), DkCropArea::Ratio::r_square);
-	mRatioBox->addItem(tr("16:9"), DkCropArea::Ratio::r_16_9);
-	mRatioBox->addItem(tr("4:3"), DkCropArea::Ratio::r_4_3);
-	mRatioBox->addItem(tr("3:2"), DkCropArea::Ratio::r_3_2);
-
-	QPushButton* flipButton = new QPushButton(tr("Flip"), this);
-	flipButton->setStatusTip(tr("flips the crop rectangle (F)"));
-	flipButton->setShortcut(Qt::Key_F);
-	flipButton->setObjectName("dark");
-
-	// connections
-	auto s = mAngleSlider->getSlider();
-	connect(s, &QSlider::sliderPressed, this, [&]() { emit isRotatingSignal(true); });
-	connect(s, &QSlider::sliderReleased, this, [&]() { emit isRotatingSignal(false); });
-	connect(mAngleSlider, &DkDoubleSlider::valueChanged, this, &DkCropToolBar::rotateSignal);
-	connect(flipButton, &QPushButton::clicked, this, &DkCropToolBar::flipSignal);
-	connect(applyButton, &QPushButton::clicked, this, [&]() { emit closeSignal(true); });
-	connect(cancelButton, &QPushButton::clicked, this, [&]() { emit closeSignal(false); });
-
-	QHBoxLayout* l = new QHBoxLayout(this);
-	l->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
-	l->setSpacing(20);
-
-	l->addStretch();
-	l->addWidget(applyButton);
-	l->addWidget(cancelButton);
-	l->addSpacing(20);
-	l->addWidget(mAngleSlider);
-	l->addSpacing(20);
-	l->addWidget(mRatioBox);
-	l->addWidget(flipButton);
-	l->addStretch();
-}
-
-void DkCropToolBar::on_ratioBox_currentIndexChanged(int idx) const {
-
-	auto r = static_cast<DkCropArea::Ratio>(mRatioBox->itemData(idx).toInt());
-	emit aspectRatioSignal(r);
-}
-
-void DkCropToolBar::reset() {
-
-	mAngleSlider->setValue(0);
-}
-
-}
\ No newline at end of file
diff --git a/ImageLounge/src/DkGui/DkCropWidgets.h b/ImageLounge/src/DkGui/DkCropWidgets.h
deleted file mode 100644
index 17906e8..0000000
--- a/ImageLounge/src/DkGui/DkCropWidgets.h
+++ /dev/null
@@ -1,249 +0,0 @@
-/*******************************************************************************************************
- nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
- Copyright (C) 2011-2016 Markus Diem <markus@nomacs.org>
- Copyright (C) 2011-2016 Stefan Fiel <stefan@nomacs.org>
- Copyright (C) 2011-2016 Florian Kleber <florian@nomacs.org>
-
- This file is part of nomacs.
-
- nomacs is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- nomacs is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
- related links:
- [1] http://www.nomacs.org/
- [2] https://github.com/nomacs/
- [3] http://download.nomacs.org
- *******************************************************************************************************/
-
-#pragma once
-
-#include "DkBaseViewPort.h"
-#include "DkBaseWidgets.h"
-
-#pragma warning(push, 0)	// no warnings from includes
-#include <QPen>
-#include <QBrush>
-#include <QDockWidget>
-#pragma warning(pop)
-
-#ifndef DllExport
-#ifdef DK_DLL_EXPORT
-#define DllExport Q_DECL_EXPORT
-#elif DK_DLL_IMPORT
-#define DllExport Q_DECL_IMPORT
-#else
-#define DllExport Q_DECL_IMPORT
-#endif
-#endif
-
-// Qt defines
-class QComboBox;
-
-namespace nmc {
-
-// nomacs defines
-class DkImageContainerT;
-class DkDoubleSlider;
-    
-class DkCropArea {
-
-public:
-    enum Handle : int {
-
-        h_no_handle = 0,
-        h_top_left,
-        h_top_right,
-        h_bottom_right,
-        h_bottom_left,
-        h_top,
-        h_bottom,
-        h_left,
-        h_right,
-        h_move,
-
-        h_end
-    };
-
-    enum Ratio : int {
-        r_free = 0,
-        r_original,
-        r_square,
-        r_16_9,
-        r_4_3,
-        r_3_2,
-
-        r_end,
-    };
-
-    bool isActive() const;
-
-    void setWorldMatrix(QTransform* matrix);
-    void setImageRect(const QRectF* rect);
-
-    QRect rect() const;
-
-    void updateHandle(const QPoint& pos);
-    void resetHandle();
-    QCursor cursor(const QPoint& pos) const;
-    Handle currentHandle() const;
-
-    void setAspectRatio(const DkCropArea::Ratio& r);
-    void flip();
-
-    void update(const QPoint& pos);
-    void move(const QPoint& dxy);
-    void reset();
-    
-    void recenter(const QRectF& target);
-
-private:
-    QTransform* mWorldMatrix = nullptr;
-    const QRectF* mImgViewRect = nullptr;
-
-    // the crop rect is kept in display coordinates
-    mutable QRect mCropRect;
-    DkCropArea::Ratio mRatio = r_free;
-    DkCropArea::Handle mCurrentHandle = DkCropArea::Handle::h_no_handle;
-    
-    double mOriginalRatio = 1.0;
-
-    Handle getHandle(const QPoint& pos, int proximity = 15) const;
-    QTransform transformCropToRect(const QRectF& target) const;
-    bool isLandscape() const;
-    void applyRatio(QRect& r, double ratio) const;
-    double toRatio(const DkCropArea::Ratio& r);
-    bool clip(QRect& r) const;
-
-    QRect moveCenterTo(const QRect& from, const QRect& to) const;
-
-    //QPointF mapToImage(const QPoint& pos) const;
-};
-
-class DkCropStyle {
-
-public:
-
-    DkCropStyle(
-        const QColor& dark = QColor(0, 0, 0), 
-        const QColor& light = QColor(255, 255, 255));
-
-    QBrush bgBrush() const;
-    QPen pen() const;
-    QPen cornerPen() const;
-
-    QColor lightColor() const;
-    
-private:
-    QColor mDarkColor;
-    QColor mLightColor;
-    int mLineWidth = 2;
-    double mOpacity = 0.8;
-
-};
-
-class DkCropViewPort : public DkBaseViewPort {
-    Q_OBJECT
-
-public:
-    DkCropViewPort(QWidget* parent = 0);
-    
-    void reset();
-
-    void setWorldTransform(QTransform* worldMatrix);
-    void setImageRect(const QRectF* rect);
-
-    void recenter();
-
-    void askBeforeClose();
-
-public slots:
-    void setVisible(bool visible) override;
-
-    void setAspectRatio(const DkCropArea::Ratio& ratio);
-    void flip();
-
-    void setImageContainer(const QSharedPointer<DkImageContainerT>& img);
-
-    void applyCrop(bool apply);
-    void crop();
-
-    void rotateCW();
-    void rotateCCW();
-    void rotate180();
-    void rotate(double angle);
-
-signals:
-    void cropImageSignal(const QRectF& rect, bool cropToMetaData = false) const;
-    void closeSignal() const;
-    void resetSignal() const;
-
-protected:
-    void mouseDoubleClickEvent(QMouseEvent* ev) override;
-    void mouseMoveEvent(QMouseEvent* ev) override;
-    void mousePressEvent(QMouseEvent* ev) override;
-    void mouseReleaseEvent(QMouseEvent* ev) override;
-
-    void paintEvent(QPaintEvent* pe) override;
-    void resizeEvent(QResizeEvent* re) override;
-
-    void controlImagePosition(const QRect& r = QRect()) override;
-
-    QRect canvas(int margin = 100) const;
-    void updateViewRect(const QRect& r);
-    QTransform getScaledImageMatrix() const override;
-    void rotateWithReset(double angle);
-
-    DkCropStyle mStyle;
-
-    DkCropArea mCropArea;
-    QRectF mRect; // TODO: remove?
-    QPoint mLastMousePos;
-    
-    bool mIsDirty = false;
-    bool mIsRotating = false;
-
-    QSharedPointer<DkImageContainerT> mImage;
-    QDockWidget* mCropDock = nullptr;
-
-};
-
-// TODO: rename to DkCropToolBar
-class DkCropToolBar : public DkWidget {
-    Q_OBJECT
-
-public:
-    DkCropToolBar(QWidget* parent = 0);
-
-public slots:
-    void reset();
-
-private slots:
-    void on_ratioBox_currentIndexChanged(int idx) const;
-
-signals:
-    void isRotatingSignal(bool rotating) const;
-    void rotateSignal(double angle) const;
-    void aspectRatioSignal(const DkCropArea::Ratio& ratio) const;
-    void flipSignal() const;
-    void closeSignal(bool apply) const;
-
-private:
-    void createLayout();
-
-    QComboBox* mRatioBox = nullptr;
-    DkDoubleSlider* mAngleSlider = nullptr;
-
-};
-
-}
\ No newline at end of file
diff --git a/ImageLounge/src/DkGui/DkDialog.cpp b/ImageLounge/src/DkGui/DkDialog.cpp
index 008c9a3..041f148 100644
--- a/ImageLounge/src/DkGui/DkDialog.cpp
+++ b/ImageLounge/src/DkGui/DkDialog.cpp
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkDialog.cpp
  Created on:	21.04.2011
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -27,4465 +27,4357 @@
 
 #include "DkDialog.h"
 
-#include "DkImageStorage.h"
-#include "DkSettings.h"
+#include "DkActionManager.h"
 #include "DkBaseViewPort.h"
-#include "DkTimer.h"
-#include "DkWidgets.h"
 #include "DkBasicWidgets.h"
+#include "DkCentralWidget.h"
+#include "DkImageStorage.h"
+#include "DkPluginManager.h"
+#include "DkSettings.h"
 #include "DkThumbs.h"
+#include "DkTimer.h"
 #include "DkUtils.h"
-#include "DkActionManager.h"
-#include "DkPluginManager.h"
-#include "DkCentralWidget.h"
 #include "DkViewPort.h"
+#include "DkWidgets.h"
 
 #if defined(Q_OS_WIN) && !defined(SOCK_STREAM)
-#include <winsock2.h>	// needed since libraw 0.16
+#include <winsock2.h> // needed since libraw 0.16
 #endif
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QWidget>
-#include <QLabel>
-#include <QRadioButton>
-#include <QSpinBox>
-#include <QSlider>
-#include <QColorDialog>
-#include <QPushButton>
+#pragma warning(push, 0) // no warnings from includes - begin
+#include <QAction>
+#include <QApplication>
 #include <QBoxLayout>
 #include <QCheckBox>
-#include <QFileInfo>
-#include <QTableView>
+#include <QColorDialog>
+#include <QComboBox>
 #include <QCompleter>
-#include <QMainWindow>
+#include <QDesktopServices>
+#include <QDesktopWidget>
 #include <QDialogButtonBox>
-#include <QStandardItemModel>
-#include <QItemEditorFactory>
+#include <QFileDialog>
+#include <QFileInfo>
+#include <QFormLayout>
+#include <QFuture>
 #include <QHeaderView>
-#include <QTreeView>
-#include <QMimeData>
-#include <QStringListModel>
+#include <QInputDialog>
+#include <QItemEditorFactory>
+#include <QKeySequenceEdit>
+#include <QLabel>
 #include <QListView>
-#include <QDialogButtonBox>
 #include <QListWidget>
-#include <QProgressDialog>
-#include <QTextEdit>
-#include <QApplication>
-#include <QInputDialog>
-#include <QFileDialog>
+#include <QMainWindow>
+#include <QMenu>
+#include <QMessageBox>
+#include <QMimeData>
+#include <QMouseEvent>
 #include <QPageSetupDialog>
 #include <QPrintDialog>
-#include <QToolBar>
-#include <QFormLayout>
+#include <QPrinterInfo>
 #include <QProgressBar>
-#include <QFuture>
-#include <QtConcurrentRun>
-#include <QMouseEvent>
-#include <QAction>
-#include <QMessageBox>
-#include <QToolButton>
-#include <QComboBox>
+#include <QProgressDialog>
+#include <QPushButton>
+#include <QRadioButton>
+#include <QRandomGenerator>
+#include <QScreen>
+#include <QSlider>
+#include <QSpinBox>
+#include <QSplashScreen>
+#include <QStandardItemModel>
+#include <QStringListModel>
+#include <QTableView>
+#include <QTextEdit>
 #include <QTimer>
+#include <QToolBar>
+#include <QToolButton>
+#include <QTreeView>
+#include <QWidget>
+#include <QtConcurrentRun>
 #include <qmath.h>
-#include <QDesktopServices>
-#include <QSplashScreen>
-#include <QMenu>
-#include <QKeySequenceEdit>
-#include <QPrinterInfo>
-#include <QDesktopWidget>
-#include <QScreen>
 
 // quazip
 #ifdef WITH_QUAZIP
+#ifdef WITH_QUAZIP1
+#include <quazip/JlCompress.h>
+#else
 #include <quazip5/JlCompress.h>
 #endif
+#endif
 
-#pragma warning(pop)		// no warnings from includes - end
-
-namespace nmc {
+#pragma warning(pop) // no warnings from includes - end
 
-QFileDialog::Options DkDialog::fileDialogOptions() {
+namespace nmc
+{
 
-	QFileDialog::Options flags;
+QFileDialog::Options DkDialog::fileDialogOptions()
+{
+    QFileDialog::Options flags;
 
-	if (!DkSettingsManager::param().resources().nativeDialog)
-		flags = QFileDialog::DontUseNativeDialog;
-		
+    if (!DkSettingsManager::param().resources().nativeDialog)
+        flags = QFileDialog::DontUseNativeDialog;
 
-	return flags;
+    return flags;
 }
 
 // DkSplashScreen --------------------------------------------------------------------
-DkSplashScreen::DkSplashScreen(QWidget* /*parent*/, Qt::WindowFlags flags) : QDialog(0, flags) {
+DkSplashScreen::DkSplashScreen(QWidget * /*parent*/, Qt::WindowFlags flags)
+    : QDialog(0, flags)
+{
+    QPixmap img(":/nomacs/img/splash-screen.png");
+    setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
+    setMouseTracking(true);
 
-	QPixmap img(":/nomacs/img/splash-screen.png");
-	setWindowFlags(Qt::FramelessWindowHint|Qt::WindowStaysOnTopHint);
-	setMouseTracking(true);
-    
 #ifdef Q_OS_MAC
     setObjectName("DkSplashScreenMac");
 #else
-	setObjectName("DkSplashScreen");
-	setAttribute(Qt::WA_TranslucentBackground);
+    setObjectName("DkSplashScreen");
+    setAttribute(Qt::WA_TranslucentBackground);
 #endif
 
-	imgLabel = new QLabel(this, Qt::FramelessWindowHint|Qt::WindowStaysOnTopHint);
-	imgLabel->setObjectName("DkSplashInfoLabel");
-	imgLabel->setMouseTracking(true);
-	imgLabel->setScaledContents(true);
-	imgLabel->setPixmap(img);
-	imgLabel->setFixedSize(600, 474);
-	imgLabel->show();
-
-	setFixedSize(imgLabel->size());
-
-	exitButton = new QPushButton(DkImage::loadIcon(":/nomacs/img/close.svg"), "", this);
-	exitButton->setObjectName("cancelButtonSplash");
-	exitButton->setFlat(true);
-	exitButton->setToolTip(tr("Close (ESC)"));
-	exitButton->setShortcut(QKeySequence(Qt::Key_Escape));
-	exitButton->move(10, 435);
-	exitButton->hide();
-	connect(exitButton, SIGNAL(clicked()), this, SLOT(close()))	;
-
-	// set the text
-	text = 
-		QString("Flo was here und w&uuml;nscht<br>" 
-		"Stefan fiel Spa&szlig; w&auml;hrend<br>" 
-		"Markus rockt... <br><br>" 
-
-		"<a href=\"https://nomacs.org\">https://nomacs.org</a><br>"
-		"<a href=\"mailto:developers@nomacs.org\">developers@nomacs.org</a><br><br>" 
-
-		"This program is licensed under GNU General Public License v3<br>"
-		"&#169; Markus Diem, Stefan Fiel and Florian Kleber, 2011-2020<br><br>"
-
-		"Press [ESC] to exit");
-
-	textLabel = new QLabel(this, Qt::FramelessWindowHint|Qt::WindowStaysOnTopHint);
-	textLabel->setObjectName("DkSplashInfoLabel");
-	textLabel->setMouseTracking(true);
-	textLabel->setScaledContents(true);
-	textLabel->setTextFormat(Qt::RichText);
-	textLabel->setText(text);
-	textLabel->move(131, 280);
-	textLabel->setOpenExternalLinks(true);
-	
-	//textLabel->setAttribute(Qt::WA_TransparentForMouseEvents);
-	
-	QLabel* versionLabel = new QLabel(this, Qt::FramelessWindowHint|Qt::WindowStaysOnTopHint);
-	versionLabel->setObjectName("DkSplashInfoLabel");
-	versionLabel->setTextFormat(Qt::RichText);
-
-	versionLabel->setText(versionText());
-	versionLabel->setAlignment(Qt::AlignRight);
-	versionLabel->move(360, 280);
-	versionLabel->setAttribute(Qt::WA_TransparentForMouseEvents);
-
-	showTimer = new QTimer(this);
-	showTimer->setInterval(5000);
-	showTimer->setSingleShot(true);
-	connect(showTimer, SIGNAL(timeout()), exitButton, SLOT(hide()));
-	
-	qDebug() << "splash screen created...";
-}
-
-void DkSplashScreen::mousePressEvent(QMouseEvent* event) {
-
-	setCursor(Qt::ClosedHandCursor);
-	mouseGrab = event->globalPos();
-	QDialog::mousePressEvent(event);
-}
-
-void DkSplashScreen::mouseMoveEvent(QMouseEvent *event) {
-
-	if (event->buttons() == Qt::LeftButton) {
-		move(pos()-(mouseGrab-event->globalPos()));
-		mouseGrab = event->globalPos();
-		qDebug() << "moving...";
-	}
-	else
-		setCursor(Qt::OpenHandCursor);
-	showClose();
-	QDialog::mouseMoveEvent(event);
-}
-
-void DkSplashScreen::mouseReleaseEvent(QMouseEvent *event) {
-
-	setCursor(Qt::OpenHandCursor);
-	showClose();
-	QDialog::mouseReleaseEvent(event);
-}
-
-void DkSplashScreen::showClose() {
-
-	exitButton->show();
-	showTimer->start();
-}
-
-QString DkSplashScreen::versionText() const {
-	
-	QString vt;
-
-	// print out if the name is changed (e.g. READ build)
-	if (QApplication::applicationName() != "Image Lounge") {
-		vt += QApplication::applicationName() + "<br>";
-	}
+    imgLabel = new QLabel(this, Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
+    imgLabel->setObjectName("DkSplashInfoLabel");
+    imgLabel->setMouseTracking(true);
+    imgLabel->setScaledContents(true);
+    imgLabel->setPixmap(img);
+    imgLabel->setFixedSize(600, 474);
+    imgLabel->show();
+
+    setFixedSize(imgLabel->size());
+
+    exitButton = new QPushButton(DkImage::loadIcon(":/nomacs/img/close.svg"), "", this);
+    exitButton->setObjectName("cancelButtonSplash");
+    exitButton->setFlat(true);
+    exitButton->setToolTip(tr("Close (ESC)"));
+    exitButton->setShortcut(QKeySequence(Qt::Key_Escape));
+    exitButton->move(10, 435);
+    exitButton->hide();
+    connect(exitButton, SIGNAL(clicked()), this, SLOT(close()));
+
+    // set the text
+    text = QString(
+        "Flo was here und w&uuml;nscht<br>"
+        "Stefan fiel Spa&szlig; w&auml;hrend<br>"
+        "Markus rockt... <br><br>"
+
+        "<a href=\"https://github.com/nomacs/nomacs\">https://github.com/nomacs/nomacs</a><br>"
+
+        "This program is licensed under GNU General Public License v3<br>"
+        "&#169; Markus Diem, Stefan Fiel and Florian Kleber, 2011-2020<br><br>"
+
+        "Press [ESC] to exit");
+
+    textLabel = new QLabel(this, Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
+    textLabel->setObjectName("DkSplashInfoLabel");
+    textLabel->setMouseTracking(true);
+    textLabel->setScaledContents(true);
+    textLabel->setTextFormat(Qt::RichText);
+    textLabel->setText(text);
+    textLabel->move(131, 280);
+    textLabel->setOpenExternalLinks(true);
+
+    // textLabel->setAttribute(Qt::WA_TransparentForMouseEvents);
+
+    QLabel *versionLabel = new QLabel(this, Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
+    versionLabel->setObjectName("DkSplashInfoLabel");
+    versionLabel->setTextFormat(Qt::RichText);
+
+    versionLabel->setText(versionText());
+    versionLabel->setAlignment(Qt::AlignRight);
+    versionLabel->move(360, 280);
+    versionLabel->setAttribute(Qt::WA_TransparentForMouseEvents);
+
+    showTimer = new QTimer(this);
+    showTimer->setInterval(5000);
+    showTimer->setSingleShot(true);
+    connect(showTimer, SIGNAL(timeout()), exitButton, SLOT(hide()));
+
+    qDebug() << "splash screen created...";
+}
+
+void DkSplashScreen::mousePressEvent(QMouseEvent *event)
+{
+    setCursor(Qt::ClosedHandCursor);
+    mouseGrab = event->globalPos();
+    QDialog::mousePressEvent(event);
+}
+
+void DkSplashScreen::mouseMoveEvent(QMouseEvent *event)
+{
+    if (event->buttons() == Qt::LeftButton) {
+        move(pos() - (mouseGrab - event->globalPos()));
+        mouseGrab = event->globalPos();
+        qDebug() << "moving...";
+    } else
+        setCursor(Qt::OpenHandCursor);
+    showClose();
+    QDialog::mouseMoveEvent(event);
+}
+
+void DkSplashScreen::mouseReleaseEvent(QMouseEvent *event)
+{
+    setCursor(Qt::OpenHandCursor);
+    showClose();
+    QDialog::mouseReleaseEvent(event);
+}
+
+void DkSplashScreen::showClose()
+{
+    exitButton->show();
+    showTimer->start();
+}
+
+QString DkSplashScreen::versionText() const
+{
+    QString vt;
+
+    // print out if the name is changed (e.g. READ build)
+    if (QApplication::applicationName() != "Image Lounge") {
+        vt += QApplication::applicationName() + "<br>";
+    }
 
-	// architecture
-	QString platform = "";
+    // architecture
+    QString platform = "";
 #ifdef _WIN64
-	platform = " [x64] ";
+    platform = " [x64] ";
 #elif defined _WIN32
-	platform = " [x86] ";
+    platform = " [x86] ";
 #endif
 
-	// version & build date
-	vt += QApplication::applicationVersion() + platform + "<br>";
-	
+    // version & build date
+    vt += QApplication::applicationVersion() + platform + "<br>";
+
 // reproducable builds for linux (see #139)
 #ifdef Q_OS_WIN
-	vt += QString(__DATE__) + "<br>";
+    vt += QString(__DATE__) + "<br>";
 #endif
 
-	// supplemental info
-	vt += "<p style=\"color: #666; font-size: 7pt; margin: 0; padding: 0;\">";
+    // supplemental info
+    vt += "<p style=\"color: #666; font-size: 7pt; margin: 0; padding: 0;\">";
 
-	// OpenCV
+    // OpenCV
 #ifdef WITH_OPENCV
-	vt += "OpenCV " + QString(CV_VERSION) + "<br>";
+    vt += "OpenCV " + QString(CV_VERSION) + "<br>";
 #else
-	vt += "No CV support<br>";
+    vt += "No CV support<br>";
 #endif
 
-	// Qt
-	vt += "Qt " + QString(QT_VERSION_STR) + "<br>";
+    // Qt
+    vt += "Qt " + QString(QT_VERSION_STR) + "<br>";
 
-	// LibRAW
+    // LibRAW
 #ifndef WITH_LIBRAW
-	vt += "No RAW support<br>";
-#endif  	
+    vt += "No RAW support<br>";
+#endif
 
-	// portable
-	vt += (DkSettingsManager::param().isPortable() ? tr("Portable") : "");
-	vt += "</p>";
-	
-	return vt;
+    // portable
+    vt += (DkSettingsManager::param().isPortable() ? tr("Portable") : "");
+    vt += "</p>";
+
+    return vt;
 }
 
 // file validator --------------------------------------------------------------------
-DkFileValidator::DkFileValidator(const QString& lastFile, QObject * parent) : QValidator(parent) {
-
-	mLastFile = lastFile;
+DkFileValidator::DkFileValidator(const QString &lastFile, QObject *parent)
+    : QValidator(parent)
+{
+    mLastFile = lastFile;
 }
 
-void DkFileValidator::fixup(QString& input) const {
-
-	if(!QFileInfo(input).exists())
-		input = mLastFile;
+void DkFileValidator::fixup(QString &input) const
+{
+    if (!QFileInfo(input).exists())
+        input = mLastFile;
 }
 
-QValidator::State DkFileValidator::validate(QString& input, int&) const {
-
-	if (QFileInfo(input).exists())
-		return QValidator::Acceptable;
-	else
-		return QValidator::Intermediate;
+QValidator::State DkFileValidator::validate(QString &input, int &) const
+{
+    if (QFileInfo(input).exists())
+        return QValidator::Acceptable;
+    else
+        return QValidator::Intermediate;
 }
 
 // train dialog --------------------------------------------------------------------
-DkTrainDialog::DkTrainDialog(QWidget* parent, Qt::WindowFlags flags) : QDialog(parent, flags) {
-
-	setWindowTitle(tr("Add New Image Format"));
-	createLayout();
-	setFixedSize(340, 400);		// due to the baseViewport we need fixed sized dialogs : (
-	setAcceptDrops(true);
-}
-
-void DkTrainDialog::createLayout() {
-
-	// first row
-	QLabel* newImageLabel = new QLabel(tr("Load New Image Format"), this);
-	mPathEdit = new QLineEdit(this);
-	mPathEdit->setValidator(&mFileValidator);
-	mPathEdit->setObjectName("DkWarningEdit");
-	connect(mPathEdit, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
-	connect(mPathEdit, SIGNAL(editingFinished()), this, SLOT(loadFile()));
-
-	QPushButton* openButton = new QPushButton(tr("&Browse"), this);
-	connect(openButton, SIGNAL(pressed()), this, SLOT(openFile()));
-
-	mFeedbackLabel = new QLabel("", this);
-	mFeedbackLabel->setObjectName("DkDecentInfo");
-
-	// shows the image if it could be loaded
-	mViewport = new DkBaseViewPort(this);
-	mViewport->setForceFastRendering(true);
-	mViewport->setPanControl(QPointF(0.0f, 0.0f));
-
-	// mButtons
-	mButtons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
-	mButtons->button(QDialogButtonBox::Ok)->setText(tr("&Add"));
-	mButtons->button(QDialogButtonBox::Ok)->setEnabled(false);
-	mButtons->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel"));
-	connect(mButtons, SIGNAL(accepted()), this, SLOT(accept()));
-	connect(mButtons, SIGNAL(rejected()), this, SLOT(reject()));
-
-	QWidget* trainWidget = new QWidget(this);
-	QGridLayout* gdLayout = new QGridLayout(trainWidget);
-	gdLayout->addWidget(newImageLabel, 0, 0);
-	gdLayout->addWidget(mPathEdit, 1, 0);
-	gdLayout->addWidget(openButton, 1, 1);
-	gdLayout->addWidget(mFeedbackLabel, 2, 0, 1, 2);
-	gdLayout->addWidget(mViewport, 3, 0, 1, 2);
-
-	QVBoxLayout* layout = new QVBoxLayout(this);
-	layout->addWidget(trainWidget);
-	layout->addWidget(mButtons);
-}
-
-void DkTrainDialog::textChanged(const QString& text) {
-	
-	if (QFileInfo(text).exists())
-		mPathEdit->setProperty("warning", false);
-	else
-		mPathEdit->setProperty("warning", false);
-
-	mPathEdit->style()->unpolish(mPathEdit);
-	mPathEdit->style()->polish(mPathEdit);
-	mPathEdit->update();
-}
-
-void DkTrainDialog::openFile() {
-
-	// load system default open dialog
-	QString filePath = QFileDialog::getOpenFileName(
-		this, 
-		tr("Open Image"),
-		mFile, 
-		tr("All Files (*.*)"),
-		nullptr,
-		DkDialog::fileDialogOptions()
-	);
-
-	if (QFileInfo(filePath).exists()) {
-		mPathEdit->setText(filePath);
-		loadFile(filePath);
-	}
+DkTrainDialog::DkTrainDialog(QWidget *parent, Qt::WindowFlags flags)
+    : QDialog(parent, flags)
+{
+    setWindowTitle(tr("Add New Image Format"));
+    createLayout();
+    setFixedSize(340, 400); // due to the baseViewport we need fixed sized dialogs : (
+    setAcceptDrops(true);
+}
+
+void DkTrainDialog::createLayout()
+{
+    // first row
+    QLabel *newImageLabel = new QLabel(tr("Load New Image Format"), this);
+    mPathEdit = new QLineEdit(this);
+    mPathEdit->setValidator(&mFileValidator);
+    mPathEdit->setObjectName("DkWarningEdit");
+    connect(mPathEdit, SIGNAL(textChanged(const QString &)), this, SLOT(textChanged(const QString &)));
+    connect(mPathEdit, SIGNAL(editingFinished()), this, SLOT(loadFile()));
+
+    QPushButton *openButton = new QPushButton(tr("&Browse"), this);
+    connect(openButton, SIGNAL(pressed()), this, SLOT(openFile()));
+
+    mFeedbackLabel = new QLabel("", this);
+    mFeedbackLabel->setObjectName("DkDecentInfo");
+
+    // shows the image if it could be loaded
+    mViewport = new DkBaseViewPort(this);
+    mViewport->setForceFastRendering(true);
+    mViewport->setPanControl(QPointF(0.0f, 0.0f));
+
+    // mButtons
+    mButtons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
+    mButtons->button(QDialogButtonBox::Ok)->setText(tr("&Add"));
+    mButtons->button(QDialogButtonBox::Ok)->setEnabled(false);
+    mButtons->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel"));
+    connect(mButtons, SIGNAL(accepted()), this, SLOT(accept()));
+    connect(mButtons, SIGNAL(rejected()), this, SLOT(reject()));
+
+    QWidget *trainWidget = new QWidget(this);
+    QGridLayout *gdLayout = new QGridLayout(trainWidget);
+    gdLayout->addWidget(newImageLabel, 0, 0);
+    gdLayout->addWidget(mPathEdit, 1, 0);
+    gdLayout->addWidget(openButton, 1, 1);
+    gdLayout->addWidget(mFeedbackLabel, 2, 0, 1, 2);
+    gdLayout->addWidget(mViewport, 3, 0, 1, 2);
+
+    QVBoxLayout *layout = new QVBoxLayout(this);
+    layout->addWidget(trainWidget);
+    layout->addWidget(mButtons);
+}
+
+void DkTrainDialog::textChanged(const QString &text)
+{
+    if (QFileInfo(text).exists())
+        mPathEdit->setProperty("warning", false);
+    else
+        mPathEdit->setProperty("warning", false);
+
+    mPathEdit->style()->unpolish(mPathEdit);
+    mPathEdit->style()->polish(mPathEdit);
+    mPathEdit->update();
+}
+
+void DkTrainDialog::openFile()
+{
+    // load system default open dialog
+    QString filePath = QFileDialog::getOpenFileName(this, tr("Open Image"), mFile, tr("All Files (*.*)"), nullptr, DkDialog::fileDialogOptions());
+
+    if (QFileInfo(filePath).exists()) {
+        mPathEdit->setText(filePath);
+        loadFile(filePath);
+    }
 }
 
-void DkTrainDialog::userFeedback(const QString& msg, bool error) {
-
-	if (!error)
-		mFeedbackLabel->setProperty("warning", false);
-	else
-		mFeedbackLabel->setProperty("warning", true);
+void DkTrainDialog::userFeedback(const QString &msg, bool error)
+{
+    if (!error)
+        mFeedbackLabel->setProperty("warning", false);
+    else
+        mFeedbackLabel->setProperty("warning", true);
 
-	mFeedbackLabel->setText(msg);
-	mFeedbackLabel->style()->unpolish(mFeedbackLabel);
-	mFeedbackLabel->style()->polish(mFeedbackLabel);
-	mFeedbackLabel->update();
+    mFeedbackLabel->setText(msg);
+    mFeedbackLabel->style()->unpolish(mFeedbackLabel);
+    mFeedbackLabel->style()->polish(mFeedbackLabel);
+    mFeedbackLabel->update();
 }
 
-void DkTrainDialog::loadFile(const QString& filePath) {
-
-	QString lFilePath = filePath;
-
-	if (filePath.isEmpty() && !mPathEdit->text().isEmpty())
-		lFilePath = mPathEdit->text();
-	else if (filePath.isEmpty())
-		return;
+void DkTrainDialog::loadFile(const QString &filePath)
+{
+    QString lFilePath = filePath;
 
-	QFileInfo fileInfo(lFilePath);
-	if (!fileInfo.exists() || mAcceptedFile == lFilePath)
-		return;	// error message?!
+    if (filePath.isEmpty() && !mPathEdit->text().isEmpty())
+        lFilePath = mPathEdit->text();
+    else if (filePath.isEmpty())
+        return;
 
-	// update validator
-	mFileValidator.setLastFile(lFilePath);
+    QFileInfo fileInfo(lFilePath);
+    if (!fileInfo.exists() || mAcceptedFile == lFilePath)
+        return; // error message?!
 
-	DkBasicLoader basicLoader;
-	basicLoader.setTraining(true);
+    // update validator
+    mFileValidator.setLastFile(lFilePath);
 
-	// TODO: archives cannot be trained currently
-	bool imgLoaded = basicLoader.loadGeneral(lFilePath, true);
+    DkBasicLoader basicLoader;
+    basicLoader.setTraining(true);
 
-	if (!imgLoaded) {
-		mViewport->setImage(QImage());	// remove the image
-		mAcceptedFile = "";
-		userFeedback(tr("Sorry, currently we don't support: *.%1 files").arg(fileInfo.suffix()), true);
-		return;
-	}
-
-	if (DkSettingsManager::param().app().fileFilters.join(" ").contains(fileInfo.suffix(), Qt::CaseInsensitive)) {
-		userFeedback(tr("*.%1 is already supported.").arg(fileInfo.suffix()), false);
-		imgLoaded = false;
-	}
-	else
-		userFeedback(tr("*.%1 is supported.").arg(fileInfo.suffix()), false);
-
-	mViewport->setImage(basicLoader.image());
-	mAcceptedFile = lFilePath;
-
-	// try loading the file
-	// if loaded !
-	mButtons->button(QDialogButtonBox::Ok)->setEnabled(imgLoaded);
-}
+    // TODO: archives cannot be trained currently
+    bool imgLoaded = basicLoader.loadGeneral(lFilePath, true);
 
-void DkTrainDialog::accept() {
-
-	QFileInfo acceptedFileInfo(mAcceptedFile);
-
-	// add the extension to user filters
-	if (!DkSettingsManager::param().app().fileFilters.join(" ").contains(acceptedFileInfo.suffix(), Qt::CaseInsensitive)) {
-
-		QString name = QInputDialog::getText(this, "Format Name", tr("Please name the new format:"), QLineEdit::Normal, "Your File Format");
-		QString tag = name + " (*." + acceptedFileInfo.suffix() + ")";
+    if (!imgLoaded) {
+        mViewport->setImage(QImage()); // remove the image
+        mAcceptedFile = "";
+        userFeedback(tr("Sorry, currently we don't support: *.%1 files").arg(fileInfo.suffix()), true);
+        return;
+    }
 
-		// load user filters
-		DefaultSettings settings;
-		QStringList userFilters = settings.value("ResourceSettings/userFilters", QStringList()).toStringList();
-		userFilters.append(tag);
-		settings.setValue("ResourceSettings/userFilters", userFilters);
-		DkSettingsManager::param().app().openFilters.append(tag);
-		DkSettingsManager::param().app().fileFilters.append("*." + acceptedFileInfo.suffix());
-		DkSettingsManager::param().app().browseFilters += acceptedFileInfo.suffix();
-	}
+    if (DkSettingsManager::param().app().fileFilters.join(" ").contains(fileInfo.suffix(), Qt::CaseInsensitive)) {
+        userFeedback(tr("*.%1 is already supported.").arg(fileInfo.suffix()), false);
+        imgLoaded = false;
+    } else
+        userFeedback(tr("*.%1 is supported.").arg(fileInfo.suffix()), false);
+
+    mViewport->setImage(basicLoader.image());
+    mAcceptedFile = lFilePath;
+
+    // try loading the file
+    // if loaded !
+    mButtons->button(QDialogButtonBox::Ok)->setEnabled(imgLoaded);
+}
+
+void DkTrainDialog::accept()
+{
+    QFileInfo acceptedFileInfo(mAcceptedFile);
+
+    // add the extension to user filters
+    if (!DkSettingsManager::param().app().fileFilters.join(" ").contains(acceptedFileInfo.suffix(), Qt::CaseInsensitive)) {
+        QString name = QInputDialog::getText(this, "Format Name", tr("Please name the new format:"), QLineEdit::Normal, "Your File Format");
+        QString tag = name + " (*." + acceptedFileInfo.suffix() + ")";
+
+        // load user filters
+        DefaultSettings settings;
+        QStringList userFilters = settings.value("ResourceSettings/userFilters", QStringList()).toStringList();
+        userFilters.append(tag);
+        settings.setValue("ResourceSettings/userFilters", userFilters);
+        DkSettingsManager::param().app().openFilters.append(tag);
+        DkSettingsManager::param().app().fileFilters.append("*." + acceptedFileInfo.suffix());
+        DkSettingsManager::param().app().browseFilters += acceptedFileInfo.suffix();
+    }
 
-	QDialog::accept();
+    QDialog::accept();
 }
 
-void DkTrainDialog::dropEvent(QDropEvent *event) {
-
-	if (event->mimeData()->hasUrls() && event->mimeData()->urls().size() > 0) {
-		QUrl url = event->mimeData()->urls().at(0);
-		qDebug() << "dropping: " << url;
-		url = url.toLocalFile();
+void DkTrainDialog::dropEvent(QDropEvent *event)
+{
+    if (event->mimeData()->hasUrls() && event->mimeData()->urls().size() > 0) {
+        QUrl url = event->mimeData()->urls().at(0);
+        qDebug() << "dropping: " << url;
+        url = url.toLocalFile();
 
-		mPathEdit->setText(url.toString());
-		loadFile();
-	}
+        mPathEdit->setText(url.toString());
+        loadFile();
+    }
 }
 
-void DkTrainDialog::dragEnterEvent(QDragEnterEvent *event) {
+void DkTrainDialog::dragEnterEvent(QDragEnterEvent *event)
+{
+    if (event->mimeData()->hasUrls()) {
+        QUrl url = event->mimeData()->urls().at(0);
+        url = url.toLocalFile();
+        QFileInfo file = QFileInfo(url.toString());
 
-	if (event->mimeData()->hasUrls()) {
-		QUrl url = event->mimeData()->urls().at(0);
-		url = url.toLocalFile();
-		QFileInfo file = QFileInfo(url.toString());
-
-		if (file.exists())
-			event->acceptProposedAction();
-	}
+        if (file.exists())
+            event->acceptProposedAction();
+    }
 }
 
 // DkAppManagerDialog --------------------------------------------------------------------
-DkAppManagerDialog::DkAppManagerDialog(DkAppManager* manager /* = 0 */, QWidget* parent /* = 0 */, Qt::WindowFlags flags /* = 0 */) : QDialog(parent, flags) {
-
-	this->manager = manager;
-	setWindowTitle(tr("Manage Applications"));
-	createLayout();
-}
-
-void DkAppManagerDialog::createLayout() {
-
-	QVector<QAction* > appActions = manager->getActions();
-
-	model = new QStandardItemModel(this);
-	for (int rIdx = 0; rIdx < appActions.size(); rIdx++)
-		model->appendRow(getItems(appActions.at(rIdx)));
-
-	appTableView = new QTableView(this);
-	appTableView->setModel(model);
-	appTableView->setSelectionBehavior(QAbstractItemView::SelectRows);
-	appTableView->verticalHeader()->hide();
-	appTableView->horizontalHeader()->hide();
-	//appTableView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-	appTableView->setShowGrid(false);
-	appTableView->resizeColumnsToContents();
-	appTableView->resizeRowsToContents();
-	appTableView->setWordWrap(false);
-
-	QPushButton* runButton = new QPushButton(tr("&Run"), this);
-	runButton->setObjectName("runButton");
-
-	QPushButton* addButton = new QPushButton(tr("&Add"), this);
-	addButton->setObjectName("addButton");
-
-	QPushButton* deleteButton = new QPushButton(tr("&Delete"), this);
-	deleteButton->setObjectName("deleteButton");
-	deleteButton->setShortcut(QKeySequence::Delete);
-
-	// mButtons
-	QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
-	buttons->button(QDialogButtonBox::Ok)->setText(tr("&OK"));
-	buttons->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel"));
-	connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
-	connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
-	buttons->addButton(runButton, QDialogButtonBox::ActionRole);
-	buttons->addButton(addButton, QDialogButtonBox::ActionRole);
-	buttons->addButton(deleteButton, QDialogButtonBox::ActionRole);
-
-	QVBoxLayout* layout = new QVBoxLayout(this);
-	layout->addWidget(appTableView);
-	layout->addWidget(buttons);
-	QMetaObject::connectSlotsByName(this);
-}
-
-QList<QStandardItem* > DkAppManagerDialog::getItems(QAction* action) {
-
-	QList<QStandardItem* > items;
-	QStandardItem* item = new QStandardItem(action->icon(), action->text().remove("&"));
-	//item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
-	items.append(item);
-	item = new QStandardItem(action->toolTip());
-	item->setFlags(Qt::ItemIsSelectable);
-	items.append(item);
-
-	return items;
-}
-
-void DkAppManagerDialog::on_addButton_clicked() {
-
-	// load system default open dialog
-	QString appFilter;
-	QString defaultPath;
+DkAppManagerDialog::DkAppManagerDialog(DkAppManager *manager /* = 0 */, QWidget *parent /* = 0 */, Qt::WindowFlags flags /* = 0 */)
+    : QDialog(parent, flags)
+{
+    this->manager = manager;
+    setWindowTitle(tr("Manage Applications"));
+    createLayout();
+}
+
+void DkAppManagerDialog::createLayout()
+{
+    QVector<QAction *> appActions = manager->getActions();
+
+    model = new QStandardItemModel(this);
+    for (int rIdx = 0; rIdx < appActions.size(); rIdx++)
+        model->appendRow(getItems(appActions.at(rIdx)));
+
+    appTableView = new QTableView(this);
+    appTableView->setModel(model);
+    appTableView->setSelectionBehavior(QAbstractItemView::SelectRows);
+    appTableView->verticalHeader()->hide();
+    appTableView->horizontalHeader()->hide();
+    // appTableView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+    appTableView->setShowGrid(false);
+    appTableView->resizeColumnsToContents();
+    appTableView->resizeRowsToContents();
+    appTableView->setWordWrap(false);
+
+    QPushButton *runButton = new QPushButton(tr("&Run"), this);
+    runButton->setObjectName("runButton");
+
+    QPushButton *addButton = new QPushButton(tr("&Add"), this);
+    addButton->setObjectName("addButton");
+
+    QPushButton *deleteButton = new QPushButton(tr("&Delete"), this);
+    deleteButton->setObjectName("deleteButton");
+    deleteButton->setShortcut(QKeySequence::Delete);
+
+    // mButtons
+    QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
+    buttons->button(QDialogButtonBox::Ok)->setText(tr("&OK"));
+    buttons->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel"));
+    connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
+    connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
+    buttons->addButton(runButton, QDialogButtonBox::ActionRole);
+    buttons->addButton(addButton, QDialogButtonBox::ActionRole);
+    buttons->addButton(deleteButton, QDialogButtonBox::ActionRole);
+
+    QVBoxLayout *layout = new QVBoxLayout(this);
+    layout->addWidget(appTableView);
+    layout->addWidget(buttons);
+    QMetaObject::connectSlotsByName(this);
+}
+
+QList<QStandardItem *> DkAppManagerDialog::getItems(QAction *action)
+{
+    QList<QStandardItem *> items;
+    QStandardItem *item = new QStandardItem(action->icon(), action->text().remove("&"));
+    // item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
+    items.append(item);
+    item = new QStandardItem(action->toolTip());
+    item->setFlags(Qt::ItemIsSelectable);
+    items.append(item);
+
+    return items;
+}
+
+void DkAppManagerDialog::on_addButton_clicked()
+{
+    // load system default open dialog
+    QString appFilter;
+    QString defaultPath;
 #ifdef Q_OS_WIN
-	appFilter += tr("Executable Files (*.exe);;");
-	defaultPath = getenv("PROGRAMFILES");
-#elif QT_VERSION < 0x050000
-	defaultPath = QDesktopServices::storageLocation(QDesktopServices::ApplicationsLocation); // retrieves startmenu on windows?!
+    appFilter += tr("Executable Files (*.exe);;");
+    defaultPath = getenv("PROGRAMFILES");
 #else
-	defaultPath = QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation);	// still retrieves startmenu on windows
+    defaultPath = QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation); // still retrieves startmenu on windows
 #endif
 
-	QString filePath = QFileDialog::getOpenFileName(
-		this, 
-		tr("Open Application"),
-		defaultPath, 
-		appFilter,
-		nullptr,
-		DkDialog::fileDialogOptions()
-	);
+    QString filePath = QFileDialog::getOpenFileName(this, tr("Open Application"), defaultPath, appFilter, nullptr, DkDialog::fileDialogOptions());
 
-	if (filePath.isEmpty())
-		return;
+    if (filePath.isEmpty())
+        return;
 
-	QAction* newApp = manager->createAction(filePath);
-
-	if (newApp)
-		model->appendRow(getItems(newApp));
+    QAction *newApp = manager->createAction(filePath);
 
+    if (newApp)
+        model->appendRow(getItems(newApp));
 }
 
-void DkAppManagerDialog::on_deleteButton_clicked() {
-
-	QModelIndexList selRows = appTableView->selectionModel()->selectedRows();
+void DkAppManagerDialog::on_deleteButton_clicked()
+{
+    QModelIndexList selRows = appTableView->selectionModel()->selectedRows();
 
-	while (!selRows.isEmpty()) {
-		model->removeRows(selRows.last().row(), 1);
-		selRows.removeLast();
-	}
+    while (!selRows.isEmpty()) {
+        model->removeRows(selRows.last().row(), 1);
+        selRows.removeLast();
+    }
 }
 
-void DkAppManagerDialog::on_runButton_clicked() {
-
-	accept();
+void DkAppManagerDialog::on_runButton_clicked()
+{
+    accept();
 
-	QItemSelectionModel* sel = appTableView->selectionModel();
+    QItemSelectionModel *sel = appTableView->selectionModel();
 
-	if (!sel->hasSelection() && !manager->getActions().isEmpty())
-		emit openWithSignal(manager->getActions().first());
-	
-	else if (!manager->getActions().isEmpty()) {
+    if (!sel->hasSelection() && !manager->getActions().isEmpty())
+        emit openWithSignal(manager->getActions().first());
 
-		QModelIndexList rows = sel->selectedRows();
-
-		for (int idx = 0; idx < rows.size(); idx++) {
-			emit openWithSignal(manager->getActions().at(rows.at(idx).row()));
-		}
-	}
+    else if (!manager->getActions().isEmpty()) {
+        QModelIndexList rows = sel->selectedRows();
 
+        for (int idx = 0; idx < rows.size(); idx++) {
+            emit openWithSignal(manager->getActions().at(rows.at(idx).row()));
+        }
+    }
 }
 
-void DkAppManagerDialog::accept() {
-
-	QVector<QAction* > apps;
-
-	for (int idx = 0; idx < model->rowCount(); idx++) {
+void DkAppManagerDialog::accept()
+{
+    QVector<QAction *> apps;
 
-		QString filePath = model->item(idx, 1)->text();
-		QString name = model->item(idx, 0)->text();
-		QAction* action = manager->findAction(filePath);
+    for (int idx = 0; idx < model->rowCount(); idx++) {
+        QString filePath = model->item(idx, 1)->text();
+        QString name = model->item(idx, 0)->text();
+        QAction *action = manager->findAction(filePath);
 
-		if (!action)
-			action = manager->createAction(filePath);
-		// obviously I cannot create this action - should we tell user?
-		if (!action)	
-			continue;
+        if (!action)
+            action = manager->createAction(filePath);
+        // obviously I cannot create this action - should we tell user?
+        if (!action)
+            continue;
 
-		if (name != action->text().remove("&"))
-			action->setText(name);
+        if (name != action->text().remove("&"))
+            action->setText(name);
 
-		qDebug() << "pushing back: " << action->text();
+        qDebug() << "pushing back: " << action->text();
 
-		apps.append(action);
-	}
+        apps.append(action);
+    }
 
-	manager->setActions(apps);
+    manager->setActions(apps);
 
-	QDialog::accept();
+    QDialog::accept();
 }
 
 // DkSearchDialaog --------------------------------------------------------------------
-DkSearchDialog::DkSearchDialog(QWidget* parent, Qt::WindowFlags flags) : QDialog(parent, flags) {
-
-	init();
+DkSearchDialog::DkSearchDialog(QWidget *parent, Qt::WindowFlags flags)
+    : QDialog(parent, flags)
+{
+    init();
 }
 
-void DkSearchDialog::init() {
-
-	setObjectName("DkSearchDialog");
-	setWindowTitle(tr("Find & Filter"));
+void DkSearchDialog::init()
+{
+    setObjectName("DkSearchDialog");
+    setWindowTitle(tr("Find & Filter"));
 
-	mEndMessage = tr("Load All");
+    mEndMessage = tr("Load All");
 
-	QVBoxLayout* layout = new QVBoxLayout(this);
+    QVBoxLayout *layout = new QVBoxLayout(this);
 
-	QCompleter* history = new QCompleter(DkSettingsManager::param().global().searchHistory, this);
-	history->setCompletionMode(QCompleter::InlineCompletion);
-	mSearchBar = new QLineEdit();
-	mSearchBar->setObjectName("searchBar");
-	mSearchBar->setToolTip(tr("Type search words or a regular expression"));
-	mSearchBar->setCompleter(history);
+    QCompleter *history = new QCompleter(DkSettingsManager::param().global().searchHistory, this);
+    history->setCompletionMode(QCompleter::InlineCompletion);
+    mSearchBar = new QLineEdit();
+    mSearchBar->setObjectName("searchBar");
+    mSearchBar->setToolTip(tr("Type search words or a regular expression"));
+    mSearchBar->setCompleter(history);
 
-	mStringModel = new QStringListModel(this);
+    mStringModel = new QStringListModel(this);
 
-	mResultListView = new QListView(this);
-	mResultListView->setObjectName("resultListView");
-	mResultListView->setModel(mStringModel);
-	mResultListView->setEditTriggers(QAbstractItemView::NoEditTriggers);
-	mResultListView->setSelectionMode(QAbstractItemView::SingleSelection);
+    mResultListView = new QListView(this);
+    mResultListView->setObjectName("resultListView");
+    mResultListView->setModel(mStringModel);
+    mResultListView->setEditTriggers(QAbstractItemView::NoEditTriggers);
+    mResultListView->setSelectionMode(QAbstractItemView::SingleSelection);
 
-	mFilterButton = new QPushButton(tr("&Filter"), this);
-	mFilterButton->setObjectName("filterButton");
+    mFilterButton = new QPushButton(tr("&Filter"), this);
+    mFilterButton->setObjectName("filterButton");
 
-	mButtons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal);
-	mButtons->button(QDialogButtonBox::Ok)->setDefault(true);
-	mButtons->button(QDialogButtonBox::Ok)->setText(tr("F&ind"));
-	mButtons->addButton(mFilterButton, QDialogButtonBox::ActionRole);
+    mButtons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal);
+    mButtons->button(QDialogButtonBox::Ok)->setDefault(true);
+    mButtons->button(QDialogButtonBox::Ok)->setText(tr("F&ind"));
+    mButtons->addButton(mFilterButton, QDialogButtonBox::ActionRole);
 
-	connect(mButtons, SIGNAL(accepted()), this, SLOT(accept()));
-	connect(mButtons, SIGNAL(rejected()), this, SLOT(reject()));
+    connect(mButtons, SIGNAL(accepted()), this, SLOT(accept()));
+    connect(mButtons, SIGNAL(rejected()), this, SLOT(reject()));
 
-	layout->addWidget(mSearchBar);
-	layout->addWidget(mResultListView);
-	layout->addWidget(mButtons);
+    layout->addWidget(mSearchBar);
+    layout->addWidget(mResultListView);
+    layout->addWidget(mButtons);
 
-	mSearchBar->setFocus(Qt::MouseFocusReason);
+    mSearchBar->setFocus(Qt::MouseFocusReason);
 
-	QMetaObject::connectSlotsByName(this);
+    QMetaObject::connectSlotsByName(this);
 }
 
-void DkSearchDialog::setFiles(const QStringList& fileList) {
-	mFileList = fileList;
-	mResultList = fileList;
-	mStringModel->setStringList(makeViewable(fileList));
+void DkSearchDialog::setFiles(const QStringList &fileList)
+{
+    mFileList = fileList;
+    mResultList = fileList;
+    mStringModel->setStringList(makeViewable(fileList));
 }
 
-void DkSearchDialog::setPath(const QString& dirPath) {
-	mPath = dirPath;
+void DkSearchDialog::setPath(const QString &dirPath)
+{
+    mPath = dirPath;
 }
 
-bool DkSearchDialog::filterPressed() const {
-	return mIsFilterPressed;
+bool DkSearchDialog::filterPressed() const
+{
+    return mIsFilterPressed;
 }
 
-void DkSearchDialog::on_searchBar_textChanged(const QString& text) {
+void DkSearchDialog::on_searchBar_textChanged(const QString &text)
+{
+    DkTimer dt;
 
-	DkTimer dt;
+    if (text == mCurrentSearch)
+        return;
 
-	if (text == mCurrentSearch)
-		return;
-	
-	mResultList = DkUtils::filterStringList(text, mFileList);
-	qDebug() << "searching [" << text << "] - converted to individual keywords [" << text.split(" ") << "] takes: " << dt;
-	mCurrentSearch = text;
+    mResultList = DkUtils::filterStringList(text, mFileList);
+    qDebug() << "searching [" << text << "] - converted to individual keywords [" << text.split(" ") << "] takes: " << dt;
+    mCurrentSearch = text;
 
-	if (mResultList.empty()) {
-		QStringList answerList;
-		answerList.append(tr("No Matching Items"));
-		mStringModel->setStringList(answerList);
+    if (mResultList.empty()) {
+        QStringList answerList;
+        answerList.append(tr("No Matching Items"));
+        mStringModel->setStringList(answerList);
 
-		mResultListView->setProperty("empty", true);
-		
-		mFilterButton->setEnabled(false);
-		mButtons->button(QDialogButtonBox::Ok)->setEnabled(false);
-	}
-	else {
-		mFilterButton->setEnabled(true);
-		mButtons->button(QDialogButtonBox::Ok)->setEnabled(true);
-		mStringModel->setStringList(makeViewable(mResultList));
-		mResultListView->selectionModel()->setCurrentIndex(mStringModel->index(0, 0), QItemSelectionModel::SelectCurrent);
-		mResultListView->setProperty("empty", false);
-	}
+        mResultListView->setProperty("empty", true);
 
-	mResultListView->style()->unpolish(mResultListView);
-	mResultListView->style()->polish(mResultListView);
-	mResultListView->update();
-
-	qDebug() << "searching takes (total): " << dt;
-}
-
-void DkSearchDialog::on_resultListView_doubleClicked(const QModelIndex& modelIndex) {
+        mFilterButton->setEnabled(false);
+        mButtons->button(QDialogButtonBox::Ok)->setEnabled(false);
+    } else {
+        mFilterButton->setEnabled(true);
+        mButtons->button(QDialogButtonBox::Ok)->setEnabled(true);
+        mStringModel->setStringList(makeViewable(mResultList));
+        mResultListView->selectionModel()->setCurrentIndex(mStringModel->index(0, 0), QItemSelectionModel::SelectCurrent);
+        mResultListView->setProperty("empty", false);
+    }
 
-	if (modelIndex.data().toString() == mEndMessage) {
-		mStringModel->setStringList(makeViewable(mResultList, true));
-		return;
-	}
+    mResultListView->style()->unpolish(mResultListView);
+    mResultListView->style()->polish(mResultListView);
+    mResultListView->update();
 
-	emit loadFileSignal(QFileInfo(mPath, modelIndex.data().toString()).absoluteFilePath());
-	close();
+    qDebug() << "searching takes (total): " << dt;
 }
 
-void DkSearchDialog::on_resultListView_clicked(const QModelIndex& modelIndex) {
+void DkSearchDialog::on_resultListView_doubleClicked(const QModelIndex &modelIndex)
+{
+    if (modelIndex.data().toString() == mEndMessage) {
+        mStringModel->setStringList(makeViewable(mResultList, true));
+        return;
+    }
 
-	if (modelIndex.data().toString() == mEndMessage)
-		mStringModel->setStringList(makeViewable(mResultList, true));
+    emit loadFileSignal(QFileInfo(mPath, modelIndex.data().toString()).absoluteFilePath());
+    close();
 }
 
-void DkSearchDialog::accept() {
+void DkSearchDialog::on_resultListView_clicked(const QModelIndex &modelIndex)
+{
+    if (modelIndex.data().toString() == mEndMessage)
+        mStringModel->setStringList(makeViewable(mResultList, true));
+}
 
-	if (mResultListView->selectionModel()->currentIndex().data().toString() == mEndMessage) {
-		mStringModel->setStringList(makeViewable(mResultList, true));
-		return;
-	}
+void DkSearchDialog::accept()
+{
+    if (mResultListView->selectionModel()->currentIndex().data().toString() == mEndMessage) {
+        mStringModel->setStringList(makeViewable(mResultList, true));
+        return;
+    }
 
-	updateHistory();
+    updateHistory();
 
-	// ok load the selected file
-	QString fileName = mResultListView->selectionModel()->currentIndex().data().toString();
-	qDebug() << "opening filename: " << fileName;
+    // ok load the selected file
+    QString fileName = mResultListView->selectionModel()->currentIndex().data().toString();
+    qDebug() << "opening filename: " << fileName;
 
-	if (!fileName.isEmpty())
-		emit loadFileSignal(QFileInfo(mPath, fileName).absoluteFilePath());
+    if (!fileName.isEmpty())
+        emit loadFileSignal(QFileInfo(mPath, fileName).absoluteFilePath());
 
-	QDialog::accept();
+    QDialog::accept();
 }
 
-void DkSearchDialog::on_filterButton_pressed() {
-
-	filterSignal(mCurrentSearch);
-	mIsFilterPressed = true;
-	DkSearchDialog::accept(); 
-	done(filter_button);
+void DkSearchDialog::on_filterButton_pressed()
+{
+    filterSignal(mCurrentSearch);
+    mIsFilterPressed = true;
+    DkSearchDialog::accept();
+    done(filter_button);
 }
 
-void DkSearchDialog::setDefaultButton(int defaultButton /* = find_button */) {
-
-	if (defaultButton == find_button) {
-		mButtons->button(QDialogButtonBox::Ok)->setAutoDefault(true);
-		mButtons->button(QDialogButtonBox::Cancel)->setAutoDefault(false);
-		mFilterButton->setAutoDefault(false);
-	}
-	else if (defaultButton == filter_button) {
-		mButtons->button(QDialogButtonBox::Ok)->setAutoDefault(false);
-		mButtons->button(QDialogButtonBox::Cancel)->setAutoDefault(false);
-		mFilterButton->setAutoDefault(true);
-	}
+void DkSearchDialog::setDefaultButton(int defaultButton /* = find_button */)
+{
+    if (defaultButton == find_button) {
+        mButtons->button(QDialogButtonBox::Ok)->setAutoDefault(true);
+        mButtons->button(QDialogButtonBox::Cancel)->setAutoDefault(false);
+        mFilterButton->setAutoDefault(false);
+    } else if (defaultButton == filter_button) {
+        mButtons->button(QDialogButtonBox::Ok)->setAutoDefault(false);
+        mButtons->button(QDialogButtonBox::Cancel)->setAutoDefault(false);
+        mFilterButton->setAutoDefault(true);
+    }
 }
 
-void DkSearchDialog::updateHistory() {
-	
-	DkSettingsManager::param().global().searchHistory.append(mCurrentSearch);
+void DkSearchDialog::updateHistory()
+{
+    DkSettingsManager::param().global().searchHistory.append(mCurrentSearch);
 
-	// keep the history small
-	if (DkSettingsManager::param().global().searchHistory.size() > 50)
-		DkSettingsManager::param().global().searchHistory.pop_front();
+    // keep the history small
+    if (DkSettingsManager::param().global().searchHistory.size() > 50)
+        DkSettingsManager::param().global().searchHistory.pop_front();
 
-	//QCompleter* history = new QCompleter(DkSettingsManager::param().global().searchHistory);
-	//searchBar->setCompleter(history);
+    // QCompleter* history = new QCompleter(DkSettingsManager::param().global().searchHistory);
+    // searchBar->setCompleter(history);
 }
 
-QStringList DkSearchDialog::makeViewable(const QStringList& resultList, bool forceAll) {
-	
-	QStringList answerList;
-	
-	// if size > 1000 it gets slow -> cut at 1000 and make an entry for 'expand'
-	if (!forceAll && resultList.size() > 1000) {
+QStringList DkSearchDialog::makeViewable(const QStringList &resultList, bool forceAll)
+{
+    QStringList answerList;
 
-		for (int idx = 0; idx < 1000; idx++)
-			answerList.append(resultList[idx]);
-		answerList.append(mEndMessage);
+    // if size > 1000 it gets slow -> cut at 1000 and make an entry for 'expand'
+    if (!forceAll && resultList.size() > 1000) {
+        for (int idx = 0; idx < 1000; idx++)
+            answerList.append(resultList[idx]);
+        answerList.append(mEndMessage);
 
-		mAllDisplayed = false;
-	}
-	else {
-		mAllDisplayed = true;
-		answerList = resultList;
-	}
+        mAllDisplayed = false;
+    } else {
+        mAllDisplayed = true;
+        answerList = resultList;
+    }
 
-	return answerList;
+    return answerList;
 }
 
 // DkResizeDialog --------------------------------------------------------------------
-DkResizeDialog::DkResizeDialog(QWidget* parent, Qt::WindowFlags flags) : QDialog(parent, flags) {
-
-	init();
-	resize(DkUtils::getInitialDialogSize());
+DkResizeDialog::DkResizeDialog(QWidget *parent, Qt::WindowFlags flags)
+    : QDialog(parent, flags)
+{
+    init();
+    resize(DkUtils::getInitialDialogSize());
 }
 
-void DkResizeDialog::accept() {
-	saveSettings();
+void DkResizeDialog::accept()
+{
+    saveSettings();
 
-	QDialog::accept();
+    QDialog::accept();
 }
 
-void DkResizeDialog::saveSettings() {
-
-	DefaultSettings settings;
-	settings.beginGroup(objectName());
-
-	settings.setValue("ResampleMethod", mResampleBox->currentIndex());
-	settings.setValue("Resample", mResampleCheck->isChecked());
-	settings.setValue("CorrectGamma", mGammaCorrection->isChecked());
-
-	if (mSizeBox->currentIndex() == size_percent) {
-		settings.setValue("Width", mWPixelSpin->value());
-		settings.setValue("Height", mHPixelSpin->value());
-	}
-	else {
-		settings.setValue("Width", 0);
-		settings.setValue("Height", 0);
-	}
-	settings.endGroup();
-}
-
-
-void DkResizeDialog::loadSettings() {
-
-	qDebug() << "loading new settings...";
-
-	DefaultSettings settings;
-	settings.beginGroup(objectName());
-
-	mResampleBox->setCurrentIndex(settings.value("ResampleMethod", ipl_cubic).toInt());
-	mResampleCheck->setChecked(settings.value("Resample", true).toBool());
-	mGammaCorrection->setChecked(settings.value("CorrectGamma", true).toBool());
-
-	if (settings.value("Width", 0).toDouble() != 0) {
-
-		double w = settings.value("Width", 0).toDouble();
-		double h = settings.value("Height", 0).toDouble();
-
-		qDebug() << "width loaded from settings: " << w;
-
-		if (w != h) {
-			mLockButton->setChecked(false);
-			mLockButtonDim->setChecked(false);
-		}
-		mSizeBox->setCurrentIndex(size_percent);
-
-		mWPixelSpin->setValue(w);
-		mHPixelSpin->setValue(h);
-		
-		updateWidth();
-		updateHeight();
-	}
-	settings.endGroup();
-
-}
-
-void DkResizeDialog::init() {
-
-	setObjectName("DkResizeDialog");
-
-	mUnitFactor.resize(unit_end);
-	mUnitFactor.insert(unit_cm, 1.0f);
-	mUnitFactor.insert(unit_mm, 10.0f);
-	mUnitFactor.insert(unit_inch, 1.0f/2.54f);
+void DkResizeDialog::saveSettings()
+{
+    DefaultSettings settings;
+    settings.beginGroup(objectName());
 
-	mResFactor.resize(res_end);
-	mResFactor.insert(res_ppi, 2.54f);
-	mResFactor.insert(res_ppc, 1.0f);
+    settings.setValue("ResampleMethod", mResampleBox->currentIndex());
+    settings.setValue("Resample", mResampleCheck->isChecked());
+    settings.setValue("CorrectGamma", mGammaCorrection->isChecked());
 
-	setWindowTitle(tr("Resize Image"));
-	//setFixedSize(600, 512);
-	createLayout();
-	initBoxes();
-
-	mWPixelSpin->setFocus(Qt::ActiveWindowFocusReason);
-
-	QMetaObject::connectSlotsByName(this);
+    if (mSizeBox->currentIndex() == size_percent) {
+        settings.setValue("Width", mWPixelSpin->value());
+        settings.setValue("Height", mHPixelSpin->value());
+    } else {
+        settings.setValue("Width", 0);
+        settings.setValue("Height", 0);
+    }
+    settings.endGroup();
 }
 
-void DkResizeDialog::createLayout() {
-
-	// preview
-	int minPx = 1;
-	int maxPx = 100000;
-	double minWidth = 1;
-	double maxWidth = 500000;
-	int decimals = 2;
+void DkResizeDialog::loadSettings()
+{
+    qDebug() << "loading new settings...";
 
-	QLabel* origLabelText = new QLabel(tr("Original"));
-	origLabelText->setAlignment(Qt::AlignHCenter);
-	QLabel* newLabel = new QLabel(tr("New"));
-	newLabel->setAlignment(Qt::AlignHCenter);
-
-	// shows the original image
-	mOrigView = new DkBaseViewPort(this);
-	mOrigView->setForceFastRendering(true);
-	mOrigView->setPanControl(QPointF(0.0f, 0.0f));
-	connect(mOrigView, SIGNAL(imageUpdated()), this, SLOT(drawPreview()));
-
-	//// maybe we should report this: 
-	//// if a stylesheet (with border) is set, the var
-	//// cornerPaintingRect in QAbstractScrollArea (which we don't even need : )
-	//// is invalid which blocks re-paints unless the widget gets a focus...
-	//origView->setStyleSheet("QViewPort{border: 1px solid #888;}");
-
-	// shows the preview
-	mPreviewLabel = new QLabel(this);
-	mPreviewLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
-	mPreviewLabel->setMinimumHeight(100);
-
-	// all text dialogs...
-	QDoubleValidator* doubleValidator = new QDoubleValidator(1, 1000000, 2, 0);
-	doubleValidator->setRange(0, 100, 2);
-
-	QWidget* resizeBoxes = new QWidget(this);
-	resizeBoxes->setGeometry(QRect(QPoint(40, 300), QSize(400, 170)));
-
-	QGridLayout* gridLayout = new QGridLayout(resizeBoxes);
-
-	QLabel* wPixelLabel = new QLabel(tr("Width: "), this);
-	wPixelLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
-	mWPixelSpin = new DkSelectAllDoubleSpinBox(this);
-	mWPixelSpin->setObjectName("wPixelSpin");
-	mWPixelSpin->setRange(minPx, maxPx);
-	mWPixelSpin->setDecimals(0);
-
-	mLockButton = new DkButton(DkImage::loadIcon(":/nomacs/img/lock.svg"), DkImage::loadIcon(":/nomacs/img/lock-unlocked.svg"), "lock", this);
-	mLockButton->setObjectName("lockButton");
-	mLockButton->setCheckable(true);
-	mLockButton->setChecked(true);
-
-	QLabel* hPixelLabel = new QLabel(tr("Height: "), this);
-	hPixelLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
-	mHPixelSpin = new DkSelectAllDoubleSpinBox(this);
-	mHPixelSpin->setObjectName("hPixelSpin");
-	mHPixelSpin->setRange(minPx, maxPx);
-	mHPixelSpin->setDecimals(0);
-
-	mSizeBox = new QComboBox(this);
-	QStringList sizeList;
-	sizeList.insert(size_pixel, "pixel");
-	sizeList.insert(size_percent, "%");
-	mSizeBox->addItems(sizeList);
-	mSizeBox->setObjectName("sizeBox");
-
-	// first row
-	int rIdx = 0;
-	gridLayout->addWidget(wPixelLabel, 0, rIdx);
-	gridLayout->addWidget(mWPixelSpin, 0, ++rIdx);
-	gridLayout->addWidget(mLockButton, 0, ++rIdx);
-	gridLayout->addWidget(hPixelLabel, 0, ++rIdx);
-	gridLayout->addWidget(mHPixelSpin, 0, ++rIdx);
-	gridLayout->addWidget(mSizeBox, 0, ++rIdx);
-
-	// Document dimensions
-	QLabel* widthLabel = new QLabel(tr("Width: "));
-	widthLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
-	mWidthSpin = new DkSelectAllDoubleSpinBox();
-	mWidthSpin->setObjectName("widthSpin");
-	mWidthSpin->setRange(minWidth, maxWidth);
-	mWidthSpin->setDecimals(decimals);
-
-
-	mLockButtonDim = new DkButton(DkImage::loadIcon(":/nomacs/img/lock.svg"), DkImage::loadIcon(":/nomacs/img/lock-unlocked.svg"), "lock");
-	//mLockButtonDim->setFixedSize(QSize(16,16));
-	mLockButtonDim->setObjectName("lockButtonDim");
-	mLockButtonDim->setCheckable(true);
-	mLockButtonDim->setChecked(true);
-
-	QLabel* heightLabel = new QLabel(tr("Height: "));
-	heightLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
-	mHeightSpin = new DkSelectAllDoubleSpinBox();
-	mHeightSpin->setObjectName("heightSpin");
-	mHeightSpin->setRange(minWidth, maxWidth);
-	mHeightSpin->setDecimals(decimals);
-
-	mUnitBox = new QComboBox();
-	QStringList unitList;
-	unitList.insert(unit_cm, "cm");
-	unitList.insert(unit_mm, "mm");
-	unitList.insert(unit_inch, "inch");
-	//unitList.insert(unit_percent, "%");
-	mUnitBox->addItems(unitList);
-	mUnitBox->setObjectName("unitBox");
-
-	// second row
-	rIdx = 0;
-	gridLayout->addWidget(widthLabel, 1, rIdx);
-	gridLayout->addWidget(mWidthSpin, 1, ++rIdx);
-	gridLayout->addWidget(mLockButtonDim, 1, ++rIdx);
-	gridLayout->addWidget(heightLabel, 1, ++rIdx);
-	gridLayout->addWidget(mHeightSpin, 1, ++rIdx);
-	gridLayout->addWidget(mUnitBox, 1, ++rIdx);
-
-	// resolution
-	QLabel* resolutionLabel = new QLabel(tr("Resolution: "));
-	resolutionLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
-	mResolutionSpin = new DkSelectAllDoubleSpinBox();
-	mResolutionSpin->setObjectName("resolutionSpin");
-	mResolutionSpin->setRange(minWidth, maxWidth);
-	mResolutionSpin->setDecimals(decimals);
-
-	mResUnitBox = new QComboBox();
-	QStringList resUnitList;
-	resUnitList.insert(res_ppi, tr("pixel/inch"));
-	resUnitList.insert(res_ppc, tr("pixel/cm"));
-	mResUnitBox->addItems(resUnitList);
-	mResUnitBox->setObjectName("resUnitBox");
-
-	// third row
-	rIdx = 0;
-	gridLayout->addWidget(resolutionLabel, 2, rIdx);
-	gridLayout->addWidget(mResolutionSpin, 2, ++rIdx);
-	gridLayout->addWidget(mResUnitBox, 2, ++rIdx, 1, 2);
-
-	// resample
-	mResampleCheck = new QCheckBox(tr("Resample Image:"));
-	mResampleCheck->setChecked(true);
-	mResampleCheck->setObjectName("resampleCheck");
-
-	// TODO: disable items if no opencv is available
-	mResampleBox = new QComboBox();
-	QStringList resampleList;
-	resampleList.insert(ipl_nearest, tr("Nearest Neighbor"));
-	resampleList.insert(ipl_area, tr("Area (best for downscaling)"));
-	resampleList.insert(ipl_linear, tr("Linear"));
-	resampleList.insert(ipl_cubic, tr("Bicubic (4x4 pixel interpolation)"));
-	resampleList.insert(ipl_lanczos, tr("Lanczos (8x8 pixel interpolation)"));
-	mResampleBox->addItems(resampleList);
-	mResampleBox->setObjectName("resampleBox");
-	mResampleBox->setCurrentIndex(ipl_cubic);
-
-	// last two rows
-	gridLayout->addWidget(mResampleCheck, 3, 1, 1, 3);
-	gridLayout->addWidget(mResampleBox, 4, 1, 1, 3);
-
-	mGammaCorrection = new QCheckBox(tr("Gamma Correction"));
-	mGammaCorrection->setObjectName("gammaCorrection");
-	mGammaCorrection->setChecked(false);	// default: false since gamma might destroy soft gradients
-
-	gridLayout->addWidget(mGammaCorrection, 5, 1, 1, 3);
-
-	// add stretch
-	gridLayout->setColumnStretch(6, 1);
-
-	// mButtons
-	QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
-	buttons->button(QDialogButtonBox::Ok)->setText(tr("&OK"));
-	buttons->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel"));
-	connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
-	connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
+    DefaultSettings settings;
+    settings.beginGroup(objectName());
 
-	QGridLayout* layout = new QGridLayout(this);
-	layout->setColumnStretch(0,1);
-	layout->setColumnStretch(1,1);
+    mResampleBox->setCurrentIndex(settings.value("ResampleMethod", ipl_cubic).toInt());
+    mResampleCheck->setChecked(settings.value("Resample", true).toBool());
+    mGammaCorrection->setChecked(settings.value("CorrectGamma", true).toBool());
 
-	layout->addWidget(origLabelText, 0, 0);
-	layout->addWidget(newLabel, 0, 1);
-	layout->addWidget(mOrigView, 1, 0);
-	layout->addWidget(mPreviewLabel, 1, 1);
-	layout->addWidget(resizeBoxes, 2, 0, 1, 2, Qt::AlignLeft);
-	//layout->addStretch();
-	layout->addWidget(buttons, 3, 0, 1, 2, Qt::AlignRight);
-	
-	adjustSize();
-	resize(700, 500);
+    if (settings.value("Width", 0).toDouble() != 0) {
+        double w = settings.value("Width", 0).toDouble();
+        double h = settings.value("Height", 0).toDouble();
 
-	//show();
-}
+        qDebug() << "width loaded from settings: " << w;
 
-void DkResizeDialog::initBoxes(bool updateSettings) {
+        if (w != h) {
+            mLockButton->setChecked(false);
+            mLockButtonDim->setChecked(false);
+        }
+        mSizeBox->setCurrentIndex(size_percent);
 
-	if (mImg.isNull())
-		return;
+        mWPixelSpin->setValue(w);
+        mHPixelSpin->setValue(h);
 
-	if (mSizeBox->currentIndex() == size_pixel) {
-		mWPixelSpin->setValue(mImg.width());
-		mHPixelSpin->setValue(mImg.height());
-	}
-	else {
-		mWPixelSpin->setValue(100);
-		mHPixelSpin->setValue(100);
-	}
+        updateWidth();
+        updateHeight();
+    }
+    settings.endGroup();
+}
+
+void DkResizeDialog::init()
+{
+    setObjectName("DkResizeDialog");
+
+    mUnitFactor.resize(unit_end);
+    mUnitFactor.insert(unit_cm, 1.0f);
+    mUnitFactor.insert(unit_mm, 10.0f);
+    mUnitFactor.insert(unit_inch, 1.0f / 2.54f);
+
+    mResFactor.resize(res_end);
+    mResFactor.insert(res_ppi, 2.54f);
+    mResFactor.insert(res_ppc, 1.0f);
+
+    setWindowTitle(tr("Resize Image"));
+    // setFixedSize(600, 512);
+    createLayout();
+    initBoxes();
+
+    mWPixelSpin->setFocus(Qt::ActiveWindowFocusReason);
+
+    QMetaObject::connectSlotsByName(this);
+}
+
+void DkResizeDialog::createLayout()
+{
+    // preview
+    int minPx = 1;
+    int maxPx = 100000;
+    double minWidth = 1;
+    double maxWidth = 500000;
+    int decimals = 2;
+
+    QLabel *origLabelText = new QLabel(tr("Original"));
+    origLabelText->setAlignment(Qt::AlignHCenter);
+    QLabel *newLabel = new QLabel(tr("New"));
+    newLabel->setAlignment(Qt::AlignHCenter);
+
+    // shows the original image
+    mOrigView = new DkBaseViewPort(this);
+    mOrigView->setForceFastRendering(true);
+    mOrigView->setPanControl(QPointF(0.0f, 0.0f));
+    connect(mOrigView, SIGNAL(imageUpdated()), this, SLOT(drawPreview()));
+
+    //// maybe we should report this:
+    //// if a stylesheet (with border) is set, the var
+    //// cornerPaintingRect in QAbstractScrollArea (which we don't even need : )
+    //// is invalid which blocks re-paints unless the widget gets a focus...
+    // origView->setStyleSheet("QViewPort{border: 1px solid #888;}");
+
+    // shows the preview
+    mPreviewLabel = new QLabel(this);
+    mPreviewLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
+    mPreviewLabel->setMinimumHeight(100);
+
+    // all text dialogs...
+    QDoubleValidator *doubleValidator = new QDoubleValidator(1, 1000000, 2, 0);
+    doubleValidator->setRange(0, 100, 2);
+
+    QWidget *resizeBoxes = new QWidget(this);
+    resizeBoxes->setGeometry(QRect(QPoint(40, 300), QSize(400, 170)));
+
+    QGridLayout *gridLayout = new QGridLayout(resizeBoxes);
+
+    QLabel *wPixelLabel = new QLabel(tr("Width: "), this);
+    wPixelLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
+    mWPixelSpin = new DkSelectAllDoubleSpinBox(this);
+    mWPixelSpin->setObjectName("wPixelSpin");
+    mWPixelSpin->setRange(minPx, maxPx);
+    mWPixelSpin->setDecimals(0);
+
+    mLockButton = new DkButton(DkImage::loadIcon(":/nomacs/img/lock.svg"), DkImage::loadIcon(":/nomacs/img/lock-unlocked.svg"), "lock", this);
+    mLockButton->setObjectName("lockButton");
+    mLockButton->setCheckable(true);
+    mLockButton->setChecked(true);
+
+    QLabel *hPixelLabel = new QLabel(tr("Height: "), this);
+    hPixelLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
+    mHPixelSpin = new DkSelectAllDoubleSpinBox(this);
+    mHPixelSpin->setObjectName("hPixelSpin");
+    mHPixelSpin->setRange(minPx, maxPx);
+    mHPixelSpin->setDecimals(0);
+
+    mSizeBox = new QComboBox(this);
+    QStringList sizeList;
+    sizeList.insert(size_pixel, "pixel");
+    sizeList.insert(size_percent, "%");
+    mSizeBox->addItems(sizeList);
+    mSizeBox->setObjectName("sizeBox");
+
+    // first row
+    int rIdx = 0;
+    gridLayout->addWidget(wPixelLabel, 0, rIdx);
+    gridLayout->addWidget(mWPixelSpin, 0, ++rIdx);
+    gridLayout->addWidget(mLockButton, 0, ++rIdx);
+    gridLayout->addWidget(hPixelLabel, 0, ++rIdx);
+    gridLayout->addWidget(mHPixelSpin, 0, ++rIdx);
+    gridLayout->addWidget(mSizeBox, 0, ++rIdx);
+
+    // Document dimensions
+    QLabel *widthLabel = new QLabel(tr("Width: "));
+    widthLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
+    mWidthSpin = new DkSelectAllDoubleSpinBox();
+    mWidthSpin->setObjectName("widthSpin");
+    mWidthSpin->setRange(minWidth, maxWidth);
+    mWidthSpin->setDecimals(decimals);
+
+    mLockButtonDim = new DkButton(DkImage::loadIcon(":/nomacs/img/lock.svg"), DkImage::loadIcon(":/nomacs/img/lock-unlocked.svg"), "lock");
+    // mLockButtonDim->setFixedSize(QSize(16,16));
+    mLockButtonDim->setObjectName("lockButtonDim");
+    mLockButtonDim->setCheckable(true);
+    mLockButtonDim->setChecked(true);
+
+    QLabel *heightLabel = new QLabel(tr("Height: "));
+    heightLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
+    mHeightSpin = new DkSelectAllDoubleSpinBox();
+    mHeightSpin->setObjectName("heightSpin");
+    mHeightSpin->setRange(minWidth, maxWidth);
+    mHeightSpin->setDecimals(decimals);
+
+    mUnitBox = new QComboBox();
+    QStringList unitList;
+    unitList.insert(unit_cm, "cm");
+    unitList.insert(unit_mm, "mm");
+    unitList.insert(unit_inch, "inch");
+    // unitList.insert(unit_percent, "%");
+    mUnitBox->addItems(unitList);
+    mUnitBox->setObjectName("unitBox");
+
+    // second row
+    rIdx = 0;
+    gridLayout->addWidget(widthLabel, 1, rIdx);
+    gridLayout->addWidget(mWidthSpin, 1, ++rIdx);
+    gridLayout->addWidget(mLockButtonDim, 1, ++rIdx);
+    gridLayout->addWidget(heightLabel, 1, ++rIdx);
+    gridLayout->addWidget(mHeightSpin, 1, ++rIdx);
+    gridLayout->addWidget(mUnitBox, 1, ++rIdx);
+
+    // resolution
+    QLabel *resolutionLabel = new QLabel(tr("Resolution: "));
+    resolutionLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
+    mResolutionSpin = new DkSelectAllDoubleSpinBox();
+    mResolutionSpin->setObjectName("resolutionSpin");
+    mResolutionSpin->setRange(minWidth, maxWidth);
+    mResolutionSpin->setDecimals(decimals);
+
+    mResUnitBox = new QComboBox();
+    QStringList resUnitList;
+    resUnitList.insert(res_ppi, tr("pixel/inch"));
+    resUnitList.insert(res_ppc, tr("pixel/cm"));
+    mResUnitBox->addItems(resUnitList);
+    mResUnitBox->setObjectName("resUnitBox");
+
+    // third row
+    rIdx = 0;
+    gridLayout->addWidget(resolutionLabel, 2, rIdx);
+    gridLayout->addWidget(mResolutionSpin, 2, ++rIdx);
+    gridLayout->addWidget(mResUnitBox, 2, ++rIdx, 1, 2);
+
+    // resample
+    mResampleCheck = new QCheckBox(tr("Resample Image:"));
+    mResampleCheck->setChecked(true);
+    mResampleCheck->setObjectName("resampleCheck");
+
+    // TODO: disable items if no opencv is available
+    mResampleBox = new QComboBox();
+    QStringList resampleList;
+    resampleList.insert(ipl_nearest, tr("Nearest Neighbor"));
+    resampleList.insert(ipl_area, tr("Area (best for downscaling)"));
+    resampleList.insert(ipl_linear, tr("Linear"));
+    resampleList.insert(ipl_cubic, tr("Bicubic (4x4 pixel interpolation)"));
+    resampleList.insert(ipl_lanczos, tr("Lanczos (8x8 pixel interpolation)"));
+    mResampleBox->addItems(resampleList);
+    mResampleBox->setObjectName("resampleBox");
+    mResampleBox->setCurrentIndex(ipl_cubic);
+
+    // last two rows
+    gridLayout->addWidget(mResampleCheck, 3, 1, 1, 3);
+    gridLayout->addWidget(mResampleBox, 4, 1, 1, 3);
+
+    mGammaCorrection = new QCheckBox(tr("Gamma Correction"));
+    mGammaCorrection->setObjectName("gammaCorrection");
+    mGammaCorrection->setChecked(false); // default: false since gamma might destroy soft gradients
+
+    gridLayout->addWidget(mGammaCorrection, 5, 1, 1, 3);
+
+    // add stretch
+    gridLayout->setColumnStretch(6, 1);
+
+    // mButtons
+    QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
+    buttons->button(QDialogButtonBox::Ok)->setText(tr("&OK"));
+    buttons->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel"));
+    connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
+    connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
+
+    QGridLayout *layout = new QGridLayout(this);
+    layout->setColumnStretch(0, 1);
+    layout->setColumnStretch(1, 1);
+
+    layout->addWidget(origLabelText, 0, 0);
+    layout->addWidget(newLabel, 0, 1);
+    layout->addWidget(mOrigView, 1, 0);
+    layout->addWidget(mPreviewLabel, 1, 1);
+    layout->addWidget(resizeBoxes, 2, 0, 1, 2, Qt::AlignLeft);
+    // layout->addStretch();
+    layout->addWidget(buttons, 3, 0, 1, 2, Qt::AlignRight);
+
+    adjustSize();
+    resize(700, 500);
+
+    // show();
+}
+
+void DkResizeDialog::initBoxes(bool updateSettings)
+{
+    if (mImg.isNull())
+        return;
+
+    if (mSizeBox->currentIndex() == size_pixel) {
+        mWPixelSpin->setValue(mImg.width());
+        mHPixelSpin->setValue(mImg.height());
+    } else {
+        mWPixelSpin->setValue(100);
+        mHPixelSpin->setValue(100);
+    }
 
-	float units = mResFactor.at(mResUnitBox->currentIndex()) * mUnitFactor.at(mUnitBox->currentIndex());
-	float width = (float)mImg.width()/mExifDpi * units;
-	mWidthSpin->setValue(width);
+    float units = mResFactor.at(mResUnitBox->currentIndex()) * mUnitFactor.at(mUnitBox->currentIndex());
+    float width = (float)mImg.width() / mExifDpi * units;
+    mWidthSpin->setValue(width);
 
-	float height = (float)mImg.height()/mExifDpi * units;
-	mHeightSpin->setValue(height);
+    float height = (float)mImg.height() / mExifDpi * units;
+    mHeightSpin->setValue(height);
 
-	if (updateSettings)
-		loadSettings();
+    if (updateSettings)
+        loadSettings();
 }
 
-void DkResizeDialog::setImage(const QImage& img) {
-	
-	mImg = img;
-	initBoxes(true);
-	updateSnippets();
-	drawPreview();
-	mWPixelSpin->selectAll();
+void DkResizeDialog::setImage(const QImage &img)
+{
+    mImg = img;
+    initBoxes(true);
+    updateSnippets();
+    drawPreview();
+    mWPixelSpin->selectAll();
 }
 
-QImage DkResizeDialog::getResizedImage() {
-
-	return resizeImg(mImg, false);
+QImage DkResizeDialog::getResizedImage()
+{
+    return resizeImg(mImg, false);
 }
 
-void DkResizeDialog::setExifDpi(float exifDpi) {
-
-	mExifDpi = exifDpi;
-	mResolutionSpin->blockSignals(true);
-	mResolutionSpin->setValue(exifDpi);
-	mResolutionSpin->blockSignals(false);
+void DkResizeDialog::setExifDpi(float exifDpi)
+{
+    mExifDpi = exifDpi;
+    mResolutionSpin->blockSignals(true);
+    mResolutionSpin->setValue(exifDpi);
+    mResolutionSpin->blockSignals(false);
 }
 
-float DkResizeDialog::getExifDpi() {
-	return mExifDpi;
+float DkResizeDialog::getExifDpi()
+{
+    return mExifDpi;
 }
 
-bool DkResizeDialog::resample() {
-	return mResampleCheck->isChecked();
+bool DkResizeDialog::resample()
+{
+    return mResampleCheck->isChecked();
 }
 
-void DkResizeDialog::updateWidth() {
-
-	float pWidth = (float)mWPixelSpin->value();
+void DkResizeDialog::updateWidth()
+{
+    float pWidth = (float)mWPixelSpin->value();
 
-	if (mSizeBox->currentIndex() == size_percent)
-		pWidth = (float)qRound(pWidth/100 * mImg.width()); 
+    if (mSizeBox->currentIndex() == size_percent)
+        pWidth = (float)qRound(pWidth / 100 * mImg.width());
 
-	float units = mResFactor.at(mResUnitBox->currentIndex()) * mUnitFactor.at(mUnitBox->currentIndex());
-	float width = pWidth/mExifDpi * units;
-	mWidthSpin->setValue(width);
+    float units = mResFactor.at(mResUnitBox->currentIndex()) * mUnitFactor.at(mUnitBox->currentIndex());
+    float width = pWidth / mExifDpi * units;
+    mWidthSpin->setValue(width);
 }
 
-void DkResizeDialog::updateHeight() {
+void DkResizeDialog::updateHeight()
+{
+    float pHeight = (float)mHPixelSpin->value();
 
-	float pHeight = (float)mHPixelSpin->value();
+    if (mSizeBox->currentIndex() == size_percent)
+        pHeight = (float)qRound(pHeight / 100 * mImg.height());
 
-	if (mSizeBox->currentIndex() == size_percent)
-		pHeight = (float)qRound(pHeight/100 * mImg.height()); 
-
-	float units = mResFactor.at(mResUnitBox->currentIndex()) * mUnitFactor.at(mUnitBox->currentIndex());
-	float height = pHeight/mExifDpi * units;
-	mHeightSpin->setValue(height);
+    float units = mResFactor.at(mResUnitBox->currentIndex()) * mUnitFactor.at(mUnitBox->currentIndex());
+    float height = pHeight / mExifDpi * units;
+    mHeightSpin->setValue(height);
 }
 
-void DkResizeDialog::updateResolution() {
-
-	qDebug() << "updating resolution...";
-	float wPixel = (float)mWPixelSpin->value();
-	float width = (float)mWidthSpin->value();
+void DkResizeDialog::updateResolution()
+{
+    qDebug() << "updating resolution...";
+    float wPixel = (float)mWPixelSpin->value();
+    float width = (float)mWidthSpin->value();
 
-	float units = mResFactor.at(mResUnitBox->currentIndex()) * mUnitFactor.at(mUnitBox->currentIndex());
-	float resolution = wPixel/width * units;
-	mResolutionSpin->setValue(resolution);
+    float units = mResFactor.at(mResUnitBox->currentIndex()) * mUnitFactor.at(mUnitBox->currentIndex());
+    float resolution = wPixel / width * units;
+    mResolutionSpin->setValue(resolution);
 }
 
-void DkResizeDialog::updatePixelHeight() {
+void DkResizeDialog::updatePixelHeight()
+{
+    float height = (float)mHeightSpin->value();
 
-	float height = (float)mHeightSpin->value();
+    // *1000/10 is for more beautiful values
+    float units = mResFactor.at(mResUnitBox->currentIndex()) * mUnitFactor.at(mUnitBox->currentIndex());
+    float pixelHeight =
+        (mSizeBox->currentIndex() != size_percent) ? qRound(height * mExifDpi / units) : qRound(1000.0f * height * mExifDpi / (units * mImg.height())) / 10.0f;
 
-	// *1000/10 is for more beautiful values
-	float units = mResFactor.at(mResUnitBox->currentIndex()) * mUnitFactor.at(mUnitBox->currentIndex());
-	float pixelHeight = (mSizeBox->currentIndex() != size_percent) ? qRound(height*mExifDpi / units) : qRound(1000.0f*height*mExifDpi / (units * mImg.height()))/10.0f;
-
-	mHPixelSpin->setValue(pixelHeight);
+    mHPixelSpin->setValue(pixelHeight);
 }
 
-void DkResizeDialog::updatePixelWidth() {
-
-	float width = (float)mWidthSpin->value();
+void DkResizeDialog::updatePixelWidth()
+{
+    float width = (float)mWidthSpin->value();
 
-	float units = mResFactor.at(mResUnitBox->currentIndex()) * mUnitFactor.at(mUnitBox->currentIndex());
-	float pixelWidth = (mSizeBox->currentIndex() != size_percent) ? qRound(width*mExifDpi / units) : qRound(1000.0f*width*mExifDpi / (units * mImg.width()))/10.0f;
-	mWPixelSpin->setValue(pixelWidth);
+    float units = mResFactor.at(mResUnitBox->currentIndex()) * mUnitFactor.at(mUnitBox->currentIndex());
+    float pixelWidth =
+        (mSizeBox->currentIndex() != size_percent) ? qRound(width * mExifDpi / units) : qRound(1000.0f * width * mExifDpi / (units * mImg.width())) / 10.0f;
+    mWPixelSpin->setValue(pixelWidth);
 }
 
-void DkResizeDialog::on_lockButtonDim_clicked() {
+void DkResizeDialog::on_lockButtonDim_clicked()
+{
+    mLockButton->setChecked(mLockButtonDim->isChecked());
+    if (!mLockButtonDim->isChecked())
+        return;
 
-	mLockButton->setChecked(mLockButtonDim->isChecked());
-	if (!mLockButtonDim->isChecked())
-		return;
-
-	initBoxes();
-	drawPreview();
+    initBoxes();
+    drawPreview();
 }
 
-void DkResizeDialog::on_lockButton_clicked() {
-
-	mLockButtonDim->setChecked(mLockButton->isChecked());
+void DkResizeDialog::on_lockButton_clicked()
+{
+    mLockButtonDim->setChecked(mLockButton->isChecked());
 
-	if (!mLockButton->isChecked())
-		return;
+    if (!mLockButton->isChecked())
+        return;
 
-	initBoxes();
-	drawPreview();
+    initBoxes();
+    drawPreview();
 }
 
-void DkResizeDialog::on_wPixelSpin_valueChanged(double val) {
+void DkResizeDialog::on_wPixelSpin_valueChanged(double val)
+{
+    if (!mWPixelSpin->hasFocus())
+        return;
 
-	if (!mWPixelSpin->hasFocus())
-		return;
+    updateWidth();
 
-	updateWidth();
-
-	if (!mLockButton->isChecked()) {
-		drawPreview();
-		return;
-	}
+    if (!mLockButton->isChecked()) {
+        drawPreview();
+        return;
+    }
 
-	int newHeight = (mSizeBox->currentIndex() != size_percent) ? qRound((float)val/(float)mImg.width() * mImg.height()) : qRound(val);
-	mHPixelSpin->setValue(newHeight);
-	updateHeight();
-	drawPreview();
+    int newHeight = (mSizeBox->currentIndex() != size_percent) ? qRound((float)val / (float)mImg.width() * mImg.height()) : qRound(val);
+    mHPixelSpin->setValue(newHeight);
+    updateHeight();
+    drawPreview();
 }
 
-void DkResizeDialog::on_hPixelSpin_valueChanged(double val) {
+void DkResizeDialog::on_hPixelSpin_valueChanged(double val)
+{
+    if (!mHPixelSpin->hasFocus())
+        return;
 
-	if(!mHPixelSpin->hasFocus())
-		return;
-	
-	updateHeight();
+    updateHeight();
 
-	if (!mLockButton->isChecked()) {
-		drawPreview();
-		return;
-	}
+    if (!mLockButton->isChecked()) {
+        drawPreview();
+        return;
+    }
 
-	int newWidth = (mSizeBox->currentIndex() != size_percent) ? qRound(val/(float)mImg.height() * (float)mImg.width()) : qRound(val);
-	mWPixelSpin->setValue(newWidth);
-	updateWidth();
-	drawPreview();
+    int newWidth = (mSizeBox->currentIndex() != size_percent) ? qRound(val / (float)mImg.height() * (float)mImg.width()) : qRound(val);
+    mWPixelSpin->setValue(newWidth);
+    updateWidth();
+    drawPreview();
 }
 
-void DkResizeDialog::on_widthSpin_valueChanged(double val) {
-
-	if (!mWidthSpin->hasFocus())
-		return;
+void DkResizeDialog::on_widthSpin_valueChanged(double val)
+{
+    if (!mWidthSpin->hasFocus())
+        return;
 
-	if (mResampleCheck->isChecked()) 
-		updatePixelWidth();
+    if (mResampleCheck->isChecked())
+        updatePixelWidth();
 
-	if (!mLockButton->isChecked()) {
-		drawPreview();
-		return;
-	}
+    if (!mLockButton->isChecked()) {
+        drawPreview();
+        return;
+    }
 
-	mHeightSpin->setValue(val/(float)mImg.width() * (float)mImg.height());
+    mHeightSpin->setValue(val / (float)mImg.width() * (float)mImg.height());
 
-	if (mResampleCheck->isChecked()) 
-		updatePixelHeight();
+    if (mResampleCheck->isChecked())
+        updatePixelHeight();
 
-	if (!mResampleCheck->isChecked())
-		updateResolution();
+    if (!mResampleCheck->isChecked())
+        updateResolution();
 
-	drawPreview();
+    drawPreview();
 }
 
-void DkResizeDialog::on_heightSpin_valueChanged(double val) {
-
-	if (!mHeightSpin->hasFocus())
-		return;
+void DkResizeDialog::on_heightSpin_valueChanged(double val)
+{
+    if (!mHeightSpin->hasFocus())
+        return;
 
-	if (mResampleCheck->isChecked()) 
-		updatePixelHeight();
+    if (mResampleCheck->isChecked())
+        updatePixelHeight();
 
-	if (!mLockButton->isChecked()) {
-		drawPreview();
-		return;
-	}
+    if (!mLockButton->isChecked()) {
+        drawPreview();
+        return;
+    }
 
-	mWidthSpin->setValue(val/(float)mImg.height() * (float)mImg.width());
+    mWidthSpin->setValue(val / (float)mImg.height() * (float)mImg.width());
 
-	if (mResampleCheck->isChecked()) 
-		updatePixelWidth();
+    if (mResampleCheck->isChecked())
+        updatePixelWidth();
 
-	if (!mResampleCheck->isChecked())
-		updateResolution();
-	drawPreview();
+    if (!mResampleCheck->isChecked())
+        updateResolution();
+    drawPreview();
 }
 
-void DkResizeDialog::on_resolutionSpin_valueChanged(double val) {
-
-	mExifDpi = (float)val;
+void DkResizeDialog::on_resolutionSpin_valueChanged(double val)
+{
+    mExifDpi = (float)val;
 
-	if (!mResolutionSpin->hasFocus())
-		return;
+    if (!mResolutionSpin->hasFocus())
+        return;
 
-	updatePixelWidth();
-	updatePixelHeight();
+    updatePixelWidth();
+    updatePixelHeight();
 
-	if (mResampleCheck->isChecked()) {
-		drawPreview();
-		return;
-	}
+    if (mResampleCheck->isChecked()) {
+        drawPreview();
+        return;
+    }
 
-	initBoxes();
+    initBoxes();
 }
 
-
-void DkResizeDialog::on_unitBox_currentIndexChanged(int) {
-
-	updateHeight();
-	updateWidth();
-	//initBoxes();
+void DkResizeDialog::on_unitBox_currentIndexChanged(int)
+{
+    updateHeight();
+    updateWidth();
+    // initBoxes();
 }
 
-void DkResizeDialog::on_sizeBox_currentIndexChanged(int idx) {
-
-	if (idx == size_pixel) {
-		mWPixelSpin->setDecimals(0);
-		mHPixelSpin->setDecimals(0);
-	}
-	else {
-		mWPixelSpin->setDecimals(2);
-		mHPixelSpin->setDecimals(2);
-	}
+void DkResizeDialog::on_sizeBox_currentIndexChanged(int idx)
+{
+    if (idx == size_pixel) {
+        mWPixelSpin->setDecimals(0);
+        mHPixelSpin->setDecimals(0);
+    } else {
+        mWPixelSpin->setDecimals(2);
+        mHPixelSpin->setDecimals(2);
+    }
 
-	updatePixelHeight();
-	updatePixelWidth();
+    updatePixelHeight();
+    updatePixelWidth();
 }
 
-void DkResizeDialog::on_resUnitBox_currentIndexChanged(int) {
-
-	updateResolution();
-	//initBoxes();
+void DkResizeDialog::on_resUnitBox_currentIndexChanged(int)
+{
+    updateResolution();
+    // initBoxes();
 }
 
-void DkResizeDialog::on_resampleCheck_clicked() {
-
-	mResampleBox->setEnabled(mResampleCheck->isChecked());
-	mWPixelSpin->setEnabled(mResampleCheck->isChecked());
-	mHPixelSpin->setEnabled(mResampleCheck->isChecked());
+void DkResizeDialog::on_resampleCheck_clicked()
+{
+    mResampleBox->setEnabled(mResampleCheck->isChecked());
+    mWPixelSpin->setEnabled(mResampleCheck->isChecked());
+    mHPixelSpin->setEnabled(mResampleCheck->isChecked());
 
-	if (!mResampleCheck->isChecked()) {
-		mLockButton->setChecked(true);
-		mLockButtonDim->setChecked(true);
-		initBoxes();
-	}
-	else
-		drawPreview();
+    if (!mResampleCheck->isChecked()) {
+        mLockButton->setChecked(true);
+        mLockButtonDim->setChecked(true);
+        initBoxes();
+    } else
+        drawPreview();
 }
 
-void DkResizeDialog::on_gammaCorrection_clicked() {
-
-	drawPreview();	// diem: just update
+void DkResizeDialog::on_gammaCorrection_clicked()
+{
+    drawPreview(); // diem: just update
 }
 
-void DkResizeDialog::on_resampleBox_currentIndexChanged(int) {
-	drawPreview();
+void DkResizeDialog::on_resampleBox_currentIndexChanged(int)
+{
+    drawPreview();
 }
 
-void DkResizeDialog::updateSnippets() {
-
-	if (mImg.isNull() /*|| !isVisible()*/)
-		return;
+void DkResizeDialog::updateSnippets()
+{
+    if (mImg.isNull() /*|| !isVisible()*/)
+        return;
 
-	mOrigView->setImage(mImg);
-	mOrigView->fullView();
-	mOrigView->zoomConstraints(mOrigView->get100Factor());
+    mOrigView->setImage(mImg);
+    mOrigView->fullView();
+    mOrigView->zoomConstraints(mOrigView->get100Factor());
 }
 
-void DkResizeDialog::drawPreview() {
+void DkResizeDialog::drawPreview()
+{
+    if (mImg.isNull() || !isVisible())
+        return;
 
-	if (mImg.isNull() || !isVisible()) 
-		return;
+    QImage newImg = mOrigView->getCurrentImageRegion();
 
-	QImage newImg = mOrigView->getCurrentImageRegion();
+    // TODO: thread here!
+    QImage img = resizeImg(newImg);
 
-	// TODO: thread here!
-	QImage img = resizeImg(newImg);
-
-	// TODO: is there a better way of mapping the pixels? (ipl here introduces artifacts that are not in the final image)
-	img = img.scaled(mPreviewLabel->size(), Qt::KeepAspectRatio, Qt::FastTransformation);
-	mPreviewLabel->setPixmap(QPixmap::fromImage(img));
+    // TODO: is there a better way of mapping the pixels? (ipl here introduces artifacts that are not in the final image)
+    img = img.scaled(mPreviewLabel->size(), Qt::KeepAspectRatio, Qt::FastTransformation);
+    mPreviewLabel->setPixmap(QPixmap::fromImage(img));
 }
 
-QImage DkResizeDialog::resizeImg(QImage img, bool silent) {
-
-	if (img.isNull())
-		return img;
+QImage DkResizeDialog::resizeImg(QImage img, bool silent)
+{
+    if (img.isNull())
+        return img;
 
-	QSize newSize;
+    QSize newSize;
 
-	if (mSizeBox->currentIndex() == size_percent)
-		newSize = QSize(qRound(mWPixelSpin->value()/100.0f * mImg.width()), qRound(mHPixelSpin->value()/100.0f * mImg.height()));
-	else
-		newSize = QSize(qRound(mWPixelSpin->value()), qRound(mHPixelSpin->value()));
+    if (mSizeBox->currentIndex() == size_percent)
+        newSize = QSize(qRound(mWPixelSpin->value() / 100.0f * mImg.width()), qRound(mHPixelSpin->value() / 100.0f * mImg.height()));
+    else
+        newSize = QSize(qRound(mWPixelSpin->value()), qRound(mHPixelSpin->value()));
 
-	QSize imgSize = mImg.size();
+    QSize imgSize = mImg.size();
 
-	// nothing to do
-	if (mImg.size() == newSize)
-		return img;
+    // nothing to do
+    if (mImg.size() == newSize)
+        return img;
 
-	if (mImg.size() != img.size()) {
-		// compute relative size
-		float relWidth = (float)newSize.width()/(float)imgSize.width();
-		float relHeight = (float)newSize.height()/(float)imgSize.height();
+    if (mImg.size() != img.size()) {
+        // compute relative size
+        float relWidth = (float)newSize.width() / (float)imgSize.width();
+        float relHeight = (float)newSize.height() / (float)imgSize.height();
 
-		newSize = QSize(qRound(img.width()*relWidth), qRound(img.height()*relHeight));
-	}
-
-	if (newSize.width() < mWPixelSpin->minimum() || newSize.width() > mWPixelSpin->maximum() || 
-		newSize.height() < mHPixelSpin->minimum() || newSize.height() > mHPixelSpin->maximum()) {
+        newSize = QSize(qRound(img.width() * relWidth), qRound(img.height() * relHeight));
+    }
 
-		if (!silent) {
-			QMessageBox errorDialog(this);
-			errorDialog.setIcon(QMessageBox::Critical);
-			errorDialog.setText(tr("Sorry, but the image size %1 x %2 is illegal.").arg(newSize.width()).arg(newSize.height()));
-			errorDialog.show();
-			errorDialog.exec();
-		}
-	}
+    if (newSize.width() < mWPixelSpin->minimum() || newSize.width() > mWPixelSpin->maximum() || newSize.height() < mHPixelSpin->minimum()
+        || newSize.height() > mHPixelSpin->maximum()) {
+        if (!silent) {
+            QMessageBox errorDialog(this);
+            errorDialog.setIcon(QMessageBox::Critical);
+            errorDialog.setText(tr("Sorry, but the image size %1 x %2 is illegal.").arg(newSize.width()).arg(newSize.height()));
+            errorDialog.show();
+            errorDialog.exec();
+        }
+    }
 
-	QImage rImg = DkImage::resizeImage(img, newSize, 1.0f, mResampleBox->currentIndex(), mGammaCorrection->isChecked());
+    QImage rImg = DkImage::resizeImage(img, newSize, 1.0f, mResampleBox->currentIndex(), mGammaCorrection->isChecked());
 
-	if (rImg.isNull() && !silent) {
-		qDebug() << "image size: " << newSize;
-		QMessageBox errorDialog(this);
-		errorDialog.setIcon(QMessageBox::Critical);
-		errorDialog.setText(tr("Sorry, the image is too large: %1").arg(DkImage::getBufferSize(newSize, 32)));
-		errorDialog.show();
-		errorDialog.exec();
-	}
+    if (rImg.isNull() && !silent) {
+        qDebug() << "image size: " << newSize;
+        QMessageBox errorDialog(this);
+        errorDialog.setIcon(QMessageBox::Critical);
+        errorDialog.setText(tr("Sorry, the image is too large: %1").arg(DkImage::getBufferSize(newSize, 32)));
+        errorDialog.show();
+        errorDialog.exec();
+    }
 
-	return rImg;
+    return rImg;
 }
 
-void DkResizeDialog::setVisible(bool visible) {
-
-	QDialog::setVisible(visible);
-
-	updateSnippets();
-	drawPreview();
+void DkResizeDialog::setVisible(bool visible)
+{
+    QDialog::setVisible(visible);
 
+    updateSnippets();
+    drawPreview();
 }
 
-void DkResizeDialog::resizeEvent(QResizeEvent* re) {
-
-	drawPreview();
-	QDialog::resizeEvent(re);
+void DkResizeDialog::resizeEvent(QResizeEvent *re)
+{
+    drawPreview();
+    QDialog::resizeEvent(re);
 }
 
 // DkShortcutDelegate --------------------------------------------------------------------
-DkShortcutDelegate::DkShortcutDelegate(QObject* parent) : QItemDelegate(parent) {
-	mItem = 0;
-	mClearPm = DkImage::loadIcon(":/nomacs/img/close.svg");
+DkShortcutDelegate::DkShortcutDelegate(QObject *parent)
+    : QItemDelegate(parent)
+{
+    mItem = 0;
+    mClearPm = DkImage::loadIcon(":/nomacs/img/close.svg");
 }
 
-QWidget* DkShortcutDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const {
+QWidget *DkShortcutDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
+{
+    QWidget *scW = QItemDelegate::createEditor(parent, option, index);
 
-	QWidget* scW = QItemDelegate::createEditor(parent, option, index);
+    if (!scW)
+        return scW;
 
-	if (!scW)
-		return scW;
+    connect(scW, SIGNAL(keySequenceChanged(const QKeySequence &)), this, SLOT(keySequenceChanged(const QKeySequence &)));
 
-#if QT_VERSION < 0x050000
-	connect(scW, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
-	connect(scW, SIGNAL(editingFinished()), this, SLOT(textChanged()));
-#else
-	connect(scW, SIGNAL(keySequenceChanged(const QKeySequence&)), this, SLOT(keySequenceChanged(const QKeySequence&)));
-#endif	
-	
-	return scW;
+    return scW;
 }
 
-QSize DkShortcutDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const {
+QSize DkShortcutDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
+{
+    QSize s = QItemDelegate::sizeHint(option, index);
 
-	QSize s = QItemDelegate::sizeHint(option, index);
+    if (index.column() == 1)
+        s.setWidth(s.width() + s.height()); // make room for our x
 
-	if (index.column() == 1)
-		s.setWidth(s.width() + s.height());	// make room for our x
-
-	return s;
+    return s;
 }
 
-void DkShortcutDelegate::setEditorData(QWidget* editor, const QModelIndex& index) const {
-
-	const_cast<DkShortcutDelegate*>(this)->mItem = index.internalPointer();
-	emit clearDuplicateSignal();
+void DkShortcutDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
+{
+    const_cast<DkShortcutDelegate *>(this)->mItem = index.internalPointer();
+    emit clearDuplicateSignal();
 
-	QItemDelegate::setEditorData(editor, index);
+    QItemDelegate::setEditorData(editor, index);
 }
 
-bool DkShortcutDelegate::editorEvent(QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index) {
-	
-	// did the user click the x?
-	if (event->type() == QEvent::MouseButtonRelease) {
+bool DkShortcutDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index)
+{
+    // did the user click the x?
+    if (event->type() == QEvent::MouseButtonRelease) {
+        QMouseEvent *e = (QMouseEvent *)event;
+        int clickX = e->x();
+        int clickY = e->y();
 
-		QMouseEvent * e = (QMouseEvent *)event;
-		int clickX = e->x();
-		int clickY = e->y();
+        QRect r = option.rect;
+        int x = r.left() + r.width() - r.height();
 
-		QRect r = option.rect;
-		int x = r.left() + r.width() - r.height();
-
-		if (clickX > x && clickX < x + r.height())
-			if (clickY > r.top() && clickY < r.top() + r.height()) {
-				model->setData(index, QKeySequence());
-			}
-	}
+        if (clickX > x && clickX < x + r.height())
+            if (clickY > r.top() && clickY < r.top() + r.height()) {
+                model->setData(index, QKeySequence());
+            }
+    }
 
-	mItem = index.internalPointer();
+    mItem = index.internalPointer();
 
-	return QItemDelegate::editorEvent(event, model, option, index);
+    return QItemDelegate::editorEvent(event, model, option, index);
 }
 
-void DkShortcutDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const {
+void DkShortcutDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
+{
+    // calling before means, that our x is always in front
+    QItemDelegate::paint(painter, option, index);
 
-	// calling before means, that our x is always in front
-	QItemDelegate::paint(painter, option, index);
+    TreeItem *ti = static_cast<TreeItem *>(index.internalPointer());
 
-	TreeItem* ti = static_cast<TreeItem*>(index.internalPointer());
+    if (index.column() == 1 && ti && !ti->data(1).toString().isEmpty()) {
+        QRect r = option.rect; // getting the rect of the cell
+        int s = r.height();
+        QRect pmr(r.right() - s, r.top(), s, s);
 
-	if (index.column() == 1 && ti && !ti->data(1).toString().isEmpty()) {
-		
-		QRect r = option.rect;//getting the rect of the cell
-		int s = r.height();
-		QRect pmr(r.right()-s, r.top(), s, s);
-		
-		painter->drawPixmap(pmr, mClearPm);
-	}
- }
-
-#if QT_VERSION < 0x050000
-void DkShortcutDelegate::textChanged(const QString& text) {
-	emit checkDuplicateSignal(text, mItem);
+        painter->drawPixmap(pmr, mClearPm);
+    }
 }
 
-void DkShortcutDelegate::keySequenceChanged(const QKeySequence&) {}
-#else
-
-void DkShortcutDelegate::textChanged(const QString&) {}	// dummy since the moccer is to dumb to get #if defs
+void DkShortcutDelegate::textChanged(const QString &)
+{
+} // dummy since the moccer is to dumb to get #if defs
 
-void DkShortcutDelegate::keySequenceChanged(const QKeySequence& keySequence) {
-	emit checkDuplicateSignal(keySequence, mItem);
+void DkShortcutDelegate::keySequenceChanged(const QKeySequence &keySequence)
+{
+    emit checkDuplicateSignal(keySequence, mItem);
 }
-#endif
 
-// fun fact: there are ~10^4500 (binary) images of size 128x128 
+// fun fact: there are ~10^4500 (binary) images of size 128x128
 // increase counter if you think this is fascinating: 1
 
 // DkShortcutsModel --------------------------------------------------------------------
-DkShortcutsModel::DkShortcutsModel(QObject* parent) : QAbstractItemModel(parent) {
-
-	// create root
-	QVector<QVariant> rootData;
-	rootData << tr("Name") << tr("Shortcut");
-
-	mRootItem = new TreeItem(rootData);
+DkShortcutsModel::DkShortcutsModel(QObject *parent)
+    : QAbstractItemModel(parent)
+{
+    // create root
+    QVector<QVariant> rootData;
+    rootData << tr("Name") << tr("Shortcut");
 
+    mRootItem = new TreeItem(rootData);
 }
 
-DkShortcutsModel::~DkShortcutsModel() {
-	delete mRootItem;
+DkShortcutsModel::~DkShortcutsModel()
+{
+    delete mRootItem;
 }
 
-QModelIndex DkShortcutsModel::index(int row, int column, const QModelIndex &parent) const {
-	
-	if (!hasIndex(row, column, parent))
-		return QModelIndex();
+QModelIndex DkShortcutsModel::index(int row, int column, const QModelIndex &parent) const
+{
+    if (!hasIndex(row, column, parent))
+        return QModelIndex();
 
-	TreeItem *parentItem;
+    TreeItem *parentItem;
 
-	if (!parent.isValid())
-		parentItem = mRootItem;
-	else
-		parentItem = static_cast<TreeItem*>(parent.internalPointer());
+    if (!parent.isValid())
+        parentItem = mRootItem;
+    else
+        parentItem = static_cast<TreeItem *>(parent.internalPointer());
 
-	TreeItem *childItem = parentItem->child(row);
+    TreeItem *childItem = parentItem->child(row);
 
-	if (childItem)
-		return createIndex(row, column, childItem);
-	else
-		return QModelIndex();
+    if (childItem)
+        return createIndex(row, column, childItem);
+    else
+        return QModelIndex();
 }
 
-QModelIndex DkShortcutsModel::parent(const QModelIndex &index) const {
-	
-	if (!index.isValid())
-		return QModelIndex();
+QModelIndex DkShortcutsModel::parent(const QModelIndex &index) const
+{
+    if (!index.isValid())
+        return QModelIndex();
 
-	TreeItem *childItem = static_cast<TreeItem*>(index.internalPointer());
-	TreeItem *parentItem = childItem->parent();
+    TreeItem *childItem = static_cast<TreeItem *>(index.internalPointer());
+    TreeItem *parentItem = childItem->parent();
 
-	if (parentItem == mRootItem)
-		return QModelIndex();
+    if (parentItem == mRootItem)
+        return QModelIndex();
 
-	return createIndex(parentItem->row(), 0, parentItem);
+    return createIndex(parentItem->row(), 0, parentItem);
 }
 
-int DkShortcutsModel::rowCount(const QModelIndex& parent) const {
-
-	TreeItem *parentItem;
-	if (parent.column() > 0)
-		return 0;
+int DkShortcutsModel::rowCount(const QModelIndex &parent) const
+{
+    TreeItem *parentItem;
+    if (parent.column() > 0)
+        return 0;
 
-	if (!parent.isValid())
-		parentItem = mRootItem;
-	else
-		parentItem = static_cast<TreeItem*>(parent.internalPointer());
+    if (!parent.isValid())
+        parentItem = mRootItem;
+    else
+        parentItem = static_cast<TreeItem *>(parent.internalPointer());
 
-	return parentItem->childCount();
+    return parentItem->childCount();
 }
 
-int DkShortcutsModel::columnCount(const QModelIndex& parent) const {
-
-	if (parent.isValid())
-		return static_cast<TreeItem*>(parent.internalPointer())->columnCount();
-	else
-		return mRootItem->columnCount();
+int DkShortcutsModel::columnCount(const QModelIndex &parent) const
+{
+    if (parent.isValid())
+        return static_cast<TreeItem *>(parent.internalPointer())->columnCount();
+    else
+        return mRootItem->columnCount();
 }
 
-QVariant DkShortcutsModel::data(const QModelIndex& index, int role) const {
-
-	if (!index.isValid()) {
-		qDebug() << "invalid row: " << index.row();
-		return QVariant();
-	}
-
-	if (role == Qt::DisplayRole || role == Qt::EditRole) {
+QVariant DkShortcutsModel::data(const QModelIndex &index, int role) const
+{
+    if (!index.isValid()) {
+        qDebug() << "invalid row: " << index.row();
+        return QVariant();
+    }
 
-		TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
-		return item->data(index.column());
-	}
+    if (role == Qt::DisplayRole || role == Qt::EditRole) {
+        TreeItem *item = static_cast<TreeItem *>(index.internalPointer());
+        return item->data(index.column());
+    }
 
-	return QVariant();
+    return QVariant();
 }
 
-QVariant DkShortcutsModel::headerData(int section, Qt::Orientation orientation, int role) const {
-
-	if (orientation != Qt::Horizontal || role != Qt::DisplayRole) 
-		return QVariant();
-
-	return mRootItem->data(section);
-} 
+QVariant DkShortcutsModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+    if (orientation != Qt::Horizontal || role != Qt::DisplayRole)
+        return QVariant();
 
-bool DkShortcutsModel::setData(const QModelIndex& index, const QVariant& value, int role) {
-
-	if (!index.isValid() || role != Qt::EditRole)
-		return false;
+    return mRootItem->data(section);
+}
 
-	if (index.column() == 1) {
+bool DkShortcutsModel::setData(const QModelIndex &index, const QVariant &value, int role)
+{
+    if (!index.isValid() || role != Qt::EditRole)
+        return false;
 
-		QKeySequence ks = value.value<QKeySequence>();
-		TreeItem* duplicate = mRootItem->find(ks, index.column());
-		if (duplicate) duplicate->setData(QKeySequence(), index.column());
-		//if (!duplicate) qDebug() << ks << " no duplicate found...";
+    if (index.column() == 1) {
+        QKeySequence ks = value.value<QKeySequence>();
+        TreeItem *duplicate = mRootItem->find(ks, index.column());
+        if (duplicate)
+            duplicate->setData(QKeySequence(), index.column());
+        // if (!duplicate) qDebug() << ks << " no duplicate found...";
 
-		TreeItem* item = static_cast<TreeItem*>(index.internalPointer());
-		item->setData(ks, index.column());
-	}
-	else {
-		TreeItem* item = static_cast<TreeItem*>(index.internalPointer());
-		item->setData(value, index.column());
-	}
+        TreeItem *item = static_cast<TreeItem *>(index.internalPointer());
+        item->setData(ks, index.column());
+    } else {
+        TreeItem *item = static_cast<TreeItem *>(index.internalPointer());
+        item->setData(value, index.column());
+    }
 
-	emit dataChanged(index, index);
-	return true;
+    emit dataChanged(index, index);
+    return true;
 }
 
-Qt::ItemFlags DkShortcutsModel::flags(const QModelIndex& index) const {
-
-	if (!index.isValid())
-		return Qt::ItemIsEditable;
+Qt::ItemFlags DkShortcutsModel::flags(const QModelIndex &index) const
+{
+    if (!index.isValid())
+        return Qt::ItemIsEditable;
 
-	Qt::ItemFlags flags;
+    Qt::ItemFlags flags;
 
-	if (index.column() == 0)
-		flags = QAbstractItemModel::flags(index);
-	if (index.column() == 1)
-		flags = QAbstractItemModel::flags(index) | Qt::ItemIsEditable;
+    if (index.column() == 0)
+        flags = QAbstractItemModel::flags(index);
+    if (index.column() == 1)
+        flags = QAbstractItemModel::flags(index) | Qt::ItemIsEditable;
 
-	return flags;
+    return flags;
 }
 
-void DkShortcutsModel::addDataActions(QVector<QAction*> actions, const QString& name) {
+void DkShortcutsModel::addDataActions(QVector<QAction *> actions, const QString &name)
+{
+    // create root
+    QVector<QVariant> menuData;
+    menuData << name;
 
-	// create root
-	QVector<QVariant> menuData;
-	menuData << name;
+    TreeItem *menuItem = new TreeItem(menuData, mRootItem);
 
-	TreeItem* menuItem = new TreeItem(menuData, mRootItem);
+    for (int idx = 0; idx < actions.size(); idx++) {
+        // skip NULL actions - this should never happen!
+        if (actions[idx]->text().isNull()) {
+            qDebug() << "NULL Action detected when creating shortcuts...";
+            continue;
+        }
 
-	for (int idx = 0; idx < actions.size(); idx++) {
+        QString text = actions[idx]->text().remove("&");
 
-		// skip NULL actions - this should never happen!
-		if (actions[idx]->text().isNull()) {
-			qDebug() << "NULL Action detected when creating shortcuts...";
-			continue;
-		}
+        QVector<QVariant> actionData;
+        actionData << text << actions[idx]->shortcut();
 
-		QString text = actions[idx]->text().remove("&");
-
-		QVector<QVariant> actionData;
-		actionData << text << actions[idx]->shortcut();
-
-		TreeItem* dataItem = new TreeItem(actionData, menuItem);
-		menuItem->appendChild(dataItem);
-	}
+        TreeItem *dataItem = new TreeItem(actionData, menuItem);
+        menuItem->appendChild(dataItem);
+    }
 
-	mRootItem->appendChild(menuItem);
-	mActions.append(actions);
+    mRootItem->appendChild(menuItem);
+    mActions.append(actions);
 }
 
-void DkShortcutsModel::checkDuplicate(const QString& text, void* item) {
-
-	if (text.isEmpty()) {
-		emit duplicateSignal("");
-		return;
-	}
+void DkShortcutsModel::checkDuplicate(const QString &text, void *item)
+{
+    if (text.isEmpty()) {
+        emit duplicateSignal("");
+        return;
+    }
 
-	QKeySequence ks(text);
-	checkDuplicate(ks, item);
+    QKeySequence ks(text);
+    checkDuplicate(ks, item);
 }
 
-void DkShortcutsModel::checkDuplicate(const QKeySequence& ks, void* item) {
-
-	if (ks.isEmpty()) {
-		emit duplicateSignal("");
-		return;
-	}
+void DkShortcutsModel::checkDuplicate(const QKeySequence &ks, void *item)
+{
+    if (ks.isEmpty()) {
+        emit duplicateSignal("");
+        return;
+    }
 
-	TreeItem* duplicate = mRootItem->find(ks, 1);
+    TreeItem *duplicate = mRootItem->find(ks, 1);
 
-	if (duplicate == item)
-		return;
+    if (duplicate == item)
+        return;
 
-	if (duplicate && duplicate->parent()) {
-		emit duplicateSignal(tr("%1 already used by %2 > %3\nPress ESC to undo changes")
-				.arg(duplicate->data(1).toString())
-				.arg(duplicate->parent()->data(0).toString())
-				.arg(duplicate->data(0).toString()));
-	}
-	else if (duplicate) {
-		emit duplicateSignal(tr("%1 already used by %2\nPress ESC to undo changes")
-			.arg(duplicate->data(1).toString())
-			.arg(duplicate->data(0).toString()));
-	}
-	else 
-		emit duplicateSignal("");
+    if (duplicate && duplicate->parent()) {
+        emit duplicateSignal(tr("%1 already used by %2 > %3\nPress ESC to undo changes")
+                                 .arg(duplicate->data(1).toString())
+                                 .arg(duplicate->parent()->data(0).toString())
+                                 .arg(duplicate->data(0).toString()));
+    } else if (duplicate) {
+        emit duplicateSignal(tr("%1 already used by %2\nPress ESC to undo changes").arg(duplicate->data(1).toString()).arg(duplicate->data(0).toString()));
+    } else
+        emit duplicateSignal("");
 }
 
-void DkShortcutsModel::clearDuplicateInfo() const {
-
-	qDebug() << "duplicates cleared...";
-	emit duplicateSignal("");
+void DkShortcutsModel::clearDuplicateInfo() const
+{
+    qDebug() << "duplicates cleared...";
+    emit duplicateSignal("");
 }
 
-void DkShortcutsModel::resetActions() {
+void DkShortcutsModel::resetActions()
+{
+    DefaultSettings settings;
+    settings.beginGroup("CustomShortcuts");
 
-	DefaultSettings settings;
-	settings.beginGroup("CustomShortcuts");
+    for (int pIdx = 0; pIdx < mActions.size(); pIdx++) {
+        QVector<QAction *> cActions = mActions.at(pIdx);
 
-	for (int pIdx = 0; pIdx < mActions.size(); pIdx++) {
-		
-		QVector<QAction*> cActions = mActions.at(pIdx);
-		
-		for (int idx = 0; idx < cActions.size(); idx++) {
-			QString val = settings.value(cActions[idx]->text(), "no-shortcut").toString();
+        for (int idx = 0; idx < cActions.size(); idx++) {
+            QString val = settings.value(cActions[idx]->text(), "no-shortcut").toString();
 
-			if (val != "no-shortcut") {
-				cActions[idx]->setShortcut(QKeySequence());
-			}
-		}
-	}
+            if (val != "no-shortcut") {
+                cActions[idx]->setShortcut(QKeySequence());
+            }
+        }
+    }
 
-	settings.endGroup();
+    settings.endGroup();
 }
 
-void DkShortcutsModel::saveActions() const {
-
-	if (!mRootItem)
-		return;
-
-	DefaultSettings settings;
-	settings.beginGroup("CustomShortcuts");
-
-	// loop all menu entries
-	for (int idx = 0; idx < mRootItem->childCount(); idx++) {
+void DkShortcutsModel::saveActions() const
+{
+    if (!mRootItem)
+        return;
 
-		TreeItem* cMenu = mRootItem->child(idx);
-		QVector<QAction*> cActions = mActions.at(idx);
+    DefaultSettings settings;
+    settings.beginGroup("CustomShortcuts");
 
-		// loop all action entries
-		for (int mIdx = 0; mIdx < cMenu->childCount(); mIdx++) {
+    // loop all menu entries
+    for (int idx = 0; idx < mRootItem->childCount(); idx++) {
+        TreeItem *cMenu = mRootItem->child(idx);
+        QVector<QAction *> cActions = mActions.at(idx);
 
-			TreeItem* cItem = cMenu->child(mIdx);
-			QKeySequence ks = cItem->data(1).value<QKeySequence>();
+        // loop all action entries
+        for (int mIdx = 0; mIdx < cMenu->childCount(); mIdx++) {
+            TreeItem *cItem = cMenu->child(mIdx);
+            QKeySequence ks = cItem->data(1).value<QKeySequence>();
 
-			if (cActions.at(mIdx)->shortcut() != ks) {
+            if (cActions.at(mIdx)->shortcut() != ks) {
+                if (cActions.at(mIdx)->text().isEmpty()) {
+                    qDebug() << "empty action detected! shortcut is: " << ks;
+                    continue;
+                }
 
-				if (cActions.at(mIdx)->text().isEmpty()) {
-					qDebug() << "empty action detected! shortcut is: " << ks;
-					continue;
-				}
-
-				QString aT = cActions.at(mIdx)->text().remove("&");
-
-				cActions.at(mIdx)->setShortcut(ks);		// assign new shortcut
-				settings.setValue(aT, ks.toString());	// note this works as long as you don't change the language!
-			}
-		}
-	}
-	settings.endGroup();
+                QString aT = cActions.at(mIdx)->text().remove("&");
 
+                cActions.at(mIdx)->setShortcut(ks); // assign new shortcut
+                settings.setValue(aT, ks.toString()); // note this works as long as you don't change the language!
+            }
+        }
+    }
+    settings.endGroup();
 }
 
 // DkShortcutsDialog --------------------------------------------------------------------
-DkShortcutsDialog::DkShortcutsDialog(QWidget* parent, Qt::WindowFlags flags) : QDialog(parent, flags) {
-
-	createLayout();
+DkShortcutsDialog::DkShortcutsDialog(QWidget *parent, Qt::WindowFlags flags)
+    : QDialog(parent, flags)
+{
+    createLayout();
 }
 
-void DkShortcutsDialog::createLayout() {
+void DkShortcutsDialog::createLayout()
+{
+    setWindowTitle(tr("Keyboard Shortcuts"));
 
-	setWindowTitle(tr("Keyboard Shortcuts"));
+    QVBoxLayout *layout = new QVBoxLayout(this);
 
-	QVBoxLayout* layout = new QVBoxLayout(this);
+    // register our special shortcut editor
+    QItemEditorFactory *factory = new QItemEditorFactory;
 
-	// register our special shortcut editor
-	QItemEditorFactory *factory = new QItemEditorFactory;
+    QItemEditorCreatorBase *shortcutListCreator = new QStandardItemEditorCreator<QKeySequenceEdit>();
 
-#if QT_VERSION < 0x050000
-	QItemEditorCreatorBase *shortcutListCreator =
-		new QStandardItemEditorCreator<DkShortcutEditor>();
-#else
-	QItemEditorCreatorBase *shortcutListCreator =
-		new QStandardItemEditorCreator<QKeySequenceEdit>();
-#endif
+    factory->registerEditor(QVariant::KeySequence, shortcutListCreator);
 
-	factory->registerEditor(QVariant::KeySequence, shortcutListCreator);
+    QItemEditorFactory::setDefaultFactory(factory);
 
-	QItemEditorFactory::setDefaultFactory(factory);
+    // create our beautiful shortcut view
+    mModel = new DkShortcutsModel(this);
 
-	// create our beautiful shortcut view
-	mModel = new DkShortcutsModel(this);
-	
-	DkShortcutDelegate* scDelegate = new DkShortcutDelegate(this);
+    DkShortcutDelegate *scDelegate = new DkShortcutDelegate(this);
 
-	QTreeView* treeView = new QTreeView(this);
-	treeView->setModel(mModel);
-	treeView->setItemDelegate(scDelegate);
-	treeView->setAlternatingRowColors(true);
-	treeView->setIndentation(8);
-	treeView->header()->resizeSection(0, 200);
+    QTreeView *treeView = new QTreeView(this);
+    treeView->setModel(mModel);
+    treeView->setItemDelegate(scDelegate);
+    treeView->setAlternatingRowColors(true);
+    treeView->setIndentation(8);
+    treeView->header()->resizeSection(0, 200);
 
-	mNotificationLabel = new QLabel(this);
-	mNotificationLabel->setObjectName("DkDecentInfo");
-	mNotificationLabel->setProperty("warning", true);
-	//notificationLabel->setTextFormat(Qt::)
+    mNotificationLabel = new QLabel(this);
+    mNotificationLabel->setObjectName("DkDecentInfo");
+    mNotificationLabel->setProperty("warning", true);
+    // notificationLabel->setTextFormat(Qt::)
 
-	mDefaultButton = new QPushButton(tr("Set to &Default"), this);
-	mDefaultButton->setToolTip(tr("Removes All Custom Shortcuts"));
-	connect(mDefaultButton, SIGNAL(clicked()), this, SLOT(defaultButtonClicked()));
-	connect(mModel, SIGNAL(duplicateSignal(const QString&)), mNotificationLabel, SLOT(setText(const QString&)));
+    mDefaultButton = new QPushButton(tr("Set to &Default"), this);
+    mDefaultButton->setToolTip(tr("Removes All Custom Shortcuts"));
+    connect(mDefaultButton, SIGNAL(clicked()), this, SLOT(defaultButtonClicked()));
+    connect(mModel, SIGNAL(duplicateSignal(const QString &)), mNotificationLabel, SLOT(setText(const QString &)));
 
-#if QT_VERSION < 0x050000
-	connect(scDelegate, SIGNAL(checkDuplicateSignal(const QString&, void*)), model, SLOT(checkDuplicate(const QString&, void*)));
-#else
-	connect(scDelegate, SIGNAL(checkDuplicateSignal(const QKeySequence&, void*)), mModel, SLOT(checkDuplicate(const QKeySequence&, void*)));
-	connect(scDelegate, SIGNAL(clearDuplicateSignal()), mModel, SLOT(clearDuplicateInfo()));
-#endif
+    connect(scDelegate, SIGNAL(checkDuplicateSignal(const QKeySequence &, void *)), mModel, SLOT(checkDuplicate(const QKeySequence &, void *)));
+    connect(scDelegate, SIGNAL(clearDuplicateSignal()), mModel, SLOT(clearDuplicateInfo()));
 
-	// mButtons
-	QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
-	buttons->button(QDialogButtonBox::Ok)->setText(tr("&OK"));
-	buttons->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel"));
-	buttons->addButton(mDefaultButton, QDialogButtonBox::ActionRole);
-	
-	connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
-	connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
+    // mButtons
+    QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
+    buttons->button(QDialogButtonBox::Ok)->setText(tr("&OK"));
+    buttons->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel"));
+    buttons->addButton(mDefaultButton, QDialogButtonBox::ActionRole);
 
-	layout->addWidget(treeView);
-	layout->addWidget(mNotificationLabel);
-	//layout->addSpacing()
-	layout->addWidget(buttons);
-	resize(420, 500);
-}
-
-void DkShortcutsDialog::addActions(const QVector<QAction*>& actions, const QString& name) {
-
-	QString cleanName = name;
-	mModel->addDataActions(actions, cleanName.remove("&"));
+    connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
+    connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
 
+    layout->addWidget(treeView);
+    layout->addWidget(mNotificationLabel);
+    // layout->addSpacing()
+    layout->addWidget(buttons);
+    resize(420, 500);
 }
 
-void DkShortcutsDialog::contextMenu(const QPoint&) {
-
+void DkShortcutsDialog::addActions(const QVector<QAction *> &actions, const QString &name)
+{
+    QString cleanName = name;
+    mModel->addDataActions(actions, cleanName.remove("&"));
 }
 
-void DkShortcutsDialog::defaultButtonClicked() {
+void DkShortcutsDialog::contextMenu(const QPoint &)
+{
+}
 
-	if (mModel) mModel->resetActions();
+void DkShortcutsDialog::defaultButtonClicked()
+{
+    if (mModel)
+        mModel->resetActions();
 
-	DefaultSettings settings;
-	settings.remove("CustomShortcuts");
+    DefaultSettings settings;
+    settings.remove("CustomShortcuts");
 
-	QDialog::reject();
+    QDialog::reject();
 }
 
-void DkShortcutsDialog::accept() {
-
-	// assign shortcuts & save them if they are changed
-	if (mModel) mModel->saveActions();
+void DkShortcutsDialog::accept()
+{
+    // assign shortcuts & save them if they are changed
+    if (mModel)
+        mModel->saveActions();
 
-	QDialog::accept();
+    QDialog::accept();
 }
 
 // DkTextDialog --------------------------------------------------------------------
-DkTextDialog::DkTextDialog(QWidget* parent /* = 0 */, Qt::WindowFlags flags /* = 0 */) : QDialog(parent, flags) {
-
-	setWindowTitle(tr("Text Editor"));
-	createLayout();
+DkTextDialog::DkTextDialog(QWidget *parent /* = 0 */, Qt::WindowFlags flags /* = 0 */)
+    : QDialog(parent, flags)
+{
+    setWindowTitle(tr("Text Editor"));
+    createLayout();
 }
 
-void DkTextDialog::createLayout() {
+void DkTextDialog::createLayout()
+{
+    textEdit = new QTextEdit(this);
 
-	textEdit = new QTextEdit(this);
+    QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal);
+    buttons->button(QDialogButtonBox::Ok)->setDefault(true); // ok is auto-default
+    buttons->button(QDialogButtonBox::Ok)->setText(tr("&Save"));
+    buttons->button(QDialogButtonBox::Cancel)->setText(tr("&Close"));
 
-	QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal);
-	buttons->button(QDialogButtonBox::Ok)->setDefault(true);	// ok is auto-default
-	buttons->button(QDialogButtonBox::Ok)->setText(tr("&Save"));
-	buttons->button(QDialogButtonBox::Cancel)->setText(tr("&Close"));
+    connect(buttons, SIGNAL(accepted()), this, SLOT(save()));
+    connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
 
-	connect(buttons, SIGNAL(accepted()), this, SLOT(save()));
-	connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
-
-	// dialog layout
-	QVBoxLayout* layout = new QVBoxLayout(this);
-	layout->addWidget(textEdit);
-	layout->addWidget(buttons);
+    // dialog layout
+    QVBoxLayout *layout = new QVBoxLayout(this);
+    layout->addWidget(textEdit);
+    layout->addWidget(buttons);
 }
 
-void DkTextDialog::setText(const QStringList& text) {
-	textEdit->setText(text.join("\n"));
+void DkTextDialog::setText(const QStringList &text)
+{
+    textEdit->setText(text.join("\n"));
 }
 
-void DkTextDialog::save() {
+void DkTextDialog::save()
+{
+    QStringList folders = DkSettingsManager::param().global().recentFolders;
+    QString savePath = QDir::rootPath();
 
-	QStringList folders = DkSettingsManager::param().global().recentFolders;
-	QString savePath = QDir::rootPath();
+    if (folders.size() > 0)
+        savePath = folders.first();
 
-	if (folders.size() > 0)
-		savePath = folders.first();
+    QStringList extList;
+    extList << tr("Text File (*.txt)") << tr("All Files (*.*)");
+    QString saveFilters(extList.join(";;"));
 
-	QStringList extList;
-	extList << tr("Text File (*.txt)") << tr("All Files (*.*)");
-	QString saveFilters(extList.join(";;"));
+    QString fileName = QFileDialog::getSaveFileName(this, tr("Save Text File"), savePath, saveFilters, nullptr, DkDialog::fileDialogOptions());
 
-	QString fileName = QFileDialog::getSaveFileName(
-		this,
-		tr("Save Text File"),
-		savePath,
-		saveFilters,
-		nullptr,
-		DkDialog::fileDialogOptions()
-	);
+    if (fileName.isEmpty())
+        return;
 
-	if (fileName.isEmpty())
-		return;
+    QFile file(fileName);
 
-	QFile file(fileName);
-	
-	if (file.open(QIODevice::WriteOnly)) {
-		QTextStream stream(&file);
-		stream << textEdit->toPlainText();
-	}
-	else {
-		QMessageBox::critical(this, tr("Error"), tr("Could not save: %1\n%2").arg(fileName).arg(file.errorString()));
-		return;
-	}
+    if (file.open(QIODevice::WriteOnly)) {
+        QTextStream stream(&file);
+        stream << textEdit->toPlainText();
+    } else {
+        QMessageBox::critical(this, tr("Error"), tr("Could not save: %1\n%2").arg(fileName).arg(file.errorString()));
+        return;
+    }
 
-	file.close();
-	accept();
+    file.close();
+    accept();
 }
 
 // DkUpdateDialog --------------------------------------------------------------------
-DkUpdateDialog::DkUpdateDialog(QWidget* parent, Qt::WindowFlags flags) : QDialog(parent, flags) {
-	init();
+DkUpdateDialog::DkUpdateDialog(QWidget *parent, Qt::WindowFlags flags)
+    : QDialog(parent, flags)
+{
+    init();
 }
 
-void DkUpdateDialog::init() {
-	createLayout();
+void DkUpdateDialog::init()
+{
+    createLayout();
 
-	connect(cancelButton, SIGNAL(clicked()), this, SLOT(close()));
-	connect(okButton, SIGNAL(clicked()), this, SLOT(okButtonClicked()));
+    connect(cancelButton, SIGNAL(clicked()), this, SLOT(close()));
+    connect(okButton, SIGNAL(clicked()), this, SLOT(okButtonClicked()));
 }
 
-void DkUpdateDialog::createLayout() {
-	setFixedWidth(300);
-	setFixedHeight(150);
-	setWindowTitle(tr("nomacs updater"));
+void DkUpdateDialog::createLayout()
+{
+    setFixedWidth(300);
+    setFixedHeight(150);
+    setWindowTitle(tr("nomacs updater"));
 
-	QGridLayout* gridlayout = new QGridLayout;
-	upperLabel = new QLabel;
-	upperLabel->setOpenExternalLinks(true);
+    QGridLayout *gridlayout = new QGridLayout;
+    upperLabel = new QLabel;
+    upperLabel->setOpenExternalLinks(true);
 
-	QWidget* lowerWidget = new QWidget;
-	QHBoxLayout* hbox = new QHBoxLayout;
-	okButton = new QPushButton(tr("Install Now"));
-	cancelButton = new QPushButton(tr("Cancel"));
-	hbox->addStretch();
-	hbox->addWidget(okButton);
-	hbox->addWidget(cancelButton);
-	lowerWidget->setLayout(hbox);
+    QWidget *lowerWidget = new QWidget;
+    QHBoxLayout *hbox = new QHBoxLayout;
+    okButton = new QPushButton(tr("Install Now"));
+    cancelButton = new QPushButton(tr("Cancel"));
+    hbox->addStretch();
+    hbox->addWidget(okButton);
+    hbox->addWidget(cancelButton);
+    lowerWidget->setLayout(hbox);
 
-	gridlayout->addWidget(upperLabel, 0, 0);
-	gridlayout->addWidget(lowerWidget, 1, 0);
-	
-	setLayout(gridlayout);
+    gridlayout->addWidget(upperLabel, 0, 0);
+    gridlayout->addWidget(lowerWidget, 1, 0);
 
+    setLayout(gridlayout);
 }
 
-void DkUpdateDialog::okButtonClicked() {
-	emit startUpdate();
-	close();
+void DkUpdateDialog::okButtonClicked()
+{
+    emit startUpdate();
+    close();
 }
 
 // DkPrintPreviewDialog --------------------------------------------------------------------
-DkPrintPreviewDialog::DkPrintPreviewDialog(QWidget* parent, Qt::WindowFlags flags) 
-		: QDialog(parent, flags) {
-	
-	setWindowTitle(tr("Print Preview"));
-	init();
+DkPrintPreviewDialog::DkPrintPreviewDialog(QWidget *parent, Qt::WindowFlags flags)
+    : QDialog(parent, flags)
+{
+    setWindowTitle(tr("Print Preview"));
+    init();
 }
 
-void DkPrintPreviewDialog::setImage(const QImage& img) {
+void DkPrintPreviewDialog::setImage(const QImage &img)
+{
+    mPreview->setImage(img);
 
-	mPreview->setImage(img);
-
-	if (!img.isNull() && img.width() > img.height())
-		mPreview->setLandscapeOrientation();
-	else
-		mPreview->setPortraitOrientation();
+    if (!img.isNull() && img.width() > img.height())
+        mPreview->setLandscapeOrientation();
+    else
+        mPreview->setPortraitOrientation();
 }
 
-void DkPrintPreviewDialog::addImage(const QImage& img) {
-
-	mPreview->addImage(img);
+void DkPrintPreviewDialog::addImage(const QImage &img)
+{
+    mPreview->addImage(img);
 }
 
-void DkPrintPreviewDialog::init() {
-	
-	if (!mPrinter) {
+void DkPrintPreviewDialog::init()
+{
+    if (!mPrinter) {
 #ifdef Q_OS_WIN
-		if(QPrinterInfo::defaultPrinter().isNull())
-			mPrinter = new QPrinter();	// new QPrinter(QPrinter::HighResolution);
-		else
-			mPrinter = new QPrinter(QPrinterInfo::defaultPrinter());
-			
+        if (QPrinterInfo::defaultPrinter().isNull())
+            mPrinter = new QPrinter(); // new QPrinter(QPrinter::HighResolution);
+        else
+            mPrinter = new QPrinter(QPrinterInfo::defaultPrinter());
+
 #else
-		mPrinter = new QPrinter();
+        mPrinter = new QPrinter();
 #endif
-	}
-
-	mPreview = new DkPrintPreviewWidget(mPrinter, this);
-
-	createIcons();
-	createLayout();
-	
-	setMinimumHeight(600);
-	setMinimumWidth(800);
-
-	connect(mPreview, SIGNAL(dpiChanged(int)), mDpiBox, SLOT(setValue(int)));
-}
-
-void DkPrintPreviewDialog::createIcons() {
+    }
+
+    mPreview = new DkPrintPreviewWidget(mPrinter, this);
+
+    createIcons();
+    createLayout();
 
-	mIcons.resize(print_end);
-
-	mIcons[print_fit_width]	= DkImage::loadIcon(":/nomacs/img/fit-width.svg");
-	mIcons[print_fit_page]	= DkImage::loadIcon(":/nomacs/img/zoom-reset.svg");
-	mIcons[print_zoom_in]	= DkImage::loadIcon(":/nomacs/img/zoom-in.svg");
-	mIcons[print_zoom_out]	= DkImage::loadIcon(":/nomacs/img/zoom-out.svg");
-	mIcons[print_reset_dpi]	= DkImage::loadIcon(":/nomacs/img/zoom-100.svg");
-	mIcons[print_landscape]	= DkImage::loadIcon(":/nomacs/img/landscape.svg");
-	mIcons[print_portrait]	= DkImage::loadIcon(":/nomacs/img/portrait.svg");
-	mIcons[print_setup]		= DkImage::loadIcon(":/nomacs/img/print-setup.svg");
-	mIcons[print_printer]	= DkImage::loadIcon(":/nomacs/img/print.svg");
+    setMinimumHeight(600);
+    setMinimumWidth(800);
+
+    connect(mPreview, SIGNAL(dpiChanged(int)), mDpiBox, SLOT(setValue(int)));
 }
 
-void DkPrintPreviewDialog::createLayout() {
-	
-	QAction* fitWidth = new QAction(mIcons[print_fit_width], tr("Fit Width"), this);
-	QAction* fitPage = new QAction(mIcons[print_fit_page], tr("Fit Page"), this);
+void DkPrintPreviewDialog::createIcons()
+{
+    mIcons.resize(print_end);
 
-	QAction* zoomIn = new QAction(mIcons[print_zoom_in], tr("Zoom in"), this);
-	zoomIn->setShortcut(Qt::Key_Plus);
+    mIcons[print_fit_width] = DkImage::loadIcon(":/nomacs/img/fit-width.svg");
+    mIcons[print_fit_page] = DkImage::loadIcon(":/nomacs/img/zoom-reset.svg");
+    mIcons[print_zoom_in] = DkImage::loadIcon(":/nomacs/img/zoom-in.svg");
+    mIcons[print_zoom_out] = DkImage::loadIcon(":/nomacs/img/zoom-out.svg");
+    mIcons[print_reset_dpi] = DkImage::loadIcon(":/nomacs/img/zoom-100.svg");
+    mIcons[print_landscape] = DkImage::loadIcon(":/nomacs/img/landscape.svg");
+    mIcons[print_portrait] = DkImage::loadIcon(":/nomacs/img/portrait.svg");
+    mIcons[print_setup] = DkImage::loadIcon(":/nomacs/img/print-setup.svg");
+    mIcons[print_printer] = DkImage::loadIcon(":/nomacs/img/print.svg");
+}
 
-	QAction* zoomOut = new QAction(mIcons[print_zoom_out], tr("Zoom out"), this);
-	zoomOut->setShortcut(Qt::Key_Minus);
-	
-	QString zoomTip = tr("keep ALT key pressed to zoom with the mouse wheel");
-	zoomIn->setToolTip(zoomTip);
-	zoomOut->setToolTip(zoomTip);
+void DkPrintPreviewDialog::createLayout()
+{
+    QAction *fitWidth = new QAction(mIcons[print_fit_width], tr("Fit Width"), this);
+    QAction *fitPage = new QAction(mIcons[print_fit_page], tr("Fit Page"), this);
 
-	mDpiBox = new QSpinBox(this);
-	mDpiBox->setSuffix(" dpi");
-	mDpiBox->setMinimum(10);
-	mDpiBox->setMaximum(9999);
-	mDpiBox->setSingleStep(100);
+    QAction *zoomIn = new QAction(mIcons[print_zoom_in], tr("Zoom in"), this);
+    zoomIn->setShortcut(Qt::Key_Plus);
 
-	// Portrait/Landscape
-	QAction* prt = new QAction(mIcons[print_portrait], tr("Portrait"), this);
-	prt->setObjectName("portrait");
+    QAction *zoomOut = new QAction(mIcons[print_zoom_out], tr("Zoom out"), this);
+    zoomOut->setShortcut(Qt::Key_Minus);
 
-	QAction* lsc = new QAction(mIcons[print_landscape], tr("Landscape"), this);
-	lsc->setObjectName("landscape");
+    QString zoomTip = tr("keep ALT key pressed to zoom with the mouse wheel");
+    zoomIn->setToolTip(zoomTip);
+    zoomOut->setToolTip(zoomTip);
 
-	// Print
-	QAction* pageSetup = new QAction(mIcons[print_setup], tr("Page setup"), this);
-	QAction* printAction = new QAction(mIcons[print_printer], tr("Print"), this);
+    mDpiBox = new QSpinBox(this);
+    mDpiBox->setSuffix(" dpi");
+    mDpiBox->setMinimum(10);
+    mDpiBox->setMaximum(9999);
+    mDpiBox->setSingleStep(100);
 
-	// create toolbar
-	QToolBar *toolbar = new QToolBar(tr("Print Preview"), this);
-	
-	toolbar->addAction(fitWidth);
-	toolbar->addAction(fitPage);
-	
-	toolbar->addAction(zoomIn);
-	toolbar->addAction(zoomOut);
-	
-	toolbar->addWidget(mDpiBox);
-	
-	toolbar->addAction(prt);
-	toolbar->addAction(lsc);
-	
-	toolbar->addSeparator();
-	toolbar->addAction(pageSetup);
-	toolbar->addAction(printAction);
+    // Portrait/Landscape
+    QAction *prt = new QAction(mIcons[print_portrait], tr("Portrait"), this);
+    prt->setObjectName("portrait");
 
-	toolbar->setIconSize(QSize(DkSettingsManager::param().effectiveIconSize(this), DkSettingsManager::param().effectiveIconSize(this)));
+    QAction *lsc = new QAction(mIcons[print_landscape], tr("Landscape"), this);
+    lsc->setObjectName("landscape");
 
-	// Cannot use the actions' triggered signal here, since it doesn't autorepeat
-	QToolButton *zoomInButton = static_cast<QToolButton *>(toolbar->widgetForAction(zoomIn));
-	zoomInButton->setAutoRepeat(true);
-	zoomInButton->setAutoRepeatInterval(200);
-	zoomInButton->setAutoRepeatDelay(200);
+    // Print
+    QAction *pageSetup = new QAction(mIcons[print_setup], tr("Page setup"), this);
+    QAction *printAction = new QAction(mIcons[print_printer], tr("Print"), this);
 
-	QToolButton *zoomOutButton = static_cast<QToolButton *>(toolbar->widgetForAction(zoomOut));
-	zoomOutButton->setAutoRepeat(true);
-	zoomOutButton->setAutoRepeatInterval(200);
-	zoomOutButton->setAutoRepeatDelay(200);
+    // create toolbar
+    QToolBar *toolbar = new QToolBar(tr("Print Preview"), this);
 
-	connect(mDpiBox, SIGNAL(valueChanged(int)), mPreview, SLOT(changeDpi(int)));
-	connect(zoomInButton, SIGNAL(clicked()), this, SLOT(zoomIn()));
-	connect(zoomOutButton, SIGNAL(clicked()), this, SLOT(zoomOut()));
+    toolbar->addAction(fitWidth);
+    toolbar->addAction(fitPage);
 
-	connect(lsc, SIGNAL(triggered()), mPreview, SLOT(setLandscapeOrientation()));
-	connect(prt, SIGNAL(triggered()), mPreview, SLOT(setPortraitOrientation()));
-	connect(fitWidth, SIGNAL(triggered()), this, SLOT(previewFitWidth()));
-	connect(fitPage, SIGNAL(triggered()), this, SLOT(previewFitPage()));
+    toolbar->addAction(zoomIn);
+    toolbar->addAction(zoomOut);
 
-	connect(printAction, SIGNAL(triggered(bool)), this, SLOT(print()));
-	connect(pageSetup, SIGNAL(triggered(bool)), this, SLOT(pageSetup()));
+    toolbar->addWidget(mDpiBox);
 
+    toolbar->addAction(prt);
+    toolbar->addAction(lsc);
 
-	QMainWindow* mw = new QMainWindow();
-	mw->addToolBar(toolbar);
-	mw->setCentralWidget(mPreview);
+    toolbar->addSeparator();
+    toolbar->addAction(pageSetup);
+    toolbar->addAction(printAction);
 
-	QHBoxLayout* layout = new QHBoxLayout(this);
-	layout->setContentsMargins(0, 0, 0, 0);
-	layout->addWidget(mw);
+    toolbar->setIconSize(QSize(DkSettingsManager::param().effectiveIconSize(this), DkSettingsManager::param().effectiveIconSize(this)));
 
-	setLayout(layout);
-}
+    // Cannot use the actions' triggered signal here, since it doesn't autorepeat
+    QToolButton *zoomInButton = static_cast<QToolButton *>(toolbar->widgetForAction(zoomIn));
+    zoomInButton->setAutoRepeat(true);
+    zoomInButton->setAutoRepeatInterval(200);
+    zoomInButton->setAutoRepeatDelay(200);
 
-void DkPrintPreviewDialog::zoomIn() {
-	mPreview->zoomIn();
-}
+    QToolButton *zoomOutButton = static_cast<QToolButton *>(toolbar->widgetForAction(zoomOut));
+    zoomOutButton->setAutoRepeat(true);
+    zoomOutButton->setAutoRepeatInterval(200);
+    zoomOutButton->setAutoRepeatDelay(200);
 
-void DkPrintPreviewDialog::zoomOut() {
-	mPreview->zoomOut();
-}
+    connect(mDpiBox, SIGNAL(valueChanged(int)), mPreview, SLOT(changeDpi(int)));
+    connect(zoomInButton, SIGNAL(clicked()), this, SLOT(zoomIn()));
+    connect(zoomOutButton, SIGNAL(clicked()), this, SLOT(zoomOut()));
 
-void DkPrintPreviewDialog::zoom(int scale) {
-	mPreview->setZoomFactor(scale/100.0);
-}
+    connect(lsc, SIGNAL(triggered()), mPreview, SLOT(setLandscapeOrientation()));
+    connect(prt, SIGNAL(triggered()), mPreview, SLOT(setPortraitOrientation()));
+    connect(fitWidth, SIGNAL(triggered()), this, SLOT(previewFitWidth()));
+    connect(fitPage, SIGNAL(triggered()), this, SLOT(previewFitPage()));
 
-void DkPrintPreviewDialog::previewFitWidth() {
+    connect(printAction, SIGNAL(triggered(bool)), this, SLOT(print()));
+    connect(pageSetup, SIGNAL(triggered(bool)), this, SLOT(pageSetup()));
 
-	mPreview->fitToWidth();
-}
+    QMainWindow *mw = new QMainWindow();
+    mw->addToolBar(toolbar);
+    mw->setCentralWidget(mPreview);
 
-void DkPrintPreviewDialog::previewFitPage() {
+    QHBoxLayout *layout = new QHBoxLayout(this);
+    layout->setContentsMargins(0, 0, 0, 0);
+    layout->addWidget(mw);
 
-	mPreview->fitInView();
+    setLayout(layout);
 }
 
-void DkPrintPreviewDialog::updateDpiFactor(qreal dpi) {
-	
-	mDpiBox->setValue(qRound(dpi));
+void DkPrintPreviewDialog::zoomIn()
+{
+    mPreview->zoomIn();
 }
 
-void DkPrintPreviewDialog::pageSetup() {
-	
-	QPageSetupDialog pageSetup(mPrinter, this);
-	
-	if (pageSetup.exec() == QDialog::Accepted) {
-		
-		// update possible orientation changes
-		if (mPreview->orientation() == QPrinter::Portrait) {
-			mPreview->setPortraitOrientation();
-		}
-		else {
-			mPreview->setLandscapeOrientation();
-		}
-	}
+void DkPrintPreviewDialog::zoomOut()
+{
+    mPreview->zoomOut();
 }
 
-void DkPrintPreviewDialog::print() {
-
-	QRect pr = mPrinter->pageRect();
-
-	QPrintDialog* pDialog = new QPrintDialog(mPrinter, this);
-	
-	if (pDialog->exec() == QDialog::Accepted) {
-
-		// if the page rect is changed - we have to newly fit the images...
-		if (pr != mPrinter->pageRect())
-			mPreview->fitImages();
-
-		mPreview->paintForPrinting();
-		close();
-	}
+void DkPrintPreviewDialog::zoom(int scale)
+{
+    mPreview->setZoomFactor(scale / 100.0);
 }
 
-// DkPrintPreviewWidget --------------------------------------------------------------------
-DkPrintPreviewWidget::DkPrintPreviewWidget(QPrinter* printer, QWidget* parent, Qt::WindowFlags flags) : QPrintPreviewWidget(printer, parent, flags) {
-	
-	mPrinter = printer;
-	connect(this, SIGNAL(paintRequested(QPrinter*)), this, SLOT(paintPreview(QPrinter*)));
+void DkPrintPreviewDialog::previewFitWidth()
+{
+    mPreview->fitToWidth();
 }
 
-void DkPrintPreviewWidget::paintEvent(QPaintEvent * event) {
-	
-	// TODO: can we get a better anti-aliasing here?
-	QPrintPreviewWidget::paintEvent(event);
+void DkPrintPreviewDialog::previewFitPage()
+{
+    mPreview->fitInView();
 }
 
-void DkPrintPreviewWidget::setImage(const QImage & img) {
-
-	mPrintImages.clear();
-	addImage(img);
+void DkPrintPreviewDialog::updateDpiFactor(qreal dpi)
+{
+    mDpiBox->setValue(qRound(dpi));
 }
 
-void DkPrintPreviewWidget::addImage(const QImage & img) {
-
-	if (!mPrinter) {
-		qWarning() << "cannot add images to preview if the printer is empty";
-		return;
-	}
+void DkPrintPreviewDialog::pageSetup()
+{
+    QPageSetupDialog pageSetup(mPrinter, this);
 
-	QSharedPointer<DkPrintImage> pi(new DkPrintImage(img, mPrinter));
-
-	// for now - think of adding multiple images here
-	mPrintImages << pi;
-	fitImages();
+    if (pageSetup.exec() == QDialog::Accepted) {
+        // update possible orientation changes
+        if (mPreview->orientation() == QPrinter::Portrait) {
+            mPreview->setPortraitOrientation();
+        } else {
+            mPreview->setLandscapeOrientation();
+        }
+    }
 }
 
-void DkPrintPreviewWidget::fitImages() {
+void DkPrintPreviewDialog::print()
+{
+    QRect pr = mPrinter->pageRect();
 
-	double dpi = 0;
+    QPrintDialog *pDialog = new QPrintDialog(mPrinter, this);
 
-	for (auto pi : mPrintImages) {
-		pi->fit();
-		dpi = pi->dpi();
-	}
+    if (pDialog->exec() == QDialog::Accepted) {
+        // if the page rect is changed - we have to newly fit the images...
+        if (pr != mPrinter->pageRect())
+            mPreview->fitImages();
 
-	updatePreview();
-	emit dpiChanged(qRound(dpi));
+        mPreview->paintForPrinting();
+        close();
+    }
 }
 
-void DkPrintPreviewWidget::wheelEvent(QWheelEvent *event) {
-
-	if (event->modifiers() != Qt::AltModifier) {
-		QPrintPreviewWidget::wheelEvent(event);
-		return;
-	}
-
-	qreal delta = event->delta();
-	if (DkSettingsManager::param().display().invertZoom)
-		delta *= -1;
-	if (event->delta() > 0)
-		zoomIn();
-	else
-		zoomOut();
-	emit zoomChanged();
-
-	QPrintPreviewWidget::wheelEvent(event);	
+// DkPrintPreviewWidget --------------------------------------------------------------------
+DkPrintPreviewWidget::DkPrintPreviewWidget(QPrinter *printer, QWidget *parent, Qt::WindowFlags flags)
+    : QPrintPreviewWidget(printer, parent, flags)
+{
+    mPrinter = printer;
+    connect(this, SIGNAL(paintRequested(QPrinter *)), this, SLOT(paintPreview(QPrinter *)));
 }
 
-void DkPrintPreviewWidget::centerImage() {
+void DkPrintPreviewWidget::paintEvent(QPaintEvent *event)
+{
+    // TODO: can we get a better anti-aliasing here?
+    QPrintPreviewWidget::paintEvent(event);
+}
 
-	for (auto pi : mPrintImages)
-		pi->center();
-	
-	updatePreview();
+void DkPrintPreviewWidget::setImage(const QImage &img)
+{
+    mPrintImages.clear();
+    addImage(img);
 }
 
-void DkPrintPreviewWidget::setLandscapeOrientation() {
+void DkPrintPreviewWidget::addImage(const QImage &img)
+{
+    if (!mPrinter) {
+        qWarning() << "cannot add images to preview if the printer is empty";
+        return;
+    }
 
-	QPrintPreviewWidget::setLandscapeOrientation();
+    QSharedPointer<DkPrintImage> pi(new DkPrintImage(img, mPrinter));
 
-	fitImages();
-	fitInView();
+    // for now - think of adding multiple images here
+    mPrintImages << pi;
+    fitImages();
 }
 
-void DkPrintPreviewWidget::setPortraitOrientation() {
+void DkPrintPreviewWidget::fitImages()
+{
+    double dpi = 0;
 
-	QPrintPreviewWidget::setPortraitOrientation();
+    for (auto pi : mPrintImages) {
+        pi->fit();
+        dpi = pi->dpi();
+    }
 
-	fitImages();
-	fitInView();
+    updatePreview();
+    emit dpiChanged(qRound(dpi));
 }
 
-void DkPrintPreviewWidget::changeDpi(int value) {
-
-	double inchW = mPrinter->pageRect(QPrinter::Inch).width();
-	int pxW = mPrinter->pageRect().width();
-	double sf = ((double)pxW / inchW) / value;
+void DkPrintPreviewWidget::wheelEvent(QWheelEvent *event)
+{
+    if (event->modifiers() != Qt::AltModifier) {
+        QPrintPreviewWidget::wheelEvent(event);
+        return;
+    }
 
-	for (auto pi : mPrintImages)
-		pi->scale(sf);
+    qreal delta = event->angleDelta().y();
+    if (DkSettingsManager::param().display().invertZoom)
+        delta *= -1;
+    if (event->angleDelta().y() > 0)
+        zoomIn();
+    else
+        zoomOut();
+    emit zoomChanged();
 
-	updatePreview();
+    QPrintPreviewWidget::wheelEvent(event);
 }
 
+void DkPrintPreviewWidget::centerImage()
+{
+    for (auto pi : mPrintImages)
+        pi->center();
 
-void DkPrintPreviewWidget::paintPreview(QPrinter* printer) {
-
-	QPainter painter(printer);
+    updatePreview();
+}
 
-	for (auto pi : mPrintImages) {
-		pi->draw(painter);
-		
-		if (pi != mPrintImages.last())
-			printer->newPage();
-	}
+void DkPrintPreviewWidget::setLandscapeOrientation()
+{
+    QPrintPreviewWidget::setLandscapeOrientation();
 
+    fitImages();
+    fitInView();
 }
 
-void DkPrintPreviewWidget::paintForPrinting() {
-
-	int to = mPrinter->toPage() ? mPrinter->toPage() : mPrintImages.size();
+void DkPrintPreviewWidget::setPortraitOrientation()
+{
+    QPrintPreviewWidget::setPortraitOrientation();
 
-	QPainter painter(mPrinter);
+    fitImages();
+    fitInView();
+}
 
-	for (int idx = mPrinter->fromPage(); idx <= to && idx < mPrintImages.size(); idx++) {
+void DkPrintPreviewWidget::changeDpi(int value)
+{
+    double inchW = mPrinter->pageRect(QPrinter::Inch).width();
+    int pxW = mPrinter->pageRect().width();
+    double sf = ((double)pxW / inchW) / value;
 
-		mPrintImages[idx]->draw(painter, true);
+    for (auto pi : mPrintImages)
+        pi->scale(sf);
 
-		if (idx+1 < to)
-			mPrinter->newPage();
-		
-	}
+    updatePreview();
 }
 
+void DkPrintPreviewWidget::paintPreview(QPrinter *printer)
+{
+    QPainter painter(printer);
 
-// DkOpacityDialog --------------------------------------------------------------------
-DkOpacityDialog::DkOpacityDialog(QWidget* parent, Qt::WindowFlags f) : QDialog(parent, f) {
+    for (auto pi : mPrintImages) {
+        pi->draw(painter);
 
-	createLayout();
+        if (pi != mPrintImages.last())
+            printer->newPage();
+    }
 }
 
-void DkOpacityDialog::createLayout() {
-
-	QVBoxLayout* layout = new QVBoxLayout(this);
+void DkPrintPreviewWidget::paintForPrinting()
+{
+    int to = mPrinter->toPage() ? mPrinter->toPage() : mPrintImages.size();
 
-	slider = new DkSlider(tr("Window Opacity"), this);
-	slider->setMinimum(5);
+    QPainter painter(mPrinter);
 
-	// mButtons
-	QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
-	buttons->button(QDialogButtonBox::Ok)->setText(tr("&OK"));
-	buttons->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel"));
-	connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
-	connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
+    for (int idx = mPrinter->fromPage(); idx <= to && idx < mPrintImages.size(); idx++) {
+        mPrintImages[idx]->draw(painter, true);
 
-	layout->addWidget(slider);
-	layout->addWidget(buttons);
+        if (idx + 1 < to)
+            mPrinter->newPage();
+    }
 }
 
-int DkOpacityDialog::value() const {
-	return slider->value();
+// DkOpacityDialog --------------------------------------------------------------------
+DkOpacityDialog::DkOpacityDialog(QWidget *parent, Qt::WindowFlags f)
+    : QDialog(parent, f)
+{
+    createLayout();
 }
 
-// DkExportTiffDialog --------------------------------------------------------------------
-DkExportTiffDialog::DkExportTiffDialog(QWidget* parent /* = 0 */, Qt::WindowFlags f /* = 0 */) : QDialog(parent, f) {
-
-	setWindowTitle(tr("Export Multi-Page TIFF"));
-	createLayout();
-	setAcceptDrops(true);
-
-	connect(this, SIGNAL(updateImage(const QImage&)), mViewport, SLOT(setImage(const QImage&)));
-	connect(&mWatcher, SIGNAL(finished()), this, SLOT(processingFinished()));
-	connect(this, SIGNAL(infoMessage(const QString&)), mMsgLabel, SLOT(setText(const QString&)));
-	connect(this, SIGNAL(updateProgress(int)), mProgress, SLOT(setValue(int)));
-	QMetaObject::connectSlotsByName(this);
-}
+void DkOpacityDialog::createLayout()
+{
+    QVBoxLayout *layout = new QVBoxLayout(this);
 
-void DkExportTiffDialog::dropEvent(QDropEvent *event) {
+    slider = new DkSlider(tr("Window Opacity"), this);
+    slider->setMinimum(5);
 
-	if (event->mimeData()->hasUrls() && event->mimeData()->urls().size() > 0) {
-		QUrl url = event->mimeData()->urls().at(0);
-		url = url.toLocalFile();
+    // mButtons
+    QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
+    buttons->button(QDialogButtonBox::Ok)->setText(tr("&OK"));
+    buttons->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel"));
+    connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
+    connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
 
-		setFile(url.toString());
-	}
+    layout->addWidget(slider);
+    layout->addWidget(buttons);
 }
 
-void DkExportTiffDialog::dragEnterEvent(QDragEnterEvent *event) {
-
-	if (event->mimeData()->hasUrls()) {
-		QUrl url = event->mimeData()->urls().at(0);
-		url = url.toLocalFile();
-		QFileInfo file = QFileInfo(url.toString());
-
-		if (file.exists() && file.suffix().indexOf(QRegExp("tif"), Qt::CaseInsensitive) != -1)
-			event->acceptProposedAction();
-	}
+int DkOpacityDialog::value() const
+{
+    return slider->value();
+}
 
+// DkExportTiffDialog --------------------------------------------------------------------
+DkExportTiffDialog::DkExportTiffDialog(QWidget *parent /* = 0 */, Qt::WindowFlags f /* = 0 */)
+    : QDialog(parent, f)
+{
+    setWindowTitle(tr("Export Multi-Page TIFF"));
+    createLayout();
+    setAcceptDrops(true);
+
+    connect(this, SIGNAL(updateImage(const QImage &)), mViewport, SLOT(setImage(const QImage &)));
+    connect(&mWatcher, SIGNAL(finished()), this, SLOT(processingFinished()));
+    connect(this, SIGNAL(infoMessage(const QString &)), mMsgLabel, SLOT(setText(const QString &)));
+    connect(this, SIGNAL(updateProgress(int)), mProgress, SLOT(setValue(int)));
+    QMetaObject::connectSlotsByName(this);
+}
+
+void DkExportTiffDialog::dropEvent(QDropEvent *event)
+{
+    if (event->mimeData()->hasUrls() && event->mimeData()->urls().size() > 0) {
+        QUrl url = event->mimeData()->urls().at(0);
+        url = url.toLocalFile();
+
+        setFile(url.toString());
+    }
 }
 
+void DkExportTiffDialog::dragEnterEvent(QDragEnterEvent *event)
+{
+    if (event->mimeData()->hasUrls()) {
+        QUrl url = event->mimeData()->urls().at(0);
+        url = url.toLocalFile();
+        QFileInfo file = QFileInfo(url.toString());
 
-void DkExportTiffDialog::createLayout() {
+        if (file.exists() && file.suffix().indexOf(QRegularExpression("tif"), QRegularExpression::CaseInsensitiveOption) != -1)
+            event->acceptProposedAction();
+    }
+}
 
-	// progress bar
-	mProgress = new QProgressBar(this);
-	mProgress->hide();
+void DkExportTiffDialog::createLayout()
+{
+    // progress bar
+    mProgress = new QProgressBar(this);
+    mProgress->hide();
 
-	mMsgLabel = new QLabel(this);
-	mMsgLabel->setObjectName("DkWarningInfo");
-	mMsgLabel->hide();
+    mMsgLabel = new QLabel(this);
+    mMsgLabel->setObjectName("DkWarningInfo");
+    mMsgLabel->hide();
 
-	// open handles
-	QLabel* openLabel = new QLabel(tr("Multi-Page TIFF:"), this);
-	openLabel->setAlignment(Qt::AlignRight);
+    // open handles
+    QLabel *openLabel = new QLabel(tr("Multi-Page TIFF:"), this);
+    openLabel->setAlignment(Qt::AlignRight);
 
-	QPushButton* openButton = new QPushButton(tr("&Browse"), this);
-	openButton->setObjectName("openButton");
+    QPushButton *openButton = new QPushButton(tr("&Browse"), this);
+    openButton->setObjectName("openButton");
 
-	mTiffLabel = new QLabel(tr("No Multi-Page TIFF loaded"), this);
+    mTiffLabel = new QLabel(tr("No Multi-Page TIFF loaded"), this);
 
-	// save handles
-	QLabel* saveLabel = new QLabel(tr("Save Folder:"), this);
-	saveLabel->setAlignment(Qt::AlignRight);
+    // save handles
+    QLabel *saveLabel = new QLabel(tr("Save Folder:"), this);
+    saveLabel->setAlignment(Qt::AlignRight);
 
-	QPushButton* saveButton = new QPushButton(tr("&Browse"), this);
-	saveButton->setObjectName("saveButton");
+    QPushButton *saveButton = new QPushButton(tr("&Browse"), this);
+    saveButton->setObjectName("saveButton");
 
-	mFolderLabel = new QLabel(tr("Specify a Save Folder"), this);
+    mFolderLabel = new QLabel(tr("Specify a Save Folder"), this);
 
-	// file name handles
-	QLabel* fileLabel = new QLabel(tr("Filename:"), this);
-	fileLabel->setAlignment(Qt::AlignRight);
+    // file name handles
+    QLabel *fileLabel = new QLabel(tr("Filename:"), this);
+    fileLabel->setAlignment(Qt::AlignRight);
 
-	mFileEdit = new QLineEdit("tiff_page", this);
-	mFileEdit->setObjectName("fileEdit");
+    mFileEdit = new QLineEdit("tiff_page", this);
+    mFileEdit->setObjectName("fileEdit");
 
-	mSuffixBox = new QComboBox(this);
-	mSuffixBox->addItems(DkSettingsManager::param().app().saveFilters);
-	mSuffixBox->setCurrentIndex(DkSettingsManager::param().app().saveFilters.indexOf(QRegExp(".*tif.*")));
+    mSuffixBox = new QComboBox(this);
+    mSuffixBox->addItems(DkSettingsManager::param().app().saveFilters);
+    mSuffixBox->setCurrentIndex(DkSettingsManager::param().app().saveFilters.indexOf(QRegularExpression(".*tif.*")));
 
-	// export handles
-	QLabel* exportLabel = new QLabel(tr("Export Pages"));
-	exportLabel->setAlignment(Qt::AlignRight);
+    // export handles
+    QLabel *exportLabel = new QLabel(tr("Export Pages"));
+    exportLabel->setAlignment(Qt::AlignRight);
 
-	mFromPage = new QSpinBox(0);
+    mFromPage = new QSpinBox(0);
 
-	mToPage = new QSpinBox(0);
+    mToPage = new QSpinBox(0);
 
-	mOverwrite = new QCheckBox(tr("Overwrite"));
+    mOverwrite = new QCheckBox(tr("Overwrite"));
 
-	mControlWidget = new QWidget(this);
-	QGridLayout* controlLayout = new QGridLayout(mControlWidget);
-	controlLayout->addWidget(openLabel, 0, 0);
-	controlLayout->addWidget(openButton, 0, 1, 1, 2);
-	controlLayout->addWidget(mTiffLabel, 0, 3, 1, 2);
-	//controlLayout->setColumnStretch(3, 1);
+    mControlWidget = new QWidget(this);
+    QGridLayout *controlLayout = new QGridLayout(mControlWidget);
+    controlLayout->addWidget(openLabel, 0, 0);
+    controlLayout->addWidget(openButton, 0, 1, 1, 2);
+    controlLayout->addWidget(mTiffLabel, 0, 3, 1, 2);
+    // controlLayout->setColumnStretch(3, 1);
 
-	controlLayout->addWidget(saveLabel, 1, 0);
-	controlLayout->addWidget(saveButton, 1, 1, 1, 2);
-	controlLayout->addWidget(mFolderLabel, 1, 3, 1, 2);
-	//controlLayout->setColumnStretch(3, 1);
+    controlLayout->addWidget(saveLabel, 1, 0);
+    controlLayout->addWidget(saveButton, 1, 1, 1, 2);
+    controlLayout->addWidget(mFolderLabel, 1, 3, 1, 2);
+    // controlLayout->setColumnStretch(3, 1);
 
-	controlLayout->addWidget(fileLabel, 2, 0);
-	controlLayout->addWidget(mFileEdit, 2, 1, 1, 2);
-	controlLayout->addWidget(mSuffixBox, 2, 3, 1, 2);
-	//controlLayout->setColumnStretch(3, 1);
+    controlLayout->addWidget(fileLabel, 2, 0);
+    controlLayout->addWidget(mFileEdit, 2, 1, 1, 2);
+    controlLayout->addWidget(mSuffixBox, 2, 3, 1, 2);
+    // controlLayout->setColumnStretch(3, 1);
 
-	controlLayout->addWidget(exportLabel, 3, 0);
-	controlLayout->addWidget(mFromPage, 3, 1);
-	controlLayout->addWidget(mToPage, 3, 2);
-	controlLayout->addWidget(mOverwrite, 3, 3);
-	controlLayout->setColumnStretch(5, 1);
+    controlLayout->addWidget(exportLabel, 3, 0);
+    controlLayout->addWidget(mFromPage, 3, 1);
+    controlLayout->addWidget(mToPage, 3, 2);
+    controlLayout->addWidget(mOverwrite, 3, 3);
+    controlLayout->setColumnStretch(5, 1);
 
-	// shows the image if it could be loaded
-	mViewport = new DkBaseViewPort(this);
-	mViewport->setForceFastRendering(true);
-	mViewport->setPanControl(QPointF(0.0f, 0.0f));
+    // shows the image if it could be loaded
+    mViewport = new DkBaseViewPort(this);
+    mViewport->setForceFastRendering(true);
+    mViewport->setPanControl(QPointF(0.0f, 0.0f));
 
-	// Buttons
-	mButtons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
-	mButtons->button(QDialogButtonBox::Ok)->setText(tr("&Export"));
-	mButtons->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel"));
-	connect(mButtons, SIGNAL(accepted()), this, SLOT(accept()));
-	connect(mButtons, SIGNAL(rejected()), this, SLOT(reject()));
+    // Buttons
+    mButtons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
+    mButtons->button(QDialogButtonBox::Ok)->setText(tr("&Export"));
+    mButtons->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel"));
+    connect(mButtons, SIGNAL(accepted()), this, SLOT(accept()));
+    connect(mButtons, SIGNAL(rejected()), this, SLOT(reject()));
 
-	QVBoxLayout* layout = new QVBoxLayout(this);
-	layout->addWidget(mViewport);
-	layout->addWidget(mProgress);
-	layout->addWidget(mMsgLabel);
-	layout->addWidget(mControlWidget);
-	layout->addWidget(mButtons);
+    QVBoxLayout *layout = new QVBoxLayout(this);
+    layout->addWidget(mViewport);
+    layout->addWidget(mProgress);
+    layout->addWidget(mMsgLabel);
+    layout->addWidget(mControlWidget);
+    layout->addWidget(mButtons);
 
-	enableTIFFSave(false);
+    enableTIFFSave(false);
 }
 
-void DkExportTiffDialog::on_openButton_pressed() {
-
-	// load system default open dialog
-	QString fileName = QFileDialog::getOpenFileName(
-		this, 
-		tr("Open TIFF"),
-		mFilePath, 
-		DkSettingsManager::param().app().saveFilters.filter(QRegExp(".*tif.*")).join(";;"),
-		nullptr,
-		DkDialog::fileDialogOptions()
-	);
+void DkExportTiffDialog::on_openButton_pressed()
+{
+    // load system default open dialog
+    QString fileName = QFileDialog::getOpenFileName(this,
+                                                    tr("Open TIFF"),
+                                                    mFilePath,
+                                                    DkSettingsManager::param().app().saveFilters.filter(QRegularExpression(".*tif.*")).join(";;"),
+                                                    nullptr,
+                                                    DkDialog::fileDialogOptions());
 
-	setFile(fileName);
+    setFile(fileName);
 }
 
-void DkExportTiffDialog::on_saveButton_pressed() {
-	qDebug() << "save triggered...";
+void DkExportTiffDialog::on_saveButton_pressed()
+{
+    qDebug() << "save triggered...";
 
-	// load system default open dialog
-	QString dirName = QFileDialog::getExistingDirectory(
-		this, 
-		tr("Open an Image Directory"),
-		mSaveDirPath,
-		QFileDialog::ShowDirsOnly | DkDialog::fileDialogOptions()
-	);
+    // load system default open dialog
+    QString dirName =
+        QFileDialog::getExistingDirectory(this, tr("Open an Image Directory"), mSaveDirPath, QFileDialog::ShowDirsOnly | DkDialog::fileDialogOptions());
 
-	if (QDir(dirName).exists()) {
-		mSaveDirPath = dirName;
-		mFolderLabel->setText(mSaveDirPath);
-	}
+    if (QDir(dirName).exists()) {
+        mSaveDirPath = dirName;
+        mFolderLabel->setText(mSaveDirPath);
+    }
 }
 
-void DkExportTiffDialog::on_fileEdit_textChanged(const QString& filename) {
-
-	qDebug() << "new file name: " << filename;
+void DkExportTiffDialog::on_fileEdit_textChanged(const QString &filename)
+{
+    qDebug() << "new file name: " << filename;
 }
 
-void DkExportTiffDialog::reject() {
-
-	// not sure if this is a nice way to do: but we change cancel behavior while processing
-	if (mProcessing)
-		mProcessing = false;
-	else
-		QDialog::reject();
-
+void DkExportTiffDialog::reject()
+{
+    // not sure if this is a nice way to do: but we change cancel behavior while processing
+    if (mProcessing)
+        mProcessing = false;
+    else
+        QDialog::reject();
 }
 
-void DkExportTiffDialog::accept() {
+void DkExportTiffDialog::accept()
+{
+    mProgress->setMinimum(mFromPage->value() - 1);
+    mProgress->setMaximum(mToPage->value());
+    mProgress->setValue(mProgress->minimum());
+    mProgress->show();
+    mMsgLabel->show();
 
-	mProgress->setMinimum(mFromPage->value()-1);
-	mProgress->setMaximum(mToPage->value());
-	mProgress->setValue(mProgress->minimum());
-	mProgress->show();
-	mMsgLabel->show();
+    enableAll(false);
 
-	enableAll(false);
+    QString suffix = mSuffixBox->currentText();
 
-	QString suffix = mSuffixBox->currentText();
-
-	for (int idx = 0; idx < DkSettingsManager::param().app().fileFilters.size(); idx++) {
-		if (suffix.contains("(" + DkSettingsManager::param().app().fileFilters.at(idx))) {
-			suffix = DkSettingsManager::param().app().fileFilters.at(idx);
-			suffix.replace("*","");
-			break;
-		}
-	}
-
-	QFileInfo sFile(mSaveDirPath, mFileEdit->text() + "-" + suffix);
-	
-	emit infoMessage("");
-	
-	QFuture<int> future = QtConcurrent::run(this, 
-		&nmc::DkExportTiffDialog::exportImages,
-		sFile.absoluteFilePath(), 
-		mFromPage->value(), 
-		mToPage->value(),
-		mOverwrite->isChecked());
-	mWatcher.setFuture(future);
-}
+    for (int idx = 0; idx < DkSettingsManager::param().app().fileFilters.size(); idx++) {
+        if (suffix.contains("(" + DkSettingsManager::param().app().fileFilters.at(idx))) {
+            suffix = DkSettingsManager::param().app().fileFilters.at(idx);
+            suffix.replace("*", "");
+            break;
+        }
+    }
 
-void DkExportTiffDialog::processingFinished() {
+    QFileInfo sFile(mSaveDirPath, mFileEdit->text() + "-" + suffix);
 
-	enableAll(true);
-	mProgress->hide();
-	mMsgLabel->hide();
+    emit infoMessage("");
 
-	if (mWatcher.future() == QDialog::Accepted)
-		QDialog::accept();
+    QFuture<int> future = QtConcurrent::run(this,
+                                            &nmc::DkExportTiffDialog::exportImages,
+                                            sFile.absoluteFilePath(),
+                                            mFromPage->value(),
+                                            mToPage->value(),
+                                            mOverwrite->isChecked());
+    mWatcher.setFuture(future);
 }
 
-int DkExportTiffDialog::exportImages(const QString& saveFilePath, int from, int to, bool overwrite) {
+void DkExportTiffDialog::processingFinished()
+{
+    enableAll(true);
+    mProgress->hide();
+    mMsgLabel->hide();
 
-	mProcessing = true;
+    if (mWatcher.future() == QDialog::Accepted)
+        QDialog::accept();
+}
 
-	QFileInfo saveInfo(saveFilePath);
+int DkExportTiffDialog::exportImages(const QString &saveFilePath, int from, int to, bool overwrite)
+{
+    mProcessing = true;
 
-	// Do your job
-	for (int idx = from; idx <= to; idx++) {
+    QFileInfo saveInfo(saveFilePath);
 
-		QFileInfo cInfo(saveInfo.absolutePath(), saveInfo.baseName() + QString::number(idx) + "." + saveInfo.suffix());
-		qDebug() << "trying to save: " << cInfo.absoluteFilePath();
+    // Do your job
+    for (int idx = from; idx <= to; idx++) {
+        QFileInfo cInfo(saveInfo.absolutePath(), saveInfo.baseName() + QString::number(idx) + "." + saveInfo.suffix());
+        qDebug() << "trying to save: " << cInfo.absoluteFilePath();
 
-		emit updateProgress(idx-1);
+        emit updateProgress(idx - 1);
 
-		// user wants to overwrite files
-		if (cInfo.exists() && overwrite) {
-			QFile f(cInfo.absoluteFilePath());
-			f.remove();
-		}
-		else if (cInfo.exists()) {
-			emit infoMessage(tr("%1 exists, skipping...").arg(cInfo.fileName()));
-			continue;
-		}
+        // user wants to overwrite files
+        if (cInfo.exists() && overwrite) {
+            QFile f(cInfo.absoluteFilePath());
+            f.remove();
+        } else if (cInfo.exists()) {
+            emit infoMessage(tr("%1 exists, skipping...").arg(cInfo.fileName()));
+            continue;
+        }
 
-		if (!mLoader.loadPageAt(idx)) {	// load next
-			emit infoMessage(tr("Sorry, I could not load page: %1").arg(idx));
-			continue;
-		}
+        if (!mLoader.loadPageAt(idx)) { // load next
+            emit infoMessage(tr("Sorry, I could not load page: %1").arg(idx));
+            continue;
+        }
 
-		QString lSaveFilePath = mLoader.save(cInfo.absoluteFilePath(), mLoader.image(), 90);		//TODO: ask user for compression?
-		QFileInfo lSaveInfo = QFileInfo(lSaveFilePath);
+        QString lSaveFilePath = mLoader.save(cInfo.absoluteFilePath(), mLoader.image(), 90); // TODO: ask user for compression?
+        QFileInfo lSaveInfo = QFileInfo(lSaveFilePath);
 
-		if (!lSaveInfo.exists() || !lSaveInfo.isFile())
-			emit infoMessage(tr("Sorry, I could not save: %1").arg(cInfo.fileName()));
+        if (!lSaveInfo.exists() || !lSaveInfo.isFile())
+            emit infoMessage(tr("Sorry, I could not save: %1").arg(cInfo.fileName()));
 
-		emit updateImage(mLoader.image());
-		emit updateProgress(idx);
+        emit updateImage(mLoader.image());
+        emit updateProgress(idx);
 
-		// user canceled?
-		if (!mProcessing)
-			return QDialog::Rejected;
-	}
+        // user canceled?
+        if (!mProcessing)
+            return QDialog::Rejected;
+    }
 
-	mProcessing = false;
+    mProcessing = false;
 
-	return QDialog::Accepted;
+    return QDialog::Accepted;
 }
 
-void DkExportTiffDialog::setFile(const QString& filePath) {
-	
-	if (!QFileInfo(filePath).exists())
-		return;
-	
-	QFileInfo fInfo(filePath);
-	mFilePath = filePath;
-	mSaveDirPath = fInfo.absolutePath();
-	mFolderLabel->setText(mSaveDirPath);
-	mTiffLabel->setText(filePath);
-	mFileEdit->setText(fInfo.baseName());
-
-	mLoader.loadGeneral(filePath, true);
-	mViewport->setImage(mLoader.image());
+void DkExportTiffDialog::setFile(const QString &filePath)
+{
+    if (!QFileInfo(filePath).exists())
+        return;
 
-	enableTIFFSave(mLoader.getNumPages() > 1);
+    QFileInfo fInfo(filePath);
+    mFilePath = filePath;
+    mSaveDirPath = fInfo.absolutePath();
+    mFolderLabel->setText(mSaveDirPath);
+    mTiffLabel->setText(filePath);
+    mFileEdit->setText(fInfo.baseName());
 
-	mFromPage->setRange(1, mLoader.getNumPages());
-	mToPage->setRange(1, mLoader.getNumPages());
+    mLoader.loadGeneral(filePath, true);
+    mViewport->setImage(mLoader.image());
 
-	mFromPage->setValue(1);
-	mToPage->setValue(mLoader.getNumPages());
-}
+    enableTIFFSave(mLoader.getNumPages() > 1);
 
-void DkExportTiffDialog::enableAll(bool enable) {
+    mFromPage->setRange(1, mLoader.getNumPages());
+    mToPage->setRange(1, mLoader.getNumPages());
 
-	enableTIFFSave(enable);
-	mControlWidget->setEnabled(enable);
+    mFromPage->setValue(1);
+    mToPage->setValue(mLoader.getNumPages());
 }
 
-void DkExportTiffDialog::enableTIFFSave(bool enable) {
+void DkExportTiffDialog::enableAll(bool enable)
+{
+    enableTIFFSave(enable);
+    mControlWidget->setEnabled(enable);
+}
 
-	mFileEdit->setEnabled(enable);
-	mSuffixBox->setEnabled(enable);
-	mFromPage->setEnabled(enable);
-	mToPage->setEnabled(enable);
-	mButtons->button(QDialogButtonBox::Ok)->setEnabled(enable);
+void DkExportTiffDialog::enableTIFFSave(bool enable)
+{
+    mFileEdit->setEnabled(enable);
+    mSuffixBox->setEnabled(enable);
+    mFromPage->setEnabled(enable);
+    mToPage->setEnabled(enable);
+    mButtons->button(QDialogButtonBox::Ok)->setEnabled(enable);
 }
 
 #ifdef WITH_OPENCV
 
 // DkMosaicDialog --------------------------------------------------------------------
-DkMosaicDialog::DkMosaicDialog(QWidget* parent /* = 0 */, Qt::WindowFlags f /* = 0 */) : QDialog(parent, f) {
-
-	mProcessing = false;
-	mPostProcessing = false;
-	mUpdatePostProcessing = false;
-
-	setWindowTitle(tr("Create Mosaic Image"));
-	createLayout();
-	setAcceptDrops(true);
-
-	connect(this, SIGNAL(updateImage(const QImage&)), mPreview, SLOT(setImage(const QImage&)));
-	connect(&mMosaicWatcher, SIGNAL(finished()), this, SLOT(mosaicFinished()));
-	connect(&mPostProcessWatcher, SIGNAL(finished()), this, SLOT(postProcessFinished()));
-	connect(&mPostProcessWatcher, SIGNAL(canceled()), this, SLOT(postProcessFinished()));
-	connect(this, SIGNAL(infoMessage(const QString&)), mMsgLabel, SLOT(setText(const QString&)));
-	connect(this, SIGNAL(updateProgress(int)), mProgress, SLOT(setValue(int)));
-	QMetaObject::connectSlotsByName(this);
-}
-
-void DkMosaicDialog::dropEvent(QDropEvent *event) {
-
-	if (event->mimeData()->hasUrls() && event->mimeData()->urls().size() > 0) {
-		QUrl url = event->mimeData()->urls().at(0);
-		url = url.toLocalFile();
-
-		setFile(url.toString());
-	}
-}
-
-void DkMosaicDialog::dragEnterEvent(QDragEnterEvent *event) {
-
-	if (event->mimeData()->hasUrls()) {
-		QUrl url = event->mimeData()->urls().at(0);
-		url = url.toLocalFile();
-		QFileInfo file = QFileInfo(url.toString());
-
-		if (file.exists() && DkUtils::isValid(file))
-			event->acceptProposedAction();
-	}
-}
-
-void DkMosaicDialog::createLayout() {
-
-	// progress bar
-	mProgress = new QProgressBar(this);
-	mProgress->hide();
-
-	mMsgLabel = new QLabel(this);
-	mMsgLabel->setObjectName("DkWarningInfo");
-	mMsgLabel->hide();
-
-	// post processing sliders
-	mDarkenSlider = new QSlider(Qt::Horizontal, this);
-	mDarkenSlider->setObjectName("darkenSlider");
-	mDarkenSlider->setValue(40);
-	//darkenSlider->hide();
-
-	mLightenSlider = new QSlider(Qt::Horizontal, this);
-	mLightenSlider->setObjectName("lightenSlider");
-	mLightenSlider->setValue(40);
-	//lightenSlider->hide();
-
-	mSaturationSlider = new QSlider(Qt::Horizontal, this);
-	mSaturationSlider->setObjectName("saturationSlider");
-	mSaturationSlider->setValue(60);
-	//saturationSlider->hide();
-
-	mSliderWidget = new QWidget(this);
-	QGridLayout* sliderLayout = new QGridLayout(mSliderWidget);
-	sliderLayout->addWidget(new QLabel(tr("Darken")), 0, 0);
-	sliderLayout->addWidget(new QLabel(tr("Lighten")), 0, 1);
-	sliderLayout->addWidget(new QLabel(tr("Saturation")), 0, 2);
-
-	sliderLayout->addWidget(mDarkenSlider, 1, 0);
-	sliderLayout->addWidget(mLightenSlider, 1, 1);
-	sliderLayout->addWidget(mSaturationSlider, 1, 2);
-	mSliderWidget->hide();
-
-	// open handles
-	QLabel* openLabel = new QLabel(tr("Mosaic Image:"), this);
-	openLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
-
-	QPushButton* openButton = new QPushButton(tr("&Browse"), this);
-	openButton->setObjectName("openButton");
-	openButton->setToolTip(tr("Choose which image to mosaic."));
-
-	mFileLabel = new QLabel(tr("No Image loaded"), this);
-
-	// save handles
-	QLabel* saveLabel = new QLabel(tr("Mosaic Elements Folder:"), this);
-	saveLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
-
-	QPushButton* dbButton = new QPushButton(tr("&Browse"), this);
-	dbButton->setObjectName("dbButton");
-	dbButton->setToolTip(tr("Specify the root folder of images used for mosaic elements."));
-
-	mFolderLabel = new QLabel(tr("Specify an Image Database"), this);
-
-	// resolution handles
-	QLabel* sizeLabel = new QLabel(tr("Resolution:"));
-	sizeLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
-	mNewWidthBox = new QSpinBox();
-	mNewWidthBox->setObjectName("newWidthBox");
-	mNewWidthBox->setToolTip(tr("Pixel Width"));
-	mNewWidthBox->setMinimum(100);
-	mNewWidthBox->setMaximum(30000);
-	mNewHeightBox = new QSpinBox();
-	mNewHeightBox->setObjectName("newHeightBox");
-	mNewHeightBox->setToolTip(tr("Pixel Height"));
-	mNewHeightBox->setMinimum(100);
-	mNewHeightBox->setMaximum(30000);
-	mRealResLabel = new QLabel("");
-	//realResLabel->setToolTip(tr("."));
-
-	// num patch handles
-	QLabel* patchLabel = new QLabel(tr("Patches:"));
-	patchLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
-	mNumPatchesH = new QSpinBox(this);
-	mNumPatchesH->setObjectName("numPatchesH");
-	mNumPatchesH->setToolTip(tr("Number of Horizontal Patches"));
-	mNumPatchesH->setMinimum(1);
-	mNumPatchesH->setMaximum(1000);
-	mNumPatchesV = new QSpinBox(this);
-	mNumPatchesV->setObjectName("numPatchesV");
-	mNumPatchesV->setToolTip(tr("Number of Vertical Patches"));
-	mNumPatchesV->setMinimum(1);
-	mNumPatchesV->setMaximum(1000);
-	mPatchResLabel = new QLabel("", this);
-	mPatchResLabel->setObjectName("DkDecentInfo");
-	mPatchResLabel->setToolTip(tr("If this label turns red, the computation might be slower."));
-
-	// file filters
-	QLabel* filterLabel = new QLabel(tr("Filters:"), this);
-	filterLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
-
-	mFilterEdit = new QLineEdit("", this);
-	mFilterEdit->setObjectName("fileEdit");
-	mFilterEdit->setToolTip(tr("You can split multiple ignore words with ;"));
-
-	QStringList filters = DkSettingsManager::param().app().openFilters;
-	filters.pop_front();	// replace for better readability
-	filters.push_front(tr("All Images"));
-	mSuffixBox = new QComboBox(this);
-	mSuffixBox->addItems(filters);
-	//suffixBox->setCurrentIndex(DkImageLoader::saveFilters.indexOf(QRegExp(".*tif.*")));
-
-	mControlWidget = new QWidget(this);
-	QGridLayout* controlLayout = new QGridLayout(mControlWidget);
-	controlLayout->addWidget(openLabel, 0, 0);
-	controlLayout->addWidget(openButton, 0, 1, 1, 2);
-	controlLayout->addWidget(mFileLabel, 0, 3, 1, 2);
-	//controlLayout->setColumnStretch(3, 1);
-
-	controlLayout->addWidget(saveLabel, 1, 0);
-	controlLayout->addWidget(dbButton, 1, 1, 1, 2);
-	controlLayout->addWidget(mFolderLabel, 1, 3, 1, 2);
-	//controlLayout->setColumnStretch(3, 1);
-
-	controlLayout->addWidget(sizeLabel, 2, 0);
-	controlLayout->addWidget(mNewWidthBox, 2, 1);
-	controlLayout->addWidget(mNewHeightBox, 2, 2);
-	controlLayout->addWidget(mRealResLabel, 2, 3);
-
-	controlLayout->addWidget(patchLabel, 4, 0);
-	controlLayout->addWidget(mNumPatchesH, 4, 1);
-	controlLayout->addWidget(mNumPatchesV, 4, 2);
-	controlLayout->addWidget(mPatchResLabel, 4, 3);
-
-	controlLayout->addWidget(filterLabel, 5, 0);
-	controlLayout->addWidget(mFilterEdit, 5, 1, 1, 2);
-	controlLayout->addWidget(mSuffixBox, 5, 3, 1, 2);
-	controlLayout->setColumnStretch(5, 1);
-
-	// shows the image if it could be loaded
-	mViewport = new DkBaseViewPort(this);
-	mViewport->setForceFastRendering(true);
-	mViewport->setPanControl(QPointF(0.0f, 0.0f));
-
-	mPreview = new DkBaseViewPort(this);
-	mPreview->setForceFastRendering(true);
-	mPreview->setPanControl(QPointF(0.0f, 0.0f));
-	mPreview->hide();
-
-	QWidget* viewports = new QWidget(this);
-	QHBoxLayout* viewLayout = new QHBoxLayout(viewports);
-	viewLayout->addWidget(mViewport);
-	viewLayout->addWidget(mPreview);
-
-	// mButtons
-	mButtons = new QDialogButtonBox(QDialogButtonBox::Apply | QDialogButtonBox::Save | QDialogButtonBox::Cancel, Qt::Horizontal, this);
-	mButtons->button(QDialogButtonBox::Save)->setText(tr("&Save"));
-	mButtons->button(QDialogButtonBox::Apply)->setText(tr("&Generate"));
-	mButtons->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel"));
-	//connect(mButtons, SIGNAL(accepted()), this, SLOT(accept()));
-	connect(mButtons, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonClicked(QAbstractButton*)));
-	connect(mButtons, SIGNAL(rejected()), this, SLOT(reject()));
-	mButtons->button(QDialogButtonBox::Save)->setEnabled(false);
-	
-	QVBoxLayout* layout = new QVBoxLayout(this);
-	layout->addWidget(viewports);
-	layout->addWidget(mProgress);
-	layout->addWidget(mSliderWidget);
-	layout->addWidget(mMsgLabel);
-	layout->addWidget(mControlWidget);
-	layout->addWidget(mButtons);
-
-	enableMosaicSave(false);
-}
-
-void DkMosaicDialog::on_openButton_pressed() {
-
-	// load system default open dialog
-	QString fileName = QFileDialog::getOpenFileName(
-		this, 
-		tr("Open TIFF"),
-		mFilePath, 
-		DkSettingsManager::param().app().openFilters.join(";;"),
-		nullptr,
-		DkDialog::fileDialogOptions()
-	);
-
-	setFile(fileName);
+DkMosaicDialog::DkMosaicDialog(QWidget *parent /* = 0 */, Qt::WindowFlags f /* = 0 */)
+    : QDialog(parent, f)
+{
+    mProcessing = false;
+    mPostProcessing = false;
+    mUpdatePostProcessing = false;
+
+    setWindowTitle(tr("Create Mosaic Image"));
+    createLayout();
+    setAcceptDrops(true);
+
+    connect(this, SIGNAL(updateImage(const QImage &)), mPreview, SLOT(setImage(const QImage &)));
+    connect(&mMosaicWatcher, SIGNAL(finished()), this, SLOT(mosaicFinished()));
+    connect(&mPostProcessWatcher, SIGNAL(finished()), this, SLOT(postProcessFinished()));
+    connect(&mPostProcessWatcher, SIGNAL(canceled()), this, SLOT(postProcessFinished()));
+    connect(this, SIGNAL(infoMessage(const QString &)), mMsgLabel, SLOT(setText(const QString &)));
+    connect(this, SIGNAL(updateProgress(int)), mProgress, SLOT(setValue(int)));
+    QMetaObject::connectSlotsByName(this);
+}
+
+void DkMosaicDialog::dropEvent(QDropEvent *event)
+{
+    if (event->mimeData()->hasUrls() && event->mimeData()->urls().size() > 0) {
+        QUrl url = event->mimeData()->urls().at(0);
+        url = url.toLocalFile();
+
+        setFile(url.toString());
+    }
 }
 
-void DkMosaicDialog::on_dbButton_pressed() {
-	qDebug() << "save triggered...";
-
-	// load system default open dialog
-	QString dirName = QFileDialog::getExistingDirectory(
-		this, 
-		tr("Open an Image Directory"), 
-		mSavePath,
-		QFileDialog::ShowDirsOnly | DkDialog::fileDialogOptions()
-	);
+void DkMosaicDialog::dragEnterEvent(QDragEnterEvent *event)
+{
+    if (event->mimeData()->hasUrls()) {
+        QUrl url = event->mimeData()->urls().at(0);
+        url = url.toLocalFile();
+        QFileInfo file = QFileInfo(url.toString());
 
-	if (QFileInfo(dirName).exists()) {
-		mSavePath = dirName;
-		mFolderLabel->setText(mSavePath);
-	}
+        if (file.exists() && DkUtils::isValid(file))
+            event->acceptProposedAction();
+    }
 }
 
-void DkMosaicDialog::on_fileEdit_textChanged(const QString& filename) {
-
-	qDebug() << "new file name: " << filename;
+void DkMosaicDialog::createLayout()
+{
+    // progress bar
+    mProgress = new QProgressBar(this);
+    mProgress->hide();
+
+    mMsgLabel = new QLabel(this);
+    mMsgLabel->setObjectName("DkWarningInfo");
+    mMsgLabel->hide();
+
+    // post processing sliders
+    mDarkenSlider = new QSlider(Qt::Horizontal, this);
+    mDarkenSlider->setObjectName("darkenSlider");
+    mDarkenSlider->setValue(40);
+    // darkenSlider->hide();
+
+    mLightenSlider = new QSlider(Qt::Horizontal, this);
+    mLightenSlider->setObjectName("lightenSlider");
+    mLightenSlider->setValue(40);
+    // lightenSlider->hide();
+
+    mSaturationSlider = new QSlider(Qt::Horizontal, this);
+    mSaturationSlider->setObjectName("saturationSlider");
+    mSaturationSlider->setValue(60);
+    // saturationSlider->hide();
+
+    mSliderWidget = new QWidget(this);
+    QGridLayout *sliderLayout = new QGridLayout(mSliderWidget);
+    sliderLayout->addWidget(new QLabel(tr("Darken")), 0, 0);
+    sliderLayout->addWidget(new QLabel(tr("Lighten")), 0, 1);
+    sliderLayout->addWidget(new QLabel(tr("Saturation")), 0, 2);
+
+    sliderLayout->addWidget(mDarkenSlider, 1, 0);
+    sliderLayout->addWidget(mLightenSlider, 1, 1);
+    sliderLayout->addWidget(mSaturationSlider, 1, 2);
+    mSliderWidget->hide();
+
+    // open handles
+    QLabel *openLabel = new QLabel(tr("Mosaic Image:"), this);
+    openLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
+
+    QPushButton *openButton = new QPushButton(tr("&Browse"), this);
+    openButton->setObjectName("openButton");
+    openButton->setToolTip(tr("Choose which image to mosaic."));
+
+    mFileLabel = new QLabel(tr("No Image loaded"), this);
+
+    // save handles
+    QLabel *saveLabel = new QLabel(tr("Mosaic Elements Folder:"), this);
+    saveLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
+
+    QPushButton *dbButton = new QPushButton(tr("&Browse"), this);
+    dbButton->setObjectName("dbButton");
+    dbButton->setToolTip(tr("Specify the root folder of images used for mosaic elements."));
+
+    mFolderLabel = new QLabel(tr("Specify an Image Database"), this);
+
+    // resolution handles
+    QLabel *sizeLabel = new QLabel(tr("Resolution:"));
+    sizeLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
+    mNewWidthBox = new QSpinBox();
+    mNewWidthBox->setObjectName("newWidthBox");
+    mNewWidthBox->setToolTip(tr("Pixel Width"));
+    mNewWidthBox->setMinimum(100);
+    mNewWidthBox->setMaximum(30000);
+    mNewHeightBox = new QSpinBox();
+    mNewHeightBox->setObjectName("newHeightBox");
+    mNewHeightBox->setToolTip(tr("Pixel Height"));
+    mNewHeightBox->setMinimum(100);
+    mNewHeightBox->setMaximum(30000);
+    mRealResLabel = new QLabel("");
+    // realResLabel->setToolTip(tr("."));
+
+    // num patch handles
+    QLabel *patchLabel = new QLabel(tr("Patches:"));
+    patchLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
+    mNumPatchesH = new QSpinBox(this);
+    mNumPatchesH->setObjectName("numPatchesH");
+    mNumPatchesH->setToolTip(tr("Number of Horizontal Patches"));
+    mNumPatchesH->setMinimum(1);
+    mNumPatchesH->setMaximum(1000);
+    mNumPatchesV = new QSpinBox(this);
+    mNumPatchesV->setObjectName("numPatchesV");
+    mNumPatchesV->setToolTip(tr("Number of Vertical Patches"));
+    mNumPatchesV->setMinimum(1);
+    mNumPatchesV->setMaximum(1000);
+    mPatchResLabel = new QLabel("", this);
+    mPatchResLabel->setObjectName("DkDecentInfo");
+    mPatchResLabel->setToolTip(tr("If this label turns red, the computation might be slower."));
+
+    // file filters
+    QLabel *filterLabel = new QLabel(tr("Filters:"), this);
+    filterLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
+
+    mFilterEdit = new QLineEdit("", this);
+    mFilterEdit->setObjectName("fileEdit");
+    mFilterEdit->setToolTip(tr("You can split multiple ignore words with ;"));
+
+    QStringList filters = DkSettingsManager::param().app().openFilters;
+    filters.pop_front(); // replace for better readability
+    filters.push_front(tr("All Images"));
+    mSuffixBox = new QComboBox(this);
+    mSuffixBox->addItems(filters);
+    // suffixBox->setCurrentIndex(DkImageLoader::saveFilters.indexOf(QRegExp(".*tif.*")));
+
+    mControlWidget = new QWidget(this);
+    QGridLayout *controlLayout = new QGridLayout(mControlWidget);
+    controlLayout->addWidget(openLabel, 0, 0);
+    controlLayout->addWidget(openButton, 0, 1, 1, 2);
+    controlLayout->addWidget(mFileLabel, 0, 3, 1, 2);
+    // controlLayout->setColumnStretch(3, 1);
+
+    controlLayout->addWidget(saveLabel, 1, 0);
+    controlLayout->addWidget(dbButton, 1, 1, 1, 2);
+    controlLayout->addWidget(mFolderLabel, 1, 3, 1, 2);
+    // controlLayout->setColumnStretch(3, 1);
+
+    controlLayout->addWidget(sizeLabel, 2, 0);
+    controlLayout->addWidget(mNewWidthBox, 2, 1);
+    controlLayout->addWidget(mNewHeightBox, 2, 2);
+    controlLayout->addWidget(mRealResLabel, 2, 3);
+
+    controlLayout->addWidget(patchLabel, 4, 0);
+    controlLayout->addWidget(mNumPatchesH, 4, 1);
+    controlLayout->addWidget(mNumPatchesV, 4, 2);
+    controlLayout->addWidget(mPatchResLabel, 4, 3);
+
+    controlLayout->addWidget(filterLabel, 5, 0);
+    controlLayout->addWidget(mFilterEdit, 5, 1, 1, 2);
+    controlLayout->addWidget(mSuffixBox, 5, 3, 1, 2);
+    controlLayout->setColumnStretch(5, 1);
+
+    // shows the image if it could be loaded
+    mViewport = new DkBaseViewPort(this);
+    mViewport->setForceFastRendering(true);
+    mViewport->setPanControl(QPointF(0.0f, 0.0f));
+
+    mPreview = new DkBaseViewPort(this);
+    mPreview->setForceFastRendering(true);
+    mPreview->setPanControl(QPointF(0.0f, 0.0f));
+    mPreview->hide();
+
+    QWidget *viewports = new QWidget(this);
+    QHBoxLayout *viewLayout = new QHBoxLayout(viewports);
+    viewLayout->addWidget(mViewport);
+    viewLayout->addWidget(mPreview);
+
+    // mButtons
+    mButtons = new QDialogButtonBox(QDialogButtonBox::Apply | QDialogButtonBox::Save | QDialogButtonBox::Cancel, Qt::Horizontal, this);
+    mButtons->button(QDialogButtonBox::Save)->setText(tr("&Save"));
+    mButtons->button(QDialogButtonBox::Apply)->setText(tr("&Generate"));
+    mButtons->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel"));
+    // connect(mButtons, SIGNAL(accepted()), this, SLOT(accept()));
+    connect(mButtons, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *)));
+    connect(mButtons, SIGNAL(rejected()), this, SLOT(reject()));
+    mButtons->button(QDialogButtonBox::Save)->setEnabled(false);
+
+    QVBoxLayout *layout = new QVBoxLayout(this);
+    layout->addWidget(viewports);
+    layout->addWidget(mProgress);
+    layout->addWidget(mSliderWidget);
+    layout->addWidget(mMsgLabel);
+    layout->addWidget(mControlWidget);
+    layout->addWidget(mButtons);
+
+    enableMosaicSave(false);
+}
+
+void DkMosaicDialog::on_openButton_pressed()
+{
+    // load system default open dialog
+    QString fileName = QFileDialog::getOpenFileName(this,
+                                                    tr("Open TIFF"),
+                                                    mFilePath,
+                                                    DkSettingsManager::param().app().openFilters.join(";;"),
+                                                    nullptr,
+                                                    DkDialog::fileDialogOptions());
+
+    setFile(fileName);
+}
+
+void DkMosaicDialog::on_dbButton_pressed()
+{
+    qDebug() << "save triggered...";
+
+    // load system default open dialog
+    QString dirName =
+        QFileDialog::getExistingDirectory(this, tr("Open an Image Directory"), mSavePath, QFileDialog::ShowDirsOnly | DkDialog::fileDialogOptions());
+
+    if (QFileInfo(dirName).exists()) {
+        mSavePath = dirName;
+        mFolderLabel->setText(mSavePath);
+    }
 }
 
-void DkMosaicDialog::on_newWidthBox_valueChanged(int) {
-
-	if (!mLoader.hasImage())
-		return;
-
-	mNewHeightBox->blockSignals(true);
-	mNewHeightBox->setValue(qRound((float)mNewWidthBox->value()/mLoader.image().width()*mLoader.image().height()));
-	mNewHeightBox->blockSignals(false);
-	mRealResLabel->setText(tr("%1 x %2 cm @150 dpi").arg(mNewWidthBox->value()/150.0*2.54, 0, 'f', 1).arg(mNewHeightBox->value()/150.0*2.54, 0, 'f', 1));
-	updatePatchRes();
+void DkMosaicDialog::on_fileEdit_textChanged(const QString &filename)
+{
+    qDebug() << "new file name: " << filename;
 }
 
-void DkMosaicDialog::on_newHeightBox_valueChanged(int) {
-
-	if (!mLoader.hasImage())
-		return;
+void DkMosaicDialog::on_newWidthBox_valueChanged(int)
+{
+    if (!mLoader.hasImage())
+        return;
 
-	mNewWidthBox->blockSignals(true);
-	mNewWidthBox->setValue(qRound((float)mNewHeightBox->value()/mLoader.image().height()*mLoader.image().width()));
-	mNewWidthBox->blockSignals(false);
-	mRealResLabel->setText(tr("%1 x %2 cm @150 dpi").arg(mNewWidthBox->value()/150.0*2.54, 0, 'f', 1).arg(mNewHeightBox->value()/150.0*2.54, 0, 'f', 1));
-	updatePatchRes();
+    mNewHeightBox->blockSignals(true);
+    mNewHeightBox->setValue(qRound((float)mNewWidthBox->value() / mLoader.image().width() * mLoader.image().height()));
+    mNewHeightBox->blockSignals(false);
+    mRealResLabel->setText(
+        tr("%1 x %2 cm @150 dpi").arg(mNewWidthBox->value() / 150.0 * 2.54, 0, 'f', 1).arg(mNewHeightBox->value() / 150.0 * 2.54, 0, 'f', 1));
+    updatePatchRes();
 }
 
-void DkMosaicDialog::on_numPatchesH_valueChanged(int) {
+void DkMosaicDialog::on_newHeightBox_valueChanged(int)
+{
+    if (!mLoader.hasImage())
+        return;
 
-	if (!mLoader.hasImage())
-		return;
-
-	mNumPatchesV->blockSignals(true);
-	mNumPatchesV->setValue(qFloor((float)mLoader.image().height()/((float)mLoader.image().width()/mNumPatchesH->value())));
-	mNumPatchesV->blockSignals(false);
-	updatePatchRes();
+    mNewWidthBox->blockSignals(true);
+    mNewWidthBox->setValue(qRound((float)mNewHeightBox->value() / mLoader.image().height() * mLoader.image().width()));
+    mNewWidthBox->blockSignals(false);
+    mRealResLabel->setText(
+        tr("%1 x %2 cm @150 dpi").arg(mNewWidthBox->value() / 150.0 * 2.54, 0, 'f', 1).arg(mNewHeightBox->value() / 150.0 * 2.54, 0, 'f', 1));
+    updatePatchRes();
 }
 
-void DkMosaicDialog::on_numPatchesV_valueChanged(int) {
-	
-	if (!mLoader.hasImage())
-		return;
+void DkMosaicDialog::on_numPatchesH_valueChanged(int)
+{
+    if (!mLoader.hasImage())
+        return;
 
-	mNumPatchesH->blockSignals(true);
-	mNumPatchesH->setValue(qFloor((float)mLoader.image().width()/((float)mLoader.image().height()/mNumPatchesV->value())));
-	mNumPatchesH->blockSignals(false);
-	updatePatchRes();
+    mNumPatchesV->blockSignals(true);
+    mNumPatchesV->setValue(qFloor((float)mLoader.image().height() / ((float)mLoader.image().width() / mNumPatchesH->value())));
+    mNumPatchesV->blockSignals(false);
+    updatePatchRes();
 }
 
-void DkMosaicDialog::on_darkenSlider_valueChanged(int) {
-
-	updatePostProcess();
+void DkMosaicDialog::on_numPatchesV_valueChanged(int)
+{
+    if (!mLoader.hasImage())
+        return;
+
+    mNumPatchesH->blockSignals(true);
+    mNumPatchesH->setValue(qFloor((float)mLoader.image().width() / ((float)mLoader.image().height() / mNumPatchesV->value())));
+    mNumPatchesH->blockSignals(false);
+    updatePatchRes();
 }
 
-void DkMosaicDialog::on_lightenSlider_valueChanged(int) {
-
-	updatePostProcess();
+void DkMosaicDialog::on_darkenSlider_valueChanged(int)
+{
+    updatePostProcess();
 }
 
-void DkMosaicDialog::on_saturationSlider_valueChanged(int) {
+void DkMosaicDialog::on_lightenSlider_valueChanged(int)
+{
+    updatePostProcess();
+}
+
+void DkMosaicDialog::on_saturationSlider_valueChanged(int)
+{
+    updatePostProcess();
+}
+
+void DkMosaicDialog::updatePatchRes()
+{
+    int patchResD = qFloor((float)mNewWidthBox->value() / mNumPatchesH->value());
+
+    mPatchResLabel->setText(tr("Patch Resolution: %1 px").arg(patchResD));
+    mPatchResLabel->show();
+
+    // show the user if we can work with the thumbnails or not
+    if (patchResD > 97)
+        mPatchResLabel->setProperty("warning", true);
+    else
+        mPatchResLabel->setProperty("warning", false);
+
+    mPatchResLabel->style()->unpolish(mPatchResLabel);
+    mPatchResLabel->style()->polish(mPatchResLabel);
+    mPatchResLabel->update();
+}
+
+QImage DkMosaicDialog::getImage()
+{
+    if (mMosaic.isNull() && !mMosaicMat.empty())
+        return DkImage::mat2QImage(mMosaicMat);
+
+    return mMosaic;
+}
+
+void DkMosaicDialog::reject()
+{
+    // not sure if this is a nice way to do: but we change cancel behavior while processing
+    if (mProcessing)
+        mProcessing = false;
+    else if (!mMosaic.isNull() && !mButtons->button(QDialogButtonBox::Apply)->isEnabled()) {
+        mButtons->button(QDialogButtonBox::Apply)->setEnabled(true);
+        enableAll(true);
+        mViewport->show();
+        mSliderWidget->hide();
+    } else
+        QDialog::reject();
+}
+
+void DkMosaicDialog::buttonClicked(QAbstractButton *button)
+{
+    if (button == mButtons->button(QDialogButtonBox::Save)) {
+        // render the full image
+        if (!mMosaic.isNull()) {
+            mSliderWidget->hide();
+            mProgress->setValue(mProgress->minimum());
+            mProgress->show();
+            enableAll(false);
+            button->setEnabled(false);
+
+            QFuture<bool> future = QtConcurrent::run(this,
+                                                     &nmc::DkMosaicDialog::postProcessMosaic,
+                                                     mDarkenSlider->value() / 100.0f,
+                                                     mLightenSlider->value() / 100.0f,
+                                                     mSaturationSlider->value() / 100.0f,
+                                                     false);
+            mPostProcessWatcher.setFuture(future);
+        }
+    } else if (button == mButtons->button(QDialogButtonBox::Apply))
+        compute();
+}
+
+void DkMosaicDialog::compute()
+{
+    if (mPostProcessing)
+        return;
+
+    mProgress->setValue(mProgress->minimum());
+    mProgress->show();
+    mMsgLabel->setText("");
+    mMsgLabel->show();
+    mMosaicMatSmall.release();
+    mMosaicMat.release();
+    mOrigImg.release();
+    mMosaic = QImage();
+    mSliderWidget->hide();
+    mViewport->show();
+    mPreview->setForceFastRendering(true);
+    mPreview->show();
+
+    enableAll(false);
+
+    QString suffixTmp = mSuffixBox->currentText();
+    QString suffix;
+
+    for (int idx = 0; idx < DkSettingsManager::param().app().fileFilters.size(); idx++) {
+        if (suffixTmp.contains("(" + DkSettingsManager::param().app().fileFilters.at(idx))) {
+            suffix = DkSettingsManager::param().app().fileFilters.at(idx);
+            break;
+        }
+    }
+
+    QString filter = mFilterEdit->text();
+    mFilesUsed.clear();
 
-	updatePostProcess();
+    mProcessing = true;
+    QFuture<int> future = QtConcurrent::run(this, &nmc::DkMosaicDialog::computeMosaic, filter, suffix, mNewWidthBox->value(), mNumPatchesH->value());
+    mMosaicWatcher.setFuture(future);
+
+    //// debug
+    // computeMosaic(
+    //	cFile,
+    //	filter,
+    //	suffix,
+    //	fromPage->value(),
+    //	toPage->value(),
+    //	overwrite->isChecked());
 }
 
-void DkMosaicDialog::updatePatchRes() {
-
-	int patchResD = qFloor((float)mNewWidthBox->value()/mNumPatchesH->value());
-
-	mPatchResLabel->setText(tr("Patch Resolution: %1 px").arg(patchResD));
-	mPatchResLabel->show();
+void DkMosaicDialog::mosaicFinished()
+{
+    mProgress->hide();
+    // msgLabel->hide();
 
-	// show the user if we can work with the thumbnails or not
-	if (patchResD > 97)
-		mPatchResLabel->setProperty("warning", true);
-	else
-		mPatchResLabel->setProperty("warning", false);
+    if (!mMosaicMat.empty()) {
+        mSliderWidget->show();
+        mMsgLabel->hide();
+        mViewport->hide();
+        mPreview->setForceFastRendering(false);
 
-	mPatchResLabel->style()->unpolish(mPatchResLabel);
-	mPatchResLabel->style()->polish(mPatchResLabel);
-	mPatchResLabel->update();
+        updatePostProcess(); // add values
+        mButtons->button(QDialogButtonBox::Save)->setEnabled(true);
+    } else
+        enableAll(true);
 }
 
-QImage DkMosaicDialog::getImage() {
+int DkMosaicDialog::computeMosaic(const QString &filter, const QString &suffix, int newWidth, int numPatchesH)
+{
+    DkTimer dt;
 
-	if (mMosaic.isNull() && !mMosaicMat.empty())
-		return DkImage::mat2QImage(mMosaicMat);
+    // compute new image size
+    cv::Mat mImg = DkImage::qImage2Mat(mLoader.image());
 
-	return mMosaic;
-}
-
-void DkMosaicDialog::reject() {
+    QSize numPatches = QSize(numPatchesH, 0);
 
-	// not sure if this is a nice way to do: but we change cancel behavior while processing
-	if (mProcessing)
-		mProcessing = false;
-	else if (!mMosaic.isNull() && !mButtons->button(QDialogButtonBox::Apply)->isEnabled()) {
-		mButtons->button(QDialogButtonBox::Apply)->setEnabled(true);
-		enableAll(true);
-		mViewport->show();
-		mSliderWidget->hide();
-	}
-	else
-		QDialog::reject();
+    // compute new image size
+    // float aratio = (float)mImg.rows/mImg.cols;
+    int patchResO = qFloor((float)mImg.cols / numPatches.width());
+    numPatches.setHeight(qFloor((float)mImg.rows / patchResO));
 
-}
+    int patchResD = qFloor(newWidth / numPatches.width());
 
-void DkMosaicDialog::buttonClicked(QAbstractButton* button) {
+    float shR = (mImg.rows - patchResO * numPatches.height()) / 2.0f;
+    float shC = (mImg.cols - patchResO * numPatches.width()) / 2.0f;
 
-	if (button == mButtons->button(QDialogButtonBox::Save)) {
+    mImg = mImg.rowRange(qFloor(shR), mImg.rows - qCeil(shR)).colRange(qFloor(shC), mImg.cols - qCeil(shC));
+    cv::Mat mImgLab;
+    cv::cvtColor(mImg, mImgLab, CV_RGB2Lab);
+    std::vector<cv::Mat> channels;
+    cv::split(mImgLab, channels);
+    cv::Mat imgL = channels[0];
+
+    // keeps track of the weights
+    cv::Mat cc(numPatches.height(), numPatches.width(), CV_32FC1);
+    cc.setTo(0);
+    cv::Mat ccD(numPatches.height(), numPatches.width(), CV_8UC1); // tells us if we have already computed the real patch
+
+    mFilesUsed.resize(numPatches.height() * numPatches.width());
+
+    // destination image
+    cv::Mat dImg(patchResD * numPatches.height(), patchResD * numPatches.width(), CV_8UC1);
+    dImg = 255;
+
+    // patch image (preview)
+    cv::Mat pImg(patchResO * numPatches.height(), patchResO * numPatches.width(), CV_8UC1);
+    pImg = 255;
+
+    qDebug() << "mosaic data --------------------------------";
+    qDebug() << "patchRes: " << patchResD;
+    qDebug() << "new resolution: " << dImg.cols << " x " << dImg.rows;
+    qDebug() << "num patches: " << numPatches.width() << " x " << numPatches.height();
+    qDebug() << "mosaic data --------------------------------";
+
+    // progress bar
+    int pIdx = 0;
+    int maxP = numPatches.width() * numPatches.height();
+
+    int iDidNothing = 0;
+    bool force = false;
+    bool useTwice = false;
+
+    while (iDidNothing < 10000) {
+        if (!mProcessing)
+            return QDialog::Rejected;
+
+        if (iDidNothing > 100) {
+            force = true;
+
+            if (!useTwice)
+                emit infoMessage(tr("Filling empty areas..."));
+        }
+
+        if (iDidNothing > 400 && !useTwice) {
+            emit infoMessage(tr("I need to use some images twice - maybe the database is too small?"));
+            iDidNothing = 0;
+            useTwice = true;
+        } else if (iDidNothing > 400) {
+            emit infoMessage(tr("Sorry, it seems that i cannot create your mosaic with this database."));
+            return QDialog::Rejected;
+        }
+
+        QString imgPath = getRandomImagePath(mSavePath, filter, suffix);
+
+        if (!useTwice && mFilesUsed.contains(QFileInfo(imgPath))) {
+            iDidNothing++;
+            continue;
+        }
+
+        try {
+            DkThumbNail thumb = DkThumbNail(imgPath);
+            thumb.compute();
+
+            cv::Mat ccTmp(cc.size(), cc.depth());
+
+            if (!force)
+                ccTmp.setTo(0);
+            else
+                ccTmp = cc.clone();
+
+            cv::Mat thumbPatch = createPatch(thumb, patchResO);
+
+            if (thumbPatch.rows != patchResO || thumbPatch.cols != patchResO) {
+                iDidNothing++;
+                continue;
+            }
+
+            matchPatch(imgL, thumbPatch, patchResO, ccTmp);
+
+            if (force) {
+                cv::Mat mask = (cc == 0);
+                mask.convertTo(mask, CV_32FC1, 1.0f / 255.0f);
+                ccTmp = ccTmp.mul(mask);
+            }
+
+            double maxVal = 0;
+            cv::Point maxIdx;
+            cv::minMaxLoc(ccTmp, 0, &maxVal, 0, &maxIdx);
+            float *ccPtr = cc.ptr<float>(maxIdx.y);
+
+            if (maxVal > ccPtr[maxIdx.x]) {
+                cv::Mat pPatch =
+                    pImg.rowRange(maxIdx.y * patchResO, maxIdx.y * patchResO + patchResO).colRange(maxIdx.x * patchResO, maxIdx.x * patchResO + patchResO);
+                thumbPatch.copyTo(pPatch);
+
+                // visualize
+                if (pIdx % 10 == 0) {
+                    channels[0] = pImg;
+
+                    // debug
+                    cv::Mat imgT3;
+                    cv::merge(channels, imgT3);
+                    cv::cvtColor(imgT3, imgT3, CV_Lab2BGR);
+                    emit updateImage(DkImage::mat2QImage(imgT3));
+                }
+
+                if (ccPtr[maxIdx.x] == 0) {
+                    pIdx++;
+                    emit updateProgress(qRound((float)pIdx / maxP * 100));
+                }
+
+                // compute it now if we already have the full image loaded
+                if (thumb.getImage().width() > patchResD && thumb.getImage().height() > patchResD) {
+                    thumbPatch = createPatch(thumb, patchResD);
+
+                    cv::Mat dPatch =
+                        dImg.rowRange(maxIdx.y * patchResD, maxIdx.y * patchResD + patchResD).colRange(maxIdx.x * patchResD, maxIdx.x * patchResD + patchResD);
+                    thumbPatch.copyTo(dPatch);
+                    ccD.ptr<unsigned char>(maxIdx.y)[maxIdx.x] = 1;
+                } else
+                    ccD.ptr<unsigned char>(maxIdx.y)[maxIdx.x] = 0;
+
+                // update cc
+                ccPtr[maxIdx.x] = (float)maxVal;
+
+                mFilesUsed[maxIdx.y * numPatchesH + maxIdx.x] = thumb.getFilePath(); // replaces additionally the old file
+                iDidNothing = 0;
+            } else
+                iDidNothing++;
+        }
+        // catch cv exceptions e.g. out of memory
+        catch (...) {
+            iDidNothing++;
+        }
+
+        // are we done yet?
+        double minVal = 0;
+        cv::minMaxLoc(cc, &minVal);
+
+        if (minVal > 0)
+            break;
+    }
 
-		// render the full image
-		if (!mMosaic.isNull()) {
-			mSliderWidget->hide();
-			mProgress->setValue(mProgress->minimum());
-			mProgress->show();
-			enableAll(false);
-			button->setEnabled(false);
-			
-			QFuture<bool> future = QtConcurrent::run(this, 
-				&nmc::DkMosaicDialog::postProcessMosaic,
-				mDarkenSlider->value()/100.0f,
-				mLightenSlider->value()/100.0f, 
-				mSaturationSlider->value()/100.0f,
-				false);
-			mPostProcessWatcher.setFuture(future);
-		}
-	}
-	else if (button == mButtons->button(QDialogButtonBox::Apply))
-		compute();
-}
+    pIdx = 0;
 
-void DkMosaicDialog::compute() {
+    // compute real resolution
+    for (int rIdx = 0; rIdx < ccD.rows; rIdx++) {
+        const unsigned char *ccDPtr = ccD.ptr<unsigned char>(rIdx);
 
-	if (mPostProcessing)
-		return;
+        for (int cIdx = 0; cIdx < ccD.cols; cIdx++) {
+            // is the patch already computed?
+            if (ccDPtr[cIdx])
+                continue;
 
-	mProgress->setValue(mProgress->minimum());
-	mProgress->show();
-	mMsgLabel->setText("");
-	mMsgLabel->show();
-	mMosaicMatSmall.release();
-	mMosaicMat.release();
-	mOrigImg.release();
-	mMosaic = QImage();
-	mSliderWidget->hide();
-	mViewport->show();
-	mPreview->setForceFastRendering(true);
-	mPreview->show();
+            QFileInfo cFile = mFilesUsed.at(rIdx * ccD.cols + cIdx);
 
-	enableAll(false);
+            if (!cFile.exists()) {
+                emit infoMessage(tr("Something is seriously wrong, I could not load: %1").arg(cFile.absoluteFilePath()));
+                continue;
+            }
 
-	QString suffixTmp = mSuffixBox->currentText();
-	QString suffix;
+            cv::Mat thumbPatch = createPatch(DkThumbNail(cFile.absoluteFilePath()), patchResD);
 
-	for (int idx = 0; idx < DkSettingsManager::param().app().fileFilters.size(); idx++) {
-		if (suffixTmp.contains("(" + DkSettingsManager::param().app().fileFilters.at(idx))) {
-			suffix = DkSettingsManager::param().app().fileFilters.at(idx);
-			break;
-		}
-	}
+            cv::Mat dPatch = dImg.rowRange(rIdx * patchResD, rIdx * patchResD + patchResD).colRange(cIdx * patchResD, cIdx * patchResD + patchResD);
+            thumbPatch.copyTo(dPatch);
+            emit updateProgress(qRound((float)pIdx / maxP * 100));
+            pIdx++;
+        }
+    }
 
-	QString filter = mFilterEdit->text();
-	mFilesUsed.clear();
+    qDebug() << "I fully rendered: " << ccD.rows * ccD.cols - cv::sum(ccD)[0] << " images";
 
-	mProcessing = true;
-	QFuture<int> future = QtConcurrent::run(this, 
-		&nmc::DkMosaicDialog::computeMosaic,
-		filter,
-		suffix, 
-		mNewWidthBox->value(), 
-		mNumPatchesH->value());
-	mMosaicWatcher.setFuture(future);
-
-	//// debug
-	//computeMosaic(
-	//	cFile,
-	//	filter,
-	//	suffix,
-	//	fromPage->value(), 
-	//	toPage->value(),
-	//	overwrite->isChecked());
-
-}
-
-void DkMosaicDialog::mosaicFinished() {
-
-	mProgress->hide();
-	//msgLabel->hide();
-	
-	if (!mMosaicMat.empty()) {
-		mSliderWidget->show();
-		mMsgLabel->hide();
-		mViewport->hide();
-		mPreview->setForceFastRendering(false);
-
-		updatePostProcess();	// add values
-		mButtons->button(QDialogButtonBox::Save)->setEnabled(true);
-	}
-	else
-		enableAll(true);
-}
-
-int DkMosaicDialog::computeMosaic(const QString& filter, const QString& suffix, int newWidth, int numPatchesH) {
-
-	DkTimer dt;
-
-	// compute new image size
-	cv::Mat mImg = DkImage::qImage2Mat(mLoader.image());
-
-	QSize numPatches = QSize(numPatchesH, 0);
-
-	// compute new image size
-	//float aratio = (float)mImg.rows/mImg.cols;
-	int patchResO = qFloor((float)mImg.cols/numPatches.width());
-	numPatches.setHeight(qFloor((float)mImg.rows/patchResO));
-
-	int patchResD = qFloor(newWidth/numPatches.width());
-
-	float shR = (mImg.rows-patchResO*numPatches.height())/2.0f;
-	float shC = (mImg.cols-patchResO*numPatches.width())/2.0f;
-
-	mImg = mImg.rowRange(qFloor(shR), mImg.rows-qCeil(shR)).colRange(qFloor(shC), mImg.cols-qCeil(shC));
-	cv::Mat mImgLab;
-	cv::cvtColor(mImg, mImgLab, CV_RGB2Lab);
-	std::vector<cv::Mat> channels;
-	cv::split(mImgLab, channels);
-	cv::Mat imgL = channels[0];
-
-	// keeps track of the weights
-	cv::Mat cc(numPatches.height(), numPatches.width(), CV_32FC1);
-	cc.setTo(0);
-	cv::Mat ccD(numPatches.height(), numPatches.width(), CV_8UC1);	// tells us if we have already computed the real patch
-
-	mFilesUsed.resize(numPatches.height()*numPatches.width());
-
-	// destination image
-	cv::Mat dImg(patchResD*numPatches.height(), patchResD*numPatches.width(), CV_8UC1);
-	dImg = 255;
-
-	// patch image (preview)
-	cv::Mat pImg(patchResO*numPatches.height(), patchResO*numPatches.width(), CV_8UC1);
-	pImg = 255;
-
-	qDebug() << "mosaic data --------------------------------";
-	qDebug() << "patchRes: " << patchResD;
-	qDebug() << "new resolution: " << dImg.cols << " x " << dImg.rows;
-	qDebug() << "num patches: " << numPatches.width() << " x " << numPatches.height();
-	qDebug() << "mosaic data --------------------------------";
-
-	// progress bar
-	int pIdx = 0;
-	int maxP = numPatches.width()*numPatches.height();
-
-	int iDidNothing = 0;
-	bool force = false;
-	bool useTwice = false;
-
-	while (iDidNothing < 10000) {
-
-		if (!mProcessing)
-			return QDialog::Rejected;
-
-		if (iDidNothing > 100) {
-			force = true;
-
-			if (!useTwice)
-				emit infoMessage(tr("Filling empty areas..."));
-		}
-
-		if (iDidNothing > 400 && !useTwice) {
-			emit infoMessage(tr("I need to use some images twice - maybe the database is too small?"));
-			iDidNothing = 0;
-			useTwice = true;
-		}
-		else if (iDidNothing > 400) {
-			emit infoMessage(tr("Sorry, it seems that i cannot create your mosaic with this database."));
-			return QDialog::Rejected;
-		}
-
-		QString imgPath = getRandomImagePath(mSavePath, filter, suffix);
-
-		if (!useTwice && mFilesUsed.contains(QFileInfo(imgPath))) {
-			iDidNothing++;
-			continue;
-		}
-
-		try {
-
-			DkThumbNail thumb = DkThumbNail(imgPath);
-			thumb.compute();
-
-			cv::Mat ccTmp(cc.size(), cc.depth());
-		
-			if (!force)
-				ccTmp.setTo(0);
-			else
-				ccTmp = cc.clone();
-
-			cv::Mat thumbPatch = createPatch(thumb, patchResO);
-		
-			if (thumbPatch.rows != patchResO || thumbPatch.cols != patchResO) {
-				iDidNothing++;
-				continue;
-			}
-		
-			matchPatch(imgL, thumbPatch, patchResO, ccTmp);
-
-			if (force) {
-				cv::Mat mask = (cc == 0);
-				mask.convertTo(mask, CV_32FC1, 1.0f/255.0f);
-				ccTmp = ccTmp.mul(mask);
-			}
-				
-			double maxVal = 0;
-			cv::Point maxIdx;
-			cv::minMaxLoc(ccTmp, 0, &maxVal, 0, &maxIdx);
-			float* ccPtr = cc.ptr<float>(maxIdx.y);
-
-			if (maxVal > ccPtr[maxIdx.x]) {
-
-				cv::Mat pPatch = pImg.rowRange(maxIdx.y*patchResO, maxIdx.y*patchResO+patchResO)
-					.colRange(maxIdx.x*patchResO, maxIdx.x*patchResO+patchResO);
-				thumbPatch.copyTo(pPatch);
-			
-				// visualize
-				if (pIdx % 10 == 0) {
-				
-					channels[0] = pImg;
-				
-					//debug
-					cv::Mat imgT3;
-					cv::merge(channels, imgT3);
-					cv::cvtColor(imgT3, imgT3, CV_Lab2BGR);
-					emit updateImage(DkImage::mat2QImage(imgT3));
-				}
-
-				if (ccPtr[maxIdx.x] == 0) {
-					pIdx++;
-					emit updateProgress(qRound((float)pIdx/maxP*100));
-				}
-
-				// compute it now if we already have the full image loaded
-				if (thumb.getImage().width() > patchResD && thumb.getImage().height() > patchResD) {
-					thumbPatch = createPatch(thumb, patchResD);
-
-					cv::Mat dPatch = dImg.rowRange(maxIdx.y*patchResD, maxIdx.y*patchResD+patchResD)
-						.colRange(maxIdx.x*patchResD, maxIdx.x*patchResD+patchResD);
-					thumbPatch.copyTo(dPatch);
-					ccD.ptr<unsigned char>(maxIdx.y)[maxIdx.x] = 1;
-				}
-				else
-					ccD.ptr<unsigned char>(maxIdx.y)[maxIdx.x] = 0;
-
-				// update cc
-				ccPtr[maxIdx.x] = (float)maxVal;
-
-				mFilesUsed[maxIdx.y*numPatchesH+maxIdx.x] = thumb.getFilePath();	// replaces additionally the old file
-				iDidNothing = 0;
-			}
-			else
-				iDidNothing++;
-		} 
-		// catch cv exceptions e.g. out of memory
-		catch(...) {
-			iDidNothing++;
-		}
-
-		// are we done yet?
-		double minVal = 0;
-		cv::minMaxLoc(cc, &minVal);
-
-		if (minVal > 0)
-			break;
-		
-	}
-
-	pIdx = 0;
-
-	// compute real resolution
-	for (int rIdx = 0; rIdx < ccD.rows; rIdx++) {
-
-		const unsigned char* ccDPtr = ccD.ptr<unsigned char>(rIdx);
-
-		for (int cIdx = 0; cIdx < ccD.cols; cIdx++) {
-
-			// is the patch already computed?
-			if (ccDPtr[cIdx])
-				continue;
-
-			QFileInfo cFile = mFilesUsed.at(rIdx*ccD.cols+cIdx);
-
-			if (!cFile.exists()) {
-				emit infoMessage(tr("Something is seriously wrong, I could not load: %1").arg(cFile.absoluteFilePath()));
-				continue;
-			}
-
-			cv::Mat thumbPatch = createPatch(DkThumbNail(cFile.absoluteFilePath()), patchResD);
-
-			cv::Mat dPatch = dImg.rowRange(rIdx*patchResD, rIdx*patchResD+patchResD)
-				.colRange(cIdx*patchResD, cIdx*patchResD+patchResD);
-			thumbPatch.copyTo(dPatch);
-			emit updateProgress(qRound((float)pIdx/maxP*100));
-			pIdx++;
-		}
-	}
-
-	qDebug() << "I fully rendered: " << ccD.rows*ccD.cols-cv::sum(ccD)[0] << " images";
-
-	// create final images
-	mOrigImg = mImgLab;
-	mMosaicMat = dImg;
-	mMosaicMatSmall = pImg;
-
-	mProcessing = false;
-
-	qDebug() << "mosaic computed in: " << dt;
-
-	return QDialog::Accepted;
-}
-
-void DkMosaicDialog::matchPatch(const cv::Mat& img, const cv::Mat& thumb, int patchRes, cv::Mat& cc) {
-
-	for (int rIdx = 0; rIdx < cc.rows; rIdx++) {
-
-		float* ccPtr = cc.ptr<float>(rIdx);
-		const cv::Mat imgStrip = img.rowRange(rIdx*patchRes, rIdx*patchRes+patchRes);
+    // create final images
+    mOrigImg = mImgLab;
+    mMosaicMat = dImg;
+    mMosaicMatSmall = pImg;
 
-		for (int cIdx = 0; cIdx < cc.cols; cIdx++) {
+    mProcessing = false;
 
-			// already computed?
-			if (ccPtr[cIdx] != 0)
-				continue;
+    qDebug() << "mosaic computed in: " << dt;
 
-			const cv::Mat cPatch = imgStrip.colRange(cIdx*patchRes, cIdx*patchRes+patchRes);
-			
-			cv::Mat absDiff;
-			cv::absdiff(cPatch, thumb, absDiff);
-			ccPtr[cIdx] = 1.0f-((float)cv::sum(absDiff)[0]/(patchRes*patchRes*255));
-		}
-	}
+    return QDialog::Accepted;
 }
 
-cv::Mat DkMosaicDialog::createPatch(const DkThumbNail& thumb, int patchRes) {
-
-	QImage img;
+void DkMosaicDialog::matchPatch(const cv::Mat &img, const cv::Mat &thumb, int patchRes, cv::Mat &cc)
+{
+    for (int rIdx = 0; rIdx < cc.rows; rIdx++) {
+        float *ccPtr = cc.ptr<float>(rIdx);
+        const cv::Mat imgStrip = img.rowRange(rIdx * patchRes, rIdx * patchRes + patchRes);
 
-	// load full image if we have not enough resolution
-	if (thumb.getImage().isNull() || 
-		qMin(thumb.getImage().width(), thumb.getImage().height()) < patchRes) {
-		DkBasicLoader loader;
-		loader.loadGeneral(thumb.getFilePath(), true, true);
-		img = loader.image();
-	}
-	else
-		img = thumb.getImage();
+        for (int cIdx = 0; cIdx < cc.cols; cIdx++) {
+            // already computed?
+            if (ccPtr[cIdx] != 0)
+                continue;
 
-	cv::Mat cvThumb = DkImage::qImage2Mat(img);
-	cv::cvtColor(cvThumb, cvThumb, CV_RGB2Lab);
-	std::vector<cv::Mat> channels;
-	cv::split(cvThumb, channels);
-	cvThumb = channels[0];
-	channels.clear();
+            const cv::Mat cPatch = imgStrip.colRange(cIdx * patchRes, cIdx * patchRes + patchRes);
 
-	// make square
-	if (cvThumb.rows != cvThumb.cols) {
+            cv::Mat absDiff;
+            cv::absdiff(cPatch, thumb, absDiff);
+            ccPtr[cIdx] = 1.0f - ((float)cv::sum(absDiff)[0] / (patchRes * patchRes * 255));
+        }
+    }
+}
 
-		if (cvThumb.rows > cvThumb.cols) {
-			float sh = (cvThumb.rows - cvThumb.cols)/2.0f;
-			cvThumb = cvThumb.rowRange(qFloor(sh), cvThumb.rows-qCeil(sh));
-		}
-		else {
-			float sh = (cvThumb.cols - cvThumb.rows)/2.0f;
-			cvThumb = cvThumb.colRange(qFloor(sh), cvThumb.cols-qCeil(sh));
-		}
-	}
+cv::Mat DkMosaicDialog::createPatch(const DkThumbNail &thumb, int patchRes)
+{
+    QImage img;
+
+    // load full image if we have not enough resolution
+    if (thumb.getImage().isNull() || qMin(thumb.getImage().width(), thumb.getImage().height()) < patchRes) {
+        DkBasicLoader loader;
+        loader.loadGeneral(thumb.getFilePath(), true, true);
+        img = loader.image();
+    } else
+        img = thumb.getImage();
+
+    cv::Mat cvThumb = DkImage::qImage2Mat(img);
+    cv::cvtColor(cvThumb, cvThumb, CV_RGB2Lab);
+    std::vector<cv::Mat> channels;
+    cv::split(cvThumb, channels);
+    cvThumb = channels[0];
+    channels.clear();
+
+    // make square
+    if (cvThumb.rows != cvThumb.cols) {
+        if (cvThumb.rows > cvThumb.cols) {
+            float sh = (cvThumb.rows - cvThumb.cols) / 2.0f;
+            cvThumb = cvThumb.rowRange(qFloor(sh), cvThumb.rows - qCeil(sh));
+        } else {
+            float sh = (cvThumb.cols - cvThumb.rows) / 2.0f;
+            cvThumb = cvThumb.colRange(qFloor(sh), cvThumb.cols - qCeil(sh));
+        }
+    }
 
-	if (cvThumb.rows < patchRes || cvThumb.cols < patchRes)
-		qDebug() << "enlarging thumbs!!";
+    if (cvThumb.rows < patchRes || cvThumb.cols < patchRes)
+        qDebug() << "enlarging thumbs!!";
 
-	cv::resize(cvThumb, cvThumb, cv::Size(patchRes, patchRes), 0.0, 0.0, CV_INTER_AREA);
+    cv::resize(cvThumb, cvThumb, cv::Size(patchRes, patchRes), 0.0, 0.0, CV_INTER_AREA);
 
-	return cvThumb;
+    return cvThumb;
 }
 
-QString DkMosaicDialog::getRandomImagePath(const QString& cPath, const QString& ignore, const QString& suffix) {
-
-	// TODO: remove hierarchy
-	QStringList fileFilters = (suffix.isEmpty()) ? DkSettingsManager::param().app().fileFilters : QStringList(suffix);
+QString DkMosaicDialog::getRandomImagePath(const QString &cPath, const QString &ignore, const QString &suffix)
+{
+    // TODO: remove hierarchy
+    QStringList fileFilters = (suffix.isEmpty()) ? DkSettingsManager::param().app().fileFilters : QStringList(suffix);
 
-	// get all dirs
-	QFileInfoList entries = QDir(cPath).entryInfoList(QStringList(), QDir::AllDirs | QDir::NoDotAndDotDot);
-	//qDebug() << entries;
-	// get all files
-	entries += QDir(cPath).entryInfoList(fileFilters);
-	//qDebug() << "current entries: " << e;
+    // get all dirs
+    QFileInfoList entries = QDir(cPath).entryInfoList(QStringList(), QDir::AllDirs | QDir::NoDotAndDotDot);
+    // qDebug() << entries;
+    //  get all files
+    entries += QDir(cPath).entryInfoList(fileFilters);
+    // qDebug() << "current entries: " << e;
 
-	if (!ignore.isEmpty()) {
+    if (!ignore.isEmpty()) {
+        QStringList ignoreList = ignore.split(";");
+        QFileInfoList entriesTmp = entries;
+        entries.clear();
 
-		QStringList ignoreList = ignore.split(";");
-		QFileInfoList entriesTmp = entries;
-		entries.clear();
+        for (int idx = 0; idx < entriesTmp.size(); idx++) {
+            bool lIgnore = false;
+            QString p = entriesTmp.at(idx).absoluteFilePath();
 
-		for (int idx = 0; idx < entriesTmp.size(); idx++) {
-			
-			bool lIgnore = false;
-			QString p = entriesTmp.at(idx).absoluteFilePath();
+            for (int iIdx = 0; iIdx < ignoreList.size(); iIdx++) {
+                if (p.contains(ignoreList.at(iIdx))) {
+                    lIgnore = true;
+                    break;
+                }
+            }
 
-			for (int iIdx = 0; iIdx < ignoreList.size(); iIdx++) {
-				if (p.contains(ignoreList.at(iIdx))) {
-					lIgnore = true;
-					break;
-				}
-			}
-
-			if (!lIgnore)
-				entries.append(entriesTmp.at(idx));
-		}
-	}
-		
+            if (!lIgnore)
+                entries.append(entriesTmp.at(idx));
+        }
+    }
 
-	if (entries.isEmpty())
-		return QString();
+    if (entries.isEmpty())
+        return QString();
 
-	int rIdx = qRound((float)qrand()/RAND_MAX*(entries.size()-1));
+    int rIdx = qRound(QRandomGenerator::global()->generateDouble() * (entries.size() - 1));
 
-	//qDebug() << "rand index: " << rIdx;
+    // qDebug() << "rand index: " << rIdx;
 
-	QFileInfo rPath = entries.at(rIdx);
-	//qDebug() << rPath.absoluteFilePath();
+    QFileInfo rPath = entries.at(rIdx);
+    // qDebug() << rPath.absoluteFilePath();
 
-	if (rPath.isDir())
-		return getRandomImagePath(rPath.absoluteFilePath(), ignore, suffix);
-	else
-		return rPath.absoluteFilePath();
+    if (rPath.isDir())
+        return getRandomImagePath(rPath.absoluteFilePath(), ignore, suffix);
+    else
+        return rPath.absoluteFilePath();
 }
 
-void DkMosaicDialog::updatePostProcess() {
-	
-	if (mMosaicMat.empty() || mProcessing)
-		return;
-
-	if (mPostProcessing) {
-		mUpdatePostProcessing = true;
-		return;
-	}
-
-	mButtons->button(QDialogButtonBox::Apply)->setEnabled(false);
-	mButtons->button(QDialogButtonBox::Save)->setEnabled(false);
-
-	QFuture<bool> future = QtConcurrent::run(this, 
-		&nmc::DkMosaicDialog::postProcessMosaic,
-		mDarkenSlider->value()/100.0f,
-		mLightenSlider->value()/100.0f, 
-		mSaturationSlider->value()/100.0f,
-		true);
-	mPostProcessWatcher.setFuture(future);
-
-	mUpdatePostProcessing = false;
-	//postProcessMosaic(darkenSlider->value()/100.0f, lightenSlider->value()/100.0f, saturationSlider->value()/100.0f);
-}
+void DkMosaicDialog::updatePostProcess()
+{
+    if (mMosaicMat.empty() || mProcessing)
+        return;
 
-void DkMosaicDialog::postProcessFinished() {
+    if (mPostProcessing) {
+        mUpdatePostProcessing = true;
+        return;
+    }
 
-	if (mPostProcessWatcher.result()) {
-		QDialog::accept();
-	}
-	else if (mUpdatePostProcessing)
-		updatePostProcess();
-	else {
-		mButtons->button(QDialogButtonBox::Save)->setEnabled(true);
-	}
+    mButtons->button(QDialogButtonBox::Apply)->setEnabled(false);
+    mButtons->button(QDialogButtonBox::Save)->setEnabled(false);
+
+    QFuture<bool> future = QtConcurrent::run(this,
+                                             &nmc::DkMosaicDialog::postProcessMosaic,
+                                             mDarkenSlider->value() / 100.0f,
+                                             mLightenSlider->value() / 100.0f,
+                                             mSaturationSlider->value() / 100.0f,
+                                             true);
+    mPostProcessWatcher.setFuture(future);
+
+    mUpdatePostProcessing = false;
+    // postProcessMosaic(darkenSlider->value()/100.0f, lightenSlider->value()/100.0f, saturationSlider->value()/100.0f);
+}
+
+void DkMosaicDialog::postProcessFinished()
+{
+    if (mPostProcessWatcher.result()) {
+        QDialog::accept();
+    } else if (mUpdatePostProcessing)
+        updatePostProcess();
+    else {
+        mButtons->button(QDialogButtonBox::Save)->setEnabled(true);
+    }
 }
 
-bool DkMosaicDialog::postProcessMosaic(float multiply /* = 0.3 */, float screen /* = 0.5 */, float saturation, bool computePreview) {
-
-	mPostProcessing = true;
+bool DkMosaicDialog::postProcessMosaic(float multiply /* = 0.3 */, float screen /* = 0.5 */, float saturation, bool computePreview)
+{
+    mPostProcessing = true;
 
-	qDebug() << "darken: " << multiply << " lighten: " << screen;
+    qDebug() << "darken: " << multiply << " lighten: " << screen;
 
-	cv::Mat origR;
-	cv::Mat mosaicR;
+    cv::Mat origR;
+    cv::Mat mosaicR;
 
-	try {
-		if (computePreview) {
-			origR = mOrigImg.clone();
-			mosaicR = mMosaicMatSmall.clone();
-		}
-		else {
-			cv::resize(mOrigImg, origR, mMosaicMat.size(), 0, 0, CV_INTER_LANCZOS4);
-			mosaicR = mMosaicMat;
-			mOrigImg.release();
-		}
+    try {
+        if (computePreview) {
+            origR = mOrigImg.clone();
+            mosaicR = mMosaicMatSmall.clone();
+        } else {
+            cv::resize(mOrigImg, origR, mMosaicMat.size(), 0, 0, CV_INTER_LANCZOS4);
+            mosaicR = mMosaicMat;
+            mOrigImg.release();
+        }
 
-		// multiply the two images
-		for (int rIdx = 0; rIdx < origR.rows; rIdx++) {
+        // multiply the two images
+        for (int rIdx = 0; rIdx < origR.rows; rIdx++) {
+            const unsigned char *mosaicPtr = mosaicR.ptr<unsigned char>(rIdx);
+            unsigned char *origPtr = origR.ptr<unsigned char>(rIdx);
 
-			const unsigned char* mosaicPtr = mosaicR.ptr<unsigned char>(rIdx);
-			unsigned char* origPtr = origR.ptr<unsigned char>(rIdx);
+            if (!computePreview)
+                emit updateProgress(qRound((float)rIdx / origR.rows * 100));
 
-			if (!computePreview)
-				emit updateProgress(qRound((float)rIdx/origR.rows*100));
+            for (int cIdx = 0; cIdx < origR.cols; cIdx++) {
+                // mix the luminance channel
+                float mosaic = mosaicPtr[cIdx] / 255.0f;
+                float luminance = (*origPtr) / 255.0f;
 
-			for (int cIdx = 0; cIdx < origR.cols; cIdx++) {
+                float lighten = (1.0f - luminance) * screen + (1.0f - screen);
+                lighten *= 1.0f - mosaic; // multiply inverse
+                lighten = 1.0f - lighten;
 
-				// mix the luminance channel
-				float mosaic = mosaicPtr[cIdx]/255.0f;
-				float luminance = (*origPtr)/255.0f;
+                float darken = luminance * multiply + (1.0f - multiply);
+                darken *= lighten; // mix with the mosaic pixel
 
-			
-				float lighten = (1.0f-luminance)*screen + (1.0f-screen);
-				lighten *= 1.0f-mosaic;	// multiply inverse
-				lighten = 1.0f-lighten;
+                // now stretch to the dynamic range and save it
+                *origPtr = (unsigned char)qRound(darken * 255.0f);
 
-				float darken = luminance*multiply + (1.0f-multiply);
-				darken *= lighten;	// mix with the mosaic pixel
+                // now adopt the saturation
+                origPtr++;
+                *origPtr = (unsigned char)qRound((*origPtr - 128) * saturation) + 128;
+                origPtr++;
+                *origPtr = (unsigned char)qRound((*origPtr - 128) * saturation) + 128;
+                origPtr++;
+            }
+        }
 
-				// now stretch to the dynamic range and save it
-				*origPtr = (unsigned char)qRound(darken*255.0f);
+        // if (!computePreview)
+        //	mosaicMat.release();
+        cv::cvtColor(origR, origR, CV_Lab2BGR);
+        qDebug() << "color converted";
 
-				// now adopt the saturation
-				origPtr++;
-				*origPtr = (unsigned char)qRound((*origPtr-128) * saturation)+128;
-				origPtr++;
-				*origPtr = (unsigned char)qRound((*origPtr-128) * saturation)+128;
-				origPtr++;
-			}
-		}
+        mMosaic = DkImage::mat2QImage(origR);
+        qDebug() << "mosaicing computed...";
 
-		//if (!computePreview)
-		//	mosaicMat.release();
-		cv::cvtColor(origR, origR, CV_Lab2BGR);
-		qDebug() << "color converted";
+    } catch (...) {
+        origR.release();
 
-		mMosaic = DkImage::mat2QImage(origR);
-		qDebug() << "mosaicing computed...";
-
-	}
-	catch(...) {
-		origR.release();
-
-		QMessageBox::critical(DkUtils::getMainWindow(), tr("Error"), tr("Sorry, I could not mix the image..."));
-		qDebug() << "exception caught...";
-		mMosaic = DkImage::mat2QImage(mMosaicMat);
-	}
-	
-	if (computePreview)
-		mPreview->setImage(mMosaic);
+        QMessageBox::critical(DkUtils::getMainWindow(), tr("Error"), tr("Sorry, I could not mix the image..."));
+        qDebug() << "exception caught...";
+        mMosaic = DkImage::mat2QImage(mMosaicMat);
+    }
 
-	mPostProcessing = false;
+    if (computePreview)
+        mPreview->setImage(mMosaic);
 
-	return !computePreview;
+    mPostProcessing = false;
 
+    return !computePreview;
 }
 
-void DkMosaicDialog::setFile(const QString& filePath) {
-
-	QFileInfo fInfo(filePath);
-	if (!fInfo.exists())
-		return;
+void DkMosaicDialog::setFile(const QString &filePath)
+{
+    QFileInfo fInfo(filePath);
+    if (!fInfo.exists())
+        return;
 
-	mFilePath = filePath;
-	mSavePath = fInfo.absolutePath();
-	mFolderLabel->setText(mSavePath);
-	mFileLabel->setText(filePath);
+    mFilePath = filePath;
+    mSavePath = fInfo.absolutePath();
+    mFolderLabel->setText(mSavePath);
+    mFileLabel->setText(filePath);
 
-	mLoader.loadGeneral(filePath, true);
-	mViewport->setImage(mLoader.image());
+    mLoader.loadGeneral(filePath, true);
+    mViewport->setImage(mLoader.image());
 
-	enableMosaicSave(mLoader.hasImage());
+    enableMosaicSave(mLoader.hasImage());
 
-	//newWidthBox->blockSignals(true);
-	//newHeightBox->blockSignals(true);
-	mNewWidthBox->setValue(mLoader.image().width());
-	mNumPatchesH->setValue(qFloor((float)mLoader.image().width()/90));	// 130 is a pretty good patch resolution
-	mNumPatchesH->setMaximum(qMin(1000, qFloor(mLoader.image().width()*0.5f)));
-	mNumPatchesV->setMaximum(qMin(1000, qFloor(mLoader.image().height()*0.5f)));
-	//newHeightBox->setValue(loader.image().height());
-	//newWidthBox->blockSignals(false);
-	//newHeightBox->blockSignals(false);
+    // newWidthBox->blockSignals(true);
+    // newHeightBox->blockSignals(true);
+    mNewWidthBox->setValue(mLoader.image().width());
+    mNumPatchesH->setValue(qFloor((float)mLoader.image().width() / 90)); // 130 is a pretty good patch resolution
+    mNumPatchesH->setMaximum(qMin(1000, qFloor(mLoader.image().width() * 0.5f)));
+    mNumPatchesV->setMaximum(qMin(1000, qFloor(mLoader.image().height() * 0.5f)));
+    // newHeightBox->setValue(loader.image().height());
+    // newWidthBox->blockSignals(false);
+    // newHeightBox->blockSignals(false);
 
-	//fromPage->setRange(1, loader.getNumPages());
-	//toPage->setRange(1, loader.getNumPages());
+    // fromPage->setRange(1, loader.getNumPages());
+    // toPage->setRange(1, loader.getNumPages());
 
-	//fromPage->setValue(1);
-	//toPage->setValue(loader.getNumPages());
+    // fromPage->setValue(1);
+    // toPage->setValue(loader.getNumPages());
 }
 
-void DkMosaicDialog::enableAll(bool enable) {
-
-	enableMosaicSave(enable);
-	mControlWidget->setEnabled(enable);
+void DkMosaicDialog::enableAll(bool enable)
+{
+    enableMosaicSave(enable);
+    mControlWidget->setEnabled(enable);
 }
 
-void DkMosaicDialog::enableMosaicSave(bool enable) {
-
-	mFilterEdit->setEnabled(enable);
-	mSuffixBox->setEnabled(enable);
-	mNewWidthBox->setEnabled(enable);
-	mNewHeightBox->setEnabled(enable);
-	mNumPatchesH->setEnabled(enable);
-	mNumPatchesV->setEnabled(enable);
-	mButtons->button(QDialogButtonBox::Apply)->setEnabled(enable);
+void DkMosaicDialog::enableMosaicSave(bool enable)
+{
+    mFilterEdit->setEnabled(enable);
+    mSuffixBox->setEnabled(enable);
+    mNewWidthBox->setEnabled(enable);
+    mNewHeightBox->setEnabled(enable);
+    mNumPatchesH->setEnabled(enable);
+    mNumPatchesV->setEnabled(enable);
+    mButtons->button(QDialogButtonBox::Apply)->setEnabled(enable);
 
-	if (!enable)
-		mButtons->button(QDialogButtonBox::Save)->setEnabled(enable);
+    if (!enable)
+        mButtons->button(QDialogButtonBox::Save)->setEnabled(enable);
 }
 #endif
 // DkForceThumbDialog --------------------------------------------------------------------
-DkForceThumbDialog::DkForceThumbDialog(QWidget* parent /* = 0 */, Qt::WindowFlags f /* = 0 */) : QDialog(parent, f) {
-
-	createLayout();
+DkForceThumbDialog::DkForceThumbDialog(QWidget *parent /* = 0 */, Qt::WindowFlags f /* = 0 */)
+    : QDialog(parent, f)
+{
+    createLayout();
 }
 
-void DkForceThumbDialog::createLayout() {
-
-	QVBoxLayout* layout = new QVBoxLayout(this);
+void DkForceThumbDialog::createLayout()
+{
+    QVBoxLayout *layout = new QVBoxLayout(this);
 
-	infoLabel = new QLabel();
-	infoLabel->setAlignment(Qt::AlignHCenter);
+    infoLabel = new QLabel();
+    infoLabel->setAlignment(Qt::AlignHCenter);
 
-	cbForceSave = new QCheckBox(tr("Overwrite Existing Thumbnails"));
-	cbForceSave->setToolTip("If checked, existing thumbnails will be replaced");
+    cbForceSave = new QCheckBox(tr("Overwrite Existing Thumbnails"));
+    cbForceSave->setToolTip("If checked, existing thumbnails will be replaced");
 
-	// mButtons
-	QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
-	buttons->button(QDialogButtonBox::Ok)->setText(tr("&OK"));
-	buttons->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel"));
-	connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
-	connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
-
-	layout->addWidget(infoLabel);
-	layout->addWidget(cbForceSave);
-	layout->addWidget(buttons);
+    // mButtons
+    QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
+    buttons->button(QDialogButtonBox::Ok)->setText(tr("&OK"));
+    buttons->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel"));
+    connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
+    connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
 
+    layout->addWidget(infoLabel);
+    layout->addWidget(cbForceSave);
+    layout->addWidget(buttons);
 }
 
-bool DkForceThumbDialog::forceSave() const {
-
-	return cbForceSave->isChecked();
+bool DkForceThumbDialog::forceSave() const
+{
+    return cbForceSave->isChecked();
 }
 
-void DkForceThumbDialog::setDir(const QDir& fileInfo) {
-
-	infoLabel->setText(tr("Compute thumbnails for all images in:\n %1\n").arg(fileInfo.absolutePath()));
+void DkForceThumbDialog::setDir(const QDir &fileInfo)
+{
+    infoLabel->setText(tr("Compute thumbnails for all images in:\n %1\n").arg(fileInfo.absolutePath()));
 }
 
 // Welcome dialog --------------------------------------------------------------------
-DkWelcomeDialog::DkWelcomeDialog(QWidget* parent, Qt::WindowFlags f) : QDialog(parent, f) {
-
-	setWindowTitle(tr("Welcome"));
-	createLayout();
-	mLanguageChanged = false;
+DkWelcomeDialog::DkWelcomeDialog(QWidget *parent, Qt::WindowFlags f)
+    : QDialog(parent, f)
+{
+    setWindowTitle(tr("Welcome"));
+    createLayout();
+    mLanguageChanged = false;
 }
 
-void DkWelcomeDialog::createLayout() {
+void DkWelcomeDialog::createLayout()
+{
+    QGridLayout *layout = new QGridLayout(this);
 
-	QGridLayout* layout = new QGridLayout(this);
+    QLabel *welcomeLabel = new QLabel(tr("Welcome to nomacs, please choose your preferred language below."), this);
 
-	QLabel* welcomeLabel = new QLabel(tr("Welcome to nomacs, please choose your preferred language below."), this);
+    mLanguageCombo = new QComboBox(this);
+    DkUtils::addLanguages(mLanguageCombo, mLanguages);
 
-	mLanguageCombo = new QComboBox(this);
-	DkUtils::addLanguages(mLanguageCombo, mLanguages);
+    mRegisterFilesCheckBox = new QCheckBox(tr("&Register File Associations"), this);
+    mRegisterFilesCheckBox->setChecked(!DkSettingsManager::param().isPortable());
 
-	mRegisterFilesCheckBox = new QCheckBox(tr("&Register File Associations"), this);
-	mRegisterFilesCheckBox->setChecked(!DkSettingsManager::param().isPortable());
+    mSetAsDefaultCheckBox = new QCheckBox(tr("Set As &Default Viewer"), this);
+    mSetAsDefaultCheckBox->setChecked(!DkSettingsManager::param().isPortable());
 
-	mSetAsDefaultCheckBox = new QCheckBox(tr("Set As &Default Viewer"), this);
-	mSetAsDefaultCheckBox->setChecked(!DkSettingsManager::param().isPortable());
+    // mButtons
+    QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
+    buttons->button(QDialogButtonBox::Ok)->setText(tr("&OK"));
+    buttons->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel"));
+    connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
+    connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
 
-	// mButtons
-	QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
-	buttons->button(QDialogButtonBox::Ok)->setText(tr("&OK"));
-	buttons->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel"));
-	connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
-	connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
-	
-	layout->addItem(new QSpacerItem(10, 10), 0, 0, -1, -1);
-	layout->addWidget(welcomeLabel, 1, 0, 1, 3);
-	layout->addItem(new QSpacerItem(10, 10), 2, 0, -1, -1);
-	layout->addWidget(mLanguageCombo, 3, 1);
+    layout->addItem(new QSpacerItem(10, 10), 0, 0, -1, -1);
+    layout->addWidget(welcomeLabel, 1, 0, 1, 3);
+    layout->addItem(new QSpacerItem(10, 10), 2, 0, -1, -1);
+    layout->addWidget(mLanguageCombo, 3, 1);
 
 #ifdef Q_OS_WIN
-	layout->addWidget(mRegisterFilesCheckBox, 4, 1);
-	layout->addWidget(mSetAsDefaultCheckBox, 5, 1);
+    layout->addWidget(mRegisterFilesCheckBox, 4, 1);
+    layout->addWidget(mSetAsDefaultCheckBox, 5, 1);
 #else
-	mRegisterFilesCheckBox->setChecked(false);
-	mRegisterFilesCheckBox->hide();
-	mSetAsDefaultCheckBox->setChecked(false);
-	mSetAsDefaultCheckBox->hide();
+    mRegisterFilesCheckBox->setChecked(false);
+    mRegisterFilesCheckBox->hide();
+    mSetAsDefaultCheckBox->setChecked(false);
+    mSetAsDefaultCheckBox->hide();
 #endif
-	
-	layout->addWidget(buttons, 6, 0, 1, 3);
-}
 
-void DkWelcomeDialog::accept() {
+    layout->addWidget(buttons, 6, 0, 1, 3);
+}
 
-	DkFileFilterHandling fh;
+void DkWelcomeDialog::accept()
+{
+    DkFileFilterHandling fh;
 
-	if (mRegisterFilesCheckBox->isChecked())
-		DkFileFilterHandling::registerFileAssociations();
-	fh.registerNomacs(mSetAsDefaultCheckBox->isChecked());	// register nomacs again - to be save
+    if (mRegisterFilesCheckBox->isChecked())
+        DkFileFilterHandling::registerFileAssociations();
+    fh.registerNomacs(mSetAsDefaultCheckBox->isChecked()); // register nomacs again - to be save
 
-	// change language
-	if (mLanguageCombo->currentIndex() != mLanguages.indexOf(DkSettingsManager::param().global().language) && mLanguageCombo->currentIndex() >= 0) {
-		DkSettingsManager::param().global().language = mLanguages.at(mLanguageCombo->currentIndex());
-		mLanguageChanged = true;
-	}
+    // change language
+    if (mLanguageCombo->currentIndex() != mLanguages.indexOf(DkSettingsManager::param().global().language) && mLanguageCombo->currentIndex() >= 0) {
+        DkSettingsManager::param().global().language = mLanguages.at(mLanguageCombo->currentIndex());
+        mLanguageChanged = true;
+    }
 
-	QDialog::accept();
+    QDialog::accept();
 }
 
-bool DkWelcomeDialog::isLanguageChanged() {
-
-	return mLanguageChanged;
+bool DkWelcomeDialog::isLanguageChanged()
+{
+    return mLanguageChanged;
 }
 
-
 // archive extraction dialog --------------------------------------------------------------------
 #ifdef WITH_QUAZIP
-DkArchiveExtractionDialog::DkArchiveExtractionDialog(QWidget* parent, Qt::WindowFlags flags) : QDialog(parent, flags) {
-	
-	mFileList = QStringList();
-	setWindowTitle(tr("Extract images from an archive"));
-	createLayout();
-	setMinimumSize(340, 400);
-	setAcceptDrops(true);
-}
-
-void DkArchiveExtractionDialog::createLayout() {
-
-	// archive file path
-	QLabel* archiveLabel = new QLabel(tr("Archive (%1)").arg(DkSettingsManager::param().app().containerRawFilters.replace(" *", ", *")), this);
-	mArchivePathEdit = new QLineEdit(this);
-	mArchivePathEdit->setObjectName("DkWarningEdit");
-	mArchivePathEdit->setValidator(&mFileValidator);
-	connect(mArchivePathEdit, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
-	connect(mArchivePathEdit, SIGNAL(editingFinished()), this, SLOT(loadArchive()));
-
-	QPushButton* openArchiveButton = new QPushButton(tr("&Browse"));
-	connect(openArchiveButton, SIGNAL(pressed()), this, SLOT(openArchive()));
-
-	// dir file path
-	QLabel* dirLabel = new QLabel(tr("Extract to"));
-	mDirPathEdit = new QLineEdit();
-	mDirPathEdit->setValidator(&mFileValidator);
-	connect(mDirPathEdit, SIGNAL(textChanged(const QString&)), this, SLOT(dirTextChanged(const QString&)));
-
-	QPushButton* openDirButton = new QPushButton(tr("&Browse"));
-	connect(openDirButton, SIGNAL(pressed()), this, SLOT(openDir()));
-
-	mFeedbackLabel = new QLabel("", this);
-	mFeedbackLabel->setObjectName("DkDecentInfo");
-
-	mFileListDisplay = new QListWidget(this);
-
-	mRemoveSubfolders = new QCheckBox(tr("Remove Subfolders"), this);
-	mRemoveSubfolders->setChecked(false);
-	connect(mRemoveSubfolders, SIGNAL(stateChanged(int)), this, SLOT(checkbocChecked(int)));
-
-	// mButtons
-	mButtons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
-	mButtons->button(QDialogButtonBox::Ok)->setText(tr("&Extract"));
-	mButtons->button(QDialogButtonBox::Ok)->setEnabled(false);
-	mButtons->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel"));
-	connect(mButtons, SIGNAL(accepted()), this, SLOT(accept()));
-	connect(mButtons, SIGNAL(rejected()), this, SLOT(reject()));
-
-	QWidget* extractWidget = new QWidget(this);
-	QGridLayout* gdLayout = new QGridLayout(extractWidget);
-	gdLayout->addWidget(archiveLabel, 0, 0);
-	gdLayout->addWidget(mArchivePathEdit, 1, 0);
-	gdLayout->addWidget(openArchiveButton, 1, 1);
-	gdLayout->addWidget(dirLabel, 2, 0);
-	gdLayout->addWidget(mDirPathEdit, 3, 0);
-	gdLayout->addWidget(openDirButton, 3, 1);
-	gdLayout->addWidget(mFeedbackLabel, 4, 0, 1, 2);
-	gdLayout->addWidget(mFileListDisplay, 5, 0, 1, 2);
-	gdLayout->addWidget(mRemoveSubfolders, 6, 0, 1, 2);
-
-	QVBoxLayout* layout = new QVBoxLayout(this);
-	layout->addWidget(extractWidget);
-	layout->addWidget(mButtons);
-}
-
-void DkArchiveExtractionDialog::setCurrentFile(const QString& filePath, bool isZip) {
-
-	userFeedback("", false);
-	mArchivePathEdit->setText("");
-	mDirPathEdit->setText("");
-	mFileListDisplay->clear();
-	mRemoveSubfolders->setChecked(false);
-
-	mFilePath = filePath;
-	if (isZip) {
-		mArchivePathEdit->setText(mFilePath);
-		loadArchive();
-	}
+DkArchiveExtractionDialog::DkArchiveExtractionDialog(QWidget *parent, Qt::WindowFlags flags)
+    : QDialog(parent, flags)
+{
+    mFileList = QStringList();
+    setWindowTitle(tr("Extract images from an archive"));
+    createLayout();
+    setMinimumSize(340, 400);
+    setAcceptDrops(true);
+}
+
+void DkArchiveExtractionDialog::createLayout()
+{
+    // archive file path
+    QLabel *archiveLabel = new QLabel(tr("Archive (%1)").arg(DkSettingsManager::param().app().containerRawFilters.replace(" *", ", *")), this);
+    mArchivePathEdit = new QLineEdit(this);
+    mArchivePathEdit->setObjectName("DkWarningEdit");
+    mArchivePathEdit->setValidator(&mFileValidator);
+    connect(mArchivePathEdit, SIGNAL(textChanged(const QString &)), this, SLOT(textChanged(const QString &)));
+    connect(mArchivePathEdit, SIGNAL(editingFinished()), this, SLOT(loadArchive()));
+
+    QPushButton *openArchiveButton = new QPushButton(tr("&Browse"));
+    connect(openArchiveButton, SIGNAL(pressed()), this, SLOT(openArchive()));
+
+    // dir file path
+    QLabel *dirLabel = new QLabel(tr("Extract to"));
+    mDirPathEdit = new QLineEdit();
+    mDirPathEdit->setValidator(&mFileValidator);
+    connect(mDirPathEdit, SIGNAL(textChanged(const QString &)), this, SLOT(dirTextChanged(const QString &)));
+
+    QPushButton *openDirButton = new QPushButton(tr("&Browse"));
+    connect(openDirButton, SIGNAL(pressed()), this, SLOT(openDir()));
+
+    mFeedbackLabel = new QLabel("", this);
+    mFeedbackLabel->setObjectName("DkDecentInfo");
+
+    mFileListDisplay = new QListWidget(this);
+
+    mRemoveSubfolders = new QCheckBox(tr("Remove Subfolders"), this);
+    mRemoveSubfolders->setChecked(false);
+    connect(mRemoveSubfolders, SIGNAL(stateChanged(int)), this, SLOT(checkbocChecked(int)));
+
+    // mButtons
+    mButtons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
+    mButtons->button(QDialogButtonBox::Ok)->setText(tr("&Extract"));
+    mButtons->button(QDialogButtonBox::Ok)->setEnabled(false);
+    mButtons->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel"));
+    connect(mButtons, SIGNAL(accepted()), this, SLOT(accept()));
+    connect(mButtons, SIGNAL(rejected()), this, SLOT(reject()));
+
+    QWidget *extractWidget = new QWidget(this);
+    QGridLayout *gdLayout = new QGridLayout(extractWidget);
+    gdLayout->addWidget(archiveLabel, 0, 0);
+    gdLayout->addWidget(mArchivePathEdit, 1, 0);
+    gdLayout->addWidget(openArchiveButton, 1, 1);
+    gdLayout->addWidget(dirLabel, 2, 0);
+    gdLayout->addWidget(mDirPathEdit, 3, 0);
+    gdLayout->addWidget(openDirButton, 3, 1);
+    gdLayout->addWidget(mFeedbackLabel, 4, 0, 1, 2);
+    gdLayout->addWidget(mFileListDisplay, 5, 0, 1, 2);
+    gdLayout->addWidget(mRemoveSubfolders, 6, 0, 1, 2);
+
+    QVBoxLayout *layout = new QVBoxLayout(this);
+    layout->addWidget(extractWidget);
+    layout->addWidget(mButtons);
+}
+
+void DkArchiveExtractionDialog::setCurrentFile(const QString &filePath, bool isZip)
+{
+    userFeedback("", false);
+    mArchivePathEdit->setText("");
+    mDirPathEdit->setText("");
+    mFileListDisplay->clear();
+    mRemoveSubfolders->setChecked(false);
+
+    mFilePath = filePath;
+    if (isZip) {
+        mArchivePathEdit->setText(mFilePath);
+        loadArchive();
+    }
 }
 
-void DkArchiveExtractionDialog::textChanged(const QString& text) {
-	
-	bool oldStyle = mArchivePathEdit->property("error").toBool();
-	bool newStyle = false;
-
-	if (QFileInfo(text).exists() && DkBasicLoader::isContainer(text)) {
-		newStyle = false;
-		mArchivePathEdit->setProperty("error", newStyle);
-		loadArchive(text);
-	}
-	else {
-		newStyle = true;
-		mArchivePathEdit->setProperty("error", newStyle);
-		userFeedback("", false);	
-		mFileListDisplay->clear();
-		mButtons->button(QDialogButtonBox::Ok)->setEnabled(false);
-	}
-
-	if (oldStyle != newStyle) {
-		mArchivePathEdit->style()->unpolish(mArchivePathEdit);
-		mArchivePathEdit->style()->polish(mArchivePathEdit);
-		mArchivePathEdit->update();
-	}
-
-}
+void DkArchiveExtractionDialog::textChanged(const QString &text)
+{
+    bool oldStyle = mArchivePathEdit->property("error").toBool();
+    bool newStyle = false;
+
+    if (QFileInfo(text).exists() && DkBasicLoader::isContainer(text)) {
+        newStyle = false;
+        mArchivePathEdit->setProperty("error", newStyle);
+        loadArchive(text);
+    } else {
+        newStyle = true;
+        mArchivePathEdit->setProperty("error", newStyle);
+        userFeedback("", false);
+        mFileListDisplay->clear();
+        mButtons->button(QDialogButtonBox::Ok)->setEnabled(false);
+    }
 
-void DkArchiveExtractionDialog::dirTextChanged(const QString& text) {
-	
-	if (text.isEmpty()) {
-		userFeedback("", false);
-		mButtons->button(QDialogButtonBox::Ok)->setEnabled(false);
-	}
-}
-
-void DkArchiveExtractionDialog::checkbocChecked(int) {
-
-	loadArchive();
+    if (oldStyle != newStyle) {
+        mArchivePathEdit->style()->unpolish(mArchivePathEdit);
+        mArchivePathEdit->style()->polish(mArchivePathEdit);
+        mArchivePathEdit->update();
+    }
 }
 
-void DkArchiveExtractionDialog::openArchive() {
-
-	// load system default open dialog
-	QString filePath = QFileDialog::getOpenFileName(
-		this, 
-		tr("Open Archive"),
-		(mArchivePathEdit->text().isEmpty()) ? QFileInfo(mFilePath).absolutePath() : mArchivePathEdit->text(), 
-		tr("Archives (%1)").arg(DkSettingsManager::param().app().containerRawFilters.remove(",")),
-		nullptr,
-		DkDialog::fileDialogOptions()
-	);
+void DkArchiveExtractionDialog::dirTextChanged(const QString &text)
+{
+    if (text.isEmpty()) {
+        userFeedback("", false);
+        mButtons->button(QDialogButtonBox::Ok)->setEnabled(false);
+    }
+}
 
-	if (QFileInfo(filePath).exists()) {
-		mArchivePathEdit->setText(filePath);
-		loadArchive(filePath);
-	}
+void DkArchiveExtractionDialog::checkbocChecked(int)
+{
+    loadArchive();
 }
 
-void DkArchiveExtractionDialog::openDir() {
-
-	// load system default open dialog
-	QString filePath = QFileDialog::getExistingDirectory(
-		this, 
-		tr("Open Directory"),
-		(mDirPathEdit->text().isEmpty()) ? QFileInfo(mFilePath).absolutePath() : mDirPathEdit->text(), 
-		QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks | DkDialog::fileDialogOptions()
-	);
+void DkArchiveExtractionDialog::openArchive()
+{
+    // load system default open dialog
+    QString filePath = QFileDialog::getOpenFileName(this,
+                                                    tr("Open Archive"),
+                                                    (mArchivePathEdit->text().isEmpty()) ? QFileInfo(mFilePath).absolutePath() : mArchivePathEdit->text(),
+                                                    tr("Archives (%1)").arg(DkSettingsManager::param().app().containerRawFilters.remove(",")),
+                                                    nullptr,
+                                                    DkDialog::fileDialogOptions());
 
-	if (QFileInfo(filePath).exists())
-		mDirPathEdit->setText(filePath);
+    if (QFileInfo(filePath).exists()) {
+        mArchivePathEdit->setText(filePath);
+        loadArchive(filePath);
+    }
 }
 
-void DkArchiveExtractionDialog::userFeedback(const QString& msg, bool error) {
+void DkArchiveExtractionDialog::openDir()
+{
+    // load system default open dialog
+    QString filePath = QFileDialog::getExistingDirectory(this,
+                                                         tr("Open Directory"),
+                                                         (mDirPathEdit->text().isEmpty()) ? QFileInfo(mFilePath).absolutePath() : mDirPathEdit->text(),
+                                                         QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks | DkDialog::fileDialogOptions());
 
-	if (!error)
-		mFeedbackLabel->setProperty("warning", false);
-	else
-		mFeedbackLabel->setProperty("warning", true);
-
-	mFeedbackLabel->setText(msg);
-	mFeedbackLabel->style()->unpolish(mFeedbackLabel);
-	mFeedbackLabel->style()->polish(mFeedbackLabel);
-	mFeedbackLabel->update();
+    if (QFileInfo(filePath).exists())
+        mDirPathEdit->setText(filePath);
 }
 
-void DkArchiveExtractionDialog::loadArchive(const QString& filePath) {
-
-	mFileList = QStringList();
-	mFileListDisplay->clear();
+void DkArchiveExtractionDialog::userFeedback(const QString &msg, bool error)
+{
+    if (!error)
+        mFeedbackLabel->setProperty("warning", false);
+    else
+        mFeedbackLabel->setProperty("warning", true);
 
-	QString lFilePath = filePath;
-	if (lFilePath.isEmpty())
-		lFilePath = mArchivePathEdit->text();
+    mFeedbackLabel->setText(msg);
+    mFeedbackLabel->style()->unpolish(mFeedbackLabel);
+    mFeedbackLabel->style()->polish(mFeedbackLabel);
+    mFeedbackLabel->update();
+}
 
-	QFileInfo fileInfo(lFilePath);
-	if (!fileInfo.exists())
-		return;
+void DkArchiveExtractionDialog::loadArchive(const QString &filePath)
+{
+    mFileList = QStringList();
+    mFileListDisplay->clear();
 
-	if (!DkBasicLoader::isContainer(lFilePath)) {
-		userFeedback(tr("Not a valid archive."), true);
-		return;
-	}
+    QString lFilePath = filePath;
+    if (lFilePath.isEmpty())
+        lFilePath = mArchivePathEdit->text();
 
-	if (mDirPathEdit->text().isEmpty()) {
+    QFileInfo fileInfo(lFilePath);
+    if (!fileInfo.exists())
+        return;
 
-		mDirPathEdit->setText(lFilePath.remove("." + fileInfo.suffix()));
-		mDirPathEdit->setFocus();
-	}
+    if (!DkBasicLoader::isContainer(lFilePath)) {
+        userFeedback(tr("Not a valid archive."), true);
+        return;
+    }
 
-	QStringList fileNameList = JlCompress::getFileList(lFilePath);
-	
-	// remove the * in fileFilters
-	QStringList fileFiltersClean = DkSettingsManager::param().app().browseFilters;
-	for (int idx = 0; idx < fileFiltersClean.size(); idx++)
-		fileFiltersClean[idx].replace("*", "");
+    if (mDirPathEdit->text().isEmpty()) {
+        mDirPathEdit->setText(lFilePath.remove("." + fileInfo.suffix()));
+        mDirPathEdit->setFocus();
+    }
 
-	for (int idx = 0; idx < fileNameList.size(); idx++) {
-		
-		for (int idxFilter = 0; idxFilter < fileFiltersClean.size(); idxFilter++) {
+    QStringList fileNameList = JlCompress::getFileList(lFilePath);
 
-			if (fileNameList.at(idx).contains(fileFiltersClean[idxFilter], Qt::CaseInsensitive)) {
-				mFileList.append(fileNameList.at(idx));
-				break;
-			}
-		}
-	}
+    // remove the * in fileFilters
+    QStringList fileFiltersClean = DkSettingsManager::param().app().browseFilters;
+    for (int idx = 0; idx < fileFiltersClean.size(); idx++)
+        fileFiltersClean[idx].replace("*", "");
 
-	if (mFileList.size() > 0)
-		userFeedback(tr("Number of images: ") + QString::number(mFileList.size()), false);
-	else {
-		userFeedback(tr("The archive does not contain any images."), false);
-		return;
-	}
+    for (int idx = 0; idx < fileNameList.size(); idx++) {
+        for (int idxFilter = 0; idxFilter < fileFiltersClean.size(); idxFilter++) {
+            if (fileNameList.at(idx).contains(fileFiltersClean[idxFilter], Qt::CaseInsensitive)) {
+                mFileList.append(fileNameList.at(idx));
+                break;
+            }
+        }
+    }
 
-	mFileListDisplay->addItems(mFileList);
+    if (mFileList.size() > 0)
+        userFeedback(tr("Number of images: ") + QString::number(mFileList.size()), false);
+    else {
+        userFeedback(tr("The archive does not contain any images."), false);
+        return;
+    }
 
-	if (mRemoveSubfolders->checkState() == Qt::Checked) {
-		for (int i = 0; i < mFileListDisplay->count(); i++) {
+    mFileListDisplay->addItems(mFileList);
 
-			QFileInfo fi(mFileListDisplay->item(i)->text());
-			mFileListDisplay->item(i)->setText(fi.fileName());
-		}
-	}
-	mFileListDisplay->update();
+    if (mRemoveSubfolders->checkState() == Qt::Checked) {
+        for (int i = 0; i < mFileListDisplay->count(); i++) {
+            QFileInfo fi(mFileListDisplay->item(i)->text());
+            mFileListDisplay->item(i)->setText(fi.fileName());
+        }
+    }
+    mFileListDisplay->update();
 
-	mButtons->button(QDialogButtonBox::Ok)->setEnabled(true);
+    mButtons->button(QDialogButtonBox::Ok)->setEnabled(true);
 }
 
-void DkArchiveExtractionDialog::accept() {
+void DkArchiveExtractionDialog::accept()
+{
+    QStringList extractedFiles = extractFilesWithProgress(mArchivePathEdit->text(), mFileList, mDirPathEdit->text(), mRemoveSubfolders->isChecked());
 
-	QStringList extractedFiles = extractFilesWithProgress(mArchivePathEdit->text(), mFileList, mDirPathEdit->text(), mRemoveSubfolders->isChecked());
-
-	if ((extractedFiles.isEmpty() || extractedFiles.size() != mFileList.size()) && !extractedFiles.contains("userCanceled")) {
-		
-		QMessageBox msgBox(this);
-		msgBox.setText(tr("The images could not be extracted!"));
-		msgBox.setIcon(QMessageBox::Critical);
-		msgBox.exec();
-	}
+    if ((extractedFiles.isEmpty() || extractedFiles.size() != mFileList.size()) && !extractedFiles.contains("userCanceled")) {
+        QMessageBox msgBox(this);
+        msgBox.setText(tr("The images could not be extracted!"));
+        msgBox.setIcon(QMessageBox::Critical);
+        msgBox.exec();
+    }
 
-	QDialog::accept();
+    QDialog::accept();
 }
 
-void DkArchiveExtractionDialog::dropEvent(QDropEvent *event) {
+void DkArchiveExtractionDialog::dropEvent(QDropEvent *event)
+{
+    if (event->mimeData()->hasUrls() && event->mimeData()->urls().size() > 0) {
+        QUrl url = event->mimeData()->urls().at(0);
+        qDebug() << "dropping: " << url;
+        url = url.toLocalFile();
 
-	if (event->mimeData()->hasUrls() && event->mimeData()->urls().size() > 0) {
-		QUrl url = event->mimeData()->urls().at(0);
-		qDebug() << "dropping: " << url;
-		url = url.toLocalFile();
-
-		if (QFileInfo(url.toString()).isFile()) {
-			mArchivePathEdit->setText(url.toString());
-			loadArchive(url.toString());
-		}
-		else
-			mDirPathEdit->setText(url.toString());
-	}
+        if (QFileInfo(url.toString()).isFile()) {
+            mArchivePathEdit->setText(url.toString());
+            loadArchive(url.toString());
+        } else
+            mDirPathEdit->setText(url.toString());
+    }
 }
 
-void DkArchiveExtractionDialog::dragEnterEvent(QDragEnterEvent *event) {
-
-	if (event->mimeData()->hasUrls()) {
-		QUrl url = event->mimeData()->urls().at(0);
-		url = url.toLocalFile();
-		QFileInfo file = QFileInfo(url.toString());
-
-		if (file.exists())
-			event->acceptProposedAction();
-	}
+void DkArchiveExtractionDialog::dragEnterEvent(QDragEnterEvent *event)
+{
+    if (event->mimeData()->hasUrls()) {
+        QUrl url = event->mimeData()->urls().at(0);
+        url = url.toLocalFile();
+        QFileInfo file = QFileInfo(url.toString());
 
+        if (file.exists())
+            event->acceptProposedAction();
+    }
 }
 
-QStringList DkArchiveExtractionDialog::extractFilesWithProgress(const QString& fileCompressed, const QStringList& files, const QString& dir, bool removeSubfolders) {
-
+QStringList
+DkArchiveExtractionDialog::extractFilesWithProgress(const QString &fileCompressed, const QStringList &files, const QString &dir, bool removeSubfolders)
+{
     QProgressDialog progressDialog(this);
     progressDialog.setCancelButtonText(tr("&Cancel"));
     progressDialog.setRange(0, files.size() - 1);
     progressDialog.setWindowTitle(tr("Extracting files..."));
-	progressDialog.setWindowModality(Qt::WindowModal);
-	progressDialog.setModal(true);
-	progressDialog.hide();
-	progressDialog.show();
+    progressDialog.setWindowModality(Qt::WindowModal);
+    progressDialog.setModal(true);
+    progressDialog.hide();
+    progressDialog.show();
 
     QStringList extracted;
-    for (int i=0; i<files.count(); i++) {
-		progressDialog.setValue(i);
-		progressDialog.setLabelText(tr("Extracting file %1 of %2").arg(i + 1).arg(files.size()));
-
-		QString absPath;
-		if(removeSubfolders)
-			absPath = QDir(dir).absoluteFilePath(QFileInfo(files.at(i)).fileName());
-		else
-			absPath = QDir(dir).absoluteFilePath(files.at(i));
-
-		if (JlCompress::extractFile(fileCompressed, files.at(i), absPath).isEmpty()) {
-			qDebug() << "unable to extract:" << files.at(i);
-			//return QStringList();
-		}
+    for (int i = 0; i < files.count(); i++) {
+        progressDialog.setValue(i);
+        progressDialog.setLabelText(tr("Extracting file %1 of %2").arg(i + 1).arg(files.size()));
+
+        QString absPath;
+        if (removeSubfolders)
+            absPath = QDir(dir).absoluteFilePath(QFileInfo(files.at(i)).fileName());
+        else
+            absPath = QDir(dir).absoluteFilePath(files.at(i));
+
+        if (JlCompress::extractFile(fileCompressed, files.at(i), absPath).isEmpty()) {
+            qDebug() << "unable to extract:" << files.at(i);
+            // return QStringList();
+        }
         extracted.append(absPath);
-		if(progressDialog.wasCanceled()) {
-			return QStringList("userCanceled");
-		}
+        if (progressDialog.wasCanceled()) {
+            return QStringList("userCanceled");
+        }
     }
 
-	progressDialog.close();
+    progressDialog.close();
 
     return extracted;
 }
 
 #endif
 
-
 // DkDialogManager --------------------------------------------------------------------
-DkDialogManager::DkDialogManager(QObject* parent) : QObject(parent) {
-
-	DkActionManager& am = DkActionManager::instance();
-
-	connect(am.action(DkActionManager::menu_edit_shortcuts), SIGNAL(triggered()), this, SLOT(openShortcutsDialog()));
-	connect(am.action(DkActionManager::menu_file_app_manager), SIGNAL(triggered()), this, SLOT(openAppManager()));
-	connect(am.action(DkActionManager::menu_file_print), SIGNAL(triggered()), this, SLOT(openPrintDialog()));
-	connect(am.action(DkActionManager::menu_tools_mosaic), SIGNAL(triggered()), this, SLOT(openMosaicDialog()));
-}
-
-void DkDialogManager::openShortcutsDialog() const {
-
-	DkActionManager& am = DkActionManager::instance();
-
-	DkShortcutsDialog* shortcutsDialog = new DkShortcutsDialog(DkUtils::getMainWindow());
-	shortcutsDialog->addActions(am.fileActions(), am.fileMenu()->title());
-	shortcutsDialog->addActions(am.openWithActions(), am.openWithMenu()->title());
-	shortcutsDialog->addActions(am.sortActions(), am.sortMenu()->title());
-	shortcutsDialog->addActions(am.editActions(), am.editMenu()->title());
-	shortcutsDialog->addActions(am.manipulatorActions(), am.manipulatorMenu()->title());
-	shortcutsDialog->addActions(am.viewActions(), am.viewMenu()->title());
-	shortcutsDialog->addActions(am.panelActions(), am.panelMenu()->title());
-	shortcutsDialog->addActions(am.toolsActions(), am.toolsMenu()->title());
-	shortcutsDialog->addActions(am.syncActions(), am.syncMenu()->title());
-	shortcutsDialog->addActions(am.previewActions(), tr("Preview"));
-#ifdef WITH_PLUGINS	// TODO
-
-	DkPluginActionManager* pm = am.pluginActionManager();
-	pm->updateMenu();
-
-	QVector<QAction*> allPluginActions = pm->pluginActions();
-
-	for (const QMenu* m : pm->pluginSubMenus()) {
-		allPluginActions << m->actions().toVector();
-	}
+DkDialogManager::DkDialogManager(QObject *parent)
+    : QObject(parent)
+{
+    DkActionManager &am = DkActionManager::instance();
+
+    connect(am.action(DkActionManager::menu_edit_shortcuts), SIGNAL(triggered()), this, SLOT(openShortcutsDialog()));
+    connect(am.action(DkActionManager::menu_file_app_manager), SIGNAL(triggered()), this, SLOT(openAppManager()));
+    connect(am.action(DkActionManager::menu_file_print), SIGNAL(triggered()), this, SLOT(openPrintDialog()));
+    connect(am.action(DkActionManager::menu_tools_mosaic), SIGNAL(triggered()), this, SLOT(openMosaicDialog()));
+}
+
+void DkDialogManager::openShortcutsDialog() const
+{
+    DkActionManager &am = DkActionManager::instance();
+
+    DkShortcutsDialog *shortcutsDialog = new DkShortcutsDialog(DkUtils::getMainWindow());
+    shortcutsDialog->addActions(am.fileActions(), am.fileMenu()->title());
+    shortcutsDialog->addActions(am.openWithActions(), am.openWithMenu()->title());
+    shortcutsDialog->addActions(am.sortActions(), am.sortMenu()->title());
+    shortcutsDialog->addActions(am.editActions(), am.editMenu()->title());
+    shortcutsDialog->addActions(am.manipulatorActions(), am.manipulatorMenu()->title());
+    shortcutsDialog->addActions(am.viewActions(), am.viewMenu()->title());
+    shortcutsDialog->addActions(am.panelActions(), am.panelMenu()->title());
+    shortcutsDialog->addActions(am.toolsActions(), am.toolsMenu()->title());
+    shortcutsDialog->addActions(am.syncActions(), am.syncMenu()->title());
+    shortcutsDialog->addActions(am.previewActions(), tr("Preview"));
+#ifdef WITH_PLUGINS // TODO
+
+    DkPluginActionManager *pm = am.pluginActionManager();
+    pm->updateMenu();
+
+    QVector<QAction *> allPluginActions = pm->pluginActions();
+
+    for (const QMenu *m : pm->pluginSubMenus()) {
+        allPluginActions << m->actions().toVector();
+    }
 
-	shortcutsDialog->addActions(allPluginActions, pm->menu()->title());
+    shortcutsDialog->addActions(allPluginActions, pm->menu()->title());
 #endif // WITH_PLUGINS
-	shortcutsDialog->addActions(am.helpActions(), am.helpMenu()->title());
-	shortcutsDialog->addActions(am.hiddenActions(), tr("Shortcuts"));
+    shortcutsDialog->addActions(am.helpActions(), am.helpMenu()->title());
+    shortcutsDialog->addActions(am.hiddenActions(), tr("Shortcuts"));
 
-	shortcutsDialog->exec();
-	shortcutsDialog->deleteLater();
+    shortcutsDialog->exec();
+    shortcutsDialog->deleteLater();
 }
 
-void DkDialogManager::setCentralWidget(DkCentralWidget * cw) {
-	mCentralWidget = cw;
+void DkDialogManager::setCentralWidget(DkCentralWidget *cw)
+{
+    mCentralWidget = cw;
 }
 
-void DkDialogManager::openAppManager() const {
+void DkDialogManager::openAppManager() const
+{
+    DkActionManager &am = DkActionManager::instance();
 
-	DkActionManager& am = DkActionManager::instance();
+    DkAppManagerDialog *appManagerDialog = new DkAppManagerDialog(am.appManager(), DkUtils::getMainWindow());
+    connect(appManagerDialog, SIGNAL(openWithSignal(QAction *)), am.appManager(), SIGNAL(openFileSignal(QAction *))); // forward
+    appManagerDialog->exec();
 
-	DkAppManagerDialog* appManagerDialog = new DkAppManagerDialog(am.appManager(), DkUtils::getMainWindow());
-	connect(appManagerDialog, SIGNAL(openWithSignal(QAction*)), am.appManager(), SIGNAL(openFileSignal(QAction*)));	// forward
-	appManagerDialog->exec();
+    appManagerDialog->deleteLater();
 
-	appManagerDialog->deleteLater();
-
-	DkActionManager::instance().updateOpenWithMenu();
+    DkActionManager::instance().updateOpenWithMenu();
 }
 
-void DkDialogManager::openMosaicDialog() const {
-
-	if (!mCentralWidget) {
-		qWarning() << "cannot compute mosaic if there is no central widget...";
-		return;
-	}
+void DkDialogManager::openMosaicDialog() const
+{
+    if (!mCentralWidget) {
+        qWarning() << "cannot compute mosaic if there is no central widget...";
+        return;
+    }
 
 #ifdef WITH_OPENCV
-	DkMosaicDialog* mosaicDialog = new DkMosaicDialog(DkUtils::getMainWindow(), Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint);
-	mosaicDialog->setFile(mCentralWidget->getCurrentFilePath());
+    DkMosaicDialog *mosaicDialog = new DkMosaicDialog(DkUtils::getMainWindow(), Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint);
+    mosaicDialog->setFile(mCentralWidget->getCurrentFilePath());
+
+    int response = mosaicDialog->exec();
 
-	int response = mosaicDialog->exec();
+    if (response == QDialog::Accepted && !mosaicDialog->getImage().isNull()) {
+        QImage editedImage = mosaicDialog->getImage();
 
-	if (response == QDialog::Accepted && !mosaicDialog->getImage().isNull()) {
-		QImage editedImage = mosaicDialog->getImage();
-		
-		QSharedPointer<DkImageContainerT> imgC(new DkImageContainerT(""));
-		imgC->setImage(mosaicDialog->getImage(), tr("Mosaic"));
+        QSharedPointer<DkImageContainerT> imgC(new DkImageContainerT(""));
+        imgC->setImage(mosaicDialog->getImage(), tr("Mosaic"));
 
-		mCentralWidget->addTab(imgC);
-		DkActionManager::instance().action(DkActionManager::menu_file_save_as)->trigger();
-	}
+        mCentralWidget->addTab(imgC);
+        DkActionManager::instance().action(DkActionManager::menu_file_save_as)->trigger();
+    }
 
-	mosaicDialog->deleteLater();
+    mosaicDialog->deleteLater();
 #endif
 }
 
-void DkDialogManager::openPrintDialog() const {
-
-	if (!mCentralWidget) {
-		qWarning() << "cannot open print dialog if there is no central widget...";
-		return;
-	}
-
-	QSharedPointer<DkImageContainerT> imgC = mCentralWidget->getCurrentImage();
+void DkDialogManager::openPrintDialog() const
+{
+    if (!mCentralWidget) {
+        qWarning() << "cannot open print dialog if there is no central widget...";
+        return;
+    }
 
-	DkPrintPreviewDialog* previewDialog = new DkPrintPreviewDialog(DkUtils::getMainWindow());
-	previewDialog->setImage(imgC->image());
+    QSharedPointer<DkImageContainerT> imgC = mCentralWidget->getCurrentImage();
+    if (!imgC) {
+        qWarning() << "cannot open print dialog if there is no ImageContainer...";
+        return;
+    }
 
-	// load all pages of tiffs
-	if (imgC->getLoader()->getNumPages() > 1) {
+    DkPrintPreviewDialog *previewDialog = new DkPrintPreviewDialog(DkUtils::getMainWindow());
+    previewDialog->setImage(imgC->image());
 
-		auto l = imgC->getLoader();
+    // load all pages of tiffs
+    if (imgC->getLoader()->getNumPages() > 1) {
+        auto l = imgC->getLoader();
 
-		for (int idx = 1; idx < l->getNumPages(); idx++) {
-			l->loadPageAt(idx+1);
-			previewDialog->addImage(l->image());
-		}
-	}
+        for (int idx = 1; idx < l->getNumPages(); idx++) {
+            l->loadPageAt(idx + 1);
+            previewDialog->addImage(l->image());
+        }
+    }
 
-	previewDialog->exec();
-	previewDialog->deleteLater();
+    previewDialog->exec();
+    previewDialog->deleteLater();
 }
 
-// -------------------------------------------------------------------- DkPrintImage 
-DkPrintImage::DkPrintImage(const QImage & img, QPrinter * printer) {
-	mImg = img;
-	mPrinter = printer;
+// -------------------------------------------------------------------- DkPrintImage
+DkPrintImage::DkPrintImage(const QImage &img, QPrinter *printer)
+{
+    mImg = img;
+    mPrinter = printer;
 }
 
-QImage DkPrintImage::image() const {
-	return mImg;
+QImage DkPrintImage::image() const
+{
+    return mImg;
 }
 
-void DkPrintImage::draw(QPainter & p, bool highQuality) {
+void DkPrintImage::draw(QPainter &p, bool highQuality)
+{
+    QRect r = mImg.rect();
+    r = mTransform.mapRect(r);
 
-	QRect r = mImg.rect();
-	r = mTransform.mapRect(r);
+    QImage img = mImg;
 
-	QImage img = mImg;
+    if (highQuality)
+        img = DkImage::resizeImage(mImg, QSize(), mTransform.m11(), DkImage::ipl_area, false);
+    else
+        p.setRenderHints(QPainter::SmoothPixmapTransform);
 
-	if (highQuality) 
-		img = DkImage::resizeImage(mImg, QSize(), mTransform.m11(), DkImage::ipl_area, false);
-	else
-		p.setRenderHints(QPainter::SmoothPixmapTransform);
-
-	p.drawImage(r, img, img.rect());
+    p.drawImage(r, img, img.rect());
 }
 
-void DkPrintImage::fit() {
-
-	if (!mPrinter) {
-		qWarning() << "cannot fit image if the printer is NULL";
-		return;
-	}
+void DkPrintImage::fit()
+{
+    if (!mPrinter) {
+        qWarning() << "cannot fit image if the printer is NULL";
+        return;
+    }
 
-	double sf = 0;
-	QRectF pr = mPrinter->pageRect();
+    double sf = 0;
+    QRectF pr = mPrinter->pageRect();
 
-	// scale image to fit on paper
-	if (pr.width() / mImg.width() < pr.height() / mImg.height()) {
-		sf = pr.width() / (mImg.width() + DBL_EPSILON);
-	}
-	else {
-		sf = pr.height() / (mImg.height() + DBL_EPSILON);
-	}
+    // scale image to fit on paper
+    if (pr.width() / mImg.width() < pr.height() / mImg.height()) {
+        sf = pr.width() / (mImg.width() + DBL_EPSILON);
+    } else {
+        sf = pr.height() / (mImg.height() + DBL_EPSILON);
+    }
 
-	double inchW = mPrinter->pageRect(QPrinter::Inch).width();
-	double pxW = mPrinter->pageRect().width();
-	double cDpi = dpi();
+    double inchW = mPrinter->pageRect(QPrinter::Inch).width();
+    double pxW = mPrinter->pageRect().width();
+    double cDpi = dpi();
 
-	// use at least 150 dpi 
-	if (cDpi < 150 && sf > 1) {
-		cDpi = 150;
-		sf = (pxW / inchW) / cDpi;
-		qDebug() << "new scale Factor:" << sf;
-	}
+    // use at least 150 dpi
+    if (cDpi < 150 && sf > 1) {
+        cDpi = 150;
+        sf = (pxW / inchW) / cDpi;
+        qDebug() << "new scale Factor:" << sf;
+    }
 
-	mTransform.reset();
-	mTransform.scale(sf, sf);
+    mTransform.reset();
+    mTransform.scale(sf, sf);
 
-	// TODO: print
-	//updateDpiFactor(mDpi);
-	center();
+    // TODO: print
+    // updateDpiFactor(mDpi);
+    center();
 }
 
-double DkPrintImage::dpi() {
-	
-	double iW = mPrinter->pageRect(QPrinter::Inch).width();
-	double pxW = mPrinter->pageRect().width();
+double DkPrintImage::dpi()
+{
+    double iW = mPrinter->pageRect(QPrinter::Inch).width();
+    double pxW = mPrinter->pageRect().width();
 
-	return (pxW / iW) / mTransform.m11();
+    return (pxW / iW) / mTransform.m11();
 }
 
-void DkPrintImage::center() {
-	center(mTransform);
+void DkPrintImage::center()
+{
+    center(mTransform);
 }
 
-void DkPrintImage::scale(double sf) {
+void DkPrintImage::scale(double sf)
+{
+    mTransform.reset();
+    mTransform.scale(sf, sf);
 
-	mTransform.reset();
-	mTransform.scale(sf, sf);
-	
-	center();
+    center();
 }
 
-void DkPrintImage::center(QTransform & t) const {
-
-	QRectF transRect = t.mapRect(mImg.rect());
-	qreal xtrans = 0, ytrans = 0;
-	xtrans = ((mPrinter->pageRect().width() - transRect.width()) / 2);
-	ytrans = (mPrinter->pageRect().height() - transRect.height()) / 2;
+void DkPrintImage::center(QTransform &t) const
+{
+    QRectF transRect = t.mapRect(mImg.rect());
+    qreal xtrans = 0, ytrans = 0;
+    xtrans = ((mPrinter->pageRect().width() - transRect.width()) / 2);
+    ytrans = (mPrinter->pageRect().height() - transRect.height()) / 2;
 
-	t.translate(-t.dx() / (t.m11() + DBL_EPSILON), -t.dy() / (t.m22() + DBL_EPSILON)); // reset old transformation
-	t.translate(xtrans / (t.m11() + DBL_EPSILON), ytrans / (t.m22() + DBL_EPSILON));
+    t.translate(-t.dx() / (t.m11() + DBL_EPSILON), -t.dy() / (t.m22() + DBL_EPSILON)); // reset old transformation
+    t.translate(xtrans / (t.m11() + DBL_EPSILON), ytrans / (t.m22() + DBL_EPSILON));
 }
 
-// -------------------------------------------------------------------- DkSvgSizeDialog 
-DkSvgSizeDialog::DkSvgSizeDialog(const QSize& size, QWidget* parent) : QDialog(parent) {
-	
-	mSize = size;
-	mARatio = (double)size.width() / size.height();
-	setWindowTitle("Resize SVG");
-	createLayout();
+// -------------------------------------------------------------------- DkSvgSizeDialog
+DkSvgSizeDialog::DkSvgSizeDialog(const QSize &size, QWidget *parent)
+    : QDialog(parent)
+{
+    mSize = size;
+    mARatio = (double)size.width() / size.height();
+    setWindowTitle("Resize SVG");
+    createLayout();
 
-	QMetaObject::connectSlotsByName(this);
+    QMetaObject::connectSlotsByName(this);
 }
 
-void DkSvgSizeDialog::createLayout() {
+void DkSvgSizeDialog::createLayout()
+{
+    QLabel *wl = new QLabel(tr("width:"), this);
 
+    mSizeBox.resize(b_end);
 
-	QLabel* wl = new QLabel(tr("width:"), this);
+    mSizeBox[b_width] = new QSpinBox(this);
+    mSizeBox[b_width]->setObjectName("width");
 
-	mSizeBox.resize(b_end);
+    QLabel *hl = new QLabel(tr("height:"), this);
 
-	mSizeBox[b_width] = new QSpinBox(this);
-	mSizeBox[b_width]->setObjectName("width");
+    mSizeBox[b_height] = new QSpinBox(this);
+    mSizeBox[b_height]->setObjectName("height");
 
-	QLabel* hl = new QLabel(tr("height:"), this);
-
-	mSizeBox[b_height] = new QSpinBox(this);
-	mSizeBox[b_height]->setObjectName("height");
+    for (auto s : mSizeBox) {
+        s->setMinimum(1);
+        s->setMaximum(50000);
+        s->setSuffix(" px");
+    }
 
-	for (auto s : mSizeBox) {
-		s->setMinimum(1);
-		s->setMaximum(50000);
-		s->setSuffix(" px");
-	}
-	
-	mSizeBox[b_width]->setValue(mSize.width());
-	mSizeBox[b_height]->setValue(mSize.height());
+    mSizeBox[b_width]->setValue(mSize.width());
+    mSizeBox[b_height]->setValue(mSize.height());
 
-	// buttons
-	auto buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
-	buttons->button(QDialogButtonBox::Ok)->setText(tr("&OK"));
-	buttons->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel"));
-	connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
-	connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
+    // buttons
+    auto buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
+    buttons->button(QDialogButtonBox::Ok)->setText(tr("&OK"));
+    buttons->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel"));
+    connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
+    connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
 
-	QGridLayout* layout = new QGridLayout(this);
-	layout->addWidget(wl, 1, 1);
-	layout->addWidget(mSizeBox[b_width], 1, 2);
-	layout->addWidget(hl, 1, 3);
-	layout->addWidget(mSizeBox[b_height], 1, 4);
-	layout->setColumnStretch(0, 1);
-	layout->setColumnStretch(5, 1);
-	layout->setRowStretch(0, 1);
-	layout->setRowStretch(2, 1);
-	layout->addWidget(buttons, 3, 1, 1, 6, Qt::AlignBottom);
-	
+    QGridLayout *layout = new QGridLayout(this);
+    layout->addWidget(wl, 1, 1);
+    layout->addWidget(mSizeBox[b_width], 1, 2);
+    layout->addWidget(hl, 1, 3);
+    layout->addWidget(mSizeBox[b_height], 1, 4);
+    layout->setColumnStretch(0, 1);
+    layout->setColumnStretch(5, 1);
+    layout->setRowStretch(0, 1);
+    layout->setRowStretch(2, 1);
+    layout->addWidget(buttons, 3, 1, 1, 6, Qt::AlignBottom);
 }
 
-void DkSvgSizeDialog::on_width_valueChanged(int val) {
+void DkSvgSizeDialog::on_width_valueChanged(int val)
+{
+    mSize.setWidth(val);
+    mSize.setHeight(qRound(val / mARatio));
 
-	mSize.setWidth(val);
-	mSize.setHeight(qRound(val/mARatio));
-
-	mSizeBox[b_height]->blockSignals(true);
-	mSizeBox[b_height]->setValue(mSize.height());
-	mSizeBox[b_height]->blockSignals(false);
+    mSizeBox[b_height]->blockSignals(true);
+    mSizeBox[b_height]->setValue(mSize.height());
+    mSizeBox[b_height]->blockSignals(false);
 }
 
-void DkSvgSizeDialog::on_height_valueChanged(int val) {
-
-	mSize.setWidth(qRound(val * mARatio));
-	mSize.setHeight(val);
+void DkSvgSizeDialog::on_height_valueChanged(int val)
+{
+    mSize.setWidth(qRound(val * mARatio));
+    mSize.setHeight(val);
 
-	mSizeBox[b_width]->blockSignals(true);
-	mSizeBox[b_width]->setValue(mSize.width());
-	mSizeBox[b_width]->blockSignals(false);
+    mSizeBox[b_width]->blockSignals(true);
+    mSizeBox[b_width]->setValue(mSize.width());
+    mSizeBox[b_width]->blockSignals(false);
 }
 
-QSize DkSvgSizeDialog::size() const {
-	return mSize;
+QSize DkSvgSizeDialog::size() const
+{
+    return mSize;
 }
 
-// -------------------------------------------------------------------- DkChooseMonitorDialog 
-DkChooseMonitorDialog::DkChooseMonitorDialog(QWidget* parent) : QDialog(parent) {
-
-	mScreens = screens();
-	createLayout();
-	loadSettings();
-	resize(300, 150);
+// -------------------------------------------------------------------- DkChooseMonitorDialog
+DkChooseMonitorDialog::DkChooseMonitorDialog(QWidget *parent)
+    : QDialog(parent)
+{
+    mScreens = screens();
+    createLayout();
+    loadSettings();
+    resize(300, 150);
 }
 
-void DkChooseMonitorDialog::createLayout() {
-
-	mDisplayWidget = new DkDisplayWidget(this);
-	mDisplayWidget->show();
+void DkChooseMonitorDialog::createLayout()
+{
+    mDisplayWidget = new DkDisplayWidget(this);
+    mDisplayWidget->show();
 
-	mCbRemember = new QCheckBox(tr("Remember Monitor Settings"), this);
+    mCbRemember = new QCheckBox(tr("Remember Monitor Settings"), this);
 
-	// buttons
-	auto buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
-	buttons->button(QDialogButtonBox::Ok)->setText(tr("&OK"));
-	buttons->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel"));
-	connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
-	connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
+    // buttons
+    auto buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
+    buttons->button(QDialogButtonBox::Ok)->setText(tr("&OK"));
+    buttons->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel"));
+    connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
+    connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
 
-	QGridLayout* layout = new QGridLayout(this);
-	layout->setRowStretch(0, 1);
-	layout->addWidget(mDisplayWidget, 1, 1);
-	layout->addWidget(mCbRemember, 2, 1);
-	layout->addWidget(buttons, 3, 1);
-	layout->setRowStretch(4, 1);
+    QGridLayout *layout = new QGridLayout(this);
+    layout->setRowStretch(0, 1);
+    layout->addWidget(mDisplayWidget, 1, 1);
+    layout->addWidget(mCbRemember, 2, 1);
+    layout->addWidget(buttons, 3, 1);
+    layout->setRowStretch(4, 1);
 }
 
-void DkChooseMonitorDialog::loadSettings() {
+void DkChooseMonitorDialog::loadSettings()
+{
+    DefaultSettings settings;
+    settings.beginGroup("MonitorSetup");
 
-	DefaultSettings settings;
-	settings.beginGroup("MonitorSetup");
-	
-	int mIdx = settings.value("monitorIndex", 0).toInt();
-	mCbRemember->setChecked(!settings.value("showDialog", true).toBool());
+    int mIdx = settings.value("monitorIndex", 0).toInt();
+    mCbRemember->setChecked(!settings.value("showDialog", true).toBool());
 
-	settings.endGroup();
+    settings.endGroup();
 
-	if (mIdx >= 0 && mIdx < mDisplayWidget->count())
-		mDisplayWidget->setCurrentIndex(mIdx);
-	else
-		mCbRemember->setChecked(false);	// fall-back if the count is illegal
+    if (mIdx >= 0 && mIdx < mDisplayWidget->count())
+        mDisplayWidget->setCurrentIndex(mIdx);
+    else
+        mCbRemember->setChecked(false); // fall-back if the count is illegal
 }
 
-void DkChooseMonitorDialog::saveSettings() const {
-	
-	DefaultSettings settings;
+void DkChooseMonitorDialog::saveSettings() const
+{
+    DefaultSettings settings;
 
-	settings.beginGroup("MonitorSetup");
-	settings.setValue("monitorIndex", mDisplayWidget->currentIndex());
-	settings.setValue("showDialog", !mCbRemember->isChecked());
-	settings.endGroup();
+    settings.beginGroup("MonitorSetup");
+    settings.setValue("monitorIndex", mDisplayWidget->currentIndex());
+    settings.setValue("showDialog", !mCbRemember->isChecked());
+    settings.endGroup();
 }
 
-int DkChooseMonitorDialog::exec() {
+int DkChooseMonitorDialog::exec()
+{
+    int answer = QDialog::exec();
 
-	int answer = QDialog::exec();
+    if (answer == QDialog::Accepted)
+        saveSettings();
 
-	if (answer == QDialog::Accepted)
-		saveSettings();
-
-	return answer;
+    return answer;
 }
 
-QList<QScreen*> DkChooseMonitorDialog::screens() const {
-
-	return QGuiApplication::screens();
+QList<QScreen *> DkChooseMonitorDialog::screens() const
+{
+    return QGuiApplication::screens();
 }
 
-QRect DkChooseMonitorDialog::screenRect() const {
-	
-	return mDisplayWidget->screenRect();
+QRect DkChooseMonitorDialog::screenRect() const
+{
+    return mDisplayWidget->screenRect();
 }
 
-bool DkChooseMonitorDialog::showDialog() const {
-	return !mCbRemember->isChecked();
+bool DkChooseMonitorDialog::showDialog() const
+{
+    return !mCbRemember->isChecked();
 }
 
 } // close namespace
-
diff --git a/ImageLounge/src/DkGui/DkDialog.h b/ImageLounge/src/DkGui/DkDialog.h
index 70cfd46..644ae6f 100644
--- a/ImageLounge/src/DkGui/DkDialog.h
+++ b/ImageLounge/src/DkGui/DkDialog.h
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkDialog.h
  Created on:	21.04.2011
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -27,17 +27,17 @@
 
 #pragma once
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QItemDelegate>
-#include <QPrintPreviewWidget>
-#include <QLineEdit>
-#include <QDoubleSpinBox>
-#include <QMainWindow>
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QDialog>
 #include <QDir>
-#include <QFutureWatcher>
+#include <QDoubleSpinBox>
 #include <QFileDialog>
-#pragma warning(pop)		// no warnings from includes - end
+#include <QFutureWatcher>
+#include <QItemDelegate>
+#include <QLineEdit>
+#include <QMainWindow>
+#include <QPrintPreviewWidget>
+#pragma warning(pop) // no warnings from includes - end
 
 #include "DkBasicLoader.h"
 
@@ -60,7 +60,8 @@ class QCheckBox;
 class QProgressBar;
 class QSettings;
 
-namespace nmc {
+namespace nmc
+{
 
 // nomacs defines
 class DkBaseViewPort;
@@ -72,828 +73,859 @@ class DkAppManager;
 class DkDisplayWidget;
 class DkCentralWidget;
 
-namespace DkDialog {
-	QFileDialog::Options fileDialogOptions();
+namespace DkDialog
+{
+QFileDialog::Options fileDialogOptions();
 };
 
-
-// needed because of http://stackoverflow.com/questions/1891744/pyqt4-qspinbox-selectall-not-working-as-expected 
+// needed because of http://stackoverflow.com/questions/1891744/pyqt4-qspinbox-selectall-not-working-as-expected
 // and http://qt-project.org/forums/viewthread/8590
-class DkSelectAllLineEdit : public QLineEdit {
-
+class DkSelectAllLineEdit : public QLineEdit
+{
 public:
-	DkSelectAllLineEdit(QWidget* parent = 0) : QLineEdit(parent) {selectOnMousePressEvent = false;};
+    DkSelectAllLineEdit(QWidget *parent = 0)
+        : QLineEdit(parent)
+    {
+        selectOnMousePressEvent = false;
+    };
 
 protected:
-	void focusInEvent(QFocusEvent *event) {
-		QLineEdit::focusInEvent(event);
-		selectAll();
-		selectOnMousePressEvent = true;
-	}
-
-	void mousePressEvent(QMouseEvent *event) {
-		QLineEdit::mousePressEvent(event);
-		if (selectOnMousePressEvent) {
-			selectAll();
-			selectOnMousePressEvent = false;
-		}
-	}
+    void focusInEvent(QFocusEvent *event)
+    {
+        QLineEdit::focusInEvent(event);
+        selectAll();
+        selectOnMousePressEvent = true;
+    }
+
+    void mousePressEvent(QMouseEvent *event)
+    {
+        QLineEdit::mousePressEvent(event);
+        if (selectOnMousePressEvent) {
+            selectAll();
+            selectOnMousePressEvent = false;
+        }
+    }
+
 private:
-	bool selectOnMousePressEvent; 
+    bool selectOnMousePressEvent;
 };
 
-class DkSelectAllDoubleSpinBox : public QDoubleSpinBox {
-	public:
-		DkSelectAllDoubleSpinBox(QWidget* parent = 0) : QDoubleSpinBox(parent) {
-			DkSelectAllLineEdit* le = new DkSelectAllLineEdit(this); 
-			setLineEdit(le);
-		};
+class DkSelectAllDoubleSpinBox : public QDoubleSpinBox
+{
+public:
+    DkSelectAllDoubleSpinBox(QWidget *parent = 0)
+        : QDoubleSpinBox(parent)
+    {
+        DkSelectAllLineEdit *le = new DkSelectAllLineEdit(this);
+        setLineEdit(le);
+    };
 };
 
-class DkSplashScreen : public QDialog {
-	Q_OBJECT
+class DkSplashScreen : public QDialog
+{
+    Q_OBJECT
 
 public:
-	DkSplashScreen(QWidget* parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
-	~DkSplashScreen() {};
+    DkSplashScreen(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
+    ~DkSplashScreen(){};
 
 protected:
-	void mouseMoveEvent(QMouseEvent *event) override;
-	void mousePressEvent(QMouseEvent *event) override;
-	void mouseReleaseEvent(QMouseEvent *event) override;
-	void showClose();
+    void mouseMoveEvent(QMouseEvent *event) override;
+    void mousePressEvent(QMouseEvent *event) override;
+    void mouseReleaseEvent(QMouseEvent *event) override;
+    void showClose();
 
 private:
-	QPoint mouseGrab;
-	QString text;
-	QLabel* textLabel;
-	QLabel* imgLabel;
-	QTimer* showTimer;
-	QPushButton* exitButton;
-
-	QString versionText() const;
+    QPoint mouseGrab;
+    QString text;
+    QLabel *textLabel;
+    QLabel *imgLabel;
+    QTimer *showTimer;
+    QPushButton *exitButton;
+
+    QString versionText() const;
 };
 
-class DkFileValidator : public QValidator {
-	Q_OBJECT
+class DkFileValidator : public QValidator
+{
+    Q_OBJECT
 
 public:
-	DkFileValidator(const QString& lastFile = QString(), QObject * parent = 0);
+    DkFileValidator(const QString &lastFile = QString(), QObject *parent = 0);
 
-	void setLastFile(const QString& lastFile) {
-		mLastFile = lastFile;
-	};
-	virtual void fixup(QString& input) const;
-	virtual State validate(QString& input, int& pos) const;
+    void setLastFile(const QString &lastFile)
+    {
+        mLastFile = lastFile;
+    };
+    virtual void fixup(QString &input) const;
+    virtual State validate(QString &input, int &pos) const;
 
 protected:
-	QString mLastFile;
+    QString mLastFile;
 };
 
-class DkTrainDialog : public QDialog {
-	Q_OBJECT
-	
+class DkTrainDialog : public QDialog
+{
+    Q_OBJECT
+
 public:
-	DkTrainDialog(QWidget* parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
+    DkTrainDialog(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
 
-	QString getAcceptedFile() {
-		return mAcceptedFile;
-	};
+    QString getAcceptedFile()
+    {
+        return mAcceptedFile;
+    };
 
-	void setCurrentFile(const QString& file) {
-		mFile = file;
-	};
+    void setCurrentFile(const QString &file)
+    {
+        mFile = file;
+    };
 
 public slots:
-	void textChanged(const QString& text);
-	void loadFile(const QString& filePath = "");
-	void openFile();
-	void accept() override;
+    void textChanged(const QString &text);
+    void loadFile(const QString &filePath = "");
+    void openFile();
+    void accept() override;
 
 protected:
-	void dragEnterEvent(QDragEnterEvent *event) override;
-	void dropEvent(QDropEvent *event) override;
-
-	void createLayout();
-	void userFeedback(const QString& msg, bool error = false);
-
-	DkFileValidator mFileValidator;
-	QDialogButtonBox* mButtons;
-	QLineEdit* mPathEdit;
-	QLabel* mFeedbackLabel;
-	DkBaseViewPort* mViewport;
-	
-	QString mAcceptedFile;
-	QString mFile;
+    void dragEnterEvent(QDragEnterEvent *event) override;
+    void dropEvent(QDropEvent *event) override;
+
+    void createLayout();
+    void userFeedback(const QString &msg, bool error = false);
+
+    DkFileValidator mFileValidator;
+    QDialogButtonBox *mButtons;
+    QLineEdit *mPathEdit;
+    QLabel *mFeedbackLabel;
+    DkBaseViewPort *mViewport;
+
+    QString mAcceptedFile;
+    QString mFile;
 };
 
-class DkAppManagerDialog : public QDialog {
-	Q_OBJECT
+class DkAppManagerDialog : public QDialog
+{
+    Q_OBJECT
 
 public:
-	DkAppManagerDialog(DkAppManager* manager = 0, QWidget* parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
+    DkAppManagerDialog(DkAppManager *manager = 0, QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
 
 public slots:
-	void on_addButton_clicked();
-	void on_deleteButton_clicked();
-	void on_runButton_clicked();
-	virtual void accept() override;
+    void on_addButton_clicked();
+    void on_deleteButton_clicked();
+    void on_runButton_clicked();
+    virtual void accept() override;
 
 signals:
-	void openWithSignal(QAction* act);
+    void openWithSignal(QAction *act);
 
 protected:
-	DkAppManager* manager;
-	QStandardItemModel* model;
+    DkAppManager *manager;
+    QStandardItemModel *model;
 
-	void createLayout();
-	QList<QStandardItem* > getItems(QAction* action);
-	QTableView* appTableView;
+    void createLayout();
+    QList<QStandardItem *> getItems(QAction *action);
+    QTableView *appTableView;
 };
 
-class DkSearchDialog : public QDialog {
-	Q_OBJECT
+class DkSearchDialog : public QDialog
+{
+    Q_OBJECT
 
 public:
+    enum Buttons {
+        cancel_button = 0,
+        find_button,
+        filter_button,
 
-	enum Buttons {
-		cancel_button = 0,
-		find_button,
-		filter_button,
-
-		button_end,
-	};
+        button_end,
+    };
 
-	DkSearchDialog(QWidget* parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
+    DkSearchDialog(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
 
-	void setFiles(const QStringList& fileList);
-	void setPath(const QString& dirPath);
-	bool filterPressed() const;
-	void setDefaultButton(int defaultButton = find_button);
+    void setFiles(const QStringList &fileList);
+    void setPath(const QString &dirPath);
+    bool filterPressed() const;
+    void setDefaultButton(int defaultButton = find_button);
 
 public slots:
-	void on_searchBar_textChanged(const QString& text);
-	void on_filterButton_pressed();
-	void on_resultListView_doubleClicked(const QModelIndex& modelIndex);
-	void on_resultListView_clicked(const QModelIndex& modelIndex);
-	virtual void accept() override;
+    void on_searchBar_textChanged(const QString &text);
+    void on_filterButton_pressed();
+    void on_resultListView_doubleClicked(const QModelIndex &modelIndex);
+    void on_resultListView_clicked(const QModelIndex &modelIndex);
+    virtual void accept() override;
 
 signals:
-	void loadFileSignal(const QString& filePath) const;
-	void filterSignal(const QString&) const;
+    void loadFileSignal(const QString &filePath) const;
+    void filterSignal(const QString &) const;
 
 protected:
+    void updateHistory();
+    void init();
+    QStringList makeViewable(const QStringList &resultList, bool forceAll = false);
 
-	void updateHistory();
-	void init();
-	QStringList makeViewable(const QStringList& resultList, bool forceAll = false);
+    QStringListModel *mStringModel = 0;
+    QListView *mResultListView = 0;
+    QLineEdit *mSearchBar = 0;
+    QDialogButtonBox *mButtons = 0;
 
-	QStringListModel* mStringModel = 0;
-	QListView* mResultListView = 0;
-	QLineEdit* mSearchBar = 0;
-	QDialogButtonBox* mButtons = 0;
+    QPushButton *mFilterButton = 0;
 
-	QPushButton* mFilterButton = 0;
+    QString mCurrentSearch;
 
-	QString mCurrentSearch;
+    QString mPath;
+    QStringList mFileList;
+    QStringList mResultList;
 
-	QString mPath;
-	QStringList mFileList;
-	QStringList mResultList;
+    QString mEndMessage;
 
-	QString mEndMessage;
-
-	bool mAllDisplayed = true;
-	bool mIsFilterPressed = false;
+    bool mAllDisplayed = true;
+    bool mIsFilterPressed = false;
 };
 
-class DkResizeDialog : public QDialog {
-	Q_OBJECT
+class DkResizeDialog : public QDialog
+{
+    Q_OBJECT
 
 public:
-	DkResizeDialog(QWidget* parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
-	~DkResizeDialog() {};
+    DkResizeDialog(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
+    ~DkResizeDialog(){};
 
-	enum{ipl_nearest, ipl_area, ipl_linear, ipl_cubic, ipl_lanczos, ipl_end};
-	enum{size_pixel, size_percent, size_end};
-	enum{unit_cm, unit_mm, unit_inch, unit_end};
-	enum{res_ppi, res_ppc, res_end};  
+    enum { ipl_nearest, ipl_area, ipl_linear, ipl_cubic, ipl_lanczos, ipl_end };
+    enum { size_pixel, size_percent, size_end };
+    enum { unit_cm, unit_mm, unit_inch, unit_end };
+    enum { res_ppi, res_ppc, res_end };
 
-	void setImage(const QImage& img);
-	QImage getResizedImage();
-	void setExifDpi(float exifDpi);
-	float getExifDpi();
-	bool resample();
+    void setImage(const QImage &img);
+    QImage getResizedImage();
+    void setExifDpi(float exifDpi);
+    float getExifDpi();
+    bool resample();
 
 protected slots:
-	void on_lockButtonDim_clicked();
-	void on_lockButton_clicked();
+    void on_lockButtonDim_clicked();
+    void on_lockButton_clicked();
 
-	void on_wPixelSpin_valueChanged(double val);
-	void on_hPixelSpin_valueChanged(double val);
+    void on_wPixelSpin_valueChanged(double val);
+    void on_hPixelSpin_valueChanged(double val);
 
-	void on_widthSpin_valueChanged(double val);
-	void on_heightSpin_valueChanged(double val);
-	void on_resolutionSpin_valueChanged(double val);
+    void on_widthSpin_valueChanged(double val);
+    void on_heightSpin_valueChanged(double val);
+    void on_resolutionSpin_valueChanged(double val);
 
-	void on_sizeBox_currentIndexChanged(int idx);
-	void on_unitBox_currentIndexChanged(int idx);
-	void on_resUnitBox_currentIndexChanged(int idx);
-	void on_resampleBox_currentIndexChanged(int idx);
+    void on_sizeBox_currentIndexChanged(int idx);
+    void on_unitBox_currentIndexChanged(int idx);
+    void on_resUnitBox_currentIndexChanged(int idx);
+    void on_resampleBox_currentIndexChanged(int idx);
 
-	void on_resampleCheck_clicked();
-	void on_gammaCorrection_clicked();
+    void on_resampleCheck_clicked();
+    void on_gammaCorrection_clicked();
 
-	void drawPreview();
+    void drawPreview();
 
-	void setVisible(bool visible) override;
+    void setVisible(bool visible) override;
 
 public slots:
-	virtual void accept() override;
+    virtual void accept() override;
 
 protected:
-	QImage mImg;
-	QLabel* mPreviewLabel = 0;
-	
-	DkBaseViewPort* mOrigView = 0;
-
-	// resize gui:
-	QDoubleSpinBox* mWPixelSpin = 0;
-	QDoubleSpinBox* mHPixelSpin = 0;
-	DkButton* mLockButton = 0;
-
-	QDoubleSpinBox* mWidthSpin = 0;
-	QDoubleSpinBox* mHeightSpin = 0;
-	QComboBox* mUnitBox = 0;
-	QComboBox* mSizeBox = 0;
-	DkButton* mLockButtonDim = 0;
-
-	QDoubleSpinBox* mResolutionSpin = 0;
-	QComboBox* mResUnitBox = 0;
-	QCheckBox* mResampleCheck = 0;
-	QCheckBox* mGammaCorrection = 0;
-	QComboBox* mResampleBox = 0;
-
-	float mExifDpi = 72;
-	QVector<float> mUnitFactor;
-	QVector<float> mResFactor;
-
-	void init();
-	void initBoxes(bool updateSettings = false);
-	void createLayout();
-	void updateSnippets();
-	void updateHeight();
-	void updateWidth();
-	void updatePixelWidth();
-	void updatePixelHeight();
-	void updateResolution();
-	void loadSettings();
-	void saveSettings();
-	QImage resizeImg(QImage img, bool silent = true);
-	void resizeEvent(QResizeEvent* re);
+    QImage mImg;
+    QLabel *mPreviewLabel = 0;
+
+    DkBaseViewPort *mOrigView = 0;
+
+    // resize gui:
+    QDoubleSpinBox *mWPixelSpin = 0;
+    QDoubleSpinBox *mHPixelSpin = 0;
+    DkButton *mLockButton = 0;
+
+    QDoubleSpinBox *mWidthSpin = 0;
+    QDoubleSpinBox *mHeightSpin = 0;
+    QComboBox *mUnitBox = 0;
+    QComboBox *mSizeBox = 0;
+    DkButton *mLockButtonDim = 0;
+
+    QDoubleSpinBox *mResolutionSpin = 0;
+    QComboBox *mResUnitBox = 0;
+    QCheckBox *mResampleCheck = 0;
+    QCheckBox *mGammaCorrection = 0;
+    QComboBox *mResampleBox = 0;
+
+    float mExifDpi = 72;
+    QVector<float> mUnitFactor;
+    QVector<float> mResFactor;
+
+    void init();
+    void initBoxes(bool updateSettings = false);
+    void createLayout();
+    void updateSnippets();
+    void updateHeight();
+    void updateWidth();
+    void updatePixelWidth();
+    void updatePixelHeight();
+    void updateResolution();
+    void loadSettings();
+    void saveSettings();
+    QImage resizeImg(QImage img, bool silent = true);
+    void resizeEvent(QResizeEvent *re);
 };
 
-class DkShortcutDelegate : public QItemDelegate {
-	Q_OBJECT
+class DkShortcutDelegate : public QItemDelegate
+{
+    Q_OBJECT
 
 public:
-	DkShortcutDelegate(QObject* parent = 0);
+    DkShortcutDelegate(QObject *parent = 0);
 
-	QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
-	QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
+    QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
+    QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
 
 signals:
-	void checkDuplicateSignal(const QString& text, void* item);
-	void checkDuplicateSignal(const QKeySequence& keySequence, void* item);
-	void clearDuplicateSignal() const;
+    void checkDuplicateSignal(const QString &text, void *item);
+    void checkDuplicateSignal(const QKeySequence &keySequence, void *item);
+    void clearDuplicateSignal() const;
 
 protected slots:
-	void textChanged(const QString& text = QString());
-	void keySequenceChanged(const QKeySequence& keySequence);
+    void textChanged(const QString &text = QString());
+    void keySequenceChanged(const QKeySequence &keySequence);
 
 protected:
-	bool editorEvent(QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index)  override;
-	void setEditorData(QWidget* editor, const QModelIndex& index) const override;
-	void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
-	void* mItem;
+    bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) override;
+    void setEditorData(QWidget *editor, const QModelIndex &index) const override;
+    void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
+    void *mItem;
 
-	QPixmap mClearPm;
+    QPixmap mClearPm;
 };
 
-class DkShortcutsModel : public QAbstractItemModel {
-	Q_OBJECT
+class DkShortcutsModel : public QAbstractItemModel
+{
+    Q_OBJECT
 
 public:
-	DkShortcutsModel(QObject* parent = 0);
-	~DkShortcutsModel();
+    DkShortcutsModel(QObject *parent = 0);
+    ~DkShortcutsModel();
 
-	QModelIndex index(int row, int column, const QModelIndex &parent) const;
-	QModelIndex parent(const QModelIndex &index) const;
+    QModelIndex index(int row, int column, const QModelIndex &parent) const;
+    QModelIndex parent(const QModelIndex &index) const;
 
-	// return item of the model
-	virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
-	virtual int columnCount(const QModelIndex& parent = QModelIndex()) const;
-	virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
-	virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
+    // return item of the model
+    virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
+    virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
+    virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+    virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
 
-	virtual Qt::ItemFlags flags(const QModelIndex& index) const;
-	virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
+    virtual Qt::ItemFlags flags(const QModelIndex &index) const;
+    virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
 
-	void addDataActions(QVector<QAction*> actions, const QString& name);
+    void addDataActions(QVector<QAction *> actions, const QString &name);
 
-	void resetActions();
-	void saveActions() const;
+    void resetActions();
+    void saveActions() const;
 
 public slots:
-	void checkDuplicate(const QString& text, void* item);		// deprecated (Qt4)
-	void checkDuplicate(const QKeySequence& ks, void* item);
-	void clearDuplicateInfo() const;
+    void checkDuplicate(const QString &text, void *item); // deprecated (Qt4)
+    void checkDuplicate(const QKeySequence &ks, void *item);
+    void clearDuplicateInfo() const;
 
 signals:
-	void duplicateSignal(const QString& info) const;
+    void duplicateSignal(const QString &info) const;
 
 protected:
-	TreeItem* mRootItem;
-	QVector<QVector<QAction*> > mActions;
-
+    TreeItem *mRootItem;
+    QVector<QVector<QAction *>> mActions;
 };
 
-class DkShortcutsDialog : public QDialog {
-	Q_OBJECT
+class DkShortcutsDialog : public QDialog
+{
+    Q_OBJECT
 
 public:
-	DkShortcutsDialog(QWidget* parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
+    DkShortcutsDialog(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
 
-	void addActions(const QVector<QAction*>& actions, const QString& name);
+    void addActions(const QVector<QAction *> &actions, const QString &name);
 
 public slots:
-	void accept() override;
+    void accept() override;
 
 protected slots:
-	void contextMenu(const QPoint& cur);
-	void defaultButtonClicked();
+    void contextMenu(const QPoint &cur);
+    void defaultButtonClicked();
 
 protected:
-	void createLayout();
-	
-	DkShortcutsModel* mModel;
-	QLabel* mNotificationLabel;
-	QPushButton* mDefaultButton;
+    void createLayout();
 
+    DkShortcutsModel *mModel;
+    QLabel *mNotificationLabel;
+    QPushButton *mDefaultButton;
 };
 
-class DkTextDialog : public QDialog {
-	Q_OBJECT
+class DkTextDialog : public QDialog
+{
+    Q_OBJECT
 
 public:
-	DkTextDialog(QWidget* parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
+    DkTextDialog(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
 
-	void setText(const QStringList& text);
-	QTextEdit* getTextEdit() { return textEdit; };
+    void setText(const QStringList &text);
+    QTextEdit *getTextEdit()
+    {
+        return textEdit;
+    };
 
 public slots:
-	virtual void save();
+    virtual void save();
 
 protected:
-	void createLayout();
+    void createLayout();
 
-	QTextEdit* textEdit;
+    QTextEdit *textEdit;
 };
 
-class DkUpdateDialog : public QDialog {
-	Q_OBJECT
+class DkUpdateDialog : public QDialog
+{
+    Q_OBJECT
 
 public:
-	DkUpdateDialog(QWidget* parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
-	QLabel* upperLabel;
+    DkUpdateDialog(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
+    QLabel *upperLabel;
 
 signals:
-	void startUpdate();
+    void startUpdate();
 
 protected slots:
-	void okButtonClicked();
+    void okButtonClicked();
 
 protected:
-	void init();
-	void createLayout();
+    void init();
+    void createLayout();
 
-		
-	QPushButton* okButton;
-	QPushButton* cancelButton;
+    QPushButton *okButton;
+    QPushButton *cancelButton;
 };
 
-class DkPrintImage {
-
+class DkPrintImage
+{
 public:
-	DkPrintImage(const QImage& img = QImage(), QPrinter* printer = 0);
+    DkPrintImage(const QImage &img = QImage(), QPrinter *printer = 0);
 
-	QImage image() const;
-	void draw(QPainter& p, bool highQuality = false);
+    QImage image() const;
+    void draw(QPainter &p, bool highQuality = false);
 
-	void fit();
-	void center();
-	void scale(double sf);
+    void fit();
+    void center();
+    void scale(double sf);
 
-	double dpi();
+    double dpi();
 
 private:
-	void center(QTransform & t) const;
+    void center(QTransform &t) const;
 
-	QImage mImg;
-	QPrinter* mPrinter;
+    QImage mImg;
+    QPrinter *mPrinter;
 
-	QTransform mTransform;
+    QTransform mTransform;
 };
 
-
-class DkPrintPreviewWidget : public QPrintPreviewWidget {
-	Q_OBJECT
+class DkPrintPreviewWidget : public QPrintPreviewWidget
+{
+    Q_OBJECT
 
 public:
-	DkPrintPreviewWidget(QPrinter* printer, QWidget* parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
+    DkPrintPreviewWidget(QPrinter *printer, QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
 
-	void setImage(const QImage& img);
-	void addImage(const QImage& img);
-	void fitImages();
+    void setImage(const QImage &img);
+    void addImage(const QImage &img);
+    void fitImages();
 
 public slots:
-	void paintForPrinting();
-	void paintPreview(QPrinter *printer);
-	void changeDpi(int value);
-	void centerImage();
+    void paintForPrinting();
+    void paintPreview(QPrinter *printer);
+    void changeDpi(int value);
+    void centerImage();
 
-	void setLandscapeOrientation();
-	void setPortraitOrientation();
+    void setLandscapeOrientation();
+    void setPortraitOrientation();
 
 signals:
-	void zoomChanged() const;
-	void dpiChanged(int dpi);
+    void zoomChanged() const;
+    void dpiChanged(int dpi);
 
 protected:
-	virtual void wheelEvent(QWheelEvent *event) override;
-	virtual void paintEvent(QPaintEvent *event) override;
+    virtual void wheelEvent(QWheelEvent *event) override;
+    virtual void paintEvent(QPaintEvent *event) override;
 
 private:
-	QPrinter* mPrinter;
-	QVector<QSharedPointer<DkPrintImage> > mPrintImages;
+    QPrinter *mPrinter;
+    QVector<QSharedPointer<DkPrintImage>> mPrintImages;
 };
 
-class DkPrintPreviewDialog : public QDialog {
-	Q_OBJECT
+class DkPrintPreviewDialog : public QDialog
+{
+    Q_OBJECT
 
 public:
-	enum icons{
-		print_fit_width,
-		print_fit_page,
-		print_zoom_out,
-		print_zoom_in,
-		print_reset_dpi,
-		print_portrait,
-		print_landscape,
-		print_setup,
-		print_printer,
-		print_end,
-	};
-
-	DkPrintPreviewDialog(QWidget* parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
-	
-	void setImage(const QImage& img);
-	void addImage(const QImage& img);
-
-	void init();
+    enum icons {
+        print_fit_width,
+        print_fit_page,
+        print_zoom_out,
+        print_zoom_in,
+        print_reset_dpi,
+        print_portrait,
+        print_landscape,
+        print_setup,
+        print_printer,
+        print_end,
+    };
+
+    DkPrintPreviewDialog(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
+
+    void setImage(const QImage &img);
+    void addImage(const QImage &img);
+
+    void init();
 
 protected:
-	void createLayout();
-	void createIcons();
+    void createLayout();
+    void createIcons();
 
 private slots:
-	void zoomIn();
-	void zoomOut();
-	void updateDpiFactor(qreal dpi);
-	void pageSetup();
-	void print();
+    void zoomIn();
+    void zoomOut();
+    void updateDpiFactor(qreal dpi);
+    void pageSetup();
+    void print();
 
-	void zoom(int scale);
-	void previewFitWidth();
-	void previewFitPage();
+    void zoom(int scale);
+    void previewFitWidth();
+    void previewFitPage();
 
 private:
-	QSpinBox* mDpiBox = 0;
+    QSpinBox *mDpiBox = 0;
 
-	DkPrintPreviewWidget* mPreview = 0;
-	QPrinter* mPrinter = 0;
+    DkPrintPreviewWidget *mPreview = 0;
+    QPrinter *mPrinter = 0;
 
-	QVector<QIcon> mIcons;
+    QVector<QIcon> mIcons;
 };
 
-class DkOpacityDialog : public QDialog {
-	Q_OBJECT
+class DkOpacityDialog : public QDialog
+{
+    Q_OBJECT
 
 public:
-	DkOpacityDialog(QWidget* parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
-	int value() const;
+    DkOpacityDialog(QWidget *parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
+    int value() const;
 
 protected:
-	void createLayout();
+    void createLayout();
 
-	DkSlider* slider;
+    DkSlider *slider;
 };
 
-class DkExportTiffDialog : public QDialog {
-	Q_OBJECT
+class DkExportTiffDialog : public QDialog
+{
+    Q_OBJECT
 
 public:
-	DkExportTiffDialog(QWidget* parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
+    DkExportTiffDialog(QWidget *parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
 
 public slots:
-	void on_openButton_pressed();
-	void on_saveButton_pressed();
-	void on_fileEdit_textChanged(const QString& filename);
-	void setFile(const QString& filePath);
-	void accept() override;
-	void reject() override;
-	int exportImages(const QString& saveFilePath, int from, int to, bool overwrite);
-	void processingFinished();
+    void on_openButton_pressed();
+    void on_saveButton_pressed();
+    void on_fileEdit_textChanged(const QString &filename);
+    void setFile(const QString &filePath);
+    void accept() override;
+    void reject() override;
+    int exportImages(const QString &saveFilePath, int from, int to, bool overwrite);
+    void processingFinished();
 
 signals:
-	void updateImage(const QImage& img) const;
-	void updateProgress(int) const;
-	void infoMessage(const QString& msg) const;
+    void updateImage(const QImage &img) const;
+    void updateProgress(int) const;
+    void infoMessage(const QString &msg) const;
 
 protected:
-	void createLayout();
-	void enableTIFFSave(bool enable);
-	void enableAll(bool enable);
-
-	void dropEvent(QDropEvent *event) override;
-	void dragEnterEvent(QDragEnterEvent *event) override;
-
-	DkBaseViewPort* mViewport;
-	QLabel* mTiffLabel;
-	QLabel* mFolderLabel;
-	QLineEdit* mFileEdit;
-	QComboBox* mSuffixBox;
-	QSpinBox* mFromPage;
-	QSpinBox* mToPage;
-	QDialogButtonBox* mButtons;
-	QProgressBar* mProgress;
-	QLabel* mMsgLabel;
-	QWidget* mControlWidget;
-	QCheckBox* mOverwrite;
-
-	QString mFilePath;
-	QString mSaveDirPath;
-	DkBasicLoader mLoader;
-	QFutureWatcher<int> mWatcher;
-
-	bool mProcessing = false;
-
-	enum {
-		finished,
-		question_save,
-		error,
-
-	};
+    void createLayout();
+    void enableTIFFSave(bool enable);
+    void enableAll(bool enable);
+
+    void dropEvent(QDropEvent *event) override;
+    void dragEnterEvent(QDragEnterEvent *event) override;
+
+    DkBaseViewPort *mViewport;
+    QLabel *mTiffLabel;
+    QLabel *mFolderLabel;
+    QLineEdit *mFileEdit;
+    QComboBox *mSuffixBox;
+    QSpinBox *mFromPage;
+    QSpinBox *mToPage;
+    QDialogButtonBox *mButtons;
+    QProgressBar *mProgress;
+    QLabel *mMsgLabel;
+    QWidget *mControlWidget;
+    QCheckBox *mOverwrite;
+
+    QString mFilePath;
+    QString mSaveDirPath;
+    DkBasicLoader mLoader;
+    QFutureWatcher<int> mWatcher;
+
+    bool mProcessing = false;
+
+    enum {
+        finished,
+        question_save,
+        error,
+
+    };
 };
 
 #ifdef WITH_OPENCV
 
-class DkMosaicDialog : public QDialog {
-	Q_OBJECT
+class DkMosaicDialog : public QDialog
+{
+    Q_OBJECT
 
 public:
-	DkMosaicDialog(QWidget* parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
-	QImage getImage();
+    DkMosaicDialog(QWidget *parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
+    QImage getImage();
 
 public slots:
-	void on_openButton_pressed();
-	void on_dbButton_pressed();
-	void on_fileEdit_textChanged(const QString& filename);
-	void on_newWidthBox_valueChanged(int i);
-	void on_newHeightBox_valueChanged(int i);
-	void on_numPatchesV_valueChanged(int i);
-	void on_numPatchesH_valueChanged(int i);
-	void on_darkenSlider_valueChanged(int i);
-	void on_lightenSlider_valueChanged(int i);
-	void on_saturationSlider_valueChanged(int i);
-	
-	void setFile(const QString& file);
-	void compute();
-	void reject() override;
-	int computeMosaic(const QString& filter, const QString& suffix, int from, int to);		// TODO: make const!
-	void mosaicFinished();
-	void postProcessFinished();
-	void buttonClicked(QAbstractButton* button);
-	void updatePatchRes();
+    void on_openButton_pressed();
+    void on_dbButton_pressed();
+    void on_fileEdit_textChanged(const QString &filename);
+    void on_newWidthBox_valueChanged(int i);
+    void on_newHeightBox_valueChanged(int i);
+    void on_numPatchesV_valueChanged(int i);
+    void on_numPatchesH_valueChanged(int i);
+    void on_darkenSlider_valueChanged(int i);
+    void on_lightenSlider_valueChanged(int i);
+    void on_saturationSlider_valueChanged(int i);
+
+    void setFile(const QString &file);
+    void compute();
+    void reject() override;
+    int computeMosaic(const QString &filter, const QString &suffix, int from, int to); // TODO: make const!
+    void mosaicFinished();
+    void postProcessFinished();
+    void buttonClicked(QAbstractButton *button);
+    void updatePatchRes();
 
 signals:
-	void updateImage(const QImage& img) const;
-	void updateProgress(int) const;
-	void infoMessage(const QString& msg) const;
+    void updateImage(const QImage &img) const;
+    void updateProgress(int) const;
+    void infoMessage(const QString &msg) const;
 
 protected:
-	void updatePostProcess();
-	bool postProcessMosaic(float multiply = 0.3f, float screen = 0.5f, float saturation = 0.5f, bool computePreview = true);
-	void createLayout();
-	void enableMosaicSave(bool enable);
-	void enableAll(bool enable);
-	QString getRandomImagePath(const QString& cPath, const QString& ignore, const QString& suffix);
-	void matchPatch(const cv::Mat& img, const cv::Mat& thumb, int patchRes, cv::Mat& cc);
-	cv::Mat createPatch(const DkThumbNail& thumb, int patchRes);
-
-	void dropEvent(QDropEvent *event) override;
-	void dragEnterEvent(QDragEnterEvent *event) override;
-
-	DkBaseViewPort* mViewport = 0;
-	DkBaseViewPort* mPreview = 0;
-	QLabel* mFileLabel = 0;
-	QLabel* mFolderLabel = 0;
-	QLineEdit* mFilterEdit = 0;
-	QComboBox* mSuffixBox = 0;
-	QSpinBox* mNewWidthBox = 0;
-	QSpinBox* mNewHeightBox = 0;
-	QSpinBox* mNumPatchesV = 0;
-	QSpinBox* mNumPatchesH = 0;
-	QDialogButtonBox* mButtons = 0;
-	QProgressBar* mProgress = 0;
-	QLabel* mMsgLabel = 0;
-	QWidget* mControlWidget = 0;
-	QCheckBox* mOverwrite = 0;
-	QLabel* mRealResLabel = 0;
-	QLabel* mPatchResLabel = 0;
-	
-	QWidget* mSliderWidget = 0;
-	QSlider* mDarkenSlider = 0;
-	QSlider* mLightenSlider = 0;
-	QSlider* mSaturationSlider = 0;
-
-	QString mFilePath;
-	QString mSavePath;
-	DkBasicLoader mLoader;
-	QFutureWatcher<int> mMosaicWatcher;
-	QFutureWatcher<bool> mPostProcessWatcher;
-
-	bool mUpdatePostProcessing = false;
-	bool mPostProcessing = false;
-	bool mProcessing = false;
-	cv::Mat mOrigImg;
-	cv::Mat mMosaicMat;
-	cv::Mat mMosaicMatSmall;
-	QImage mMosaic;
-	QVector<QFileInfo> mFilesUsed;
-
-	enum {
-		finished,
-		question_save,
-		error,
-
-	};
+    void updatePostProcess();
+    bool postProcessMosaic(float multiply = 0.3f, float screen = 0.5f, float saturation = 0.5f, bool computePreview = true);
+    void createLayout();
+    void enableMosaicSave(bool enable);
+    void enableAll(bool enable);
+    QString getRandomImagePath(const QString &cPath, const QString &ignore, const QString &suffix);
+    void matchPatch(const cv::Mat &img, const cv::Mat &thumb, int patchRes, cv::Mat &cc);
+    cv::Mat createPatch(const DkThumbNail &thumb, int patchRes);
+
+    void dropEvent(QDropEvent *event) override;
+    void dragEnterEvent(QDragEnterEvent *event) override;
+
+    DkBaseViewPort *mViewport = 0;
+    DkBaseViewPort *mPreview = 0;
+    QLabel *mFileLabel = 0;
+    QLabel *mFolderLabel = 0;
+    QLineEdit *mFilterEdit = 0;
+    QComboBox *mSuffixBox = 0;
+    QSpinBox *mNewWidthBox = 0;
+    QSpinBox *mNewHeightBox = 0;
+    QSpinBox *mNumPatchesV = 0;
+    QSpinBox *mNumPatchesH = 0;
+    QDialogButtonBox *mButtons = 0;
+    QProgressBar *mProgress = 0;
+    QLabel *mMsgLabel = 0;
+    QWidget *mControlWidget = 0;
+    QCheckBox *mOverwrite = 0;
+    QLabel *mRealResLabel = 0;
+    QLabel *mPatchResLabel = 0;
+
+    QWidget *mSliderWidget = 0;
+    QSlider *mDarkenSlider = 0;
+    QSlider *mLightenSlider = 0;
+    QSlider *mSaturationSlider = 0;
+
+    QString mFilePath;
+    QString mSavePath;
+    DkBasicLoader mLoader;
+    QFutureWatcher<int> mMosaicWatcher;
+    QFutureWatcher<bool> mPostProcessWatcher;
+
+    bool mUpdatePostProcessing = false;
+    bool mPostProcessing = false;
+    bool mProcessing = false;
+    cv::Mat mOrigImg;
+    cv::Mat mMosaicMat;
+    cv::Mat mMosaicMatSmall;
+    QImage mMosaic;
+    QVector<QFileInfo> mFilesUsed;
+
+    enum {
+        finished,
+        question_save,
+        error,
+
+    };
 };
 #endif
 
-class DkForceThumbDialog : public QDialog {
-	Q_OBJECT
+class DkForceThumbDialog : public QDialog
+{
+    Q_OBJECT
 
 public:
-	DkForceThumbDialog(QWidget* parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
+    DkForceThumbDialog(QWidget *parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
 
-	bool forceSave() const;
-	void setDir(const QDir& fileInfo);
+    bool forceSave() const;
+    void setDir(const QDir &fileInfo);
 
 protected:
-	void createLayout();
+    void createLayout();
 
-	QLabel* infoLabel;
-	QCheckBox* cbForceSave;
+    QLabel *infoLabel;
+    QCheckBox *cbForceSave;
 };
 
-class DkWelcomeDialog : public QDialog {
-	Q_OBJECT
+class DkWelcomeDialog : public QDialog
+{
+    Q_OBJECT
 
 public:
-	DkWelcomeDialog(QWidget* parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
+    DkWelcomeDialog(QWidget *parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
 
-	bool isLanguageChanged();
+    bool isLanguageChanged();
 
 public slots:
-	virtual void accept() override;
+    virtual void accept() override;
 
 protected:
-	void createLayout();
-	
-	QComboBox* mLanguageCombo = 0;
-	QCheckBox* mRegisterFilesCheckBox = 0;
-	QCheckBox* mSetAsDefaultCheckBox = 0;
-	QStringList mLanguages;
-	bool mLanguageChanged = false;
+    void createLayout();
+
+    QComboBox *mLanguageCombo = 0;
+    QCheckBox *mRegisterFilesCheckBox = 0;
+    QCheckBox *mSetAsDefaultCheckBox = 0;
+    QStringList mLanguages;
+    bool mLanguageChanged = false;
 };
 
-class DkSvgSizeDialog : public QDialog {
-	Q_OBJECT
+class DkSvgSizeDialog : public QDialog
+{
+    Q_OBJECT
 
 public:
-	DkSvgSizeDialog(const QSize& size, QWidget* parent);
+    DkSvgSizeDialog(const QSize &size, QWidget *parent);
 
-	QSize size() const;
+    QSize size() const;
 
 public slots:
-	void on_width_valueChanged(int val);
-	void on_height_valueChanged(int val);
+    void on_width_valueChanged(int val);
+    void on_height_valueChanged(int val);
 
 private:
-	void createLayout();
+    void createLayout();
 
-	enum {
-		b_width,
-		b_height,
+    enum {
+        b_width,
+        b_height,
 
-		b_end
-	};
+        b_end
+    };
 
-	double mARatio = 0;
-	QSize mSize;
-	QVector<QSpinBox*> mSizeBox;
+    double mARatio = 0;
+    QSize mSize;
+    QVector<QSpinBox *> mSizeBox;
 };
 
-class DkChooseMonitorDialog : public QDialog {
-	Q_OBJECT
+class DkChooseMonitorDialog : public QDialog
+{
+    Q_OBJECT
 
 public:
-	DkChooseMonitorDialog(QWidget* parent);
+    DkChooseMonitorDialog(QWidget *parent);
 
-	QRect screenRect() const;
-	bool showDialog() const;
+    QRect screenRect() const;
+    bool showDialog() const;
 
 public slots:
-	int exec() override;
+    int exec() override;
 
 private:
-	void createLayout();
-	QList<QScreen*> screens() const;
-	void loadSettings();
-	void saveSettings() const;
-
-	QList<QScreen*> mScreens;
-	DkDisplayWidget* mDisplayWidget;
-	QCheckBox* mCbRemember;
+    void createLayout();
+    QList<QScreen *> screens() const;
+    void loadSettings();
+    void saveSettings() const;
+
+    QList<QScreen *> mScreens;
+    DkDisplayWidget *mDisplayWidget;
+    QCheckBox *mCbRemember;
 };
 
-
 #ifdef WITH_QUAZIP
-class DkArchiveExtractionDialog : public QDialog {
-	Q_OBJECT
-	
+class DkArchiveExtractionDialog : public QDialog
+{
+    Q_OBJECT
+
 public:
-	DkArchiveExtractionDialog(QWidget* parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
+    DkArchiveExtractionDialog(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
 
-	void setCurrentFile(const QString& filePath, bool isZip);
+    void setCurrentFile(const QString &filePath, bool isZip);
 
 public slots:
-	void textChanged(const QString& text);
-	void checkbocChecked(int state);
-	void dirTextChanged(const QString& text);
-	void loadArchive(const QString& filePath = "");
-	void openArchive();
-	void openDir();
-	void accept() override;
+    void textChanged(const QString &text);
+    void checkbocChecked(int state);
+    void dirTextChanged(const QString &text);
+    void loadArchive(const QString &filePath = "");
+    void openArchive();
+    void openDir();
+    void accept() override;
 
 protected:
-	void dragEnterEvent(QDragEnterEvent *event) override;
-	void dropEvent(QDropEvent *event) override;
-
-	void createLayout();
-	void userFeedback(const QString& msg, bool error = false);
-	QStringList extractFilesWithProgress(const QString& fileCompressed, const QStringList& files, const QString& dir, bool removeSubfolders);
-
-	DkFileValidator mFileValidator;
-	QDialogButtonBox* mButtons = 0;
-	QLineEdit* mArchivePathEdit = 0;
-	QLineEdit* mDirPathEdit = 0;
-	QListWidget* mFileListDisplay = 0;
-	QLabel* mFeedbackLabel = 0;
-	QCheckBox* mRemoveSubfolders = 0;
-
-	QStringList mFileList;
-	QString mFilePath;
+    void dragEnterEvent(QDragEnterEvent *event) override;
+    void dropEvent(QDropEvent *event) override;
+
+    void createLayout();
+    void userFeedback(const QString &msg, bool error = false);
+    QStringList extractFilesWithProgress(const QString &fileCompressed, const QStringList &files, const QString &dir, bool removeSubfolders);
+
+    DkFileValidator mFileValidator;
+    QDialogButtonBox *mButtons = 0;
+    QLineEdit *mArchivePathEdit = 0;
+    QLineEdit *mDirPathEdit = 0;
+    QListWidget *mFileListDisplay = 0;
+    QLabel *mFeedbackLabel = 0;
+    QCheckBox *mRemoveSubfolders = 0;
+
+    QStringList mFileList;
+    QString mFilePath;
 };
 #endif
 
-class DkDialogManager : public QObject {
-	Q_OBJECT
+class DkDialogManager : public QObject
+{
+    Q_OBJECT
 
 public:
-	DkDialogManager(QObject* parent = 0);
+    DkDialogManager(QObject *parent = 0);
 
-	void setCentralWidget(DkCentralWidget* cw);
+    void setCentralWidget(DkCentralWidget *cw);
 
 public slots:
-	void openShortcutsDialog() const;
-	void openAppManager() const;
-	void openMosaicDialog() const;
-	void openPrintDialog() const;
+    void openShortcutsDialog() const;
+    void openAppManager() const;
+    void openMosaicDialog() const;
+    void openPrintDialog() const;
 
 private:
-	DkCentralWidget* mCentralWidget = 0;
+    DkCentralWidget *mCentralWidget = 0;
 };
 
 }
diff --git a/ImageLounge/src/DkGui/DkDockWidgets.cpp b/ImageLounge/src/DkGui/DkDockWidgets.cpp
index 5a122af..312c7e4 100644
--- a/ImageLounge/src/DkGui/DkDockWidgets.cpp
+++ b/ImageLounge/src/DkGui/DkDockWidgets.cpp
@@ -1,6 +1,6 @@
 /*******************************************************************************************************
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2016 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2016 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2016 Florian Kleber <florian@nomacs.org>
@@ -31,73 +31,72 @@
 #include "DkBasicLoader.h"
 #include "DkSettings.h"
 
-#pragma warning(push, 0)	// no warnings from includes
-#include <QVBoxLayout>
+#pragma warning(push, 0) // no warnings from includes
 #include <QListWidget>
+#include <QVBoxLayout>
 #pragma warning(pop)
 
-namespace nmc {
+namespace nmc
+{
 
-DkHistoryDock::DkHistoryDock(const QString& title, QWidget* parent) : DkDockWidget(title, parent) {
-
-	setObjectName("DkHistoryDock");
-	createLayout();
-	QMetaObject::connectSlotsByName(this);
+DkHistoryDock::DkHistoryDock(const QString &title, QWidget *parent)
+    : DkDockWidget(title, parent)
+{
+    setObjectName("DkHistoryDock");
+    createLayout();
+    QMetaObject::connectSlotsByName(this);
 }
 
-void DkHistoryDock::createLayout() {
-
-	mHistoryList = new QListWidget(this);
-	mHistoryList->setObjectName("historyList");
-	mHistoryList->setIconSize(QSize(DkSettingsManager::param().effectiveIconSize(), DkSettingsManager::param().effectiveIconSize()));
+void DkHistoryDock::createLayout()
+{
+    mHistoryList = new QListWidget(this);
+    mHistoryList->setObjectName("historyList");
+    mHistoryList->setIconSize(QSize(DkSettingsManager::param().effectiveIconSize(), DkSettingsManager::param().effectiveIconSize()));
 
-	QWidget* contentWidget = new QWidget(this);
-	QVBoxLayout* layout = new QVBoxLayout(contentWidget);
-	layout->addWidget(mHistoryList);
+    QWidget *contentWidget = new QWidget(this);
+    QVBoxLayout *layout = new QVBoxLayout(contentWidget);
+    layout->addWidget(mHistoryList);
 
-	setWidget(contentWidget);
+    setWidget(contentWidget);
 }
 
-void DkHistoryDock::updateImage(QSharedPointer<DkImageContainerT> img) {
-
-	updateList(img);
-	mImg = img;
+void DkHistoryDock::updateImage(QSharedPointer<DkImageContainerT> img)
+{
+    updateList(img);
+    mImg = img;
 }
 
-void DkHistoryDock::updateList(QSharedPointer<DkImageContainerT> img) {
+void DkHistoryDock::updateList(QSharedPointer<DkImageContainerT> img)
+{
+    QVector<DkEditImage> *history = img->getLoader()->history();
+    int hIdx = img->getLoader()->historyIndex();
+    QVector<QListWidgetItem *> editItems;
 
-	QVector<DkEditImage>* history = img->getLoader()->history();
-	int hIdx = img->getLoader()->historyIndex();
-	QVector<QListWidgetItem*> editItems;
+    mHistoryList->clear();
 
-	mHistoryList->clear();
+    for (int idx = 0; idx < history->size(); idx++) {
+        const DkEditImage &eImg = history->at(idx);
+        QListWidgetItem *item = new QListWidgetItem(QIcon(":/nomacs/img/nomacs.svg"), eImg.editName());
+        item->setFlags(idx <= hIdx ? Qt::ItemIsEnabled : Qt::NoItemFlags);
 
-	for (int idx = 0; idx < history->size(); idx++) {
-		
-		const DkEditImage& eImg = history->at(idx);
-		QListWidgetItem* item = new QListWidgetItem(QIcon(":/nomacs/img/nomacs.svg"), eImg.editName());
-		item->setFlags(idx <= hIdx ? Qt::ItemIsEnabled : Qt::NoItemFlags);
+        mHistoryList->addItem(item);
+    }
 
-		mHistoryList->addItem(item);
-	}
-
-	if (mHistoryList->item(hIdx))
-		mHistoryList->item(hIdx)->setSelected(true);
+    if (mHistoryList->item(hIdx))
+        mHistoryList->item(hIdx)->setSelected(true);
 }
 
-void DkHistoryDock::on_historyList_itemClicked(QListWidgetItem* item) {
-
-	if (!mImg)
-		return;
-
-	for (int idx = 0; idx < mHistoryList->count(); idx++) {
-
-		if (item == mHistoryList->item(idx)) {
-			mImg->setHistoryIndex(idx);
-			break;
-		}
-	}
-
+void DkHistoryDock::on_historyList_itemClicked(QListWidgetItem *item)
+{
+    if (!mImg)
+        return;
+
+    for (int idx = 0; idx < mHistoryList->count(); idx++) {
+        if (item == mHistoryList->item(idx)) {
+            mImg->setHistoryIndex(idx);
+            break;
+        }
+    }
 }
 
 }
diff --git a/ImageLounge/src/DkGui/DkDockWidgets.h b/ImageLounge/src/DkGui/DkDockWidgets.h
index 145de0c..4feb20e 100644
--- a/ImageLounge/src/DkGui/DkDockWidgets.h
+++ b/ImageLounge/src/DkGui/DkDockWidgets.h
@@ -1,6 +1,6 @@
 /*******************************************************************************************************
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2016 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2016 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2016 Florian Kleber <florian@nomacs.org>
@@ -28,10 +28,10 @@
 
 #pragma once
 
-#include "DkImageContainer.h"
 #include "DkBaseWidgets.h"
+#include "DkImageContainer.h"
 
-#pragma warning(push, 0)	// no warnings from includes
+#pragma warning(push, 0) // no warnings from includes
 #pragma warning(pop)
 
 #ifndef DllCoreExport
@@ -48,25 +48,27 @@
 class QListWidget;
 class QListWidgetItem;
 
-namespace nmc {
+namespace nmc
+{
 
 // nomacs defines
-class DllCoreExport DkHistoryDock : public DkDockWidget {
-	Q_OBJECT
+class DllCoreExport DkHistoryDock : public DkDockWidget
+{
+    Q_OBJECT
 
 public:
-	DkHistoryDock(const QString& title = "", QWidget* parent = 0);
+    DkHistoryDock(const QString &title = "", QWidget *parent = 0);
 
 public slots:
-	void updateImage(QSharedPointer<DkImageContainerT> img);
-	void on_historyList_itemClicked(QListWidgetItem* item);
+    void updateImage(QSharedPointer<DkImageContainerT> img);
+    void on_historyList_itemClicked(QListWidgetItem *item);
 
 protected:
-	void createLayout();
-	void updateList(QSharedPointer<DkImageContainerT> img);
+    void createLayout();
+    void updateList(QSharedPointer<DkImageContainerT> img);
 
-	QSharedPointer<DkImageContainerT> mImg;
-	QListWidget* mHistoryList;
-}; 
+    QSharedPointer<DkImageContainerT> mImg;
+    QListWidget *mHistoryList;
+};
 
 }
\ No newline at end of file
diff --git a/ImageLounge/src/DkGui/DkLogWidget.cpp b/ImageLounge/src/DkGui/DkLogWidget.cpp
index f4c39c9..9b41fb1 100644
--- a/ImageLounge/src/DkGui/DkLogWidget.cpp
+++ b/ImageLounge/src/DkGui/DkLogWidget.cpp
@@ -30,55 +30,58 @@ related links:
 
 #include "DkUtils.h"
 
-#pragma warning(push, 0)	// no warnings from includes
-#include <QTextEdit>
-#include <QVBoxLayout>
+#pragma warning(push, 0) // no warnings from includes
 #include <QAction>
 #include <QPushButton>
+#include <QTextEdit>
+#include <QVBoxLayout>
 #pragma warning(pop)
 
-namespace nmc {
+namespace nmc
+{
 
 QSharedPointer<DkMessageQueuer> msgQueuer = QSharedPointer<DkMessageQueuer>();
 
-// -------------------------------------------------------------------- DkLogWidget 
-DkLogWidget::DkLogWidget(QWidget* parent) : DkWidget(parent) {
-
-	setObjectName("logWidget");
-	createLayout();
+// -------------------------------------------------------------------- DkLogWidget
+DkLogWidget::DkLogWidget(QWidget *parent)
+    : DkWidget(parent)
+{
+    setObjectName("logWidget");
+    createLayout();
 
-	if (!msgQueuer)
-		msgQueuer = QSharedPointer<DkMessageQueuer>(new DkMessageQueuer());
+    if (!msgQueuer)
+        msgQueuer = QSharedPointer<DkMessageQueuer>(new DkMessageQueuer());
 
-	connect(msgQueuer.data(), SIGNAL(message(const QString &)), this, SLOT(log(const QString &)), Qt::QueuedConnection);
+    connect(msgQueuer.data(), SIGNAL(message(const QString &)), this, SLOT(log(const QString &)), Qt::QueuedConnection);
 
-	qInstallMessageHandler(widgetMessageHandler);
-	QMetaObject::connectSlotsByName(this);
+    qInstallMessageHandler(widgetMessageHandler);
+    QMetaObject::connectSlotsByName(this);
 }
 
-void DkLogWidget::log(const QString & msg) {
-
-	mTextEdit->append(msg);
+void DkLogWidget::log(const QString &msg)
+{
+    mTextEdit->append(msg);
 }
 
-void DkLogWidget::on_clearButton_pressed() {
-	mTextEdit->clear();
+void DkLogWidget::on_clearButton_pressed()
+{
+    mTextEdit->clear();
 }
 
-void DkLogWidget::createLayout() {
-
-	mTextEdit = new QTextEdit(this);
-	mTextEdit->setReadOnly(true);
+void DkLogWidget::createLayout()
+{
+    mTextEdit = new QTextEdit(this);
+    mTextEdit->setReadOnly(true);
 
-	QPushButton* clearButton = new QPushButton(this);
-	clearButton->setFlat(true);
-	clearButton->setObjectName("clearButton");
-	clearButton->setFixedSize(QSize(32, 32));
+    QPushButton *clearButton = new QPushButton(this);
+    clearButton->setFlat(true);
+    clearButton->setObjectName("clearButton");
+    clearButton->setFixedSize(QSize(32, 32));
 
-	QGridLayout* layout = new QGridLayout(this);
-	layout->setContentsMargins(0, 0, 0, 0);
-	layout->addWidget(mTextEdit, 1, 1);
-	layout->addWidget(clearButton, 1, 1, Qt::AlignRight | Qt::AlignTop);
+    QGridLayout *layout = new QGridLayout(this);
+    layout->setContentsMargins(0, 0, 0, 0);
+    layout->addWidget(mTextEdit, 1, 1);
+    layout->addWidget(clearButton, 1, 1, Qt::AlignRight | Qt::AlignTop);
 }
 
 /// <summary>
@@ -89,62 +92,59 @@ void DkLogWidget::createLayout() {
 /// <param name="type">The message type (QtDebugMsg are not written to the log).</param>
 /// <param name=""></param>
 /// <param name="msg">The message.</param>
-void widgetMessageHandler(QtMsgType type, const QMessageLogContext &, const QString &msg) {
-
-	if (msgQueuer) {
-		msgQueuer->log(type, msg);
-	}
+void widgetMessageHandler(QtMsgType type, const QMessageLogContext &, const QString &msg)
+{
+    if (msgQueuer) {
+        msgQueuer->log(type, msg);
+    }
 
-	DkUtils::logToFile(type, msg);
+    DkUtils::logToFile(type, msg);
 }
 
-
-// -------------------------------------------------------------------- DkLogDock 
-DkLogDock::DkLogDock(const QString& title, QWidget* parent, Qt::WindowFlags flags) : DkDockWidget(title, parent, flags) {
-	
-	setObjectName("logDock");
-	createLayout();
+// -------------------------------------------------------------------- DkLogDock
+DkLogDock::DkLogDock(const QString &title, QWidget *parent, Qt::WindowFlags flags)
+    : DkDockWidget(title, parent, flags)
+{
+    setObjectName("logDock");
+    createLayout();
 }
 
-void DkLogDock::createLayout() {
-	
-	DkLogWidget* logWidget = new DkLogWidget(this);
-	setWidget(logWidget);
+void DkLogDock::createLayout()
+{
+    DkLogWidget *logWidget = new DkLogWidget(this);
+    setWidget(logWidget);
 }
 
-DkMessageQueuer::DkMessageQueuer() {
+DkMessageQueuer::DkMessageQueuer()
+{
 }
 
-void DkMessageQueuer::log(QtMsgType type, const QString & msg) {
-
-	QString txt;
-
-#if QT_VERSION >= 0x050500
-	switch (type) {
-	case QtDebugMsg:
-		//return;	// ignore debug messages
-		txt = "<span style=\"color: #aaa\"><i>" + msg + "</i></span>";
-		break;
-	case QtInfoMsg:
-		txt = "<span style=\"color: #21729e\">" + msg + "</span>";
-		break;
-	case QtWarningMsg:
-		txt = "<span style=\"color: #e29b0d\">[Warning] " + msg + "</span>";
-		break;
-	case QtCriticalMsg:
-		txt = "<span style=\"color: #a81e1e\">[Critical] " + msg + "</span>";
-		break;
-	case QtFatalMsg:
-		txt = "<span style=\"color: #a81e1e\">[FATAL] " + msg + "</span>";
-		break;
-	default:
-		return;
-	}
-#else
-	txt = msg;
-#endif
-
-	emit message(txt);
+void DkMessageQueuer::log(QtMsgType type, const QString &msg)
+{
+    QString txt;
+
+    switch (type) {
+    case QtDebugMsg:
+        // return;	// ignore debug messages
+        txt = "<span style=\"color: #aaa\"><i>" + msg + "</i></span>";
+        break;
+    case QtInfoMsg:
+        txt = "<span style=\"color: #21729e\">" + msg + "</span>";
+        break;
+    case QtWarningMsg:
+        txt = "<span style=\"color: #e29b0d\">[Warning] " + msg + "</span>";
+        break;
+    case QtCriticalMsg:
+        txt = "<span style=\"color: #a81e1e\">[Critical] " + msg + "</span>";
+        break;
+    case QtFatalMsg:
+        txt = "<span style=\"color: #a81e1e\">[FATAL] " + msg + "</span>";
+        break;
+    default:
+        return;
+    }
+
+    emit message(txt);
 }
 
-}
\ No newline at end of file
+}
diff --git a/ImageLounge/src/DkGui/DkLogWidget.h b/ImageLounge/src/DkGui/DkLogWidget.h
index 609c78e..68dce1a 100644
--- a/ImageLounge/src/DkGui/DkLogWidget.h
+++ b/ImageLounge/src/DkGui/DkLogWidget.h
@@ -29,7 +29,7 @@
 
 #include "DkBaseWidgets.h"
 
-#pragma warning(push, 0)	// no warnings from includes
+#pragma warning(push, 0) // no warnings from includes
 #include <QWidget>
 #pragma warning(pop)
 
@@ -45,47 +45,50 @@
 
 class QTextEdit;
 
-namespace nmc {
-	
+namespace nmc
+{
+
 void widgetMessageHandler(QtMsgType type, const QMessageLogContext &, const QString &msg);
 
-class DkMessageQueuer : public QObject {
-	Q_OBJECT
+class DkMessageQueuer : public QObject
+{
+    Q_OBJECT
 
 public:
-	DkMessageQueuer();
+    DkMessageQueuer();
 
-	void log(QtMsgType type, const QString &msg);
+    void log(QtMsgType type, const QString &msg);
 
 signals:
-	void message(const QString &msg);
+    void message(const QString &msg);
 };
 
-
-class DkLogDock : public DkDockWidget {
-	Q_OBJECT
+class DkLogDock : public DkDockWidget
+{
+    Q_OBJECT
 
 public:
-	DkLogDock(const QString& title, QWidget* parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
+    DkLogDock(const QString &title, QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
 
 protected:
-	void createLayout();
+    void createLayout();
 };
 
-class DkLogWidget : public DkWidget {
-	Q_OBJECT
+class DkLogWidget : public DkWidget
+{
+    Q_OBJECT
 
 public:
-	DkLogWidget(QWidget* parent = 0);
+    DkLogWidget(QWidget *parent = 0);
 
 public slots:
-	void log(const QString &msg);
-	void on_clearButton_pressed();
+    void log(const QString &msg);
+    void on_clearButton_pressed();
 
 protected:
-	void createLayout();
+    void createLayout();
 
-	QTextEdit* mTextEdit;
+    QTextEdit *mTextEdit;
 };
 
 }
\ No newline at end of file
diff --git a/ImageLounge/src/DkGui/DkManipulatorWidgets.cpp b/ImageLounge/src/DkGui/DkManipulatorWidgets.cpp
index 8d42e13..6d7ad37 100644
--- a/ImageLounge/src/DkGui/DkManipulatorWidgets.cpp
+++ b/ImageLounge/src/DkGui/DkManipulatorWidgets.cpp
@@ -1,6 +1,6 @@
 /*******************************************************************************************************
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2016 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2016 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2016 Florian Kleber <florian@nomacs.org>
@@ -28,605 +28,653 @@
 
 #include "DkManipulatorWidgets.h"
 #include "DkActionManager.h"
-#include "DkWidgets.h"
-#include "DkTimer.h"
-#include "DkUtils.h"
-#include "DkSettings.h"
-#include "DkImageStorage.h"
 #include "DkBasicWidgets.h"
+#include "DkImageStorage.h"
 #include "DkManipulatorsIpl.h"
+#include "DkSettings.h"
+#include "DkTimer.h"
+#include "DkUtils.h"
+#include "DkWidgets.h"
 
-#pragma warning(push, 0)	// no warnings from includes
-#include <QVBoxLayout>
-#include <QLabel>
+#pragma warning(push, 0) // no warnings from includes
 #include <QButtonGroup>
 #include <QCheckBox>
 #include <QComboBox>
+#include <QLabel>
+#include <QVBoxLayout>
 #pragma warning(pop)
 
-namespace nmc {
-
+namespace nmc
+{
 // DkManipulatorWidget --------------------------------------------------------------------
-DkManipulatorWidget::DkManipulatorWidget(QWidget* parent) : DkFadeWidget(parent) {
-	
-	// create widgets
-	DkActionManager& am = DkActionManager::instance();
-	mWidgets << new DkTinyPlanetWidget(am.manipulatorManager().manipulatorExt(DkManipulatorManager::m_tiny_planet), this);
-	mWidgets << new DkBlurWidget(am.manipulatorManager().manipulatorExt(DkManipulatorManager::m_blur), this);
-	mWidgets << new DkUnsharpMaskWidget(am.manipulatorManager().manipulatorExt(DkManipulatorManager::m_unsharp_mask), this);
-	mWidgets << new DkRotateWidget(am.manipulatorManager().manipulatorExt(DkManipulatorManager::m_rotate), this);
-	mWidgets << new DkResizeWidget(am.manipulatorManager().manipulatorExt(DkManipulatorManager::m_resize), this);
-	mWidgets << new DkThresholdWidget(am.manipulatorManager().manipulatorExt(DkManipulatorManager::m_threshold), this);
-	mWidgets << new DkHueWidget(am.manipulatorManager().manipulatorExt(DkManipulatorManager::m_hue), this);
-	mWidgets << new DkColorWidget(am.manipulatorManager().manipulatorExt(DkManipulatorManager::m_color), this);
-	mWidgets << new DkExposureWidget(am.manipulatorManager().manipulatorExt(DkManipulatorManager::m_exposure), this);
-
-	setObjectName("DkPreferenceTabs");
-	createLayout();
-
-	for (QWidget* w : mWidgets)
-		w->setObjectName("darkManipulator");
-
-	for (QAction* a : am.manipulatorActions())
-		connect(a, SIGNAL(triggered()), this, SLOT(selectManipulator()), Qt::UniqueConnection);
-}
-
-void DkManipulatorWidget::createLayout() {
-
-	// actions
-	QWidget* actionWidget = new QWidget(this);
-	QVBoxLayout* aLayout = new QVBoxLayout(actionWidget);
-	aLayout->setAlignment(Qt::AlignTop);
-	aLayout->setContentsMargins(0, 0, 0, 0);
-	aLayout->setSpacing(0);
-
-	QButtonGroup* group = new QButtonGroup(this);
-
-	DkActionManager& am = DkActionManager::instance();
-	//for (QAction* a : am.manipulatorActions()) {	// if you want to get all
-	for (int idx = DkManipulatorManager::m_end; idx < DkManipulatorManager::m_ext_end; idx++) {
-
-		auto mpl = am.manipulatorManager().manipulatorExt((DkManipulatorManager::ManipulatorExtId)idx);
-
-		DkTabEntryWidget* entry = new DkTabEntryWidget(mpl->action()->icon(), mpl->name(), this);
-		connect(entry, SIGNAL(clicked()), mpl->action(), SIGNAL(triggered()), Qt::UniqueConnection);
-		
-		aLayout->addWidget(entry);
-		group->addButton(entry);
-	}
-
-	QString scrollbarStyle = 
-		QString("QScrollBar:vertical {border: 1px solid " + DkUtils::colorToString(DkSettingsManager::param().display().hudFgdColor) + "; background: rgba(0,0,0,0); width: 7px; margin: 0 0 0 0;}")
-		+ QString("QScrollBar::handle:vertical {background: " + DkUtils::colorToString(DkSettingsManager::param().display().hudFgdColor) + "; min-height: 0px;}")
-		+ QString("QScrollBar::add-line:vertical {height: 0px;}")
-		+ QString("QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {background: rgba(0,0,0,0); width: 1px;}")
-		+ QString("QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical {height: 0;}");
-
-	QScrollArea* actionScroller = new QScrollArea(this);
-	actionScroller->setStyleSheet(scrollbarStyle + actionScroller->styleSheet());
-	actionScroller->setWidgetResizable(true);
-	actionScroller->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
-	actionScroller->setWidget(actionWidget);
-	actionScroller->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-
-	// preview
-	mTitleLabel = new QLabel(this);
-	mTitleLabel->setObjectName("DkManipulatorSettingsTitle");
-	mPreview = new QLabel(this);
-	mPreview->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
-
-	// undo
-	QPixmap pm = DkImage::colorizePixmap(QIcon(":/nomacs/img/rotate-cc.svg").pixmap(QSize(32, 32)), QColor(255, 255, 255));
-	QPushButton* undoButton = new QPushButton(pm, "", this);
-	undoButton->setFlat(true);
-	undoButton->setIconSize(QSize(32, 32));
-	undoButton->setObjectName("dark");
-	undoButton->setStatusTip(tr("Undo"));
-	connect(undoButton, SIGNAL(clicked()), am.action(DkActionManager::menu_edit_undo), SIGNAL(triggered()));
-
-	pm = DkImage::colorizePixmap(QIcon(":/nomacs/img/rotate-cw.svg").pixmap(QSize(32, 32)), QColor(255, 255, 255));
-	QPushButton* redoButton = new QPushButton(pm, "", this);
-	redoButton->setFlat(true);
-	redoButton->setIconSize(QSize(32, 32));
-	redoButton->setObjectName("dark");
-	redoButton->setStatusTip(tr("Redo"));
-	connect(redoButton, SIGNAL(clicked()), am.action(DkActionManager::menu_edit_redo), SIGNAL(triggered()));
-
-	QWidget* buttonWidget = new QWidget(this);
-	QHBoxLayout* buttonLayout = new QHBoxLayout(buttonWidget);
-	buttonLayout->setContentsMargins(0, 0, 0, 0);
-	buttonLayout->addWidget(undoButton);
-	buttonLayout->addWidget(redoButton);
-
-	QWidget* mplWidget = new QWidget(this);
-	QVBoxLayout* mplLayout = new QVBoxLayout(mplWidget);
-	mplLayout->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
-	mplLayout->addWidget(mTitleLabel);
-	for (QWidget* w : mWidgets) 
-		mplLayout->addWidget(w);
-	mplLayout->addWidget(mPreview);
-	mplLayout->addWidget(buttonWidget);
-
-	QVBoxLayout* layout = new QVBoxLayout(this);
-	layout->setContentsMargins(0, 0, 0, 0);
-	layout->addWidget(actionScroller);
-	layout->addWidget(mplWidget);
-}
-
-QImage DkManipulatorWidget::scaledPreview(const QImage& img) const {
-
-	QImage imgR;
-
-	if (img.height() > img.width())
-		imgR = img.scaledToHeight(qMin(img.height(), mMaxPreview));
-	else
-		imgR = img.scaledToWidth(qMin(img.width(), mMaxPreview));
-
-	return imgR;
-}
-
-void DkManipulatorWidget::setImage(QSharedPointer<DkImageContainerT> imgC) {
-	mImgC = imgC;
-
-	if (mImgC) {
-
-		QImage img = mImgC->imageScaledToWidth(qMin(mPreview->width(), mMaxPreview));
-		img = scaledPreview(img);
-
-		mPreview->setPixmap(QPixmap::fromImage(img));
-		mPreview->show();
-	}
-	else
-		mPreview->hide();
-}
-
-void DkManipulatorWidget::selectManipulator() {
-
-	QAction* action = dynamic_cast<QAction*>(QObject::sender());
-
-	DkActionManager& am = DkActionManager::instance();
-	QSharedPointer<DkBaseManipulator> mpl = am.manipulatorManager().manipulator(action);
-	QSharedPointer<DkBaseManipulatorExt> mplExt = qSharedPointerDynamicCast<DkBaseManipulatorExt>(mpl);
-
-	// compute preview
-	if (mpl && mImgC) {
-		DkTimer dt;
-		QImage img = mpl->apply(mImgC->imageScaledToWidth(qMin(mPreview->width(), mMaxPreview)));
-		img = scaledPreview(img);
-
-		if (!img.isNull())
-			mPreview->setPixmap(QPixmap::fromImage(img));
-		qDebug() << "preview computed in " << dt;
-	}
-
-	for (QWidget* w : mWidgets)
-		w->hide();
-
-	if (!mplExt) {
-		mTitleLabel->hide();
-		return;
-	}
-
-	if (!mplExt->widget()) {
-		qCritical() << action->text() << "does not have a corresponding UI";
-		return;
-	}
-
-	mplExt->widget()->show();
-	mTitleLabel->setText(mpl->name());
+DkManipulatorWidget::DkManipulatorWidget(QWidget *parent)
+    : DkFadeWidget(parent)
+{
+    // create widgets
+    DkActionManager &am = DkActionManager::instance();
+    mWidgets << new DkTinyPlanetWidget(am.manipulatorManager().manipulatorExt(DkManipulatorManager::m_tiny_planet), this);
+    mWidgets << new DkBlurWidget(am.manipulatorManager().manipulatorExt(DkManipulatorManager::m_blur), this);
+    mWidgets << new DkUnsharpMaskWidget(am.manipulatorManager().manipulatorExt(DkManipulatorManager::m_unsharp_mask), this);
+    mWidgets << new DkRotateWidget(am.manipulatorManager().manipulatorExt(DkManipulatorManager::m_rotate), this);
+    mWidgets << new DkResizeWidget(am.manipulatorManager().manipulatorExt(DkManipulatorManager::m_resize), this);
+    mWidgets << new DkThresholdWidget(am.manipulatorManager().manipulatorExt(DkManipulatorManager::m_threshold), this);
+    mWidgets << new DkHueWidget(am.manipulatorManager().manipulatorExt(DkManipulatorManager::m_hue), this);
+    mWidgets << new DkColorWidget(am.manipulatorManager().manipulatorExt(DkManipulatorManager::m_color), this);
+    mWidgets << new DkExposureWidget(am.manipulatorManager().manipulatorExt(DkManipulatorManager::m_exposure), this);
+
+    setObjectName("DkPreferenceTabs");
+    createLayout();
+
+    for (QWidget *w : mWidgets)
+        w->setObjectName("darkManipulator");
+
+    for (QAction *a : am.manipulatorActions())
+        connect(a, SIGNAL(triggered()), this, SLOT(selectManipulator()), Qt::UniqueConnection);
+}
+
+void DkManipulatorWidget::createLayout()
+{
+    // actions
+    QWidget *actionWidget = new QWidget(this);
+    QVBoxLayout *aLayout = new QVBoxLayout(actionWidget);
+    aLayout->setAlignment(Qt::AlignTop);
+    aLayout->setContentsMargins(0, 0, 0, 0);
+    aLayout->setSpacing(0);
+
+    QButtonGroup *group = new QButtonGroup(this);
+
+    DkActionManager &am = DkActionManager::instance();
+    // for (QAction* a : am.manipulatorActions()) {	// if you want to get all
+    for (int idx = DkManipulatorManager::m_end; idx < DkManipulatorManager::m_ext_end; idx++) {
+        auto mpl = am.manipulatorManager().manipulatorExt((DkManipulatorManager::ManipulatorExtId)idx);
+
+        DkTabEntryWidget *entry = new DkTabEntryWidget(mpl->action()->icon(), mpl->name(), this);
+        connect(entry, SIGNAL(clicked()), mpl->action(), SIGNAL(triggered()), Qt::UniqueConnection);
+
+        aLayout->addWidget(entry);
+        group->addButton(entry);
+    }
+
+    QString scrollbarStyle = QString("QScrollBar:vertical {border: 1px solid " + DkUtils::colorToString(DkSettingsManager::param().display().hudFgdColor)
+                                     + "; background: rgba(0,0,0,0); width: 7px; margin: 0 0 0 0;}")
+        + QString("QScrollBar::handle:vertical {background: " + DkUtils::colorToString(DkSettingsManager::param().display().hudFgdColor)
+                  + "; min-height: 0px;}")
+        + QString("QScrollBar::add-line:vertical {height: 0px;}")
+        + QString("QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {background: rgba(0,0,0,0); width: 1px;}")
+        + QString("QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical {height: 0;}");
+
+    QScrollArea *actionScroller = new QScrollArea(this);
+    actionScroller->setStyleSheet(scrollbarStyle + actionScroller->styleSheet());
+    actionScroller->setWidgetResizable(true);
+    actionScroller->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
+    actionScroller->setWidget(actionWidget);
+    actionScroller->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+
+    // preview
+    mTitleLabel = new QLabel(this);
+    mTitleLabel->setObjectName("DkManipulatorSettingsTitle");
+    mPreview = new QLabel(this);
+    mPreview->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
+
+    // undo
+    QPixmap pm = DkImage::colorizePixmap(QIcon(":/nomacs/img/rotate-cc.svg").pixmap(QSize(32, 32)), QColor(255, 255, 255));
+    QPushButton *undoButton = new QPushButton(pm, "", this);
+    undoButton->setFlat(true);
+    undoButton->setIconSize(QSize(32, 32));
+    undoButton->setObjectName("DkRestartButton");
+    undoButton->setStatusTip(tr("Undo"));
+    connect(undoButton, SIGNAL(clicked()), am.action(DkActionManager::menu_edit_undo), SIGNAL(triggered()));
+
+    pm = DkImage::colorizePixmap(QIcon(":/nomacs/img/rotate-cw.svg").pixmap(QSize(32, 32)), QColor(255, 255, 255));
+    QPushButton *redoButton = new QPushButton(pm, "", this);
+    redoButton->setFlat(true);
+    redoButton->setIconSize(QSize(32, 32));
+    redoButton->setObjectName("DkRestartButton");
+    redoButton->setStatusTip(tr("Redo"));
+    connect(redoButton, SIGNAL(clicked()), am.action(DkActionManager::menu_edit_redo), SIGNAL(triggered()));
+
+    QWidget *buttonWidget = new QWidget(this);
+    QHBoxLayout *buttonLayout = new QHBoxLayout(buttonWidget);
+    buttonLayout->setContentsMargins(0, 0, 0, 0);
+    buttonLayout->addWidget(undoButton);
+    buttonLayout->addWidget(redoButton);
+
+    QWidget *mplWidget = new QWidget(this);
+    QVBoxLayout *mplLayout = new QVBoxLayout(mplWidget);
+    mplLayout->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
+    mplLayout->addWidget(mTitleLabel);
+    for (QWidget *w : mWidgets)
+        mplLayout->addWidget(w);
+    mplLayout->addWidget(mPreview);
+    mplLayout->addWidget(buttonWidget);
+
+    QVBoxLayout *layout = new QVBoxLayout(this);
+    layout->setContentsMargins(0, 0, 0, 0);
+    layout->addWidget(actionScroller);
+    layout->addWidget(mplWidget);
+}
+
+QImage DkManipulatorWidget::scaledPreview(const QImage &img) const
+{
+    QImage imgR;
+
+    if (img.height() > img.width())
+        imgR = img.scaledToHeight(qMin(img.height(), mMaxPreview));
+    else
+        imgR = img.scaledToWidth(qMin(img.width(), mMaxPreview));
+
+    return imgR;
+}
+
+void DkManipulatorWidget::setImage(QSharedPointer<DkImageContainerT> imgC)
+{
+    mImgC = imgC;
+
+    if (mImgC) {
+        QImage img = mImgC->imageScaledToWidth(qMin(mPreview->width(), mMaxPreview));
+        img = scaledPreview(img);
+
+        mPreview->setPixmap(QPixmap::fromImage(img));
+        mPreview->show();
+    } else
+        mPreview->hide();
+}
+
+void DkManipulatorWidget::selectManipulator()
+{
+    QAction *action = dynamic_cast<QAction *>(QObject::sender());
+
+    DkActionManager &am = DkActionManager::instance();
+    QSharedPointer<DkBaseManipulator> mpl = am.manipulatorManager().manipulator(action);
+    QSharedPointer<DkBaseManipulatorExt> mplExt = qSharedPointerDynamicCast<DkBaseManipulatorExt>(mpl);
+
+    // compute preview
+    if (mpl && mImgC) {
+        DkTimer dt;
+        QImage img = mpl->apply(mImgC->imageScaledToWidth(qMin(mPreview->width(), mMaxPreview)));
+        img = scaledPreview(img);
+
+        if (!img.isNull())
+            mPreview->setPixmap(QPixmap::fromImage(img));
+        qDebug() << "preview computed in " << dt;
+    }
+
+    for (QWidget *w : mWidgets)
+        w->hide();
+
+    if (!mplExt) {
+        mTitleLabel->hide();
+        return;
+    }
+
+    if (!mplExt->widget()) {
+        qCritical() << action->text() << "does not have a corresponding UI";
+        return;
+    }
+
+    mplExt->widget()->show();
+    mTitleLabel->setText(mpl->name());
 }
 
 // DkMainpulatorDoc --------------------------------------------------------------------
-DkEditDock::DkEditDock(const QString& title, QWidget* parent, Qt::WindowFlags flags) : DkDockWidget(title, parent, flags) {
-
-	setObjectName("DkEditDock");
-	createLayout();
+DkEditDock::DkEditDock(const QString &title, QWidget *parent, Qt::WindowFlags flags)
+    : DkDockWidget(title, parent, flags)
+{
+    setObjectName("DkEditDock");
+    createLayout();
 }
 
-void DkEditDock::createLayout() {
-
-	mMplWidget = new DkManipulatorWidget(this);
-	setWidget(mMplWidget);
+void DkEditDock::createLayout()
+{
+    mMplWidget = new DkManipulatorWidget(this);
+    setWidget(mMplWidget);
 }
 
-void DkEditDock::setImage(QSharedPointer<DkImageContainerT> imgC) {
-	mMplWidget->setImage(imgC);
+void DkEditDock::setImage(QSharedPointer<DkImageContainerT> imgC)
+{
+    mMplWidget->setImage(imgC);
 }
 
 // DkManipulatorWidget --------------------------------------------------------------------
-DkBaseManipulatorWidget::DkBaseManipulatorWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget* parent) : DkFadeWidget(parent) {
-	mBaseManipulator = manipulator;
+DkBaseManipulatorWidget::DkBaseManipulatorWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget *parent)
+    : DkFadeWidget(parent)
+{
+    mBaseManipulator = manipulator;
 }
 
-QSharedPointer<DkBaseManipulatorExt> DkBaseManipulatorWidget::baseManipulator() const {
-	return mBaseManipulator;
+QSharedPointer<DkBaseManipulatorExt> DkBaseManipulatorWidget::baseManipulator() const
+{
+    return mBaseManipulator;
 }
 
 // DkTinyPlanetWidget --------------------------------------------------------------------
-DkTinyPlanetWidget::DkTinyPlanetWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget* parent) : DkBaseManipulatorWidget(manipulator, parent) {
-	createLayout();
-	QMetaObject::connectSlotsByName(this);
+DkTinyPlanetWidget::DkTinyPlanetWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget *parent)
+    : DkBaseManipulatorWidget(manipulator, parent)
+{
+    createLayout();
+    QMetaObject::connectSlotsByName(this);
 
-	manipulator->setWidget(this);
+    manipulator->setWidget(this);
 }
 
-void DkTinyPlanetWidget::createLayout() {
+void DkTinyPlanetWidget::createLayout()
+{
+    // post processing sliders
+    DkSlider *scaleSlider = new DkSlider(tr("Planet Size"), this);
+    scaleSlider->setObjectName("scaleSlider");
+    scaleSlider->setMinimum(1);
+    scaleSlider->setMaximum(1000);
+    scaleSlider->setValue(manipulator()->size());
 
-	// post processing sliders
-	DkSlider* scaleSlider = new DkSlider(tr("Planet Size"), this);
-	scaleSlider->setObjectName("scaleSlider");
-	scaleSlider->setMinimum(1);
-	scaleSlider->setMaximum(1000);
-	scaleSlider->setValue(manipulator()->size());
+    DkSlider *angleSlider = new DkSlider(tr("Angle"), this);
+    angleSlider->setObjectName("angleSlider");
+    angleSlider->setValue(manipulator()->angle());
+    angleSlider->setMinimum(-180);
+    angleSlider->setMaximum(179);
 
-	DkSlider* angleSlider = new DkSlider(tr("Angle"), this);
-	angleSlider->setObjectName("angleSlider");
-	angleSlider->setValue(manipulator()->angle());
-	angleSlider->setMinimum(-180);
-	angleSlider->setMaximum(179);
+    QCheckBox *invertBox = new QCheckBox(tr("Invert Planet"), this);
+    invertBox->setObjectName("invertBox");
+    invertBox->setChecked(manipulator()->inverted());
 
-	QCheckBox* invertBox = new QCheckBox(tr("Invert Planet"), this);
-	invertBox->setObjectName("invertBox");
-	invertBox->setChecked(manipulator()->inverted());
-
-	QVBoxLayout* sliderLayout = new QVBoxLayout(this);
-	sliderLayout->addWidget(scaleSlider);
-	sliderLayout->addWidget(angleSlider);
-	sliderLayout->addWidget(invertBox);
+    QVBoxLayout *sliderLayout = new QVBoxLayout(this);
+    sliderLayout->addWidget(scaleSlider);
+    sliderLayout->addWidget(angleSlider);
+    sliderLayout->addWidget(invertBox);
 }
 
-void DkTinyPlanetWidget::on_scaleSlider_valueChanged(int val) {
-	manipulator()->setSize(val);
+void DkTinyPlanetWidget::on_scaleSlider_valueChanged(int val)
+{
+    manipulator()->setSize(val);
 }
 
-void DkTinyPlanetWidget::on_angleSlider_valueChanged(int val) {
-	manipulator()->setAngle(val);
+void DkTinyPlanetWidget::on_angleSlider_valueChanged(int val)
+{
+    manipulator()->setAngle(val);
 }
 
-void DkTinyPlanetWidget::on_invertBox_toggled(bool val) {
-	manipulator()->setInverted(val);
+void DkTinyPlanetWidget::on_invertBox_toggled(bool val)
+{
+    manipulator()->setInverted(val);
 }
 
-QSharedPointer<DkTinyPlanetManipulator> DkTinyPlanetWidget::manipulator() const {
-	return qSharedPointerDynamicCast<DkTinyPlanetManipulator>(baseManipulator());
+QSharedPointer<DkTinyPlanetManipulator> DkTinyPlanetWidget::manipulator() const
+{
+    return qSharedPointerDynamicCast<DkTinyPlanetManipulator>(baseManipulator());
 }
 
 // DkBlurWidget --------------------------------------------------------------------
-DkBlurWidget::DkBlurWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget* parent) : DkBaseManipulatorWidget(manipulator, parent) {
-	
-	createLayout();
-	QMetaObject::connectSlotsByName(this);
+DkBlurWidget::DkBlurWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget *parent)
+    : DkBaseManipulatorWidget(manipulator, parent)
+{
+    createLayout();
+    QMetaObject::connectSlotsByName(this);
 
-	manipulator->setWidget(this);
+    manipulator->setWidget(this);
 }
 
-void DkBlurWidget::createLayout() {
-
-	// post processing sliders
-	DkSlider* sigmaSlider = new DkSlider(tr("Sigma"), this);
-	sigmaSlider->setObjectName("sigmaSlider");
-	sigmaSlider->setValue(manipulator()->sigma());
-	sigmaSlider->setMaximum(50);
+void DkBlurWidget::createLayout()
+{
+    // post processing sliders
+    DkSlider *sigmaSlider = new DkSlider(tr("Sigma"), this);
+    sigmaSlider->setObjectName("sigmaSlider");
+    sigmaSlider->setValue(manipulator()->sigma());
+    sigmaSlider->setMaximum(50);
 
-	QVBoxLayout* sliderLayout = new QVBoxLayout(this);
-	sliderLayout->addWidget(sigmaSlider);
+    QVBoxLayout *sliderLayout = new QVBoxLayout(this);
+    sliderLayout->addWidget(sigmaSlider);
 }
 
-void DkBlurWidget::on_sigmaSlider_valueChanged(int val) {
-	manipulator()->setSigma(val);
+void DkBlurWidget::on_sigmaSlider_valueChanged(int val)
+{
+    manipulator()->setSigma(val);
 }
 
-QSharedPointer<DkBlurManipulator> DkBlurWidget::manipulator() const {
-	return qSharedPointerDynamicCast<DkBlurManipulator>(baseManipulator());
+QSharedPointer<DkBlurManipulator> DkBlurWidget::manipulator() const
+{
+    return qSharedPointerDynamicCast<DkBlurManipulator>(baseManipulator());
 }
 
 // DkUnsharpMaskWidget --------------------------------------------------------------------
-DkUnsharpMaskWidget::DkUnsharpMaskWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget* parent) : DkBaseManipulatorWidget(manipulator, parent) {
-	createLayout();
-	QMetaObject::connectSlotsByName(this);
+DkUnsharpMaskWidget::DkUnsharpMaskWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget *parent)
+    : DkBaseManipulatorWidget(manipulator, parent)
+{
+    createLayout();
+    QMetaObject::connectSlotsByName(this);
 
-	manipulator->setWidget(this);
+    manipulator->setWidget(this);
 }
 
-void DkUnsharpMaskWidget::createLayout() {
+void DkUnsharpMaskWidget::createLayout()
+{
+    // post processing sliders
+    DkSlider *sigmaSlider = new DkSlider(tr("Sigma"), this);
+    sigmaSlider->setObjectName("sigmaSlider");
+    sigmaSlider->setValue(manipulator()->sigma());
+    // darkenSlider->hide();
 
-	// post processing sliders
-	DkSlider* sigmaSlider = new DkSlider(tr("Sigma"), this);
-	sigmaSlider->setObjectName("sigmaSlider");
-	sigmaSlider->setValue(manipulator()->sigma());
-	//darkenSlider->hide();
+    DkSlider *amountSlider = new DkSlider(tr("Amount"), this);
+    amountSlider->setObjectName("amountSlider");
+    amountSlider->setValue(manipulator()->amount());
 
-	DkSlider* amountSlider = new DkSlider(tr("Amount"), this);
-	amountSlider->setObjectName("amountSlider");
-	amountSlider->setValue(manipulator()->amount());
-
-	QVBoxLayout* sliderLayout = new QVBoxLayout(this);
-	sliderLayout->addWidget(sigmaSlider);
-	sliderLayout->addWidget(amountSlider);
+    QVBoxLayout *sliderLayout = new QVBoxLayout(this);
+    sliderLayout->addWidget(sigmaSlider);
+    sliderLayout->addWidget(amountSlider);
 }
 
-void DkUnsharpMaskWidget::on_sigmaSlider_valueChanged(int val) {
-	manipulator()->setSigma(val);
+void DkUnsharpMaskWidget::on_sigmaSlider_valueChanged(int val)
+{
+    manipulator()->setSigma(val);
 }
 
-void DkUnsharpMaskWidget::on_amountSlider_valueChanged(int val) {
-	manipulator()->setAmount(val);
+void DkUnsharpMaskWidget::on_amountSlider_valueChanged(int val)
+{
+    manipulator()->setAmount(val);
 }
 
-QSharedPointer<DkUnsharpMaskManipulator> DkUnsharpMaskWidget::manipulator() const {
-	return qSharedPointerDynamicCast<DkUnsharpMaskManipulator>(baseManipulator());
+QSharedPointer<DkUnsharpMaskManipulator> DkUnsharpMaskWidget::manipulator() const
+{
+    return qSharedPointerDynamicCast<DkUnsharpMaskManipulator>(baseManipulator());
 }
 
 // DkRotateWidget --------------------------------------------------------------------
-DkRotateWidget::DkRotateWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget* parent) : DkBaseManipulatorWidget(manipulator, parent) {
-	createLayout();
-	QMetaObject::connectSlotsByName(this);
+DkRotateWidget::DkRotateWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget *parent)
+    : DkBaseManipulatorWidget(manipulator, parent)
+{
+    createLayout();
+    QMetaObject::connectSlotsByName(this);
 
-	manipulator->setWidget(this);
+    manipulator->setWidget(this);
 }
 
-QSharedPointer<DkRotateManipulator> DkRotateWidget::manipulator() const {
-	return qSharedPointerDynamicCast<DkRotateManipulator>(baseManipulator());
+QSharedPointer<DkRotateManipulator> DkRotateWidget::manipulator() const
+{
+    return qSharedPointerDynamicCast<DkRotateManipulator>(baseManipulator());
 }
 
-void DkRotateWidget::createLayout() {
-
-	DkSlider* angleSlider = new DkSlider(tr("Angle"), this);
-	angleSlider->setObjectName("angleSlider");
-	angleSlider->setValue(manipulator()->angle());
-	angleSlider->setMinimum(-180);
-	angleSlider->setMaximum(180);
+void DkRotateWidget::createLayout()
+{
+    DkSlider *angleSlider = new DkSlider(tr("Angle"), this);
+    angleSlider->setObjectName("angleSlider");
+    angleSlider->setValue(manipulator()->angle());
+    angleSlider->setMinimum(-180);
+    angleSlider->setMaximum(180);
 
-	QVBoxLayout* sliderLayout = new QVBoxLayout(this);
-	sliderLayout->addWidget(angleSlider);
+    QVBoxLayout *sliderLayout = new QVBoxLayout(this);
+    sliderLayout->addWidget(angleSlider);
 }
 
-void DkRotateWidget::on_angleSlider_valueChanged(int val) {
-	manipulator()->setAngle(val);
+void DkRotateWidget::on_angleSlider_valueChanged(int val)
+{
+    manipulator()->setAngle(val);
 }
 
 // DkRotateWidget --------------------------------------------------------------------
-DkResizeWidget::DkResizeWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget* parent) : DkBaseManipulatorWidget(manipulator, parent) {
-	createLayout();
-	QMetaObject::connectSlotsByName(this);
+DkResizeWidget::DkResizeWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget *parent)
+    : DkBaseManipulatorWidget(manipulator, parent)
+{
+    createLayout();
+    QMetaObject::connectSlotsByName(this);
 
-	manipulator->setWidget(this);
+    manipulator->setWidget(this);
 
-	// I would have loved setObjectName to be virtual : )
-	connect(this, SIGNAL(objectNameChanged(const QString&)), this, SLOT(onObjectNameChanged(const QString&)));
+    // I would have loved setObjectName to be virtual : )
+    connect(this, SIGNAL(objectNameChanged(const QString &)), this, SLOT(onObjectNameChanged(const QString &)));
 }
 
-QSharedPointer<DkResizeManipulator> DkResizeWidget::manipulator() const {
-	return qSharedPointerDynamicCast<DkResizeManipulator>(baseManipulator());
+QSharedPointer<DkResizeManipulator> DkResizeWidget::manipulator() const
+{
+    return qSharedPointerDynamicCast<DkResizeManipulator>(baseManipulator());
 }
 
-void DkResizeWidget::onObjectNameChanged(const QString & name) {
-	
-	if (name == "darkManipulator") {
-		// this is a hack: if we don't do this, nmc--DkBaseManipulatorWidget#darkManipulator QComboBox QAbstractItemView get's applied
-		// I have the feeling, that this is a Qt issue
-		// without this line, all styles are applied to the QComboBox but not to its drop down list (QAbstractItemView)
-		mIplBox->setStyleSheet(mIplBox->styleSheet() + " ");
-	}
+void DkResizeWidget::onObjectNameChanged(const QString &name)
+{
+    if (name == "darkManipulator") {
+        // this is a hack: if we don't do this, nmc--DkBaseManipulatorWidget#darkManipulator QComboBox QAbstractItemView get's applied
+        // I have the feeling, that this is a Qt issue
+        // without this line, all styles are applied to the QComboBox but not to its drop down list (QAbstractItemView)
+        mIplBox->setStyleSheet(mIplBox->styleSheet() + " ");
+    }
 }
 
-void DkResizeWidget::createLayout() {
+void DkResizeWidget::createLayout()
+{
+    DkDoubleSlider *scaleSlider = new DkDoubleSlider(tr("Scale"), this);
+    scaleSlider->setObjectName("scaleFactorSlider");
+    scaleSlider->setMinimum(0.1);
+    scaleSlider->setCenterValue(1.0);
+    scaleSlider->setMaximum(10);
+    scaleSlider->setValue(manipulator()->scaleFactor());
 
-	DkDoubleSlider* scaleSlider = new DkDoubleSlider(tr("Scale"), this);
-	scaleSlider->setObjectName("scaleFactorSlider");
-	scaleSlider->setMinimum(0.1);
-	scaleSlider->setCenterValue(1.0);
-	scaleSlider->setMaximum(10);
-	scaleSlider->setValue(manipulator()->scaleFactor());
+    mIplBox = new QComboBox(this);
+    mIplBox->setObjectName("iplBox");
+    mIplBox->setView(new QListView()); // needed for style
+    mIplBox->addItem(tr("Nearest Neighbor"), DkImage::ipl_nearest);
+    mIplBox->addItem(tr("Area (best for downscaling)"), DkImage::ipl_area);
+    mIplBox->addItem(tr("Linear"), DkImage::ipl_linear);
+    mIplBox->addItem(tr("Bicubic (4x4 interpolatia)"), DkImage::ipl_cubic);
+    mIplBox->addItem(tr("Lanczos (8x8 interpolation)"), DkImage::ipl_lanczos);
+    mIplBox->setCurrentIndex(1);
 
-	mIplBox = new QComboBox(this);
-	mIplBox->setObjectName("iplBox");
-	mIplBox->setView(new QListView());	// needed for style
-	mIplBox->addItem(tr("Nearest Neighbor"), DkImage::ipl_nearest);
-	mIplBox->addItem(tr("Area (best for downscaling)"), DkImage::ipl_area);
-	mIplBox->addItem(tr("Linear"), DkImage::ipl_linear);
-	mIplBox->addItem(tr("Bicubic (4x4 interpolatia)"), DkImage::ipl_cubic);
-	mIplBox->addItem(tr("Lanczos (8x8 interpolation)"), DkImage::ipl_lanczos);
-	mIplBox->setCurrentIndex(1);
+    QCheckBox *cbGamma = new QCheckBox(tr("Gamma Correction"), this);
+    cbGamma->setObjectName("gammaCorrection");
 
-	QCheckBox* cbGamma = new QCheckBox(tr("Gamma Correction"), this);
-	cbGamma->setObjectName("gammaCorrection");
-
-	QVBoxLayout* sliderLayout = new QVBoxLayout(this);
-	sliderLayout->setSpacing(10);
-	sliderLayout->addWidget(scaleSlider);
-	sliderLayout->addWidget(mIplBox);
-	sliderLayout->addWidget(cbGamma);
+    QVBoxLayout *sliderLayout = new QVBoxLayout(this);
+    sliderLayout->setSpacing(10);
+    sliderLayout->addWidget(scaleSlider);
+    sliderLayout->addWidget(mIplBox);
+    sliderLayout->addWidget(cbGamma);
 }
 
-void DkResizeWidget::on_scaleFactorSlider_valueChanged(double val) {
-	manipulator()->setScaleFactor(val);
+void DkResizeWidget::on_scaleFactorSlider_valueChanged(double val)
+{
+    manipulator()->setScaleFactor(val);
 }
 
-void DkResizeWidget::on_iplBox_currentIndexChanged(int idx) {
-	manipulator()->setInterpolation(mIplBox->itemData(idx).toInt());
+void DkResizeWidget::on_iplBox_currentIndexChanged(int idx)
+{
+    manipulator()->setInterpolation(mIplBox->itemData(idx).toInt());
 }
 
-void DkResizeWidget::on_gammaCorrection_toggled(bool checked) {
-	manipulator()->setCorrectGamma(checked);
+void DkResizeWidget::on_gammaCorrection_toggled(bool checked)
+{
+    manipulator()->setCorrectGamma(checked);
 }
 
 // DkThresholdWidget --------------------------------------------------------------------
-DkThresholdWidget::DkThresholdWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget* parent) : DkBaseManipulatorWidget(manipulator, parent) {
-	createLayout();
-	QMetaObject::connectSlotsByName(this);
+DkThresholdWidget::DkThresholdWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget *parent)
+    : DkBaseManipulatorWidget(manipulator, parent)
+{
+    createLayout();
+    QMetaObject::connectSlotsByName(this);
 
-	manipulator->setWidget(this);
+    manipulator->setWidget(this);
 }
 
-QSharedPointer<DkThresholdManipulator> DkThresholdWidget::manipulator() const {
-	return qSharedPointerDynamicCast<DkThresholdManipulator>(baseManipulator());
+QSharedPointer<DkThresholdManipulator> DkThresholdWidget::manipulator() const
+{
+    return qSharedPointerDynamicCast<DkThresholdManipulator>(baseManipulator());
 }
 
-void DkThresholdWidget::on_colBox_toggled(bool checked) {
-	manipulator()->setColor(checked);
+void DkThresholdWidget::on_colBox_toggled(bool checked)
+{
+    manipulator()->setColor(checked);
 }
 
-void DkThresholdWidget::createLayout() {
-
-	DkSlider* thrSlider = new DkSlider(tr("Threshold"), this);
-	thrSlider->setObjectName("thrSlider");
-	thrSlider->setValue(manipulator()->threshold());
-	thrSlider->setMinimum(0);
-	thrSlider->setMaximum(255);
-	thrSlider->setValue(manipulator()->threshold());
+void DkThresholdWidget::createLayout()
+{
+    DkSlider *thrSlider = new DkSlider(tr("Threshold"), this);
+    thrSlider->setObjectName("thrSlider");
+    thrSlider->setValue(manipulator()->threshold());
+    thrSlider->setMinimum(0);
+    thrSlider->setMaximum(255);
+    thrSlider->setValue(manipulator()->threshold());
 
-	QCheckBox* colBox = new QCheckBox(tr("Color"), this);
-	colBox->setObjectName("colBox");
-	colBox->setChecked(manipulator()->color());
+    QCheckBox *colBox = new QCheckBox(tr("Color"), this);
+    colBox->setObjectName("colBox");
+    colBox->setChecked(manipulator()->color());
 
-	QVBoxLayout* layout = new QVBoxLayout(this);
-	layout->addWidget(thrSlider);
-	layout->addWidget(colBox);
+    QVBoxLayout *layout = new QVBoxLayout(this);
+    layout->addWidget(thrSlider);
+    layout->addWidget(colBox);
 }
-void DkThresholdWidget::on_thrSlider_valueChanged(int val) {
-	manipulator()->setThreshold(val);
+void DkThresholdWidget::on_thrSlider_valueChanged(int val)
+{
+    manipulator()->setThreshold(val);
 }
 
-// -------------------------------------------------------------------- DkColorWidget 
-DkColorWidget::DkColorWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget* parent) : DkBaseManipulatorWidget(manipulator, parent) {
-	createLayout();
+// -------------------------------------------------------------------- DkColorWidget
+DkColorWidget::DkColorWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget *parent)
+    : DkBaseManipulatorWidget(manipulator, parent)
+{
+    createLayout();
 
-	QMetaObject::connectSlotsByName(this);
+    QMetaObject::connectSlotsByName(this);
 
-	manipulator->setWidget(this);
-	setMinimumHeight(150);
+    manipulator->setWidget(this);
+    setMinimumHeight(150);
 }
 
-QSharedPointer<DkColorManipulator> DkColorWidget::manipulator() const {
-	return qSharedPointerDynamicCast<DkColorManipulator>(baseManipulator());
+QSharedPointer<DkColorManipulator> DkColorWidget::manipulator() const
+{
+    return qSharedPointerDynamicCast<DkColorManipulator>(baseManipulator());
 }
 
-void DkColorWidget::createLayout() {
+void DkColorWidget::createLayout()
+{
+    DkColorPicker *cp = new DkColorPicker(this);
+    cp->setObjectName("colPicker");
 
-	DkColorPicker* cp = new DkColorPicker(this);
-	cp->setObjectName("colPicker");
-
-	QVBoxLayout* l = new QVBoxLayout(this);
-	l->setContentsMargins(0, 0, 0, 0);
-	l->addWidget(cp);
+    QVBoxLayout *l = new QVBoxLayout(this);
+    l->setContentsMargins(0, 0, 0, 0);
+    l->addWidget(cp);
 }
 
-void DkColorWidget::on_colPicker_colorSelected(const QColor& col) {
-	manipulator()->setColor(col);
+void DkColorWidget::on_colPicker_colorSelected(const QColor &col)
+{
+    manipulator()->setColor(col);
 }
 
 // DkHueWidget --------------------------------------------------------------------
-DkHueWidget::DkHueWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget* parent) : DkBaseManipulatorWidget(manipulator, parent) {
-	createLayout();
-	QMetaObject::connectSlotsByName(this);
+DkHueWidget::DkHueWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget *parent)
+    : DkBaseManipulatorWidget(manipulator, parent)
+{
+    createLayout();
+    QMetaObject::connectSlotsByName(this);
 
-	manipulator->setWidget(this);
+    manipulator->setWidget(this);
 }
 
-
-QSharedPointer<DkHueManipulator> DkHueWidget::manipulator() const {
-	return qSharedPointerDynamicCast<DkHueManipulator>(baseManipulator());
+QSharedPointer<DkHueManipulator> DkHueWidget::manipulator() const
+{
+    return qSharedPointerDynamicCast<DkHueManipulator>(baseManipulator());
 }
 
-void DkHueWidget::createLayout() {
+void DkHueWidget::createLayout()
+{
+    DkSlider *hueSlider = new DkSlider(tr("Hue"), this);
+    hueSlider->setObjectName("hueSlider");
+    hueSlider->getSlider()->setObjectName("DkHueSlider");
+    hueSlider->setValue(manipulator()->hue());
+    hueSlider->setMinimum(-180);
+    hueSlider->setMaximum(180);
 
-	DkSlider* hueSlider = new DkSlider(tr("Hue"), this);
-	hueSlider->setObjectName("hueSlider");
-	hueSlider->getSlider()->setObjectName("DkHueSlider");
-	hueSlider->setValue(manipulator()->hue());
-	hueSlider->setMinimum(-180);
-	hueSlider->setMaximum(180);
+    DkSlider *satSlider = new DkSlider(tr("Saturation"), this);
+    satSlider->setObjectName("satSlider");
+    satSlider->getSlider()->setObjectName("DkSaturationSlider");
+    satSlider->setValue(manipulator()->saturation());
+    satSlider->setMinimum(-100);
+    satSlider->setMaximum(100);
 
-	DkSlider* satSlider = new DkSlider(tr("Saturation"), this);
-	satSlider->setObjectName("satSlider");
-	satSlider->getSlider()->setObjectName("DkSaturationSlider");
-	satSlider->setValue(manipulator()->saturation());
-	satSlider->setMinimum(-100);
-	satSlider->setMaximum(100);
+    DkSlider *brightnessSlider = new DkSlider(tr("Brightness"), this);
+    brightnessSlider->setObjectName("brightnessSlider");
+    brightnessSlider->getSlider()->setObjectName("DkBrightnessSlider");
+    brightnessSlider->setValue(manipulator()->hue());
+    brightnessSlider->setMinimum(-100);
+    brightnessSlider->setMaximum(100);
 
-	DkSlider* brightnessSlider = new DkSlider(tr("Brightness"), this);
-	brightnessSlider->setObjectName("brightnessSlider");
-	brightnessSlider->getSlider()->setObjectName("DkBrightnessSlider");
-	brightnessSlider->setValue(manipulator()->hue());
-	brightnessSlider->setMinimum(-100);
-	brightnessSlider->setMaximum(100);
-
-	QVBoxLayout* sliderLayout = new QVBoxLayout(this);
-	sliderLayout->addWidget(hueSlider);
-	sliderLayout->addWidget(satSlider);
-	sliderLayout->addWidget(brightnessSlider);
+    QVBoxLayout *sliderLayout = new QVBoxLayout(this);
+    sliderLayout->addWidget(hueSlider);
+    sliderLayout->addWidget(satSlider);
+    sliderLayout->addWidget(brightnessSlider);
 }
 
-void DkHueWidget::on_hueSlider_valueChanged(int val) {
-	manipulator()->setHue(val);
+void DkHueWidget::on_hueSlider_valueChanged(int val)
+{
+    manipulator()->setHue(val);
 }
 
-void DkHueWidget::on_satSlider_valueChanged(int val) {
-	manipulator()->setSaturation(val);
+void DkHueWidget::on_satSlider_valueChanged(int val)
+{
+    manipulator()->setSaturation(val);
 }
 
-void DkHueWidget::on_brightnessSlider_valueChanged(int val) {
-	manipulator()->setValue(val);
+void DkHueWidget::on_brightnessSlider_valueChanged(int val)
+{
+    manipulator()->setValue(val);
 }
 
 // DkExposureWidget --------------------------------------------------------------------
-DkExposureWidget::DkExposureWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget* parent) : DkBaseManipulatorWidget(manipulator, parent) {
-	createLayout();
-	QMetaObject::connectSlotsByName(this);
-
-	manipulator->setWidget(this);
-}
-
-QSharedPointer<DkExposureManipulator> DkExposureWidget::manipulator() const {
-	return qSharedPointerDynamicCast<DkExposureManipulator>(baseManipulator());
-}
-
-void DkExposureWidget::createLayout() {
-
-	DkDoubleSlider* exposureSlider = new DkDoubleSlider(tr("Exposure"), this);
-	exposureSlider->setObjectName("exposureSlider");
-	exposureSlider->setMinimum(-3);
-	exposureSlider->setMaximum(3);
-	exposureSlider->setTickInterval(0.0005);
-	exposureSlider->setValue(manipulator()->exposure());
-
-	DkDoubleSlider* offsetSlider = new DkDoubleSlider(tr("Offset"), this);
-	offsetSlider->setObjectName("offsetSlider");
-	offsetSlider->setMinimum(-0.5);
-	offsetSlider->setMaximum(0.5);
-	offsetSlider->setTickInterval(0.001);
-	offsetSlider->setValue(manipulator()->offset());
-
-	DkDoubleSlider* gammaSlider = new DkDoubleSlider(tr("Gamma"), this);
-	gammaSlider->setObjectName("gammaSlider");
-	gammaSlider->setMinimum(0);
-	gammaSlider->setCenterValue(1);
-	gammaSlider->setMaximum(10);
-	gammaSlider->setTickInterval(0.001);
-	gammaSlider->setSliderInverted(true);
-	gammaSlider->setValue(manipulator()->gamma());
-
-	QVBoxLayout* sliderLayout = new QVBoxLayout(this);
-	sliderLayout->addWidget(exposureSlider);
-	sliderLayout->addWidget(offsetSlider);
-	sliderLayout->addWidget(gammaSlider);
-}
-
-void DkExposureWidget::on_exposureSlider_valueChanged(double val) {
-
-	double tv = val*val;
-	if (val < 0)
-		tv *= -1.0;
-	manipulator()->setExposure(tv);
-}
-
-void DkExposureWidget::on_offsetSlider_valueChanged(double val) {
-	manipulator()->setOffset(val);
-}
-
-void DkExposureWidget::on_gammaSlider_valueChanged(double val) {
-	manipulator()->setGamma(val);
+DkExposureWidget::DkExposureWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget *parent)
+    : DkBaseManipulatorWidget(manipulator, parent)
+{
+    createLayout();
+    QMetaObject::connectSlotsByName(this);
+
+    manipulator->setWidget(this);
+}
+
+QSharedPointer<DkExposureManipulator> DkExposureWidget::manipulator() const
+{
+    return qSharedPointerDynamicCast<DkExposureManipulator>(baseManipulator());
+}
+
+void DkExposureWidget::createLayout()
+{
+    DkDoubleSlider *exposureSlider = new DkDoubleSlider(tr("Exposure"), this);
+    exposureSlider->setObjectName("exposureSlider");
+    exposureSlider->setMinimum(-3);
+    exposureSlider->setMaximum(3);
+    exposureSlider->setTickInterval(0.0005);
+    exposureSlider->setValue(manipulator()->exposure());
+
+    DkDoubleSlider *offsetSlider = new DkDoubleSlider(tr("Offset"), this);
+    offsetSlider->setObjectName("offsetSlider");
+    offsetSlider->setMinimum(-0.5);
+    offsetSlider->setMaximum(0.5);
+    offsetSlider->setTickInterval(0.001);
+    offsetSlider->setValue(manipulator()->offset());
+
+    DkDoubleSlider *gammaSlider = new DkDoubleSlider(tr("Gamma"), this);
+    gammaSlider->setObjectName("gammaSlider");
+    gammaSlider->setMinimum(0);
+    gammaSlider->setCenterValue(1);
+    gammaSlider->setMaximum(10);
+    gammaSlider->setTickInterval(0.001);
+    gammaSlider->setSliderInverted(true);
+    gammaSlider->setValue(manipulator()->gamma());
+
+    QVBoxLayout *sliderLayout = new QVBoxLayout(this);
+    sliderLayout->addWidget(exposureSlider);
+    sliderLayout->addWidget(offsetSlider);
+    sliderLayout->addWidget(gammaSlider);
+}
+
+void DkExposureWidget::on_exposureSlider_valueChanged(double val)
+{
+    double tv = val * val;
+    if (val < 0)
+        tv *= -1.0;
+    manipulator()->setExposure(tv);
+}
+
+void DkExposureWidget::on_offsetSlider_valueChanged(double val)
+{
+    manipulator()->setOffset(val);
+}
+
+void DkExposureWidget::on_gammaSlider_valueChanged(double val)
+{
+    manipulator()->setGamma(val);
 }
 
 }
\ No newline at end of file
diff --git a/ImageLounge/src/DkGui/DkManipulatorWidgets.h b/ImageLounge/src/DkGui/DkManipulatorWidgets.h
index 85bc2a1..b548f2e 100644
--- a/ImageLounge/src/DkGui/DkManipulatorWidgets.h
+++ b/ImageLounge/src/DkGui/DkManipulatorWidgets.h
@@ -1,6 +1,6 @@
 /*******************************************************************************************************
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2016 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2016 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2016 Florian Kleber <florian@nomacs.org>
@@ -32,7 +32,7 @@
 #include "DkImageContainer.h"
 #include "DkManipulatorsIpl.h"
 
-#pragma warning(push, 0)	// no warnings from includes
+#pragma warning(push, 0) // no warnings from includes
 
 #pragma warning(pop)
 
@@ -48,214 +48,220 @@
 
 // Qt defines
 
-namespace nmc {
+namespace nmc
+{
 
 // nomacs defines
 
-class DkBaseManipulatorWidget : public DkFadeWidget {
-	Q_OBJECT
+class DkBaseManipulatorWidget : public DkFadeWidget
+{
+    Q_OBJECT
 
 public:
-	DkBaseManipulatorWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget* parent = 0);
+    DkBaseManipulatorWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget *parent = 0);
 
-	QSharedPointer<DkBaseManipulatorExt> baseManipulator() const;
+    QSharedPointer<DkBaseManipulatorExt> baseManipulator() const;
 
 private:
-	QSharedPointer<DkBaseManipulatorExt> mBaseManipulator;
+    QSharedPointer<DkBaseManipulatorExt> mBaseManipulator;
 };
 
-class DkTinyPlanetWidget : public DkBaseManipulatorWidget {
-	Q_OBJECT
+class DkTinyPlanetWidget : public DkBaseManipulatorWidget
+{
+    Q_OBJECT
 
 public:
-	DkTinyPlanetWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget* parent = 0);
+    DkTinyPlanetWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget *parent = 0);
 
-	QSharedPointer<DkTinyPlanetManipulator> manipulator() const;
+    QSharedPointer<DkTinyPlanetManipulator> manipulator() const;
 
 public slots:
-	void on_scaleSlider_valueChanged(int val);
-	void on_angleSlider_valueChanged(int val);
-	void on_invertBox_toggled(bool val);
+    void on_scaleSlider_valueChanged(int val);
+    void on_angleSlider_valueChanged(int val);
+    void on_invertBox_toggled(bool val);
 
 private:
-	void createLayout();
+    void createLayout();
 };
 
-class DkBlurWidget : public DkBaseManipulatorWidget {
-	Q_OBJECT
+class DkBlurWidget : public DkBaseManipulatorWidget
+{
+    Q_OBJECT
 
 public:
-	DkBlurWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget* parent = 0);
+    DkBlurWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget *parent = 0);
 
-	QSharedPointer<DkBlurManipulator> manipulator() const;
+    QSharedPointer<DkBlurManipulator> manipulator() const;
 
 public slots:
-	void on_sigmaSlider_valueChanged(int val);
+    void on_sigmaSlider_valueChanged(int val);
 
 private:
-	void createLayout();
-
+    void createLayout();
 };
 
-class DkUnsharpMaskWidget : public DkBaseManipulatorWidget {
-	Q_OBJECT
+class DkUnsharpMaskWidget : public DkBaseManipulatorWidget
+{
+    Q_OBJECT
 
 public:
-	DkUnsharpMaskWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget* parent = 0);
+    DkUnsharpMaskWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget *parent = 0);
 
-	QSharedPointer<DkUnsharpMaskManipulator> manipulator() const;
+    QSharedPointer<DkUnsharpMaskManipulator> manipulator() const;
 
 public slots:
-	void on_sigmaSlider_valueChanged(int val);
-	void on_amountSlider_valueChanged(int val);
+    void on_sigmaSlider_valueChanged(int val);
+    void on_amountSlider_valueChanged(int val);
 
 private:
-	void createLayout();
-
+    void createLayout();
 };
 
-class DkRotateWidget : public DkBaseManipulatorWidget {
-	Q_OBJECT
+class DkRotateWidget : public DkBaseManipulatorWidget
+{
+    Q_OBJECT
 
 public:
-	DkRotateWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget* parent = 0);
+    DkRotateWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget *parent = 0);
 
-	QSharedPointer<DkRotateManipulator> manipulator() const;
+    QSharedPointer<DkRotateManipulator> manipulator() const;
 
 public slots:
-	void on_angleSlider_valueChanged(int val);
+    void on_angleSlider_valueChanged(int val);
 
 private:
-	void createLayout();
-
+    void createLayout();
 };
 
-class DkResizeWidget : public DkBaseManipulatorWidget {
-	Q_OBJECT
+class DkResizeWidget : public DkBaseManipulatorWidget
+{
+    Q_OBJECT
 
 public:
-	DkResizeWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget* parent = 0);
+    DkResizeWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget *parent = 0);
 
-	QSharedPointer<DkResizeManipulator> manipulator() const;
+    QSharedPointer<DkResizeManipulator> manipulator() const;
 
 public slots:
-	void on_scaleFactorSlider_valueChanged(double val);
-	void on_iplBox_currentIndexChanged(int idx);
-	void on_gammaCorrection_toggled(bool checked);
-	void onObjectNameChanged(const QString& name);
+    void on_scaleFactorSlider_valueChanged(double val);
+    void on_iplBox_currentIndexChanged(int idx);
+    void on_gammaCorrection_toggled(bool checked);
+    void onObjectNameChanged(const QString &name);
 
 private:
-	void createLayout();
-
-	QComboBox* mIplBox;
+    void createLayout();
 
+    QComboBox *mIplBox;
 };
 
-class DkThresholdWidget : public DkBaseManipulatorWidget {
-	Q_OBJECT
+class DkThresholdWidget : public DkBaseManipulatorWidget
+{
+    Q_OBJECT
 
 public:
-	DkThresholdWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget* parent = 0);
+    DkThresholdWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget *parent = 0);
 
-	QSharedPointer<DkThresholdManipulator> manipulator() const;
+    QSharedPointer<DkThresholdManipulator> manipulator() const;
 
 public slots:
-	void on_thrSlider_valueChanged(int val);
-	void on_colBox_toggled(bool checked);
+    void on_thrSlider_valueChanged(int val);
+    void on_colBox_toggled(bool checked);
 
 private:
-	void createLayout();
-
+    void createLayout();
 };
 
-class DkHueWidget : public DkBaseManipulatorWidget {
-	Q_OBJECT
+class DkHueWidget : public DkBaseManipulatorWidget
+{
+    Q_OBJECT
 
 public:
-	DkHueWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget* parent = 0);
+    DkHueWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget *parent = 0);
 
-	QSharedPointer<DkHueManipulator> manipulator() const;
+    QSharedPointer<DkHueManipulator> manipulator() const;
 
 public slots:
-	void on_hueSlider_valueChanged(int val);
-	void on_satSlider_valueChanged(int val);
-	void on_brightnessSlider_valueChanged(int val);
+    void on_hueSlider_valueChanged(int val);
+    void on_satSlider_valueChanged(int val);
+    void on_brightnessSlider_valueChanged(int val);
 
 private:
-	void createLayout();
+    void createLayout();
 };
 
-class DkColorWidget : public DkBaseManipulatorWidget {
-	Q_OBJECT
+class DkColorWidget : public DkBaseManipulatorWidget
+{
+    Q_OBJECT
 
 public:
-	DkColorWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget* parent = 0);
+    DkColorWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget *parent = 0);
 
-	QSharedPointer<DkColorManipulator> manipulator() const;
+    QSharedPointer<DkColorManipulator> manipulator() const;
 
 public slots:
-	void on_colPicker_colorSelected(const QColor& col);
+    void on_colPicker_colorSelected(const QColor &col);
 
 private:
-	void createLayout();
+    void createLayout();
 };
 
-class DkExposureWidget : public DkBaseManipulatorWidget {
-	Q_OBJECT
+class DkExposureWidget : public DkBaseManipulatorWidget
+{
+    Q_OBJECT
 
 public:
-	DkExposureWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget* parent = 0);
+    DkExposureWidget(QSharedPointer<DkBaseManipulatorExt> manipulator, QWidget *parent = 0);
 
-	QSharedPointer<DkExposureManipulator> manipulator() const;
+    QSharedPointer<DkExposureManipulator> manipulator() const;
 
 public slots:
-	void on_exposureSlider_valueChanged(double val);
-	void on_offsetSlider_valueChanged(double val);
-	void on_gammaSlider_valueChanged(double val);
+    void on_exposureSlider_valueChanged(double val);
+    void on_offsetSlider_valueChanged(double val);
+    void on_gammaSlider_valueChanged(double val);
 
 private:
-	void createLayout();
+    void createLayout();
 };
 
 // dock --------------------------------------------------------------------
-class DkManipulatorWidget : public DkFadeWidget {
-	Q_OBJECT
+class DkManipulatorWidget : public DkFadeWidget
+{
+    Q_OBJECT
 
 public:
-	DkManipulatorWidget(QWidget* parent = 0);
+    DkManipulatorWidget(QWidget *parent = 0);
 
-	void setImage(QSharedPointer<DkImageContainerT> imgC);
+    void setImage(QSharedPointer<DkImageContainerT> imgC);
 
 public slots:
-	void selectManipulator();
+    void selectManipulator();
 
 private:
-	void createLayout();
-	QImage scaledPreview(const QImage& img) const;
+    void createLayout();
+    QImage scaledPreview(const QImage &img) const;
 
-	QVector<DkBaseManipulatorWidget*> mWidgets;
+    QVector<DkBaseManipulatorWidget *> mWidgets;
 
-	QSharedPointer<DkImageContainerT> mImgC;
-	QLabel* mPreview = 0;
-	QLabel* mTitleLabel = 0;
-	int mMaxPreview = 150;
+    QSharedPointer<DkImageContainerT> mImgC;
+    QLabel *mPreview = 0;
+    QLabel *mTitleLabel = 0;
+    int mMaxPreview = 150;
 };
 
-class DkEditDock : public DkDockWidget {
-	Q_OBJECT
+class DkEditDock : public DkDockWidget
+{
+    Q_OBJECT
 
 public:
-	DkEditDock(const QString& title, QWidget* parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
+    DkEditDock(const QString &title, QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
 
 public slots:
-	void setImage(QSharedPointer<DkImageContainerT> imgC);
+    void setImage(QSharedPointer<DkImageContainerT> imgC);
 
 protected:
-	void createLayout();
-
-	DkManipulatorWidget* mMplWidget = 0;
+    void createLayout();
 
+    DkManipulatorWidget *mMplWidget = 0;
 };
 
-
 }
\ No newline at end of file
diff --git a/ImageLounge/src/DkGui/DkMenu.cpp b/ImageLounge/src/DkGui/DkMenu.cpp
index 09947ff..68cf45e 100644
--- a/ImageLounge/src/DkGui/DkMenu.cpp
+++ b/ImageLounge/src/DkGui/DkMenu.cpp
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkMenu.cpp
  Created on:	09.08.2011
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -26,262 +26,275 @@
  *******************************************************************************************************/
 
 #include "DkMenu.h"
-#include "DkSettings.h"
 #include "DkNetwork.h"
+#include "DkSettings.h"
 
-#pragma warning(push, 0)	// no warnings from includes - begin
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QAction>
+#include <QDebug>
 #include <QFileInfo>
 #include <QList>
 #include <QObject>
 #include <QPointer>
-#include <QTimer>
 #include <QStringBuilder>
-#include <QDebug>
-#pragma warning(pop)		// no warnings from includes - end
+#include <QTimer>
+#pragma warning(pop) // no warnings from includes - end
 
 #ifdef QT_NO_DEBUG_OUTPUT
-#pragma warning(disable: 4127)		// no 'conditional expression is constant' if qDebug() messages are removed
+#pragma warning(disable : 4127) // no 'conditional expression is constant' if qDebug() messages are removed
 #endif
 
-namespace nmc {
+namespace nmc
+{
 
 // DkMenu --------------------------------------------------------------------
-DkMenuBar::DkMenuBar(QWidget *parent, int timeToShow) : QMenuBar(parent) {
-
-	mTimeToShow = timeToShow;	// default: 5 seconds
-
-	mTimerMenu = new QTimer(this);
-	mTimerMenu->setSingleShot(true);
-	connect(mTimerMenu, SIGNAL(timeout()), this, SLOT(hideMenu()));
-
-
-	// uncomment if you want to show menu on start-up
-	//if (timeToShow != -1)
-	//	timerMenu->start(timeToShow);
+DkMenuBar::DkMenuBar(QWidget *parent, int timeToShow)
+    : QMenuBar(parent)
+{
+    mTimeToShow = timeToShow; // default: 5 seconds
+
+    mTimerMenu = new QTimer(this);
+    mTimerMenu->setSingleShot(true);
+    connect(mTimerMenu, SIGNAL(timeout()), this, SLOT(hideMenu()));
+
+    // uncomment if you want to show menu on start-up
+    // if (timeToShow != -1)
+    //	timerMenu->start(timeToShow);
 }
 
-QAction* DkMenuBar::addMenu(QMenu* menu) {
-
-	mMenus.append(menu);
+QAction *DkMenuBar::addMenu(QMenu *menu)
+{
+    mMenus.append(menu);
 
-	return QMenuBar::addMenu(menu);
+    return QMenuBar::addMenu(menu);
 }
 
-QMenu* DkMenuBar::addMenu(const QString& title) {
+QMenu *DkMenuBar::addMenu(const QString &title)
+{
+    QMenu *newMenu = QMenuBar::addMenu(title);
+    mMenus.append(newMenu);
 
-	QMenu* newMenu = QMenuBar::addMenu(title);
-	mMenus.append(newMenu);
-
-	return newMenu;
+    return newMenu;
 }
 
-QMenu* DkMenuBar::addMenu(const QIcon& icon, const QString& title) {
-
-	QMenu* newMenu = QMenuBar::addMenu(icon, title);
-	mMenus.append(newMenu);
+QMenu *DkMenuBar::addMenu(const QIcon &icon, const QString &title)
+{
+    QMenu *newMenu = QMenuBar::addMenu(icon, title);
+    mMenus.append(newMenu);
 
-	return newMenu;
+    return newMenu;
 }
 
-void DkMenuBar::showMenu() {
+void DkMenuBar::showMenu()
+{
+    // if (mTimeToShow == -1)
+    //	return;
 
-	//if (mTimeToShow == -1)
-	//	return;
+    if (isVisible()) {
+        mTimerMenu->stop();
+        hideMenu();
+        return;
+    }
 
-	if (isVisible()) {
-		mTimerMenu->stop();
-		hideMenu();
-		return;
-	}
+    if (mTimeToShow != -1)
+        mTimerMenu->start(mTimeToShow);
 
-	if (mTimeToShow != -1)
-		mTimerMenu->start(mTimeToShow);
-	
-	show();
+    show();
 }
 
-void DkMenuBar::hideMenu() {
-
-	if (mTimeToShow == -1)
-		return;
-
-	// ok we have a mouseover
-	if (mActive)
-		return;
-
-	for (int idx = 0; idx < mMenus.size(); idx++) {
-
-		// ok, a child is active -> wait for it
-		if (mMenus.at(idx)->isVisible()) {
-			mTimerMenu->start(mTimeToShow);
-			return;
-		}
-	}
-
-	if (!mActive)
-		hide();
+void DkMenuBar::hideMenu()
+{
+    if (mTimeToShow == -1)
+        return;
+
+    // ok we have a mouseover
+    if (mActive)
+        return;
+
+    for (int idx = 0; idx < mMenus.size(); idx++) {
+        // ok, a child is active -> wait for it
+        if (mMenus.at(idx)->isVisible()) {
+            mTimerMenu->start(mTimeToShow);
+            return;
+        }
+    }
+
+    if (!mActive)
+        hide();
 }
 
-void DkMenuBar::setTimeToShow(int timeToShow) {
-
-	mTimeToShow = timeToShow;
+void DkMenuBar::setTimeToShow(int timeToShow)
+{
+    mTimeToShow = timeToShow;
 }
 
-void DkMenuBar::enterEvent(QEvent* event) {
-
-	if (mTimeToShow == -1)
-		return;
+void DkMenuBar::enterEvent(QEvent *event)
+{
+    if (mTimeToShow == -1)
+        return;
 
-	mActive = true;
+    mActive = true;
 
-	QMenuBar::enterEvent(event);
+    QMenuBar::enterEvent(event);
 }
 
-void DkMenuBar::leaveEvent(QEvent* event) {
-
-	if (mTimeToShow == -1)
-		return;
+void DkMenuBar::leaveEvent(QEvent *event)
+{
+    if (mTimeToShow == -1)
+        return;
 
-	mActive = false;
-	mTimerMenu->start(mTimeToShow);
-
-	QMenuBar::leaveEvent(event);
+    mActive = false;
+    mTimerMenu->start(mTimeToShow);
 
+    QMenuBar::leaveEvent(event);
 }
 
 // DkTcpMenu --------------------------------------------------------------------
-DkTcpMenu::DkTcpMenu(const QString& title, QWidget* parent) : QMenu(title, parent) {
-
-	connect(this, SIGNAL(aboutToShow()), this, SLOT(updatePeers()));
-	connect(this, SIGNAL(synchronizeWithSignal(quint16)), DkSyncManager::inst().client(), SLOT(synchronizeWith(quint16)));
+DkTcpMenu::DkTcpMenu(const QString &title, QWidget *parent)
+    : QMenu(title, parent)
+{
+    connect(this, SIGNAL(aboutToShow()), this, SLOT(updatePeers()));
+    connect(this, SIGNAL(synchronizeWithSignal(quint16)), DkSyncManager::inst().client(), SLOT(synchronizeWith(quint16)));
 }
 
-DkTcpMenu::~DkTcpMenu() {}
-
-void DkTcpMenu::addTcpAction(QAction* tcpAction) {
-	mTcpActions.append(tcpAction);
+DkTcpMenu::~DkTcpMenu()
+{
 }
 
-void DkTcpMenu::showNoClientsFound(bool show) {
-	mNoClientsFound = show;
+void DkTcpMenu::addTcpAction(QAction *tcpAction)
+{
+    mTcpActions.append(tcpAction);
 }
 
-void DkTcpMenu::clear() {
-	QMenu::clear();
-	mTcpActions.clear();
+void DkTcpMenu::showNoClientsFound(bool show)
+{
+    mNoClientsFound = show;
 }
 
-void DkTcpMenu::enableActions(bool enable, bool local) {
-
-	updatePeers();
-
-	if (local)
-		return;
-
-	bool anyConnected = enable;
-
-	// let's see if any other connection is there
-	if (!anyConnected) {
-
-		for (int idx = 0; idx < mTcpActions.size(); idx++) {
-
-			if (mTcpActions.at(idx)->objectName() == "tcpAction" && mTcpActions.at(idx)->isChecked()) {
-				anyConnected = true;
-				break;
-			}
-		}
-	}
-
-	for (int idx = 0; idx < mTcpActions.size(); idx++) {
-
-		if (mTcpActions.at(idx)->objectName() == "serverAction")
-			mTcpActions.at(idx)->setEnabled(!anyConnected);
-	}
-
+void DkTcpMenu::clear()
+{
+    QMenu::clear();
+    mTcpActions.clear();
 }
 
-void DkTcpMenu::updatePeers() {	// find other clients on paint
-
-	auto ct = DkSyncManager::inst().client();
-	QList<DkPeer*> newPeers = ct->getPeerList();	// TODO: remove old style
+void DkTcpMenu::enableActions(bool enable, bool local)
+{
+    updatePeers();
+
+    if (local)
+        return;
+
+    bool anyConnected = enable;
+
+    // let's see if any other connection is there
+    if (!anyConnected) {
+        for (int idx = 0; idx < mTcpActions.size(); idx++) {
+            if (mTcpActions.at(idx)->objectName() == "tcpAction" && mTcpActions.at(idx)->isChecked()) {
+                anyConnected = true;
+                break;
+            }
+        }
+    }
+
+    for (int idx = 0; idx < mTcpActions.size(); idx++) {
+        if (mTcpActions.at(idx)->objectName() == "serverAction")
+            mTcpActions.at(idx)->setEnabled(!anyConnected);
+    }
+}
 
-	// just update if the peers have changed...
-	QMenu::clear();
+void DkTcpMenu::updatePeers()
+{ // find other clients on paint
 
-	// show dummy action
-	if (newPeers.empty() && mNoClientsFound) {
-		QAction* defaultAction = new QAction(tr("no clients found"), this);
-		defaultAction->setEnabled(false);
-		addAction(defaultAction);
-		return;
-	}
+    auto ct = DkSyncManager::inst().client();
+    QList<DkPeer *> newPeers = ct->getPeerList(); // TODO: remove old style
 
-	if (!mNoClientsFound || !newPeers.empty()) {
+    // just update if the peers have changed...
+    QMenu::clear();
 
-		for (int idx = 0; idx < mTcpActions.size(); idx++) {
-			addAction(mTcpActions.at(idx));
-		}
-	}
+    // show dummy action
+    if (newPeers.empty() && mNoClientsFound) {
+        QAction *defaultAction = new QAction(tr("no clients found"), this);
+        defaultAction->setEnabled(false);
+        addAction(defaultAction);
+        return;
+    }
 
-	for (int idx = 0; idx < newPeers.size(); idx++) {
+    if (!mNoClientsFound || !newPeers.empty()) {
+        for (int idx = 0; idx < mTcpActions.size(); idx++) {
+            addAction(mTcpActions.at(idx));
+        }
+    }
 
-		DkPeer* currentPeer = newPeers[idx];
+    for (int idx = 0; idx < newPeers.size(); idx++) {
+        DkPeer *currentPeer = newPeers[idx];
 
-		QString title = (mNoClientsFound) ? currentPeer->title : currentPeer->clientName % QString(": ") % currentPeer->title;
+        QString title = (mNoClientsFound) ? currentPeer->title : currentPeer->clientName % QString(": ") % currentPeer->title;
 
-		DkTcpAction* peerEntry = new DkTcpAction(currentPeer, title, this);
-		if (!mNoClientsFound) 
-			peerEntry->setTcpActions(&mTcpActions);
+        DkTcpAction *peerEntry = new DkTcpAction(currentPeer, title, this);
+        if (!mNoClientsFound)
+            peerEntry->setTcpActions(&mTcpActions);
 
-		connect(peerEntry, SIGNAL(synchronizeWithSignal(quint16)), ct, SLOT(synchronizeWith(quint16)));
-		connect(peerEntry, SIGNAL(disableSynchronizeWithSignal(quint16)), ct, SLOT(stopSynchronizeWith(quint16)));
-		connect(peerEntry, SIGNAL(enableActions(bool)), this, SLOT(enableActions(bool)));
+        connect(peerEntry, SIGNAL(synchronizeWithSignal(quint16)), ct, SLOT(synchronizeWith(quint16)));
+        connect(peerEntry, SIGNAL(disableSynchronizeWithSignal(quint16)), ct, SLOT(stopSynchronizeWith(quint16)));
+        connect(peerEntry, SIGNAL(enableActions(bool)), this, SLOT(enableActions(bool)));
 
-		addAction(peerEntry);
-	}
+        addAction(peerEntry);
+    }
 }
 
 // DkTcpAction --------------------------------------------------------------------
-DkTcpAction::DkTcpAction() : QAction(0) {}
-
-DkTcpAction::DkTcpAction(DkPeer* peer, QObject* parent) : QAction(parent) {
-	this->peer = peer;
-	init();
+DkTcpAction::DkTcpAction()
+    : QAction(0)
+{
 }
 
-DkTcpAction::DkTcpAction(DkPeer* peer, const QString& text, QObject* parent) : QAction(text, parent) {
-	this->peer = peer;
-	init();
+DkTcpAction::DkTcpAction(DkPeer *peer, QObject *parent)
+    : QAction(parent)
+{
+    this->peer = peer;
+    init();
 }
 
-DkTcpAction::DkTcpAction(DkPeer* peer, const QIcon& icon, const QString& text, QObject* parent) : QAction(icon, text, parent) {
-	this->peer = peer;
-	init();
+DkTcpAction::DkTcpAction(DkPeer *peer, const QString &text, QObject *parent)
+    : QAction(text, parent)
+{
+    this->peer = peer;
+    init();
 }
 
-DkTcpAction::~DkTcpAction() {}
+DkTcpAction::DkTcpAction(DkPeer *peer, const QIcon &icon, const QString &text, QObject *parent)
+    : QAction(icon, text, parent)
+{
+    this->peer = peer;
+    init();
+}
 
-void DkTcpAction::init() {
-	tcpActions = 0;
-	setObjectName("tcpAction");
-	setCheckable(true);
-	setChecked(peer->isSynchronized());
-	connect(this, SIGNAL(triggered(bool)), this, SLOT(synchronize(bool)));
+DkTcpAction::~DkTcpAction()
+{
 }
 
-void DkTcpAction::setTcpActions(QList<QAction*>* actions) {
-	tcpActions = actions;
+void DkTcpAction::init()
+{
+    tcpActions = 0;
+    setObjectName("tcpAction");
+    setCheckable(true);
+    setChecked(peer->isSynchronized());
+    connect(this, SIGNAL(triggered(bool)), this, SLOT(synchronize(bool)));
 }
 
-void DkTcpAction::synchronize(bool checked) {
+void DkTcpAction::setTcpActions(QList<QAction *> *actions)
+{
+    tcpActions = actions;
+}
 
-	if (checked)
-		emit synchronizeWithSignal(peer->peerId);
-	else
-		emit disableSynchronizeWithSignal(peer->peerId);
+void DkTcpAction::synchronize(bool checked)
+{
+    if (checked)
+        emit synchronizeWithSignal(peer->peerId);
+    else
+        emit disableSynchronizeWithSignal(peer->peerId);
 
-	emit enableActions(checked);
+    emit enableActions(checked);
 }
 
 }
diff --git a/ImageLounge/src/DkGui/DkMenu.h b/ImageLounge/src/DkGui/DkMenu.h
index 718d7bf..a54bfef 100644
--- a/ImageLounge/src/DkGui/DkMenu.h
+++ b/ImageLounge/src/DkGui/DkMenu.h
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkMenu.h
  Created on:	09.08.2011
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -27,15 +27,16 @@
 
 #pragma once
 
-#pragma warning(push, 0)	// no warnings from includes - begin
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QMenuBar>
 #include <QPointer>
-#pragma warning(pop)		// no warnings from includes - end
+#pragma warning(pop) // no warnings from includes - end
 
 // Qt includes
 class QTimer;
 
-namespace nmc {
+namespace nmc
+{
 
 // nomacs defines
 class DkPeer;
@@ -50,121 +51,119 @@ class DkManagerThread;
  * Note: if the menu is hidden, no actions
  * are propagated. So you should register
  * your actions additionally in the QMainWindow.
- **/ 
-class DkMenuBar : public QMenuBar {
-Q_OBJECT
+ **/
+class DkMenuBar : public QMenuBar
+{
+    Q_OBJECT
 
 public:
-	
-	/**
-	 * Creates a DkMenuBar.
-	 * @param parent the parent widget.
-	 * @param timeToShow the time to show in ms. If set to -1 it acts like a QMenu.
-	 **/ 
-	DkMenuBar(QWidget *parent = 0, int timeToShow = 5000);
-
-	/**
-	 * Override method.
-	 * @param menu a menu.
-	 * @return QAction* the action returned by QMenuBar::addAction().
-	 **/ 
-	QAction* addMenu(QMenu *menu);
-	
-	/**
-	 * Override method.
-	 * @param title the menu title. (& indicates the shortcut key)
-	 * @return QMenu* the menu returned by QMenuBar::addAction().
-	 **/ 
-	QMenu* addMenu(const QString & title);
-	
-	/**
-	 * Override method.
-	 * @param icon the menu icon.
-	 * @param title the menu title.
-	 * @return QMenu* the menu returned by QMenuBar::addAction().
-	 **/ 
-	QMenu* addMenu(const QIcon& icon, const QString& title);
-
-	void setTimeToShow(int setTimeToShow);
-
+    /**
+     * Creates a DkMenuBar.
+     * @param parent the parent widget.
+     * @param timeToShow the time to show in ms. If set to -1 it acts like a QMenu.
+     **/
+    DkMenuBar(QWidget *parent = 0, int timeToShow = 5000);
+
+    /**
+     * Override method.
+     * @param menu a menu.
+     * @return QAction* the action returned by QMenuBar::addAction().
+     **/
+    QAction *addMenu(QMenu *menu);
+
+    /**
+     * Override method.
+     * @param title the menu title. (& indicates the shortcut key)
+     * @return QMenu* the menu returned by QMenuBar::addAction().
+     **/
+    QMenu *addMenu(const QString &title);
+
+    /**
+     * Override method.
+     * @param icon the menu icon.
+     * @param title the menu title.
+     * @return QMenu* the menu returned by QMenuBar::addAction().
+     **/
+    QMenu *addMenu(const QIcon &icon, const QString &title);
+
+    void setTimeToShow(int setTimeToShow);
 
 public slots:
 
-	/**
-	 * Shows or hides the menu.
-	 * If the menu is shown, the timer for the hide event is started.
-	 **/ 
-	void showMenu();
+    /**
+     * Shows or hides the menu.
+     * If the menu is shown, the timer for the hide event is started.
+     **/
+    void showMenu();
 
-	/**
-	 * Hides the menu if it is not active.
-	 * In this context, active means that the mouse is over the menubar
-	 * or one of its children is visible.
-	 **/
-	void hideMenu();
+    /**
+     * Hides the menu if it is not active.
+     * In this context, active means that the mouse is over the menubar
+     * or one of its children is visible.
+     **/
+    void hideMenu();
 
 protected:
-	void enterEvent(QEvent* event) override;
-	void leaveEvent(QEvent* event) override;
+    void enterEvent(QEvent *event) override;
+    void leaveEvent(QEvent *event) override;
 
 private:
-	QList<QMenu*> mMenus;
-	bool mActive = false;
-	int mTimeToShow = 5000;
-	QPointer<QTimer> mTimerMenu;
+    QList<QMenu *> mMenus;
+    bool mActive = false;
+    int mTimeToShow = 5000;
+    QPointer<QTimer> mTimerMenu;
 };
 
-class DkTcpAction : public QAction {
-	Q_OBJECT
+class DkTcpAction : public QAction
+{
+    Q_OBJECT
 
 public:
-	DkTcpAction();
-	DkTcpAction(DkPeer* peer, QObject* parent = 0);
-	DkTcpAction(DkPeer* peer, const QString& text, QObject* parent = 0);
-	DkTcpAction(DkPeer* peer, const QIcon& icon, const QString& text, QObject* parent);
-	~DkTcpAction();
+    DkTcpAction();
+    DkTcpAction(DkPeer *peer, QObject *parent = 0);
+    DkTcpAction(DkPeer *peer, const QString &text, QObject *parent = 0);
+    DkTcpAction(DkPeer *peer, const QIcon &icon, const QString &text, QObject *parent);
+    ~DkTcpAction();
 
-	void init();
-	void setTcpActions(QList<QAction*>* actions);
+    void init();
+    void setTcpActions(QList<QAction *> *actions);
 
 signals:
-	void synchronizeWithSignal(quint16) const;
-	void disableSynchronizeWithSignal(quint16) const;
-	void enableActions(bool enable) const;
+    void synchronizeWithSignal(quint16) const;
+    void disableSynchronizeWithSignal(quint16) const;
+    void enableActions(bool enable) const;
 
 public slots:
-	void synchronize(bool checked);
+    void synchronize(bool checked);
 
 protected:
-	DkPeer* peer;
-	QList<QAction*>* tcpActions;
-
+    DkPeer *peer;
+    QList<QAction *> *tcpActions;
 };
 
-class DkTcpMenu : public QMenu {
-	Q_OBJECT
+class DkTcpMenu : public QMenu
+{
+    Q_OBJECT
 
 public:
+    DkTcpMenu(const QString &title = QString(), QWidget *parent = 0);
+    ~DkTcpMenu();
 
-	DkTcpMenu(const QString& title = QString(), QWidget* parent = 0);
-	~DkTcpMenu();
-
-	void addTcpAction(QAction* tcpAction);
-	void showNoClientsFound(bool show);
-	void clear();
+    void addTcpAction(QAction *tcpAction);
+    void showNoClientsFound(bool show);
+    void clear();
 
 signals:
-	void synchronizeWithSignal(quint16) const;
+    void synchronizeWithSignal(quint16) const;
 
 public slots:
-	void enableActions(bool enable = false, bool local = false);
+    void enableActions(bool enable = false, bool local = false);
 
 protected slots:
-	void updatePeers();
+    void updatePeers();
 
 protected:
-
-	QList<QAction*> mTcpActions;
-	bool mNoClientsFound = false;
+    QList<QAction *> mTcpActions;
+    bool mNoClientsFound = false;
 };
 }
diff --git a/ImageLounge/src/DkGui/DkMetaDataWidgets.cpp b/ImageLounge/src/DkGui/DkMetaDataWidgets.cpp
index ede5a41..b07286a 100644
--- a/ImageLounge/src/DkGui/DkMetaDataWidgets.cpp
+++ b/ImageLounge/src/DkGui/DkMetaDataWidgets.cpp
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkMetaDataWidgets.cpp
  Created on:	17.08.2014
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2014 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2014 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2014 Florian Kleber <florian@nomacs.org>
@@ -28,262 +28,257 @@
 #include "DkMetaDataWidgets.h"
 #include "DkBasicLoader.h"
 #include "DkImageContainer.h"
-#include "DkMetaData.h"
-#include "DkUtils.h"
-#include "DkTimer.h"
 #include "DkImageStorage.h"
+#include "DkMetaData.h"
 #include "DkSettings.h"
+#include "DkTimer.h"
+#include "DkUtils.h"
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QDockWidget>
-#include <QTreeView>
-#include <QLabel>
-#include <QTextEdit>
-#include <QVBoxLayout>
-#include <QResizeEvent>
-#include <QPushButton>
-#include <QPainter>
-#include <QSettings>
-#include <QScrollArea>
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QAction>
-#include <QMenu>
 #include <QCheckBox>
 #include <QDialog>
 #include <QDialogButtonBox>
+#include <QDockWidget>
 #include <QInputDialog>
+#include <QLabel>
+#include <QMenu>
+#include <QPainter>
+#include <QPushButton>
+#include <QRegularExpression>
+#include <QResizeEvent>
+#include <QScrollArea>
+#include <QSettings>
+#include <QTextEdit>
+#include <QTreeView>
+#include <QVBoxLayout>
 #include <qmath.h>
-#pragma warning(pop)		// no warnings from includes - end
+#pragma warning(pop) // no warnings from includes - end
 
-namespace nmc {
+namespace nmc
+{
 
 // DkMetaDataModel --------------------------------------------------------------------
-DkMetaDataModel::DkMetaDataModel(QObject* parent /* = 0 */) : QAbstractItemModel(parent) {
-
-	// create root
-	QVector<QVariant> rootData;
-	rootData << tr("Key") << tr("Value");
-
-	rootItem = new TreeItem(rootData);
+DkMetaDataModel::DkMetaDataModel(QObject *parent /* = 0 */)
+    : QAbstractItemModel(parent)
+{
+    // create root
+    QVector<QVariant> rootData;
+    rootData << tr("Key") << tr("Value");
+
+    rootItem = new TreeItem(rootData);
 }
 
-DkMetaDataModel::~DkMetaDataModel() {
-	delete rootItem;
+DkMetaDataModel::~DkMetaDataModel()
+{
+    delete rootItem;
 }
 
-void DkMetaDataModel::clear() {
-
-	beginResetModel();
-	rootItem->clear();
-	endResetModel();
+void DkMetaDataModel::clear()
+{
+    beginResetModel();
+    rootItem->clear();
+    endResetModel();
 }
 
 /// <summary>
 /// Adds the meta data.
 /// </summary>
 /// <param name="metaData">The meta data.</param>
-void DkMetaDataModel::addMetaData(QSharedPointer<DkMetaDataT> metaData) {
-
-	//metaData->printMetaData();
-
-	if (!metaData)
-		return;
+void DkMetaDataModel::addMetaData(QSharedPointer<DkMetaDataT> metaData)
+{
+    // metaData->printMetaData();
 
-	QStringList fileKeys, fileValues;
-	metaData->getFileMetaData(fileKeys, fileValues);
+    if (!metaData)
+        return;
 
-	for (int idx = 0; idx < fileKeys.size(); idx++) {
+    QStringList fileKeys, fileValues;
+    metaData->getFileMetaData(fileKeys, fileValues);
 
-		QString lastKey = fileKeys.at(idx).split(".").last();
-		createItem(fileKeys.at(idx), lastKey, fileValues.at(idx));
-	}
+    for (int idx = 0; idx < fileKeys.size(); idx++) {
+        QString lastKey = fileKeys.at(idx).split(".").last();
+        createItem(fileKeys.at(idx), lastKey, fileValues.at(idx));
+    }
 
-	QStringList exifKeys = metaData->getExifKeys();
+    QStringList exifKeys = metaData->getExifKeys();
 
-	for (int idx = 0; idx < exifKeys.size(); idx++) {
+    for (int idx = 0; idx < exifKeys.size(); idx++) {
+        QString lastKey = exifKeys.at(idx).split(".").last();
+        QString translatedKey = DkMetaDataHelper::getInstance().translateKey(lastKey);
+        QString exifValue = metaData->getNativeExifValue(exifKeys.at(idx), true);
+        exifValue = DkMetaDataHelper::getInstance().resolveSpecialValue(metaData, lastKey, exifValue);
 
-		QString lastKey = exifKeys.at(idx).split(".").last();
-		QString translatedKey = DkMetaDataHelper::getInstance().translateKey(lastKey);
-		QString exifValue = metaData->getNativeExifValue(exifKeys.at(idx));
-		exifValue = DkMetaDataHelper::getInstance().resolveSpecialValue(metaData, lastKey, exifValue);
+        createItem(exifKeys.at(idx), translatedKey, exifValue);
+    }
 
-		createItem(exifKeys.at(idx), translatedKey, exifValue);
-	}
+    QStringList iptcKeys = metaData->getIptcKeys();
 
-	QStringList iptcKeys = metaData->getIptcKeys();
+    for (int idx = 0; idx < iptcKeys.size(); idx++) {
+        QString lastKey = iptcKeys.at(idx).split(".").last();
+        QString translatedKey = DkMetaDataHelper::getInstance().translateKey(lastKey);
+        QString exifValue = metaData->getIptcValue(iptcKeys.at(idx));
+        exifValue = DkMetaDataHelper::getInstance().resolveSpecialValue(metaData, lastKey, exifValue);
 
-	for (int idx = 0; idx < iptcKeys.size(); idx++) {
+        createItem(iptcKeys.at(idx), translatedKey, exifValue);
+    }
 
-		QString lastKey = iptcKeys.at(idx).split(".").last();
-		QString translatedKey = DkMetaDataHelper::getInstance().translateKey(lastKey);
-		QString exifValue = metaData->getIptcValue(iptcKeys.at(idx));
-		exifValue = DkMetaDataHelper::getInstance().resolveSpecialValue(metaData, lastKey, exifValue);
+    QStringList xmpKeys = metaData->getXmpKeys();
 
-		createItem(iptcKeys.at(idx), translatedKey, exifValue);
-	}
+    for (int idx = 0; idx < xmpKeys.size(); idx++) {
+        QString lastKey = xmpKeys.at(idx).split(".").last();
+        QString translatedKey = DkMetaDataHelper::getInstance().translateKey(lastKey);
+        QString exifValue = metaData->getXmpValue(xmpKeys.at(idx));
+        exifValue = DkMetaDataHelper::getInstance().resolveSpecialValue(metaData, lastKey, exifValue);
 
-	QStringList xmpKeys = metaData->getXmpKeys();
+        createItem(xmpKeys.at(idx), translatedKey, exifValue);
+    }
 
-	for (int idx = 0; idx < xmpKeys.size(); idx++) {
+    QStringList qtKeys = metaData->getQtKeys();
 
-		QString lastKey = xmpKeys.at(idx).split(".").last();
-		QString translatedKey = DkMetaDataHelper::getInstance().translateKey(lastKey);
-		QString exifValue = metaData->getXmpValue(xmpKeys.at(idx));
-		exifValue = DkMetaDataHelper::getInstance().resolveSpecialValue(metaData, lastKey, exifValue);
+    for (QString cKey : qtKeys) {
+        QString lastKey = cKey.split(".").last();
+        QString translatedKey = DkMetaDataHelper::getInstance().translateKey(lastKey);
+        QString exifValue = metaData->getQtValue(cKey);
+        exifValue = DkMetaDataHelper::getInstance().resolveSpecialValue(metaData, lastKey, exifValue);
 
-		createItem(xmpKeys.at(idx), translatedKey, exifValue);
-	}
-
-	QStringList qtKeys = metaData->getQtKeys();
-
-	for (QString cKey : qtKeys) {
-
-		QString lastKey = cKey.split(".").last();
-		QString translatedKey = DkMetaDataHelper::getInstance().translateKey(lastKey);
-		QString exifValue = metaData->getQtValue(cKey);
-		exifValue = DkMetaDataHelper::getInstance().resolveSpecialValue(metaData, lastKey, exifValue);
-
-		createItem(tr("Data.") + cKey, translatedKey, exifValue);
-	}
+        createItem(tr("Data.") + cKey, translatedKey, exifValue);
+    }
 }
 
-void DkMetaDataModel::createItem(const QString& key, const QString& keyName, const QString& value) {
-
-	// Split key first
-	QStringList keyHierarchy = key.split('.');
+void DkMetaDataModel::createItem(const QString &key, const QString &keyName, const QString &value)
+{
+    // Split key first
+    QStringList keyHierarchy = key.split('.');
 
-	if (keyHierarchy.empty()) {
-		qDebug() << "no key hierarchy... skipping: " << key;
-		return;
-	}
+    if (keyHierarchy.empty()) {
+        qDebug() << "no key hierarchy... skipping: " << key;
+        return;
+    }
 
-	TreeItem* item = rootItem;
+    TreeItem *item = rootItem;
 
-	for (int idx = 0; idx < keyHierarchy.size()-1; idx++) {
+    for (int idx = 0; idx < keyHierarchy.size() - 1; idx++) {
+        QString cKey = keyHierarchy.at(idx);
+        TreeItem *cHierarchyItem = item->find(cKey, 0);
 
-		QString cKey = keyHierarchy.at(idx);
-		TreeItem* cHierarchyItem = item->find(cKey, 0);
+        if (!cHierarchyItem) {
+            QVector<QVariant> keyData;
+            keyData << cKey;
+            cHierarchyItem = new TreeItem(keyData, item);
+            item->appendChild(cHierarchyItem);
+        }
 
-		if (!cHierarchyItem) {
-			QVector<QVariant> keyData;
-			keyData << cKey;
-			cHierarchyItem = new TreeItem(keyData, item);
-			item->appendChild(cHierarchyItem);
-		}
+        item = cHierarchyItem; // switch to next hierarchy level
+    }
 
-		item = cHierarchyItem;	// switch to next hierarchy level
-	}
+    QString cleanValue = DkUtils::cleanFraction(value);
 
-	QString cleanValue = DkUtils::cleanFraction(value);
-	
-	QVector<QVariant> metaDataEntry;
-	metaDataEntry << keyName;
+    QVector<QVariant> metaDataEntry;
+    metaDataEntry << keyName;
 
-	QDateTime pd = DkUtils::getConvertableDate(cleanValue);
+    QDateTime pd = DkUtils::getConvertableDate(cleanValue);
 
-	if (!pd.isNull())
-		metaDataEntry << pd;
-	else
-		metaDataEntry << cleanValue;
-
-	TreeItem* dataItem = new TreeItem(metaDataEntry, item);
-	item->appendChild(dataItem);
+    if (!pd.isNull())
+        metaDataEntry << pd;
+    else
+        metaDataEntry << cleanValue;
 
+    TreeItem *dataItem = new TreeItem(metaDataEntry, item);
+    item->appendChild(dataItem);
 }
 
-QModelIndex DkMetaDataModel::index(int row, int column, const QModelIndex &parent) const {
-
-	if (!hasIndex(row, column, parent))
-		return QModelIndex();
+QModelIndex DkMetaDataModel::index(int row, int column, const QModelIndex &parent) const
+{
+    if (!hasIndex(row, column, parent))
+        return QModelIndex();
 
-	TreeItem *parentItem;
+    TreeItem *parentItem;
 
-	if (!parent.isValid())
-		parentItem = rootItem;
-	else
-		parentItem = static_cast<TreeItem*>(parent.internalPointer());
+    if (!parent.isValid())
+        parentItem = rootItem;
+    else
+        parentItem = static_cast<TreeItem *>(parent.internalPointer());
 
-	TreeItem *childItem = parentItem->child(row);
+    TreeItem *childItem = parentItem->child(row);
 
-	//qDebug() << " creating index for: " << childItem->data(0) << " row: " << row;
-	if (childItem)
-		return createIndex(row, column, childItem);
-	else
-		return QModelIndex();
+    // qDebug() << " creating index for: " << childItem->data(0) << " row: " << row;
+    if (childItem)
+        return createIndex(row, column, childItem);
+    else
+        return QModelIndex();
 }
 
-QModelIndex DkMetaDataModel::parent(const QModelIndex &index) const {
-
-	if (!index.isValid())
-		return QModelIndex();
+QModelIndex DkMetaDataModel::parent(const QModelIndex &index) const
+{
+    if (!index.isValid())
+        return QModelIndex();
 
-	TreeItem *childItem = static_cast<TreeItem*>(index.internalPointer());
-	TreeItem *parentItem = childItem->parent();
+    TreeItem *childItem = static_cast<TreeItem *>(index.internalPointer());
+    TreeItem *parentItem = childItem->parent();
 
-	if (!parentItem || parentItem == rootItem)
-		return QModelIndex();
+    if (!parentItem || parentItem == rootItem)
+        return QModelIndex();
 
-	//qDebug() << "parent is: " << childItem->data(0);
+    // qDebug() << "parent is: " << childItem->data(0);
 
-	return createIndex(parentItem->row(), 0, parentItem);
+    return createIndex(parentItem->row(), 0, parentItem);
 }
 
-int DkMetaDataModel::rowCount(const QModelIndex& parent) const {
+int DkMetaDataModel::rowCount(const QModelIndex &parent) const
+{
+    TreeItem *parentItem;
+    if (parent.column() > 0)
+        return 0;
 
-	TreeItem *parentItem;
-	if (parent.column() > 0)
-		return 0;
+    if (!parent.isValid())
+        parentItem = rootItem;
+    else
+        parentItem = static_cast<TreeItem *>(parent.internalPointer());
 
-	if (!parent.isValid())
-		parentItem = rootItem;
-	else
-		parentItem = static_cast<TreeItem*>(parent.internalPointer());
-
-	return parentItem->childCount();
+    return parentItem->childCount();
 }
 
-int DkMetaDataModel::columnCount(const QModelIndex& parent) const {
-
-	if (parent.isValid())
-		return static_cast<TreeItem*>(parent.internalPointer())->columnCount();
-	else
-		return rootItem->columnCount();
-	//return 2;
+int DkMetaDataModel::columnCount(const QModelIndex &parent) const
+{
+    if (parent.isValid())
+        return static_cast<TreeItem *>(parent.internalPointer())->columnCount();
+    else
+        return rootItem->columnCount();
+    // return 2;
 }
 
-QVariant DkMetaDataModel::data(const QModelIndex& index, int role) const {
+QVariant DkMetaDataModel::data(const QModelIndex &index, int role) const
+{
+    if (!index.isValid()) {
+        qDebug() << "invalid row: " << index.row();
+        return QVariant();
+    }
 
-	if (!index.isValid()) {
-		qDebug() << "invalid row: " << index.row();
-		return QVariant();
-	}
+    // if (index.row() > rowCount())
+    //	return QVariant();
 
-	//if (index.row() > rowCount())
-	//	return QVariant();
+    // if (index.column() > columnCount())
+    //	return QVariant();
 
-	//if (index.column() > columnCount())
-	//	return QVariant();
+    if (role == Qt::DisplayRole || role == Qt::EditRole) {
+        TreeItem *item = static_cast<TreeItem *>(index.internalPointer());
+        // qDebug() << "returning: " << item->data(0) << "row: " << index.row();
 
-	if (role == Qt::DisplayRole || role == Qt::EditRole) {
+        return item->data(index.column());
+    }
 
-		TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
-		//qDebug() << "returning: " << item->data(0) << "row: " << index.row();
-
-		return item->data(index.column());
-	}
-
-	return QVariant();
+    return QVariant();
 }
 
+QVariant DkMetaDataModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+    if (orientation != Qt::Horizontal || role != Qt::DisplayRole)
+        return QVariant();
 
-QVariant DkMetaDataModel::headerData(int section, Qt::Orientation orientation, int role) const {
-
-	if (orientation != Qt::Horizontal || role != Qt::DisplayRole) 
-		return QVariant();
-
-	return rootItem->data(section);
-} 
+    return rootItem->data(section);
+}
 
-//bool DkMetaDataModel::setData(const QModelIndex& index, const QVariant& value, int role) {
+// bool DkMetaDataModel::setData(const QModelIndex& index, const QVariant& value, int role) {
 //
 //	if (!index.isValid() || role != Qt::EditRole)
 //		return false;
@@ -301,1000 +296,994 @@ QVariant DkMetaDataModel::headerData(int section, Qt::Orientation orientation, i
 //
 //	emit dataChanged(index, index);
 //	return true;
-//}
+// }
 //
-Qt::ItemFlags DkMetaDataModel::flags(const QModelIndex& index) const {
+Qt::ItemFlags DkMetaDataModel::flags(const QModelIndex &index) const
+{
+    if (!index.isValid())
+        return Qt::ItemIsEditable;
 
-	if (!index.isValid())
-		return Qt::ItemIsEditable;
+    // TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
 
-	//TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
+    Qt::ItemFlags flags;
 
-	Qt::ItemFlags flags;
+    if (index.column() == 0)
+        flags = QAbstractItemModel::flags(index);
+    if (index.column() == 1)
+        flags = QAbstractItemModel::flags(index) | Qt::ItemIsEditable;
 
-	if (index.column() == 0)
-		flags = QAbstractItemModel::flags(index);
-	if (index.column() == 1)
-		flags = QAbstractItemModel::flags(index) | Qt::ItemIsEditable;
-
-	return flags;
+    return flags;
 }
 
-
 // DkMetaDataProxyModel --------------------------------------------------------------------
-DkMetaDataProxyModel::DkMetaDataProxyModel(QObject* parent) : QSortFilterProxyModel(parent) {
+DkMetaDataProxyModel::DkMetaDataProxyModel(QObject *parent)
+    : QSortFilterProxyModel(parent)
+{
 }
 
-bool DkMetaDataProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex & sourceParent) const {
-
-	QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
+bool DkMetaDataProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
+{
+    QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
 
-	TreeItem* t = static_cast<TreeItem*>(index.internalPointer());
-	if (t) {
-		return t->contains(filterRegExp(), -1)/* | t->contains(filterRegExp(), 1)*/;
-	}
+    TreeItem *t = static_cast<TreeItem *>(index.internalPointer());
+    if (t) {
+        return t->contains(filterRegularExpression(), -1) /* | t->contains(filterRegExp(), 1)*/;
+    }
 
-	qWarning() << "[DkMetaDataProxyModel] Ich h�re gerade, es ist ein bisschen was durcheinander gekommen";
-	return true;
+    qWarning() << "[DkMetaDataProxyModel] Ich höre gerade, es ist ein bisschen was durcheinander gekommen";
+    return true;
 }
 
 // DkMetaDataDock --------------------------------------------------------------------
-DkMetaDataDock::DkMetaDataDock(const QString& title, QWidget* parent /* = 0 */, Qt::WindowFlags flags /* = 0 */ ) : 
-	DkDockWidget(title, parent, flags) {
+DkMetaDataDock::DkMetaDataDock(const QString &title, QWidget *parent /* = 0 */, Qt::WindowFlags flags /* = 0 */)
+    : DkDockWidget(title, parent, flags)
+{
+    setObjectName("DkMetaDataDock");
 
-	setObjectName("DkMetaDataDock");
+    createLayout();
+    readSettings();
 
-	createLayout();
-	readSettings();
-
-	QMetaObject::connectSlotsByName(this);
+    QMetaObject::connectSlotsByName(this);
 }
 
-DkMetaDataDock::~DkMetaDataDock() {
-	// save settings
-	writeSettings();
+DkMetaDataDock::~DkMetaDataDock()
+{
+    // save settings
+    writeSettings();
 }
 
-void DkMetaDataDock::writeSettings() {
-
-	DefaultSettings settings;
-	settings.beginGroup(objectName());
-	
-	for (int idx = 0; idx < mModel->columnCount(QModelIndex()); idx++) {
+void DkMetaDataDock::writeSettings()
+{
+    DefaultSettings settings;
+    settings.beginGroup(objectName());
 
-		QString headerVal = mModel->headerData(idx, Qt::Horizontal).toString();
-		settings.setValue(headerVal + "Size", mTreeView->columnWidth(idx));
-	}
+    for (int idx = 0; idx < mModel->columnCount(QModelIndex()); idx++) {
+        QString headerVal = mModel->headerData(idx, Qt::Horizontal).toString();
+        settings.setValue(headerVal + "Size", mTreeView->columnWidth(idx));
+    }
 
-	settings.setValue("expandedNames", mExpandedNames);
-	qDebug() << "settings write expanded names: " << mExpandedNames;
+    settings.setValue("expandedNames", mExpandedNames);
+    qDebug() << "settings write expanded names: " << mExpandedNames;
 
-	settings.endGroup();
+    settings.endGroup();
 }
 
-void DkMetaDataDock::readSettings() {
-	
-	DefaultSettings settings;
-	settings.beginGroup(objectName());
+void DkMetaDataDock::readSettings()
+{
+    DefaultSettings settings;
+    settings.beginGroup(objectName());
 
-	for (int idx = 0; idx < mModel->columnCount(QModelIndex()); idx++) {
+    for (int idx = 0; idx < mModel->columnCount(QModelIndex()); idx++) {
+        QString headerVal = mModel->headerData(idx, Qt::Horizontal).toString();
 
-		QString headerVal = mModel->headerData(idx, Qt::Horizontal).toString();
+        int colWidth = settings.value(headerVal + "Size", -1).toInt();
+        if (colWidth != -1)
+            mTreeView->setColumnWidth(idx, colWidth);
+    }
+    mExpandedNames = settings.value("expandedNames", QStringList()).toStringList();
+    // qDebug() << "settings expanded names: " << mExpandedNames;
 
-		int colWidth = settings.value(headerVal + "Size", -1).toInt();
-		if (colWidth != -1) 
-			mTreeView->setColumnWidth(idx, colWidth);
-	}
-	mExpandedNames = settings.value("expandedNames", QStringList()).toStringList();
-	//qDebug() << "settings expanded names: " << mExpandedNames;
-
-	settings.endGroup();
+    settings.endGroup();
 }
 
-void DkMetaDataDock::createLayout() {
-
-	mFilterEdit = new QLineEdit(this);
-	mFilterEdit->setObjectName("filter");
-	mFilterEdit->setPlaceholderText(tr("Filter"));
-
-	// create our beautiful shortcut view
-	mModel = new DkMetaDataModel(this);
-	
-	mProxyModel = new DkMetaDataProxyModel(this);
-	mProxyModel->setSourceModel(mModel);
-
-	mTreeView = new QTreeView(this);
-	mTreeView->setModel(mProxyModel);
-	mTreeView->setAlternatingRowColors(true);
-	//mTreeView->setIndentation(8);
-	//mTreeView->setStyleSheet("QTreeView{border: none;}");
-
-	mThumbNailLabel = new QLabel(tr("Thumbnail"), this);
-	mThumbNailLabel->hide();
-
-	// thumb layout
-	QWidget* thumbWidget = new QWidget(this);
-	QHBoxLayout* thumbLayout = new QHBoxLayout(thumbWidget);
-	thumbLayout->setContentsMargins(0, 0, 0, 0);
-	thumbLayout->addStretch();
-	thumbLayout->addWidget(mThumbNailLabel);
-	thumbLayout->addStretch();
-
-	QWidget* widget = new QWidget(this);
-	QVBoxLayout* layout = new QVBoxLayout(widget);
-	layout->setContentsMargins(2, 2, 2, 2);
-	layout->addWidget(mFilterEdit);
-	layout->addWidget(mTreeView);
-	layout->addWidget(thumbWidget);
-	setWidget(widget);
+void DkMetaDataDock::createLayout()
+{
+    mFilterEdit = new QLineEdit(this);
+    mFilterEdit->setObjectName("filter");
+    mFilterEdit->setPlaceholderText(tr("Filter"));
+
+    // create our beautiful shortcut view
+    mModel = new DkMetaDataModel(this);
+
+    mProxyModel = new DkMetaDataProxyModel(this);
+    mProxyModel->setSourceModel(mModel);
+
+    mTreeView = new QTreeView(this);
+    mTreeView->setModel(mProxyModel);
+    mTreeView->setAlternatingRowColors(true);
+    // mTreeView->setIndentation(8);
+    // mTreeView->setStyleSheet("QTreeView{border: none;}");
+
+    mThumbNailLabel = new QLabel(tr("Thumbnail"), this);
+    mThumbNailLabel->hide();
+
+    // thumb layout
+    QWidget *thumbWidget = new QWidget(this);
+    QHBoxLayout *thumbLayout = new QHBoxLayout(thumbWidget);
+    thumbLayout->setContentsMargins(0, 0, 0, 0);
+    thumbLayout->addStretch();
+    thumbLayout->addWidget(mThumbNailLabel);
+    thumbLayout->addStretch();
+
+    QWidget *widget = new QWidget(this);
+    QVBoxLayout *layout = new QVBoxLayout(widget);
+    layout->setContentsMargins(2, 2, 2, 2);
+    layout->addWidget(mFilterEdit);
+    layout->addWidget(mTreeView);
+    layout->addWidget(thumbWidget);
+    setWidget(widget);
 }
 
-void DkMetaDataDock::on_filter_textChanged(const QString& filterText) {
-
-	if (!filterText.isEmpty())
-		mTreeView->expandAll();
+void DkMetaDataDock::on_filter_textChanged(const QString &filterText)
+{
+    if (!filterText.isEmpty())
+        mTreeView->expandAll();
 
-	mProxyModel->setFilterRegExp(QRegExp(filterText, Qt::CaseInsensitive, QRegExp::FixedString));
+    mProxyModel->setFilterRegularExpression(QRegularExpression(QRegularExpression::escape(filterText), QRegularExpression::CaseInsensitiveOption));
 }
 
-void DkMetaDataDock::updateEntries() {
+void DkMetaDataDock::updateEntries()
+{
+    int nr = mProxyModel->rowCount(QModelIndex());
+    for (int idx = 0; idx < nr; idx++)
+        getExpandedItemNames(mProxyModel->index(idx, 0, QModelIndex()), mExpandedNames);
 
-	int nr = mProxyModel->rowCount(QModelIndex());
-	for (int idx = 0; idx < nr; idx++)
-		getExpandedItemNames(mProxyModel->index(idx,0,QModelIndex()), mExpandedNames);
+    mModel->deleteLater();
 
-	mModel->deleteLater();
+    if (!mImgC)
+        return;
 
-	if (!mImgC)
-		return;
+    mModel = new DkMetaDataModel(this);
+    mModel->addMetaData(mImgC->getMetaData());
+    mProxyModel->setSourceModel(mModel);
 
-	mModel = new DkMetaDataModel(this);
-	mModel->addMetaData(mImgC->getMetaData());
-	mProxyModel->setSourceModel(mModel);
+    mTreeView->setUpdatesEnabled(false);
+    nr = mProxyModel->rowCount();
+    for (int idx = 0; idx < nr; idx++)
+        expandRows(mProxyModel->index(idx, 0, QModelIndex()), mExpandedNames);
 
-	mTreeView->setUpdatesEnabled(false);
-	nr = mProxyModel->rowCount();
-	for (int idx = 0; idx < nr; idx++)
-		expandRows(mProxyModel->index(idx, 0, QModelIndex()), mExpandedNames);
-
-	mTreeView->setUpdatesEnabled(true);
-	
-	// for values we should adjust the size at least to the currently visible rows...
-	mTreeView->resizeColumnToContents(1);
-	//if (treeView->columnWidth(1) > 1000)
-	//	treeView->setColumnWidth(1, 1000);
+    mTreeView->setUpdatesEnabled(true);
 
+    // for values we should adjust the size at least to the currently visible rows...
+    mTreeView->resizeColumnToContents(1);
+    // if (treeView->columnWidth(1) > 1000)
+    //	treeView->setColumnWidth(1, 1000);
 }
 
-void DkMetaDataDock::setImage(QSharedPointer<DkImageContainerT> imgC) {
-
-	mImgC = imgC;
+void DkMetaDataDock::setImage(QSharedPointer<DkImageContainerT> imgC)
+{
+    mImgC = imgC;
 
-	if (isVisible())
-		updateEntries();
+    if (isVisible())
+        updateEntries();
 
-	if (imgC) {
-
-		// we need to load the thumbnail fresh to guarantee, that we just consider the exif thumb
-		// the imgC thumbnail might be created from the image
-		mThumb = QSharedPointer<DkThumbNailT>(new DkThumbNailT(imgC->filePath()));
-		connect(mThumb.data(), SIGNAL(thumbLoadedSignal(bool)), this, SLOT(thumbLoaded(bool)));
-		mThumb->fetchThumb(DkThumbNailT::force_exif_thumb);
-	}
+    if (imgC) {
+        // we need to load the thumbnail fresh to guarantee, that we just consider the exif thumb
+        // the imgC thumbnail might be created from the image
+        mThumb = QSharedPointer<DkThumbNailT>(new DkThumbNailT(imgC->filePath()));
+        connect(mThumb.data(), SIGNAL(thumbLoadedSignal(bool)), this, SLOT(thumbLoaded(bool)));
+        mThumb->fetchThumb(DkThumbNailT::force_exif_thumb);
+    }
 }
 
-void DkMetaDataDock::thumbLoaded(bool loaded) {
-
-	if (loaded) {
-		QImage thumbImg = mThumb->getImage();
-		
-		//if (thumbImg.width() > width()) {
-		//	mThumbNailLabel->setFixedWidth(width()-20);
-		//	thumbImg = thumbImg.scaled(QSize(width(), thumbImg.height()), Qt::KeepAspectRatio);
-		//}
-		//else
-		//	mThumbNailLabel->setFixedHeight(thumbImg.height());
-
-		QSize tSize = thumbImg.size();
-		thumbImg = thumbImg.scaled(tSize.boundedTo(QSize(mTreeView->width(), mTreeView->width())), Qt::KeepAspectRatio);
-
-		mThumbNailLabel->setScaledContents(true);
-		mThumbNailLabel->setPixmap(QPixmap::fromImage(thumbImg));
-		mThumbNailLabel->show();
-	}
-	else
-		mThumbNailLabel->hide();
-
+void DkMetaDataDock::thumbLoaded(bool loaded)
+{
+    if (loaded) {
+        QImage thumbImg = mThumb->getImage();
+
+        // if (thumbImg.width() > width()) {
+        //	mThumbNailLabel->setFixedWidth(width()-20);
+        //	thumbImg = thumbImg.scaled(QSize(width(), thumbImg.height()), Qt::KeepAspectRatio);
+        // }
+        // else
+        //	mThumbNailLabel->setFixedHeight(thumbImg.height());
+
+        QSize tSize = thumbImg.size();
+        thumbImg = thumbImg.scaled(tSize.boundedTo(QSize(mTreeView->width(), mTreeView->width())), Qt::KeepAspectRatio);
+
+        mThumbNailLabel->setScaledContents(true);
+        mThumbNailLabel->setPixmap(QPixmap::fromImage(thumbImg));
+        mThumbNailLabel->show();
+    } else
+        mThumbNailLabel->hide();
 }
 
-void DkMetaDataDock::getExpandedItemNames(const QModelIndex& index, QStringList& expandedNames) {
+void DkMetaDataDock::getExpandedItemNames(const QModelIndex &index, QStringList &expandedNames)
+{
+    if (!mTreeView || !index.isValid())
+        return;
 
-	if (!mTreeView || !index.isValid())
-		return;
+    QString entryName = mProxyModel->data(index, Qt::DisplayRole).toString();
 
-	QString entryName = mProxyModel->data(index,Qt::DisplayRole).toString();
+    if (mTreeView->isExpanded(index) && !expandedNames.contains(entryName))
+        expandedNames.append(entryName);
+    else if (!mTreeView->isExpanded(index))
+        expandedNames.removeAll(mProxyModel->data(index, Qt::DisplayRole).toString());
 
-	if (mTreeView->isExpanded(index) && !expandedNames.contains(entryName))
-		expandedNames.append(entryName);
-	else if (!mTreeView->isExpanded(index))
-		expandedNames.removeAll(mProxyModel->data(index,Qt::DisplayRole).toString());
-
-	int rows = mProxyModel->rowCount(index);
-
-	for (int idx = 0; idx < rows; idx++)
-		getExpandedItemNames(mProxyModel->index(idx, 0, index), expandedNames);
+    int rows = mProxyModel->rowCount(index);
 
+    for (int idx = 0; idx < rows; idx++)
+        getExpandedItemNames(mProxyModel->index(idx, 0, index), expandedNames);
 }
 
-void DkMetaDataDock::expandRows(const QModelIndex& index, const QStringList& expandedNames) {
-
-	if (!index.isValid())
-		return;
+void DkMetaDataDock::expandRows(const QModelIndex &index, const QStringList &expandedNames)
+{
+    if (!index.isValid())
+        return;
 
-	if (expandedNames.contains(mProxyModel->data(index).toString())) {
-		mTreeView->setExpanded(index, true);
-	}
+    if (expandedNames.contains(mProxyModel->data(index).toString())) {
+        mTreeView->setExpanded(index, true);
+    }
 
-	for (int idx = 0; idx < mProxyModel->rowCount(index); idx++) {
+    for (int idx = 0; idx < mProxyModel->rowCount(index); idx++) {
+        QModelIndex cIndex = mProxyModel->index(idx, 0, index);
 
-		QModelIndex cIndex = index.child(idx, 0);
-
-		if (expandedNames.contains(mProxyModel->data(cIndex).toString())) {
-			mTreeView->setExpanded(cIndex, true);
-			expandRows(cIndex, expandedNames);
-		}
-	}
+        if (expandedNames.contains(mProxyModel->data(cIndex).toString())) {
+            mTreeView->setExpanded(cIndex, true);
+            expandRows(cIndex, expandedNames);
+        }
+    }
 }
 
-//void DkMetaDataDock::setVisible(bool visible) {
+// void DkMetaDataDock::setVisible(bool visible) {
 //
 //	if (visible)
 //		updateEntries();
 //
 //	QDockWidget::setVisible(visible);
-//}
+// }
 
 // DkMetaDataSelection --------------------------------------------------------------------
-DkMetaDataSelection::DkMetaDataSelection(const QSharedPointer<DkMetaDataT> metaData, QWidget* parent) : DkWidget(parent) {
-
-	setObjectName("DkMetaDataSelection");
-	mMetaData = metaData;
-	createLayout();
-	selectionChanged();
+DkMetaDataSelection::DkMetaDataSelection(const QSharedPointer<DkMetaDataT> metaData, QWidget *parent)
+    : DkWidget(parent)
+{
+    setObjectName("DkMetaDataSelection");
+    mMetaData = metaData;
+    createLayout();
+    selectionChanged();
 }
 
-void DkMetaDataSelection::createLayout() {
+void DkMetaDataSelection::createLayout()
+{
+    createEntries(mMetaData, mKeys, mValues);
 
-	createEntries(mMetaData, mKeys, mValues);
+    QWidget *lWidget = new QWidget(this);
+    mLayout = new QGridLayout(lWidget);
 
-	QWidget* lWidget = new QWidget(this);
-	mLayout = new QGridLayout(lWidget);
+    for (int idx = 0; idx < mKeys.size(); idx++) {
+        appendGUIEntry(mKeys.at(idx), mValues.at(idx), idx);
+    }
 
-	for (int idx = 0; idx < mKeys.size(); idx++) {
-		appendGUIEntry(mKeys.at(idx), mValues.at(idx), idx);
-	}
+    mLayout->setColumnStretch(2, 10);
 
-	mLayout->setColumnStretch(2, 10);
+    QScrollArea *scrollArea = new QScrollArea(this);
+    scrollArea->setWidgetResizable(true);
+    scrollArea->setMinimumSize(QSize(200, 200));
+    scrollArea->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+    scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+    scrollArea->setBackgroundRole(QPalette::Light); // TODO: this l
+    scrollArea->setWidget(lWidget);
 
-	QScrollArea* scrollArea = new QScrollArea(this);
-	scrollArea->setWidgetResizable(true);
-	scrollArea->setMinimumSize(QSize(200, 200));
-	scrollArea->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
-	scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-	scrollArea->setBackgroundRole(QPalette::Light);		// TODO: this l
-	scrollArea->setWidget(lWidget);
+    mCbCheckAll = new QCheckBox(tr("Check All"), this);
+    mCbCheckAll->setTristate(true);
+    connect(mCbCheckAll, SIGNAL(clicked(bool)), this, SLOT(checkAll(bool)));
 
-	mCbCheckAll = new QCheckBox(tr("Check All"), this);
-	mCbCheckAll->setTristate(true);
-	connect(mCbCheckAll, SIGNAL(clicked(bool)), this, SLOT(checkAll(bool)));
-
-	QVBoxLayout* l = new QVBoxLayout(this);
-	l->addWidget(scrollArea);
-	l->addWidget(mCbCheckAll);
+    QVBoxLayout *l = new QVBoxLayout(this);
+    l->addWidget(scrollArea);
+    l->addWidget(mCbCheckAll);
 }
 
-void DkMetaDataSelection::appendGUIEntry(const QString& key, const QString& value, int idx) {
-
-	QString cleanKey = key;
-	cleanKey = cleanKey.replace(".", " > ");
+void DkMetaDataSelection::appendGUIEntry(const QString &key, const QString &value, int idx)
+{
+    QString cleanKey = key;
+    cleanKey = cleanKey.replace(".", " > ");
 
-	QCheckBox* cb = new QCheckBox(cleanKey, this);
-	connect(cb, SIGNAL(clicked()), this, SLOT(selectionChanged()));
-	mSelection.append(cb);
+    QCheckBox *cb = new QCheckBox(cleanKey, this);
+    connect(cb, SIGNAL(clicked()), this, SLOT(selectionChanged()));
+    mSelection.append(cb);
 
-	QString cleanValue = DkUtils::cleanFraction(value);
-	QDateTime pd = DkUtils::getConvertableDate(cleanValue);
+    QString cleanValue = DkUtils::cleanFraction(value);
+    QDateTime pd = DkUtils::getConvertableDate(cleanValue);
 
-	if (!pd.isNull())
-		cleanValue = pd.toString(Qt::SystemLocaleShortDate);
+    if (!pd.isNull())
+        cleanValue = pd.toString(Qt::TextDate);
 
-	QLabel* label = new QLabel(cleanValue, this);
-	label->setObjectName("DkMetadataValueLabel");
+    QLabel *label = new QLabel(cleanValue, this);
+    label->setObjectName("DkMetadataValueLabel");
 
-	if (idx == -1)
-		idx = mKeys.size();
+    if (idx == -1)
+        idx = mKeys.size();
 
-	mLayout->addWidget(cb, idx, 1);
-	mLayout->addWidget(label, idx, 2);
+    mLayout->addWidget(cb, idx, 1);
+    mLayout->addWidget(label, idx, 2);
 }
 
-void DkMetaDataSelection::checkAll(bool checked) {
-
-	for (QCheckBox* cb : mSelection)
-		cb->setChecked(checked);
-
+void DkMetaDataSelection::checkAll(bool checked)
+{
+    for (QCheckBox *cb : mSelection)
+        cb->setChecked(checked);
 }
 
-void DkMetaDataSelection::selectionChanged() {
-
-	bool sel = false;
-	bool partial = false;
-	mCbCheckAll->setTristate(false);
+void DkMetaDataSelection::selectionChanged()
+{
+    bool sel = false;
+    bool partial = false;
+    mCbCheckAll->setTristate(false);
 
-	for (int idx = 0; idx < mSelection.size(); idx++) {
+    for (int idx = 0; idx < mSelection.size(); idx++) {
+        if (idx > 0 && sel != mSelection.at(idx)->isChecked()) {
+            mCbCheckAll->setCheckState(Qt::PartiallyChecked);
+            partial = true;
+            break;
+        }
 
-		if (idx > 0 && sel != mSelection.at(idx)->isChecked()) {
-			mCbCheckAll->setCheckState(Qt::PartiallyChecked);
-			partial = true;
-			break;
-		}
+        sel = mSelection.at(idx)->isChecked();
+    }
 
-		sel = mSelection.at(idx)->isChecked();
-	}
+    if (!partial)
+        mCbCheckAll->setChecked(sel);
 
-	if (!partial)
-		mCbCheckAll->setChecked(sel);
-
-	qDebug() << "selection changed...";
+    qDebug() << "selection changed...";
 }
 
-void DkMetaDataSelection::setSelectedKeys(const QStringList& selKeys) {
-
-	for (QString key : selKeys) {
-
-		int idx = mKeys.indexOf(key);
-
-		if (idx != -1) {
-			mSelection.at(idx)->setChecked(true);
-		}
-		else {
-			
-			// append entries that are not available in the current image
-			mKeys.append(key);
-			appendGUIEntry(key, "");
-			mSelection.last()->setChecked(true);
-		}
-	}
-
-	selectionChanged();
+void DkMetaDataSelection::setSelectedKeys(const QStringList &selKeys)
+{
+    for (QString key : selKeys) {
+        int idx = mKeys.indexOf(key);
+
+        if (idx != -1) {
+            mSelection.at(idx)->setChecked(true);
+        } else {
+            // append entries that are not available in the current image
+            mKeys.append(key);
+            appendGUIEntry(key, "");
+            mSelection.last()->setChecked(true);
+        }
+    }
+
+    selectionChanged();
 }
 
-QStringList DkMetaDataSelection::getSelectedKeys() const {
+QStringList DkMetaDataSelection::getSelectedKeys() const
+{
+    QStringList selKeys;
 
-	QStringList selKeys;
+    for (int idx = 0; idx < mSelection.size(); idx++) {
+        if (mSelection.at(idx)->isChecked())
+            selKeys.append(mKeys.at(idx));
+    }
 
-	for (int idx = 0; idx < mSelection.size(); idx++) {
-		
-		if (mSelection.at(idx)->isChecked())
-			selKeys.append(mKeys.at(idx));
-	}
-
-	return selKeys;
+    return selKeys;
 }
 
-void DkMetaDataSelection::createEntries(QSharedPointer<DkMetaDataT> metaData, QStringList& outKeys, QStringList& outValues) const {
-
-	if (!metaData)
-		return;
+void DkMetaDataSelection::createEntries(QSharedPointer<DkMetaDataT> metaData, QStringList &outKeys, QStringList &outValues) const
+{
+    if (!metaData)
+        return;
 
-	metaData->getFileMetaData(outKeys, outValues);
-	metaData->getAllMetaData(outKeys, outValues);
+    metaData->getFileMetaData(outKeys, outValues);
+    metaData->getAllMetaData(outKeys, outValues);
 }
 
 // DkMetaDataHUD --------------------------------------------------------------------
-DkMetaDataHUD::DkMetaDataHUD(QWidget* parent) : DkFadeWidget(parent) {
-
-	setObjectName("DkMetaDataHUD");
-	setCursor(Qt::ArrowCursor);
+DkMetaDataHUD::DkMetaDataHUD(QWidget *parent)
+    : DkFadeWidget(parent)
+{
+    setObjectName("DkMetaDataHUD");
+    setCursor(Qt::ArrowCursor);
 
-	// some inits
-	mKeyValues = getDefaultKeys();
-	loadSettings();
+    // some inits
+    mKeyValues = getDefaultKeys();
+    loadSettings();
 
-	if (mWindowPosition == pos_west || mWindowPosition == pos_east)
-		mOrientation = Qt::Vertical;
+    if (mWindowPosition == pos_west || mWindowPosition == pos_east)
+        mOrientation = Qt::Vertical;
 
-	createLayout();
-	createActions();
+    createLayout();
+    createActions();
 }
 
-DkMetaDataHUD::~DkMetaDataHUD() {
-
-	// save settings
-	saveSettings();
+DkMetaDataHUD::~DkMetaDataHUD()
+{
+    // save settings
+    saveSettings();
 }
 
-void DkMetaDataHUD::createLayout() {
-
-
-	QLabel* titleLabel = new QLabel(tr("Image Information"), this);
-	titleLabel->setObjectName("DkMetaDataHUDTitle");
-
-	QLabel* titleSeparator = new QLabel("", this);
-	titleSeparator->setObjectName("DkSeparator");
-
-	mTitleWidget = new QWidget(this);
-	QVBoxLayout* titleLayout = new QVBoxLayout(mTitleWidget);
-	titleLayout->addWidget(titleLabel);
-	titleLayout->addWidget(titleSeparator);
-
-	QString scrollbarStyle = 
-		QString("QScrollBar:vertical {border: 1px solid " + DkUtils::colorToString(DkSettingsManager::param().display().hudFgdColor) + "; background: rgba(0,0,0,0); width: 7px; margin: 0 0 0 0;}")
-		+ QString("QScrollBar::handle:vertical {background: " + DkUtils::colorToString(DkSettingsManager::param().display().hudFgdColor) + "; min-height: 0px;}")
-		+ QString("QScrollBar::add-line:vertical {height: 0px;}")
-		+ QString("QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {background: rgba(0,0,0,0); width: 1px;}")
-		+ QString("QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical {height: 0;}")
-	+ QString("QScrollBar:horizontal {border: 1px solid " + DkUtils::colorToString(DkSettingsManager::param().display().hudFgdColor) + "; background: rgba(0,0,0,0); height: 7px; margin: 0 0 0 0;}")	// horizontal
-		+ QString("QScrollBar::handle:horizontal {background: " + DkUtils::colorToString(DkSettingsManager::param().display().hudFgdColor) + "; min-width: 0px;}")
-		+ QString("QScrollBar::add-line:horizontal {width: 0px;}")
-		+ QString("QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal {background: rgba(0,0,0,0); height: 1px;}")
-		+ QString("QScrollBar::add-line:horizontal, QScrollBar::sub-line:horizontal {width: 0;}");
-
-	mScrollArea = new DkResizableScrollArea(this);
-	mScrollArea->setObjectName("DkScrollAreaMetaData");
-	mScrollArea->setWidgetResizable(true);
-	mScrollArea->setStyleSheet(scrollbarStyle + mScrollArea->styleSheet());
-	mScrollArea->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
-
-	mContentWidget = new QWidget(this);
-	mContentWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
-
-	mContentLayout = new QGridLayout(mContentWidget);
-	updateLabels();
-
-	mScrollArea->setWidget(mContentWidget);
-
-	QVBoxLayout* l = new QVBoxLayout(this);
-	l->setSpacing(0);
-	l->setContentsMargins(3,3,3,3);
-	l->addWidget(mScrollArea);
-} 
-
-void DkMetaDataHUD::createActions() {
-
-	mActions.resize(action_end);
+void DkMetaDataHUD::createLayout()
+{
+    QLabel *titleLabel = new QLabel(tr("Image Information"), this);
+    titleLabel->setObjectName("DkMetaDataHUDTitle");
+
+    QLabel *titleSeparator = new QLabel("", this);
+    titleSeparator->setObjectName("DkSeparator");
+
+    mTitleWidget = new QWidget(this);
+    QVBoxLayout *titleLayout = new QVBoxLayout(mTitleWidget);
+    titleLayout->addWidget(titleLabel);
+    titleLayout->addWidget(titleSeparator);
+
+    QString scrollbarStyle = QString("QScrollBar:vertical {border: 1px solid " + DkUtils::colorToString(DkSettingsManager::param().display().hudFgdColor)
+                                     + "; background: rgba(0,0,0,0); width: 7px; margin: 0 0 0 0;}")
+        + QString("QScrollBar::handle:vertical {background: " + DkUtils::colorToString(DkSettingsManager::param().display().hudFgdColor)
+                  + "; min-height: 0px;}")
+        + QString("QScrollBar::add-line:vertical {height: 0px;}")
+        + QString("QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {background: rgba(0,0,0,0); width: 1px;}")
+        + QString("QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical {height: 0;}")
+        + QString("QScrollBar:horizontal {border: 1px solid " + DkUtils::colorToString(DkSettingsManager::param().display().hudFgdColor)
+                  + "; background: rgba(0,0,0,0); height: 7px; margin: 0 0 0 0;}") // horizontal
+        + QString("QScrollBar::handle:horizontal {background: " + DkUtils::colorToString(DkSettingsManager::param().display().hudFgdColor)
+                  + "; min-width: 0px;}")
+        + QString("QScrollBar::add-line:horizontal {width: 0px;}")
+        + QString("QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal {background: rgba(0,0,0,0); height: 1px;}")
+        + QString("QScrollBar::add-line:horizontal, QScrollBar::sub-line:horizontal {width: 0;}");
+
+    mScrollArea = new DkResizableScrollArea(this);
+    mScrollArea->setObjectName("DkScrollAreaMetaData");
+    mScrollArea->setWidgetResizable(true);
+    mScrollArea->setStyleSheet(scrollbarStyle + mScrollArea->styleSheet());
+    mScrollArea->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
+
+    mContentWidget = new QWidget(this);
+    mContentWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+
+    mContentLayout = new QGridLayout(mContentWidget);
+    updateLabels();
+
+    mScrollArea->setWidget(mContentWidget);
+
+    QVBoxLayout *l = new QVBoxLayout(this);
+    l->setSpacing(0);
+    l->setContentsMargins(3, 3, 3, 3);
+    l->addWidget(mScrollArea);
+}
 
-	mActions[action_change_keys] = new QAction(tr("Change Entries"), this);
-	mActions[action_change_keys]->setStatusTip(tr("You can customize the entries displayed here."));
-	connect(mActions[action_change_keys], SIGNAL(triggered()), this, SLOT(changeKeys()));
+void DkMetaDataHUD::createActions()
+{
+    mActions.resize(action_end);
 
-	mActions[action_num_columns] = new QAction(tr("Number of Columns"), this);
-	mActions[action_num_columns]->setStatusTip(tr("Select the desired number of columns."));
-	connect(mActions[action_num_columns], SIGNAL(triggered()), this, SLOT(changeNumColumns()));
+    mActions[action_change_keys] = new QAction(tr("Change Entries"), this);
+    mActions[action_change_keys]->setStatusTip(tr("You can customize the entries displayed here."));
+    connect(mActions[action_change_keys], SIGNAL(triggered()), this, SLOT(changeKeys()));
 
-	mActions[action_set_to_default] = new QAction(tr("Set to Default"), this);
-	mActions[action_set_to_default]->setStatusTip(tr("Reset the metadata panel."));
-	connect(mActions[action_set_to_default], SIGNAL(triggered()), this, SLOT(setToDefault()));
+    mActions[action_num_columns] = new QAction(tr("Number of Columns"), this);
+    mActions[action_num_columns]->setStatusTip(tr("Select the desired number of columns."));
+    connect(mActions[action_num_columns], SIGNAL(triggered()), this, SLOT(changeNumColumns()));
 
-	// orientations
-	mActions[action_pos_west] = new QAction(tr("Show Left"), this);
-	mActions[action_pos_west]->setStatusTip(tr("Shows the Metadata on the Left"));
-	connect(mActions[action_pos_west], SIGNAL(triggered()), this, SLOT(newPosition()));
+    mActions[action_set_to_default] = new QAction(tr("Set to Default"), this);
+    mActions[action_set_to_default]->setStatusTip(tr("Reset the metadata panel."));
+    connect(mActions[action_set_to_default], SIGNAL(triggered()), this, SLOT(setToDefault()));
 
-	mActions[action_pos_north] = new QAction(tr("Show Top"), this);
-	mActions[action_pos_north]->setStatusTip(tr("Shows the Metadata at the Top"));
-	connect(mActions[action_pos_north], SIGNAL(triggered()), this, SLOT(newPosition()));
+    // orientations
+    mActions[action_pos_west] = new QAction(tr("Show Left"), this);
+    mActions[action_pos_west]->setStatusTip(tr("Shows the Metadata on the Left"));
+    connect(mActions[action_pos_west], SIGNAL(triggered()), this, SLOT(newPosition()));
 
-	mActions[action_pos_east] = new QAction(tr("Show Right"), this);
-	mActions[action_pos_east]->setStatusTip(tr("Shows the Metadata on the Right"));
-	connect(mActions[action_pos_east], SIGNAL(triggered()), this, SLOT(newPosition()));
+    mActions[action_pos_north] = new QAction(tr("Show Top"), this);
+    mActions[action_pos_north]->setStatusTip(tr("Shows the Metadata at the Top"));
+    connect(mActions[action_pos_north], SIGNAL(triggered()), this, SLOT(newPosition()));
 
-	mActions[action_pos_south] = new QAction(tr("Show Bottom"), this);
-	mActions[action_pos_south]->setStatusTip(tr("Shows the Metadata at the Bottom"));
-	connect(mActions[action_pos_south], SIGNAL(triggered()), this, SLOT(newPosition()));
+    mActions[action_pos_east] = new QAction(tr("Show Right"), this);
+    mActions[action_pos_east]->setStatusTip(tr("Shows the Metadata on the Right"));
+    connect(mActions[action_pos_east], SIGNAL(triggered()), this, SLOT(newPosition()));
 
+    mActions[action_pos_south] = new QAction(tr("Show Bottom"), this);
+    mActions[action_pos_south]->setStatusTip(tr("Shows the Metadata at the Bottom"));
+    connect(mActions[action_pos_south], SIGNAL(triggered()), this, SLOT(newPosition()));
 }
 
-void DkMetaDataHUD::loadSettings() {
-
-	DefaultSettings settings;
+void DkMetaDataHUD::loadSettings()
+{
+    DefaultSettings settings;
 
-	settings.beginGroup(objectName());
-	QStringList keyVals = settings.value("keyValues", QStringList()).toStringList();
-	mNumColumns = settings.value("numColumns", mNumColumns).toInt();
-	mWindowPosition = settings.value("windowPosition", mWindowPosition).toInt();
-	settings.endGroup();
+    settings.beginGroup(objectName());
+    QStringList keyVals = settings.value("keyValues", QStringList()).toStringList();
+    mNumColumns = settings.value("numColumns", mNumColumns).toInt();
+    mWindowPosition = settings.value("windowPosition", mWindowPosition).toInt();
+    settings.endGroup();
 
-	if (!keyVals.isEmpty())
-		mKeyValues = keyVals;
+    if (!keyVals.isEmpty())
+        mKeyValues = keyVals;
 }
 
-void DkMetaDataHUD::saveSettings() const {
+void DkMetaDataHUD::saveSettings() const
+{
+    if (mKeyValues.isEmpty())
+        return;
 
-	if (mKeyValues.isEmpty())
-		return;
+    DefaultSettings settings;
 
-	DefaultSettings settings;
-
-	settings.beginGroup(objectName());
-	settings.setValue("keyValues", mKeyValues);
-	settings.setValue("numColumns", mNumColumns);
-	settings.setValue("windowPosition", mWindowPosition);
-	settings.endGroup();
+    settings.beginGroup(objectName());
+    settings.setValue("keyValues", mKeyValues);
+    settings.setValue("numColumns", mNumColumns);
+    settings.setValue("windowPosition", mWindowPosition);
+    settings.endGroup();
 }
 
-int DkMetaDataHUD::getWindowPosition() const {
-	
-	return mWindowPosition;
+int DkMetaDataHUD::getWindowPosition() const
+{
+    return mWindowPosition;
 }
 
-QStringList DkMetaDataHUD::getDefaultKeys() const {
-
-	QStringList keyValues;
-
-	keyValues.append("File." + QObject::tr("Filename"));
-	keyValues.append("File." + QObject::tr("Path"));
-	keyValues.append("File." + QObject::tr("Size"));
-	keyValues.append("Exif.Image.Make");
-	keyValues.append("Exif.Image.Model");
-	keyValues.append("Exif.Image.DateTime");
-	keyValues.append("Exif.Image.ImageDescription");
-
-	keyValues.append("Exif.Photo.ISO");
-	keyValues.append("Exif.Photo.FocalLength");
-	keyValues.append("Exif.Photo.ExposureTime");
-	keyValues.append("Exif.Photo.Flash");
-	keyValues.append("Exif.Photo.FNumber");
-
-	return keyValues;
+QStringList DkMetaDataHUD::getDefaultKeys() const
+{
+    QStringList keyValues;
+
+    keyValues.append("File." + QObject::tr("Filename"));
+    keyValues.append("File." + QObject::tr("Path"));
+    keyValues.append("File." + QObject::tr("Size"));
+    keyValues.append("Exif.Image.Make");
+    keyValues.append("Exif.Image.Model");
+    keyValues.append("Exif.Image.DateTime");
+    keyValues.append("Exif.Image.ImageDescription");
+
+    keyValues.append("Exif.Photo.ISO");
+    keyValues.append("Exif.Photo.FocalLength");
+    keyValues.append("Exif.Photo.ExposureTime");
+    keyValues.append("Exif.Photo.Flash");
+    keyValues.append("Exif.Photo.FNumber");
+
+    return keyValues;
 }
 
-void DkMetaDataHUD::updateMetaData(const QSharedPointer<DkImageContainerT> cImg) {
+void DkMetaDataHUD::updateMetaData(const QSharedPointer<DkImageContainerT> cImg)
+{
+    if (cImg) {
+        mMetaData = cImg->getMetaData();
 
-	if (cImg) {
-		mMetaData = cImg->getMetaData();
-		
-		// only update if I am visible
-		if (isVisible())
-			updateMetaData(mMetaData);
-	}
-	else
-		mMetaData = QSharedPointer<DkMetaDataT>();
+        // only update if I am visible
+        if (isVisible())
+            updateMetaData(mMetaData);
+    } else
+        mMetaData = QSharedPointer<DkMetaDataT>();
 }
 
-void DkMetaDataHUD::updateMetaData(const QSharedPointer<DkMetaDataT> metaData) {
-
-	// clean up
-	for (QLabel* cLabel : mEntryKeyLabels)
-		delete cLabel;
-	for (QLabel* cLabel : mEntryValueLabels)
-		delete cLabel;
-
-	mEntryKeyLabels.clear();
-	mEntryValueLabels.clear();
+void DkMetaDataHUD::updateMetaData(const QSharedPointer<DkMetaDataT> metaData)
+{
+    // clean up
+    for (QLabel *cLabel : mEntryKeyLabels)
+        delete cLabel;
+    for (QLabel *cLabel : mEntryValueLabels)
+        delete cLabel;
 
-	if (!metaData) {
+    mEntryKeyLabels.clear();
+    mEntryValueLabels.clear();
 
-		// create dummy entries
-		for (QString cKey : mKeyValues) {
-			mEntryKeyLabels.append(createKeyLabel(cKey));
-		}
-		return;
-	}
+    if (!metaData) {
+        // create dummy entries
+        for (QString cKey : mKeyValues) {
+            mEntryKeyLabels.append(createKeyLabel(cKey));
+        }
+        return;
+    }
 
-	DkTimer dt;
+    DkTimer dt;
 
-	QStringList fileKeys, fileValues;
-	metaData->getFileMetaData(fileKeys, fileValues);
+    QStringList fileKeys, fileValues;
+    metaData->getFileMetaData(fileKeys, fileValues);
 
-	for (int idx = 0; idx < fileKeys.size(); idx++) {
+    for (int idx = 0; idx < fileKeys.size(); idx++) {
+        QString cKey = fileKeys.at(idx);
+        if (mKeyValues.contains(cKey)) {
+            mEntryKeyLabels.append(createKeyLabel(cKey));
+            mEntryValueLabels.append(createValueLabel(fileValues.at(idx)));
+        }
+    }
 
-		QString cKey = fileKeys.at(idx);
-		if (mKeyValues.contains(cKey)) {
-			mEntryKeyLabels.append(createKeyLabel(cKey));
-			mEntryValueLabels.append(createValueLabel(fileValues.at(idx)));
-		}
-	}
+    QStringList exifKeys = metaData->getExifKeys();
 
-	QStringList exifKeys = metaData->getExifKeys();
+    for (int idx = 0; idx < exifKeys.size(); idx++) {
+        QString cKey = exifKeys.at(idx);
 
-	for (int idx = 0; idx < exifKeys.size(); idx++) {
+        if (mKeyValues.contains(cKey)) {
+            QString lastKey = cKey.split(".").last();
+            QString exifValue = metaData->getNativeExifValue(exifKeys.at(idx), true);
+            exifValue = DkMetaDataHelper::getInstance().resolveSpecialValue(metaData, lastKey, exifValue);
 
-		QString cKey = exifKeys.at(idx);
+            mEntryKeyLabels.append(createKeyLabel(cKey));
+            mEntryValueLabels.append(createValueLabel(exifValue));
+        }
+    }
 
-		if (mKeyValues.contains(cKey)) {
-			QString lastKey = cKey.split(".").last();
-			QString exifValue = metaData->getNativeExifValue(exifKeys.at(idx));
-			exifValue = DkMetaDataHelper::getInstance().resolveSpecialValue(metaData, lastKey, exifValue);
+    QStringList iptcKeys = metaData->getIptcKeys();
 
-			mEntryKeyLabels.append(createKeyLabel(cKey));
-			mEntryValueLabels.append(createValueLabel(exifValue));
-		}
-	}
+    for (int idx = 0; idx < iptcKeys.size(); idx++) {
+        QString cKey = iptcKeys.at(idx);
 
-	QStringList iptcKeys = metaData->getIptcKeys();
+        if (mKeyValues.contains(cKey)) {
+            QString lastKey = iptcKeys.at(idx).split(".").last();
+            QString exifValue = metaData->getIptcValue(iptcKeys.at(idx));
+            exifValue = DkMetaDataHelper::getInstance().resolveSpecialValue(metaData, lastKey, exifValue);
 
-	for (int idx = 0; idx < iptcKeys.size(); idx++) {
+            mEntryKeyLabels.append(createKeyLabel(cKey));
+            mEntryValueLabels.append(createValueLabel(exifValue));
+        }
+    }
 
-		QString cKey = iptcKeys.at(idx);
+    QStringList xmpKeys = metaData->getXmpKeys();
 
-		if (mKeyValues.contains(cKey)) {
+    for (int idx = 0; idx < xmpKeys.size(); idx++) {
+        QString cKey = xmpKeys.at(idx);
 
-			QString lastKey = iptcKeys.at(idx).split(".").last();
-			QString exifValue = metaData->getIptcValue(iptcKeys.at(idx));
-			exifValue = DkMetaDataHelper::getInstance().resolveSpecialValue(metaData, lastKey, exifValue);
+        if (mKeyValues.contains(cKey)) {
+            QString lastKey = xmpKeys.at(idx).split(".").last();
+            QString exifValue = metaData->getXmpValue(xmpKeys.at(idx));
+            exifValue = DkMetaDataHelper::getInstance().resolveSpecialValue(metaData, lastKey, exifValue);
 
-			mEntryKeyLabels.append(createKeyLabel(cKey));
-			mEntryValueLabels.append(createValueLabel(exifValue));
-		}
-	}
+            mEntryKeyLabels.append(createKeyLabel(cKey));
+            mEntryValueLabels.append(createValueLabel(exifValue));
+        }
+    }
 
-	QStringList xmpKeys = metaData->getXmpKeys();
+    QStringList qtKeys = metaData->getQtKeys();
 
-	for (int idx = 0; idx < xmpKeys.size(); idx++) {
+    for (int idx = 0; idx < qtKeys.size(); idx++) {
+        QString cKey = qtKeys.at(idx);
 
-		QString cKey = xmpKeys.at(idx);
+        if (mKeyValues.contains(cKey)) {
+            QString lastKey = cKey.split(".").last();
+            QString exifValue = metaData->getQtValue(cKey);
+            exifValue = DkMetaDataHelper::getInstance().resolveSpecialValue(metaData, lastKey, exifValue);
 
-		if (mKeyValues.contains(cKey)) {
+            mEntryKeyLabels.append(createKeyLabel(cKey));
+            mEntryValueLabels.append(createValueLabel(exifValue));
+        }
+    }
 
-			QString lastKey = xmpKeys.at(idx).split(".").last();
-			QString exifValue = metaData->getXmpValue(xmpKeys.at(idx));
-			exifValue = DkMetaDataHelper::getInstance().resolveSpecialValue(metaData, lastKey, exifValue);
-
-			mEntryKeyLabels.append(createKeyLabel(cKey));
-			mEntryValueLabels.append(createValueLabel(exifValue));
-		}
-	}
-
-	QStringList qtKeys = metaData->getQtKeys();
-
-	for (int idx = 0; idx < qtKeys.size(); idx++) {
-
-		QString cKey = qtKeys.at(idx);
-
-		if (mKeyValues.contains(cKey)) {
-
-			QString lastKey = cKey.split(".").last();
-			QString exifValue = metaData->getQtValue(cKey);
-			exifValue = DkMetaDataHelper::getInstance().resolveSpecialValue(metaData, lastKey, exifValue);
-
-			mEntryKeyLabels.append(createKeyLabel(cKey));
-			mEntryValueLabels.append(createValueLabel(exifValue));
-		}
-	}
-
-
-	updateLabels();
+    updateLabels();
 }
 
-void DkMetaDataHUD::updateLabels(int numColumns /* = -1 */) {
-
-	if (numColumns == -1 && mNumColumns == -1) {
-		int numLines = 6;
-		numColumns = ((float)mEntryKeyLabels.size()+numLines-1)/numLines > 2 ? qRound(((float)mEntryKeyLabels.size()+numLines-1)/numLines) : 2;
-	}
-	else if (numColumns == -1) {
-		numColumns = mNumColumns;
-	}
-
-	if (mOrientation == Qt::Vertical)
-		numColumns = 1;
-
-	int cIdx = 0;
-	int rIdx = 0;
-	int nRows = qCeil((float)(mEntryKeyLabels.size())/numColumns);
-
-	// stretch between labels
-	// we need this for correct context menu handling
-	int cS = (mOrientation == Qt::Horizontal) ? 10 : 0;
-	mContentLayout->setColumnStretch(cIdx, cS); cIdx++;
-	mContentLayout->setRowStretch(rIdx, cS);
-
-	mTitleWidget->setVisible(mOrientation == Qt::Vertical);
-	if (mOrientation == Qt::Vertical)
-		mContentLayout->addWidget(mTitleWidget, 0, 0, 1, 4);
-
-	for (int idx = 0; idx < mEntryKeyLabels.size(); idx++) {
-
-		if (idx && idx % nRows == 0) {
-			rIdx = 0;
-			cIdx += 3;
-			mContentLayout->setColumnStretch(cIdx-1, cS);
-		}
-		 
-		mContentLayout->addWidget(mEntryKeyLabels.at(idx), rIdx+1, cIdx, 1, 1, Qt::AlignTop);
-		mContentLayout->addWidget(mEntryValueLabels.at(idx), rIdx+1, cIdx+1, 1, 1, Qt::AlignTop);
-		rIdx++;
-	}
-	
-	mContentLayout->setColumnStretch(cIdx+1, cS);
-	mContentLayout->setRowStretch(1000, 10);	// stretch a reasonably high row (we assume to have less than 1000 entries)
-
-	// remove old columnStretches
-	for (int idx = cIdx+2; idx < 40; idx++)
-		mContentLayout->setColumnStretch(idx, 0);
-
-	if (mOrientation == Qt::Vertical) {
-		// some scroll area settings need to be adopted to the orientation
-		mScrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
-		mScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-	}
-	else {
-		// some scroll area settings need to be adopted to the orientation
-		mScrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-		mScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
-	}
-
-	// TODO: I give now up on this:
-	// I do not understand why Qt does not simply resize according to the
-	// child widget's constraints if Qt::ScrollBarAlwaysOff is set
-	// to me, this would be intended behavior
-	// resizing itself is fixed, however, on layout changes it won't
-	// decrease it's size
+void DkMetaDataHUD::updateLabels(int numColumns /* = -1 */)
+{
+    if (numColumns == -1 && mNumColumns == -1) {
+        int numLines = 6;
+        numColumns = ((float)mEntryKeyLabels.size() + numLines - 1) / numLines > 2 ? qRound(((float)mEntryKeyLabels.size() + numLines - 1) / numLines) : 2;
+    } else if (numColumns == -1) {
+        numColumns = mNumColumns;
+    }
+
+    if (mOrientation == Qt::Vertical)
+        numColumns = 1;
+
+    int cIdx = 0;
+    int rIdx = 0;
+    int nRows = qCeil((float)(mEntryKeyLabels.size()) / numColumns);
+
+    // stretch between labels
+    // we need this for correct context menu handling
+    int cS = (mOrientation == Qt::Horizontal) ? 10 : 0;
+    mContentLayout->setColumnStretch(cIdx, cS);
+    cIdx++;
+    mContentLayout->setRowStretch(rIdx, cS);
+
+    mTitleWidget->setVisible(mOrientation == Qt::Vertical);
+    if (mOrientation == Qt::Vertical)
+        mContentLayout->addWidget(mTitleWidget, 0, 0, 1, 4);
+
+    for (int idx = 0; idx < mEntryKeyLabels.size(); idx++) {
+        if (idx && idx % nRows == 0) {
+            rIdx = 0;
+            cIdx += 3;
+            mContentLayout->setColumnStretch(cIdx - 1, cS);
+        }
+
+        mContentLayout->addWidget(mEntryKeyLabels.at(idx), rIdx + 1, cIdx, 1, 1, Qt::AlignTop);
+        mContentLayout->addWidget(mEntryValueLabels.at(idx), rIdx + 1, cIdx + 1, 1, 1, Qt::AlignTop);
+        rIdx++;
+    }
+
+    mContentLayout->setColumnStretch(cIdx + 1, cS);
+    mContentLayout->setRowStretch(1000, 10); // stretch a reasonably high row (we assume to have less than 1000 entries)
+
+    // remove old columnStretches
+    for (int idx = cIdx + 2; idx < 40; idx++)
+        mContentLayout->setColumnStretch(idx, 0);
+
+    if (mOrientation == Qt::Vertical) {
+        // some scroll area settings need to be adopted to the orientation
+        mScrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
+        mScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+    } else {
+        // some scroll area settings need to be adopted to the orientation
+        mScrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+        mScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
+    }
+
+    // TODO: I give now up on this:
+    // I do not understand why Qt does not simply resize according to the
+    // child widget's constraints if Qt::ScrollBarAlwaysOff is set
+    // to me, this would be intended behavior
+    // resizing itself is fixed, however, on layout changes it won't
+    // decrease it's size
 }
 
-QLabel* DkMetaDataHUD::createKeyLabel(const QString& key) {
-
-	QString labelString = key.split(".").last();
-	labelString = DkMetaDataHelper::getInstance().translateKey(labelString);
-	QLabel* keyLabel = new QLabel(labelString, this);
-	keyLabel->setObjectName("DkMetaDataKeyLabel");
-	keyLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
-	keyLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
+QLabel *DkMetaDataHUD::createKeyLabel(const QString &key)
+{
+    QString labelString = key.split(".").last();
+    labelString = DkMetaDataHelper::getInstance().translateKey(labelString);
+    QLabel *keyLabel = new QLabel(labelString, this);
+    keyLabel->setObjectName("DkMetaDataKeyLabel");
+    keyLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
+    keyLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
 
-	return keyLabel;
+    return keyLabel;
 }
 
-QLabel* DkMetaDataHUD::createValueLabel(const QString& val) {
+QLabel *DkMetaDataHUD::createValueLabel(const QString &val)
+{
+    QString cleanValue = DkUtils::cleanFraction(val);
+    QDateTime pd = DkUtils::getConvertableDate(cleanValue);
 
-	QString cleanValue = DkUtils::cleanFraction(val);
-	QDateTime pd = DkUtils::getConvertableDate(cleanValue);
+    if (!pd.isNull())
+        cleanValue = pd.toString(Qt::TextDate);
 
-	if (!pd.isNull())
-		cleanValue = pd.toString(Qt::SystemLocaleShortDate);
+    QLabel *valLabel = new QLabel(cleanValue.trimmed(), this);
+    valLabel->setObjectName("DkMetaDataLabel");
+    valLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
+    valLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
 
-	QLabel* valLabel = new QLabel(cleanValue.trimmed(), this);
-	valLabel->setObjectName("DkMetaDataLabel");
-	valLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
-	valLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
-
-	return valLabel;
+    return valLabel;
 }
 
 // events
-void DkMetaDataHUD::contextMenuEvent(QContextMenuEvent *event) {
-
-	if (!mContextMenu) {
-		mContextMenu = new QMenu(tr("Metadata Menu"), this);
-		mContextMenu->addActions(mActions.toList());
-	}
+void DkMetaDataHUD::contextMenuEvent(QContextMenuEvent *event)
+{
+    if (!mContextMenu) {
+        mContextMenu = new QMenu(tr("Metadata Menu"), this);
+        mContextMenu->addActions(mActions.toList());
+    }
 
-	mContextMenu->exec(event->globalPos());
-	event->accept();
+    mContextMenu->exec(event->globalPos());
+    event->accept();
 
-	//DkFadeWidget::contextMenuEvent(event);
+    // DkFadeWidget::contextMenuEvent(event);
 }
 
 // public slots...
-void DkMetaDataHUD::setVisible(bool visible, bool saveSetting /* = true */) {
-
-	DkFadeWidget::setVisible(visible, saveSetting);
+void DkMetaDataHUD::setVisible(bool visible, bool saveSetting /* = true */)
+{
+    DkFadeWidget::setVisible(visible, saveSetting);
 
-	updateMetaData(mMetaData);
+    updateMetaData(mMetaData);
 }
 
-void DkMetaDataHUD::newPosition() {
-
-	QAction* sender = static_cast<QAction*>(QObject::sender());
-
-	if (!sender)
-		return;
-
-	int pos = 0;
-	Qt::Orientation orient = Qt::Horizontal;
-
-	if (sender == mActions[action_pos_west]) {
-		pos = pos_west;
-		orient = Qt::Vertical;
-	}
-	else if (sender == mActions[action_pos_east]) {
-		pos = pos_east;
-		orient = Qt::Vertical;
-	}
-	else if (sender == mActions[action_pos_north]) {
-		pos = pos_north;
-		orient = Qt::Horizontal;
-	}
-	else {
-		pos = pos_south;
-		orient = Qt::Horizontal;
-	}
-
-	mWindowPosition = pos;
-	mOrientation = orient;
-	emit positionChangeSignal(mWindowPosition);
-
-	updateLabels();
+void DkMetaDataHUD::newPosition()
+{
+    QAction *sender = static_cast<QAction *>(QObject::sender());
+
+    if (!sender)
+        return;
+
+    int pos = 0;
+    Qt::Orientation orient = Qt::Horizontal;
+
+    if (sender == mActions[action_pos_west]) {
+        pos = pos_west;
+        orient = Qt::Vertical;
+    } else if (sender == mActions[action_pos_east]) {
+        pos = pos_east;
+        orient = Qt::Vertical;
+    } else if (sender == mActions[action_pos_north]) {
+        pos = pos_north;
+        orient = Qt::Horizontal;
+    } else {
+        pos = pos_south;
+        orient = Qt::Horizontal;
+    }
+
+    mWindowPosition = pos;
+    mOrientation = orient;
+    emit positionChangeSignal(mWindowPosition);
+
+    updateLabels();
 }
 
-void DkMetaDataHUD::changeKeys() {
+void DkMetaDataHUD::changeKeys()
+{
+    QDialog *dialog = new QDialog(this);
+    dialog->setWindowTitle(tr("Change Metadata Entries"));
 
-	QDialog* dialog = new QDialog(this);
-	dialog->setWindowTitle(tr("Change Metadata Entries"));
-		
-	DkMetaDataSelection* selWidget = new DkMetaDataSelection(mMetaData, this);
-	selWidget->setSelectedKeys(mKeyValues);
+    DkMetaDataSelection *selWidget = new DkMetaDataSelection(mMetaData, this);
+    selWidget->setSelectedKeys(mKeyValues);
 
-	// mButtons
-	QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
-	buttons->button(QDialogButtonBox::Ok)->setText(tr("&OK"));
-	buttons->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel"));
-	connect(buttons, SIGNAL(accepted()), dialog, SLOT(accept()));
-	connect(buttons, SIGNAL(rejected()), dialog, SLOT(reject()));
+    // mButtons
+    QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
+    buttons->button(QDialogButtonBox::Ok)->setText(tr("&OK"));
+    buttons->button(QDialogButtonBox::Cancel)->setText(tr("&Cancel"));
+    connect(buttons, SIGNAL(accepted()), dialog, SLOT(accept()));
+    connect(buttons, SIGNAL(rejected()), dialog, SLOT(reject()));
 
-	QVBoxLayout* layout = new QVBoxLayout(dialog);
-	layout->addWidget(selWidget);
-	layout->addWidget(buttons);
+    QVBoxLayout *layout = new QVBoxLayout(dialog);
+    layout->addWidget(selWidget);
+    layout->addWidget(buttons);
 
-	int res = dialog->exec();
+    int res = dialog->exec();
 
-	if (res == QDialog::Accepted) {
-		mKeyValues = selWidget->getSelectedKeys();
-		updateMetaData(mMetaData);
-	}
+    if (res == QDialog::Accepted) {
+        mKeyValues = selWidget->getSelectedKeys();
+        updateMetaData(mMetaData);
+    }
 
-	dialog->deleteLater();
+    dialog->deleteLater();
 }
 
-void DkMetaDataHUD::changeNumColumns() {
-
-	bool ok;
-	int val = QInputDialog::getInt(this, tr("Number of Columns"), tr("Number of columns (-1 is default)"), mNumColumns, -1, 20, 1, &ok);
+void DkMetaDataHUD::changeNumColumns()
+{
+    bool ok;
+    int val = QInputDialog::getInt(this, tr("Number of Columns"), tr("Number of columns (-1 is default)"), mNumColumns, -1, 20, 1, &ok);
 
-	if (ok) {
-		mNumColumns = val;
-		updateLabels(mNumColumns);
-	}
+    if (ok) {
+        mNumColumns = val;
+        updateLabels(mNumColumns);
+    }
 }
 
-void DkMetaDataHUD::setToDefault() {
-
-	mNumColumns = -1;
-	mKeyValues = getDefaultKeys();
-	updateMetaData(mMetaData);
+void DkMetaDataHUD::setToDefault()
+{
+    mNumColumns = -1;
+    mKeyValues = getDefaultKeys();
+    updateMetaData(mMetaData);
 }
 
 // DkCommentTextEdit --------------------------------------------------------------------
-DkCommentTextEdit::DkCommentTextEdit(QWidget* parent /* = 0 */) : QTextEdit(parent) {
-
+DkCommentTextEdit::DkCommentTextEdit(QWidget *parent /* = 0 */)
+    : QTextEdit(parent)
+{
 }
 
-void DkCommentTextEdit::focusOutEvent(QFocusEvent *focusEvent) {
-	emit focusLost();
-	QTextEdit::focusOutEvent(focusEvent);
+void DkCommentTextEdit::focusOutEvent(QFocusEvent *focusEvent)
+{
+    emit focusLost();
+    QTextEdit::focusOutEvent(focusEvent);
 }
 
-void DkCommentTextEdit::paintEvent(QPaintEvent* e) {
+void DkCommentTextEdit::paintEvent(QPaintEvent *e)
+{
+    if (toPlainText().isEmpty() && !viewport()->hasFocus()) {
+        QPainter p(viewport());
+        p.setOpacity(0.5);
+        p.drawText(QRect(QPoint(), viewport()->size()), Qt::AlignHCenter | Qt::AlignVCenter, tr("Click here to add notes"));
+        // qDebug() << "painting placeholder...";
+    }
 
-	if (toPlainText().isEmpty() && !viewport()->hasFocus()) {
-		QPainter p(viewport());
-		p.setOpacity(0.5);
-		p.drawText(QRect(QPoint(), viewport()->size()), Qt::AlignHCenter | Qt::AlignVCenter, tr("Click here to add notes"));
-		//qDebug() << "painting placeholder...";
-	}
-	
-	QTextEdit::paintEvent(e);
+    QTextEdit::paintEvent(e);
 }
 
 // DkCommentWidget --------------------------------------------------------------------
-DkCommentWidget::DkCommentWidget(QWidget* parent /* = 0 */, Qt::WindowFlags /* = 0 */) : DkFadeLabel(parent) {
-
-	setMaximumSize(220, 150);
-	createLayout();
-	QMetaObject::connectSlotsByName(this);
+DkCommentWidget::DkCommentWidget(QWidget *parent /* = 0 */, Qt::WindowFlags /* = 0 */)
+    : DkFadeLabel(parent)
+{
+    setMaximumSize(220, 150);
+    createLayout();
+    QMetaObject::connectSlotsByName(this);
 }
 
-void DkCommentWidget::createLayout() {
-
-	setObjectName("DkCommentWidget");
-
-	QLabel* titleLabel = new QLabel(tr("NOTES"), this);
-	titleLabel->setObjectName("commentTitleLabel");
-
-	QString scrollbarStyle = 
-		QString("QScrollBar:vertical {border: 1px solid " + DkUtils::colorToString(DkSettingsManager::param().display().hudFgdColor) + "; background: rgba(0,0,0,0); width: 7px; margin: 0 0 0 0;}")
-		+ QString("QScrollBar::handle:vertical {background: " + DkUtils::colorToString(DkSettingsManager::param().display().hudFgdColor) + "; min-height: 0px;}")
-		+ QString("QScrollBar::add-line:vertical {height: 0px;}")
-		+ QString("QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {background: rgba(0,0,0,0); width: 1px;}")
-		+ QString("QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical {height: 0;}");
-
-	mCommentLabel = new DkCommentTextEdit(this);
-	mCommentLabel->setObjectName("CommentLabel");
-	mCommentLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
-	mCommentLabel->setStyleSheet(scrollbarStyle + mCommentLabel->styleSheet());
-	mCommentLabel->setToolTip(tr("Enter your notes here. They will be saved to the image metadata."));
-
-	QPushButton* saveButton = new QPushButton(this);
-	saveButton->setObjectName("saveButton");
-	saveButton->setFlat(true);
-	saveButton->setIcon(DkImage::loadIcon(":/nomacs/img/save.svg", QSize(), DkSettingsManager::param().display().hudFgdColor));
-	saveButton->setToolTip(tr("Save Note (CTRL + ENTER)"));
-	saveButton->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Return));
-
-	QPushButton* cancelButton = new QPushButton(this);
-	cancelButton->setObjectName("cancelButton");
-	cancelButton->setFlat(true);
-	cancelButton->setIcon(DkImage::loadIcon(":/nomacs/img/trash.svg", QSize(), DkSettingsManager::param().display().hudFgdColor));
-	cancelButton->setToolTip(tr("Discard Changes (ESC)"));
-	cancelButton->setShortcut(QKeySequence(Qt::Key_Escape));
-
-	QWidget* titleWidget = new QWidget(this);
-	QHBoxLayout* titleLayout = new QHBoxLayout(titleWidget);
-	titleLayout->setAlignment(Qt::AlignLeft);
-	titleLayout->setContentsMargins(0, 0, 0, 0);
-	titleLayout->setSpacing(0);
-	titleLayout->addWidget(titleLabel);
-	titleLayout->addStretch();
-	titleLayout->addWidget(cancelButton, 0, Qt::AlignVCenter);
-	titleLayout->addWidget(saveButton, 0, Qt::AlignVCenter);
-
-	QVBoxLayout* layout = new QVBoxLayout(this);
-	//layout->setContentsMargins(0,0,0,0);
-	layout->addWidget(titleWidget);
-	layout->addWidget(mCommentLabel);
-
-	setLayout(layout);
-	setCursor(Qt::ArrowCursor);
+void DkCommentWidget::createLayout()
+{
+    setObjectName("DkCommentWidget");
+
+    QLabel *titleLabel = new QLabel(tr("NOTES"), this);
+    titleLabel->setObjectName("commentTitleLabel");
+
+    QString scrollbarStyle = QString("QScrollBar:vertical {border: 1px solid " + DkUtils::colorToString(DkSettingsManager::param().display().hudFgdColor)
+                                     + "; background: rgba(0,0,0,0); width: 7px; margin: 0 0 0 0;}")
+        + QString("QScrollBar::handle:vertical {background: " + DkUtils::colorToString(DkSettingsManager::param().display().hudFgdColor)
+                  + "; min-height: 0px;}")
+        + QString("QScrollBar::add-line:vertical {height: 0px;}")
+        + QString("QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {background: rgba(0,0,0,0); width: 1px;}")
+        + QString("QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical {height: 0;}");
+
+    mCommentLabel = new DkCommentTextEdit(this);
+    mCommentLabel->setObjectName("CommentLabel");
+    mCommentLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
+    mCommentLabel->setStyleSheet(scrollbarStyle + mCommentLabel->styleSheet());
+    mCommentLabel->setToolTip(tr("Enter your notes here. They will be saved to the image metadata."));
+
+    QPushButton *saveButton = new QPushButton(this);
+    saveButton->setObjectName("saveButton");
+    saveButton->setFlat(true);
+    saveButton->setIcon(DkImage::loadIcon(":/nomacs/img/save.svg", QSize(), DkSettingsManager::param().display().hudFgdColor));
+    saveButton->setToolTip(tr("Save Note (CTRL + ENTER)"));
+    saveButton->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Return));
+
+    QPushButton *cancelButton = new QPushButton(this);
+    cancelButton->setObjectName("cancelButton");
+    cancelButton->setFlat(true);
+    cancelButton->setIcon(DkImage::loadIcon(":/nomacs/img/trash.svg", QSize(), DkSettingsManager::param().display().hudFgdColor));
+    cancelButton->setToolTip(tr("Discard Changes (ESC)"));
+    cancelButton->setShortcut(QKeySequence(Qt::Key_Escape));
+
+    QWidget *titleWidget = new QWidget(this);
+    QHBoxLayout *titleLayout = new QHBoxLayout(titleWidget);
+    titleLayout->setAlignment(Qt::AlignLeft);
+    titleLayout->setContentsMargins(0, 0, 0, 0);
+    titleLayout->setSpacing(0);
+    titleLayout->addWidget(titleLabel);
+    titleLayout->addStretch();
+    titleLayout->addWidget(cancelButton, 0, Qt::AlignVCenter);
+    titleLayout->addWidget(saveButton, 0, Qt::AlignVCenter);
+
+    QVBoxLayout *layout = new QVBoxLayout(this);
+    // layout->setContentsMargins(0,0,0,0);
+    layout->addWidget(titleWidget);
+    layout->addWidget(mCommentLabel);
+
+    setLayout(layout);
+    setCursor(Qt::ArrowCursor);
 }
 
-void DkCommentWidget::setMetaData(QSharedPointer<DkMetaDataT> metaData) {
-
-	mMetaData = metaData;
-	setComment(metaData->getDescription());
+void DkCommentWidget::setMetaData(QSharedPointer<DkMetaDataT> metaData)
+{
+    mMetaData = metaData;
+    initComment(metaData->getDescription());
 }
 
-void DkCommentWidget::setComment(const QString& description) {
-	
-	mCommentLabel->setText(description);
-
-	mOldText = description;
-	mDirty = false;
+void DkCommentWidget::initComment(const QString &description)
+{
+    mOldText = description;
+    resetComment();
 }
 
-void DkCommentWidget::saveComment() {
-
-	if (mTextChanged && mCommentLabel->toPlainText() != mMetaData->getDescription() && mMetaData) {
-		
-		if (!mMetaData->setDescription(mCommentLabel->toPlainText()) && !mCommentLabel->toPlainText().isEmpty()) {
-			emit showInfoSignal(tr("Sorry, I cannot save comments for this image format."));
-		}
-		else
-			mDirty = true;
-	}
+void DkCommentWidget::resetComment()
+{
+    // First, reset comment text (triggering changed event, but not edited event)
+    mOldText = mMetaData->getDescription();
+    mCommentLabel->setText(mOldText);
+    mCommentLabel->clearFocus();
+    // Reset internal state (this panel only)
+    mTextEdited = false;
+    // Just like in any typical webform, "cancel"/"reset" shouldn't save anything
 }
 
-void DkCommentWidget::on_CommentLabel_textChanged() {
-
-	mTextChanged = true;
+QString DkCommentWidget::text() const
+{
+    return mCommentLabel->toPlainText();
 }
 
-void DkCommentWidget::on_CommentLabel_focusLost() {
-
-	saveComment();
+void DkCommentWidget::saveComment()
+{
+    if (mTextEdited && mCommentLabel->toPlainText() != mMetaData->getDescription() && mMetaData) {
+        if (!mMetaData->setDescription(text()) && !text().isEmpty()) {
+            emit showInfoSignal(tr("Sorry, I cannot save comments for this image format."));
+            return;
+        }
+        initComment(text());
+
+        emit commentSavedSignal();
+        emit commentSavedSignal(tr("File comment"));
+    }
 }
 
-void DkCommentWidget::on_saveButton_clicked() {
-
-	mCommentLabel->clearFocus();
+void DkCommentWidget::on_CommentLabel_textChanged()
+{
+    mTextEdited = text() != mOldText;
+    if (mTextEdited)
+        emit commentEditedSignal();
 }
 
-void DkCommentWidget::on_cancelButton_clicked() {
+void DkCommentWidget::on_CommentLabel_focusLost()
+{
+    // We don't want to do anything when changing focus
+}
 
-	mTextChanged = false;
-	mCommentLabel->clearFocus();
-	mCommentLabel->setText("");
+void DkCommentWidget::on_saveButton_clicked()
+{
+    saveComment();
+    mCommentLabel->clearFocus();
+}
 
-	saveComment();
+void DkCommentWidget::on_cancelButton_clicked()
+{
+    resetComment();
 }
 
 }
diff --git a/ImageLounge/src/DkGui/DkMetaDataWidgets.h b/ImageLounge/src/DkGui/DkMetaDataWidgets.h
index 54b331a..c69102c 100644
--- a/ImageLounge/src/DkGui/DkMetaDataWidgets.h
+++ b/ImageLounge/src/DkGui/DkMetaDataWidgets.h
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkMetaDataWidgets.h
  Created on:	17.08.2014
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2014 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2014 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2014 Florian Kleber <florian@nomacs.org>
@@ -27,12 +27,12 @@
 
 #pragma once
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QTextEdit>
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QAbstractTableModel>
 #include <QDockWidget>
 #include <QSortFilterProxyModel>
-#pragma warning(pop)		// no warnings from includes - end
+#include <QTextEdit>
+#pragma warning(pop) // no warnings from includes - end
 
 #include "DkBaseWidgets.h"
 #include "DkImageContainer.h"
@@ -46,220 +46,234 @@ class QCheckBox;
 class QVBoxLayout;
 class QLineEdit;
 
-namespace nmc {
+namespace nmc
+{
 
 // nomacs defines
 class TreeItem;
 
-class DkMetaDataModel : public QAbstractItemModel {
-	Q_OBJECT
+class DkMetaDataModel : public QAbstractItemModel
+{
+    Q_OBJECT
 
 public:
-	DkMetaDataModel(QObject* parent = 0);
-	~DkMetaDataModel();
+    DkMetaDataModel(QObject *parent = 0);
+    ~DkMetaDataModel();
 
-	QModelIndex index(int row, int column, const QModelIndex &parent) const;
-	QModelIndex parent(const QModelIndex &index) const;
+    QModelIndex index(int row, int column, const QModelIndex &parent) const;
+    QModelIndex parent(const QModelIndex &index) const;
 
-	// return item of the model
-	virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
-	virtual int columnCount(const QModelIndex& parent = QModelIndex()) const;
-	virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
-	virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
+    // return item of the model
+    virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
+    virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
+    virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+    virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
 
-	virtual Qt::ItemFlags flags(const QModelIndex& index) const;
-	//virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
+    virtual Qt::ItemFlags flags(const QModelIndex &index) const;
+    // virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
 
-	virtual void addMetaData(QSharedPointer<DkMetaDataT> metaData);
-	void clear();
+    virtual void addMetaData(QSharedPointer<DkMetaDataT> metaData);
+    void clear();
 
 protected:
-	TreeItem* rootItem;
+    TreeItem *rootItem;
 
-	void createItem(const QString& key, const QString& keyName, const QString& value);
+    void createItem(const QString &key, const QString &keyName, const QString &value);
 };
 
-class DkMetaDataProxyModel : public QSortFilterProxyModel {
-	Q_OBJECT
+class DkMetaDataProxyModel : public QSortFilterProxyModel
+{
+    Q_OBJECT
 
 public:
-	DkMetaDataProxyModel(QObject * parent = 0);
-	virtual ~DkMetaDataProxyModel() {}
+    DkMetaDataProxyModel(QObject *parent = 0);
+    virtual ~DkMetaDataProxyModel()
+    {
+    }
 
 protected:
-	virtual bool filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const override;
-
+    virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
 };
 
-class DkMetaDataDock : public DkDockWidget {
-	Q_OBJECT
+class DkMetaDataDock : public DkDockWidget
+{
+    Q_OBJECT
 
 public:
-	DkMetaDataDock(const QString& title, QWidget* parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
-	~DkMetaDataDock();
+    DkMetaDataDock(const QString &title, QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
+    ~DkMetaDataDock();
 
 public slots:
-	void setImage(QSharedPointer<DkImageContainerT> imgC);
-	void thumbLoaded(bool loaded);
-	void on_filter_textChanged(const QString& filterText);
+    void setImage(QSharedPointer<DkImageContainerT> imgC);
+    void thumbLoaded(bool loaded);
+    void on_filter_textChanged(const QString &filterText);
 
 protected:
-	void createLayout();
-	void updateEntries();
-	void writeSettings();
-	void readSettings();
-
-	void getExpandedItemNames(const QModelIndex& index, QStringList& expandedNames);
-	void expandRows(const QModelIndex& index, const QStringList& expandedNames);
-
-	QSharedPointer<DkImageContainerT> mImgC;
-	QTreeView* mTreeView = 0;
-	DkMetaDataProxyModel* mProxyModel = 0;
-	QLineEdit* mFilterEdit = 0;
-	DkMetaDataModel* mModel = 0;
-	QLabel* mThumbNailLabel = 0;
-	QSharedPointer<DkThumbNailT> mThumb;
-	QStringList mExpandedNames;
+    void createLayout();
+    void updateEntries();
+    void writeSettings();
+    void readSettings();
+
+    void getExpandedItemNames(const QModelIndex &index, QStringList &expandedNames);
+    void expandRows(const QModelIndex &index, const QStringList &expandedNames);
+
+    QSharedPointer<DkImageContainerT> mImgC;
+    QTreeView *mTreeView = 0;
+    DkMetaDataProxyModel *mProxyModel = 0;
+    QLineEdit *mFilterEdit = 0;
+    DkMetaDataModel *mModel = 0;
+    QLabel *mThumbNailLabel = 0;
+    QSharedPointer<DkThumbNailT> mThumb;
+    QStringList mExpandedNames;
 };
 
-class DkMetaDataSelection : public DkWidget {
-	Q_OBJECT
+class DkMetaDataSelection : public DkWidget
+{
+    Q_OBJECT
 
 public:
-	DkMetaDataSelection(const QSharedPointer<DkMetaDataT> metaData, QWidget* parent = 0);
+    DkMetaDataSelection(const QSharedPointer<DkMetaDataT> metaData, QWidget *parent = 0);
 
-	void setSelectedKeys(const QStringList& selKeys);
-	QStringList getSelectedKeys() const;
+    void setSelectedKeys(const QStringList &selKeys);
+    QStringList getSelectedKeys() const;
 
 public slots:
-	void checkAll(bool checked);
-	void selectionChanged();
+    void checkAll(bool checked);
+    void selectionChanged();
 
 protected:
-	void createLayout();
-	void createEntries(QSharedPointer<DkMetaDataT> metaData, QStringList& outKeys, QStringList& outValues) const;
-	void appendGUIEntry(const QString& key, const QString& value, int idx = -1);
+    void createLayout();
+    void createEntries(QSharedPointer<DkMetaDataT> metaData, QStringList &outKeys, QStringList &outValues) const;
+    void appendGUIEntry(const QString &key, const QString &value, int idx = -1);
 
-	QSharedPointer<DkMetaDataT> mMetaData;
+    QSharedPointer<DkMetaDataT> mMetaData;
 
-	QStringList mSelectedKeys;
-	QStringList mKeys;
-	QStringList mValues;
+    QStringList mSelectedKeys;
+    QStringList mKeys;
+    QStringList mValues;
 
-	QVector<QCheckBox*> mSelection;
-	QCheckBox* mCbCheckAll;
-	QGridLayout* mLayout;
+    QVector<QCheckBox *> mSelection;
+    QCheckBox *mCbCheckAll;
+    QGridLayout *mLayout;
 };
 
-class DkMetaDataHUD : public DkFadeWidget {
-	Q_OBJECT
+class DkMetaDataHUD : public DkFadeWidget
+{
+    Q_OBJECT
 
 public:
-	DkMetaDataHUD(QWidget* parent = 0);
-	~DkMetaDataHUD();
+    DkMetaDataHUD(QWidget *parent = 0);
+    ~DkMetaDataHUD();
 
-	void updateLabels(int numColumns = -1);
+    void updateLabels(int numColumns = -1);
 
-	int getWindowPosition() const;
+    int getWindowPosition() const;
 
-	enum {
-		action_change_keys,
-		action_num_columns,
-		action_set_to_default,
+    enum {
+        action_change_keys,
+        action_num_columns,
+        action_set_to_default,
 
-		action_pos_west,
-		action_pos_north,
-		action_pos_east,
-		action_pos_south,
+        action_pos_west,
+        action_pos_north,
+        action_pos_east,
+        action_pos_south,
 
-		action_end,
-	};
+        action_end,
+    };
 
 public slots:
-	void updateMetaData(const QSharedPointer<DkImageContainerT> cImg = QSharedPointer<DkImageContainerT>());
-	void updateMetaData(const QSharedPointer<DkMetaDataT> cImg);
-	void changeKeys();
-	void changeNumColumns();
-	void setToDefault();
-	void newPosition();
-	virtual void setVisible(bool visible, bool saveSetting = true) override;
+    void updateMetaData(const QSharedPointer<DkImageContainerT> cImg = QSharedPointer<DkImageContainerT>());
+    void updateMetaData(const QSharedPointer<DkMetaDataT> cImg);
+    void changeKeys();
+    void changeNumColumns();
+    void setToDefault();
+    void newPosition();
+    virtual void setVisible(bool visible, bool saveSetting = true) override;
 
 signals:
-	void positionChangeSignal(int newPos) const;
+    void positionChangeSignal(int newPos) const;
 
 protected:
-	void createLayout();
-	void createActions();
-	void loadSettings();
-	void saveSettings() const;
-	QStringList getDefaultKeys() const;
-	QLabel* createKeyLabel(const QString& key);
-	QLabel* createValueLabel(const QString& val);
-
-	void contextMenuEvent(QContextMenuEvent *event) override;
-
-	// current metadata
-	QSharedPointer<DkMetaDataT> mMetaData;
-	QStringList mKeyValues;
-
-	// gui elements
-	QVector<QLabel*> mEntryKeyLabels;
-	QVector<QLabel*> mEntryValueLabels;
-	QGridLayout* mContentLayout = 0;
-	QWidget* mContentWidget = 0;
-	DkResizableScrollArea* mScrollArea = 0;
-	QWidget* mTitleWidget = 0;
-
-	QMenu* mContextMenu = 0;
-	QVector<QAction*> mActions;
-
-	int mNumColumns = -1;
-	int mWindowPosition = pos_south;
-	Qt::Orientation mOrientation = Qt::Horizontal;
+    void createLayout();
+    void createActions();
+    void loadSettings();
+    void saveSettings() const;
+    QStringList getDefaultKeys() const;
+    QLabel *createKeyLabel(const QString &key);
+    QLabel *createValueLabel(const QString &val);
+
+    void contextMenuEvent(QContextMenuEvent *event) override;
+
+    // current metadata
+    QSharedPointer<DkMetaDataT> mMetaData;
+    QStringList mKeyValues;
+
+    // gui elements
+    QVector<QLabel *> mEntryKeyLabels;
+    QVector<QLabel *> mEntryValueLabels;
+    QGridLayout *mContentLayout = 0;
+    QWidget *mContentWidget = 0;
+    DkResizableScrollArea *mScrollArea = 0;
+    QWidget *mTitleWidget = 0;
+
+    QMenu *mContextMenu = 0;
+    QVector<QAction *> mActions;
+
+    int mNumColumns = -1;
+    int mWindowPosition = pos_south;
+    Qt::Orientation mOrientation = Qt::Horizontal;
 };
 
-class DkCommentTextEdit : public QTextEdit {
-	Q_OBJECT
+class DkCommentTextEdit : public QTextEdit
+{
+    Q_OBJECT
 
 public:
-	DkCommentTextEdit(QWidget* parent = 0);
+    DkCommentTextEdit(QWidget *parent = 0);
 
 signals:
-	void focusLost() const;
+    void focusLost() const;
 
 protected:
-	void focusOutEvent(QFocusEvent* focusEvent) override;
-	void paintEvent(QPaintEvent* e) override;
+    void focusOutEvent(QFocusEvent *focusEvent) override;
+    void paintEvent(QPaintEvent *e) override;
 };
 
-class DkCommentWidget : public DkFadeLabel {
-	Q_OBJECT
+class DkCommentWidget : public DkFadeLabel
+{
+    Q_OBJECT
 
 public:
-	DkCommentWidget(QWidget* parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
-	~DkCommentWidget() {};
-	
-	void setMetaData(QSharedPointer<DkMetaDataT> metaData);
+    DkCommentWidget(QWidget *parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
+    ~DkCommentWidget(){};
+
+    void setMetaData(QSharedPointer<DkMetaDataT> metaData);
+    QString text() const;
 
 public slots:
-	void on_CommentLabel_textChanged();
-	void on_CommentLabel_focusLost();
-	void on_saveButton_clicked();
-	void on_cancelButton_clicked();
+    void on_CommentLabel_textChanged();
+    void on_CommentLabel_focusLost();
+    void on_saveButton_clicked();
+    void on_cancelButton_clicked();
+
+    void initComment(const QString &description);
+    void resetComment();
+    void saveComment();
 
 signals:
-	void showInfoSignal(const QString& msg) const;
+    void showInfoSignal(const QString &msg) const;
+    void commentEditedSignal() const;
+    void commentSavedSignal() const;
+    void commentSavedSignal(const QString &) const;
 
 protected:
-	void setComment(const QString& description);
-	void saveComment();
-	void createLayout();
-
-	DkCommentTextEdit* mCommentLabel;
-	QSharedPointer<DkMetaDataT> mMetaData;
-	bool mTextChanged = false;
-	bool mDirty = false;
-	QString mOldText;
+    void createLayout();
+
+    DkCommentTextEdit *mCommentLabel;
+    QSharedPointer<DkMetaDataT> mMetaData;
+    bool mTextEdited = false;
+    QString mOldText;
 };
 
 }
diff --git a/ImageLounge/src/DkGui/DkNetwork.cpp b/ImageLounge/src/DkGui/DkNetwork.cpp
index a90e496..e9d709a 100644
--- a/ImageLounge/src/DkGui/DkNetwork.cpp
+++ b/ImageLounge/src/DkGui/DkNetwork.cpp
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkNetwork.cpp
  Created on:	20.07.2011
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -26,710 +26,756 @@
  *******************************************************************************************************/
 
 #include "DkNetwork.h"
+#include "DkActionManager.h"
+#include "DkControlWidget.h" // needed for a connection
 #include "DkSettings.h"
 #include "DkTimer.h"
-#include "DkControlWidget.h"	// needed for a connection
 #include "DkUtils.h"
-#include "DkActionManager.h"
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QTcpSocket>
-#include <QStringBuilder>
+#pragma warning(push, 0) // no warnings from includes - begin
+#include <QAbstractButton>
+#include <QApplication>
+#include <QDebug>
+#include <QDesktopServices>
 #include <QDir>
-#include <QNetworkInterface>
-#include <QList>
-#include <QThread>
-#include <QTimer>
 #include <QHostInfo>
-#include <QUrl>
-#include <QNetworkAccessManager>
-#include <QApplication>
-#include <QDesktopWidget>
+#include <QList>
+#include <QMessageBox>
+#include <QMimeData>
 #include <QMutex>
 #include <QMutexLocker>
+#include <QNetworkAccessManager>
 #include <QNetworkCookieJar>
-#include <QDesktopServices>
-#include <QDebug>
+#include <QNetworkInterface>
 #include <QNetworkProxyFactory>
-#include <QXmlStreamReader>
-#include <QMessageBox>
-#include <QAbstractButton>
 #include <QProcess>
-#include <QMimeData>
+#include <QScreen>
+#include <QStringBuilder>
+#include <QTcpSocket>
+#include <QThread>
+#include <QTimer>
+#include <QUrl>
+#include <QXmlStreamReader>
 #include <qmath.h>
 
 #ifdef QT_NO_DEBUG_OUTPUT
-#pragma warning(disable: 4127)		// no 'conditional expression is constant' if qDebug() messages are removed
+#pragma warning(disable : 4127) // no 'conditional expression is constant' if qDebug() messages are removed
 #endif
 
-#pragma warning(pop)		// no warnings from includes - end
+#pragma warning(pop) // no warnings from includes - end
 
 #include <assert.h>
 
-namespace nmc {
+namespace nmc
+{
 
 // DkClientManager --------------------------------------------------------------------
-DkClientManager::DkClientManager(const QString& title, QObject* parent) : QObject(parent) {
-	mNewPeerId = 0;
-	this->mCurrentTitle = title;
-	qRegisterMetaType<QList<quint16> >("QList<quint16>");
-	qRegisterMetaType<QList<DkPeer*> >("QList<DkPeer*>");
+DkClientManager::DkClientManager(const QString &title, QObject *parent)
+    : QObject(parent)
+{
+    mNewPeerId = 0;
+    this->mCurrentTitle = title;
+    qRegisterMetaType<QList<quint16>>("QList<quint16>");
+    qRegisterMetaType<QList<DkPeer *>>("QList<DkPeer*>");
 }
 
-DkClientManager::~DkClientManager() {
-	
-	// save settings
-	sendGoodByeToAll();	// does nothing...
+DkClientManager::~DkClientManager()
+{
+    // save settings
+    sendGoodByeToAll(); // does nothing...
 }
 
+void DkClientManager::connectionReadyForUse(quint16 peerServerPort, const QString &title, DkConnection *connection)
+{
+    // qDebug() << "connection ready for use" << connection->peerPort() << " with title:" << title << " peerServerPort:" << peerServerPort;
 
-void DkClientManager::connectionReadyForUse(quint16 peerServerPort, const QString& title, DkConnection* connection) {
-	//qDebug() << "connection ready for use" << connection->peerPort() << " with title:" << title << " peerServerPort:" << peerServerPort;
-
-	mNewPeerId++;
-	DkPeer* peer = new DkPeer(connection->peerPort(), mNewPeerId, connection->peerAddress(), peerServerPort, title, connection, false, "", false, this);
-	connection->setPeerId(mNewPeerId);
-	mPeerList.addPeer(peer); 
-
-	sendTitle(mCurrentTitle);
+    mNewPeerId++;
+    DkPeer *peer = new DkPeer(connection->peerPort(), mNewPeerId, connection->peerAddress(), peerServerPort, title, connection, false, "", false, this);
+    connection->setPeerId(mNewPeerId);
+    mPeerList.addPeer(peer);
 
+    sendTitle(mCurrentTitle);
 }
 
-void DkClientManager::disconnected() {
-
-	if (DkConnection *connection = qobject_cast<DkConnection *>(sender())) {		
-		removeConnection(connection);
-	}
+void DkClientManager::disconnected()
+{
+    if (DkConnection *connection = qobject_cast<DkConnection *>(sender())) {
+        removeConnection(connection);
+    }
 }
 
-void DkClientManager::removeConnection(DkConnection* connection) {
-	mPeerList.setSynchronized(connection->getPeerId(), false);
-	emit synchronizedPeersListChanged(mPeerList.getSynchronizedPeerServerPorts());
-	
-	auto aps = mPeerList.getActivePeers();
-	emit clientConnectedSignal(!aps.isEmpty());
+void DkClientManager::removeConnection(DkConnection *connection)
+{
+    mPeerList.setSynchronized(connection->getPeerId(), false);
+    emit synchronizedPeersListChanged(mPeerList.getSynchronizedPeerServerPorts());
 
-	qDebug() << "connection Disconnected:" << connection->getPeerPort();
-	mPeerList.removePeer(connection->getPeerId());
-	
-	auto p = mPeerList.getPeerById(connection->getPeerId());
-	if (p && p->isSynchronized()) {
-		QString msg = listConnections(aps, false);
-		emit updateConnectionSignal(msg);
-	}
-}
+    auto aps = mPeerList.getActivePeers();
+    emit clientConnectedSignal(!aps.isEmpty());
 
-void DkClientManager::connectionSentNewTitle(DkConnection* connection, const QString& newTitle) {
-	mPeerList.setTitle(connection->getPeerId(), newTitle);
-}
+    qDebug() << "connection Disconnected:" << connection->getPeerPort();
+    mPeerList.removePeer(connection->getPeerId());
 
-void DkClientManager::connectionReceivedTransformation(DkConnection*, const QTransform& transform, const QTransform& imgTransform, const QPointF& canvasSize) {
-	emit receivedTransformation(transform, imgTransform, canvasSize);
+    auto p = mPeerList.getPeerById(connection->getPeerId());
+    if (p && p->isSynchronized()) {
+        QString msg = listConnections(aps, false);
+        emit updateConnectionSignal(msg);
+    }
 }
 
-void DkClientManager::connectionReceivedPosition(DkConnection*, const QRect& rect, bool opacity, bool overlaid) {
-	emit receivedPosition(rect, opacity, overlaid);
+void DkClientManager::connectionSentNewTitle(DkConnection *connection, const QString &newTitle)
+{
+    mPeerList.setTitle(connection->getPeerId(), newTitle);
 }
 
-void DkClientManager::connectionReceivedNewFile(DkConnection*, qint16 op, const QString& filename) {
-	emit receivedNewFile(op, filename);
+void DkClientManager::connectionReceivedTransformation(DkConnection *, const QTransform &transform, const QTransform &imgTransform, const QPointF &canvasSize)
+{
+    emit receivedTransformation(transform, imgTransform, canvasSize);
 }
 
-void DkClientManager::connectionReceivedGoodBye(DkConnection* connection) {
-	mPeerList.removePeer(connection->getPeerId());
-	qDebug() << "goodbye received from " << connection->getPeerId();
-
-	emit synchronizedPeersListChanged(mPeerList.getSynchronizedPeerServerPorts());
-
-	auto aps = mPeerList.getActivePeers();
-	QString msg = listConnections(aps, false);
-	emit updateConnectionSignal(msg);
-	emit clientConnectedSignal(!aps.isEmpty());
+void DkClientManager::connectionReceivedPosition(DkConnection *, const QRect &rect, bool opacity, bool overlaid)
+{
+    emit receivedPosition(rect, opacity, overlaid);
 }
 
-void DkClientManager::connectionShowStatusMessage(DkConnection*, const QString& msg) {
-	emit sendInfoSignal(msg, 2000);
+void DkClientManager::connectionReceivedNewFile(DkConnection *, qint16 op, const QString &filename)
+{
+    emit receivedNewFile(op, filename);
 }
 
-void DkClientManager::sendTitle(const QString& newTitle) {
-	this->mCurrentTitle = newTitle;
-
-	QList<DkPeer*> peers = mPeerList.getPeerList();
-	foreach (DkPeer* peer , peers) {
-		
-		if (!peer)
-			continue;
+void DkClientManager::connectionReceivedGoodBye(DkConnection *connection)
+{
+    mPeerList.removePeer(connection->getPeerId());
+    qDebug() << "goodbye received from " << connection->getPeerId();
 
-		connect(this,SIGNAL(sendNewTitleMessage(const QString&)), peer->connection, SLOT(sendNewTitleMessage(const QString&)));
-		emit sendNewTitleMessage(newTitle);
-		disconnect(this,SIGNAL(sendNewTitleMessage(const QString&)), peer->connection, SLOT(sendNewTitleMessage(const QString&)));
-	}
-
-}
+    emit synchronizedPeersListChanged(mPeerList.getSynchronizedPeerServerPorts());
 
-void DkClientManager::sendTransform(QTransform transform, QTransform imgTransform, QPointF canvasSize) {
-	QList<DkPeer*> synchronizedPeers = mPeerList.getSynchronizedPeers();
-	foreach (DkPeer* peer , synchronizedPeers) {
-		
-		if (!peer)
-			continue;
-		
-		connect(this,SIGNAL(sendNewTransformMessage(QTransform, QTransform, QPointF)), peer->connection, SLOT(sendNewTransformMessage(QTransform, QTransform, QPointF)));
-		emit sendNewTransformMessage(transform, imgTransform, canvasSize);
-		disconnect(this,SIGNAL(sendNewTransformMessage(QTransform, QTransform, QPointF)), peer->connection, SLOT(sendNewTransformMessage(QTransform, QTransform, QPointF)));
-	}
+    auto aps = mPeerList.getActivePeers();
+    QString msg = listConnections(aps, false);
+    emit updateConnectionSignal(msg);
+    emit clientConnectedSignal(!aps.isEmpty());
+}
+
+void DkClientManager::connectionShowStatusMessage(DkConnection *, const QString &msg)
+{
+    emit sendInfoSignal(msg, 2000);
+}
+
+void DkClientManager::sendTitle(const QString &newTitle)
+{
+    this->mCurrentTitle = newTitle;
+
+    QList<DkPeer *> peers = mPeerList.getPeerList();
+    foreach (DkPeer *peer, peers) {
+        if (!peer)
+            continue;
+
+        connect(this, SIGNAL(sendNewTitleMessage(const QString &)), peer->connection, SLOT(sendNewTitleMessage(const QString &)));
+        emit sendNewTitleMessage(newTitle);
+        disconnect(this, SIGNAL(sendNewTitleMessage(const QString &)), peer->connection, SLOT(sendNewTitleMessage(const QString &)));
+    }
+}
+
+void DkClientManager::sendTransform(QTransform transform, QTransform imgTransform, QPointF canvasSize)
+{
+    QList<DkPeer *> synchronizedPeers = mPeerList.getSynchronizedPeers();
+    foreach (DkPeer *peer, synchronizedPeers) {
+        if (!peer)
+            continue;
+
+        connect(this,
+                SIGNAL(sendNewTransformMessage(QTransform, QTransform, QPointF)),
+                peer->connection,
+                SLOT(sendNewTransformMessage(QTransform, QTransform, QPointF)));
+        emit sendNewTransformMessage(transform, imgTransform, canvasSize);
+        disconnect(this,
+                   SIGNAL(sendNewTransformMessage(QTransform, QTransform, QPointF)),
+                   peer->connection,
+                   SLOT(sendNewTransformMessage(QTransform, QTransform, QPointF)));
+    }
+}
+
+void DkClientManager::sendPosition(QRect newRect, bool overlaid)
+{
+    QList<DkPeer *> synchronizedPeers = mPeerList.getSynchronizedPeers();
+    foreach (DkPeer *peer, synchronizedPeers) {
+        if (!peer)
+            continue;
+
+        connect(this, SIGNAL(sendNewPositionMessage(QRect, bool, bool)), peer->connection, SLOT(sendNewPositionMessage(QRect, bool, bool)));
+        emit sendNewPositionMessage(newRect, true, overlaid);
+        disconnect(this, SIGNAL(sendNewPositionMessage(QRect, bool, bool)), peer->connection, SLOT(sendNewPositionMessage(QRect, bool, bool)));
+    }
+}
+
+void DkClientManager::sendNewFile(qint16 op, const QString &filename)
+{
+    QList<DkPeer *> synchronizedPeers = mPeerList.getSynchronizedPeers();
+    foreach (DkPeer *peer, synchronizedPeers) {
+        if (!peer)
+            continue;
+
+        connect(this, SIGNAL(sendNewFileMessage(qint16, const QString &)), peer->connection, SLOT(sendNewFileMessage(qint16, const QString &)));
+        emit sendNewFileMessage(op, filename);
+        disconnect(this, SIGNAL(sendNewFileMessage(qint16, const QString &)), peer->connection, SLOT(sendNewFileMessage(qint16, const QString &)));
+    }
+}
+
+void DkClientManager::newConnection(int socketDescriptor)
+{
+    DkConnection *connection = createConnection();
+    connection->setSocketDescriptor(socketDescriptor);
+    connection->setTitle(mCurrentTitle);
+    mStartUpConnections.append(connection);
+    // qDebug() << "new Connection " << connection->peerPort();
+}
+
+void DkClientManager::connectConnection(DkConnection *connection)
+{
+    qRegisterMetaType<QList<quint16>>("QList<quint16>");
+    connect(connection,
+            SIGNAL(connectionReadyForUse(quint16, const QString &, DkConnection *)),
+            this,
+            SLOT(connectionReadyForUse(quint16, const QString &, DkConnection *)));
+    connect(connection, SIGNAL(connectionStopSynchronize(DkConnection *)), this, SLOT(connectionStopSynchronized(DkConnection *)));
+    connect(connection, SIGNAL(connectionStartSynchronize(QList<quint16>, DkConnection *)), this, SLOT(connectionSynchronized(QList<quint16>, DkConnection *)));
+    connect(connection, SIGNAL(disconnected()), this, SLOT(disconnected()));
+    connect(connection,
+            SIGNAL(connectionTitleHasChanged(DkConnection *, const QString &)),
+            this,
+            SLOT(connectionSentNewTitle(DkConnection *, const QString &)));
+    connect(connection,
+            SIGNAL(connectionNewPosition(DkConnection *, QRect, bool, bool)),
+            this,
+            SLOT(connectionReceivedPosition(DkConnection *, QRect, bool, bool)));
+    connect(connection,
+            SIGNAL(connectionNewTransform(DkConnection *, QTransform, QTransform, QPointF)),
+            this,
+            SLOT(connectionReceivedTransformation(DkConnection *, QTransform, QTransform, QPointF)));
+    connect(connection,
+            SIGNAL(connectionNewFile(DkConnection *, qint16, const QString &)),
+            this,
+            SLOT(connectionReceivedNewFile(DkConnection *, qint16, const QString &)));
+    connect(connection, SIGNAL(connectionGoodBye(DkConnection *)), this, SLOT(connectionReceivedGoodBye(DkConnection *)));
+    connect(connection,
+            SIGNAL(connectionShowStatusMessage(DkConnection *, const QString &)),
+            this,
+            SLOT(connectionShowStatusMessage(DkConnection *, const QString &)));
+
+    connection->synchronizedPeersListChanged(mPeerList.getSynchronizedPeerServerPorts());
+}
+
+QString DkClientManager::listConnections(QList<DkPeer *> peers, bool connected)
+{
+    QString newPeers;
+
+    if (!peers.empty()) {
+        if (connected) {
+            newPeers = tr("connected with: ");
+        } else {
+            newPeers = tr("disconnected with: ");
+        }
+
+        newPeers.append("\n\t");
+    }
+
+    for (const DkPeer *cp : peers) {
+        if (!cp->clientName.isEmpty())
+            newPeers.append(cp->clientName);
+        if (!cp->clientName.isEmpty() && !cp->title.isEmpty())
+            newPeers.append(": ");
+        if (!cp->title.isEmpty())
+            newPeers.append(cp->title);
+    }
+
+    return newPeers;
+}
+
+void DkClientManager::sendGoodByeToAll()
+{
+    foreach (DkPeer *peer, mPeerList.getPeerList()) {
+        if (!peer)
+            continue;
+
+        connect(this, SIGNAL(sendGoodByeMessage()), peer->connection, SLOT(sendNewGoodbyeMessage()));
+        emit sendGoodByeMessage();
+        disconnect(this, SIGNAL(sendGoodByeMessage()), peer->connection, SLOT(sendNewGoodbyeMessage()));
+    }
 }
 
-void DkClientManager::sendPosition(QRect newRect, bool overlaid) {
-	QList<DkPeer*> synchronizedPeers = mPeerList.getSynchronizedPeers();
-	foreach (DkPeer* peer , synchronizedPeers) {
-		
-		if (!peer)
-			continue;
-		
-		connect(this,SIGNAL(sendNewPositionMessage(QRect, bool, bool)), peer->connection, SLOT(sendNewPositionMessage(QRect, bool, bool)));
-		emit sendNewPositionMessage(newRect, true, overlaid);
-		disconnect(this,SIGNAL(sendNewPositionMessage(QRect, bool, bool)), peer->connection, SLOT(sendNewPositionMessage(QRect, bool, bool)));
-	}
-}
+// DkLocalClientManager --------------------------------------------------------------------
 
-void DkClientManager::sendNewFile(qint16 op, const QString& filename) {
-	QList<DkPeer*> synchronizedPeers = mPeerList.getSynchronizedPeers();
-	foreach (DkPeer* peer , synchronizedPeers) {
-		
-		if (!peer)
-			continue;
-		
-		connect(this,SIGNAL(sendNewFileMessage(qint16, const QString&)), peer->connection, SLOT(sendNewFileMessage(qint16, const QString&)));
-		emit sendNewFileMessage(op, filename);
-		disconnect(this,SIGNAL(sendNewFileMessage(qint16, const QString&)), peer->connection, SLOT(sendNewFileMessage(qint16, const QString&)));
-	}
+DkLocalClientManager::DkLocalClientManager(const QString &title, QObject *parent)
+    : DkClientManager(title, parent)
+{
+    startServer();
 }
 
-void DkClientManager::newConnection( int socketDescriptor ) {
-	DkConnection* connection = createConnection();
-	connection->setSocketDescriptor(socketDescriptor);
-	connection->setTitle(mCurrentTitle);
-	mStartUpConnections.append(connection);
-	//qDebug() << "new Connection " << connection->peerPort();
+QList<DkPeer *> DkLocalClientManager::getPeerList()
+{
+    return mPeerList.getPeerList();
 }
 
-void DkClientManager::connectConnection(DkConnection* connection) {
-	qRegisterMetaType<QList<quint16> >("QList<quint16>");
-	connect(connection, SIGNAL(connectionReadyForUse(quint16, const QString&, DkConnection*)), this, SLOT(connectionReadyForUse(quint16, const QString& , DkConnection*)));
-	connect(connection, SIGNAL(connectionStopSynchronize(DkConnection*)), this, SLOT(connectionStopSynchronized(DkConnection*)));
-	connect(connection, SIGNAL(connectionStartSynchronize(QList<quint16>,DkConnection*)), this, SLOT(connectionSynchronized(QList<quint16>,DkConnection*)));
-	connect(connection, SIGNAL(disconnected()), this, SLOT(disconnected()));
-	connect(connection, SIGNAL(connectionTitleHasChanged(DkConnection*, const QString&)), this, SLOT(connectionSentNewTitle(DkConnection*, const QString&)));
-	connect(connection, SIGNAL(connectionNewPosition(DkConnection*, QRect, bool, bool)), this, SLOT(connectionReceivedPosition(DkConnection*, QRect, bool, bool)));
-	connect(connection, SIGNAL(connectionNewTransform(DkConnection*, QTransform, QTransform, QPointF)), this, SLOT(connectionReceivedTransformation(DkConnection*, QTransform, QTransform, QPointF)));
-	connect(connection, SIGNAL(connectionNewFile(DkConnection*, qint16, const QString&)), this, SLOT(connectionReceivedNewFile(DkConnection*, qint16, const QString&)));
-	connect(connection, SIGNAL(connectionGoodBye(DkConnection*)), this, SLOT(connectionReceivedGoodBye(DkConnection*)));
-	connect(connection, SIGNAL(connectionShowStatusMessage(DkConnection*, const QString&)), this, SLOT(connectionShowStatusMessage(DkConnection*, const QString&)));
+quint16 DkLocalClientManager::getServerPort() const
+{
+    if (!mServer)
+        return 0;
 
-	connection->synchronizedPeersListChanged(mPeerList.getSynchronizedPeerServerPorts());
+    return mServer->serverPort();
 }
 
-QString DkClientManager::listConnections(QList<DkPeer*> peers, bool connected) {
-	
-	QString newPeers;
+QMimeData *DkLocalClientManager::mimeData() const
+{
+    QByteArray connectionData;
+    QDataStream dataStream(&connectionData, QIODevice::WriteOnly);
+    dataStream << getServerPort();
 
-	if (!peers.empty()) {
-		if (connected) {
-			newPeers = tr("connected with: ");
-		}
-		else {
-			newPeers = tr("disconnected with: ");
-		}
-
-		newPeers.append("\n\t");
-	}
-
-	for (const DkPeer* cp : peers) {
-
-		if (!cp->clientName.isEmpty())
-			newPeers.append(cp->clientName);
-		if (!cp->clientName.isEmpty() && !cp->title.isEmpty())
-			newPeers.append(": ");
-		if (!cp->title.isEmpty())
-			newPeers.append(cp->title);
-	}
-
-	return newPeers;
-}
-
-void DkClientManager::sendGoodByeToAll() {
-	
-	foreach (DkPeer* peer, mPeerList.getPeerList()) {
-		
-		if (!peer)
-			continue;
-
-		connect(this,SIGNAL(sendGoodByeMessage()), peer->connection, SLOT(sendNewGoodbyeMessage()));
-		emit sendGoodByeMessage();
-		disconnect(this,SIGNAL(sendGoodByeMessage()), peer->connection, SLOT(sendNewGoodbyeMessage()));
-	}
-}
-
-// DkLocalClientManager --------------------------------------------------------------------
+    QMimeData *mimeData = new QMimeData;
+    mimeData->setData("network/sync-dir", connectionData);
 
-DkLocalClientManager::DkLocalClientManager(const QString& title, QObject* parent ) : DkClientManager(title, parent) {
-	startServer();
+    return mimeData;
 }
 
-QList<DkPeer*> DkLocalClientManager::getPeerList() {
-	return mPeerList.getPeerList();
-}
+void DkLocalClientManager::startServer()
+{
+    mServer = new DkLocalTcpServer(this);
+    connect(mServer, SIGNAL(serverReiceivedNewConnection(int)), this, SLOT(newConnection(int)));
 
-quint16 DkLocalClientManager::getServerPort() const {
-	
-	if (!mServer)
-		return 0;
+    // TODO: hook on thread
+    searchForOtherClients();
 
-	return mServer->serverPort();
+    DkActionManager &am = DkActionManager::instance();
+    connect(am.action(DkActionManager::menu_sync_connect_all), SIGNAL(triggered()), this, SLOT(connectAll()));
 }
 
-QMimeData* DkLocalClientManager::mimeData() const {
-	
-	QByteArray connectionData;
-	QDataStream dataStream(&connectionData, QIODevice::WriteOnly);
-	dataStream << getServerPort();
-	
-	QMimeData* mimeData = new QMimeData;
-	mimeData->setData("network/sync-dir", connectionData);
+// slots
+void DkLocalClientManager::connectAll()
+{
+    QList<DkPeer *> peers = getPeerList();
 
-	return mimeData;
+    for (auto p : peers)
+        synchronizeWithServerPort(p->peerServerPort);
 }
 
-void DkLocalClientManager::startServer() {
-
-	mServer = new DkLocalTcpServer(this);
-	connect(mServer, SIGNAL(serverReiceivedNewConnection(int)), this, SLOT(newConnection(int)));
-	
-	// TODO: hook on thread
-	searchForOtherClients();
-
-	DkActionManager & am = DkActionManager::instance();
-	connect(am.action(DkActionManager::menu_sync_connect_all), SIGNAL(triggered()), this, SLOT(connectAll()));
+void DkLocalClientManager::synchronizeWithServerPort(quint16 port)
+{
+    // qDebug() << "DkClientManager::synchronizeWithServerPort port:" << port;
+    DkPeer *peer = mPeerList.getPeerByServerport(port);
+    if (!peer)
+        return;
+    synchronizeWith(peer->peerId);
 }
 
-// slots
-void DkLocalClientManager::connectAll() {
+void DkLocalClientManager::searchForOtherClients()
+{
+    assert(mServer);
 
-	QList<DkPeer*> peers = getPeerList();
+    for (int i = local_tcp_port_start; i <= local_tcp_port_end; i++) {
+        if (i == mServer->serverPort())
+            continue;
 
-	for (auto p : peers)
-		synchronizeWithServerPort(p->peerServerPort);
+        DkConnection *connection = createConnection();
+        connection->connectToHost(QHostAddress::LocalHost, (qint16)i);
+    }
 }
 
-void DkLocalClientManager::synchronizeWithServerPort(quint16 port) {
-	//qDebug() << "DkClientManager::synchronizeWithServerPort port:" << port;
-	DkPeer* peer = mPeerList.getPeerByServerport(port);
-	if (!peer)
-		return;
-	synchronizeWith(peer->peerId);
-}
+void DkLocalClientManager::connectionSynchronized(QList<quint16> synchronizedPeersOfOtherClient, DkConnection *connection)
+{
+    qDebug() << "Connection synchronized with:" << connection->getPeerPort();
+    mPeerList.setSynchronized(connection->getPeerId(), true);
+    emit synchronizedPeersListChanged(mPeerList.getSynchronizedPeerServerPorts());
 
-void DkLocalClientManager::searchForOtherClients() {
-		
-	assert(mServer);
+    auto aps = mPeerList.getActivePeers();
 
-	for (int i = local_tcp_port_start; i <= local_tcp_port_end; i++) {
-		
-		if (i == mServer->serverPort())
-			continue;
-		
-		DkConnection* connection = createConnection();
-		connection->connectToHost(QHostAddress::LocalHost, (qint16)i);
-	}
-}
+    QString msg = listConnections(aps, true);
+    emit updateConnectionSignal(msg);
 
-void DkLocalClientManager::connectionSynchronized(QList<quint16> synchronizedPeersOfOtherClient, DkConnection* connection) {
-	
-	qDebug() << "Connection synchronized with:" << connection->getPeerPort();
-	mPeerList.setSynchronized(connection->getPeerId(), true);
-	emit synchronizedPeersListChanged(mPeerList.getSynchronizedPeerServerPorts());
-
-	auto aps = mPeerList.getActivePeers();
-	
-	QString msg = listConnections(aps, true);
-	emit updateConnectionSignal(msg);
-
-	emit clientConnectedSignal(!aps.isEmpty());
-	
-	for (int i = 0; i < synchronizedPeersOfOtherClient.size(); i++) {
-		
-		if (synchronizedPeersOfOtherClient[i] != mServer->serverPort()) {
-			
-			DkPeer* peer = mPeerList.getPeerByServerport(synchronizedPeersOfOtherClient[i]);
-			if (!peer)
-				continue;
-
-			connect(this,SIGNAL(sendSynchronizeMessage()), peer->connection, SLOT(sendStartSynchronizeMessage()));
-			emit sendSynchronizeMessage();
-			disconnect(this,SIGNAL(sendSynchronizeMessage()), peer->connection, SLOT(sendStartSynchronizeMessage()));				
-
-		}
-	}
-	//qDebug() << "--------------------";
-	//qDebug() << "current peer list:";
-	//peerList.print();
-	//qDebug() << "--------------------";
-}
-
-void DkLocalClientManager::connectionStopSynchronized(DkConnection* connection) {
-	qDebug() << "Connection no longer synchronized with: " << connection->getPeerPort();
-	mPeerList.setSynchronized(connection->getPeerId(), false);
-
-	//qDebug() << "--------------------";
-	//qDebug() << "current peer list:";
-	//peerList.print();
-	//qDebug() << "--------------------";
-	emit synchronizedPeersListChanged(mPeerList.getSynchronizedPeerServerPorts());
-	
-	auto aps = mPeerList.getActivePeers();
-	
-	QString msg = listConnections(aps, false);
-	emit updateConnectionSignal(msg);
-	emit clientConnectedSignal(!aps.isEmpty());
-}
-
-
-void DkLocalClientManager::synchronizeWith(quint16 peerId) {
-	qDebug() << "DkLocalClientManager::synchronizeWith  peerId:" << peerId;
-
-	mPeerList.setSynchronized(peerId, true); // will be reset if other client does not response within 1 sec
-	emit synchronizedPeersListChanged(mPeerList.getSynchronizedPeerServerPorts());
+    emit clientConnectedSignal(!aps.isEmpty());
 
-	DkPeer* peer = mPeerList.getPeerById(peerId);
-	if (peer == 0 || peer->connection == 0) {
-		//qDebug() << "TcpClient: synchronizeWith: Peer is null or connection is null";
-		return;
-	}
-
-	//qDebug() << "synchronizing with: " << peerId;
-
-
-	connect(this,SIGNAL(sendSynchronizeMessage()), peer->connection, SLOT(sendStartSynchronizeMessage()));
-	emit sendSynchronizeMessage();
-	disconnect(this,SIGNAL(sendSynchronizeMessage()), peer->connection, SLOT(sendStartSynchronizeMessage()));
+    for (int i = 0; i < synchronizedPeersOfOtherClient.size(); i++) {
+        if (synchronizedPeersOfOtherClient[i] != mServer->serverPort()) {
+            DkPeer *peer = mPeerList.getPeerByServerport(synchronizedPeersOfOtherClient[i]);
+            if (!peer)
+                continue;
 
+            connect(this, SIGNAL(sendSynchronizeMessage()), peer->connection, SLOT(sendStartSynchronizeMessage()));
+            emit sendSynchronizeMessage();
+            disconnect(this, SIGNAL(sendSynchronizeMessage()), peer->connection, SLOT(sendStartSynchronizeMessage()));
+        }
+    }
+    // qDebug() << "--------------------";
+    // qDebug() << "current peer list:";
+    // peerList.print();
+    // qDebug() << "--------------------";
 }
 
-void DkLocalClientManager::stopSynchronizeWith(quint16) {
-	QList<DkPeer*> synchronizedPeers = mPeerList.getSynchronizedPeers();
-	
-	foreach (DkPeer* peer , synchronizedPeers) {
+void DkLocalClientManager::connectionStopSynchronized(DkConnection *connection)
+{
+    qDebug() << "Connection no longer synchronized with: " << connection->getPeerPort();
+    mPeerList.setSynchronized(connection->getPeerId(), false);
 
-		if (!peer)
-			continue;
-
-		connect(this,SIGNAL(sendDisableSynchronizeMessage()), peer->connection, SLOT(sendStopSynchronizeMessage()));
-		emit sendDisableSynchronizeMessage();
-		mPeerList.setSynchronized(peer->peerId, false);
-		disconnect(this,SIGNAL(sendDisableSynchronizeMessage()), peer->connection, SLOT(sendStopSynchronizeMessage()));
-	}
-
-	emit synchronizedPeersListChanged(mPeerList.getSynchronizedPeerServerPorts());
-	
-	auto aps = mPeerList.getActivePeers();
-	
-	QString msg = listConnections(aps, false);
-	emit updateConnectionSignal(msg);
-	emit clientConnectedSignal(!aps.isEmpty());
-}
+    // qDebug() << "--------------------";
+    // qDebug() << "current peer list:";
+    // peerList.print();
+    // qDebug() << "--------------------";
+    emit synchronizedPeersListChanged(mPeerList.getSynchronizedPeerServerPorts());
 
-void DkLocalClientManager::sendArrangeInstances(bool overlaid) {
-	
-	int screen = QApplication::desktop()->screenNumber(DkUtils::getMainWindow());
-	const QRect screenGeometry =  QApplication::desktop()->availableGeometry(screen);
-	int connectedInstances = mPeerList.getSynchronizedPeers().size() + 1 ; // +1 because of this instance itself
-	if (connectedInstances == 1)
-		return;
-	int instancesPerRow = (connectedInstances == 2 || connectedInstances == 4) ? 2 : 3;
+    auto aps = mPeerList.getActivePeers();
 
-	int rows = (int)qCeil((float)connectedInstances / (float)instancesPerRow);
-	int width = screenGeometry.width() / instancesPerRow;
-	int height = screenGeometry.height() / rows;
-
-	int curX = screenGeometry.topLeft().x();
-	int curY = screenGeometry.topLeft().y();
-	emit receivedPosition(QRect(curX, curY, width, height), false, overlaid);
-	curX += width;
-	int count = 1;
-	for (DkPeer* peer : mPeerList.getSynchronizedPeers()) {
+    QString msg = listConnections(aps, false);
+    emit updateConnectionSignal(msg);
+    emit clientConnectedSignal(!aps.isEmpty());
+}
 
-		if (!peer)
-			continue;
+void DkLocalClientManager::synchronizeWith(quint16 peerId)
+{
+    qDebug() << "DkLocalClientManager::synchronizeWith  peerId:" << peerId;
 
-		QRect newPosition = QRect(curX, curY, width, height);
-		connect(this,SIGNAL(sendNewPositionMessage(QRect, bool, bool)), peer->connection, SLOT(sendNewPositionMessage(QRect, bool, bool)));
-		emit sendNewPositionMessage(newPosition, false, overlaid);
-		disconnect(this,SIGNAL(sendNewPositionMessage(QRect, bool, bool)), peer->connection, SLOT(sendNewPositionMessage(QRect, bool, bool)));
-		
-		count++;
-		if (count < instancesPerRow)
-			curX += width;
-		else {
-			curX = screenGeometry.topLeft().x();
-			curY += height;
-			count = 0;
-		}
-	}
-}
+    mPeerList.setSynchronized(peerId, true); // will be reset if other client does not response within 1 sec
+    emit synchronizedPeersListChanged(mPeerList.getSynchronizedPeerServerPorts());
 
-void DkLocalClientManager::sendQuitMessageToPeers() {
-	emit sendQuitMessage();
-}
+    DkPeer *peer = mPeerList.getPeerById(peerId);
+    if (peer == 0 || peer->connection == 0) {
+        // qDebug() << "TcpClient: synchronizeWith: Peer is null or connection is null";
+        return;
+    }
 
-void DkLocalClientManager::connectToNomacs() {
-	
-	DkConnection* c = static_cast<DkConnection*>(QObject::sender());
-	
-	if (c) {
-		c->sendGreetingMessage(mCurrentTitle);
-		mStartUpConnections.append(c);
-	}
+    // qDebug() << "synchronizing with: " << peerId;
 
+    connect(this, SIGNAL(sendSynchronizeMessage()), peer->connection, SLOT(sendStartSynchronizeMessage()));
+    emit sendSynchronizeMessage();
+    disconnect(this, SIGNAL(sendSynchronizeMessage()), peer->connection, SLOT(sendStartSynchronizeMessage()));
 }
 
-void DkLocalClientManager::connectionReceivedQuit() {
-	emit receivedQuit();
-}
+void DkLocalClientManager::stopSynchronizeWith(quint16)
+{
+    QList<DkPeer *> synchronizedPeers = mPeerList.getSynchronizedPeers();
 
-DkLocalConnection* DkLocalClientManager::createConnection() {
+    foreach (DkPeer *peer, synchronizedPeers) {
+        if (!peer)
+            continue;
 
-	// wow - there is no one owning connection (except for QOBJECT)
-	DkLocalConnection* connection = new DkLocalConnection(this);
-	connection->setLocalTcpServerPort(mServer->serverPort());
-	connection->setTitle(mCurrentTitle);
-	connectConnection(connection);
-	connect(this, SIGNAL(synchronizedPeersListChanged(QList<quint16>)), connection, SLOT(synchronizedPeersListChanged(QList<quint16>)));
-	connect(this, SIGNAL(sendQuitMessage()), connection, SLOT(sendQuitMessage()));
-	connect(connection, SIGNAL(connectionQuitReceived()), this, SLOT(connectionReceivedQuit()));
-	connect(connection, SIGNAL(connected()), this, SLOT(connectToNomacs()));
+        connect(this, SIGNAL(sendDisableSynchronizeMessage()), peer->connection, SLOT(sendStopSynchronizeMessage()));
+        emit sendDisableSynchronizeMessage();
+        mPeerList.setSynchronized(peer->peerId, false);
+        disconnect(this, SIGNAL(sendDisableSynchronizeMessage()), peer->connection, SLOT(sendStopSynchronizeMessage()));
+    }
 
-	return connection;
+    emit synchronizedPeersListChanged(mPeerList.getSynchronizedPeerServerPorts());
 
+    auto aps = mPeerList.getActivePeers();
+
+    QString msg = listConnections(aps, false);
+    emit updateConnectionSignal(msg);
+    emit clientConnectedSignal(!aps.isEmpty());
 }
 
-// DkLocalTcpServer --------------------------------------------------------------------
-DkLocalTcpServer::DkLocalTcpServer(QObject* parent) : QTcpServer(parent) {
+void DkLocalClientManager::sendArrangeInstances(bool overlaid)
+{
+    const QRect screenGeometry = QApplication::primaryScreen()->availableGeometry();
+    int connectedInstances = mPeerList.getSynchronizedPeers().size() + 1; // +1 because of this instance itself
+    if (connectedInstances == 1)
+        return;
+    int instancesPerRow = (connectedInstances == 2 || connectedInstances == 4) ? 2 : 3;
 
-	for (int i = local_tcp_port_start; i < local_tcp_port_end; i++) {
-		if (listen(QHostAddress::LocalHost, (quint16)i)) {
-			break;
-		}
-	}
-	//qDebug() << "TCP Listening on port " << this->serverPort();
-}
+    int rows = (int)qCeil((float)connectedInstances / (float)instancesPerRow);
+    int width = screenGeometry.width() / instancesPerRow;
+    int height = screenGeometry.height() / rows;
 
-void DkLocalTcpServer::incomingConnection(qintptr socketDescriptor) {
-	emit serverReiceivedNewConnection((int)socketDescriptor);
-	//qDebug() << "Server: NEW CONNECTION AVAIABLE";
-}
+    int curX = screenGeometry.topLeft().x();
+    int curY = screenGeometry.topLeft().y();
+    emit receivedPosition(QRect(curX, curY, width, height), false, overlaid);
+    curX += width;
+    int count = 1;
+    for (DkPeer *peer : mPeerList.getSynchronizedPeers()) {
+        if (!peer)
+            continue;
 
-DkPeer::DkPeer(
-	quint16 port, 
-	quint16 peerId, 
-	const QHostAddress& hostAddress, 
-	quint16 peerServerPort, 
-	const QString& title, 
-	DkConnection* connection, 
-	bool sychronized, 
-	const QString& clientName, 
-	bool showInMenu, 
-	QObject* parent) : QObject(parent) {
-	
-	this->peerId = peerId;
-	this->localServerPort = port;
-	this->peerServerPort = peerServerPort;
-	this->hostAddress = hostAddress;
-	this->title = title;
-	this->sychronized = sychronized;
-	this->connection = connection;
-	this->timer = new QTimer(this);
-	timer->setSingleShot(true);
-	this->clientName = clientName;
-	this->showInMenu = showInMenu;
-	mHasChangedRecently = false;
-	connect(timer, SIGNAL(timeout()), this, SLOT(timerTimeout()), Qt::UniqueConnection);
-}
+        QRect newPosition = QRect(curX, curY, width, height);
+        connect(this, SIGNAL(sendNewPositionMessage(QRect, bool, bool)), peer->connection, SLOT(sendNewPositionMessage(QRect, bool, bool)));
+        emit sendNewPositionMessage(newPosition, false, overlaid);
+        disconnect(this, SIGNAL(sendNewPositionMessage(QRect, bool, bool)), peer->connection, SLOT(sendNewPositionMessage(QRect, bool, bool)));
 
-DkPeer::~DkPeer() {
+        count++;
+        if (count < instancesPerRow)
+            curX += width;
+        else {
+            curX = screenGeometry.topLeft().x();
+            curY += height;
+            count = 0;
+        }
+    }
 }
 
-void DkPeer::setSynchronized(bool flag) {
-	sychronized = flag;
-	mHasChangedRecently = true;
-	connect(timer, SIGNAL(timeout()), this, SLOT(timerTimeout()), Qt::UniqueConnection);
-	timer->start(1000);
+void DkLocalClientManager::sendQuitMessageToPeers()
+{
+    emit sendQuitMessage();
 }
 
-bool DkPeer::operator==(const DkPeer& peer) const {
+void DkLocalClientManager::connectToNomacs()
+{
+    DkConnection *c = static_cast<DkConnection *>(QObject::sender());
 
-	return localServerPort == peer.localServerPort && sychronized == peer.sychronized && title == peer.title && hostAddress == peer.hostAddress;
+    if (c) {
+        c->sendGreetingMessage(mCurrentTitle);
+        mStartUpConnections.append(c);
+    }
 }
 
-void DkPeer::timerTimeout() {
-	mHasChangedRecently = false;
+void DkLocalClientManager::connectionReceivedQuit()
+{
+    emit receivedQuit();
 }
 
-// DkPeerList --------------------------------------------------------------------
-DkPeerList::DkPeerList() {
-	// do nothing
-}
+DkLocalConnection *DkLocalClientManager::createConnection()
+{
+    // wow - there is no one owning connection (except for QOBJECT)
+    DkLocalConnection *connection = new DkLocalConnection(this);
+    connection->setLocalTcpServerPort(mServer->serverPort());
+    connection->setTitle(mCurrentTitle);
+    connectConnection(connection);
+    connect(this, SIGNAL(synchronizedPeersListChanged(QList<quint16>)), connection, SLOT(synchronizedPeersListChanged(QList<quint16>)));
+    connect(this, SIGNAL(sendQuitMessage()), connection, SLOT(sendQuitMessage()));
+    connect(connection, SIGNAL(connectionQuitReceived()), this, SLOT(connectionReceivedQuit()));
+    connect(connection, SIGNAL(connected()), this, SLOT(connectToNomacs()));
 
-bool DkPeerList::addPeer(DkPeer* peer) {
-	
-	if (!peer) {
-		qDebug() << "[WARNING] you try to append a NULL peer!";
-		return false;
-	}
-
-	if (peerList.contains(peer->peerId))
-		return false;
-	else {
-		peerList.insert(peer->peerId, peer);
-		return true;
-	}
+    return connection;
 }
 
-bool DkPeerList::removePeer(quint16 peerId) {
-	if (!peerList.contains(peerId))
-		return false;
-	else {
-		peerList.remove(peerId);
-		return true;
-	}
+// DkLocalTcpServer --------------------------------------------------------------------
+DkLocalTcpServer::DkLocalTcpServer(QObject *parent)
+    : QTcpServer(parent)
+{
+    for (int i = local_tcp_port_start; i < local_tcp_port_end; i++) {
+        if (listen(QHostAddress::LocalHost, (quint16)i)) {
+            break;
+        }
+    }
+    // qDebug() << "TCP Listening on port " << this->serverPort();
+}
+
+void DkLocalTcpServer::incomingConnection(qintptr socketDescriptor)
+{
+    emit serverReiceivedNewConnection((int)socketDescriptor);
+    // qDebug() << "Server: NEW CONNECTION AVAIABLE";
+}
+
+DkPeer::DkPeer(quint16 port,
+               quint16 peerId,
+               const QHostAddress &hostAddress,
+               quint16 peerServerPort,
+               const QString &title,
+               DkConnection *connection,
+               bool sychronized,
+               const QString &clientName,
+               bool showInMenu,
+               QObject *parent)
+    : QObject(parent)
+{
+    this->peerId = peerId;
+    this->localServerPort = port;
+    this->peerServerPort = peerServerPort;
+    this->hostAddress = hostAddress;
+    this->title = title;
+    this->sychronized = sychronized;
+    this->connection = connection;
+    this->timer = new QTimer(this);
+    timer->setSingleShot(true);
+    this->clientName = clientName;
+    this->showInMenu = showInMenu;
+    mHasChangedRecently = false;
+    connect(timer, SIGNAL(timeout()), this, SLOT(timerTimeout()), Qt::UniqueConnection);
+}
+
+DkPeer::~DkPeer()
+{
+}
+
+void DkPeer::setSynchronized(bool flag)
+{
+    sychronized = flag;
+    mHasChangedRecently = true;
+    connect(timer, SIGNAL(timeout()), this, SLOT(timerTimeout()), Qt::UniqueConnection);
+    timer->start(1000);
+}
+
+bool DkPeer::operator==(const DkPeer &peer) const
+{
+    return localServerPort == peer.localServerPort && sychronized == peer.sychronized && title == peer.title && hostAddress == peer.hostAddress;
+}
+
+void DkPeer::timerTimeout()
+{
+    mHasChangedRecently = false;
 }
 
-bool DkPeerList::setSynchronized(quint16 peerId, bool synchronized) {
-		
-	if (!peerList.contains(peerId))
-		return false;
-	DkPeer* peer = peerList.value(peerId);
-	peer->setSynchronized(synchronized);
-	//peerList.replace(peerId, peer);
-
-	return true;
-}
+// DkPeerList --------------------------------------------------------------------
+DkPeerList::DkPeerList()
+{
+    // do nothing
+}
+
+bool DkPeerList::addPeer(DkPeer *peer)
+{
+    if (!peer) {
+        qDebug() << "[WARNING] you try to append a NULL peer!";
+        return false;
+    }
+
+    if (peerList.contains(peer->peerId))
+        return false;
+    else {
+        peerList.insert(peer->peerId, peer);
+        return true;
+    }
+}
+
+bool DkPeerList::removePeer(quint16 peerId)
+{
+    if (!peerList.contains(peerId))
+        return false;
+    else {
+        peerList.remove(peerId);
+        return true;
+    }
+}
 
-bool DkPeerList::setTitle(quint16 peerId, const QString& title) {
-	if (!peerList.contains(peerId))
-		return false;
-	DkPeer* peer = peerList.value(peerId);
-	peer->title = title;
-	//peerList.replace(peerId, peer);
+bool DkPeerList::setSynchronized(quint16 peerId, bool synchronized)
+{
+    if (!peerList.contains(peerId))
+        return false;
+    DkPeer *peer = peerList.value(peerId);
+    peer->setSynchronized(synchronized);
+    // peerList.replace(peerId, peer);
+
+    return true;
+}
+
+bool DkPeerList::setTitle(quint16 peerId, const QString &title)
+{
+    if (!peerList.contains(peerId))
+        return false;
+    DkPeer *peer = peerList.value(peerId);
+    peer->title = title;
+    // peerList.replace(peerId, peer);
 
-	return true;
+    return true;
 }
 
-bool DkPeerList::setShowInMenu(quint16 peerId, bool showInMenu) {
-	if (!peerList.contains(peerId))
-		return false;
-	DkPeer* peer = peerList.value(peerId);
-	peer->showInMenu = showInMenu;
-	//peerList.replace(peerId, peer);
+bool DkPeerList::setShowInMenu(quint16 peerId, bool showInMenu)
+{
+    if (!peerList.contains(peerId))
+        return false;
+    DkPeer *peer = peerList.value(peerId);
+    peer->showInMenu = showInMenu;
+    // peerList.replace(peerId, peer);
 
-	return true;
+    return true;
 }
 
-QList<DkPeer*> DkPeerList::getSynchronizedPeers() const {
-	QList<DkPeer*> sychronizedPeers;
-	foreach(DkPeer* peer, peerList) {
-		if (peer->isSynchronized())
-			sychronizedPeers.push_back(peer);
-	}
-	return sychronizedPeers;
+QList<DkPeer *> DkPeerList::getSynchronizedPeers() const
+{
+    QList<DkPeer *> sychronizedPeers;
+    foreach (DkPeer *peer, peerList) {
+        if (peer->isSynchronized())
+            sychronizedPeers.push_back(peer);
+    }
+    return sychronizedPeers;
 }
 
-QList<DkPeer*> DkPeerList::getPeerList() {
-	return peerList.values();
+QList<DkPeer *> DkPeerList::getPeerList()
+{
+    return peerList.values();
 }
 
-QList<quint16> DkPeerList::getSynchronizedPeerServerPorts() const {
-	QList<quint16> sychronizedPeerServerPorts;
-	foreach(DkPeer* peer, peerList) {
-		if (peer->isSynchronized())
-			sychronizedPeerServerPorts.push_back(peer->peerServerPort);
-	}
-	return sychronizedPeerServerPorts;
+QList<quint16> DkPeerList::getSynchronizedPeerServerPorts() const
+{
+    QList<quint16> sychronizedPeerServerPorts;
+    foreach (DkPeer *peer, peerList) {
+        if (peer->isSynchronized())
+            sychronizedPeerServerPorts.push_back(peer->peerServerPort);
+    }
+    return sychronizedPeerServerPorts;
 }
 
-QList<DkPeer*> DkPeerList::getActivePeers() const {
-	QList<DkPeer*> activePeers;
-	foreach(DkPeer* peer, peerList) {
-		if (peer->isActive())
-			activePeers.push_back(peer);
-	}
-	return activePeers;
+QList<DkPeer *> DkPeerList::getActivePeers() const
+{
+    QList<DkPeer *> activePeers;
+    foreach (DkPeer *peer, peerList) {
+        if (peer->isActive())
+            activePeers.push_back(peer);
+    }
+    return activePeers;
 }
 
-DkPeer* DkPeerList::getPeerByServerport(quint16 port) const {
-	foreach (DkPeer* peer, peerList) {
-		if (peer->peerServerPort == port)
-			return peer;
-	}
-	return 0;
+DkPeer *DkPeerList::getPeerByServerport(quint16 port) const
+{
+    foreach (DkPeer *peer, peerList) {
+        if (peer->peerServerPort == port)
+            return peer;
+    }
+    return 0;
+}
+
+bool DkPeerList::alreadyConnectedTo(const QHostAddress &address, quint16 port) const
+{
+    foreach (DkPeer *peer, peerList) {
+        if (peer->hostAddress == address && peer->localServerPort == port) // TODO: wieso localserver port ... aber es funkt
+            return true;
+    }
+    return false;
 }
 
-bool DkPeerList::alreadyConnectedTo(const QHostAddress& address, quint16 port) const {
-	foreach (DkPeer* peer, peerList) {
-		if (peer->hostAddress == address && peer->localServerPort == port ) // TODO: wieso localserver port ... aber es funkt
-			return true;
-	}
-	return false;
+DkPeer *DkPeerList::getPeerById(quint16 id)
+{
+    return peerList.value(id, 0);
 }
 
-DkPeer* DkPeerList::getPeerById(quint16 id) {
-	return peerList.value(id, 0);
+DkPeer *DkPeerList::getPeerByAddress(const QHostAddress &address, quint16 port) const
+{
+    foreach (DkPeer *peer, peerList) {
+        if (peer->hostAddress == address && peer->localServerPort == port)
+            return peer;
+    }
+    return 0; // should not happen
 }
 
-DkPeer* DkPeerList::getPeerByAddress(const QHostAddress& address, quint16 port) const {
-	foreach (DkPeer* peer, peerList) {
-		if (peer->hostAddress == address && peer->localServerPort == port)
-			return peer;
-	}
-	return 0; // should not happen
-}
+void DkPeerList::print() const
+{
+    foreach (DkPeer *peer, peerList) {
+        if (!peer)
+            continue;
 
-void DkPeerList::print() const {
-	foreach (DkPeer* peer, peerList) {
-		
-		if (!peer)
-			continue;
-		
-		qDebug() << peer->peerId << " " << peer->clientName << " " << peer->hostAddress << " serverPort:" << peer->peerServerPort << 
-			" localPort:" << peer->localServerPort << " " << peer->title << " sync:" << peer->isSynchronized() << " menu:" << peer->showInMenu << " connection:" << peer->connection;
-	}
+        qDebug() << peer->peerId << " " << peer->clientName << " " << peer->hostAddress << " serverPort:" << peer->peerServerPort
+                 << " localPort:" << peer->localServerPort << " " << peer->title << " sync:" << peer->isSynchronized() << " menu:" << peer->showInMenu
+                 << " connection:" << peer->connection;
+    }
 }
 
 // DkStatusBarManager --------------------------------------------------------------------
-DkSyncManager::DkSyncManager() {
-
-	DkTimer dt;
-	mClient = new DkLocalClientManager("nomacs | Image Lounge", 0);
+DkSyncManager::DkSyncManager()
+{
+    DkTimer dt;
+    mClient = new DkLocalClientManager("nomacs | Image Lounge", 0);
 
-	//connect(this, SIGNAL(syncWithSignal(quint16)), mClient, SLOT(synchronizeWith(quint16)));
-	//connect(this, SIGNAL(stopSyncWithSignal(quint16)), mClient, SLOT(stopSynchronizeWith(quint16)));
-	qInfo() << "local client created in: " << dt;	// takes 1 sec in the client thread
+    // connect(this, SIGNAL(syncWithSignal(quint16)), mClient, SLOT(synchronizeWith(quint16)));
+    // connect(this, SIGNAL(stopSyncWithSignal(quint16)), mClient, SLOT(stopSynchronizeWith(quint16)));
+    qInfo() << "local client created in: " << dt; // takes 1 sec in the client thread
 }
 
-DkSyncManager& DkSyncManager::inst() {
-
-	static DkSyncManager inst;
-	return inst;
+DkSyncManager &DkSyncManager::inst()
+{
+    static DkSyncManager inst;
+    return inst;
 }
 
-DkClientManager* DkSyncManager::client() {
-
-	if (!mClient) {
-		qWarning() << "DkSyncManager::client() which is not created yet...";
-		return 0;
-	}
+DkClientManager *DkSyncManager::client()
+{
+    if (!mClient) {
+        qWarning() << "DkSyncManager::client() which is not created yet...";
+        return 0;
+    }
 
-	return mClient;
+    return mClient;
 }
 
 }
diff --git a/ImageLounge/src/DkGui/DkNetwork.h b/ImageLounge/src/DkGui/DkNetwork.h
index 01ce69b..5f1b43b 100644
--- a/ImageLounge/src/DkGui/DkNetwork.h
+++ b/ImageLounge/src/DkGui/DkNetwork.h
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkNetwork.h
  Created on:	20.07.2011
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -25,235 +25,244 @@
 
  *******************************************************************************************************/
 
-#pragma  once
+#pragma once
 
 #define local_tcp_port_start 45454
 #define local_tcp_port_end 45484
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QTcpServer>
-#include <QThread>
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QMutex>
 #include <QSharedPointer>
-#pragma warning(pop)		// no warnings from includes - end
+#include <QTcpServer>
+#include <QThread>
+#pragma warning(pop) // no warnings from includes - end
 
 #include "DkConnection.h"
 
 class QMimeData;
 
-namespace nmc {
+namespace nmc
+{
 
 // nomacs defines
 class DkLocalTcpServer;
 class DkLANTcpServer;
 class DkLANUdpSocket;
 
-class DkPeer : public QObject{
-	Q_OBJECT
+class DkPeer : public QObject
+{
+    Q_OBJECT
 
 public:
-	DkPeer(	
-		quint16 port, 
-		quint16 peerId, 
-		const QHostAddress& hostAddress, 
-		quint16 peerServerPort, 
-		const QString& title, 
-		DkConnection* connection, 
-		bool sychronized = false, 
-		const QString& clientName="", 
-		bool showInMenu = false, 
-		QObject* parent = NULL);
-
-	~DkPeer();
-
-	bool operator==(const DkPeer& peer) const;
-
-	bool isActive() const { return mHasChangedRecently; };
-	void setSynchronized(bool flag);
-	bool isSynchronized() const {return sychronized;};
-	bool isLocal() const {
-		return hostAddress == QHostAddress::LocalHost;
-	};
-
-	quint16 peerId;
-	quint16 localServerPort;
-	quint16 peerServerPort;
-	QHostAddress hostAddress;
-	QString clientName;
-	QString title;
-	DkConnection* connection;
-	QTimer* timer;
-	bool showInMenu;
+    DkPeer(quint16 port,
+           quint16 peerId,
+           const QHostAddress &hostAddress,
+           quint16 peerServerPort,
+           const QString &title,
+           DkConnection *connection,
+           bool sychronized = false,
+           const QString &clientName = "",
+           bool showInMenu = false,
+           QObject *parent = NULL);
+
+    ~DkPeer();
+
+    bool operator==(const DkPeer &peer) const;
+
+    bool isActive() const
+    {
+        return mHasChangedRecently;
+    };
+    void setSynchronized(bool flag);
+    bool isSynchronized() const
+    {
+        return sychronized;
+    };
+    bool isLocal() const
+    {
+        return hostAddress == QHostAddress::LocalHost;
+    };
+
+    quint16 peerId;
+    quint16 localServerPort;
+    quint16 peerServerPort;
+    QHostAddress hostAddress;
+    QString clientName;
+    QString title;
+    DkConnection *connection;
+    QTimer *timer;
+    bool showInMenu;
 
 signals:
-	void sendGoodByeMessage();
+    void sendGoodByeMessage();
 private slots:
-	void timerTimeout();
+    void timerTimeout();
 
 private:
-	bool mHasChangedRecently = false;
-	bool sychronized;
+    bool mHasChangedRecently = false;
+    bool sychronized;
 };
 
-class DkPeerList {
-
+class DkPeerList
+{
 public:
-	DkPeerList();
-	bool addPeer(DkPeer* peer);
-	bool removePeer(quint16 peerId);
-	bool setSynchronized(quint16 peerId, bool synchronized);
-	bool setTitle(quint16 peerId, const QString& title);
-	bool setShowInMenu(quint16 peerId, bool showInMenu);
-	QList<DkPeer*> getPeerList();
-	DkPeer* getPeerById(quint16 id);
-	DkPeer* getPeerByAddress(const QHostAddress& address, quint16 port) const;
-
-	QList<DkPeer*> getSynchronizedPeers() const;
-	QList<quint16> getSynchronizedPeerServerPorts() const;
-	QList<DkPeer*> getActivePeers() const;
-
-	DkPeer* getPeerByServerport(quint16 port) const;
-	bool alreadyConnectedTo(const QHostAddress& address, quint16 port) const;
-	void print() const;
+    DkPeerList();
+    bool addPeer(DkPeer *peer);
+    bool removePeer(quint16 peerId);
+    bool setSynchronized(quint16 peerId, bool synchronized);
+    bool setTitle(quint16 peerId, const QString &title);
+    bool setShowInMenu(quint16 peerId, bool showInMenu);
+    QList<DkPeer *> getPeerList();
+    DkPeer *getPeerById(quint16 id);
+    DkPeer *getPeerByAddress(const QHostAddress &address, quint16 port) const;
+
+    QList<DkPeer *> getSynchronizedPeers() const;
+    QList<quint16> getSynchronizedPeerServerPorts() const;
+    QList<DkPeer *> getActivePeers() const;
+
+    DkPeer *getPeerByServerport(quint16 port) const;
+    bool alreadyConnectedTo(const QHostAddress &address, quint16 port) const;
+    void print() const;
 
 private:
-	QMultiHash<quint16, DkPeer*> peerList;
+    QMultiHash<quint16, DkPeer *> peerList;
 };
 
-class DkClientManager : public QObject {
-	Q_OBJECT
-	public:
-		DkClientManager(const QString& title, QObject* parent = 0);
-		~DkClientManager();
-		virtual	QList<DkPeer*> getPeerList() = 0;
-
-	signals:
-		void receivedTransformation(QTransform transform, QTransform imgTransform, QPointF canvasSize);
-		void receivedPosition(QRect position, bool opacity, bool overlaid);
-		void receivedNewFile(qint16 op, const QString& filename);
-		void receivedImage(const QImage& image);
-		void receivedImageTitle(const QString& title);
-		void sendInfoSignal(const QString& msg, int time = 3000);
-		void sendGreetingMessage(const QString& title);
-		void sendSynchronizeMessage();
-		void sendDisableSynchronizeMessage();
-		void sendNewTitleMessage(const QString& newtitle);
-		void sendNewPositionMessage(QRect position, bool opacity, bool overlaid);
-		void sendNewTransformMessage(QTransform transform, QTransform imgTransform, QPointF canvasSize);
-		void sendNewFileMessage(qint16 op, const QString& filename);
-		void sendNewImageMessage(QImage image, const QString& title);
-		void sendNewUpcomingImageMessage(const QString& imageTitle);
-		void sendGoodByeMessage();
-		void synchronizedPeersListChanged(QList<quint16> newList);
-		void updateConnectionSignal(const QString&);
-		void clientConnectedSignal(bool);
-
-		void receivedQuit();
-
-	public slots:
-		virtual void synchronizeWith(quint16 peerId) = 0;
-		virtual void synchronizeWithServerPort(quint16 port) = 0;
-		virtual void stopSynchronizeWith(quint16 peerId) = 0;
-		virtual void sendTitle(const QString& newTitle);
-		void sendTransform(QTransform transform, QTransform imgTransform, QPointF canvasSize);
-		void sendPosition(QRect newRect, bool overlaid);
-
-		void sendNewFile(qint16 op, const QString& filename);
-		virtual void sendNewImage(QImage, const QString&) {}; // dummy
-		void sendGoodByeToAll();
-
-	protected slots:
-		void newConnection( int socketDescriptor );
-		virtual void connectionReadyForUse(quint16 peerId, const QString& title, DkConnection* connection);
-		virtual void connectionSynchronized(QList<quint16> synchronizedPeersOfOtherClient, DkConnection* connection) = 0;
-		virtual void connectionStopSynchronized(DkConnection* connection) = 0;
-		virtual void connectionSentNewTitle(DkConnection* connection, const QString& newTitle);
-		virtual void connectionReceivedTransformation(DkConnection* connection, const QTransform& transform, const QTransform& imgTransform, const QPointF& canvasSize);
-		virtual void connectionReceivedPosition(DkConnection* connection, const QRect& rect, bool opacity, bool overlaid);
-		virtual void connectionReceivedNewFile(DkConnection* connection, qint16 op, const QString& filename);
-		virtual void connectionReceivedGoodBye(DkConnection* connection);
-		void connectionShowStatusMessage(DkConnection* connection, const QString& msg);
-		void disconnected();
-
-	protected:
-		void removeConnection(DkConnection* connection);
-		void connectConnection(DkConnection* connection);
-		virtual DkConnection* createConnection() = 0;
-		QString listConnections(QList<DkPeer*> peers, bool connected);
-
-		DkPeerList mPeerList;
-		QString mCurrentTitle;
-		quint16 mNewPeerId;
-		QList<DkConnection*> mStartUpConnections;
+class DkClientManager : public QObject
+{
+    Q_OBJECT
+public:
+    DkClientManager(const QString &title, QObject *parent = 0);
+    ~DkClientManager();
+    virtual QList<DkPeer *> getPeerList() = 0;
+
+signals:
+    void receivedTransformation(QTransform transform, QTransform imgTransform, QPointF canvasSize);
+    void receivedPosition(QRect position, bool opacity, bool overlaid);
+    void receivedNewFile(qint16 op, const QString &filename);
+    void receivedImage(const QImage &image);
+    void receivedImageTitle(const QString &title);
+    void sendInfoSignal(const QString &msg, int time = 3000);
+    void sendGreetingMessage(const QString &title);
+    void sendSynchronizeMessage();
+    void sendDisableSynchronizeMessage();
+    void sendNewTitleMessage(const QString &newtitle);
+    void sendNewPositionMessage(QRect position, bool opacity, bool overlaid);
+    void sendNewTransformMessage(QTransform transform, QTransform imgTransform, QPointF canvasSize);
+    void sendNewFileMessage(qint16 op, const QString &filename);
+    void sendNewImageMessage(QImage image, const QString &title);
+    void sendNewUpcomingImageMessage(const QString &imageTitle);
+    void sendGoodByeMessage();
+    void synchronizedPeersListChanged(QList<quint16> newList);
+    void updateConnectionSignal(const QString &);
+    void clientConnectedSignal(bool);
+
+    void receivedQuit();
+
+public slots:
+    virtual void synchronizeWith(quint16 peerId) = 0;
+    virtual void synchronizeWithServerPort(quint16 port) = 0;
+    virtual void stopSynchronizeWith(quint16 peerId) = 0;
+    virtual void sendTitle(const QString &newTitle);
+    void sendTransform(QTransform transform, QTransform imgTransform, QPointF canvasSize);
+    void sendPosition(QRect newRect, bool overlaid);
+
+    void sendNewFile(qint16 op, const QString &filename);
+    virtual void sendNewImage(QImage, const QString &){}; // dummy
+    void sendGoodByeToAll();
+
+protected slots:
+    void newConnection(int socketDescriptor);
+    virtual void connectionReadyForUse(quint16 peerId, const QString &title, DkConnection *connection);
+    virtual void connectionSynchronized(QList<quint16> synchronizedPeersOfOtherClient, DkConnection *connection) = 0;
+    virtual void connectionStopSynchronized(DkConnection *connection) = 0;
+    virtual void connectionSentNewTitle(DkConnection *connection, const QString &newTitle);
+    virtual void
+    connectionReceivedTransformation(DkConnection *connection, const QTransform &transform, const QTransform &imgTransform, const QPointF &canvasSize);
+    virtual void connectionReceivedPosition(DkConnection *connection, const QRect &rect, bool opacity, bool overlaid);
+    virtual void connectionReceivedNewFile(DkConnection *connection, qint16 op, const QString &filename);
+    virtual void connectionReceivedGoodBye(DkConnection *connection);
+    void connectionShowStatusMessage(DkConnection *connection, const QString &msg);
+    void disconnected();
 
+protected:
+    void removeConnection(DkConnection *connection);
+    void connectConnection(DkConnection *connection);
+    virtual DkConnection *createConnection() = 0;
+    QString listConnections(QList<DkPeer *> peers, bool connected);
+
+    DkPeerList mPeerList;
+    QString mCurrentTitle;
+    quint16 mNewPeerId;
+    QList<DkConnection *> mStartUpConnections;
 };
 
-class DkLocalClientManager : public DkClientManager {
-	Q_OBJECT
-	
+class DkLocalClientManager : public DkClientManager
+{
+    Q_OBJECT
+
 public:
-	DkLocalClientManager(const QString& title, QObject* parent = 0);
-	QList<DkPeer*> getPeerList();
-	quint16 getServerPort() const;
+    DkLocalClientManager(const QString &title, QObject *parent = 0);
+    QList<DkPeer *> getPeerList();
+    quint16 getServerPort() const;
 
-	QMimeData* mimeData() const;
-	void startServer();
+    QMimeData *mimeData() const;
+    void startServer();
 
 signals:
-	void receivedQuit();
-	void sendQuitMessage();
+    void receivedQuit();
+    void sendQuitMessage();
 
 public slots:
-	void stopSynchronizeWith(quint16 peerId);
-	void synchronizeWithServerPort(quint16 port);
-	void synchronizeWith(quint16 peerId);
-	void sendArrangeInstances(bool overlaid);
-	void sendQuitMessageToPeers();
-	void connectToNomacs();
-	void connectAll();
+    void stopSynchronizeWith(quint16 peerId);
+    void synchronizeWithServerPort(quint16 port);
+    void synchronizeWith(quint16 peerId);
+    void sendArrangeInstances(bool overlaid);
+    void sendQuitMessageToPeers();
+    void connectToNomacs();
+    void connectAll();
 
 private slots:
-	void connectionSynchronized(QList<quint16> synchronizedPeersOfOtherClient, DkConnection* connection);
-	virtual void connectionStopSynchronized(DkConnection* connection);
-	void connectionReceivedQuit(); 
+    void connectionSynchronized(QList<quint16> synchronizedPeersOfOtherClient, DkConnection *connection);
+    virtual void connectionStopSynchronized(DkConnection *connection);
+    void connectionReceivedQuit();
 
 private:
-	DkLocalConnection* createConnection();
-	void searchForOtherClients();
+    DkLocalConnection *createConnection();
+    void searchForOtherClients();
 
-	DkLocalTcpServer* mServer;
+    DkLocalTcpServer *mServer;
 };
 
-class DkLocalTcpServer : public QTcpServer {
-	Q_OBJECT
-	
+class DkLocalTcpServer : public QTcpServer
+{
+    Q_OBJECT
+
 public:
-	DkLocalTcpServer(QObject* parent = 0);
+    DkLocalTcpServer(QObject *parent = 0);
 
 signals:
-	void serverReiceivedNewConnection(int DkDescriptor);
+    void serverReiceivedNewConnection(int DkDescriptor);
 
 protected:
-	void incomingConnection(qintptr socketDescriptor) override;
+    void incomingConnection(qintptr socketDescriptor) override;
 };
 
-class DllCoreExport DkSyncManager {
-
+class DllCoreExport DkSyncManager
+{
 public:
-	static DkSyncManager& inst();
+    static DkSyncManager &inst();
 
-	// singleton
-	DkSyncManager(DkSyncManager const&) = delete;
-	void operator=(DkSyncManager const&) = delete;
+    // singleton
+    DkSyncManager(DkSyncManager const &) = delete;
+    void operator=(DkSyncManager const &) = delete;
 
-	DkClientManager* client();
+    DkClientManager *client();
 
 private:
-	DkSyncManager();
+    DkSyncManager();
 
-	DkLocalClientManager* mClient = 0;
+    DkLocalClientManager *mClient = 0;
 };
 
-
 }
-
diff --git a/ImageLounge/src/DkGui/DkNoMacs.cpp b/ImageLounge/src/DkGui/DkNoMacs.cpp
index b61491e..6edd06b 100644
--- a/ImageLounge/src/DkGui/DkNoMacs.cpp
+++ b/ImageLounge/src/DkGui/DkNoMacs.cpp
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkNoMacs.cpp
  Created on:	21.04.2011
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -28,69 +28,72 @@
 #include "DkNoMacs.h"
 
 // my stuff
-#include "DkNetwork.h"
-#include "DkViewPort.h"
-#include "DkWidgets.h"
+#include "DkActionManager.h"
+#include "DkBatch.h"
+#include "DkCentralWidget.h"
+#include "DkControlWidget.h"
 #include "DkDialog.h"
-#include "DkSettings.h"
+#include "DkDockWidgets.h"
+#include "DkImageContainer.h"
+#include "DkImageLoader.h"
+#include "DkLogWidget.h"
+#include "DkManipulatorWidgets.h"
 #include "DkMenu.h"
 #include "DkMessageBox.h"
-#include "DkMetaDataWidgets.h"
-#include "DkManipulatorWidgets.h"
-#include "DkThumbsWidgets.h"
-#include "DkBatch.h"
-#include "DkCentralWidget.h"
 #include "DkMetaData.h"
-#include "DkImageContainer.h"
+#include "DkMetaDataWidgets.h"
+#include "DkNetwork.h"
 #include "DkQuickAccess.h"
-#include "DkUtils.h"
-#include "DkControlWidget.h"
-#include "DkImageLoader.h"
-#include "DkTimer.h"
-#include "DkActionManager.h"
+#include "DkSettings.h"
 #include "DkStatusBar.h"
-#include "DkDockWidgets.h"
-#include "DkLogWidget.h"
-#include "DkUpdater.h"
+#include "DkThumbsWidgets.h"
+#include "DkTimer.h"
 #include "DkToolbars.h"
+#include "DkUpdater.h"
+#include "DkUtils.h"
+#include "DkViewPort.h"
+#include "DkWidgets.h"
 
-#ifdef  WITH_PLUGINS
+#ifdef WITH_PLUGINS
 #include "DkPluginInterface.h"
 #include "DkPluginManager.h"
 #endif //  WITH_PLUGINS
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QBoxLayout>
-#include <QResizeEvent>
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QAction>
+#include <QBoxLayout>
 #include <QFileDialog>
 #include <QMessageBox>
+#include <QResizeEvent>
 #include <QStatusBar>
-//#include <QPanGesture>
-#include <QSplashScreen>
-#include <QErrorMessage>
-#include <QDesktopServices>
+// #include <QPanGesture>
+#include <QApplication>
 #include <QClipboard>
+#include <QDesktopServices>
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+#include <QDesktopWidget>
+#endif
+#include <QDrag>
+#include <QErrorMessage>
 #include <QEvent>
-#include <QSettings>
 #include <QFileInfo>
-#include <QTimer>
+#include <QInputDialog>
+#include <QMimeData>
+#include <QNetworkProxyFactory>
 #include <QProcess>
-#include <QStringBuilder>
-#include <QDesktopWidget>
 #include <QProgressDialog>
-#include <QDrag>
+#include <QScreen>
+#include <QSettings>
+#include <QShortcut>
+#include <QSplashScreen>
+#include <QStringBuilder>
+#include <QTimer>
 #include <QVector2D>
 #include <qmath.h>
-#include <QMimeData>
-#include <QNetworkProxyFactory>
-#include <QInputDialog>
-#include <QApplication>
-#include <QShortcut>
-#pragma warning(pop)		// no warnings from includes - end
+#pragma warning(pop) // no warnings from includes - end
 
 #if defined(Q_OS_WIN) && !defined(SOCK_STREAM)
-#include <winsock2.h>	// needed since libraw 0.16
+#include <winsock2.h> // needed since libraw 0.16
 #endif
 
 #ifdef Q_OS_WIN
@@ -101,366 +104,373 @@
 
 #include <iostream>
 
-namespace nmc {
+namespace nmc
+{
 
-DkNomacsOSXEventFilter::DkNomacsOSXEventFilter(QObject *parent) : QObject(parent) {
+DkNomacsOSXEventFilter::DkNomacsOSXEventFilter(QObject *parent)
+    : QObject(parent)
+{
 }
 
 /*! Handle QFileOpenEvent for mac here */
-bool DkNomacsOSXEventFilter::eventFilter(QObject *obj, QEvent *event) {
-	if (event->type() == QEvent::FileOpen) {
-		emit loadFile(static_cast<QFileOpenEvent*>(event)->file());
-		return true;
-	}
-	return QObject::eventFilter(obj, event);
+bool DkNomacsOSXEventFilter::eventFilter(QObject *obj, QEvent *event)
+{
+    if (event->type() == QEvent::FileOpen) {
+        emit loadFile(static_cast<QFileOpenEvent *>(event)->file());
+        return true;
+    }
+    return QObject::eventFilter(obj, event);
 }
 
 DkNoMacs::DkNoMacs(QWidget *parent, Qt::WindowFlags flags)
-	: QMainWindow(parent, flags) {
-
-	QMainWindow::setWindowTitle("nomacs | Image Lounge");
-	setObjectName("DkNoMacs");
-
-	mMenu = new DkMenuBar(this, -1);
-
-	DkActionManager& am = DkActionManager::instance();
-	am.createActions(this);
-	am.createMenus(mMenu);
-	am.enableImageActions(false);
-
-	mSaveSettings = true;
-
-	mOpenDialog = 0;
-	mSaveDialog = 0;
-	mThumbSaver = 0;
-	mOpacityDialog = 0;
-	mUpdater = 0;
-	mTranslationUpdater = 0;
-	mExportTiffDialog = 0;
-	mUpdateDialog = 0;
-	mProgressDialog = 0;
-	mProgressDialogTranslations = 0;
-	mForceDialog = 0;
-	mTrainDialog = 0;
-	mExplorer = 0;
-	mMetaDataDock = 0;
-	mPrintPreviewDialog = 0;
-	mThumbsDock = 0;
-	mQuickAccess = 0;
+    : QMainWindow(parent, flags)
+{
+    QMainWindow::setWindowTitle("nomacs | Image Lounge");
+    setObjectName("DkNoMacs");
+
+    mMenu = new DkMenuBar(this, -1);
+
+    DkActionManager &am = DkActionManager::instance();
+    am.createActions(this);
+    am.createMenus(mMenu);
+    am.enableImageActions(false);
+
+    mSaveSettings = true;
+
+    mOpenDialog = 0;
+    mSaveDialog = 0;
+    mThumbSaver = 0;
+    mOpacityDialog = 0;
+    mUpdater = 0;
+    mTranslationUpdater = 0;
+    mExportTiffDialog = 0;
+    mUpdateDialog = 0;
+    mProgressDialog = 0;
+    mProgressDialogTranslations = 0;
+    mForceDialog = 0;
+    mTrainDialog = 0;
+    mExplorer = 0;
+    mMetaDataDock = 0;
+    mPrintPreviewDialog = 0;
+    mThumbsDock = 0;
+    mQuickAccess = 0;
 #ifdef WITH_QUAZIP
-	mArchiveExtractionDialog = 0;
-#endif 
+    mArchiveExtractionDialog = 0;
+#endif
 
-	mOldGeometry = geometry();
-	mOverlaid = false;
-	
-	resize(850, 504);
-	setMinimumSize(20, 20);
+    mOldGeometry = geometry();
+    mOverlaid = false;
 
-	//// fun fact
-	//double an = pow(3987, 12);
-	//double bn = pow(4365, 12);
+    resize(850, 504);
+    setMinimumSize(20, 20);
 
-	//qDebug() << "3987 ^ 12 + 4365 ^ 12 = " << pow(an + bn, 1/12.0) << "^ 12";
-	//qDebug() << "Sorry Fermat, but the Simpsons are right.";
+    //// fun fact
+    // double an = pow(3987, 12);
+    // double bn = pow(4365, 12);
+
+    // qDebug() << "3987 ^ 12 + 4365 ^ 12 = " << pow(an + bn, 1/12.0) << "^ 12";
+    // qDebug() << "Sorry Fermat, but the Simpsons are right.";
 }
 
-DkNoMacs::~DkNoMacs() {
+DkNoMacs::~DkNoMacs()
+{
 }
 
-void DkNoMacs::init() {
+void DkNoMacs::init()
+{
+    // assign icon -> in windows the 32px version
+    QString iconPath = ":/nomacs/img/nomacs.svg";
+    loadStyleSheet();
 
-// assign icon -> in windows the 32px version
-	QString iconPath = ":/nomacs/img/nomacs.svg";
-	loadStyleSheet();
+    QIcon nmcIcon = QIcon(iconPath);
+    setObjectName("DkNoMacs");
 
-	QIcon nmcIcon = QIcon(iconPath);
-	setObjectName("DkNoMacs");
-	
-	if (!nmcIcon.isNull())
-		setWindowIcon(nmcIcon);
+    if (!nmcIcon.isNull())
+        setWindowIcon(nmcIcon);
 
-	// shortcuts and actions
-	createActions();
-	createMenu();
-	createContextMenu();
-	createStatusBar();
+    // shortcuts and actions
+    createActions();
+    createMenu();
+    createContextMenu();
+    createStatusBar();
 
-	//// TODO - just for android register me as a gesture recognizer
-	//grabGesture(Qt::PanGesture);
-	//grabGesture(Qt::PinchGesture);
-	//grabGesture(Qt::SwipeGesture);
+    //// TODO - just for android register me as a gesture recognizer
+    // grabGesture(Qt::PanGesture);
+    // grabGesture(Qt::PinchGesture);
+    // grabGesture(Qt::SwipeGesture);
 
-	// load the window at the same position as last time
-	readSettings();
-	installEventFilter(this);
+    // load the window at the same position as last time
+    readSettings();
+    installEventFilter(this);
 
-	if (DkSettingsManager::param().app().appMode != DkSettings::mode_frameless) {
-		DkToolBarManager::inst().showDefaultToolBar(DkSettingsManager::param().app().showToolBar);
-		showMenuBar(DkSettingsManager::param().app().showMenuBar);
-		DkStatusBarManager::instance().show(DkSettingsManager::param().app().showStatusBar);
-	}
+    if (DkSettingsManager::param().app().appMode != DkSettings::mode_frameless) {
+        DkToolBarManager::inst().showDefaultToolBar(DkSettingsManager::param().app().showToolBar);
+        showMenuBar(DkSettingsManager::param().app().showMenuBar);
+        DkStatusBarManager::instance().show(DkSettingsManager::param().app().showStatusBar);
+    }
 
-	// connections to the image loader
-	connect(getTabWidget(), SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)), this, SLOT(setWindowTitle(QSharedPointer<DkImageContainerT>)));
+    // connections to the image loader
+    connect(getTabWidget(), SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)), this, SLOT(setWindowTitle(QSharedPointer<DkImageContainerT>)));
 
-	DkActionManager::instance().enableMovieActions(false);
+    DkActionManager::instance().enableMovieActions(false);
 
 // clean up nomacs
 #ifdef Q_OS_WIN
-	if (!nmc::DkSettingsManager::param().global().setupPath.isEmpty() && QApplication::applicationVersion() == nmc::DkSettingsManager::param().global().setupVersion) {
-
-		// ask for exists - otherwise we always try to delete it if the user deleted it
-		if (!QFileInfo(nmc::DkSettingsManager::param().global().setupPath).exists() || QFile::remove(nmc::DkSettingsManager::param().global().setupPath)) {
-			nmc::DkSettingsManager::param().global().setupPath = "";
-			nmc::DkSettingsManager::param().global().setupVersion = "";
-			nmc::DkSettingsManager::param().save();
-		}
-	}
+    if (!nmc::DkSettingsManager::param().global().setupPath.isEmpty()
+        && QApplication::applicationVersion() == nmc::DkSettingsManager::param().global().setupVersion) {
+        // ask for exists - otherwise we always try to delete it if the user deleted it
+        if (!QFileInfo(nmc::DkSettingsManager::param().global().setupPath).exists() || QFile::remove(nmc::DkSettingsManager::param().global().setupPath)) {
+            nmc::DkSettingsManager::param().global().setupPath = "";
+            nmc::DkSettingsManager::param().global().setupVersion = "";
+            nmc::DkSettingsManager::param().save();
+        }
+    }
 #endif // Q_WS_WIN
 }
 
-void DkNoMacs::createStatusBar() {
-
-	setStatusBar(DkStatusBarManager::instance().statusbar());
+void DkNoMacs::createStatusBar()
+{
+    setStatusBar(DkStatusBarManager::instance().statusbar());
 }
 
-void DkNoMacs::loadStyleSheet() {
-
-	DkThemeManager tm;
-	tm.applyTheme();
+void DkNoMacs::loadStyleSheet()
+{
+    DkThemeManager tm;
+    tm.applyTheme();
 }
 
-void DkNoMacs::createMenu() {
-
-	setMenuBar(mMenu);
-	DkActionManager& am = DkActionManager::instance();
-	mMenu->addMenu(am.fileMenu());
-	mMenu->addMenu(am.editMenu());
-	mMenu->addMenu(am.manipulatorMenu());
-	mMenu->addMenu(am.viewMenu());
-	mMenu->addMenu(am.panelMenu());
-	mMenu->addMenu(am.toolsMenu());
+void DkNoMacs::createMenu()
+{
+    setMenuBar(mMenu);
+    DkActionManager &am = DkActionManager::instance();
+    mMenu->addMenu(am.fileMenu());
+    mMenu->addMenu(am.editMenu());
+    mMenu->addMenu(am.manipulatorMenu());
+    mMenu->addMenu(am.viewMenu());
+    mMenu->addMenu(am.panelMenu());
+    mMenu->addMenu(am.toolsMenu());
 
-	// no sync menu in frameless view
-	if (DkSettingsManager::param().app().appMode != DkSettings::mode_frameless)
-		mMenu->addMenu(am.syncMenu());
+    // no sync menu in frameless view
+    if (DkSettingsManager::param().app().appMode != DkSettings::mode_frameless)
+        mMenu->addMenu(am.syncMenu());
 
 #ifdef WITH_PLUGINS
-	// plugin menu
-	mPluginsMenu = mMenu->addMenu(tr("Pl&ugins"));
-	am.pluginActionManager()->setMenu(mPluginsMenu);
+    // plugin menu
+    mPluginsMenu = mMenu->addMenu(tr("Pl&ugins"));
+    am.pluginActionManager()->setMenu(mPluginsMenu);
 #endif // WITH_PLUGINS
 
-	mMenu->addMenu(am.helpMenu());
-}
-
-void DkNoMacs::createContextMenu() {
-}
-
-void DkNoMacs::createActions() {
-	
-	DkActionManager& am = DkActionManager::instance();
-
-	connect(am.action(DkActionManager::menu_file_open), SIGNAL(triggered()), this, SLOT(openFile()));
-	connect(am.action(DkActionManager::menu_file_open_dir), SIGNAL(triggered()), this, SLOT(openDir()));
-	connect(am.action(DkActionManager::menu_file_quick_launch), SIGNAL(triggered()), this, SLOT(openQuickLaunch()));
-	connect(am.action(DkActionManager::menu_file_open_list), SIGNAL(triggered()), this, SLOT(openFileList()));
-	connect(am.action(DkActionManager::menu_file_save_list), SIGNAL(triggered()), this, SLOT(saveFileList()));
-	connect(am.action(DkActionManager::menu_file_rename), SIGNAL(triggered()), this, SLOT(renameFile()));
-	connect(am.action(DkActionManager::menu_file_goto), SIGNAL(triggered()), this, SLOT(goTo()));
-	connect(am.action(DkActionManager::menu_file_show_recent), SIGNAL(triggered(bool)), centralWidget(), SLOT(showRecentFiles(bool)));	
-	connect(am.action(DkActionManager::menu_file_new_instance), SIGNAL(triggered()), this, SLOT(newInstance()));
-	connect(am.action(DkActionManager::menu_file_private_instance), SIGNAL(triggered()), this, SLOT(newInstance()));
-	connect(am.action(DkActionManager::menu_file_find), SIGNAL(triggered()), this, SLOT(find()));
-	connect(am.action(DkActionManager::menu_file_recursive), SIGNAL(triggered(bool)), this, SLOT(setRecursiveScan(bool)));
-	connect(am.action(DkActionManager::menu_file_exit), SIGNAL(triggered()), this, SLOT(close()));
-	
-	connect(am.action(DkActionManager::menu_sort_filename), SIGNAL(triggered(bool)), this, SLOT(changeSorting(bool)));
-	connect(am.action(DkActionManager::menu_sort_date_created), SIGNAL(triggered(bool)), this, SLOT(changeSorting(bool)));
-	connect(am.action(DkActionManager::menu_sort_date_modified), SIGNAL(triggered(bool)), this, SLOT(changeSorting(bool)));
-	connect(am.action(DkActionManager::menu_sort_random), SIGNAL(triggered(bool)), this, SLOT(changeSorting(bool)));
-	connect(am.action(DkActionManager::menu_sort_ascending), SIGNAL(triggered(bool)), this, SLOT(changeSorting(bool)));
-	connect(am.action(DkActionManager::menu_sort_descending), SIGNAL(triggered(bool)), this, SLOT(changeSorting(bool)));
-
-	connect(am.action(DkActionManager::menu_panel_menu), SIGNAL(toggled(bool)), this, SLOT(showMenuBar(bool)));
-	connect(am.action(DkActionManager::menu_panel_explorer), SIGNAL(toggled(bool)), this, SLOT(showExplorer(bool)));
-	connect(am.action(DkActionManager::menu_panel_metadata_dock), SIGNAL(toggled(bool)), this, SLOT(showMetaDataDock(bool)));
-	connect(am.action(DkActionManager::menu_edit_image), SIGNAL(toggled(bool)), this, SLOT(showEditDock(bool)));
-	connect(am.action(DkActionManager::menu_panel_history), SIGNAL(toggled(bool)), this, SLOT(showHistoryDock(bool)));
-	connect(am.action(DkActionManager::menu_panel_log), SIGNAL(toggled(bool)), this, SLOT(showLogDock(bool)));
-	connect(am.action(DkActionManager::menu_panel_preview), SIGNAL(toggled(bool)), this, SLOT(showThumbsDock(bool)));
-	connect(am.action(DkActionManager::menu_panel_toggle), SIGNAL(toggled(bool)), this, SLOT(toggleDocks(bool)));
-
-	connect(am.action(DkActionManager::menu_view_fit_frame), SIGNAL(triggered()), this, SLOT(fitFrame()));
-	connect(am.action(DkActionManager::menu_view_fullscreen), SIGNAL(triggered()), this, SLOT(toggleFullScreen()));
-	connect(am.action(DkActionManager::menu_view_frameless), SIGNAL(toggled(bool)), this, SLOT(restartFrameless(bool)));
-	connect(am.action(DkActionManager::menu_panel_transfertoolbar), SIGNAL(toggled(bool)), this, SLOT(restartWithPseudoColor(bool)));
-	connect(am.action(DkActionManager::menu_view_opacity_change), SIGNAL(triggered()), this, SLOT(showOpacityDialog()));
-	connect(am.action(DkActionManager::menu_view_opacity_up), SIGNAL(triggered()), this, SLOT(opacityUp()));
-	connect(am.action(DkActionManager::menu_view_opacity_down), SIGNAL(triggered()), this, SLOT(opacityDown()));
-	connect(am.action(DkActionManager::menu_view_opacity_an), SIGNAL(triggered()), this, SLOT(animateChangeOpacity()));
-	connect(am.action(DkActionManager::menu_view_lock_window), SIGNAL(triggered(bool)), this, SLOT(lockWindow(bool)));
-	
-	connect(am.action(DkActionManager::menu_tools_thumbs), SIGNAL(triggered()), this, SLOT(computeThumbsBatch()));
-	connect(am.action(DkActionManager::menu_tools_filter), SIGNAL(triggered(bool)), this, SLOT(find(bool)));
-	connect(am.action(DkActionManager::menu_tools_export_tiff), SIGNAL(triggered()), this, SLOT(exportTiff()));
-	connect(am.action(DkActionManager::menu_tools_extract_archive), SIGNAL(triggered()), this, SLOT(extractImagesFromArchive()));
-	connect(am.action(DkActionManager::menu_tools_train_format), SIGNAL(triggered()), this, SLOT(trainFormat()));
-
-	connect(am.action(DkActionManager::sc_test_rec), SIGNAL(triggered()), this, SLOT(loadRecursion()));
-	connect(am.action(DkActionManager::sc_test_pong), SIGNAL(triggered()), this, SLOT(startPong()));
-	
-	connect(am.action(DkActionManager::menu_plugin_manager), SIGNAL(triggered()), this, SLOT(openPluginManager()));
-
-	// help menu
-	connect(am.action(DkActionManager::menu_help_about), SIGNAL(triggered()), this, SLOT(aboutDialog()));
-	connect(am.action(DkActionManager::menu_help_documentation), SIGNAL(triggered()), this, SLOT(openDocumentation()));
-	connect(am.action(DkActionManager::menu_help_bug), SIGNAL(triggered()), this, SLOT(bugReport()));
-	connect(am.action(DkActionManager::menu_help_update), SIGNAL(triggered()), this, SLOT(checkForUpdate()));
-	connect(am.action(DkActionManager::menu_help_update_translation), SIGNAL(triggered()), this, SLOT(updateTranslations()));
-
-	connect(am.appManager(), SIGNAL(openFileSignal(QAction*)), this, SLOT(openFileWith(QAction*)));
-}
-
-void DkNoMacs::clearFileHistory() {
-	DkSettingsManager::param().global().recentFiles.clear();
-}
-
-void DkNoMacs::clearFolderHistory() {
-	DkSettingsManager::param().global().recentFolders.clear();
-}
-
-DkCentralWidget* DkNoMacs::getTabWidget() const {
-
-	DkCentralWidget* cw = dynamic_cast<DkCentralWidget*>(centralWidget());
-	return cw;
+    mMenu->addMenu(am.helpMenu());
 }
 
-// Qt how-to
-void DkNoMacs::closeEvent(QCloseEvent *event) {
+void DkNoMacs::createContextMenu()
+{
+}
+
+void DkNoMacs::createActions()
+{
+    DkActionManager &am = DkActionManager::instance();
 
-	DkCentralWidget* cw = static_cast<DkCentralWidget*>(centralWidget());
+    connect(am.action(DkActionManager::menu_file_open), SIGNAL(triggered()), this, SLOT(openFile()));
+    connect(am.action(DkActionManager::menu_file_open_dir), SIGNAL(triggered()), this, SLOT(openDir()));
+    connect(am.action(DkActionManager::menu_file_quick_launch), SIGNAL(triggered()), this, SLOT(openQuickLaunch()));
+    connect(am.action(DkActionManager::menu_file_open_list), SIGNAL(triggered()), this, SLOT(openFileList()));
+    connect(am.action(DkActionManager::menu_file_save_list), SIGNAL(triggered()), this, SLOT(saveFileList()));
+    connect(am.action(DkActionManager::menu_file_rename), SIGNAL(triggered()), this, SLOT(renameFile()));
+    connect(am.action(DkActionManager::menu_file_goto), SIGNAL(triggered()), this, SLOT(goTo()));
+    connect(am.action(DkActionManager::menu_file_show_recent), SIGNAL(triggered(bool)), centralWidget(), SLOT(showRecentFiles(bool)));
+    connect(am.action(DkActionManager::menu_file_new_instance), SIGNAL(triggered()), this, SLOT(newInstance()));
+    connect(am.action(DkActionManager::menu_file_private_instance), SIGNAL(triggered()), this, SLOT(newInstance()));
+    connect(am.action(DkActionManager::menu_file_find), SIGNAL(triggered()), this, SLOT(find()));
+    connect(am.action(DkActionManager::menu_file_recursive), SIGNAL(triggered(bool)), this, SLOT(setRecursiveScan(bool)));
+    connect(am.action(DkActionManager::menu_file_exit), SIGNAL(triggered()), this, SLOT(close()));
 
-	if (cw && cw->getTabs().size() > 1) {
-		
-		DkMessageBox* msg = new DkMessageBox(QMessageBox::Question, tr("Quit nomacs"), 
-			tr("Do you want nomacs to save your tabs?"), 
-			(QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel), this);
-		msg->setButtonText(QMessageBox::Yes, tr("&Save and Quit"));
-		msg->setButtonText(QMessageBox::No, tr("&Quit"));
-		msg->setObjectName("saveTabsDialog");
+    connect(am.action(DkActionManager::menu_sort_filename), SIGNAL(triggered(bool)), this, SLOT(changeSorting(bool)));
+    connect(am.action(DkActionManager::menu_sort_file_size), SIGNAL(triggered(bool)), this, SLOT(changeSorting(bool)));
+    connect(am.action(DkActionManager::menu_sort_date_created), SIGNAL(triggered(bool)), this, SLOT(changeSorting(bool)));
+    connect(am.action(DkActionManager::menu_sort_date_modified), SIGNAL(triggered(bool)), this, SLOT(changeSorting(bool)));
+    connect(am.action(DkActionManager::menu_sort_random), SIGNAL(triggered(bool)), this, SLOT(changeSorting(bool)));
+    connect(am.action(DkActionManager::menu_sort_ascending), SIGNAL(triggered(bool)), this, SLOT(changeSorting(bool)));
+    connect(am.action(DkActionManager::menu_sort_descending), SIGNAL(triggered(bool)), this, SLOT(changeSorting(bool)));
 
-		int answer = msg->exec();
-	
-		if (answer == QMessageBox::Cancel || answer == QMessageBox::NoButton) {	// User canceled - do not close
-			event->ignore();
-			return;
-		}
+    connect(am.action(DkActionManager::menu_panel_menu), SIGNAL(toggled(bool)), this, SLOT(showMenuBar(bool)));
+    connect(am.action(DkActionManager::menu_panel_explorer), SIGNAL(toggled(bool)), this, SLOT(showExplorer(bool)));
+    connect(am.action(DkActionManager::menu_panel_metadata_dock), SIGNAL(toggled(bool)), this, SLOT(showMetaDataDock(bool)));
+    connect(am.action(DkActionManager::menu_edit_image), SIGNAL(toggled(bool)), this, SLOT(showEditDock(bool)));
+    connect(am.action(DkActionManager::menu_panel_history), SIGNAL(toggled(bool)), this, SLOT(showHistoryDock(bool)));
+    connect(am.action(DkActionManager::menu_panel_log), SIGNAL(toggled(bool)), this, SLOT(showLogDock(bool)));
+    connect(am.action(DkActionManager::menu_panel_preview), SIGNAL(toggled(bool)), this, SLOT(showThumbsDock(bool)));
+    connect(am.action(DkActionManager::menu_panel_toggle), SIGNAL(toggled(bool)), this, SLOT(toggleDocks(bool)));
 
-		cw->saveSettings(answer == QMessageBox::Yes);
-	}
-	else
-		cw->saveSettings(false);
+    connect(am.action(DkActionManager::menu_view_fit_frame), SIGNAL(triggered()), this, SLOT(fitFrame()));
+    connect(am.action(DkActionManager::menu_view_fullscreen), SIGNAL(triggered()), this, SLOT(toggleFullScreen()));
+    connect(am.action(DkActionManager::menu_view_frameless), SIGNAL(toggled(bool)), this, SLOT(restartFrameless(bool)));
+    connect(am.action(DkActionManager::menu_panel_transfertoolbar), SIGNAL(toggled(bool)), this, SLOT(restartWithPseudoColor(bool)));
+    connect(am.action(DkActionManager::menu_view_opacity_change), SIGNAL(triggered()), this, SLOT(showOpacityDialog()));
+    connect(am.action(DkActionManager::menu_view_opacity_up), SIGNAL(triggered()), this, SLOT(opacityUp()));
+    connect(am.action(DkActionManager::menu_view_opacity_down), SIGNAL(triggered()), this, SLOT(opacityDown()));
+    connect(am.action(DkActionManager::menu_view_opacity_an), SIGNAL(triggered()), this, SLOT(animateChangeOpacity()));
+    connect(am.action(DkActionManager::menu_view_lock_window), SIGNAL(triggered(bool)), this, SLOT(lockWindow(bool)));
 
-	if (!getTabWidget()->requestClose()) {
-		// do not close if the user hit cancel in the save changes dialog
-		event->ignore();
-		return;
-	}
+    connect(am.action(DkActionManager::menu_tools_thumbs), SIGNAL(triggered()), this, SLOT(computeThumbsBatch()));
+    connect(am.action(DkActionManager::menu_tools_filter), SIGNAL(triggered(bool)), this, SLOT(find(bool)));
+    connect(am.action(DkActionManager::menu_tools_export_tiff), SIGNAL(triggered()), this, SLOT(exportTiff()));
+    connect(am.action(DkActionManager::menu_tools_extract_archive), SIGNAL(triggered()), this, SLOT(extractImagesFromArchive()));
+    connect(am.action(DkActionManager::menu_tools_train_format), SIGNAL(triggered()), this, SLOT(trainFormat()));
 
-	emit closeSignal();
-	qDebug() << "saving window settings...";
-	setVisible(false);
-	//showNormal();
+    connect(am.action(DkActionManager::sc_test_rec), SIGNAL(triggered()), this, SLOT(loadRecursion()));
+    connect(am.action(DkActionManager::sc_test_pong), SIGNAL(triggered()), this, SLOT(startPong()));
 
-	if (mSaveSettings) {
-		DefaultSettings settings;
-		settings.setValue("geometryNomacs", geometry());
-		settings.setValue("geometry", saveGeometry());
-		settings.setValue("windowState", saveState());
-		
-		if (mExplorer)
-			settings.setValue(mExplorer->objectName(), QMainWindow::dockWidgetArea(mExplorer));
-		if (mMetaDataDock)
-			settings.setValue(mMetaDataDock->objectName(), QMainWindow::dockWidgetArea(mMetaDataDock));
-		if (mEditDock)
-			settings.setValue(mEditDock->objectName(), QMainWindow::dockWidgetArea(mEditDock));
-		if (mThumbsDock)
-			settings.setValue(mThumbsDock->objectName(), QMainWindow::dockWidgetArea(mThumbsDock));
+    connect(am.action(DkActionManager::menu_plugin_manager), SIGNAL(triggered()), this, SLOT(openPluginManager()));
 
-		nmc::DkSettingsManager::param().save();
-	}
+    // help menu
+    connect(am.action(DkActionManager::menu_help_about), SIGNAL(triggered()), this, SLOT(aboutDialog()));
+    connect(am.action(DkActionManager::menu_help_documentation), SIGNAL(triggered()), this, SLOT(openDocumentation()));
+    connect(am.action(DkActionManager::menu_help_bug), SIGNAL(triggered()), this, SLOT(bugReport()));
+    connect(am.action(DkActionManager::menu_help_update), SIGNAL(triggered()), this, SLOT(checkForUpdate()));
+    connect(am.action(DkActionManager::menu_help_update_translation), SIGNAL(triggered()), this, SLOT(updateTranslations()));
 
-	QMainWindow::closeEvent(event);
+    connect(am.appManager(), SIGNAL(openFileSignal(QAction *)), this, SLOT(openFileWith(QAction *)));
 }
 
-void DkNoMacs::resizeEvent(QResizeEvent *event) {
+void DkNoMacs::clearFileHistory()
+{
+    DkSettingsManager::param().global().recentFiles.clear();
+}
 
-	QMainWindow::resizeEvent(event);
-	
-	if (!mOverlaid)
-		mOldGeometry = geometry();
-	else if (windowOpacity() < 1.0f) {
-		animateChangeOpacity();
-		mOverlaid = false;
-	}
+void DkNoMacs::clearFolderHistory()
+{
+    DkSettingsManager::param().global().recentFolders.clear();
+}
 
+DkCentralWidget *DkNoMacs::getTabWidget() const
+{
+    DkCentralWidget *cw = dynamic_cast<DkCentralWidget *>(centralWidget());
+    return cw;
 }
 
-void DkNoMacs::moveEvent(QMoveEvent *event) {
+// Qt how-to
+void DkNoMacs::closeEvent(QCloseEvent *event)
+{
+    DkCentralWidget *cw = static_cast<DkCentralWidget *>(centralWidget());
+
+    if (cw && cw->getTabs().size() > 1) {
+        DkMessageBox *msg = new DkMessageBox(QMessageBox::Question,
+                                             tr("Quit nomacs"),
+                                             tr("Do you want nomacs to save your tabs?"),
+                                             (QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel),
+                                             this);
+        msg->setButtonText(QMessageBox::Yes, tr("&Save and Quit"));
+        msg->setButtonText(QMessageBox::No, tr("&Quit"));
+        msg->setObjectName("saveTabsDialog");
 
-	QMainWindow::moveEvent(event);
+        int answer = msg->exec();
 
-	if (!mOverlaid)
-		mOldGeometry = geometry();
-	else if (windowOpacity() < 1.0f) {
-		animateChangeOpacity();
-		mOverlaid = false;
-	}
-}
+        if (answer == QMessageBox::Cancel || answer == QMessageBox::NoButton) { // User canceled - do not close
+            event->ignore();
+            return;
+        }
+
+        cw->saveSettings(answer == QMessageBox::Yes);
+    } else
+        cw->saveSettings(false);
+
+    if (!getTabWidget()->requestClose()) {
+        // do not close if the user hit cancel in the save changes dialog
+        event->ignore();
+        return;
+    }
+
+    emit closeSignal();
+    qDebug() << "saving window settings...";
+    setVisible(false);
+    // showNormal();
 
-void DkNoMacs::mouseDoubleClickEvent(QMouseEvent* event) {
+    if (mSaveSettings) {
+        DefaultSettings settings;
+        settings.setValue("geometryNomacs", geometry());
+        settings.setValue("geometry", saveGeometry());
+        settings.setValue("windowState", saveState());
 
-	if (event->button() != Qt::LeftButton || (getTabWidget() && !getTabWidget()->getCurrentImage()))
-		return;
+        if (mExplorer)
+            settings.setValue(mExplorer->objectName(), QMainWindow::dockWidgetArea(mExplorer));
+        if (mMetaDataDock)
+            settings.setValue(mMetaDataDock->objectName(), QMainWindow::dockWidgetArea(mMetaDataDock));
+        if (mEditDock)
+            settings.setValue(mEditDock->objectName(), QMainWindow::dockWidgetArea(mEditDock));
+        if (mThumbsDock)
+            settings.setValue(mThumbsDock->objectName(), QMainWindow::dockWidgetArea(mThumbsDock));
 
-	if (isFullScreen())
-		exitFullScreen();
-	else if (DkSettingsManager::instance().param().global().doubleClickForFullscreen)
-		enterFullScreen();
+        nmc::DkSettingsManager::param().save();
+    }
 
-	//QMainWindow::mouseDoubleClickEvent(event);
+    QMainWindow::closeEvent(event);
 }
 
+void DkNoMacs::resizeEvent(QResizeEvent *event)
+{
+    QMainWindow::resizeEvent(event);
 
-void DkNoMacs::mousePressEvent(QMouseEvent* event) {
+    if (!mOverlaid)
+        mOldGeometry = geometry();
+    else if (windowOpacity() < 1.0f) {
+        animateChangeOpacity();
+        mOverlaid = false;
+    }
+}
 
-	mMousePos = event->pos();
+void DkNoMacs::moveEvent(QMoveEvent *event)
+{
+    QMainWindow::moveEvent(event);
 
-	QMainWindow::mousePressEvent(event);
+    if (!mOverlaid)
+        mOldGeometry = geometry();
+    else if (windowOpacity() < 1.0f) {
+        animateChangeOpacity();
+        mOverlaid = false;
+    }
 }
 
-void DkNoMacs::mouseReleaseEvent(QMouseEvent *event) {
+void DkNoMacs::mouseDoubleClickEvent(QMouseEvent *event)
+{
+    if (event->button() != Qt::LeftButton || (getTabWidget() && !getTabWidget()->getCurrentImage()))
+        return;
+
+    if (isFullScreen())
+        exitFullScreen();
+    else if (DkSettingsManager::instance().param().global().doubleClickForFullscreen)
+        enterFullScreen();
 
-	QMainWindow::mouseReleaseEvent(event);
+    // QMainWindow::mouseDoubleClickEvent(event);
 }
 
-void DkNoMacs::contextMenuEvent(QContextMenuEvent *event) {
+void DkNoMacs::mousePressEvent(QMouseEvent *event)
+{
+    mMousePos = event->pos();
 
-	QMainWindow::contextMenuEvent(event);
+    QMainWindow::mousePressEvent(event);
+}
 
-	if (!event->isAccepted())
-		DkActionManager::instance().contextMenu()->exec(event->globalPos());
+void DkNoMacs::mouseReleaseEvent(QMouseEvent *event)
+{
+    QMainWindow::mouseReleaseEvent(event);
 }
 
-void DkNoMacs::mouseMoveEvent(QMouseEvent *event) {
+void DkNoMacs::contextMenuEvent(QContextMenuEvent *event)
+{
+    QMainWindow::contextMenuEvent(event);
 
-	QMainWindow::mouseMoveEvent(event);
+    if (!event->isAccepted())
+        DkActionManager::instance().contextMenu()->exec(event->globalPos());
 }
 
-//bool DkNoMacs::gestureEvent(QGestureEvent *event) {
-//	
+void DkNoMacs::mouseMoveEvent(QMouseEvent *event)
+{
+    QMainWindow::mouseMoveEvent(event);
+}
+
+// bool DkNoMacs::gestureEvent(QGestureEvent *event) {
+//
 //	DkViewPort* vp = viewport();
 //
 //	if (QGesture *swipe = event->gesture(Qt::SwipeGesture)) {
@@ -468,7 +478,7 @@ void DkNoMacs::mouseMoveEvent(QMouseEvent *event) {
 //
 //		qDebug() << "swipe detected\n";
 //		if (vp) {
-//			
+//
 //			if (swipeG->horizontalDirection() == QSwipeGesture::Left)
 //				vp->loadNextFileFast();
 //			else if (swipeG->horizontalDirection() == QSwipeGesture::Right)
@@ -479,7 +489,7 @@ void DkNoMacs::mouseMoveEvent(QMouseEvent *event) {
 //
 //	}
 //	else if (QGesture *pan = event->gesture(Qt::PanGesture)) {
-//		
+//
 //		QPanGesture* panG = static_cast<QPanGesture *>(pan);
 //
 //		qDebug() << "you're speedy: " << panG->acceleration();
@@ -487,7 +497,7 @@ void DkNoMacs::mouseMoveEvent(QMouseEvent *event) {
 //		QPointF delta = panG->delta();
 //
 //		if (panG->acceleration() > 10 && delta.x() && fabs(delta.y()/delta.x()) < 0.2) {
-//			
+//
 //			if (delta.x() < 0)
 //				vp->loadNextFileFast();
 //			else
@@ -518,1691 +528,1660 @@ void DkNoMacs::mouseMoveEvent(QMouseEvent *event) {
 //
 //	//	pinchTriggered(static_cast<QPinchGesture *>(pinch));
 //	return true;
-//}
+// }
 
-void DkNoMacs::readSettings() {
-	
-	DefaultSettings settings;
+void DkNoMacs::readSettings()
+{
+    DefaultSettings settings;
 
 #ifdef Q_WS_WIN
-	// fixes #392 - starting maximized on 2nd screen - tested on win8 only
-	QRect r = settings.value("geometryNomacs", QRect()).toRect();
+    // fixes #392 - starting maximized on 2nd screen - tested on win8 only
+    QRect r = settings.value("geometryNomacs", QRect()).toRect();
 
-	if (r.width() && r.height())	// do not set the geometry if nomacs is loaded the first time
-		setGeometry(r);
+    if (r.width() && r.height()) // do not set the geometry if nomacs is loaded the first time
+        setGeometry(r);
 #endif
 
-	restoreGeometry(settings.value("geometry").toByteArray());
-	restoreState(settings.value("windowState").toByteArray());
-
-	// restore state makes the toolbar visible - so hide it again...
-	if (DkSettingsManager::param().app().appMode == DkSettings::mode_frameless) {
-		DkToolBarManager::inst().showDefaultToolBar(false);
-		DkStatusBarManager::instance().show(false);
-	}
-}
-
-void DkNoMacs::toggleFullScreen() {
-
-	if (isFullScreen())
-		exitFullScreen();
-	else
-		enterFullScreen();
-}
+    restoreGeometry(settings.value("geometry").toByteArray());
+    restoreState(settings.value("windowState").toByteArray());
+
+    // restore state makes the toolbar visible - so hide it again...
+    if (DkSettingsManager::param().app().appMode == DkSettings::mode_frameless) {
+        DkToolBarManager::inst().showDefaultToolBar(false);
+        DkStatusBarManager::instance().show(false);
+    }
+}
+
+void DkNoMacs::toggleFullScreen()
+{
+    if (isFullScreen())
+        exitFullScreen();
+    else
+        enterFullScreen();
+}
 
-void DkNoMacs::enterFullScreen() {
-	
-	DkSettingsManager::param().app().currentAppMode += qFloor(DkSettings::mode_end*0.5f);
-	if (DkSettingsManager::param().app().currentAppMode < 0) {
-		qDebug() << "illegal state: " << DkSettingsManager::param().app().currentAppMode;
-		DkSettingsManager::param().app().currentAppMode = DkSettings::mode_default;
-	}
+void DkNoMacs::enterFullScreen()
+{
+    DkSettingsManager::param().app().currentAppMode += qFloor(DkSettings::mode_end * 0.5f);
+    if (DkSettingsManager::param().app().currentAppMode < 0) {
+        qDebug() << "illegal state: " << DkSettingsManager::param().app().currentAppMode;
+        DkSettingsManager::param().app().currentAppMode = DkSettings::mode_default;
+    }
 
-	menuBar()->hide();
-	DkToolBarManager::inst().show(false);
-	DkStatusBarManager::instance().statusbar()->hide();
-	getTabWidget()->showTabs(false);
+    menuBar()->hide();
+    DkToolBarManager::inst().show(false);
+    DkStatusBarManager::instance().statusbar()->hide();
+    getTabWidget()->showTabs(false);
 
-	restoreDocks();
+    restoreDocks();
 
-	// here is an issue with windows that I can't quite fix:
-	// if we send nomacs to fullscreen from an attached window (i.e. split window)
-	setWindowState(windowState() ^ Qt::WindowFullScreen);
-	
-	if (getTabWidget()->getViewPort())
-		getTabWidget()->getViewPort()->setFullScreen(true);
+    // here is an issue with windows that I can't quite fix:
+    // if we send nomacs to fullscreen from an attached window (i.e. split window)
+    setWindowState(windowState() ^ Qt::WindowFullScreen);
 
+    if (getTabWidget()->getViewPort())
+        getTabWidget()->getViewPort()->setFullScreen(true);
 }
 
-void DkNoMacs::exitFullScreen() {
+void DkNoMacs::exitFullScreen()
+{
+    if (isFullScreen()) {
+        DkSettingsManager::param().app().currentAppMode -= qFloor(DkSettings::mode_end * 0.5f);
+        if (DkSettingsManager::param().app().currentAppMode < 0) {
+            qDebug() << "illegal state: " << DkSettingsManager::param().app().currentAppMode;
+            DkSettingsManager::param().app().currentAppMode = DkSettings::mode_default;
+        }
 
-	if (isFullScreen()) {
-		DkSettingsManager::param().app().currentAppMode -= qFloor(DkSettings::mode_end*0.5f);
-		if (DkSettingsManager::param().app().currentAppMode < 0) {
-			qDebug() << "illegal state: " << DkSettingsManager::param().app().currentAppMode;
-			DkSettingsManager::param().app().currentAppMode = DkSettings::mode_default;
-		}
+        if (DkSettingsManager::param().app().showMenuBar)
+            mMenu->show();
+        if (DkSettingsManager::param().app().showStatusBar)
+            DkStatusBarManager::instance().statusbar()->show();
 
-		if (DkSettingsManager::param().app().showMenuBar) mMenu->show();
-		if (DkSettingsManager::param().app().showStatusBar) DkStatusBarManager::instance().statusbar()->show();
+        DkToolBarManager::inst().restore();
+        restoreDocks();
+        setWindowState(windowState() ^ Qt::WindowFullScreen);
 
-		DkToolBarManager::inst().restore();
-		restoreDocks();
-		setWindowState(windowState() ^ Qt::WindowFullScreen);
+        if (getTabWidget())
+            getTabWidget()->showTabs(true);
 
+        update(); // if no resize is triggered, the viewport won't change its color
+    }
 
-		if (getTabWidget())
-			getTabWidget()->showTabs(true);
-
-		update();	// if no resize is triggered, the viewport won't change its color
-	}
-
-	if (getTabWidget()->getViewPort())
-		getTabWidget()->getViewPort()->setFullScreen(false);
+    if (getTabWidget()->getViewPort())
+        getTabWidget()->getViewPort()->setFullScreen(false);
 }
 
-void DkNoMacs::toggleDocks(bool hide) {
-
-	if (hide) {
-		showExplorer(false, false);
-		showMetaDataDock(false, false);
-		showEditDock(false, false);
-		showHistoryDock(false, false);
-		showLogDock(false, false);
-		DkToolBarManager::inst().show(false, false);
-		DkStatusBarManager::instance().show(false, false);
-	}
-	else {
-		restoreDocks();
-		DkToolBarManager::inst().restore();
-		DkStatusBarManager::instance().show(DkSettingsManager::param().app().showStatusBar, false);
-	}
+void DkNoMacs::toggleDocks(bool hide)
+{
+    if (hide) {
+        showExplorer(false, false);
+        showMetaDataDock(false, false);
+        showEditDock(false, false);
+        showHistoryDock(false, false);
+        showLogDock(false, false);
+        DkToolBarManager::inst().show(false, false);
+        DkStatusBarManager::instance().show(false, false);
+    } else {
+        restoreDocks();
+        DkToolBarManager::inst().restore();
+        DkStatusBarManager::instance().show(DkSettingsManager::param().app().showStatusBar, false);
+    }
 }
 
-void DkNoMacs::restoreDocks() {
-
-	showExplorer(DkDockWidget::testDisplaySettings(DkSettingsManager::param().app().showExplorer), false);
-	showMetaDataDock(DkDockWidget::testDisplaySettings(DkSettingsManager::param().app().showMetaDataDock), false);
-	showEditDock(DkDockWidget::testDisplaySettings(DkSettingsManager::param().app().showEditDock), false);
-	showHistoryDock(DkDockWidget::testDisplaySettings(DkSettingsManager::param().app().showHistoryDock), false);
-	showLogDock(DkDockWidget::testDisplaySettings(DkSettingsManager::param().app().showLogDock), false);
+void DkNoMacs::restoreDocks()
+{
+    showExplorer(DkDockWidget::testDisplaySettings(DkSettingsManager::param().app().showExplorer), false);
+    showMetaDataDock(DkDockWidget::testDisplaySettings(DkSettingsManager::param().app().showMetaDataDock), false);
+    showEditDock(DkDockWidget::testDisplaySettings(DkSettingsManager::param().app().showEditDock), false);
+    showHistoryDock(DkDockWidget::testDisplaySettings(DkSettingsManager::param().app().showHistoryDock), false);
+    showLogDock(DkDockWidget::testDisplaySettings(DkSettingsManager::param().app().showLogDock), false);
 }
 
-void DkNoMacs::restartFrameless(bool) {
+void DkNoMacs::restartFrameless(bool)
+{
+    QString exe = QApplication::applicationFilePath();
+    QStringList args;
 
-	QString exe = QApplication::applicationFilePath();
-	QStringList args;
+    if (objectName() != "DkNoMacsFrameless")
+        args << "-m"
+             << "frameless";
+    else
+        args << "-m"
+             << "default";
 
-	if (objectName() != "DkNoMacsFrameless")
-		args << "-m" << "frameless";
-	else
-		args << "-m" << "default";
+    if (getTabWidget()->getCurrentImage())
+        args.append(getTabWidget()->getCurrentImage()->filePath());
 
-	if (getTabWidget()->getCurrentImage())
-		args.append(getTabWidget()->getCurrentImage()->filePath());
-	
-	nmc::DkSettingsManager::param().save();
-	
-	bool started = mProcess.startDetached(exe, args);
+    nmc::DkSettingsManager::param().save();
 
-	// close me if the new instance started
-	if (started)
-		close();
+    bool started = mProcess.startDetached(exe, args);
 
-	qDebug() << "frameless arguments: " << args;
-}
-
-void DkNoMacs::showRecentFilesOnStartUp() {
+    // close me if the new instance started
+    if (started)
+        close();
 
-	QTimer::singleShot(100, getTabWidget(), SLOT(showRecentFiles()));
+    qDebug() << "frameless arguments: " << args;
 }
 
-void DkNoMacs::startPong() const {
+void DkNoMacs::showRecentFilesOnStartUp()
+{
+    QTimer::singleShot(100, getTabWidget(), SLOT(showRecentFiles()));
+}
 
-	QString exe = QApplication::applicationFilePath();
-	QStringList args;
+void DkNoMacs::startPong() const
+{
+    QString exe = QApplication::applicationFilePath();
+    QStringList args;
 
-	args.append("--pong");
+    args.append("--pong");
 
-	bool started = mProcess.startDetached(exe, args);
-	qDebug() << "pong started: " << started;
+    bool started = mProcess.startDetached(exe, args);
+    qDebug() << "pong started: " << started;
 }
 
-void DkNoMacs::fitFrame() {
+void DkNoMacs::fitFrame()
+{
+    if (!getTabWidget()->getViewPort())
+        return;
 
-	if (!getTabWidget()->getViewPort())
-		return;
+    auto vp = getTabWidget()->getViewPort();
 
-	auto vp = getTabWidget()->getViewPort();
+    QRectF viewRect = vp->getImageViewRect();
+    QRectF vpRect = vp->geometry();
+    QRectF nmRect = frameGeometry();
+    QSize frDiff = frameGeometry().size() - geometry().size();
 
-	QRectF viewRect = vp->getImageViewRect();
-	QRectF vpRect = vp->geometry();
-	QRectF nmRect = frameGeometry();
-	QSize frDiff = frameGeometry().size()-geometry().size();
+    // compute new size
+    QPointF c = nmRect.center();
+    nmRect.setSize(nmRect.size() + viewRect.size() - vpRect.size());
+    nmRect.moveCenter(c);
 
-	// compute new size
-	QPointF c = nmRect.center();
-	nmRect.setSize(nmRect.size() + viewRect.size() - vpRect.size());
-	nmRect.moveCenter(c);
-	
-	// still fits on screen?
-	QDesktopWidget* dw = QApplication::desktop();
-	QRect screenRect = dw->availableGeometry(this);
-	QRect newGeometry = screenRect.intersected(nmRect.toRect());
-	
-	// correct frame
-	newGeometry.setSize(newGeometry.size()-frDiff);
-	newGeometry.moveTopLeft(newGeometry.topLeft() - frameGeometry().topLeft()+geometry().topLeft());
+    // still fits on screen?
+    QScreen *sc = QApplication::primaryScreen();
+    QRect screenRect = sc->availableGeometry();
+    QRect newGeometry = screenRect.intersected(nmRect.toRect());
 
-	setGeometry(newGeometry);
+    // correct frame
+    newGeometry.setSize(newGeometry.size() - frDiff);
+    newGeometry.moveTopLeft(newGeometry.topLeft() - frameGeometry().topLeft() + geometry().topLeft());
 
-	// reset viewport if we did not clip -> compensates round-off errors
-	if (screenRect.contains(nmRect.toRect()))
-		vp->resetView();
+    setGeometry(newGeometry);
 
+    // reset viewport if we did not clip -> compensates round-off errors
+    if (screenRect.contains(nmRect.toRect()))
+        vp->resetView();
 }
 
-void DkNoMacs::setRecursiveScan(bool recursive) {
+void DkNoMacs::setRecursiveScan(bool recursive)
+{
+    DkSettingsManager::param().global().scanSubFolders = recursive;
 
-	DkSettingsManager::param().global().scanSubFolders = recursive;
+    QSharedPointer<DkImageLoader> loader = getTabWidget()->getCurrentImageLoader();
 
-	QSharedPointer<DkImageLoader> loader = getTabWidget()->getCurrentImageLoader();
-	
-	if (!loader)
-		return;
+    if (!loader)
+        return;
 
-	if (recursive)
-		getTabWidget()->setInfo(tr("Recursive Folder Scan is Now Enabled"));
-	else
-		getTabWidget()->setInfo(tr("Recursive Folder Scan is Now Disabled"));
+    if (recursive)
+        getTabWidget()->setInfo(tr("Recursive Folder Scan is Now Enabled"));
+    else
+        getTabWidget()->setInfo(tr("Recursive Folder Scan is Now Disabled"));
 
-	loader->updateSubFolders(loader->getDirPath());
+    loader->updateSubFolders(loader->getDirPath());
 }
 
-void DkNoMacs::showOpacityDialog() {
+void DkNoMacs::showOpacityDialog()
+{
+    if (!mOpacityDialog) {
+        mOpacityDialog = new DkOpacityDialog(this);
+        mOpacityDialog->setWindowTitle(tr("Change Opacity"));
+    }
 
-	if (!mOpacityDialog) {
-		mOpacityDialog = new DkOpacityDialog(this);
-		mOpacityDialog->setWindowTitle(tr("Change Opacity"));
-	}
-	
-	if (mOpacityDialog->exec())
-		setWindowOpacity(mOpacityDialog->value()/100.0f);
+    if (mOpacityDialog->exec())
+        setWindowOpacity(mOpacityDialog->value() / 100.0f);
 }
 
-void DkNoMacs::opacityDown() {
-
-	changeOpacity(-0.3f);
+void DkNoMacs::opacityDown()
+{
+    changeOpacity(-0.3f);
 }
 
-void DkNoMacs::opacityUp() {
-	
-	changeOpacity(0.3f);
+void DkNoMacs::opacityUp()
+{
+    changeOpacity(0.3f);
 }
 
-void DkNoMacs::changeOpacity(float change) {
-
-	float newO = (float)windowOpacity() + change;
-	if (newO > 1) newO = 1.0f;
-	if (newO < 0.1) newO = 0.1f;
-	setWindowOpacity(newO);
+void DkNoMacs::changeOpacity(float change)
+{
+    float newO = (float)windowOpacity() + change;
+    if (newO > 1)
+        newO = 1.0f;
+    if (newO < 0.1)
+        newO = 0.1f;
+    setWindowOpacity(newO);
 }
 
-void DkNoMacs::animateOpacityDown() {
+void DkNoMacs::animateOpacityDown()
+{
+    float newO = (float)windowOpacity() - 0.03f;
 
-	float newO = (float)windowOpacity() - 0.03f;
+    if (newO < 0.3f) {
+        setWindowOpacity(0.3f);
+        return;
+    }
 
-	if (newO < 0.3f) {
-		setWindowOpacity(0.3f);
-		return;
-	}
-
-	setWindowOpacity(newO);
-	QTimer::singleShot(20, this, SLOT(animateOpacityDown()));
+    setWindowOpacity(newO);
+    QTimer::singleShot(20, this, SLOT(animateOpacityDown()));
 }
 
-void DkNoMacs::animateOpacityUp() {
-
-	float newO = (float)windowOpacity() + 0.03f;
+void DkNoMacs::animateOpacityUp()
+{
+    float newO = (float)windowOpacity() + 0.03f;
 
-	if (newO > 1.0f) {
-		setWindowOpacity(1.0f);
-		return;
-	}
+    if (newO > 1.0f) {
+        setWindowOpacity(1.0f);
+        return;
+    }
 
-	setWindowOpacity(newO);
-	QTimer::singleShot(20, this, SLOT(animateOpacityUp()));
+    setWindowOpacity(newO);
+    QTimer::singleShot(20, this, SLOT(animateOpacityUp()));
 }
 
 // >DIR: diem - why can't we put it in mViewport?
-void DkNoMacs::animateChangeOpacity() {
+void DkNoMacs::animateChangeOpacity()
+{
+    float newO = (float)windowOpacity();
 
-	float newO = (float)windowOpacity();
-
-	if (newO >= 1.0f)
-		animateOpacityDown();
-	else
-		animateOpacityUp();
+    if (newO >= 1.0f)
+        animateOpacityDown();
+    else
+        animateOpacityUp();
 }
 
-void DkNoMacs::lockWindow(bool lock) {
-
-	
+void DkNoMacs::lockWindow(bool lock)
+{
 #ifdef Q_OS_WIN
-	
-	qDebug() << "locking: " << lock;
-
-	if (lock) {
-		//setAttribute(Qt::WA_TransparentForMouseEvents);
-		HWND hwnd = (HWND) winId(); // get handle of the widget
-		LONG styles = GetWindowLong(hwnd, GWL_EXSTYLE);
-		SetWindowLong(hwnd, GWL_EXSTYLE, styles | WS_EX_TRANSPARENT); 
-		SetWindowPos((HWND)this->winId(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
-		
-		auto keyStr = DkActionManager::instance().action(DkActionManager::menu_view_lock_window)->shortcut().toString();
-		getTabWidget()->setInfo(tr("Window Locked\nTo unlock: gain focus (ALT+Tab),\nthen press %1")
-			.arg(keyStr));
-	}
-	else if (lock && windowOpacity() == 1.0f) {
-		getTabWidget()->setInfo(tr("You should first reduce opacity\n before working through the window."));
-		DkActionManager::instance().action(DkActionManager::menu_view_lock_window)->setChecked(false);
-	}
-	else {
-		qDebug() << "deactivating...";
-		HWND hwnd = (HWND) winId(); // get handle of the widget
-		LONG styles = GetWindowLong(hwnd, GWL_EXSTYLE);
-		SetWindowLong(hwnd, GWL_EXSTYLE, styles & ~WS_EX_TRANSPARENT); 
-
-		SetWindowPos((HWND)this->winId(), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
-	}
+
+    qDebug() << "locking: " << lock;
+
+    if (lock) {
+        // setAttribute(Qt::WA_TransparentForMouseEvents);
+        HWND hwnd = (HWND)winId(); // get handle of the widget
+        LONG styles = GetWindowLong(hwnd, GWL_EXSTYLE);
+        SetWindowLong(hwnd, GWL_EXSTYLE, styles | WS_EX_TRANSPARENT);
+        SetWindowPos((HWND)this->winId(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+
+        auto keyStr = DkActionManager::instance().action(DkActionManager::menu_view_lock_window)->shortcut().toString();
+        getTabWidget()->setInfo(tr("Window Locked\nTo unlock: gain focus (ALT+Tab),\nthen press %1").arg(keyStr));
+    } else if (lock && windowOpacity() == 1.0f) {
+        getTabWidget()->setInfo(tr("You should first reduce opacity\n before working through the window."));
+        DkActionManager::instance().action(DkActionManager::menu_view_lock_window)->setChecked(false);
+    } else {
+        qDebug() << "deactivating...";
+        HWND hwnd = (HWND)winId(); // get handle of the widget
+        LONG styles = GetWindowLong(hwnd, GWL_EXSTYLE);
+        SetWindowLong(hwnd, GWL_EXSTYLE, styles & ~WS_EX_TRANSPARENT);
+
+        SetWindowPos((HWND)this->winId(), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+    }
 #else
-	// TODO: find corresponding command for linux etc
+    // TODO: find corresponding command for linux etc
 
-	//setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
-	//show();
+    // setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
+    // show();
 #endif
 }
 
-void DkNoMacs::newClientConnected(bool connected) {
-	
-	mOverlaid = false;
-	// add methods if clients are connected
-
-	DkActionManager& am = DkActionManager::instance();
-	am.action(DkActionManager::menu_sync_view)->setEnabled(connected);
-	am.action(DkActionManager::menu_sync_pos)->setEnabled(connected);
-	am.action(DkActionManager::menu_sync_arrange)->setEnabled(connected);
+void DkNoMacs::newClientConnected(bool connected)
+{
+    mOverlaid = false;
+    // add methods if clients are connected
 
+    DkActionManager &am = DkActionManager::instance();
+    am.action(DkActionManager::menu_sync_view)->setEnabled(connected);
+    am.action(DkActionManager::menu_sync_pos)->setEnabled(connected);
+    am.action(DkActionManager::menu_sync_arrange)->setEnabled(connected);
 }
 
-void DkNoMacs::tcpSetWindowRect(QRect newRect, bool opacity, bool overlaid) {
-
-	this->mOverlaid = overlaid;
-
-	// we are currently overlaid...
-	if (!overlaid) {
-
-		setGeometry(mOldGeometry);
-		if (opacity)
-			animateOpacityUp();
-		mOldGeometry = geometry();
-	}
-	else {
+void DkNoMacs::tcpSetWindowRect(QRect newRect, bool opacity, bool overlaid)
+{
+    this->mOverlaid = overlaid;
 
+    // we are currently overlaid...
+    if (!overlaid) {
+        setGeometry(mOldGeometry);
+        if (opacity)
+            animateOpacityUp();
+        mOldGeometry = geometry();
+    } else {
 #ifdef Q_OS_WIN
-		showMinimized();
-		setWindowState(Qt::WindowActive);
+        showMinimized();
+        setWindowState(Qt::WindowActive);
 #else
-		Qt::WindowFlags flags = windowFlags();
-		setWindowFlags(Qt::WindowStaysOnTopHint);	// we need this to 'generally' (for all OSs) bring the window to front
-		setWindowFlags(flags);	// reset flags
-		showNormal();
+        Qt::WindowFlags flags = windowFlags();
+        setWindowFlags(Qt::WindowStaysOnTopHint); // we need this to 'generally' (for all OSs) bring the window to front
+        setWindowFlags(flags); // reset flags
+        showNormal();
 #endif
 
-		mOldGeometry = geometry();
-		
-		this->move(newRect.topLeft());
-		this->resize(newRect.size() - (frameGeometry().size() - geometry().size()));
-
-		//setGeometry(newRect);
-		if (opacity)
-			animateOpacityDown();
-		
-		//this->setActiveWindow();
-	}
-}
-
-void DkNoMacs::tcpSendWindowRect() {
-
-	mOverlaid = !mOverlaid;
+        mOldGeometry = geometry();
 
-	qDebug() << "overlaying";
-	// change my geometry
-	tcpSetWindowRect(this->frameGeometry(), !mOverlaid, mOverlaid);
+        this->move(newRect.topLeft());
+        this->resize(newRect.size() - (frameGeometry().size() - geometry().size()));
 
+        // setGeometry(newRect);
+        if (opacity)
+            animateOpacityDown();
 
-	auto cm = DkSyncManager::inst().client();
-	if (cm)
-		cm->sendPosition(frameGeometry(), mOverlaid);
+        // this->setActiveWindow();
+    }
 }
 
-void DkNoMacs::tcpSendArrange() {
-	
-	mOverlaid = !mOverlaid;
-	emit sendArrangeSignal(mOverlaid);
-}
-
-void DkNoMacs::showExplorer(bool show, bool saveSettings) {
-
-	if (!show && !mExplorer)
-		return;
-
-	if (!mExplorer) {
-
-		// get last location
-		mExplorer = new DkBrowseExplorer(tr("File Explorer"));
-		mExplorer->registerAction(DkActionManager::instance().action(DkActionManager::menu_panel_explorer));
-		mExplorer->setDisplaySettings(&DkSettingsManager::param().app().showExplorer);
-		addDockWidget(mExplorer->getDockLocationSettings(Qt::LeftDockWidgetArea), mExplorer);
-
-		connect(mExplorer, SIGNAL(openFile(const QString&)), getTabWidget(), SLOT(loadFile(const QString&)));
-		connect(mExplorer, SIGNAL(openDir(const QString&)), getTabWidget(), SLOT(loadDirToTab(const QString&)));
-		connect(getTabWidget(), SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)), mExplorer, SLOT(setCurrentImage(QSharedPointer<DkImageContainerT>)));
-	}
-
-	mExplorer->setVisible(show, saveSettings);
+void DkNoMacs::tcpSendWindowRect()
+{
+    mOverlaid = !mOverlaid;
 
-	if (getTabWidget()->getCurrentImage() && QFileInfo(getTabWidget()->getCurrentFilePath()).exists()) {
-		mExplorer->setCurrentPath(getTabWidget()->getCurrentFilePath());
-	}
-	else {
-		QStringList folders = DkSettingsManager::param().global().recentFiles;
+    qDebug() << "overlaying";
+    // change my geometry
+    tcpSetWindowRect(this->frameGeometry(), !mOverlaid, mOverlaid);
 
-		if (folders.size() > 0)
-			mExplorer->setCurrentPath(folders[0]);
-	}
+    auto cm = DkSyncManager::inst().client();
+    if (cm)
+        cm->sendPosition(frameGeometry(), mOverlaid);
 }
 
-void DkNoMacs::showMetaDataDock(bool show, bool saveSettings) {
-
-	if (!show && !mMetaDataDock)
-		return;
-
-	if (!mMetaDataDock) {
-
-		mMetaDataDock = new DkMetaDataDock(tr("Meta Data Info"), this);
-		mMetaDataDock->registerAction(DkActionManager::instance().action(DkActionManager::menu_panel_metadata_dock));
-		mMetaDataDock->setDisplaySettings(&DkSettingsManager::param().app().showMetaDataDock);
-		addDockWidget(mMetaDataDock->getDockLocationSettings(Qt::RightDockWidgetArea), mMetaDataDock);
-
-		connect(getTabWidget(), SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)), mMetaDataDock, SLOT(setImage(QSharedPointer<DkImageContainerT>)));
-	}
-
-	mMetaDataDock->setVisible(show, saveSettings);
-
-	if (getTabWidget()->getCurrentImage())
-		mMetaDataDock->setImage(getTabWidget()->getCurrentImage());
-}
-
-void DkNoMacs::showEditDock(bool show, bool saveSettings) {
-
-	if (!show && !mEditDock)
-		return;
-
-	if (!mEditDock) {
-
-		mEditDock = new DkEditDock(tr("Edit Image"), this);
-		mEditDock->registerAction(DkActionManager::instance().action(DkActionManager::menu_edit_image));
-		mEditDock->setDisplaySettings(&DkSettingsManager::param().app().showEditDock);
-		addDockWidget(mEditDock->getDockLocationSettings(Qt::RightDockWidgetArea), mEditDock);
-
-		connect(getTabWidget(), SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)), mEditDock, SLOT(setImage(QSharedPointer<DkImageContainerT>)));
-	}
-
-	mEditDock->setVisible(show, saveSettings);
-
-	if (getTabWidget()->getCurrentImage())
-		mEditDock->setImage(getTabWidget()->getCurrentImage());
+void DkNoMacs::tcpSendArrange()
+{
+    mOverlaid = !mOverlaid;
+    emit sendArrangeSignal(mOverlaid);
 }
 
-void DkNoMacs::showHistoryDock(bool show, bool saveSettings) {
+void DkNoMacs::showExplorer(bool show, bool saveSettings)
+{
+    if (!show && !mExplorer)
+        return;
 
-	if (!show && !mHistoryDock)
-		return;
-
-	if (!mHistoryDock) {
-
-		mHistoryDock = new DkHistoryDock(tr("History"), this);
-		mHistoryDock->registerAction(DkActionManager::instance().action(DkActionManager::menu_panel_history));
-		mHistoryDock->setDisplaySettings(&DkSettingsManager::param().app().showHistoryDock);
-		addDockWidget(mHistoryDock->getDockLocationSettings(Qt::RightDockWidgetArea), mHistoryDock);
-
-		connect(getTabWidget(), SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)), mHistoryDock, SLOT(updateImage(QSharedPointer<DkImageContainerT>)));
-	}
-
-	mHistoryDock->setVisible(show, saveSettings);
-
-	if (show && getTabWidget()->getCurrentImage())
-		mHistoryDock->updateImage(getTabWidget()->getCurrentImage());
-}
-
-void DkNoMacs::showLogDock(bool show, bool saveSettings) {
-
-	if (!show && !mLogDock)
-		return;
+    if (!mExplorer) {
+        // get last location
+#ifdef WIN32
+        // don't use the browse explorer on windows
+        // see #536
+        mExplorer = new DkExplorer(tr("File Explorer"));
+#else
+        mExplorer = new DkBrowseExplorer(tr("File Explorer"));
+#endif
+        mExplorer->registerAction(DkActionManager::instance().action(DkActionManager::menu_panel_explorer));
+        mExplorer->setDisplaySettings(&DkSettingsManager::param().app().showExplorer);
+        addDockWidget(mExplorer->getDockLocationSettings(Qt::LeftDockWidgetArea), mExplorer);
 
-	if (!mLogDock) {
+        connect(mExplorer, SIGNAL(openFile(const QString &)), getTabWidget(), SLOT(loadFile(const QString &)));
+        connect(mExplorer, SIGNAL(openDir(const QString &)), getTabWidget(), SLOT(loadDirToTab(const QString &)));
+        connect(getTabWidget(),
+                SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)),
+                mExplorer,
+                SLOT(setCurrentImage(QSharedPointer<DkImageContainerT>)));
+    }
 
-		// get last location
-		mLogDock = new DkLogDock(tr("Console"), this);
-		mLogDock->registerAction(DkActionManager::instance().action(DkActionManager::menu_panel_log));
-		mLogDock->setDisplaySettings(&DkSettingsManager::param().app().showLogDock);
-		addDockWidget(mLogDock->getDockLocationSettings(Qt::LeftDockWidgetArea), mLogDock);
-	}
+    mExplorer->setVisible(show, saveSettings);
 
-	mLogDock->setVisible(show, saveSettings);
-	qInfoClean() << QStringLiteral("Say \"Hi\" to ") << QApplication::applicationName() << " " << QApplication::applicationVersion();
+    if (getTabWidget()->getCurrentImage() && QFileInfo(getTabWidget()->getCurrentFilePath()).exists()) {
+        mExplorer->setCurrentPath(getTabWidget()->getCurrentFilePath());
+    } else {
+        QStringList folders = DkSettingsManager::param().global().recentFiles;
 
+        if (folders.size() > 0)
+            mExplorer->setCurrentPath(folders[0]);
+    }
 }
 
-void DkNoMacs::showThumbsDock(bool show) {
-	
-	if (!show && !mThumbsDock)
-		return;
-
-	// nothing todo here
-	if (mThumbsDock && mThumbsDock->isVisible() && show)
-		return;
-	
-	if (!getTabWidget()->getViewPort())
-		return;
-
-	auto vp = getTabWidget()->getViewPort();
-	int winPos = vp->getController()->getFilePreview()->getWindowPosition();
-
-	if (winPos != DkFilePreview::cm_pos_dock_hor && winPos != DkFilePreview::cm_pos_dock_ver) {
-		if (mThumbsDock) {
+void DkNoMacs::showMetaDataDock(bool show, bool saveSettings)
+{
+    if (!show && !mMetaDataDock)
+        return;
 
-			//DkSettingsManager::param().display().thumbDockSize = qMin(thumbsDock->width(), thumbsDock->height());
-			DefaultSettings settings;
-			settings.setValue("thumbsDockLocation", QMainWindow::dockWidgetArea(mThumbsDock));
+    if (!mMetaDataDock) {
+        mMetaDataDock = new DkMetaDataDock(tr("Meta Data Info"), this);
+        mMetaDataDock->registerAction(DkActionManager::instance().action(DkActionManager::menu_panel_metadata_dock));
+        mMetaDataDock->setDisplaySettings(&DkSettingsManager::param().app().showMetaDataDock);
+        addDockWidget(mMetaDataDock->getDockLocationSettings(Qt::RightDockWidgetArea), mMetaDataDock);
 
-			mThumbsDock->hide();
-			mThumbsDock->setWidget(0);
-			mThumbsDock->deleteLater();
-			mThumbsDock = 0;
-		}
-		return;
-	}
+        connect(getTabWidget(),
+                SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)),
+                mMetaDataDock,
+                SLOT(setImage(QSharedPointer<DkImageContainerT>)));
+    }
+
+    mMetaDataDock->setVisible(show, saveSettings);
+
+    if (getTabWidget()->getCurrentImage())
+        mMetaDataDock->setImage(getTabWidget()->getCurrentImage());
+}
+
+void DkNoMacs::showEditDock(bool show, bool saveSettings)
+{
+    if (!show && !mEditDock)
+        return;
+
+    if (!mEditDock) {
+        mEditDock = new DkEditDock(tr("Edit Image"), this);
+        mEditDock->registerAction(DkActionManager::instance().action(DkActionManager::menu_edit_image));
+        mEditDock->setDisplaySettings(&DkSettingsManager::param().app().showEditDock);
+        addDockWidget(mEditDock->getDockLocationSettings(Qt::RightDockWidgetArea), mEditDock);
 
-	if (!mThumbsDock) {
-		mThumbsDock = new DkDockWidget(tr("Thumbnails"), this);
-		mThumbsDock->registerAction(DkActionManager::instance().action(DkActionManager::menu_panel_preview));
-		mThumbsDock->setDisplaySettings(&DkSettingsManager::param().app().showFilePreview);
-		mThumbsDock->setWidget(vp->getController()->getFilePreview());
-		addDockWidget(mThumbsDock->getDockLocationSettings(Qt::TopDockWidgetArea), mThumbsDock);
-		thumbsDockAreaChanged();
+        connect(getTabWidget(), SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)), mEditDock, SLOT(setImage(QSharedPointer<DkImageContainerT>)));
+    }
+
+    mEditDock->setVisible(show, saveSettings);
 
-		QLabel* thumbsTitle = new QLabel(mThumbsDock);
-		thumbsTitle->setObjectName("thumbsTitle");
-		thumbsTitle->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
-		thumbsTitle->setPixmap(QPixmap(":/nomacs/img/widget-separator.png").scaled(QSize(16, 4)));
-		thumbsTitle->setFixedHeight(16);
-		mThumbsDock->setTitleBarWidget(thumbsTitle);
-
-		connect(mThumbsDock, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), this, SLOT(thumbsDockAreaChanged()));
-	}
-
-	if (show != mThumbsDock->isVisible())
-		mThumbsDock->setVisible(show);
+    if (getTabWidget()->getCurrentImage())
+        mEditDock->setImage(getTabWidget()->getCurrentImage());
 }
 
-void DkNoMacs::thumbsDockAreaChanged() {
+void DkNoMacs::showHistoryDock(bool show, bool saveSettings)
+{
+    if (!show && !mHistoryDock)
+        return;
 
-	Qt::DockWidgetArea area = dockWidgetArea(mThumbsDock);
+    if (!mHistoryDock) {
+        mHistoryDock = new DkHistoryDock(tr("History"), this);
+        mHistoryDock->registerAction(DkActionManager::instance().action(DkActionManager::menu_panel_history));
+        mHistoryDock->setDisplaySettings(&DkSettingsManager::param().app().showHistoryDock);
+        addDockWidget(mHistoryDock->getDockLocationSettings(Qt::RightDockWidgetArea), mHistoryDock);
 
-	int thumbsOrientation = DkFilePreview::cm_pos_dock_hor;
+        connect(getTabWidget(),
+                SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)),
+                mHistoryDock,
+                SLOT(updateImage(QSharedPointer<DkImageContainerT>)));
+    }
 
-	if (area == Qt::LeftDockWidgetArea || area == Qt::RightDockWidgetArea)
-		thumbsOrientation = DkFilePreview::cm_pos_dock_ver;
-
-	if (getTabWidget()->getViewPort())
-		getTabWidget()->getViewPort()->getController()->getFilePreview()->setWindowPosition(thumbsOrientation);
+    mHistoryDock->setVisible(show, saveSettings);
 
+    if (show && getTabWidget()->getCurrentImage())
+        mHistoryDock->updateImage(getTabWidget()->getCurrentImage());
 }
 
-void DkNoMacs::openDir() {
-
-	// load system default open dialog
-	QString dirName = QFileDialog::getExistingDirectory(
-		this, 
-		tr("Open an Image Directory"),
-		getTabWidget()->getCurrentDir(), 
-		QFileDialog::ShowDirsOnly | DkDialog::fileDialogOptions()
-	);
+void DkNoMacs::showLogDock(bool show, bool saveSettings)
+{
+    if (!show && !mLogDock)
+        return;
 
-	if (dirName.isEmpty())
-		return;
+    if (!mLogDock) {
+        // get last location
+        mLogDock = new DkLogDock(tr("Console"), this);
+        mLogDock->registerAction(DkActionManager::instance().action(DkActionManager::menu_panel_log));
+        mLogDock->setDisplaySettings(&DkSettingsManager::param().app().showLogDock);
+        addDockWidget(mLogDock->getDockLocationSettings(Qt::LeftDockWidgetArea), mLogDock);
+    }
 
-	getTabWidget()->loadDirToTab(dirName);
+    mLogDock->setVisible(show, saveSettings);
+    qInfoClean() << QStringLiteral("Say \"Hi\" to ") << QApplication::applicationName() << " " << QApplication::applicationVersion();
 }
 
-void DkNoMacs::openFile() {
-
-	QStringList openFilters = DkSettingsManager::param().app().openFilters;
-	openFilters.pop_front();
-	openFilters.prepend(tr("All Files (*.*)"));
-
-	// load system default open dialog
-	QStringList filePaths = QFileDialog::getOpenFileNames(
-		this,
-		tr("Open Image"),
-		getTabWidget()->getCurrentDir(),
-		openFilters.join(";;"),
-		nullptr,
-		DkDialog::fileDialogOptions()
-	);
-
-	if (filePaths.isEmpty())
-		return;
-
-	int count = getTabWidget()->getTabs().count(); // Save current count of tabs for setting tab position later
-	if (getTabWidget()->getTabs().at(0)->getMode() == DkTabInfo::tab_empty)
-		count = 0; 
-		
-	QSet<QString> duplicates;
-	for (const QString& fp : filePaths) {
-		bool dup = false;
+void DkNoMacs::showThumbsDock(bool show)
+{
+    if (!show && !mThumbsDock)
+        return;
 
-		if (DkSettingsManager::param().global().checkOpenDuplicates) { // Should we check for duplicates?
-			for (auto tab : getTabWidget()->getTabs()) {
-				if (tab->getFilePath().compare(fp) == 0) {
-					duplicates.insert(tab->getFilePath());
-					dup = true;
-					break;
-				}
-			}
-		}
-
-		if (!dup) {
-
-			// > 1: only open in tab if more than one file is opened
-			bool newTab = filePaths.size() > 1 | getTabWidget()->getTabs().size() > 1;
-			getTabWidget()->loadFile(fp, newTab);
-		}
-	}
-	if (duplicates.count() > 0) { // Show message if at least one duplicate was found
-		QString duptext = tr("The following duplicates were not opened:");
-		for (auto dup : duplicates) {
-			duptext.append("\n" + dup);
-		}
-		getTabWidget()->getViewPort()->getController()->setInfo(duptext);
-	}
-
-	if (filePaths.count() > duplicates.count()) // Only set the active tab if there is actually something added
-		getTabWidget()->setActiveTab(count); // Set first file opened to be the active tab
-}
-
-void DkNoMacs::openFileList() {
-	
-	QStringList openFilters;
-	openFilters.append(tr("Text file (*.txt)"));
-	openFilters.append(tr("All files (*.*)"));
+    // nothing todo here
+    if (mThumbsDock && mThumbsDock->isVisible() && show)
+        return;
 
-	// load system default open dialog
-	QString fileName = QFileDialog::getOpenFileName(
-		this, 
-		tr("Open Image"),
-		getTabWidget()->getCurrentDir(),
-		openFilters.join(";;"),
-		nullptr,
-		DkDialog::fileDialogOptions()
-	);
+    if (!getTabWidget()->getViewPort())
+        return;
 
-	if (fileName.isEmpty())
-		return;
+    auto vp = getTabWidget()->getViewPort();
+    int winPos = vp->getController()->getFilePreview()->getWindowPosition();
 
-	int count = getTabWidget()->getTabs().count();
-	if (getTabWidget()->getTabs().at(0)->getMode() == DkTabInfo::tab_empty)
-		count = 0;
+    if (winPos != DkFilePreview::cm_pos_dock_hor && winPos != DkFilePreview::cm_pos_dock_ver) {
+        if (mThumbsDock) {
+            // DkSettingsManager::param().display().thumbDockSize = qMin(thumbsDock->width(), thumbsDock->height());
+            DefaultSettings settings;
+            settings.setValue("thumbsDockLocation", QMainWindow::dockWidgetArea(mThumbsDock));
+
+            mThumbsDock->hide();
+            mThumbsDock->setWidget(0);
+            mThumbsDock->deleteLater();
+            mThumbsDock = 0;
+        }
+        return;
+    }
+
+    if (!mThumbsDock) {
+        mThumbsDock = new DkDockWidget(tr("Thumbnails"), this);
+        mThumbsDock->registerAction(DkActionManager::instance().action(DkActionManager::menu_panel_preview));
+        mThumbsDock->setDisplaySettings(&DkSettingsManager::param().app().showFilePreview);
+        mThumbsDock->setWidget(vp->getController()->getFilePreview());
+        addDockWidget(mThumbsDock->getDockLocationSettings(Qt::TopDockWidgetArea), mThumbsDock);
+        thumbsDockAreaChanged();
+
+        QLabel *thumbsTitle = new QLabel(mThumbsDock);
+        thumbsTitle->setObjectName("thumbsTitle");
+        thumbsTitle->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
+        thumbsTitle->setPixmap(QPixmap(":/nomacs/img/widget-separator.png").scaled(QSize(16, 4)));
+        thumbsTitle->setFixedHeight(16);
+        mThumbsDock->setTitleBarWidget(thumbsTitle);
+
+        connect(mThumbsDock, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), this, SLOT(thumbsDockAreaChanged()));
+    }
+
+    if (show != mThumbsDock->isVisible())
+        mThumbsDock->setVisible(show);
+}
+
+void DkNoMacs::thumbsDockAreaChanged()
+{
+    Qt::DockWidgetArea area = dockWidgetArea(mThumbsDock);
+
+    int thumbsOrientation = DkFilePreview::cm_pos_dock_hor;
+
+    if (area == Qt::LeftDockWidgetArea || area == Qt::RightDockWidgetArea)
+        thumbsOrientation = DkFilePreview::cm_pos_dock_ver;
+
+    if (getTabWidget()->getViewPort())
+        getTabWidget()->getViewPort()->getController()->getFilePreview()->setWindowPosition(thumbsOrientation);
+}
+
+void DkNoMacs::openDir()
+{
+    // load system default open dialog
+    QString dirName = QFileDialog::getExistingDirectory(this,
+                                                        tr("Open an Image Directory"),
+                                                        getTabWidget()->getCurrentDir(),
+                                                        QFileDialog::ShowDirsOnly | DkDialog::fileDialogOptions());
+
+    if (dirName.isEmpty())
+        return;
+
+    getTabWidget()->loadDirToTab(dirName);
+}
+
+void DkNoMacs::openFile()
+{
+    QStringList openFilters = DkSettingsManager::param().app().openFilters;
+    openFilters.pop_front();
+    openFilters.prepend(tr("All Files (*.*)"));
+
+    // load system default open dialog
+    QStringList filePaths =
+        QFileDialog::getOpenFileNames(this, tr("Open Image"), getTabWidget()->getCurrentDir(), openFilters.join(";;"), nullptr, DkDialog::fileDialogOptions());
+
+    if (filePaths.isEmpty())
+        return;
+
+    int count = getTabWidget()->getTabs().count(); // Save current count of tabs for setting tab position later
+    if (getTabWidget()->getTabs().at(0)->getMode() == DkTabInfo::tab_empty)
+        count = 0;
+
+    QSet<QString> duplicates;
+    for (const QString &fp : filePaths) {
+        bool dup = false;
 
-	QFile file(fileName);
-	if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
-		return;
-
-	while (!file.atEnd()) {
-		QString line = file.readLine().simplified();
-		if (QFileInfo::exists(line)) {
-			getTabWidget()->loadFile(line, true);
-		}
-	}
-
-	getTabWidget()->setActiveTab(count);
-}
-
-void DkNoMacs::saveFileList() {
-
-	QStringList saveFilters;
-	saveFilters.append(tr("Text file (*.txt)"));
-	saveFilters.append(tr("All files (*.*)"));
-
-	QString fileName = QFileDialog::getSaveFileName(
-		this, 
-		tr("Save Tab List"),
-		getTabWidget()->getCurrentDir(),
-		saveFilters.join(";;"),
-		nullptr,
-		DkDialog::fileDialogOptions()
-	);
-
-	if (fileName.isEmpty())
-		return;
-
-	QFile file(fileName);
-	if (!file.open(QIODevice::ReadWrite | QIODevice::Text | QIODevice::Truncate))
-		return;
-
-	for (auto tab : getTabWidget()->getTabs()) {
-		file.write(tab->getFilePath().toUtf8()+"\n");
-	}
-
-	file.close();
-}
-
-void DkNoMacs::openQuickLaunch() {
-
-	DkMainToolBar* tb = DkToolBarManager::inst().defaultToolBar();
-
-	// create new model
-	if (!mQuickAccess) {
-		mQuickAccess = new DkQuickAccess(this);
-		
-		// add all actions
-		mQuickAccess->addActions(DkActionManager::instance().allActions());
-		
-		connect(mQuickAccess, SIGNAL(loadFileSignal(const QString&)), getTabWidget(), SLOT(loadFile(const QString&)));
-	}
+        if (DkSettingsManager::param().global().checkOpenDuplicates) { // Should we check for duplicates?
+            for (auto tab : getTabWidget()->getTabs()) {
+                if (tab->getFilePath().compare(fp) == 0) {
+                    duplicates.insert(tab->getFilePath());
+                    dup = true;
+                    break;
+                }
+            }
+        }
+
+        if (!dup) {
+            // > 1: only open in tab if more than one file is opened
+            bool newTab = filePaths.size() > 1 | getTabWidget()->getTabs().size() > 1;
+            getTabWidget()->loadFile(fp, newTab);
+        }
+    }
+    if (duplicates.count() > 0) { // Show message if at least one duplicate was found
+        QString duptext = tr("The following duplicates were not opened:");
+        for (auto dup : duplicates) {
+            duptext.append("\n" + dup);
+        }
+        getTabWidget()->getViewPort()->getController()->setInfo(duptext);
+    }
+
+    if (filePaths.count() > duplicates.count()) // Only set the active tab if there is actually something added
+        getTabWidget()->setActiveTab(count); // Set first file opened to be the active tab
+}
+
+void DkNoMacs::openFileList()
+{
+    QStringList openFilters;
+    openFilters.append(tr("Text file (*.txt)"));
+    openFilters.append(tr("All files (*.*)"));
 
-	if (tb)
-		connect(tb->getQuickAccess(), SIGNAL(executeSignal(const QString&)), mQuickAccess, SLOT(execute(const QString&)), Qt::UniqueConnection);
+    // load system default open dialog
+    QString fileName =
+        QFileDialog::getOpenFileName(this, tr("Open Image"), getTabWidget()->getCurrentDir(), openFilters.join(";;"), nullptr, DkDialog::fileDialogOptions());
 
-	mQuickAccess->addDirs(DkSettingsManager::param().global().recentFolders);
-	mQuickAccess->addFiles(DkSettingsManager::param().global().recentFiles);
-
-	if (tb && tb->isVisible())
-		tb->setQuickAccessModel(mQuickAccess->getModel());
-	else {
-		
-		if (!mQuickAccessEdit) {
-			mQuickAccessEdit = new DkQuickAccessEdit(this);
-			connect(mQuickAccessEdit, SIGNAL(executeSignal(const QString&)), mQuickAccess, SLOT(execute(const QString&)));
-		}
-
-		int right = getTabWidget()->geometry().right();
-		mQuickAccessEdit->setFixedWidth(qRound(width()/3.0f));
-		mQuickAccessEdit->move(QPoint(right-mQuickAccessEdit->width()-10, qRound(height()*0.25)));
-		mQuickAccessEdit->setModel(mQuickAccess->getModel());
-		mQuickAccessEdit->show();
-	}
-}
+    if (fileName.isEmpty())
+        return;
 
-void DkNoMacs::loadFile(const QString& filePath) {
+    int count = getTabWidget()->getTabs().count();
+    if (getTabWidget()->getTabs().at(0)->getMode() == DkTabInfo::tab_empty)
+        count = 0;
 
-	if (!getTabWidget())
-		return;
+    QFile file(fileName);
+    if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
+        return;
 
-	if (QFileInfo(filePath).isDir())
-		getTabWidget()->loadDirToTab(filePath);
-	else
-		getTabWidget()->loadFile(filePath, false);
+    while (!file.atEnd()) {
+        QString line = file.readLine().simplified();
+        if (QFileInfo::exists(line)) {
+            getTabWidget()->loadFile(line, true);
+        }
+    }
 
+    getTabWidget()->setActiveTab(count);
 }
 
-// TODO: move this
-void DkNoMacs::renameFile() {
-
-	// TODO:ref move!
-	QString filePath = getTabWidget()->getCurrentFilePath();
-	QFileInfo file(filePath);
-
-	if (!file.absoluteDir().exists()) {
-		getTabWidget()->setInfo(tr("Sorry, the directory: %1 does not exist\n").arg(file.absolutePath()));
-		return;
-	}
-	if (file.exists() && !file.isWritable()) {
-		getTabWidget()->setInfo(tr("Sorry, I can't write to the fileInfo: %1").arg(file.fileName()));
-		return;
-	}
-
-	QString fileName = file.fileName();
-	int dotIdx = fileName.lastIndexOf(".");
-	QString baseName = dotIdx != -1 ? fileName.left(dotIdx) : fileName;
-
-	bool ok = false;
-	QString newFileName = QInputDialog::getText(this, baseName, tr("Rename:"), QLineEdit::Normal, baseName, &ok);
-
-	if (ok && !newFileName.isEmpty() && newFileName != baseName) {
-		
-		if (!file.suffix().isEmpty())
-			newFileName.append("." + file.suffix());
-		
-		qDebug() << "renaming: " << file.fileName() << " -> " << newFileName;
-		QFileInfo renamedFile = QFileInfo(file.absoluteDir(), newFileName);
-
-		// overwrite file?
-		// the second comparison is important for windows (case insensitive filenames)
-		if (renamedFile.exists() && renamedFile.absoluteFilePath().compare(file.absoluteFilePath(), Qt::CaseInsensitive) != 0) {
-
-			QMessageBox infoDialog(this);
-			infoDialog.setWindowTitle(tr("Question"));
-			infoDialog.setText(tr("The fileInfo: %1  already exists.\n Do you want to replace it?").arg(newFileName));
-			infoDialog.setIcon(QMessageBox::Question);
-			infoDialog.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
-			infoDialog.setDefaultButton(QMessageBox::No);
-			infoDialog.show();
-			int choice = infoDialog.exec();
-
-			if (choice == QMessageBox::Yes) {
-
-				QFile oldFile(renamedFile.absoluteFilePath());
-				bool removed = oldFile.remove();
-
-				// tell user that deleting went wrong, and stop the renaming
-				if (!removed) {
-					getTabWidget()->setInfo(tr("Sorry, I can't delete: %1").arg(file.fileName()));
-					return;
-				}
-			}
-			else
-				return;		// cancel renaming
-		}
+void DkNoMacs::saveFileList()
+{
+    QStringList saveFilters;
+    saveFilters.append(tr("Text file (*.txt)"));
+    saveFilters.append(tr("All files (*.*)"));
+
+    QString fileName = QFileDialog::getSaveFileName(this,
+                                                    tr("Save Tab List"),
+                                                    getTabWidget()->getCurrentDir(),
+                                                    saveFilters.join(";;"),
+                                                    nullptr,
+                                                    DkDialog::fileDialogOptions());
 
-		if (getTabWidget()->getViewPort())
-			getTabWidget()->getViewPort()->unloadImage();
+    if (fileName.isEmpty())
+        return;
 
-		QFile newFile(file.absoluteFilePath());
-		bool renamed = newFile.rename(renamedFile.absoluteFilePath());
-		
-		// tell user that deleting went wrong, and stop the renaming
-		if (!renamed)
-			getTabWidget()->setInfo(tr("Sorry, I can't rename: %1").arg(file.fileName()));
-		else if (DkSettingsManager::param().resources().loadSavedImage == DkSettings::ls_load)
-			getTabWidget()->loadFile(renamedFile.absoluteFilePath());
-		else if (getTabWidget()->getViewPort())
-			getTabWidget()->getViewPort()->loadNextFileFast();
+    QFile file(fileName);
+    if (!file.open(QIODevice::ReadWrite | QIODevice::Text | QIODevice::Truncate))
+        return;
+
+    for (auto tab : getTabWidget()->getTabs()) {
+        file.write(tab->getFilePath().toUtf8() + "\n");
+    }
+
+    file.close();
+}
+
+void DkNoMacs::openQuickLaunch()
+{
+    DkMainToolBar *tb = DkToolBarManager::inst().defaultToolBar();
+
+    // create new model
+    if (!mQuickAccess) {
+        mQuickAccess = new DkQuickAccess(this);
+
+        // add all actions
+        mQuickAccess->addActions(DkActionManager::instance().allActions());
+
+        connect(mQuickAccess, SIGNAL(loadFileSignal(const QString &)), getTabWidget(), SLOT(loadFile(const QString &)));
+    }
+
+    if (tb)
+        connect(tb->getQuickAccess(), SIGNAL(executeSignal(const QString &)), mQuickAccess, SLOT(execute(const QString &)), Qt::UniqueConnection);
+
+    mQuickAccess->addDirs(DkSettingsManager::param().global().recentFolders);
+    mQuickAccess->addFiles(DkSettingsManager::param().global().recentFiles);
+
+    if (tb && tb->isVisible())
+        tb->setQuickAccessModel(mQuickAccess->getModel());
+    else {
+        if (!mQuickAccessEdit) {
+            mQuickAccessEdit = new DkQuickAccessEdit(this);
+            connect(mQuickAccessEdit, SIGNAL(executeSignal(const QString &)), mQuickAccess, SLOT(execute(const QString &)));
+        }
 
-	}
+        int right = getTabWidget()->geometry().right();
+        mQuickAccessEdit->setFixedWidth(qRound(width() / 3.0f));
+        mQuickAccessEdit->move(QPoint(right - mQuickAccessEdit->width() - 10, qRound(height() * 0.25)));
+        mQuickAccessEdit->setModel(mQuickAccess->getModel());
+        mQuickAccessEdit->show();
+    }
 }
 
-void DkNoMacs::find(bool filterAction) {
-
-	if (!getTabWidget()->getCurrentImageLoader())
-		return;
-
-	if (filterAction) {
-
-		int db = (QObject::sender() == DkActionManager::instance().action(DkActionManager::menu_tools_filter)) ? DkSearchDialog::filter_button : DkSearchDialog::find_button;
-		
-		qDebug() << "default button: " << db;
-		DkSearchDialog* searchDialog = new DkSearchDialog(this);
-		searchDialog->setDefaultButton(db);
-
-		searchDialog->setFiles(getTabWidget()->getCurrentImageLoader()->getFileNames());
-		searchDialog->setPath(getTabWidget()->getCurrentImageLoader()->getDirPath());
-
-		connect(searchDialog, SIGNAL(filterSignal(const QString&)), getTabWidget()->getCurrentImageLoader().data(), SLOT(setFolderFilter(const QString&)));
-		connect(searchDialog, SIGNAL(loadFileSignal(const QString&)), getTabWidget(), SLOT(loadFile(const QString&)));
-		int answer = searchDialog->exec();
-
-		DkActionManager::instance().action(DkActionManager::menu_tools_filter)->setChecked(answer == DkSearchDialog::filter_button);		
-	}
-	else {
-		// remove the filter 
-		getTabWidget()->getCurrentImageLoader()->setFolderFilter(QString());
-	}
+void DkNoMacs::loadFile(const QString &filePath)
+{
+    if (!getTabWidget())
+        return;
 
+    if (QFileInfo(filePath).isDir())
+        getTabWidget()->loadDirToTab(filePath);
+    else
+        getTabWidget()->loadFile(filePath, false);
 }
 
-void DkNoMacs::changeSorting(bool change) {
-
-	// TODO: move to image loader?!
-
-	if (change) {
-	
-		QString senderName = QObject::sender()->objectName();
-
-		if (senderName == "menu_sort_filename")
-			DkSettingsManager::param().global().sortMode = DkSettings::sort_filename;
-		else if (senderName == "menu_sort_date_created")
-			DkSettingsManager::param().global().sortMode = DkSettings::sort_date_created;
-		else if (senderName == "menu_sort_date_modified")
-			DkSettingsManager::param().global().sortMode = DkSettings::sort_date_modified;
-		else if (senderName == "menu_sort_random")
-			DkSettingsManager::param().global().sortMode = DkSettings::sort_random;
-		else if (senderName == "menu_sort_ascending")
-			DkSettingsManager::param().global().sortDir = DkSettings::sort_ascending;
-		else if (senderName == "menu_sort_descending")
-			DkSettingsManager::param().global().sortDir = DkSettings::sort_descending;
-
-		if (getTabWidget()->getCurrentImageLoader()) 
-			getTabWidget()->getCurrentImageLoader()->sort();
-	}
-
-	QVector<QAction*> sortActions = DkActionManager::instance().sortActions();
-	for (int idx = 0; idx < sortActions.size(); idx++) {
-
-		if (idx < DkActionManager::menu_sort_ascending)
-			sortActions[idx]->setChecked(idx == DkSettingsManager::param().global().sortMode);
-		else if (idx >= DkActionManager::menu_sort_ascending)
-			sortActions[idx]->setChecked(idx-DkActionManager::menu_sort_ascending == DkSettingsManager::param().global().sortDir);
-	}
-}
-
-void DkNoMacs::goTo() {
-
-	if (!getTabWidget()->getCurrentImageLoader())
-		return;
-
-	QSharedPointer<DkImageLoader> loader = getTabWidget()->getCurrentImageLoader();
-	
-	bool ok = false;
-	int fileIdx = QInputDialog::getInt(this, tr("Go To Image"), tr("Image Index:"), 1, 1, loader->numFiles(), 1, &ok);
-
-	if (ok)
-		loader->loadFileAt(fileIdx-1);
-
-}
-
-void DkNoMacs::trainFormat() {
-
-	if (!mTrainDialog)
-		mTrainDialog = new DkTrainDialog(this);
-
-	mTrainDialog->setCurrentFile(getTabWidget()->getCurrentFilePath());
-	bool okPressed = mTrainDialog->exec() != 0;
+// TODO: move this
+void DkNoMacs::renameFile()
+{
+    // TODO:ref move!
+    QString filePath = getTabWidget()->getCurrentFilePath();
+    QFileInfo file(filePath);
+
+    if (!file.absoluteDir().exists()) {
+        getTabWidget()->setInfo(tr("Sorry, the directory: %1 does not exist\n").arg(file.absolutePath()));
+        return;
+    }
+    if (file.exists() && !file.isWritable()) {
+        getTabWidget()->setInfo(tr("Sorry, I can't write to the fileInfo: %1").arg(file.fileName()));
+        return;
+    }
+
+    QString fileName = file.fileName();
+    int dotIdx = fileName.lastIndexOf(".");
+    QString baseName = dotIdx != -1 ? fileName.left(dotIdx) : fileName;
+
+    bool ok = false;
+    QString newFileName = QInputDialog::getText(this, baseName, tr("Rename:"), QLineEdit::Normal, baseName, &ok);
+
+    if (ok && !newFileName.isEmpty() && newFileName != baseName) {
+        if (!file.suffix().isEmpty())
+            newFileName.append("." + file.suffix());
+
+        qDebug() << "renaming: " << file.fileName() << " -> " << newFileName;
+        QFileInfo renamedFile = QFileInfo(file.absoluteDir(), newFileName);
+
+        // overwrite file?
+        // the second comparison is important for windows (case insensitive filenames)
+        if (renamedFile.exists() && renamedFile.absoluteFilePath().compare(file.absoluteFilePath(), Qt::CaseInsensitive) != 0) {
+            QMessageBox infoDialog(this);
+            infoDialog.setWindowTitle(tr("Question"));
+            infoDialog.setText(tr("The fileInfo: %1  already exists.\n Do you want to replace it?").arg(newFileName));
+            infoDialog.setIcon(QMessageBox::Question);
+            infoDialog.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
+            infoDialog.setDefaultButton(QMessageBox::No);
+            infoDialog.show();
+            int choice = infoDialog.exec();
+
+            if (choice == QMessageBox::Yes) {
+                QFile oldFile(renamedFile.absoluteFilePath());
+                bool removed = oldFile.remove();
+
+                // tell user that deleting went wrong, and stop the renaming
+                if (!removed) {
+                    getTabWidget()->setInfo(tr("Sorry, I can't delete: %1").arg(file.fileName()));
+                    return;
+                }
+            } else
+                return; // cancel renaming
+        }
+
+        if (getTabWidget()->getViewPort())
+            getTabWidget()->getViewPort()->unloadImage();
+
+        QFile newFile(file.absoluteFilePath());
+        bool renamed = newFile.rename(renamedFile.absoluteFilePath());
+
+        // tell user that deleting went wrong, and stop the renaming
+        if (!renamed)
+            getTabWidget()->setInfo(tr("Sorry, I can't rename: %1").arg(file.fileName()));
+        else if (DkSettingsManager::param().resources().loadSavedImage == DkSettings::ls_load)
+            getTabWidget()->loadFile(renamedFile.absoluteFilePath());
+        else if (getTabWidget()->getViewPort())
+            getTabWidget()->getViewPort()->loadNextFileFast();
+    }
+}
+
+void DkNoMacs::find(bool filterAction)
+{
+    if (!getTabWidget()->getCurrentImageLoader())
+        return;
+
+    if (filterAction) {
+        int db = (QObject::sender() == DkActionManager::instance().action(DkActionManager::menu_tools_filter)) ? DkSearchDialog::filter_button
+                                                                                                               : DkSearchDialog::find_button;
+
+        qDebug() << "default button: " << db;
+        DkSearchDialog *searchDialog = new DkSearchDialog(this);
+        searchDialog->setDefaultButton(db);
+
+        searchDialog->setFiles(getTabWidget()->getCurrentImageLoader()->getFileNames());
+        searchDialog->setPath(getTabWidget()->getCurrentImageLoader()->getDirPath());
+
+        connect(searchDialog, SIGNAL(filterSignal(const QString &)), getTabWidget()->getCurrentImageLoader().data(), SLOT(setFolderFilter(const QString &)));
+        connect(searchDialog, SIGNAL(loadFileSignal(const QString &)), getTabWidget(), SLOT(loadFile(const QString &)));
+        int answer = searchDialog->exec();
+
+        DkActionManager::instance().action(DkActionManager::menu_tools_filter)->setChecked(answer == DkSearchDialog::filter_button);
+    } else {
+        // remove the filter
+        getTabWidget()->getCurrentImageLoader()->setFolderFilter(QString());
+    }
+}
+
+void DkNoMacs::changeSorting(bool change)
+{
+    // TODO: move to image loader?!
+
+    if (change) {
+        QString senderName = QObject::sender()->objectName();
+
+        if (senderName == "menu_sort_filename")
+            DkSettingsManager::param().global().sortMode = DkSettings::sort_filename;
+        else if (senderName == "menu_sort_file_size")
+            DkSettingsManager::param().global().sortMode = DkSettings::sort_file_size;
+        else if (senderName == "menu_sort_date_created")
+            DkSettingsManager::param().global().sortMode = DkSettings::sort_date_created;
+        else if (senderName == "menu_sort_date_modified")
+            DkSettingsManager::param().global().sortMode = DkSettings::sort_date_modified;
+        else if (senderName == "menu_sort_random")
+            DkSettingsManager::param().global().sortMode = DkSettings::sort_random;
+        else if (senderName == "menu_sort_ascending")
+            DkSettingsManager::param().global().sortDir = DkSettings::sort_ascending;
+        else if (senderName == "menu_sort_descending")
+            DkSettingsManager::param().global().sortDir = DkSettings::sort_descending;
+
+        if (getTabWidget()->getCurrentImageLoader())
+            getTabWidget()->getCurrentImageLoader()->sort();
+    }
+
+    QVector<QAction *> sortActions = DkActionManager::instance().sortActions();
+    for (int idx = 0; idx < sortActions.size(); idx++) {
+        if (idx < DkActionManager::menu_sort_ascending)
+            sortActions[idx]->setChecked(idx == DkSettingsManager::param().global().sortMode);
+        else if (idx >= DkActionManager::menu_sort_ascending)
+            sortActions[idx]->setChecked(idx - DkActionManager::menu_sort_ascending == DkSettingsManager::param().global().sortDir);
+    }
+}
+
+void DkNoMacs::goTo()
+{
+    if (!getTabWidget()->getCurrentImageLoader())
+        return;
+
+    QSharedPointer<DkImageLoader> loader = getTabWidget()->getCurrentImageLoader();
+
+    bool ok = false;
+    int fileIdx = QInputDialog::getInt(this, tr("Go To Image"), tr("Image Index:"), 1, 1, loader->numFiles(), 1, &ok);
+
+    if (ok)
+        loader->loadFileAt(fileIdx - 1);
+}
+
+void DkNoMacs::trainFormat()
+{
+    if (!mTrainDialog)
+        mTrainDialog = new DkTrainDialog(this);
+
+    mTrainDialog->setCurrentFile(getTabWidget()->getCurrentFilePath());
+    bool okPressed = mTrainDialog->exec() != 0;
 
-	if (okPressed && getTabWidget()->getCurrentImageLoader()) {
-		getTabWidget()->getCurrentImageLoader()->load(mTrainDialog->getAcceptedFile());
-		getTabWidget()->restart();	// quick & dirty, but currently he messes up the filteredFileList if the same folder was already loaded
-	}
+    if (okPressed && getTabWidget()->getCurrentImageLoader()) {
+        getTabWidget()->getCurrentImageLoader()->load(mTrainDialog->getAcceptedFile());
+        getTabWidget()->restart(); // quick & dirty, but currently he messes up the filteredFileList if the same folder was already loaded
+    }
+}
 
-}
-
-void DkNoMacs::extractImagesFromArchive() {
+void DkNoMacs::extractImagesFromArchive()
+{
 #ifdef WITH_QUAZIP
 
-	if (!mArchiveExtractionDialog)
-		mArchiveExtractionDialog = new DkArchiveExtractionDialog(this);
+    if (!mArchiveExtractionDialog)
+        mArchiveExtractionDialog = new DkArchiveExtractionDialog(this);
 
-	if (getTabWidget()->getCurrentImage()) {
-		if (getTabWidget()->getCurrentImage()->isFromZip())
-			mArchiveExtractionDialog->setCurrentFile(getTabWidget()->getCurrentImage()->getZipData()->getZipFilePath(), true);
-		else 
-			mArchiveExtractionDialog->setCurrentFile(getTabWidget()->getCurrentFilePath(), false);
-	}
-	else 
-		mArchiveExtractionDialog->setCurrentFile(getTabWidget()->getCurrentFilePath(), false);
+    if (getTabWidget()->getCurrentImage()) {
+        if (getTabWidget()->getCurrentImage()->isFromZip())
+            mArchiveExtractionDialog->setCurrentFile(getTabWidget()->getCurrentImage()->getZipData()->getZipFilePath(), true);
+        else
+            mArchiveExtractionDialog->setCurrentFile(getTabWidget()->getCurrentFilePath(), false);
+    } else
+        mArchiveExtractionDialog->setCurrentFile(getTabWidget()->getCurrentFilePath(), false);
 
-	mArchiveExtractionDialog->exec();
+    mArchiveExtractionDialog->exec();
 #endif
 }
 
-void DkNoMacs::exportTiff() {
-
+void DkNoMacs::exportTiff()
+{
 #ifdef WITH_LIBTIFF
-	if (!mExportTiffDialog)
-		mExportTiffDialog = new DkExportTiffDialog(this);
+    if (!mExportTiffDialog)
+        mExportTiffDialog = new DkExportTiffDialog(this);
 
-	mExportTiffDialog->setFile(getTabWidget()->getCurrentFilePath());
-	mExportTiffDialog->exec();
+    mExportTiffDialog->setFile(getTabWidget()->getCurrentFilePath());
+    mExportTiffDialog->exec();
 #endif
 }
 
-void DkNoMacs::computeThumbsBatch() {
+void DkNoMacs::computeThumbsBatch()
+{
+    if (!mForceDialog)
+        mForceDialog = new DkForceThumbDialog(this);
+    mForceDialog->setWindowTitle(tr("Save Thumbnails"));
+    mForceDialog->setDir(getTabWidget()->getCurrentDir());
 
-	if (!mForceDialog)
-		mForceDialog = new DkForceThumbDialog(this);
-	mForceDialog->setWindowTitle(tr("Save Thumbnails"));
-	mForceDialog->setDir(getTabWidget()->getCurrentDir());
+    if (!mForceDialog->exec())
+        return;
 
-	if (!mForceDialog->exec())
-		return;
+    if (!mThumbSaver)
+        mThumbSaver = new DkThumbsSaver(this);
 
-	if (!mThumbSaver)
-		mThumbSaver = new DkThumbsSaver(this);
-	
-	if (getTabWidget()->getCurrentImageLoader())
-		mThumbSaver->processDir(getTabWidget()->getCurrentImageLoader()->getImages(), mForceDialog->forceSave());
+    if (getTabWidget()->getCurrentImageLoader())
+        mThumbSaver->processDir(getTabWidget()->getCurrentImageLoader()->getImages(), mForceDialog->forceSave());
 }
 
-void DkNoMacs::aboutDialog() {
-
-	DkSplashScreen* spScreen = new DkSplashScreen(this, 0);
-	spScreen->exec();
-	spScreen->deleteLater();
+void DkNoMacs::aboutDialog()
+{
+    DkSplashScreen *spScreen = new DkSplashScreen(this);
+    spScreen->exec();
+    spScreen->deleteLater();
 }
 
-void DkNoMacs::openDocumentation() {
-
-	QString url = QString("https://nomacs.org/documentation/");
-	QDesktopServices::openUrl(QUrl(url));
+void DkNoMacs::openDocumentation()
+{
+    QString url = QString("https://nomacs.org/documentation/");
+    QDesktopServices::openUrl(QUrl(url));
 }
 
-void DkNoMacs::bugReport() {
-
-	QString url = "https://github.com/nomacs/nomacs/issues/new";
-	QDesktopServices::openUrl(QUrl(url));
+void DkNoMacs::bugReport()
+{
+    QString url = "https://github.com/nomacs/nomacs/issues/new";
+    QDesktopServices::openUrl(QUrl(url));
 }
 
-void DkNoMacs::cleanSettings() {
+void DkNoMacs::cleanSettings()
+{
+    DefaultSettings settings;
+    settings.clear();
 
-	DefaultSettings settings;
-	settings.clear();
-
-	readSettings();
-	resize(400, 225);
-	move(100, 100);
+    readSettings();
+    resize(400, 225);
+    move(100, 100);
 }
 
-void DkNoMacs::newInstance(const QString& filePath) {
+void DkNoMacs::newInstance(const QString &filePath)
+{
+    QString exe = QApplication::applicationFilePath();
+    QStringList args;
 
-	QString exe = QApplication::applicationFilePath();
-	QStringList args;
+    QAction *a = static_cast<QAction *>(sender());
 
-	QAction* a = static_cast<QAction*>(sender());
+    if (a && a == DkActionManager::instance().action(DkActionManager::menu_file_private_instance))
+        args.append("-p");
 
-	if (a && a == DkActionManager::instance().action(DkActionManager::menu_file_private_instance))
-		args.append("-p");
+    if (filePath.isEmpty())
+        args.append(getTabWidget()->getCurrentFilePath());
+    else
+        args.append(filePath);
 
-	if (filePath.isEmpty())
-		args.append(getTabWidget()->getCurrentFilePath());
-	else
-		args.append(filePath);
-	
-	QProcess::startDetached(exe, args);
+    QProcess::startDetached(exe, args);
 }
 
-void tagWall(const std::list<std::string>& code) {
-	for (auto line : code)
-		std::cout << line << std::endl;
+void tagWall(const std::list<std::string> &code)
+{
+    for (auto line : code)
+        std::cout << line << std::endl;
 }
 
-void DkNoMacs::loadRecursion() {
-
-	std::list<std::string> code;
-	code.push_back("void tagWall(const std::list<std::string>& code) {");
-	code.push_back("	for (auto line : code)");
-	code.push_back("		std::cout << line << std::endl;");
-	code.push_back("}");
-	tagWall(code);
+void DkNoMacs::loadRecursion()
+{
+    std::list<std::string> code;
+    code.push_back("void tagWall(const std::list<std::string>& code) {");
+    code.push_back("	for (auto line : code)");
+    code.push_back("		std::cout << line << std::endl;");
+    code.push_back("}");
+    tagWall(code);
 
-	QImage img = grab().toImage();
+    QImage img = grab().toImage();
 
-	if (getTabWidget()->getViewPort())
-		getTabWidget()->getViewPort()->setImage(img);
+    if (getTabWidget()->getViewPort())
+        getTabWidget()->getViewPort()->setImage(img);
 }
 
 // Added by fabian for transfer function:
 
-void DkNoMacs::restartWithPseudoColor(bool contrast) {
+void DkNoMacs::restartWithPseudoColor(bool contrast)
+{
+    qDebug() << "contrast: " << contrast;
 
-	qDebug() << "contrast: " << contrast;
+    QString exe = QApplication::applicationFilePath();
+    QStringList args;
 
-	QString exe = QApplication::applicationFilePath();
-	QStringList args;
+    if (contrast)
+        args << "-m"
+             << "pseudocolor";
+    else
+        args << "-m"
+             << "default";
+    args.append(getTabWidget()->getCurrentFilePath());
 
-	if (contrast)
-		args << "-m" << "pseudocolor";
-	else
-		args << "-m" << "default";
-	args.append(getTabWidget()->getCurrentFilePath());
-	
-	bool started = mProcess.startDetached(exe, args);
+    bool started = mProcess.startDetached(exe, args);
 
-	// close me if the new instance started
-	if (started)
-		close();
+    // close me if the new instance started
+    if (started)
+        close();
 
-	qDebug() << "contrast arguments: " << args;
+    qDebug() << "contrast arguments: " << args;
 }
 
-void DkNoMacs::onWindowLoaded() {
+void DkNoMacs::onWindowLoaded()
+{
+    DefaultSettings settings;
+    bool firstTime = settings.value("AppSettings/firstTime.nomacs.3", true).toBool();
 
-	DefaultSettings settings;
-	bool firstTime = settings.value("AppSettings/firstTime.nomacs.3", true).toBool();
+    if (DkDockWidget::testDisplaySettings(DkSettingsManager::param().app().showExplorer))
+        showExplorer(true);
+    if (DkDockWidget::testDisplaySettings(DkSettingsManager::param().app().showMetaDataDock))
+        showMetaDataDock(true);
+    if (DkDockWidget::testDisplaySettings(DkSettingsManager::param().app().showEditDock))
+        showEditDock(true);
+    if (DkDockWidget::testDisplaySettings(DkSettingsManager::param().app().showHistoryDock))
+        showHistoryDock(true);
+    if (DkDockWidget::testDisplaySettings(DkSettingsManager::param().app().showLogDock))
+        showLogDock(true);
 
-	if (DkDockWidget::testDisplaySettings(DkSettingsManager::param().app().showExplorer))
-		showExplorer(true);
-	if (DkDockWidget::testDisplaySettings(DkSettingsManager::param().app().showMetaDataDock))
-		showMetaDataDock(true);
-	if (DkDockWidget::testDisplaySettings(DkSettingsManager::param().app().showEditDock))
-		showEditDock(true);
-	if (DkDockWidget::testDisplaySettings(DkSettingsManager::param().app().showHistoryDock))
-		showHistoryDock(true);
-	if (DkDockWidget::testDisplaySettings(DkSettingsManager::param().app().showLogDock))
-		showLogDock(true);
+    if (firstTime) {
+        // here are some first time requests
+        DkWelcomeDialog *wecomeDialog = new DkWelcomeDialog(this);
+        wecomeDialog->exec();
 
-	if (firstTime) {
+        settings.setValue("AppSettings/firstTime.nomacs.3", false);
 
-		// here are some first time requests
-		DkWelcomeDialog* wecomeDialog = new DkWelcomeDialog(this);
-		wecomeDialog->exec();
+        if (wecomeDialog->isLanguageChanged()) {
+            restartWithTranslationUpdate();
+        }
+    }
 
-		settings.setValue("AppSettings/firstTime.nomacs.3", false);
+    checkForUpdate(true);
 
-		if (wecomeDialog->isLanguageChanged()) {
-			restartWithTranslationUpdate();
-		}
-	}
-
-	checkForUpdate(true);
-
-	// load settings AFTER everything is initialized
-	getTabWidget()->loadSettings();
+    // load settings AFTER everything is initialized
+    getTabWidget()->loadSettings();
 
 // init global taskbar
 #ifdef WIN32
-	QWinTaskbarButton *button = new QWinTaskbarButton(this);
-	button->setWindow(windowHandle());
+    QWinTaskbarButton *button = new QWinTaskbarButton(this);
+    button->setWindow(windowHandle());
 
-	DkGlobalProgress::instance().setProgressBar(button->progress());
+    DkGlobalProgress::instance().setProgressBar(button->progress());
 #endif
 
-	toggleDocks(DkSettingsManager::param().app().hideAllPanels);
+    toggleDocks(DkSettingsManager::param().app().hideAllPanels);
 }
 
-void DkNoMacs::keyPressEvent(QKeyEvent *event) {
-	
-	if (event->key() == Qt::Key_Alt) {
-		mPosGrabKey = QCursor::pos();
-		mOtherKeyPressed = false;
-	}
-	else
-		mOtherKeyPressed = true;
-
+void DkNoMacs::keyPressEvent(QKeyEvent *event)
+{
+    if (event->key() == Qt::Key_Alt) {
+        mPosGrabKey = QCursor::pos();
+        mOtherKeyPressed = false;
+    } else
+        mOtherKeyPressed = true;
 }
 
-void DkNoMacs::keyReleaseEvent(QKeyEvent* event) {
-
-	if (event->key() == Qt::Key_Alt && !mOtherKeyPressed && (mPosGrabKey - QCursor::pos()).manhattanLength() == 0)
-		mMenu->showMenu();
-	
+void DkNoMacs::keyReleaseEvent(QKeyEvent *event)
+{
+    if (event->key() == Qt::Key_Alt && !mOtherKeyPressed && (mPosGrabKey - QCursor::pos()).manhattanLength() == 0)
+        mMenu->showMenu();
 }
 
 // >DIR diem: eating shortcut overrides (this allows us to use navigation keys like arrows)
-bool DkNoMacs::eventFilter(QObject*, QEvent* event) {
-
-	if (event->type() == QEvent::ShortcutOverride) {
-		QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
+bool DkNoMacs::eventFilter(QObject *, QEvent *event)
+{
+    if (event->type() == QEvent::ShortcutOverride) {
+        QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
 
-		// consume esc key if fullscreen is on
-		if (keyEvent->key() == Qt::Key_Escape && isFullScreen()) {
-			exitFullScreen();
-			return true;
-		}
-		else if (keyEvent->key() == Qt::Key_Escape && DkSettingsManager::param().app().closeOnEsc)
-			close();
-	}
-	//if (event->type() == QEvent::Gesture) {
-	//	return gestureEvent(static_cast<QGestureEvent*>(event));
-	//}
+        // consume esc key if fullscreen is on
+        if (keyEvent->key() == Qt::Key_Escape && isFullScreen()) {
+            exitFullScreen();
+            return true;
+        } else if (keyEvent->key() == Qt::Key_Escape && DkSettingsManager::param().app().closeOnEsc)
+            close();
+    }
+    // if (event->type() == QEvent::Gesture) {
+    //	return gestureEvent(static_cast<QGestureEvent*>(event));
+    // }
 
-	return false;
+    return false;
 }
 
-void DkNoMacs::showMenuBar(bool show) {
+void DkNoMacs::showMenuBar(bool show)
+{
+    DkSettingsManager::param().app().showMenuBar = show;
 
-	DkSettingsManager::param().app().showMenuBar = show;
-	
-	QAction* mp = DkActionManager::instance().action(DkActionManager::menu_panel_menu);
-	mp->blockSignals(true);
-	mp->setChecked(DkSettingsManager::param().app().showMenuBar);
-	mp->blockSignals(false);
+    QAction *mp = DkActionManager::instance().action(DkActionManager::menu_panel_menu);
+    mp->blockSignals(true);
+    mp->setChecked(DkSettingsManager::param().app().showMenuBar);
+    mp->blockSignals(false);
 
-	int tts = (DkSettingsManager::param().app().showMenuBar) ? -1 : 5000;
-	mMenu->setTimeToShow(tts);
-	
-	if (show)
-		mMenu->showMenu();
-	else if (!show)
-		mMenu->hide();
-}
+    int tts = (DkSettingsManager::param().app().showMenuBar) ? -1 : 5000;
+    mMenu->setTimeToShow(tts);
 
-void DkNoMacs::openFileWith(QAction* action) {
-
-	if (!action)
-		return;
+    if (show)
+        mMenu->showMenu();
+    else if (!show)
+        mMenu->hide();
+}
+
+void DkNoMacs::openFileWith(QAction *action)
+{
+    if (!action)
+        return;
 
-	QFileInfo app(action->toolTip());
+    QFileInfo app(action->toolTip());
 
-	if (!app.exists())
-		getTabWidget()->setInfo("Sorry, " % app.fileName() % " does not exist");
+    if (!app.exists())
+        getTabWidget()->setInfo("Sorry, " % app.fileName() % " does not exist");
 
-	QStringList args;
-	
-	QString filePath = getTabWidget()->getCurrentFilePath();
+    QStringList args;
 
-	if (app.fileName() == "explorer.exe")
-		args << "/select," << QDir::toNativeSeparators(filePath);
-	else if (app.fileName().toLower() == "outlook.exe") {
-		args << "/a" << QDir::toNativeSeparators(filePath);
-	}
-	else
-		args << QDir::toNativeSeparators(filePath);
+    QString filePath = getTabWidget()->getCurrentFilePath();
 
-	//bool started = process.startDetached("psOpenImages.exe", args);	// already deprecated
-	bool started = mProcess.startDetached(app.absoluteFilePath(), args);
+    if (app.fileName() == "explorer.exe")
+        args << "/select," << QDir::toNativeSeparators(filePath);
+    else if (app.fileName().toLower() == "outlook.exe") {
+        args << "/a" << QDir::toNativeSeparators(filePath);
+    } else
+        args << QDir::toNativeSeparators(filePath);
 
-	if (started)
-		qDebug() << "starting: " << app.fileName() << args;
-	else 
-		getTabWidget()->setInfo("Sorry, I could not start: " % app.absoluteFilePath());
-}
+    // bool started = process.startDetached("psOpenImages.exe", args);	// already deprecated
+    bool started = mProcess.startDetached(app.absoluteFilePath(), args);
 
-void DkNoMacs::setWindowTitle(QSharedPointer<DkImageContainerT> imgC) {
+    if (started)
+        qDebug() << "starting: " << app.fileName() << args;
+    else
+        getTabWidget()->setInfo("Sorry, I could not start: " % app.absoluteFilePath());
+}
 
-	if (!imgC) {
-		setWindowTitle(QString());
-		return;
-	}
+void DkNoMacs::setWindowTitle(QSharedPointer<DkImageContainerT> imgC)
+{
+    if (!imgC) {
+        setWindowTitle(QString());
+        return;
+    }
 
-	setWindowTitle(imgC->filePath(), imgC->image().size(), imgC->isEdited(), imgC->getTitleAttribute());
+    setWindowTitle(imgC->filePath(), imgC->image().size(), imgC->isEdited(), imgC->getTitleAttribute());
 }
 
-void DkNoMacs::setWindowTitle(const QString& filePath, const QSize& size, bool edited, const QString& attr) {
-
-	QString title;
+void DkNoMacs::setWindowTitle(const QString &filePath, const QSize &size, bool edited, const QString &attr)
+{
+    QString title;
 
-	if (DkSettingsManager::param().global().extendedTabs && (getTabWidget()->getTabs().count() > 1)) {
-		title.append(QString::number(getTabWidget()->getActiveTab() + 1) + "/" + QString::number(getTabWidget()->getTabs().count()) + " - ");
-	}
+    if (DkSettingsManager::param().global().extendedTabs && (getTabWidget()->getTabs().count() > 1)) {
+        title.append(QString::number(getTabWidget()->getActiveTab() + 1) + "/" + QString::number(getTabWidget()->getTabs().count()) + " - ");
+    }
 
-	QFileInfo fInfo = filePath;
-	title.append(QFileInfo(filePath).fileName());
-	title = title.remove(".lnk");
-	
-	if (filePath.isEmpty()) {
-		title = "nomacs - Image Lounge";
-		if (DkSettingsManager::param().app().privateMode) 
-			title.append(tr(" [Private Mode]"));
-	}
+    QFileInfo fInfo(filePath);
+    title.append(QFileInfo(filePath).fileName());
+    title = title.remove(".lnk");
 
-	if (edited)
-		title.append("[*]");
+    if (filePath.isEmpty()) {
+        title = "nomacs - Image Lounge";
+        if (DkSettingsManager::param().app().privateMode)
+            title.append(tr(" [Private Mode]"));
+    }
 
-	title.append(" ");
-	title.append(attr);	// append some attributes
+    if (edited)
+        title.append("[*]");
 
-	QString attributes;
-	auto vp = getTabWidget()->getViewPort();
+    title.append(" ");
+    title.append(attr); // append some attributes
 
-	if (!size.isEmpty())
-		attributes.sprintf(" - %i x %i", size.width(), size.height());
-	if (size.isEmpty() && vp && !vp->getImageSize().isEmpty())
-		attributes.sprintf(" - %i x %i", vp->getImage().width(), vp->getImage().height());
-	if (DkSettingsManager::param().app().privateMode) 
-		attributes.append(tr(" [Private Mode]"));
+    QString attributes;
+    auto vp = getTabWidget()->getViewPort();
 
-	QMainWindow::setWindowTitle(title.append(attributes));
-	setWindowFilePath(filePath);
-	setWindowModified(edited);
+    if (!size.isEmpty())
+        attributes.asprintf(" - %i x %i", size.width(), size.height());
+    if (size.isEmpty() && vp && !vp->getImageSize().isEmpty())
+        attributes.asprintf(" - %i x %i", vp->getImage().width(), vp->getImage().height());
+    if (DkSettingsManager::param().app().privateMode)
+        attributes.append(tr(" [Private Mode]"));
 
-	auto cm = DkSyncManager::inst().client();
-	if (cm)
-		cm->sendTitle(windowTitle());
+    QMainWindow::setWindowTitle(title.append(attributes));
+    setWindowFilePath(filePath);
+    setWindowModified(edited);
 
-	// TODO: move!
-	DkStatusBar* bar = DkStatusBarManager::instance().statusbar();
+    auto cm = DkSyncManager::inst().client();
+    if (cm)
+        cm->sendTitle(windowTitle());
 
-	if (((vp && !vp->getController()->getFileInfoLabel()->isVisible()) || 
-		!DkSettingsManager::param().slideShow().display.testBit(DkSettings::display_creation_date)) && getTabWidget()->getCurrentImage()) {
-		
-		// create statusbar info
-		QSharedPointer<DkMetaDataT> metaData = getTabWidget()->getCurrentImage()->getMetaData();
-		QString dateString = metaData->getExifValue("DateTimeOriginal");
-		dateString = DkUtils::convertDateString(dateString, fInfo);
-		bar->setMessage(dateString, DkStatusBar::status_time_info);
-	}
-	else 
-		bar->setMessage("", DkStatusBar::status_time_info);	// hide label
+    // TODO: move!
+    DkStatusBar *bar = DkStatusBarManager::instance().statusbar();
 
-	if (fInfo.exists())
-		bar->setMessage(DkUtils::readableByte((float)fInfo.size()), DkStatusBar::status_filesize_info);
-	else 
-		bar->setMessage("", DkStatusBar::status_filesize_info);
+    if (((vp && !vp->getController()->getFileInfoLabel()->isVisible())
+         || !DkSettingsManager::param().slideShow().display.testBit(DkSettings::display_creation_date))
+        && getTabWidget()->getCurrentImage()) {
+        // create statusbar info
+        QSharedPointer<DkMetaDataT> metaData = getTabWidget()->getCurrentImage()->getMetaData();
+        QString dateString = metaData->getExifValue("DateTimeOriginal");
+        dateString = DkUtils::convertDateString(dateString, fInfo);
+        bar->setMessage(dateString, DkStatusBar::status_time_info);
+    } else
+        bar->setMessage("", DkStatusBar::status_time_info); // hide label
 
+    if (fInfo.exists())
+        bar->setMessage(DkUtils::readableByte((float)fInfo.size()), DkStatusBar::status_filesize_info);
+    else
+        bar->setMessage("", DkStatusBar::status_filesize_info);
 }
 
-void DkNoMacs::settingsChanged() {
-	
-	if (!isFullScreen()) {
-		showMenuBar(DkSettingsManager::param().app().showMenuBar);
+void DkNoMacs::settingsChanged()
+{
+    if (!isFullScreen()) {
+        showMenuBar(DkSettingsManager::param().app().showMenuBar);
 
-		DkToolBarManager::inst().restore();
-		DkStatusBarManager::instance().show(DkSettingsManager::param().app().showStatusBar);
-	}
+        DkToolBarManager::inst().restore();
+        DkStatusBarManager::instance().show(DkSettingsManager::param().app().showStatusBar);
+    }
 }
 
-void DkNoMacs::checkForUpdate(bool silent) {
-
-	// updates are supported on windows only
+void DkNoMacs::checkForUpdate(bool silent)
+{
+    // updates are supported on windows only
 #ifndef Q_OS_LINUX
 
-	// do we really need to check for update?
-	if (!silent || 
-		(!DkSettingsManager::param().sync().updateDialogShown && 
-		 QDate::currentDate() > DkSettingsManager::param().sync().lastUpdateCheck && 
-		 DkSettingsManager::param().sync().checkForUpdates)) {
-
-		DkTimer dt;
-
-		if (!mUpdater) {
-			mUpdater = new DkUpdater(this);
-			connect(mUpdater, SIGNAL(displayUpdateDialog(QString, QString)), this, SLOT(showUpdateDialog(QString, QString)));
-			connect(mUpdater, SIGNAL(showUpdaterMessage(QString, QString)), this, SLOT(showUpdaterMessage(QString, QString)));
-		}
-		mUpdater->silent = silent;
-		mUpdater->checkForUpdates();
-		qDebug() << "checking for updates takes: " << dt;
-	}
+    // do we really need to check for update?
+    if (!silent
+        || (!DkSettingsManager::param().sync().updateDialogShown && QDate::currentDate() > DkSettingsManager::param().sync().lastUpdateCheck
+            && DkSettingsManager::param().sync().checkForUpdates)) {
+        DkTimer dt;
+
+        if (!mUpdater) {
+            mUpdater = new DkUpdater(this);
+            connect(mUpdater, SIGNAL(displayUpdateDialog(QString, QString)), this, SLOT(showUpdateDialog(QString, QString)));
+            connect(mUpdater, SIGNAL(showUpdaterMessage(QString, QString)), this, SLOT(showUpdaterMessage(QString, QString)));
+        }
+        mUpdater->silent = silent;
+        mUpdater->checkForUpdates();
+        qDebug() << "checking for updates takes: " << dt;
+    }
 #endif // !#ifndef Q_OS_LINUX
 }
 
-void DkNoMacs::showUpdaterMessage(QString msg, QString title) {
-	
-	QMessageBox infoDialog(this);
-	infoDialog.setWindowTitle(title);
-	infoDialog.setIcon(QMessageBox::Information);
-	infoDialog.setText(msg);
-	infoDialog.show();
-
-	infoDialog.exec();
-}
-
-void DkNoMacs::showUpdateDialog(QString msg, QString title) {
-	
-	if (mProgressDialog != 0 && !mProgressDialog->isHidden()) { // check if the progress bar is already open 
-		showUpdaterMessage(tr("Already downloading update"), "update");
-		return;
-	}
-
-	DkSettingsManager::param().sync().updateDialogShown = true;
-	DkSettingsManager::param().save();
-	
-	if (!mUpdateDialog) {
-		mUpdateDialog = new DkUpdateDialog(this);
-		mUpdateDialog->setWindowTitle(title);
-		mUpdateDialog->upperLabel->setText(msg);
-		connect(mUpdateDialog, SIGNAL(startUpdate()), this, SLOT(performUpdate()));
-	}
-
-	mUpdateDialog->exec();
-}
-
-void DkNoMacs::performUpdate() {
-	
-	if (!mUpdater) {
-		qDebug() << "WARNING updater is NULL where it should not be.";
-		return;
-	}
-
-	mUpdater->performUpdate();
-
-	if (!mProgressDialog) {
-		mProgressDialog = new QProgressDialog(tr("Downloading update..."), tr("Cancel Update"), 0, 100, this);
-		mProgressDialog->setWindowIcon(windowIcon());
-		connect(mProgressDialog, SIGNAL(canceled()), mUpdater, SLOT(cancelUpdate()));
-		connect(mUpdater, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(updateProgress(qint64, qint64)));
-		connect(mUpdater, SIGNAL(downloadFinished(QString)), mProgressDialog, SLOT(close()));
-		//connect(updater, SIGNAL(downloadFinished(QString)), progressDialog, SLOT(deleteLater()));
-		connect(mUpdater, SIGNAL(downloadFinished(QString)), this, SLOT(startSetup(QString)));
-	}
-	//mProgressDialog->setWindowModality(Qt::ApplicationModal);
-
-	mProgressDialog->show();
-	//progressDialog->raise();
-	//progressDialog->activateWindow();
-	//mProgressDialog->setWindowModality(Qt::NonModal);
-}
-
-void DkNoMacs::updateProgress(qint64 received, qint64 total) {
-	mProgressDialog->setMaximum((int)total);
-	mProgressDialog->setValue((int)received);
-}
-
-void DkNoMacs::updateProgressTranslations(qint64 received, qint64 total) {
-	qDebug() << "rec:" << received << "  total:" << total;
-	mProgressDialogTranslations->setMaximum((int)total);
-	mProgressDialogTranslations->setValue((int)received);
-}
-
-void DkNoMacs::startSetup(QString filePath) {
-	
-	qDebug() << "starting setup filePath:" << filePath;
-	
-	if (!QFile::exists(filePath))
-		qDebug() << "file does not exist";
-	if (!QDesktopServices::openUrl(QUrl::fromLocalFile(filePath))) {
-		QString msg = tr("Unable to install new version<br>") +
-			tr("You can download the new version from our web page") +
-			"<br><a href=\"https://nomacs.org/download/\">www.nomacs.org</a><br>";
-		showUpdaterMessage(msg, "update");
-	}
-}
-
-void DkNoMacs::updateTranslations() {
-	
-	if (!mTranslationUpdater) {
-		mTranslationUpdater = new DkTranslationUpdater(false, this);
-		connect(mTranslationUpdater, SIGNAL(showUpdaterMessage(QString, QString)), this, SLOT(showUpdaterMessage(QString, QString)));
-	}
-
-	if (!mProgressDialogTranslations) {
-		mProgressDialogTranslations = new QProgressDialog(tr("Downloading new translations..."), tr("Cancel"), 0, 100, this);
-		mProgressDialogTranslations->setWindowIcon(windowIcon());
-		connect(mProgressDialogTranslations, SIGNAL(canceled()), mTranslationUpdater, SLOT(cancelUpdate()));
-		//connect(progressDialogTranslations, SIGNAL(canceled()), translationUpdater, SLOT(cancelUpdate()));
-		connect(mTranslationUpdater, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(updateProgressTranslations(qint64, qint64)));
-		connect(mTranslationUpdater, SIGNAL(downloadFinished()), mProgressDialogTranslations, SLOT(close()));
-	}
-	//mProgressDialogTranslations->setWindowModality(Qt::ApplicationModal);
-
-	mProgressDialogTranslations->show();
-	//progressDialog->raise();
-	//progressDialog->activateWindow();
-	//mProgressDialogTranslations->setWindowModality(Qt::NonModal);
-
-	mTranslationUpdater->checkForUpdates();
-}
-
-void DkNoMacs::restartWithTranslationUpdate() {
-	
-	if (!mTranslationUpdater) {
-		mTranslationUpdater = new DkTranslationUpdater(false, this);
-		connect(mTranslationUpdater, SIGNAL(showUpdaterMessage(QString, QString)), this, SLOT(showUpdaterMessage(QString, QString)));
-	}
-
-	mTranslationUpdater->silent = true;
-	connect(mTranslationUpdater, SIGNAL(downloadFinished()), this, SLOT(restart()));
-	updateTranslations();
-}
-
-void DkNoMacs::openPluginManager() {
+void DkNoMacs::showUpdaterMessage(QString msg, QString title)
+{
+    QMessageBox infoDialog(this);
+    infoDialog.setWindowTitle(title);
+    infoDialog.setIcon(QMessageBox::Information);
+    infoDialog.setText(msg);
+    infoDialog.show();
+
+    infoDialog.exec();
+}
+
+void DkNoMacs::showUpdateDialog(QString msg, QString title)
+{
+    if (mProgressDialog != 0 && !mProgressDialog->isHidden()) { // check if the progress bar is already open
+        showUpdaterMessage(tr("Already downloading update"), "update");
+        return;
+    }
+
+    DkSettingsManager::param().sync().updateDialogShown = true;
+    DkSettingsManager::param().save();
+
+    if (!mUpdateDialog) {
+        mUpdateDialog = new DkUpdateDialog(this);
+        mUpdateDialog->setWindowTitle(title);
+        mUpdateDialog->upperLabel->setText(msg);
+        connect(mUpdateDialog, SIGNAL(startUpdate()), this, SLOT(performUpdate()));
+    }
+
+    mUpdateDialog->exec();
+}
+
+void DkNoMacs::performUpdate()
+{
+    if (!mUpdater) {
+        qDebug() << "WARNING updater is NULL where it should not be.";
+        return;
+    }
+
+    mUpdater->performUpdate();
+
+    if (!mProgressDialog) {
+        mProgressDialog = new QProgressDialog(tr("Downloading update..."), tr("Cancel Update"), 0, 100, this);
+        mProgressDialog->setWindowIcon(windowIcon());
+        connect(mProgressDialog, SIGNAL(canceled()), mUpdater, SLOT(cancelUpdate()));
+        connect(mUpdater, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(updateProgress(qint64, qint64)));
+        connect(mUpdater, SIGNAL(downloadFinished(QString)), mProgressDialog, SLOT(close()));
+        // connect(updater, SIGNAL(downloadFinished(QString)), progressDialog, SLOT(deleteLater()));
+        connect(mUpdater, SIGNAL(downloadFinished(QString)), this, SLOT(startSetup(QString)));
+    }
+    // mProgressDialog->setWindowModality(Qt::ApplicationModal);
+
+    mProgressDialog->show();
+    // progressDialog->raise();
+    // progressDialog->activateWindow();
+    // mProgressDialog->setWindowModality(Qt::NonModal);
+}
+
+void DkNoMacs::updateProgress(qint64 received, qint64 total)
+{
+    mProgressDialog->setMaximum((int)total);
+    mProgressDialog->setValue((int)received);
+}
+
+void DkNoMacs::updateProgressTranslations(qint64 received, qint64 total)
+{
+    qDebug() << "rec:" << received << "  total:" << total;
+    mProgressDialogTranslations->setMaximum((int)total);
+    mProgressDialogTranslations->setValue((int)received);
+}
+
+void DkNoMacs::startSetup(QString filePath)
+{
+    qDebug() << "starting setup filePath:" << filePath;
+
+    if (!QFile::exists(filePath))
+        qDebug() << "file does not exist";
+    if (!QDesktopServices::openUrl(QUrl::fromLocalFile(filePath))) {
+        QString msg = tr("Unable to install new version<br>") + tr("You can download the new version from our web page")
+            + "<br><a href=\"https://nomacs.org/download/\">www.nomacs.org</a><br>";
+        showUpdaterMessage(msg, "update");
+    }
+}
+
+void DkNoMacs::updateTranslations()
+{
+    if (!mTranslationUpdater) {
+        mTranslationUpdater = new DkTranslationUpdater(false, this);
+        connect(mTranslationUpdater, SIGNAL(showUpdaterMessage(QString, QString)), this, SLOT(showUpdaterMessage(QString, QString)));
+    }
+
+    if (!mProgressDialogTranslations) {
+        mProgressDialogTranslations = new QProgressDialog(tr("Downloading new translations..."), tr("Cancel"), 0, 100, this);
+        mProgressDialogTranslations->setWindowIcon(windowIcon());
+        connect(mProgressDialogTranslations, SIGNAL(canceled()), mTranslationUpdater, SLOT(cancelUpdate()));
+        // connect(progressDialogTranslations, SIGNAL(canceled()), translationUpdater, SLOT(cancelUpdate()));
+        connect(mTranslationUpdater, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(updateProgressTranslations(qint64, qint64)));
+        connect(mTranslationUpdater, SIGNAL(downloadFinished()), mProgressDialogTranslations, SLOT(close()));
+    }
+    // mProgressDialogTranslations->setWindowModality(Qt::ApplicationModal);
+
+    mProgressDialogTranslations->show();
+    // progressDialog->raise();
+    // progressDialog->activateWindow();
+    // mProgressDialogTranslations->setWindowModality(Qt::NonModal);
+
+    mTranslationUpdater->checkForUpdates();
+}
+
+void DkNoMacs::restartWithTranslationUpdate()
+{
+    if (!mTranslationUpdater) {
+        mTranslationUpdater = new DkTranslationUpdater(false, this);
+        connect(mTranslationUpdater, SIGNAL(showUpdaterMessage(QString, QString)), this, SLOT(showUpdaterMessage(QString, QString)));
+    }
+
+    mTranslationUpdater->silent = true;
+    connect(mTranslationUpdater, SIGNAL(downloadFinished()), this, SLOT(restart()));
+    updateTranslations();
+}
+
+void DkNoMacs::openPluginManager()
+{
 #ifdef WITH_PLUGINS
 
-	if (getTabWidget()->getViewPort())
-		getTabWidget()->getViewPort()->getController()->closePlugin(true);
+    if (getTabWidget()->getViewPort())
+        getTabWidget()->getViewPort()->getController()->closePlugin(true);
 
-	if (DkPluginManager::instance().getRunningPlugin()) {
-	   	   
-		QMessageBox infoDialog(this);
-		infoDialog.setWindowTitle("Close plugin");
-		infoDialog.setIcon(QMessageBox::Information);
-		infoDialog.setText("Please close the currently opened plugin first.");
-		infoDialog.show();
+    if (DkPluginManager::instance().getRunningPlugin()) {
+        QMessageBox infoDialog(this);
+        infoDialog.setWindowTitle("Close plugin");
+        infoDialog.setIcon(QMessageBox::Information);
+        infoDialog.setText("Please close the currently opened plugin first.");
+        infoDialog.show();
 
-		infoDialog.exec();
-		return;
-	}
+        infoDialog.exec();
+        return;
+    }
 
-	DkPluginManagerDialog* pluginDialog = new DkPluginManagerDialog(this);
-	pluginDialog->exec();
-	pluginDialog->deleteLater();
+    DkPluginManagerDialog *pluginDialog = new DkPluginManagerDialog(this);
+    pluginDialog->exec();
+    pluginDialog->deleteLater();
 
-	DkPluginActionManager* am = DkActionManager::instance().pluginActionManager();
-	am->updateMenu();
+    DkPluginActionManager *am = DkActionManager::instance().pluginActionManager();
+    am->updateMenu();
 
 #endif // WITH_PLUGINS
 }
 
 // DkNoMacsSync --------------------------------------------------------------------
-DkNoMacsSync::DkNoMacsSync(QWidget *parent, Qt::WindowFlags flags) : DkNoMacs(parent, flags) {
+DkNoMacsSync::DkNoMacsSync(QWidget *parent, Qt::WindowFlags flags)
+    : DkNoMacs(parent, flags)
+{
 }
 
-DkNoMacsSync::~DkNoMacsSync() {
+DkNoMacsSync::~DkNoMacsSync()
+{
 }
 
-void DkNoMacsSync::createActions() {
+void DkNoMacsSync::createActions()
+{
+    DkNoMacs::createActions();
+
+    DkActionManager &am = DkActionManager::instance();
 
-	DkNoMacs::createActions();
+    // sync menu
+    connect(am.action(DkActionManager::menu_sync_pos), SIGNAL(triggered()), this, SLOT(tcpSendWindowRect()));
+    connect(am.action(DkActionManager::menu_sync_arrange), SIGNAL(triggered()), this, SLOT(tcpSendArrange()));
 
-	DkActionManager& am = DkActionManager::instance();
-	
-	// sync menu
-	connect(am.action(DkActionManager::menu_sync_pos), SIGNAL(triggered()), this, SLOT(tcpSendWindowRect()));
-	connect(am.action(DkActionManager::menu_sync_arrange), SIGNAL(triggered()), this, SLOT(tcpSendArrange()));
+    auto cm = DkSyncManager::inst().client();
+    assert(cm);
 
-	auto cm = DkSyncManager::inst().client();
-	assert(cm);
+    // just for local client
+    connect(this, SIGNAL(sendArrangeSignal(bool)), cm, SLOT(sendArrangeInstances(bool)));
+    connect(this, SIGNAL(sendQuitLocalClientsSignal()), cm, SLOT(sendQuitMessageToPeers()));
 
-	// just for local client
-	connect(this, SIGNAL(sendArrangeSignal(bool)), cm, SLOT(sendArrangeInstances(bool)));
-	connect(this, SIGNAL(sendQuitLocalClientsSignal()), cm, SLOT(sendQuitMessageToPeers()));
-	
-	connect(cm, SIGNAL(clientConnectedSignal(bool)), this, SLOT(newClientConnected(bool)));
-	connect(cm, SIGNAL(receivedPosition(QRect, bool, bool)), this, SLOT(tcpSetWindowRect(QRect, bool, bool)));
+    connect(cm, SIGNAL(clientConnectedSignal(bool)), this, SLOT(newClientConnected(bool)));
+    connect(cm, SIGNAL(receivedPosition(QRect, bool, bool)), this, SLOT(tcpSetWindowRect(QRect, bool, bool)));
 }
 
 // mouse events
-void DkNoMacsSync::mouseMoveEvent(QMouseEvent *event) {
-
-	int dist = QPoint(event->pos()-mMousePos).manhattanLength();
-
-	// create drag sync action
-	if (event->buttons() == Qt::LeftButton && dist > QApplication::startDragDistance() &&
-		event->modifiers() == (Qt::ControlModifier | Qt::AltModifier)) {
-
-			qDebug() << "generating a drag event...";
+void DkNoMacsSync::mouseMoveEvent(QMouseEvent *event)
+{
+    int dist = QPoint(event->pos() - mMousePos).manhattanLength();
 
-			auto cm = dynamic_cast<DkLocalClientManager*>(DkSyncManager::inst().client());
-			assert(cm);
-			auto md = cm->mimeData();
+    // create drag sync action
+    if (event->buttons() == Qt::LeftButton && dist > QApplication::startDragDistance() && event->modifiers() == (Qt::ControlModifier | Qt::AltModifier)) {
+        qDebug() << "generating a drag event...";
 
-			QDrag* drag = new QDrag(this);
-			drag->setMimeData(md);
-			drag->exec(Qt::CopyAction | Qt::MoveAction);
-	}
-	else
-		DkNoMacs::mouseMoveEvent(event);
+        auto cm = dynamic_cast<DkLocalClientManager *>(DkSyncManager::inst().client());
+        assert(cm);
+        auto md = cm->mimeData();
 
+        QDrag *drag = new QDrag(this);
+        drag->setMimeData(md);
+        drag->exec(Qt::CopyAction | Qt::MoveAction);
+    } else
+        DkNoMacs::mouseMoveEvent(event);
 }
 
-void DkNoMacsSync::dragEnterEvent(QDragEnterEvent *event) {
+void DkNoMacsSync::dragEnterEvent(QDragEnterEvent *event)
+{
+    if (event->mimeData()->hasFormat("network/sync-dir")) {
+        event->accept();
+    }
 
-	if (event->mimeData()->hasFormat("network/sync-dir")) {
-		event->accept();
-	}
-
-	QMainWindow::dragEnterEvent(event);
+    QMainWindow::dragEnterEvent(event);
 }
 
-void DkNoMacsSync::dropEvent(QDropEvent *event) {
-
-	if (event->source() == this) {
-		event->accept();
-		return;
-	}
+void DkNoMacsSync::dropEvent(QDropEvent *event)
+{
+    if (event->source() == this) {
+        event->accept();
+        return;
+    }
 
-	if (event->mimeData()->hasFormat("network/sync-dir")) {
+    if (event->mimeData()->hasFormat("network/sync-dir")) {
+        QByteArray connectionData = event->mimeData()->data("network/sync-dir");
+        QDataStream dataStream(&connectionData, QIODevice::ReadOnly);
+        quint16 peerId;
+        dataStream >> peerId;
 
-		QByteArray connectionData = event->mimeData()->data("network/sync-dir");
-		QDataStream dataStream(&connectionData, QIODevice::ReadOnly);
-		quint16 peerId;
-		dataStream >> peerId;
-
-		auto cm = DkSyncManager::inst().client();
-		cm->synchronizeWithServerPort(peerId);
-	}
-	else
-		QMainWindow::dropEvent(event);
+        auto cm = DkSyncManager::inst().client();
+        cm->synchronizeWithServerPort(peerId);
+    } else
+        QMainWindow::dropEvent(event);
 }
 
-DkNoMacsIpl::DkNoMacsIpl(QWidget *parent, Qt::WindowFlags flags) : DkNoMacsSync(parent, flags) {
+DkNoMacsIpl::DkNoMacsIpl(QWidget *parent, Qt::WindowFlags flags)
+    : DkNoMacsSync(parent, flags)
+{
+    // init members
+    DkCentralWidget *cw = new DkCentralWidget(this);
+    setCentralWidget(cw);
 
-	// init members
-	DkCentralWidget* cw = new DkCentralWidget(this);
-	setCentralWidget(cw);
-	
-	init();
-	setAcceptDrops(true);
-	setMouseTracking (true);	//receive mouse event everytime
+    init();
+    setAcceptDrops(true);
+    setMouseTracking(true); // receive mouse event everytime
 
-	DkSettingsManager::param().app().appMode = 0;
-	DkSettingsManager::param().app().appMode = DkSettings::mode_default;
+    DkSettingsManager::param().app().appMode = 0;
+    DkSettingsManager::param().app().appMode = DkSettings::mode_default;
 }
 
 // FramelessNoMacs --------------------------------------------------------------------
 DkNoMacsFrameless::DkNoMacsFrameless(QWidget *parent, Qt::WindowFlags flags)
-	: DkNoMacs(parent, flags) {
+    : DkNoMacs(parent, flags)
+{
+    setObjectName("DkNoMacsFrameless");
+    DkSettingsManager::param().app().appMode = DkSettings::mode_frameless;
 
-		setObjectName("DkNoMacsFrameless");
-		DkSettingsManager::param().app().appMode = DkSettings::mode_frameless;
-		
-		setWindowFlags(Qt::FramelessWindowHint);
-		setAttribute(Qt::WA_TranslucentBackground, true);
+    setWindowFlags(Qt::FramelessWindowHint);
+    setAttribute(Qt::WA_TranslucentBackground, true);
 
-		// init members
-		DkCentralWidget* cw = new DkCentralWidget(this);
-		setCentralWidget(cw);
+    // init members
+    DkCentralWidget *cw = new DkCentralWidget(this);
+    setCentralWidget(cw);
 
-		init();
-		
-		setAcceptDrops(true);
-		setMouseTracking(true);	//receive mouse event everytime
+    init();
 
-		// in frameless, you cannot control if menu is visible...
-		DkActionManager& am = DkActionManager::instance();
-		am.action(DkActionManager::menu_panel_menu)->setEnabled(false);
-		am.action(DkActionManager::menu_panel_statusbar)->setEnabled(false);
-		am.action(DkActionManager::menu_panel_statusbar)->setChecked(false);
-		am.action(DkActionManager::menu_panel_toolbar)->setChecked(false);
+    setAcceptDrops(true);
+    setMouseTracking(true); // receive mouse event everytime
 
-		mMenu->setTimeToShow(5000);
-		mMenu->hide();
-		
-		am.action(DkActionManager::menu_view_frameless)->blockSignals(true);
-		am.action(DkActionManager::menu_view_frameless)->setChecked(true);
-		am.action(DkActionManager::menu_view_frameless)->blockSignals(false);
+    // in frameless, you cannot control if menu is visible...
+    DkActionManager &am = DkActionManager::instance();
+    am.action(DkActionManager::menu_panel_menu)->setEnabled(false);
+    am.action(DkActionManager::menu_panel_statusbar)->setEnabled(false);
+    am.action(DkActionManager::menu_panel_statusbar)->setChecked(false);
+    am.action(DkActionManager::menu_panel_toolbar)->setChecked(false);
 
-		mDesktop = QApplication::desktop();
+    mMenu->setTimeToShow(5000);
+    mMenu->hide();
 
-		chooseMonitor(false);
-		show();
-        
-        connect(mDesktop, SIGNAL(workAreaResized(int)), this, SLOT(chooseMonitor()));
-		connect(am.action(DkActionManager::menu_view_monitors), SIGNAL(triggered()), this, SLOT(chooseMonitor()));
+    am.action(DkActionManager::menu_view_frameless)->blockSignals(true);
+    am.action(DkActionManager::menu_view_frameless)->setChecked(true);
+    am.action(DkActionManager::menu_view_frameless)->blockSignals(false);
 
-		setObjectName("DkNoMacsFrameless");
-		DkStatusBarManager::instance().show(false);	// fix
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+    mDesktop = QApplication::desktop();
 
-		// actions that should always be disabled
-		DkActionManager::instance().action(DkActionManager::menu_view_fit_frame)->setEnabled(false);
-}
+    chooseMonitor(false);
+#endif
+    show();
 
-DkNoMacsFrameless::~DkNoMacsFrameless() {
-}
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+    connect(mDesktop, SIGNAL(workAreaResized(int)), this, SLOT(chooseMonitor()));
+    connect(am.action(DkActionManager::menu_view_monitors), SIGNAL(triggered()), this, SLOT(chooseMonitor()));
+#endif
 
-void DkNoMacsFrameless::createContextMenu() {
+    setObjectName("DkNoMacsFrameless");
+    DkStatusBarManager::instance().show(false); // fix
 
-	DkNoMacs::createContextMenu();
+    // actions that should always be disabled
+    DkActionManager::instance().action(DkActionManager::menu_view_fit_frame)->setEnabled(false);
+}
 
-	DkActionManager& am = DkActionManager::instance();
-	am.contextMenu()->addSeparator();
-	am.contextMenu()->addAction(am.action(DkActionManager::menu_file_exit));
+DkNoMacsFrameless::~DkNoMacsFrameless()
+{
 }
 
-void DkNoMacsFrameless::chooseMonitor(bool force) {
+void DkNoMacsFrameless::createContextMenu()
+{
+    DkNoMacs::createContextMenu();
+
+    DkActionManager &am = DkActionManager::instance();
+    am.contextMenu()->addSeparator();
+    am.contextMenu()->addAction(am.action(DkActionManager::menu_file_exit));
+}
 
-	if (!mDesktop)
-		return;
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+void DkNoMacsFrameless::chooseMonitor(bool force)
+{
+    if (!mDesktop)
+        return;
 
-	QRect screenRect = mDesktop->availableGeometry();
+    QRect screenRect = mDesktop->availableGeometry();
 
-	// ask the user which monitor to use
-	if (mDesktop->screenCount() > 1) {
-		DkChooseMonitorDialog* cmd = new DkChooseMonitorDialog(this);
-		cmd->setWindowTitle(tr("Choose a Monitor"));
+    // ask the user which monitor to use
+    if (mDesktop->screenCount() > 1) {
+        DkChooseMonitorDialog *cmd = new DkChooseMonitorDialog(this);
+        cmd->setWindowTitle(tr("Choose a Monitor"));
 
-		if (force || cmd->showDialog()) {
-			int answer = cmd->exec();
-			if (answer == QDialog::Accepted) {
-				screenRect = cmd->screenRect();
-			}
-		}
-		else {
-			screenRect = cmd->screenRect();
-		}
-	}
+        if (force || cmd->showDialog()) {
+            int answer = cmd->exec();
+            if (answer == QDialog::Accepted) {
+                screenRect = cmd->screenRect();
+            }
+        } else {
+            screenRect = cmd->screenRect();
+        }
+    }
 
-	setGeometry(screenRect);
+    setGeometry(screenRect);
 }
+#endif
 
 // >DIR diem: eating shortcut overrides
-bool DkNoMacsFrameless::eventFilter(QObject* , QEvent* event) {
+bool DkNoMacsFrameless::eventFilter(QObject *, QEvent *event)
+{
+    if (event->type() == QEvent::ShortcutOverride) {
+        QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
 
-	if (event->type() == QEvent::ShortcutOverride) {
-		QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
+        // consume esc key if fullscreen is on
+        if (keyEvent->key() == Qt::Key_Escape && isFullScreen()) {
+            exitFullScreen();
+            return true;
+        } else if (keyEvent->key() == Qt::Key_Escape) {
+            close();
+            return true;
+        }
+    }
+    // if (event->type() == QEvent::Gesture) {
+    //	return gestureEvent(static_cast<QGestureEvent*>(event));
+    // }
 
-		// consume esc key if fullscreen is on
-		if (keyEvent->key() == Qt::Key_Escape && isFullScreen()) {
-			exitFullScreen();
-			return true;
-		}
-		else if (keyEvent->key() == Qt::Key_Escape) {
-			close();
-			return true;
-		}
-	}
-	//if (event->type() == QEvent::Gesture) {
-	//	return gestureEvent(static_cast<QGestureEvent*>(event));
-	//}
-
-	return false;
+    return false;
 }
 
-void DkNoMacsFrameless::closeEvent(QCloseEvent *event) {
-
-	// do not save the window size
-	if (mSaveSettings)
-		DkSettingsManager::param().save();
+void DkNoMacsFrameless::closeEvent(QCloseEvent *event)
+{
+    // do not save the window size
+    if (mSaveSettings)
+        DkSettingsManager::param().save();
 
-	mSaveSettings = false;
+    mSaveSettings = false;
 
-	DkNoMacs::closeEvent(event);
+    DkNoMacs::closeEvent(event);
 }
 
 // Transfer function:
 
 DkNoMacsContrast::DkNoMacsContrast(QWidget *parent, Qt::WindowFlags flags)
-	: DkNoMacsSync(parent, flags) {
-
-		setObjectName("DkNoMacsContrast");
+    : DkNoMacsSync(parent, flags)
+{
+    setObjectName("DkNoMacsContrast");
 
-		// init members
-		DkCentralWidget* cw = new DkCentralWidget(this);
-		setCentralWidget(cw);
+    // init members
+    DkCentralWidget *cw = new DkCentralWidget(this);
+    setCentralWidget(cw);
 
-		init();
+    init();
 
-		DkToolBarManager::inst().createTransferToolBar();
+    DkToolBarManager::inst().createTransferToolBar();
 
-		setAcceptDrops(true);
-		setMouseTracking (true);	//receive mouse event everytime
+    setAcceptDrops(true);
+    setMouseTracking(true); // receive mouse event everytime
 
-		DkSettingsManager::param().app().appMode = DkSettings::mode_contrast;
-		setObjectName("DkNoMacsContrast");
+    DkSettingsManager::param().app().appMode = DkSettings::mode_contrast;
+    setObjectName("DkNoMacsContrast");
 
-		// show it...
-		show();
+    // show it...
+    show();
 
-		// TODO: this should be checked but no event should be called
-		DkActionManager& am = DkActionManager::instance();
-		am.action(DkActionManager::menu_panel_transfertoolbar)->blockSignals(true);
-		am.action(DkActionManager::menu_panel_transfertoolbar)->setChecked(true);
-		am.action(DkActionManager::menu_panel_transfertoolbar)->blockSignals(false);
+    // TODO: this should be checked but no event should be called
+    DkActionManager &am = DkActionManager::instance();
+    am.action(DkActionManager::menu_panel_transfertoolbar)->blockSignals(true);
+    am.action(DkActionManager::menu_panel_transfertoolbar)->setChecked(true);
+    am.action(DkActionManager::menu_panel_transfertoolbar)->blockSignals(false);
 }
 
-DkNoMacsContrast::~DkNoMacsContrast() {
+DkNoMacsContrast::~DkNoMacsContrast()
+{
 }
 
 }
diff --git a/ImageLounge/src/DkGui/DkNoMacs.h b/ImageLounge/src/DkGui/DkNoMacs.h
index 6a9d1f7..98476cb 100644
--- a/ImageLounge/src/DkGui/DkNoMacs.h
+++ b/ImageLounge/src/DkGui/DkNoMacs.h
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkNoMacs.h
  Created on:	21.04.2011
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -30,16 +30,16 @@
 #pragma once
 
 // Qt
-#pragma warning(push, 0)	// no warnings from includes - begin
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QMainWindow>
 #include <QProcess>
-#pragma warning(pop)		// no warnings from includes - end
+#pragma warning(pop) // no warnings from includes - end
 
 #include "DkImageContainer.h"
 
 #ifdef Q_OS_WIN
-	#pragma warning(disable: 4996)
-	#pragma warning(disable: 4251)	// TODO: remove
+#pragma warning(disable : 4996)
+#pragma warning(disable : 4251) // TODO: remove
 #endif
 
 #ifndef DllCoreExport
@@ -59,7 +59,8 @@ class QDesktopWidget;
 class QLabel;
 class QShortcut;
 
-namespace nmc {
+namespace nmc
+{
 
 class DkCompressDialog;
 class DkOpacityDialog;
@@ -69,7 +70,7 @@ class DkTrainDialog;
 #ifdef WITH_QUAZIP
 class DkArchiveExtractionDialog;
 #endif
-class DkBrowseExplorer;
+class DkExplorer;
 class DkMetaDataDock;
 class DkEditDock;
 class DkHistoryDock;
@@ -94,260 +95,260 @@ Its main purpose is to provide Mac OS X "open file from finder"
 functionality for nomacs. It *has* to be catched on the
 QApplication level in the event().
 */
-class DkNomacsOSXEventFilter : public QObject {
-	Q_OBJECT
+class DkNomacsOSXEventFilter : public QObject
+{
+    Q_OBJECT
 
 public:
-	DkNomacsOSXEventFilter(QObject *parent = 0);
+    DkNomacsOSXEventFilter(QObject *parent = 0);
 
 signals:
-	void loadFile(const QString& fi) const;
+    void loadFile(const QString &fi) const;
 
 protected:
-	/*! Handle QFileOpenEvent for mac here */
-	bool eventFilter(QObject *obj, QEvent *event) override;
-
+    /*! Handle QFileOpenEvent for mac here */
+    bool eventFilter(QObject *obj, QEvent *event) override;
 };
 
 class DkMenuBar;
 
 enum PluginMenuActions {
-	menu_plugin_manager,
+    menu_plugin_manager,
 
-	menu_plugins_end,	// nothing beyond this point
+    menu_plugins_end, // nothing beyond this point
 };
 
-
-class DllCoreExport DkNoMacs : public QMainWindow {
-	Q_OBJECT
+class DllCoreExport DkNoMacs : public QMainWindow
+{
+    Q_OBJECT
 
 public:
+    virtual ~DkNoMacs();
+
+    virtual DkCentralWidget *getTabWidget() const;
 
-	virtual ~DkNoMacs();
-	
-	virtual DkCentralWidget* getTabWidget() const;
-	
-	void loadFile(const QString& filePath);
+    void loadFile(const QString &filePath);
 
-	bool mSaveSettings = true;
+    bool mSaveSettings = true;
 
 signals:
-	void sendArrangeSignal(bool overlaid) const;
-	void closeSignal() const;
-	void sendQuitLocalClientsSignal() const;
+    void sendArrangeSignal(bool overlaid) const;
+    void closeSignal() const;
+    void sendQuitLocalClientsSignal() const;
 
 public slots:
-	void toggleFullScreen();
-	void enterFullScreen();
-	void exitFullScreen();
-	void toggleDocks(bool hide);
-	void restoreDocks();
-	void showExplorer(bool show, bool saveSettings = true);
-	void showMetaDataDock(bool show, bool saveSettings = true);
-	void showEditDock(bool show, bool saveSettings = true);
-	void showHistoryDock(bool show, bool saveSettings = true);
-	void showLogDock(bool show, bool saveSettings = true);
-	void showThumbsDock(bool show);
-	void thumbsDockAreaChanged();
-	void openDir();
-	void openFile();
-	void openQuickLaunch();
-	void openFileList();
-	void saveFileList();
-	void renameFile();
-	void changeSorting(bool change);
-	void goTo();
-	void find(bool filterAction = true);
-	void extractImagesFromArchive();
-	void trainFormat();
-	void exportTiff();
-	void cleanSettings();
-	void newInstance(const QString& filePath = QString());
-	void showMenuBar(bool show);
-	void openFileWith(QAction* action);
-	void aboutDialog();
-	void openDocumentation();
-	void bugReport();
-	void loadRecursion();
-	void setWindowTitle(QSharedPointer<DkImageContainerT> imgC);
-	void setWindowTitle(const QString& filePath, const QSize& size = QSize(), bool edited = false, const QString& attr = QString());
-	void showOpacityDialog();
-	void opacityUp();
-	void opacityDown();
-	void changeOpacity(float change);
-	void animateChangeOpacity();
-	void animateOpacityUp();
-	void animateOpacityDown();
-	void lockWindow(bool lock);
-	void tcpSetWindowRect(QRect newRect, bool opacity, bool overlaid);
-	void tcpSendWindowRect();
-	void tcpSendArrange();
-	void newClientConnected(bool connected);
-	virtual void settingsChanged();
-	void showUpdaterMessage(QString msg, QString title);
-	void showUpdateDialog(QString msg, QString title);
-	void performUpdate();
-	void updateProgress(qint64 received, qint64 total);
-	void updateProgressTranslations(qint64 received, qint64 total);
-	void startSetup(QString);
-	void updateTranslations();
-	void checkForUpdate(bool silent = false);
-	void startPong() const;
-	void fitFrame();
-	void setRecursiveScan(bool recursive);
-	void openPluginManager();
-	void clearFileHistory();
-	void clearFolderHistory();
-	void restartWithTranslationUpdate();
-	void restartWithPseudoColor(bool contrast);
-	void restartFrameless(bool frameless);
-	void showRecentFilesOnStartUp();
-
-	// batch actions
-	void computeThumbsBatch();
-	void onWindowLoaded();
+    void toggleFullScreen();
+    void enterFullScreen();
+    void exitFullScreen();
+    void toggleDocks(bool hide);
+    void restoreDocks();
+    void showExplorer(bool show, bool saveSettings = true);
+    void showMetaDataDock(bool show, bool saveSettings = true);
+    void showEditDock(bool show, bool saveSettings = true);
+    void showHistoryDock(bool show, bool saveSettings = true);
+    void showLogDock(bool show, bool saveSettings = true);
+    void showThumbsDock(bool show);
+    void thumbsDockAreaChanged();
+    void openDir();
+    void openFile();
+    void openQuickLaunch();
+    void openFileList();
+    void saveFileList();
+    void renameFile();
+    void changeSorting(bool change);
+    void goTo();
+    void find(bool filterAction = true);
+    void extractImagesFromArchive();
+    void trainFormat();
+    void exportTiff();
+    void cleanSettings();
+    void newInstance(const QString &filePath = QString());
+    void showMenuBar(bool show);
+    void openFileWith(QAction *action);
+    void aboutDialog();
+    void openDocumentation();
+    void bugReport();
+    void loadRecursion();
+    void setWindowTitle(QSharedPointer<DkImageContainerT> imgC);
+    void setWindowTitle(const QString &filePath, const QSize &size = QSize(), bool edited = false, const QString &attr = QString());
+    void showOpacityDialog();
+    void opacityUp();
+    void opacityDown();
+    void changeOpacity(float change);
+    void animateChangeOpacity();
+    void animateOpacityUp();
+    void animateOpacityDown();
+    void lockWindow(bool lock);
+    void tcpSetWindowRect(QRect newRect, bool opacity, bool overlaid);
+    void tcpSendWindowRect();
+    void tcpSendArrange();
+    void newClientConnected(bool connected);
+    virtual void settingsChanged();
+    void showUpdaterMessage(QString msg, QString title);
+    void showUpdateDialog(QString msg, QString title);
+    void performUpdate();
+    void updateProgress(qint64 received, qint64 total);
+    void updateProgressTranslations(qint64 received, qint64 total);
+    void startSetup(QString);
+    void updateTranslations();
+    void checkForUpdate(bool silent = false);
+    void startPong() const;
+    void fitFrame();
+    void setRecursiveScan(bool recursive);
+    void openPluginManager();
+    void clearFileHistory();
+    void clearFolderHistory();
+    void restartWithTranslationUpdate();
+    void restartWithPseudoColor(bool contrast);
+    void restartFrameless(bool frameless);
+    void showRecentFilesOnStartUp();
+
+    // batch actions
+    void computeThumbsBatch();
+    void onWindowLoaded();
 
 protected:
-	
-	// mouse events
-	void mouseDoubleClickEvent(QMouseEvent* event) override;
-	void mousePressEvent(QMouseEvent* event) override;
-	void mouseReleaseEvent(QMouseEvent *event) override;
-	void mouseMoveEvent(QMouseEvent *event) override;
-
-	// mouse events
-	void moveEvent(QMoveEvent *event) override;
-
-	// window events
-	void contextMenuEvent(QContextMenuEvent *event) override;
-	bool eventFilter(QObject *obj, QEvent *event) override;
-	void resizeEvent(QResizeEvent *event) override;
-	void closeEvent(QCloseEvent *event) override;
-
-	void keyPressEvent(QKeyEvent *event) override;
-	void keyReleaseEvent(QKeyEvent* event) override;
-
-	//bool gestureEvent(QGestureEvent *event);
-
-	// needed to hide menu
-	bool mOtherKeyPressed = true;
-	QPoint mPosGrabKey;
-	bool mOverlaid = false;
-	
-	// menu
-	DkMenuBar* mMenu = 0;
-	QMenu* mPluginsMenu = 0;
-	QMenu* mSyncMenu = 0;
-
-	QPoint mMousePos;
-	
-	// quick access
-	DkQuickAccessEdit* mQuickAccessEdit = 0;
-	DkQuickAccess* mQuickAccess = 0;
-
-	// file dialog
-	QFileDialog* mOpenDialog = 0;
-	QFileDialog* mSaveDialog = 0;
-	DkOpacityDialog* mOpacityDialog = 0;
-	DkUpdateDialog* mUpdateDialog = 0;
-	QProgressDialog* mProgressDialog = 0;
-	QProgressDialog* mProgressDialogTranslations = 0;
-	DkForceThumbDialog* mForceDialog = 0;
-	DkTrainDialog* mTrainDialog = 0;
+    // mouse events
+    void mouseDoubleClickEvent(QMouseEvent *event) override;
+    void mousePressEvent(QMouseEvent *event) override;
+    void mouseReleaseEvent(QMouseEvent *event) override;
+    void mouseMoveEvent(QMouseEvent *event) override;
+
+    // mouse events
+    void moveEvent(QMoveEvent *event) override;
+
+    // window events
+    void contextMenuEvent(QContextMenuEvent *event) override;
+    bool eventFilter(QObject *obj, QEvent *event) override;
+    void resizeEvent(QResizeEvent *event) override;
+    void closeEvent(QCloseEvent *event) override;
+
+    void keyPressEvent(QKeyEvent *event) override;
+    void keyReleaseEvent(QKeyEvent *event) override;
+
+    // bool gestureEvent(QGestureEvent *event);
+
+    // needed to hide menu
+    bool mOtherKeyPressed = true;
+    QPoint mPosGrabKey;
+    bool mOverlaid = false;
+
+    // menu
+    DkMenuBar *mMenu = 0;
+    QMenu *mPluginsMenu = 0;
+    QMenu *mSyncMenu = 0;
+
+    QPoint mMousePos;
+
+    // quick access
+    DkQuickAccessEdit *mQuickAccessEdit = 0;
+    DkQuickAccess *mQuickAccess = 0;
+
+    // file dialog
+    QFileDialog *mOpenDialog = 0;
+    QFileDialog *mSaveDialog = 0;
+    DkOpacityDialog *mOpacityDialog = 0;
+    DkUpdateDialog *mUpdateDialog = 0;
+    QProgressDialog *mProgressDialog = 0;
+    QProgressDialog *mProgressDialogTranslations = 0;
+    DkForceThumbDialog *mForceDialog = 0;
+    DkTrainDialog *mTrainDialog = 0;
 #ifdef WITH_QUAZIP
-	DkArchiveExtractionDialog* mArchiveExtractionDialog = 0;
+    DkArchiveExtractionDialog *mArchiveExtractionDialog = 0;
 #endif
-	DkBrowseExplorer* mExplorer = 0;
-	DkMetaDataDock* mMetaDataDock = 0;
-	DkEditDock* mEditDock = 0;
-	DkHistoryDock* mHistoryDock = 0;
-	DkLogDock* mLogDock = 0;
-	DkDockWidget* mThumbsDock = 0;
-	DkExportTiffDialog* mExportTiffDialog = 0;
-	DkThumbsSaver* mThumbSaver = 0;
-
-	DkPrintPreviewDialog* mPrintPreviewDialog = 0;
-
-	DkInstallUpdater* mInstallUpdater = 0;
-	DkUpdater* mUpdater = 0;
-	DkTranslationUpdater* mTranslationUpdater = 0;	
-
-	QRect mOldGeometry;
-	QProcess mProcess;
-
-	// functions
-	DkNoMacs(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
-
-	virtual void init();
-	
-	void loadStyleSheet();
-	virtual void createActions();
-	virtual void createMenu();
-	virtual void createContextMenu();
-	virtual void createStatusBar();
-
-	virtual void readSettings();
-
-	// plugin functions
-	bool mPluginMenuCreated = false;
+    DkExplorer *mExplorer = 0;
+    DkMetaDataDock *mMetaDataDock = 0;
+    DkEditDock *mEditDock = 0;
+    DkHistoryDock *mHistoryDock = 0;
+    DkLogDock *mLogDock = 0;
+    DkDockWidget *mThumbsDock = 0;
+    DkExportTiffDialog *mExportTiffDialog = 0;
+    DkThumbsSaver *mThumbSaver = 0;
+
+    DkPrintPreviewDialog *mPrintPreviewDialog = 0;
+
+    DkInstallUpdater *mInstallUpdater = 0;
+    DkUpdater *mUpdater = 0;
+    DkTranslationUpdater *mTranslationUpdater = 0;
+
+    QRect mOldGeometry;
+    QProcess mProcess;
+
+    // functions
+    DkNoMacs(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
+
+    virtual void init();
+
+    void loadStyleSheet();
+    virtual void createActions();
+    virtual void createMenu();
+    virtual void createContextMenu();
+    virtual void createStatusBar();
+
+    virtual void readSettings();
+
+    // plugin functions
+    bool mPluginMenuCreated = false;
 };
 
-class DllCoreExport DkNoMacsSync : public DkNoMacs {
-	Q_OBJECT
+class DllCoreExport DkNoMacsSync : public DkNoMacs
+{
+    Q_OBJECT
 
 public:
-	DkNoMacsSync(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
-	~DkNoMacsSync();
-	
+    DkNoMacsSync(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
+    ~DkNoMacsSync();
+
 signals:
-	void startRCServerSignal(bool start);
+    void startRCServerSignal(bool start);
 
 protected:
+    // mouse events
+    void dragEnterEvent(QDragEnterEvent *event) override;
+    void dropEvent(QDropEvent *event) override;
+    void mouseMoveEvent(QMouseEvent *event) override;
 
-	// mouse events
-	void dragEnterEvent(QDragEnterEvent *event) override;
-	void dropEvent(QDropEvent *event) override;
-	void mouseMoveEvent(QMouseEvent *event) override;
-
-	// gui
-	virtual void createActions() override;
+    // gui
+    virtual void createActions() override;
 };
 
-class DllCoreExport DkNoMacsIpl : public DkNoMacsSync {
-	Q_OBJECT
+class DllCoreExport DkNoMacsIpl : public DkNoMacsSync
+{
+    Q_OBJECT
 
 public:
-	DkNoMacsIpl(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
+    DkNoMacsIpl(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
 };
 
-
-
-class DllCoreExport DkNoMacsFrameless : public DkNoMacs {
-	Q_OBJECT
+class DllCoreExport DkNoMacsFrameless : public DkNoMacs
+{
+    Q_OBJECT
 
 public:
-	DkNoMacsFrameless(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
-	
-	virtual ~DkNoMacsFrameless();
+    DkNoMacsFrameless(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
+
+    virtual ~DkNoMacsFrameless();
 
 public slots:
-	void chooseMonitor(bool force = true);
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+    void chooseMonitor(bool force = true);
+#endif
 
 protected:
-	void closeEvent(QCloseEvent *event) override;
-	bool eventFilter(QObject *obj, QEvent *event) override;
-	virtual void createContextMenu() override;
+    void closeEvent(QCloseEvent *event) override;
+    bool eventFilter(QObject *obj, QEvent *event) override;
+    virtual void createContextMenu() override;
 
-	QDesktopWidget* mDesktop = 0;
+    QDesktopWidget *mDesktop = 0;
 };
 
-class DllCoreExport DkNoMacsContrast : public DkNoMacsSync {
-	Q_OBJECT
+class DllCoreExport DkNoMacsContrast : public DkNoMacsSync
+{
+    Q_OBJECT
 
 public:
-	DkNoMacsContrast(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
-	
-	virtual ~DkNoMacsContrast();
+    DkNoMacsContrast(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
 
+    virtual ~DkNoMacsContrast();
 };
 }
diff --git a/ImageLounge/src/DkGui/DkPong.cpp b/ImageLounge/src/DkGui/DkPong.cpp
index e9be6e2..a5ed683 100644
--- a/ImageLounge/src/DkGui/DkPong.cpp
+++ b/ImageLounge/src/DkGui/DkPong.cpp
@@ -1,711 +1,730 @@
- /*******************************************************************************************************
- DkViewPort.cpp
- Created on:	05.05.2011
- 
- nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
- Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
- Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
- Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
+/*******************************************************************************************************
+DkViewPort.cpp
+Created on:	05.05.2011
 
- This file is part of nomacs.
+nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
 
- nomacs is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
+Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
+Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
 
- nomacs is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
+This file is part of nomacs.
 
- You should have received a copy of the GNU General Public License
- along with this program.  If not, see <http://www.gnu.org/licenses/>.
+nomacs is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
 
- *******************************************************************************************************/
+nomacs is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+*******************************************************************************************************/
 
 #include "DkPong.h"
 
 #include "DkSettings.h"
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QTimer>
+#pragma warning(push, 0) // no warnings from includes - begin
+#include <QApplication>
 #include <QDebug>
-#include <QVector2D>
 #include <QKeyEvent>
-#include <QTime>
-#include <QApplication>
-#include <QDesktopWidget>
+#include <QRandomGenerator>
+#include <QScreen>
 #include <QSettings>
-#pragma warning(pop)		// no warnings from includes - end
-
-namespace nmc {
+#include <QTime>
+#include <QTimer>
+#include <QVector2D>
+#pragma warning(pop) // no warnings from includes - end
 
+namespace nmc
+{
 
 // DkPongSettings --------------------------------------------------------------------
-DkPongSettings::DkPongSettings() {
-	loadSettings();
+DkPongSettings::DkPongSettings()
+{
+    loadSettings();
 }
 
-void DkPongSettings::setField(const QRect & field) {
-	mField = field;
+void DkPongSettings::setField(const QRect &field)
+{
+    mField = field;
 }
 
-QRect DkPongSettings::field() const {
-	return mField;
+QRect DkPongSettings::field() const
+{
+    return mField;
 }
 
-void DkPongSettings::setUnit(int unit) {
-	mUnit = unit;
+void DkPongSettings::setUnit(int unit)
+{
+    mUnit = unit;
 }
 
-int DkPongSettings::unit() const {
-	return mUnit;
+int DkPongSettings::unit() const
+{
+    return mUnit;
 }
 
-void DkPongSettings::setBackgroundColor(const QColor & col) {
-	mBgCol = col;
+void DkPongSettings::setBackgroundColor(const QColor &col)
+{
+    mBgCol = col;
 }
 
-QColor DkPongSettings::backgroundColor() const {
-	return mBgCol;
+QColor DkPongSettings::backgroundColor() const
+{
+    return mBgCol;
 }
 
-void DkPongSettings::setForegroundColor(const QColor & col) {
-	mFgCol = col;
+void DkPongSettings::setForegroundColor(const QColor &col)
+{
+    mFgCol = col;
 }
 
-QColor DkPongSettings::foregroundColor() const {
-	return mFgCol;
+QColor DkPongSettings::foregroundColor() const
+{
+    return mFgCol;
 }
 
-void DkPongSettings::setTotalScore(int maxScore) {
-	mTotalScore = maxScore;
+void DkPongSettings::setTotalScore(int maxScore)
+{
+    mTotalScore = maxScore;
 }
 
-int DkPongSettings::totalScore() const {
-	return mTotalScore;
+int DkPongSettings::totalScore() const
+{
+    return mTotalScore;
 }
 
-void DkPongSettings::writeSettings() {
+void DkPongSettings::writeSettings()
+{
+    DefaultSettings settings;
+    settings.beginGroup("DkPong");
 
-	DefaultSettings settings;
-	settings.beginGroup("DkPong");
+    settings.setValue("field", mField);
+    settings.setValue("unit", mUnit);
+    settings.setValue("totalScore", mTotalScore);
 
-	settings.setValue("field", mField);
-	settings.setValue("unit", mUnit);
-	settings.setValue("totalScore", mTotalScore);
+    settings.setValue("backgroundColor", mBgCol.name());
+    settings.setValue("foregroundColor", mFgCol.name());
 
-	settings.setValue("backgroundColor", mBgCol.name());
-	settings.setValue("foregroundColor", mFgCol.name());
+    settings.setValue("backgroundAlpha", mBgCol.alpha());
+    settings.setValue("foregroundAlpha", mFgCol.alpha());
 
-	settings.setValue("backgroundAlpha", mBgCol.alpha());
-	settings.setValue("foregroundAlpha", mFgCol.alpha());
+    settings.setValue("player1Name", mPlayer1Name);
+    settings.setValue("player2Name", mPlayer2Name);
 
-	settings.setValue("player1Name", mPlayer1Name);
-	settings.setValue("player2Name", mPlayer2Name);
-	
-	settings.setValue("playerRatio", qRound(mPlayerRatio*100.0f));
+    settings.setValue("playerRatio", qRound(mPlayerRatio * 100.0f));
 
-	settings.endGroup();
+    settings.endGroup();
 
-	qDebug() << "settings written...";
+    qDebug() << "settings written...";
 }
 
-QString DkPongSettings::player1Name() const {
-	return mPlayer1Name;
+QString DkPongSettings::player1Name() const
+{
+    return mPlayer1Name;
 }
 
-QString DkPongSettings::player2Name() const {
-	return mPlayer2Name;
+QString DkPongSettings::player2Name() const
+{
+    return mPlayer2Name;
 }
 
-float DkPongSettings::playerRatio() const {
-	return mPlayerRatio;
+float DkPongSettings::playerRatio() const
+{
+    return mPlayerRatio;
 }
 
-void DkPongSettings::loadSettings() {
-
-	DefaultSettings settings;
-	settings.beginGroup("DkPong");
+void DkPongSettings::loadSettings()
+{
+    DefaultSettings settings;
+    settings.beginGroup("DkPong");
 
-	mField = settings.value("field", mField).toRect();
-	mUnit = settings.value("unit", mUnit).toInt();
-	mTotalScore = settings.value("totalScore", mTotalScore).toInt();
+    mField = settings.value("field", mField).toRect();
+    mUnit = settings.value("unit", mUnit).toInt();
+    mTotalScore = settings.value("totalScore", mTotalScore).toInt();
 
-	mPlayer1Name = settings.value("player1Name", mPlayer1Name).toString();
-	mPlayer2Name = settings.value("player2Name", mPlayer2Name).toString();
+    mPlayer1Name = settings.value("player1Name", mPlayer1Name).toString();
+    mPlayer2Name = settings.value("player2Name", mPlayer2Name).toString();
 
-	mPlayerRatio = settings.value("playerRatio", qRound(mPlayerRatio*100)).toInt()/100.0f;
+    mPlayerRatio = settings.value("playerRatio", qRound(mPlayerRatio * 100)).toInt() / 100.0f;
 
-	int bgAlpha = settings.value("backgroundAlpha", mBgCol.alpha()).toInt();
-	int fgAlpha = settings.value("foregroundAlpha", mFgCol.alpha()).toInt();
+    int bgAlpha = settings.value("backgroundAlpha", mBgCol.alpha()).toInt();
+    int fgAlpha = settings.value("foregroundAlpha", mFgCol.alpha()).toInt();
 
-	mBgCol.setNamedColor(settings.value("backgroundColor", mBgCol.name()).toString());
-	mFgCol.setNamedColor(settings.value("foregroundColor", mFgCol.name()).toString());
+    mBgCol.setNamedColor(settings.value("backgroundColor", mBgCol.name()).toString());
+    mFgCol.setNamedColor(settings.value("foregroundColor", mFgCol.name()).toString());
 
-	mBgCol.setAlpha(bgAlpha);
-	mFgCol.setAlpha(fgAlpha);
+    mBgCol.setAlpha(bgAlpha);
+    mFgCol.setAlpha(fgAlpha);
 
-	settings.endGroup();
+    settings.endGroup();
 }
 
 // DkPlayer --------------------------------------------------------------------
-DkPongPlayer::DkPongPlayer(const QString& playerName, QSharedPointer<DkPongSettings> settings) {
+DkPongPlayer::DkPongPlayer(const QString &playerName, QSharedPointer<DkPongSettings> settings)
+{
+    mPlayerName = playerName;
+    mS = settings;
+    mSpeed = 0;
+    mPos = INT_MAX;
 
-	mPlayerName = playerName;
-	mS = settings;
-	mSpeed = 0;
-	mPos = INT_MAX;
-
-	mRect = QRect(QPoint(), QSize(settings->unit(), 2*settings->unit()));
+    mRect = QRect(QPoint(), QSize(settings->unit(), 2 * settings->unit()));
 }
 
-void DkPongPlayer::reset(const QPoint& pos) {
-	mRect.moveCenter(pos);
+void DkPongPlayer::reset(const QPoint &pos)
+{
+    mRect.moveCenter(pos);
 }
 
-int DkPongPlayer::pos() const {
-	return mPos;
+int DkPongPlayer::pos() const
+{
+    return mPos;
 }
 
-QRect DkPongPlayer::rect() const {
-	return mRect;
+QRect DkPongPlayer::rect() const
+{
+    return mRect;
 }
 
-void DkPongPlayer::setHeight(int newHeight) {
-	mRect.setHeight(newHeight);
+void DkPongPlayer::setHeight(int newHeight)
+{
+    mRect.setHeight(newHeight);
 }
 
-void DkPongPlayer::move() {
-
-	if (mRect.top() + mSpeed < 0)
-		mRect.moveTop(0);
-	else if (mRect.bottom() + mSpeed > mS->field().height())
-		mRect.moveBottom(mS->field().height());
-	else
-		mRect.moveTop(mRect.top() + mSpeed);
+void DkPongPlayer::move()
+{
+    if (mRect.top() + mSpeed < 0)
+        mRect.moveTop(0);
+    else if (mRect.bottom() + mSpeed > mS->field().height())
+        mRect.moveBottom(mS->field().height());
+    else
+        mRect.moveTop(mRect.top() + mSpeed);
 }
 
-void DkPongPlayer::setSpeed(int speed) {
-	
-	mSpeed = speed;
+void DkPongPlayer::setSpeed(int speed)
+{
+    mSpeed = speed;
 
-	if (speed != 0)
-		mPos = mRect.center().y();
-	else
-		mPos = INT_MAX;
+    if (speed != 0)
+        mPos = mRect.center().y();
+    else
+        mPos = INT_MAX;
 }
 
-void DkPongPlayer::updateSize() {
-	mRect.setHeight(qRound(mS->field().height()*mS->playerRatio()));
+void DkPongPlayer::updateSize()
+{
+    mRect.setHeight(qRound(mS->field().height() * mS->playerRatio()));
 }
 
-void DkPongPlayer::increaseScore() {
-	mScore++;
+void DkPongPlayer::increaseScore()
+{
+    mScore++;
 }
 
-void DkPongPlayer::resetScore() {
-	mScore = 0;
+void DkPongPlayer::resetScore()
+{
+    mScore = 0;
 }
 
-int DkPongPlayer::score() const {
-	return mScore;
+int DkPongPlayer::score() const
+{
+    return mScore;
 }
 
-QString DkPongPlayer::name() const {
-	return mPlayerName;
+QString DkPongPlayer::name() const
+{
+    return mPlayerName;
 }
 
 // DkScoreLabel --------------------------------------------------------------------
-DkScoreLabel::DkScoreLabel(Qt::Alignment align, QWidget* parent, QSharedPointer<DkPongSettings> settings) : QLabel(parent) {
-	
-	mS = settings;
-	mAlign = align;
-	setStyleSheet("QLabel{ color: #fff;}");
-	setAlignment(Qt::AlignHCenter | Qt::AlignTop);
-	
-	mFont = QFont("terminal", 6);
-	setFont(mFont);
-	qDebug() << "using:" << mFont.family();
+DkScoreLabel::DkScoreLabel(Qt::Alignment align, QWidget *parent, QSharedPointer<DkPongSettings> settings)
+    : QLabel(parent)
+{
+    mS = settings;
+    mAlign = align;
+    setStyleSheet("QLabel{ color: #fff;}");
+    setAlignment(Qt::AlignHCenter | Qt::AlignTop);
+
+    mFont = QFont("terminal", 6);
+    setFont(mFont);
+    qDebug() << "using:" << mFont.family();
 }
 
-void DkScoreLabel::paintEvent(QPaintEvent* /*ev*/) {
+void DkScoreLabel::paintEvent(QPaintEvent * /*ev*/)
+{
+    QFontMetrics m(mFont);
 
-	QFontMetrics m(mFont);
-	
-	QPixmap buffer(m.width(text())-1, m.height());
-	buffer.fill(Qt::transparent);
-	//buffer.fill(Qt::red);
+    QPixmap buffer(m.horizontalAdvance(text()) - 1, m.height());
+    buffer.fill(Qt::transparent);
+    // buffer.fill(Qt::red);
 
-	// draw font
-	QPen fontPen(mS->foregroundColor());
+    // draw font
+    QPen fontPen(mS->foregroundColor());
 
-	QPainter bp(&buffer);
-	bp.setPen(fontPen);
-	bp.setFont(mFont);
-	bp.drawText(buffer.rect(), Qt::AlignHCenter | Qt::AlignVCenter, text());
-	bp.end();
+    QPainter bp(&buffer);
+    bp.setPen(fontPen);
+    bp.setFont(mFont);
+    bp.drawText(buffer.rect(), Qt::AlignHCenter | Qt::AlignVCenter, text());
+    bp.end();
 
-	QSize bSize(size());
-	bSize.setHeight(qRound(bSize.height() - mS->unit()*0.5));
-	buffer = buffer.scaled(bSize, Qt::KeepAspectRatio, Qt::FastTransformation);
+    QSize bSize(size());
+    bSize.setHeight(qRound(bSize.height() - mS->unit() * 0.5));
+    buffer = buffer.scaled(bSize, Qt::KeepAspectRatio, Qt::FastTransformation);
 
-	QRect r(buffer.rect());
+    QRect r(buffer.rect());
 
-	if (mAlign & Qt::AlignRight)
-		r.moveLeft(width() - (mS->unit() * 3 + buffer.width()));
-	else if (mAlign & Qt::AlignHCenter)
-		r.moveLeft(qRound((width() - buffer.width())*0.5f));
-	else
-		r.moveLeft(mS->unit() * 3);
+    if (mAlign & Qt::AlignRight)
+        r.moveLeft(width() - (mS->unit() * 3 + buffer.width()));
+    else if (mAlign & Qt::AlignHCenter)
+        r.moveLeft(qRound((width() - buffer.width()) * 0.5f));
+    else
+        r.moveLeft(mS->unit() * 3);
 
-	if (mAlign & Qt::AlignBottom)
-		r.moveBottom(height());
-	else
-		r.moveTop(qRound((height()-buffer.height())/2.0f));	// default: center
+    if (mAlign & Qt::AlignBottom)
+        r.moveBottom(height());
+    else
+        r.moveTop(qRound((height() - buffer.height()) / 2.0f)); // default: center
 
-	QPainter p(this);
-	p.drawPixmap(r, buffer);
+    QPainter p(this);
+    p.drawPixmap(r, buffer);
 
-	//QLabel::paintEvent(ev);
+    // QLabel::paintEvent(ev);
 }
 
 // DkPongPort --------------------------------------------------------------------
-DkPongPort::DkPongPort(QWidget *parent, Qt::WindowFlags) : QGraphicsView(parent) {
+DkPongPort::DkPongPort(QWidget *parent, Qt::WindowFlags)
+    : QGraphicsView(parent)
+{
+    setAttribute(Qt::WA_TranslucentBackground, true);
 
-	setAttribute(Qt::WA_TranslucentBackground, true);
+    mS = QSharedPointer<DkPongSettings>(new DkPongSettings());
+    mPlayerSpeed = qRound(mS->field().width() * 0.007);
 
-	mS = QSharedPointer<DkPongSettings>(new DkPongSettings());
-	mPlayerSpeed = qRound(mS->field().width()*0.007);
+    mBall = DkBall(mS);
+    mPlayer1 = DkPongPlayer(mS->player1Name(), mS);
+    mPlayer2 = DkPongPlayer(mS->player2Name(), mS);
 
-	mBall = DkBall(mS);
-	mPlayer1 = DkPongPlayer(mS->player1Name(), mS);
-	mPlayer2 = DkPongPlayer(mS->player2Name(), mS);
+    mP1Score = new DkScoreLabel(Qt::AlignRight, this, mS);
+    mP2Score = new DkScoreLabel(Qt::AlignLeft, this, mS);
+    mLargeInfo = new DkScoreLabel(Qt::AlignHCenter | Qt::AlignBottom, this, mS);
+    mSmallInfo = new DkScoreLabel(Qt::AlignHCenter, this, mS);
 
-	mP1Score = new DkScoreLabel(Qt::AlignRight, this, mS);
-	mP2Score = new DkScoreLabel(Qt::AlignLeft, this, mS);
-	mLargeInfo = new DkScoreLabel(Qt::AlignHCenter | Qt::AlignBottom, this, mS);
-	mSmallInfo = new DkScoreLabel(Qt::AlignHCenter, this, mS);
-	 
-	mEventLoop = new QTimer(this);
-	mEventLoop->setInterval(10);
-	//eventLoop->start();
+    mEventLoop = new QTimer(this);
+    mEventLoop->setInterval(10);
+    // eventLoop->start();
 
-	mCountDownTimer = new QTimer(this);
-	mCountDownTimer->setInterval(500);
+    mCountDownTimer = new QTimer(this);
+    mCountDownTimer->setInterval(500);
 
-	connect(mEventLoop, SIGNAL(timeout()), this, SLOT(gameLoop()));
-	connect(mCountDownTimer, SIGNAL(timeout()), this, SLOT(countDown()));
+    connect(mEventLoop, SIGNAL(timeout()), this, SLOT(gameLoop()));
+    connect(mCountDownTimer, SIGNAL(timeout()), this, SLOT(countDown()));
 
-	initGame();
-	pauseGame();
+    initGame();
+    pauseGame();
 }
 
-void DkPongPort::initGame() {
-	
-	mBall.reset();
-	mPlayer1.reset(QPoint(mS->unit(), qRound(height()*0.5f)));
-	mPlayer2.reset(QPoint(qRound(width()-mS->unit()*1.5f), qRound(height()*0.5f)));
+void DkPongPort::initGame()
+{
+    mBall.reset();
+    mPlayer1.reset(QPoint(mS->unit(), qRound(height() * 0.5f)));
+    mPlayer2.reset(QPoint(qRound(width() - mS->unit() * 1.5f), qRound(height() * 0.5f)));
 
-	if (mPlayer1.score() == 0 && mPlayer2.score() == 0) {
-		mP1Score->setText(mPlayer1.name());
-		mP2Score->setText(mPlayer2.name());
-	}
-	else {
-		mP1Score->setText(QString::number(mPlayer1.score()));
-		mP2Score->setText(QString::number(mPlayer2.score()));
-	}
+    if (mPlayer1.score() == 0 && mPlayer2.score() == 0) {
+        mP1Score->setText(mPlayer1.name());
+        mP2Score->setText(mPlayer2.name());
+    } else {
+        mP1Score->setText(QString::number(mPlayer1.score()));
+        mP2Score->setText(QString::number(mPlayer2.score()));
+    }
 
-	qDebug() << mPlayer1.score() << ":" << mPlayer2.score();
+    qDebug() << mPlayer1.score() << ":" << mPlayer2.score();
 
-	update();
+    update();
 }
 
-void DkPongPort::togglePause() {
-
-	pauseGame(mEventLoop->isActive());
+void DkPongPort::togglePause()
+{
+    pauseGame(mEventLoop->isActive());
 }
 
-void DkPongPort::pauseGame(bool pause) {
-
-	if (pause) {
-		mCountDownTimer->stop();
-		mEventLoop->stop();
-		mLargeInfo->setText(tr("PAUSED"));
-		mSmallInfo->setText(tr("Press <SPACE> to start."));
-	}
-	else {
-
-		mP1Score->setText(QString::number(mPlayer1.score()));
-		mP2Score->setText(QString::number(mPlayer2.score()));
+void DkPongPort::pauseGame(bool pause)
+{
+    if (pause) {
+        mCountDownTimer->stop();
+        mEventLoop->stop();
+        mLargeInfo->setText(tr("PAUSED"));
+        mSmallInfo->setText(tr("Press <SPACE> to start."));
+    } else {
+        mP1Score->setText(QString::number(mPlayer1.score()));
+        mP2Score->setText(QString::number(mPlayer2.score()));
 
-		if (mPlayer1.score() >= mS->totalScore() || mPlayer2.score() >= mS->totalScore()) {
-			mPlayer1.resetScore();
-			mPlayer2.resetScore();
-			initGame();
-		}
+        if (mPlayer1.score() >= mS->totalScore() || mPlayer2.score() >= mS->totalScore()) {
+            mPlayer1.resetScore();
+            mPlayer2.resetScore();
+            initGame();
+        }
 
-		mEventLoop->start();
-	}
+        mEventLoop->start();
+    }
 
-	mLargeInfo->setVisible(pause);
-	mSmallInfo->setVisible(pause);
+    mLargeInfo->setVisible(pause);
+    mSmallInfo->setVisible(pause);
 }
 
-DkPongPort::~DkPongPort() {
+DkPongPort::~DkPongPort()
+{
 }
 
-QSharedPointer<DkPongSettings> DkPongPort::settings() const {
-	return mS;
+QSharedPointer<DkPongSettings> DkPongPort::settings() const
+{
+    return mS;
 }
 
-void DkPongPort::countDown() {
-	
-	mCountDownSecs--;
-
-	if (mCountDownSecs == 0) {
-		mCountDownTimer->stop();
-		pauseGame(false);	// start
-	}
-	else
-		mLargeInfo->setText(QString::number(mCountDownSecs));
-}
-
-void DkPongPort::paintEvent(QPaintEvent* event) {
-
-	// propagate
-	QGraphicsView::paintEvent(event);
-
-	QPainter p(viewport());
-	p.setBackgroundMode(Qt::TransparentMode);
+void DkPongPort::countDown()
+{
+    mCountDownSecs--;
 
-	p.fillRect(QRect(QPoint(), size()), mS->backgroundColor());
-	drawField(p);
-
-	p.fillRect(mBall.rect(), mS->foregroundColor());
-	p.fillRect(mPlayer1.rect(), mS->foregroundColor());
-	p.fillRect(mPlayer2.rect(), mS->foregroundColor());
-
-	// clear area under text
-	if (mLargeInfo->isVisible()) {
-		p.fillRect(mLargeInfo->geometry(), mS->foregroundColor());
-		p.setCompositionMode(QPainter::CompositionMode_SourceIn);
-		p.fillRect(mLargeInfo->geometry(), mS->backgroundColor());
-		p.setCompositionMode(QPainter::CompositionMode_SourceOver);
-	}
-
-	// clear area under small text
-	if (mSmallInfo->isVisible()) {
-		p.fillRect(mSmallInfo->geometry(), mS->foregroundColor());
-		p.setCompositionMode(QPainter::CompositionMode_SourceIn);
-		p.fillRect(mSmallInfo->geometry(), mS->backgroundColor());
-		p.setCompositionMode(QPainter::CompositionMode_SourceOver);
-	}
-
-	p.end();
+    if (mCountDownSecs == 0) {
+        mCountDownTimer->stop();
+        pauseGame(false); // start
+    } else
+        mLargeInfo->setText(QString::number(mCountDownSecs));
 }
 
-void DkPongPort::drawField(QPainter& p) {
+void DkPongPort::paintEvent(QPaintEvent *event)
+{
+    // propagate
+    QGraphicsView::paintEvent(event);
 
-	QPen cPen = p.pen();
-	
-	// set dash pattern
-	QVector<qreal> dashes;
-	dashes << 0.1 << 3;
+    QPainter p(viewport());
+    p.setBackgroundMode(Qt::TransparentMode);
 
-	// create style
-	QPen linePen;
-	linePen.setColor(mS->foregroundColor());
-	linePen.setWidth(qRound(mS->unit()*0.5));
-	linePen.setDashPattern(dashes);
-	p.setPen(linePen);
+    p.fillRect(QRect(QPoint(), size()), mS->backgroundColor());
+    drawField(p);
 
-	// set line
-	QLine line(QPoint(qRound(width()*0.5f), 0), QPoint(qRound(width()*0.5f),height()));
-	p.drawLine(line);
+    p.fillRect(mBall.rect(), mS->foregroundColor());
+    p.fillRect(mPlayer1.rect(), mS->foregroundColor());
+    p.fillRect(mPlayer2.rect(), mS->foregroundColor());
 
-	p.setPen(cPen);
-}
+    // clear area under text
+    if (mLargeInfo->isVisible()) {
+        p.fillRect(mLargeInfo->geometry(), mS->foregroundColor());
+        p.setCompositionMode(QPainter::CompositionMode_SourceIn);
+        p.fillRect(mLargeInfo->geometry(), mS->backgroundColor());
+        p.setCompositionMode(QPainter::CompositionMode_SourceOver);
+    }
 
-void DkPongPort::startCountDown(int sec) {
+    // clear area under small text
+    if (mSmallInfo->isVisible()) {
+        p.fillRect(mSmallInfo->geometry(), mS->foregroundColor());
+        p.setCompositionMode(QPainter::CompositionMode_SourceIn);
+        p.fillRect(mSmallInfo->geometry(), mS->backgroundColor());
+        p.setCompositionMode(QPainter::CompositionMode_SourceOver);
+    }
 
-	mCountDownSecs = sec;
-	pauseGame();
-	mCountDownTimer->start();
-	mLargeInfo->setText(QString::number(mCountDownSecs));
-	mLargeInfo->show();
-	mSmallInfo->hide();
+    p.end();
 }
 
-void DkPongPort::resizeEvent(QResizeEvent *event) {
-
-	//resize(event->size());
+void DkPongPort::drawField(QPainter &p)
+{
+    QPen cPen = p.pen();
 
-	mS->setField(QRect(QPoint(), event->size()));
-	mPlayerSpeed = qRound(mS->field().width()*0.007);
-	mPlayer1.updateSize();
-	mPlayer2.updateSize();
-	mBall.updateSize();
+    // set dash pattern
+    QVector<qreal> dashes;
+    dashes << 0.1 << 3;
 
-	initGame();
+    // create style
+    QPen linePen;
+    linePen.setColor(mS->foregroundColor());
+    linePen.setWidth(qRound(mS->unit() * 0.5));
+    linePen.setDashPattern(dashes);
+    p.setPen(linePen);
 
-	// resize player scores
-	QRect sR(QPoint(0, mS->unit()*3), QSize(qRound(width()*0.5), qRound(height()*0.15)));
-	QRect sR1 = sR;
-	QRect sR2 = sR;
-	sR2.moveLeft(qRound(width()*0.5));
-	mP1Score->setGeometry(sR1);
-	mP2Score->setGeometry(sR2);
-	
-	// resize info labels
-	QRect lIR(QPoint(qRound(width()*0.15),0), QSize(qRound(width()*0.7), qRound(height()*0.15)));
-	lIR.moveBottom(qRound(height()*0.5 + mS->unit()));
-	mLargeInfo->setGeometry(lIR);
-	
-	QRect sIR(QPoint(qRound(width()*0.15),0), QSize(qRound(width()*0.7), qRound(height()*0.08)));
-	sIR.moveTop(qRound(height()*0.5 + mS->unit()*2));
-	mSmallInfo->setGeometry(sIR);
-
-	QWidget::resizeEvent(event);
-	
+    // set line
+    QLine line(QPoint(qRound(width() * 0.5f), 0), QPoint(qRound(width() * 0.5f), height()));
+    p.drawLine(line);
+
+    p.setPen(cPen);
+}
+
+void DkPongPort::startCountDown(int sec)
+{
+    mCountDownSecs = sec;
+    pauseGame();
+    mCountDownTimer->start();
+    mLargeInfo->setText(QString::number(mCountDownSecs));
+    mLargeInfo->show();
+    mSmallInfo->hide();
 }
 
-void DkPongPort::gameLoop() {
-
-	// logic first
-	if (!mBall.move(mPlayer1, mPlayer2)) {
-
-		initGame();
+void DkPongPort::resizeEvent(QResizeEvent *event)
+{
+    // resize(event->size());
 
-		// check if somebody won
-		if (mPlayer1.score() >= mS->totalScore() || mPlayer2.score() >= mS->totalScore()) {
-			pauseGame();
-			mLargeInfo->setText(tr("%1 won!").arg(mPlayer1.score() > mPlayer2.score() ? mPlayer1.name() : mPlayer2.name()));
-			mSmallInfo->setText(tr("Hit <SPACE> to start a new Game"));
-		}
-		else
-			startCountDown();
+    mS->setField(QRect(QPoint(), event->size()));
+    mPlayerSpeed = qRound(mS->field().width() * 0.007);
+    mPlayer1.updateSize();
+    mPlayer2.updateSize();
+    mBall.updateSize();
 
-		return;
-	}
+    initGame();
 
-	mPlayer1.move();
-	mPlayer2.move();
-
-	//repaint();
-	viewport()->update();
-	
-	//QGraphicsView::update();
+    // resize player scores
+    QRect sR(QPoint(0, mS->unit() * 3), QSize(qRound(width() * 0.5), qRound(height() * 0.15)));
+    QRect sR1 = sR;
+    QRect sR2 = sR;
+    sR2.moveLeft(qRound(width() * 0.5));
+    mP1Score->setGeometry(sR1);
+    mP2Score->setGeometry(sR2);
+
+    // resize info labels
+    QRect lIR(QPoint(qRound(width() * 0.15), 0), QSize(qRound(width() * 0.7), qRound(height() * 0.15)));
+    lIR.moveBottom(qRound(height() * 0.5 + mS->unit()));
+    mLargeInfo->setGeometry(lIR);
+
+    QRect sIR(QPoint(qRound(width() * 0.15), 0), QSize(qRound(width() * 0.7), qRound(height() * 0.08)));
+    sIR.moveTop(qRound(height() * 0.5 + mS->unit() * 2));
+    mSmallInfo->setGeometry(sIR);
+
+    QWidget::resizeEvent(event);
+}
+
+void DkPongPort::gameLoop()
+{
+    // logic first
+    if (!mBall.move(mPlayer1, mPlayer2)) {
+        initGame();
+
+        // check if somebody won
+        if (mPlayer1.score() >= mS->totalScore() || mPlayer2.score() >= mS->totalScore()) {
+            pauseGame();
+            mLargeInfo->setText(tr("%1 won!").arg(mPlayer1.score() > mPlayer2.score() ? mPlayer1.name() : mPlayer2.name()));
+            mSmallInfo->setText(tr("Hit <SPACE> to start a new Game"));
+        } else
+            startCountDown();
+
+        return;
+    }
+
+    mPlayer1.move();
+    mPlayer2.move();
+
+    // repaint();
+    viewport()->update();
+
+    // QGraphicsView::update();
 }
-
-void DkPongPort::keyPressEvent(QKeyEvent *event) {
-
-	if (event->key() == Qt::Key_Up && !event->isAutoRepeat()) {
-		mPlayer2.setSpeed(-mPlayerSpeed);
-	}
-	if (event->key() == Qt::Key_Down && !event->isAutoRepeat()) {
-		mPlayer2.setSpeed(mPlayerSpeed);
-	}
-	if (event->key() == Qt::Key_W && !event->isAutoRepeat()) {
-		mPlayer1.setSpeed(-mPlayerSpeed);
-	}
-	if (event->key() == Qt::Key_S && !event->isAutoRepeat()) {
-		mPlayer1.setSpeed(mPlayerSpeed);
-	}
-	if (event->key() == Qt::Key_Space) {
-		togglePause();
-	}
-
-	QWidget::keyPressEvent(event);
-}
-
-void DkPongPort::keyReleaseEvent(QKeyEvent* event) {
-
-	if ((event->key() == Qt::Key_Up && !event->isAutoRepeat()) || (event->key() == Qt::Key_Down && !event->isAutoRepeat())) {
-		mPlayer2.setSpeed(0);
-	}
-	if ((event->key() == Qt::Key_W && !event->isAutoRepeat()) || (event->key() == Qt::Key_S && !event->isAutoRepeat())) {
-		mPlayer1.setSpeed(0);
-	}
-
-	QWidget::keyReleaseEvent(event);
+
+void DkPongPort::keyPressEvent(QKeyEvent *event)
+{
+    if (event->key() == Qt::Key_Up && !event->isAutoRepeat()) {
+        mPlayer2.setSpeed(-mPlayerSpeed);
+    }
+    if (event->key() == Qt::Key_Down && !event->isAutoRepeat()) {
+        mPlayer2.setSpeed(mPlayerSpeed);
+    }
+    if (event->key() == Qt::Key_W && !event->isAutoRepeat()) {
+        mPlayer1.setSpeed(-mPlayerSpeed);
+    }
+    if (event->key() == Qt::Key_S && !event->isAutoRepeat()) {
+        mPlayer1.setSpeed(mPlayerSpeed);
+    }
+    if (event->key() == Qt::Key_Space) {
+        togglePause();
+    }
+
+    QWidget::keyPressEvent(event);
+}
+
+void DkPongPort::keyReleaseEvent(QKeyEvent *event)
+{
+    if ((event->key() == Qt::Key_Up && !event->isAutoRepeat()) || (event->key() == Qt::Key_Down && !event->isAutoRepeat())) {
+        mPlayer2.setSpeed(0);
+    }
+    if ((event->key() == Qt::Key_W && !event->isAutoRepeat()) || (event->key() == Qt::Key_S && !event->isAutoRepeat())) {
+        mPlayer1.setSpeed(0);
+    }
+
+    QWidget::keyReleaseEvent(event);
 }
 
 // DkBall --------------------------------------------------------------------
-DkBall::DkBall(QSharedPointer<DkPongSettings> settings) {
+DkBall::DkBall(QSharedPointer<DkPongSettings> settings)
+{
+    mS = settings;
 
-	qsrand(QTime::currentTime().msec());
-	mS = settings;
-	
-	mMinSpeed = qRound(mS->field().width()*0.005);
-	mMaxSpeed = qRound(mS->field().width()*0.01);
-	qDebug() << "maxSpeed: " << mMaxSpeed;
+    mMinSpeed = qRound(mS->field().width() * 0.005);
+    mMaxSpeed = qRound(mS->field().width() * 0.01);
+    qDebug() << "maxSpeed: " << mMaxSpeed;
 
-	mRect = QRect(QPoint(), QSize(mS->unit(), mS->unit()));
+    mRect = QRect(QPoint(), QSize(mS->unit(), mS->unit()));
 
-	//setDirection(DkVector(10, 10));
+    // setDirection(DkVector(10, 10));
 
-	reset();
+    reset();
 }
 
-void DkBall::reset() {
-	
-	//mDirection = DkVector(3, 0);// DkVector(mUnit*0.15f, mUnit*0.15f);
-	mRect.moveCenter(QPoint(qRound(mS->field().width()*0.5f), qRound(mS->field().height()*0.5f)));
+void DkBall::reset()
+{
+    // mDirection = DkVector(3, 0);// DkVector(mUnit*0.15f, mUnit*0.15f);
+    mRect.moveCenter(QPoint(qRound(mS->field().width() * 0.5f), qRound(mS->field().height() * 0.5f)));
 }
 
-void DkBall::updateSize() {
-	mMinSpeed = qRound(mS->field().width()*0.005);
-	mMaxSpeed = qRound(mS->field().width()*0.01);
-	setDirection(DkVector((float)qrand()/RAND_MAX*10.0f-5.0f, (float)qrand()/RAND_MAX*5.0f-2.5f));
-	//setDirection(DkVector(10,10));
+void DkBall::updateSize()
+{
+    mMinSpeed = qRound(mS->field().width() * 0.005);
+    mMaxSpeed = qRound(mS->field().width() * 0.01);
+    setDirection(DkVector(static_cast<float>(QRandomGenerator::global()->generateDouble() * 10.0f - 5.0f),
+                          static_cast<float>(QRandomGenerator::global()->generateDouble() * 5.0f - 2.5f)));
+    // setDirection(DkVector(10,10));
 }
 
-QRect DkBall::rect() const {
-	return mRect;
+QRect DkBall::rect() const
+{
+    return mRect;
 }
 
-QPoint DkBall::direction() const {
-	return mDirection.toQPointF().toPoint();
+QPoint DkBall::direction() const
+{
+    return mDirection.toQPointF().toPoint();
 }
 
-bool DkBall::move(DkPongPlayer& player1, DkPongPlayer& player2) {
-
-	DkVector dir = mDirection;
+bool DkBall::move(DkPongPlayer &player1, DkPongPlayer &player2)
+{
+    DkVector dir = mDirection;
 
-	// collision detection top & bottom
-	if ((mRect.top() <= mS->field().top() && dir.y < 0) || (mRect.bottom() >= mS->field().bottom() && dir.y > 0)) {
-		dir.rotate(dir.angle()*2);
-		//qDebug() << "collision...";
-	}
+    // collision detection top & bottom
+    if ((mRect.top() <= mS->field().top() && dir.y < 0) || (mRect.bottom() >= mS->field().bottom() && dir.y > 0)) {
+        dir.rotate(dir.angle() * 2);
+        // qDebug() << "collision...";
+    }
 
-	double nAngle = dir.angle() + CV_PI*0.5;//DkMath::normAngleRad(dir.angle()+CV_PI*0.5, 0, CV_PI*0.5);
-	double magic = (double)qrand() / RAND_MAX * 0.5 - 0.25;
+    double nAngle = dir.angle() + CV_PI * 0.5; // DkMath::normAngleRad(dir.angle()+CV_PI*0.5, 0, CV_PI*0.5);
+    double magic = QRandomGenerator::global()->generateDouble() * 0.5 - 0.25;
 
-	// player collision
-	if (player1.rect().intersects(mRect) && dir.x < 0) {
+    // player collision
+    if (player1.rect().intersects(mRect) && dir.x < 0) {
+        dir.rotate((nAngle * 2) + magic);
 
-		dir.rotate((nAngle*2)+magic);
-		
-		// change the angle if the ball becomes horizontal
-		if (DkMath::distAngle(dir.angle(), 0.0) > 0.01)
-			dir.rotate(0.7);
+        // change the angle if the ball becomes horizontal
+        if (DkMath::distAngle(dir.angle(), 0.0) > 0.01)
+            dir.rotate(0.7);
 
-		double mod = (player1.pos() != INT_MAX) ? (player1.rect().center().y() - player1.pos())/(float)mS->field().height() : 0;
-		dir.y += (float)mod*mS->unit();
-	}
-	else if (player2.rect().intersects(mRect) && dir.x > 0) {
+        double mod = (player1.pos() != INT_MAX) ? (player1.rect().center().y() - player1.pos()) / (float)mS->field().height() : 0;
+        dir.y += (float)mod * mS->unit();
+    } else if (player2.rect().intersects(mRect) && dir.x > 0) {
+        dir.rotate((nAngle * 2) + magic);
 
-		dir.rotate((nAngle*2)+magic);
+        // change the angle if the ball becomes horizontal
+        if (DkMath::distAngle(dir.angle(), 0.0) > 0.01)
+            dir.rotate(0.7);
 
-		// change the angle if the ball becomes horizontal
-		if (DkMath::distAngle(dir.angle(), 0.0) > 0.01)
-			dir.rotate(0.7);
+        double mod = (player2.pos() != INT_MAX) ? (player2.rect().center().y() - player2.pos()) / (float)mS->field().height() : 0;
+        dir.y += (float)mod * mS->unit();
+    }
+    // collision detection left & right
+    else if (mRect.left() <= mS->field().left()) {
+        dir = QPointF(player2.rect().center()) - mS->field().center();
+        dir.normalize();
+        dir *= (float)mMinSpeed;
+        setDirection(dir);
+        player2.increaseScore();
+        return false;
+    } else if (mRect.right() >= mS->field().right()) {
+        dir = QPointF(player1.rect().center()) - mS->field().center();
+        dir.normalize();
+        dir *= (float)mMinSpeed;
+        setDirection(dir);
+        player1.increaseScore();
+        return false;
+    }
 
-		double mod = (player2.pos() != INT_MAX) ? (player2.rect().center().y() - player2.pos())/(float)mS->field().height() : 0;
-		dir.y += (float)mod*mS->unit();
-	}
-	// collision detection left & right
-	else if (mRect.left() <= mS->field().left()) {
-		dir = QPointF(player2.rect().center())-mS->field().center();
-		dir.normalize();
-		dir *= (float)mMinSpeed;
-		setDirection(dir);
-		player2.increaseScore();
-		return false;
-	}
-	else if (mRect.right() >= mS->field().right()) {
-		dir = QPointF(player1.rect().center())-mS->field().center();
-		dir.normalize();
-		dir *= (float)mMinSpeed;
-		setDirection(dir);
-		player1.increaseScore();
-		return false;
-	}
+    // qDebug() << ballDir.angle();
 
-	//qDebug() << ballDir.angle();
+    setDirection(dir);
+    mRect.moveCenter(mRect.center() + mDirection.toQPointF().toPoint());
 
-	setDirection(dir);
-	mRect.moveCenter(mRect.center() + mDirection.toQPointF().toPoint());
-	
-	return true;
+    return true;
 }
 
-void DkBall::setDirection(const DkVector& dir) {
-	
-	mDirection = dir;
+void DkBall::setDirection(const DkVector &dir)
+{
+    mDirection = dir;
 
-	// check angle
-	fixAngle();
+    // check angle
+    fixAngle();
 
-	if (mDirection.norm() > mMaxSpeed) {
-		mDirection.normalize();
-		mDirection *= (float)mMaxSpeed;
-	}
-	else if (mDirection.norm() < mMinSpeed) {
-		mDirection.normalize();
-		mDirection *= (float)mMinSpeed;
-	}
+    if (mDirection.norm() > mMaxSpeed) {
+        mDirection.normalize();
+        mDirection *= (float)mMaxSpeed;
+    } else if (mDirection.norm() < mMinSpeed) {
+        mDirection.normalize();
+        mDirection *= (float)mMinSpeed;
+    }
 }
 
-void DkBall::fixAngle() {
+void DkBall::fixAngle()
+{
+    double angle = mDirection.angle();
+    double range = CV_PI / 5.0;
+    double sign = angle > 0 ? 1.0 : -1.0;
+    angle = fabs(angle);
+    double newAngle = 0.0;
+
+    if (angle < CV_PI * 0.5 && angle > CV_PI * 0.5 - range) {
+        newAngle = CV_PI * 0.5 - range;
+    } else if (angle > CV_PI * 0.5 && angle < CV_PI * 0.5 + range) {
+        newAngle = CV_PI * 0.5 + range;
+    }
 
-	double angle = mDirection.angle();
-	double range = CV_PI / 5.0;
-	double sign = angle > 0 ? 1.0 : -1.0;
-	angle = fabs(angle);
-	double newAngle = 0.0;
-
-	if (angle < CV_PI*0.5 && angle > CV_PI*0.5 - range) {
-		newAngle = CV_PI*0.5 - range;
-	}
-	else if (angle > CV_PI*0.5 && angle < CV_PI*0.5 + range) {
-		newAngle = CV_PI*0.5 + range;
-	}
-
-	if (newAngle != 0.0) {
-		mDirection.rotate(mDirection.angle() - (newAngle*sign));
-		//qDebug() << "angle: " << angle << " new angle: " << newAngle;
-	}
+    if (newAngle != 0.0) {
+        mDirection.rotate(mDirection.angle() - (newAngle * sign));
+        // qDebug() << "angle: " << angle << " new angle: " << newAngle;
+    }
 }
 
 // DkBall --------------------------------------------------------------------
-DkPong::DkPong(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, flags) {
+DkPong::DkPong(QWidget *parent, Qt::WindowFlags flags)
+    : QMainWindow(parent, flags)
+{
+    setStyleSheet("QWidget{background-color: rgba(0,0,0,0); border: none;}");
+    setWindowFlags(Qt::FramelessWindowHint);
+    setAttribute(Qt::WA_TranslucentBackground, true);
 
-	setStyleSheet("QWidget{background-color: rgba(0,0,0,0); border: none;}");
-	setWindowFlags(Qt::FramelessWindowHint);
-	setAttribute(Qt::WA_TranslucentBackground, true);
+    mViewport = new DkPongPort(this);
 
-	mViewport = new DkPongPort(this);
+    QRect screenRect = QApplication::primaryScreen()->availableGeometry();
+    QRect winRect = screenRect;
 
-	QRect screenRect = QApplication::desktop()->screenGeometry();
-	QRect winRect = screenRect;
-	
-	if (mViewport->settings()->field() == QRect())
-		winRect.setSize(screenRect.size()*0.5);
-	else
-		winRect = mViewport->settings()->field();
+    if (mViewport->settings()->field() == QRect())
+        winRect.setSize(screenRect.size() * 0.5);
+    else
+        winRect = mViewport->settings()->field();
 
-	winRect.moveCenter(screenRect.center());
-	setGeometry(winRect);
-	
-	setCentralWidget(mViewport);
-	show();
-}
+    winRect.moveCenter(screenRect.center());
+    setGeometry(winRect);
 
-void DkPong::keyPressEvent(QKeyEvent *event) {
-
-	if (event->key() == Qt::Key_Escape)
-		close();
+    setCentralWidget(mViewport);
+    show();
 }
 
-void DkPong::closeEvent(QCloseEvent * event) {
+void DkPong::keyPressEvent(QKeyEvent *event)
+{
+    if (event->key() == Qt::Key_Escape)
+        close();
+}
 
-	mViewport->settings()->writeSettings();
+void DkPong::closeEvent(QCloseEvent *event)
+{
+    mViewport->settings()->writeSettings();
 
-	QMainWindow::closeEvent(event);
+    QMainWindow::closeEvent(event);
 }
 
 }
diff --git a/ImageLounge/src/DkGui/DkPong.h b/ImageLounge/src/DkGui/DkPong.h
index b2d1f2a..1f89ffa 100644
--- a/ImageLounge/src/DkGui/DkPong.h
+++ b/ImageLounge/src/DkGui/DkPong.h
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkViewPort.cpp
  Created on:	05.05.2011
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -27,16 +27,16 @@
 
 #pragma once
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QMainWindow>
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QGraphicsView>
-#include <QRect>
 #include <QLabel>
+#include <QMainWindow>
+#include <QRect>
 #include <QSharedPointer>
-#pragma warning(pop)		// no warnings from includes - end
+#pragma warning(pop) // no warnings from includes - end
 
 #include "DkMath.h"
-#pragma warning(disable: 4251)
+#pragma warning(disable : 4251)
 
 #ifndef DllCoreExport
 #ifdef DK_CORE_DLL_EXPORT
@@ -48,183 +48,190 @@
 #endif
 #endif
 
-namespace nmc {
-
-class DllCoreExport DkPongSettings {
+namespace nmc
+{
 
+class DllCoreExport DkPongSettings
+{
 public:
-	DkPongSettings();
+    DkPongSettings();
 
-	void setField(const QRect& field);
-	QRect field() const;
+    void setField(const QRect &field);
+    QRect field() const;
 
-	void setUnit(int unit);
-	int unit() const;
+    void setUnit(int unit);
+    int unit() const;
 
-	void setBackgroundColor(const QColor& col);
-	QColor backgroundColor() const;
+    void setBackgroundColor(const QColor &col);
+    QColor backgroundColor() const;
 
-	void setForegroundColor(const QColor& col);
-	QColor foregroundColor() const;
+    void setForegroundColor(const QColor &col);
+    QColor foregroundColor() const;
 
-	void setTotalScore(int maxScore);
-	int totalScore() const;
+    void setTotalScore(int maxScore);
+    int totalScore() const;
 
-	void writeSettings();
+    void writeSettings();
 
-	QString player1Name() const;
-	QString player2Name() const;
+    QString player1Name() const;
+    QString player2Name() const;
 
-	float playerRatio() const;
+    float playerRatio() const;
 
 protected:
-	QRect mField;
-	int mUnit = 10;
-	int mTotalScore = 10;
+    QRect mField;
+    int mUnit = 10;
+    int mTotalScore = 10;
 
-	QColor mBgCol = QColor(0,0,0,100);
-	QColor mFgCol = QColor(255,255,255);
+    QColor mBgCol = QColor(0, 0, 0, 100);
+    QColor mFgCol = QColor(255, 255, 255);
 
-	QString mPlayer1Name = QObject::tr("Player 1");
-	QString mPlayer2Name = QObject::tr("Player 2");
+    QString mPlayer1Name = QObject::tr("Player 1");
+    QString mPlayer2Name = QObject::tr("Player 2");
 
-	float mPlayerRatio = 0.15f;
+    float mPlayerRatio = 0.15f;
 
-	void loadSettings();
+    void loadSettings();
 };
 
-class DllCoreExport DkPongPlayer {
-	
+class DllCoreExport DkPongPlayer
+{
 public:
-	DkPongPlayer(const QString& playerName = QObject::tr("Anonymous"), QSharedPointer<DkPongSettings> settings = QSharedPointer<DkPongSettings>(new DkPongSettings()));
+    DkPongPlayer(const QString &playerName = QObject::tr("Anonymous"),
+                 QSharedPointer<DkPongSettings> settings = QSharedPointer<DkPongSettings>(new DkPongSettings()));
 
-	void reset(const QPoint& pos);
-	QRect rect() const;
-	int pos() const;
-	void setHeight(int newHeight);
+    void reset(const QPoint &pos);
+    QRect rect() const;
+    int pos() const;
+    void setHeight(int newHeight);
 
-	void move();
-	void setSpeed(int speed);
+    void move();
+    void setSpeed(int speed);
 
-	void updateSize();
-	void increaseScore();
+    void updateSize();
+    void increaseScore();
 
-	void resetScore();
-	int score() const;
+    void resetScore();
+    int score() const;
 
-	QString name() const;
+    QString name() const;
 
 protected:
-	int mSpeed;
-	int mVelocity;
+    int mSpeed;
+    int mVelocity;
 
-	int mScore = 0;
-	int mPos = INT_MAX;
+    int mScore = 0;
+    int mPos = INT_MAX;
 
-	QSharedPointer<DkPongSettings> mS;
-	QRect mRect;
+    QSharedPointer<DkPongSettings> mS;
+    QRect mRect;
 
-	QString mPlayerName;
+    QString mPlayerName;
 };
 
-class DllCoreExport DkBall {
-
+class DllCoreExport DkBall
+{
 public:
-	DkBall(QSharedPointer<DkPongSettings> settings = QSharedPointer<DkPongSettings>(new DkPongSettings()));
+    DkBall(QSharedPointer<DkPongSettings> settings = QSharedPointer<DkPongSettings>(new DkPongSettings()));
 
-	void reset();
-	void updateSize();
+    void reset();
+    void updateSize();
 
-	QRect rect() const;
-	QPoint direction() const;
+    QRect rect() const;
+    QPoint direction() const;
 
-	bool move(DkPongPlayer& player1, DkPongPlayer& player2);
+    bool move(DkPongPlayer &player1, DkPongPlayer &player2);
 
 protected:
-	int mMinSpeed;
-	int mMaxSpeed;
+    int mMinSpeed;
+    int mMaxSpeed;
 
-	DkVector mDirection;
-	QRect mRect;
+    DkVector mDirection;
+    QRect mRect;
 
-	QSharedPointer<DkPongSettings> mS;
+    QSharedPointer<DkPongSettings> mS;
 
-	void fixAngle();
-	void setDirection(const DkVector& dir);
+    void fixAngle();
+    void setDirection(const DkVector &dir);
 };
 
-class DllCoreExport DkScoreLabel : public QLabel {
-	Q_OBJECT
+class DllCoreExport DkScoreLabel : public QLabel
+{
+    Q_OBJECT
 
 public:
-	DkScoreLabel(Qt::Alignment align = Qt::AlignLeft, QWidget* parent = 0, QSharedPointer<DkPongSettings> settings = QSharedPointer<DkPongSettings>(new DkPongSettings()));
+    DkScoreLabel(Qt::Alignment align = Qt::AlignLeft,
+                 QWidget *parent = 0,
+                 QSharedPointer<DkPongSettings> settings = QSharedPointer<DkPongSettings>(new DkPongSettings()));
 
 protected:
-	void paintEvent(QPaintEvent* ev);
-	QFont mFont;
-	Qt::Alignment mAlign;
+    void paintEvent(QPaintEvent *ev);
+    QFont mFont;
+    Qt::Alignment mAlign;
 
-	QSharedPointer<DkPongSettings> mS;
+    QSharedPointer<DkPongSettings> mS;
 };
 
-class DllCoreExport DkPongPort : public QGraphicsView {
-	Q_OBJECT
+class DllCoreExport DkPongPort : public QGraphicsView
+{
+    Q_OBJECT
 
 public:
-	DkPongPort(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
-	virtual ~DkPongPort();
+    DkPongPort(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
+    virtual ~DkPongPort();
 
-	QSharedPointer<DkPongSettings> settings() const;
+    QSharedPointer<DkPongSettings> settings() const;
 
 public slots:
-	void gameLoop();
-	void countDown();
-	
+    void gameLoop();
+    void countDown();
+
 protected:
-	virtual void paintEvent(QPaintEvent* event) override;
-	virtual void resizeEvent(QResizeEvent* event) override;
-	virtual void keyPressEvent(QKeyEvent* event) override;
-	virtual void keyReleaseEvent(QKeyEvent* event) override;
+    virtual void paintEvent(QPaintEvent *event) override;
+    virtual void resizeEvent(QResizeEvent *event) override;
+    virtual void keyPressEvent(QKeyEvent *event) override;
+    virtual void keyReleaseEvent(QKeyEvent *event) override;
 
-	void initGame();
-	void togglePause();
-	void pauseGame(bool pause = true);
+    void initGame();
+    void togglePause();
+    void pauseGame(bool pause = true);
 
 private:
-	QTimer *mEventLoop;
-	QTimer *mCountDownTimer;
-	int mCountDownSecs = 3;
+    QTimer *mEventLoop;
+    QTimer *mCountDownTimer;
+    int mCountDownSecs = 3;
 
-	int mPlayerSpeed;
+    int mPlayerSpeed;
 
-	DkBall mBall;
-	DkPongPlayer mPlayer1;
-	DkPongPlayer mPlayer2;
+    DkBall mBall;
+    DkPongPlayer mPlayer1;
+    DkPongPlayer mPlayer2;
 
-	QSharedPointer<DkPongSettings> mS;
-	void drawField(QPainter& p);
+    QSharedPointer<DkPongSettings> mS;
+    void drawField(QPainter &p);
 
-	DkScoreLabel* mP1Score;
-	DkScoreLabel* mP2Score;
+    DkScoreLabel *mP1Score;
+    DkScoreLabel *mP2Score;
 
-	DkScoreLabel* mLargeInfo;
-	DkScoreLabel* mSmallInfo;
+    DkScoreLabel *mLargeInfo;
+    DkScoreLabel *mSmallInfo;
 
-	void startCountDown(int sec = 3);
+    void startCountDown(int sec = 3);
 };
 
-class DllCoreExport DkPong : public QMainWindow {
-	Q_OBJECT
+class DllCoreExport DkPong : public QMainWindow
+{
+    Q_OBJECT
 
 public:
-	DkPong(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
-	virtual ~DkPong() {};
+    DkPong(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
+    virtual ~DkPong(){};
 
 protected:
-	void keyPressEvent(QKeyEvent *event) override;
-	void closeEvent(QCloseEvent* event) override;
-	
-	DkPongPort* mViewport;
+    void keyPressEvent(QKeyEvent *event) override;
+    void closeEvent(QCloseEvent *event) override;
+
+    DkPongPort *mViewport;
 };
 
 }
diff --git a/ImageLounge/src/DkGui/DkPreferenceWidgets.cpp b/ImageLounge/src/DkGui/DkPreferenceWidgets.cpp
index 0530a44..c220a90 100644
--- a/ImageLounge/src/DkGui/DkPreferenceWidgets.cpp
+++ b/ImageLounge/src/DkGui/DkPreferenceWidgets.cpp
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
 DkPreferenceWidgets.cpp
 Created on:	14.12.2015
- 
+
 nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
 Copyright (C) 2011-2014 Markus Diem <markus@nomacs.org>
 Copyright (C) 2011-2014 Stefan Fiel <stefan@nomacs.org>
 Copyright (C) 2011-2014 Florian Kleber <florian@nomacs.org>
@@ -27,34 +27,33 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 #include "DkPreferenceWidgets.h"
 
+#include "DkActionManager.h"
+#include "DkBasicWidgets.h"
+#include "DkDialog.h"
 #include "DkImageStorage.h"
-#include "DkWidgets.h"
+#include "DkNoMacs.h"
 #include "DkSettings.h"
-#include "DkUtils.h"
-#include "DkBasicWidgets.h"
 #include "DkSettingsWidget.h"
-#include "DkActionManager.h"
-#include "DkNoMacs.h"
-#include "DkDialog.h"
+#include "DkUtils.h"
+#include "DkWidgets.h"
 
-#pragma warning(push, 0)	// no warnings from includes
-#include <QVBoxLayout>
-#include <QStackedLayout>
-#include <QStyleOption>
-#include <QPainter>
+#pragma warning(push, 0) // no warnings from includes
 #include <QAction>
-#include <QFileInfo>
 #include <QCheckBox>
 #include <QComboBox>
+#include <QFileDialog>
+#include <QFileInfo>
+#include <QHeaderView>
 #include <QMessageBox>
+#include <QPainter>
+#include <QProcess>
 #include <QSpinBox>
+#include <QStackedLayout>
 #include <QStandardItemModel>
-#include <QTableView>
-#include <QHeaderView>
-#include <QStandardPaths>
-#include <QProcess>
-#include <QFileDialog>
 #include <QStandardPaths>
+#include <QStyleOption>
+#include <QTableView>
+#include <QVBoxLayout>
 
 #include <QButtonGroup>
 #include <QRadioButton>
@@ -62,1519 +61,1518 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #include <QDebug>
 #pragma warning(pop)
 
-namespace nmc {
-
-DkPreferenceWidget::DkPreferenceWidget(QWidget* parent) : DkFadeWidget(parent) {
-
-	createLayout();
-
-	QAction* nextAction = new QAction(tr("next"), this);
-	nextAction->setShortcut(Qt::Key_PageDown);
-	connect(nextAction, SIGNAL(triggered()), this, SLOT(nextTab()));
-	addAction(nextAction);
-
-	QAction* previousAction = new QAction(tr("previous"), this);
-	previousAction->setShortcut(Qt::Key_PageUp);
-	previousAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
-	connect(previousAction, SIGNAL(triggered()), this, SLOT(previousTab()));
-	addAction(previousAction);
-}
-
-void DkPreferenceWidget::createLayout() {
-
-	// create tab entries
-	QWidget* tabs = new QWidget(this);
-	tabs->setObjectName("DkPreferenceTabs");
-
-	QSize s(32, 32);
-	QPixmap pm = DkImage::loadIcon(":/nomacs/img/power.svg", s, QColor(255, 255, 255));
-	QPushButton* restartButton = new QPushButton(pm, "", this);
-	restartButton->setObjectName("DkPlayerButton");
-	restartButton->setFlat(true);
-	restartButton->setIconSize(pm.size());
-	restartButton->setObjectName("dark");
-	restartButton->setStatusTip(tr("Restart nomacs"));
-	connect(restartButton, SIGNAL(clicked()), this, SIGNAL(restartSignal()));
-
-	mTabLayout = new QVBoxLayout(tabs);
-	mTabLayout->setContentsMargins(0, 60, 0, 0);
-	mTabLayout->setSpacing(0);
-	mTabLayout->setAlignment(Qt::AlignTop);
-	mTabLayout->addStretch();
-	mTabLayout->addWidget(restartButton);
-
-	// create central widget
-	QWidget* centralWidget = new QWidget(this);
-	mCentralLayout = new QStackedLayout(centralWidget);
-	mCentralLayout->setContentsMargins(0, 0, 0, 0);
-
-	// add a scroll area
-	DkResizableScrollArea* scrollAreaTabs = new DkResizableScrollArea(this);
-	scrollAreaTabs->setObjectName("DkPreferenceTabsScroller");
-	scrollAreaTabs->setWidgetResizable(true);
-	scrollAreaTabs->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
-	scrollAreaTabs->setWidget(tabs);
-
-	QHBoxLayout* sL = new QHBoxLayout(this);
-	sL->setContentsMargins(0, 0, 0, 0);	// use 1 to get the border
-	sL->setSpacing(0);
-	sL->setAlignment(Qt::AlignLeft);
-	sL->addWidget(scrollAreaTabs);
-	sL->addWidget(centralWidget);
-}
-
-void DkPreferenceWidget::addTabWidget(DkPreferenceTabWidget* tabWidget) {
-
-	mWidgets.append(tabWidget);
-	mCentralLayout->addWidget(tabWidget);
-
-	DkTabEntryWidget* tabEntry = new DkTabEntryWidget(tabWidget->icon(), tabWidget->name(), this);
-	mTabLayout->insertWidget(mTabLayout->count()-2, tabEntry);	// -2 -> insert before stretch
-	connect(tabEntry, SIGNAL(clicked()), this, SLOT(changeTab()));
-	connect(tabWidget, SIGNAL(restartSignal()), this, SIGNAL(restartSignal()));
-	mTabEntries.append(tabEntry);
-
-	// tick the first
-	if (mTabEntries.size() == 1)
-		tabEntry->click();
-}
-
-void DkPreferenceWidget::previousTab() {
-
-	// modulo is sign aware in cpp...
-	int idx = (mCurrentIndex == 0) ? mWidgets.size()-1 : mCurrentIndex-1;
-	setCurrentIndex(idx);
-}
-
-void DkPreferenceWidget::nextTab() {
-	setCurrentIndex((mCurrentIndex+1) % mWidgets.size());
-}
-
-void DkPreferenceWidget::changeTab() {
-
-	DkTabEntryWidget* te = qobject_cast<DkTabEntryWidget*>(sender());
-
-	for (int idx = 0; idx < mTabEntries.size(); idx++) {
-
-		if (te == mTabEntries[idx]) {
-			setCurrentIndex(idx);
-		}
-	}
-}
-
-void DkPreferenceWidget::setCurrentIndex(int index) {
-
-	// something todo here?
-	if (index == mCurrentIndex)
-		return;
-
-	mCurrentIndex = index;
-	mCentralLayout->setCurrentIndex(index);
-
-	// now check the correct one
-	for (int idx = 0; idx < mTabEntries.size(); idx++)
-		mTabEntries[idx]->setChecked(idx == index);
-
+namespace nmc
+{
+
+DkPreferenceWidget::DkPreferenceWidget(QWidget *parent)
+    : DkFadeWidget(parent)
+{
+    createLayout();
+
+    QAction *nextAction = new QAction(tr("next"), this);
+    nextAction->setShortcut(Qt::Key_PageDown);
+    connect(nextAction, SIGNAL(triggered()), this, SLOT(nextTab()));
+    addAction(nextAction);
+
+    QAction *previousAction = new QAction(tr("previous"), this);
+    previousAction->setShortcut(Qt::Key_PageUp);
+    previousAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+    connect(previousAction, SIGNAL(triggered()), this, SLOT(previousTab()));
+    addAction(previousAction);
+}
+
+void DkPreferenceWidget::createLayout()
+{
+    // create tab entries
+    QWidget *tabs = new QWidget(this);
+    tabs->setObjectName("DkPreferenceTabs");
+
+    QSize s(32, 32);
+    QPixmap pm = DkImage::loadIcon(":/nomacs/img/power.svg", QColor(255, 255, 255), s);
+    QPushButton *restartButton = new QPushButton(pm, "", this);
+    restartButton->setObjectName("DkPlayerButton");
+    restartButton->setFlat(true);
+    restartButton->setIconSize(pm.size());
+    restartButton->setObjectName("DkRestartButton");
+    restartButton->setStatusTip(tr("Restart nomacs"));
+    connect(restartButton, SIGNAL(clicked()), this, SIGNAL(restartSignal()));
+
+    mTabLayout = new QVBoxLayout(tabs);
+    mTabLayout->setContentsMargins(0, 60, 0, 0);
+    mTabLayout->setSpacing(0);
+    mTabLayout->setAlignment(Qt::AlignTop);
+    mTabLayout->addStretch();
+    mTabLayout->addWidget(restartButton);
+
+    // create central widget
+    QWidget *centralWidget = new QWidget(this);
+    mCentralLayout = new QStackedLayout(centralWidget);
+    mCentralLayout->setContentsMargins(0, 0, 0, 0);
+
+    // add a scroll area
+    DkResizableScrollArea *scrollAreaTabs = new DkResizableScrollArea(this);
+    scrollAreaTabs->setObjectName("DkPreferenceTabsScroller");
+    scrollAreaTabs->setWidgetResizable(true);
+    scrollAreaTabs->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
+    scrollAreaTabs->setWidget(tabs);
+
+    QHBoxLayout *sL = new QHBoxLayout(this);
+    sL->setContentsMargins(0, 0, 0, 0); // use 1 to get the border
+    sL->setSpacing(0);
+    sL->setAlignment(Qt::AlignLeft);
+    sL->addWidget(scrollAreaTabs);
+    sL->addWidget(centralWidget);
+}
+
+void DkPreferenceWidget::addTabWidget(DkPreferenceTabWidget *tabWidget)
+{
+    mWidgets.append(tabWidget);
+    mCentralLayout->addWidget(tabWidget);
+
+    DkTabEntryWidget *tabEntry = new DkTabEntryWidget(tabWidget->icon(), tabWidget->name(), this);
+    mTabLayout->insertWidget(mTabLayout->count() - 2, tabEntry); // -2 -> insert before stretch
+    connect(tabEntry, SIGNAL(clicked()), this, SLOT(changeTab()));
+    connect(tabWidget, SIGNAL(restartSignal()), this, SIGNAL(restartSignal()));
+    mTabEntries.append(tabEntry);
+
+    // tick the first
+    if (mTabEntries.size() == 1)
+        tabEntry->click();
+}
+
+void DkPreferenceWidget::previousTab()
+{
+    // modulo is sign aware in cpp...
+    int idx = (mCurrentIndex == 0) ? mWidgets.size() - 1 : mCurrentIndex - 1;
+    setCurrentIndex(idx);
+}
+
+void DkPreferenceWidget::nextTab()
+{
+    setCurrentIndex((mCurrentIndex + 1) % mWidgets.size());
+}
+
+void DkPreferenceWidget::changeTab()
+{
+    DkTabEntryWidget *te = qobject_cast<DkTabEntryWidget *>(sender());
+
+    for (int idx = 0; idx < mTabEntries.size(); idx++) {
+        if (te == mTabEntries[idx]) {
+            setCurrentIndex(idx);
+        }
+    }
+}
+
+void DkPreferenceWidget::setCurrentIndex(int index)
+{
+    // something todo here?
+    if (index == mCurrentIndex)
+        return;
+
+    mCurrentIndex = index;
+    mCentralLayout->setCurrentIndex(index);
+
+    // now check the correct one
+    for (int idx = 0; idx < mTabEntries.size(); idx++)
+        mTabEntries[idx]->setChecked(idx == index);
 }
 
 // DkPreferenceTabWidget --------------------------------------------------------------------
-DkPreferenceTabWidget::DkPreferenceTabWidget(const QIcon& icon, const QString& name, QWidget* parent) : DkNamedWidget(name, parent) {
-
-	setObjectName("DkPreferenceTab");
-	mIcon = icon;
+DkPreferenceTabWidget::DkPreferenceTabWidget(const QIcon &icon, const QString &name, QWidget *parent)
+    : DkNamedWidget(name, parent)
+{
+    setObjectName("DkPreferenceTab");
+    mIcon = icon;
 
-	createLayout();
-	QMetaObject::connectSlotsByName(this);
+    createLayout();
+    QMetaObject::connectSlotsByName(this);
 }
 
-void DkPreferenceTabWidget::createLayout() {
-
-	QLabel* titleLabel = new QLabel(name(), this);
-	titleLabel->setObjectName("DkPreferenceTitle");
+void DkPreferenceTabWidget::createLayout()
+{
+    QLabel *titleLabel = new QLabel(name(), this);
+    titleLabel->setObjectName("DkPreferenceTitle");
 
-	// add a scroll area
-	mCentralScroller = new DkResizableScrollArea(this);
-	mCentralScroller->setObjectName("DkPreferenceScroller");
-	mCentralScroller->setWidgetResizable(true);
+    // add a scroll area
+    mCentralScroller = new DkResizableScrollArea(this);
+    mCentralScroller->setObjectName("DkPreferenceScroller");
+    mCentralScroller->setWidgetResizable(true);
 
-	mInfoButton = new QPushButton(tr(""), this);
-	mInfoButton->setObjectName("infoButton");
-	mInfoButton->setFlat(true);
-	mInfoButton->setVisible(false);
-	connect(mInfoButton, SIGNAL(clicked()), this, SIGNAL(restartSignal()));
+    mInfoButton = new QPushButton(tr(""), this);
+    mInfoButton->setObjectName("infoButton");
+    mInfoButton->setFlat(true);
+    mInfoButton->setVisible(false);
+    connect(mInfoButton, SIGNAL(clicked()), this, SIGNAL(restartSignal()));
 
-	QGridLayout* l = new QGridLayout(this);
-	l->setContentsMargins(0, 0, 0, 0);
-	l->setAlignment(Qt::AlignTop);
-	l->addWidget(titleLabel, 0, 0);
-	l->addWidget(mCentralScroller, 1, 0);
-	l->addWidget(mInfoButton, 2, 0, Qt::AlignBottom);
+    QGridLayout *l = new QGridLayout(this);
+    l->setContentsMargins(0, 0, 0, 0);
+    l->setAlignment(Qt::AlignTop);
+    l->addWidget(titleLabel, 0, 0);
+    l->addWidget(mCentralScroller, 1, 0);
+    l->addWidget(mInfoButton, 2, 0, Qt::AlignBottom);
 }
 
-void DkPreferenceTabWidget::setWidget(QWidget* w) {
+void DkPreferenceTabWidget::setWidget(QWidget *w)
+{
+    mCentralScroller->setWidget(w);
+    w->setObjectName("DkPreferenceWidget");
 
-	mCentralScroller->setWidget(w);
-	w->setObjectName("DkPreferenceWidget");
-
-	connect(w, SIGNAL(infoSignal(const QString&)), this, SLOT(setInfoMessage(const QString&)));
+    connect(w, SIGNAL(infoSignal(const QString &)), this, SLOT(setInfoMessage(const QString &)));
 }
 
-void DkPreferenceTabWidget::setInfoMessage(const QString& msg) {
-
-	mInfoButton->setText(msg);
-	mInfoButton->setVisible(!msg.isEmpty());
+void DkPreferenceTabWidget::setInfoMessage(const QString &msg)
+{
+    mInfoButton->setText(msg);
+    mInfoButton->setVisible(!msg.isEmpty());
 }
 
-QWidget* DkPreferenceTabWidget::widget() const {
-	return mCentralScroller->widget();
+QWidget *DkPreferenceTabWidget::widget() const
+{
+    return mCentralScroller->widget();
 }
 
-QIcon DkPreferenceTabWidget::icon() const {
-	return mIcon;
+QIcon DkPreferenceTabWidget::icon() const
+{
+    return mIcon;
 }
 
 // DkGroupWidget --------------------------------------------------------------------
-DkGroupWidget::DkGroupWidget(const QString& title, QWidget* parent) : DkWidget(parent) {
+DkGroupWidget::DkGroupWidget(const QString &title, QWidget *parent)
+    : DkWidget(parent)
+{
+    setObjectName("DkGroupWidget");
+    mTitle = title;
 
-	setObjectName("DkGroupWidget");
-	mTitle = title;
-
-	createLayout();
+    createLayout();
 }
 
-void DkGroupWidget::createLayout() {
-
-	QLabel* titleLabel = new QLabel(mTitle, this);
-	titleLabel->setObjectName("subTitle");
+void DkGroupWidget::createLayout()
+{
+    QLabel *titleLabel = new QLabel(mTitle, this);
+    titleLabel->setObjectName("subTitle");
 
-	// we create a content widget to have control over the margins
-	QWidget* contentWidget = new QWidget(this);
-	mContentLayout = new QVBoxLayout(contentWidget);
+    // we create a content widget to have control over the margins
+    QWidget *contentWidget = new QWidget(this);
+    mContentLayout = new QVBoxLayout(contentWidget);
 
-	QVBoxLayout* layout = new QVBoxLayout(this);
-	layout->setContentsMargins(0, 0, 0, 0);
-	layout->addWidget(titleLabel);
-	layout->addWidget(contentWidget);
+    QVBoxLayout *layout = new QVBoxLayout(this);
+    layout->setContentsMargins(0, 0, 0, 0);
+    layout->addWidget(titleLabel);
+    layout->addWidget(contentWidget);
 }
 
-void DkGroupWidget::addWidget(QWidget* widget) {
-	
-	mContentLayout->addWidget(widget);
+void DkGroupWidget::addWidget(QWidget *widget)
+{
+    mContentLayout->addWidget(widget);
 }
 
-void DkGroupWidget::addSpace() {
-
-	mContentLayout->addSpacing(10);
+void DkGroupWidget::addSpace()
+{
+    mContentLayout->addSpacing(10);
 }
 
-void DkGroupWidget::paintEvent(QPaintEvent *event) {
-
-	// fixes stylesheets which are not applied to custom widgets
-	QStyleOption opt;
-	opt.init(this);
-	QPainter p(this);
-	style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
+void DkGroupWidget::paintEvent(QPaintEvent *event)
+{
+    // fixes stylesheets which are not applied to custom widgets
+    QStyleOption opt;
+    opt.initFrom(this);
+    QPainter p(this);
+    style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
 
-	QWidget::paintEvent(event);
+    QWidget::paintEvent(event);
 }
 
 // DkGeneralPreference --------------------------------------------------------------------
-DkGeneralPreference::DkGeneralPreference(QWidget* parent) : DkWidget(parent) {
-
-	createLayout();
-	QMetaObject::connectSlotsByName(this);
-}
-
-void DkGeneralPreference::createLayout() {
-
-	// Theme
-	DkThemeManager tm;
-	QStringList themes = tm.cleanThemeNames(tm.getAvailableThemes());
-
-	QComboBox* themeBox = new QComboBox(this);
-	themeBox->setView(new QListView());
-	themeBox->setObjectName("themeBox");
-	themeBox->addItems(themes);
-	themeBox->setCurrentText(tm.cleanThemeName(tm.getCurrentThemeName()));
-	connect(themeBox, SIGNAL(currentIndexChanged(int)), this, SLOT(showRestartLabel()));
-
-	DkColorChooser* iconColorChooser = new DkColorChooser(QColor(51, 51, 51, 255), tr("Icon Color"), this);
-	iconColorChooser->setObjectName("iconColor");
-	iconColorChooser->setColor(&DkSettingsManager::param().display().iconColor);
-	connect(iconColorChooser, SIGNAL(accepted()), this, SLOT(showRestartLabel()));
-
-	DkColorChooser* bgColorChooser = new DkColorChooser(QColor(100, 100, 100, 255), tr("Background Color"), this);
-	bgColorChooser->setObjectName("backgroundColor");
-	bgColorChooser->setColor(&DkSettingsManager::param().display().bgColor);
-	connect(bgColorChooser, SIGNAL(accepted()), this, SLOT(showRestartLabel()));
-
-	DkColorChooser* fullscreenColorChooser = new DkColorChooser(QColor(51, 51, 51), tr("Fullscreen Color"), this);
-	fullscreenColorChooser->setObjectName("fullscreenColor");
-	fullscreenColorChooser->setColor(&DkSettingsManager::param().slideShow().backgroundColor);
-	connect(fullscreenColorChooser, SIGNAL(accepted()), this, SLOT(showRestartLabel()));
-
-	DkGroupWidget* colorGroup = new DkGroupWidget(tr("Color Settings"), this);
-	colorGroup->addWidget(themeBox);
-	colorGroup->addWidget(iconColorChooser);
-	colorGroup->addWidget(bgColorChooser);
-	colorGroup->addWidget(fullscreenColorChooser);
-
-	// default pushbutton
-	QPushButton* defaultSettings = new QPushButton(tr("Reset All Settings"));
-	defaultSettings->setObjectName("defaultSettings");
-	defaultSettings->setMaximumWidth(300);
-
-	QPushButton* importSettings = new QPushButton(tr("&Import Settings"));
-	importSettings->setObjectName("importSettings");
-	importSettings->setMaximumWidth(300);
-
-	QPushButton* exportSettings = new QPushButton(tr("&Export Settings"));
-	exportSettings->setObjectName("exportSettings");
-	exportSettings->setMaximumWidth(300);
-
-	DkGroupWidget* defaultGroup = new DkGroupWidget(tr("Default Settings"), this);
-	defaultGroup->addWidget(defaultSettings);
-	defaultGroup->addWidget(importSettings);
-	defaultGroup->addWidget(exportSettings);
-
-	// the left column (holding all color settings)
-	QWidget* leftColumn = new QWidget(this);
-	leftColumn->setMinimumWidth(400);
-
-	QVBoxLayout* leftColumnLayout = new QVBoxLayout(leftColumn);
-	leftColumnLayout->setAlignment(Qt::AlignTop);
-	leftColumnLayout->addWidget(colorGroup);
-	leftColumnLayout->addWidget(defaultGroup);
-
-	// checkboxes
-	QCheckBox* cbRecentFiles = new QCheckBox(tr("Show Recent Files on Start-Up"), this);
-	cbRecentFiles->setObjectName("showRecentFiles");
-	cbRecentFiles->setToolTip(tr("Show the History Panel on Start-Up"));
-	cbRecentFiles->setChecked(DkSettingsManager::param().app().showRecentFiles);
-
-	QCheckBox* cbLogRecentFiles = new QCheckBox(tr("Remember Recent Files History"), this);
-	cbLogRecentFiles->setObjectName("logRecentFiles");
-	cbLogRecentFiles->setToolTip(tr("If checked, recent files will be saved."));
-	cbLogRecentFiles->setChecked(DkSettingsManager::param().global().logRecentFiles);
-
-	QCheckBox* cbCheckOpenDuplicates = new QCheckBox(tr("Check for Duplicates on Open"), this);
-	cbCheckOpenDuplicates->setObjectName("checkOpenDuplicates");
-	cbCheckOpenDuplicates->setToolTip(tr("If any files are opened which are already open in a tab, don't open them again."));
-	cbCheckOpenDuplicates->setChecked(DkSettingsManager::param().global().checkOpenDuplicates);
-
-	QCheckBox* cbExtendedTabs = new QCheckBox(tr("Show extra options related to tabs"), this);
-	cbExtendedTabs->setObjectName("extendedTabs");
-	cbExtendedTabs->setToolTip(tr("Enables the \"Go to Tab\", \"First Tab\", and \"Last Tab\" options in the View menu, and the \"Open Tabs\" and \"Save Tabs\" options in the File menu."));
-	cbExtendedTabs->setChecked(DkSettingsManager::param().global().extendedTabs);
-
-	QCheckBox* cbLoopImages = new QCheckBox(tr("Loop Images"), this);
-	cbLoopImages->setObjectName("loopImages");
-	cbLoopImages->setToolTip(tr("Start with the first image in a folder after showing the last."));
-	cbLoopImages->setChecked(DkSettingsManager::param().global().loop);
-
-	QCheckBox* cbZoomOnWheel = new QCheckBox(tr("Mouse Wheel Zooms"), this);
-	cbZoomOnWheel->setObjectName("zoomOnWheel");
-	cbZoomOnWheel->setToolTip(tr("If checked, the mouse wheel zooms - otherwise it is used to switch between images."));
-	cbZoomOnWheel->setChecked(DkSettingsManager::param().global().zoomOnWheel);
-
-	QCheckBox* cbHorZoomSkips = new QCheckBox(tr("Next Image on Horizontal Zoom"), this);
-	cbHorZoomSkips->setObjectName("horZoomSkips");
-	cbHorZoomSkips->setToolTip(tr("If checked, horizontal wheel events load the next/previous images."));
-	cbHorZoomSkips->setChecked(DkSettingsManager::param().global().horZoomSkips);
-
-	QCheckBox* cbDoubleClickForFullscreen = new QCheckBox(tr("Double Click Opens Fullscreen"), this);
-	cbDoubleClickForFullscreen->setObjectName("doubleClickForFullscreen");
-	cbDoubleClickForFullscreen->setToolTip(tr("If checked, a double click on the canvas opens the fullscreen mode."));
-	cbDoubleClickForFullscreen->setChecked(DkSettingsManager::param().global().doubleClickForFullscreen);
-
-	QCheckBox* cbShowBgImage = new QCheckBox(tr("Show Background Image"), this);
-	cbShowBgImage->setObjectName("showBgImage");
-	cbShowBgImage->setToolTip(tr("If checked, the nomacs logo is shown in the bottom right corner."));
-	cbShowBgImage->setChecked(DkSettingsManager::param().global().showBgImage);
-
-	QCheckBox* cbSwitchModifier = new QCheckBox(tr("Switch CTRL with ALT"), this);
-	cbSwitchModifier->setObjectName("switchModifier");
-	cbSwitchModifier->setToolTip(tr("If checked, CTRL + Mouse is switched with ALT + Mouse."));
-	cbSwitchModifier->setChecked(DkSettingsManager::param().sync().switchModifier);
-
-	QCheckBox* cbCloseOnEsc = new QCheckBox(tr("Close on ESC"), this);
-	cbCloseOnEsc->setObjectName("closeOnEsc");
-	cbCloseOnEsc->setToolTip(tr("Close nomacs if ESC is pressed."));
-	cbCloseOnEsc->setChecked(DkSettingsManager::param().app().closeOnEsc);
-
-	QCheckBox* cbCheckForUpdates = new QCheckBox(tr("Check For Updates"), this);
-	cbCheckForUpdates->setObjectName("checkForUpdates");
-	cbCheckForUpdates->setToolTip(tr("Check for updates on start-up."));
-	cbCheckForUpdates->setChecked(DkSettingsManager::param().sync().checkForUpdates);
-	cbCheckForUpdates->setDisabled(DkSettingsManager::param().sync().disableUpdateInteraction);
-
-	DkGroupWidget* generalGroup = new DkGroupWidget(tr("General"), this);
-	generalGroup->addWidget(cbRecentFiles);
-	generalGroup->addWidget(cbLogRecentFiles);
-	generalGroup->addWidget(cbCheckOpenDuplicates);
-	generalGroup->addWidget(cbExtendedTabs);
-	generalGroup->addWidget(cbLoopImages);
-	generalGroup->addWidget(cbZoomOnWheel);
-	generalGroup->addWidget(cbHorZoomSkips);
-	generalGroup->addWidget(cbDoubleClickForFullscreen);
-	generalGroup->addWidget(cbSwitchModifier);
-	generalGroup->addWidget(cbCloseOnEsc);
-	generalGroup->addWidget(cbCheckForUpdates);
-	generalGroup->addWidget(cbShowBgImage);
-
-	// language
-	QComboBox* languageCombo = new QComboBox(this);
-	languageCombo->setView(new QListView());	// fix style
-	languageCombo->setObjectName("languageCombo");
-	languageCombo->setToolTip(tr("Choose your preferred language."));
-	DkUtils::addLanguages(languageCombo, mLanguages);
-	languageCombo->setCurrentIndex(mLanguages.indexOf(DkSettingsManager::param().global().language));
-
-	QLabel* translateLabel = new QLabel("<a href=\"https://nomacs.org/how-to-translate-nomacs/\">How-to translate nomacs</a>", this);
-	translateLabel->setToolTip(tr("Info on how to translate nomacs."));
-	translateLabel->setOpenExternalLinks(true);
-
-	DkGroupWidget* languageGroup = new DkGroupWidget(tr("Language"), this);
-	languageGroup->addWidget(languageCombo);
-	languageGroup->addWidget(translateLabel);
-
-	// the right column (holding all checkboxes)
-	QWidget* cbWidget = new QWidget(this);
-	QVBoxLayout* cbLayout = new QVBoxLayout(cbWidget);
-	cbLayout->setAlignment(Qt::AlignTop);
-	cbLayout->addWidget(generalGroup);
+DkGeneralPreference::DkGeneralPreference(QWidget *parent)
+    : DkWidget(parent)
+{
+    createLayout();
+    QMetaObject::connectSlotsByName(this);
+}
+
+void DkGeneralPreference::createLayout()
+{
+    // Theme
+    DkThemeManager tm;
+    QStringList themes = tm.cleanThemeNames(tm.getAvailableThemes());
+
+    QComboBox *themeBox = new QComboBox(this);
+    themeBox->setView(new QListView());
+    themeBox->setObjectName("themeBox");
+    themeBox->addItems(themes);
+    themeBox->setCurrentText(tm.cleanThemeName(tm.getCurrentThemeName()));
+    connect(themeBox, SIGNAL(currentIndexChanged(int)), this, SLOT(showRestartLabel()));
+
+    DkColorChooser *iconColorChooser = new DkColorChooser(QColor(51, 51, 51, 255), tr("Icon Color"), this);
+    iconColorChooser->setObjectName("iconColor");
+    iconColorChooser->setColor(&DkSettingsManager::param().display().iconColor);
+    connect(iconColorChooser, SIGNAL(accepted()), this, SLOT(showRestartLabel()));
+
+    DkColorChooser *bgColorChooser = new DkColorChooser(QColor(100, 100, 100, 255), tr("Background Color"), this);
+    bgColorChooser->setObjectName("backgroundColor");
+    bgColorChooser->setColor(&DkSettingsManager::param().display().bgColor);
+    connect(bgColorChooser, SIGNAL(accepted()), this, SLOT(showRestartLabel()));
+
+    DkColorChooser *fullscreenColorChooser = new DkColorChooser(QColor(51, 51, 51), tr("Fullscreen Color"), this);
+    fullscreenColorChooser->setObjectName("fullscreenColor");
+    fullscreenColorChooser->setColor(&DkSettingsManager::param().slideShow().backgroundColor);
+    connect(fullscreenColorChooser, SIGNAL(accepted()), this, SLOT(showRestartLabel()));
+
+    DkGroupWidget *colorGroup = new DkGroupWidget(tr("Color Settings"), this);
+    colorGroup->addWidget(themeBox);
+    colorGroup->addWidget(iconColorChooser);
+    colorGroup->addWidget(bgColorChooser);
+    colorGroup->addWidget(fullscreenColorChooser);
+
+    // default pushbutton
+    QPushButton *defaultSettings = new QPushButton(tr("Reset All Settings"));
+    defaultSettings->setObjectName("defaultSettings");
+    defaultSettings->setMaximumWidth(300);
+
+    QPushButton *importSettings = new QPushButton(tr("&Import Settings"));
+    importSettings->setObjectName("importSettings");
+    importSettings->setMaximumWidth(300);
+
+    QPushButton *exportSettings = new QPushButton(tr("&Export Settings"));
+    exportSettings->setObjectName("exportSettings");
+    exportSettings->setMaximumWidth(300);
+
+    DkGroupWidget *defaultGroup = new DkGroupWidget(tr("Default Settings"), this);
+    defaultGroup->addWidget(defaultSettings);
+    defaultGroup->addWidget(importSettings);
+    defaultGroup->addWidget(exportSettings);
+
+    // the left column (holding all color settings)
+    QWidget *leftColumn = new QWidget(this);
+    leftColumn->setMinimumWidth(400);
+
+    QVBoxLayout *leftColumnLayout = new QVBoxLayout(leftColumn);
+    leftColumnLayout->setAlignment(Qt::AlignTop);
+    leftColumnLayout->addWidget(colorGroup);
+    leftColumnLayout->addWidget(defaultGroup);
+
+    // checkboxes
+    QCheckBox *cbRecentFiles = new QCheckBox(tr("Show Recent Files on Start-Up"), this);
+    cbRecentFiles->setObjectName("showRecentFiles");
+    cbRecentFiles->setToolTip(tr("Show the History Panel on Start-Up"));
+    cbRecentFiles->setChecked(DkSettingsManager::param().app().showRecentFiles);
+
+    QCheckBox *cbLogRecentFiles = new QCheckBox(tr("Remember Recent Files History"), this);
+    cbLogRecentFiles->setObjectName("logRecentFiles");
+    cbLogRecentFiles->setToolTip(tr("If checked, recent files will be saved."));
+    cbLogRecentFiles->setChecked(DkSettingsManager::param().global().logRecentFiles);
+
+    QCheckBox *cbCheckOpenDuplicates = new QCheckBox(tr("Check for Duplicates on Open"), this);
+    cbCheckOpenDuplicates->setObjectName("checkOpenDuplicates");
+    cbCheckOpenDuplicates->setToolTip(tr("If any files are opened which are already open in a tab, don't open them again."));
+    cbCheckOpenDuplicates->setChecked(DkSettingsManager::param().global().checkOpenDuplicates);
+
+    QCheckBox *cbExtendedTabs = new QCheckBox(tr("Show extra options related to tabs"), this);
+    cbExtendedTabs->setObjectName("extendedTabs");
+    cbExtendedTabs->setToolTip(
+        tr("Enables the \"Go to Tab\", \"First Tab\", and \"Last Tab\" options in the View menu, and the \"Open Tabs\" and \"Save Tabs\" options in the File "
+           "menu."));
+    cbExtendedTabs->setChecked(DkSettingsManager::param().global().extendedTabs);
+
+    QCheckBox *cbLoopImages = new QCheckBox(tr("Loop Images"), this);
+    cbLoopImages->setObjectName("loopImages");
+    cbLoopImages->setToolTip(tr("Start with the first image in a folder after showing the last."));
+    cbLoopImages->setChecked(DkSettingsManager::param().global().loop);
+
+    QCheckBox *cbZoomOnWheel = new QCheckBox(tr("Mouse Wheel Zooms"), this);
+    cbZoomOnWheel->setObjectName("zoomOnWheel");
+    cbZoomOnWheel->setToolTip(tr("If checked, the mouse wheel zooms - otherwise it is used to switch between images."));
+    cbZoomOnWheel->setChecked(DkSettingsManager::param().global().zoomOnWheel);
+
+    QCheckBox *cbHorZoomSkips = new QCheckBox(tr("Next Image on Horizontal Zoom"), this);
+    cbHorZoomSkips->setObjectName("horZoomSkips");
+    cbHorZoomSkips->setToolTip(tr("If checked, horizontal wheel events load the next/previous images."));
+    cbHorZoomSkips->setChecked(DkSettingsManager::param().global().horZoomSkips);
+
+    QCheckBox *cbDoubleClickForFullscreen = new QCheckBox(tr("Double Click Opens Fullscreen"), this);
+    cbDoubleClickForFullscreen->setObjectName("doubleClickForFullscreen");
+    cbDoubleClickForFullscreen->setToolTip(tr("If checked, a double click on the canvas opens the fullscreen mode."));
+    cbDoubleClickForFullscreen->setChecked(DkSettingsManager::param().global().doubleClickForFullscreen);
+
+    QCheckBox *cbShowBgImage = new QCheckBox(tr("Show Background Image"), this);
+    cbShowBgImage->setObjectName("showBgImage");
+    cbShowBgImage->setToolTip(tr("If checked, the nomacs logo is shown in the bottom right corner."));
+    cbShowBgImage->setChecked(DkSettingsManager::param().global().showBgImage);
+
+    QCheckBox *cbSwitchModifier = new QCheckBox(tr("Switch CTRL with ALT"), this);
+    cbSwitchModifier->setObjectName("switchModifier");
+    cbSwitchModifier->setToolTip(tr("If checked, CTRL + Mouse is switched with ALT + Mouse."));
+    cbSwitchModifier->setChecked(DkSettingsManager::param().sync().switchModifier);
+
+    QCheckBox *cbCloseOnEsc = new QCheckBox(tr("Close on ESC"), this);
+    cbCloseOnEsc->setObjectName("closeOnEsc");
+    cbCloseOnEsc->setToolTip(tr("Close nomacs if ESC is pressed."));
+    cbCloseOnEsc->setChecked(DkSettingsManager::param().app().closeOnEsc);
+
+    QCheckBox *cbCheckForUpdates = new QCheckBox(tr("Check For Updates"), this);
+    cbCheckForUpdates->setObjectName("checkForUpdates");
+    cbCheckForUpdates->setToolTip(tr("Check for updates on start-up."));
+    cbCheckForUpdates->setChecked(DkSettingsManager::param().sync().checkForUpdates);
+    cbCheckForUpdates->setDisabled(DkSettingsManager::param().sync().disableUpdateInteraction);
+
+    DkGroupWidget *generalGroup = new DkGroupWidget(tr("General"), this);
+    generalGroup->addWidget(cbRecentFiles);
+    generalGroup->addWidget(cbLogRecentFiles);
+    generalGroup->addWidget(cbCheckOpenDuplicates);
+    generalGroup->addWidget(cbExtendedTabs);
+    generalGroup->addWidget(cbLoopImages);
+    generalGroup->addWidget(cbZoomOnWheel);
+    generalGroup->addWidget(cbHorZoomSkips);
+    generalGroup->addWidget(cbDoubleClickForFullscreen);
+    generalGroup->addWidget(cbSwitchModifier);
+    generalGroup->addWidget(cbCloseOnEsc);
+    generalGroup->addWidget(cbCheckForUpdates);
+    generalGroup->addWidget(cbShowBgImage);
+
+    // language
+    QComboBox *languageCombo = new QComboBox(this);
+    languageCombo->setView(new QListView()); // fix style
+    languageCombo->setObjectName("languageCombo");
+    languageCombo->setToolTip(tr("Choose your preferred language."));
+    DkUtils::addLanguages(languageCombo, mLanguages);
+    languageCombo->setCurrentIndex(mLanguages.indexOf(DkSettingsManager::param().global().language));
+
+    QLabel *translateLabel = new QLabel("<a href=\"https://nomacs.org/how-to-translate-nomacs/\">How-to translate nomacs</a>", this);
+    translateLabel->setToolTip(tr("Info on how to translate nomacs."));
+    translateLabel->setOpenExternalLinks(true);
+
+    DkGroupWidget *languageGroup = new DkGroupWidget(tr("Language"), this);
+    languageGroup->addWidget(languageCombo);
+    languageGroup->addWidget(translateLabel);
+
+    // the right column (holding all checkboxes)
+    QWidget *cbWidget = new QWidget(this);
+    QVBoxLayout *cbLayout = new QVBoxLayout(cbWidget);
+    cbLayout->setAlignment(Qt::AlignTop);
+    cbLayout->addWidget(generalGroup);
 
-	// add language
-	cbLayout->addWidget(languageGroup);
-
-	QHBoxLayout* contentLayout = new QHBoxLayout(this);
-	contentLayout->setAlignment(Qt::AlignLeft);
-	contentLayout->addWidget(leftColumn);
-	contentLayout->addWidget(cbWidget);
+    // add language
+    cbLayout->addWidget(languageGroup);
+
+    QHBoxLayout *contentLayout = new QHBoxLayout(this);
+    contentLayout->setAlignment(Qt::AlignLeft);
+    contentLayout->addWidget(leftColumn);
+    contentLayout->addWidget(cbWidget);
 }
 
-void DkGeneralPreference::showRestartLabel() const {
-	emit infoSignal(tr("Please Restart nomacs to apply changes"));
+void DkGeneralPreference::showRestartLabel() const
+{
+    emit infoSignal(tr("Please Restart nomacs to apply changes"));
 }
 
-void DkGeneralPreference::on_backgroundColor_accepted() const {
-	DkSettingsManager::param().display().defaultBackgroundColor = false;
+void DkGeneralPreference::on_backgroundColor_accepted() const
+{
+    DkSettingsManager::param().display().defaultBackgroundColor = false;
 }
 
-void DkGeneralPreference::on_backgroundColor_resetClicked() const {
-	DkSettingsManager::param().display().defaultBackgroundColor = true;
+void DkGeneralPreference::on_backgroundColor_resetClicked() const
+{
+    DkSettingsManager::param().display().defaultBackgroundColor = true;
 }
 
-void DkGeneralPreference::on_iconColor_accepted() const {
-	DkSettingsManager::param().display().defaultIconColor = false;
+void DkGeneralPreference::on_iconColor_accepted() const
+{
+    DkSettingsManager::param().display().defaultIconColor = false;
 }
 
-void DkGeneralPreference::on_iconColor_resetClicked() const {
-	DkSettingsManager::param().display().defaultIconColor = true;
+void DkGeneralPreference::on_iconColor_resetClicked() const
+{
+    DkSettingsManager::param().display().defaultIconColor = true;
 }
 
-void DkGeneralPreference::on_themeBox_currentIndexChanged(const QString& text) const {
-
-	QString tn = text + ".css";
-	tn = tn.replace(" ", "-");
+void DkGeneralPreference::on_themeBox_currentIndexChanged(const QString &text) const
+{
+    QString tn = text + ".css";
+    tn = tn.replace(" ", "-");
 
-	if (DkSettingsManager::param().display().themeName != tn) {
-		DkSettingsManager::param().display().themeName = tn;
-		DkThemeManager tm;
-		tm.loadTheme(tn);
-	}
+    if (DkSettingsManager::param().display().themeName != tn) {
+        DkSettingsManager::param().display().themeName = tn;
+        DkThemeManager tm;
+        tm.loadTheme(tn);
+    }
 }
 
-void DkGeneralPreference::on_showRecentFiles_toggled(bool checked) const {
-
-	if (DkSettingsManager::param().app().showRecentFiles != checked)
-		DkSettingsManager::param().app().showRecentFiles = checked;
+void DkGeneralPreference::on_showRecentFiles_toggled(bool checked) const
+{
+    if (DkSettingsManager::param().app().showRecentFiles != checked)
+        DkSettingsManager::param().app().showRecentFiles = checked;
 }
 
-void DkGeneralPreference::on_logRecentFiles_toggled(bool checked) const {
-
-	if (DkSettingsManager::param().global().logRecentFiles != checked)
-		DkSettingsManager::param().global().logRecentFiles = checked;
+void DkGeneralPreference::on_logRecentFiles_toggled(bool checked) const
+{
+    if (DkSettingsManager::param().global().logRecentFiles != checked)
+        DkSettingsManager::param().global().logRecentFiles = checked;
 }
 
-void DkGeneralPreference::on_checkOpenDuplicates_toggled(bool checked) const {
-
-	if (DkSettingsManager::param().global().checkOpenDuplicates != checked)
-		DkSettingsManager::param().global().checkOpenDuplicates = checked;
+void DkGeneralPreference::on_checkOpenDuplicates_toggled(bool checked) const
+{
+    if (DkSettingsManager::param().global().checkOpenDuplicates != checked)
+        DkSettingsManager::param().global().checkOpenDuplicates = checked;
 }
 
-void DkGeneralPreference::on_extendedTabs_toggled(bool checked) const {
-
-	if (DkSettingsManager::param().global().extendedTabs != checked) {
-		DkSettingsManager::param().global().extendedTabs = checked;
-		showRestartLabel();
-	}
+void DkGeneralPreference::on_extendedTabs_toggled(bool checked) const
+{
+    if (DkSettingsManager::param().global().extendedTabs != checked) {
+        DkSettingsManager::param().global().extendedTabs = checked;
+        showRestartLabel();
+    }
 }
 
-void DkGeneralPreference::on_closeOnEsc_toggled(bool checked) const {
-
-	if (DkSettingsManager::param().app().closeOnEsc != checked)
-		DkSettingsManager::param().app().closeOnEsc = checked;
+void DkGeneralPreference::on_closeOnEsc_toggled(bool checked) const
+{
+    if (DkSettingsManager::param().app().closeOnEsc != checked)
+        DkSettingsManager::param().app().closeOnEsc = checked;
 }
 
-void DkGeneralPreference::on_zoomOnWheel_toggled(bool checked) const {
-
-	if (DkSettingsManager::param().global().zoomOnWheel != checked) {
-		DkSettingsManager::param().global().zoomOnWheel = checked;
-	}
+void DkGeneralPreference::on_zoomOnWheel_toggled(bool checked) const
+{
+    if (DkSettingsManager::param().global().zoomOnWheel != checked) {
+        DkSettingsManager::param().global().zoomOnWheel = checked;
+    }
 }
 
-void DkGeneralPreference::on_horZoomSkips_toggled(bool checked) const {
-
-	if (DkSettingsManager::param().global().horZoomSkips != checked) {
-		DkSettingsManager::param().global().horZoomSkips = checked;
-	}
+void DkGeneralPreference::on_horZoomSkips_toggled(bool checked) const
+{
+    if (DkSettingsManager::param().global().horZoomSkips != checked) {
+        DkSettingsManager::param().global().horZoomSkips = checked;
+    }
 }
 
-void DkGeneralPreference::on_doubleClickForFullscreen_toggled(bool checked) const {
-
-	if (DkSettingsManager::param().global().doubleClickForFullscreen != checked)
-		DkSettingsManager::param().global().doubleClickForFullscreen = checked;
-
+void DkGeneralPreference::on_doubleClickForFullscreen_toggled(bool checked) const
+{
+    if (DkSettingsManager::param().global().doubleClickForFullscreen != checked)
+        DkSettingsManager::param().global().doubleClickForFullscreen = checked;
 }
 
-void DkGeneralPreference::on_showBgImage_toggled(bool checked) const {
-
-	if (DkSettingsManager::param().global().showBgImage != checked) {
-		DkSettingsManager::param().global().showBgImage = checked;
-		showRestartLabel();
-	}
-
+void DkGeneralPreference::on_showBgImage_toggled(bool checked) const
+{
+    if (DkSettingsManager::param().global().showBgImage != checked) {
+        DkSettingsManager::param().global().showBgImage = checked;
+        showRestartLabel();
+    }
 }
 
-void DkGeneralPreference::on_checkForUpdates_toggled(bool checked) const {
-
-	if (DkSettingsManager::param().sync().checkForUpdates != checked)
-		DkSettingsManager::param().sync().checkForUpdates = checked;
+void DkGeneralPreference::on_checkForUpdates_toggled(bool checked) const
+{
+    if (DkSettingsManager::param().sync().checkForUpdates != checked)
+        DkSettingsManager::param().sync().checkForUpdates = checked;
 }
 
-void DkGeneralPreference::on_switchModifier_toggled(bool checked) const {
-
-	if (DkSettingsManager::param().sync().switchModifier != checked) {
+void DkGeneralPreference::on_switchModifier_toggled(bool checked) const
+{
+    if (DkSettingsManager::param().sync().switchModifier != checked) {
+        DkSettingsManager::param().sync().switchModifier = checked;
 
-		DkSettingsManager::param().sync().switchModifier = checked;
-
-		if (DkSettingsManager::param().sync().switchModifier) {
-			DkSettingsManager::param().global().altMod = Qt::ControlModifier;
-			DkSettingsManager::param().global().ctrlMod = Qt::AltModifier;
-		}
-		else {
-			DkSettingsManager::param().global().altMod = Qt::AltModifier;
-			DkSettingsManager::param().global().ctrlMod = Qt::ControlModifier;
-		}
-	}
+        if (DkSettingsManager::param().sync().switchModifier) {
+            DkSettingsManager::param().global().altMod = Qt::ControlModifier;
+            DkSettingsManager::param().global().ctrlMod = Qt::AltModifier;
+        } else {
+            DkSettingsManager::param().global().altMod = Qt::AltModifier;
+            DkSettingsManager::param().global().ctrlMod = Qt::ControlModifier;
+        }
+    }
 }
 
-void DkGeneralPreference::on_loopImages_toggled(bool checked) const {
-
-	if (DkSettingsManager::param().global().loop != checked)
-		DkSettingsManager::param().global().loop = checked;
+void DkGeneralPreference::on_loopImages_toggled(bool checked) const
+{
+    if (DkSettingsManager::param().global().loop != checked)
+        DkSettingsManager::param().global().loop = checked;
 }
 
-void DkGeneralPreference::on_defaultSettings_clicked() {
-
-	int answer = QMessageBox::warning(this, tr("Reset All Settings"), tr("This will reset all personal settings!"), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
-	
-	if (answer == QMessageBox::Yes) {
-		DkSettingsManager::param().setToDefaultSettings();
-		showRestartLabel();
-		qDebug() << "answer is: " << answer << "flushing all settings...";
-	}
+void DkGeneralPreference::on_defaultSettings_clicked()
+{
+    int answer = QMessageBox::warning(this,
+                                      tr("Reset All Settings"),
+                                      tr("This will reset all personal settings!"),
+                                      QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
 
+    if (answer == QMessageBox::Yes) {
+        DkSettingsManager::param().setToDefaultSettings();
+        showRestartLabel();
+        qDebug() << "answer is: " << answer << "flushing all settings...";
+    }
 }
 
-void DkGeneralPreference::on_importSettings_clicked() {
-
-	QString filePath = QFileDialog::getOpenFileName(
-		DkUtils::getMainWindow(), 
-		tr("Import Settings"),
-		QDir::homePath(), 
-		"Nomacs Settings (*.ini)",
-		nullptr,
-		DkDialog::fileDialogOptions()
-	);
+void DkGeneralPreference::on_importSettings_clicked()
+{
+    QString filePath = QFileDialog::getOpenFileName(DkUtils::getMainWindow(),
+                                                    tr("Import Settings"),
+                                                    QDir::homePath(),
+                                                    "Nomacs Settings (*.ini)",
+                                                    nullptr,
+                                                    DkDialog::fileDialogOptions());
 
-	// user canceled?
-	if (filePath.isEmpty())
-		return;
+    // user canceled?
+    if (filePath.isEmpty())
+        return;
 
-	DkSettingsManager::importSettings(filePath);
+    DkSettingsManager::importSettings(filePath);
 
-	showRestartLabel();
+    showRestartLabel();
 }
 
-void DkGeneralPreference::on_exportSettings_clicked() {
-
-	QString filePath = QFileDialog::getSaveFileName(
-		DkUtils::getMainWindow(), 
-		tr("Export Settings"),
-		QDir::homePath(), 
-		"Nomacs Settings (*.ini)",
-		nullptr,
-		DkDialog::fileDialogOptions()
-	);
+void DkGeneralPreference::on_exportSettings_clicked()
+{
+    QString filePath = QFileDialog::getSaveFileName(DkUtils::getMainWindow(),
+                                                    tr("Export Settings"),
+                                                    QDir::homePath(),
+                                                    "Nomacs Settings (*.ini)",
+                                                    nullptr,
+                                                    DkDialog::fileDialogOptions());
 
-	// user canceled?
-	if (filePath.isEmpty())
-		return;
+    // user canceled?
+    if (filePath.isEmpty())
+        return;
 
-	// try copying setting
-	// NOTE: unfortunately this won't copy ini files on unix
-	bool copied = false;
-	QFile f(DkSettingsManager::instance().param().settingsPath());
-	if (f.exists())
-		copied = f.copy(filePath);
+    // try copying setting
+    // NOTE: unfortunately this won't copy ini files on unix
+    bool copied = false;
+    QFile f(DkSettingsManager::instance().param().settingsPath());
+    if (f.exists())
+        copied = f.copy(filePath);
 
-	// save settings (here we lose settings such as [CustomShortcuts])
-	if (!copied) {
-		QSettings settings(filePath, QSettings::IniFormat);
-		DkSettingsManager::instance().settings().save(settings, true);
-	}
+    // save settings (here we lose settings such as [CustomShortcuts])
+    if (!copied) {
+        QSettings settings(filePath, QSettings::IniFormat);
+        DkSettingsManager::instance().settings().save(settings, true);
+    }
 
-	emit infoSignal(tr("Settings exported"));
+    emit infoSignal(tr("Settings exported"));
 }
 
-void DkGeneralPreference::on_languageCombo_currentIndexChanged(int index) const {
+void DkGeneralPreference::on_languageCombo_currentIndexChanged(int index) const
+{
+    if (index >= 0 && index < mLanguages.size()) {
+        QString language = mLanguages[index];
 
-	if (index >= 0 && index < mLanguages.size()) {
-		QString language = mLanguages[index];
-
-		if (DkSettingsManager::param().global().language != language) {
-			DkSettingsManager::param().global().language = language;
-			showRestartLabel();
-		}
-	}
+        if (DkSettingsManager::param().global().language != language) {
+            DkSettingsManager::param().global().language = language;
+            showRestartLabel();
+        }
+    }
 }
 
-void DkGeneralPreference::paintEvent(QPaintEvent *event) {
-
-	// fixes stylesheets which are not applied to custom widgets
-	QStyleOption opt;
-	opt.init(this);
-	QPainter p(this);
-	style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
-
-	QWidget::paintEvent(event);
+void DkGeneralPreference::paintEvent(QPaintEvent *event)
+{
+    // fixes stylesheets which are not applied to custom widgets
+    QStyleOption opt;
+    opt.initFrom(this);
+    QPainter p(this);
+    style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
+
+    QWidget::paintEvent(event);
 }
 
 // DkDisplaySettings --------------------------------------------------------------------
-DkDisplayPreference::DkDisplayPreference(QWidget* parent) : DkWidget(parent) {
-
-	createLayout();
-	QMetaObject::connectSlotsByName(this);
-}
-
-void DkDisplayPreference::createLayout() {
-
-	// zoom settings
-	QCheckBox* invertZoom = new QCheckBox(tr("Invert mouse wheel behaviour for zooming"), this);
-	invertZoom->setObjectName("invertZoom");
-	invertZoom->setToolTip(tr("If checked, the mouse wheel behaviour is inverted while zooming."));
-	invertZoom->setChecked(DkSettingsManager::param().display().invertZoom);
-
-	// zoom settings
-	QCheckBox* hQAntiAliasing = new QCheckBox(tr("Display Images with High Quality Anti Aliasing"), this);
-	hQAntiAliasing->setObjectName("hQAntiAliasing");
-	hQAntiAliasing->setToolTip(tr("NOTE: if checked, nomacs might be slow while zooming."));
-	hQAntiAliasing->setChecked(DkSettingsManager::param().display().highQualityAntiAliasing);
-
-	// show scollbars
-	QCheckBox* showScrollBars = new QCheckBox(tr("Show Scrollbars when zooming into images"), this);
-	showScrollBars->setObjectName("showScrollBars");
-	showScrollBars->setToolTip(tr("If checked, scrollbars will appear that allow panning with the mouse."));
-	showScrollBars->setChecked(DkSettingsManager::param().display().showScrollBars);
-
-	QLabel* interpolationLabel = new QLabel(tr("Show pixels if zoom level is above"), this);
-
-	QSpinBox* sbInterpolation = new QSpinBox(this);
-	sbInterpolation->setObjectName("interpolationBox");
-	sbInterpolation->setToolTip(tr("nomacs will not interpolate images if the zoom level is larger."));
-	sbInterpolation->setSuffix("%");
-	sbInterpolation->setMinimum(0);
-	sbInterpolation->setMaximum(10000);
-	sbInterpolation->setValue(DkSettingsManager::param().display().interpolateZoomLevel);
-
-	// zoom levels
-	DkZoomConfig& zc = DkZoomConfig::instance();
-	QCheckBox* useZoomLevels = new QCheckBox(tr("Use Fixed Zoom Levels"), this);
-	useZoomLevels->setObjectName("useZoomLevels");
-	useZoomLevels->setToolTip(tr("If checked, predefined zoom levels are used when zooming."));
-	useZoomLevels->setChecked(zc.useLevels());
-
-	mZoomLevelsEdit = new QLineEdit(this);
-	mZoomLevelsEdit->setObjectName("zoomLevels");
-	mZoomLevelsEdit->setText(zc.levelsToString());
-
-	QPushButton* zoomLevelsDefaults = new QPushButton(tr("Load Defaults"), this);
-	zoomLevelsDefaults->setObjectName("zoomLevelsDefault");
-
-	mZoomLevels = new QWidget(this);
-
-	QHBoxLayout* zll = new QHBoxLayout(mZoomLevels);
-	zll->addWidget(mZoomLevelsEdit);
-	zll->addWidget(zoomLevelsDefaults);
-	
-	mZoomLevels->setEnabled(zc.useLevels());
-
-	DkGroupWidget* zoomGroup = new DkGroupWidget(tr("Zoom"), this);
-	zoomGroup->addWidget(invertZoom);
-	zoomGroup->addWidget(hQAntiAliasing);
-	zoomGroup->addWidget(showScrollBars);
-	zoomGroup->addWidget(interpolationLabel);
-	zoomGroup->addWidget(sbInterpolation);
-	zoomGroup->addWidget(useZoomLevels);
-	zoomGroup->addWidget(mZoomLevels);
-
-	// keep zoom radio buttons
-	QVector<QRadioButton*> keepZoomButtons;
-	keepZoomButtons.resize(DkSettings::zoom_end);
-	keepZoomButtons[DkSettings::zoom_always_keep] = new QRadioButton(tr("Always keep zoom"), this);
-	keepZoomButtons[DkSettings::zoom_keep_same_size] = new QRadioButton(tr("Keep zoom if the size is the same"), this);
-	keepZoomButtons[DkSettings::zoom_keep_same_size]->setToolTip(tr("If checked, the zoom level is only kept, if the image loaded has the same level as the previous."));
-	keepZoomButtons[DkSettings::zoom_never_keep] = new QRadioButton(tr("Never keep zoom"), this);
-
-	QCheckBox* cbZoomToFit = new QCheckBox(tr("Always zoom to fit"), this);
-	cbZoomToFit->setObjectName("zoomToFit");
-	cbZoomToFit->setChecked(DkSettingsManager::param().display().zoomToFit);
-
-	// check wrt the current settings
-	keepZoomButtons[DkSettingsManager::param().display().keepZoom]->setChecked(true);
-
-	QButtonGroup* keepZoomButtonGroup = new QButtonGroup(this);
-	keepZoomButtonGroup->setObjectName("keepZoom");
-	keepZoomButtonGroup->addButton(keepZoomButtons[DkSettings::zoom_always_keep], DkSettings::zoom_always_keep);
-	keepZoomButtonGroup->addButton(keepZoomButtons[DkSettings::zoom_keep_same_size], DkSettings::zoom_keep_same_size);
-	keepZoomButtonGroup->addButton(keepZoomButtons[DkSettings::zoom_never_keep], DkSettings::zoom_never_keep);
-
-	DkGroupWidget* keepZoomGroup = new DkGroupWidget(tr("When Displaying New Images"), this);
-	keepZoomGroup->addWidget(keepZoomButtons[DkSettings::zoom_always_keep]);
-	keepZoomGroup->addWidget(keepZoomButtons[DkSettings::zoom_keep_same_size]);
-	keepZoomGroup->addWidget(keepZoomButtons[DkSettings::zoom_never_keep]);
-	keepZoomGroup->addWidget(cbZoomToFit);
-	
-	// icon size
-	QSpinBox* sbIconSize = new QSpinBox(this);
-	sbIconSize->setObjectName("iconSizeBox");
-	sbIconSize->setToolTip(tr("Define the icon size in pixel."));
-	sbIconSize->setSuffix(" px");
-	sbIconSize->setMinimum(16);
-	sbIconSize->setMaximum(1024);
-	sbIconSize->setValue(DkSettingsManager::param().effectiveIconSize(sbIconSize));
-
-	DkGroupWidget* iconGroup = new DkGroupWidget(tr("Icon Size"), this);
-	iconGroup->addWidget(sbIconSize);
-
-	// show navigation
-	QCheckBox* cbShowNavigation = new QCheckBox(tr("Show Navigation Arrows"), this);
-	cbShowNavigation->setObjectName("showNavigation");
-	cbShowNavigation->setToolTip(tr("If checked, navigation arrows will be displayed on top of the image"));
-	cbShowNavigation->setChecked(DkSettingsManager::param().display().showNavigation);
-
-	DkGroupWidget* navigationGroup = new DkGroupWidget(tr("Navigation"), this);
-	navigationGroup->addWidget(cbShowNavigation);
-
-
-	// slideshow
-	QLabel* fadeImageLabel = new QLabel(tr("Image Transition"), this);
-
-	QComboBox* cbTransition = new QComboBox(this);
-	cbTransition->setView(new QListView());	// fix style
-	cbTransition->setObjectName("transition");
-	cbTransition->setToolTip(tr("Choose a transition when loading a new image"));
-
-	for (int idx = 0; idx < DkSettings::trans_end; idx++) {
-
-		QString str = tr("Unknown Transition");
-
-		switch (idx) {
-		case DkSettings::trans_appear:	str = tr("Appear"); break;
-		case DkSettings::trans_swipe:	str = tr("Swipe");	break;
-		case DkSettings::trans_fade:	str = tr("Fade");	break;
-		}
-
-		cbTransition->addItem(str);
-	}
-	cbTransition->setCurrentIndex(DkSettingsManager::param().display().transition);
-
-	QDoubleSpinBox* fadeImageBox = new QDoubleSpinBox(this);
-	fadeImageBox->setObjectName("fadeImageBox");
-	fadeImageBox->setToolTip(tr("Define the image transition speed."));
-	fadeImageBox->setSuffix(" sec");
-	fadeImageBox->setMinimum(0.0);
-	fadeImageBox->setMaximum(3);
-	fadeImageBox->setSingleStep(.2);
-	fadeImageBox->setValue(DkSettingsManager::param().display().animationDuration);
-
-	QCheckBox* cbAlwaysAnimate = new QCheckBox(tr("Always Animate Image Loading"), this);
-	cbAlwaysAnimate->setObjectName("alwaysAnimate");
-	cbAlwaysAnimate->setToolTip(tr("If unchecked, loading is only animated if nomacs is fullscreen"));
-	cbAlwaysAnimate->setChecked(DkSettingsManager::param().display().alwaysAnimate);
-
-	QLabel* displayTimeLabel = new QLabel(tr("Display Time"), this);
-	
-	QDoubleSpinBox* displayTimeBox = new QDoubleSpinBox(this);
-	displayTimeBox->setObjectName("displayTimeBox");
-	displayTimeBox->setToolTip(tr("Define the time an image is displayed."));
-	displayTimeBox->setSuffix(" sec");
-	displayTimeBox->setMinimum(0.0);
-	displayTimeBox->setMaximum(30);
-	displayTimeBox->setSingleStep(.2);
-	displayTimeBox->setValue(DkSettingsManager::param().slideShow().time);
-
-	QCheckBox* showPlayer = new QCheckBox(tr("Show Player"), this);
-	showPlayer->setObjectName("showPlayer");
-	showPlayer->setChecked(DkSettingsManager::param().slideShow().showPlayer);
-
-	DkGroupWidget* slideshowGroup = new DkGroupWidget(tr("Slideshow"), this);
-	slideshowGroup->addWidget(fadeImageLabel);
-	slideshowGroup->addWidget(cbTransition);
-	slideshowGroup->addWidget(fadeImageBox);
-	slideshowGroup->addWidget(cbAlwaysAnimate);
-	slideshowGroup->addWidget(displayTimeLabel);
-	slideshowGroup->addWidget(displayTimeBox);
-	slideshowGroup->addWidget(showPlayer);
-
-	// show crop from metadata
-	QCheckBox* showCrop = new QCheckBox(tr("Show crop rectangle"), this);
-	showCrop->setObjectName("showCrop");
-	showCrop->setChecked(DkSettingsManager::param().display().showCrop);
-
-	DkGroupWidget* showCropGroup = new DkGroupWidget(tr("Show Metadata Cropping"), this);
-	showCropGroup->addWidget(showCrop);
-
-	// left column
-	QVBoxLayout* l = new QVBoxLayout(this);
-	l->setAlignment(Qt::AlignTop);
-	l->addWidget(zoomGroup);
-	l->addWidget(keepZoomGroup);
-	l->addWidget(iconGroup);
-	l->addWidget(navigationGroup);
-	l->addWidget(slideshowGroup);
-	l->addWidget(showCropGroup);
+DkDisplayPreference::DkDisplayPreference(QWidget *parent)
+    : DkWidget(parent)
+{
+    createLayout();
+    QMetaObject::connectSlotsByName(this);
+}
+
+void DkDisplayPreference::createLayout()
+{
+    // zoom settings
+    QCheckBox *invertZoom = new QCheckBox(tr("Invert mouse wheel behaviour for zooming"), this);
+    invertZoom->setObjectName("invertZoom");
+    invertZoom->setToolTip(tr("If checked, the mouse wheel behaviour is inverted while zooming."));
+    invertZoom->setChecked(DkSettingsManager::param().display().invertZoom);
+
+    // zoom settings
+    QCheckBox *hQAntiAliasing = new QCheckBox(tr("Display Images with High Quality Anti Aliasing"), this);
+    hQAntiAliasing->setObjectName("hQAntiAliasing");
+    hQAntiAliasing->setToolTip(tr("NOTE: if checked, nomacs might be slow while zooming."));
+    hQAntiAliasing->setChecked(DkSettingsManager::param().display().highQualityAntiAliasing);
+
+    // show scollbars
+    QCheckBox *showScrollBars = new QCheckBox(tr("Show Scrollbars when zooming into images"), this);
+    showScrollBars->setObjectName("showScrollBars");
+    showScrollBars->setToolTip(tr("If checked, scrollbars will appear that allow panning with the mouse."));
+    showScrollBars->setChecked(DkSettingsManager::param().display().showScrollBars);
+
+    QLabel *interpolationLabel = new QLabel(tr("Show pixels if zoom level is above"), this);
+
+    QSpinBox *sbInterpolation = new QSpinBox(this);
+    sbInterpolation->setObjectName("interpolationBox");
+    sbInterpolation->setToolTip(tr("nomacs will not interpolate images if the zoom level is larger."));
+    sbInterpolation->setSuffix("%");
+    sbInterpolation->setMinimum(0);
+    sbInterpolation->setMaximum(10000);
+    sbInterpolation->setValue(DkSettingsManager::param().display().interpolateZoomLevel);
+
+    // zoom levels
+    DkZoomConfig &zc = DkZoomConfig::instance();
+    QCheckBox *useZoomLevels = new QCheckBox(tr("Use Fixed Zoom Levels"), this);
+    useZoomLevels->setObjectName("useZoomLevels");
+    useZoomLevels->setToolTip(tr("If checked, predefined zoom levels are used when zooming."));
+    useZoomLevels->setChecked(zc.useLevels());
+
+    mZoomLevelsEdit = new QLineEdit(this);
+    mZoomLevelsEdit->setObjectName("zoomLevels");
+    mZoomLevelsEdit->setText(zc.levelsToString());
+
+    QPushButton *zoomLevelsDefaults = new QPushButton(tr("Load Defaults"), this);
+    zoomLevelsDefaults->setObjectName("zoomLevelsDefault");
+
+    mZoomLevels = new QWidget(this);
+
+    QHBoxLayout *zll = new QHBoxLayout(mZoomLevels);
+    zll->addWidget(mZoomLevelsEdit);
+    zll->addWidget(zoomLevelsDefaults);
+
+    mZoomLevels->setEnabled(zc.useLevels());
+
+    DkGroupWidget *zoomGroup = new DkGroupWidget(tr("Zoom"), this);
+    zoomGroup->addWidget(invertZoom);
+    zoomGroup->addWidget(hQAntiAliasing);
+    zoomGroup->addWidget(showScrollBars);
+    zoomGroup->addWidget(interpolationLabel);
+    zoomGroup->addWidget(sbInterpolation);
+    zoomGroup->addWidget(useZoomLevels);
+    zoomGroup->addWidget(mZoomLevels);
+
+    // keep zoom radio buttons
+    QVector<QRadioButton *> keepZoomButtons;
+    keepZoomButtons.resize(DkSettings::zoom_end);
+    keepZoomButtons[DkSettings::zoom_always_keep] = new QRadioButton(tr("Always keep zoom"), this);
+    keepZoomButtons[DkSettings::zoom_keep_same_size] = new QRadioButton(tr("Keep zoom if the size is the same"), this);
+    keepZoomButtons[DkSettings::zoom_keep_same_size]->setToolTip(
+        tr("If checked, the zoom level is only kept, if the image loaded has the same level as the previous."));
+    keepZoomButtons[DkSettings::zoom_never_keep] = new QRadioButton(tr("Never keep zoom"), this);
+
+    QCheckBox *cbZoomToFit = new QCheckBox(tr("Always zoom to fit"), this);
+    cbZoomToFit->setObjectName("zoomToFit");
+    cbZoomToFit->setChecked(DkSettingsManager::param().display().zoomToFit);
+
+    // check wrt the current settings
+    keepZoomButtons[DkSettingsManager::param().display().keepZoom]->setChecked(true);
+
+    QButtonGroup *keepZoomButtonGroup = new QButtonGroup(this);
+    keepZoomButtonGroup->setObjectName("keepZoom");
+    keepZoomButtonGroup->addButton(keepZoomButtons[DkSettings::zoom_always_keep], DkSettings::zoom_always_keep);
+    keepZoomButtonGroup->addButton(keepZoomButtons[DkSettings::zoom_keep_same_size], DkSettings::zoom_keep_same_size);
+    keepZoomButtonGroup->addButton(keepZoomButtons[DkSettings::zoom_never_keep], DkSettings::zoom_never_keep);
+
+    DkGroupWidget *keepZoomGroup = new DkGroupWidget(tr("When Displaying New Images"), this);
+    keepZoomGroup->addWidget(keepZoomButtons[DkSettings::zoom_always_keep]);
+    keepZoomGroup->addWidget(keepZoomButtons[DkSettings::zoom_keep_same_size]);
+    keepZoomGroup->addWidget(keepZoomButtons[DkSettings::zoom_never_keep]);
+    keepZoomGroup->addWidget(cbZoomToFit);
+
+    // icon size
+    QSpinBox *sbIconSize = new QSpinBox(this);
+    sbIconSize->setObjectName("iconSizeBox");
+    sbIconSize->setToolTip(tr("Define the icon size in pixel."));
+    sbIconSize->setSuffix(" px");
+    sbIconSize->setMinimum(16);
+    sbIconSize->setMaximum(1024);
+    sbIconSize->setValue(DkSettingsManager::param().effectiveIconSize(sbIconSize));
+
+    DkGroupWidget *iconGroup = new DkGroupWidget(tr("Icon Size"), this);
+    iconGroup->addWidget(sbIconSize);
+
+    // show navigation
+    QCheckBox *cbShowNavigation = new QCheckBox(tr("Show Navigation Arrows"), this);
+    cbShowNavigation->setObjectName("showNavigation");
+    cbShowNavigation->setToolTip(tr("If checked, navigation arrows will be displayed on top of the image"));
+    cbShowNavigation->setChecked(DkSettingsManager::param().display().showNavigation);
+
+    DkGroupWidget *navigationGroup = new DkGroupWidget(tr("Navigation"), this);
+    navigationGroup->addWidget(cbShowNavigation);
+
+    // slideshow
+    QLabel *fadeImageLabel = new QLabel(tr("Image Transition"), this);
+
+    QComboBox *cbTransition = new QComboBox(this);
+    cbTransition->setView(new QListView()); // fix style
+    cbTransition->setObjectName("transition");
+    cbTransition->setToolTip(tr("Choose a transition when loading a new image"));
+
+    for (int idx = 0; idx < DkSettings::trans_end; idx++) {
+        QString str = tr("Unknown Transition");
+
+        switch (idx) {
+        case DkSettings::trans_appear:
+            str = tr("Appear");
+            break;
+        case DkSettings::trans_swipe:
+            str = tr("Swipe");
+            break;
+        case DkSettings::trans_fade:
+            str = tr("Fade");
+            break;
+        }
+
+        cbTransition->addItem(str);
+    }
+    cbTransition->setCurrentIndex(DkSettingsManager::param().display().transition);
+
+    QDoubleSpinBox *fadeImageBox = new QDoubleSpinBox(this);
+    fadeImageBox->setObjectName("fadeImageBox");
+    fadeImageBox->setToolTip(tr("Define the image transition speed."));
+    fadeImageBox->setSuffix(" sec");
+    fadeImageBox->setMinimum(0.0);
+    fadeImageBox->setMaximum(3);
+    fadeImageBox->setSingleStep(.2);
+    fadeImageBox->setValue(DkSettingsManager::param().display().animationDuration);
+
+    QCheckBox *cbAlwaysAnimate = new QCheckBox(tr("Always Animate Image Loading"), this);
+    cbAlwaysAnimate->setObjectName("alwaysAnimate");
+    cbAlwaysAnimate->setToolTip(tr("If unchecked, loading is only animated if nomacs is fullscreen"));
+    cbAlwaysAnimate->setChecked(DkSettingsManager::param().display().alwaysAnimate);
+
+    QLabel *displayTimeLabel = new QLabel(tr("Display Time"), this);
+
+    QDoubleSpinBox *displayTimeBox = new QDoubleSpinBox(this);
+    displayTimeBox->setObjectName("displayTimeBox");
+    displayTimeBox->setToolTip(tr("Define the time an image is displayed."));
+    displayTimeBox->setSuffix(" sec");
+    displayTimeBox->setMinimum(0.0);
+    displayTimeBox->setMaximum(30);
+    displayTimeBox->setSingleStep(.2);
+    displayTimeBox->setValue(DkSettingsManager::param().slideShow().time);
+
+    QCheckBox *showPlayer = new QCheckBox(tr("Show Player"), this);
+    showPlayer->setObjectName("showPlayer");
+    showPlayer->setChecked(DkSettingsManager::param().slideShow().showPlayer);
+
+    DkGroupWidget *slideshowGroup = new DkGroupWidget(tr("Slideshow"), this);
+    slideshowGroup->addWidget(fadeImageLabel);
+    slideshowGroup->addWidget(cbTransition);
+    slideshowGroup->addWidget(fadeImageBox);
+    slideshowGroup->addWidget(cbAlwaysAnimate);
+    slideshowGroup->addWidget(displayTimeLabel);
+    slideshowGroup->addWidget(displayTimeBox);
+    slideshowGroup->addWidget(showPlayer);
+
+    // show crop from metadata
+    QCheckBox *showCrop = new QCheckBox(tr("Show crop rectangle"), this);
+    showCrop->setObjectName("showCrop");
+    showCrop->setChecked(DkSettingsManager::param().display().showCrop);
+
+    DkGroupWidget *showCropGroup = new DkGroupWidget(tr("Show Metadata Cropping"), this);
+    showCropGroup->addWidget(showCrop);
+
+    // left column
+    QVBoxLayout *l = new QVBoxLayout(this);
+    l->setAlignment(Qt::AlignTop);
+    l->addWidget(zoomGroup);
+    l->addWidget(keepZoomGroup);
+    l->addWidget(iconGroup);
+    l->addWidget(navigationGroup);
+    l->addWidget(slideshowGroup);
+    l->addWidget(showCropGroup);
 }
 
-void DkDisplayPreference::on_interpolationBox_valueChanged(int value) const {
-
-	if (DkSettingsManager::param().display().interpolateZoomLevel != value)
-		DkSettingsManager::param().display().interpolateZoomLevel = value;
-
+void DkDisplayPreference::on_interpolationBox_valueChanged(int value) const
+{
+    if (DkSettingsManager::param().display().interpolateZoomLevel != value)
+        DkSettingsManager::param().display().interpolateZoomLevel = value;
 }
 
-void DkDisplayPreference::on_fadeImageBox_valueChanged(double value) const {
-
-	if (DkSettingsManager::param().display().animationDuration != value)
-		DkSettingsManager::param().display().animationDuration = (float)value;
-
+void DkDisplayPreference::on_fadeImageBox_valueChanged(double value) const
+{
+    if (DkSettingsManager::param().display().animationDuration != value)
+        DkSettingsManager::param().display().animationDuration = (float)value;
 }
 
-void DkDisplayPreference::on_displayTimeBox_valueChanged(double value) const {
-
-	if (DkSettingsManager::param().slideShow().time != value)
-		DkSettingsManager::param().slideShow().time = (float)value;
-
+void DkDisplayPreference::on_displayTimeBox_valueChanged(double value) const
+{
+    if (DkSettingsManager::param().slideShow().time != value)
+        DkSettingsManager::param().slideShow().time = (float)value;
 }
 
-void DkDisplayPreference::on_showPlayer_toggled(bool checked) const {
-
-	if (DkSettingsManager::param().slideShow().showPlayer != checked)
-		DkSettingsManager::param().slideShow().showPlayer = checked;
-
+void DkDisplayPreference::on_showPlayer_toggled(bool checked) const
+{
+    if (DkSettingsManager::param().slideShow().showPlayer != checked)
+        DkSettingsManager::param().slideShow().showPlayer = checked;
 }
 
-void DkDisplayPreference::on_iconSizeBox_valueChanged(int value) const {
-
-	if (DkSettingsManager::param().display().iconSize != value) {
-		DkSettingsManager::param().display().iconSize = value;
-		emit infoSignal(tr("Please Restart nomacs to apply changes"));
-	}
-
+void DkDisplayPreference::on_iconSizeBox_valueChanged(int value) const
+{
+    if (DkSettingsManager::param().display().iconSize != value) {
+        DkSettingsManager::param().display().iconSize = value;
+        emit infoSignal(tr("Please Restart nomacs to apply changes"));
+    }
 }
 
-void DkDisplayPreference::on_keepZoom_buttonClicked(int buttonId) const {
-	
-	if (DkSettingsManager::param().display().keepZoom != buttonId)
-		DkSettingsManager::param().display().keepZoom = buttonId;
+void DkDisplayPreference::on_keepZoom_buttonClicked(int buttonId) const
+{
+    if (DkSettingsManager::param().display().keepZoom != buttonId)
+        DkSettingsManager::param().display().keepZoom = buttonId;
 }
 
-void DkDisplayPreference::on_invertZoom_toggled(bool checked) const {
-
-	if (DkSettingsManager::param().display().invertZoom != checked)
-		DkSettingsManager::param().display().invertZoom = checked;
+void DkDisplayPreference::on_invertZoom_toggled(bool checked) const
+{
+    if (DkSettingsManager::param().display().invertZoom != checked)
+        DkSettingsManager::param().display().invertZoom = checked;
 }
 
-void DkDisplayPreference::on_hQAntiAliasing_toggled(bool checked) const {
-
-	if (DkSettingsManager::param().display().highQualityAntiAliasing != checked)
-		DkSettingsManager::param().display().highQualityAntiAliasing = checked;
+void DkDisplayPreference::on_hQAntiAliasing_toggled(bool checked) const
+{
+    if (DkSettingsManager::param().display().highQualityAntiAliasing != checked)
+        DkSettingsManager::param().display().highQualityAntiAliasing = checked;
 }
 
-void DkDisplayPreference::on_zoomToFit_toggled(bool checked) const {
-
-	if (DkSettingsManager::param().display().zoomToFit != checked)
-		DkSettingsManager::param().display().zoomToFit = checked;
-
+void DkDisplayPreference::on_zoomToFit_toggled(bool checked) const
+{
+    if (DkSettingsManager::param().display().zoomToFit != checked)
+        DkSettingsManager::param().display().zoomToFit = checked;
 }
 
-void DkDisplayPreference::on_transition_currentIndexChanged(int index) const {
-
-	if (DkSettingsManager::param().display().transition != index)
-		DkSettingsManager::param().display().transition = (DkSettings::TransitionMode)index;
-
+void DkDisplayPreference::on_transition_currentIndexChanged(int index) const
+{
+    if (DkSettingsManager::param().display().transition != index)
+        DkSettingsManager::param().display().transition = (DkSettings::TransitionMode)index;
 }
 
-void DkDisplayPreference::on_alwaysAnimate_toggled(bool checked) const {
-
-	if (DkSettingsManager::param().display().alwaysAnimate != checked)
-		DkSettingsManager::param().display().alwaysAnimate = checked;
-
+void DkDisplayPreference::on_alwaysAnimate_toggled(bool checked) const
+{
+    if (DkSettingsManager::param().display().alwaysAnimate != checked)
+        DkSettingsManager::param().display().alwaysAnimate = checked;
 }
 
-void DkDisplayPreference::on_showCrop_toggled(bool checked) const {
-
-	if (DkSettingsManager::param().display().showCrop != checked)
-		DkSettingsManager::param().display().showCrop = checked;
-
+void DkDisplayPreference::on_showCrop_toggled(bool checked) const
+{
+    if (DkSettingsManager::param().display().showCrop != checked)
+        DkSettingsManager::param().display().showCrop = checked;
 }
 
-void DkDisplayPreference::on_showScrollBars_toggled(bool checked) const {
-
-	if (DkSettingsManager::param().display().showScrollBars != checked)
-		DkSettingsManager::param().display().showScrollBars = checked;
+void DkDisplayPreference::on_showScrollBars_toggled(bool checked) const
+{
+    if (DkSettingsManager::param().display().showScrollBars != checked)
+        DkSettingsManager::param().display().showScrollBars = checked;
 }
 
-void DkDisplayPreference::on_useZoomLevels_toggled(bool checked) const {
-
-	DkZoomConfig::instance().setUseLevels(checked);
-	mZoomLevels->setEnabled(checked);
-
+void DkDisplayPreference::on_useZoomLevels_toggled(bool checked) const
+{
+    DkZoomConfig::instance().setUseLevels(checked);
+    mZoomLevels->setEnabled(checked);
 }
 
-void DkDisplayPreference::on_showNavigation_toggled(bool checked) const {
-
-	if (DkSettingsManager::param().display().showNavigation != checked)
-		DkSettingsManager::param().display().showNavigation = checked;
-
+void DkDisplayPreference::on_showNavigation_toggled(bool checked) const
+{
+    if (DkSettingsManager::param().display().showNavigation != checked)
+        DkSettingsManager::param().display().showNavigation = checked;
 }
 
-void DkDisplayPreference::on_zoomLevels_editingFinished() const {
-
-	DkZoomConfig& zc = DkZoomConfig::instance();
-	if (!zc.setLevels(mZoomLevelsEdit->text()))
-		mZoomLevelsEdit->setText(zc.levelsToString());
-
+void DkDisplayPreference::on_zoomLevels_editingFinished() const
+{
+    DkZoomConfig &zc = DkZoomConfig::instance();
+    if (!zc.setLevels(mZoomLevelsEdit->text()))
+        mZoomLevelsEdit->setText(zc.levelsToString());
 }
 
-void DkDisplayPreference::on_zoomLevelsDefault_clicked() const {
-
-	DkZoomConfig::instance().setLevelsToDefault();
-	mZoomLevelsEdit->setText(DkZoomConfig::instance().levelsToString());
+void DkDisplayPreference::on_zoomLevelsDefault_clicked() const
+{
+    DkZoomConfig::instance().setLevelsToDefault();
+    mZoomLevelsEdit->setText(DkZoomConfig::instance().levelsToString());
 }
 
-void DkDisplayPreference::paintEvent(QPaintEvent *event) {
-
-	// fixes stylesheets which are not applied to custom widgets
-	QStyleOption opt;
-	opt.init(this);
-	QPainter p(this);
-	style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
+void DkDisplayPreference::paintEvent(QPaintEvent *event)
+{
+    // fixes stylesheets which are not applied to custom widgets
+    QStyleOption opt;
+    opt.initFrom(this);
+    QPainter p(this);
+    style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
 
-	QWidget::paintEvent(event);
+    QWidget::paintEvent(event);
 }
 
 // DkDummySettings --------------------------------------------------------------------
-DkFilePreference::DkFilePreference(QWidget* parent) : DkWidget(parent) {
-
-	createLayout();
-	QMetaObject::connectSlotsByName(this);
-}
-
-void DkFilePreference::createLayout() {
-
-	// temp folder
-	DkDirectoryChooser* dirChooser = new DkDirectoryChooser(DkSettingsManager::param().global().tmpPath, this);
-	dirChooser->setObjectName("dirChooser");
-
-	QLabel* tLabel = new QLabel(tr("Screenshots are automatically saved to this folder"), this);
-	
-	DkGroupWidget* tempFolderGroup = new DkGroupWidget(tr("Use Temporary Folder"), this);
-	tempFolderGroup->addWidget(dirChooser);
-	tempFolderGroup->addWidget(tLabel);
-
-	// cache size
-	int maxRam = qMax(qRound(DkMemory::getTotalMemory()), 1024);
-	qInfo() << "Available RAM: " << maxRam << "MB";
-	QSpinBox* cacheBox = new QSpinBox(this);
-	cacheBox->setObjectName("cacheBox");
-	cacheBox->setMinimum(0);
-	cacheBox->setMaximum(maxRam);
-	cacheBox->setSuffix(" MB");
-	cacheBox->setMaximumWidth(200);
-	cacheBox->setValue(qRound(DkSettingsManager::param().resources().cacheMemory));
-
-	QLabel* cLabel = new QLabel(tr("We recommend to set a moderate cache value around 100 MB. [%1-%2 MB]")
-		.arg(cacheBox->minimum()).arg(cacheBox->maximum()), this);
-	
-	DkGroupWidget* cacheGroup = new DkGroupWidget(tr("Maximal Cache Size"), this);
-	cacheGroup->addWidget(cacheBox);
-	cacheGroup->addWidget(cLabel);
-
-	// history size
-	// cache size
-	QSpinBox* historyBox = new QSpinBox(this);
-	historyBox->setObjectName("historyBox");
-	historyBox->setMinimum(0);
-	historyBox->setMaximum(1024);
-	historyBox->setSuffix(" MB");
-	historyBox->setMaximumWidth(200);
-	historyBox->setValue(qRound(DkSettingsManager::param().resources().historyMemory));
-
-	QLabel* hLabel = new QLabel(tr("We recommend to set a moderate edit history value around 100 MB. [%1-%2 MB]")
-		.arg(historyBox->minimum()).arg(historyBox->maximum()), this);
-
-	DkGroupWidget* historyGroup = new DkGroupWidget(tr("History Size"), this);
-	historyGroup->addWidget(historyBox);
-	historyGroup->addWidget(hLabel);
-	
-	// loading policy
-	QVector<QRadioButton*> loadButtons;
-	loadButtons.append(new QRadioButton(tr("Skip Images"), this));
-	loadButtons[0]->setToolTip(tr("Images are skipped until the Next key is released"));
-	loadButtons.append(new QRadioButton(tr("Wait for Images to be Loaded"), this));
-	loadButtons[1]->setToolTip(tr("The next image is loaded after the current image is shown."));
-
-	// check wrt the current settings
-	loadButtons[0]->setChecked(!DkSettingsManager::param().resources().waitForLastImg);
-	loadButtons[1]->setChecked(DkSettingsManager::param().resources().waitForLastImg);
-
-	QButtonGroup* loadButtonGroup = new QButtonGroup(this);
-	loadButtonGroup->setObjectName("loadGroup");
-	loadButtonGroup->addButton(loadButtons[0], 0);
-	loadButtonGroup->addButton(loadButtons[1], 1);
-
-	DkGroupWidget* loadGroup = new DkGroupWidget(tr("Image Loading Policy"), this);
-	loadGroup->addWidget(loadButtons[0]);
-	loadGroup->addWidget(loadButtons[1]);
-
-	// save policy
-	QVector<QRadioButton*> saveButtons;
-	saveButtons.append(new QRadioButton(tr("Load Saved Images"), this));
-	saveButtons[0]->setToolTip(tr("After saving, the saved image will be loaded in place"));
-	saveButtons.append(new QRadioButton(tr("Load to Tab"), this));
-	saveButtons[1]->setToolTip(tr("After saving, the saved image will be loaded to a tab."));
-	saveButtons.append(new QRadioButton(tr("Do Nothing"), this));
-	saveButtons[2]->setToolTip(tr("The saved image will not be loaded."));
-
-	// check wrt the current settings
-	saveButtons[DkSettingsManager::param().resources().loadSavedImage]->setChecked(true);
-
-	QButtonGroup* saveButtonGroup = new QButtonGroup(this);
-	saveButtonGroup->setObjectName("saveGroup");
-
-	DkGroupWidget* saveGroup = new DkGroupWidget(tr("Image Saving Policy"), this);
-	
-	for (int idx = 0; idx < saveButtons.size(); idx++) {
-		saveButtonGroup->addButton(saveButtons[idx], idx);
-		saveGroup->addWidget(saveButtons[idx]);
-	}
-
-	// skip images
-	QSpinBox* skipBox = new QSpinBox(this);
-	skipBox->setObjectName("skipBox");
-	skipBox->setMinimum(2);
-	skipBox->setMaximum(1000);
-	skipBox->setValue(DkSettingsManager::param().global().skipImgs);
-	skipBox->setMaximumWidth(200);
-
-	DkGroupWidget* skipGroup = new DkGroupWidget(tr("Number of Skipped Images on PgUp/PgDown"), this);
-	skipGroup->addWidget(skipBox);
-
-	// left column
-	QVBoxLayout* l = new QVBoxLayout(this);
-	l->setAlignment(Qt::AlignTop);
-	l->addWidget(tempFolderGroup);
-	l->addWidget(cacheGroup);
-	l->addWidget(historyGroup);
-	l->addWidget(loadGroup);
-	l->addWidget(saveGroup);
-	l->addWidget(skipGroup);
-}
-
-void DkFilePreference::on_dirChooser_directoryChanged(const QString& dirPath) const {
-
-	bool dirExists = QDir(dirPath).exists();
-
-	if (DkSettingsManager::param().global().tmpPath != dirPath && dirExists)
-		DkSettingsManager::param().global().tmpPath = dirPath;
-	else if (!dirExists)
-		DkSettingsManager::param().global().tmpPath = "";
-
+DkFilePreference::DkFilePreference(QWidget *parent)
+    : DkWidget(parent)
+{
+    createLayout();
+    QMetaObject::connectSlotsByName(this);
+}
+
+void DkFilePreference::createLayout()
+{
+    // temp folder
+    DkDirectoryChooser *dirChooser = new DkDirectoryChooser(DkSettingsManager::param().global().tmpPath, this);
+    dirChooser->setObjectName("dirChooser");
+
+    QLabel *tLabel = new QLabel(tr("Screenshots are automatically saved to this folder"), this);
+
+    DkGroupWidget *tempFolderGroup = new DkGroupWidget(tr("Use Temporary Folder"), this);
+    tempFolderGroup->addWidget(dirChooser);
+    tempFolderGroup->addWidget(tLabel);
+
+    // cache size
+    int maxRam = qMax(qRound(DkMemory::getTotalMemory()), 1024);
+    qInfo() << "Available RAM: " << maxRam << "MB";
+    QSpinBox *cacheBox = new QSpinBox(this);
+    cacheBox->setObjectName("cacheBox");
+    cacheBox->setMinimum(0);
+    cacheBox->setMaximum(maxRam);
+    cacheBox->setSuffix(" MB");
+    cacheBox->setMaximumWidth(200);
+    cacheBox->setValue(qRound(DkSettingsManager::param().resources().cacheMemory));
+
+    QLabel *cLabel =
+        new QLabel(tr("We recommend to set a moderate cache value around 100 MB. [%1-%2 MB]").arg(cacheBox->minimum()).arg(cacheBox->maximum()), this);
+
+    DkGroupWidget *cacheGroup = new DkGroupWidget(tr("Maximal Cache Size"), this);
+    cacheGroup->addWidget(cacheBox);
+    cacheGroup->addWidget(cLabel);
+
+    // history size
+    // cache size
+    QSpinBox *historyBox = new QSpinBox(this);
+    historyBox->setObjectName("historyBox");
+    historyBox->setMinimum(0);
+    historyBox->setMaximum(1024);
+    historyBox->setSuffix(" MB");
+    historyBox->setMaximumWidth(200);
+    historyBox->setValue(qRound(DkSettingsManager::param().resources().historyMemory));
+
+    QLabel *hLabel =
+        new QLabel(tr("We recommend to set a moderate edit history value around 100 MB. [%1-%2 MB]").arg(historyBox->minimum()).arg(historyBox->maximum()),
+                   this);
+
+    DkGroupWidget *historyGroup = new DkGroupWidget(tr("History Size"), this);
+    historyGroup->addWidget(historyBox);
+    historyGroup->addWidget(hLabel);
+
+    // loading policy
+    QVector<QRadioButton *> loadButtons;
+    loadButtons.append(new QRadioButton(tr("Skip Images"), this));
+    loadButtons[0]->setToolTip(tr("Images are skipped until the Next key is released"));
+    loadButtons.append(new QRadioButton(tr("Wait for Images to be Loaded"), this));
+    loadButtons[1]->setToolTip(tr("The next image is loaded after the current image is shown."));
+
+    // check wrt the current settings
+    loadButtons[0]->setChecked(!DkSettingsManager::param().resources().waitForLastImg);
+    loadButtons[1]->setChecked(DkSettingsManager::param().resources().waitForLastImg);
+
+    QButtonGroup *loadButtonGroup = new QButtonGroup(this);
+    loadButtonGroup->setObjectName("loadGroup");
+    loadButtonGroup->addButton(loadButtons[0], 0);
+    loadButtonGroup->addButton(loadButtons[1], 1);
+
+    DkGroupWidget *loadGroup = new DkGroupWidget(tr("Image Loading Policy"), this);
+    loadGroup->addWidget(loadButtons[0]);
+    loadGroup->addWidget(loadButtons[1]);
+
+    // save policy
+    QVector<QRadioButton *> saveButtons;
+    saveButtons.append(new QRadioButton(tr("Load Saved Images"), this));
+    saveButtons[0]->setToolTip(tr("After saving, the saved image will be loaded in place"));
+    saveButtons.append(new QRadioButton(tr("Load to Tab"), this));
+    saveButtons[1]->setToolTip(tr("After saving, the saved image will be loaded to a tab."));
+    saveButtons.append(new QRadioButton(tr("Do Nothing"), this));
+    saveButtons[2]->setToolTip(tr("The saved image will not be loaded."));
+
+    // check wrt the current settings
+    saveButtons[DkSettingsManager::param().resources().loadSavedImage]->setChecked(true);
+
+    QButtonGroup *saveButtonGroup = new QButtonGroup(this);
+    saveButtonGroup->setObjectName("saveGroup");
+
+    DkGroupWidget *saveGroup = new DkGroupWidget(tr("Image Saving Policy"), this);
+
+    for (int idx = 0; idx < saveButtons.size(); idx++) {
+        saveButtonGroup->addButton(saveButtons[idx], idx);
+        saveGroup->addWidget(saveButtons[idx]);
+    }
+
+    // skip images
+    QSpinBox *skipBox = new QSpinBox(this);
+    skipBox->setObjectName("skipBox");
+    skipBox->setMinimum(2);
+    skipBox->setMaximum(1000);
+    skipBox->setValue(DkSettingsManager::param().global().skipImgs);
+    skipBox->setMaximumWidth(200);
+
+    DkGroupWidget *skipGroup = new DkGroupWidget(tr("Number of Skipped Images on PgUp/PgDown"), this);
+    skipGroup->addWidget(skipBox);
+
+    // left column
+    QVBoxLayout *l = new QVBoxLayout(this);
+    l->setAlignment(Qt::AlignTop);
+    l->addWidget(tempFolderGroup);
+    l->addWidget(cacheGroup);
+    l->addWidget(historyGroup);
+    l->addWidget(loadGroup);
+    l->addWidget(saveGroup);
+    l->addWidget(skipGroup);
+}
+
+void DkFilePreference::on_dirChooser_directoryChanged(const QString &dirPath) const
+{
+    bool dirExists = QDir(dirPath).exists();
+
+    if (DkSettingsManager::param().global().tmpPath != dirPath && dirExists)
+        DkSettingsManager::param().global().tmpPath = dirPath;
+    else if (!dirExists)
+        DkSettingsManager::param().global().tmpPath = "";
+}
+
+void DkFilePreference::on_loadGroup_buttonClicked(int buttonId) const
+{
+    if (DkSettingsManager::param().resources().waitForLastImg != (buttonId == 1))
+        DkSettingsManager::param().resources().waitForLastImg = (buttonId == 1);
+}
+
+void DkFilePreference::on_saveGroup_buttonClicked(int buttonId) const
+{
+    if (DkSettingsManager::param().resources().loadSavedImage != buttonId)
+        DkSettingsManager::param().resources().loadSavedImage = buttonId;
+}
+
+void DkFilePreference::on_skipBox_valueChanged(int value) const
+{
+    if (DkSettingsManager::param().global().skipImgs != value) {
+        DkSettingsManager::param().global().skipImgs = value;
+    }
 }
 
-void DkFilePreference::on_loadGroup_buttonClicked(int buttonId) const {
-
-	if (DkSettingsManager::param().resources().waitForLastImg != (buttonId == 1))
-		DkSettingsManager::param().resources().waitForLastImg = (buttonId == 1);
-
-}
-
-void DkFilePreference::on_saveGroup_buttonClicked(int buttonId) const {
-
-	if (DkSettingsManager::param().resources().loadSavedImage != buttonId)
-		DkSettingsManager::param().resources().loadSavedImage = buttonId;
-
-}
-
-void DkFilePreference::on_skipBox_valueChanged(int value) const {
-
-	if (DkSettingsManager::param().global().skipImgs != value) {
-		DkSettingsManager::param().global().skipImgs = value;
-	}
-
+void DkFilePreference::on_cacheBox_valueChanged(int value) const
+{
+    if (DkSettingsManager::param().resources().cacheMemory != value) {
+        DkSettingsManager::param().resources().cacheMemory = (float)value;
+    }
 }
 
-void DkFilePreference::on_cacheBox_valueChanged(int value) const {
-
-	if (DkSettingsManager::param().resources().cacheMemory != value) {
-		DkSettingsManager::param().resources().cacheMemory = (float)value;
-	}
-
+void DkFilePreference::on_historyBox_valueChanged(int value) const
+{
+    if (DkSettingsManager::param().resources().historyMemory != value) {
+        DkSettingsManager::param().resources().historyMemory = (float)value;
+    }
 }
 
-void DkFilePreference::on_historyBox_valueChanged(int value) const {
+void DkFilePreference::paintEvent(QPaintEvent *event)
+{
+    // fixes stylesheets which are not applied to custom widgets
+    QStyleOption opt;
+    opt.initFrom(this);
+    QPainter p(this);
+    style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
 
-	if (DkSettingsManager::param().resources().historyMemory != value) {
-		DkSettingsManager::param().resources().historyMemory = (float)value;
-	}
-}
-
-void DkFilePreference::paintEvent(QPaintEvent *event) {
-
-	// fixes stylesheets which are not applied to custom widgets
-	QStyleOption opt;
-	opt.init(this);
-	QPainter p(this);
-	style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
-
-	QWidget::paintEvent(event);
+    QWidget::paintEvent(event);
 }
 
 // DkFileAssocationsSettings --------------------------------------------------------------------
-DkFileAssociationsPreference::DkFileAssociationsPreference(QWidget* parent) : DkWidget(parent) {
-
-	createLayout();
-	QMetaObject::connectSlotsByName(this);
-}
-
-DkFileAssociationsPreference::~DkFileAssociationsPreference() {
-
-	// save settings
-	if (mSaveSettings) {
-		writeSettings();
-		mSaveSettings = false;
-		DkSettingsManager::param().save();
-	}
-}
-
-void DkFileAssociationsPreference::createLayout() {
-	
-	QStringList fileFilters = DkSettingsManager::param().app().openFilters;
-
-	mModel = new QStandardItemModel(this);
-	mModel->setObjectName("fileModel");
-	for (int rIdx = 1; rIdx < fileFilters.size(); rIdx++)
-		mModel->appendRow(getItems(fileFilters.at(rIdx), checkFilter(fileFilters.at(rIdx), DkSettingsManager::param().app().browseFilters), checkFilter(fileFilters.at(rIdx), DkSettingsManager::param().app().registerFilters)));
-
-	mModel->setHeaderData(0, Qt::Horizontal, tr("Filter"));
-	mModel->setHeaderData(1, Qt::Horizontal, tr("Browse"));
-	mModel->setHeaderData(2, Qt::Horizontal, tr("Register"));
-
-	QTableView* filterTableView = new QTableView(this);
-	filterTableView->setModel(mModel);
-	filterTableView->setSelectionBehavior(QAbstractItemView::SelectRows);
-	filterTableView->verticalHeader()->hide();
-	filterTableView->setShowGrid(false);
-	filterTableView->resizeColumnsToContents();
-	filterTableView->resizeRowsToContents();
-	filterTableView->setWordWrap(false);
-
-	// now the final widgets
-	QVBoxLayout* layout = new QVBoxLayout(this);
-	layout->setAlignment(Qt::AlignTop);
-	layout->addWidget(filterTableView);
+DkFileAssociationsPreference::DkFileAssociationsPreference(QWidget *parent)
+    : DkWidget(parent)
+{
+    createLayout();
+    QMetaObject::connectSlotsByName(this);
+}
+
+DkFileAssociationsPreference::~DkFileAssociationsPreference()
+{
+    // save settings
+    if (mSaveSettings) {
+        writeSettings();
+        mSaveSettings = false;
+        DkSettingsManager::param().save();
+    }
+}
+
+void DkFileAssociationsPreference::createLayout()
+{
+    QStringList fileFilters = DkSettingsManager::param().app().openFilters;
+
+    mModel = new QStandardItemModel(this);
+    mModel->setObjectName("fileModel");
+    for (int rIdx = 1; rIdx < fileFilters.size(); rIdx++)
+        mModel->appendRow(getItems(fileFilters.at(rIdx),
+                                   checkFilter(fileFilters.at(rIdx), DkSettingsManager::param().app().browseFilters),
+                                   checkFilter(fileFilters.at(rIdx), DkSettingsManager::param().app().registerFilters)));
+
+    mModel->setHeaderData(0, Qt::Horizontal, tr("Filter"));
+    mModel->setHeaderData(1, Qt::Horizontal, tr("Browse"));
+    mModel->setHeaderData(2, Qt::Horizontal, tr("Register"));
+
+    QTableView *filterTableView = new QTableView(this);
+    filterTableView->setModel(mModel);
+    filterTableView->setSelectionBehavior(QAbstractItemView::SelectRows);
+    filterTableView->verticalHeader()->hide();
+    filterTableView->setShowGrid(false);
+    filterTableView->resizeColumnsToContents();
+    filterTableView->resizeRowsToContents();
+    filterTableView->setWordWrap(false);
+
+    // now the final widgets
+    QVBoxLayout *layout = new QVBoxLayout(this);
+    layout->setAlignment(Qt::AlignTop);
+    layout->addWidget(filterTableView);
 
 #ifdef Q_OS_WIN
 
-	QPushButton* assocFiles = new QPushButton(tr("Set File Associations"), this);
-	assocFiles->setObjectName("associateFiles");
+    QPushButton *assocFiles = new QPushButton(tr("Set File Associations"), this);
+    assocFiles->setObjectName("associateFiles");
 
-	QPushButton* openDefault = new QPushButton(tr("Set as Default Viewer"), this);
-	openDefault->setObjectName("openDefault");
+    QPushButton *openDefault = new QPushButton(tr("Set as Default Viewer"), this);
+    openDefault->setObjectName("openDefault");
 
-	QWidget* bw = new QWidget(this);
-	QHBoxLayout* l = new QHBoxLayout(bw);
-	l->setAlignment(Qt::AlignLeft);
-	l->setContentsMargins(0, 0, 0, 0);
-	l->addWidget(openDefault);
-	l->addWidget(assocFiles);
+    QWidget *bw = new QWidget(this);
+    QHBoxLayout *l = new QHBoxLayout(bw);
+    l->setAlignment(Qt::AlignLeft);
+    l->setContentsMargins(0, 0, 0, 0);
+    l->addWidget(openDefault);
+    l->addWidget(assocFiles);
 
-	layout->addWidget(bw);
+    layout->addWidget(bw);
 #endif
-
 }
 
-void DkFileAssociationsPreference::on_fileModel_itemChanged(QStandardItem*) {
-
-	mSaveSettings = true;
-	emit infoSignal(tr("Please Restart nomacs to apply changes"));
+void DkFileAssociationsPreference::on_fileModel_itemChanged(QStandardItem *)
+{
+    mSaveSettings = true;
+    emit infoSignal(tr("Please Restart nomacs to apply changes"));
 }
 
-void DkFileAssociationsPreference::on_openDefault_clicked() const {
-	
-	DkFileFilterHandling fh;
-	fh.showDefaultSoftware();
+void DkFileAssociationsPreference::on_openDefault_clicked() const
+{
+    DkFileFilterHandling fh;
+    fh.showDefaultSoftware();
 }
 
-void DkFileAssociationsPreference::on_associateFiles_clicked() {
-	
-	mSaveSettings = true;
-	emit infoSignal(tr("Please Restart nomacs to apply changes"));
+void DkFileAssociationsPreference::on_associateFiles_clicked()
+{
+    mSaveSettings = true;
+    emit infoSignal(tr("Please Restart nomacs to apply changes"));
 }
 
-bool DkFileAssociationsPreference::checkFilter(const QString& cFilter, const QStringList& filters) const {
-
-	if (filters.empty() && (DkSettingsManager::param().app().containerFilters.contains(cFilter) || cFilter.contains("ico")))
-		return false;
+bool DkFileAssociationsPreference::checkFilter(const QString &cFilter, const QStringList &filters) const
+{
+    if (filters.empty() && (DkSettingsManager::param().app().containerFilters.contains(cFilter) || cFilter.contains("ico")))
+        return false;
 
-	if (filters.empty())
-		return true;
+    if (filters.empty())
+        return true;
 
-	for (int idx = 0; idx < filters.size(); idx++)
-		if (cFilter.contains(filters[idx]))
-			return true;
+    for (int idx = 0; idx < filters.size(); idx++)
+        if (cFilter.contains(filters[idx]))
+            return true;
 
-	return filters.indexOf(cFilter) != -1;
+    return filters.indexOf(cFilter) != -1;
 }
 
-QList<QStandardItem*> DkFileAssociationsPreference::getItems(const QString& filter, bool browse, bool reg) {
-
-	QList<QStandardItem* > items;
-	QStandardItem* item = new QStandardItem(filter);
-	item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
-	items.append(item);
-	item = new QStandardItem("");
-	//item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable);
-	item->setCheckable(true);
-	item->setCheckState(browse ? Qt::Checked : Qt::Unchecked);
-	items.append(item);
-	item = new QStandardItem("");
-	//item->setFlags(Qt::Qt::ItemIsSelectable | Qt::ItemIsUserCheckable);
-	item->setCheckable(true);
-	item->setCheckState(reg ? Qt::Checked : Qt::Unchecked);
-#ifndef Q_OS_WIN	// registering is windows only
-	item->setEnabled(false);
+QList<QStandardItem *> DkFileAssociationsPreference::getItems(const QString &filter, bool browse, bool reg)
+{
+    QList<QStandardItem *> items;
+    QStandardItem *item = new QStandardItem(filter);
+    item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
+    items.append(item);
+    item = new QStandardItem("");
+    // item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable);
+    item->setCheckable(true);
+    item->setCheckState(browse ? Qt::Checked : Qt::Unchecked);
+    items.append(item);
+    item = new QStandardItem("");
+    // item->setFlags(Qt::Qt::ItemIsSelectable | Qt::ItemIsUserCheckable);
+    item->setCheckable(true);
+    item->setCheckState(reg ? Qt::Checked : Qt::Unchecked);
+#ifndef Q_OS_WIN // registering is windows only
+    item->setEnabled(false);
 #endif
-	items.append(item);
-
-	return items;
+    items.append(item);
 
+    return items;
 }
 
-void DkFileAssociationsPreference::writeSettings() const {
-
-	DkFileFilterHandling fh;
-	DkSettingsManager::param().app().browseFilters.clear();
-	DkSettingsManager::param().app().registerFilters.clear();
-
-	for (int idx = 0; idx < mModel->rowCount(); idx++) {
-
-		QStandardItem* item = mModel->item(idx, 0);
+void DkFileAssociationsPreference::writeSettings() const
+{
+    DkFileFilterHandling fh;
+    DkSettingsManager::param().app().browseFilters.clear();
+    DkSettingsManager::param().app().registerFilters.clear();
 
-		if (!item)
-			continue;
+    for (int idx = 0; idx < mModel->rowCount(); idx++) {
+        QStandardItem *item = mModel->item(idx, 0);
 
-		QStandardItem* browseItem = mModel->item(idx, 1);
-		QStandardItem* regItem = mModel->item(idx, 2);
+        if (!item)
+            continue;
 
-		if (browseItem && browseItem->checkState() == Qt::Checked) {
+        QStandardItem *browseItem = mModel->item(idx, 1);
+        QStandardItem *regItem = mModel->item(idx, 2);
 
-			QString cFilter = item->text();
-			cFilter = cFilter.section(QRegExp("(\\(|\\))"), 1);
-			cFilter = cFilter.replace(")", "");
+        if (browseItem && browseItem->checkState() == Qt::Checked) {
+            QString cFilter = item->text();
+            cFilter = cFilter.section(QRegularExpression("(\\(|\\))"), 1);
+            cFilter = cFilter.replace(")", "");
 
-			DkSettingsManager::param().app().browseFilters += cFilter.split(" ");
-		}
+            DkSettingsManager::param().app().browseFilters += cFilter.split(" ");
+        }
 
-		fh.registerFileType(item->text(), tr("Image"), regItem->checkState() == Qt::Checked);
+        fh.registerFileType(item->text(), tr("Image"), regItem->checkState() == Qt::Checked);
 
-		if (regItem->checkState() == Qt::Checked) {
-			DkSettingsManager::param().app().registerFilters.append(item->text());
-			qDebug() << item->text() << " registered";
-		}
-		else
-			qDebug() << item->text() << " unregistered";
-	}
+        if (regItem->checkState() == Qt::Checked) {
+            DkSettingsManager::param().app().registerFilters.append(item->text());
+            qDebug() << item->text() << " registered";
+        } else
+            qDebug() << item->text() << " unregistered";
+    }
 
-	fh.registerNomacs();	// register nomacs again - to be save
+    fh.registerNomacs(); // register nomacs again - to be save
 }
 
-void DkFileAssociationsPreference::paintEvent(QPaintEvent *event) {
+void DkFileAssociationsPreference::paintEvent(QPaintEvent *event)
+{
+    // fixes stylesheets which are not applied to custom widgets
+    QStyleOption opt;
+    opt.initFrom(this);
+    QPainter p(this);
+    style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
 
-	// fixes stylesheets which are not applied to custom widgets
-	QStyleOption opt;
-	opt.init(this);
-	QPainter p(this);
-	style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
-
-	QWidget::paintEvent(event);
+    QWidget::paintEvent(event);
 }
 
 // DkAdvancedSettings --------------------------------------------------------------------
-DkAdvancedPreference::DkAdvancedPreference(QWidget* parent) : DkWidget(parent) {
-
-	createLayout();
-	QMetaObject::connectSlotsByName(this);
-}
-
-void DkAdvancedPreference::createLayout() {
-
-	// load RAW radio buttons
-	QVector<QRadioButton*> loadRawButtons;
-	loadRawButtons.resize(DkSettings::raw_thumb_end);
-	loadRawButtons[DkSettings::raw_thumb_always] = new QRadioButton(tr("Always Load JPG if Embedded"), this);
-	loadRawButtons[DkSettings::raw_thumb_if_large] = new QRadioButton(tr("Load JPG if it Fits the Screen Resolution"), this);
-	loadRawButtons[DkSettings::raw_thumb_never] = new QRadioButton(tr("Always Load RAW Data"), this);
-
-	// check wrt the current settings
-	loadRawButtons[DkSettingsManager::param().resources().loadRawThumb]->setChecked(true);
-
-	QButtonGroup* loadRawButtonGroup = new QButtonGroup(this);
-	loadRawButtonGroup->setObjectName("loadRaw");
-	loadRawButtonGroup->addButton(loadRawButtons[DkSettings::raw_thumb_always], DkSettings::raw_thumb_always);
-	loadRawButtonGroup->addButton(loadRawButtons[DkSettings::raw_thumb_if_large], DkSettings::raw_thumb_if_large);
-	loadRawButtonGroup->addButton(loadRawButtons[DkSettings::raw_thumb_never], DkSettings::raw_thumb_never);
-
-	QCheckBox* cbFilterRaw = new QCheckBox(tr("Apply Noise Filtering to RAW Images"), this);
-	cbFilterRaw->setObjectName("filterRaw");
-	cbFilterRaw->setToolTip(tr("If checked, a noise filter is applied which reduced color noise"));
-	cbFilterRaw->setChecked(DkSettingsManager::param().resources().filterRawImages);
-
-	DkGroupWidget* loadRawGroup = new DkGroupWidget(tr("RAW Loader Settings"), this);
-	loadRawGroup->addWidget(loadRawButtons[DkSettings::raw_thumb_always]);
-	loadRawGroup->addWidget(loadRawButtons[DkSettings::raw_thumb_if_large]);
-	loadRawGroup->addWidget(loadRawButtons[DkSettings::raw_thumb_never]);
-	loadRawGroup->addSpace();
-	loadRawGroup->addWidget(cbFilterRaw);
-
-	// file loading
-	QCheckBox* cbSaveDeleted = new QCheckBox(tr("Ask to Save Deleted Files"), this);
-	cbSaveDeleted->setObjectName("saveDeleted");
-	cbSaveDeleted->setToolTip(tr("If checked, nomacs asks to save files which were deleted by other applications"));
-	cbSaveDeleted->setChecked(DkSettingsManager::param().global().askToSaveDeletedFiles);
-
-	QCheckBox* cbIgnoreExif = new QCheckBox(tr("Ignore Exif Orientation when Loading"), this);
-	cbIgnoreExif->setObjectName("ignoreExif");
-	cbIgnoreExif->setToolTip(tr("If checked, images are NOT rotated with respect to their Exif orientation"));
-	cbIgnoreExif->setChecked(DkSettingsManager::param().metaData().ignoreExifOrientation);
-
-	QCheckBox* cbSaveExif = new QCheckBox(tr("Save Exif Orientation"), this);
-	cbSaveExif->setObjectName("saveExif");
-	cbSaveExif->setToolTip(tr("If checked, orientation is written to the Exif rather than rotating the image Matrix\n") +
-		tr("NOTE: this allows for rotating JPGs without losing information."));
-	cbSaveExif->setChecked(DkSettingsManager::param().metaData().saveExifOrientation);
-
-	DkGroupWidget* loadFileGroup = new DkGroupWidget(tr("File Loading/Saving"), this);
-	loadFileGroup->addWidget(cbSaveDeleted);
-	loadFileGroup->addWidget(cbIgnoreExif);
-	loadFileGroup->addWidget(cbSaveExif);
-
-	// batch processing
-	QSpinBox* sbNumThreads = new QSpinBox(this);
-	sbNumThreads->setObjectName("numThreads");
-	sbNumThreads->setToolTip(tr("Choose the number of Threads in the thread pool"));
-	sbNumThreads->setMinimum(1);
-	sbNumThreads->setMaximum(100);
-	sbNumThreads->setValue(DkSettingsManager::param().global().numThreads);
-
-	DkGroupWidget* threadsGroup = new DkGroupWidget(tr("Number of Threads"), this);
-	threadsGroup->addWidget(sbNumThreads);
-
-	// native dialogs
-	QCheckBox* cbNative = new QCheckBox(tr("Enable Native File Dialogs"), this);
-	cbNative->setObjectName("useNative");
-	cbNative->setToolTip(tr("If checked, native system dialogs are used for opening/saving files."));
-	cbNative->setChecked(DkSettingsManager::param().resources().nativeDialog);
-
-	DkGroupWidget* nativeGroup = new DkGroupWidget(tr("Native Dialogs"), this);
-	nativeGroup->addWidget(cbNative);
-
-	// log
-	QCheckBox* cbUseLog = new QCheckBox(tr("Use Log File"), this);
-	cbUseLog->setObjectName("useLog");
-	cbUseLog->setToolTip(tr("If checked, a log file will be created."));
-	cbUseLog->setChecked(DkSettingsManager::param().app().useLogFile);
-
-	QPushButton* pbLog = new QPushButton(tr("Open Log"), this);
-	pbLog->setObjectName("logFolder");
+DkAdvancedPreference::DkAdvancedPreference(QWidget *parent)
+    : DkWidget(parent)
+{
+    createLayout();
+    QMetaObject::connectSlotsByName(this);
+}
+
+void DkAdvancedPreference::createLayout()
+{
+    // load RAW radio buttons
+    QVector<QRadioButton *> loadRawButtons;
+    loadRawButtons.resize(DkSettings::raw_thumb_end);
+    loadRawButtons[DkSettings::raw_thumb_always] = new QRadioButton(tr("Always Load JPG if Embedded"), this);
+    loadRawButtons[DkSettings::raw_thumb_if_large] = new QRadioButton(tr("Load JPG if it Fits the Screen Resolution"), this);
+    loadRawButtons[DkSettings::raw_thumb_never] = new QRadioButton(tr("Always Load RAW Data"), this);
+
+    // check wrt the current settings
+    loadRawButtons[DkSettingsManager::param().resources().loadRawThumb]->setChecked(true);
+
+    QButtonGroup *loadRawButtonGroup = new QButtonGroup(this);
+    loadRawButtonGroup->setObjectName("loadRaw");
+    loadRawButtonGroup->addButton(loadRawButtons[DkSettings::raw_thumb_always], DkSettings::raw_thumb_always);
+    loadRawButtonGroup->addButton(loadRawButtons[DkSettings::raw_thumb_if_large], DkSettings::raw_thumb_if_large);
+    loadRawButtonGroup->addButton(loadRawButtons[DkSettings::raw_thumb_never], DkSettings::raw_thumb_never);
+
+    QCheckBox *cbFilterRaw = new QCheckBox(tr("Apply Noise Filtering to RAW Images"), this);
+    cbFilterRaw->setObjectName("filterRaw");
+    cbFilterRaw->setToolTip(tr("If checked, a noise filter is applied which reduced color noise"));
+    cbFilterRaw->setChecked(DkSettingsManager::param().resources().filterRawImages);
+
+    DkGroupWidget *loadRawGroup = new DkGroupWidget(tr("RAW Loader Settings"), this);
+    loadRawGroup->addWidget(loadRawButtons[DkSettings::raw_thumb_always]);
+    loadRawGroup->addWidget(loadRawButtons[DkSettings::raw_thumb_if_large]);
+    loadRawGroup->addWidget(loadRawButtons[DkSettings::raw_thumb_never]);
+    loadRawGroup->addSpace();
+    loadRawGroup->addWidget(cbFilterRaw);
+
+    // file loading
+    QCheckBox *cbSaveDeleted = new QCheckBox(tr("Ask to Save Deleted Files"), this);
+    cbSaveDeleted->setObjectName("saveDeleted");
+    cbSaveDeleted->setToolTip(tr("If checked, nomacs asks to save files which were deleted by other applications"));
+    cbSaveDeleted->setChecked(DkSettingsManager::param().global().askToSaveDeletedFiles);
+
+    QCheckBox *cbIgnoreExif = new QCheckBox(tr("Ignore Exif Orientation when Loading"), this);
+    cbIgnoreExif->setObjectName("ignoreExif");
+    cbIgnoreExif->setToolTip(tr("If checked, images are NOT rotated with respect to their Exif orientation"));
+    cbIgnoreExif->setChecked(DkSettingsManager::param().metaData().ignoreExifOrientation);
+
+    QCheckBox *cbSaveExif = new QCheckBox(tr("Save Exif Orientation"), this);
+    cbSaveExif->setObjectName("saveExif");
+    cbSaveExif->setToolTip(tr("If checked, orientation is written to the Exif rather than rotating the image Matrix\n")
+                           + tr("NOTE: this allows for rotating JPGs without losing information."));
+    cbSaveExif->setChecked(DkSettingsManager::param().metaData().saveExifOrientation);
+
+    DkGroupWidget *loadFileGroup = new DkGroupWidget(tr("File Loading/Saving"), this);
+    loadFileGroup->addWidget(cbSaveDeleted);
+    loadFileGroup->addWidget(cbIgnoreExif);
+    loadFileGroup->addWidget(cbSaveExif);
+
+    // batch processing
+    QSpinBox *sbNumThreads = new QSpinBox(this);
+    sbNumThreads->setObjectName("numThreads");
+    sbNumThreads->setToolTip(tr("Choose the number of Threads in the thread pool"));
+    sbNumThreads->setMinimum(1);
+    sbNumThreads->setMaximum(100);
+    sbNumThreads->setValue(DkSettingsManager::param().global().numThreads);
+
+    DkGroupWidget *threadsGroup = new DkGroupWidget(tr("Number of Threads"), this);
+    threadsGroup->addWidget(sbNumThreads);
+
+    // native dialogs
+    QCheckBox *cbNative = new QCheckBox(tr("Enable Native File Dialogs"), this);
+    cbNative->setObjectName("useNative");
+    cbNative->setToolTip(tr("If checked, native system dialogs are used for opening/saving files."));
+    cbNative->setChecked(DkSettingsManager::param().resources().nativeDialog);
+
+    DkGroupWidget *nativeGroup = new DkGroupWidget(tr("Native Dialogs"), this);
+    nativeGroup->addWidget(cbNative);
+
+    // log
+    QCheckBox *cbUseLog = new QCheckBox(tr("Use Log File"), this);
+    cbUseLog->setObjectName("useLog");
+    cbUseLog->setToolTip(tr("If checked, a log file will be created."));
+    cbUseLog->setChecked(DkSettingsManager::param().app().useLogFile);
+
+    QPushButton *pbLog = new QPushButton(tr("Open Log"), this);
+    pbLog->setObjectName("logFolder");
 #ifdef Q_OS_WIN
-	pbLog->setVisible(DkSettingsManager::param().app().useLogFile);
+    pbLog->setVisible(DkSettingsManager::param().app().useLogFile);
 #else
-	pbLog->setVisible(false);
+    pbLog->setVisible(false);
 #endif
 
-	DkGroupWidget* useLogGroup = new DkGroupWidget(tr("Logging"), this);
-	useLogGroup->addWidget(cbUseLog);
-	useLogGroup->addWidget(pbLog);
-
-	QVBoxLayout* layout = new QVBoxLayout(this);
-	layout->setAlignment(Qt::AlignTop);
-	layout->addWidget(loadRawGroup);
-	layout->addWidget(loadFileGroup);
-	layout->addWidget(threadsGroup);
-	layout->addWidget(nativeGroup);
-	layout->addWidget(useLogGroup);
+    DkGroupWidget *useLogGroup = new DkGroupWidget(tr("Logging"), this);
+    useLogGroup->addWidget(cbUseLog);
+    useLogGroup->addWidget(pbLog);
 
+    QVBoxLayout *layout = new QVBoxLayout(this);
+    layout->setAlignment(Qt::AlignTop);
+    layout->addWidget(loadRawGroup);
+    layout->addWidget(loadFileGroup);
+    layout->addWidget(threadsGroup);
+    layout->addWidget(nativeGroup);
+    layout->addWidget(useLogGroup);
 }
 
-void DkAdvancedPreference::on_loadRaw_buttonClicked(int buttonId) const {
-
-	if (DkSettingsManager::param().resources().loadRawThumb != buttonId)
-		DkSettingsManager::param().resources().loadRawThumb = buttonId;
+void DkAdvancedPreference::on_loadRaw_buttonClicked(int buttonId) const
+{
+    if (DkSettingsManager::param().resources().loadRawThumb != buttonId)
+        DkSettingsManager::param().resources().loadRawThumb = buttonId;
 }
 
-void DkAdvancedPreference::on_filterRaw_toggled(bool checked) const {
-
-	if (DkSettingsManager::param().resources().filterRawImages != checked)
-		DkSettingsManager::param().resources().filterRawImages = checked;
+void DkAdvancedPreference::on_filterRaw_toggled(bool checked) const
+{
+    if (DkSettingsManager::param().resources().filterRawImages != checked)
+        DkSettingsManager::param().resources().filterRawImages = checked;
 }
 
-void DkAdvancedPreference::on_saveDeleted_toggled(bool checked) const {
-
-	if (DkSettingsManager::param().global().askToSaveDeletedFiles != checked)
-		DkSettingsManager::param().global().askToSaveDeletedFiles = checked;
+void DkAdvancedPreference::on_saveDeleted_toggled(bool checked) const
+{
+    if (DkSettingsManager::param().global().askToSaveDeletedFiles != checked)
+        DkSettingsManager::param().global().askToSaveDeletedFiles = checked;
 }
 
-void DkAdvancedPreference::on_ignoreExif_toggled(bool checked) const {
-
-	if (DkSettingsManager::param().metaData().ignoreExifOrientation != checked)
-		DkSettingsManager::param().metaData().ignoreExifOrientation = checked;
+void DkAdvancedPreference::on_ignoreExif_toggled(bool checked) const
+{
+    if (DkSettingsManager::param().metaData().ignoreExifOrientation != checked)
+        DkSettingsManager::param().metaData().ignoreExifOrientation = checked;
 }
 
-void DkAdvancedPreference::on_saveExif_toggled(bool checked) const {
-
-	if (DkSettingsManager::param().metaData().saveExifOrientation != checked)
-		DkSettingsManager::param().metaData().saveExifOrientation = checked;
+void DkAdvancedPreference::on_saveExif_toggled(bool checked) const
+{
+    if (DkSettingsManager::param().metaData().saveExifOrientation != checked)
+        DkSettingsManager::param().metaData().saveExifOrientation = checked;
 }
 
-void DkAdvancedPreference::on_useLog_toggled(bool checked) const {
-
-	if (DkSettingsManager::param().app().useLogFile != checked) {
-		DkSettingsManager::param().app().useLogFile = checked;
-		emit infoSignal(tr("Please Restart nomacs to apply changes"));
-	}
+void DkAdvancedPreference::on_useLog_toggled(bool checked) const
+{
+    if (DkSettingsManager::param().app().useLogFile != checked) {
+        DkSettingsManager::param().app().useLogFile = checked;
+        emit infoSignal(tr("Please Restart nomacs to apply changes"));
+    }
 }
 
-void DkAdvancedPreference::on_useNative_toggled(bool checked) const {
-
-	if (DkSettingsManager::param().resources().nativeDialog != checked) {
-		DkSettingsManager::param().resources().nativeDialog = checked;
-	}
+void DkAdvancedPreference::on_useNative_toggled(bool checked) const
+{
+    if (DkSettingsManager::param().resources().nativeDialog != checked) {
+        DkSettingsManager::param().resources().nativeDialog = checked;
+    }
 }
 
-void DkAdvancedPreference::on_logFolder_clicked() const {
-
-	// TODO: add linux/mac os
-	QString logPath = QDir::toNativeSeparators(DkUtils::getLogFilePath());
-	QProcess::startDetached(QString("explorer /select, \"%1\"").arg(logPath));
+void DkAdvancedPreference::on_logFolder_clicked() const
+{
+    // TODO: add linux/mac os
+    QString logPath = QDir::toNativeSeparators(DkUtils::getLogFilePath());
+    QProcess::startDetached(QString("explorer /select, \"%1\"").arg(logPath));
 }
 
-void DkAdvancedPreference::on_numThreads_valueChanged(int val) const {
-
-	if (DkSettingsManager::param().global().numThreads != val)
-		DkSettingsManager::param().setNumThreads(val);
-
+void DkAdvancedPreference::on_numThreads_valueChanged(int val) const
+{
+    if (DkSettingsManager::param().global().numThreads != val)
+        DkSettingsManager::param().setNumThreads(val);
 }
 
-void DkAdvancedPreference::paintEvent(QPaintEvent *event) {
-
-	// fixes stylesheets which are not applied to custom widgets
-	QStyleOption opt;
-	opt.init(this);
-	QPainter p(this);
-	style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
+void DkAdvancedPreference::paintEvent(QPaintEvent *event)
+{
+    // fixes stylesheets which are not applied to custom widgets
+    QStyleOption opt;
+    opt.initFrom(this);
+    QPainter p(this);
+    style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
 
-	QWidget::paintEvent(event);
+    QWidget::paintEvent(event);
 }
 
 // DkEditorPreference --------------------------------------------------------------------
-DkEditorPreference::DkEditorPreference(QWidget* parent) : DkWidget(parent) {
-
-	createLayout();
-	QMetaObject::connectSlotsByName(this);
+DkEditorPreference::DkEditorPreference(QWidget *parent)
+    : DkWidget(parent)
+{
+    createLayout();
+    QMetaObject::connectSlotsByName(this);
 }
 
-void DkEditorPreference::createLayout() {
-
-	mSettingsWidget = new DkSettingsWidget(this);
-	mSettingsWidget->setSettingsPath(DkSettingsManager::param().settingsPath());
-
-	QVBoxLayout* layout = new QVBoxLayout(this);
-	layout->setAlignment(Qt::AlignLeft);
+void DkEditorPreference::createLayout()
+{
+    mSettingsWidget = new DkSettingsWidget(this);
+    mSettingsWidget->setSettingsPath(DkSettingsManager::param().settingsPath());
 
-	layout->addWidget(mSettingsWidget);
+    QVBoxLayout *layout = new QVBoxLayout(this);
+    layout->setAlignment(Qt::AlignLeft);
 
-	connect(mSettingsWidget, SIGNAL(changeSettingSignal(const QString&, const QVariant&, const QStringList&)), 
-			this, SLOT(changeSetting(const QString&, const QVariant&, const QStringList&)));
-	connect(mSettingsWidget, SIGNAL(removeSettingSignal(const QString&, const QStringList&)), 
-		this, SLOT(removeSetting(const QString&, const QStringList&)));
+    layout->addWidget(mSettingsWidget);
 
+    connect(mSettingsWidget,
+            SIGNAL(changeSettingSignal(const QString &, const QVariant &, const QStringList &)),
+            this,
+            SLOT(changeSetting(const QString &, const QVariant &, const QStringList &)));
+    connect(mSettingsWidget,
+            SIGNAL(removeSettingSignal(const QString &, const QStringList &)),
+            this,
+            SLOT(removeSetting(const QString &, const QStringList &)));
 }
-void DkEditorPreference::paintEvent(QPaintEvent *event) {
+void DkEditorPreference::paintEvent(QPaintEvent *event)
+{
+    // fixes stylesheets which are not applied to custom widgets
+    QStyleOption opt;
+    opt.initFrom(this);
+    QPainter p(this);
+    style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
 
-	// fixes stylesheets which are not applied to custom widgets
-	QStyleOption opt;
-	opt.init(this);
-	QPainter p(this);
-	style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
-
-	QWidget::paintEvent(event);
+    QWidget::paintEvent(event);
 }
 
-void DkEditorPreference::changeSetting(const QString& key, const QVariant& value, const QStringList& groups) const {
-
-	DefaultSettings settings;
-	DkSettingsWidget::changeSetting(settings, key, value, groups);
+void DkEditorPreference::changeSetting(const QString &key, const QVariant &value, const QStringList &groups) const
+{
+    DefaultSettings settings;
+    DkSettingsWidget::changeSetting(settings, key, value, groups);
 
-	// update values
-	nmc::DkSettingsManager::instance().param().load();
+    // update values
+    nmc::DkSettingsManager::instance().param().load();
 }
 
-void DkEditorPreference::removeSetting(const QString& key, const QStringList& groups) const {
-	
-	DefaultSettings settings;
-	DkSettingsWidget::removeSetting(settings, key, groups);
+void DkEditorPreference::removeSetting(const QString &key, const QStringList &groups) const
+{
+    DefaultSettings settings;
+    DkSettingsWidget::removeSetting(settings, key, groups);
 }
 
 //// DkDummySettings --------------------------------------------------------------------
-//DkDummyPreference::DkDummyPreference(QWidget* parent) : QWidget(parent) {
+// DkDummyPreference::DkDummyPreference(QWidget* parent) : QWidget(parent) {
 //
 //	createLayout();
 //	QMetaObject::connectSlotsByName(this);
-//}
+// }
 //
-//void DkDummyPreference::createLayout() {
+// void DkDummyPreference::createLayout() {
 
-	//QHBoxLayout* layout = new QHBoxLayout(this);
-	//layout->setAlignment(Qt::AlignLeft);
+// QHBoxLayout* layout = new QHBoxLayout(this);
+// layout->setAlignment(Qt::AlignLeft);
 
-	//layout->addWidget(leftWidget);
+// layout->addWidget(leftWidget);
 
 //}
-//void DkDummyPreference::paintEvent(QPaintEvent *event) {
+// void DkDummyPreference::paintEvent(QPaintEvent *event) {
 //
 //	// fixes stylesheets which are not applied to custom widgets
 //	QStyleOption opt;
diff --git a/ImageLounge/src/DkGui/DkPreferenceWidgets.h b/ImageLounge/src/DkGui/DkPreferenceWidgets.h
index 9ead3c8..9910cb0 100644
--- a/ImageLounge/src/DkGui/DkPreferenceWidgets.h
+++ b/ImageLounge/src/DkGui/DkPreferenceWidgets.h
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkPreferenceWidgets.h
  Created on:	14.12.2015
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2015 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2015 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2015 Florian Kleber <florian@nomacs.org>
@@ -30,13 +30,13 @@
 // Qt defines
 #include "DkBaseWidgets.h"
 
-#pragma warning(push, 0)	// no warnings from includes
+#pragma warning(push, 0) // no warnings from includes
 #include <QIcon>
-#include <QPushButton>
 #include <QList>
+#include <QPushButton>
 #pragma warning(pop)
 
-#pragma warning(disable: 4251)	// TODO: remove
+#pragma warning(disable : 4251) // TODO: remove
 
 #ifndef DllCoreExport
 #ifdef DK_CORE_DLL_EXPORT
@@ -55,254 +55,262 @@ class QStandardItem;
 class QStandardItemModel;
 class QLineEdit;
 
-namespace nmc {
+namespace nmc
+{
 
 class DkWorkingDirWidget;
 class DkSettingsWidget;
 class DkTabEntryWidget;
 
 // extend this class if you want to add general preference functions
-class DllCoreExport DkPreferenceTabWidget : public DkNamedWidget {
-	Q_OBJECT
+class DllCoreExport DkPreferenceTabWidget : public DkNamedWidget
+{
+    Q_OBJECT
 
 public:
-	DkPreferenceTabWidget(const QIcon& icon, const QString& name, QWidget* parent);
+    DkPreferenceTabWidget(const QIcon &icon, const QString &name, QWidget *parent);
 
-	void setWidget(QWidget* widget);
-	QWidget* widget() const;
+    void setWidget(QWidget *widget);
+    QWidget *widget() const;
 
-	QIcon icon() const;
+    QIcon icon() const;
 
 public slots:
-	void setInfoMessage(const QString& msg);
+    void setInfoMessage(const QString &msg);
 
 signals:
-	void restartSignal() const;
-	
+    void restartSignal() const;
+
 protected:
-	void createLayout();
+    void createLayout();
 
-	DkResizableScrollArea* mCentralScroller = 0;
-	QPushButton* mInfoButton;
+    DkResizableScrollArea *mCentralScroller = 0;
+    QPushButton *mInfoButton;
 
-	QIcon mIcon;
+    QIcon mIcon;
 };
 
-class DllCoreExport DkPreferenceWidget : public DkFadeWidget {
-	Q_OBJECT
+class DllCoreExport DkPreferenceWidget : public DkFadeWidget
+{
+    Q_OBJECT
 
 public:
-	DkPreferenceWidget(QWidget* parent);
+    DkPreferenceWidget(QWidget *parent);
 
-	void addTabWidget(DkPreferenceTabWidget* tabWidget);
+    void addTabWidget(DkPreferenceTabWidget *tabWidget);
 
 public slots:
-	void changeTab();
-	void setCurrentIndex(int index);
-	void previousTab();
-	void nextTab();
+    void changeTab();
+    void setCurrentIndex(int index);
+    void previousTab();
+    void nextTab();
 
 signals:
-	void restartSignal() const;
+    void restartSignal() const;
 
 protected:
-	void createLayout();
+    void createLayout();
 
-	int mCurrentIndex = 0;
-	QVector<DkTabEntryWidget*> mTabEntries;
-	QVector<DkPreferenceTabWidget*> mWidgets;
+    int mCurrentIndex = 0;
+    QVector<DkTabEntryWidget *> mTabEntries;
+    QVector<DkPreferenceTabWidget *> mWidgets;
 
-	QStackedLayout* mCentralLayout = 0;
-	QVBoxLayout* mTabLayout = 0;
+    QStackedLayout *mCentralLayout = 0;
+    QVBoxLayout *mTabLayout = 0;
 };
 
-class DkGroupWidget : public DkWidget {
-	Q_OBJECT
+class DkGroupWidget : public DkWidget
+{
+    Q_OBJECT
 
 public:
-	DkGroupWidget(const QString& title, QWidget* parent);
+    DkGroupWidget(const QString &title, QWidget *parent);
 
-	void addWidget(QWidget* widget);
-	void addSpace();
+    void addWidget(QWidget *widget);
+    void addSpace();
 
 protected:
-	void paintEvent(QPaintEvent* event) override;
-	void createLayout();
+    void paintEvent(QPaintEvent *event) override;
+    void createLayout();
 
-	QString mTitle;
-	QVBoxLayout* mContentLayout = 0;
+    QString mTitle;
+    QVBoxLayout *mContentLayout = 0;
 };
 
-class DkGeneralPreference : public DkWidget {
-	Q_OBJECT
+class DkGeneralPreference : public DkWidget
+{
+    Q_OBJECT
 
 public:
-	DkGeneralPreference(QWidget* parent = 0);
+    DkGeneralPreference(QWidget *parent = 0);
 
 public slots:
-	void on_themeBox_currentIndexChanged(const QString& text) const;
-	void on_showRecentFiles_toggled(bool checked) const;
-	void on_logRecentFiles_toggled(bool checked) const;
-	void on_checkOpenDuplicates_toggled(bool checked) const;
-	void on_extendedTabs_toggled(bool checked) const;
-	void on_closeOnEsc_toggled(bool checked) const;
-	void on_zoomOnWheel_toggled(bool checked) const;
-	void on_horZoomSkips_toggled(bool checked) const;
-	void on_doubleClickForFullscreen_toggled(bool checked) const;
-	void on_showBgImage_toggled(bool checked) const;
-	void on_checkForUpdates_toggled(bool checked) const;
-	void on_switchModifier_toggled(bool checked) const;
-	void on_loopImages_toggled(bool checked) const;
-	void on_defaultSettings_clicked();
-	void on_importSettings_clicked();
-	void on_exportSettings_clicked();
-	void on_languageCombo_currentIndexChanged(int index) const;
-	void showRestartLabel() const;
-
-	void on_backgroundColor_accepted() const;
-	void on_backgroundColor_resetClicked() const;
-	void on_iconColor_accepted() const;
-	void on_iconColor_resetClicked() const;
-	
+    void on_themeBox_currentIndexChanged(const QString &text) const;
+    void on_showRecentFiles_toggled(bool checked) const;
+    void on_logRecentFiles_toggled(bool checked) const;
+    void on_checkOpenDuplicates_toggled(bool checked) const;
+    void on_extendedTabs_toggled(bool checked) const;
+    void on_closeOnEsc_toggled(bool checked) const;
+    void on_zoomOnWheel_toggled(bool checked) const;
+    void on_horZoomSkips_toggled(bool checked) const;
+    void on_doubleClickForFullscreen_toggled(bool checked) const;
+    void on_showBgImage_toggled(bool checked) const;
+    void on_checkForUpdates_toggled(bool checked) const;
+    void on_switchModifier_toggled(bool checked) const;
+    void on_loopImages_toggled(bool checked) const;
+    void on_defaultSettings_clicked();
+    void on_importSettings_clicked();
+    void on_exportSettings_clicked();
+    void on_languageCombo_currentIndexChanged(int index) const;
+    void showRestartLabel() const;
+
+    void on_backgroundColor_accepted() const;
+    void on_backgroundColor_resetClicked() const;
+    void on_iconColor_accepted() const;
+    void on_iconColor_resetClicked() const;
+
 signals:
-	void infoSignal(const QString& msg) const;
+    void infoSignal(const QString &msg) const;
 
 protected:
-	void createLayout();
-	void paintEvent(QPaintEvent* ev) override;
+    void createLayout();
+    void paintEvent(QPaintEvent *ev) override;
 
-	QStringList mLanguages;
+    QStringList mLanguages;
 };
 
-class DkDisplayPreference : public DkWidget {
-	Q_OBJECT
+class DkDisplayPreference : public DkWidget
+{
+    Q_OBJECT
 
 public:
-	DkDisplayPreference(QWidget* parent = 0);
+    DkDisplayPreference(QWidget *parent = 0);
 
 public slots:
-	void on_interpolationBox_valueChanged(int value) const;
-	void on_iconSizeBox_valueChanged(int value) const;
-	void on_fadeImageBox_valueChanged(double value) const;
-	void on_displayTimeBox_valueChanged(double value) const;
-	void on_showPlayer_toggled(bool checked) const;
-	void on_keepZoom_buttonClicked(int buttonId) const;
-	void on_invertZoom_toggled(bool checked) const;
-	void on_hQAntiAliasing_toggled(bool checked) const;
-	void on_zoomToFit_toggled(bool checked) const;
-	void on_transition_currentIndexChanged(int index) const;
-	void on_alwaysAnimate_toggled(bool checked) const;
-	void on_showCrop_toggled(bool checked) const;
-	void on_showScrollBars_toggled(bool checked) const;
-	void on_useZoomLevels_toggled(bool checked) const;
-	void on_showNavigation_toggled(bool checked) const;
-	void on_zoomLevels_editingFinished() const;	
-	void on_zoomLevelsDefault_clicked() const;
+    void on_interpolationBox_valueChanged(int value) const;
+    void on_iconSizeBox_valueChanged(int value) const;
+    void on_fadeImageBox_valueChanged(double value) const;
+    void on_displayTimeBox_valueChanged(double value) const;
+    void on_showPlayer_toggled(bool checked) const;
+    void on_keepZoom_buttonClicked(int buttonId) const;
+    void on_invertZoom_toggled(bool checked) const;
+    void on_hQAntiAliasing_toggled(bool checked) const;
+    void on_zoomToFit_toggled(bool checked) const;
+    void on_transition_currentIndexChanged(int index) const;
+    void on_alwaysAnimate_toggled(bool checked) const;
+    void on_showCrop_toggled(bool checked) const;
+    void on_showScrollBars_toggled(bool checked) const;
+    void on_useZoomLevels_toggled(bool checked) const;
+    void on_showNavigation_toggled(bool checked) const;
+    void on_zoomLevels_editingFinished() const;
+    void on_zoomLevelsDefault_clicked() const;
 
 signals:
-	void infoSignal(const QString& msg) const;
+    void infoSignal(const QString &msg) const;
 
 protected:
-	void createLayout();
-	void paintEvent(QPaintEvent* ev) override;
-
-	QWidget* mZoomLevels = 0;
-	QLineEdit* mZoomLevelsEdit = 0;
+    void createLayout();
+    void paintEvent(QPaintEvent *ev) override;
 
+    QWidget *mZoomLevels = 0;
+    QLineEdit *mZoomLevelsEdit = 0;
 };
 
-class DkFilePreference : public DkWidget {
-	Q_OBJECT
+class DkFilePreference : public DkWidget
+{
+    Q_OBJECT
 
 public:
-	DkFilePreference(QWidget* parent = 0);
+    DkFilePreference(QWidget *parent = 0);
 
 public slots:
-	void on_dirChooser_directoryChanged(const QString& dirPath) const;
-	void on_loadGroup_buttonClicked(int buttonId) const;
-	void on_skipBox_valueChanged(int value) const;
-	void on_cacheBox_valueChanged(int value) const;
-	void on_historyBox_valueChanged(int value) const;
-	void on_saveGroup_buttonClicked(int buttonId) const;
+    void on_dirChooser_directoryChanged(const QString &dirPath) const;
+    void on_loadGroup_buttonClicked(int buttonId) const;
+    void on_skipBox_valueChanged(int value) const;
+    void on_cacheBox_valueChanged(int value) const;
+    void on_historyBox_valueChanged(int value) const;
+    void on_saveGroup_buttonClicked(int buttonId) const;
 
 signals:
-	void infoSignal(const QString& msg) const;
+    void infoSignal(const QString &msg) const;
 
 protected:
-	void createLayout();
-	void paintEvent(QPaintEvent* ev) override;
-
+    void createLayout();
+    void paintEvent(QPaintEvent *ev) override;
 };
 
-class DkFileAssociationsPreference : public DkWidget {
-	Q_OBJECT
+class DkFileAssociationsPreference : public DkWidget
+{
+    Q_OBJECT
 
 public:
-	DkFileAssociationsPreference(QWidget* parent = 0);
-	virtual ~DkFileAssociationsPreference();
+    DkFileAssociationsPreference(QWidget *parent = 0);
+    virtual ~DkFileAssociationsPreference();
 public slots:
-	void on_fileModel_itemChanged(QStandardItem*);
-	void on_openDefault_clicked() const;
-	void on_associateFiles_clicked();
+    void on_fileModel_itemChanged(QStandardItem *);
+    void on_openDefault_clicked() const;
+    void on_associateFiles_clicked();
 
 signals:
-   void infoSignal(const QString& msg) const;
+    void infoSignal(const QString &msg) const;
 
 protected:
-	void createLayout();
-	void paintEvent(QPaintEvent* ev) override;
+    void createLayout();
+    void paintEvent(QPaintEvent *ev) override;
 
-	bool checkFilter(const QString& cFilter, const QStringList& filters) const;
-	QList<QStandardItem*> getItems(const QString& filter, bool browse, bool reg);
-	void writeSettings() const;
+    bool checkFilter(const QString &cFilter, const QStringList &filters) const;
+    QList<QStandardItem *> getItems(const QString &filter, bool browse, bool reg);
+    void writeSettings() const;
 
-	bool mSaveSettings = false;
-	QStandardItemModel* mModel = 0;
+    bool mSaveSettings = false;
+    QStandardItemModel *mModel = 0;
 };
 
-class DkAdvancedPreference : public DkWidget {
-	Q_OBJECT
+class DkAdvancedPreference : public DkWidget
+{
+    Q_OBJECT
 
 public:
-	DkAdvancedPreference(QWidget* parent = 0);
+    DkAdvancedPreference(QWidget *parent = 0);
 
 public slots:
-	void on_loadRaw_buttonClicked(int buttonId) const;
-	void on_filterRaw_toggled(bool checked) const;
-	void on_saveDeleted_toggled(bool checked) const;
-	void on_ignoreExif_toggled(bool checked) const;
-	void on_saveExif_toggled(bool checked) const;
-	void on_useLog_toggled(bool checked) const;
-	void on_useNative_toggled(bool checked) const;
-	void on_logFolder_clicked() const;
-	void on_numThreads_valueChanged(int val) const;
+    void on_loadRaw_buttonClicked(int buttonId) const;
+    void on_filterRaw_toggled(bool checked) const;
+    void on_saveDeleted_toggled(bool checked) const;
+    void on_ignoreExif_toggled(bool checked) const;
+    void on_saveExif_toggled(bool checked) const;
+    void on_useLog_toggled(bool checked) const;
+    void on_useNative_toggled(bool checked) const;
+    void on_logFolder_clicked() const;
+    void on_numThreads_valueChanged(int val) const;
 
 signals:
-	void infoSignal(const QString& msg) const;
+    void infoSignal(const QString &msg) const;
 
 protected:
-	void createLayout();
-	void paintEvent(QPaintEvent* ev) override;
+    void createLayout();
+    void paintEvent(QPaintEvent *ev) override;
 };
 
-class DkEditorPreference : public DkWidget {
-	Q_OBJECT
+class DkEditorPreference : public DkWidget
+{
+    Q_OBJECT
 
 public:
-	DkEditorPreference(QWidget* parent = 0);
+    DkEditorPreference(QWidget *parent = 0);
 
 signals:
-   void infoSignal(const QString& msg) const;
+    void infoSignal(const QString &msg) const;
 
 public slots:
-	void changeSetting(const QString& key, const QVariant& value, const QStringList& groups) const;
-	void removeSetting(const QString& key, const QStringList& groups) const;
+    void changeSetting(const QString &key, const QVariant &value, const QStringList &groups) const;
+    void removeSetting(const QString &key, const QStringList &groups) const;
 
 protected:
-	void createLayout();
+    void createLayout();
 
-	DkSettingsWidget* mSettingsWidget;
-	void paintEvent(QPaintEvent* ev) override;
+    DkSettingsWidget *mSettingsWidget;
+    void paintEvent(QPaintEvent *ev) override;
 };
 
 }
diff --git a/ImageLounge/src/DkGui/DkQuickAccess.cpp b/ImageLounge/src/DkGui/DkQuickAccess.cpp
index 1134652..268498d 100644
--- a/ImageLounge/src/DkGui/DkQuickAccess.cpp
+++ b/ImageLounge/src/DkGui/DkQuickAccess.cpp
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkQuickAccess.cpp
  Created on:	16.04.2015
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2015 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2015 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2015 Florian Kleber <florian@nomacs.org>
@@ -26,178 +26,173 @@
  *******************************************************************************************************/
 
 #include "DkQuickAccess.h"
-#include "DkUtils.h"
-#include "DkImageStorage.h"
 #include "DkActionManager.h"
+#include "DkImageStorage.h"
+#include "DkUtils.h"
 
-#pragma warning(push, 0)	// no warnings from includes - begin
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QAction>
-#include <QStandardItemModel>
-#include <QDebug>
 #include <QCompleter>
+#include <QDebug>
 #include <QKeyEvent>
-#pragma warning(pop)		// no warnings from includes - end
-
+#include <QStandardItemModel>
+#pragma warning(pop) // no warnings from includes - end
 
-namespace nmc {
+namespace nmc
+{
 
 // DkQuickFilterCompleter --------------------------------------------------------------------
-DkQuickAccess::DkQuickAccess(QObject* parent /* = 0 */) : QObject(parent) {
-
-	mModel = new QStandardItemModel(this);
-	mModel->setColumnCount(1);
-
+DkQuickAccess::DkQuickAccess(QObject *parent /* = 0 */)
+    : QObject(parent)
+{
+    mModel = new QStandardItemModel(this);
+    mModel->setColumnCount(1);
 }
 
-void DkQuickAccess::addActions(const QVector<QAction*>& actions) {
-
-	// initialize the model
-	int nRows = mModel->rowCount();
-	mModel->setRowCount(nRows + actions.size());
-
-	for (int rIdx = 0; rIdx < actions.size(); rIdx++) {
-		
-		if (!actions[rIdx]) {
-			qDebug() << "WARNING: empty action detected...";
-			continue;
-		}
-
-		QAction* a = actions[rIdx];
-		QIcon icon = a->icon().isNull() ? DkImage::loadIcon(":/nomacs/img/dummy.svg") : a->icon();
-
-		QString text = a->text().remove("&");
-		QStandardItem* item = new QStandardItem(text);
-		item->setSizeHint(QSize(18, 18));
-		item->setIcon(icon);
-		item->setToolTip(a->toolTip());
-		mModel->setItem(nRows+rIdx, 0, item);
-	}
-
-	// we assume they are unique
-	mActions << actions;
+void DkQuickAccess::addActions(const QVector<QAction *> &actions)
+{
+    // initialize the model
+    int nRows = mModel->rowCount();
+    mModel->setRowCount(nRows + actions.size());
+
+    for (int rIdx = 0; rIdx < actions.size(); rIdx++) {
+        if (!actions[rIdx]) {
+            qDebug() << "WARNING: empty action detected...";
+            continue;
+        }
+
+        QAction *a = actions[rIdx];
+        QIcon icon = a->icon().isNull() ? DkImage::loadIcon(":/nomacs/img/dummy.svg") : a->icon();
+
+        QString text = a->text().remove("&");
+        QStandardItem *item = new QStandardItem(text);
+        item->setSizeHint(QSize(18, 18));
+        item->setIcon(icon);
+        item->setToolTip(a->toolTip());
+        mModel->setItem(nRows + rIdx, 0, item);
+    }
+
+    // we assume they are unique
+    mActions << actions;
 }
 
-void DkQuickAccess::addFiles(const QStringList& filePaths) {
-
-	QPixmap pm = DkImage::loadIcon(":/nomacs/img/nomacs-bg.svg");
-	addItems(filePaths, pm);
+void DkQuickAccess::addFiles(const QStringList &filePaths)
+{
+    QPixmap pm = DkImage::loadIcon(":/nomacs/img/nomacs-bg.svg");
+    addItems(filePaths, pm);
 }
 
-void DkQuickAccess::addDirs(const QStringList& dirPaths) {
-	
-	QPixmap pm = DkImage::loadIcon(":/nomacs/img/dir.svg");
-	addItems(dirPaths, pm);
+void DkQuickAccess::addDirs(const QStringList &dirPaths)
+{
+    QPixmap pm = DkImage::loadIcon(":/nomacs/img/dir.svg");
+    addItems(dirPaths, pm);
 }
 
-void DkQuickAccess::addItems(const QStringList& itemTexts, const QIcon& icon) {
+void DkQuickAccess::addItems(const QStringList &itemTexts, const QIcon &icon)
+{
+    int nRows = mModel->rowCount();
+    mModel->setRowCount(nRows + itemTexts.size());
 
-	int nRows = mModel->rowCount();
-	mModel->setRowCount(nRows + itemTexts.size());
+    for (int rIdx = 0; rIdx < itemTexts.size(); rIdx++) {
+        QString text = itemTexts.at(rIdx);
 
-	for (int rIdx = 0; rIdx < itemTexts.size(); rIdx++) {
+        if (mFilePaths.contains(text))
+            continue;
 
-		QString text = itemTexts.at(rIdx);
-
-		if (mFilePaths.contains(text))
-			continue;
-
-		QStandardItem* item = new QStandardItem(text);
-		item->setIcon(icon);
-		item->setSizeHint(QSize(18, 18));
-		mModel->setItem(nRows + rIdx, 0, item);
-		mFilePaths.append(text);
-	}
+        QStandardItem *item = new QStandardItem(text);
+        item->setIcon(icon);
+        item->setSizeHint(QSize(18, 18));
+        mModel->setItem(nRows + rIdx, 0, item);
+        mFilePaths.append(text);
+    }
 }
 
-bool DkQuickAccess::execute(const QString& cmd) const {
-	
-	qDebug() << "executing" << cmd;
-
-	if (QFileInfo(cmd).exists()) {
-		emit loadFileSignal(cmd);
-		return true;
-	}
+bool DkQuickAccess::execute(const QString &cmd) const
+{
+    qDebug() << "executing" << cmd;
 
-	for (QAction* a : mActions) {
+    if (QFileInfo(cmd).exists()) {
+        emit loadFileSignal(cmd);
+        return true;
+    }
 
-		QString aKey = a->text().remove("&");
+    for (QAction *a : mActions) {
+        QString aKey = a->text().remove("&");
 
-		if (aKey == cmd) {
+        if (aKey == cmd) {
+            if (a->isEnabled())
+                a->trigger();
+            return true;
+        }
+    }
 
-			if (a->isEnabled())
-				a->trigger();
-			return true;
-		}
-	}
-	
-	return false;
+    return false;
 }
 
 // DkQuickAcessEdit --------------------------------------------------------------------
-DkQuickAccessEdit::DkQuickAccessEdit(QWidget* parent) : QLineEdit("", parent) {
-	
-	QString shortcutText = DkActionManager::instance().action(DkActionManager::menu_file_quick_launch)->shortcut().toString();
-	setPlaceholderText(tr("Quick Launch (%1)").arg(shortcutText));
-	setMinimumWidth(150);
-	setMaximumWidth(350);
-	hide();
-
-	mCompleter = new QCompleter(this);
-
-#if QT_VERSION >= 0x050000
-	mCompleter->setFilterMode(Qt::MatchContains);
-#endif
-	mCompleter->setCaseSensitivity(Qt::CaseInsensitive);
-	setCompleter(mCompleter);
-
-	connect(this, SIGNAL(returnPressed()), this, SLOT(editConfirmed()));
-}
+DkQuickAccessEdit::DkQuickAccessEdit(QWidget *parent)
+    : QLineEdit("", parent)
+{
+    QString shortcutText = DkActionManager::instance().action(DkActionManager::menu_file_quick_launch)->shortcut().toString();
+    setPlaceholderText(tr("Quick Launch (%1)").arg(shortcutText));
+    setMinimumWidth(150);
+    setMaximumWidth(350);
+    hide();
 
-void DkQuickAccessEdit::setModel(QStandardItemModel* model) {
+    mCompleter = new QCompleter(this);
 
-	mCompleter->setModel(model);
-	clear();
-	show();
+    mCompleter->setFilterMode(Qt::MatchContains);
 
-	setFocus(Qt::MouseFocusReason);
-}
+    mCompleter->setCaseSensitivity(Qt::CaseInsensitive);
+    setCompleter(mCompleter);
 
-void DkQuickAccessEdit::editConfirmed() {
-	
-	QString fp = text();
+    connect(this, SIGNAL(returnPressed()), this, SLOT(editConfirmed()));
+}
 
-	// check if we can directly load what is there (this is nice to load the parent dir of a recent dir)
-	if (QFileInfo(fp).exists())
-		emit executeSignal(text());
-	else if (!mCompleter->currentCompletion().isNull())
-		emit executeSignal(mCompleter->currentCompletion());
-	else
-		// do something usefull if our completer has no idea anymore...
-		emit executeSignal(text());
+void DkQuickAccessEdit::setModel(QStandardItemModel *model)
+{
+    mCompleter->setModel(model);
+    clear();
+    show();
 
-	clearAccess();
+    setFocus(Qt::MouseFocusReason);
 }
 
-void DkQuickAccessEdit::focusOutEvent(QFocusEvent* ev) {
+void DkQuickAccessEdit::editConfirmed()
+{
+    QString fp = text();
+
+    // check if we can directly load what is there (this is nice to load the parent dir of a recent dir)
+    if (QFileInfo(fp).exists())
+        emit executeSignal(text());
+    else if (!mCompleter->currentCompletion().isNull())
+        emit executeSignal(mCompleter->currentCompletion());
+    else
+        // do something usefull if our completer has no idea anymore...
+        emit executeSignal(text());
 
-	QLineEdit::focusOutEvent(ev);
-	clearAccess();
+    clearAccess();
 }
 
-void DkQuickAccessEdit::keyReleaseEvent(QKeyEvent* ev) {
+void DkQuickAccessEdit::focusOutEvent(QFocusEvent *ev)
+{
+    QLineEdit::focusOutEvent(ev);
+    clearAccess();
+}
 
-	QLineEdit::keyReleaseEvent(ev);
-	
-	if (ev->key() == Qt::Key_Escape) {
-		clearAccess();
-	}
+void DkQuickAccessEdit::keyReleaseEvent(QKeyEvent *ev)
+{
+    QLineEdit::keyReleaseEvent(ev);
 
+    if (ev->key() == Qt::Key_Escape) {
+        clearAccess();
+    }
 }
 
-void DkQuickAccessEdit::clearAccess() {
-
-	clear();
-	hide();
+void DkQuickAccessEdit::clearAccess()
+{
+    clear();
+    hide();
 }
 
-}
\ No newline at end of file
+}
diff --git a/ImageLounge/src/DkGui/DkQuickAccess.h b/ImageLounge/src/DkGui/DkQuickAccess.h
index c1339d0..64a2184 100644
--- a/ImageLounge/src/DkGui/DkQuickAccess.h
+++ b/ImageLounge/src/DkGui/DkQuickAccess.h
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkQuickAccess.h
  Created on:	16.04.2015
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2015 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2015 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2015 Florian Kleber <florian@nomacs.org>
@@ -27,68 +27,73 @@
 
 #pragma once
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QObject>
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QFileInfo>
-#include <QVector>
-#include <QStringList>
 #include <QLineEdit>
-#pragma warning(pop)		// no warnings from includes - end
+#include <QObject>
+#include <QStringList>
+#include <QVector>
+#pragma warning(pop) // no warnings from includes - end
 
 class QAction;
 class QStandardItemModel;
 class QIcon;
 class QModelIndex;
 
-namespace nmc {
+namespace nmc
+{
 
-class DkQuickAccess : public QObject {
-	Q_OBJECT
+class DkQuickAccess : public QObject
+{
+    Q_OBJECT
 
 public:
-	DkQuickAccess(QObject* parent = 0);
+    DkQuickAccess(QObject *parent = 0);
 
-	void addActions(const QVector<QAction*>& actions);
-	void addDirs(const QStringList& dirPaths);
-	void addFiles(const QStringList& filePaths);
-	void addItems(const QStringList& itemTexts, const QIcon& icon);
+    void addActions(const QVector<QAction *> &actions);
+    void addDirs(const QStringList &dirPaths);
+    void addFiles(const QStringList &filePaths);
+    void addItems(const QStringList &itemTexts, const QIcon &icon);
+
+    QStandardItemModel *getModel() const
+    {
+        return mModel;
+    };
 
-	QStandardItemModel* getModel() const { return mModel; };
-	
 public slots:
-	bool execute(const QString& cmd) const;
+    bool execute(const QString &cmd) const;
 
 signals:
-	void loadFileSignal(const QString& filePath) const;
+    void loadFileSignal(const QString &filePath) const;
 
 protected:
-	QStandardItemModel* mModel = 0;
+    QStandardItemModel *mModel = 0;
 
-	QVector<QAction*> mActions;
-	QStringList mFilePaths;
+    QVector<QAction *> mActions;
+    QStringList mFilePaths;
 };
 
-class DkQuickAccessEdit : public QLineEdit {
-	Q_OBJECT
+class DkQuickAccessEdit : public QLineEdit
+{
+    Q_OBJECT
 
 public:
-	DkQuickAccessEdit(QWidget* parent = 0);
+    DkQuickAccessEdit(QWidget *parent = 0);
 
-	void setModel(QStandardItemModel* model);
+    void setModel(QStandardItemModel *model);
 
 signals:
-	void executeSignal(const QString& cmd) const;
+    void executeSignal(const QString &cmd) const;
 
 public slots:
-	void clearAccess();
-	void editConfirmed();
+    void clearAccess();
+    void editConfirmed();
 
 protected:
-	void focusOutEvent(QFocusEvent* ev) override;
-	void keyReleaseEvent(QKeyEvent* ev) override;
-
-	QCompleter* mCompleter;
+    void focusOutEvent(QFocusEvent *ev) override;
+    void keyReleaseEvent(QKeyEvent *ev) override;
 
+    QCompleter *mCompleter;
 };
 
 }
\ No newline at end of file
diff --git a/ImageLounge/src/DkGui/DkSettingsWidget.cpp b/ImageLounge/src/DkGui/DkSettingsWidget.cpp
index 9aa578f..0b07651 100644
--- a/ImageLounge/src/DkGui/DkSettingsWidget.cpp
+++ b/ImageLounge/src/DkGui/DkSettingsWidget.cpp
@@ -1,6 +1,6 @@
 /*******************************************************************************************************
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2016 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2016 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2016 Florian Kleber <florian@nomacs.org>
@@ -30,479 +30,489 @@
 
 #include "DkActionManager.h"
 
-#pragma warning(push, 0)	// no warnings from includes
-#include <QTreeView>
-#include <QVBoxLayout>
+#pragma warning(push, 0) // no warnings from includes
 #include <QHeaderView>
 #include <QLineEdit>
 #include <QMenu>
+#include <QTreeView>
+#include <QVBoxLayout>
 #pragma warning(pop)
 
-namespace nmc {
-
+namespace nmc
+{
 
 // DkSettingsWidget --------------------------------------------------------------------
-DkSettingsWidget::DkSettingsWidget(QWidget* parent) : DkWidget(parent) {
-
-	createLayout();
+DkSettingsWidget::DkSettingsWidget(QWidget *parent)
+    : DkWidget(parent)
+{
+    createLayout();
 
-	QMetaObject::connectSlotsByName(this);
+    QMetaObject::connectSlotsByName(this);
 }
 
-void DkSettingsWidget::setSettingsPath(const QString & settingsPath, const QString& parentName) {
-
-	QSettings settings(settingsPath, QSettings::IniFormat);
+void DkSettingsWidget::setSettingsPath(const QString &settingsPath, const QString &parentName)
+{
+    QSettings settings(settingsPath, QSettings::IniFormat);
 
-	DkSettingsGroup sg = DkSettingsGroup::fromSettings(settings, parentName);
-	addSettingsGroup(sg);
+    DkSettingsGroup sg = DkSettingsGroup::fromSettings(settings, parentName);
+    addSettingsGroup(sg);
 }
 
-void DkSettingsWidget::addSettingsGroup(const DkSettingsGroup & group) {
-	
-	if (group.name().isEmpty()) {
-		for (auto g : group.children())
-			mSettingsModel->addSettingsGroup(g);
-	}
-	else
-		mSettingsModel->addSettingsGroup(group);
-	
-	// udpate proxy
-	mProxyModel->setSourceModel(mSettingsModel);
-}
+void DkSettingsWidget::addSettingsGroup(const DkSettingsGroup &group)
+{
+    if (group.name().isEmpty()) {
+        for (auto g : group.children())
+            mSettingsModel->addSettingsGroup(g);
+    } else
+        mSettingsModel->addSettingsGroup(group);
 
-void DkSettingsWidget::clear() {
-	mProxyModel->clear();
-	mSettingsModel->clear();
+    // udpate proxy
+    mProxyModel->setSourceModel(mSettingsModel);
 }
 
-void DkSettingsWidget::changeSetting(QSettings& settings, const QString& key, const QVariant& value, const QStringList& groups) {
+void DkSettingsWidget::clear()
+{
+    mProxyModel->invalidate();
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+    mSettingsModel->clear();
+#endif
+}
 
-	QStringList groupsClean = groups;
-	groupsClean.pop_front();	// remove default group: settings
+void DkSettingsWidget::changeSetting(QSettings &settings, const QString &key, const QVariant &value, const QStringList &groups)
+{
+    QStringList groupsClean = groups;
+    groupsClean.pop_front(); // remove default group: settings
 
-	for (const QString& gName : groupsClean) {
-		settings.beginGroup(gName);
-	}
+    for (const QString &gName : groupsClean) {
+        settings.beginGroup(gName);
+    }
 
-	settings.setValue(key, value);
-	qDebug() << key << ":" << value << "written...";
+    settings.setValue(key, value);
+    qDebug() << key << ":" << value << "written...";
 
-	for (int idx = 0; idx < groupsClean.size(); idx++)
-		settings.endGroup();
+    for (int idx = 0; idx < groupsClean.size(); idx++)
+        settings.endGroup();
 }
 
-void DkSettingsWidget::removeSetting(QSettings& settings, const QString & key, const QStringList & groups) {
+void DkSettingsWidget::removeSetting(QSettings &settings, const QString &key, const QStringList &groups)
+{
+    QStringList groupsClean = groups;
+    groupsClean.pop_front();
 
-	QStringList groupsClean = groups;
-	groupsClean.pop_front();
+    for (const QString &gName : groupsClean) {
+        settings.beginGroup(gName);
+    }
 
-	for (const QString& gName : groupsClean) {
-		settings.beginGroup(gName);
-	}
+    settings.remove(key);
+    qDebug() << key << "removed...";
 
-	settings.remove(key);
-	qDebug() << key << "removed...";
-
-	for (int idx = 0; idx < groupsClean.size(); idx++)
-		settings.endGroup();
+    for (int idx = 0; idx < groupsClean.size(); idx++)
+        settings.endGroup();
 }
 
-void DkSettingsWidget::on_SettingsModel_settingChanged(const QString & key, const QVariant & value, const QStringList & groups) {
-	emit changeSettingSignal(key, value, groups);
+void DkSettingsWidget::on_SettingsModel_settingChanged(const QString &key, const QVariant &value, const QStringList &groups)
+{
+    emit changeSettingSignal(key, value, groups);
 }
 
-void DkSettingsWidget::on_SettingsModel_settingRemoved(const QString & key, const QStringList & groups) {
-	emit removeSettingSignal(key, groups);
+void DkSettingsWidget::on_SettingsModel_settingRemoved(const QString &key, const QStringList &groups)
+{
+    emit removeSettingSignal(key, groups);
 }
 
-void DkSettingsWidget::on_removeRows_triggered() {
-	
-	QModelIndexList selList = mTreeView->selectionModel()->selectedRows();
-	for (const QModelIndex index : selList) {
-		const QModelIndex cIndex = mProxyModel->mapToSource(index.parent());
-		mSettingsModel->removeRows(index.row(), 1, cIndex);
-	}
+void DkSettingsWidget::on_removeRows_triggered()
+{
+    QModelIndexList selList = mTreeView->selectionModel()->selectedRows();
+    for (const QModelIndex index : selList) {
+        const QModelIndex cIndex = mProxyModel->mapToSource(index.parent());
+        mSettingsModel->removeRows(index.row(), 1, cIndex);
+    }
 }
 
-void DkSettingsWidget::createLayout() {
+void DkSettingsWidget::createLayout()
+{
+    mSettingsFilter = new QLineEdit(this);
+    mSettingsFilter->setObjectName("Filter");
+    mSettingsFilter->setPlaceholderText(tr("Filter Settings"));
 
-	mSettingsFilter = new QLineEdit(this);
-	mSettingsFilter->setObjectName("Filter");
-	mSettingsFilter->setPlaceholderText(tr("Filter Settings"));
+    // create our beautiful shortcut view
+    mSettingsModel = new DkSettingsModel(this);
+    mSettingsModel->setObjectName("SettingsModel");
 
-	// create our beautiful shortcut view
-	mSettingsModel = new DkSettingsModel(this);
-	mSettingsModel->setObjectName("SettingsModel");
+    mProxyModel = new DkSettingsProxyModel(this);
+    mProxyModel->setSourceModel(mSettingsModel);
+    // mProxyModel->setDynamicSortFilter(true);
 
-	mProxyModel = new DkSettingsProxyModel(this);
-	mProxyModel->setSourceModel(mSettingsModel);
-	//mProxyModel->setDynamicSortFilter(true);
+    mTreeView = new QTreeView(this);
+    mTreeView->setModel(mProxyModel);
+    mTreeView->setAlternatingRowColors(true);
+    // mTreeView->setIndentation(8);
+    mTreeView->header()->resizeSection(0, 200);
+    // mTreeView->setSortingEnabled(true);
 
-	mTreeView = new QTreeView(this);
-	mTreeView->setModel(mProxyModel);
-	mTreeView->setAlternatingRowColors(true);
-	//mTreeView->setIndentation(8);
-	mTreeView->header()->resizeSection(0, 200);
-	//mTreeView->setSortingEnabled(true);
+    QVBoxLayout *layout = new QVBoxLayout(this);
+    layout->setContentsMargins(0, 0, 0, 0);
+    layout->addWidget(mSettingsFilter);
+    layout->addWidget(mTreeView);
 
-	QVBoxLayout* layout = new QVBoxLayout(this);
-	layout->setContentsMargins(0, 0, 0, 0);
-	layout->addWidget(mSettingsFilter);
-	layout->addWidget(mTreeView);
+    // contextMenu
+    QMenu *contextMenu = new QMenu(mTreeView);
+    mTreeView->setContextMenuPolicy(Qt::ActionsContextMenu);
 
-	// contextMenu
-	QMenu* contextMenu = new QMenu(mTreeView);
-	mTreeView->setContextMenuPolicy(Qt::ActionsContextMenu);
-	
-	QAction* removeAction = new QAction(tr("Delete"), contextMenu);
-	removeAction->setObjectName("removeRows");
-	removeAction->setShortcut(QKeySequence::Delete);
-	mTreeView->addAction(removeAction);
-	
+    QAction *removeAction = new QAction(tr("Delete"), contextMenu);
+    removeAction->setObjectName("removeRows");
+    removeAction->setShortcut(QKeySequence::Delete);
+    mTreeView->addAction(removeAction);
 }
 
-void DkSettingsWidget::filter(const QString& filterText) {
-
-	if (!filterText.isEmpty())
-		mTreeView->expandAll();
+void DkSettingsWidget::filter(const QString &filterText)
+{
+    if (!filterText.isEmpty())
+        mTreeView->expandAll();
 
-	mProxyModel->setFilterRegExp(QRegExp(filterText, Qt::CaseInsensitive, QRegExp::FixedString));
-	qDebug() << "filtering: " << filterText;
+    mProxyModel->setFilterRegularExpression(QRegularExpression(QRegularExpression::escape(filterText), QRegularExpression::CaseInsensitiveOption));
+    qDebug() << "filtering: " << filterText;
 }
 
-void DkSettingsWidget::expandAll() {
-	mTreeView->expandAll();
+void DkSettingsWidget::expandAll()
+{
+    mTreeView->expandAll();
 }
 
-void DkSettingsWidget::on_Filter_textChanged(const QString& filterText) {
-
-	filter(filterText);
+void DkSettingsWidget::on_Filter_textChanged(const QString &filterText)
+{
+    filter(filterText);
 }
 
 // DkSettingsEntry --------------------------------------------------------------------
-DkSettingsEntry::DkSettingsEntry(const QString & key, const QVariant & value) {
-	mKey = key;
-	mValue = value;
+DkSettingsEntry::DkSettingsEntry(const QString &key, const QVariant &value)
+{
+    mKey = key;
+    mValue = value;
 }
 
-QString DkSettingsEntry::key() const {
-	return mKey;
+QString DkSettingsEntry::key() const
+{
+    return mKey;
 }
 
-void DkSettingsEntry::setValue(const QVariant & value) {
-	mValue = value;
+void DkSettingsEntry::setValue(const QVariant &value)
+{
+    mValue = value;
 }
 
-QVariant DkSettingsEntry::value() const {
-	return mValue;
+QVariant DkSettingsEntry::value() const
+{
+    return mValue;
 }
 
-DkSettingsEntry DkSettingsEntry::fromSettings(const QString & key, const QSettings & settings) {
+DkSettingsEntry DkSettingsEntry::fromSettings(const QString &key, const QSettings &settings)
+{
+    DkSettingsEntry se(key);
 
-	DkSettingsEntry se(key);
+    // int settings
+    bool ok = false;
 
-	// int settings
-	bool ok = false;
+    // double settings?
+    double dVal = settings.value(key, -1.0).toDouble(&ok);
 
-	// double settings?
-	double dVal = settings.value(key, -1.0).toDouble(&ok);
+    // we first cast to double & check if the number is rational
+    // if it is not, we pass it to the int cast
+    if (ok && (double)qRound(dVal) != dVal) {
+        se.setValue(dVal);
+        return se;
+    }
 
-	// we first cast to double & check if the number is rational
-	// if it is not, we pass it to the int cast
-	if (ok && (double)qRound(dVal) != dVal) {
-		se.setValue(dVal);
-		return se;
-	}
+    int iVal = settings.value(key, -1).toString().toInt(&ok); // double is ok e.g. 1.3 -> iVal=1
 
-	int iVal = settings.value(key, -1).toString().toInt(&ok); //double is ok e.g. 1.3 -> iVal=1
+    if (ok) {
+        se.setValue(iVal);
+        return se;
+    }
 
-	if (ok) {
-		se.setValue(iVal);
-		return se;
-	}
-	
-	se.setValue(settings.value(key));
-	return se;
+    se.setValue(settings.value(key));
+    return se;
 }
 
 // DkSettingsGroup --------------------------------------------------------------------
-DkSettingsGroup::DkSettingsGroup(const QString & name) {
-	mGroupName = name;
+DkSettingsGroup::DkSettingsGroup(const QString &name)
+{
+    mGroupName = name;
 }
 
-bool DkSettingsGroup::isEmpty() const {
-	return mEntries.empty() && mChildren.empty();
+bool DkSettingsGroup::isEmpty() const
+{
+    return mEntries.empty() && mChildren.empty();
 }
 
-DkSettingsGroup DkSettingsGroup::fromSettings(QSettings & settings, const QString & groupName) {
+DkSettingsGroup DkSettingsGroup::fromSettings(QSettings &settings, const QString &groupName)
+{
+    DkSettingsGroup sg(groupName);
+    settings.beginGroup(groupName);
 
-	DkSettingsGroup sg(groupName);
-	settings.beginGroup(groupName);
+    for (const QString &key : settings.allKeys()) {
+        if (!key.contains("/")) // skip entries from different hierarchies
+            sg.mEntries << DkSettingsEntry::fromSettings(key, settings);
+    }
 
-	for (const QString& key : settings.allKeys()) {
-		if (!key.contains("/"))	// skip entries from different hierarchies
-			sg.mEntries << DkSettingsEntry::fromSettings(key, settings);
-	}
+    for (const QString &gn : settings.childGroups()) {
+        sg.addChild(DkSettingsGroup::fromSettings(settings, gn));
+    }
 
-	for (const QString& gn : settings.childGroups()) {
-		sg.addChild(DkSettingsGroup::fromSettings(settings, gn));
-	}
+    settings.endGroup();
 
-	settings.endGroup();
-
-	return sg;
+    return sg;
 }
 
-QString DkSettingsGroup::name() const {
-	return mGroupName;
+QString DkSettingsGroup::name() const
+{
+    return mGroupName;
 }
 
-int DkSettingsGroup::size() const {
-	return mEntries.size();
+int DkSettingsGroup::size() const
+{
+    return mEntries.size();
 }
 
-QVector<DkSettingsEntry> DkSettingsGroup::entries() const {
-	return mEntries;
+QVector<DkSettingsEntry> DkSettingsGroup::entries() const
+{
+    return mEntries;
 }
 
-QVector<DkSettingsGroup> DkSettingsGroup::children() const {
-	return mChildren;
+QVector<DkSettingsGroup> DkSettingsGroup::children() const
+{
+    return mChildren;
 }
 
-void DkSettingsGroup::addChild(const DkSettingsGroup & group) {
-	mChildren << group;
+void DkSettingsGroup::addChild(const DkSettingsGroup &group)
+{
+    mChildren << group;
 }
 
 // DkSettingsProxyModel --------------------------------------------------------------------
-DkSettingsProxyModel::DkSettingsProxyModel(QObject* parent) : QSortFilterProxyModel(parent) {
-
+DkSettingsProxyModel::DkSettingsProxyModel(QObject *parent)
+    : QSortFilterProxyModel(parent)
+{
 }
 
-bool DkSettingsProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex & sourceParent) const {
+bool DkSettingsProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
+{
+    QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
 
-	QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
+    TreeItem *t = static_cast<TreeItem *>(index.internalPointer());
+    if (t) {
+        return t->contains(filterRegularExpression(), filterKeyColumn());
+    }
 
-	TreeItem* t = static_cast<TreeItem*>(index.internalPointer());
-	if (t) {
-		return t->contains(filterRegExp(), filterKeyColumn());
-	}
-
-	return true;
+    return true;
 }
 
-
 // DkSettingsModel --------------------------------------------------------------------
-DkSettingsModel::DkSettingsModel(QObject* parent) : QAbstractItemModel(parent) {
-
-	// create root
-	QVector<QVariant> rootData;
-	rootData << tr("Settings") << tr("Value");
-
-	mRootItem = new TreeItem(rootData);
+DkSettingsModel::DkSettingsModel(QObject *parent)
+    : QAbstractItemModel(parent)
+{
+    // create root
+    QVector<QVariant> rootData;
+    rootData << tr("Settings") << tr("Value");
 
+    mRootItem = new TreeItem(rootData);
 }
 
-DkSettingsModel::~DkSettingsModel() {
-	delete mRootItem;	// crash detected
+DkSettingsModel::~DkSettingsModel()
+{
+    delete mRootItem; // crash detected
 }
 
-QModelIndex DkSettingsModel::index(int row, int column, const QModelIndex &parent) const {
+QModelIndex DkSettingsModel::index(int row, int column, const QModelIndex &parent) const
+{
+    if (!hasIndex(row, column, parent))
+        return QModelIndex();
 
-	if (!hasIndex(row, column, parent))
-		return QModelIndex();
+    TreeItem *parentItem;
 
-	TreeItem *parentItem;
+    if (!parent.isValid())
+        parentItem = mRootItem;
+    else
+        parentItem = static_cast<TreeItem *>(parent.internalPointer());
 
-	if (!parent.isValid())
-		parentItem = mRootItem;
-	else
-		parentItem = static_cast<TreeItem*>(parent.internalPointer());
+    TreeItem *childItem = parentItem->child(row);
 
-	TreeItem *childItem = parentItem->child(row);
-
-	if (childItem)
-		return createIndex(row, column, childItem);
-	else
-		return QModelIndex();
+    if (childItem)
+        return createIndex(row, column, childItem);
+    else
+        return QModelIndex();
 }
 
-QModelIndex DkSettingsModel::parent(const QModelIndex &index) const {
-
-	if (!index.isValid())
-		return QModelIndex();
+QModelIndex DkSettingsModel::parent(const QModelIndex &index) const
+{
+    if (!index.isValid())
+        return QModelIndex();
 
-	TreeItem *childItem = static_cast<TreeItem*>(index.internalPointer());
-	TreeItem *parentItem = childItem->parent();
+    TreeItem *childItem = static_cast<TreeItem *>(index.internalPointer());
+    TreeItem *parentItem = childItem->parent();
 
-	if (parentItem == mRootItem)
-		return QModelIndex();
+    if (parentItem == mRootItem)
+        return QModelIndex();
 
-	//qDebug() << "creating index for: " << childItem->data(0);
+    // qDebug() << "creating index for: " << childItem->data(0);
 
-	return createIndex(parentItem->row(), 0, parentItem);
+    return createIndex(parentItem->row(), 0, parentItem);
 }
 
-int DkSettingsModel::rowCount(const QModelIndex& parent) const {
-
-	TreeItem *parentItem;
-	if (parent.column() > 0)
-		return 0;
+int DkSettingsModel::rowCount(const QModelIndex &parent) const
+{
+    TreeItem *parentItem;
+    if (parent.column() > 0)
+        return 0;
 
-	if (!parent.isValid())
-		parentItem = mRootItem;
-	else
-		parentItem = static_cast<TreeItem*>(parent.internalPointer());
+    if (!parent.isValid())
+        parentItem = mRootItem;
+    else
+        parentItem = static_cast<TreeItem *>(parent.internalPointer());
 
-	return parentItem->childCount();
+    return parentItem->childCount();
 }
 
-int DkSettingsModel::columnCount(const QModelIndex& parent) const {
-
-	if (parent.isValid())
-		return static_cast<TreeItem*>(parent.internalPointer())->columnCount();
-	else
-		return mRootItem->columnCount();
+int DkSettingsModel::columnCount(const QModelIndex &parent) const
+{
+    if (parent.isValid())
+        return static_cast<TreeItem *>(parent.internalPointer())->columnCount();
+    else
+        return mRootItem->columnCount();
 }
 
-QVariant DkSettingsModel::data(const QModelIndex& index, int role) const {
-
-	if (!index.isValid()) {
-		qDebug() << "invalid row: " << index.row();
-		return QVariant();
-	}
+QVariant DkSettingsModel::data(const QModelIndex &index, int role) const
+{
+    if (!index.isValid()) {
+        qDebug() << "invalid row: " << index.row();
+        return QVariant();
+    }
 
-	if (role == Qt::DisplayRole || role == Qt::EditRole) {
+    if (role == Qt::DisplayRole || role == Qt::EditRole) {
+        TreeItem *item = static_cast<TreeItem *>(index.internalPointer());
+        return item->data(index.column());
+    }
 
-		TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
-		return item->data(index.column());
-	}
-
-	return QVariant();
+    return QVariant();
 }
 
-QVariant DkSettingsModel::headerData(int section, Qt::Orientation orientation, int role) const {
-
-	if (orientation != Qt::Horizontal || role != Qt::DisplayRole) 
-		return QVariant();
-
-	return mRootItem->data(section);
-} 
-
-bool DkSettingsModel::setData(const QModelIndex& index, const QVariant& value, int role) {
+QVariant DkSettingsModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+    if (orientation != Qt::Horizontal || role != Qt::DisplayRole)
+        return QVariant();
 
-	if (!index.isValid() || role != Qt::EditRole)
-		return false;
-
-	if (index.column() == 1) {
+    return mRootItem->data(section);
+}
 
+bool DkSettingsModel::setData(const QModelIndex &index, const QVariant &value, int role)
+{
+    if (!index.isValid() || role != Qt::EditRole)
+        return false;
 
-		QString val = value.value<QString>();
-		// TODO: check value & write it directly?
+    if (index.column() == 1) {
+        QString val = value.value<QString>();
+        // TODO: check value & write it directly?
 
-		TreeItem* item = static_cast<TreeItem*>(index.internalPointer());
-		item->setData(val, index.column());
-	}
-	else {
-		TreeItem* item = static_cast<TreeItem*>(index.internalPointer());
-		item->setData(value, index.column());
-	}
+        TreeItem *item = static_cast<TreeItem *>(index.internalPointer());
+        item->setData(val, index.column());
+    } else {
+        TreeItem *item = static_cast<TreeItem *>(index.internalPointer());
+        item->setData(value, index.column());
+    }
 
-	TreeItem* item = static_cast<TreeItem*>(index.internalPointer());
+    TreeItem *item = static_cast<TreeItem *>(index.internalPointer());
 
-	if (item) {
-		item->setData(value, index.column());
+    if (item) {
+        item->setData(value, index.column());
 
-		if (index.column() == 1) {
-			emit settingChanged(item->data(0).toString(), item->data(1), item->parentList());
-		}
-	}
+        if (index.column() == 1) {
+            emit settingChanged(item->data(0).toString(), item->data(1), item->parentList());
+        }
+    }
 
-	emit dataChanged(index, index);
-	return true;
+    emit dataChanged(index, index);
+    return true;
 }
 
-Qt::ItemFlags DkSettingsModel::flags(const QModelIndex& index) const {
-
-	if (!index.isValid())
-		return Qt::ItemIsEditable;
+Qt::ItemFlags DkSettingsModel::flags(const QModelIndex &index) const
+{
+    if (!index.isValid())
+        return Qt::ItemIsEditable;
 
-	//// no editing on root items
-	//if (item->parent() == rootItem)
-	//	return QAbstractTableModel::flags(index);
+    //// no editing on root items
+    // if (item->parent() == rootItem)
+    //	return QAbstractTableModel::flags(index);
 
-	Qt::ItemFlags flags;
+    Qt::ItemFlags flags;
 
-	if (index.column() == 0)
-		flags = QAbstractItemModel::flags(index);
-	if (index.column() == 1)
-		flags = QAbstractItemModel::flags(index) | Qt::ItemIsEditable;
+    if (index.column() == 0)
+        flags = QAbstractItemModel::flags(index);
+    if (index.column() == 1)
+        flags = QAbstractItemModel::flags(index) | Qt::ItemIsEditable;
 
-	return flags;
+    return flags;
 }
 
-void DkSettingsModel::addSettingsGroup(const DkSettingsGroup& group, const QString& parentName) {
-
-	beginResetModel();
-	// create root
-	QVector<QVariant> data;
-	data << group.name();
-
-	TreeItem* parentItem = mRootItem->find(parentName, 0);
-	if (!parentItem)
-		parentItem = mRootItem;
+void DkSettingsModel::addSettingsGroup(const DkSettingsGroup &group, const QString &parentName)
+{
+    beginResetModel();
+    // create root
+    QVector<QVariant> data;
+    data << group.name();
 
-	TreeItem* settingsItem = new TreeItem(data, parentItem);
+    TreeItem *parentItem = mRootItem->find(parentName, 0);
+    if (!parentItem)
+        parentItem = mRootItem;
 
-	for (const DkSettingsEntry& entry : group.entries()) {
+    TreeItem *settingsItem = new TreeItem(data, parentItem);
 
-		QVector<QVariant> settingsData;
-		settingsData << entry.key() << entry.value();
+    for (const DkSettingsEntry &entry : group.entries()) {
+        QVector<QVariant> settingsData;
+        settingsData << entry.key() << entry.value();
 
-		TreeItem* dataItem = new TreeItem(settingsData, settingsItem);
-		settingsItem->appendChild(dataItem);
-	}
+        TreeItem *dataItem = new TreeItem(settingsData, settingsItem);
+        settingsItem->appendChild(dataItem);
+    }
 
-	parentItem->appendChild(settingsItem);
+    parentItem->appendChild(settingsItem);
 
-	for (const DkSettingsGroup& g : group.children()) {
-		addSettingsGroup(g, group.name());
-	}
-	endResetModel();
+    for (const DkSettingsGroup &g : group.children()) {
+        addSettingsGroup(g, group.name());
+    }
+    endResetModel();
 
-	//qDebug() << "item - child count:" << settingsItem->childCount();
+    // qDebug() << "item - child count:" << settingsItem->childCount();
 }
 
-void DkSettingsModel::clear() {
-
-	beginResetModel();
-	mRootItem->clear();
-	endResetModel();
+void DkSettingsModel::clear()
+{
+    beginResetModel();
+    mRootItem->clear();
+    endResetModel();
 }
 
-bool DkSettingsModel::removeRows(int row, int count, const QModelIndex & parent) {
-
-	bool success = false;
+bool DkSettingsModel::removeRows(int row, int count, const QModelIndex &parent)
+{
+    bool success = false;
 
-	TreeItem* item = static_cast<TreeItem*>(parent.internalPointer());
-	if (!item)
-		item = mRootItem;
+    TreeItem *item = static_cast<TreeItem *>(parent.internalPointer());
+    if (!item)
+        item = mRootItem;
 
-	beginRemoveRows(parent, row, row);
-	for (int rIdx = row; rIdx < row + count; rIdx++) {
+    beginRemoveRows(parent, row, row);
+    for (int rIdx = row; rIdx < row + count; rIdx++) {
+        TreeItem *deleteRow = item->child(rIdx);
 
-		TreeItem* deleteRow = item->child(rIdx);
+        if (deleteRow) {
+            emit settingRemoved(deleteRow->data(0).toString(), deleteRow->parentList());
+            item->remove(rIdx);
+            success = true;
+        } else
+            qWarning() << "I cannot delete a non-existing row:" << row;
+    }
+    endRemoveRows();
 
-		if (deleteRow) {
-			emit settingRemoved(deleteRow->data(0).toString(), deleteRow->parentList());
-			item->remove(rIdx);
-			success = true;
-		}
-		else
-			qWarning() << "I cannot delete a non-existing row:" << row;
-	}
-	endRemoveRows();
-
-	return success;
+    return success;
 }
 
-}
\ No newline at end of file
+}
diff --git a/ImageLounge/src/DkGui/DkSettingsWidget.h b/ImageLounge/src/DkGui/DkSettingsWidget.h
index d5dbeef..9192a0d 100644
--- a/ImageLounge/src/DkGui/DkSettingsWidget.h
+++ b/ImageLounge/src/DkGui/DkSettingsWidget.h
@@ -1,6 +1,6 @@
 /*******************************************************************************************************
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2016 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2016 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2016 Florian Kleber <florian@nomacs.org>
@@ -28,14 +28,14 @@
 
 #pragma once
 
-#include "DkUtils.h"
 #include "DkBaseWidgets.h"
+#include "DkUtils.h"
 
-#pragma warning(push, 0)	// no warnings from includes
-#include <QWidget>
-#include <QSettings>
+#pragma warning(push, 0) // no warnings from includes
 #include <QAbstractItemModel>
+#include <QSettings>
 #include <QSortFilterProxyModel>
+#include <QWidget>
 #pragma warning(pop)
 
 #ifndef DllCoreExport
@@ -52,126 +52,130 @@
 class QTreeView;
 class QLineEdit;
 
-namespace nmc {
-
-class DllCoreExport DkSettingsEntry {
+namespace nmc
+{
 
+class DllCoreExport DkSettingsEntry
+{
 public:
-	DkSettingsEntry(const QString& key = QString(), const QVariant& value = QVariant());
+    DkSettingsEntry(const QString &key = QString(), const QVariant &value = QVariant());
 
-	QString key() const;
+    QString key() const;
 
-	void setValue(const QVariant& value);
-	QVariant value() const;
+    void setValue(const QVariant &value);
+    QVariant value() const;
 
-	static DkSettingsEntry fromSettings(const QString& key, const QSettings& settings);
+    static DkSettingsEntry fromSettings(const QString &key, const QSettings &settings);
 
 protected:
-	QString mKey;
-	QVariant mValue;
+    QString mKey;
+    QVariant mValue;
 };
 
-class DllCoreExport DkSettingsGroup {
-
+class DllCoreExport DkSettingsGroup
+{
 public:
-	DkSettingsGroup(const QString& name = QString());
+    DkSettingsGroup(const QString &name = QString());
 
-	bool isEmpty() const;
+    bool isEmpty() const;
 
-	QString name() const;
-	int size() const;
-	QVector<DkSettingsEntry> entries() const;
-	QVector<DkSettingsGroup> children() const;
+    QString name() const;
+    int size() const;
+    QVector<DkSettingsEntry> entries() const;
+    QVector<DkSettingsGroup> children() const;
 
-	void addChild(const DkSettingsGroup& group);
+    void addChild(const DkSettingsGroup &group);
 
-	static DkSettingsGroup fromSettings(QSettings& settings, const QString& groupName = "");
+    static DkSettingsGroup fromSettings(QSettings &settings, const QString &groupName = "");
 
 protected:
-	QString mGroupName;
-	QVector<DkSettingsEntry> mEntries;
-	QVector<DkSettingsGroup> mChildren;
+    QString mGroupName;
+    QVector<DkSettingsEntry> mEntries;
+    QVector<DkSettingsGroup> mChildren;
 };
 
-class DkSettingsProxyModel : public QSortFilterProxyModel {
-	Q_OBJECT
+class DkSettingsProxyModel : public QSortFilterProxyModel
+{
+    Q_OBJECT
 
 public:
-	DkSettingsProxyModel(QObject * parent = 0);
-	virtual ~DkSettingsProxyModel() {}
+    DkSettingsProxyModel(QObject *parent = 0);
+    virtual ~DkSettingsProxyModel()
+    {
+    }
 
 protected:
-	virtual bool filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const override;
-
+    virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
 };
 
-class DkSettingsModel : public QAbstractItemModel {
-	Q_OBJECT
+class DkSettingsModel : public QAbstractItemModel
+{
+    Q_OBJECT
 
 public:
-	DkSettingsModel(QObject* parent = 0);
-	~DkSettingsModel();
-
-	QModelIndex index(int row, int column, const QModelIndex &parent) const override;
-	QModelIndex parent(const QModelIndex &index) const override;
-
-	// return item of the model
-	virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override;
-	virtual int columnCount(const QModelIndex& parent = QModelIndex()) const override;
-	virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
-	virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
-
-	// edit functions
-	virtual Qt::ItemFlags flags(const QModelIndex& index) const override;
-	virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
-	virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
-	
-	void addSettingsGroup(const DkSettingsGroup& group, const QString& parentName = "");
-	void clear();
+    DkSettingsModel(QObject *parent = 0);
+    ~DkSettingsModel();
+
+    QModelIndex index(int row, int column, const QModelIndex &parent) const override;
+    QModelIndex parent(const QModelIndex &index) const override;
+
+    // return item of the model
+    virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+    virtual int columnCount(const QModelIndex &parent = QModelIndex()) const override;
+    virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+    virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
+
+    // edit functions
+    virtual Qt::ItemFlags flags(const QModelIndex &index) const override;
+    virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
+    virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
+
+    void addSettingsGroup(const DkSettingsGroup &group, const QString &parentName = "");
+    void clear();
 
 signals:
-	void settingChanged(const QString& key, const QVariant& value, const QStringList& groups) const;
-	void settingRemoved(const QString& key, const QStringList& groups) const;
+    void settingChanged(const QString &key, const QVariant &value, const QStringList &groups) const;
+    void settingRemoved(const QString &key, const QStringList &groups) const;
 
 protected:
-	TreeItem* mRootItem;
+    TreeItem *mRootItem;
 };
 
 // nomacs defines
-class DllCoreExport DkSettingsWidget : public DkWidget {
-	Q_OBJECT
+class DllCoreExport DkSettingsWidget : public DkWidget
+{
+    Q_OBJECT
 
 public:
-	DkSettingsWidget(QWidget* parent);
+    DkSettingsWidget(QWidget *parent);
 
-	void setSettingsPath(const QString& settings, const QString& parentName = "");
-	void addSettingsGroup(const DkSettingsGroup& group);
-	void clear();
-	void filter(const QString& filterText);
-	void expandAll();
+    void setSettingsPath(const QString &settings, const QString &parentName = "");
+    void addSettingsGroup(const DkSettingsGroup &group);
+    void clear();
+    void filter(const QString &filterText);
+    void expandAll();
 
-	static void changeSetting(QSettings& settings, const QString& key, const QVariant& value, const QStringList& groups);
-	static void removeSetting(QSettings& settings, const QString& key, const QStringList& groups);
+    static void changeSetting(QSettings &settings, const QString &key, const QVariant &value, const QStringList &groups);
+    static void removeSetting(QSettings &settings, const QString &key, const QStringList &groups);
 
 signals:
-	void changeSettingSignal(const QString& key, const QVariant& value, const QStringList& groups);
-	void removeSettingSignal(const QString& key, const QStringList& groups);
+    void changeSettingSignal(const QString &key, const QVariant &value, const QStringList &groups);
+    void removeSettingSignal(const QString &key, const QStringList &groups);
 
 public slots:
-	//void focusFilter();
-	void on_Filter_textChanged(const QString& text);
-	void on_SettingsModel_settingChanged(const QString& key, const QVariant& value, const QStringList& groups);
-	void on_SettingsModel_settingRemoved(const QString& key, const QStringList& groups);
-	void on_removeRows_triggered();
+    // void focusFilter();
+    void on_Filter_textChanged(const QString &text);
+    void on_SettingsModel_settingChanged(const QString &key, const QVariant &value, const QStringList &groups);
+    void on_SettingsModel_settingRemoved(const QString &key, const QStringList &groups);
+    void on_removeRows_triggered();
 
 protected:
-	void createLayout();
+    void createLayout();
 
-	DkSettingsModel* mSettingsModel;
-	DkSettingsProxyModel* mProxyModel;
-	QLineEdit* mSettingsFilter;
-	QTreeView* mTreeView;
+    DkSettingsModel *mSettingsModel;
+    DkSettingsProxyModel *mProxyModel;
+    QLineEdit *mSettingsFilter;
+    QTreeView *mTreeView;
 };
 
-
 }
\ No newline at end of file
diff --git a/ImageLounge/src/DkGui/DkThumbsWidgets.cpp b/ImageLounge/src/DkGui/DkThumbsWidgets.cpp
index 0c3b294..d169a4d 100644
--- a/ImageLounge/src/DkGui/DkThumbsWidgets.cpp
+++ b/ImageLounge/src/DkGui/DkThumbsWidgets.cpp
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkThumbsWidgets.cpp
  Created on:	18.09.2014
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2014 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2014 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2014 Florian Kleber <florian@nomacs.org>
@@ -26,2445 +26,2351 @@
  *******************************************************************************************************/
 
 #include "DkThumbsWidgets.h"
-#include "DkThumbs.h"
-#include "DkTimer.h"
+#include "DkActionManager.h"
 #include "DkImageContainer.h"
-#include "DkImageStorage.h"
-#include "DkSettings.h"
 #include "DkImageLoader.h"
-#include "DkActionManager.h"
-#include "DkUtils.h"
+#include "DkImageStorage.h"
 #include "DkMessageBox.h"
+#include "DkSettings.h"
 #include "DkStatusBar.h"
+#include "DkThumbs.h"
+#include "DkTimer.h"
+#include "DkUtils.h"
 
 #include "DkBasicLoader.h"
 #include "DkDialog.h"
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QTimer>
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QAction>
-#include <QMenu>
-#include <qmath.h>
-#include <QResizeEvent>
-#include <QGraphicsSceneMouseEvent>
 #include <QApplication>
-#include <QUrl>
-#include <QScrollBar>
+#include <QClipboard>
+#include <QGraphicsSceneMouseEvent>
 #include <QHBoxLayout>
-#include <QStyleOptionGraphicsItem>
-#include <QToolBar>
-#include <QToolButton>
+#include <QInputDialog>
 #include <QLineEdit>
-#include <QClipboard>
+#include <QMenu>
 #include <QMessageBox>
-#include <QInputDialog>
 #include <QMimeData>
-#include <QThreadPool>
 #include <QPushButton>
-#pragma warning(pop)		// no warnings from includes - end
+#include <QResizeEvent>
+#include <QScrollBar>
+#include <QStyleOptionGraphicsItem>
+#include <QThreadPool>
+#include <QTimer>
+#include <QToolBar>
+#include <QToolButton>
+#include <QUrl>
+#include <qmath.h>
+#pragma warning(pop) // no warnings from includes - end
 
-namespace nmc {
+namespace nmc
+{
 
 // DkFilePreview --------------------------------------------------------------------
-DkFilePreview::DkFilePreview(QWidget* parent, Qt::WindowFlags flags) : DkFadeWidget(parent, flags) {
-
-	orientation = Qt::Horizontal;
-	windowPosition = pos_north;
-
-	init();
-	//setStyleSheet("QToolTip{border: 0px; border-radius: 21px; color: white; background-color: red;}"); //" + DkUtils::colorToString(mBgCol) + ";}");
+DkFilePreview::DkFilePreview(QWidget *parent, Qt::WindowFlags flags)
+    : DkFadeWidget(parent, flags)
+{
+    orientation = Qt::Horizontal;
+    windowPosition = pos_north;
+
+    init();
+    // setStyleSheet("QToolTip{border: 0px; border-radius: 21px; color: white; background-color: red;}"); //" + DkUtils::colorToString(mBgCol) + ";}");
+
+    loadSettings();
+    initOrientations();
+
+    createContextMenu();
+}
+
+void DkFilePreview::init()
+{
+    setObjectName("DkFilePreview");
+    setMouseTracking(true); // receive mouse event everytime
+
+    // thumbsLoader = 0;
+
+    xOffset = qRound(DkSettingsManager::param().effectiveThumbSize(this) * 0.1f);
+    yOffset = qRound(DkSettingsManager::param().effectiveThumbSize(this) * 0.1f);
+
+    currentDx = 0;
+    currentFileIdx = -1;
+    oldFileIdx = -1;
+    mouseTrace = 0;
+    scrollToCurrentImage = false;
+    isPainted = false;
+
+    winPercent = 0.1f;
+    borderTrigger = (orientation == Qt::Horizontal) ? (float)width() * winPercent : (float)height() * winPercent;
+
+    worldMatrix = QTransform();
+
+    moveImageTimer = new QTimer(this);
+    moveImageTimer->setInterval(5); // reduce cpu utilization
+    connect(moveImageTimer, SIGNAL(timeout()), this, SLOT(moveImages()));
+
+    int borderTriggerI = qRound(borderTrigger);
+    leftGradient =
+        (orientation == Qt::Horizontal) ? QLinearGradient(QPoint(0, 0), QPoint(borderTriggerI, 0)) : QLinearGradient(QPoint(0, 0), QPoint(0, borderTriggerI));
+    rightGradient = (orientation == Qt::Horizontal) ? QLinearGradient(QPoint(width() - borderTriggerI, 0), QPoint(width(), 0))
+                                                    : QLinearGradient(QPoint(0, height() - borderTriggerI), QPoint(0, height()));
+    leftGradient.setColorAt(1, Qt::white);
+    leftGradient.setColorAt(0, Qt::black);
+    rightGradient.setColorAt(1, Qt::black);
+    rightGradient.setColorAt(0, Qt::white);
+
+    minHeight = DkSettingsManager::param().effectiveThumbSize(this) + yOffset;
+    // resize(parent->width(), minHeight);
+
+    selected = -1;
+
+    // wheel label
+    QPixmap wp = QPixmap(":/nomacs/img/thumbs-move.svg");
+    wheelButton = new QLabel(this);
+    wheelButton->setAttribute(Qt::WA_TransparentForMouseEvents);
+    wheelButton->setPixmap(wp);
+    wheelButton->hide();
+
+    QWidget *nomacs = DkUtils::getMainWindow();
+    connect(this, SIGNAL(showThumbsDockSignal(bool)), nomacs, SLOT(showThumbsDock(bool)));
+}
+
+void DkFilePreview::initOrientations()
+{
+    if (windowPosition == pos_north || windowPosition == pos_south || windowPosition == pos_dock_hor)
+        orientation = Qt::Horizontal;
+    else if (windowPosition == pos_east || windowPosition == pos_west || windowPosition == pos_dock_ver)
+        orientation = Qt::Vertical;
+
+    if (windowPosition == pos_dock_ver || windowPosition == pos_dock_hor)
+        minHeight = max_thumb_size;
+    else
+        minHeight = DkSettingsManager::param().effectiveThumbSize(this);
+
+    if (orientation == Qt::Horizontal) {
+        setMinimumSize(20, 20);
+        setMaximumSize(QWIDGETSIZE_MAX, minHeight);
+        setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
+        borderTrigger = (float)width() * winPercent;
+        int borderTriggerI = qRound(borderTrigger);
+        leftGradient = QLinearGradient(QPoint(0, 0), QPoint(borderTriggerI, 0));
+        rightGradient = QLinearGradient(QPoint(width() - borderTriggerI, 0), QPoint(width(), 0));
+    } else {
+        setMinimumSize(20, 20);
+        setMaximumSize(minHeight, QWIDGETSIZE_MAX);
+        setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
+        borderTrigger = (float)height() * winPercent;
+        int borderTriggerI = qRound(borderTrigger);
+        leftGradient = QLinearGradient(QPoint(0, 0), QPoint(0, borderTriggerI));
+        rightGradient = QLinearGradient(QPoint(0, height() - borderTriggerI), QPoint(0, height()));
+    }
+
+    leftGradient.setColorAt(1, Qt::white);
+    leftGradient.setColorAt(0, Qt::black);
+    rightGradient.setColorAt(1, Qt::black);
+    rightGradient.setColorAt(0, Qt::white);
+
+    worldMatrix.reset();
+    currentDx = 0;
+    scrollToCurrentImage = true;
+    update();
+}
+
+void DkFilePreview::loadSettings()
+{
+    DefaultSettings settings;
+    settings.beginGroup(objectName());
+    windowPosition = settings.value("windowPosition", windowPosition).toInt();
+    settings.endGroup();
+}
+
+void DkFilePreview::saveSettings()
+{
+    DefaultSettings settings;
+    settings.beginGroup(objectName());
+    settings.setValue("windowPosition", windowPosition);
+    settings.endGroup();
+}
+
+void DkFilePreview::createContextMenu()
+{
+    contextMenuActions.resize(cm_end - 1); // -1 because we just need to know of one dock widget
+
+    contextMenuActions[cm_pos_west] = new QAction(tr("Show Left"), this);
+    contextMenuActions[cm_pos_west]->setStatusTip(tr("Shows the Thumbnail Bar on the Left"));
+    connect(contextMenuActions[cm_pos_west], SIGNAL(triggered()), this, SLOT(newPosition()));
+
+    contextMenuActions[cm_pos_north] = new QAction(tr("Show Top"), this);
+    contextMenuActions[cm_pos_north]->setStatusTip(tr("Shows the Thumbnail Bar at the Top"));
+    connect(contextMenuActions[cm_pos_north], SIGNAL(triggered()), this, SLOT(newPosition()));
+
+    contextMenuActions[cm_pos_east] = new QAction(tr("Show Right"), this);
+    contextMenuActions[cm_pos_east]->setStatusTip(tr("Shows the Thumbnail Bar on the Right"));
+    connect(contextMenuActions[cm_pos_east], SIGNAL(triggered()), this, SLOT(newPosition()));
+
+    contextMenuActions[cm_pos_south] = new QAction(tr("Show Bottom"), this);
+    contextMenuActions[cm_pos_south]->setStatusTip(tr("Shows the Thumbnail Bar at the Bottom"));
+    connect(contextMenuActions[cm_pos_south], SIGNAL(triggered()), this, SLOT(newPosition()));
+
+    contextMenuActions[cm_pos_dock_hor] = new QAction(tr("Undock"), this);
+    contextMenuActions[cm_pos_dock_hor]->setStatusTip(tr("Undock the thumbnails"));
+    connect(contextMenuActions[cm_pos_dock_hor], SIGNAL(triggered()), this, SLOT(newPosition()));
+
+    contextMenu = new QMenu(tr("File Preview Menu"), this);
+    contextMenu->addActions(contextMenuActions.toList());
+}
+
+void DkFilePreview::paintEvent(QPaintEvent *)
+{
+    // render nothing if there are no thumbs
+    if (mThumbs.isEmpty())
+        return;
+
+    if (minHeight != DkSettingsManager::param().effectiveThumbSize(this) + yOffset && windowPosition != pos_dock_hor && windowPosition != pos_dock_ver) {
+        xOffset = qCeil(DkSettingsManager::param().effectiveThumbSize(this) * 0.1f);
+        yOffset = qCeil(DkSettingsManager::param().effectiveThumbSize(this) * 0.1f);
+
+        minHeight = DkSettingsManager::param().effectiveThumbSize(this) + yOffset;
+
+        if (orientation == Qt::Horizontal)
+            setMaximumSize(QWIDGETSIZE_MAX, minHeight);
+        else
+            setMaximumSize(minHeight, QWIDGETSIZE_MAX);
+    }
+
+    QPainter painter(this);
+    painter.setBackground(DkSettingsManager::param().display().hudBgColor);
+
+    painter.setPen(Qt::NoPen);
+    painter.setBrush(DkSettingsManager::param().display().hudBgColor);
+
+    if (windowPosition != pos_dock_hor && windowPosition != pos_dock_ver) {
+        QRect r = QRect(QPoint(), this->size());
+        painter.drawRect(r);
+    }
+
+    painter.setWorldTransform(worldMatrix);
+    painter.setWorldMatrixEnabled(true);
+
+    if (mThumbs.empty()) {
+        thumbRects.clear();
+        return;
+    }
+
+    painter.setRenderHint(QPainter::SmoothPixmapTransform);
+    drawThumbs(&painter);
+
+    if (currentFileIdx != oldFileIdx && currentFileIdx >= 0) {
+        oldFileIdx = currentFileIdx;
+        scrollToCurrentImage = true;
+        moveImageTimer->start();
+    }
+    isPainted = true;
+}
+
+void DkFilePreview::drawThumbs(QPainter *painter)
+{
+    // qDebug() << "drawing thumbs: " << worldMatrix.dx();
+
+    bufferDim = (orientation == Qt::Horizontal) ? QRectF(QPointF(0, yOffset / 2), QSize(xOffset, 0)) : QRectF(QPointF(yOffset / 2, 0), QSize(0, xOffset));
+    thumbRects.clear();
+
+    DkTimer dt;
+
+    // mouse over effect
+    QPoint p = worldMatrix.inverted().map(mapFromGlobal(QCursor::pos()));
+
+    for (int idx = 0; idx < mThumbs.size(); idx++) {
+        QSharedPointer<DkThumbNailT> thumb = mThumbs.at(idx)->getThumb();
+        QImage img;
+
+        // if the image is loaded draw that (it might be edited)
+        if (mThumbs.at(idx)->hasImage()) {
+            img = mThumbs.at(idx)->imageScaledToHeight(DkSettingsManager::param().effectiveThumbSize(this));
+        } else {
+            if (thumb->hasImage() == DkThumbNail::exists_not) {
+                thumbRects.push_back(QRectF());
+                continue;
+            }
+
+            if (thumb->hasImage() == DkThumbNail::loaded)
+                img = thumb->getImage();
+        }
+
+        // if (img.width() > max_thumb_size * DkSettingsManager::param().dpiScaleFactor())
+        //	qDebug() << thumb->getFilePath() << "size:" << img.size();
+
+        QPointF anchor = orientation == Qt::Horizontal ? bufferDim.topRight() : bufferDim.bottomLeft();
+        QRectF r = !img.isNull()
+            ? QRectF(anchor, img.size())
+            : QRectF(anchor, QSize(DkSettingsManager::param().effectiveThumbSize(this), DkSettingsManager::param().effectiveThumbSize(this)));
+        if (orientation == Qt::Horizontal && height() - yOffset < r.height() * 2)
+            r.setSize(QSizeF(qFloor(r.width() * (float)(height() - yOffset) / r.height()), height() - yOffset));
+        else if (orientation == Qt::Vertical && width() - yOffset < r.width() * 2)
+            r.setSize(QSizeF(width() - yOffset, qFloor(r.height() * (float)(width() - yOffset) / r.width())));
+
+        // check if the size is still valid
+        if (r.width() < 1 || r.height() < 1)
+            continue; // this brings us in serious problems with the selection
+
+        // center vertically
+        if (orientation == Qt::Horizontal)
+            r.moveCenter(QPoint(qFloor(r.center().x()), height() / 2));
+        else
+            r.moveCenter(QPoint(width() / 2, qFloor(r.center().y())));
+
+        // update the buffer dim
+        if (orientation == Qt::Horizontal)
+            bufferDim.setRight(qFloor(bufferDim.right() + r.width()) + qCeil(xOffset / 2.0f));
+        else
+            bufferDim.setBottom(qFloor(bufferDim.bottom() + r.height()) + qCeil(xOffset / 2.0f));
+        thumbRects.push_back(r);
+
+        QRectF imgWorldRect = worldMatrix.mapRect(r);
+
+        // update file rect for move to current file timer
+        if (scrollToCurrentImage && idx == currentFileIdx)
+            newFileRect = imgWorldRect;
+
+        // is the current image within the canvas?
+        if ((orientation == Qt::Horizontal && imgWorldRect.right() < 0) || (orientation == Qt::Vertical && imgWorldRect.bottom() < 0)) {
+            continue;
+        }
+
+        if (((orientation == Qt::Horizontal && imgWorldRect.left() > width()) || (orientation == Qt::Vertical && imgWorldRect.top() > height()))
+            && scrollToCurrentImage) {
+            continue;
+        } else if ((orientation == Qt::Horizontal && imgWorldRect.left() > width()) || (orientation == Qt::Vertical && imgWorldRect.top() > height())) {
+            break;
+        }
+
+        // only fetch thumbs if we are not moving too fast...
+        if (thumb->hasImage() == DkThumbNail::not_loaded && fabs(currentDx) < 40) {
+            thumb->fetchThumb();
+            connect(thumb.data(), SIGNAL(thumbLoadedSignal()), this, SLOT(update()));
+        }
+
+        bool isLeftGradient = (orientation == Qt::Horizontal && worldMatrix.dx() < 0 && imgWorldRect.left() < leftGradient.finalStop().x())
+            || (orientation == Qt::Vertical && worldMatrix.dy() < 0 && imgWorldRect.top() < leftGradient.finalStop().y());
+        bool isRightGradient = (orientation == Qt::Horizontal && imgWorldRect.right() > rightGradient.start().x())
+            || (orientation == Qt::Vertical && imgWorldRect.bottom() > rightGradient.start().y());
+        // show that there are more images...
+        if (isLeftGradient && !img.isNull())
+            drawFadeOut(leftGradient, imgWorldRect, &img);
+        if (isRightGradient && !img.isNull())
+            drawFadeOut(rightGradient, imgWorldRect, &img);
+
+        if (!img.isNull())
+            painter->drawImage(r, img, QRect(QPoint(), img.size()));
+        else
+            drawNoImgEffect(painter, r);
+
+        if (idx == currentFileIdx)
+            drawCurrentImgEffect(painter, r);
+        else if (idx == selected && r.contains(p))
+            drawSelectedEffect(painter, r);
+
+        // painter->fillRect(QRect(0,0,200, 110), leftGradient);
+    }
+}
+
+void DkFilePreview::drawNoImgEffect(QPainter *painter, const QRectF &r)
+{
+    QBrush oldBrush = painter->brush();
+    QPen oldPen = painter->pen();
+
+    QPen noImgPen(DkSettingsManager::param().display().bgColor);
+    painter->setPen(noImgPen);
+    painter->setBrush(QColor(0, 0, 0, 0));
+    painter->drawRect(r);
+    painter->setPen(oldPen);
+    painter->setBrush(oldBrush);
+}
+
+void DkFilePreview::drawSelectedEffect(QPainter *painter, const QRectF &r)
+{
+    QBrush oldBrush = painter->brush();
+    float oldOp = (float)painter->opacity();
+
+    // drawing
+    painter->setOpacity(0.4);
+    painter->setBrush(DkSettingsManager::param().display().highlightColor);
+    painter->drawRect(r);
+
+    // reset painter
+    painter->setOpacity(oldOp);
+    painter->setBrush(oldBrush);
+}
+
+void DkFilePreview::drawCurrentImgEffect(QPainter *painter, const QRectF &r)
+{
+    QPen oldPen = painter->pen();
+    QBrush oldBrush = painter->brush();
+    float oldOp = (float)painter->opacity();
+
+    // draw
+    QRectF cr = r;
+    cr.setSize(QSize((int)cr.width() + 1, (int)cr.height() + 1));
+    cr.moveCenter(cr.center() + QPointF(-1, -1));
+
+    QPen cPen(DkSettingsManager::param().display().highlightColor, 1);
+    painter->setBrush(QColor(0, 0, 0, 0));
+    painter->setOpacity(1.0);
+    painter->setPen(cPen);
+    painter->drawRect(cr);
+
+    painter->setOpacity(0.5);
+    cr.setSize(QSize((int)cr.width() + 2, (int)cr.height() + 2));
+    cr.moveCenter(cr.center() + QPointF(-1, -1));
+    painter->drawRect(cr);
+
+    painter->setBrush(oldBrush);
+    painter->setOpacity(oldOp);
+    painter->setPen(oldPen);
+}
+
+void DkFilePreview::drawFadeOut(QLinearGradient gradient, QRectF imgRect, QImage *img)
+{
+    if (img && img->format() == QImage::Format_Indexed8)
+        return;
+
+    // compute current scaling
+    QPointF scale(img->width() / imgRect.width(), img->height() / imgRect.height());
+    QTransform wm;
+    wm.scale(scale.x(), scale.y());
+
+    if (orientation == Qt::Horizontal)
+        wm.translate(-imgRect.left(), 0);
+    else
+        wm.translate(0, -imgRect.top());
+
+    QLinearGradient imgGradient = gradient;
+
+    if (orientation == Qt::Horizontal) {
+        imgGradient.setStart(wm.map(gradient.start()).x(), 0);
+        imgGradient.setFinalStop(wm.map(gradient.finalStop()).x(), 0);
+    } else {
+        imgGradient.setStart(0, wm.map(gradient.start()).y());
+        imgGradient.setFinalStop(0, wm.map(gradient.finalStop()).y());
+    }
+
+    QImage mask = *img;
+    QPainter painter(&mask);
+    painter.fillRect(img->rect(), Qt::black);
+    painter.fillRect(img->rect(), imgGradient);
+    painter.end();
+
+    img->setAlphaChannel(mask);
+}
+
+void DkFilePreview::resizeEvent(QResizeEvent *event)
+{
+    QWidget *pw = qobject_cast<QWidget *>(parent());
+
+    if (event->size() == event->oldSize()
+        && ((orientation == Qt::Horizontal && pw && this->width() == pw->width()) || (orientation == Qt::Vertical && pw && this->height() == pw->height()))) {
+        return;
+    }
+
+    if (currentFileIdx >= 0 && isVisible()) {
+        scrollToCurrentImage = true;
+        moveImageTimer->start();
+    }
+
+    // now update...
+    borderTrigger = (orientation == Qt::Horizontal) ? (float)width() * winPercent : (float)height() * winPercent;
+    int borderTriggerI = qRound(borderTrigger);
+    leftGradient.setFinalStop((orientation == Qt::Horizontal) ? QPoint(borderTriggerI, 0) : QPoint(0, borderTriggerI));
+    rightGradient.setStart((orientation == Qt::Horizontal) ? QPoint(width() - borderTriggerI, 0) : QPoint(0, height() - borderTriggerI));
+    rightGradient.setFinalStop((orientation == Qt::Horizontal) ? QPoint(width(), 0) : QPoint(0, height()));
+
+    // update();
+    QWidget::resizeEvent(event);
+}
+
+void DkFilePreview::mouseMoveEvent(QMouseEvent *event)
+{
+    if (lastMousePos.isNull()) {
+        lastMousePos = event->pos();
+        QWidget::mouseMoveEvent(event);
+        return;
+    }
+
+    if (mouseTrace < 21) {
+        mouseTrace += qRound(fabs(QPointF(lastMousePos - event->pos()).manhattanLength()));
+        return;
+    }
+
+    float eventPos = orientation == Qt::Horizontal ? (float)event->pos().x() : (float)event->pos().y();
+    float lastMousePosC = orientation == Qt::Horizontal ? (float)lastMousePos.x() : (float)lastMousePos.y();
+    int limit = orientation == Qt::Horizontal ? width() : height();
+
+    if (event->buttons() == Qt::MiddleButton) {
+        float enterPosC = orientation == Qt::Horizontal ? (float)enterPos.x() : (float)enterPos.y();
+        float dx = std::fabs((float)(enterPosC - eventPos)) * 0.015f;
+        dx = std::exp(dx);
+
+        if (enterPosC - eventPos < 0)
+            dx = -dx;
+
+        currentDx = dx; // update dx
+        return;
+    }
+
+    int mouseDir = qRound(eventPos - lastMousePosC);
+
+    if (event->buttons() == Qt::LeftButton) {
+        currentDx = (float)mouseDir;
+        lastMousePos = event->pos();
+        selected = -1;
+        setCursor(Qt::ClosedHandCursor);
+        scrollToCurrentImage = false;
+        moveImages();
+        return;
+    }
+
+    if (cursor().shape() != Qt::ArrowCursor)
+        setCursor(Qt::ArrowCursor);
+
+    int ndx = limit - qRound(eventPos);
+    int pdx = qRound(eventPos);
+
+    bool left = pdx < ndx;
+    float dx = (left) ? (float)pdx : (float)ndx;
+
+    if (dx < borderTrigger && ((mouseDir < 0 && left) || (mouseDir > 0 && !left))) {
+        dx = std::exp((borderTrigger - dx) / borderTrigger * 3);
+        currentDx = (left) ? dx : -dx;
+
+        scrollToCurrentImage = false;
+        moveImageTimer->start();
+    } else if (dx > borderTrigger && !scrollToCurrentImage)
+        moveImageTimer->stop();
+
+    // select the current thumbnail
+    if (dx > borderTrigger * 0.5) {
+        int oldSelection = selected;
+        selected = -1;
+
+        // find out where the mouse is
+        for (int idx = 0; idx < thumbRects.size(); idx++) {
+            if (worldMatrix.mapRect(thumbRects.at(idx)).contains(event->pos())) {
+                selected = idx;
+
+                if (selected <= mThumbs.size() && selected >= 0) {
+                    QSharedPointer<DkThumbNailT> thumb = mThumbs.at(selected)->getThumb();
+                    // selectedImg = DkImage::colorizePixmap(QPixmap::fromImage(thumb->getImage()), DkSettingsManager::param().display().highlightColor, 0.3f);
+
+                    // important: setText shows the label - if you then hide it here again you'll get a stack overflow
+                    // if (fileLabel->height() < height())
+                    //	fileLabel->setText(thumbs.at(selected).getFile().fileName(), -1);
+                    QFileInfo fileInfo(thumb->getFilePath());
+                    QString toolTipInfo = tr("Name: ") + fileInfo.fileName() + "\n" + tr("Size: ") + DkUtils::readableByte((float)fileInfo.size()) + "\n"
+                        + tr("Created: ") + fileInfo.birthTime().toString(Qt::SystemLocaleDate);
+                    setToolTip(toolTipInfo);
+                    setStatusTip(fileInfo.fileName());
+                }
+                break;
+            }
+        }
+
+        if (selected != -1 || selected != oldSelection)
+            update();
+        // else if (selected == -1)
+        //	fileLabel->hide();
+    } else
+        selected = -1;
+
+    if (selected == -1)
+        setToolTip(tr("CTRL+Zoom resizes the thumbnails"));
+
+    lastMousePos = event->pos();
+
+    // QWidget::mouseMoveEvent(event);
+}
+
+void DkFilePreview::mousePressEvent(QMouseEvent *event)
+{
+    if (event->buttons() == Qt::LeftButton) {
+        mouseTrace = 0;
+    } else if (event->buttons() == Qt::MiddleButton) {
+        enterPos = event->pos();
+        qDebug() << "stop scrolling (middle button)";
+        scrollToCurrentImage = false;
+        moveImageTimer->start();
+
+        // show icon
+        wheelButton->move(event->pos().x() - 16, event->pos().y() - 16);
+        wheelButton->show();
+    }
+}
+
+void DkFilePreview::mouseReleaseEvent(QMouseEvent *event)
+{
+    currentDx = 0;
+    moveImageTimer->stop();
+    wheelButton->hide();
+
+    if (mouseTrace < 20) {
+        // find out where the mouse did click
+        for (int idx = 0; idx < thumbRects.size(); idx++) {
+            if (idx < mThumbs.size() && worldMatrix.mapRect(thumbRects.at(idx)).contains(event->pos())) {
+                if (mThumbs.at(idx)->isFromZip())
+                    emit changeFileSignal(idx - currentFileIdx);
+                else
+                    emit loadFileSignal(mThumbs.at(idx)->filePath() /*, event->modifiers() == Qt::ControlModifier*/);
+            }
+        }
+    } else
+        unsetCursor();
+}
+
+void DkFilePreview::wheelEvent(QWheelEvent *event)
+{
+    if (event->modifiers() == Qt::CTRL && windowPosition != pos_dock_hor && windowPosition != pos_dock_ver) {
+        int newSize = DkSettingsManager::param().display().thumbSize;
+        newSize += qRound(event->angleDelta().y() * 0.05f);
+
+        // make sure it is even
+        if (qRound(newSize * 0.5f) != newSize * 0.5f)
+            newSize++;
+
+        if (newSize < 8)
+            newSize = 8;
+        else if (newSize > max_thumb_size)
+            newSize = max_thumb_size;
+
+        if (newSize != DkSettingsManager::param().display().thumbSize) {
+            DkSettingsManager::param().display().thumbSize = newSize;
+            update();
+        }
+    } else {
+        int fc = (event->angleDelta().y() > 0) ? -1 : 1;
+
+        if (!DkSettingsManager::param().resources().waitForLastImg) {
+            currentFileIdx += fc;
+            scrollToCurrentImage = true;
+        }
+        emit changeFileSignal(fc);
+    }
+
+    // accept the event here - so it won't be propagated to the viewport
+    event->accept();
+}
+
+void DkFilePreview::leaveEvent(QEvent *)
+{
+    selected = -1;
+    if (!scrollToCurrentImage) {
+        moveImageTimer->stop();
+    }
+    update();
+}
+
+void DkFilePreview::contextMenuEvent(QContextMenuEvent *event)
+{
+    contextMenu->exec(event->globalPos());
+    event->accept();
+
+    DkFadeWidget::contextMenuEvent(event);
+}
+
+void DkFilePreview::newPosition()
+{
+    QAction *sender = static_cast<QAction *>(QObject::sender());
+
+    if (!sender)
+        return;
+
+    int pos = 0;
+    Qt::Orientation orient = Qt::Horizontal;
+
+    if (sender == contextMenuActions[cm_pos_west]) {
+        pos = pos_west;
+        orient = Qt::Vertical;
+    } else if (sender == contextMenuActions[cm_pos_east]) {
+        pos = pos_east;
+        orient = Qt::Vertical;
+    } else if (sender == contextMenuActions[cm_pos_north]) {
+        pos = pos_north;
+        orient = Qt::Horizontal;
+    } else if (sender == contextMenuActions[cm_pos_south]) {
+        pos = pos_south;
+        orient = Qt::Horizontal;
+    } else if (sender == contextMenuActions[cm_pos_dock_hor]) {
+        pos = pos_dock_hor;
+        orient = Qt::Horizontal;
+    }
+
+    // don't apply twice
+    if (windowPosition == pos || (pos == pos_dock_hor && windowPosition == pos_dock_ver))
+        return;
+
+    windowPosition = pos;
+    orientation = orient;
+    initOrientations();
+    emit positionChangeSignal(windowPosition);
+
+    hide();
+    show();
+
+    // emit showThumbsDockSignal(true);
+}
+
+void DkFilePreview::moveImages()
+{
+    if (!isVisible()) {
+        moveImageTimer->stop();
+        return;
+    }
+
+    int limit = orientation == Qt::Horizontal ? width() : height();
+    float center = orientation == Qt::Horizontal ? (float)newFileRect.center().x() : (float)newFileRect.center().y();
+
+    if (scrollToCurrentImage) {
+        float cDist = limit / 2.0f - center;
+
+        if (mThumbs.size() < 2000) {
+            if (fabs(cDist) < limit) {
+                currentDx = sqrt(fabs(cDist)) / 1.3f;
+                if (cDist < 0)
+                    currentDx *= -1.0f;
+            } else
+                currentDx = cDist / 4.0f;
+        }
+        // this is not too beautiful - but fast
+        else
+            currentDx = cDist / 2.0f;
+
+        if (fabs(currentDx) < 2)
+            currentDx = (currentDx < 0) ? -2.0f : 2.0f;
+
+        // end position
+        if (fabs(cDist) <= 2) {
+            currentDx = limit / 2.0f - center;
+            moveImageTimer->stop();
+            scrollToCurrentImage = false;
+        } else
+            isPainted = false;
+    }
 
-	loadSettings();
-	initOrientations();
+    float translation = orientation == Qt::Horizontal ? (float)worldMatrix.dx() : (float)worldMatrix.dy();
+    float bufferPos = orientation == Qt::Horizontal ? (float)bufferDim.right() : (float)bufferDim.bottom();
+
+    // do not scroll out of the thumbs
+    if ((translation >= limit * 0.5 && currentDx > 0) || (translation <= -(bufferPos - limit * 0.5 + xOffset) && currentDx < 0))
+        return;
+
+    // set the last step to match the center of the screen...	(nicer if user scrolls very fast)
+    if (translation < limit * 0.5 && currentDx > 0 && translation + currentDx > limit * 0.5 && currentDx > 0)
+        currentDx = limit * 0.5f - translation;
+    else if (translation > -(bufferPos - limit * 0.5 + xOffset) && translation + currentDx <= -(bufferPos - limit * 0.5 + xOffset) && currentDx < 0)
+        currentDx = -(bufferPos - limit * 0.5f + xOffset + (float)worldMatrix.dx());
+
+    // qDebug() << "currentDx: " << currentDx;
+    if (orientation == Qt::Horizontal)
+        worldMatrix.translate(currentDx, 0);
+    else
+        worldMatrix.translate(0, currentDx);
+    // qDebug() << "dx: " << worldMatrix.dx();
+    update();
+}
+
+void DkFilePreview::updateFileIdx(int idx)
+{
+    if (idx == currentFileIdx)
+        return;
+
+    currentFileIdx = idx;
+    if (currentFileIdx >= 0)
+        scrollToCurrentImage = true;
+    update();
+}
+
+void DkFilePreview::setFileInfo(QSharedPointer<DkImageContainerT> cImage)
+{
+    if (!cImage)
+        return;
+
+    int tIdx = -1;
+
+    for (int idx = 0; idx < mThumbs.size(); idx++) {
+        if (mThumbs.at(idx)->filePath() == cImage->filePath()) {
+            tIdx = idx;
+            break;
+        }
+    }
 
-	createContextMenu();
+    currentFileIdx = tIdx;
+    if (currentFileIdx >= 0)
+        scrollToCurrentImage = true;
+    update();
 }
 
-void DkFilePreview::init() {
-
-	setObjectName("DkFilePreview");
-	setMouseTracking(true);	//receive mouse event everytime
-	
-	//thumbsLoader = 0;
-
-	xOffset = qRound(DkSettingsManager::param().effectiveThumbSize(this)*0.1f);
-	yOffset = qRound(DkSettingsManager::param().effectiveThumbSize(this)*0.1f);
-
-	currentDx = 0;
-	currentFileIdx = -1;
-	oldFileIdx = -1;
-	mouseTrace = 0;
-	scrollToCurrentImage = false;
-	isPainted = false;
-
-	winPercent = 0.1f;
-	borderTrigger = (orientation == Qt::Horizontal) ? (float)width()*winPercent : (float)height()*winPercent;
-
-	worldMatrix = QTransform();
+void DkFilePreview::updateThumbs(QVector<QSharedPointer<DkImageContainerT>> thumbs)
+{
+    mThumbs = thumbs;
 
-	moveImageTimer = new QTimer(this);
-	moveImageTimer->setInterval(5);	// reduce cpu utilization
-	connect(moveImageTimer, SIGNAL(timeout()), this, SLOT(moveImages()));
-
-	int borderTriggerI = qRound(borderTrigger);
-	leftGradient = (orientation == Qt::Horizontal) ? QLinearGradient(QPoint(0, 0), QPoint(borderTriggerI, 0)) : QLinearGradient(QPoint(0, 0), QPoint(0, borderTriggerI));
-	rightGradient = (orientation == Qt::Horizontal) ? QLinearGradient(QPoint(width()-borderTriggerI, 0), QPoint(width(), 0)) : QLinearGradient(QPoint(0, height()-borderTriggerI), QPoint(0, height()));
-	leftGradient.setColorAt(1, Qt::white);
-	leftGradient.setColorAt(0, Qt::black);
-	rightGradient.setColorAt(1, Qt::black);
-	rightGradient.setColorAt(0, Qt::white);
-
-	minHeight = DkSettingsManager::param().effectiveThumbSize(this) + yOffset;
-	//resize(parent->width(), minHeight);
-	
-	selected = -1;
-
-	// wheel label
-	QPixmap wp = QPixmap(":/nomacs/img/thumbs-move.svg");
-	wheelButton = new QLabel(this);
-	wheelButton->setAttribute(Qt::WA_TransparentForMouseEvents);
-	wheelButton->setPixmap(wp);
-	wheelButton->hide();
-
-	QWidget* nomacs = DkUtils::getMainWindow();
-	connect(this, SIGNAL(showThumbsDockSignal(bool)), nomacs, SLOT(showThumbsDock(bool)));
-}
-
-void DkFilePreview::initOrientations() {
-
-	if (windowPosition == pos_north || windowPosition == pos_south || windowPosition == pos_dock_hor)
-		orientation = Qt::Horizontal;
-	else if (windowPosition == pos_east || windowPosition == pos_west || windowPosition == pos_dock_ver)
-		orientation = Qt::Vertical;
-
-	if (windowPosition == pos_dock_ver || windowPosition == pos_dock_hor)
-		minHeight = max_thumb_size;
-	else
-		minHeight = DkSettingsManager::param().effectiveThumbSize(this);
-
-	if (orientation == Qt::Horizontal) {
-
-		setMinimumSize(20, 20);
-		setMaximumSize(QWIDGETSIZE_MAX, minHeight);
-		setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
-		borderTrigger = (float)width()*winPercent;
-		int borderTriggerI = qRound(borderTrigger);
-		leftGradient = QLinearGradient(QPoint(0, 0), QPoint(borderTriggerI, 0));
-		rightGradient = QLinearGradient(QPoint(width()-borderTriggerI, 0), QPoint(width(), 0));
-	}
-	else {
-
-		setMinimumSize(20, 20);
-		setMaximumSize(minHeight, QWIDGETSIZE_MAX);
-		setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
-		borderTrigger = (float)height()*winPercent;
-		int borderTriggerI = qRound(borderTrigger);
-		leftGradient = QLinearGradient(QPoint(0, 0), QPoint(0, borderTriggerI));
-		rightGradient = QLinearGradient(QPoint(0, height()-borderTriggerI), QPoint(0, height()));
-	}
-
-	leftGradient.setColorAt(1, Qt::white);
-	leftGradient.setColorAt(0, Qt::black);
-	rightGradient.setColorAt(1, Qt::black);
-	rightGradient.setColorAt(0, Qt::white);
-
-	worldMatrix.reset();
-	currentDx = 0;
-	scrollToCurrentImage = true;
-	update();
-
-}
-
-void DkFilePreview::loadSettings() {
-
-	DefaultSettings settings;
-	settings.beginGroup(objectName());
-	windowPosition = settings.value("windowPosition", windowPosition).toInt();
-	settings.endGroup();
-
-}
-
-void DkFilePreview::saveSettings() {
-
-	DefaultSettings settings;
-	settings.beginGroup(objectName());
-	settings.setValue("windowPosition", windowPosition);
-	settings.endGroup();
-}
-
-void DkFilePreview::createContextMenu() {
-
-	contextMenuActions.resize(cm_end - 1);	// -1 because we just need to know of one dock widget
-
-	contextMenuActions[cm_pos_west] = new QAction(tr("Show Left"), this);
-	contextMenuActions[cm_pos_west]->setStatusTip(tr("Shows the Thumbnail Bar on the Left"));
-	connect(contextMenuActions[cm_pos_west], SIGNAL(triggered()), this, SLOT(newPosition()));
-
-	contextMenuActions[cm_pos_north] = new QAction(tr("Show Top"), this);
-	contextMenuActions[cm_pos_north]->setStatusTip(tr("Shows the Thumbnail Bar at the Top"));
-	connect(contextMenuActions[cm_pos_north], SIGNAL(triggered()), this, SLOT(newPosition()));
-
-	contextMenuActions[cm_pos_east] = new QAction(tr("Show Right"), this);
-	contextMenuActions[cm_pos_east]->setStatusTip(tr("Shows the Thumbnail Bar on the Right"));
-	connect(contextMenuActions[cm_pos_east], SIGNAL(triggered()), this, SLOT(newPosition()));
-
-	contextMenuActions[cm_pos_south] = new QAction(tr("Show Bottom"), this);
-	contextMenuActions[cm_pos_south]->setStatusTip(tr("Shows the Thumbnail Bar at the Bottom"));
-	connect(contextMenuActions[cm_pos_south], SIGNAL(triggered()), this, SLOT(newPosition()));
-
-	contextMenuActions[cm_pos_dock_hor] = new QAction(tr("Undock"), this);
-	contextMenuActions[cm_pos_dock_hor]->setStatusTip(tr("Undock the thumbnails"));
-	connect(contextMenuActions[cm_pos_dock_hor], SIGNAL(triggered()), this, SLOT(newPosition()));
-
-	contextMenu = new QMenu(tr("File Preview Menu"), this);
-	contextMenu->addActions(contextMenuActions.toList());
-}
-
-void DkFilePreview::paintEvent(QPaintEvent*) {
-
-	// render nothing if there are no thumbs
-	if (mThumbs.isEmpty())
-		return;
-
-	if (minHeight != DkSettingsManager::param().effectiveThumbSize(this) + yOffset && windowPosition != pos_dock_hor && windowPosition != pos_dock_ver) {
-
-		xOffset = qCeil(DkSettingsManager::param().effectiveThumbSize(this)*0.1f);
-		yOffset = qCeil(DkSettingsManager::param().effectiveThumbSize(this)*0.1f);
-
-		minHeight = DkSettingsManager::param().effectiveThumbSize(this) + yOffset;
-		
-		if (orientation == Qt::Horizontal)
-			setMaximumSize(QWIDGETSIZE_MAX, minHeight);
-		else
-			setMaximumSize(minHeight, QWIDGETSIZE_MAX);
-
-	}
-
-	QPainter painter(this);
-	painter.setBackground(DkSettingsManager::param().display().hudBgColor);
-
-	painter.setPen(Qt::NoPen);
-	painter.setBrush(DkSettingsManager::param().display().hudBgColor);
-	
-	if (windowPosition != pos_dock_hor && windowPosition != pos_dock_ver) {
-		QRect r = QRect(QPoint(), this->size());
-		painter.drawRect(r);
-	}
-
-	painter.setWorldTransform(worldMatrix);
-	painter.setWorldMatrixEnabled(true);
-
-	if (mThumbs.empty()) {
-		thumbRects.clear();
-		return;
-	}
-
-	painter.setRenderHint(QPainter::SmoothPixmapTransform);
-	drawThumbs(&painter);
-
-	if (currentFileIdx != oldFileIdx && currentFileIdx >= 0) {
-		oldFileIdx = currentFileIdx;
-		scrollToCurrentImage = true;
-		moveImageTimer->start();
-	}
-	isPainted = true;
-
-}
-
-void DkFilePreview::drawThumbs(QPainter* painter) {
-
-	//qDebug() << "drawing thumbs: " << worldMatrix.dx();
-
-	bufferDim = (orientation == Qt::Horizontal) ? QRectF(QPointF(0, yOffset/2), QSize(xOffset, 0)) : QRectF(QPointF(yOffset/2, 0), QSize(0, xOffset));
-	thumbRects.clear();
-
-	DkTimer dt;
-
-	// mouse over effect
-	QPoint p = worldMatrix.inverted().map(mapFromGlobal(QCursor::pos()));
-
-	for (int idx = 0; idx < mThumbs.size(); idx++) {
-
-		QSharedPointer<DkThumbNailT> thumb = mThumbs.at(idx)->getThumb();
-		QImage img;
-		
-		// if the image is loaded draw that (it might be edited)
-		if (mThumbs.at(idx)->hasImage()) {
-			img = mThumbs.at(idx)->imageScaledToHeight(DkSettingsManager::param().effectiveThumbSize(this));
-		}
-		else {
-
-			if (thumb->hasImage() == DkThumbNail::exists_not) {
-				thumbRects.push_back(QRectF());
-				continue;
-			}
-
-			if (thumb->hasImage() == DkThumbNail::loaded)
-				img = thumb->getImage();
-		}
-
-		//if (img.width() > max_thumb_size * DkSettingsManager::param().dpiScaleFactor())
-		//	qDebug() << thumb->getFilePath() << "size:" << img.size();
-
-		QPointF anchor = orientation == Qt::Horizontal ? bufferDim.topRight() : bufferDim.bottomLeft();
-		QRectF r = !img.isNull() ? QRectF(anchor, img.size()) : QRectF(anchor, QSize(DkSettingsManager::param().effectiveThumbSize(this), DkSettingsManager::param().effectiveThumbSize(this)));
-		if (orientation == Qt::Horizontal && height()-yOffset < r.height()*2)
-			r.setSize(QSizeF(qFloor(r.width()*(float)(height()-yOffset)/r.height()), height()-yOffset));
-		else if (orientation == Qt::Vertical && width()-yOffset < r.width()*2)
-			r.setSize(QSizeF(width()-yOffset, qFloor(r.height()*(float)(width()-yOffset)/r.width())));
-
-		// check if the size is still valid
-		if (r.width() < 1 || r.height() < 1) 
-			continue;	// this brings us in serious problems with the selection
-
-		// center vertically
-		if (orientation == Qt::Horizontal)
-			r.moveCenter(QPoint(qFloor(r.center().x()), height()/2));
-		else
-			r.moveCenter(QPoint(width()/2, qFloor(r.center().y())));
-
-		// update the buffer dim
-		if (orientation == Qt::Horizontal)
-			bufferDim.setRight(qFloor(bufferDim.right() + r.width()) + qCeil(xOffset/2.0f));
-		else
-			bufferDim.setBottom(qFloor(bufferDim.bottom() + r.height()) + qCeil(xOffset/2.0f));
-		thumbRects.push_back(r);
-
-		QRectF imgWorldRect = worldMatrix.mapRect(r);
-
-		// update file rect for move to current file timer
-		if (scrollToCurrentImage && idx == currentFileIdx)
-			newFileRect = imgWorldRect;
-
-		// is the current image within the canvas?
-		if ((orientation == Qt::Horizontal && imgWorldRect.right() < 0) ||
-			(orientation == Qt::Vertical && imgWorldRect.bottom() < 0)) {
-			continue;
-		}
-
-		if (((orientation == Qt::Horizontal && imgWorldRect.left() > width()) ||
-			(orientation == Qt::Vertical && imgWorldRect.top() > height())) && scrollToCurrentImage) {
-			continue;
-		}
-		else if ((orientation == Qt::Horizontal && imgWorldRect.left() > width()) ||
-			(orientation == Qt::Vertical && imgWorldRect.top() > height())) {
-			break;
-		}
-
-		// only fetch thumbs if we are not moving too fast...
-		if (thumb->hasImage() == DkThumbNail::not_loaded && fabs(currentDx) < 40) {
-			thumb->fetchThumb();
-			connect(thumb.data(), SIGNAL(thumbLoadedSignal()), this, SLOT(update()));
-		}
-
-		bool isLeftGradient = (orientation == Qt::Horizontal && worldMatrix.dx() < 0 && imgWorldRect.left() < leftGradient.finalStop().x()) ||
-			(orientation == Qt::Vertical && worldMatrix.dy() < 0 && imgWorldRect.top() < leftGradient.finalStop().y());
-		bool isRightGradient = (orientation == Qt::Horizontal && imgWorldRect.right() > rightGradient.start().x()) ||
-			(orientation == Qt::Vertical && imgWorldRect.bottom() > rightGradient.start().y());
-		// show that there are more images...
-		if (isLeftGradient && !img.isNull())
-			drawFadeOut(leftGradient, imgWorldRect, &img);
-		if (isRightGradient && !img.isNull())
-			drawFadeOut(rightGradient, imgWorldRect, &img);
-
-		if (!img.isNull())
-			painter->drawImage(r, img, QRect(QPoint(), img.size()));
-		else 
-			drawNoImgEffect(painter, r);
-				
-		if (idx == currentFileIdx)
-			drawCurrentImgEffect(painter, r);
-		else if (idx == selected && r.contains(p))
-			drawSelectedEffect(painter, r);
-
-		//painter->fillRect(QRect(0,0,200, 110), leftGradient);
-	}
-}
-
-void DkFilePreview::drawNoImgEffect(QPainter* painter, const QRectF& r) {
-
-	QBrush oldBrush = painter->brush();
-	QPen oldPen = painter->pen();
-
-	QPen noImgPen(DkSettingsManager::param().display().bgColor);
-	painter->setPen(noImgPen);
-	painter->setBrush(QColor(0,0,0,0));
-	painter->drawRect(r);
-	painter->setPen(oldPen);
-	painter->setBrush(oldBrush);
-}
-
-void DkFilePreview::drawSelectedEffect(QPainter* painter, const QRectF& r) {
-
-	QBrush oldBrush = painter->brush();
-	float oldOp = (float)painter->opacity();
-	
-	// drawing
-	painter->setOpacity(0.4);
-	painter->setBrush(DkSettingsManager::param().display().highlightColor);
-	painter->drawRect(r);
-	
-	// reset painter
-	painter->setOpacity(oldOp);
-	painter->setBrush(oldBrush);
-}
-
-void DkFilePreview::drawCurrentImgEffect(QPainter* painter, const QRectF& r) {
-
-	QPen oldPen = painter->pen();
-	QBrush oldBrush = painter->brush();
-	float oldOp = (float)painter->opacity();
-
-	// draw
-	QRectF cr = r;
-	cr.setSize(QSize((int)cr.width()+1, (int)cr.height()+1));
-	cr.moveCenter(cr.center() + QPointF(-1,-1));
-
-	QPen cPen(DkSettingsManager::param().display().highlightColor, 1);
-	painter->setBrush(QColor(0,0,0,0));
-	painter->setOpacity(1.0);
-	painter->setPen(cPen);
-	painter->drawRect(cr);
-
-	painter->setOpacity(0.5);
-	cr.setSize(QSize((int)cr.width()+2, (int)cr.height()+2));
-	cr.moveCenter(cr.center() + QPointF(-1,-1));
-	painter->drawRect(cr);
-
-	painter->setBrush(oldBrush);
-	painter->setOpacity(oldOp);
-	painter->setPen(oldPen);
-}
-
-void DkFilePreview::drawFadeOut(QLinearGradient gradient, QRectF imgRect, QImage *img) {
-
-	if (img && img->format() == QImage::Format_Indexed8)
-		return;
-
-	// compute current scaling
-	QPointF scale(img->width()/imgRect.width(), img->height()/imgRect.height());
-	QTransform wm;
-	wm.scale(scale.x(), scale.y());
-	
-	if (orientation == Qt::Horizontal)
-		wm.translate(-imgRect.left(), 0);
-	else
-		wm.translate(0, -imgRect.top());
-
-	QLinearGradient imgGradient = gradient;
-	
-	if (orientation == Qt::Horizontal) {
-		imgGradient.setStart(wm.map(gradient.start()).x(), 0);
-		imgGradient.setFinalStop(wm.map(gradient.finalStop()).x(), 0);
-	}
-	else {
-		imgGradient.setStart(0, wm.map(gradient.start()).y());
-		imgGradient.setFinalStop(0, wm.map(gradient.finalStop()).y());
-	}
-
-	QImage mask = *img;
-	QPainter painter(&mask);
-	painter.fillRect(img->rect(), Qt::black);
-	painter.fillRect(img->rect(), imgGradient);
-	painter.end();
-
-	img->setAlphaChannel(mask);
-}
-
-void DkFilePreview::resizeEvent(QResizeEvent *event) {
-
-	QWidget* pw = qobject_cast<QWidget*>(parent());
-
-	if (event->size() == event->oldSize() && 
-		((orientation == Qt::Horizontal && pw && this->width() == pw->width())  ||
-		(orientation == Qt::Vertical && pw && this->height() == pw->height()))) {
-			return;
-	}
-
-	if (currentFileIdx >= 0 && isVisible()) {
-		scrollToCurrentImage = true;
-		moveImageTimer->start();
-	}
-
-	// now update...
-	borderTrigger = (orientation == Qt::Horizontal) ? (float)width()*winPercent : (float)height()*winPercent;
-	int borderTriggerI = qRound(borderTrigger);
-	leftGradient.setFinalStop((orientation == Qt::Horizontal) ? QPoint(borderTriggerI, 0) : QPoint(0, borderTriggerI));
-	rightGradient.setStart((orientation == Qt::Horizontal) ? QPoint(width()-borderTriggerI, 0) : QPoint(0, height()-borderTriggerI));
-	rightGradient.setFinalStop((orientation == Qt::Horizontal) ?  QPoint(width(), 0) : QPoint(0, height()));
-
-	//update();
-	QWidget::resizeEvent(event);
-
-}
-
-void DkFilePreview::mouseMoveEvent(QMouseEvent *event) {
-
-	if (lastMousePos.isNull()) {
-		lastMousePos = event->pos();
-		QWidget::mouseMoveEvent(event);
-		return;
-	}
-
-	if (mouseTrace < 21) {
-		mouseTrace += qRound(fabs(QPointF(lastMousePos - event->pos()).manhattanLength()));
-		return;
-	}
-
-	float eventPos = orientation == Qt::Horizontal ? (float)event->pos().x() : (float)event->pos().y();
-	float lastMousePosC = orientation == Qt::Horizontal ? (float)lastMousePos.x() : (float)lastMousePos.y();
-	int limit = orientation == Qt::Horizontal ? width() : height();
-
-	if (event->buttons() == Qt::MiddleButton) {
-
-		float enterPosC = orientation == Qt::Horizontal ? (float)enterPos.x() : (float)enterPos.y();
-		float dx = std::fabs((float)(enterPosC - eventPos))*0.015f;
-		dx = std::exp(dx);
-
-		if (enterPosC - eventPos < 0)
-			dx = -dx;
-
-		currentDx = dx;	// update dx
-		return;
-	}
-
-	int mouseDir = qRound(eventPos - lastMousePosC);
-
-	if (event->buttons() == Qt::LeftButton) {
-		currentDx = (float)mouseDir;
-		lastMousePos = event->pos();
-		selected = -1;
-		setCursor(Qt::ClosedHandCursor);
-		scrollToCurrentImage = false;
-		moveImages();
-		return;
-	}
-
-	if (cursor().shape() != Qt::ArrowCursor)
-		setCursor(Qt::ArrowCursor);
-
-	int ndx = limit - qRound(eventPos);
-	int pdx = qRound(eventPos);
-
-	bool left = pdx < ndx;
-	float dx = (left) ? (float)pdx : (float)ndx;
-
-	if (dx < borderTrigger && ((mouseDir < 0 && left) || (mouseDir > 0 && !left))) {
-		dx = std::exp((borderTrigger - dx)/borderTrigger*3);
-		currentDx = (left) ? dx : -dx;
-
-		scrollToCurrentImage = false;
-		moveImageTimer->start();
-	}
-	else if (dx > borderTrigger && !scrollToCurrentImage)
-		moveImageTimer->stop();
-
-	// select the current thumbnail
-	if (dx > borderTrigger*0.5) {
-
-		int oldSelection = selected;
-		selected = -1;
-
-		// find out where the mouse is
-		for (int idx = 0; idx < thumbRects.size(); idx++) {
-
-			if (worldMatrix.mapRect(thumbRects.at(idx)).contains(event->pos())) {
-				selected = idx;
-
-				if (selected <= mThumbs.size() && selected >= 0) {
-					QSharedPointer<DkThumbNailT> thumb = mThumbs.at(selected)->getThumb();
-					//selectedImg = DkImage::colorizePixmap(QPixmap::fromImage(thumb->getImage()), DkSettingsManager::param().display().highlightColor, 0.3f);
-
-					// important: setText shows the label - if you then hide it here again you'll get a stack overflow
-					//if (fileLabel->height() < height())
-					//	fileLabel->setText(thumbs.at(selected).getFile().fileName(), -1);
-					QFileInfo fileInfo(thumb->getFilePath());
-					QString toolTipInfo = tr("Name: ") + fileInfo.fileName() + 
-						"\n" + tr("Size: ") + DkUtils::readableByte((float)fileInfo.size()) + 
-						"\n" + tr("Created: ") + fileInfo.created().toString(Qt::SystemLocaleDate);
-					setToolTip(toolTipInfo);
-					setStatusTip(fileInfo.fileName());
-				}
-				break;
-			}
-		}
-
-		if (selected != -1 || selected != oldSelection)
-			update();
-		//else if (selected == -1)
-		//	fileLabel->hide();
-	}
-	else
-		selected = -1;
-
-	if (selected == -1)
-		setToolTip(tr("CTRL+Zoom resizes the thumbnails"));
-
-
-	lastMousePos = event->pos();
-
-	//QWidget::mouseMoveEvent(event);
-}
-
-void DkFilePreview::mousePressEvent(QMouseEvent *event) {
-
-	if (event->buttons() == Qt::LeftButton) {
-		mouseTrace = 0;
-	}
-	else if (event->buttons() == Qt::MiddleButton) {
-
-		enterPos = event->pos();
-		qDebug() << "stop scrolling (middle button)";
-		scrollToCurrentImage = false;
-		moveImageTimer->start();
-
-		// show icon
-		wheelButton->move(event->pos().x()-16, event->pos().y()-16);
-		wheelButton->show();
-	}
-
-}
-
-void DkFilePreview::mouseReleaseEvent(QMouseEvent *event) {
-
-	currentDx = 0;
-	moveImageTimer->stop();
-	wheelButton->hide();
-
-	if (mouseTrace < 20) {
-
-		// find out where the mouse did click
-		for (int idx = 0; idx < thumbRects.size(); idx++) {
-
-			if (idx < mThumbs.size() && worldMatrix.mapRect(thumbRects.at(idx)).contains(event->pos())) {
-				if (mThumbs.at(idx)->isFromZip()) 
-					emit changeFileSignal(idx - currentFileIdx);
-				else 
-					emit loadFileSignal(mThumbs.at(idx)->filePath()/*, event->modifiers() == Qt::ControlModifier*/);
-			}
-		}
-	}
-	else
-		unsetCursor();
-
-}
-
-void DkFilePreview::wheelEvent(QWheelEvent *event) {
-
-	if (event->modifiers() == Qt::CTRL && windowPosition != pos_dock_hor && windowPosition != pos_dock_ver) {
-
-		int newSize = DkSettingsManager::param().display().thumbSize;
-		newSize += qRound(event->delta()*0.05f);
-
-		// make sure it is even
-		if (qRound(newSize*0.5f) != newSize*0.5f)
-			newSize++;
-
-		if (newSize < 8)
-			newSize = 8;
-		else if (newSize > max_thumb_size)
-			newSize = max_thumb_size;
-
-		if (newSize != DkSettingsManager::param().display().thumbSize) {
-			DkSettingsManager::param().display().thumbSize = newSize;
-			update();
-		}
-	}
-	else {
-		
-		int fc = (event->delta() > 0) ? -1 : 1;
-		
-		if (!DkSettingsManager::param().resources().waitForLastImg) {
-			currentFileIdx += fc;
-			scrollToCurrentImage = true;
-		}
-		emit changeFileSignal(fc);
-	}
-
-	// accept the event here - so it won't be propagated to the viewport
-	event->accept();
-}
-
-void DkFilePreview::leaveEvent(QEvent*) {
-
-	selected = -1;
-	if (!scrollToCurrentImage) {
-		moveImageTimer->stop();
-	}
-	update();
-}
-
-void DkFilePreview::contextMenuEvent(QContextMenuEvent *event) {
-
-	contextMenu->exec(event->globalPos());
-	event->accept();
-
-	DkFadeWidget::contextMenuEvent(event);
-}
-
-void DkFilePreview::newPosition() {
-
-	QAction* sender = static_cast<QAction*>(QObject::sender());
-
-	if (!sender)
-		return;
-
-	int pos = 0;
-	Qt::Orientation orient = Qt::Horizontal;
-
-	if (sender == contextMenuActions[cm_pos_west]) {
-		pos = pos_west;
-		orient = Qt::Vertical;
-	}
-	else if (sender == contextMenuActions[cm_pos_east]) {
-		pos = pos_east;
-		orient = Qt::Vertical;
-	}
-	else if (sender == contextMenuActions[cm_pos_north]) {
-		pos = pos_north;
-		orient = Qt::Horizontal;
-	}
-	else if (sender == contextMenuActions[cm_pos_south]) {
-		pos = pos_south;
-		orient = Qt::Horizontal;
-	}
-	else if (sender == contextMenuActions[cm_pos_dock_hor]) {
-		pos = pos_dock_hor;
-		orient = Qt::Horizontal;
-	}
-
-	// don't apply twice
-	if (windowPosition == pos || (pos == pos_dock_hor && windowPosition == pos_dock_ver))
-		return;
-
-	windowPosition = pos;
-	orientation = orient;
-	initOrientations();
-	emit positionChangeSignal(windowPosition);
-
-	hide();
-	show();
-
-	//emit showThumbsDockSignal(true);
-}
-
-void DkFilePreview::moveImages() {
-
-	if (!isVisible()) {
-		moveImageTimer->stop();
-		return;
-	}
-
-	int limit = orientation == Qt::Horizontal ? width() : height();
-	float center = orientation == Qt::Horizontal ? (float)newFileRect.center().x() : (float)newFileRect.center().y();
-
-	if (scrollToCurrentImage) {
-		float cDist = limit/2.0f - center;
-
-		if (mThumbs.size() < 2000) {
-			if (fabs(cDist) < limit) {
-				currentDx = sqrt(fabs(cDist)) / 1.3f;
-				if (cDist < 0) currentDx *= -1.0f;
-			}
-			else
-				currentDx = cDist / 4.0f;
-		}
-		// this is not too beautiful - but fast
-		else
-			currentDx = cDist/2.0f;
-
-		if (fabs(currentDx) < 2)
-			currentDx = (currentDx < 0) ? -2.0f : 2.0f;
-
-		// end position
-		if (fabs(cDist) <= 2) {
-			currentDx = limit/2.0f-center;
-			moveImageTimer->stop();
-			scrollToCurrentImage = false;
-		}
-		else
-			isPainted = false;
-	}
-
-	float translation	= orientation == Qt::Horizontal ? (float)worldMatrix.dx() : (float)worldMatrix.dy();
-	float bufferPos		= orientation == Qt::Horizontal ? (float)bufferDim.right() : (float)bufferDim.bottom();
-
-	// do not scroll out of the thumbs
-	if ((translation >= limit*0.5 && currentDx > 0) || (translation <= -(bufferPos-limit*0.5+xOffset) && currentDx < 0))
-		return;
-
-	// set the last step to match the center of the screen...	(nicer if user scrolls very fast)
-	if (translation < limit*0.5 && currentDx > 0 && translation+currentDx > limit*0.5 && currentDx > 0)
-		currentDx = limit*0.5f-translation;
-	else if (translation > -(bufferPos-limit*0.5+xOffset) && translation+currentDx <= -(bufferPos-limit*0.5+xOffset) && currentDx < 0)
-		currentDx = -(bufferPos-limit*0.5f+xOffset+(float)worldMatrix.dx());
-
-	//qDebug() << "currentDx: " << currentDx;
-	if (orientation == Qt::Horizontal)
-		worldMatrix.translate(currentDx, 0);
-	else
-		worldMatrix.translate(0, currentDx);
-	//qDebug() << "dx: " << worldMatrix.dx();
-	update();
-}
-
-void DkFilePreview::updateFileIdx(int idx) {
-
-	if (idx == currentFileIdx)
-		return;
-
-	currentFileIdx = idx;
-	if (currentFileIdx >= 0)
-		scrollToCurrentImage = true;
-	update();
-}
-
-void DkFilePreview::setFileInfo(QSharedPointer<DkImageContainerT> cImage) {
-
-	if (!cImage)
-		return;
-
-	int tIdx = -1;
-
-	for (int idx = 0; idx < mThumbs.size(); idx++) {
-		if (mThumbs.at(idx)->filePath() == cImage->filePath()) {
-			tIdx = idx;
-			break;
-		}
-	}
-
-	currentFileIdx = tIdx;
-	if (currentFileIdx >= 0)
-		scrollToCurrentImage = true;
-	update();
-
-}
-
-void DkFilePreview::updateThumbs(QVector<QSharedPointer<DkImageContainerT> > thumbs) {
-
-	mThumbs = thumbs;
-
-	for (int idx = 0; idx < thumbs.size(); idx++) {
-		if (thumbs.at(idx)->isSelected()) {
-			currentFileIdx = idx;
-			break;
-		}
-	}
-
-	update();
-}
-
-void DkFilePreview::setVisible(bool visible, bool saveSettings) {
-
-	emit showThumbsDockSignal(visible);
-
-	DkFadeWidget::setVisible(visible, saveSettings);
+    for (int idx = 0; idx < thumbs.size(); idx++) {
+        if (thumbs.at(idx)->isSelected()) {
+            currentFileIdx = idx;
+            break;
+        }
+    }
+
+    update();
+}
+
+void DkFilePreview::setVisible(bool visible, bool saveSettings)
+{
+    emit showThumbsDockSignal(visible);
+
+    DkFadeWidget::setVisible(visible, saveSettings);
 }
 
 // DkThumbLabel --------------------------------------------------------------------
-DkThumbLabel::DkThumbLabel(QSharedPointer<DkThumbNailT> thumb, QGraphicsItem* parent) : QGraphicsObject(parent), mText(this) {
-
-	mThumbInitialized = false;
-	mFetchingThumb = false;
-	mIsHovered = false;
+DkThumbLabel::DkThumbLabel(QSharedPointer<DkThumbNailT> thumb, QGraphicsItem *parent)
+    : QGraphicsObject(parent)
+    , mText(this)
+{
+    mThumbInitialized = false;
+    mFetchingThumb = false;
+    mIsHovered = false;
 
-	setThumb(thumb);
-	setFlag(ItemIsSelectable, true);
+    setThumb(thumb);
+    setFlag(ItemIsSelectable, true);
 
-#if QT_VERSION < 0x050000
-	setAcceptsHoverEvents(true);
-#else
-	setAcceptHoverEvents(true);
-#endif
+    setAcceptHoverEvents(true);
 }
 
-DkThumbLabel::~DkThumbLabel() {}
-
-void DkThumbLabel::setThumb(QSharedPointer<DkThumbNailT> thumb) {
+DkThumbLabel::~DkThumbLabel()
+{
+}
 
-	this->mThumb = thumb;
+void DkThumbLabel::setThumb(QSharedPointer<DkThumbNailT> thumb)
+{
+    this->mThumb = thumb;
 
-	if (thumb.isNull())
-		return;
+    if (thumb.isNull())
+        return;
 
-	connect(thumb.data(), SIGNAL(thumbLoadedSignal()), this, SLOT(updateLabel()));
-	QFileInfo fileInfo(thumb->getFilePath());
-	QString toolTipInfo = tr("Name: ") + fileInfo.fileName() + 
-		"\n" + tr("Size: ") + DkUtils::readableByte((float)fileInfo.size()) + 
-		"\n" + tr("Created: ") + fileInfo.created().toString(Qt::SystemLocaleDate);
+    connect(thumb.data(), SIGNAL(thumbLoadedSignal()), this, SLOT(updateLabel()));
+    QFileInfo fileInfo(thumb->getFilePath());
+    QString toolTipInfo = tr("Name: ") + fileInfo.fileName() + "\n" + tr("Size: ") + DkUtils::readableByte((float)fileInfo.size()) + "\n" + tr("Created: ")
+        + fileInfo.birthTime().toString(Qt::SystemLocaleDate);
 
-	setToolTip(toolTipInfo);
+    setToolTip(toolTipInfo);
 
-	// style dummy
-	mNoImagePen.setColor(QColor(150,150,150));
-	mNoImageBrush = QColor(100,100,100,50);
+    // style dummy
+    mNoImagePen.setColor(QColor(150, 150, 150));
+    mNoImageBrush = QColor(100, 100, 100, 50);
 
-	QColor col = DkSettingsManager::param().display().highlightColor;
-	col.setAlpha(90);
-	mSelectBrush = col;
-	mSelectPen.setColor(DkSettingsManager::param().display().highlightColor);
+    QColor col = DkSettingsManager::param().display().highlightColor;
+    col.setAlpha(90);
+    mSelectBrush = col;
+    mSelectPen.setColor(DkSettingsManager::param().display().highlightColor);
 }
 
-QPixmap DkThumbLabel::pixmap() const {
-
-	return mIcon.pixmap();
+QPixmap DkThumbLabel::pixmap() const
+{
+    return mIcon.pixmap();
 }
 
-void DkThumbLabel::cancelLoading() {
-	
-	mFetchingThumb = false;
+void DkThumbLabel::cancelLoading()
+{
+    mFetchingThumb = false;
 }
 
-QRectF DkThumbLabel::boundingRect() const {
-
+QRectF DkThumbLabel::boundingRect() const
+{
     int sz = DkSettingsManager::param().effectiveThumbPreviewSize();
-	return QRectF(QPoint(0,0), QSize(sz, sz));
+    return QRectF(QPoint(0, 0), QSize(sz, sz));
 }
 
-QPainterPath DkThumbLabel::shape() const {
-
-	QPainterPath path;
+QPainterPath DkThumbLabel::shape() const
+{
+    QPainterPath path;
 
-	path.addRect(boundingRect());
-	return path;
+    path.addRect(boundingRect());
+    return path;
 }
 
-void DkThumbLabel::updateLabel() {
-
-	if (mThumb.isNull())
-		return;
-
-	QPixmap pm;
+void DkThumbLabel::updateLabel()
+{
+    if (mThumb.isNull())
+        return;
 
-	if (!mThumb->getImage().isNull()) {
+    QPixmap pm;
 
-		pm = QPixmap::fromImage(mThumb->getImage());
+    if (!mThumb->getImage().isNull()) {
+        pm = QPixmap::fromImage(mThumb->getImage());
 
-		if (DkSettingsManager::param().display().displaySquaredThumbs) {
+        if (DkSettingsManager::param().display().displaySquaredThumbs) {
+            pm = DkImage::makeSquare(pm);
+        }
+    } else
+        qDebug() << "update called on empty thumb label!";
 
-			pm = DkImage::makeSquare(pm);
-		}
-	}
-	else
-		qDebug() << "update called on empty thumb label!";
+    if (!pm.isNull()) {
+        mIcon.setTransformationMode(Qt::SmoothTransformation);
+        mIcon.setPixmap(pm);
+        mIcon.setFlag(ItemIsSelectable, true);
+    }
+    if (pm.isNull())
+        setFlag(ItemIsSelectable, false); // if we cannot load it -> disable selection
 
-	if (!pm.isNull()) {
-		mIcon.setTransformationMode(Qt::SmoothTransformation);
-		mIcon.setPixmap(pm);
-		mIcon.setFlag(ItemIsSelectable, true);
-	}
-	if (pm.isNull())
-		setFlag(ItemIsSelectable, false);	// if we cannot load it -> disable selection
+    // update label
+    mText.setPos(0, pm.height());
+    mText.setDefaultTextColor(QColor(255, 255, 255));
 
-	// update label
-	mText.setPos(0, pm.height());
-	mText.setDefaultTextColor(QColor(255,255,255));
-	
-	QFont font;
-	font.setBold(false);
-	font.setPointSize(8);
-	mText.setFont(font);
-	mText.setPlainText(QFileInfo(mThumb->getFilePath()).fileName());
-	mText.hide();
+    QFont font;
+    font.setBold(false);
+    font.setPointSize(8);
+    mText.setFont(font);
+    mText.setPlainText(QFileInfo(mThumb->getFilePath()).fileName());
+    mText.hide();
 
-	prepareGeometryChange();
-	updateSize();
+    prepareGeometryChange();
+    updateSize();
 }
 
-void DkThumbLabel::updateSize() {
-
-	if (mIcon.pixmap().isNull())
-		return;
-
-	prepareGeometryChange();
-
-	// resize pixmap label
-	int maxSize = qMax(mIcon.pixmap().width(), mIcon.pixmap().height());
-	int ps = DkSettingsManager::param().effectiveThumbPreviewSize();
-
-	if ((float)ps/maxSize != mIcon.scale()) {
-		mIcon.setScale(1.0f);
-		mIcon.setPos(0,0);
-
-		mIcon.setScale((float)ps/maxSize);
-		mIcon.moveBy((ps-mIcon.pixmap().width()*mIcon.scale())*0.5f, (ps-mIcon.pixmap().height()*mIcon.scale())*0.5);
-	}
-
-	//update();
-}	
-
-void DkThumbLabel::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) {
-
-	if (mThumb.isNull())
-		return;
-
-	emit loadFileSignal(mThumb->getFilePath(), event->modifiers() == Qt::ControlModifier);
-}
-
-void DkThumbLabel::hoverEnterEvent(QGraphicsSceneHoverEvent*) {
-
-	mIsHovered = true;
-	emit showFileSignal(mThumb->getFilePath());
-	update();
-}
-
-void DkThumbLabel::hoverLeaveEvent(QGraphicsSceneHoverEvent*) {
-
-	mIsHovered = false;
-	emit showFileSignal();
-	update();
-}
-
-void DkThumbLabel::setVisible(bool visible) {
-
-	mIcon.setVisible(visible);
-	mText.setVisible(visible);
-}
-
-void DkThumbLabel::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) {
-	
-	if (!mFetchingThumb && mThumb->hasImage() == DkThumbNail::not_loaded) {
-			mThumb->fetchThumb();
-			mFetchingThumb = true;
-	}
-	else if (!mThumbInitialized && (mThumb->hasImage() == DkThumbNail::loaded || mThumb->hasImage() == DkThumbNail::exists_not)) {
-		updateLabel();
-		mThumbInitialized = true;
-		return;		// exit - otherwise we get paint errors
-	}
-
-	if (mIcon.pixmap().isNull() && mThumb->hasImage() == DkThumbNail::exists_not) {
-		painter->setPen(mNoImagePen);
-		painter->setBrush(mNoImageBrush);
-		painter->drawRect(boundingRect());
-	}
-	else if (mIcon.pixmap().isNull()) {
-		QColor c = DkSettingsManager::param().display().highlightColor;
-		c.setAlpha(30);
-		painter->setPen(mNoImagePen);
-		painter->setBrush(c);
-
-		QRectF r = boundingRect();
-		painter->drawRect(r);
-	}
-
-	// this is the Qt idea of how to fix the dashed border:
-	// http://www.qtcentre.org/threads/23087-How-to-hide-the-dashed-frame-outside-the-QGraphicsItem
-	// I don't think it's beautiful...
-	QStyleOptionGraphicsItem noSelOption;
-	if (option) {
-		noSelOption = *option;
-		noSelOption.state &= ~QStyle::State_Selected;
-	}
-
-	//painter->setRenderHints(QPainter::SmoothPixmapTransform | QPainter::Antialiasing);
-
-	QTransform mt = painter->worldTransform();
-	QTransform it = mt;
-	it.translate(mIcon.pos().x(), mIcon.pos().y());
-	it.scale(mIcon.scale(), mIcon.scale());
-
-	painter->setTransform(it);
-	mIcon.paint(painter, &noSelOption, widget);
-	painter->setTransform(mt);
-
-	// draw text
-	if (boundingRect().width() > 50 && DkSettingsManager::param().display().showThumbLabel) {
-		
-		QTransform tt = mt;
-		tt.translate(0, boundingRect().height()-mText.boundingRect().height());
-
-		QRectF r = mText.boundingRect();
-		r.setWidth(boundingRect().width());
-		painter->setPen(Qt::NoPen);
-		painter->setWorldTransform(tt);
-		painter->setBrush(DkSettingsManager::param().display().hudBgColor);
-		painter->drawRect(r);
-		mText.paint(painter, &noSelOption, widget);
-		painter->setWorldTransform(mt);
-	}
-
-	// render hovered
-	if (mIsHovered) {
-		painter->setBrush(QColor(255,255,255,60));
-		painter->setPen(mNoImagePen);
-		//painter->setPen(Qt::NoPen);
-		painter->drawRect(boundingRect());
-	}
-
-	// render selected
-	if (isSelected()) {
-		painter->setBrush(mSelectBrush);
-		painter->setPen(mSelectPen);
-		painter->drawRect(boundingRect());
-	}
+void DkThumbLabel::updateSize()
+{
+    if (mIcon.pixmap().isNull())
+        return;
 
+    prepareGeometryChange();
+
+    // resize pixmap label
+    int maxSize = qMax(mIcon.pixmap().width(), mIcon.pixmap().height());
+    int ps = DkSettingsManager::param().effectiveThumbPreviewSize();
+
+    if ((float)ps / maxSize != mIcon.scale()) {
+        mIcon.setScale(1.0f);
+        mIcon.setPos(0, 0);
+
+        mIcon.setScale((float)ps / maxSize);
+        mIcon.moveBy((ps - mIcon.pixmap().width() * mIcon.scale()) * 0.5f, (ps - mIcon.pixmap().height() * mIcon.scale()) * 0.5);
+    }
+
+    // update();
+}
+
+void DkThumbLabel::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
+{
+    if (mThumb.isNull())
+        return;
+
+    emit loadFileSignal(mThumb->getFilePath(), event->modifiers() == Qt::ControlModifier);
+}
+
+void DkThumbLabel::hoverEnterEvent(QGraphicsSceneHoverEvent *)
+{
+    mIsHovered = true;
+    emit showFileSignal(mThumb->getFilePath());
+    update();
+}
+
+void DkThumbLabel::hoverLeaveEvent(QGraphicsSceneHoverEvent *)
+{
+    mIsHovered = false;
+    emit showFileSignal();
+    update();
+}
+
+void DkThumbLabel::setVisible(bool visible)
+{
+    mIcon.setVisible(visible);
+    mText.setVisible(visible);
+}
+
+void DkThumbLabel::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+{
+    if (!mFetchingThumb && mThumb->hasImage() == DkThumbNail::not_loaded) {
+        mThumb->fetchThumb();
+        mFetchingThumb = true;
+    } else if (!mThumbInitialized && (mThumb->hasImage() == DkThumbNail::loaded || mThumb->hasImage() == DkThumbNail::exists_not)) {
+        updateLabel();
+        mThumbInitialized = true;
+        return; // exit - otherwise we get paint errors
+    }
+
+    if (mIcon.pixmap().isNull() && mThumb->hasImage() == DkThumbNail::exists_not) {
+        painter->setPen(mNoImagePen);
+        painter->setBrush(mNoImageBrush);
+        painter->drawRect(boundingRect());
+    } else if (mIcon.pixmap().isNull()) {
+        QColor c = DkSettingsManager::param().display().highlightColor;
+        c.setAlpha(30);
+        painter->setPen(mNoImagePen);
+        painter->setBrush(c);
+
+        QRectF r = boundingRect();
+        painter->drawRect(r);
+    }
+
+    // this is the Qt idea of how to fix the dashed border:
+    // http://www.qtcentre.org/threads/23087-How-to-hide-the-dashed-frame-outside-the-QGraphicsItem
+    // I don't think it's beautiful...
+    QStyleOptionGraphicsItem noSelOption;
+    if (option) {
+        noSelOption = *option;
+        noSelOption.state &= ~QStyle::State_Selected;
+    }
+
+    // painter->setRenderHints(QPainter::SmoothPixmapTransform | QPainter::Antialiasing);
+
+    QTransform mt = painter->worldTransform();
+    QTransform it = mt;
+    it.translate(mIcon.pos().x(), mIcon.pos().y());
+    it.scale(mIcon.scale(), mIcon.scale());
+
+    painter->setTransform(it);
+    mIcon.paint(painter, &noSelOption, widget);
+    painter->setTransform(mt);
+
+    // draw text
+    if (boundingRect().width() > 50 && DkSettingsManager::param().display().showThumbLabel) {
+        QTransform tt = mt;
+        tt.translate(0, boundingRect().height() - mText.boundingRect().height());
+
+        QRectF r = mText.boundingRect();
+        r.setWidth(boundingRect().width());
+        painter->setPen(Qt::NoPen);
+        painter->setWorldTransform(tt);
+        painter->setBrush(DkSettingsManager::param().display().hudBgColor);
+        painter->drawRect(r);
+        mText.paint(painter, &noSelOption, widget);
+        painter->setWorldTransform(mt);
+    }
+
+    // render hovered
+    if (mIsHovered) {
+        painter->setBrush(QColor(255, 255, 255, 60));
+        painter->setPen(mNoImagePen);
+        // painter->setPen(Qt::NoPen);
+        painter->drawRect(boundingRect());
+    }
+
+    // render selected
+    if (isSelected()) {
+        painter->setBrush(mSelectBrush);
+        painter->setPen(mSelectPen);
+        painter->drawRect(boundingRect());
+    }
 }
 
 // DkThumbWidget --------------------------------------------------------------------
-DkThumbScene::DkThumbScene(QWidget* parent /* = 0 */) : QGraphicsScene(parent) {
-
-	setObjectName("DkThumbWidget");
-
+DkThumbScene::DkThumbScene(QWidget *parent /* = 0 */)
+    : QGraphicsScene(parent)
+{
+    setObjectName("DkThumbWidget");
 }
 
-void DkThumbScene::updateLayout() {
+void DkThumbScene::updateLayout()
+{
+    if (mThumbLabels.empty())
+        return;
 
-	if (mThumbLabels.empty())
-		return;
+    QSize pSize;
 
-	QSize pSize;
-
-	if (!views().empty())
-		pSize = QSize(views().first()->viewport()->size());
+    if (!views().empty())
+        pSize = QSize(views().first()->viewport()->size());
 
     int psz = DkSettingsManager::param().effectiveThumbPreviewSize();
-	mXOffset = 2;// qCeil(psz*0.1f);
-	mNumCols = qMax(qFloor(((float)pSize.width()-mXOffset)/(psz + mXOffset)), 1);
-	mNumCols = qMin(mThumbLabels.size(), mNumCols);
-	mNumRows = qCeil((float)mThumbLabels.size()/mNumCols);
-
-	int tso = psz+mXOffset;
-	setSceneRect(0, 0, mNumCols*tso+mXOffset, mNumRows*tso+mXOffset);
-
-	DkTimer dt;
-	int cYOffset = mXOffset;
+    mXOffset = 2; // qCeil(psz*0.1f);
+    mNumCols = qMax(qFloor(((float)pSize.width() - mXOffset) / (psz + mXOffset)), 1);
+    mNumCols = qMin(mThumbLabels.size(), mNumCols);
+    mNumRows = qCeil((float)mThumbLabels.size() / mNumCols);
 
-	for (int rIdx = 0; rIdx < mNumRows; rIdx++) {
+    int tso = psz + mXOffset;
+    setSceneRect(0, 0, mNumCols * tso + mXOffset, mNumRows * tso + mXOffset);
 
-		int cXOffset = mXOffset;
+    DkTimer dt;
+    int cYOffset = mXOffset;
 
-		for (int cIdx = 0; cIdx < mNumCols; cIdx++) {
+    for (int rIdx = 0; rIdx < mNumRows; rIdx++) {
+        int cXOffset = mXOffset;
 
-			int tIdx = rIdx*mNumCols+cIdx;
+        for (int cIdx = 0; cIdx < mNumCols; cIdx++) {
+            int tIdx = rIdx * mNumCols + cIdx;
 
-			if (tIdx < 0 || tIdx >= mThumbLabels.size())
-				break;
+            if (tIdx < 0 || tIdx >= mThumbLabels.size())
+                break;
 
-			DkThumbLabel* cLabel = mThumbLabels.at(tIdx);
-			cLabel->setPos(cXOffset, cYOffset);
-			cLabel->updateSize();
+            DkThumbLabel *cLabel = mThumbLabels.at(tIdx);
+            cLabel->setPos(cXOffset, cYOffset);
+            cLabel->updateSize();
+
+            cXOffset += psz + mXOffset;
+        }
+
+        // update ypos
+        cYOffset += psz + mXOffset; // 20 for label
+    }
 
-			cXOffset += psz + mXOffset;
-		}
-
-		// update ypos
-		cYOffset += psz + mXOffset;	// 20 for label 
-	}
-
-	for (int idx = 0; idx < mThumbLabels.size(); idx++) {
-
-		if (mThumbLabels.at(idx)->isSelected())
-			mThumbLabels.at(idx)->ensureVisible();
-	}
-
-	mFirstLayout = false;
+    for (int idx = 0; idx < mThumbLabels.size(); idx++) {
+        if (mThumbLabels.at(idx)->isSelected())
+            mThumbLabels.at(idx)->ensureVisible();
+    }
+
+    mFirstLayout = false;
 }
 
-void DkThumbScene::updateThumbs(QVector<QSharedPointer<DkImageContainerT> > thumbs) {
-
-	this->mThumbs = thumbs;
-	updateThumbLabels();
-}
+void DkThumbScene::updateThumbs(QVector<QSharedPointer<DkImageContainerT>> thumbs)
+{
+    this->mThumbs = thumbs;
+    updateThumbLabels();
+}
+
+void DkThumbScene::updateThumbLabels()
+{
+    blockSignals(true); // do not emit selection changed while clearing!
+    clear(); // deletes the thumbLabels
+    blockSignals(false);
 
-void DkThumbScene::updateThumbLabels() {
+    mThumbLabels.clear();
 
-	blockSignals(true);	// do not emit selection changed while clearing!
-	clear();	// deletes the thumbLabels
-	blockSignals(false);
+    for (int idx = 0; idx < mThumbs.size(); idx++) {
+        DkThumbLabel *thumb = new DkThumbLabel(mThumbs.at(idx)->getThumb());
+        connect(thumb, SIGNAL(loadFileSignal(const QString &, bool)), this, SIGNAL(loadFileSignal(const QString &, bool)));
+        connect(thumb, SIGNAL(showFileSignal(const QString &)), this, SLOT(showFile(const QString &)));
+        connect(mThumbs.at(idx).data(), SIGNAL(thumbLoadedSignal()), this, SIGNAL(thumbLoadedSignal()));
 
-	mThumbLabels.clear();
+        // thumb->show();
+        addItem(thumb);
+        mThumbLabels.append(thumb);
+        // thumbsNotLoaded.append(thumb);
+    }
 
-	for (int idx = 0; idx < mThumbs.size(); idx++) {
-		DkThumbLabel* thumb = new DkThumbLabel(mThumbs.at(idx)->getThumb());
-		connect(thumb, SIGNAL(loadFileSignal(const QString&, bool)), this, SIGNAL(loadFileSignal(const QString&, bool)));
-		connect(thumb, SIGNAL(showFileSignal(const QString&)), this, SLOT(showFile(const QString&)));
-		connect(mThumbs.at(idx).data(), SIGNAL(thumbLoadedSignal()), this, SIGNAL(thumbLoadedSignal()));
+    showFile();
 
-		//thumb->show();
-		addItem(thumb);
-		mThumbLabels.append(thumb);
-		//thumbsNotLoaded.append(thumb);
-	}
+    if (!mThumbs.empty())
+        updateLayout();
 
-	showFile();
-
-	if (!mThumbs.empty())
-		updateLayout();
-
-	emit selectionChanged();
+    emit selectionChanged();
 }
 
-void DkThumbScene::setImageLoader(QSharedPointer<DkImageLoader> loader) {
-	
-	connectLoader(mLoader, false);		// disconnect
-	mLoader = loader;
-	connectLoader(loader);
+void DkThumbScene::setImageLoader(QSharedPointer<DkImageLoader> loader)
+{
+    connectLoader(mLoader, false); // disconnect
+    mLoader = loader;
+    connectLoader(loader);
 }
 
-void DkThumbScene::connectLoader(QSharedPointer<DkImageLoader> loader, bool connectSignals) {
-
-	if (!loader)
-		return;
+void DkThumbScene::connectLoader(QSharedPointer<DkImageLoader> loader, bool connectSignals)
+{
+    if (!loader)
+        return;
 
-	if (connectSignals) {
-		connect(loader.data(), SIGNAL(updateDirSignal(QVector<QSharedPointer<DkImageContainerT> >)), this, SLOT(updateThumbs(QVector<QSharedPointer<DkImageContainerT> >)), Qt::UniqueConnection);
-	}
-	else {
-		disconnect(loader.data(), SIGNAL(updateDirSignal(QVector<QSharedPointer<DkImageContainerT> >)), this, SLOT(updateThumbs(QVector<QSharedPointer<DkImageContainerT> >)));
-	}
+    if (connectSignals) {
+        connect(loader.data(),
+                SIGNAL(updateDirSignal(QVector<QSharedPointer<DkImageContainerT>>)),
+                this,
+                SLOT(updateThumbs(QVector<QSharedPointer<DkImageContainerT>>)),
+                Qt::UniqueConnection);
+    } else {
+        disconnect(loader.data(),
+                   SIGNAL(updateDirSignal(QVector<QSharedPointer<DkImageContainerT>>)),
+                   this,
+                   SLOT(updateThumbs(QVector<QSharedPointer<DkImageContainerT>>)));
+    }
 }
 
-void DkThumbScene::keyPressEvent(QKeyEvent * event) {
-
-	int idx = selectedThumbIndex((event->key() != Qt::Key_Right && event->key() != Qt::Key_Down));
-
-	if (idx == -1)
-		return;
+void DkThumbScene::keyPressEvent(QKeyEvent *event)
+{
+    int idx = selectedThumbIndex((event->key() != Qt::Key_Right && event->key() != Qt::Key_Down));
 
-	if (event->modifiers() != Qt::ShiftModifier && 
-		(event->key() == Qt::Key_Left || 
-		 event->key() == Qt::Key_Right || 
-		 event->key() == Qt::Key_Up || 
-		 event->key() == Qt::Key_Down))
-		selectThumbs(false);
+    if (idx == -1)
+        return;
 
-	switch (event->key()) {
-	case Qt::Key_Left: {
-		selectThumb(qMax(idx - 1, 0));
-		break;
-	}
-	case Qt::Key_Right: {
-		selectThumb(qMin(idx + 1, mThumbLabels.size()-1));
-		break;
-	}
-	case Qt::Key_Up: {
-		selectThumb(qMax(idx - mNumCols, 0));
-		break;
-	}
-	case Qt::Key_Down: {
-		selectThumb(qMin(idx + mNumCols, mThumbLabels.size()-1));
-		break;
-	}
+    if (event->modifiers() != Qt::ShiftModifier
+        && (event->key() == Qt::Key_Left || event->key() == Qt::Key_Right || event->key() == Qt::Key_Up || event->key() == Qt::Key_Down))
+        selectThumbs(false);
 
-	}
+    switch (event->key()) {
+    case Qt::Key_Left: {
+        selectThumb(qMax(idx - 1, 0));
+        break;
+    }
+    case Qt::Key_Right: {
+        selectThumb(qMin(idx + 1, mThumbLabels.size() - 1));
+        break;
+    }
+    case Qt::Key_Up: {
+        selectThumb(qMax(idx - mNumCols, 0));
+        break;
+    }
+    case Qt::Key_Down: {
+        selectThumb(qMin(idx + mNumCols, mThumbLabels.size() - 1));
+        break;
+    }
+    }
 }
 
-void DkThumbScene::showFile(const QString& filePath) {
+void DkThumbScene::showFile(const QString &filePath)
+{
+    if (filePath == QDir::currentPath() || filePath.isEmpty()) {
+        int sf = getSelectedFiles().size();
 
-	if (filePath == QDir::currentPath() || filePath.isEmpty()) {
-		int sf = getSelectedFiles().size();
+        QString info;
 
-		QString info;
-
-		if (sf > 1)
-			info = QString::number(sf) + tr(" selected");
-		else
-			info = QString::number(mThumbLabels.size()) + tr(" images");
-
-		DkStatusBarManager::instance().setMessage(tr("%1 | %2").arg(info, currentDir()));
-	}
-	else
-		DkStatusBarManager::instance().setMessage(QFileInfo(filePath).fileName());
+        if (sf > 1)
+            info = QString::number(sf) + tr(" selected");
+        else
+            info = QString::number(mThumbLabels.size()) + tr(" images");
 
+        DkStatusBarManager::instance().setMessage(tr("%1 | %2").arg(info, currentDir()));
+    } else
+        DkStatusBarManager::instance().setMessage(QFileInfo(filePath).fileName());
 }
 
-void DkThumbScene::ensureVisible(QSharedPointer<DkImageContainerT> img) const {
-
-	if (!img)
-		return;
-
-	for (DkThumbLabel* label : mThumbLabels) {
-
-		if (label->getThumb()->getFilePath() == img->filePath()) {
-			label->ensureVisible();
-			break;
-		}
-	}
+void DkThumbScene::ensureVisible(QSharedPointer<DkImageContainerT> img) const
+{
+    if (!img)
+        return;
 
+    for (DkThumbLabel *label : mThumbLabels) {
+        if (label->getThumb()->getFilePath() == img->filePath()) {
+            label->ensureVisible();
+            break;
+        }
+    }
 }
 
-QString DkThumbScene::currentDir() const {
-	
-	if (mThumbs.empty() || !mThumbs[0])
-		return "";
-	
-	return mThumbs[0]->fileInfo().absolutePath();
-}
+QString DkThumbScene::currentDir() const
+{
+    if (mThumbs.empty() || !mThumbs[0])
+        return "";
 
-int DkThumbScene::selectedThumbIndex(bool first) {
-	
-	int selIdx = -1;
-	for (int idx = 0; idx < mThumbLabels.size(); idx++) {
-
-		if (first && mThumbLabels[idx]->isSelected())
-			return idx;
-		else if (mThumbLabels[idx]->isSelected())
-			selIdx = idx;
-	}
-	
-	return selIdx;
+    return mThumbs[0]->fileInfo().absolutePath();
 }
 
-void DkThumbScene::toggleThumbLabels(bool show) {
+int DkThumbScene::selectedThumbIndex(bool first)
+{
+    int selIdx = -1;
+    for (int idx = 0; idx < mThumbLabels.size(); idx++) {
+        if (first && mThumbLabels[idx]->isSelected())
+            return idx;
+        else if (mThumbLabels[idx]->isSelected())
+            selIdx = idx;
+    }
 
-	DkSettingsManager::param().display().showThumbLabel = show;
+    return selIdx;
+}
 
-	for (const auto t : mThumbLabels)
-		t->update();
+void DkThumbScene::toggleThumbLabels(bool show)
+{
+    DkSettingsManager::param().display().showThumbLabel = show;
 
+    for (const auto t : mThumbLabels)
+        t->update();
 }
 
-void DkThumbScene::toggleSquaredThumbs(bool squares) {
-
-	DkSettingsManager::param().display().displaySquaredThumbs = squares;
+void DkThumbScene::toggleSquaredThumbs(bool squares)
+{
+    DkSettingsManager::param().display().displaySquaredThumbs = squares;
 
-	for (const auto t : mThumbLabels)
-		t->updateLabel();
+    for (const auto t : mThumbLabels)
+        t->updateLabel();
 
-	// well, that's not too beautiful
-	if (DkSettingsManager::param().display().displaySquaredThumbs)
-		updateLayout();
+    // well, that's not too beautiful
+    if (DkSettingsManager::param().display().displaySquaredThumbs)
+        updateLayout();
 }
 
-void DkThumbScene::increaseThumbs() {
-
-	resizeThumbs(1.2f);
+void DkThumbScene::increaseThumbs()
+{
+    resizeThumbs(1.2f);
 }
 
-void DkThumbScene::decreaseThumbs() {
-
-	resizeThumbs(0.8f);
+void DkThumbScene::decreaseThumbs()
+{
+    resizeThumbs(0.8f);
 }
 
-void DkThumbScene::resizeThumbs(float dx) {
+void DkThumbScene::resizeThumbs(float dx)
+{
+    if (dx < 0)
+        dx += 2.0f;
 
-	if (dx < 0)
-		dx += 2.0f;
+    int newSize = qRound(DkSettingsManager::param().display().thumbPreviewSize * dx);
 
-	int newSize = qRound(DkSettingsManager::param().display().thumbPreviewSize * dx);
-
-	if (newSize > 6 && newSize <= max_thumb_size) {
-		DkSettingsManager::param().display().thumbPreviewSize = newSize;
-		updateLayout();
-	}
+    if (newSize > 6 && newSize <= max_thumb_size) {
+        DkSettingsManager::param().display().thumbPreviewSize = newSize;
+        updateLayout();
+    }
 }
 
-void DkThumbScene::cancelLoading() {
-	
-	DkThumbsThreadPool::clear();
+void DkThumbScene::cancelLoading()
+{
+    DkThumbsThreadPool::clear();
 
-	for (auto t : mThumbLabels)
-		t->cancelLoading();
+    for (auto t : mThumbLabels)
+        t->cancelLoading();
 }
 
-void DkThumbScene::selectAllThumbs(bool selected) {
-
-	selectThumbs(selected);
+void DkThumbScene::selectAllThumbs(bool selected)
+{
+    selectThumbs(selected);
 }
 
-void DkThumbScene::selectThumbs(bool selected /* = true */, int from /* = 0 */, int to /* = -1 */) {
-
-	if (mThumbLabels.empty())
-		return;
+void DkThumbScene::selectThumbs(bool selected /* = true */, int from /* = 0 */, int to /* = -1 */)
+{
+    if (mThumbLabels.empty())
+        return;
 
-	if (to == -1)
-		to = mThumbLabels.size()-1;
+    if (to == -1)
+        to = mThumbLabels.size() - 1;
 
-	if (from > to) {
-		int tmp = to;
-		to = from;
-		from = tmp;
-	}
+    if (from > to) {
+        int tmp = to;
+        to = from;
+        from = tmp;
+    }
 
-	blockSignals(true);
-	for (int idx = from; idx <= to && idx < mThumbLabels.size(); idx++) {
-		mThumbLabels.at(idx)->setSelected(selected);
-	}
-	blockSignals(false);
-	emit selectionChanged();
-	showFile();	// update selection label
+    blockSignals(true);
+    for (int idx = from; idx <= to && idx < mThumbLabels.size(); idx++) {
+        mThumbLabels.at(idx)->setSelected(selected);
+    }
+    blockSignals(false);
+    emit selectionChanged();
+    showFile(); // update selection label
 }
 
-void DkThumbScene::selectThumb(int idx, bool select) {
+void DkThumbScene::selectThumb(int idx, bool select)
+{
+    if (mThumbLabels.empty())
+        return;
 
-	if (mThumbLabels.empty())
-		return;
+    if (idx < 0 || idx >= mThumbLabels.size()) {
+        qWarning() << "index out of bounds in selectThumbs()" << idx;
+        return;
+    }
 
-	if (idx < 0 || idx >= mThumbLabels.size()) {
-		qWarning() << "index out of bounds in selectThumbs()" << idx;
-		return;
-	}
+    blockSignals(true);
+    mThumbLabels[idx]->setSelected(select);
+    blockSignals(false);
 
-	blockSignals(true);
-	mThumbLabels[idx]->setSelected(select);
-	blockSignals(false);
-	
-	emit selectionChanged();
-	showFile();	// update selection label
-	ensureVisible(mThumbs[idx]);
+    emit selectionChanged();
+    showFile(); // update selection label
+    ensureVisible(mThumbs[idx]);
 }
 
-void DkThumbScene::copySelected() const {
+void DkThumbScene::copySelected() const
+{
+    QStringList fileList = getSelectedFiles();
 
-	QStringList fileList = getSelectedFiles();
+    if (fileList.empty())
+        return;
 
-	if (fileList.empty())
-		return;
+    QMimeData *mimeData = new QMimeData();
 
-	QMimeData* mimeData = new QMimeData();
-
-	if (!fileList.empty()) {
-
-		QList<QUrl> urls;
-		for (QString cStr : fileList)
-			urls.append(QUrl::fromLocalFile(cStr));
-		mimeData->setUrls(urls);
-		QClipboard* clipboard = QApplication::clipboard();
-		clipboard->setMimeData(mimeData);
-	}
+    if (!fileList.empty()) {
+        QList<QUrl> urls;
+        for (QString cStr : fileList)
+            urls.append(QUrl::fromLocalFile(cStr));
+        mimeData->setUrls(urls);
+        QClipboard *clipboard = QApplication::clipboard();
+        clipboard->setMimeData(mimeData);
+    }
 }
 
-void DkThumbScene::pasteImages() const {
-
-	copyImages(QApplication::clipboard()->mimeData());
+void DkThumbScene::pasteImages() const
+{
+    copyImages(QApplication::clipboard()->mimeData());
 }
 
-void DkThumbScene::copyImages(const QMimeData* mimeData, const Qt::DropAction& da) const {
+void DkThumbScene::copyImages(const QMimeData *mimeData, const Qt::DropAction &da) const
+{
+    if (!mimeData || !mimeData->hasUrls() || !mLoader)
+        return;
 
-	if (!mimeData || !mimeData->hasUrls() || !mLoader)
-		return;
+    QDir dir = mLoader->getDirPath();
 
-	QDir dir = mLoader->getDirPath();
+    for (QUrl url : mimeData->urls()) {
+        QFileInfo fileInfo = DkUtils::urlToLocalFile(url);
+        QFile file(fileInfo.absoluteFilePath());
+        QString newFilePath = QFileInfo(dir, fileInfo.fileName()).absoluteFilePath();
 
-	for (QUrl url : mimeData->urls()) {
+        // ignore existing silently
+        if (QFileInfo(newFilePath).exists())
+            continue;
 
-		QFileInfo fileInfo = DkUtils::urlToLocalFile(url);
-		QFile file(fileInfo.absoluteFilePath());
-		QString newFilePath = QFileInfo(dir, fileInfo.fileName()).absoluteFilePath();
+        auto askUser = [&](const QString &aMsg) {
+            int answer = QMessageBox::critical(DkUtils::getMainWindow(),
+                                               tr("Error"),
+                                               tr("Sorry, I cannot %1 %2").arg(aMsg, newFilePath),
+                                               QMessageBox::Ok | QMessageBox::Cancel);
 
-		// ignore existing silently
-		if (QFileInfo(newFilePath).exists())
-			continue;
+            return answer == QMessageBox::Cancel;
+        };
 
-		auto askUser = [&](const QString& aMsg) {
-			int answer = QMessageBox::critical(DkUtils::getMainWindow(), tr("Error"), tr("Sorry, I cannot %1 %2")
-				.arg(aMsg, newFilePath), QMessageBox::Ok | QMessageBox::Cancel);
-			
-			return answer == QMessageBox::Cancel;
-		};
-
-		bool userCanceled = false;
-
-		switch (da) {
-		// move files -> a move is actually a rename
-		case Qt::MoveAction: {
-			if (!file.rename(newFilePath))
-				userCanceled = askUser(tr("move"));
-			break;
-		}
-		// create links
-		case Qt::LinkAction: {
+        bool userCanceled = false;
 
+        switch (da) {
+        // move files -> a move is actually a rename
+        case Qt::MoveAction: {
+            if (!file.rename(newFilePath))
+                userCanceled = askUser(tr("move"));
+            break;
+        }
+        // create links
+        case Qt::LinkAction: {
 #ifdef Q_OS_WIN
-			newFilePath += ".lnk";
+            newFilePath += ".lnk";
 #endif
 
-			if (!file.link(newFilePath)) {
-				userCanceled = askUser(tr("create link"));
-			}
-			break;
-		}
-
-		default: {
-			// our default action is copying (usually done without modifiers)
-			if (!file.copy(newFilePath)) {
-				userCanceled = askUser(tr("copy"));
-			}
-			break;
-		}
-		}
+            if (!file.link(newFilePath)) {
+                userCanceled = askUser(tr("create link"));
+            }
+            break;
+        }
 
-		if (userCanceled)
-			break;
-	}
+        default: {
+            // our default action is copying (usually done without modifiers)
+            if (!file.copy(newFilePath)) {
+                userCanceled = askUser(tr("copy"));
+            }
+            break;
+        }
+        }
 
+        if (userCanceled)
+            break;
+    }
 }
 
-void DkThumbScene::deleteSelected() const {
+void DkThumbScene::deleteSelected() const
+{
+    QStringList fileList = getSelectedFiles();
 
-	QStringList fileList = getSelectedFiles();
+    if (fileList.empty())
+        return;
 
-	if (fileList.empty())
-		return;
-
-	QString question;
+    QString question;
 
 #if defined(Q_OS_WIN) || defined(W_OS_LINUX)
-	question = tr("Shall I move %1 file(s) to trash?").arg(fileList.size());
+    question = tr("Shall I move %1 file(s) to trash?").arg(fileList.size());
 #else
-	question = tr("Are you sure you want to permanently delete %1 file(s)?").arg(fileList.size());
+    question = tr("Are you sure you want to permanently delete %1 file(s)?").arg(fileList.size());
 #endif
 
-	DkMessageBox* msgBox = new DkMessageBox(
-		QMessageBox::Question, 
-		tr("Delete File"), 
-		question, 
-		(QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel), 
-		DkUtils::getMainWindow());
-
-	msgBox->setDefaultButton(QMessageBox::Yes);
-	msgBox->setObjectName("deleteThumbFileDialog");
+    DkMessageBox *msgBox = new DkMessageBox(QMessageBox::Question,
+                                            tr("Delete File"),
+                                            question,
+                                            (QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel),
+                                            DkUtils::getMainWindow());
 
-	int answer = msgBox->exec();
+    msgBox->setDefaultButton(QMessageBox::Yes);
+    msgBox->setObjectName("deleteThumbFileDialog");
 
-	if (answer == QMessageBox::Yes || answer == QMessageBox::Accepted) {
-		
-		if (mLoader && fileList.size() > 100)	// saves CPU
-			mLoader->deactivate();
+    int answer = msgBox->exec();
 
-		for (const QString& fString : fileList) {
+    if (answer == QMessageBox::Yes || answer == QMessageBox::Accepted) {
+        if (mLoader && fileList.size() > 100) // saves CPU
+            mLoader->deactivate();
 
-			QString fName = QFileInfo(fString).fileName();
-			qDebug() << "deleting: " << fString;
+        for (const QString &fString : fileList) {
+            QString fName = QFileInfo(fString).fileName();
+            qDebug() << "deleting: " << fString;
 
-			if (!DkUtils::moveToTrash(fString)) {
-				answer = QMessageBox::critical(
-					DkUtils::getMainWindow(), 
-					tr("Error"), 
-					tr("Sorry, I cannot delete:\n%1").arg(fName), 
-					QMessageBox::Ok | QMessageBox::Cancel);
+            if (!DkUtils::moveToTrash(fString)) {
+                answer = QMessageBox::critical(DkUtils::getMainWindow(),
+                                               tr("Error"),
+                                               tr("Sorry, I cannot delete:\n%1").arg(fName),
+                                               QMessageBox::Ok | QMessageBox::Cancel);
 
-				if (answer == QMessageBox::Cancel) {
-					break;
-				}
-			}
-		}
+                if (answer == QMessageBox::Cancel) {
+                    break;
+                }
+            }
+        }
 
-		if (mLoader && fileList.size() > 100)	// saves CPU
-			mLoader->activate();
+        if (mLoader && fileList.size() > 100) // saves CPU
+            mLoader->activate();
 
-		if (mLoader)
-			mLoader->directoryChanged(mLoader->getDirPath());
-	}
+        if (mLoader)
+            mLoader->directoryChanged(mLoader->getDirPath());
+    }
 }
 
-void DkThumbScene::renameSelected() const {
+void DkThumbScene::renameSelected() const
+{
+    QStringList fileList = getSelectedFiles();
 
-	QStringList fileList = getSelectedFiles();
+    if (fileList.empty())
+        return;
 
-	if (fileList.empty())
-		return;
+    bool ok;
+    QString newFileName = QInputDialog::getText(DkUtils::getMainWindow(), tr("Rename File(s)"), tr("New Filename:"), QLineEdit::Normal, "", &ok);
 
-	bool ok;
-	QString newFileName = QInputDialog::getText(
-		DkUtils::getMainWindow(), 
-		tr("Rename File(s)"),
-		tr("New Filename:"), 
-		QLineEdit::Normal,
-		"", &ok);
-	
-	if (ok && !newFileName.isEmpty()) {
+    if (ok && !newFileName.isEmpty()) {
+        for (int idx = 0; idx < fileList.size(); idx++) {
+            QFileInfo fileInfo = fileList.at(idx);
+            QFile file(fileInfo.absoluteFilePath());
+            QString pattern = (fileList.size() == 1) ? newFileName + ".<old>" : newFileName + "<d:3>.<old>"; // no index if just 1 file was added
+            DkFileNameConverter converter(fileInfo.fileName(), pattern, idx);
+            QFileInfo newFileInfo(fileInfo.dir(), converter.getConvertedFileName());
+            if (!file.rename(newFileInfo.absoluteFilePath())) {
+                int answer = QMessageBox::critical(DkUtils::getMainWindow(),
+                                                   tr("Error"),
+                                                   tr("Sorry, I cannot rename: %1 to %2").arg(fileInfo.fileName(), newFileInfo.fileName()),
+                                                   QMessageBox::Ok | QMessageBox::Cancel);
 
-		for (int idx = 0; idx < fileList.size(); idx++) {
-
-			QFileInfo fileInfo = fileList.at(idx);
-			QFile file(fileInfo.absoluteFilePath());
-			QString pattern = (fileList.size() == 1) ? newFileName + ".<old>" : newFileName + "<d:3>.<old>";	// no index if just 1 file was added
-			DkFileNameConverter converter(fileInfo.fileName(), pattern, idx);
-			QFileInfo newFileInfo(fileInfo.dir(), converter.getConvertedFileName());
-			if (!file.rename(newFileInfo.absoluteFilePath())) {
-				
-				int answer = QMessageBox::critical(
-					DkUtils::getMainWindow(), 
-					tr("Error"), 
-					tr("Sorry, I cannot rename: %1 to %2").arg(fileInfo.fileName(), newFileInfo.fileName()), 
-					QMessageBox::Ok | QMessageBox::Cancel);
-
-				if (answer == QMessageBox::Cancel) {
-					break;
-				}
-			}
-		}
-	}
+                if (answer == QMessageBox::Cancel) {
+                    break;
+                }
+            }
+        }
+    }
 }
 
-QStringList DkThumbScene::getSelectedFiles() const {
-
-	QStringList fileList;
+QStringList DkThumbScene::getSelectedFiles() const
+{
+    QStringList fileList;
 
-	for (int idx = 0; idx < mThumbLabels.size(); idx++) {
+    for (int idx = 0; idx < mThumbLabels.size(); idx++) {
+        if (mThumbLabels.at(idx) && mThumbLabels.at(idx)->isSelected()) {
+            fileList.append(mThumbLabels.at(idx)->getThumb()->getFilePath());
+        }
+    }
 
-		if (mThumbLabels.at(idx) && mThumbLabels.at(idx)->isSelected()) {
-			fileList.append(mThumbLabels.at(idx)->getThumb()->getFilePath());
-		}
-	}
-
-	return fileList;
+    return fileList;
 }
 
-QVector<DkThumbLabel*> DkThumbScene::getSelectedThumbs() const {
-
-	QVector<DkThumbLabel*> selected;
+QVector<DkThumbLabel *> DkThumbScene::getSelectedThumbs() const
+{
+    QVector<DkThumbLabel *> selected;
 
-	for (DkThumbLabel* label : mThumbLabels) {
-		if (label->isSelected())
-			selected << label;
-	}
+    for (DkThumbLabel *label : mThumbLabels) {
+        if (label->isSelected())
+            selected << label;
+    }
 
-	return selected;
+    return selected;
 }
 
-int DkThumbScene::findThumb(DkThumbLabel* thumb) const {
-
-	int thumbIdx = -1;
+int DkThumbScene::findThumb(DkThumbLabel *thumb) const
+{
+    int thumbIdx = -1;
 
-	for (int idx = 0; idx < mThumbLabels.size(); idx++) {
-		if (thumb == mThumbLabels.at(idx)) {
-			thumbIdx = idx;
-			break;
-		}
-	}
+    for (int idx = 0; idx < mThumbLabels.size(); idx++) {
+        if (thumb == mThumbLabels.at(idx)) {
+            thumbIdx = idx;
+            break;
+        }
+    }
 
-	return thumbIdx;
+    return thumbIdx;
 }
 
-bool DkThumbScene::allThumbsSelected() const {
+bool DkThumbScene::allThumbsSelected() const
+{
+    for (DkThumbLabel *label : mThumbLabels)
+        if (label->flags() & QGraphicsItem::ItemIsSelectable && !label->isSelected())
+            return false;
 
-	for (DkThumbLabel* label : mThumbLabels)
-		if (label->flags() & QGraphicsItem::ItemIsSelectable && !label->isSelected())
-			return false;
-
-	return true;
+    return true;
 }
 
 // DkThumbView --------------------------------------------------------------------
-DkThumbsView::DkThumbsView(DkThumbScene* scene, QWidget* parent /* = 0 */) : QGraphicsView(scene, parent) {
-
-	setObjectName("DkThumbsView");
-	this->scene = scene;
-	connect(scene, SIGNAL(thumbLoadedSignal()), this, SLOT(fetchThumbs()));
+DkThumbsView::DkThumbsView(DkThumbScene *scene, QWidget *parent /* = 0 */)
+    : QGraphicsView(scene, parent)
+{
+    setObjectName("DkThumbsView");
+    this->scene = scene;
+    connect(scene, SIGNAL(thumbLoadedSignal()), this, SLOT(fetchThumbs()));
 
-	setResizeAnchor(QGraphicsView::AnchorUnderMouse);
-	setAcceptDrops(true);
+    setResizeAnchor(QGraphicsView::AnchorUnderMouse);
+    setAcceptDrops(true);
 
-	lastShiftIdx = -1;
+    lastShiftIdx = -1;
 }
 
-void DkThumbsView::wheelEvent(QWheelEvent *event) {
-
-	if (event->modifiers() == Qt::ControlModifier) {
-		scene->resizeThumbs(event->delta()/100.0f);
-	}
-	else if (event->modifiers() == Qt::NoModifier) {
+void DkThumbsView::wheelEvent(QWheelEvent *event)
+{
+    if (event->modifiers() == Qt::ControlModifier) {
+        scene->resizeThumbs(event->angleDelta().y() / 100.0f);
+    } else if (event->modifiers() == Qt::NoModifier) {
+        if (verticalScrollBar()->isVisible()) {
+            verticalScrollBar()->setValue(verticalScrollBar()->value() - event->angleDelta().y());
+        }
+    }
 
-		if (verticalScrollBar()->isVisible()) {
-			verticalScrollBar()->setValue(verticalScrollBar()->value()-event->delta());
-		}
-	}
-
-	//QWidget::wheelEvent(event);
+    // QWidget::wheelEvent(event);
 }
 
-void DkThumbsView::mousePressEvent(QMouseEvent *event) {
+void DkThumbsView::mousePressEvent(QMouseEvent *event)
+{
+    if (event->buttons() == Qt::LeftButton) {
+        mousePos = event->pos();
+    }
 
-	if (event->buttons() == Qt::LeftButton) {
-		mousePos = event->pos();
-	}
+    qDebug() << "mouse pressed";
 
-	qDebug() << "mouse pressed";
+    DkThumbLabel *itemClicked = static_cast<DkThumbLabel *>(scene->itemAt(mapToScene(event->pos()), QTransform()));
 
-#if QT_VERSION < 0x050000
-	DkThumbLabel* itemClicked = static_cast<DkThumbLabel*>(scene->itemAt(mapToScene(event->pos())));
-#else
-	DkThumbLabel* itemClicked = static_cast<DkThumbLabel*>(scene->itemAt(mapToScene(event->pos()), QTransform()));
-#endif
-
-	// this is a bit of a hack
-	// what we want to achieve: if the user is selecting with e.g. shift or ctrl 
-	// and he clicks (unintentionally) into the background - the selection would be lost
-	// otherwise so we just don't propagate this event
-	if (itemClicked || event->modifiers() == Qt::NoModifier)	
-		QGraphicsView::mousePressEvent(event);
+    // this is a bit of a hack
+    // what we want to achieve: if the user is selecting with e.g. shift or ctrl
+    // and he clicks (unintentionally) into the background - the selection would be lost
+    // otherwise so we just don't propagate this event
+    if (itemClicked || event->modifiers() == Qt::NoModifier)
+        QGraphicsView::mousePressEvent(event);
 }
 
-void DkThumbsView::mouseMoveEvent(QMouseEvent *event) {
-
-	if (event->buttons() == Qt::LeftButton) {
-
-		int dist = qRound(QPointF(event->pos()-mousePos).manhattanLength());
+void DkThumbsView::mouseMoveEvent(QMouseEvent *event)
+{
+    if (event->buttons() == Qt::LeftButton) {
+        int dist = qRound(QPointF(event->pos() - mousePos).manhattanLength());
 
-		if (dist > QApplication::startDragDistance()) {
+        if (dist > QApplication::startDragDistance()) {
+            QStringList fileList = scene->getSelectedFiles();
 
-			QStringList fileList = scene->getSelectedFiles();
+            QMimeData *mimeData = new QMimeData;
 
-			QMimeData* mimeData = new QMimeData;
+            if (!fileList.empty()) {
+                QList<QUrl> urls;
+                for (QString fStr : fileList)
+                    urls.append(QUrl::fromLocalFile(fStr));
 
-			if (!fileList.empty()) {
+                mimeData->setUrls(urls);
 
-				QList<QUrl> urls;
-				for (QString fStr : fileList)
-					urls.append(QUrl::fromLocalFile(fStr));
+                // create thumb image
+                QVector<DkThumbLabel *> tl = scene->getSelectedThumbs();
+                QVector<QImage> imgs;
 
-				mimeData->setUrls(urls);
+                for (int idx = 0; idx < tl.size() && idx < 3; idx++) {
+                    imgs << tl[idx]->getThumb()->getImage();
+                }
 
-				// create thumb image
-				QVector<DkThumbLabel*> tl = scene->getSelectedThumbs();
-				QVector<QImage> imgs;
+                QPixmap pm = DkImage::merge(imgs).scaledToHeight(73); // 73: see https://www.youtube.com/watch?v=TIYMmbHik08
 
-				for (int idx = 0; idx < tl.size() && idx < 3; idx++) {
-					imgs << tl[idx]->getThumb()->getImage();
-				}
+                QDrag *drag = new QDrag(this);
+                drag->setMimeData(mimeData);
+                drag->setPixmap(pm);
 
-				QPixmap pm = DkImage::merge(imgs).scaledToHeight(73);	// 73: see https://www.youtube.com/watch?v=TIYMmbHik08
+                drag->exec(Qt::CopyAction | Qt::MoveAction | Qt::LinkAction, Qt::CopyAction);
+            }
+        }
+    }
 
-				QDrag* drag = new QDrag(this);
-				drag->setMimeData(mimeData);
-				drag->setPixmap(pm);
-				
-				drag->exec(Qt::CopyAction | Qt::MoveAction | Qt::LinkAction, Qt::CopyAction);
-			}
-		}
-	}
-
-	QGraphicsView::mouseMoveEvent(event);
+    QGraphicsView::mouseMoveEvent(event);
 }
 
-void DkThumbsView::mouseReleaseEvent(QMouseEvent *event) {
-	
-	QGraphicsView::mouseReleaseEvent(event);
-	
-#if QT_VERSION < 0x050000
-	DkThumbLabel* itemClicked = static_cast<DkThumbLabel*>(scene->itemAt(mapToScene(event->pos())));
-#else
-	DkThumbLabel* itemClicked = static_cast<DkThumbLabel*>(scene->itemAt(mapToScene(event->pos()), QTransform()));
-#endif
+void DkThumbsView::mouseReleaseEvent(QMouseEvent *event)
+{
+    QGraphicsView::mouseReleaseEvent(event);
 
-	if (lastShiftIdx != -1 && event->modifiers() & Qt::ShiftModifier && itemClicked != 0) {
-		scene->selectThumbs(true, lastShiftIdx, scene->findThumb(itemClicked));
-	}
-	else if (itemClicked != 0) {
-		lastShiftIdx = scene->findThumb(itemClicked);
-	}
-	else
-		lastShiftIdx = -1;
+    DkThumbLabel *itemClicked = static_cast<DkThumbLabel *>(scene->itemAt(mapToScene(event->pos()), QTransform()));
 
+    if (lastShiftIdx != -1 && event->modifiers() & Qt::ShiftModifier && itemClicked != 0) {
+        scene->selectThumbs(true, lastShiftIdx, scene->findThumb(itemClicked));
+    } else if (itemClicked != 0) {
+        lastShiftIdx = scene->findThumb(itemClicked);
+    } else
+        lastShiftIdx = -1;
 }
 
-void DkThumbsView::dragEnterEvent(QDragEnterEvent *event) {
+void DkThumbsView::dragEnterEvent(QDragEnterEvent *event)
+{
+    QGraphicsView::dragEnterEvent(event);
 
-	QGraphicsView::dragEnterEvent(event);
+    qDebug() << event->source() << " I am: " << this;
 
-	qDebug() << event->source() << " I am: " << this;
+    if (event->source() == this)
+        event->accept();
+    else if (event->mimeData()->hasUrls()) {
+        QUrl url = event->mimeData()->urls().at(0);
+        url = url.toLocalFile();
 
-	if (event->source() == this)
-		event->accept();
-	else if (event->mimeData()->hasUrls()) {
-		QUrl url = event->mimeData()->urls().at(0);
-		url = url.toLocalFile();
-
-		QFileInfo file = QFileInfo(url.toString());
-
-		// just accept image files
-		if (DkUtils::isValid(file))
-			event->acceptProposedAction();
-		else if (file.isDir())
-			event->acceptProposedAction();
-	}
+        QFileInfo file = QFileInfo(url.toString());
 
+        // just accept image files
+        if (DkUtils::isValid(file))
+            event->acceptProposedAction();
+        else if (file.isDir())
+            event->acceptProposedAction();
+    }
 }
 
-void DkThumbsView::dragMoveEvent(QDragMoveEvent *event) {
-
-	QGraphicsView::dragMoveEvent(event);
+void DkThumbsView::dragMoveEvent(QDragMoveEvent *event)
+{
+    QGraphicsView::dragMoveEvent(event);
 
-	if (event->source() == this) {
-		event->accept();
-	}
-	else if (event->mimeData()->hasUrls()) {
-		QUrl url = event->mimeData()->urls().at(0);
-		url = url.toLocalFile();
+    if (event->source() == this) {
+        event->accept();
+    } else if (event->mimeData()->hasUrls()) {
+        QUrl url = event->mimeData()->urls().at(0);
+        url = url.toLocalFile();
 
-		QFileInfo file = QFileInfo(url.toString());
-
-		// just accept image files
-		if (DkUtils::isValid(file))
-			event->acceptProposedAction();
-		else if (file.isDir())
-			event->acceptProposedAction();
-	}
+        QFileInfo file = QFileInfo(url.toString());
 
+        // just accept image files
+        if (DkUtils::isValid(file))
+            event->acceptProposedAction();
+        else if (file.isDir())
+            event->acceptProposedAction();
+    }
 }
 
-void DkThumbsView::dropEvent(QDropEvent *event) {
-
-	if (event->source() == this) {
-		event->accept();
-		return;
-	}
+void DkThumbsView::dropEvent(QDropEvent *event)
+{
+    if (event->source() == this) {
+        event->accept();
+        return;
+    }
 
-	if (event->mimeData()->hasUrls() && event->mimeData()->urls().size() > 0) {
-		
-		QUrl url = event->mimeData()->urls().at(0);
-		url = url.toLocalFile();
+    if (event->mimeData()->hasUrls() && event->mimeData()->urls().size() > 0) {
+        QUrl url = event->mimeData()->urls().at(0);
+        url = url.toLocalFile();
 
-		QFileInfo file = QFileInfo(url.toString());
+        QFileInfo file = QFileInfo(url.toString());
 
-		// if a folder is dropped -> open it
-		if (file.isDir()) {
-			emit updateDirSignal(file.absoluteFilePath());
-		}
-		else {
-			scene->copyImages(event->mimeData(), event->proposedAction());
-		}
-	}
+        // if a folder is dropped -> open it
+        if (file.isDir()) {
+            emit updateDirSignal(file.absoluteFilePath());
+        } else {
+            scene->copyImages(event->mimeData(), event->proposedAction());
+        }
+    }
 
-	QGraphicsView::dropEvent(event);
+    QGraphicsView::dropEvent(event);
 }
 
-void DkThumbsView::fetchThumbs() {
+void DkThumbsView::fetchThumbs()
+{
+    QList<QGraphicsItem *> items = scene->items(mapToScene(viewport()->rect()).boundingRect(), Qt::IntersectsItemShape);
 
-	QList<QGraphicsItem*> items = scene->items(mapToScene(viewport()->rect()).boundingRect(), Qt::IntersectsItemShape);
+    for (int idx = 0; idx < items.size(); idx++) {
+        DkThumbLabel *th = dynamic_cast<DkThumbLabel *>(items.at(idx));
 
-	for (int idx = 0; idx < items.size(); idx++) {
-
-		DkThumbLabel* th = dynamic_cast<DkThumbLabel*>(items.at(idx));
-
-		if (!th) {
-			qWarning() << "could not cast to thumb label...";
-			continue;
-		}
-
-		if (th->pixmap().isNull()) {
-			th->update();
-		}
-	}
+        if (!th) {
+            qWarning() << "could not cast to thumb label...";
+            continue;
+        }
 
+        if (th->pixmap().isNull()) {
+            th->update();
+        }
+    }
 }
 
 // DkThumbScrollWidget --------------------------------------------------------------------
-DkThumbScrollWidget::DkThumbScrollWidget(QWidget* parent /* = 0 */, Qt::WindowFlags flags /* = 0 */) : DkFadeWidget(parent, flags) {
-
-	setObjectName("DkThumbScrollWidget");
-	setContentsMargins(0,0,0,0);
-
-	mThumbsScene = new DkThumbScene(this);
-	//thumbsView->setContentsMargins(0,0,0,0);
-
-	mView = new DkThumbsView(mThumbsScene, this);
-	mView->setFocusPolicy(Qt::StrongFocus);
-
-	createActions();
-	createToolbar();
-
-	QVBoxLayout* layout = new QVBoxLayout(this);
-	layout->setContentsMargins(0,0,0,0);
-	layout->setSpacing(0);
-	layout->addWidget(mToolbar);
-	layout->addWidget(mView);
-	setLayout(layout);
-
-	enableSelectionActions();
-
-	QMetaObject::connectSlotsByName(this);
-}
-
-void DkThumbScrollWidget::createToolbar() {
-
-	mToolbar = new QToolBar(tr("Thumb Preview Toolbar"), this);
-	mToolbar->setIconSize(QSize(DkSettingsManager::param().effectiveIconSize(this), DkSettingsManager::param().effectiveIconSize(this)));
-
-	DkActionManager& am = DkActionManager::instance();
-	mToolbar->addAction(am.action(DkActionManager::preview_zoom_in));
-	mToolbar->addAction(am.action(DkActionManager::preview_zoom_out));
-	mToolbar->addAction(am.action(DkActionManager::preview_display_squares));
-	mToolbar->addAction(am.action(DkActionManager::preview_show_labels));
-	mToolbar->addSeparator();
-	mToolbar->addAction(am.action(DkActionManager::preview_copy));
-	mToolbar->addAction(am.action(DkActionManager::preview_paste));
-	mToolbar->addAction(am.action(DkActionManager::preview_rename));
-	mToolbar->addAction(am.action(DkActionManager::preview_delete));
-	mToolbar->addSeparator();
-	mToolbar->addAction(am.action(DkActionManager::preview_batch));
-	mToolbar->addAction(am.action(DkActionManager::preview_print));
-
-	// add sorting
-	QString menuTitle = tr("&Sort");
-	QMenu* m = mContextMenu->addMenu(menuTitle);
-	m->addActions(am.sortActions().toList());
-
-	QToolButton* toolButton = new QToolButton(this);
-	toolButton->setObjectName("DkThumbToolButton");
-	toolButton->setMenu(m);
-	toolButton->setAccessibleName(menuTitle);
-	toolButton->setText(menuTitle);
-	toolButton->setIcon(DkImage::loadIcon(":/nomacs/img/sort.svg"));
-	toolButton->setPopupMode(QToolButton::InstantPopup);
-	mToolbar->addWidget(toolButton);
-
-	// filter edit
-	mFilterEdit = new QLineEdit("", this);
-	mFilterEdit->setPlaceholderText(tr("Filter Files (Ctrl + F)"));
-	mFilterEdit->setMaximumWidth(250);
-
-	// right align search filters
-	QWidget* spacer = new QWidget(this);
-	spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
-	mToolbar->addWidget(spacer);
-	mToolbar->addWidget(mFilterEdit);
-}
-
-void DkThumbScrollWidget::createActions() {
-
-	// create context menu
-	mContextMenu = new QMenu(tr("Thumb"), this);
-	QVector<QAction*> actions = DkActionManager::instance().previewActions();
-	for (int idx = 0; idx < actions.size(); idx++) {
-
-		mContextMenu->addAction(actions.at(idx));
-
-		if (idx == DkActionManager::preview_show_labels)
-			mContextMenu->addSeparator();
-	}
-
-	DkActionManager& am = DkActionManager::instance();
-	//addActions(am.allActions().toList());
-	addActions(am.previewActions().toList());
+DkThumbScrollWidget::DkThumbScrollWidget(QWidget *parent /* = 0 */, Qt::WindowFlags flags /* = 0 */)
+    : DkFadeWidget(parent, flags)
+{
+    setObjectName("DkThumbScrollWidget");
+    setContentsMargins(0, 0, 0, 0);
+
+    mThumbsScene = new DkThumbScene(this);
+    // thumbsView->setContentsMargins(0,0,0,0);
+
+    mView = new DkThumbsView(mThumbsScene, this);
+    mView->setFocusPolicy(Qt::StrongFocus);
+
+    createActions();
+    createToolbar();
+
+    QVBoxLayout *layout = new QVBoxLayout(this);
+    layout->setContentsMargins(0, 0, 0, 0);
+    layout->setSpacing(0);
+    layout->addWidget(mToolbar);
+    layout->addWidget(mView);
+    setLayout(layout);
+
+    enableSelectionActions();
+
+    QMetaObject::connectSlotsByName(this);
+}
+
+void DkThumbScrollWidget::createToolbar()
+{
+    mToolbar = new QToolBar(tr("Thumb Preview Toolbar"), this);
+    mToolbar->setIconSize(QSize(DkSettingsManager::param().effectiveIconSize(this), DkSettingsManager::param().effectiveIconSize(this)));
+
+    DkActionManager &am = DkActionManager::instance();
+    mToolbar->addAction(am.action(DkActionManager::preview_zoom_in));
+    mToolbar->addAction(am.action(DkActionManager::preview_zoom_out));
+    mToolbar->addAction(am.action(DkActionManager::preview_display_squares));
+    mToolbar->addAction(am.action(DkActionManager::preview_show_labels));
+    mToolbar->addSeparator();
+    mToolbar->addAction(am.action(DkActionManager::preview_copy));
+    mToolbar->addAction(am.action(DkActionManager::preview_paste));
+    mToolbar->addAction(am.action(DkActionManager::preview_rename));
+    mToolbar->addAction(am.action(DkActionManager::preview_delete));
+    mToolbar->addSeparator();
+    mToolbar->addAction(am.action(DkActionManager::preview_batch));
+    mToolbar->addAction(am.action(DkActionManager::preview_print));
+
+    // add sorting
+    QString menuTitle = tr("&Sort");
+    QMenu *m = mContextMenu->addMenu(menuTitle);
+    m->addActions(am.sortActions().toList());
+
+    QToolButton *toolButton = new QToolButton(this);
+    toolButton->setObjectName("DkThumbToolButton");
+    toolButton->setMenu(m);
+    toolButton->setAccessibleName(menuTitle);
+    toolButton->setText(menuTitle);
+    toolButton->setIcon(DkImage::loadIcon(":/nomacs/img/sort.svg"));
+    toolButton->setPopupMode(QToolButton::InstantPopup);
+    mToolbar->addWidget(toolButton);
+
+    // filter edit
+    mFilterEdit = new QLineEdit("", this);
+    mFilterEdit->setPlaceholderText(tr("Filter Files (Ctrl + F)"));
+    mFilterEdit->setMaximumWidth(250);
+
+    // right align search filters
+    QWidget *spacer = new QWidget(this);
+    spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+    mToolbar->addWidget(spacer);
+    mToolbar->addWidget(mFilterEdit);
+}
+
+void DkThumbScrollWidget::createActions()
+{
+    // create context menu
+    mContextMenu = new QMenu(tr("Thumb"), this);
+    QVector<QAction *> actions = DkActionManager::instance().previewActions();
+    for (int idx = 0; idx < actions.size(); idx++) {
+        mContextMenu->addAction(actions.at(idx));
+
+        if (idx == DkActionManager::preview_show_labels)
+            mContextMenu->addSeparator();
+    }
+
+    DkActionManager &am = DkActionManager::instance();
+    // addActions(am.allActions().toList());
+    addActions(am.previewActions().toList());
 
     // add a shortcut to open the selected image
-	QAction* loadFile = new QAction(tr("Open Image"), this);
-	loadFile->setObjectName("loadFile");
-	loadFile->setShortcut(Qt::Key_Return);
+    QAction *loadFile = new QAction(tr("Open Image"), this);
+    loadFile->setObjectName("loadFile");
+    loadFile->setShortcut(Qt::Key_Return);
 
-	addAction(loadFile);
+    addAction(loadFile);
 }
 
-void DkThumbScrollWidget::batchProcessFiles() const {
-
-	QStringList fileList = mThumbsScene->getSelectedFiles();
-	emit batchProcessFilesSignal(fileList);
+void DkThumbScrollWidget::batchProcessFiles() const
+{
+    QStringList fileList = mThumbsScene->getSelectedFiles();
+    emit batchProcessFilesSignal(fileList);
 }
 
-void DkThumbScrollWidget::batchPrint() const {
-
-	QStringList fileList = mThumbsScene->getSelectedFiles();
-
-	QVector<QImage> imgs;
-	DkBasicLoader bl;
-
-	for (const QString& f : fileList) {
+void DkThumbScrollWidget::batchPrint() const
+{
+    QStringList fileList = mThumbsScene->getSelectedFiles();
 
-		bl.loadGeneral(f);
+    QVector<QImage> imgs;
+    DkBasicLoader bl;
 
-		if (!bl.image().isNull())
-			imgs << bl.image();
+    for (const QString &f : fileList) {
+        bl.loadGeneral(f);
 
-	}
+        if (!bl.image().isNull())
+            imgs << bl.image();
+    }
 
-	DkPrintPreviewDialog* printPreviewDialog = new DkPrintPreviewDialog(DkUtils::getMainWindow());
+    DkPrintPreviewDialog *printPreviewDialog = new DkPrintPreviewDialog(DkUtils::getMainWindow());
 
-	for (const QImage& img : imgs)
-		printPreviewDialog->addImage(img);
+    for (const QImage &img : imgs)
+        printPreviewDialog->addImage(img);
 
-	printPreviewDialog->exec();
-	printPreviewDialog->deleteLater();
+    printPreviewDialog->exec();
+    printPreviewDialog->deleteLater();
 }
 
-void DkThumbScrollWidget::on_loadFile_triggered() {
+void DkThumbScrollWidget::on_loadFile_triggered()
+{
+    auto selected = mThumbsScene->selectedItems();
 
-	auto selected = mThumbsScene->selectedItems();
+    if (selected.isEmpty())
+        return;
 
-	if (selected.isEmpty())
-		return;
-	
-	auto thumb = dynamic_cast<DkThumbLabel*>(selected.first());
+    auto thumb = dynamic_cast<DkThumbLabel *>(selected.first());
 
-	if (thumb && thumb->getThumb())
-		mThumbsScene->loadFileSignal(thumb->getThumb()->getFilePath(), false);
+    if (thumb && thumb->getThumb())
+        mThumbsScene->loadFileSignal(thumb->getThumb()->getFilePath(), false);
 }
 
-void DkThumbScrollWidget::updateThumbs(QVector<QSharedPointer<DkImageContainerT> > thumbs) {
-
-	mThumbsScene->updateThumbs(thumbs);
+void DkThumbScrollWidget::updateThumbs(QVector<QSharedPointer<DkImageContainerT>> thumbs)
+{
+    mThumbsScene->updateThumbs(thumbs);
 }
 
-void DkThumbScrollWidget::clear() {
-
-	mThumbsScene->updateThumbs(QVector<QSharedPointer<DkImageContainerT> > ());
+void DkThumbScrollWidget::clear()
+{
+    mThumbsScene->updateThumbs(QVector<QSharedPointer<DkImageContainerT>>());
 }
 
-void DkThumbScrollWidget::setDir(const QString& dirPath) {
-
-	if (isVisible())
-		emit updateDirSignal(dirPath);
+void DkThumbScrollWidget::setDir(const QString &dirPath)
+{
+    if (isVisible())
+        emit updateDirSignal(dirPath);
 }
 
-void DkThumbScrollWidget::setVisible(bool visible) {
+void DkThumbScrollWidget::setVisible(bool visible)
+{
+    connectToActions(visible);
 
-	connectToActions(visible);
+    DkFadeWidget::setVisible(visible);
 
-	DkFadeWidget::setVisible(visible);
-
-	if (visible) {
-		mThumbsScene->updateThumbLabels();
-		mFilterEdit->setText("");
-	}
-	else
-		mThumbsScene->cancelLoading();
+    if (visible) {
+        mThumbsScene->updateThumbLabels();
+        mFilterEdit->setText("");
+    } else
+        mThumbsScene->cancelLoading();
 }
 
-void DkThumbScrollWidget::connectToActions(bool activate) {
-	
-	DkActionManager& am = DkActionManager::instance();
-	for (QAction* a : am.previewActions())
-		a->setEnabled(activate);
-	
-	if (activate) {
-		connect(am.action(DkActionManager::preview_select_all), SIGNAL(triggered(bool)), mThumbsScene, SLOT(selectAllThumbs(bool)));
-		connect(am.action(DkActionManager::preview_zoom_in), SIGNAL(triggered()), mThumbsScene, SLOT(increaseThumbs()));
-		connect(am.action(DkActionManager::preview_zoom_out), SIGNAL(triggered()), mThumbsScene, SLOT(decreaseThumbs()));
-		connect(am.action(DkActionManager::preview_display_squares), SIGNAL(triggered(bool)), mThumbsScene, SLOT(toggleSquaredThumbs(bool)));
-		connect(am.action(DkActionManager::preview_show_labels), SIGNAL(triggered(bool)), mThumbsScene, SLOT(toggleThumbLabels(bool)));
-		connect(am.action(DkActionManager::preview_filter), SIGNAL(triggered()), this, SLOT(setFilterFocus()));
-		connect(am.action(DkActionManager::preview_delete), SIGNAL(triggered()), mThumbsScene, SLOT(deleteSelected()));
-		connect(am.action(DkActionManager::preview_copy), SIGNAL(triggered()), mThumbsScene, SLOT(copySelected()));
-		connect(am.action(DkActionManager::preview_paste), SIGNAL(triggered()), mThumbsScene, SLOT(pasteImages()));
-		connect(am.action(DkActionManager::preview_rename), SIGNAL(triggered()), mThumbsScene, SLOT(renameSelected()));
-		connect(am.action(DkActionManager::preview_batch), SIGNAL(triggered()), this, SLOT(batchProcessFiles()));
-		connect(am.action(DkActionManager::preview_print), SIGNAL(triggered()), this, SLOT(batchPrint()));
-
-		connect(mFilterEdit, SIGNAL(textChanged(const QString&)), this, SIGNAL(filterChangedSignal(const QString&)));
-		connect(mView, SIGNAL(updateDirSignal(const QString&)), this, SIGNAL(updateDirSignal(const QString&)));
-		connect(mThumbsScene, SIGNAL(selectionChanged()), this, SLOT(enableSelectionActions()));
-	}
-	else {
-		disconnect(am.action(DkActionManager::preview_select_all), SIGNAL(triggered(bool)), mThumbsScene, SLOT(selectAllThumbs(bool)));
-		disconnect(am.action(DkActionManager::preview_zoom_in), SIGNAL(triggered()), mThumbsScene, SLOT(increaseThumbs()));
-		disconnect(am.action(DkActionManager::preview_zoom_out), SIGNAL(triggered()), mThumbsScene, SLOT(decreaseThumbs()));
-		disconnect(am.action(DkActionManager::preview_display_squares), SIGNAL(triggered(bool)), mThumbsScene, SLOT(toggleSquaredThumbs(bool)));
-		disconnect(am.action(DkActionManager::preview_show_labels), SIGNAL(triggered(bool)), mThumbsScene, SLOT(toggleThumbLabels(bool)));
-		disconnect(am.action(DkActionManager::preview_filter), SIGNAL(triggered()), this, SLOT(setFilterFocus()));
-		disconnect(am.action(DkActionManager::preview_delete), SIGNAL(triggered()), mThumbsScene, SLOT(deleteSelected()));
-		disconnect(am.action(DkActionManager::preview_copy), SIGNAL(triggered()), mThumbsScene, SLOT(copySelected()));
-		disconnect(am.action(DkActionManager::preview_paste), SIGNAL(triggered()), mThumbsScene, SLOT(pasteImages()));
-		disconnect(am.action(DkActionManager::preview_rename), SIGNAL(triggered()), mThumbsScene, SLOT(renameSelected()));
-		disconnect(am.action(DkActionManager::preview_batch), SIGNAL(triggered()), this, SLOT(batchProcessFiles()));
-		disconnect(am.action(DkActionManager::preview_print), SIGNAL(triggered()), this, SLOT(batchPrint()));
+void DkThumbScrollWidget::connectToActions(bool activate)
+{
+    DkActionManager &am = DkActionManager::instance();
+    for (QAction *a : am.previewActions())
+        a->setEnabled(activate);
 
-		disconnect(mFilterEdit, SIGNAL(textChanged(const QString&)), this, SIGNAL(filterChangedSignal(const QString&)));
-		disconnect(mView, SIGNAL(updateDirSignal(const QString&)), this, SIGNAL(updateDirSignal(const QString&)));
-		disconnect(mThumbsScene, SIGNAL(selectionChanged()), this, SLOT(enableSelectionActions()));
-	}
-}
+    if (activate) {
+        connect(am.action(DkActionManager::preview_select_all), SIGNAL(triggered(bool)), mThumbsScene, SLOT(selectAllThumbs(bool)));
+        connect(am.action(DkActionManager::preview_zoom_in), SIGNAL(triggered()), mThumbsScene, SLOT(increaseThumbs()));
+        connect(am.action(DkActionManager::preview_zoom_out), SIGNAL(triggered()), mThumbsScene, SLOT(decreaseThumbs()));
+        connect(am.action(DkActionManager::preview_display_squares), SIGNAL(triggered(bool)), mThumbsScene, SLOT(toggleSquaredThumbs(bool)));
+        connect(am.action(DkActionManager::preview_show_labels), SIGNAL(triggered(bool)), mThumbsScene, SLOT(toggleThumbLabels(bool)));
+        connect(am.action(DkActionManager::preview_filter), SIGNAL(triggered()), this, SLOT(setFilterFocus()));
+        connect(am.action(DkActionManager::preview_delete), SIGNAL(triggered()), mThumbsScene, SLOT(deleteSelected()));
+        connect(am.action(DkActionManager::preview_copy), SIGNAL(triggered()), mThumbsScene, SLOT(copySelected()));
+        connect(am.action(DkActionManager::preview_paste), SIGNAL(triggered()), mThumbsScene, SLOT(pasteImages()));
+        connect(am.action(DkActionManager::preview_rename), SIGNAL(triggered()), mThumbsScene, SLOT(renameSelected()));
+        connect(am.action(DkActionManager::preview_batch), SIGNAL(triggered()), this, SLOT(batchProcessFiles()));
+        connect(am.action(DkActionManager::preview_print), SIGNAL(triggered()), this, SLOT(batchPrint()));
 
-void DkThumbScrollWidget::setFilterFocus() const {
+        connect(mFilterEdit, SIGNAL(textChanged(const QString &)), this, SIGNAL(filterChangedSignal(const QString &)));
+        connect(mView, SIGNAL(updateDirSignal(const QString &)), this, SIGNAL(updateDirSignal(const QString &)));
+        connect(mThumbsScene, SIGNAL(selectionChanged()), this, SLOT(enableSelectionActions()));
+    } else {
+        disconnect(am.action(DkActionManager::preview_select_all), SIGNAL(triggered(bool)), mThumbsScene, SLOT(selectAllThumbs(bool)));
+        disconnect(am.action(DkActionManager::preview_zoom_in), SIGNAL(triggered()), mThumbsScene, SLOT(increaseThumbs()));
+        disconnect(am.action(DkActionManager::preview_zoom_out), SIGNAL(triggered()), mThumbsScene, SLOT(decreaseThumbs()));
+        disconnect(am.action(DkActionManager::preview_display_squares), SIGNAL(triggered(bool)), mThumbsScene, SLOT(toggleSquaredThumbs(bool)));
+        disconnect(am.action(DkActionManager::preview_show_labels), SIGNAL(triggered(bool)), mThumbsScene, SLOT(toggleThumbLabels(bool)));
+        disconnect(am.action(DkActionManager::preview_filter), SIGNAL(triggered()), this, SLOT(setFilterFocus()));
+        disconnect(am.action(DkActionManager::preview_delete), SIGNAL(triggered()), mThumbsScene, SLOT(deleteSelected()));
+        disconnect(am.action(DkActionManager::preview_copy), SIGNAL(triggered()), mThumbsScene, SLOT(copySelected()));
+        disconnect(am.action(DkActionManager::preview_paste), SIGNAL(triggered()), mThumbsScene, SLOT(pasteImages()));
+        disconnect(am.action(DkActionManager::preview_rename), SIGNAL(triggered()), mThumbsScene, SLOT(renameSelected()));
+        disconnect(am.action(DkActionManager::preview_batch), SIGNAL(triggered()), this, SLOT(batchProcessFiles()));
+        disconnect(am.action(DkActionManager::preview_print), SIGNAL(triggered()), this, SLOT(batchPrint()));
 
-	mFilterEdit->setFocus(Qt::MouseFocusReason);
+        disconnect(mFilterEdit, SIGNAL(textChanged(const QString &)), this, SIGNAL(filterChangedSignal(const QString &)));
+        disconnect(mView, SIGNAL(updateDirSignal(const QString &)), this, SIGNAL(updateDirSignal(const QString &)));
+        disconnect(mThumbsScene, SIGNAL(selectionChanged()), this, SLOT(enableSelectionActions()));
+    }
 }
 
-void DkThumbScrollWidget::resizeEvent(QResizeEvent *event) {
-
-	if (event->oldSize().width() != event->size().width() && isVisible())
-		mThumbsScene->updateLayout();
+void DkThumbScrollWidget::setFilterFocus() const
+{
+    mFilterEdit->setFocus(Qt::MouseFocusReason);
+}
 
-	DkFadeWidget::resizeEvent(event);
+void DkThumbScrollWidget::resizeEvent(QResizeEvent *event)
+{
+    if (event->oldSize().width() != event->size().width() && isVisible())
+        mThumbsScene->updateLayout();
 
+    DkFadeWidget::resizeEvent(event);
 }
 
-void DkThumbScrollWidget::contextMenuEvent(QContextMenuEvent *event) {
-
-	mContextMenu->exec(event->globalPos());
-	event->accept();
+void DkThumbScrollWidget::contextMenuEvent(QContextMenuEvent *event)
+{
+    mContextMenu->exec(event->globalPos());
+    event->accept();
 
-	//QGraphicsView::contextMenuEvent(event);
+    // QGraphicsView::contextMenuEvent(event);
 }
 
-void DkThumbScrollWidget::enableSelectionActions() {
+void DkThumbScrollWidget::enableSelectionActions()
+{
+    bool enable = !mThumbsScene->getSelectedFiles().isEmpty();
 
-	bool enable = !mThumbsScene->getSelectedFiles().isEmpty();
+    DkActionManager &am = DkActionManager::instance();
+    am.action(DkActionManager::preview_copy)->setEnabled(enable);
+    am.action(DkActionManager::preview_rename)->setEnabled(enable);
+    am.action(DkActionManager::preview_delete)->setEnabled(enable);
+    am.action(DkActionManager::preview_batch)->setEnabled(enable);
 
-	DkActionManager& am = DkActionManager::instance();
-	am.action(DkActionManager::preview_copy)->setEnabled(enable);
-	am.action(DkActionManager::preview_rename)->setEnabled(enable);
-	am.action(DkActionManager::preview_delete)->setEnabled(enable);
-	am.action(DkActionManager::preview_batch)->setEnabled(enable);
-
-	am.action(DkActionManager::preview_select_all)->setChecked(mThumbsScene->allThumbsSelected());
+    am.action(DkActionManager::preview_select_all)->setChecked(mThumbsScene->allThumbsSelected());
 }
 
 // DkThumbPreviewLabel --------------------------------------------------------------------
-DkThumbPreviewLabel::DkThumbPreviewLabel(const QString& filePath, int thumbSize, QWidget* parent /* = 0 */, Qt::WindowFlags f /* = 0 */) : QLabel(parent, f) {
-
-	mThumbSize = thumbSize;
+DkThumbPreviewLabel::DkThumbPreviewLabel(const QString &filePath, int thumbSize, QWidget *parent /* = 0 */, Qt::WindowFlags f /* = 0 */)
+    : QLabel(parent, f)
+{
+    mThumbSize = thumbSize;
 
-	mThumb = QSharedPointer<DkThumbNailT>(new DkThumbNailT(filePath));
-	connect(mThumb.data(), SIGNAL(thumbLoadedSignal()), this, SLOT(thumbLoaded()));
+    mThumb = QSharedPointer<DkThumbNailT>(new DkThumbNailT(filePath));
+    connect(mThumb.data(), SIGNAL(thumbLoadedSignal()), this, SLOT(thumbLoaded()));
 
-	setFixedSize(mThumbSize, mThumbSize);
-	setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
-	setStatusTip(filePath);
-	
-	QFileInfo fInfo(filePath);
-	setToolTip(fInfo.fileName());
+    setFixedSize(mThumbSize, mThumbSize);
+    setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
+    setStatusTip(filePath);
+
+    QFileInfo fInfo(filePath);
+    setToolTip(fInfo.fileName());
+
+    mThumb->fetchThumb(DkThumbNail::force_exif_thumb);
+}
+
+void DkThumbPreviewLabel::thumbLoaded()
+{
+    if (mThumb->getImage().isNull()) {
+        setProperty("empty", true); // apply empty style
+        style()->unpolish(this);
+        style()->polish(this);
+        update();
 
-	mThumb->fetchThumb(DkThumbNail::force_exif_thumb);
-}
+        return;
+    }
 
-void DkThumbPreviewLabel::thumbLoaded() {
+    QPixmap pm = QPixmap::fromImage(mThumb->getImage());
+    pm = DkImage::makeSquare(pm);
+
+    if (pm.width() > width())
+        pm = pm.scaled(size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
 
-	if (mThumb->getImage().isNull()) {
-		setProperty("empty", true);	// apply empty style
-		style()->unpolish(this);
-		style()->polish(this);
-		update();
-
-		return;
-	}
-
-	QPixmap pm = QPixmap::fromImage(mThumb->getImage());
-	pm = DkImage::makeSquare(pm);
-	
-	if (pm.width() > width())
-		pm = pm.scaled(size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
-
-	setPixmap(pm);
+    setPixmap(pm);
 }
 
-void DkThumbPreviewLabel::mousePressEvent(QMouseEvent *ev) {
+void DkThumbPreviewLabel::mousePressEvent(QMouseEvent *ev)
+{
+    emit loadFileSignal(mThumb->getFilePath(), ev->modifiers() == Qt::ControlModifier);
 
-	emit loadFileSignal(mThumb->getFilePath(), ev->modifiers() == Qt::ControlModifier);
-
-	// do not propagate
-	//QLabel::mousePressEvent(ev);
+    // do not propagate
+    // QLabel::mousePressEvent(ev);
 }
 
-// -------------------------------------------------------------------- DkRecentFilesEntry 
-DkRecentDirWidget::DkRecentDirWidget(const DkRecentDir& rde, QWidget* parent) : DkFadeWidget(parent) {
-
-	mRecentDir = rde;
+// -------------------------------------------------------------------- DkRecentFilesEntry
+DkRecentDirWidget::DkRecentDirWidget(const DkRecentDir &rde, QWidget *parent)
+    : DkFadeWidget(parent)
+{
+    mRecentDir = rde;
 
-	createLayout();
-	QMetaObject::connectSlotsByName(this);
+    createLayout();
+    QMetaObject::connectSlotsByName(this);
 }
 
-void DkRecentDirWidget::createLayout() {
+void DkRecentDirWidget::createLayout()
+{
+    QLabel *dirNameLabel = new QLabel(mRecentDir.dirName(), this);
+    dirNameLabel->setAlignment(Qt::AlignBottom);
+    dirNameLabel->setObjectName("recentFilesTitle");
 
-	QLabel* dirNameLabel = new QLabel(mRecentDir.dirName(), this);
-	dirNameLabel->setAlignment(Qt::AlignBottom);
-	dirNameLabel->setObjectName("recentFilesTitle");
+    // create buttons
+    mButtons.resize(button_end);
 
-	// create buttons
-	mButtons.resize(button_end);
+    mButtons[button_load_dir] = new QPushButton(DkImage::loadIcon(":/nomacs/img/dir.svg"), "", this);
+    mButtons[button_load_dir]->setToolTip(tr("Load the directory"));
+    mButtons[button_load_dir]->setObjectName("load_dir");
+    mButtons[button_load_dir]->setFlat(true);
+    mButtons[button_load_dir]->hide();
 
-	mButtons[button_load_dir] = new QPushButton(DkImage::loadIcon(":/nomacs/img/dir.svg"), "", this);
-	mButtons[button_load_dir]->setToolTip(tr("Load the directory"));
-	mButtons[button_load_dir]->setObjectName("load_dir");
-	mButtons[button_load_dir]->setFlat(true);
-	mButtons[button_load_dir]->hide();
+    QIcon pIcon;
+    pIcon.addPixmap(DkImage::loadIcon(":/nomacs/img/pin-checked.svg"), QIcon::Normal, QIcon::On);
+    pIcon.addPixmap(DkImage::loadIcon(":/nomacs/img/pin.svg"), QIcon::Normal, QIcon::Off);
 
-	QIcon pIcon;
-	pIcon.addPixmap(DkImage::loadIcon(":/nomacs/img/pin-checked.svg"), QIcon::Normal, QIcon::On);
-	pIcon.addPixmap(DkImage::loadIcon(":/nomacs/img/pin.svg"), QIcon::Normal, QIcon::Off);
+    mButtons[button_pin] = new QPushButton(pIcon, "", this);
+    mButtons[button_pin]->setToolTip(tr("Pin this directory"));
+    mButtons[button_pin]->setObjectName("pin");
+    mButtons[button_pin]->setCheckable(true);
+    mButtons[button_pin]->setChecked(mRecentDir.isPinned());
+    mButtons[button_pin]->setFlat(true);
+    mButtons[button_pin]->hide();
 
-	mButtons[button_pin] = new QPushButton(pIcon, "", this);
-	mButtons[button_pin]->setToolTip(tr("Pin this directory"));
-	mButtons[button_pin]->setObjectName("pin");
-	mButtons[button_pin]->setCheckable(true);
-	mButtons[button_pin]->setChecked(mRecentDir.isPinned());
-	mButtons[button_pin]->setFlat(true);
-	mButtons[button_pin]->hide();
+    mButtons[button_remove] = new QPushButton(DkImage::loadIcon(":/nomacs/img/close.svg"), "", this);
+    mButtons[button_remove]->setToolTip(tr("Remove this directory"));
+    mButtons[button_remove]->setObjectName("remove");
+    mButtons[button_remove]->setFlat(true);
+    mButtons[button_remove]->hide();
 
-	mButtons[button_remove] = new QPushButton(DkImage::loadIcon(":/nomacs/img/close.svg"), "", this);
-	mButtons[button_remove]->setToolTip(tr("Remove this directory"));
-	mButtons[button_remove]->setObjectName("remove");
-	mButtons[button_remove]->setFlat(true);
-	mButtons[button_remove]->hide();
+    QVector<DkThumbPreviewLabel *> tls;
 
-	QVector<DkThumbPreviewLabel*> tls;
+    // check if the folder exists (in the current context)
+    // this should fix issues with disconnected samba drives on windows
+    if (DkUtils::exists(mRecentDir.firstFilePath(), 30)) {
+        for (auto tp : mRecentDir.filePaths(4)) {
+            auto tpl = new DkThumbPreviewLabel(tp, 42, this);
+            connect(tpl, SIGNAL(loadFileSignal(const QString &, bool)), this, SIGNAL(loadFileSignal(const QString &, bool)));
+            tls << tpl;
+        }
+    } else {
+        qInfo() << mRecentDir.firstFilePath() << "does not exist - according to a fast check";
+    }
 
-	// check if the folder exists (in the current context)
-	// this should fix issues with disconnected samba drives on windows
-	if (DkUtils::exists(mRecentDir.firstFilePath(), 30)) {
+    QLabel *pathLabel = new QLabel(mRecentDir.dirPath(), this);
+    pathLabel->setAlignment(Qt::AlignLeft);
+    pathLabel->setObjectName("recentFilesPath");
 
-		for (auto tp : mRecentDir.filePaths(4)) {
-			auto tpl = new DkThumbPreviewLabel(tp, 42, this);
-			connect(tpl, SIGNAL(loadFileSignal(const QString&, bool)), this, SIGNAL(loadFileSignal(const QString&, bool)));
-			tls << tpl;
-		}
-	}
-	else {
-		qInfo() << mRecentDir.firstFilePath() << "does not exist - according to a fast check";
-	}
+    QGridLayout *layout = new QGridLayout(this);
+    layout->setAlignment(Qt::AlignLeft);
+    layout->addWidget(dirNameLabel, 1, 0, 1, tls.size() + 1);
+    layout->setColumnStretch(tls.size() + 2, 1);
+    layout->addWidget(mButtons[button_load_dir], 1, tls.size() + 3);
+    layout->addWidget(mButtons[button_pin], 1, tls.size() + 4);
+    layout->addWidget(mButtons[button_remove], 1, tls.size() + 5);
+    layout->addWidget(pathLabel, 2, tls.size(), 1, 6);
 
-	QLabel* pathLabel = new QLabel(mRecentDir.dirPath(), this);
-	pathLabel->setAlignment(Qt::AlignLeft);
-	pathLabel->setObjectName("recentFilesPath");
+    for (int idx = 0; idx < tls.size(); idx++)
+        layout->addWidget(tls[idx], 2, idx, Qt::AlignTop);
 
-	QGridLayout* layout = new QGridLayout(this);
-	layout->setAlignment(Qt::AlignLeft);
-	layout->addWidget(dirNameLabel, 1, 0, 1, tls.size()+1);
-	layout->setColumnStretch(tls.size()+2, 1);
-	layout->addWidget(mButtons[button_load_dir], 1, tls.size() + 3);
-	layout->addWidget(mButtons[button_pin], 1, tls.size() + 4);
-	layout->addWidget(mButtons[button_remove], 1, tls.size() + 5);
-	layout->addWidget(pathLabel, 2, tls.size(), 1, 6);
+    show();
+    setCursor(Qt::PointingHandCursor);
 
-	for (int idx = 0; idx < tls.size(); idx++)
-		layout->addWidget(tls[idx], 2, idx, Qt::AlignTop);
-
-	show();
-	setCursor(Qt::PointingHandCursor);
-
-	setToolTip(mRecentDir.dirPath());
-	setStatusTip(mRecentDir.dirPath());
+    setToolTip(mRecentDir.dirPath());
+    setStatusTip(mRecentDir.dirPath());
 }
 
-void DkRecentDirWidget::on_pin_clicked(bool checked) {
-
-	if (checked) {
-		DkSettingsManager::param().global().pinnedFiles << mRecentDir.filePaths();
-	}
-	else {
-		for (const QString& fp : mRecentDir.filePaths())
-			DkSettingsManager::param().global().pinnedFiles.removeAll(fp);
-	}
+void DkRecentDirWidget::on_pin_clicked(bool checked)
+{
+    if (checked) {
+        DkSettingsManager::param().global().pinnedFiles << mRecentDir.filePaths();
+    } else {
+        for (const QString &fp : mRecentDir.filePaths())
+            DkSettingsManager::param().global().pinnedFiles.removeAll(fp);
+    }
 }
 
-void DkRecentDirWidget::on_remove_clicked() {
-
-	mRecentDir.remove();
-	emit removeSignal();
+void DkRecentDirWidget::on_remove_clicked()
+{
+    mRecentDir.remove();
+    emit removeSignal();
 }
 
-void DkRecentDirWidget::on_load_dir_clicked() {
-
-	emit loadDirSignal(mRecentDir.dirPath());
+void DkRecentDirWidget::on_load_dir_clicked()
+{
+    emit loadDirSignal(mRecentDir.dirPath());
 }
 
-void DkRecentDirWidget::mousePressEvent(QMouseEvent * event) {
-	
-	if (event->button() == Qt::LeftButton && !mRecentDir.isEmpty()) {
-		emit loadFileSignal(mRecentDir.firstFilePath(), event->modifiers() == Qt::ControlModifier);
-	}
+void DkRecentDirWidget::mousePressEvent(QMouseEvent *event)
+{
+    if (event->button() == Qt::LeftButton && !mRecentDir.isEmpty()) {
+        emit loadFileSignal(mRecentDir.firstFilePath(), event->modifiers() == Qt::ControlModifier);
+    }
 
-	DkFadeWidget::mousePressEvent(event);
+    DkFadeWidget::mousePressEvent(event);
 }
 
-void DkRecentDirWidget::enterEvent(QEvent * event) {
-
-	for (auto b : mButtons)
-		b->show();
+void DkRecentDirWidget::enterEvent(QEvent *event)
+{
+    for (auto b : mButtons)
+        b->show();
 
-	DkFadeWidget::enterEvent(event);
+    DkFadeWidget::enterEvent(event);
 }
 
-void DkRecentDirWidget::leaveEvent(QEvent * event) {
+void DkRecentDirWidget::leaveEvent(QEvent *event)
+{
+    for (auto b : mButtons)
+        b->hide();
 
-	for (auto b : mButtons)
-		b->hide();
-
-	DkFadeWidget::leaveEvent(event);
+    DkFadeWidget::leaveEvent(event);
 }
 
-// -------------------------------------------------------------------- DkRecentFilesEntry 
-DkRecentFilesWidget::DkRecentFilesWidget(QWidget* parent) : DkFadeWidget(parent) {
-
-	createLayout();
-	setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+// -------------------------------------------------------------------- DkRecentFilesEntry
+DkRecentFilesWidget::DkRecentFilesWidget(QWidget *parent)
+    : DkFadeWidget(parent)
+{
+    createLayout();
+    setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
 }
 
-void DkRecentFilesWidget::setVisible(bool visible) {
-
-	if (visible)
-		updateList();
+void DkRecentFilesWidget::setVisible(bool visible)
+{
+    if (visible)
+        updateList();
 
-	DkFadeWidget::setVisible(visible);
+    DkFadeWidget::setVisible(visible);
 }
 
-void DkRecentFilesWidget::createLayout() {
+void DkRecentFilesWidget::createLayout()
+{
+    mScrollArea = new QScrollArea(this);
+    QVBoxLayout *sl = new QVBoxLayout(this);
+    sl->addWidget(mScrollArea);
+    sl->setContentsMargins(0, 0, 0, 0);
 
-	mScrollArea = new QScrollArea(this);
-	QVBoxLayout* sl = new QVBoxLayout(this);
-	sl->addWidget(mScrollArea);
-	sl->setContentsMargins(0, 0, 0, 0);
+    mScrollArea->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
 
-	mScrollArea->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
-
-	//updateList();
+    // updateList();
 }
 
-void DkRecentFilesWidget::updateList() {
+void DkRecentFilesWidget::updateList()
+{
+    DkTimer dt;
 
-	DkTimer dt;
+    DkRecentDirManager fm;
 
-	DkRecentDirManager fm;
+    QWidget *dummy = new QWidget(this);
+    QVBoxLayout *l = new QVBoxLayout(dummy);
 
-	QWidget* dummy = new QWidget(this);
-	QVBoxLayout* l = new QVBoxLayout(dummy);
+    QVector<DkRecentDirWidget *> recentFiles;
+    int idx = 0;
 
-	QVector<DkRecentDirWidget*> recentFiles;
-	int idx = 0;
+    for (auto rd : fm.recentDirs()) {
+        DkRecentDirWidget *rf = new DkRecentDirWidget(rd, dummy);
+        rf->setMaximumWidth(500);
+        connect(rf, SIGNAL(loadFileSignal(const QString &, bool)), this, SIGNAL(loadFileSignal(const QString &, bool)));
+        connect(rf, SIGNAL(loadDirSignal(const QString &)), this, SIGNAL(loadDirSignal(const QString &)));
+        connect(rf, SIGNAL(removeSignal()), this, SLOT(entryRemoved()));
 
-	for (auto rd : fm.recentDirs()) {
-		
-		DkRecentDirWidget* rf = new DkRecentDirWidget(rd, dummy);
-		rf->setMaximumWidth(500);
-		connect(rf, SIGNAL(loadFileSignal(const QString&, bool)), this, SIGNAL(loadFileSignal(const QString&, bool)));
-		connect(rf, SIGNAL(loadDirSignal(const QString&)), this, SIGNAL(loadDirSignal(const QString&)));
-		connect(rf, SIGNAL(removeSignal()), this, SLOT(entryRemoved()));
-		
-		recentFiles << rf;
-		l->addWidget(rf);
-		idx++;
-	}
+        recentFiles << rf;
+        l->addWidget(rf);
+        idx++;
+    }
 
-	qInfo() << "list updated in" << dt;
+    qInfo() << "list updated in" << dt;
 
-	mScrollArea->setWidget(dummy);
+    mScrollArea->setWidget(dummy);
 }
 
-void DkRecentFilesWidget::entryRemoved() {
-
-	updateList();
+void DkRecentFilesWidget::entryRemoved()
+{
+    updateList();
 }
 
-// -------------------------------------------------------------------- DkRecentDir 
-DkRecentDir::DkRecentDir(const QStringList& filePaths, bool pinned) {
-	mFilePaths = filePaths;
-	mIsPinned = pinned;
+// -------------------------------------------------------------------- DkRecentDir
+DkRecentDir::DkRecentDir(const QStringList &filePaths, bool pinned)
+{
+    mFilePaths = filePaths;
+    mIsPinned = pinned;
 }
 
-bool DkRecentDir::operator==(const DkRecentDir& o) const {
-
-	return dirPath() == o.dirPath();
+bool DkRecentDir::operator==(const DkRecentDir &o) const
+{
+    return dirPath() == o.dirPath();
 }
 
-void DkRecentDir::update(const DkRecentDir & o) {
-
-	for (const QString& cp : o.filePaths())
-		mFilePaths.push_front(cp);
+void DkRecentDir::update(const DkRecentDir &o)
+{
+    for (const QString &cp : o.filePaths())
+        mFilePaths.push_front(cp);
 
-	mFilePaths.removeDuplicates();
+    mFilePaths.removeDuplicates();
 }
 
-QStringList DkRecentDir::filePaths(int max) const {
-
-	if (max <= 0)
-		return mFilePaths;
+QStringList DkRecentDir::filePaths(int max) const
+{
+    if (max <= 0)
+        return mFilePaths;
 
-	QStringList fps = mFilePaths;
+    QStringList fps = mFilePaths;
 
-	while (fps.size() > max)
-		fps.pop_back();
+    while (fps.size() > max)
+        fps.pop_back();
 
-	return fps;
+    return fps;
 }
 
-bool DkRecentDir::isEmpty() const {
-	return mFilePaths.isEmpty();
+bool DkRecentDir::isEmpty() const
+{
+    return mFilePaths.isEmpty();
 }
 
-bool DkRecentDir::isPinned() const {
-	return mIsPinned;
+bool DkRecentDir::isPinned() const
+{
+    return mIsPinned;
 }
 
-QString DkRecentDir::dirName() const {
-
-	QDir d(dirPath());
-	return d.dirName();
+QString DkRecentDir::dirName() const
+{
+    QDir d(dirPath());
+    return d.dirName();
 }
 
-QString DkRecentDir::dirPath() const {
-
-	if (mFilePaths.empty())
-		return QString("");
+QString DkRecentDir::dirPath() const
+{
+    if (mFilePaths.empty())
+        return QString("");
 
-	return QFileInfo(mFilePaths[0]).absolutePath();
+    return QFileInfo(mFilePaths[0]).absolutePath();
 }
 
-QString DkRecentDir::firstFilePath() const {
-	
-	if (!mFilePaths.isEmpty())
-		return mFilePaths[0];
-	
-	return QString();
-}
+QString DkRecentDir::firstFilePath() const
+{
+    if (!mFilePaths.isEmpty())
+        return mFilePaths[0];
 
-void DkRecentDir::remove() const {
-	
-	QStringList& pf = DkSettingsManager::param().global().pinnedFiles;
-	QStringList& rf = DkSettingsManager::param().global().recentFiles;
-
-	// remove from history
-	for (const QString& fp : mFilePaths) {
-		pf.removeAll(fp);
-		rf.removeAll(fp);
-	}
+    return QString();
 }
 
-// -------------------------------------------------------------------- DkRecentDirManager 
-DkRecentDirManager::DkRecentDirManager() {
-
-	// update pinned files
-	mDirs = genFileLists(DkSettingsManager::param().global().pinnedFiles, true);
-	auto recentDirs = genFileLists(DkSettingsManager::param().global().recentFiles);
+void DkRecentDir::remove() const
+{
+    QStringList &pf = DkSettingsManager::param().global().pinnedFiles;
+    QStringList &rf = DkSettingsManager::param().global().recentFiles;
 
-	for (auto rde : recentDirs) {
+    // remove from history
+    for (const QString &fp : mFilePaths) {
+        pf.removeAll(fp);
+        rf.removeAll(fp);
+    }
+}
 
-		if (!mDirs.contains(rde))
-			mDirs << rde;
-		else {
-			int idx = mDirs.indexOf(rde);
-			if (idx != -1)
-				mDirs[idx].update(rde);
-		}
+// -------------------------------------------------------------------- DkRecentDirManager
+DkRecentDirManager::DkRecentDirManager()
+{
+    // update pinned files
+    mDirs = genFileLists(DkSettingsManager::param().global().pinnedFiles, true);
+    auto recentDirs = genFileLists(DkSettingsManager::param().global().recentFiles);
 
-	}
+    for (auto rde : recentDirs) {
+        if (!mDirs.contains(rde))
+            mDirs << rde;
+        else {
+            int idx = mDirs.indexOf(rde);
+            if (idx != -1)
+                mDirs[idx].update(rde);
+        }
+    }
 }
 
-QList<DkRecentDir> DkRecentDirManager::recentDirs() const {
-	return mDirs;
+QList<DkRecentDir> DkRecentDirManager::recentDirs() const
+{
+    return mDirs;
 }
 
-QList<DkRecentDir> DkRecentDirManager::genFileLists(const QStringList & filePaths, bool pinned) {
-
-	QMap<QString, QStringList> gPaths;
-
-	for (const QString& cp : filePaths) {
+QList<DkRecentDir> DkRecentDirManager::genFileLists(const QStringList &filePaths, bool pinned)
+{
+    QMap<QString, QStringList> gPaths;
 
-		QFileInfo fi(cp);
+    for (const QString &cp : filePaths) {
+        QFileInfo fi(cp);
 
-		// this if is needed if there are errors in our data
-		// however, it incredibly slows down the process if samba mounts are lost
-		//if (!fi.isFile())
-		//	continue;
-		
-		// get folder
-		QString dp = fi.absolutePath();
+        // this if is needed if there are errors in our data
+        // however, it incredibly slows down the process if samba mounts are lost
+        // if (!fi.isFile())
+        //	continue;
 
-		auto dir = gPaths.find(dp);
+        // get folder
+        QString dp = fi.absolutePath();
 
-		// ok, create a new entry
-		if (dir == gPaths.end()) {
-			QStringList cpl;
-			cpl << cp;
-			gPaths.insert(dp, cpl);
-		}
-		else {
+        auto dir = gPaths.find(dp);
 
-			// append the filename
-			dir.value() << cp;
-		}
-	}
+        // ok, create a new entry
+        if (dir == gPaths.end()) {
+            QStringList cpl;
+            cpl << cp;
+            gPaths.insert(dp, cpl);
+        } else {
+            // append the filename
+            dir.value() << cp;
+        }
+    }
 
-	// TODO: here is the issue reported in #279
-	// the map re-sorts the entries w.r.t to the path
-	// create recent directories
-	QList<DkRecentDir> rdes;
-	for (const QStringList& fps : gPaths.values())
-		rdes << DkRecentDir(fps, pinned);
+    // TODO: here is the issue reported in #279
+    // the map re-sorts the entries w.r.t to the path
+    // create recent directories
+    QList<DkRecentDir> rdes;
+    for (const QStringList &fps : gPaths.values())
+        rdes << DkRecentDir(fps, pinned);
 
-	return rdes;
+    return rdes;
 }
 
 }
diff --git a/ImageLounge/src/DkGui/DkThumbsWidgets.h b/ImageLounge/src/DkGui/DkThumbsWidgets.h
index 4bc7db0..706980c 100644
--- a/ImageLounge/src/DkGui/DkThumbsWidgets.h
+++ b/ImageLounge/src/DkGui/DkThumbsWidgets.h
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkThumbsWidgets.h
  Created on:	18.09.2014
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2014 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2014 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2014 Florian Kleber <florian@nomacs.org>
@@ -27,16 +27,16 @@
 
 #pragma once
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QProcess>
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QDrag>
-#include <QSharedPointer>
 #include <QFileInfo>
 #include <QGraphicsObject>
-#include <QPen>
 #include <QGraphicsScene>
 #include <QGraphicsView>
-#pragma warning(pop)		// no warnings from includes - end
+#include <QPen>
+#include <QProcess>
+#include <QSharedPointer>
+#pragma warning(pop) // no warnings from includes - end
 
 #include "DkBaseWidgets.h"
 #include "DkImageContainer.h"
@@ -56,410 +56,421 @@ class QMenu;
 class QToolBar;
 class QLineEdit;
 
-namespace nmc {
+namespace nmc
+{
 
 // nomacs defines
 class DkImageLoader;
 
-class DkFilePreview : public DkFadeWidget {
-	Q_OBJECT
+class DkFilePreview : public DkFadeWidget
+{
+    Q_OBJECT
 
 public:
-
-	enum {
-		cm_pos_west,
-		cm_pos_north,
-		cm_pos_east,
-		cm_pos_south,
-		cm_pos_dock_hor,
-		cm_pos_dock_ver,
-
-		cm_end,
-	};
-
-	DkFilePreview(QWidget* parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
-
-	~DkFilePreview() {
-		saveSettings();
-	};
-
-	void setCurrentDx(float dx) {
-		scrollToCurrentImage = false;	// external move events
-		currentDx = dx;
-	};
-
-	QTimer* getMoveImageTimer() {
-		return moveImageTimer;
-	};
-
-	void setVisible(bool visible, bool saveSettings = true) override;
-
-	void setWindowPosition(int position) {
-
-		windowPosition = position;
-		initOrientations();
-	};
-
-	int getWindowPosition() {
-
-		return windowPosition;
-	};
+    enum {
+        cm_pos_west,
+        cm_pos_north,
+        cm_pos_east,
+        cm_pos_south,
+        cm_pos_dock_hor,
+        cm_pos_dock_ver,
+
+        cm_end,
+    };
+
+    DkFilePreview(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
+
+    ~DkFilePreview()
+    {
+        saveSettings();
+    };
+
+    void setCurrentDx(float dx)
+    {
+        scrollToCurrentImage = false; // external move events
+        currentDx = dx;
+    };
+
+    QTimer *getMoveImageTimer()
+    {
+        return moveImageTimer;
+    };
+
+    void setVisible(bool visible, bool saveSettings = true) override;
+
+    void setWindowPosition(int position)
+    {
+        windowPosition = position;
+        initOrientations();
+    };
+
+    int getWindowPosition()
+    {
+        return windowPosition;
+    };
 
 public slots:
-	void moveImages();
-	void updateFileIdx(int fileIdx);
-	void updateThumbs(QVector<QSharedPointer<DkImageContainerT> > thumbs);
-	void setFileInfo(QSharedPointer<DkImageContainerT> cImage);
-	void newPosition();
+    void moveImages();
+    void updateFileIdx(int fileIdx);
+    void updateThumbs(QVector<QSharedPointer<DkImageContainerT>> thumbs);
+    void setFileInfo(QSharedPointer<DkImageContainerT> cImage);
+    void newPosition();
 
 signals:
-	void loadFileSignal(const QString& filePath) const;
-	void changeFileSignal(int idx) const;
-	void positionChangeSignal(int pos) const;
-	void showThumbsDockSignal(bool show) const;
+    void loadFileSignal(const QString &filePath) const;
+    void changeFileSignal(int idx) const;
+    void positionChangeSignal(int pos) const;
+    void showThumbsDockSignal(bool show) const;
 
 protected:
-	void paintEvent(QPaintEvent *event) override;
-	void resizeEvent(QResizeEvent *event) override;
-	void mouseMoveEvent(QMouseEvent *event) override;
-	void mousePressEvent(QMouseEvent *event) override;
-	void mouseReleaseEvent(QMouseEvent *event) override;
-	void wheelEvent(QWheelEvent *event) override;
-	void leaveEvent(QEvent *event) override;
-	void contextMenuEvent(QContextMenuEvent *event) override;
-	void loadSettings();
-	void saveSettings();
+    void paintEvent(QPaintEvent *event) override;
+    void resizeEvent(QResizeEvent *event) override;
+    void mouseMoveEvent(QMouseEvent *event) override;
+    void mousePressEvent(QMouseEvent *event) override;
+    void mouseReleaseEvent(QMouseEvent *event) override;
+    void wheelEvent(QWheelEvent *event) override;
+    void leaveEvent(QEvent *event) override;
+    void contextMenuEvent(QContextMenuEvent *event) override;
+    void loadSettings();
+    void saveSettings();
 
 private:
-	QVector<QSharedPointer<DkImageContainerT> > mThumbs;
-	QTransform worldMatrix;
-
-	QPoint lastMousePos;
-	QPoint enterPos;
-	Qt::Orientation orientation;
-	QTimer* moveImageTimer;
-
-	QRectF bufferDim;
-	QVector<QRectF> thumbRects;
-
-	QLinearGradient leftGradient;
-	QLinearGradient rightGradient;
-	//QPixmap selectedImg;
-	//QPixmap currentImg;
-
-	int mouseTrace;
-	QFileInfo currentFile;
-	int currentFileIdx;
-	int oldFileIdx;
-	float currentDx;
-	QLabel* wheelButton;
-
-	int selected;
-	float winPercent;
-	float borderTrigger;
-
-	int xOffset;
-	int yOffset;
-	int minHeight;
-
-	int windowPosition;
-
-	QRectF newFileRect;
-	bool scrollToCurrentImage;
-	bool isPainted;
-
-	QMenu* contextMenu;
-	QVector<QAction*> contextMenuActions;
-
-	void init();
-	void initOrientations();
-	void drawThumbs(QPainter* painter);
-	void drawFadeOut(QLinearGradient gradient, QRectF imgRect, QImage *img);
-	void drawSelectedEffect(QPainter* painter, const QRectF& r);
-	void drawCurrentImgEffect(QPainter* painter, const QRectF& r);
-	void drawNoImgEffect(QPainter* painter, const QRectF& r);
-	void createContextMenu();
+    QVector<QSharedPointer<DkImageContainerT>> mThumbs;
+    QTransform worldMatrix;
+
+    QPoint lastMousePos;
+    QPoint enterPos;
+    Qt::Orientation orientation;
+    QTimer *moveImageTimer;
+
+    QRectF bufferDim;
+    QVector<QRectF> thumbRects;
+
+    QLinearGradient leftGradient;
+    QLinearGradient rightGradient;
+    // QPixmap selectedImg;
+    // QPixmap currentImg;
+
+    int mouseTrace;
+    QFileInfo currentFile;
+    int currentFileIdx;
+    int oldFileIdx;
+    float currentDx;
+    QLabel *wheelButton;
+
+    int selected;
+    float winPercent;
+    float borderTrigger;
+
+    int xOffset;
+    int yOffset;
+    int minHeight;
+
+    int windowPosition;
+
+    QRectF newFileRect;
+    bool scrollToCurrentImage;
+    bool isPainted;
+
+    QMenu *contextMenu;
+    QVector<QAction *> contextMenuActions;
+
+    void init();
+    void initOrientations();
+    void drawThumbs(QPainter *painter);
+    void drawFadeOut(QLinearGradient gradient, QRectF imgRect, QImage *img);
+    void drawSelectedEffect(QPainter *painter, const QRectF &r);
+    void drawCurrentImgEffect(QPainter *painter, const QRectF &r);
+    void drawNoImgEffect(QPainter *painter, const QRectF &r);
+    void createContextMenu();
 };
 
-class DkThumbLabel : public QGraphicsObject {
-	Q_OBJECT
+class DkThumbLabel : public QGraphicsObject
+{
+    Q_OBJECT
 
 public:
-	DkThumbLabel(QSharedPointer<DkThumbNailT> thumb = QSharedPointer<DkThumbNailT>(), QGraphicsItem* parent = 0);
-	~DkThumbLabel();
-
-	void setThumb(QSharedPointer<DkThumbNailT> thumb);
-	QSharedPointer<DkThumbNailT> getThumb() {return mThumb;};
-	QRectF boundingRect() const override;
-	QPainterPath shape() const override;
-	void updateSize();
-	void setVisible(bool visible);
-	QPixmap pixmap() const;
-	void cancelLoading();
+    DkThumbLabel(QSharedPointer<DkThumbNailT> thumb = QSharedPointer<DkThumbNailT>(), QGraphicsItem *parent = 0);
+    ~DkThumbLabel();
+
+    void setThumb(QSharedPointer<DkThumbNailT> thumb);
+    QSharedPointer<DkThumbNailT> getThumb()
+    {
+        return mThumb;
+    };
+    QRectF boundingRect() const override;
+    QPainterPath shape() const override;
+    void updateSize();
+    void setVisible(bool visible);
+    QPixmap pixmap() const;
+    void cancelLoading();
 
 public slots:
-	void updateLabel();
+    void updateLabel();
 
 signals:
-	void loadFileSignal(const QString& filePath, bool newTab) const;
-	void showFileSignal(const QString& filePath = QString()) const;
+    void loadFileSignal(const QString &filePath, bool newTab) const;
+    void showFileSignal(const QString &filePath = QString()) const;
 
 protected:
-	void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override;
-	void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget * widget = 0) override;
-	void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
-	void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override;
-
-	QSharedPointer<DkThumbNailT> mThumb;
-	QGraphicsPixmapItem mIcon;
-	QGraphicsTextItem mText;
-	bool mThumbInitialized = false;
-	bool mFetchingThumb = false;
-	QPen mNoImagePen;
-	QBrush mNoImageBrush;
-	QPen mSelectPen;
-	QBrush mSelectBrush;
-	bool mIsHovered = false;
-	QPointF mLastMove;
+    void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override;
+    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override;
+    void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
+    void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override;
+
+    QSharedPointer<DkThumbNailT> mThumb;
+    QGraphicsPixmapItem mIcon;
+    QGraphicsTextItem mText;
+    bool mThumbInitialized = false;
+    bool mFetchingThumb = false;
+    QPen mNoImagePen;
+    QBrush mNoImageBrush;
+    QPen mSelectPen;
+    QBrush mSelectBrush;
+    bool mIsHovered = false;
+    QPointF mLastMove;
 };
 
-class DllCoreExport DkThumbScene : public QGraphicsScene {
-	Q_OBJECT
+class DllCoreExport DkThumbScene : public QGraphicsScene
+{
+    Q_OBJECT
 
 public:
-	DkThumbScene(QWidget* parent = 0);
-
-	void updateLayout();
-	QStringList getSelectedFiles() const;
-	QVector<DkThumbLabel*> getSelectedThumbs() const;
-	int selectedThumbIndex(bool first = true);
-
-	void setImageLoader(QSharedPointer<DkImageLoader> loader);
-	void copyImages(const QMimeData* mimeData, const Qt::DropAction& da = Qt::CopyAction) const;
-	int findThumb(DkThumbLabel* thumb) const;
-	bool allThumbsSelected() const;
-	void ensureVisible(QSharedPointer<DkImageContainerT> img) const;
-	QString currentDir() const;
-	
+    DkThumbScene(QWidget *parent = 0);
+
+    void updateLayout();
+    QStringList getSelectedFiles() const;
+    QVector<DkThumbLabel *> getSelectedThumbs() const;
+    int selectedThumbIndex(bool first = true);
+
+    void setImageLoader(QSharedPointer<DkImageLoader> loader);
+    void copyImages(const QMimeData *mimeData, const Qt::DropAction &da = Qt::CopyAction) const;
+    int findThumb(DkThumbLabel *thumb) const;
+    bool allThumbsSelected() const;
+    void ensureVisible(QSharedPointer<DkImageContainerT> img) const;
+    QString currentDir() const;
+
 public slots:
-	void updateThumbLabels();
-	void cancelLoading();
-	void increaseThumbs();
-	void decreaseThumbs();
-	void toggleSquaredThumbs(bool squares);
-	void toggleThumbLabels(bool show);
-	void resizeThumbs(float dx);
-	void showFile(const QString& filePath = QString());
-	void selectThumbs(bool select = true, int from = 0, int to = -1);
-	void selectThumb(int idx, bool select = true);
-	void selectAllThumbs(bool select = true);
-	void updateThumbs(QVector<QSharedPointer<DkImageContainerT> > thumbs);
-	void deleteSelected() const;
-	void copySelected() const;
-	void pasteImages() const;
-	void renameSelected() const;
+    void updateThumbLabels();
+    void cancelLoading();
+    void increaseThumbs();
+    void decreaseThumbs();
+    void toggleSquaredThumbs(bool squares);
+    void toggleThumbLabels(bool show);
+    void resizeThumbs(float dx);
+    void showFile(const QString &filePath = QString());
+    void selectThumbs(bool select = true, int from = 0, int to = -1);
+    void selectThumb(int idx, bool select = true);
+    void selectAllThumbs(bool select = true);
+    void updateThumbs(QVector<QSharedPointer<DkImageContainerT>> thumbs);
+    void deleteSelected() const;
+    void copySelected() const;
+    void pasteImages() const;
+    void renameSelected() const;
 
 signals:
-	void loadFileSignal(const QString& filePath, bool newTab) const;
-	void statusInfoSignal(const QString& msg, int pos = 0) const;
-	void thumbLoadedSignal() const;
+    void loadFileSignal(const QString &filePath, bool newTab) const;
+    void statusInfoSignal(const QString &msg, int pos = 0) const;
+    void thumbLoadedSignal() const;
 
 protected:
-	void connectLoader(QSharedPointer<DkImageLoader> loader, bool connectSignals = true);
-	void keyPressEvent(QKeyEvent* event) override;
-	
-	int mXOffset = 0;
-	int mNumRows = 0;
-	int mNumCols = 0;
-	bool mFirstLayout = true;
-
-	QVector<DkThumbLabel* > mThumbLabels;
-	QSharedPointer<DkImageLoader> mLoader;
-	QVector<QSharedPointer<DkImageContainerT> > mThumbs;
+    void connectLoader(QSharedPointer<DkImageLoader> loader, bool connectSignals = true);
+    void keyPressEvent(QKeyEvent *event) override;
+
+    int mXOffset = 0;
+    int mNumRows = 0;
+    int mNumCols = 0;
+    bool mFirstLayout = true;
+
+    QVector<DkThumbLabel *> mThumbLabels;
+    QSharedPointer<DkImageLoader> mLoader;
+    QVector<QSharedPointer<DkImageContainerT>> mThumbs;
 };
 
-class DkThumbsView : public QGraphicsView {
-	Q_OBJECT
+class DkThumbsView : public QGraphicsView
+{
+    Q_OBJECT
 
 public:
-	DkThumbsView(DkThumbScene* scene, QWidget* parent = 0);
+    DkThumbsView(DkThumbScene *scene, QWidget *parent = 0);
 
 signals:
-	void updateDirSignal(const QString& dir) const;
+    void updateDirSignal(const QString &dir) const;
 
 public slots:
-	void fetchThumbs();
+    void fetchThumbs();
 
 protected:
-	void wheelEvent(QWheelEvent *event) override;
-	void dragEnterEvent(QDragEnterEvent *event) override;
-	void dropEvent(QDropEvent *event) override;
-	void dragMoveEvent(QDragMoveEvent *event) override;
-	void mousePressEvent(QMouseEvent *event) override;
-	void mouseMoveEvent(QMouseEvent *event) override;
-	void mouseReleaseEvent(QMouseEvent *event) override;
-
-	DkThumbScene* scene;
-	QPointF mousePos;
-	int lastShiftIdx;
-
+    void wheelEvent(QWheelEvent *event) override;
+    void dragEnterEvent(QDragEnterEvent *event) override;
+    void dropEvent(QDropEvent *event) override;
+    void dragMoveEvent(QDragMoveEvent *event) override;
+    void mousePressEvent(QMouseEvent *event) override;
+    void mouseMoveEvent(QMouseEvent *event) override;
+    void mouseReleaseEvent(QMouseEvent *event) override;
+
+    DkThumbScene *scene;
+    QPointF mousePos;
+    int lastShiftIdx;
 };
 
-class DllCoreExport DkThumbScrollWidget : public DkFadeWidget {
-	Q_OBJECT
+class DllCoreExport DkThumbScrollWidget : public DkFadeWidget
+{
+    Q_OBJECT
 
 public:
-	DkThumbScrollWidget(QWidget* parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
+    DkThumbScrollWidget(QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
 
-	DkThumbScene* getThumbWidget() {
-		return mThumbsScene;
-	};
+    DkThumbScene *getThumbWidget()
+    {
+        return mThumbsScene;
+    };
 
-	void clear();
+    void clear();
 
 public slots:
-	virtual void setVisible(bool visible) override;
-	void updateThumbs(QVector<QSharedPointer<DkImageContainerT> > thumbs);
-	void setDir(const QString& dirPath);
-	void enableSelectionActions();
-	void setFilterFocus() const;
-	void batchProcessFiles() const;
-	void batchPrint() const;
-	void on_loadFile_triggered();
+    virtual void setVisible(bool visible) override;
+    void updateThumbs(QVector<QSharedPointer<DkImageContainerT>> thumbs);
+    void setDir(const QString &dirPath);
+    void enableSelectionActions();
+    void setFilterFocus() const;
+    void batchProcessFiles() const;
+    void batchPrint() const;
+    void on_loadFile_triggered();
 
 signals:
-	void updateDirSignal(const QString& dir);
-	void filterChangedSignal(const QString& filters);
-	void batchProcessFilesSignal(const QStringList& fileList) const;
+    void updateDirSignal(const QString &dir);
+    void filterChangedSignal(const QString &filters);
+    void batchProcessFilesSignal(const QStringList &fileList) const;
 
 protected:
-	void createActions();
-	void createToolbar();
-	void resizeEvent(QResizeEvent *event) override;
-	void contextMenuEvent(QContextMenuEvent *event) override;
-	void connectToActions(bool activate = true);
-
-	DkThumbScene* mThumbsScene = 0;
-	DkThumbsView* mView = 0;
-
-	QMenu* mContextMenu = 0;
-	QToolBar* mToolbar = 0;
-	QLineEdit* mFilterEdit = 0;
+    void createActions();
+    void createToolbar();
+    void resizeEvent(QResizeEvent *event) override;
+    void contextMenuEvent(QContextMenuEvent *event) override;
+    void connectToActions(bool activate = true);
+
+    DkThumbScene *mThumbsScene = 0;
+    DkThumbsView *mView = 0;
+
+    QMenu *mContextMenu = 0;
+    QToolBar *mToolbar = 0;
+    QLineEdit *mFilterEdit = 0;
 };
 
-class DkRecentDir {
-
+class DkRecentDir
+{
 public:
-	DkRecentDir(const QStringList& filePaths = QStringList(), bool pinned = false);
+    DkRecentDir(const QStringList &filePaths = QStringList(), bool pinned = false);
+
+    bool operator==(const DkRecentDir &o) const;
+    void update(const DkRecentDir &o);
+
+    bool isEmpty() const;
+    bool isPinned() const;
 
-	bool operator==(const DkRecentDir& o) const;
-	void update(const DkRecentDir& o);
+    QString dirName() const;
+    QString dirPath() const;
+    QString firstFilePath() const;
+    QStringList filePaths(int max = -1) const;
 
-	bool isEmpty() const;
-	bool isPinned() const;
-	
-	QString dirName() const;
-	QString dirPath() const;
-	QString firstFilePath() const;
-	QStringList filePaths(int max = -1) const;
-	
-	void remove() const;
+    void remove() const;
 
 private:
-	QStringList mFilePaths;
-	bool mIsPinned = false;
+    QStringList mFilePaths;
+    bool mIsPinned = false;
 };
 
-class DkRecentDirManager {
-
+class DkRecentDirManager
+{
 public:
-	DkRecentDirManager();
+    DkRecentDirManager();
 
-	QList<DkRecentDir> recentDirs() const;
+    QList<DkRecentDir> recentDirs() const;
 
 private:
+    QList<DkRecentDir> genFileLists(const QStringList &filePaths, bool pinned = false);
 
-	QList<DkRecentDir> genFileLists(const QStringList& filePaths, bool pinned = false);
-	
-	QList<DkRecentDir> mDirs;
+    QList<DkRecentDir> mDirs;
 };
 
-class DkThumbPreviewLabel : public QLabel {
-	Q_OBJECT
+class DkThumbPreviewLabel : public QLabel
+{
+    Q_OBJECT
 
 public:
-	DkThumbPreviewLabel(const QString& filePath, int thumbSize = 100, QWidget* parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
+    DkThumbPreviewLabel(const QString &filePath, int thumbSize = 100, QWidget *parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
 
 signals:
-	void loadFileSignal(const QString& filePath, bool newTab);
+    void loadFileSignal(const QString &filePath, bool newTab);
 
 public slots:
-	void thumbLoaded();
+    void thumbLoaded();
 
 protected:
-	void mousePressEvent(QMouseEvent *ev) override;
+    void mousePressEvent(QMouseEvent *ev) override;
 
-	QSharedPointer<DkThumbNailT> mThumb;
-	int mThumbSize = 100;
+    QSharedPointer<DkThumbNailT> mThumb;
+    int mThumbSize = 100;
 };
 
-class DllCoreExport DkRecentDirWidget : public DkFadeWidget {
-	Q_OBJECT
+class DllCoreExport DkRecentDirWidget : public DkFadeWidget
+{
+    Q_OBJECT
 
 public:
-	DkRecentDirWidget(const DkRecentDir& rde, QWidget* parent = 0);
+    DkRecentDirWidget(const DkRecentDir &rde, QWidget *parent = 0);
 
 signals:
-	void loadFileSignal(const QString& filePath, bool newTab);
-	void loadDirSignal(const QString& filePath);
-	void removeSignal();
+    void loadFileSignal(const QString &filePath, bool newTab);
+    void loadDirSignal(const QString &filePath);
+    void removeSignal();
 
 public slots:
-	void on_pin_clicked(bool checked);
-	void on_remove_clicked();
-	void on_load_dir_clicked();
+    void on_pin_clicked(bool checked);
+    void on_remove_clicked();
+    void on_load_dir_clicked();
 
 protected:
-	DkRecentDir mRecentDir;
-	QVector<DkThumbLabel> mThumbs;
-	
-	enum {
-		button_load_dir = 0,
-		button_pin,
-		button_remove,
+    DkRecentDir mRecentDir;
+    QVector<DkThumbLabel> mThumbs;
 
-		button_end
-	};
+    enum {
+        button_load_dir = 0,
+        button_pin,
+        button_remove,
 
-	QVector<QPushButton*> mButtons;
+        button_end
+    };
 
-	void createLayout();
-	void mousePressEvent(QMouseEvent* event) override;
-	void enterEvent(QEvent* event) override;
-	void leaveEvent(QEvent* event) override;
+    QVector<QPushButton *> mButtons;
 
+    void createLayout();
+    void mousePressEvent(QMouseEvent *event) override;
+    void enterEvent(QEvent *event) override;
+    void leaveEvent(QEvent *event) override;
 };
 
-class DllCoreExport DkRecentFilesWidget : public DkFadeWidget {
-	Q_OBJECT
+class DllCoreExport DkRecentFilesWidget : public DkFadeWidget
+{
+    Q_OBJECT
 
 public:
-	DkRecentFilesWidget(QWidget* parent = 0);
+    DkRecentFilesWidget(QWidget *parent = 0);
 
 signals:
-	void loadFileSignal(const QString& filePath, bool newTab);
-	void loadDirSignal(const QString& filePath);
+    void loadFileSignal(const QString &filePath, bool newTab);
+    void loadDirSignal(const QString &filePath);
 
 public slots:
-	void entryRemoved();
-	void setVisible(bool visible) override;
+    void entryRemoved();
+    void setVisible(bool visible) override;
 
 protected:
-	void createLayout();
-	void updateList();
-	
-	QScrollArea* mScrollArea;
-};
+    void createLayout();
+    void updateList();
 
+    QScrollArea *mScrollArea;
+};
 
 }
diff --git a/ImageLounge/src/DkGui/DkToolbars.cpp b/ImageLounge/src/DkGui/DkToolbars.cpp
index dd450f5..f3cd9fe 100644
--- a/ImageLounge/src/DkGui/DkToolbars.cpp
+++ b/ImageLounge/src/DkGui/DkToolbars.cpp
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkTransferToolBar.cpp
  Created on:	13.02.2012
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -26,1039 +26,1327 @@
  *******************************************************************************************************/
 
 #include "DkToolbars.h"
-#include "DkSettings.h"
-#include "DkMath.h"
-#include "DkUtils.h"
+#include "DkActionManager.h"
+#include "DkBasicWidgets.h"
 #include "DkImageStorage.h"
+#include "DkMath.h"
 #include "DkQuickAccess.h"
-#include "DkBasicWidgets.h"
-#include "DkActionManager.h"
+#include "DkSettings.h"
+#include "DkUtils.h"
 
 #include <assert.h>
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QToolBar>
-#include <QWidget>
-#include <QObject>
-#include <QPainter>
-#include <QLinearGradient>
-#include <QImage>
-#include <QPainterPath>
-#include <QDebug>
-#include <QMouseEvent>
-#include <QColorDialog>
+#pragma warning(push, 0) // no warnings from includes - begin
+#include <QAction>
+#include <QCheckBox>
 #include <QColor>
-#include <QGradientStops>
-#include <QPushButton>
+#include <QColorDialog>
 #include <QComboBox>
-#include <QLabel>
-#include <QCheckBox>
+#include <QCompleter>
+#include <QDebug>
+#include <QDoubleSpinBox>
+#include <QGradientStops>
 #include <QHBoxLayout>
-#include <QLayout>
 #include <QIcon>
-#include <QAction>
-#include <QTranslator>
-#include <QDoubleSpinBox>
-#include <QMenu>
+#include <QImage>
+#include <QLabel>
+#include <QLayout>
 #include <QLineEdit>
-#include <QCompleter>
-//#include <QStringListModel>
-#include <QStandardItemModel>
+#include <QLinearGradient>
+#include <QMenu>
+#include <QMouseEvent>
+#include <QObject>
+#include <QPainter>
+#include <QPainterPath>
+#include <QPushButton>
+#include <QToolBar>
+#include <QTranslator>
+#include <QWidget>
+// #include <QStringListModel>
 #include <QAbstractItemView>
 #include <QMainWindow>
+#include <QStandardItemModel>
 
-#include <QGridLayout>
 #include <QGraphicsOpacityEffect>
+#include <QGridLayout>
 #include <qmath.h>
-#pragma warning(pop)		// no warnings from includes - end
+#pragma warning(pop) // no warnings from includes - end
 
-namespace nmc {
+namespace nmc
+{
 
 // DkMainToolBar --------------------------------------------------------------------
-DkMainToolBar::DkMainToolBar(const QString & title, QWidget * parent /* = 0 */) : QToolBar(title, parent) {
-
-	createLayout();
+DkMainToolBar::DkMainToolBar(const QString &title, QWidget *parent /* = 0 */)
+    : QToolBar(title, parent)
+{
+    createLayout();
 }
 
-void DkMainToolBar::createLayout() {
-
-	mQuickAccessEdit = new DkQuickAccessEdit(this);
+void DkMainToolBar::createLayout()
+{
+    mQuickAccessEdit = new DkQuickAccessEdit(this);
 }
 
-void DkMainToolBar::setQuickAccessModel(QStandardItemModel* model) {
-	
-	mQuickAccessEdit->setModel(model);
-	addWidget(mQuickAccessEdit);
-	mQuickAccessEdit->setFocus(Qt::MouseFocusReason);
+void DkMainToolBar::setQuickAccessModel(QStandardItemModel *model)
+{
+    mQuickAccessEdit->setModel(model);
+    addWidget(mQuickAccessEdit);
+    mQuickAccessEdit->setFocus(Qt::MouseFocusReason);
 }
 
-void DkMainToolBar::closeQuickAccess() {
-
-	mQuickAccessEdit->clearAccess();
+void DkMainToolBar::closeQuickAccess()
+{
+    mQuickAccessEdit->clearAccess();
 }
 
-void DkMainToolBar::allActionsAdded() {
-
-	// right align search filters
-	QWidget* spacer = new QWidget(this);
-	spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
-	addWidget(spacer);
-	//addWidget(quickFilterEdit);
+void DkMainToolBar::allActionsAdded()
+{
+    // right align search filters
+    QWidget *spacer = new QWidget(this);
+    spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+    addWidget(spacer);
+    // addWidget(quickFilterEdit);
 }
 
-DkQuickAccessEdit* DkMainToolBar::getQuickAccess() const {
-	return mQuickAccessEdit;
+DkQuickAccessEdit *DkMainToolBar::getQuickAccess() const
+{
+    return mQuickAccessEdit;
 }
 
 // DkColorSlider:
-DkColorSlider::DkColorSlider(QWidget *parent, qreal normedPos, QColor color, int sliderWidth) 
-	: DkWidget(parent) {
+DkColorSlider::DkColorSlider(QWidget *parent, qreal normedPos, QColor color, int sliderWidth)
+    : DkWidget(parent)
+{
+    this->setStatusTip(tr("Drag the slider downwards for elimination"));
+    this->mNormedPos = normedPos;
+    this->mColor = color;
+    this->mSliderWidth = sliderWidth;
+    mIsActive = false;
 
-	this->setStatusTip(tr("Drag the slider downwards for elimination"));
-	this->mNormedPos = normedPos;
-	this->mColor = color;
-	this->mSliderWidth = sliderWidth;
-	mIsActive = false;
+    mSliderHalfWidth = qCeil((float)sliderWidth / 2);
+    // return (qreal)(pos) / (qreal)(width() - sliderWidth);
 
-	mSliderHalfWidth = qCeil((float)sliderWidth / 2);
-	//return (qreal)(pos) / (qreal)(width() - sliderWidth);
-	
-	int pos = qRound(normedPos * (parent->width() - sliderWidth - 1));
+    int pos = qRound(normedPos * (parent->width() - sliderWidth - 1));
 
-	setGeometry(pos, 23, sliderWidth + 1, sliderWidth + mSliderHalfWidth + 1);
-
-	show();
+    setGeometry(pos, 23, sliderWidth + 1, sliderWidth + mSliderHalfWidth + 1);
 
+    show();
 }
 
-void DkColorSlider::paintEvent(QPaintEvent*) {
+void DkColorSlider::paintEvent(QPaintEvent *)
+{
+    QPainter painter(this);
 
-	QPainter painter(this);
+    painter.setPen(Qt::black);
 
-	painter.setPen(Qt::black);
+    // Draw the filled triangle at the top of the slider:
+    if (mIsActive) {
+        QPainterPath path;
+        path.moveTo(0, mSliderHalfWidth);
+        path.lineTo(mSliderHalfWidth, 0);
+        path.lineTo(mSliderHalfWidth, 0);
+        path.lineTo(mSliderWidth, mSliderHalfWidth);
 
-	// Draw the filled triangle at the top of the slider:
-	if (mIsActive) {
+        painter.fillPath(path, Qt::black);
+        painter.drawPath(path);
 
-		QPainterPath path;
-		path.moveTo(0, mSliderHalfWidth);
-		path.lineTo(mSliderHalfWidth, 0);
-		path.lineTo(mSliderHalfWidth, 0);
-		path.lineTo(mSliderWidth, mSliderHalfWidth);
-	
-		painter.fillPath(path, Qt::black);
-		painter.drawPath(path);
+    }
+    // Draw the empty triangle at the top of the slider:
+    else {
+        painter.drawLine(0, mSliderHalfWidth, mSliderHalfWidth, 0);
+        painter.drawLine(mSliderHalfWidth, 0, mSliderWidth, mSliderHalfWidth);
+    }
 
-	} 
-	// Draw the empty triangle at the top of the slider:
-	else {
-		painter.drawLine(0, mSliderHalfWidth, mSliderHalfWidth, 0);
-		painter.drawLine(mSliderHalfWidth, 0, mSliderWidth, mSliderHalfWidth);
-	}
-	
-	painter.drawRect(0, mSliderHalfWidth, mSliderWidth, mSliderWidth);
-	painter.fillRect(2, mSliderHalfWidth+2, mSliderWidth - 3, mSliderWidth - 3, mColor);
-	
- 
+    painter.drawRect(0, mSliderHalfWidth, mSliderWidth, mSliderWidth);
+    painter.fillRect(2, mSliderHalfWidth + 2, mSliderWidth - 3, mSliderWidth - 3, mColor);
 }
 
-void DkColorSlider::updatePos(int parentWidth) {
-
-	int pos = qRound(mNormedPos * (parentWidth - mSliderWidth - 1));
-	setGeometry(pos, 23, mSliderWidth + 1, mSliderWidth + mSliderHalfWidth + 1);
+void DkColorSlider::updatePos(int parentWidth)
+{
+    int pos = qRound(mNormedPos * (parentWidth - mSliderWidth - 1));
+    setGeometry(pos, 23, mSliderWidth + 1, mSliderWidth + mSliderHalfWidth + 1);
 }
 
-void DkColorSlider::setActive(bool isActive) {
-
-	mIsActive = isActive;
+void DkColorSlider::setActive(bool isActive)
+{
+    mIsActive = isActive;
 }
 
-DkColorSlider::~DkColorSlider() {
+DkColorSlider::~DkColorSlider()
+{
 }
 
-QColor DkColorSlider::getColor() {
-
-	return mColor;
+QColor DkColorSlider::getColor()
+{
+    return mColor;
 }
 
-qreal DkColorSlider::getNormedPos() {
-
-	return mNormedPos;
+qreal DkColorSlider::getNormedPos()
+{
+    return mNormedPos;
 }
 
-void DkColorSlider::setNormedPos(qreal pos) {
-
-	mNormedPos = pos;
+void DkColorSlider::setNormedPos(qreal pos)
+{
+    mNormedPos = pos;
 }
 
-
-void DkColorSlider::mousePressEvent(QMouseEvent *event) {
-	
-	mIsActive = true;
-	mDragStartX = event->pos().x();
-	emit sliderActivated(this);		
+void DkColorSlider::mousePressEvent(QMouseEvent *event)
+{
+    mIsActive = true;
+    mDragStartX = event->pos().x();
+    emit sliderActivated(this);
 }
 
-void DkColorSlider::mouseMoveEvent(QMouseEvent *event) {
-	
-	// Pass the actual position to the Gradient:
-	emit sliderMoved(this, event->pos().x() - mDragStartX, event->pos().y());
-		
+void DkColorSlider::mouseMoveEvent(QMouseEvent *event)
+{
+    // Pass the actual position to the Gradient:
+    emit sliderMoved(this, event->pos().x() - mDragStartX, event->pos().y());
 }
 
-void DkColorSlider::mouseDoubleClickEvent(QMouseEvent*) {
-
-	QColor color = QColorDialog::getColor(this->mColor, this);
-	if (color.isValid())
-		this->mColor = color;
-
-	emit colorChanged(this);
+void DkColorSlider::mouseDoubleClickEvent(QMouseEvent *)
+{
+    QColor color = QColorDialog::getColor(this->mColor, this);
+    if (color.isValid())
+        this->mColor = color;
 
+    emit colorChanged(this);
 }
 
-DkGradient::DkGradient(QWidget *parent) 
-	: DkWidget(parent) {
+DkGradient::DkGradient(QWidget *parent)
+    : DkWidget(parent)
+{
+    setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Maximum);
 
-	setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Maximum);
+    this->setMinimumWidth(100);
+    this->setMaximumWidth(600);
 
-	this->setMinimumWidth(100);
-	this->setMaximumWidth(600);
+    this->setFixedHeight(40);
 
-	this->setFixedHeight(40);
+    mIsSliderDragged = false;
+    mClickAreaHeight = 20;
+    mDeleteSliderDist = 50;
 
-	mIsSliderDragged = false;
-	mClickAreaHeight = 20;
-	mDeleteSliderDist = 50;
-	
-	// Note that sliderWidth should be odd, in order to get a pretty rendered slider.
-	mSliderWidth = 10;
-	mHalfSliderWidth = mSliderWidth / 2;
-	mGradient = QLinearGradient(0, 0, width(), height() - mClickAreaHeight);
-	
-	mSliders = QVector<DkColorSlider*>();
-	init();
+    // Note that sliderWidth should be odd, in order to get a pretty rendered slider.
+    mSliderWidth = 10;
+    mHalfSliderWidth = mSliderWidth / 2;
+    mGradient = QLinearGradient(0, 0, width(), height() - mClickAreaHeight);
 
+    mSliders = QVector<DkColorSlider *>();
+    init();
 }
 
-DkGradient::~DkGradient() {
+DkGradient::~DkGradient()
+{
 }
 
-void DkGradient::init() {
-
-	clearAllSliders();
-
-	addSlider(0, Qt::black);
-	addSlider(1, Qt::white);
-	
-	updateGradient();
+void DkGradient::init()
+{
+    clearAllSliders();
 
+    addSlider(0, Qt::black);
+    addSlider(1, Qt::white);
 
+    updateGradient();
 }
 
-void DkGradient::clearAllSliders() {
-
-	for (int i = 0; i < mSliders.size(); i++) {
-		DkColorSlider* slider = mSliders.at(i);
-		delete slider;
-	}
-
-	mSliders.clear();
+void DkGradient::clearAllSliders()
+{
+    for (int i = 0; i < mSliders.size(); i++) {
+        DkColorSlider *slider = mSliders.at(i);
+        delete slider;
+    }
 
+    mSliders.clear();
 }
 
-void DkGradient::setGradient(const QLinearGradient& gradient) {
+void DkGradient::setGradient(const QLinearGradient &gradient)
+{
+    reset();
+    clearAllSliders(); // reset adds a slider at the start and end
 
-	reset();
-	clearAllSliders();	// reset adds a slider at the start and end
+    this->mGradient.setStops(gradient.stops());
 
-	this->mGradient.setStops(gradient.stops());
-	
-	QVector<QGradientStop> stops = gradient.stops();
+    QVector<QGradientStop> stops = gradient.stops();
 
-	for (int idx = 0; idx < stops.size(); idx++) {
-		addSlider(stops.at(idx).first, stops.at(idx).second);
-	}
-
-	updateGradient();
-	update();
-	emit gradientChanged();
+    for (int idx = 0; idx < stops.size(); idx++) {
+        addSlider(stops.at(idx).first, stops.at(idx).second);
+    }
 
+    updateGradient();
+    update();
+    emit gradientChanged();
 }
 
-QLinearGradient DkGradient::getGradient() {
-
-	return mGradient;
+QLinearGradient DkGradient::getGradient()
+{
+    return mGradient;
 }
 
-void DkGradient::reset() {
-
-	init();
-	update();
-
+void DkGradient::reset()
+{
+    init();
+    update();
 }
 
+void DkGradient::resizeEvent(QResizeEvent *event)
+{
+    if (event->size() == event->oldSize())
+        return;
 
-void DkGradient::resizeEvent( QResizeEvent * event ) {
-
-	if (event->size() == event->oldSize())
-		return;
+    DkColorSlider *slider;
 
-	DkColorSlider *slider;
+    for (int i = 0; i < mSliders.size(); i++) {
+        slider = mSliders.at(i);
+        slider->updatePos(this->width());
+    }
 
-	for (int i = 0; i < mSliders.size(); i++) {
-		slider = mSliders.at(i);
-		slider->updatePos(this->width());
-	}
+    // qDebug() << "resize gradient: " << event->size();
 
-	//qDebug() << "resize gradient: " << event->size();
+    updateGradient();
 
-	updateGradient();
-
-	QWidget::resizeEvent(event);
+    QWidget::resizeEvent(event);
 }
 
-
-void DkGradient::addSlider(qreal pos, QColor color) {
-
-
-	DkColorSlider *actSlider =  new DkColorSlider(this, pos, color, mSliderWidth);
-	mSliders.append(actSlider);
-	connect(actSlider, SIGNAL(sliderMoved(DkColorSlider*, int, int)), this, SLOT(moveSlider(DkColorSlider*, int, int)));
-	connect(actSlider, SIGNAL(colorChanged(DkColorSlider*)), this, SLOT(changeColor(DkColorSlider*)));
-	connect(actSlider, SIGNAL(sliderActivated(DkColorSlider*)), this, SLOT(activateSlider(DkColorSlider*)));
-
+void DkGradient::addSlider(qreal pos, QColor color)
+{
+    DkColorSlider *actSlider = new DkColorSlider(this, pos, color, mSliderWidth);
+    mSliders.append(actSlider);
+    connect(actSlider, SIGNAL(sliderMoved(DkColorSlider *, int, int)), this, SLOT(moveSlider(DkColorSlider *, int, int)));
+    connect(actSlider, SIGNAL(colorChanged(DkColorSlider *)), this, SLOT(changeColor(DkColorSlider *)));
+    connect(actSlider, SIGNAL(sliderActivated(DkColorSlider *)), this, SLOT(activateSlider(DkColorSlider *)));
 }
 
-void DkGradient::insertSlider(qreal pos, QColor col) {
-
-	// Inserts a new slider at position pos and calculates the color, interpolated from the closest neighbors.
-
-	// Find the neighbors of the new slider, since we need it for the color interpolation:
-	QColor leftColor, rightColor, actColor;
-	qreal dist;
-	qreal initValue = DBL_MAX; //std::numeric_limits<qreal>::max();	// >DIR: fix for linux [9.2.2012 markus]
-	qreal leftDist = initValue;
-	qreal rightDist = initValue;
+void DkGradient::insertSlider(qreal pos, QColor col)
+{
+    // Inserts a new slider at position pos and calculates the color, interpolated from the closest neighbors.
 
-	int leftIdx = 0, rightIdx = 0;
-	
-	for (int i = 0; i < mSliders.size(); i++) {
-		dist = mSliders.at(i)->getNormedPos() - pos;
-		if (dist < 0) {
-			if (std::abs(dist) < leftDist) {
-				leftDist = (std::abs(dist));
-				leftIdx = i;
-			}
-		}
-		else if (dist > 0){
-			if (std::abs(dist) < rightDist) {
-				rightDist = (std::abs(dist));
-				rightIdx = i;
-			}
-		}
-		else {
-			actColor = mSliders.at(i)->getColor();
-			break;
-		}
-	}
+    // Find the neighbors of the new slider, since we need it for the color interpolation:
+    QColor leftColor, rightColor, actColor;
+    qreal dist;
+    qreal initValue = DBL_MAX; // std::numeric_limits<qreal>::max();	// >DIR: fix for linux [9.2.2012 markus]
+    qreal leftDist = initValue;
+    qreal rightDist = initValue;
 
-	if ((leftDist == initValue) && (rightDist == initValue))
-		actColor = Qt::black;
-	// The slider is most left:
-	else if (leftDist == initValue)
-		actColor = mSliders.at(rightIdx)->getColor();
-	// The slider is most right:
-	else if (rightDist == initValue)
-		actColor = mSliders.at(leftIdx)->getColor();
-	// The slider has a neighbor to the left and to the right:
-	else {
-		int rLeft, rRight, rNew, gLeft, gRight, gNew, bLeft, bRight, bNew;
-		
-		mSliders.at(leftIdx)->getColor().getRgb(&rLeft, &gLeft, &bLeft);
-		mSliders.at(rightIdx)->getColor().getRgb(&rRight, &gRight, &bRight);
-		
-		qreal fac = leftDist / (leftDist + rightDist);
-		rNew = qRound(rLeft * (1 - fac) + rRight * fac);
-		gNew = qRound(gLeft * (1 - fac) + gRight * fac);
-		bNew = qRound(bLeft * (1 - fac) + bRight * fac);
+    int leftIdx = 0, rightIdx = 0;
 
-		actColor = QColor(rNew, gNew, bNew);
+    for (int i = 0; i < mSliders.size(); i++) {
+        dist = mSliders.at(i)->getNormedPos() - pos;
+        if (dist < 0) {
+            if (std::abs(dist) < leftDist) {
+                leftDist = (std::abs(dist));
+                leftIdx = i;
+            }
+        } else if (dist > 0) {
+            if (std::abs(dist) < rightDist) {
+                rightDist = (std::abs(dist));
+                rightIdx = i;
+            }
+        } else {
+            actColor = mSliders.at(i)->getColor();
+            break;
+        }
+    }
 
-	}
+    if ((leftDist == initValue) && (rightDist == initValue))
+        actColor = Qt::black;
+    // The slider is most left:
+    else if (leftDist == initValue)
+        actColor = mSliders.at(rightIdx)->getColor();
+    // The slider is most right:
+    else if (rightDist == initValue)
+        actColor = mSliders.at(leftIdx)->getColor();
+    // The slider has a neighbor to the left and to the right:
+    else {
+        int rLeft, rRight, rNew, gLeft, gRight, gNew, bLeft, bRight, bNew;
 
+        mSliders.at(leftIdx)->getColor().getRgb(&rLeft, &gLeft, &bLeft);
+        mSliders.at(rightIdx)->getColor().getRgb(&rRight, &gRight, &bRight);
 
-	addSlider(pos, col.isValid() ? col : actColor);
-	// The last slider in the list is the last one added, now make this one active:
-	activateSlider(mSliders.last());
+        qreal fac = leftDist / (leftDist + rightDist);
+        rNew = qRound(rLeft * (1 - fac) + rRight * fac);
+        gNew = qRound(gLeft * (1 - fac) + gRight * fac);
+        bNew = qRound(bLeft * (1 - fac) + bRight * fac);
 
-	updateGradient();
-	update();
+        actColor = QColor(rNew, gNew, bNew);
+    }
 
+    addSlider(pos, col.isValid() ? col : actColor);
+    // The last slider in the list is the last one added, now make this one active:
+    activateSlider(mSliders.last());
 
+    updateGradient();
+    update();
 }
 
-void DkGradient::mousePressEvent(QMouseEvent *event) {
+void DkGradient::mousePressEvent(QMouseEvent *event)
+{
+    QPointF enterPos = event->pos();
+    qreal pos = (qreal)(enterPos.x() - mHalfSliderWidth) / (qreal)(width() - mSliderWidth);
 
-	QPointF enterPos = event->pos();
-	qreal pos = (qreal)(enterPos.x() - mHalfSliderWidth) / (qreal)(width()-mSliderWidth);
-
-	insertSlider(pos);
-	
+    insertSlider(pos);
 }
 
-void DkGradient::updateGradient() {
-
-	mGradient = QLinearGradient(0, 0, width(), height() - mClickAreaHeight);
+void DkGradient::updateGradient()
+{
+    mGradient = QLinearGradient(0, 0, width(), height() - mClickAreaHeight);
 
-	for (int i = 0; i < mSliders.size(); i++) 
-		mGradient.setColorAt(mSliders.at(i)->getNormedPos(), mSliders.at(i)->getColor());
-	
+    for (int i = 0; i < mSliders.size(); i++)
+        mGradient.setColorAt(mSliders.at(i)->getNormedPos(), mSliders.at(i)->getColor());
 }
 
-QGradientStops DkGradient::getGradientStops() {
-
-	return mGradient.stops();
+QGradientStops DkGradient::getGradientStops()
+{
+    return mGradient.stops();
 }
 
-void DkGradient::moveSlider(DkColorSlider* sender, int dragDistX, int yPos) {
-
-
-	// Delete the actual slider:
-	if (yPos > mDeleteSliderDist) {
-		int idx = mSliders.lastIndexOf(sender);
-		if (idx != -1) {
-			mSliders.remove(idx);
-			delete sender;
-			mIsActiveSliderExisting = false;
-		}
-	}
-
-	// Insert a new slider:
-	else {
+void DkGradient::moveSlider(DkColorSlider *sender, int dragDistX, int yPos)
+{
+    // Delete the actual slider:
+    if (yPos > mDeleteSliderDist) {
+        int idx = mSliders.lastIndexOf(sender);
+        if (idx != -1) {
+            mSliders.remove(idx);
+            delete sender;
+            mIsActiveSliderExisting = false;
+        }
+    }
 
-		int newPos = sender->pos().x() + dragDistX;
+    // Insert a new slider:
+    else {
+        int newPos = sender->pos().x() + dragDistX;
 
-		if (newPos < 0)
-			newPos = 0;
-		else if (newPos > width() - mSliderWidth - 1)
-			newPos = width() - mSliderWidth - 1;
+        if (newPos < 0)
+            newPos = 0;
+        else if (newPos > width() - mSliderWidth - 1)
+            newPos = width() - mSliderWidth - 1;
 
-		qreal normedSliderPos = getNormedPos(newPos);
+        qreal normedSliderPos = getNormedPos(newPos);
 
-		if (normedSliderPos > 1)
-			normedSliderPos = 1;
-		if (normedSliderPos < 0)
-			normedSliderPos = 0;
+        if (normedSliderPos > 1)
+            normedSliderPos = 1;
+        if (normedSliderPos < 0)
+            normedSliderPos = 0;
 
-		DkColorSlider *slider;
-		// Check if the position is already assigned to another slider:
-		for (int i = 0; i < mSliders.size(); i++) {
-			slider = mSliders.at(i);
-			if (slider != sender) {
-				if (slider->getNormedPos() == normedSliderPos)
-					return;
-			}
-		}
+        DkColorSlider *slider;
+        // Check if the position is already assigned to another slider:
+        for (int i = 0; i < mSliders.size(); i++) {
+            slider = mSliders.at(i);
+            if (slider != sender) {
+                if (slider->getNormedPos() == normedSliderPos)
+                    return;
+            }
+        }
 
-		sender->setNormedPos(normedSliderPos);
-		sender->move(newPos, sender->pos().y());
+        sender->setNormedPos(normedSliderPos);
+        sender->move(newPos, sender->pos().y());
+    }
 
-	}
-
-	updateGradient();
-	update();
-	
-	emit gradientChanged();
+    updateGradient();
+    update();
 
+    emit gradientChanged();
 }
 
-qreal DkGradient::getNormedPos(int pos) {
-
-	return (qreal)(pos) / (qreal)(width() - mSliderWidth);
-
+qreal DkGradient::getNormedPos(int pos)
+{
+    return (qreal)(pos) / (qreal)(width() - mSliderWidth);
 }
 
-int DkGradient::getAbsolutePos(qreal pos) {
-
-	return (int) pos * width();
-
+int DkGradient::getAbsolutePos(qreal pos)
+{
+    return (int)pos * width();
 }
 
-void DkGradient::paintEvent(QPaintEvent*) {
+void DkGradient::paintEvent(QPaintEvent *)
+{
+    QPainter painter(this);
+    painter.setPen(Qt::gray);
 
-	QPainter painter(this);
-	painter.setPen(Qt::gray);
-	
-	painter.fillRect(mHalfSliderWidth, 2, width() - mSliderWidth, height() - mClickAreaHeight, mGradient);
-	painter.drawRect(mHalfSliderWidth, 2, width() - mSliderWidth, height() - mClickAreaHeight);
+    painter.fillRect(mHalfSliderWidth, 2, width() - mSliderWidth, height() - mClickAreaHeight, mGradient);
+    painter.drawRect(mHalfSliderWidth, 2, width() - mSliderWidth, height() - mClickAreaHeight);
 }
 
-
-void DkGradient::mouseReleaseEvent(QMouseEvent *) {
-
-	// unused
+void DkGradient::mouseReleaseEvent(QMouseEvent *)
+{
+    // unused
 }
 
-void DkGradient::changeColor(DkColorSlider*) {
+void DkGradient::changeColor(DkColorSlider *)
+{
+    updateGradient();
+    update();
 
-	updateGradient();
-	update();
-
-	emit gradientChanged();
+    emit gradientChanged();
 }
 
-void DkGradient::activateSlider(DkColorSlider *sender) {
-
-	
-	if (mIsActiveSliderExisting) 
-		mActiveSlider->setActive(false);
-	else
-		mIsActiveSliderExisting = true;
+void DkGradient::activateSlider(DkColorSlider *sender)
+{
+    if (mIsActiveSliderExisting)
+        mActiveSlider->setActive(false);
+    else
+        mIsActiveSliderExisting = true;
 
-	mActiveSlider = sender;
-	mActiveSlider->setActive(true);
-
-	update();
+    mActiveSlider = sender;
+    mActiveSlider->setActive(true);
 
+    update();
 }
 
 //
-DkTransferToolBar::DkTransferToolBar(QWidget * parent) 
-	: QToolBar(tr("Pseudo Color Toolbar"), parent) {
-
-	loadSettings();
-
-	
-	mEnableTFCheckBox = new QCheckBox(tr("Enable"));
-	mEnableTFCheckBox->setStatusTip(tr("Enables the Pseudo Color function"));
+DkTransferToolBar::DkTransferToolBar(QWidget *parent)
+    : QToolBar(tr("Pseudo Color Toolbar"), parent)
+{
+    loadSettings();
 
-	this->addWidget(mEnableTFCheckBox);
+    mEnableTFCheckBox = new QCheckBox(tr("Enable"));
+    mEnableTFCheckBox->setStatusTip(tr("Enables the Pseudo Color function"));
 
-	// >DIR: more compact gui [2.3.2012 markus]
-	this->addSeparator();
-	//this->addWidget(new QLabel(tr("Active channel:")));
+    this->addWidget(mEnableTFCheckBox);
 
-	mChannelComboBox = new QComboBox(this);
-	mChannelComboBox->setStatusTip(tr("Changes the displayed color channel"));
-	this->addWidget(mChannelComboBox);
+    // >DIR: more compact gui [2.3.2012 markus]
+    this->addSeparator();
+    // this->addWidget(new QLabel(tr("Active channel:")));
 
-	mHistoryCombo = new QComboBox(this);
+    mChannelComboBox = new QComboBox(this);
+    mChannelComboBox->setStatusTip(tr("Changes the displayed color channel"));
+    this->addWidget(mChannelComboBox);
 
-	QAction* delGradientAction = new QAction(tr("Delete"), mHistoryCombo);
-	connect(delGradientAction, SIGNAL(triggered()), this, SLOT(deleteGradient()));
+    mHistoryCombo = new QComboBox(this);
 
-	mHistoryCombo->addAction(delGradientAction);
-	mHistoryCombo->setContextMenuPolicy(Qt::ActionsContextMenu);
+    QAction *delGradientAction = new QAction(tr("Delete"), mHistoryCombo);
+    connect(delGradientAction, SIGNAL(triggered()), this, SLOT(deleteGradient()));
 
-	updateGradientHistory();
-	connect(mHistoryCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(switchGradient(int)));
-	connect(mHistoryCombo, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(deleteGradientMenu(QPoint)));
+    mHistoryCombo->addAction(delGradientAction);
+    mHistoryCombo->setContextMenuPolicy(Qt::ActionsContextMenu);
 
-	this->addWidget(mHistoryCombo);
+    updateGradientHistory();
+    connect(mHistoryCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(switchGradient(int)));
+    connect(mHistoryCombo, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(deleteGradientMenu(QPoint)));
 
-	createIcons();
+    this->addWidget(mHistoryCombo);
 
-	mGradient = new DkGradient(this);
-	mGradient->setStatusTip(tr("Click into the field for a new slider"));
-	this->addWidget(mGradient);
+    createIcons();
 
-	mEffect = new QGraphicsOpacityEffect(mGradient);
-	mEffect->setOpacity(1);
-	mGradient->setGraphicsEffect(mEffect);
+    mGradient = new DkGradient(this);
+    mGradient->setStatusTip(tr("Click into the field for a new slider"));
+    this->addWidget(mGradient);
 
-	// Disable the entire transfer toolbar:
-	//enableTF(Qt::Unchecked);
+    mEffect = new QGraphicsOpacityEffect(mGradient);
+    mEffect->setOpacity(1);
+    mGradient->setGraphicsEffect(mEffect);
 
-	// Initialize the combo box for color images:
-	mImageMode = mode_uninitialized;
-	applyImageMode(mode_rgb);
+    // Disable the entire transfer toolbar:
+    // enableTF(Qt::Unchecked);
 
-	enableToolBar(false);
-	mEnableTFCheckBox->setEnabled(true);	
+    // Initialize the combo box for color images:
+    mImageMode = mode_uninitialized;
+    applyImageMode(mode_rgb);
 
-	connect(mEnableTFCheckBox, SIGNAL(stateChanged(int)), this, SLOT(enableTFCheckBoxClicked(int)));
-	connect(mGradient, SIGNAL(gradientChanged()), this, SLOT(applyTF()));
+    enableToolBar(false);
+    mEnableTFCheckBox->setEnabled(true);
 
-	// needed for initialization
-	connect(this, SIGNAL(gradientChanged()), mGradient, SIGNAL(gradientChanged()));
+    connect(mEnableTFCheckBox, SIGNAL(stateChanged(int)), this, SLOT(enableTFCheckBoxClicked(int)));
+    connect(mGradient, SIGNAL(gradientChanged()), this, SLOT(applyTF()));
 
-	if (!mOldGradients.empty())
-		mGradient->setGradient(mOldGradients.first());
+    // needed for initialization
+    connect(this, SIGNAL(gradientChanged()), mGradient, SIGNAL(gradientChanged()));
 
+    if (!mOldGradients.empty())
+        mGradient->setGradient(mOldGradients.first());
 }
 
-DkTransferToolBar::~DkTransferToolBar() {
+DkTransferToolBar::~DkTransferToolBar()
+{
 }
 
+void DkTransferToolBar::createIcons()
+{
+    // user needs to decide...
+    // this->setIconSize(QSize(DkSettingsManager::param().effectiveIconSize(), DkSettingsManager::param().effectiveIconSize()));
 
-void DkTransferToolBar::createIcons() {
-
-	// user needs to decide...
-	//this->setIconSize(QSize(DkSettingsManager::param().effectiveIconSize(), DkSettingsManager::param().effectiveIconSize()));
-			
-	mToolBarIcons.resize(icon_toolbar_end);
-
-	mToolBarIcons[icon_toolbar_reset] = DkImage::loadIcon(":/nomacs/img/gradient-reset.svg");
-	mToolBarIcons[icon_toolbar_pipette] = DkImage::loadIcon(":/nomacs/img/pipette.svg");
-	mToolBarIcons[icon_toolbar_save] = DkImage::loadIcon(":/nomacs/img/save.svg");
+    mToolBarIcons.resize(icon_toolbar_end);
 
-	mToolBarActions.resize(toolbar_end);
-	mToolBarActions[toolbar_reset] = new QAction(mToolBarIcons[icon_toolbar_reset], tr("Reset"), this);
-	mToolBarActions[toolbar_reset]->setStatusTip(tr("Resets the Pseudo Color function"));
-	connect(mToolBarActions[toolbar_reset], SIGNAL(triggered()), this, SLOT(resetGradient()));
+    mToolBarIcons[icon_toolbar_reset] = DkImage::loadIcon(":/nomacs/img/gradient-reset.svg");
+    mToolBarIcons[icon_toolbar_pipette] = DkImage::loadIcon(":/nomacs/img/pipette.svg");
+    mToolBarIcons[icon_toolbar_save] = DkImage::loadIcon(":/nomacs/img/save.svg");
 
-	//toolBarActions[toolbar_reset]->setToolTip("was geht?");
+    mToolBarActions.resize(toolbar_end);
+    mToolBarActions[toolbar_reset] = new QAction(mToolBarIcons[icon_toolbar_reset], tr("Reset"), this);
+    mToolBarActions[toolbar_reset]->setStatusTip(tr("Resets the Pseudo Color function"));
+    connect(mToolBarActions[toolbar_reset], SIGNAL(triggered()), this, SLOT(resetGradient()));
 
-	mToolBarActions[toolbar_pipette] = new QAction(mToolBarIcons[icon_toolbar_pipette], tr("Select Color"), this);
-	mToolBarActions[toolbar_pipette]->setStatusTip(tr("Adds a slider at the selected color value"));
-	mToolBarActions[toolbar_pipette]->setCheckable(true);
-	mToolBarActions[toolbar_pipette]->setChecked(false);
-	connect(mToolBarActions[toolbar_pipette], SIGNAL(triggered(bool)), this, SLOT(pickColor(bool)));
+    // toolBarActions[toolbar_reset]->setToolTip("was geht?");
 
-	mToolBarActions[toolbar_save] = new QAction(mToolBarIcons[icon_toolbar_save], tr("Save Gradient"), this);
-	mToolBarActions[toolbar_save]->setStatusTip(tr("Saves the current Gradient"));
-	connect(mToolBarActions[toolbar_save], SIGNAL(triggered()), this, SLOT(saveGradient()));
+    mToolBarActions[toolbar_pipette] = new QAction(mToolBarIcons[icon_toolbar_pipette], tr("Select Color"), this);
+    mToolBarActions[toolbar_pipette]->setStatusTip(tr("Adds a slider at the selected color value"));
+    mToolBarActions[toolbar_pipette]->setCheckable(true);
+    mToolBarActions[toolbar_pipette]->setChecked(false);
+    connect(mToolBarActions[toolbar_pipette], SIGNAL(triggered(bool)), this, SLOT(pickColor(bool)));
 
-	addActions(mToolBarActions.toList());
+    mToolBarActions[toolbar_save] = new QAction(mToolBarIcons[icon_toolbar_save], tr("Save Gradient"), this);
+    mToolBarActions[toolbar_save]->setStatusTip(tr("Saves the current Gradient"));
+    connect(mToolBarActions[toolbar_save], SIGNAL(triggered()), this, SLOT(saveGradient()));
 
+    addActions(mToolBarActions.toList());
 }
 
-void DkTransferToolBar::saveSettings() {
+void DkTransferToolBar::saveSettings()
+{
+    DefaultSettings settings;
+    settings.beginGroup("Pseudo Color");
 
-	DefaultSettings settings;
-	settings.beginGroup("Pseudo Color");
+    settings.beginWriteArray("oldGradients", mOldGradients.size());
 
-	settings.beginWriteArray("oldGradients", mOldGradients.size());
+    for (int idx = 0; idx < mOldGradients.size(); idx++) {
+        settings.setArrayIndex(idx);
 
-	for (int idx = 0; idx < mOldGradients.size(); idx++) {
-		settings.setArrayIndex(idx);
+        QVector<QGradientStop> stops = mOldGradients.at(idx).stops();
+        settings.beginWriteArray("gradient", stops.size());
 
-		QVector<QGradientStop> stops = mOldGradients.at(idx).stops();
-		settings.beginWriteArray("gradient", stops.size());
+        for (int sIdx = 0; sIdx < stops.size(); sIdx++) {
+            settings.setArrayIndex(sIdx);
+            settings.setValue("posRGBA", (float)stops.at(sIdx).first);
+            settings.setValue("colorRGBA", stops.at(sIdx).second.rgba());
+        }
+        settings.endArray();
+    }
 
-		for (int sIdx = 0; sIdx < stops.size(); sIdx++) {
-			settings.setArrayIndex(sIdx);
-			settings.setValue("posRGBA", (float)stops.at(sIdx).first);
-			settings.setValue("colorRGBA", stops.at(sIdx).second.rgba());
-		}
-		settings.endArray();
-	}
-
-	settings.endArray();
-	settings.endGroup();
+    settings.endArray();
+    settings.endGroup();
 }
 
-void DkTransferToolBar::loadSettings() {
+void DkTransferToolBar::loadSettings()
+{
+    DefaultSettings settings;
+    settings.beginGroup("Pseudo Color");
 
-	DefaultSettings settings;
-	settings.beginGroup("Pseudo Color");
+    int gSize = settings.beginReadArray("oldGradients");
 
-	int gSize = settings.beginReadArray("oldGradients");
+    for (int idx = 0; idx < gSize; idx++) {
+        settings.setArrayIndex(idx);
 
-	for (int idx = 0; idx < gSize; idx++) {
-		settings.setArrayIndex(idx);
+        QVector<QGradientStop> stops;
+        int sSize = settings.beginReadArray("gradient");
 
-		QVector<QGradientStop> stops;
-		int sSize = settings.beginReadArray("gradient");
+        for (int sIdx = 0; sIdx < sSize; sIdx++) {
+            settings.setArrayIndex(sIdx);
 
-		for (int sIdx = 0; sIdx < sSize; sIdx++) {
-			settings.setArrayIndex(sIdx);
-			
-			QGradientStop s;
-			s.first = settings.value("posRGBA", 0).toFloat();
-			s.second = QColor::fromRgba(settings.value("colorRGBA", QColor().rgba()).toInt());
-			qDebug() << "pos: " << s.first << " col: " << s.second;
-			stops.append(s);
-		}
-		settings.endArray();
+            QGradientStop s;
+            s.first = settings.value("posRGBA", 0).toFloat();
+            s.second = QColor::fromRgba(settings.value("colorRGBA", QColor().rgba()).toInt());
+            qDebug() << "pos: " << s.first << " col: " << s.second;
+            stops.append(s);
+        }
+        settings.endArray();
 
-		QLinearGradient g;
-		g.setStops(stops);
-		mOldGradients.append(g);
-	}
+        QLinearGradient g;
+        g.setStops(stops);
+        mOldGradients.append(g);
+    }
 
-	settings.endArray();
-	settings.endGroup();
+    settings.endArray();
+    settings.endGroup();
 }
 
-void DkTransferToolBar::deleteGradientMenu(QPoint pos) {
-
-	QMenu* cm = new QMenu(this);
-	QAction* delAction = new QAction("Delete", this);
-	connect(delAction, SIGNAL(triggered()), this, SLOT(deleteGradient()));
-	cm->popup(mHistoryCombo->mapToGlobal(pos));
-	cm->exec();
+void DkTransferToolBar::deleteGradientMenu(QPoint pos)
+{
+    QMenu *cm = new QMenu(this);
+    QAction *delAction = new QAction("Delete", this);
+    connect(delAction, SIGNAL(triggered()), this, SLOT(deleteGradient()));
+    cm->popup(mHistoryCombo->mapToGlobal(pos));
+    cm->exec();
 }
 
-void DkTransferToolBar::deleteGradient() {
+void DkTransferToolBar::deleteGradient()
+{
+    int idx = mHistoryCombo->currentIndex();
+
+    if (idx >= 0 && idx < mOldGradients.size()) {
+        mOldGradients.remove(idx);
+        mHistoryCombo->removeItem(idx);
+    }
+}
 
-	int idx = mHistoryCombo->currentIndex();
+void DkTransferToolBar::resizeEvent(QResizeEvent *event)
+{
+    mGradient->resize(event->size().width() - mGradient->x(), 40);
+}
 
-	if (idx >= 0 && idx < mOldGradients.size()) {
-		mOldGradients.remove(idx);
-		mHistoryCombo->removeItem(idx);
-	}
+void DkTransferToolBar::insertSlider(qreal pos)
+{
+    mGradient->insertSlider(pos);
+}
 
+void DkTransferToolBar::setImageMode(int mode)
+{
+    qDebug() << "and I received...";
+    applyImageMode(mode);
 }
 
-void DkTransferToolBar::resizeEvent( QResizeEvent * event ) {
+void DkTransferToolBar::applyImageMode(int mode)
+{
+    // At first check if the right mode is already set. If so, don't do nothing.
 
-	mGradient->resize(event->size().width() - mGradient->x(), 40);
+    if (mode == mImageMode)
+        return;
 
-}
+    // if (mImageMode != mode_invalid_format) {
+    //	enableToolBar(true);
+    //	emit channelChanged(0);
+    // }
 
-void DkTransferToolBar::insertSlider(qreal pos) {
+    mImageMode = mode;
+    mEnableTFCheckBox->setEnabled(mImageMode != mode_invalid_format);
 
-	mGradient->insertSlider(pos);
+    if (mImageMode == mode_invalid_format) {
+        enableToolBar(false);
+        return;
+    }
 
-}
+    disconnect(mChannelComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(changeChannel(int)));
+    mChannelComboBox->clear();
 
-void DkTransferToolBar::setImageMode(int mode) {
+    if (mode == mode_gray) {
+        mChannelComboBox->addItem(tr("Gray"));
+    } else if (mode == mode_rgb) {
+        mChannelComboBox->addItem(tr("RGB"));
+        mChannelComboBox->addItem(tr("Red"));
+        mChannelComboBox->addItem(tr("Green"));
+        mChannelComboBox->addItem(tr("Blue"));
+    }
 
-	qDebug() << "and I received...";
-	applyImageMode(mode);
+    mChannelComboBox->setCurrentIndex(0);
 
+    connect(mChannelComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(changeChannel(int)));
 }
 
-void DkTransferToolBar::applyImageMode(int mode) {
+void DkTransferToolBar::pickColor(bool enabled)
+{
+    emit pickColorRequest(enabled);
+}
 
-	// At first check if the right mode is already set. If so, don't do nothing.
+void DkTransferToolBar::enableTFCheckBoxClicked(int state)
+{
+    bool enabled;
+    if (state == Qt::Checked)
+        enabled = true;
+    else
+        enabled = false;
 
-	if (mode == mImageMode)
-		return;
+    enableToolBar(enabled);
 
-	//if (mImageMode != mode_invalid_format) {
-	//	enableToolBar(true);
-	//	emit channelChanged(0);
-	//}
+    // At this point the checkbox is disabled, hence enable it...
+    mEnableTFCheckBox->setEnabled(true);
 
-	mImageMode = mode;
-	mEnableTFCheckBox->setEnabled(mImageMode != mode_invalid_format);	
+    if (enabled)
+        mEnableTFCheckBox->setStatusTip(tr("Disables the Pseudo Color function"));
+    else
+        mEnableTFCheckBox->setStatusTip(tr("Enables the Pseudo Color function"));
 
-	if (mImageMode == mode_invalid_format) {
-		enableToolBar(false);
-		return;
-	}
+    emit tFEnabled(enabled);
+    emit gradientChanged();
+}
 
-	disconnect(mChannelComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(changeChannel(int)));
-	mChannelComboBox->clear();
+void DkTransferToolBar::enableToolBar(bool enable)
+{
+    QObjectList list = this->children();
 
-	if (mode == mode_gray) {
-		mChannelComboBox->addItem(tr("Gray"));
-	}
-	else if (mode == mode_rgb) {
-		mChannelComboBox->addItem(tr("RGB"));
-		mChannelComboBox->addItem(tr("Red"));
-		mChannelComboBox->addItem(tr("Green"));
-		mChannelComboBox->addItem(tr("Blue"));
-	}
+    for (int i = 0; i < list.count(); i++) {
+        if (QWidget *action = qobject_cast<QWidget *>(list.at(i)))
+            action->setEnabled(enable);
+    }
 
-	mChannelComboBox->setCurrentIndex(0);
+    if (enable)
+        mEffect->setOpacity(1);
+    else
+        mEffect->setOpacity(.5);
+}
 
-	connect(mChannelComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(changeChannel(int)));
+void DkTransferToolBar::applyTF()
+{
+    QGradientStops stops = mGradient->getGradientStops();
 
+    emit colorTableChanged(stops);
 }
 
-void DkTransferToolBar::pickColor(bool enabled) {
-
-	emit pickColorRequest(enabled);
+void DkTransferToolBar::changeChannel(int index)
+{
+    emit channelChanged(index);
 }
 
-void DkTransferToolBar::enableTFCheckBoxClicked(int state) {
+void DkTransferToolBar::resetGradient()
+{
+    mGradient->reset();
 
-	bool enabled;
-	if (state == Qt::Checked)
-		enabled = true;
-	else
-		enabled = false;
+    QGradientStops stops = mGradient->getGradientStops();
 
-	enableToolBar(enabled);
+    emit colorTableChanged(stops);
+}
 
-	// At this point the checkbox is disabled, hence enable it...
-	mEnableTFCheckBox->setEnabled(true);
+void DkTransferToolBar::paintEvent(QPaintEvent *event)
+{
+    QToolBar::paintEvent(event);
+}
 
-	if (enabled)
-		mEnableTFCheckBox->setStatusTip(tr("Disables the Pseudo Color function"));
-	else
-		mEnableTFCheckBox->setStatusTip(tr("Enables the Pseudo Color function"));
+void DkTransferToolBar::updateGradientHistory()
+{
+    mHistoryCombo->clear();
+    mHistoryCombo->setIconSize(QSize(50, 10));
 
-	emit tFEnabled(enabled);
-	emit gradientChanged();
+    for (int idx = 0; idx < mOldGradients.size(); idx++) {
+        QPixmap cg(50, 10);
+        QLinearGradient g(QPoint(0, 0), QPoint(50, 0));
+        g.setStops(mOldGradients[idx].stops());
+        QPainter p(&cg);
+        p.fillRect(cg.rect(), g);
+        mHistoryCombo->addItem(cg, tr(""));
+    }
 }
 
-void DkTransferToolBar::enableToolBar(bool enable) {
+void DkTransferToolBar::switchGradient(int idx)
+{
+    if (idx >= 0 && idx < mOldGradients.size()) {
+        mGradient->setGradient(mOldGradients[idx]);
+    }
+}
 
-	QObjectList list = this->children();
+void DkTransferToolBar::saveGradient()
+{
+    mOldGradients.prepend(mGradient->getGradient());
+    updateGradientHistory();
+    saveSettings();
+}
 
-	for (int i = 0; i < list.count(); i++) {
-		if (QWidget *action = qobject_cast<QWidget*>(list.at(i)))
-			action->setEnabled(enable);
-	}
-	
-	if (enable)
-		mEffect->setOpacity(1);
-	else
-		mEffect->setOpacity(.5);
+// DkCropToolbar --------------------------------------------------------------------
+DkCropToolBar::DkCropToolBar(const QString &title, QWidget *parent /* = 0 */)
+    : QToolBar(title, parent)
+{
+    createIcons();
+    createLayout();
+    QMetaObject::connectSlotsByName(this);
+
+    setIconSize(QSize(DkSettingsManager::param().effectiveIconSize(this), DkSettingsManager::param().effectiveIconSize(this)));
+    setObjectName("cropToolBar");
+}
+
+DkCropToolBar::~DkCropToolBar()
+{
+    // save settings
+    saveSettings();
+}
+
+void DkCropToolBar::loadSettings()
+{
+    DefaultSettings settings;
+    settings.beginGroup("Crop");
+
+    mHorValBox->setValue(settings.value("AspectRatioHorizontal", 0).toInt());
+    mVerValBox->setValue(settings.value("AspectRatioVertical", 0).toInt());
+    mGuideBox->setCurrentIndex(settings.value("guides", 1).toInt());
+    mInvertAction->setChecked(settings.value("inverted", false).toBool());
+    mInfoAction->setChecked(settings.value("info", true).toBool());
+    mCbMeta->setChecked(settings.value("cropToMetadata", false).toBool());
+    settings.endGroup();
+}
+
+void DkCropToolBar::saveSettings()
+{
+    DefaultSettings settings;
+    settings.beginGroup("Crop");
+
+    settings.setValue("AspectRatioHorizontal", mHorValBox->value());
+    settings.setValue("AspectRatioVertical", mVerValBox->value());
+    settings.setValue("guides", mGuideBox->currentIndex());
+    settings.setValue("inverted", mInvertAction->isChecked());
+    settings.setValue("info", mInfoAction->isChecked());
+    settings.setValue("cropToMetadata", mCbMeta->isChecked());
+    settings.endGroup();
+}
+
+void DkCropToolBar::createIcons()
+{
+    // create icons
+    mIcons.resize(icons_end);
+
+    mIcons[crop_icon] = DkImage::loadIcon(":/nomacs/img/crop.svg");
+    mIcons[cancel_icon] = DkImage::loadIcon(":/nomacs/img/close.svg");
+    mIcons[pan_icon] = DkImage::loadIcon(":/nomacs/img/pan.svg");
+    mIcons[pan_icon].addPixmap(DkImage::loadIcon(":/nomacs/img/pan-checked.svg"), QIcon::Normal, QIcon::On);
+    mIcons[invert_icon] = DkImage::loadIcon(":/nomacs/img/crop-invert.svg");
+    mIcons[invert_icon].addPixmap(DkImage::loadIcon(":/nomacs/img/crop-invert-checked.svg"), QIcon::Normal, QIcon::On);
+    mIcons[info_icon] = DkImage::loadIcon(":/nomacs/img/info.svg");
+
+    if (!DkSettingsManager::param().display().defaultIconColor) {
+        // now colorize all icons
+        for (int idx = 0; idx < mIcons.size(); idx++) {
+            mIcons[idx].addPixmap(DkImage::colorizePixmap(mIcons[idx].pixmap(DkSettingsManager::param().effectiveIconSize(this), QIcon::Normal, QIcon::On),
+                                                          DkSettingsManager::param().display().iconColor),
+                                  QIcon::Normal,
+                                  QIcon::On);
+            mIcons[idx].addPixmap(DkImage::colorizePixmap(mIcons[idx].pixmap(DkSettingsManager::param().effectiveIconSize(this), QIcon::Normal, QIcon::Off),
+                                                          DkSettingsManager::param().display().iconColor),
+                                  QIcon::Normal,
+                                  QIcon::Off);
+        }
+    }
+}
+
+void DkCropToolBar::createLayout()
+{
+    QList<QKeySequence> enterSc;
+    enterSc.append(QKeySequence(Qt::Key_Enter));
+    enterSc.append(QKeySequence(Qt::Key_Return));
+
+    QAction *cropAction = new QAction(mIcons[crop_icon], tr("Crop (ENTER)"), this);
+    cropAction->setShortcuts(enterSc);
+    cropAction->setObjectName("cropAction");
+
+    QAction *cancelAction = new QAction(mIcons[cancel_icon], tr("Cancel (ESC)"), this);
+    cancelAction->setShortcut(QKeySequence(Qt::Key_Escape));
+    cancelAction->setObjectName("cancelAction");
+
+    mPanAction = new QAction(mIcons[pan_icon], tr("Pan"), this);
+    mPanAction->setShortcut(QKeySequence(Qt::Key_P));
+    mPanAction->setObjectName("panAction");
+    mPanAction->setCheckable(true);
+    mPanAction->setChecked(false);
+
+    QStringList ratios;
+    ratios << "1:1"
+           << "4:3"
+           << "5:4"
+           << "14:10"
+           << "14:11"
+           << "16:9"
+           << "16:10";
+    ratios.prepend(tr("User Defined"));
+    ratios.prepend(tr("No Aspect Ratio"));
+    mRatioBox = new QComboBox(this);
+    mRatioBox->addItems(ratios);
+    mRatioBox->setObjectName("ratioBox");
+
+    mHorValBox = new QDoubleSpinBox(this);
+    mHorValBox->setObjectName("horValBox");
+    mHorValBox->setSpecialValueText("  ");
+    mHorValBox->setToolTip(tr("Horizontal Constraint"));
+    mHorValBox->setStatusTip(mHorValBox->toolTip());
+
+    QAction *swapAction = new QAction(DkImage::loadIcon(":/nomacs/img/swap.svg"), tr("Swap"), this);
+    swapAction->setObjectName("swapAction");
+    swapAction->setToolTip(tr("Swap Dimensions"));
+    swapAction->setStatusTip(swapAction->toolTip());
+
+    mVerValBox = new QDoubleSpinBox(this);
+    mVerValBox->setObjectName("verValBox");
+    mVerValBox->setSpecialValueText("  ");
+    mHorValBox->setToolTip(tr("Vertical Constraint"));
+    mHorValBox->setStatusTip(mHorValBox->toolTip());
+
+    mAngleBox = new QDoubleSpinBox(this);
+    mAngleBox->setObjectName("angleBox");
+    mAngleBox->setSuffix(dk_degree_str);
+    mAngleBox->setMinimum(-180);
+    mAngleBox->setMaximum(180);
+
+    // background color
+    mBgCol = QColor(0, 0, 0, 0);
+    mBgColButton = new QPushButton(this);
+    mBgColButton->setObjectName("bgColButton");
+    mBgColButton->setStyleSheet("QPushButton {background-color: " + DkUtils::colorToString(mBgCol) + "; border: 1px solid #888;}");
+    mBgColButton->setToolTip(tr("Background Color"));
+    mBgColButton->setStatusTip(mBgColButton->toolTip());
+
+    mColorDialog = new QColorDialog(this);
+    mColorDialog->setObjectName("colorDialog");
+    mColorDialog->setOption(QColorDialog::ShowAlphaChannel, true);
+
+    // crop customization
+    QStringList guides;
+    guides << tr("Guides") << tr("Rule of Thirds") << tr("Grid");
+    mGuideBox = new QComboBox(this);
+    mGuideBox->addItems(guides);
+    mGuideBox->setObjectName("guideBox");
+    mGuideBox->setToolTip(tr("Show Guides in the Preview"));
+    mGuideBox->setStatusTip(mGuideBox->toolTip());
+
+    mInvertAction = new QAction(mIcons[invert_icon], tr("Invert Crop Tool Color"), this);
+    mInvertAction->setObjectName("invertAction");
+    mInvertAction->setCheckable(true);
+    mInvertAction->setChecked(false);
+
+    mInfoAction = new QAction(mIcons[info_icon], tr("Show Info"), this);
+    mInfoAction->setObjectName("infoAction");
+    mInfoAction->setCheckable(true);
+    mInfoAction->setChecked(false);
+
+    mCbMeta = new QCheckBox(tr("Crop to Metadata"), this);
+    mCbMeta->setChecked(false);
+    mCbMeta->hide(); // "disabled" for now (keep it simple)
+
+    mCropRect = new DkRectWidget(QRect(), this);
+    mCropRect->setObjectName("cropRect");
+
+    addAction(cropAction);
+    addAction(mPanAction);
+    addAction(cancelAction);
+    addSeparator();
+    addWidget(mRatioBox);
+    addWidget(mHorValBox);
+    addAction(swapAction);
+    addWidget(mVerValBox);
+    addWidget(mAngleBox);
+    addSeparator();
+    addWidget(mBgColButton);
+    addSeparator();
+    addWidget(mGuideBox);
+    addAction(mInvertAction);
+    addAction(mInfoAction);
+    addWidget(mCbMeta);
+    addSeparator();
+    addWidget(mCropRect);
+
+    connect(mCropRect, SIGNAL(updateRectSignal(const QRect &)), this, SIGNAL(updateRectSignal(const QRect &)));
+}
+
+void DkCropToolBar::setVisible(bool visible)
+{
+    if (!visible)
+        emit colorSignal(Qt::NoBrush);
+    else
+        emit colorSignal(mBgCol);
+
+    if (visible) {
+        mPanAction->setChecked(false);
+        mAngleBox->setValue(0);
+    }
+
+    QToolBar::setVisible(visible);
+}
 
+void DkCropToolBar::setAspectRatio(const QPointF &aRatio)
+{
+    mHorValBox->setValue(aRatio.x());
+    mVerValBox->setValue(aRatio.y());
 }
 
-void DkTransferToolBar::applyTF() {
+void DkCropToolBar::setRect(const QRect &r)
+{
+    mCropRect->setRect(r);
+}
 
-	QGradientStops stops = mGradient->getGradientStops();
+void DkCropToolBar::on_cropAction_triggered()
+{
+    emit cropSignal(mCbMeta->isChecked());
+}
 
-	emit colorTableChanged(stops);
+void DkCropToolBar::on_cancelAction_triggered()
+{
+    emit cancelSignal();
 }
 
-void DkTransferToolBar::changeChannel(int index) {
+void DkCropToolBar::on_invertAction_toggled(bool checked)
+{
+    emit shadingHint(checked);
+}
 
-	emit channelChanged(index);
+void DkCropToolBar::on_infoAction_toggled(bool checked)
+{
+    emit showInfo(checked);
 }
 
-void DkTransferToolBar::resetGradient() {
+void DkCropToolBar::on_swapAction_triggered()
+{
+    int tmpV = qRound(mHorValBox->value());
+    mHorValBox->setValue(mVerValBox->value());
+    mVerValBox->setValue(tmpV);
+}
 
-	mGradient->reset();
+void DkCropToolBar::on_angleBox_valueChanged(double val)
+{
+    emit angleSignal(DK_DEG2RAD * val);
+}
 
-	QGradientStops stops = mGradient->getGradientStops();
+void DkCropToolBar::angleChanged(double val)
+{
+    double angle = val * DK_RAD2DEG;
+    while (angle > 90)
+        angle -= 180;
+    while (angle <= -90)
+        angle += 180;
 
-	emit colorTableChanged(stops);
+    mAngleBox->blockSignals(true);
+    mAngleBox->setValue(angle);
+    mAngleBox->blockSignals(false);
 }
 
-void DkTransferToolBar::paintEvent(QPaintEvent* event) {
+void DkCropToolBar::on_bgColButton_clicked()
+{
+    QColor tmpCol = mBgCol;
+    if (!tmpCol.alpha())
+        tmpCol.setAlpha(255); // avoid frustrated users
 
-	QToolBar::paintEvent(event);
+    mColorDialog->setCurrentColor(tmpCol);
+    int ok = mColorDialog->exec();
 
+    if (ok == QDialog::Accepted) {
+        mBgCol = mColorDialog->currentColor();
+        mBgColButton->setStyleSheet("QPushButton {background-color: " + DkUtils::colorToString(mBgCol) + "; border: 1px solid #888;}");
+        emit colorSignal(mBgCol);
+    }
 }
 
-void DkTransferToolBar::updateGradientHistory() {
+void DkCropToolBar::on_ratioBox_currentIndexChanged(const QString &text)
+{
+    // user defined -> do nothing
+    if (mRatioBox->currentIndex() == 1)
+        return;
 
-	mHistoryCombo->clear();
-	mHistoryCombo->setIconSize(QSize(50,10));
+    // no aspect ratio -> clear boxes
+    if (mRatioBox->currentIndex() == 0) {
+        mHorValBox->setValue(0);
+        mVerValBox->setValue(0);
+        return;
+    }
 
-	for (int idx = 0; idx < mOldGradients.size(); idx++) {
+    QStringList vals = text.split(":");
 
-		QPixmap cg(50, 10);
-		QLinearGradient g(QPoint(0,0), QPoint(50, 0));
-		g.setStops(mOldGradients[idx].stops());
-		QPainter p(&cg);
-		p.fillRect(cg.rect(), g);
-		mHistoryCombo->addItem(cg, tr(""));
-	}
-}
+    qDebug() << vals;
 
-void DkTransferToolBar::switchGradient(int idx) {
+    if (vals.size() == 2) {
+        mHorValBox->setValue(vals[0].toDouble());
+        mVerValBox->setValue(vals[1].toDouble());
+    }
+}
 
-	if (idx >= 0 && idx < mOldGradients.size()) {
-		mGradient->setGradient(mOldGradients[idx]);
-	}
+void DkCropToolBar::on_guideBox_currentIndexChanged(int idx)
+{
+    emit paintHint(idx);
+}
 
+void DkCropToolBar::on_verValBox_valueChanged(double val)
+{
+    // just pass it on
+    on_horValBox_valueChanged(val);
 }
 
-void DkTransferToolBar::saveGradient() {
-	
-	mOldGradients.prepend(mGradient->getGradient());
-	updateGradientHistory();
-	saveSettings();
+void DkCropToolBar::on_horValBox_valueChanged(double)
+{
+    DkVector diag = DkVector((float)mHorValBox->value(), (float)mVerValBox->value());
+    emit aspectRatio(diag);
+
+    QString rs = QString::number(mHorValBox->value()) + ":" + QString::number(mVerValBox->value());
+
+    int idx = mRatioBox->findText(rs);
+
+    if (idx != -1)
+        mRatioBox->setCurrentIndex(idx);
+    else if (mHorValBox->value() == 0 && mVerValBox->value() == 0)
+        mRatioBox->setCurrentIndex(0);
+    else
+        mRatioBox->setCurrentIndex(1);
 }
 
-// -------------------------------------------------------------------- DkToolBarManager 
-DkToolBarManager::DkToolBarManager() {
+void DkCropToolBar::on_panAction_toggled(bool checked)
+{
+    emit panSignal(checked);
 }
 
-DkToolBarManager& DkToolBarManager::inst() {
+// -------------------------------------------------------------------- DkToolBarManager
+DkToolBarManager::DkToolBarManager()
+{
+}
 
-	static DkToolBarManager inst;
-	return inst;
+DkToolBarManager &DkToolBarManager::inst()
+{
+    static DkToolBarManager inst;
+    return inst;
 }
 
-void DkToolBarManager::createDefaultToolBar() {
-	
-	if (mToolBar)
-		return;
+void DkToolBarManager::createDefaultToolBar()
+{
+    if (mToolBar)
+        return;
 
-	auto nomacs = dynamic_cast<QMainWindow*>(DkUtils::getMainWindow());
-	assert(nomacs);
+    auto nomacs = dynamic_cast<QMainWindow *>(DkUtils::getMainWindow());
+    assert(nomacs);
 
-	mToolBar = new DkMainToolBar(QObject::tr("Edit ToolBar"), nomacs);
-	mToolBar->setObjectName("EditToolBar");
+    mToolBar = new DkMainToolBar(QObject::tr("Edit ToolBar"), nomacs);
+    mToolBar->setObjectName("EditToolBar");
 
-	int is = DkSettingsManager::param().effectiveIconSize(nomacs);
-	mToolBar->setIconSize(QSize(is, is));
+    int is = DkSettingsManager::param().effectiveIconSize(nomacs);
+    mToolBar->setIconSize(QSize(is, is));
 
-	// add actions
-	DkActionManager& am = DkActionManager::instance();
-	mToolBar->addAction(am.action(DkActionManager::menu_file_prev));
-	mToolBar->addAction(am.action(DkActionManager::menu_file_next));
-	mToolBar->addSeparator();
+    // add actions
+    DkActionManager &am = DkActionManager::instance();
+    mToolBar->addAction(am.action(DkActionManager::menu_file_prev));
+    mToolBar->addAction(am.action(DkActionManager::menu_file_next));
+    mToolBar->addSeparator();
 
-	mToolBar->addAction(am.action(DkActionManager::menu_file_open));
-	mToolBar->addAction(am.action(DkActionManager::menu_file_open_dir));
-	mToolBar->addAction(am.action(DkActionManager::menu_file_save));
-	mToolBar->addAction(am.action(DkActionManager::menu_edit_delete));
-	mToolBar->addAction(am.action(DkActionManager::menu_tools_filter));
-	mToolBar->addSeparator();
+    mToolBar->addAction(am.action(DkActionManager::menu_file_open));
+    mToolBar->addAction(am.action(DkActionManager::menu_file_open_dir));
+    mToolBar->addAction(am.action(DkActionManager::menu_file_save));
+    mToolBar->addAction(am.action(DkActionManager::menu_edit_delete));
+    mToolBar->addAction(am.action(DkActionManager::menu_tools_filter));
+    mToolBar->addSeparator();
 
-	// view
-	mToolBar->addAction(am.action(DkActionManager::menu_view_zoom_in));
-	mToolBar->addAction(am.action(DkActionManager::menu_view_zoom_out));
-	mToolBar->addSeparator();
+    // view
+    mToolBar->addAction(am.action(DkActionManager::menu_view_zoom_in));
+    mToolBar->addAction(am.action(DkActionManager::menu_view_zoom_out));
+    mToolBar->addSeparator();
 
-	// edit
-	mToolBar->addAction(am.action(DkActionManager::menu_edit_copy));
-	mToolBar->addAction(am.action(DkActionManager::menu_edit_paste));
-	mToolBar->addSeparator();
-	mToolBar->addAction(am.action(DkActionManager::menu_edit_rotate_ccw));
-	mToolBar->addAction(am.action(DkActionManager::menu_edit_rotate_cw));
-	mToolBar->addSeparator();
-	mToolBar->addAction(am.action(DkActionManager::menu_edit_crop));
-	mToolBar->addAction(am.action(DkActionManager::menu_edit_transform));
-	mToolBar->addSeparator();
+    // edit
+    mToolBar->addAction(am.action(DkActionManager::menu_edit_copy));
+    mToolBar->addAction(am.action(DkActionManager::menu_edit_paste));
+    mToolBar->addSeparator();
+    mToolBar->addAction(am.action(DkActionManager::menu_edit_rotate_ccw));
+    mToolBar->addAction(am.action(DkActionManager::menu_edit_rotate_cw));
+    mToolBar->addSeparator();
+    mToolBar->addAction(am.action(DkActionManager::menu_edit_crop));
+    mToolBar->addAction(am.action(DkActionManager::menu_edit_transform));
+    mToolBar->addSeparator();
 
-	// view
-	mToolBar->addAction(am.action(DkActionManager::menu_view_fullscreen));
-	mToolBar->addAction(am.action(DkActionManager::menu_view_reset));
-	mToolBar->addAction(am.action(DkActionManager::menu_view_100));
-	mToolBar->addSeparator();
+    // view
+    mToolBar->addAction(am.action(DkActionManager::menu_view_fullscreen));
+    mToolBar->addAction(am.action(DkActionManager::menu_view_reset));
+    mToolBar->addAction(am.action(DkActionManager::menu_view_100));
+    mToolBar->addSeparator();
 
-	mToolBar->addAction(am.action(DkActionManager::menu_view_gps_map));
-	mToolBar->allActionsAdded();
+    mToolBar->addAction(am.action(DkActionManager::menu_view_gps_map));
+    mToolBar->allActionsAdded();
 
-	mMovieToolBar = nomacs->addToolBar(QObject::tr("Movie ToolBar"));
-	mMovieToolBar->setObjectName("movieToolbar");
-	mMovieToolBar->setIconSize(QSize(is, is));
-	mMovieToolBar->addAction(am.action(DkActionManager::menu_view_movie_prev));
-	mMovieToolBar->addAction(am.action(DkActionManager::menu_view_movie_pause));
-	mMovieToolBar->addAction(am.action(DkActionManager::menu_view_movie_next));
+    mMovieToolBar = nomacs->addToolBar(QObject::tr("Movie ToolBar"));
+    mMovieToolBar->setObjectName("movieToolbar");
+    mMovieToolBar->setIconSize(QSize(is, is));
+    mMovieToolBar->addAction(am.action(DkActionManager::menu_view_movie_prev));
+    mMovieToolBar->addAction(am.action(DkActionManager::menu_view_movie_pause));
+    mMovieToolBar->addAction(am.action(DkActionManager::menu_view_movie_next));
 
-	nomacs->addToolBar(mToolBar);
+    nomacs->addToolBar(mToolBar);
 }
 
-void DkToolBarManager::show(bool show, bool permanent) {
-	showDefaultToolBar(show, permanent);
-	showMovieToolBar(show);
-	showToolBarsTemporarily(show);
+void DkToolBarManager::show(bool show, bool permanent)
+{
+    showDefaultToolBar(show, permanent);
+    showMovieToolBar(show);
+    showToolBarsTemporarily(show);
 }
 
-void DkToolBarManager::restore() {
-
-	if (mToolBar)
-		mToolBar->setVisible(DkSettingsManager::param().app().showToolBar);
-	if (mMovieToolBar)
-		mMovieToolBar->setVisible(DkSettingsManager::param().app().showMovieToolBar);
+void DkToolBarManager::restore()
+{
+    if (mToolBar)
+        mToolBar->setVisible(DkSettingsManager::param().app().showToolBar);
+    if (mMovieToolBar)
+        mMovieToolBar->setVisible(DkSettingsManager::param().app().showMovieToolBar);
 }
 
-void DkToolBarManager::showToolBar(QToolBar* toolbar, bool show) {
-
-	if (!toolbar)
-		return;
-
-	showToolBarsTemporarily(!show);
-	QMainWindow* nomacs = dynamic_cast<QMainWindow*>(DkUtils::getMainWindow());
-	assert(nomacs);
+void DkToolBarManager::showToolBar(QToolBar *toolbar, bool show)
+{
+    if (!toolbar)
+        return;
 
-	if (show) {
+    showToolBarsTemporarily(!show);
+    QMainWindow *nomacs = dynamic_cast<QMainWindow *>(DkUtils::getMainWindow());
+    assert(nomacs);
 
-		if (!mToolBar)
-			createDefaultToolBar();
+    if (show) {
+        if (!mToolBar)
+            createDefaultToolBar();
 
-		nomacs->addToolBar(nomacs->toolBarArea(mToolBar), toolbar);
-	}
-	else
-		nomacs->removeToolBar(toolbar);
+        nomacs->addToolBar(nomacs->toolBarArea(mToolBar), toolbar);
+    } else
+        nomacs->removeToolBar(toolbar);
 
-	toolbar->setVisible(show);
+    toolbar->setVisible(show);
 }
 
-void DkToolBarManager::showToolBarsTemporarily(bool show) {
+void DkToolBarManager::showToolBarsTemporarily(bool show)
+{
+    if (show) {
+        for (QToolBar *t : mHiddenToolBars)
+            t->show();
+    } else {
+        QMainWindow *nomacs = dynamic_cast<QMainWindow *>(DkUtils::getMainWindow());
+        assert(nomacs);
 
-	if (show) {
+        mHiddenToolBars.clear();
+        QList<QToolBar *> tbs = nomacs->findChildren<QToolBar *>();
 
-		for (QToolBar* t : mHiddenToolBars)
-			t->show();
-	}
-	else {
-
-		QMainWindow* nomacs = dynamic_cast<QMainWindow*>(DkUtils::getMainWindow());
-		assert(nomacs);
-
-		mHiddenToolBars.clear();
-		QList<QToolBar *> tbs = nomacs->findChildren<QToolBar *>();
-
-		for (QToolBar* t : tbs) {
-
-			if (t->isVisible()) {
-				t->hide();
-				mHiddenToolBars.append(t);
-			}
-		}
-	}
+        for (QToolBar *t : tbs) {
+            if (t->isVisible()) {
+                t->hide();
+                mHiddenToolBars.append(t);
+            }
+        }
+    }
 }
 
-void DkToolBarManager::showDefaultToolBar(bool show, bool permanent) {
-
-	if (!show && !mToolBar)
-		return;
+void DkToolBarManager::showDefaultToolBar(bool show, bool permanent)
+{
+    if (!show && !mToolBar)
+        return;
 
-	if (!mToolBar)
-		createDefaultToolBar();
+    if (!mToolBar)
+        createDefaultToolBar();
 
-	if (mToolBar->isVisible() == show)
-		return;
+    if (mToolBar->isVisible() == show)
+        return;
 
-	if (permanent)
-		DkSettingsManager::param().app().showToolBar = show;
-	DkActionManager::instance().action(DkActionManager::menu_panel_toolbar)->setChecked(DkSettingsManager::param().app().showToolBar);
+    if (permanent)
+        DkSettingsManager::param().app().showToolBar = show;
+    DkActionManager::instance().action(DkActionManager::menu_panel_toolbar)->setChecked(DkSettingsManager::param().app().showToolBar);
 
-	mToolBar->setVisible(show);
+    mToolBar->setVisible(show);
 }
 
-void DkToolBarManager::showMovieToolBar(bool show) {
+void DkToolBarManager::showMovieToolBar(bool show)
+{
+    QMainWindow *nomacs = dynamic_cast<QMainWindow *>(DkUtils::getMainWindow());
+    assert(nomacs);
 
-	QMainWindow* nomacs = dynamic_cast<QMainWindow*>(DkUtils::getMainWindow());
-	assert(nomacs);
+    // set movie toolbar into current toolbar
+    if (mMovieToolbarArea == Qt::NoToolBarArea && show)
+        mMovieToolbarArea = nomacs->toolBarArea(mToolBar);
 
-	// set movie toolbar into current toolbar
-	if (mMovieToolbarArea == Qt::NoToolBarArea && show)
-		mMovieToolbarArea = nomacs->toolBarArea(mToolBar);
+    if (show)
+        nomacs->addToolBar(mMovieToolbarArea, mMovieToolBar);
+    else {
+        // remember if the user changed it
+        Qt::ToolBarArea nta = nomacs->toolBarArea(mMovieToolBar);
 
-	if (show)
-		nomacs->addToolBar(mMovieToolbarArea, mMovieToolBar);
-	else {
-		// remember if the user changed it
-		Qt::ToolBarArea nta = nomacs->toolBarArea(mMovieToolBar);
+        if (nta != Qt::NoToolBarArea && mMovieToolBar->isVisible())
+            mMovieToolbarArea = nomacs->toolBarArea(mMovieToolBar);
+        nomacs->removeToolBar(mMovieToolBar);
+    }
 
-		if (nta != Qt::NoToolBarArea && mMovieToolBar->isVisible())
-			mMovieToolbarArea = nomacs->toolBarArea(mMovieToolBar);
-		nomacs->removeToolBar(mMovieToolBar);
-	}
-
-	if (mToolBar && mToolBar->isVisible())
-		mMovieToolBar->setVisible(show);
+    if (mToolBar && mToolBar->isVisible())
+        mMovieToolBar->setVisible(show);
 }
 
+void DkToolBarManager::createTransferToolBar()
+{
+    QMainWindow *nomacs = dynamic_cast<QMainWindow *>(DkUtils::getMainWindow());
+    assert(nomacs);
 
-void DkToolBarManager::createTransferToolBar() {
-
-	QMainWindow* nomacs = dynamic_cast<QMainWindow*>(DkUtils::getMainWindow());
-	assert(nomacs);
+    mTransferToolBar = new DkTransferToolBar(nomacs);
 
-	mTransferToolBar = new DkTransferToolBar(nomacs);
+    // add this toolbar below all previous toolbars
+    nomacs->addToolBarBreak();
+    nomacs->addToolBar(mTransferToolBar);
+    mTransferToolBar->setObjectName("TransferToolBar");
 
-	// add this toolbar below all previous toolbars
-	nomacs->addToolBarBreak();
-	nomacs->addToolBar(mTransferToolBar);
-	mTransferToolBar->setObjectName("TransferToolBar");
-
-	int is = DkSettingsManager::param().effectiveIconSize(nomacs);
-	mTransferToolBar->setIconSize(QSize(is, is));
+    int is = DkSettingsManager::param().effectiveIconSize(nomacs);
+    mTransferToolBar->setIconSize(QSize(is, is));
 }
 
-DkMainToolBar * DkToolBarManager::defaultToolBar() const {
-	return mToolBar;
+DkMainToolBar *DkToolBarManager::defaultToolBar() const
+{
+    return mToolBar;
 }
 
-DkTransferToolBar * DkToolBarManager::transferToolBar() const {
-	return mTransferToolBar;
+DkTransferToolBar *DkToolBarManager::transferToolBar() const
+{
+    return mTransferToolBar;
 }
 
-
 }
diff --git a/ImageLounge/src/DkGui/DkToolbars.h b/ImageLounge/src/DkGui/DkToolbars.h
index fece90b..c4f2204 100644
--- a/ImageLounge/src/DkGui/DkToolbars.h
+++ b/ImageLounge/src/DkGui/DkToolbars.h
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkTransferToolBar.h
  Created on:	13.02.2012
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -29,14 +29,14 @@
 
 #include "DkBaseWidgets.h"
 
-#pragma warning(push, 0)	// no warnings from includes - begin
+#pragma warning(push, 0) // no warnings from includes - begin
+#include <QCompleter>
+#include <QObject>
 #include <QToolBar>
 #include <QWidget>
-#include <QObject>
-#include <QCompleter>
-#pragma warning(pop)		// no warnings from includes - end
+#pragma warning(pop) // no warnings from includes - end
 
-#pragma warning(disable: 4251)
+#pragma warning(disable : 4251)
 
 // Qt defines
 class QCheckBox;
@@ -48,7 +48,8 @@ class QPushButton;
 class QColorDialog;
 class QStandardItemModel;
 
-namespace nmc {
+namespace nmc
+{
 
 class DkTransferToolBar;
 class DkVector;
@@ -56,223 +57,301 @@ class DkQuickAccess;
 class DkQuickAccessEdit;
 class DkRectWidget;
 
-class DkMainToolBar : public QToolBar {
-	Q_OBJECT
+class DkMainToolBar : public QToolBar
+{
+    Q_OBJECT
 
 public:
-	DkMainToolBar(const QString & title, QWidget * parent = 0);
+    DkMainToolBar(const QString &title, QWidget *parent = 0);
 
-	void allActionsAdded();	// fast fix for now
-	void setQuickAccessModel(QStandardItemModel* model);
-	DkQuickAccessEdit* getQuickAccess() const;
+    void allActionsAdded(); // fast fix for now
+    void setQuickAccessModel(QStandardItemModel *model);
+    DkQuickAccessEdit *getQuickAccess() const;
 
 public slots:
-	void closeQuickAccess();
+    void closeQuickAccess();
 
 protected:
-	void createLayout();
+    void createLayout();
 
-	DkQuickAccessEdit* mQuickAccessEdit;
+    DkQuickAccessEdit *mQuickAccessEdit;
 };
 
-class DkColorSlider : public DkWidget {
-	Q_OBJECT
-	
+class DkColorSlider : public DkWidget
+{
+    Q_OBJECT
+
 public:
-	//DkColorSlider(QWidget *parent);
-	DkColorSlider(QWidget *parent, QColor color);
-	DkColorSlider(QWidget *parent, qreal normedPos, QColor color, int sliderWidth);
-	~DkColorSlider();
-	QColor getColor();
-	qreal getNormedPos();
-	void setNormedPos(qreal pos);
-	void setActive(bool isActive);
-	void updatePos(int parentWidth);
-
-	//void paintSlider(QPainter *painter);
+    // DkColorSlider(QWidget *parent);
+    DkColorSlider(QWidget *parent, QColor color);
+    DkColorSlider(QWidget *parent, qreal normedPos, QColor color, int sliderWidth);
+    ~DkColorSlider();
+    QColor getColor();
+    qreal getNormedPos();
+    void setNormedPos(qreal pos);
+    void setActive(bool isActive);
+    void updatePos(int parentWidth);
+
+    // void paintSlider(QPainter *painter);
 
 signals:
-	void sliderMoved(DkColorSlider *sender, int dragDistX, int yPos) const;
-	void sliderActivated(DkColorSlider *sender) const;
-	void colorChanged(DkColorSlider *slider) const;
-				
+    void sliderMoved(DkColorSlider *sender, int dragDistX, int yPos) const;
+    void sliderActivated(DkColorSlider *sender) const;
+    void colorChanged(DkColorSlider *slider) const;
+
 public slots:
-	virtual void paintEvent(QPaintEvent* event) override;
+    virtual void paintEvent(QPaintEvent *event) override;
 
 protected:
-	virtual void mousePressEvent(QMouseEvent *event) override;
-	virtual void mouseMoveEvent(QMouseEvent *event) override;
-	virtual void mouseDoubleClickEvent(QMouseEvent *event) override;
+    virtual void mousePressEvent(QMouseEvent *event) override;
+    virtual void mouseMoveEvent(QMouseEvent *event) override;
+    virtual void mouseDoubleClickEvent(QMouseEvent *event) override;
 
 private:
-	int mSliderWidth = 0, mSliderHeight = 0, mSliderHalfWidth = 0;
-	bool mIsActive = false;
-	int mDragStartX = 0;
-	QColor mColor;
-	qreal mNormedPos;
+    int mSliderWidth = 0, mSliderHeight = 0, mSliderHalfWidth = 0;
+    bool mIsActive = false;
+    int mDragStartX = 0;
+    QColor mColor;
+    qreal mNormedPos;
 };
 
-class DkGradient : public DkWidget {
-	Q_OBJECT
+class DkGradient : public DkWidget
+{
+    Q_OBJECT
 
 public:
-	DkGradient(QWidget *parent);
-	~DkGradient();
-	QGradientStops getGradientStops();
-	void insertSlider(qreal pos, QColor col = QColor());
-	void reset();
-	QLinearGradient getGradient();
-	void setGradient(const QLinearGradient& gradient);
+    DkGradient(QWidget *parent);
+    ~DkGradient();
+    QGradientStops getGradientStops();
+    void insertSlider(qreal pos, QColor col = QColor());
+    void reset();
+    QLinearGradient getGradient();
+    void setGradient(const QLinearGradient &gradient);
 
 signals:
-	void gradientChanged() const;
-		
+    void gradientChanged() const;
+
 public slots:
-	void moveSlider(DkColorSlider* sender, int dragDistX, int yPos);
-	void changeColor(DkColorSlider *slider);
-	void activateSlider(DkColorSlider *sender);
+    void moveSlider(DkColorSlider *sender, int dragDistX, int yPos);
+    void changeColor(DkColorSlider *slider);
+    void activateSlider(DkColorSlider *sender);
 
 protected:
-	virtual void paintEvent(QPaintEvent* event) override;
-	virtual void mousePressEvent(QMouseEvent *event) override;
-	virtual void mouseReleaseEvent(QMouseEvent *event) override;
-	virtual void resizeEvent(QResizeEvent * event) override;
-		
+    virtual void paintEvent(QPaintEvent *event) override;
+    virtual void mousePressEvent(QMouseEvent *event) override;
+    virtual void mouseReleaseEvent(QMouseEvent *event) override;
+    virtual void resizeEvent(QResizeEvent *event) override;
+
 private:
-	void init();
-	void addSlider(qreal pos, QColor color);
-	void clearAllSliders();
-	void updateGradient();
-	qreal getNormedPos(int pos);
-	int getAbsolutePos(qreal pos);
-
-	int mClickAreaHeight;
-	int mDeleteSliderDist;
-	QVector<DkColorSlider*> mSliders;
-	bool mIsSliderDragged = false;
-	QLinearGradient mGradient;
-	int mSliderWidth = 0, mHalfSliderWidth = 0;
-
-	DkColorSlider *mActiveSlider = 0;
-	bool mIsActiveSliderExisting = false;
+    void init();
+    void addSlider(qreal pos, QColor color);
+    void clearAllSliders();
+    void updateGradient();
+    qreal getNormedPos(int pos);
+    int getAbsolutePos(qreal pos);
+
+    int mClickAreaHeight;
+    int mDeleteSliderDist;
+    QVector<DkColorSlider *> mSliders;
+    bool mIsSliderDragged = false;
+    QLinearGradient mGradient;
+    int mSliderWidth = 0, mHalfSliderWidth = 0;
+
+    DkColorSlider *mActiveSlider = 0;
+    bool mIsActiveSliderExisting = false;
 };
 
 enum toolBarIcons {
-	icon_toolbar_reset,
-	icon_toolbar_pipette,
-	icon_toolbar_save,
-	icon_toolbar_end,	// nothing beyond this point
+    icon_toolbar_reset,
+    icon_toolbar_pipette,
+    icon_toolbar_save,
+    icon_toolbar_end, // nothing beyond this point
 };
 
 enum toolBarActions {
-	toolbar_save,
-	toolbar_reset,
-	toolbar_pipette,
-	toolbar_end,	// nothing beyond this point
+    toolbar_save,
+    toolbar_reset,
+    toolbar_pipette,
+    toolbar_end, // nothing beyond this point
 };
 
 enum imageModes {
-	mode_uninitialized,
-	mode_invalid_format,
-	mode_gray,
-	mode_rgb,
+    mode_uninitialized,
+    mode_invalid_format,
+    mode_gray,
+    mode_rgb,
 };
 
-class DkTransferToolBar : public QToolBar {
-	Q_OBJECT
+class DkTransferToolBar : public QToolBar
+{
+    Q_OBJECT
 
 public:
-	DkTransferToolBar(QWidget *parent);
-	~DkTransferToolBar();
-		
+    DkTransferToolBar(QWidget *parent);
+    ~DkTransferToolBar();
 
 signals:
-	void pickColorRequest(bool enabled) const;
-	void colorTableChanged(QGradientStops stops) const;
-	void channelChanged(int channel) const;
-	void transferFunctionChanged(int channel, QGradientStops stops) const;
-	void tFEnabled(bool) const;
-	void gradientChanged() const;
+    void pickColorRequest(bool enabled) const;
+    void colorTableChanged(QGradientStops stops) const;
+    void channelChanged(int channel) const;
+    void transferFunctionChanged(int channel, QGradientStops stops) const;
+    void tFEnabled(bool) const;
+    void gradientChanged() const;
 
 public slots:
-	virtual void paintEvent(QPaintEvent* event) override;
-	void insertSlider(qreal pos);
-	void setImageMode(int mode);
-	void saveGradient();
-	void deleteGradientMenu(QPoint pos);
-	void deleteGradient();
-	void resetGradient();
+    virtual void paintEvent(QPaintEvent *event) override;
+    void insertSlider(qreal pos);
+    void setImageMode(int mode);
+    void saveGradient();
+    void deleteGradientMenu(QPoint pos);
+    void deleteGradient();
+    void resetGradient();
 
 protected slots:
-	void applyTF();
-	void pickColor(bool enabled);
-	void changeChannel(int index);
-	void enableTFCheckBoxClicked(int state);
-	void switchGradient(int idx);
+    void applyTF();
+    void pickColor(bool enabled);
+    void changeChannel(int index);
+    void enableTFCheckBoxClicked(int state);
+    void switchGradient(int idx);
 
 protected:
-	virtual void resizeEvent(QResizeEvent * event) override;
-	void loadSettings();
-	void saveSettings();
-	void updateGradientHistory();
+    virtual void resizeEvent(QResizeEvent *event) override;
+    void loadSettings();
+    void saveSettings();
+    void updateGradientHistory();
 
 private:
-	void createIcons();
-	void applyImageMode(int mode);
-	void enableToolBar(bool enable);
-	
-	QCheckBox *mEnableTFCheckBox = 0;
-		
-	QImage mShade;
-	QImage mSliderImg, mActiveSliderImg;
-
-	QVector<QAction *> mToolBarActions;
-	QVector<QIcon> mToolBarIcons;
-		
-	DkGradient *mGradient = 0;
-	QComboBox *mChannelComboBox = 0;
-
-	QComboBox* mHistoryCombo = 0;
-	QVector<QLinearGradient> mOldGradients;
-
-	QGraphicsOpacityEffect *mEffect = 0;
-	int mImageMode = mode_uninitialized;
+    void createIcons();
+    void applyImageMode(int mode);
+    void enableToolBar(bool enable);
+
+    QCheckBox *mEnableTFCheckBox = 0;
+
+    QImage mShade;
+    QImage mSliderImg, mActiveSliderImg;
+
+    QVector<QAction *> mToolBarActions;
+    QVector<QIcon> mToolBarIcons;
+
+    DkGradient *mGradient = 0;
+    QComboBox *mChannelComboBox = 0;
+
+    QComboBox *mHistoryCombo = 0;
+    QVector<QLinearGradient> mOldGradients;
 
+    QGraphicsOpacityEffect *mEffect = 0;
+    int mImageMode = mode_uninitialized;
 };
 
-class DllCoreExport DkToolBarManager {
+class DkCropToolBar : public QToolBar
+{
+    Q_OBJECT
 
 public:
-	static DkToolBarManager& inst();
+    enum {
+        crop_icon = 0,
+        pan_icon,
+        cancel_icon,
+        invert_icon,
+        info_icon,
 
-	// singleton
-	DkToolBarManager(DkToolBarManager const&) = delete;
-	void operator=(DkToolBarManager const&) = delete;
+        icons_end,
 
-	void showDefaultToolBar(bool show, bool permanent = true);
-	void showMovieToolBar(bool show);
-	void show(bool show, bool permanent = false);
-	void restore();
-	void showToolBar(QToolBar* toolbar, bool show);
-	void showToolBarsTemporarily(bool show);
+    };
 
-	void createTransferToolBar();
+    DkCropToolBar(const QString &title, QWidget *parent = 0);
+    virtual ~DkCropToolBar();
 
-	DkMainToolBar* defaultToolBar() const;
-	DkTransferToolBar* transferToolBar() const;
+    QColor getColor()
+    {
+        return mBgCol;
+    };
 
-private:
-	DkToolBarManager();
-	void createDefaultToolBar();
+    void loadSettings();
 
-	DkMainToolBar* mToolBar = 0;
-	QToolBar* mMovieToolBar = 0;
-	QVector<QToolBar*> mHiddenToolBars;
-	Qt::ToolBarArea mMovieToolbarArea = Qt::NoToolBarArea;
+public slots:
+    void setAspectRatio(const QPointF &aRatio);
+    void setRect(const QRect &r);
+    void on_cropAction_triggered();
+    void on_cancelAction_triggered();
+    void on_swapAction_triggered();
+    void on_ratioBox_currentIndexChanged(const QString &text);
+    void on_guideBox_currentIndexChanged(int idx);
+    void on_horValBox_valueChanged(double val);
+    void on_verValBox_valueChanged(double val);
+    void on_angleBox_valueChanged(double val);
+    void on_bgColButton_clicked();
+    void on_panAction_toggled(bool checked);
+    void on_invertAction_toggled(bool checked);
+    void on_infoAction_toggled(bool checked);
+    void angleChanged(double val);
+    virtual void setVisible(bool visible) override;
 
-	DkTransferToolBar* mTransferToolBar = 0;
+signals:
+    void panSignal(bool checked);
+    void cropSignal(bool cropToMetadata = false); // vs. crop
+    void cancelSignal();
+    void aspectRatio(const DkVector &diag);
+    void angleSignal(double angle);
+    void colorSignal(const QBrush &brush);
+    void paintHint(int paintMode);
+    void shadingHint(bool invert);
+    void showInfo(bool show);
+    void updateRectSignal(const QRect &r);
 
+protected:
+    void createLayout();
+    void createIcons();
+    void saveSettings();
+
+    QComboBox *mRatioBox = 0;
+    QComboBox *mGuideBox = 0;
+    QAction *mInvertAction = 0;
+    QDoubleSpinBox *mHorValBox = 0;
+    QDoubleSpinBox *mVerValBox = 0;
+    QDoubleSpinBox *mAngleBox = 0;
+    QPushButton *mBgColButton = 0;
+    QColorDialog *mColorDialog = 0;
+    QColor mBgCol;
+    QAction *mPanAction = 0;
+    QAction *mInfoAction = 0;
+    QCheckBox *mCbMeta = 0;
+    DkRectWidget *mCropRect = 0;
+
+    QVector<QIcon> mIcons; // needed for colorizing
 };
 
+class DllCoreExport DkToolBarManager
+{
+public:
+    static DkToolBarManager &inst();
+
+    // singleton
+    DkToolBarManager(DkToolBarManager const &) = delete;
+    void operator=(DkToolBarManager const &) = delete;
+
+    void showDefaultToolBar(bool show, bool permanent = true);
+    void showMovieToolBar(bool show);
+    void show(bool show, bool permanent = false);
+    void restore();
+    void showToolBar(QToolBar *toolbar, bool show);
+    void showToolBarsTemporarily(bool show);
+
+    void createTransferToolBar();
+
+    DkMainToolBar *defaultToolBar() const;
+    DkTransferToolBar *transferToolBar() const;
+
+private:
+    DkToolBarManager();
+    void createDefaultToolBar();
+
+    DkMainToolBar *mToolBar = 0;
+    QToolBar *mMovieToolBar = 0;
+    QVector<QToolBar *> mHiddenToolBars;
+    Qt::ToolBarArea mMovieToolbarArea = Qt::NoToolBarArea;
+
+    DkTransferToolBar *mTransferToolBar = 0;
+};
 
 }
diff --git a/ImageLounge/src/DkGui/DkViewPort.cpp b/ImageLounge/src/DkGui/DkViewPort.cpp
index c03ca76..2c78172 100644
--- a/ImageLounge/src/DkGui/DkViewPort.cpp
+++ b/ImageLounge/src/DkGui/DkViewPort.cpp
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkViewPort.cpp
  Created on:	05.05.2011
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -27,42 +27,41 @@
 
 #include "DkViewPort.h"
 
+#include "DkActionManager.h"
+#include "DkBasicLoader.h"
 #include "DkControlWidget.h"
+#include "DkDialog.h"
 #include "DkImageLoader.h"
-#include "DkWidgets.h"
-#include "DkSettings.h"
-#include "DkNetwork.h"
-#include "DkThumbsWidgets.h"		// needed in the connects -> shall we move them to mController?
-#include "DkMetaDataWidgets.h"
-#include "DkToolbars.h"
+#include "DkMessageBox.h"
 #include "DkMetaData.h"
+#include "DkMetaDataWidgets.h"
+#include "DkNetwork.h"
 #include "DkPluginManager.h"
-#include "DkActionManager.h"
+#include "DkSettings.h"
 #include "DkStatusBar.h"
-#include "DkUtils.h"
-#include "DkBasicLoader.h"
-#include "DkDialog.h"
-#include "DkMessageBox.h"
+#include "DkThumbsWidgets.h" // needed in the connects -> shall we move them to mController?
 #include "DkToolbars.h"
+#include "DkUtils.h"
+#include "DkWidgets.h"
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QClipboard>
-#include <QMovie>
-#include <QMimeData>
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QAction>
 #include <QApplication>
-#include <QVBoxLayout>
-#include <QDragLeaveEvent>
+#include <QClipboard>
+#include <QDesktopWidget>
 #include <QDrag>
+#include <QDragLeaveEvent>
 #include <QInputDialog>
+#include <QMenu>
 #include <QMessageBox>
-#include <QDesktopWidget>
+#include <QMimeData>
+#include <QMovie>
 #include <QSvgRenderer>
-#include <QMenu>
+#include <QVBoxLayout>
 #include <QtConcurrentRun>
 
 #include <qmath.h>
-#pragma warning(pop)		// no warnings from includes - end
+#pragma warning(pop) // no warnings from includes - end
 
 #include <assert.h>
 
@@ -70,2517 +69,2492 @@
 #include <windows.h>
 #endif
 
-namespace nmc {
-
+namespace nmc
+{
 // DkViewPort --------------------------------------------------------------------
-DkViewPort::DkViewPort(QWidget *parent) : DkBaseViewPort(parent) {
+DkViewPort::DkViewPort(QWidget *parent)
+    : DkBaseViewPort(parent)
+{
+    mRepeatZoomTimer = new QTimer(this);
+    mAnimationTimer = new QTimer(this);
 
-	mRepeatZoomTimer = new QTimer(this);
-	mAnimationTimer = new QTimer(this);
+    // try loading a custom file
+    mImgBg.load(QFileInfo(QApplication::applicationDirPath(), "bg.png").absoluteFilePath());
+    if (mImgBg.isNull() && DkSettingsManager::param().global().showBgImage) {
+        QColor col = backgroundBrush().color().darker();
+        mImgBg = DkImage::loadIcon(":/nomacs/img/nomacs-bg.svg", col, QSize(100, 100)).toImage();
+    }
 
-	// try loading a custom file
-	mImgBg.load(QFileInfo(QApplication::applicationDirPath(), "bg.png").absoluteFilePath());
-	if (mImgBg.isNull() && DkSettingsManager::param().global().showBgImage) {
-		QColor col = backgroundBrush().color().darker();
-		mImgBg = DkImage::loadIcon(":/nomacs/img/nomacs-bg.svg", QSize(100, 100), col).toImage();
-	}
+    mRepeatZoomTimer->setInterval(20);
+    connect(mRepeatZoomTimer, SIGNAL(timeout()), this, SLOT(repeatZoom()));
 
-	mRepeatZoomTimer->setInterval(20);
-	connect(mRepeatZoomTimer, SIGNAL(timeout()), this, SLOT(repeatZoom()));
+    mAnimationTimer->setInterval(5);
+    connect(mAnimationTimer, SIGNAL(timeout()), this, SLOT(animateFade()));
 
-	mAnimationTimer->setInterval(5);
-	connect(mAnimationTimer, SIGNAL(timeout()), this, SLOT(animateFade()));
+    // no border
+    setMouseTracking(true); // receive mouse event everytime
 
-	//no border
-	setMouseTracking(true);//receive mouse event everytime
-	
-	mPaintLayout = new QVBoxLayout(this);
-	mPaintLayout->setContentsMargins(0,0,0,0);
+    mPaintLayout = new QVBoxLayout(this);
+    mPaintLayout->setContentsMargins(0, 0, 0, 0);
 
-	createShortcuts();
+    createShortcuts();
 
-	mController = new DkControlWidget(this);
+    mController = new DkControlWidget(this);
 
-	mLoader = QSharedPointer<DkImageLoader>(new DkImageLoader());
-	connectLoader(mLoader);
+    mLoader = QSharedPointer<DkImageLoader>(new DkImageLoader());
+    connectLoader(mLoader);
 
-	if (DkSettingsManager::param().display().showScrollBars) {
-		setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
-		setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
-	}
+    if (DkSettingsManager::param().display().showScrollBars) {
+        setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
+        setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
+    }
 
-	mController->setTransforms(&mWorldMatrix, &mImgMatrix);
+    mController->getOverview()->setTransforms(&mWorldMatrix, &mImgMatrix);
+    mController->getCropWidget()->setWorldTransform(&mWorldMatrix);
+    mController->getCropWidget()->setImageTransform(&mImgMatrix);
+    mController->getCropWidget()->setImageRect(&mImgViewRect);
 
-	// this must be initialized after mController to be above it
-	mNavigationWidget = new DkHudNavigation(this);
+    // this must be initialized after mController to be above it
+    mNavigationWidget = new DkHudNavigation(this);
     mPaintLayout->addWidget(mNavigationWidget);
-	// TODO: if visible, currently mNavigationWidget eats all mouse events that are supposed for control widget
-
-	// add actions
-	DkActionManager& am = DkActionManager::instance();
-	addActions(am.fileActions().toList());
-	addActions(am.viewActions().toList());
-	addActions(am.editActions().toList());
-	addActions(am.manipulatorActions().toList());
-	addActions(am.sortActions().toList());
-	addActions(am.toolsActions().toList());
-	addActions(am.panelActions().toList());
-	addActions(am.syncActions().toList());
-	addActions(am.pluginActions().toList());
-	addActions(am.helpActions().toList());
-	addActions(am.hiddenActions().toList());
-
-	addActions(am.openWithActions().toList());
+    // TODO: if visible, currently mNavigationWidget eats all mouse events that are supposed for control widget
+
+    // add actions
+    DkActionManager &am = DkActionManager::instance();
+    addActions(am.fileActions().toList());
+    addActions(am.viewActions().toList());
+    addActions(am.editActions().toList());
+    addActions(am.manipulatorActions().toList());
+    addActions(am.sortActions().toList());
+    addActions(am.toolsActions().toList());
+    addActions(am.panelActions().toList());
+    addActions(am.syncActions().toList());
+    addActions(am.pluginActions().toList());
+    addActions(am.helpActions().toList());
+    addActions(am.hiddenActions().toList());
+
+    addActions(am.openWithActions().toList());
 #ifdef WITH_PLUGINS
-	addActions(am.pluginActionManager()->pluginDummyActions().toList());
+    addActions(am.pluginActionManager()->pluginDummyActions().toList());
 #endif
 
-	connect(&mImgStorage, SIGNAL(infoSignal(const QString&)), this, SIGNAL(infoSignal(const QString&)));
-
-	if (am.pluginActionManager())
-		connect(am.pluginActionManager(), SIGNAL(runPlugin(DkPluginContainer*, const QString&)), this, SLOT(applyPlugin(DkPluginContainer*, const QString&)));
-
-	// connect
-	connect(am.action(DkActionManager::menu_file_reload), SIGNAL(triggered()), this, SLOT(reloadFile()));
-	connect(am.action(DkActionManager::menu_file_next), SIGNAL(triggered()), this, SLOT(loadNextFileFast()));
-	connect(am.action(DkActionManager::menu_file_prev), SIGNAL(triggered()), this, SLOT(loadPrevFileFast()));
-	connect(am.action(DkActionManager::menu_file_save), SIGNAL(triggered()), this, SLOT(saveFile()));
-	connect(am.action(DkActionManager::menu_file_save_as), SIGNAL(triggered()), this, SLOT(saveFileAs()));
-	connect(am.action(DkActionManager::menu_file_save_web), SIGNAL(triggered()), this, SLOT(saveFileWeb()));
-	connect(am.action(DkActionManager::menu_tools_wallpaper), SIGNAL(triggered()), this, SLOT(setAsWallpaper()));
-
-	connect(am.action(DkActionManager::menu_edit_rotate_cw), SIGNAL(triggered()), this, SLOT(rotateCW()));
-	connect(am.action(DkActionManager::menu_edit_rotate_ccw), SIGNAL(triggered()), this, SLOT(rotateCCW()));
-	connect(am.action(DkActionManager::menu_edit_rotate_180), SIGNAL(triggered()), this, SLOT(rotate180()));
-	connect(am.action(DkActionManager::menu_edit_transform), SIGNAL(triggered()), this, SLOT(resizeImage()));
-	connect(am.action(DkActionManager::menu_edit_delete), SIGNAL(triggered()), this, SLOT(deleteImage()));
-	connect(am.action(DkActionManager::menu_edit_copy), SIGNAL(triggered()), this, SLOT(copyImage()));
-	connect(am.action(DkActionManager::menu_edit_copy_buffer), SIGNAL(triggered()), this, SLOT(copyImageBuffer()));
-	connect(am.action(DkActionManager::menu_edit_copy_color), SIGNAL(triggered()), this, SLOT(copyPixelColorValue()));
-
-	connect(am.action(DkActionManager::menu_view_reset), SIGNAL(triggered()), this, SLOT(zoomToFit()));
-	connect(am.action(DkActionManager::menu_view_100), SIGNAL(triggered()), this, SLOT(fullView()));
-	connect(am.action(DkActionManager::menu_view_zoom_in), SIGNAL(triggered()), this, SLOT(zoomIn()));
-	connect(am.action(DkActionManager::menu_view_zoom_out), SIGNAL(triggered()), this, SLOT(zoomOut()));
-	connect(am.action(DkActionManager::menu_view_tp_pattern), SIGNAL(toggled(bool)), this, SLOT(togglePattern(bool)));
-	connect(am.action(DkActionManager::menu_view_movie_pause), SIGNAL(triggered(bool)), this, SLOT(pauseMovie(bool)));
-	connect(am.action(DkActionManager::menu_view_movie_prev), SIGNAL(triggered()), this, SLOT(previousMovieFrame()));
-	connect(am.action(DkActionManager::menu_view_movie_next), SIGNAL(triggered()), this, SLOT(nextMovieFrame()));
-	
-	connect(am.action(DkActionManager::sc_test_img), SIGNAL(triggered()), this, SLOT(loadLena()));
-	connect(am.action(DkActionManager::menu_sync_view), SIGNAL(triggered()), this, SLOT(tcpForceSynchronize()));
-
-	// playing
-	connect(mNavigationWidget, SIGNAL(previousSignal()), this, SLOT(loadPrevFileFast()));
-	connect(mNavigationWidget, SIGNAL(nextSignal()), this, SLOT(loadNextFileFast()));
-
-	// trivial connects
-	connect(this, &DkViewPort::movieLoadedSignal,
-		[this](bool movie) { DkActionManager::instance().enableMovieActions(movie); });
-
-	// connect sync
-	auto cm = DkSyncManager::inst().client();
-
-	connect(this, SIGNAL(sendTransformSignal(QTransform, QTransform, QPointF)), cm, SLOT(sendTransform(QTransform, QTransform, QPointF)));
-	connect(this, SIGNAL(sendNewFileSignal(qint16, const QString&)), cm, SLOT(sendNewFile(qint16, const QString&)));
-	connect(cm, SIGNAL(receivedNewFile(qint16, const QString&)), this, SLOT(tcpLoadFile(qint16, const QString&)));
-	connect(cm, SIGNAL(updateConnectionSignal(const QString&)), mController, SLOT(setInfo(const QString&)));
-	connect(cm, SIGNAL(receivedTransformation(QTransform, QTransform, QPointF)), this, SLOT(tcpSetTransforms(QTransform, QTransform, QPointF)));
-	
-	for (auto action : am.manipulatorActions())
-		connect(action, SIGNAL(triggered()), this, SLOT(applyManipulator()));
-
-	connect(&mManipulatorWatcher, SIGNAL(finished()), this, SLOT(manipulatorApplied()));
-
-	// TODO:
-	// one could blur the canvas if a transparent GUI is present
-	// what we would need: QGraphicsBlurEffect...
-	// render all widgets to the alpha channel (bw)
-	// pre-render the mViewport to that image... apply blur
-	// and then render the blurred image after the widget is rendered...
-	// performance?!
-	
-}
-
-DkViewPort::~DkViewPort() {
-
-	mController->closePlugin(false, true);
-
-	mManipulatorWatcher.cancel();
-	mManipulatorWatcher.blockSignals(true);
-}
-
-void DkViewPort::createShortcuts() {
-
-	DkActionManager& am = DkActionManager::instance();
-	connect(am.action(DkActionManager::sc_first_file), SIGNAL(triggered()), this, SLOT(loadFirst()));
-	connect(am.action(DkActionManager::sc_last_file), SIGNAL(triggered()), this, SLOT(loadLast()));
-	connect(am.action(DkActionManager::sc_skip_prev), SIGNAL(triggered()), this, SLOT(loadSkipPrev10()));
-	connect(am.action(DkActionManager::sc_skip_next), SIGNAL(triggered()), this, SLOT(loadSkipNext10()));
-	connect(am.action(DkActionManager::sc_first_file_sync), SIGNAL(triggered()), this, SLOT(loadFirst()));
-	connect(am.action(DkActionManager::sc_last_file_sync), SIGNAL(triggered()), this, SLOT(loadLast()));
-	connect(am.action(DkActionManager::sc_skip_next_sync), SIGNAL(triggered()), this, SLOT(loadNextFileFast()));
-	connect(am.action(DkActionManager::sc_skip_prev_sync), SIGNAL(triggered()), this, SLOT(loadPrevFileFast()));
-
-}
-
-void DkViewPort::setPaintWidget(QWidget* widget, bool removeWidget) {
-
-	if (!removeWidget) {
-		mPaintLayout->addWidget(widget);
-		//pluginImageWasApplied = false;
-	} else {
-		mPaintLayout->removeWidget(widget);
-		//widget->deleteLater();
-	}
-	
-	mController->raise();
+    connect(&mImgStorage, SIGNAL(infoSignal(const QString &)), this, SIGNAL(infoSignal(const QString &)));
+
+    if (am.pluginActionManager())
+        connect(am.pluginActionManager(),
+                SIGNAL(runPlugin(DkPluginContainer *, const QString &)),
+                this,
+                SLOT(applyPlugin(DkPluginContainer *, const QString &)));
+
+    // connect
+    connect(am.action(DkActionManager::menu_file_reload), SIGNAL(triggered()), this, SLOT(reloadFile()));
+    connect(am.action(DkActionManager::menu_file_next), SIGNAL(triggered()), this, SLOT(loadNextFileFast()));
+    connect(am.action(DkActionManager::menu_file_prev), SIGNAL(triggered()), this, SLOT(loadPrevFileFast()));
+    connect(am.action(DkActionManager::menu_file_save), SIGNAL(triggered()), this, SLOT(saveFile()));
+    connect(am.action(DkActionManager::menu_file_save_as), SIGNAL(triggered()), this, SLOT(saveFileAs()));
+    connect(am.action(DkActionManager::menu_file_save_web), SIGNAL(triggered()), this, SLOT(saveFileWeb()));
+    connect(am.action(DkActionManager::menu_tools_wallpaper), SIGNAL(triggered()), this, SLOT(setAsWallpaper()));
+
+    connect(am.action(DkActionManager::menu_edit_rotate_cw), SIGNAL(triggered()), this, SLOT(rotateCW()));
+    connect(am.action(DkActionManager::menu_edit_rotate_ccw), SIGNAL(triggered()), this, SLOT(rotateCCW()));
+    connect(am.action(DkActionManager::menu_edit_rotate_180), SIGNAL(triggered()), this, SLOT(rotate180()));
+    connect(am.action(DkActionManager::menu_edit_transform), SIGNAL(triggered()), this, SLOT(resizeImage()));
+    connect(am.action(DkActionManager::menu_edit_delete), SIGNAL(triggered()), this, SLOT(deleteImage()));
+    connect(am.action(DkActionManager::menu_edit_copy), SIGNAL(triggered()), this, SLOT(copyImage()));
+    connect(am.action(DkActionManager::menu_edit_copy_buffer), SIGNAL(triggered()), this, SLOT(copyImageBuffer()));
+    connect(am.action(DkActionManager::menu_edit_copy_color), SIGNAL(triggered()), this, SLOT(copyPixelColorValue()));
+
+    connect(am.action(DkActionManager::menu_view_reset), SIGNAL(triggered()), this, SLOT(zoomToFit()));
+    connect(am.action(DkActionManager::menu_view_100), SIGNAL(triggered()), this, SLOT(fullView()));
+    connect(am.action(DkActionManager::menu_view_zoom_in), SIGNAL(triggered()), this, SLOT(zoomIn()));
+    connect(am.action(DkActionManager::menu_view_zoom_out), SIGNAL(triggered()), this, SLOT(zoomOut()));
+    connect(am.action(DkActionManager::menu_view_tp_pattern), SIGNAL(toggled(bool)), this, SLOT(togglePattern(bool)));
+    connect(am.action(DkActionManager::menu_view_movie_pause), SIGNAL(triggered(bool)), this, SLOT(pauseMovie(bool)));
+    connect(am.action(DkActionManager::menu_view_movie_prev), SIGNAL(triggered()), this, SLOT(previousMovieFrame()));
+    connect(am.action(DkActionManager::menu_view_movie_next), SIGNAL(triggered()), this, SLOT(nextMovieFrame()));
+
+    connect(am.action(DkActionManager::sc_test_img), SIGNAL(triggered()), this, SLOT(loadLena()));
+    connect(am.action(DkActionManager::menu_sync_view), SIGNAL(triggered()), this, SLOT(tcpForceSynchronize()));
+
+    // playing
+    connect(mNavigationWidget, SIGNAL(previousSignal()), this, SLOT(loadPrevFileFast()));
+    connect(mNavigationWidget, SIGNAL(nextSignal()), this, SLOT(loadNextFileFast()));
+
+    // trivial connects
+    connect(this, &DkViewPort::movieLoadedSignal, [this](bool movie) {
+        DkActionManager::instance().enableMovieActions(movie);
+    });
+
+    // connect sync
+    auto cm = DkSyncManager::inst().client();
+
+    connect(this, SIGNAL(sendTransformSignal(QTransform, QTransform, QPointF)), cm, SLOT(sendTransform(QTransform, QTransform, QPointF)));
+    connect(this, SIGNAL(sendNewFileSignal(qint16, const QString &)), cm, SLOT(sendNewFile(qint16, const QString &)));
+    connect(cm, SIGNAL(receivedNewFile(qint16, const QString &)), this, SLOT(tcpLoadFile(qint16, const QString &)));
+    connect(cm, SIGNAL(updateConnectionSignal(const QString &)), mController, SLOT(setInfo(const QString &)));
+    connect(cm, SIGNAL(receivedTransformation(QTransform, QTransform, QPointF)), this, SLOT(tcpSetTransforms(QTransform, QTransform, QPointF)));
+
+    for (auto action : am.manipulatorActions())
+        connect(action, SIGNAL(triggered()), this, SLOT(applyManipulator()));
+
+    connect(&mManipulatorWatcher, SIGNAL(finished()), this, SLOT(manipulatorApplied()));
+
+    // TODO:
+    // one could blur the canvas if a transparent GUI is present
+    // what we would need: QGraphicsBlurEffect...
+    // render all widgets to the alpha channel (bw)
+    // pre-render the mViewport to that image... apply blur
+    // and then render the blurred image after the widget is rendered...
+    // performance?!
+}
+
+DkViewPort::~DkViewPort()
+{
+    mController->closePlugin(false, true);
+
+    mManipulatorWatcher.cancel();
+    mManipulatorWatcher.blockSignals(true);
+}
+
+void DkViewPort::createShortcuts()
+{
+    DkActionManager &am = DkActionManager::instance();
+    connect(am.action(DkActionManager::sc_first_file), SIGNAL(triggered()), this, SLOT(loadFirst()));
+    connect(am.action(DkActionManager::sc_last_file), SIGNAL(triggered()), this, SLOT(loadLast()));
+    connect(am.action(DkActionManager::sc_skip_prev), SIGNAL(triggered()), this, SLOT(loadSkipPrev10()));
+    connect(am.action(DkActionManager::sc_skip_next), SIGNAL(triggered()), this, SLOT(loadSkipNext10()));
+    connect(am.action(DkActionManager::sc_first_file_sync), SIGNAL(triggered()), this, SLOT(loadFirst()));
+    connect(am.action(DkActionManager::sc_last_file_sync), SIGNAL(triggered()), this, SLOT(loadLast()));
+    connect(am.action(DkActionManager::sc_skip_next_sync), SIGNAL(triggered()), this, SLOT(loadNextFileFast()));
+    connect(am.action(DkActionManager::sc_skip_prev_sync), SIGNAL(triggered()), this, SLOT(loadPrevFileFast()));
+}
+
+void DkViewPort::setPaintWidget(QWidget *widget, bool removeWidget)
+{
+    if (!removeWidget) {
+        mPaintLayout->addWidget(widget);
+        // pluginImageWasApplied = false;
+    } else {
+        mPaintLayout->removeWidget(widget);
+        // widget->deleteLater();
+    }
+
+    mController->raise();
 }
 
 #ifdef WITH_OPENCV
-void DkViewPort::setImage(cv::Mat newImg) {
-
-	QImage imgQt = DkImage::mat2QImage(newImg);
-	setImage(imgQt);
+void DkViewPort::setImage(cv::Mat newImg)
+{
+    QImage imgQt = DkImage::mat2QImage(newImg);
+    setImage(imgQt);
 }
 #endif
 
-void DkViewPort::updateImage(QSharedPointer<DkImageContainerT> image, bool loaded) {
+void DkViewPort::updateImage(QSharedPointer<DkImageContainerT> image, bool loaded)
+{
+    // things todo if a file was not loaded...
+    if (!loaded) {
+        mController->getPlayer()->startTimer();
+        return;
+    }
 
-	// things todo if a file was not loaded...
-	if (!loaded) {
-		mController->getPlayer()->startTimer();
-		return;
-	}
+    // should not happen -> the mLoader should send this signal
+    if (!mLoader)
+        return;
 
-	// should not happen -> the mLoader should send this signal
-	if (!mLoader)
-		return;
+    if (mLoader->hasImage()) {
+        setImage(mLoader->getPixmap()); // modified image (for view), may differ from lastImage after rotate
+    }
 
-	if (mLoader->hasImage()) {
-		setImage(mLoader->getImage());
-	}
+    emit imageUpdatedSignal();
 }
 
-void DkViewPort::loadImage(const QImage& newImg) {
-
-	// delete current information
-	if (mLoader) {
-		if (!unloadImage(true))
-			return;	// user canceled
-
-		mLoader->setImage(newImg, tr("Original Image"));
-		setImage(newImg);
-
-		// save to temp folder
-		mLoader->saveTempFile(newImg);
-	}
+void DkViewPort::setImageUpdated()
+{
+    if (!mLoader)
+        return;
+    mLoader->setImageUpdated();
 }
 
-void DkViewPort::loadImage(QSharedPointer<DkImageContainerT> img) {
-
-	if (mLoader) {
-
-		if (!unloadImage(true))
-			return;
+void DkViewPort::loadImage(const QImage &newImg)
+{
+    // delete current information
+    if (mLoader) {
+        if (!unloadImage(true))
+            return; // user canceled
 
-		if (img->hasImage()) {
-			mLoader->setCurrentImage(img);
-			setImage(img->image());
-		}
-		mLoader->load(img);
-	}
+        mLoader->setImage(newImg, tr("Original Image"));
+        setImage(newImg);
 
+        // save to temp folder
+        mLoader->saveTempFile(newImg);
+    }
 }
 
-void DkViewPort::setImage(QImage newImg) {
-
-	// calling show here fixes issues with the HUD
-	show();
-
-	DkTimer dt;
-
-	emit movieLoadedSignal(false);
-	stopMovie();	// just to be sure
-
-	if (mManipulatorWatcher.isRunning())
-		mManipulatorWatcher.cancel();
-
-	mController->getOverview()->setImage(QImage());	// clear overview
-
-	mImgStorage.setImage(newImg);
-
-	if (mLoader->hasMovie() && !mLoader->isEdited())
-		loadMovie();
-	if (mLoader->hasSvg() && !mLoader->isEdited())
-		loadSvg();
-
-	mImgRect = QRectF(QPoint(), getImageSize());
+void DkViewPort::loadImage(QSharedPointer<DkImageContainerT> img)
+{
+    if (mLoader) {
+        if (!unloadImage(true))
+            return;
 
-	DkActionManager::instance().enableImageActions(!newImg.isNull());
-	mController->imageLoaded(!newImg.isNull());
-
-	double oldZoom = mWorldMatrix.m11();// *mImgMatrix.m11();
-
-	if (!(DkSettingsManager::param().display().keepZoom == DkSettings::zoom_keep_same_size && mOldImgRect == mImgRect))
-		mWorldMatrix.reset();
-
-	updateImageMatrix();		
-
-	// if image is not inside, we'll align it at the top left border
-	if (!mViewportRect.intersects(mWorldMatrix.mapRect(mImgViewRect).toRect())) {
-		mWorldMatrix.translate(-mWorldMatrix.dx(), -mWorldMatrix.dy());
-		centerImage();
-	}
-
-	if (DkSettingsManager::param().display().keepZoom == DkSettings::zoom_always_keep) {
-		zoomToPoint(oldZoom, mImgViewRect.center().toPoint(), mWorldMatrix);
-	}
-
-	mController->getPlayer()->startTimer();
-	mController->getOverview()->setImage(newImg);	// TODO: maybe we could make use of the image pyramid here
-
-	mOldImgRect = mImgRect;
-	
-	// init fading
-	if (DkSettingsManager::param().display().animationDuration && 
-		DkSettingsManager::param().display().transition != DkSettingsManager::param().trans_appear && 
-		(mController->getPlayer()->isPlaying() ||
-			DkUtils::getMainWindow()->isFullScreen() ||
-			DkSettingsManager::param().display().alwaysAnimate)) {
-		mAnimationTimer->start();
-		mAnimationTime.start();
-	}
-	else
-		mAnimationValue = 0.0f;
-
-	//// set/clear crop rect
-	//if (mLoader->getCurrentImage())
-	//	mCropRect = mLoader->getCurrentImage()->cropRect();
-	//else
-	//	mCropRect = DkRotatingRect();
-
-	update();
-
-	// draw a histogram from the image -> does nothing if the histogram is invisible
-	if (mController->getHistogram()) 
-		mController->getHistogram()->drawHistogram(newImg);
-
-	emit newImageSignal(&newImg);
-	emit zoomSignal(mWorldMatrix.m11()*mImgMatrix.m11()*100);
-
-	// status info
-	if (!newImg.isNull()) {
-		DkStatusBarManager::instance().setMessage(QString::number(qRound((float)(mWorldMatrix.m11()*mImgMatrix.m11() * 100))) + "%", DkStatusBar::status_zoom_info);
-		DkStatusBarManager::instance().setMessage(DkUtils::formatToString(newImg.format()), DkStatusBar::status_format_info);
-		DkStatusBarManager::instance().setMessage(QString::number(newImg.width()) + " x " + QString::number(newImg.height()), DkStatusBar::status_dimension_info);
-
-		if (imageContainer())
-			DkStatusBarManager::instance().setMessage(imageContainer()->fileName(), DkStatusBar::status_file_info);
-	}
-	else {
-		DkStatusBarManager::instance().setMessage("", DkStatusBar::status_zoom_info);
-		DkStatusBarManager::instance().setMessage("", DkStatusBar::status_format_info);
-		DkStatusBarManager::instance().setMessage("", DkStatusBar::status_dimension_info);
-		DkStatusBarManager::instance().setMessage("", DkStatusBar::status_file_info);
-	}
+        if (img->hasImage()) {
+            mLoader->setCurrentImage(img);
+            setImage(img->image());
+        }
+        mLoader->load(img);
+    }
 }
 
-void DkViewPort::zoom(double factor, const QPointF& center, bool force) {
-
-	if (mImgStorage.isEmpty() || mBlockZooming)
-		return;
-
-	//factor/=5;//-0.1 <-> 0.1
-	//factor+=1;//0.9 <-> 1.1
-
-	//limit zoom out ---
-	if (mWorldMatrix.m11()*factor < mMinZoom && factor < 1)
-		return;
+void DkViewPort::setImage(QImage newImg)
+{
+    // calling show here fixes issues with the HUD
+    show();
 
-	// reset view & block if we pass the 'image fit to screen' on zoom out
-	if (mWorldMatrix.m11() > 1 && mWorldMatrix.m11()*factor < 1 && !force) {
+    DkTimer dt;
 
-		mBlockZooming = true;
-		mZoomTimer->start(500);
-		resetView();
-		return;
-	}
+    emit movieLoadedSignal(false);
+    stopMovie(); // just to be sure
 
-	// reset view if we pass the 'image fit to screen' on zoom in
-	if (mWorldMatrix.m11() < 1 && mWorldMatrix.m11()*factor > 1 && !force) {
-		
-		resetView();
-		return;
-	}
+    if (mManipulatorWatcher.isRunning())
+        mManipulatorWatcher.cancel();
 
-	// TODO: the reset in mWorldMatrix introduces wrong pans
-	//// reset view & block if we pass the '100%' on zoom out
-	//if (mWorldMatrix.m11()*mImgMatrix.m11()-FLT_EPSILON > 1 && mWorldMatrix.m11()*mImgMatrix.m11()*factor < 1) {
-	//	
-	//	mBlockZooming = true;
-	//	mZoomTimer->start(500);
-	//	mWorldMatrix.reset();
-	//	factor = 1.0f / (float)mImgMatrix.m11();
-	//}
+    mController->getOverview()->setImage(QImage()); // clear overview
 
-	//// reset view if we pass the '100%' on zoom in
-	//if (mWorldMatrix.m11()*mImgMatrix.m11()+FLT_EPSILON < 1 && mWorldMatrix.m11()*mImgMatrix.m11()*factor > 1) {
+    mImgStorage.setImage(newImg);
 
-	//	mBlockZooming = true;
-	//	mZoomTimer->start(500);
-	//	mWorldMatrix.reset();
-	//	factor = 1.0f / (float)mImgMatrix.m11();
-	//}
+    if (mLoader->hasMovie() && !mLoader->isEdited())
+        loadMovie();
+    if (mLoader->hasSvg() && !mLoader->isEdited())
+        loadSvg();
 
+    mImgRect = QRectF(QPoint(), getImageSize());
+
+    DkActionManager::instance().enableImageActions(!newImg.isNull());
+    mController->imageLoaded(!newImg.isNull());
 
-	//limit zoom in ---
-	if (mWorldMatrix.m11()*mImgMatrix.m11() > mMaxZoom && factor > 1)
-		return;
+    double oldZoom = mWorldMatrix.m11(); // *mImgMatrix.m11();
 
-	bool blackBorder = false;
+    if (!(DkSettingsManager::param().display().keepZoom == DkSettings::zoom_keep_same_size && mOldImgRect == mImgRect))
+        mWorldMatrix.reset();
+
+    updateImageMatrix();
+
+    // if image is not inside, we'll align it at the top left border
+    if (!mViewportRect.intersects(mWorldMatrix.mapRect(mImgViewRect))) {
+        mWorldMatrix.translate(-mWorldMatrix.dx(), -mWorldMatrix.dy());
+        centerImage();
+    }
+
+    if (DkSettingsManager::param().display().keepZoom == DkSettings::zoom_always_keep) {
+        zoomToPoint(oldZoom, mImgViewRect.center().toPoint(), mWorldMatrix);
+    }
 
-	QPointF pos = center;
-
-	// if no center assigned: zoom in at the image center
-	if (pos.x() == -1 || pos.y() == -1)
-		pos = mImgViewRect.center();
-	else {
-
-		// if black border - do not zoom to the mouse coordinate
-		if (mImgViewRect.width()*(mWorldMatrix.m11()*factor) < width()) {
-			pos.setX(mImgViewRect.center().x());
-			blackBorder = true;
-		}
-		if ((mImgViewRect.height()*mWorldMatrix.m11()*factor) < height()) {
-			pos.setY(mImgViewRect.center().y());
-			blackBorder = true;
-		}
-	}
-
-	zoomToPoint(factor, pos, mWorldMatrix);
-
-	controlImagePosition();
-	if (blackBorder && factor < 1) centerImage();	// TODO: geht auch schöner
-	showZoom();
-	changeCursor();
-
-	mController->update();	// why do we need to update the mController manually?
-	update();
-
-	tcpSynchronize();
-
-	emit zoomSignal(mWorldMatrix.m11()*mImgMatrix.m11()*100);
-	DkStatusBarManager::instance().setMessage(QString::number(qRound(mWorldMatrix.m11()*mImgMatrix.m11() * 100)) + "%", DkStatusBar::status_zoom_info);
-}
-
-void DkViewPort::zoomTo(double zoomLevel) {
-
-	mWorldMatrix.reset();
-	zoom(zoomLevel/mImgMatrix.m11());
+    mController->getPlayer()->startTimer();
+    mController->getOverview()->setImage(newImg); // TODO: maybe we could make use of the image pyramid here
+
+    mOldImgRect = mImgRect;
+
+    // init fading
+    if (DkSettingsManager::param().display().animationDuration && DkSettingsManager::param().display().transition != DkSettingsManager::param().trans_appear
+        && (mController->getPlayer()->isPlaying() || DkUtils::getMainWindow()->isFullScreen() || DkSettingsManager::param().display().alwaysAnimate)) {
+        mAnimationTimer->start();
+        mAnimationTime.start();
+    } else
+        mAnimationValue = 0.0f;
+
+    // set/clear crop rect
+    if (mLoader->getCurrentImage())
+        mCropRect = mLoader->getCurrentImage()->cropRect();
+    else
+        mCropRect = DkRotatingRect();
+
+    update();
+
+    // draw a histogram from the image -> does nothing if the histogram is invisible
+    if (mController->getHistogram())
+        mController->getHistogram()->drawHistogram(newImg);
+
+    emit newImageSignal(&newImg);
+    emit zoomSignal(mWorldMatrix.m11() * mImgMatrix.m11() * 100);
+
+    // status info
+    if (!newImg.isNull()) {
+        DkStatusBarManager::instance().setMessage(QString::number(qRound((float)(mWorldMatrix.m11() * mImgMatrix.m11() * 100))) + "%",
+                                                  DkStatusBar::status_zoom_info);
+        DkStatusBarManager::instance().setMessage(DkUtils::formatToString(newImg.format()), DkStatusBar::status_format_info);
+        DkStatusBarManager::instance().setMessage(QString::number(newImg.width()) + " x " + QString::number(newImg.height()),
+                                                  DkStatusBar::status_dimension_info);
+
+        if (imageContainer())
+            DkStatusBarManager::instance().setMessage(imageContainer()->fileName(), DkStatusBar::status_file_info);
+    } else {
+        DkStatusBarManager::instance().setMessage("", DkStatusBar::status_zoom_info);
+        DkStatusBarManager::instance().setMessage("", DkStatusBar::status_format_info);
+        DkStatusBarManager::instance().setMessage("", DkStatusBar::status_dimension_info);
+        DkStatusBarManager::instance().setMessage("", DkStatusBar::status_file_info);
+    }
+}
+
+void DkViewPort::zoom(double factor, const QPointF &center, bool force)
+{
+    if (mImgStorage.isEmpty() || mBlockZooming)
+        return;
+
+    // factor/=5;//-0.1 <-> 0.1
+    // factor+=1;//0.9 <-> 1.1
+
+    // limit zoom out ---
+    if (mWorldMatrix.m11() * factor < mMinZoom && factor < 1)
+        return;
+
+    // reset view & block if we pass the 'image fit to screen' on zoom out
+    if (mWorldMatrix.m11() > 1 && mWorldMatrix.m11() * factor < 1 && !force) {
+        mBlockZooming = true;
+        mZoomTimer->start(500);
+        resetView();
+        return;
+    }
+
+    // reset view if we pass the 'image fit to screen' on zoom in
+    if (mWorldMatrix.m11() < 1 && mWorldMatrix.m11() * factor > 1 && !force) {
+        resetView();
+        return;
+    }
+
+    // TODO: the reset in mWorldMatrix introduces wrong pans
+    //// reset view & block if we pass the '100%' on zoom out
+    // if (mWorldMatrix.m11()*mImgMatrix.m11()-FLT_EPSILON > 1 && mWorldMatrix.m11()*mImgMatrix.m11()*factor < 1) {
+    //
+    //	mBlockZooming = true;
+    //	mZoomTimer->start(500);
+    //	mWorldMatrix.reset();
+    //	factor = 1.0f / (float)mImgMatrix.m11();
+    // }
+
+    //// reset view if we pass the '100%' on zoom in
+    // if (mWorldMatrix.m11()*mImgMatrix.m11()+FLT_EPSILON < 1 && mWorldMatrix.m11()*mImgMatrix.m11()*factor > 1) {
+
+    //	mBlockZooming = true;
+    //	mZoomTimer->start(500);
+    //	mWorldMatrix.reset();
+    //	factor = 1.0f / (float)mImgMatrix.m11();
+    //}
+
+    // limit zoom in ---
+    if (mWorldMatrix.m11() * mImgMatrix.m11() > mMaxZoom && factor > 1)
+        return;
+
+    bool blackBorder = false;
+
+    QPointF pos = center;
+
+    // if no center assigned: zoom in at the image center
+    if (pos.x() == -1 || pos.y() == -1)
+        pos = mImgViewRect.center();
+    else {
+        // if black border - do not zoom to the mouse coordinate
+        if (mImgViewRect.width() * (mWorldMatrix.m11() * factor) < width()) {
+            pos.setX(mImgViewRect.center().x());
+            blackBorder = true;
+        }
+        if ((mImgViewRect.height() * mWorldMatrix.m11() * factor) < height()) {
+            pos.setY(mImgViewRect.center().y());
+            blackBorder = true;
+        }
+    }
+
+    zoomToPoint(factor, pos, mWorldMatrix);
+
+    controlImagePosition();
+    if (blackBorder && factor < 1)
+        centerImage(); // TODO: geht auch schöner
+    showZoom();
+    changeCursor();
+
+    mController->update(); // why do we need to update the mController manually?
+    update();
+
+    tcpSynchronize();
+
+    emit zoomSignal(mWorldMatrix.m11() * mImgMatrix.m11() * 100);
+    DkStatusBarManager::instance().setMessage(QString::number(qRound(mWorldMatrix.m11() * mImgMatrix.m11() * 100)) + "%", DkStatusBar::status_zoom_info);
+}
+
+void DkViewPort::zoomTo(double zoomLevel)
+{
+    mWorldMatrix.reset();
+    zoom(zoomLevel / mImgMatrix.m11());
+}
+
+void DkViewPort::zoomToFit()
+{
+    QSizeF imgSize = getImageSize();
+    QSizeF winSize = size();
+    double zoomLevel = qMin(winSize.width() / imgSize.width(), winSize.height() / imgSize.height());
+
+    if (zoomLevel > 1)
+        zoomTo(zoomLevel);
+    else if (zoomLevel < 1)
+        resetView();
+    else if (zoomLevel == 1 && mLoader && mLoader->hasSvg())
+        resetView();
+}
+
+void DkViewPort::resetView()
+{
+    mWorldMatrix.reset();
+    showZoom();
+    changeCursor();
+
+    update();
+    controlImagePosition();
+
+    emit zoomSignal(mWorldMatrix.m11() * mImgMatrix.m11() * 100);
+    tcpSynchronize();
+}
+
+void DkViewPort::fullView()
+{
+    QPointF p = mViewportRect.center();
+    zoom(1.0 / (mImgMatrix.m11() * mWorldMatrix.m11()), p.toPoint(), true);
+
+    emit zoomSignal(mWorldMatrix.m11() * mImgMatrix.m11() * 100);
+    changeCursor();
+    update();
 }
 
-void DkViewPort::zoomToFit(double margin) {
+void DkViewPort::showZoom()
+{
+    // don't show zoom if we are in fullscreen mode
+    if (isFullScreen() || DkSettingsManager::param().app().hideAllPanels)
+        return;
 
-	QSizeF imgSize = getImageSize();
-	QSizeF winSize = size();
-	double zoomLevel = qMin((winSize.width() - margin) / imgSize.width(), (winSize.height() - margin) / imgSize.height());
+    QString zoomStr;
+    zoomStr.asprintf("%.1f%%", mImgMatrix.m11() * mWorldMatrix.m11() * 100);
 
-	if (zoomLevel > 1 || margin != 0)
-		zoomTo(zoomLevel);
-	else if (zoomLevel < 1)
-		resetView();
-	else if (zoomLevel == 1 && mLoader && mLoader->hasSvg())
-		resetView();
+    if (!mController->getZoomWidget()->isVisible())
+        mController->setInfo(zoomStr, 3000, DkControlWidget::bottom_left_label);
 }
 
-void DkViewPort::resetView() {
-
-	mWorldMatrix.reset();
-	showZoom();
-	changeCursor();
-
-	update();
-	controlImagePosition();
-
-	emit zoomSignal(mWorldMatrix.m11()*mImgMatrix.m11() * 100);
-	tcpSynchronize();
+void DkViewPort::repeatZoom()
+{
+    qDebug() << "repeating...";
+    if ((DkSettingsManager::param().display().invertZoom && QApplication::mouseButtons() == Qt::XButton1)
+        || (!DkSettingsManager::param().display().invertZoom && QApplication::mouseButtons() == Qt::XButton2)) {
+        zoom(1.1f);
+    } else if ((!DkSettingsManager::param().display().invertZoom && QApplication::mouseButtons() == Qt::XButton1)
+               || (DkSettingsManager::param().display().invertZoom && QApplication::mouseButtons() == Qt::XButton2)) {
+        zoom(0.9f);
+    } else {
+        mRepeatZoomTimer->stop(); // safety if we don't catch the release
+    }
 }
 
-void DkViewPort::fullView() {
-	
-	QPointF p = mViewportRect.center();
-	zoom(1.0/(mImgMatrix.m11()*mWorldMatrix.m11()), p.toPoint(), true);
-	
-	emit zoomSignal(mWorldMatrix.m11()*mImgMatrix.m11() * 100);
-	changeCursor();
-	update();
+void DkViewPort::toggleResetMatrix()
+{
+    DkSettingsManager::param().display().keepZoom = !DkSettingsManager::param().display().keepZoom;
 }
 
-void DkViewPort::showZoom() {
-
-	// don't show zoom if we are in fullscreen mode
-	if (isFullScreen() || DkSettingsManager::param().app().hideAllPanels)
-		return;
+void DkViewPort::updateImageMatrix()
+{
+    if (mImgStorage.isEmpty())
+        return;
 
-	QString zoomStr;
-	zoomStr.sprintf("%.1f%%", mImgMatrix.m11()*mWorldMatrix.m11()*100);
-	
-	if (!mController->getZoomWidget()->isVisible())
-		mController->setInfo(zoomStr, 3000, DkControlWidget::bottom_left_label);
-}
-
-void DkViewPort::repeatZoom() {
+    QRectF oldImgRect = mImgViewRect;
+    QTransform oldImgMatrix = mImgMatrix;
 
-	qDebug() << "repeating...";
-	if ( (DkSettingsManager::param().display().invertZoom && QApplication::mouseButtons() == Qt::XButton1) ||
-		(!DkSettingsManager::param().display().invertZoom && QApplication::mouseButtons() == Qt::XButton2)) {
-		zoom(1.1f);
-	}
-	else if (	(!DkSettingsManager::param().display().invertZoom && QApplication::mouseButtons() == Qt::XButton1) ||
-				( DkSettingsManager::param().display().invertZoom && QApplication::mouseButtons() == Qt::XButton2)) {
-		zoom(0.9f);
-	}
-	else {
-		mRepeatZoomTimer->stop();	// safety if we don't catch the release
-	}
-}
+    mImgMatrix.reset();
 
-void DkViewPort::toggleResetMatrix() {
+    QSize imgSize = getImageSize();
 
-	DkSettingsManager::param().display().keepZoom = !DkSettingsManager::param().display().keepZoom;
-}
+    // if the image is smaller or zoom is active: paint the image as is
+    if (!mViewportRect.contains(mImgRect.toRect()))
+        mImgMatrix = getScaledImageMatrix();
+    else {
+        mImgMatrix.translate((float)(getMainGeometry().width() - imgSize.width()) * 0.5f, (float)(getMainGeometry().height() - imgSize.height()) * 0.5f);
+        mImgMatrix.scale(1.0f, 1.0f);
+    }
 
-void DkViewPort::updateImageMatrix() {
+    mImgViewRect = mImgMatrix.mapRect(mImgRect);
 
-	if (mImgStorage.isEmpty())
-		return;
-
-	QRectF oldImgRect = mImgViewRect;
-	QTransform oldImgMatrix = mImgMatrix;
-
-	mImgMatrix.reset();
-
-	QSize imgSize = getImageSize();
-
-	// if the image is smaller or zoom is active: paint the image as is
-	if (!mViewportRect.contains(mImgRect.toRect()))
-		mImgMatrix = getScaledImageMatrix();
-	else {
-		mImgMatrix.translate((float)(getMainGeometry().width()-imgSize.width())*0.5f, (float)(getMainGeometry().height()-imgSize.height())*0.5f);
-		mImgMatrix.scale(1.0f, 1.0f);
-	}
-
-	mImgViewRect = mImgMatrix.mapRect(mImgRect);
-
-	// update world matrix?
-	// mWorldMatrix.m11() != 1
-	if (qAbs(mWorldMatrix.m11()-1.0) > 1e-4) {
-
-		float scaleFactor = (float)(oldImgMatrix.m11()/mImgMatrix.m11());
-		double dx = oldImgRect.x()/scaleFactor-mImgViewRect.x();
-		double dy = oldImgRect.y()/scaleFactor-mImgViewRect.y();
-
-		mWorldMatrix.scale(scaleFactor, scaleFactor);
-		mWorldMatrix.translate(dx, dy);
-	}
-	// NOTE: this is not the same as resetView!
-	else if (DkSettingsManager::param().display().zoomToFit)
-		zoomToFit();	
+    // update world matrix?
+    // mWorldMatrix.m11() != 1
+    if (qAbs(mWorldMatrix.m11() - 1.0) > 1e-4) {
+        float scaleFactor = (float)(oldImgMatrix.m11() / mImgMatrix.m11());
+        double dx = oldImgRect.x() / scaleFactor - mImgViewRect.x();
+        double dy = oldImgRect.y() / scaleFactor - mImgViewRect.y();
 
+        mWorldMatrix.scale(scaleFactor, scaleFactor);
+        mWorldMatrix.translate(dx, dy);
+    }
+    // NOTE: this is not the same as resetView!
+    else if (DkSettingsManager::param().display().zoomToFit)
+        zoomToFit();
 }
 
-void DkViewPort::tcpSetTransforms(QTransform newWorldMatrix, QTransform newImgMatrix, QPointF canvasSize) {
+void DkViewPort::tcpSetTransforms(QTransform newWorldMatrix, QTransform newImgMatrix, QPointF canvasSize)
+{
+    // ok relative transform
+    if (canvasSize.isNull()) {
+        moveView(QPointF(newWorldMatrix.dx(), newWorldMatrix.dy()) / mWorldMatrix.m11());
+    } else {
+        mWorldMatrix = newWorldMatrix;
+        mImgMatrix = newImgMatrix;
+        updateImageMatrix();
 
-	// ok relative transform
-	if (canvasSize.isNull()) {
-		moveView(QPointF(newWorldMatrix.dx(), newWorldMatrix.dy())/mWorldMatrix.m11());
-	}
-	else {
-		mWorldMatrix = newWorldMatrix;
-		mImgMatrix = newImgMatrix;
-		updateImageMatrix();
+        QPointF imgPos = QPointF(canvasSize.x() * getImageSize().width(), canvasSize.y() * getImageSize().height());
 
-		QPointF imgPos = QPointF(canvasSize.x()*getImageSize().width(), canvasSize.y()*getImageSize().height());
+        // go to screen coordinates
+        imgPos = mImgMatrix.map(imgPos);
 
-		// go to screen coordinates
-		imgPos = mImgMatrix.map(imgPos);
+        // go to world coordinates
+        imgPos = mWorldMatrix.map(imgPos);
 
-		// go to world coordinates
-		imgPos = mWorldMatrix.map(imgPos);
+        // compute difference to current mViewport center - in world coordinates
+        imgPos = QPointF(width() * 0.5f, height() * 0.5f) - imgPos;
 
-		// compute difference to current mViewport center - in world coordinates
-		imgPos = QPointF(width()*0.5f, height()*0.5f) - imgPos;
+        // back to screen coordinates
+        float s = (float)mWorldMatrix.m11();
+        mWorldMatrix.translate(imgPos.x() / s, imgPos.y() / s);
+    }
 
-		// back to screen coordinates
-		float s = (float)mWorldMatrix.m11();
-		mWorldMatrix.translate(imgPos.x()/s, imgPos.y()/s);
-	}
-
-	update();
+    update();
 }
 
-void DkViewPort::tcpSetWindowRect(QRect rect) {
-	this->setGeometry(rect);
+void DkViewPort::tcpSetWindowRect(QRect rect)
+{
+    this->setGeometry(rect);
 }
 
-void DkViewPort::tcpForceSynchronize() {
-	tcpSynchronize(QTransform(), true);
+void DkViewPort::tcpForceSynchronize()
+{
+    tcpSynchronize(QTransform(), true);
 }
 
-void DkViewPort::tcpSynchronize(QTransform relativeMatrix, bool force) {
-	
-	if (!relativeMatrix.isIdentity()) {
-		emit sendTransformSignal(relativeMatrix, QTransform(), QPointF());
-		return;
-	}
+void DkViewPort::tcpSynchronize(QTransform relativeMatrix, bool force)
+{
+    if (!relativeMatrix.isIdentity()) {
+        emit sendTransformSignal(relativeMatrix, QTransform(), QPointF());
+        return;
+    }
 
-	// check if we need a synchronization
-	if ((force || qApp->keyboardModifiers() == mAltMod ||
-		DkSettingsManager::param().sync().syncActions) &&
-		(hasFocus() || mController->hasFocus())) {
-		QPointF size = QPointF(geometry().width()/2.0f, geometry().height()/2.0f);
-		size = mWorldMatrix.inverted().map(size);
-		size = mImgMatrix.inverted().map(size);
-		size = QPointF(size.x()/(float)getImageSize().width(), size.y()/(float)getImageSize().height());
+    // check if we need a synchronization
+    if ((force || qApp->keyboardModifiers() == mAltMod || DkSettingsManager::param().sync().syncActions) && (hasFocus() || mController->hasFocus())) {
+        QPointF size = QPointF(geometry().width() / 2.0f, geometry().height() / 2.0f);
+        size = mWorldMatrix.inverted().map(size);
+        size = mImgMatrix.inverted().map(size);
+        size = QPointF(size.x() / (float)getImageSize().width(), size.y() / (float)getImageSize().height());
 
-		emit sendTransformSignal(mWorldMatrix, mImgMatrix, size);
-	}
+        emit sendTransformSignal(mWorldMatrix, mImgMatrix, size);
+    }
 }
 
-void DkViewPort::applyPlugin(DkPluginContainer* plugin, const QString& key) {
-	
+void DkViewPort::applyPlugin(DkPluginContainer *plugin, const QString &key)
+{
 #ifdef WITH_PLUGINS
-	if (!plugin)
-		return;
+    if (!plugin)
+        return;
 
-	DkBatchPluginInterface* bPlugin = plugin->batchPlugin();
-	if (bPlugin)
-		bPlugin->loadSettings();
+    DkBatchPluginInterface *bPlugin = plugin->batchPlugin();
+    if (bPlugin)
+        bPlugin->loadSettings();
 
-	QSharedPointer<DkImageContainerT> result = DkImageContainerT::fromImageContainer(plugin->plugin()->runPlugin(key, imageContainer()));
-	if (result) 
-		setEditedImage(result);
+    QSharedPointer<DkImageContainerT> result = DkImageContainerT::fromImageContainer(plugin->plugin()->runPlugin(key, imageContainer()));
+    if (result)
+        setEditedImage(result);
 
-	plugin->setActive(false);
+    plugin->setActive(false);
 #else
-	Q_UNUSED(plugin);
-	Q_UNUSED(key);
+    Q_UNUSED(plugin);
+    Q_UNUSED(key);
 #endif
 }
 
-QImage DkViewPort::getImage() const {
-	
-	if (imageContainer() && (!mSvg || !mSvg->isValid()) && (!mMovie || !mMovie->isValid()))
-		return imageContainer()->image();
-	
-	return DkBaseViewPort::getImage();
-}
-
-void DkViewPort::resizeImage() {
-
-	if (!mResizeDialog)
-		mResizeDialog = new DkResizeDialog(this);
+QImage DkViewPort::getImage() const
+{
+    if (imageContainer() && (!mSvg || !mSvg->isValid()) && (!mMovie || !mMovie->isValid()))
+        return imageContainer()->image();
 
-	QSharedPointer<DkImageContainerT> imgC = imageContainer();
-	QSharedPointer<DkMetaDataT> metaData;
+    return DkBaseViewPort::getImage();
+}
 
-	if (imgC) {
-		metaData = imgC->getMetaData();
-		QVector2D res = metaData->getResolution();
-		mResizeDialog->setExifDpi((float)res.x());
-	}
+void DkViewPort::resizeImage()
+{
+    if (!mResizeDialog)
+        mResizeDialog = new DkResizeDialog(this);
 
-	if (!imgC) {
-		qWarning() << "cannot resize empty image...";
-		return;
-	}
+    QSharedPointer<DkImageContainerT> imgC = imageContainer();
+    QSharedPointer<DkMetaDataT> metaData;
 
-	mResizeDialog->setImage(imgC->image());
+    if (imgC) {
+        metaData = imgC->getMetaData();
+        QVector2D res = metaData->getResolution();
+        mResizeDialog->setExifDpi((float)res.x());
+    }
 
-	if (!mResizeDialog->exec())
-		return;
+    if (!imgC) {
+        qWarning() << "cannot resize empty image...";
+        return;
+    }
 
-	if (mResizeDialog->resample()) {
+    mResizeDialog->setImage(imgC->image());
 
-		QImage rImg = mResizeDialog->getResizedImage();
+    if (!mResizeDialog->exec())
+        return;
 
-		if (!rImg.isNull()) {
+    if (mResizeDialog->resample()) {
+        QImage rImg = mResizeDialog->getResizedImage();
 
-			// this reloads the image -> that's not what we want!
-			if (metaData)
-				metaData->setResolution(QVector2D(mResizeDialog->getExifDpi(), mResizeDialog->getExifDpi()));
+        if (!rImg.isNull()) {
+            // this reloads the image -> that's not what we want!
+            if (metaData)
+                metaData->setResolution(QVector2D(mResizeDialog->getExifDpi(), mResizeDialog->getExifDpi()));
 
-			imgC->setImage(rImg, tr("Resize"));
-			setEditedImage(imgC);
-		}
-	}
-	else if (metaData) {
-		// ok, user just wants to change the resolution
-		metaData->setResolution(QVector2D(mResizeDialog->getExifDpi(), mResizeDialog->getExifDpi()));
-		qDebug() << "setting resolution to: " << mResizeDialog->getExifDpi();
-	}
+            imgC->setImage(rImg, tr("Resize"));
+            setEditedImage(imgC);
+        }
+    } else if (metaData) {
+        // ok, user just wants to change the resolution
+        metaData->setResolution(QVector2D(mResizeDialog->getExifDpi(), mResizeDialog->getExifDpi()));
+        qDebug() << "setting resolution to: " << mResizeDialog->getExifDpi();
+    }
 }
 
-void DkViewPort::deleteImage() {
-
-	auto imgC = imageContainer();
+void DkViewPort::deleteImage()
+{
+    auto imgC = imageContainer();
 
-	if (!imgC || !imgC->hasImage())
-		return;
+    if (!imgC || !imgC->hasImage())
+        return;
 
-	getController()->applyPluginChanges(true);
+    getController()->applyPluginChanges(true);
 
-	QFileInfo fileInfo(imgC->filePath());
-	QString question;
+    QFileInfo fileInfo(imgC->filePath());
+    QString question;
 
 #if defined(Q_OS_WIN) || defined(Q_OS_LINUX)
-	question = tr("Shall I move %1 to trash?").arg(fileInfo.fileName());
+    question = tr("Shall I move %1 to trash?").arg(fileInfo.fileName());
 #else
-	question = tr("Do you want to permanently delete %1?").arg(fileInfo.fileName());
+    question = tr("Do you want to permanently delete %1?").arg(fileInfo.fileName());
 #endif
 
-	DkMessageBox* msgBox = new DkMessageBox(
-		QMessageBox::Question,
-		tr("Delete File"),
-		question,
-		(QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel),
-		this);
+    DkMessageBox *msgBox =
+        new DkMessageBox(QMessageBox::Question, tr("Delete File"), question, (QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel), this);
 
-	msgBox->setDefaultButton(QMessageBox::Yes);
-	msgBox->setObjectName("deleteFileDialog");
+    msgBox->setDefaultButton(QMessageBox::Yes);
+    msgBox->setObjectName("deleteFileDialog");
 
-	int answer = msgBox->exec();
+    int answer = msgBox->exec();
 
-	if (answer == QMessageBox::Accepted || answer == QMessageBox::Yes) {
-		stopMovie();	// movies keep file handles so stop it before we can delete files
+    if (answer == QMessageBox::Accepted || answer == QMessageBox::Yes) {
+        stopMovie(); // movies keep file handles so stop it before we can delete files
 
-		if (!mLoader->deleteFile())
-			loadMovie();	// load the movie again, if we could not delete it
-	}
+        if (!mLoader->deleteFile())
+            loadMovie(); // load the movie again, if we could not delete it
+    }
 }
 
-void DkViewPort::saveFile() {
-	saveFileAs(true);
+void DkViewPort::saveFile()
+{
+    saveFileAs(true);
 }
 
-void DkViewPort::saveFileAs(bool silent) {
+void DkViewPort::saveFileAs(bool silent)
+{
+    if (mLoader) {
+        mController->closePlugin(false);
 
-	if (mLoader) {
-		mController->closePlugin(false);
-		
-		QImage img = getImage();
+        QImage img = getImage();
 
-		if (mLoader->hasSvg() && !mLoader->isEdited()) {
-			
-			DkSvgSizeDialog* sd = new DkSvgSizeDialog(img.size(), DkUtils::getMainWindow());
-			sd->resize(270, 120);
+        if (mLoader->hasSvg() && !mLoader->isEdited()) {
+            DkSvgSizeDialog *sd = new DkSvgSizeDialog(img.size(), DkUtils::getMainWindow());
+            sd->resize(270, 120);
 
-			int answer = sd->exec();
+            int answer = sd->exec();
 
-			if (answer == QDialog::Accepted) {
-				
-				img = QImage(sd->size(), QImage::Format_ARGB32);
-				img.fill(QColor(0, 0, 0, 0));
+            if (answer == QDialog::Accepted) {
+                img = QImage(sd->size(), QImage::Format_ARGB32);
+                img.fill(QColor(0, 0, 0, 0));
 
-				QPainter p(&img);
-				mSvg->render(&p, QRectF(QPointF(), sd->size()));
-			}
-		}
-		
-		mLoader->saveUserFileAs(img, silent);
-	}
-}
+                QPainter p(&img);
+                mSvg->render(&p, QRectF(QPointF(), sd->size()));
+            }
+        }
 
-void DkViewPort::saveFileWeb() {
-	if (mLoader) {
-		mController->closePlugin(false);
-		mLoader->saveFileWeb(getImage());
-	}
+        mLoader->saveUserFileAs(img, silent);
+    }
 }
 
-void DkViewPort::setAsWallpaper() {
+void DkViewPort::saveFileWeb()
+{
+    if (mLoader) {
+        mController->closePlugin(false);
+        mLoader->saveFileWeb(getImage());
+    }
+}
 
-	// based on code from: http://qtwiki.org/Set_windows_background_using_QT
-	auto imgC = imageContainer();
+void DkViewPort::setAsWallpaper()
+{
+    // based on code from: http://qtwiki.org/Set_windows_background_using_QT
+    auto imgC = imageContainer();
 
-	if (!imgC || !imgC->hasImage()) {
-		qWarning() << "cannot create wallpaper because there is no image loaded...";
-	}
+    if (!imgC || !imgC->hasImage()) {
+        qWarning() << "cannot create wallpaper because there is no image loaded...";
+    }
 
-	QImage img = imgC->image();
-	QString tmpPath = mLoader->saveTempFile(img, "wallpaper", ".jpg", true, false);
+    QImage img = imgC->image();
+    QString tmpPath = mLoader->saveTempFile(img, "wallpaper", ".jpg", true, false);
 
-	// is there a more elegant way to see if saveTempFile returned an empty path
-	if (tmpPath.isEmpty()) {
-		QMessageBox::critical(this, tr("Error"), tr("Sorry, I could not create a wallpaper..."));
-		return;
-	}
+    // is there a more elegant way to see if saveTempFile returned an empty path
+    if (tmpPath.isEmpty()) {
+        QMessageBox::critical(this, tr("Error"), tr("Sorry, I could not create a wallpaper..."));
+        return;
+    }
 
 #ifdef Q_OS_WIN
 
-	//Read current windows background image path
-	QSettings appSettings("HKEY_CURRENT_USER\\Control Panel\\Desktop", QSettings::NativeFormat);
-	appSettings.setValue("Wallpaper", tmpPath);
+    // Read current windows background image path
+    QSettings appSettings("HKEY_CURRENT_USER\\Control Panel\\Desktop", QSettings::NativeFormat);
+    appSettings.setValue("Wallpaper", tmpPath);
 
-	QByteArray ba = tmpPath.toLatin1();
-	SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, (void*)ba.data(), SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE);
+    QByteArray ba = tmpPath.toLatin1();
+    SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, (void *)ba.data(), SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE);
 #endif
-	// TODO: add functionality for unix based systems
+    // TODO: add functionality for unix based systems
 }
 
-void DkViewPort::applyManipulator() {
+void DkViewPort::applyManipulator()
+{
+    QAction *action = dynamic_cast<QAction *>(QObject::sender());
 
-	QAction* action = dynamic_cast<QAction*>(QObject::sender());
+    if (!action) {
+        qWarning() << "applyManipulator is not called from its action!";
+        return;
+    }
 
-	if (!action) {
-		qWarning() << "applyManipulator is not called from its action!";
-		return;
-	}
+    DkActionManager &am = DkActionManager::instance();
+    QSharedPointer<DkBaseManipulator> mpl = am.manipulatorManager().manipulator(action);
 
-	DkActionManager& am = DkActionManager::instance();
-	QSharedPointer<DkBaseManipulator> mpl = am.manipulatorManager().manipulator(action);
+    if (!mpl) {
+        qWarning() << "could not find manipulator for:" << action;
+        return;
+    }
 
-	if (!mpl) {
-		qWarning() << "could not find manipulator for:" << action;
-		return;
-	}
+    // try to cast up
+    QSharedPointer<DkBaseManipulatorExt> mplExt = qSharedPointerDynamicCast<DkBaseManipulatorExt>(mpl);
 
-	// try to cast up
-	QSharedPointer<DkBaseManipulatorExt> mplExt = qSharedPointerDynamicCast<DkBaseManipulatorExt>(mpl);
+    // mark dirty
+    if (mManipulatorWatcher.isRunning() && mplExt && mActiveManipulator == mpl) {
+        mplExt->setDirty(true);
+        return;
+    }
 
-	// mark dirty
-	if (mManipulatorWatcher.isRunning() && mplExt && mActiveManipulator == mpl) {
-		mplExt->setDirty(true);
-		return;
-	}
+    if (mManipulatorWatcher.isRunning()) {
+        mController->setInfo(tr("Busy"));
+        return;
+    }
 
-	if (mManipulatorWatcher.isRunning()) {
-		mController->setInfo(tr("Busy"));
-		return;
-	}
+    // show the dock (in case it's not shown yet)
+    if (mplExt) {
+        am.action(DkActionManager::menu_edit_image)->setChecked(true);
+    }
 
-	// show the dock (in case it's not shown yet)
-	if (mplExt) {
-		am.action(DkActionManager::menu_edit_image)->setChecked(true);
-	}
+    // undo last if it is an extended manipulator
+    QImage img;
+    if (mplExt && imageContainer()) {
+        auto l = imageContainer()->getLoader();
+        l->setMinHistorySize(3); // increase the min history size to 3 for correctly popping back
+        if (!l->history()->isEmpty() && l->lastEdit().editName() == mplExt->name()) {
+            imageContainer()->undo();
+        }
+
+        img = imageContainer()->image();
+    } else
+        img = getImage();
+
+    mManipulatorWatcher.setFuture(QtConcurrent::run(mpl.data(), &nmc::DkBaseManipulator::apply, img));
+
+    mActiveManipulator = mpl;
+
+    emit showProgress(true, 500);
+}
+
+void DkViewPort::manipulatorApplied()
+{
+    DkGlobalProgress::instance().stop();
+
+    if (mManipulatorWatcher.isCanceled() || !mActiveManipulator) {
+        qDebug() << "manipulator applied - but it's canceled";
+        return;
+    }
+
+    // trigger again if it's dirty
+    QSharedPointer<DkBaseManipulatorExt> mplExt = qSharedPointerDynamicCast<DkBaseManipulatorExt>(mActiveManipulator);
 
-	// undo last if it is an extended manipulator
-	QImage img;
-	if (mplExt && imageContainer()) {
+    // set the edited image
+    QImage img = mManipulatorWatcher.result();
 
-		auto l = imageContainer()->getLoader();
-		l->setMinHistorySize(3);	// increase the min history size to 3 for correctly popping back
-		if (!l->history()->isEmpty() && l->lastEdit().editName() == mplExt->name()) {
-			imageContainer()->undo();
-		}
-		
-		img = imageContainer()->image();
-	}
-	else
-		img = getImage();
+    if (!img.isNull())
+        setEditedImage(img, mActiveManipulator->name());
+    else
+        mController->setInfo(mActiveManipulator->errorMessage());
 
-	mManipulatorWatcher.setFuture(
-		QtConcurrent::run(
-			mpl.data(), 
-			&nmc::DkBaseManipulator::apply,
-			img));
-
-	mActiveManipulator = mpl;
+    if (mplExt && mplExt->isDirty()) {
+        mplExt->setDirty(false);
+        mplExt->action()->trigger();
+        qDebug() << "triggering manipulator - it's dirty";
+    }
 
-	emit showProgress(true, 500);
-}
-
-void DkViewPort::manipulatorApplied() {
-
-	DkGlobalProgress::instance().stop();
-
-	if (mManipulatorWatcher.isCanceled() || !mActiveManipulator) {
-		qDebug() << "manipulator applied - but it's canceled";
-		return;
-	}
-
-	// trigger again if it's dirty
-	QSharedPointer<DkBaseManipulatorExt> mplExt = qSharedPointerDynamicCast<DkBaseManipulatorExt>(mActiveManipulator);
-
-	// set the edited image
-	QImage img = mManipulatorWatcher.result();
-
-	if (!img.isNull())
-		setEditedImage(img, mActiveManipulator->name());
-	else
-		mController->setInfo(mActiveManipulator->errorMessage());
-
-	if (mplExt && mplExt->isDirty()) {
-		mplExt->setDirty(false);
-		mplExt->action()->trigger();
-		qDebug() << "triggering manipulator - it's dirty";
-	}
-
-	emit showProgress(false);
+    emit showProgress(false);
 }
 
-void DkViewPort::paintEvent(QPaintEvent* event) {
-
-	QPainter painter(viewport());
-
-	if (!mImgStorage.isEmpty()) {
-
-		// usually the QGraphicsView should do this - but we have seen issues(e.g. #706)
-		painter.setPen(Qt::NoPen);
-		painter.setBrush(backgroundBrush());
-		painter.drawRect(QRect(QPoint(), size()));
-
-		painter.setWorldTransform(mWorldMatrix);
-
-		// interpolate between 100% and max interpolate level
-		if (!mForceFastRendering && // force?
-			mImgMatrix.m11()*mWorldMatrix.m11() - DBL_EPSILON > 1.0 && // @100% ?
-			mImgMatrix.m11()*mWorldMatrix.m11() <= DkSettingsManager::param().display().interpolateZoomLevel / 100.0) {	// > max zoom level
-			painter.setRenderHints(QPainter::SmoothPixmapTransform | QPainter::Antialiasing);
-		}
-		
-		if (DkSettingsManager::param().display().transition == DkSettings::trans_swipe &&
-			!mAnimationBuffer.isNull()) {
-		
-			double dx = mNextSwipe ? width()*(mAnimationValue) : -width()*(mAnimationValue);
+void DkViewPort::paintEvent(QPaintEvent *event)
+{
+    QPainter painter(viewport());
 
-			QTransform swipeTransform;
-			swipeTransform.translate(dx, 0);
-			painter.setTransform(swipeTransform);
-		}
+    if (!mImgStorage.isEmpty()) {
+        // usually the QGraphicsView should do this - but we have seen issues(e.g. #706)
+        painter.setPen(Qt::NoPen);
+        painter.setBrush(backgroundBrush());
+        painter.drawRect(QRect(QPoint(), size()));
 
-		// TODO: if fading is active we interpolate with background instead of the other image
-		double opacity = (DkSettingsManager::param().display().transition == DkSettings::trans_fade) ? 1.0 - mAnimationValue : 1.0;
-		draw(painter, opacity);
+        painter.setWorldTransform(mWorldMatrix);
 
-		if (!mAnimationBuffer.isNull() && mAnimationValue > 0) {
+        // interpolate between 100% and max interpolate level
+        if (!mForceFastRendering && // force?
+            mImgMatrix.m11() * mWorldMatrix.m11() - DBL_EPSILON > 1.0 && // @100% ?
+            mImgMatrix.m11() * mWorldMatrix.m11() <= DkSettingsManager::param().display().interpolateZoomLevel / 100.0) { // > max zoom level
+            painter.setRenderHints(QPainter::SmoothPixmapTransform | QPainter::Antialiasing);
+        }
 
-			float oldOp = (float)painter.opacity();
-			
-			// fade transition
-			if (DkSettingsManager::param().display().transition == DkSettings::trans_fade) {
-				painter.setOpacity(mAnimationValue);
-			}
-			else if (DkSettingsManager::param().display().transition == DkSettings::trans_swipe) {
-			
-				double dx = mNextSwipe ? -width()*(1.0-mAnimationValue) : width()*(1.0-mAnimationValue);
-				QTransform swipeTransform;
-				swipeTransform.translate(dx, 0);
-				painter.setTransform(swipeTransform);
-			}
+        if (DkSettingsManager::param().display().transition == DkSettings::trans_swipe && !mAnimationBuffer.isNull()) {
+            double dx = mNextSwipe ? width() * (mAnimationValue) : -width() * (mAnimationValue);
 
-			painter.drawImage(mFadeImgViewRect, mAnimationBuffer, mAnimationBuffer.rect());
-			painter.setOpacity(oldOp);
-		}
+            QTransform swipeTransform;
+            swipeTransform.translate(dx, 0);
+            painter.setTransform(swipeTransform);
+        }
 
-		// now disable world matrix for overlay display
-		painter.setWorldMatrixEnabled(false);
-	}
-	else
-		drawBackground(painter);
+        // TODO: if fading is active we interpolate with background instead of the other image
+        double opacity = (DkSettingsManager::param().display().transition == DkSettings::trans_fade) ? 1.0 - mAnimationValue : 1.0;
+        draw(painter, opacity);
 
-	//// draw the cropping rect
-	//if (!mCropRect.isEmpty() && DkSettingsManager::param().display().showCrop && imageContainer()) {
+        if (!mAnimationBuffer.isNull() && mAnimationValue > 0) {
+            float oldOp = (float)painter.opacity();
 
-	//	// create path
-	//	QPainterPath path;
-	//	path.addRect(getImageViewRect().toRect());
+            // fade transition
+            if (DkSettingsManager::param().display().transition == DkSettings::trans_fade) {
+                painter.setOpacity(mAnimationValue);
+            } else if (DkSettingsManager::param().display().transition == DkSettings::trans_swipe) {
+                double dx = mNextSwipe ? -width() * (1.0 - mAnimationValue) : width() * (1.0 - mAnimationValue);
+                QTransform swipeTransform;
+                swipeTransform.translate(dx, 0);
+                painter.setTransform(swipeTransform);
+            }
 
-	//	DkRotatingRect r = mCropRect;
-	//	QPolygonF polyF;
-	//	polyF = r.getClosedPoly();
-	//	polyF = mImgMatrix.map(polyF);
-	//	polyF = mWorldMatrix.map(polyF);
-	//	path.addPolygon(polyF.toPolygon());
+            painter.drawImage(mFadeImgViewRect, mAnimationBuffer, mAnimationBuffer.rect());
+            painter.setOpacity(oldOp);
+        }
 
-	//	painter.setPen(Qt::NoPen);
-	//	painter.setBrush(QColor(0,0,0,100));
-	//	painter.drawPath(path);
-	//}
+        // now disable world matrix for overlay display
+        painter.setWorldMatrixEnabled(false);
+    } else
+        drawBackground(painter);
 
-	painter.end();
+    // draw the cropping rect
+    if (!mCropRect.isEmpty() && DkSettingsManager::param().display().showCrop && imageContainer()) {
+        // create path
+        QPainterPath path;
+        path.addRect(getImageViewRect().toRect());
 
-	// propagate
-	QGraphicsView::paintEvent(event);
-}
+        DkRotatingRect r = mCropRect;
+        QPolygonF polyF;
+        polyF = r.getClosedPoly();
+        polyF = mImgMatrix.map(polyF);
+        polyF = mWorldMatrix.map(polyF);
+        path.addPolygon(polyF.toPolygon());
 
-void DkViewPort::leaveEvent(QEvent* event) {
+        painter.setPen(Qt::NoPen);
+        painter.setBrush(QColor(0, 0, 0, 100));
+        painter.drawPath(path);
+    }
 
-	// hide navigation buttons if the mouse leaves the viewport
-	mNavigationWidget->hide();
-	DkBaseViewPort::leaveEvent(event);
+    painter.end();
+
+    // propagate
+    QGraphicsView::paintEvent(event);
+}
+
+void DkViewPort::leaveEvent(QEvent *event)
+{
+    // hide navigation buttons if the mouse leaves the viewport
+    mNavigationWidget->hide();
+    DkBaseViewPort::leaveEvent(event);
 }
 
 // drawing functions --------------------------------------------------------------------
-void DkViewPort::drawBackground(QPainter & painter) {
-	
-	// fit to mViewport
-	QSize s = mImgBg.size();
-	if (s.width() > (float)(size().width()*0.5))
-		s = s*((size().width()*0.5)/s.width());
+void DkViewPort::drawBackground(QPainter &painter)
+{
+    // fit to mViewport
+    QSize s = mImgBg.size();
+    if (s.width() > (float)(size().width() * 0.5))
+        s = s * ((size().width() * 0.5) / s.width());
 
-	if (s.height() > size().height()*0.6)
-		s = s*((size().height()*0.6)/s.height());
+    if (s.height() > size().height() * 0.6)
+        s = s * ((size().height() * 0.6) / s.height());
 
-	QRect bgRect(QPoint(), s);
-	bgRect.moveBottomRight(QPoint(width()-20, height()-20));
+    QRect bgRect(QPoint(), s);
+    bgRect.moveBottomRight(QPoint(width() - 20, height() - 20));
 
-	painter.drawImage(bgRect, mImgBg, QRect(QPoint(), mImgBg.size()));
+    painter.drawImage(bgRect, mImgBg, QRect(QPoint(), mImgBg.size()));
 }
 
-void DkViewPort::loadMovie() {
-
-	if (!mLoader)
-		return;
+void DkViewPort::loadMovie()
+{
+    if (!mLoader)
+        return;
 
-	if (mMovie)
-		mMovie->stop();
+    if (mMovie)
+        mMovie->stop();
 
-	// check if it truely a movie (we need this for we don't know if webp is actually animated)
-	QSharedPointer<QMovie> m(new QMovie(mLoader->filePath()));
-	if (m->frameCount() == 1)
-		return;
+    // check if it truely a movie (we need this for we don't know if webp is actually animated)
+    QSharedPointer<QMovie> m(new QMovie(mLoader->filePath()));
+    if (m->frameCount() == 1)
+        return;
 
-	mMovie = m;
+    mMovie = m;
 
-	connect(mMovie.data(), SIGNAL(frameChanged(int)), this, SLOT(update()));
-	mMovie->start();
+    connect(mMovie.data(), SIGNAL(frameChanged(int)), this, SLOT(update()));
+    mMovie->start();
 
-	emit movieLoadedSignal(true);
+    emit movieLoadedSignal(true);
 }
 
-void DkViewPort::loadSvg() {
-
-	if (!mLoader)
-		return;
-
-	auto cc = mLoader->getCurrentImage();
-	if (cc) {
-		mSvg = QSharedPointer<QSvgRenderer>(
-			new QSvgRenderer(
-			*cc->getFileBuffer()
-			));
-	}
-	else {
-		mSvg = QSharedPointer<QSvgRenderer>(
-			new QSvgRenderer(
-			mLoader->filePath()
-			));
-	}
+void DkViewPort::loadSvg()
+{
+    if (!mLoader)
+        return;
 
-	connect(mSvg.data(), SIGNAL(repaintNeeded()), this, SLOT(update()));
+    auto cc = mLoader->getCurrentImage();
+    if (cc) {
+        mSvg = QSharedPointer<QSvgRenderer>(new QSvgRenderer(*cc->getFileBuffer()));
+    } else {
+        mSvg = QSharedPointer<QSvgRenderer>(new QSvgRenderer(mLoader->filePath()));
+    }
 
+    connect(mSvg.data(), SIGNAL(repaintNeeded()), this, SLOT(update()));
 }
 
-void DkViewPort::pauseMovie(bool pause) {
+void DkViewPort::pauseMovie(bool pause)
+{
+    if (!mMovie)
+        return;
 
-	if (!mMovie)
-		return;
-
-	mMovie->setPaused(pause);
+    mMovie->setPaused(pause);
 }
 
-void DkViewPort::nextMovieFrame() {
-
-	if (!mMovie)
-		return;
+void DkViewPort::nextMovieFrame()
+{
+    if (!mMovie)
+        return;
 
-	mMovie->jumpToNextFrame();
-	update();
+    mMovie->jumpToNextFrame();
+    update();
 }
 
-void DkViewPort::previousMovieFrame() {
+void DkViewPort::previousMovieFrame()
+{
+    if (!mMovie)
+        return;
 
-	if (!mMovie)
-		return;
+    int fn = mMovie->currentFrameNumber() - 1;
+    if (fn == -1)
+        fn = mMovie->frameCount() - 1;
+    // qDebug() << "retrieving frame: " << fn;
 
-	
-	int fn = mMovie->currentFrameNumber()-1;
-	if (fn == -1)
-		fn = mMovie->frameCount()-1;
-	//qDebug() << "retrieving frame: " << fn;
-	
-	while(mMovie->currentFrameNumber() != fn)
-		mMovie->jumpToNextFrame();
+    while (mMovie->currentFrameNumber() != fn)
+        mMovie->jumpToNextFrame();
 
-	//// the subsequent thing is not working if the movie is paused
-	//bool success = movie->jumpToFrame(movie->currentFrameNumber()-1);
-	update();
+    //// the subsequent thing is not working if the movie is paused
+    // bool success = movie->jumpToFrame(movie->currentFrameNumber()-1);
+    update();
 }
 
-void DkViewPort::stopMovie() {
+void DkViewPort::stopMovie()
+{
+    if (!mMovie)
+        return;
 
-	if (!mMovie)
-		return;		
-	
-	mMovie->stop();
-	mMovie = QSharedPointer<QMovie>();
+    mMovie->stop();
+    mMovie = QSharedPointer<QMovie>();
 }
 
-void DkViewPort::drawPolygon(QPainter & painter, const QPolygon & polygon) {
-
-	QPoint lastPoint;
-
-	for (const QPoint& p : polygon) {
+void DkViewPort::drawPolygon(QPainter &painter, const QPolygon &polygon)
+{
+    QPoint lastPoint;
 
-		if (!lastPoint.isNull())
-			painter.drawLine(p, lastPoint);
-
-		lastPoint = p;
-	}
+    for (const QPoint &p : polygon) {
+        if (!lastPoint.isNull())
+            painter.drawLine(p, lastPoint);
 
+        lastPoint = p;
+    }
 }
 
 // event listeners --------------------------------------------------------------------
-void DkViewPort::resizeEvent(QResizeEvent *event) {
-
-	mViewportRect = QRect(0, 0, width(), height());
+void DkViewPort::resizeEvent(QResizeEvent *event)
+{
+    mViewportRect = QRect(0, 0, width(), height());
 
-	// >DIR: diem - bug if zoom factor is large and window becomes small
-	updateImageMatrix();
-	centerImage();
-	changeCursor();
+    // >DIR: diem - bug if zoom factor is large and window becomes small
+    updateImageMatrix();
+    centerImage();
+    changeCursor();
 
-	mController->getOverview()->setViewPortRect(geometry());
-	mController->resize(width(), height());
+    mController->getOverview()->setViewPortRect(geometry());
+    mController->resize(width(), height());
 
-	return QGraphicsView::resizeEvent(event);
+    return QGraphicsView::resizeEvent(event);
 }
 
 // mouse events --------------------------------------------------------------------
-bool DkViewPort::event(QEvent *event) {
-
-	// ok obviously QGraphicsView eats all mouse events -> so we simply redirect these to QWidget in order to get them delivered here
-	if (event->type() == QEvent::MouseButtonPress || 
-		event->type() == QEvent::MouseButtonDblClick || 
-		event->type() == QEvent::MouseButtonRelease || 
-		event->type() == QEvent::MouseMove || 
-		event->type() == QEvent::Wheel || 
-		event->type() == QEvent::KeyPress || 
-		event->type() == QEvent::KeyRelease || 
-		event->type() == QEvent::DragEnter ||
-
-		event->type() == QEvent::Drop) {
-
-		//qDebug() << "redirecting event...";
-		// mouse events that double are now fixed, since the mViewport is now overlayed by the mController
-		return QWidget::event(event);
-	}
-	else {
-		//qDebug() << "not redirecting - type: " << event->type();
-		return DkBaseViewPort::event(event);
-	}
-}
-
-void DkViewPort::dragLeaveEvent(QDragLeaveEvent *event) {
-
-	event->accept();	
-}
-
-void DkViewPort::mousePressEvent(QMouseEvent *event) {
-
-	// if zoom on wheel, the additional keys should be used for switching files
-	if (DkSettingsManager::param().global().zoomOnWheel) {
-		if(event->buttons() == Qt::XButton1)
-			loadPrevFileFast();
-		else if(event->buttons() == Qt::XButton2)
-			loadNextFileFast();
-	} 
-	else if(event->buttons() == Qt::XButton1 || event->buttons() == Qt::XButton2) {
-		repeatZoom();
-		mRepeatZoomTimer->start();
-	}
-	
-	// ok, start panning
-	if (mWorldMatrix.m11() > 1 && !imageInside() && event->buttons() == Qt::LeftButton) {
-		setCursor(Qt::ClosedHandCursor);
-		mPosGrab = event->pos();
-	}
-	
-	// keep in mind if the gesture was started in the viewport
-	// this fixes issues if some HUD widgets or child widgets
-	// do not implement mouse events correctly
-	if (event->buttons() == Qt::LeftButton)
-		mGestureStarted = true;
-	else
-		mGestureStarted = false;
-
-	// should be sent to QWidget?!
-	DkBaseViewPort::mousePressEvent(event);
-}
-
-void DkViewPort::mouseReleaseEvent(QMouseEvent *event) {
-	
-	mRepeatZoomTimer->stop();
-
-	int sa = swipeRecognition(event->pos(), mPosGrab.toPoint());
-	QPoint pos = mapToImage(event->pos());
-
-	if (imageInside() && mGestureStarted) {
-		swipeAction(sa);
-	}
-
-	// needed for scientific projects...
-	if (pos.x() != -1 && pos.y() != -1)
-		emit mouseClickSignal(event, pos);
-
-	mGestureStarted = false;
-
-	DkBaseViewPort::mouseReleaseEvent(event);
-}
-
-void DkViewPort::mouseMoveEvent(QMouseEvent *event) {
-
-	if (DkSettingsManager::param().display().showNavigation &&
-		event->modifiers() == Qt::NoModifier && 
-		event->buttons() == Qt::NoButton) {
-
-		int left = qMin(100, qRound(0.1 * width()));
-		int right = qMax(width()-100, qRound(0.9 * width()));
-
-		if (event->pos().x() < left)
-			mNavigationWidget->showPrevious();
-		else if (event->pos().x() > right)
-			mNavigationWidget->showNext();
-		else if (mNavigationWidget->isVisible())
-			mNavigationWidget->hide();
-	}
-
-	//qDebug() << "mouse move (DkViewPort)";
-	//changeCursor();
-	mCurrentPixelPos = event->pos();
-
-	if (DkStatusBarManager::instance().statusbar()->isVisible())
-		getPixelInfo(event->pos());
-
-	if (mWorldMatrix.m11() > 1 && event->buttons() == Qt::LeftButton) {
-
-		QPointF cPos = event->pos();
-		QPointF dxy = (cPos - mPosGrab);
-		mPosGrab = cPos;
-		moveView(dxy/mWorldMatrix.m11());
-
-		// with shift also a hotkey for fast switching...
-		if ((DkSettingsManager::param().sync().syncAbsoluteTransform &&
-			event->modifiers() == (mAltMod | Qt::ShiftModifier)) || 
-			(!DkSettingsManager::param().sync().syncAbsoluteTransform &&
-			event->modifiers() == (mAltMod))) {
-			
-			if (dxy.x() != 0 || dxy.y() != 0) {
-				QTransform relTransform;
-				relTransform.translate(dxy.x(), dxy.y());
-				tcpSynchronize(relTransform);
-			}
-		}
+bool DkViewPort::event(QEvent *event)
+{
+    // ok obviously QGraphicsView eats all mouse events -> so we simply redirect these to QWidget in order to get them delivered here
+    if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonDblClick || event->type() == QEvent::MouseButtonRelease
+        || event->type() == QEvent::MouseMove || event->type() == QEvent::Wheel || event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease
+        || event->type() == QEvent::DragEnter ||
+
+        event->type() == QEvent::Drop) {
+        // qDebug() << "redirecting event...";
+        //  mouse events that double are now fixed, since the mViewport is now overlayed by the mController
+        return QWidget::event(event);
+    } else {
+        // qDebug() << "not redirecting - type: " << event->type();
+        return DkBaseViewPort::event(event);
+    }
+}
+
+void DkViewPort::dragLeaveEvent(QDragLeaveEvent *event)
+{
+    event->accept();
+}
+
+void DkViewPort::mousePressEvent(QMouseEvent *event)
+{
+    // if zoom on wheel, the additional keys should be used for switching files
+    if (DkSettingsManager::param().global().zoomOnWheel) {
+        if (event->buttons() == Qt::XButton1)
+            loadPrevFileFast();
+        else if (event->buttons() == Qt::XButton2)
+            loadNextFileFast();
+    } else if (event->buttons() == Qt::XButton1 || event->buttons() == Qt::XButton2) {
+        repeatZoom();
+        mRepeatZoomTimer->start();
+    }
+
+    // ok, start panning
+    if (mWorldMatrix.m11() > 1 && !imageInside() && event->buttons() == Qt::LeftButton) {
+        setCursor(Qt::ClosedHandCursor);
+        mPosGrab = event->pos();
+    }
+
+    // keep in mind if the gesture was started in the mViewport
+    // this fixes issues if some HUD widgets or child widgets
+    // do not implement mouse events correctly
+    if (event->buttons() == Qt::LeftButton)
+        mGestureStarted = true;
+    else
+        mGestureStarted = false;
+
+    // should be sent to QWidget?!
+    DkBaseViewPort::mousePressEvent(event);
+}
+
+void DkViewPort::mouseReleaseEvent(QMouseEvent *event)
+{
+    mRepeatZoomTimer->stop();
+
+    int sa = swipeRecognition(event->pos(), mPosGrab.toPoint());
+    QPoint pos = mapToImage(event->pos());
+
+    if (imageInside() && mGestureStarted) {
+        swipeAction(sa);
+    }
+
+    // needed for scientific projects...
+    if (pos.x() != -1 && pos.y() != -1)
+        emit mouseClickSignal(event, pos);
+
+    mGestureStarted = false;
+
+    DkBaseViewPort::mouseReleaseEvent(event);
+}
+
+void DkViewPort::mouseMoveEvent(QMouseEvent *event)
+{
+    if (DkSettingsManager::param().display().showNavigation && event->modifiers() == Qt::NoModifier && event->buttons() == Qt::NoButton) {
+        int left = qMin(100, qRound(0.1 * width()));
+        int right = qMax(width() - 100, qRound(0.9 * width()));
+
+        if (event->pos().x() < left)
+            mNavigationWidget->showPrevious();
+        else if (event->pos().x() > right)
+            mNavigationWidget->showNext();
+        else if (mNavigationWidget->isVisible())
+            mNavigationWidget->hide();
+    }
+
+    // qDebug() << "mouse move (DkViewPort)";
+    // changeCursor();
+    mCurrentPixelPos = event->pos();
+
+    if (DkStatusBarManager::instance().statusbar()->isVisible())
+        getPixelInfo(event->pos());
+
+    if (mWorldMatrix.m11() > 1 && event->buttons() == Qt::LeftButton) {
+        QPointF cPos = event->pos();
+        QPointF dxy = (cPos - mPosGrab);
+        mPosGrab = cPos;
+        moveView(dxy / mWorldMatrix.m11());
+
+        // with shift also a hotkey for fast switching...
+        if ((DkSettingsManager::param().sync().syncAbsoluteTransform && event->modifiers() == (mAltMod | Qt::ShiftModifier))
+            || (!DkSettingsManager::param().sync().syncAbsoluteTransform && event->modifiers() == (mAltMod))) {
+            if (dxy.x() != 0 || dxy.y() != 0) {
+                QTransform relTransform;
+                relTransform.translate(dxy.x(), dxy.y());
+                tcpSynchronize(relTransform);
+            }
+        }
         // absolute transformation
         else
-		    tcpSynchronize();
-	}
+            tcpSynchronize();
+    }
 
-	int dist = QPoint(event->pos()-mPosGrab.toPoint()).manhattanLength();
-	
-	// drag & drop action
-	if (event->buttons() == Qt::LeftButton 
-		&& dist > QApplication::startDragDistance()
-		&& imageInside()
-		&& !getImage().isNull()
-		&& mLoader
-		&& !QApplication::widgetAt(event->globalPos())) {	// is NULL if the mouse leaves the window
+    int dist = QPoint(event->pos() - mPosGrab.toPoint()).manhattanLength();
 
-			QMimeData* mimeData = createMime();
+    // drag & drop action
+    if (event->buttons() == Qt::LeftButton && dist > QApplication::startDragDistance() && imageInside() && !getImage().isNull() && mLoader
+        && !QApplication::widgetAt(event->globalPos())) { // is NULL if the mouse leaves the window
 
-			QPixmap pm;
-			if (!getImage().isNull())
-				pm = QPixmap::fromImage(mImgStorage.image().scaledToHeight(73, Qt::SmoothTransformation));
-			if (pm.width() > 130)
-				pm = pm.scaledToWidth(100, Qt::SmoothTransformation);
-
-			QDrag* drag = new QDrag(this);
-			drag->setMimeData(mimeData);
-			drag->setPixmap(pm);
-			drag->exec(Qt::CopyAction);
-	}
-
-	// send to parent
-	DkBaseViewPort::mouseMoveEvent(event);
-}
-
-void DkViewPort::wheelEvent(QWheelEvent *event) {
-
-	if ((!DkSettingsManager::param().global().zoomOnWheel && event->modifiers() != mCtrlMod) || 
-		(DkSettingsManager::param().global().zoomOnWheel && (event->modifiers() & mCtrlMod || 
-		(DkSettingsManager::param().global().horZoomSkips && event->orientation() == Qt::Horizontal && !(event->modifiers() & mAltMod))))) {
-
-		if (event->delta() < 0)
-			loadNextFileFast();
-		else
-			loadPrevFileFast();
-	}
-	else 
-		DkBaseViewPort::wheelEvent(event);
-
-	tcpSynchronize();
+        QMimeData *mimeData = createMime();
 
-}
+        QPixmap pm;
+        if (!getImage().isNull())
+            pm = QPixmap::fromImage(mImgStorage.image().scaledToHeight(73, Qt::SmoothTransformation));
+        if (pm.width() > 130)
+            pm = pm.scaledToWidth(100, Qt::SmoothTransformation);
 
-int DkViewPort::swipeRecognition(QPoint start, QPoint end) {
+        QDrag *drag = new QDrag(this);
+        drag->setMimeData(mimeData);
+        drag->setPixmap(pm);
+        drag->exec(Qt::CopyAction);
+    }
 
-	DkVector vec((float)(start.x()-end.x()), (float)(start.y()-end.y()));
-
-	if (fabs(vec.norm()) < 100)
-		return no_swipe;
+    // send to parent
+    DkBaseViewPort::mouseMoveEvent(event);
+}
 
-	double angle = DkMath::normAngleRad(vec.angle(DkVector(0,1)), 0.0, CV_PI);
-	bool horizontal = false;
+void DkViewPort::wheelEvent(QWheelEvent *event)
+{
+    if ((!DkSettingsManager::param().global().zoomOnWheel && event->modifiers() != mCtrlMod)
+        || (DkSettingsManager::param().global().zoomOnWheel
+            && (event->modifiers() & mCtrlMod
+                || (DkSettingsManager::param().global().horZoomSkips && event->orientation() == Qt::Horizontal && !(event->modifiers() & mAltMod))))) {
+        if (event->angleDelta().y() < 0)
+            loadNextFileFast();
+        else
+            loadPrevFileFast();
+    } else
+        DkBaseViewPort::wheelEvent(event);
 
-	if (angle > CV_PI*0.3 && angle < CV_PI*0.6)
-		horizontal = true;
-	else if (angle < 0.2*CV_PI || angle > 0.8*CV_PI)
-		horizontal = false;
-	else
-		return no_swipe;	// angles ~45� are not accepted
+    tcpSynchronize();
+}
 
-	QPoint startPos = QWidget::mapFromGlobal(end);
-	qDebug() << "vec: " << vec.x << ", " << vec.y;
+int DkViewPort::swipeRecognition(QPoint start, QPoint end)
+{
+    DkVector vec((float)(start.x() - end.x()), (float)(start.y() - end.y()));
 
-	if (horizontal) {
+    if (fabs(vec.norm()) < 100)
+        return no_swipe;
 
-		if (vec.x < 0)
-			return next_image;
-		else
-			return prev_image;
+    double angle = DkMath::normAngleRad(vec.angle(DkVector(0, 1)), 0.0, CV_PI);
+    bool horizontal = false;
 
-	}
-	// upper part of the canvas is thumbs
-	else if (!horizontal && startPos.y() < height()*0.5f) {
+    if (angle > CV_PI * 0.3 && angle < CV_PI * 0.6)
+        horizontal = true;
+    else if (angle < 0.2 * CV_PI || angle > 0.8 * CV_PI)
+        horizontal = false;
+    else
+        return no_swipe; // angles ~45� are not accepted
 
-		// downward gesture is opening
-		if (vec.y > 0)
-			return open_thumbs;
-		else
-			return close_thumbs;
-	}
-	// lower part of the canvas is thumbs
-	else if (!horizontal && startPos.y() > height()*0.5f) {
+    QPoint startPos = QWidget::mapFromGlobal(end);
+    qDebug() << "vec: " << vec.x << ", " << vec.y;
 
-		// upward gesture is opening
-		if (vec.y < 0)
-			return open_metadata;
-		else
-			return close_metadata;
-	}
+    if (horizontal) {
+        if (vec.x < 0)
+            return next_image;
+        else
+            return prev_image;
+
+    }
+    // upper part of the canvas is thumbs
+    else if (!horizontal && startPos.y() < height() * 0.5f) {
+        // downward gesture is opening
+        if (vec.y > 0)
+            return open_thumbs;
+        else
+            return close_thumbs;
+    }
+    // lower part of the canvas is thumbs
+    else if (!horizontal && startPos.y() > height() * 0.5f) {
+        // upward gesture is opening
+        if (vec.y < 0)
+            return open_metadata;
+        else
+            return close_metadata;
+    }
 
-	return no_swipe;
+    return no_swipe;
 }
 
-void DkViewPort::swipeAction(int swipeGesture) {
-
-	assert(mController);
+void DkViewPort::swipeAction(int swipeGesture)
+{
+    assert(mController);
 
-	switch (swipeGesture) {
-	case next_image:
-		loadNextFileFast();
-		break;
-	case prev_image:
-		loadPrevFileFast();
-		break;
-	case open_thumbs:
-		mController->showPreview(true);
-		break;
-	case close_thumbs:
-		mController->showPreview(false);
-		break;
-	case open_metadata:
-		mController->showMetaData(true);
-		break;
-	case close_metadata:
-		mController->showMetaData(false);
-		break;
-	default:
-		break;
-	}
+    switch (swipeGesture) {
+    case next_image:
+        loadNextFileFast();
+        break;
+    case prev_image:
+        loadPrevFileFast();
+        break;
+    case open_thumbs:
+        mController->showPreview(true);
+        break;
+    case close_thumbs:
+        mController->showPreview(false);
+        break;
+    case open_metadata:
+        mController->showMetaData(true);
+        break;
+    case close_metadata:
+        mController->showMetaData(false);
+        break;
+    default:
+        break;
+    }
 }
 
-void DkViewPort::setFullScreen(bool fullScreen) {
+void DkViewPort::setFullScreen(bool fullScreen)
+{
+    assert(mController);
+    mController->setFullScreen(fullScreen);
+    toggleLena(fullScreen);
 
-	assert(mController);
-	mController->setFullScreen(fullScreen);
-	toggleLena(fullScreen);
+    if (fullScreen)
+        QWidget::setWindowState(windowState() ^ Qt::WindowFullScreen);
+    else
+        QWidget::setWindowState(windowState() & ~Qt::WindowFullScreen);
 
-	if (fullScreen)
-		QWidget::setWindowState(windowState() ^ Qt::WindowFullScreen);
-	else
-		QWidget::setWindowState(windowState() & ~Qt::WindowFullScreen);
-
-	if (fullScreen)
-		mHideCursorTimer->start();
-	else
-		unsetCursor();
+    if (fullScreen)
+        mHideCursorTimer->start();
+    else
+        unsetCursor();
 }
 
-QPoint DkViewPort::mapToImage(const QPoint& windowPos) const {
-
-	QPointF imgPos = mWorldMatrix.inverted().map(QPointF(windowPos));
-	imgPos = mImgMatrix.inverted().map(imgPos);
+QPoint DkViewPort::mapToImage(const QPoint &windowPos) const
+{
+    QPointF imgPos = mWorldMatrix.inverted().map(QPointF(windowPos));
+    imgPos = mImgMatrix.inverted().map(imgPos);
 
-	QPoint xy(qFloor(imgPos.x()), qFloor(imgPos.y()));
+    QPoint xy(qFloor(imgPos.x()), qFloor(imgPos.y()));
 
-	if (xy.x() < 0 || xy.y() < 0 || xy.x() >= getImageSize().width() || xy.y() >= getImageSize().height())
-		return QPoint(-1,-1);
+    if (xy.x() < 0 || xy.y() < 0 || xy.x() >= getImageSize().width() || xy.y() >= getImageSize().height())
+        return QPoint(-1, -1);
 
-	return xy;
+    return xy;
 }
 
-void DkViewPort::getPixelInfo(const QPoint& pos) {
+void DkViewPort::getPixelInfo(const QPoint &pos)
+{
+    if (mImgStorage.isEmpty())
+        return;
 
-	if (mImgStorage.isEmpty())
-		return;
+    QPoint xy = mapToImage(pos);
 
-	QPoint xy = mapToImage(pos);
+    if (xy.x() == -1 || xy.y() == -1)
+        return;
 
-	if (xy.x() == -1 || xy.y() == -1)
-		return;
+    QColor col = getImage().pixel(xy);
 
-	QColor col = getImage().pixel(xy);
-	
-	QString msg = "x: " + QString::number(xy.x()) + " y: " + QString::number(xy.y()) +
-		" | r: " + QString::number(col.red()) + " g: " + QString::number(col.green()) + " b: " + QString::number(col.blue());
+    QString msg = "x: " + QString::number(xy.x()) + " y: " + QString::number(xy.y()) + " | r: " + QString::number(col.red())
+        + " g: " + QString::number(col.green()) + " b: " + QString::number(col.blue());
 
-	if (mImgStorage.image().hasAlphaChannel())
-		msg += " a: " + QString::number(col.alpha());
+    if (mImgStorage.image().hasAlphaChannel())
+        msg += " a: " + QString::number(col.alpha());
 
-	msg += " | " + col.name().toUpper();
+    msg += " | " + col.name().toUpper();
 
-	DkStatusBarManager::instance().setMessage(msg, DkStatusBar::status_pixel_info);
+    DkStatusBarManager::instance().setMessage(msg, DkStatusBar::status_pixel_info);
 }
 
-QString DkViewPort::getCurrentPixelHexValue() {
+QString DkViewPort::getCurrentPixelHexValue()
+{
+    if (mImgStorage.isEmpty() || mCurrentPixelPos.isNull())
+        return QString();
 
-	if (mImgStorage.isEmpty() || mCurrentPixelPos.isNull())
-		return QString();
+    QPointF imgPos = mWorldMatrix.inverted().map(QPointF(mCurrentPixelPos));
+    imgPos = mImgMatrix.inverted().map(imgPos);
 
-	QPointF imgPos = mWorldMatrix.inverted().map(QPointF(mCurrentPixelPos));
-	imgPos = mImgMatrix.inverted().map(imgPos);
+    QPoint xy(qFloor(imgPos.x()), qFloor(imgPos.y()));
 
-	QPoint xy(qFloor(imgPos.x()), qFloor(imgPos.y()));
+    if (xy.x() < 0 || xy.y() < 0 || xy.x() >= getImageSize().width() || xy.y() >= getImageSize().height())
+        return QString();
 
-	if (xy.x() < 0 || xy.y() < 0 || xy.x() >= getImageSize().width() || xy.y() >= getImageSize().height())
-		return QString();
+    QColor col = getImage().pixel(xy);
 
-	QColor col = getImage().pixel(xy);
-	
-	return col.name().toUpper().remove(0,1);
+    return col.name().toUpper().remove(0, 1);
 }
 
 // Copy & Paste --------------------------------------------------------
-void DkViewPort::copyPixelColorValue() {
+void DkViewPort::copyPixelColorValue()
+{
+    if (getImage().isNull())
+        return;
 
-	if (getImage().isNull())
-		return;
+    QMimeData *mimeData = new QMimeData;
 
-	QMimeData* mimeData = new QMimeData;
+    if (!getImage().isNull())
+        mimeData->setText(getCurrentPixelHexValue());
 
-	if (!getImage().isNull())
-		mimeData->setText(getCurrentPixelHexValue());
-
-	QClipboard* clipboard = QApplication::clipboard();
-	clipboard->setMimeData(mimeData);
+    QClipboard *clipboard = QApplication::clipboard();
+    clipboard->setMimeData(mimeData);
 }
 
-void DkViewPort::copyImage() {
-
-	QMimeData* mimeData = createMime();
+void DkViewPort::copyImage()
+{
+    QMimeData *mimeData = createMime();
 
-	QClipboard* clipboard = QApplication::clipboard();
-	clipboard->setMimeData(mimeData);
+    QClipboard *clipboard = QApplication::clipboard();
+    clipboard->setMimeData(mimeData);
 }
 
-QMimeData * DkViewPort::createMime() const {
+QMimeData *DkViewPort::createMime() const
+{
+    if (getImage().isNull() || !mLoader)
+        return 0;
 
-	if (getImage().isNull() || !mLoader)
-		return 0;
+    // NOTE: if we do the file:/// thingy, we will get into problems with mounted drives (e.g. //hermes...)
+    QUrl fileUrl = QUrl::fromLocalFile(mLoader->filePath());
 
-	// NOTE: if we do the file:/// thingy, we will get into problems with mounted drives (e.g. //hermes...)
-	QUrl fileUrl = QUrl::fromLocalFile(mLoader->filePath());
+    QList<QUrl> urls;
+    urls.append(fileUrl);
 
-	QList<QUrl> urls;
-	urls.append(fileUrl);
+    QMimeData *mimeData = new QMimeData;
 
-	QMimeData* mimeData = new QMimeData;
+    if (QFileInfo(mLoader->filePath()).exists() && !mLoader->isEdited()) {
+        mimeData->setUrls(urls);
+        mimeData->setText(fileUrl.toLocalFile());
+    } else if (!getImage().isNull())
+        mimeData->setImageData(getImage());
 
-	if (QFileInfo(mLoader->filePath()).exists() && !mLoader->isEdited()) {
-		mimeData->setUrls(urls);
-		mimeData->setText(fileUrl.toLocalFile());
-	}
-	else if (!getImage().isNull())
-		mimeData->setImageData(getImage());
-
-	return mimeData;
+    return mimeData;
 }
 
-void DkViewPort::copyImageBuffer() {
-
-	if (getImage().isNull())
-		return;
+void DkViewPort::copyImageBuffer()
+{
+    if (getImage().isNull())
+        return;
 
-	QMimeData* mimeData = new QMimeData;
+    QMimeData *mimeData = new QMimeData;
 
-	if (!getImage().isNull())
-		mimeData->setImageData(getImage());
+    if (!getImage().isNull())
+        mimeData->setImageData(getImage());
 
-	QClipboard* clipboard = QApplication::clipboard();
-	clipboard->setMimeData(mimeData);
+    QClipboard *clipboard = QApplication::clipboard();
+    clipboard->setMimeData(mimeData);
 }
 
-void DkViewPort::animateFade() {
+void DkViewPort::animateFade()
+{
+    mAnimationValue = 1.0f - (float)(mAnimationTime.elapsed() / 1000.0) / DkSettingsManager::param().display().animationDuration;
 
-	mAnimationValue = 1.0f-(float)(mAnimationTime.elapsed()/1000.0)/DkSettingsManager::param().display().animationDuration;
-	
-	// slow in - slow out
-	double speed = mAnimationValue > 0.5 ? fabs(1.0 - mAnimationValue) : fabs(mAnimationValue);
-	speed *= .05;
+    // slow in - slow out
+    double speed = mAnimationValue > 0.5 ? fabs(1.0 - mAnimationValue) : fabs(mAnimationValue);
+    speed *= .05;
 
-	mAnimationValue += (float)speed;
+    mAnimationValue += (float)speed;
 
-	if (mAnimationValue <= 0) {
-		mAnimationBuffer = QImage();
-		mAnimationTimer->stop();
-		mAnimationValue = 0;
-	}
+    if (mAnimationValue <= 0) {
+        mAnimationBuffer = QImage();
+        mAnimationTimer->stop();
+        mAnimationValue = 0;
+    }
 
-	update();
+    update();
 }
 
-void DkViewPort::togglePattern(bool show) {
-
-	emit infoSignal((show) ? tr("Transparency Pattern Enabled") : tr("Transparency Pattern Disabled"));
-	DkBaseViewPort::togglePattern(show);
+void DkViewPort::togglePattern(bool show)
+{
+    emit infoSignal((show) ? tr("Transparency Pattern Enabled") : tr("Transparency Pattern Disabled"));
+    DkBaseViewPort::togglePattern(show);
 }
 
 // edit image --------------------------------------------------------------------
-void DkViewPort::rotateCW() {
-
-	if (!mController->applyPluginChanges(true))
-		return;
+void DkViewPort::rotateCW()
+{
+    if (!mController->applyPluginChanges(true))
+        return;
 
-	if (mLoader)
-		mLoader->rotateImage(90);
+    if (mLoader)
+        mLoader->rotateImage(90);
 }
 
-void DkViewPort::rotateCCW() {
-
-	if (!mController->applyPluginChanges(true))
-		return;
-
-	if (mLoader)
-		mLoader->rotateImage(-90);
+void DkViewPort::rotateCCW()
+{
+    if (!mController->applyPluginChanges(true))
+        return;
 
+    if (mLoader)
+        mLoader->rotateImage(-90);
 }
 
-void DkViewPort::rotate180() {
-
-	if (!mController->applyPluginChanges(true))
-		return;
-
-	if (mLoader)
-		mLoader->rotateImage(180);
+void DkViewPort::rotate180()
+{
+    if (!mController->applyPluginChanges(true))
+        return;
 
+    if (mLoader)
+        mLoader->rotateImage(180);
 }
 
 // file handling --------------------------------------------------------------------
-void DkViewPort::loadLena() {
-
-	bool ok;
-	QString text = QInputDialog::getText(this, tr("Lenna"), tr("A remarkable woman"), QLineEdit::Normal, 0, &ok);
-
-	// pass phrase
-	if (ok && !text.isEmpty() && text == "lenna") {
-		mTestLoaded = true;
-		toggleLena(DkUtils::getMainWindow()->isFullScreen());
-	}
-	else if (!ok) {
-		QMessageBox warningDialog(DkUtils::getMainWindow());
-		warningDialog.setIcon(QMessageBox::Warning);
-		warningDialog.setText(tr("you cannot cancel this"));
-		warningDialog.exec();
-		loadLena();
-	}
-	else {
-		QApplication::beep();
-		
-		if (text.isEmpty())
-			mController->setInfo(tr("did you understand the brainteaser?"));
-		else
-			mController->setInfo(tr("%1 is wrong...").arg(text));
-	}
+void DkViewPort::loadLena()
+{
+    bool ok;
+    QString text = QInputDialog::getText(this, tr("Lenna"), tr("A remarkable woman"), QLineEdit::Normal, 0, &ok);
+
+    // pass phrase
+    if (ok && !text.isEmpty() && text == "lenna") {
+        mTestLoaded = true;
+        toggleLena(DkUtils::getMainWindow()->isFullScreen());
+    } else if (!ok) {
+        QMessageBox warningDialog(DkUtils::getMainWindow());
+        warningDialog.setIcon(QMessageBox::Warning);
+        warningDialog.setText(tr("you cannot cancel this"));
+        warningDialog.exec();
+        loadLena();
+    } else {
+        QApplication::beep();
+
+        if (text.isEmpty())
+            mController->setInfo(tr("did you understand the brainteaser?"));
+        else
+            mController->setInfo(tr("%1 is wrong...").arg(text));
+    }
 }
 
-void DkViewPort::toggleLena(bool fullscreen) {
+void DkViewPort::toggleLena(bool fullscreen)
+{
+    if (!mTestLoaded)
+        return;
 
-	if (!mTestLoaded)
-		return;
-
-	if (mLoader) {
-		if (fullscreen)
-			mLoader->downloadFile(QUrl("http://www.lenna.org/lena_std.tif"));
-		else
-			mLoader->load(":/nomacs/img/we.jpg");
-	}
+    if (mLoader) {
+        if (fullscreen)
+            mLoader->downloadFile(QUrl("http://www.lenna.org/lena_std.tif"));
+        else
+            mLoader->load(":/nomacs/img/we.jpg");
+    }
 }
 
-void DkViewPort::settingsChanged() {
+void DkViewPort::settingsChanged()
+{
+    reloadFile();
 
-	reloadFile();
+    mAltMod = DkSettingsManager::param().global().altMod;
+    mCtrlMod = DkSettingsManager::param().global().ctrlMod;
 
-	mAltMod = DkSettingsManager::param().global().altMod;
-	mCtrlMod = DkSettingsManager::param().global().ctrlMod;
-
-	mController->settingsChanged();
+    mController->settingsChanged();
 }
 
-void DkViewPort::setEditedImage(const QImage& newImg, const QString& editName) {
-
-	if (!mController->applyPluginChanges(true))		// user wants to first apply the plugin
-		return;
+void DkViewPort::setEditedImage(const QImage &newImg, const QString &editName)
+{
+    if (!mController->applyPluginChanges(true)) // user wants to first apply the plugin
+        return;
 
-	if (newImg.isNull()) {
-		emit infoSignal(tr("Attempted to set NULL image"));	// not sure if users understand that
-		return;
-	}
+    if (newImg.isNull()) {
+        emit infoSignal(tr("Attempted to set NULL image")); // not sure if users understand that
+        return;
+    }
 
-	if (mManipulatorWatcher.isRunning())
-		mManipulatorWatcher.cancel();
+    if (mManipulatorWatcher.isRunning())
+        mManipulatorWatcher.cancel();
 
-	QSharedPointer<DkImageContainerT> imgC = mLoader->getCurrentImage();
+    QSharedPointer<DkImageContainerT> imgC = mLoader->getCurrentImage();
 
-	if (!imgC)
-		imgC = QSharedPointer<DkImageContainerT>(new DkImageContainerT(""));
+    if (!imgC)
+        imgC = QSharedPointer<DkImageContainerT>(new DkImageContainerT(""));
 
-	if (!imgC)
-		imgC = QSharedPointer<DkImageContainerT>();
-	imgC->setImage(newImg, editName);
-	unloadImage(false);
-	mLoader->setImage(imgC);
-	qDebug() << "mLoader gets this size: " << newImg.size();
+    if (!imgC)
+        imgC = QSharedPointer<DkImageContainerT>();
+    imgC->setImage(newImg, editName);
+    unloadImage(false);
+    mLoader->setImage(imgC);
+    qDebug() << "mLoader gets this size: " << newImg.size();
 }
 
-void DkViewPort::setEditedImage(QSharedPointer<DkImageContainerT> img) {
+void DkViewPort::setEditedImage(QSharedPointer<DkImageContainerT> img)
+{
+    if (!img) {
+        emit infoSignal(tr("Attempted to set NULL image")); // not sure if users understand that
+        return;
+    }
 
-	if (!img) {
-		emit infoSignal(tr("Attempted to set NULL image"));	// not sure if users understand that
-		return;
-	}
-
-	unloadImage(false);
-	mLoader->setImage(img);
+    unloadImage(false);
+    mLoader->setImage(img);
 }
 
-bool DkViewPort::unloadImage(bool fileChange) {
+bool DkViewPort::unloadImage(bool fileChange)
+{
+    if (DkSettingsManager::param().display().animationDuration > 0
+        && (mController->getPlayer()->isPlaying() || DkUtils::getMainWindow()->isFullScreen() || DkSettingsManager::param().display().alwaysAnimate)) {
+        QRect dr = mWorldMatrix.mapRect(mImgViewRect).toRect();
+        mAnimationBuffer = mImgStorage.image(dr.size());
+        mFadeImgViewRect = mImgViewRect;
+        mFadeImgRect = mImgRect;
+        mAnimationValue = 1.0f;
+    }
 
-	if (DkSettingsManager::param().display().animationDuration > 0 && 
-			(mController->getPlayer()->isPlaying() || 
-			DkUtils::getMainWindow()->isFullScreen() || 
-			DkSettingsManager::param().display().alwaysAnimate)) {
-		
-		QRect dr = mWorldMatrix.mapRect(mImgViewRect).toRect();
-		mAnimationBuffer = mImgStorage.image(dr.size());
-		mFadeImgViewRect = mImgViewRect;
-		mFadeImgRect = mImgRect;
-		mAnimationValue = 1.0f;
-	}
+    int success = true;
 
-	int success = true;
-	
-	if (!mController->applyPluginChanges(true))		// user wants to apply changes first
-		return false;
+    if (!mController->applyPluginChanges(true)) // user wants to apply changes first
+        return false;
 
-	if (fileChange)
-		success = mLoader->unloadFile();		// returns false if the user cancels
-	
-	// notify controller
-	mController->updateImage(imageContainer());
+    if (fileChange)
+        success = mLoader->unloadFile(); // returns false if the user cancels
 
-	if (mMovie && success) {
-		mMovie->stop();
-		mMovie = QSharedPointer<QMovie>();
-	}
+    // notify controller
+    mController->updateImage(imageContainer());
 
-	if (mSvg && success)
-		mSvg = QSharedPointer<QSvgRenderer>();
-	
-	return success != 0;
-}
+    if (mMovie && success) {
+        mMovie->stop();
+        mMovie = QSharedPointer<QMovie>();
+    }
 
-void DkViewPort::deactivate() {
-	
-	setImage(QImage());
+    if (mSvg && success)
+        mSvg = QSharedPointer<QSvgRenderer>();
+
+    return success != 0;
 }
 
-void DkViewPort::loadFile(const QString& filePath) {
+void DkViewPort::deactivate()
+{
+    setImage(QImage());
+}
 
-	if (!unloadImage())
-		return;
+void DkViewPort::loadFile(const QString &filePath)
+{
+    if (!unloadImage())
+        return;
 
-	mTestLoaded = false;
+    mTestLoaded = false;
 
-	if (mLoader && !filePath.isEmpty() && QFileInfo(filePath).isDir()) {
-		mLoader->setDir(filePath);
-	} 
-	else if (mLoader)
-		mLoader->load(filePath);
+    if (mLoader && !filePath.isEmpty() && QFileInfo(filePath).isDir()) {
+        mLoader->setDir(filePath);
+    } else if (mLoader)
+        mLoader->load(filePath);
 
-	// diem: I removed this line for a) we don't support remote displays anymore and be: https://github.com/nomacs/nomacs/issues/219
-	//qDebug() << "sync mode: " << (DkSettingsManager::param().sync().syncMode == DkSettings::sync_mode_remote_display);
-	//if ((qApp->keyboardModifiers() == mAltMod || DkSettingsManager::param().sync().syncMode == DkSettings::sync_mode_remote_display) && 
-	//	(hasFocus() || mController->hasFocus()) && 
-	//	mLoader->hasFile())
-	//	tcpLoadFile(0, filePath);
+    // diem: I removed this line for a) we don't support remote displays anymore and be: https://github.com/nomacs/nomacs/issues/219
+    // qDebug() << "sync mode: " << (DkSettingsManager::param().sync().syncMode == DkSettings::sync_mode_remote_display);
+    // if ((qApp->keyboardModifiers() == mAltMod || DkSettingsManager::param().sync().syncMode == DkSettings::sync_mode_remote_display) &&
+    //	(hasFocus() || mController->hasFocus()) &&
+    //	mLoader->hasFile())
+    //	tcpLoadFile(0, filePath);
 }
 
-void DkViewPort::reloadFile() {
-
-	if (mLoader) {
-
-		if (unloadImage())
-			mLoader->reloadImage();
-	}
+void DkViewPort::reloadFile()
+{
+    if (mLoader) {
+        if (unloadImage())
+            mLoader->reloadImage();
+    }
 }
 
-void DkViewPort::loadFile(int skipIdx) {
+void DkViewPort::loadFile(int skipIdx)
+{
+    if (!unloadImage())
+        return;
 
-	if (!unloadImage())
-		return;
+    if (mLoader && !mTestLoaded)
+        mLoader->changeFile(skipIdx);
 
-	if (mLoader && !mTestLoaded)
-		mLoader->changeFile(skipIdx);
-
-	// alt mod
-	if ((qApp->keyboardModifiers() == mAltMod || DkSettingsManager::param().sync().syncActions) && (hasFocus() || mController->hasFocus())) {
-		emit sendNewFileSignal((qint16)skipIdx);
-		qDebug() << "emitting load next";
-	}
+    // alt mod
+    if ((qApp->keyboardModifiers() == mAltMod || DkSettingsManager::param().sync().syncActions) && (hasFocus() || mController->hasFocus())) {
+        emit sendNewFileSignal((qint16)skipIdx);
+        qDebug() << "emitting load next";
+    }
 }
 
-void DkViewPort::loadPrevFileFast() {
-
-	loadFileFast(-1);
+void DkViewPort::loadPrevFileFast()
+{
+    loadFileFast(-1);
 }
 
-void DkViewPort::loadNextFileFast() {
-
-	loadFileFast(1);
+void DkViewPort::loadNextFileFast()
+{
+    loadFileFast(1);
 }
 
+void DkViewPort::loadFileFast(int skipIdx)
+{
+    if (!unloadImage())
+        return;
 
-void DkViewPort::loadFileFast(int skipIdx) {
-
-	if (!unloadImage())
-		return;
-
-	mNextSwipe = skipIdx > 0;
-
-	QApplication::sendPostedEvents();
+    mNextSwipe = skipIdx > 0;
 
-	int sIdx = skipIdx;
-	QSharedPointer<DkImageContainerT> lastImg;
+    QApplication::sendPostedEvents();
 
-	for (int idx = 0; idx < mLoader->getImages().size(); idx++) {
+    int sIdx = skipIdx;
+    QSharedPointer<DkImageContainerT> lastImg;
 
-		QSharedPointer<DkImageContainerT> imgC = mLoader->getSkippedImage(sIdx);
+    for (int idx = 0; idx < mLoader->getImages().size(); idx++) {
+        QSharedPointer<DkImageContainerT> imgC = mLoader->getSkippedImage(sIdx);
 
-		if (!imgC)
-			break;
+        if (!imgC)
+            break;
 
-		mLoader->setCurrentImage(imgC);
+        mLoader->setCurrentImage(imgC);
 
-		if (imgC && imgC->getLoadState() != DkImageContainer::exists_not) {
-			mLoader->load(imgC);
-			break;
-		}
-		else if (lastImg == imgC) {
-			sIdx += skipIdx;	// get me out of endless loops (self referencing shortcuts)
-		}
-		else {
-			qDebug() << "image does not exist - skipping";
-		}
+        if (imgC && imgC->getLoadState() != DkImageContainer::exists_not) {
+            mLoader->load(imgC);
+            break;
+        } else if (lastImg == imgC) {
+            sIdx += skipIdx; // get me out of endless loops (self referencing shortcuts)
+        } else {
+            qDebug() << "image does not exist - skipping";
+        }
 
-		lastImg = imgC;
-	}
+        lastImg = imgC;
+    }
 
-	if ((qApp->keyboardModifiers() == mAltMod || DkSettingsManager::param().sync().syncActions) && (hasFocus() || mController->hasFocus())) {
-		emit sendNewFileSignal((qint16)skipIdx);
-		QCoreApplication::sendPostedEvents();
-	}
+    if ((qApp->keyboardModifiers() == mAltMod || DkSettingsManager::param().sync().syncActions) && (hasFocus() || mController->hasFocus())) {
+        emit sendNewFileSignal((qint16)skipIdx);
+        QCoreApplication::sendPostedEvents();
+    }
 }
 
-void DkViewPort::loadFirst() {
+void DkViewPort::loadFirst()
+{
+    if (!unloadImage())
+        return;
 
-	if (!unloadImage())
-		return;
+    if (mLoader && !mTestLoaded)
+        mLoader->firstFile();
 
-	if (mLoader && !mTestLoaded)
-		mLoader->firstFile();
-
-	if ((qApp->keyboardModifiers() == mAltMod || DkSettingsManager::param().sync().syncActions) && (hasFocus() || mController->hasFocus()))
-		emit sendNewFileSignal(SHRT_MIN);
+    if ((qApp->keyboardModifiers() == mAltMod || DkSettingsManager::param().sync().syncActions) && (hasFocus() || mController->hasFocus()))
+        emit sendNewFileSignal(SHRT_MIN);
 }
 
-void DkViewPort::loadLast() {
-
-	if (!unloadImage())
-		return;
+void DkViewPort::loadLast()
+{
+    if (!unloadImage())
+        return;
 
-	if (mLoader && !mTestLoaded)
-		mLoader->lastFile();
-
-	if ((qApp->keyboardModifiers() == mAltMod || DkSettingsManager::param().sync().syncActions) && (hasFocus() || mController->hasFocus()))
-		emit sendNewFileSignal(SHRT_MAX);
+    if (mLoader && !mTestLoaded)
+        mLoader->lastFile();
 
+    if ((qApp->keyboardModifiers() == mAltMod || DkSettingsManager::param().sync().syncActions) && (hasFocus() || mController->hasFocus()))
+        emit sendNewFileSignal(SHRT_MAX);
 }
 
-void DkViewPort::loadSkipPrev10() {
-
-	loadFileFast(-DkSettingsManager::param().global().skipImgs);
-	//unloadImage();
+void DkViewPort::loadSkipPrev10()
+{
+    loadFileFast(-DkSettingsManager::param().global().skipImgs);
+    // unloadImage();
 
-	//if (mLoader && !testLoaded)
-	//	mLoader->changeFile(-DkSettingsManager::param().global().skipImgs, (parent->isFullScreen() && DkSettingsManager::param().slideShow().silentFullscreen));
+    // if (mLoader && !testLoaded)
+    //	mLoader->changeFile(-DkSettingsManager::param().global().skipImgs, (parent->isFullScreen() && DkSettingsManager::param().slideShow().silentFullscreen));
 
-	if (qApp->keyboardModifiers() == mAltMod && (hasFocus() || mController->hasFocus()))
-		emit sendNewFileSignal((qint16)-DkSettingsManager::param().global().skipImgs);
+    if (qApp->keyboardModifiers() == mAltMod && (hasFocus() || mController->hasFocus()))
+        emit sendNewFileSignal((qint16)-DkSettingsManager::param().global().skipImgs);
 }
 
-void DkViewPort::loadSkipNext10() {
+void DkViewPort::loadSkipNext10()
+{
+    loadFileFast(DkSettingsManager::param().global().skipImgs);
+    // unloadImage();
 
-	loadFileFast(DkSettingsManager::param().global().skipImgs);
-	//unloadImage();
+    // if (mLoader && !testLoaded)
+    //	mLoader->changeFile(DkSettingsManager::param().global().skipImgs, (parent->isFullScreen() && DkSettingsManager::param().slideShow().silentFullscreen));
 
-	//if (mLoader && !testLoaded)
-	//	mLoader->changeFile(DkSettingsManager::param().global().skipImgs, (parent->isFullScreen() && DkSettingsManager::param().slideShow().silentFullscreen));
-
-	if (qApp->keyboardModifiers() == mAltMod && (hasFocus() || mController->hasFocus()))
-		emit sendNewFileSignal((qint16)DkSettingsManager::param().global().skipImgs);
+    if (qApp->keyboardModifiers() == mAltMod && (hasFocus() || mController->hasFocus()))
+        emit sendNewFileSignal((qint16)DkSettingsManager::param().global().skipImgs);
 }
 
-void DkViewPort::tcpLoadFile(qint16 idx, QString filename) {
-
-	qDebug() << "I got a file request??";
-
-	// some hack: set the mode to default in order to prevent loops (if both are auto connected)
-	// should be mostly harmless
-	//int oldMode = DkSettingsManager::param().sync().syncMode;
-	//DkSettingsManager::param().sync().syncMode = DkSettings::sync_mode_receiveing_command;
-
-	if (filename.isEmpty()) {
+void DkViewPort::tcpLoadFile(qint16 idx, QString filename)
+{
+    qDebug() << "I got a file request??";
 
-		// change the file idx according to my brother
-		switch (idx) {
-			case SHRT_MIN:
-				loadFirst();
-				break;
-			case SHRT_MAX:
-				loadLast();
-				break;
-			//case 1:
-			//	loadNextFileFast();
-			//	break;
-			//case -1:
-			//	loadPrevFileFast();
-			//	break;
-			default:
-				loadFileFast(idx);
-				//if (mLoader) mLoader->loadFileAt(idx);
-		}
-	}
-	else 
-		loadFile(filename);
-
-	qDebug() << "loading file: " << filename;
-
-	//DkSettingsManager::param().sync().syncMode = oldMode;
-}
-
-QSharedPointer<DkImageContainerT> DkViewPort::imageContainer() const {
-
-	if (!mLoader)
-		return QSharedPointer<DkImageContainerT>();
-
-	return mLoader->getCurrentImage();
-}
-
-void DkViewPort::setImageLoader(QSharedPointer<DkImageLoader> newLoader) {
-	
-	mLoader = newLoader;
-	connectLoader(newLoader);
-
-	if (mLoader)
-		mLoader->activate();
-}
-
-void DkViewPort::connectLoader(QSharedPointer<DkImageLoader> loader, bool connectSignals) {
-
-	assert(mController);
-
-	if (!loader)
-		return;
-
-	if (connectSignals) {
-		//connect(mLoader.data(), SIGNAL(imageLoadedSignal(QSharedPointer<DkImageContainerT>, bool)), this, SLOT(updateImage(QSharedPointer<DkImageContainerT>, bool)), Qt::UniqueConnection);
-		connect(loader.data(), SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)), this, SLOT(updateImage(QSharedPointer<DkImageContainerT>)), Qt::UniqueConnection);
-
-		connect(loader.data(), SIGNAL(updateDirSignal(QVector<QSharedPointer<DkImageContainerT> >)), mController->getFilePreview(), SLOT(updateThumbs(QVector<QSharedPointer<DkImageContainerT> >)), Qt::UniqueConnection);
-		connect(loader.data(), SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)), mController->getFilePreview(), SLOT(setFileInfo(QSharedPointer<DkImageContainerT>)), Qt::UniqueConnection);
-		connect(loader.data(), SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)), mController->getMetaDataWidget(), SLOT(updateMetaData(QSharedPointer<DkImageContainerT>)), Qt::UniqueConnection);
-		connect(loader.data(), SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)), mController, SLOT(updateImage(QSharedPointer<DkImageContainerT>)), Qt::UniqueConnection);
-
-		connect(loader.data(), SIGNAL(showInfoSignal(const QString&, int, int)), mController, SLOT(setInfo(const QString&, int, int)), Qt::UniqueConnection);
-
-		connect(loader.data(), SIGNAL(setPlayer(bool)), mController->getPlayer(), SLOT(play(bool)), Qt::UniqueConnection);
-
-		connect(loader.data(), SIGNAL(updateDirSignal(QVector<QSharedPointer<DkImageContainerT> >)), mController->getScroller(), SLOT(updateDir(QVector<QSharedPointer<DkImageContainerT> >)), Qt::UniqueConnection);
-		connect(loader.data(), SIGNAL(imageUpdatedSignal(int)), mController->getScroller(), SLOT(updateFile(int)), Qt::UniqueConnection);
-		connect(mController->getScroller(), SIGNAL(valueChanged(int)), loader.data(), SLOT(loadFileAt(int)));
-	}
-	else {
-		//connect(mLoader.data(), SIGNAL(imageLoadedSignal(QSharedPointer<DkImageContainerT>, bool)), this, SLOT(updateImage(QSharedPointer<DkImageContainerT>, bool)), Qt::UniqueConnection);
-		disconnect(loader.data(), SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)), this, SLOT(updateImage(QSharedPointer<DkImageContainerT>)));
-
-		disconnect(loader.data(), SIGNAL(updateDirSignal(QVector<QSharedPointer<DkImageContainerT> >)), mController->getFilePreview(), SLOT(updateThumbs(QVector<QSharedPointer<DkImageContainerT> >)));
-		disconnect(loader.data(), SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)), mController->getFilePreview(), SLOT(setFileInfo(QSharedPointer<DkImageContainerT>)));
-		disconnect(loader.data(), SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)), mController->getMetaDataWidget(), SLOT(updateMetaData(QSharedPointer<DkImageContainerT>)));
-		disconnect(loader.data(), SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)), mController, SLOT(setFileInfo(QSharedPointer<DkImageContainerT>)));
-
-		disconnect(loader.data(), SIGNAL(showInfoSignal(const QString&, int, int)), mController, SLOT(setInfo(const QString&, int, int)));
-		disconnect(loader.data(), SIGNAL(updateSpinnerSignalDelayed(bool, int)), mController, SLOT(setSpinnerDelayed(bool, int)));
-
-		disconnect(loader.data(), SIGNAL(setPlayer(bool)), mController->getPlayer(), SLOT(play(bool)));
-
-		disconnect(loader.data(), SIGNAL(updateDirSignal(QVector<QSharedPointer<DkImageContainerT> >)), mController->getScroller(), SLOT(updateDir(QVector<QSharedPointer<DkImageContainerT> >)));
-		disconnect(loader.data(), SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)), mController->getScroller(), SLOT(updateFile(QSharedPointer<DkImageContainerT>)));
-	}
-}
-
-DkControlWidget* DkViewPort::getController() {
-	
-	return mController;
+    // some hack: set the mode to default in order to prevent loops (if both are auto connected)
+    // should be mostly harmless
+    // int oldMode = DkSettingsManager::param().sync().syncMode;
+    // DkSettingsManager::param().sync().syncMode = DkSettings::sync_mode_receiveing_command;
+
+    if (filename.isEmpty()) {
+        // change the file idx according to my brother
+        switch (idx) {
+        case SHRT_MIN:
+            loadFirst();
+            break;
+        case SHRT_MAX:
+            loadLast();
+            break;
+        // case 1:
+        //	loadNextFileFast();
+        //	break;
+        // case -1:
+        //	loadPrevFileFast();
+        //	break;
+        default:
+            loadFileFast(idx);
+            // if (mLoader) mLoader->loadFileAt(idx);
+        }
+    } else
+        loadFile(filename);
+
+    qDebug() << "loading file: " << filename;
+
+    // DkSettingsManager::param().sync().syncMode = oldMode;
+}
+
+QSharedPointer<DkImageContainerT> DkViewPort::imageContainer() const
+{
+    if (!mLoader)
+        return QSharedPointer<DkImageContainerT>();
+
+    return mLoader->getCurrentImage();
+}
+
+void DkViewPort::setImageLoader(QSharedPointer<DkImageLoader> newLoader)
+{
+    mLoader = newLoader;
+    connectLoader(newLoader);
+
+    if (mLoader)
+        mLoader->activate();
+}
+
+void DkViewPort::connectLoader(QSharedPointer<DkImageLoader> loader, bool connectSignals)
+{
+    assert(mController);
+
+    if (!loader)
+        return;
+
+    if (connectSignals) {
+        connect(loader.data(),
+                SIGNAL(imageLoadedSignal(QSharedPointer<DkImageContainerT>, bool)),
+                this,
+                SLOT(updateImage(QSharedPointer<DkImageContainerT>, bool)),
+                Qt::UniqueConnection);
+        connect(loader.data(),
+                SIGNAL(imageLoadedSignal(QSharedPointer<DkImageContainerT>)),
+                mController->getMetaDataWidget(),
+                SLOT(updateMetaData(QSharedPointer<DkImageContainerT>)),
+                Qt::UniqueConnection);
+        connect(loader.data(),
+                SIGNAL(imageLoadedSignal(QSharedPointer<DkImageContainerT>)),
+                mController,
+                SLOT(updateImage(QSharedPointer<DkImageContainerT>)),
+                Qt::UniqueConnection);
+
+        connect(loader.data(),
+                SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)),
+                this,
+                SLOT(updateImage(QSharedPointer<DkImageContainerT>)),
+                Qt::UniqueConnection); // update image matrix
+
+        connect(loader.data(),
+                SIGNAL(updateDirSignal(QVector<QSharedPointer<DkImageContainerT>>)),
+                mController->getFilePreview(),
+                SLOT(updateThumbs(QVector<QSharedPointer<DkImageContainerT>>)),
+                Qt::UniqueConnection);
+        connect(loader.data(),
+                SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)),
+                mController->getFilePreview(),
+                SLOT(setFileInfo(QSharedPointer<DkImageContainerT>)),
+                Qt::UniqueConnection);
+
+        connect(loader.data(), SIGNAL(showInfoSignal(const QString &, int, int)), mController, SLOT(setInfo(const QString &, int, int)), Qt::UniqueConnection);
+
+        connect(loader.data(), SIGNAL(setPlayer(bool)), mController->getPlayer(), SLOT(play(bool)), Qt::UniqueConnection);
+
+        connect(loader.data(),
+                SIGNAL(updateDirSignal(QVector<QSharedPointer<DkImageContainerT>>)),
+                mController->getScroller(),
+                SLOT(updateDir(QVector<QSharedPointer<DkImageContainerT>>)),
+                Qt::UniqueConnection);
+        connect(loader.data(), SIGNAL(imageUpdatedSignal(int)), mController->getScroller(), SLOT(updateFile(int)), Qt::UniqueConnection);
+        connect(mController->getScroller(), SIGNAL(valueChanged(int)), loader.data(), SLOT(loadFileAt(int)));
+    } else {
+        disconnect(loader.data(),
+                   SIGNAL(imageLoadedSignal(QSharedPointer<DkImageContainerT>, bool)),
+                   this,
+                   SLOT(updateImage(QSharedPointer<DkImageContainerT>, bool)));
+        disconnect(loader.data(),
+                   SIGNAL(imageLoadedSignal(QSharedPointer<DkImageContainerT>)),
+                   mController->getMetaDataWidget(),
+                   SLOT(updateMetaData(QSharedPointer<DkImageContainerT>)));
+        disconnect(loader.data(),
+                   SIGNAL(imageLoadedSignal(QSharedPointer<DkImageContainerT>)),
+                   mController,
+                   SLOT(updateImage(QSharedPointer<DkImageContainerT>)));
+
+        disconnect(loader.data(), SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)), this, SLOT(updateImage(QSharedPointer<DkImageContainerT>)));
+
+        disconnect(loader.data(),
+                   SIGNAL(updateDirSignal(QVector<QSharedPointer<DkImageContainerT>>)),
+                   mController->getFilePreview(),
+                   SLOT(updateThumbs(QVector<QSharedPointer<DkImageContainerT>>)));
+        disconnect(loader.data(),
+                   SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)),
+                   mController->getFilePreview(),
+                   SLOT(setFileInfo(QSharedPointer<DkImageContainerT>)));
+        disconnect(loader.data(),
+                   SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)),
+                   mController->getMetaDataWidget(),
+                   SLOT(updateMetaData(QSharedPointer<DkImageContainerT>)));
+        disconnect(loader.data(),
+                   SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)),
+                   mController,
+                   SLOT(setFileInfo(QSharedPointer<DkImageContainerT>)));
+
+        disconnect(loader.data(), SIGNAL(showInfoSignal(const QString &, int, int)), mController, SLOT(setInfo(const QString &, int, int)));
+        disconnect(loader.data(), SIGNAL(updateSpinnerSignalDelayed(bool, int)), mController, SLOT(setSpinnerDelayed(bool, int)));
+
+        disconnect(loader.data(), SIGNAL(setPlayer(bool)), mController->getPlayer(), SLOT(play(bool)));
+
+        disconnect(loader.data(),
+                   SIGNAL(updateDirSignal(QVector<QSharedPointer<DkImageContainerT>>)),
+                   mController->getScroller(),
+                   SLOT(updateDir(QVector<QSharedPointer<DkImageContainerT>>)));
+        disconnect(loader.data(),
+                   SIGNAL(imageUpdatedSignal(QSharedPointer<DkImageContainerT>)),
+                   mController->getScroller(),
+                   SLOT(updateFile(QSharedPointer<DkImageContainerT>)));
+    }
+}
+
+DkControlWidget *DkViewPort::getController()
+{
+    return mController;
+}
+
+void DkViewPort::cropImage(const DkRotatingRect &rect, const QColor &bgCol, bool cropToMetaData)
+{
+    QSharedPointer<DkImageContainerT> imgC = mLoader->getCurrentImage();
+
+    if (!imgC) {
+        qWarning() << "cannot crop NULL image...";
+        return;
+    }
+
+    imgC->cropImage(rect, bgCol, cropToMetaData);
+    setEditedImage(imgC);
 }
 
 // DkViewPortFrameless --------------------------------------------------------------------
-DkViewPortFrameless::DkViewPortFrameless(QWidget *parent) : DkViewPort(parent) {
-	
+DkViewPortFrameless::DkViewPortFrameless(QWidget *parent)
+    : DkViewPort(parent)
+{
 #ifdef Q_OS_MAC
-	parent->setAttribute(Qt::WA_MacNoShadow);
+    parent->setAttribute(Qt::WA_MacNoShadow);
 #endif
 
-	setAttribute(Qt::WA_TranslucentBackground, true);
-	mImgBg.load(QFileInfo(QApplication::applicationDirPath(), "bgf.png").absoluteFilePath());
-	
-	if (mImgBg.isNull())
-		mImgBg.load(":/nomacs/img/splash-screen.png");
+    setAttribute(Qt::WA_TranslucentBackground, true);
+    mImgBg.load(QFileInfo(QApplication::applicationDirPath(), "bgf.png").absoluteFilePath());
 
-	DkActionManager& am = DkActionManager::instance();
-	mStartActions.append(am.action(DkActionManager::menu_file_open));
-	mStartActions.append(am.action(DkActionManager::menu_file_open_dir));
-	
-	mStartIcons.append(am.icon(DkActionManager::icon_file_open_large));
-	mStartIcons.append(am.icon(DkActionManager::icon_file_dir_large));
-}
+    if (mImgBg.isNull())
+        mImgBg.load(":/nomacs/img/splash-screen.png");
+
+    DkActionManager &am = DkActionManager::instance();
+    mStartActions.append(am.action(DkActionManager::menu_file_open));
+    mStartActions.append(am.action(DkActionManager::menu_file_open_dir));
 
-DkViewPortFrameless::~DkViewPortFrameless() {
+    mStartIcons.append(am.icon(DkActionManager::icon_file_open_large));
+    mStartIcons.append(am.icon(DkActionManager::icon_file_dir_large));
 }
 
-void DkViewPortFrameless::zoom(double factor, const QPointF& center, bool force) {
+DkViewPortFrameless::~DkViewPortFrameless()
+{
+}
 
-	if (mImgStorage.isEmpty() || mBlockZooming)
-		return;
+void DkViewPortFrameless::zoom(double factor, const QPointF &center, bool force)
+{
+    if (mImgStorage.isEmpty() || mBlockZooming)
+        return;
 
-	//limit zoom out ---
-	if (mWorldMatrix.m11()*factor <= mMinZoom && factor < 1)
-		return;
+    // limit zoom out ---
+    if (mWorldMatrix.m11() * factor <= mMinZoom && factor < 1)
+        return;
 
-	// reset view & block if we pass the 'image fit to screen' on zoom out
-	if (mWorldMatrix.m11() > 1 && mWorldMatrix.m11()*factor < 1 && !force) {
+    // reset view & block if we pass the 'image fit to screen' on zoom out
+    if (mWorldMatrix.m11() > 1 && mWorldMatrix.m11() * factor < 1 && !force) {
+        mBlockZooming = true;
+        mZoomTimer->start(500);
+    }
 
-		mBlockZooming = true;
-		mZoomTimer->start(500);
-	}
+    // limit zoom in ---
+    if (mWorldMatrix.m11() * mImgMatrix.m11() > mMaxZoom && factor > 1)
+        return;
 
-	//limit zoom in ---
-	if (mWorldMatrix.m11()*mImgMatrix.m11() > mMaxZoom && factor > 1)
-		return;
+    QRectF viewRect = mWorldMatrix.mapRect(mImgViewRect);
+    QPointF pos = center;
 
-	QRectF viewRect = mWorldMatrix.mapRect(mImgViewRect);
-	QPointF pos = center;
+    // if no center assigned: zoom in at the image center
+    if (pos.x() == -1 || pos.y() == -1)
+        pos = viewRect.center();
 
-	// if no center assigned: zoom in at the image center
-	if (pos.x() == -1 || pos.y() == -1)
-		pos = viewRect.center();
-	
-	if (pos.x() < viewRect.left())			pos.setX(viewRect.left());
-	else if (pos.x() > viewRect.right())	pos.setX(viewRect.right());
-	if (pos.y() < viewRect.top())			pos.setY(viewRect.top());
-	else if (pos.y() > viewRect.bottom())	pos.setY(viewRect.bottom());
+    if (pos.x() < viewRect.left())
+        pos.setX(viewRect.left());
+    else if (pos.x() > viewRect.right())
+        pos.setX(viewRect.right());
+    if (pos.y() < viewRect.top())
+        pos.setY(viewRect.top());
+    else if (pos.y() > viewRect.bottom())
+        pos.setY(viewRect.bottom());
 
-	zoomToPoint(factor, pos, mWorldMatrix);
+    zoomToPoint(factor, pos, mWorldMatrix);
 
-	controlImagePosition();
-	showZoom();
-	changeCursor();
+    controlImagePosition();
+    showZoom();
+    changeCursor();
 
-	update();
+    update();
 
-	tcpSynchronize();
-	emit zoomSignal(mWorldMatrix.m11()*mImgMatrix.m11()*100);
+    tcpSynchronize();
+    emit zoomSignal(mWorldMatrix.m11() * mImgMatrix.m11() * 100);
 }
 
-void DkViewPortFrameless::resetView() {
-
-	// maybe we can delete this function...
-	DkViewPort::resetView();
+void DkViewPortFrameless::resetView()
+{
+    // maybe we can delete this function...
+    DkViewPort::resetView();
 }
 
-void DkViewPortFrameless::paintEvent(QPaintEvent* event) {
+void DkViewPortFrameless::paintEvent(QPaintEvent *event)
+{
+    if (!DkUtils::getMainWindow()->isFullScreen()) {
+        QPainter painter(viewport());
+        painter.setWorldTransform(mWorldMatrix);
+        drawFrame(painter);
+        painter.end();
+    }
 
-	if (!DkUtils::getMainWindow()->isFullScreen()) {
-
-		QPainter painter(viewport());
-		painter.setWorldTransform(mWorldMatrix);
-		drawFrame(painter);
-		painter.end();
-	}
-
-	DkViewPort::paintEvent(event);
+    DkViewPort::paintEvent(event);
 }
 
-void DkViewPortFrameless::draw(QPainter & painter, double) {
-	
-	if (DkUtils::getMainWindow()->isFullScreen()) {
-		QColor col = QColor(0,0,0);
-		col.setAlpha(150);
-		painter.setWorldMatrixEnabled(false);
-		painter.fillRect(QRect(QPoint(), size()), col);
-		painter.setWorldMatrixEnabled(true);
-	}
-
-	if (mSvg && mSvg->isValid()) {
-		mSvg->render(&painter, mImgViewRect);
-	}
-	else if (mMovie && mMovie->isValid()) {
-		painter.drawPixmap(mImgViewRect, mMovie->currentPixmap(), mMovie->frameRect());
-	}
-	else {
-
-		QRect displayRect = mWorldMatrix.mapRect(mImgViewRect).toRect();
-		QImage img = mImgStorage.image(displayRect.size());
+void DkViewPortFrameless::draw(QPainter &painter, double)
+{
+    if (DkUtils::getMainWindow()->isFullScreen()) {
+        QColor col = QColor(0, 0, 0);
+        col.setAlpha(150);
+        painter.setWorldMatrixEnabled(false);
+        painter.fillRect(QRect(QPoint(), size()), col);
+        painter.setWorldMatrixEnabled(true);
+    }
 
-		// opacity == 1.0f -> do not show pattern if we crossfade two images
-		if (DkSettingsManager::param().display().tpPattern && img.hasAlphaChannel())
-			drawPattern(painter);
+    if (mSvg && mSvg->isValid()) {
+        mSvg->render(&painter, mImgViewRect);
+    } else if (mMovie && mMovie->isValid()) {
+        painter.drawPixmap(mImgViewRect, mMovie->currentPixmap(), mMovie->frameRect());
+    } else {
+        QRect displayRect = mWorldMatrix.mapRect(mImgViewRect).toRect();
+        QImage img = mImgStorage.image(displayRect.size());
 
-		painter.drawImage(mImgViewRect, img, QRect(QPoint(), img.size()));
-	}
+        // opacity == 1.0f -> do not show pattern if we crossfade two images
+        if (DkSettingsManager::param().display().tpPattern && img.hasAlphaChannel())
+            drawPattern(painter);
 
+        painter.drawImage(mImgViewRect, img, QRect(QPoint(), img.size()));
+    }
 }
 
-void DkViewPortFrameless::drawBackground(QPainter & painter) {
-	
-	painter.setWorldTransform(mImgMatrix);
-	painter.setBrush(QColor(127, 144, 144, 200));
-	painter.setPen(QColor(100, 100, 100, 255));
+void DkViewPortFrameless::drawBackground(QPainter &painter)
+{
+    painter.setWorldTransform(mImgMatrix);
+    painter.setBrush(QColor(127, 144, 144, 200));
+    painter.setPen(QColor(100, 100, 100, 255));
+
+    QRectF initialRect = rect();
+    QPointF oldCenter = initialRect.center();
+
+    QTransform cT;
+    cT.scale(400 / initialRect.width(), 400 / initialRect.width());
+    initialRect = cT.mapRect(initialRect);
+    initialRect.moveCenter(oldCenter);
+
+    // fit to mViewport
+    QSize s = mImgBg.size();
+
+    QRectF bgRect(QPoint(), s);
+    bgRect.moveCenter(initialRect.center()); // moveTopLeft(QPointF(size().width(), size().height())*0.5 - initialRect.bottomRight()*0.5);
+
+    // painter.drawRect(initialRect);
+    painter.drawImage(bgRect, mImgBg, QRect(QPoint(), mImgBg.size()));
+
+    if (mStartActions.isEmpty())
+        return;
+
+    // first time?
+    if (mStartActionsRects.isEmpty()) {
+        float margin = 40;
+        float iconSizeMargin = (float)((initialRect.width() - 3 * margin) / mStartActions.size());
+        QSize iconSize = QSize(qRound(iconSizeMargin - margin), qRound(iconSizeMargin - margin));
+        QPointF offset = QPointF(bgRect.left() + 50, initialRect.center().y() + iconSizeMargin * 0.25f);
+
+        for (int idx = 0; idx < mStartActions.size(); idx++) {
+            QRectF iconRect = QRectF(offset, iconSize);
+            QPixmap ci = !mStartIcons[idx].isNull() ? mStartIcons[idx].pixmap(iconSize) : mStartActions[idx]->icon().pixmap(iconSize);
+            mStartActionsRects.push_back(iconRect);
+            mStartActionsIcons.push_back(ci);
+
+            offset.setX(offset.x() + margin + iconSize.width());
+        }
+    }
 
-	QRectF initialRect = rect();
-	QPointF oldCenter = initialRect.center();
-
-	QTransform cT;
-	cT.scale(400/initialRect.width(), 400/initialRect.width());
-	initialRect = cT.mapRect(initialRect);
-	initialRect.moveCenter(oldCenter);
-
-	// fit to mViewport
-	QSize s = mImgBg.size();
-
-	QRectF bgRect(QPoint(), s);
-	bgRect.moveCenter(initialRect.center());//moveTopLeft(QPointF(size().width(), size().height())*0.5 - initialRect.bottomRight()*0.5);
-
-	//painter.drawRect(initialRect);
-	painter.drawImage(bgRect, mImgBg, QRect(QPoint(), mImgBg.size()));
-
-	if (mStartActions.isEmpty())
-		return;
-
-	// first time?
-	if (mStartActionsRects.isEmpty()) {
-		float margin = 40;
-		float iconSizeMargin = (float)((initialRect.width()-3*margin)/mStartActions.size());
-		QSize iconSize = QSize(qRound(iconSizeMargin - margin), qRound(iconSizeMargin - margin));
-		QPointF offset = QPointF(bgRect.left() + 50, initialRect.center().y()+iconSizeMargin*0.25f);
-
-		for (int idx = 0; idx < mStartActions.size(); idx++) {
-
-			QRectF iconRect = QRectF(offset, iconSize);
-			QPixmap ci = !mStartIcons[idx].isNull() ? mStartIcons[idx].pixmap(iconSize) : mStartActions[idx]->icon().pixmap(iconSize);
-			mStartActionsRects.push_back(iconRect);
-			mStartActionsIcons.push_back(ci);
-
-			offset.setX(offset.x() + margin + iconSize.width());
-		}
-	}
+    // draw start actions
+    for (int idx = 0; idx < mStartActions.size(); idx++) {
+        if (!mStartIcons[idx].isNull())
+            painter.drawPixmap(mStartActionsRects[idx], mStartActionsIcons[idx], QRect(QPoint(), mStartActionsIcons[idx].size()));
+        else
+            painter.drawPixmap(mStartActionsRects[idx], mStartActionsIcons[idx], QRect(QPoint(), mStartActionsIcons[idx].size()));
 
-	// draw start actions
-	for (int idx = 0; idx < mStartActions.size(); idx++) {
-		
-		if (!mStartIcons[idx].isNull())
-			painter.drawPixmap(mStartActionsRects[idx], mStartActionsIcons[idx], QRect(QPoint(), mStartActionsIcons[idx].size()));
-		else
-			painter.drawPixmap(mStartActionsRects[idx], mStartActionsIcons[idx], QRect(QPoint(), mStartActionsIcons[idx].size()));
-		
-		QRectF tmpRect = mStartActionsRects[idx];
-		QString text = mStartActions[idx]->text().remove("&");
-		tmpRect.moveTop(tmpRect.bottom()+10);
-		painter.drawText(tmpRect, text);
-	}
+        QRectF tmpRect = mStartActionsRects[idx];
+        QString text = mStartActions[idx]->text().remove("&");
+        tmpRect.moveTop(tmpRect.bottom() + 10);
+        painter.drawText(tmpRect, text);
+    }
 
-	QString infoText = tr("Press F10 to exit Frameless view");
-	QRectF tmpRect(bgRect.left()+50, bgRect.bottom()-60, bgRect.width()-100, 20);
-	painter.drawText(tmpRect, infoText);
+    QString infoText = tr("Press F10 to exit Frameless view");
+    QRectF tmpRect(bgRect.left() + 50, bgRect.bottom() - 60, bgRect.width() - 100, 20);
+    painter.drawText(tmpRect, infoText);
 }
 
-void DkViewPortFrameless::drawFrame(QPainter & painter) {
-
-	// TODO: replace hasAlphaChannel with has alphaBorder
-	if ((!mImgStorage.isEmpty() && mImgStorage.image().hasAlphaChannel()) || !DkSettingsManager::param().display().showBorder)	// braces
-		return;
+void DkViewPortFrameless::drawFrame(QPainter &painter)
+{
+    // TODO: replace hasAlphaChannel with has alphaBorder
+    if ((!mImgStorage.isEmpty() && mImgStorage.image().hasAlphaChannel()) || !DkSettingsManager::param().display().showBorder) // braces
+        return;
 
-	painter.setBrush(QColor(255, 255, 255, 200));
-	painter.setPen(QColor(100, 100, 100, 255));
+    painter.setBrush(QColor(255, 255, 255, 200));
+    painter.setPen(QColor(100, 100, 100, 255));
 
-	QRectF frameRect;
+    QRectF frameRect;
 
-	float fs = qMin((float)mImgViewRect.width(), (float)mImgViewRect.height())*0.1f;
+    float fs = qMin((float)mImgViewRect.width(), (float)mImgViewRect.height()) * 0.1f;
 
-	// looks pretty bad if the frame is too small
-	if (fs < 4)
-		return;
+    // looks pretty bad if the frame is too small
+    if (fs < 4)
+        return;
 
-	frameRect = mImgViewRect;
-	frameRect.setSize(frameRect.size() + QSize(qRound(fs), qRound(fs)));
-	frameRect.moveCenter(mImgViewRect.center());
+    frameRect = mImgViewRect;
+    frameRect.setSize(frameRect.size() + QSize(qRound(fs), qRound(fs)));
+    frameRect.moveCenter(mImgViewRect.center());
 
-	painter.drawRect(frameRect);
+    painter.drawRect(frameRect);
 }
 
-void DkViewPortFrameless::mousePressEvent(QMouseEvent *event) {
-	
-	// move the window - todo: NOT full screen, window inside...
-	setCursor(Qt::ClosedHandCursor);
-	mPosGrab = event->pos();
+void DkViewPortFrameless::mousePressEvent(QMouseEvent *event)
+{
+    // move the window - todo: NOT full screen, window inside...
+    setCursor(Qt::ClosedHandCursor);
+    mPosGrab = event->pos();
 
-	DkViewPort::mousePressEvent(event);
+    DkViewPort::mousePressEvent(event);
 }
 
-void DkViewPortFrameless::mouseReleaseEvent(QMouseEvent *event) {
-	
-	if (mImgStorage.isEmpty()) {
-
-		QPointF pos = mImgMatrix.inverted().map(event->pos());
-
-		for (int idx = 0; idx < mStartActionsRects.size(); idx++) {
+void DkViewPortFrameless::mouseReleaseEvent(QMouseEvent *event)
+{
+    if (mImgStorage.isEmpty()) {
+        QPointF pos = mImgMatrix.inverted().map(event->pos());
 
-			if (mStartActionsRects[idx].contains(pos)) {
-				
-				mStartActions[idx]->trigger();
-				break;
-			}
-		}
-	}
+        for (int idx = 0; idx < mStartActionsRects.size(); idx++) {
+            if (mStartActionsRects[idx].contains(pos)) {
+                mStartActions[idx]->trigger();
+                break;
+            }
+        }
+    }
 
-	unsetCursor();
-	//setCursor(Qt::OpenHandCursor);
-	DkViewPort::mouseReleaseEvent(event);
+    unsetCursor();
+    // setCursor(Qt::OpenHandCursor);
+    DkViewPort::mouseReleaseEvent(event);
 }
 
+void DkViewPortFrameless::mouseMoveEvent(QMouseEvent *event)
+{
+    if (mImgStorage.isEmpty()) {
+        QPointF pos = mImgMatrix.inverted().map(event->pos());
 
-void DkViewPortFrameless::mouseMoveEvent(QMouseEvent *event) {
-	
-	if (mImgStorage.isEmpty()) {
-
-		QPointF pos = mImgMatrix.inverted().map(event->pos());
-
-		int idx;
-		for (idx = 0; idx < mStartActionsRects.size(); idx++) {
-
-			if (mStartActionsRects[idx].contains(pos)) {
-				setCursor(Qt::PointingHandCursor);
-				break;
-			}
-		}
-
-		//// TODO: change if closed hand cursor is present...
-		//if (idx == startActionsRects.size())
-		//	setCursor(Qt::OpenHandCursor);
-	}
+        int idx;
+        for (idx = 0; idx < mStartActionsRects.size(); idx++) {
+            if (mStartActionsRects[idx].contains(pos)) {
+                setCursor(Qt::PointingHandCursor);
+                break;
+            }
+        }
 
-	if (DkStatusBarManager::instance().statusbar()->isVisible())
-		getPixelInfo(event->pos());
+        //// TODO: change if closed hand cursor is present...
+        // if (idx == startActionsRects.size())
+        //	setCursor(Qt::OpenHandCursor);
+    }
 
-	if (event->buttons() == Qt::LeftButton) {
+    if (DkStatusBarManager::instance().statusbar()->isVisible())
+        getPixelInfo(event->pos());
 
-		QPointF cPos = event->pos();
-		QPointF dxy = (cPos - mPosGrab);
-		mPosGrab = cPos;
-		moveView(dxy/mWorldMatrix.m11());
-	}
+    if (event->buttons() == Qt::LeftButton) {
+        QPointF cPos = event->pos();
+        QPointF dxy = (cPos - mPosGrab);
+        mPosGrab = cPos;
+        moveView(dxy / mWorldMatrix.m11());
+    }
 
-	QGraphicsView::mouseMoveEvent(event);
+    QGraphicsView::mouseMoveEvent(event);
 }
 
-void DkViewPortFrameless::moveView(QPointF delta) {
+void DkViewPortFrameless::moveView(QPointF delta)
+{
+    // if no zoom is present -> the translation is like a move window
+    if (mWorldMatrix.m11() == 1.0f) {
+        float s = (float)mImgMatrix.m11();
+        mImgMatrix.translate(delta.x() / s, delta.y() / s);
+        mImgViewRect = mImgMatrix.mapRect(mImgRect);
+    } else
+        mWorldMatrix.translate(delta.x(), delta.y());
 
-	// if no zoom is present -> the translation is like a move window
-	if (mWorldMatrix.m11() == 1.0f) {
-		float s = (float)mImgMatrix.m11();
-		mImgMatrix.translate(delta.x()/s, delta.y()/s);
-		mImgViewRect = mImgMatrix.mapRect(mImgRect);
-	}
-	else
-		mWorldMatrix.translate(delta.x(), delta.y());
-
-	controlImagePosition();
-	update();
+    controlImagePosition();
+    update();
 }
 
-
-void DkViewPortFrameless::controlImagePosition(const QRect&) {
-	// dummy method
+void DkViewPortFrameless::controlImagePosition(float, float)
+{
+    // dummy method
 }
 
-void DkViewPortFrameless::centerImage() {
+void DkViewPortFrameless::centerImage()
+{
 }
 
-void DkViewPortFrameless::updateImageMatrix() {
-
-	if (mImgStorage.isEmpty())
-		return;
-
-	QRectF oldImgRect = mImgViewRect;
-	QTransform oldImgMatrix = mImgMatrix;
+void DkViewPortFrameless::updateImageMatrix()
+{
+    if (mImgStorage.isEmpty())
+        return;
 
-	mImgMatrix.reset();
+    QRectF oldImgRect = mImgViewRect;
+    QTransform oldImgMatrix = mImgMatrix;
 
-	QSize imgSize = getImageSize();
+    mImgMatrix.reset();
 
-	// if the image is smaller or zoom is active: paint the image as is
-	if (!mViewportRect.contains(mImgRect.toRect())) {
-		mImgMatrix = getScaledImageMatrix(size()*0.9f);
-		QSize shift = size()*0.1f;
-		mImgMatrix.translate(shift.width(), shift.height());
-	}
-	else {
-		mImgMatrix.translate((float)(getMainGeometry().width()-imgSize.width())*0.5f, (float)(getMainGeometry().height()-imgSize.height())*0.5f);
-		mImgMatrix.scale(1.0f, 1.0f);
-	}
+    QSize imgSize = getImageSize();
 
-	mImgViewRect = mImgMatrix.mapRect(mImgRect);
+    // if the image is smaller or zoom is active: paint the image as is
+    if (!mViewportRect.contains(mImgRect.toRect())) {
+        mImgMatrix = getScaledImageMatrix(size() * 0.9f);
+        QSize shift = size() * 0.1f;
+        mImgMatrix.translate(shift.width(), shift.height());
+    } else {
+        mImgMatrix.translate((float)(getMainGeometry().width() - imgSize.width()) * 0.5f, (float)(getMainGeometry().height() - imgSize.height()) * 0.5f);
+        mImgMatrix.scale(1.0f, 1.0f);
+    }
 
-	// update world matrix
-	if (mWorldMatrix.m11() != 1) {
+    mImgViewRect = mImgMatrix.mapRect(mImgRect);
 
-		double scaleFactor = oldImgMatrix.m11()/mImgMatrix.m11();
-		double dx = oldImgRect.x()/scaleFactor-mImgViewRect.x();
-		double dy = oldImgRect.y()/scaleFactor-mImgViewRect.y();
+    // update world matrix
+    if (mWorldMatrix.m11() != 1) {
+        float scaleFactor = (float)(oldImgMatrix.m11() / mImgMatrix.m11());
+        double dx = oldImgRect.x() / scaleFactor - mImgViewRect.x();
+        double dy = oldImgRect.y() / scaleFactor - mImgViewRect.y();
 
-		mWorldMatrix.scale(scaleFactor, scaleFactor);
-		mWorldMatrix.translate(dx, dy);
-	}
+        mWorldMatrix.scale(scaleFactor, scaleFactor);
+        mWorldMatrix.translate(dx, dy);
+    }
 }
 
 // DkViewPortContrast --------------------------------------------------------------------
-DkViewPortContrast::DkViewPortContrast(QWidget *parent) : DkViewPort(parent) {
-
-	mColorTable = QVector<QRgb>(256);
-	for (int i = 0; i < mColorTable.size(); i++) 
-		mColorTable[i] = qRgb(i, i, i);
-
-	// connect
-	auto ttb = DkToolBarManager::inst().transferToolBar();
-	connect(ttb, SIGNAL(colorTableChanged(QGradientStops)), this, SLOT(changeColorTable(QGradientStops)));
-	connect(ttb, SIGNAL(channelChanged(int)),				this, SLOT(changeChannel(int)));
-	connect(ttb, SIGNAL(pickColorRequest(bool)),			this, SLOT(pickColor(bool)));
-	connect(ttb, SIGNAL(tFEnabled(bool)),					this, SLOT(enableTF(bool)));
-	connect(this, SIGNAL(tFSliderAdded(qreal)),				ttb, SLOT(insertSlider(qreal)));
-	connect(this, SIGNAL(imageModeSet(int)),				ttb, SLOT(setImageMode(int)));
-}
-
-DkViewPortContrast::~DkViewPortContrast() {
-}
-
-void DkViewPortContrast::changeChannel(int channel) {
-
-	if (channel < 0 || channel >= mImgs.size())
-		return;
-
-	if (!mImgStorage.isEmpty()) {
-
-		mFalseColorImg = mImgs[channel];
-		mFalseColorImg.setColorTable(mColorTable);
-		mDrawFalseColorImg = true;
-
-		update();
-
-		drawImageHistogram();
-	}
-}
-
-void DkViewPortContrast::changeColorTable(QGradientStops stops) {
-	
-	qreal fac;
+DkViewPortContrast::DkViewPortContrast(QWidget *parent)
+    : DkViewPort(parent)
+{
+    mColorTable = QVector<QRgb>(256);
+    for (int i = 0; i < mColorTable.size(); i++)
+        mColorTable[i] = qRgb(i, i, i);
+
+    // connect
+    auto ttb = DkToolBarManager::inst().transferToolBar();
+    connect(ttb, SIGNAL(colorTableChanged(QGradientStops)), this, SLOT(changeColorTable(QGradientStops)));
+    connect(ttb, SIGNAL(channelChanged(int)), this, SLOT(changeChannel(int)));
+    connect(ttb, SIGNAL(pickColorRequest(bool)), this, SLOT(pickColor(bool)));
+    connect(ttb, SIGNAL(tFEnabled(bool)), this, SLOT(enableTF(bool)));
+    connect(this, SIGNAL(tFSliderAdded(qreal)), ttb, SLOT(insertSlider(qreal)));
+    connect(this, SIGNAL(imageModeSet(int)), ttb, SLOT(setImageMode(int)));
+}
+
+DkViewPortContrast::~DkViewPortContrast()
+{
+}
+
+void DkViewPortContrast::changeChannel(int channel)
+{
+    if (channel < 0 || channel >= mImgs.size())
+        return;
+
+    if (!mImgStorage.isEmpty()) {
+        mFalseColorImg = mImgs[channel];
+        mFalseColorImg.setColorTable(mColorTable);
+        mDrawFalseColorImg = true;
+
+        update();
+
+        drawImageHistogram();
+    }
+}
+
+void DkViewPortContrast::changeColorTable(QGradientStops stops)
+{
+    qreal fac;
+
+    qreal actPos, leftStop, rightStop;
+    QColor tmp;
+
+    int rLeft, gLeft, bLeft, rRight, gRight, bRight;
+    int rAct, gAct, bAct;
+
+    // At least one stop has to be set:
+    tmp = stops.at(0).second;
+    tmp.getRgb(&rLeft, &gLeft, &bLeft);
+    leftStop = stops.at(0).first;
+
+    // If just one stop is set, we can speed things up:
+    if (stops.size() == 1) {
+        for (int i = 0; i < mColorTable.size(); i++)
+            mColorTable[i] = qRgb(rLeft, gLeft, bLeft);
+    }
+    // Otherwise interpolate:
+    else {
+        int rightStopIdx = 1;
+        tmp = stops.at(rightStopIdx).second;
+        tmp.getRgb(&rRight, &gRight, &bRight);
+        rightStop = stops.at(rightStopIdx).first;
+
+        for (int i = 0; i < mColorTable.size(); i++) {
+            actPos = (qreal)i / mColorTable.size();
+
+            if (actPos > rightStop) {
+                leftStop = rightStop;
+
+                rLeft = rRight;
+                gLeft = gRight;
+                bLeft = bRight;
+
+                if (stops.size() > rightStopIdx + 1) {
+                    rightStopIdx++;
+                    rightStop = stops.at(rightStopIdx).first;
+                    tmp = stops.at(rightStopIdx).second;
+                    tmp.getRgb(&rRight, &gRight, &bRight);
+                }
+            }
+
+            if (actPos <= leftStop)
+                mColorTable[i] = qRgb(rLeft, gLeft, bLeft);
+            else if (actPos >= rightStop)
+                mColorTable[i] = qRgb(rRight, gRight, bRight);
+            else {
+                fac = (actPos - leftStop) / (rightStop - leftStop);
+                rAct = qRound(rLeft + (rRight - rLeft) * fac);
+                gAct = qRound(gLeft + (gRight - gLeft) * fac);
+                bAct = qRound(bLeft + (bRight - bLeft) * fac);
+                mColorTable[i] = qRgb(rAct, gAct, bAct);
+            }
+        }
+    }
+
+    mFalseColorImg.setColorTable(mColorTable);
+
+    update();
+}
+
+void DkViewPortContrast::draw(QPainter &painter, double opacity)
+{
+    if (!mDrawFalseColorImg || mSvg || mMovie) {
+        DkBaseViewPort::draw(painter, opacity);
+        return;
+    }
+
+    if (DkUtils::getMainWindow()->isFullScreen())
+        painter.setBackground(DkSettingsManager::param().slideShow().backgroundColor);
+
+    QRect dr = mWorldMatrix.mapRect(mImgViewRect).toRect();
+    QImage img = mImgStorage.image(dr.size());
 
-	qreal actPos, leftStop, rightStop;
-	QColor tmp;
-
-	int rLeft, gLeft, bLeft, rRight, gRight, bRight;
-	int rAct, gAct, bAct;
-
-	// At least one stop has to be set:
-	tmp = stops.at(0).second;
-	tmp.getRgb(&rLeft, &gLeft, &bLeft);
-	leftStop = stops.at(0).first;
-
-	// If just one stop is set, we can speed things up:
-	if (stops.size() == 1) {
-		for (int i = 0; i < mColorTable.size(); i++)
-			mColorTable[i] = qRgb(rLeft, gLeft, bLeft);
-	}
-	// Otherwise interpolate:
-	else {
-
-		int rightStopIdx = 1;
-		tmp = stops.at(rightStopIdx).second;
-		tmp.getRgb(&rRight, &gRight, &bRight);
-		rightStop = stops.at(rightStopIdx).first;
-	
-		for (int i = 0; i < mColorTable.size(); i++) {
-			actPos = (qreal) i / mColorTable.size();
-
-			if (actPos > rightStop) {
-				leftStop = rightStop;	
-
-				rLeft = rRight;
-				gLeft = gRight;
-				bLeft = bRight;
-
-				if (stops.size() > rightStopIdx + 1) {
-					rightStopIdx++;
-					rightStop = stops.at(rightStopIdx).first;
-					tmp = stops.at(rightStopIdx).second;
-					tmp.getRgb(&rRight, &gRight, &bRight);
-				}
-
-			}
-		
-			if (actPos <= leftStop)
-				mColorTable[i] = qRgb(rLeft, gLeft, bLeft);
-			else if (actPos >= rightStop)
-				mColorTable[i] = qRgb(rRight, gRight, bRight);
-			else {
-				fac = (actPos - leftStop) / (rightStop - leftStop);
-				rAct = qRound(rLeft + (rRight - rLeft) * fac);
-				gAct = qRound(gLeft + (gRight - gLeft) * fac);
-				bAct = qRound(bLeft + (bRight - bLeft) * fac);
-				mColorTable[i] = qRgb(rAct, gAct, bAct);
-			}	
-		}
-	}
-
-
-	mFalseColorImg.setColorTable(mColorTable);
-	
-	update();
-	
-}
-
-void DkViewPortContrast::draw(QPainter & painter, double opacity) {
-
-	if (!mDrawFalseColorImg || mSvg || mMovie) {
-		DkBaseViewPort::draw(painter, opacity);
-		return;
-	}
-
-	if (DkUtils::getMainWindow()->isFullScreen())
-		painter.setBackground(DkSettingsManager::param().slideShow().backgroundColor);
-
-	QRect dr = mWorldMatrix.mapRect(mImgViewRect).toRect();
-	QImage img = mImgStorage.image(dr.size());
-
-	// opacity == 1.0f -> do not show pattern if we crossfade two images
-	if (DkSettingsManager::param().display().tpPattern && img.hasAlphaChannel() && opacity == 1.0)
-		drawPattern(painter);
-
-	if (mDrawFalseColorImg)
-		painter.drawImage(mImgViewRect, mFalseColorImg, mImgRect);
-}
-
-void DkViewPortContrast::setImage(QImage newImg) {
-
-	DkViewPort::setImage(newImg);
-	
-	if (newImg.isNull())
-		return;
-
-	if (mImgStorage.image().format() == QImage::Format_Indexed8) {
-		mImgs = QVector<QImage>(1);
-		mImgs[0] = mImgStorage.image();
-		mActiveChannel = 0;
-	}
+    // opacity == 1.0f -> do not show pattern if we crossfade two images
+    if (DkSettingsManager::param().display().tpPattern && img.hasAlphaChannel() && opacity == 1.0)
+        drawPattern(painter);
+
+    if (mDrawFalseColorImg)
+        painter.drawImage(mImgViewRect, mFalseColorImg, mImgRect);
+}
+
+void DkViewPortContrast::setImage(QImage newImg)
+{
+    DkViewPort::setImage(newImg);
+
+    if (newImg.isNull())
+        return;
+
+    if (mImgStorage.image().format() == QImage::Format_Indexed8) {
+        mImgs = QVector<QImage>(1);
+        mImgs[0] = mImgStorage.image();
+        mActiveChannel = 0;
+    }
 #ifdef WITH_OPENCV
 
-	else {	
-					
-			mImgs = QVector<QImage>(4);
-			std::vector<cv::Mat> planes;
-			
-			cv::Mat imgUC3 = DkImage::qImage2Mat(mImgStorage.image());
-			//int format = imgQt.format();
-			//if (format == QImage::Format_RGB888)
-			//	imgUC3 = Mat(imgQt.height(), imgQt.width(), CV_8UC3, (uchar*)imgQt.bits(), imgQt.bytesPerLine());
-			//else
-			//	imgUC3 = Mat(imgQt.height(), imgQt.width(), CV_8UC4, (uchar*)imgQt.bits(), imgQt.bytesPerLine());
-			split(imgUC3, planes);
-			// Store the 3 channels in a QImage Vector.
-			//Be aware that OpenCV 'swaps' the rgb triplet, hence process it in a descending way:
-			int idx = 1;
-			for (int i = 2; i >= 0; i--) {
-
-				// dirty hack
-				if (i >= (int)planes.size()) i = 0;
-				mImgs[idx] = QImage((const unsigned char*)planes[i].data, (int)planes[i].cols, (int)planes[i].rows, (int)planes[i].step,  QImage::Format_Indexed8);
-				mImgs[idx] = mImgs[idx].copy();
-				idx++;
-
-			}
-			// The first element in the vector contains the gray scale 'average' of the 3 channels:
-			cv::Mat grayMat;
-			cv::cvtColor(imgUC3, grayMat, CV_BGR2GRAY);
-			mImgs[0] = QImage((const unsigned char*)grayMat.data, (int)grayMat.cols, (int)grayMat.rows, (int)grayMat.step,  QImage::Format_Indexed8);
-			mImgs[0] = mImgs[0].copy();
-			planes.clear();
-
-	}
+    else {
+
+        mImgs = QVector<QImage>(4);
+        std::vector<cv::Mat> planes;
+
+        cv::Mat imgUC3 = DkImage::qImage2Mat(mImgStorage.image());
+        // int format = imgQt.format();
+        // if (format == QImage::Format_RGB888)
+        //	imgUC3 = Mat(imgQt.height(), imgQt.width(), CV_8UC3, (uchar*)imgQt.bits(), imgQt.bytesPerLine());
+        // else
+        //	imgUC3 = Mat(imgQt.height(), imgQt.width(), CV_8UC4, (uchar*)imgQt.bits(), imgQt.bytesPerLine());
+        split(imgUC3, planes);
+        // Store the 3 channels in a QImage Vector.
+        // Be aware that OpenCV 'swaps' the rgb triplet, hence process it in a descending way:
+        int idx = 1;
+        for (int i = 2; i >= 0; i--) {
+            // dirty hack
+            if (i >= (int)planes.size())
+                i = 0;
+            mImgs[idx] = QImage((const unsigned char *)planes[i].data, (int)planes[i].cols, (int)planes[i].rows, (int)planes[i].step, QImage::Format_Indexed8);
+            mImgs[idx] = mImgs[idx].copy();
+            idx++;
+        }
+        // The first element in the vector contains the gray scale 'average' of the 3 channels:
+        cv::Mat grayMat;
+        cv::cvtColor(imgUC3, grayMat, CV_BGR2GRAY);
+        mImgs[0] = QImage((const unsigned char *)grayMat.data, (int)grayMat.cols, (int)grayMat.rows, (int)grayMat.step, QImage::Format_Indexed8);
+        mImgs[0] = mImgs[0].copy();
+        planes.clear();
+    }
 #else
 
-	else {
-		mDrawFalseColorImg = false;
-		emit imageModeSet(mode_invalid_format);	
-		return;
-	}
+    else {
+        mDrawFalseColorImg = false;
+        emit imageModeSet(mode_invalid_format);
+        return;
+    }
 
 #endif
-	
-	mFalseColorImg = mImgs[mActiveChannel];
-	mFalseColorImg.setColorTable(mColorTable);
-	
-	// images with valid color table return img.isGrayScale() false...
-	if (mSvg || mMovie)
-		emit imageModeSet(mode_invalid_format);
-	else if (mImgs.size() == 1) 
-		emit imageModeSet(mode_gray);
-	else
-		emit imageModeSet(mode_rgb);
-
-	update();
-
-	
-}
 
-void DkViewPortContrast::pickColor(bool enable) {
+    mFalseColorImg = mImgs[mActiveChannel];
+    mFalseColorImg.setColorTable(mColorTable);
 
-	mIsColorPickerActive = enable;
-	this->setCursor(Qt::CrossCursor);
+    // images with valid color table return img.isGrayScale() false...
+    if (mSvg || mMovie)
+        emit imageModeSet(mode_invalid_format);
+    else if (mImgs.size() == 1)
+        emit imageModeSet(mode_gray);
+    else
+        emit imageModeSet(mode_rgb);
 
+    update();
 }
 
-void DkViewPortContrast::enableTF(bool enable) {
-
-	mDrawFalseColorImg = enable;
-	update();
-
-	drawImageHistogram();
-
+void DkViewPortContrast::pickColor(bool enable)
+{
+    mIsColorPickerActive = enable;
+    this->setCursor(Qt::CrossCursor);
 }
 
-void DkViewPortContrast::mousePressEvent(QMouseEvent *event) {
+void DkViewPortContrast::enableTF(bool enable)
+{
+    mDrawFalseColorImg = enable;
+    update();
 
-	if (!mIsColorPickerActive)
-		DkViewPort::mousePressEvent(event);	// just propagate events, if the color picker is not active
+    drawImageHistogram();
 }
 
-void DkViewPortContrast::mouseMoveEvent(QMouseEvent *event) {
-
-	if (!mIsColorPickerActive)
-		DkViewPort::mouseMoveEvent(event); // just propagate events, if the color picker is not active
-	else if (DkStatusBarManager::instance().statusbar()->isVisible())
-		getPixelInfo(event->pos());
+void DkViewPortContrast::mousePressEvent(QMouseEvent *event)
+{
+    if (!mIsColorPickerActive)
+        DkViewPort::mousePressEvent(event); // just propagate events, if the color picker is not active
 }
 
-void DkViewPortContrast::mouseReleaseEvent(QMouseEvent *event) {
-
-	if (mIsColorPickerActive) {
-
-		QPointF imgPos = mWorldMatrix.inverted().map(event->pos());
-		imgPos = mImgMatrix.inverted().map(imgPos);
+void DkViewPortContrast::mouseMoveEvent(QMouseEvent *event)
+{
+    if (!mIsColorPickerActive)
+        DkViewPort::mouseMoveEvent(event); // just propagate events, if the color picker is not active
+    else if (DkStatusBarManager::instance().statusbar()->isVisible())
+        getPixelInfo(event->pos());
+}
 
-		QPoint xy = imgPos.toPoint();
+void DkViewPortContrast::mouseReleaseEvent(QMouseEvent *event)
+{
+    if (mIsColorPickerActive) {
+        QPointF imgPos = mWorldMatrix.inverted().map(event->pos());
+        imgPos = mImgMatrix.inverted().map(imgPos);
 
-		bool isPointValid = true;
+        QPoint xy = imgPos.toPoint();
 
-		if (xy.x() < 0 || xy.y() < 0 || xy.x() >= getImageSize().width() || xy.y() >= getImageSize().height())
-			isPointValid = false;
+        bool isPointValid = true;
 
-		if (isPointValid) {
+        if (xy.x() < 0 || xy.y() < 0 || xy.x() >= getImageSize().width() || xy.y() >= getImageSize().height())
+            isPointValid = false;
 
-			int colorIdx = mImgs[mActiveChannel].pixelIndex(xy);
-			qreal normedPos = (qreal) colorIdx / 255;
-			emit tFSliderAdded(normedPos);
-		}
+        if (isPointValid) {
+            int colorIdx = mImgs[mActiveChannel].pixelIndex(xy);
+            qreal normedPos = (qreal)colorIdx / 255;
+            emit tFSliderAdded(normedPos);
+        }
 
-		//unsetCursor();
-		//isColorPickerActive = false;
-	} 
-	else
-		DkViewPort::mouseReleaseEvent(event);
+        // unsetCursor();
+        // isColorPickerActive = false;
+    } else
+        DkViewPort::mouseReleaseEvent(event);
 }
 
-void DkViewPortContrast::keyPressEvent(QKeyEvent* event) {
-
-	if ((event->key() == Qt::Key_Escape) && mIsColorPickerActive) {
-		unsetCursor();
-		mIsColorPickerActive = false;
-		update();
-		return;
-	}
-	else
-		DkViewPort::keyPressEvent(event);
+void DkViewPortContrast::keyPressEvent(QKeyEvent *event)
+{
+    if ((event->key() == Qt::Key_Escape) && mIsColorPickerActive) {
+        unsetCursor();
+        mIsColorPickerActive = false;
+        update();
+        return;
+    } else
+        DkViewPort::keyPressEvent(event);
 }
 
-QImage DkViewPortContrast::getImage() const {
-
-	if (mDrawFalseColorImg)
-		return mFalseColorImg;
-	else
-		return imageContainer() ? imageContainer()->image() : QImage();
-
+QImage DkViewPortContrast::getImage() const
+{
+    if (mDrawFalseColorImg)
+        return mFalseColorImg;
+    else
+        return imageContainer() ? imageContainer()->image() : QImage();
 }
 
 // in contrast mode: if the histogram widget is visible redraw the histogram from the selected image channel data
-void DkViewPortContrast::drawImageHistogram() {
-
-	if (mController->getHistogram() && mController->getHistogram()->isVisible()) {
-		if (mDrawFalseColorImg) 
-			mController->getHistogram()->drawHistogram(mFalseColorImg);
-		else 
-			mController->getHistogram()->drawHistogram(getImage());
-	}
+void DkViewPortContrast::drawImageHistogram()
+{
+    if (mController->getHistogram() && mController->getHistogram()->isVisible()) {
+        if (mDrawFalseColorImg)
+            mController->getHistogram()->drawHistogram(mFalseColorImg);
+        else
+            mController->getHistogram()->drawHistogram(getImage());
+    }
 }
 
 }
diff --git a/ImageLounge/src/DkGui/DkViewPort.h b/ImageLounge/src/DkGui/DkViewPort.h
index b6bd0ce..90bc9d8 100644
--- a/ImageLounge/src/DkGui/DkViewPort.h
+++ b/ImageLounge/src/DkGui/DkViewPort.h
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkViewPort.h
  Created on:	05.05.2011
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -29,12 +29,12 @@
 
 #include "DkBaseViewPort.h"
 #include "DkImageContainer.h"
-#include "DkTimer.h"
 #include "DkMath.h"
+#include "DkTimer.h"
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QTimer>	// needed to construct mTimers
-#pragma warning(pop)		// no warnings from includes - end
+#pragma warning(push, 0) // no warnings from includes - begin
+#include <QTimer> // needed to construct mTimers
+#pragma warning(pop) // no warnings from includes - end
 
 #ifndef DllCoreExport
 #ifdef DK_CORE_DLL_EXPORT
@@ -46,12 +46,12 @@
 #endif
 #endif
 
-#pragma warning(disable: 4275)	// no dll interface of base class
+#pragma warning(disable : 4275) // no dll interface of base class
 
 // OpenCV
 #ifdef WITH_OPENCV
 #ifdef Q_OS_WIN
-#pragma warning(disable: 4996)
+#pragma warning(disable : 4996)
 #endif
 #endif
 
@@ -59,8 +59,8 @@ class QVBoxLayout;
 class QMimeData;
 class QPushButton;
 
-namespace nmc {
-
+namespace nmc
+{
 // some dummies
 class DkImageLoader;
 class DkLoader;
@@ -73,257 +73,270 @@ class DkBaseManipulator;
 class DkResizeDialog;
 class DkHudNavigation;
 
-class DllCoreExport DkViewPort : public DkBaseViewPort {
-	Q_OBJECT
+class DllCoreExport DkViewPort : public DkBaseViewPort
+{
+    Q_OBJECT
 
 public:
-	DkViewPort(QWidget *parent = 0);
-	virtual ~DkViewPort();
-	
-	void zoom(double factor = 0.5, const QPointF& center = QPointF(-1,-1), bool force = false) override;
+    DkViewPort(QWidget *parent = 0);
+    virtual ~DkViewPort();
+
+    void zoom(double factor = 0.5, const QPointF &center = QPointF(-1, -1), bool force = false) override;
 
-	void setFullScreen(bool fullScreen);
-		
-	QTransform getWorldMatrix() override { 
-		return mWorldMatrix;
-	};
+    void setFullScreen(bool fullScreen);
 
-	QTransform* getWorldMatrixPtr() {
-		return &mWorldMatrix;
-	};
+    QTransform getWorldMatrix() override
+    {
+        return mWorldMatrix;
+    };
 
-	QTransform* getImageMatrixPtr() {
-		return &mImgMatrix;
-	};
+    QTransform *getWorldMatrixPtr()
+    {
+        return &mWorldMatrix;
+    };
 
-	void setPaintWidget(QWidget* widget, bool removeWidget);
+    QTransform *getImageMatrixPtr()
+    {
+        return &mImgMatrix;
+    };
+
+    void setPaintWidget(QWidget *widget, bool removeWidget);
 
 #ifdef WITH_OPENCV
-	void setImage(cv::Mat newImg) override;
+    void setImage(cv::Mat newImg) override;
 #endif
 
-	// getter
-	QSharedPointer<DkImageContainerT> imageContainer() const;
-	void setImageLoader(QSharedPointer<DkImageLoader> newLoader);
-	DkControlWidget* getController();
-	bool isTestLoaded() { return mTestLoaded; };
-	
-	QString getCurrentPixelHexValue();
-	QPoint mapToImage(const QPoint& windowPos) const;
-	
-	void connectLoader(QSharedPointer<DkImageLoader> loader, bool connectSignals = true);
+    // getter
+    QSharedPointer<DkImageContainerT> imageContainer() const;
+    void setImageLoader(QSharedPointer<DkImageLoader> newLoader);
+    DkControlWidget *getController();
+    bool isTestLoaded()
+    {
+        return mTestLoaded;
+    };
+
+    QString getCurrentPixelHexValue();
+    QPoint mapToImage(const QPoint &windowPos) const;
+
+    void connectLoader(QSharedPointer<DkImageLoader> loader, bool connectSignals = true);
 
 signals:
-	void sendTransformSignal(QTransform transform, QTransform imgTransform, QPointF canvasSize) const;
-	void sendNewFileSignal(qint16 op, QString filename = "") const;
-	void movieLoadedSignal(bool isMovie) const;
-	void infoSignal(const QString& msg) const;	// needed to forward signals
-	void addTabSignal(const QString& filePath) const;
-	void zoomSignal(double zoomLevel) const;
-	void mouseClickSignal(QMouseEvent* event, QPoint imgPos) const;
-	void showProgress(bool show, int time = -1) const;
+    void sendTransformSignal(QTransform transform, QTransform imgTransform, QPointF canvasSize) const;
+    void sendNewFileSignal(qint16 op, QString filename = "") const;
+    void movieLoadedSignal(bool isMovie) const;
+    void infoSignal(const QString &msg) const; // needed to forward signals
+    void addTabSignal(const QString &filePath) const;
+    void zoomSignal(double zoomLevel) const;
+    void mouseClickSignal(QMouseEvent *event, QPoint imgPos) const;
+    void showProgress(bool show, int time = -1) const;
+    void imageUpdatedSignal() const;
 
 public slots:
-	void fullView() override;
-	void resetView() override;
-
-	void rotateCW();
-	void rotateCCW();
-	void rotate180();
-	void resizeImage();
-	void deleteImage();
-	void zoomToFit(double margin = 0);
-	void resizeEvent(QResizeEvent* event) override;
-	void toggleResetMatrix();
-	void zoomTo(double zoomLevel);
-	
-	// tcp actions
-	void tcpSetTransforms(QTransform worldMatrix, QTransform imgMatrix, QPointF canvasSize);
-	void tcpSetWindowRect(QRect rect);
-	void tcpForceSynchronize();
-	void tcpSynchronize(QTransform relativeMatrix = QTransform(), bool force = false);
-	void tcpLoadFile(qint16 idx, QString filename);
-	
-	// file actions
-	void loadFile(const QString& filePath);
-	void reloadFile();
-	void loadNextFileFast();
-	void loadPrevFileFast();
-	void loadFileFast(int skipIdx);
-	void loadFile(int skipIdx);
-	void loadFirst();
-	void loadLast();
-	void loadSkipNext10();
-	void loadSkipPrev10();
-	void loadLena();
-	bool unloadImage(bool fileChange = true) override;
-	void deactivate();
-	void repeatZoom();
-
-	void applyPlugin(DkPluginContainer* plugin, const QString& key);
-
-	// image saving
-	QImage getImage() const override;
-	void saveFile();
-	void saveFileAs(bool silent = false);
-	void saveFileWeb();
-	void setAsWallpaper();
-
-	// copy & paste
-	void copyPixelColorValue();
-	void copyImageBuffer();
-	void copyImage();
-	QMimeData* createMime() const;
-
-	// image manipulators
-	virtual void applyManipulator();
-	void manipulatorApplied();
-
-	virtual void updateImage(QSharedPointer<DkImageContainerT> image, bool loaded = true);
-	virtual void loadImage(const QImage& newImg);
-	virtual void loadImage(QSharedPointer<DkImageContainerT> img);
-	virtual void setEditedImage(const QImage& newImg, const QString& editName);
-	virtual void setEditedImage(QSharedPointer<DkImageContainerT> img);
-	virtual void setImage(QImage newImg) override;
-
-	void settingsChanged();
-	void pauseMovie(bool paused);
-	void stopMovie();
-	virtual void loadMovie();
-	virtual void loadSvg();
-	void nextMovieFrame();
-	void previousMovieFrame();
-	void animateFade();
-	virtual void togglePattern(bool show) override;
+    void fullView() override;
+    void resetView() override;
+
+    void rotateCW();
+    void rotateCCW();
+    void rotate180();
+    void resizeImage();
+    void deleteImage();
+    void zoomToFit();
+    void resizeEvent(QResizeEvent *event) override;
+    void toggleResetMatrix();
+    void zoomTo(double zoomLevel);
+
+    // tcp actions
+    void tcpSetTransforms(QTransform worldMatrix, QTransform imgMatrix, QPointF canvasSize);
+    void tcpSetWindowRect(QRect rect);
+    void tcpForceSynchronize();
+    void tcpSynchronize(QTransform relativeMatrix = QTransform(), bool force = false);
+    void tcpLoadFile(qint16 idx, QString filename);
+
+    // file actions
+    void loadFile(const QString &filePath);
+    void reloadFile();
+    void loadNextFileFast();
+    void loadPrevFileFast();
+    void loadFileFast(int skipIdx);
+    void loadFile(int skipIdx);
+    void loadFirst();
+    void loadLast();
+    void loadSkipNext10();
+    void loadSkipPrev10();
+    void loadLena();
+    bool unloadImage(bool fileChange = true) override;
+    void deactivate();
+    void cropImage(const DkRotatingRect &rect, const QColor &bgCol, bool cropToMetaData);
+    void repeatZoom();
+
+    void applyPlugin(DkPluginContainer *plugin, const QString &key);
+
+    // image saving
+    QImage getImage() const override;
+    void saveFile();
+    void saveFileAs(bool silent = false);
+    void saveFileWeb();
+    void setAsWallpaper();
+
+    // copy & paste
+    void copyPixelColorValue();
+    void copyImageBuffer();
+    void copyImage();
+    QMimeData *createMime() const;
+
+    // image manipulators
+    virtual void applyManipulator();
+    void manipulatorApplied();
+
+    virtual void updateImage(QSharedPointer<DkImageContainerT> image, bool loaded = true);
+    virtual void setImageUpdated();
+    virtual void loadImage(const QImage &newImg);
+    virtual void loadImage(QSharedPointer<DkImageContainerT> img);
+    virtual void setEditedImage(const QImage &newImg, const QString &editName);
+    virtual void setEditedImage(QSharedPointer<DkImageContainerT> img);
+    virtual void setImage(QImage newImg) override;
+
+    void settingsChanged();
+    void pauseMovie(bool paused);
+    void stopMovie();
+    virtual void loadMovie();
+    virtual void loadSvg();
+    void nextMovieFrame();
+    void previousMovieFrame();
+    void animateFade();
+    virtual void togglePattern(bool show) override;
 
 protected:
-	
-	// events
-	virtual void dragLeaveEvent(QDragLeaveEvent *event) override;
-	virtual void mousePressEvent(QMouseEvent *event) override;
-	virtual void mouseReleaseEvent(QMouseEvent *event) override;
-	virtual void mouseMoveEvent(QMouseEvent *event) override;
-	virtual void wheelEvent(QWheelEvent *event) override;
-	virtual bool event(QEvent *event) override;
-	virtual void paintEvent(QPaintEvent* event) override;
-	virtual void leaveEvent(QEvent* event) override;
-
-	bool mTestLoaded = false;
-	bool mGestureStarted = false;
-
-	QRectF mOldImgRect;
-
-	QTimer* mRepeatZoomTimer;
-	
-	// fading stuff
-	QTimer* mAnimationTimer;
-	DkTimer mAnimationTime;
-	QImage mAnimationBuffer;
-	double mAnimationValue;
-	QRectF mFadeImgViewRect;
-	QRectF mFadeImgRect;
-	bool mNextSwipe = true;
-
-	QImage mImgBg;
-
-	QVBoxLayout* mPaintLayout = 0;
-	DkControlWidget* mController = 0;
-	QSharedPointer<DkImageLoader> mLoader = QSharedPointer<DkImageLoader>();
-	DkResizeDialog* mResizeDialog = 0;
-
-	QPoint mCurrentPixelPos;
-	
-	DkHudNavigation* mNavigationWidget = 0;
-	
-	// image manipulators
-	QFutureWatcher<QImage> mManipulatorWatcher;
-	QSharedPointer<DkBaseManipulator> mActiveManipulator;
-
-	// functions
-	virtual int swipeRecognition(QPoint start, QPoint end);
-	virtual void swipeAction(int swipeGesture);
-	virtual void createShortcuts();
-
-	void drawPolygon(QPainter & painter, const QPolygon & polygon);
-	virtual void drawBackground(QPainter & painter);
-	void updateImageMatrix() override;
-	void showZoom();
-	void toggleLena(bool fullscreen);
-	void getPixelInfo(const QPoint& pos);
+    // events
+    virtual void dragLeaveEvent(QDragLeaveEvent *event) override;
+    virtual void mousePressEvent(QMouseEvent *event) override;
+    virtual void mouseReleaseEvent(QMouseEvent *event) override;
+    virtual void mouseMoveEvent(QMouseEvent *event) override;
+    virtual void wheelEvent(QWheelEvent *event) override;
+    virtual bool event(QEvent *event) override;
+    virtual void paintEvent(QPaintEvent *event) override;
+    virtual void leaveEvent(QEvent *event) override;
+
+    bool mTestLoaded = false;
+    bool mGestureStarted = false;
+
+    QRectF mOldImgRect;
+
+    QTimer *mRepeatZoomTimer;
+
+    // fading stuff
+    QTimer *mAnimationTimer;
+    DkTimer mAnimationTime;
+    QImage mAnimationBuffer;
+    double mAnimationValue;
+    QRectF mFadeImgViewRect;
+    QRectF mFadeImgRect;
+    bool mNextSwipe = true;
+
+    QImage mImgBg;
+
+    QVBoxLayout *mPaintLayout = 0;
+    DkControlWidget *mController = 0;
+    QSharedPointer<DkImageLoader> mLoader = QSharedPointer<DkImageLoader>();
+    DkResizeDialog *mResizeDialog = 0;
+
+    QPoint mCurrentPixelPos;
+
+    DkRotatingRect mCropRect;
+
+    DkHudNavigation *mNavigationWidget = 0;
+
+    // image manipulators
+    QFutureWatcher<QImage> mManipulatorWatcher;
+    QSharedPointer<DkBaseManipulator> mActiveManipulator;
+
+    // functions
+    virtual int swipeRecognition(QPoint start, QPoint end);
+    virtual void swipeAction(int swipeGesture);
+    virtual void createShortcuts();
+
+    void drawPolygon(QPainter &painter, const QPolygon &polygon);
+    virtual void drawBackground(QPainter &painter);
+    virtual void updateImageMatrix() override;
+    void showZoom();
+    void toggleLena(bool fullscreen);
+    void getPixelInfo(const QPoint &pos);
 };
 
-class DllCoreExport DkViewPortFrameless : public DkViewPort {
-	Q_OBJECT
+class DllCoreExport DkViewPortFrameless : public DkViewPort
+{
+    Q_OBJECT
 
 public:
-	DkViewPortFrameless(QWidget *parent = 0);
-	virtual ~DkViewPortFrameless();
+    DkViewPortFrameless(QWidget *parent = 0);
+    virtual ~DkViewPortFrameless();
 
-	virtual void zoom(double factor = 0.5, const QPointF& center = QPointF(-1,-1), bool force = false) override;
+    virtual void zoom(double factor = 0.5, const QPointF &center = QPointF(-1, -1), bool force = false) override;
 
 public slots:
-	virtual void resetView() override;
-	virtual void moveView(QPointF);
+    virtual void resetView() override;
+    virtual void moveView(QPointF);
 
 protected:
-	virtual void mousePressEvent(QMouseEvent *event) override;
-	virtual void mouseReleaseEvent(QMouseEvent *event) override;
-	virtual void mouseMoveEvent(QMouseEvent *event) override;
-	virtual void paintEvent(QPaintEvent* event) override;
-
-	// functions
-	void updateImageMatrix() override;
-	void draw(QPainter & painter, double opacity = 1.0) override;
-	void drawFrame(QPainter & painter);
-	void drawBackground(QPainter & painter) override;
-	void controlImagePosition(const QRect& = QRect()) override;
-	void centerImage() override;
-
-	// variables
-	QVector<QAction*> mStartActions;
-	QVector<QIcon> mStartIcons;
-	QVector<QRectF> mStartActionsRects;
-	QVector<QPixmap> mStartActionsIcons;
+    virtual void mousePressEvent(QMouseEvent *event) override;
+    virtual void mouseReleaseEvent(QMouseEvent *event) override;
+    virtual void mouseMoveEvent(QMouseEvent *event) override;
+    virtual void paintEvent(QPaintEvent *event) override;
+
+    // functions
+    virtual void updateImageMatrix() override;
+    virtual void draw(QPainter &painter, double opacity = 1.0) override;
+    void drawFrame(QPainter &painter);
+    virtual void drawBackground(QPainter &painter) override;
+    void controlImagePosition(float lb = -1, float ub = -1) override;
+    virtual void centerImage() override;
+
+    // variables
+    QVector<QAction *> mStartActions;
+    QVector<QIcon> mStartIcons;
+    QVector<QRectF> mStartActionsRects;
+    QVector<QPixmap> mStartActionsIcons;
 };
 
-class DllCoreExport DkViewPortContrast : public DkViewPort {
-	Q_OBJECT
+class DllCoreExport DkViewPortContrast : public DkViewPort
+{
+    Q_OBJECT
 
 public:
-	DkViewPortContrast(QWidget *parent = 0);
-	virtual ~DkViewPortContrast();
+    DkViewPortContrast(QWidget *parent = 0);
+    virtual ~DkViewPortContrast();
 
 signals:
-	void tFSliderAdded(qreal pos) const;
-	void imageModeSet(int mode) const;
+    void tFSliderAdded(qreal pos) const;
+    void imageModeSet(int mode) const;
 
 public slots:
-	void changeChannel(int channel);
-	void changeColorTable(QGradientStops stops);
-	void pickColor(bool enable);
-	void enableTF(bool enable);
-	QImage getImage() const override;
+    void changeChannel(int channel);
+    void changeColorTable(QGradientStops stops);
+    void pickColor(bool enable);
+    void enableTF(bool enable);
+    QImage getImage() const override;
 
-	virtual void setImage(QImage newImg) override;
+    virtual void setImage(QImage newImg) override;
 
 protected:
-	virtual void draw(QPainter & painter, double opacity = 1.0) override;
-	virtual void mousePressEvent(QMouseEvent *event) override;
-	virtual void mouseMoveEvent(QMouseEvent *event) override;
-	virtual void mouseReleaseEvent(QMouseEvent *event) override;
-	virtual void keyPressEvent(QKeyEvent *event) override;
+    virtual void draw(QPainter &painter, double opacity = 1.0) override;
+    virtual void mousePressEvent(QMouseEvent *event) override;
+    virtual void mouseMoveEvent(QMouseEvent *event) override;
+    virtual void mouseReleaseEvent(QMouseEvent *event) override;
+    virtual void keyPressEvent(QKeyEvent *event) override;
 
 private:
-	QImage mFalseColorImg;
-	bool mDrawFalseColorImg = false;
-	bool mIsColorPickerActive = false;
-	int mActiveChannel = 0;
-		
-	QVector<QImage> mImgs;
-	QVector<QRgb> mColorTable;
-
-	// functions
-	void drawImageHistogram();
+    QImage mFalseColorImg;
+    bool mDrawFalseColorImg = false;
+    bool mIsColorPickerActive = false;
+    int mActiveChannel = 0;
+
+    QVector<QImage> mImgs;
+    QVector<QRgb> mColorTable;
+
+    // functions
+    void drawImageHistogram();
 };
 
 }
diff --git a/ImageLounge/src/DkGui/DkWidgets.cpp b/ImageLounge/src/DkGui/DkWidgets.cpp
index c10722c..72616fb 100644
--- a/ImageLounge/src/DkGui/DkWidgets.cpp
+++ b/ImageLounge/src/DkGui/DkWidgets.cpp
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkWidgets.cpp
  Created on:	17.05.2011
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -27,2335 +27,2395 @@
 
 #include "DkWidgets.h"
 
-#include "DkUtils.h"
-#include "DkTimer.h"
-#include "DkThumbs.h"
+#include "DkActionManager.h"
+#include "DkDialog.h"
 #include "DkImageContainer.h"
-#include "DkToolbars.h"
 #include "DkImageStorage.h"
 #include "DkSettings.h"
 #include "DkStatusBar.h"
-#include "DkActionManager.h"
-#include "DkDialog.h"
+#include "DkThumbs.h"
+#include "DkTimer.h"
+#include "DkToolbars.h"
+#include "DkUtils.h"
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QMainWindow>
-#include <QObject>
-#include <QColor>
-#include <QDoubleSpinBox>
-#include <QApplication>
-#include <QRadioButton>
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QAction>
+#include <QApplication>
 #include <QBoxLayout>
+#include <QButtonGroup>
+#include <QColor>
+#include <QColorDialog>
+#include <QComboBox>
+#include <QCompleter>
 #include <QDialog>
+#include <QDockWidget>
+#include <QDoubleSpinBox>
+#include <QFileDialog>
+#include <QFileSystemModel>
+#include <QFuture>
+#include <QFutureWatcher>
 #include <QGraphicsBlurEffect>
+#include <QGraphicsItem>
+#include <QGraphicsItemAnimation>
 #include <QGraphicsPixmapItem>
+#include <QGraphicsSceneMouseEvent>
+#include <QGraphicsView>
+#include <QHeaderView>
+#include <QInputDialog>
 #include <QLabel>
-#include <QPainter>
-#include <QPushButton>
-#include <QMouseEvent>
-#include <QToolButton>
-#include <QComboBox>
+#include <QLineEdit>
+#include <QMainWindow>
+#include <QMap>
+#include <QMenu>
 #include <QMessageBox>
-#include <QStringBuilder>
+#include <QMimeData>
+#include <QMouseEvent>
+#include <QMovie>
+#include <QObject>
+#include <QPainter>
 #include <QPointer>
-#include <QTimer>
-#include <QMap>
-#include <QVector2D>
-#include <qmath.h>
+#include <QProgressDialog>
+#include <QPushButton>
+#include <QRadioButton>
+#include <QRegularExpression>
+#include <QScreen>
+#include <QScrollArea>
 #include <QScrollBar>
-#include <QFileSystemModel>
-#include <QDockWidget>
-#include <QTreeView>
 #include <QSortFilterProxyModel>
+#include <QStringBuilder>
+#include <QSvgRenderer>
+#include <QThread>
+#include <QTimeLine>
+#include <QTimer>
+#include <QToolButton>
 #include <QToolTip>
-#include <QProgressDialog>
-#include <QHeaderView>
-#include <QMenu>
-#include <QScrollArea>
-#include <QGraphicsView>
-#include <QGraphicsPixmapItem>
-#include <QGraphicsSceneMouseEvent>
-#include <QGraphicsItem>
+#include <QTreeView>
+#include <QVBoxLayout>
+#include <QVector2D>
 #include <QtConcurrentRun>
-#include <QMimeData>
-#include <QTimeLine>
-#include <QGraphicsItemAnimation>
-#include <QLineEdit>
-#include <QThread>
-#include <QFuture>
-#include <QFutureWatcher>
+#include <qmath.h>
 #include <qtconcurrentmap.h>
-#include <QColor>
-#include <QVBoxLayout>
-#include <QLabel>
-#include <QMovie>
-#include <QColorDialog>
-#include <QCompleter>
-#include <QDirModel>
-#include <QSvgRenderer>
-#include <QFileDialog>
-#include <QInputDialog>
-#include <QButtonGroup>
-#include <QDesktopWidget>
-#include <QScreen>
-#pragma warning(pop)		// no warnings from includes - end
+#pragma warning(pop) // no warnings from includes - end
 
-namespace nmc {
+namespace nmc
+{
 
 // DkFolderScrollBar --------------------------------------------------------------------
-DkFolderScrollBar::DkFolderScrollBar(QWidget* parent) : QSlider(Qt::Horizontal, parent) {
-	
-	setObjectName("DkFolderScrollBar");
-	init();
-	mMouseDown = false;
+DkFolderScrollBar::DkFolderScrollBar(QWidget *parent)
+    : QSlider(Qt::Horizontal, parent)
+{
+    setObjectName("DkFolderScrollBar");
+    init();
+    mMouseDown = false;
 }
 
-DkFolderScrollBar::~DkFolderScrollBar() {
+DkFolderScrollBar::~DkFolderScrollBar()
+{
 }
 
 // DkFadeWidget stuff
-void DkFolderScrollBar::registerAction(QAction* action) {
-	connect(this, SIGNAL(visibleSignal(bool)), action, SLOT(setChecked(bool)));
+void DkFolderScrollBar::registerAction(QAction *action)
+{
+    connect(this, SIGNAL(visibleSignal(bool)), action, SLOT(setChecked(bool)));
 }
 
-void DkFolderScrollBar::block(bool blocked) {
-	this->mBlocked = blocked;
-	setVisible(false);
+void DkFolderScrollBar::block(bool blocked)
+{
+    this->mBlocked = blocked;
+    setVisible(false);
 }
 
-void DkFolderScrollBar::setDisplaySettings(QBitArray* displayBits) {
-	mDisplaySettingsBits = displayBits;
+void DkFolderScrollBar::setDisplaySettings(QBitArray *displayBits)
+{
+    mDisplaySettingsBits = displayBits;
 }
 
-bool DkFolderScrollBar::getCurrentDisplaySetting() {
-
-	if (!mDisplaySettingsBits)
-		return false;
+bool DkFolderScrollBar::getCurrentDisplaySetting()
+{
+    if (!mDisplaySettingsBits)
+        return false;
 
-	if (DkSettingsManager::param().app().currentAppMode < 0 || DkSettingsManager::param().app().currentAppMode >= mDisplaySettingsBits->size()) {
-		qDebug() << "[WARNING] illegal app mode: " << DkSettingsManager::param().app().currentAppMode;
-		return false;
-	}
+    if (DkSettingsManager::param().app().currentAppMode < 0 || DkSettingsManager::param().app().currentAppMode >= mDisplaySettingsBits->size()) {
+        qDebug() << "[WARNING] illegal app mode: " << DkSettingsManager::param().app().currentAppMode;
+        return false;
+    }
 
-	return mDisplaySettingsBits->testBit(DkSettingsManager::param().app().currentAppMode);
+    return mDisplaySettingsBits->testBit(DkSettingsManager::param().app().currentAppMode);
 }
 
-void DkFolderScrollBar::updateDir(QVector<QSharedPointer<DkImageContainerT> > images) {
-
-	setMaximum(images.size()-1);
+void DkFolderScrollBar::updateDir(QVector<QSharedPointer<DkImageContainerT>> images)
+{
+    setMaximum(images.size() - 1);
 }
 
-void DkFolderScrollBar::updateFile(int idx) {
-	
-	if (mMouseDown)
-		return;
+void DkFolderScrollBar::updateFile(int idx)
+{
+    if (mMouseDown)
+        return;
 
-	if (isVisible()) {
-		blockSignals(true);
-		QSlider::setValue(idx);
-		blockSignals(false);
-	}
+    if (isVisible()) {
+        blockSignals(true);
+        QSlider::setValue(idx);
+        blockSignals(false);
+    }
 }
 
-void DkFolderScrollBar::setValue(int idx) {
-
-	QSlider::setValue(idx);
+void DkFolderScrollBar::setValue(int idx)
+{
+    QSlider::setValue(idx);
 }
 
-void DkFolderScrollBar::mousePressEvent(QMouseEvent *event) {
-
-	blockSignals(true);
-	QSlider::mousePressEvent(event);
+void DkFolderScrollBar::mousePressEvent(QMouseEvent *event)
+{
+    blockSignals(true);
+    QSlider::mousePressEvent(event);
 }
 
-void DkFolderScrollBar::mouseReleaseEvent(QMouseEvent *event) {
-
-	mMouseDown = false;
-	blockSignals(false);
-	emit valueChanged(value());
-	QSlider::mouseReleaseEvent(event);
+void DkFolderScrollBar::mouseReleaseEvent(QMouseEvent *event)
+{
+    mMouseDown = false;
+    blockSignals(false);
+    emit valueChanged(value());
+    QSlider::mouseReleaseEvent(event);
 }
 
-void DkFolderScrollBar::init() {
-
-	setMouseTracking(true);
+void DkFolderScrollBar::init()
+{
+    setMouseTracking(true);
 
-	mBgCol = (DkSettingsManager::param().app().appMode == DkSettings::mode_frameless) ?
-		DkSettingsManager::param().display().bgColorFrameless :
-		DkSettingsManager::param().display().hudBgColor;
+    mBgCol = (DkSettingsManager::param().app().appMode == DkSettings::mode_frameless) ? DkSettingsManager::param().display().bgColorFrameless
+                                                                                      : DkSettingsManager::param().display().hudBgColor;
 
-	mShowing = false;
-	mHiding = false;
-	mBlocked = false;
-	mDisplaySettingsBits = 0;
-	mOpacityEffect = 0;
+    mShowing = false;
+    mHiding = false;
+    mBlocked = false;
+    mDisplaySettingsBits = 0;
+    mOpacityEffect = 0;
 
-	// painter problems if the widget is a child of another that has the same graphicseffect
-	// widget starts on hide
-	mOpacityEffect = new QGraphicsOpacityEffect(this);
-	mOpacityEffect->setOpacity(0);
-	mOpacityEffect->setEnabled(false);
-	setGraphicsEffect(mOpacityEffect);
+    // painter problems if the widget is a child of another that has the same graphicseffect
+    // widget starts on hide
+    mOpacityEffect = new QGraphicsOpacityEffect(this);
+    mOpacityEffect->setOpacity(0);
+    mOpacityEffect->setEnabled(false);
+    setGraphicsEffect(mOpacityEffect);
 
-	setVisible(false);
+    setVisible(false);
 }
 
-void DkFolderScrollBar::show(bool saveSettings) {
-
-	// here is a strange problem if you add a DkFadeWidget to another DkFadeWidget -> painters crash
-	if (!mBlocked && !mShowing) {
-		mHiding = false;
-		mShowing = true;
-		setVisible(true, saveSettings);
-		animateOpacityUp();
-	}
+void DkFolderScrollBar::show(bool saveSettings)
+{
+    // here is a strange problem if you add a DkFadeWidget to another DkFadeWidget -> painters crash
+    if (!mBlocked && !mShowing) {
+        mHiding = false;
+        mShowing = true;
+        setVisible(true, saveSettings);
+        animateOpacityUp();
+    }
 }
 
-void DkFolderScrollBar::hide(bool saveSettings) {
-
-	if (!mHiding) {
-		mHiding = true;
-		mShowing = false;
-		animateOpacityDown();
+void DkFolderScrollBar::hide(bool saveSettings)
+{
+    if (!mHiding) {
+        mHiding = true;
+        mShowing = false;
+        animateOpacityDown();
 
-		// set display bit here too -> since the final call to setVisible takes a few seconds
-		if (saveSettings && mDisplaySettingsBits && mDisplaySettingsBits->size() > DkSettingsManager::param().app().currentAppMode) {
-			mDisplaySettingsBits->setBit(DkSettingsManager::param().app().currentAppMode, false);
-		}
-	}
+        // set display bit here too -> since the final call to setVisible takes a few seconds
+        if (saveSettings && mDisplaySettingsBits && mDisplaySettingsBits->size() > DkSettingsManager::param().app().currentAppMode) {
+            mDisplaySettingsBits->setBit(DkSettingsManager::param().app().currentAppMode, false);
+        }
+    }
 }
 
-void DkFolderScrollBar::setVisible(bool visible, bool saveSettings) {
-
-	if (mBlocked) {
-		QWidget::setVisible(false);
-		return;
-	}
+void DkFolderScrollBar::setVisible(bool visible, bool saveSettings)
+{
+    if (mBlocked) {
+        QWidget::setVisible(false);
+        return;
+    }
 
-	if (visible && !isVisible() && !mShowing)
-		mOpacityEffect->setOpacity(100);
+    if (visible && !isVisible() && !mShowing)
+        mOpacityEffect->setOpacity(100);
 
-	QWidget::setVisible(visible);
-	emit visibleSignal(visible);	// if this gets slow -> put it into hide() or show()
+    QWidget::setVisible(visible);
+    emit visibleSignal(visible); // if this gets slow -> put it into hide() or show()
 
-	if (saveSettings && mDisplaySettingsBits && mDisplaySettingsBits->size() > DkSettingsManager::param().app().currentAppMode) {
-		mDisplaySettingsBits->setBit(DkSettingsManager::param().app().currentAppMode, visible);
-	}
+    if (saveSettings && mDisplaySettingsBits && mDisplaySettingsBits->size() > DkSettingsManager::param().app().currentAppMode) {
+        mDisplaySettingsBits->setBit(DkSettingsManager::param().app().currentAppMode, visible);
+    }
 }
 
-void DkFolderScrollBar::animateOpacityUp() {
-
-	if (!mShowing)
-		return;
+void DkFolderScrollBar::animateOpacityUp()
+{
+    if (!mShowing)
+        return;
 
-	mOpacityEffect->setEnabled(true);
-	if (mOpacityEffect->opacity() >= 1.0f || !mShowing) {
-		mOpacityEffect->setOpacity(1.0f);
-		mShowing = false;
-		mOpacityEffect->setEnabled(false);
-		return;
-	}
+    mOpacityEffect->setEnabled(true);
+    if (mOpacityEffect->opacity() >= 1.0f || !mShowing) {
+        mOpacityEffect->setOpacity(1.0f);
+        mShowing = false;
+        mOpacityEffect->setEnabled(false);
+        return;
+    }
 
-	QTimer::singleShot(20, this, SLOT(animateOpacityUp()));
-	mOpacityEffect->setOpacity(mOpacityEffect->opacity()+0.05);
+    QTimer::singleShot(20, this, SLOT(animateOpacityUp()));
+    mOpacityEffect->setOpacity(mOpacityEffect->opacity() + 0.05);
 }
 
-void DkFolderScrollBar::animateOpacityDown() {
+void DkFolderScrollBar::animateOpacityDown()
+{
+    if (!mHiding)
+        return;
 
-	if (!mHiding)
-		return;
-
-	mOpacityEffect->setEnabled(true);
-	if (mOpacityEffect->opacity() <= 0.0f) {
-		mOpacityEffect->setOpacity(0.0f);
-		mHiding = false;
-		setVisible(false, false);	// finally hide the widget
-		mOpacityEffect->setEnabled(false);
-		return;
-	}
+    mOpacityEffect->setEnabled(true);
+    if (mOpacityEffect->opacity() <= 0.0f) {
+        mOpacityEffect->setOpacity(0.0f);
+        mHiding = false;
+        setVisible(false, false); // finally hide the widget
+        mOpacityEffect->setEnabled(false);
+        return;
+    }
 
-	QTimer::singleShot(20, this, SLOT(animateOpacityDown()));
-	mOpacityEffect->setOpacity(mOpacityEffect->opacity()-0.05);
+    QTimer::singleShot(20, this, SLOT(animateOpacityDown()));
+    mOpacityEffect->setOpacity(mOpacityEffect->opacity() - 0.05);
 }
 
 // DkThumbsSaver --------------------------------------------------------------------
-DkThumbsSaver::DkThumbsSaver(QWidget* parent) : DkFadeWidget(parent) {
-	mStop = false;
-	mNumSaved = 0;
+DkThumbsSaver::DkThumbsSaver(QWidget *parent)
+    : DkFadeWidget(parent)
+{
+    mStop = false;
+    mNumSaved = 0;
 }
 
-void DkThumbsSaver::processDir(QVector<QSharedPointer<DkImageContainerT> > images, bool forceSave) {
-
-	if (images.empty())
-		return;
+void DkThumbsSaver::processDir(QVector<QSharedPointer<DkImageContainerT>> images, bool forceSave)
+{
+    if (images.empty())
+        return;
 
-	mStop = false;
-	mNumSaved = 0;
+    mStop = false;
+    mNumSaved = 0;
 
-	mPd = new QProgressDialog(tr("\nCreating thumbnails...\n") + images.first()->filePath(), 
-		tr("Cancel"), 
-		0, 
-		(int)images.size(), 
-		DkUtils::getMainWindow());
-	mPd->setWindowTitle(tr("Thumbnails"));
+    mPd = new QProgressDialog(tr("\nCreating thumbnails...\n") + images.first()->filePath(), tr("Cancel"), 0, (int)images.size(), DkUtils::getMainWindow());
+    mPd->setWindowTitle(tr("Thumbnails"));
 
-	//pd->setWindowModality(Qt::WindowModal);
+    // pd->setWindowModality(Qt::WindowModal);
 
-	connect(this, SIGNAL(numFilesSignal(int)), mPd, SLOT(setValue(int)));
-	connect(mPd, SIGNAL(canceled()), this, SLOT(stopProgress()));
+    connect(this, SIGNAL(numFilesSignal(int)), mPd, SLOT(setValue(int)));
+    connect(mPd, SIGNAL(canceled()), this, SLOT(stopProgress()));
 
-	mPd->show();
-
-	this->mForceSave = forceSave;
-	this->mImages = images;
-	loadNext();
+    mPd->show();
 
+    this->mForceSave = forceSave;
+    this->mImages = images;
+    loadNext();
 }
 
-void DkThumbsSaver::thumbLoaded(bool) {
-
-	mNumSaved++;
-	emit numFilesSignal(mNumSaved);
+void DkThumbsSaver::thumbLoaded(bool)
+{
+    mNumSaved++;
+    emit numFilesSignal(mNumSaved);
 
-	if (mNumSaved == mImages.size() || mStop) {
-		if (mPd) {
-			mPd->close();
-			mPd->deleteLater();
-			mPd = 0;
-		}
-		mStop = true;
-	}
-	else
-		loadNext();
+    if (mNumSaved == mImages.size() || mStop) {
+        if (mPd) {
+            mPd->close();
+            mPd->deleteLater();
+            mPd = 0;
+        }
+        mStop = true;
+    } else
+        loadNext();
 }
 
-void DkThumbsSaver::loadNext() {
-	
-	if (mStop)
-		return;
+void DkThumbsSaver::loadNext()
+{
+    if (mStop)
+        return;
 
-	int force = (mForceSave) ? DkThumbNail::force_save_thumb : DkThumbNail::save_thumb;
+    int force = (mForceSave) ? DkThumbNail::force_save_thumb : DkThumbNail::save_thumb;
 
-	for (int idx = 0; idx < mImages.size(); idx++) {
-		connect(mImages.at(idx)->getThumb().data(), SIGNAL(thumbLoadedSignal(bool)), this, SLOT(thumbLoaded(bool)));
-		mImages.at(idx)->getThumb()->fetchThumb(force);
-	}
+    for (int idx = 0; idx < mImages.size(); idx++) {
+        connect(mImages.at(idx)->getThumb().data(), SIGNAL(thumbLoadedSignal(bool)), this, SLOT(thumbLoaded(bool)));
+        mImages.at(idx)->getThumb()->fetchThumb(force);
+    }
 }
 
-void DkThumbsSaver::stopProgress() {
-
-	mStop = true;
+void DkThumbsSaver::stopProgress()
+{
+    mStop = true;
 }
 
 // DkFileSystemModel --------------------------------------------------------------------
-DkFileSystemModel::DkFileSystemModel(QObject* parent /* = 0 */) : QFileSystemModel(parent) {
-
-	// some custom settings
-	setRootPath(QDir::rootPath());
-	setNameFilters(DkSettingsManager::param().app().fileFilters);
-	setReadOnly(false);
+DkFileSystemModel::DkFileSystemModel(QObject *parent /* = 0 */)
+    : QFileSystemModel(parent)
+{
+    // some custom settings
+    setRootPath(QDir::rootPath());
+    setNameFilters(DkSettingsManager::param().app().fileFilters);
+    setReadOnly(false);
 }
 
 // DkSortFileProxyModel --------------------------------------------------------------------
-DkSortFileProxyModel::DkSortFileProxyModel(QObject* parent /* = 0 */) : QSortFilterProxyModel(parent) {
-
+DkSortFileProxyModel::DkSortFileProxyModel(QObject *parent /* = 0 */)
+    : QSortFilterProxyModel(parent)
+{
 }
 
-bool DkSortFileProxyModel::lessThan(const QModelIndex& left, const QModelIndex& right) const {
+bool DkSortFileProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
+{
+    if (left.data().canConvert(QMetaType::QUrl)) {
+        QFileInfo lf = QFileInfo(left.data().toString());
+        QFileInfo rf = QFileInfo(right.data().toString());
 
-	if (left.data().canConvert(QVariant::Url)) {
+        // could not find a better way to tell files from dirs appart (isDir() is not what we expect)
+        if (lf.suffix().isEmpty() && !rf.suffix().isEmpty())
+            return true;
+        else if (!lf.suffix().isEmpty() && rf.suffix().isEmpty())
+            return false;
 
-		QFileInfo lf = left.data().toString();
-		QFileInfo rf = right.data().toString();
+        QString ls = (!lf.fileName().isEmpty()) ? lf.fileName() : lf.absoluteFilePath(); // otherwise e.g. C: is empty
+        QString rs = (!rf.fileName().isEmpty()) ? rf.fileName() : rf.absoluteFilePath();
 
-		// could not find a better way to tell files from dirs appart (isDir() is not what we expect)
-		if (lf.suffix().isEmpty() && !rf.suffix().isEmpty())
-			return true;
-		else if (!lf.suffix().isEmpty() && rf.suffix().isEmpty())
-			return false;		
+        QString ld = ls.section(QRegularExpression("[A-Z]:"), 1, -1, QString::SectionIncludeLeadingSep);
 
+        // sort by drive letter if present
+        if (!ld.isEmpty()) {
+            ld.truncate(2);
+            ls = ld;
+        }
 
-		QString ls = (!lf.fileName().isEmpty()) ? lf.fileName() : lf.absoluteFilePath();	// otherwise e.g. C: is empty
-		QString rs = (!rf.fileName().isEmpty()) ? rf.fileName() : rf.absoluteFilePath();
-
-		QString ld = ls.section(QRegExp("[A-Z]:"), 1, -1, QString::SectionIncludeLeadingSep);
-		
-		// sort by drive letter if present
-		if (!ld.isEmpty()) {
-			ld.truncate(2);
-			ls = ld;
-		}
-
-		QString rd = rs.section(QRegExp("[A-Z]:"), 1, -1, QString::SectionIncludeLeadingSep);
+        QString rd = rs.section(QRegularExpression("[A-Z]:"), 1, -1, QString::SectionIncludeLeadingSep);
 
-		// sort by drive letter if present
-		if (!rd.isEmpty()) {
-			rd.truncate(2);
-			rs = rd;
-		}
+        // sort by drive letter if present
+        if (!rd.isEmpty()) {
+            rd.truncate(2);
+            rs = rd;
+        }
 
-		return DkUtils::compLogicQString(ls, rs);
-	}
+        return DkUtils::compLogicQString(ls, rs);
+    }
 
-	return QSortFilterProxyModel::lessThan(left, right);
+    return QSortFilterProxyModel::lessThan(left, right);
 }
 
-// -------------------------------------------------------------------- DkBrowseExplorer 
-DkBrowseExplorer::DkBrowseExplorer(
-	const QString& title,
-	QWidget* parent,
-	Qt::WindowFlags flags) : DkExplorer(title, parent, flags) {
-
-	createLayout();
-	readSettings();
+// -------------------------------------------------------------------- DkBrowseExplorer
+DkBrowseExplorer::DkBrowseExplorer(const QString &title, QWidget *parent, Qt::WindowFlags flags)
+    : DkExplorer(title, parent, flags)
+{
+    createLayout();
+    readSettings();
 
-	connect(mRootPathBrowseButton, SIGNAL(clicked()), this, SLOT(browseClicked()));
+    connect(mRootPathBrowseButton, SIGNAL(clicked()), this, SLOT(browseClicked()));
 }
 
-DkBrowseExplorer::~DkBrowseExplorer() {
-
-	writeSettings();
+DkBrowseExplorer::~DkBrowseExplorer()
+{
+    writeSettings();
 }
 
-void DkBrowseExplorer::browseClicked() {
-
-	QString root = QFileDialog::getExistingDirectory(
-		this,
-		tr("Choose Root Directory"),
-		mRootPath,
-		QFileDialog::ShowDirsOnly | DkDialog::fileDialogOptions()
-	);
+void DkBrowseExplorer::browseClicked()
+{
+    QString root = QFileDialog::getExistingDirectory(this, tr("Choose Root Directory"), mRootPath, QFileDialog::ShowDirsOnly | DkDialog::fileDialogOptions());
 
-	if (root != "")
-		setRootPath(root);
+    if (root != "")
+        setRootPath(root);
 }
 
-void DkBrowseExplorer::setRootPath(const QString& root) {
-
-	mRootPath = root;
-	mFileTree->setRootIndex(mSortModel->mapFromSource(mFileModel->index(root)));
-	mFileModel->setRootPath(root);
-	mRootPathLabel->setText(root);
-	mRootPathLabel->setToolTip(root);
+void DkBrowseExplorer::setRootPath(const QString &root)
+{
+    mRootPath = root;
+    mFileTree->setRootIndex(mSortModel->mapFromSource(mFileModel->index(root)));
+    mFileModel->setRootPath(root);
+    mRootPathLabel->setText(root);
+    mRootPathLabel->setToolTip(root);
 }
 
-void DkBrowseExplorer::createLayout() {
+void DkBrowseExplorer::createLayout()
+{
+    QWidget *rootPathWidget = new QWidget(this);
+    QHBoxLayout *rpLayout = new QHBoxLayout(rootPathWidget);
+    mRootPathLabel = new DkElidedLabel(rootPathWidget, "");
+    mRootPathBrowseButton = new QPushButton(tr("Browse"));
+    rpLayout->setContentsMargins(4, 2, 2, 2);
+    rpLayout->addWidget(mRootPathLabel, 1);
+    rpLayout->addWidget(mRootPathBrowseButton);
 
-	QWidget* rootPathWidget = new QWidget(this);
-	QHBoxLayout* rpLayout = new QHBoxLayout(rootPathWidget);
-	mRootPathLabel = new DkElidedLabel(rootPathWidget, "");
-	mRootPathBrowseButton = new QPushButton(tr("Browse"));
-	rpLayout->setContentsMargins(4, 2, 2, 2);
-	rpLayout->addWidget(mRootPathLabel, 1);
-	rpLayout->addWidget(mRootPathBrowseButton);
-
-	mLayout->insertWidget(0, rootPathWidget);
+    mLayout->insertWidget(0, rootPathWidget);
 }
 
-void DkBrowseExplorer::readSettings() {
-
-	DefaultSettings settings;
-	settings.beginGroup(objectName());
-	setRootPath(settings.value("RootPath", QDir::homePath()).toString());
-	settings.endGroup();
+void DkBrowseExplorer::readSettings()
+{
+    DefaultSettings settings;
+    settings.beginGroup(objectName());
+    setRootPath(settings.value("RootPath", QDir::homePath()).toString());
+    settings.endGroup();
 }
 
-void DkBrowseExplorer::writeSettings() {
-
-	DefaultSettings settings;
-	settings.beginGroup(objectName());
-	settings.setValue("RootPath", mRootPath);
-	settings.endGroup();
+void DkBrowseExplorer::writeSettings()
+{
+    DefaultSettings settings;
+    settings.beginGroup(objectName());
+    settings.setValue("RootPath", mRootPath);
+    settings.endGroup();
 }
 
 // DkExplorer --------------------------------------------------------------------
-DkExplorer::DkExplorer(const QString& title, QWidget* parent /* = 0 */, Qt::WindowFlags flags /* = 0 */) : DkDockWidget(title, parent, flags) {
+DkExplorer::DkExplorer(const QString &title, QWidget *parent /* = 0 */, Qt::WindowFlags flags /* = 0 */)
+    : DkDockWidget(title, parent, flags)
+{
+    setObjectName("DkExplorer");
+    createLayout();
+    readSettings();
 
-	setObjectName("DkExplorer");
-	createLayout();
-	readSettings();
+    // open selected images
+    QAction *selAction = new QAction(tr("Open Image"), this);
+    selAction->setShortcut(Qt::Key_Return);
+    selAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+    connect(selAction, SIGNAL(triggered()), this, SLOT(openSelected()));
 
-	// open selected images
-	QAction* selAction = new QAction(tr("Open Image"), this);
-	selAction->setShortcut(Qt::Key_Return);
-	selAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
-	connect(selAction, SIGNAL(triggered()), this, SLOT(openSelected()));
-	
-	connect(mFileTree, SIGNAL(clicked(const QModelIndex&)), this, SLOT(fileClicked(const QModelIndex&)));
-	
-	addAction(selAction);
+    connect(mFileTree, SIGNAL(clicked(const QModelIndex &)), this, SLOT(fileClicked(const QModelIndex &)));
 
-	if (mLoadSelected)
-		connect(mFileTree->selectionModel(), SIGNAL(currentChanged(const QModelIndex&, const QModelIndex&)), this, SLOT(fileClicked(const QModelIndex&)), Qt::UniqueConnection);
+    addAction(selAction);
+
+    if (mLoadSelected)
+        connect(mFileTree->selectionModel(),
+                SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
+                this,
+                SLOT(fileClicked(const QModelIndex &)),
+                Qt::UniqueConnection);
 }
 
-DkExplorer::~DkExplorer() {
-	
-	// save settings
-	writeSettings();
+DkExplorer::~DkExplorer()
+{
+    // save settings
+    writeSettings();
 }
 
-void DkExplorer::createLayout() {
+void DkExplorer::createLayout()
+{
+    mFileModel = new DkFileSystemModel(this);
 
-	mFileModel = new DkFileSystemModel(this);
-	
-	mSortModel = new DkSortFileProxyModel(this);
-	mSortModel->setSourceModel(mFileModel);
-	mSortModel->setSortLocaleAware(true);
-	
-	mFileTree = new QTreeView(this);
-	mFileTree->setSortingEnabled(true);
-	mFileTree->setModel(mSortModel);
-	mFileTree->setDragEnabled(true);
-	mFileTree->setAcceptDrops(true);
+    mSortModel = new DkSortFileProxyModel(this);
+    mSortModel->setSourceModel(mFileModel);
+    mSortModel->setSortLocaleAware(true);
 
-	// by default descendingOrder is set
-	mFileTree->header()->setSortIndicator(0, Qt::AscendingOrder);
-	mFileTree->header()->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
+    mFileTree = new QTreeView(this);
+    mFileTree->setSortingEnabled(true);
+    mFileTree->setModel(mSortModel);
+    mFileTree->setDragEnabled(true);
+    mFileTree->setAcceptDrops(true);
 
-	QWidget* widget = new QWidget(this);
-	mLayout = new QVBoxLayout(widget);
-	mLayout->setContentsMargins(0, 0, 0, 0);
-	mLayout->setSpacing(0);
-	mLayout->addWidget(mFileTree);
-	setWidget(widget);
-}
+    // by default descendingOrder is set
+    mFileTree->header()->setSortIndicator(0, Qt::AscendingOrder);
+    mFileTree->header()->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
 
-void DkExplorer::setCurrentImage(QSharedPointer<DkImageContainerT> img) {
+    QWidget *widget = new QWidget(this);
+    mLayout = new QVBoxLayout(widget);
+    mLayout->setContentsMargins(0, 0, 0, 0);
+    mLayout->setSpacing(0);
+    mLayout->addWidget(mFileTree);
+    setWidget(widget);
+}
 
-	if (!img)
-		return;
+void DkExplorer::setCurrentImage(QSharedPointer<DkImageContainerT> img)
+{
+    if (!img)
+        return;
 
-	setCurrentPath(img->filePath());
+    setCurrentPath(img->filePath());
 }
 
-void DkExplorer::setCurrentPath(const QString& filePath) {
+void DkExplorer::setCurrentPath(const QString &filePath)
+{
+    // expand folders
+    if (QFileInfo(filePath).isDir())
+        mFileTree->expand(mSortModel->mapFromSource(mFileModel->index(filePath)));
 
-	// expand folders
-	if (QFileInfo(filePath).isDir())
-		mFileTree->expand(mSortModel->mapFromSource(mFileModel->index(filePath)));
-
-	mFileTree->setCurrentIndex(mSortModel->mapFromSource(mFileModel->index(filePath)));
+    mFileTree->setCurrentIndex(mSortModel->mapFromSource(mFileModel->index(filePath)));
 }
 
-void DkExplorer::fileClicked(const QModelIndex &index) const {
-
-	QFileInfo cFile = mFileModel->fileInfo(mSortModel->mapToSource(index));
+void DkExplorer::fileClicked(const QModelIndex &index) const
+{
+    QFileInfo cFile = mFileModel->fileInfo(mSortModel->mapToSource(index));
 
-	qDebug() << "opening: " << cFile.absoluteFilePath();
+    qDebug() << "opening: " << cFile.absoluteFilePath();
 
-	if (DkUtils::isValid(cFile))
-		emit openFile(cFile.absoluteFilePath());
-	else if (cFile.isDir())
-		emit openDir(cFile.absoluteFilePath());
+    if (DkUtils::isValid(cFile))
+        emit openFile(cFile.absoluteFilePath());
+    else if (cFile.isDir())
+        emit openDir(cFile.absoluteFilePath());
 }
 
-void DkExplorer::contextMenuEvent(QContextMenuEvent *event) {
-
-	QMenu* cm = new QMenu(this);
+void DkExplorer::contextMenuEvent(QContextMenuEvent *event)
+{
+    QMenu *cm = new QMenu(this);
 
-	// enable editing
-	QAction* editAction = new QAction(tr("Editable"), this);
-	editAction->setCheckable(true);
-	editAction->setChecked(!mFileModel->isReadOnly());
-	connect(editAction, SIGNAL(triggered(bool)), this, SLOT(setEditable(bool)));
+    // enable editing
+    QAction *editAction = new QAction(tr("Editable"), this);
+    editAction->setCheckable(true);
+    editAction->setChecked(!mFileModel->isReadOnly());
+    connect(editAction, SIGNAL(triggered(bool)), this, SLOT(setEditable(bool)));
 
-	// open selected images
-	QAction* selAction = new QAction(tr("Open Selected Image"), this);
-	selAction->setCheckable(true);
-	selAction->setChecked(mLoadSelected);
-	connect(selAction, SIGNAL(triggered(bool)), this, SLOT(loadSelectedToggled(bool)));
+    // open selected images
+    QAction *selAction = new QAction(tr("Open Selected Image"), this);
+    selAction->setCheckable(true);
+    selAction->setChecked(mLoadSelected);
+    connect(selAction, SIGNAL(triggered(bool)), this, SLOT(loadSelectedToggled(bool)));
 
-	cm->addAction(editAction);
-	cm->addAction(selAction);
-	cm->addSeparator();
+    cm->addAction(editAction);
+    cm->addAction(selAction);
+    cm->addSeparator();
 
-	// adjust sizes
-	QAction* sizeAction = new QAction(tr("Adjust Columns"), this);
-	connect(sizeAction, SIGNAL(triggered()), this, SLOT(adjustColumnWidth()));
+    // adjust sizes
+    QAction *sizeAction = new QAction(tr("Adjust Columns"), this);
+    connect(sizeAction, SIGNAL(triggered()), this, SLOT(adjustColumnWidth()));
 
-	cm->addAction(sizeAction);
-	cm->addSeparator();
+    cm->addAction(sizeAction);
+    cm->addSeparator();
 
-	mColumnActions.clear();	// quick&dirty
+    mColumnActions.clear(); // quick&dirty
 
-	for (int idx = 0; idx < mFileModel->columnCount(); idx++) {
+    for (int idx = 0; idx < mFileModel->columnCount(); idx++) {
+        QAction *action = new QAction(mFileModel->headerData(idx, Qt::Horizontal).toString(), this);
+        action->setCheckable(true);
+        action->setChecked(!mFileTree->isColumnHidden(idx));
+        action->setObjectName(QString::number(idx));
 
-		QAction* action = new QAction(mFileModel->headerData(idx, Qt::Horizontal).toString(), this);
-		action->setCheckable(true);
-		action->setChecked(!mFileTree->isColumnHidden(idx));
-		action->setObjectName(QString::number(idx));
+        connect(action, SIGNAL(toggled(bool)), this, SLOT(showColumn(bool)));
+        mColumnActions.push_back(action);
 
-		connect(action, SIGNAL(toggled(bool)), this, SLOT(showColumn(bool)));
-		mColumnActions.push_back(action);
-
-		cm->addAction(action);
-	}
+        cm->addAction(action);
+    }
 
-	cm->exec(event->globalPos());	
+    cm->exec(event->globalPos());
 }
 
-void DkExplorer::showColumn(bool show) {
-
-	bool ok = false;
-	int idx = QObject::sender()->objectName().toInt(&ok);
+void DkExplorer::showColumn(bool show)
+{
+    bool ok = false;
+    int idx = QObject::sender()->objectName().toInt(&ok);
 
-	if (!ok)
-		return;
+    if (!ok)
+        return;
 
-	mFileTree->setColumnHidden(idx, !show);
+    mFileTree->setColumnHidden(idx, !show);
 }
 
-void DkExplorer::loadSelectedToggled(bool checked) {
+void DkExplorer::loadSelectedToggled(bool checked)
+{
+    mLoadSelected = checked;
 
-	mLoadSelected = checked;
-
-	if (mLoadSelected)
-		connect(mFileTree->selectionModel(), SIGNAL(currentChanged(const QModelIndex&, const QModelIndex&)), this, SLOT(fileClicked(const QModelIndex&)), Qt::UniqueConnection);
-	else
-		disconnect(mFileTree->selectionModel(), SIGNAL(currentChanged(const QModelIndex&, const QModelIndex&)), this, SLOT(fileClicked(const QModelIndex&)));
+    if (mLoadSelected)
+        connect(mFileTree->selectionModel(),
+                SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
+                this,
+                SLOT(fileClicked(const QModelIndex &)),
+                Qt::UniqueConnection);
+    else
+        disconnect(mFileTree->selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(fileClicked(const QModelIndex &)));
 }
 
-void DkExplorer::openSelected() {
-	
-	auto index = mFileTree->selectionModel()->currentIndex();
-	QFileInfo cFile = mFileModel->fileInfo(mSortModel->mapToSource(index));
-	qDebug() << "opening: " << cFile.absoluteFilePath();
-
-	if (DkUtils::isValid(cFile))
-		emit openFile(cFile.absoluteFilePath());
-	else if (cFile.isDir())
-		emit openDir(cFile.absoluteFilePath());
+void DkExplorer::openSelected()
+{
+    auto index = mFileTree->selectionModel()->currentIndex();
+    QFileInfo cFile = mFileModel->fileInfo(mSortModel->mapToSource(index));
+    qDebug() << "opening: " << cFile.absoluteFilePath();
 
+    if (DkUtils::isValid(cFile))
+        emit openFile(cFile.absoluteFilePath());
+    else if (cFile.isDir())
+        emit openDir(cFile.absoluteFilePath());
 }
 
-void DkExplorer::setEditable(bool editable) {
-	mFileModel->setReadOnly(!editable);	
+void DkExplorer::setEditable(bool editable)
+{
+    mFileModel->setReadOnly(!editable);
 }
 
-void DkExplorer::adjustColumnWidth() {
-
-	for (int idx = 0; idx < mFileTree->model()->columnCount(); idx++)
-		mFileTree->resizeColumnToContents(idx);
-	qDebug() << "size adjusted...";
+void DkExplorer::adjustColumnWidth()
+{
+    for (int idx = 0; idx < mFileTree->model()->columnCount(); idx++)
+        mFileTree->resizeColumnToContents(idx);
+    qDebug() << "size adjusted...";
 }
 
-void DkExplorer::closeEvent(QCloseEvent* event) {
-
-	writeSettings();
-	DkDockWidget::closeEvent(event);
+void DkExplorer::closeEvent(QCloseEvent *event)
+{
+    writeSettings();
+    DkDockWidget::closeEvent(event);
 }
 
-void DkExplorer::writeSettings() {
+void DkExplorer::writeSettings()
+{
+    DefaultSettings settings;
+    settings.beginGroup(objectName());
 
-	DefaultSettings settings;
-	settings.beginGroup(objectName());
-	
-	for (int idx = 0; idx < mFileModel->columnCount(QModelIndex()); idx++) {
-		QString headerVal = mFileModel->headerData(idx, Qt::Horizontal).toString();
-		settings.setValue(headerVal + "Size", mFileTree->columnWidth(idx));
-		settings.setValue(headerVal + "Hidden", mFileTree->isColumnHidden(idx));
-	}
+    for (int idx = 0; idx < mFileModel->columnCount(QModelIndex()); idx++) {
+        QString headerVal = mFileModel->headerData(idx, Qt::Horizontal).toString();
+        settings.setValue(headerVal + "Size", mFileTree->columnWidth(idx));
+        settings.setValue(headerVal + "Hidden", mFileTree->isColumnHidden(idx));
+    }
 
-	settings.setValue("LoadSelected", mLoadSelected);
-	settings.setValue("ReadOnly", mFileModel->isReadOnly());
-	settings.endGroup();
+    settings.setValue("LoadSelected", mLoadSelected);
+    settings.setValue("ReadOnly", mFileModel->isReadOnly());
+    settings.endGroup();
 }
 
-void DkExplorer::readSettings() {
+void DkExplorer::readSettings()
+{
+    DefaultSettings settings;
+    settings.beginGroup(objectName());
 
-	DefaultSettings settings;
-	settings.beginGroup(objectName());
+    for (int idx = 0; idx < mFileModel->columnCount(QModelIndex()); idx++) {
+        QString headerVal = mFileModel->headerData(idx, Qt::Horizontal).toString();
 
-	for (int idx = 0; idx < mFileModel->columnCount(QModelIndex()); idx++) {
-		
-		QString headerVal = mFileModel->headerData(idx, Qt::Horizontal).toString();
-		
-		int colWidth = settings.value(headerVal + "Size", -1).toInt();
-		if (colWidth != -1) 
-			mFileTree->setColumnWidth(idx, colWidth);
+        int colWidth = settings.value(headerVal + "Size", -1).toInt();
+        if (colWidth != -1)
+            mFileTree->setColumnWidth(idx, colWidth);
 
-		bool showCol = idx != 0;	// by default, show the first column only
-		mFileTree->setColumnHidden(idx, settings.value(headerVal + "Hidden", showCol).toBool());
-	}
+        bool showCol = idx != 0; // by default, show the first column only
+        mFileTree->setColumnHidden(idx, settings.value(headerVal + "Hidden", showCol).toBool());
+    }
 
-	mLoadSelected = settings.value("LoadSelected", mLoadSelected).toBool();
-	mFileModel->setReadOnly(settings.value("ReadOnly", true).toBool());
-	settings.endGroup();
+    mLoadSelected = settings.value("LoadSelected", mLoadSelected).toBool();
+    mFileModel->setReadOnly(settings.value("ReadOnly", true).toBool());
+    settings.endGroup();
 }
 
 // DkOverview --------------------------------------------------------------------
-DkOverview::DkOverview(QWidget* parent) : QLabel(parent) {
-
-	setObjectName("DkOverview");
-	setMinimumSize(0, 0);
-	setMaximumSize(200, 200);
-	setCursor(Qt::ArrowCursor);
-	setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
-}
-
-void DkOverview::paintEvent(QPaintEvent *event) {
-
-	if (mImgT.isNull()) {
-		mImgT = resizedImg(mImg);
-		mImg = QImage();	// free-up space
-	}
-
-	if (!mImgMatrix || !mWorldMatrix)
-		return;
-
-	QPainter painter(this);
-
-	int lm, tm, rm, bm;
-	getContentsMargins(&lm, &tm, &rm, &bm);
-
-	QSize viewSize = QSize(width()-lm-rm, height()-tm-bm);	// overview shall take 15% of the mViewport....
-	
-	if (viewSize.width() > 2 && viewSize.height() > 2) {
-	
-		QTransform overviewImgMatrix = getScaledImageMatrix();			// matrix that always resizes the image to the current mViewport
-		QRectF overviewImgRect = getScaledImageMatrix().mapRect(QRectF(QPointF(), mImgSize));
-
-		// now render the current view
-		QRectF viewRect = mViewPortRect;
-		viewRect = mWorldMatrix->inverted().mapRect(viewRect);
-		viewRect = mImgMatrix->inverted().mapRect(viewRect);
-		viewRect = overviewImgMatrix.mapRect(viewRect);
-		viewRect.moveTopLeft(viewRect.topLeft()+QPointF(lm, tm));
-
-		if(viewRect.topLeft().x() < overviewImgRect.topLeft().x()) viewRect.setTopLeft(QPointF(overviewImgRect.topLeft().x(), viewRect.topLeft().y()));
-		if(viewRect.topLeft().y() < overviewImgRect.topLeft().y()) viewRect.setTopLeft(QPointF(viewRect.topLeft().x(), overviewImgRect.topLeft().y()));
-		if(viewRect.bottomRight().x() > overviewImgRect.bottomRight().x()) viewRect.setBottomRight(QPointF(overviewImgRect.bottomRight().x()-1, viewRect.bottomRight().y()));
-		if(viewRect.bottomRight().y() > overviewImgRect.bottomRight().y()) viewRect.setBottomRight(QPointF(viewRect.bottomRight().x(), overviewImgRect.bottomRight().y()-1));		
-
-		//draw the image's location
-		painter.setRenderHints(QPainter::SmoothPixmapTransform);
-		painter.setBrush(DkSettingsManager::param().display().hudBgColor);
-		painter.setPen(QColor(200, 200, 200));
-		//painter.drawRect(overviewRect);
-		painter.setOpacity(0.8f);
-		painter.drawImage(overviewImgRect, mImgT, QRect(0, 0, mImgT.width(), mImgT.height()));
-
-		QColor col = DkSettingsManager::param().display().highlightColor;
-		col.setAlpha(255);
-		painter.setPen(col);
-		col.setAlpha(50);
-		painter.setBrush(col);
-
-		if (viewRect.width()+1 < overviewImgRect.width() || viewRect.height()+1 < overviewImgRect.height())	// draw viewrect if we do not see all parts of the image
-			painter.drawRect(viewRect);
+DkOverview::DkOverview(QWidget *parent)
+    : QLabel(parent)
+{
+    setObjectName("DkOverview");
+    setMinimumSize(0, 0);
+    setMaximumSize(200, 200);
+    setCursor(Qt::ArrowCursor);
+    setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+}
+
+void DkOverview::paintEvent(QPaintEvent *event)
+{
+    if (mImgT.isNull()) {
+        mImgT = resizedImg(mImg);
+        mImg = QImage(); // free-up space
+    }
 
-	}
-	painter.end();
+    if (!mImgMatrix || !mWorldMatrix)
+        return;
+
+    QPainter painter(this);
+
+    int lm = 0;
+    int tm = 0;
+    int rm = 0;
+    int bm = 0;
+    if (layout() != nullptr)
+        layout()->getContentsMargins(&lm, &tm, &rm, &bm);
+
+    QSize viewSize = QSize(width() - lm - rm, height() - tm - bm); // overview shall take 15% of the mViewport....
+
+    if (viewSize.width() > 2 && viewSize.height() > 2) {
+        QTransform overviewImgMatrix = getScaledImageMatrix(); // matrix that always resizes the image to the current mViewport
+        QRectF overviewImgRect = getScaledImageMatrix().mapRect(QRectF(QPointF(), mImgSize));
+
+        // now render the current view
+        QRectF viewRect = mViewPortRect;
+        viewRect = mWorldMatrix->inverted().mapRect(viewRect);
+        viewRect = mImgMatrix->inverted().mapRect(viewRect);
+        viewRect = overviewImgMatrix.mapRect(viewRect);
+        viewRect.moveTopLeft(viewRect.topLeft() + QPointF(lm, tm));
+
+        if (viewRect.topLeft().x() < overviewImgRect.topLeft().x())
+            viewRect.setTopLeft(QPointF(overviewImgRect.topLeft().x(), viewRect.topLeft().y()));
+        if (viewRect.topLeft().y() < overviewImgRect.topLeft().y())
+            viewRect.setTopLeft(QPointF(viewRect.topLeft().x(), overviewImgRect.topLeft().y()));
+        if (viewRect.bottomRight().x() > overviewImgRect.bottomRight().x())
+            viewRect.setBottomRight(QPointF(overviewImgRect.bottomRight().x() - 1, viewRect.bottomRight().y()));
+        if (viewRect.bottomRight().y() > overviewImgRect.bottomRight().y())
+            viewRect.setBottomRight(QPointF(viewRect.bottomRight().x(), overviewImgRect.bottomRight().y() - 1));
+
+        // draw the image's location
+        painter.setRenderHints(QPainter::SmoothPixmapTransform);
+        painter.setBrush(DkSettingsManager::param().display().hudBgColor);
+        painter.setPen(QColor(200, 200, 200));
+        // painter.drawRect(overviewRect);
+        painter.setOpacity(0.8f);
+        painter.drawImage(overviewImgRect, mImgT, QRect(0, 0, mImgT.width(), mImgT.height()));
+
+        QColor col = DkSettingsManager::param().display().highlightColor;
+        col.setAlpha(255);
+        painter.setPen(col);
+        col.setAlpha(50);
+        painter.setBrush(col);
+
+        if (viewRect.width() + 1 < overviewImgRect.width()
+            || viewRect.height() + 1 < overviewImgRect.height()) // draw viewrect if we do not see all parts of the image
+            painter.drawRect(viewRect);
+    }
+    painter.end();
 
-	QWidget::paintEvent(event);
+    QWidget::paintEvent(event);
 }
 
-void DkOverview::mousePressEvent(QMouseEvent *event) {
-	
-	mEnterPos = event->pos();
-	mPosGrab = event->pos();
+void DkOverview::mousePressEvent(QMouseEvent *event)
+{
+    mEnterPos = event->pos();
+    mPosGrab = event->pos();
 }
 
-void DkOverview::mouseReleaseEvent(QMouseEvent *event) {
-
-	QPointF dxy = mEnterPos-QPointF(event->pos());
+void DkOverview::mouseReleaseEvent(QMouseEvent *event)
+{
+    QPointF dxy = mEnterPos - QPointF(event->pos());
 
-	if (dxy.manhattanLength() < 4) {
-		
-		int lm, tm, rm, bm;
-		getContentsMargins(&lm, &tm, &rm, &bm);
-		
-		// move to the current position
-		QRectF viewRect = mViewPortRect;
-		viewRect = mWorldMatrix->inverted().mapRect(viewRect);
-		viewRect = mImgMatrix->inverted().mapRect(viewRect);
-		viewRect = getScaledImageMatrix().mapRect(viewRect);
-		QPointF currentViewPoint = viewRect.center();
+    if (dxy.manhattanLength() < 4) {
+        int lm = 0;
+        int tm = 0;
+        int rm = 0;
+        int bm = 0;
+        if (layout() != nullptr)
+            layout()->getContentsMargins(&lm, &tm, &rm, &bm);
 
-		float panningSpeed = (float)-(mWorldMatrix->m11()/(getScaledImageMatrix().m11()/mImgMatrix->m11()));
+        // move to the current position
+        QRectF viewRect = mViewPortRect;
+        viewRect = mWorldMatrix->inverted().mapRect(viewRect);
+        viewRect = mImgMatrix->inverted().mapRect(viewRect);
+        viewRect = getScaledImageMatrix().mapRect(viewRect);
+        QPointF currentViewPoint = viewRect.center();
 
-		QPointF cPos = event->pos()-QPointF(lm, tm);
-		QPointF lDxy = (cPos - currentViewPoint)/mWorldMatrix->m11()*panningSpeed;
-		emit moveViewSignal(lDxy);
+        float panningSpeed = (float)-(mWorldMatrix->m11() / (getScaledImageMatrix().m11() / mImgMatrix->m11()));
 
-		if (event->modifiers() == DkSettingsManager::param().global().altMod)
-			emit sendTransformSignal();
-	}
+        QPointF cPos = event->pos() - QPointF(lm, tm);
+        QPointF lDxy = (cPos - currentViewPoint) / mWorldMatrix->m11() * panningSpeed;
+        emit moveViewSignal(lDxy);
 
+        if (event->modifiers() == DkSettingsManager::param().global().altMod)
+            emit sendTransformSignal();
+    }
 }
 
-void DkOverview::mouseMoveEvent(QMouseEvent *event) {
-
-	if (event->buttons() != Qt::LeftButton)
-		return;
-
-	float panningSpeed = (float)-(mWorldMatrix->m11()/(getScaledImageMatrix().m11()/mImgMatrix->m11()));
+void DkOverview::mouseMoveEvent(QMouseEvent *event)
+{
+    if (event->buttons() != Qt::LeftButton)
+        return;
 
-	QPointF cPos = event->pos();
-	QPointF dxy = (cPos - mPosGrab)/mWorldMatrix->m11()*panningSpeed;
-	mPosGrab = cPos;
-	emit moveViewSignal(dxy);
+    float panningSpeed = (float)-(mWorldMatrix->m11() / (getScaledImageMatrix().m11() / mImgMatrix->m11()));
 
-	if (event->modifiers() == DkSettingsManager::param().global().altMod)
-		emit sendTransformSignal();
+    QPointF cPos = event->pos();
+    QPointF dxy = (cPos - mPosGrab) / mWorldMatrix->m11() * panningSpeed;
+    mPosGrab = cPos;
+    emit moveViewSignal(dxy);
 
+    if (event->modifiers() == DkSettingsManager::param().global().altMod)
+        emit sendTransformSignal();
 }
 
-QRectF DkOverview::getImageRect() const {
-	
-	QRectF imgRect = QRectF(QPoint(), size());			// get the overview rect
+QRectF DkOverview::getImageRect() const
+{
+    QRectF imgRect = QRectF(QPoint(), size()); // get the overview rect
 
-	if ((float)mImgT.width()/mImgT.height() < (float)imgRect.width()/imgRect.height())
-		imgRect.setWidth(width() * (float)height()/(float)mImgT.height());
-	else
-		imgRect.setHeight(height() * (float)width()/(float)mImgT.width());
+    if ((float)mImgT.width() / mImgT.height() < (float)imgRect.width() / imgRect.height())
+        imgRect.setWidth(width() * (float)height() / (float)mImgT.height());
+    else
+        imgRect.setHeight(height() * (float)width() / (float)mImgT.width());
 
-	return imgRect;
+    return imgRect;
 }
 
-QImage DkOverview::resizedImg(const QImage& src) {
+QImage DkOverview::resizedImg(const QImage &src)
+{
+    if (src.isNull())
+        return QImage();
 
-	if (src.isNull())
-		return QImage();
+    QTransform overviewImgMatrix = getScaledImageMatrix(); // matrix that always resizes the image to the current mViewport
 
-	QTransform overviewImgMatrix = getScaledImageMatrix();			// matrix that always resizes the image to the current mViewport
-	
-	// is the overviewImgMatrix empty?
-	if (overviewImgMatrix.isIdentity())
-		return src;
-	
-	// fast downscaling
-	QImage sImg = src.scaled(maximumWidth()*2, maximumHeight()*2, Qt::KeepAspectRatio, Qt::FastTransformation);
-	sImg = sImg.scaled(maximumWidth(), maximumHeight(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
+    // is the overviewImgMatrix empty?
+    if (overviewImgMatrix.isIdentity())
+        return src;
 
-	return sImg;
-}
+    // fast downscaling
+    QImage sImg = src.scaled(maximumWidth() * 2, maximumHeight() * 2, Qt::KeepAspectRatio, Qt::FastTransformation);
+    sImg = sImg.scaled(maximumWidth(), maximumHeight(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
 
-QTransform DkOverview::getScaledImageMatrix() {
+    return sImg;
+}
 
-	if (mImgT.isNull() && mImg.isNull())
-		return QTransform();
+QTransform DkOverview::getScaledImageMatrix()
+{
+    if (mImgT.isNull() && mImg.isNull())
+        return QTransform();
 
-	int lm, tm, rm, bm;
-	getContentsMargins(&lm, &tm, &rm, &bm);
+    int lm = 0;
+    int tm = 0;
+    int rm = 0;
+    int bm = 0;
+    if (layout() != nullptr)
+        layout()->getContentsMargins(&lm, &tm, &rm, &bm);
 
-	QSize iSize = QSize(width()-lm-rm, height()-tm-bm);	// inner size
+    QSize iSize = QSize(width() - lm - rm, height() - tm - bm); // inner size
 
-	if (iSize.width() < 2 || iSize.height() < 2)
-		return QTransform();
+    if (iSize.width() < 2 || iSize.height() < 2)
+        return QTransform();
 
-	// the image resizes as we zoom
-	QRectF imgRect = QRectF(QPoint(lm, tm), mImgSize);
-	float ratioImg = (float)(imgRect.width()/imgRect.height());
-	float ratioWin = (float)(iSize.width())/(float)(iSize.height());
+    // the image resizes as we zoom
+    QRectF imgRect = QRectF(QPoint(lm, tm), mImgSize);
+    float ratioImg = (float)(imgRect.width() / imgRect.height());
+    float ratioWin = (float)(iSize.width()) / (float)(iSize.height());
 
-	QTransform imgMatrix;
-	float s;
-	if (imgRect.width() == 0 || imgRect.height() == 0)
-		s = 1.0f;
-	else
-		s = (ratioImg > ratioWin) ? (float)(iSize.width()/imgRect.width()) : (float)(iSize.height()/imgRect.height());
+    QTransform imgMatrix;
+    float s;
+    if (imgRect.width() == 0 || imgRect.height() == 0)
+        s = 1.0f;
+    else
+        s = (ratioImg > ratioWin) ? (float)(iSize.width() / imgRect.width()) : (float)(iSize.height() / imgRect.height());
 
-	imgMatrix.scale(s, s);
+    imgMatrix.scale(s, s);
 
-	QRectF imgViewRect = imgMatrix.mapRect(imgRect);
-	imgMatrix.translate((iSize.width()-imgViewRect.width())*0.5f/s, (iSize.height()-imgViewRect.height())*0.5f/s);
+    QRectF imgViewRect = imgMatrix.mapRect(imgRect);
+    imgMatrix.translate((iSize.width() - imgViewRect.width()) * 0.5f / s, (iSize.height() - imgViewRect.height()) * 0.5f / s);
 
-	return imgMatrix;
+    return imgMatrix;
 }
 
-
 // DkZoomWidget --------------------------------------------------------------------
-DkZoomWidget::DkZoomWidget(QWidget* parent) : DkFadeLabel(parent) {
+DkZoomWidget::DkZoomWidget(QWidget *parent)
+    : DkFadeLabel(parent)
+{
+    mAutoHide = false;
+    setObjectName("DkZoomWidget");
+    createLayout();
 
-	mAutoHide = false;
-	setObjectName("DkZoomWidget");
-	createLayout();
-
-	setMinimumSize(70, 0);
-	setMaximumSize(200, 240);
-	setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
-	QMetaObject::connectSlotsByName(this);
+    setMinimumSize(70, 0);
+    setMaximumSize(200, 240);
+    setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+    QMetaObject::connectSlotsByName(this);
 }
 
-void DkZoomWidget::createLayout() {
+void DkZoomWidget::createLayout()
+{
+    mOverview = new DkOverview(this);
 
-	mOverview = new DkOverview(this);
-	
-	mSlZoom = new QSlider(Qt::Horizontal, this);
-	mSlZoom->setObjectName("slZoom");
-	mSlZoom->setCursor(Qt::ArrowCursor);
-	mSlZoom->setMinimum(0);	// add a mapping here
-	mSlZoom->setMaximum(100);
+    mSlZoom = new QSlider(Qt::Horizontal, this);
+    mSlZoom->setObjectName("slZoom");
+    mSlZoom->setCursor(Qt::ArrowCursor);
+    mSlZoom->setMinimum(0); // add a mapping here
+    mSlZoom->setMaximum(100);
 
-	mSbZoom = new QDoubleSpinBox(this);
-	mSbZoom->setObjectName("sbZoom");
-	mSbZoom->setButtonSymbols(QAbstractSpinBox::NoButtons);
-	mSbZoom->setSuffix("%");
-	mSbZoom->setDecimals(0);
-	mSbZoom->setValue(100);
-	mSbZoom->setMinimum(0.2);
-	mSbZoom->setMaximum(6000);
+    mSbZoom = new QDoubleSpinBox(this);
+    mSbZoom->setObjectName("sbZoom");
+    mSbZoom->setButtonSymbols(QAbstractSpinBox::NoButtons);
+    mSbZoom->setSuffix("%");
+    mSbZoom->setDecimals(0);
+    mSbZoom->setValue(100);
+    mSbZoom->setMinimum(0.2);
+    mSbZoom->setMaximum(6000);
 
-	QLabel* sliderWidget = new QLabel(this);
-	sliderWidget->setObjectName("DkOverviewSliderWidget");
-	QHBoxLayout* sliderLayout = new QHBoxLayout(sliderWidget);
-	sliderLayout->setContentsMargins(10,0,0,0);
-	sliderLayout->setSpacing(10);
-	sliderLayout->addWidget(mSlZoom);
-	sliderLayout->addWidget(mSbZoom);
+    QLabel *sliderWidget = new QLabel(this);
+    sliderWidget->setObjectName("DkOverviewSliderWidget");
+    QHBoxLayout *sliderLayout = new QHBoxLayout(sliderWidget);
+    sliderLayout->setContentsMargins(10, 0, 0, 0);
+    sliderLayout->setSpacing(10);
+    sliderLayout->addWidget(mSlZoom);
+    sliderLayout->addWidget(mSbZoom);
 
-	QVBoxLayout* layout = new QVBoxLayout(this);
-	//mLayout->setContentsMargins(10,10,10,10);
-	layout->setSpacing(0);
-	layout->addWidget(mOverview);
-	layout->addWidget(sliderWidget);
+    QVBoxLayout *layout = new QVBoxLayout(this);
+    // mLayout->setContentsMargins(10,10,10,10);
+    layout->setSpacing(0);
+    layout->addWidget(mOverview);
+    layout->addWidget(sliderWidget);
 }
 
-void DkZoomWidget::on_sbZoom_valueChanged(double zoomLevel) {
-	updateZoom((float)zoomLevel);
-	mAutoHide = false;
-	emit zoomSignal(zoomLevel/100.0);
+void DkZoomWidget::on_sbZoom_valueChanged(double zoomLevel)
+{
+    updateZoom((float)zoomLevel);
+    mAutoHide = false;
+    emit zoomSignal(zoomLevel / 100.0);
 }
 
-void DkZoomWidget::on_slZoom_valueChanged(int zoomLevel) {
-	double level = (zoomLevel > 50) ? (zoomLevel-50.0)/50.0 * mSbZoom->maximum() + 200.0 : zoomLevel*4.0;
-	if (level < 0.2) level = 0.2;
-	mAutoHide = false;
-	updateZoom(level);
-	emit zoomSignal(level/100.0);
+void DkZoomWidget::on_slZoom_valueChanged(int zoomLevel)
+{
+    double level = (zoomLevel > 50) ? (zoomLevel - 50.0) / 50.0 * mSbZoom->maximum() + 200.0 : zoomLevel * 4.0;
+    if (level < 0.2)
+        level = 0.2;
+    mAutoHide = false;
+    updateZoom(level);
+    emit zoomSignal(level / 100.0);
 }
 
-void DkZoomWidget::updateZoom(double zoomLevel) {
+void DkZoomWidget::updateZoom(double zoomLevel)
+{
+    mSlZoom->blockSignals(true);
+    mSbZoom->blockSignals(true);
 
-	mSlZoom->blockSignals(true);
-	mSbZoom->blockSignals(true);
-	
-	int slVal = (zoomLevel > 200.0) ? qRound(zoomLevel/mSbZoom->maximum()*50.0 + 50.0) : qRound(zoomLevel*0.25);
-	mSlZoom->setValue(slVal);
-	mSbZoom->setValue(zoomLevel);
-	mSlZoom->blockSignals(false);
-	mSbZoom->blockSignals(false);
+    int slVal = (zoomLevel > 200.0) ? qRound(zoomLevel / mSbZoom->maximum() * 50.0 + 50.0) : qRound(zoomLevel * 0.25);
+    mSlZoom->setValue(slVal);
+    mSbZoom->setValue(zoomLevel);
+    mSlZoom->blockSignals(false);
+    mSbZoom->blockSignals(false);
 }
 
-DkOverview* DkZoomWidget::getOverview() const {
-	return mOverview;
+DkOverview *DkZoomWidget::getOverview() const
+{
+    return mOverview;
 }
 
-void DkZoomWidget::setVisible(bool visible, bool autoHide /* = false */) {
-	
-	if (!isVisible() && visible)
-		this->mAutoHide = autoHide;
+void DkZoomWidget::setVisible(bool visible, bool autoHide /* = false */)
+{
+    if (!isVisible() && visible)
+        this->mAutoHide = autoHide;
 
-	if (!visible)
-		autoHide = false;
+    if (!visible)
+        autoHide = false;
 
-	DkFadeLabel::setVisible(visible);
+    DkFadeLabel::setVisible(visible);
 }
 
-bool DkZoomWidget::isAutoHide() const {
-	return mAutoHide;
+bool DkZoomWidget::isAutoHide() const
+{
+    return mAutoHide;
 }
 
 // DkButton --------------------------------------------------------------------
-DkButton::DkButton(QWidget* parent) : QPushButton(parent) {
-
+DkButton::DkButton(QWidget *parent)
+    : QPushButton(parent)
+{
 }
 
-DkButton::DkButton(const QString& text, QWidget* parent) : QPushButton(text, parent) {
-
+DkButton::DkButton(const QString &text, QWidget *parent)
+    : QPushButton(text, parent)
+{
 }
 
-DkButton::DkButton(const QIcon& icon, const QString& text, QWidget* parent) : QPushButton(icon, text, parent) {
+DkButton::DkButton(const QIcon &icon, const QString &text, QWidget *parent)
+    : QPushButton(icon, text, parent)
+{
+    checkedIcon = icon;
+    setText(text);
 
-	checkedIcon = icon;
-	setText(text);
-
-	init();
+    init();
 }
 
-DkButton::DkButton(const QIcon& checkedIcon, const QIcon& uncheckedIcon, const QString& text, QWidget* parent) : QPushButton(checkedIcon, text, parent) {
+DkButton::DkButton(const QIcon &checkedIcon, const QIcon &uncheckedIcon, const QString &text, QWidget *parent)
+    : QPushButton(checkedIcon, text, parent)
+{
+    this->checkedIcon = checkedIcon;
+    this->uncheckedIcon = uncheckedIcon;
+    this->setCheckable(true);
+    setText(text);
 
-	this->checkedIcon = checkedIcon;
-	this->uncheckedIcon = uncheckedIcon;
-	this->setCheckable(true);
-	setText(text);
-	
-	init();
+    init();
 }
 
-void DkButton::init() {
+void DkButton::init()
+{
+    setIcon(checkedIcon);
 
-	setIcon(checkedIcon);
+    if (!checkedIcon.availableSizes().empty())
+        this->setMaximumSize(checkedIcon.availableSizes()[0]); // crashes if the image is empty!!
 
-	if (!checkedIcon.availableSizes().empty())
-		this->setMaximumSize(checkedIcon.availableSizes()[0]);	// crashes if the image is empty!!
-	
-	mouseOver = false;
-	keepAspectRatio = true;
+    mouseOver = false;
+    keepAspectRatio = true;
 }
 
-void DkButton::setFixedSize(QSize size) {
-	mySize = size;
-	this->setMaximumSize(size);
+void DkButton::setFixedSize(QSize size)
+{
+    mySize = size;
+    this->setMaximumSize(size);
 }
 
-void DkButton::paintEvent(QPaintEvent*) {
-
- 	QPainter painter(this);
-	QPoint offset;
-	QSize s;
-	float opacity = 1.0f;
+void DkButton::paintEvent(QPaintEvent *)
+{
+    QPainter painter(this);
+    QPoint offset;
+    QSize s;
+    float opacity = 1.0f;
 
-	if (!isEnabled())
-		opacity = 0.5f;
-	else if(!mouseOver)
-		opacity = 0.7f;
+    if (!isEnabled())
+        opacity = 0.5f;
+    else if (!mouseOver)
+        opacity = 0.7f;
 
-	painter.setOpacity(opacity);
-	painter.setRenderHint(QPainter::SmoothPixmapTransform);
+    painter.setOpacity(opacity);
+    painter.setRenderHint(QPainter::SmoothPixmapTransform);
 
-	if (!mySize.isEmpty()) {
-		
-		offset = QPoint(qRound((float)(size().width()-mySize.width())*0.5f), qRound((float)(size().height()-mySize.height())*0.5f));
-		s = mySize;
-	}
-	else
-		s = this->size();
+    if (!mySize.isEmpty()) {
+        offset = QPoint(qRound((float)(size().width() - mySize.width()) * 0.5f), qRound((float)(size().height() - mySize.height()) * 0.5f));
+        s = mySize;
+    } else
+        s = this->size();
 
-	// scale to parent label
-	QRect r = (keepAspectRatio) ? QRect(offset, checkedIcon.actualSize(s)) : QRect(offset, s);	// actual size preserves the aspect ratio
-	QPixmap pm2draw;
+    // scale to parent label
+    QRect r = (keepAspectRatio) ? QRect(offset, checkedIcon.actualSize(s)) : QRect(offset, s); // actual size preserves the aspect ratio
+    QPixmap pm2draw;
 
-	if (isChecked() || !isCheckable())
-		pm2draw = checkedIcon.pixmap(s);
-	else
-		pm2draw = uncheckedIcon.pixmap(s);
+    if (isChecked() || !isCheckable())
+        pm2draw = checkedIcon.pixmap(s);
+    else
+        pm2draw = uncheckedIcon.pixmap(s);
 
-	if (this->isDown()) {
-		QPixmap effect = createSelectedEffect(&pm2draw);
-		painter.drawPixmap(r, effect);
-	}
+    if (this->isDown()) {
+        QPixmap effect = createSelectedEffect(&pm2draw);
+        painter.drawPixmap(r, effect);
+    }
 
-	painter.drawPixmap(r, pm2draw);
-	painter.end();
+    painter.drawPixmap(r, pm2draw);
+    painter.end();
 }
 
-QPixmap DkButton::createSelectedEffect(QPixmap* pm) {
+QPixmap DkButton::createSelectedEffect(QPixmap *pm)
+{
+    if (!pm || pm->isNull())
+        return QPixmap();
 
-	if (!pm || pm->isNull())
-		return QPixmap();
-
-	return DkImage::colorizePixmap(*pm, DkSettingsManager::param().display().highlightColor, 1.0f);
+    return DkImage::colorizePixmap(*pm, DkSettingsManager::param().display().highlightColor, 1.0f);
 }
 
-void DkButton::focusInEvent(QFocusEvent*) {
-	mouseOver = true;
+void DkButton::focusInEvent(QFocusEvent *)
+{
+    mouseOver = true;
 }
 
-void DkButton::focusOutEvent(QFocusEvent*) {
-	mouseOver = false;
+void DkButton::focusOutEvent(QFocusEvent *)
+{
+    mouseOver = false;
 }
 
-void DkButton::enterEvent(QEvent*) {
-	mouseOver = true;
+void DkButton::enterEvent(QEvent *)
+{
+    mouseOver = true;
 }
 
-void DkButton::leaveEvent(QEvent*) {
-	mouseOver = false;
+void DkButton::leaveEvent(QEvent *)
+{
+    mouseOver = false;
 }
 
 // star label --------------------------------------------------------------------
-DkRatingLabel::DkRatingLabel(int rating, QWidget* parent, Qt::WindowFlags flags) : DkFadeWidget(parent, flags) {
-
-	setObjectName("DkRatingLabel");
-	mRating = rating;
-	init();
-
-	int iconSize = 16;
+DkRatingLabel::DkRatingLabel(int rating, QWidget *parent, Qt::WindowFlags flags)
+    : DkFadeWidget(parent, flags)
+{
+    setObjectName("DkRatingLabel");
+    mRating = rating;
+    init();
+
+    int iconSize = 16;
+
+    mLayout = new QBoxLayout(QBoxLayout::LeftToRight);
+    mLayout->setContentsMargins(0, 0, 0, 0);
+    mLayout->setSpacing(3);
+    mLayout->addStretch();
+
+    for (int idx = 0; idx < mStars.size(); idx++) {
+        mStars[idx]->setFixedSize(QSize(iconSize, iconSize));
+        mLayout->addWidget(mStars[idx]);
+    }
 
-	mLayout = new QBoxLayout(QBoxLayout::LeftToRight);
-	mLayout->setContentsMargins(0,0,0,0);
-	mLayout->setSpacing(3);
-	mLayout->addStretch();
-	
-	for (int idx = 0; idx < mStars.size(); idx++) {
-		mStars[idx]->setFixedSize(QSize(iconSize, iconSize));
-		mLayout->addWidget(mStars[idx]);
-	}
-	
-	setLayout(mLayout);
+    setLayout(mLayout);
 }
 
-void DkRatingLabel::init() {
-
-	QIcon starDark = DkImage::loadIcon(":/nomacs/img/star-off.svg", QSize(), DkSettingsManager::param().display().hudFgdColor);
-	QIcon starWhite = DkImage::loadIcon(":/nomacs/img/star-on.svg", QSize(), DkSettingsManager::param().display().hudFgdColor);
+void DkRatingLabel::init()
+{
+    QIcon starDark = DkImage::loadIcon(":/nomacs/img/star-off.svg", QSize(), DkSettingsManager::param().display().hudFgdColor);
+    QIcon starWhite = DkImage::loadIcon(":/nomacs/img/star-on.svg", QSize(), DkSettingsManager::param().display().hudFgdColor);
 
-	mStars.resize(5);
-	
-	mStars[rating_1] = new DkButton(starWhite, starDark, tr("one star"), this);
-	mStars[rating_1]->setCheckable(true);
-	connect(mStars[rating_1], SIGNAL(released()), this, SLOT(rating1()));
+    mStars.resize(5);
 
-	mStars[rating_2] = new DkButton(starWhite, starDark, tr("two stars"), this);
-	mStars[rating_2]->setCheckable(true);
-	connect(mStars[rating_2], SIGNAL(released()), this, SLOT(rating2()));
+    mStars[rating_1] = new DkButton(starWhite, starDark, tr("one star"), this);
+    mStars[rating_1]->setCheckable(true);
+    connect(mStars[rating_1], SIGNAL(released()), this, SLOT(rating1()));
 
-	mStars[rating_3] = new DkButton(starWhite, starDark, tr("three star"), this);
-	mStars[rating_3]->setCheckable(true);
-	connect(mStars[rating_3], SIGNAL(released()), this, SLOT(rating3()));
+    mStars[rating_2] = new DkButton(starWhite, starDark, tr("two stars"), this);
+    mStars[rating_2]->setCheckable(true);
+    connect(mStars[rating_2], SIGNAL(released()), this, SLOT(rating2()));
 
-	mStars[rating_4] = new DkButton(starWhite, starDark, tr("four star"), this);
-	mStars[rating_4]->setCheckable(true);
-	connect(mStars[rating_4], SIGNAL(released()), this, SLOT(rating4()));
+    mStars[rating_3] = new DkButton(starWhite, starDark, tr("three star"), this);
+    mStars[rating_3]->setCheckable(true);
+    connect(mStars[rating_3], SIGNAL(released()), this, SLOT(rating3()));
 
-	mStars[rating_5] = new DkButton(starWhite, starDark, tr("five star"), this);
-	mStars[rating_5]->setCheckable(true);
-	connect(mStars[rating_5], SIGNAL(released()), this, SLOT(rating5()));
+    mStars[rating_4] = new DkButton(starWhite, starDark, tr("four star"), this);
+    mStars[rating_4]->setCheckable(true);
+    connect(mStars[rating_4], SIGNAL(released()), this, SLOT(rating4()));
 
+    mStars[rating_5] = new DkButton(starWhite, starDark, tr("five star"), this);
+    mStars[rating_5]->setCheckable(true);
+    connect(mStars[rating_5], SIGNAL(released()), this, SLOT(rating5()));
 }
 
 // DkRatingLabelBg --------------------------------------------------------------------
-DkRatingLabelBg::DkRatingLabelBg(int rating, QWidget* parent, Qt::WindowFlags flags) : DkRatingLabel(rating, parent, flags) {
-
-	setCursor(Qt::ArrowCursor);
+DkRatingLabelBg::DkRatingLabelBg(int rating, QWidget *parent, Qt::WindowFlags flags)
+    : DkRatingLabel(rating, parent, flags)
+{
+    setCursor(Qt::ArrowCursor);
 
-	mHideTimer = new QTimer(this);
-	mHideTimer->setInterval(mTimeToDisplay);
-	mHideTimer->setSingleShot(true);
+    mHideTimer = new QTimer(this);
+    mHideTimer->setInterval(mTimeToDisplay);
+    mHideTimer->setSingleShot(true);
 
-	// we want a margin
-	mLayout->setContentsMargins(10,4,10,4);
-	mLayout->setSpacing(4);
+    // we want a margin
+    mLayout->setContentsMargins(10, 4, 10, 4);
+    mLayout->setSpacing(4);
 
-	DkActionManager& am = DkActionManager::instance();
+    DkActionManager &am = DkActionManager::instance();
 
-	connect(am.action(DkActionManager::sc_star_rating_0), SIGNAL(triggered()), this, SLOT(rating0()));
-	mStars[rating_1]->addAction(am.action(DkActionManager::sc_star_rating_1));
-	connect(am.action(DkActionManager::sc_star_rating_1), SIGNAL(triggered()), this, SLOT(rating1()));
-	mStars[rating_2]->addAction(am.action(DkActionManager::sc_star_rating_2));
-	connect(am.action(DkActionManager::sc_star_rating_2), SIGNAL(triggered()), this, SLOT(rating2()));
-	mStars[rating_3]->addAction(am.action(DkActionManager::sc_star_rating_3));
-	connect(am.action(DkActionManager::sc_star_rating_3), SIGNAL(triggered()), this, SLOT(rating3()));
-	mStars[rating_4]->addAction(am.action(DkActionManager::sc_star_rating_4));
-	connect(am.action(DkActionManager::sc_star_rating_4), SIGNAL(triggered()), this, SLOT(rating4()));
-	mStars[rating_5]->addAction(am.action(DkActionManager::sc_star_rating_5));
-	connect(am.action(DkActionManager::sc_star_rating_5), SIGNAL(triggered()), this, SLOT(rating5()));
-	
-	connect(mHideTimer, SIGNAL(timeout()), this, SLOT(hide()));
-}
-
-DkRatingLabelBg::~DkRatingLabelBg() {}
+    connect(am.action(DkActionManager::sc_star_rating_0), SIGNAL(triggered()), this, SLOT(rating0()));
+    mStars[rating_1]->addAction(am.action(DkActionManager::sc_star_rating_1));
+    connect(am.action(DkActionManager::sc_star_rating_1), SIGNAL(triggered()), this, SLOT(rating1()));
+    mStars[rating_2]->addAction(am.action(DkActionManager::sc_star_rating_2));
+    connect(am.action(DkActionManager::sc_star_rating_2), SIGNAL(triggered()), this, SLOT(rating2()));
+    mStars[rating_3]->addAction(am.action(DkActionManager::sc_star_rating_3));
+    connect(am.action(DkActionManager::sc_star_rating_3), SIGNAL(triggered()), this, SLOT(rating3()));
+    mStars[rating_4]->addAction(am.action(DkActionManager::sc_star_rating_4));
+    connect(am.action(DkActionManager::sc_star_rating_4), SIGNAL(triggered()), this, SLOT(rating4()));
+    mStars[rating_5]->addAction(am.action(DkActionManager::sc_star_rating_5));
+    connect(am.action(DkActionManager::sc_star_rating_5), SIGNAL(triggered()), this, SLOT(rating5()));
 
-void DkRatingLabelBg::changeRating(int newRating) {
-	DkRatingLabel::changeRating(newRating);
-	show();
-	mHideTimer->start();
+    connect(mHideTimer, SIGNAL(timeout()), this, SLOT(hide()));
 }
 
-void DkRatingLabelBg::paintEvent(QPaintEvent *event) {
-
-	QPainter painter(this);
-	painter.fillRect(QRect(QPoint(), this->size()), DkSettingsManager::param().display().hudBgColor);
-	painter.end();
-
-	DkRatingLabel::paintEvent(event);
+DkRatingLabelBg::~DkRatingLabelBg()
+{
 }
 
-// title info --------------------------------------------------------------------
-DkFileInfoLabel::DkFileInfoLabel(QWidget* parent) : DkFadeLabel(parent) {
-
-	setObjectName("DkFileInfoLabel");
-	setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
-
-	mTitleLabel = new QLabel(this);
-	mTitleLabel->setMouseTracking(true);
-	mTitleLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
-	mDateLabel = new QLabel(this);
-	mDateLabel->setMouseTracking(true);
-	mDateLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
-	mRatingLabel = new DkRatingLabel(0, this);
-	setMinimumWidth(110);
-	setCursor(Qt::ArrowCursor);
-	
-	createLayout();
+void DkRatingLabelBg::changeRating(int newRating)
+{
+    DkRatingLabel::changeRating(newRating);
+    show();
+    mHideTimer->start();
 }
 
-void DkFileInfoLabel::createLayout() {
-
-	mLayout = new QBoxLayout(QBoxLayout::TopToBottom, this);
-	mLayout->setSpacing(2);
+void DkRatingLabelBg::paintEvent(QPaintEvent *event)
+{
+    QPainter painter(this);
+    painter.fillRect(QRect(QPoint(), this->size()), DkSettingsManager::param().display().hudBgColor);
+    painter.end();
 
-	mLayout->addWidget(mTitleLabel);
-	mLayout->addWidget(mDateLabel);
-	mLayout->addWidget(mRatingLabel);
-	//mLayout->addStretch();
+    DkRatingLabel::paintEvent(event);
 }
 
-void DkFileInfoLabel::setVisible(bool visible, bool saveSettings) {
-
-	// nothing to display??
-	if (!DkSettingsManager::param().slideShow().display.testBit(DkSettings::display_file_name) &&
-		!DkSettingsManager::param().slideShow().display.testBit(DkSettings::display_creation_date) &&
-		!DkSettingsManager::param().slideShow().display.testBit(DkSettings::display_file_rating) && visible) {
-			
-			QMessageBox infoDialog(DkUtils::getMainWindow());
-			infoDialog.setWindowTitle(tr("Info Box"));
-			infoDialog.setText(tr("All information fields are currently hidden.\nDo you want to show them again?"));
-			infoDialog.setIcon(QMessageBox::Information);
-			infoDialog.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
-			infoDialog.setDefaultButton(QMessageBox::Yes);
-			infoDialog.show();
-			int choice = infoDialog.exec();
-
-			if (choice == QMessageBox::No) {
-				DkFadeLabel::setVisible(false);
-				return;
-			}
-			else {
-				DkSettingsManager::param().slideShow().display.setBit(DkSettings::display_file_name, true);
-				DkSettingsManager::param().slideShow().display.setBit(DkSettings::display_creation_date, true);
-				DkSettingsManager::param().slideShow().display.setBit(DkSettings::display_file_rating, true);
-			}
-	}
+// title info --------------------------------------------------------------------
+DkFileInfoLabel::DkFileInfoLabel(QWidget *parent)
+    : DkFadeLabel(parent)
+{
+    setObjectName("DkFileInfoLabel");
+    setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
+
+    mTitleLabel = new QLabel(this);
+    mTitleLabel->setMouseTracking(true);
+    mTitleLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
+    mDateLabel = new QLabel(this);
+    mDateLabel->setMouseTracking(true);
+    mDateLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
+    mRatingLabel = new DkRatingLabel(0, this);
+    setMinimumWidth(110);
+    setCursor(Qt::ArrowCursor);
+
+    createLayout();
+}
+
+void DkFileInfoLabel::createLayout()
+{
+    mLayout = new QBoxLayout(QBoxLayout::TopToBottom, this);
+    mLayout->setSpacing(2);
+
+    mLayout->addWidget(mTitleLabel);
+    mLayout->addWidget(mDateLabel);
+    mLayout->addWidget(mRatingLabel);
+    // mLayout->addStretch();
+}
+
+void DkFileInfoLabel::setVisible(bool visible, bool saveSettings)
+{
+    // nothing to display??
+    if (!DkSettingsManager::param().slideShow().display.testBit(DkSettings::display_file_name)
+        && !DkSettingsManager::param().slideShow().display.testBit(DkSettings::display_creation_date)
+        && !DkSettingsManager::param().slideShow().display.testBit(DkSettings::display_file_rating) && visible) {
+        QMessageBox infoDialog(DkUtils::getMainWindow());
+        infoDialog.setWindowTitle(tr("Info Box"));
+        infoDialog.setText(tr("All information fields are currently hidden.\nDo you want to show them again?"));
+        infoDialog.setIcon(QMessageBox::Information);
+        infoDialog.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
+        infoDialog.setDefaultButton(QMessageBox::Yes);
+        infoDialog.show();
+        int choice = infoDialog.exec();
+
+        if (choice == QMessageBox::No) {
+            DkFadeLabel::setVisible(false);
+            return;
+        } else {
+            DkSettingsManager::param().slideShow().display.setBit(DkSettings::display_file_name, true);
+            DkSettingsManager::param().slideShow().display.setBit(DkSettings::display_creation_date, true);
+            DkSettingsManager::param().slideShow().display.setBit(DkSettings::display_file_rating, true);
+        }
+    }
 
-	DkFadeLabel::setVisible(visible, saveSettings);
-	mTitleLabel->setVisible(DkSettingsManager::param().slideShow().display.testBit(DkSettings::display_file_name));
-	mDateLabel->setVisible(DkSettingsManager::param().slideShow().display.testBit(DkSettings::display_creation_date));
-	mRatingLabel->setVisible(DkSettingsManager::param().slideShow().display.testBit(DkSettings::display_file_rating));
+    DkFadeLabel::setVisible(visible, saveSettings);
+    mTitleLabel->setVisible(DkSettingsManager::param().slideShow().display.testBit(DkSettings::display_file_name));
+    mDateLabel->setVisible(DkSettingsManager::param().slideShow().display.testBit(DkSettings::display_creation_date));
+    mRatingLabel->setVisible(DkSettingsManager::param().slideShow().display.testBit(DkSettings::display_file_rating));
 
-	int height = 32;
-	if (mTitleLabel->isVisible())
-		height += mTitleLabel->sizeHint().height();
-	if (mDateLabel->isVisible())
-		height += mDateLabel->sizeHint().height();
-	if (mRatingLabel->isVisible())
-		height += mRatingLabel->sizeHint().height();
+    int height = 32;
+    if (mTitleLabel->isVisible())
+        height += mTitleLabel->sizeHint().height();
+    if (mDateLabel->isVisible())
+        height += mDateLabel->sizeHint().height();
+    if (mRatingLabel->isVisible())
+        height += mRatingLabel->sizeHint().height();
 
-	setMinimumHeight(height);
-	updateWidth();
+    setMinimumHeight(height);
+    updateWidth();
 }
 
-void DkFileInfoLabel::setEdited(bool edited) {
-
-	if (!isVisible() || !edited)
-		return;
-
-	QString cFileName = mTitleLabel->text() + "*";
-	this->mTitleLabel->setText(cFileName);
+void DkFileInfoLabel::setEdited(bool edited)
+{
+    if (!isVisible() || !edited)
+        return;
 
+    QString cFileName = mTitleLabel->text() + "*";
+    this->mTitleLabel->setText(cFileName);
 }
 
-DkRatingLabel* DkFileInfoLabel::getRatingLabel() {
-	return mRatingLabel;
+DkRatingLabel *DkFileInfoLabel::getRatingLabel()
+{
+    return mRatingLabel;
 }
 
-void DkFileInfoLabel::updateInfo(const QString& filePath, const QString& attr, const QString& date, const int rating) {
+void DkFileInfoLabel::updateInfo(const QString &filePath, const QString &attr, const QString &date, const int rating)
+{
+    mFilePath = filePath;
+    updateTitle(filePath, attr);
+    updateDate(date);
+    updateRating(rating);
 
-	mFilePath = filePath;
-	updateTitle(filePath, attr);
-	updateDate(date);
-	updateRating(rating);
-
-	updateWidth();
+    updateWidth();
 }
 
-void DkFileInfoLabel::updateTitle(const QString& filePath, const QString& attr) {
-	
-	updateDate();
-	mTitleLabel->setText(QFileInfo(filePath).fileName() + " " + attr);
-	mTitleLabel->setAlignment(Qt::AlignRight);
+void DkFileInfoLabel::updateTitle(const QString &filePath, const QString &attr)
+{
+    updateDate();
+    mTitleLabel->setText(QFileInfo(filePath).fileName() + " " + attr);
+    mTitleLabel->setAlignment(Qt::AlignRight);
 
-	updateWidth();
+    updateWidth();
 }
 
-void DkFileInfoLabel::updateDate(const QString& date) {
-
-	QString dateConverted = DkUtils::convertDateString(date, QFileInfo(mFilePath));
-
-	mDateLabel->setText(dateConverted);
-	mDateLabel->setAlignment(Qt::AlignRight);
+void DkFileInfoLabel::updateDate(const QString &date)
+{
+    QString dateConverted = DkUtils::convertDateString(date, QFileInfo(mFilePath));
 
-	updateWidth();
-}
+    mDateLabel->setText(dateConverted);
+    mDateLabel->setAlignment(Qt::AlignRight);
 
-void DkFileInfoLabel::updateRating(const int rating) {
-	
-	mRatingLabel->setRating(rating);
+    updateWidth();
 }
 
-void DkFileInfoLabel::updateWidth() {
-
-	int width = 20;		// mar
-	width += qMax(qMax(mTitleLabel->sizeHint().width(), mDateLabel->sizeHint().width()), mRatingLabel->sizeHint().width());
-	
-	if (width < minimumWidth())
-		setMinimumWidth(width);
-	
-	setMaximumWidth(width);
-}
-
-// player --------------------------------------------------------------------
-DkPlayer::DkPlayer(QWidget* parent) : DkFadeWidget(parent) {
-
-	init();
-	createLayout();
-}
-
-void DkPlayer::createLayout() {
-
-	int height = 50;
-	QSize ih(height-12, height-12);
-
-	previousButton = new QPushButton(DkImage::loadIcon(":/nomacs/img/previous.svg", ih, Qt::white), "", this);
-	//previousButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
-	previousButton->setIconSize(ih);
-	previousButton->setMinimumSize(QSize(qRound(1.5*height), height));
-	previousButton->setToolTip(tr("Show previous image"));
-	previousButton->setObjectName("DkPlayerButton");
-	previousButton->setFlat(true);
-	connect(previousButton, SIGNAL(pressed()), this, SLOT(previous()));
-
-	QIcon icon;
-	icon.addPixmap(DkImage::loadIcon(":/nomacs/img/pause.svg", ih, Qt::white), QIcon::Normal, QIcon::On);
-	icon.addPixmap(DkImage::loadIcon(":/nomacs/img/play.svg", ih, Qt::white), QIcon::Normal, QIcon::Off);
-	playButton = new QPushButton(icon, "", this);
-	//playButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
-	playButton->setIconSize(ih);
-	playButton->setMinimumSize(QSize(qRound(1.5*height), height));
-	playButton->setToolTip(tr("Play/Pause"));
-	playButton->setObjectName("DkPlayerButton");
-	playButton->setFlat(true);
-	playButton->setCheckable(true);
-	playButton->setChecked(false);
-	playButton->addAction(DkActionManager::instance().action(DkActionManager::menu_view_slideshow));
-	connect(playButton, SIGNAL(clicked(bool)), this, SLOT(play(bool)));
-
-	nextButton = new QPushButton(DkImage::loadIcon(":/nomacs/img/next.svg", ih, Qt::white), "",  this);
-	//nextButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
-	nextButton->setIconSize(ih);
-	nextButton->setMinimumSize(QSize(qRound(1.5*height), height));
-	nextButton->setToolTip(tr("Show next image"));
-	nextButton->setObjectName("DkPlayerButton");
-	nextButton->setFlat(true);
-	connect(nextButton, SIGNAL(pressed()), this, SLOT(next()));
-
-	// now add to mLayout
-	container = new QWidget(this);
-	QHBoxLayout* layout = new QHBoxLayout(container);
-	//layout->setContentsMargins(0,0,0,0);
-	layout->addStretch();
-	layout->addWidget(previousButton);
-	layout->addWidget(playButton);
-	layout->addWidget(nextButton);
-	layout->addStretch();
-
-	QVBoxLayout* l = new QVBoxLayout(this);
-	l->setContentsMargins(0, 0, 0, 0);
-	l->addWidget(container);
-	l->addStretch();
-
-	//setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
-
-}
-
-void DkPlayer::init() {
-	
-	setObjectName("DkPlayer");
-
-	// slide show
-	int timeToDisplayPlayer = 3000;
-	timeToDisplay = qRound(DkSettingsManager::param().slideShow().time*1000);
-	playing = false;
-	displayTimer = new QTimer(this);
-	displayTimer->setInterval(timeToDisplay);
-	displayTimer->setSingleShot(true);
-	connect(displayTimer, SIGNAL(timeout()), this, SLOT(autoNext()));
-
-	hideTimer = new QTimer(this);
-	hideTimer->setInterval(timeToDisplayPlayer);
-	hideTimer->setSingleShot(true);
-	connect(hideTimer, SIGNAL(timeout()), this, SLOT(hide()));
-
-	connect(DkActionManager::instance().action(DkActionManager::menu_view_slideshow), SIGNAL(triggered()), this, SLOT(togglePlay()));
+void DkFileInfoLabel::updateRating(const int rating)
+{
+    mRatingLabel->setRating(rating);
 }
 
-void DkPlayer::play(bool play) {
+void DkFileInfoLabel::updateWidth()
+{
+    int width = 20; // mar
+    width += qMax(qMax(mTitleLabel->sizeHint().width(), mDateLabel->sizeHint().width()), mRatingLabel->sizeHint().width());
 
-	if (play != playing)	// emulate a click
-		playButton->setChecked(play);
+    if (width < minimumWidth())
+        setMinimumWidth(width);
 
-	playing = play;
-
-	if (play) {
-		displayTimer->start();
-		hideTimer->start();
-	}
-	else
-		displayTimer->stop();
+    setMaximumWidth(width);
 }
 
-void DkPlayer::togglePlay() {
-
-	show();
-	playing = !playing;
-	playButton->click();
-}
-
-void DkPlayer::startTimer() {
-	if (playing) {
-		displayTimer->setInterval(qRound(DkSettingsManager::param().slideShow().time*1000));	// if it was updated...
-		displayTimer->start();
-	}
+// player --------------------------------------------------------------------
+DkPlayer::DkPlayer(QWidget *parent)
+    : DkFadeWidget(parent)
+{
+    init();
+    createLayout();
+}
+
+void DkPlayer::createLayout()
+{
+    int height = 50;
+    QSize ih(height - 12, height - 12);
+
+    previousButton = new QPushButton(DkImage::loadIcon(":/nomacs/img/previous.svg", ih, Qt::white), "", this);
+    // previousButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+    previousButton->setIconSize(ih);
+    previousButton->setMinimumSize(QSize(qRound(1.5 * height), height));
+    previousButton->setToolTip(tr("Show previous image"));
+    previousButton->setObjectName("DkPlayerButton");
+    previousButton->setFlat(true);
+    connect(previousButton, SIGNAL(pressed()), this, SLOT(previous()));
+
+    QIcon icon;
+    icon.addPixmap(DkImage::loadIcon(":/nomacs/img/pause.svg", ih, Qt::white), QIcon::Normal, QIcon::On);
+    icon.addPixmap(DkImage::loadIcon(":/nomacs/img/play.svg", ih, Qt::white), QIcon::Normal, QIcon::Off);
+    playButton = new QPushButton(icon, "", this);
+    // playButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+    playButton->setIconSize(ih);
+    playButton->setMinimumSize(QSize(qRound(1.5 * height), height));
+    playButton->setToolTip(tr("Play/Pause"));
+    playButton->setObjectName("DkPlayerButton");
+    playButton->setFlat(true);
+    playButton->setCheckable(true);
+    playButton->setChecked(false);
+    playButton->addAction(DkActionManager::instance().action(DkActionManager::menu_view_slideshow));
+    connect(playButton, SIGNAL(clicked(bool)), this, SLOT(play(bool)));
+
+    nextButton = new QPushButton(DkImage::loadIcon(":/nomacs/img/next.svg", ih, Qt::white), "", this);
+    // nextButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+    nextButton->setIconSize(ih);
+    nextButton->setMinimumSize(QSize(qRound(1.5 * height), height));
+    nextButton->setToolTip(tr("Show next image"));
+    nextButton->setObjectName("DkPlayerButton");
+    nextButton->setFlat(true);
+    connect(nextButton, SIGNAL(pressed()), this, SLOT(next()));
+
+    // now add to mLayout
+    container = new QWidget(this);
+    QHBoxLayout *layout = new QHBoxLayout(container);
+    // layout->setContentsMargins(0,0,0,0);
+    layout->addStretch();
+    layout->addWidget(previousButton);
+    layout->addWidget(playButton);
+    layout->addWidget(nextButton);
+    layout->addStretch();
+
+    QVBoxLayout *l = new QVBoxLayout(this);
+    l->setContentsMargins(0, 0, 0, 0);
+    l->addWidget(container);
+    l->addStretch();
+
+    // setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+}
+
+void DkPlayer::init()
+{
+    setObjectName("DkPlayer");
+
+    // slide show
+    int timeToDisplayPlayer = 3000;
+    timeToDisplay = qRound(DkSettingsManager::param().slideShow().time * 1000);
+    playing = false;
+    displayTimer = new QTimer(this);
+    displayTimer->setInterval(timeToDisplay);
+    displayTimer->setSingleShot(true);
+    connect(displayTimer, SIGNAL(timeout()), this, SLOT(autoNext()));
+
+    hideTimer = new QTimer(this);
+    hideTimer->setInterval(timeToDisplayPlayer);
+    hideTimer->setSingleShot(true);
+    connect(hideTimer, SIGNAL(timeout()), this, SLOT(hide()));
+
+    connect(DkActionManager::instance().action(DkActionManager::menu_view_slideshow), SIGNAL(triggered()), this, SLOT(togglePlay()));
+}
+
+void DkPlayer::play(bool play)
+{
+    if (play != playing) // emulate a click
+        playButton->setChecked(play);
+
+    playing = play;
+
+    if (play) {
+        displayTimer->start();
+        hideTimer->start();
+    } else
+        displayTimer->stop();
+}
+
+void DkPlayer::togglePlay()
+{
+    show();
+    playing = !playing;
+    playButton->click();
+}
+
+void DkPlayer::startTimer()
+{
+    if (playing) {
+        displayTimer->setInterval(qRound(DkSettingsManager::param().slideShow().time * 1000)); // if it was updated...
+        displayTimer->start();
+    }
 }
 
-void DkPlayer::autoNext() {
-	emit nextSignal();
+void DkPlayer::autoNext()
+{
+    emit nextSignal();
 }
 
-void DkPlayer::next() {
-	hideTimer->stop();
-	emit nextSignal();
+void DkPlayer::next()
+{
+    hideTimer->stop();
+    emit nextSignal();
 }
 
-void DkPlayer::previous() {
-	hideTimer->stop();
-	emit previousSignal();
+void DkPlayer::previous()
+{
+    hideTimer->stop();
+    emit previousSignal();
 }
 
-bool DkPlayer::isPlaying() const {
-	return playing;
+bool DkPlayer::isPlaying() const
+{
+    return playing;
 }
 
-void DkPlayer::setTimeToDisplay(int ms) {
-
-	timeToDisplay = ms;
-	displayTimer->setInterval(ms);
+void DkPlayer::setTimeToDisplay(int ms)
+{
+    timeToDisplay = ms;
+    displayTimer->setInterval(ms);
 }
 
-void DkPlayer::show(int ms) {		
-	
-	if (ms > 0 && !hideTimer->isActive()) {
-		hideTimer->setInterval(ms);
-		hideTimer->start();
-	}
+void DkPlayer::show(int ms)
+{
+    if (ms > 0 && !hideTimer->isActive()) {
+        hideTimer->setInterval(ms);
+        hideTimer->start();
+    }
 
-	bool showPlayer = getCurrentDisplaySetting();
+    bool showPlayer = getCurrentDisplaySetting();
 
-	DkFadeWidget::show();
+    DkFadeWidget::show();
 
-	// automatic showing, don't store it in the display bits
-	if (ms > 0 && mDisplaySettingsBits && mDisplaySettingsBits->size() > DkSettingsManager::param().app().currentAppMode) {
-		mDisplaySettingsBits->setBit(DkSettingsManager::param().app().currentAppMode, showPlayer);
-	}
+    // automatic showing, don't store it in the display bits
+    if (ms > 0 && mDisplaySettingsBits && mDisplaySettingsBits->size() > DkSettingsManager::param().app().currentAppMode) {
+        mDisplaySettingsBits->setBit(DkSettingsManager::param().app().currentAppMode, showPlayer);
+    }
 }
 
-// -------------------------------------------------------------------- DkHudNavigation 
-DkHudNavigation::DkHudNavigation(QWidget* parent) : DkFadeWidget(parent) {
-
-	createLayout();
+// -------------------------------------------------------------------- DkHudNavigation
+DkHudNavigation::DkHudNavigation(QWidget *parent)
+    : DkFadeWidget(parent)
+{
+    createLayout();
 }
 
-void DkHudNavigation::createLayout() {
-
-	// previous/next buttons
-	QSize s(64, 64);
-	QColor c(0,0,0);
-	c.setAlpha(0);
-	
-	mPreviousButton = new QPushButton(DkImage::loadIcon(":/nomacs/img/previous-hud.svg", s, c), "", this);
-	mPreviousButton->setObjectName("hudNavigationButton");
-	mPreviousButton->setToolTip(tr("Show previous image"));
-	mPreviousButton->setFlat(true);
-	mPreviousButton->setIconSize(s);
-	connect(mPreviousButton, SIGNAL(pressed()), this, SIGNAL(previousSignal()));
+void DkHudNavigation::createLayout()
+{
+    // previous/next buttons
+    QSize s(64, 64);
+    QColor c(0, 0, 0);
+    c.setAlpha(0);
 
-	mNextButton = new QPushButton(DkImage::loadIcon(":/nomacs/img/next-hud.svg", s, c), "", this);
-	mNextButton->setObjectName("hudNavigationButton");
-	mNextButton->setToolTip(tr("Show next image"));
-	mNextButton->setFlat(true);
-	mNextButton->setIconSize(s);
-	connect(mNextButton, SIGNAL(pressed()), this, SIGNAL(nextSignal()));
+    mPreviousButton = new QPushButton(DkImage::loadIcon(":/nomacs/img/previous-hud.svg", s, c), "", this);
+    mPreviousButton->setObjectName("hudNavigationButton");
+    mPreviousButton->setToolTip(tr("Show previous image"));
+    mPreviousButton->setFlat(true);
+    mPreviousButton->setIconSize(s);
+    connect(mPreviousButton, SIGNAL(pressed()), this, SIGNAL(previousSignal()));
 
-	QHBoxLayout* l = new QHBoxLayout(this);
-	l->setContentsMargins(0, 0, 0, 0);
-	l->addWidget(mPreviousButton);
-	l->addStretch();
-	l->addWidget(mNextButton);
+    mNextButton = new QPushButton(DkImage::loadIcon(":/nomacs/img/next-hud.svg", s, c), "", this);
+    mNextButton->setObjectName("hudNavigationButton");
+    mNextButton->setToolTip(tr("Show next image"));
+    mNextButton->setFlat(true);
+    mNextButton->setIconSize(s);
+    connect(mNextButton, SIGNAL(pressed()), this, SIGNAL(nextSignal()));
 
+    QHBoxLayout *l = new QHBoxLayout(this);
+    l->setContentsMargins(0, 0, 0, 0);
+    l->addWidget(mPreviousButton);
+    l->addStretch();
+    l->addWidget(mNextButton);
 }
 
-void DkHudNavigation::showNext() {
-
-	mNextButton->show();
-	DkFadeWidget::show();
-	mPreviousButton->hide();
+void DkHudNavigation::showNext()
+{
+    mNextButton->show();
+    DkFadeWidget::show();
+    mPreviousButton->hide();
 }
 
-void DkHudNavigation::showPrevious() {
-
-	mPreviousButton->show();
-	DkFadeWidget::show();
-	mNextButton->hide();
+void DkHudNavigation::showPrevious()
+{
+    mPreviousButton->show();
+    DkFadeWidget::show();
+    mNextButton->hide();
 }
 
 // DkTransformRectangle --------------------------------------------------------------------
-DkTransformRect::DkTransformRect(int idx, DkRotatingRect* rect, QWidget* parent, Qt::WindowFlags f) : DkWidget(parent, f) {
-
-	this->parentIdx = idx;
-	this->size = QSize(12, 12);
-	this->rect = rect;
+DkTransformRect::DkTransformRect(int idx, DkRotatingRect *rect, QWidget *parent, Qt::WindowFlags f)
+    : DkWidget(parent, f)
+{
+    this->parentIdx = idx;
+    this->size = QSize(12, 12);
+    this->rect = rect;
+
+    init();
+
+    this->resize(size);
+    setCursor(Qt::CrossCursor);
+}
+
+void DkTransformRect::init()
+{
+}
+
+void DkTransformRect::draw(QPainter *painter)
+{
+    QPen penNoStroke;
+    penNoStroke.setWidth(0);
+    penNoStroke.setColor(QColor(0, 0, 0, 0));
+
+    QPen pen;
+    // pen.setWidth(1);
+    pen.setColor(QColor(255, 255, 0, 100));
+
+    QRectF visibleRect(QPointF(), QSizeF(5, 5));
+    QRectF whiteRect(QPointF(), QSize(7, 7));
+    visibleRect.moveCenter(geometry().center());
+    whiteRect.moveCenter(geometry().center());
+
+    // draw the control point
+    painter->setWorldMatrixEnabled(false);
+    painter->setPen(penNoStroke);
+    painter->setBrush(QColor(0, 0, 0, 0));
+    painter->drawRect(geometry()); // invisible mRect for mouseevents...
+    // painter->setPen(pen);
+    painter->setBrush(QColor(255, 255, 255, 100));
+    painter->drawRect(whiteRect);
+    painter->setBrush(QColor(0, 0, 0));
+    painter->drawRect(visibleRect);
+    painter->setWorldMatrixEnabled(true);
+}
+
+void DkTransformRect::mousePressEvent(QMouseEvent *event)
+{
+    if (event->buttons() == Qt::LeftButton) {
+        posGrab = event->globalPos();
+        initialPos = geometry().topLeft();
+
+        emit updateDiagonal(parentIdx);
+    }
+    qDebug() << "mouse pressed control point";
+    QWidget::mousePressEvent(event);
+}
 
-	init();
+void DkTransformRect::mouseMoveEvent(QMouseEvent *event)
+{
+    if (event->buttons() == Qt::LeftButton) {
+        QPointF pt = initialPos + event->globalPos() - posGrab;
+        emit ctrlMovedSignal(parentIdx, pt, event->modifiers(), true);
+    }
 
-	this->resize(size);
-	setCursor(Qt::CrossCursor);
+    QWidget::mouseMoveEvent(event);
 }
 
-void DkTransformRect::init() {
+void DkTransformRect::mouseReleaseEvent(QMouseEvent *event)
+{
+    QWidget::mouseReleaseEvent(event);
 }
 
-void DkTransformRect::draw(QPainter *painter) {
-
-	QPen penNoStroke;
-	penNoStroke.setWidth(0);
-	penNoStroke.setColor(QColor(0,0,0,0));
-	
-	QPen pen;
-	//pen.setWidth(1);
-	pen.setColor(QColor(255,255,0,100));
+void DkTransformRect::enterEvent(QEvent *)
+{
+    if (rect)
+        setCursor(rect->cpCursor(parentIdx));
+}
 
-	QRectF visibleRect(QPointF(), QSizeF(5,5));
-	QRectF whiteRect(QPointF(), QSize(7,7));
-	visibleRect.moveCenter(geometry().center());
-	whiteRect.moveCenter(geometry().center());
+// DkEditableRectangle --------------------------------------------------------------------
+DkEditableRect::DkEditableRect(const QRectF &rect, QWidget *parent, Qt::WindowFlags f)
+    : DkFadeWidget(parent, f)
+{
+    mRect = rect;
+    mRotatingCursor = QCursor(DkImage::loadFromSvg(":/nomacs/img/rotating-cursor.svg", QSize(24, 24)));
+
+    setAttribute(Qt::WA_MouseTracking);
+
+    mPen = QPen(QColor(0, 0, 0, 255), 1);
+    mPen.setCosmetic(true);
+    mBrush = (DkSettingsManager::param().app().appMode == DkSettings::mode_frameless) ? DkSettingsManager::param().display().bgColorFrameless
+                                                                                      : DkSettingsManager::param().display().hudBgColor;
+
+    for (int idx = 0; idx < 8; idx++) {
+        mCtrlPoints.push_back(new DkTransformRect(idx, &this->mRect, this));
+        mCtrlPoints[idx]->hide();
+        connect(mCtrlPoints[idx],
+                SIGNAL(ctrlMovedSignal(int, const QPointF &, Qt::KeyboardModifiers, bool)),
+                this,
+                SLOT(updateCorner(int, const QPointF &, Qt::KeyboardModifiers, bool)));
+        connect(mCtrlPoints[idx], SIGNAL(updateDiagonal(int)), this, SLOT(updateDiagonal(int)));
+    }
+}
 
-	// draw the control point
-	painter->setWorldMatrixEnabled(false);
-	painter->setPen(penNoStroke);
-	painter->setBrush(QColor(0, 0, 0, 0));
-	painter->drawRect(geometry());	// invisible mRect for mouseevents...
-	//painter->setPen(pen);
-	painter->setBrush(QColor(255,255,255, 100));
-	painter->drawRect(whiteRect);
-	painter->setBrush(QColor(0,0,0));
-	painter->drawRect(visibleRect);
-	painter->setWorldMatrixEnabled(true);
+void DkEditableRect::reset()
+{
+    mRect = QRectF();
 }
 
-void DkTransformRect::mousePressEvent(QMouseEvent *event) {
-	
-	if (event->buttons() == Qt::LeftButton) {
-		posGrab = event->globalPos();
-		initialPos = geometry().topLeft();
+QPointF DkEditableRect::map(const QPointF &pos)
+{
+    QPointF posM = pos;
+    if (mWorldTform)
+        posM = mWorldTform->inverted().map(posM);
+    if (mImgTform)
+        posM = mImgTform->inverted().map(posM);
 
-		emit updateDiagonal(parentIdx);
-	}
-	qDebug() << "mouse pressed control point";
-	QWidget::mousePressEvent(event);
+    return posM;
 }
 
-void DkTransformRect::mouseMoveEvent(QMouseEvent *event) {
+QPointF DkEditableRect::clipToImage(const QPointF &pos)
+{
+    if (!mImgRect)
+        return QPointF(pos);
 
-	if (event->buttons() == Qt::LeftButton) {
-		
-		QPointF pt = initialPos+event->globalPos()-posGrab;
-		emit ctrlMovedSignal(parentIdx, pt, event->modifiers(), true);
-	}
+    QRectF imgViewRect(*mImgRect);
+    if (mWorldTform)
+        imgViewRect = mWorldTform->mapRect(imgViewRect);
 
-	QWidget::mouseMoveEvent(event);
-}
+    float x = (float)pos.x();
+    float y = (float)pos.y();
+    float magicMargin = 5; // 5 px for now
 
-void DkTransformRect::mouseReleaseEvent(QMouseEvent *event) {
+    if (qAbs(x - imgViewRect.left()) < magicMargin)
+        x = (float)imgViewRect.left();
+    if (qAbs(x - imgViewRect.right()) < magicMargin)
+        x = (float)imgViewRect.right();
 
-	QWidget::mouseReleaseEvent(event);
-}
-
-void DkTransformRect::enterEvent(QEvent*) {
+    if (qAbs(y - imgViewRect.top()) < magicMargin)
+        y = (float)imgViewRect.top();
+    if (qAbs(y - imgViewRect.bottom()) < magicMargin)
+        y = (float)imgViewRect.bottom();
 
-	if (rect)
-		setCursor(rect->cpCursor(parentIdx));
+    return QPointF(x, y); // round
 }
 
-// DkEditableRectangle --------------------------------------------------------------------
-DkEditableRect::DkEditableRect(const QRectF& rect, QWidget* parent, Qt::WindowFlags f) : DkFadeWidget(parent, f) {
+QPointF DkEditableRect::clipToImageForce(const QPointF &pos)
+{
+    if (!mImgRect)
+        return QPointF(pos);
 
-	mRect = rect;
-	mRotatingCursor = QCursor(DkImage::loadFromSvg(":/nomacs/img/rotating-cursor.svg", QSize(24, 24)));
-	
-	setAttribute(Qt::WA_MouseTracking);
+    QRectF imgViewRect(*mImgRect);
+    if (mWorldTform)
+        imgViewRect = mWorldTform->mapRect(imgViewRect);
 
-	mPen = QPen(QColor(0, 0, 0, 255), 1);
-	mPen.setCosmetic(true);
-	mBrush = (DkSettingsManager::param().app().appMode == DkSettings::mode_frameless) ?
-		DkSettingsManager::param().display().bgColorFrameless :
-		DkSettingsManager::param().display().hudBgColor;
+    float x = (float)pos.x();
+    float y = (float)pos.y();
 
-	for (int idx = 0; idx < 8; idx++) {
-		mCtrlPoints.push_back(new DkTransformRect(idx, &this->mRect, this));
-		mCtrlPoints[idx]->hide();
-		connect(mCtrlPoints[idx], SIGNAL(ctrlMovedSignal(int, const QPointF&, Qt::KeyboardModifiers, bool)), this, SLOT(updateCorner(int, const QPointF&, Qt::KeyboardModifiers, bool)));
-		connect(mCtrlPoints[idx], SIGNAL(updateDiagonal(int)), this, SLOT(updateDiagonal(int)));
-	}
-}
+    if (x < imgViewRect.left())
+        x = (float)imgViewRect.left();
+    if (x > imgViewRect.right())
+        x = (float)imgViewRect.right();
 
-void DkEditableRect::reset() {
+    if (y < imgViewRect.top())
+        y = (float)imgViewRect.top();
+    if (y > imgViewRect.bottom())
+        y = (float)imgViewRect.bottom();
 
-	mRect = QRectF();
+    return QPointF(x, y); // round
 }
 
-QPointF DkEditableRect::map(const QPointF &pos) {
-
-	QPointF posM = pos;
-	if (mWorldTform) posM = mWorldTform->inverted().map(posM);
-	if (mImgTform)	posM = mImgTform->inverted().map(posM);
-	
-	return posM;
+void DkEditableRect::updateDiagonal(int idx)
+{
+    // we need to store the old diagonal in order to enable "keep aspect ratio"
+    if (mRect.isEmpty())
+        mOldDiag = DkVector(-1.0f, -1.0f);
+    else
+        mOldDiag = mRect.getDiagonal(idx);
 }
 
-QPointF DkEditableRect::clipToImage(const QPointF &pos) {
-	
-	if (!mImgRect)
-		return QPointF(pos);
+void DkEditableRect::setFixedDiagonal(const DkVector &diag)
+{
+    mFixedDiag = diag;
 
-	QRectF imgViewRect(*mImgRect);
-	if (mWorldTform) imgViewRect = mWorldTform->mapRect(imgViewRect);
+    qDebug() << "after rotating: " << mFixedDiag.toQPointF();
 
-	float x = (float)pos.x();
-	float y = (float)pos.y();
-	float magicMargin = 5;	// 5 px for now
+    // don't update in that case
+    if (diag.x == 0 || diag.y == 0)
+        return;
+    else
+        mFixedDiag.rotate(-mRect.getAngle());
 
-	if (qAbs(x - imgViewRect.left()) < magicMargin)
-		x = (float)imgViewRect.left();
-	if (qAbs(x - imgViewRect.right()) < magicMargin)
-		x = (float)imgViewRect.right();
+    QPointF c = mRect.getCenter();
 
-	if (qAbs(y - imgViewRect.top()) < magicMargin)
-		y = (float)imgViewRect.top();
-	if (qAbs(y - imgViewRect.bottom()) < magicMargin)
-		y = (float)imgViewRect.bottom();
+    if (!mRect.getPoly().isEmpty())
+        mRect.updateCorner(0, mRect.getPoly().at(0), mFixedDiag);
 
-	return QPointF(x,y);		// round
+    mRect.setCenter(c);
+    update();
 }
 
-QPointF DkEditableRect::clipToImageForce(const QPointF &pos) {
-
-	if (!mImgRect)
-		return QPointF(pos);
-
-	QRectF imgViewRect(*mImgRect);
-	if (mWorldTform) imgViewRect = mWorldTform->mapRect(imgViewRect);
+void DkEditableRect::setPanning(bool panning)
+{
+    this->mPanning = panning;
+    setCursor(Qt::OpenHandCursor);
+    qDebug() << "panning set...";
+}
 
-	float x = (float)pos.x();
-	float y = (float)pos.y();
+void DkEditableRect::updateCorner(int idx, const QPointF &point, Qt::KeyboardModifiers modifiers, bool changeState)
+{
+    if (changeState)
+        mState = scaling;
 
-	if (x < imgViewRect.left())
-		x = (float)imgViewRect.left();
-	if (x > imgViewRect.right())
-		x = (float)imgViewRect.right();
+    DkVector diag = (modifiers & Qt::ShiftModifier || (mFixedDiag.x != 0 && mFixedDiag.y != 0)) ? mOldDiag : DkVector(); // braces
+    QPointF p = point;
 
-	if (y < imgViewRect.top())
-		y = (float)imgViewRect.top();
-	if (y > imgViewRect.bottom())
-		y = (float)imgViewRect.bottom();
+    if ((modifiers & Qt::ControlModifier) == 0)
+        p = clipToImage(point);
 
-	return QPointF(x,y);		// round
-}
+    mRect.updateCorner(idx, map(p), diag);
 
-void DkEditableRect::updateDiagonal(int idx) {
+    // edge control -> remove aspect ratio constraint
+    if (idx >= 4 && idx < 8)
+        emit aRatioSignal(QPointF(0, 0));
 
-	// we need to store the old diagonal in order to enable "keep aspect ratio"
-	if (mRect.isEmpty())
-		mOldDiag = DkVector(-1.0f, -1.0f);
-	else
-		mOldDiag = mRect.getDiagonal(idx);
+    update();
 }
 
-void DkEditableRect::setFixedDiagonal(const DkVector& diag) {
+void DkEditableRect::paintEvent(QPaintEvent *event)
+{
+    // create path
+    QPainterPath path;
+    QRect canvas(geometry().x() - 1, geometry().y() - 1, geometry().width() + 1, geometry().height() + 1);
+    path.addRect(canvas);
 
-	mFixedDiag = diag;
+    QPolygonF p;
+    if (!mRect.isEmpty()) {
+        // TODO: directly map the points (it's easier and not slower at all)
+        p = mRect.getClosedPoly();
+        p = mTtform.map(p);
+        p = mRtform.map(p);
+        p = mTtform.inverted().map(p);
+        if (mImgTform)
+            p = mImgTform->map(p);
+        if (mWorldTform)
+            p = mWorldTform->map(p);
+        QPolygon pr = p.toPolygon(); // round coordinates
+        path.addPolygon(pr);
+    }
 
-	qDebug() << "after rotating: " << mFixedDiag.toQPointF();
+    // now draw
+    QPainter painter(this);
 
-	// don't update in that case
-	if (diag.x == 0 || diag.y == 0)
-		return;
-	else
-		mFixedDiag.rotate(-mRect.getAngle());
+    painter.setPen(mPen);
+    painter.setBrush(mBrush);
+    painter.drawPath(path);
 
-	QPointF c = mRect.getCenter();
+    drawGuide(&painter, p, mPaintMode);
 
-	if (!mRect.getPoly().isEmpty()) 
-		mRect.updateCorner(0, mRect.getPoly().at(0), mFixedDiag);
+    //// debug
+    // painter.drawPoint(mRect.getCenter());
 
-	mRect.setCenter(c);
-	update();
-}
+    // this changes the painter -> do it at the end
+    if (!mRect.isEmpty()) {
+        for (int idx = 0; idx < mCtrlPoints.size(); idx++) {
+            QPointF cp;
 
-void DkEditableRect::setPanning(bool panning) {
-	this->mPanning = panning;
-	setCursor(Qt::OpenHandCursor);
-	qDebug() << "panning set...";
-}
+            if (idx < 4) {
+                QPointF c = p[idx];
+                cp = c - mCtrlPoints[idx]->getCenter();
+            }
+            // paint control points in the middle of the edge
+            else if (idx >= 4) {
+                QPointF s = mCtrlPoints[idx]->getCenter();
 
-void DkEditableRect::updateCorner(int idx, const QPointF& point, Qt::KeyboardModifiers modifiers, bool changeState) {
+                QPointF lp = p[idx % 4];
+                QPointF rp = p[(idx + 1) % 4];
 
-	if (changeState)
-		mState = scaling;
+                QVector2D lv = QVector2D(lp - s);
+                QVector2D rv = QVector2D(rp - s);
 
-	DkVector diag = (modifiers & Qt::ShiftModifier || (mFixedDiag.x != 0 && mFixedDiag.y != 0)) ? mOldDiag : DkVector();	// braces
-	QPointF p = point;
-	
-	if ((modifiers & Qt::ControlModifier) == 0)
-		p = clipToImage(point);
+                cp = (lv + 0.5 * (rv - lv)).toPointF();
+            }
 
-	mRect.updateCorner(idx, map(p), diag);
+            mCtrlPoints[idx]->move(qRound(cp.x()), qRound(cp.y()));
+            mCtrlPoints[idx]->draw(&painter);
+        }
+    }
 
-	// edge control -> remove aspect ratio constraint
-	if (idx >= 4 && idx < 8)
-		emit aRatioSignal(QPointF(0,0));
+    painter.end();
 
-	update();
+    QWidget::paintEvent(event);
 }
 
-void DkEditableRect::paintEvent(QPaintEvent *event) {
+QRect DkEditableRect::rect() const
+{
+    QRect r;
+    r.setTopLeft(mRect.getCenter().toPoint());
+    r.setSize(mRect.size());
 
-	// create path
-	QPainterPath path;
-	QRect canvas(geometry().x()-1, geometry().y()-1, geometry().width()+1, geometry().height()+1);
-	path.addRect(canvas);
-	
-	QPolygonF p;
-	if (!mRect.isEmpty()) {
-		// TODO: directly map the points (it's easier and not slower at all)
-		p = mRect.getClosedPoly();
-		p = mTtform.map(p);
-		p = mRtform.map(p); 
-		p = mTtform.inverted().map(p);
-		if (mImgTform) p = mImgTform->map(p);
-		if (mWorldTform) p = mWorldTform->map(p);
-		QPolygon pr = p.toPolygon();	// round coordinates
-		path.addPolygon(pr);
-	}
+    return r;
+}
 
-	// now draw
-	QPainter painter(this);
+void DkEditableRect::drawGuide(QPainter *painter, const QPolygonF &p, int paintMode)
+{
+    if (p.isEmpty() || paintMode == no_guide)
+        return;
 
-	painter.setPen(mPen);
-	painter.setBrush(mBrush);
-	painter.drawPath(path);
+    QColor col = painter->pen().color();
+    col.setAlpha(150);
+    QPen pen = painter->pen();
+    QPen cPen = pen;
+    cPen.setColor(col);
+    painter->setPen(cPen);
 
-	drawGuide(&painter, p, mPaintMode);
-	
-	//// debug
-	//painter.drawPoint(mRect.getCenter());
+    // vertical
+    DkVector lp = p[1] - p[0]; // parallel to drawing
+    DkVector l9 = p[3] - p[0]; // perpendicular to drawing
 
-	// this changes the painter -> do it at the end
-	if (!mRect.isEmpty()) {
-		
-		for (int idx = 0; idx < mCtrlPoints.size(); idx++) {
-			
-			QPointF cp;
-			
-			if (idx < 4) {
-				QPointF c = p[idx];
-				cp = c-mCtrlPoints[idx]->getCenter();
-			}
-			// paint control points in the middle of the edge
-			else if (idx >= 4) {
-				QPointF s = mCtrlPoints[idx]->getCenter();
+    int nLines = (paintMode == rule_of_thirds) ? 3 : qRound(l9.norm() / 20.0f);
+    DkVector offset = l9;
+    offset.normalize();
+    offset *= l9.norm() / nLines;
 
-				QPointF lp = p[idx % 4];
-				QPointF rp = p[(idx+1) % 4];
+    DkVector offsetVec = offset;
 
-				QVector2D lv = QVector2D(lp-s);
-				QVector2D rv = QVector2D(rp-s);
+    for (int idx = 0; idx < (nLines - 1); idx++) {
+        // step through & paint
+        QLineF l = QLineF(DkVector(p[1] + offsetVec).toQPointF(), DkVector(p[0] + offsetVec).toQPointF());
+        painter->drawLine(l);
+        offsetVec += offset;
+    }
 
-				cp = (lv + 0.5*(rv - lv)).toPointF();
-			}
+    // horizontal
+    lp = p[3] - p[0]; // parallel to drawing
+    l9 = p[1] - p[0]; // perpendicular to drawing
 
-			mCtrlPoints[idx]->move(qRound(cp.x()), qRound(cp.y()));
-			mCtrlPoints[idx]->draw(&painter);
-		}
-	}
- 
-	painter.end();
+    nLines = (paintMode == rule_of_thirds) ? 3 : qRound(l9.norm() / 20);
+    offset = l9;
+    offset.normalize();
+    offset *= l9.norm() / nLines;
 
-	QWidget::paintEvent(event);
-}
+    offsetVec = offset;
 
-QRect DkEditableRect::rect() const {
-	
-	QRect r;
-	r.setTopLeft(mRect.getCenter().toPoint());
-	r.setSize(mRect.size());
+    for (int idx = 0; idx < (nLines - 1); idx++) {
+        // step through & paint
+        QLineF l = QLineF(DkVector(p[3] + offsetVec).toQPointF(), DkVector(p[0] + offsetVec).toQPointF());
+        painter->drawLine(l);
+        offsetVec += offset;
+    }
 
-	return r;
+    painter->setPen(pen); // revert painter
 }
 
-void DkEditableRect::drawGuide(QPainter* painter, const QPolygonF& p, int paintMode) {
+// make events callable
+void DkEditableRect::mousePressEvent(QMouseEvent *event)
+{
+    // panning -> redirect to mViewport
+    if (event->buttons() == Qt::LeftButton && (event->modifiers() == DkSettingsManager::param().global().altMod || mPanning)) {
+        event->setModifiers(Qt::NoModifier); // we want a 'normal' action in the mViewport
+        event->ignore();
+        return;
+    }
 
-	if (p.isEmpty() || paintMode == no_guide)
-		return;
+    mPosGrab = map(QPointF(event->pos()));
+    mClickPos = QPointF(event->pos());
 
-	QColor col = painter->pen().color();
-	col.setAlpha(150);
-	QPen pen = painter->pen();
-	QPen cPen = pen;
-	cPen.setColor(col);
-	painter->setPen(cPen);
+    if (mRect.isEmpty()) {
+        mState = initializing;
+        setAngle(0);
+    } else if (mRect.getPoly().containsPoint(mPosGrab, Qt::OddEvenFill)) {
+        mState = moving;
+    } else {
+        mState = rotating;
+    }
+}
 
-	// vertical
-	DkVector lp = p[1]-p[0];	// parallel to drawing
-	DkVector l9 = p[3]-p[0];	// perpendicular to drawing
+void DkEditableRect::mouseMoveEvent(QMouseEvent *event)
+{
+    // panning -> redirect to mViewport
+    if (event->modifiers() == DkSettingsManager::param().global().altMod || mPanning) {
+        if (event->buttons() != Qt::LeftButton)
+            setCursor(Qt::OpenHandCursor);
+        else
+            setCursor(Qt::ClosedHandCursor);
 
-	int nLines = (paintMode == rule_of_thirds) ? 3 : qRound(l9.norm()/20.0f);
-	DkVector offset = l9;
-	offset.normalize();
-	offset *= l9.norm()/nLines;
+        event->setModifiers(Qt::NoModifier);
+        event->ignore();
+        update();
+        return;
+    }
 
-	DkVector offsetVec = offset;
+    QPointF posM = map(QPointF(event->pos()));
+
+    if (event->buttons() != Qt::LeftButton && !mRect.isEmpty()) {
+        // show rotating - moving
+        if (mRect.getPoly().containsPoint(map(event->pos()), Qt::OddEvenFill))
+            setCursor(Qt::SizeAllCursor);
+        else
+            setCursor(mRotatingCursor);
+    } else if (mRect.isEmpty())
+        setCursor(Qt::CrossCursor);
+
+    // additionally needed for showToolTip
+    double angle = 0;
+
+    if (mState == initializing && event->buttons() == Qt::LeftButton) {
+        QPointF clipPos = clipToImageForce(QPointF(event->pos()));
+
+        if (!mImgRect || !mRect.isEmpty() || clipPos == QPointF(event->pos())) {
+            if (mRect.isEmpty()) {
+                for (int idx = 0; idx < mCtrlPoints.size(); idx++)
+                    mCtrlPoints[idx]->show();
+
+                QPointF p = map(clipToImageForce(mClickPos));
+                mRect.setAllCorners(p);
+            }
+
+            DkVector diag;
+
+            // when initializing shift should make the mRect a square
+            if (event->modifiers() == Qt::ShiftModifier)
+                diag = DkVector(1.0f, 1.0f);
+            else
+                diag = mFixedDiag;
+            mRect.updateCorner(2, map(clipPos), diag);
+            update();
+        }
 
-	for (int idx = 0; idx < (nLines-1); idx++) {
+    } else if (mState == moving && event->buttons() == Qt::LeftButton) {
+        QPointF dxy = posM - mPosGrab;
+        mRtform.translate(dxy.x(), dxy.y());
+        mPosGrab = posM;
+        update();
+    } else if (mState == rotating && event->buttons() == Qt::LeftButton) {
+        DkVector c(mRect.getCenter());
+        DkVector xt(mPosGrab);
+        DkVector xn(posM);
+
+        // compute the direction vector;
+        xt = c - xt;
+        xn = c - xn;
+        angle = xn.angle() - xt.angle();
+
+        // just rotate in CV_PI*0.25 steps if shift is pressed
+        if (event->modifiers() == Qt::ShiftModifier) {
+            double angleRound = DkMath::normAngleRad(angle + mRect.getAngle(), -CV_PI * 0.125, CV_PI * 0.125);
+            angle -= angleRound;
+        }
 
-		// step through & paint
-		QLineF l = QLineF(DkVector(p[1]+offsetVec).toQPointF(), DkVector(p[0]+offsetVec).toQPointF());
-		painter->drawLine(l);
-		offsetVec += offset;
-	}
-
-	// horizontal
-	lp = p[3]-p[0];	// parallel to drawing
-	l9 = p[1]-p[0];	// perpendicular to drawing
+        setAngle(angle, false);
+    }
 
-	nLines = (paintMode == rule_of_thirds) ? 3 : qRound(l9.norm()/20);
-	offset = l9;
-	offset.normalize();
-	offset *= l9.norm()/nLines;
+    if (event->buttons() == Qt::LeftButton) {
+        QPolygonF p = mRect.getPoly();
 
-	offsetVec = offset;
+        float sAngle = DkMath::getReadableAngle(mRect.getAngle() + angle);
+        int height = qRound(DkVector(p[1] - p[0]).norm());
+        int width = qRound(DkVector(p[3] - p[0]).norm());
 
-	for (int idx = 0; idx < (nLines-1); idx++) {
+        // show coordinates
+        QString info;
+        QPoint tl;
 
-		// step through & paint
-		QLineF l = QLineF(DkVector(p[3]+offsetVec).toQPointF(), DkVector(p[0]+offsetVec).toQPointF());
-		painter->drawLine(l);
-		offsetVec += offset;
-	}
+        if (sAngle == 0.0f || fabs(sAngle) == 90.0f) {
+            tl = mRtform.map(mRect.getTopLeft()).toPoint();
+            info += "x: ";
+        } else {
+            tl = mRtform.map(mRect.getCenter()).toPoint();
+            info += "center x: ";
+        }
+        info += QString::number(tl.x()) + ", y: ";
+        info += QString::number(tl.y()) + " | ";
+        info += QString::number(width) + " x ";
+        info += QString::number(height) + " px | ";
+        info += QString::number(sAngle) + dk_degree_str;
+
+        if (mShowInfo) {
+            QToolTip::showText(event->globalPos(), info, this);
+        }
 
-	painter->setPen(pen);	// revert painter
+        DkStatusBarManager::instance().setMessage(info);
+    }
 
+    // QWidget::mouseMoveEvent(event);
 }
 
-// make events callable
-void DkEditableRect::mousePressEvent(QMouseEvent *event) {
-
-	// panning -> redirect to mViewport
-	if (event->buttons() == Qt::LeftButton && 
-		(event->modifiers() == DkSettingsManager::param().global().altMod || mPanning)) {
-		event->setModifiers(Qt::NoModifier);	// we want a 'normal' action in the mViewport
-		event->ignore();
-		return;
-	}
-
-	mPosGrab = map(QPointF(event->pos()));
-	mClickPos = QPointF(event->pos());
-
-	if (mRect.isEmpty()) {
-		mState = initializing;
-		setAngle(0);
-	}
-	else if (mRect.getPoly().containsPoint(mPosGrab, Qt::OddEvenFill)) {
-		mState = moving;
-	}
-	else {
-		mState = rotating;
-	}
-
-}
-
-void DkEditableRect::mouseMoveEvent(QMouseEvent *event) {
-
-	// panning -> redirect to mViewport
-	if (event->modifiers() == DkSettingsManager::param().global().altMod ||
-		mPanning) {
-		
-		if (event->buttons() != Qt::LeftButton)
-			setCursor(Qt::OpenHandCursor);
-		else
-			setCursor(Qt::ClosedHandCursor);
-
-		event->setModifiers(Qt::NoModifier);
-		event->ignore();
-		update();
-		return;
-	}
-
-	QPointF posM = map(QPointF(event->pos()));
-	
-	if (event->buttons() != Qt::LeftButton && !mRect.isEmpty()) {
-		// show rotating - moving
-		if (mRect.getPoly().containsPoint(map(event->pos()), Qt::OddEvenFill))
-			setCursor(Qt::SizeAllCursor);
-		else
-			setCursor(mRotatingCursor);
-	}
-	else if (mRect.isEmpty())
-		setCursor(Qt::CrossCursor);
-
-	// additionally needed for showToolTip
-	double angle = 0;
-
-	if (mState == initializing && event->buttons() == Qt::LeftButton) {
-
-		QPointF clipPos = clipToImageForce(QPointF(event->pos()));
-
-		if (!mImgRect || !mRect.isEmpty() || clipPos == QPointF(event->pos())) {
-			
-			if (mRect.isEmpty()) {
-
-				for (int idx = 0; idx < mCtrlPoints.size(); idx++)
-					mCtrlPoints[idx]->show();
-
-				QPointF p = map(clipToImageForce(mClickPos));
-				mRect.setAllCorners(p);
-			}
-			
-			DkVector diag;
-			
-			// when initializing shift should make the mRect a square
-			if (event->modifiers() == Qt::ShiftModifier)
-				diag = DkVector(1.0f, 1.0f);
-			else
-				diag = mFixedDiag;
-			mRect.updateCorner(2, map(clipPos), diag);
-			update();
-		}
- 
-	}
-	else if (mState == moving && event->buttons() == Qt::LeftButton) {
-		
-		QPointF dxy = posM-mPosGrab;
-		mRtform.translate(dxy.x(), dxy.y());
-		mPosGrab = posM;
-		update();
-	}
-	else if (mState == rotating && event->buttons() == Qt::LeftButton) {
-
-		DkVector c(mRect.getCenter());
-		DkVector xt(mPosGrab);
-		DkVector xn(posM);
-
-		// compute the direction vector;
-		xt = c-xt;
-		xn = c-xn;
-		angle = xn.angle() - xt.angle();
-
-		// just rotate in CV_PI*0.25 steps if shift is pressed
-		if (event->modifiers() == Qt::ShiftModifier) {
-			double angleRound = DkMath::normAngleRad(angle+mRect.getAngle(), -CV_PI*0.125, CV_PI*0.125);
-			angle -= angleRound;
-		}
-					
-		setAngle(angle, false);
-	}
+void DkEditableRect::mouseReleaseEvent(QMouseEvent *event)
+{
+    // panning -> redirect to mViewport
+    if (event->buttons() == Qt::LeftButton && (event->modifiers() == DkSettingsManager::param().global().altMod || mPanning)) {
+        setCursor(Qt::OpenHandCursor);
+        event->setModifiers(Qt::NoModifier);
+        event->ignore();
+        return;
+    }
 
-	if (event->buttons() == Qt::LeftButton) {
+    mState = do_nothing;
 
-		QPolygonF p = mRect.getPoly();
+    applyTransform();
+    // QWidget::mouseReleaseEvent(event);
+}
 
-		float sAngle = DkMath::getReadableAngle(mRect.getAngle() + angle);
-		int height = qRound(DkVector(p[1]-p[0]).norm());
-		int width = qRound(DkVector(p[3]-p[0]).norm());
+void DkEditableRect::wheelEvent(QWheelEvent *event)
+{
+    QWidget::wheelEvent(event);
+    update(); // this is an extra update - however we get rendering errors otherwise?!
+}
 
-		// show coordinates
-		QString info;
-		QPoint tl;
+void DkEditableRect::applyTransform()
+{
+    // apply transform
+    mRect.transform(mTtform, mRtform);
 
-		if (sAngle == 0.0f || fabs(sAngle) == 90.0f) {
-			tl = mRtform.map(mRect.getTopLeft()).toPoint();
-			info += "x: ";
-		}
-		else {
-			tl = mRtform.map(mRect.getCenter()).toPoint();
-			info += "center x: ";
-		}
-		info += QString::number(tl.x()) + ", y: ";
-		info += QString::number(tl.y()) + " | ";
-		info += QString::number(width) + " x ";
-		info += QString::number(height) + " px | ";
-		info += QString::number(sAngle) + dk_degree_str;
+    mRtform.reset();
+    mTtform.reset();
+    update();
 
-		if (mShowInfo) {
+    emit updateRectSignal(rect());
+}
 
-			QToolTip::showText(event->globalPos(),
-				info,
-				this);
-		}
+void DkEditableRect::keyPressEvent(QKeyEvent *event)
+{
+    if (event->key() == Qt::Key_Alt)
+        setCursor(Qt::OpenHandCursor);
 
-		DkStatusBarManager::instance().setMessage(info);
-	}
+    QWidget::keyPressEvent(event);
+}
 
-	//QWidget::mouseMoveEvent(event);
+void DkEditableRect::keyReleaseEvent(QKeyEvent *event)
+{
+    QWidget::keyPressEvent(event);
 }
 
-void DkEditableRect::mouseReleaseEvent(QMouseEvent *event) {
+void DkEditableRect::setPaintHint(int paintMode /* = DkCropToolBar::no_guide */)
+{
+    this->mPaintMode = paintMode;
+    update();
+}
 
-	// panning -> redirect to mViewport
-	if (event->buttons() == Qt::LeftButton && 
-		(event->modifiers() == DkSettingsManager::param().global().altMod || mPanning)) {
-		setCursor(Qt::OpenHandCursor);
-		event->setModifiers(Qt::NoModifier);
-		event->ignore();
-		return;
-	}
+void DkEditableRect::setShadingHint(bool)
+{
+    QColor col = mBrush.color();
+    col = QColor(255 - col.red(), 255 - col.green(), 255 - col.blue(), col.alpha());
+    mBrush.setColor(col);
 
-	mState = do_nothing;
+    col = mPen.color();
+    col = QColor(255 - col.red(), 255 - col.green(), 255 - col.blue(), col.alpha());
+    mPen.setColor(col);
 
-	applyTransform();
-	//QWidget::mouseReleaseEvent(event);
+    update();
 }
 
-void DkEditableRect::wheelEvent(QWheelEvent* event) {
-
-	QWidget::wheelEvent(event);
-	update();	// this is an extra update - however we get rendering errors otherwise?!
+void DkEditableRect::setShowInfo(bool showInfo)
+{
+    this->mShowInfo = showInfo;
 }
 
-void DkEditableRect::applyTransform() {
-
-	// apply transform
-	mRect.transform(mTtform, mRtform);
-
-	mRtform.reset();	
-	mTtform.reset();
-	update();
+void DkEditableRect::setRect(const QRect &rect)
+{
+    mRect.setCenter(rect.topLeft());
+    mRect.setSize(rect.size());
 
-	emit updateRectSignal(rect());
+    update();
 }
 
-void DkEditableRect::keyPressEvent(QKeyEvent *event) {
+void DkEditableRect::setAngle(double angle, bool apply)
+{
+    DkVector c(mRect.getCenter());
 
-	if (event->key() == Qt::Key_Alt)
-		setCursor(Qt::OpenHandCursor);
+    if (!mTtform.isTranslating())
+        mTtform.translate(-c.x, -c.y);
 
-	QWidget::keyPressEvent(event);
+    mRtform.reset();
+    if (apply)
+        mRtform.rotateRadians(angle - mRect.getAngle());
+    else
+        mRtform.rotateRadians(angle);
+
+    if (apply)
+        applyTransform();
+    else {
+        emit angleSignal(mRect.getAngle() + angle);
+        update();
+    }
 }
 
-void DkEditableRect::keyReleaseEvent(QKeyEvent *event) {
+void DkEditableRect::setVisible(bool visible)
+{
+    if (!visible) {
+        mRect = DkRotatingRect();
+        for (int idx = 0; idx < mCtrlPoints.size(); idx++)
+            mCtrlPoints[idx]->hide();
+    } else {
+        // setFocus(Qt::ActiveWindowFocusReason);
+        setCursor(Qt::CrossCursor);
+    }
 
-	QWidget::keyPressEvent(event);
+    DkFadeWidget::setVisible(visible);
 }
 
-void DkEditableRect::setPaintHint(int paintMode /* = DkEditableRect::no_guide */) {
-
-	this->mPaintMode = paintMode;
-	update();
+// DkEditableRect --------------------------------------------------------------------
+DkCropWidget::DkCropWidget(QRectF rect /* = QRect */, QWidget *parent /* = 0*/, Qt::WindowFlags f /* = 0*/)
+    : DkEditableRect(rect, parent, f)
+{
+    cropToolbar = 0;
 }
 
-void DkEditableRect::setShadingHint(bool) {
+void DkCropWidget::createToolbar()
+{
+    cropToolbar = new DkCropToolBar(tr("Crop Toolbar"), this);
 
-	QColor col = mBrush.color();
-	col = QColor(255-col.red(), 255-col.green(), 255-col.blue(), col.alpha());
-	mBrush.setColor(col);
+    connect(cropToolbar, SIGNAL(updateRectSignal(const QRect &)), this, SLOT(setRect(const QRect &)));
 
-	col = mPen.color();
-	col = QColor(255-col.red(), 255-col.green(), 255-col.blue(), col.alpha());
-	mPen.setColor(col);
+    connect(cropToolbar, SIGNAL(cropSignal(bool)), this, SLOT(crop(bool)));
+    connect(cropToolbar, SIGNAL(cancelSignal()), this, SIGNAL(hideSignal()));
+    connect(cropToolbar, SIGNAL(aspectRatio(const DkVector &)), this, SLOT(setFixedDiagonal(const DkVector &)));
+    connect(cropToolbar, SIGNAL(angleSignal(double)), this, SLOT(setAngle(double)));
+    connect(cropToolbar, SIGNAL(panSignal(bool)), this, SLOT(setPanning(bool)));
+    connect(cropToolbar, SIGNAL(paintHint(int)), this, SLOT(setPaintHint(int)));
+    connect(cropToolbar, SIGNAL(shadingHint(bool)), this, SLOT(setShadingHint(bool)));
+    connect(cropToolbar, SIGNAL(showInfo(bool)), this, SLOT(setShowInfo(bool)));
+    connect(this, SIGNAL(angleSignal(double)), cropToolbar, SLOT(angleChanged(double)));
+    connect(this, SIGNAL(aRatioSignal(const QPointF &)), cropToolbar, SLOT(setAspectRatio(const QPointF &)));
+    connect(this, SIGNAL(updateRectSignal(const QRect &)), cropToolbar, SLOT(setRect(const QRect &)));
 
-	update();
+    cropToolbar->loadSettings(); // need to this manually after connecting the slots
 }
 
-void DkEditableRect::setShowInfo(bool showInfo) {
-	this->mShowInfo = showInfo;
+void DkCropWidget::mouseDoubleClickEvent(QMouseEvent *ev)
+{
+    crop();
+    QWidget::mouseDoubleClickEvent(ev);
 }
 
-void DkEditableRect::setRect(const QRect & rect) {
-	
-	mRect.setCenter(rect.topLeft());
-	mRect.setSize(rect.size());
-
-	update();
+DkCropToolBar *DkCropWidget::getToolbar() const
+{
+    return cropToolbar;
 }
 
-void DkEditableRect::setAngle(double angle, bool apply) {
-
-	DkVector c(mRect.getCenter());
+void DkCropWidget::crop(bool cropToMetadata)
+{
+    if (!cropToolbar)
+        return;
 
-	if (!mTtform.isTranslating())
-		mTtform.translate(-c.x, -c.y);
-	
-	mRtform.reset();
-	if (apply)
-		mRtform.rotateRadians(angle-mRect.getAngle());
-	else
-		mRtform.rotateRadians(angle);
-	
-	if (apply)
-		applyTransform();
-	else {
-		emit angleSignal(mRect.getAngle()+angle);
-		update();
-	}
+    if (!mRect.isEmpty())
+        emit cropImageSignal(mRect, cropToolbar->getColor(), cropToMetadata);
 
+    setVisible(false);
+    setWindowOpacity(0);
+    emit hideSignal();
 }
 
-void DkEditableRect::setVisible(bool visible) {
+void DkCropWidget::setVisible(bool visible)
+{
+    if (visible && !cropToolbar)
+        createToolbar();
 
-	if (!visible) {
-		
-		mRect = DkRotatingRect();
-		for (int idx = 0; idx < mCtrlPoints.size(); idx++)
-			mCtrlPoints[idx]->hide();
-	}
-	else {
-		//setFocus(Qt::ActiveWindowFocusReason);
-		setCursor(Qt::CrossCursor);
-	}
-
-	DkFadeWidget::setVisible(visible);
+    DkToolBarManager::inst().showToolBar(cropToolbar, visible);
+    DkEditableRect::setVisible(visible);
 }
 
 // Image histogram  -------------------------------------------------------------------
-DkHistogram::DkHistogram(QWidget *parent) : DkFadeWidget(parent){
-	
-	setObjectName("DkHistogram");
-	setMinimumWidth(265);
-	setMinimumHeight(142);
-	setCursor(Qt::ArrowCursor);
-	loadSettings();
+DkHistogram::DkHistogram(QWidget *parent)
+    : DkFadeWidget(parent)
+{
+    setObjectName("DkHistogram");
+    setMinimumWidth(265);
+    setMinimumHeight(142);
+    setCursor(Qt::ArrowCursor);
+    loadSettings();
 
-	//create context menu
-	QAction* showStats = new QAction(tr("Show Statistics"), this);
-	showStats->setObjectName("toggleStats");
-	showStats->setCheckable(true);
-	showStats->setChecked(mDisplayMode == DisplayMode::histogram_mode_extended);
+    // create context menu
+    QAction *showStats = new QAction(tr("Show Statistics"), this);
+    showStats->setObjectName("toggleStats");
+    showStats->setCheckable(true);
+    showStats->setChecked(mDisplayMode == DisplayMode::histogram_mode_extended);
 
-	mContextMenu = new QMenu(tr("Histogram Settings"));
-	mContextMenu->addAction(showStats);
+    mContextMenu = new QMenu(tr("Histogram Settings"));
+    mContextMenu->addAction(showStats);
 
-	QMetaObject::connectSlotsByName(this);
+    QMetaObject::connectSlotsByName(this);
 }
 
-DkHistogram::~DkHistogram() {
+DkHistogram::~DkHistogram()
+{
 }
 
 /**
  * Paints the image histogram
  **/
-void DkHistogram::paintEvent(QPaintEvent*) {
-
-	QPainter painter(this);
-	painter.fillRect(1, 1, width(), height(), DkSettingsManager::param().display().hudBgColor);
-
-	int numTextLines;
-	if (mDisplayMode == DisplayMode::histogram_mode_simple) {
-		numTextLines = 0;
-	} else {
-		// histogram_mode_extended has 2 lines of text
-		numTextLines = 2;
-	}
-
-	const int margin = 5;
-	const int TEXT_SIZE = 12 + 1;  //FIXME just guessed
-	const int textHeight = numTextLines * TEXT_SIZE + margin;
-
-	int binHeight = height() - margin * 2 - textHeight;
-	int binBottom = height() - margin - textHeight;
-
-	//draw Histogram
-	if (mIsPainted && mMaxValue > 0) {
-		
-		for (int x = 0; x < 256; x++) {
-			
-			// get bounded values
-			int rLineHeight = qMax(qMin(qRound((float)mHist[0][x] * binHeight * mScaleFactor/mMaxValue), binHeight), 0);
-			int gLineHeight = qMax(qMin(qRound((float)mHist[1][x] * binHeight * mScaleFactor/mMaxValue), binHeight), 0);
-			int bLineHeight = qMax(qMin(qRound((float)mHist[2][x] * binHeight * mScaleFactor/mMaxValue), binHeight), 0);
-			int maxLineHeight = qMax(qMax(rLineHeight, gLineHeight), bLineHeight);
-
-			painter.setCompositionMode(QPainter::CompositionMode_Clear);
-			painter.setPen(Qt::black);
-			painter.drawLine(QPoint(x + margin, binBottom), QPoint(x + margin, binBottom - maxLineHeight));
-
-			painter.setCompositionMode(QPainter::CompositionMode_Screen);
-			painter.setPen(Qt::red);
-			painter.drawLine(QPoint(x+margin, binBottom), QPoint(x+margin, binBottom - rLineHeight));
-			painter.setPen(Qt::green);
-			painter.drawLine(QPoint(x+margin, binBottom), QPoint(x+margin, binBottom - gLineHeight));
-			painter.setPen(Qt::blue);
-			painter.drawLine(QPoint(x+margin, binBottom), QPoint(x+margin, binBottom - bLineHeight));
-		}
-	}
+void DkHistogram::paintEvent(QPaintEvent *)
+{
+    QPainter painter(this);
+    painter.fillRect(1, 1, width(), height(), DkSettingsManager::param().display().hudBgColor);
+
+    int numTextLines;
+    if (mDisplayMode == DisplayMode::histogram_mode_simple) {
+        numTextLines = 0;
+    } else {
+        // histogram_mode_extended has 2 lines of text
+        numTextLines = 2;
+    }
 
-    if (mDisplayMode == DisplayMode::histogram_mode_extended) {
+    const int margin = 5;
+    const int TEXT_SIZE = 12 + 1; // FIXME just guessed
+    const int textHeight = numTextLines * TEXT_SIZE + margin;
+
+    int binHeight = height() - margin * 2 - textHeight;
+    int binBottom = height() - margin - textHeight;
+
+    // draw Histogram
+    if (mIsPainted && mMaxValue > 0) {
+        for (int x = 0; x < 256; x++) {
+            // get bounded values
+            int rLineHeight = qMax(qMin(qRound((float)mHist[0][x] * binHeight * mScaleFactor / mMaxValue), binHeight), 0);
+            int gLineHeight = qMax(qMin(qRound((float)mHist[1][x] * binHeight * mScaleFactor / mMaxValue), binHeight), 0);
+            int bLineHeight = qMax(qMin(qRound((float)mHist[2][x] * binHeight * mScaleFactor / mMaxValue), binHeight), 0);
+            int maxLineHeight = qMax(qMax(rLineHeight, gLineHeight), bLineHeight);
+
+            painter.setCompositionMode(QPainter::CompositionMode_Clear);
+            painter.setPen(Qt::black);
+            painter.drawLine(QPoint(x + margin, binBottom), QPoint(x + margin, binBottom - maxLineHeight));
+
+            painter.setCompositionMode(QPainter::CompositionMode_Screen);
+            painter.setPen(Qt::red);
+            painter.drawLine(QPoint(x + margin, binBottom), QPoint(x + margin, binBottom - rLineHeight));
+            painter.setPen(Qt::green);
+            painter.drawLine(QPoint(x + margin, binBottom), QPoint(x + margin, binBottom - gLineHeight));
+            painter.setPen(Qt::blue);
+            painter.drawLine(QPoint(x + margin, binBottom), QPoint(x + margin, binBottom - bLineHeight));
+        }
+    }
 
-		//draw histogram text
+    if (mDisplayMode == DisplayMode::histogram_mode_extended) {
+        // draw histogram text
         double megaPixels = (double)mNumPixels * 10.0e-7;
         painter.setPen(QColor(255, 255, 255, 200));
 
         QString histText1("Pixels: %1\tMPix: %2");
-        painter.drawText(QPoint(margin, height() - 2 * TEXT_SIZE + margin),
-                         histText1.arg(mNumPixels, 10, 10)
-                                  .arg(megaPixels, 10, 'f', 2));
+        painter.drawText(QPoint(margin, height() - 2 * TEXT_SIZE + margin), histText1.arg(mNumPixels, 10, 10).arg(megaPixels, 10, 'f', 2));
 
         if (mMinBinValue < 256) {
-            //gray image statistics
+            // gray image statistics
             QString histText2("Min: %1\tMax: %2\tValue Count: %3");
             painter.drawText(QPoint(margin, height() - 1 * TEXT_SIZE + margin),
-                             histText2.arg(mMinBinValue, 5, 10)
-                                      .arg(mMaxBinValue, 5, 10)
-                                      .arg(mNumDistinctValues, 5, 10));
+                             histText2.arg(mMinBinValue, 5, 10).arg(mMaxBinValue, 5, 10).arg(mNumDistinctValues, 5, 10));
         } else {
-            //color image statistics
+            // color image statistics
             double blackPct = 100.0 * (double)mNumZeroPixels / (double)mNumPixels;
             double whitePct = 100.0 * (double)mNumSaturatedPixels / (double)mNumPixels;
             double goodPct = 100.0 * (double)(mNumPixels - mNumZeroPixels - mNumSaturatedPixels) / (double)mNumPixels;
 
             QString histText2("Black:  %1\tGood: %3\tWhite: %2");
             painter.drawText(QPoint(margin, height() - 1 * TEXT_SIZE + margin),
-                             histText2.arg(blackPct, 5, 'f', 1)
-                                      .arg(whitePct, 5, 'f', 1)
-                                      .arg(goodPct, 5, 'f', 1));
-
+                             histText2.arg(blackPct, 5, 'f', 1).arg(whitePct, 5, 'f', 1).arg(goodPct, 5, 'f', 1));
         }
     }
 }
 
-void DkHistogram::contextMenuEvent(QContextMenuEvent * event) {
+void DkHistogram::contextMenuEvent(QContextMenuEvent *event)
+{
+    mContextMenu->exec(event->globalPos());
+    event->accept();
 
-	mContextMenu->exec(event->globalPos());
-	event->accept();
-
-	// do not pass it on
-	//DkFadeWidget::contextMenuEvent(event);
+    // do not pass it on
+    // DkFadeWidget::contextMenuEvent(event);
 }
 
-void DkHistogram::on_toggleStats_triggered(bool show) {
-	
-	mDisplayMode = (show) ? DisplayMode::histogram_mode_extended : DisplayMode::histogram_mode_simple;
-	DkSettingsManager::param().display().histogramStyle = (int)mDisplayMode;
-	update();
+void DkHistogram::on_toggleStats_triggered(bool show)
+{
+    mDisplayMode = (show) ? DisplayMode::histogram_mode_extended : DisplayMode::histogram_mode_simple;
+    DkSettingsManager::param().display().histogramStyle = (int)mDisplayMode;
+    update();
 }
 
-void DkHistogram::loadSettings() {
-
-	int styleSetting = DkSettingsManager::param().display().histogramStyle;
-	DisplayMode maybeMode = static_cast<DisplayMode>(styleSetting);
-	if(maybeMode == DisplayMode::histogram_mode_simple ||
-	   maybeMode == DisplayMode::histogram_mode_extended){
-
-		mDisplayMode = maybeMode;
-	} else {
-		mDisplayMode = DisplayMode::histogram_mode_simple;
-	}
+void DkHistogram::loadSettings()
+{
+    int styleSetting = DkSettingsManager::param().display().histogramStyle;
+    DisplayMode maybeMode = static_cast<DisplayMode>(styleSetting);
+    if (maybeMode == DisplayMode::histogram_mode_simple || maybeMode == DisplayMode::histogram_mode_extended) {
+        mDisplayMode = maybeMode;
+    } else {
+        mDisplayMode = DisplayMode::histogram_mode_simple;
+    }
 }
 
 /**
  * Goes through the image and counts pixels values. They are used to create the image histogram.
  * @param currently displayed image
- **/ 
-void DkHistogram::drawHistogram(QImage imgQt) {
-
-	if (!isVisible() || imgQt.isNull()) {
-		setPainted(false);
-		return;
-	}
-
-	DkTimer dt;
-
-	//clear histogram values
-	mNumZeroPixels = 0;
-	mNumSaturatedPixels = 0;
-	mMaxBinValue = -1;
-	mMinBinValue = 256;
-	mMaxValue = 0;
-	mNumPixels = imgQt.width() * imgQt.height();
-
-	for (int idx = 0; idx < 256; idx++) {
-		mHist[0][idx] = 0;
-		mHist[1][idx] = 0;
-		mHist[2][idx] = 0;
-	}
-
-	// count pixel- and total values, for
-	// 8 bit images
-	if (imgQt.depth() == 8) {
-
-		qDebug() << "8 bit histogram -------------------";
-
-		for (int rIdx = 0; rIdx < imgQt.height(); rIdx++) {
-
-			const unsigned char* pixel = imgQt.constScanLine(rIdx);
-
-			for (int cIdx = 0; cIdx < imgQt.width(); cIdx++, pixel++) {
-
-				mHist[0][*pixel]++;
-				mHist[1][*pixel]++;
-				mHist[2][*pixel]++;
-
-				if (*pixel == 255) mNumSaturatedPixels++;
-				if (*pixel < mMinBinValue) mMinBinValue = *pixel;
-				if (*pixel > mMaxBinValue) mMaxBinValue = *pixel;
-			}
-		}
-	}
-	// 24 bit images
-	else if (imgQt.depth() == 24) {
-		
-		for (int rIdx = 0; rIdx < imgQt.height(); rIdx++) {
-
-			const unsigned char* pixel = imgQt.constScanLine(rIdx);
-			for (int cIdx = 0; cIdx < imgQt.width(); cIdx++) {
-
-				// If I understood the api correctly, the first bits are 0 if we have 24bpp & < 8 bits per channel
-				unsigned char pixR = *pixel;
-				mHist[0][*pixel]++; pixel++;
-				unsigned char pixG = *pixel;
-				mHist[1][*pixel]++; pixel++;
-				unsigned char pixB = *pixel;
-				mHist[2][*pixel]++; pixel++;
-
-				if (pixR == 0 && pixG == 0 && pixB == 0) {
-					mNumZeroPixels++;
-				}
-				else if (pixR == 255 && pixG == 255 && pixB == 255) {
-					mNumSaturatedPixels++;
-				}
-			}
-		}
-	}
-	// 32 bit images
-	else if (imgQt.depth() == 32) {
-		
-		for (int rIdx = 0; rIdx < imgQt.height(); rIdx++) {
-		
-			const QRgb* pixel = (QRgb*)(imgQt.constScanLine(rIdx));
-	
-			for (int cIdx = 0; cIdx < imgQt.width(); cIdx++, pixel++) {
-				size_t pixR = static_cast<size_t>(qRed(*pixel));
-				size_t pixG = static_cast<size_t>(qGreen(*pixel));
-				size_t pixB = static_cast<size_t>(qBlue(*pixel));
-
-				mHist[0][pixR]++;
-				mHist[1][pixG]++;
-				mHist[2][pixB]++;
-
-				if (pixR == 0 && pixG == 0 && pixB == 0) {
-					mNumZeroPixels++;
-				}
-				else if (pixR == 255 && pixG == 255 && pixB == 255) {
-					mNumSaturatedPixels++;
-				}
-			}
-		}
-	}
-
-	// determine extreme values from the histogram
-	mNumDistinctValues = 0;
+ **/
+void DkHistogram::drawHistogram(QImage imgQt)
+{
+    if (!isVisible() || imgQt.isNull()) {
+        setPainted(false);
+        return;
+    }
+
+    DkTimer dt;
+
+    // clear histogram values
+    mNumZeroPixels = 0;
+    mNumSaturatedPixels = 0;
+    mMaxBinValue = -1;
+    mMinBinValue = 256;
+    mMaxValue = 0;
+    mNumPixels = imgQt.width() * imgQt.height();
+
+    for (int idx = 0; idx < 256; idx++) {
+        mHist[0][idx] = 0;
+        mHist[1][idx] = 0;
+        mHist[2][idx] = 0;
+    }
+
+    // count pixel- and total values, for
+    // 8 bit images
+    if (imgQt.depth() == 8) {
+        qDebug() << "8 bit histogram -------------------";
+
+        for (int rIdx = 0; rIdx < imgQt.height(); rIdx++) {
+            const unsigned char *pixel = imgQt.constScanLine(rIdx);
+
+            for (int cIdx = 0; cIdx < imgQt.width(); cIdx++, pixel++) {
+                mHist[0][*pixel]++;
+                mHist[1][*pixel]++;
+                mHist[2][*pixel]++;
+
+                if (*pixel == 255)
+                    mNumSaturatedPixels++;
+                if (*pixel < mMinBinValue)
+                    mMinBinValue = *pixel;
+                if (*pixel > mMaxBinValue)
+                    mMaxBinValue = *pixel;
+            }
+        }
+    }
+    // 24 bit images
+    else if (imgQt.depth() == 24) {
+        for (int rIdx = 0; rIdx < imgQt.height(); rIdx++) {
+            const unsigned char *pixel = imgQt.constScanLine(rIdx);
+            for (int cIdx = 0; cIdx < imgQt.width(); cIdx++) {
+                // If I understood the api correctly, the first bits are 0 if we have 24bpp & < 8 bits per channel
+                unsigned char pixR = *pixel;
+                mHist[0][*pixel]++;
+                pixel++;
+                unsigned char pixG = *pixel;
+                mHist[1][*pixel]++;
+                pixel++;
+                unsigned char pixB = *pixel;
+                mHist[2][*pixel]++;
+                pixel++;
+
+                if (pixR == 0 && pixG == 0 && pixB == 0) {
+                    mNumZeroPixels++;
+                } else if (pixR == 255 && pixG == 255 && pixB == 255) {
+                    mNumSaturatedPixels++;
+                }
+            }
+        }
+    }
+    // 32 bit images
+    else if (imgQt.depth() == 32) {
+        for (int rIdx = 0; rIdx < imgQt.height(); rIdx++) {
+            const QRgb *pixel = (QRgb *)(imgQt.constScanLine(rIdx));
+
+            for (int cIdx = 0; cIdx < imgQt.width(); cIdx++, pixel++) {
+                size_t pixR = static_cast<size_t>(qRed(*pixel));
+                size_t pixG = static_cast<size_t>(qGreen(*pixel));
+                size_t pixB = static_cast<size_t>(qBlue(*pixel));
+
+                mHist[0][pixR]++;
+                mHist[1][pixG]++;
+                mHist[2][pixB]++;
+
+                if (pixR == 0 && pixG == 0 && pixB == 0) {
+                    mNumZeroPixels++;
+                } else if (pixR == 255 && pixG == 255 && pixB == 255) {
+                    mNumSaturatedPixels++;
+                }
+            }
+        }
+    }
+
+    // determine extreme values from the histogram
+    mNumDistinctValues = 0;
 
     for (int idx = 0; idx < 256; idx++) {
         if (mHist[0][idx] > mMaxValue)
@@ -2365,701 +2425,693 @@ void DkHistogram::drawHistogram(QImage imgQt) {
         if (mHist[2][idx] > mMaxValue)
             mMaxValue = mHist[2][idx];
 
-        if (mHist[0][idx] || mHist[1][idx] || mHist[2][idx]){
+        if (mHist[0][idx] || mHist[1][idx] || mHist[2][idx]) {
             mNumDistinctValues++;
         }
     }
 
-	setPainted(true);
-	qDebug() << "drawing the histogram took me: " << dt;
-	update();
+    setPainted(true);
+    qDebug() << "drawing the histogram took me: " << dt;
+    update();
 }
 
 /**
  * Clears the histogram panel
- **/ 
-void DkHistogram::clearHistogram() {
-
-	setPainted(false);
-	update();
+ **/
+void DkHistogram::clearHistogram()
+{
+    setPainted(false);
+    update();
 }
 
-void DkHistogram::setPainted(bool isPainted) {
-
-	this->mIsPainted = isPainted;
+void DkHistogram::setPainted(bool isPainted)
+{
+    this->mIsPainted = isPainted;
 }
 
-void DkHistogram::setMaxHistogramValue(int maxValue) {
-
-	if (maxValue == 0)
-		setPainted(false);
+void DkHistogram::setMaxHistogramValue(int maxValue)
+{
+    if (maxValue == 0)
+        setPainted(false);
 
-	this->mMaxValue = maxValue;
+    this->mMaxValue = maxValue;
 }
 
 /**
  * Updates histogram values.
  * @param values to be copied
- **/ 
-void DkHistogram::updateHistogramValues(int histValues[][256]) {
-
-	for(int i = 0; i < 256; i++) {
-		this->mHist[0][i] = histValues[0][i];
-		this->mHist[1][i] = histValues[1][i];
-		this->mHist[2][i] = histValues[2][i];
-	}
+ **/
+void DkHistogram::updateHistogramValues(int histValues[][256])
+{
+    for (int i = 0; i < 256; i++) {
+        this->mHist[0][i] = histValues[0][i];
+        this->mHist[1][i] = histValues[1][i];
+        this->mHist[2][i] = histValues[2][i];
+    }
 }
 
 /**
  * Mouse events for scaling the histogram - enlarge the histogram between the bottom axis and the cursor position
- **/ 
-void DkHistogram::mousePressEvent(QMouseEvent *event) {
-
-	// always propagate mouse events
-	if (event->buttons() != Qt::LeftButton)
-		DkFadeWidget::mousePressEvent(event);
+ **/
+void DkHistogram::mousePressEvent(QMouseEvent *event)
+{
+    // always propagate mouse events
+    if (event->buttons() != Qt::LeftButton)
+        DkFadeWidget::mousePressEvent(event);
 }
 
-void DkHistogram::mouseMoveEvent(QMouseEvent *event) {
-
-	if (event->buttons() == Qt::LeftButton) {
-		
-		float cp = (float)(height() - event->pos().y());
-		
-		if (cp > 0) {
-			mScaleFactor = height() / cp;
-			update();
-		}
-	}
-	else
-		DkFadeWidget::mouseMoveEvent(event);
+void DkHistogram::mouseMoveEvent(QMouseEvent *event)
+{
+    if (event->buttons() == Qt::LeftButton) {
+        float cp = (float)(height() - event->pos().y());
 
+        if (cp > 0) {
+            mScaleFactor = height() / cp;
+            update();
+        }
+    } else
+        DkFadeWidget::mouseMoveEvent(event);
 }
 
-void DkHistogram::mouseReleaseEvent(QMouseEvent *event) {
-	
-	mScaleFactor = 1;
-	update();
+void DkHistogram::mouseReleaseEvent(QMouseEvent *event)
+{
+    mScaleFactor = 1;
+    update();
 
-	if (event->buttons() != Qt::LeftButton)
-		DkFadeWidget::mouseReleaseEvent(event);
+    if (event->buttons() != Qt::LeftButton)
+        DkFadeWidget::mouseReleaseEvent(event);
 }
 
 // DkFileInfo --------------------------------------------------------------------
-DkFileInfo::DkFileInfo() {
-	mFileExists = false;
-	mUsed = false;
+DkFileInfo::DkFileInfo()
+{
+    mFileExists = false;
+    mUsed = false;
 }
 
-DkFileInfo::DkFileInfo(const QFileInfo& fileInfo) {
-
-	mFileInfo = fileInfo;
+DkFileInfo::DkFileInfo(const QFileInfo &fileInfo)
+{
+    mFileInfo = fileInfo;
 }
 
-bool DkFileInfo::exists() const {
-	return mFileExists;
+bool DkFileInfo::exists() const
+{
+    return mFileExists;
 }
 
-void DkFileInfo::setExists(bool fileExists) {
-	mFileExists = fileExists;
+void DkFileInfo::setExists(bool fileExists)
+{
+    mFileExists = fileExists;
 }
 
-bool DkFileInfo::inUse() const {
-	return mUsed;
+bool DkFileInfo::inUse() const
+{
+    return mUsed;
 }
 
-void DkFileInfo::setInUse(bool inUse) {
-	mUsed = inUse;
+void DkFileInfo::setInUse(bool inUse)
+{
+    mUsed = inUse;
 }
 
-QString DkFileInfo::getFilePath() const {
-	return mFileInfo.absoluteFilePath();
+QString DkFileInfo::getFilePath() const
+{
+    return mFileInfo.absoluteFilePath();
 }
 
-
 // DkFileLabel --------------------------------------------------------------------
-DkFolderLabel::DkFolderLabel(const DkFileInfo& fileInfo, QWidget* parent /* = 0 */, Qt::WindowFlags f /* = 0 */) : QLabel(parent, f) {
-
-	// we don't use the file labels anymore
-	// + isDir() might hang - if we try to get an unavailable network resource on windows
-	//QFileInfo fInfo(fileInfo.getFilePath());
-	//if (fInfo.isDir())
-		setText(fileInfo.getFilePath());
-	//else
-	//	setText(fInfo.fileName());
+DkFolderLabel::DkFolderLabel(const DkFileInfo &fileInfo, QWidget *parent /* = 0 */, Qt::WindowFlags f /* = 0 */)
+    : QLabel(parent, f)
+{
+    // we don't use the file labels anymore
+    // + isDir() might hang - if we try to get an unavailable network resource on windows
+    // QFileInfo fInfo(fileInfo.getFilePath());
+    // if (fInfo.isDir())
+    setText(fileInfo.getFilePath());
+    // else
+    //	setText(fInfo.fileName());
 
-	this->fileInfo = fileInfo;
-	setObjectName("DkFileLabel");
+    this->fileInfo = fileInfo;
+    setObjectName("DkFileLabel");
 }
 
-void DkFolderLabel::mousePressEvent(QMouseEvent *ev) {
-
-	emit loadFileSignal(fileInfo.getFilePath());
+void DkFolderLabel::mousePressEvent(QMouseEvent *ev)
+{
+    emit loadFileSignal(fileInfo.getFilePath());
 
-	QLabel::mousePressEvent(ev);
+    QLabel::mousePressEvent(ev);
 }
 
 // DkDirectoryEdit --------------------------------------------------------------------
-DkDirectoryEdit::DkDirectoryEdit(QWidget* parent /* = 0 */) : QLineEdit(parent) {
-	setObjectName("DkWarningEdit");
-	connect(this, SIGNAL(textChanged(QString)), this, SLOT(lineEditChanged(QString)));
-
-	QCompleter *completer = new QCompleter(this);
-	QDirModel* model = new QDirModel(completer);
-	model->setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
-	completer->setModel(model);
-	setCompleter(completer);
-}
-
-DkDirectoryEdit::DkDirectoryEdit(const QString& content, QWidget* parent /* = 0 */) : QLineEdit(parent) {
-	
-	setObjectName("DkWarningEdit");
-	connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(lineEditChanged(const QString&)));
-	setText(content);
-
-	QCompleter *completer = new QCompleter(this);
-	QDirModel* model = new QDirModel(completer);
-	model->setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
-	completer->setModel(model);
-	setCompleter(completer);
-}
-
-void DkDirectoryEdit::lineEditChanged(const QString& path) {
-	
-	setProperty("error", !existsDirectory(path));
-	style()->unpolish(this);
-	style()->polish(this);
-	update();
-	
-	// converting to QDir since D:/img == D:/img/ then
-	if (QDir(path).absolutePath() != QDir(mOldPath).absolutePath() && existsDirectory(path)) {
-		mOldPath = path;
-		emit directoryChanged(path);
-	}
+DkDirectoryEdit::DkDirectoryEdit(QWidget *parent /* = 0 */)
+    : QLineEdit(parent)
+{
+    setObjectName("DkWarningEdit");
+    connect(this, SIGNAL(textChanged(QString)), this, SLOT(lineEditChanged(QString)));
+
+    QCompleter *completer = new QCompleter(this);
+    QFileSystemModel *model = new QFileSystemModel(completer);
+    model->setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
+    completer->setModel(model);
+    setCompleter(completer);
+}
+
+DkDirectoryEdit::DkDirectoryEdit(const QString &content, QWidget *parent /* = 0 */)
+    : QLineEdit(parent)
+{
+    setObjectName("DkWarningEdit");
+    connect(this, SIGNAL(textChanged(const QString &)), this, SLOT(lineEditChanged(const QString &)));
+    setText(content);
+
+    QCompleter *completer = new QCompleter(this);
+    QFileSystemModel *model = new QFileSystemModel(completer);
+    model->setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
+    completer->setModel(model);
+    setCompleter(completer);
+}
+
+void DkDirectoryEdit::lineEditChanged(const QString &path)
+{
+    setProperty("error", !existsDirectory(path));
+    style()->unpolish(this);
+    style()->polish(this);
+    update();
+
+    // converting to QDir since D:/img == D:/img/ then
+    if (QDir(path).absolutePath() != QDir(mOldPath).absolutePath() && existsDirectory(path)) {
+        mOldPath = path;
+        emit directoryChanged(path);
+    }
 }
 
-bool DkDirectoryEdit::existsDirectory(const QString& path) {
-	
-	return QDir(path).exists();
+bool DkDirectoryEdit::existsDirectory(const QString &path)
+{
+    return QDir(path).exists();
 }
 
 // DkDirectoryChooser --------------------------------------------------------------------
-DkDirectoryChooser::DkDirectoryChooser(const QString& dirPath, QWidget* parent) : DkWidget(parent) {
-	
-	createLayout(dirPath);
-	QMetaObject::connectSlotsByName(this);
+DkDirectoryChooser::DkDirectoryChooser(const QString &dirPath, QWidget *parent)
+    : DkWidget(parent)
+{
+    createLayout(dirPath);
+    QMetaObject::connectSlotsByName(this);
 }
 
-void DkDirectoryChooser::createLayout(const QString& dirPath) {
-
-	mDirEdit = new DkDirectoryEdit(dirPath, this);
-	mDirEdit->setObjectName("dirEdit");
+void DkDirectoryChooser::createLayout(const QString &dirPath)
+{
+    mDirEdit = new DkDirectoryEdit(dirPath, this);
+    mDirEdit->setObjectName("dirEdit");
 
-	QPushButton* dirButton = new QPushButton(tr("..."), this);
-	dirButton->setObjectName("dirButton");
+    QPushButton *dirButton = new QPushButton(tr("..."), this);
+    dirButton->setObjectName("dirButton");
 
-	QHBoxLayout* layout = new QHBoxLayout(this);
-	layout->setAlignment(Qt::AlignLeft);
-	layout->setContentsMargins(0, 0, 0, 0);
-	layout->addWidget(mDirEdit);
-	layout->addWidget(dirButton);
+    QHBoxLayout *layout = new QHBoxLayout(this);
+    layout->setAlignment(Qt::AlignLeft);
+    layout->setContentsMargins(0, 0, 0, 0);
+    layout->addWidget(mDirEdit);
+    layout->addWidget(dirButton);
 
-	connect(mDirEdit, SIGNAL(textChanged(const QString&)), this, SIGNAL(directoryChanged(const QString&)));
+    connect(mDirEdit, SIGNAL(textChanged(const QString &)), this, SIGNAL(directoryChanged(const QString &)));
 }
 
-void DkDirectoryChooser::on_dirButton_clicked() {
-
-	QString dirPath = QFileDialog::getExistingDirectory(
-		this, 
-		tr("Open an Image Directory"), 
-		mDirEdit->text(),
-		QFileDialog::ShowDirsOnly | DkDialog::fileDialogOptions()
-	);
+void DkDirectoryChooser::on_dirButton_clicked()
+{
+    QString dirPath =
+        QFileDialog::getExistingDirectory(this, tr("Open an Image Directory"), mDirEdit->text(), QFileDialog::ShowDirsOnly | DkDialog::fileDialogOptions());
 
-	if (dirPath.isEmpty())
-		return;
+    if (dirPath.isEmpty())
+        return;
 
-	mDirEdit->setText(dirPath);
+    mDirEdit->setText(dirPath);
 }
 
 // DkListWidget --------------------------------------------------------------------
-DkListWidget::DkListWidget(QWidget* parent) : QListWidget(parent) {
-
-	setAcceptDrops(true);
-	setDragEnabled(true);
-	setMinimumHeight(100);
-	setDropIndicatorShown(true);
-
-	setSelectionMode(QAbstractItemView::ExtendedSelection);
+DkListWidget::DkListWidget(QWidget *parent)
+    : QListWidget(parent)
+{
+    setAcceptDrops(true);
+    setDragEnabled(true);
+    setMinimumHeight(100);
+    setDropIndicatorShown(true);
 
+    setSelectionMode(QAbstractItemView::ExtendedSelection);
 }
 
-void DkListWidget::startDrag(Qt::DropActions) {
-
-	QListWidget::startDrag(Qt::MoveAction);
+void DkListWidget::startDrag(Qt::DropActions)
+{
+    QListWidget::startDrag(Qt::MoveAction);
 }
 
-bool DkListWidget::isEmpty() const {
-	return count() == 0;
+bool DkListWidget::isEmpty() const
+{
+    return count() == 0;
 }
 
-void DkListWidget::setEmptyText(const QString & text) {
-	mEmptyText = text;
+void DkListWidget::setEmptyText(const QString &text)
+{
+    mEmptyText = text;
 }
 
-void DkListWidget::dropEvent(QDropEvent *event) {
+void DkListWidget::dropEvent(QDropEvent *event)
+{
+    if (event->source() != this)
+        QListWidget::dropEvent(event);
 
-	if (event->source() != this)
-		QListWidget::dropEvent(event);
-
-	// workaround for the empty rows
-	emit dataDroppedSignal();
+    // workaround for the empty rows
+    emit dataDroppedSignal();
 }
 
-void DkListWidget::paintEvent(QPaintEvent *event) {
-
-	QListView::paintEvent(event);
+void DkListWidget::paintEvent(QPaintEvent *event)
+{
+    QListView::paintEvent(event);
 
-	if (model() && model()->rowCount(rootIndex())) 
-		return;
+    if (model() && model()->rowCount(rootIndex()))
+        return;
 
-	// The view is empty.
-	QPainter p(viewport());
-	p.setPen(Qt::NoPen);
-	p.setBrush(QBrush(QColor(200,200,200), Qt::BDiagPattern));
-	p.drawRect(QRect(QPoint(), size()));
+    // The view is empty.
+    QPainter p(viewport());
+    p.setPen(Qt::NoPen);
+    p.setBrush(QBrush(QColor(200, 200, 200), Qt::BDiagPattern));
+    p.drawRect(QRect(QPoint(), size()));
 
-	p.setPen(QPen(QColor(100,100,100)));
-	p.drawText(rect(), Qt::AlignCenter, mEmptyText);
+    p.setPen(QPen(QColor(100, 100, 100)));
+    p.drawText(rect(), Qt::AlignCenter, mEmptyText);
 }
 
 // DkProgressBar --------------------------------------------------------------------
-DkProgressBar::DkProgressBar(QWidget* parent) : QProgressBar(parent) {
+DkProgressBar::DkProgressBar(QWidget *parent)
+    : QProgressBar(parent)
+{
+    initPoints();
+    mTimer.setInterval(20);
+    connect(&mTimer, SIGNAL(timeout()), this, SLOT(update()));
 
-	initPoints();
-	mTimer.setInterval(20);
-	connect(&mTimer, SIGNAL(timeout()), this, SLOT(update()));
-
-	mShowTimer.setInterval(3000);
-	connect(&mShowTimer, SIGNAL(timeout()), this, SLOT(show()));
+    mShowTimer.setInterval(3000);
+    connect(&mShowTimer, SIGNAL(timeout()), this, SLOT(show()));
 }
 
-void DkProgressBar::setVisible(bool visible) {
-
-	if (visible)
-		mTimer.start();
-	else
-		mTimer.stop();
+void DkProgressBar::setVisible(bool visible)
+{
+    if (visible)
+        mTimer.start();
+    else
+        mTimer.stop();
 
-	if (visible && !isVisible())
-		initPoints();
+    if (visible && !isVisible())
+        initPoints();
 
-	QProgressBar::setVisible(visible);
+    QProgressBar::setVisible(visible);
 }
 
-void DkProgressBar::setVisibleTimed(bool visible, int time) {
+void DkProgressBar::setVisibleTimed(bool visible, int time)
+{
+    // nothing todo?
+    if (visible && mShowTimer.isActive())
+        return;
 
-	// nothing todo?
-	if (visible && mShowTimer.isActive())
-		return;
+    // hide
+    if (isVisible() && !visible)
+        hide();
 
-	// hide
-	if (isVisible() && !visible)
-		hide();
+    // just stop the timer, if it is active & the process is done already
+    if (!visible && mShowTimer.isActive())
+        mShowTimer.stop();
 
-	// just stop the timer, if it is active & the process is done already
-	if (!visible && mShowTimer.isActive())
-		mShowTimer.stop();
-
-	// start the timer
-	if (!isVisible() && visible && time > 0) {
-		mShowTimer.setInterval(time);
-		mShowTimer.start();
-	}
+    // start the timer
+    if (!isVisible() && visible && time > 0) {
+        mShowTimer.setInterval(time);
+        mShowTimer.start();
+    }
 
-	// simply show
-	if (visible && !isVisible() && time <= 0)
-		show();
+    // simply show
+    if (visible && !isVisible() && time <= 0)
+        show();
 }
 
-void DkProgressBar::paintEvent(QPaintEvent *) {
-
-	QStyleOption opt;
-	opt.init(this);
+void DkProgressBar::paintEvent(QPaintEvent *)
+{
+    QStyleOption opt;
+    opt.initFrom(this);
 
-	QPainter p(this);
-	style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
-	p.setPen(Qt::NoPen);
+    QPainter p(this);
+    style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
+    p.setPen(Qt::NoPen);
 
-	if (parentWidget() && DkUtils::getMainWindow()->isFullScreen())
-		p.setBackground(DkSettingsManager::param().slideShow().backgroundColor);
+    if (parentWidget() && DkUtils::getMainWindow()->isFullScreen())
+        p.setBackground(DkSettingsManager::param().slideShow().backgroundColor);
 
-	p.setBrush(DkSettingsManager::param().display().highlightColor);
+    p.setBrush(DkSettingsManager::param().display().highlightColor);
 
-	if (value() != minimum()) {
+    if (value() != minimum()) {
+        int rv = qRound((value() - minimum()) / (double)(maximum() - minimum()) * width());
 
-		int rv = qRound((value() - minimum()) / (double)(maximum() - minimum())*width());
+        // draw the current status bar
+        QRect r(QPoint(), size());
+        r.setRight(rv);
 
-		// draw the current status bar
-		QRect r(QPoint(), size());
-		r.setRight(rv);
-
-		p.drawRect(r);
-	}
-
-	bool stillVisible = false;
-
-	// draw points
-	for (double& pt : mPoints) {
+        p.drawRect(r);
+    }
 
-		animatePoint(pt);
+    bool stillVisible = false;
 
-		QRect r(QPoint(), QSize(height(), height()));
-		r.moveLeft(qRound(pt*width()));
+    // draw points
+    for (double &pt : mPoints) {
+        animatePoint(pt);
 
-		p.drawRect(r);
+        QRect r(QPoint(), QSize(height(), height()));
+        r.moveLeft(qRound(pt * width()));
 
-		if (pt < 0.99)
-			stillVisible = true;
-	}
+        p.drawRect(r);
 
-	if (!stillVisible)
-		initPoints();
+        if (pt < 0.99)
+            stillVisible = true;
+    }
 
+    if (!stillVisible)
+        initPoints();
 }
 
-void DkProgressBar::initPoints() {
-
-	mPoints.clear();
+void DkProgressBar::initPoints()
+{
+    mPoints.clear();
 
-	int m = 7;
-	for (int idx = 1; idx < m; idx++) {
-		mPoints.append((double)idx / m * 0.1);
-	}
+    int m = 7;
+    for (int idx = 1; idx < m; idx++) {
+        mPoints.append((double)idx / m * 0.1);
+    }
 }
 
-void DkProgressBar::animatePoint(double& xVal) {
-
-
-	double speed = xVal > 0.5 ? std::abs(1.0 - xVal) : std::abs(xVal);
-	speed *= .05;
+void DkProgressBar::animatePoint(double &xVal)
+{
+    double speed = xVal > 0.5 ? std::abs(1.0 - xVal) : std::abs(xVal);
+    speed *= .05;
 
-	xVal += speed;
+    xVal += speed;
 }
 
 // DkGenericProfileWidget --------------------------------------------------------------------
-DkGenericProfileWidget::DkGenericProfileWidget(const QString& name, QWidget* parent, const QString& settingsPath) : DkNamedWidget(name, parent) {
-
-	mSettingsPath = settingsPath.isEmpty() ? DkSettingsManager::param().settingsPath() : settingsPath;
+DkGenericProfileWidget::DkGenericProfileWidget(const QString &name, QWidget *parent, const QString &settingsPath)
+    : DkNamedWidget(name, parent)
+{
+    mSettingsPath = settingsPath.isEmpty() ? DkSettingsManager::param().settingsPath() : settingsPath;
 }
 
-DkGenericProfileWidget::~DkGenericProfileWidget() {
-
-	// save settings
-	for (int idx = 0; idx < mProfileList->count(); idx++) {
-		saveSettings(mProfileList->itemText(idx));
-	}
+DkGenericProfileWidget::~DkGenericProfileWidget()
+{
+    // save settings
+    for (int idx = 0; idx < mProfileList->count(); idx++) {
+        saveSettings(mProfileList->itemText(idx));
+    }
 }
 
-void DkGenericProfileWidget::init() {
+void DkGenericProfileWidget::init()
+{
+    createLayout();
 
-	createLayout();
+    connect(mSaveButton, SIGNAL(clicked()), this, SLOT(saveSettings()));
+    connect(mDeleteButton, SIGNAL(clicked()), this, SLOT(deleteCurrentSetting()));
+    connect(mProfileList, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(loadSettings(const QString &)));
 
-	connect(mSaveButton, SIGNAL(clicked()), this, SLOT(saveSettings()));
-	connect(mDeleteButton, SIGNAL(clicked()), this, SLOT(deleteCurrentSetting()));
-	connect(mProfileList, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(loadSettings(const QString&)));
-
-	activate(false);	// inits gui states
+    activate(false); // inits gui states
 }
 
-void DkGenericProfileWidget::createLayout() {
-
-	QPixmap pm = QPixmap(":/nomacs/img/save.svg");
-	mSaveButton = new QPushButton(this);
-	mSaveButton->setIcon(QIcon(pm));
-	//mSaveButton->setIconSize(pm.size());
-	mSaveButton->setFlat(true);
+void DkGenericProfileWidget::createLayout()
+{
+    QPixmap pm = QPixmap(":/nomacs/img/save.svg");
+    mSaveButton = new QPushButton(this);
+    mSaveButton->setIcon(QIcon(pm));
+    // mSaveButton->setIconSize(pm.size());
+    mSaveButton->setFlat(true);
 
-	pm = QPixmap(":/nomacs/img/trash.svg");
-	mDeleteButton = new QPushButton(this);
-	mDeleteButton->setIcon(QIcon(pm));
-	//mDeleteButton->setIconSize(pm.size());
-	mDeleteButton->setFlat(true);
+    pm = QPixmap(":/nomacs/img/trash.svg");
+    mDeleteButton = new QPushButton(this);
+    mDeleteButton->setIcon(QIcon(pm));
+    // mDeleteButton->setIconSize(pm.size());
+    mDeleteButton->setFlat(true);
 
-	mProfileList = new QComboBox(this);
-	mProfileList->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Maximum);
+    mProfileList = new QComboBox(this);
+    mProfileList->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Maximum);
 
-	QAction* delGradientAction = new QAction(tr("Set As Default"), mProfileList);
-	connect(delGradientAction, SIGNAL(triggered()), this, SLOT(setDefaultModel()));
+    QAction *delGradientAction = new QAction(tr("Set As Default"), mProfileList);
+    connect(delGradientAction, SIGNAL(triggered()), this, SLOT(setDefaultModel()));
 
-	mProfileList->addAction(delGradientAction);
-	mProfileList->setContextMenuPolicy(Qt::ActionsContextMenu);
+    mProfileList->addAction(delGradientAction);
+    mProfileList->setContextMenuPolicy(Qt::ActionsContextMenu);
 
-	QStringList modelStrings = loadProfileStrings();
+    QStringList modelStrings = loadProfileStrings();
 
-	if (!modelStrings.empty()) {
-		mProfileList->addItems(loadProfileStrings());
-		mProfileList->setCurrentText(loadDefaultProfileString());
-	}
+    if (!modelStrings.empty()) {
+        mProfileList->addItems(loadProfileStrings());
+        mProfileList->setCurrentText(loadDefaultProfileString());
+    }
 
-	QHBoxLayout* layout = new QHBoxLayout(this);
-	layout->setAlignment(Qt::AlignTop);
-	layout->setContentsMargins(0, 0, 0, 0);
-	layout->addWidget(mProfileList);
-	layout->addWidget(mSaveButton);
-	layout->addWidget(mDeleteButton);
+    QHBoxLayout *layout = new QHBoxLayout(this);
+    layout->setAlignment(Qt::AlignTop);
+    layout->setContentsMargins(0, 0, 0, 0);
+    layout->addWidget(mProfileList);
+    layout->addWidget(mSaveButton);
+    layout->addWidget(mDeleteButton);
 }
 
-QStringList DkGenericProfileWidget::loadProfileStrings() const {
+QStringList DkGenericProfileWidget::loadProfileStrings() const
+{
+    QSettings s(mSettingsPath, QSettings::IniFormat);
 
-	QSettings s(mSettingsPath, QSettings::IniFormat);
+    s.beginGroup(mSettingsGroup);
+    QStringList modelStrings = s.childGroups();
+    s.endGroup();
 
-	s.beginGroup(mSettingsGroup);
-	QStringList modelStrings = s.childGroups();
-	s.endGroup();
+    qDebug() << "profile settings of group: " << mSettingsGroup;
 
-	qDebug() << "profile settings of group: " << mSettingsGroup;
-
-	return modelStrings;
+    return modelStrings;
 }
 
-void DkGenericProfileWidget::deleteCurrentSetting() {
-
-	QString modelName = mProfileList->currentText();
+void DkGenericProfileWidget::deleteCurrentSetting()
+{
+    QString modelName = mProfileList->currentText();
 
-	QSettings s(mSettingsPath, QSettings::IniFormat);
+    QSettings s(mSettingsPath, QSettings::IniFormat);
 
-	s.beginGroup(mSettingsGroup);
-	s.beginGroup(modelName);
-	s.remove("");	// remove all group entries
-	s.endGroup();
-	s.endGroup();
+    s.beginGroup(mSettingsGroup);
+    s.beginGroup(modelName);
+    s.remove(""); // remove all group entries
+    s.endGroup();
+    s.endGroup();
 
-	// update list
-	mProfileList->removeItem(mProfileList->currentIndex());
+    // update list
+    mProfileList->removeItem(mProfileList->currentIndex());
 }
 
-void DkGenericProfileWidget::saveSettings() const {
-
-	// default mode is overwrite (UI is asking anyway)
-	QString dName = mProfileList->currentText().isEmpty() ? "Profile 1" : mProfileList->currentText();
+void DkGenericProfileWidget::saveSettings() const
+{
+    // default mode is overwrite (UI is asking anyway)
+    QString dName = mProfileList->currentText().isEmpty() ? "Profile 1" : mProfileList->currentText();
 
-	bool ok;
-	QString text = QInputDialog::getText(
-		DkUtils::getMainWindow(), 
-		tr("Profile Name"),
-		tr("Profile Name:"), 
-		QLineEdit::Normal,
-		dName, &ok);
+    bool ok;
+    QString text = QInputDialog::getText(DkUtils::getMainWindow(), tr("Profile Name"), tr("Profile Name:"), QLineEdit::Normal, dName, &ok);
 
-	if (!ok || text.isEmpty())
-		return;	// user canceled
+    if (!ok || text.isEmpty())
+        return; // user canceled
 
-				// is the model name unique?
-	if (mProfileList->findText(text) != -1) {
+    // is the model name unique?
+    if (mProfileList->findText(text) != -1) {
+        QMessageBox::StandardButton button = QMessageBox::information(DkUtils::getMainWindow(),
+                                                                      tr("Profile Already Exists"),
+                                                                      tr("Do you want to overwrite %1?").arg(text),
+                                                                      QMessageBox::Yes | QMessageBox::No);
 
-		QMessageBox::StandardButton button = QMessageBox::information(
-			DkUtils::getMainWindow(), 
-			tr("Profile Already Exists"), 
-			tr("Do you want to overwrite %1?").arg(text), 
-			QMessageBox::Yes | QMessageBox::No);
-
-		if (button == QMessageBox::No) {
-			saveSettings(); // start over
-			return;
-		}
-	}
+        if (button == QMessageBox::No) {
+            saveSettings(); // start over
+            return;
+        }
+    }
 
-	saveSettings(text);
+    saveSettings(text);
 }
 
-void DkGenericProfileWidget::saveSettings(const QString& name) const {
+void DkGenericProfileWidget::saveSettings(const QString &name) const
+{
+    if (mProfileList->findText(name) == -1)
+        mProfileList->addItem(name);
 
-	if (mProfileList->findText(name) == -1)
-		mProfileList->addItem(name);
-
-	int idx = mProfileList->findText(name);
-	if (idx != -1)
-		mProfileList->setCurrentIndex(idx);
+    int idx = mProfileList->findText(name);
+    if (idx != -1)
+        mProfileList->setCurrentIndex(idx);
 }
 
-void DkGenericProfileWidget::activate(bool active) {
-
-	mProfileList->setVisible(active);
-	mSaveButton->setVisible(active);
-	mDeleteButton->setVisible(active);
-	mEmpty = !active;
+void DkGenericProfileWidget::activate(bool active)
+{
+    mProfileList->setVisible(active);
+    mSaveButton->setVisible(active);
+    mDeleteButton->setVisible(active);
+    mEmpty = !active;
 
-	if (active)
-		loadSettings(mProfileList->currentText());
+    if (active)
+        loadSettings(mProfileList->currentText());
 
-	update();
+    update();
 }
 
-void DkGenericProfileWidget::setDefaultModel() const {
-
-	QSettings s(mSettingsPath, QSettings::IniFormat);
-	s.beginGroup(mSettingsGroup);
-	s.setValue("DefaultProfileString", mProfileList->currentText());
-	s.endGroup();
+void DkGenericProfileWidget::setDefaultModel() const
+{
+    QSettings s(mSettingsPath, QSettings::IniFormat);
+    s.beginGroup(mSettingsGroup);
+    s.setValue("DefaultProfileString", mProfileList->currentText());
+    s.endGroup();
 }
 
-QString DkGenericProfileWidget::loadDefaultProfileString() const {
+QString DkGenericProfileWidget::loadDefaultProfileString() const
+{
+    QSettings s(mSettingsPath, QSettings::IniFormat);
+    s.beginGroup(mSettingsGroup);
+    QString defaultString = s.value("DefaultProfileString", "").toString();
+    s.endGroup();
 
-	QSettings s(mSettingsPath, QSettings::IniFormat);
-	s.beginGroup(mSettingsGroup);
-	QString defaultString = s.value("DefaultProfileString", "").toString();
-	s.endGroup();
-
-	return defaultString;
+    return defaultString;
 }
 
-void DkGenericProfileWidget::paintEvent(QPaintEvent* ev) {
-
-	if (mEmpty) {
-
-		// The view is empty.
-		QPainter p(this);
-		p.setPen(Qt::NoPen);
-		p.setBrush(QBrush(QColor(200,200,200), Qt::BDiagPattern));
-		p.drawRect(QRect(QPoint(), size()));
+void DkGenericProfileWidget::paintEvent(QPaintEvent *ev)
+{
+    if (mEmpty) {
+        // The view is empty.
+        QPainter p(this);
+        p.setPen(Qt::NoPen);
+        p.setBrush(QBrush(QColor(200, 200, 200), Qt::BDiagPattern));
+        p.drawRect(QRect(QPoint(), size()));
 
-		p.setPen(QPen(QColor(100,100,100)));
-		p.drawText(rect(), Qt::AlignCenter, tr("No Profiles"));
-	}
-	else
-		DkNamedWidget::paintEvent(ev);
+        p.setPen(QPen(QColor(100, 100, 100)));
+        p.drawText(rect(), Qt::AlignCenter, tr("No Profiles"));
+    } else
+        DkNamedWidget::paintEvent(ev);
 }
 
 // DkTabEntryWidget --------------------------------------------------------------------
-DkTabEntryWidget::DkTabEntryWidget(const QIcon& icon, const QString& text, QWidget* parent) : QPushButton(text, parent) {
+DkTabEntryWidget::DkTabEntryWidget(const QIcon &icon, const QString &text, QWidget *parent)
+    : QPushButton(text, parent)
+{
+    setObjectName("DkTabEntryWidget");
 
-	setObjectName("DkTabEntryWidget");
+    QPixmap pm = DkImage::colorizePixmap(icon.pixmap(100), QColor(255, 255, 255));
+    setIcon(pm);
+    setIconSize(pm.size());
 
-	QPixmap pm = DkImage::colorizePixmap(icon.pixmap(100), QColor(255, 255, 255));
-	setIcon(pm);
-	setIconSize(pm.size());
-
-	setFlat(true);
-	setCheckable(true);
+    setFlat(true);
+    setCheckable(true);
 }
 
-void DkTabEntryWidget::paintEvent(QPaintEvent *event) {
-
-	// fixes stylesheets which are not applied to custom widgets
-	QStyleOption opt;
-	opt.init(this);
-	QPainter p(this);
-	style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
+void DkTabEntryWidget::paintEvent(QPaintEvent *event)
+{
+    // fixes stylesheets which are not applied to custom widgets
+    QStyleOption opt;
+    opt.initFrom(this);
+    QPainter p(this);
+    style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
 
-	QPushButton::paintEvent(event);
+    QPushButton::paintEvent(event);
 }
 
-// -------------------------------------------------------------------- DkDisplayWidget 
-DkDisplayWidget::DkDisplayWidget(QWidget* parent) : DkFadeWidget(parent) {
-
-	createLayout();
-	updateLayout();
+// -------------------------------------------------------------------- DkDisplayWidget
+DkDisplayWidget::DkDisplayWidget(QWidget *parent)
+    : DkFadeWidget(parent)
+{
+    createLayout();
+    updateLayout();
 
-	setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
-	setMinimumHeight(100);
+    setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
+    setMinimumHeight(100);
 }
 
-QRect DkDisplayWidget::screenRect() const {
-	
-	int idx = currentIndex();
+QRect DkDisplayWidget::screenRect() const
+{
+    int idx = currentIndex();
 
-	if (idx >= 0)
-		return mScreens[idx]->availableGeometry();
+    if (idx >= 0)
+        return mScreens[idx]->availableGeometry();
 
-	return QRect();
+    return QRect();
 }
 
-int DkDisplayWidget::count() const {
-	
-	return mScreens.size();
+int DkDisplayWidget::count() const
+{
+    return mScreens.size();
 }
 
-int DkDisplayWidget::currentIndex() const {
-	
-	for (int idx = 0; idx < mScreenButtons.size(); idx++) {
+int DkDisplayWidget::currentIndex() const
+{
+    for (int idx = 0; idx < mScreenButtons.size(); idx++) {
+        if (mScreenButtons[idx]->isChecked())
+            return idx;
+    }
 
-		if (mScreenButtons[idx]->isChecked())
-			return idx;
-	}
-	
-	return 0;
+    return 0;
 }
 
-void DkDisplayWidget::setCurrentIndex(int index) {
-
-	mScreenButtons[index]->setChecked(true);
+void DkDisplayWidget::setCurrentIndex(int index)
+{
+    mScreenButtons[index]->setChecked(true);
 }
 
-void DkDisplayWidget::resizeEvent(QResizeEvent * event) {
-
-	DkFadeWidget::resizeEvent(event);
-	updateLayout();
+void DkDisplayWidget::resizeEvent(QResizeEvent *event)
+{
+    DkFadeWidget::resizeEvent(event);
+    updateLayout();
 }
 
-void DkDisplayWidget::createLayout() {
+void DkDisplayWidget::createLayout()
+{
+    mScreens = QGuiApplication::screens();
 
-	mScreens = QGuiApplication::screens();
+    QButtonGroup *bg = new QButtonGroup(this);
 
-	QButtonGroup* bg = new QButtonGroup(this);
+    for (int idx = 0; idx < mScreens.size(); idx++) {
+        QPushButton *sb = new QPushButton(QString::number(idx + 1), this);
+        sb->setObjectName("displayButton");
+        sb->setCheckable(true);
+        sb->setFlat(true);
 
-	for (int idx = 0; idx < mScreens.size(); idx++) {
+        // connect(sb, SIGNAL(clicked()), this, SLOT(changeDisplay()));
 
-		QPushButton* sb = new QPushButton(QString::number(idx+1), this);
-		sb->setObjectName("displayButton");
-		sb->setCheckable(true);
-		sb->setFlat(true);
-
-		//connect(sb, SIGNAL(clicked()), this, SLOT(changeDisplay()));
-
-		bg->addButton(sb);
-		mScreenButtons << sb;
-	}
+        bg->addButton(sb);
+        mScreenButtons << sb;
+    }
 }
 
-void DkDisplayWidget::updateLayout() {
-
-
-	QRect desktop;
-	for (auto s : mScreens) {
-		desktop = desktop.united(s->geometry());
-	}
+void DkDisplayWidget::updateLayout()
+{
+    QRect desktop;
+    for (auto s : mScreens) {
+        desktop = desktop.united(s->geometry());
+    }
 
-	int w = width() - 6;
-	int h = height() - 6;
+    int w = width() - 6;
+    int h = height() - 6;
 
-	QTransform tm;
-	double sx = (double)w / desktop.width();
-	double sy = (double)h / desktop.height();
-	double s = qMin(sx, sy);
-	tm.scale(s, s);
+    QTransform tm;
+    double sx = (double)w / desktop.width();
+    double sy = (double)h / desktop.height();
+    double s = qMin(sx, sy);
+    tm.scale(s, s);
 
-	QRect md = tm.mapRect(desktop);
-	QPoint dxy(qRound((width() - md.width()) * 0.5), qRound((height() - md.height()) * 0.5));
+    QRect md = tm.mapRect(desktop);
+    QPoint dxy(qRound((width() - md.width()) * 0.5), qRound((height() - md.height()) * 0.5));
 
-	int myScreen = QApplication::desktop()->screenNumber(this);
+    QScreen *myScreen = screen();
 
-	for (int idx = 0; idx < mScreens.size(); idx++) {
+    for (int idx = 0; idx < mScreens.size(); idx++) {
+        QRect r = mScreens[idx]->geometry();
+        r.moveCenter(r.center() - desktop.topLeft());
 
-		QRect r = mScreens[idx]->geometry();
-		r.moveCenter(r.center()-desktop.topLeft());
-		
-		r = tm.mapRect(r);
-		r.moveCenter(r.center()+dxy);	// center
+        r = tm.mapRect(r);
+        r.moveCenter(r.center() + dxy); // center
 
-		if (idx == myScreen)
-			mScreenButtons[idx]->setChecked(true);
+        if (mScreens[idx] == myScreen)
+            mScreenButtons[idx]->setChecked(true);
 
-		mScreenButtons[idx]->setGeometry(r);
-	}
+        mScreenButtons[idx]->setGeometry(r);
+    }
 }
 
-//void DkDisplayWidget::changeDisplay() {
+// void DkDisplayWidget::changeDisplay() {
 //
 //	QRect sr = screenRect();
 //
@@ -3067,8 +3119,6 @@ void DkDisplayWidget::updateLayout() {
 //
 //	if (w)
 //		w->setGeometry(sr);
-//}
-
+// }
 
 }
-
diff --git a/ImageLounge/src/DkGui/DkWidgets.h b/ImageLounge/src/DkGui/DkWidgets.h
index d36e7da..80f3ebc 100644
--- a/ImageLounge/src/DkGui/DkWidgets.h
+++ b/ImageLounge/src/DkGui/DkWidgets.h
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  DkWidgets.h
  Created on:	17.05.2011
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -27,25 +27,25 @@
 
 #pragma once
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QPushButton>
-#include <QSlider>
-#include <QFileSystemModel>
-#include <QSortFilterProxyModel>
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QDockWidget>
-#include <QPointer>
-#include <QPen>
+#include <QFileSystemModel>
 #include <QFutureWatcher>
 #include <QLineEdit>
 #include <QListWidget>
+#include <QPen>
+#include <QPointer>
 #include <QProgressBar>
-#pragma warning(pop)		// no warnings from includes - end
+#include <QPushButton>
+#include <QSlider>
+#include <QSortFilterProxyModel>
+#pragma warning(pop) // no warnings from includes - end
 
-#pragma warning(disable: 4251)	// TODO: remove
+#pragma warning(disable : 4251) // TODO: remove
 
-#include "DkMath.h"
 #include "DkBaseWidgets.h"
 #include "DkImageContainer.h"
+#include "DkMath.h"
 
 // Qt defines
 class QColorDialog;
@@ -62,908 +62,969 @@ class QVBoxLayout;
 class QSvgRenderer;
 class QSettings;
 
-namespace nmc {
+namespace nmc
+{
+// nomacs defines
+class DkCropToolBar;
 
-class DkButton : public QPushButton {
-	Q_OBJECT
+class DkButton : public QPushButton
+{
+    Q_OBJECT
 
 public:
-	DkButton ( QWidget * parent = 0 );
-	DkButton ( const QString & text, QWidget * parent = 0 );
-	DkButton ( const QIcon & icon, const QString & text, QWidget * parent = 0 );
-	DkButton ( const QIcon & checkedIcon, const QIcon & uncheckedIcon, const QString & text, QWidget * parent = 0 );
-	~DkButton() {};
+    DkButton(QWidget *parent = 0);
+    DkButton(const QString &text, QWidget *parent = 0);
+    DkButton(const QIcon &icon, const QString &text, QWidget *parent = 0);
+    DkButton(const QIcon &checkedIcon, const QIcon &uncheckedIcon, const QString &text, QWidget *parent = 0);
+    ~DkButton(){};
 
-	void adjustSize();
-	void setFixedSize(QSize size);
+    void adjustSize();
+    void setFixedSize(QSize size);
 
-	bool keepAspectRatio;
+    bool keepAspectRatio;
 
 protected:
-	QIcon checkedIcon;
-	QIcon uncheckedIcon;
-	bool mouseOver;
-	QSize mySize;
-	
-	// functions
-	void init();
-
-	void paintEvent(QPaintEvent * event) override;
-	void focusInEvent(QFocusEvent * event) override;
-	void focusOutEvent(QFocusEvent * event) override;
-	void enterEvent(QEvent *event) override;
-	void leaveEvent(QEvent *event) override;
-	QPixmap createSelectedEffect(QPixmap* pm);
-
+    QIcon checkedIcon;
+    QIcon uncheckedIcon;
+    bool mouseOver;
+    QSize mySize;
+
+    // functions
+    void init();
+
+    void paintEvent(QPaintEvent *event) override;
+    void focusInEvent(QFocusEvent *event) override;
+    void focusOutEvent(QFocusEvent *event) override;
+    void enterEvent(QEvent *event);
+    void leaveEvent(QEvent *event) override;
+    QPixmap createSelectedEffect(QPixmap *pm);
 };
 
-class DkRatingLabel : public DkFadeWidget {
-	Q_OBJECT
+class DkRatingLabel : public DkFadeWidget
+{
+    Q_OBJECT
 
 public:
-	enum {
-		rating_1,
-		rating_2,
-		rating_3,
-		rating_4,
-		rating_5,
-		rating_0,	// no image for that one
-	};
-
-	DkRatingLabel(int rating = 0, QWidget* parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
-	~DkRatingLabel() {};
-
-	void setRating(int rating) {
-		mRating = rating;
-		updateRating();
-	};
-
-	virtual void changeRating(int newRating) {
-		mRating = newRating;
-		updateRating();
-		emit newRatingSignal(mRating);
-	};
-
-	int getRating() {
-		return mRating;
-	};
+    enum {
+        rating_1,
+        rating_2,
+        rating_3,
+        rating_4,
+        rating_5,
+        rating_0, // no image for that one
+    };
+
+    DkRatingLabel(int rating = 0, QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
+    ~DkRatingLabel(){};
+
+    void setRating(int rating)
+    {
+        mRating = rating;
+        updateRating();
+    };
+
+    virtual void changeRating(int newRating)
+    {
+        mRating = newRating;
+        updateRating();
+        emit newRatingSignal(mRating);
+    };
+
+    int getRating()
+    {
+        return mRating;
+    };
 
 signals:
-	void newRatingSignal(int rating = 0);
+    void newRatingSignal(int rating = 0);
 
 public slots:
-	void rating0() {
-		changeRating(0);
-	};
-
-	void rating1() {
-		changeRating(1);
-	};
-
-	void rating2() {
-		changeRating(2);
-	};
-
-	void rating3() {
-		changeRating(3);
-	};
-
-	void rating4() {
-		changeRating(4);
-	};
-
-	void rating5() {
-		changeRating(5);
-	};
+    void rating0()
+    {
+        changeRating(0);
+    };
+
+    void rating1()
+    {
+        changeRating(1);
+    };
+
+    void rating2()
+    {
+        changeRating(2);
+    };
+
+    void rating3()
+    {
+        changeRating(3);
+    };
+
+    void rating4()
+    {
+        changeRating(4);
+    };
+
+    void rating5()
+    {
+        changeRating(5);
+    };
 
 protected:
-	QVector<DkButton*> mStars;
-	QBoxLayout* mLayout = 0;
-	int mRating = 0;
-
-	void updateRating() {
-		
-		for (int idx = 0; idx < mStars.size(); idx++) {
-			mStars[idx]->setChecked(idx < mRating);
-		}
-	};
-
-	virtual void init();
+    QVector<DkButton *> mStars;
+    QBoxLayout *mLayout = 0;
+    int mRating = 0;
+
+    void updateRating()
+    {
+        for (int idx = 0; idx < mStars.size(); idx++) {
+            mStars[idx]->setChecked(idx < mRating);
+        }
+    };
+
+    virtual void init();
 };
 
-class DkRatingLabelBg : public DkRatingLabel {
-	Q_OBJECT
+class DkRatingLabelBg : public DkRatingLabel
+{
+    Q_OBJECT
 
 public:
-	DkRatingLabelBg(int rating = 0, QWidget* parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
-	~DkRatingLabelBg();
+    DkRatingLabelBg(int rating = 0, QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
+    ~DkRatingLabelBg();
 
-	void changeRating(int newRating) override;
+    void changeRating(int newRating) override;
 
 protected:
-	QTimer* mHideTimer;
-	int mTimeToDisplay = 4000;
-	
-	virtual void paintEvent(QPaintEvent *event) override;
+    QTimer *mHideTimer;
+    int mTimeToDisplay = 4000;
+
+    virtual void paintEvent(QPaintEvent *event) override;
 };
 
-class DkFileInfoLabel : public DkFadeLabel {
-	Q_OBJECT
+class DkFileInfoLabel : public DkFadeLabel
+{
+    Q_OBJECT
 
 public:
-	DkFileInfoLabel(QWidget* parent = 0);
-	~DkFileInfoLabel() {};
+    DkFileInfoLabel(QWidget *parent = 0);
+    ~DkFileInfoLabel(){};
 
-	void createLayout();
-	void updateInfo(const QString& filePath, const QString& attr, const QString& date, const int rating);
-	void updateTitle(const QString& filePath, const QString& attr);
-	void updateDate(const QString& date = QString());
-	void updateRating(const int rating);
-	void setEdited(bool edited);
-	DkRatingLabel* getRatingLabel();
+    void createLayout();
+    void updateInfo(const QString &filePath, const QString &attr, const QString &date, const int rating);
+    void updateTitle(const QString &filePath, const QString &attr);
+    void updateDate(const QString &date = QString());
+    void updateRating(const int rating);
+    void setEdited(bool edited);
+    DkRatingLabel *getRatingLabel();
 
 public slots:
-	virtual void setVisible(bool visible, bool saveSettings = true) override;
+    virtual void setVisible(bool visible, bool saveSettings = true) override;
 
 protected:
-	QString mFilePath;
+    QString mFilePath;
 
-	QBoxLayout* mLayout;
-	QLabel* mTitleLabel;
-	QLabel* mDateLabel;
-	DkRatingLabel* mRatingLabel;
+    QBoxLayout *mLayout;
+    QLabel *mTitleLabel;
+    QLabel *mDateLabel;
+    DkRatingLabel *mRatingLabel;
 
-	void updateWidth();
+    void updateWidth();
 };
 
-class DkPlayer : public DkFadeWidget {
-	Q_OBJECT
+class DkPlayer : public DkFadeWidget
+{
+    Q_OBJECT
 
 public:
-	enum {
-		play_action = 0,	// if more actions are to be assigned
-	};
+    enum {
+        play_action = 0, // if more actions are to be assigned
+    };
 
-	DkPlayer(QWidget* parent = 0);
-	~DkPlayer() {};
+    DkPlayer(QWidget *parent = 0);
+    ~DkPlayer(){};
 
-	void setTimeToDisplay(int ms = 1000);
+    void setTimeToDisplay(int ms = 1000);
 
 signals:
-	void nextSignal();
-	void previousSignal();
+    void nextSignal();
+    void previousSignal();
 
 public slots:
-	void play(bool play);
-	void togglePlay();
-	void startTimer();
-	void autoNext();
-	void next();
-	void previous();
-	virtual void show(int ms = 0);
-	bool isPlaying() const;
+    void play(bool play);
+    void togglePlay();
+    void startTimer();
+    void autoNext();
+    void next();
+    void previous();
+    virtual void show(int ms = 0);
+    bool isPlaying() const;
 
 protected:
-	void init();
-	void createLayout();
+    void init();
+    void createLayout();
 
-	bool playing = false;
+    bool playing = false;
 
-	int timeToDisplay;
-	QTimer* displayTimer;
-	QTimer* hideTimer;
+    int timeToDisplay;
+    QTimer *displayTimer;
+    QTimer *hideTimer;
 
-	QPushButton* previousButton;
-	QPushButton* nextButton;
-	QPushButton* playButton;
-	QWidget* container;
+    QPushButton *previousButton;
+    QPushButton *nextButton;
+    QPushButton *playButton;
+    QWidget *container;
 };
 
-class DkHudNavigation : public DkFadeWidget {
-	Q_OBJECT
+class DkHudNavigation : public DkFadeWidget
+{
+    Q_OBJECT
 
 public:
-	DkHudNavigation(QWidget* parent = 0);
-	~DkHudNavigation() {};
+    DkHudNavigation(QWidget *parent = 0);
+    ~DkHudNavigation(){};
 
 signals:
-	void nextSignal();
-	void previousSignal();
+    void nextSignal();
+    void previousSignal();
 
 public slots:
-	void showNext();
-	void showPrevious();
+    void showNext();
+    void showPrevious();
 
 protected:
-	void createLayout();
+    void createLayout();
 
-	QPushButton* mPreviousButton;
-	QPushButton* mNextButton;
+    QPushButton *mPreviousButton;
+    QPushButton *mNextButton;
 };
 
-class DkFolderScrollBar : public QSlider {
-	Q_OBJECT
+class DkFolderScrollBar : public QSlider
+{
+    Q_OBJECT
 
-public: 
-	DkFolderScrollBar(QWidget* parent = 0);
-	~DkFolderScrollBar();
+public:
+    DkFolderScrollBar(QWidget *parent = 0);
+    ~DkFolderScrollBar();
 
-	virtual void setValue(int i);
+    virtual void setValue(int i);
 
-	void registerAction(QAction* action);
-	void block(bool blocked);
-	void setDisplaySettings(QBitArray* displayBits);
-	bool getCurrentDisplaySetting();
+    void registerAction(QAction *action);
+    void block(bool blocked);
+    void setDisplaySettings(QBitArray *displayBits);
+    bool getCurrentDisplaySetting();
 
 public slots:
-	void updateDir(QVector<QSharedPointer<DkImageContainerT> > images);
+    void updateDir(QVector<QSharedPointer<DkImageContainerT>> images);
 
-	virtual void show(bool saveSettings = true);
-	virtual void hide(bool saveSettings = true);
-	virtual void setVisible(bool visible, bool saveSettings = true);
+    virtual void show(bool saveSettings = true);
+    virtual void hide(bool saveSettings = true);
+    virtual void setVisible(bool visible, bool saveSettings = true);
 
-	void animateOpacityUp();
-	void animateOpacityDown();
+    void animateOpacityUp();
+    void animateOpacityDown();
 
 protected slots:
-	void updateFile(int idx);
+    void updateFile(int idx);
 
 signals:
-	void loadFileSignal(int idx) const;
-	void visibleSignal(bool visible) const;
+    void loadFileSignal(int idx) const;
+    void visibleSignal(bool visible) const;
 
 protected:
-	void mousePressEvent(QMouseEvent *event) override;
-	void mouseReleaseEvent(QMouseEvent *event) override;
+    void mousePressEvent(QMouseEvent *event) override;
+    void mouseReleaseEvent(QMouseEvent *event) override;
 
-	QColor mBgCol;
-	bool mBlocked = false;
-	bool mHiding = false;
-	bool mShowing = false;
-	bool mMouseDown = false;
+    QColor mBgCol;
+    bool mBlocked = false;
+    bool mHiding = false;
+    bool mShowing = false;
+    bool mMouseDown = false;
 
-	QGraphicsOpacityEffect* mOpacityEffect = 0;
-	QBitArray* mDisplaySettingsBits = 0;
-
-	void init();
+    QGraphicsOpacityEffect *mOpacityEffect = 0;
+    QBitArray *mDisplaySettingsBits = 0;
 
+    void init();
 };
 
 // this class is one of the first batch processing classes -> move them to a new file in the (near) future
-class DkThumbsSaver : public DkFadeWidget {
-	Q_OBJECT
+class DkThumbsSaver : public DkFadeWidget
+{
+    Q_OBJECT
 
 public:
-	DkThumbsSaver(QWidget* parent = 0);
+    DkThumbsSaver(QWidget *parent = 0);
 
-	void processDir(QVector<QSharedPointer<DkImageContainerT> > images, bool forceSave);
+    void processDir(QVector<QSharedPointer<DkImageContainerT>> images, bool forceSave);
 
 signals:
-	void numFilesSignal(int currentFileIdx);
+    void numFilesSignal(int currentFileIdx);
 
 public slots:
-	void stopProgress();
-	void thumbLoaded(bool loaded);
-	void loadNext();
+    void stopProgress();
+    void thumbLoaded(bool loaded);
+    void loadNext();
 
 protected:
-
-	QFileInfo mCurrentDir;
-	QProgressDialog* mPd = 0;
-	bool mStop = false;
-	bool mForceSave = false;
-	int mNumSaved = false;
-	QVector<QSharedPointer<DkImageContainerT> > mImages;
+    QFileInfo mCurrentDir;
+    QProgressDialog *mPd = 0;
+    bool mStop = false;
+    bool mForceSave = false;
+    int mNumSaved = false;
+    QVector<QSharedPointer<DkImageContainerT>> mImages;
 };
 
-class DkFileSystemModel : public QFileSystemModel {
-	Q_OBJECT
+class DkFileSystemModel : public QFileSystemModel
+{
+    Q_OBJECT
 
 public:
-	DkFileSystemModel(QObject* parent = 0);
+    DkFileSystemModel(QObject *parent = 0);
 };
 
-class DkSortFileProxyModel : public QSortFilterProxyModel {
-	Q_OBJECT
+class DkSortFileProxyModel : public QSortFilterProxyModel
+{
+    Q_OBJECT
 
 public:
-	DkSortFileProxyModel(QObject* parent = 0);
+    DkSortFileProxyModel(QObject *parent = 0);
 
 protected:
-	virtual bool lessThan(const QModelIndex& left, const QModelIndex& right) const;
-
+    virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
 };
 
-class DllCoreExport DkExplorer : public DkDockWidget {
-	Q_OBJECT
+class DllCoreExport DkExplorer : public DkDockWidget
+{
+    Q_OBJECT
 
 public:
-	DkExplorer(const QString& title, QWidget* parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
-	virtual ~DkExplorer();
+    DkExplorer(const QString &title, QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
+    virtual ~DkExplorer();
 
-	DkFileSystemModel* getModel() { return mFileModel; };
+    DkFileSystemModel *getModel()
+    {
+        return mFileModel;
+    };
 
 public slots:
-	void setCurrentImage(QSharedPointer<DkImageContainerT> img);
-	void setCurrentPath(const QString& filePath);
-	void fileClicked(const QModelIndex &index) const;
-	void showColumn(bool show);
-	void setEditable(bool editable);
-	void adjustColumnWidth();
-	void loadSelectedToggled(bool checked);
-	void openSelected();
+    void setCurrentImage(QSharedPointer<DkImageContainerT> img);
+    void setCurrentPath(const QString &filePath);
+    void fileClicked(const QModelIndex &index) const;
+    void showColumn(bool show);
+    void setEditable(bool editable);
+    void adjustColumnWidth();
+    void loadSelectedToggled(bool checked);
+    void openSelected();
 
 signals:
-	void openFile(const QString& filePath) const;
-	void openDir(const QString& dir) const;
+    void openFile(const QString &filePath) const;
+    void openDir(const QString &dir) const;
 
 protected:
-	void closeEvent(QCloseEvent* event) override;
-	void contextMenuEvent(QContextMenuEvent* event) override;
+    void closeEvent(QCloseEvent *event) override;
+    void contextMenuEvent(QContextMenuEvent *event) override;
 
-	virtual void createLayout();
-	virtual void writeSettings();
-	virtual void readSettings();
+    virtual void createLayout();
+    virtual void writeSettings();
+    virtual void readSettings();
 
-	QVBoxLayout* mLayout = nullptr;
-	QTreeView* mFileTree = nullptr;
-	DkFileSystemModel* mFileModel = nullptr;
-	DkSortFileProxyModel* mSortModel = nullptr;
+    QVBoxLayout *mLayout = nullptr;
+    QTreeView *mFileTree = nullptr;
+    DkFileSystemModel *mFileModel = nullptr;
+    DkSortFileProxyModel *mSortModel = nullptr;
 
 private:
-
-	QVector<QAction*> mColumnActions;
-	bool mLoadSelected = false;
+    QVector<QAction *> mColumnActions;
+    bool mLoadSelected = false;
 };
 
-class DllCoreExport DkBrowseExplorer : public DkExplorer {
-	Q_OBJECT
+class DllCoreExport DkBrowseExplorer : public DkExplorer
+{
+    Q_OBJECT
 
 public:
-	DkBrowseExplorer(const QString& title, QWidget* parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
-	~DkBrowseExplorer();
+    DkBrowseExplorer(const QString &title, QWidget *parent = 0, Qt::WindowFlags flags = Qt::WindowFlags());
+    ~DkBrowseExplorer();
 
 public slots:
-	void browseClicked();
-	void setRootPath(const QString& root);
+    void browseClicked();
+    void setRootPath(const QString &root);
 
 protected:
-	void createLayout() override;
-	void readSettings() override;
-	void writeSettings() override;
+    void createLayout() override;
+    void readSettings() override;
+    void writeSettings() override;
 
-	QString mRootPath;
-	QPushButton* mRootPathBrowseButton;
-	DkElidedLabel* mRootPathLabel;
+    QString mRootPath;
+    QPushButton *mRootPathBrowseButton;
+    DkElidedLabel *mRootPathLabel;
 };
 
-class DkOverview : public QLabel {
-	Q_OBJECT
+class DkOverview : public QLabel
+{
+    Q_OBJECT
 
 public:
-	DkOverview(QWidget * parent = 0);
-	~DkOverview() {};
-
-	void setImage(const QImage& img) {
-		mImg = img;
-		mImgSize = img.size();
-		mImgT = QImage();
-	};
-
-	void setTransforms(const QTransform* worldMatrix, const QTransform* imgMatrix) {
-		mWorldMatrix = worldMatrix;
-		mImgMatrix = imgMatrix;
-	};
-
-	void setViewPortRect(const QRectF& viewPortRect) {
-		mViewPortRect = viewPortRect;	
-	};
+    DkOverview(QWidget *parent = 0);
+    ~DkOverview(){};
+
+    void setImage(const QImage &img)
+    {
+        mImg = img;
+        mImgSize = img.size();
+        mImgT = QImage();
+    };
+
+    void setTransforms(QTransform *worldMatrix, QTransform *imgMatrix)
+    {
+        mWorldMatrix = worldMatrix;
+        mImgMatrix = imgMatrix;
+    };
+
+    void setViewPortRect(const QRectF &viewPortRect)
+    {
+        mViewPortRect = viewPortRect;
+    };
 
 signals:
-	void moveViewSignal(const QPointF& dxy) const;
-	void sendTransformSignal() const;
+    void moveViewSignal(const QPointF &dxy) const;
+    void sendTransformSignal() const;
 
 protected:
-	QImage mImg;
-	QImage mImgT;
-	QSize mImgSize;
-	QTransform* mScaledImgMatrix;
-	const QTransform* mWorldMatrix;
-	const QTransform* mImgMatrix;
-	QRectF mViewPortRect;
-	QPointF mPosGrab;
-	QPointF mEnterPos;
-
-	QImage resizedImg(const QImage& src);
-	void paintEvent(QPaintEvent *event) override;
-	void mouseMoveEvent(QMouseEvent *event) override;
-	void mouseReleaseEvent(QMouseEvent *event) override;
-	void mousePressEvent(QMouseEvent *event) override;
-	QRectF getImageRect() const;
-	QTransform getScaledImageMatrix();
+    QImage mImg;
+    QImage mImgT;
+    QSize mImgSize;
+    QTransform *mScaledImgMatrix;
+    QTransform *mWorldMatrix;
+    QTransform *mImgMatrix;
+    QRectF mViewPortRect;
+    QPointF mPosGrab;
+    QPointF mEnterPos;
+
+    QImage resizedImg(const QImage &src);
+    void paintEvent(QPaintEvent *event) override;
+    void mouseMoveEvent(QMouseEvent *event) override;
+    void mouseReleaseEvent(QMouseEvent *event) override;
+    void mousePressEvent(QMouseEvent *event) override;
+    QRectF getImageRect() const;
+    QTransform getScaledImageMatrix();
 };
 
-class DkZoomWidget : public DkFadeLabel {
-	Q_OBJECT
+class DkZoomWidget : public DkFadeLabel
+{
+    Q_OBJECT
 
 public:
-	DkZoomWidget(QWidget* parent = 0);
+    DkZoomWidget(QWidget *parent = 0);
 
-	DkOverview* getOverview() const;
+    DkOverview *getOverview() const;
 
-	bool isAutoHide() const;
+    bool isAutoHide() const;
 
 signals:
-	void zoomSignal(double zoomLevel);
+    void zoomSignal(double zoomLevel);
 
 public slots:
-	virtual void setVisible(bool visible, bool autoHide = false);
+    virtual void setVisible(bool visible, bool autoHide = false);
 
-	void updateZoom(double zoomLevel);
-	void on_sbZoom_valueChanged(double zoomLevel);
-	void on_slZoom_valueChanged(int zoomLevel);
+    void updateZoom(double zoomLevel);
+    void on_sbZoom_valueChanged(double zoomLevel);
+    void on_slZoom_valueChanged(int zoomLevel);
 
 protected:
-	void createLayout();
+    void createLayout();
 
-	DkOverview* mOverview = 0;
-	QSlider* mSlZoom = 0;
-	QDoubleSpinBox* mSbZoom = 0;
-	bool mAutoHide = false;
+    DkOverview *mOverview = 0;
+    QSlider *mSlZoom = 0;
+    QDoubleSpinBox *mSbZoom = 0;
+    bool mAutoHide = false;
 };
 
-class DkTransformRect : public DkWidget {
-	Q_OBJECT
+class DkTransformRect : public DkWidget
+{
+    Q_OBJECT
 
 public:
-	
-	DkTransformRect(int idx = -1, DkRotatingRect* rect = 0, QWidget* parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
-	virtual ~DkTransformRect() {};
+    DkTransformRect(int idx = -1, DkRotatingRect *rect = 0, QWidget *parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
+    virtual ~DkTransformRect(){};
+
+    void draw(QPainter *painter);
 
-	void draw(QPainter *painter);
-	
-	QPointF getCenter() {
-		return QPointF(size.width()*0.5f, size.height()*0.5f);
-	};
+    QPointF getCenter()
+    {
+        return QPointF(size.width() * 0.5f, size.height() * 0.5f);
+    };
 
 signals:
-	void ctrlMovedSignal(int, const QPointF&, Qt::KeyboardModifiers, bool);
-	void updateDiagonal(int);
+    void ctrlMovedSignal(int, const QPointF &, Qt::KeyboardModifiers, bool);
+    void updateDiagonal(int);
 
 protected:
-
-	void mousePressEvent(QMouseEvent *event) override;
-	void mouseMoveEvent(QMouseEvent *event) override;
-	void mouseReleaseEvent(QMouseEvent *event) override;
-	void enterEvent(QEvent *event) override;
-	void init();
-	
-	DkRotatingRect* rect;
-	QPointF initialPos;
-	QPointF posGrab;
-	int parentIdx;
-	QSize size;
+    void mousePressEvent(QMouseEvent *event) override;
+    void mouseMoveEvent(QMouseEvent *event) override;
+    void mouseReleaseEvent(QMouseEvent *event) override;
+    void enterEvent(QEvent *event);
+    void init();
+
+    DkRotatingRect *rect;
+    QPointF initialPos;
+    QPointF posGrab;
+    int parentIdx;
+    QSize size;
 };
 
-
-class DkEditableRect : public DkFadeWidget {
-	Q_OBJECT
+class DkEditableRect : public DkFadeWidget
+{
+    Q_OBJECT
 
 public:
+    enum {
+        no_guide = 0,
+        rule_of_thirds,
+        grid,
 
-	enum {
-		no_guide = 0,
-		rule_of_thirds,
-		grid,
+        mode_end,
+    };
 
-		mode_end,
-	};
+    enum { do_nothing, initializing, rotating, moving, scaling };
 
-	enum {
-		do_nothing,
-		initializing,
-		rotating,
-		moving,
-		scaling
-	};
+    DkEditableRect(const QRectF &rect = QRect(), QWidget *parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
+    virtual ~DkEditableRect(){};
 
-	DkEditableRect(const QRectF& rect = QRect(), QWidget* parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
-	virtual ~DkEditableRect() {};
+    void reset();
 
-	void reset();
+    void setWorldTransform(QTransform *worldTform)
+    {
+        mWorldTform = worldTform;
+    };
 
-	void setWorldTransform(QTransform *worldTform) {
-		mWorldTform = worldTform;
-	};	
+    void setImageTransform(QTransform *imgTform)
+    {
+        mImgTform = imgTform;
+    };
 
-	void setImageTransform(QTransform *imgTform) {
-		mImgTform = imgTform;
-	};
+    void setImageRect(QRectF *imgRect)
+    {
+        mImgRect = imgRect;
+    };
 
-	void setImageRect(QRectF* imgRect) {
-		mImgRect = imgRect;
-	};
-
-	virtual void setVisible(bool visible) override;
+    virtual void setVisible(bool visible) override;
 
 signals:
-	void cropImageSignal(const DkRotatingRect& cropArea, const QColor& bgCol = QColor(0,0,0,0), bool cropToMetaData = false) const;
-	void angleSignal(double angle) const;
-	void aRatioSignal(const QPointF& aRatio) const;
-	void updateRectSignal(const QRect& r) const;
+    void cropImageSignal(const DkRotatingRect &cropArea, const QColor &bgCol = QColor(0, 0, 0, 0), bool cropToMetaData = false) const;
+    void angleSignal(double angle) const;
+    void aRatioSignal(const QPointF &aRatio) const;
+    void updateRectSignal(const QRect &r) const;
 
 public slots:
-	void updateCorner(int idx, const QPointF& point, Qt::KeyboardModifiers modifier, bool changeState = false);
-	void updateDiagonal(int idx);
-	void setFixedDiagonal(const DkVector& diag);
-	void setAngle(double angle, bool apply = true);
-	void setPanning(bool panning);
-	void setPaintHint(int paintMode = rule_of_thirds);
-	void setShadingHint(bool invert);
-	void setShowInfo(bool showInfo);
-	void setRect(const QRect& rect);
+    void updateCorner(int idx, const QPointF &point, Qt::KeyboardModifiers modifier, bool changeState = false);
+    void updateDiagonal(int idx);
+    void setFixedDiagonal(const DkVector &diag);
+    void setAngle(double angle, bool apply = true);
+    void setPanning(bool panning);
+    void setPaintHint(int paintMode = rule_of_thirds);
+    void setShadingHint(bool invert);
+    void setShowInfo(bool showInfo);
+    void setRect(const QRect &rect);
 
 protected:
-	void mousePressEvent(QMouseEvent *event) override;
-	void mouseReleaseEvent(QMouseEvent *event) override;
-	void mouseMoveEvent(QMouseEvent *event) override;
-	void wheelEvent(QWheelEvent* event) override;
-	void keyPressEvent(QKeyEvent *event) override;
-	void keyReleaseEvent(QKeyEvent *event) override;
-	void paintEvent(QPaintEvent *event) override;
-	QRect rect() const;
-
-	QPointF clipToImage(const QPointF& pos);
-	QPointF clipToImageForce(const QPointF& pos);
-	void applyTransform();
-	void drawGuide(QPainter* painter, const QPolygonF& p, int paintMode);
-	QPointF map(const QPointF &pos);
-
-	int mState = do_nothing;
-	QTransform *mImgTform = 0;
-	QTransform *mWorldTform = 0;
-	QTransform mTtform;
-	QTransform mRtform;
-	QPointF mPosGrab;
-	QPointF mClickPos;
-	DkVector mOldDiag = DkVector(-1.0f, -1.0f);
-	DkVector mFixedDiag;
-
-	DkRotatingRect mRect;
-	QPen mPen;
-	QBrush mBrush;
-	QVector<DkTransformRect*> mCtrlPoints;
-	QCursor mRotatingCursor;
-	QRectF* mImgRect = 0;
-	bool mPanning = false;
-	int mPaintMode = rule_of_thirds;
-	bool mShowInfo = false;
+    void mousePressEvent(QMouseEvent *event) override;
+    void mouseReleaseEvent(QMouseEvent *event) override;
+    void mouseMoveEvent(QMouseEvent *event) override;
+    void wheelEvent(QWheelEvent *event) override;
+    void keyPressEvent(QKeyEvent *event) override;
+    void keyReleaseEvent(QKeyEvent *event) override;
+    void paintEvent(QPaintEvent *event) override;
+    QRect rect() const;
+
+    QPointF clipToImage(const QPointF &pos);
+    QPointF clipToImageForce(const QPointF &pos);
+    void applyTransform();
+    void drawGuide(QPainter *painter, const QPolygonF &p, int paintMode);
+    QPointF map(const QPointF &pos);
+
+    int mState = do_nothing;
+    QTransform *mImgTform = 0;
+    QTransform *mWorldTform = 0;
+    QTransform mTtform;
+    QTransform mRtform;
+    QPointF mPosGrab;
+    QPointF mClickPos;
+    DkVector mOldDiag = DkVector(-1.0f, -1.0f);
+    DkVector mFixedDiag;
+
+    DkRotatingRect mRect;
+    QPen mPen;
+    QBrush mBrush;
+    QVector<DkTransformRect *> mCtrlPoints;
+    QCursor mRotatingCursor;
+    QRectF *mImgRect = 0;
+    bool mPanning = false;
+    int mPaintMode = rule_of_thirds;
+    bool mShowInfo = false;
 };
 
-// Image histogram display
-class DkHistogram : public DkFadeWidget {
+class DkCropWidget : public DkEditableRect
+{
+    Q_OBJECT
 
-	Q_OBJECT
-	
 public:
-	enum class DisplayMode {
-		histogram_mode_simple = 0,      /// shows just the histogram
-		histogram_mode_extended = 1,    /// shows histogram and data
-		histogram_mode_end = 2,
-	};
+    DkCropWidget(QRectF rect = QRect(), QWidget *parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
 
+    DkCropToolBar *getToolbar() const;
 
-	DkHistogram(QWidget *parent);
-	~DkHistogram();
+public slots:
+    void crop(bool cropToMetadata = false);
+    virtual void setVisible(bool visible) override;
 
-	void drawHistogram(QImage img);
-	void clearHistogram();
-	void setMaxHistogramValue(int maxValue);
-	void updateHistogramValues(int histValues[][256]);
-	void setPainted(bool isPainted);
+signals:
+    void hideSignal();
+
+protected:
+    void createToolbar();
+    void mouseDoubleClickEvent(QMouseEvent *ev) override;
+
+    DkCropToolBar *cropToolbar;
+};
+
+// Image histogram display
+class DkHistogram : public DkFadeWidget
+{
+    Q_OBJECT
+
+public:
+    enum class DisplayMode {
+        histogram_mode_simple = 0, /// shows just the histogram
+        histogram_mode_extended = 1, /// shows histogram and data
+        histogram_mode_end = 2,
+    };
+
+    DkHistogram(QWidget *parent);
+    ~DkHistogram();
+
+    void drawHistogram(QImage img);
+    void clearHistogram();
+    void setMaxHistogramValue(int maxValue);
+    void updateHistogramValues(int histValues[][256]);
+    void setPainted(bool isPainted);
 
 public slots:
-	void on_toggleStats_triggered(bool show);
+    void on_toggleStats_triggered(bool show);
 
 protected:
-	virtual void mousePressEvent(QMouseEvent *event) override;
-	virtual void mouseMoveEvent(QMouseEvent *event) override;
-	virtual void mouseReleaseEvent(QMouseEvent *event) override;
-	virtual void paintEvent(QPaintEvent* event) override;
-	virtual void contextMenuEvent(QContextMenuEvent *event) override;
+    virtual void mousePressEvent(QMouseEvent *event) override;
+    virtual void mouseMoveEvent(QMouseEvent *event) override;
+    virtual void mouseReleaseEvent(QMouseEvent *event) override;
+    virtual void paintEvent(QPaintEvent *event) override;
+    virtual void contextMenuEvent(QContextMenuEvent *event) override;
 
-	void loadSettings();
+    void loadSettings();
 
 private:
-	int mHist[3][256];          /// 3 channels 256 bin. channels duplicated when gray
-	int mNumPixels = 0;         /// image pixel count
-	int mNumDistinctValues = 0; /// number of distinct values
-	int mNumZeroPixels = 0;     /// pixels with zero value
-	int mNumSaturatedPixels = 0;    /// pixels saturating RGB 8bit
-	int mNumValues = 0;         /// number of distinct histogram values
-	int mMinBinValue = 256;     /// (gray-only) minimum intensity value
-	int mMaxBinValue = -1;      /// (gray-only) maximum intensity value
-	int mMaxValue = 20;         /// maximum count over all bins
-	bool mIsPainted = false;
-	float mScaleFactor = 1;
-	DisplayMode mDisplayMode = DisplayMode::histogram_mode_simple; /// determins shown histogram type
-
-	QMenu* mContextMenu = 0;
+    int mHist[3][256]; /// 3 channels 256 bin. channels duplicated when gray
+    int mNumPixels = 0; /// image pixel count
+    int mNumDistinctValues = 0; /// number of distinct values
+    int mNumZeroPixels = 0; /// pixels with zero value
+    int mNumSaturatedPixels = 0; /// pixels saturating RGB 8bit
+    int mNumValues = 0; /// number of distinct histogram values
+    int mMinBinValue = 256; /// (gray-only) minimum intensity value
+    int mMaxBinValue = -1; /// (gray-only) maximum intensity value
+    int mMaxValue = 20; /// maximum count over all bins
+    bool mIsPainted = false;
+    float mScaleFactor = 1;
+    DisplayMode mDisplayMode = DisplayMode::histogram_mode_simple; /// determins shown histogram type
+
+    QMenu *mContextMenu = 0;
 };
 
-class DkFileInfo {
-
+class DkFileInfo
+{
 public:
-	DkFileInfo();
-	DkFileInfo(const QFileInfo& fileInfo);
+    DkFileInfo();
+    DkFileInfo(const QFileInfo &fileInfo);
 
-	QString getFilePath() const;
-	bool exists() const;
-	void setExists(bool fileExists);
+    QString getFilePath() const;
+    bool exists() const;
+    void setExists(bool fileExists);
 
-	bool inUse() const;
-	void setInUse(bool inUse);
+    bool inUse() const;
+    void setInUse(bool inUse);
 
 protected:
-	QFileInfo mFileInfo;
-	bool mFileExists = false;
-	bool mUsed = false;
+    QFileInfo mFileInfo;
+    bool mFileExists = false;
+    bool mUsed = false;
 };
 
-class DkFolderLabel : public QLabel {
-	Q_OBJECT
+class DkFolderLabel : public QLabel
+{
+    Q_OBJECT
 
 public:
-	DkFolderLabel(const DkFileInfo& fileInfo, QWidget* parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
+    DkFolderLabel(const DkFileInfo &fileInfo, QWidget *parent = 0, Qt::WindowFlags f = Qt::WindowFlags());
 
 signals:
-	void loadFileSignal(const QString&) const;
+    void loadFileSignal(const QString &) const;
 
 protected:
-	void mousePressEvent(QMouseEvent *ev) override;
+    void mousePressEvent(QMouseEvent *ev) override;
 
-	DkFileInfo fileInfo;
+    DkFileInfo fileInfo;
 };
 
-class DkDirectoryEdit : public QLineEdit {
-	Q_OBJECT
+class DkDirectoryEdit : public QLineEdit
+{
+    Q_OBJECT
+
+public:
+    DkDirectoryEdit(QWidget *parent = 0);
+    DkDirectoryEdit(const QString &content, QWidget *parent = 0);
 
-public:	
-	DkDirectoryEdit(QWidget* parent = 0);
-	DkDirectoryEdit(const QString& content, QWidget* parent = 0);
-		
-	bool existsDirectory() { return existsDirectory(text()); };
+    bool existsDirectory()
+    {
+        return existsDirectory(text());
+    };
 
 signals:
-	bool directoryChanged(const QString& path);
+    bool directoryChanged(const QString &path);
 
 public slots:
-	void lineEditChanged(const QString& path);
+    void lineEditChanged(const QString &path);
 
 private:
-	bool existsDirectory(const QString& path);
+    bool existsDirectory(const QString &path);
 
-	QString mOldPath;
-	bool showFolderButton = false;
+    QString mOldPath;
+    bool showFolderButton = false;
 };
 
-class DkDirectoryChooser : public DkWidget {
-	Q_OBJECT
+class DkDirectoryChooser : public DkWidget
+{
+    Q_OBJECT
 public:
-	DkDirectoryChooser(const QString& dirPath = "", QWidget* parent = 0);
+    DkDirectoryChooser(const QString &dirPath = "", QWidget *parent = 0);
 
 public slots:
-	void on_dirButton_clicked();
+    void on_dirButton_clicked();
 
 signals:
-	void directoryChanged(const QString& dirPath) const;
+    void directoryChanged(const QString &dirPath) const;
 
 protected:
-	void createLayout(const QString& dirPath);
-
-	DkDirectoryEdit* mDirEdit = 0;
+    void createLayout(const QString &dirPath);
 
+    DkDirectoryEdit *mDirEdit = 0;
 };
 
-class DkDelayedInfo : public QObject {
-	Q_OBJECT
+class DkDelayedInfo : public QObject
+{
+    Q_OBJECT
 
 public:
-	DkDelayedInfo(int time = 0, QObject* parent = 0) : QObject(parent) {
-		timer = new QTimer();
-		timer->setSingleShot(true);
-
-		if (time)
-			timer->start(time);
-
-		connect(timer, SIGNAL(timeout()), this, SLOT(sendInfo()));
-	}
-
-	virtual ~DkDelayedInfo() {
+    DkDelayedInfo(int time = 0, QObject *parent = 0)
+        : QObject(parent)
+    {
+        timer = new QTimer();
+        timer->setSingleShot(true);
 
-		if (timer && timer->isActive())
-			timer->stop();
+        if (time)
+            timer->start(time);
 
-		if (timer)
-			delete timer;
+        connect(timer, SIGNAL(timeout()), this, SLOT(sendInfo()));
+    }
 
-		timer = 0;
-	}
+    virtual ~DkDelayedInfo()
+    {
+        if (timer && timer->isActive())
+            timer->stop();
 
-	void stop() {
+        if (timer)
+            delete timer;
 
-		if (timer && timer->isActive())
-			timer->stop();
-		else
-			emit infoSignal(1);
-	}
+        timer = 0;
+    }
 
-	void setInfo(int time = 1000) {
+    void stop()
+    {
+        if (timer && timer->isActive())
+            timer->stop();
+        else
+            emit infoSignal(1);
+    }
 
-		if (!timer)
-			return;
+    void setInfo(int time = 1000)
+    {
+        if (!timer)
+            return;
 
-		timer->start(time);
-	}
+        timer->start(time);
+    }
 
 signals:
-	void infoSignal(int time);
+    void infoSignal(int time);
 
-	protected slots:
-	virtual void sendInfo() {
-		emit infoSignal(-1);
-	}
+protected slots:
+    virtual void sendInfo()
+    {
+        emit infoSignal(-1);
+    }
 
 protected:
-	QTimer* timer;
-
+    QTimer *timer;
 };
 
-
-class DkDelayedMessage : public DkDelayedInfo {
-	Q_OBJECT
+class DkDelayedMessage : public DkDelayedInfo
+{
+    Q_OBJECT
 
 public:
-	DkDelayedMessage(const QString& msg  = QString(), int time = 0, QObject* parent = 0) : DkDelayedInfo(time, parent) {
-		mMsg = msg;
-	}
-	DkDelayedMessage(QObject* parent = 0) : DkDelayedInfo(0, parent) {
-	}
-
-	~DkDelayedMessage() {}
-
-	void stop() {
-
-		if (timer && timer->isActive())
-			timer->stop();
-		else
-			emit infoSignal(mMsg, 1);
-	}
-
-	void setInfo(const QString& msg, int time = 1000) {
-
-		DkDelayedInfo::setInfo(time);
-		mMsg = msg;
-	}
+    DkDelayedMessage(const QString &msg = QString(), int time = 0, QObject *parent = 0)
+        : DkDelayedInfo(time, parent)
+    {
+        mMsg = msg;
+    }
+    DkDelayedMessage(QObject *parent = 0)
+        : DkDelayedInfo(0, parent)
+    {
+    }
+
+    ~DkDelayedMessage()
+    {
+    }
+
+    void stop()
+    {
+        if (timer && timer->isActive())
+            timer->stop();
+        else
+            emit infoSignal(mMsg, 1);
+    }
+
+    void setInfo(const QString &msg, int time = 1000)
+    {
+        DkDelayedInfo::setInfo(time);
+        mMsg = msg;
+    }
 
 signals:
-	void infoSignal(const QString& msg, int time = -1) const;
+    void infoSignal(const QString &msg, int time = -1) const;
 
 protected:
-	QString mMsg;
-
+    QString mMsg;
 };
 
-class DkListWidget : public QListWidget {
-	Q_OBJECT
+class DkListWidget : public QListWidget
+{
+    Q_OBJECT
 
 public:
-	DkListWidget(QWidget* parent);
+    DkListWidget(QWidget *parent);
 
-	void startDrag(Qt::DropActions supportedActions) override;
-	bool isEmpty() const;
+    void startDrag(Qt::DropActions supportedActions) override;
+    bool isEmpty() const;
 
-	void setEmptyText(const QString& text);
+    void setEmptyText(const QString &text);
 
 signals:
-	void dataDroppedSignal() const;
+    void dataDroppedSignal() const;
 
 protected:
-	void paintEvent(QPaintEvent *event) override;
-	void dropEvent(QDropEvent *event) override;
+    void paintEvent(QPaintEvent *event) override;
+    void dropEvent(QDropEvent *event) override;
 
-	QString mEmptyText = tr("Drag Items Here");
+    QString mEmptyText = tr("Drag Items Here");
 };
 
-class DkProgressBar : public QProgressBar {
-	Q_OBJECT
+class DkProgressBar : public QProgressBar
+{
+    Q_OBJECT
 
 public:
-	DkProgressBar(QWidget* parent = 0);
+    DkProgressBar(QWidget *parent = 0);
 
 public slots:
-	void setVisible(bool visible) override;
-	void setVisibleTimed(bool visible, int time = -1);
+    void setVisible(bool visible) override;
+    void setVisibleTimed(bool visible, int time = -1);
 
 protected:
-	void paintEvent(QPaintEvent *ev) override;
-	void initPoints();
-	void animatePoint(double& xVal);
+    void paintEvent(QPaintEvent *ev) override;
+    void initPoints();
+    void animatePoint(double &xVal);
 
-	QTimer mTimer;
-	QTimer mShowTimer;
-	QVector<double> mPoints;
+    QTimer mTimer;
+    QTimer mShowTimer;
+    QVector<double> mPoints;
 };
 
-class DllCoreExport DkGenericProfileWidget : public DkNamedWidget {
-	Q_OBJECT
+class DllCoreExport DkGenericProfileWidget : public DkNamedWidget
+{
+    Q_OBJECT
 
 public:
-	DkGenericProfileWidget(const QString& name, QWidget* parent, const QString& settingsPath = "");
-	virtual ~DkGenericProfileWidget();
+    DkGenericProfileWidget(const QString &name, QWidget *parent, const QString &settingsPath = "");
+    virtual ~DkGenericProfileWidget();
 
 public slots:
-	void saveSettings() const;
-	virtual void saveSettings(const QString& name) const;
-	virtual void loadSettings(const QString& name) = 0;
-	void deleteCurrentSetting();
-	void activate(bool active = true);
-	void setDefaultModel() const;
+    void saveSettings() const;
+    virtual void saveSettings(const QString &name) const;
+    virtual void loadSettings(const QString &name) = 0;
+    void deleteCurrentSetting();
+    void activate(bool active = true);
+    void setDefaultModel() const;
 
 protected:
-	void paintEvent(QPaintEvent* ev) override;
+    void paintEvent(QPaintEvent *ev) override;
 
-	virtual void init();
-	void createLayout();
-	QStringList loadProfileStrings() const;
-	QString loadDefaultProfileString() const;
+    virtual void init();
+    void createLayout();
+    QStringList loadProfileStrings() const;
+    QString loadDefaultProfileString() const;
 
-	QPushButton* mSaveButton;
-	QPushButton* mDeleteButton;
-	QComboBox* mProfileList;
-	bool mEmpty = true;
+    QPushButton *mSaveButton;
+    QPushButton *mDeleteButton;
+    QComboBox *mProfileList;
+    bool mEmpty = true;
 
-	QString mSettingsGroup = "ILLEGAL_GENERIC_GROUP";
-	QString mSettingsPath;
+    QString mSettingsGroup = "ILLEGAL_GENERIC_GROUP";
+    QString mSettingsPath;
 };
 
-
-class DllCoreExport DkTabEntryWidget : public QPushButton {
-	Q_OBJECT
+class DllCoreExport DkTabEntryWidget : public QPushButton
+{
+    Q_OBJECT
 
 public:
-	DkTabEntryWidget(const QIcon& icon, const QString& text, QWidget* parent);
+    DkTabEntryWidget(const QIcon &icon, const QString &text, QWidget *parent);
 
 protected:
-	void paintEvent(QPaintEvent* event) override;
-
+    void paintEvent(QPaintEvent *event) override;
 };
 
-class DllCoreExport DkDisplayWidget : public DkFadeWidget {
-	Q_OBJECT
+class DllCoreExport DkDisplayWidget : public DkFadeWidget
+{
+    Q_OBJECT
 
 public:
-	DkDisplayWidget(QWidget* parent);
+    DkDisplayWidget(QWidget *parent);
+
+    QRect screenRect() const;
 
-	QRect screenRect() const;
-	
-	int count() const;
+    int count() const;
 
-	int currentIndex() const;
-	void setCurrentIndex(int index);
+    int currentIndex() const;
+    void setCurrentIndex(int index);
 
-//public slots:
-//	void changeDisplay();
+    // public slots:
+    //	void changeDisplay();
 
 protected:
-	void resizeEvent(QResizeEvent *event) override;
+    void resizeEvent(QResizeEvent *event) override;
 
 private:
-	void createLayout();
-	void updateLayout();
+    void createLayout();
+    void updateLayout();
 
-	QList<QScreen*> mScreens;
-	QList<QPushButton*> mScreenButtons;
+    QList<QScreen *> mScreens;
+    QList<QPushButton *> mScreenButtons;
 };
 
 }
diff --git a/ImageLounge/src/img/aspect-ratio.svg b/ImageLounge/src/img/aspect-ratio.svg
deleted file mode 100644
index a236ef4..0000000
--- a/ImageLounge/src/img/aspect-ratio.svg
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Generator: Adobe Illustrator 24.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
-<svg version="1.1" id="Layer_3" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
-	 viewBox="0 0 80.1 80.1" style="enable-background:new 0 0 80.1 80.1;" xml:space="preserve">
-<style type="text/css">
-	.st0{fill:#231F20;}
-</style>
-<path class="st0" d="M75,18v45H5V18H75 M76.2,13H3.8C1.7,13,0,14.7,0,16.8v47.5c0,2.1,1.7,3.8,3.8,3.8h72.4c2.1,0,3.8-1.7,3.8-3.8
-	V16.8C80,14.7,78.3,13,76.2,13L76.2,13z"/>
-<rect x="20" y="33" class="st0" width="5" height="5"/>
-<rect x="10" y="33" class="st0" width="5" height="5"/>
-<rect x="30" y="33" class="st0" width="5" height="5"/>
-<rect x="40" y="33" class="st0" width="5" height="5"/>
-<rect x="50" y="33" class="st0" width="5" height="5"/>
-<rect x="60" y="33" class="st0" width="5" height="5"/>
-<rect x="60" y="43" class="st0" width="5" height="5"/>
-<rect x="60" y="53" class="st0" width="5" height="5"/>
-</svg>
diff --git a/ImageLounge/src/img/crop-invert-checked.svg b/ImageLounge/src/img/crop-invert-checked.svg
new file mode 100644
index 0000000..457e68d
--- /dev/null
+++ b/ImageLounge/src/img/crop-invert-checked.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+	 viewBox="0 0 160 160" style="enable-background:new 0 0 160 160;" xml:space="preserve">
+<style type="text/css">
+	.st0{fill:#231F20;}
+</style>
+<g>
+	<path class="st0" d="M60,120h50v10H35c-2.8,0-5-2.2-5-5V5c0-5,12.2-5,15-5s15,0,15,5V120z"/>
+	<path class="st0" d="M160,125c0,2.8-2.2,5-5,5h-15v-10h15C157.8,120,160,122.2,160,125z"/>
+</g>
+<g>
+	<path class="st0" d="M5,30h15v30H5c-5,0-5-12.2-5-15C0,42.2,0,30,5,30z"/>
+	<path class="st0" d="M130,35v120c0,2.8-2.2,5-5,5s-5-2.2-5-5V60H70V30h55C127.8,30,130,32.2,130,35z"/>
+</g>
+</svg>
diff --git a/ImageLounge/src/img/crop-invert.svg b/ImageLounge/src/img/crop-invert.svg
new file mode 100644
index 0000000..8e426f5
--- /dev/null
+++ b/ImageLounge/src/img/crop-invert.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+	 viewBox="0 0 160 160" style="enable-background:new 0 0 160 160;" xml:space="preserve">
+<style type="text/css">
+	.st0{fill:#231F20;}
+</style>
+<g>
+	<path class="st0" d="M40,100h50v30H35c-2.8,0-5-2.2-5-5V5c0-2.8,2.2-5,5-5s5,2.2,5,5V100z"/>
+	<path class="st0" d="M160,115c0,2.8,0,15-5,15h-15v-30h15C160,100,160,112.2,160,115z"/>
+</g>
+<g>
+	<path class="st0" d="M5,30h15v10H5c-2.8,0-5-2.2-5-5C0,32.2,2.2,30,5,30z"/>
+	<path class="st0" d="M130,35v120c0,5-12.2,5-15,5s-15,0-15-5V40H50V30h75C127.8,30,130,32.2,130,35z"/>
+</g>
+</svg>
diff --git a/ImageLounge/src/main.cpp b/ImageLounge/src/main.cpp
index 07edf04..a96fcc9 100644
--- a/ImageLounge/src/main.cpp
+++ b/ImageLounge/src/main.cpp
@@ -1,9 +1,9 @@
 /*******************************************************************************************************
  main.cpp
  Created on:	21.04.2011
- 
+
  nomacs is a fast and small image viewer with the capability of synchronizing multiple instances
- 
+
  Copyright (C) 2011-2013 Markus Diem <markus@nomacs.org>
  Copyright (C) 2011-2013 Stefan Fiel <stefan@nomacs.org>
  Copyright (C) 2011-2013 Florian Kleber <florian@nomacs.org>
@@ -25,318 +25,310 @@
 
  *******************************************************************************************************/
 
-
 #ifdef Q_OS_WIN
-	#include "shlwapi.h"
-	#pragma comment (lib, "shlwapi.lib")
+#include "shlwapi.h"
+#pragma comment(lib, "shlwapi.lib")
 #endif
 
 #if defined(_MSC_BUILD) && !defined(DK_INSTALL) // only final release will be compiled without a CMD
-	#pragma comment (linker, "/SUBSYSTEM:CONSOLE")
+#pragma comment(linker, "/SUBSYSTEM:CONSOLE")
 #else
-	#pragma comment (linker, "/SUBSYSTEM:WINDOWS")
+#pragma comment(linker, "/SUBSYSTEM:WINDOWS")
 #endif
 
 #ifdef QT_NO_DEBUG_OUTPUT
-#pragma warning(disable: 4127)		// no 'conditional expression is constant' if qDebug() messages are removed
+#pragma warning(disable : 4127) // no 'conditional expression is constant' if qDebug() messages are removed
 #endif
 
-#pragma warning(push, 0)	// no warnings from includes - begin
-#include <QObject>
+#pragma warning(push, 0) // no warnings from includes - begin
 #include <QApplication>
-#include <QFileInfo>
-#include <QProcess>
-#include <QTranslator>
+#include <QCommandLineParser>
 #include <QDebug>
-#include <QDir>
-#include <QTextStream>
 #include <QDesktopServices>
-#include <QCommandLineParser>
+#include <QDir>
+#include <QFileInfo>
 #include <QMessageBox>
-#pragma warning(pop)	// no warnings from includes - end
+#include <QObject>
+#include <QProcess>
+#include <QTextStream>
+#include <QTranslator>
+#pragma warning(pop) // no warnings from includes - end
 
-#include "DkNoMacs.h"
 #include "DkCentralWidget.h"
+#include "DkNoMacs.h"
+#include "DkPluginManager.h"
+#include "DkPong.h"
+#include "DkProcess.h"
 #include "DkSettings.h"
 #include "DkTimer.h"
-#include "DkPong.h"
 #include "DkUtils.h"
-#include "DkProcess.h"
-#include "DkPluginManager.h"
 
 #include "DkDependencyResolver.h"
 #include "DkMetaData.h"
 
 #include "DkVersion.h"
 
-#include <iostream>
 #include <cassert>
+#include <iostream>
 
 #ifdef Q_OS_WIN
 #include <shlobj.h>
 #endif
 
 #ifdef Q_OS_WIN
-int main(int argc, wchar_t *argv[]) {
+int main(int argc, wchar_t *argv[])
+{
 #else
-int main(int argc, char *argv[]) {
+int main(int argc, char *argv[])
+{
 #endif
 
     QCoreApplication::setOrganizationName("nomacs");
     QCoreApplication::setOrganizationDomain("https://nomacs.org");
     QCoreApplication::setApplicationName("Image Lounge");
     QCoreApplication::setApplicationVersion(NOMACS_VERSION_STR);
-	
+
 #if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
     QApplication::setAttribute(Qt::AA_DisableHighDpiScaling, true);
 #endif
 
-	QApplication app(argc, (char**)argv);
-
-	// init settings
-	nmc::DkSettingsManager::instance().init();
-	nmc::DkMetaDataHelper::initialize();	// this line makes the XmpParser thread-save - so don't delete it even if you seem to know what you do
-
-	nmc::DefaultSettings settings;
-	int mode = settings.value("AppSettings/appMode", nmc::DkSettingsManager::param().app().appMode).toInt();
-
-	// uncomment this for the single instance feature...
-	//// check for single instance
-	//nmc::DkRunGuard guard;
-	//
-	//if (!guard.tryRunning()) {
-	//	qDebug() << "nomacs is already running - quitting...";
-	//	return 0;
-	//}
-
-	// CMD parser --------------------------------------------------------------------
-	QCommandLineParser parser;
-	
-	parser.addHelpOption();
-	parser.addVersionOption();
-	parser.addPositionalArgument("image", QObject::tr("An input image."));
-
-	// fullscreen (-f)
-	QCommandLineOption fullScreenOpt(QStringList() << "f" << "fullscreen", QObject::tr("Start in fullscreen."));
-	parser.addOption(fullScreenOpt);
-
-	QCommandLineOption slideshowOpt(QStringList() << "slideshow", QObject::tr("Start slideshow playback"));
-	parser.addOption(slideshowOpt);
-
-	QCommandLineOption pongOpt(QStringList() << "pong", QObject::tr("Start Pong."));
-	parser.addOption(pongOpt);
-
-	QCommandLineOption privateOpt(QStringList() << "p" << "private", QObject::tr("Start in private mode."));
-	parser.addOption(privateOpt);
-
-	QCommandLineOption modeOpt(QStringList() << "m" << "mode",
-		QObject::tr("Set the viewing mode <mode>."),
-		QObject::tr("default | frameless | pseudocolor"));
-	parser.addOption(modeOpt);
-
-	QCommandLineOption sourceDirOpt(QStringList() << "d" << "directory",
-		QObject::tr("Load all files of a <directory>."),
-		QObject::tr("directory"));
-	parser.addOption(sourceDirOpt);
-
-	QCommandLineOption tabOpt(QStringList() << "t" << "tab",
-		QObject::tr("Load <images> to tabs."),
-		QObject::tr("images"));
-	parser.addOption(tabOpt);
-
-	QCommandLineOption batchOpt(QStringList() << "batch",
-		QObject::tr("Batch processing of <batch-settings.pnm>."),
-		QObject::tr("batch-settings-path"));
-	parser.addOption(batchOpt);
-
-	QCommandLineOption batchLogOpt(QStringList() << "batch-log",
-		QObject::tr("Saves batch log to <log-path.txt>."),
-		QObject::tr("log-path.txt"));
-	parser.addOption(batchLogOpt);
-
-	QCommandLineOption importSettingsOpt(QStringList() << "import-settings",
-		QObject::tr("Imports the settings from <settings-path.ini> and saves them."),
-		QObject::tr("settings-path.ini"));
-	parser.addOption(importSettingsOpt);
-	
-	QCommandLineOption registerFilesOpt(QStringList() << "register-files", QObject::tr("Register file associations (Windows only)."));
-	parser.addOption(registerFilesOpt);
-
-	parser.process(app);
-	
-	// CMD parser --------------------------------------------------------------------
-	nmc::DkPluginManager::createPluginsPath();
-	
-	// compute batch process
-	if (!parser.value(batchOpt).isEmpty()) {
-		
-		QString logPath;
-		if (!parser.value(batchLogOpt).isEmpty())
-			logPath = parser.value(batchLogOpt);
-
-		QString batchSettingsPath = parser.value(batchOpt);
-		nmc::DkBatchProcessing::computeBatch(batchSettingsPath, logPath);
-		
-		return 0;
-	}
-
-	bool noUI = false;
-
-	// apply default settings
-	if (!parser.value(importSettingsOpt).isEmpty()) {
-		QString settingsPath = parser.value(importSettingsOpt);
-		nmc::DkSettingsManager::importSettings(settingsPath);
-		noUI = true;
-	}
-
-	// apply default settings
-	if (parser.isSet(registerFilesOpt)) {
-		
-		nmc::DkFileFilterHandling::registerFileAssociations();
-		noUI = true;
-	}
-
-	if (noUI)
-		return 0;
-
-	//install translations
-	QString translationName = "nomacs_" + 
-		settings.value("GlobalSettings/language", nmc::DkSettingsManager::param().global().language).toString() + ".qm";
-	QString translationNameQt = "qt_" + 
-		settings.value("GlobalSettings/language", nmc::DkSettingsManager::param().global().language).toString() + ".qm";
-
-	QTranslator translator;
-	nmc::DkSettingsManager::param().loadTranslation(translationName, translator);
-	app.installTranslator(&translator);
-
-	QTranslator translatorQt;
-	nmc::DkSettingsManager::param().loadTranslation(translationNameQt, translatorQt);
-	app.installTranslator(&translatorQt);
-
-	nmc::DkNoMacs* w = 0;
-	nmc::DkPong* pw = 0;	// pong
-
-	// show pink icons if nomacs is in private mode
-	if(parser.isSet(privateOpt)) {
-		nmc::DkSettingsManager::param().display().iconColor = QColor(136, 0, 125);
-		nmc::DkSettingsManager::param().app().privateMode = true;
-	}
-
-	if (parser.isSet(modeOpt)) {
-		QString pm = parser.value(modeOpt);
-
-		if (pm == "default")
-			mode = nmc::DkSettingsManager::param().mode_default;
-		else if (pm == "frameless")
-			mode = nmc::DkSettingsManager::param().mode_frameless;
-		else if (pm == "pseudocolor")
-			mode = nmc::DkSettingsManager::param().mode_contrast;
-		else
-			qWarning() << "illegal mode: " << pm << "use either <default>, <frameless> or <pseudocolor>";
-
-		nmc::DkSettingsManager::param().app().currentAppMode = mode;
-	}
-
-	nmc::DkTimer dt;
-
-	// initialize nomacs
-	if (mode == nmc::DkSettingsManager::param().mode_frameless) {
-		w = new nmc::DkNoMacsFrameless();
-		qDebug() << "this is the frameless nomacs...";
-	}
-	else if (mode == nmc::DkSettingsManager::param().mode_contrast) {
-		w = new nmc::DkNoMacsContrast();
-		qDebug() << "this is the contrast nomacs...";
-	}
-	else if (parser.isSet(pongOpt)) {
-		pw = new nmc::DkPong();
-		int rVal = app.exec();
-		return rVal;
-	}
-	else
-		w = new nmc::DkNoMacsIpl();
-
-	// show what we got...
-	w->show();
-
-	// this triggers a first show
-	QCoreApplication::sendPostedEvents();
-
-	if (w)
-		w->onWindowLoaded();
-
-	qInfo() << "Initialization takes: " << dt;
-
-	nmc::DkCentralWidget* cw = w->getTabWidget();
-
-	bool loading = false;
-
-	if (!parser.positionalArguments().empty()) {
-
-		QString filePath = parser.positionalArguments()[0].trimmed();
-
-		if (!filePath.isEmpty()) {
-			w->loadFile(QFileInfo(filePath).absoluteFilePath());	// update folder + be silent
-			loading = true;
-		}
-	}
-
-	// load directory preview
-	if (!parser.value(sourceDirOpt).trimmed().isEmpty()) {
-		cw->loadDirToTab(parser.value(sourceDirOpt));
-		loading = true;
-	}
-
-	// load to tabs
-	if (!parser.value(tabOpt).isEmpty()) {
-		QStringList tabPaths = parser.values(tabOpt);
-		loading = true;
-
-		for (const QString& filePath : tabPaths)
-			cw->addTab(filePath);
-	}
-	
-	// load recent files if there is nothing to display
-	if (!loading &&
-		nmc::DkSettingsManager::param().app().showRecentFiles) {
-		w->showRecentFilesOnStartUp();
-	}
-
-	int fullScreenMode = settings.value("AppSettings/currentAppMode", nmc::DkSettingsManager::param().app().currentAppMode).toInt();
-
-	if (fullScreenMode == nmc::DkSettingsManager::param().mode_default_fullscreen		||
-		fullScreenMode == nmc::DkSettingsManager::param().mode_frameless_fullscreen		||
-		fullScreenMode == nmc::DkSettingsManager::param().mode_contrast_fullscreen		||
-		parser.isSet(fullScreenOpt)) {
-		w->enterFullScreen();
-		qDebug() << "trying to enter fullscreen...";
-	}
-
-	if (parser.isSet(slideshowOpt)) {
-		cw->startSlideshow();
-	}
+    QApplication app(argc, (char **)argv);
+
+    // init settings
+    nmc::DkSettingsManager::instance().init();
+    nmc::DkMetaDataHelper::initialize(); // this line makes the XmpParser thread-save - so don't delete it even if you seem to know what you do
+
+    nmc::DefaultSettings settings;
+    int mode = settings.value("AppSettings/appMode", nmc::DkSettingsManager::param().app().appMode).toInt();
+
+    // uncomment this for the single instance feature...
+    //// check for single instance
+    // nmc::DkRunGuard guard;
+    //
+    // if (!guard.tryRunning()) {
+    //	qDebug() << "nomacs is already running - quitting...";
+    //	return 0;
+    // }
+
+    // CMD parser --------------------------------------------------------------------
+    QCommandLineParser parser;
+
+    parser.addHelpOption();
+    parser.addVersionOption();
+    parser.addPositionalArgument("image", QObject::tr("An input image."));
+
+    // fullscreen (-f)
+    QCommandLineOption fullScreenOpt(QStringList() << "f"
+                                                   << "fullscreen",
+                                     QObject::tr("Start in fullscreen."));
+    parser.addOption(fullScreenOpt);
+
+    QCommandLineOption slideshowOpt(QStringList() << "slideshow", QObject::tr("Start slideshow playback"));
+    parser.addOption(slideshowOpt);
+
+    QCommandLineOption pongOpt(QStringList() << "pong", QObject::tr("Start Pong."));
+    parser.addOption(pongOpt);
+
+    QCommandLineOption privateOpt(QStringList() << "p"
+                                                << "private",
+                                  QObject::tr("Start in private mode."));
+    parser.addOption(privateOpt);
+
+    QCommandLineOption modeOpt(QStringList() << "m"
+                                             << "mode",
+                               QObject::tr("Set the viewing mode <mode>."),
+                               QObject::tr("default | frameless | pseudocolor"));
+    parser.addOption(modeOpt);
+
+    QCommandLineOption sourceDirOpt(QStringList() << "d"
+                                                  << "directory",
+                                    QObject::tr("Load all files of a <directory>."),
+                                    QObject::tr("directory"));
+    parser.addOption(sourceDirOpt);
+
+    QCommandLineOption tabOpt(QStringList() << "t"
+                                            << "tab",
+                              QObject::tr("Load <images> to tabs."),
+                              QObject::tr("images"));
+    parser.addOption(tabOpt);
+
+    QCommandLineOption batchOpt(QStringList() << "batch", QObject::tr("Batch processing of <batch-settings.pnm>."), QObject::tr("batch-settings-path"));
+    parser.addOption(batchOpt);
+
+    QCommandLineOption batchLogOpt(QStringList() << "batch-log", QObject::tr("Saves batch log to <log-path.txt>."), QObject::tr("log-path.txt"));
+    parser.addOption(batchLogOpt);
+
+    QCommandLineOption importSettingsOpt(QStringList() << "import-settings",
+                                         QObject::tr("Imports the settings from <settings-path.ini> and saves them."),
+                                         QObject::tr("settings-path.ini"));
+    parser.addOption(importSettingsOpt);
+
+    QCommandLineOption registerFilesOpt(QStringList() << "register-files", QObject::tr("Register file associations (Windows only)."));
+    parser.addOption(registerFilesOpt);
+
+    parser.process(app);
+
+    // CMD parser --------------------------------------------------------------------
+    nmc::DkPluginManager::createPluginsPath();
+
+    // compute batch process
+    if (!parser.value(batchOpt).isEmpty()) {
+        QString logPath;
+        if (!parser.value(batchLogOpt).isEmpty())
+            logPath = parser.value(batchLogOpt);
+
+        QString batchSettingsPath = parser.value(batchOpt);
+        nmc::DkBatchProcessing::computeBatch(batchSettingsPath, logPath);
+
+        return 0;
+    }
+
+    bool noUI = false;
+
+    // apply default settings
+    if (!parser.value(importSettingsOpt).isEmpty()) {
+        QString settingsPath = parser.value(importSettingsOpt);
+        nmc::DkSettingsManager::importSettings(settingsPath);
+        noUI = true;
+    }
+
+    // apply default settings
+    if (parser.isSet(registerFilesOpt)) {
+        nmc::DkFileFilterHandling::registerFileAssociations();
+        noUI = true;
+    }
+
+    if (noUI)
+        return 0;
+
+    // install translations
+    QString translationName = "nomacs_" + settings.value("GlobalSettings/language", nmc::DkSettingsManager::param().global().language).toString() + ".qm";
+    QString translationNameQt = "qt_" + settings.value("GlobalSettings/language", nmc::DkSettingsManager::param().global().language).toString() + ".qm";
+
+    QTranslator translator;
+    nmc::DkSettingsManager::param().loadTranslation(translationName, translator);
+    app.installTranslator(&translator);
+
+    QTranslator translatorQt;
+    nmc::DkSettingsManager::param().loadTranslation(translationNameQt, translatorQt);
+    app.installTranslator(&translatorQt);
+
+    nmc::DkNoMacs *w = 0;
+    nmc::DkPong *pw = 0; // pong
+
+    // show pink icons if nomacs is in private mode
+    if (parser.isSet(privateOpt)) {
+        nmc::DkSettingsManager::param().display().iconColor = QColor(136, 0, 125);
+        nmc::DkSettingsManager::param().app().privateMode = true;
+    }
+
+    if (parser.isSet(modeOpt)) {
+        QString pm = parser.value(modeOpt);
+
+        if (pm == "default")
+            mode = nmc::DkSettingsManager::param().mode_default;
+        else if (pm == "frameless")
+            mode = nmc::DkSettingsManager::param().mode_frameless;
+        else if (pm == "pseudocolor")
+            mode = nmc::DkSettingsManager::param().mode_contrast;
+        else
+            qWarning() << "illegal mode: " << pm << "use either <default>, <frameless> or <pseudocolor>";
+
+        nmc::DkSettingsManager::param().app().currentAppMode = mode;
+    }
+
+    nmc::DkTimer dt;
+
+    // initialize nomacs
+    if (mode == nmc::DkSettingsManager::param().mode_frameless) {
+        w = new nmc::DkNoMacsFrameless();
+        qDebug() << "this is the frameless nomacs...";
+    } else if (mode == nmc::DkSettingsManager::param().mode_contrast) {
+        w = new nmc::DkNoMacsContrast();
+        qDebug() << "this is the contrast nomacs...";
+    } else if (parser.isSet(pongOpt)) {
+        pw = new nmc::DkPong();
+        int rVal = app.exec();
+        return rVal;
+    } else
+        w = new nmc::DkNoMacsIpl();
+
+    // show what we got...
+    w->show();
+
+    // this triggers a first show
+    QCoreApplication::sendPostedEvents();
+
+    if (w)
+        w->onWindowLoaded();
+
+    qInfo() << "Initialization takes: " << dt;
+
+    nmc::DkCentralWidget *cw = w->getTabWidget();
+
+    bool loading = false;
+
+    if (!parser.positionalArguments().empty()) {
+        QString filePath = parser.positionalArguments()[0].trimmed();
+
+        if (!filePath.isEmpty()) {
+            w->loadFile(QFileInfo(filePath).absoluteFilePath()); // update folder + be silent
+            loading = true;
+        }
+    }
+
+    // load directory preview
+    if (!parser.value(sourceDirOpt).trimmed().isEmpty()) {
+        cw->loadDirToTab(parser.value(sourceDirOpt));
+        loading = true;
+    }
+
+    // load to tabs
+    if (!parser.value(tabOpt).isEmpty()) {
+        QStringList tabPaths = parser.values(tabOpt);
+        loading = true;
+
+        for (const QString &filePath : tabPaths)
+            cw->addTab(filePath);
+    }
+
+    // load recent files if there is nothing to display
+    if (!loading && nmc::DkSettingsManager::param().app().showRecentFiles) {
+        w->showRecentFilesOnStartUp();
+    }
+
+    int fullScreenMode = settings.value("AppSettings/currentAppMode", nmc::DkSettingsManager::param().app().currentAppMode).toInt();
+
+    if (fullScreenMode == nmc::DkSettingsManager::param().mode_default_fullscreen || fullScreenMode == nmc::DkSettingsManager::param().mode_frameless_fullscreen
+        || fullScreenMode == nmc::DkSettingsManager::param().mode_contrast_fullscreen || parser.isSet(fullScreenOpt)) {
+        w->enterFullScreen();
+        qDebug() << "trying to enter fullscreen...";
+    }
+
+    if (parser.isSet(slideshowOpt)) {
+        cw->startSlideshow();
+    }
 
 #ifdef Q_WS_MAC
-	nmc::DkNomacsOSXEventFilter *osxEventFilter = new nmc::DkNomacsOSXEventFilter();
-	app.installEventFilter(osxEventFilter);
-	QObject::connect(osxEventFilter, SIGNAL(loadFile(const QFileInfo&)),
-		w, SLOT(loadFile(const QFileInfo&)));
+    nmc::DkNomacsOSXEventFilter *osxEventFilter = new nmc::DkNomacsOSXEventFilter();
+    app.installEventFilter(osxEventFilter);
+    QObject::connect(osxEventFilter, SIGNAL(loadFile(const QFileInfo &)), w, SLOT(loadFile(const QFileInfo &)));
 #endif
 
-	int rVal = -1;
-	try {
-		rVal = app.exec();
-	}
-	catch (const std::bad_alloc&) {
-		
-		QMessageBox::critical(0, QObject::tr("Critical Error"), 
-			QObject::tr("Sorry, nomacs ran out of memory..."), QMessageBox::Ok);
-	}
-
-	if (w)
-		delete w;	// we need delete so that settings are saved (from destructors)
-	if (pw)
-		delete pw;
-
-	return rVal;
+    int rVal = -1;
+    try {
+        rVal = app.exec();
+    } catch (const std::bad_alloc &) {
+        QMessageBox::critical(0, QObject::tr("Critical Error"), QObject::tr("Sorry, nomacs ran out of memory..."), QMessageBox::Ok);
+    }
+
+    // restore message handler, workaround for: https://github.com/nomacs/nomacs/issues/874
+    qInstallMessageHandler(0);
+
+    if (w)
+        delete w; // we need delete so that settings are saved (from destructors)
+    if (pw)
+        delete pw;
+
+    return rVal;
 }
diff --git a/ImageLounge/src/nomacs.qrc b/ImageLounge/src/nomacs.qrc
index bdbccb8..56e643a 100644
--- a/ImageLounge/src/nomacs.qrc
+++ b/ImageLounge/src/nomacs.qrc
@@ -1,6 +1,5 @@
 <RCC>
   <qresource prefix="/nomacs">
-    <file>img/aspect-ratio.svg</file>
     <file>img/next.svg</file>
     <file>img/next-hud.svg</file>
     <file>img/previous.svg</file>
@@ -58,6 +57,8 @@
     <file>img/swap.svg</file>
     <file>img/pan.svg</file>
     <file>img/pan-checked.svg</file>
+    <file>img/crop-invert.svg</file>
+    <file>img/crop-invert-checked.svg</file>
     <file>img/info.svg</file>
     <file>img/widget-separator.svg</file>
     <file>img/trash.svg</file>
diff --git a/ImageLounge/src/stylesheet.css b/ImageLounge/src/stylesheet.css
index 54daa90..4ac3931 100644
--- a/ImageLounge/src/stylesheet.css
+++ b/ImageLounge/src/stylesheet.css
@@ -103,16 +103,16 @@ QPushButton#hudNavigationButton {
     max-height: 128px;
 }
 
-QPushButton#dark {
+QPushButton#DkRestartButton {
 	border: none;
 	padding: 4px;
 }
 
-QPushButton#dark:hover{
+QPushButton#DkRestartButton:hover{
 	background-color: rgba(255,255,255,.2);
 } 
 
-QPushButton#dark:pressed {
+QPushButton#DkRestartButton:pressed {
 	background-color: HIGHLIGHT_LIGHT;
 }
 
@@ -121,6 +121,11 @@ QToolBar {
 	border-bottom: 1px solid #cdcdcd;
 }
 
+QToolBar#cropToolBar {
+	spacing: 3px; 
+	padding: 3px;
+}
+
 QStatusBar#statusBarWithGradient {
 	border-top: none; 
 	background: QLinearGradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #edeff9, stop: 1 #bebfc7); 
@@ -438,132 +443,105 @@ nmc--DkDescriptionEdit {
 	background-color: rgba(0,0,0,0);
 }
 
-/* crop toolbar */
-#cropDock {
-    background-color: #9f1d1d;
-}
-
-nmc--DkCropToolBar,
-nmc--DkCropToolBar > QWidget {
-    background: #333;
-    color: #fff;
-    font-size: 11pt;
-    font-weight: 100;
-}
-
-QComboBox#ratioBox {
-    border: none;
-    border-bottom: 1px solid #fff;
-    min-width: 120px;
-    margin-bottom: 5px; /* hack to align with rotate slider */
-}
-
-nmc--DkDoubleSlider QLabel {
-    font-size: 11pt;
-}
-
 /* edit image */
-#darkManipulator QSpinBox,
-#darkManipulator QLabel,
-#darkManipulator QCheckBox,
-#darkManipulator QDoubleSpinBox,
-#darkManipulator QComboBox,
-#darkManipulator QLineEdit {
+nmc--DkBaseManipulatorWidget#darkManipulator QSpinBox,
+nmc--DkBaseManipulatorWidget#darkManipulator QLabel,
+nmc--DkBaseManipulatorWidget#darkManipulator QCheckBox,
+nmc--DkBaseManipulatorWidget#darkManipulator QDoubleSpinBox,
+nmc--DkBaseManipulatorWidget#darkManipulator QComboBox,
+nmc--DkBaseManipulatorWidget#darkManipulator QLineEdit {
 	color: #fff;
 }
 
-#darkManipulator QLineEdit,
-#darkManipulator QComboBox,
-#darkManipulator QDoubleSpinBox,
-#darkManipulator QSpinBox {
+nmc--DkBaseManipulatorWidget#darkManipulator QLineEdit,
+nmc--DkBaseManipulatorWidget#darkManipulator QComboBox,
+nmc--DkBaseManipulatorWidget#darkManipulator QDoubleSpinBox,
+nmc--DkBaseManipulatorWidget#darkManipulator QSpinBox {
 	background: #333;
 	border: none;
 	border-bottom: 1px solid #fff;
 }
 
-#darkManipulator QWidget {
+nmc--DkBaseManipulatorWidget#darkManipulator QWidget {
 	background: #333;
 }
 
-#darkManipulator QDoubleSpinBox::up-button,
-#darkManipulator QDoubleSpinBox::down-button,
-#darkManipulator QSpinBox::up-button,
-#darkManipulator QSpinBox::down-button {
+nmc--DkBaseManipulatorWidget#darkManipulator QDoubleSpinBox::up-button,
+nmc--DkBaseManipulatorWidget#darkManipulator QDoubleSpinBox::down-button,
+nmc--DkBaseManipulatorWidget#darkManipulator QSpinBox::up-button,
+nmc--DkBaseManipulatorWidget#darkManipulator QSpinBox::down-button {
 	border: none;
 	/* background-color: rgba(0,0,0,0); */
 }	
 
-#darkManipulator QSlider::groove:horizontal {
+nmc--DkBaseManipulatorWidget#darkManipulator QSlider::groove:horizontal {
 	border: none; 
-	height: 1px; 
+	height: 3px; 
 	margin: 2px 0;
-	background: #999;
+	background: #fff;
 }
 
-#darkManipulator QSlider::handle:horizontal {
+nmc--DkBaseManipulatorWidget#darkManipulator QSlider::handle:horizontal {
 	background-color: #fff; 
 	width: 6px; 
 	margin:-8px 0px -8px 0px;
 	border: 2px solid #333;
 }
 
-#darkManipulator QDoubleSpinBox::up-button,
-#darkManipulator QDoubleSpinBox::down-button,
-#darkManipulator QSpinBox::up-button,
-#darkManipulator QSlider::down-button {
+nmc--DkBaseManipulatorWidget#darkManipulator QDoubleSpinBox::up-button,
+nmc--DkBaseManipulatorWidget#darkManipulator QDoubleSpinBox::down-button,
+nmc--DkBaseManipulatorWidget#darkManipulator QSpinBox::up-button,
+nmc--DkBaseManipulatorWidget#darkManipulator QSlider::down-button {
 	border: none;
 	background-color: rgba(0,0,0,0);
 }
 
-#darkManipulator {
+nmc--DkBaseManipulatorWidget#darkManipulator {
 	/* background-color: palette(light); */
 	/* border-radius: 7px; */
 }
 
 /* DkManipulationWidget */
-#darkManipulator QSlider#DkBrightnessSlider::groove:horizontal {
+nmc--DkBaseManipulatorWidget#darkManipulator QSlider#DkBrightnessSlider::groove:horizontal {
 	background: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #3c3c3c, stop:1 #c8c8c8);
 }
 
-#darkManipulator QSlider#DkSaturationSlider::groove:horizontal {
+nmc--DkBaseManipulatorWidget#darkManipulator QSlider#DkSaturationSlider::groove:horizontal {
 	background: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #ffffff, stop:1 #00ffff);
 }
 
-#darkManipulator QSlider#DkHueSlider::groove:horizontal {
+nmc--DkBaseManipulatorWidget#darkManipulator QSlider#DkHueSlider::groove:horizontal {
 	background: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #ff0000, stop:0.167 #ffff00, stop:0.333 #00ff00, stop:0.5 #00ffff, stop:0.666 #0000ff, stop:0.833 #ff00ff, stop:1 #ff0000);
 }
 
-#darkManipulator QComboBox {
+nmc--DkBaseManipulatorWidget#darkManipulator QComboBox {
 	font-size: 11pt;
 	min-height: 30px;
 }
 
-#darkManipulator QComboBox::drop-down {
-  	image: url(:/nomacs/img/down-white.svg);
+nmc--DkBaseManipulatorWidget#darkManipulator QComboBox::drop-down {
+	image: url(:/nomacs/img/down-white.svg);
 	border: none;
 	width: 16px;
-    height: 16px;
-    padding: 2px;
-    margin-top: 6px;
-	background-color: none;
+	height: 16px;
+	padding: 5px;
 }
 
-#darkManipulator QComboBox::drop-down:hover {
+nmc--DkBaseManipulatorWidget#darkManipulator QComboBox::drop-down:hover {
 	background-color: rgba(255, 255, 255, 30);
 }
 
-#darkManipulator QComboBox QListView {
-    color: #fff;
-    border: 1px solid #444;
+nmc--DkBaseManipulatorWidget#darkManipulator QComboBox QListView {
+	border: 1px solid #444;
 	font-size: 11pt;
 }
 
-#darkManipulator QComboBox QListView::item {
+nmc--DkBaseManipulatorWidget#darkManipulator QComboBox QListView::item {
 	color: #fff;
 	padding: 5px;
 }
 
-#darkManipulator QComboBox QListView::item:selected { 
+nmc--DkBaseManipulatorWidget#darkManipulator QComboBox QListView::item:selected { 
 	color: #333;
 	background-color: HIGHLIGHT_COLOR; 
 }
diff --git a/ImageLounge/src/themes/Dark-Theme.css b/ImageLounge/src/themes/Dark-Theme.css
index ae5c725..6114d82 100644
--- a/ImageLounge/src/themes/Dark-Theme.css
+++ b/ImageLounge/src/themes/Dark-Theme.css
@@ -143,8 +143,8 @@ QTextEdit,
 QTreeView,
 QTableView,
 QListView {
-    border: 1px solid #444;
-    alternate-background-color:#444;
+        border: 1px solid #444;
+        alternate-background-color:#444;
 }
 
 QPushButton:hover,
diff --git a/ImageLounge/translations/src/nomacs.ts b/ImageLounge/translations/src/nomacs.ts
index 87fb7c3..b9de37c 100644
--- a/ImageLounge/translations/src/nomacs.ts
+++ b/ImageLounge/translations/src/nomacs.ts
@@ -1,2698 +1,2601 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE TS>
 <TS version="2.1">
-<context>
-    <name>DkCropToolBar</name>
-    <message>
-        <location filename="../../src/DkGui/DkCropWidgets.cpp" line="870"/>
-        <source>closes the crop view, and applies cropping to the image (ENTER)</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../../src/DkGui/DkCropWidgets.cpp" line="869"/>
-        <source>Apply</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../../src/DkGui/DkCropWidgets.cpp" line="875"/>
-        <source>Cancel</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../../src/DkGui/DkCropWidgets.cpp" line="876"/>
-        <source>closes the crop view, leaving the image unchanged (ESC)</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../../src/DkGui/DkCropWidgets.cpp" line="880"/>
-        <source>Rotate</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../../src/DkGui/DkCropWidgets.cpp" line="894"/>
-        <source>Aspect Ratio</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../../src/DkGui/DkCropWidgets.cpp" line="895"/>
-        <source>Free</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../../src/DkGui/DkCropWidgets.cpp" line="896"/>
-        <source>Original</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../../src/DkGui/DkCropWidgets.cpp" line="897"/>
-        <source>Square</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../../src/DkGui/DkCropWidgets.cpp" line="898"/>
-        <source>16:9</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../../src/DkGui/DkCropWidgets.cpp" line="899"/>
-        <source>4:3</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../../src/DkGui/DkCropWidgets.cpp" line="900"/>
-        <source>3:2</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../../src/DkGui/DkCropWidgets.cpp" line="902"/>
-        <source>Flip</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../../src/DkGui/DkCropWidgets.cpp" line="903"/>
-        <source>flips the crop rectangle (F)</source>
-        <translation type="unfinished"></translation>
-    </message>
-</context>
-<context>
-    <name>DkCropViewPort</name>
-    <message>
-        <location filename="../../src/DkGui/DkCropWidgets.cpp" line="294"/>
-        <source>Crop Image</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../../src/DkGui/DkCropWidgets.cpp" line="295"/>
-        <source>Do you want to apply cropping?</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../../src/DkGui/DkCropWidgets.cpp" line="297"/>
-        <source>&amp;Crop</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../../src/DkGui/DkCropWidgets.cpp" line="298"/>
-        <source>&amp;Don&apos;t Crop</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../../src/DkGui/DkCropWidgets.cpp" line="366"/>
-        <source>Rotated</source>
-        <translation type="unfinished"></translation>
-    </message>
-</context>
 <context>
     <name>QObject</name>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="184"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="183"/>
         <source>&amp;Photoshop</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="195"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="194"/>
         <source>Pic&amp;asa</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="206"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="205"/>
         <source>Picasa Ph&amp;oto Viewer</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="217"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="216"/>
         <source>&amp;IrfanView</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="227"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="226"/>
         <source>&amp;Explorer</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="363"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="358"/>
         <source>&amp;File</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="406"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="401"/>
         <source>&amp;Open With</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="428"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="423"/>
         <source>S&amp;ort</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="442"/>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="668"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="438"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="663"/>
         <source>&amp;View</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="500"/>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="674"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="496"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="669"/>
         <source>&amp;Edit</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="522"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="518"/>
         <source>&amp;Adjustments</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="538"/>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="652"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="534"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="647"/>
         <source>&amp;Panels</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="540"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="536"/>
         <source>Tool&amp;bars</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="571"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="567"/>
         <source>&amp;Tools</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="595"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="591"/>
         <source>&amp;?</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="611"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="607"/>
         <source>&amp;Sync</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="614"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="610"/>
         <source>&amp;Synchronize</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="957"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="993"/>
         <source>&amp;Open</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="959"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="995"/>
         <source>Open an image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="961"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="997"/>
         <source>Open &amp;Directory</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="963"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="999"/>
         <source>Open a directory and load its first image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="965"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1001"/>
         <source>&amp;Open Tabs</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="966"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1002"/>
         <source>Open a texfile containing a list of filepaths, and open tabs for them</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="968"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1004"/>
         <source>&amp;Quick Launch</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="975"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1011"/>
         <source>&amp;Manage Applications</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="976"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1012"/>
         <source>Manage Applications which are Automatically Opened</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="979"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1015"/>
         <source>Re&amp;name</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="982"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1018"/>
         <source>Rename an image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="984"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1020"/>
         <source>&amp;Go To</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="986"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1022"/>
         <source>Go To an image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="988"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1024"/>
         <source>&amp;Save</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="990"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1026"/>
         <source>Save an image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="992"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1028"/>
         <source>S&amp;ave As</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="994"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1030"/>
         <source>Save an image as</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="996"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1032"/>
         <source>Sa&amp;ve a Copy</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="997"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1033"/>
         <source>Copy the Image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="999"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1035"/>
         <source>&amp;Save Tabs</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1000"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1036"/>
         <source>Save a newline separated list of the filenames of the open tabs</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1002"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1038"/>
         <source>&amp;Save for Web</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1003"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1039"/>
         <source>Save an Image for Web Applications</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1005"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1041"/>
         <source>&amp;Print</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1007"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1043"/>
         <source>Print an image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1009"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1045"/>
         <source>&amp;Recent Files</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1013"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1049"/>
         <source>Show Recent Files</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1015"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1051"/>
         <source>&amp;Reload File</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1018"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1054"/>
         <source>Reload File</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1020"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1056"/>
         <source>Ne&amp;xt File</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1023"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1059"/>
         <source>Load next image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1025"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1061"/>
         <source>Pre&amp;vious File</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1028"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1064"/>
         <source>Load previous file</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1030"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1066"/>
         <source>St&amp;art New Instance</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1032"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1068"/>
         <source>Open file in new instance</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1034"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1070"/>
         <source>St&amp;art Private Instance</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1036"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1072"/>
         <source>Open private instance</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1038"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1074"/>
         <source>&amp;Find &amp;&amp; Filter</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1040"/>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1391"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1076"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1433"/>
         <source>Find an image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1042"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1078"/>
         <source>Scan Folder Re&amp;cursive</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1043"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1079"/>
         <source>Step through Folder and Sub Folders</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1047"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1083"/>
         <source>&amp;Exit</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1048"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1084"/>
         <source>Exit</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1053"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1089"/>
         <source>by &amp;Filename</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1055"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1091"/>
         <source>Sort by Filename</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1059"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1095"/>
+        <source>by File &amp;Size</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1097"/>
+        <source>Sort by File Size</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1101"/>
         <source>by Date &amp;Created</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1061"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1103"/>
         <source>Sort by Date Created</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1065"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1107"/>
         <source>by Date Modified</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1067"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1109"/>
         <source>Sort by Date Last Modified</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1071"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1113"/>
         <source>Random</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1073"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1115"/>
         <source>Sort in Random Order</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1077"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1119"/>
         <source>&amp;Ascending</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1079"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1121"/>
         <source>Sort in Ascending Order</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1083"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1125"/>
         <source>&amp;Descending</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1085"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1127"/>
         <source>Sort in Descending Order</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1092"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1134"/>
         <source>9&amp;0%1 Clockwise</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1095"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1137"/>
         <source>rotate the image 90%1 clockwise</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1097"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1139"/>
         <source>&amp;90%1 Counter Clockwise</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1100"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1142"/>
         <source>rotate the image 90%1 counter clockwise</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1102"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1144"/>
         <source>180%1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1103"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1145"/>
         <source>rotate the image by 180%1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1105"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1147"/>
         <source>&amp;Undo</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1108"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1150"/>
         <source>Undo Last Action</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1110"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1152"/>
         <source>&amp;Redo</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1113"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1155"/>
         <source>Redo Last Action</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1115"/>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1494"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1157"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1537"/>
         <source>&amp;Copy</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1118"/>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1123"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1160"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1165"/>
         <source>copy image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1120"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1162"/>
         <source>Copy &amp;Buffer</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1125"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1167"/>
         <source>Copy Co&amp;lor</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1128"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1170"/>
         <source>copy pixel color value as HEX</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1133"/>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1497"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1175"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1540"/>
         <source>&amp;Paste</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1136"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1178"/>
         <source>paste image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1138"/>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1491"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1180"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1534"/>
         <source>&amp;Delete</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1141"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1183"/>
         <source>delete current fileInfo</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1143"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1185"/>
         <source>&amp;Keyboard Shortcuts</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1145"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1187"/>
         <source>lets you customize your keyboard shortcuts</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1147"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1189"/>
         <source>&amp;Settings</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1149"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1191"/>
         <source>settings</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1152"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1194"/>
         <source>Image &amp;Adjustments</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1155"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1197"/>
         <source>open image manipulation toolbox</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1158"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1200"/>
         <source>R&amp;esize Image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1161"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1203"/>
         <source>resize the current image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1163"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1205"/>
         <source>Cr&amp;op Image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1166"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1208"/>
         <source>cut the current image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1172"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1214"/>
         <source>Show &amp;Menu</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1173"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1215"/>
         <source>Hides the Menu and Shows it Again on ALT</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1176"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1218"/>
         <source>Tool&amp;bar</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1178"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1220"/>
         <source>Show Toolbar</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1181"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1223"/>
         <source>&amp;Statusbar</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1183"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1225"/>
         <source>Show Statusbar</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1186"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1228"/>
         <source>&amp;Pseudocolor Function</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1188"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1230"/>
         <source>Show Pseudocolor Function</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1192"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1234"/>
         <source>O&amp;verview</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1194"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1236"/>
         <source>Shows the Zoom Overview</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1198"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1240"/>
         <source>Pla&amp;yer</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1200"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1242"/>
         <source>Shows the Slide Show Player</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1203"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1245"/>
         <source>&amp;Hide All Panels</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1205"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1247"/>
         <source>Hide all panels</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1209"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1251"/>
         <source>File &amp;Explorer</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1211"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1253"/>
         <source>Show File Explorer</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1214"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1256"/>
         <source>Metadata &amp;Info</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1216"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1258"/>
         <source>Show Metadata Info</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1219"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1261"/>
         <source>&amp;Thumbnails</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1221"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1263"/>
         <source>Show Thumbnails</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1224"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1266"/>
         <source>&amp;Thumbnail Preview</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1226"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1268"/>
         <source>Show Thumbnails Preview</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1229"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1271"/>
         <source>&amp;Folder Scrollbar</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1230"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1272"/>
         <source>Show Folder Scrollbar</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1233"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1275"/>
         <source>&amp;Metadata Ribbon</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1235"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1277"/>
         <source>Shows the Metadata Panel</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1238"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1280"/>
         <source>File &amp;Info</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1240"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1282"/>
         <source>Shows the Info Panel</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1243"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1285"/>
         <source>&amp;Histogram</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1245"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1287"/>
         <source>Shows the Histogram Panel</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1248"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1290"/>
         <source>Image &amp;Notes</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1250"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1292"/>
         <source>Shows Image Notes</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1253"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1295"/>
         <source>Edit &amp;History</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1254"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1296"/>
         <source>Shows the edit history</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1258"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1300"/>
         <source>Show &amp;Log</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1259"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1301"/>
         <source>Shows the log window</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1266"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1308"/>
         <source>New &amp;Tab</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1268"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1310"/>
         <source>Open a new tab</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1270"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1312"/>
         <source>&amp;Close Tab</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1272"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1314"/>
         <source>Close current tab</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1274"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1316"/>
         <source>&amp;Close All Tabs</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1275"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1317"/>
         <source>Close all open tabs</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1277"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1319"/>
         <source>&amp;Fit Window to Image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1305"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1347"/>
         <source>&amp;Fit Image to Window</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1307"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1349"/>
         <source>Zoom image to fit window</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1279"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1321"/>
         <source>Fit window to the image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1281"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1323"/>
         <source>F&amp;irst Tab</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1282"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1324"/>
         <source>Switch to first tab</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1284"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1326"/>
         <source>&amp;Previous Tab</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1286"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1328"/>
         <source>Switch to previous tab</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1288"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1330"/>
         <source>&amp;Go to Tab</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1289"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1331"/>
         <source>Go to tab by index</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1291"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1333"/>
         <source>&amp;Next Tab</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1293"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1335"/>
         <source>Switch to next tab</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1295"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1337"/>
         <source>La&amp;st Tab</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1296"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1338"/>
         <source>Switch to last tab</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1301"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1343"/>
         <source>Fu&amp;ll Screen</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1303"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1345"/>
         <source>Full Screen</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1309"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1351"/>
         <source>Show &amp;100%</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1311"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1353"/>
         <source>Shows the image at 100%</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1313"/>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1474"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1355"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1517"/>
         <source>Zoom &amp;In</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1315"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1357"/>
         <source>zoom in</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1317"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1359"/>
         <source>&amp;Zoom Out</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1319"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1361"/>
         <source>zoom out</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1321"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1363"/>
         <source>&amp;Anti Aliasing</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1323"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1365"/>
         <source>if checked images are smoother</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1327"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1369"/>
         <source>&amp;Transparency Pattern</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1329"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1371"/>
         <source>if checked, a pattern will be displayed for transparent objects</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1333"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1375"/>
         <source>&amp;Frameless</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1335"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1377"/>
         <source>shows a frameless window</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1339"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1381"/>
         <source>&amp;Change Opacity</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1341"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1383"/>
         <source>change the window opacity</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1343"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1385"/>
         <source>Opacity &amp;Up</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1345"/>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1349"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1387"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1391"/>
         <source>changes the window opacity</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1347"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1389"/>
         <source>Opacity &amp;Down</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1351"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1393"/>
         <source>To&amp;ggle Opacity</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1353"/>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1444"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1395"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1487"/>
         <source>toggle the window opacity</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1355"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1397"/>
         <source>Lock &amp;Window</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1357"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1399"/>
         <source>lock the window</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1361"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1403"/>
         <source>&amp;Toggle Slideshow</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1362"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1404"/>
         <source>Start/Pause the slideshow</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1365"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1407"/>
         <source>&amp;Pause Movie</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1366"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1408"/>
         <source>pause the current movie</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1370"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1412"/>
         <source>P&amp;revious Frame</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1371"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1413"/>
         <source>show previous frame</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1373"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1415"/>
         <source>&amp;Next Frame</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1374"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1416"/>
         <source>show next frame</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1376"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1418"/>
         <source>Choose &amp;Monitor</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1377"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1419"/>
         <source>Choose the Monitor to run nomacs</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1379"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1421"/>
         <source>Show Image Location</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1380"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1422"/>
         <source>shows where the image was taken in Google maps</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1386"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1428"/>
         <source>Compute &amp;Thumbnails</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1387"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1429"/>
         <source>compute all thumbnails of the current folder</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1390"/>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1488"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1432"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1531"/>
         <source>&amp;Filter</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1395"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1437"/>
         <source>Export Multipage &amp;TIFF</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1396"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1438"/>
         <source>Export TIFF pages to multiple tiff files</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1398"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1440"/>
         <source>Extract From Archive</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1399"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1442"/>
         <source>Extract images from an archive (%1)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1402"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1445"/>
         <source>&amp;Mosaic Image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1403"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1446"/>
         <source>Create a Mosaic Image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1405"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1448"/>
         <source>Batch Processing</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1406"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1449"/>
         <source>Apply actions to multiple images</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1409"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1452"/>
         <source>&amp;Wallpaper</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1410"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1453"/>
         <source>set the current image as wallpaper</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1412"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1455"/>
         <source>Add Image Format</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1413"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1456"/>
         <source>Add a new image format to nomacs</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1417"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1460"/>
         <source>&amp;About Nomacs</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1419"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1462"/>
         <source>about</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1421"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1464"/>
         <source>&amp;Documentation</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1422"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1465"/>
         <source>Online Documentation</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1424"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1467"/>
         <source>&amp;Report a Bug</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1425"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1468"/>
         <source>Report a Bug</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1427"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1470"/>
         <source>&amp;Check for Updates</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1428"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1471"/>
         <source>check for updates</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1431"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1474"/>
         <source>&amp;Update Translation</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1432"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1475"/>
         <source>Checks for a new version of the translations of the current language</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1437"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1480"/>
         <source>Synchronize &amp;View</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1439"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1482"/>
         <source>synchronize the current view</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1442"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1485"/>
         <source>&amp;Window Overlay</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1447"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1490"/>
         <source>Arrange Instances</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1449"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1492"/>
         <source>arrange connected instances</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1452"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1495"/>
         <source>Connect &amp;All</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1455"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1498"/>
         <source>connect all instances</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1457"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1500"/>
         <source>&amp;Sync All Actions</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1458"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1501"/>
         <source>Transmit All Signals Automatically.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1464"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1507"/>
         <source>&amp;Plugin Manager</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1465"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1508"/>
         <source>manage installed plugins and download new ones</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1470"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1513"/>
         <source>Select &amp;All</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1477"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1520"/>
         <source>Zoom &amp;Out</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1480"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1523"/>
         <source>Display &amp;Squares</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1484"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1527"/>
         <source>Show &amp;Filename</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1500"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1543"/>
         <source>&amp;Rename</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1503"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1546"/>
         <source>&amp;Batch Process</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1504"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1547"/>
         <source>Adds selected files to batch processing.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1507"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1550"/>
         <source>&amp;Batch Print</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1508"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1551"/>
         <source>Prints selected files.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1523"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1566"/>
         <source>Start pong</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1526"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1569"/>
         <source>First File</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1527"/>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1543"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1570"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1586"/>
         <source>Jump to first file</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1530"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1573"/>
         <source>Last File</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1531"/>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1547"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1574"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1590"/>
         <source>Jump to the end of the current folder</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1534"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1577"/>
         <source>Skip Previous Images</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1535"/>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1551"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1578"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1594"/>
         <source>Jumps 10 images before the current image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1538"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1581"/>
         <source>Skip Next Images</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1539"/>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1555"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1582"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1598"/>
         <source>Jumps 10 images after the current image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1542"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1585"/>
         <source>First File Sync</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1546"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1589"/>
         <source>Last File Sync</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1550"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1593"/>
         <source>Skip Previous Images Sync</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1554"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1597"/>
         <source>Skip Next Images Sync</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1558"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1601"/>
         <source>Delete File Silent</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1559"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1602"/>
         <source>Deletes a file without warning</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1562"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1605"/>
         <source>Star Rating 0</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1563"/>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1567"/>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1571"/>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1575"/>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1579"/>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1583"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1606"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1610"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1614"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1618"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1622"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1626"/>
         <source>Star rating which is saved to an image&apos;s metadata</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1566"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1609"/>
         <source>Star Rating 1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1570"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1613"/>
         <source>Star Rating 2</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1574"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1617"/>
         <source>Star Rating 3</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1578"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1621"/>
         <source>Star Rating 4</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1582"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1625"/>
         <source>Star Rating 5</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1586"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1629"/>
         <source>Pan Image Up</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1587"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1630"/>
         <source>Pans the image up if zoomed.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1590"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1633"/>
         <source>Pan Image Down</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1591"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1634"/>
         <source>Pans the image down if zoomed.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1594"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1637"/>
         <source>Pan Image Left</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1595"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1638"/>
         <source>Pans the image left if zoomed.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1598"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1641"/>
         <source>Pan Image Right</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1599"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1642"/>
         <source>Pans the image right if zoomed.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkImageContainer.cpp" line="140"/>
-        <location filename="../../src/DkCore/DkImageContainer.cpp" line="149"/>
+        <location filename="../../src/DkCore/DkImageContainer.cpp" line="145"/>
         <source>Cropped</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulators.cpp" line="84"/>
+        <location filename="../../src/DkCore/DkManipulators.cpp" line="89"/>
         <source>&amp;Grayscale</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulators.cpp" line="85"/>
+        <location filename="../../src/DkCore/DkManipulators.cpp" line="90"/>
         <source>Convert to Grayscale</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulators.cpp" line="89"/>
+        <location filename="../../src/DkCore/DkManipulators.cpp" line="94"/>
         <source>&amp;Auto Adjust</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulators.cpp" line="91"/>
+        <location filename="../../src/DkCore/DkManipulators.cpp" line="96"/>
         <source>Auto Adjust Image Contrast and Color Balance</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulators.cpp" line="95"/>
+        <location filename="../../src/DkCore/DkManipulators.cpp" line="100"/>
         <source>Nor&amp;malize Image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulators.cpp" line="97"/>
+        <location filename="../../src/DkCore/DkManipulators.cpp" line="102"/>
         <source>Normalize the Image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulators.cpp" line="101"/>
+        <location filename="../../src/DkCore/DkManipulators.cpp" line="106"/>
         <source>Flip &amp;Horizontal</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulators.cpp" line="102"/>
+        <location filename="../../src/DkCore/DkManipulators.cpp" line="107"/>
         <source>Flip Image Horizontally</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulators.cpp" line="106"/>
+        <location filename="../../src/DkCore/DkManipulators.cpp" line="111"/>
         <source>Flip &amp;Vertical</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulators.cpp" line="107"/>
+        <location filename="../../src/DkCore/DkManipulators.cpp" line="112"/>
         <source>Flip Image Vertically</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulators.cpp" line="111"/>
+        <location filename="../../src/DkCore/DkManipulators.cpp" line="116"/>
         <source>&amp;Invert Image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulators.cpp" line="112"/>
+        <location filename="../../src/DkCore/DkManipulators.cpp" line="117"/>
         <source>Invert the Image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulators.cpp" line="117"/>
+        <location filename="../../src/DkCore/DkManipulators.cpp" line="122"/>
         <source>&amp;Tiny Planet...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulators.cpp" line="118"/>
+        <location filename="../../src/DkCore/DkManipulators.cpp" line="123"/>
         <source>Create a Tiny Planet</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulators.cpp" line="122"/>
+        <location filename="../../src/DkCore/DkManipulators.cpp" line="127"/>
         <source>&amp;Background Color...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulators.cpp" line="123"/>
+        <location filename="../../src/DkCore/DkManipulators.cpp" line="128"/>
         <source>Add a background color</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulators.cpp" line="127"/>
+        <location filename="../../src/DkCore/DkManipulators.cpp" line="132"/>
         <source>&amp;Blur...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulators.cpp" line="128"/>
+        <location filename="../../src/DkCore/DkManipulators.cpp" line="133"/>
         <source>Blur the image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulators.cpp" line="132"/>
+        <location filename="../../src/DkCore/DkManipulators.cpp" line="137"/>
         <source>&amp;Sharpen...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulators.cpp" line="133"/>
+        <location filename="../../src/DkCore/DkManipulators.cpp" line="138"/>
         <source>Sharpens the image by applying an unsharp mask</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulators.cpp" line="137"/>
+        <location filename="../../src/DkCore/DkManipulators.cpp" line="142"/>
         <source>&amp;Rotate...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulators.cpp" line="138"/>
+        <location filename="../../src/DkCore/DkManipulators.cpp" line="143"/>
         <source>Rotate the image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulators.cpp" line="142"/>
+        <location filename="../../src/DkCore/DkManipulators.cpp" line="147"/>
         <source>&amp;Resize...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulators.cpp" line="143"/>
+        <location filename="../../src/DkCore/DkManipulators.cpp" line="148"/>
         <source>Resize the image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulators.cpp" line="147"/>
+        <location filename="../../src/DkCore/DkManipulators.cpp" line="152"/>
         <source>&amp;Threshold...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulators.cpp" line="148"/>
+        <location filename="../../src/DkCore/DkManipulators.cpp" line="153"/>
         <source>Threshold the image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulators.cpp" line="152"/>
+        <location filename="../../src/DkCore/DkManipulators.cpp" line="157"/>
         <source>&amp;Hue/Saturation...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulators.cpp" line="153"/>
+        <location filename="../../src/DkCore/DkManipulators.cpp" line="158"/>
         <source>Change Hue and Saturation</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulators.cpp" line="157"/>
+        <location filename="../../src/DkCore/DkManipulators.cpp" line="162"/>
         <source>&amp;Exposure...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulators.cpp" line="158"/>
+        <location filename="../../src/DkCore/DkManipulators.cpp" line="163"/>
         <source>Change the Exposure and Gamma</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulatorsIpl.cpp" line="54"/>
+        <location filename="../../src/DkCore/DkManipulatorsIpl.cpp" line="58"/>
         <source>Could not convert to grayscale</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulatorsIpl.cpp" line="71"/>
+        <location filename="../../src/DkCore/DkManipulatorsIpl.cpp" line="78"/>
         <source>Cannot auto adjust</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulatorsIpl.cpp" line="89"/>
+        <location filename="../../src/DkCore/DkManipulatorsIpl.cpp" line="99"/>
         <source>The Image is Already Normalized...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulatorsIpl.cpp" line="104"/>
+        <location filename="../../src/DkCore/DkManipulatorsIpl.cpp" line="117"/>
         <source>Cannot invert image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulatorsIpl.cpp" line="117"/>
-        <location filename="../../src/DkCore/DkManipulatorsIpl.cpp" line="129"/>
+        <location filename="../../src/DkCore/DkManipulatorsIpl.cpp" line="133"/>
+        <location filename="../../src/DkCore/DkManipulatorsIpl.cpp" line="149"/>
         <source>Cannot flip image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulatorsIpl.cpp" line="152"/>
+        <location filename="../../src/DkCore/DkManipulatorsIpl.cpp" line="175"/>
         <source>Sorry, I could not create a tiny planet</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulatorsIpl.cpp" line="208"/>
+        <location filename="../../src/DkCore/DkManipulatorsIpl.cpp" line="236"/>
         <source>Cannot blur image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulatorsIpl.cpp" line="236"/>
+        <location filename="../../src/DkCore/DkManipulatorsIpl.cpp" line="268"/>
         <source>Cannot sharpen image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulatorsIpl.cpp" line="274"/>
+        <location filename="../../src/DkCore/DkManipulatorsIpl.cpp" line="312"/>
         <source>Cannot rotate image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulatorsIpl.cpp" line="303"/>
+        <location filename="../../src/DkCore/DkManipulatorsIpl.cpp" line="345"/>
         <source>Cannot resize image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulatorsIpl.cpp" line="344"/>
+        <location filename="../../src/DkCore/DkManipulatorsIpl.cpp" line="394"/>
         <source>Cannot threshold image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulatorsIpl.cpp" line="382"/>
+        <location filename="../../src/DkCore/DkManipulatorsIpl.cpp" line="438"/>
         <source>Cannot change Hue/Saturation</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulatorsIpl.cpp" line="432"/>
+        <location filename="../../src/DkCore/DkManipulatorsIpl.cpp" line="495"/>
         <source>Cannot apply exposure</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkManipulatorsIpl.cpp" line="484"/>
+        <location filename="../../src/DkCore/DkManipulatorsIpl.cpp" line="553"/>
         <source>Cannot draw background color</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="407"/>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="881"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="479"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="946"/>
         <source>&lt;data too large to display&gt;</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="522"/>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="835"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="587"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="821"/>
         <source>Filename</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="525"/>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="836"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="590"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="822"/>
         <source>Path</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="529"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="594"/>
         <source>Target</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="533"/>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="837"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="598"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="823"/>
         <source>Size</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="537"/>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="540"/>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="543"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="602"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="605"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="608"/>
         <source>Date</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="537"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="602"/>
         <source>Created</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="540"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="605"/>
         <source>Last Modified</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="543"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="608"/>
         <source>Last Read</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="547"/>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="560"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="612"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="625"/>
         <source>Owner</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="551"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="616"/>
         <source>OwnerID</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="555"/>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="574"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="620"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="639"/>
         <source>Group</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="560"/>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="567"/>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="574"/>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="581"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="625"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="632"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="639"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="646"/>
         <source>Permissions</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="567"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="632"/>
         <source>User</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="581"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="646"/>
         <source>Other</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="591"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="656"/>
         <source>File</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1462"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1551"/>
         <source>not defined</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1463"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1552"/>
         <source>manual</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1464"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1553"/>
         <source>normal</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1465"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1554"/>
         <source>aperture priority</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1466"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1555"/>
         <source>shutter priority</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1467"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1556"/>
         <source>program creative</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1468"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1557"/>
         <source>high-speed program</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1469"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1558"/>
         <source>portrait mode</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1470"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1559"/>
         <source>landscape mode</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1473"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1562"/>
         <source>No Flash</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1474"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1563"/>
         <source>Fired</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1475"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1564"/>
         <source>Fired, Return not detected</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1476"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1565"/>
         <source>Fired, Return detected</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1477"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1566"/>
         <source>On, Did not fire</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1478"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1567"/>
         <source>On, Fired</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1479"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1568"/>
         <source>On, Return not detected</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1480"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1569"/>
         <source>On, Return detected</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1481"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1570"/>
         <source>Off, Did not fire</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1482"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1571"/>
         <source>Off, Did not fire, Return not detected</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1483"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1572"/>
         <source>Auto, Did not fire</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1484"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1573"/>
         <source>Auto, Fired</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1485"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1574"/>
         <source>Auto, Fired, Return not detected</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1486"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1575"/>
         <source>Auto, Fired, Return detected</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1487"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1576"/>
         <source>No flash function</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1488"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1577"/>
         <source>Off, No flash function</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1489"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1578"/>
         <source>Fired, Red-eye reduction</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1490"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1579"/>
         <source>Fired, Red-eye reduction, Return not detected</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1491"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1580"/>
         <source>Fired, Red-eye reduction, Return detected</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1492"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1581"/>
         <source>On, Red-eye reduction</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1493"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1582"/>
         <source>On, Red-eye reduction, Return not detected</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1494"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1583"/>
         <source>On, Red-eye reduction, Return detected</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1495"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1584"/>
         <source>Off, Red-eye reduction</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1496"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1585"/>
         <source>Auto, Did not fire, Red-eye reduction</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1497"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1586"/>
         <source>Auto, Fired, Red-eye reduction</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1498"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1587"/>
         <source>Auto, Fired, Red-eye reduction, Return not detected</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1499"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1588"/>
         <source>Auto, Fired, Red-eye reduction, Return detected</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1502"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1591"/>
         <source>Uncompressed</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1503"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1592"/>
         <source>CCITT 1D</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1504"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1593"/>
         <source>T4/Group 3 Fax</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1505"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1594"/>
         <source>T6/Group 4 Fax</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1506"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1595"/>
         <source>LZW</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1507"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1596"/>
         <source>JPEG (old-style)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1508"/>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1512"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1597"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1601"/>
         <source>JPEG</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1509"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1598"/>
         <source>Adobe Deflate</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1510"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1599"/>
         <source>JBIG B&amp;W</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1511"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1600"/>
         <source>JBIG Color</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1513"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1602"/>
         <source>Kodak 262</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1514"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1603"/>
         <source>Next</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1515"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1604"/>
         <source>Sony ARW Compressed</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1516"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1605"/>
         <source>Packed RAW</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1517"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1606"/>
         <source>Samsung SRW Compressed</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1518"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1607"/>
         <source>CCIRLEW</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1519"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1608"/>
         <source>Samsung SRW Compressed 2</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1520"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1609"/>
         <source>PackBits</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1521"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1610"/>
         <source>Thunderscan</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1522"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1611"/>
         <source>Kodak KDC Compressed</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1523"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1612"/>
         <source>IT8CTPAD</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1524"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1613"/>
         <source>IT8LW</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1525"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1614"/>
         <source>IT8MP</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1526"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1615"/>
         <source>IT8BL</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1527"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1616"/>
         <source>PixarFilm</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1528"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1617"/>
         <source>PixarLog</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1529"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1618"/>
         <source>Deflate</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1530"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1619"/>
         <source>DCS</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1531"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1620"/>
         <source>Aperio JPEG 2000 YCbCr</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1532"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1621"/>
         <source>Aperio JPEG 2000 RGB</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1533"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1622"/>
         <source>JBIG</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1534"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1623"/>
         <source>SGILog</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1535"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1624"/>
         <source>SGILog24</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1536"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1625"/>
         <source>JPEG 2000</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1537"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1626"/>
         <source>Nikon NEF Compressed</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1538"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1627"/>
         <source>JBIG2 TIFF FX</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1539"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1628"/>
         <source>Microsoft Document Imaging(MDI) Binary Level Codec</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1540"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1629"/>
         <source>Microsoft Document Imaging(MDI) Progressive Transform Codec</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1541"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1630"/>
         <source>Microsoft Document Imaging(MDI) Vector</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1542"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1631"/>
         <source>ESRI Lerc</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1543"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1632"/>
         <source>Lossy JPEG</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1544"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1633"/>
         <source>LZMA2</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1545"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1634"/>
         <source>Zstd</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1546"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1635"/>
         <source>WebP</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1547"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1636"/>
         <source>PNG</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1548"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1637"/>
         <source>JPEG XR</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1549"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1638"/>
         <source>Kodak DCR Compressed</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMetaData.cpp" line="1550"/>
+        <location filename="../../src/DkCore/DkMetaData.cpp" line="1639"/>
         <source>Pentax PEF Compressed</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkPluginManager.cpp" line="1103"/>
+        <location filename="../../src/DkCore/DkPluginManager.cpp" line="1114"/>
         <source>Plugin Manager</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkPluginManager.cpp" line="1104"/>
+        <location filename="../../src/DkCore/DkPluginManager.cpp" line="1115"/>
         <source>The dll could not be deleted!
 Please restart nomacs and try again.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkPluginManager.cpp" line="1278"/>
+        <location filename="../../src/DkCore/DkPluginManager.cpp" line="1281"/>
         <source>Close plugin</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkPluginManager.cpp" line="1280"/>
+        <location filename="../../src/DkCore/DkPluginManager.cpp" line="1283"/>
         <source>Please close the currently opened plugin.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="82"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="86"/>
         <source>Batch Action</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="128"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="134"/>
         <source>[Transform Batch]</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="276"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="289"/>
         <location filename="../../src/DkCore/DkProcess.cpp" line="415"/>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="544"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="540"/>
         <source>%1 inactive -&gt; skipping</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="318"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="329"/>
         <source>transformed</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="321"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="332"/>
         <source>%1 image transformed.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="324"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="335"/>
         <source>%1 image resized, scale factor: %2%</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="326"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="337"/>
         <source>%1 image resized, new side: %2 px</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="329"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="339"/>
         <source>%1 image transformed and cropped.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="333"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="342"/>
         <source>%1 error, could not transform image.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="366"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="369"/>
         <source>%1 I need to increase the image size, but the option is set to &apos;decrease only&apos; -&gt; skipping.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="370"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="372"/>
         <source>%1 I need to decrease the image size, but the option is set to &apos;increase only&apos; -&gt; skipping.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="374"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="375"/>
         <source>%1 image size matches scale factor -&gt; skipping.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="426"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="425"/>
         <source>%1 %2 applied.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="429"/>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="583"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="427"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="574"/>
         <source>%1 Cannot apply %2.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="435"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="433"/>
         <source>%1 error, could not apply image adjustments.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="443"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="442"/>
         <source>[Adjustment Batch]</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="575"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="566"/>
         <source>%1 Cannot cast batch plugin %2.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="586"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="576"/>
         <source>%1 illegal plugin interface: %2</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="589"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="578"/>
         <source>%1 Cannot apply plugin because it is NULL.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="593"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="582"/>
         <source>%1 error, could not apply plugins.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="597"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="585"/>
         <source>%1 plugins applied.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="603"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="592"/>
         <source>[Plugin Batch]</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="716"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="703"/>
         <source>%1 already exists -&gt; skipping (check &apos;overwrite&apos; if you want to overwrite the file)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="721"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="707"/>
         <source>Error: input file does not exist</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="722"/>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="895"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="708"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="873"/>
         <source>Input: %1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="727"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="712"/>
         <source>Skipping: nothing to do here.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="766"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="749"/>
         <source>processing %1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="771"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="754"/>
         <source>Error while loading...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="779"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="761"/>
         <source>Error: cannot process a NULL function.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="785"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="767"/>
         <source>%1 failed</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="800"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="782"/>
         <source>%1 not saved - option &apos;Do not Save&apos; is checked...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="806"/>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="839"/>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="902"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="788"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="820"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="879"/>
         <source>Original filename added to Exif</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="810"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="792"/>
         <source>%1 saved...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="813"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="794"/>
         <source>Could not save: %1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="828"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="809"/>
         <source>Error: could not rename file, the target file exists already.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="844"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="825"/>
         <source>Error: could not rename file</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="849"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="829"/>
         <source>Renaming: %1 -&gt; %2</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="878"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="856"/>
         <source>I should copy the file, but &apos;Do not Save&apos; is checked - so I will do nothing...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="894"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="872"/>
         <source>Error: could not copy file</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="896"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="874"/>
         <source>Output: %1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="904"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="881"/>
         <source>Copying: %1 -&gt; %2</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="923"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="899"/>
         <source>Error: back-up (%1) file already exists</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="931"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="907"/>
         <source>Error: could not rename existing file to %1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="949"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="925"/>
         <source>Error: could not delete existing file</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="960"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="935"/>
         <source>Ui - a lot of things went wrong. Your original file can be found here: %1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="965"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="939"/>
         <source>I could not save to %1 so I restored the original file.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="981"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="955"/>
         <source>%1 deleted.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="984"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="958"/>
         <source>I could not delete %1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="989"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="962"/>
         <source>I did not delete the original because I detected %1 failure(s).</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSettings.cpp" line="1082"/>
+        <location filename="../../src/DkCore/DkSettings.cpp" line="1107"/>
         <source>Image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSettings.cpp" line="1104"/>
+        <location filename="../../src/DkCore/DkSettings.cpp" line="1128"/>
         <source>nomacs - Image Lounge is a lightweight image viewer.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkUtils.cpp" line="789"/>
+        <location filename="../../src/DkCore/DkUtils.cpp" line="763"/>
         <source>Binary</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkUtils.cpp" line="790"/>
+        <location filename="../../src/DkCore/DkUtils.cpp" line="766"/>
         <source>Indexed 8-bit</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkUtils.cpp" line="796"/>
+        <location filename="../../src/DkCore/DkUtils.cpp" line="772"/>
         <source>RGB 32-bit</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkUtils.cpp" line="802"/>
+        <location filename="../../src/DkCore/DkUtils.cpp" line="778"/>
         <source>ARGB 32-bit</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkUtils.cpp" line="805"/>
+        <location filename="../../src/DkCore/DkUtils.cpp" line="783"/>
         <source>RGB 16-bit</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkUtils.cpp" line="808"/>
+        <location filename="../../src/DkCore/DkUtils.cpp" line="788"/>
         <source>ARGB 24-bit</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkUtils.cpp" line="810"/>
+        <location filename="../../src/DkCore/DkUtils.cpp" line="792"/>
         <source>RGB 24-bit</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkUtils.cpp" line="811"/>
+        <location filename="../../src/DkCore/DkUtils.cpp" line="795"/>
         <source>ARGB 16-bit</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkUtils.cpp" line="814"/>
+        <location filename="../../src/DkCore/DkUtils.cpp" line="799"/>
         <source>BGR 32-bit</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkUtils.cpp" line="815"/>
+        <location filename="../../src/DkCore/DkUtils.cpp" line="802"/>
         <source>ABGR 32-bit</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkUtils.cpp" line="816"/>
+        <location filename="../../src/DkCore/DkUtils.cpp" line="805"/>
         <source>Grayscale 8-bit</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkUtils.cpp" line="817"/>
+        <location filename="../../src/DkCore/DkUtils.cpp" line="808"/>
         <source>Alpha 8-bit</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="232"/>
+        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="231"/>
         <source>New Tab</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="235"/>
+        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="234"/>
         <source>Thumbnail Preview</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="237"/>
+        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="236"/>
         <source>Recent Files</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="239"/>
+        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="238"/>
         <source>Settings</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="241"/>
+        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="240"/>
         <source>Batch</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="243"/>
-        <source>Crop</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../../src/DkGui/DkPong.h" line="88"/>
+        <location filename="../../src/DkGui/DkPong.h" line="89"/>
         <source>Player 1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPong.h" line="89"/>
+        <location filename="../../src/DkGui/DkPong.h" line="90"/>
         <source>Player 2</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPong.h" line="99"/>
+        <location filename="../../src/DkGui/DkPong.h" line="100"/>
         <source>Anonymous</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkToolbars.cpp" line="881"/>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="1174"/>
         <source>Edit ToolBar</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkToolbars.cpp" line="925"/>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="1218"/>
         <source>Movie ToolBar</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/main.cpp" line="117"/>
+        <location filename="../../src/main.cpp" line="118"/>
         <source>An input image.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/main.cpp" line="120"/>
+        <location filename="../../src/main.cpp" line="123"/>
         <source>Start in fullscreen.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/main.cpp" line="123"/>
+        <location filename="../../src/main.cpp" line="126"/>
         <source>Start slideshow playback</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/main.cpp" line="126"/>
+        <location filename="../../src/main.cpp" line="129"/>
         <source>Start Pong.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/main.cpp" line="129"/>
+        <location filename="../../src/main.cpp" line="134"/>
         <source>Start in private mode.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/main.cpp" line="133"/>
+        <location filename="../../src/main.cpp" line="139"/>
         <source>Set the viewing mode &lt;mode&gt;.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/main.cpp" line="134"/>
+        <location filename="../../src/main.cpp" line="140"/>
         <source>default | frameless | pseudocolor</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/main.cpp" line="138"/>
+        <location filename="../../src/main.cpp" line="145"/>
         <source>Load all files of a &lt;directory&gt;.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/main.cpp" line="139"/>
+        <location filename="../../src/main.cpp" line="146"/>
         <source>directory</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/main.cpp" line="143"/>
+        <location filename="../../src/main.cpp" line="151"/>
         <source>Load &lt;images&gt; to tabs.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/main.cpp" line="144"/>
+        <location filename="../../src/main.cpp" line="152"/>
         <source>images</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/main.cpp" line="148"/>
+        <location filename="../../src/main.cpp" line="155"/>
         <source>Batch processing of &lt;batch-settings.pnm&gt;.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/main.cpp" line="149"/>
+        <location filename="../../src/main.cpp" line="155"/>
         <source>batch-settings-path</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/main.cpp" line="153"/>
+        <location filename="../../src/main.cpp" line="158"/>
         <source>Saves batch log to &lt;log-path.txt&gt;.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/main.cpp" line="154"/>
+        <location filename="../../src/main.cpp" line="158"/>
         <source>log-path.txt</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/main.cpp" line="158"/>
+        <location filename="../../src/main.cpp" line="162"/>
         <source>Imports the settings from &lt;settings-path.ini&gt; and saves them.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/main.cpp" line="159"/>
+        <location filename="../../src/main.cpp" line="163"/>
         <source>settings-path.ini</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/main.cpp" line="162"/>
+        <location filename="../../src/main.cpp" line="166"/>
         <source>Register file associations (Windows only).</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/main.cpp" line="332"/>
+        <location filename="../../src/main.cpp" line="322"/>
         <source>Critical Error</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/main.cpp" line="333"/>
+        <location filename="../../src/main.cpp" line="322"/>
         <source>Sorry, nomacs ran out of memory...</source>
         <translation type="unfinished"></translation>
     </message>
@@ -2700,27 +2603,27 @@ Please restart nomacs and try again.</source>
 <context>
     <name>QObject::QObject</name>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1514"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1557"/>
         <source>Lena</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1515"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1558"/>
         <source>Show test image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1518"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1561"/>
         <source>All Images</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1519"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1562"/>
         <source>Generates all images in the world</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkActionManager.cpp" line="1522"/>
+        <location filename="../../src/DkCore/DkActionManager.cpp" line="1565"/>
         <source>Pong</source>
         <translation type="unfinished"></translation>
     </message>
@@ -2728,123 +2631,123 @@ Please restart nomacs and try again.</source>
 <context>
     <name>nmc::DkAdvancedPreference</name>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1348"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1344"/>
         <source>Always Load JPG if Embedded</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1349"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1345"/>
         <source>Load JPG if it Fits the Screen Resolution</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1350"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1346"/>
         <source>Always Load RAW Data</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1361"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1357"/>
         <source>Apply Noise Filtering to RAW Images</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1363"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1359"/>
         <source>If checked, a noise filter is applied which reduced color noise</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1366"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1362"/>
         <source>RAW Loader Settings</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1374"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1370"/>
         <source>Ask to Save Deleted Files</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1376"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1372"/>
         <source>If checked, nomacs asks to save files which were deleted by other applications</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1379"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1375"/>
         <source>Ignore Exif Orientation when Loading</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1381"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1377"/>
         <source>If checked, images are NOT rotated with respect to their Exif orientation</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1384"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1380"/>
         <source>Save Exif Orientation</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1386"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1382"/>
         <source>If checked, orientation is written to the Exif rather than rotating the image Matrix
 </source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1387"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1383"/>
         <source>NOTE: this allows for rotating JPGs without losing information.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1390"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1386"/>
         <source>File Loading/Saving</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1398"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1394"/>
         <source>Choose the number of Threads in the thread pool</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1403"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1399"/>
         <source>Number of Threads</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1407"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1403"/>
         <source>Enable Native File Dialogs</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1409"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1405"/>
         <source>If checked, native system dialogs are used for opening/saving files.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1412"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1408"/>
         <source>Native Dialogs</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1416"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1412"/>
         <source>Use Log File</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1418"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1414"/>
         <source>If checked, a log file will be created.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1421"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1417"/>
         <source>Open Log</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1429"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1425"/>
         <source>Logging</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1477"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1472"/>
         <source>Please Restart nomacs to apply changes</source>
         <translation type="unfinished"></translation>
     </message>
@@ -2852,42 +2755,42 @@ Please restart nomacs and try again.</source>
 <context>
     <name>nmc::DkAppManagerDialog</name>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="485"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="482"/>
         <source>Manage Applications</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="508"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="505"/>
         <source>&amp;Run</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="511"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="508"/>
         <source>&amp;Add</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="514"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="511"/>
         <source>&amp;Delete</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="520"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="517"/>
         <source>&amp;OK</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="521"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="518"/>
         <source>&amp;Cancel</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="553"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="550"/>
         <source>Executable Files (*.exe);;</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="563"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="556"/>
         <source>Open Application</source>
         <translation type="unfinished"></translation>
     </message>
@@ -2895,84 +2798,84 @@ Please restart nomacs and try again.</source>
 <context>
     <name>nmc::DkArchiveExtractionDialog</name>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="3812"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="3709"/>
         <source>Extract images from an archive</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="3821"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="3718"/>
         <source>Archive (%1)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="3828"/>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="3837"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="3725"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="3734"/>
         <source>&amp;Browse</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="3832"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="3729"/>
         <source>Extract to</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="3845"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="3742"/>
         <source>Remove Subfolders</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="3851"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="3748"/>
         <source>&amp;Extract</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="3853"/>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="4083"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="3750"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="3968"/>
         <source>&amp;Cancel</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="3933"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="3827"/>
         <source>Open Archive</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="3935"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="3829"/>
         <source>Archives (%1)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="3951"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="3843"/>
         <source>Open Directory</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="3987"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="3878"/>
         <source>Not a valid archive.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="4016"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="3904"/>
         <source>Number of images: </source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="4018"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="3906"/>
         <source>The archive does not contain any images.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="4043"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="3929"/>
         <source>The images could not be extracted!</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="4085"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="3970"/>
         <source>Extracting files...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="4094"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="3979"/>
         <source>Extracting file %1 of %2</source>
         <translation type="unfinished"></translation>
     </message>
@@ -2980,13 +2883,13 @@ Please restart nomacs and try again.</source>
 <context>
     <name>nmc::DkBasicLoader</name>
     <message>
-        <location filename="../../src/DkCore/DkBasicLoader.cpp" line="346"/>
-        <location filename="../../src/DkCore/DkBasicLoader.cpp" line="1033"/>
+        <location filename="../../src/DkCore/DkBasicLoader.cpp" line="379"/>
+        <location filename="../../src/DkCore/DkBasicLoader.cpp" line="1187"/>
         <source>Original Image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkBasicLoader.cpp" line="1191"/>
+        <location filename="../../src/DkCore/DkBasicLoader.cpp" line="1354"/>
         <source>Sorry, I could not save: %1</source>
         <translation type="unfinished"></translation>
     </message>
@@ -2994,7 +2897,7 @@ Please restart nomacs and try again.</source>
 <context>
     <name>nmc::DkBatchButtonsWidget</name>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2268"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2295"/>
         <source>Start/Cancel Batch Processing (%1)</source>
         <translation type="unfinished"></translation>
     </message>
@@ -3002,22 +2905,22 @@ Please restart nomacs and try again.</source>
 <context>
     <name>nmc::DkBatchInput</name>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="350"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="352"/>
         <source>File Explorer</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="362"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="364"/>
         <source>Thumbnails</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="363"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="365"/>
         <source>File List</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="415"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="419"/>
         <source>Open an Image Directory</source>
         <translation type="unfinished"></translation>
     </message>
@@ -3037,8 +2940,8 @@ Please restart nomacs and try again.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="510"/>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="524"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="509"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="523"/>
         <source>Results</source>
         <translation type="unfinished"></translation>
     </message>
@@ -3046,17 +2949,17 @@ Please restart nomacs and try again.</source>
 <context>
     <name>nmc::DkBatchManipulatorWidget</name>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="1765"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="1791"/>
         <source>Select Image Adjustments</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="1989"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2014"/>
         <source>inactive</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="1991"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2016"/>
         <source>%1 manipulators selected</source>
         <translation type="unfinished"></translation>
     </message>
@@ -3064,120 +2967,120 @@ Please restart nomacs and try again.</source>
 <context>
     <name>nmc::DkBatchOutput</name>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="752"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="762"/>
         <source>Output Directory</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="755"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="765"/>
         <source>Browse</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="757"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="767"/>
         <source>Select a Directory</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="762"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="772"/>
         <source>Overwrite Existing Files</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="763"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="773"/>
         <source>If checked, existing files are overwritten.
 This option might destroy your images - so be careful!</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="767"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="777"/>
         <source>Do not Save Output Images</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="768"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="778"/>
         <source>If checked, output images are not saved at all.
 This option is only useful if plugins save sidecar files - so be careful!</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="772"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="782"/>
         <source>Use Input Folder</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="773"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="783"/>
         <source>If checked, the batch is applied to the input folder - so be careful!</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="777"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="787"/>
         <source>Delete Input Files</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="778"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="788"/>
         <source>If checked, the original file will be deleted if the conversion was successful.
  So be careful!</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="796"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="806"/>
         <source>Filename</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="817"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="827"/>
         <source>Keep Extension</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="818"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="828"/>
         <source>Convert To</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="828"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="885"/>
         <source>Best Quality</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="829"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="885"/>
         <source>High Quality</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="830"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="885"/>
         <source>Medium Quality</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="831"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="885"/>
         <source>Low Quality</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="832"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="885"/>
         <source>Bad Quality</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="842"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="847"/>
         <source>Preview</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="845"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="850"/>
         <source>Old Filename: </source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="850"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="855"/>
         <source>New Filename: </source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="885"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="923"/>
         <source>Open an Image Directory</source>
         <translation type="unfinished"></translation>
     </message>
@@ -3185,22 +3088,22 @@ This option is only useful if plugins save sidecar files - so be careful!</sourc
 <context>
     <name>nmc::DkBatchPluginWidget</name>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="1504"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="1534"/>
         <source>Select Plugins</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="1674"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="1703"/>
         <source> Settings</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="1749"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="1774"/>
         <source>inactive</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="1751"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="1776"/>
         <source>%1 plugins selected</source>
         <translation type="unfinished"></translation>
     </message>
@@ -3208,12 +3111,12 @@ This option is only useful if plugins save sidecar files - so be careful!</sourc
 <context>
     <name>nmc::DkBatchProcessing</name>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="1255"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="1218"/>
         <source>[OK]</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkProcess.cpp" line="1257"/>
+        <location filename="../../src/DkCore/DkProcess.cpp" line="1220"/>
         <source>[FAIL]</source>
         <translation type="unfinished"></translation>
     </message>
@@ -3221,122 +3124,122 @@ This option is only useful if plugins save sidecar files - so be careful!</sourc
 <context>
     <name>nmc::DkBatchTransformWidget</name>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2005"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2030"/>
         <source>Resize</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2010"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2035"/>
         <source>Percent</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2010"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2035"/>
         <source>Long Side</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2010"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2035"/>
         <source>Short Side</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2010"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2035"/>
         <source>Width</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2010"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2035"/>
         <source>Height</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2014"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2039"/>
         <source>%</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2019"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2044"/>
         <source> px</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2025"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2050"/>
         <source>Transform All</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2025"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2050"/>
         <source>Shrink Only</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2025"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2050"/>
         <source>Enlarge Only</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2039"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2064"/>
         <source>Orientation</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2042"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2067"/>
         <source>Do &amp;Not Rotate</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2044"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2069"/>
         <source>90%1 Counter Clockwise</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2045"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2070"/>
         <source>90%1 Clockwise</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2046"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2071"/>
         <source>180%1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2055"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2080"/>
         <source>Transformations</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2058"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2083"/>
         <source>&amp;Crop from Metadata</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2061"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2086"/>
         <source>&amp;Crop Rectangle</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2124"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2146"/>
         <source>inactive</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2130"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2151"/>
         <source>Resize by: %1%</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2134"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2155"/>
         <source>Resize %1 to: %2 px</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2140"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2161"/>
         <source>Rotating by: %1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2146"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2167"/>
         <source>Crop</source>
         <translation type="unfinished"></translation>
     </message>
@@ -3344,136 +3247,136 @@ This option is only useful if plugins save sidecar files - so be careful!</sourc
 <context>
     <name>nmc::DkBatchWidget</name>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2360"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2399"/>
         <source>next</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2365"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2404"/>
         <source>previous</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2386"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2425"/>
         <source>Input</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2386"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2425"/>
         <source>no files selected</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2391"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2430"/>
         <source>Adjustments</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2391"/>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2394"/>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2398"/>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2406"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2430"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2433"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2437"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2445"/>
         <source>inactive</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2394"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2433"/>
         <source>Transform</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2398"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2437"/>
         <source>Plugins</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2402"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2441"/>
         <source>Output</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2402"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2441"/>
         <source>not set</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2406"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2445"/>
         <source>Profiles</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2587"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2626"/>
         <source>Please select files for processing.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2594"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2633"/>
         <source>I am missing a widget.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2608"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2645"/>
         <source>Please check &apos;Overwrite Existing Files&apos; or choose a different output directory.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2629"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2664"/>
         <source>Create Output Directory</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2630"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2665"/>
         <source>Should I create:
 %1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2647"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2681"/>
         <source>Please select an output directory.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2652"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2685"/>
         <source>Sorry, I cannot create %1.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2657"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2689"/>
         <source>Sorry, I cannot find files to process.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2662"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2693"/>
         <source>Sorry, the file pattern is empty.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2672"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2703"/>
         <source>Sorry, I cannot start processing - please check the configuration.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2714"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2746"/>
         <source>Canceling...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2768"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2799"/>
         <source>%1/%2 files processed... %3 failed.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2794"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2825"/>
         <source>Batch Log</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2865"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2894"/>
         <source>Error</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="2865"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="2894"/>
         <source>Sorry, I cannot save the settings...</source>
         <translation type="unfinished"></translation>
     </message>
@@ -3481,7 +3384,7 @@ This option is only useful if plugins save sidecar files - so be careful!</sourc
 <context>
     <name>nmc::DkBlurWidget</name>
     <message>
-        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="306"/>
+        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="318"/>
         <source>Sigma</source>
         <translation type="unfinished"></translation>
     </message>
@@ -3489,12 +3392,12 @@ This option is only useful if plugins save sidecar files - so be careful!</sourc
 <context>
     <name>nmc::DkBrowseExplorer</name>
     <message>
-        <location filename="../../src/DkGui/DkWidgets.cpp" line="425"/>
+        <location filename="../../src/DkGui/DkWidgets.cpp" line="418"/>
         <source>Choose Root Directory</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkWidgets.cpp" line="448"/>
+        <location filename="../../src/DkGui/DkWidgets.cpp" line="438"/>
         <source>Browse</source>
         <translation type="unfinished"></translation>
     </message>
@@ -3502,77 +3405,77 @@ This option is only useful if plugins save sidecar files - so be careful!</sourc
 <context>
     <name>nmc::DkCentralWidget</name>
     <message>
-        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="289"/>
+        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="290"/>
         <source>Go to Tab</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="289"/>
+        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="290"/>
         <source>Go to tab number: </source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="518"/>
+        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="529"/>
         <source>General</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="524"/>
+        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="535"/>
         <source>Display</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="530"/>
+        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="541"/>
         <source>File</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="536"/>
+        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="547"/>
         <source>File Associations</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="542"/>
+        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="553"/>
         <source>Advanced</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="548"/>
+        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="559"/>
         <source>Editor</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="1265"/>
+        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="1181"/>
         <source>I could not load &quot;%1&quot;</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="1320"/>
+        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="1233"/>
         <source>Unable to load file &quot;%1&quot;</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="1328"/>
+        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="1239"/>
         <source>&quot;%1&quot; cannot be loaded</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="1338"/>
+        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="1247"/>
         <source>downloading &quot;%1&quot;</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="1362"/>
+        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="1270"/>
         <source>Sorry, I could not drop the content.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="1484"/>
+        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="1381"/>
         <source>Save File</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="1497"/>
+        <location filename="../../src/DkGui/DkCentralWidget.cpp" line="1392"/>
         <source>%1 vec files merged</source>
         <translation type="unfinished"></translation>
     </message>
@@ -3580,17 +3483,17 @@ This option is only useful if plugins save sidecar files - so be careful!</sourc
 <context>
     <name>nmc::DkChooseMonitorDialog</name>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="4423"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="4315"/>
         <source>Remember Monitor Settings</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="4427"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="4319"/>
         <source>&amp;OK</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="4428"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="4320"/>
         <source>&amp;Cancel</source>
         <translation type="unfinished"></translation>
     </message>
@@ -3598,12 +3501,12 @@ This option is only useful if plugins save sidecar files - so be careful!</sourc
 <context>
     <name>nmc::DkClientManager</name>
     <message>
-        <location filename="../../src/DkGui/DkNetwork.cpp" line="239"/>
+        <location filename="../../src/DkGui/DkNetwork.cpp" line="273"/>
         <source>connected with: </source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNetwork.cpp" line="242"/>
+        <location filename="../../src/DkGui/DkNetwork.cpp" line="275"/>
         <source>disconnected with: </source>
         <translation type="unfinished"></translation>
     </message>
@@ -3611,7 +3514,7 @@ This option is only useful if plugins save sidecar files - so be careful!</sourc
 <context>
     <name>nmc::DkColorChooser</name>
     <message>
-        <location filename="../../src/DkCore/DkBasicWidgets.cpp" line="362"/>
+        <location filename="../../src/DkCore/DkBasicWidgets.cpp" line="373"/>
         <source>Reset</source>
         <translation type="unfinished"></translation>
     </message>
@@ -3619,7 +3522,7 @@ This option is only useful if plugins save sidecar files - so be careful!</sourc
 <context>
     <name>nmc::DkColorSlider</name>
     <message>
-        <location filename="../../src/DkGui/DkToolbars.cpp" line="117"/>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="120"/>
         <source>Drag the slider downwards for elimination</source>
         <translation type="unfinished"></translation>
     </message>
@@ -3627,7 +3530,7 @@ This option is only useful if plugins save sidecar files - so be careful!</sourc
 <context>
     <name>nmc::DkCommentTextEdit</name>
     <message>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="1182"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="1154"/>
         <source>Click here to add notes</source>
         <translation type="unfinished"></translation>
     </message>
@@ -3635,40 +3538,45 @@ This option is only useful if plugins save sidecar files - so be careful!</sourc
 <context>
     <name>nmc::DkCommentWidget</name>
     <message>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="1201"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="1174"/>
         <source>NOTES</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="1215"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="1189"/>
         <source>Enter your notes here. They will be saved to the image metadata.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="1221"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="1195"/>
         <source>Save Note (CTRL + ENTER)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="1228"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="1202"/>
         <source>Discard Changes (ESC)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="1269"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="1256"/>
         <source>Sorry, I cannot save comments for this image format.</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="1262"/>
+        <source>File comment</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>nmc::DkCompressDialog</name>
     <message>
-        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="176"/>
+        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="177"/>
         <source>JPG Settings</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="178"/>
+        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="179"/>
         <source>J2K Settings</source>
         <translation type="unfinished"></translation>
     </message>
@@ -3678,97 +3586,102 @@ This option is only useful if plugins save sidecar files - so be careful!</sourc
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="199"/>
+        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="195"/>
         <source>AVIF Settings</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="211"/>
+        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="205"/>
+        <source>JXL Settings</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="213"/>
         <source>Save for Web</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="224"/>
+        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="225"/>
         <source>Original</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="226"/>
+        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="227"/>
         <source>New</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="247"/>
+        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="248"/>
         <source>Small  (800 x 600)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="248"/>
+        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="249"/>
         <source>Medium (1024 x 786)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="249"/>
+        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="250"/>
         <source>Large  (1920 x 1080)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="250"/>
+        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="251"/>
         <source>Original Size</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="255"/>
+        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="256"/>
         <source>Best Quality</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="256"/>
+        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="257"/>
         <source>High Quality</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="257"/>
+        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="258"/>
         <source>Medium Quality</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="258"/>
+        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="259"/>
         <source>Low Quality</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="259"/>
+        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="260"/>
         <source>Bad Quality</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="264"/>
+        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="265"/>
         <source>Lossless Compression</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="271"/>
+        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="272"/>
         <source>Background Color</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="294"/>
+        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="295"/>
         <source>&amp;Cancel</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="297"/>
+        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="298"/>
         <source>&amp;OK</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="417"/>
+        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="418"/>
         <source>File Size: --</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="431"/>
+        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="434"/>
         <source>File Size: ~%1</source>
         <translation type="unfinished"></translation>
     </message>
@@ -3776,20 +3689,121 @@ This option is only useful if plugins save sidecar files - so be careful!</sourc
 <context>
     <name>nmc::DkControlWidget</name>
     <message>
-        <location filename="../../src/DkGui/DkControlWidget.cpp" line="525"/>
+        <location filename="../../src/DkGui/DkControlWidget.cpp" line="333"/>
+        <source>File comment</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../../src/DkGui/DkControlWidget.cpp" line="558"/>
         <source>Closing Plugin</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkControlWidget.cpp" line="526"/>
+        <location filename="../../src/DkGui/DkControlWidget.cpp" line="558"/>
         <source>Apply plugin changes?</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
+<context>
+    <name>nmc::DkCropToolBar</name>
+    <message>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="901"/>
+        <source>Crop (ENTER)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="905"/>
+        <source>Cancel (ESC)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="909"/>
+        <source>Pan</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="923"/>
+        <source>User Defined</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="924"/>
+        <source>No Aspect Ratio</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="932"/>
+        <source>Horizontal Constraint</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="935"/>
+        <source>Swap</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="937"/>
+        <source>Swap Dimensions</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="943"/>
+        <source>Vertical Constraint</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="957"/>
+        <source>Background Color</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="966"/>
+        <source>Guides</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="966"/>
+        <source>Rule of Thirds</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="966"/>
+        <source>Grid</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="970"/>
+        <source>Show Guides in the Preview</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="973"/>
+        <source>Invert Crop Tool Color</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="978"/>
+        <source>Show Info</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="983"/>
+        <source>Crop to Metadata</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>nmc::DkCropWidget</name>
+    <message>
+        <location filename="../../src/DkGui/DkWidgets.cpp" line="2144"/>
+        <source>Crop Toolbar</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
 <context>
     <name>nmc::DkDescriptionEdit</name>
     <message>
-        <location filename="../../src/DkCore/DkPluginManager.cpp" line="996"/>
+        <location filename="../../src/DkCore/DkPluginManager.cpp" line="1009"/>
         <source>No metadata available!</source>
         <translation type="unfinished"></translation>
     </message>
@@ -3797,17 +3811,17 @@ This option is only useful if plugins save sidecar files - so be careful!</sourc
 <context>
     <name>nmc::DkDialogManager</name>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="4145"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="4030"/>
         <source>Preview</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="4160"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="4045"/>
         <source>Shortcuts</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="4200"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="4086"/>
         <source>Mosaic</source>
         <translation type="unfinished"></translation>
     </message>
@@ -3815,12 +3829,12 @@ This option is only useful if plugins save sidecar files - so be careful!</sourc
 <context>
     <name>nmc::DkDirectoryChooser</name>
     <message>
-        <location filename="../../src/DkGui/DkWidgets.cpp" line="2558"/>
+        <location filename="../../src/DkGui/DkWidgets.cpp" line="2625"/>
         <source>...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkWidgets.cpp" line="2574"/>
+        <location filename="../../src/DkGui/DkWidgets.cpp" line="2640"/>
         <source>Open an Image Directory</source>
         <translation type="unfinished"></translation>
     </message>
@@ -3828,197 +3842,197 @@ This option is only useful if plugins save sidecar files - so be careful!</sourc
 <context>
     <name>nmc::DkDisplayPreference</name>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="675"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="682"/>
         <source>Invert mouse wheel behaviour for zooming</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="677"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="684"/>
         <source>If checked, the mouse wheel behaviour is inverted while zooming.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="681"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="688"/>
         <source>Display Images with High Quality Anti Aliasing</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="683"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="690"/>
         <source>NOTE: if checked, nomacs might be slow while zooming.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="687"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="694"/>
         <source>Show Scrollbars when zooming into images</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="689"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="696"/>
         <source>If checked, scrollbars will appear that allow panning with the mouse.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="692"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="699"/>
         <source>Show pixels if zoom level is above</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="696"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="703"/>
         <source>nomacs will not interpolate images if the zoom level is larger.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="704"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="711"/>
         <source>Use Fixed Zoom Levels</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="706"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="713"/>
         <source>If checked, predefined zoom levels are used when zooming.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="713"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="720"/>
         <source>Load Defaults</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="724"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="731"/>
         <source>Zoom</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="736"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="743"/>
         <source>Always keep zoom</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="737"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="744"/>
         <source>Keep zoom if the size is the same</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="738"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="746"/>
         <source>If checked, the zoom level is only kept, if the image loaded has the same level as the previous.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="739"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="747"/>
         <source>Never keep zoom</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="741"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="749"/>
         <source>Always zoom to fit</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="754"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="762"/>
         <source>When Displaying New Images</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="763"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="771"/>
         <source>Define the icon size in pixel.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="769"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="777"/>
         <source>Icon Size</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="773"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="781"/>
         <source>Show Navigation Arrows</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="775"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="783"/>
         <source>If checked, navigation arrows will be displayed on top of the image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="778"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="786"/>
         <source>Navigation</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="783"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="790"/>
         <source>Image Transition</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="788"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="795"/>
         <source>Choose a transition when loading a new image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="792"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="798"/>
         <source>Unknown Transition</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="795"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="802"/>
         <source>Appear</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="796"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="805"/>
         <source>Swipe</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="797"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="808"/>
         <source>Fade</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="806"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="818"/>
         <source>Define the image transition speed.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="813"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="825"/>
         <source>Always Animate Image Loading</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="815"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="827"/>
         <source>If unchecked, loading is only animated if nomacs is fullscreen</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="818"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="830"/>
         <source>Display Time</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="822"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="834"/>
         <source>Define the time an image is displayed.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="829"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="841"/>
         <source>Show Player</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="833"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="845"/>
         <source>Slideshow</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="843"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="855"/>
         <source>Show crop rectangle</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="847"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="859"/>
         <source>Show Metadata Cropping</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="893"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="901"/>
         <source>Please Restart nomacs to apply changes</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4026,22 +4040,22 @@ This option is only useful if plugins save sidecar files - so be careful!</sourc
 <context>
     <name>nmc::DkExplorer</name>
     <message>
-        <location filename="../../src/DkGui/DkWidgets.cpp" line="480"/>
+        <location filename="../../src/DkGui/DkWidgets.cpp" line="471"/>
         <source>Open Image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkWidgets.cpp" line="559"/>
+        <location filename="../../src/DkGui/DkWidgets.cpp" line="554"/>
         <source>Editable</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkWidgets.cpp" line="565"/>
+        <location filename="../../src/DkGui/DkWidgets.cpp" line="560"/>
         <source>Open Selected Image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkWidgets.cpp" line="575"/>
+        <location filename="../../src/DkGui/DkWidgets.cpp" line="570"/>
         <source>Adjust Columns</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4049,83 +4063,83 @@ This option is only useful if plugins save sidecar files - so be careful!</sourc
 <context>
     <name>nmc::DkExportTiffDialog</name>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2438"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2384"/>
         <source>Export Multi-Page TIFF</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2484"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2428"/>
         <source>Multi-Page TIFF:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2487"/>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2496"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2431"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2440"/>
         <source>&amp;Browse</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2490"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2434"/>
         <source>No Multi-Page TIFF loaded</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2493"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2437"/>
         <source>Save Folder:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2499"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2443"/>
         <source>Specify a Save Folder</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2502"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2446"/>
         <source>Filename:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2513"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2457"/>
         <source>Export Pages</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2520"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2464"/>
         <source>Overwrite</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2552"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2496"/>
         <source>&amp;Export</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2553"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2497"/>
         <source>&amp;Cancel</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2572"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2515"/>
         <source>Open TIFF</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2588"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2530"/>
         <source>Open an Image Directory</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2677"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2613"/>
         <source>%1 exists, skipping...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2682"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2618"/>
         <source>Sorry, I could not load page: %1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2690"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2626"/>
         <source>Sorry, I could not save: %1</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4133,17 +4147,17 @@ This option is only useful if plugins save sidecar files - so be careful!</sourc
 <context>
     <name>nmc::DkExposureWidget</name>
     <message>
-        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="587"/>
+        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="633"/>
         <source>Exposure</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="594"/>
+        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="640"/>
         <source>Offset</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="601"/>
+        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="647"/>
         <source>Gamma</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4176,13 +4190,13 @@ This option is only useful if plugins save sidecar files - so be careful!</sourc
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1233"/>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1245"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1232"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1244"/>
         <source>Please Restart nomacs to apply changes</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1312"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1308"/>
         <source>Image</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4190,12 +4204,12 @@ This option is only useful if plugins save sidecar files - so be careful!</sourc
 <context>
     <name>nmc::DkFileInfoLabel</name>
     <message>
-        <location filename="../../src/DkGui/DkWidgets.cpp" line="1206"/>
+        <location filename="../../src/DkGui/DkWidgets.cpp" line="1232"/>
         <source>Info Box</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkWidgets.cpp" line="1207"/>
+        <location filename="../../src/DkGui/DkWidgets.cpp" line="1233"/>
         <source>All information fields are currently hidden.
 Do you want to show them again?</source>
         <translation type="unfinished"></translation>
@@ -4204,97 +4218,97 @@ Do you want to show them again?</source>
 <context>
     <name>nmc::DkFilePreference</name>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1002"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1003"/>
         <source>Screenshots are automatically saved to this folder</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1004"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1005"/>
         <source>Use Temporary Folder</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1019"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1021"/>
         <source>We recommend to set a moderate cache value around 100 MB. [%1-%2 MB]</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1022"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1023"/>
         <source>Maximal Cache Size</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1036"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1038"/>
         <source>We recommend to set a moderate edit history value around 100 MB. [%1-%2 MB]</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1039"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1041"/>
         <source>History Size</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1045"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1047"/>
         <source>Skip Images</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1046"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1048"/>
         <source>Images are skipped until the Next key is released</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1047"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1049"/>
         <source>Wait for Images to be Loaded</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1048"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1050"/>
         <source>The next image is loaded after the current image is shown.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1059"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1061"/>
         <source>Image Loading Policy</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1065"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1067"/>
         <source>Load Saved Images</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1066"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1068"/>
         <source>After saving, the saved image will be loaded in place</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1067"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1069"/>
         <source>Load to Tab</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1068"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1070"/>
         <source>After saving, the saved image will be loaded to a tab.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1069"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1071"/>
         <source>Do Nothing</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1070"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1072"/>
         <source>The saved image will not be loaded.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1078"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1080"/>
         <source>Image Saving Policy</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1093"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="1095"/>
         <source>Number of Skipped Images on PgUp/PgDown</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4302,77 +4316,77 @@ Do you want to show them again?</source>
 <context>
     <name>nmc::DkFilePreview</name>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="199"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="198"/>
         <source>Show Left</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="200"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="199"/>
         <source>Shows the Thumbnail Bar on the Left</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="203"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="202"/>
         <source>Show Top</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="204"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="203"/>
         <source>Shows the Thumbnail Bar at the Top</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="207"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="206"/>
         <source>Show Right</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="208"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="207"/>
         <source>Shows the Thumbnail Bar on the Right</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="211"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="210"/>
         <source>Show Bottom</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="212"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="211"/>
         <source>Shows the Thumbnail Bar at the Bottom</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="215"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="214"/>
         <source>Undock</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="216"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="215"/>
         <source>Undock the thumbnails</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="219"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="218"/>
         <source>File Preview Menu</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="582"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="567"/>
         <source>Name: </source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="583"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="567"/>
         <source>Size: </source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="584"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="568"/>
         <source>Created: </source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="601"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="584"/>
         <source>CTRL+Zoom resizes the thumbnails</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4438,22 +4452,22 @@ Do you want to show them again?</source>
 <context>
     <name>nmc::DkForceThumbDialog</name>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="3710"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="3607"/>
         <source>Overwrite Existing Thumbnails</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="3715"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="3612"/>
         <source>&amp;OK</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="3716"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="3613"/>
         <source>&amp;Cancel</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="3733"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="3629"/>
         <source>Compute thumbnails for all images in:
  %1
 </source>
@@ -4463,208 +4477,208 @@ Do you want to show them again?</source>
 <context>
     <name>nmc::DkGeneralPreference</name>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="301"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="306"/>
         <source>Icon Color</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="306"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="311"/>
         <source>Background Color</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="311"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="316"/>
         <source>Fullscreen Color</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="316"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="321"/>
         <source>Color Settings</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="323"/>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="581"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="328"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="590"/>
         <source>Reset All Settings</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="327"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="332"/>
         <source>&amp;Import Settings</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="331"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="336"/>
         <source>&amp;Export Settings</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="335"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="340"/>
         <source>Default Settings</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="350"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="355"/>
         <source>Show Recent Files on Start-Up</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="352"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="357"/>
         <source>Show the History Panel on Start-Up</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="355"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="360"/>
         <source>Remember Recent Files History</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="357"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="362"/>
         <source>If checked, recent files will be saved.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="360"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="365"/>
         <source>Check for Duplicates on Open</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="362"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="367"/>
         <source>If any files are opened which are already open in a tab, don&apos;t open them again.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="365"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="370"/>
         <source>Show extra options related to tabs</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="367"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="373"/>
         <source>Enables the &quot;Go to Tab&quot;, &quot;First Tab&quot;, and &quot;Last Tab&quot; options in the View menu, and the &quot;Open Tabs&quot; and &quot;Save Tabs&quot; options in the File menu.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="370"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="377"/>
         <source>Loop Images</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="372"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="379"/>
         <source>Start with the first image in a folder after showing the last.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="375"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="382"/>
         <source>Mouse Wheel Zooms</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="377"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="384"/>
         <source>If checked, the mouse wheel zooms - otherwise it is used to switch between images.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="380"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="387"/>
         <source>Next Image on Horizontal Zoom</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="382"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="389"/>
         <source>If checked, horizontal wheel events load the next/previous images.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="385"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="392"/>
         <source>Double Click Opens Fullscreen</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="387"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="394"/>
         <source>If checked, a double click on the canvas opens the fullscreen mode.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="390"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="397"/>
         <source>Show Background Image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="392"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="399"/>
         <source>If checked, the nomacs logo is shown in the bottom right corner.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="395"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="402"/>
         <source>Switch CTRL with ALT</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="397"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="404"/>
         <source>If checked, CTRL + Mouse is switched with ALT + Mouse.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="400"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="407"/>
         <source>Close on ESC</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="402"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="409"/>
         <source>Close nomacs if ESC is pressed.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="405"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="412"/>
         <source>Check For Updates</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="407"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="414"/>
         <source>Check for updates on start-up.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="411"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="418"/>
         <source>General</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="429"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="436"/>
         <source>Choose your preferred language.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="434"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="441"/>
         <source>Info on how to translate nomacs.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="437"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="444"/>
         <source>Language</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="457"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="465"/>
         <source>Please Restart nomacs to apply changes</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="581"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="591"/>
         <source>This will reset all personal settings!</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="595"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="604"/>
         <source>Import Settings</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="615"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="622"/>
         <source>Export Settings</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="639"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="645"/>
         <source>Settings exported</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4672,32 +4686,32 @@ Do you want to show them again?</source>
 <context>
     <name>nmc::DkGenericProfileWidget</name>
     <message>
-        <location filename="../../src/DkGui/DkWidgets.cpp" line="2792"/>
+        <location filename="../../src/DkGui/DkWidgets.cpp" line="2855"/>
         <source>Set As Default</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkWidgets.cpp" line="2850"/>
+        <location filename="../../src/DkGui/DkWidgets.cpp" line="2911"/>
         <source>Profile Name</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkWidgets.cpp" line="2851"/>
+        <location filename="../../src/DkGui/DkWidgets.cpp" line="2911"/>
         <source>Profile Name:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkWidgets.cpp" line="2863"/>
+        <location filename="../../src/DkGui/DkWidgets.cpp" line="2919"/>
         <source>Profile Already Exists</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkWidgets.cpp" line="2864"/>
+        <location filename="../../src/DkGui/DkWidgets.cpp" line="2920"/>
         <source>Do you want to overwrite %1?</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkWidgets.cpp" line="2928"/>
+        <location filename="../../src/DkGui/DkWidgets.cpp" line="2983"/>
         <source>No Profiles</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4705,7 +4719,7 @@ Do you want to show them again?</source>
 <context>
     <name>nmc::DkGlobalSettingsWidget</name>
     <message>
-        <location filename="../../src/DkCore/DkUtils.cpp" line="367"/>
+        <location filename="../../src/DkCore/DkUtils.cpp" line="368"/>
         <source>English</source>
         <extracomment>this should be the name of the language in which nomacs is translated to</extracomment>
         <translation type="unfinished"></translation>
@@ -4714,12 +4728,12 @@ Do you want to show them again?</source>
 <context>
     <name>nmc::DkHistogram</name>
     <message>
-        <location filename="../../src/DkGui/DkWidgets.cpp" line="2132"/>
+        <location filename="../../src/DkGui/DkWidgets.cpp" line="2207"/>
         <source>Show Statistics</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkWidgets.cpp" line="2137"/>
+        <location filename="../../src/DkGui/DkWidgets.cpp" line="2212"/>
         <source>Histogram Settings</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4727,12 +4741,12 @@ Do you want to show them again?</source>
 <context>
     <name>nmc::DkHudNavigation</name>
     <message>
-        <location filename="../../src/DkGui/DkWidgets.cpp" line="1471"/>
+        <location filename="../../src/DkGui/DkWidgets.cpp" line="1501"/>
         <source>Show previous image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkWidgets.cpp" line="1478"/>
+        <location filename="../../src/DkGui/DkWidgets.cpp" line="1508"/>
         <source>Show next image</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4740,17 +4754,17 @@ Do you want to show them again?</source>
 <context>
     <name>nmc::DkHueWidget</name>
     <message>
-        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="534"/>
+        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="574"/>
         <source>Hue</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="541"/>
+        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="581"/>
         <source>Saturation</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="548"/>
+        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="588"/>
         <source>Brightness</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4758,45 +4772,45 @@ Do you want to show them again?</source>
 <context>
     <name>nmc::DkImageContainerT</name>
     <message>
-        <location filename="../../src/DkCore/DkImageContainer.cpp" line="688"/>
+        <location filename="../../src/DkCore/DkImageContainer.cpp" line="722"/>
         <source>Sorry, the file: %1 does not exist... </source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkImageContainer.cpp" line="695"/>
+        <location filename="../../src/DkCore/DkImageContainer.cpp" line="727"/>
         <source>Sorry, you are not allowed to read: %1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkImageContainer.cpp" line="813"/>
+        <location filename="../../src/DkCore/DkImageContainer.cpp" line="841"/>
         <source>updated...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkImageContainer.cpp" line="821"/>
+        <location filename="../../src/DkCore/DkImageContainer.cpp" line="849"/>
         <source>Sorry, I could not load: %1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkImageContainer.cpp" line="877"/>
+        <location filename="../../src/DkCore/DkImageContainer.cpp" line="901"/>
         <source>Sorry, I could not download:
 %1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkImageContainer.cpp" line="948"/>
+        <location filename="../../src/DkCore/DkImageContainer.cpp" line="973"/>
         <source>I can&apos;t save an empty file, sorry...
 </source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkImageContainer.cpp" line="953"/>
+        <location filename="../../src/DkCore/DkImageContainer.cpp" line="978"/>
         <source>Sorry, the directory: %1  does not exist
 </source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkImageContainer.cpp" line="958"/>
+        <location filename="../../src/DkCore/DkImageContainer.cpp" line="983"/>
         <source>Sorry, I can&apos;t write to the file: %1</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4804,101 +4818,102 @@ Do you want to show them again?</source>
 <context>
     <name>nmc::DkImageLoader</name>
     <message>
-        <location filename="../../src/DkCore/DkImageLoader.cpp" line="203"/>
-        <location filename="../../src/DkCore/DkImageLoader.cpp" line="239"/>
-        <location filename="../../src/DkCore/DkImageLoader.cpp" line="275"/>
+        <location filename="../../src/DkCore/DkImageLoader.cpp" line="205"/>
+        <location filename="../../src/DkCore/DkImageLoader.cpp" line="243"/>
+        <location filename="../../src/DkCore/DkImageLoader.cpp" line="281"/>
         <source>%1 
  does not contain any image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkImageLoader.cpp" line="569"/>
-        <location filename="../../src/DkCore/DkImageLoader.cpp" line="631"/>
+        <location filename="../../src/DkCore/DkImageLoader.cpp" line="561"/>
+        <location filename="../../src/DkCore/DkImageLoader.cpp" line="617"/>
         <source>You have reached the beginning</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkImageLoader.cpp" line="575"/>
-        <location filename="../../src/DkCore/DkImageLoader.cpp" line="636"/>
+        <location filename="../../src/DkCore/DkImageLoader.cpp" line="567"/>
+        <location filename="../../src/DkCore/DkImageLoader.cpp" line="621"/>
         <source>You have reached the end</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkImageLoader.cpp" line="747"/>
+        <location filename="../../src/DkCore/DkImageLoader.cpp" line="728"/>
         <source>Save Image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkImageLoader.cpp" line="748"/>
+        <location filename="../../src/DkCore/DkImageLoader.cpp" line="729"/>
         <source>Do you want to save changes to:
 %1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkImageLoader.cpp" line="866"/>
+        <location filename="../../src/DkCore/DkImageLoader.cpp" line="849"/>
         <source>sorry, %1 does not exist anymore...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkImageLoader.cpp" line="884"/>
+        <location filename="../../src/DkCore/DkImageLoader.cpp" line="867"/>
         <source>Sorry, I could not find the GPS coordinates...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkImageLoader.cpp" line="971"/>
+        <location filename="../../src/DkCore/DkImageLoader.cpp" line="953"/>
         <source>%1 of %2</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkImageLoader.cpp" line="1008"/>
+        <location filename="../../src/DkCore/DkImageLoader.cpp" line="986"/>
         <source>Save Directory</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkImageLoader.cpp" line="1063"/>
-        <location filename="../../src/DkCore/DkImageLoader.cpp" line="1123"/>
-        <location filename="../../src/DkCore/DkImageLoader.cpp" line="1201"/>
+        <location filename="../../src/DkCore/DkImageLoader.cpp" line="1037"/>
+        <location filename="../../src/DkCore/DkImageLoader.cpp" line="1092"/>
+        <location filename="../../src/DkCore/DkImageLoader.cpp" line="1163"/>
         <source>Save File %1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkImageLoader.cpp" line="1140"/>
+        <location filename="../../src/DkCore/DkImageLoader.cpp" line="1103"/>
         <source>Sorry, I could not copy the image...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkImageLoader.cpp" line="1187"/>
+        <location filename="../../src/DkCore/DkImageLoader.cpp" line="1150"/>
         <source>Overwrite File</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkImageLoader.cpp" line="1188"/>
+        <location filename="../../src/DkCore/DkImageLoader.cpp" line="1151"/>
         <source>Do you want to overwrite:
 %1?</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkImageLoader.cpp" line="1336"/>
+        <location filename="../../src/DkCore/DkImageLoader.cpp" line="1337"/>
         <source>Sorry, I cannot save an empty image...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkImageLoader.cpp" line="1476"/>
+        <location filename="../../src/DkCore/DkImageLoader.cpp" line="1470"/>
         <source>%1 deleted...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkImageLoader.cpp" line="1480"/>
+        <location filename="../../src/DkCore/DkImageLoader.cpp" line="1473"/>
         <source>Sorry, I could not delete: %1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkImageLoader.cpp" line="1530"/>
+        <location filename="../../src/DkCore/DkImageLoader.cpp" line="1519"/>
+        <location filename="../../src/DkCore/DkImageLoader.cpp" line="1525"/>
         <source>Rotated</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkImageLoader.cpp" line="1790"/>
+        <location filename="../../src/DkCore/DkImageLoader.cpp" line="1785"/>
         <source>Error</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4906,12 +4921,12 @@ Do you want to show them again?</source>
 <context>
     <name>nmc::DkImageStorage</name>
     <message>
-        <location filename="../../src/DkCore/DkImageStorage.cpp" line="1537"/>
+        <location filename="../../src/DkCore/DkImageStorage.cpp" line="1490"/>
         <source>Anti Aliasing Enabled</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkImageStorage.cpp" line="1537"/>
+        <location filename="../../src/DkCore/DkImageStorage.cpp" line="1490"/>
         <source>Anti Aliasing Disabled</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4919,22 +4934,22 @@ Do you want to show them again?</source>
 <context>
     <name>nmc::DkInstalledPluginsModel</name>
     <message>
-        <location filename="../../src/DkCore/DkPluginManager.cpp" line="785"/>
+        <location filename="../../src/DkCore/DkPluginManager.cpp" line="799"/>
         <source>Uninstall</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkPluginManager.cpp" line="798"/>
+        <location filename="../../src/DkCore/DkPluginManager.cpp" line="813"/>
         <source>Name</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkPluginManager.cpp" line="800"/>
+        <location filename="../../src/DkCore/DkPluginManager.cpp" line="815"/>
         <source>Version</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkPluginManager.cpp" line="802"/>
+        <location filename="../../src/DkCore/DkPluginManager.cpp" line="817"/>
         <source>Uninstall plugin</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4942,7 +4957,7 @@ Do you want to show them again?</source>
 <context>
     <name>nmc::DkListWidget</name>
     <message>
-        <location filename="../../src/DkGui/DkWidgets.h" line="875"/>
+        <location filename="../../src/DkGui/DkWidgets.h" line="934"/>
         <source>Drag Items Here</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4950,12 +4965,12 @@ Do you want to show them again?</source>
 <context>
     <name>nmc::DkManipulatorWidget</name>
     <message>
-        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="124"/>
+        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="125"/>
         <source>Undo</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="132"/>
+        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="133"/>
         <source>Redo</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4963,12 +4978,12 @@ Do you want to show them again?</source>
 <context>
     <name>nmc::DkMessageBox</name>
     <message>
-        <location filename="../../src/DkCore/DkMessageBox.cpp" line="68"/>
+        <location filename="../../src/DkCore/DkMessageBox.cpp" line="70"/>
         <source>Error</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkMessageBox.cpp" line="102"/>
+        <location filename="../../src/DkCore/DkMessageBox.cpp" line="104"/>
         <source>Remember my choice</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4976,17 +4991,17 @@ Do you want to show them again?</source>
 <context>
     <name>nmc::DkMetaData</name>
     <message>
-        <location filename="../../src/DkCore/DkSettings.cpp" line="66"/>
+        <location filename="../../src/DkCore/DkSettings.cpp" line="68"/>
         <source>Image Size</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSettings.cpp" line="67"/>
+        <location filename="../../src/DkCore/DkSettings.cpp" line="68"/>
         <source>Orientation</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSettings.cpp" line="68"/>
+        <location filename="../../src/DkCore/DkSettings.cpp" line="69"/>
         <source>Make</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5001,107 +5016,107 @@ Do you want to show them again?</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSettings.cpp" line="71"/>
+        <location filename="../../src/DkCore/DkSettings.cpp" line="70"/>
         <source>ISO</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSettings.cpp" line="72"/>
+        <location filename="../../src/DkCore/DkSettings.cpp" line="71"/>
         <source>Flash</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSettings.cpp" line="73"/>
+        <location filename="../../src/DkCore/DkSettings.cpp" line="71"/>
         <source>Focal Length</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSettings.cpp" line="74"/>
+        <location filename="../../src/DkCore/DkSettings.cpp" line="72"/>
         <source>Exposure Mode</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSettings.cpp" line="75"/>
+        <location filename="../../src/DkCore/DkSettings.cpp" line="72"/>
         <source>Exposure Time</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSettings.cpp" line="76"/>
+        <location filename="../../src/DkCore/DkSettings.cpp" line="73"/>
         <source>Compression</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSettings.cpp" line="79"/>
+        <location filename="../../src/DkCore/DkSettings.cpp" line="75"/>
         <source>Rating</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSettings.cpp" line="80"/>
+        <location filename="../../src/DkCore/DkSettings.cpp" line="75"/>
         <source>User Comment</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSettings.cpp" line="81"/>
+        <location filename="../../src/DkCore/DkSettings.cpp" line="76"/>
         <source>Date Time</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSettings.cpp" line="82"/>
+        <location filename="../../src/DkCore/DkSettings.cpp" line="76"/>
         <source>Date Time Original</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSettings.cpp" line="83"/>
+        <location filename="../../src/DkCore/DkSettings.cpp" line="77"/>
         <source>Image Description</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSettings.cpp" line="84"/>
+        <location filename="../../src/DkCore/DkSettings.cpp" line="77"/>
         <source>Creator</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSettings.cpp" line="85"/>
+        <location filename="../../src/DkCore/DkSettings.cpp" line="78"/>
         <source>Creator Title</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSettings.cpp" line="86"/>
+        <location filename="../../src/DkCore/DkSettings.cpp" line="78"/>
         <source>City</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSettings.cpp" line="87"/>
+        <location filename="../../src/DkCore/DkSettings.cpp" line="79"/>
         <source>Country</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSettings.cpp" line="88"/>
+        <location filename="../../src/DkCore/DkSettings.cpp" line="79"/>
         <source>Headline</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSettings.cpp" line="89"/>
+        <location filename="../../src/DkCore/DkSettings.cpp" line="80"/>
         <source>Caption</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSettings.cpp" line="90"/>
+        <location filename="../../src/DkCore/DkSettings.cpp" line="80"/>
         <source>Copyright</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSettings.cpp" line="91"/>
+        <location filename="../../src/DkCore/DkSettings.cpp" line="81"/>
         <source>Keywords</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSettings.cpp" line="92"/>
+        <location filename="../../src/DkCore/DkSettings.cpp" line="81"/>
         <source>Path</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSettings.cpp" line="93"/>
+        <location filename="../../src/DkCore/DkSettings.cpp" line="82"/>
         <source>File Size</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5109,12 +5124,12 @@ Do you want to show them again?</source>
 <context>
     <name>nmc::DkMetaDataDock</name>
     <message>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="398"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="393"/>
         <source>Filter</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="412"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="407"/>
         <source>Thumbnail</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5122,103 +5137,103 @@ Do you want to show them again?</source>
 <context>
     <name>nmc::DkMetaDataHUD</name>
     <message>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="720"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="704"/>
         <source>Image Information</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="767"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="754"/>
         <source>Change Entries</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="768"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="755"/>
         <source>You can customize the entries displayed here.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="771"/>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="1152"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="758"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="1122"/>
         <source>Number of Columns</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="772"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="759"/>
         <source>Select the desired number of columns.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="775"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="762"/>
         <source>Set to Default</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="776"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="763"/>
         <source>Reset the metadata panel.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="780"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="767"/>
         <source>Show Left</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="781"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="768"/>
         <source>Shows the Metadata on the Left</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="784"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="771"/>
         <source>Show Top</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="785"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="772"/>
         <source>Shows the Metadata at the Top</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="788"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="775"/>
         <source>Show Right</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="789"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="776"/>
         <source>Shows the Metadata on the Right</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="792"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="779"/>
         <source>Show Bottom</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="793"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="780"/>
         <source>Shows the Metadata at the Bottom</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="1068"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="1041"/>
         <source>Metadata Menu</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="1123"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="1093"/>
         <source>Change Metadata Entries</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="1130"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="1100"/>
         <source>&amp;OK</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="1131"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="1101"/>
         <source>&amp;Cancel</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="1152"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="1122"/>
         <source>Number of columns (-1 is default)</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5226,17 +5241,17 @@ Do you want to show them again?</source>
 <context>
     <name>nmc::DkMetaDataModel</name>
     <message>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="64"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="67"/>
         <source>Key</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="64"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="67"/>
         <source>Value</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="145"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="144"/>
         <source>Data.</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5244,7 +5259,7 @@ Do you want to show them again?</source>
 <context>
     <name>nmc::DkMetaDataSelection</name>
     <message>
-        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="587"/>
+        <location filename="../../src/DkGui/DkMetaDataWidgets.cpp" line="577"/>
         <source>Check All</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5252,174 +5267,174 @@ Do you want to show them again?</source>
 <context>
     <name>nmc::DkMosaicDialog</name>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2753"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2690"/>
         <source>Create Mosaic Image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2816"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2753"/>
         <source>Darken</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2817"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2754"/>
         <source>Lighten</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2818"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2755"/>
         <source>Saturation</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2826"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2763"/>
         <source>Mosaic Image:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2829"/>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2839"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2766"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2776"/>
         <source>&amp;Browse</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2831"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2768"/>
         <source>Choose which image to mosaic.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2833"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2770"/>
         <source>No Image loaded</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2836"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2773"/>
         <source>Mosaic Elements Folder:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2841"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2778"/>
         <source>Specify the root folder of images used for mosaic elements.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2843"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2780"/>
         <source>Specify an Image Database</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2846"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2783"/>
         <source>Resolution:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2850"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2787"/>
         <source>Pixel Width</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2855"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2792"/>
         <source>Pixel Height</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2862"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2799"/>
         <source>Patches:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2866"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2803"/>
         <source>Number of Horizontal Patches</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2871"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2808"/>
         <source>Number of Vertical Patches</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2876"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2813"/>
         <source>If this label turns red, the computation might be slower.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2879"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2816"/>
         <source>Filters:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2884"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2821"/>
         <source>You can split multiple ignore words with ;</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2888"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2825"/>
         <source>All Images</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2937"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2874"/>
         <source>&amp;Save</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2938"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2875"/>
         <source>&amp;Generate</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2939"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2876"/>
         <source>&amp;Cancel</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2961"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2897"/>
         <source>Open TIFF</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2977"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2912"/>
         <source>Open an Image Directory</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="3001"/>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="3013"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2934"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2947"/>
         <source>%1 x %2 cm @150 dpi</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="3058"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2992"/>
         <source>Patch Resolution: %1 px</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="3256"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="3178"/>
         <source>Filling empty areas...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="3260"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="3182"/>
         <source>I need to use some images twice - maybe the database is too small?</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="3265"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="3186"/>
         <source>Sorry, it seems that i cannot create your mosaic with this database.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="3382"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="3295"/>
         <source>Something is seriously wrong, I could not load: %1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="3630"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="3527"/>
         <source>Error</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="3630"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="3527"/>
         <source>Sorry, I could not mix the image...</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5427,101 +5442,102 @@ Do you want to show them again?</source>
 <context>
     <name>nmc::DkNoMacs</name>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="251"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="259"/>
         <source>Pl&amp;ugins</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="347"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="359"/>
         <source>Quit nomacs</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="348"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="360"/>
         <source>Do you want nomacs to save your tabs?</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="350"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="363"/>
         <source>&amp;Save and Quit</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="351"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="364"/>
         <source>&amp;Quit</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="715"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="725"/>
         <source>Recursive Folder Scan is Now Enabled</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="717"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="727"/>
         <source>Recursive Folder Scan is Now Disabled</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="726"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="736"/>
         <source>Change Opacity</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="803"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="814"/>
         <source>Window Locked
 To unlock: gain focus (ALT+Tab),
 then press %1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="807"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="816"/>
         <source>You should first reduce opacity
  before working through the window.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="903"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="908"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="910"/>
         <source>File Explorer</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="933"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="942"/>
         <source>Meta Data Info</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="954"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="965"/>
         <source>Edit Image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="975"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="985"/>
         <source>History</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="997"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1009"/>
         <source>Console</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1039"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1049"/>
         <source>Thumbnails</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1079"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1087"/>
         <source>Open an Image Directory</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1094"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1101"/>
         <source>All Files (*.*)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1099"/>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1155"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1105"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1154"/>
         <source>Open Image</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5532,111 +5548,111 @@ then press %1</source>
     </message>
     <message>
         <location filename="../../src/DkGui/DkNoMacs.cpp" line="1149"/>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1186"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1180"/>
         <source>Text file (*.txt)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
         <location filename="../../src/DkGui/DkNoMacs.cpp" line="1150"/>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1187"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1181"/>
         <source>All files (*.*)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1191"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1184"/>
         <source>Save Tab List</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1269"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1259"/>
         <source>Sorry, the directory: %1 does not exist
 </source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1273"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1263"/>
         <source>Sorry, I can&apos;t write to the fileInfo: %1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1282"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1272"/>
         <source>Rename:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1297"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1285"/>
         <source>Question</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1298"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1286"/>
         <source>The fileInfo: %1  already exists.
  Do you want to replace it?</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1312"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1299"/>
         <source>Sorry, I can&apos;t delete: %1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1328"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1314"/>
         <source>Sorry, I can&apos;t rename: %1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1409"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1392"/>
         <source>Go To Image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1409"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1392"/>
         <source>Image Index:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1465"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1446"/>
         <source>Save Thumbnails</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1727"/>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1744"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1705"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1722"/>
         <source> [Private Mode]</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1825"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1799"/>
         <source>Already downloading update</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1852"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1826"/>
         <source>Downloading update...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1852"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1826"/>
         <source>Cancel Update</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1886"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1862"/>
         <source>Unable to install new version&lt;br&gt;</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1887"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1862"/>
         <source>You can download the new version from our web page</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1901"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1876"/>
         <source>Downloading new translations...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1901"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="1876"/>
         <source>Cancel</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5644,7 +5660,7 @@ then press %1</source>
 <context>
     <name>nmc::DkNoMacsFrameless</name>
     <message>
-        <location filename="../../src/DkGui/DkNoMacs.cpp" line="2124"/>
+        <location filename="../../src/DkGui/DkNoMacs.cpp" line="2103"/>
         <source>Choose a Monitor</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5652,17 +5668,17 @@ then press %1</source>
 <context>
     <name>nmc::DkOpacityDialog</name>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2417"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2361"/>
         <source>Window Opacity</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2422"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2366"/>
         <source>&amp;OK</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2423"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2367"/>
         <source>&amp;Cancel</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5670,17 +5686,17 @@ then press %1</source>
 <context>
     <name>nmc::DkPlayer</name>
     <message>
-        <location filename="../../src/DkGui/DkWidgets.cpp" line="1317"/>
+        <location filename="../../src/DkGui/DkWidgets.cpp" line="1343"/>
         <source>Show previous image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkWidgets.cpp" line="1329"/>
+        <location filename="../../src/DkGui/DkWidgets.cpp" line="1355"/>
         <source>Play/Pause</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkWidgets.cpp" line="1341"/>
+        <location filename="../../src/DkGui/DkWidgets.cpp" line="1367"/>
         <source>Show next image</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5688,22 +5704,22 @@ then press %1</source>
 <context>
     <name>nmc::DkPluginContainer</name>
     <message>
-        <location filename="../../src/DkCore/DkPluginManager.cpp" line="437"/>
+        <location filename="../../src/DkCore/DkPluginManager.cpp" line="432"/>
         <source>Author:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkPluginManager.cpp" line="438"/>
+        <location filename="../../src/DkCore/DkPluginManager.cpp" line="433"/>
         <source>Company:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkPluginManager.cpp" line="439"/>
+        <location filename="../../src/DkCore/DkPluginManager.cpp" line="434"/>
         <source>Created:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkPluginManager.cpp" line="440"/>
+        <location filename="../../src/DkCore/DkPluginManager.cpp" line="435"/>
         <source>Last Modified:</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5711,12 +5727,12 @@ then press %1</source>
 <context>
     <name>nmc::DkPluginManagerDialog</name>
     <message>
-        <location filename="../../src/DkCore/DkPluginManager.cpp" line="549"/>
+        <location filename="../../src/DkCore/DkPluginManager.cpp" line="554"/>
         <source>Plugin Manager</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkPluginManager.cpp" line="561"/>
+        <location filename="../../src/DkCore/DkPluginManager.cpp" line="566"/>
         <source>&amp;Close</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5724,7 +5740,7 @@ then press %1</source>
 <context>
     <name>nmc::DkPluginTableWidget</name>
     <message>
-        <location filename="../../src/DkCore/DkPluginManager.cpp" line="620"/>
+        <location filename="../../src/DkCore/DkPluginManager.cpp" line="625"/>
         <source>Search plugins</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5732,22 +5748,22 @@ then press %1</source>
 <context>
     <name>nmc::DkPongPort</name>
     <message>
-        <location filename="../../src/DkGui/DkPong.cpp" line="336"/>
+        <location filename="../../src/DkGui/DkPong.cpp" line="361"/>
         <source>PAUSED</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPong.cpp" line="337"/>
+        <location filename="../../src/DkGui/DkPong.cpp" line="362"/>
         <source>Press &lt;SPACE&gt; to start.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPong.cpp" line="485"/>
+        <location filename="../../src/DkGui/DkPong.cpp" line="507"/>
         <source>%1 won!</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPong.cpp" line="486"/>
+        <location filename="../../src/DkGui/DkPong.cpp" line="508"/>
         <source>Hit &lt;SPACE&gt; to start a new Game</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5755,17 +5771,17 @@ then press %1</source>
 <context>
     <name>nmc::DkPreferenceWidget</name>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="71"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="72"/>
         <source>next</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="76"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="77"/>
         <source>previous</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="96"/>
+        <location filename="../../src/DkGui/DkPreferenceWidgets.cpp" line="97"/>
         <source>Restart nomacs</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5773,53 +5789,53 @@ then press %1</source>
 <context>
     <name>nmc::DkPrintPreviewDialog</name>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2069"/>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2161"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2017"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2109"/>
         <source>Print Preview</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2130"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2078"/>
         <source>Fit Width</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2131"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2079"/>
         <source>Fit Page</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2133"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2081"/>
         <source>Zoom in</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2136"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2084"/>
         <source>Zoom out</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2139"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2087"/>
         <source>keep ALT key pressed to zoom with the mouse wheel</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2150"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2098"/>
         <source>Portrait</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2153"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2101"/>
         <source>Landscape</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2157"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2105"/>
         <source>Page setup</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2158"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="2106"/>
         <source>Print</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5827,42 +5843,42 @@ then press %1</source>
 <context>
     <name>nmc::DkProfileSummaryWidget</name>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="1175"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="1211"/>
         <source>Summary: </source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="1176"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="1212"/>
         <source>Files</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="1205"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="1242"/>
         <source>Input</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="1209"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="1246"/>
         <source>Output</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="1213"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="1250"/>
         <source>Functions</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="1232"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="1269"/>
         <source>Update</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="1237"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="1274"/>
         <source>Delete</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="1242"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="1279"/>
         <source>Export</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5870,63 +5886,63 @@ then press %1</source>
 <context>
     <name>nmc::DkProfileWidget</name>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="1273"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="1310"/>
         <source>Create New Profile</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="1276"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="1313"/>
         <source>Apply Default</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="1314"/>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="1370"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="1354"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="1410"/>
         <source>inactive</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="1339"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="1379"/>
         <source>Default</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="1406"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="1445"/>
         <source>Deleting Profile</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="1407"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="1445"/>
         <source>Sorry, I cannot delete %1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="1425"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="1458"/>
         <source>Export Batch Profile</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="1427"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="1460"/>
         <source>nomacs Batch Profile (*.%1)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="1442"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="1474"/>
         <source>Profile Name</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="1443"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="1474"/>
         <source>Profile Name:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="1454"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="1482"/>
         <source>Profile Already Exists</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkBatch.cpp" line="1455"/>
+        <location filename="../../src/DkGui/DkBatch.cpp" line="1482"/>
         <source>Do you want to overwrite %1?</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5934,7 +5950,7 @@ then press %1</source>
 <context>
     <name>nmc::DkQuickAccessEdit</name>
     <message>
-        <location filename="../../src/DkGui/DkQuickAccess.cpp" line="140"/>
+        <location filename="../../src/DkGui/DkQuickAccess.cpp" line="137"/>
         <source>Quick Launch (%1)</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5942,27 +5958,27 @@ then press %1</source>
 <context>
     <name>nmc::DkRatingLabel</name>
     <message>
-        <location filename="../../src/DkGui/DkWidgets.cpp" line="1099"/>
+        <location filename="../../src/DkGui/DkWidgets.cpp" line="1122"/>
         <source>one star</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkWidgets.cpp" line="1103"/>
+        <location filename="../../src/DkGui/DkWidgets.cpp" line="1126"/>
         <source>two stars</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkWidgets.cpp" line="1107"/>
+        <location filename="../../src/DkGui/DkWidgets.cpp" line="1130"/>
         <source>three star</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkWidgets.cpp" line="1111"/>
+        <location filename="../../src/DkGui/DkWidgets.cpp" line="1134"/>
         <source>four star</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkWidgets.cpp" line="1115"/>
+        <location filename="../../src/DkGui/DkWidgets.cpp" line="1138"/>
         <source>five star</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5970,17 +5986,17 @@ then press %1</source>
 <context>
     <name>nmc::DkRecentDirWidget</name>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="2160"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="2070"/>
         <source>Load the directory</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="2170"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="2080"/>
         <source>Pin this directory</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="2178"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="2088"/>
         <source>Remove this directory</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5988,27 +6004,27 @@ then press %1</source>
 <context>
     <name>nmc::DkRectWidget</name>
     <message>
-        <location filename="../../src/DkCore/DkBasicWidgets.cpp" line="765"/>
+        <location filename="../../src/DkCore/DkBasicWidgets.cpp" line="778"/>
         <source>x:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkBasicWidgets.cpp" line="769"/>
+        <location filename="../../src/DkCore/DkBasicWidgets.cpp" line="782"/>
         <source>y:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkBasicWidgets.cpp" line="773"/>
+        <location filename="../../src/DkCore/DkBasicWidgets.cpp" line="786"/>
         <source>width:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkBasicWidgets.cpp" line="777"/>
+        <location filename="../../src/DkCore/DkBasicWidgets.cpp" line="790"/>
         <source>height:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkBasicWidgets.cpp" line="782"/>
+        <location filename="../../src/DkCore/DkBasicWidgets.cpp" line="795"/>
         <source> px</source>
         <translation type="unfinished"></translation>
     </message>
@@ -6016,99 +6032,99 @@ then press %1</source>
 <context>
     <name>nmc::DkResizeDialog</name>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="911"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="893"/>
         <source>Resize Image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="930"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="912"/>
         <source>Original</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="932"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="914"/>
         <source>New</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="961"/>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="997"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="943"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="979"/>
         <source>Width: </source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="973"/>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="1011"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="955"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="992"/>
         <source>Height: </source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="1037"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="1018"/>
         <source>Resolution: </source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="1046"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="1027"/>
         <source>pixel/inch</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="1047"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="1028"/>
         <source>pixel/cm</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="1058"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="1039"/>
         <source>Resample Image:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="1065"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="1046"/>
         <source>Nearest Neighbor</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="1066"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="1047"/>
         <source>Area (best for downscaling)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="1067"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="1048"/>
         <source>Linear</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="1068"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="1049"/>
         <source>Bicubic (4x4 pixel interpolation)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="1069"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="1050"/>
         <source>Lanczos (8x8 pixel interpolation)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="1078"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="1059"/>
         <source>Gamma Correction</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="1089"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="1070"/>
         <source>&amp;OK</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="1090"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="1071"/>
         <source>&amp;Cancel</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="1454"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="1435"/>
         <source>Sorry, but the image size %1 x %2 is illegal.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="1466"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="1447"/>
         <source>Sorry, the image is too large: %1</source>
         <translation type="unfinished"></translation>
     </message>
@@ -6116,37 +6132,37 @@ then press %1</source>
 <context>
     <name>nmc::DkResizeWidget</name>
     <message>
-        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="415"/>
+        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="441"/>
         <source>Scale</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="425"/>
+        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="451"/>
         <source>Nearest Neighbor</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="426"/>
+        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="452"/>
         <source>Area (best for downscaling)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="427"/>
+        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="453"/>
         <source>Linear</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="428"/>
+        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="454"/>
         <source>Bicubic (4x4 interpolatia)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="429"/>
+        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="455"/>
         <source>Lanczos (8x8 interpolation)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="432"/>
+        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="458"/>
         <source>Gamma Correction</source>
         <translation type="unfinished"></translation>
     </message>
@@ -6154,7 +6170,7 @@ then press %1</source>
 <context>
     <name>nmc::DkRotateWidget</name>
     <message>
-        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="374"/>
+        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="396"/>
         <source>Angle</source>
         <translation type="unfinished"></translation>
     </message>
@@ -6162,32 +6178,32 @@ then press %1</source>
 <context>
     <name>nmc::DkSearchDialog</name>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="648"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="633"/>
         <source>Find &amp; Filter</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="650"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="635"/>
         <source>Load All</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="658"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="643"/>
         <source>Type search words or a regular expression</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="669"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="654"/>
         <source>&amp;Filter</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="674"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="659"/>
         <source>F&amp;ind</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="716"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="704"/>
         <source>No Matching Items</source>
         <translation type="unfinished"></translation>
     </message>
@@ -6195,12 +6211,12 @@ then press %1</source>
 <context>
     <name>nmc::DkSettingsModel</name>
     <message>
-        <location filename="../../src/DkGui/DkSettingsWidget.cpp" line="299"/>
+        <location filename="../../src/DkGui/DkSettingsWidget.cpp" line="316"/>
         <source>Settings</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkSettingsWidget.cpp" line="299"/>
+        <location filename="../../src/DkGui/DkSettingsWidget.cpp" line="316"/>
         <source>Value</source>
         <translation type="unfinished"></translation>
     </message>
@@ -6208,12 +6224,12 @@ then press %1</source>
 <context>
     <name>nmc::DkSettingsWidget</name>
     <message>
-        <location filename="../../src/DkGui/DkSettingsWidget.cpp" line="131"/>
+        <location filename="../../src/DkGui/DkSettingsWidget.cpp" line="136"/>
         <source>Filter Settings</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkSettingsWidget.cpp" line="157"/>
+        <location filename="../../src/DkGui/DkSettingsWidget.cpp" line="162"/>
         <source>Delete</source>
         <translation type="unfinished"></translation>
     </message>
@@ -6221,27 +6237,27 @@ then press %1</source>
 <context>
     <name>nmc::DkShortcutsDialog</name>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="1862"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="1821"/>
         <source>Keyboard Shortcuts</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="1898"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="1851"/>
         <source>Set to &amp;Default</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="1899"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="1852"/>
         <source>Removes All Custom Shortcuts</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="1912"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="1861"/>
         <source>&amp;OK</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="1913"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="1862"/>
         <source>&amp;Cancel</source>
         <translation type="unfinished"></translation>
     </message>
@@ -6249,23 +6265,23 @@ then press %1</source>
 <context>
     <name>nmc::DkShortcutsModel</name>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="1593"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="1563"/>
         <source>Name</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="1593"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="1563"/>
         <source>Shortcut</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="1775"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="1742"/>
         <source>%1 already used by %2 &gt; %3
 Press ESC to undo changes</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="1781"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="1747"/>
         <source>%1 already used by %2
 Press ESC to undo changes</source>
         <translation type="unfinished"></translation>
@@ -6274,12 +6290,12 @@ Press ESC to undo changes</source>
 <context>
     <name>nmc::DkSplashScreen</name>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="145"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="150"/>
         <source>Close (ESC)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="270"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="273"/>
         <source>Portable</source>
         <translation type="unfinished"></translation>
     </message>
@@ -6287,22 +6303,22 @@ Press ESC to undo changes</source>
 <context>
     <name>nmc::DkSvgSizeDialog</name>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="4344"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="4235"/>
         <source>width:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="4351"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="4242"/>
         <source>height:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="4367"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="4258"/>
         <source>&amp;OK</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="4368"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="4259"/>
         <source>&amp;Cancel</source>
         <translation type="unfinished"></translation>
     </message>
@@ -6310,7 +6326,7 @@ Press ESC to undo changes</source>
 <context>
     <name>nmc::DkTcpMenu</name>
     <message>
-        <location filename="../../src/DkGui/DkMenu.cpp" line="214"/>
+        <location filename="../../src/DkGui/DkMenu.cpp" line="216"/>
         <source>no clients found</source>
         <translation type="unfinished"></translation>
     </message>
@@ -6318,42 +6334,42 @@ Press ESC to undo changes</source>
 <context>
     <name>nmc::DkTextDialog</name>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="1958"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="1909"/>
         <source>Text Editor</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="1968"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="1919"/>
         <source>&amp;Save</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="1969"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="1920"/>
         <source>&amp;Close</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="1993"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="1945"/>
         <source>Text File (*.txt)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="1993"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="1945"/>
         <source>All Files (*.*)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="1998"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="1948"/>
         <source>Save Text File</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2015"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="1959"/>
         <source>Error</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2015"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="1959"/>
         <source>Could not save: %1
 %2</source>
         <translation type="unfinished"></translation>
@@ -6362,12 +6378,12 @@ Press ESC to undo changes</source>
 <context>
     <name>nmc::DkThresholdWidget</name>
     <message>
-        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="472"/>
+        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="505"/>
         <source>Threshold</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="479"/>
+        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="512"/>
         <source>Color</source>
         <translation type="unfinished"></translation>
     </message>
@@ -6375,17 +6391,17 @@ Press ESC to undo changes</source>
 <context>
     <name>nmc::DkThumbLabel</name>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="892"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="858"/>
         <source>Name: </source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="893"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="858"/>
         <source>Size: </source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="894"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="858"/>
         <source>Created: </source>
         <translation type="unfinished"></translation>
     </message>
@@ -6393,80 +6409,80 @@ Press ESC to undo changes</source>
 <context>
     <name>nmc::DkThumbScene</name>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1261"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1218"/>
         <source> selected</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1263"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1220"/>
         <source> images</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1265"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1222"/>
         <source>%1 | %2</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1451"/>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1534"/>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1580"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1401"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1479"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1516"/>
         <source>Error</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1451"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1402"/>
         <source>Sorry, I cannot %1 %2</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1463"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1414"/>
         <source>move</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1474"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1424"/>
         <source>create link</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1482"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1432"/>
         <source>copy</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1504"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1453"/>
         <source>Shall I move %1 file(s) to trash?</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1506"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1455"/>
         <source>Are you sure you want to permanently delete %1 file(s)?</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1511"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1459"/>
         <source>Delete File</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1535"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1480"/>
         <source>Sorry, I cannot delete:
 %1</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1562"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1505"/>
         <source>Rename File(s)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1563"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1505"/>
         <source>New Filename:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1581"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1517"/>
         <source>Sorry, I cannot rename: %1 to %2</source>
         <translation type="unfinished"></translation>
     </message>
@@ -6474,27 +6490,27 @@ Press ESC to undo changes</source>
 <context>
     <name>nmc::DkThumbScrollWidget</name>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1874"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1788"/>
         <source>Thumb Preview Toolbar</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1892"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1806"/>
         <source>&amp;Sort</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1907"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1821"/>
         <source>Filter Files (Ctrl + F)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1920"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1834"/>
         <source>Thumb</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1935"/>
+        <location filename="../../src/DkGui/DkThumbsWidgets.cpp" line="1848"/>
         <source>Open Image</source>
         <translation type="unfinished"></translation>
     </message>
@@ -6502,19 +6518,19 @@ Press ESC to undo changes</source>
 <context>
     <name>nmc::DkThumbsSaver</name>
     <message>
-        <location filename="../../src/DkGui/DkWidgets.cpp" line="296"/>
+        <location filename="../../src/DkGui/DkWidgets.cpp" line="299"/>
         <source>
 Creating thumbnails...
 </source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkWidgets.cpp" line="297"/>
+        <location filename="../../src/DkGui/DkWidgets.cpp" line="299"/>
         <source>Cancel</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkWidgets.cpp" line="301"/>
+        <location filename="../../src/DkGui/DkWidgets.cpp" line="300"/>
         <source>Thumbnails</source>
         <translation type="unfinished"></translation>
     </message>
@@ -6522,27 +6538,27 @@ Creating thumbnails...
 <context>
     <name>nmc::DkTifDialog</name>
     <message>
-        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="65"/>
+        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="68"/>
         <source>TIF compression</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="68"/>
+        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="71"/>
         <source>&amp;no compression</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="69"/>
+        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="72"/>
         <source>&amp;LZW compression (lossless)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="79"/>
+        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="82"/>
         <source>&amp;OK</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="80"/>
+        <location filename="../../src/DkCore/DkSaveDialog.cpp" line="83"/>
         <source>&amp;Cancel</source>
         <translation type="unfinished"></translation>
     </message>
@@ -6550,17 +6566,17 @@ Creating thumbnails...
 <context>
     <name>nmc::DkTinyPlanetWidget</name>
     <message>
-        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="256"/>
+        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="263"/>
         <source>Planet Size</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="262"/>
+        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="269"/>
         <source>Angle</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="268"/>
+        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="275"/>
         <source>Invert Planet</source>
         <translation type="unfinished"></translation>
     </message>
@@ -6568,57 +6584,57 @@ Creating thumbnails...
 <context>
     <name>nmc::DkTrainDialog</name>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="299"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="304"/>
         <source>Add New Image Format</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="308"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="313"/>
         <source>Load New Image Format</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="315"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="320"/>
         <source>&amp;Browse</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="328"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="333"/>
         <source>&amp;Add</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="330"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="335"/>
         <source>&amp;Cancel</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="364"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="367"/>
         <source>Open Image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="366"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="367"/>
         <source>All Files (*.*)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="415"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="413"/>
         <source>Sorry, currently we don&apos;t support: *.%1 files</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="420"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="418"/>
         <source>*.%1 is already supported.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="424"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="421"/>
         <source>*.%1 is supported.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="441"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="437"/>
         <source>Please name the new format:</source>
         <translation type="unfinished"></translation>
     </message>
@@ -6626,93 +6642,93 @@ Creating thumbnails...
 <context>
     <name>nmc::DkTransferToolBar</name>
     <message>
-        <location filename="../../src/DkGui/DkToolbars.cpp" line="527"/>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="498"/>
         <source>Pseudo Color Toolbar</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkToolbars.cpp" line="532"/>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="502"/>
         <source>Enable</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkToolbars.cpp" line="533"/>
-        <location filename="../../src/DkGui/DkToolbars.cpp" line="783"/>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="503"/>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="745"/>
         <source>Enables the Pseudo Color function</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkToolbars.cpp" line="542"/>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="512"/>
         <source>Changes the displayed color channel</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkToolbars.cpp" line="547"/>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="517"/>
         <source>Delete</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkToolbars.cpp" line="562"/>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="532"/>
         <source>Click into the field for a new slider</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkToolbars.cpp" line="606"/>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="575"/>
         <source>Reset</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkToolbars.cpp" line="607"/>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="576"/>
         <source>Resets the Pseudo Color function</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkToolbars.cpp" line="612"/>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="581"/>
         <source>Select Color</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkToolbars.cpp" line="613"/>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="582"/>
         <source>Adds a slider at the selected color value</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkToolbars.cpp" line="618"/>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="587"/>
         <source>Save Gradient</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkToolbars.cpp" line="619"/>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="588"/>
         <source>Saves the current Gradient</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkToolbars.cpp" line="747"/>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="711"/>
         <source>Gray</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkToolbars.cpp" line="750"/>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="713"/>
         <source>RGB</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkToolbars.cpp" line="751"/>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="714"/>
         <source>Red</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkToolbars.cpp" line="752"/>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="715"/>
         <source>Green</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkToolbars.cpp" line="753"/>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="716"/>
         <source>Blue</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkToolbars.cpp" line="781"/>
+        <location filename="../../src/DkGui/DkToolbars.cpp" line="743"/>
         <source>Disables the Pseudo Color function</source>
         <translation type="unfinished"></translation>
     </message>
@@ -6720,41 +6736,41 @@ Creating thumbnails...
 <context>
     <name>nmc::DkTranslationUpdater</name>
     <message>
-        <location filename="../../src/DkCore/DkUpdater.cpp" line="368"/>
+        <location filename="../../src/DkCore/DkUpdater.cpp" line="374"/>
         <source>Updates Disabled</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkUpdater.cpp" line="369"/>
+        <location filename="../../src/DkCore/DkUpdater.cpp" line="375"/>
         <source>nomacs updates are disabled.
 Please contact your system administrator for further information.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkUpdater.cpp" line="416"/>
+        <location filename="../../src/DkCore/DkUpdater.cpp" line="423"/>
         <source>Unable to download translation</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkUpdater.cpp" line="416"/>
-        <location filename="../../src/DkCore/DkUpdater.cpp" line="433"/>
-        <location filename="../../src/DkCore/DkUpdater.cpp" line="455"/>
-        <location filename="../../src/DkCore/DkUpdater.cpp" line="460"/>
+        <location filename="../../src/DkCore/DkUpdater.cpp" line="423"/>
+        <location filename="../../src/DkCore/DkUpdater.cpp" line="441"/>
+        <location filename="../../src/DkCore/DkUpdater.cpp" line="464"/>
+        <location filename="../../src/DkCore/DkUpdater.cpp" line="469"/>
         <source>update</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkUpdater.cpp" line="433"/>
+        <location filename="../../src/DkCore/DkUpdater.cpp" line="441"/>
         <source>Unable to update translation</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkUpdater.cpp" line="455"/>
+        <location filename="../../src/DkCore/DkUpdater.cpp" line="464"/>
         <source>Translation updated</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkUpdater.cpp" line="460"/>
+        <location filename="../../src/DkCore/DkUpdater.cpp" line="469"/>
         <source>No newer translations found</source>
         <translation type="unfinished"></translation>
     </message>
@@ -6762,12 +6778,12 @@ Please contact your system administrator for further information.</source>
 <context>
     <name>nmc::DkUnsharpMaskWidget</name>
     <message>
-        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="334"/>
+        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="350"/>
         <source>Sigma</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="339"/>
+        <location filename="../../src/DkGui/DkManipulatorWidgets.cpp" line="355"/>
         <source>Amount</source>
         <translation type="unfinished"></translation>
     </message>
@@ -6775,17 +6791,17 @@ Please contact your system administrator for further information.</source>
 <context>
     <name>nmc::DkUpdateDialog</name>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2038"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="1986"/>
         <source>nomacs updater</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2046"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="1994"/>
         <source>Install Now</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="2047"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="1995"/>
         <source>Cancel</source>
         <translation type="unfinished"></translation>
     </message>
@@ -6793,66 +6809,66 @@ Please contact your system administrator for further information.</source>
 <context>
     <name>nmc::DkUpdater</name>
     <message>
-        <location filename="../../src/DkCore/DkUpdater.cpp" line="161"/>
+        <location filename="../../src/DkCore/DkUpdater.cpp" line="164"/>
         <source>Updates Disabled</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkUpdater.cpp" line="162"/>
+        <location filename="../../src/DkCore/DkUpdater.cpp" line="165"/>
         <source>nomacs updates are disabled.
 Please contact your system administrator for further information.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkUpdater.cpp" line="249"/>
+        <location filename="../../src/DkCore/DkUpdater.cpp" line="251"/>
         <source>sorry, I could not check for newer versions</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkUpdater.cpp" line="249"/>
+        <location filename="../../src/DkCore/DkUpdater.cpp" line="251"/>
         <source>Updates</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkUpdater.cpp" line="261"/>
+        <location filename="../../src/DkCore/DkUpdater.cpp" line="264"/>
         <source>A new version</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkUpdater.cpp" line="261"/>
+        <location filename="../../src/DkCore/DkUpdater.cpp" line="264"/>
         <source>is available</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkUpdater.cpp" line="262"/>
+        <location filename="../../src/DkCore/DkUpdater.cpp" line="265"/>
         <source>Do you want to download and install it now?</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkUpdater.cpp" line="263"/>
+        <location filename="../../src/DkCore/DkUpdater.cpp" line="266"/>
         <source>For more information see </source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkUpdater.cpp" line="269"/>
         <location filename="../../src/DkCore/DkUpdater.cpp" line="272"/>
-        <location filename="../../src/DkCore/DkUpdater.cpp" line="280"/>
-        <location filename="../../src/DkCore/DkUpdater.cpp" line="350"/>
+        <location filename="../../src/DkCore/DkUpdater.cpp" line="274"/>
+        <location filename="../../src/DkCore/DkUpdater.cpp" line="281"/>
+        <location filename="../../src/DkCore/DkUpdater.cpp" line="356"/>
         <source>updates</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkUpdater.cpp" line="272"/>
+        <location filename="../../src/DkCore/DkUpdater.cpp" line="274"/>
         <source>nomacs is up-to-date</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkUpdater.cpp" line="280"/>
+        <location filename="../../src/DkCore/DkUpdater.cpp" line="281"/>
         <source>sorry, unable to download the new version</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkCore/DkUpdater.cpp" line="350"/>
+        <location filename="../../src/DkCore/DkUpdater.cpp" line="356"/>
         <source>Unable to connect to server ... please try again later</source>
         <translation type="unfinished"></translation>
     </message>
@@ -6860,83 +6876,83 @@ Please contact your system administrator for further information.</source>
 <context>
     <name>nmc::DkViewPort</name>
     <message>
-        <location filename="../../src/DkGui/DkViewPort.cpp" line="272"/>
+        <location filename="../../src/DkGui/DkViewPort.cpp" line="286"/>
         <source>Original Image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkViewPort.cpp" line="714"/>
+        <location filename="../../src/DkGui/DkViewPort.cpp" line="713"/>
         <source>Resize</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkViewPort.cpp" line="738"/>
+        <location filename="../../src/DkGui/DkViewPort.cpp" line="736"/>
         <source>Shall I move %1 to trash?</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkViewPort.cpp" line="740"/>
+        <location filename="../../src/DkGui/DkViewPort.cpp" line="738"/>
         <source>Do you want to permanently delete %1?</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkViewPort.cpp" line="745"/>
+        <location filename="../../src/DkGui/DkViewPort.cpp" line="742"/>
         <source>Delete File</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkViewPort.cpp" line="816"/>
+        <location filename="../../src/DkGui/DkViewPort.cpp" line="810"/>
         <source>Error</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkViewPort.cpp" line="816"/>
+        <location filename="../../src/DkGui/DkViewPort.cpp" line="810"/>
         <source>Sorry, I could not create a wallpaper...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkViewPort.cpp" line="859"/>
+        <location filename="../../src/DkGui/DkViewPort.cpp" line="853"/>
         <source>Busy</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkViewPort.cpp" line="1557"/>
+        <location filename="../../src/DkGui/DkViewPort.cpp" line="1501"/>
         <source>Transparency Pattern Enabled</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkViewPort.cpp" line="1557"/>
+        <location filename="../../src/DkGui/DkViewPort.cpp" line="1501"/>
         <source>Transparency Pattern Disabled</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkViewPort.cpp" line="1595"/>
+        <location filename="../../src/DkGui/DkViewPort.cpp" line="1537"/>
         <source>Lenna</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkViewPort.cpp" line="1595"/>
+        <location filename="../../src/DkGui/DkViewPort.cpp" line="1537"/>
         <source>A remarkable woman</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkViewPort.cpp" line="1605"/>
+        <location filename="../../src/DkGui/DkViewPort.cpp" line="1546"/>
         <source>you cannot cancel this</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkViewPort.cpp" line="1613"/>
+        <location filename="../../src/DkGui/DkViewPort.cpp" line="1553"/>
         <source>did you understand the brainteaser?</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkViewPort.cpp" line="1615"/>
+        <location filename="../../src/DkGui/DkViewPort.cpp" line="1555"/>
         <source>%1 is wrong...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkViewPort.cpp" line="1648"/>
-        <location filename="../../src/DkGui/DkViewPort.cpp" line="1671"/>
+        <location filename="../../src/DkGui/DkViewPort.cpp" line="1588"/>
+        <location filename="../../src/DkGui/DkViewPort.cpp" line="1611"/>
         <source>Attempted to set NULL image</source>
         <translation type="unfinished"></translation>
     </message>
@@ -6944,7 +6960,7 @@ Please contact your system administrator for further information.</source>
 <context>
     <name>nmc::DkViewPortFrameless</name>
     <message>
-        <location filename="../../src/DkGui/DkViewPort.cpp" line="2144"/>
+        <location filename="../../src/DkGui/DkViewPort.cpp" line="2141"/>
         <source>Press F10 to exit Frameless view</source>
         <translation type="unfinished"></translation>
     </message>
@@ -6952,32 +6968,32 @@ Please contact your system administrator for further information.</source>
 <context>
     <name>nmc::DkWelcomeDialog</name>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="3739"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="3636"/>
         <source>Welcome</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="3748"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="3645"/>
         <source>Welcome to nomacs, please choose your preferred language below.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="3753"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="3650"/>
         <source>&amp;Register File Associations</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="3756"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="3653"/>
         <source>Set As &amp;Default Viewer</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="3761"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="3658"/>
         <source>&amp;OK</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../../src/DkGui/DkDialog.cpp" line="3762"/>
+        <location filename="../../src/DkGui/DkDialog.cpp" line="3659"/>
         <source>&amp;Cancel</source>
         <translation type="unfinished"></translation>
     </message>
diff --git a/ImageLounge/translations/src/update-translation.bat b/ImageLounge/translations/src/update-translation.bat
index ad2f6b9..9485ca3 100644
--- a/ImageLounge/translations/src/update-translation.bat
+++ b/ImageLounge/translations/src/update-translation.bat
@@ -1,6 +1,7 @@
-set lupdatePath="C:\Qt\5.14.2\msvc2017_64\bin\lupdate.exe"
+set lupdatePath="C:\Qt\5.15.2\msvc2019_64\bin\lupdate.exe"
 
 %lupdatePath%  ..\..\src\ -no-obsolete -ts nomacs.ts
 
 for %%f in (*.ts) DO %lupdatePath%  ..\..\src\ -no-obsolete -ts %%f
+pause
 
diff --git a/ImageLounge/xgd-data/nomacs.1 b/ImageLounge/xgd-data/nomacs.1
index d4cf968..cb1f74a 100644
--- a/ImageLounge/xgd-data/nomacs.1
+++ b/ImageLounge/xgd-data/nomacs.1
@@ -1,27 +1,125 @@
-.\"Created with GNOME Manpages Editor Wizard
-.\"http://sourceforge.net/projects/gmanedit2
-.TH nomacs 1 "July 13, 2012" "" "nomacs - ImageLounge"
-
+.\"                                      Hey, EMACS: -*- nroff -*-
+.TH nomacs 1 "October 24, 2022" "" "nomacs - ImageLounge"
+.\"----------------------------------------------------------------------------
 .SH NAME
 nomacs \- is a free, open source image viewer, which supports multiple platforms. 
-
+.\"----------------------------------------------------------------------------
 .SH SYNOPSIS
 .B nomacs
-.RI [ file ]
+.RI [file]
 .br
-
+.\"----------------------------------------------------------------------------
 .SH DESCRIPTION
-\fBnomacs\fP nomacs is a free, open source image viewer, which supports multiple platforms. You can use it for viewing all common image formats including RAW and psd images.
+.PP
+\fBnomacs\fP is a free, open source image viewer, which supports multiple platforms. You can use it for viewing all common image formats including RAW and psd images.
 nomacs includes image manipulation methods for adjusting brightness, contrast, saturation, hue, gamma, exposure. It has a pseudo color function which allows creating false color images. A unique feature of nomacs is the synchronization of multiple instances. With this feature you can easily compare images by zooming and/or panning at the exactly same position or even by overlaying them with different opacity.
 nomacs is licensed under the GNU General Public License v3 and available for Windows, Linux, FreeBSD, and OS/2. It is free for private and commercial use.
-
+.\"----------------------------------------------------------------------------
 .SH OPTIONS
-
-you can supply an image file to nomacs and it will open it immediately. 
-
+.PP
+The following is the list of the options you can use, but the minimum usage is just supplying the file or folder path to nomacs.
+.
+.PP
+\-\-batch <batch-settings-path>
+.RS 4
+Batch processing of <batch-settings.pnm>.
+.RE
+.
+.PP
+\-\-batch-log <log-path.txt>
+.RS 4
+Saves batch log to <log-path.txt>.
+.RE
+.
+.PP
+\-d, \-\-directory <directory>
+.RS 4
+Load all files in the <directory>.
+.RE
+.
+.PP
+\-f, \-\-fullscreen
+.RS 4
+Start in fullscreen.
+.RE
+.
+.PP
+\-h, \-\-help
+.RS 4
+Displays help on commandline options.
+.RE
+.
+.PP
+\-\-help-all
+.RS 4
+Displays help including Qt specific options.
+.RE
+.
+.PP
+\-\-import-settings <settings-path.ini>
+.RS 4
+Imports the settings from <settings-path.ini> and saves them.
+.RE
+.
+.PP
+\-m, \-\-mode <default | frameless | pseudocolor>
+.RS 4
+Set the viewing mode <mode>.
+.RE
+.
+.PP
+\-p, \-\-private
+.RS 4
+Start in private mode.
+.RE
+.
+.PP
+\-\-pong
+.RS 4
+Start Pong.
+.RE
+.
+.PP
+\-\-register-files
+.RS 4
+Register file associations (Windows only).
+.RE
+.
+.PP
+\-\-slideshow
+.RS 4
+Start slideshow playback.
+.RE
+.
+.PP
+\-t, \-\-tab <images>
+.RS 4
+Load <images> to tabs.
+.RE
+.
+.PP
+\-v, \-\-version
+.RS 4
+Displays version information.
+.RE
+.
+.\"----------------------------------------------------------------------------
+.SH ARGUMENTS
+.PP
+You can supply an image file to nomacs and it will open it immediately. 
+.\"----------------------------------------------------------------------------
+.SH SEE ALSO
+.PP
+You may also find more detailed online documentation on project homepage and Git repository.
+.
+.br
+• https://github.com/nomacs/nomacs
+.
+.\"----------------------------------------------------------------------------
 .SH AUTHORS
-Markus Diem <markus@nomacs.org>
-
-Stefan Fiel <stefan@nomacs.org>
-
-Florian Kleber <florian@nomacs.org>
+.PP
+• Markus Diem <markus@nomacs.org>
+.br
+• Stefan Fiel <stefan@nomacs.org>
+.br
+• Florian Kleber <florian@nomacs.org>
diff --git a/ImageLounge/xgd-data/org.nomacs.ImageLounge.desktop b/ImageLounge/xgd-data/org.nomacs.ImageLounge.desktop
index 6b9bddd..674faa9 100644
--- a/ImageLounge/xgd-data/org.nomacs.ImageLounge.desktop
+++ b/ImageLounge/xgd-data/org.nomacs.ImageLounge.desktop
@@ -2,12 +2,12 @@
 Name=nomacs
 GenericName=Image Viewer
 Comment=nomacs is a free, open source image viewer.
-Exec=nomacs %F
+Exec=nomacs %f
 Terminal=false
 Icon=org.nomacs.ImageLounge
 Type=Application
 Categories=Graphics;RasterGraphics;Viewer;2DGraphics;
-MimeType=image/gif;image/jpeg;image/png;image/bmp;image/tiff;image/x-eps;image/x-ico;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-xbitmap;image/x-xpixmap;
+MimeType=image/avif;image/bmp;image/gif;image/heic;image/heif;image/jpeg;image/jxl;image/png;image/tiff;image/webp;image/x-eps;image/x-ico;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-xbitmap;image/x-xpixmap;
 GenericName[de]=Bildbetrachter
 Comment[de]=Ressourcenschonender, plattformübergreifender Bildbetrachter mit Unterstützung für verschiedenste Formate
 Name[pt]=nomacs
diff --git a/README.md b/README.md
index 4680b34..90b4584 100644
--- a/README.md
+++ b/README.md
@@ -51,7 +51,7 @@ Get the required packages:
 sudo apt-get install debhelper cdbs qt5-qmake qttools5-dev-tools qt5-default qttools5-dev libqt5svg5-dev qt5-image-formats-plugins libexiv2-dev libraw-dev libopencv-dev cmake libtiff-dev libquazip5-dev libwebp-dev git build-essential lcov libzip-dev
 ```
 
-Get the nomacs sources from github:
+Clone the nomacs repository from GitHub:
 ``` console
 git clone https://github.com/nomacs/nomacs.git
 ```
@@ -96,12 +96,27 @@ Install required dependencies:
 $ brew install qt5 exiv2 opencv libraw quazip cmake pkg-config
 ```
 
+Clone the nomacs repository from GitHub:
+``` console
+git clone https://github.com/nomacs/nomacs.git
+```
+
 Go to the `nomacs` directory and run cmake to get the Makefiles:
 
 ``` console
+$ cd nomacs
 $ mkdir build
 $ cd build
-$ Qt5_DIR=/usr/local/opt/qt5/ cmake -DQT_QMAKE_EXECUTABLE=/usr/local/opt/qt5/bin ../ImageLounge/.
+```
+
+For Homebrew on Intel models:
+```console
+$ Qt5_DIR=/usr/local/opt/qt5/ cmake -DQT_QMAKE_EXECUTABLE=/usr/local/opt/qt5/bin/qmake ../ImageLounge/.
+```
+
+For Homebrew on Apple Silicon models:
+```console
+$ Qt5_DIR=/opt/homebrew/opt/qt5/ cmake -DQT_QMAKE_EXECUTABLE=/opt/homebrew/opt/qt5/bin/qmake ../ImageLounge/.
 ```
 
 Run make:
diff --git a/appveyor.yml b/appveyor.yml
index 780446b..abf5d79 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -10,7 +10,7 @@ skip_commits:
 environment:
     matrix:
     - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
-      QT5: C:\Qt\5.14\msvc2017_64
+      QT5: C:\Qt\5.15.2\msvc2019_64
       VCVARS: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat
       ARCHITECTURE: x86_64
       WARNINGS_AS_ERRORS: ON
@@ -53,3 +53,6 @@ artifacts:
     - path: 'installer/nomacs-setup-x64.exe'
       name: nomacs-multi-user-installer
 
+    - path: 'installer/nomacs.x64/translations'
+      name: translations
+      type: zip
diff --git a/debian/changelog b/debian/changelog
index e2bbf27..83d3e39 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+nomacs (3.17.2282+dfsg-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- Debian Janitor <janitor@jelmer.uk>  Wed, 19 Jul 2023 13:08:00 -0000
+
 nomacs (3.17.2206+dfsg-2) unstable; urgency=medium
 
   * Update Homepage (Closes: #974618).
diff --git a/debian/patches/0001-Return-dummy-treeish-in-git_tag.patch b/debian/patches/0001-Return-dummy-treeish-in-git_tag.patch
index c1ad41d..c7e63e6 100644
--- a/debian/patches/0001-Return-dummy-treeish-in-git_tag.patch
+++ b/debian/patches/0001-Return-dummy-treeish-in-git_tag.patch
@@ -7,10 +7,10 @@ Subject: Return dummy treeish in git_tag
  scripts/versionupdate.py | 6 +-----
  1 file changed, 1 insertion(+), 5 deletions(-)
 
-diff --git a/scripts/versionupdate.py b/scripts/versionupdate.py
-index 09e31a6..6a69f4b 100644
---- a/scripts/versionupdate.py
-+++ b/scripts/versionupdate.py
+Index: nomacs.git/scripts/versionupdate.py
+===================================================================
+--- nomacs.git.orig/scripts/versionupdate.py
++++ nomacs.git/scripts/versionupdate.py
 @@ -111,12 +111,8 @@ def add_git_tag_string(line):
      return line
  
diff --git a/installer/nomacs-setup.iss b/installer/nomacs-setup.iss
index d893a05..bd4fad7 100644
--- a/installer/nomacs-setup.iss
+++ b/installer/nomacs-setup.iss
@@ -51,8 +51,10 @@ Name: "resetsettings"; Description: "Reset user configs for current user"; Types
 Name: "fa"; Description: "File associations"; Types: full custom
 Name: "fa\3fr"; Description: ".3fr"; Types: full custom
 Name: "fa\arw"; Description: ".arw"; Types: full custom
+Name: "fa\avif"; Description: ".avif"; Types: full custom
 Name: "fa\bmp"; Description: ".bmp"; Types: full custom
-Name: "fa\cr2"; Description: ".crw"; Types: full custom
+Name: "fa\cr2"; Description: ".cr2"; Types: full custom
+Name: "fa\cr3"; Description: ".cr3"; Types: full custom
 Name: "fa\crw"; Description: ".crw"; Types: full custom
 Name: "fa\cur"; Description: ".cur"; Types: full custom
 Name: "fa\dng"; Description: ".dng"; Types: full custom
@@ -64,22 +66,23 @@ Name: "fa\heif"; Description: ".heif"; Types: full custom
 Name: "fa\heifs"; Description: ".heifs"; Types: full custom
 Name: "fa\icns"; Description: ".icns"; Types: full custom
 Name: "fa\iiq"; Description: ".iiq"; Types: full custom
-Name: "fa\j2k"; Description: ".jp2"; Types: full custom
+Name: "fa\j2k"; Description: ".j2k"; Types: full custom
 Name: "fa\jp2"; Description: ".jp2"; Types: full custom
-Name: "fa\jpe"; Description: ".jpg"; Types: full custom
-Name: "fa\jpeg"; Description: ".jpg"; Types: full custom
-Name: "fa\jpf"; Description: ".jp2"; Types: full custom
+Name: "fa\jpe"; Description: ".jpe"; Types: full custom
+Name: "fa\jpeg"; Description: ".jpeg"; Types: full custom
+Name: "fa\jpf"; Description: ".jpf"; Types: full custom
 Name: "fa\jpg"; Description: ".jpg"; Types: full custom
-Name: "fa\jpgx"; Description: ".jp2"; Types: full custom
-Name: "fa\jpm"; Description: ".jp2"; Types: full custom
+Name: "fa\jpgx"; Description: ".jpgx"; Types: full custom
+Name: "fa\jpm"; Description: ".jpm"; Types: full custom
 Name: "fa\jps"; Description: ".jps"; Types: full custom
-Name: "fa\jpx"; Description: ".jp2"; Types: full custom
+Name: "fa\jpx"; Description: ".jpx"; Types: full custom
+Name: "fa\jxl"; Description: ".jxl"; Types: full custom
 Name: "fa\mng"; Description: ".mng"; Types: full custom
 Name: "fa\mos"; Description: ".mos"; Types: full custom
 Name: "fa\mpo"; Description: ".mpo"; Types: full custom
 Name: "fa\mrw"; Description: ".mrw"; Types: full custom
 Name: "fa\nef"; Description: ".nef"; Types: full custom
-Name: "fa\nrw"; Description: ".nef"; Types: full custom
+Name: "fa\nrw"; Description: ".nrw"; Types: full custom
 Name: "fa\orf"; Description: ".orf"; Types: full custom
 Name: "fa\pbm"; Description: ".pbm"; Types: full custom
 Name: "fa\pef"; Description: ".pef"; Types: full custom
@@ -92,13 +95,13 @@ Name: "fa\psd"; Description: ".psd"; Types: full custom
 Name: "fa\raf"; Description: ".raf"; Types: full custom
 Name: "fa\raw"; Description: ".raw"; Types: full custom
 Name: "fa\roh"; Description: ".roh"; Types: full custom
-Name: "fa\rw2"; Description: ".raw"; Types: full custom
+Name: "fa\rw2"; Description: ".rw2"; Types: full custom
 Name: "fa\srw"; Description: ".srw"; Types: full custom
 Name: "fa\svg"; Description: ".svg"; Types: full custom
-Name: "fa\svgz"; Description: ".svg"; Types: full custom
+Name: "fa\svgz"; Description: ".svgz"; Types: full custom
 Name: "fa\tga"; Description: ".tga"; Types: full custom
 Name: "fa\tif"; Description: ".tif"; Types: full custom
-Name: "fa\tiff"; Description: ".tif"; Types: full custom
+Name: "fa\tiff"; Description: ".tiff"; Types: full custom
 Name: "fa\vec"; Description: ".vec"; Types: full custom
 Name: "fa\wbmp"; Description: ".wbmp"; Types: full custom
 Name: "fa\webp"; Description: ".webp"; Types: full custom
@@ -226,8 +229,10 @@ Name: "tr"; MessagesFile: "compiler:Languages\Turkish.isl"
 [Registry]
 Root: HKA; Subkey: "Software\Classes\.3fr"; ValueType: string; ValueName: ""; ValueData: "nomacs.3fr.3"; Flags: uninsdeletevalue; Components: fa\3fr
 Root: HKA; Subkey: "Software\Classes\.arw"; ValueType: string; ValueName: ""; ValueData: "nomacs.arw.3"; Flags: uninsdeletevalue; Components: fa\arw
+Root: HKA; Subkey: "Software\Classes\.avif"; ValueType: string; ValueName: ""; ValueData: "nomacs.avif.3"; Flags: uninsdeletevalue; Components: fa\avif
 Root: HKA; Subkey: "Software\Classes\.bmp"; ValueType: string; ValueName: ""; ValueData: "nomacs.bmp.3"; Flags: uninsdeletevalue; Components: fa\bmp
 Root: HKA; Subkey: "Software\Classes\.cr2"; ValueType: string; ValueName: ""; ValueData: "nomacs.crw.3"; Flags: uninsdeletevalue; Components: fa\cr2
+Root: HKA; Subkey: "Software\Classes\.cr3"; ValueType: string; ValueName: ""; ValueData: "nomacs.crw.3"; Flags: uninsdeletevalue; Components: fa\cr3
 Root: HKA; Subkey: "Software\Classes\.crw"; ValueType: string; ValueName: ""; ValueData: "nomacs.crw.3"; Flags: uninsdeletevalue; Components: fa\crw
 Root: HKA; Subkey: "Software\Classes\.cur"; ValueType: string; ValueName: ""; ValueData: "nomacs.cur.3"; Flags: uninsdeletevalue; Components: fa\cur
 Root: HKA; Subkey: "Software\Classes\.dng"; ValueType: string; ValueName: ""; ValueData: "nomacs.dng.3"; Flags: uninsdeletevalue; Components: fa\dng
@@ -249,6 +254,7 @@ Root: HKA; Subkey: "Software\Classes\.jpgx"; ValueType: string; ValueName: ""; V
 Root: HKA; Subkey: "Software\Classes\.jpm"; ValueType: string; ValueName: ""; ValueData: "nomacs.jp2.3"; Flags: uninsdeletevalue; Components: fa\jpm
 Root: HKA; Subkey: "Software\Classes\.jps"; ValueType: string; ValueName: ""; ValueData: "nomacs.jps.3"; Flags: uninsdeletevalue; Components: fa\jps
 Root: HKA; Subkey: "Software\Classes\.jpx"; ValueType: string; ValueName: ""; ValueData: "nomacs.jp2.3"; Flags: uninsdeletevalue; Components: fa\jpx
+Root: HKA; Subkey: "Software\Classes\.jxl"; ValueType: string; ValueName: ""; ValueData: "nomacs.jxl.3"; Flags: uninsdeletevalue; Components: fa\jxl
 Root: HKA; Subkey: "Software\Classes\.mng"; ValueType: string; ValueName: ""; ValueData: "nomacs.mng.3"; Flags: uninsdeletevalue; Components: fa\mng
 Root: HKA; Subkey: "Software\Classes\.mos"; ValueType: string; ValueName: ""; ValueData: "nomacs.mos.3"; Flags: uninsdeletevalue; Components: fa\mos
 Root: HKA; Subkey: "Software\Classes\.mpo"; ValueType: string; ValueName: ""; ValueData: "nomacs.mpo.3"; Flags: uninsdeletevalue; Components: fa\mpo
@@ -283,6 +289,7 @@ Root: HKA; Subkey: "Software\Classes\.xpm"; ValueType: string; ValueName: ""; Va
 
 Root: HKA; Subkey: "Software\Classes\nomacs.3fr.3"; ValueType: string; ValueName: ""; ValueData: "Hasselblad Raw"; Flags: uninsdeletekey; Components: fa
 Root: HKA; Subkey: "Software\Classes\nomacs.arw.3"; ValueType: string; ValueName: ""; ValueData: "Sony Raw"; Flags: uninsdeletekey; Components: fa
+Root: HKA; Subkey: "Software\Classes\nomacs.avif.3"; ValueType: string; ValueName: ""; ValueData: "AV1 Image File Format"; Flags: uninsdeletekey; Components: fa
 Root: HKA; Subkey: "Software\Classes\nomacs.bmp.3"; ValueType: string; ValueName: ""; ValueData: "Windows Bitmap"; Flags: uninsdeletekey; Components: fa
 Root: HKA; Subkey: "Software\Classes\nomacs.crw.3"; ValueType: string; ValueName: ""; ValueData: "Canon Raw"; Flags: uninsdeletekey; Components: fa
 Root: HKA; Subkey: "Software\Classes\nomacs.cur.3"; ValueType: string; ValueName: ""; ValueData: "Windows Cursor Files"; Flags: uninsdeletekey; Components: fa
@@ -298,6 +305,7 @@ Root: HKA; Subkey: "Software\Classes\nomacs.iiq.3"; ValueType: string; ValueName
 Root: HKA; Subkey: "Software\Classes\nomacs.jp2.3"; ValueType: string; ValueName: ""; ValueData: "JPEG 2000"; Flags: uninsdeletekey; Components: fa
 Root: HKA; Subkey: "Software\Classes\nomacs.jpg.3"; ValueType: string; ValueName: ""; ValueData: "JPEG"; Flags: uninsdeletekey; Components: fa
 Root: HKA; Subkey: "Software\Classes\nomacs.jps.3"; ValueType: string; ValueName: ""; ValueData: "JPEG Stereo"; Flags: uninsdeletekey; Components: fa
+Root: HKA; Subkey: "Software\Classes\nomacs.jxl.3"; ValueType: string; ValueName: ""; ValueData: "JPEG XL"; Flags: uninsdeletekey; Components: fa
 Root: HKA; Subkey: "Software\Classes\nomacs.mng.3"; ValueType: string; ValueName: ""; ValueData: "Multi-Image Network Graphics"; Flags: uninsdeletekey; Components: fa
 Root: HKA; Subkey: "Software\Classes\nomacs.mos.3"; ValueType: string; ValueName: ""; ValueData: "Leaf Raw"; Flags: uninsdeletekey; Components: fa
 Root: HKA; Subkey: "Software\Classes\nomacs.mpo.3"; ValueType: string; ValueName: ""; ValueData: "Multi Picture Object"; Flags: uninsdeletekey; Components: fa
@@ -328,6 +336,7 @@ Root: HKA; Subkey: "Software\Classes\nomacs.xpm.3"; ValueType: string; ValueName
 
 Root: HKA; Subkey: "Software\Classes\nomacs.3fr.3\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\bin\nomacs.exe,5"; Components: fa
 Root: HKA; Subkey: "Software\Classes\nomacs.arw.3\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\bin\nomacs.exe,5"; Components: fa
+Root: HKA; Subkey: "Software\Classes\nomacs.avif.3\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\bin\nomacs.exe,0"; Components: fa
 Root: HKA; Subkey: "Software\Classes\nomacs.bmp.3\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\bin\nomacs.exe,4"; Components: fa
 Root: HKA; Subkey: "Software\Classes\nomacs.crw.3\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\bin\nomacs.exe,5"; Components: fa
 Root: HKA; Subkey: "Software\Classes\nomacs.cur.3\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\bin\nomacs.exe,0"; Components: fa
@@ -343,6 +352,7 @@ Root: HKA; Subkey: "Software\Classes\nomacs.iiq.3\DefaultIcon"; ValueType: strin
 Root: HKA; Subkey: "Software\Classes\nomacs.jp2.3\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\bin\nomacs.exe,0"; Components: fa
 Root: HKA; Subkey: "Software\Classes\nomacs.jpg.3\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\bin\nomacs.exe,1"; Components: fa
 Root: HKA; Subkey: "Software\Classes\nomacs.jps.3\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\bin\nomacs.exe,0"; Components: fa
+Root: HKA; Subkey: "Software\Classes\nomacs.jxl.3\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\bin\nomacs.exe,0"; Components: fa
 Root: HKA; Subkey: "Software\Classes\nomacs.mng.3\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\bin\nomacs.exe,2"; Components: fa
 Root: HKA; Subkey: "Software\Classes\nomacs.mos.3\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\bin\nomacs.exe,5"; Components: fa
 Root: HKA; Subkey: "Software\Classes\nomacs.mpo.3\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\bin\nomacs.exe,0"; Components: fa
@@ -373,6 +383,7 @@ Root: HKA; Subkey: "Software\Classes\nomacs.xpm.3\DefaultIcon"; ValueType: strin
 
 Root: HKA; Subkey: "Software\Classes\nomacs.3fr.3\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\bin\nomacs.exe"" ""%1"""; Components: fa
 Root: HKA; Subkey: "Software\Classes\nomacs.arw.3\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\bin\nomacs.exe"" ""%1"""; Components: fa
+Root: HKA; Subkey: "Software\Classes\nomacs.avif.3\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\bin\nomacs.exe"" ""%1"""; Components: fa
 Root: HKA; Subkey: "Software\Classes\nomacs.bmp.3\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\bin\nomacs.exe"" ""%1"""; Components: fa
 Root: HKA; Subkey: "Software\Classes\nomacs.crw.3\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\bin\nomacs.exe"" ""%1"""; Components: fa
 Root: HKA; Subkey: "Software\Classes\nomacs.cur.3\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\bin\nomacs.exe"" ""%1"""; Components: fa
@@ -388,6 +399,7 @@ Root: HKA; Subkey: "Software\Classes\nomacs.iiq.3\shell\open\command"; ValueType
 Root: HKA; Subkey: "Software\Classes\nomacs.jp2.3\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\bin\nomacs.exe"" ""%1"""; Components: fa
 Root: HKA; Subkey: "Software\Classes\nomacs.jpg.3\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\bin\nomacs.exe"" ""%1"""; Components: fa
 Root: HKA; Subkey: "Software\Classes\nomacs.jps.3\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\bin\nomacs.exe"" ""%1"""; Components: fa
+Root: HKA; Subkey: "Software\Classes\nomacs.jxl.3\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\bin\nomacs.exe"" ""%1"""; Components: fa
 Root: HKA; Subkey: "Software\Classes\nomacs.mng.3\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\bin\nomacs.exe"" ""%1"""; Components: fa
 Root: HKA; Subkey: "Software\Classes\nomacs.mos.3\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\bin\nomacs.exe"" ""%1"""; Components: fa
 Root: HKA; Subkey: "Software\Classes\nomacs.mpo.3\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\bin\nomacs.exe"" ""%1"""; Components: fa
diff --git a/installer/sign.bat b/installer/sign.bat
index 81f367f..d82eb7d 100644
--- a/installer/sign.bat
+++ b/installer/sign.bat
@@ -8,7 +8,7 @@ REM sign with the repositorie's certificate (password has to be provided)
 
 echo online signing...
 echo arg: %2
-signtool sign /t http://timestamp.digicert.com /f ./cert-2018.p12 /p %2 /a %~1
+REM signtool sign /t http://timestamp.digicert.com /f ./cert-2018.p12 /fd certHash /p %2 /a %~1
 goto end
 
 REM REM set code page to utf-8 (for german umlaute)
@@ -18,4 +18,4 @@ REM chcp 65001
 REM REM sign using the installed certificate
 REM signtool sign /n "Technische Universität Wien" /t http://timestamp.digicert.com %~1
 
-:end
\ No newline at end of file
+:end
diff --git a/scripts/make.py b/scripts/make.py
index 8daf6ad..c671599 100644
--- a/scripts/make.py
+++ b/scripts/make.py
@@ -29,6 +29,7 @@ class NomacsConfig(Config):
             "-DENABLE_TRANSLATIONS=ON",
             "-DENABLE_HEIF=ON",
             "-DENABLE_AVIF=ON",
+            "-DENABLE_JXL=ON",
             "-DENABLE_INCREMENTER=ON",
             "-B" + self.builddir,
             self.srcpath
@@ -58,7 +59,6 @@ class ExpatConfig(Config):
 
         # tune cmake parameters here
         args = [
-            "--clean-first",
             "-DBUILD_examples=OFF",
             "-DBUILD_tests=OFF",
             "-B" + self.builddir,
@@ -93,9 +93,11 @@ class ExifConfig(Config):
 
         # tune cmake parameters here
         args = self.additional_cmake_args + [
-            "--clean-first",
             "-DEXPAT_BUILD_PATH=" + self.libpath + "/expat",
             "-DEXPAT_INCLUDE_DIR=" + self.repopath + "/expat/lib",
+            "-DEXIV2_ENABLE_BMFF=ON",
+            "-DEXIV2_BUILD_EXIV2_COMMAND=OFF",
+            "-DEXIV2_BUILD_SAMPLES=OFF",
             "-B" + self.builddir,
             self.srcpath
         ]
@@ -124,7 +126,6 @@ class LibrawConfig(Config):
 
         # tune cmake parameters here
         args = self.additional_cmake_args + [
-            "--clean-first",
             "-DENABLE_EXAMPLES=OFF",
             "-B" + self.builddir,
             self.srcpath
@@ -157,7 +158,6 @@ class QuazipConfig(Config):
 
         # tune cmake parameters here
         args = self.additional_cmake_args + [
-            "--clean-first",
             "-DCMAKE_PREFIX_PATH=" + self.qtpath,
             "-B" + self.builddir,
             self.srcpath
@@ -194,7 +194,7 @@ class OpenCVConfig(Config):
 
         # FIXME: release is generated by cmake - so this is not enough to ask for...
         self.binaryfile = os.path.join(
-            self.builddir, "bin", "Release", "opencv_core430.dll")
+            self.builddir, "bin", "Release", "opencv_core455.dll")
 
     def cmake_zlib(self):
 
@@ -209,7 +209,6 @@ class OpenCVConfig(Config):
 
         # tune cmake parameters here
         args = [
-            "--clean-first",
             "-DBUILD_PERF_TESTS=OFF",
             "-DBUILD_TESTS=OFF",
             "-DBUILD_opencv_java=OFF",
@@ -255,10 +254,9 @@ class FormatsConfig(Config):
 
         # tune cmake parameters here
         args = [
-            "--clean-first",
             "-DCMAKE_PREFIX_PATH=" +
-            os.path.join(self.libpath, "libde265") + ";" +
-            os.path.join(self.libpath, "libheif") + ";" +
+            # os.path.join(self.libpath, "libde265") + ";" +
+            # os.path.join(self.libpath, "libheif") + ";" +
             self.qtpath,
             "-B" + self.builddir,
             self.srcpath
@@ -303,16 +301,16 @@ def make_imageformats(params):
     params['install'] = False
 
     # config libde265 which we need for libheif
-    libde265 = FormatsConfig(params, "libde265")
-    libde265.builddir = os.path.join(libde265.builddir, libde265.name)
-    libde265.binaryfile = os.path.join(libde265.builddir, libde265.name, "Release", libde265.name + ".dll")
-    build(libde265)
+    # libde265 = FormatsConfig(params, "libde265")
+    # libde265.builddir = os.path.join(libde265.builddir, libde265.name)
+    # libde265.binaryfile = os.path.join(libde265.builddir, libde265.name, "Release", libde265.name + ".dll")
+    # build(libde265)
     
     # config libheif
-    libheif = FormatsConfig(params, "libheif")
-    libheif.builddir = os.path.join(libheif.builddir, libheif.name)
-    libheif.binaryfile = os.path.join(libheif.builddir, "libheif", "Release", "heif.dll")
-    build(libheif)
+    # libheif = FormatsConfig(params, "libheif")
+    # libheif.builddir = os.path.join(libheif.builddir, libheif.name)
+    # libheif.binaryfile = os.path.join(libheif.builddir, "libheif", "Release", "heif.dll")
+    # build(libheif)
     
     # configure image formats
     params["srcpath"] = params["repopath"]
diff --git a/scripts/utils/fun.py b/scripts/utils/fun.py
index 5fb1f66..78ba4c3 100644
--- a/scripts/utils/fun.py
+++ b/scripts/utils/fun.py
@@ -27,7 +27,7 @@ def version():
     vp = version_cache()
 
     with open(vp, "r") as src:
-        for l in src.readlines():
+        for l in src.read().splitlines():
 
             # assuming: version: 3.15.0.1444
             pl = l.split(":")
diff --git a/scripts/utils/version.cache b/scripts/utils/version.cache
index 0cf0d7d..249be33 100644
--- a/scripts/utils/version.cache
+++ b/scripts/utils/version.cache
@@ -1 +1 @@
-version:3.17.2204
\ No newline at end of file
+version:3.17.2282
\ No newline at end of file

Debdiff

[The following lists of changes regard files as different if they have different names, permissions or owners.]

Files in second set of .debs but not in first

-rw-r--r--  root/root   /usr/lib/debug/.build-id/9f/cde99cca17ada8b2b1c7b0ee7bacb2e95d95a6.debug
-rw-r--r--  root/root   /usr/lib/debug/.build-id/fa/7fea695bcb98b351b3c3d0c375c17e81e7c81b.debug

Files in first set of .debs but not in second

-rw-r--r--  root/root   /usr/lib/debug/.build-id/49/519e167f2f69f726a5c1aa678c7ef6ab3322c1.debug
-rw-r--r--  root/root   /usr/lib/debug/.build-id/c0/a75adea232919ca610c74ed981666caf8ec3bc.debug

Control files of package nomacs: lines which differ (wdiff format)

  • Depends: libc6 (>= 2.34), libexiv2-27 (>= 0.27.2), 0.27.5), libgcc-s1 (>= 3.0), libopencv-core406 (>= 4.6.0+dfsg), libopencv-imgproc406 (>= 4.6.0+dfsg), libqt5concurrent5 (>= 5.6.0~rc), libqt5core5a (>= 5.15.1), libqt5gui5 (>= 5.14.1) | libqt5gui5-gles (>= 5.14.1), libqt5network5 (>= 5.0.2), libqt5printsupport5 (>= 5.2.0), libqt5svg5 (>= 5.6.0~beta), libqt5widgets5 (>= 5.15.1), libquazip5-1 (>= 0.7.3), libraw23 (>= 0.21.1), libstdc++6 (>= 11), 13.1), libtiff6 (>= 4.0.3), qt5-image-formats-plugins

Control files of package nomacs-dbgsym: lines which differ (wdiff format)

  • Build-Ids: 49519e167f2f69f726a5c1aa678c7ef6ab3322c1 c0a75adea232919ca610c74ed981666caf8ec3bc 9fcde99cca17ada8b2b1c7b0ee7bacb2e95d95a6 fa7fea695bcb98b351b3c3d0c375c17e81e7c81b

No differences were encountered between the control files of package nomacs-l10n

More details

Full run details