-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from miikasda/about
Add about page
- Loading branch information
Showing
36 changed files
with
1,058 additions
and
1 deletion.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
//@ This file is part of opal-about. | ||
//@ https://github.com/Pretty-SFOS/opal-about | ||
//@ SPDX-FileCopyrightText: 2020-2023 Mirian Margiani | ||
//@ SPDX-License-Identifier: GPL-3.0-or-later | ||
import QtQuick 2.0 | ||
import Sailfish.Silica 1.0 | ||
import"private/functions.js"as Func | ||
import"private" | ||
Page{id:page | ||
property string appName:"" | ||
property string appIcon:"" | ||
property string appVersion:"" | ||
property string appRelease:"1" | ||
property string appReleaseType:"" | ||
property string description:"" | ||
property var mainAttributions:[] | ||
property var authors:[] | ||
property var __effectiveMainAttribs:Func.makeStringListConcat(authors,mainAttributions,false) | ||
property string sourcesUrl:"" | ||
property string translationsUrl:"" | ||
property string homepageUrl:"" | ||
property list<ChangelogItem>changelogItems | ||
property url changelogList | ||
property list<License>licenses | ||
property bool allowDownloadingLicenses:false | ||
property list<Attribution>attributions | ||
readonly property DonationsGroup donations:DonationsGroup{} | ||
property list<InfoSection>extraSections | ||
property list<ContributionSection>contributionSections | ||
property alias flickable:_flickable | ||
property alias _pageHeaderItem:_pageHeader | ||
property alias _iconItem:_icon | ||
property alias _develInfoSection:_develInfo | ||
property alias _licenseInfoSection:_licenseInfo | ||
property alias _donationsInfoSection:_donationsInfo | ||
readonly property Attribution _effectiveSelfAttribution:Attribution{name:appName | ||
entries:__effectiveMainAttribs | ||
licenses:page.licenses | ||
homepage:homepageUrl | ||
sources:sourcesUrl | ||
} | ||
function openOrCopyUrl(externalUrl,title){pageStack.push(Qt.resolvedUrl("private/ExternalUrlPage.qml"),{"externalUrl":externalUrl,"title":!!title?title:""}) | ||
}allowedOrientations:Orientation.All | ||
SilicaFlickable{id:_flickable | ||
contentHeight:column.height | ||
anchors.fill:parent | ||
VerticalScrollDecorator{}onContentHeightChanged:{if(_flickable.contentHeight>page.height&&_flickable.contentHeight-_pageHeader.origHeight+Theme.paddingMedium<page.height){var to=(page.height-(_flickable.contentHeight-_pageHeader.origHeight))/2+Theme.paddingMedium | ||
if(to<paddingAnim.to)paddingAnim.to=to | ||
hideAnim.restart() | ||
}}Column{id:column | ||
width:parent.width | ||
spacing:1.5*Theme.paddingLarge | ||
PageHeader{id:_pageHeader | ||
property real origHeight:height | ||
title:qsTranslate("Opal.About","About") | ||
Component.onCompleted:origHeight=height | ||
ParallelAnimation{id:hideAnim | ||
FadeAnimator{target:_pageHeader | ||
to:0.0 | ||
duration:80 | ||
}SmoothedAnimation{id:paddingAnim | ||
target:_pageHeader | ||
property:"height" | ||
to:_pageHeader.origHeight | ||
duration:80 | ||
}}}Image{id:_icon | ||
anchors.horizontalCenter:parent.horizontalCenter | ||
width:Theme.itemSizeExtraLarge | ||
height:Theme.itemSizeExtraLarge | ||
fillMode:Image.PreserveAspectFit | ||
source:appIcon | ||
verticalAlignment:Image.AlignVCenter | ||
}Column{width:parent.width-2*Theme.horizontalPageMargin | ||
anchors.horizontalCenter:parent.horizontalCenter | ||
spacing:Theme.paddingSmall | ||
Label{width:parent.width | ||
visible:appName!=="" | ||
text:appName | ||
color:Theme.highlightColor | ||
font.pixelSize:Theme.fontSizeLarge | ||
horizontalAlignment:Text.AlignHCenter | ||
}Label{width:parent.width | ||
visible:String(appVersion!=="") | ||
text:qsTranslate("Opal.About","Version %1").arg(Func.formatAppVersion(appVersion,appRelease,appReleaseType)) | ||
wrapMode:Text.Wrap | ||
color:Theme.secondaryHighlightColor | ||
font.pixelSize:Theme.fontSizeMedium | ||
horizontalAlignment:Text.AlignHCenter | ||
}}Label{anchors.horizontalCenter:parent.horizontalCenter | ||
width:parent.width-2*Theme.horizontalPageMargin | ||
text:description | ||
onLinkActivated:openOrCopyUrl(link) | ||
wrapMode:Text.Wrap | ||
textFormat:Text.StyledText | ||
horizontalAlignment:Text.AlignHCenter | ||
linkColor:palette.secondaryColor | ||
palette.primaryColor:Theme.highlightColor | ||
}InfoSection{id:_develInfo | ||
width:parent.width | ||
title:qsTranslate("Opal.About","Development") | ||
enabled:contributionSections.length>0||attributions.length>0 | ||
text:__effectiveMainAttribs.join(", ") | ||
showMoreLabel:qsTranslate("Opal.About","show contributors") | ||
onClicked:{pageStack.animatorPush("private/ContributorsPage.qml",{"appName":appName,"sections":contributionSections,"attributions":attributions,"mainAttributions":__effectiveMainAttribs,"allowDownloadingLicenses":allowDownloadingLicenses}) | ||
}buttons:[InfoButton{text:qsTranslate("Opal.About","Homepage") | ||
onClicked:openOrCopyUrl(homepageUrl,text) | ||
enabled:homepageUrl!=="" | ||
},InfoButton{text:qsTranslate("Opal.About","Changelog") | ||
onClicked:pageStack.animatorPush(Qt.resolvedUrl("private/ChangelogPage.qml"),{appName:appName,changelogItems:changelogItems,changelogList:changelogList}) | ||
enabled:changelogItems.length>0||changelogList!="" | ||
},InfoButton{text:qsTranslate("Opal.About","Translations") | ||
onClicked:openOrCopyUrl(translationsUrl,text) | ||
enabled:translationsUrl!=="" | ||
},InfoButton{text:qsTranslate("Opal.About","Source Code") | ||
onClicked:openOrCopyUrl(sourcesUrl,text) | ||
enabled:sourcesUrl!=="" | ||
}]}Column{width:parent.width | ||
spacing:parent.spacing | ||
children:extraSections | ||
}InfoSection{id:_donationsInfo | ||
visible:donations.services.length>0||donations.text!=="" | ||
width:parent.width | ||
title:qsTranslate("Opal.About","Donations") | ||
enabled:false | ||
text:donations.text===""?donations.defaultTextGeneral:donations.text | ||
__donationButtons:donations.services | ||
}InfoSection{id:_licenseInfo | ||
width:parent.width | ||
title:qsTranslate("Opal.About","License") | ||
enabled:licenses.length>0 | ||
onClicked:pageStack.animatorPush("private/LicensePage.qml",{"mainAttribution":_effectiveSelfAttribution,"attributions":attributions,"allowDownloadingLicenses":allowDownloadingLicenses,"enableSourceHint":true}) | ||
text:enabled===false?"This component has been improperly configured. Please report this bug.":((licenses[0].name!==""&&licenses[0].error!==true)?licenses[0].name:licenses[0].spdxId) | ||
smallPrint:licenses[0].customShortText | ||
showMoreLabel:qsTranslate("Opal.About","show license(s)","",licenses.length+attributions.length) | ||
clip:true | ||
Behavior on height{SmoothedAnimation{duration:80 | ||
}}}Item{id:bottomVerticalSpacing | ||
width:parent.width | ||
height:Theme.paddingMedium | ||
}}}Component.onCompleted:{if(__silica_applicationwindow_instance&&__silica_applicationwindow_instance._defaultPageOrientations){__silica_applicationwindow_instance._defaultPageOrientations=Orientation.All | ||
}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//@ This file is part of opal-about. | ||
//@ https://github.com/Pretty-SFOS/opal-about | ||
//@ SPDX-FileCopyrightText: 2021-2022 Mirian Margiani | ||
//@ SPDX-License-Identifier: GPL-3.0-or-later | ||
import QtQuick 2.0 | ||
import"private/functions.js"as Func | ||
QtObject{property string name | ||
property var entries:[] | ||
property list<License>licenses | ||
property string description | ||
property string homepage | ||
property string sources | ||
property var __effectiveEntries:Func.makeStringList(entries,false) | ||
property var _spdxList:null | ||
function _getSpdxList(force){var upd=Func.updateSpdxList(licenses,_spdxList,force) | ||
if(upd!==null){_spdxList=upd.spdx | ||
}return _spdxList | ||
}function _getSpdxString(append,force){var str=_getSpdxList(force).join(", ") | ||
if(str!==""&&append)str=str+" "+append | ||
return str | ||
}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
//@ This file is part of opal-about. | ||
//@ https://github.com/Pretty-SFOS/opal-about | ||
//@ SPDX-FileCopyrightText: 2023 Mirian Margiani | ||
//@ SPDX-License-Identifier: GPL-3.0-or-later | ||
import QtQuick 2.0 | ||
import"private/functions.js"as Func | ||
QtObject{property string version | ||
property date date:new Date(NaN) | ||
property string author | ||
property var paragraphs | ||
property int textFormat:Text.StyledText | ||
property var __effectiveEntries:Func.makeStringList(paragraphs,false) | ||
property string __effectiveSection:version+(isNaN(date.valueOf())?"":"|"+Qt.formatDate(date,Qt.DefaultLocaleShortDate)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//@ This file is part of opal-about. | ||
//@ https://github.com/Pretty-SFOS/opal-about | ||
//@ SPDX-FileCopyrightText: 2023 Mirian Margiani | ||
//@ SPDX-License-Identifier: GPL-3.0-or-later | ||
import QtQuick 2.0 | ||
QtObject{id:root | ||
default property alias content:root.changelogItems | ||
property list<ChangelogItem>changelogItems | ||
readonly property int __is_opal_about_changelog_list:0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
//@ This file is part of opal-about. | ||
//@ https://github.com/Pretty-SFOS/opal-about | ||
//@ SPDX-FileCopyrightText: 2023 Mirian Margiani | ||
//@ SPDX-License-Identifier: GPL-3.0-or-later | ||
import QtQuick 2.2 | ||
import Sailfish.Silica 1.0 | ||
import Nemo.Configuration 1.0 | ||
import"private/functions.js"as Func | ||
import"private" | ||
Item{id:root | ||
property list<ChangelogItem>changelogItems | ||
property url changelogList | ||
property string _applicationName:Qt.application.name | ||
property string _organizationName:Qt.application.organization | ||
readonly property string __lastVersion:!!configLoader.item?configLoader.item.lastVersion:"" | ||
readonly property string __configPath:"/settings/opal/opal-about/"+"changelog-overlay/%1/%2".arg(_organizationName).arg(_applicationName) | ||
property list<ChangelogItem>__filteredItems | ||
property int __ready:(configLoader.status===Loader.Ready?1:0)+(itemsLoader.effectiveItems.length>0?1:0) | ||
function show(){showTimer.stop() | ||
pageStack.completeAnimation() | ||
pageStack.push(dialogComponent) | ||
}function _markAsRead(){if(__filteredItems.length===0){return | ||
}var latestChangelogVersion=__filteredItems[0].version | ||
configLoader.item.lastVersion=latestChangelogVersion | ||
}Component.onCompleted:{if(!_applicationName||!_organizationName){console.warn("[Opal.About] both application name and organisation name "+"must be set in order to use the changelog overlay") | ||
console.warn("[Opal.About] note that these properties are also required "+"for Sailjail sandboxing") | ||
console.warn("[Opal.About] see: https://github.com/sailfishos/"+"sailjail-permissions#desktop-file-changes") | ||
}}on__ReadyChanged:{if(__ready<2||itemsLoader.effectiveItems.length===0||__filteredItems.length>0)return | ||
if(!!__lastVersion){var loadedItems=[] | ||
for(var i in itemsLoader.effectiveItems){var v=itemsLoader.effectiveItems[i].version | ||
if(v===__lastVersion){break | ||
}console.log("[Opal.About] showing changelog for:",v) | ||
loadedItems.push(itemsLoader.effectiveItems[i]) | ||
}if(loadedItems.length>0){__filteredItems=loadedItems | ||
showTimer.start() | ||
}else{__filteredItems=itemsLoader.effectiveItems | ||
}}else{__filteredItems=itemsLoader.effectiveItems | ||
_markAsRead() | ||
__ready=-1 | ||
}}Loader{id:configLoader | ||
sourceComponent:!!_applicationName&&!!_organizationName?configComponent:null | ||
asynchronous:true | ||
}ChangelogItemsLoader{id:itemsLoader | ||
changelogItems:root.changelogItems | ||
changelogList:root.changelogList | ||
}Timer{id:showTimer | ||
interval:10 | ||
repeat:true | ||
running:false | ||
onTriggered:{if(pageStack.busy||pageStack.depth===0)return | ||
show() | ||
}}Component{id:configComponent | ||
ConfigurationGroup{path:root.__configPath | ||
property string lastVersion:"" | ||
}}Component{id:dialogComponent | ||
Dialog{allowedOrientations:Orientation.All | ||
onDone:_markAsRead() | ||
ChangelogView{anchors.fill:parent | ||
changelogItems:root.__filteredItems | ||
header:PageHeader{title:qsTranslate("Opal.About","News") | ||
description:qsTranslate("Opal.About","Changes since version %1").arg(__lastVersion) | ||
descriptionWrapMode:Text.Wrap | ||
}}}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//@ This file is part of opal-about. | ||
//@ https://github.com/Pretty-SFOS/opal-about | ||
//@ SPDX-FileCopyrightText: 2020-2021 Mirian Margiani | ||
//@ SPDX-License-Identifier: GPL-3.0-or-later | ||
import QtQuick 2.0 | ||
import"private/functions.js"as Func | ||
QtObject{property string title | ||
property var entries:[] | ||
property var __effectiveEntries:Func.makeStringList(entries) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//@ This file is part of opal-about. | ||
//@ https://github.com/Pretty-SFOS/opal-about | ||
//@ SPDX-FileCopyrightText: 2020-2021 Mirian Margiani | ||
//@ SPDX-License-Identifier: GPL-3.0-or-later | ||
import QtQuick 2.0 | ||
QtObject{property string title | ||
property list<ContributionGroup>groups | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//@ This file is part of opal-about. | ||
//@ https://github.com/Pretty-SFOS/opal-about | ||
//@ SPDX-FileCopyrightText: 2021 Mirian Margiani | ||
//@ SPDX-License-Identifier: GPL-3.0-or-later | ||
import QtQuick 2.0 | ||
QtObject{property string name | ||
property string url | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//@ This file is part of opal-about. | ||
//@ https://github.com/Pretty-SFOS/opal-about | ||
//@ SPDX-FileCopyrightText: 2021 Mirian Margiani | ||
//@ SPDX-License-Identifier: GPL-3.0-or-later | ||
import QtQuick 2.0 | ||
QtObject{property string text:"" | ||
property bool enabled:true | ||
signal clicked | ||
} |
Oops, something went wrong.