Commit 449abef5 authored by Marzanna's avatar Marzanna Committed by Linus Jahn

Clean up coding style (#28)

Closes #23.
parent 2144d981
......@@ -16,14 +16,15 @@ Kaidan::Kaidan(NetworkFactories* networkFactories, QObject *parent) :
Kaidan::~Kaidan()
{
if(connected){
if (connected)
{
client->removePayloadSerializer(&echoPayloadSerializer);
client->removePayloadParserFactory(&echoPayloadParserFactory);
softwareVersionResponder->stop();
delete tracer;
delete softwareVersionResponder;
delete client;
}
delete softwareVersionResponder;
delete client;
delete rosterController_;
}
......@@ -50,8 +51,10 @@ void Kaidan::mainConnect(const QString &jid, const QString &pass){
}
//we don't want to close client without disconnection
void Kaidan::mainDisconnect(){
if(connectionState()){
void Kaidan::mainDisconnect()
{
if (connectionState())
{
client->disconnect();
}
}
......@@ -78,7 +81,8 @@ void Kaidan::handleConnected()
rosterController_->requestRosterFromClient(client);
}
void Kaidan::handleDisconnected(){
void Kaidan::handleDisconnected()
{
connected = false;
emit connectionStateDisconnected();
}
......@@ -103,6 +107,7 @@ RosterController* Kaidan::getRosterController()
return rosterController_;
}
bool Kaidan::connectionState() const{
bool Kaidan::connectionState() const
{
return connected;
}
......@@ -2,15 +2,15 @@ import QtQuick 2.5
import QtQuick.Controls 1.2
import harbour.kaidan 1.0
Item{
Column{
Row{
TextField{
Item {
Column {
Row {
TextField {
id: jidField
width: 150
placeholderText: "JID"
}
TextField{
TextField {
id: passField
width: 150
height: 27
......@@ -18,27 +18,29 @@ Item{
echoMode: TextInput.Password
}
}
Button{
Button {
id: connectButton
text: "Connect"
onClicked:{
onClicked: {
connectButton.enabled = false;
kaidan.mainConnect(jidField.text, passField.text);
}
}
Label{
Label {
id: statusLabel
text: "Not connected"
}
}
Component.onCompleted:{
function goToRoster(){
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"
}
function enableConnectButton(){connectButton.enabled = true}
function enableConnectButton() {
connectButton.enabled = true
}
kaidan.connectionStateConnected.connect(goToRoster)
kaidan.connectionStateDisconnected.connect(enableConnectButton)
}
......
import QtQuick 2.1
import harbour.kaidan 1.0
Flickable{
Flickable {
ListView {
anchors.fill: parent
model: kaidan.rosterController.rosterList
......
......@@ -2,12 +2,12 @@ import QtQuick 2.1
import QtQuick.Controls 1.4
import harbour.kaidan 1.0
ApplicationWindow{
ApplicationWindow {
visible: true
width: 360
height: 720
Loader{
Loader {
id: mainLoader
anchors.fill: parent
source: "LoginPage.qml"
......
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