/***************************************************************************
                           cubedialog.h
                           -------------------
    copyright            : (C) 2004 by Jos van den Oever
    email                : jos@vandenoever.info
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/
#ifndef CUBEDIALOG_H
#define CUBEDIALOG_H
#include "question.h"
#include <q3vbox.h>
//Added by qt3to4:
#include <QResizeEvent>
#include <QLabel>
#include <QKeyEvent>
#include <list>
using std::list;
class SideStyle;
class ScoreKeeper;
class Cube;
class QLabel;
class QPushButton;
class QCubeLabel;
class CubeDialog : public Q3VBox {
Q_OBJECT
public:
	explicit CubeDialog(QWidget* parent=0, const char* name=0, Qt::WFlags f=0);
	void startQuestions();
	const ScoreKeeper &getScore() const;
	void readQuestions();
	void setSideStyle(const SideStyle *);
	void setQuestion(Question &);
	short blanks;
protected:
	void keyPressEvent(QKeyEvent *);
	void resizeEvent(QResizeEvent *);
private:
	bool autoq;
	bool beforeAnimation;
	bool next;
	bool stopAnimation;
	bool answered;
	bool restoreanswer;
	QLabel *msg;
	ScoreKeeper *score;
	QCubeLabel *sides;
	Cube *cube;
	Cube *answers[4];
	QPushButton *answerButtons[4], *ok, *reset;
	list<Question> questions;
	list<Question>::iterator q;
	const SideStyle *style;
	
	void nextQuestion();
	void setAnswer(short i);
	void stopAnim();
private slots:
	void answerA();
	void answerB();
	void answerC();
	void answerD();
	void afterAnimation();
	void answer();
	void resetQuestion();
	void handleRotation();
signals:
	void finished();
};

#endif
