Example #1
0
void MERTool::on_loadButton_clicked()
{
    QFileDialog dialog;
    dialog.setFileMode(QFileDialog::Directory);
    dialog.setOption(QFileDialog::ShowDirsOnly);
    QString directory = dialog.getExistingDirectory();

    if(directory.toStdString().size() < 3){
        return;
    }
    std::vector<std::string> p = mocca::splitString<std::string>(directory.toStdString(),'/');

    std::shared_ptr<BrainVisIO::MERData::MERBundle> bunlde = BrainVisIO::MERData::MERFileManager::getInstance().openFolder(directory.toStdString());

    MERBundleManager::getInstance().addMERBundle(p[p.size()-1], bunlde);

    updateSettings(bunlde);

    if( ui->BundleSelection->findText(QString(p[p.size()-1].c_str())) == -1)
        ui->BundleSelection->addItem(QString(p[p.size()-1].c_str()));

    ui->BundleSelection->setCurrentIndex(ui->BundleSelection->findText(QString(p[p.size()-1].c_str())));
    on_BundleSelection_activated(ui->BundleSelection->currentText());

    if( DataHandleManager::getInstance().getDataHandle(ActivityManager::getInstance().getActiveDataset()) != nullptr)
        DataHandleManager::getInstance().getDataHandle(ActivityManager::getInstance().getActiveDataset())->incrementStatus();
}
void ExportWidget::on_cmdSelectImportFile_clicked()
{
    QFileDialog exportDirDialog;
    QString dirname = exportDirDialog.getExistingDirectory(this, tr("Open Directory"), QApplication::applicationDirPath(), QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
    if (!dirname.isEmpty()) {
        ui.txtDestFile->setText(dirname);
    }
}
Example #3
0
void FSTableView::download()
{
    QFileDialog dialog;
    dialog.setWindowTitle("Télécharger");
    QString dirPath = dialog.getExistingDirectory(this);
    if (!dirPath.isEmpty())
        fsModel()->download(dirPath,currentIndex());
}
Example #4
0
/*----------------------------------------------------------------------------
Name		getDefaultSaveLoc

Purpose		Slot: when Select Default Save Location is clicked;

History		8 Jun 16  AFB	Created
----------------------------------------------------------------------------*/
void OptionMenu::getDefaultSaveLoc()
{
    QFileDialog fileDialog;

    mDefaultSaveLoc = fileDialog.getExistingDirectory(
                          this
                          , tr("Choose default save directory")
                          , QStandardPaths::displayName(QStandardPaths::DocumentsLocation));
}
Example #5
0
void Dialog::on_Load_Result_Btn_clicked()
{
    QFileDialog FileDialog;
    QString path=FileDialog.getExistingDirectory(this, tr("Open Calibration Files"),  "/home/nubot/ros_workspace/src/omni_vision/calibration/",
                                                QFileDialog::ShowDirsOnly|QFileDialog::DontResolveSymlinks);

    calibration_result_dir_=path.toStdString();
    std::string file_path=calibration_result_dir_+"/CTable.dat";
    std::ifstream CTable_Read(file_path.c_str(), std::ios::binary|std::ios::in);
    CTable_Read.read((char *)CTable_,sizeof(unsigned char)*64*64*64);
    CTable_Read.close();

    file_path=calibration_result_dir_+"/CTableBGR.dat";
    std::ifstream CTableBGR_Read(file_path.c_str(), std::ios::binary|std::ios::out);
    CTableBGR_Read.read((char *)CTable_bgr_,sizeof(unsigned char)*64*64*64);
    CTableBGR_Read.close();


    file_path=calibration_result_dir_+"/ROI.xml";
    cv::FileStorage roi_file(file_path, cv::FileStorage::READ);
    int tmp1,tmp2;
    roi_file["center_point_row"]>>tmp2;
    roi_file["center_point_column"]>>tmp1;
    circle_center_=QPoint(tmp1,tmp2);
    roi_file["big_radius"] >>circle_radius_;
    roi_file ["small_radius"] >> small_radius_;
    roi_file ["rows"]>>height_;
    roi_file ["cols"]<<width_;
    roi_file.release();

    file_path=calibration_result_dir_+"/calibration.xml";
    cv::FileStorage calibration(file_path, cv::FileStorage::READ);
    std::vector<int> poly_pts;
    std::vector<int> lint_pts;
    cv::FileNode calib_result = calibration["Color_Calib"];
    cv::FileNodeIterator it = calib_result.begin(), it_end = calib_result.end();
    int idx=0;
    for( ; it != it_end; ++it)
    {
        QVector<QPoint> polys_pt;
        (*it)["poly_pts"]>>poly_pts;
        polys_pt.push_back(QPoint(poly_pts[0],poly_pts[1]));
        polys_pt.push_back(QPoint(poly_pts[2],poly_pts[3]));
        polys_pt.push_back(QPoint(poly_pts[4],poly_pts[5]));
        polys_pt.push_back(QPoint(poly_pts[6],poly_pts[7]));
        calib_final_result_[idx]=polys_pt;
        QVector<QPoint> line_pt;
        (*it)["line_pts"]>>lint_pts;
        line_pt.push_back(QPoint(lint_pts[0],0));
        line_pt.push_back(QPoint(lint_pts[1],0));
        calib_Line_final_result_[idx]=line_pt;
        idx++;
    }
    calibration.release();

    load_interim_result();
}
void MainWindow::onAddFolderToLibrary(){
  QFileDialog d;
  QString folder;
  folder = d.getExistingDirectory(this,tr("Select Folder"),
                                  QDir::homePath(),
                                  QFileDialog::ShowDirsOnly |
                                  QFileDialog::DontResolveSymlinks);
  ui->library->addToSearchPath(folder);
}
Example #7
0
void DialogConfigBooks::on_toolButtonBkPath_clicked()
{
     QFileDialog dlg;

    QString dir = dlg.getExistingDirectory(this, tr("Open Directory"),
                                                    ui->lineEditPath->text(),
                                                    QFileDialog::ShowDirsOnly
                                                    |QFileDialog::DontResolveSymlinks);
<<<<<<< HEAD
/**
 * @autor Alex
 * @beschreibung wählt einen Speicherort aus und fügt ihn in das Feld ein
 */
void Hauptfenster::on_buttonSpeicherort_clicked()
{
    QFileDialog SpeicherDialog;
    QString speicherOrt = SpeicherDialog.getExistingDirectory();
    if(speicherOrt!=""){
        ui->editSpeicherort->setText(speicherOrt);
        settings.set("Speicherort",ui->editSpeicherort->text());//Speichert Einstellung
    }
 }
Example #9
0
void MainWindow::on_folderPushButton_clicked()
{
    QFileDialog folderDlg;
    folder = folderDlg.getExistingDirectory(0,"Caption",QString(),QFileDialog::ShowDirsOnly);
    ui->folderLineEdit->setText(folder);
    QDir recoredDir(folder);
    allFiles = recoredDir.entryList(QDir::NoDotAndDotDot | QDir::System | QDir::Hidden  | QDir::AllDirs | QDir::Files, QDir::DirsFirst);
    videos = allFiles.filter(format,Qt::CaseSensitive);
    ui->joinPushButton->setEnabled(true);
}
void
FlumeSettings::setTempDirectory()
{
    QFileDialog fd;
    fd.setFileMode(QFileDialog::Directory);
    fd.setOption(QFileDialog::ShowDirsOnly, true);
    QString file = fd.getExistingDirectory(this, tr("Select Directory"));
    if (file != "") {
        ui->tempDirectoryEdit_2->setText(file);
    }
}
void Launcher_page::btn_wallpaper_choose()
{
    if(Global::srcPath == "")
    {
        QMessageBox::warning(this, "提示框", "必须先新建工厂或导入现有工程才可以修改!!", QMessageBox::Abort);
        return;
    }
    QFileDialog *fileDlg = new QFileDialog();
    QString wallpaperPath = fileDlg->getExistingDirectory(this);
    le_wallpaper->setText(wallpaperPath);
}
Example #12
0
/*
 *  Initialize/update/re-read from cache.
 */
void browse::Sync(int type){
    if(type == 2 || type == 3){    /// import new entries into local db for each folder and file
        QDir usrDir = QString(getenv("HOME"));
        QFileDialog iDirect;

        usrDir = iDirect.getExistingDirectory(this, tr("Import a directory"), usrDir.absolutePath());
        if(usrDir.dirName() != NULL || usrDir.dirName() != ""){
            if(type == 2){   /// import audio
               if(lclSync.Sync(usrDir, 0)){
                   MenuMode = 0;
                }
            }
            else if(type == 3){  /// import video
                if(lclSync.Sync(usrDir, 1)){
                    MenuMode = 1;
                }
            }
        }
    }else if(type == 4){
        radStat = new radiostat();
        radStat->init(dbCon);
        radStat->show();
        if(radStat->exec() == QDialog::Accepted){
            dbCon->readDB(Radio, "radios");
            dbCon->readDB(RadioCat, "categories");

            MenuMode = 2;  /// set Mode to radio
            updateMenu();
            updateTitle(0);
        }
    }else if(type == 0){
        QDir usrDir;
         usrDir = QFileDialog::getOpenFileName(this, tr("Open a Audio/Video file"), QDir::currentPath(), tr("Video/Audio (*.avi *.mp4 *.mp3 *.flac *.wav)"));
         if(usrDir.dirName() != NULL || usrDir.dirName() != ""){
            emit startTempTrack(usrDir.dirName().toStdString(), usrDir.path().toStdString(), MenuMode);
         }
    }else if(type == -1){
        web = new QWebUrl();
        web->show();
        if(web->exec() == QDialog::Accepted){
            if(web->url_input != "http://" || web->url_input != ""){
                emit startTempTrack("", web->url_input, MenuMode);
            }
        }
    }

    if(type ==1 || type == 2 || type == 3){   /// don't sync if we're playing a temp file
        syncCache();
        updateMenu();
    }
}
void MainWindow::on_actionRestore_Tasks_Settings_triggered()
{
    QFileDialog fd;
    QString dir = fd.getExistingDirectory(this, tr("Choose Directory To Restore From"), "", QFileDialog::ShowDirsOnly);
    if(!dir.isEmpty())
    {
        QFile::remove(DataLoc.at(0) + "/settings.ini");
        QFile::remove(DataLoc.at(0) + "/tasks.db");
        QFile::copy(dir + "/settings.ini", DataLoc.at(0) + "/settings.ini");
        QFile::copy(dir + "/tasks.db", DataLoc.at(0) + "/tasks.db");
        QMessageBox::information(this, tr("Status"), tr("Restore Complete!"));
        updateTable();
    }
}
Example #14
0
void MainWindow::on_btn_destination_location_clicked()
{
    // Create new dialog
    QFileDialog dialog;

    // Set is to Directory
    dialog.setFileMode(QFileDialog::Directory);

    // Only show directories
    dialog.setOption(QFileDialog::ShowDirsOnly);

    // Set tb_destination_location to the selected directory
    ui->tb_destination_location->setText(dialog.getExistingDirectory(0,"Select destination folder",QString(),QFileDialog::ShowDirsOnly));
}
Example #15
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("错误"), "您没有选择任何文件夹!");
    }
}
Example #16
0
void QtDatasetViewWidget::computestacks_event(void)
{
	QFileDialog* fd = new QFileDialog( this );
	fd->setFilter(QDir::Dirs | QDir::NoSymLinks | QDir::NoDotAndDotDot);

	//Load our folder structure.
	QString dn = fd->getExistingDirectory(this, "Please select a Directory", currentworkingdir);

	if(dn.isEmpty())
	{
		return;
	}

	printf("Computing stacks...\n");
	emit datasetview_computestacks_signal(dn, dsview);	
}
Example #17
0
void MainWindow::on_searchFolderProjectButton_clicked()
{
	QFileDialog * fileDialog = new QFileDialog();
	QString fileName = fileDialog->getExistingDirectory( this, tr( "Choose folder for project" ), QString( boost::filesystem::initial_path().string().c_str() ) );

	_newProjectDialog->getFolderProjectLineEdit()->setText( fileName );

	//set the name folder for the project files
	Projet& projectInstance = Projet::getInstance();
	boost::filesystem::path pathFolder( fileName.toStdString() );
	projectInstance.setProjectFolder( pathFolder );

	/*Create corresponding folders*/
	pathFolder /= "projet";
        boost::filesystem::create_directory( pathFolder );
	boost::filesystem::path pathFolderPictures = pathFolder / "pictures";
	boost::filesystem::create_directory( pathFolderPictures );
        boost::filesystem::path pathFolderPicturesHD = pathFolderPictures / "HD";
        boost::filesystem::create_directory( pathFolderPicturesHD );
        projectInstance.gPhotoInstance().setFolderToSavePictures( projectInstance.getProjectFolder() );
}
void MainWindow::on_actionExport_Tasks_Settings_triggered()
{
    QFileDialog fileDialog;
    fileDialog.setFileMode(QFileDialog::DirectoryOnly);
    QString dir = fileDialog.getExistingDirectory(this, tr("Open Directory"), "", QFileDialog::ShowDirsOnly);
    if(!dir.isEmpty())
    {
        QFile::remove(dir + "/settings.ini");
        QFile::remove(dir + "/tasks.db");
        if(!QFile::copy(DataLoc.at(0) + "/settings.ini", dir + "/settings.ini"))
        {
            QMessageBox::warning(this, tr("Warning"), tr("settings.ini could not be copied"));
            QFile::remove(dir + "/settings.ini");
        }
        if(!QFile::copy(DataLoc.at(0) + "/tasks.db", dir + "/tasks.db"))
        {
            QMessageBox::warning(this, tr("Warning"), tr("tasks.db could not be copied"));
            QFile::remove(dir + "/tasks.db");
        }
        QMessageBox::information(this, tr("Export"), tr("Export Complete!"));
    }
}
Example #19
0
void    ImageFactory::exportImg()
{
    QFileDialog *dial = new QFileDialog(this, Qt::Dialog);
    QString dir = dial->getExistingDirectory(this, "Select the destination folder", QDir::currentPath(), QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
    QStringList listPicture = dial->getOpenFileNames(this, "Select one or more files", QDir::currentPath(), "Image Files (*.png *.jpg *.jpeg *.bmp)");
    if (!listPicture.isEmpty())
    {
        QString file;
        QStringList::Iterator it = listPicture.begin();
        while (it != listPicture.end())
        {
            QString dest = *it;
            int index = dest.lastIndexOf("/");
            std::cout << index << std::endl;
            dest.remove(0, index);
            file = "cp " + *it + " " + dir + dest;
            const char *str = file.toStdString().c_str();
            std::cout << str << std::endl;
            system(str);
            ++it;
        }
    }
}
Example #20
0
SgNode* BinaryCloneGui::disassembleFile(std::string tsv_directory){
  SgNode* globalBlock;

  if(exists(tsv_directory) == false)
  {

    char buf[4096] = "\0";

    int i = 0; 
    while( exists ( relativePathPrefix +"/"+ tsv_directory) == false ) 
    {
      
      if(i>10){
        std::string error_message = "user error: Relative Path to  ";
        error_message+=tsv_directory;
        error_message+=" not selected in " ;
        error_message+= boost::lexical_cast<std::string>(i);
        error_message+=" attempts.";
        eAssert(0,  (error_message.c_str()) );
      }

      QFileDialog dialog;
      dialog.setFileMode(QFileDialog::DirectoryOnly);
      //relativePathPrefix = dialog.getOpenFileName( 0, "Relative Path To Binaries", getcwd(buf, 4096), "ASCII (*)").toStdString();
      relativePathPrefix = dialog.getExistingDirectory(0,  "get existing directory", getcwd(buf, 4096)).toStdString();
      i++;
    }

    tsv_directory = relativePathPrefix +"/"+tsv_directory;

  };
  
  if(is_directory( tsv_directory  ) == true )
  {
    RoseBin_Def::RoseAssemblyLanguage=RoseBin_Def::x86;
    RoseBin_Arch::arch=RoseBin_Arch::bit32;
    RoseBin_OS::os_sys=RoseBin_OS::linux_op;
    RoseBin_OS_VER::os_ver=RoseBin_OS_VER::linux_26;


    RoseFile* roseBin = new RoseFile( (char*)tsv_directory.c_str() );

    cerr << " ASSEMBLY LANGUAGE :: " << RoseBin_Def::RoseAssemblyLanguage << endl;
    // query the DB to retrieve all data

    globalBlock = roseBin->retrieve_DB();

    // traverse the AST and test it
    roseBin->test();
  }else{
    vector<char*> args;
    args.push_back(strdup(""));
    args.push_back(strdup(tsv_directory.c_str()));
    args.push_back(0);

    ostringstream outStr; 

    for(vector<char*>::iterator iItr = args.begin(); iItr != args.end();
        ++iItr )
    {
      outStr << *iItr << " ";
    }     
    ;
    std::cout << "Calling " << outStr.str() << std::endl;

    globalBlock =  frontend(args.size()-1,&args[0]);
    
  }
  return globalBlock;
};
Example #21
0
void QtDatasetViewWidget::open(void)
{
	QFileDialog* fd = new QFileDialog( this );
	fd->setFilter(QDir::Dirs | QDir::NoSymLinks | QDir::NoDotAndDotDot);

	//Load our folder structure.
	QString dn = fd->getExistingDirectory(this, "Please select a Directory", currentworkingdir);

	if(dn.isEmpty())
	{
		return;
	}

	clear_all();

	//now populate the ListWidgetItems
	dsview.datafolder = dn;

	QPixmap pixmap =  QPixmap(128, 128);
	pixmap.fill(QColor(0,0,0));

	QDir dirs = QDir(dn);
	dirs.setFilter(QDir::Dirs | QDir::NoSymLinks | QDir::NoDotAndDotDot);
	dirs.setSorting(QDir::Name | QDir::LocaleAware);

	QStringList stringdirlist = dirs.entryList();
	for(int i=0; i<stringdirlist.size(); i++)
	{
		if(stringdirlist[i]!="VVData")
		{
			dsview.datasubfolders.push_back(stringdirlist[i]);
			dsview.datathumbnails.push_back(pixmap);
		}
	}
	for(int i=0; i<stringdirlist.size(); i++)
	{
		QString savedir = dn + "/" + "VVData/";
		QString savesubdir = dn + "/" + "VVData/" + stringdirlist[i] + "/";

		QDir dir(savesubdir);
		if (!dir.exists())
		{
			dir.mkpath(savesubdir);
		}
	}
	for(int i=0; i<dsview.datasubfolders.size(); i++)
	{
		QString thumbname = dsview.datafolder + "/VVData/Thumbs/";		

		QDir dir;
		dir.mkdir(thumbname);
		thumbname += dsview.datasubfolders[i] + ".png";
		printf("thumbname: %s\n", thumbname.latin1());
		dsview.datathumbnails[i].load(thumbname, "PNG");
	}

	int thumb_size=64;
	tablewidget->setIconSize(QSize(thumb_size, thumb_size));

	QTableWidgetItem *newitem;
	for(int i=0; i<dsview.datasubfolders.size(); i++)
	{
		QIcon viewIcon(dsview.datathumbnails[i]);

		printf("ADDING ITEM\n");

		tablewidget->setRowCount(tablewidget->rowCount()+1);
		tablewidget->setRowHeight(tablewidget->rowCount()-1, thumb_size);

		newitem = new QTableWidgetItem(viewIcon,"",0);
		tablewidget->setItem(tablewidget->rowCount()-1, 0, newitem);

		newitem = new QTableWidgetItem(dsview.datasubfolders[i],0);
		tablewidget->setItem(tablewidget->rowCount()-1, 1, newitem);

		newitem = new QTableWidgetItem("align.msr",0);
		tablewidget->setItem(tablewidget->rowCount()-1, 2, newitem);
	}

	dsview.numbimages = dsview.datasubfolders.size();
	dsview.current_image = 0;
}