diff options
-rw-r--r-- | office/re-typeset/README | 8 | ||||
-rw-r--r-- | office/re-typeset/doinst.sh | 3 | ||||
-rw-r--r-- | office/re-typeset/paths.diff | 41 | ||||
-rw-r--r-- | office/re-typeset/re-typeset.SlackBuild | 92 | ||||
-rw-r--r-- | office/re-typeset/re-typeset.desktop | 8 | ||||
-rw-r--r-- | office/re-typeset/re-typeset.info | 10 | ||||
-rw-r--r-- | office/re-typeset/rm_lang_menu.diff | 65 | ||||
-rw-r--r-- | office/re-typeset/slack-desc | 19 |
8 files changed, 246 insertions, 0 deletions
diff --git a/office/re-typeset/README b/office/re-typeset/README new file mode 100644 index 0000000000..7a3f8e989b --- /dev/null +++ b/office/re-typeset/README @@ -0,0 +1,8 @@ +re-typeset (resize scanned text images) + +This software is a GUI application which re-typesets scanned pages to +smaller sizes without changing font sizes. Words are found on pages and +placed in a new, smaller image with preserved paragraphs, page numbers, +headers etc. + +See the upstream website for documentation diff --git a/office/re-typeset/doinst.sh b/office/re-typeset/doinst.sh new file mode 100644 index 0000000000..5fb28930db --- /dev/null +++ b/office/re-typeset/doinst.sh @@ -0,0 +1,3 @@ +if [ -x /usr/bin/update-desktop-database ]; then + /usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1 +fi diff --git a/office/re-typeset/paths.diff b/office/re-typeset/paths.diff new file mode 100644 index 0000000000..097d326bef --- /dev/null +++ b/office/re-typeset/paths.diff @@ -0,0 +1,41 @@ +diff -Naur re-typeset-1.2.0/re-typeset-src/mainwindow.cpp re-typeset-1.2.0.patched/re-typeset-src/mainwindow.cpp +--- re-typeset-1.2.0/re-typeset-src/mainwindow.cpp 2016-10-13 15:51:19.000000000 -0400 ++++ re-typeset-1.2.0.patched/re-typeset-src/mainwindow.cpp 2018-12-25 12:17:28.448448693 -0500 +@@ -22,6 +22,7 @@ + #include "mainwindow.hpp"
+ #include "license.hpp"
+ #include "ui_mainwindow.h"
++#include <QLibraryInfo>
+ #include <QImage>
+ #include <QDebug>
+ #include <QPainter>
+@@ -43,7 +44,7 @@ + ui->pageSizeWidth->setSuffix( " px" );
+
+ createLanguageMenu();
+- setWindowIcon( QIcon( QApplication::applicationDirPath() + "res/re-typeset.png" ) );
++ setWindowIcon( QIcon( "/usr/share/pixmaps/re-typeset.png" ) );
+
+ QString locale = QLocale::system().name();
+ locale.truncate(locale.lastIndexOf('_'));
+@@ -332,8 +333,8 @@ + currLang_ = rLanguage;
+ QLocale locale = QLocale(currLang_);
+ QLocale::setDefault(locale);
+- switchTranslator(translator_, QString("res/re-typeset_%1.qm").arg(rLanguage));
+- switchTranslator(translatorQt_, QString("languages/qt_%1.qm").arg(rLanguage));
++ switchTranslator(translator_, QString("/usr/share/re-typeset/re-typeset_%1.qm").arg(rLanguage));
++ switchTranslator(translatorQt_, QString("%1/qt_%2.qm").arg(QLibraryInfo::location(QLibraryInfo::TranslationsPath)).arg(rLanguage));
+ }
+ }
+
+@@ -343,8 +344,7 @@ + connect(langGroup, SIGNAL(triggered(QAction *)), this, SLOT(slotLanguageChanged(QAction *)));
+ QString defaultLocale = QLocale::system().name(); // e.g. "de_DE" // format systems language
+ defaultLocale.truncate(defaultLocale.lastIndexOf('_')); // e.g. "de"
+- langPath_ = QApplication::applicationDirPath();
+- langPath_.append("/res");
++ langPath_ = QString("/usr/share/re-typeset");
+ QDir dir(langPath_);
+ QStringList fileNames = dir.entryList(QStringList("re-typeset_*.qm"));
+ if( fileNames.size() == 0 ) {
diff --git a/office/re-typeset/re-typeset.SlackBuild b/office/re-typeset/re-typeset.SlackBuild new file mode 100644 index 0000000000..5fe1fab0c6 --- /dev/null +++ b/office/re-typeset/re-typeset.SlackBuild @@ -0,0 +1,92 @@ +#!/bin/sh + +# Slackware build script for re-typeset + +# Written by B. Watson (yalhcru@gmail.com) + +# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. + +PRGNAM=re-typeset +VERSION=${VERSION:-1.2.0} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +# No need for SLKCFLAGS or LIBDIRSUFFIX. + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION +chown -R root:root . +find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \ + \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+ + +# The Language menu doesn't actually work. For now, it's disabled, +# unless/until someone fixes it (upstream? me? *you*?). If you build +# with LANGMENU=yes, you'll see the menu with 2 entries (English +# and Polish), but it won't actually *do* anything. With LANGMENU=no, +# the UI is English only. +LANGMENU="${LANGMENU:-no}" + +if [ "$LANGMENU" = "yes" ]; then + # Look in /usr/share/$PRGNAM for language icons and translations. + patch -p1 < $CWD/paths.diff +else + # Remove the Languages menu entirely. + patch -p1 < $CWD/rm_lang_menu.diff +fi + +# The Makefile is a mess... and it's intended for the author's particular +# setup with various cross-compilers installed in his home directory & +# such. Fortunately we can just do this for a native build (and qmake-qt5 +# will set CXXFLAGS to the SLKCFLAGS it was compiled with, too): +cd $PRGNAM-src +qmake-qt5 +make + +# No install target, just put everything where it goes. +mkdir -p $PKG/usr/bin $PKG/usr/share/pixmaps +install -s -m0755 $PRGNAM $PKG/usr/bin +cat img/$PRGNAM.png > $PKG/usr/share/pixmaps/$PRGNAM.png + +if [ "$LANGMENU" = "yes" ]; then + # Translations don't get built automatically. + mkdir -p $PKG/usr/share/$PRGNAM + lrelease-qt5 lang/*.ts + for i in img/??.png lang/*.qm; do + cat $i > $PKG/usr/share/$PRGNAM/$( basename $i ) + done +fi + +# .desktop file written by SlackBuild author. Sorry about the lame little +# 16x16 icon, it's all upstream gave us. +mkdir -p $PKG/usr/share/applications +cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a LICENSE.TXT ../README.TXT $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/office/re-typeset/re-typeset.desktop b/office/re-typeset/re-typeset.desktop new file mode 100644 index 0000000000..310086e590 --- /dev/null +++ b/office/re-typeset/re-typeset.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=Re-Typeset +Comment=Scanned Image Re-typesetter +Exec=re-typeset +Icon=re-typeset +Terminal=false +Type=Application +Categories=Office; diff --git a/office/re-typeset/re-typeset.info b/office/re-typeset/re-typeset.info new file mode 100644 index 0000000000..af055f16b6 --- /dev/null +++ b/office/re-typeset/re-typeset.info @@ -0,0 +1,10 @@ +PRGNAM="re-typeset" +VERSION="1.2.0" +HOMEPAGE="https://freeshell.de/~ja/re-typeset/" +DOWNLOAD="https://github.com/re-typeset/re-typeset/archive/1.2.0/re-typeset-1.2.0.tar.gz" +MD5SUM="d73e5b25e6ccd7af4f527c78ad351229" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="qt5" +MAINTAINER="B. Watson" +EMAIL="yalhcru@gmail.com" diff --git a/office/re-typeset/rm_lang_menu.diff b/office/re-typeset/rm_lang_menu.diff new file mode 100644 index 0000000000..4be8181c6e --- /dev/null +++ b/office/re-typeset/rm_lang_menu.diff @@ -0,0 +1,65 @@ +diff -Naur re-typeset-1.2.0/re-typeset-src/mainwindow.cpp re-typeset-1.2.0.patched/re-typeset-src/mainwindow.cpp +--- re-typeset-1.2.0/re-typeset-src/mainwindow.cpp 2016-10-13 15:51:19.000000000 -0400 ++++ re-typeset-1.2.0.patched/re-typeset-src/mainwindow.cpp 2018-12-26 16:51:03.683711862 -0500 +@@ -42,7 +42,6 @@ + ui->pageSizeHeight->setSuffix( " px" );
+ ui->pageSizeWidth->setSuffix( " px" );
+
+- createLanguageMenu();
+ setWindowIcon( QIcon( QApplication::applicationDirPath() + "res/re-typeset.png" ) );
+
+ QString locale = QLocale::system().name();
+@@ -337,38 +336,6 @@ + }
+ }
+
+-void MainWindow::createLanguageMenu() {
+- QActionGroup* langGroup = new QActionGroup(ui->menuLanguage);
+- langGroup->setExclusive(true);
+- connect(langGroup, SIGNAL(triggered(QAction *)), this, SLOT(slotLanguageChanged(QAction *)));
+- QString defaultLocale = QLocale::system().name(); // e.g. "de_DE" // format systems language
+- defaultLocale.truncate(defaultLocale.lastIndexOf('_')); // e.g. "de"
+- langPath_ = QApplication::applicationDirPath();
+- langPath_.append("/res");
+- QDir dir(langPath_);
+- QStringList fileNames = dir.entryList(QStringList("re-typeset_*.qm"));
+- if( fileNames.size() == 0 ) {
+- ui->menuLanguage->setDisabled( true );
+- } else {
+- for (int i = 0; i < fileNames.size(); ++i) {
+- QString locale;// get locale extracted by filename
+- locale = fileNames[i]; // "TranslationExample_de.qm"
+- locale.truncate(locale.lastIndexOf('.')); // "TranslationExample_de"
+- locale.remove(0, locale.indexOf('_') + 1); // "de"
+- QString lang = QLocale::languageToString(QLocale(locale).language());
+- QIcon ico(QString("%1/%2.png").arg(langPath_).arg(locale));
+- QAction *action = new QAction(ico, lang, this);
+- action->setCheckable(true);
+- action->setData(locale);
+- ui->menuLanguage->addAction(action);
+- langGroup->addAction(action);
+- if (defaultLocale == locale) {// set default translators and language checked
+- action->setChecked(true);
+- }
+- }
+- }
+-}
+-
+ void MainWindow::changeEvent(QEvent * event) {
+ if(0 != event) {
+ switch(event->type()) {
+diff -Naur re-typeset-1.2.0/re-typeset-src/mainwindow.ui re-typeset-1.2.0.patched/re-typeset-src/mainwindow.ui +--- re-typeset-1.2.0/re-typeset-src/mainwindow.ui 2016-10-13 15:51:19.000000000 -0400 ++++ re-typeset-1.2.0.patched/re-typeset-src/mainwindow.ui 2018-12-26 16:51:03.683711862 -0500 +@@ -757,11 +757,6 @@ + <height>21</height>
+ </rect>
+ </property>
+- <widget class="QMenu" name="menuLanguage">
+- <property name="title">
+- <string>&Language</string>
+- </property>
+- </widget>
+ <widget class="QMenu" name="menuOptions">
+ <property name="title">
+ <string>Options</string>
diff --git a/office/re-typeset/slack-desc b/office/re-typeset/slack-desc new file mode 100644 index 0000000000..0b4f27fa91 --- /dev/null +++ b/office/re-typeset/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +re-typeset: re-typeset (resize scanned text images) +re-typeset: +re-typeset: This software is a GUI application which re-typesets scanned pages +re-typeset: to smaller sizes without changing font sizes. Words are found on +re-typeset: pages and placed in a new, smaller image with preserved paragraphs, +re-typeset: page numbers, headers etc. +re-typeset: +re-typeset: +re-typeset: +re-typeset: +re-typeset: |