bool SGMSSAAppController::startup() { // Initialize AMBeamline::bl() as an SGMBeamline::sgm() instance. FIRST! SGMBeamline::sgm(); if(AMAppController::startup()) { // Testing and making the first run in the database, if there isn't one already. Make this it's own function if you think startup() is getting too big ; ) //////////////////////////////////////// AMRun existingRun; if(!existingRun.loadFromDb(AMDatabase::database("user"), 1)) { // no run yet... let's create one. AMRun firstRun("SGM", 3); /// \todo For now, we know that 5 is the ID of the REIXS facility, but this is a hardcoded hack. firstRun.storeToDb(AMDatabase::database("user")); } // Create panes in the main window: //////////////////////////////////// mw_->insertHeading("Beamline Control", 0); ////////// /* samplePositionView_ = new AMSampleManagementWidget(new SGMSampleManipulatorView(), QUrl("http://ccd1611-403/axis-cgi/mjpg/video.cgi?resolution=1280x1024&.mjpg"), SGMBeamline::sgm()->currentSamplePlate()); mw_->addPane(samplePositionView_, "Beamline Control", "SGM Sample Position", ":/system-software-update.png"); connect(samplePositionView_, SIGNAL(newSamplePlateSelected(AMSamplePlate*)), SGMBeamline::sgm(), SLOT(setCurrentSamplePlate(AMSamplePlate*))); connect(SGMBeamline::sgm(), SIGNAL(currentSamplePlateChanged(AMSamplePlate*)), workflowManagerView_, SLOT(setCurrentSamplePlate(AMSamplePlate*))); */ sampleManipulatorView_ = new SGMSampleManipulatorView(true); mw_->addPane(sampleManipulatorView_, "Beamline Control", "SGM Sample Position", ":/system-software-update.png"); connect(SGMBeamline::sgm(), SIGNAL(criticalControlsConnectionsChanged()), this, SLOT(onSGMBeamlineConnected())); /*! \todo: hook up bottom-bar signals to the active scan controller. void MainWindow::onScanControllerReady(AMScanController *scanController){ connect(bottomBar_, SIGNAL(pauseScanIssued()), scanController, SLOT(pause())); connect(bottomBar_, SIGNAL(stopScanIssued()), scanController, SLOT(cancel())); connect(scanController, SIGNAL(progress(double,double)), bottomBar_, SLOT(updateScanProgress(double,double))); } */ sgmSidebar_ = new SGMSidebar(); mw_->addRightWidget(sgmSidebar_); mw_->move(0, 0); return true; } else return false; }
void TupMainWindow::setupSettingsActions() { TAction *wizard = new TAction(tr("Launch configuration wizard..."), QKeySequence(), qobject_cast<TupApplication*>(qApp), SLOT(firstRun()), m_actionManager, "wizard"); wizard->setStatusTip(tr("Launch first configuration wizard")); TAction * preferences = new TAction(QPixmap(THEME_DIR + "icons/properties.png"), tr("Pr&eferences..."), QKeySequence(tr("Ctrl+P")), this, SLOT( preferences()), m_actionManager, "preferences"); preferences->setStatusTip(tr("Opens the preferences dialog box")); }
static void tryAutoLoad(MainWindow &mw) { const auto &config = getConfig(); const auto &settings = config.autoLoad; if (settings.autoLoadMap && !settings.fileName.isEmpty()) { tryLoad(mw, QDir{settings.lastMapDirectory}, settings.fileName, false); } else if (config.general.firstRun) { firstRun(mw); } }
void SabreController::begin(uint8_t mode, uint8_t f_clock) { sabreDAC.begin(mode, f_clock, 0, true); // (mono/stereo, clock frequency, default attenuation, keep muted) if (firstRun()) { resetInputNames(); applyDefaultSettings(); for (uint8_t i = 0; i < NUMBER_OF_INPUTS; i++) { writeInputConfiguration(i); } writeMainMenuSettings(); EEPROM.write(EEPROM_GUI_FIRST_RUN, FIRST_RUN); // write flag to EEPROM } else { readInputConfiguration(); // read the input config from the EEPROM readMainMenuSettings(); // read the main menu settings from the EEPROM } // dac stuff this->SelectedInput = EEPROM.read(EEPROM_SELECTED_INPUT); applyInputConfiguration(this->SelectedInput); sabreDAC.setAttenuation(this->MainMenuSettings.defaultAttenuation); // gui stuff this->GUI_State = HomeScreen; this->SelectedInputSetting = InputName; this->SelectedMenuSetting = DisplayAutoOff; this->CursorPosition = 0; this->TimerEnabled = false; OLED.begin(20, 4); // initialize the 20x4 OLED rtc.begin(); // initialize the rtc if (!rtc.isrunning()) { rtc.adjust(DateTime(2014, 1, 1, 0, 0)); // set the date to 1 January 2014 and time to 12:00 hrs } // finally unmute the dacs sabreDAC.unMuteDACS(); }