2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2010-01-04 11:36:55 +01:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2009-07-27 13:55:30 +02:00
|
|
|
|
2014-12-19 12:05:40 +01:00
|
|
|
#include "core_global.h"
|
2009-07-27 13:55:30 +02:00
|
|
|
|
2020-09-21 13:30:57 +02:00
|
|
|
#include <utils/id.h>
|
2014-12-16 12:01:35 +01:00
|
|
|
|
2017-02-24 18:41:22 +01:00
|
|
|
#include <QWidget>
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QObject>
|
2010-11-11 16:49:17 +01:00
|
|
|
|
2017-01-06 21:41:46 +01:00
|
|
|
#include <functional>
|
|
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QPixmap;
|
|
|
|
|
QT_END_NAMESPACE
|
2009-07-27 13:55:30 +02:00
|
|
|
|
2014-12-19 12:05:40 +01:00
|
|
|
namespace Core {
|
2009-07-27 13:55:30 +02:00
|
|
|
|
2014-12-19 12:05:40 +01:00
|
|
|
class CORE_EXPORT IWelcomePage : public QObject
|
2009-07-27 13:55:30 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
2010-11-11 16:49:17 +01:00
|
|
|
Q_PROPERTY(QString title READ title CONSTANT)
|
|
|
|
|
Q_PROPERTY(int priority READ priority CONSTANT)
|
|
|
|
|
|
2009-07-27 13:55:30 +02:00
|
|
|
public:
|
|
|
|
|
IWelcomePage();
|
2018-05-07 15:00:03 +02:00
|
|
|
~IWelcomePage() override;
|
2009-07-27 13:55:30 +02:00
|
|
|
|
|
|
|
|
virtual QString title() const = 0;
|
|
|
|
|
virtual int priority() const { return 0; }
|
2020-06-26 13:59:38 +02:00
|
|
|
virtual Utils::Id id() const = 0;
|
2017-01-06 21:41:46 +01:00
|
|
|
virtual QWidget *createWidget() const = 0;
|
2017-12-08 17:20:48 +01:00
|
|
|
|
|
|
|
|
static const QList<IWelcomePage *> allWelcomePages();
|
2017-01-06 21:41:46 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class WelcomePageButtonPrivate;
|
|
|
|
|
|
2017-02-24 18:41:22 +01:00
|
|
|
class CORE_EXPORT WelcomePageFrame : public QWidget
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
WelcomePageFrame(QWidget *parent);
|
|
|
|
|
|
|
|
|
|
void paintEvent(QPaintEvent *event) override;
|
2021-03-04 11:57:32 +01:00
|
|
|
|
|
|
|
|
static QPalette buttonPalette(bool isActive, bool isCursorInside, bool forText);
|
2017-02-24 18:41:22 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class CORE_EXPORT WelcomePageButton : public WelcomePageFrame
|
2017-01-06 21:41:46 +01:00
|
|
|
{
|
|
|
|
|
public:
|
2021-11-29 20:48:43 +01:00
|
|
|
enum Size {
|
|
|
|
|
SizeSmall,
|
|
|
|
|
SizeLarge,
|
|
|
|
|
};
|
|
|
|
|
|
2017-01-06 21:41:46 +01:00
|
|
|
WelcomePageButton(QWidget *parent);
|
2018-05-07 15:00:03 +02:00
|
|
|
~WelcomePageButton() override;
|
2017-01-06 21:41:46 +01:00
|
|
|
|
|
|
|
|
void mousePressEvent(QMouseEvent *) override;
|
2022-07-13 09:27:18 +02:00
|
|
|
void enterEvent(QEnterEvent *) override;
|
2017-01-06 21:41:46 +01:00
|
|
|
void leaveEvent(QEvent *) override;
|
|
|
|
|
|
|
|
|
|
void setText(const QString &text);
|
2021-11-29 20:48:43 +01:00
|
|
|
void setSize(enum Size);
|
|
|
|
|
void setWithAccentColor(bool withAccent);
|
2017-01-06 21:41:46 +01:00
|
|
|
void setOnClicked(const std::function<void ()> &value);
|
|
|
|
|
void setActiveChecker(const std::function<bool ()> &value);
|
|
|
|
|
void recheckActive();
|
|
|
|
|
void click();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
WelcomePageButtonPrivate *d;
|
2009-07-27 13:55:30 +02:00
|
|
|
};
|
|
|
|
|
|
2014-12-19 12:05:40 +01:00
|
|
|
} // Core
|