/** Open a QFileDialog to browse for a Tor executable file. */ void GeneralPage::browseTorExecutable() { QString filePath = browseExecutable(tr("Select Path to Tor"), ui.lineTorExecutable->text()); if (! filePath.isEmpty()) ui.lineTorExecutable->setText(filePath); }
DGLRunAppProjectFactory::DGLRunAppProjectFactory() { m_ui.setupUi(&m_gui); #ifndef _WIN32 m_ui.radioButton_ModeWGLGLX->setText("GLX"); #endif CONNASSERT(m_ui.lineEdit_Executable, SIGNAL(editingFinished()), this, SLOT(updatePath())); CONNASSERT(m_ui.toolButton_Exec, SIGNAL(clicked()), this, SLOT(browseExecutable())); CONNASSERT(m_ui.toolButton_Dir, SIGNAL(clicked()), this, SLOT(browseDirectory())); m_ui.lineEdit_Executable->setFocus(); }
OpenWithManagerDialog::OpenWithManagerDialog(QWidget *parentObject) : QDialog(parentObject), ui(new Ui::OpenWithManagerDialog), m_factoryModel(new OpenWithExecutableModel(this)), m_patternModel(new OpenWithPatternModel(this)), m_patternMapper(new QDataWidgetMapper(this)), m_handlerMapper(new QDataWidgetMapper(this)), m_patternTypeDelegate(new PatternTypeDelegate(this)), m_dirty(false) { // Setup ui: ui->setupUi(this); // Setup MVC: ui->tableFactories->setModel(m_factoryModel); ui->tablePattern->setModel(m_patternModel); ui->tablePattern->setItemDelegate(m_patternTypeDelegate); ui->comboMatch->setModel(m_patternTypeDelegate->patternTypeModel()); m_handlerMapper->setModel(m_factoryModel); m_handlerMapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit); m_handlerMapper->addMapping(ui->editName, 0); m_handlerMapper->addMapping(ui->comboType, 1, "currentIndex"); m_handlerMapper->addMapping(ui->editExec, 2); m_patternMapper->setModel(m_patternModel); m_patternMapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit); m_patternMapper->setItemDelegate(m_patternTypeDelegate); m_patternMapper->addMapping(ui->editPattern, OpenWithPatternModel::PatternCol); m_patternMapper->addMapping(ui->comboMatch, OpenWithPatternModel::PatternTypeCol); m_patternMapper->addMapping(ui->checkCaseSensitive, OpenWithPatternModel::CaseSensitivityCol); // Setup executable completion QFileSystemModel *fsModel = new QFileSystemModel(this); fsModel->setFilter(QDir::Files | QDir::Dirs | QDir::NoDot); fsModel->setRootPath(QDir::rootPath()); QCompleter *fsCompleter = new QCompleter(fsModel, this); ui->editExec->setCompleter(fsCompleter); // Factory GUI: connect(ui->pushAddFactory, SIGNAL(clicked()), this, SLOT(addFactory())); connect(ui->pushRemoveFactory, SIGNAL(clicked()), this, SLOT(removeFactory())); connect(ui->comboType, SIGNAL(currentIndexChanged(int)), this, SLOT(factoryTypeChanged(int))); connect(ui->tableFactories->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(factorySelectionChanged())); // Executable GUI: connect(ui->pushExec, SIGNAL(clicked()), SLOT(browseExecutable())); connect(ui->editExec, SIGNAL(textChanged(QString)), SLOT(testExecutable())); // Pattern GUI: connect(ui->pushAddPattern, SIGNAL(clicked()), this, SLOT(addPattern())); connect(ui->pushRemovePattern, SIGNAL(clicked()), this, SLOT(removePattern())); connect(ui->tablePattern->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(patternSelectionChanged())); connect(ui->pushApplyPattern, SIGNAL(clicked()), m_patternMapper, SLOT(submit())); connect(ui->pushRevertPattern, SIGNAL(clicked()), m_patternMapper, SLOT(revert())); connect(m_patternModel, SIGNAL(rowsInserted(QModelIndex, int, int)), this, SLOT(patternDimensionsChanged())); connect(m_patternModel, SIGNAL(rowsRemoved(QModelIndex, int, int)), this, SLOT(patternDimensionsChanged())); connect(m_patternModel, SIGNAL(modelReset()), this, SLOT(patternDimensionsChanged())); // Test updates: connect(ui->editTest, SIGNAL(textChanged(QString)), this, SLOT(checkTestText())); connect(m_patternModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(checkTestText())); connect(m_patternModel, SIGNAL(layoutChanged()), this, SLOT(checkTestText())); connect(ui->tableFactories->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(checkTestText())); // handle apply button: connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), SLOT(buttonBoxClicked(QAbstractButton*))); // Mark dirty when the data changes. connect(m_factoryModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), SLOT(markDirty())); connect(m_factoryModel, SIGNAL(rowsInserted(QModelIndex, int, int)), SLOT(markDirty())); connect(m_factoryModel, SIGNAL(rowsRemoved(QModelIndex, int, int)), SLOT(markDirty())); connect(m_patternModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), SLOT(markDirty())); connect(m_patternModel, SIGNAL(rowsInserted(QModelIndex, int, int)), SLOT(markDirty())); connect(m_patternModel, SIGNAL(rowsRemoved(QModelIndex, int, int)), SLOT(markDirty())); }