/*! \fn OptionsDialog::loadProfiles() */ void OptionsDialog::loadProfiles() { QStringList profiles = getSetting("profiles").toStringList(); profilesList->clear(); profilesList->addItems(profiles); setCurrentProfile(); profileSelectionChanged(); }
OptionsDialog::OptionsDialog(Juicer* juicer) : QDialog(juicer) { setupUi(this); this->juicer = juicer; #ifndef Q_WS_WIN handlerGroupBox->setHidden(true); #endif IconWidget* l = new IconWidget(":/options/core.png", tr("Core"), tr("Core Settings"), QBoxLayout::TopToBottom, listWidget); QListWidgetItem* item = new QListWidgetItem(listWidget); item->setSizeHint(l->size()); listWidget->setItemWidget(item, l); l = new IconWidget(":/options/limits.png", tr("Limits"), tr("Limitations"), QBoxLayout::TopToBottom, listWidget); item = new QListWidgetItem(listWidget); item->setSizeHint(l->size()); listWidget->setItemWidget(item, l); l = new IconWidget(":/options/appearance.png", tr("Appearance"), tr("Appearance of the GUI"), QBoxLayout::TopToBottom, listWidget); item = new QListWidgetItem(listWidget); item->setSizeHint(l->size()); listWidget->setItemWidget(item, l); l = new IconWidget(":/options/behaviour.png", tr("Behaviour"), tr("Behaviour of the GUI"), QBoxLayout::TopToBottom, listWidget); item = new QListWidgetItem(listWidget); item->setSizeHint(l->size()); listWidget->setItemWidget(item, l); l = new IconWidget(":/options/search.png", tr("Search"), tr("Search Settings"), QBoxLayout::TopToBottom, listWidget); item = new QListWidgetItem(listWidget); item->setSizeHint(l->size()); listWidget->setItemWidget(item, l); l = new IconWidget(":/options/launching.png", tr("Launching"), tr("Opening of Files"), QBoxLayout::TopToBottom, listWidget); item = new QListWidgetItem(listWidget); item->setSizeHint(l->size()); listWidget->setItemWidget(item, l); l = new IconWidget(":/options/ftp.png", tr("FTP"), tr("FTP Settings"), QBoxLayout::TopToBottom, listWidget); item = new QListWidgetItem(listWidget); item->setSizeHint(l->size()); listWidget->setItemWidget(item, l); l = new IconWidget(":/options/reset.png", tr("Reset"), tr("Configuration Reset"), QBoxLayout::TopToBottom, listWidget); item = new QListWidgetItem(listWidget); item->setSizeHint(l->size()); listWidget->setItemWidget(item, l); languageComboBox->addItem(QIcon(":/options/de.png"), "deutsch", "de"); languageComboBox->addItem(QIcon(":/options/gb.png"), "english", "en"); launchCombo->addItem(DEFAULT_LAUNCHER); if(DEFAULT_LAUNCHER == KDE_LAUNCHER) launchCombo->addItem(GNOME_LAUNCHER); specificRadioToggled(false); connect(incomingButton, SIGNAL(clicked()), this, SLOT(selectIncomingDir())); connect(tempButton, SIGNAL(clicked()), this, SLOT(selectTempDir())); connect(launcherButton, SIGNAL(clicked()), this, SLOT(selectLauncher())); connect(incomingSpecificButton, SIGNAL(clicked()), this, SLOT(selectIncomingDirSpecific())); connect(tempSpecificButton, SIGNAL(clicked()), this, SLOT(selectTempDirSpecific())); connect(specificRadio, SIGNAL(toggled(bool)), this, SLOT(specificRadioToggled(bool))); connect(listWidget, SIGNAL(currentRowChanged(int)), stackedWidget , SLOT(setCurrentIndex(int))); connect(jumpFtpButton, SIGNAL(clicked()), this , SLOT(jumpToFtpSlot())); connect(fontComboBox, SIGNAL(currentFontChanged(const QFont&)), this, SLOT(setFontSizes(const QFont&))); connect(this, SIGNAL(accepted()), this, SLOT(acceptedSlot())); connect(resetPushButton, SIGNAL(clicked()), this, SLOT(reset())); connect(profilesList, SIGNAL(itemSelectionChanged()), this, SLOT(profileSelectionChanged())); connect(addProfileButton, SIGNAL(clicked()), this, SLOT(addProfile())); connect(changeProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile())); connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile())); profileChangeActive = true; profileChanged = false; listWidget->setCurrentRow(0); connect(downSpin, SIGNAL(valueChanged(int)), this, SLOT(limitsChanged())); connect(upSpin, SIGNAL(valueChanged(int)), this, SLOT(limitsChanged())); connect(slotSpin, SIGNAL(valueChanged(int)), this, SLOT(limitsChanged())); connect(sourcesSpin, SIGNAL(valueChanged(int)), this, SLOT(limitsChanged())); connect(connectionsSpin, SIGNAL(valueChanged(int)), this, SLOT(limitsChanged())); connect(newSpin, SIGNAL(valueChanged(int)), this, SLOT(limitsChanged())); }
QWidget *ProfileOptionsPage::createPage(QWidget *parent) { m_configWidget = new QWidget(parent); m_profilesView = new QTreeView(m_configWidget); m_profilesView->setUniformRowHeights(true); m_profilesView->header()->setStretchLastSection(true); m_addButton = new QPushButton(tr("Add"), m_configWidget); m_cloneButton = new QPushButton(tr("Clone"), m_configWidget); m_delButton = new QPushButton(tr("Remove"), m_configWidget); m_makeDefaultButton = new QPushButton(tr("Make Default"), m_configWidget); QVBoxLayout *buttonLayout = new QVBoxLayout(); buttonLayout->setContentsMargins(0, 0, 0, 0); buttonLayout->addWidget(m_addButton); buttonLayout->addWidget(m_cloneButton); buttonLayout->addWidget(m_delButton); buttonLayout->addWidget(m_makeDefaultButton); buttonLayout->addItem(new QSpacerItem(10, 40, QSizePolicy::Minimum, QSizePolicy::Expanding)); QVBoxLayout *verticalLayout = new QVBoxLayout(); verticalLayout->addWidget(m_profilesView); QHBoxLayout *horizontalLayout = new QHBoxLayout(m_configWidget); horizontalLayout->addLayout(verticalLayout); horizontalLayout->addLayout(buttonLayout); Q_ASSERT(!m_model); m_model = new Internal::ProfileModel(verticalLayout); connect(m_model, SIGNAL(profileStateChanged()), this, SLOT(updateState())); m_profilesView->setModel(m_model); m_profilesView->header()->setResizeMode(0, QHeaderView::Stretch); m_profilesView->expandAll(); m_selectionModel = m_profilesView->selectionModel(); connect(m_selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(profileSelectionChanged())); connect(ProfileManager::instance(), SIGNAL(profileAdded(ProjectExplorer::Profile*)), this, SLOT(profileSelectionChanged())); connect(ProfileManager::instance(), SIGNAL(profileRemoved(ProjectExplorer::Profile*)), this, SLOT(profileSelectionChanged())); connect(ProfileManager::instance(), SIGNAL(profileUpdated(ProjectExplorer::Profile*)), this, SLOT(profileSelectionChanged())); // Set up add menu: connect(m_addButton, SIGNAL(clicked()), this, SLOT(addNewProfile())); connect(m_cloneButton, SIGNAL(clicked()), this, SLOT(cloneProfile())); connect(m_delButton, SIGNAL(clicked()), this, SLOT(removeProfile())); connect(m_makeDefaultButton, SIGNAL(clicked()), this, SLOT(makeDefaultProfile())); m_searchKeywords = tr("Profiles"); updateState(); if (m_toShow) m_selectionModel->select(m_model->indexOf(m_toShow), QItemSelectionModel::Clear | QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows); m_toShow = 0; return m_configWidget; }