2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2008-12-02 16:19:05 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "projecttreewidget.h"
|
2008-12-09 15:25:01 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "projectexplorer.h"
|
2010-11-01 11:18:27 +01:00
|
|
|
#include "projectnodes.h"
|
2009-09-25 11:35:44 +02:00
|
|
|
#include "project.h"
|
|
|
|
|
#include "session.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "projectmodels.h"
|
2014-11-19 17:58:33 +01:00
|
|
|
#include "projecttree.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2018-01-26 12:45:55 +01:00
|
|
|
#include <coreplugin/actionmanager/actionmanager.h>
|
2012-05-23 14:02:36 +02:00
|
|
|
#include <coreplugin/actionmanager/command.h>
|
2014-11-19 17:58:33 +01:00
|
|
|
#include <coreplugin/documentmanager.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <coreplugin/icore.h>
|
2015-02-26 13:38:54 +01:00
|
|
|
#include <coreplugin/idocument.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <coreplugin/editormanager/editormanager.h>
|
2013-01-30 18:13:46 +01:00
|
|
|
#include <coreplugin/editormanager/ieditor.h>
|
2014-07-31 18:15:19 +02:00
|
|
|
#include <coreplugin/find/itemviewfind.h>
|
2010-11-12 17:25:39 +01:00
|
|
|
|
2014-07-03 15:46:54 +02:00
|
|
|
#include <utils/algorithm.h>
|
2017-07-21 11:47:27 +02:00
|
|
|
#include <utils/navigationtreeview.h>
|
|
|
|
|
#include <utils/progressindicator.h>
|
2015-08-20 14:47:02 +02:00
|
|
|
#include <utils/tooltip/tooltip.h>
|
2016-08-03 17:55:54 +02:00
|
|
|
#include <utils/utilsicons.h>
|
2008-12-09 15:25:01 +01:00
|
|
|
|
2017-07-21 11:47:27 +02:00
|
|
|
#include <QApplication>
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QSettings>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2013-01-16 15:27:03 +01:00
|
|
|
#include <QStyledItemDelegate>
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
#include <QToolButton>
|
2017-07-21 11:47:27 +02:00
|
|
|
#include <QPainter>
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QAction>
|
2018-03-08 02:04:34 +03:00
|
|
|
#include <QLineEdit>
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QMenu>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2017-07-21 11:47:27 +02:00
|
|
|
#include <memory>
|
|
|
|
|
|
2013-01-10 20:18:41 +02:00
|
|
|
using namespace Core;
|
2008-12-02 12:01:29 +01:00
|
|
|
using namespace ProjectExplorer;
|
|
|
|
|
using namespace ProjectExplorer::Internal;
|
2017-07-21 11:47:27 +02:00
|
|
|
using namespace Utils;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2014-07-03 15:46:54 +02:00
|
|
|
QList<ProjectTreeWidget *> ProjectTreeWidget::m_projectTreeWidgets;
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
namespace {
|
2013-01-16 15:27:03 +01:00
|
|
|
|
|
|
|
|
class ProjectTreeItemDelegate : public QStyledItemDelegate
|
|
|
|
|
{
|
|
|
|
|
public:
|
2017-07-21 11:47:27 +02:00
|
|
|
ProjectTreeItemDelegate(QTreeView *view) : QStyledItemDelegate(view),
|
|
|
|
|
m_view(view)
|
|
|
|
|
{
|
|
|
|
|
connect(m_view->model(), &QAbstractItemModel::modelReset,
|
|
|
|
|
this, &ProjectTreeItemDelegate::deleteAllIndicators);
|
|
|
|
|
|
|
|
|
|
// Actually this only needs to delete the indicators in the effected rows and *after* it,
|
|
|
|
|
// but just be lazy and nuke all the indicators.
|
|
|
|
|
connect(m_view->model(), &QAbstractItemModel::rowsAboutToBeRemoved,
|
|
|
|
|
this, &ProjectTreeItemDelegate::deleteAllIndicators);
|
|
|
|
|
connect(m_view->model(), &QAbstractItemModel::rowsAboutToBeInserted,
|
|
|
|
|
this, &ProjectTreeItemDelegate::deleteAllIndicators);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
~ProjectTreeItemDelegate() override
|
|
|
|
|
{
|
|
|
|
|
deleteAllIndicators();
|
|
|
|
|
}
|
2013-01-16 15:27:03 +01:00
|
|
|
|
2017-07-21 11:47:27 +02:00
|
|
|
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
|
2013-01-16 15:27:03 +01:00
|
|
|
{
|
2018-03-22 10:13:19 +01:00
|
|
|
QStyledItemDelegate::paint(painter, option, index);
|
2017-07-21 11:47:27 +02:00
|
|
|
|
|
|
|
|
if (index.data(Project::isParsingRole).toBool()) {
|
2018-03-22 10:13:19 +01:00
|
|
|
QStyleOptionViewItem opt = option;
|
2017-07-21 11:47:27 +02:00
|
|
|
initStyleOption(&opt, index);
|
|
|
|
|
ProgressIndicatorPainter *indicator = findOrCreateIndicatorPainter(index);
|
|
|
|
|
|
|
|
|
|
QStyle *style = option.widget ? option.widget->style() : QApplication::style();
|
|
|
|
|
const QRect rect = style->subElementRect(QStyle::SE_ItemViewItemDecoration, &opt, opt.widget);
|
|
|
|
|
|
|
|
|
|
indicator->paint(*painter, rect);
|
|
|
|
|
} else {
|
|
|
|
|
delete m_indicators.value(index);
|
|
|
|
|
m_indicators.remove(index);
|
|
|
|
|
}
|
2013-01-16 15:27:03 +01:00
|
|
|
}
|
2017-07-21 11:47:27 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
ProgressIndicatorPainter *findOrCreateIndicatorPainter(const QModelIndex &index) const
|
|
|
|
|
{
|
|
|
|
|
ProgressIndicatorPainter *indicator = m_indicators.value(index);
|
|
|
|
|
if (!indicator)
|
|
|
|
|
indicator = createIndicatorPainter(index);
|
|
|
|
|
return indicator;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ProgressIndicatorPainter *createIndicatorPainter(const QModelIndex &index) const
|
|
|
|
|
{
|
|
|
|
|
auto indicator = new ProgressIndicatorPainter(ProgressIndicatorSize::Small);
|
|
|
|
|
indicator->setUpdateCallback([index, this]() { m_view->update(index); });
|
|
|
|
|
indicator->startAnimation();
|
|
|
|
|
m_indicators.insert(index, indicator);
|
|
|
|
|
return indicator;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void deleteAllIndicators()
|
|
|
|
|
{
|
|
|
|
|
qDeleteAll(m_indicators);
|
|
|
|
|
m_indicators.clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mutable QHash<QModelIndex, ProgressIndicatorPainter *> m_indicators;
|
|
|
|
|
QTreeView *m_view;
|
2013-01-16 15:27:03 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
bool debug = false;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2017-07-21 11:47:27 +02:00
|
|
|
class ProjectTreeView : public NavigationTreeView
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
ProjectTreeView()
|
|
|
|
|
{
|
|
|
|
|
setEditTriggers(QAbstractItemView::EditKeyPressed);
|
|
|
|
|
setContextMenuPolicy(Qt::CustomContextMenu);
|
2014-09-04 13:37:43 +02:00
|
|
|
setDragEnabled(true);
|
2019-02-11 15:04:35 +01:00
|
|
|
setDragDropMode(QAbstractItemView::DragDrop);
|
|
|
|
|
viewport()->setAcceptDrops(true);
|
|
|
|
|
setDropIndicatorShown(true);
|
2020-05-26 14:48:38 +02:00
|
|
|
auto context = new IContext(this);
|
|
|
|
|
context->setContext(Context(ProjectExplorer::Constants::C_PROJECT_TREE));
|
|
|
|
|
context->setWidget(this);
|
2015-05-07 15:40:56 +02:00
|
|
|
|
2020-05-26 14:48:38 +02:00
|
|
|
ICore::addContextObject(context);
|
2015-05-07 15:40:56 +02:00
|
|
|
|
|
|
|
|
connect(this, &ProjectTreeView::expanded,
|
|
|
|
|
this, &ProjectTreeView::invalidateSize);
|
|
|
|
|
connect(this, &ProjectTreeView::collapsed,
|
|
|
|
|
this, &ProjectTreeView::invalidateSize);
|
2010-11-12 17:25:39 +01:00
|
|
|
}
|
2015-05-07 15:40:56 +02:00
|
|
|
|
|
|
|
|
void invalidateSize()
|
|
|
|
|
{
|
|
|
|
|
m_cachedSize = -1;
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-20 12:25:04 +02:00
|
|
|
void setModel(QAbstractItemModel *newModel) override
|
2015-05-07 15:40:56 +02:00
|
|
|
{
|
|
|
|
|
// Note: Don't connect to column signals, as we have only one column
|
|
|
|
|
if (model()) {
|
|
|
|
|
QAbstractItemModel *m = model();
|
|
|
|
|
disconnect(m, &QAbstractItemModel::dataChanged,
|
2016-01-31 08:06:51 +02:00
|
|
|
this, &ProjectTreeView::invalidateSize);
|
2015-05-07 15:40:56 +02:00
|
|
|
disconnect(m, &QAbstractItemModel::layoutChanged,
|
2016-01-31 08:06:51 +02:00
|
|
|
this, &ProjectTreeView::invalidateSize);
|
2015-05-07 15:40:56 +02:00
|
|
|
disconnect(m, &QAbstractItemModel::modelReset,
|
2016-01-31 08:06:51 +02:00
|
|
|
this, &ProjectTreeView::invalidateSize);
|
2015-05-07 15:40:56 +02:00
|
|
|
disconnect(m, &QAbstractItemModel::rowsInserted,
|
2016-01-31 08:06:51 +02:00
|
|
|
this, &ProjectTreeView::invalidateSize);
|
2015-05-07 15:40:56 +02:00
|
|
|
disconnect(m, &QAbstractItemModel::rowsMoved,
|
2016-01-31 08:06:51 +02:00
|
|
|
this, &ProjectTreeView::invalidateSize);
|
2015-05-07 15:40:56 +02:00
|
|
|
disconnect(m, &QAbstractItemModel::rowsRemoved,
|
2016-01-31 08:06:51 +02:00
|
|
|
this, &ProjectTreeView::invalidateSize);
|
2015-05-07 15:40:56 +02:00
|
|
|
}
|
|
|
|
|
if (newModel) {
|
|
|
|
|
connect(newModel, &QAbstractItemModel::dataChanged,
|
|
|
|
|
this, &ProjectTreeView::invalidateSize);
|
|
|
|
|
connect(newModel, &QAbstractItemModel::layoutChanged,
|
|
|
|
|
this, &ProjectTreeView::invalidateSize);
|
|
|
|
|
connect(newModel, &QAbstractItemModel::modelReset,
|
|
|
|
|
this, &ProjectTreeView::invalidateSize);
|
|
|
|
|
connect(newModel, &QAbstractItemModel::rowsInserted,
|
|
|
|
|
this, &ProjectTreeView::invalidateSize);
|
|
|
|
|
connect(newModel, &QAbstractItemModel::rowsMoved,
|
|
|
|
|
this, &ProjectTreeView::invalidateSize);
|
|
|
|
|
connect(newModel, &QAbstractItemModel::rowsRemoved,
|
|
|
|
|
this, &ProjectTreeView::invalidateSize);
|
|
|
|
|
}
|
2017-07-21 11:47:27 +02:00
|
|
|
NavigationTreeView::setModel(newModel);
|
2015-05-07 15:40:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int sizeHintForColumn(int column) const override
|
|
|
|
|
{
|
|
|
|
|
if (m_cachedSize < 0)
|
2017-07-21 11:47:27 +02:00
|
|
|
m_cachedSize = NavigationTreeView::sizeHintForColumn(column);
|
2015-05-07 15:40:56 +02:00
|
|
|
|
|
|
|
|
return m_cachedSize;
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-12 17:25:39 +01:00
|
|
|
private:
|
2015-05-07 15:40:56 +02:00
|
|
|
mutable int m_cachedSize = -1;
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
/class ProjectTreeWidget
|
|
|
|
|
|
|
|
|
|
Shows the projects in form of a tree.
|
|
|
|
|
*/
|
2016-04-13 15:52:14 +02:00
|
|
|
ProjectTreeWidget::ProjectTreeWidget(QWidget *parent) : QWidget(parent)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2017-01-19 14:54:23 +01:00
|
|
|
// We keep one instance per tree as this also manages the
|
|
|
|
|
// simple/non-simple etc state which is per tree.
|
|
|
|
|
m_model = new FlatModel(this);
|
2008-12-02 12:01:29 +01:00
|
|
|
m_view = new ProjectTreeView;
|
|
|
|
|
m_view->setModel(m_model);
|
2017-07-21 11:47:27 +02:00
|
|
|
m_view->setItemDelegate(new ProjectTreeItemDelegate(m_view));
|
2008-12-02 12:01:29 +01:00
|
|
|
setFocusProxy(m_view);
|
2014-11-19 17:58:33 +01:00
|
|
|
m_view->installEventFilter(this);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2016-04-13 15:52:14 +02:00
|
|
|
auto layout = new QVBoxLayout();
|
2015-02-03 23:59:04 +02:00
|
|
|
layout->addWidget(ItemViewFind::createSearchableWrapper(
|
2014-08-11 17:31:27 +02:00
|
|
|
m_view, ItemViewFind::DarkColored,
|
|
|
|
|
ItemViewFind::FetchMoreWhileSearching));
|
2008-12-02 12:01:29 +01:00
|
|
|
layout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
|
setLayout(layout);
|
|
|
|
|
|
2010-09-28 17:29:05 +02:00
|
|
|
m_filterProjectsAction = new QAction(tr("Simplify Tree"), this);
|
2008-12-02 12:01:29 +01:00
|
|
|
m_filterProjectsAction->setCheckable(true);
|
|
|
|
|
m_filterProjectsAction->setChecked(false); // default is the traditional complex tree
|
2016-01-29 16:38:37 +02:00
|
|
|
connect(m_filterProjectsAction, &QAction::toggled, this, &ProjectTreeWidget::setProjectFilter);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-09-28 17:29:05 +02:00
|
|
|
m_filterGeneratedFilesAction = new QAction(tr("Hide Generated Files"), this);
|
2008-12-02 12:01:29 +01:00
|
|
|
m_filterGeneratedFilesAction->setCheckable(true);
|
|
|
|
|
m_filterGeneratedFilesAction->setChecked(true);
|
2016-01-29 16:38:37 +02:00
|
|
|
connect(m_filterGeneratedFilesAction, &QAction::toggled,
|
|
|
|
|
this, &ProjectTreeWidget::setGeneratedFilesFilter);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2019-10-22 13:42:21 +02:00
|
|
|
m_filterDisabledFilesAction = new QAction(tr("Hide Disabled Files"), this);
|
|
|
|
|
m_filterDisabledFilesAction->setCheckable(true);
|
|
|
|
|
m_filterDisabledFilesAction->setChecked(false);
|
|
|
|
|
connect(m_filterDisabledFilesAction, &QAction::toggled,
|
|
|
|
|
this, &ProjectTreeWidget::setDisabledFilesFilter);
|
|
|
|
|
|
2018-02-07 13:53:54 +01:00
|
|
|
const char focusActionId[] = "ProjectExplorer.FocusDocumentInProjectTree";
|
|
|
|
|
if (!ActionManager::command(focusActionId)) {
|
|
|
|
|
auto focusDocumentInProjectTree = new QAction(tr("Focus Document in Project Tree"), this);
|
|
|
|
|
Command *cmd = ActionManager::registerAction(focusDocumentInProjectTree, focusActionId);
|
2018-08-20 12:44:52 +02:00
|
|
|
cmd->setDefaultKeySequence(
|
|
|
|
|
QKeySequence(useMacShortcuts ? tr("Meta+Shift+L") : tr("Alt+Shift+L")));
|
|
|
|
|
connect(focusDocumentInProjectTree, &QAction::triggered, this, [this]() {
|
|
|
|
|
syncFromDocumentManager();
|
|
|
|
|
});
|
2018-02-07 13:53:54 +01:00
|
|
|
}
|
2018-01-26 12:45:55 +01:00
|
|
|
|
2017-08-02 17:02:02 +02:00
|
|
|
m_trimEmptyDirectoriesAction = new QAction(tr("Hide Empty Directories"), this);
|
|
|
|
|
m_trimEmptyDirectoriesAction->setCheckable(true);
|
|
|
|
|
m_trimEmptyDirectoriesAction->setChecked(true);
|
|
|
|
|
connect(m_trimEmptyDirectoriesAction, &QAction::toggled,
|
|
|
|
|
this, &ProjectTreeWidget::setTrimEmptyDirectories);
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
// connections
|
2014-11-19 17:58:33 +01:00
|
|
|
connect(m_model, &FlatModel::renamed,
|
|
|
|
|
this, &ProjectTreeWidget::renamed);
|
2017-03-01 13:19:51 +01:00
|
|
|
connect(m_model, &FlatModel::requestExpansion,
|
|
|
|
|
m_view, &QTreeView::expand);
|
2016-01-29 16:38:37 +02:00
|
|
|
connect(m_view, &QAbstractItemView::activated,
|
|
|
|
|
this, &ProjectTreeWidget::openItem);
|
|
|
|
|
connect(m_view->selectionModel(), &QItemSelectionModel::currentChanged,
|
|
|
|
|
this, &ProjectTreeWidget::handleCurrentItemChange);
|
|
|
|
|
connect(m_view, &QWidget::customContextMenuRequested,
|
|
|
|
|
this, &ProjectTreeWidget::showContextMenu);
|
2017-03-01 13:19:51 +01:00
|
|
|
connect(m_view, &QTreeView::expanded,
|
|
|
|
|
m_model, &FlatModel::onExpanded);
|
|
|
|
|
connect(m_view, &QTreeView::collapsed,
|
|
|
|
|
m_model, &FlatModel::onCollapsed);
|
2016-01-29 16:38:37 +02:00
|
|
|
|
2020-01-23 12:11:59 +01:00
|
|
|
m_toggleSync = new QToolButton(this);
|
2018-01-07 21:39:39 +01:00
|
|
|
m_toggleSync->setIcon(Icons::LINK_TOOLBAR.icon());
|
2008-12-11 14:35:14 +01:00
|
|
|
m_toggleSync->setCheckable(true);
|
|
|
|
|
m_toggleSync->setChecked(autoSynchronization());
|
|
|
|
|
m_toggleSync->setToolTip(tr("Synchronize with Editor"));
|
2016-01-29 16:38:37 +02:00
|
|
|
connect(m_toggleSync, &QAbstractButton::clicked,
|
|
|
|
|
this, &ProjectTreeWidget::toggleAutoSynchronization);
|
2008-12-11 14:35:14 +01:00
|
|
|
|
2019-04-30 12:58:33 +02:00
|
|
|
setCurrentItem(ProjectTree::currentNode());
|
2009-01-20 17:06:46 +01:00
|
|
|
setAutoSynchronization(true);
|
2014-07-03 15:46:54 +02:00
|
|
|
|
|
|
|
|
m_projectTreeWidgets << this;
|
2014-11-19 17:58:33 +01:00
|
|
|
ProjectTree::registerWidget(this);
|
2014-07-03 15:46:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ProjectTreeWidget::~ProjectTreeWidget()
|
|
|
|
|
{
|
|
|
|
|
m_projectTreeWidgets.removeOne(this);
|
2014-11-19 17:58:33 +01:00
|
|
|
ProjectTree::unregisterWidget(this);
|
2014-07-03 15:46:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// returns how many nodes need to be expanded to make node visible
|
|
|
|
|
int ProjectTreeWidget::expandedCount(Node *node)
|
|
|
|
|
{
|
|
|
|
|
if (m_projectTreeWidgets.isEmpty())
|
|
|
|
|
return 0;
|
|
|
|
|
FlatModel *model = m_projectTreeWidgets.first()->m_model;
|
|
|
|
|
QModelIndex index = model->indexForNode(node);
|
|
|
|
|
if (!index.isValid())
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
int count = 0;
|
|
|
|
|
foreach (ProjectTreeWidget *tree, m_projectTreeWidgets) {
|
|
|
|
|
QModelIndex idx = index;
|
|
|
|
|
while (idx.isValid() && idx != tree->m_view->rootIndex()) {
|
|
|
|
|
if (!tree->m_view->isExpanded(idx))
|
|
|
|
|
++count;
|
|
|
|
|
idx = model->parent(idx);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return count;
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-19 17:58:33 +01:00
|
|
|
void ProjectTreeWidget::rowsInserted(const QModelIndex &parent, int start, int end)
|
2014-10-21 11:57:46 +02:00
|
|
|
{
|
2019-08-15 16:59:12 +02:00
|
|
|
if (m_delayedRename.isEmpty())
|
|
|
|
|
return;
|
2015-04-22 11:36:51 +02:00
|
|
|
Node *node = m_model->nodeForIndex(parent);
|
2015-10-28 09:16:40 +02:00
|
|
|
QTC_ASSERT(node, return);
|
2019-08-15 16:59:12 +02:00
|
|
|
for (int i = start; i <= end && !m_delayedRename.isEmpty(); ++i) {
|
2014-11-19 17:58:33 +01:00
|
|
|
QModelIndex idx = m_model->index(i, 0, parent);
|
|
|
|
|
Node *n = m_model->nodeForIndex(idx);
|
2019-08-15 16:59:12 +02:00
|
|
|
if (!n)
|
|
|
|
|
continue;
|
|
|
|
|
const int renameIdx = m_delayedRename.indexOf(n->filePath());
|
|
|
|
|
if (renameIdx != -1) {
|
2014-11-19 17:58:33 +01:00
|
|
|
m_view->setCurrentIndex(idx);
|
2019-08-15 16:59:12 +02:00
|
|
|
m_delayedRename.removeAt(renameIdx);
|
2014-11-19 17:58:33 +01:00
|
|
|
}
|
|
|
|
|
}
|
2014-10-21 11:57:46 +02:00
|
|
|
}
|
|
|
|
|
|
2019-05-28 13:49:26 +02:00
|
|
|
Node *ProjectTreeWidget::nodeForFile(const FilePath &fileName)
|
2015-03-03 15:11:01 +01:00
|
|
|
{
|
2020-02-04 23:40:55 +02:00
|
|
|
if (fileName.isEmpty())
|
|
|
|
|
return nullptr;
|
2017-03-06 18:03:43 +01:00
|
|
|
Node *bestNode = nullptr;
|
2014-07-03 15:46:54 +02:00
|
|
|
int bestNodeExpandCount = INT_MAX;
|
|
|
|
|
|
2019-03-01 11:02:29 +01:00
|
|
|
// FIXME: Looks like this could be done with less cycles.
|
2017-03-17 12:26:00 +01:00
|
|
|
for (Project *project : SessionManager::projects()) {
|
|
|
|
|
if (ProjectNode *projectNode = project->rootProjectNode()) {
|
|
|
|
|
projectNode->forEachGenericNode([&](Node *node) {
|
|
|
|
|
if (node->filePath() == fileName) {
|
2021-01-12 12:09:07 +01:00
|
|
|
if (!bestNode || node->priority() < bestNode->priority()) {
|
2017-03-17 12:26:00 +01:00
|
|
|
bestNode = node;
|
|
|
|
|
bestNodeExpandCount = ProjectTreeWidget::expandedCount(node);
|
2021-01-12 12:09:07 +01:00
|
|
|
} else if (node->priority() == bestNode->priority()) {
|
2017-03-17 12:26:00 +01:00
|
|
|
int nodeExpandCount = ProjectTreeWidget::expandedCount(node);
|
|
|
|
|
if (nodeExpandCount < bestNodeExpandCount) {
|
|
|
|
|
bestNode = node;
|
|
|
|
|
bestNodeExpandCount = ProjectTreeWidget::expandedCount(node);
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-03-06 18:03:43 +01:00
|
|
|
}
|
2017-03-17 12:26:00 +01:00
|
|
|
});
|
2014-07-03 15:46:54 +02:00
|
|
|
}
|
2017-03-17 12:26:00 +01:00
|
|
|
}
|
2017-03-06 18:03:43 +01:00
|
|
|
|
2014-07-03 15:46:54 +02:00
|
|
|
return bestNode;
|
2008-12-11 14:35:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QToolButton *ProjectTreeWidget::toggleSync()
|
|
|
|
|
{
|
|
|
|
|
return m_toggleSync;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ProjectTreeWidget::toggleAutoSynchronization()
|
|
|
|
|
{
|
|
|
|
|
setAutoSynchronization(!m_autoSync);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool ProjectTreeWidget::autoSynchronization() const
|
|
|
|
|
{
|
|
|
|
|
return m_autoSync;
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-19 17:58:33 +01:00
|
|
|
void ProjectTreeWidget::setAutoSynchronization(bool sync)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2008-12-11 14:35:14 +01:00
|
|
|
m_toggleSync->setChecked(sync);
|
2008-12-02 12:01:29 +01:00
|
|
|
if (sync == m_autoSync)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
m_autoSync = sync;
|
|
|
|
|
|
|
|
|
|
if (debug)
|
|
|
|
|
qDebug() << (m_autoSync ? "Enabling auto synchronization" : "Disabling auto synchronization");
|
2014-11-19 17:58:33 +01:00
|
|
|
|
2018-01-26 12:45:55 +01:00
|
|
|
if (m_autoSync)
|
|
|
|
|
syncFromDocumentManager();
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2020-02-18 18:03:22 +01:00
|
|
|
void ProjectTreeWidget::expandNodeRecursively(const QModelIndex &index)
|
|
|
|
|
{
|
|
|
|
|
const int rc = index.model()->rowCount(index);
|
|
|
|
|
for (int i = 0; i < rc; ++i)
|
|
|
|
|
expandNodeRecursively(index.model()->index(i, index.column(), index));
|
|
|
|
|
if (rc > 0)
|
|
|
|
|
m_view->expand(index);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ProjectTreeWidget::expandCurrentNodeRecursively()
|
|
|
|
|
{
|
|
|
|
|
expandNodeRecursively(m_view->currentIndex());
|
|
|
|
|
}
|
|
|
|
|
|
2011-07-13 11:52:14 +02:00
|
|
|
void ProjectTreeWidget::collapseAll()
|
|
|
|
|
{
|
|
|
|
|
m_view->collapseAll();
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-16 13:12:12 +01:00
|
|
|
void ProjectTreeWidget::expandAll()
|
|
|
|
|
{
|
|
|
|
|
m_view->expandAll();
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
void ProjectTreeWidget::editCurrentItem()
|
|
|
|
|
{
|
2014-11-19 17:58:33 +01:00
|
|
|
m_delayedRename.clear();
|
2018-03-07 13:09:28 +03:00
|
|
|
const QModelIndex currentIndex = m_view->selectionModel()->currentIndex();
|
|
|
|
|
if (!currentIndex.isValid())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
m_view->edit(currentIndex);
|
2018-03-08 02:04:34 +03:00
|
|
|
// Select complete file basename for renaming
|
|
|
|
|
const Node *node = m_model->nodeForIndex(currentIndex);
|
2018-06-12 14:06:13 +02:00
|
|
|
if (!node)
|
2018-03-08 02:04:34 +03:00
|
|
|
return;
|
2018-07-12 22:17:17 +02:00
|
|
|
auto *editor = qobject_cast<QLineEdit*>(m_view->indexWidget(currentIndex));
|
2018-03-08 02:04:34 +03:00
|
|
|
if (!editor)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
const QString text = editor->text();
|
2020-12-16 10:27:49 +01:00
|
|
|
const int dotIndex = text.lastIndexOf('.');
|
2018-03-08 02:04:34 +03:00
|
|
|
if (dotIndex > 0)
|
|
|
|
|
editor->setSelection(0, dotIndex);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2019-05-28 13:49:26 +02:00
|
|
|
void ProjectTreeWidget::renamed(const FilePath &oldPath, const FilePath &newPath)
|
2014-11-19 17:58:33 +01:00
|
|
|
{
|
2017-01-19 14:54:23 +01:00
|
|
|
update();
|
2019-07-23 10:58:00 +02:00
|
|
|
Q_UNUSED(oldPath)
|
2015-10-29 17:53:47 +01:00
|
|
|
if (!currentNode() || currentNode()->filePath() != newPath) {
|
2014-11-19 17:58:33 +01:00
|
|
|
// try to find the node
|
|
|
|
|
Node *node = nodeForFile(newPath);
|
|
|
|
|
if (node)
|
|
|
|
|
m_view->setCurrentIndex(m_model->indexForNode(node));
|
|
|
|
|
else
|
2019-08-15 16:59:12 +02:00
|
|
|
m_delayedRename << newPath;
|
2014-11-19 17:58:33 +01:00
|
|
|
}
|
|
|
|
|
}
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2018-01-26 12:45:55 +01:00
|
|
|
void ProjectTreeWidget::syncFromDocumentManager()
|
|
|
|
|
{
|
|
|
|
|
// sync from document manager
|
2019-05-28 13:49:26 +02:00
|
|
|
FilePath fileName;
|
2018-01-26 12:45:55 +01:00
|
|
|
if (IDocument *doc = EditorManager::currentDocument())
|
|
|
|
|
fileName = doc->filePath();
|
|
|
|
|
if (!currentNode() || currentNode()->filePath() != fileName)
|
|
|
|
|
setCurrentItem(ProjectTreeWidget::nodeForFile(fileName));
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-19 17:58:33 +01:00
|
|
|
void ProjectTreeWidget::setCurrentItem(Node *node)
|
|
|
|
|
{
|
2008-12-02 12:01:29 +01:00
|
|
|
const QModelIndex mainIndex = m_model->indexForNode(node);
|
|
|
|
|
|
2013-02-06 23:05:34 +02:00
|
|
|
if (mainIndex.isValid()) {
|
|
|
|
|
if (mainIndex != m_view->selectionModel()->currentIndex()) {
|
2018-01-26 12:45:55 +01:00
|
|
|
// Expand everything between the index and the root index!
|
|
|
|
|
QModelIndex parent = mainIndex.parent();
|
|
|
|
|
while (parent.isValid()) {
|
|
|
|
|
m_view->setExpanded(parent, true);
|
|
|
|
|
parent = parent.parent();
|
|
|
|
|
}
|
2013-02-06 23:05:34 +02:00
|
|
|
m_view->setCurrentIndex(mainIndex);
|
|
|
|
|
m_view->scrollTo(mainIndex);
|
|
|
|
|
}
|
2009-01-20 17:06:46 +01:00
|
|
|
} else {
|
|
|
|
|
m_view->clearSelection();
|
2021-01-12 10:55:28 +01:00
|
|
|
m_view->setCurrentIndex({});
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ProjectTreeWidget::handleCurrentItemChange(const QModelIndex ¤t)
|
|
|
|
|
{
|
2019-07-23 10:58:00 +02:00
|
|
|
Q_UNUSED(current)
|
2014-11-19 17:58:33 +01:00
|
|
|
ProjectTree::nodeChanged(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Node *ProjectTreeWidget::currentNode()
|
|
|
|
|
{
|
|
|
|
|
return m_model->nodeForIndex(m_view->currentIndex());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ProjectTreeWidget::sync(Node *node)
|
|
|
|
|
{
|
|
|
|
|
if (m_autoSync)
|
|
|
|
|
setCurrentItem(node);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2015-08-20 14:47:02 +02:00
|
|
|
void ProjectTreeWidget::showMessage(Node *node, const QString &message)
|
|
|
|
|
{
|
|
|
|
|
QModelIndex idx = m_model->indexForNode(node);
|
|
|
|
|
m_view->setCurrentIndex(idx);
|
|
|
|
|
m_view->scrollTo(idx);
|
|
|
|
|
|
|
|
|
|
QPoint pos = m_view->mapToGlobal(m_view->visualRect(idx).bottomLeft());
|
2017-07-21 11:47:27 +02:00
|
|
|
pos -= ToolTip::offsetFromPosition();
|
|
|
|
|
ToolTip::show(pos, message);
|
2015-08-20 14:47:02 +02:00
|
|
|
}
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
void ProjectTreeWidget::showContextMenu(const QPoint &pos)
|
|
|
|
|
{
|
|
|
|
|
QModelIndex index = m_view->indexAt(pos);
|
|
|
|
|
Node *node = m_model->nodeForIndex(index);
|
2015-01-13 15:50:37 +01:00
|
|
|
ProjectTree::showContextMenu(this, m_view->mapToGlobal(pos), node);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ProjectTreeWidget::openItem(const QModelIndex &mainIndex)
|
|
|
|
|
{
|
|
|
|
|
Node *node = m_model->nodeForIndex(mainIndex);
|
2019-02-28 17:19:18 +01:00
|
|
|
if (!node || !node->asFileNode())
|
2013-01-30 18:13:46 +01:00
|
|
|
return;
|
2015-10-29 17:53:47 +01:00
|
|
|
IEditor *editor = EditorManager::openEditor(node->filePath().toString());
|
2013-08-06 14:55:38 +02:00
|
|
|
if (editor && node->line() >= 0)
|
2013-01-30 18:13:46 +01:00
|
|
|
editor->gotoLine(node->line());
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ProjectTreeWidget::setProjectFilter(bool filter)
|
|
|
|
|
{
|
|
|
|
|
m_model->setProjectFilterEnabled(filter);
|
|
|
|
|
m_filterProjectsAction->setChecked(filter);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ProjectTreeWidget::setGeneratedFilesFilter(bool filter)
|
|
|
|
|
{
|
|
|
|
|
m_model->setGeneratedFilesFilterEnabled(filter);
|
|
|
|
|
m_filterGeneratedFilesAction->setChecked(filter);
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-22 13:42:21 +02:00
|
|
|
void ProjectTreeWidget::setDisabledFilesFilter(bool filter)
|
|
|
|
|
{
|
|
|
|
|
m_model->setDisabledFilesFilterEnabled(filter);
|
|
|
|
|
m_filterDisabledFilesAction->setChecked(filter);
|
|
|
|
|
}
|
|
|
|
|
|
2017-08-02 17:02:02 +02:00
|
|
|
void ProjectTreeWidget::setTrimEmptyDirectories(bool filter)
|
|
|
|
|
{
|
|
|
|
|
m_model->setTrimEmptyDirectories(filter);
|
|
|
|
|
m_trimEmptyDirectoriesAction->setChecked(filter);
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-11 14:35:14 +01:00
|
|
|
bool ProjectTreeWidget::generatedFilesFilter()
|
|
|
|
|
{
|
|
|
|
|
return m_model->generatedFilesFilterEnabled();
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-22 13:42:21 +02:00
|
|
|
bool ProjectTreeWidget::disabledFilesFilter()
|
|
|
|
|
{
|
|
|
|
|
return m_model->disabledFilesFilterEnabled();
|
|
|
|
|
}
|
|
|
|
|
|
2019-06-13 11:44:57 +02:00
|
|
|
bool ProjectTreeWidget::trimEmptyDirectoriesFilter()
|
|
|
|
|
{
|
|
|
|
|
return m_model->trimEmptyDirectoriesEnabled();
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-11 14:35:14 +01:00
|
|
|
bool ProjectTreeWidget::projectFilter()
|
|
|
|
|
{
|
|
|
|
|
return m_model->projectFilterEnabled();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-01-20 17:14:00 +01:00
|
|
|
ProjectTreeWidgetFactory::ProjectTreeWidgetFactory()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2014-06-24 11:15:32 +02:00
|
|
|
setDisplayName(tr("Projects"));
|
|
|
|
|
setPriority(100);
|
2015-08-20 14:47:02 +02:00
|
|
|
setId(ProjectExplorer::Constants::PROJECTTREE_ID);
|
2018-02-02 13:39:18 +01:00
|
|
|
setActivationSequence(QKeySequence(useMacShortcuts ? tr("Meta+X") : tr("Alt+X")));
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2013-01-10 20:18:41 +02:00
|
|
|
NavigationView ProjectTreeWidgetFactory::createWidget()
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2013-01-10 20:18:41 +02:00
|
|
|
NavigationView n;
|
2016-04-13 15:52:14 +02:00
|
|
|
auto ptw = new ProjectTreeWidget;
|
2008-12-02 12:01:29 +01:00
|
|
|
n.widget = ptw;
|
|
|
|
|
|
2020-01-23 12:11:59 +01:00
|
|
|
auto filter = new QToolButton(ptw);
|
2017-07-21 11:47:27 +02:00
|
|
|
filter->setIcon(Icons::FILTER.icon());
|
2010-09-28 17:29:05 +02:00
|
|
|
filter->setToolTip(tr("Filter Tree"));
|
2008-12-02 12:01:29 +01:00
|
|
|
filter->setPopupMode(QToolButton::InstantPopup);
|
2012-02-01 21:39:05 +01:00
|
|
|
filter->setProperty("noArrow", true);
|
2016-04-13 15:52:14 +02:00
|
|
|
auto filterMenu = new QMenu(filter);
|
2008-12-02 12:01:29 +01:00
|
|
|
filterMenu->addAction(ptw->m_filterProjectsAction);
|
|
|
|
|
filterMenu->addAction(ptw->m_filterGeneratedFilesAction);
|
2019-10-22 13:42:21 +02:00
|
|
|
filterMenu->addAction(ptw->m_filterDisabledFilesAction);
|
2017-08-02 17:02:02 +02:00
|
|
|
filterMenu->addAction(ptw->m_trimEmptyDirectoriesAction);
|
2008-12-02 12:01:29 +01:00
|
|
|
filter->setMenu(filterMenu);
|
|
|
|
|
|
2009-10-09 17:41:09 +02:00
|
|
|
n.dockToolBarWidgets << filter << ptw->toggleSync();
|
2008-12-02 12:01:29 +01:00
|
|
|
return n;
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-14 17:00:53 +01:00
|
|
|
const bool kProjectFilterDefault = false;
|
|
|
|
|
const bool kHideGeneratedFilesDefault = true;
|
|
|
|
|
const bool kHideDisabledFilesDefault = false;
|
|
|
|
|
const bool kTrimEmptyDirsDefault = true;
|
|
|
|
|
const bool kSyncDefault = true;
|
2020-12-16 10:27:49 +01:00
|
|
|
const char kBaseKey[] = "ProjectTreeWidget.";
|
|
|
|
|
const char kProjectFilterKey[] = ".ProjectFilter";
|
|
|
|
|
const char kHideGeneratedFilesKey[] = ".GeneratedFilter";
|
|
|
|
|
const char kHideDisabledFilesKey[] = ".DisabledFilesFilter";
|
|
|
|
|
const char kTrimEmptyDirsKey[] = ".TrimEmptyDirsFilter";
|
|
|
|
|
const char kSyncKey[] = ".SyncWithEditor";
|
2020-12-14 17:00:53 +01:00
|
|
|
|
|
|
|
|
void ProjectTreeWidgetFactory::saveSettings(QtcSettings *settings, int position, QWidget *widget)
|
2008-12-11 14:35:14 +01:00
|
|
|
{
|
2016-04-13 15:52:14 +02:00
|
|
|
auto ptw = qobject_cast<ProjectTreeWidget *>(widget);
|
2008-12-11 14:35:14 +01:00
|
|
|
Q_ASSERT(ptw);
|
2020-12-16 10:27:49 +01:00
|
|
|
const QString baseKey = kBaseKey + QString::number(position);
|
|
|
|
|
settings->setValueWithDefault(baseKey + kProjectFilterKey,
|
2020-12-14 17:00:53 +01:00
|
|
|
ptw->projectFilter(),
|
|
|
|
|
kProjectFilterDefault);
|
2020-12-16 10:27:49 +01:00
|
|
|
settings->setValueWithDefault(baseKey + kHideGeneratedFilesKey,
|
2020-12-14 17:00:53 +01:00
|
|
|
ptw->generatedFilesFilter(),
|
|
|
|
|
kHideGeneratedFilesDefault);
|
2020-12-16 10:27:49 +01:00
|
|
|
settings->setValueWithDefault(baseKey + kHideDisabledFilesKey,
|
2020-12-14 17:00:53 +01:00
|
|
|
ptw->disabledFilesFilter(),
|
|
|
|
|
kHideDisabledFilesDefault);
|
2020-12-16 10:27:49 +01:00
|
|
|
settings->setValueWithDefault(baseKey + kTrimEmptyDirsKey,
|
2020-12-14 17:00:53 +01:00
|
|
|
ptw->trimEmptyDirectoriesFilter(),
|
|
|
|
|
kTrimEmptyDirsDefault);
|
2020-12-16 10:27:49 +01:00
|
|
|
settings->setValueWithDefault(baseKey + kSyncKey, ptw->autoSynchronization(), kSyncDefault);
|
2008-12-11 14:35:14 +01:00
|
|
|
}
|
|
|
|
|
|
2016-09-17 18:31:56 +03:00
|
|
|
void ProjectTreeWidgetFactory::restoreSettings(QSettings *settings, int position, QWidget *widget)
|
2008-12-11 14:35:14 +01:00
|
|
|
{
|
2016-04-13 15:52:14 +02:00
|
|
|
auto ptw = qobject_cast<ProjectTreeWidget *>(widget);
|
2008-12-11 14:35:14 +01:00
|
|
|
Q_ASSERT(ptw);
|
2020-12-16 10:27:49 +01:00
|
|
|
const QString baseKey = kBaseKey + QString::number(position);
|
2020-12-14 17:00:53 +01:00
|
|
|
ptw->setProjectFilter(
|
2020-12-16 10:27:49 +01:00
|
|
|
settings->value(baseKey + kProjectFilterKey, kProjectFilterDefault).toBool());
|
2020-12-14 17:00:53 +01:00
|
|
|
ptw->setGeneratedFilesFilter(
|
2020-12-16 10:27:49 +01:00
|
|
|
settings->value(baseKey + kHideGeneratedFilesKey, kHideGeneratedFilesDefault).toBool());
|
2020-12-14 17:00:53 +01:00
|
|
|
ptw->setDisabledFilesFilter(
|
2020-12-16 10:27:49 +01:00
|
|
|
settings->value(baseKey + kHideDisabledFilesKey, kHideDisabledFilesDefault).toBool());
|
2020-12-14 17:00:53 +01:00
|
|
|
ptw->setTrimEmptyDirectories(
|
2020-12-16 10:27:49 +01:00
|
|
|
settings->value(baseKey + kTrimEmptyDirsKey, kTrimEmptyDirsDefault).toBool());
|
|
|
|
|
ptw->setAutoSynchronization(settings->value(baseKey + kSyncKey, kSyncDefault).toBool());
|
2008-12-11 14:35:14 +01:00
|
|
|
}
|