2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 Przemyslaw Gorszkowski <pgorszkowski@gmail.com>
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2013-08-13 22:58:38 +02:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2013-08-13 22:58:38 +02:00
|
|
|
|
|
|
|
|
#include <coreplugin/inavigationwidgetfactory.h>
|
2016-07-26 10:52:03 +02:00
|
|
|
#include <utils/treemodel.h>
|
2013-08-13 22:58:38 +02:00
|
|
|
|
2016-07-26 10:52:03 +02:00
|
|
|
#include <QSet>
|
2013-08-13 22:58:38 +02:00
|
|
|
|
|
|
|
|
namespace CppEditor {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2016-07-26 10:52:03 +02:00
|
|
|
class CppIncludeHierarchyItem;
|
2013-08-13 22:58:38 +02:00
|
|
|
|
2016-08-05 11:59:28 +03:00
|
|
|
class CppIncludeHierarchyModel : public Utils::TreeModel<CppIncludeHierarchyItem>
|
2013-08-13 22:58:38 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
2019-02-07 11:04:13 +01:00
|
|
|
using base_type = Utils::TreeModel<CppIncludeHierarchyItem>;
|
2013-08-13 22:58:38 +02:00
|
|
|
|
2016-07-26 10:52:03 +02:00
|
|
|
public:
|
|
|
|
|
CppIncludeHierarchyModel();
|
2013-08-13 22:58:38 +02:00
|
|
|
|
2016-07-26 10:52:03 +02:00
|
|
|
Qt::DropActions supportedDragActions() const override;
|
|
|
|
|
QStringList mimeTypes() const override;
|
|
|
|
|
QMimeData *mimeData(const QModelIndexList &indexes) const override;
|
2013-08-13 22:58:38 +02:00
|
|
|
|
2016-07-26 10:52:03 +02:00
|
|
|
void buildHierarchy(const QString &filePath);
|
|
|
|
|
QString editorFilePath() const { return m_editorFilePath; }
|
|
|
|
|
void setSearching(bool on);
|
|
|
|
|
QString toString() const;
|
2013-08-13 22:58:38 +02:00
|
|
|
|
2016-08-05 11:59:28 +03:00
|
|
|
#if WITH_TESTS
|
|
|
|
|
using base_type::canFetchMore;
|
|
|
|
|
using base_type::fetchMore;
|
|
|
|
|
#endif
|
2013-08-13 22:58:38 +02:00
|
|
|
|
|
|
|
|
private:
|
2016-07-26 10:52:03 +02:00
|
|
|
friend class CppIncludeHierarchyItem;
|
|
|
|
|
QString m_editorFilePath;
|
|
|
|
|
QSet<QString> m_seen;
|
|
|
|
|
bool m_searching = false;
|
2013-08-13 22:58:38 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class CppIncludeHierarchyFactory : public Core::INavigationWidgetFactory
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
2016-07-26 10:52:03 +02:00
|
|
|
|
2013-08-13 22:58:38 +02:00
|
|
|
public:
|
|
|
|
|
CppIncludeHierarchyFactory();
|
|
|
|
|
|
2016-07-26 10:52:03 +02:00
|
|
|
Core::NavigationView createWidget() override;
|
2020-12-14 17:00:53 +01:00
|
|
|
void saveSettings(Utils::QtcSettings *settings, int position, QWidget *widget) override;
|
2018-09-16 21:34:32 +02:00
|
|
|
void restoreSettings(QSettings *settings, int position, QWidget *widget) override;
|
2013-08-13 22:58:38 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace CppEditor
|