Compare commits

...

13 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
Jonas Kvinge
d8052b295f Release 1.1.0-rc2 2024-07-09 04:39:48 +02:00
Jonas Kvinge
625929133c Rename analyzers and add turbine analyzer 2024-07-09 04:39:48 +02:00
Jonas Kvinge
79c28e7e1d sqlite_test: Remove fts5 2024-07-09 03:24:13 +02:00
Jonas Kvinge
01f4a79f07 schema: Bump schema version to 20 2024-07-09 03:19:29 +02:00
Jonas Kvinge
47c5a2215e device-schema: Remove fts5 table 2024-07-09 03:18:43 +02:00
Jonas Kvinge
bb6e38630f Turn on git revision 2024-07-09 03:18:04 +02:00
22 changed files with 256 additions and 108 deletions

View File

@@ -2,7 +2,7 @@ Strawberry Music Player
=======================
ChangeLog
Version 1.1.0-rc1:
Version 1.1.0-rc3 (2024.07.09):
Bugfixes:
* Fixed crash when pressing CTRL + C (#1359).
@@ -54,6 +54,7 @@ Version 1.1.0-rc1:
* (Windows MSVC) Add back WASAPI2.
New features:
* Turbine analyzer.
* WaveRubber analyzer.
* Spotify streaming support.

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 rc1)
set(STRAWBERRY_VERSION_PRERELEASE rc3)
set(INCLUDE_GIT_REVISION OFF)

View File

@@ -94,9 +94,4 @@ CREATE INDEX idx_device_%deviceid_songs_album ON device_%deviceid_songs (album);
CREATE INDEX idx_device_%deviceid_songs_comp_artist ON device_%deviceid_songs (compilation_effective, artist);
CREATE VIRTUAL TABLE device_%deviceid_fts USING fts5(
ftstitle, ftsalbum, ftsartist, ftsalbumartist, ftscomposer, ftsperformer, ftsgrouping, ftsgenre, ftscomment,
tokenize = "unicode61 remove_diacritics 1"
);
UPDATE devices SET schema_version=5 WHERE ROWID=%deviceid;

View File

