/** * Returns the path tab. */ QWidget *SettingsDialog::createPathTab() { QPushButton *button; QWidget *tab = new QWidget(this); QGridLayout *grid = new QGridLayout(tab, 5, 3, 5, 5); grid->addWidget(new QLabel(tr("External Editor"), tab), 0, 0); editorLineEdit_ = new QLineEdit(tab); grid->addWidget(editorLineEdit_, 0, 1); button = new QPushButton("...", tab); grid->addWidget(button, 0, 2); connect(button, SIGNAL(clicked()), this, SLOT(chooseExternalEditor())); grid->addWidget(new QLabel(tr("External Compiler"), tab), 1, 0); compilerLineEdit_ = new QLineEdit(tab); grid->addWidget(compilerLineEdit_, 1, 1); button = new QPushButton("...", tab); grid->addWidget(button, 1, 2); connect(button, SIGNAL(clicked()), this, SLOT(chooseExternalCompiler())); grid->addWidget(new QLabel(tr("C Source Template Path"), tab), 2, 0); cTemplateLineEdit_ = new QLineEdit(tab); grid->addWidget(cTemplateLineEdit_, 2, 1); button = new QPushButton("...", tab); grid->addWidget(button, 2, 2); connect(button, SIGNAL(clicked()), this, SLOT(chooseTemplatePath())); return tab; }
void SaveFormAsTemplate::checkToAddPath(int itemIndex) { if (itemIndex != m_addPathIndex) return; const QString dir = chooseTemplatePath(this); if (dir.isEmpty()) { ui.categoryCombo->setCurrentIndex(0); return; } ui.categoryCombo->insertItem(m_addPathIndex, dir); ui.categoryCombo->setCurrentIndex(m_addPathIndex); ++m_addPathIndex; }
void TemplateOptionsWidget::addTemplatePath() { const QString templatePath = chooseTemplatePath(m_core, this); if (templatePath.isEmpty()) return; const QList<QListWidgetItem *> existing = m_ui->m_templatePathListWidget->findItems(templatePath, Qt::MatchExactly); if (!existing.empty()) return; QListWidgetItem *newItem = new QListWidgetItem(templatePath); m_ui->m_templatePathListWidget->addItem(newItem); m_ui->m_templatePathListWidget->setCurrentItem(newItem); }