forked from qt-creator/qt-creator
ClangTools: Polish ClangDiagnosticConfigsWidget
* Improve distinction between built-in and custom configs by introducing corresponding parent nodes * Add button to rename a config * Make closing the dialog apply the selected config. * Adapt also the related ClangDiagnosticConfigsSelectionWidget showing a combo box of the diagnostic configs and a "Manage..." button: Remove the combo box and show the current config as the button text. Change-Id: Ic015df37f2532f84bd7da6cd20bfce07799a97b8 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -28,7 +28,6 @@
|
||||
#include "cpptools_global.h"
|
||||
|
||||
#include "clangdiagnosticconfig.h"
|
||||
#include "clangdiagnosticconfigsmodel.h"
|
||||
|
||||
#include <QHash>
|
||||
#include <QWidget>
|
||||
@@ -49,6 +48,7 @@ class ClazyChecks;
|
||||
class TidyChecks;
|
||||
}
|
||||
|
||||
class ConfigsModel;
|
||||
class TidyChecksTreeModel;
|
||||
class ClazyChecksTreeModel;
|
||||
class ClazyChecksSortFilterModel;
|
||||
@@ -58,22 +58,20 @@ class CPPTOOLS_EXPORT ClangDiagnosticConfigsWidget : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ClangDiagnosticConfigsWidget(const ClangDiagnosticConfigsModel &configsModel,
|
||||
explicit ClangDiagnosticConfigsWidget(const ClangDiagnosticConfigs &configs,
|
||||
const Core::Id &configToSelect,
|
||||
bool showTidyClazyTabs,
|
||||
QWidget *parent = nullptr);
|
||||
~ClangDiagnosticConfigsWidget() override;
|
||||
|
||||
ClangDiagnosticConfigs customConfigs() const;
|
||||
|
||||
signals:
|
||||
void customConfigsChanged(const CppTools::ClangDiagnosticConfigs &customConfigs);
|
||||
ClangDiagnosticConfigs configs() const;
|
||||
const ClangDiagnosticConfig currentConfig() const;
|
||||
|
||||
private:
|
||||
void setupTabs(bool showTidyClazyTabs);
|
||||
|
||||
void onCurrentConfigChanged(int index);
|
||||
void onCopyButtonClicked();
|
||||
void onRenameButtonClicked();
|
||||
void onRemoveButtonClicked();
|
||||
void onClangTidyModeChanged(int index);
|
||||
void onClangTidyTreeChanged();
|
||||
@@ -82,9 +80,7 @@ private:
|
||||
|
||||
void onClangOnlyOptionsChanged();
|
||||
|
||||
void syncWidgetsToModel(const Core::Id &configToSelect = Core::Id());
|
||||
void syncConfigChooserToModel(const Core::Id &configToSelect = Core::Id());
|
||||
void syncOtherWidgetsToComboBox();
|
||||
void syncToConfigsView();
|
||||
void syncClangTidyWidgets(const ClangDiagnosticConfig &config);
|
||||
void syncClazyWidgets(const ClangDiagnosticConfig &config);
|
||||
void syncClazyChecksGroupBox();
|
||||
@@ -92,10 +88,6 @@ private:
|
||||
|
||||
void updateConfig(const CppTools::ClangDiagnosticConfig &config);
|
||||
|
||||
bool isConfigChooserEmpty() const;
|
||||
const ClangDiagnosticConfig &selectedConfig() const;
|
||||
Core::Id selectedConfigId() const;
|
||||
|
||||
void setDiagnosticOptions(const QString &options);
|
||||
void updateValidityWidgets(const QString &errorMessage);
|
||||
|
||||
@@ -105,14 +97,12 @@ private:
|
||||
void connectClazyItemChanged();
|
||||
void disconnectClazyItemChanged();
|
||||
|
||||
void connectConfigChooserCurrentIndex();
|
||||
void disconnectConfigChooserCurrentIndex();
|
||||
void connectClangOnlyOptionsChanged();
|
||||
void disconnectClangOnlyOptionsChanged();
|
||||
|
||||
private:
|
||||
Ui::ClangDiagnosticConfigsWidget *m_ui;
|
||||
ClangDiagnosticConfigsModel m_diagnosticConfigsModel;
|
||||
ConfigsModel *m_configsModel = nullptr;
|
||||
QHash<Core::Id, QString> m_notAcceptedOptions;
|
||||
|
||||
std::unique_ptr<CppTools::Ui::ClangBaseChecks> m_clangBaseChecks;
|
||||
@@ -126,8 +116,6 @@ private:
|
||||
std::unique_ptr<CppTools::Ui::TidyChecks> m_tidyChecks;
|
||||
QWidget *m_tidyChecksWidget = nullptr;
|
||||
std::unique_ptr<TidyChecksTreeModel> m_tidyTreeModel;
|
||||
|
||||
int m_selectedConfigIndex = 0;
|
||||
};
|
||||
|
||||
} // CppTools namespace
|
||||
|
||||
Reference in New Issue
Block a user