Commit 14a8cb5e authored by Linus Jahn's avatar Linus Jahn

Add Kirigami UI (#33)

The needed QtQuick version is 2.0, now. At the moment we don't
need a newer version.

The connect button will show 'Connecting...', when pressed now.
parent 449abef5
import QtQuick 2.5
import QtQuick.Controls 1.2
import QtQuick 2.0
import QtQuick.Controls 1.2 as Controls
import QtQuick.Layouts 1.2
import org.kde.kirigami 1.0 as Kirigami
import harbour.kaidan 1.0
Item {
Column {
Row {
TextField {
id: jidField
width: 150
placeholderText: "JID"
}
TextField {
id: passField
width: 150
height: 27
placeholderText: "Password"
echoMode: TextInput.Password
}
Kirigami.ScrollablePage {
id: page
title: "Login"
Layout.fillWidth: true
implicitWidth: applicationWindow().width
GridLayout {
columns: 2
anchors.fill: parent
Layout.fillWidth: true
Controls.Label {
text: "Your Jabber-ID:"
}
Controls.TextField {
id: jidField
placeholderText: "user@example.org"
Layout.fillWidth: true
}
Controls.Label {
text: "Your Password:"
}
Controls.TextField {
id: passField
placeholderText: "Password"
echoMode: TextInput.Password
Layout.fillWidth: true
}
Button {
Controls.Button {
id: connectButton
text: "Connect"
Layout.columnSpan: 2
Layout.alignment: Qt.AlignRight
onClicked: {
connectButton.enabled = false;
connectButton.text = "<i>Connecting...</i>"
kaidan.mainConnect(jidField.text, passField.text);
}
}
Label {
id: statusLabel
text: "Not connected"
}
}
Component.onCompleted: {
function goToRoster() {
statusLabel.text = "Connected";
//we need to disconnect enableConnectButton to prevent calling it on normal disconnection
kaidan.connectionStateDisconnected.disconnect(enableConnectButton)
mainLoader.source = "RosterPage.qml"
//open the roster page, loaded in main.qml
applicationWindow().pageStack.replace(rosterPageComponent)
}
function enableConnectButton() {
connectButton.text = "Retry"
connectButton.enabled = true
}
kaidan.connectionStateConnected.connect(goToRoster)
kaidan.connectionStateDisconnected.connect(enableConnectButton)
}
}
import QtQuick 2.1
import QtQuick 2.0
import org.kde.kirigami 1.0 as Kirigami
import harbour.kaidan 1.0
Flickable {
Kirigami.ScrollablePage {
id: rosterPage
title: "Contacts"
ListView {
anchors.fill: parent
id: rosterView
model: kaidan.rosterController.rosterList
delegate: Rectangle {
height: 25
width: parent.width
Text { text: model.modelData.jid}
delegate: Kirigami.BasicListItem {
label: model.modelData.jid
}
}
}
import QtQuick 2.1
import QtQuick.Controls 1.4
import QtQuick 2.0
import org.kde.kirigami 1.0 as Kirigami
import harbour.kaidan 1.0
ApplicationWindow {
Kirigami.ApplicationWindow {
id: root
visible: true
width: 360
height: 720
Loader {
id: mainLoader
anchors.fill: parent
source: "LoginPage.qml"
pageStack.initialPage: loginPageComponent
Component {
id: rosterPageComponent
RosterPage {}
}
Component {
id: loginPageComponent
LoginPage {}
}
onClosing: kaidan.mainDisconnect()
}
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