/** * The Settings-Button was pressed. Stop the computation, display the settings * dialog. The user might adjust the crop region that the ComputationWorker processes * or the URL of the camera server might change, so we need to reinitiate the * ComputationWorker afterwards, to ensure the new settings are used accordingly. */ void MainWindow::actionSettingsPressed(bool) { deleteComputation(); SettingsDialog d(this); d.exec(); initComputation(); }
void ConfigStat::compute() { deleteComputation(); initComputation(); computeDistanceMatrix(); computeCenter(); computeCentroid(); computeBetweennessCenter(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), settings("FRSEM", "HolMOS GUI") { ui->setupUi(this); bool settingsNew = settings.value("misc/settingsNew", true).value<bool>(); if(settingsNew) { // Initialize default values settings.setValue("capture/camUrl", "http://127.0.0.1:3000"); settings.setValue("capture/cropX", -1); settings.setValue("capture/cropY", -1); settings.setValue("satellite/rect_x", 0); settings.setValue("satellite/rect_y", 0); settings.setValue("satellite/rect_r", 0); settings.setValue("misc/settingsNew", false); settings.setValue("misc/enable_3d", false); settings.sync(); } // Start the computation worker in the background initComputation(); threedEnabled = settings.value("misc/enable_3d", false).value<bool>(); connect(ui->sliderRectX, SIGNAL(valueChanged(int)), this, SLOT(sliderRectXChanged(int))); connect(ui->sliderRectY, SIGNAL(valueChanged(int)), this, SLOT(sliderRectYChanged(int))); connect(ui->sliderRectR, SIGNAL(valueChanged(int)), this, SLOT(sliderRectRChanged(int))); connect(ui->phaseUnwrapCheck, SIGNAL(stateChanged(int)), this, SLOT(phaseUnwrapCheckChanged(int))); connect(&satelliteSelector, SIGNAL(pointSelected(QPoint)), this, SLOT(satellitePointSelected(QPoint))); connect(ui->actionSettings, SIGNAL(triggered(bool)), this, SLOT(actionSettingsPressed(bool))); ui->scrollAreaTab1->setWidget(&cameraViewer); ui->scrollAreaTab2->setWidget(&satelliteSelector); ui->scrollArea_3->setWidget(&phaseViewer); if(threedEnabled) { threedViewer = new MOpenGLWidget(); ui->verticalLayout_4->addWidget(threedViewer); connect(ui->heightScale, SIGNAL(valueChanged(int)), this, SLOT(sliderHeightChanged(int))); } /* Setup start/stop computation button */ ui->mainToolBar->addAction(ui->actionCompute); ui->actionCompute->setIcon(QIcon::fromTheme("media-playback-start-symbolic")); connect(ui->actionCompute, SIGNAL(triggered(bool)), this, SLOT(computeButtonPressed())); }
void MainWindow::computeButtonPressed() { // Toggle button state if(!computeButtonRunning) { // Button displays start, should start ct qDebug() << "Requested ct start"; initComputation(); } else { // Button displays stop, should stop ct qDebug() << "Requested ct stop"; deleteComputation(); } }