2017-08-29 05:02:56 +00:00
|
|
|
import QtQuick 2.4
|
2019-05-14 02:20:27 +00:00
|
|
|
import QtQuick.Controls 2.5
|
2017-08-29 14:28:33 +00:00
|
|
|
import QtQuick.Controls.Material 2.1
|
2017-08-29 05:02:56 +00:00
|
|
|
import QtQuick.Layouts 1.3
|
|
|
|
|
2019-05-17 16:16:48 +00:00
|
|
|
import "componentCreator.js" as ComponentCreator
|
|
|
|
|
2017-08-29 05:02:56 +00:00
|
|
|
ApplicationWindow {
|
|
|
|
id: mainWindow
|
|
|
|
visible: true
|
|
|
|
|
2019-05-10 00:55:30 +00:00
|
|
|
Material.theme: settings.style == "Dark" ? Material.Dark : Material.Light
|
|
|
|
Material.accent: Material.Purple
|
2017-08-29 05:02:56 +00:00
|
|
|
// flags: Qt.FramelessWindowHint
|
2019-05-10 22:54:32 +00:00
|
|
|
background: Rectangle {
|
|
|
|
color: Material.color(Material.Grey, Material.Shade900)
|
|
|
|
}
|
2019-05-10 00:55:30 +00:00
|
|
|
|
2019-05-14 02:28:34 +00:00
|
|
|
minimumWidth: 364
|
2019-05-09 14:21:11 +00:00
|
|
|
minimumHeight: 590
|
2019-05-17 13:31:37 +00:00
|
|
|
width: minimumWidth * 2
|
|
|
|
height: minimumWidth * 1.5
|
2019-05-09 05:51:24 +00:00
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
if (settings.firstRun) {
|
|
|
|
connectDialog.open()
|
|
|
|
}
|
|
|
|
}
|
2017-08-29 05:02:56 +00:00
|
|
|
|
|
|
|
Item {
|
|
|
|
AboutDialog {
|
|
|
|
id: aboutDialog
|
|
|
|
x: (mainWindow.width - width) / 2
|
|
|
|
y: mainWindow.height / 6
|
|
|
|
width: Math.min(mainWindow.width, mainWindow.height) / 3 * 2
|
|
|
|
}
|
|
|
|
|
2019-05-05 11:41:07 +00:00
|
|
|
ConnectDialog {
|
|
|
|
id: connectDialog
|
|
|
|
x: mainWindow.width / 2 - width / 2
|
2019-05-05 16:21:38 +00:00
|
|
|
y: mainWindow.height / 2 - height / 2 - mainWindow.header.height
|
2019-05-05 11:41:07 +00:00
|
|
|
width: 340
|
2019-05-15 00:08:13 +00:00
|
|
|
height: 500
|
2019-05-05 11:41:07 +00:00
|
|
|
}
|
|
|
|
|
2017-08-29 05:02:56 +00:00
|
|
|
SettingsDialog {
|
|
|
|
id: settingsDialog
|
|
|
|
x: (mainWindow.width - width) / 2
|
|
|
|
y: mainWindow.height / 6
|
|
|
|
width: Math.min(mainWindow.width, mainWindow.height) / 3 * 2
|
|
|
|
}
|
2019-05-10 13:45:38 +00:00
|
|
|
|
|
|
|
Popup {
|
|
|
|
id: errorDialog
|
|
|
|
modal: true
|
|
|
|
focus: true
|
|
|
|
contentHeight: errorLayout.height
|
|
|
|
visible: accountBridge.error.length > 0
|
|
|
|
x: mainWindow.width / 2 - width / 2
|
|
|
|
y: mainWindow.height / 2 - height / 2 - mainWindow.header.height
|
|
|
|
width: Math.min(mainWindow.width * 0.66, errorLayout.implicitWidth + 32)
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
id: errorLayout
|
|
|
|
spacing: 20
|
|
|
|
width: parent.width
|
|
|
|
|
|
|
|
Label {
|
|
|
|
text: qsTr("Error")
|
|
|
|
font.bold: true
|
|
|
|
}
|
|
|
|
|
|
|
|
Label {
|
2019-05-19 00:43:48 +00:00
|
|
|
Layout.fillWidth: true
|
2019-05-10 13:45:38 +00:00
|
|
|
wrapMode: Label.Wrap
|
|
|
|
font.pointSize: 14
|
|
|
|
text: accountBridge.error
|
|
|
|
}
|
|
|
|
|
|
|
|
Button {
|
|
|
|
id: okButton
|
|
|
|
Layout.alignment: Qt.AlignCenter
|
|
|
|
highlighted: true
|
|
|
|
|
|
|
|
text: qsTr("Close")
|
|
|
|
onClicked: {
|
2019-05-12 00:42:05 +00:00
|
|
|
accountBridge.error = ""
|
2019-05-10 13:45:38 +00:00
|
|
|
errorDialog.close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-08-29 05:02:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
header: ToolBar {
|
2019-05-13 06:08:40 +00:00
|
|
|
ToolButton {
|
|
|
|
id: drawerButton
|
|
|
|
contentItem: Image {
|
|
|
|
fillMode: Image.Pad
|
|
|
|
horizontalAlignment: Image.AlignHCenter
|
|
|
|
verticalAlignment: Image.AlignVCenter
|
|
|
|
source: "images/drawer.png"
|
2017-08-29 05:02:56 +00:00
|
|
|
}
|
2019-05-13 06:08:40 +00:00
|
|
|
onClicked: {
|
|
|
|
drawer.open()
|
2017-08-29 05:02:56 +00:00
|
|
|
}
|
2019-05-13 06:08:40 +00:00
|
|
|
}
|
2017-08-31 18:54:29 +00:00
|
|
|
|
2017-08-29 05:02:56 +00:00
|
|
|
RowLayout {
|
2019-05-13 06:08:40 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
spacing: 8
|
|
|
|
|
|
|
|
ImageButton {
|
|
|
|
opacity: 1.0
|
|
|
|
rounded: true
|
|
|
|
horizontalAlignment: Image.AlignHCenter
|
|
|
|
verticalAlignment: Image.AlignVCenter
|
|
|
|
source: accountBridge.avatar
|
|
|
|
sourceSize.height: 32
|
|
|
|
onClicked: function() {
|
|
|
|
Qt.openUrlExternally(accountBridge.profileURL)
|
2017-08-29 05:02:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-13 06:08:40 +00:00
|
|
|
Label {
|
|
|
|
id: titleLabel
|
|
|
|
text: accountBridge.username
|
|
|
|
font.pointSize: 13
|
|
|
|
elide: Label.ElideRight
|
|
|
|
horizontalAlignment: Image.AlignHCenter
|
|
|
|
verticalAlignment: Qt.AlignVCenter
|
2017-08-29 05:02:56 +00:00
|
|
|
}
|
2019-05-13 06:08:40 +00:00
|
|
|
}
|
2017-08-29 05:02:56 +00:00
|
|
|
|
2019-05-13 06:08:40 +00:00
|
|
|
ToolButton {
|
|
|
|
id: postButton
|
|
|
|
anchors.right: menuButton.left
|
|
|
|
contentItem: Image {
|
|
|
|
fillMode: Image.Pad
|
|
|
|
horizontalAlignment: Image.AlignHCenter
|
|
|
|
verticalAlignment: Image.AlignVCenter
|
|
|
|
source: "images/post.png"
|
2019-05-05 12:59:38 +00:00
|
|
|
}
|
2019-05-13 06:08:40 +00:00
|
|
|
onClicked: {
|
2019-05-17 16:16:48 +00:00
|
|
|
ComponentCreator.createMessagePopup(this, null).open();
|
2019-05-13 06:08:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
ToolButton {
|
|
|
|
anchors.right: parent.right
|
|
|
|
id: menuButton
|
|
|
|
Layout.alignment: Qt.AlignRight
|
|
|
|
contentItem: Image {
|
|
|
|
fillMode: Image.Pad
|
|
|
|
horizontalAlignment: Image.AlignHCenter
|
|
|
|
verticalAlignment: Image.AlignVCenter
|
|
|
|
source: "images/menu.png"
|
|
|
|
}
|
|
|
|
onClicked: optionsMenu.open()
|
|
|
|
|
|
|
|
Menu {
|
|
|
|
id: optionsMenu
|
|
|
|
x: parent.width - width
|
|
|
|
transformOrigin: Menu.TopRight
|
|
|
|
|
|
|
|
MenuItem {
|
|
|
|
text: qsTr("Connect")
|
|
|
|
onTriggered: function() {
|
|
|
|
connectDialog.reset()
|
|
|
|
connectDialog.open()
|
2017-08-29 05:02:56 +00:00
|
|
|
}
|
|
|
|
}
|
2019-05-13 06:08:40 +00:00
|
|
|
/*
|
|
|
|
MenuItem {
|
|
|
|
text: qsTr("Settings")
|
|
|
|
onTriggered: settingsDialog.open()
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
MenuItem {
|
|
|
|
text: qsTr("About")
|
|
|
|
onTriggered: aboutDialog.open()
|
|
|
|
}
|
2017-08-29 05:02:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Drawer {
|
|
|
|
id: drawer
|
2019-05-14 22:23:32 +00:00
|
|
|
width: drawerLayout.implicitWidth + 16
|
2017-08-29 05:02:56 +00:00
|
|
|
height: mainWindow.height
|
|
|
|
dragMargin: 0
|
|
|
|
|
2019-05-05 12:57:56 +00:00
|
|
|
ColumnLayout {
|
2019-05-14 22:23:32 +00:00
|
|
|
id: drawerLayout
|
2017-08-29 05:02:56 +00:00
|
|
|
anchors.fill: parent
|
|
|
|
|
2019-05-06 18:16:20 +00:00
|
|
|
AccountSummary {
|
|
|
|
profile: accountBridge
|
|
|
|
}
|
2019-05-05 12:57:56 +00:00
|
|
|
ToolSeparator {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
orientation: Qt.Horizontal
|
2017-08-29 05:02:56 +00:00
|
|
|
}
|
|
|
|
|
2019-05-05 12:57:56 +00:00
|
|
|
ListView {
|
|
|
|
id: listView
|
|
|
|
currentIndex: -1
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
delegate: ItemDelegate {
|
|
|
|
width: parent.width
|
|
|
|
text: model.title
|
|
|
|
highlighted: ListView.isCurrentItem
|
|
|
|
onClicked: {
|
|
|
|
listView.currentIndex = -1
|
|
|
|
drawer.close()
|
|
|
|
switch (model.sid) {
|
|
|
|
case 0:
|
2019-05-17 16:16:48 +00:00
|
|
|
ComponentCreator.createMessagePopup(this, null).open();
|
2019-05-05 12:57:56 +00:00
|
|
|
break
|
2019-05-09 05:51:24 +00:00
|
|
|
case 1:
|
2019-05-05 12:57:56 +00:00
|
|
|
Qt.quit()
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
model: ListModel {
|
|
|
|
ListElement {
|
|
|
|
title: qsTr("New Post")
|
2019-05-09 05:51:24 +00:00
|
|
|
property int sid: 0
|
2019-05-05 12:57:56 +00:00
|
|
|
}
|
|
|
|
ListElement {
|
|
|
|
title: qsTr("Exit")
|
2019-05-09 05:51:24 +00:00
|
|
|
property int sid: 1
|
2019-05-05 12:57:56 +00:00
|
|
|
}
|
2017-08-29 05:02:56 +00:00
|
|
|
}
|
2019-05-05 12:57:56 +00:00
|
|
|
ScrollIndicator.vertical: ScrollIndicator {
|
2017-08-29 05:02:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-14 02:20:27 +00:00
|
|
|
ScrollView {
|
|
|
|
id: mainscroll
|
2017-08-29 05:02:56 +00:00
|
|
|
anchors.fill: parent
|
2019-05-14 02:20:27 +00:00
|
|
|
ScrollBar.horizontal.policy: contentWidth > width ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff
|
|
|
|
ScrollBar.vertical.policy: ScrollBar.AlwaysOff
|
2019-05-17 13:14:20 +00:00
|
|
|
contentWidth: Math.max(maingrid.implicitWidth, parent.width)
|
2019-05-14 02:20:27 +00:00
|
|
|
|
|
|
|
GridLayout {
|
|
|
|
id: maingrid
|
|
|
|
// columns: accountBridge.panes.length
|
|
|
|
rows: 1
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.margins: 0
|
|
|
|
columnSpacing: 0
|
|
|
|
rowSpacing: 0
|
|
|
|
|
|
|
|
Repeater {
|
|
|
|
model: accountBridge.panes
|
|
|
|
MessagePane {
|
|
|
|
Layout.row: 0
|
|
|
|
Layout.column: index
|
|
|
|
|
|
|
|
idx: index
|
|
|
|
name: model.panename
|
|
|
|
sticky: model.panesticky
|
|
|
|
messageModel: model.msgmodel
|
|
|
|
}
|
2019-05-13 20:42:03 +00:00
|
|
|
}
|
2017-08-29 05:02:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|