コード例 #1
0
ファイル: Environment.cpp プロジェクト: Phoenox/soundscape
void Environment::setPreset(QString name)
{
	Preset* preset = nullptr;
	bool added = false;

	for (Preset* candidate : m_presets)
	{
		if (candidate->name() == name)
		{
			preset = candidate;
			break;
		}
	}

	if (!preset)
	{
		preset = new Preset(name, this);
		addPreset(preset);
		added = true;
	}

	for (RepeatedSound* sound : m_repeatedSounds)
		preset->setRepeatedSound(sound);
	for (Song* song : m_songs)
		preset->setSong(song);
	for (Playlist* playlist : m_playlists)
		preset->setPlaylist(playlist);

	if (added)
		emit presetAdded(preset);
	else
		emit presetChanged(preset);
}
コード例 #2
0
ファイル: qgsvisibilitypresets.cpp プロジェクト: Ariki/QGIS
QgsVisibilityPresets::QgsVisibilityPresets()
    : mMenu( new QMenu )
{

  mMenu->addAction( QgisApp::instance()->actionShowAllLayers() );
  mMenu->addAction( QgisApp::instance()->actionHideAllLayers() );
  mMenu->addAction( QgisApp::instance()->actionShowSelectedLayers() );
  mMenu->addAction( QgisApp::instance()->actionHideSelectedLayers() );
  mMenu->addSeparator();

  mMenu->addAction( tr( "Add Preset..." ), this, SLOT( addPreset() ) );
  mMenuSeparator = mMenu->addSeparator();

  mActionRemoveCurrentPreset = mMenu->addAction( tr( "Remove Current Preset" ), this, SLOT( removeCurrentPreset() ) );

  connect( mMenu, SIGNAL( aboutToShow() ), this, SLOT( menuAboutToShow() ) );

  connect( QgsMapLayerRegistry::instance(), SIGNAL( layersRemoved( QStringList ) ),
           this, SLOT( registryLayersRemoved( QStringList ) ) );

  connect( QgsProject::instance(), SIGNAL( readProject( const QDomDocument & ) ),
           this, SLOT( readProject( const QDomDocument & ) ) );
  connect( QgsProject::instance(), SIGNAL( writeProject( QDomDocument & ) ),
           this, SLOT( writeProject( QDomDocument & ) ) );
}
コード例 #3
0
ファイル: equalizer_dialog.cpp プロジェクト: RavetcoFX/Yarock
//! ----------------------- savePreset -----------------------------------------
void Equalizer_Dialog::savePreset()
{
    QString currentPresetName = _comboBoxPreset->currentText();

    DialogInput input(this, tr("Save preset"), tr("Name"));
    input.setEditValue(currentPresetName);
    input.setFixedSize(480,140);
    

    if(input.exec() == QDialog::Accepted) {
      QString name = input.editValue();
      
      if (name.isEmpty())  return;
      
      
      Equalizer::EqPreset currentPreset;
      for (int i=0 ; i < Equalizer::kBands ; ++i) {
        currentPreset.gain[i] = eqSliderList[i]->value();
      }
      currentPreset.preamp = eqSliderPreamp->value();

      addPreset(name, currentPreset);
      _comboBoxPreset->setCurrentIndex(_comboBoxPreset->findText(name));

      _settingChanged = true;
    }
}
コード例 #4
0
void FilterHorizontalHeaderView::savePreset()
{
	QVariantMap p=preset();
	bool ok;
	QString presetName = QInputDialog::getText(this, tr("QInputDialog::getText()"),
						   tr("Preset name:"), QLineEdit::Normal,
						   QString(), &ok);
	if (ok) {
		addPreset(p,presetName);
	}
	emit presetSaved(p,presetName);
}
コード例 #5
0
ファイル: qgsmapthemes.cpp プロジェクト: GeoCat/QGIS
void QgsMapThemes::addPreset()
{
  QStringList existingNames = QgsProject::instance()->mapThemeCollection()->mapThemes();
  QgsNewNameDialog dlg( tr( "theme" ), tr( "Theme" ), QStringList(), existingNames, QRegExp(), Qt::CaseInsensitive, mMenu );
  dlg.setWindowTitle( tr( "Map Themes" ) );
  dlg.setHintString( tr( "Name of the new theme" ) );
  dlg.setOverwriteEnabled( false );
  dlg.setConflictingNameWarning( tr( "A theme with this name already exists" ) );
  if ( dlg.exec() != QDialog::Accepted || dlg.name().isEmpty() )
    return;

  addPreset( dlg.name() );
}
コード例 #6
0
ファイル: qgsmapthemes.cpp プロジェクト: GeoCat/QGIS
void QgsMapThemes::replaceTriggered()
{
  QAction *actionPreset = qobject_cast<QAction *>( sender() );
  if ( !actionPreset )
    return;

  int res = QMessageBox::question( mMenu, tr( "Replace theme" ),
                                   trUtf8( "Are you sure you want to replace the existing theme “%1”?" ).arg( actionPreset->text() ),
                                   QMessageBox::Yes | QMessageBox::No, QMessageBox::No );
  if ( res != QMessageBox::Yes )
    return;

  //adding preset with same name is effectively a replace
  addPreset( actionPreset->text() );
}
コード例 #7
0
QmitkLevelWindowPresetDefinitionDialog::QmitkLevelWindowPresetDefinitionDialog(QWidget *parent, Qt::WindowFlags f)
  : QDialog(parent, f), m_TableModel(nullptr), m_SortModel(this)
{
  this->setupUi(this);

  QObject::connect(addButton, SIGNAL(clicked()), this, SLOT(addPreset()));
  QObject::connect(removeButton, SIGNAL(clicked()), this, SLOT(removePreset()));
  QObject::connect(changeButton, SIGNAL(clicked()), this, SLOT(changePreset()));

  QObject::connect(presetView->horizontalHeader(), SIGNAL(sectionClicked(int)), this, SLOT(sortPresets(int)));

  presetView->verticalHeader()->setVisible(false);
  presetView->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed);

  presetView->setModel(&m_SortModel);
}
コード例 #8
0
void PresetController::loadSettings(QSettings *s)
{
    s->beginGroup(tr("PresetController"));
    setVisible(s->value(tr("visible"), tr("true")).toBool());

    int size = s->beginReadArray(tr("Presets"));

    for(int i = 0; i < size; i++){
        s->setArrayIndex(i);
        Preset *p = new Preset(this);
        p->loadSettings(s);
        addPreset(p);
    }

    s->endArray();
    s->endGroup();
}
コード例 #9
0
bool MVPresetManager::saveCurrentPresetAs(QString newName)
{
    QString newFileName = Globals::userPresetsDir + "/" + currentBank + "/" + newName + PRESET_FILE_EXT;
    MVPreset * existingPreset = getPresetByName(currentBank, newName);
    if(existingPreset)
    {
       existingPreset->copyDataFrom(*currentPreset);
       existingPreset->saveData();
       return true;
    }

    if (currentPreset->saveData(newFileName))
    {
        addPreset(newFileName);
        return true;
    }
    return false;
}
コード例 #10
0
ファイル: qgsmapthemes.cpp プロジェクト: GeoCat/QGIS
QgsMapThemes::QgsMapThemes()
  : mMenu( new QMenu )
{

  mMenu->addAction( QgisApp::instance()->actionShowAllLayers() );
  mMenu->addAction( QgisApp::instance()->actionHideAllLayers() );
  mMenu->addAction( QgisApp::instance()->actionShowSelectedLayers() );
  mMenu->addAction( QgisApp::instance()->actionHideSelectedLayers() );
  mMenu->addAction( QgisApp::instance()->actionHideDeselectedLayers() );
  mMenu->addSeparator();

  mReplaceMenu = new QMenu( tr( "Replace Theme" ) );
  mMenu->addMenu( mReplaceMenu );
  mActionAddPreset = mMenu->addAction( tr( "Add Theme..." ), this, SLOT( addPreset() ) );
  mMenuSeparator = mMenu->addSeparator();

  mActionRemoveCurrentPreset = mMenu->addAction( tr( "Remove Current Theme" ), this, SLOT( removeCurrentPreset() ) );

  connect( mMenu, &QMenu::aboutToShow, this, &QgsMapThemes::menuAboutToShow );
}
コード例 #11
0
ファイル: Environment.cpp プロジェクト: Phoenox/soundscape
void Environment::load()
{
	Storable::load();

	QVariantMap info = this->storage()->loadData();

	for (QString singleSound : info.value(SETTINGS_KEY_SINGLESOUNDS).toStringList())
		m_singleSounds.append(new SingleSound(SoundFactory::instance()->loadSound(singleSound), this));
	for (QString repeatedSound : info.value(SETTINGS_KEY_REPEATEDSOUNDS).toStringList())
		m_repeatedSounds.append(new RepeatedSound(SoundFactory::instance()->loadSound(repeatedSound), this));
	for (QString song : info.value(SETTINGS_KEY_SONGS).toStringList())
		m_songs.append(new Song(SoundFactory::instance()->loadSound(song), this));
	for (QString playlist : info.value(SETTINGS_KEY_PLAYLISTS).toStringList())
		m_playlists.append(new Playlist(SoundFactory::instance()->loadSound(playlist), this));

	// Load presets
	QDir objectFolder = this->storage()->objectFolder();
	for (QString path : objectFolder.entryList({"*.preset"}))
	{
		QFile file(objectFolder.filePath(path));
		addPreset(new Preset(file, this));
	}
}
コード例 #12
0
ファイル: equalizer_dialog.cpp プロジェクト: RavetcoFX/Yarock
//! ----------------------- restoreSettings ------------------------------------
void Equalizer_Dialog::restoreSettings()
{
    _presetList.clear();
    _comboBoxPreset->clear();

    QMap<QString, Equalizer::EqPreset> presetsEq = SETTINGS()->_presetEq;

    //! Load presets
    if ( presetsEq.isEmpty() ) {
      addDefaultPreset();
    }
    else {
      foreach (const QString& name, presetsEq.keys()) {
        addPreset( name , presetsEq[name] );
      }
    }

    //! Load selected preset
    const QString selected_preset = SETTINGS()->_currentPreset;
    const int selectedIdx = _comboBoxPreset->findText(selected_preset);

    if (selectedIdx != -1) {
      _comboBoxPreset->setCurrentIndex(selectedIdx);
      for (int i=0 ; i < Equalizer::kBands ; ++i) {
        eqSliderList[i]->setValue(_presetList[selected_preset].gain[i]);
      }
    }

    //! Load Enabled state
    _enableCheckBox->setChecked( SETTINGS()->_enableEq );
    _slider_container->setEnabled(_enableCheckBox->isChecked());

    //! signal loaded preset
    if(_enableCheckBox->isChecked())
      equalizerChanged();
}
コード例 #13
0
GammaWidget::GammaWidget(QWidget *parent) : QWidget(parent), ui(new Ui::GammaWidget)
{
    ui->setupUi(this);

    connect(ui->slider_gamma, SIGNAL(valueChanged(int)), this, SLOT(gammaChanged(int)));
    connect(ui->spinBox_gamma, SIGNAL(valueChanged(double)), this, SLOT(gammaChanged(double)));
    connect(ui->checkBox_CRF, SIGNAL(stateChanged(int)), this, SLOT(CRFChanged(int)));
    connect(ui->combo_CRF_List, SIGNAL(activated(QString)), this, SLOT(SetCRFPreset(QString)));

    ui->combo_CRF_List->addItem(tr("External..."));

    addPreset("Advantix 100", "Advantix_100CD");
    addPreset("Advantix 200", "Advantix_200CD");
    addPreset("Advantix 400", "Advantix_400CD");
    addPreset("Agfachrome CTPrecisa 200", "Agfachrome_ctpecisa_200CD");
    addPreset("Agfachrome CTPrecisa 100", "Agfachrome_ctprecisa_100CD");
    addPreset("Agfachrome rsx2 050", "Agfachrome_rsx2_050CD");
    addPreset("Agfachrome rsx2 100", "Agfachrome_rsx2_100CD");
    addPreset("Agfachrome rsx2 200", "Agfachrome_rsx2_200CD");
    addPreset("Agfacolor Futura 100", "Agfacolor_futura_100CD");
    addPreset("Agfacolor Futura 200", "Agfacolor_futura_200CD");
    addPreset("Agfacolor Futura 400", "Agfacolor_futura_400CD");
    addPreset("Agfacolor Futura II 100", "Agfacolor_futuraII_100CD");
    addPreset("Agfacolor Futura II 200", "Agfacolor_futuraII_200CD");
    addPreset("Agfacolor Futura II 400", "Agfacolor_futuraII_400CD");
    addPreset("Agfacolor HDC 100 Plus", "Agfacolor_hdc_100_plusCD");
    addPreset("Agfacolor HDC 200 Plus", "Agfacolor_hdc_200_plusCD");
    addPreset("Agfacolor HDC 400 Plus", "Agfacolor_hdc_400_plusCD");
    addPreset("Agfacolor Optima II 100", "Agfacolor_optimaII_100CD");
    addPreset("Agfacolor Optima II 200", "Agfacolor_optimaII_200CD");
    addPreset("Agfacolor Ultra 050", "Agfacolor_ultra_050_CD");
    addPreset("Agfacolor Vista 100", "Agfacolor_vista_100CD");
    addPreset("Agfacolor Vista 200", "Agfacolor_vista_200CD");
    addPreset("Agfacolor Vista 400", "Agfacolor_vista_400CD");
    addPreset("Agfacolor Vista 800", "Agfacolor_vista_800CD");
    addPreset("Agfapan APX 025 (B&W)", "Agfapan_apx_025CD");
    addPreset("Agfapan APX 100 (B&W)", "Agfapan_apx_100CD");
    addPreset("Agfapan APX 400 (B&W)", "Agfapan_apx_400CD");
    addPreset("Ektachrome 100 Plus (Color Rev.)", "Ektachrome_100_plusCD");
    addPreset("Ektachrome 100 (Color Rev.)", "Ektachrome_100CD");
    addPreset("Ektachrome 320T (Color Rev.)", "Ektachrome_320TCD");
    addPreset("Ektachrome 400X (Color Rev.)", "Ektachrome_400XCD");
    addPreset("Ektachrome 64 (Color Rev.)", "Ektachrome_64CD");
    addPreset("Ektachrome 64T (Color Rev.)", "Ektachrome_64TCD");
    addPreset("Ektachrome E100S", "Ektachrome_E100SCD");
    addPreset("Fujifilm Cine F-125", "F125CD");
    addPreset("Fujifilm Cine F-250", "F250CD");
    addPreset("Fujifilm Cine F-400", "F400CD");
    addPreset("Fujifilm Cine FCI", "FCICD");
    addPreset("Kodak Gold 100", "Gold_100CD");
    addPreset("Kodak Gold 200", "Gold_200CD");
    addPreset("Kodachrome 200", "Kodachrome_200CD");
    addPreset("Kodachrome 25", "Kodachrome_25CD");
    addPreset("Kodachrome 64", "Kodachrome_64CD");
    addPreset("Kodak Max Zoom 800", "Max_Zoom_800CD");
    addPreset("Kodak Portra 100T", "Portra_100TCD");
    addPreset("Kodak Portra 160NC", "Portra_160NCCD");
    addPreset("Kodak Portra 160VC", "Portra_160VCCD");
    addPreset("Kodak Portra 400NC", "Portra_400NCCD");
    addPreset("Kodak Portra 400VC", "Portra_400VCCD");
    addPreset("Kodak Portra 800", "Portra_800CD");
}
コード例 #14
0
ファイル: equalizer_dialog.cpp プロジェクト: RavetcoFX/Yarock
//! ----------------------- addDefaultPreset -----------------------------------
void Equalizer_Dialog::addDefaultPreset()
{
    addPreset("Custom",             Equalizer::EqPreset(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
    addPreset("Classical",          Equalizer::EqPreset(0, 0, 0, 0, 0, 0, -40, -40, -40, -50, 0));
    addPreset("Club",               Equalizer::EqPreset(0, 0, 20, 30, 30, 30, 20, 0, 0, 0, 0));
    addPreset("Dance",              Equalizer::EqPreset(50, 35, 10, 0, 0, -30, -40, -40, 0, 0, 0));
    addPreset("Full Bass",          Equalizer::EqPreset(70, 70, 70, 40, 20, -45, -50, -55, -55, -55, 0));
    addPreset("Full Treble",        Equalizer::EqPreset(-50, -50, -50, -25, 15, 55, 80, 80, 80, 85, 0));
    addPreset("Full Bass + Treble", Equalizer::EqPreset(35, 30, 0, -40, -25, 10, 45, 55, 60, 60, 0));
    addPreset("Laptop/Headphones",  Equalizer::EqPreset(25, 50, 25, -20, 0, -30, -40, -40, 0, 0, 0));
    addPreset("Large Hall",         Equalizer::EqPreset(50, 50, 30, 30, 0, -25, -25, -25, 0, 0, 0));
    addPreset("Live",               Equalizer::EqPreset(-25, 0, 20, 25, 30, 30, 20, 15, 15, 10, 0));
    addPreset("Party",              Equalizer::EqPreset(35, 35, 0, 0, 0, 0, 0, 0, 35, 35, 0));
    addPreset("Pop",                Equalizer::EqPreset(-10, 25, 35, 40, 25, -5, -15, -15, -10, -10, 0));
    addPreset("Reggae",             Equalizer::EqPreset(0, 0, -5, -30, 0, -35, -35, 0, 0, 0, 0));
    addPreset("Rock",               Equalizer::EqPreset(40, 25, -30, -40, -20, 20, 45, 55, 55, 55, 0));
    addPreset("Soft",               Equalizer::EqPreset(25, 10, -5, -15, -5, 20, 45, 50, 55, 60, 0));
    addPreset("Ska",                Equalizer::EqPreset(-15, -25, -25, -5, 20, 30, 45, 50, 55, 50, 0));
    addPreset("Soft Rock",          Equalizer::EqPreset(20, 20, 10, -5, -25, -30, -20, -5, 15, 45, 0));
    addPreset("Techno",             Equalizer::EqPreset(40, 30, 0, -30, -25, 0, 40, 50, 50, 45, 0));
    addPreset("Zero",               Equalizer::EqPreset(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
}