ClassView: Move setup of Manager class closer to new pattern

Change-Id: I2b836b839b1b082bdb6507082f689e2ef114eb9c
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2024-01-09 17:57:30 +01:00
parent 3873947c00
commit e87cd355d3
3 changed files with 13 additions and 17 deletions

View File

@@ -404,4 +404,9 @@ void Manager::setFlatMode(bool flat)
}, Qt::QueuedConnection); }, Qt::QueuedConnection);
} }
void setupClassViewManager(QObject *guard)
{
(void) new Manager(guard);
}
} // ClassView::Internal } // ClassView::Internal

View File

@@ -13,12 +13,13 @@ namespace ClassView::Internal {
class ManagerPrivate; class ManagerPrivate;
class Manager : public QObject class Manager final : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit Manager(QObject *parent = nullptr); explicit Manager(QObject *parent);
~Manager() override; ~Manager() final;
static Manager *instance(); static Manager *instance();
bool canFetchMore(QStandardItem *item, bool skipRoot = false) const; bool canFetchMore(QStandardItem *item, bool skipRoot = false) const;
@@ -42,4 +43,6 @@ private:
ManagerPrivate *d; ManagerPrivate *d;
}; };
void setupClassViewManager(QObject *guard);
} // ClassView::Internal } // ClassView::Internal

View File

@@ -19,24 +19,12 @@ namespace Internal {
projects in the sidebar. projects in the sidebar.
*/ */
class ClassViewPluginPrivate ClassViewPlugin::~ClassViewPlugin() = default;
{
public:
Manager manager;
};
static ClassViewPluginPrivate *dd = nullptr;
ClassViewPlugin::~ClassViewPlugin()
{
delete dd;
dd = nullptr;
}
void ClassViewPlugin::initialize() void ClassViewPlugin::initialize()
{ {
setupClassViewNavigationWidgetFactory(); setupClassViewNavigationWidgetFactory();
dd = new ClassViewPluginPrivate; setupClassViewManager(this);
} }
} // namespace Internal } // namespace Internal