Skip to content

Commit

Permalink
feat: add "suffix without extension" log file path type (fix #3325)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bionus committed Nov 24, 2024
1 parent c12fc25 commit fe3a514
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/gui/src/settings/log-window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ LogWindow::LogWindow(int index, Profile *profile, QWidget *parent)
ui->lineFilename->setText(dta["filename"].toString());
ui->lineUniquePath->setText(dta["uniquePath"].toString());
ui->lineSuffix->setText(dta["suffix"].toString());
ui->lineSuffixWithoutExtension->setText(dta["suffixWithoutExtension"].toString());
ui->textEditContent->setPlainText(dta["content"].toString());
}

Expand Down Expand Up @@ -69,6 +70,7 @@ void LogWindow::save()
dta["filename"] = ui->lineFilename->text();
dta["uniquePath"] = ui->lineUniquePath->text();
dta["suffix"] = ui->lineSuffix->text();
dta["suffixWithoutExtension"] = ui->lineSuffixWithoutExtension->text();
dta["content"] = ui->textEditContent->toPlainText();

emit validated(m_index, dta);
Expand Down
49 changes: 46 additions & 3 deletions src/gui/src/settings/log-window.ui
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
<string>Suffix</string>
</property>
</item>
<item>
<property name="text">
<string>Suffix without extension</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0" colspan="2">
Expand Down Expand Up @@ -174,7 +179,45 @@
<widget class="QLineEdit" name="lineSuffix"/>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="label">
<widget class="QLabel" name="labelSuffixHelp">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Each time an image is saved, an external text file will be saved with the same name at the same location.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="pageSuffixWithoutExtension">
<layout class="QFormLayout" name="formLayout_5">
<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="0">
<widget class="QLabel" name="labelSuffixWithoutExtension">
<property name="text">
<string>Suffix</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineSuffixWithoutExtension"/>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="labelWithoutExtensionHelp">
<property name="font">
<font>
<italic>true</italic>
Expand Down Expand Up @@ -205,10 +248,10 @@
<item row="6" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
<set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok</set>
</property>
</widget>
</item>
Expand Down
2 changes: 2 additions & 0 deletions src/lib/src/models/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,8 @@ QString Image::postSaving(const QString &originalPath, Size size, bool addMd5, b
fileTagsPath = logFile["uniquePath"].toString();
} else if (locationType == 2) {
fileTagsPath = path + logFile["suffix"].toString();
} else if (locationType == 3) {
fileTagsPath = setExtension(path, "") + logFile["suffixWithoutExtension"].toString();
}

// Replace some post-save tokens
Expand Down

0 comments on commit fe3a514

Please sign in to comment.