commit c39ba13aea28c1488277b6974d09f8b628afea78
parent d0ec68ce89c697832703a6c65273b79206bf6778
Author: MTRNord <mtrnord1@gmail.com>
Date: Thu, 24 Aug 2017 01:03:58 +0200
CLeanup MainWindow as it will be dynamicly generated in the future
Diffstat:
| D | qml/Main.ui | | | 158 | ------------------------------------------------------------------------------- |
| D | qml/login.ui | | | 121 | ------------------------------------------------------------------------------- |
| M | uis.go | | | 64 | +++++++++++++++++++++------------------------------------------- |
3 files changed, 21 insertions(+), 322 deletions(-)
diff --git a/qml/Main.ui b/qml/Main.ui
@@ -1,158 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>centralWidget</class>
- <widget class="QWidget" name="centralWidget">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>1036</width>
- <height>717</height>
- </rect>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="windowTitle">
- <string>Neo</string>
- </property>
- <property name="title" stdset="0">
- <string/>
- </property>
- <widget class="QLabel" name="RoomNameLabel">
- <property name="geometry">
- <rect>
- <x>261</x>
- <y>10</y>
- <width>740</width>
- <height>47</height>
- </rect>
- </property>
- <property name="font">
- <font>
- <family>Arial</family>
- <pointsize>31</pointsize>
- <underline>false</underline>
- </font>
- </property>
- <property name="text">
- <string>Titel</string>
- </property>
- </widget>
- <widget class="QScrollArea" name="scrollArea_2">
- <property name="geometry">
- <rect>
- <x>250</x>
- <y>80</y>
- <width>756</width>
- <height>571</height>
- </rect>
- </property>
- <property name="widgetResizable">
- <bool>false</bool>
- </property>
- <widget class="QWidget" name="scrollAreaWidgetContents_14">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>239</width>
- <height>568</height>
- </rect>
- </property>
- </widget>
- </widget>
- <widget class="QScrollArea" name="scrollArea">
- <property name="geometry">
- <rect>
- <x>2</x>
- <y>80</y>
- <width>239</width>
- <height>571</height>
- </rect>
- </property>
- <property name="widgetResizable">
- <bool>false</bool>
- </property>
- <widget class="QWidget" name="scrollAreaWidgetContents_13">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>237</width>
- <height>569</height>
- </rect>
- </property>
- </widget>
- </widget>
- <widget class="QLabel" name="UsernameLabel">
- <property name="geometry">
- <rect>
- <x>80</x>
- <y>10</y>
- <width>164</width>
- <height>32</height>
- </rect>
- </property>
- <property name="font">
- <font>
- <family>Arial</family>
- <pointsize>16</pointsize>
- <underline>true</underline>
- </font>
- </property>
- <property name="text">
- <string>Username</string>
- </property>
- </widget>
- <widget class="QLabel" name="AvatarLabel">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>70</width>
- <height>70</height>
- </rect>
- </property>
- <property name="font">
- <font>
- <family>Arial</family>
- <pointsize>31</pointsize>
- <underline>false</underline>
- </font>
- </property>
- <property name="text">
- <string>MR</string>
- </property>
- <property name="scaledContents">
- <bool>true</bool>
- </property>
- </widget>
- <widget class="QLabel" name="MXIDLabel">
- <property name="geometry">
- <rect>
- <x>80</x>
- <y>40</y>
- <width>159</width>
- <height>16</height>
- </rect>
- </property>
- <property name="font">
- <font>
- <family>Arial</family>
- <pointsize>10</pointsize>
- <underline>false</underline>
- </font>
- </property>
- <property name="text">
- <string>@User:matrix.org</string>
- </property>
- </widget>
- </widget>
- <layoutdefault spacing="6" margin="11"/>
- <resources/>
- <connections/>
-</ui>
diff --git a/qml/login.ui b/qml/login.ui
@@ -1,121 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>centralWidget</class>
- <widget class="QWidget" name="centralWidget">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>1280</width>
- <height>720</height>
- </rect>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="windowTitle">
- <string>Neo - Login</string>
- </property>
- <widget class="QWidget" name="layoutWidget">
- <property name="geometry">
- <rect>
- <x>510</x>
- <y>287</y>
- <width>258</width>
- <height>147</height>
- </rect>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QLabel" name="LoginHeader">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="font">
- <font>
- <family>Arial</family>
- <pointsize>29</pointsize>
- <underline>true</underline>
- </font>
- </property>
- <property name="text">
- <string>Login</string>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QFormLayout" name="LoginFormLayout">
- <property name="formAlignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
- </property>
- <item row="0" column="0">
- <widget class="QLabel" name="UsernameLabel">
- <property name="font">
- <font>
- <family>Arial</family>
- <pointsize>12</pointsize>
- </font>
- </property>
- <property name="text">
- <string>Username:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLineEdit" name="UsernameInput">
- <property name="inputMethodHints">
- <set>Qt::ImhNoAutoUppercase</set>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="PasswordLabel">
- <property name="font">
- <font>
- <family>Arial</family>
- <pointsize>12</pointsize>
- </font>
- </property>
- <property name="inputMethodHints">
- <set>Qt::ImhNone</set>
- </property>
- <property name="text">
- <string>Password:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLineEdit" name="PasswordInput">
- <property name="inputMethodHints">
- <set>Qt::ImhHiddenText|Qt::ImhNoAutoUppercase|Qt::ImhNoPredictiveText|Qt::ImhSensitiveData</set>
- </property>
- <property name="echoMode">
- <enum>QLineEdit::Password</enum>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QPushButton" name="loginButton">
- <property name="font">
- <font>
- <family>Segoe UI</family>
- <pointsize>12</pointsize>
- </font>
- </property>
- <property name="text">
- <string>Login</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </widget>
- <layoutdefault spacing="6" margin="11"/>
- <resources/>
- <connections/>
-</ui>
diff --git a/uis.go b/uis.go
@@ -1,13 +1,11 @@
package main
import (
- "fmt"
"log"
"sync"
"github.com/Nordgedanken/Neo/matrix"
"github.com/therecipe/qt/core"
- "github.com/therecipe/qt/uitools"
"github.com/therecipe/qt/widgets"
)
@@ -50,18 +48,6 @@ func NewLoginUI(windowWidth, windowHeight int) *widgets.QWidget {
formLayout.AddLayout(usernameLayout, 0)
formLayout.AddLayout(passwordLayout, 0)
- // UsernameInput-Label
- // usernameLabel := widgets.NewQLabel(nil, 0)
- // usernameLabel.SetText("Username: ")
- // usernameLabel.SetBuddy(usernameInput)
- // layout.AddWidget(usernameLabel, 0, 0)
-
- // PasswordInput-Label
- // passwordLabel := widgets.NewQLabel(nil, 0)
- // passwordLabel.SetText("Password: ")
- // passwordLabel.SetBuddy(passwordInput)
- // layout.AddWidget(passwordLabel, 0, 0)
-
// loginButton
buttonLayout := widgets.NewQHBoxLayout()
buttonLayout.SetSpacing(0)
@@ -133,37 +119,29 @@ func NewLoginUI(windowWidth, windowHeight int) *widgets.QWidget {
//NewMainUI initializes the login Screen
func NewMainUI(windowWidth, windowHeight int, cli *matrix.Client) *widgets.QWidget {
widget := widgets.NewQWidget(nil, 0)
+ topLayout := widgets.NewQVBoxLayout()
- loader := uitools.NewQUiLoader(nil)
- file := core.NewQFile2(":/qml/Main.ui")
-
- file.Open(core.QIODevice__ReadOnly)
- mainWidget := loader.Load(file, widget)
- file.Close()
-
- var (
- usernameLabel = widgets.NewQLabelFromPointer(widget.FindChild("UsernameLabel", core.Qt__FindChildrenRecursively).Pointer())
- mxidLabel = widgets.NewQLabelFromPointer(widget.FindChild("MXIDLabel", core.Qt__FindChildrenRecursively).Pointer())
- avatarLogo = widgets.NewQLabelFromPointer(widget.FindChild("AvatarLabel", core.Qt__FindChildrenRecursively).Pointer())
- )
-
- // Set MXID Label
- mxidLabel.SetText(fmt.Sprint(username))
-
- // Set Dispalyname Label
- displayName, displayNameErr := cli.GetUserDisplayName(username)
- if displayNameErr != nil {
- localLog.Println(displayNameErr)
- }
- usernameLabel.SetText(fmt.Sprint(displayName))
-
- // Set Avatar
- avatarLogo.SetAlignment(core.Qt__AlignBottom | core.Qt__AlignRight)
- avatarLogo.SetPixmap(cli.GetOwnUserAvatar())
+ // var (
+ // usernameLabel = widgets.NewQLabelFromPointer(widget.FindChild("UsernameLabel", core.Qt__FindChildrenRecursively).Pointer())
+ // mxidLabel = widgets.NewQLabelFromPointer(widget.FindChild("MXIDLabel", core.Qt__FindChildrenRecursively).Pointer())
+ // avatarLogo = widgets.NewQLabelFromPointer(widget.FindChild("AvatarLabel", core.Qt__FindChildrenRecursively).Pointer())
+ // )
+ //
+ // // Set MXID Label
+ // mxidLabel.SetText(fmt.Sprint(username))
+ //
+ // // Set Dispalyname Label
+ // displayName, displayNameErr := cli.GetUserDisplayName(username)
+ // if displayNameErr != nil {
+ // localLog.Println(displayNameErr)
+ // }
+ // usernameLabel.SetText(fmt.Sprint(displayName))
+ //
+ // // Set Avatar
+ // avatarLogo.SetAlignment(core.Qt__AlignBottom | core.Qt__AlignRight)
+ // avatarLogo.SetPixmap(cli.GetOwnUserAvatar())
- layout := widgets.NewQVBoxLayout()
- layout.AddWidget(mainWidget, 0, 0)
- widget.SetLayout(layout)
+ widget.SetLayout(topLayout)
return widget
}