MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { QCoreApplication::setOrganizationName("polyvision UG"); QCoreApplication::setOrganizationDomain("polyvision.org"); QCoreApplication::setApplicationName("RaceLapTimer"); ui->setupUi(this); setWindowTitle(QString("OpenRaceLapTimer by airbirds.de - v%1").arg(RLT_VERSION)); setWindowIcon(QIcon("app_icon.png")); QVBoxLayout *pLayout = new QVBoxLayout(ui->centralWidget); m_pTabWidget = new QTabWidget(); pLayout->addWidget(m_pTabWidget); this->m_pRLTDatabase = RLTDatabase::instance(); m_pConfigurationWidget = new ConfigurationWidget(); m_pConfigurationWidget->setMainWindow(this); this->m_pTabWidget->addTab(m_pConfigurationWidget,"Configuration"); m_pPilotsWidget = new PilotsWidget(); this->m_pTabWidget->addTab(m_pPilotsWidget,"Pilots"); m_pRaceTableWidget = new RaceTableWidget(); this->m_pTabWidget->addTab(m_pRaceTableWidget,"Races"); m_pCurrentRaceWidget = new CurrentRaceWidget(); this->m_pTabWidget->addTab(m_pCurrentRaceWidget,"Current Race"); this->m_pLabelCOMPortStatus = new QLabel(this); this->m_pLabelCOMPortStatus->setText("not connected to COM port"); this->ui->statusBar->addWidget(m_pLabelCOMPortStatus); this->m_pLabelLastIncommingSignal = new QLabel(this); this->m_pLabelLastIncommingSignal->setText("XXX-XXX-XXX"); this->ui->statusBar->addWidget(m_pLabelLastIncommingSignal); connect(CurrentRace::instance(),SIGNAL(pilotDataChanged()),this,SLOT(onCurrentRacePilotDataChanged())); connect(CurrentRace::instance(),SIGNAL(fastedLapChanged()),this,SLOT(onCurrentRaceFastestLapDataChanged())); connect(CurrentRace::instance(),SIGNAL(raceFinished()),this,SLOT(onCurentRaceFinished())); connect(m_pRaceTableWidget,SIGNAL(signalStartRace()),this,SLOT(onStartRaceClicked())); connect(m_pCurrentRaceWidget,SIGNAL(signalStopRace()),this,SLOT(onStopRaceClicked())); connect(m_pCurrentRaceWidget,SIGNAL(signalSimulate(QString)),this,SLOT(onSimulateClicked(QString))); connect(this->ui->actionAbout, SIGNAL(triggered()), this, SLOT(openAboutDialog())); }
bool ClientLobbyRoomProtocol::notifyEvent(Event* event) { assert(m_setup); // assert that the setup exists NetworkString &data = event->data(); assert(data.size()); // assert that data isn't empty uint8_t message_type = data.getUInt8(); Log::info("ClientLobbyRoomProtocol", "Synchronous message of type %d", message_type); switch(message_type) { case LE_KART_SELECTION_UPDATE: kartSelectionUpdate(event); break; case LE_RACE_FINISHED: raceFinished(event); break; case LE_EXIT_RESULT: exitResultScreen(event); break; default: return false; break; } // switch return true; } // notifyEvent
bool ClientLobbyRoomProtocol::notifyEvent(Event* event) { assert(m_setup); // assert that the setup exists if (event->getType() == EVENT_TYPE_MESSAGE) { const NetworkString &data = event->data(); assert(data.size()); // assert that data isn't empty uint8_t message_type = data[0]; if (message_type != 0x03 && message_type != 0x06) return false; // don't treat the event event->removeFront(1); Log::info("ClientLobbyRoomProtocol", "Synchronous message of type %d", message_type); if (message_type == 0x03) // kart selection update kartSelectionUpdate(event); else if (message_type == 0x06) // end of race raceFinished(event); return true; } return false; } // notifyEvent