From 225380044e0eb1c38635f77dfe4548ee3d3747b7 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Thu, 31 Aug 2023 14:20:20 +0300 Subject: [PATCH] Moved out PasswordInput to separate module. --- CMakeLists.txt | 2 ++ ui/widgets/fields/password_input.cpp | 20 ++++++++++++++++++++ ui/widgets/fields/password_input.h | 27 +++++++++++++++++++++++++++ ui/widgets/input_fields.cpp | 9 --------- ui/widgets/input_fields.h | 6 ------ 5 files changed, 49 insertions(+), 15 deletions(-) create mode 100644 ui/widgets/fields/password_input.cpp create mode 100644 ui/widgets/fields/password_input.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 9073bcb..a9dc2d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -202,6 +202,8 @@ PRIVATE ui/widgets/input_fields.h ui/widgets/labels.cpp ui/widgets/labels.h + ui/widgets/fields/password_input.cpp + ui/widgets/fields/password_input.h ui/widgets/fields/time_part_input.cpp ui/widgets/fields/time_part_input.h ui/widgets/menu/menu.cpp diff --git a/ui/widgets/fields/password_input.cpp b/ui/widgets/fields/password_input.cpp new file mode 100644 index 0000000..b0cbd70 --- /dev/null +++ b/ui/widgets/fields/password_input.cpp @@ -0,0 +1,20 @@ +// This file is part of Desktop App Toolkit, +// a set of libraries for developing nice desktop applications. +// +// For license and copyright information please follow this link: +// https://github.com/desktop-app/legal/blob/master/LEGAL +// +#include "ui/widgets/fields/password_input.h" + +namespace Ui { + +PasswordInput::PasswordInput( + QWidget *parent, + const style::InputField &st, + rpl::producer placeholder, + const QString &val) +: MaskedInputField(parent, st, std::move(placeholder), val) { + QLineEdit::setEchoMode(QLineEdit::Password); +} + +} // namespace Ui diff --git a/ui/widgets/fields/password_input.h b/ui/widgets/fields/password_input.h new file mode 100644 index 0000000..30680b7 --- /dev/null +++ b/ui/widgets/fields/password_input.h @@ -0,0 +1,27 @@ +// This file is part of Desktop App Toolkit, +// a set of libraries for developing nice desktop applications. +// +// For license and copyright information please follow this link: +// https://github.com/desktop-app/legal/blob/master/LEGAL +// +#pragma once + +#include "ui/widgets/input_fields.h" + +namespace style { +struct InputField; +} // namespace style + +namespace Ui { + +class PasswordInput final : public MaskedInputField { +public: + PasswordInput( + QWidget *parent, + const style::InputField &st, + rpl::producer placeholder = nullptr, + const QString &val = QString()); + +}; + +} // namespace Ui diff --git a/ui/widgets/input_fields.cpp b/ui/widgets/input_fields.cpp index 06f0f62..0458a70 100644 --- a/ui/widgets/input_fields.cpp +++ b/ui/widgets/input_fields.cpp @@ -4349,15 +4349,6 @@ void MaskedInputField::onCursorPositionChanged(int oldPosition, int position) { _oldcursor = position; } -PasswordInput::PasswordInput( - QWidget *parent, - const style::InputField &st, - rpl::producer placeholder, - const QString &val) -: MaskedInputField(parent, st, std::move(placeholder), val) { - setEchoMode(QLineEdit::Password); -} - NumberInput::NumberInput( QWidget *parent, const style::InputField &st, diff --git a/ui/widgets/input_fields.h b/ui/widgets/input_fields.h index 25dad1d..fd7a832 100644 --- a/ui/widgets/input_fields.h +++ b/ui/widgets/input_fields.h @@ -718,12 +718,6 @@ private: }; -class PasswordInput : public MaskedInputField { -public: - PasswordInput(QWidget *parent, const style::InputField &st, rpl::producer placeholder = nullptr, const QString &val = QString()); - -}; - class NumberInput : public MaskedInputField { public: NumberInput(