Exemplo n.º 1
0
void
FileSystemModel::onWatchedDirectoryChanged(const QString& directory)
{
    boost::shared_ptr<FileSystemItem> item = _imp->getItemFromPath(directory);
    if (item) {
        if (directory == _imp->currentRootPath) {
            cleanAndRefreshItem(item);
        } else {
            ///This is a sub-directory
            ///Clear the parent of the corresponding item
            if (item->parent()) {
                
                QModelIndex idx = index(item.get());
				assert(idx.isValid());
				int count = item->parent()->childCount();
				if (count > 0) {
					beginRemoveRows(idx.parent(), 0, count - 1);
					item->parent()->clearChildren();
					endRemoveRows();
				}
            }
        }
    }
    
    QDir dir(_imp->currentRootPath);
    if (!dir.exists()) {
        ///The current directory has changed its name or was deleted.. just fallback the filesystem to the root-path
        setRootPath(QDir::rootPath());
    } else {
        setRootPath(_imp->currentRootPath);
    }
}
Exemplo n.º 2
0
	bool FileSystemModel::cd (const QString& dirName)
	{
		QDir root (m_rootPath);
		const bool isSuccess = root.cd(dirName);
		if(isSuccess)
		{
			setRootPath (root.absolutePath());
		}
		return isSuccess;
	}
Exemplo n.º 3
0
ChannelConfigurationsModel::ChannelConfigurationsModel(QObject *parent)
	: QFileSystemModel(parent),
	m_iconProvider(new FileIconProvider)
{
	setIconProvider(m_iconProvider);
	const QString configPath = QString::fromStdString(Camera::ConfigPath::path());
	QDir().mkpath(configPath);
	setNameFilters(QStringList() << ("*." + QString::fromStdString(Camera::ConfigPath::extension())));
	setNameFilterDisables(false);
	setRootPath(configPath);
}
Exemplo n.º 4
0
 SelectFilesModel() : QFileSystemModel() {
     class FileLister : private FileList {
     public:
         static QStringList filters() {
             return GetDefaultFilters();
         }
     };
     setNameFilters(FileLister::filters());
     setNameFilterDisables(false);
     setRootPath("/");
 }
