#include "question.h"
#include <iostream>

Question::Question(QString type)
    : type(type)
{
}

Question::~Question()
{
}

bool Question::loadFromNode(const QDomNode& node)
{
  timer = node.toElement().attribute("duration").toInt();
  for ( QDomNode child = node.firstChild(); ! child.isNull(); child = child.nextSibling() )
  {
     //QDomElement element = child.toElement();
     if ( child.isNull() ) continue;

     if ( child.nodeName() == "text" )
        text = child.toElement().text();
     else if ( child.nodeName() == "answer" )
        answer = child.toElement().text();
  }
  return true;
}

#include <iostream>

void Question::print() const
{
    std::cout << '[' << qPrintable(text) << ": " << qPrintable(answer) << ']' << std::endl;
}

QString Question::getText() const
{
    return text;
}

QString Question::getAnswer() const
{
    return answer;
}

QVector<QString> *Question::getOptions()
{
    return NULL;
}

QString Question::getType() const
{
    return type;
}

void Question::setQuestion(QString quest)
{
    text = quest;
}
