Commit 994afbbd authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Correctly disable subtitle widget buttons when no subtitle is selected, add button tooltips

parent be2e8a1a
Pipeline #47906 passed with stage
in 10 minutes and 36 seconds
......@@ -79,9 +79,8 @@ SubtitleEdit::SubtitleEdit(QWidget *parent)
m_position = new TimecodeDisplay(pCore->timecode(), this);
m_endPosition = new TimecodeDisplay(pCore->timecode(), this);
m_duration = new TimecodeDisplay(pCore->timecode(), this);
m_position->setEnabled(false);
m_endPosition->setEnabled(false);
m_duration->setEnabled(false);
frame_position->setEnabled(false);
buttonDelete->setEnabled(false);
position_box->addWidget(m_position);
auto *spacer = new QSpacerItem(1, 1, QSizePolicy::MinimumExpanding, QSizePolicy::Maximum);
......@@ -144,6 +143,12 @@ SubtitleEdit::SubtitleEdit(QWidget *parent)
connect(buttonDelete, &QToolButton::clicked, [this]() {
pCore->triggerAction(QStringLiteral("delete_timeline_clip"));
});
buttonNext->setToolTip(i18n("Go to next subtitle"));
buttonPrev->setToolTip(i18n("Go to previous subtitle"));
buttonAdd->setToolTip(i18n("Add subtitle"));
buttonCut->setToolTip(i18n("Split subtitle at cursor position"));
buttonApply->setToolTip(i18n("Update subtitle text"));
buttonDelete->setToolTip(i18n("Delete subtitle"));
}
void SubtitleEdit::setModel(std::shared_ptr<SubtitleModel> model)
......@@ -184,9 +189,8 @@ void SubtitleEdit::setActiveSubtitle(int id)
if (m_model && id > -1) {
subText->setEnabled(true);
QSignalBlocker bk(subText);
m_position->setEnabled(true);
m_endPosition->setEnabled(true);
m_duration->setEnabled(true);
frame_position->setEnabled(true);
buttonDelete->setEnabled(true);
/*QSignalBlocker bk2(m_position);
QSignalBlocker bk3(m_endPosition);
QSignalBlocker bk4(m_duration);*/
......@@ -199,9 +203,8 @@ void SubtitleEdit::setActiveSubtitle(int id)
m_duration->setValue(duration);
} else {
subText->setEnabled(false);
m_position->setEnabled(false);
m_endPosition->setEnabled(false);
m_duration->setEnabled(false);
frame_position->setEnabled(false);
buttonDelete->setEnabled(false);
QSignalBlocker bk(subText);
subText->clear();
}
......
......@@ -6,19 +6,12 @@
<rect>
<x>0</x>
<y>0</y>
<width>321</width>
<height>267</height>
<width>392</width>
<height>366</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="3" column="0">
<widget class="QLabel" name="duration_label_2">
<property name="text">
<string>Duration</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="3">
<layout class="QGridLayout" name="gridLayout_2">
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QToolButton" name="buttonPrev">
......@@ -63,24 +56,7 @@
</item>
</layout>
</item>
<item row="4" column="4">
<widget class="QToolButton" name="buttonDelete">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="2" column="2" colspan="3">
<layout class="QHBoxLayout" name="end_box"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="duration_label">
<property name="text">
<string>End</string>
</property>
</widget>
</item>
<item row="4" column="3">
<item row="2" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
......@@ -93,59 +69,107 @@
</property>
</spacer>
</item>
<item row="1" column="2" colspan="3">
<layout class="QHBoxLayout" name="position_box"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="position_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Position</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QToolButton" name="buttonIn">
<item row="2" column="2">
<widget class="QToolButton" name="buttonDelete">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QToolButton" name="buttonOut">
<property name="text">
<string>...</string>
<item row="1" column="0" colspan="3">
<widget class="QFrame" name="frame_position">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="1">
<widget class="QToolButton" name="buttonIn">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="1" column="2">
<layout class="QHBoxLayout" name="end_box"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="duration_label_2">
<property name="text">
<string>Duration</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="duration_label">
<property name="text">
<string>End</string>
</property>
</widget>
</item>
<item row="2" column="2">
<layout class="QHBoxLayout" name="duration_box"/>
</item>
<item row="2" column="1">
<widget class="QToolButton" name="buttonLock">
<property name="text">
<string>...</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QToolButton" name="buttonOut">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="0" column="2">
<layout class="QHBoxLayout" name="position_box"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="position_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Position</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="0" colspan="5">
<item row="0" column="0" colspan="3">
<widget class="QPlainTextEdit" name="subText">
<property name="tabChangesFocus">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QToolButton" name="buttonLock">
<property name="text">
<string>...</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="2" colspan="3">
<layout class="QHBoxLayout" name="duration_box"/>
</item>
</layout>
</widget>
<resources/>
......
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