コード例 #1
0
ファイル: qtfiledialogpeer.cpp プロジェクト: 0day-ci/gcc
  void runEvent()
  {
    if( open )
      {
	widget->setAcceptMode( QFileDialog::AcceptOpen );
	widget->setFileMode( QFileDialog::ExistingFile );
      }
    else
      {
	widget->setAcceptMode( QFileDialog::AcceptSave );
	widget->setFileMode( QFileDialog::AnyFile );	
      }
  }
コード例 #2
0
ファイル: MainWindow.cpp プロジェクト: BijanZarif/coolfluid3
void MainWindow::save_file_locally()
{
  QFileDialog dlg;

  dlg.setAcceptMode(QFileDialog::AcceptSave);
  dlg.exec();
}
コード例 #3
0
ファイル: main.cpp プロジェクト: KubaO/stackoverflown
 void askForFile() {
    QFileDialog * dialog = new QFileDialog(aView());
    connect(dialog, SIGNAL(fileSelected(QString)), SLOT(loadFile(QString)));
    dialog->setAcceptMode(QFileDialog::AcceptOpen);
    dialog->setAttribute(Qt::WA_DeleteOnClose);
    dialog->show();
 }
コード例 #4
0
ファイル: advanced.cpp プロジェクト: stramel/drasterblaster
void Advanced::saveParams()
{
    QFileDialog dialogRaster;
        dialogRaster.setAcceptMode(QFileDialog::AcceptSave);
        dialogRaster.setFileMode(QFileDialog::AnyFile);
        dialogRaster.setDirectory(QDir::toNativeSeparators(QCoreApplication::applicationDirPath()));
        dialogRaster.setFilter(QDir::Files);
        dialogRaster.setWindowTitle("Save Projection Parameters");
        dialogRaster.setNameFilter("Config files (*.config)");
        dialogRaster.exec();

        QString filename = dialogRaster.selectedFiles().first();
        if (filename.isEmpty())
            return;
        else
        {
            QFile file(filename);
            if (!file.open(QIODevice::WriteOnly))
            {
                QMessageBox::information(this, tr("Unable to open file"), file.errorString());
                return;
            }

            QDataStream out (&file);
            out.setVersion(12);
            //out << ;//Write DATA here
        }
}
コード例 #5
0
ファイル: MainWindow.cpp プロジェクト: BijanZarif/coolfluid3
void MainWindow::open_file_locally()
{
  QFileDialog dlg;

  dlg.setAcceptMode(QFileDialog::AcceptOpen);
  dlg.exec();
}
コード例 #6
0
ファイル: ui_mainwindow.cpp プロジェクト: idx0/Sabre
void MainWindow::onChangeDataDirectory()
{
    QFileDialog dlg;

    dlg.setAcceptMode(QFileDialog::AcceptOpen);
    dlg.setFileMode(QFileDialog::Directory);
    dlg.setOption(QFileDialog::ShowDirsOnly, true);

    if (dlg.exec()) {
        QString path = dlg.selectedFiles().at(0);
        DatabaseDlg dbdlg(QDir(path), this);

        if (dbdlg.exec()) {
            Parser *p = new Parser(path, m_output);

            p->restrictYears(dbdlg.getSelectedYears());

            activateWindow();
            raise();

            p->moveToThread(&m_thread);

            connect(&m_thread, SIGNAL(finished()), p, SLOT(deleteLater()));
            connect(p, SIGNAL(finished()), this, SLOT(onParseFinished()));
            connect(this, SIGNAL(parse()), p, SLOT(parse()));

            m_thread.start();

            emit parse();
        }
    }
}
コード例 #7
0
ファイル: ProjectManager.cpp プロジェクト: vanhoefm/Publisher
void ProjectManager::SaveProjectAs()
{
    if(m_pBoek == NULL)
    {
        QMessageBox box(QMessageBox::Information, "Geen project", "Er is geen project geopend!");
        box.exec();
        return;
    }

    QFileDialog fileDialog;
    fileDialog.setFileMode(QFileDialog::AnyFile);
    fileDialog.setAcceptMode(QFileDialog::AcceptSave);

    if(fileDialog.exec())
    {
        QStringList files = fileDialog.selectedFiles();
        if(files.size() >= 1)
        {
            m_saveLocation = files.first();
            save(m_saveLocation);
        }
        else
        {
            qWarning("No files selected in QFileDialog but user still managed to click save?");
        }
    }
}
コード例 #8
0
ファイル: mainwindow.cpp プロジェクト: Skycoder42/IcoDroid
void MainWindow::on_actionAdd_File_triggered()
{
	this->settings->beginGroup(QStringLiteral("paths"));

	QFileDialog *dialog = new QFileDialog(this);
	DialogMaster::masterDialog(dialog);
	dialog->setWindowTitle(tr("Open Icon Archive"));
	dialog->setAcceptMode(QFileDialog::AcceptOpen);
	dialog->setFileMode(QFileDialog::ExistingFiles);
	dialog->setDirectory(this->settings->value(QStringLiteral("openPath")).toString());

	QStringList mTypes = byteToStringList(QImageReader::supportedMimeTypes());
	mTypes.append(QStringLiteral("application/octet-stream"));
	dialog->setMimeTypeFilters(mTypes);

	QString selFilter = this->settings->value(QStringLiteral("openFilter")).toString();
	qDebug() << selFilter;
	if(selFilter.isEmpty()) {
#if defined(Q_OS_WIN)
	dialog->selectMimeTypeFilter(QStringLiteral("image/vnd.microsoft.icon"));
#elif defined(Q_OS_OSX)
	dialog->selectMimeTypeFilter(QStringLiteral("image/x-icns"));
#else
	dialog->selectMimeTypeFilter(QStringLiteral("image/png"));
#endif
	} else
		dialog->selectNameFilter(selFilter);

	this->settings->endGroup();
	dialog->open(this, SLOT(fileSelected(QStringList)));
}
コード例 #9
0
ファイル: FileDialogs.cpp プロジェクト: HoTaeWang/tano
File FileDialogs::openPlaylist()
{
    QStringList filters;
    filters << filterByType(File::M3U)
            << filterByType(File::CSV)
            << filterByType(File::JS);

    QFileDialog dialog;
    dialog.setAcceptMode(QFileDialog::AcceptOpen);
    dialog.setFileMode(QFileDialog::ExistingFile);
    dialog.setNameFilters(filters);

    QString fileName;
    File::Type type = File::Unknown;
    if (dialog.exec()) {
        fileName = dialog.selectedFiles()[0];

        for (int i = 0; i < 50; i++) {
            if (dialog.selectedNameFilter() == filterByType(File::Type(i))) {
                type = File::Type(i);
            }
        }
    }

    File file;
    file.path = fileName;
    file.type = type;
    return file;
}
コード例 #10
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;
}
コード例 #11
0
ファイル: FileDialogs.cpp プロジェクト: HoTaeWang/tano
File FileDialogs::savePlaylist()
{
    QStringList filters;
    filters << filterByType(File::M3U)
            << filterByType(File::M3UClean)
            << filterByType(File::M3UUdpxy)
            << filterByType(File::CSV)
            << filterByType(File::JS);

    QFileDialog dialog;
    dialog.setAcceptMode(QFileDialog::AcceptSave);
    dialog.setFileMode(QFileDialog::AnyFile);
    dialog.setConfirmOverwrite(true);
    dialog.setNameFilters(filters);

    QString fileName;
    File::Type type = File::Unknown;
    if (dialog.exec()) {
        fileName = dialog.selectedFiles()[0];

        for (int i = 0; i < 50; i++) {
            if (dialog.selectedNameFilter() == filterByType(File::Type(i))) {
                type = File::Type(i);
            }
        }
    }

    File file;
    file.path = fileName;
    file.type = type;
    return file;
}
コード例 #12
0
void MainWindow::on_action_Export_Scenes_triggered()
{
    QFileDialog fileDialog;
    fileDialog.setWindowTitle(tr("Export"));
    // Set the dialog for saving files, sets the dialog button to "Save"
    fileDialog.setAcceptMode(QFileDialog::AcceptSave);
    // Set the dialog to display the Desktop folder as default location
    fileDialog.setDirectory(QStandardPaths::writableLocation(QStandardPaths::DesktopLocation));
    // Set the dialog to return the file name wheather the file exists or not
    fileDialog.setFileMode(QFileDialog::AnyFile);
    fileDialog.setNameFilter(tr("XML Data File") + " (*.xml)");

    bool wasFileSelected = fileDialog.exec();
    QString filePath;
    if (wasFileSelected) {
        filePath = fileDialog.selectedFiles().at(0);

        qDebug() << "Exporting file: " + filePath;
        try {
            _sceneDataFile->exportTo(filePath);
        }
        catch (SceneDataFileException& exception)
        {
            QMessageBox::critical(this,
                                  tr("ERROR: File Export Failed"),
                                  exception.getMessage());

            return; // If export failed
        }
    }
    else
    {
        return; // If no file was selected
    }
} // on_action_Export_Scenes_triggered()
コード例 #13
0
void MainWindow::save_as()

