Changeset View
Changeset View
Standalone View
Standalone View
libkcardgame/kcardthemewidget_p.h
Show All 34 Lines | |||||
35 | 35 | | |||
36 | 36 | | |||
37 | class PreviewThread : public QThread | 37 | class PreviewThread : public QThread | ||
38 | { | 38 | { | ||
39 | Q_OBJECT | 39 | Q_OBJECT | ||
40 | 40 | | |||
41 | public: | 41 | public: | ||
42 | PreviewThread( const KCardThemeWidgetPrivate * d, const QList<KCardTheme> & themes ); | 42 | PreviewThread( const KCardThemeWidgetPrivate * d, const QList<KCardTheme> & themes ); | ||
43 | void run() Q_DECL_OVERRIDE; | 43 | void run() override; | ||
44 | void halt(); | 44 | void halt(); | ||
45 | 45 | | |||
46 | Q_SIGNALS: | 46 | Q_SIGNALS: | ||
47 | void previewRendered( const KCardTheme & theme, const QImage & image ); | 47 | void previewRendered( const KCardTheme & theme, const QImage & image ); | ||
48 | 48 | | |||
49 | private: | 49 | private: | ||
50 | const KCardThemeWidgetPrivate * const d; | 50 | const KCardThemeWidgetPrivate * const d; | ||
51 | const QList<KCardTheme> m_themes; | 51 | const QList<KCardTheme> m_themes; | ||
52 | bool m_haltFlag; | 52 | bool m_haltFlag; | ||
53 | QMutex m_haltMutex; | 53 | QMutex m_haltMutex; | ||
54 | }; | 54 | }; | ||
55 | 55 | | |||
56 | 56 | | |||
57 | class CardThemeModel : public QAbstractListModel | 57 | class CardThemeModel : public QAbstractListModel | ||
58 | { | 58 | { | ||
59 | Q_OBJECT | 59 | Q_OBJECT | ||
60 | 60 | | |||
61 | public: | 61 | public: | ||
62 | explicit CardThemeModel( KCardThemeWidgetPrivate * d, QObject * parent = nullptr ); | 62 | explicit CardThemeModel( KCardThemeWidgetPrivate * d, QObject * parent = nullptr ); | ||
63 | virtual ~CardThemeModel(); | 63 | virtual ~CardThemeModel(); | ||
64 | 64 | | |||
65 | void reload(); | 65 | void reload(); | ||
66 | QModelIndex indexOf( const QString & dirName ) const; | 66 | QModelIndex indexOf( const QString & dirName ) const; | ||
67 | 67 | | |||
68 | int rowCount( const QModelIndex & parent = QModelIndex() ) const Q_DECL_OVERRIDE; | 68 | int rowCount( const QModelIndex & parent = QModelIndex() ) const override; | ||
69 | QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const Q_DECL_OVERRIDE; | 69 | QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const override; | ||
70 | 70 | | |||
71 | private Q_SLOTS: | 71 | private Q_SLOTS: | ||
72 | void deleteThread(); | 72 | void deleteThread(); | ||
73 | void submitPreview( const KCardTheme & theme, const QImage & image ); | 73 | void submitPreview( const KCardTheme & theme, const QImage & image ); | ||
74 | 74 | | |||
75 | private: | 75 | private: | ||
76 | const KCardThemeWidgetPrivate * const d; | 76 | const KCardThemeWidgetPrivate * const d; | ||
77 | QMap<QString,KCardTheme> m_themes; | 77 | QMap<QString,KCardTheme> m_themes; | ||
78 | QMap<QString,QPixmap*> m_previews; | 78 | QMap<QString,QPixmap*> m_previews; | ||
79 | PreviewThread * m_thread; | 79 | PreviewThread * m_thread; | ||
80 | }; | 80 | }; | ||
81 | 81 | | |||
82 | 82 | | |||
83 | class CardThemeDelegate : public QAbstractItemDelegate | 83 | class CardThemeDelegate : public QAbstractItemDelegate | ||
84 | { | 84 | { | ||
85 | public: | 85 | public: | ||
86 | explicit CardThemeDelegate( KCardThemeWidgetPrivate * d, QObject * parent = nullptr ); | 86 | explicit CardThemeDelegate( KCardThemeWidgetPrivate * d, QObject * parent = nullptr ); | ||
87 | 87 | | |||
88 | void paint( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const Q_DECL_OVERRIDE; | 88 | void paint( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const override; | ||
89 | QSize sizeHint( const QStyleOptionViewItem & option, const QModelIndex & index ) const Q_DECL_OVERRIDE; | 89 | QSize sizeHint( const QStyleOptionViewItem & option, const QModelIndex & index ) const override; | ||
90 | 90 | | |||
91 | private: | 91 | private: | ||
92 | const KCardThemeWidgetPrivate * const d; | 92 | const KCardThemeWidgetPrivate * const d; | ||
93 | }; | 93 | }; | ||
94 | 94 | | |||
95 | 95 | | |||
96 | class KCardThemeWidgetPrivate : public QObject | 96 | class KCardThemeWidgetPrivate : public QObject | ||
97 | { | 97 | { | ||
Show All 32 Lines |