first commit

This commit is contained in:
2026-01-02 19:20:35 +09:00
commit a10cb30c4a
94 changed files with 28609 additions and 0 deletions

74
widgets/appicon.h Normal file
View File

@@ -0,0 +1,74 @@
#ifndef APPICON_H
#define APPICON_H
#include <QWidget>
#include <QLabel>
#include <QPropertyAnimation>
#include <QGraphicsDropShadowEffect>
struct AppIconData
{
QString id;
QString name;
QString nameEn;
QString icon;
QString color;
QStringList gradient;
QString badge;
QString group; // 分组标识相同group的图标会被框起来
QString description;
QStringList features;
bool warning = false;
};
class AppIcon : public QWidget
{
Q_OBJECT
Q_PROPERTY(qreal scale READ scale WRITE setScale)
public:
explicit AppIcon(const AppIconData &data, QWidget *parent = nullptr);
~AppIcon();
QString appId() const { return m_data.id; }
qreal scale() const { return m_scale; }
void setScale(qreal scale);
signals:
void clicked(const QString &appId);
void longPressed(const QString &appId);
protected:
void paintEvent(QPaintEvent *event) override;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
void enterEvent(QEnterEvent *event) override;
#else
void enterEvent(QEvent *event) override;
#endif
void leaveEvent(QEvent *event) override;
void mousePressEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override;
void timerEvent(QTimerEvent *event) override;
private:
void setupUI();
void animateScale(qreal targetScale, int duration = 100);
QString generateGradientStyle() const;
QString getIconSymbol(const QString &id) const;
AppIconData m_data;
QLabel *m_iconLabel;
QLabel *m_nameLabel;
QLabel *m_badgeLabel;
QGraphicsDropShadowEffect *m_shadowEffect;
qreal m_scale;
bool m_isPressed;
int m_longPressTimerId;
static constexpr int ICON_SIZE = 96;
static constexpr int BORDER_RADIUS = 20;
static constexpr int LONG_PRESS_DELAY = 500;
};
#endif // APPICON_H