From 75af31920b96152ac030ec4765597733de8b1e64 Mon Sep 17 00:00:00 2001 From: Alf Gaida Date: Thu, 22 Dec 2016 03:03:43 +0100 Subject: [PATCH] Cherry-picking upstream release 0.5.1. * Removed build dependencies: - cmake - liblxqt0-dev - libqt5xdg-dev - pkg-config - qttools5-dev - qttools5-dev-tools * Bumped minimum version libfm-qt-dev (>= 0.11.2) * Added build dependency lxqt-build-tools (>= 0.3.0) --- .gitignore | 3 - CHANGELOG | 17 +++++- CMakeLists.txt | 18 ++---- debian/changelog | 15 +++++ debian/control | 9 +-- src/mainwindow.cpp | 61 ++++++++++++++++--- src/mainwindow.h | 2 + src/mainwindow.ui | 12 ++++ .../lximage-qt-screenshot_da.desktop | 3 + .../lximage-qt-screenshot_fr.desktop | 4 ++ .../lximage-qt-screenshot_it.desktop | 4 ++ src/translations/lximage-qt_da.desktop | 3 + src/translations/lximage-qt_fr.desktop | 4 ++ 13 files changed, 121 insertions(+), 34 deletions(-) delete mode 100644 .gitignore create mode 100644 src/translations/lximage-qt-screenshot_da.desktop create mode 100644 src/translations/lximage-qt-screenshot_fr.desktop create mode 100644 src/translations/lximage-qt-screenshot_it.desktop create mode 100644 src/translations/lximage-qt_da.desktop create mode 100644 src/translations/lximage-qt_fr.desktop diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 48cd491..0000000 --- a/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -build -*.kdev4 -src/translations/lximage-qt diff --git a/CHANGELOG b/CHANGELOG index 3f6bc71..4f0abd0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,22 @@ -lximage-qt-0.5.0 / 2016-09-24 +lximage-qt-0.5.1 / 2016-12-21 ============================= + * Bump patch version and (#82) + * Create lximage-qt-screenshot_it.desktop (#83) + * Add *da.desktop files + * Desktop entry files: Fix typo in French translation + * [MRG] Display first image when loading a directory (v2) (#75) + * Desktop entry files: Add French translation + * Use lxqt-build-tools + * Use the new lxqt-build-tools package + * Fixed A Cast (#71) + * Remove cpack (#70) + +0.5.0 / 2016-09-24 +================== + + * Release 0.5.0: Add changelog * Bump version to 0.5.0 (#67) * Remove Core and Qt from Categories in desktop file (#64) * Extend README.md diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b0b270..3e0b354 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,17 +1,18 @@ cmake_minimum_required(VERSION 3.0.2) - project(lximage-qt) include(GNUInstallDirs) set(MAJOR_VERSION 0) set(MINOR_VERSION 5) -set(PATCH_VERSION 0) +set(PATCH_VERSION 1) set(LXIMAGE_VERSION ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}) +set(LXQTBT_MINIMUM_VERSION "0.3.0") + +set(CMAKE_AUTOMOC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON) -set(CMAKE_AUTOMOC ON) find_package(Qt5Widgets REQUIRED) find_package(Qt5DBus REQUIRED) @@ -20,7 +21,7 @@ find_package(Qt5X11Extras REQUIRED QUIET) find_package(Qt5LinguistTools REQUIRED QUIET) find_package(Qt5Svg REQUIRED QUIET) find_package(fm-qt REQUIRED QUIET) -find_package(lxqt REQUIRED) #just a build dependency for .desktop files translation +find_package(lxqt-build-tools ${LXQTBT_MINIMUM_VERSION} REQUIRED) message(STATUS "Building with Qt ${Qt5Core_VERSION_STRING}") include(LXQtCompilerSettings NO_POLICY_SCOPE) @@ -46,12 +47,3 @@ install( DESTINATION "${CMAKE_INSTALL_DATADIR}/icons/hicolor/48x48/apps" ) -# building tarball with CPack ------------------------------------------------- -include(InstallRequiredSystemLibraries) -set(CPACK_PACKAGE_VERSION_MAJOR ${MAJOR_VERSION}) -set(CPACK_PACKAGE_VERSION_MINOR ${MINOR_VERSION}) -set(CPACK_PACKAGE_VERSION_PATCH ${PATCH_VERSION}) -set(CPACK_GENERATOR TBZ2) -set(CPACK_SOURCE_GENERATOR TBZ2) -set(CPACK_SOURCE_IGNORE_FILES /build/;.gitignore;.*~;.git;.kdev4;temp) -include(CPack) diff --git a/debian/changelog b/debian/changelog index 79fce9b..52a8e83 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,18 @@ +lximage-qt (0.5.1-1) unstable; urgency=medium + + * Cherry-picking upstream release 0.5.1. + * Removed build dependencies: + - cmake + - liblxqt0-dev + - libqt5xdg-dev + - pkg-config + - qttools5-dev + - qttools5-dev-tools + * Bumped minimum version libfm-qt-dev (>= 0.11.2) + * Added build dependency lxqt-build-tools (>= 0.3.0) + + -- Alf Gaida Thu, 22 Dec 2016 02:59:30 +0100 + lximage-qt (0.5.0-4) unstable; urgency=medium * Fixes Recommends lxqtimage-qt-l10n to lximage-qt-l10n diff --git a/debian/control b/debian/control index e821256..06ab901 100644 --- a/debian/control +++ b/debian/control @@ -6,22 +6,17 @@ Uploaders: Alf Gaida , Section: x11 Priority: optional Build-Depends: debhelper (>= 10), - cmake (>= 3.0.2), libexif-dev, libglib2.0-dev, libfm-dev, - libfm-qt-dev (>= 0.11.1), + libfm-qt-dev (>= 0.11.2), libkf5windowsystem-dev, - liblxqt0-dev (>= 0.11.0), libmenu-cache-dev, libqt5svg5-dev, libqt5x11extras5-dev, - libqt5xdg-dev (>= 2.0.0), libx11-dev, libxfixes-dev, - pkg-config, - qttools5-dev, - qttools5-dev-tools + lxqt-build-tools (>= 0.3.0) Standards-Version: 3.9.8 Vcs-Browser: https://anonscm.debian.org/cgit/pkg-lxqt/lximage-qt.git/?h=debian/sid Vcs-Git: https://anonscm.debian.org/git/pkg-lxqt/lximage-qt.git -b debian/sid diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 94b4795..795e184 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -19,6 +19,8 @@ #include "mainwindow.h" +#include +#include #include #include #include @@ -184,6 +186,9 @@ void MainWindow::onFolderLoaded(FmFolder* folder) { thumbnailsView_->childView()->scrollTo(currentIndex_, QAbstractItemView::EnsureVisible); } } + // this is used to open the first image of a folder + else if (currentFile_ == nullptr) + on_actionFirst_triggered(); } void MainWindow::openImageFile(QString fileName) { @@ -193,9 +198,31 @@ void MainWindow::openImageFile(QString fileName) { fm_path_unref(path); return; } - // load the image file asynchronously - loadImage(path); - loadFolder(fm_path_get_parent(path)); + if (QFileInfo(fileName).isDir()) { + if(fm_path_equal(path, folderPath_)) { + fm_path_unref(path); + return; + } + QList formats = QImageReader::supportedImageFormats(); + QStringList formatsFilters; + for (const QByteArray& format: formats) + formatsFilters << QString("*.") + format; + QDir dir(fileName); + dir.setNameFilters(formatsFilters); + dir.setFilter(QDir::Files | QDir::NoDotAndDotDot); + if(dir.entryList().isEmpty()) { + fm_path_unref(path); + return; + } + if(currentFile_) + fm_path_unref(currentFile_); + currentFile_ = nullptr; + loadFolder(path); + } else { + // load the image file asynchronously + loadImage(path); + loadFolder(fm_path_get_parent(path)); + } fm_path_unref(path); } @@ -243,6 +270,12 @@ QString MainWindow::openFileName() { return fileName; } +QString MainWindow::openDirectory() { + QString directory = QFileDialog::getExistingDirectory(this, + tr("Open directory"), QString()); + return directory; +} + // popup a file dialog and retrieve the selected image file name QString MainWindow::saveFileName(QString defaultName) { QString filterStr; @@ -275,6 +308,13 @@ void MainWindow::on_actionOpenFile_triggered() { } } +void MainWindow::on_actionOpenDirectory_triggered() { + QString directory = openDirectory(); + if(!directory.isEmpty()) { + openImageFile(directory); + } +} + void MainWindow::on_actionNewWindow_triggered() { Application* app = static_cast(qApp); MainWindow* window = new MainWindow(); @@ -646,19 +686,19 @@ QGraphicsItem* MainWindow::getGraphicsItem() { void MainWindow::on_actionRotateClockwise_triggered() { QGraphicsItem *graphItem = getGraphicsItem(); + bool isGifOrSvg (graphItem->isWidget() // we have gif animation + || dynamic_cast(graphItem)); // an SVG image; if(!image_.isNull()) { QTransform transform; transform.rotate(90.0); image_ = image_.transformed(transform, Qt::SmoothTransformation); /* when this is GIF or SVG, we need to rotate its corresponding QImage without showing it to have the right measure for auto-zooming */ - ui.view->setImage(image_, graphItem->isWidget() // we have gif animation - || static_cast(graphItem) // an SVG image - ? false : true); + ui.view->setImage(image_, isGifOrSvg ? false : true); setModified(true); } - if(graphItem) { + if(isGifOrSvg) { QTransform transform; transform.translate(graphItem->sceneBoundingRect().height(), 0); transform.rotate(90); @@ -671,16 +711,17 @@ void MainWindow::on_actionRotateClockwise_triggered() { void MainWindow::on_actionRotateCounterclockwise_triggered() { QGraphicsItem *graphItem = getGraphicsItem(); + bool isGifOrSvg (graphItem->isWidget() + || dynamic_cast(graphItem)); if(!image_.isNull()) { QTransform transform; transform.rotate(-90.0); image_ = image_.transformed(transform, Qt::SmoothTransformation); - ui.view->setImage(image_, graphItem->isWidget() || static_cast(graphItem) - ? false : true); + ui.view->setImage(image_, isGifOrSvg ? false : true); setModified(true); } - if(graphItem) { + if(isGifOrSvg) { QTransform transform; transform.translate(0, graphItem->sceneBoundingRect().width()); transform.rotate(-90); diff --git a/src/mainwindow.h b/src/mainwindow.h index 0139484..60cb18b 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -74,6 +74,7 @@ protected: void saveImage(FmPath* filePath); // save current image to a file void loadFolder(FmPath* newFolderPath); QString openFileName(); + QString openDirectory(); QString saveFileName(QString defaultName = QString()); virtual void changeEvent(QEvent * event); virtual void resizeEvent(QResizeEvent *event); @@ -87,6 +88,7 @@ private Q_SLOTS: void on_actionAbout_triggered(); void on_actionOpenFile_triggered(); + void on_actionOpenDirectory_triggered(); void on_actionNewWindow_triggered(); void on_actionSave_triggered(); void on_actionSaveAs_triggered(); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index ad78add..c67fa6d 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -56,6 +56,7 @@ + @@ -454,6 +455,17 @@ File Properties + + + + + + Open &Directory + + + Ctrl+D + + diff --git a/src/translations/lximage-qt-screenshot_da.desktop b/src/translations/lximage-qt-screenshot_da.desktop new file mode 100644 index 0000000..b6ea3c6 --- /dev/null +++ b/src/translations/lximage-qt-screenshot_da.desktop @@ -0,0 +1,3 @@ +Name[da]=Skærmbillede +GenericName[da]=Skærmbillede +Comment[da]=Tag et skærmbillede diff --git a/src/translations/lximage-qt-screenshot_fr.desktop b/src/translations/lximage-qt-screenshot_fr.desktop new file mode 100644 index 0000000..de415a0 --- /dev/null +++ b/src/translations/lximage-qt-screenshot_fr.desktop @@ -0,0 +1,4 @@ +#Translations +Name[fr]=Copie d'écran +GenericName[fr]=Copie d'écran +Comment[fr]=Faire une copie d'écran diff --git a/src/translations/lximage-qt-screenshot_it.desktop b/src/translations/lximage-qt-screenshot_it.desktop new file mode 100644 index 0000000..5de747b --- /dev/null +++ b/src/translations/lximage-qt-screenshot_it.desktop @@ -0,0 +1,4 @@ +#Translations +Name[it]=Cattura schermata +GenericName[it]=Cattura una schermata +Comment[it]=Catturare una schermata diff --git a/src/translations/lximage-qt_da.desktop b/src/translations/lximage-qt_da.desktop new file mode 100644 index 0000000..b7143c3 --- /dev/null +++ b/src/translations/lximage-qt_da.desktop @@ -0,0 +1,3 @@ +Name[da]=LXImage +GenericName[da]=Billedfremviser +Comment[da]=LXQt-billedfremviseren diff --git a/src/translations/lximage-qt_fr.desktop b/src/translations/lximage-qt_fr.desktop new file mode 100644 index 0000000..82200c3 --- /dev/null +++ b/src/translations/lximage-qt_fr.desktop @@ -0,0 +1,4 @@ +#Translation +Name[fr]=LXImage +GenericName[fr]=Visionneuse d'images +Comment[fr]=Visionneuse d'images de LXQt