Пример #1
0
void MainWindow::OpenWAVFile()
{
QFileDialog *g  = new QFileDialog(this);
#if  QT_VERSION==0x040806 || defined(Q_OS_UNIX)
g->setNameFilter("Audio Files (*.wav | *.mp3)");
#else
g->setNameFilter("Audio Files (*.wav;*.mp3)");
#endif
#if QT_VERSION>=0x050000 && !defined(Q_OS_UNIX)
g->setDirectory(lastdirR);
#endif
if(g->exec())
{
ui->listWidget->clear();
f = fopen(g->selectedFiles().at(0).toLocal8Bit().constData(),"rb");
fread(&format,1,44,f);
fclose(f);
ui->locut->setMaximum(format.SampleRate/2);
ui->hicut->setMaximum(format.SampleRate/2);
ui->locutslider->setMaximum(format.SampleRate/2);
ui->hicutslider->setMaximum(format.SampleRate/2);

filename = g->selectedFiles().at(0);
QFileInfo info(g->selectedFiles().at(0));
lastdirR = info.absolutePath();
ui->actionApply_Effect->setEnabled(true);
ui->pushButton->setEnabled(true);
}
}
Пример #2
0
bool ImageViewer::saveAsLabelledResult(QString &pathResult)
{
    if(!_srcOcvImage) return false;
    if(!_displayImage) return false;
    if(!_result_display) return false;

    QFileDialog *fDlg = new QFileDialog(this);
    fDlg->setWindowTitle(tr("保存标注结果"));
    fDlg->setAcceptMode(QFileDialog::AcceptSave);
    fDlg->setFileMode(QFileDialog::AnyFile);
    fDlg->setViewMode(QFileDialog::Detail);
    fDlg->setDirectory(QDir::currentPath());

    fDlg->setFilter(MOLI_IMAGE_FILTER);
    fDlg->setDefaultSuffix("png");

    if(fDlg->exec() == QDialog::Accepted)
    {
        QString filename = fDlg->selectedFiles()[0];
        if(_result_display->save(filename))
        {
            pathResult = filename;
            return true;
        }
        else return false;
    }
    else return true;
}
Пример #3
0
/**
 * @brief Stores the debug information to a markdown file
 */
