File indexing completed on 2022-11-22 13:00:59

0001 /*
0002     SPDX-FileCopyrightText: 2014 Andreas Xavier
0003     SPDX-FileCopyrightText: 2014 Inge Wallin <inge@lysator.liu.se>
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef COLLECTIONWIDGET_H
0008 #define COLLECTIONWIDGET_H
0009 
0010 #include <QWidget>
0011 
0012 #include "collection.h"
0013 
0014 #include "barwidget.h"
0015 
0016 // Size constants for the collection widgets
0017 extern int COLLWIDTH; // Width in pixels of a collection widget
0018 extern int COLLHEIGHT1; // Height in pixels of a collection widget not yet fully learned
0019 extern int COLLHEIGHT2; // Height in pixels of a collection widget fully learned
0020 
0021 class QLabel;
0022 class QPushButton;
0023 class RemoveButton;
0024 class Collection;
0025 
0026 class CollectionWidget : public QWidget
0027 {
0028     Q_OBJECT
0029 
0030 public:
0031     CollectionWidget(Collection *collection, WordCount *dueWords, QWidget *parent = 0);
0032     ~CollectionWidget() override;
0033 
0034     Collection *collection() const;
0035     void setCollection(Collection *collection);
0036 
0037     void updateDue();
0038 
0039 Q_SIGNALS:
0040     void practiceButtonClicked();
0041     void removeButtonClicked();
0042 
0043 private:
0044     void setupWidget(WordCount *dueWords);
0045     void fillWidget();
0046 
0047 private:
0048     QLabel *m_titleLabel;
0049     QLabel *m_thumbnail;
0050     BarWidget *m_barWidget;
0051     RemoveButton *m_removeButton;
0052     QPushButton *m_practiceButton;
0053 
0054     Collection *m_collection;
0055 };
0056 
0057 #endif