gcd.firstTime + SettingsList scrolls
the build was successful Details

This commit is contained in:
Sarah Jamie Lewis 2020-11-23 12:50:06 -08:00
parent b4b10ca75f
commit 228a9b6ebd
12 changed files with 73 additions and 45 deletions

10
QML_DEBUG_NOTES.md Normal file
View File

@ -0,0 +1,10 @@
# Settings List / Flickable
Content not scrolling: Flickable does some reparenting behind the scenes and so
in the top level child of the Flickable you will need:
parent: root.contentItem
And in the flickable you will need to set the contentHeight:
contentHeight: <childId>.height + <padding>

View File

@ -36,18 +36,18 @@ type GrandCentralDispatcher struct {
m_selectedProfile string
m_selectedConversation string
_ string `property:"os"`
_ float32 `property:"themeScale,auto,changed"`
_ string `property:"theme,auto,changed"`
_ string `property:"locale,auto,changed"`
_ string `property:"version"`
_ string `property:"buildDate"`
_ string `property:"assetPath"`
_ string `property:"selectedProfile,auto"`
_ string `property:"selectedConversation,auto"`
_ int `property:"torStatus"`
_ string `property:"os"`
_ bool `property:"firstTime"`
_ float32 `property:"themeScale,auto,changed"`
_ string `property:"theme,auto,changed"`
_ string `property:"locale,auto,changed"`
_ string `property:"version"`
_ string `property:"buildDate"`
_ string `property:"assetPath"`
_ string `property:"selectedProfile,auto"`
_ string `property:"selectedConversation,auto"`
_ bool `property:experimentsEnabled,auto,changed`
_ map[string]bool `property:experiments,auto,changed`
@ -141,7 +141,9 @@ type GrandCentralDispatcher struct {
func (this *GrandCentralDispatcher) init() {
this.uIManagers = make(map[string]Manager)
this.GlobalSettings = ReadGlobalSettings()
firstTime := false
this.GlobalSettings,firstTime = ReadGlobalSettings()
this.SetFirstTime(firstTime)
this.SetThemeScale(this.GlobalSettings.Zoom)
this.SetTheme(this.GlobalSettings.Theme)
this.SetExperimentsEnabled(this.GlobalSettings.ExperimentsEnabled)

View File

@ -55,7 +55,7 @@ func InitGlobalSettingsFile(directory string, password string) error {
return nil
}
func ReadGlobalSettings() *GlobalSettings {
func ReadGlobalSettings() (*GlobalSettings, bool) {
settings := DefaultGlobalSettings
if runtime.GOOS == "android" {
settings.Zoom = 2.9
@ -65,17 +65,18 @@ func ReadGlobalSettings() *GlobalSettings {
settingsBytes, err := the.GlobalSettingsFile.Read()
if err != nil {
log.Errorf("Could not read global ui settings: %v\n", err)
return &settings
return &settings, true //firstTime = true
}
err = json.Unmarshal(settingsBytes, &settings)
if err != nil {
log.Errorf("Could not parse global ui settings: %v\n", err)
return &settings, true //firstTime = true
}
log.Debugf("Settings: %v", settings)
return &settings
return &settings, false
}
func WriteGlobalSettings(globalSettings *GlobalSettings) {

View File

@ -115,6 +115,7 @@ func main() {
the.CwtchApp = nil
the.CwtchService = nil
os.MkdirAll(the.CwtchDir, 0700)
os.MkdirAll(path.Join(the.CwtchDir, "tor"), 0700)
if *flagService {
mainService()
@ -185,6 +186,8 @@ func mainUi(flagLocal bool, flagClientUI bool) {
gcd.SetBuildDate("now")
}
// this is to load local qml files quickly when developing
var qmlSource *core.QUrl
if flagLocal {

View File

@ -141,18 +141,21 @@ ApplicationWindow {
StackLayout {
id: parentStack
currentIndex: managementPane
anchors.right: parent.right
anchors.left: parent.left
anchors.bottom: statusbar.top
anchors.top: toolbar.bottom
readonly property int managementPane: 0
readonly property int settingsPane: 1
readonly property int addEditProfilePane: 2
readonly property int profilePane: 3
readonly property int addEditServerPane: 4
currentIndex: gcd.firstTime ? parentStack.settingsPane : parentStack.managementPane
anchors.right: parent.right
anchors.left: parent.left
anchors.bottom: statusbar.top
anchors.top: toolbar.bottom
property alias pane: parentStack.currentIndex
Rectangle { // Profile login/management pane

@ -1 +1 @@
Subproject commit 3b9675e25917f667ba4b1cf1db09d44ed328f010
Subproject commit d6b56d02780c675a0acc36bd0f9ae65a42789077

View File

@ -20,7 +20,7 @@ Opaque.SettingsList { // groupSettingsPane
property bool connected: false
property bool synced: false
settings: Column {
Column {
anchors.fill: parent
Opaque.Setting {

View File

@ -16,12 +16,17 @@ Opaque.SettingsList { // settingsPane
id: root
anchors.fill: parent
anchors.topMargin: 20
width: parent.width
height: parent.height
contentHeight: peerSettings.height + 20
property string authorization
property string saveHistory
settings: Column {
anchors.fill: parent
Column {
id: peerSettings
anchors.horizontalCenter: parent.horizontalCenter
width:parent.width -20
parent: root.contentItem
Opaque.Setting {
inline: false

View File

@ -34,8 +34,8 @@ Opaque.SettingsList { // Add Profile Pane
serverAddEditPane.server_messages = server_messages;
}
settings: Column {
Column {
anchors.horizontalCenter: parent.horizontalCenter
width: 700

View File

@ -20,7 +20,7 @@ Opaque.SettingsList { // groupSettingsPane
property bool connected: false
property bool synced: false
settings: Column {
Column {
anchors.fill: parent
Opaque.Setting {

View File

@ -16,13 +16,19 @@ import "../utils.js" as Utils
Opaque.SettingsList { // settingsPane
id: root
anchors.fill: parent
width: parent.width
height: parent.height
anchors.topMargin: 20
contentHeight: settings.height
settings: Column {
Column {
id: settings
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width - 20
width:parent.width -20
parent:root.contentItem
Opaque.Setting {
//: Language
label: qsTr("setting-language")
@ -149,6 +155,19 @@ Opaque.SettingsList { // settingsPane
name: "groups_enabled"
experiment_id: "tapir-groups-experiment"
}
Opaque.ScalingLabel {
id: versionLabel
anchors.horizontalCenter: parent.horizontalCenter
//: Version %1
text: qsTr("version %1").arg(gcd.version)
}
Opaque.ScalingLabel {
id: builddateLabel
anchors.horizontalCenter: parent.horizontalCenter
//: Built on: %2
text: qsTr("builddate %2").arg(gcd.buildDate)
}
}
@ -177,22 +196,7 @@ Opaque.SettingsList { // settingsPane
Opaque.ScalingLabel {
id: versionLabel
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: builddateLabel.top
//: Version %1
text: qsTr("version %1").arg(gcd.version)
}
Opaque.ScalingLabel {
id: builddateLabel
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: 10
//: Built on: %2
text: qsTr("builddate %2").arg(gcd.buildDate)
}
//end of flickable

View File

@ -174,7 +174,7 @@ Rectangle {
Image { // ACKNOWLEDGEMENT ICON
id: ack
source: root.error != "" ? gcd.assetPath + "core/fontawesome/regular/window-close.webp" : (root.ackd ? gcd.assetPath + "core/fontawesome/regular/check-circle.svg" : gcd.assetPath + "core/fontawesome/regular/hourglass.svg")
source: root.error != "" ? gcd.assetPath + "core/fontawesome/regular/window-close.webp" : (root.ackd ? gcd.assetPath + "core/fontawesome/regular/check-circle.webp" : gcd.assetPath + "core/fontawesome/regular/hourglass.svg")
height: Theme.chatMetaTextSize * gcd.themeScale
width: Theme.chatMetaTextSize * gcd.themeScale
anchors.bottom: parent.bottom