diff options
Diffstat (limited to 'src/plugins/todo')
-rw-r--r-- | src/plugins/todo/CMakeLists.txt | 25 | ||||
-rw-r--r-- | src/plugins/todo/cpptodoitemsscanner.cpp | 2 | ||||
-rw-r--r-- | src/plugins/todo/todoitem.h | 2 | ||||
-rw-r--r-- | src/plugins/todo/todoitemsprovider.cpp | 32 | ||||
-rw-r--r-- | src/plugins/todo/todoitemsprovider.h | 2 | ||||
-rw-r--r-- | src/plugins/todo/todoitemsscanner.cpp | 2 | ||||
-rw-r--r-- | src/plugins/todo/todooutputpane.cpp | 14 | ||||
-rw-r--r-- | src/plugins/todo/todooutputpane.h | 4 |
8 files changed, 52 insertions, 31 deletions
diff --git a/src/plugins/todo/CMakeLists.txt b/src/plugins/todo/CMakeLists.txt new file mode 100644 index 0000000000..6283407272 --- /dev/null +++ b/src/plugins/todo/CMakeLists.txt @@ -0,0 +1,25 @@ +add_qtc_plugin(Todo + DEPENDS qmljs + PLUGIN_DEPENDS Core CppTools ProjectExplorer + SOURCES + constants.h + cpptodoitemsscanner.cpp cpptodoitemsscanner.h + keyword.cpp keyword.h + keyworddialog.cpp keyworddialog.h keyworddialog.ui + lineparser.cpp lineparser.h + optionsdialog.cpp optionsdialog.h optionsdialog.ui + optionspage.cpp optionspage.h + qmljstodoitemsscanner.cpp qmljstodoitemsscanner.h + settings.cpp settings.h + todoicons.cpp todoicons.h + todoitem.h + todoitemsmodel.cpp todoitemsmodel.h + todoitemsprovider.cpp todoitemsprovider.h + todoitemsscanner.cpp todoitemsscanner.h + todooutputpane.cpp todooutputpane.h + todooutputtreeview.cpp todooutputtreeview.h + todooutputtreeviewdelegate.cpp todooutputtreeviewdelegate.h + todoplugin.cpp todoplugin.h + todoplugin.qrc + todoprojectsettingswidget.cpp todoprojectsettingswidget.h todoprojectsettingswidget.ui +) diff --git a/src/plugins/todo/cpptodoitemsscanner.cpp b/src/plugins/todo/cpptodoitemsscanner.cpp index 46b6f3d9a7..938f7922fc 100644 --- a/src/plugins/todo/cpptodoitemsscanner.cpp +++ b/src/plugins/todo/cpptodoitemsscanner.cpp @@ -60,7 +60,7 @@ void CppTodoItemsScanner::scannerParamsChanged() QSet<QString> filesToBeUpdated; foreach (const CppTools::ProjectInfo &info, modelManager->projectInfos()) filesToBeUpdated.unite(Utils::transform(info.project().data()->files(ProjectExplorer::Project::SourceFiles), - &Utils::FileName::toString).toSet()); + &Utils::FilePath::toString).toSet()); modelManager->updateSourceFiles(filesToBeUpdated); } diff --git a/src/plugins/todo/todoitem.h b/src/plugins/todo/todoitem.h index be38f85ae7..f44cf0b42c 100644 --- a/src/plugins/todo/todoitem.h +++ b/src/plugins/todo/todoitem.h @@ -42,7 +42,7 @@ class TodoItem { public: QString text; - Utils::FileName file; + Utils::FilePath file; int line = -1; IconType iconType = IconType::Todo; QColor color; diff --git a/src/plugins/todo/todoitemsprovider.cpp b/src/plugins/todo/todoitemsprovider.cpp index 99ca36fc23..c2f958bb4e 100644 --- a/src/plugins/todo/todoitemsprovider.cpp +++ b/src/plugins/todo/todoitemsprovider.cpp @@ -45,6 +45,7 @@ #include <QTimer> using namespace ProjectExplorer; +using namespace Utils; namespace Todo { namespace Internal { @@ -90,7 +91,7 @@ void TodoItemsProvider::updateList() // Show only items of the current file if any if (m_settings.scanningScope == ScanningScopeCurrentFile) { if (m_currentEditor) - m_itemsList = m_itemsHash.value(m_currentEditor->document()->filePath().toString()); + m_itemsList = m_itemsHash.value(m_currentEditor->document()->filePath()); // Show only items of the current sub-project } else if (m_settings.scanningScope == ScanningScopeSubProject) { if (m_startupProject) @@ -121,21 +122,19 @@ void TodoItemsProvider::createScanners() void TodoItemsProvider::setItemsListWithinStartupProject() { - QHashIterator<QString, QList<TodoItem> > it(m_itemsHash); - const QSet<QString> fileNames - = QSet<QString>::fromList(Utils::transform(m_startupProject->files(Project::SourceFiles), - &Utils::FileName::toString)); + QHashIterator<FilePath, QList<TodoItem> > it(m_itemsHash); + const auto filePaths = QSet<FilePath>::fromList(m_startupProject->files(Project::SourceFiles)); QVariantMap settings = m_startupProject->namedSettings(Constants::SETTINGS_NAME_KEY).toMap(); while (it.hasNext()) { it.next(); - QString fileName = it.key(); - if (fileNames.contains(fileName)) { + const FilePath filePath = it.key(); + if (filePaths.contains(filePath)) { bool skip = false; for (const QVariant &pattern : settings[Constants::EXCLUDES_LIST_KEY].toList()) { QRegExp re(pattern.toString()); - if (re.indexIn(fileName) != -1) { + if (re.indexIn(filePath.toString()) != -1) { skip = true; break; } @@ -149,27 +148,24 @@ void TodoItemsProvider::setItemsListWithinStartupProject() void TodoItemsProvider::setItemsListWithinSubproject() { // TODO prefer current editor as source of sub-project - const Node *node = ProjectTree::findCurrentNode(); + const Node *node = ProjectTree::currentNode(); if (node) { ProjectNode *projectNode = node->parentProjectNode(); if (projectNode) { // FIXME: The name doesn't match the implementation that lists all files. - QSet<Utils::FileName> subprojectFileNames; + QSet<FilePath> subprojectFileNames; projectNode->forEachGenericNode([&](Node *node) { subprojectFileNames.insert(node->filePath()); }); // files must be both in the current subproject and the startup-project. - const QSet<QString> fileNames - = QSet<QString>::fromList(Utils::transform(m_startupProject->files(Project::SourceFiles), - &Utils::FileName::toString)); - QHashIterator<QString, QList<TodoItem> > it(m_itemsHash); + const auto fileNames + = QSet<FilePath>::fromList(m_startupProject->files(Project::SourceFiles)); + QHashIterator<FilePath, QList<TodoItem> > it(m_itemsHash); while (it.hasNext()) { it.next(); - if (subprojectFileNames.contains(Utils::FileName::fromString(it.key())) - && fileNames.contains(it.key())) { + if (subprojectFileNames.contains(it.key()) && fileNames.contains(it.key())) m_itemsList << it.value(); - } } } } @@ -178,7 +174,7 @@ void TodoItemsProvider::setItemsListWithinSubproject() void TodoItemsProvider::itemsFetched(const QString &fileName, const QList<TodoItem> &items) { // Replace old items with new ones - m_itemsHash.insert(fileName, items); + m_itemsHash.insert(FilePath::fromString(fileName), items); m_shouldUpdateList = true; } diff --git a/src/plugins/todo/todoitemsprovider.h b/src/plugins/todo/todoitemsprovider.h index 234025bfec..f2d1f33a10 100644 --- a/src/plugins/todo/todoitemsprovider.h +++ b/src/plugins/todo/todoitemsprovider.h @@ -60,7 +60,7 @@ private: TodoItemsModel *m_itemsModel; // All to-do items are stored here regardless current scanning scope - QHash<QString, QList<TodoItem> > m_itemsHash; + QHash<Utils::FilePath, QList<TodoItem> > m_itemsHash; // This list contains only those to-do items that are within current scanning scope QList<TodoItem> m_itemsList; diff --git a/src/plugins/todo/todoitemsscanner.cpp b/src/plugins/todo/todoitemsscanner.cpp index 9b3a25dbfa..f9c57cccb7 100644 --- a/src/plugins/todo/todoitemsscanner.cpp +++ b/src/plugins/todo/todoitemsscanner.cpp @@ -54,7 +54,7 @@ void TodoItemsScanner::processCommentLine(const QString &fileName, const QString for (int i = 0; i < newItemList.count(); ++i) { newItemList[i].line = lineNumber; - newItemList[i].file = Utils::FileName::fromString(fileName); + newItemList[i].file = Utils::FilePath::fromString(fileName); } outItemList << newItemList; diff --git a/src/plugins/todo/todooutputpane.cpp b/src/plugins/todo/todooutputpane.cpp index 0becced031..9f8a528124 100644 --- a/src/plugins/todo/todooutputpane.cpp +++ b/src/plugins/todo/todooutputpane.cpp @@ -91,7 +91,7 @@ int TodoOutputPane::priorityInStatusBar() const void TodoOutputPane::clearContents() { - clearFilter(); + clearKeywordFilter(); } void TodoOutputPane::visibilityChanged(bool visible) @@ -176,7 +176,7 @@ void TodoOutputPane::todoTreeViewClicked(const QModelIndex &index) TodoItem item; item.text = index.sibling(row, Constants::OUTPUT_COLUMN_TEXT).data().toString(); - item.file = Utils::FileName::fromUserInput(index.sibling(row, Constants::OUTPUT_COLUMN_FILE).data().toString()); + item.file = Utils::FilePath::fromUserInput(index.sibling(row, Constants::OUTPUT_COLUMN_FILE).data().toString()); item.line = index.sibling(row, Constants::OUTPUT_COLUMN_LINE).data().toInt(); item.color = index.data(Qt::TextColorRole).value<QColor>(); item.iconType = static_cast<IconType>(index.sibling(row, Constants::OUTPUT_COLUMN_TEXT) @@ -190,7 +190,7 @@ void TodoOutputPane::updateTodoCount() emit setBadgeNumber(m_todoTreeView->model()->rowCount()); } -void TodoOutputPane::updateFilter() +void TodoOutputPane::updateKeywordFilter() { QStringList keywords; for (const QToolButton *btn: qAsConst(m_filterButtons)) { @@ -208,12 +208,12 @@ void TodoOutputPane::updateFilter() updateTodoCount(); } -void TodoOutputPane::clearFilter() +void TodoOutputPane::clearKeywordFilter() { for (QToolButton *btn: qAsConst(m_filterButtons)) btn->setChecked(false); - updateFilter(); + updateKeywordFilter(); } void TodoOutputPane::createTreeView() @@ -271,7 +271,7 @@ void TodoOutputPane::createScopeButtons() m_scopeButtons->addButton(m_wholeProjectButton); m_scopeButtons->addButton(m_currentFileButton); m_scopeButtons->addButton(m_subProjectButton); - connect(m_scopeButtons, static_cast<void (QButtonGroup::*)(QAbstractButton *)>(&QButtonGroup::buttonClicked), + connect(m_scopeButtons, QOverload<QAbstractButton *>::of(&QButtonGroup::buttonClicked), this, &TodoOutputPane::scopeButtonClicked); m_spacer = new QWidget; @@ -282,7 +282,7 @@ void TodoOutputPane::createScopeButtons() QToolButton *button = createCheckableToolButton(keyword.name, tooltip.arg(keyword.name), toolBarIcon(keyword.iconType)); button->setProperty(Constants::FILTER_KEYWORD_NAME, keyword.name); button->setToolButtonStyle(Qt::ToolButtonIconOnly); - connect(button, &QToolButton::clicked, this, &TodoOutputPane::updateFilter); + connect(button, &QToolButton::clicked, this, &TodoOutputPane::updateKeywordFilter); m_filterButtons.append(button); } diff --git a/src/plugins/todo/todooutputpane.h b/src/plugins/todo/todooutputpane.h index 0c99d0a04a..78b0aff45d 100644 --- a/src/plugins/todo/todooutputpane.h +++ b/src/plugins/todo/todooutputpane.h @@ -80,8 +80,8 @@ private: void scopeButtonClicked(QAbstractButton *button); void todoTreeViewClicked(const QModelIndex &index); void updateTodoCount(); - void updateFilter(); - void clearFilter(); + void updateKeywordFilter(); + void clearKeywordFilter(); void createTreeView(); void freeTreeView(); |