From 085a87339bb2021f4af3d9a0784c9a60ac127bd0 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Sun, 22 Jul 2018 04:56:40 -0500 Subject: user/skanlite: bump to 2.1.0.1, modernise, drop upstreamed patches --- user/skanlite/APKBUILD | 15 ++---- user/skanlite/fix-version.patch | 2 +- user/skanlite/png-review-129988.patch | 99 ----------------------------------- user/skanlite/review-129989.patch | 72 ------------------------- 4 files changed, 6 insertions(+), 182 deletions(-) delete mode 100644 user/skanlite/png-review-129988.patch delete mode 100644 user/skanlite/review-129989.patch diff --git a/user/skanlite/APKBUILD b/user/skanlite/APKBUILD index c0f3194c5..77c06dc04 100644 --- a/user/skanlite/APKBUILD +++ b/user/skanlite/APKBUILD @@ -1,7 +1,7 @@ # Contributor: A. Wilcox # Maintainer: A. Wilcox pkgname=skanlite -pkgver=2.0.1 +pkgver=2.1.0.1 pkgrel=0 pkgdesc="Simple image scanning application" url="https://www.kde.org/applications/graphics/skanlite/" @@ -11,13 +11,10 @@ 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 +source="https://download.kde.org/stable/skanlite/2.1/skanlite-$pkgver.tar.xz fix-version.patch - review-129989.patch - png-review-129988.patch" -builddir="$srcdir/skanlite-$pkgver" + " build() { cd "$builddir" @@ -45,7 +42,5 @@ package() { 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" +sha512sums="8eb1a32994259010d4a134c1b25b74b8cc03ba4fa6ce70ee2026a3070c675c2b11f38770453d197008fbe12df976cc653362eb44d6ef89a7f0173c3a2cef3658 skanlite-2.1.0.1.tar.xz +91ce7a1f9a2796be511f20978fdea9e19c9eb6415ae5d407fbc855675d2e6809ddc85546b4e018ca0d72262d86104292c81e490613ae9045d10257e646da8732 fix-version.patch" diff --git a/user/skanlite/fix-version.patch b/user/skanlite/fix-version.patch index 94c5f345d..e5afa0be2 100644 --- a/user/skanlite/fix-version.patch +++ b/user/skanlite/fix-version.patch @@ -18,6 +18,6 @@ i18n("Skanlite"), // displayName, k4: programName - QLatin1String(skanlite_version), // version + QLatin1String(SKANLITE_VERSION_STRING), // version - i18n("Scanning application for KDE based on libksane."), // shortDescription + i18n("Scanning application by 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 deleted file mode 100644 index 05697078c..000000000 --- a/user/skanlite/png-review-129988.patch +++ /dev/null @@ -1,99 +0,0 @@ -From 9f1e7b3596b114ef23834810f661307ef49a38de Mon Sep 17 00:00:00 2001 -From: Alexander Trufanov -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 deleted file mode 100644 index 431f1a720..000000000 --- a/user/skanlite/review-129989.patch +++ /dev/null @@ -1,72 +0,0 @@ -From e9eaf4c80ef0f90f53ee7aa284e56e808dcbe6c4 Mon Sep 17 00:00:00 2001 -From: Alexander Trufanov -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(&QComboBox::activated), this, &SaveLocation::updateGui); - connect(u_numStartFrom, static_cast(&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 - -- cgit v1.2.3-70-g09d2