Commit 50388366 authored by Julius Künzel's avatar Julius Künzel
Browse files

Improvements on titler animation

- Use the word "viewport" to make clear that the red and green
rectangles represent the viewport and not the canvas position in the
animation

- Fix an issue where the font size of the labels was not refreshed

- Centralize some code

Related to #699
parent 3ce0ef18
Pipeline #83176 passed with stage
in 8 minutes and 25 seconds
......@@ -972,9 +972,9 @@ void TitleWidget::initAnimation()
graphicsView->scene()->addItem(m_endViewport);
connect(keep_aspect, &QAbstractButton::toggled, this, &TitleWidget::slotKeepAspect);
connect(resize50, &QAbstractButton::clicked, this, &TitleWidget::slotResize50);
connect(resize100, &QAbstractButton::clicked, this, &TitleWidget::slotResize100);
connect(resize200, &QAbstractButton::clicked, this, &TitleWidget::slotResize200);
connect(resize50, &QAbstractButton::clicked, this, [&](){ slotResize(50); });
connect(resize100, &QAbstractButton::clicked, this, [&](){ slotResize(100); });
connect(resize200, &QAbstractButton::clicked, this, [&](){ slotResize(200); });
}
void TitleWidget::slotUpdateZoom(int pos)
......@@ -2550,8 +2550,8 @@ void TitleWidget::slotAnimEnd(bool anim)
void TitleWidget::addAnimInfoText()
{
// add text to anim viewport
QGraphicsTextItem *t = new QGraphicsTextItem(i18nc("Indicates the start of an animation", "Start"), m_startViewport);
QGraphicsTextItem *t2 = new QGraphicsTextItem(i18nc("Indicates the end of an animation", "End"), m_endViewport);
QGraphicsTextItem *t = new QGraphicsTextItem(i18nc("Indicates the start of an animation", "Start Viewport"), m_startViewport);
QGraphicsTextItem *t2 = new QGraphicsTextItem(i18nc("Indicates the end of an animation", "End Viewport"), m_endViewport);
QFont font = t->font();
font.setPixelSize(int(m_startViewport->rect().width() / 10));
QColor col = m_startViewport->pen().color();
......@@ -2614,31 +2614,22 @@ void TitleWidget::slotKeepAspect(bool keep)
}
}
void TitleWidget::slotResize50()
void TitleWidget::slotResize(int percentSize)
{
if (int(m_endViewport->zValue()) == 1100) {
m_endViewport->setRect(0, 0, m_frameWidth / 2, m_frameHeight / 2);
} else {
m_startViewport->setRect(0, 0, m_frameWidth / 2, m_frameHeight / 2);
}
}
void TitleWidget::slotResize100()
{
if (int(m_endViewport->zValue()) == 1100) {
m_endViewport->setRect(0, 0, m_frameWidth, m_frameHeight);
int w, h;
if (percentSize < 100) {
w = m_frameWidth / (100 / percentSize);
h = m_frameHeight / (100 / percentSize);
} else {
m_startViewport->setRect(0, 0, m_frameWidth, m_frameHeight);
w = m_frameWidth * (percentSize / 100);
h = m_frameHeight * (percentSize / 100);
}
}
void TitleWidget::slotResize200()
{
if (int(m_endViewport->zValue()) == 1100) {
m_endViewport->setRect(0, 0, m_frameWidth * 2, m_frameHeight * 2);
m_endViewport->setRect(0, 0, w, h);
} else {
m_startViewport->setRect(0, 0, m_frameWidth * 2, m_frameHeight * 2);
m_startViewport->setRect(0, 0, w, h);
}
updateInfoText();
}
void TitleWidget::slotAddEffect(int /*ix*/)
......
......@@ -346,9 +346,7 @@ private slots:
void itemBottom();
void itemLeft();
void itemRight();
void slotResize50();
void slotResize100();
void slotResize200();
void slotResize(int percentSize);
/** @brief Show hide guides */
void showGuides(int state);
/** @brief Build guides */
......
......@@ -498,14 +498,14 @@
<property name="flat">
<bool>false</bool>
</property>
<property name="color">
<property name="color" stdset="0">
<color>
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</property>
<property name="defaultColor">
<property name="defaultColor" stdset="0">
<color>
<red>255</red>
<green>0</green>
......@@ -703,7 +703,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>367</width>
<width>388</width>
<height>542</height>
</rect>
</property>
......@@ -766,14 +766,14 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="color">
<property name="color" stdset="0">
<color alpha="100">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</property>
<property name="alphaChannelEnabled">
<property name="alphaChannelEnabled" stdset="0">
<bool>true</bool>
</property>
</widget>
......@@ -1054,7 +1054,7 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="color">
<property name="color" stdset="0">
<color>
<red>0</red>
<green>0</green>
......@@ -1074,14 +1074,14 @@
<property name="flat">
<bool>false</bool>
</property>
<property name="color">
<property name="color" stdset="0">
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</property>
<property name="defaultColor">
<property name="defaultColor" stdset="0">
<color>
<red>255</red>
<green>255</green>
......@@ -1256,14 +1256,14 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="color">
<property name="color" stdset="0">
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</property>
<property name="defaultColor">
<property name="defaultColor" stdset="0">
<color>
<red>0</red>
<green>0</green>
......@@ -1325,14 +1325,14 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="color">
<property name="color" stdset="0">
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</property>
<property name="defaultColor">
<property name="defaultColor" stdset="0">
<color>
<red>0</red>
<green>0</green>
......@@ -1444,14 +1444,14 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="color">
<property name="color" stdset="0">
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</property>
<property name="defaultColor">
<property name="defaultColor" stdset="0">
<color>
<red>0</red>
<green>0</green>
......@@ -1470,7 +1470,7 @@
<item row="0" column="0">
<widget class="QToolButton" name="anim_start">
<property name="text">
<string>Edit start</string>
<string>Edit start viewport</string>
</property>
<property name="checkable">
<bool>true</bool>
......@@ -1480,7 +1480,7 @@
<item row="0" column="1">
<widget class="QToolButton" name="anim_end">
<property name="text">
<string>Edit end</string>
<string>Edit end viewport</string>
</property>
<property name="checkable">
<bool>true</bool>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment