Beispiel #1
0
bool KWQQuizModel::init()
{
    if (m_sourceModel == 0)
        return false;

    invalidate();

    //check if enough in list
    bool result = false;
    switch (m_quizType)  {
    case Prefs::EnumStartSession::Editor:
        //
        break;
    case Prefs::EnumStartSession::Flashcard:
        result = (rowCount(QModelIndex()) > 0);
        break;
    case Prefs::EnumStartSession::QA:
        result = (rowCount(QModelIndex()) > 0);
        break;
    case Prefs::EnumStartSession::MultipleChoice:
        result = (rowCount(QModelIndex()) > 2);
        break;
    }

    if (!result)
        return false;

    m_quizList.clear();
    for (int i = 0; i < rowCount(QModelIndex()); ++i) {
        m_quizList.append(i);
        if (m_quizMode == 5)
            m_quizList.append(-i);
    }

    activateBaseList();
    return true;
}
Beispiel #2
0
bool WQQuiz::init()
{

  bool result = false;
  if (Prefs::enableBlanks())
  {
    result = m_table->checkSyntax(true, true);
  }
  else
  {
    result = true;
  }

  if (!result)
  {
    return false;
  }

  int aCol;
  int bCol;

  switch (m_quizMode)
  {
  case 1:
    aCol = 0;
    bCol = 1;
    break;
  case 2:
    aCol = 1;
    bCol = 0;
    break;
  case 3:
    aCol = 0;
    bCol = 1;
    break;
  case 4:
    aCol = 1;
    bCol = 0;
    break;
  case 5:
  default:
    aCol = 0;
    bCol = 1;
    break;
  }

  addToList(aCol, bCol);

  //check if enough in list
  switch (m_quizType)
  {
  case qtEditor:
    //
    break;  
  case qtFlash:
    result = (m_quizList.count() > 0);
    break;
  case qtQA:
    result = (m_quizList.count() > 0);
    break;
  case qtMultiple:
    result = (m_quizList.count() > 2);
    break;
  }

  if (!result)
  {
    return false;
  }

  if (m_quizMode == 5)
  {
    aCol = 1;
    bCol = 0;
    addToList(aCol, bCol);
  }

  //Prepare final lists
  activateBaseList();
  return true;
}