Esempio n. 1
0
  // @mfunc Open this <c OMFile>.
  //   @precondition <f !isOpen()>
  //   @precondition <f !isClosed()>
  //   @postcondition <f isOpen()>
void OMFile::open(void)
{
  TRACE("OMFile::open");
  PRECONDITION("Not already open", !isOpen());
  PRECONDITION("Never been opened", !isClosed());
  PRECONDITION("Valid mode", (_mode == readOnlyMode) ||
                             (_mode == writeOnlyMode) ||
                             (_mode == modifyMode));

  if (_isNew) { // new file - create
    ASSERT("Correct mode for new file", _mode != readOnlyMode);
    if (_mode == modifyMode) {
      createModify();
    } else { // _mode == writeOnly
      createWrite();
    }
  } else {      // existing file - open
    ASSERT("Correct mode for existing file", (_mode == readOnlyMode) ||
                                             (_mode == modifyMode));
    if (_mode == readOnlyMode) {
      openRead();
    } else { // _mode == modifyMode
      openModify();
    }
    ASSERT("No root object", _root == 0);
    _root = restoreRoot();
  }

  _isOpen = true;
  POSTCONDITION("Open", isOpen());
}
Esempio n. 2
0
CWindowHandler::CWindowHandler()
{
    widget = new QMainWindow;
    ui.setupUi(widget);
    QStringList recipeList = CLoaderRecipe::getLoaderRecipe()->getCategorie();
    for (int i = 0; i<recipeList.size(); ++i)
        ui.comboBoxCategorie->addItem(recipeList[i]);
    recipeList = CLoaderRecipe::getLoaderRecipe()->getDescription(ui.comboBoxCategorie->currentText());
    for (int i = 0; i<recipeList.size(); ++i)
        ui.comboBoxName->addItem(recipeList[i]);
    loadColor(0);
    QObject::connect(ui.comboBoxCategorie, SIGNAL(currentIndexChanged(int)), this, SLOT(changeName(int)));
    QObject::connect(ui.comboBoxName, SIGNAL(currentIndexChanged(int)), this, SLOT(loadColor(int)));
    QObject::connect(ui.actionAjouter, SIGNAL(triggered()), this, SLOT(openAdd()));
    QObject::connect(ui.actionModifier, SIGNAL(triggered()), this, SLOT(openModify()));
    QObject::connect(ui.actionSupprimer, SIGNAL(triggered()), this, SLOT(openDelete()));
    //ui.labelBaseColorHex->setStyleSheet("QLabel { background-color : rgb(255, 255, 255);}");
    //ui.labelLumiere1ColorHex->setStyleSheet("QLabel { background-color : rgb(255, 255, 255);}");
    //ui.labelOmbre1ColorHex->setStyleSheet("QLabel { background-color : rgb(255, 255, 255);}");
    //ui.labelOmbre2ColorHex->setStyleSheet("QLabel { background-color : rgb(255, 255, 255);}");
    widget->show();
}