Added options for monospaced font and capital X in checkboxes

This commit is contained in:
Scharel Clemens 2018-12-04 11:44:06 +01:00
parent 1396633e34
commit 30947fb251
5 changed files with 46 additions and 30 deletions

View file

@ -17,6 +17,8 @@ ApplicationWindow
property int previewLineCount: value("previewLineCount", 4) property int previewLineCount: value("previewLineCount", 4)
property string sortBy: value("sortBy", "date") property string sortBy: value("sortBy", "date")
property bool showSeparator: value("showSeparator", false) property bool showSeparator: value("showSeparator", false)
property bool useMonoFont: value("useMonoFont", false)
property bool useCapitalX: value("useCapitalX", false)
} }
ConfigurationValue { ConfigurationValue {

View file

@ -51,6 +51,7 @@ Dialog {
width: parent.width width: parent.width
focus: true focus: true
text: note.content text: note.content
font.family: appSettings.useMonoFont ? "DejaVu Sans Mono" : Theme.fontFamily // "Courier"
property int preTextLength: 0 property int preTextLength: 0
property var listPrefixes: ["- ", "* ", "+ ", "- [ ] ", "- [x] ", "- [X] "] property var listPrefixes: ["- ", "* ", "+ ", "- [ ] ", "- [x] ", "- [X] "]
onTextChanged: { onTextChanged: {

View file

@ -35,9 +35,6 @@ Dialog {
function parseContent() { function parseContent() {
note = account.getNote(note.id, false) note = account.getNote(note.id, false)
//modifiedDetail.value = new Date(note.modified * 1000).toLocaleString(Qt.locale(), Locale.ShortFormat)
//favoriteDetail.value = note.favorite ? qsTr("yes") : qsTr("no")
//categoryDetail.value = note.category
var convertedText = converter.makeHtml(note.content) var convertedText = converter.makeHtml(note.content)
var occurence = -1 var occurence = -1
convertedText = convertedText.replace(/^<li>\[ \] (.*)<\/li>$/gm, convertedText = convertedText.replace(/^<li>\[ \] (.*)<\/li>$/gm,
@ -73,13 +70,11 @@ Dialog {
MenuItem { MenuItem {
text: qsTr("Delete") text: qsTr("Delete")
enabled: account ? true : false enabled: account ? true : false
//visible: appSettings.currentAccount >= 0
onClicked: remorse.execute("Deleting", function() { account.deleteNote(notey.id) } ) onClicked: remorse.execute("Deleting", function() { account.deleteNote(notey.id) } )
} }
MenuItem { MenuItem {
text: enabled ? qsTr("Reload") : qsTr("Updating...") text: enabled ? qsTr("Reload") : qsTr("Updating...")
enabled: account ? !account.busy : false enabled: account ? !account.busy : false
//visible: appSettings.currentAccount >= 0
onClicked: account.getNote(note.id) onClicked: account.getNote(note.id)
} }
MenuLabel { MenuLabel {
@ -117,7 +112,7 @@ Dialog {
function(match, p1, offset, string) { function(match, p1, offset, string) {
occurence++ occurence++
if (occurence === parseInt(link.split('_')[1])) { if (occurence === parseInt(link.split('_')[1])) {
return '- [x] ' + p1 } return (appSettings.useCapitalX ? '- [X] ' : '- [x] ') + p1 }
else { return match } else { return match }
} ) } )
note.content = newContent note.content = newContent

View file

@ -95,6 +95,34 @@ Page {
} }
} }
SectionHeader {
text: qsTr("Synchronization")
}
ComboBox {
id: autoSyncComboBox
label: qsTr("Auto-Sync")
description: qsTr("Periodically pull notes from the server")
menu: ContextMenu {
Repeater {
id: autoSyncIntervalRepeater
model: [0, 3, 5, 10, 20, 30, 60, 120, 300, 600]
MenuItem {
text: modelData === 0 ?
qsTr("Disabled") : (qsTr("every") + " " +
(parseInt(modelData / 60) ?
(parseInt(modelData / 60) + " " + qsTr("Minutes")) :
(modelData + " " + qsTr("Seconds"))))
Component.onCompleted: {
if (modelData === appSettings.autoSyncInterval) {
autoSyncComboBox.currentIndex = index
}
}
}
}
}
onCurrentIndexChanged: appSettings.autoSyncInterval = autoSyncIntervalRepeater.model[currentIndex]
}
SectionHeader { SectionHeader {
text: qsTr("Appearance") text: qsTr("Appearance")
} }
@ -140,31 +168,19 @@ Page {
} }
SectionHeader { SectionHeader {
text: qsTr("Synchronization") text: qsTr("Editing")
} }
ComboBox { TextSwitch {
id: autoSyncComboBox text: qsTr("Use monospaced font")
label: qsTr("Auto-Sync") description: qsTr("Use a monospeced font to edit a note")
description: qsTr("Periodically pull notes from the server") checked: appSettings.useMonoFont
menu: ContextMenu { onCheckedChanged: appSettings.useMonoFont = checked
Repeater { }
id: autoSyncIntervalRepeater TextSwitch {
model: [0, 3, 5, 10, 20, 30, 60, 120, 300, 600] text: qsTr("Use capital 'X' in checkboxes")
MenuItem { description: qsTr("For compatibility with other apps such as Joplin")
text: modelData === 0 ? checked: appSettings.useCapitalX
qsTr("Disabled") : (qsTr("every") + " " + onCheckedChanged: appSettings.useCapitalX = checked
(parseInt(modelData / 60) ?
(parseInt(modelData / 60) + " " + qsTr("Minutes")) :
(modelData + " " + qsTr("Seconds"))))
Component.onCompleted: {
if (modelData === appSettings.autoSyncInterval) {
autoSyncComboBox.currentIndex = index
}
}
}
}
}
onCurrentIndexChanged: appSettings.autoSyncInterval = autoSyncIntervalRepeater.model[currentIndex]
} }
} }

View file

@ -14,6 +14,8 @@
* Tue Dec 04 2018 Scharel Clemens <harbour-nextcloudnotes@scharel.name> 0.1-6 * Tue Dec 04 2018 Scharel Clemens <harbour-nextcloudnotes@scharel.name> 0.1-6
- Bugfix: Adding notes is possible again - Bugfix: Adding notes is possible again
- Added: Option for monospaced font
- Added: Option for capital X in checkboxes
* Tue Dec 04 2018 Scharel Clemens <harbour-nextcloudnotes@scharel.name> 0.1-5 * Tue Dec 04 2018 Scharel Clemens <harbour-nextcloudnotes@scharel.name> 0.1-5
- Implemented auto prepend for list elements - Implemented auto prepend for list elements