2020-09-23 19:57:54 -04:00
|
|
|
// Copyright Mirage authors & contributors <https://github.com/mirukana/mirage>
|
2019-12-02 16:29:29 -04:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
|
|
|
|
import QtQuick 2.12
|
2020-05-15 03:03:47 -04:00
|
|
|
import "."
|
2019-12-02 16:29:29 -04:00
|
|
|
|
|
|
|
PythonBridge {
|
2020-07-12 00:25:57 -04:00
|
|
|
property bool ready: false
|
|
|
|
property bool startupAnyAccountsSaved: false
|
|
|
|
|
|
|
|
readonly property EventHandlers eventHandlers: EventHandlers {}
|
|
|
|
|
2019-12-02 16:29:29 -04:00
|
|
|
Component.onCompleted: {
|
|
|
|
for (var func in eventHandlers) {
|
|
|
|
if (! eventHandlers.hasOwnProperty(func)) continue
|
2020-07-08 17:25:32 -04:00
|
|
|
if (! func.startsWith("on")) continue
|
2019-12-02 16:29:29 -04:00
|
|
|
setHandler(func.replace(/^on/, ""), eventHandlers[func])
|
|
|
|
}
|
|
|
|
|
|
|
|
addImportPath("src")
|
|
|
|
addImportPath("qrc:/src")
|
|
|
|
|
|
|
|
importNames("backend.qml_bridge", ["BRIDGE"], () => {
|
2020-10-05 03:06:07 -04:00
|
|
|
callCoro("get_settings", [], ([settings, state, hist, theme]) => {
|
|
|
|
window.settings = settings
|
|
|
|
window.uiState = state
|
|
|
|
window.history = hist
|
|
|
|
window.theme = Qt.createQmlObject(theme, window, "theme")
|
|
|
|
utils.theme = window.theme
|
|
|
|
|
2019-12-02 16:29:29 -04:00
|
|
|
callCoro("saved_accounts.any_saved", [], any => {
|
|
|
|
if (any) { callCoro("load_saved_accounts", []) }
|
|
|
|
|
|
|
|
startupAnyAccountsSaved = any
|
|
|
|
ready = true
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|