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
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CppTodoItemsScanner(const KeywordList &keywordList, QObject *parent = 0);
|
||||
|
||||
protected:
|
||||
void scannerParamsChanged();
|
||||
|
||||
private slots:
|
||||
void documentUpdated(CPlusPlus::Document::Ptr doc);
|
||||
|
||||
private:
|
||||
void documentUpdated(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->errorLabel->hide();
|
||||
|
||||
connect(ui->buttonBox, SIGNAL(accepted()), SLOT(acceptButtonClicked()));
|
||||
connect(ui->keywordNameEdit, SIGNAL(textChanged(QString)), ui->errorLabel, SLOT(hide()));
|
||||
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &KeywordDialog::acceptButtonClicked);
|
||||
connect(ui->keywordNameEdit, &QLineEdit::textChanged, ui->errorLabel, &QWidget::hide);
|
||||
}
|
||||
|
||||
KeywordDialog::~KeywordDialog()
|
||||
@@ -108,7 +108,7 @@ void KeywordDialog::setupColorWidgets(const QColor &color)
|
||||
{
|
||||
ui->colorButton->setColor(color);
|
||||
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()
|
||||
|
||||
@@ -47,11 +47,9 @@ public:
|
||||
|
||||
Keyword keyword();
|
||||
|
||||
private slots:
|
||||
private:
|
||||
void colorSelected(const QColor &color);
|
||||
void acceptButtonClicked();
|
||||
|
||||
private:
|
||||
void setupListWidget(IconType selectedIcon);
|
||||
void setupColorWidgets(const QColor &color);
|
||||
bool canAccept();
|
||||
|
||||
@@ -41,11 +41,18 @@ OptionsDialog::OptionsDialog(QWidget *parent) :
|
||||
ui->setupUi(this);
|
||||
ui->keywordsList->setIconSize(QSize(16, 16));
|
||||
setKeywordsButtonsEnabled();
|
||||
connect(ui->addKeywordButton, SIGNAL(clicked()), SLOT(addKeywordButtonClicked()));
|
||||
connect(ui->removeKeywordButton, SIGNAL(clicked()), SLOT(removeKeywordButtonClicked()));
|
||||
connect(ui->editKeywordButton, SIGNAL(clicked()), SLOT(editKeywordButtonClicked()));
|
||||
connect(ui->resetKeywordsButton, SIGNAL(clicked()), SLOT(resetKeywordsButtonClicked()));
|
||||
connect(ui->keywordsList, SIGNAL(itemDoubleClicked(QListWidgetItem*)), SLOT(keywordDoubleClicked(QListWidgetItem*)));
|
||||
connect(ui->addKeywordButton, &QAbstractButton::clicked,
|
||||
this, &OptionsDialog::addKeywordButtonClicked);
|
||||
connect(ui->removeKeywordButton, &QAbstractButton::clicked,
|
||||
this, &OptionsDialog::removeKeywordButtonClicked);
|
||||
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()
|
||||
|
||||
@@ -42,7 +42,6 @@ class Keyword;
|
||||
|
||||
class OptionsDialog : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit OptionsDialog(QWidget *parent = 0);
|
||||
~OptionsDialog();
|
||||
@@ -50,15 +49,13 @@ public:
|
||||
void setSettings(const Settings &settings);
|
||||
Settings settings();
|
||||
|
||||
private slots:
|
||||
private:
|
||||
void addKeywordButtonClicked();
|
||||
void editKeywordButtonClicked();
|
||||
void removeKeywordButtonClicked();
|
||||
void resetKeywordsButtonClicked();
|
||||
void setKeywordsButtonsEnabled();
|
||||
void keywordDoubleClicked(QListWidgetItem *item);
|
||||
|
||||
private:
|
||||
void uiFromSettings(const Settings &settings);
|
||||
Settings settingsFromUi();
|
||||
void addToKeywordsList(const Keyword &keyword);
|
||||
|
||||
@@ -114,25 +114,5 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<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>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -35,8 +35,6 @@ namespace Internal {
|
||||
|
||||
class QmlJsTodoItemsScanner : public TodoItemsScanner
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QmlJsTodoItemsScanner(const KeywordList &keywordList, QObject *parent = 0);
|
||||
|
||||
@@ -44,10 +42,8 @@ protected:
|
||||
bool shouldProcessFile(const QString &fileName);
|
||||
void scannerParamsChanged() override;
|
||||
|
||||
private slots:
|
||||
void documentUpdated(QmlJS::Document::Ptr doc);
|
||||
|
||||
private:
|
||||
void documentUpdated(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;
|
||||
|
||||
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
|
||||
|
||||
public slots:
|
||||
void todoItemsListUpdated();
|
||||
|
||||
private:
|
||||
|
||||
@@ -111,8 +111,8 @@ void TodoItemsProvider::createScanners()
|
||||
m_scanners << new QmlJsTodoItemsScanner(m_settings.keywords, this);
|
||||
|
||||
foreach (TodoItemsScanner *scanner, m_scanners) {
|
||||
connect(scanner, SIGNAL(itemsFetched(QString,QList<TodoItem>)), this,
|
||||
SLOT(itemsFetched(QString,QList<TodoItem>)), Qt::QueuedConnection);
|
||||
connect(scanner, &TodoItemsScanner::itemsFetched, this,
|
||||
&TodoItemsProvider::itemsFetched, Qt::QueuedConnection);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,16 +208,17 @@ void TodoItemsProvider::updateListTimeoutElapsed()
|
||||
void TodoItemsProvider::setupStartupProjectBinding()
|
||||
{
|
||||
m_startupProject = SessionManager::startupProject();
|
||||
connect(SessionManager::instance(), SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
|
||||
SLOT(startupProjectChanged(ProjectExplorer::Project*)));
|
||||
connect(ProjectExplorerPlugin::instance(), SIGNAL(fileListChanged()), SLOT(projectsFilesChanged()));
|
||||
connect(SessionManager::instance(), &SessionManager::startupProjectChanged,
|
||||
this, &TodoItemsProvider::startupProjectChanged);
|
||||
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::fileListChanged,
|
||||
this, &TodoItemsProvider::projectsFilesChanged);
|
||||
}
|
||||
|
||||
void TodoItemsProvider::setupCurrentEditorBinding()
|
||||
{
|
||||
m_currentEditor = Core::EditorManager::currentEditor();
|
||||
connect(Core::EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)),
|
||||
SLOT(currentEditorChanged(Core::IEditor*)));
|
||||
connect(Core::EditorManager::instance(), &Core::EditorManager::currentEditorChanged,
|
||||
this, &TodoItemsProvider::currentEditorChanged);
|
||||
}
|
||||
|
||||
void TodoItemsProvider::setupUpdateListTimer()
|
||||
|
||||
@@ -49,7 +49,6 @@ public:
|
||||
explicit TodoItemsProvider(Settings settings, QObject *parent = 0);
|
||||
TodoItemsModel *todoItemsModel();
|
||||
|
||||
public slots:
|
||||
void settingsChanged(const Settings &newSettings);
|
||||
void projectSettingsChanged(ProjectExplorer::Project *project);
|
||||
|
||||
@@ -82,7 +81,7 @@ private:
|
||||
void setItemsListWithinStartupProject();
|
||||
void setItemsListWithinSubproject();
|
||||
|
||||
private slots:
|
||||
private:
|
||||
void itemsFetched(const QString &fileName, const QList<TodoItem> &items);
|
||||
void startupProjectChanged(ProjectExplorer::Project *project);
|
||||
void projectsFilesChanged();
|
||||
|
||||
@@ -73,21 +73,11 @@ signals:
|
||||
void todoItemClicked(const TodoItem &item);
|
||||
void scanningScopeChanged(ScanningScope scanningScope);
|
||||
|
||||
private slots:
|
||||
private:
|
||||
void scopeButtonClicked(QAbstractButton *button);
|
||||
void todoTreeViewClicked(const QModelIndex &index);
|
||||
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 freeTreeView();
|
||||
void createScopeButtons();
|
||||
@@ -96,6 +86,15 @@ private:
|
||||
QModelIndex selectedModelIndex();
|
||||
QModelIndex nextModelIndex();
|
||||
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
|
||||
|
||||
@@ -51,7 +51,7 @@ TodoOutputTreeView::TodoOutputTreeView(QWidget *parent) :
|
||||
header()->setSectionResizeMode(QHeaderView::Interactive);
|
||||
header()->setStretchLastSection(true);
|
||||
header()->setSectionsMovable(false);
|
||||
connect(header(), SIGNAL(sectionResized(int,int,int)), SLOT(todoColumnResized(int,int,int)));
|
||||
connect(header(), &QHeaderView::sectionResized, this, &TodoOutputTreeView::todoColumnResized);
|
||||
loadDisplaySettings();
|
||||
}
|
||||
|
||||
|
||||
@@ -32,17 +32,15 @@ namespace Internal {
|
||||
|
||||
class TodoOutputTreeView : public Utils::TreeView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit TodoOutputTreeView(QWidget *parent = 0);
|
||||
~TodoOutputTreeView();
|
||||
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
||||
private slots:
|
||||
private:
|
||||
void todoColumnResized(int column, int oldSize, int newSize);
|
||||
|
||||
private:
|
||||
void saveDisplaySettings();
|
||||
void loadDisplaySettings();
|
||||
|
||||
|
||||
@@ -50,12 +50,10 @@ public:
|
||||
void extensionsInitialized();
|
||||
bool initialize(const QStringList &arguments, QString *errorString);
|
||||
|
||||
private slots:
|
||||
private:
|
||||
void settingsChanged(const Settings &settings);
|
||||
void scanningScopeChanged(ScanningScope scanningScope);
|
||||
void todoItemClicked(const TodoItem &item);
|
||||
|
||||
private:
|
||||
void createItemsProvider();
|
||||
void createTodoOutputPane();
|
||||
void createOptionsPage();
|
||||
|
||||
@@ -38,7 +38,6 @@ namespace Todo {
|
||||
namespace Internal {
|
||||
|
||||
TodoProjectSettingsWidget::TodoProjectSettingsWidget(ProjectExplorer::Project *project) :
|
||||
QWidget(0),
|
||||
ui(new Ui::TodoProjectSettingsWidget),
|
||||
m_project(project)
|
||||
{
|
||||
@@ -51,6 +50,8 @@ TodoProjectSettingsWidget::TodoProjectSettingsWidget(ProjectExplorer::Project *p
|
||||
this, &TodoProjectSettingsWidget::removeExcludedPatternButtonClicked);
|
||||
connect(ui->excludedPatternsList, &QListWidget::itemChanged,
|
||||
this, &TodoProjectSettingsWidget::excludedPatternChanged, Qt::QueuedConnection);
|
||||
connect(ui->excludedPatternsList, &QListWidget::itemSelectionChanged,
|
||||
this, &TodoProjectSettingsWidget::setExcludedPatternsButtonsEnabled);
|
||||
|
||||
loadSettings();
|
||||
}
|
||||
|
||||
@@ -53,13 +53,11 @@ public:
|
||||
signals:
|
||||
void projectSettingsChanged();
|
||||
|
||||
private slots:
|
||||
private:
|
||||
void addExcludedPatternButtonClicked();
|
||||
void removeExcludedPatternButtonClicked();
|
||||
void setExcludedPatternsButtonsEnabled();
|
||||
void excludedPatternChanged(QListWidgetItem *item);
|
||||
|
||||
private:
|
||||
QListWidgetItem *addToExcludedPatternsList(const QString &pattern);
|
||||
void loadSettings();
|
||||
void saveSettings();
|
||||
|
||||
@@ -67,25 +67,5 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<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>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
Reference in New Issue
Block a user