void Private::setupGameSignals() { QObject *root = m_view.rootObject(); if ( root ) { m_parent->connect( root, SIGNAL(browseMapButtonClicked()), m_parent, SLOT(browseMapButtonClicked()) ); QObject *gameOptions = root->findChild<QObject*>(QStringLiteral("gameOptions")); m_parent->connect( gameOptions, SIGNAL(nextButtonClicked()), m_parent, SLOT(createQuestion()) ); m_parent->connect( gameOptions, SIGNAL(gameClosed()), m_parent, SLOT(disableGames()) ); // For "Identify the highlighted country" game m_parent->connect( gameOptions, SIGNAL(countryByShapeGameRequested()), m_parent, SLOT(enableCountryShapeGame()) ); m_parent->connect( m_countryByShape, SIGNAL(gameInitialized()), m_parent, SLOT(createQuestion()) ); // For "Identify the flag" game m_parent->connect( gameOptions, SIGNAL(countryByFlagGameRequested()), m_parent, SLOT(enableCountryFlagGame()) ); m_parent->connect( m_countryByFlag, SIGNAL(gameInitialized()), m_parent, SLOT(createQuestion()) ); // For "Click on that country" game m_parent->connect( gameOptions, SIGNAL(clickOnThatGameRequested()), m_parent, SLOT(enableClickOnThatGame()) ); m_parent->connect( m_clickOnThat, SIGNAL(gameInitialized()), m_parent, SLOT(createQuestion()) ); m_parent->connect( gameOptions, SIGNAL(answerDisplayButtonClicked()), m_clickOnThat, SLOT(highlightCorrectAnswer()) ); } }
// Protoype function // Main method int main() { // Create a monitor and register function for it monitor = newMonitor(); // Create a server manager ans register function for it manager = newServerManager(); // Register function for manager question = createQuestion(); // Now run server // Create server Server server; init(&server,&monitor,&manager,question); // Register processing function for server //Now run server.run(&server); return 0; }