MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); prepareTable(); // WiFi_1 -> WiFi_2 -> LTE -> WiFi_1 QVector<QColor> d = ((MyScene*)ui->graphicsView->scene())->color_data; foreach (QColor temp, d) { QString text; int rand = qrand() % 5; switch (rand) { case 0: case 1: text = "FiFi"; break; case 2: case 3: default: text = "LTE"; break; } text += "_" + QString::number(qrand() % 15); ui->textBrowser->insertHtml(coloredText(text, temp)); }
void GameManager::newRound() { table.setWaitRound(false); if(gameMode != EXIT) { GameConfig conf; conf.sx = 15; conf.sy = 11; conf.sb = 40; if (gameMode == SURVIVE) conf.goal = GOAL_MONSTER; if (gameMode == SINGLE || gameMode == CLASSIC) conf.resetPlayer = false; conf.place = gamePlace; table.setConfig(conf); } if(input.getRun() == false) { gameMode = EXIT; } view.setNow(); if (table.getCalc()) { switch(gameMode) { case SINGLE: { if (nextMap.empty()) nextMap = "maps/map_first.map"; std::cout << nextMap << std::endl; if (loadNextMap) { currMap = nextMap; nextMap = table.loadMap(nextMap); } else table.loadMap(currMap); //table.setStart(0,0,0); break; } case CLASSIC: { table.generateMap(); table.spawnMonster(0); table.spawnMonster(0); table.spawnMonster(1); table.spawnMonster(1); break; } case TEAM: { spawn_monster = view.getNow(); table.generateMap(); break; } case SURVIVE: { spawn_monster = view.getNow(); table.generateBase(); break; } default: { return; } } } else { table.generateBase(); } if(gameMode == EXIT) { input.setRun(false); } else { input.setRun(true); } prepareTable(); printf("manager done\n"); }
QHBoxLayout* StatusViewer::initializeLayout() { QHBoxLayout* mainLayout = new QHBoxLayout(); mainLayout->setSpacing(0); mainLayout->setMargin(0); mainLayout->addStretch(0); //Initialize the mag and qval fields magLabel_ = new QLabel; qvalLabel_ = new QLabel; QFormLayout* rtlayout = new QFormLayout(); rtlayout->setMargin(0); rtlayout->addRow("Calculated Mag: ", magLabel_); rtlayout->addRow("Last QVAL: ", qvalLabel_); phaseResLabel_ = new QLabel; numSpotsLabel_ = new QLabel; QFormLayout* ltlayout = new QFormLayout(); ltlayout->setMargin(0); ltlayout->addRow("Sym. PhaRes: ", phaseResLabel_); ltlayout->addRow("# of spots: ", numSpotsLabel_); QHBoxLayout* layout = new QHBoxLayout(); layout->setSpacing(5); layout->setMargin(0); layout->addLayout(rtlayout); layout->addLayout(ltlayout); //Initialize the bins table binsTable_ = prepareTable(2, 6); binsTable_->horizontalHeader()->hide(); binsTable_->setVerticalHeaderLabels(QStringList() << "Resolution [A]" << "#"); //Initialize the qval table qvalTable_ = prepareTable(4, 7); QStringList labels; labels << tr("IQ1") << tr("IQ2") << tr("IQ3") << tr("IQ4") << tr("IQ5") << tr("IQ6") << tr("QVAL"); qvalTable_->setHorizontalHeaderLabels(labels); qvalTable_->setVerticalHeaderLabels(QStringList() << "Unbend I" << "Unbend II" << "Movie A" << "Movie B"); //Initialize the tilt table tiltTable_ = prepareTable(4, 4); tiltTable_->setVerticalHeaderLabels(QStringList() << tr("Defocus") << tr("Lattice") << tr("Spot Split") << tr("Merge")); tiltTable_->setHorizontalHeaderLabels(QStringList() << "Grid TAxis" << "Grid TAngle" << "Xtal TAxis" << "Xtal TAngle"); //Arrange everything in a layout QVBoxLayout* firstColLayout = new QVBoxLayout(); firstColLayout->setMargin(0); firstColLayout->setSpacing(2); firstColLayout->addLayout(layout); firstColLayout->addStretch(1); firstColLayout->addWidget(new QLabel("Power Bins:")); firstColLayout->addWidget(binsTable_); QWidget* firstCol = new QWidget; firstCol->setLayout(firstColLayout); mainLayout->addWidget(firstCol, 1); mainLayout->addWidget(qvalTable_, 1); mainLayout->addWidget(tiltTable_, 1); return mainLayout; }