Merge pull request #4012 from zhaowenlan1779/ui-retext

citra_qt: UI text improvements
This commit is contained in:
James Rowe 2018-08-13 23:31:39 -06:00 committed by GitHub
commit aed15a8d9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 79 additions and 92 deletions

View File

@ -78,36 +78,20 @@ enum class CalloutFlag : uint32_t {
Telemetry = 0x1, Telemetry = 0x1,
}; };
static void ShowCalloutMessage(const QString& message, CalloutFlag flag) { void GMainWindow::ShowTelemetryCallout() {
if (UISettings::values.callout_flags & static_cast<uint32_t>(flag)) { if (UISettings::values.callout_flags & static_cast<uint32_t>(CalloutFlag::Telemetry)) {
return; return;
} }
UISettings::values.callout_flags |= static_cast<uint32_t>(flag); UISettings::values.callout_flags |= static_cast<uint32_t>(CalloutFlag::Telemetry);
QMessageBox msg;
msg.setText(message);
msg.setStandardButtons(QMessageBox::Ok);
msg.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
msg.setStyleSheet("QLabel{min-width: 900px;}");
msg.exec();
}
void GMainWindow::ShowCallouts() {
static const QString telemetry_message = static const QString telemetry_message =
tr("To help improve Citra, the Citra Team collects anonymous usage data. No private or " tr("<a href='https://citra-emu.org/entry/telemetry-and-why-thats-a-good-thing/'>Anonymous "
"personally identifying information is collected. This data helps us to understand how " "data is collected</a> to help improve Citra. "
"people use Citra and prioritize our efforts. Furthermore, it helps us to more easily " "<br/><br/>Would you like to share your usage data with us?");
"identify emulation bugs and performance issues. This data includes:<ul><li>Information" if (QMessageBox::question(this, tr("Telemetry"), telemetry_message) != QMessageBox::Yes) {
" about the version of Citra you are using</li><li>Performance data about the games you " Settings::values.enable_telemetry = false;
"play</li><li>Your configuration settings</li><li>Information about your computer " Settings::Apply();
"hardware</li><li>Emulation errors and crash information</li></ul>By default, this " }
"feature is enabled. To disable this feature, click 'Emulation' from the menu and then "
"select 'Configure...'. Then, on the 'Web' tab, uncheck 'Share anonymous usage data with"
" the Citra team'. <br/><br/>By using this software, you agree to the above terms.<br/>"
"<br/><a href='https://citra-emu.org/entry/telemetry-and-why-thats-a-good-thing/'>Learn "
"more</a>");
ShowCalloutMessage(telemetry_message, CalloutFlag::Telemetry);
} }
const int GMainWindow::max_recent_files_item; const int GMainWindow::max_recent_files_item;
@ -160,7 +144,7 @@ GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) {
game_list->PopulateAsync(UISettings::values.game_dirs); game_list->PopulateAsync(UISettings::values.game_dirs);
// Show one-time "callout" messages to the user // Show one-time "callout" messages to the user
ShowCallouts(); ShowTelemetryCallout();
if (UISettings::values.check_for_update_on_start) { if (UISettings::values.check_for_update_on_start) {
CheckForUpdates(); CheckForUpdates();
@ -606,10 +590,9 @@ void GMainWindow::OnUpdateFound(bool found, bool error) {
void GMainWindow::ShowUpdatePrompt() { void GMainWindow::ShowUpdatePrompt() {
defer_update_prompt = false; defer_update_prompt = false;
auto result = QMessageBox::question( auto result =
this, tr("Update available!"), QMessageBox::question(this, tr("Update Available"),
tr("An update for Citra is available. Do you wish to install it now?<br /><br />" tr("An update is available. Would you like to install it now?"),
"This <b>will</b> terminate emulation, if it is running."),
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
if (result == QMessageBox::Yes) { if (result == QMessageBox::Yes) {
@ -619,7 +602,7 @@ void GMainWindow::ShowUpdatePrompt() {
} }
void GMainWindow::ShowNoUpdatePrompt() { void GMainWindow::ShowNoUpdatePrompt() {
QMessageBox::information(this, tr("No update found"), tr("No update has been found for Citra."), QMessageBox::information(this, tr("No Update Found"), tr("No update is found."),
QMessageBox::Ok, QMessageBox::Ok); QMessageBox::Ok, QMessageBox::Ok);
} }
@ -636,7 +619,7 @@ bool GMainWindow::LoadROM(const QString& filename) {
render_window->MakeCurrent(); render_window->MakeCurrent();
if (!gladLoadGL()) { if (!gladLoadGL()) {
QMessageBox::critical(this, tr("Error while initializing OpenGL 3.3 Core!"), QMessageBox::critical(this, tr("OpenGL 3.3 Unsupported"),
tr("Your GPU may not support OpenGL 3.3, or you do not " tr("Your GPU may not support OpenGL 3.3, or you do not "
"have the latest graphics driver.")); "have the latest graphics driver."));
return false; return false;
@ -650,44 +633,53 @@ bool GMainWindow::LoadROM(const QString& filename) {
switch (result) { switch (result) {
case Core::System::ResultStatus::ErrorGetLoader: case Core::System::ResultStatus::ErrorGetLoader:
LOG_CRITICAL(Frontend, "Failed to obtain loader for {}!", filename.toStdString()); LOG_CRITICAL(Frontend, "Failed to obtain loader for {}!", filename.toStdString());
QMessageBox::critical(this, tr("Error while loading ROM!"), QMessageBox::critical(
tr("The ROM format is not supported.")); this, tr("Invalid ROM Format"),
tr("Your ROM format is not supported.<br/>Please follow the guides to redump your "
"<a href='https://citra-emu.org/wiki/dumping-game-cartridges/'>game "
"cartridges</a> or "
"<a href='https://citra-emu.org/wiki/dumping-installed-titles/'>installed "
"titles</a>."));
break; break;
case Core::System::ResultStatus::ErrorSystemMode: case Core::System::ResultStatus::ErrorSystemMode:
LOG_CRITICAL(Frontend, "Failed to load ROM!"); LOG_CRITICAL(Frontend, "Failed to load ROM!");
QMessageBox::critical(this, tr("Error while loading ROM!"), QMessageBox::critical(
tr("Could not determine the system mode.")); this, tr("ROM Corrupted"),
tr("Your ROM is corrupted. <br/>Please follow the guides to redump your "
"<a href='https://citra-emu.org/wiki/dumping-game-cartridges/'>game "
"cartridges</a> or "
"<a href='https://citra-emu.org/wiki/dumping-installed-titles/'>installed "
"titles</a>."));
break; break;
case Core::System::ResultStatus::ErrorLoader_ErrorEncrypted: { case Core::System::ResultStatus::ErrorLoader_ErrorEncrypted: {
QMessageBox::critical( QMessageBox::critical(
this, tr("Error while loading ROM!"), this, tr("ROM Encrypted"),
tr("The game that you are trying to load must be decrypted before being used with " tr("Your ROM is encrypted. <br/>Please follow the guides to redump your "
"Citra. A real 3DS is required.<br/><br/>" "<a href='https://citra-emu.org/wiki/dumping-game-cartridges/'>game "
"For more information on dumping and decrypting games, please see the following " "cartridges</a> or "
"wiki pages: <ul>" "<a href='https://citra-emu.org/wiki/dumping-installed-titles/'>installed "
"<li><a href='https://citra-emu.org/wiki/dumping-game-cartridges/'>Dumping Game " "titles</a>."));
"Cartridges</a></li>"
"<li><a href='https://citra-emu.org/wiki/dumping-installed-titles/'>Dumping "
"Installed Titles</a></li>"
"</ul>"));
break; break;
} }
case Core::System::ResultStatus::ErrorLoader_ErrorInvalidFormat: case Core::System::ResultStatus::ErrorLoader_ErrorInvalidFormat:
QMessageBox::critical(this, tr("Error while loading ROM!"), QMessageBox::critical(
tr("The ROM format is not supported.")); this, tr("Invalid ROM Format"),
tr("Your ROM format is not supported.<br/>Please follow the guides to redump your "
"<a href='https://citra-emu.org/wiki/dumping-game-cartridges/'>game "
"cartridges</a> or "
"<a href='https://citra-emu.org/wiki/dumping-installed-titles/'>installed "
"titles</a>."));
break; break;
case Core::System::ResultStatus::ErrorVideoCore: case Core::System::ResultStatus::ErrorVideoCore:
QMessageBox::critical( QMessageBox::critical(
this, tr("An error occured in the video core."), this, tr("Video Core Error"),
tr("Citra has encountered an error while running the video core, please see the " tr("An error has occured. Please <a "
"log for more details." "href='https://community.citra-emu.org/t/how-to-upload-the-log-file/296'>see "
"For more information on accessing the log, please see the following page: " "the "
"<a href='https://community.citra-emu.org/t/how-to-upload-the-log-file/296'>How " "log</a> for more details. "
"to "
"Upload the Log File</a>."
"Ensure that you have the latest graphics drivers for your GPU.")); "Ensure that you have the latest graphics drivers for your GPU."));
break; break;
@ -1076,12 +1068,9 @@ void GMainWindow::OnMenuReportCompatibility() {
CompatDB compatdb{this}; CompatDB compatdb{this};
compatdb.exec(); compatdb.exec();
} else { } else {
QMessageBox::critical( QMessageBox::critical(this, tr("Missing Citra Account"),
this, tr("Missing Citra Account"), tr("You must link your Citra account to submit test cases."
tr("In order to submit a game compatibility test case, you must link your Citra " "<br/>Go to Emulation &gt; Configure... &gt; Web to do so."));
"account.<br><br/>To link your Citra account, go to Emulation &gt; Configuration "
"&gt; "
"Web."));
} }
} }
@ -1249,53 +1238,52 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string det
QMessageBox::StandardButton answer; QMessageBox::StandardButton answer;
QString status_message; QString status_message;
const QString common_message = const QString common_message =
tr("The game you are trying to load requires additional files from your 3DS to be dumped " tr("%1 is missing. Please <a "
"before playing.<br/><br/>For more information on dumping these files, please see the "
"following wiki page: <a "
"href='https://citra-emu.org/wiki/" "href='https://citra-emu.org/wiki/"
"dumping-system-archives-and-the-shared-fonts-from-a-3ds-console/'>Dumping System " "dumping-system-archives-and-the-shared-fonts-from-a-3ds-console/'>dump your "
"Archives and the Shared Fonts from a 3DS Console</a>.<br/><br/>Would you like to quit " "system archives</a>.<br/>Continuing emulation may result in crashes and bugs.");
"back to the game list? Continuing emulation may result in crashes, corrupted save " QString title, message;
"data, or other bugs.");
switch (result) { switch (result) {
case Core::System::ResultStatus::ErrorSystemFiles: { case Core::System::ResultStatus::ErrorSystemFiles: {
QString message = "Citra was unable to locate a 3DS system archive";
if (!details.empty()) { if (!details.empty()) {
message.append(tr(": %1. ").arg(details.c_str())); message = common_message.arg(QString::fromStdString(details));
} else { } else {
message.append(". "); message = common_message.arg("A system archive");
} }
message.append(common_message);
answer = QMessageBox::question(this, tr("System Archive Not Found"), message, title = tr("System Archive Not Found");
QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
status_message = "System Archive Missing"; status_message = "System Archive Missing";
break; break;
} }
case Core::System::ResultStatus::ErrorSharedFont: { case Core::System::ResultStatus::ErrorSharedFont: {
QString message = tr("Citra was unable to locate the 3DS shared fonts. "); message = tr("Shared fonts not found. ");
message.append(common_message); message.append(common_message);
answer = QMessageBox::question(this, tr("Shared Fonts Not Found"), message, title = tr("Shared Fonts Not Found");
QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
status_message = "Shared Font Missing"; status_message = "Shared Font Missing";
break; break;
} }
default: default:
answer = QMessageBox::question( title = tr("Fatal Error");
this, tr("Fatal Error"), message =
tr("Citra has encountered a fatal error, please see the log for more details. " tr("A fatal error occured. "
"For more information on accessing the log, please see the following page: " "<a href='https://community.citra-emu.org/t/how-to-upload-the-log-file/296'>Check "
"<a href='https://community.citra-emu.org/t/how-to-upload-the-log-file/296'>How to " "the log</a> for details."
"Upload the Log File</a>.<br/><br/>Would you like to quit back to the game list? " "<br/>Continuing emulation may result in crashes and bugs.");
"Continuing emulation may result in crashes, corrupted save data, or other bugs."),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
status_message = "Fatal Error encountered"; status_message = "Fatal Error encountered";
break; break;
} }
if (answer == QMessageBox::Yes) { QMessageBox message_box;
message_box.setWindowTitle(title);
message_box.setText(message);
message_box.setIcon(QMessageBox::Icon::Critical);
QPushButton* continue_button = message_box.addButton(tr("Continue"), QMessageBox::RejectRole);
QPushButton* abort_button = message_box.addButton(tr("Abort"), QMessageBox::AcceptRole);
message_box.exec();
if (message_box.clickedButton() == abort_button) {
if (emu_thread) { if (emu_thread) {
ShutdownGame(); ShutdownGame();
} }
@ -1319,7 +1307,7 @@ bool GMainWindow::ConfirmClose() {
return true; return true;
QMessageBox::StandardButton answer = QMessageBox::StandardButton answer =
QMessageBox::question(this, tr("Citra"), tr("Are you sure you want to close Citra?"), QMessageBox::question(this, tr("Citra"), tr("Would you like to exit now?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No); QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
return answer != QMessageBox::No; return answer != QMessageBox::No;
} }
@ -1386,8 +1374,7 @@ bool GMainWindow::ConfirmChangeGame() {
return true; return true;
auto answer = QMessageBox::question( auto answer = QMessageBox::question(
this, tr("Citra"), this, tr("Citra"), tr("The game is still running. Would you like to stop emulation?"),
tr("Are you sure you want to stop the emulation? Any unsaved progress will be lost."),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No); QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
return answer != QMessageBox::No; return answer != QMessageBox::No;
} }

View File

@ -103,7 +103,7 @@ private:
void BootGame(const QString& filename); void BootGame(const QString& filename);
void ShutdownGame(); void ShutdownGame();
void ShowCallouts(); void ShowTelemetryCallout();
void ShowUpdaterWidgets(); void ShowUpdaterWidgets();
void ShowUpdatePrompt(); void ShowUpdatePrompt();
void ShowNoUpdatePrompt(); void ShowNoUpdatePrompt();