Preparation for messageeventmodel.

This commit is contained in:
Black Hat 2018-03-05 19:11:55 +08:00
parent 9b4fa0d8c6
commit fe57008564
6 changed files with 39 additions and 15 deletions

View File

@ -17,7 +17,8 @@ DEFINES += QT_DEPRECATED_WARNINGS
SOURCES += main.cpp \ SOURCES += main.cpp \
matrix/controller.cpp \ matrix/controller.cpp \
matrix/roomlistmodel.cpp \ matrix/roomlistmodel.cpp \
matrix/imageprovider.cpp matrix/imageprovider.cpp \
matrix/messageeventmodel.cpp
RESOURCES += \ RESOURCES += \
res.qrc res.qrc
@ -50,4 +51,5 @@ DISTFILES += \
HEADERS += \ HEADERS += \
matrix/controller.h \ matrix/controller.h \
matrix/roomlistmodel.h \ matrix/roomlistmodel.h \
matrix/imageprovider.h matrix/imageprovider.h \
matrix/messageeventmodel.h

View File

@ -11,20 +11,24 @@ Controller::~Controller() {
} }
void Controller::login(QString home, QString user, QString pass) { 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() << "UserID:" << userID;
qDebug() << "Token:" << token; qDebug() << "Token:" << token;
qDebug() << "Home:" << home; qDebug() << "Home:" << home;
qDebug() << "User:" << user; qDebug() << "User:" << user;
qDebug() << "Pass:" << pass; qDebug() << "Pass:" << pass;
if(!userID.isEmpty() && !token.isEmpty()) { if(!userID.isEmpty() && !token.isEmpty()) {
qDebug() << "Using token."; qDebug() << "Using token.";
m_connection->connectWithToken(userID, token, ""); m_connection->connectWithToken(userID, token, "");
} else if(!user.isEmpty() && !pass.isEmpty()) { } else if(!user.isEmpty() && !pass.isEmpty()) {
qDebug() << "Using given credential."; qDebug() << "Using given credential.";
m_connection->connectToServer("@"+user+":"+home, pass, ""); m_connection->connectToServer("@"+user+":"+home, pass, "");
}
} else {
qDebug() << "You are already logged in.";
} }
} }

View File

@ -1,9 +1,12 @@
import QtQuick 2.10 import QtQuick 2.10
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import "qrc:/qml/form" import "qrc:/qml/form"
import Matrique 0.1
Page { Page {
property var roomListModel property RoomListModel roomListModel
ListForm { ListForm {
id: roomListForm id: roomListForm
@ -16,5 +19,6 @@ Page {
id: roomForm id: roomForm
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: roomListForm.width anchors.leftMargin: roomListForm.width
roomIndex: roomListForm.currentIndex
} }
} }

View File

@ -11,9 +11,15 @@ Page {
TabButton { TabButton {
text: qsTr("Overview") text: qsTr("Overview")
} }
TabButton {
text: qsTr("Interface")
}
TabButton { TabButton {
text: qsTr("Network") text: qsTr("Network")
} }
TabButton { TabButton {
text: qsTr("Sync") text: qsTr("Sync")
} }
@ -36,5 +42,9 @@ Page {
Page { Page {
} }
Page {
}
} }
} }

View File

@ -7,6 +7,8 @@ import "qrc:/qml/component"
Item { Item {
property var listModel property var listModel
property alias currentIndex: listView.currentIndex
ColumnLayout { ColumnLayout {
anchors.fill: parent anchors.fill: parent
spacing: 0 spacing: 0

View File

@ -6,6 +6,8 @@ import QtGraphicalEffects 1.0
import "qrc:/qml/component" import "qrc:/qml/component"
Item { Item {
property int roomIndex
ColumnLayout { ColumnLayout {
anchors.fill: parent anchors.fill: parent
spacing: 0 spacing: 0