/* ======================== idLobby::BecomeHost ======================== */ void idLobby::BecomeHost() { if( !verify( migrationInfo.state == MIGRATE_PICKING_HOST ) ) { idLib::Printf( "BecomeHost: Must be called from PickNewHost.\n" ); EndMigration(); return; } if( IsHost() ) { idLib::Printf( "BecomeHost: Already host of session.\n" ); EndMigration(); return; } if( !sessionCB->BecomingHost( *this ) ) { EndMigration(); return; } idLib::Printf( "BecomeHost: Sending %i invites on %s.\n", migrationInfo.invites.Num(), GetLobbyName() ); migrationInfo.state = MIGRATE_BECOMING_HOST; migrationInfo.migrationStartTime = Sys_Milliseconds(); if( lobbyBackend == NULL ) { // If we don't have a lobbyBackend, then just create one Shutdown(); StartCreating(); return; } // Shutdown the current lobby, but keep the lobbyBackend (we'll migrate it) Shutdown( true ); // Migrate the lobbyBackend to host lobbyBackend->BecomeHost( migrationInfo.invites.Num() ); // Wait for it to complete SetState( STATE_CREATE_LOBBY_BACKEND ); }
Creator::Creator(QWidget *parent) : QWidget(parent) { _modifier = 0; qRegisterMetaType<MessageLevel>("MessageLevel"); qRegisterMetaType<cv::Mat>("cv::Mat"); qRegisterMetaType<CalibrationSet>("CalibrationSet"); qRegisterMetaType<QMatrix4x4>("QMatrix4x4"); qRegisterMetaType<PositionDesc>("PositionDesc"); ui.setupUi(this); // populate values to comboboxes ui.modifierCombo->addItem("None", QVariant(NoneModifier)); ui.modifierCombo->addItem("Canny", QVariant(CannyModifier)); // connections // Global application // shortcuts _shortcuts.push_back(new QShortcut(QKeySequence("Ctrl+s"), this)); _shortcuts.push_back(new QShortcut(QKeySequence("Alt+a"), this)); _shortcuts.push_back(new QShortcut(QKeySequence("Alt+n"), this)); connect(_shortcuts[0], SIGNAL(activated()), this, SLOT(SaveSettings())); connect(_shortcuts[1], SIGNAL(activated()), this, SLOT(AddPoint())); connect(_shortcuts[2], SIGNAL(activated()), this, SLOT(AddNewPoint())); // worker connects connect(this, SIGNAL(modeChangedSignal(int)), _capturer.GetWorker(), SLOT(SetMode(int))); connect(ui.renderer, SIGNAL( DescChangedSignal(PositionDesc&)), this, SLOT(FillActive(PositionDesc&))); // rendered connects connect(ui.renderGroup, SIGNAL(buttonClicked(int)), ui.renderer, SLOT(ChangeRenderStyle(int))); ui.renderGroup->setId(ui.renderPointsButton, RenderPoints); ui.renderGroup->setId(ui.renderWireframeButton, RenderWireframe); ui.renderGroup->setId(ui.renderFullButton, RenderComplete); connect(ui.loadButton, SIGNAL(clicked()), this, SLOT(LoadModel())); connect(ui.renderer, SIGNAL(reportSignal(MessageLevel, const QString &)), ui.infobox, SLOT(Report(MessageLevel, const QString&))); connect(ui.reloadShadersButton, SIGNAL(clicked()), ui.renderer, SLOT(ChangeShaders())); connect(ui.lockGroup, SIGNAL(buttonClicked(int)), ui.renderer, SLOT(ChangeActiveKeyPos(int))); ui.lockGroup->setId(ui.cameraRadioButton, PositionCamera); ui.lockGroup->setId(ui.modelRadioButton, PositionModel); ui.lockGroup->setId(ui.lightRadioButton, PositionLight); // videorender connections connect(ui.applyDescButton, SIGNAL(clicked()), this, SLOT(ChangeActiveDesc())); connect(ui.saveSettingsButton, SIGNAL(clicked(void)), this, SLOT(SaveSettings())); connect(ui.playButton, SIGNAL(clicked(void)), this, SLOT(PlayVideo())); connect(ui.pauseButton, SIGNAL(clicked(void)), this, SLOT(Pause(void))); connect(ui.cloudPoints, SIGNAL(Finished(void)), this, SLOT(EnablePlay())); connect(ui.cloudPoints, SIGNAL(reportSignal(MessageLevel, const QString &)), ui.infobox, SLOT(Report(MessageLevel, const QString&))); connect(ui.createMeshButton, SIGNAL(clicked()),this, SLOT(StartCreating())); //connect(ui.nextFrameButton, SIGNAL(clicked(void)), ui.cloudPoints, SLOT(RequestNextFrame())); //connect(ui.prevFrameButton, SIGNAL(clicked(void)), ui.cloudPoints, SLOT(RequestPrevFrame())); ui.nextFrameButton->setDisabled(true); ui.prevFrameButton->setDisabled(true); connect(ui.stopButton, SIGNAL(clicked(void)), this, SLOT(Stop(void))); connect(ui.featuresCheckbox, SIGNAL(clicked(void)), this, SLOT(FeaturesFromFrame())); connect(ui.stopButton, SIGNAL(clicked(void)), this, SLOT(Stop())); connect(ui.greyCheckBox, SIGNAL(clicked(void)), this, SLOT(ShowGreyFrame(void))); connect(ui.newButton, SIGNAL(clicked(void)), this, SLOT(CreateNew(void))); //calibration connects connect(ui.loadCalibrationButton, SIGNAL(clicked()), this, SLOT(LoadCalibration(void))); connect(ui.runCalibrationButton, SIGNAL(clicked()), this, SLOT(RunCalibration(void))); connect(ui.calibrationFolderButton, SIGNAL(clicked()), this, SLOT(LoadCalibrationImages())); connect(ui.applyCalibrationButton, SIGNAL(clicked()), this, SLOT(SendParameters())); connect(ui.playUndistortedButton, SIGNAL(clicked()), this, SLOT(ShowUndistorted())); connect(ui.saveCalibrationButton, SIGNAL(clicked()), this, SLOT(SaveCalibration())); connect(&_capturer, SIGNAL(imageReadySignal(cv::Mat)), ui.cloudPoints, SLOT(setImage(cv::Mat))); connect(&_capturer, SIGNAL(reportSignal(MessageLevel, const QString &)), ui.cloudPoints, SLOT(Report(MessageLevel, const QString &))); connect(_capturer.GetWorker(), SIGNAL(camParametersSignal(cv::Mat, cv::Mat)), ui.cloudPoints, SLOT(ShowParameters(cv::Mat, cv::Mat))); connect(ui.cloudPoints, SIGNAL(setCalibrationSignal(CalibrationSet)), _capturer.GetWorker(), SLOT(ChangeCalibration(CalibrationSet))); // comparer connects connect(ui.compareNext, SIGNAL(clicked()), this, SLOT(GetNextImagePair())); connect(this, SIGNAL(PreparePairSignal(int, int)), _capturer.GetWorker(), SLOT(PreparePair(int,int))); connect(_capturer.GetWorker(), SIGNAL(imagePairSignal(cv::Mat, cv::Mat)), this, SLOT(SetCompare(cv::Mat, cv::Mat))); connect(ui.applyModifierButton, SIGNAL(clicked()), this, SLOT(SetModifier())); //connect(ui.comparePrev, SIGNAL(clicked()), this, SLOT(GetPrevImagePair())); // rest of the initialization LoadSettings(); }