Ejemplo n.º 1
0
void QmitkUSNavigationProcessWidget::SetSettingsWidget(QmitkUSNavigationAbstractSettingsWidget* settingsWidget)
{
  // disconnect slots to settings widget if there was a widget before
  if ( m_SettingsWidget )
  {
    disconnect( ui->settingsSaveButton, SIGNAL(clicked()), m_SettingsWidget, SLOT(OnSave()) );
    disconnect( ui->settingsCancelButton, SIGNAL(clicked()), m_SettingsWidget, SLOT(OnCancel()) );

    disconnect (m_SettingsWidget, SIGNAL(Saved()), this, SLOT(OnSettingsWidgetReturned()) );
    disconnect (m_SettingsWidget, SIGNAL(Canceled()), this, SLOT(OnSettingsWidgetReturned()) );
    disconnect (m_SettingsWidget, SIGNAL(SettingsChanged(itk::SmartPointer<mitk::DataNode>)), this, SLOT(OnSettingsChanged(itk::SmartPointer<mitk::DataNode>)) );

    ui->settingsWidget->removeWidget(m_SettingsWidget);
  }

  m_SettingsWidget = settingsWidget;
  if ( m_SettingsWidget )
  {
    m_SettingsWidget->LoadSettings();

    connect( ui->settingsSaveButton, SIGNAL(clicked()), m_SettingsWidget, SLOT(OnSave()) );
    connect( ui->settingsCancelButton, SIGNAL(clicked()), m_SettingsWidget, SLOT(OnCancel()) );

    connect (m_SettingsWidget, SIGNAL(Saved()), this, SLOT(OnSettingsWidgetReturned()) );
    connect (m_SettingsWidget, SIGNAL(Canceled()), this, SLOT(OnSettingsWidgetReturned()) );
    connect (m_SettingsWidget, SIGNAL(SettingsChanged(itk::SmartPointer<mitk::DataNode>)), this, SLOT(OnSettingsChanged(itk::SmartPointer<mitk::DataNode>)) );

    if ( m_SettingsNode.IsNotNull() ) { m_SettingsWidget->SetSettingsNode(m_SettingsNode, true); }

    ui->settingsWidget->addWidget(m_SettingsWidget);
  }
  ui->settingsButton->setEnabled(m_SettingsWidget != 0);
}
Ejemplo n.º 2
0
//---------------------------------------------------------------------------
void TConfiguration::DoSave(bool All, bool Explicit)
{
  if (FDontSave)
  {
    return;
  }

  std::unique_ptr<THierarchicalStorage> Storage(CreateStorage(false));
  Storage->SetAccessMode(smReadWrite);
  Storage->SetExplicit(Explicit);
  if (Storage->OpenSubKey(GetConfigurationSubKey(), true))
  {
    SaveData(Storage.get(), All);
  }

  Saved();

  if (All)
  {
    StoredSessions->Save(true, Explicit);
  }

  // clean up as last, so that if it fails (read only INI), the saving can proceed
  if (GetStorage() == stRegistry)
  {
    CleanupIniFile();
  }
}
Ejemplo n.º 3
0
void TConfiguration::DoSave(bool All, bool Explicit)
{
  if (FDontSave)
  {
    return;
  }

  std::unique_ptr<THierarchicalStorage> Storage(CreateConfigStorage());
  Storage->SetAccessMode(smReadWrite);
  Storage->SetExplicit(Explicit);
  if (Storage->OpenSubKey(GetConfigurationSubKey(), true))
  {
     // if saving to TOptionsStorage, make sure we save everything so that
     // all configuration is properly transferred to the master storage
     bool ConfigAll = All || Storage->GetTemporary();
     SaveData(Storage.get(), ConfigAll);
  }

  Saved();

  if (All)
  {
    StoredSessions->Save(true, Explicit);
  }

  // clean up as last, so that if it fails (read only INI), the saving can proceed
  if (GetStorage() == stRegistry)
  {
    CleanupIniFile();
  }
}
Ejemplo n.º 4
0
//---------------------------------------------------------------------------
void __fastcall TConfiguration::DoSave(bool All, bool Explicit)
{
  if (FDontSave) return;

  THierarchicalStorage * AStorage = CreateScpStorage(false);
  try
  {
    AStorage->AccessMode = smReadWrite;
    AStorage->Explicit = Explicit;
    if (AStorage->OpenSubKey(ConfigurationSubKey, true))
    {
      SaveData(AStorage, All);
    }
  }
  __finally
  {
    delete AStorage;
  }

  Saved();

  if (All)
  {
    StoredSessions->Save(true, Explicit);
  }

  // clean up as last, so that if it fails (read only INI), the saving can proceed
  if (Storage == stRegistry)
  {
    CleanupIniFile();
  }
}
Ejemplo n.º 5
0
ToolsWindow::ToolsWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::ToolsWindow)
{
    ui->setupUi(this);

    this->active_mode = 0;
    this->active_tile_index = 0;
    this->active_actor_index = 0;
    this->save = false;

    QObject::connect(ui->TileSelector, SIGNAL(currentIndexChanged(int)),
                          this, SLOT(TileSelectorChange(int)));

    QObject::connect(ui->ModeNone, SIGNAL(clicked(bool)),
                            this, SLOT(modeNone(bool)));

    QObject::connect(ui->ModeTiles, SIGNAL(clicked(bool)),
                            this, SLOT(modeTile(bool)));

    QObject::connect(ui->LeftInput, SIGNAL(valueChanged(int)),
                            this, SLOT(setLeft(int)));

    QObject::connect(ui->TopInput, SIGNAL(valueChanged(int)),
                            this, SLOT(setTop(int)));

    QObject::connect(ui->RightInput, SIGNAL(valueChanged(int)),
                            this, SLOT(setRight(int)));

    QObject::connect(ui->BottomInput, SIGNAL(valueChanged(int)),
                            this, SLOT(setBottom(int)));

    QObject::connect(ui->ActorSelector, SIGNAL(currentIndexChanged(int)),
                            this, SLOT(ActorSelectorChange(int)));

    QObject::connect(ui->ModeActors, SIGNAL(clicked(bool)),
                            this, SLOT(modeActor(bool)));

    QObject::connect(ui->AddToFactory, SIGNAL(clicked(bool)),
                            this, SLOT(addToFactory(bool)));

    QObject::connect(ui->Group, SIGNAL(valueChanged(int)),
                            this, SLOT(setGroup(int)));

    QObject::connect(ui->TriggerSensitivity, SIGNAL(currentIndexChanged(int)),
                            this, SLOT(setTriggerSensitivity(int)));

    QObject::connect(ui->TriggerSelector, SIGNAL(currentIndexChanged(int)),
                            this, SLOT(setTriggerType(int)));

    QObject::connect(ui->NumToKeepAlive, SIGNAL(valueChanged(int)),
                            this, SLOT(setNumToKeepAlive(int)));

    QObject::connect(ui->NumToSpawn, SIGNAL(valueChanged(int)),
                            this, SLOT(setNumToSpawn(int)));

    QObject::connect(ui->Frequency, SIGNAL(valueChanged(int)),
                            this, SLOT(setSpawnFrequency(int)));

    QObject::connect(ui->actionSave, SIGNAL(triggered()),
                            this, SLOT(Saved()));
}
Ejemplo n.º 6
0
void GWorkBench::closeEvent( QCloseEvent *event )
{
    WriteToPermanentStorage();
    emit Saved();
    QMainWindow::closeEvent( event );
}