void ShortIntValueFieldWidget::valueUpdated(int value)
{
    if (value == adjustRealToDisplayed(m_wrapper->getValue())) {
        return;
    }

    assert(isEditEnabled());
    m_wrapper->setValue(adjustDisplayedToReal(value));
    refresh();
    emitFieldUpdated();
}
Exemple #2
0
void System::setRunning(bool running) {
  if (running) {
    dev_fgcolor = -DEFAULT_FOREGROUND;
    dev_bgcolor = -DEFAULT_BACKGROUND;
    setDimensions();
    dev_clrkb();
    _output->setAutoflush(!opt_show_page);
    if (_mainBas || isNetworkLoad() || !isEditEnabled()) {
      _loadPath.clear();
    }
    _userScreenId = -1;
  } else {
    osd_clear_sound_queue();
    if (!isClosing() && !isRestart() && !isBack()) {
      _state = kActiveState;
      _output->setAutoflush(true);
    }
  }
}
void OptionalFieldWidget::availabilityChanged(int state)
{
    Mode mode = Mode::Tentative;
    if (state == Qt::Unchecked) {
        mode = Mode::Missing;
    }
    else {
        mode = Mode::Exists;
    }

    if (mode == m_wrapper->getMode()) {
        return;
    }

    if (!isEditEnabled()) {
        refreshInternal();
        return;
    }

    m_wrapper->setMode(mode);
    refresh();
    emitFieldUpdated();
}
Exemple #4
0
void System::runMain(const char *mainBasPath) {
  logEntered();

  // activePath provides the program name after termination
  String activePath = mainBasPath;
  _loadPath = mainBasPath;
  _mainBas = true;
  strcpy(opt_command, "welcome");

  bool started = execute(_loadPath);
  if (!started) {
    alert("Error", gsb_last_errmsg);
    _state = kClosingState;
  }

  while (!isClosing() && started) {
    if (isRestart()) {
      _loadPath = activePath;
      _state = kActiveState;
    } else {
      if (fileExists(_loadPath)) {
        _mainBas = false;
        activePath = _loadPath;
        if (!isEditReady()) {
          setupPath(_loadPath);
        }
      } else {
        _mainBas = true;
        _loadPath = mainBasPath;
        activePath = mainBasPath;
      }
    }

    if (!_mainBas && isEditReady() && loadSource(_loadPath)) {
      editSource(_loadPath);
      if (isBack()) {
        _loadPath.clear();
        _state = kActiveState;
        continue;
      } else if (isClosing()) {
        break;
      }
    }

    bool success = execute(_loadPath);
    bool networkFile = isNetworkLoad();
    if (!isBack() && !isClosing() &&
        (success || networkFile || !isEditEnabled())) {
      // when editing, only pause here when successful, otherwise the editor shows
      // the error. load the next network file without displaying the previous result
      if (!_mainBas && !networkFile) {
        // display an indication the program has completed
        showCompletion(success);
      }
      if (!success) {
        if (_mainBas) {
          // unexpected error in main.bas
          alert("", gsb_last_errmsg);
          _state = kClosingState;
        } else {
          // don't reload
          _loadPath.clear();
          _state = kActiveState;
        }
      }
      if (!_mainBas && !networkFile) {
        waitForBack();
      }
    }
  }
}
void ShortIntValueFieldWidget::editEnabledUpdatedImpl()
{
    bool readonly = !isEditEnabled();
    m_ui.m_valueSpinBox->setReadOnly(readonly);
    m_ui.m_serValueLineEdit->setReadOnly(readonly);
}
void OptionalFieldWidget::editEnabledUpdatedImpl()
{
    assert(m_field != nullptr);
    m_field->setEditEnabled(isEditEnabled());
}
void ArrayListRawDataFieldWidget::editEnabledUpdatedImpl()
{
    bool readonly = !isEditEnabled();
    m_ui.m_valuePlainTextEdit->setReadOnly(readonly);
}