Path::Path(){ // get the home directory _HomeDir = getEnvVar("HOME"); // get the root directory setRootDir(getEnvVar("FREESTYLE_DIR")); //setRootDir(QString(".")); _pInstance = this; }
Path::Path() { // get the root directory // soc setRootDir(BLI_get_folder(BLENDER_SYSTEM_SCRIPTS, NULL)); _pInstance = this; }
DockPixelStreamer::DockPixelStreamer(const QSize& size, const QString& rootDir) : PixelStreamer() , flow_(new PictureFlow()) , loader_(0) , toolbar_(0) { const QSize& dockSize = constrainSize(size); createFlow(dockSize); createToolbar(dockSize.width(), dockSize.height()*0.15); createImageLoader(); loadThread_.start(); if (rootDir.isEmpty() || !setRootDir(rootDir)) setRootDir(QDir::homePath()); }
FileDialog::FileDialog(QWidget *parent) : QDialog(parent) , m_viewMode(List) , m_fileMode(AnyFile) , m_acceptMode(AcceptOpen) , m_dirIcon(":/images/dirclosed-16.png") , m_fileIcon(":/fileicons/xfile_16.png") , m_previewWidget(NULL) { ui.setupUi(this); ui.toolButton1->setDefaultAction(ui.actionBack); ui.toolButton2->setDefaultAction(ui.actionParentDir); ui.toolButton3->setDefaultAction(ui.actionNewDirectory); ui.toolButton4->setDefaultAction(ui.actionListView); ui.toolButton5->setDefaultAction(ui.actionDetailView); ui.treeWidget->setRootIsDecorated(false); ui.treeWidget->setIconSize(QSize(16, 16)); ui.treeWidget->setSortingEnabled(true); ui.treeWidget->sortItems(0, Qt::AscendingOrder); ui.treeWidget->setColumnWidth(0, 100); ui.rootDirTree->setRootIsDecorated(false); ui.rootDirTree->setIconSize(QSize(16, 16)); ui.actionBack->setDisabled(true); QActionGroup* ag = new QActionGroup(this); ag->addAction(ui.actionListView); ag->addAction(ui.actionDetailView); QObject::connect(ui.treeWidget->header(), SIGNAL(sectionClicked(int)), this, SLOT(SortByColumn(int))); setRootDir("/"); updateWidget(); }
void setRootDir(const std::string& rootDir) { setRootDir(boost::filesystem::path(rootDir)); }
bool KTar::openArchive( QIODevice::OpenMode mode ) { if ( !(mode & QIODevice::ReadOnly) ) return true; if ( !d->fillTempFile( fileName() ) ) return false; // We'll use the permission and user/group of d->rootDir // for any directory we emulate (see findOrCreate) //struct stat buf; //stat( fileName(), &buf ); d->dirList.clear(); QIODevice* dev = device(); if ( !dev ) return false; // read dir information char buffer[ 0x200 ]; bool ende = false; do { QString name; QString symlink; // Read header qint64 n = d->readHeader( buffer, name, symlink ); if (n < 0) return false; if (n == 0x200) { bool isdir = false; if ( name.endsWith( QLatin1Char( '/' ) ) ) { isdir = true; name.truncate( name.length() - 1 ); } QByteArray prefix = QByteArray(buffer + 0x159, 155); if (prefix[0] != '\0') { name = (QString::fromLatin1(prefix.constData()) + QLatin1Char('/') + name); } int pos = name.lastIndexOf( QLatin1Char('/') ); QString nm = ( pos == -1 ) ? name : name.mid( pos + 1 ); // read access buffer[ 0x6b ] = 0; char *dummy; const char* p = buffer + 0x64; while( *p == ' ' ) ++p; int access = (int)strtol( p, &dummy, 8 ); // read user and group QString user = QString::fromLocal8Bit( buffer + 0x109 ); QString group = QString::fromLocal8Bit( buffer + 0x129 ); // read time buffer[ 0x93 ] = 0; p = buffer + 0x88; while( *p == ' ' ) ++p; uint time = (int)strtol( p, &dummy, 8 ); // read type flag char typeflag = buffer[ 0x9c ]; // '0' for files, '1' hard link, '2' symlink, '5' for directory // (and 'L' for longlink fileNames, 'K' for longlink symlink targets) // 'D' for GNU tar extension DUMPDIR, 'x' for Extended header referring // to the next file in the archive and 'g' for Global extended header if ( typeflag == '5' ) isdir = true; bool isDumpDir = false; if ( typeflag == 'D' ) { isdir = false; isDumpDir = true; } //qDebug() << nm << "isdir=" << isdir << "pos=" << dev->pos() << "typeflag=" << typeflag << " islink=" << ( typeflag == '1' || typeflag == '2' ); if (typeflag == 'x' || typeflag == 'g') { // pax extended header, or pax global extended header // Skip it for now. TODO: implement reading of extended header, as per http://pubs.opengroup.org/onlinepubs/009695399/utilities/pax.html (void)dev->read( buffer, 0x200 ); continue; } if (isdir) access |= S_IFDIR; // f*cking broken tar files KArchiveEntry* e; if ( isdir ) { //qDebug() << "directory" << nm; e = new KArchiveDirectory( this, nm, access, KArchivePrivate::time_tToDateTime(time), user, group, symlink ); } else { // read size QByteArray sizeBuffer( buffer + 0x7c, 12 ); qint64 size = sizeBuffer.trimmed().toLongLong( 0, 8 /*octal*/ ); //qDebug() << "sizeBuffer='" << sizeBuffer << "' -> size=" << size; // for isDumpDir we will skip the additional info about that dirs contents if ( isDumpDir ) { //qDebug() << nm << "isDumpDir"; e = new KArchiveDirectory( this, nm, access, KArchivePrivate::time_tToDateTime(time), user, group, symlink ); } else { // Let's hack around hard links. Our classes don't support that, so make them symlinks if ( typeflag == '1' ) { //qDebug() << "Hard link, setting size to 0 instead of" << size; size = 0; // no contents } //qDebug() << "file" << nm << "size=" << size; e = new KArchiveFile( this, nm, access, KArchivePrivate::time_tToDateTime(time), user, group, symlink, dev->pos(), size ); } // Skip contents + align bytes qint64 rest = size % 0x200; qint64 skip = size + (rest ? 0x200 - rest : 0); //qDebug() << "pos()=" << dev->pos() << "rest=" << rest << "skipping" << skip; if (! dev->seek( dev->pos() + skip ) ) { //qWarning() << "skipping" << skip << "failed"; } } if ( pos == -1 ) { if (nm == QLatin1String(".")) { // special case Q_ASSERT( isdir ); if (isdir) { setRootDir( static_cast<KArchiveDirectory *>( e ) ); } } else { rootDir()->addEntry( e ); } } else { // In some tar files we can find dir/./file => call cleanPath QString path = QDir::cleanPath( name.left( pos ) ); // Ensure container directory exists, create otherwise KArchiveDirectory * d = findOrCreate( path ); d->addEntry( e ); } } else { //qDebug("Terminating. Read %d bytes, first one is %d", n, buffer[0]); d->tarEnd = dev->pos() - n; // Remember end of archive ende = true; } } while( !ende ); return true; }
void FilePage::updateFiles(bool /*checked*/) { setRootDir(); }
void FilePage::setData(const ModXData *data) { ui.copyFiles->setChecked(data->copyFiles); setRootDir(); }