IndexedFileAttachmentView::IndexedFileAttachmentView(QWidget *parent) : AttachmentView(parent), ui(new Ui::IndexedFileAttachmentView) { ui->setupUi(this); initializedUis << ui; connect(ui->buttonChooseFile, SIGNAL(clicked()), this, SLOT(chooseFile()) ); connect(ui->buttonChooseFileBig, SIGNAL(clicked()), this, SLOT(chooseFile()) ); }
void MainWindow::onButtonClicked(QAbstractButton *button) { Q_D(MainWindow); if (button == d->chooseFileBtn) { chooseFile(); } else if (button == d->chooseAnotherFileBtn) { chooseFile(); } else if (button == d->startPatchingBtn) { startPatching(); } }
int FrmImport::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = SecondaryFrm::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: rollbackImport(); break; case 1: loadItem((*reinterpret_cast< QListWidgetItem*(*)>(_a[1]))); break; case 2: { bool _r = readTableNames(); if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break; case 3: { bool _r = readTableNames((*reinterpret_cast< AbstractTableFormat*(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break; case 4: hideAppend((*reinterpret_cast< bool(*)>(_a[1]))); break; case 5: Ok(); break; case 6: Cancel(); break; case 7: preview((*reinterpret_cast< QListWidgetItem*(*)>(_a[1]))); break; case 8: preview(); break; case 9: chooseFile(); break; default: ; } _id -= 10; } return _id; }
/*! * Constructs a file chooser with a given \a parent. * */ QwwFileChooser::QwwFileChooser(QWidget *parent) : QwwButtonLineEdit(*new QwwFileChooserPrivate(this), parent) { Q_D(QwwFileChooser); #if QT_VERSION >= 0x040200 && !defined(QT_NO_COMPLETER) d->completer = new QCompleter(this); setCompleter(d->completer); QStyleOption opt; opt.initFrom(this); int mar = style()->pixelMetric(QStyle::PM_DefaultFrameWidth, &opt, this); int siz = style()->pixelMetric(QStyle::PM_SmallIconSize, &opt, this); #if QT_VERSION >=0x040500 setTextMargins(siz+2, 0, 0, 0); #else setStyleSheet(QString("QwwFileChooser {padding-left: %1px;}").arg(mar+siz+2)); #endif // connect(this, SIGNAL(textEdited(const QString&)), d->completer, SLOT(setCompletionPrefix(const QString&))); #endif setModel(new QDirModel(this)); setButtonPosition(RightOutside); connect(this, SIGNAL(buttonClicked()), this, SLOT(chooseFile())); setAutoRaise(true); setAcceptMode(QFileDialog::AcceptOpen); QShortcut *sc = new QShortcut(QKeySequence("Ctrl+Space"), this); connect(sc, SIGNAL(activated()), d->completer, SLOT(complete())); connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(_q_textChanged(const QString&))); }
FileChooser::FileChooser( QWidget *parent, const char *name ) : QWidget( parent ), md( File ) { if (name) setObjectName(name); QHBoxLayout *layout = new QHBoxLayout( this ); layout->setMargin( 0 ); layout->setSpacing( 4 ); lineEdit = new QLineEdit( this); layout->addWidget( lineEdit ); connect( lineEdit, SIGNAL( textChanged( const QString & ) ), this, SIGNAL( fileNameChanged( const QString & ) ) ); button = new QPushButton( "...", this); button->setFixedWidth( button->fontMetrics().width( " ... " ) ); layout->addWidget( button ); connect( button, SIGNAL( clicked() ), this, SLOT( chooseFile() ) ); setFocusProxy( lineEdit ); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { rowCount=0; mainLayout = new QVBoxLayout; widget = new QWidget; widget->setLayout(mainLayout); setCentralWidget(widget); //setStyleSheet("background-color:rgb(192,192,192)"); title = new QLabel("Genome Assembly"); title->setStyleSheet("font-size:25px"); mainLayout->addWidget(title); title->setAlignment(Qt::AlignHCenter); open = new QToolButton; open->setText("Click to choose a file..."); open->setStyleSheet("color:white;background-color:rgba(1,1,1,1);border-style:inset"); connect(open,SIGNAL(clicked()),this, SLOT(chooseFile())); open->setFixedSize(380,30); assemble = new QToolButton; assemble ->setText("Assemble"); assemble->setStyleSheet("color:white;background-color:rgba(1,1,1,1);border-style:inset"); assemble->setFixedHeight(30); connect(assemble,SIGNAL(clicked()),this,SLOT(code())); middleLayout = new QHBoxLayout; middleLayout->addWidget(open); middleLayout->addWidget(assemble); mainLayout->addLayout(middleLayout); table = new QTableWidget(0,8); table->setSelectionBehavior(QAbstractItemView::SelectRows); //设置为选择整行 QStringList header; header.append(tr("ID")); header.append(tr("Contigs Number")); header.append(tr("Total Length")); header.append(tr("Maximal Length")); header.append(tr("N50 Length")); header.append(tr("Mean Length")); header.append(tr("Median Length")); header.append(tr("Time(ms)")); table->setHorizontalHeaderLabels(header); table->setEditTriggers(QAbstractItemView::NoEditTriggers); //禁止编辑表格 table->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);//使列完全填充并且平分 table->setTextElideMode(Qt::ElideMiddle); table->verticalHeader()->setVisible(false); mainLayout->addWidget(table); mainLayout->addStretch(0); }
ImportFlexTextDialog::ImportFlexTextDialog(DatabaseAdapter *dbAdapter, QWidget *parent) : QDialog(parent), ui(new Ui::ImportFlexTextDialog) { mDbAdapter = dbAdapter; ui->setupUi(this); ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); connect(ui->choose, SIGNAL(clicked()), this, SLOT(chooseFile())); connect(ui->filename, SIGNAL(textChanged(QString)), this, SLOT(fillDataFromFlexText())); if( !chooseFile() ) QTimer::singleShot(0, this, SLOT(close())); setWindowTitle(tr("Import Flex Text")); }
QString QWebPage_QtDShell::__override_chooseFile(QWebFrame* originatingFrame0, const QString& oldFile1, bool static_call) { if (static_call) { return QWebPage::chooseFile((QWebFrame* )originatingFrame0, (const QString& )oldFile1); } else { return chooseFile((QWebFrame* )originatingFrame0, (const QString& )oldFile1); } }
//====================== class ItemProperties ============================ LinkProperties::LinkProperties(QWidget *parent) : QDialog(parent) { ui.setupUi(this); connect(ui.BRemove, SIGNAL(clicked()), this, SLOT(RemoveLink()) ); connect(ui.BChooseFile, SIGNAL(clicked()), this, SLOT(chooseFile()) ); }
void GUI::YuvFileOpenDialog::connectActions() { connect(button_ok_,SIGNAL(clicked()),this,SLOT(accept())); connect(button_cancel_,SIGNAL(clicked()),this,SLOT(reject())); connect(button_chooseFile_,SIGNAL(clicked()),this,SLOT(chooseFile())); connect(listView_recentlyUsed_->selectionModel(),SIGNAL(selectionChanged(QItemSelection, QItemSelection)),this,SLOT(selectionChanged(QItemSelection))); connect(this,SIGNAL(finished(int)),this,SLOT(hasFinished(int))); }
FileLocationChooser::FileLocationChooser() : QDialog(), ui(new Ui::FileLocationChooser) { ui->setupUi(this); ui->filePathEdit->setText(DEFAULT_PATH); connect(ui->browseButton, SIGNAL(clicked()), this, SLOT(chooseFile())); connect(ui->saveButton, SIGNAL(clicked()), this, SLOT(pathChosen())); }
FileChooser::FileChooser( QWidget *parent, QString name) : QDialog( parent) { setWindowTitle(name); setModal(true); ui.setupUi(this); connect(ui.lineEdit, SIGNAL(textChanged( const QString & ) ), this, SIGNAL( fileNameChanged( const QString & ) ) ); connect(ui.pushButton, SIGNAL( clicked() ), this, SLOT( chooseFile() ) ); setWindowTitle(name); }
IconChooser::IconChooser(QWidget* parent) : QDialog(parent), ui(new Ui::IconChooser) { ui->setupUi(this); ui->iconList->setItemDelegate(new IconChooserDelegate(ui->iconList)); connect(ui->chooseFile, SIGNAL(clicked()), this, SLOT(chooseFile())); connect(ui->siteUrl, SIGNAL(textChanged(QString)), this, SLOT(searchIcon(QString))); }
bool FileChooser::qt_invoke( int _id, QUObject* _o ) { switch ( _id - staticMetaObject()->slotOffset() ) { case 0: setFileName((const QString&)static_QUType_QString.get(_o+1)); break; case 1: setMode((Mode)static_QUType_enum.get(_o+1)); break; case 2: chooseFile(); break; default: return QWidget::qt_invoke( _id, _o ); } return TRUE; }
NewContainerDialog::NewContainerDialog(QWidget *parent, ContainerListModel *model) : QDialog(parent), m_model(model), ui(new Ui::NewContainerDialog) { ui->setupUi(this); QObject::connect(ui->chooseButton, SIGNAL(clicked()), this, SLOT(chooseFile())); QObject::connect(ui->loadUrlButton, SIGNAL(clicked()), this, SLOT(tryCreateHttpFtp())); QObject::connect(ui->loadLocalButton, SIGNAL(clicked()), this, SLOT(tryCreateLocal())); }
UIClient::UIClient(QWidget *parent) : QDialog(parent), ui(new Ui::UIClient) { ui->setupUi(this); ui->statusInfo->setReadOnly(true); c.setProcBarCon(ui->progressBar); c.setStatusInfo(ui->statusInfo); c.setSpeedLabel(ui->transSpeed); c.setFileSrvAddr(ui->fileServAddr); connect(ui->fileSendBnt, SIGNAL(clicked()), this, SLOT(sendFile())); connect(ui->fileChooseBnt, SIGNAL(clicked()), this, SLOT(chooseFile())); }
void FileChooser::openFileChooser(Document* doc) { Page *page = doc->page(); Frame *frame = doc->frame(); if (!page || !frame) return; FrameLoaderClientQt *fl = static_cast<FrameLoaderClientQt*>(frame->loader()->client()); if (!fl) return; QString f = fl->chooseFile(m_filename); if (!f.isEmpty()) chooseFile(f); }
ReportEditWidget::ReportEditWidget(QWidget *parent) : QWidget(parent), ui(new Ui::ReportEditWidget) { ui->setupUi(this); m_menuModel = new QSqlQueryModel(this); m_typeModel = new ReportTypeModel(this); ui->cmbType->setModel(m_typeModel, 0, 1); connect(ui->btnCancel, SIGNAL(clicked()), SIGNAL(closed())); connect(ui->btnSave, SIGNAL(clicked()), SLOT(save())); connect(ui->btnChooseSourceFile, SIGNAL(clicked()), SLOT(chooseFile())); connect(ui->btnSaveToFile, SIGNAL(clicked()), SLOT(saveToFile())); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); // Set title this->setWindowTitle(WE_APP_TITLE); ui->btnApply->setEnabled(false); // Connect signals/slots QObject::connect(ui->btnApply, SIGNAL(clicked()), this, SLOT(apply())); QObject::connect(ui->btnFilePath, SIGNAL(clicked()), this, SLOT(chooseFile())); QObject::connect(ui->btnQuit, SIGNAL(clicked()), qApp, SLOT(quit())); }
InsertGraphics::InsertGraphics(QWidget *parent, InsertGraphicsConfig *conf) : QDialog(parent) { setWindowTitle(tr("Insert Graphic")); setModal(true); ui.setupUi(this); ui.fileSelectButton->setIcon(getRealIcon("fileopen")); ui.pbSaveDefault->setIcon(getRealIcon("filesave")); connect(ui.leFile, SIGNAL(textChanged(const QString &)), this, SIGNAL(fileNameChanged(const QString &))); connect(ui.fileSelectButton, SIGNAL(clicked()), this, SLOT(chooseFile())); connect(ui.rbWidthHeight, SIGNAL(toggled(bool)), this, SLOT(includeOptionChanged())); connect(ui.rbUser, SIGNAL(toggled(bool)), this, SLOT(includeOptionChanged())); connect(ui.cbWidth, SIGNAL(toggled(bool)), this, SLOT(includeOptionChanged())); connect(ui.cbHeight, SIGNAL(toggled(bool)), this, SLOT(includeOptionChanged())); connect(ui.leWidth, SIGNAL(textChanged(QString)), this, SLOT(includeOptionChanged())); connect(ui.leHeight, SIGNAL(textChanged(QString)), this, SLOT(includeOptionChanged())); connect(ui.cbWidthUnit, SIGNAL(currentIndexChanged(QString)), this, SLOT(includeOptionChanged())); connect(ui.cbHeightUnit, SIGNAL(currentIndexChanged(QString)), this, SLOT(includeOptionChanged())); connect(ui.upButton, SIGNAL(clicked()), this, SLOT(posMoveItemUp())); connect(ui.downButton, SIGNAL(clicked()), this, SLOT(posMoveItemDown())); connect(ui.leLabel, SIGNAL(textChanged(QString)), this, SLOT(labelChanged(QString))); connect(ui.pbSaveDefault, SIGNAL(clicked()), this, SLOT(saveDefault())); connect(this, SIGNAL(fileNameChanged(const QString &)), this, SLOT(updateLabel(const QString &))); setWindowTitle(tr("Insert Graphics","Wizard")); // adjust listPlacement size ui.listPlacement->addItem(new QListWidgetItem(tr("Here"), ui.listPlacement, InsertGraphics::PlaceHere)); ui.listPlacement->addItem(new QListWidgetItem(tr("Top"), ui.listPlacement, InsertGraphics::PlaceTop)); ui.listPlacement->addItem(new QListWidgetItem(tr("Bottom"), ui.listPlacement, InsertGraphics::PlaceBottom)); ui.listPlacement->addItem(new QListWidgetItem(tr("Page"), ui.listPlacement, InsertGraphics::PlacePage)); int rows = ui.listPlacement->count(); int rowSize = ui.listPlacement->sizeHintForRow(0); int height = rows * rowSize; int frameWidth = ui.listPlacement->frameWidth(); ui.listPlacement->setFixedHeight(height + frameWidth * 2); includeOptionChanged(); filter = "Images (*.eps *.jpg *.png *.pdf)"; ui.cbWidthUnit->insertItems(0, widthUnits); ui.cbHeightUnit->insertItems(0, heightUnits); autoLabel = true; defaultConfig = conf; setConfig(*conf); }
ccRenderToFileDlg::ccRenderToFileDlg(unsigned baseWidth, unsigned baseHeight, QWidget* parent/*=0*/) : QDialog(parent) , w(baseWidth) , h(baseHeight) { setupUi(this); //we grab the list of supported image file formats (writing) QList<QByteArray> list = QImageWriter::supportedImageFormats(); if (list.size()<1) { ccConsole::Error("No supported image format on this platform?!"); reject(); return; } //we convert this list into a proper "filters" string QString firstExtension(list[0].data()); QString firstFilter; for (int i=0;i<list.size();++i) { filters.append(QString("%1 image (*.%2)\n").arg(QString(list[i].data()).toUpper()).arg(list[i].data())); if (i==0) firstFilter = filters; } QSettings settings; settings.beginGroup("RenderToFile"); selectedFilter = settings.value("selectedFilter",firstFilter).toString(); QString currentPath = settings.value("currentPath",QApplication::applicationDirPath()).toString(); QString selectedExtension = settings.value("selectedExtension",firstExtension).toString(); QString baseFilename = settings.value("baseFilename","capture").toString(); bool dontScale = settings.value("dontScaleFeatures",dontScalePoints()).toBool(); settings.endGroup(); dontScaleFeaturesCheckBox->setChecked(dontScale); filenameLineEdit->setText(currentPath+QString("/")+baseFilename+QString(".")+selectedExtension); zoomDoubleSpinBox->setValue(s_zoom); connect(chooseFileButton, SIGNAL(clicked()), this, SLOT(chooseFile())); connect(zoomDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(updateInfo())); connect(buttonBox, SIGNAL(accepted()), this, SLOT(saveSettings())); updateInfo(); }
FileRequester::FileRequester(QWidget *parent) : QWidget(parent) { _fileEdit = new QLineEdit(this); _fileButton = new QToolButton(this); QHBoxLayout * layout = new QHBoxLayout(this); layout->setMargin(0); layout->addWidget(_fileEdit); layout->addWidget(_fileButton); setLayout(layout); _fileButton->setIcon(QPixmap(":kst_changefile.png")); setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); connect (_fileEdit, SIGNAL(textChanged(const QString &)), this, SLOT(setFile(const QString &))); connect (_fileButton, SIGNAL(clicked()), this, SLOT(chooseFile())); }
FileRequester::FileRequester(const QString &file, QWidget *parent) : QWidget(parent), _file(file) { _fileEdit = new QLineEdit(this); _fileButton = new QToolButton(this); QHBoxLayout * layout = new QHBoxLayout(this); layout->addWidget(_fileEdit); layout->addWidget(_fileButton); setLayout(layout); int size = style()->pixelMetric(QStyle::PM_SmallIconSize); _fileButton->setIcon(QPixmap(":kst_changefile.png")); _fileButton->setFixedSize(size + 8, size + 8); setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); connect (_fileEdit, SIGNAL(textEdited(const QString &)), this, SLOT(setFile(const QString &))); connect (_fileButton, SIGNAL(clicked()), this, SLOT(chooseFile())); }
void Viewer::createMenus() { fileMenu = new QMenu(tr("&File"), this); brightnessMenu = new QMenu(tr("&Brightness"), this); QAction *openAction = fileMenu->addAction(tr("&Open...")); openAction->setShortcut(QKeySequence("Ctrl+O")); saveAction = fileMenu->addAction(tr("&Save...")); saveAction->setShortcut(QKeySequence("Ctrl+S")); saveAction->setEnabled(false); QAction *quitAction = fileMenu->addAction(tr("E&xit")); quitAction->setShortcut(QKeySequence("Ctrl+Q")); QAction *noBrightness = brightnessMenu->addAction(tr("&0%")); noBrightness->setCheckable(true); QAction *quarterBrightness = brightnessMenu->addAction(tr("&25%")); quarterBrightness->setCheckable(true); QAction *halfBrightness = brightnessMenu->addAction(tr("&50%")); halfBrightness->setCheckable(true); QAction *threeQuartersBrightness = brightnessMenu->addAction(tr("&75%")); threeQuartersBrightness->setCheckable(true); QAction *fullBrightness = brightnessMenu->addAction(tr("&100%")); fullBrightness->setCheckable(true); menuMap[noBrightness] = None; menuMap[quarterBrightness] = Quarter; menuMap[halfBrightness] = Half; menuMap[threeQuartersBrightness] = ThreeQuarters; menuMap[fullBrightness] = Full; currentBrightness = fullBrightness; currentBrightness->setChecked(true); brightnessMenu->setEnabled(false); menuBar()->addMenu(fileMenu); menuBar()->addMenu(brightnessMenu); connect(openAction, SIGNAL(triggered()), this, SLOT(chooseFile())); connect(saveAction, SIGNAL(triggered()), this, SLOT(saveImage())); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); connect(brightnessMenu, SIGNAL(triggered(QAction *)), this, SLOT(setBrightness(QAction *))); }
FtpClientWindow::FtpClientWindow(QWidget *parent, Qt::WFlags flags) : QDialog(parent, flags) { setupUi(this); ftpClient = new FtpClient(this); connect(ftpServerLineEdit, SIGNAL(editingFinished ()), this, SLOT(changeServerName())); //connect(ftpServerPortLineEdit, SIGNAL(editingFinished ()), // this, SLOT(changeServerPort())); //connect(userNamelineEdit, SIGNAL(editingFinished ()), // this, SLOT(changeUserName())); //connect(passWordlineEdit, SIGNAL(editingFinished ()), // this, SLOT(changePWD())); connect(listWidget, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(processItem(QListWidgetItem *))); connect(listWidget, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(switchDownloadButton())); connect(connectPB, SIGNAL(clicked()), this, SLOT(ftpConnect())); //connect(cdUpDirPB, SIGNAL(clicked()), this, SLOT(cdParent())); connect(downLoadPB, SIGNAL(clicked()), this, SLOT(downloadFile())); connect(putLoadPB, SIGNAL(clicked()), this, SLOT(putloadFile())); connect(choosePB, SIGNAL(clicked()), this, SLOT(chooseFile())); connect(ftpClient, SIGNAL(cmdChangeList(const QUrlInfo &)), this, SLOT(changeList(const QUrlInfo &))); connect(ftpClient, SIGNAL(cmdConncted(bool)), this, SLOT(onConnect(bool))); connect(ftpClient, SIGNAL(cmdGot(bool)), this, SLOT(onGot(bool))); connect(ftpClient, SIGNAL(cmdPut(bool)), this, SLOT(onPut(bool))); connect(ftpClient, SIGNAL(cmdList(bool)), this, SLOT(onList(bool))); //connect(ftpClient, SIGNAL(cmdIsTopDir(bool)), // this, SLOT(onTopDir(bool))); connect(quitPB, SIGNAL(clicked()), this, SLOT(close())); }
ConfigDialog::ConfigDialog(QWidget *parent) : QDialog(parent) { setModal(true); setWindowTitle(QString("Configure root directory")); fil = new QFile("/home/user/.mysehat-config"); if(!fil->open(QIODevice::ReadOnly)) { qDebug("no config"); } QTextStream stream(fil); QString path; stream >> path; fil->close(); path_e = new QLineEdit(path); path_e->setReadOnly(true); browse_b = new QPushButton(tr("Browse.")); lay = new QHBoxLayout(this); lay->addWidget(path_e); lay->addWidget(browse_b); connect(browse_b,SIGNAL(clicked()),this,SLOT(chooseFile())); }
void DataSourceSelector::setup() { _fileEdit = new QLineEdit(this); _fileButton = new QToolButton(this); int h = fontMetrics().lineSpacing()*4/3; _fileEdit->setFixedHeight(h); QHBoxLayout * layout = new QHBoxLayout(this); layout->setMargin(0); layout->addWidget(_fileEdit); layout->addWidget(_fileButton); _fileButton->setFixedSize(h,h); setLayout(layout); //int size = style()->pixelMetric(QStyle::PM_SmallIconSize); _fileButton->setFixedSize(h,h); _fileButton->setIcon(KstGetIcon("kst_changefile")); //qDebug() << "file button small icon size" << size; setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); //connect (_fileEdit, SIGNAL(textChanged(const QString &)), this, SIGNAL(changed(const QString &))); connect (_fileEdit, SIGNAL(textChanged(QString)), this, SLOT(updateFile(QString))); connect (_fileButton, SIGNAL(clicked()), this, SLOT(chooseFile())); QFileSystemModel *dirModel = new QFileSystemModel; dirModel->setFilter(QDir::AllEntries); dirModel->setRootPath(QString('/')); QCompleter *completer = new QCompleter(this); completer->setModel(dirModel); _fileEdit->setCompleter(completer); setFixedHeight(h); }
void FileChooser::openFileChooser(Document* document) { FrameView* view = document->view(); if (!view) return; GtkWidget* dialog = gtk_file_chooser_dialog_new(_("Upload File"), GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(view->containingWindow()))), GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); // We need this protector because otherwise we can be deleted if the file upload control is detached while // we're within the gtk_run_dialog call. RefPtr<FileChooser> protector(this); String result; const bool acceptedDialog = gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT; if (acceptedDialog && stringByAdoptingFileSystemRepresentation(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)), result)) chooseFile(result); gtk_widget_destroy(dialog); }
CustomActionDialog::CustomActionDialog(QWidget* parent, Qt::WFlags fl) : QDialog(parent, fl) { setWindowTitle(tr("MantidPlot") + " - " + tr("Add Custom Action")); itemsList = new QListWidget(); itemsList->setSelectionMode(QAbstractItemView::SingleSelection); itemsList->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred)); itemsList->setSpacing(2); QGroupBox *gb1 = new QGroupBox(); gb1->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred)); QGridLayout *gl1 = new QGridLayout(gb1); gl1->addWidget(new QLabel(tr("Folder")), 0, 0); folderBox = new QLineEdit(); gl1->addWidget(folderBox, 0, 1); folderBtn = new QPushButton(tr("Choose &Folder")); gl1->addWidget(folderBtn, 0, 2); gl1->addWidget(new QLabel(tr("Script File")), 1, 0); fileBox = new QLineEdit(); gl1->addWidget(fileBox, 1, 1); fileBtn = new QPushButton(tr("Choose &Script")); gl1->addWidget(fileBtn, 1, 2); gl1->addWidget(new QLabel(tr("Icon")), 2, 0); iconBox = new QLineEdit(); gl1->addWidget(iconBox, 2, 1); iconBtn = new QPushButton(tr("Choose &Icon")); gl1->addWidget(iconBtn, 2, 2); gl1->addWidget(new QLabel(tr("Text")), 3, 0); textBox = new QLineEdit(); gl1->addWidget(textBox, 3, 1); gl1->addWidget(new QLabel(tr("Tool Tip Text")), 4, 0); toolTipBox = new QLineEdit(); gl1->addWidget(toolTipBox, 4, 1); gl1->addWidget(new QLabel(tr("Shortcut")), 5, 0); shortcutBox = new QLineEdit(); gl1->addWidget(shortcutBox, 5, 1); menuBtn = new QRadioButton(tr("&Menu")); gl1->addWidget(menuBtn, 6, 0); menuBox = new QComboBox(); gl1->addWidget(menuBox, 6, 1); toolBarBtn = new QRadioButton(tr("&Tool Bar")); toolBarBtn->setChecked(true); gl1->addWidget(toolBarBtn, 7, 0); toolBarBox = new QComboBox(); gl1->addWidget(toolBarBox, 7, 1); gl1->setRowStretch(8, 1); gl1->setColumnStretch(1, 10); QHBoxLayout * bottomButtons = new QHBoxLayout(); bottomButtons->addStretch(); buttonSave = new QPushButton(tr("&Save")); buttonSave->setAutoDefault( true ); bottomButtons->addWidget(buttonSave); buttonAdd = new QPushButton(tr("&Add")); buttonAdd->setAutoDefault( true ); bottomButtons->addWidget(buttonAdd); buttonRemove = new QPushButton(tr("&Remove")); buttonRemove->setAutoDefault(true); bottomButtons->addWidget(buttonRemove); buttonCancel = new QPushButton(tr("&Close")); buttonCancel->setAutoDefault( true ); bottomButtons->addWidget( buttonCancel ); QHBoxLayout *vl = new QHBoxLayout(); vl->addWidget(itemsList); vl->addWidget(gb1); QVBoxLayout *mainLayout = new QVBoxLayout(this); mainLayout->addLayout(vl); mainLayout->addLayout(bottomButtons); init(); QShortcut *accelRemove = new QShortcut(QKeySequence(Qt::Key_Delete), this); connect(accelRemove, SIGNAL(activated()), this, SLOT(removeAction())); connect(buttonSave, SIGNAL(clicked()), this, SLOT(saveCurrentAction())); connect(buttonAdd, SIGNAL(clicked()), this, SLOT(addAction())); connect(buttonRemove, SIGNAL(clicked()), this, SLOT(removeAction())); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); connect(iconBtn, SIGNAL(clicked()), this, SLOT(chooseIcon())); connect(fileBtn, SIGNAL(clicked()), this, SLOT(chooseFile())); connect(folderBtn, SIGNAL(clicked()), this, SLOT(chooseFolder())); connect(itemsList, SIGNAL(currentRowChanged(int)), this, SLOT(setCurrentAction(int))); }
void FormMain_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) { if (controlWithDefValue != 0 && id == controlWithDefValue && codeNotify==EN_CHANGE) controlWithDefValue= 0; switch (id) { case IDOK: btnOk_Click(hwnd); break; case IDCANCEL: btnCancel_Click(hwnd); break; case IDC_BUTTON_DETAILS: btnDetails_Click(hwnd); break; case IDC_BUTTON_HELP: btnHelp_Click(hwnd); break; case IDC_BUTTON_TEST: btnTest_Click(hwnd); break; case IDC_SSLKEYCHOOSER: chooseFile(hwnd, IDC_EDIT_sslkey); break; case IDC_SSLCERTCHOOSER: chooseFile(hwnd, IDC_EDIT_sslcert); break; case IDC_SSLCACHOOSER: chooseFile(hwnd, IDC_EDIT_sslca); break; case IDC_SSLCAPATHCHOOSER: choosePath(hwnd, IDC_EDIT_sslcapath); break; case IDC_RSAKEYCHOOSER: chooseFile(hwnd, IDC_EDIT_rsakey); break; case IDC_CHOOSER_plugin_dir: choosePath(hwnd, IDC_EDIT_plugin_dir); break; case IDC_RADIO_tcp: case IDC_RADIO_pipe: SwitchTcpOrPipe(hwnd, !!Button_GetCheck(GetDlgItem(hwnd, IDC_RADIO_pipe))); break; case IDC_CHECK_cursor_prefetch_active: { HWND cursorTab= TabCtrl_1.hTabPages[CURSORS_TAB-1]; assert(cursorTab); HWND prefetch= GetDlgItem(cursorTab, IDC_EDIT_cursor_prefetch_number); assert(prefetch); EnableWindow(prefetch, !!Button_GetCheck(GetDlgItem(cursorTab, IDC_CHECK_cursor_prefetch_active))); if (Edit_GetTextLength(prefetch) == 0) { setUnsignedFieldData(cursorTab, default_cursor_prefetch, IDC_EDIT_cursor_prefetch_number); } } break; case IDC_EDIT_name: { if (codeNotify==EN_CHANGE) { int len = Edit_GetTextLength(GetDlgItem(hwnd,IDC_EDIT_name)); Button_Enable(GetDlgItem(hwnd,IDOK), len > 0); Button_Enable(GetDlgItem(hwnd,IDC_BUTTON_TEST), len > 0); RedrawWindow(hwnd,NULL,NULL,RDW_INVALIDATE); } break; } case IDC_EDIT_dbname: processDbCombobox(hwnd, hwndCtl, codeNotify); break; case IDC_EDIT_charset: processCharsetCombobox(hwnd, hwndCtl, codeNotify); } return; }