gcd.firstTime + SettingsList scrolls #388
|
@ -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>
|
|
@ -14,9 +14,7 @@ const TofuBundlePrefix = "tofubundle:"
|
|||
const GroupPrefix = "torv3"
|
||||
const GroupExperiment = "tapir-groups-experiment"
|
||||
|
||||
|
||||
type GroupFunctionality struct {
|
||||
|
||||
}
|
||||
|
||||
// ExperimentGate returns GroupFunctionality if the experiment is enabled, and an error otherwise.
|
||||
|
@ -72,6 +70,5 @@ func (gf * GroupFunctionality) HandleImportString(importString string) error {
|
|||
return the.Peer.ImportGroup(importString)
|
||||
}
|
||||
|
||||
|
||||
return errors.New("invalid_group_invite_prefix")
|
||||
}
|
|
@ -2,7 +2,6 @@ package groups
|
|||
|
||||
import "testing"
|
||||
|
||||
|
||||
func TestGroupFunctionality_ValidPrefix(t *testing.T) {
|
||||
gf, _ := ExperimentGate(map[string]bool{GroupExperiment: true})
|
||||
if gf.ValidPrefix("torv3blahblahblah") == false {
|
||||
|
|
|
@ -21,8 +21,6 @@ import (
|
|||
"sync"
|
||||
)
|
||||
|
||||
|
||||
|
||||
// ServerManager is responsible for managing user operated servers
|
||||
type ServerManager struct {
|
||||
servers sync.Map
|
||||
|
@ -37,7 +35,6 @@ type serverStatusCache struct {
|
|||
bundle []byte
|
||||
}
|
||||
|
||||
|
||||
// LaunchServiceManager is responsible for setting up everything relating to managing servers in the UI.
|
||||
func LaunchServiceManager(gcd *ui.GrandCentralDispatcher, acn connectivity.ACN, configDir string) {
|
||||
sm := new(ServerManager)
|
||||
|
@ -112,13 +109,12 @@ func (sm *ServerManager) Init(gcd *ui.GrandCentralDispatcher) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// NewServer createa a new server
|
||||
func (sm *ServerManager) NewServer() {
|
||||
log.Debugf("Adding a new Server")
|
||||
num, err := rand.Int(rand.Reader, big.NewInt(math.MaxUint32))
|
||||
if err == nil {
|
||||
serverDir := path.Join(sm.configDir, num.String());
|
||||
serverDir := path.Join(sm.configDir, num.String())
|
||||
os.MkdirAll(serverDir, 0700)
|
||||
config := server.LoadConfig(serverDir, "serverconfig")
|
||||
identity := config.Identity()
|
||||
|
@ -137,7 +133,6 @@ func (sm *ServerManager) runServer(s * server.Server) {
|
|||
the.AppBus.Subscribe(constants.AutoStart, q)
|
||||
the.AppBus.Subscribe(event.Shutdown, q)
|
||||
|
||||
|
||||
identity := s.Identity()
|
||||
|
||||
cache, ok := sm.servers.Load(identity.Hostname())
|
||||
|
@ -148,7 +143,6 @@ func (sm *ServerManager) runServer(s * server.Server) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
log.Debugf("Launching Server %v", identity.Hostname())
|
||||
log.Debugf("Launching Event Bus for Server %v", identity.Hostname())
|
||||
for {
|
||||
|
|
13
go/ui/gcd.go
13
go/ui/gcd.go
|
@ -36,7 +36,9 @@ type GrandCentralDispatcher struct {
|
|||
m_selectedProfile string
|
||||
m_selectedConversation string
|
||||
|
||||
_ int `property:"torStatus"`
|
||||
_ string `property:"os"`
|
||||
_ bool `property:"firstTime"`
|
||||
_ float32 `property:"themeScale,auto,changed"`
|
||||
_ string `property:"theme,auto,changed"`
|
||||
_ string `property:"locale,auto,changed"`
|
||||
|
@ -45,11 +47,8 @@ type GrandCentralDispatcher struct {
|
|||
_ string `property:"assetPath"`
|
||||
_ string `property:"selectedProfile,auto"`
|
||||
_ string `property:"selectedConversation,auto"`
|
||||
|
||||
_ int `property:"torStatus"`
|
||||
|
||||
_ bool `property:experimentsEnabled,auto,changed`
|
||||
_ map[string]bool `property:experiments,auto,changed`
|
||||
_ bool `property:"experimentsEnabled,auto,changed"`
|
||||
_ map[string]bool `property:"experiments,auto,changed"`
|
||||
|
||||
// profile management stuff
|
||||
_ func() `signal:"Loaded"`
|
||||
|
@ -141,7 +140,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)
|
||||
|
|
|
@ -50,7 +50,6 @@ func (this *MessageModel) setHandle(handle string) {
|
|||
this.handle = handle
|
||||
}
|
||||
|
||||
|
||||
func (this *MessageModel) init() {
|
||||
mdt := reflect.TypeOf([]MessageWrapper{}).Elem()
|
||||
roles := make(map[int]*core.QByteArray)
|
||||
|
|
|
@ -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,17 @@ 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) {
|
||||
|
|
3
main.go
3
main.go
|
@ -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 {
|
||||
|
|
15
qml/main.qml
15
qml/main.qml
|
@ -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
|
|
@ -20,7 +20,7 @@ Opaque.SettingsList { // groupSettingsPane
|
|||
property bool connected: false
|
||||
property bool synced: false
|
||||
|
||||
settings: Column {
|
||||
Column {
|
||||
anchors.fill: parent
|
||||
|
||||
Opaque.Setting {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -34,8 +34,8 @@ Opaque.SettingsList { // Add Profile Pane
|
|||
serverAddEditPane.server_messages = server_messages;
|
||||
}
|
||||
|
||||
settings: Column {
|
||||
|
||||
Column {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
width: 700
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ Opaque.SettingsList { // groupSettingsPane
|
|||
property bool connected: false
|
||||
property bool synced: false
|
||||
|
||||
settings: Column {
|
||||
Column {
|
||||
anchors.fill: parent
|
||||
|
||||
Opaque.Setting {
|
||||
|
|
|
@ -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
|
||||
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
|
||||
|
|
|
@ -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
|
||||
|
|
Reference in New Issue