int AgiLoader_v2::init() { int ec = errOK; // load directory files ec = loadDir(_vm->_game.dirLogic, LOGDIR); if (ec == errOK) ec = loadDir(_vm->_game.dirPic, PICDIR); if (ec == errOK) ec = loadDir(_vm->_game.dirView, VIEWDIR); if (ec == errOK) ec = loadDir(_vm->_game.dirSound, SNDDIR); return ec; }
MisliDir *MisliInstance::addDir(QString path) { MisliDir *md = loadDir(path); saveDirsToSettings(); emit misliDirsChanged(); return md; }
size_t vsscan9p1 (uint8_t *msg, char fmt, void *p) { size_t l; switch (fmt) { case '0': *(uint8_t *)p = msg[0]; return 1; case '1': LOAD16LE(*(uint16_t *)p, msg); return 2; case '2': LOAD32LE(*(uint32_t *)p, msg); return 4; case '3': LOAD64LE(*(uint64_t *)p, msg); return 8; case 'd': return loadDir (p, msg); case 'q': return loadQid (p, msg); case 's': LOAD16LE(l, msg); *(char **)p = xstrndup (msg + 2, l); return (2 + l); } }
void MasterApplication::_open( const QString uri, const QPointF coords, promisePtr promise ) { if( uri.isEmpty( )) { if( promise ) promise->set_value( false ); return; } auto loader = ContentLoader{ _displayGroup }; bool success = false; if( auto window = loader.findWindow( uri )) { _displayGroup->moveToFront( window ); success = true; } else if( QDir{ uri }.exists( )) success = loader.loadDir( uri ); else success = loader.load( uri, coords ); if( promise ) promise->set_value( success ); }
void QvvMainWindow::slotShowDirsOnly() { opt_dirs_only = ! opt_dirs_only; loadDir( cdir.absolutePath() ); statusBar()->showMessage( opt_dirs_only ? tr( "Show directories only" ) : tr( "Show all directories and files" ) ); }
void ImageProvider::loadNewDir(int inc) { if (isLoading) return; QString curr = io->getCurrentDir(), sDir = curr; curr = sDir.remove(sDir.length() - 1, 1); // Delete last slash sDir = sDir.remove(sDir.lastIndexOf('/'), 100); // Delete all before last slash QFileInfoList entr = QDir(sDir).entryInfoList({"*"}, QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name); int ind = 0; for (int i = 0; i < entr.size(); i++) { if (curr == entr[i].absoluteFilePath()) { ind = i; } } ind += inc; ind = ind < 0 ? 0 : ind; ind = ind > entr.length() - 1 ? entr.length() - 1 : ind; sDir = entr[ind].absoluteFilePath(); io->setCurrentDir(sDir + '/'); loadDir(); }
void MainWindow::on_ConfigureButton_triggered() { dbg << "configure" << std::endl; st->loadSettings(this->program_settings); st->exec(); if(st->dirModified) { this->hasCustomImg = false; st->dirModified = false; this->imgdir.orderBy = st->ui->orderByComboBox->currentIndex(); loadDir(); } this->random = program_settings.retrive_as_int(RANDOM_SETT); this->showDebug = program_settings.retrive_as_int(SHOW_DEBUG); if(showDebug) { ui->debugTextViewer->show(); ui->testLabel->show(); } else { ui->debugTextViewer->hide(); ui->testLabel->hide(); } coutdebug(); }
void ThumbGenerator::loadDir(QImage& image, const QFileInfo& fi) { QDir dir(fi.absoluteFilePath()); dir.setFilter(QDir::Files); QFileInfoList list = dir.entryInfoList(); QFileInfoList::const_iterator it = list.begin(); const QFileInfo *f; bool found = false; while (it != list.end()) { f = &(*it); QImageReader testread(f->absoluteFilePath()); testread.setAutoDetectImageFormat(false); if (testread.canRead()) { found = true; break; } ++it; } if (found) { loadFile(image, *f); return; } else { // if we didn't find the image yet // go into subdirs and keep looking dir.setFilter(QDir::Dirs); QFileInfoList dirlist = dir.entryInfoList(); if (dirlist.isEmpty()) return; QFileInfoList::const_iterator it = dirlist.begin(); const QFileInfo *f; while (it != dirlist.end() && image.isNull() ) { f = &(*it); ++it; if (f->fileName() == "." || f->fileName() == "..") continue; loadDir(image, *f); } } }
void ImageArea::_connectSignals( ScreenBase * w ) { if ( w == NULL ) return; connect( w, SIGNAL(updateSignal()), this, SLOT(update()) ); connect( w, SIGNAL(closeOnTouch()), this, SLOT(passCloseOnTouch()) ); connect( w, SIGNAL(changeFullscreen()), this, SLOT(passChangeFullScreen()) ); connect( w, SIGNAL(loadFile()), this, SLOT(passLoadFile()) ); connect( w, SIGNAL(loadDir()), this, SLOT(passLoadDir()) ); connect( w, SIGNAL(config()), this, SLOT(passConfig()) ); connect( w, SIGNAL(startTimer()), this, SLOT(onStartTimer()) ); connect( w, SIGNAL(changeViewer()), this, SLOT(onChangeMode()) ); connect( w, SIGNAL(indexChanged(int)), this, SLOT(indexChanged(int)) ); }
void QvvMainWindow::goToDir( int mode ) { mode = ! mode; // FIXME: for what?? QFileDialog::Options options = QFileDialog::DontResolveSymlinks | QFileDialog::ShowDirsOnly; /* if (!native->isChecked()) options |= QFileDialog::DontUseNativeDialog; */ QString new_dir = QFileDialog::getExistingDirectory( this, tr( "Change directory" ), cdir.absolutePath(), options ); if ( ! new_dir.isEmpty() ) loadDir( new_dir ); };
void imageLoader::chooseDir(){ if(ofGetWindowMode() == 0){ ofBackground(0); ofFileDialogResult result = ofSystemLoadDialog("Folder To Watch...", true); if(result.bSuccess) { path = result.getPath(); // img01 = 0; //img02 = 1; // alpha01 = 255; //alpha02 = 0; loadDir(); //cout << "path: " << path << endl; } }else { help = true; } }
void MisliInstance::loadStoredDirs() { //Clear first for(MisliDir* misliDir: misliDirs_m) delete misliDir; misliDirs_m.clear(); QStringList notesDirs; //------Extract the directory paths from the settings---------- if(settings.contains("notes_dir")){ notesDirs = settings.value("notes_dir").toStringList(); qDebug()<<"Loading notes dirs:"<<notesDirs; } //-------Load the directories------------------------ for(QString notesDir: notesDirs){ loadDir(notesDir); } emit storedDirsLoaded(); }
void MainWindow::initialLoad() { this->statusBar()->hide(); slideShowActive = 0; int x_win_offset; int y_win_offset; execution_path.replace("\\","/",Qt::CaseSensitive); program_settings.path = execution_path.toStdString(); program_settings.path.append("/settings"); dbg << program_settings.path << std::endl; program_settings.load(); program_settings.dump(); this->resize(1900,1050); x_win_offset = program_settings.retrive_as_int(X_WIN_OFFSET); y_win_offset = program_settings.retrive_as_int(Y_WIN_OFFSET); this->move(x_win_offset, y_win_offset); this->random = program_settings.retrive_as_int(RANDOM_SETT); this->imgdir.orderBy = program_settings.retrive_as_int(ORDER_BY_SETT); this->showDebug = program_settings.retrive_as_int(SHOW_DEBUG); if(hasCustomImg) { ui->imgLabel->setText(customImg); this->program_settings.modify(DIR1_SETT,QFileInfo(customImg).absolutePath().toStdString()); } if(showDebug) { ui->debugTextViewer->show(); ui->testLabel->show(); } loadDir(); coutdebug(); }
void ThumbGenerator::loadDir(QImage& image, const QFileInfo& fi) { QDir dir(fi.absoluteFilePath()); dir.setFilter(QDir::Files); QFileInfoList list = dir.entryInfoList(); for (QFileInfoList::const_iterator it = list.begin(); it != list.end() && !m_cancel; ++it) { const QFileInfo *f = &(*it); QImageReader testread(f->absoluteFilePath()); if (testread.canRead()) { loadFile(image, *f); return; } } // If we are supposed to cancel, don't recurse into subdirs, just quit if (m_cancel) return; // if we didn't find the image yet // go into subdirs and keep looking dir.setFilter(QDir::Dirs); QFileInfoList dirlist = dir.entryInfoList(); if (dirlist.isEmpty()) return; for (QFileInfoList::const_iterator it = dirlist.begin(); it != dirlist.end() && image.isNull() && !m_cancel; ++it) { const QFileInfo *f = &(*it); if (f->fileName() == "." || f->fileName() == "..") continue; loadDir(image, *f); } }
void QvvMainWindow::enter( QTreeWidgetItem *item ) { if( ! item ) return; if( item->text( 0 ) == ITEM_TYPE_DIR ) { loadDir( item->text( 1 ) ); } else { QvvView *view; if( views.count() > 0 ) { view = views[0]; } else { view = new QvvView( this ); views.append( view ); } view->load( cdir.absolutePath() + "/" + item->text( 1 ) ); } };
//-------------------------------------------------------------- void imageLoader::update(){ //ofBackground(255); timeline = ofGetElapsedTimeMillis(); timeline %= SWITCH_SPEED; //cout <<timeline << endl; if(timeline < 500){ goingUp = true; reload = true; anim = true; } if (timeline > 1200 && reload == true) { if (!path.empty()) { loadDir(); reload = false; } } }
ImageProvider::ImageProvider(Window *w, QString dir) : wnd(w) { io = new PIO(this); files = new QStringList; imgLoader = new ImageLoader(this); gifLoader = new GifLoader(this); mutex = new QMutex; connect(this, &ImageProvider::titleChanged, wnd, &Window::titleChanged, Qt::QueuedConnection); QFile f("/home/ilya/.myQtProgs/photos_last.json"); if (f.open(QFile::ReadOnly)) { lastPicture = QJsonDocument::fromJson(f.readAll()).object(); f.close(); } if (dir == "") { io->setNewCurrentDir(); } else { io->setCurrentDir(dir); loadDir(); } }
void ThumbGenerator::run() { RunProlog(); m_cancel = false; while (moreWork() && !m_cancel) { QString file, dir; bool isGallery; m_mutex.lock(); dir = m_directory; isGallery = m_isGallery; file = m_fileList.first(); if (!m_fileList.isEmpty()) m_fileList.pop_front(); m_mutex.unlock(); if (file.isEmpty()) continue; QString filePath = dir + QString("/") + file; QFileInfo fileInfo(filePath); if (!fileInfo.exists()) continue; if (isGallery) { if (fileInfo.isDir()) isGallery = checkGalleryDir(fileInfo); else isGallery = checkGalleryFile(fileInfo); } if (!isGallery) { QString cachePath = QString("%1%2.jpg").arg(getThumbcacheDir(dir)) .arg(file); QFileInfo cacheInfo(cachePath); if (cacheInfo.exists() && cacheInfo.lastModified() >= fileInfo.lastModified()) { continue; } else { // cached thumbnail not there or out of date QImage image; // Remove the old one if it exists if (cacheInfo.exists()) QFile::remove(cachePath); if (fileInfo.isDir()) loadDir(image, fileInfo); else loadFile(image, fileInfo); if (image.isNull()) continue; // give up; // if the file is a movie save the image to use as a screenshot if (GalleryUtil::IsMovie(fileInfo.filePath())) { QString screenshotPath = QString("%1%2-screenshot.jpg") .arg(getThumbcacheDir(dir)) .arg(file); image.save(screenshotPath, "JPEG", 95); } image = image.scaled(m_width,m_height, Qt::KeepAspectRatio, Qt::SmoothTransformation); image.save(cachePath, "JPEG", 95); // deep copies all over ThumbData *td = new ThumbData; td->directory = dir; td->fileName = file; td->thumb = image.copy(); // inform parent we have thumbnail ready for it QApplication::postEvent(m_parent, new ThumbGenEvent(td)); } } } RunEpilog(); }
BitmapSequence::BitmapSequence( string inDir ){ init(); loadDir( inDir ); }
void QvvMainWindow::slotReloadDir() { loadDir( cdir.absolutePath() ); }
void QvvMainWindow::slotHomeDir() { loadDir( cdir.homePath() ); }
void QvvMainWindow::slotGoUp() { loadDir( ".." ); };
void ImageArea::passLoadDir( void ) { emit loadDir(); }