Skip to content
Snippets Groups Projects
Commit 446405a2 authored by Loïck Bonniot's avatar Loïck Bonniot
Browse files

[gui] Add welcome screen

parent 44734fb9
No related branches found
No related tags found
1 merge request!66412 gui various improvements
...@@ -10,5 +10,6 @@ ...@@ -10,5 +10,6 @@
<file>images/digital_signature_pen.png</file> <file>images/digital_signature_pen.png</file>
<file>signform/signform.ui</file> <file>signform/signform.ui</file>
<file>showcontract/showcontract.ui</file> <file>showcontract/showcontract.ui</file>
<file>welcome/welcome.ui</file>
</qresource> </qresource>
</RCC> </RCC>
...@@ -14,8 +14,8 @@ import ( ...@@ -14,8 +14,8 @@ import (
// Config is the structure that will be persisted in the configuration file // Config is the structure that will be persisted in the configuration file
type Config struct { type Config struct {
Email string `json: email` Email string `json:"email"`
Platform string `json: platform` Platform string `json:"platform"`
} }
// Load loads the configuration file into memory. // Load loads the configuration file into memory.
......
...@@ -40,7 +40,7 @@ func main() { ...@@ -40,7 +40,7 @@ func main() {
if viper.GetBool("authenticated") { if viper.GetBool("authenticated") {
w.addActions() w.addActions()
w.showNewContractForm() w.showWelcome()
} else if viper.GetBool("registered") { } else if viper.GetBool("registered") {
w.showAuthForm() w.showAuthForm()
} else { } else {
......
...@@ -8,10 +8,19 @@ import ( ...@@ -8,10 +8,19 @@ import (
"dfss/gui/showcontract" "dfss/gui/showcontract"
"dfss/gui/signform" "dfss/gui/signform"
"dfss/gui/userform" "dfss/gui/userform"
"dfss/gui/welcome"
"github.com/spf13/viper" "github.com/spf13/viper"
"github.com/visualfc/goqt/ui" "github.com/visualfc/goqt/ui"
) )
func (w *window) showWelcome() {
w.setScreen(welcome.NewWidget(
w.showNewContractForm,
func() { w.showShowContract("") },
w.showFetchForm,
))
}
func (w *window) showUserForm() { func (w *window) showUserForm() {
w.setScreen(userform.NewWidget(func(pwd string) { w.setScreen(userform.NewWidget(func(pwd string) {
w.showAuthForm() w.showAuthForm()
......
package welcome
import (
"github.com/visualfc/goqt/ui"
)
type Widget struct {
*ui.QWidget
}
func NewWidget(onNew, onOpen, onFetch func()) *Widget {
file := ui.NewFileWithName(":/welcome/welcome.ui")
loader := ui.NewUiLoader()
form := loader.Load(file)
(ui.NewPushButtonFromDriver(form.FindChild("createButton"))).OnClicked(onNew)
(ui.NewPushButtonFromDriver(form.FindChild("openButton"))).OnClicked(onOpen)
(ui.NewPushButtonFromDriver(form.FindChild("fetchButton"))).OnClicked(onFetch)
return &Widget{QWidget: form}
}
func (w *Widget) Q() *ui.QWidget {
return w.QWidget
}
func (w *Widget) Tick() {}
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Welcome</class>
<widget class="QWidget" name="Welcome">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>776</width>
<height>353</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>650</width>
<height>350</height>
</size>
</property>
<property name="windowTitle">
<string>Calculator Builder</string>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="authLabel">
<property name="minimumSize">
<size>
<width>0</width>
<height>100</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>100</height>
</size>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:20pt;&quot;&gt;Welcome&lt;/span&gt;&lt;/p&gt;&lt;p&gt;The DFSS client is ready.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<property name="formAlignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="horizontalSpacing">
<number>30</number>
</property>
<property name="verticalSpacing">
<number>10</number>
</property>
<property name="leftMargin">
<number>50</number>
</property>
<property name="rightMargin">
<number>50</number>
</property>
<item row="0" column="0">
<widget class="QPushButton" name="createButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Create a new contract</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="openButton">
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Open a contract file</string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="fetchButton">
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Download a contract file</string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="createLabel">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Collaborate safely by proposing a new contract</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="openLabel">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Look or sign at a saved contract</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="fetchLabel">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Fetch a contract from the platform with its ID</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment