Show document title at the top of line edit
It takes more space but just looks better.
This commit is contained in:
parent
82e8d28bdd
commit
976bcbb2e8
|
@ -284,15 +284,15 @@ void TagEditorWidget::updateDocumentTitleEdits()
|
||||||
const vector<string> &titles = container ? container->titles() : vector<string>();
|
const vector<string> &titles = container ? container->titles() : vector<string>();
|
||||||
|
|
||||||
// get layout
|
// get layout
|
||||||
QLayout *docTitleLayout = m_ui->docTitleWidget->layout();
|
QLayout *const docTitleLayout = m_ui->docTitleWidget->layout();
|
||||||
int lineEditCount = docTitleLayout->count() - 1;
|
int lineEditCount = docTitleLayout->count();
|
||||||
|
|
||||||
// update existing line edits, remove unneeded line edits
|
// update existing line edits, remove unneeded line edits
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (; i < lineEditCount; ++i) {
|
for (; i < lineEditCount; ++i) {
|
||||||
if (i < segmentCount) {
|
if (i < segmentCount) {
|
||||||
// update existing line edit
|
// update existing line edit
|
||||||
static_cast<ClearLineEdit *>(docTitleLayout->itemAt(i + 1)->widget())
|
static_cast<ClearLineEdit *>(docTitleLayout->itemAt(i)->widget())
|
||||||
->setText(static_cast<size_t>(i) < titles.size() ? QString::fromUtf8(titles[static_cast<size_t>(i)].data()) : QString());
|
->setText(static_cast<size_t>(i) < titles.size() ? QString::fromUtf8(titles[static_cast<size_t>(i)].data()) : QString());
|
||||||
} else {
|
} else {
|
||||||
// remove unneeded line edit
|
// remove unneeded line edit
|
||||||
|
@ -475,13 +475,15 @@ void TagEditorWidget::updateTagSelectionComboBox()
|
||||||
*/
|
*/
|
||||||
void TagEditorWidget::updateFileStatusStatus()
|
void TagEditorWidget::updateFileStatusStatus()
|
||||||
{
|
{
|
||||||
bool opened = m_fileInfo.isOpen();
|
const bool opened = m_fileInfo.isOpen();
|
||||||
bool hasTag = opened && m_tags.size();
|
const bool hasTag = opened && m_tags.size();
|
||||||
// notification widgets
|
// notification widgets
|
||||||
m_ui->parsingNotificationWidget->setVisible(opened);
|
m_ui->parsingNotificationWidget->setVisible(opened);
|
||||||
m_ui->makingNotificationWidget->setVisible(opened && (m_makingResultsAvailable));
|
m_ui->makingNotificationWidget->setVisible(opened && (m_makingResultsAvailable));
|
||||||
// document title widget
|
// document title widget
|
||||||
m_ui->docTitleWidget->setVisible(opened && m_fileInfo.container() && m_fileInfo.container()->supportsTitle());
|
const bool showDocumentTitle = opened && m_fileInfo.container() && m_fileInfo.container()->supportsTitle();
|
||||||
|
m_ui->docTitleLabel->setVisible(showDocumentTitle);
|
||||||
|
m_ui->docTitleWidget->setVisible(showDocumentTitle);
|
||||||
// buttons and actions to save, delete, close
|
// buttons and actions to save, delete, close
|
||||||
m_ui->saveButton->setEnabled(opened);
|
m_ui->saveButton->setEnabled(opened);
|
||||||
m_ui->nextButton->setEnabled(opened);
|
m_ui->nextButton->setEnabled(opened);
|
||||||
|
@ -1037,12 +1039,11 @@ bool TagEditorWidget::applyEntriesAndSaveChangings()
|
||||||
m_makingResultsAvailable = true;
|
m_makingResultsAvailable = true;
|
||||||
|
|
||||||
// apply titles
|
// apply titles
|
||||||
if (AbstractContainer *container = m_fileInfo.container()) {
|
AbstractContainer *const container = m_fileInfo.container();
|
||||||
if (container->supportsTitle()) {
|
if (container && container->supportsTitle()) {
|
||||||
QLayout *docTitleLayout = m_ui->docTitleWidget->layout();
|
QLayout *const docTitleLayout = m_ui->docTitleWidget->layout();
|
||||||
for (int i = 0, count = min<int>(docTitleLayout->count() - 1, container->segmentCount()); i < count; ++i) {
|
for (std::size_t i = 0, count = min<std::size_t>(static_cast<std::size_t>(docTitleLayout->count()), container->segmentCount()); i < count; ++i) {
|
||||||
container->setTitle(static_cast<ClearLineEdit *>(docTitleLayout->itemAt(i + 1)->widget())->text().toUtf8().data(), i);
|
container->setTitle(static_cast<ClearLineEdit *>(docTitleLayout->itemAt(static_cast<int>(i))->widget())->text().toUtf8().data(), i);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// apply all tags
|
// apply all tags
|
||||||
|
|
|
@ -54,6 +54,13 @@
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>2</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="docTitleLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Document title</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="docTitleWidget" native="true">
|
<widget class="QWidget" name="docTitleWidget" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -75,18 +82,11 @@
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="docTitleLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Document title</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="" native="true">
|
<widget class="QWidget" name="widget" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
@ -94,6 +94,15 @@
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="tagSelectionHorizontalLayout">
|
<layout class="QHBoxLayout" name="tagSelectionHorizontalLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="tagSelectionComboBox">
|
<widget class="QComboBox" name="tagSelectionComboBox">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -231,6 +240,14 @@ currently shown tag.</string>
|
||||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QStackedWidget" name="stackedWidget">
|
<widget class="QStackedWidget" name="stackedWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>678</width>
|
||||||
|
<height>0</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
|
Loading…
Reference in New Issue