Skip to content

Commit

Permalink
Replace keyword buttons with a combo box
Browse files Browse the repository at this point in the history
This reduces horizontal space and makes room for more keywords.
Also add some additional keywords.

As suggested here:
https://forum.shotcut.org/t/text-simple/12888/4
  • Loading branch information
bmatherly committed Aug 9, 2023
1 parent dd79560 commit cf73a0a
Showing 1 changed file with 58 additions and 19 deletions.
77 changes: 58 additions & 19 deletions src/qml/filters/dynamictext/ui.qml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ Item {
if (filter.animateOut > 0)
filter.set(textFilterUi.endValue, filter.getRect(textFilterUi.rectProperty, filter.duration - 1));
}
insertCombo.currentIndex = -1;
filter.blockSignals = false;
setControls();
if (filter.isNew)
Expand Down Expand Up @@ -261,30 +262,68 @@ Item {
Layout.alignment: Qt.AlignRight
}

RowLayout {
Shotcut.Button {
text: qsTr('# (Hash sign)')
onClicked: textArea.insert(textArea.cursorPosition, '\\#')
}
Shotcut.ComboBox {
id: insertCombo

Shotcut.Button {
text: qsTr('Timecode')
onClicked: textArea.insert(textArea.cursorPosition, '#timecode#')
implicitWidth: 180
textRole: 'text'
onActivated: {
if (currentIndex >= 0) {
textArea.insert(textArea.cursorPosition, insertModel.get(currentIndex).value);
}
insertCombo.currentIndex = -1;
}

Shotcut.Button {
text: qsTr('Frame #', 'Frame number')
onClicked: textArea.insert(textArea.cursorPosition, '#frame#')
}
model: ListModel {
id: insertModel

Shotcut.Button {
text: qsTr('File date')
onClicked: textArea.insert(textArea.cursorPosition, '#localfiledate#')
}
ListElement {
}

ListElement {
text: qsTr('# (Hash sign)')
value: '\\#'
}

ListElement {
text: qsTr('Timecode (drop frame)')
value: '#timecode#'
}

ListElement {
text: qsTr('Timecode (non-drop frame)')
value: '#smpte_ndf#'
}

Shotcut.Button {
text: qsTr('File name')
onClicked: textArea.insert(textArea.cursorPosition, '#resource#')
ListElement {
text: qsTr('Frame #', 'Frame number')
value: '#frame#'
}

ListElement {
text: qsTr('File date')
value: '#localfiledate#'
}

ListElement {
text: qsTr('Creation date')
value: '#createdate#'
}

ListElement {
text: qsTr('File name and path')
value: '#resource#'
}

ListElement {
text: qsTr('File name')
value: '#filename#'
}

ListElement {
text: qsTr('File base name')
value: '#basename#'
}
}
}

Expand Down

0 comments on commit cf73a0a

Please sign in to comment.