{
  QFileDialog dialog;

  dialog.setAcceptMode(QFileDialog::AcceptSave);
  dialog.setFileMode(QFileDialog::AnyFile);
  dialog.setDefaultSuffix("xml");
  dialog.setNameFilter(tr("xml files (*.xml)"));

  if (dialog.exec() == QDialog::Accepted)
    {
      this->filename = dialog.selectedFiles().at(0);

      if (!this->save(this->filename))
        {
          this->filename = "";

          QMessageBox message;

          message.setText("Could not save the file.");
          message.exec();
        }
      else  // set the new window title
        {
          this->update_title();
          this->change_happened = false; // reset the change watcher
        }
    }
}
コード例 #14
0
ファイル: mainwindow.cpp プロジェクト: lomsansnom/IHM_OFELI
void MainWindow::saveFileAs()
{
    QFileDialog *saveWindow = new QFileDialog(this);
    FILE *saveFile;
    QTextStream *fileStream;
    QByteArray filenameFopen;

    saveWindow->setAcceptMode(QFileDialog::AcceptSave);
    saveWindow->setFileMode(QFileDialog::AnyFile);
    saveWindow->show();

    if(saveWindow->exec())
    {
        //convert Qstring to char* for the fopen function
        filenameFopen = saveWindow->selectedFiles()[0].toLocal8Bit();
        saveFile = fopen(filenameFopen.data(), "w");

        if(saveFile == NULL)
        {
            cout << "Erreur" << endl;
        }
        else
        {
            fileStream = new QTextStream(saveFile,QIODevice::ReadWrite);
            currentDocument->save(*fileStream, 4);
            fclose(saveFile);
            fileSaved = true;
        }
    }

}
コード例 #15
0
void AppImportFile::open()
{
    const QString MetaIOImageFilter("MetaIO Image (*.mhd)"), DICOMImageFilter("DICOM Images (*.dcm)"), AllFilesFilter("All Files (*)");
    QStringList imagesFilter;
    imagesFilter << MetaIOImageFilter << DICOMImageFilter << AllFilesFilter;

    QFileDialog *openDialog = new QFileDialog(0);
    openDialog->setWindowTitle(tr("Select files to open..."));
    openDialog->setDirectory(m_workingDirectory);
    openDialog->setNameFilters(imagesFilter);
    openDialog->selectNameFilter (m_lastExtension);
    openDialog->setFileMode(QFileDialog::ExistingFiles);
    openDialog->setAcceptMode(QFileDialog::AcceptOpen);

    if (openDialog->exec() == QDialog::Accepted)
    {
        QStringList fileNames = openDialog->selectedFiles();

        emit selectedFiles(fileNames);

        m_workingDirectory = QFileInfo(fileNames.first()).dir().path();
        m_lastExtension = openDialog->selectedNameFilter();

        writeSettings();
    }
    delete openDialog;
}
コード例 #16
0
void smallPictureView::saveAs(){
    if(!allImgs.isEmpty()){
        QFileDialog *fileDialog = new QFileDialog(this);//创建一个QFileDialog对象,构造函数中的参数可以有所添加。
        fileDialog->setWindowTitle(tr("Save As"));//设置文件保存对话框的标题
        fileDialog->setAcceptMode(QFileDialog::AcceptSave);//设置文件对话框为保存模式
        fileDialog->setFileMode(QFileDialog::AnyFile);//设置文件对话框弹出的时候显示任何文件,不论是文件夹还是文件
        fileDialog->setViewMode(QFileDialog::Detail);//文件以详细的形式显示,显示文件名,大小,创建日期等信息;
        QString filename = fileDialog->getSaveFileName(this, tr("Save File"), "/home/wz/img/未命名.png", tr("Images (*.png)"));
        qDebug()<<filename<<currentfile;
        fileDialog->setGeometry(10,30,100,200);//设置文件对话框的显示位置

        saveAsThread->saveAsFlag = 1;
        saveAsThread->breakNum = 1;
        if(!saveAsThread->allImgs.isEmpty()){
            saveAsThread->allImgs.clear();
        }
        saveAsThread->allImgs = allImgs;
        saveAsThread->imgNum = imgNum;
        saveAsThread->filename = filename;
        saveAsThread->selectedNum = selectedNum;
        saveAsThread->start();
    }else{
        QMessageBox message(QMessageBox::NoIcon, "提示", "请先选择图片文件!");
        message.setIconPixmap(QPixmap("../2.png"));
        message.exec();
    }

}
コード例 #17
0
ファイル: filesystem.cpp プロジェクト: Beshkarev/ImageViewer
bool FileSystem::saveAsDialog()
{
    QFileDialog dialog;
    dialog.setMimeTypeFilters(Config::supportedSaveMimeTypes());
    dialog.setAcceptMode(QFileDialog::AcceptSave);
    dialog.selectFile(getCurrentAbsoluteFileName());
    dialog.setDirectory(getCurrentAbsoluteFileName());
    dialog.selectMimeTypeFilter("image/jpeg");

    bool success;
    if(dialog.exec())
    {
        QImage img;
        if(SaveConfirmation::imageWasChanged(getCurrentAbsoluteFileName()))
        {
            img = SaveConfirmation::getChagedImage(getCurrentAbsoluteFileName());
            success = img.save(dialog.selectedFiles().first());
            if(success)
                SaveConfirmation::deleteImage(getCurrentAbsoluteFileName());
        }
        else
        {
            img.load(getCurrentAbsoluteFileName());
            success = img.save(dialog.selectedFiles().first());
        }
    }

    return success;
}
コード例 #18
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("Markdown files (*.md)");
    dialog.setWindowTitle("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();
    }
}
コード例 #19
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] );
}
コード例 #20
0
ファイル: editor.cpp プロジェクト: adaptee/fcitx
void ListEditor::exportData()
{
    QFileDialog* dialog = new QFileDialog(this);
    dialog->setAttribute(Qt::WA_DeleteOnClose, true);
    dialog->setAcceptMode(QFileDialog::AcceptSave);
    dialog->open();
    connect(dialog, SIGNAL(accepted()), this, SLOT(exportFileSelected()));
}
コード例 #21
0
ファイル: mainwindow.cpp プロジェクト: laybatin/ImageDomino
void MainWindow::on_actionSave_triggered()
{
    QFileDialog dlg;
    dlg.setAcceptMode(QFileDialog::AcceptSave);
    QString fileName = dlg.getSaveFileName();
    qDebug() << fileName;

    result->save(fileName);
}
コード例 #22
0
void TTCurrentFrame::saveCurrentFrame()
{
  QString      szTemp;
  QString      extension;
  QString      format;
  QStringList  fileList;
  QString      fileName;
  QFileDialog* fileDlg;

  // no video file open
  if ( !TTCut::isVideoOpen )
    return;

  // get the image file name
  fileDlg = new QFileDialog( this,
      "save current frame",
      TTCut::lastDirPath,
      "Portable Network Graphics (*.png);;JPEG (*.jpg);;Bitmap (*.bmp)" );

  // enable specifying a file that doesn't exist
  fileDlg->setFileMode( QFileDialog::AnyFile );
  fileDlg->setAcceptMode( QFileDialog::AcceptSave );

  // input filename specified
  if ( fileDlg->exec() == QDialog::Accepted )
  {
    szTemp   = fileDlg->selectedFilter();
    fileList = fileDlg->selectedFiles();
    fileName = fileList.at(0);

    if ( szTemp == "Portable Network Graphics (*.png)" )
    {
      format    = "PNG";
      extension = "png";
    }
    else if ( szTemp == "JPEG (*.jpg)" )
    {
      format    = "JPG";
      extension = "jpg";
    }
    else if ( szTemp == "Bitmap (*.bmp)" )
    {
      format    = "BMP";
      extension = "bmp";
    }
    else
    {
      qDebug( "unsupported format" );
      return;
    }

    fileName = ttChangeFileExt( fileName, qPrintable(extension) );

    mpegWindow->saveCurrentFrame( fileName, qPrintable(format) );
  }
  delete fileDlg;
}
コード例 #23
0
ファイル: MainWindow.cpp プロジェクト: tehme/Outlaw
void MainWindow::onSaveChat()
{
    QFileDialog * saveChatDialog = new QFileDialog(this, "Save chat", QString(), "*.html");
    saveChatDialog->setAcceptMode(QFileDialog::AcceptSave);
    saveChatDialog->setFileMode(QFileDialog::AnyFile);
    saveChatDialog->setDefaultSuffix("html");
    connect(saveChatDialog, SIGNAL(finished(int)), this, SLOT(onSaveChatFinished(int)));

    saveChatDialog->show();
}
コード例 #24
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();
    }
}
コード例 #25
0
ファイル: PluginsWindow.cpp プロジェクト: elmodos/charface2
void PluginsWindow::onRegisterPluginsFromDir()
{
    QFileDialog dialog;
    dialog.setAcceptMode(QFileDialog::AcceptOpen);
    dialog.setFileMode(QFileDialog::Directory);

    if (!dialog.exec()) return;

    bool loaded = PluginManager::instance()->registerPluginsFromDirectory(dialog.directory().absolutePath());
    if (loaded)
        showPluginsList();
}
コード例 #26
0
ファイル: aviz.cpp プロジェクト: simphony/AViz
// Save a PNG screenshot file
void AViz::savePNGFile() {
    setFileType( PNG_FILE );

    // Launch a standard file selector
    QFileDialog * fd = new QFileDialog();
    fd->setModal(true);
    fd->setFileMode(QFileDialog::AnyFile);
    fd->setAcceptMode(QFileDialog::AcceptSave);
    fd->setNameFilter("PNG image files (*.png)");
    connect( fd, SIGNAL(fileSelected(const QString&)), this, SLOT(snapFile(const QString&)) );
    fd->show();
}
コード例 #27
0
void MainWindow::browseImageLocation() {
  QFileDialog * fd = new QFileDialog();
  fd->setFileMode( QFileDialog::DirectoryOnly );
  fd->setAcceptMode( QFileDialog::AcceptOpen );
  if ( fd->exec() ) {
    QStringList sl = fd->selectedFiles();
    if ( sl.size() > 0 ) {
      ui.imageLocation->setText( sl.at( 0 ) );
    }

  }
}
コード例 #28
0
QIODevice* LoggingConnection::openDevice(const QString &deviceName)
{
    if (logFile.isOpen()){
        logFile.close();
    }
    QFileDialog * fd = new QFileDialog();
    fd->setAcceptMode(QFileDialog::AcceptOpen);
    fd->setNameFilter("OpenPilot Log (*.opl)");
    connect(fd, SIGNAL(fileSelected(QString)), this, SLOT(startReplay(QString)));
    fd->exec();
    return &logFile;
}
コード例 #29
0
ファイル: mainwindow.cpp プロジェクト: luka-mikec/mu_machine
void MainWindow::on_actionSave_triggered()
{
#ifdef full_gui_functionality
    QFileDialog dialog;
    dialog.setFileMode(QFileDialog::AnyFile);
    dialog.setAcceptMode(QFileDialog::AcceptMode::AcceptSave);
    if(dialog.exec()) {
        ofstream f(dialog.selectedFiles()[0].toStdString());
        f << ui->plainTextEdit->toPlainText().toStdString();
        old_adress = dialog.selectedFiles()[0].toStdString();
    }
#endif
}
コード例 #30
0
std::fstream* openFileUI(QWidget* parent, bool save, QString filter, QString* name = 0) {
    QFileDialog dialog (parent);
    dialog.setFileMode(save ? QFileDialog::FileMode::AnyFile : QFileDialog::FileMode::ExistingFile);
    dialog.setNameFilter(filter);
    dialog.setAcceptMode(save ? QFileDialog::AcceptMode::AcceptSave : QFileDialog::AcceptMode::AcceptOpen);
    if (dialog.exec()) {
        if (name != nullptr)
            *name = dialog.selectedFiles().front();
        std::fstream* stream = new std::fstream();
        stream->open(dialog.selectedFiles().front().toStdString(), save ? std::ios_base::out : std::ios_base::in);
        return stream;
    } else {
        return nullptr;
    }
}