forked from qt-creator/qt-creator
Todo: non-alien dir separators in To-Do entries list
Use Utils::FileName instead of QString in TodoItem Change-Id: I3c35599f972f0c23087f86ef10c9363a1577ce35 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -30,6 +30,8 @@
|
||||
#include "constants.h"
|
||||
#include "todoicons.h"
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
#include <QMetaType>
|
||||
#include <QString>
|
||||
#include <QColor>
|
||||
@@ -43,7 +45,7 @@ public:
|
||||
TodoItem() : line(-1) {}
|
||||
|
||||
QString text;
|
||||
QString file;
|
||||
Utils::FileName file;
|
||||
int line;
|
||||
IconType iconType;
|
||||
QColor color;
|
||||
|
||||
@@ -100,7 +100,7 @@ QVariant TodoItemsModel::data(const QModelIndex &index, int role) const
|
||||
|
||||
case Constants::OUTPUT_COLUMN_FILE:
|
||||
if (role == Qt::DisplayRole)
|
||||
return item.file;
|
||||
return item.file.toUserOutput();
|
||||
break;
|
||||
|
||||
case Constants::OUTPUT_COLUMN_LINE:
|
||||
|
||||
@@ -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 = fileName;
|
||||
newItemList[i].file = Utils::FileName::fromString(fileName);
|
||||
}
|
||||
|
||||
outItemList << newItemList;
|
||||
|
||||
@@ -170,7 +170,7 @@ void TodoOutputPane::todoTreeViewClicked(const QModelIndex &index)
|
||||
|
||||
TodoItem item;
|
||||
item.text = index.sibling(row, Constants::OUTPUT_COLUMN_TEXT).data().toString();
|
||||
item.file = index.sibling(row, Constants::OUTPUT_COLUMN_FILE).data().toString();
|
||||
item.file = Utils::FileName::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::BackgroundColorRole).value<QColor>();
|
||||
item.iconType = static_cast<IconType>(index.sibling(row, Constants::OUTPUT_COLUMN_TEXT)
|
||||
|
||||
@@ -111,8 +111,8 @@ void TodoPlugin::scanningScopeChanged(ScanningScope scanningScope)
|
||||
|
||||
void TodoPlugin::todoItemClicked(const TodoItem &item)
|
||||
{
|
||||
if (QFileInfo::exists(item.file)) {
|
||||
Core::IEditor *editor = Core::EditorManager::openEditor(item.file);
|
||||
if (item.file.exists()) {
|
||||
Core::IEditor *editor = Core::EditorManager::openEditor(item.file.toString());
|
||||
editor->gotoLine(item.line);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user