@@ -4,7 +4,7 @@ CREATE TABLE IF NOT EXISTS schema_version (
DELETE FROM schema_version;
INSERT INTO schema_version (version) VALUES (19);
INSERT INTO schema_version (version) VALUES (20);
CREATE TABLE IF NOT EXISTS directories (
path TEXT NOT NULL,

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

@@ -72,9 +72,10 @@ set(SOURCES
analyzer/analyzercontainer.cpp
analyzer/blockanalyzer.cpp
analyzer/boomanalyzer.cpp
analyzer/turbineanalyzer.cpp
analyzer/sonogramanalyzer.cpp
analyzer/waverubberanalyzer.cpp
analyzer/rainbowanalyzer.cpp
analyzer/sonogram.cpp
analyzer/waverubber.cpp
equalizer/equalizer.cpp
equalizer/equalizerslider.cpp
@@ -331,9 +332,10 @@ set(HEADERS
analyzer/analyzercontainer.h
analyzer/blockanalyzer.h
analyzer/boomanalyzer.h
analyzer/turbineanalyzer.h
analyzer/sonogramanalyzer.h
analyzer/waverubberanalyzer.h
analyzer/rainbowanalyzer.h
analyzer/sonogram.h
analyzer/waverubber.h
equalizer/equalizer.h
equalizer/equalizerslider.h

View File

@@ -39,9 +39,10 @@
#include "analyzerbase.h"
#include "blockanalyzer.h"
#include "boomanalyzer.h"
#include "turbineanalyzer.h"
#include "sonogramanalyzer.h"
#include "waverubberanalyzer.h"
#include "rainbowanalyzer.h"
#include "sonogram.h"
#include "waverubber.h"
#include "core/logging.h"
#include "core/shared_ptr.h"
@@ -88,10 +89,11 @@ AnalyzerContainer::AnalyzerContainer(QWidget *parent)
AddAnalyzerType<BlockAnalyzer>();
AddAnalyzerType<BoomAnalyzer>();
AddAnalyzerType<NyanCatAnalyzer>();
AddAnalyzerType<TurbineAnalyzer>();
AddAnalyzerType<SonogramAnalyzer>();
AddAnalyzerType<WaveRubberAnalyzer>();
AddAnalyzerType<RainbowDashAnalyzer>();
AddAnalyzerType<Sonogram>();
AddAnalyzerType<WaveRubber>();
AddAnalyzerType<NyanCatAnalyzer>();
disable_action_ = context_menu_->addAction(tr("No analyzer"), this, &AnalyzerContainer::DisableAnalyzer);
disable_action_->setCheckable(true);

View File

@@ -136,7 +136,7 @@ void BlockAnalyzer::transform(Scope &s) {
}
void BlockAnalyzer::analyze(QPainter &p, const Scope &s, bool new_frame) {
void BlockAnalyzer::analyze(QPainter &p, const Scope &s, const bool new_frame) {
// y = 2 3 2 1 0 2
// . . . . # .

View File

@@ -54,7 +54,7 @@ class BlockAnalyzer : public AnalyzerBase {
protected:
void transform(Scope&) override;
void analyze(QPainter &p, const Scope&, bool new_frame) override;
void analyze(QPainter &p, const Scope &s, const bool new_frame) override;
void resizeEvent(QResizeEvent*) override;
virtual void paletteChange(const QPalette&);
void framerateChanged() override;

View File

@@ -45,7 +45,7 @@ class BoomAnalyzer : public AnalyzerBase {
static const char *kName;
void transform(Scope &s) override;
void analyze(QPainter &p, const Scope&, const bool new_frame) override;
void analyze(QPainter &p, const Scope &scope, const bool new_frame) override;
public slots:
void changeK_barHeight(int);

View File

@@ -41,18 +41,21 @@
#include "fht.h"
#include "analyzerbase.h"
const char *NyanCatAnalyzer::kName = "Nyanalyzer Cat";
const char *RainbowDashAnalyzer::kName = "Rainbow Dash";
RainbowAnalyzer::RainbowType RainbowAnalyzer::rainbowtype;
const int RainbowAnalyzer::kHeight[] = { 21, 33 };
const int RainbowAnalyzer::kWidth[] = { 34, 53 };
const int RainbowAnalyzer::kFrameCount[] = { 6, 16 };
const int RainbowAnalyzer::kRainbowHeight[] = { 21, 16 };
const int RainbowAnalyzer::kRainbowOverlap[] = { 13, 15 };
const int RainbowAnalyzer::kSleepingHeight[] = { 24, 33 };
const char *NyanCatAnalyzer::kName = "Nyanalyzer Cat";
const char *RainbowDashAnalyzer::kName = "Rainbow Dash";
const float RainbowAnalyzer::kPixelScale = 0.02F;
RainbowAnalyzer::RainbowType RainbowAnalyzer::rainbowtype;
namespace {
constexpr int kFrameIntervalMs = 150;
constexpr int kRainbowHeight[] = { 21, 16 };
constexpr int kRainbowOverlap[] = { 13, 15 };
constexpr float kPixelScale = 0.02F;
} // namespace
RainbowAnalyzer::RainbowAnalyzer(const RainbowType rbtype, QWidget *parent)
: AnalyzerBase(parent, 9),
@@ -106,7 +109,7 @@ void RainbowAnalyzer::resizeEvent(QResizeEvent *e) {
}
void RainbowAnalyzer::analyze(QPainter &p, const Scope &s, bool new_frame) {
void RainbowAnalyzer::analyze(QPainter &p, const Scope &s, const bool new_frame) {
// Discard the second half of the transform
const int scope_size = static_cast<int>(s.size() / 2);

View File

@@ -49,44 +49,37 @@ class RainbowAnalyzer : public AnalyzerBase {
Dash = 1
};
RainbowAnalyzer(const RainbowType rbtype, QWidget *parent);
explicit RainbowAnalyzer(const RainbowType rbtype, QWidget *parent);
protected:
void transform(Scope&) override;
void analyze(QPainter &p, const Scope&, bool new_frame) override;
void transform(Scope &s) override;
void analyze(QPainter &p, const Scope &s, const bool new_frame) override;
void timerEvent(QTimerEvent *e) override;
void resizeEvent(QResizeEvent *e) override;
private:
static const int kRainbowBands = 6;
static const int kHistorySize = 128;
static RainbowType rainbowtype;
static const int kHeight[];
static const int kWidth[];
static const int kFrameCount[];
static const int kRainbowHeight[];
static const int kRainbowOverlap[];
static const int kSleepingHeight[];
static const int kHistorySize = 128;
static const int kRainbowBands = 6;
static const float kPixelScale;
static const int kFrameIntervalMs = 150;
static RainbowType rainbowtype;
inline QRect SourceRect(RainbowType _rainbowtype) const {
inline QRect SourceRect(const RainbowType _rainbowtype) const {
return QRect(0, kHeight[_rainbowtype] * frame_, kWidth[_rainbowtype], kHeight[_rainbowtype]);
}
inline QRect SleepingSourceRect(RainbowType _rainbowtype) const {
inline QRect SleepingSourceRect(const RainbowType _rainbowtype) const {
return QRect(0, kHeight[_rainbowtype] * kFrameCount[_rainbowtype], kWidth[_rainbowtype], kSleepingHeight[_rainbowtype]);
}
inline QRect DestRect(RainbowType _rainbowtype) const {
inline QRect DestRect(const RainbowType _rainbowtype) const {
return QRect(width() - kWidth[_rainbowtype], (height() - kHeight[_rainbowtype]) / 2, kWidth[_rainbowtype], kHeight[_rainbowtype]);
}
inline QRect SleepingDestRect(RainbowType _rainbowtype) const {
inline QRect SleepingDestRect(const RainbowType _rainbowtype) const {
return QRect(width() - kWidth[_rainbowtype], (height() - kSleepingHeight[_rainbowtype]) / 2, kWidth[_rainbowtype], kSleepingHeight[_rainbowtype]);
}

View File

@@ -26,14 +26,14 @@
#include "engine/enginebase.h"
#include "sonogram.h"
#include "sonogramanalyzer.h"
const char *Sonogram::kName = QT_TRANSLATE_NOOP("AnalyzerContainer", "Sonogram");
const char *SonogramAnalyzer::kName = QT_TRANSLATE_NOOP("AnalyzerContainer", "Sonogram");
Sonogram::Sonogram(QWidget *parent)
SonogramAnalyzer::SonogramAnalyzer(QWidget *parent)
: AnalyzerBase(parent, 9) {}
void Sonogram::resizeEvent(QResizeEvent *e) {
void SonogramAnalyzer::resizeEvent(QResizeEvent *e) {
Q_UNUSED(e)
@@ -42,7 +42,7 @@ void Sonogram::resizeEvent(QResizeEvent *e) {
}
void Sonogram::analyze(QPainter &p, const Scope &s, bool new_frame) {
void SonogramAnalyzer::analyze(QPainter &p, const Scope &s, const bool new_frame) {
if (!new_frame || engine_->state() == EngineBase::State::Paused) {
p.drawPixmap(0, 0, canvas_);
@@ -81,7 +81,7 @@ void Sonogram::analyze(QPainter &p, const Scope &s, bool new_frame) {
}
void Sonogram::transform(Scope &scope) {
void SonogramAnalyzer::transform(Scope &scope) {
fht_->power2(scope.data());
fht_->scale(scope.data(), 1.0 / 256);
@@ -89,6 +89,6 @@ void Sonogram::transform(Scope &scope) {
}
void Sonogram::demo(QPainter &p) {
void SonogramAnalyzer::demo(QPainter &p) {
analyze(p, Scope(fht_->size(), 0), new_frame_);
}

View File

@@ -21,24 +21,25 @@
along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SONOGRAM_H
#define SONOGRAM_H
#ifndef SONOGRAMANALYZER_H
#define SONOGRAMANALYZER_H
#include <QPixmap>
#include <QPainter>
#include "analyzerbase.h"
class Sonogram : public AnalyzerBase {
class SonogramAnalyzer : public AnalyzerBase {
Q_OBJECT
public:
Q_INVOKABLE explicit Sonogram(QWidget *parent);
Q_INVOKABLE explicit SonogramAnalyzer(QWidget *parent);
static const char *kName;
protected:
void resizeEvent(QResizeEvent *e) override;
void analyze(QPainter &p, const Scope &s, bool new_frame) override;
void analyze(QPainter &p, const Scope &s, const bool new_frame) override;
void transform(Scope &scope) override;
void demo(QPainter &p) override;
@@ -46,4 +47,4 @@ class Sonogram : public AnalyzerBase {
QPixmap canvas_;
};
#endif // SONOGRAM_H
#endif // SONOGRAMANALYZER_H

View File

@@ -0,0 +1,100 @@
/*
Strawberry Music Player
This file was part of Clementine.
Copyright 2003, Stanislav Karchebny <berkus@users.sf.net>
Copyright 2003, Max Howell <max.howell@methylblue.com>
Copyright 2009-2010, David Sansome <davidsansome@gmail.com>
Copyright 2014-2015, Mark Furneaux <mark@furneaux.ca>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <cmath>
#include <algorithm>
#include <QPainter>
#include "turbineanalyzer.h"
#include "engine/enginebase.h"
const char *TurbineAnalyzer::kName = QT_TRANSLATE_NOOP("AnalyzerContainer", "Turbine");
TurbineAnalyzer::TurbineAnalyzer(QWidget *parent) : BoomAnalyzer(parent) {}
void TurbineAnalyzer::analyze(QPainter &p, const Scope &scope, const bool new_frame) {
if (!new_frame || engine_->state() == EngineBase::State::Paused) {
p.drawPixmap(0, 0, canvas_);
return;
}
const uint hd2 = height() / 2;
const uint kMaxHeight = hd2 - 1;
QPainter canvas_painter(&canvas_);
canvas_.fill(palette().color(QPalette::Window));
AnalyzerBase::interpolate(scope, scope_);
for (uint i = 0, x = 0, y = 0; i < static_cast<uint>(bands_); ++i, x += kColumnWidth + 1) {
float h = static_cast<float>(std::min(log10(scope_[i] * 256.0) * F_ * 0.5, kMaxHeight * 1.0));
if (h > bar_height_[i]) {
bar_height_[i] = h;
if (h > peak_height_[i]) {
peak_height_[i] = h;
peak_speed_[i] = 0.01;
}
else {
goto peak_handling;
}
}
else {
if (bar_height_[i] > 0.0) {
bar_height_[i] -= K_barHeight_; // 1.4
if (bar_height_[i] < 0.0) bar_height_[i] = 0.0;
}
peak_handling:
if (peak_height_[i] > 0.0) {
peak_height_[i] -= peak_speed_[i];
peak_speed_[i] *= F_peakSpeed_; // 1.12
peak_height_[i] = std::max(0.0, std::max(bar_height_[i], peak_height_[i]));
}
}
y = hd2 - static_cast<uint>(bar_height_[i]);
canvas_painter.drawPixmap(static_cast<int>(x + 1), static_cast<int>(y), barPixmap_, 0, static_cast<int>(y), -1, -1);
canvas_painter.drawPixmap(static_cast<int>(x + 1), static_cast<int>(hd2), barPixmap_, 0, static_cast<int>(bar_height_[i]), -1, -1);
canvas_painter.setPen(fg_);
if (bar_height_[i] > 0) {
canvas_painter.drawRect(static_cast<int>(x), static_cast<int>(y), kColumnWidth - 1, static_cast<int>(bar_height_[i]) * 2 - 1);
}
const uint x2 = x + kColumnWidth - 1;
canvas_painter.setPen(palette().color(QPalette::Midlight));
y = hd2 - static_cast<uint>(peak_height_[i]);
canvas_painter.drawLine(static_cast<int>(x), static_cast<int>(y), static_cast<int>(x2), static_cast<int>(y));
y = hd2 + static_cast<uint>(peak_height_[i]);
canvas_painter.drawLine(static_cast<int>(x), static_cast<int>(y), static_cast<int>(x2), static_cast<int>(y));
}
p.drawPixmap(0, 0, canvas_);
}

View File

@@ -0,0 +1,41 @@
/*
Strawberry Music Player
This file was part of Clementine.
Copyright 2003, Stanislav Karchebny <berkus@users.sf.net>
Copyright 2009-2010, David Sansome <davidsansome@gmail.com>
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
Copyright 2014, John Maguire <john.maguire@gmail.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TURBINEANALYZER_H
#define TURBINEANALYZER_H
#include "boomanalyzer.h"
class QPainter;
class TurbineAnalyzer : public BoomAnalyzer {
Q_OBJECT
public:
Q_INVOKABLE explicit TurbineAnalyzer(QWidget *parent);
void analyze(QPainter &p, const Scope &scope, const bool new_frame);
static const char *kName;
};
#endif // TURBINEANALYZER_H

View File

@@ -19,14 +19,14 @@
#include <QPainter>
#include <QResizeEvent>
#include "engine/enginebase.h"
#include "waverubber.h"
#include "waverubberanalyzer.h"
const char *WaveRubber::kName = QT_TRANSLATE_NOOP("AnalyzerContainer", "WaveRubber");
const char *WaveRubberAnalyzer::kName = QT_TRANSLATE_NOOP("AnalyzerContainer", "WaveRubber");
WaveRubber::WaveRubber(QWidget *parent)
WaveRubberAnalyzer::WaveRubberAnalyzer(QWidget *parent)
: AnalyzerBase(parent, 9) {}
void WaveRubber::resizeEvent(QResizeEvent *e) {
void WaveRubberAnalyzer::resizeEvent(QResizeEvent *e) {
Q_UNUSED(e)
@@ -35,7 +35,7 @@ void WaveRubber::resizeEvent(QResizeEvent *e) {
}
void WaveRubber::analyze(QPainter &p, const Scope &s, const bool new_frame) {
void WaveRubberAnalyzer::analyze(QPainter &p, const Scope &s, const bool new_frame) {
if (!new_frame || engine_->state() == EngineBase::State::Paused) {
p.drawPixmap(0, 0, canvas_);
@@ -82,11 +82,11 @@ void WaveRubber::analyze(QPainter &p, const Scope &s, const bool new_frame) {
}
void WaveRubber::transform(Scope &s) {
void WaveRubberAnalyzer::transform(Scope &s) {
// No need transformation for waveform analyzer
Q_UNUSED(s);
}
void WaveRubber::demo(QPainter &p) {
void WaveRubberAnalyzer::demo(QPainter &p) {
analyze(p, Scope(fht_->size(), 0), new_frame_);
}

View File

@@ -22,11 +22,11 @@
#include "analyzerbase.h"
class WaveRubber : public AnalyzerBase {
class WaveRubberAnalyzer : public AnalyzerBase {
Q_OBJECT
public:
Q_INVOKABLE explicit WaveRubber(QWidget *parent);
Q_INVOKABLE explicit WaveRubberAnalyzer(QWidget *parent);
static const char *kName;

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

View File

@@ -3,14 +3,14 @@
// clazy:excludeall=returning-void-expression
TEST(SqliteTest, FTS5SupportEnabled) {
TEST(SqliteTest, CreateTableTest) {
sqlite3* db = nullptr;
sqlite3 *db = nullptr;
int rc = sqlite3_open(":memory:", &db);
ASSERT_EQ(0, rc);
char* errmsg = nullptr;
rc = sqlite3_exec(db, "CREATE VIRTUAL TABLE foo USING fts5(content, TEXT, tokenize = 'unicode61 remove_diacritics 0')", nullptr, nullptr, &errmsg);
char *errmsg = nullptr;
rc = sqlite3_exec(db, "CREATE TABLE foo (content TEXT)", nullptr, nullptr, &errmsg);
ASSERT_EQ(0, rc) << errmsg;
sqlite3_close(db);