Refactor and cleanup dead qml
This commit is contained in:
@@ -18,7 +18,6 @@ import NeoChat.Menu 1.0
|
|||||||
Kirigami.ScrollablePage {
|
Kirigami.ScrollablePage {
|
||||||
id: page
|
id: page
|
||||||
|
|
||||||
property var roomListModel
|
|
||||||
property var enteredRoom
|
property var enteredRoom
|
||||||
required property var activeConnection
|
required property var activeConnection
|
||||||
|
|
||||||
@@ -62,7 +61,10 @@ Kirigami.ScrollablePage {
|
|||||||
}
|
}
|
||||||
model: SortFilterRoomListModel {
|
model: SortFilterRoomListModel {
|
||||||
id: sortFilterRoomListModel
|
id: sortFilterRoomListModel
|
||||||
sourceModel: roomListModel
|
sourceModel: RoomListModel {
|
||||||
|
id: roomListModel
|
||||||
|
connection: page.activeConnection
|
||||||
|
}
|
||||||
roomSortOrder: Config.mergeRoomList ? SortFilterRoomListModel.LastActivity : SortFilterRoomListModel.Categories
|
roomSortOrder: Config.mergeRoomList ? SortFilterRoomListModel.LastActivity : SortFilterRoomListModel.Categories
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
30
qml/main.qml
30
qml/main.qml
@@ -20,7 +20,6 @@ import NeoChat.Page 1.0
|
|||||||
Kirigami.ApplicationWindow {
|
Kirigami.ApplicationWindow {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property var currentRoom: null
|
|
||||||
property int columnWidth: Kirigami.Units.gridUnit * 13
|
property int columnWidth: Kirigami.Units.gridUnit * 13
|
||||||
|
|
||||||
minimumWidth: Kirigami.Units.gridUnit * 15
|
minimumWidth: Kirigami.Units.gridUnit * 15
|
||||||
@@ -28,6 +27,10 @@ Kirigami.ApplicationWindow {
|
|||||||
|
|
||||||
wideScreen: width > columnWidth * 5
|
wideScreen: width > columnWidth * 5
|
||||||
|
|
||||||
|
onClosing: Controller.saveWindowGeometry(root)
|
||||||
|
|
||||||
|
pageStack.initialPage: LoadingPage {}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: root.quitAction
|
target: root.quitAction
|
||||||
function onTriggered() {
|
function onTriggered() {
|
||||||
@@ -35,8 +38,6 @@ Kirigami.ApplicationWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onClosing: Controller.saveWindowGeometry(root)
|
|
||||||
|
|
||||||
// This timer allows to batch update the window size change to reduce
|
// This timer allows to batch update the window size change to reduce
|
||||||
// the io load and also work around the fact that x/y/width/height are
|
// the io load and also work around the fact that x/y/width/height are
|
||||||
// changed when loading the page and overwrite the saved geometry from
|
// changed when loading the page and overwrite the saved geometry from
|
||||||
@@ -78,7 +79,7 @@ Kirigami.ApplicationWindow {
|
|||||||
signal openRoom(string room);
|
signal openRoom(string room);
|
||||||
|
|
||||||
function roomByAliasOrId(aliasOrId) {
|
function roomByAliasOrId(aliasOrId) {
|
||||||
return spectralRoomListModel.roomByAliasOrId(aliasOrId)
|
return Controller.activeConnection.room(aliasOrId)
|
||||||
}
|
}
|
||||||
|
|
||||||
function openRoomAndEvent(room, event) {
|
function openRoomAndEvent(room, event) {
|
||||||
@@ -90,7 +91,7 @@ Kirigami.ApplicationWindow {
|
|||||||
if (Config.openRoom) {
|
if (Config.openRoom) {
|
||||||
const room = Controller.activeConnection.room(Config.openRoom);
|
const room = Controller.activeConnection.room(Config.openRoom);
|
||||||
currentRoom = room;
|
currentRoom = room;
|
||||||
roomItem = pageStack.push(roomPage, { 'currentRoom': room, });
|
roomItem = pageStack.push("qrc:/imports/NeoChat/Page/RoomPage.qml", { 'currentRoom': room, });
|
||||||
connectRoomToSignal(roomItem);
|
connectRoomToSignal(roomItem);
|
||||||
} else {
|
} else {
|
||||||
// TODO create welcome page
|
// TODO create welcome page
|
||||||
@@ -102,7 +103,7 @@ Kirigami.ApplicationWindow {
|
|||||||
roomItem.currentRoom = room;
|
roomItem.currentRoom = room;
|
||||||
pageStack.currentIndex = pageStack.depth - 1;
|
pageStack.currentIndex = pageStack.depth - 1;
|
||||||
} else {
|
} else {
|
||||||
roomItem = pageStack.push(roomPage, { 'currentRoom': room, });
|
roomItem = pageStack.push("qrc:/imports/NeoChat/Page/RoomPage.qml", { 'currentRoom': room, });
|
||||||
}
|
}
|
||||||
currentRoom = room;
|
currentRoom = room;
|
||||||
Config.openRoom = room.id;
|
Config.openRoom = room.id;
|
||||||
@@ -112,7 +113,7 @@ Kirigami.ApplicationWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getBack() {
|
function getBack() {
|
||||||
pageStack.replace(roomPage, { 'currentRoom': currentRoom, });
|
pageStack.replace("qrc:/imports/NeoChat/Page/RoomPage.qml", { 'currentRoom': currentRoom, });
|
||||||
}
|
}
|
||||||
|
|
||||||
function openWindow(room) {
|
function openWindow(room) {
|
||||||
@@ -236,13 +237,10 @@ Kirigami.ApplicationWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pageStack.initialPage: LoadingPage {}
|
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: roomListComponent
|
id: roomListComponent
|
||||||
RoomListPage {
|
RoomListPage {
|
||||||
id: roomList
|
id: roomList
|
||||||
roomListModel: spectralRoomListModel
|
|
||||||
activeConnection: Controller.activeConnection
|
activeConnection: Controller.activeConnection
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -333,18 +331,6 @@ Kirigami.ApplicationWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RoomListModel {
|
|
||||||
id: spectralRoomListModel
|
|
||||||
|
|
||||||
connection: Controller.activeConnection
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
|
||||||
id: roomPage
|
|
||||||
|
|
||||||
RoomPage {}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: createRoomDialog
|
id: createRoomDialog
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user