mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-29 13:00:32 +01:00
office/re-typeset: Added (resize scanned text images).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
parent
61eb593a60
commit
e2cfbb6e1c
8 changed files with 246 additions and 0 deletions
8
office/re-typeset/README
Normal file
8
office/re-typeset/README
Normal file
|
@ -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
|
3
office/re-typeset/doinst.sh
Normal file
3
office/re-typeset/doinst.sh
Normal file
|
@ -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
|
41
office/re-typeset/paths.diff
Normal file
41
office/re-typeset/paths.diff
Normal file
|
@ -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 ) {
|
92
office/re-typeset/re-typeset.SlackBuild
Normal file
92
office/re-typeset/re-typeset.SlackBuild
Normal file
|
@ -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}
|
8
office/re-typeset/re-typeset.desktop
Normal file
8
office/re-typeset/re-typeset.desktop
Normal file
|
@ -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;
|
10
office/re-typeset/re-typeset.info
Normal file
10
office/re-typeset/re-typeset.info
Normal file
|
@ -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"
|
65
office/re-typeset/rm_lang_menu.diff
Normal file
65
office/re-typeset/rm_lang_menu.diff
Normal file
|
@ -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>
|
19
office/re-typeset/slack-desc
Normal file
19
office/re-typeset/slack-desc
Normal file
|
@ -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:
|
Loading…
Reference in a new issue