Коммит 4a93c0d5 создал по автору OMP Education's avatar OMP Education
Просмотр файлов

[Structure] Setup application template.

владелец 509c0abb
/*******************************************************************************
**
** Copyright (C) 2023 Open Mobile Platform LLC.
** Contact: https://community.omprussia.ru/open-source
**
** This file is part of the DocumentConverter project.
**
** Redistribution and use in source and binary forms,
** with or without modification, are permitted provided
** that the following conditions are met:
**
** * Redistributions of source code must retain the above copyright notice,
** this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright notice,
** this list of conditions and the following disclaimer
** in the documentation and/or other materials provided with the distribution.
** * Neither the name of the copyright holder nor the names of its contributors
** may be used to endorse or promote products derived from this software
** without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
** FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
** IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
** OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
** LOSS OF USE, DATA, OR PROFITS;
** OR BUSINESS INTERRUPTION)
** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE)
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
** EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
*******************************************************************************/
#ifndef CONVERTER_H
#define CONVERTER_H
#include <QString>
#include <QObject>
#include <QFile>
#include <QIODevice>
#include <QTextStream>
#include <QRunnable>
#define LOK_USE_UNSTABLE_API
#include <LibreOfficeKit.hxx>
#include <LibreOfficeKitEnums.h>
class Converter : public QObject
{
Q_OBJECT
public:
enum class State {
Initilize,
Opening,
Opened,
Saving,
Saved,
Failed
};
Q_ENUM(State)
Q_PROPERTY(State state READ state NOTIFY stateChanged)
public:
explicit Converter(QObject *parent = nullptr);
State state() const;
void setState(State newState);
public slots:
void convert(const QString &fileSourcePath, const QString &fileResultPath);
signals:
void fileConverted();
void stateChanged();
private:
lok::Office *m_office;
lok::Document *m_document;
State m_state;
};
class ConverterWorker : public QObject, public QRunnable
{
Q_OBJECT
public:
ConverterWorker(lok::Office *office, const QByteArray &srcUrl, const QByteArray &dstUrl);
void run() override final;
signals:
void satateChanged(Converter::State);
private:
lok::Office *m_office;
QByteArray m_srcUrl;
QByteArray m_dstUrl;
};
#endif // CONVERTER_H
/*******************************************************************************
**
** Copyright (C) 2023 Open Mobile Platform LLC.
** Contact: https://community.omprussia.ru/open-source
**
** This file is part of the DocumentConverter project.
**
** Redistribution and use in source and binary forms,
** with or without modification, are permitted provided
** that the following conditions are met:
**
** * Redistributions of source code must retain the above copyright notice,
** this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright notice,
** this list of conditions and the following disclaimer
** in the documentation and/or other materials provided with the distribution.
** * Neither the name of the copyright holder nor the names of its contributors
** may be used to endorse or promote products derived from this software
** without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
** FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
** IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
** OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
** LOSS OF USE, DATA, OR PROFITS;
** OR BUSINESS INTERRUPTION)
** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE)
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
** EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
*******************************************************************************/
#include <auroraapp.h>
#include <QtQuick>
#include <QMetaType>
#include "converter.h"
int main(int argc, char *argv[])
{
QScopedPointer<QGuiApplication> application(Aurora::Application::application(argc, argv));
application->setOrganizationName(QStringLiteral("ru.auroraos"));
application->setApplicationName(QStringLiteral("DocumentConverter"));
qmlRegisterType<Converter>("ru.auroraos.DocumentConverter", 1, 0, "Converter");
QScopedPointer<QQuickView> view(Aurora::Application::createView());
view->setSource(Aurora::Application::pathTo(QStringLiteral("qml/DocumentConverter.qml")));
view->show();
return application->exec();
}
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="ru">
<context>
<name>ConvertPage</name>
<message>
<location filename="../qml/pages/ConvertPage.qml" line="38"/>
<source>converting</source>
<translation>Конвертация</translation>
</message>
<message>
<location filename="../qml/pages/ConvertPage.qml" line="70"/>
<source>Converting file ...</source>
<translation>Конвертация файла ...</translation>
</message>
<message>
<location filename="../qml/pages/ConvertPage.qml" line="83"/>
<source>File %1 saved</source>
<translation>Файл %1 сохранен</translation>
</message>
<message>
<location filename="../qml/pages/ConvertPage.qml" line="95"/>
<source>Failed to convert %1</source>
<translation>Не удалось конвертировать %1</translation>
</message>
</context>
<context>
<name>DefaultCoverPage</name>
<message>
<location filename="../qml/cover/DefaultCoverPage.qml" line="27"/>
<source>Document Converter</source>
<translation>Конвертер документов</translation>
</message>
</context>
<context>
<name>MainPage</name>
<message>
<location filename="../qml/pages/MainPage.qml" line="95"/>
<source>Conver to %1</source>
<translation>Конвертировать в %1</translation>
</message>
<message>
<location filename="../qml/pages/MainPage.qml" line="136"/>
<source>Save as ...</source>
<translation>Сохранить в ...</translation>
</message>
</context>
</TS>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="en">
<context>
<name>ConvertPage</name>
<message>
<location filename="../qml/pages/ConvertPage.qml" line="38"/>
<source>converting</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/ConvertPage.qml" line="70"/>
<source>Converting file ...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/ConvertPage.qml" line="83"/>
<source>File %1 saved</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/ConvertPage.qml" line="95"/>
<source>Failed to convert %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DefaultCoverPage</name>
<message>
<location filename="../qml/cover/DefaultCoverPage.qml" line="27"/>
<source>File Converter</source>
<translation>File Converter</translation>
</message>
</context>
<context>
<name>MainPage</name>
<message>
<location filename="../qml/pages/MainPage.qml" line="95"/>
<source>Conver to %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/MainPage.qml" line="136"/>
<source>Save as ...</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>
diff --git a/configure.ac b/configure.ac
index 59ef29ff35fc..bb30fe08cce8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2896,7 +2896,7 @@ AC_SUBST(BASH)
AC_MSG_CHECKING([for GNU or BSD tar])
for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
- $a --version 2> /dev/null | egrep "GNU|bsdtar" 2>&1 > /dev/null
+ $a --version 2> /dev/null | egrep "GNU|bsdtar|tar" 2>&1 > /dev/null
if test $? -eq 0; then
GNUTAR=$a
break
@@ -2917,7 +2917,7 @@ else
if test $? -eq 0; then
STRIP_COMPONENTS="--strip-path"
else
- STRIP_COMPONENTS="unsupported"
+ STRIP_COMPONENTS=""
fi
fi
AC_MSG_RESULT($STRIP_COMPONENTS)
diff --git a/configure.ac b/configure.ac
index bb30fe08cce8..a72b6f72e314 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10435,8 +10435,6 @@ dnl ===================================================================
AC_MSG_CHECKING([which sane header to use])
if test "$with_system_sane" = "yes"; then
AC_MSG_RESULT([external])
- AC_CHECK_HEADER(sane/sane.h, [],
- [AC_MSG_ERROR(sane not found. install sane)], [])
else
AC_MSG_RESULT([internal])
BUILD_TYPE="$BUILD_TYPE SANE"
diff --git a/configure.ac b/configure.ac
index a72b6f72e314..9079294d9f06 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7194,7 +7194,7 @@ AC_MSG_CHECKING([whether gperf is new enough])
my_gperf_ver1=$($GPERF --version | head -n 1)
my_gperf_ver2=${my_gperf_ver1#GNU gperf }
my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
-if test "$my_gperf_ver3" -ge 301; then
+if test "$my_gperf_ver3" -ge 300; then
AC_MSG_RESULT([yes ($my_gperf_ver2)])
else
AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
diff --git a/external/epoxy/Library_epoxy.mk b/external/epoxy/Library_epoxy.mk
index 81c35d695997..a4b02a6c848c 100644
--- a/external/epoxy/Library_epoxy.mk
+++ b/external/epoxy/Library_epoxy.mk
@@ -44,8 +44,8 @@ $(eval $(call gb_Library_add_generated_cobjects,epoxy,\
))
else
$(eval $(call gb_Library_add_generated_cobjects,epoxy,\
- UnpackedTarball/epoxy/src/dispatch_glx \
- UnpackedTarball/epoxy/src/glx_generated_dispatch \
+ UnpackedTarball/epoxy/src/dispatch_egl \
+ UnpackedTarball/epoxy/src/egl_generated_dispatch \
))
ifeq ($(ENABLE_GTK3),TRUE)
$(eval $(call gb_Library_add_cflags,epoxy,\
diff --git a/external/epoxy/epoxy.noegl.by.default.patch b/external/epoxy/epoxy.noegl.by.default.patch
index bf89453363fa..8f3248a34d6e 100644
--- a/external/epoxy/epoxy.noegl.by.default.patch
+++ b/external/epoxy/epoxy.noegl.by.default.patch
@@ -1,6 +1,6 @@
--- src/dispatch_common.h
+++ src/dispatch_common.h
-@@ -24,20 +24,19 @@
+@@ -24,20 +24,20 @@
#include "config.h"
#ifdef _WIN32
@@ -22,7 +22,8 @@
#else
-#define PLATFORM_HAS_EGL ENABLE_EGL
-#define PLATFORM_HAS_GLX ENABLE_GLX
-+#define PLATFORM_HAS_GLX 1
++#define PLATFORM_HAS_EGL 1
++#define PLATFORM_HAS_GLX 0
#define PLATFORM_HAS_WGL 0
#endif
%define external_url https://dev-www.libreoffice.org/src/
%global __provides_exclude_from ^%{_datadir}/%{name}/lib/libreoffice/program/.*\\.so.*$
%global __requires_exclude_from ^%{_datadir}/%{name}/lib/libreoffice/program/.*$
Name: ru.auroraos.DocumentConverter
Summary: Document Converter App based on LibreOffice
Version: 0.0.1
Release: 1
License: BSD-3-Clause
URL: https://auroraos.ru
Source0: %{name}-%{version}.tar.bz2
BuildRequires: which
BuildRequires: pkgconfig(libjpeg)
BuildRequires: bsdtar
BuildRequires: pkgconfig(hunspell)
BuildRequires: pkgconfig(zlib)
BuildRequires: pkgconfig(cairo)
BuildRequires: pkgconfig(openssl)
BuildRequires: pkgconfig(cppunit)
BuildRequires: pkgconfig(libcrypt)
BuildRequires: libtool-ltdl-devel
BuildRequires: autoconf
BuildRequires: libtool
BuildRequires: zip
BuildRequires: gperf
BuildRequires: bison
BuildRequires: flex >= 2.6.0
BuildRequires: pkgconfig(zxing)
BuildRequires: libcurl-devel
BuildRequires: pkgconfig(libxslt)
BuildRequires: pkgconfig(nss)
BuildRequires: pkgconfig(egl)
BuildRequires: libGLESv1-devel
BuildRequires: libGLESv2-devel
BuildRequires: pkgconfig(auroraapp)
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Qml)
BuildRequires: pkgconfig(Qt5Quick)
BuildRequires: pkgconfig(Qt5Concurrent)
BuildRequires: desktop-file-utils
Requires: sailfishsilica-qt5 >= 0.10.9
Patch1: 0001-configure-fix-tar-checking.patch
Patch2: 0002-disable-sane-checking.patch
Patch3: 0003-hack-required-gperf-version.patch
Patch4: 0004-use-egl-epoxy.patch
%description
%{summary}.
%prep
%autosetup -p1 -n %{name}-%{version}/upstream
%build
# path to external tarballs
EXTSRCDIR=../tarballs
LDFLAGS=-Wl,-rpath=%{_datadir}/%{name}/lib
aclocal -I ${PWD}/m4
autoconf -I ${PWD}
%configure \
--without-help \
--without-helppack-integration \
--without-myspell-dicts \
--without-system-dicts \
--without-doxygen \
--without-java \
--without-krb5 \
--without-fonts \
--without-junit \
--without-galleries \
--without-theme \
--without-package-format \
--without-system-libcmis \
--without-system-cuckoo \
--without-system-clucene \
--without-system-xmlsec \
--without-system-libodfgen \
--without-system-libepubgen \
--without-system-libwpd \
--without-system-libwpg \
--without-system-libwps \
--without-system-libvisio \
--without-system-libcdr \
--without-system-libmspub \
--without-system-libmwaw \
--without-system-libetonyek \
--without-system-libfreehand \
--without-system-libebook \
--without-system-libabw \
--without-system-libpagemaker \
--without-system-libqxp \
--without-system-libzmf \
--without-system-libstaroffice \
--without-system-mdds \
--without-system-orcus \
--without-system-redland \
--without-system-mythes \
--without-system-glm \
--without-system-libexttextcat \
--without-system-libnumbertext \
--without-system-altlinuxhyph \
--without-system-box2d \
--without-system-librevenge \
--without-system-odbc \
--without-system-liblangtag \
--without-system-epoxy \
--without-system-harfbuzz \
--without-system-boost \
--without-system-graphite \
--without-system-lcms2 \
--without-system-icu \
--disable-cmis \
--disable-odk \
--disable-gtk3 \
--disable-gtk4 \
--disable-gio \
--disable-qt5 \
--disable-gui \
--disable-randr \
--disable-cairo-canvas \
--disable-dbus \
--disable-cups \
--disable-dconf \
--disable-ldap \
--disable-report-builder \
--disable-coinmp \
--disable-lpsolve \
--disable-lotuswordpro \
--disable-scripting-beanshell \
--disable-scripting-javascript \
--disable-sdremote \
--disable-postgresql-sdbc \
--disable-firebird-sdbc \
--disable-pdfimport \
--disable-pdfium \
--disable-poppler \
--disable-skia \
--disable-evolution2 \
--disable-fuzzers \
--disable-cve-tests \
--disable-chart-tests \
--disable-fetch-external \
--disable-dependency-tracking \
--disable-extension-update \
--disable-extension-integration \
--disable-ooenv \
--disable-debug \
--disable-dbgutil \
--with-system-libs \
--with-system-ucpp \
--with-lang="" \
--with-locales="" \
--with-webdav=no \
--with-theme=no \
--enable-ld=gold \
--with-vendor="Open Mobile Platform LLC" \
--disable-fetch-external \
--with-external-tar="$EXTSRCDIR" \
--without-system-sane \
--enable-mpl-subset \
--enable-release-build \
--enable-eot=no \
--enable-python=no \
--enable-mergelibs \
--with-parallelism=%(echo -n "%{?_smp_mflags}" | sed "s/-j//") \
--libexecdir=%{_libexecdir}/%{name} \
--libdir=%{_datadir}/%{name}/lib
%define _smp_mflags %{nil}
%make_build build-nocheck
cd ..
%{__cp} -r upstream/include/LibreOfficeKit application/
%qmake5
%make_build
%install
BINDIR=../tarballs
%{__make} install-strip DESTDIR=%{?buildroot} INSTALL="%{__install} -p"
%{__rm} -f %{buildroot}/gid_Module_*
%{__install} -d %{buildroot}%{_datadir}/%{name}/include/LibreOfficeKit
%{__cp} -r ../upstream/include/LibreOfficeKit %{buildroot}%{_datadir}/%{name}/include
%{__mkdir_p} %{buildroot}%{_libexecdir}/%{name}
%{__rm} %{buildroot}%{_datadir}/%{name}/lib/libreoffice/program/gengal
%{__rm} %{buildroot}%{_datadir}/%{name}/lib/libreoffice/program/senddoc
%{__rm} %{buildroot}%{_datadir}/%{name}/lib/libreoffice/program/uno
%{__rm} %{buildroot}%{_datadir}/%{name}/lib/libreoffice/program/unoinfo
%{__rm} %{buildroot}%{_datadir}/%{name}/lib/libreoffice/program/unopkg
chmod -x %{buildroot}%{_datadir}/%{name}/lib/libreoffice/program/gengal.bin
%{__rm} %{buildroot}%{_datadir}/%{name}/lib/libreoffice/program/oosplash
%{__rm} %{buildroot}%{_datadir}/%{name}/lib/libreoffice/program/opencltest
%{__rm} %{buildroot}%{_datadir}/%{name}/lib/libreoffice/program/regmerge
%{__rm} %{buildroot}%{_datadir}/%{name}/lib/libreoffice/program/regview
chmod -x %{buildroot}%{_datadir}/%{name}/lib/libreoffice/program/soffice.bin
chmod -x %{buildroot}%{_datadir}/%{name}/lib/libreoffice/program/uno.bin
chmod -x %{buildroot}%{_datadir}/%{name}/lib/libreoffice/program/unopkg.bin
%{__rm} %{buildroot}%{_datadir}/%{name}/lib/libreoffice/program/uri-encode
cd ..
%qmake5_install
%files
%defattr(-,root,root,-)
%{_bindir}/%{name}
%defattr(644,root,root,-)
%{_datadir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.png
################################################################################
##
## Copyright (C) 2023 Open Mobile Platform LLC.
## Contact: https://community.omprussia.ru/open-source
##
## This file is part of the DocumentConverter project.
##
## Redistribution and use in source and binary forms,
## with or without modification, are permitted provided
## that the following conditions are met:
##
## * Redistributions of source code must retain the above copyright notice,
## this list of conditions and the following disclaimer.
## * Redistributions in binary form must reproduce the above copyright notice,
## this list of conditions and the following disclaimer
## in the documentation and/or other materials provided with the distribution.
## * Neither the name of the copyright holder nor the names of its contributors
## may be used to endorse or promote products derived from this software
## without specific prior written permission.
##
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
## THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
## FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
## IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
## FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
## OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
## LOSS OF USE, DATA, OR PROFITS;
## OR BUSINESS INTERRUPTION)
## HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
## WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
## (INCLUDING NEGLIGENCE OR OTHERWISE)
## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
## EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
##
################################################################################
TEMPLATE = subdirs
SUBDIRS = \
application \
OTHER_FILES += \
rpm/ru.auroraos.DocumentConverter.spec \
AUTHORS.md \
CODE_OF_CONDUCT.md \
CONTRIBUTING.md \
LICENSE.BSD-3-CLAUSE.md \
README.md \
Файл добавлен
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать