Locale conversion fix (#10007)

Resolves: #9579

Convert filenames to/from utf-8

<!-- Use "x" to fill the checkboxes below like [x] -->

- [x] I signed [CLA](https://www.audacityteam.org/cla/)
- [x] The title of the pull request describes an issue it addresses
- [x] If changes are extensive, then there is a sequence of easily
reviewable commits
- [x] Each commit's message describes its purpose and effects
- [x] There are no behavior changes unnecessary for the stated purpose
of the PR

Recommended:
- [x] Each commit compiles and runs on my machine without known
undesirable changes of behavior

QA:

- [ ] Autobot test cases have been run
This commit is contained in:
Dmitry Makarenko 2025-12-05 15:05:03 +03:00 committed by GitHub
commit 3bc8fc2d37
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 11 additions and 11 deletions

View File

@ -5,6 +5,7 @@
#include <QCoreApplication>
#include "progressdialog.h"
#include "wxtypes_convert.h"
ProgressDialog::ProgressDialog(const std::string& title)
: m_progressTitle{title}
@ -15,7 +16,7 @@ ProgressDialog::ProgressDialog(const std::string& title)
}
ProgressDialog::ProgressDialog(const TranslatableString& title)
: ProgressDialog{title.Translation().ToStdString()}
: ProgressDialog{au::au3::wxToStdSting(title.Translation())}
{
}
@ -30,7 +31,7 @@ void ProgressDialog::Reinit()
void ProgressDialog::SetDialogTitle(const TranslatableString& title)
{
m_progressTitle = title.Translation().ToStdString();
m_progressTitle = au::au3::wxToStdSting(title.Translation());
}
ProgressResult ProgressDialog::Poll(unsigned long long numerator, unsigned long long denominator, const TranslatableString& message)
@ -46,7 +47,7 @@ ProgressResult ProgressDialog::Poll(unsigned long long numerator, unsigned long
}
if (!message.empty()) {
m_progressMessage = message.Translation().ToStdString();
m_progressMessage = au::au3::wxToStdSting(message.Translation());
}
if (m_progress.progress(numerator, denominator, m_progressMessage)) {
@ -61,5 +62,5 @@ ProgressResult ProgressDialog::Poll(unsigned long long numerator, unsigned long
void ProgressDialog::SetMessage(const TranslatableString& message)
{
m_progressMessage = message.Translation().ToStdString();
m_progressMessage = au::au3::wxToStdSting(message.Translation());
}

View File

@ -27,7 +27,7 @@ inline wxString wxFromString(const muse::String& s)
inline wxString wxFromStdString(const std::string& s)
{
return wxString(s);
return wxString::FromUTF8(s);
}
#ifndef NO_QT_SUPPORT

View File

@ -57,14 +57,11 @@ check_include_file(unistd.h HAVE_UNISTD_H)
list( APPEND OPTIONS
PRIVATE
$<$<CXX_COMPILER_ID:AppleClang,Clang,GNU>:
-O3
-fcheck-new
-Wno-unused-parameter
-Wno-unused-variable
-Wno-unused-function
>
$<$<CXX_COMPILER_ID:MSVC>:
/O2
/wd4100
/wd4505
>

View File

@ -14,6 +14,7 @@
#include "modules/import-export/RegisterExportPlugins.h"
#include "au3wrap/au3types.h"
#include "au3wrap/internal/wxtypes_convert.h"
#include "translation.h"
@ -108,7 +109,7 @@ muse::Ret Au3Exporter::exportData(std::string filename)
filePath = filePath.appendingSuffix(defaultExtension);
}
wxFileName wxfilename = wxString(filePath.toStdString());
wxFileName wxfilename = wxFromString(filePath.toString());
Au3Project* project = reinterpret_cast<Au3Project*>(globalContext()->currentProject()->au3ProjectPtr());
IF_ASSERT_FAILED(project) {

View File

@ -10,6 +10,7 @@
#include "libraries/lib-label-track/LabelTrack.h"
#include "au3wrap/au3types.h"
#include "au3wrap/internal/wxtypes_convert.h"
using namespace au::au3;
using namespace au::importexport;
@ -46,7 +47,7 @@ muse::Ret Au3LabelsExporter::exportData(const muse::io::path_t& filePath, const
return muse::make_ret(muse::Ret::Code::InternalError);
}
wxTextFile textFile(wxString(filePath.toStdString()));
wxTextFile textFile(wxFromString(filePath.toString()));
bool open = false;
if (textFile.Exists()) {

View File

@ -125,7 +125,7 @@ void au::importexport::Au3Importer::addImportedTracks(const muse::io::path_t& fi
std::vector<Track*> results;
wxFileName fn(fileName.toStdString());
wxFileName fn(wxFromString(fileName.toString()));
double newRate = 0;
wxString trackNameBase = fn.GetName();