SimulateTrafficDialog::SimulateTrafficDialog(std::shared_ptr<Router> r, std::shared_ptr<IController> editor, QMainWindow *widget) : QDialog(widget) { nodesEditor = editor; id = r->getId(); router = r; router->attach(this); view = widget; repopulateFecList(); this->setAttribute(Qt::WA_DeleteOnClose); mainLayout = new QVBoxLayout; mainLayout->setSizeConstraint(QLayout::SetFixedSize); QHBoxLayout *firstLayout = new QHBoxLayout; QHBoxLayout *secondLayout = new QHBoxLayout; QHBoxLayout *thirdLayout = new QHBoxLayout; setLayout(mainLayout); mainLayout->addLayout(firstLayout); mainLayout->addLayout(secondLayout); mainLayout->addLayout(thirdLayout); fecComboBox = new QComboBox; fillFecComboBox(fecComboBox); firstLayout->addWidget(fecComboBox); startButton = new QPushButton(tr("Start")); stopButton = new QPushButton(tr("Stop")); secondLayout->addWidget(startButton); secondLayout->addWidget(stopButton); prevButton = new QPushButton(tr("Prev")); nextButton = new QPushButton(tr("Next")); thirdLayout->addWidget(prevButton); thirdLayout->addWidget(nextButton); connect(startButton, SIGNAL(pressed()), this, SLOT(handleStartButton())); connect(stopButton, SIGNAL(pressed()), this, SLOT(handleStopButton())); connect(prevButton, SIGNAL(pressed()), this, SLOT(handlePrevButton())); connect(nextButton, SIGNAL(pressed()), this, SLOT(handleNextButton())); stopButton->setEnabled(false); prevButton->setEnabled(false); nextButton->setEnabled(false); this->setWindowTitle("Trafiic simulation"); }
void Game::handleHelpFirst() { SDL_Event helpEvent; while(SDL_PollEvent(&helpEvent) != 0) { if(helpEvent.type == SDL_QUIT) { running = false; } if((helpEvent.type == SDL_MOUSEBUTTONDOWN) && (helpEvent.button.button == SDL_BUTTON_LEFT)) { handleBackToGameButton(helpEvent); handleNextFirstButton(helpEvent); handlePrevButton(helpEvent); } } }