Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Replace deprecated FilePath::toString() with toFSPathString() #116

Merged
merged 1 commit into from
Mar 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions ChatView/ChatRootView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,10 @@ QString ChatRootView::getChatsHistoryDir() const

if (auto project = ProjectExplorer::ProjectManager::startupProject()) {
Settings::ProjectSettings projectSettings(project);
path = projectSettings.chatHistoryPath().toString();
path = projectSettings.chatHistoryPath().toFSPathString();
} else {
path = QString("%1/qodeassist/chat_history").arg(Core::ICore::userResourcePath().toString());
path = QString("%1/qodeassist/chat_history")
.arg(Core::ICore::userResourcePath().toFSPathString());
}

QDir dir(path);
Expand Down Expand Up @@ -350,7 +351,7 @@ void ChatRootView::showAttachFilesDialog()
dialog.setFileMode(QFileDialog::ExistingFiles);

if (auto project = ProjectExplorer::ProjectManager::startupProject()) {
dialog.setDirectory(project->projectDirectory().toString());
dialog.setDirectory(project->projectDirectory().toFSPathString());
}

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

if (auto project = ProjectExplorer::ProjectManager::startupProject()) {
dialog.setDirectory(project->projectDirectory().toString());
dialog.setDirectory(project->projectDirectory().toFSPathString());
}

if (dialog.exec() == QDialog::Accepted) {
Expand Down Expand Up @@ -437,9 +438,10 @@ void ChatRootView::openChatHistoryFolder()
QString path;
if (auto project = ProjectExplorer::ProjectManager::startupProject()) {
Settings::ProjectSettings projectSettings(project);
path = projectSettings.chatHistoryPath().toString();
path = projectSettings.chatHistoryPath().toFSPathString();
} else {
path = QString("%1/qodeassist/chat_history").arg(Core::ICore::userResourcePath().toString());
path = QString("%1/qodeassist/chat_history")
.arg(Core::ICore::userResourcePath().toFSPathString());
}

QDir dir(path);
Expand Down Expand Up @@ -493,7 +495,7 @@ bool ChatRootView::isSyncOpenFiles() const
void ChatRootView::onEditorAboutToClose(Core::IEditor *editor)
{
if (auto document = editor->document(); document && isSyncOpenFiles()) {
QString filePath = document->filePath().toString();
QString filePath = document->filePath().toFSPathString();
m_linkedFiles.removeOne(filePath);
emit linkedFilesChanged();
}
Expand All @@ -506,7 +508,7 @@ void ChatRootView::onEditorAboutToClose(Core::IEditor *editor)
void ChatRootView::onAppendLinkFileFromEditor(Core::IEditor *editor)
{
if (auto document = editor->document(); document && isSyncOpenFiles()) {
QString filePath = document->filePath().toString();
QString filePath = document->filePath().toFSPathString();
if (!m_linkedFiles.contains(filePath)) {
m_linkedFiles.append(filePath);
emit linkedFilesChanged();
Expand Down
4 changes: 2 additions & 2 deletions ChatView/ClientInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,11 @@ QString ClientInterface::getCurrentFileContext() const
}

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

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

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

return QString("Current file context:\n%1\nFile content:\n%2").arg(fileInfo, content);
}
Expand Down
2 changes: 1 addition & 1 deletion context/ContextManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ ProgrammingLanguage ContextManager::getDocumentLanguage(const QJsonObject &reque
filePath);

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

Expand Down
4 changes: 2 additions & 2 deletions settings/ProjectSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ ProjectSettings::ProjectSettings(ProjectExplorer::Project *project)
chatHistoryPath.setExpectedKind(Utils::PathChooser::ExistingDirectory);
chatHistoryPath.setLabelText(Tr::tr("Chat History Path:"));

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

chatHistoryPath.setDefaultValue(projectChatHistoryPath);

Expand Down