From 6851046c5a797f084fab2a249690513aecdce891 Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Wed, 24 Dec 2025 10:31:57 -0500 Subject: [PATCH] refactor: validatorError, make clear a private method --- src/lib/gui/validators/ValidationError.cpp | 24 ++++++++++------------ src/lib/gui/validators/ValidationError.h | 2 ++ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/lib/gui/validators/ValidationError.cpp b/src/lib/gui/validators/ValidationError.cpp index 980d88d32..4493291f5 100644 --- a/src/lib/gui/validators/ValidationError.cpp +++ b/src/lib/gui/validators/ValidationError.cpp @@ -1,5 +1,6 @@ /* * Deskflow -- mouse and keyboard sharing utility + * SPDX-FileCopyrightText: (C) 2025 Deskflow Developers * SPDX-FileCopyrightText: (C) 2024 Symless Ltd. * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception */ @@ -12,20 +13,9 @@ using namespace deskflow::gui; namespace validators { -void clear(QLabel *label) -{ - if (label) { - label->setStyleSheet(kStyleErrorInactiveLabel); - label->setText(""); - } -} - ValidationError::ValidationError(QObject *parent, QLabel *label) : QObject(parent), m_label(label) { - - if (m_label) { - clear(m_label); - } + clear(); } const QString &ValidationError::message() const @@ -39,7 +29,7 @@ void ValidationError::setMessage(const QString &message) if (m_label) { if (message.isEmpty()) { - clear(m_label); + clear(); } else { m_label->setStyleSheet(kStyleErrorActiveLabel); m_label->setText(message); @@ -47,4 +37,12 @@ void ValidationError::setMessage(const QString &message) } } +void ValidationError::clear() +{ + if (!m_label) + return; + m_label->setStyleSheet(kStyleErrorInactiveLabel); + m_label->setText({}); +} + } // namespace validators diff --git a/src/lib/gui/validators/ValidationError.h b/src/lib/gui/validators/ValidationError.h index 9679e7862..3d049a2ad 100644 --- a/src/lib/gui/validators/ValidationError.h +++ b/src/lib/gui/validators/ValidationError.h @@ -1,5 +1,6 @@ /* * Deskflow -- mouse and keyboard sharing utility + * SPDX-FileCopyrightText: (C) 2025 Deskflow Developers * SPDX-FileCopyrightText: (C) 2024 Symless Ltd. * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception */ @@ -20,6 +21,7 @@ public: void setMessage(const QString &message); private: + void clear(); QString m_message; QLabel *m_label = nullptr; };