From d24f813f3f2a05c112e803e4256b53535895fc98 Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Wed, 14 Jul 2021 11:49:10 +1200 Subject: Initial mirror commit --- src/study/CardSideView.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 src/study/CardSideView.h (limited to 'src/study/CardSideView.h') 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 + +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 -- cgit