Skip to content

Commit b791108

Browse files
committed
Apply clazy fixes + restore Qt backward compatibility
1 parent 0acab4f commit b791108

File tree

10 files changed

+22
-24
lines changed

10 files changed

+22
-24
lines changed

src/MainWindow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ void MainWindow::loadConfig()
717717

718718
QVector<float> rawEqData;
719719

720-
for (auto val : rawEqString.split(";"))
720+
for (const auto &val : rawEqString.split(";"))
721721
{
722722
if (!val.isEmpty())
723723
{

src/audio/pipewire/FilterContainer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ FilterContainer::FilterContainer(PwPipelineManager* pipe_manager, PwPluginBase*
7070

7171
connect_filters();
7272

73-
QObject::connect(settings, &AppConfig::updated, [&, this](const auto& key, const auto& value) {
73+
QObject::connect(settings, &AppConfig::updated, nullptr, [&, this](const auto& key, const auto& value) {
7474
if(key != AppConfig::AudioOutputDevice)
7575
return;
7676

src/audio/pipewire/PipewireAudioService.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,10 @@ IAppManager *PipewireAudioService::appManager()
147147
std::vector<IOutputDevice> PipewireAudioService::sinkDevices()
148148
{
149149
std::vector<IOutputDevice> devices;
150-
for(auto [id, node] : mgr.get()->node_map)
150+
for(const auto &[id, node] : mgr.get()->node_map)
151151
{
152152
if(node.media_class == "Audio/Sink" && node.name != "jamesdsp_sink"){
153-
for(auto blacklist : mgr.get()->blocklist_node_name){
153+
for(const auto &blacklist : mgr.get()->blocklist_node_name){
154154
if(node.name == blacklist)
155155
{
156156
continue;

src/audio/pipewire/PwAppManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ void PwAppManager::handleSettingsUpdate(const AppConfig::Key& key, const QVarian
7676
switch(key)
7777
{
7878
case AppConfig::AudioAppBlocklist:
79-
for (const auto& node : apps)
79+
for (const auto& node : qAsConst(apps))
8080
{
8181
const auto& app_is_enabled = mgr->stream_is_connected(node.id, node.media_class);
8282
bool is_blocklisted = AppConfig::instance().isAppBlocked(QString::fromStdString(node.name));

src/config/DspConfig.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,7 @@ class DspConfig :
241241

242242
void loadDefault()
243243
{
244-
QString data;
245-
QString fileName(":/assets/default.conf");
246-
247-
QFile file(fileName);
244+
QFile file(":/assets/default.conf");
248245

249246
if (file.open(QIODevice::ReadOnly))
250247
{

src/data/EelParser.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ void EELParser::loadFile(QString path)
1919
// Parse number range parameters
2020
{
2121
QRegularExpression descRe(R"((?<var>\w+):(?<def>-?\d+\.?\d*)?<(?<min>-?\d+\.?\d*),(?<max>-?\d+\.?\d*),?(?<step>-?\d+\.?\d*)?>(?<desc>[\s\S][^\n]*))");
22-
for (auto line : container.code.split("\n"))
22+
for (const auto &line : container.code.split("\n"))
2323
{
2424
auto matchIterator = descRe.globalMatch(line);
2525

@@ -77,7 +77,7 @@ bool EELParser::loadDefaults()
7777
return false;
7878
}
7979

80-
for(const auto& prop : properties)
80+
for(const auto& prop : qAsConst(properties))
8181
{
8282
if(prop->getType() == EELPropertyType::NumberRange)
8383
{
@@ -96,7 +96,7 @@ bool EELParser::hasDefaultsDefined()
9696
return false;
9797
}
9898

99-
for(const auto& prop : properties)
99+
for(const auto& prop : qAsConst(properties))
100100
{
101101
if(prop->getType() == EELPropertyType::NumberRange)
102102
{
@@ -116,7 +116,7 @@ bool EELParser::canLoadDefaults()
116116
return false;
117117
}
118118

119-
for(auto* prop : properties)
119+
for(auto* prop : qAsConst(properties))
120120
{
121121
if(prop->getType() == EELPropertyType::NumberRange)
122122
{
@@ -146,7 +146,7 @@ QString EELParser::getDescription()
146146
{
147147
QRegularExpression descRe(R"((?:^|(?<=\n))(?:desc:)([\s\S][^\n]*))");
148148

149-
for (auto line : container.code.split("\n"))
149+
for (const auto &line : container.code.split("\n"))
150150
{
151151
auto matchIterator = descRe.globalMatch(line);
152152

@@ -198,7 +198,7 @@ QString EELParser::findVariable(QString key,
198198
{
199199
QRegularExpression re(QString(R"(%1\s*=\s*(?<val>-?\d+\.?\d*)\s*;)").arg(key));
200200

201-
for (auto line : container.code.split("\n"))
201+
for (const auto &line : container.code.split("\n"))
202202
{
203203
auto matchIterator = re.globalMatch(line);
204204

src/interface/QMenuEditor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ bool QMenuEditor::insertAction(QAction *new_action)
133133
{
134134
int act_before = ui->list_target->currentRow();
135135

136-
for (auto item : mTarget)
136+
for (auto item : qAsConst(mTarget))
137137
{
138138
if (item->text() == new_action->text() &&
139139
!item->isSeparator())
@@ -167,7 +167,7 @@ QMenu* QMenuEditor::exportMenu()
167167
{
168168
QMenu *menu = new QMenu();
169169

170-
for (auto item : mTarget)
170+
for (auto item : qAsConst(mTarget))
171171
{
172172
if (item->isSeparator())
173173
{

src/interface/WidgetMarqueeLabel.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ class ScrollText :
1414

1515
public:
1616
explicit ScrollText(QWidget *parent = 0);
17-
18-
public slots:
1917
QString text() const;
2018
void setText(QString text);
2119

@@ -46,4 +44,4 @@ private slots:
4644

4745
};
4846

49-
#endif // SCROLLTEXT_H
47+
#endif // SCROLLTEXT_H

src/subprojects/FlatTabWidget/flattabwidget.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ FlatTabWidget::~FlatTabWidget()
5757
{
5858
lineMorph->deleteLater();
5959
fade->deleteLater();
60-
for(const auto& item : pages)
60+
for(const auto& item : qAsConst(pages))
6161
{
6262
item.fadeIn->deleteLater();
6363
item.fadeOut->deleteLater();
@@ -66,7 +66,6 @@ FlatTabWidget::~FlatTabWidget()
6666
}
6767

6868
void FlatTabWidget::addPage(QString title, QWidget* page, int index){
69-
auto pal = palette();
7069
auto textcolor_active = getColor(ColorRole::Active);
7170
auto textcolor_disabled = getColor(ColorRole::Inactive);
7271

@@ -102,7 +101,7 @@ void FlatTabWidget::updatePages(bool overrideSeparator){
102101
}
103102
ui->TabBarContainer->repaint();
104103

105-
for (auto page : pages) {
104+
for (auto page : qAsConst(pages)) {
106105
ui->TabBarContainer->layout()->addWidget(page.label);
107106
if(!detachCustomStackedWidget)
108107
activeContainer->addWidget(page.widget);
@@ -142,7 +141,7 @@ void FlatTabWidget::showEvent(QShowEvent *event)
142141
}
143142

144143
void FlatTabWidget::redrawTabBar(){
145-
for (auto page : pages)
144+
for (auto page : qAsConst(pages))
146145
page.label->setColor(getColor(ColorRole::Inactive));
147146
int temp = currentSelection;
148147
setCurrentTab(temp);

src/subprojects/GraphicEQWidget/GraphicEQFilterGUI.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,11 @@ void GraphicEQFilterGUI::load(const QString& parameters)
135135
std::vector<FilterNode> nodes;
136136
QStringList nodeList = parameterList.at(1).split(";");
137137
for(QString nodeStr : nodeList){
138+
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
139+
QStringList values = nodeStr.trimmed().split(" ", QString::SkipEmptyParts);
140+
#else
138141
QStringList values = nodeStr.trimmed().split(" ", Qt::SkipEmptyParts);
142+
#endif
139143
if(values.count() != 2)
140144
continue;
141145
FilterNode node(values.at(0).toDouble(),values.at(1).toDouble());

0 commit comments

Comments
 (0)