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

[Structure] Setup application template.

владелец 590a036b
# Authors
* Kirill Chuvilin, <k.chuvilin@omp.ru>
* Product owner, 2022
* Maintainer, 2022
# Application Template
The project provides a template for Aurora OS applications.
The main purpose is to clearly demonstrate almost minimal source code to get a correct and extensible application.
## Terms of Use and Participation
The source code of the project is provided under [the license](LICENSE.BSD-3-CLAUSE.md),
that allows it to be used in third-party applications.
The [contributor agreement](CONTRIBUTING.md) documents the rights granted by contributors
to the Open Mobile Platform.
For information about contributors see [AUTHORS](AUTHORS.md).
[Code of conduct](CODE_OF_CONDUCT.md) is a current set of rules of the Open Mobile
Platform which informs you how we expect the members of the community will interact
while contributing and communicating.
## Project Structure
The project has a common structure
of an application based on C++ and QML for Aurora OS.
* **[ru.auroraos.ApplicationTemplate.pro](ru.auroraos.ApplicationTemplate.pro)** file describes the project structure for the qmake build system.
* **[icons](icons)** directory contains application icons for different screen resolutions.
* **[qml](qml)** directory contains the QML source code and the UI resources.
* **[cover](qml/cover)** directory contains the application cover implementations.
* **[icons](qml/icons)** directory contains the custom UI icons.
* **[pages](qml/pages)** directory contains the application pages.
* **[ApplicationTemplate.qml](qml/ApplicationTemplate.qml)** file provides the application window implementation.
* **[rpm](rpm)** directory contains the rpm-package build settings.
**[ru.auroraos.ApplicationTemplate.spec](rpm/ru.auroraos.ApplicationTemplate.spec)** file is used by rpmbuild tool.
* **[src](src)** directory contains the C++ source code.
* **[main.cpp](src/main.cpp)** file is the application entry point.
* **[translations](translations)** directory contains the UI translation files.
* **[ru.auroraos.ApplicationTemplate.desktop](ru.auroraos.ApplicationTemplate.desktop)** file defines the display and parameters for launching the application.
## Compatibility
The project is compatible with all the supported versions of the Aurora OS.
## Project Building
The project is built in the usual way using the Aurora SDK.
## Screenshots
![screenshots](screenshots/screenshots.png)
## This document in Russian / Перевод этого документа на русский язык
- [README.ru.md](README.ru.md)
// SPDX-FileCopyrightText: 2023 Open Mobile Platform LLC <community@omp.ru>
// SPDX-License-Identifier: BSD-3-Clause
import QtQuick 2.0
import Sailfish.Silica 1.0
ApplicationWindow {
objectName: "applicationWindow"
initialPage: Qt.resolvedUrl("pages/MainPage.qml")
cover: Qt.resolvedUrl("cover/DefaultCoverPage.qml")
allowedOrientations: defaultAllowedOrientations
}
// SPDX-FileCopyrightText: 2023 Open Mobile Platform LLC <community@omp.ru>
// SPDX-License-Identifier: BSD-3-Clause
import QtQuick 2.0
import Sailfish.Silica 1.0
CoverBackground {
objectName: "defaultCover"
CoverPlaceholder {
objectName: "placeholder"
text: qsTr("Application Template")
icon {
source: Qt.resolvedUrl("../icons/ApplicationTemplate.svg")
sourceSize {
width: icon.width;
height: icon.height
}
}
forceFit: true
}
}
<svg width="1024" height="1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<path id="Background" d="m0 357.5c0-180.46 0-245.38 56.06-301.44s120.99-56.06 326.74-56.06h258.39c205.76 0 270.68 0 326.74 56.06s56.06 120.99 56.06 326.74v258.39c0 205.76 0 270.68-56.06 326.74-56.06 56.059-120.99 56.059-326.74 56.059h-258.39c-205.76 0-270.68 0-326.74-56.059-56.06-56.06-56.06-120.99-56.06-326.74z" fill="#003e88"/>
<mask id="Frame_Mask" maskUnits="userSpaceOnUse">
<use xlink:href="#Background"/>
</mask>
<g fill="none" mask="url(#Frame_Mask)" stroke="#4169e1" stroke-width="1024">
<path d="m-2e-5 512h1024" stroke-dasharray="1.024, 49.152, 1.024, 0"/>
<path d="m512-2.41e-5v1024" stroke-dasharray="1.024, 49.152, 1.024, 0"/>
<path d="m-2e-5 512h1024" stroke-dasharray="2.56, 506.88, 2.56, 0"/>
<path d="m512-2.41e-5v1024" stroke-dasharray="2.56, 506.88, 2.56, 0"/>
</g>
<radialGradient id="Aurora_Gradient" cx="253.16" cy="572.03" r="346.86" gradientTransform="matrix(1.7323 .99965 -1 1.7329 540.61 -618.36)" gradientUnits="userSpaceOnUse">
<stop stop-color="#fff" offset="0"/>
<stop stop-color="#fff" stop-opacity="0" offset="1"/>
</radialGradient>
<path d="m820.13 625.96h-23.404a3.7229 3.7229 0 0 1-3.2222-5.5952l8.1207-14.064a12.388 12.388 0 0 0 0-12.41l-35.161-60.959-53.775 93.007h-17.831a3.7229 3.7229 0 0 1-3.2222-5.5952l59.109-102.32a12.388 12.388 0 0 0 0-12.41l-35.161-60.959-204.15 353.24-9.2745-16.045a9.8624 9.8624 0 0 1 0-9.9277l197.7-341.96a12.388 12.388 0 0 0 0-12.41l-35.161-60.959-204.21 353.19-9.2528-16.045a9.8624 9.8624 0 0 1 0-9.9277l197.75-342.05a12.388 12.388 0 0 0 0-12.41l-35.182-61.003-206.7 357.61h-17.722a3.7229 3.7229 0 0 1-3.2221-5.5952l211.92-366.76a12.453 12.453 0 0 0 0-12.41l-35.182-60.959-257.66 445.72h-17.831a3.7229 3.7229 0 0 1-3.2221-5.5952l263.02-455.02a12.388 12.388 0 0 0 0-12.41l-35.204-60.938-346.86 601.06h208.15l138.16 238.94 138.18-238.94h209.22z" fill="url(#Aurora_Gradient)"/>
</svg>
// SPDX-FileCopyrightText: 2023 Open Mobile Platform LLC <community@omp.ru>
// SPDX-License-Identifier: BSD-3-Clause
import QtQuick 2.0
import Sailfish.Silica 1.0
Page {
objectName: "aboutPage"
allowedOrientations: Orientation.All
SilicaFlickable {
objectName: "flickable"
anchors.fill: parent
contentHeight: layout.height + Theme.paddingLarge
Column {
id: layout
objectName: "layout"
width: parent.width
PageHeader {
objectName: "pageHeader"
title: qsTr("About Application")
}
Label {
objectName: "descriptionText"
anchors { left: parent.left; right: parent.right; margins: Theme.horizontalPageMargin }
color: palette.highlightColor
font.pixelSize: Theme.fontSizeSmall
textFormat: Text.RichText
wrapMode: Text.WordWrap
text: qsTr("#descriptionText")
}
SectionHeader {
objectName: "licenseHeader"
text: qsTr("3-Clause BSD License")
}
Label {
objectName: "licenseText"
anchors { left: parent.left; right: parent.right; margins: Theme.horizontalPageMargin }
color: palette.highlightColor
font.pixelSize: Theme.fontSizeSmall
textFormat: Text.RichText
wrapMode: Text.WordWrap
text: qsTr("#licenseText")
}
}
}
}
// SPDX-FileCopyrightText: 2023 Open Mobile Platform LLC <community@omp.ru>
// SPDX-License-Identifier: BSD-3-Clause
import QtQuick 2.0
import Sailfish.Silica 1.0
Page {
objectName: "mainPage"
allowedOrientations: Orientation.All
PageHeader {
objectName: "pageHeader"
title: qsTr("Application Template")
extraContent.children: [
IconButton {
objectName: "aboutButton"
icon.source: "image://theme/icon-m-about"
anchors.verticalCenter: parent.verticalCenter
onClicked: pageStack.push(Qt.resolvedUrl("AboutPage.qml"))
}
]
}
}
Name: ru.auroraos.ApplicationTemplate
Summary: Template
Version: 0.1
Release: 1
Group: Qt/Qt
License: BSD-3-Clause
URL: https://community.omprussia.ru/open-source
Source0: %{name}-%{version}.tar.bz2
Requires: sailfishsilica-qt5 >= 0.10.9
BuildRequires: pkgconfig(auroraapp)
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Qml)
BuildRequires: pkgconfig(Qt5Quick)
%description
Aurora OS Application Template.
%prep
%autosetup
%build
%qmake5
%make_build
%install
%make_install
%files
%defattr(-,root,root,-)
%{_bindir}/%{name}
%defattr(644,root,root,-)
%{_datadir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.png
[Desktop Entry]
Type=Application
X-Nemo-Application-Type=silica-qt5
Icon=ru.auroraos.ApplicationTemplate
Exec=/usr/bin/ru.auroraos.ApplicationTemplate
Name=Template
Name[ru]=Шаблон
[X-Application]
Permissions=
OrganizationName=ru.auroraos
ApplicationName=ApplicationTemplate
ExecDBus=/usr/bin/ru.auroraos.ApplicationTemplate
# SPDX-FileCopyrightText: 2023 Open Mobile Platform LLC <community@omp.ru>
# SPDX-License-Identifier: BSD-3-Clause
TARGET = ru.auroraos.ApplicationTemplate
CONFIG += \
auroraapp \
PKGCONFIG += \
SOURCES += \
src/main.cpp \
HEADERS += \
DISTFILES += \
rpm/ru.auroraos.ApplicationTemplate.spec \
AUTHORS.md \
CODE_OF_CONDUCT.md \
CONTRIBUTING.md \
LICENSE.BSD-3-Clause.md \
README.md \
README.ru.md \
AURORAAPP_ICONS = 86x86 108x108 128x128 172x172
CONFIG += auroraapp_i18n
TRANSLATIONS += \
translations/ru.auroraos.ApplicationTemplate.ts \
translations/ru.auroraos.ApplicationTemplate-ru.ts \
// SPDX-FileCopyrightText: 2023 Open Mobile Platform LLC <community@omp.ru>
// SPDX-License-Identifier: BSD-3-Clause
#include <auroraapp.h>
#include <QtQuick>
int main(int argc, char *argv[])
{
QScopedPointer<QGuiApplication> application(Aurora::Application::application(argc, argv));
application->setOrganizationName(QStringLiteral("ru.auroraos"));
application->setApplicationName(QStringLiteral("ApplicationTemplate"));
QScopedPointer<QQuickView> view(Aurora::Application::createView());
view->setSource(Aurora::Application::pathTo(QStringLiteral("qml/ApplicationTemplate.qml")));
view->show();
return application->exec();
}
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="ru">
<context>
<name>AboutPage</name>
<message>
<location filename="../qml/pages/AboutPage.qml" line="23"/>
<source>About Application</source>
<translation>О приложении</translation>
</message>
<message>
<location filename="../qml/pages/AboutPage.qml" line="33"/>
<source>#descriptionText</source>
<translation>&lt;p&gt;Проект предоставляет шаблон приложений для ОС&amp;nbsp;Аврора.&lt;/p&gt;
&lt;p&gt;Основная цель&amp;nbsp; наглядно продемонстрировать практически минимальный исходный код для получения корректного и расширяемого приложения.&lt;/p&gt;</translation>
</message>
<message>
<location filename="../qml/pages/AboutPage.qml" line="38"/>
<source>3-Clause BSD License</source>
<translation>Лицензия 3-Clause BSD</translation>
</message>
<message>
<location filename="../qml/pages/AboutPage.qml" line="48"/>
<source>#licenseText</source>
<translation>&lt;p&gt;&lt;i&gt;Copyright (C) 2023 Open Mobile Platform LLC&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.&lt;/li&gt;
&lt;li&gt;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.&lt;/li&gt;
&lt;li&gt;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.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot; 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.&lt;/p&gt;</translation>
</message>
</context>
<context>
<name>DefaultCoverPage</name>
<message>
<location filename="../qml/cover/DefaultCoverPage.qml" line="12"/>
<source>Application Template</source>
<translation>Шаблон приложения</translation>
</message>
</context>
<context>
<name>MainPage</name>
<message>
<location filename="../qml/pages/MainPage.qml" line="13"/>
<source>Application Template</source>
<translation>Шаблон приложения</translation>
</message>
</context>
</TS>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="en">
<context>
<name>AboutPage</name>
<message>
<location filename="../qml/pages/AboutPage.qml" line="23"/>
<source>About Application</source>
<translation>About Application</translation>
</message>
<message>
<location filename="../qml/pages/AboutPage.qml" line="33"/>
<source>#descriptionText</source>
<translation>&lt;p&gt;The project provides a template for Aurora OS applications.&lt;/p&gt;
&lt;p&gt;The main purpose is to clearly demonstrate almost minimal source code to get a correct and extensible application.&lt;/p&gt;</translation>
</message>
<message>
<location filename="../qml/pages/AboutPage.qml" line="38"/>
<source>3-Clause BSD License</source>
<translation>3-Clause BSD License</translation>
</message>
<message>
<location filename="../qml/pages/AboutPage.qml" line="48"/>
<source>#licenseText</source>
<translation>&lt;p&gt;&lt;i&gt;Copyright (C) 2023 Open Mobile Platform LLC&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.&lt;/li&gt;
&lt;li&gt;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.&lt;/li&gt;
&lt;li&gt;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.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot; 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.&lt;/p&gt;</translation>
</message>
</context>
<context>
<name>DefaultCoverPage</name>
<message>
<location filename="../qml/cover/DefaultCoverPage.qml" line="12"/>
<source>Application Template</source>
<translation>Application Template</translation>
</message>
</context>
<context>
<name>MainPage</name>
<message>
<location filename="../qml/pages/MainPage.qml" line="13"/>
<source>Application Template</source>
<translation>Application Template</translation>
</message>
</context>
</TS>
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать