Exemplo n.º 1
0
void Adim::initAdim(const string& keycodeFilename, const string& workbookFilename,
		const string& candidateNumberFilename, 
		size_t numberOfQuestion ,
		bool randomQuestion ,size_t firstQuestionNumber,
		int sizeOfCharacterCode) 
{
	complete_ = false;
	ReadKeycode(keycodeFilename);
	ReadWorkbook(workbookFilename);
	InitKeycodeTableCandidateNumber();
	SetKeycodeTableCandidateNumberFilename(candidateNumberFilename);
	ReadKeycodeTableCandidateNumber();
	numberOfQuestion_ = numberOfQuestion;
	
	do{
		if( randomQuestion ) {
			for(int i=0; i < GetNumberOfWorkbookElement() ; ++i ) {
				numberOfQuestionArray_.push_back(i);
			}
			random_shuffle( numberOfQuestionArray_.begin(),
				numberOfQuestionArray_.end() );		
		}else {
			for(int i=firstQuestionNumber; i < GetNumberOfWorkbookElement() ; ++i ) {
				numberOfQuestionArray_.push_back(i);
			}
			for(int i=0; i < GetNumberOfWorkbookElement() ; ++i ) {
				numberOfQuestionArray_.push_back(i);
			}
		}
	}while( numberOfQuestionArray_.size() < GetNumberOfWorkbookElement() );

	SetQuestion( numberOfQuestionArray_[0] );
	SetSizeOfCharacterCode(sizeOfCharacterCode);
}
Exemplo n.º 2
0
void CWndGuildVote::SelChange(CGuild* pGuild, int nIndex)
{
	GUILD_VOTE_SELECT guildvotesel[4];
	
	CWndComboBox* pCombo = (CWndComboBox*)GetDlgItem(WIDC_COMBOBOX1);
	
	list <CGuildVote*>::iterator it = pGuild->m_votes.begin();
	
	for ( ; it != pGuild->m_votes.end() ; ++it )
	{
		if( (*it)->GetID() == pCombo->GetItemData(nIndex) )
		{
			guildvotesel[0] = (*it)->GetVoteSelect(0);
			guildvotesel[1] = (*it)->GetVoteSelect(1);
			guildvotesel[2] = (*it)->GetVoteSelect(2);
			guildvotesel[3] = (*it)->GetVoteSelect(3);
			
			SetQuestion( (*it)->GetQuestion() );
			break;
		}
	}
	
	SetszString( guildvotesel[0].szString, guildvotesel[1].szString, guildvotesel[2].szString, guildvotesel[3].szString );
	SetCount( guildvotesel[0].cbCount, guildvotesel[1].cbCount, guildvotesel[2].cbCount, guildvotesel[3].cbCount );
}
QtOpenQuestionDialog::QtOpenQuestionDialog(
  const boost::shared_ptr<QuestionDialog>& dialog,
  QWidget *parent)
  : QtQuestionDialog(dialog,parent),
    ui(new Ui::QtOpenQuestionDialog)
    //m_dialog(new OpenQuestionDialog(question))
{
  ui->setupUi(this);
  assert(dialog);
  SetQuestion(dialog->GetQuestion());
}
ribi::QtTestQuestionMainDialog::QtTestQuestionMainDialog(QWidget *parent) :
    QtHideAndShowDialog(parent),
    ui(new Ui::QtTestQuestionMainDialog),
    m_dialog{}
{
  #ifndef NDEBUG
  Test();
  #endif
  ui->setupUi(this);
  SetQuestion("-,1+1=,2,1,3");
}
Exemplo n.º 5
0
//[返却値]
//2 成功 問題文打ち終わった COMPLETE
//1 成功 このまま続行 SUCCESS
//0 失敗 FAILURE
int Adim::InputCharacter(char code)
{
	int result = InputTypewordFromKeyboard(code);

	if( result == COMPLETE ) { //問題文を打ち終わった
		nowNumberOfQuestion_++;
		int num = nowNumberOfQuestion_;
		
		if( num >= GetNumberOfWorkbookElement() )
			num = 0;
		SetQuestion( numberOfQuestionArray_[num] );
		SaveKeycodeTableCandidateNumber(); //キーコードテーブルの保存
		if( nowNumberOfQuestion_ >= numberOfQuestion_ ){
			complete_ = true;
		}
	}
	return result;
}