Preparation for messageeventmodel.

square-messages
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 \
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

View File

@ -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.";
}
}

View File

@ -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
}
}

View File

@ -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 {
}
}
}

View File

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

View File

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