EditTagDialog: Make reset feedback work by calling
`set_reset_button()` in `UpdateModifiedField()` and catering for non-text in `IsValueModified()` (-1 original being same as 0); use new `ExtendedEditor::set_font()`; connect reset for "rating". Make "comment" `tabChangesFocus` to keep tab chain. ExtendedEditor: New `set_font()` to get emboldened font to work and make reset feedback work for `CheckBox` and `RatingBox` by overriding `Resize()`. RatingWidget: Allow tabbed focus and implement keyboard input.
This commit is contained in:
@@ -199,6 +199,7 @@ EditTagDialog::EditTagDialog(const SharedPtr<NetworkAccessManager> network,
|
||||
}
|
||||
else if (RatingBox *ratingbox = qobject_cast<RatingBox*>(widget)) {
|
||||
QObject::connect(ratingbox, &RatingWidget::RatingChanged, this, &EditTagDialog::FieldValueEdited);
|
||||
QObject::connect(ratingbox, &RatingBox::Reset, this, &EditTagDialog::ResetField);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -544,6 +545,20 @@ bool EditTagDialog::DoesValueVary(const QModelIndexList &sel, const QString &id)
|
||||
|
||||
bool EditTagDialog::IsValueModified(const QModelIndexList &sel, const QString &id) const {
|
||||
|
||||
if (id == u"track"_s || id == u"disc"_s || id == u"year"_s) {
|
||||
return std::any_of(sel.begin(), sel.end(), [this, id](const QModelIndex &i) {
|
||||
const int original = data_[i.row()].original_value(id).toInt();
|
||||
const int current = data_[i.row()].current_value(id).toInt();
|
||||
return original != current && (original != -1 || current != 0);
|
||||
});
|
||||
}
|
||||
else if (id == u"rating"_s) {
|
||||
return std::any_of(sel.begin(), sel.end(), [this, id](const QModelIndex &i) {
|
||||
const float original = data_[i.row()].original_value(id).toFloat();
|
||||
const float current = data_[i.row()].current_value(id).toFloat();
|
||||
return original != current && (original != -1 || current != 0);
|
||||
});
|
||||
}
|
||||
return std::any_of(sel.begin(), sel.end(), [this, id](const QModelIndex &i) { return data_[i.row()].original_value(id) != data_[i.row()].current_value(id); });
|
||||
|
||||
}
|
||||
@@ -605,7 +620,15 @@ void EditTagDialog::UpdateModifiedField(const FieldData &field, const QModelInde
|
||||
QFont new_font(font());
|
||||
new_font.setBold(modified);
|
||||
field.label_->setFont(new_font);
|
||||
if (field.editor_) field.editor_->setFont(new_font);
|
||||
if (field.editor_) {
|
||||
if (ExtendedEditor *editor = dynamic_cast<ExtendedEditor*>(field.editor_)) {
|
||||
editor->set_font(new_font);
|
||||
editor->set_reset_button(modified);
|
||||
}
|
||||
else {
|
||||
field.editor_->setFont(new_font);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -944,7 +944,7 @@
|
||||
<item row="15" column="1">
|
||||
<widget class="CheckBox" name="compilation">
|
||||
<property name="has_reset_button" stdset="0">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="has_clear_button" stdset="0">
|
||||
<bool>false</bool>
|
||||
@@ -1011,6 +1011,9 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="tabChangesFocus">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="has_reset_button" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -1072,7 +1075,20 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="1">
|
||||
<widget class="RatingBox" name="rating" native="true"/>
|
||||
<widget class="RatingBox" name="rating" native="true">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>140</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="has_reset_button" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="has_clear_button" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
@@ -1217,6 +1233,7 @@
|
||||
<tabstop>grouping</tabstop>
|
||||
<tabstop>genre</tabstop>
|
||||
<tabstop>compilation</tabstop>
|
||||
<tabstop>rating</tabstop>
|
||||
<tabstop>fetch_tag</tabstop>
|
||||
<tabstop>comment</tabstop>
|
||||
<tabstop>lyrics</tabstop>
|
||||
|
||||
Reference in New Issue
Block a user