Skip to content

Commit

Permalink
[foilpics] Added settings page
Browse files Browse the repository at this point in the history
  • Loading branch information
monich committed Jun 18, 2022
1 parent c6e7ad0 commit bf1265f
Show file tree
Hide file tree
Showing 15 changed files with 247 additions and 23 deletions.
30 changes: 14 additions & 16 deletions app.pro
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
PREFIX = harbour
NAME = foilpics

openrepos {
PREFIX = openrepos
DEFINES += OPENREPOS
} else {
PREFIX = harbour
CONFIG += app_settings
}

TARGET = $${PREFIX}-$${NAME}
Expand Down Expand Up @@ -190,27 +189,26 @@ for(s, ICON_SIZES) {
icon_dir = icons/$${s}x$${s}
$${icon_target}.files = $${icon_dir}/$${TARGET}.png
$${icon_target}.path = /usr/share/icons/hicolor/$${s}x$${s}/apps
equals(PREFIX, "openrepos") {
$${icon_target}.extra = cp $${icon_dir}/harbour-$${NAME}.png $$eval($${icon_target}.files)
$${icon_target}.CONFIG += no_check_exist
}
INSTALLS += $${icon_target}
}

app_icon.files = icons/harbour-$${NAME}.svg
app_icon.path = /usr/share/$${TARGET}/qml/images
INSTALLS += app_icon

