forked from qt-creator/qt-creator
Squish: Use new setup pattern for SquishNavigationWidgetFactory
Change-Id: I44ac6a84f68b9b1fb22d9906921647e13d78de19 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/find/itemviewfind.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/inavigationwidgetfactory.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/checkablemessagebox.h>
|
||||
@@ -30,12 +31,12 @@ namespace Squish::Internal {
|
||||
|
||||
const int defaultSectionSize = 17;
|
||||
|
||||
class SquishNavigationWidget : public QWidget
|
||||
class SquishNavigationWidget final : public QWidget
|
||||
{
|
||||
public:
|
||||
explicit SquishNavigationWidget(QWidget *parent = nullptr);
|
||||
~SquishNavigationWidget() override;
|
||||
void contextMenuEvent(QContextMenuEvent *event) override;
|
||||
SquishNavigationWidget();
|
||||
|
||||
void contextMenuEvent(QContextMenuEvent *event) final;
|
||||
static QList<QToolButton *> createToolButtons();
|
||||
|
||||
private:
|
||||
@@ -54,9 +55,7 @@ private:
|
||||
SquishTestTreeSortModel *m_sortModel;
|
||||
};
|
||||
|
||||
|
||||
SquishNavigationWidget::SquishNavigationWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
SquishNavigationWidget::SquishNavigationWidget()
|
||||
{
|
||||
setWindowTitle(Tr::tr("Squish"));
|
||||
m_view = new SquishTestTreeView(this);
|
||||
@@ -105,8 +104,6 @@ SquishNavigationWidget::SquishNavigationWidget(QWidget *parent)
|
||||
});
|
||||
}
|
||||
|
||||
SquishNavigationWidget::~SquishNavigationWidget() {}
|
||||
|
||||
void SquishNavigationWidget::contextMenuEvent(QContextMenuEvent *event)
|
||||
{
|
||||
QMenu menu;
|
||||
@@ -356,20 +353,29 @@ void SquishNavigationWidget::onNewTestCaseTriggered(const QModelIndex &index)
|
||||
m_view->edit(m_sortModel->mapFromSource(added));
|
||||
}
|
||||
|
||||
SquishNavigationWidgetFactory::SquishNavigationWidgetFactory()
|
||||
class SquishNavigationWidgetFactory final : public Core::INavigationWidgetFactory
|
||||
{
|
||||
setDisplayName(Tr::tr("Squish"));
|
||||
setId(Squish::Constants::SQUISH_ID);
|
||||
setPriority(777);
|
||||
}
|
||||
public:
|
||||
SquishNavigationWidgetFactory()
|
||||
{
|
||||
setDisplayName(Tr::tr("Squish"));
|
||||
setId(Squish::Constants::SQUISH_ID);
|
||||
setPriority(777);
|
||||
}
|
||||
|
||||
Core::NavigationView SquishNavigationWidgetFactory::createWidget()
|
||||
Core::NavigationView createWidget() final
|
||||
{
|
||||
SquishNavigationWidget *squishNavigationWidget = new SquishNavigationWidget;
|
||||
Core::NavigationView view;
|
||||
view.widget = squishNavigationWidget;
|
||||
view.dockToolBarWidgets = squishNavigationWidget->createToolButtons();
|
||||
return view;
|
||||
}
|
||||
};
|
||||
|
||||
void setupSquishNavigationWidgetFactory()
|
||||
{
|
||||
SquishNavigationWidget *squishNavigationWidget = new SquishNavigationWidget;
|
||||
Core::NavigationView view;
|
||||
view.widget = squishNavigationWidget;
|
||||
view.dockToolBarWidgets = squishNavigationWidget->createToolButtons();
|
||||
return view;
|
||||
static SquishNavigationWidgetFactory squishNavigationWidgetFactory;
|
||||
}
|
||||
|
||||
} // Squish::Internal
|
||||
|
@@ -3,17 +3,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <coreplugin/inavigationwidgetfactory.h>
|
||||
|
||||
namespace Squish::Internal {
|
||||
|
||||
class SquishNavigationWidgetFactory : public Core::INavigationWidgetFactory
|
||||
{
|
||||
public:
|
||||
SquishNavigationWidgetFactory();
|
||||
|
||||
private:
|
||||
Core::NavigationView createWidget() override;
|
||||
};
|
||||
void setupSquishNavigationWidgetFactory();
|
||||
|
||||
} // Squish::Internal
|
||||
|
@@ -39,7 +39,6 @@ public:
|
||||
|
||||
bool initializeGlobalScripts();
|
||||
|
||||
SquishNavigationWidgetFactory m_navigationWidgetFactory;
|
||||
ObjectsMapEditorFactory m_objectsMapEditorFactory;
|
||||
SquishOutputPane m_outputPane;
|
||||
SquishTools m_squishTools;
|
||||
@@ -109,6 +108,7 @@ private:
|
||||
d.reset(new SquishPluginPrivate);
|
||||
|
||||
setupSquishWizardPages();
|
||||
setupSquishNavigationWidgetFactory();
|
||||
|
||||
ProjectExplorer::JsonWizardFactory::addWizardPath(":/squish/wizard/");
|
||||
}
|
||||
|
Reference in New Issue
Block a user