diff options
| -rw-r--r-- | .gitignore | 73 | ||||
| -rw-r--r-- | ChatView.qml | 46 | ||||
| -rw-r--r-- | ContactList.qml | 34 | ||||
| -rw-r--r-- | CustToolbar.qml | 27 | ||||
| -rw-r--r-- | EncryptionPopup.qml | 34 | ||||
| -rw-r--r-- | main.cpp | 21 | ||||
| -rw-r--r-- | main.qml | 28 | ||||
| -rw-r--r-- | qml.qrc | 10 | ||||
| -rw-r--r-- | qtquickcontrols2.conf | 7 | ||||
| -rw-r--r-- | yachat.pro | 21 |
10 files changed, 301 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fab7372 --- /dev/null +++ b/.gitignore @@ -0,0 +1,73 @@ +# This file is used to ignore files which are generated +# ---------------------------------------------------------------------------- + +*~ +*.autosave +*.a +*.core +*.moc +*.o +*.obj +*.orig +*.rej +*.so +*.so.* +*_pch.h.cpp +*_resource.rc +*.qm +.#* +*.*# +core +!core/ +tags +.DS_Store +.directory +*.debug +Makefile* +*.prl +*.app +moc_*.cpp +ui_*.h +qrc_*.cpp +Thumbs.db +*.res +*.rc +/.qmake.cache +/.qmake.stash + +# qtcreator generated files +*.pro.user* + +# xemacs temporary files +*.flc + +# Vim temporary files +.*.swp + +# Visual Studio generated files +*.ib_pdb_index +*.idb +*.ilk +*.pdb +*.sln +*.suo +*.vcproj +*vcproj.*.*.user +*.ncb +*.sdf +*.opensdf +*.vcxproj +*vcxproj.* + +# MinGW generated files +*.Debug +*.Release + +# Python byte code +*.pyc + +# Binaries +# -------- +*.dll +*.exe + diff --git a/ChatView.qml b/ChatView.qml new file mode 100644 index 0000000..3da0998 --- /dev/null +++ b/ChatView.qml @@ -0,0 +1,46 @@ +import QtQuick 2.12 +import QtQuick.Window 2.12 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.0 + +Page +{ + property string destination + + EncryptionPopup { + id: enctype + } + + header: CustToolbar + { + title: destination + } + + footer: Pane + { + RowLayout + { + anchors.fill: parent + + TextArea + { + id: textarea + wrapMode: TextArea.Wrap + Layout.fillWidth: true + placeholderText: "Compose message" + } + + Button + { + text: qsTr("enc") + onClicked: enctype.open() + } + + Button + { + text: qsTr("Send") + enabled: textarea.length > 1 + } + } + } +} diff --git a/ContactList.qml b/ContactList.qml new file mode 100644 index 0000000..0f9f47c --- /dev/null +++ b/ContactList.qml @@ -0,0 +1,34 @@ +import QtQuick 2.12 +import QtQuick.Window 2.12 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.0 + +Page +{ + header: CustToolbar + { + title: qsTr("Contacts") + + ToolButton + { + text: qsTr("+") + anchors.left: parent.left + } + } + + ListView + { + width: parent.width + model: ["Alice", "Bob"] + anchors.fill: parent + delegate: ItemDelegate + { + width: parent.width + text: modelData + onClicked: stack.push("qrc:/ChatView.qml", + { + destination: modelData + }) + } + } +} diff --git a/CustToolbar.qml b/CustToolbar.qml new file mode 100644 index 0000000..395d624 --- /dev/null +++ b/CustToolbar.qml @@ -0,0 +1,27 @@ +import QtQuick 2.12 +import QtQuick.Window 2.12 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.0 + +ToolBar +{ + property string title + + RowLayout + { + anchors.fill: parent + + ToolButton + { + text: "<" + onClicked: stack.pop() + visible: stack.depth > 1 + } + + Label + { + text: title + anchors.centerIn: parent + } + } +} diff --git a/EncryptionPopup.qml b/EncryptionPopup.qml new file mode 100644 index 0000000..08ebdf7 --- /dev/null +++ b/EncryptionPopup.qml @@ -0,0 +1,34 @@ +import QtQuick 2.12 +import QtQuick.Window 2.12 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.0 + +Popup +{ + id: enctype + modal: true + + RowLayout + { + Label + { + text: "Select encryption:" + } + + ComboBox + { + model: ListModel + { + ListElement + { + text: "OMEMO" + } + + ListElement + { + text: "Unencrypted" + } + } + } + } +} diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..104e9fc --- /dev/null +++ b/main.cpp @@ -0,0 +1,21 @@ +#include <QGuiApplication> +#include <QQmlApplicationEngine> + +int main(int argc, char *argv[]) +{ +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); +#endif + QGuiApplication app(argc, argv); + + QQmlApplicationEngine engine; + const QUrl url(QStringLiteral("qrc:/main.qml")); + QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, + &app, [url](QObject *obj, const QUrl &objUrl) { + if (!obj && url == objUrl) + QCoreApplication::exit(-1); + }, Qt::QueuedConnection); + engine.load(url); + + return app.exec(); +} diff --git a/main.qml b/main.qml new file mode 100644 index 0000000..cbfb770 --- /dev/null +++ b/main.qml @@ -0,0 +1,28 @@ +import QtQuick 2.12 +import QtQuick.Window 2.12 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.0 + +ApplicationWindow { + id: window + width: 320 + height: 240 + visible: true + title: qsTr("Yet Another Chat Client") + + Transition { + from: "*" + to: "*" + NumberAnimation + { + duration: 1000 + } + } + + StackView + { + id: stack + anchors.fill: parent + initialItem: ContactList {} + } +} @@ -0,0 +1,10 @@ +<RCC> + <qresource prefix="/"> + <file>main.qml</file> + <file>ChatView.qml</file> + <file>ContactList.qml</file> + <file>CustToolbar.qml</file> + <file>qtquickcontrols2.conf</file> + <file>EncryptionPopup.qml</file> + </qresource> +</RCC> diff --git a/qtquickcontrols2.conf b/qtquickcontrols2.conf new file mode 100644 index 0000000..938b27c --- /dev/null +++ b/qtquickcontrols2.conf @@ -0,0 +1,7 @@ +[Controls] +Style=Material + +[Material] +Theme=System +Accent=Teal +Primary=BlueGrey diff --git a/yachat.pro b/yachat.pro new file mode 100644 index 0000000..9e24353 --- /dev/null +++ b/yachat.pro @@ -0,0 +1,21 @@ +QT += quick quickcontrols2 + +# You can make your code fail to compile if it uses deprecated APIs. +# In order to do so, uncomment the following line. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +SOURCES += \ + main.cpp + +RESOURCES += qml.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 |
