File indexing completed on 2024-05-19 04:07:54

0001 /*
0002     SPDX-FileCopyrightText: 2015 Jakob Gruber <jakob.gruber@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef STREAKITEM_H
0008 #define STREAKITEM_H
0009 
0010 #include <QGraphicsTextItem>
0011 
0012 #include "reloadableitem.h"
0013 #include "src/gui/renderer.h"
0014 #include "src/logic/picmi.h"
0015 
0016 class StreakItem : public QGraphicsTextItem, public ReloadableItem
0017 {
0018     Q_OBJECT
0019 public:
0020     StreakItem(int x, int y, QSharedPointer<Picmi> game, QGraphicsItem *parent = nullptr);
0021 
0022     /* update displayed streak */
0023     virtual void refresh() = 0;
0024 
0025     void reload(const QSize &size) override = 0;
0026 
0027 private Q_SLOTS:
0028     void settingChanged(Settings::SettingsType type);
0029 
0030 protected:
0031     int padding(int tilesize) const;
0032     void setFontColors();
0033 
0034     const QSharedPointer<Picmi> m_game;
0035     QString m_color_solved, m_color_unsolved;
0036 };
0037 
0038 class RowStreakItem : public StreakItem {
0039 public:
0040     RowStreakItem(QSharedPointer<Picmi> game, int y, QGraphicsItem *parent = nullptr);
0041 
0042     void refresh() override;
0043     void reload(const QSize &size) override;
0044 };
0045 
0046 class ColStreakItem : public StreakItem {
0047 public:
0048     ColStreakItem(QSharedPointer<Picmi> game, int x, QGraphicsItem *parent = nullptr);
0049 
0050     void refresh() override;
0051     void reload(const QSize &size) override;
0052 };
0053 
0054 #endif // STREAKITEM_H