Robot25DWindow::Robot25DWindow(const QDir & imagesDir, QWidget *parent) : QGraphicsView(parent) { setAttribute(Qt::WA_Hover); setMouseTracking(true); mousePressPosition_ = QPoint(-1, -1); setScene(new QGraphicsScene); const QString resPath = imagesDir.absolutePath(); QImage bgImg = QImage(resPath+"/grass_0.png"); QBrush bgBrush = QBrush(bgImg); // QBrush bgBrush = QBrush(QColor(Qt::black)); setBackgroundBrush(bgBrush); setRenderHints(QPainter::Antialiasing|QPainter::TextAntialiasing); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_robotView = new Robot25D::RobotView(imagesDir, false, true, false, QSize(400,300)); scene()->addItem(m_robotView); loadGame(resPath+"/default.pm.json"); // m_robotView->setAnimated(true); setWindowTitle(tr("Isometric Robot")); }
bool QGit::gitRepositoryDefaultSignature(const QDir &path, QString &name, QString &email) { git_repository *repo = nullptr; git_signature *me = nullptr; int result = 0; bool ret = false; result = git_repository_open(&repo, path.absolutePath().toUtf8().constData()); if (result) { goto cleanup; } result = git_signature_default(&me, repo); if (result) { goto cleanup; } name = me->name; email = me->email; ret = true; cleanup: if (me) { git_signature_free(me); me = nullptr; } if (repo) { git_repository_free(repo); repo = nullptr; } return ret; }
OpencvModule::OpencvModule(QDir filename,OniModule* pOniModule){ bool success; Size = cvSize(RES_X,RES_Y); codec = CV_FOURCC('X', 'V', 'I', 'D'); fThresCanny1 = 80; fThresCanny2 = fThresCanny1*3; outputFile=filename.absolutePath().toStdString(); extension= ".avi"; currentIndex=0; windowopened=false; success=setOutput(outputFile,codec,Size); float p[3]; float t[3]; //0 blue //1 green //2 red p[0]=1; p[1]=1; p[2]=1; t[0]=0.48888; t[1]=0.16666; t[2]=-0.166666; Pseudocolor=new psInfo(p,t); videostarttime.setHMS(0,0,0,0); NumFrames = 0; //In order to draw the skeleton; this->pOniModule = pOniModule; this->pSampleManager = pOniModule->GetSampleManager(); this->pUserGenerator = pOniModule->GetUserGenerator(); rgbdepth=Mat(480,640,CV_8UC3); }
void QgsGeometryCheckerResultTab::exportErrors() { QString initialdir; QDir dir = QFileInfo( mChecker->featurePools().first()->layer()->dataProvider()->dataSourceUri() ).dir(); if ( dir.exists() ) { initialdir = dir.absolutePath(); } QString selectedFilter; QString file = QFileDialog::getSaveFileName( this, tr( "Select Output File" ), initialdir, QgsVectorFileWriter::fileFilterString(), &selectedFilter ); if ( file.isEmpty() ) { return; } file = QgsFileUtils::addExtensionFromFilter( file, selectedFilter ); if ( !exportErrorsDo( file ) ) { QMessageBox::critical( this, tr( "Export Errors" ), tr( "Failed to export errors to %1." ).arg( QDir::toNativeSeparators( file ) ) ); } }
/** qCopyDirectory -- 拷贝目录 fromDir : 源目录 toDir : 目标目录 bCoverIfFileExists : ture:同名时覆盖 false:同名时返回false,终止拷贝 返回: ture拷贝成功 false:拷贝未完成 */ bool qCopyDirectory(const QDir& fromDir, const QDir& toDir, bool bCoverIfFileExists) { QDir formDir_ = fromDir; QDir toDir_ = toDir; if(!toDir_.exists()) { if(!toDir_.mkdir(toDir.absolutePath())) return false; } QFileInfoList fileInfoList = formDir_.entryInfoList(); foreach(QFileInfo fileInfo, fileInfoList) { if(fileInfo.fileName() == "." || fileInfo.fileName() == "..") continue; //拷贝子目录 if(fileInfo.isDir()) { //递归调用拷贝 if(!qCopyDirectory(fileInfo.filePath(), toDir_.filePath(fileInfo.fileName()))) return false; } //拷贝子文件 else { if(bCoverIfFileExists && toDir_.exists(fileInfo.fileName())) { toDir_.remove(fileInfo.fileName()); } if(!QFile::copy(fileInfo.filePath(), toDir_.filePath(fileInfo.fileName()))) { return false; } } } return true; }
void CaptureDialog::on_exePath_textChanged(const QString &text) { QString exe = text; // This is likely due to someone pasting a full path copied using copy path. Removing the quotes // is safe in any case if(exe.startsWith(QLatin1Char('"')) && exe.endsWith(QLatin1Char('"')) && exe.count() > 2) { exe = exe.mid(1, exe.count() - 2); ui->exePath->setText(exe); return; } QFileInfo f(exe); QDir dir = f.dir(); bool valid = dir.makeAbsolute(); if(valid && f.isAbsolute()) { QString path = dir.absolutePath(); if(!m_Ctx.Replay().CurrentRemote()) path = QDir::toNativeSeparators(path); // match the path separators from the path if(exe.count(QLatin1Char('/')) > exe.count(QLatin1Char('\\'))) path = path.replace(QLatin1Char('\\'), QLatin1Char('/')); else path = path.replace(QLatin1Char('/'), QLatin1Char('\\')); ui->workDirPath->setPlaceholderText(path); } else if(exe.isEmpty()) { ui->workDirPath->setPlaceholderText(QString()); } UpdateGlobalHook(); }
void PythonConsole::slot_saveAs() { QString oldFname = filename; QString dirName = QDir::homePath(); if (!filename.isEmpty()) { QFileInfo fInfo(filename); QDir fileDir = fInfo.absoluteDir(); if (fileDir.exists()) dirName = fileDir.absolutePath(); } filename = QFileDialog::getSaveFileName(this, tr("Save the Python Commands in File"), dirName, tr("Python Scripts (*.py *.PY)")); if (filename.isEmpty()) { filename = oldFname; return; } slot_save(); }
void findFoldersAndFiles(QDir& findFolder, QStringList& fList) { QString dirPath = findFolder.absolutePath(); QStringList list = findFolder.entryList(QDir::Files | QDir::NoDotAndDotDot | QDir::Hidden | QDir::Dirs, QDir::Name); for (int i = 0; i < list.size(); ++i) { QString fullString = dirPath + "/" + list.at(i); QFileInfo fileInfo(fullString); if ((fileInfo.fileName() != ".") && (fileInfo.fileName() != "..")) { if (fileInfo.isDir()) { fList.push_back(fullString); findFolder.setPath(fullString); findFoldersAndFiles(findFolder, fList); findFolder.cdUp(); } else fList.push_back(fullString); } } }
/** * Funtion returns image pointer to Image located * in cache folder where shoul be downloaded cover * with name from parameter. * @param name * @return */ QImage* CoverDownloader::getImage(QString name) { QDir d = QDir::current(); std::cout << "Current dir cover.. " << d.absolutePath().toStdString() << std::endl; if (d.cd("cache")) { QImage * img = new QImage(); QStringList filters; filters << name + ".*"; QStringList files = d.entryList(filters, QDir::Readable | QDir::Files | QDir::NoSymLinks); for (QStringList::Iterator it = files.begin(); it != files.end(); ++it) { std::cout << it->toStdString() << std::endl; if (img->load("cache/" + *it)) { break; } } if (!img->isNull()) { return img; } SAFE_DELETE(img); } return NULL; }
void AndroidSettingsWidget::searchForAnt(const Utils::FileName &location) { if (!m_androidConfig.antLocation().isEmpty()) return; if (location.isEmpty()) return; QDir parentFolder = location.toFileInfo().absoluteDir(); foreach (const QString &file, parentFolder.entryList()) { if (file.startsWith(QLatin1String("apache-ant"))) { Utils::FileName ant = Utils::FileName::fromString(parentFolder.absolutePath()); ant.appendPath(file).appendPath(QLatin1String("bin")); if (Utils::HostOsInfo::isWindowsHost()) ant.appendPath(QLatin1String("ant.bat")); else ant.appendPath(QLatin1String("ant")); if (ant.toFileInfo().exists()) { m_androidConfig.setAntLocation(ant); m_ui->AntLocationLineEdit->setText(ant.toUserOutput()); } } } }
void FileListDialog::on_addButton_pressed() { QSettings settings("UFZ", "OpenGeoSys-5"); QFileDialog dlg(this); dlg.setDirectory(settings.value("lastOpenedOgsFileDirectory").toString()); dlg.setFileMode(QFileDialog::ExistingFiles); dlg.setNameFilter(this->getFileTypeString(_input_file_type)); if (dlg.exec()) { QStringList const file_names = dlg.selectedFiles(); if (file_names.empty()) return; QStringList list = _allFiles.stringList(); list.append(file_names); _allFiles.setStringList(list); QDir const dir = QDir(file_names[0]); settings.setValue("lastOpenedOgsFileDirectory", dir.absolutePath()); } }
static bool addRunningApplication(const QString &rootPath) { QFile file(runningApplicationsFilePath()); QDir dir = QFileInfo(file).dir(); if (!dir.exists()) { dir.mkpath("."); // set permissions of the dir QFile(dir.absolutePath()).setPermissions(QFile::ReadUser | QFile::WriteUser | QFile::ExeUser); } if (!file.open(QIODevice::WriteOnly | QIODevice::Append)) { return false; } TF_FLOCK(file.handle(), LOCK_EX); // lock file.write(rootPath.toLatin1()); file.write("\n"); TF_FLOCK(file.handle(), LOCK_UN); // unlock file.close(); return true; }
int TestRegistry::runTests(QStringList args) { int result = 0; int xunitoutFlagIndex = args.indexOf("-xunitout"); bool usingXUnitOut = (xunitoutFlagIndex >= 0 && args.length() > xunitoutFlagIndex + 1); QDir outDir; if(usingXUnitOut) { outDir = QDir(args.at(xunitoutFlagIndex + 1)); QDir().mkpath(outDir.absolutePath()); args.removeAt(xunitoutFlagIndex); args.removeAt(xunitoutFlagIndex); } foreach(QObject *test, tests_) { QStringList testArgs = args; if(usingXUnitOut) { testArgs << "-xunitxml"; testArgs << "-o"; QString outFile = QString("%1.xml").arg(outDir.absoluteFilePath(test->metaObject()->className())); testArgs << outFile; } result |= QTest::qExec(test, testArgs); }
void CaptureDialog::on_workDirBrowse_clicked() { QString initDir = ""; if(QDir(ui->workDirPath->text()).exists()) { initDir = ui->workDirPath->text(); } else { QDir dir = QFileInfo(ui->exePath->text()).dir(); if(dir.exists()) initDir = dir.absolutePath(); else if(m_Ctx->Config.LastCapturePath != "") initDir = m_Ctx->Config.LastCapturePath; } // TODO Remote // if(m_Core.Renderer.Remote == null) { QString dir = RDDialog::getExistingDirectory(this, "Choose working directory", initDir); if(dir != "") ui->workDirPath->setText(dir); } /* else { VirtualOpenFileDialog remoteBrowser = new VirtualOpenFileDialog(m_Core.Renderer); remoteBrowser.Opened += new EventHandler<FileOpenedEventArgs>(this.virtualWorkDirBrowser_Opened); remoteBrowser.DirectoryBrowse = true; remoteBrowser.ShowDialog(this); } */ }
bool MainWindow::saveProject( QString fileName ) { if ( fileName.isEmpty() ) return false; try { QDir d = QFileInfo( fileName ).absoluteDir(); QString projectDir = QDir::cleanPath( d.absolutePath() ); QDomDocument doc; QDomProcessingInstruction xmlHeaderPI = doc.createProcessingInstruction( "xml", "version=\"1.0\" " ); doc.appendChild( xmlHeaderPI ); QDomElement root = doc.createElement( "project" ); root.setAttribute( "version", 1 ); doc.appendChild( root ); project.save( root, projectDir ); spriteView->save(root); graphicsView->save( root ); QFile outFile( fileName ); if ( !outFile.open( QIODevice::WriteOnly | QIODevice::Text ) ) throw std::runtime_error( "cant open project file" ); QTextStream stream( &outFile ); stream << doc.toString(); clearUndoHistory(); } catch ( ... ) { return false; } return true; }
/** * Opens the macro file in an editor. */ void DlgMacroExecuteImp::on_editButton_clicked() { QDir dir; QTreeWidgetItem* item = 0; int index = tabMacroWidget->currentIndex(); if (index == 0) { //user-specific item = userMacroListBox->currentItem(); dir.setPath(this->macroPath); } else { //index == 1 system-wide item = systemMacroListBox->currentItem(); dir.setPath(QString::fromUtf8(App::GetApplication().getHomePath()) + QString::fromUtf8("Macro")); } if (!item) return; MacroItem * mitem = static_cast<MacroItem *>(item); QString file = QString::fromLatin1("%1/%2").arg(dir.absolutePath(), item->text(0)); PythonEditor* editor = new PythonEditor(); editor->setWindowIcon(Gui::BitmapFactory().iconFromTheme("applications-python")); PythonEditorView* edit = new PythonEditorView(editor, getMainWindow()); edit->open(file); edit->resize(400, 300); getMainWindow()->addWindow(edit); if (mitem->systemWide) { editor->setReadOnly(true); QString shownName; shownName = QString::fromLatin1("%1[*] - [%2]").arg(item->text(0), tr("Read-only")); edit->setWindowTitle(shownName); } close(); }
void QgsGeometrySnapperDialog::selectOutputFile() { QString filterString = QgsVectorFileWriter::filterForDriver( "ESRI Shapefile" ); QMap<QString, QString> filterFormatMap = QgsVectorFileWriter::supportedFiltersAndFormats(); foreach ( const QString& filter, filterFormatMap.keys() ) { QString driverName = filterFormatMap.value( filter ); if ( driverName != "ESRI Shapefile" ) // Default entry, first in list (see above) { filterString += ";;" + filter; } } QString initialdir; QgsVectorLayer* layer = getInputLayer(); if ( layer ) { QDir dir = QFileInfo( layer->dataProvider()->dataSourceUri() ).dir(); if ( dir.exists() ) { initialdir = dir.absolutePath(); } } QString selectedFilter; QString filename = QFileDialog::getSaveFileName( this, tr( "Select Output File" ), initialdir, filterString, &selectedFilter ); if ( !filename.isEmpty() ) { mOutputDriverName = filterFormatMap.value( selectedFilter ); QgsVectorFileWriter::MetaData mdata; if ( QgsVectorFileWriter::driverMetadata( mOutputDriverName, mdata ) ) { if ( !filename.endsWith( QString( ".%1" ).arg( mdata.ext ), Qt::CaseInsensitive ) ) { filename += QString( ".%1" ).arg( mdata.ext ); } } ui.lineEditOutput->setText( filename ); } }
Global::Global() { appDirPath = QCoreApplication::applicationDirPath(); QDir appDir = QDir(appDirPath); #if defined(Q_OS_MAC) if (appDir.dirName() == "MacOS") { //We're in the mac package and need to get back to the package to access relative directories appDir.cdUp(); appDir.cdUp(); appDir.cdUp(); //Root dir where app is located appDirPath = appDir.absolutePath(); } #endif pebbleDataPath = appDirPath + "/PebbleData/"; file = new QFile(pebbleDataPath+"pebblelog.txt"); bool res = file->open(QIODevice::Unbuffered | QIODevice::Truncate | QIODevice::WriteOnly | QIODevice::Text); pLogfile = NULL; if (res) { pLogfile = new QDebug(file); *pLogfile << "Pebble log file\n"; } revision = new char[80]; //See PebbleQt.pro for DEFINES statement that creates PEBBLE_VERSION sprintf(revision,"Build %s on %s using QT:%s",PEBBLE_VERSION, PEBBLE_DATE, PEBBLE_QT); //qDebug(revision); sdr = NULL; perform.InitPerformance(); beep.setSource(QUrl::fromLocalFile(pebbleDataPath + "beep-07.wav")); beep.setLoopCount(1); beep.setVolume(0.25f); primaryScreen = QGuiApplication::primaryScreen(); }
void ScriptEditor::onSaveScriptClicked() { std::vector<std::string> filters; filters.push_back("py"); SequenceFileDialog dialog(this, filters, false, SequenceFileDialog::eFileDialogModeSave, getGui()->getLastSaveProjectDirectory().toStdString(), getGui(), false); if ( dialog.exec() ) { QDir currentDir = dialog.currentDirectory(); getGui()->updateLastSavedProjectPath( currentDir.absolutePath() ); QString fileName( QString::fromUtf8( dialog.selectedFiles().c_str() ) ); QFile file(fileName); if ( file.open(QIODevice::ReadWrite) ) { QTextStream ts(&file); ts << _imp->inputEdit->toPlainText(); } else { Dialogs::errorDialog( tr("Operation failed").toStdString(), tr("Failure to save the file").toStdString() ); } } }
void Downloader::start(){ //try create the path to store the downloaded file QDir path; if(!path.mkpath(pathToSave)){ QString errorString = "Can't create the path to store the downloaded file in" + pathToSave; throw std::runtime_error(errorString.toStdString()); } else{ qInfo() << "Path created at " << path.absolutePath(); } downloadedFile.reset( new QFile(path.absoluteFilePath(destFileName))); if(!downloadedFile->open(QIODevice::WriteOnly | QIODevice::Truncate)){//erase the old file content throw std::runtime_error("Can't open the file to write "); } else{ qInfo() << "Downloaded bytes will be writed in " << QFileInfo(*downloadedFile).absoluteFilePath(); } doHttpRequest(downloadUrl); }
void RequestHistory::init() { QDir home = QDir::home(); if(!home.exists(".qrestclient")) { if( !home.mkdir(".qrestclient")) { qDebug() << "Fatal create directory"; return; } } home.cd(".qrestclient"); QString file = home.absolutePath() + "/history.db"; bool bNeedToCreate = !QFile::exists(file); connect(file); if(bNeedToCreate) { createDataBase(); } }
void ScanForObjectFilesThread::scanDirectory(const QString& path, const QStringList& files_to_ignore, LoadObjectsPanel* panel) { QDir directory = QDir(path); QString absolute_path = directory.absolutePath(); // Find the list of all object files in this directory QStringList files = directory.entryList(PrintableObject::loadableFileFilterExtensions(), QDir::Files | QDir::NoSymLinks); // Remove any entries that are already in the list for (int i = files.size() - 1; i >= 0; --i) { QString object_file_path = absolute_path + QDir::separator() + files.at(i); if (files_to_ignore.contains(object_file_path, Qt::CaseSensitive)) { files.removeAt(i); } } // Add the list panel->addDiscoveredObjectFiles(absolute_path, files); }
void ProfileCreationPage::rebaseDirs() { QString profiles; if (!m_singleProfile) { profiles += QLatin1String("profiles/"); profiles += ui->idEdit->text(); } if(Profile::instance()->isCustomProfilePath()) { QDir dir = Profile::instance()->getCustomProfilePath(); ui->dataEdit->setText(dir.absoluteFilePath("share")); dir = QDir::cleanPath(dir.absolutePath() % "/" % profiles); ui->configEdit->setText(dir.absoluteFilePath("config")); ui->historyEdit->setText(dir.absoluteFilePath("history")); } else if (ui->portableBox->isChecked()) { QDir dir = qApp->applicationDirPath(); ui->dataEdit->setText(dir.absoluteFilePath("share")); dir = QDir::cleanPath(dir.absolutePath() % "/" % profiles); ui->configEdit->setText(dir.absoluteFilePath("config")); ui->historyEdit->setText(dir.absoluteFilePath("history")); } else { #if defined(Q_OS_WIN) QDir dir = QString::fromLocal8Bit(qgetenv("APPDATA")); ui->dataEdit->setText(dir.absolutePath() % "/qutim/share/"); dir = QDir::cleanPath(dir.absolutePath() % "/qutim/" % profiles); ui->configEdit->setText(m_singleProfile ? dir.absolutePath() : dir.absoluteFilePath("config")); ui->historyEdit->setText(dir.absoluteFilePath("history")); #elif defined(Q_OS_MAC) QDir dir = QDir::homePath() + "/Library/Application Support/qutIM"; ui->dataEdit->setText(dir.absoluteFilePath("share")); dir = QDir::cleanPath(dir.absolutePath() % "/" % profiles); ui->configEdit->setText(dir.absoluteFilePath("config")); ui->historyEdit->setText(dir.absoluteFilePath("history")); #elif defined(Q_OS_UNIX) QDir dir = QDir::home(); ui->dataEdit->setText(dir.absoluteFilePath(".local/share/qutim")); dir = dir.absoluteFilePath(".config/qutim/" % profiles); ui->configEdit->setText(m_singleProfile ? dir.absolutePath() : dir.absoluteFilePath("config")); ui->historyEdit->setText(dir.absoluteFilePath("history")); #else # error Strange os.. yeah.. #endif } }
ComplexUserActionList ComplexUserActionParser::parse() { ComplexUserActionList complexActions; QDir dir; dir.current().cdUp(); dir.cdUp(); dir.setPath("userAction/complexUserAction/XMLcomplexUserActions"); QStringList filters; filters << "*.xml"; QStringList const complexActionFileNames = dir.entryList(filters); QStringList complexActionFiles; for (const QString &actionFileName: complexActionFileNames) { complexActionFiles << dir.absolutePath() + "/" + actionFileName; } for (const QString &actionFile: complexActionFiles) { ComplexUserAction *complexUserAction = parseAction(actionFile); if (complexUserAction != nullptr) { complexActions << complexUserAction; } } return complexActions; }
QString getAppPath() { QDir testPluginsDir = QDir(qApp->applicationDirPath()); #if defined(Q_OS_WIN) if (testPluginsDir.dirName().toLower() == "debug" || testPluginsDir.dirName().toLower() == "release") testPluginsDir.cdUp(); #elif defined(Q_OS_MAC) // In a Mac app bundle, plugins directory could be either // a - below the actual executable i.e. v3d.app/Contents/MacOS/plugins/ // b - parallel to v3d.app i.e. foo/v3d.app and foo/plugins/ if (testPluginsDir.dirName() == "MacOS") { QDir testUpperPluginsDir = testPluginsDir; testUpperPluginsDir.cdUp(); testUpperPluginsDir.cdUp(); testUpperPluginsDir.cdUp(); // like foo/plugins next to foo/v3d.app if (testUpperPluginsDir.cd("plugins")) testPluginsDir = testUpperPluginsDir; testPluginsDir.cdUp(); } #endif return testPluginsDir.absolutePath(); }
ComplexUserActionList ComplexUserActionParser::parseScenarios() { ComplexUserActionList scenarios; QDir dir; dir.current().cdUp(); dir.cdUp(); dir.setPath("userAction/userScenario"); QStringList filters; filters << "*.xml"; QStringList const scenarioFileNames = dir.entryList(filters); QStringList scenarioFiles; for (const QString &actionFileName: scenarioFileNames) { scenarioFiles << dir.absolutePath() + "/" + actionFileName; } for (const QString &actionFile: scenarioFiles) { ComplexUserAction *scenario = parseAction(actionFile, true); if (scenario != nullptr) { scenarios << scenario; } } return scenarios; }
void AtticaManager::loadPixmapsFromCache() { QDir cacheDir = TomahawkUtils::appDataDir(); if ( !cacheDir.cd( "atticacache" ) ) // doesn't exist, no cache return; qDebug() << "Loading resolvers from cache dir:" << cacheDir.absolutePath(); qDebug() << "Currently we know about these resolvers:" << m_resolverStates.keys(); foreach ( const QString& file, cacheDir.entryList( QStringList() << "*.png", QDir::Files | QDir::NoSymLinks ) ) { // load all the pixmaps QFileInfo info( file ); if ( !m_resolverStates.contains( info.baseName() ) ) { tLog() << "Found resolver icon cached for resolver we no longer see in synchrotron repo:" << info.baseName(); continue; } QPixmap* icon = new QPixmap( cacheDir.absoluteFilePath( file ) ); m_resolverStates[ info.baseName() ].pixmap = icon; } }
void MainWindow::on_actionLoad_triggered() { qDebug() << Q_FUNC_INFO <<"start"; ui->labelProgress->show(); //First try to load settings QString lstload = IUpdatesettings.value( "lastLoadPath",QDir::homePath() ).toString(); csvInter.SetFilePath(QFileDialog::getOpenFileName( this,tr( "Open %1 Marks File" ).arg( csvInter.GetFileTypeName() ), lstload, tr( "%1" ).arg( csvInter.GetFileExt() ) ) ); if ( csvInter.LoadFile() ){ //Update setting QDir d = QFileInfo( csvInter.FilePath() ).absoluteDir(); IUpdatesettings.setValue( "lastLoadPath",d.absolutePath() ); //PopulateSubjectGrid(); PopulateSubjectWeb(); //ADD POPULATE HTML INFO HERE //Load the marktypes into the combo box ui->comboBoxMarkTypeSlct->clear(); ui->comboBoxMarkTypeSlct->addItems( csvInter.GetMarkTypesList() ); showSideWindow(); } else { qDebug()<<"File not loaded (Perhaps cancell was clicked)"; } ui->labelProgress->hide(); qDebug() << Q_FUNC_INFO <<"end"; }
void MainWindow::detect() { string sFileName, sFullPath; vector<FaceObject> faceObjects; // parse arguments string sClassifier = ui->dropDownDetect->currentText().toUtf8().data(); string sPath = ui->inputPath->text().toUtf8().constData(); // create subfolder with a timestamp and chosen classifiern QString path = ui->inputPath->text(); QDir dir = path; QString fullPath = dir.absolutePath(); if (!QDir(path + "/metaface").exists()) { QDir().mkdir("metaface"); } QDateTime dateTime; QString date = dateTime.currentDateTime().toString(); sTimestamp = dateTime.currentDateTime().toString().toUtf8().constData(); sTimestamp = sTimestamp + "_" + sClassifier; QDir dirr = QDir::root(); QString timestamp = QString::fromStdString(sTimestamp); dirr.mkpath(fullPath + "/metaface/" + timestamp +"/"); // iterate through image folder and run detection on each image dir.setFilter(QDir::Files | QDir::Dirs | QDir::NoDot | QDir::NoDotDot | QDir::NoSymLinks); // add QDirIterator::Subdirectories as argument if you want to iterate trough subfolders QDirIterator it(dir); while(it.hasNext()) { it.next(); sFileName = it.fileName().toUtf8().constData(); faceObjects = detectFaces(sPath, sFileName, sClassifier); writeObjectFile(faceObjects, sPath + "/metaface/" + sTimestamp + "/" + sFileName + ".txt"); } ui->outputText->append("Detection done!"); }
/*! * \author Anders Fernström and Ingemar Axelsson * \date 2006-02-10 (update) * * \brief open a new document * * 2005-12-05 AF, check if filename exists, otherwise use work dir * 2006-02-10 AF, check if link path and fragment exists */ void CellDocument::linkClicked(const QUrl *link) // void CellDocument::anchorClicked(const QUrl *link) { // 2006-02-10 AF, check if path is empty fprintf(stderr, "received link: %s\n", link->toString().toStdString().c_str()); fflush(stderr); fflush(stdout); if( !link->path().isEmpty() ) { // 2005-12-05 AF, check if filename exists, otherwise use work dir if( filename_.isEmpty() ) { // replace '\' with '/' in the link path QString linkpath = link->path(); linkpath.replace( "\\", "/" ); QDir dir; executeCommand(new OpenFileCommand( dir.absolutePath() + '/' + linkpath )); } else { // replace '\' with '/' in the link path QString linkpath = link->path(); linkpath.replace( "\\", "/" ); executeCommand(new OpenFileCommand( QFileInfo(filename_).absolutePath() + '/' + linkpath )); } } // 2006-02-10 AF, check if there is a link fragment if( !link->fragment().isEmpty() ) { //should handel internal document links in some way } }