CppEditor: Introduce QuickFix settings and unify getter/setter generation

Introduces a QuickFix settings page where the generation of getters and
setters can be customized. The settings can be saved into a file that can
go into a VCS. All QuickFixes that generate getter/setter/signals/
Q_PROPERTIES now use the same backend. QuickFixes that generate getters/
setters are now extended to also generate signals and Q_PROPERTIES.

Fixes: QTCREATORBUG-1532
Fixes: QTCREATORBUG-17941
Fixes: QTCREATORBUG-12678
Fixes: QTCREATORBUG-15779
Fixes: QTCREATORBUG-11620
Fixes: QTCREATORBUG-22707
Fixes: QTCREATORBUG-20157
Fixes: QTCREATORBUG-21804
Fixes: QTCREATORBUG-19814
Fixes: QTCREATORBUG-14622
Fixes: QTCREATORBUG-19803
Change-Id: I50ed2dad9b4a637fbd87b3e1f2856060ad0ad920
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Leander Schulten
2020-08-20 00:33:24 +02:00
parent 7c58a4ac5b
commit 5b5ae97104
24 changed files with 5370 additions and 1698 deletions

View File

@@ -29,13 +29,15 @@
#include "cppcodemodelinspectordialog.h"
#include "cppeditor.h"
#include "cppeditorconstants.h"
#include "cppeditorwidget.h"
#include "cppeditordocument.h"
#include "cppeditorwidget.h"
#include "cpphighlighter.h"
#include "cppincludehierarchy.h"
#include "cppoutline.h"
#include "cppquickfixassistant.h"
#include "cppquickfixes.h"
#include "cppquickfixprojectsettingswidget.h"
#include "cppquickfixsettingspage.h"
#include "cpptypehierarchy.h"
#include "resourcepreviewhoverhandler.h"
@@ -56,10 +58,11 @@
#include <coreplugin/progressmanager/progressmanager.h>
#include <cpptools/cpphoverhandler.h>
#include <cpptools/cpptoolsconstants.h>
#include <texteditor/texteditoractionhandler.h>
#include <texteditor/texteditorconstants.h>
#include <projectexplorer/projectpanelfactory.h>
#include <texteditor/colorpreviewhoverhandler.h>
#include <texteditor/snippets/snippetprovider.h>
#include <texteditor/texteditoractionhandler.h>
#include <texteditor/texteditorconstants.h>
#include <utils/hostosinfo.h>
#include <utils/mimetypes/mimedatabase.h>
@@ -124,6 +127,7 @@ public:
QAction *m_openIncludeHierarchyAction = nullptr;
CppQuickFixAssistProvider m_quickFixProvider;
CppQuickFixSettingsPage m_quickFixSettingsPage;
QPointer<CppCodeModelInspectorDialog> m_cppCodeModelInspectorDialog;
@@ -164,6 +168,16 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
{
Q_UNUSED(errorMessage)
auto panelFactory = new ProjectExplorer::ProjectPanelFactory;
panelFactory->setPriority(100);
panelFactory->setId(Constants::QUICK_FIX_PROJECT_PANEL_ID);
panelFactory->setDisplayName(
QCoreApplication::translate("CppTools", Constants::QUICK_FIX_SETTINGS_DISPLAY_NAME));
panelFactory->setCreateWidgetFunction([](ProjectExplorer::Project *project) {
return new CppQuickFixProjectSettingsWidget(project);
});
ProjectExplorer::ProjectPanelFactory::registerFactory(panelFactory);
d = new CppEditorPluginPrivate;
SnippetProvider::registerGroup(Constants::CPP_SNIPPETS_GROUP_ID, tr("C++", "SnippetProvider"),