implemented font and fontsize in toolbar of songeditor

This commit is contained in:
Chris Cochrun 2022-04-22 16:42:07 -05:00
parent bc6f6b0606
commit eaa32c8b2b
4 changed files with 39 additions and 4 deletions

View file

@ -8,9 +8,12 @@
[[file:~/dev/church-presenter/src/qml/presenter/SongEditor.qml::Controls.ToolBar {]]
- [X] alignment
- [X] font
- [X] fontsize
- [X] font - Need to finish the UI portion of it
- [X] fontsize - Need to finish the UI portion of it
- [ ] effects?
For effects, I'm not 100% sure how to do this in an easy to build out way. Should I just do them the same as the other attributes or have effects be individually stored? Which effects to use?
I'm thinking shadows for sure for readability on slides. Also, maybe I should have an effect of like glow? But maybe I'll come back to this after more of the core system is finished.
** TODO bug in changing slides with the arrows
[[file:~/dev/church-presenter/src/qml/presenter/Presentation.qml::function changeSlide() {]]

View file

@ -15,16 +15,19 @@ Item {
property string videoBackground
property var hTextAlignment
property var vTextAlignment
property string font
property real fontSize
Presenter.Slide {
id: representation
anchors.fill: parent
textSize: width / 15
editMode: true
imageSource: imageBackground
videoSource: videoBackground
hTextAlignment: root.hTextAlignment
vTextAlignment: root.vTextAlignment
chosenFont: font
textSize: fontSize
preview: true
}

View file

@ -33,7 +33,7 @@ Item {
editable: true
hoverEnabled: true
flat: true
onCurrentTextChanged: showPassiveNotification(currentText)
onActivated: updateFont(currentText)
}
Controls.SpinBox {
id: fontSizeBox
@ -41,6 +41,7 @@ Item {
from: 5
to: 72
hoverEnabled: true
onValueModified: updateFontSize(value)
}
Controls.ComboBox {
id: hAlignmentBox
@ -290,6 +291,8 @@ Item {
changeSlideHAlignment(song.horizontalTextAlignment);
changeSlideVAlignment(song.verticalTextAlignment);
changeSlideFont(song.font, true);
changeSlideFontSize(song.fontSize, true)
print(song);
}
@ -336,6 +339,16 @@ Item {
songsqlmodel.updateVerticalTextAlignment(songIndex, textAlignment)
}
function updateFont(font) {
changeSlideFont(font, false);
songsqlmodel.updateFont(songIndex, font);
}
function updateFontSize(fontSize) {
changeSlideFontSize(fontSize, false);
songsqlmodel.updateFontSize(songIndex, fontSize);
}
function changeSlideHAlignment(alignment) {
switch (alignment) {
case "left" :
@ -373,4 +386,18 @@ Item {
break;
}
}
function changeSlideFont(font, updateBox) {
const fontIndex = fontBox.find(font);
print(fontIndex);
if (updateBox)
fontBox.currentIndex = fontIndex;
slideEditor.font = font;
}
function changeSlideFontSize(fontSize, updateBox) {
if (updateBox)
fontSizeBox.value = fontSize;
slideEditor.fontSize = fontSize;
}
}

View file

@ -99,6 +99,8 @@ QHash<int, QByteArray> SongSqlModel::roleNames() const
names[Qt::UserRole + 8] = "backgroundType";
names[Qt::UserRole + 9] = "horizontalTextAlignment";
names[Qt::UserRole + 10] = "verticalTextAlignment";
names[Qt::UserRole + 11] = "font";
names[Qt::UserRole + 12] = "fontSize";
return names;
}