# Desktop file
equals(PREFIX, "openrepos") {
desktop.extra = sed s/harbour/openrepos/g harbour-$${NAME}.desktop > $${TARGET}.desktop
desktop.CONFIG += no_check_exist
# Settings
app_settings {
settings_json.files = settings/$${TARGET}.json
settings_json.path = /usr/share/jolla-settings/entries/
settings_qml.files = settings/*.qml
settings_qml.path = /usr/share/$${TARGET}/qml/settings/
INSTALLS += settings_qml settings_json
}
OTHER_FILES += \
settings/*.qml \
settings/*.json

# Translations
TRANSLATION_IDBASED=-idbased
TRANSLATION_SOURCES = \
$${_PRO_FILE_PWD_}/qml
$${_PRO_FILE_PWD_}/qml \
$${_PRO_FILE_PWD_}/settings

defineTest(addTrFile) {
rel = translations/$${1}
Expand Down
4 changes: 3 additions & 1 deletion rpm/harbour-foilpics.spec
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Url:
%setup -q -n %{name}-%{version}

%build
%qtc_qmake5 %{name}.pro
%qtc_qmake5 CONFIG+=openrepos %{name}.pro
%qtc_make %{?_smp_mflags}

%install
Expand All @@ -62,3 +62,5 @@ desktop-file-install --delete-original \
%{_datadir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.png
%{_datadir}/jolla-settings/entries/%{name}.json
%{_datadir}/translations/%{name}*.qm
14 changes: 14 additions & 0 deletions settings/harbour-foilpics.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"translation_catalog" : "harbour-foilpics",
"entries": [
{
"path": "applications/harbour-foilpics.desktop",
"title": "Foil Pics",
"type": "page",
"icon": "harbour-foilpics",
"params": {
"source": "/usr/share/harbour-foilpics/qml/settings/settings.qml"
}
}
]
}
65 changes: 65 additions & 0 deletions settings/settings.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
import org.nemomobile.configuration 1.0

Page {
readonly property string rootPath: "/apps/harbour-foilpics/"
property alias title: pageHeader.title

// jolla-settings expects these properties:
property var applicationName
property var applicationIcon

SilicaFlickable {
anchors.fill: parent
contentHeight: content.height

Column {
id: content
width: parent.width

PageHeader {
id: pageHeader

rightMargin: Theme.horizontalPageMargin + (appIcon.visible ? (height - appIcon.padding) : 0)
title: applicationName ? applicationName : "Foil Pics"
description: applicationName ?
//: Settings page header description (app version)
//% "Version %1"
qsTrId("foilpics-settings_page-header-version").arg("1.1.0") : ""

Image {
id: appIcon
readonly property int padding: Theme.paddingLarge
readonly property int size: pageHeader.height - 2 * padding
x: pageHeader.width - width - Theme.horizontalPageMargin
y: padding
width: size
height: size
sourceSize: Qt.size(size,size)
source: applicationIcon ? applicationIcon : ""
visible: appIcon.status === Image.Ready
}
}

TextSwitch {
//: Text switch label
//% "Automatic locking"
text: qsTrId("foilpics-settings_page-autolock-text")
//: Text switch description
//% "Require to enter Foil password after unlocking the screen."
description: qsTrId("foilpics-settings_page-autolock-description")
automaticCheck: false
checked: autoLockConfig.value
onClicked: autoLockConfig.value = !autoLockConfig.value

ConfigurationValue {
id: autoLockConfig

key: rootPath + "autoLock"
defaultValue: true
}
}
}
}
}
7 changes: 1 addition & 6 deletions src/FoilPicsDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,7 @@
#ifndef FOILPICS_DEFS_H
#define FOILPICS_DEFS_H

#ifdef OPENREPOS
# define FOILPICS_APP_NAME "openrepos-foilpics"
#else
# define FOILPICS_APP_NAME "harbour-foilpics"
#endif

#define FOILPICS_APP_NAME "harbour-foilpics"
#define FOILPICS_QML_IMPORT "harbour.foilpics"
#define FOILPICS_DCONF_ROOT "/apps/" FOILPICS_APP_NAME "/"

Expand Down
15 changes: 15 additions & 0 deletions translations/harbour-foilpics-de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,21 @@
<extracomment>Warning text, small size label below the password prompt</extracomment>
<translation type="unfinished">Beachten Sie, dass alle Foil-Apps denselben Verschlüsselungsschlüssel und dasselbe Kennwort verwenden.</translation>
</message>
<message id="foilpics-settings_page-header-version">
<source>Version %1</source>
<extracomment>Settings page header description (app version)</extracomment>
<translation type="unfinished">Version %1</translation>
</message>
<message id="foilpics-settings_page-autolock-text">
<source>Automatic locking</source>
<extracomment>Text switch label</extracomment>
<translation type="unfinished">Automatische Sperrung</translation>
</message>
<message id="foilpics-settings_page-autolock-description">
<source>Require to enter Foil password after unlocking the screen.</source>
<extracomment>Text switch description</extracomment>
<translation type="unfinished">Nach dem Entsperren des Bildschirms muss das Foil-Passwort eingegeben werden.</translation>
</message>
<message id="jail-explanation">
<source>This application is not designed to function in a sandbox. Try installing the latest version from &lt;b&gt;&lt;a href=&apos;%1&apos;&gt;OpenRepos&lt;/a&gt;&lt;/b&gt; or &lt;b&gt;&lt;a href=&apos;%2&apos;&gt;GitHub&lt;/a&gt;&lt;/b&gt;, it may implement some sort of a workaround. No guarantee, though.</source>
<extracomment>Label text explaining the sandbox situation</extracomment>
Expand Down
15 changes: 15 additions & 0 deletions translations/harbour-foilpics-es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,21 @@
<extracomment>Warning text, small size label below the password prompt</extracomment>
<translation type="unfinished">Tenga en cuenta que todas las aplicaciones de Foil usan la misma clave de cifrado y contraseña.</translation>
</message>
<message id="foilpics-settings_page-header-version">
<source>Version %1</source>
<extracomment>Settings page header description (app version)</extracomment>
<translation type="unfinished">Versión %1</translation>
</message>
<message id="foilpics-settings_page-autolock-text">
<source>Automatic locking</source>
<extracomment>Text switch label</extracomment>
<translation type="unfinished">Bloqueo automático</translation>
</message>
<message id="foilpics-settings_page-autolock-description">
<source>Require to enter Foil password after unlocking the screen.</source>
<extracomment>Text switch description</extracomment>
<translation type="unfinished">Requiere ingresar la contraseña de Foil después de desbloquear la pantalla.</translation>
</message>
<message id="jail-explanation">
<source>This application is not designed to function in a sandbox. Try installing the latest version from &lt;b&gt;&lt;a href=&apos;%1&apos;&gt;OpenRepos&lt;/a&gt;&lt;/b&gt; or &lt;b&gt;&lt;a href=&apos;%2&apos;&gt;GitHub&lt;/a&gt;&lt;/b&gt;, it may implement some sort of a workaround. No guarantee, though.</source>
<extracomment>Label text explaining the sandbox situation</extracomment>
Expand Down
15 changes: 15 additions & 0 deletions translations/harbour-foilpics-fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,21 @@
<extracomment>Warning text, small size label below the password prompt</extracomment>
<translation>Sachez que toutes les applications Foil partagent leur clef de chiffrement et leur mot de passe.</translation>
</message>
<message id="foilpics-settings_page-header-version">
<source>Version %1</source>
<extracomment>Settings page header description (app version)</extracomment>
<translation type="unfinished">Version %1</translation>
</message>
<message id="foilpics-settings_page-autolock-text">
<source>Automatic locking</source>
<extracomment>Text switch label</extracomment>
<translation type="unfinished">Verrouillage automatique</translation>
</message>
<message id="foilpics-settings_page-autolock-description">
<source>Require to enter Foil password after unlocking the screen.</source>
<extracomment>Text switch description</extracomment>
<translation type="unfinished">Nécessite d&apos;entrer le mot de passe Foil après avoir déverrouillé l&apos;écran.</translation>
</message>
<message id="jail-explanation">
<source>This application is not designed to function in a sandbox. Try installing the latest version from &lt;b&gt;&lt;a href=&apos;%1&apos;&gt;OpenRepos&lt;/a&gt;&lt;/b&gt; or &lt;b&gt;&lt;a href=&apos;%2&apos;&gt;GitHub&lt;/a&gt;&lt;/b&gt;, it may implement some sort of a workaround. No guarantee, though.</source>
<extracomment>Label text explaining the sandbox situation</extracomment>
Expand Down
15 changes: 15 additions & 0 deletions translations/harbour-foilpics-hu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,21 @@
<extracomment>Warning text, small size label below the password prompt</extracomment>
<translation>Figyeljen rá, hogy mindegyik Foil alkalmazás ugyanazt a titkosítási kulcsot és jelszót használja.</translation>
</message>
<message id="foilpics-settings_page-header-version">
<source>Version %1</source>
<extracomment>Settings page header description (app version)</extracomment>
<translation type="unfinished">Verzió %1</translation>
</message>
<message id="foilpics-settings_page-autolock-text">
<source>Automatic locking</source>
<extracomment>Text switch label</extracomment>
<translation type="unfinished">Automatikus lezárás</translation>
</message>
<message id="foilpics-settings_page-autolock-description">
<source>Require to enter Foil password after unlocking the screen.</source>
<extracomment>Text switch description</extracomment>
<translation type="unfinished">A képernyő feloldása után meg kell adnia a Foil jelszót.</translation>
</message>
<message id="jail-explanation">
<source>This application is not designed to function in a sandbox. Try installing the latest version from &lt;b&gt;&lt;a href=&apos;%1&apos;&gt;OpenRepos&lt;/a&gt;&lt;/b&gt; or &lt;b&gt;&lt;a href=&apos;%2&apos;&gt;GitHub&lt;/a&gt;&lt;/b&gt;, it may implement some sort of a workaround. No guarantee, though.</source>
<extracomment>Label text explaining the sandbox situation</extracomment>
Expand Down
15 changes: 15 additions & 0 deletions translations/harbour-foilpics-nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,21 @@
<extracomment>Warning text, small size label below the password prompt</extracomment>
<translation>Merk op dat alle Foil-apps dezelfde coderingssleutel en wachtwoord gebruiken.</translation>
</message>
<message id="foilpics-settings_page-header-version">
<source>Version %1</source>
<extracomment>Settings page header description (app version)</extracomment>
<translation type="unfinished">Versie %1</translation>
</message>
<message id="foilpics-settings_page-autolock-text">
<source>Automatic locking</source>
<extracomment>Text switch label</extracomment>
<translation type="unfinished">Automatisch vergrendelen</translation>
</message>
<message id="foilpics-settings_page-autolock-description">
<source>Require to enter Foil password after unlocking the screen.</source>
<extracomment>Text switch description</extracomment>
<translation type="unfinished">Vereisen om Foil wachtwoord in te voeren nadat het scherm is ontgrendeld.</translation>
</message>
<message id="jail-explanation">
<source>This application is not designed to function in a sandbox. Try installing the latest version from &lt;b&gt;&lt;a href=&apos;%1&apos;&gt;OpenRepos&lt;/a&gt;&lt;/b&gt; or &lt;b&gt;&lt;a href=&apos;%2&apos;&gt;GitHub&lt;/a&gt;&lt;/b&gt;, it may implement some sort of a workaround. No guarantee, though.</source>
<extracomment>Label text explaining the sandbox situation</extracomment>
Expand Down
15 changes: 15 additions & 0 deletions translations/harbour-foilpics-pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,21 @@
<extracomment>Warning text, small size label below the password prompt</extracomment>
<translation>Pamiętaj, że wszystkie aplikacje Foil współdzielą klucz szyfrowania i hasło.</translation>
</message>
<message id="foilpics-settings_page-header-version">
<source>Version %1</source>
<extracomment>Settings page header description (app version)</extracomment>
<translation>Wersja %1</translation>
</message>
<message id="foilpics-settings_page-autolock-text">
<source>Automatic locking</source>
<extracomment>Text switch label</extracomment>
<translation type="unfinished">Automatyczne blokowanie</translation>
</message>
<message id="foilpics-settings_page-autolock-description">
<source>Require to enter Foil password after unlocking the screen.</source>
<extracomment>Text switch description</extracomment>
<translation type="unfinished">Wymagaj podania Foil hasła po odblokowaniu ekranu.</translation>
</message>
<message id="jail-explanation">
<source>This application is not designed to function in a sandbox. Try installing the latest version from &lt;b&gt;&lt;a href=&apos;%1&apos;&gt;OpenRepos&lt;/a&gt;&lt;/b&gt; or &lt;b&gt;&lt;a href=&apos;%2&apos;&gt;GitHub&lt;/a&gt;&lt;/b&gt;, it may implement some sort of a workaround. No guarantee, though.</source>
<extracomment>Label text explaining the sandbox situation</extracomment>
Expand Down
15 changes: 15 additions & 0 deletions translations/harbour-foilpics-ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,21 @@
<extracomment>Warning text, small size label below the password prompt</extracomment>
<translation>Имейте в виду, что все Foil приложения использует тот же ключ с тем же паролем.</translation>
</message>
<message id="foilpics-settings_page-header-version">
<source>Version %1</source>
<extracomment>Settings page header description (app version)</extracomment>
<translation>Версия %1</translation>
</message>
<message id="foilpics-settings_page-autolock-text">
<source>Automatic locking</source>
<extracomment>Text switch label</extracomment>
<translation>Автоматическая блокировка</translation>
</message>
<message id="foilpics-settings_page-autolock-description">
<source>Require to enter Foil password after unlocking the screen.</source>
<extracomment>Text switch description</extracomment>
<translation>Требовать ввода пароля после разблокировки экрана.</translation>
</message>
<message id="jail-explanation">
<source>This application is not designed to function in a sandbox. Try installing the latest version from &lt;b&gt;&lt;a href=&apos;%1&apos;&gt;OpenRepos&lt;/a&gt;&lt;/b&gt; or &lt;b&gt;&lt;a href=&apos;%2&apos;&gt;GitHub&lt;/a&gt;&lt;/b&gt;, it may implement some sort of a workaround. No guarantee, though.</source>
<extracomment>Label text explaining the sandbox situation</extracomment>
Expand Down
15 changes: 15 additions & 0 deletions translations/harbour-foilpics-sv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,21 @@ Om du har glömt ditt lösenord, bör du veta att det troligen är datortekniskt
<extracomment>Warning text, small size label below the password prompt</extracomment>
<translation type="unfinished">Notera att alla Foil-appar delar krypteringsnyckel och lösenord.</translation>
</message>
<message id="foilpics-settings_page-header-version">
<source>Version %1</source>
<extracomment>Settings page header description (app version)</extracomment>
<translation>Version %1</translation>
</message>
<message id="foilpics-settings_page-autolock-text">
<source>Automatic locking</source>
<extracomment>Text switch label</extracomment>
<translation type="unfinished">Automatisk låsning</translation>
</message>
<message id="foilpics-settings_page-autolock-description">
<source>Require to enter Foil password after unlocking the screen.</source>
<extracomment>Text switch description</extracomment>
<translation type="unfinished">Kräv att ange Foil lösenord efter att ha låst upp skärmen.</translation>
</message>
<message id="jail-explanation">
<source>This application is not designed to function in a sandbox. Try installing the latest version from &lt;b&gt;&lt;a href=&apos;%1&apos;&gt;OpenRepos&lt;/a&gt;&lt;/b&gt; or &lt;b&gt;&lt;a href=&apos;%2&apos;&gt;GitHub&lt;/a&gt;&lt;/b&gt;, it may implement some sort of a workaround. No guarantee, though.</source>
<extracomment>Label text explaining the sandbox situation</extracomment>
Expand Down
15 changes: 15 additions & 0 deletions translations/harbour-foilpics-zh_CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,21 @@
<extracomment>Warning text, small size label below the password prompt</extracomment>
<translation>请记住所有的 Foil 系列软件均使用相同的加密秘钥及密码。</translation>
</message>
<message id="foilpics-settings_page-header-version">
<source>Version %1</source>
<extracomment>Settings page header description (app version)</extracomment>
<translation type="unfinished">版本 %1</translation>
</message>
<message id="foilpics-settings_page-autolock-text">
<source>Automatic locking</source>
<extracomment>Text switch label</extracomment>
<translation type="unfinished">自动锁定</translation>
</message>
<message id="foilpics-settings_page-autolock-description">
<source>Require to enter Foil password after unlocking the screen.</source>
<extracomment>Text switch description</extracomment>
<translation type="unfinished">解锁屏幕后需要输入Foil密码。</translation>
</message>
<message id="jail-explanation">
<source>This application is not designed to function in a sandbox. Try installing the latest version from &lt;b&gt;&lt;a href=&apos;%1&apos;&gt;OpenRepos&lt;/a&gt;&lt;/b&gt; or &lt;b&gt;&lt;a href=&apos;%2&apos;&gt;GitHub&lt;/a&gt;&lt;/b&gt;, it may implement some sort of a workaround. No guarantee, though.</source>
<extracomment>Label text explaining the sandbox situation</extracomment>
Expand Down
Loading

0 comments on commit bf1265f

Please sign in to comment.