Keep Import-Export credits up to date

This commit is contained in:
Pavel Škoda
2020-08-17 10:28:10 +02:00
committed by Michal Horejsek
parent 658ead9fb3
commit df80e7eb27
6 changed files with 21 additions and 61 deletions

View File

@ -32,61 +32,20 @@ Item {
ListView {
anchors.fill: parent
clip: true
model: go.credits.split(";")
model: [
"github.com/0xAX/notificator" ,
"github.com/abiosoft/ishell" ,
"github.com/allan-simon/go-singleinstance" ,
"github.com/andybalholm/cascadia" ,
"github.com/bgentry/speakeasy" ,
"github.com/boltdb/bolt" ,
"github.com/docker/docker-credential-helpers" ,
"github.com/emersion/go-imap" ,
"github.com/emersion/go-imap-appendlimit" ,
"github.com/emersion/go-imap-idle" ,
"github.com/emersion/go-imap-move" ,
"github.com/emersion/go-imap-quota" ,
"github.com/emersion/go-imap-specialuse" ,
"github.com/emersion/go-smtp" ,
"github.com/emersion/go-textwrapper" ,
"github.com/fsnotify/fsnotify" ,
"github.com/jaytaylor/html2text" ,
"github.com/jhillyerd/go.enmime" ,
"github.com/k0kubun/pp" ,
"github.com/kardianos/osext" ,
"github.com/keybase/go-keychain" ,
"github.com/mattn/go-colorable" ,
"github.com/pkg/browser" ,
"github.com/shibukawa/localsocket" ,
"github.com/shibukawa/tobubus" ,
"github.com/shirou/gopsutil" ,
"github.com/sirupsen/logrus" ,
"github.com/skratchdot/open-golang/open" ,
"github.com/therecipe/qt" ,
"github.com/thomasf/systray" ,
"github.com/ugorji/go/codec" ,
"github.com/urfave/cli" ,
"" ,
"Font Awesome 4.7.0",
"" ,
"The Qt Company - Qt 5.9.1 LGPLv3" ,
"" ,
]
delegate: Text {
delegate: AccessibleText {
anchors.horizontalCenter: parent.horizontalCenter
text: modelData
color: Style.main.text
font.pointSize: Style.main.fontSize * Style.pt
}
footer: ButtonRounded {
anchors.horizontalCenter: parent.horizontalCenter
text: "Close"
onClicked: {
root.parent.hide()
}
text: qsTr("Close", "close window")
onClicked: dialogCredits.hide()
}
}
}
}

View File

@ -28,6 +28,7 @@ import (
"github.com/ProtonMail/proton-bridge/internal/events"
qtcommon "github.com/ProtonMail/proton-bridge/internal/frontend/qt-common"
"github.com/ProtonMail/proton-bridge/internal/frontend/types"
"github.com/ProtonMail/proton-bridge/internal/importexport"
"github.com/ProtonMail/proton-bridge/internal/transfer"
"github.com/ProtonMail/proton-bridge/internal/updates"
"github.com/ProtonMail/proton-bridge/pkg/config"
@ -94,10 +95,6 @@ func New(
ie: ie,
}
// Nicer string for OS
currentOS := core.QSysInfo_PrettyProductName()
ie.SetCurrentOS(currentOS)
log.Debugf("New Qt frontend: %p", f)
return f
}
@ -218,6 +215,10 @@ func (f *FrontendQt) QtExecute(Procedure func(*FrontendQt) error) error {
if err := Procedure(f); err != nil {
return err
}
// List of used packages
f.Qml.SetCredits(importexport.Credits)
// Loop
if ret := gui.QGuiApplication_Exec(); ret != 0 {
//err := errors.New(errors.ErrQApplication, "Event loop ended with return value: %v", string(ret))

View File

@ -35,6 +35,7 @@ type GoQMLInterface struct {
_ string `property:"currentAddress"`
_ string `property:"goos"`
_ string `property:"credits"`
_ bool `property:"isFirstStart"`
_ bool `property:"isRestarting"`
_ bool `property:"isConnectionOK"`

View File

@ -112,7 +112,6 @@ type ImportExporter interface {
GetRemoteImporter(string, string, string, string, string) (*transfer.Transfer, error)
GetEMLExporter(string, string) (*transfer.Transfer, error)
GetMBOXExporter(string, string) (*transfer.Transfer, error)
SetCurrentOS(os string)
ReportBug(osType, osVersion, description, accountName, address, emailClient string) error
ReportFile(osType, osVersion, accountName, address string, logdata []byte) error
}

View File

@ -169,6 +169,3 @@ func (ie *ImportExport) getPMAPIProvider(address string) (*transfer.PMAPIProvide
return transfer.NewPMAPIProvider(ie.clientManager, user.ID(), addressID)
}
// SetCurrentOS TODO
func (ie *ImportExport) SetCurrentOS(os string) {}

View File

@ -23,14 +23,17 @@ PACKAGE=$1
# Vendor packages
LOCKFILE=../go.mod
egrep $'^\t[^=>]*$' $LOCKFILE | sed -r 's/\t([^ ]*) v.*/\1/g' > tmp1-$PACKAGE
egrep $'^\t.*=>.*v.*$' $LOCKFILE | sed -r 's/^.*=> ([^ ]*)( v.*)?/\1/g' >> tmp1-$PACKAGE
cat tmp1-$PACKAGE | egrep -v 'therecipe/qt/internal|therecipe/env_.*_512|protontech' | sort | uniq > tmp-$PACKAGE
TEMPFILE1=$(mktemp)
TEMPFILE2=$(mktemp)
egrep $'^\t[^=>]*$' $LOCKFILE | sed -r 's/\t([^ ]*) v.*/\1/g' > $TEMPFILE1
egrep $'^\t.*=>.*v.*$' $LOCKFILE | sed -r 's/^.*=> ([^ ]*)( v.*)?/\1/g' >> $TEMPFILE1
cat $TEMPFILE1 | egrep -v 'therecipe/qt/internal|therecipe/env_.*_512|protontech' | sort | uniq > $TEMPFILE2
# Add non vendor credits
echo -e "\nFont Awesome 4.7.0\n\nQt 5.13 by Qt group\n" >> tmp-$PACKAGE
echo -e "\nFont Awesome 4.7.0\n\nQt 5.13 by Qt group\n" >> $TEMPFILE2
# join lines
sed -i -e ':a' -e 'N' -e '$!ba' -e 's|\n|;|g' tmp-$PACKAGE
sed -i -e ':a' -e 'N' -e '$!ba' -e 's|\n|;|g' $TEMPFILE2
cat ../utils/license_header.txt > ../internal/$PACKAGE/credits.go
echo -e '// Code generated by '`echo $0`' at '`date`'. DO NOT EDIT.\n\npackage '$PACKAGE'\n\nconst Credits = "'$(cat tmp-$PACKAGE)'"' >> ../internal/$PACKAGE/credits.go
rm tmp1-$PACKAGE tmp-$PACKAGE
echo -e '// Code generated by '`echo $0`' at '`date`'. DO NOT EDIT.\n\npackage '$PACKAGE'\n\nconst Credits = "'$(cat $TEMPFILE2)'"' >> ../internal/$PACKAGE/credits.go
rm $TEMPFILE1 $TEMPFILE2