Skip to content

Commit 7c483f8

Browse files
authoredMar 8, 2025
chore: Replace deprecated FilePath::toString() with toFSPathString() (#116)
This solves a number of deprecation warnings during build. FilePath::toFSPathString() has been available since couple of years ago.
1 parent 6c32364 commit 7c483f8

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed
 

‎ChatView/ChatRootView.cpp

+10-8
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,10 @@ QString ChatRootView::getChatsHistoryDir() const
164164

165165
if (auto project = ProjectExplorer::ProjectManager::startupProject()) {
166166
Settings::ProjectSettings projectSettings(project);
167-
path = projectSettings.chatHistoryPath().toString();
167+
path = projectSettings.chatHistoryPath().toFSPathString();
168168
} else {
169-
path = QString("%1/qodeassist/chat_history").arg(Core::ICore::userResourcePath().toString());
169+
path = QString("%1/qodeassist/chat_history")
170+
.arg(Core::ICore::userResourcePath().toFSPathString());
170171
}
171172

172173
QDir dir(path);
@@ -350,7 +351,7 @@ void ChatRootView::showAttachFilesDialog()
350351
dialog.setFileMode(QFileDialog::ExistingFiles);
351352

352353
if (auto project = ProjectExplorer::ProjectManager::startupProject()) {
353-
dialog.setDirectory(project->projectDirectory().toString());
354+
dialog.setDirectory(project->projectDirectory().toFSPathString());
354355
}
355356

356357
if (dialog.exec() == QDialog::Accepted) {
@@ -384,7 +385,7 @@ void ChatRootView::showLinkFilesDialog()
384385
dialog.setFileMode(QFileDialog::ExistingFiles);
385386

386387
if (auto project = ProjectExplorer::ProjectManager::startupProject()) {
387-
dialog.setDirectory(project->projectDirectory().toString());
388+
dialog.setDirectory(project->projectDirectory().toFSPathString());
388389
}
389390

390391
if (dialog.exec() == QDialog::Accepted) {
@@ -437,9 +438,10 @@ void ChatRootView::openChatHistoryFolder()
437438
QString path;
438439
if (auto project = ProjectExplorer::ProjectManager::startupProject()) {
439440
Settings::ProjectSettings projectSettings(project);
440-
path = projectSettings.chatHistoryPath().toString();
441+
path = projectSettings.chatHistoryPath().toFSPathString();
441442
} else {
442-
path = QString("%1/qodeassist/chat_history").arg(Core::ICore::userResourcePath().toString());
443+
path = QString("%1/qodeassist/chat_history")
444+
.arg(Core::ICore::userResourcePath().toFSPathString());
443445
}
444446

445447
QDir dir(path);
@@ -493,7 +495,7 @@ bool ChatRootView::isSyncOpenFiles() const
493495
void ChatRootView::onEditorAboutToClose(Core::IEditor *editor)
494496
{
495497
if (auto document = editor->document(); document && isSyncOpenFiles()) {
496-
QString filePath = document->filePath().toString();
498+
QString filePath = document->filePath().toFSPathString();
497499
m_linkedFiles.removeOne(filePath);
498500
emit linkedFilesChanged();
499501
}
@@ -506,7 +508,7 @@ void ChatRootView::onEditorAboutToClose(Core::IEditor *editor)
506508
void ChatRootView::onAppendLinkFileFromEditor(Core::IEditor *editor)
507509
{
508510
if (auto document = editor->document(); document && isSyncOpenFiles()) {
509-
QString filePath = document->filePath().toString();
511+
QString filePath = document->filePath().toFSPathString();
510512
if (!m_linkedFiles.contains(filePath)) {
511513
m_linkedFiles.append(filePath);
512514
emit linkedFilesChanged();

‎ChatView/ClientInterface.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,11 @@ QString ClientInterface::getCurrentFileContext() const
183183
}
184184

185185
QString fileInfo = QString("Language: %1\nFile: %2\n\n")
186-
.arg(textDocument->mimeType(), textDocument->filePath().toString());
186+
.arg(textDocument->mimeType(), textDocument->filePath().toFSPathString());
187187

188188
QString content = textDocument->document()->toPlainText();
189189

190-
LOG_MESSAGE(QString("Got context from file: %1").arg(textDocument->filePath().toString()));
190+
LOG_MESSAGE(QString("Got context from file: %1").arg(textDocument->filePath().toFSPathString()));
191191

192192
return QString("Current file context:\n%1\nFile content:\n%2").arg(fileInfo, content);
193193
}

‎context/ContextManager.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ ProgrammingLanguage ContextManager::getDocumentLanguage(const QJsonObject &reque
8181
filePath);
8282

8383
if (!textDocument) {
84-
LOG_MESSAGE("Error: Document is not available for" + filePath.toString());
84+
LOG_MESSAGE("Error: Document is not available for" + filePath.toFSPathString());
8585
return Context::ProgrammingLanguage::Unknown;
8686
}
8787

‎settings/ProjectSettings.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ ProjectSettings::ProjectSettings(ProjectExplorer::Project *project)
4343
chatHistoryPath.setExpectedKind(Utils::PathChooser::ExistingDirectory);
4444
chatHistoryPath.setLabelText(Tr::tr("Chat History Path:"));
4545

46-
QString projectChatHistoryPath
47-
= QString("%1/qodeassist/chat_history").arg(Core::ICore::userResourcePath().toString());
46+
QString projectChatHistoryPath = QString("%1/qodeassist/chat_history")
47+
.arg(Core::ICore::userResourcePath().toFSPathString());
4848

4949
chatHistoryPath.setDefaultValue(projectChatHistoryPath);
5050

0 commit comments

Comments
 (0)