void SettingsDialog::on_saveDebugInfoButton_clicked() {
    QFileDialog dialog;
    dialog.setFileMode(QFileDialog::AnyFile);
    dialog.setAcceptMode(QFileDialog::AcceptSave);
    dialog.setDirectory(QDir::homePath());
    dialog.setNameFilter(tr("Markdown files (*.md)"));
    dialog.setWindowTitle(tr("Save debug information"));
    dialog.selectFile("QOwnNotes Debug Information.md");
    int ret = dialog.exec();

    if (ret == QDialog::Accepted) {
        QStringList fileNames = dialog.selectedFiles();
        if (fileNames.size() == 0) {
            return;
        }

        QFile file(fileNames.at(0));

        if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
            qWarning() << file.errorString();
            return;
        }

        QTextStream out(&file);
        out.setCodec("UTF-8");
        out << ui->debugInfoTextEdit->toPlainText();
        file.flush();
        file.close();
    }
}
Пример #4
0
void codecs::on_readBtn_clicked()
{
    QFileDialog *dialog = new QFileDialog();
    dialog->setDirectory(curDir);
    dialog->setWindowTitle("Open *any* file to decode if possible");

    readFileToBuffer(dialog->getOpenFileName());
}
Пример #5
0
/**
Handler for the onbrowse event.
*/
void SlicingAlgorithmDialog::onBrowse() {
  QFileDialog dialog;
  dialog.setDirectory(QDir::homePath());
  dialog.setNameFilter("Nexus files (*.nxs)");
  if (dialog.exec()) {
    ui.txt_filename->setText(dialog.selectedFiles().front());
  }
}
Пример #6
0
void Settings::browseMount() {
	QFileDialog *fd = new QFileDialog(this);
	fd->setFileMode(QFileDialog::DirectoryOnly);
	fd->setAcceptMode(QFileDialog::AcceptOpen);
	fd->setDirectory( txtMount->text() );
	if (fd->exec())
		txtMount->setText( fd->selectedFiles()[0] );
}
Пример #7
0
void MainWindow::choosePath() {
    QFileDialog dirDialog;
    dirDialog.setFileMode(QFileDialog::DirectoryOnly);
    dirDialog.setDirectory(ui->lineEdit_3->text());
    if(dirDialog.exec()) {
        if(!dirDialog.selectedFiles().isEmpty())
            ui->lineEdit_3->setText(dirDialog.selectedFiles().at(0));
    }
}
Пример #8
0
void BrowsePicture::OpenDir()
{
  QFileDialog *fileDialog = new QFileDialog(this); 
  fileDialog->setWindowTitle(tr("选择图片所在文件夹路径")); 
  fileDialog->setDirectory("../"); 
  fileDialog-> setFileMode( QFileDialog::DirectoryOnly ); 
  if(fileDialog->exec() == QDialog::Accepted) { 
    pic_path = fileDialog->selectedFiles()[0]; 
  }
}
Пример #9
0
void MainWindow::on_btnSelectOutputFolder_clicked() {
    QFileDialog fileDlg;
    fileDlg.setOption(QFileDialog::ShowDirsOnly, true);
    fileDlg.setFileMode(QFileDialog::DirectoryOnly);
    fileDlg.setDirectory(ui->txtOutpuFolder->text());
    if (fileDlg.exec()) {
        ui->txtOutpuFolder->setText(fileDlg.selectedFiles().at(0));
        AppSettings::setOutputFolder(ui->txtOutpuFolder->text());
    }
}
Пример #10
0
void PreferencesDialog::slotBrowseFlow()
{
    QFileDialog dialog;
    dialog.setAcceptMode(QFileDialog::AcceptOpen);
    dialog.setFileMode(QFileDialog::ExistingFile);
    dialog.setDirectory(QFileInfo(ui->buildFlow->text()).absolutePath());
    if (dialog.exec() == QDialog::Accepted) {
        ui->buildFlow->setText(dialog.selectedFiles().at(0));
        slotValidateFlowBinary();
    }
}
Пример #11
0
void CategoryDialog::showDirDialog()
{
    QFileDialog *dlg = new QFileDialog(this);
    dlg->setDirectory(ui->catpath->text());
    dlg->setAttribute(Qt::WA_DeleteOnClose);
    dlg->setFileMode(QFileDialog::DirectoryOnly);
    dlg->setWindowTitle(tr("Выбор директории"));
    dlg->setOption(QFileDialog::DontUseNativeDialog);
    dlg->setModal(true);
    connect(dlg,SIGNAL(fileSelected(QString)),this,SLOT(setCategoryDir(QString)));
    dlg->show();
}
Пример #12
0
void MainWindow::on_btnSelectOutputDirectory_clicked()
{
    QFileDialog fileDlg;
    fileDlg.setOption(QFileDialog::ShowDirsOnly, true);
    fileDlg.setFileMode(QFileDialog::DirectoryOnly);
    fileDlg.setDirectory(ui->txtOutputDirectory->text());
    if (fileDlg.exec())
    {
        ui->txtOutputDirectory->setText(fileDlg.selectedFiles().at(0));
        QSettings().setValue("outputDirectory", ui->txtOutputDirectory->text());
    }
}
Пример #13
0
void ZoneViewerWindow::selectAssetDir()
{
    QFileDialog fd;
    fd.setFileMode(QFileDialog::Directory);
    fd.setDirectory(m_scene->assetPath());
    fd.setWindowTitle("Select an asset directory");
    // OpenGL rendering interferes wtih QFileDialog
    m_viewport->setAnimation(false);
    if((fd.exec() == QDialog::Accepted) && (fd.selectedFiles().count() > 0))
        m_scene->setAssetPath(fd.selectedFiles().value(0));
    m_viewport->setAnimation(true);
}
Пример #14
0
/**
 * @brief MainWindow::open
 * Open new Mesh File
 */