Exemplo n.º 5
0
void
FileSystemModel::setSequenceModeEnabled(bool sequenceMode)
{
    {
        QMutexLocker l(&_imp->sequenceModeEnabledMutex);
        _imp->sequenceModeEnabled = sequenceMode;
    }
    
    resetCompletly();
    
    ///Now re-populate the current root path
    setRootPath(_imp->currentRootPath);
}
Exemplo n.º 6
0
bool FmFileWidget::cdUp()
{
    QString path( FmUtils::checkFolderToDriveFilter( currentPath().absoluteFilePath() ) );
    QFileInfo fileInfo( path );
    QString cdUpPath;
    // path length>3 means current path is a sub folder, then get up level path and navigate to it
    // Otherwise means current path is a top level drive path, Should navigate to drive view. So setRootPath with empty path string.
    if( path.length() > 3 ) {
        cdUpPath = fileInfo.dir().absolutePath();
    }
    setRootPath( FmUtils::fillPathWithSplash( cdUpPath ) );
    return true;
}
Exemplo n.º 7
0
void FmFileWidget::changeRootIndex( const QModelIndex &index )
{
    FM_LOG("FmFileWidget::changeRootIndex start" );
    if( mCurrentModel != mFileModel ) {
        FM_LOG("FmFileWidget::changeRootIndex end because model not equal mFileModel" );
        return;
    }

    mFileModel->fetchMore(index);
    QString filePath = mFileModel->fileInfo( index ).absoluteFilePath();
    // pathChanged signal will be emitted in setRootPath
    setRootPath( filePath );
    FM_LOG("FmFileWidget::changeRootIndex end" );
}
/*!
    init
    \param directory .
*/
void FmFileDialogPrivate::init( const FmFileDialogArgs &args )
{
    mArgs = args;
    setProperties();
    createHeadingWidget();
    createContentWidget();
    createBottomWidget();

    if( !mFileDialog->primaryAction() && !mFileDialog->secondaryAction() ) {
        createAndSetActions(mFileDialog->tr("Ok"),mFileDialog->tr("Cancel"));
    }

    makeConnections();
    setRootPath( mArgs.mDirectory );
    mFileWidget->setModelFilter( mArgs.mDirFilters );
    mFileWidget->setNameFilters( mArgs.mNameFilters );
}
Exemplo n.º 9
0
FMListView::FMListView( QWidget *parent) :
    QListView(parent)
{    
    freeSpace.clear();
#if !defined(QEFEM_MAEMO_DEV)
    setDragEnabled ( true );
    setDragDropMode( QAbstractItemView::DragDrop );
    setAcceptDrops( true );
#endif    
    setSelectionMode( QAbstractItemView::ExtendedSelection );
    
    setEditTriggers( QAbstractItemView::NoEditTriggers );
    QString home( QDir::homePath() );
    
    setRootPath( home );
    
    connect( &watcher, SIGNAL(directoryChanged( const QString& )), this, SLOT(setRootPath(const QString&)) );
    selectionModel()->clear();
}
Exemplo n.º 10
0
void DuFileDialog::makeConfigurations()
{
    setWindowTitle(mTitle);
    auto fileSystemModel = new QFileSystemModel(this);
    fileSystemModel->setRootPath(QDir::rootPath());
    mFilenameLineEdit->setCompleter(new QCompleter(fileSystemModel, this));
    mDialogButtonBox->setStandardButtons(QDialogButtonBox::Ok
                                         | QDialogButtonBox::Cancel);
    mToolButton->setIcon(QIcon(":/browse"));

    auto hbox = new QHBoxLayout;
    hbox->addWidget(mLabel);
    hbox->addWidget(mFilenameLineEdit);
    hbox->addWidget(mToolButton);
    auto vbox = new QVBoxLayout;
    vbox->addLayout(hbox);
    vbox->addWidget(mDialogButtonBox);
    setLayout(vbox);
    resize(width()*4, height());
}
Exemplo n.º 11
0
dc_viewer::dc_viewer(QWidget *parent, Qt::WFlags flags)
	: QMainWindow(parent, flags)
{
	ui.setupUi(this);

	//connect signals
	connect(this->ui.actionSetRoot, SIGNAL(triggered()), this, SLOT(setRootPath()));
	connect(this->ui.actionSetTemppath, SIGNAL(triggered()), this, SLOT(setTemppath()));
	connect(this->ui.fileTreeView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(onFileItemDoubleClicked(QModelIndex)));
	connect(this->ui.colorLabel, SIGNAL(labelDoubleClicked()), this, SLOT(onColorLabelDoubleClicked()));
	connect(this->ui.depthLabel, SIGNAL(labelDoubleClicked()),this, SLOT(onDepthLabelDoubleClicked()));
	connect(this->ui.edgeLabel, SIGNAL(labelDoubleClicked()), this, SLOT(onEdgeLabelDoubleClicked()));
	connect(this->ui.tempLabel, SIGNAL(labelDoubleClicked()), this, SLOT(onTempLabelDoubleClicked()));
	connect(this->ui.normalLabel, SIGNAL(labelDoubleClicked()),this, SLOT(onNormalLabelDoubleClicked()));

	//set parameters
	this->colorImage = NULL;
	this->depthImage = NULL;
	this->captureImage = NULL;
	this->pointData = NULL;
	this->normalData = NULL;
	this->fileModel = new QFileSystemModel(this);
	this->rootPath = QDir::currentPath();
	this->fileModel->setRootPath(this->rootPath);
	this->boundingBox.setX(0);
	this->boundingBox.setY(0);
	this->focusLength = 1;
	this->pixelSize = 1;
	this->initializeColorMap();
	//QStringList roiNameFilter;
	//roiNameFilter << "png";
	//this->fileModel->setNameFilters(roiNameFilter);
	this->ui.fileTreeView->setModel(fileModel);
	this->ui.fileTreeView->hideColumn(1);
	this->ui.fileTreeView->hideColumn(2);
	this->ui.fileTreeView->hideColumn(3);
	this->ui.fileTreeView->hideColumn(4);
	this->ui.fileTreeView->setCurrentIndex(fileModel->index(this->rootPath));
}
Exemplo n.º 12
0
void FmFileWidget::on_listActivated()
{
    FM_LOG("FmFileWidget::on_list_activated start" );
    if( mCurrentModel == mDriveModel ) {
        //If current model is DriveModel, open drive and set path
        QString driveName = mDriveModel->driveName( mActivatedModelIndex );
        QString checkedPath = FmUtils::checkDriveToFolderFilter( driveName );
        if( checkedPath.isEmpty() ) {
            FM_LOG("FmFileWidget::on_list_activated end becaise checkedpath empty" );
            return;
        }

        FM_LOG("FmFileWidget::on_list_activated setModel dir start" );
        setModel( mFileModel );
        FM_LOG("FmFileWidget::on_list_activated setModel dir end" );
        setRootPath( checkedPath );
        FM_LOG("FmFileWidget::on_list_activated setRootIndex" );
        emit pathChanged( checkedPath );
        FM_LOG("FmFileWidget::on_list_activated finish emit pathChanged" );
    }
    else if( mCurrentModel == mFileModel ) {
        //If current model is FileSystemModel, open path or emit file activate signal.
        if ( mFileModel->isDir( mActivatedModelIndex ) ) {
            FM_LOG("FmFileWidget::on_list_activated start changeRootIndex" );
            changeRootIndex( mActivatedModelIndex );
            FM_LOG("FmFileWidget::on_list_activated finish changeRootIndex" );
        } else {
            QFileInfo fileInfo( mFileModel->filePath( mActivatedModelIndex ) );
            if( fileInfo.isFile() ) {
                emit fileActivated( fileInfo.fileName() );
                FM_LOG("FmFileWidget::on_list_activated finish emit fileActivated" );
            }
        }
    } else {
        Q_ASSERT( false );
    }
    FM_LOG("FmFileWidget::on_list_activated end" );
}
Exemplo n.º 13
0
void setRelativeRootPath(const char *relativeRootPath)
{
    Q_ASSERT(relativeRootPath);
    setRootPath(QCoreApplication::applicationDirPath() + QDir::separator()
                + QLatin1String(relativeRootPath));
}
Exemplo n.º 14
0
FileListModel::FileListModel(QObject *parent) :
    QFileSystemModel(parent)
{
    QString root = myComputer().toString();
    setRootPath(root);
}
Exemplo n.º 15
0
ProjectTreeModel::ProjectTreeModel(const Workspace& workspace,
                                   QObject*         parent) noexcept
  : QFileSystemModel(parent) {
  setIconProvider(new FileIconProvider());
  setRootPath(workspace.getProjectsPath().toStr());
}