diff options
author | Ken Moore <ken@ixsystems.com> | 2017-06-26 09:47:38 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-06-26 09:47:38 -0400 |
commit | 946cb4e3e3695fc37dc2ec8cab21f60874c048cb (patch) | |
tree | b59bed33101b493dbabb70bbb4b7edd79794c153 /src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp | |
parent | Large amount of whitespace cleanup, and almost get the LuminaRandR class fini... (diff) | |
download | lumina-946cb4e3e3695fc37dc2ec8cab21f60874c048cb.tar.gz lumina-946cb4e3e3695fc37dc2ec8cab21f60874c048cb.tar.bz2 lumina-946cb4e3e3695fc37dc2ec8cab21f60874c048cb.zip |
Finish up all the new TreeWidget stuff from JT:
1. Save/load the size of the tree widget between sessions (sync size across all tabs as well).
2. Sync the tree widget with the browser with regards to whether hidden files should be shown or not.
3. Tie the tree widget "dir model" to the line edit so we get auto-completions again.
4. Make sure the tree widget shows the "normalized" directory path (does not show ZFS snapshot dirs and such).
5. Clean up a lot of debugging messages and comment out unused variable declarations.
6. Change the Browser thumbnail loading/scaling routine to always run based on image resolution rather than file size.
Diffstat (limited to 'src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp')
-rw-r--r-- | src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp index 6c2d4f35..ab2c023d 100644 --- a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp +++ b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp @@ -16,9 +16,9 @@ #include <QInputDialog> #include <QScrollBar> #include <QSettings> -#include <QtConcurrent/QtConcurrentRun> +#include <QtConcurrent> #include <QFileSystemModel> - +#include <QCompleter> #include <LuminaOS.h> #include <LuminaXDG.h> #include <LUtils.h> @@ -71,7 +71,7 @@ DirWidget::DirWidget(QString objID, QWidget *parent) : QWidget(parent), ui(new U dirtreeModel->setFilter(QDir::NoDotAndDotDot | QDir::AllDirs); // remove extraneous dirs dirtreeModel->setRootPath(folderTreePath); ui->folderViewPane->setModel(dirtreeModel); - ui->splitter->setSizes( QList<int>() << this->width()/3 << 2*this->width()/3); + ui->splitter->setSizes( QList<int>() << this->width()/4 << 3*this->width()/4); ui->folderViewPane->setHeaderHidden(true); ui->folderViewPane->resizeColumnToContents(0); ui->folderViewPane->setColumnHidden(1, true); @@ -83,11 +83,13 @@ DirWidget::DirWidget(QString objID, QWidget *parent) : QWidget(parent), ui(new U contextMenu = new QMenu(this); cNewMenu = cOpenMenu = cFModMenu = cFViewMenu = cOpenWithMenu = 0; //not created yet connect(contextMenu, SIGNAL(aboutToShow()), this, SLOT(UpdateContextMenu()) ); + connect(ui->splitter, SIGNAL(splitterMoved(int,int)), this, SLOT(splitterMoved()) ); UpdateIcons(); UpdateText(); createShortcuts(); createMenus(); + line_dir->setCompleter(new QCompleter(dirtreeModel, this)); } DirWidget::~DirWidget(){ @@ -112,7 +114,7 @@ void DirWidget::ChangeDir(QString dirpath){ } void DirWidget::setDirCompleter(QCompleter *comp){ - //line_dir->setCompleter(comp); + line_dir->setCompleter(comp); } QString DirWidget::id(){ @@ -131,6 +133,9 @@ void DirWidget::setShowDetails(bool show){ void DirWidget::showHidden(bool show){ BW->showHiddenFiles(show); if(RCBW!=0){ RCBW->showHiddenFiles(show); } + //Also make sure the tree model is showing hidden files as needed + if(show){ dirtreeModel->setFilter(QDir::NoDotAndDotDot | QDir::Hidden | QDir::AllDirs); } + else{ dirtreeModel->setFilter(QDir::NoDotAndDotDot | QDir::AllDirs); } } void DirWidget::showThumbnails(bool show){ @@ -148,15 +153,8 @@ void DirWidget::setThumbnailSize(int px){ //==================== // Folder Pane //==================== - -void DirWidget::showDirTreePane(bool show){ - if(show !=showdirtree){ - showdirtree = show; - } -} - -bool DirWidget::showingDirTreePane(){ - return showdirtree; +void DirWidget::adjustTreeWidget(float percent){ + ui->splitter->setSizes( QList<int>() << this->width()*(percent/100.0) << this->width() * ((100.0-percent)/100.0) ); } void DirWidget::on_folderViewPane_clicked(const QModelIndex &index){ @@ -349,6 +347,10 @@ QStringList DirWidget::currentDirFiles(){ // ================= // PRIVATE SLOTS // ================= +void DirWidget::splitterMoved(){ + float percent = (ui->splitter->sizes().first() / ( (float) this->width()) )*100.0; + this->emit treeWidgetSizeChanged(percent); +} //UI BUTTONS void DirWidget::on_tool_zoom_in_clicked(){ @@ -600,17 +602,17 @@ void DirWidget::currentDirectoryChanged(bool widgetonly){ normalbasedir = cur; ui->group_snaps->setVisible(false); emit findSnaps(ID, cur); - qDebug() << "Changed to directory:" << cur; + //qDebug() << "Changed to directory:" << cur; }else{ //Re-assemble the normalbasedir variable (in case moving around within a snapshot) normalbasedir = cur; normalbasedir.replace( QRegExp("\\/\\.zfs\\/snapshot/([^/]+)\\/"), "/" ); - qDebug() << "Changed to snapshot:" << cur << normalbasedir; + //qDebug() << "Changed to snapshot:" << cur << normalbasedir; } ui->actionBack->setEnabled( currentBrowser()->history().length()>1 ); - line_dir->setText(normalbasedir); + line_dir->setText(normalbasedir); emit TabNameChanged(ID, normalbasedir.section("/",-1)); - QModelIndex index = dirtreeModel->index(cur,0); + QModelIndex index = dirtreeModel->index(normalbasedir,0); ui->folderViewPane->setCurrentIndex( index ); ui->folderViewPane->scrollTo(index); } |