Commit bae90ef4 authored by Loïck Bonniot's avatar Loïck Bonniot

[gui] Add contractform mockup

TG-381 #ready
parent 9f90c21c
Pipeline #575 passed with stage
......@@ -2,5 +2,6 @@
<qresource prefix="/">
<file>userform/userform.ui</file>
<file>authform/authform.ui</file>
<file>contractform/contractform.ui</file>
</qresource>
</RCC>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CalculatorForm</class>
<widget class="QWidget" name="CalculatorForm">
<class>AuthForm</class>
<widget class="QWidget" name="AuthForm">
<property name="enabled">
<bool>true</bool>
</property>
......@@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>592</width>
<height>340</height>
<width>776</width>
<height>353</height>
</rect>
</property>
<property name="sizePolicy">
......@@ -19,6 +19,12 @@
<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>
......
package contractform
import (
"dfss/gui/config"
"github.com/visualfc/goqt/ui"
)
type Widget struct {
*ui.QWidget
}
func NewWidget(conf *config.Config) *Widget {
file := ui.NewFileWithName(":/contractform/contractform.ui")
loader := ui.NewUiLoader()
form := loader.Load(file)
return &Widget{QWidget: form}
}
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ContractForm</class>
<widget class="QWidget" name="ContractForm">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>802</width>
<height>457</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>
<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="QLabel" name="fileLabel">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Contract file&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="fileField">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>(none)</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="fileButton">
<property name="text">
<string>Select</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="signersLabel">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Signers&lt;br/&gt;&lt;/span&gt;&lt;span style=&quot; font-size:8pt; font-style:italic;&quot;&gt;Space-separated&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPlainTextEdit" name="signersField"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="commentLabel">
<property name="text">
<string>Comment</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPlainTextEdit" name="commentField"/>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="createButton">
<property name="text">
<string>Create contract</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="feedbackLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
......@@ -4,47 +4,42 @@ import (
"dfss"
"dfss/gui/authform"
"dfss/gui/config"
"dfss/gui/contractform"
"dfss/gui/userform"
"github.com/visualfc/goqt/ui"
)
const WIDTH = 650
const HEIGHT = 350
func main() {
// Load configuration
conf := config.Load()
// Start first window
ui.Run(func() {
layout := ui.NewVBoxLayout()
window := ui.NewMainWindow()
var newuser *userform.Widget
var newauth *authform.Widget
var newcontract *contractform.Widget
newauth = authform.NewWidget(&conf, func() {
layout.RemoveWidget(newauth)
newauth.Hide()
window.SetCentralWidget(newcontract)
})
newuser = userform.NewWidget(&conf, func(pwd string) {
layout.RemoveWidget(newuser)
newuser.Hide()
layout.AddWidget(newauth)
window.SetCentralWidget(newauth)
})
newcontract = contractform.NewWidget(&conf)
if conf.Authenticated {
// TODO
window.SetCentralWidget(newcontract)
} else if conf.Registered {
layout.AddWidget(newauth)
window.SetCentralWidget(newauth)
} else {
layout.AddWidget(newuser)
window.SetCentralWidget(newuser)
}
w := ui.NewWidget()
w.SetLayout(layout)
w.SetWindowTitle("DFSS Client v" + dfss.Version)
w.SetFixedSizeWithWidthHeight(WIDTH, HEIGHT)
w.Show()
window.SetWindowTitle("DFSS Client v" + dfss.Version)
window.Show()
})
}
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CalculatorForm</class>
<widget class="QWidget" name="CalculatorForm">
<class>UserForm</class>
<widget class="QWidget" name="UserForm">
<property name="enabled">
<bool>true</bool>
</property>
......@@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>408</width>
<height>316</height>
<width>731</width>
<height>446</height>
</rect>
</property>
<property name="sizePolicy">
......@@ -19,6 +19,12 @@
<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>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment