diff options
author | Jedidiah Barber <contact@jedbarber.id.au> | 2021-07-14 11:49:10 +1200 |
---|---|---|
committer | Jedidiah Barber <contact@jedbarber.id.au> | 2021-07-14 11:49:10 +1200 |
commit | d24f813f3f2a05c112e803e4256b53535895fc98 (patch) | |
tree | 601e6ae9a1cd44bcfdcf91739a5ca36aedd827c9 /src/study/CardSideView.h |
Diffstat (limited to 'src/study/CardSideView.h')
-rw-r--r-- | src/study/CardSideView.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/study/CardSideView.h b/src/study/CardSideView.h new file mode 100644 index 0000000..c67ebe4 --- /dev/null +++ b/src/study/CardSideView.h @@ -0,0 +1,52 @@ +#ifndef CARDSIDEVIEW_H +#define CARDSIDEVIEW_H + +#include <QLabel> + +class CardPack; +class FieldStyle; +class Field; + +class CardSideView : public QLabel +{ + Q_OBJECT +public: + CardSideView( bool aMode = QstMode ); + void setPack( const CardPack* pack ); + void setQstAnsr( const QString aQuestion, const QStringList aAnswers ); + void setQuestion( const QString aQuestion ); + void setShowMode( bool aMode ); + QSize sizeHint() const; + QString getFormattedText() const; + void showNewIcon(bool visible); + +public: + static const bool QstMode = true; + static const bool AnsMode = false; + +public slots: + void setEnabled( bool aEnabled ); + +protected: + void resizeEvent(QResizeEvent* event); + +private: + void updateText(); + void setBackgroundVisible( bool aVisible ); + QString formattedField( const QString aField, const QString aStyle ) const; + QString highlightKeyword( const QString aText, const FieldStyle& fieldStyle ) const; + QString getHighlighting(const FieldStyle& fieldStyle) const; + QString getFormattedQuestion() const; + QString getFormattedAnswer() const; + QString getFormattedAnswerField(const Field* field, int index) const; + void updateNewIconPos(); + +private: + bool m_showMode; + const CardPack* cardPack; + QString m_question; + QStringList m_answers; + QLabel* newIcon; +}; + +#endif |