2020-10-07 10:36:04 +00:00
|
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
2024-01-01 17:07:58 +00:00
|
|
|
// SPDX-FileCopyrightText: 2020-2024 The Monero Project
|
2020-10-07 10:36:04 +00:00
|
|
|
|
2021-06-27 12:51:15 +00:00
|
|
|
#ifndef FEATHER_COMPONENTS_H
|
|
|
|
#define FEATHER_COMPONENTS_H
|
2020-10-07 10:36:04 +00:00
|
|
|
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QHBoxLayout>
|
|
|
|
#include <QDialog>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QPlainTextEdit>
|
|
|
|
#include <QLineEdit>
|
2023-02-11 17:11:21 +00:00
|
|
|
#include <QListWidget>
|
2020-10-07 10:36:04 +00:00
|
|
|
|
2021-02-03 19:40:35 +00:00
|
|
|
class DoublePixmapLabel : public QLabel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit DoublePixmapLabel(QWidget *parent = nullptr);
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void setAssets(const QString &firstAsset, const QString &secondAsset);
|
|
|
|
void setMode(bool mode);
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool m_mode = false;
|
|
|
|
QPixmap m_first;
|
|
|
|
QPixmap m_second;
|
|
|
|
};
|
|
|
|
|
2020-10-07 10:36:04 +00:00
|
|
|
class StatusBarButton : public QPushButton
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit StatusBarButton(const QIcon &icon, const QString &tooltip, QWidget *parent = nullptr);
|
|
|
|
};
|
|
|
|
|
|
|
|
class HelpLabel : public QLabel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
QFont font;
|
2023-09-12 14:15:40 +00:00
|
|
|
void setHelpText(const QString &text, const QString &informativeText, const QString &doc = "");
|
2020-10-07 10:36:04 +00:00
|
|
|
|
|
|
|
explicit HelpLabel(QWidget * parent);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void mouseReleaseEvent(QMouseEvent *event) override;
|
2022-05-24 15:32:42 +00:00
|
|
|
void enterEvent(QEnterEvent *event) override;
|
2020-10-07 10:36:04 +00:00
|
|
|
void leaveEvent(QEvent *event) override;
|
2023-09-12 14:15:40 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
QString m_text;
|
|
|
|
QString m_informativeText;
|
|
|
|
QString m_doc;
|
2020-10-07 10:36:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class ClickableLabel : public QLabel {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit ClickableLabel(QWidget* parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags());
|
|
|
|
~ClickableLabel() override;
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void clicked();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void mousePressEvent(QMouseEvent* event) override;
|
|
|
|
|
|
|
|
};
|
2021-06-27 12:51:15 +00:00
|
|
|
|
2021-10-22 17:19:56 +00:00
|
|
|
class WindowModalDialog : public QDialog {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit WindowModalDialog(QWidget *parent);
|
|
|
|
};
|
|
|
|
|
2023-09-15 12:29:58 +00:00
|
|
|
class InfoFrame : public QFrame {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit InfoFrame(QWidget *parent);
|
|
|
|
void setInfo(const QIcon &icon, const QString &text);
|
|
|
|
void setText(const QString &text);
|
|
|
|
|
|
|
|
private:
|
|
|
|
QPushButton *m_icon;
|
|
|
|
QLabel *m_infoLabel;
|
|
|
|
};
|
|
|
|
|
2023-12-02 18:28:31 +00:00
|
|
|
class U32Validator : public QValidator {
|
|
|
|
public:
|
|
|
|
U32Validator(QObject *parent = nullptr) : QValidator(parent) {}
|
|
|
|
|
|
|
|
QValidator::State validate(QString &input, int &pos) const override {
|
|
|
|
if (input.isEmpty()) {
|
|
|
|
return QValidator::Intermediate;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ok;
|
|
|
|
qint64 value = input.toLongLong(&ok);
|
|
|
|
|
|
|
|
if (!ok) {
|
|
|
|
return QValidator::Invalid;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (value < 0 || value > UINT32_MAX) {
|
|
|
|
return QValidator::Invalid;
|
|
|
|
}
|
|
|
|
|
|
|
|
return QValidator::Acceptable;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-06-27 12:51:15 +00:00
|
|
|
#endif //FEATHER_COMPONENTS_H
|