Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libs/plugin_utils/include/plugin_utils/plugin_info.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "plugin_utils/qt_compat.h"
#include <QLatin1StringView>

namespace plugin_utils {

Expand Down
45 changes: 0 additions & 45 deletions libs/plugin_utils/include/plugin_utils/qt_compat.h

This file was deleted.

20 changes: 8 additions & 12 deletions libs/plugin_utils/src/settings_form.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
#include <QVBoxLayout>
#include <QtMath>

#include "plugin_utils/qt_compat.h"

using namespace Qt::StringLiterals;

namespace plugin_utils {
Expand Down Expand Up @@ -48,9 +46,9 @@ QIcon swatch(const QColor& color) {
} // namespace

QColor colorValue(const PluginSettings& settings, const ColorField& field) {
QColor color = colorFromString(settings.value(field.key, field.default_value));
QColor color = QColor::fromString(settings.value(field.key, field.default_value));
if (!color.isValid()) {
color = colorFromString(field.default_value);
color = QColor::fromString(field.default_value);
}
color.setAlphaF(static_cast<float>(settings.value(field.opacity_key, field.default_opacity)) / kMaxOpacity);
return color;
Expand All @@ -72,8 +70,7 @@ void SettingsForm::addSpinBox(const SpinBoxField& field, std::function<void(int)
spin_box->setValue(settings_.value(field.key, field.default_value));
// Don't report every typed digit.
spin_box->setKeyboardTracking(false);
connect(spin_box.get(), qOverload<int>(&QSpinBox::valueChanged), this,
storeAndNotify(settings_, field.key, std::move(on_changed)));
connect(spin_box.get(), &QSpinBox::valueChanged, this, storeAndNotify(settings_, field.key, std::move(on_changed)));
layout_.addRow(field.label, spin_box.release());
}

Expand Down Expand Up @@ -110,11 +107,10 @@ void SettingsForm::addColorPicker(const ColorField& field, std::function<void(QC
on_changed(colorValue(settings, field));
}
};
connect(opacity.get(), qOverload<int>(&QSpinBox::valueChanged), this,
[settings = settings_, field, notify](int value) {
settings.setValue(field.opacity_key, value);
notify();
});
connect(opacity.get(), &QSpinBox::valueChanged, this, [settings = settings_, field, notify](int value) {
settings.setValue(field.opacity_key, value);
notify();
});
connect(button.get(), &QPushButton::clicked, this,
[settings = settings_, field, notify, button = button.get(), opacity = opacity.get()] {
const QColor picked = QColorDialog::getColor(colorValue(settings, field), button, field.label,
Expand Down Expand Up @@ -145,7 +141,7 @@ void SettingsForm::addComboBox(const ComboBoxField& field, std::function<void(QS
}
const int current = combo_box->findData(settings_.value(field.key, field.default_value));
combo_box->setCurrentIndex(current >= 0 ? current : combo_box->findData(field.default_value));
connect(combo_box.get(), qOverload<int>(&QComboBox::currentIndexChanged), this,
connect(combo_box.get(), &QComboBox::currentIndexChanged, this,
[combo_box = combo_box.get(), store = storeAndNotify(settings_, field.key, std::move(on_changed))] {
store(combo_box->currentData().toString());
});
Expand Down
4 changes: 2 additions & 2 deletions plugins/dltproxy/dltproxy_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
#include <utility>

#include <QCoreApplication>
#include <QDebug>
#include <QLatin1StringView>
#include <QRegularExpression>
#include <QString>
#include <QStringList>
#include <QtLogging>

#include "plugin_utils/plugin_info.h"
#include "plugin_utils/plugin_settings.h"
#include "plugin_utils/qt_compat.h"

using namespace Qt::StringLiterals;

Expand Down
3 changes: 1 addition & 2 deletions plugins/uitweaks/tweak_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
#include <ranges>

#include <QDebug>

#include "plugin_utils/qt_compat.h"
#include <QtLogging>

using namespace Qt::StringLiterals;

Expand Down
1 change: 1 addition & 0 deletions plugins/uitweaks/tweaks/current_tab_tweak.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <utility>

#include <QDebug>
#include <QtLogging>

CurrentTabTweak::CurrentTabTweak(QWidget* main_window, QString tab_widget_name, QString tab_name)
: main_window_(main_window), tab_widget_name_(std::move(tab_widget_name)), tab_name_(std::move(tab_name)) {}
Expand Down
6 changes: 3 additions & 3 deletions plugins/uitweaks/tweaks/filter_colors_tweak.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
#include <QGridLayout>
#include <QGroupBox>
#include <QHBoxLayout>
#include <QLatin1StringView>
#include <QPalette>
#include <QPushButton>
#include <QSet>
#include <QSize>
#include <QString>
#include <QTreeWidget>
#include <QVBoxLayout>

#include "plugin_utils/qt_compat.h"
#include <QtLogging>

using namespace Qt::StringLiterals;

Expand Down Expand Up @@ -272,7 +272,7 @@ class ShadesChooser : public QWidget {
}

void showShades(const HueFamily& family) {
for (QPushButton* swatch : shades_row_.findChildren<QPushButton*>(QString(), Qt::FindDirectChildrenOnly)) {
for (QPushButton* swatch : shades_row_.findChildren<QPushButton*>(Qt::FindDirectChildrenOnly)) {
swatch->hide();
swatch->deleteLater();
}
Expand Down
3 changes: 1 addition & 2 deletions plugins/uitweaks/tweaks/filter_type_box_tweak.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
#include <QGroupBox>
#include <QString>
#include <QWidget>

#include "plugin_utils/qt_compat.h"
#include <QtLogging>

using namespace Qt::StringLiterals;

Expand Down
1 change: 1 addition & 0 deletions plugins/uitweaks/tweaks/hidden_widgets_tweak.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <utility>

#include <QDebug>
#include <QtLogging>

HiddenWidgetsTweak::HiddenWidgetsTweak(QWidget* main_window, QStringList object_names)
: main_window_(main_window), object_names_(std::move(object_names)) {}
Expand Down
8 changes: 4 additions & 4 deletions plugins/uitweaks/tweaks/id_column_width_tweak.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#include "tweaks/id_column_width_tweak.h"

#include <algorithm>
#include <utility>

#include <QDebug>
#include <QEvent>
#include <QFontMetrics>
#include <QHeaderView>
#include <QLatin1Char>
#include <QLatin1StringView>
#include <QStyle>
#include <QTimer>
#include <QWidget>

#include "plugin_utils/qt_compat.h"
#include <QtLogging>
#include <QtMinMax>

namespace {

Expand All @@ -24,7 +24,7 @@ int minimumIdWidth(const QTableView* table) {
const QFontMetrics metrics(table->font());
int widest_char = 0;
for (char const c : kIdChars) {
widest_char = std::max(widest_char, metrics.horizontalAdvance(QLatin1Char(c)));
widest_char = qMax(widest_char, metrics.horizontalAdvance(QLatin1Char(c)));
}

// Item views draw text inset by this margin on both sides.
Expand Down
5 changes: 3 additions & 2 deletions plugins/uitweaks/tweaks/payload_column_tweak.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#include "tweaks/payload_column_tweak.h"

#include <algorithm>
#include <utility>

#include <QDebug>
#include <QGuiApplication>
#include <QHeaderView>
#include <QTimer>
#include <QtLogging>
#include <QtMinMax>

PayloadColumnTweak::PayloadColumnTweak(QWidget* main_window, QStringList table_names, int column)
: main_window_(main_window), table_names_(std::move(table_names)), column_(column) {}
Expand Down Expand Up @@ -102,7 +103,7 @@ void PayloadColumnTweak::fit(Table& table) {
return;
}
const int others = header->length() - header->sectionSize(column_);
const int width = std::max(header->minimumSectionSize(), table.view->viewport()->width() - others);
const int width = qMax(header->minimumSectionSize(), table.view->viewport()->width() - others);
if (width == header->sectionSize(column_)) {
return;
}
Expand Down
3 changes: 1 addition & 2 deletions plugins/uitweaks/tweaks/recent_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
#include <QDebug>
#include <QFileInfo>
#include <QTimer>

#include "plugin_utils/qt_compat.h"
#include <QtLogging>

using namespace Qt::StringLiterals;

Expand Down
2 changes: 0 additions & 2 deletions plugins/uitweaks/tweaks/recent_menus_tweak.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
#include <array>
#include <utility>

#include "plugin_utils/qt_compat.h"

using namespace Qt::StringLiterals;

namespace {
Expand Down
3 changes: 1 addition & 2 deletions plugins/uitweaks/tweaks/search_hits_tweak.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,12 @@
#include <QTimer>
#include <QToolBar>
#include <QVariant>
#include <QtLogging>
#include <qdlt/dltmessagematcher.h>
#include <qdlt/qdltfile.h>
#include <qdlt/qdltmsg.h>
#include <qdlt/qdltsettingsmanager.h>

#include "plugin_utils/qt_compat.h"

using namespace Qt::StringLiterals;

struct SearchMatcher {
Expand Down
5 changes: 2 additions & 3 deletions plugins/uitweaks/tweaks/text_color_tweak.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
#include <QPalette>
#include <QStyleOptionViewItem>
#include <QStyledItemDelegate>

#include "plugin_utils/qt_compat.h"
#include <QtLogging>

using namespace Qt::StringLiterals;

Expand Down Expand Up @@ -126,7 +125,7 @@ void TextColorTweak::buildSettings(plugin_utils::SettingsForm& form) {
bool TextColorTweak::eventFilter(QObject* watched, QEvent* event) {
if (event->type() == QEvent::Show && watched->inherits(kFilterDialogClass)) {
watchColorPreview(watched);
} else if (event->type() == QEvent::PaletteChange && color_previews_.contains(qobject_cast<QWidget*>(watched))) {
} else if (event->type() == QEvent::PaletteChange && color_previews_.contains(watched)) {
updateColorPreview(qobject_cast<QWidget*>(watched));
}
return false;
Expand Down
2 changes: 1 addition & 1 deletion plugins/uitweaks/uitweaks_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
#include <array>
#include <cstddef>

#include <QLatin1StringView>
#include <QList>
#include <QStringList>
#include <qdlt/fieldnames.h>

#include "plugin_utils/plugin_info.h"
#include "plugin_utils/qt_compat.h"

#include "tweaks/current_tab_tweak.h"
#include "tweaks/filter_colors_tweak.h"
Expand Down
Loading