Use new PCN format for settings config file

This commit is contained in:
miruka
2020-10-07 20:12:32 -04:00
parent 6ce3059322
commit db12036372
52 changed files with 1305 additions and 409 deletions

View File

@@ -37,7 +37,7 @@ Drawer {
property bool collapse:
(horizontal ? window.width : window.height) <
window.settings.collapseSidePanesUnderWindowWidth * theme.uiScale
window.settings.General.hide_side_panes_under * theme.uiScale
property int peekSizeWhileCollapsed:
(horizontal ? referenceSizeParent.width : referenceSizeParent.height) *

View File

@@ -6,8 +6,8 @@ import QtQuick.Controls 2.12
Flickable {
id: flickable
maximumFlickVelocity: window.settings.kineticScrollingMaxSpeed
flickDeceleration: window.settings.kineticScrollingDeceleration
maximumFlickVelocity: window.settings.Scrolling.kinetic_max_speed
flickDeceleration: window.settings.Scrolling.kinetic_deceleration
ScrollBar.vertical: HScrollBar {
visible: parent.interactive

View File

@@ -81,8 +81,8 @@ GridView {
preferredHighlightBegin: height / 2 - currentItemHeight / 2
preferredHighlightEnd: height / 2 + currentItemHeight / 2
maximumFlickVelocity: window.settings.kineticScrollingMaxSpeed
flickDeceleration: window.settings.kineticScrollingDeceleration
maximumFlickVelocity: window.settings.Scrolling.kinetic_max_speed
flickDeceleration: window.settings.Scrolling.kinetic_deceleration
highlight: Rectangle {

View File

@@ -18,7 +18,7 @@ Image {
property alias radius: roundMask.radius
property alias showProgressBar: progressBarLoader.active
property bool showPauseButton: true
property bool pause: ! window.settings.media.autoPlayGIF
property bool pause: ! window.settings.Chat.Files.auto_play_gif
property bool forcePause: false
property real speed: 1

View File

@@ -16,7 +16,7 @@ MouseArea {
const speedMultiply =
Qt.styleHints.wheelScrollLines *
window.settings.nonKineticScrollingSpeed
window.settings.Scrolling.non_kinetic_speed
const pixelDelta = {
x: wheel.pixelDelta.x || wheel.angleDelta.x / 8 * speedMultiply,
@@ -64,7 +64,7 @@ MouseArea {
}
enabled: ! window.settings.enableKineticScrolling
enabled: ! window.settings.Scrolling.kinetic
propagateComposedEvents: true
acceptedButtons: Qt.NoButton
@@ -84,7 +84,8 @@ MouseArea {
Binding {
target: flickable
property: "maximumFlickVelocity"
value: mouseArea.enabled ? 0 : window.settings.kineticScrollingMaxSpeed
value:
mouseArea.enabled ? 0 : window.settings.Scrolling.kinetic_max_speed
}
Binding {
@@ -93,6 +94,6 @@ MouseArea {
value:
mouseArea.enabled ?
0 :
window.settings.kineticScrollingDeceleration
window.settings.Scrolling.kinetic_deceleration
}
}

View File

@@ -89,8 +89,8 @@ ListView {
preferredHighlightBegin: height / 2 - currentItemHeight / 2
preferredHighlightEnd: height / 2 + currentItemHeight / 2
maximumFlickVelocity: window.settings.kineticScrollingMaxSpeed
flickDeceleration: window.settings.kineticScrollingDeceleration
maximumFlickVelocity: window.settings.Scrolling.kinetic_max_speed
flickDeceleration: window.settings.Scrolling.kinetic_deceleration
highlight: Rectangle {
color: theme.controls.listView.highlight

View File

@@ -7,7 +7,7 @@ import ".."
HButton {
id: tile
property bool compact: window.settings.compactMode
property bool compact: window.settings.General.compact
property real contentOpacity: 1
property Component contextMenu: null
property HMenu openedMenu: null

View File

@@ -26,7 +26,7 @@ ToolTip {
}
delay: instant ? 0 : theme.controls.toolTip.delay
delay: instant ? 0 : window.settings.General.tooltips_delay * 1000
padding: background.border.width
background: Rectangle {

View File

@@ -55,7 +55,7 @@ HColumnLayout {
Timer {
id: osdHideTimer
interval: window.settings.media.autoHideOSDAfterMsec
interval: window.settings.Chat.Files.autohide_image_controls_after
onTriggered: osd.showup = false
}

View File

@@ -8,7 +8,7 @@ Rectangle {
implicitWidth:
window.settings.compactMode ?
window.settings.General.compact ?
theme.controls.presence.radius * 2 :
theme.controls.presence.radius * 2.5

View File

@@ -25,7 +25,7 @@ HDrawer {
property string selectedOutputText: ""
property string pythonDebugKeybind:
window.settings.keys.startPythonDebugger[0]
window.settings.Keys.python_debugger[0]
property string help: qsTr(
`Interact with the QML code using JavaScript ES6 syntax.
@@ -71,7 +71,7 @@ HDrawer {
if (addToHistory && history.slice(-1)[0] !== input) {
history.push(input)
while (history.length > maxHistoryLength) history.shift()
window.historyChanged()
window.saveHistory()
}
let output = ""
@@ -154,7 +154,7 @@ HDrawer {
}
HShortcut {
sequences: settings.keys.toggleDebugConsole
sequences: settings.Keys.qml_console
onActivated: debugConsole.toggle()
}

View File

@@ -17,7 +17,7 @@ Timer {
interval: 1000
repeat: true
running:
window.settings.beUnavailableAfterSecondsIdle > 0 &&
window.settings.Presence.auto_away_after > 0 &&
CppUtils.idleMilliseconds() !== -1
onTriggered: {
@@ -25,7 +25,7 @@ Timer {
const beUnavailable =
CppUtils.idleMilliseconds() / 1000 >=
window.settings.beUnavailableAfterSecondsIdle
window.settings.Presence.auto_away_after
for (let i = 0; i < accounts.count; i++) {
const account = accounts.get(i)

View File

@@ -81,7 +81,7 @@ Rectangle {
HShortcut {
sequences: window.settings.keys.goToPreviousAccount
sequences: window.settings.Keys.Accounts.previous
onActivated: {
accountList.moveCurrentIndexLeft()
accountList.currentItem.leftClicked()
@@ -89,7 +89,7 @@ Rectangle {
}
HShortcut {
sequences: window.settings.keys.goToNextAccount
sequences: window.settings.Keys.Accounts.next
onActivated: {
accountList.moveCurrentIndexRight()
accountList.currentItem.leftClicked()

View File

@@ -26,7 +26,7 @@ HTile {
function setCollapse(collapse) {
window.uiState.collapseAccounts[model.id] = collapse
window.uiStateChanged()
window.saveUIState()
py.callCoro("set_account_collapse", [model.id, collapse])
}
@@ -162,7 +162,7 @@ HTile {
HShortcut {
enabled: enableKeybinds
sequences: window.settings.keys.addNewChat
sequences: window.settings.Keys.Rooms.add
onActivated: addChat.clicked()
}
}
@@ -210,37 +210,37 @@ HTile {
HShortcut {
enabled: enableKeybinds
sequences: window.settings.keys.accountSettings
sequences: window.settings.Keys.Accounts.settings
onActivated: leftClicked()
}
HShortcut {
enabled: enableKeybinds
sequences: window.settings.keys.toggleCollapseAccount
sequences: window.settings.Keys.Accounts.collapse
onActivated: toggleCollapse()
}
HShortcut {
enabled: enableKeybinds
sequences: window.settings.keys.openPresenceMenu
sequences: window.settings.Keys.Accounts.menu
onActivated: account.doRightClick(false)
}
HShortcut {
enabled: enableKeybinds
sequences: window.settings.keys.togglePresenceUnavailable
sequences: window.settings.Keys.Accounts.unavailable
onActivated: account.togglePresence("unavailable")
}
HShortcut {
enabled: enableKeybinds
sequences: window.settings.keys.togglePresenceInvisible
sequences: window.settings.Keys.Accounts.invisible
onActivated: account.togglePresence("invisible")
}
HShortcut {
enabled: enableKeybinds
sequences: window.settings.keys.togglePresenceOffline
sequences: window.settings.Keys.Accounts.offline
onActivated: account.togglePresence("offline")
}

View File

@@ -32,7 +32,7 @@ Rectangle {
Layout.fillHeight: true
HShortcut {
sequences: window.settings.keys.addNewAccount
sequences: window.settings.Keys.Accounts.add
onActivated: addAccountButton.clicked()
}
}
@@ -57,7 +57,7 @@ Rectangle {
Keys.onEnterPressed: Keys.onReturnPressed(event)
Keys.onReturnPressed: {
roomList.showItemAtIndex()
if (window.settings.clearRoomFilterOnEnter) text = ""
if (window.settings.RoomList.enter_clears_filter) text = ""
}
Keys.onMenuPressed:
@@ -66,19 +66,19 @@ Rectangle {
Keys.onEscapePressed: {
mainPane.toggleFocus()
if (window.settings.clearRoomFilterOnEscape) text = ""
if (window.settings.RoomList.escape_clears_filter) text = ""
}
Behavior on opacity { HNumberAnimation {} }
HShortcut {
sequences: window.settings.keys.clearRoomFilter
sequences: window.settings.Keys.Rooms.clear_filter
onActivated: filterField.text = ""
}
HShortcut {
sequences: window.settings.keys.toggleFocusMainPane
sequences: window.settings.Keys.Rooms.focus_filter
onActivated: mainPane.toggleFocus()
}
}

View File

@@ -25,8 +25,9 @@ HDrawer {
saveName: "mainPane"
background: Rectangle { color: theme.mainPane.background }
minimumSize: theme.mainPane.minimumSize
requireDefaultSize: bottomBar.filterField.activeFocus
minimumSize:
window.settings.RoomList.min_width * window.settings.General.zoom
Behavior on opacity { HNumberAnimation {} }

View File

@@ -73,12 +73,12 @@ HListView {
) :
pageLoader.showRoom(item.for_account, item.id)
if (fromClick && ! window.settings.centerRoomListOnClick)
if (fromClick && ! window.settings.RoomList.click_centers)
keepListCentered = false
currentIndex = index
if (fromClick && ! window.settings.centerRoomListOnClick)
if (fromClick && ! window.settings.RoomList.click_centers)
keepListCentered = true
}
@@ -245,54 +245,53 @@ HListView {
}
HShortcut {
sequences: window.settings.keys.goToPreviousRoom
sequences: window.settings.Keys.Rooms.previous
onActivated: { decrementCurrentIndex(); showItemLimiter.restart() }
}
HShortcut {
sequences: window.settings.keys.goToNextRoom
sequences: window.settings.Keys.Rooms.next
onActivated: { incrementCurrentIndex(); showItemLimiter.restart() }
}
HShortcut {
sequences: window.settings.keys.goToPreviousUnreadRoom
sequences: window.settings.Keys.Rooms.previous_unread
onActivated: { cycleUnreadRooms(false) && showItemLimiter.restart() }
}
HShortcut {
sequences: window.settings.keys.goToNextUnreadRoom
sequences: window.settings.Keys.Rooms.next_unread
onActivated: { cycleUnreadRooms(true) && showItemLimiter.restart() }
}
HShortcut {
sequences: window.settings.keys.goToPreviousMentionedRoom
sequences: window.settings.Keys.Rooms.previous_urgent
onActivated: cycleUnreadRooms(false, true) && showItemLimiter.restart()
}
HShortcut {
sequences: window.settings.keys.goToNextMentionedRoom
sequences: window.settings.Keys.Rooms.next_urgent
onActivated: cycleUnreadRooms(true, true) && showItemLimiter.restart()
}
Repeater {
model: Object.keys(window.settings.keys.focusAccountAtIndex)
model: Object.keys(window.settings.Keys.Accounts.at_index)
Item {
HShortcut {
sequence: window.settings.keys.focusAccountAtIndex[modelData]
onActivated: goToAccountNumber(parseInt(modelData - 1, 10))
sequence: window.settings.Keys.Accounts.at_index[modelData]
onActivated: goToAccountNumber(parseInt(modelData, 10) - 1)
}
}
}
Repeater {
model: Object.keys(window.settings.keys.focusRoomAtIndex)
model: Object.keys(window.settings.Keys.Rooms.at_index)
Item {
HShortcut {
sequence: window.settings.keys.focusRoomAtIndex[modelData]
onActivated:
showAccountRoomAtIndex(parseInt(modelData - 1, 10))
sequence: window.settings.Keys.Rooms.at_index[modelData]
onActivated: showAccountRoomAtIndex(parseInt(modelData,10) - 1)
}
}
}

View File

@@ -44,7 +44,7 @@ HLoader {
}
window.uiState.pageProperties = properties
window.uiStateChanged()
window.saveUIState()
}
function showRoom(userId, roomId) {
@@ -92,7 +92,7 @@ HLoader {
}
HShortcut {
sequences: window.settings.keys.goToLastPage
sequences: window.settings.Keys.last_page
onActivated: showPrevious()
}
}

View File

@@ -34,8 +34,10 @@ HFlickableColumnPage {
}
if (aliasFieldItem.changed) {
window.settings.writeAliases[userId] = aliasFieldItem.text
window.settingsChanged()
window.settings.Chat.Composer.aliases[userId] =
aliasFieldItem.text
window.saveSettings()
}
if (avatar.changed) {
@@ -249,7 +251,7 @@ HFlickableColumnPage {
HLabeledItem {
id: aliasField
readonly property var aliases: window.settings.writeAliases
readonly property var aliases: window.settings.Chat.Composer.aliases
readonly property string currentAlias: aliases[userId] || ""
readonly property bool hasWhiteSpace: /\s/.test(item.text)

View File

@@ -164,12 +164,12 @@ HColumnPage {
Keys.onMenuPressed: Keys.onEnterPressed(event)
HShortcut {
sequences: window.settings.keys.refreshDevices
sequences: window.settings.Keys.Sessions.refresh
onActivated: refreshButton.clicked()
}
HShortcut {
sequences: window.settings.keys.signOutCheckedOrAllDevices
sequences: window.settings.Keys.Sessions.sign_out_checked_or_all
onActivated: signOutCheckedButton.clicked()
}

View File

@@ -51,7 +51,7 @@ Item {
onReadyChanged: longLoading = false
HShortcut {
sequences: window.settings.keys.leaveRoom
sequences: window.settings.Keys.Chat.leave
active: userInfo && userInfo.presence !== "offline"
onActivated: window.makePopup(
"Popups/LeaveRoomPopup.qml",
@@ -60,7 +60,7 @@ Item {
}
HShortcut {
sequences: window.settings.keys.forgetRoom
sequences: window.settings.Keys.Chat.forget
active: userInfo && userInfo.presence !== "offline"
onActivated: window.makePopup(
"Popups/ForgetRoomPopup.qml",

View File

@@ -21,7 +21,7 @@ HTextArea {
readonly property var usableAliases: {
const obj = {}
const aliases = window.settings.writeAliases
const aliases = window.settings.Chat.Composer.aliases
// Get accounts that are members of this room with permission to talk
for (const [id, alias] of Object.entries(aliases)) {

View File

@@ -21,7 +21,7 @@ HButton {
onClicked: sendFilePicker.dialog.open()
HShortcut {
sequences: window.settings.keys.sendFileFromPathInClipboard
sequences: window.settings.Keys.Chat.send_clipboard_path
onActivated: window.makePopup(
"Popups/ConfirmUploadPopup.qml",
{
@@ -43,7 +43,7 @@ HButton {
onReplied: chat.clearReplyTo()
HShortcut {
sequences: window.settings.keys.sendFile
sequences: window.settings.Keys.Chat.send_file
onActivated: sendFilePicker.dialog.open()
}
}

View File

@@ -14,7 +14,7 @@ Rectangle {
(chat.roomPane.collapse || chat.roomPane.forceCollapse)
readonly property bool center:
showLeftButton || window.settings.alwaysCenterRoomHeader
showLeftButton || window.settings.Chat.always_center_header
implicitHeight: theme.baseElementsHeight

View File

@@ -139,7 +139,9 @@ HColumnLayout {
stackView.currentItem.currentIndex = -1
roomPane.toggleFocus()
if (window.settings.clearMemberFilterOnEscape) text = ""
if (window.settings.RoomList.escape_clears_filter)
text = ""
}
Behavior on opacity { HNumberAnimation {} }
@@ -174,7 +176,7 @@ HColumnLayout {
Layout.preferredHeight: filterField.implicitHeight
HShortcut {
sequences: window.settings.keys.inviteToRoom
sequences: window.settings.Keys.Chat.invite
onActivated:
if (inviteButton.enabled) inviteButton.clicked()
}

View File

@@ -105,12 +105,12 @@ MultiviewPane {
}
HShortcut {
sequences: window.settings.keys.toggleFocusRoomPane
sequences: window.settings.Keys.Chat.focus_room_pane
onActivated: roomPane.toggleFocus()
}
HShortcut {
sequences: window.settings.keys.toggleHideRoomPane
sequences: window.settings.Keys.Chat.hide_room_pane
onActivated: roomPane.forceCollapse = ! roomPane.forceCollapse
}
}

View File

@@ -75,11 +75,11 @@ HRowLayout {
readonly property int maxMessageWidth:
contentText.includes("<pre>") || contentText.includes("<table>") ?
-1 :
window.settings.maxMessageCharactersPerLine < 0 ?
window.settings.Chat.max_messages_line_length < 0 ?
-1 :
Math.ceil(
mainUI.fontMetrics.averageCharacterWidth *
window.settings.maxMessageCharactersPerLine
window.settings.Chat.max_messages_line_length
)
readonly property alias selectedText: contentLabel.selectedPlainText

View File

@@ -17,7 +17,7 @@ HColumnLayout {
readonly property var nextModel: eventList.model.get(model.index - 1)
readonly property QtObject currentModel: model
readonly property bool compact: window.settings.compactMode
readonly property bool compact: window.settings.General.compact
readonly property bool checked: model.id in eventList.checked
readonly property bool isOwn: chat.userId === model.sender_id
readonly property bool isRedacted: model.event_type === "RedactedEvent"

View File

@@ -17,7 +17,12 @@ HTile {
width: Math.min(
eventDelegate.width,
eventContent.maxMessageWidth,
Math.max(theme.chat.message.fileMinWidth, implicitWidth),
Math.max(
window.settings.Chat.Files.min_file_width *
window.settings.General.zoom,
implicitWidth,
),
)
height: Math.max(theme.chat.message.avatarSize, implicitHeight)

View File

@@ -10,13 +10,16 @@ HMxcImage {
property EventMediaLoader loader
readonly property real zoom: window.settings.General.zoom
readonly property real maxHeight:
eventList.height * theme.chat.message.thumbnailMaxHeightRatio
eventList.height *
window.settings.Chat.Files.max_thumbnail_height_ratio * zoom
readonly property size fitSize: utils.fitSize(
// Minimum display size
theme.chat.message.thumbnailMinSize.width,
theme.chat.message.thumbnailMinSize.height,
window.settings.Chat.Files.min_thumbnail_size[0] * zoom,
window.settings.Chat.Files.min_thumbnail_size[1] * zoom,
// Real size
(
@@ -35,12 +38,18 @@ HMxcImage {
// Maximum display size
Math.min(
Math.max(maxHeight, theme.chat.message.thumbnailMinSize.width),
Math.max(
maxHeight,
window.settings.Chat.Files.min_thumbnail_size[0] * zoom,
),
pureMedia ? Infinity : eventContent.maxMessageWidth,
eventDelegate.width - eventContent.spacing - avatarWrapper.width -
eventContent.spacing * 2, // padding
),
Math.max(maxHeight, theme.chat.message.thumbnailMinSize.height),
Math.max(
maxHeight,
window.settings.Chat.Files.min_thumbnail_size[1] * zoom,
),
)
readonly property bool hovered: hover.hovered
@@ -92,7 +101,7 @@ HMxcImage {
return
}
window.settings.media.openExternallyOnClick ?
window.settings.Chat.Files.click_opens_externally ?
image.openExternally() :
image.openInternally()
}
@@ -103,7 +112,7 @@ HMxcImage {
acceptedModifiers: Qt.NoModifier
gesturePolicy: TapHandler.ReleaseWithinBounds
onTapped:
window.settings.media.openExternallyOnClick ?
window.settings.Chat.Files.click_opens_externally ?
image.openInternally() :
image.openExternally()
}

View File

@@ -21,7 +21,7 @@ Rectangle {
color: theme.chat.eventList.background
HShortcut {
sequences: window.settings.keys.unfocusOrDeselectAllMessages
sequences: window.settings.Keys.Messages.unfocus_or_deselect
onActivated: {
eventList.selectedCount ?
eventList.checked = {} :
@@ -30,24 +30,24 @@ Rectangle {
}
HShortcut {
sequences: window.settings.keys.focusPreviousMessage
sequences: window.settings.Keys.Messages.previous
onActivated: eventList.focusPreviousMessage()
}
HShortcut {
sequences: window.settings.keys.focusNextMessage
sequences: window.settings.Keys.Messages.next
onActivated: eventList.focusNextMessage()
}
HShortcut {
active: eventList.currentItem
sequences: window.settings.keys.toggleSelectMessage
sequences: window.settings.Keys.Messages.select
onActivated: eventList.toggleCheck(eventList.currentIndex)
}
HShortcut {
active: eventList.currentItem
sequences: window.settings.keys.selectMessagesUntilHere
sequences: window.settings.Keys.Messages.select_until_here
onActivated:
eventList.checkFromLastToHere(eventList.currentIndex)
}
@@ -75,7 +75,7 @@ Rectangle {
}
enabled: (events && events.length > 0) || events === null
sequences: window.settings.keys.removeFocusedOrSelectedMessages
sequences: window.settings.Keys.Messages.remove
onActivated: window.makePopup(
"Popups/RedactPopup.qml",
{
@@ -98,7 +98,7 @@ Rectangle {
}
HShortcut {
sequences: window.settings.keys.replyToFocusedOrLastMessage
sequences: window.settings.Keys.Messages.reply
onActivated: {
let event = eventList.model.get(0)
@@ -132,7 +132,7 @@ Rectangle {
}
HShortcut {
sequences: window.settings.keys.openMessagesLinksOrFiles
sequences: window.settings.Keys.Messages.open_links_files
onActivated: {
const indice =
eventList.getFocusedOrSelectedOrLastMediaEvents(true)
@@ -158,7 +158,7 @@ Rectangle {
}
HShortcut {
sequences: window.settings.keys.openMessagesLinksOrFilesExternally
sequences: window.settings.Keys.Messages.open_links_files_externally
onActivated: {
const indice =
eventList.getFocusedOrSelectedOrLastMediaEvents(true)
@@ -178,7 +178,7 @@ Rectangle {
}
HShortcut {
sequences: window.settings.keys.copyFilesLocalPath
sequences: window.settings.Keys.Messages.copy_files_path
onActivated: {
const paths = []
const indice =
@@ -199,14 +199,14 @@ Rectangle {
HShortcut {
active: eventList.currentItem
sequences: window.settings.keys.debugFocusedMessage
sequences: window.settings.Keys.Messages.debug
onActivated: mainUI.debugConsole.toggle(
eventList.currentItem.eventContent, "t.parent.json()",
)
}
HShortcut {
sequences: window.settings.keys.clearRoomMessages
sequences: window.settings.Keys.Messages.clear_all
onActivated: window.makePopup(
"Popups/ClearMessagesPopup.qml",
{
@@ -231,9 +231,10 @@ Rectangle {
property bool moreToLoad: true
property bool ownEventsOnLeft:
window.settings.ownMessagesOnLeftAboveWidth < 0 ?
window.settings.Chat.own_messages_on_left_above < 0 ?
false :
width > window.settings.ownMessagesOnLeftAboveWidth * theme.uiScale
width >
window.settings.Chat.own_messages_on_left_above * theme.uiScale
property string delegateWithSelectedText: ""
property string selectedText: ""
@@ -616,7 +617,7 @@ Rectangle {
}
Timer {
interval: Math.max(100, window.settings.markRoomReadMsecDelay)
interval: Math.max(100, window.settings.Chat.mark_read_delay * 1000)
running:
! eventList.updateMarkerFutureId &&

View File

@@ -123,7 +123,7 @@ HPopup {
Timer {
id: autoHideTimer
interval: window.settings.media.autoHideOSDAfterMsec
interval: window.settings.Chat.Files.autohide_image_controls_after
}
ViewerInfo {

View File

@@ -29,7 +29,7 @@ HFlow {
visible: viewer.isAnimated
HPopupShortcut {
sequences: window.settings.keys.imageViewer.pause
sequences: window.settings.Keys.ImageViewer.pause
onActivated: pause.clicked()
}
}
@@ -46,7 +46,7 @@ HFlow {
visible: viewer.isAnimated
HPopupShortcut {
sequences: window.settings.keys.imageViewer.previousSpeed
sequences: window.settings.Keys.ImageViewer.slow_down
onActivated: viewer.imagesSpeed = viewer.availableSpeeds[Math.min(
viewer.availableSpeeds.indexOf(viewer.imagesSpeed) + 1,
viewer.availableSpeeds.length - 1,
@@ -54,14 +54,14 @@ HFlow {
}
HPopupShortcut {
sequences: window.settings.keys.imageViewer.nextSpeed
sequences: window.settings.Keys.ImageViewer.speed_up
onActivated: viewer.imagesSpeed = viewer.availableSpeeds[Math.max(
viewer.availableSpeeds.indexOf(viewer.imagesSpeed) - 1, 0,
)]
}
HPopupShortcut {
sequences: window.settings.keys.imageViewer.resetSpeed
sequences: window.settings.Keys.ImageViewer.reset_speed
onActivated: viewer.imagesSpeed = 1
}
}
@@ -77,7 +77,7 @@ HFlow {
onPressed: viewer.animatedRotationTarget -= 45
HPopupShortcut {
sequences: window.settings.keys.imageViewer.rotateLeft
sequences: window.settings.Keys.ImageViewer.rotate_left
onActivated: viewer.animatedRotationTarget -= 45
}
}
@@ -93,13 +93,13 @@ HFlow {
onPressed: viewer.animatedRotationTarget += 45
HPopupShortcut {
sequences: window.settings.keys.imageViewer.rotateRight
sequences: window.settings.Keys.ImageViewer.rotate_right
onActivated: viewer.animatedRotationTarget += 45
}
}
HPopupShortcut {
sequences: window.settings.keys.imageViewer.rotateReset
sequences: window.settings.Keys.ImageViewer.reset_rotation
onActivated: viewer.animatedRotationTarget = 0
}
@@ -116,7 +116,7 @@ HFlow {
onClicked: viewer.alternateScaling = ! viewer.alternateScaling
HPopupShortcut {
sequences: window.settings.keys.imageViewer.expand
sequences: window.settings.Keys.ImageViewer.expand
onActivated: expand.clicked()
}
}
@@ -131,7 +131,7 @@ HFlow {
visible: Qt.application.supportsMultipleWindows
HPopupShortcut {
sequences: window.settings.keys.imageViewer.fullScreen
sequences: window.settings.Keys.ImageViewer.fullscreen
onActivated: fullScreen.clicked()
}
}
@@ -144,7 +144,7 @@ HFlow {
onClicked: viewer.close()
HPopupShortcut {
sequences: window.settings.keys.imageViewer.close
sequences: window.settings.Keys.ImageViewer.close
onActivated: close.clicked()
}
}

View File

@@ -53,37 +53,37 @@ HFlickable {
}
HPopupShortcut {
sequences: window.settings.keys.imageViewer.panLeft
sequences: window.settings.Keys.ImageViewer.pan_left
onActivated: utils.flickPages(flickable, -0.2, true, 5)
}
HPopupShortcut {
sequences: window.settings.keys.imageViewer.panRight
sequences: window.settings.Keys.ImageViewer.pan_right
onActivated: utils.flickPages(flickable, 0.2, true, 5)
}
HPopupShortcut {
sequences: window.settings.keys.imageViewer.panUp
sequences: window.settings.Keys.ImageViewer.pan_up
onActivated: utils.flickPages(flickable, -0.2, false, 5)
}
HPopupShortcut {
sequences: window.settings.keys.imageViewer.panDown
sequences: window.settings.Keys.ImageViewer.pan_down
onActivated: utils.flickPages(flickable, 0.2, false, 5)
}
HPopupShortcut {
sequences: window.settings.keys.imageViewer.zoomOut
sequences: window.settings.Keys.ImageViewer.zoom_out
onActivated: thumbnail.scale = Math.max(0.1, thumbnail.scale - 0.2)
}
HPopupShortcut {
sequences: window.settings.keys.imageViewer.zoomIn
sequences: window.settings.Keys.ImageViewer.zoom_in
onActivated: thumbnail.scale = Math.min(10, thumbnail.scale + 0.2)
}
HPopupShortcut {
sequences: window.settings.keys.imageViewer.zoomReset
sequences: window.settings.Keys.ImageViewer.reset_zoom
onActivated: resetScaleAnimation.start()
}

View File

@@ -28,8 +28,8 @@ QtObject {
const msec =
highImportance ?
window.settings.alertOnMentionForMsec :
window.settings.alertOnMessageForMsec
window.settings.Notifications.urgent_alert_time * 1000 :
window.settings.Notifications.alert_time * 1000
if (msec) window.alert(msec === -1 ? 0 : msec) // -1 → 0 = no time out
}

View File

@@ -13,37 +13,37 @@ HQtObject {
HShortcut {
active: root.active
sequences: window.settings.keys.scrollUp
sequences: window.settings.Keys.Scrolling.up
onActivated: utils.flickPages(flickable, -1 / 10)
}
HShortcut {
active: root.active
sequences: window.settings.keys.scrollDown
sequences: window.settings.Keys.Scrolling.down
onActivated: utils.flickPages(flickable, 1 / 10)
}
HShortcut {
active: root.active
sequences: window.settings.keys.scrollPageUp
sequences: window.settings.Keys.Scrolling.page_up
onActivated: utils.flickPages(flickable, -1)
}
HShortcut {
active: root.active
sequences: window.settings.keys.scrollPageDown
sequences: window.settings.Keys.Scrolling.page_down
onActivated: utils.flickPages(flickable, 1)
}
HShortcut {
active: root.active
sequences: window.settings.keys.scrollToTop
sequences: window.settings.Keys.Scrolling.top
onActivated: utils.flickToTop(flickable)
}
HShortcut {
active: root.active
sequences: window.settings.keys.scrollToBottom
sequences: window.settings.Keys.Scrolling.bottom
onActivated: utils.flickToBottom(flickable)
}
}

View File

@@ -13,7 +13,7 @@ HQtObject {
HShortcut {
active: root.active
sequences: window.settings.keys.previousTab
sequences: window.settings.Keys.previous_tab
onActivated: container.setCurrentIndex(
utils.numberWrapAt(container.currentIndex - 1, container.count),
)
@@ -21,7 +21,7 @@ HQtObject {
HShortcut {
active: root.active
sequences: window.settings.keys.nextTab
sequences: window.settings.Keys.next_tab
onActivated: container.setCurrentIndex(
utils.numberWrapAt(container.currentIndex + 1, container.count),
)

View File

@@ -36,39 +36,41 @@ Item {
Component.onCompleted: window.mainUI = mainUI
HShortcut {
sequences: window.settings.keys.startPythonDebugger
sequences: window.settings.Keys.python_debugger
onActivated: py.call("BRIDGE.pdb")
}
HShortcut {
sequences: window.settings.keys.zoomIn
sequences: window.settings.Keys.zoom_in
onActivated: {
window.settings.zoom += 0.1
window.settingsChanged()
window.settings.General.zoom += 0.1
window.saveSettings()
}
}
HShortcut {
sequences: window.settings.keys.zoomOut
sequences: window.settings.Keys.zoom_out
onActivated: {
window.settings.zoom = Math.max(0.1, window.settings.zoom - 0.1)
window.settingsChanged()
window.settings.General.zoom =
Math.max(0.1, window.settings.General.zoom - 0.1)
window.saveSettings()
}
}
HShortcut {
sequences: window.settings.keys.zoomReset
sequences: window.settings.Keys.reset_zoom
onActivated: {
window.settings.zoom = 1
window.settingsChanged()
window.settings.General.zoom = 1
window.saveSettings()
}
}
HShortcut {
sequences: window.settings.keys.toggleCompactMode
sequences: window.settings.Keys.compact
onActivated: {
settings.compactMode = ! settings.compactMode
settingsChanged()
window.settings.General.compact = ! window.settings.General.compact
windowsaveSettings()
}
}

View File

@@ -36,6 +36,20 @@ ApplicationWindow {
readonly property bool anyPopup: Object.keys(visiblePopups).length > 0
readonly property bool anyPopupOrMenu: anyMenu || anyPopup
function saveSettings() {
settingsChanged()
py.saveConfig("settings", settings)
}
function saveUIState() {
uiStateChanged()
py.saveConfig("ui_state", uiState)
}
function saveHistory() {
historyChanged()
py.saveConfig("history", history)
}
function saveState(obj) {
if (! obj.saveName || ! obj.saveProperties ||
@@ -51,7 +65,7 @@ ApplicationWindow {
[obj.saveName]: { [obj.saveId || "ALL"]: propertyValues },
})
uiStateChanged()
saveUIState()
}
function getState(obj, property, defaultValue=undefined) {
@@ -86,15 +100,9 @@ ApplicationWindow {
visible: true
color: "transparent"
// NOTE: For JS object variables, the corresponding method to notify
// key/value changes must be called manually, e.g. settingsChanged().
onSettingsChanged: py.saveConfig("settings", settings)
onUiStateChanged: py.saveConfig("ui_state", uiState)
onHistoryChanged: py.saveConfig("history", history)
onClosing: {
close.accepted = ! settings.closeMinimizesToTray
settings.closeMinimizesToTray ? hide() : Qt.quit()
close.accepted = ! settings.General.close_to_tray
settings.General.close_to_tray ? hide() : Qt.quit()
}
PythonRootBridge { id: py }