summaryrefslogtreecommitdiffstats
path: root/Source/QtDialog/CMakeSetup.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/QtDialog/CMakeSetup.cxx')
-rw-r--r--Source/QtDialog/CMakeSetup.cxx43
1 files changed, 13 insertions, 30 deletions
diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx
index c556049..fb12b7d 100644
--- a/Source/QtDialog/CMakeSetup.cxx
+++ b/Source/QtDialog/CMakeSetup.cxx
@@ -10,15 +10,6 @@
#include <QTranslator>
#include <QtPlugin>
-// FIXME(#23565): Qt6 has QTextCodec in Core5Compat, but using its
-// `setCodecForLocale` does not make cmake-gui support non-ASCII chars
-// on Windows. For now we only support them with Qt5. How do we support
-// them with Qt6, preferably without Core5Compat?
-#if defined(Q_OS_WIN) && (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
-# include <QTextCodec>
-# define CMAKE_HAVE_QTEXTCODEC
-#endif
-
#include "cmsys/CommandLineArguments.hxx"
#include "cmsys/Encoding.hxx"
#include "cmsys/SystemTools.hxx"
@@ -133,11 +124,6 @@ int main(int argc, char** argv)
setlocale(LC_NUMERIC, "C");
-#ifdef CMAKE_HAVE_QTEXTCODEC
- QTextCodec* utf8_codec = QTextCodec::codecForName("UTF-8");
- QTextCodec::setCodecForLocale(utf8_codec);
-#endif
-
// tell the cmake library where cmake is
QDir cmExecDir(QApplication::applicationDirPath());
#if defined(Q_OS_MAC)
@@ -146,7 +132,7 @@ int main(int argc, char** argv)
// pick up translation files if they exists in the data directory
QDir translationsDir = cmExecDir;
- translationsDir.cd(QString::fromLocal8Bit(".." CMAKE_DATA_DIR));
+ translationsDir.cd(".." CMAKE_DATA_DIR);
translationsDir.cd("i18n");
QTranslator translator;
if (translator.load(QLocale(), "cmake", "_", translationsDir.path())) {
@@ -185,8 +171,7 @@ int main(int argc, char** argv)
}
}
- sourceDirectory =
- cmSystemTools::CollapseFullPath(path.toLocal8Bit().data());
+ sourceDirectory = cmSystemTools::CollapseFullPath(path.toStdString());
cmSystemTools::ConvertToUnixSlashes(sourceDirectory);
} else if (arg.startsWith("-B")) {
QString path = arg.mid(2);
@@ -203,8 +188,7 @@ int main(int argc, char** argv)
}
}
- binaryDirectory =
- cmSystemTools::CollapseFullPath(path.toLocal8Bit().data());
+ binaryDirectory = cmSystemTools::CollapseFullPath(path.toStdString());
cmSystemTools::ConvertToUnixSlashes(binaryDirectory);
} else if (arg.startsWith("--preset=")) {
QString preset = arg.mid(cmStrLen("--preset="));
@@ -212,7 +196,7 @@ int main(int argc, char** argv)
std::cerr << "No preset specified for --preset" << std::endl;
return 1;
}
- presetName = preset.toLocal8Bit().data();
+ presetName = preset.toStdString();
} else if (arg == "--browse-manual") {
OpenReferenceManual();
return 0;
@@ -220,21 +204,20 @@ int main(int argc, char** argv)
}
if (!sourceDirectory.empty() &&
(!binaryDirectory.empty() || !presetName.empty())) {
- dialog.setSourceDirectory(QString::fromLocal8Bit(sourceDirectory.c_str()));
+ dialog.setSourceDirectory(QString::fromStdString(sourceDirectory));
if (!binaryDirectory.empty()) {
- dialog.setBinaryDirectory(
- QString::fromLocal8Bit(binaryDirectory.c_str()));
+ dialog.setBinaryDirectory(QString::fromStdString(binaryDirectory));
if (!presetName.empty()) {
dialog.setStartupBinaryDirectory(true);
}
}
if (!presetName.empty()) {
- dialog.setDeferredPreset(QString::fromLocal8Bit(presetName.c_str()));
+ dialog.setDeferredPreset(QString::fromStdString(presetName));
}
} else {
if (args.count() == 2) {
std::string filePath =
- cmSystemTools::CollapseFullPath(args[1].toLocal8Bit().data());
+ cmSystemTools::CollapseFullPath(args[1].toStdString());
// check if argument is a directory containing CMakeCache.txt
std::string buildFilePath = cmStrCat(filePath, "/CMakeCache.txt");
@@ -249,12 +232,12 @@ int main(int argc, char** argv)
std::string srcFilePath = cmStrCat(filePath, "/CMakeLists.txt");
if (cmSystemTools::FileExists(buildFilePath.c_str())) {
- dialog.setBinaryDirectory(QString::fromLocal8Bit(
- cmSystemTools::GetFilenamePath(buildFilePath).c_str()));
+ dialog.setBinaryDirectory(QString::fromStdString(
+ cmSystemTools::GetFilenamePath(buildFilePath)));
} else if (cmSystemTools::FileExists(srcFilePath.c_str())) {
- dialog.setSourceDirectory(QString::fromLocal8Bit(filePath.c_str()));
- dialog.setBinaryDirectory(QString::fromLocal8Bit(
- cmSystemTools::CollapseFullPath(".").c_str()));
+ dialog.setSourceDirectory(QString::fromStdString(filePath));
+ dialog.setBinaryDirectory(
+ QString::fromStdString(cmSystemTools::CollapseFullPath(".")));
}
}
}