File indexing completed on 2024-09-15 06:37:37
0001 /* 0002 SPDX-FileCopyrightText: 2007 Paolo Capriotti <p.capriotti@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef STATSWIDGET_H 0008 #define STATSWIDGET_H 0009 0010 #include <QLabel> 0011 #include <QFrame> 0012 #include <QWidget> 0013 #include <QPointer> 0014 0015 class Stats; 0016 class KBSRenderer; 0017 0018 class StatsWidgetElement : public QFrame 0019 { 0020 public: 0021 static const int MARGIN = 5; 0022 static const int BORDER_WIDTH = 2; 0023 static const int BORDER_X = 1; 0024 static const int BORDER_Y = 1; 0025 0026 private: 0027 QLabel *m_icon; 0028 QLabel *m_text; 0029 0030 public: 0031 StatsWidgetElement(const QPixmap &icon, const QString &text, QWidget *parent); 0032 0033 void setText(const QString &text); 0034 void setData(const QPixmap &icon, const QString &text); 0035 0036 protected: 0037 void paintEvent(QPaintEvent *) override; 0038 }; 0039 0040 class StatsWidget : public QWidget 0041 { 0042 Q_OBJECT 0043 private: 0044 QPointer<Stats> m_stats; 0045 0046 StatsWidgetElement* m_elements[2]; 0047 public: 0048 StatsWidget(KBSRenderer* renderer, QWidget* parent); 0049 0050 void setWidth(int width); 0051 void setData(Stats*); 0052 public Q_SLOTS: 0053 void refresh(); 0054 }; 0055 0056 0057 #endif // STATSWIDGET_H