Compare commits

..

7 Commits

Author SHA1 Message Date
Jonas Kvinge
822cf0ad07 Release 1.1.0-rc3 2024-07-09 16:23:10 +02:00
Jonas Kvinge
67f04a81b3 Playlist: Add data changed when setting current row 2024-07-09 16:21:09 +02:00
Jonas Kvinge
9232ad0125 TagReaderTagLib: Use QString for converting TagLib::String
Converting directly to std::string does not seem to work correctly.
2024-07-09 15:56:07 +02:00
Jonas Kvinge
0de87b3e1e TagReaderTagLib: Use UTF-8 when converting to CString
Fixes #1481
2024-07-09 15:06:07 +02:00
Jonas Kvinge
74b8cd6156 StretchHeaderView: Formatting 2024-07-09 11:35:01 +02:00
Jonas Kvinge
ac959387fe StretchHeaderView: Fix infinite loop
Fixes #1480
2024-07-09 11:14:31 +02:00
Jonas Kvinge
ffd8ce9281 Turn on git revision 2024-07-09 10:44:11 +02:00
6 changed files with 49 additions and 39 deletions

View File

@@ -2,7 +2,7 @@ Strawberry Music Player
=======================
ChangeLog
Version 1.1.0-rc2 (2024.07.09):
Version 1.1.0-rc3 (2024.07.09):
Bugfixes:
* Fixed crash when pressing CTRL + C (#1359).

View File

@@ -1,7 +1,7 @@
set(STRAWBERRY_VERSION_MAJOR 1)
set(STRAWBERRY_VERSION_MINOR 1)
set(STRAWBERRY_VERSION_PATCH 0)
set(STRAWBERRY_VERSION_PRERELEASE rc2)
set(STRAWBERRY_VERSION_PRERELEASE rc3)
set(INCLUDE_GIT_REVISION OFF)

View File

@@ -23,8 +23,6 @@
#include <string>
#include <boost/algorithm/string/trim.hpp>
#include <QByteArray>
#include <QString>
@@ -64,7 +62,7 @@ class TagReaderTagLib : public TagReaderBase {
}
static inline std::string TagLibStringToStdString(const TagLib::String &s) {
return std::string(s.toCString(), s.length());
return std::string(s.toCString(true), s.length());
}
static inline TagLib::String QStringToTagLibString(const QString &s) {
@@ -77,9 +75,9 @@ class TagReaderTagLib : public TagReaderBase {
static inline void AssignTagLibStringToStdString(const TagLib::String &tstr, std::string *output) {
std::string stdstr = TagLibStringToStdString(tstr);
boost::trim(stdstr);
output->assign(stdstr);
const QString qstr = TagLibStringToQString(tstr).trimmed();
const QByteArray data = qstr.toUtf8();
output->assign(data.constData(), data.size());
}

View File

@@ -710,6 +710,7 @@ void Playlist::set_current_row(const int i, const AutoScroll autoscroll, const b
if (current_item_index_.isValid() && !is_stopping) {
InformOfCurrentSongChange(false);
emit dataChanged(index(current_item_index_.row(), 0), index(current_item_index_.row(), ColumnCount - 1));
emit MaybeAutoscroll(autoscroll);
}

View File

@@ -42,7 +42,8 @@ constexpr int kMagicNumber = 0x502C9510;
StretchHeaderView::StretchHeaderView(const Qt::Orientation orientation, QWidget *parent)
: QHeaderView(orientation, parent),
stretch_enabled_(false),
in_mouse_move_event_(false) {
in_mouse_move_event_(false),
forced_resize_logical_index_(-1) {
setDefaultSectionSize(100);
setMinimumSectionSize(30);
@@ -326,39 +327,48 @@ void StretchHeaderView::SectionResized(const int logical_index, const int old_si
return;
}
if (in_mouse_move_event_) {
bool resized = false;
if (new_size >= minimumSectionSize()) {
// Find the visible section to the right of the section that's being resized
const int visual_index = visualIndex(logical_index);
int right_section_logical_index = -1;
int right_section_visual_index = -1;
for (int i = 0; i <= count(); ++i) {
if (!isSectionHidden(i) &&
visualIndex(i) > visual_index &&
(right_section_visual_index == -1 || visualIndex(i) < right_section_visual_index)) {
right_section_logical_index = i;
right_section_visual_index = visualIndex(i);
}
}
if (right_section_logical_index != -1) {
const int right_section_size = sectionSize(right_section_logical_index) + (old_size - new_size);
if (right_section_size >= minimumSectionSize()) {
column_widths_[logical_index] = static_cast<ColumnWidthType>(new_size) / width();
column_widths_[right_section_logical_index] = static_cast<ColumnWidthType>(right_section_size) / width();
in_mouse_move_event_ = false;
NormaliseWidths(QList<int>() << right_section_logical_index);
ResizeSections(QList<int>() << right_section_logical_index);
in_mouse_move_event_ = true;
resized = true;
}
if (logical_index == forced_resize_logical_index_) {
forced_resize_logical_index_ = -1;
return;
}
if (!in_mouse_move_event_) {
return;
}
bool resized = false;
if (new_size >= minimumSectionSize()) {
// Find the visible section to the right of the section that's being resized
const int visual_index = visualIndex(logical_index);
int right_section_logical_index = -1;
int right_section_visual_index = -1;
for (int i = 0; i <= count(); ++i) {
if (!isSectionHidden(i) &&
visualIndex(i) > visual_index &&
(right_section_visual_index == -1 || visualIndex(i) < right_section_visual_index)) {
right_section_logical_index = i;
right_section_visual_index = visualIndex(i);
}
}
if (!resized) {
in_mouse_move_event_ = true;
resizeSection(logical_index, old_size);
in_mouse_move_event_ = false;
if (right_section_logical_index != -1) {
const int right_section_size = sectionSize(right_section_logical_index) + (old_size - new_size);
if (right_section_size >= minimumSectionSize()) {
column_widths_[logical_index] = static_cast<ColumnWidthType>(new_size) / width();
column_widths_[right_section_logical_index] = static_cast<ColumnWidthType>(right_section_size) / width();
in_mouse_move_event_ = false;
NormaliseWidths(QList<int>() << right_section_logical_index);
ResizeSections(QList<int>() << right_section_logical_index);
in_mouse_move_event_ = true;
resized = true;
}
}
}
if (!resized) {
forced_resize_logical_index_ = logical_index;
in_mouse_move_event_ = false;
resizeSection(logical_index, old_size);
in_mouse_move_event_ = true;
}
}

View File

@@ -95,6 +95,7 @@ class StretchHeaderView : public QHeaderView {
QVector<ColumnWidthType> column_widths_;
bool in_mouse_move_event_;
int forced_resize_logical_index_;
};
#endif // STRETCHHEADERVIEW_H