diff --git a/internal/frontend/qml/ImportExportUI/Credits.qml b/internal/frontend/qml/ImportExportUI/Credits.qml index ef85265a..0e071757 100644 --- a/internal/frontend/qml/ImportExportUI/Credits.qml +++ b/internal/frontend/qml/ImportExportUI/Credits.qml @@ -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() } } } } - diff --git a/internal/frontend/qt-ie/frontend.go b/internal/frontend/qt-ie/frontend.go index 32971fa7..e8a0e9a9 100644 --- a/internal/frontend/qt-ie/frontend.go +++ b/internal/frontend/qt-ie/frontend.go @@ -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)) diff --git a/internal/frontend/qt-ie/ui.go b/internal/frontend/qt-ie/ui.go index fe2ee8bf..26029a65 100644 --- a/internal/frontend/qt-ie/ui.go +++ b/internal/frontend/qt-ie/ui.go @@ -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"` diff --git a/internal/frontend/types/types.go b/internal/frontend/types/types.go index 38032e9a..cf8da377 100644 --- a/internal/frontend/types/types.go +++ b/internal/frontend/types/types.go @@ -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 } diff --git a/internal/importexport/importexport.go b/internal/importexport/importexport.go index bc813984..3cab2c92 100644 --- a/internal/importexport/importexport.go +++ b/internal/importexport/importexport.go @@ -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) {} diff --git a/utils/credits.sh b/utils/credits.sh index 4c9ccf9f..ed265dee 100755 --- a/utils/credits.sh +++ b/utils/credits.sh @@ -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