forked from qt-creator/qt-creator
Todo: Use Qt5-style connects
The heavy lifting was done by clazy. Change-Id: I6132a266f9d350dfecd7a12b03877bdcbbc31302 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
4c09ead418
commit
a9f73d079a
@@ -35,18 +35,14 @@ namespace Internal {
|
|||||||
|
|
||||||
class CppTodoItemsScanner : public TodoItemsScanner
|
class CppTodoItemsScanner : public TodoItemsScanner
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CppTodoItemsScanner(const KeywordList &keywordList, QObject *parent = 0);
|
explicit CppTodoItemsScanner(const KeywordList &keywordList, QObject *parent = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void scannerParamsChanged();
|
void scannerParamsChanged();
|
||||||
|
|
||||||
private slots:
|
|
||||||
void documentUpdated(CPlusPlus::Document::Ptr doc);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void documentUpdated(CPlusPlus::Document::Ptr doc);
|
||||||
void processDocument(CPlusPlus::Document::Ptr doc);
|
void processDocument(CPlusPlus::Document::Ptr doc);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ KeywordDialog::KeywordDialog(const Keyword &keyword, const QSet<QString> &alread
|
|||||||
ui->keywordNameEdit->setText(keyword.name);
|
ui->keywordNameEdit->setText(keyword.name);
|
||||||
ui->errorLabel->hide();
|
ui->errorLabel->hide();
|
||||||
|
|
||||||
connect(ui->buttonBox, SIGNAL(accepted()), SLOT(acceptButtonClicked()));
|
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &KeywordDialog::acceptButtonClicked);
|
||||||
connect(ui->keywordNameEdit, SIGNAL(textChanged(QString)), ui->errorLabel, SLOT(hide()));
|
connect(ui->keywordNameEdit, &QLineEdit::textChanged, ui->errorLabel, &QWidget::hide);
|
||||||
}
|
}
|
||||||
|
|
||||||
KeywordDialog::~KeywordDialog()
|
KeywordDialog::~KeywordDialog()
|
||||||
@@ -108,7 +108,7 @@ void KeywordDialog::setupColorWidgets(const QColor &color)
|
|||||||
{
|
{
|
||||||
ui->colorButton->setColor(color);
|
ui->colorButton->setColor(color);
|
||||||
ui->colorEdit->setText(color.name());
|
ui->colorEdit->setText(color.name());
|
||||||
connect(ui->colorButton, SIGNAL(colorChanged(QColor)), SLOT(colorSelected(QColor)));
|
connect(ui->colorButton, &Utils::QtColorButton::colorChanged, this, &KeywordDialog::colorSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KeywordDialog::canAccept()
|
bool KeywordDialog::canAccept()
|
||||||
|
|||||||
@@ -47,11 +47,9 @@ public:
|
|||||||
|
|
||||||
Keyword keyword();
|
Keyword keyword();
|
||||||
|
|
||||||
private slots:
|
private:
|
||||||
void colorSelected(const QColor &color);
|
void colorSelected(const QColor &color);
|
||||||
void acceptButtonClicked();
|
void acceptButtonClicked();
|
||||||
|
|
||||||
private:
|
|
||||||
void setupListWidget(IconType selectedIcon);
|
void setupListWidget(IconType selectedIcon);
|
||||||
void setupColorWidgets(const QColor &color);
|
void setupColorWidgets(const QColor &color);
|
||||||
bool canAccept();
|
bool canAccept();
|
||||||
|
|||||||
@@ -41,11 +41,18 @@ OptionsDialog::OptionsDialog(QWidget *parent) :
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->keywordsList->setIconSize(QSize(16, 16));
|
ui->keywordsList->setIconSize(QSize(16, 16));
|
||||||
setKeywordsButtonsEnabled();
|
setKeywordsButtonsEnabled();
|
||||||
connect(ui->addKeywordButton, SIGNAL(clicked()), SLOT(addKeywordButtonClicked()));
|
connect(ui->addKeywordButton, &QAbstractButton::clicked,
|
||||||
connect(ui->removeKeywordButton, SIGNAL(clicked()), SLOT(removeKeywordButtonClicked()));
|
this, &OptionsDialog::addKeywordButtonClicked);
|
||||||
connect(ui->editKeywordButton, SIGNAL(clicked()), SLOT(editKeywordButtonClicked()));
|
connect(ui->removeKeywordButton, &QAbstractButton::clicked,
|
||||||
connect(ui->resetKeywordsButton, SIGNAL(clicked()), SLOT(resetKeywordsButtonClicked()));
|
this, &OptionsDialog::removeKeywordButtonClicked);
|
||||||
connect(ui->keywordsList, SIGNAL(itemDoubleClicked(QListWidgetItem*)), SLOT(keywordDoubleClicked(QListWidgetItem*)));
|
connect(ui->editKeywordButton, &QAbstractButton::clicked,
|
||||||
|
this, &OptionsDialog::editKeywordButtonClicked);
|
||||||
|
connect(ui->resetKeywordsButton, &QAbstractButton::clicked,
|
||||||
|
this, &OptionsDialog::resetKeywordsButtonClicked);
|
||||||
|
connect(ui->keywordsList, &QListWidget::itemDoubleClicked,
|
||||||
|
this, &OptionsDialog::keywordDoubleClicked);
|
||||||
|
connect(ui->keywordsList, &QListWidget::itemSelectionChanged,
|
||||||
|
this, &OptionsDialog::setKeywordsButtonsEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
OptionsDialog::~OptionsDialog()
|
OptionsDialog::~OptionsDialog()
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ class Keyword;
|
|||||||
|
|
||||||
class OptionsDialog : public QWidget
|
class OptionsDialog : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
|
||||||
public:
|
public:
|
||||||
explicit OptionsDialog(QWidget *parent = 0);
|
explicit OptionsDialog(QWidget *parent = 0);
|
||||||
~OptionsDialog();
|
~OptionsDialog();
|
||||||
@@ -50,15 +49,13 @@ public:
|
|||||||
void setSettings(const Settings &settings);
|
void setSettings(const Settings &settings);
|
||||||
Settings settings();
|
Settings settings();
|
||||||
|
|
||||||
private slots:
|
private:
|
||||||
void addKeywordButtonClicked();
|
void addKeywordButtonClicked();
|
||||||
void editKeywordButtonClicked();
|
void editKeywordButtonClicked();
|
||||||
void removeKeywordButtonClicked();
|
void removeKeywordButtonClicked();
|
||||||
void resetKeywordsButtonClicked();
|
void resetKeywordsButtonClicked();
|
||||||
void setKeywordsButtonsEnabled();
|
void setKeywordsButtonsEnabled();
|
||||||
void keywordDoubleClicked(QListWidgetItem *item);
|
void keywordDoubleClicked(QListWidgetItem *item);
|
||||||
|
|
||||||
private:
|
|
||||||
void uiFromSettings(const Settings &settings);
|
void uiFromSettings(const Settings &settings);
|
||||||
Settings settingsFromUi();
|
Settings settingsFromUi();
|
||||||
void addToKeywordsList(const Keyword &keyword);
|
void addToKeywordsList(const Keyword &keyword);
|
||||||
|
|||||||
@@ -114,25 +114,5 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections/>
|
||||||
<connection>
|
|
||||||
<sender>keywordsList</sender>
|
|
||||||
<signal>itemSelectionChanged()</signal>
|
|
||||||
<receiver>Todo::Internal::OptionsDialog</receiver>
|
|
||||||
<slot>setKeywordsButtonsEnabled()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>247</x>
|
|
||||||
<y>176</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>5</x>
|
|
||||||
<y>137</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
</connections>
|
|
||||||
<slots>
|
|
||||||
<slot>setKeywordsButtonsEnabled()</slot>
|
|
||||||
</slots>
|
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
@@ -35,8 +35,6 @@ namespace Internal {
|
|||||||
|
|
||||||
class QmlJsTodoItemsScanner : public TodoItemsScanner
|
class QmlJsTodoItemsScanner : public TodoItemsScanner
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit QmlJsTodoItemsScanner(const KeywordList &keywordList, QObject *parent = 0);
|
explicit QmlJsTodoItemsScanner(const KeywordList &keywordList, QObject *parent = 0);
|
||||||
|
|
||||||
@@ -44,10 +42,8 @@ protected:
|
|||||||
bool shouldProcessFile(const QString &fileName);
|
bool shouldProcessFile(const QString &fileName);
|
||||||
void scannerParamsChanged() override;
|
void scannerParamsChanged() override;
|
||||||
|
|
||||||
private slots:
|
|
||||||
void documentUpdated(QmlJS::Document::Ptr doc);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void documentUpdated(QmlJS::Document::Ptr doc);
|
||||||
void processDocument(QmlJS::Document::Ptr doc);
|
void processDocument(QmlJS::Document::Ptr doc);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -49,8 +49,6 @@ public:
|
|||||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||||
|
|
||||||
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
|
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
|
||||||
|
|
||||||
public slots:
|
|
||||||
void todoItemsListUpdated();
|
void todoItemsListUpdated();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -111,8 +111,8 @@ void TodoItemsProvider::createScanners()
|
|||||||
m_scanners << new QmlJsTodoItemsScanner(m_settings.keywords, this);
|
m_scanners << new QmlJsTodoItemsScanner(m_settings.keywords, this);
|
||||||
|
|
||||||
foreach (TodoItemsScanner *scanner, m_scanners) {
|
foreach (TodoItemsScanner *scanner, m_scanners) {
|
||||||
connect(scanner, SIGNAL(itemsFetched(QString,QList<TodoItem>)), this,
|
connect(scanner, &TodoItemsScanner::itemsFetched, this,
|
||||||
SLOT(itemsFetched(QString,QList<TodoItem>)), Qt::QueuedConnection);
|
&TodoItemsProvider::itemsFetched, Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,16 +208,17 @@ void TodoItemsProvider::updateListTimeoutElapsed()
|
|||||||
void TodoItemsProvider::setupStartupProjectBinding()
|
void TodoItemsProvider::setupStartupProjectBinding()
|
||||||
{
|
{
|
||||||
m_startupProject = SessionManager::startupProject();
|
m_startupProject = SessionManager::startupProject();
|
||||||
connect(SessionManager::instance(), SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
|
connect(SessionManager::instance(), &SessionManager::startupProjectChanged,
|
||||||
SLOT(startupProjectChanged(ProjectExplorer::Project*)));
|
this, &TodoItemsProvider::startupProjectChanged);
|
||||||
connect(ProjectExplorerPlugin::instance(), SIGNAL(fileListChanged()), SLOT(projectsFilesChanged()));
|
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::fileListChanged,
|
||||||
|
this, &TodoItemsProvider::projectsFilesChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TodoItemsProvider::setupCurrentEditorBinding()
|
void TodoItemsProvider::setupCurrentEditorBinding()
|
||||||
{
|
{
|
||||||
m_currentEditor = Core::EditorManager::currentEditor();
|
m_currentEditor = Core::EditorManager::currentEditor();
|
||||||
connect(Core::EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)),
|
connect(Core::EditorManager::instance(), &Core::EditorManager::currentEditorChanged,
|
||||||
SLOT(currentEditorChanged(Core::IEditor*)));
|
this, &TodoItemsProvider::currentEditorChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TodoItemsProvider::setupUpdateListTimer()
|
void TodoItemsProvider::setupUpdateListTimer()
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ public:
|
|||||||
explicit TodoItemsProvider(Settings settings, QObject *parent = 0);
|
explicit TodoItemsProvider(Settings settings, QObject *parent = 0);
|
||||||
TodoItemsModel *todoItemsModel();
|
TodoItemsModel *todoItemsModel();
|
||||||
|
|
||||||
public slots:
|
|
||||||
void settingsChanged(const Settings &newSettings);
|
void settingsChanged(const Settings &newSettings);
|
||||||
void projectSettingsChanged(ProjectExplorer::Project *project);
|
void projectSettingsChanged(ProjectExplorer::Project *project);
|
||||||
|
|
||||||
@@ -82,7 +81,7 @@ private:
|
|||||||
void setItemsListWithinStartupProject();
|
void setItemsListWithinStartupProject();
|
||||||
void setItemsListWithinSubproject();
|
void setItemsListWithinSubproject();
|
||||||
|
|
||||||
private slots:
|
private:
|
||||||
void itemsFetched(const QString &fileName, const QList<TodoItem> &items);
|
void itemsFetched(const QString &fileName, const QList<TodoItem> &items);
|
||||||
void startupProjectChanged(ProjectExplorer::Project *project);
|
void startupProjectChanged(ProjectExplorer::Project *project);
|
||||||
void projectsFilesChanged();
|
void projectsFilesChanged();
|
||||||
|
|||||||
@@ -73,21 +73,11 @@ signals:
|
|||||||
void todoItemClicked(const TodoItem &item);
|
void todoItemClicked(const TodoItem &item);
|
||||||
void scanningScopeChanged(ScanningScope scanningScope);
|
void scanningScopeChanged(ScanningScope scanningScope);
|
||||||
|
|
||||||
private slots:
|
private:
|
||||||
void scopeButtonClicked(QAbstractButton *button);
|
void scopeButtonClicked(QAbstractButton *button);
|
||||||
void todoTreeViewClicked(const QModelIndex &index);
|
void todoTreeViewClicked(const QModelIndex &index);
|
||||||
void updateTodoCount();
|
void updateTodoCount();
|
||||||
|
|
||||||
private:
|
|
||||||
TodoOutputTreeView *m_todoTreeView;
|
|
||||||
QToolButton *m_currentFileButton;
|
|
||||||
QToolButton *m_wholeProjectButton;
|
|
||||||
QToolButton *m_subProjectButton;
|
|
||||||
QWidget *m_spacer;
|
|
||||||
QButtonGroup *m_scopeButtons;
|
|
||||||
QList<TodoItem> *items;
|
|
||||||
TodoItemsModel *m_todoItemsModel;
|
|
||||||
|
|
||||||
void createTreeView();
|
void createTreeView();
|
||||||
void freeTreeView();
|
void freeTreeView();
|
||||||
void createScopeButtons();
|
void createScopeButtons();
|
||||||
@@ -96,6 +86,15 @@ private:
|
|||||||
QModelIndex selectedModelIndex();
|
QModelIndex selectedModelIndex();
|
||||||
QModelIndex nextModelIndex();
|
QModelIndex nextModelIndex();
|
||||||
QModelIndex previousModelIndex();
|
QModelIndex previousModelIndex();
|
||||||
|
|
||||||
|
TodoOutputTreeView *m_todoTreeView;
|
||||||
|
QToolButton *m_currentFileButton;
|
||||||
|
QToolButton *m_wholeProjectButton;
|
||||||
|
QToolButton *m_subProjectButton;
|
||||||
|
QWidget *m_spacer;
|
||||||
|
QButtonGroup *m_scopeButtons;
|
||||||
|
QList<TodoItem> *items;
|
||||||
|
TodoItemsModel *m_todoItemsModel;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ TodoOutputTreeView::TodoOutputTreeView(QWidget *parent) :
|
|||||||
header()->setSectionResizeMode(QHeaderView::Interactive);
|
header()->setSectionResizeMode(QHeaderView::Interactive);
|
||||||
header()->setStretchLastSection(true);
|
header()->setStretchLastSection(true);
|
||||||
header()->setSectionsMovable(false);
|
header()->setSectionsMovable(false);
|
||||||
connect(header(), SIGNAL(sectionResized(int,int,int)), SLOT(todoColumnResized(int,int,int)));
|
connect(header(), &QHeaderView::sectionResized, this, &TodoOutputTreeView::todoColumnResized);
|
||||||
loadDisplaySettings();
|
loadDisplaySettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,17 +32,15 @@ namespace Internal {
|
|||||||
|
|
||||||
class TodoOutputTreeView : public Utils::TreeView
|
class TodoOutputTreeView : public Utils::TreeView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
|
||||||
public:
|
public:
|
||||||
explicit TodoOutputTreeView(QWidget *parent = 0);
|
explicit TodoOutputTreeView(QWidget *parent = 0);
|
||||||
~TodoOutputTreeView();
|
~TodoOutputTreeView();
|
||||||
|
|
||||||
void resizeEvent(QResizeEvent *event);
|
void resizeEvent(QResizeEvent *event);
|
||||||
|
|
||||||
private slots:
|
private:
|
||||||
void todoColumnResized(int column, int oldSize, int newSize);
|
void todoColumnResized(int column, int oldSize, int newSize);
|
||||||
|
|
||||||
private:
|
|
||||||
void saveDisplaySettings();
|
void saveDisplaySettings();
|
||||||
void loadDisplaySettings();
|
void loadDisplaySettings();
|
||||||
|
|
||||||
|
|||||||
@@ -50,12 +50,10 @@ public:
|
|||||||
void extensionsInitialized();
|
void extensionsInitialized();
|
||||||
bool initialize(const QStringList &arguments, QString *errorString);
|
bool initialize(const QStringList &arguments, QString *errorString);
|
||||||
|
|
||||||
private slots:
|
private:
|
||||||
void settingsChanged(const Settings &settings);
|
void settingsChanged(const Settings &settings);
|
||||||
void scanningScopeChanged(ScanningScope scanningScope);
|
void scanningScopeChanged(ScanningScope scanningScope);
|
||||||
void todoItemClicked(const TodoItem &item);
|
void todoItemClicked(const TodoItem &item);
|
||||||
|
|
||||||
private:
|
|
||||||
void createItemsProvider();
|
void createItemsProvider();
|
||||||
void createTodoOutputPane();
|
void createTodoOutputPane();
|
||||||
void createOptionsPage();
|
void createOptionsPage();
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ namespace Todo {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
TodoProjectSettingsWidget::TodoProjectSettingsWidget(ProjectExplorer::Project *project) :
|
TodoProjectSettingsWidget::TodoProjectSettingsWidget(ProjectExplorer::Project *project) :
|
||||||
QWidget(0),
|
|
||||||
ui(new Ui::TodoProjectSettingsWidget),
|
ui(new Ui::TodoProjectSettingsWidget),
|
||||||
m_project(project)
|
m_project(project)
|
||||||
{
|
{
|
||||||
@@ -51,6 +50,8 @@ TodoProjectSettingsWidget::TodoProjectSettingsWidget(ProjectExplorer::Project *p
|
|||||||
this, &TodoProjectSettingsWidget::removeExcludedPatternButtonClicked);
|
this, &TodoProjectSettingsWidget::removeExcludedPatternButtonClicked);
|
||||||
connect(ui->excludedPatternsList, &QListWidget::itemChanged,
|
connect(ui->excludedPatternsList, &QListWidget::itemChanged,
|
||||||
this, &TodoProjectSettingsWidget::excludedPatternChanged, Qt::QueuedConnection);
|
this, &TodoProjectSettingsWidget::excludedPatternChanged, Qt::QueuedConnection);
|
||||||
|
connect(ui->excludedPatternsList, &QListWidget::itemSelectionChanged,
|
||||||
|
this, &TodoProjectSettingsWidget::setExcludedPatternsButtonsEnabled);
|
||||||
|
|
||||||
loadSettings();
|
loadSettings();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,13 +53,11 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
void projectSettingsChanged();
|
void projectSettingsChanged();
|
||||||
|
|
||||||
private slots:
|
private:
|
||||||
void addExcludedPatternButtonClicked();
|
void addExcludedPatternButtonClicked();
|
||||||
void removeExcludedPatternButtonClicked();
|
void removeExcludedPatternButtonClicked();
|
||||||
void setExcludedPatternsButtonsEnabled();
|
void setExcludedPatternsButtonsEnabled();
|
||||||
void excludedPatternChanged(QListWidgetItem *item);
|
void excludedPatternChanged(QListWidgetItem *item);
|
||||||
|
|
||||||
private:
|
|
||||||
QListWidgetItem *addToExcludedPatternsList(const QString &pattern);
|
QListWidgetItem *addToExcludedPatternsList(const QString &pattern);
|
||||||
void loadSettings();
|
void loadSettings();
|
||||||
void saveSettings();
|
void saveSettings();
|
||||||
|
|||||||
@@ -67,25 +67,5 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections/>
|
||||||
<connection>
|
|
||||||
<sender>excludedPatternsList</sender>
|
|
||||||
<signal>itemSelectionChanged()</signal>
|
|
||||||
<receiver>Todo::Internal::TodoProjectSettingsWidget</receiver>
|
|
||||||
<slot>setExcludedPatternsButtonsEnabled()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>170</x>
|
|
||||||
<y>381</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>221</x>
|
|
||||||
<y>240</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
</connections>
|
|
||||||
<slots>
|
|
||||||
<slot>setExcludedPatternsButtonsEnabled()</slot>
|
|
||||||
</slots>
|
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
Reference in New Issue
Block a user