mirror of
https://github.com/PabloMK7/citra
synced 2024-11-15 05:08:23 +00:00
yuzu/main: Specify string conversions explicitly
This commit is contained in:
parent
5f20bf0e10
commit
4b7a45ccc7
3 changed files with 140 additions and 113 deletions
|
@ -235,12 +235,15 @@ void Config::ReadControlValues() {
|
|||
}
|
||||
|
||||
void Config::ReadUtilityValues() {
|
||||
qt_config->beginGroup("Utility");
|
||||
qt_config->beginGroup(QStringLiteral("Utility"));
|
||||
|
||||
Settings::values.dump_textures = ReadSetting("dump_textures", false).toBool();
|
||||
Settings::values.custom_textures = ReadSetting("custom_textures", false).toBool();
|
||||
Settings::values.preload_textures = ReadSetting("preload_textures", false).toBool();
|
||||
Settings::values.use_disk_shader_cache = ReadSetting("use_disk_shader_cache", true).toBool();
|
||||
Settings::values.dump_textures = ReadSetting(QStringLiteral("dump_textures"), false).toBool();
|
||||
Settings::values.custom_textures =
|
||||
ReadSetting(QStringLiteral("custom_textures"), false).toBool();
|
||||
Settings::values.preload_textures =
|
||||
ReadSetting(QStringLiteral("preload_textures"), false).toBool();
|
||||
Settings::values.use_disk_shader_cache =
|
||||
ReadSetting(QStringLiteral("use_disk_shader_cache"), true).toBool();
|
||||
|
||||
qt_config->endGroup();
|
||||
}
|
||||
|
@ -711,12 +714,13 @@ void Config::SaveControlValues() {
|
|||
}
|
||||
|
||||
void Config::SaveUtilityValues() {
|
||||
qt_config->beginGroup("Utility");
|
||||
qt_config->beginGroup(QStringLiteral("Utility"));
|
||||
|
||||
WriteSetting("dump_textures", Settings::values.dump_textures, false);
|
||||
WriteSetting("custom_textures", Settings::values.custom_textures, false);
|
||||
WriteSetting("preload_textures", Settings::values.preload_textures, false);
|
||||
WriteSetting("use_disk_shader_cache", Settings::values.use_disk_shader_cache, true);
|
||||
WriteSetting(QStringLiteral("dump_textures"), Settings::values.dump_textures, false);
|
||||
WriteSetting(QStringLiteral("custom_textures"), Settings::values.custom_textures, false);
|
||||
WriteSetting(QStringLiteral("preload_textures"), Settings::values.preload_textures, false);
|
||||
WriteSetting(QStringLiteral("use_disk_shader_cache"), Settings::values.use_disk_shader_cache,
|
||||
true);
|
||||
|
||||
qt_config->endGroup();
|
||||
}
|
||||
|
|
|
@ -277,7 +277,7 @@ void GMainWindow::InitializeWidgets() {
|
|||
statusBar()->setVisible(true);
|
||||
|
||||
// Removes an ugly inner border from the status bar widgets under Linux
|
||||
setStyleSheet("QStatusBar::item{border: none;}");
|
||||
setStyleSheet(QStringLiteral("QStatusBar::item{border: none;}"));
|
||||
|
||||
QActionGroup* actionGroup_ScreenLayouts = new QActionGroup(this);
|
||||
actionGroup_ScreenLayouts->addAction(ui.action_Screen_Layout_Default);
|
||||
|
@ -385,26 +385,35 @@ void GMainWindow::InitializeRecentFileMenuActions() {
|
|||
void GMainWindow::InitializeHotkeys() {
|
||||
hotkey_registry.LoadHotkeys();
|
||||
|
||||
const QString main_window = QStringLiteral("Main Window");
|
||||
const QString load_file = QStringLiteral("Load File");
|
||||
const QString exit_citra = QStringLiteral("Exit Citra");
|
||||
const QString stop_emulation = QStringLiteral("Stop Emulation");
|
||||
const QString toggle_filter_bar = QStringLiteral("Toggle Filter Bar");
|
||||
const QString toggle_status_bar = QStringLiteral("Toggle Status Bar");
|
||||
const QString fullscreen = QStringLiteral("Fullscreen");
|
||||
|
||||
ui.action_Show_Filter_Bar->setShortcut(
|
||||
hotkey_registry.GetKeySequence("Main Window", "Toggle Filter Bar"));
|
||||
hotkey_registry.GetKeySequence(main_window, toggle_filter_bar));
|
||||
ui.action_Show_Filter_Bar->setShortcutContext(
|
||||
hotkey_registry.GetShortcutContext("Main Window", "Toggle Filter Bar"));
|
||||
hotkey_registry.GetShortcutContext(main_window, toggle_filter_bar));
|
||||
|
||||
ui.action_Show_Status_Bar->setShortcut(
|
||||
hotkey_registry.GetKeySequence("Main Window", "Toggle Status Bar"));
|
||||
hotkey_registry.GetKeySequence(main_window, toggle_status_bar));
|
||||
ui.action_Show_Status_Bar->setShortcutContext(
|
||||
hotkey_registry.GetShortcutContext("Main Window", "Toggle Status Bar"));
|
||||
hotkey_registry.GetShortcutContext(main_window, toggle_status_bar));
|
||||
|
||||
connect(hotkey_registry.GetHotkey("Main Window", "Load File", this), &QShortcut::activated,
|
||||
connect(hotkey_registry.GetHotkey(main_window, load_file, this), &QShortcut::activated,
|
||||
ui.action_Load_File, &QAction::trigger);
|
||||
|
||||
connect(hotkey_registry.GetHotkey("Main Window", "Stop Emulation", this), &QShortcut::activated,
|
||||
connect(hotkey_registry.GetHotkey(main_window, stop_emulation, this), &QShortcut::activated,
|
||||
ui.action_Stop, &QAction::trigger);
|
||||
|
||||
connect(hotkey_registry.GetHotkey("Main Window", "Exit Citra", this), &QShortcut::activated,
|
||||
connect(hotkey_registry.GetHotkey(main_window, exit_citra, this), &QShortcut::activated,
|
||||
ui.action_Exit, &QAction::trigger);
|
||||
|
||||
connect(hotkey_registry.GetHotkey("Main Window", "Continue/Pause Emulation", this),
|
||||
connect(
|
||||
hotkey_registry.GetHotkey(main_window, QStringLiteral("Continue/Pause Emulation"), this),
|
||||
&QShortcut::activated, this, [&] {
|
||||
if (emulation_running) {
|
||||
if (emu_thread->IsRunning()) {
|
||||
|
@ -414,71 +423,73 @@ void GMainWindow::InitializeHotkeys() {
|
|||
}
|
||||
}
|
||||
});
|
||||
connect(hotkey_registry.GetHotkey("Main Window", "Restart Emulation", this),
|
||||
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Restart Emulation"), this),
|
||||
&QShortcut::activated, this, [this] {
|
||||
if (!Core::System::GetInstance().IsPoweredOn())
|
||||
return;
|
||||
BootGame(QString(game_path));
|
||||
});
|
||||
connect(hotkey_registry.GetHotkey("Main Window", "Swap Screens", render_window),
|
||||
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Swap Screens"), render_window),
|
||||
&QShortcut::activated, ui.action_Screen_Layout_Swap_Screens, &QAction::trigger);
|
||||
connect(hotkey_registry.GetHotkey("Main Window", "Rotate Screens Upright", render_window),
|
||||
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Rotate Screens Upright"),
|
||||
render_window),
|
||||
&QShortcut::activated, ui.action_Screen_Layout_Upright_Screens, &QAction::trigger);
|
||||
connect(hotkey_registry.GetHotkey("Main Window", "Toggle Screen Layout", render_window),
|
||||
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Toggle Screen Layout"),
|
||||
render_window),
|
||||
&QShortcut::activated, this, &GMainWindow::ToggleScreenLayout);
|
||||
connect(hotkey_registry.GetHotkey("Main Window", "Fullscreen", render_window),
|
||||
connect(hotkey_registry.GetHotkey(main_window, fullscreen, render_window),
|
||||
&QShortcut::activated, ui.action_Fullscreen, &QAction::trigger);
|
||||
connect(hotkey_registry.GetHotkey("Main Window", "Fullscreen", render_window),
|
||||
connect(hotkey_registry.GetHotkey(main_window, fullscreen, render_window),
|
||||
&QShortcut::activatedAmbiguously, ui.action_Fullscreen, &QAction::trigger);
|
||||
connect(hotkey_registry.GetHotkey("Main Window", "Exit Fullscreen", this),
|
||||
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Exit Fullscreen"), this),
|
||||
&QShortcut::activated, this, [&] {
|
||||
if (emulation_running) {
|
||||
ui.action_Fullscreen->setChecked(false);
|
||||
ToggleFullscreen();
|
||||
}
|
||||
});
|
||||
connect(hotkey_registry.GetHotkey("Main Window", "Toggle Speed Limit", this),
|
||||
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Toggle Speed Limit"), this),
|
||||
&QShortcut::activated, this, [&] {
|
||||
Settings::values.use_frame_limit = !Settings::values.use_frame_limit;
|
||||
UpdateStatusBar();
|
||||
});
|
||||
connect(hotkey_registry.GetHotkey("Main Window", "Toggle Texture Dumping", this),
|
||||
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Toggle Texture Dumping"), this),
|
||||
&QShortcut::activated, this,
|
||||
[&] { Settings::values.dump_textures = !Settings::values.dump_textures; });
|
||||
// We use "static" here in order to avoid capturing by lambda due to a MSVC bug, which makes
|
||||
// the variable hold a garbage value after this function exits
|
||||
static constexpr u16 SPEED_LIMIT_STEP = 5;
|
||||
connect(hotkey_registry.GetHotkey("Main Window", "Increase Speed Limit", this),
|
||||
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Increase Speed Limit"), this),
|
||||
&QShortcut::activated, this, [&] {
|
||||
if (Settings::values.frame_limit < 9999 - SPEED_LIMIT_STEP) {
|
||||
Settings::values.frame_limit += SPEED_LIMIT_STEP;
|
||||
UpdateStatusBar();
|
||||
}
|
||||
});
|
||||
connect(hotkey_registry.GetHotkey("Main Window", "Decrease Speed Limit", this),
|
||||
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Decrease Speed Limit"), this),
|
||||
&QShortcut::activated, this, [&] {
|
||||
if (Settings::values.frame_limit > SPEED_LIMIT_STEP) {
|
||||
Settings::values.frame_limit -= SPEED_LIMIT_STEP;
|
||||
UpdateStatusBar();
|
||||
}
|
||||
});
|
||||
connect(hotkey_registry.GetHotkey("Main Window", "Toggle Frame Advancing", this),
|
||||
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Toggle Frame Advancing"), this),
|
||||
&QShortcut::activated, ui.action_Enable_Frame_Advancing, &QAction::trigger);
|
||||
connect(hotkey_registry.GetHotkey("Main Window", "Advance Frame", this), &QShortcut::activated,
|
||||
ui.action_Advance_Frame, &QAction::trigger);
|
||||
connect(hotkey_registry.GetHotkey("Main Window", "Load Amiibo", this), &QShortcut::activated,
|
||||
this, [&] {
|
||||
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Advance Frame"), this),
|
||||
&QShortcut::activated, ui.action_Advance_Frame, &QAction::trigger);
|
||||
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Load Amiibo"), this),
|
||||
&QShortcut::activated, this, [&] {
|
||||
if (ui.action_Load_Amiibo->isEnabled()) {
|
||||
OnLoadAmiibo();
|
||||
}
|
||||
});
|
||||
connect(hotkey_registry.GetHotkey("Main Window", "Remove Amiibo", this), &QShortcut::activated,
|
||||
this, [&] {
|
||||
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Remove Amiibo"), this),
|
||||
&QShortcut::activated, this, [&] {
|
||||
if (ui.action_Remove_Amiibo->isEnabled()) {
|
||||
OnRemoveAmiibo();
|
||||
}
|
||||
});
|
||||
connect(hotkey_registry.GetHotkey("Main Window", "Capture Screenshot", this),
|
||||
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Capture Screenshot"), this),
|
||||
&QShortcut::activated, this, [&] {
|
||||
if (emu_thread->IsRunning()) {
|
||||
OnCaptureScreenshot();
|
||||
|
@ -617,9 +628,13 @@ void GMainWindow::ConnectMenuEvents() {
|
|||
&MultiplayerState::OnOpenNetworkRoom);
|
||||
|
||||
ui.action_Fullscreen->setShortcut(
|
||||
hotkey_registry.GetHotkey("Main Window", "Fullscreen", this)->key());
|
||||
hotkey_registry
|
||||
.GetHotkey(QStringLiteral("Main Window"), QStringLiteral("Fullscreen"), this)
|
||||
->key());
|
||||
ui.action_Screen_Layout_Swap_Screens->setShortcut(
|
||||
hotkey_registry.GetHotkey("Main Window", "Swap Screens", this)->key());
|
||||
hotkey_registry
|
||||
.GetHotkey(QStringLiteral("Main Window"), QStringLiteral("Swap Screens"), this)
|
||||
->key());
|
||||
ui.action_Screen_Layout_Swap_Screens->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
||||
ui.action_Screen_Layout_Upright_Screens->setShortcut(
|
||||
hotkey_registry.GetHotkey("Main Window", "Rotate Screens Upright", this)->key());
|
||||
|
@ -674,8 +689,9 @@ void GMainWindow::ConnectMenuEvents() {
|
|||
// Help
|
||||
connect(ui.action_Open_Citra_Folder, &QAction::triggered, this,
|
||||
&GMainWindow::OnOpenCitraFolder);
|
||||
connect(ui.action_FAQ, &QAction::triggered,
|
||||
[]() { QDesktopServices::openUrl(QUrl("https://citra-emu.org/wiki/faq/")); });
|
||||
connect(ui.action_FAQ, &QAction::triggered, []() {
|
||||
QDesktopServices::openUrl(QUrl(QStringLiteral("https://citra-emu.org/wiki/faq/")));
|
||||
});
|
||||
connect(ui.action_About, &QAction::triggered, this, &GMainWindow::OnMenuAboutCitra);
|
||||
connect(ui.action_Check_For_Updates, &QAction::triggered, this,
|
||||
&GMainWindow::OnCheckForUpdates);
|
||||
|
@ -890,7 +906,7 @@ bool GMainWindow::LoadROM(const QString& filename) {
|
|||
}
|
||||
|
||||
void GMainWindow::BootGame(const QString& filename) {
|
||||
if (filename.endsWith(".cia")) {
|
||||
if (filename.endsWith(QStringLiteral(".cia"))) {
|
||||
const auto answer = QMessageBox::question(
|
||||
this, tr("CIA must be installed before usage"),
|
||||
tr("Before using this CIA, you must install it. Do you want to install it now?"),
|
||||
|
@ -1067,7 +1083,7 @@ void GMainWindow::UpdateRecentFiles() {
|
|||
std::min(UISettings::values.recent_files.size(), max_recent_files_item);
|
||||
|
||||
for (int i = 0; i < num_recent_files; i++) {
|
||||
const QString text = QString("&%1. %2").arg(i + 1).arg(
|
||||
const QString text = QStringLiteral("&%1. %2").arg(i + 1).arg(
|
||||
QFileInfo(UISettings::values.recent_files[i]).fileName());
|
||||
actions_recent_files[i]->setText(text);
|
||||
actions_recent_files[i]->setData(UISettings::values.recent_files[i]);
|
||||
|
@ -1158,12 +1174,12 @@ void GMainWindow::OnGameListNavigateToGamedbEntry(u64 program_id,
|
|||
|
||||
void GMainWindow::OnGameListOpenDirectory(const QString& directory) {
|
||||
QString path;
|
||||
if (directory == "INSTALLED") {
|
||||
if (directory == QStringLiteral("INSTALLED")) {
|
||||
path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir) +
|
||||
"Nintendo "
|
||||
"3DS/00000000000000000000000000000000/"
|
||||
"00000000000000000000000000000000/title/00040000");
|
||||
} else if (directory == "SYSTEM") {
|
||||
} else if (directory == QStringLiteral("SYSTEM")) {
|
||||
path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir) +
|
||||
"00000000000000000000000000000000/title/00040010");
|
||||
} else {
|
||||
|
@ -1197,8 +1213,8 @@ void GMainWindow::OnGameListShowList(bool show) {
|
|||
};
|
||||
|
||||
void GMainWindow::OnMenuLoadFile() {
|
||||
const QString extensions =
|
||||
QString("*.").append(GameList::supported_file_extensions.join(" *."));
|
||||
const QString extensions = QStringLiteral("*.").append(
|
||||
GameList::supported_file_extensions.join(QStringLiteral(" *.")));
|
||||
const QString file_filter = tr("3DS Executable (%1);;All Files (*.*)",
|
||||
"%1 is an identifier for the 3DS executable file extensions.")
|
||||
.arg(extensions);
|
||||
|
@ -1507,9 +1523,9 @@ void GMainWindow::OnConfigure() {
|
|||
}
|
||||
|
||||
void GMainWindow::OnLoadAmiibo() {
|
||||
const QString extensions{"*.bin"};
|
||||
const QString extensions{QStringLiteral("*.bin")};
|
||||
const QString file_filter = tr("Amiibo File (%1);; All Files (*.*)").arg(extensions);
|
||||
const QString filename = QFileDialog::getOpenFileName(this, tr("Load Amiibo"), "", file_filter);
|
||||
const QString filename = QFileDialog::getOpenFileName(this, tr("Load Amiibo"), {}, file_filter);
|
||||
|
||||
if (filename.isEmpty()) {
|
||||
return;
|
||||
|
@ -1728,7 +1744,7 @@ void GMainWindow::OnCaptureScreenshot() {
|
|||
QFileDialog png_dialog(this, tr("Capture Screenshot"), UISettings::values.screenshot_path,
|
||||
tr("PNG Image (*.png)"));
|
||||
png_dialog.setAcceptMode(QFileDialog::AcceptSave);
|
||||
png_dialog.setDefaultSuffix("png");
|
||||
png_dialog.setDefaultSuffix(QStringLiteral("png"));
|
||||
if (png_dialog.exec()) {
|
||||
const QString path = png_dialog.selectedFiles().first();
|
||||
if (!path.isEmpty()) {
|
||||
|
@ -1821,11 +1837,11 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string det
|
|||
if (!details.empty()) {
|
||||
message = common_message.arg(QString::fromStdString(details));
|
||||
} else {
|
||||
message = common_message.arg("A system archive");
|
||||
message = common_message.arg(tr("A system archive"));
|
||||
}
|
||||
|
||||
title = tr("System Archive Not Found");
|
||||
status_message = "System Archive Missing";
|
||||
status_message = tr("System Archive Missing");
|
||||
} else {
|
||||
title = tr("Fatal Error");
|
||||
message =
|
||||
|
@ -1833,7 +1849,7 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string det
|
|||
"<a href='https://community.citra-emu.org/t/how-to-upload-the-log-file/296'>Check "
|
||||
"the log</a> for details."
|
||||
"<br/>Continuing emulation may result in crashes and bugs.");
|
||||
status_message = "Fatal Error encountered";
|
||||
status_message = tr("Fatal Error encountered");
|
||||
}
|
||||
|
||||
QMessageBox message_box;
|
||||
|
@ -1941,7 +1957,7 @@ bool GMainWindow::DropAction(QDropEvent* event) {
|
|||
const QMimeData* mime_data = event->mimeData();
|
||||
const QString& filename = mime_data->urls().at(0).toLocalFile();
|
||||
|
||||
if (emulation_running && QFileInfo(filename).suffix() == "bin") {
|
||||
if (emulation_running && QFileInfo(filename).suffix() == QStringLiteral("bin")) {
|
||||
// Amiibo
|
||||
LoadAmiibo(filename);
|
||||
} else {
|
||||
|
@ -1981,32 +1997,38 @@ void GMainWindow::filterBarSetChecked(bool state) {
|
|||
}
|
||||
|
||||
void GMainWindow::UpdateUITheme() {
|
||||
const QString default_icons = QStringLiteral(":/icons/default");
|
||||
const QString& current_theme = UISettings::values.theme;
|
||||
const bool is_default_theme = current_theme == QString::fromUtf8(UISettings::themes[0].second);
|
||||
QStringList theme_paths(default_theme_paths);
|
||||
if (UISettings::values.theme != UISettings::themes[0].second &&
|
||||
!UISettings::values.theme.isEmpty()) {
|
||||
const QString theme_uri(":" + UISettings::values.theme + "/style.qss");
|
||||
|
||||
if (is_default_theme || current_theme.isEmpty()) {
|
||||
qApp->setStyleSheet({});
|
||||
setStyleSheet({});
|
||||
theme_paths.append(default_icons);
|
||||
QIcon::setThemeName(default_icons);
|
||||
} else {
|
||||
const QString theme_uri(QLatin1Char{':'} + current_theme + QStringLiteral("/style.qss"));
|
||||
QFile f(theme_uri);
|
||||
if (f.open(QFile::ReadOnly | QFile::Text)) {
|
||||
QTextStream ts(&f);
|
||||
qApp->setStyleSheet(ts.readAll());
|
||||
GMainWindow::setStyleSheet(ts.readAll());
|
||||
setStyleSheet(ts.readAll());
|
||||
} else {
|
||||
LOG_ERROR(Frontend, "Unable to set style, stylesheet file not found");
|
||||
}
|
||||
theme_paths.append(QStringList{":/icons/default", ":/icons/" + UISettings::values.theme});
|
||||
QIcon::setThemeName(":/icons/" + UISettings::values.theme);
|
||||
} else {
|
||||
qApp->setStyleSheet("");
|
||||
GMainWindow::setStyleSheet("");
|
||||
theme_paths.append(QStringList{":/icons/default"});
|
||||
QIcon::setThemeName(":/icons/default");
|
||||
|
||||
const QString theme_name = QStringLiteral(":/icons/") + current_theme;
|
||||
theme_paths.append({default_icons, theme_name});
|
||||
QIcon::setThemeName(theme_name);
|
||||
}
|
||||
|
||||
QIcon::setThemeSearchPaths(theme_paths);
|
||||
}
|
||||
|
||||
void GMainWindow::LoadTranslation() {
|
||||
// If the selected language is English, no need to install any translation
|
||||
if (UISettings::values.language == "en") {
|
||||
if (UISettings::values.language == QStringLiteral("en")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2014,21 +2036,21 @@ void GMainWindow::LoadTranslation() {
|
|||
|
||||
if (UISettings::values.language.isEmpty()) {
|
||||
// If the selected language is empty, use system locale
|
||||
loaded = translator.load(QLocale(), "", "", ":/languages/");
|
||||
loaded = translator.load(QLocale(), {}, {}, QStringLiteral(":/languages/"));
|
||||
} else {
|
||||
// Otherwise load from the specified file
|
||||
loaded = translator.load(UISettings::values.language, ":/languages/");
|
||||
loaded = translator.load(UISettings::values.language, QStringLiteral(":/languages/"));
|
||||
}
|
||||
|
||||
if (loaded) {
|
||||
qApp->installTranslator(&translator);
|
||||
} else {
|
||||
UISettings::values.language = "en";
|
||||
UISettings::values.language = QStringLiteral("en");
|
||||
}
|
||||
}
|
||||
|
||||
void GMainWindow::OnLanguageChanged(const QString& locale) {
|
||||
if (UISettings::values.language != "en") {
|
||||
if (UISettings::values.language != QStringLiteral("en")) {
|
||||
qApp->removeTranslator(&translator);
|
||||
}
|
||||
|
||||
|
@ -2110,8 +2132,8 @@ int main(int argc, char* argv[]) {
|
|||
SCOPE_EXIT({ MicroProfileShutdown(); });
|
||||
|
||||
// Init settings params
|
||||
QCoreApplication::setOrganizationName("Citra team");
|
||||
QCoreApplication::setApplicationName("Citra");
|
||||
QCoreApplication::setOrganizationName(QStringLiteral("Citra team"));
|
||||
QCoreApplication::setApplicationName(QStringLiteral("Citra"));
|
||||
|
||||
QSurfaceFormat format;
|
||||
format.setVersion(3, 3);
|
||||
|
|
|
@ -128,25 +128,25 @@ static QString StringToInputMask(const QString& input) {
|
|||
QString mask = input;
|
||||
|
||||
// ... replace any special characters by their escaped counterparts ...
|
||||
mask.replace("\\", "\\\\");
|
||||
mask.replace("A", "\\A");
|
||||
mask.replace("a", "\\a");
|
||||
mask.replace("N", "\\N");
|
||||
mask.replace("n", "\\n");
|
||||
mask.replace("X", "\\X");
|
||||
mask.replace("x", "\\x");
|
||||
mask.replace("9", "\\9");
|
||||
mask.replace("0", "\\0");
|
||||
mask.replace("D", "\\D");
|
||||
mask.replace("d", "\\d");
|
||||
mask.replace("#", "\\#");
|
||||
mask.replace("H", "\\H");
|
||||
mask.replace("h", "\\h");
|
||||
mask.replace("B", "\\B");
|
||||
mask.replace("b", "\\b");
|
||||
mask.replace(">", "\\>");
|
||||
mask.replace("<", "\\<");
|
||||
mask.replace("!", "\\!");
|
||||
mask.replace(QStringLiteral("\\"), QStringLiteral("\\\\"));
|
||||
mask.replace(QLatin1Char{'A'}, QStringLiteral("\\A"));
|
||||
mask.replace(QLatin1Char{'a'}, QStringLiteral("\\a"));
|
||||
mask.replace(QLatin1Char{'N'}, QStringLiteral("\\N"));
|
||||
mask.replace(QLatin1Char{'n'}, QStringLiteral("\\n"));
|
||||
mask.replace(QLatin1Char{'X'}, QStringLiteral("\\X"));
|
||||
mask.replace(QLatin1Char{'x'}, QStringLiteral("\\x"));
|
||||
mask.replace(QLatin1Char{'9'}, QStringLiteral("\\9"));
|
||||
mask.replace(QLatin1Char{'0'}, QStringLiteral("\\0"));
|
||||
mask.replace(QLatin1Char{'D'}, QStringLiteral("\\D"));
|
||||
mask.replace(QLatin1Char{'d'}, QStringLiteral("\\d"));
|
||||
mask.replace(QLatin1Char{'#'}, QStringLiteral("\\#"));
|
||||
mask.replace(QLatin1Char{'H'}, QStringLiteral("\\H"));
|
||||
mask.replace(QLatin1Char{'h'}, QStringLiteral("\\h"));
|
||||
mask.replace(QLatin1Char{'B'}, QStringLiteral("\\B"));
|
||||
mask.replace(QLatin1Char{'b'}, QStringLiteral("\\b"));
|
||||
mask.replace(QLatin1Char{'>'}, QStringLiteral("\\>"));
|
||||
mask.replace(QLatin1Char{'<'}, QStringLiteral("\\<"));
|
||||
mask.replace(QLatin1Char{'!'}, QStringLiteral("\\!"));
|
||||
|
||||
return mask;
|
||||
}
|
||||
|
@ -160,19 +160,19 @@ void CSpinBox::UpdateText() {
|
|||
|
||||
// For base 10 and negative range, demand a single sign character
|
||||
if (HasSign())
|
||||
mask += "X"; // identified as "-" or "+" in the validator
|
||||
mask.append(QLatin1Char{'X'}); // identified as "-" or "+" in the validator
|
||||
|
||||
// Uppercase digits greater than 9.
|
||||
mask += ">";
|
||||
mask.append(QLatin1Char{'>'});
|
||||
|
||||
// Match num_digits digits
|
||||
// Digits irrelevant to the chosen number base are filtered in the validator
|
||||
mask += QString("H").repeated(std::max(num_digits, 1));
|
||||
mask.append(QStringLiteral("H").repeated(std::max(num_digits, 1)));
|
||||
|
||||
// Switch off case conversion
|
||||
mask += "!";
|
||||
mask.append(QLatin1Char{'!'});
|
||||
|
||||
mask += StringToInputMask(suffix);
|
||||
mask.append(StringToInputMask(suffix));
|
||||
}
|
||||
lineEdit()->setInputMask(mask);
|
||||
|
||||
|
@ -185,8 +185,9 @@ void CSpinBox::UpdateText() {
|
|||
}
|
||||
|
||||
QString CSpinBox::TextFromValue() {
|
||||
return prefix + QString(HasSign() ? ((value < 0) ? "-" : "+") : "") +
|
||||
QString("%1").arg(std::abs(value), num_digits, base, QLatin1Char('0')).toUpper() +
|
||||
return prefix +
|
||||
(HasSign() ? ((value < 0) ? QStringLiteral("-") : QStringLiteral("+")) : QString{}) +
|
||||
QStringLiteral("%1").arg(std::abs(value), num_digits, base, QLatin1Char('0')).toUpper() +
|
||||
suffix;
|
||||
}
|
||||
|
||||
|
@ -224,20 +225,20 @@ QValidator::State CSpinBox::validate(QString& input, int& pos) const {
|
|||
|
||||
// Demand sign character for negative ranges
|
||||
if (HasSign())
|
||||
regexp += "[+\\-]";
|
||||
regexp.append(QStringLiteral("[+\\-]"));
|
||||
|
||||
// Match digits corresponding to the chosen number base.
|
||||
regexp += QString("[0-%1").arg(std::min(base, 9));
|
||||
regexp.append(QStringLiteral("[0-%1").arg(std::min(base, 9)));
|
||||
if (base == 16) {
|
||||
regexp += "a-fA-F";
|
||||
regexp.append(QStringLiteral("a-fA-F"));
|
||||
}
|
||||
regexp += "]";
|
||||
regexp.append(QLatin1Char(']'));
|
||||
|
||||
// Specify number of digits
|
||||
if (num_digits > 0) {
|
||||
regexp += QString("{%1}").arg(num_digits);
|
||||
regexp.append(QStringLiteral("{%1}").arg(num_digits));
|
||||
} else {
|
||||
regexp += "+";
|
||||
regexp.append(QLatin1Char{'+'});
|
||||
}
|
||||
|
||||
// Match string
|
||||
|
|
Loading…
Reference in a new issue