File indexing completed on 2024-12-22 04:45:35

0001 /*
0002    SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "libruqolawidgets_private_export.h"
0010 #include <QDebug>
0011 #include <QIcon>
0012 #include <QUrl>
0013 #include <QWidget>
0014 class QLineEdit;
0015 class KUrlRequester;
0016 class QLabel;
0017 class LIBRUQOLAWIDGETS_TESTS_EXPORT AdministratorCustomEmojiCreateOrUpdateWidget : public QWidget
0018 {
0019     Q_OBJECT
0020 public:
0021     enum AdministratorCustomEmojiCreateOrUpdateType {
0022         Create,
0023         Update,
0024     };
0025 
0026     struct CustomEmojiCreateInfo {
0027         QString alias;
0028         QString name;
0029         QUrl fileNameUrl;
0030         QIcon icon;
0031     };
0032     explicit AdministratorCustomEmojiCreateOrUpdateWidget(QWidget *parent = nullptr);
0033     ~AdministratorCustomEmojiCreateOrUpdateWidget() override;
0034 
0035     void setCustomEmojiInfo(const CustomEmojiCreateInfo &info);
0036 
0037     [[nodiscard]] AdministratorCustomEmojiCreateOrUpdateWidget::CustomEmojiCreateInfo info() const;
0038 
0039     [[nodiscard]] AdministratorCustomEmojiCreateOrUpdateType type() const;
0040     void setType(AdministratorCustomEmojiCreateOrUpdateType newType);
0041 
0042 Q_SIGNALS:
0043     void updateOkButton(bool enabled);
0044 
0045 private:
0046     LIBRUQOLAWIDGETS_NO_EXPORT void slotUpdateOkButton();
0047     LIBRUQOLAWIDGETS_NO_EXPORT void slotAddNewEmoji();
0048     // Set AdministratorCustomEmojiCreateOrUpdateType as Create
0049     AdministratorCustomEmojiCreateOrUpdateType mType = AdministratorCustomEmojiCreateOrUpdateType::Create;
0050     QLineEdit *const mName;
0051     QLineEdit *const mAlias;
0052     KUrlRequester *const mSelectFile;
0053     QLabel *const mWarningLabel;
0054     QLabel *const mIconLabel;
0055 };
0056 LIBRUQOLAWIDGETS_EXPORT QDebug operator<<(QDebug d, const AdministratorCustomEmojiCreateOrUpdateWidget::CustomEmojiCreateInfo &t);