Define UIState config file

This commit is contained in:
miruka 2019-07-21 06:05:01 -04:00
parent 414082d258
commit 71f78feec6
3 changed files with 21 additions and 4 deletions

View File

@ -12,6 +12,7 @@
- When qml syntax highlighting supports string interpolation, use them - When qml syntax highlighting supports string interpolation, use them
- Fixes - Fixes
- Keyboard flicking against top/bottom edge
- Don't strip user spacing in html - Don't strip user spacing in html
- Past events loading (limit 100) freezes the GUI - need to move upsert func - Past events loading (limit 100) freezes the GUI - need to move upsert func
to a WorkerScript to a WorkerScript
@ -19,6 +20,7 @@
- Horrible performance for big rooms - Horrible performance for big rooms
- UI - UI
- When reduced, show the full-window sidepane instead of Default page
- Adapt shortcuts flicking speed to font size and DPI - Adapt shortcuts flicking speed to font size and DPI
- Show error box if uploading avatar fails - Show error box if uploading avatar fails
- EditAccount page: - EditAccount page:

View File

@ -20,11 +20,14 @@ WRITE_LOCK = asyncio.Lock()
class ConfigFile: class ConfigFile:
backend: Backend = field() backend: Backend = field()
filename: str = field() filename: str = field()
use_data_dir: bool = False
@property @property
def path(self) -> Path: def path(self) -> Path:
# pylint: disable=no-member # pylint: disable=no-member
return Path(self.backend.app.appdirs.user_config_dir) / self.filename dirs = self.backend.app.appdirs
to = dirs.user_data_dir if self.use_data_dir else dirs.user_config_dir
return Path(to) / self.filename
@dataclass @dataclass
@ -87,3 +90,15 @@ class UISettings(JSONConfigFile):
return { return {
"write_aliases": {} "write_aliases": {}
} }
@dataclass
class UIState(JSONConfigFile):
filename: str = "ui-state.json"
use_data_dir: bool = True
async def default_data(self) -> JsonData:
return {
"page": "Pages/Default.qml",
"pageProperties": {},
}

View File

@ -15,7 +15,7 @@ Item {
target: py target: py
onWillLoadAccounts: will => { onWillLoadAccounts: will => {
pageStack.showPage(will ? "Default": "SignIn") pageStack.showPage(will ? "Default": "SignIn")
if (will) { initialRoomTimer.start() } // if (will) { initialRoomTimer.start() }
} }
} }