clang-tidy warning fixes

This commit is contained in:
2020-11-03 04:23:01 +03:00
parent e81d765098
commit 91abbdcd96
99 changed files with 392 additions and 436 deletions

View File

@ -118,34 +118,35 @@ QString DPAdds::toolTipImage(const int _desktop) const
toolTipView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
// update
float margin = 5.0f * info.desktop.width() / 400.0f;
toolTipView->resize(static_cast<int>(info.desktop.width() + 2.0f * margin),
static_cast<int>(info.desktop.height() + 2.0f * margin));
auto width = static_cast<float>(info.desktop.width());
auto height = static_cast<float>(info.desktop.height());
float margin = 5.0f * width / 400.0f;
toolTipView->resize(static_cast<int>(width + 2.0f * margin),
static_cast<int>(height + 2.0f * margin));
toolTipScene->clear();
toolTipScene->setBackgroundBrush(QBrush(Qt::NoBrush));
// borders
toolTipScene->addLine(0, 0, 0, info.desktop.height() + 2.0 * margin);
toolTipScene->addLine(0, info.desktop.height() + 2.0 * margin,
info.desktop.width() + 2.0 * margin,
info.desktop.height() + 2.0 * margin);
toolTipScene->addLine(info.desktop.width() + 2.0 * margin, info.desktop.height() + 2.0 * margin,
info.desktop.width() + 2.0 * margin, 0);
toolTipScene->addLine(info.desktop.width() + 2.0 * margin, 0, 0, 0);
toolTipScene->addLine(0, 0, 0, height + 2.0 * margin);
toolTipScene->addLine(0, height + 2.0 * margin, width + 2.0 * margin, height + 2.0 * margin);
toolTipScene->addLine(width + 2.0 * margin, height + 2.0 * margin, width + 2.0 * margin, 0);
toolTipScene->addLine(width + 2.0 * margin, 0, 0, 0);
if (m_tooltipType == "contours") {
QPen pen = QPen();
pen.setWidthF(2.0 * info.desktop.width() / 400.0);
pen.setWidthF(2.0 * width / 400.0);
pen.setColor(QColor(m_tooltipColor));
for (auto &data : info.windowsData) {
QRect rect = data.rect;
toolTipScene->addLine(rect.left() + margin, rect.bottom() + margin,
rect.left() + margin, rect.top() + margin, pen);
toolTipScene->addLine(rect.left() + margin, rect.top() + margin, rect.right() + margin,
rect.top() + margin, pen);
toolTipScene->addLine(rect.right() + margin, rect.top() + margin, rect.right() + margin,
rect.bottom() + margin, pen);
toolTipScene->addLine(rect.right() + margin, rect.bottom() + margin,
rect.left() + margin, rect.bottom() + margin, pen);
auto left = static_cast<float>(rect.left());
auto right = static_cast<float>(rect.right());
auto top = static_cast<float>(rect.top());
auto bottom = static_cast<float>(rect.bottom());
toolTipScene->addLine(left + margin, bottom + margin, left + margin, top + margin, pen);
toolTipScene->addLine(left + margin, top + margin, right + margin, top + margin, pen);
toolTipScene->addLine(right + margin, top + margin, right + margin, bottom + margin,
pen);
toolTipScene->addLine(right + margin, bottom + margin, left + margin, bottom + margin,
pen);
}
} else if (m_tooltipType == "clean") {
QScreen *screen = QGuiApplication::primaryScreen();

View File

@ -45,15 +45,15 @@ public:
~DPAdds() override;
Q_INVOKABLE static bool isDebugEnabled();
Q_INVOKABLE static int currentDesktop();
Q_INVOKABLE static QStringList dictKeys(const bool _sorted = true, const QString &_regexp = "");
Q_INVOKABLE static QStringList dictKeys(bool _sorted = true, const QString &_regexp = "");
Q_INVOKABLE static int numberOfDesktops();
Q_INVOKABLE QString toolTipImage(const int _desktop) const;
Q_INVOKABLE QString parsePattern(const QString &_pattern, const int _desktop) const;
Q_INVOKABLE [[nodiscard]] QString toolTipImage(int _desktop) const;
Q_INVOKABLE [[nodiscard]] QString parsePattern(const QString &_pattern, int _desktop) const;
// values
Q_INVOKABLE void setMark(const QString &_newMark);
Q_INVOKABLE void setToolTipData(const QVariantMap &_tooltipData);
Q_INVOKABLE static QString infoByKey(const QString &_key);
Q_INVOKABLE QString valueByKey(const QString &_key, int _desktop = -1) const;
Q_INVOKABLE [[nodiscard]] QString valueByKey(const QString &_key, int _desktop = -1) const;
// configuration slots
Q_INVOKABLE static QString getAboutText(const QString &_type);
Q_INVOKABLE static QVariantMap getFont(const QVariantMap &_defaultFont);
@ -64,10 +64,10 @@ signals:
public slots:
Q_INVOKABLE static void sendNotification(const QString &_eventId, const QString &_message);
Q_INVOKABLE static void setCurrentDesktop(const int _desktop);
Q_INVOKABLE static void setCurrentDesktop(int _desktop);
private:
static DesktopWindowsInfo getInfoByDesktop(const int _desktop);
static DesktopWindowsInfo getInfoByDesktop(int _desktop);
// variables
int m_tooltipWidth = 200;
QString m_mark = "*";