void saveActiveScheme() { Fl_String pathActive(fl_homedir()); pathActive += "/.ede/schemes/Active.scheme"; saveScheme(pathActive); }
void buttonClicked (Button* b) { if (b == &loadButton) loadScheme(); else saveScheme(); }
void saveSchemeAs() { const char *schemeName = fl_input(_("Save scheme as:"), _("New scheme")); if (schemeName) { Fl_String pathScheme; pathScheme.printf("%s/.ede/schemes/%s.scheme", fl_homedir().c_str(), schemeName); saveScheme(pathScheme); schemeListBox->add(fl_file_filename(pathScheme)); } }
void ShortcutsModule::slotSaveSchemeAs() { QString sName, sFile; bool bNameValid, ok; int iScheme = -1; sName = m_pcbSchemes->currentText(); do { bNameValid = true; sName = KInputDialog::getText( i18n( "Save Key Scheme" ), i18n( "Enter a name for the key scheme:" ), sName, &ok, this ); if( ok ) { sName = sName.simplifyWhiteSpace(); sFile = sName; int ind = 0; while( ind < (int) sFile.length() ) { // parse the string for first white space ind = sFile.find(" "); if( ind == -1 ) { ind = sFile.length(); break; } // remove from string sFile.remove( ind, 1 ); // Make the next letter upper case QString s = sFile.mid( ind, 1 ); s = s.upper(); sFile.replace( ind, 1, s ); } iScheme = -1; for( int i = 0; i < (int) m_pcbSchemes->count(); i++ ) { if( sName.lower() == (m_pcbSchemes->text(i)).lower() ) { iScheme = i; int result = KMessageBox::warningContinueCancel( 0, i18n("A key scheme with the name '%1' already exists;\n" "do you want to overwrite it?\n").arg(sName), i18n("Save Key Scheme"), i18n("Overwrite")); bNameValid = (result == KMessageBox::Continue); } } } else return; } while( !bNameValid ); disconnect( m_pcbSchemes, SIGNAL(activated(int)), this, SLOT(slotSelectScheme(int)) ); QString kksPath = KGlobal::dirs()->saveLocation( "data", "kcmkeys/" ); QDir dir( kksPath ); if( !dir.exists() && !dir.mkdir( kksPath ) ) { qWarning("KShortcutsModule: Could not make directory to store user info."); return; } sFile.prepend( kksPath ); sFile += ".kksrc"; if( iScheme == -1 ) { m_pcbSchemes->insertItem( sName ); //m_pcbSchemes->setFocus(); m_pcbSchemes->setCurrentItem( m_pcbSchemes->count()-1 ); m_rgsSchemeFiles.append( sFile ); } else { //m_pcbSchemes->setFocus(); m_pcbSchemes->setCurrentItem( iScheme ); } KSimpleConfig *config = new KSimpleConfig( sFile ); config->setGroup( "Settings" ); config->writeEntry( "Name", sName ); delete config; saveScheme(); connect( m_pcbSchemes, SIGNAL(activated(int)), SLOT(slotSelectScheme(int)) ); slotSelectScheme(); }
void AbstractEditTab::initialize() { ui_edit_edit->setCurrentFont(QFont("Courier")); // opt connections connect(this, SIGNAL(optimizerChanged(Optimizer*)), m_opt, SLOT(setOptimizer(Optimizer*)), Qt::DirectConnection); connect(this, SIGNAL(queueInterfaceChanged(QueueInterface*)), m_opt, SLOT(setQueueInterface(QueueInterface*)), Qt::DirectConnection); // Dialog connections connect(this, SIGNAL(optimizerChanged(Optimizer*)), m_dialog, SIGNAL(tabsUpdateGUI())); connect(this, SIGNAL(queueInterfaceChanged(QueueInterface*)), m_dialog, SIGNAL(tabsUpdateGUI())); // Edit tab connections connect(this, SIGNAL(optimizerChanged(Optimizer*)), this, SLOT(populateTemplates())); connect(this, SIGNAL(queueInterfaceChanged(QueueInterface*)), this, SLOT(populateTemplates())); connect(this, SIGNAL(optimizerChanged(Optimizer*)), this, SLOT(populateOptStepList())); connect(this, SIGNAL(queueInterfaceChanged(QueueInterface*)), this, SLOT(populateOptStepList())); connect(ui_push_optimizerConfig, SIGNAL(clicked()), this, SLOT(configureOptimizer())); connect(ui_push_queueInterfaceConfig, SIGNAL(clicked()), this, SLOT(configureQueueInterface())); connect(ui_push_help, SIGNAL(clicked()), this, SLOT(showHelp())); connect(ui_edit_edit, SIGNAL(textChanged()), this, SLOT(saveCurrentTemplate())); connect(ui_combo_templates, SIGNAL(currentIndexChanged(int)), this, SLOT(updateEditWidget())); connect(ui_push_add, SIGNAL(clicked()), this, SLOT(appendOptStep())); connect(ui_push_remove, SIGNAL(clicked()), this, SLOT(removeCurrentOptStep())); connect(ui_list_optStep, SIGNAL(currentRowChanged(int)), this, SLOT(updateEditWidget())); connect(ui_edit_user1, SIGNAL(editingFinished()), this, SLOT(updateUserValues())); connect(ui_edit_user2, SIGNAL(editingFinished()), this, SLOT(updateUserValues())); connect(ui_edit_user3, SIGNAL(editingFinished()), this, SLOT(updateUserValues())); connect(ui_edit_user4, SIGNAL(editingFinished()), this, SLOT(updateUserValues())); connect(ui_combo_optimizers, SIGNAL(currentIndexChanged(int)), this, SLOT(updateOptimizer())); connect(ui_combo_queueInterfaces, SIGNAL(currentIndexChanged(int)), this, SLOT(updateQueueInterface())); connect(ui_push_saveScheme, SIGNAL(clicked()), this, SLOT(saveScheme())); connect(ui_push_loadScheme, SIGNAL(clicked()), this, SLOT(loadScheme())); // Populate combo boxes unsigned int index; // QueueInterfaces ui_combo_queueInterfaces->clear(); index = 0; for (QList<QueueInterface*>::const_iterator it = m_queueInterfaces.constBegin(), it_end = m_queueInterfaces.constEnd(); it != it_end; ++it) { ui_combo_queueInterfaces->insertItem(index++, (*it)->getIDString()); } // Optimizers ui_combo_optimizers->clear(); index = 0; for (QList<Optimizer*>::const_iterator it = m_optimizers.constBegin(), it_end = m_optimizers.constEnd(); it != it_end; ++it) { ui_combo_optimizers->insertItem(index++, (*it)->getIDString()); } ui_combo_queueInterfaces->setCurrentIndex(0); ui_combo_optimizers->setCurrentIndex(0); AbstractTab::initialize(); updateGUI(); }
PaletteDialog::PaletteDialog(QString const &savepath, PaletteDialog const *const global, QWidget *const parent) : QDialog(parent) , savedir_(savepath + '/') , global_(global) , listView_(new QListView(this)) , rmSchemeButton_(new QPushButton(tr("Remove Scheme"), this)) , quads_() , currentColors_() , defaultScheme_(global ? tr("Global Palette") : tr("Default Gray")) , schemeString_(defaultScheme_) { setWindowTitle(global ? tr("Current ROM Palette") : tr("Global Palette")); QDir::root().mkpath(savedir_ + "stored/"); listView_->setModel(new ImmutableStringListModel(this)); setSchemeList(); QVBoxLayout *const mainLayout = new QVBoxLayout(this); { QHBoxLayout *const topLayout = addLayout(mainLayout, new QHBoxLayout); QGroupBox *const lframe = addWidget(topLayout, new QGroupBox(tr("Scheme"))); QVBoxLayout *const frameLayout = new QVBoxLayout(lframe); frameLayout->addWidget(listView_); QPushButton *const saveButton = addWidget(frameLayout, new QPushButton(tr("Save Scheme..."))); rmSchemeButton_->setParent(0); // tab order reparent frameLayout->addWidget(rmSchemeButton_); connect(saveButton, SIGNAL(clicked()), this, SLOT(saveScheme())); connect(rmSchemeButton_, SIGNAL(clicked()), this, SLOT(rmScheme())); QVBoxLayout *vLayout = addLayout(topLayout, new QVBoxLayout); quads_[0] = addWidget(vLayout, new ColorQuad(tr("Background"))); quads_[1] = addWidget(vLayout, new ColorQuad(tr("Sprite 1"))); quads_[2] = addWidget(vLayout, new ColorQuad(tr("Sprite 2"))); } { QHBoxLayout *hLayout = addLayout(mainLayout, new QHBoxLayout, Qt::AlignBottom | Qt::AlignRight); QPushButton *okButton = addWidget(hLayout, new QPushButton(tr("OK"))); QPushButton *cancelButton = addWidget(hLayout, new QPushButton(tr("Cancel"))); okButton->setDefault(true); connect(okButton, SIGNAL(clicked()), this, SLOT(accept())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject())); } for (std::size_t i = 0; i < sizeof quads_ / sizeof *quads_; ++i) { connect(quads_[i], SIGNAL(colorChanged()), listView_->selectionModel(), SLOT(clear())); } connect(listView_->selectionModel(), SIGNAL(currentChanged(QModelIndex const &, QModelIndex const &)), this, SLOT(schemeChanged(QModelIndex const &))); if (global) { restore(); store(); } else { QSettings settings; settings.beginGroup("palette"); loadSettings(settings); settings.endGroup(); } }