summaryrefslogtreecommitdiff
path: root/src/study/CardSideView.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/study/CardSideView.h')
-rw-r--r--src/study/CardSideView.h52
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