replace model loader with placeholder data and update some paths and fix the theme switcher
This commit is contained in:
parent
4aa9af3e5b
commit
32d5e14afc
53
model.go
53
model.go
|
@ -7,7 +7,6 @@ import (
|
|||
"github.com/therecipe/qt/core"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
@ -181,47 +180,25 @@ func FormEntryDirectoryName(cwd, api, formName string) string {
|
|||
}
|
||||
|
||||
func BuildFormModel(fdm *FormDataModel, datadir string) {
|
||||
if _, err := os.Stat(datadir); os.IsNotExist(err) {
|
||||
err := os.Mkdir(datadir, 0700)
|
||||
if err != nil {
|
||||
fdm.SetError(err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
cwd, _ := filepath.Abs(datadir)
|
||||
fdm.SetCwd(cwd)
|
||||
|
||||
folders, err := ioutil.ReadDir(datadir)
|
||||
if err != nil {
|
||||
fdm.SetError(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
for _, folder := range folders {
|
||||
fdm.addFormEntry(LoadFormEntry(datadir + string(os.PathSeparator) + folder.Name()))
|
||||
}
|
||||
fdm.addFormEntry(LoadFormEntry("wip1"))
|
||||
fdm.addFormEntry(LoadFormEntry("wip2"))
|
||||
fdm.addFormEntry(LoadFormEntry("wip3"))
|
||||
}
|
||||
|
||||
func LoadFormEntry(path string) *FormEntry {
|
||||
bytes, err := ioutil.ReadFile(path + string(os.PathSeparator) + "config.json")
|
||||
if err != nil {
|
||||
return FormEntryError(path, err.Error())
|
||||
fe := &FormEntry{
|
||||
API: "api1",
|
||||
FormID: "fid1",
|
||||
FormName: "fn1",
|
||||
User: "user1",
|
||||
FolderName: "fn1",
|
||||
Token: "token1",
|
||||
RemotePubKey: "pubkey1",
|
||||
LocalPubKey: "localkey2",
|
||||
Error: "error1",
|
||||
LastDownload: time.Now(),
|
||||
Submissions: 123,
|
||||
}
|
||||
|
||||
fe := &FormEntry{}
|
||||
err = json.Unmarshal(bytes, fe)
|
||||
if err != nil {
|
||||
return FormEntryError(path, err.Error())
|
||||
}
|
||||
|
||||
fe.FolderName = path
|
||||
|
||||
bytes, err = ioutil.ReadFile(path + string(os.PathSeparator) + "keys" + string(os.PathSeparator) + "public.key")
|
||||
if err == nil {
|
||||
fe.LocalPubKey = string(bytes)
|
||||
}
|
||||
|
||||
return fe
|
||||
}
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@ import QtQuick.Dialogs 1.3
|
|||
import QtQuick.Layouts 1.12
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
|
||||
import "qml-theme"
|
||||
import "qml-widgets" as Widgets
|
||||
import "qml-widgets/fonts"
|
||||
import "opaque/theme"
|
||||
import "opaque" as Widgets
|
||||
import "opaque/fonts"
|
||||
|
||||
ColumnLayout {
|
||||
spacing: 24
|
||||
|
|
|
@ -8,9 +8,9 @@ import QtQuick.Layouts 1.12
|
|||
import QtQuick.Controls.Styles 1.4
|
||||
import QtQuick.Controls 1.4 as C
|
||||
|
||||
import "qml-theme"
|
||||
import "qml-widgets" as Widgets
|
||||
import "qml-widgets/fonts"
|
||||
import "opaque/theme"
|
||||
import "opaque" as Widgets
|
||||
import "opaque/fonts"
|
||||
|
||||
ColumnLayout {
|
||||
spacing: 24
|
||||
|
|
|
@ -42,7 +42,9 @@ ApplicationWindow {
|
|||
}
|
||||
|
||||
Widgets.ToggleSwitch {
|
||||
//?
|
||||
onToggled: function(){
|
||||
Theme.theme = isToggled ? Theme.light : Theme.dark;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 176274e648252d37a0aa53f24778c297dc42992c
|
||||
Subproject commit 913796b2889369e9701d315a3f178ca87663e71c
|
Loading…
Reference in New Issue