diff --git a/matrique.pro b/matrique.pro index 7f63d01..228330d 100644 --- a/matrique.pro +++ b/matrique.pro @@ -17,7 +17,8 @@ DEFINES += QT_DEPRECATED_WARNINGS SOURCES += main.cpp \ matrix/controller.cpp \ matrix/roomlistmodel.cpp \ - matrix/imageprovider.cpp + matrix/imageprovider.cpp \ + matrix/messageeventmodel.cpp RESOURCES += \ res.qrc @@ -50,4 +51,5 @@ DISTFILES += \ HEADERS += \ matrix/controller.h \ matrix/roomlistmodel.h \ - matrix/imageprovider.h + matrix/imageprovider.h \ + matrix/messageeventmodel.h diff --git a/matrix/controller.cpp b/matrix/controller.cpp index 423e5d6..50bd3c7 100644 --- a/matrix/controller.cpp +++ b/matrix/controller.cpp @@ -11,20 +11,24 @@ Controller::~Controller() { } void Controller::login(QString home, QString user, QString pass) { - if(home.isEmpty()) home = "matrix.org"; + if(!isLogin) { + if(home.isEmpty()) home = "matrix.org"; - qDebug() << "UserID:" << userID; - qDebug() << "Token:" << token; - qDebug() << "Home:" << home; - qDebug() << "User:" << user; - qDebug() << "Pass:" << pass; + qDebug() << "UserID:" << userID; + qDebug() << "Token:" << token; + qDebug() << "Home:" << home; + qDebug() << "User:" << user; + qDebug() << "Pass:" << pass; - if(!userID.isEmpty() && !token.isEmpty()) { - qDebug() << "Using token."; - m_connection->connectWithToken(userID, token, ""); - } else if(!user.isEmpty() && !pass.isEmpty()) { - qDebug() << "Using given credential."; - m_connection->connectToServer("@"+user+":"+home, pass, ""); + if(!userID.isEmpty() && !token.isEmpty()) { + qDebug() << "Using token."; + m_connection->connectWithToken(userID, token, ""); + } else if(!user.isEmpty() && !pass.isEmpty()) { + qDebug() << "Using given credential."; + m_connection->connectToServer("@"+user+":"+home, pass, ""); + } + } else { + qDebug() << "You are already logged in."; } } diff --git a/qml/Room.qml b/qml/Room.qml index 1602757..5bf724c 100644 --- a/qml/Room.qml +++ b/qml/Room.qml @@ -1,9 +1,12 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 + import "qrc:/qml/form" +import Matrique 0.1 + Page { - property var roomListModel + property RoomListModel roomListModel ListForm { id: roomListForm @@ -16,5 +19,6 @@ Page { id: roomForm anchors.fill: parent anchors.leftMargin: roomListForm.width + roomIndex: roomListForm.currentIndex } } diff --git a/qml/Setting.qml b/qml/Setting.qml index c3a6fda..8c290c3 100644 --- a/qml/Setting.qml +++ b/qml/Setting.qml @@ -11,9 +11,15 @@ Page { TabButton { text: qsTr("Overview") } + + TabButton { + text: qsTr("Interface") + } + TabButton { text: qsTr("Network") } + TabButton { text: qsTr("Sync") } @@ -36,5 +42,9 @@ Page { Page { } + + Page { + + } } } diff --git a/qml/form/ListForm.qml b/qml/form/ListForm.qml index b41b128..29a1875 100644 --- a/qml/form/ListForm.qml +++ b/qml/form/ListForm.qml @@ -7,6 +7,8 @@ import "qrc:/qml/component" Item { property var listModel + property alias currentIndex: listView.currentIndex + ColumnLayout { anchors.fill: parent spacing: 0 diff --git a/qml/form/RoomForm.qml b/qml/form/RoomForm.qml index bec8961..3e5d002 100644 --- a/qml/form/RoomForm.qml +++ b/qml/form/RoomForm.qml @@ -6,6 +6,8 @@ import QtGraphicalEffects 1.0 import "qrc:/qml/component" Item { + property int roomIndex + ColumnLayout { anchors.fill: parent spacing: 0