void MainWindow::open(){
QFileDialog     *fd;
QString         filter;

  fd = new QFileDialog();
  fd->setDirectory(sampleDir);
  FileName = fd->getOpenFileName(this,tr("Open Mesh Files"),sampleDir,"Mesh Files ( *.ply)", &filter);
  if (!FileName.isEmpty()){
    ui->glwidget->setMeshFile(FileName.toStdString());
    ui->glwidget->initialize();
  }
}
Пример #15
0
void MainWindow::OpenFile(void){
    QFileDialog     *fd;
    QString         filter;

      fd = new QFileDialog();
      fd->setDirectory(sampleDir);
      FileName = fd->getOpenFileName(this,tr("Open Mesh Files"),sampleDir,"Mesh Files ( *.ply)", &filter);
      if (!FileName.isEmpty()){
        glwidget->setMeshFile(FileName);
        glwidget->loadMesh();
      }

}
Пример #16
0
QFileDialog* selectFiles(QString title, QString dir, QString nameString, QString nameExt) {
    QFileDialog* finder = new QFileDialog();
    finder->setWindowTitle(title);
    finder->setDirectory(dir);
    finder->setNameFilter(nameString + "(" + nameExt + ")");
    QListView *l = finder->findChild<QListView*>("listView");
    if (l)
        l->setSelectionMode(QAbstractItemView::ExtendedSelection);
    QTreeView *t = finder->findChild<QTreeView*>();
    if (t)
        t->setSelectionMode(QAbstractItemView::ExtendedSelection);
    return finder;
}
Пример #17
0
//---------------------------------------------------------------------------------------------
void TMainForm::sl_SetPath()
{
  QString path = ui.lePath->text();
  QFileDialog fileDialog;
  if(!path.isEmpty())
    fileDialog.setDirectory(path);
  fileDialog.setFileMode(QFileDialog::Directory);

  if(fileDialog.exec())
    ui.lePath->setText(fileDialog.directory().absolutePath());

  SaveInReestr();
}
Пример #18
0
void ConfigForm::changeSearchIn_slot()
{
    QFileDialog * myDiag;
    QStringList filterList;
    QString fileName;

    myDiag = new QFileDialog( this );

    myDiag->setWindowTitle( tr("Select slocate database for querying.") );
    myDiag->setFileMode( QFileDialog::ExistingFile );
    myDiag->setViewMode( QFileDialog::List );
    QStringList filters;
    filters << tr("db files (*.db *.DB)")
            << tr("All files (*)");
    myDiag->setNameFilters(filters);

    QFileInfo tmpFile = QFileInfo( ui->LineEditSearchIn->text() );
    if ( !ui->LineEditSearchIn->text().isEmpty() && tmpFile.dir().exists() )
    {
        myDiag->setDirectory( tmpFile.dir() );
    }
    else
    {
        myDiag->setDirectory( QDir::homePath() + QString("/.qlocate/") );
    }

    myDiag->exec();

    if( !myDiag->selectedFiles().isEmpty() )
        fileName = myDiag->selectedFiles().first();

    delete (myDiag);

    if ( !fileName.isEmpty() )
    {
        ui->LineEditSearchIn->setText(fileName);
    }
}
Пример #19
0
void MainWindow::OpenFileShader(void){
    QFileDialog     *fd;
    QString         filter;

      fd = new QFileDialog();
      fd->setDirectory(sampleDir);
      FileName = fd->getOpenFileName(this,tr("Open Shader Files"),sampleDir,"Shader Files ( *.vert | *.frag)", &filter);
      fd->hide();

      if (!FileName.isEmpty()){
        glwidget->setShaderFile(FileName);
        glwidget->loadShader();
      }
}
Пример #20
0
void COptions::on_cmdBrowsePath_clicked()
{
    // Let's create and show a nice dialog to choose a directory...
    QFileDialog* dirDlg = new QFileDialog(this, "Karten-Verzeichnis");
    dirDlg->setDirectory(ui->txtChartPath->text());
    dirDlg->setOption(QFileDialog::ShowDirsOnly, true);
    dirDlg->setFileMode(QFileDialog::Directory);
    dirDlg->exec();

    // We're only interested in the first entry of the list coming from the dialog.
    // This one's going to our txt-field.
    ui->txtChartPath->setText(dirDlg->selectedFiles()[0]);

}
Пример #21
0
void MainWindow::on_Open_results_triggered()
{
    QString file_name;
    QFileDialog dlg;
    dlg.setFileMode( QFileDialog::ExistingFile );
    dlg.setDirectory( app::Settings::Instance().TestPath() );
    dlg.setNameFilter( "Результаты испытаний (*.res )" );
    dlg.setViewMode( QFileDialog::Detail );
    if ( dlg.exec() )
    {
        file_name = dlg.selectedFiles().front();
        test::DataFromFile( file_name );
        on_LastTest_triggered();
    }
}
Пример #22
0
QString FileSystem::openFileDialog()
{
    QFileDialog dialog;
    dialog.setMimeTypeFilters(Config::supportedReadMimeTypes());
    dialog.setDirectory(Config::lastWorkDirectory);

    if(!dialog.exec())
        throw QString ("The open file dialog was just closed\n");

    QStringList filename = dialog.selectedFiles();

    prepareBeforeLoadFile(filename.first());

    return filename.first();
}
Пример #23
0
void Path::on_pushButton_clicked()
{
    QFileDialog *fileDialog = new QFileDialog(this);
    fileDialog->setWindowTitle(tr("模型位置"));
    fileDialog->setDirectory(".");
    QString fpath = fileDialog->getExistingDirectory();
    std::cout << fpath.toStdString() << std::endl;
    if(fpath.length() != 0) {
        QMessageBox::information(NULL, tr("路径"), fpath);
        ui->pathlabel->setText(fpath);
    }
    else {
        QMessageBox::information(NULL, tr("错误"), "您没有选择任何文件夹!");
    }
}
Пример #24
0
void Ruralcooperativequery::on_outButton_clicked()
{
	QAbstractItemModel* model=ui.tableView->model();
	if (model->rowCount()==0||model==NULL)
	{
		QString str = str.fromLocal8Bit("提示");
		QString str2 = str.fromLocal8Bit("无数据");
		QMessageBox box(QMessageBox::Warning,QString::fromLocal8Bit("警告"),str2);
		box.setStandardButtons (QMessageBox::Ok);
		box.setButtonText (QMessageBox::Ok,QString::fromLocal8Bit("确 定"));
		box.exec();
		return;
	}

	QFileDialog dlg;
	dlg.setAcceptMode(QFileDialog::AcceptSave);

	dlg.setDirectory(QDesktopServices::storageLocation(QDesktopServices::DesktopLocation));
	dlg.setNameFilter("*.xls");


	QList<QTreeWidgetItem*> list= ui.treeWidget->selectedItems();
	QTreeWidgetItem*item = list.at(0);
	QString strText = item->text(0);
	dlg.selectFile(strText+QString::fromLocal8Bit("(农合对应关系)"));
	if(dlg.exec()!= QDialog::Accepted)
		return;


	QString filePath=dlg.selectedFiles()[0];
	if(OdbcExcel::saveFromTable(filePath,ui.tableView,"")) {
		QString str = str.fromLocal8Bit("提示");
		QString str2 = str.fromLocal8Bit("保存成功");
		QMessageBox box(QMessageBox::Warning,QString::fromLocal8Bit("警告"),str2);
		box.setStandardButtons (QMessageBox::Ok);
		box.setButtonText (QMessageBox::Ok,QString::fromLocal8Bit("确 定"));
		box.exec();
	}
	else{
		QString str = str.fromLocal8Bit("错误");
		QString msg=str.fromLocal8Bit("保存失败!\n\r")+OdbcExcel::getError();
		QMessageBox box(QMessageBox::Warning,QString::fromLocal8Bit("警告"),msg);
		box.setStandardButtons (QMessageBox::Ok);
		box.setButtonText (QMessageBox::Ok,QString::fromLocal8Bit("确 定"));
		box.exec();
	}
}
Пример #25
0
bool RegEdit::GetFilename(QString& filename, bool save)
{
    QFileDialog *fd = new QFileDialog(this);
    if(save)
        fd->setAcceptMode(QFileDialog::AcceptSave);
    fd->setFilter("Description files (*.xml);;All files (*)");
    fd->setDirectory(Settings::Get()->value("loaddescdir", QDir::currentPath()).toString());
    if(fd->exec())
    {
        QStringList filenames = fd->selectedFiles();
        filename = filenames[0];
        Settings::Get()->setValue("loaddescdir", fd->directory().absolutePath());
        return true;
    }
    else
        return false;
}
Пример #26
0
void MainWindow::imagelist_file_open(){
    QFileDialog dialog;

    dialog.setDirectory( starting_dir );
    dialog.setFileMode(QFileDialog::ExistingFiles);
        if (dialog.exec()) {
            image_string_list = dialog.selectedFiles();
            set_image_list = true;
            ui->actionRun_Experiment->setDisabled(false);
            ui->actionShow_Graph->setDisabled(false);
            emit imagelistset(image_string_list);
        }
        else
        {
            set_image_list = false;
        }
}
Пример #27
0
bool ImageViewer::saveAsMask(QString &pathMask)
{
    if(_mask.empty()) return false;

    QFileDialog *fDlg = new QFileDialog(this);
    fDlg->setWindowTitle(tr("保存掩码"));
    fDlg->setAcceptMode(QFileDialog::AcceptSave);
    fDlg->setFileMode(QFileDialog::AnyFile);
    fDlg->setViewMode(QFileDialog::Detail);
    fDlg->setDirectory(QDir::currentPath());

    fDlg->setFilter(MOLI_IMAGE_FILTER);
    fDlg->setDefaultSuffix("bmp");

    if(fDlg->exec() == QDialog::Accepted)
    {
        QString filename = fDlg->selectedFiles()[0];
        if(m_method == 0)
        {
            if(saveLabelMap(filename))
            {
                pathMask = filename;

                return true;
            }
            else return false;
        }
        else
        {
            _mask = _mask * 255;
            IplImage* temp = new IplImage(_mask);
            QImage* temp2 = IplImageToQImage(temp);
            if(temp2->save(filename))
            {
                pathMask = filename;
                if(temp2) delete temp2;
                return true;
            }
            else return false;
        }
    }
    else
    {
        return true;
    }
}
Пример #28
0
void MainWindow::colorImage()
{
	int x, y;
	Mat image;
	QColor color;
	
	QFileDialog *dialog = new QFileDialog();
	dialog->setNameFilter("PNG Files (*.png)");
	dialog->setOption(QFileDialog::ReadOnly);
	//dialog->setOption(QFileDialog::DontUseNativeDialog);
	dialog->setDirectory(".");
	QStringList fileNames;
	if (dialog->exec()) {
		fileNames = dialog->selectedFiles();
		QString fileName = fileNames.at(0);
		image = imread(fileName.toStdString(), CV_LOAD_IMAGE_COLOR);

		for( y=0; y!=image.rows; ++y) {
			if((y%2) == 0) {
				for(x=0;x!=image.cols;++x) {
					color.setBlue(image.data[((y*image.cols)+x)*3]);
					color.setGreen(image.data[((y*image.cols)+x)*3+1]);
					color.setRed(image.data[((y*image.cols)+x)*3+2]);
					motorControl.setLedColor(color);
					motorControl.commandMotor1(3, -4);
				}
			} else {
				for(x=image.cols-1;x!=-1;--x) {
					color.setBlue(image.data[((y*image.cols)+x)*3]);
					color.setGreen(image.data[((y*image.cols)+x)*3+1]);
					color.setRed(image.data[((y*image.cols)+x)*3+2]);
					motorControl.setLedColor(color);
					motorControl.commandMotor1(3, 4);
				}
			}
			motorControl.commandMotor2(6, -4);
		}
		color.setRed(0);
		color.setGreen(0);
		color.setBlue(0);
		motorControl.setLedColor(color);
		motorControl.releaseMotor1();
		motorControl.releaseMotor2();
	}	
}
Пример #29
0
void VSCCameraAdd::fileSelect()
{
	QFileDialog *fileDialog = new QFileDialog(this); 
	fileDialog->setWindowTitle(tr("Select File")); 
	fileDialog->setDirectory(ui.fileLoc->text()); 
	fileDialog->setNameFilter(tr("Video Files(*.MOV *.mp4 *.avi *.ts *.mpg)")); 
	QIcon icon;
	icon.addFile(QStringLiteral(":/logo/resources/vscsmall.png"), QSize(), QIcon::Normal, QIcon::Off);
	fileDialog->setWindowIcon(icon);
	if(fileDialog->exec() == QDialog::Accepted) { 
		QString path = fileDialog->selectedFiles()[0]; 
		ui.fileLoc->setText(path);
		VDC_DEBUG( "%s  QFileDialog %s\n",__FUNCTION__, path.toStdString().c_str());
	} else 
	{ 
	
	}
}
Пример #30
0
void VSCVideoSetting::dirSelect()
{
	QFileDialog *fileDialog = new QFileDialog(this); 
	fileDialog->setWindowTitle(tr("Select Directory")); 
	fileDialog->setDirectory(ui.fileLoc->text()); 
	fileDialog->setFileMode(QFileDialog::Directory);
	QIcon icon;
	icon.addFile(QStringLiteral(":/logo/resources/vscsmall.png"), QSize(), QIcon::Normal, QIcon::Off);
	fileDialog->setWindowIcon(icon);
	if(fileDialog->exec() == QDialog::Accepted) { 
		QString path = fileDialog->selectedFiles()[0]; 
		ui.fileLoc->setText(path);
		VDC_DEBUG( "%s  QFileDialog %s\n",__FUNCTION__, path.toStdString().c_str());
	} else 
	{ 
	
	}
}