Commit c2f01ec1 authored by Black Hat's avatar Black Hat

First commit.

parents
[submodule "matrix/libqmatrixclient"]
path = matrix/libqmatrixclient
url = https://github.com/QMatrixClient/libqmatrixclient
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include "connection.h"
#include "room.h"
#include "user.h"
#include "jobs/syncjob.h"
#include "settings.h"
using namespace QMatrixClient;
// https://forum.qt.io/topic/57809
Q_DECLARE_METATYPE(SyncJob*)
Q_DECLARE_METATYPE(Room*)
int main(int argc, char *argv[])
{
#if defined(Q_OS_WIN)
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
QGuiApplication app(argc, argv);
qmlRegisterType<SyncJob>(); qRegisterMetaType<SyncJob*> ("SyncJob*");
qmlRegisterType<Room>(); qRegisterMetaType<Room*> ("Room*");
qmlRegisterType<User>(); qRegisterMetaType<User*> ("User*");
qmlRegisterType<Connection> ("Matrique", 0, 1, "Connection");
// qmlRegisterType<MessageEventModel> ("Matrique", 0, 1, "MessageEventModel");
// qmlRegisterType<RoomListModel> ("Matrique", 0, 1, "RoomListModel");
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml")));
if (engine.rootObjects().isEmpty())
return -1;
return app.exec();
}
QT += quick
CONFIG += c++14
include(matrix/libqmatrixclient/libqmatrixclient.pri)
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += main.cpp
RESOURCES += \
res.qrc
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
# Additional import path used to resolve QML modules just for Qt Quick Designer
QML_DESIGNER_IMPORT_PATH =
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
DISTFILES += \
ChatForm.qml \
LoginForm.qml \
main.qml \
Home.qml \
Login.qml \
ImageStatus.qml \
ButtonDelegate.qml \
SideNav.qml \
ContactListForm.qml \
ContactDetailForm.qml \
Contact.qml \
Setting.qml
Subproject commit b7c1ff183384738f170d53128c684681cb34f3b7
import QtQuick 2.10
import QtQuick.Controls 2.3
import "qrc:/qml/form"
Page {
ContactListForm {
id: contactListForm
height: parent.height
width: 320
}
ContactDetailForm {
id: contactDetailForm
anchors.fill: parent
anchors.leftMargin: contactListForm.width
}
}
import QtQuick 2.10
import QtQuick.Controls 2.3
import "qrc:/qml/form"
Page {
ContactListForm {
id: contactListForm
height: parent.height
width: 320
}
ChatForm {
id: chatForm
anchors.fill: parent
anchors.leftMargin: contactListForm.width
}
}
import QtQuick 2.10
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
import QtQuick.Controls 2.3
import QtQuick.Controls.Material 2.3
import "qrc:/qml/component"
Page {
property var window
property alias username: usernameField.text
property alias password: passwordField.text
Row {
anchors.fill: parent
Pane {
width: parent.width / 2
height: parent.height
background: Item {
Image {
id: background
anchors.fill: parent
source: "qrc:/asset/img/background.jpg"
fillMode: Image.PreserveAspectCrop
}
ColorOverlay {
anchors.fill: background
source: background
color: "#b000796b"
}
}
Column {
x: 32
anchors.verticalCenter: parent.verticalCenter
Label {
text: "MATRIX LOGIN."
font.pointSize: 36
font.bold: true
color: "white"
}
Label {
text: "A NEW METHOD OF MESSAGING"
font.pointSize: 12
color: "white"
}
}
}
Pane {
width: parent.width / 2
height: parent.height
padding: 64
Column {
id: main_col
spacing: 8
anchors.fill: parent
ImageStatus {
width: 96
height: width
source: "qrc:/asset/img/avatar.png"
anchors.horizontalCenter: parent.horizontalCenter
}
TextField {
id: serverField
width: parent.width
height: 48
placeholderText: "Server"
leftPadding: 16
topPadding: 0
bottomPadding: 0
background: Rectangle {
color: "#eaeaea"
border.color: parent.activeFocus ? Material.accent : "transparent"
border.width: 2
}
}
TextField {
id: usernameField
width: parent.width
height: 48
placeholderText: "Username"
leftPadding: 16
topPadding: 0
bottomPadding: 0
background: Rectangle {
color: "#eaeaea"
border.color: parent.activeFocus ? Material.accent : "transparent"
border.width: 2
}
}
TextField {
id: passwordField
width: parent.width
height: 48
placeholderText: "Password"
leftPadding: 16
topPadding: 0
bottomPadding: 0
background: Rectangle {
color: "#eaeaea"
border.color: parent.activeFocus ? Material.accent : "transparent"
border.width: 2
}
}
Button {
id: loginButton
text: "LOGIN"
highlighted: true
width: parent.width
onClicked: window.login()
}
}
}
}
}
import QtQuick 2.10
import QtQuick.Controls 2.3
Page {
TabBar {
id: settingBar
width: parent.width
z: 10
currentIndex: settingBar.currentIndex
TabButton {
text: qsTr("Overview")
}
TabButton {
text: qsTr("Network")
}
TabButton {
text: qsTr("Sync")
}
}
SwipeView {
id: settingSwipe
currentIndex: settingBar.currentIndex
anchors.fill: parent
Page {
}
Page {
}
Page {
}
}
}
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import QtQuick.Controls.Material 2.3
Item {
property int index
property alias contentItem: itemDelegate.contentItem
signal clicked
id: buttonDelegate
Layout.fillWidth: true
Layout.preferredHeight: width
Rectangle {
width: swipeView.currentIndex === index ? parent.width : 0
height: parent.height
anchors.bottom: itemDelegate.bottom
color: Qt.lighter(Material.accent)
Behavior on width {
PropertyAnimation { easing.type: Easing.InOutQuad; duration: 200 }
}
}
ItemDelegate {
id: itemDelegate
anchors.fill: parent
onClicked: {
swipeView.currentIndex = index
buttonDelegate.clicked()
}
}
}
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtGraphicalEffects 1.0
Image {
id: avatar
mipmap: true
layer.enabled: true
fillMode: Image.PreserveAspectCrop
layer.effect: OpacityMask {
maskSource: Item {
width: avatar.width
height: avatar.width
Rectangle {
anchors.centerIn: parent
width: avatar.width
height: avatar.width
radius: avatar.width / 2
}
}
}
Rectangle {
id: circle
width: avatar.width
height: avatar.width
radius: avatar.width / 2
color: "transparent"
border.color: "#4caf50"
border.width: 4
}
}
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import QtQuick.Controls.Material 2.3
Drawer {
property SwipeView swipeView
interactive: false
position: 1.0
visible: true
modal: false
background: Rectangle {
color: Material.accent
}
}
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import QtQuick.Controls.Material 2.3
import QtGraphicalEffects 1.0
import "qrc:/qml/component"
Item {
ColumnLayout {
anchors.fill: parent
Pane {
z: 10
padding: 16
Layout.fillWidth: true
Layout.preferredHeight: 80
background: Rectangle {
color: "#eaeaea"
}
Row {
anchors.fill: parent
spacing: 16
ImageStatus {
width: parent.height
height: parent.height
source: "qrc:/asset/img/avatar.png"
}
Column {
height: parent.height
Text {
text: "Astolfo"
font.pointSize: 18
color: "#424242"
}
Text {
text: "Rider of Black"
color: "#424242"
}
}
}
}
Pane {
Layout.fillWidth: true
Layout.fillHeight: true
}
Pane {
z: 10
padding: 16
Layout.fillWidth: true
Layout.preferredHeight: 80
RowLayout {
anchors.fill: parent
spacing: 0
ItemDelegate {
Layout.preferredWidth: height
Layout.fillHeight: true
contentItem: Text {
text: "\ue226"
color: "#424242"
font.pointSize: 16
font.family: materialFont.name
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}
TextField {
Layout.fillWidth: true
Layout.fillHeight: true
placeholderText: "Send a Message"
leftPadding: 16
topPadding: 0
bottomPadding: 0
background: Rectangle {
color: "#eaeaea"
}
}
ItemDelegate {
Layout.preferredWidth: height
Layout.fillHeight: true
contentItem: Text {
text: "\ue24e"
color: parent.pressed ? Material.accent : "#424242"
font.pointSize: 16
font.family: materialFont.name
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
background: Rectangle {
color: "#eaeaea"
}
}
ItemDelegate {
Layout.preferredWidth: height
Layout.fillHeight: true
contentItem: Text {
text: "\ue163"
color: "#424242"
font.pointSize: 16
font.family: materialFont.name
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}
}
}
}
}
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import QtQuick.Controls.Material 2.3
import "qrc:/qml/component"
Item {
ColumnLayout {
anchors.fill: parent
Pane {
Layout.fillWidth: true
Layout.preferredHeight: 250
padding: 32
background: Rectangle {
color: Material.accent
}
Column {
anchors.fill: parent
ImageStatus {
z: 10
width: 96
height: width
source: "qrc:/asset/img/avatar.png"
anchors.horizontalCenter: parent.horizontalCenter
}
Text {
text: "Astolfo"
color: "white"
font.pointSize: 28
anchors.horizontalCenter: parent.horizontalCenter
}
Text {
text: "Rider of Black"
color: "#cdcdcd"
font.pointSize: 12
anchors.horizontalCenter: parent.horizontalCenter
}
Row {
height: 48
anchors.horizontalCenter: parent.horizontalCenter
ItemDelegate {
width: parent.height
height: parent.height
contentItem: Text {
text: "\ue0b7"
font.pointSize: 16
font.family: materialFont.name
color: "white"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}
ItemDelegate {
width: parent.height
height: parent.height
contentItem: Text {
text: "\ue62e"
font.pointSize: 16
font.family: materialFont.name
color: "white"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}
}
}
}
Pane {
Layout.fillWidth: true
Layout.fillHeight: true
leftPadding: 96
rightPadding: 96
GridLayout {
width: parent.width
columns: 2
flow: GridLayout.LeftToRight
anchors.horizontalCenter: parent.horizontalCenter
columnSpacing: 32
Text {
text: "Matrix ID"
}
Text {
Layout.fillWidth: true
text: "Welcome"
}
Text {
text: "Status"
}
Text {
text: "Overline"
}
}
}
}
}
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
import QtQuick.Controls.Material 2.3
import "qrc:/qml/component"
Item {
ColumnLayout {
anchors.fill: parent
spacing: 0
Pane {
z: 10
Layout.fillWidth: true
Layout.preferredHeight: 80
background: Rectangle {
color: Qt.tint(Material.accent, "#20FFFFFF")
}
TextField {
id: serverField
width: parent.width
height: 36
leftPadding: 16
topPadding: 0
bottomPadding: 0
anchors.verticalCenter: parent.verticalCenter
background: Item {
Row {
anchors.fill: parent
Text {
width: parent.height
height: parent.height
text: "\ue8b6"
font.pointSize: 16
font.family: materialFont.name
color: "white"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
Text {
height: parent.height
text: "Search"
color: "white"
font.pointSize: 12
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}
Rectangle {
width: serverField.activeFocus || serverField.text != "" ? parent.width : 0
height: parent.height
color: "white"
Behavior on width {
PropertyAnimation { easing.type: Easing.InOutQuad; duration: 200 }
}
}
}
}
}
Pane {
Layout.fillWidth: true
Layout.fillHeight: true
padding: 0
background: Rectangle {
color: "#eaeaea"
}
ListModel {
id: listModel
ListElement {
name: "Bill Smith"
number: "555 3264"
}
ListElement {
name: "John Brown"
number: "555 8426"
}
ListElement {
name: "Sam Wise"
number: "555 0473"
}
ListElement {
name: "Bill Smith"
number: "555 3264"
}
ListElement {
name: "John Brown"
number: "555 8426"
}
ListElement {
name: "Sam Wise"
number: "555 0473"
}
ListElement {
name: "Bill Smith"
number: "555 3264"
}
ListElement {
name: "John Brown"
number: "555 8426"
}