diff options
Diffstat (limited to 'user/skanlite')
-rw-r--r-- | user/skanlite/APKBUILD | 51 | ||||
-rw-r--r-- | user/skanlite/fix-version.patch | 23 | ||||
-rw-r--r-- | user/skanlite/png-review-129988.patch | 99 | ||||
-rw-r--r-- | user/skanlite/review-129989.patch | 72 |
4 files changed, 245 insertions, 0 deletions
diff --git a/user/skanlite/APKBUILD b/user/skanlite/APKBUILD new file mode 100644 index 000000000..c0f3194c5 --- /dev/null +++ b/user/skanlite/APKBUILD @@ -0,0 +1,51 @@ +# Contributor: A. Wilcox <awilfox@adelielinux.org> +# Maintainer: A. Wilcox <awilfox@adelielinux.org> +pkgname=skanlite +pkgver=2.0.1 +pkgrel=0 +pkgdesc="Simple image scanning application" +url="https://www.kde.org/applications/graphics/skanlite/" +arch="all" +license="GPL-2.0+" +depends="" +makedepends="cmake extra-cmake-modules qt5-qtbase-dev libksane-dev kio-dev + kcoreaddons-dev ki18n-dev kxmlgui-dev kdoctools-dev libpng-dev zlib-dev + ktextwidgets-dev" +install="" +subpackages="$pkgname-doc $pkgname-lang" +source="https://download.kde.org/stable/skanlite/2.0/skanlite-$pkgver.tar.xz + fix-version.patch + review-129989.patch + png-review-129988.patch" +builddir="$srcdir/skanlite-$pkgver" + +build() { + cd "$builddir" + if [ "$CBUILD" != "$CHOST" ]; then + CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux" + fi + cmake \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -DBUILD_SHARED_LIBS=True \ + -DCMAKE_BUILD_TYPE=RelWithDebugInfo \ + -DCMAKE_CXX_FLAGS="$CXXFLAGS" \ + -DCMAKE_C_FLAGS="$CFLAGS" \ + ${CMAKE_CROSSOPTS} + make +} + +check() { + cd "$builddir" + CTEST_OUTPUT_ON_FAILURE=TRUE ctest +} + +package() { + cd "$builddir" + make DESTDIR="$pkgdir" install +} + +sha512sums="2dc29f3aeca32a7afb515ae9349fab7ef635de731718b53ceaf532cbd3860fbb07bd936fd2988b6dddb74109775e22752ffd05a0a3d0218b9c8ae393af52b14e skanlite-2.0.1.tar.xz +80411112612025cb061960e7baf013efbe36d78a1567d169f313b9d39563c2d816c637f3b0ce45980e4a8ae8bf42e74677e32735fbfc5d8d63b6d637dcfac0fc fix-version.patch +d20473d75ba9be608fedc843fe6128e4b57a20af0d13dd88c36ab93efc3e11c764431935e3bab2cf495f9735f221236c5c1d061fbc863a26eb3a637be9bd0436 review-129989.patch +a960317f96dad1424cebd6b4734ce98c7f7401385b4434b961a0304283cd1d98bd99788be21eaa9e2bf0a5a01f6c647b6b5709334e0bd3f2b65fc12e3c56cbf3 png-review-129988.patch" diff --git a/user/skanlite/fix-version.patch b/user/skanlite/fix-version.patch new file mode 100644 index 000000000..94c5f345d --- /dev/null +++ b/user/skanlite/fix-version.patch @@ -0,0 +1,23 @@ +--- skanlite-2.0.1/CMakeLists.txt.old 2016-10-26 12:00:57.000000000 -0500 ++++ skanlite-2.0.1/CMakeLists.txt 2018-03-13 17:08:17.378028117 -0500 +@@ -43,7 +43,8 @@ + + set(SKANLITE_VERSION_STRING "2.0.1") + +-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/src/version.h) ++configure_file("${CMAKE_CURRENT_BINARY_DIR}/skanlite_version.h" "${CMAKE_CURRENT_BINARY_DIR}/src/version.h" COPYONLY) ++#configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/src/version.h) + + find_package(KF5 ${KF5_VERSION} REQUIRED + COMPONENTS # alias to find_package(KFGuiAddons ${KF5_VERSION} REQUIRED) +--- skanlite-2.0.1/src/main.cpp.old 2016-10-26 17:00:34.000000000 +0000 ++++ skanlite-2.0.1/src/main.cpp 2018-03-13 22:59:18.898057063 +0000 +@@ -44,7 +44,7 @@ + + KAboutData aboutData(QLatin1String("Skanlite"), // componentName, k4: appName + i18n("Skanlite"), // displayName, k4: programName +- QLatin1String(skanlite_version), // version ++ QLatin1String(SKANLITE_VERSION_STRING), // version + i18n("Scanning application for KDE based on libksane."), // shortDescription + KAboutLicense::GPL, // licenseType + i18n("(C) 2008-2016 Kåre Särs"), // copyrightStatement diff --git a/user/skanlite/png-review-129988.patch b/user/skanlite/png-review-129988.patch new file mode 100644 index 000000000..05697078c --- /dev/null +++ b/user/skanlite/png-review-129988.patch @@ -0,0 +1,99 @@ +From 9f1e7b3596b114ef23834810f661307ef49a38de Mon Sep 17 00:00:00 2001 +From: Alexander Trufanov <trufanovan@gmail.com> +Date: Wed, 8 Mar 2017 17:11:25 +0300 +Subject: fix DPI info in 16-bit PNG + +REVIEW:129988 + +Skanlite tries to save 16bit PNG files on its own in its KSaneImageSaver class because KSaneWidget (part of libksane) uses QImage to save files and QImage doesn't support 16bit images. Related warning in [libksane](https://github.com/KDE/libksane/blob/master/src/ksanewidget.h#L118) + +But Skanlite doesn't add most of optional PNG headers to the exported png file. In particulary it misses pHYs (Physical Pixel Dimensions) info. Without it ScanTailor app can't detect scan's dpi and forces user to choose it manually while png file importing. [Related issue in scantailor](https://github.com/scantailor/scantailor/issues/250) +I've fixed this by adding pHYs to 16bit png based on KSaneWidget::currentDPI() as KSaneWidget [do it itself](https://github.com/KDE/libksane/blob/master/src/ksanewidget.cpp#L627) +--- + src/KSaneImageSaver.cpp | 11 ++++++++--- + src/KSaneImageSaver.h | 4 ++-- + src/skanlite.cpp | 2 +- + 3 files changed, 11 insertions(+), 6 deletions(-) + +diff --git a/src/KSaneImageSaver.cpp b/src/KSaneImageSaver.cpp +index aaffed2..49123a1 100644 +--- a/src/KSaneImageSaver.cpp ++++ b/src/KSaneImageSaver.cpp +@@ -46,6 +46,7 @@ struct KSaneImageSaver::Private { + int m_width; + int m_height; + int m_format; ++ int m_dpi; + ImageType m_type; + + bool savePng(); +@@ -64,7 +65,7 @@ KSaneImageSaver::~KSaneImageSaver() + delete d; + } + +-bool KSaneImageSaver::savePng(const QString &name, const QByteArray &data, int width, int height, int format) ++bool KSaneImageSaver::savePng(const QString &name, const QByteArray &data, int width, int height, int format, int dpi) + { + if (!d->m_runMutex.tryLock()) { + return false; +@@ -75,15 +76,16 @@ bool KSaneImageSaver::savePng(const QString &name, const QByteArray &data, int w + d->m_width = width; + d->m_height = height; + d->m_format = format; ++ d->m_dpi = dpi; + d->m_type = Private::ImageTypePNG; + + start(); + return true; + } + +-bool KSaneImageSaver::savePngSync(const QString &name, const QByteArray &data, int width, int height, int format) ++bool KSaneImageSaver::savePngSync(const QString &name, const QByteArray &data, int width, int height, int format, int dpi) + { +- if (!savePng(name, data, width, height, format)) { ++ if (!savePng(name, data, width, height, format, dpi)) { + qDebug() << "fail"; + return false; + } +@@ -192,6 +194,9 @@ bool KSaneImageSaver::Private::savePng() + + png_set_sBIT(png_ptr, info_ptr, &sig_bit); + ++ png_uint_32 dpm = m_dpi * (1000.0 / 25.4); ++ png_set_pHYs(png_ptr, info_ptr, dpm, dpm, 1); ++ + /* Optionally write comments into the image */ + // text_ptr[0].key = "Title"; + // text_ptr[0].text = "Mona Lisa"; +diff --git a/src/KSaneImageSaver.h b/src/KSaneImageSaver.h +index 0ee23ac..96cc763 100644 +--- a/src/KSaneImageSaver.h ++++ b/src/KSaneImageSaver.h +@@ -37,9 +37,9 @@ public: + KSaneImageSaver(QObject *parent = 0); + ~KSaneImageSaver(); + +- bool savePng(const QString &name, const QByteArray &data, int width, int height, int format); ++ bool savePng(const QString &name, const QByteArray &data, int width, int height, int format, int dpi); + +- bool savePngSync(const QString &name, const QByteArray &data, int width, int height, int format); ++ bool savePngSync(const QString &name, const QByteArray &data, int width, int height, int format, int dpi); + + bool saveTiff(const QString &name, const QByteArray &data, int width, int height, int format); + +diff --git a/src/skanlite.cpp b/src/skanlite.cpp +index 1f1541c..7a671a2 100644 +--- a/src/skanlite.cpp ++++ b/src/skanlite.cpp +@@ -498,7 +498,7 @@ void Skanlite::saveImage() + (m_format == KSaneIface::KSaneWidget::FormatGrayScale16)) + { + KSaneImageSaver saver; +- if (saver.savePngSync(localName, m_data, m_width, m_height, m_format)) { ++ if (saver.savePngSync(localName, m_data, m_width, m_height, m_format, m_ksanew->currentDPI())) { + m_showImgDialog->close(); // closing the window if it is closed should not be a problem. + } + else { +-- +cgit v0.11.2 + diff --git a/user/skanlite/review-129989.patch b/user/skanlite/review-129989.patch new file mode 100644 index 000000000..431f1a720 --- /dev/null +++ b/user/skanlite/review-129989.patch @@ -0,0 +1,72 @@ +From e9eaf4c80ef0f90f53ee7aa284e56e808dcbe6c4 Mon Sep 17 00:00:00 2001 +From: Alexander Trufanov <trufanovan@gmail.com> +Date: Wed, 8 Mar 2017 17:55:33 +0300 +Subject: Bugfix: wrong folder selection dialog behavior + +REVIEW:129989 + +There are 2 problems with directory selection dialog. +1. If you scan very first page you'll get SaveLocation dialog but if you press the "..." button in it to specify folder for scans - a file selection dialog will be opened. Not directory selection, but file selection. If you select a file in it - a directory selection dialog pop up just after you close previous one. So you'll get a second dialog. Your first file selection result will be overwritten by folder selection. +2. If you choose for example "/tmp/" in directory selection dialog you'll get "/tmp" in the text box. Without trailing path separator. And resulted filename preview will be "/prefix-0001.png", not "/tmp/prefix-0001.png". If you didn't notice that and press ok you'll get an error as nothing can be saved to root. If you selected another folder you later may realize that your scans are in parent directory. Why? Bcs SkanLite doesn't check trailing path separator in directory path and believes that "/tmp" is a file tmp in the root folder. And Qt's directory selection dialogs always return directory name without trailing path separator in it. + +I've fixed both problems. +Second one is easy, just `if (!dir.endsWith(QDir::separator())) dir = dir.append(QDir::separator());` before proceeding with directory selection results. + +First one is a bit awkward. There is a slot `getDir()` and 2 widgets connected to it. `u_urlRequester` from SaveLocation dialog and `getDirButton` from Settings dialog. the slot opens QFileDialog::getExistingDirectory(). It's fine for getDirButton which is a QButton. But u_urlRequester is a KUrlRequester and contains own button and launches own file selection dialog which is for files by default. That's obviously wrong. +There are notes in `getDir()` slot about `// FIXME KF5`. Seems to be [this](https://mail.kde.org/pipermail/kde-frameworks-devel/2014-March/013276.html) discussion. I believe it's irrelevant to this problem. Perhaps this problem is a former workaround for KF5 problem which is already disappeared. + +All you need to fix this behavior is to disconnect KUrlRequester from getDir() which explicitly calls getExistingDirectory() and let it use it's own. We just need to switch it in directory selection mode with `u_urlRequester->setMode(KFile::Directory);`. +--- + src/SaveLocation.cpp | 5 +++-- + src/skanlite.cpp | 4 +--- + 2 files changed, 4 insertions(+), 5 deletions(-) + +diff --git a/src/SaveLocation.cpp b/src/SaveLocation.cpp +index 7d6135a..bb87047 100644 +--- a/src/SaveLocation.cpp ++++ b/src/SaveLocation.cpp +@@ -35,8 +35,8 @@ SaveLocation::SaveLocation(QWidget *parent) + { + setupUi(this); + ++ u_urlRequester->setMode(KFile::Directory); + connect(u_urlRequester, &KUrlRequester::textChanged, this, &SaveLocation::updateGui); +- connect(u_urlRequester, &KUrlRequester::urlSelected, this, &SaveLocation::getDir); + connect(u_imgPrefix, &QLineEdit::textChanged, this, &SaveLocation::updateGui); + connect(u_imgFormat, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated), this, &SaveLocation::updateGui); + connect(u_numStartFrom, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &SaveLocation::updateGui); +@@ -52,7 +52,8 @@ void SaveLocation::updateGui() + u_numStartFrom->setValue(1); // Reset the counter whenever the directory or the prefix is changed + } + const QString name = QString::fromLatin1("%1%2.%3").arg(u_imgPrefix->text()).arg(u_numStartFrom->value(), 4, 10, QLatin1Char('0')).arg(u_imgFormat->currentText()); +- u_resultValue->setText(QUrl(u_urlRequester->url().resolved(QUrl(name))).toString(QUrl::PreferLocalFile | QUrl::NormalizePathSegments)); ++ QString dir = QDir::cleanPath(u_urlRequester->url().toString()).append(QLatin1Char('/')); //make sure whole value is processed as path to directory ++ u_resultValue->setText(QUrl(dir).resolved(QUrl(name)).toString(QUrl::PreferLocalFile | QUrl::NormalizePathSegments)); + } + + void SaveLocation::getDir(void) +diff --git a/src/skanlite.cpp b/src/skanlite.cpp +index 7a671a2..1817425 100644 +--- a/src/skanlite.cpp ++++ b/src/skanlite.cpp +@@ -368,7 +368,7 @@ void Skanlite::saveImage() + m_firstImage = false; + } + +- QString dir = m_saveLocation->u_urlRequester->url().url(); ++ QString dir = QDir::cleanPath(m_saveLocation->u_urlRequester->url().url()).append(QLatin1Char('/')); //make sure whole value is processed as path to directory + QString prefix = m_saveLocation->u_imgPrefix->text(); + QString imgFormat = m_saveLocation->u_imgFormat->currentText().toLower(); + int fileNumber = m_saveLocation->u_numStartFrom->value(); +@@ -557,8 +557,6 @@ void Skanlite::saveImage() + + void Skanlite::getDir(void) + { +- // FIXME KF5 / WAIT: this is not working yet due to a bug in frameworkintegration: +- // see commit: 2c1ee08a21a1f16f9c2523718224598de8fc0d4f for kf5/src/frameworks/frameworkintegration/tests/qfiledialogtest.cpp + QString dir = QFileDialog::getExistingDirectory(m_settingsDialog, QString(), m_settingsUi.saveDirLEdit->text()); + if (!dir.isEmpty()) { + m_settingsUi.saveDirLEdit->setText(dir); +-- +cgit v0.11.2 + |