Merge pull request #2015 from Cockatrice/tooomm-tr_tags

fix hardcoded strings
This commit is contained in:
ctrlaltca 2016-06-26 18:52:37 +02:00 committed by GitHub
commit c19f225806
2 changed files with 12 additions and 12 deletions

View file

@ -26,9 +26,9 @@ DlgUpdate::DlgUpdate(QWidget *parent) : QDialog(parent) {
QDialogButtonBox *buttonBox = new QDialogButtonBox(this); QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
ok = new QPushButton("Ok", this); ok = new QPushButton("Ok", this);
manualDownload = new QPushButton("Update Anyway", this); manualDownload = new QPushButton(tr("Update Anyway"), this);
enableUpdateButton(false); //Unless we know there's an update available, you can't install enableUpdateButton(false); //Unless we know there's an update available, you can't install
gotoDownload = new QPushButton("Open Download Page", this); gotoDownload = new QPushButton(tr("Open Download Page"), this);
buttonBox->addButton(manualDownload, QDialogButtonBox::ActionRole); buttonBox->addButton(manualDownload, QDialogButtonBox::ActionRole);
buttonBox->addButton(gotoDownload, QDialogButtonBox::ActionRole); buttonBox->addButton(gotoDownload, QDialogButtonBox::ActionRole);
buttonBox->addButton(ok, QDialogButtonBox::AcceptRole); buttonBox->addButton(ok, QDialogButtonBox::AcceptRole);
@ -84,7 +84,7 @@ void DlgUpdate::gotoDownloadPage() {
} }
void DlgUpdate::downloadUpdate() { void DlgUpdate::downloadUpdate() {
setLabel("Downloading update..."); setLabel(tr("Downloading update..."));
enableOkButton(false); enableOkButton(false);
enableUpdateButton(false); enableUpdateButton(false);
uDownloader->beginDownload(updateUrl); uDownloader->beginDownload(updateUrl);
@ -93,7 +93,7 @@ void DlgUpdate::downloadUpdate() {
void DlgUpdate::beginUpdateCheck() { void DlgUpdate::beginUpdateCheck() {
progress->setMinimum(0); progress->setMinimum(0);
progress->setMaximum(0); progress->setMaximum(0);
setLabel("Checking for updates..."); setLabel(tr("Checking for updates..."));
uChecker->check(); uChecker->check();
} }
@ -103,7 +103,7 @@ void DlgUpdate::finishedUpdateCheck(bool needToUpdate, bool isCompatible, QVaria
//Update the UI to say we've finished //Update the UI to say we've finished
progress->setMaximum(100); progress->setMaximum(100);
setLabel("Finished checking for updates."); setLabel(tr("Finished checking for updates."));
//If there are no available builds, then they can't auto update. //If there are no available builds, then they can't auto update.
enableUpdateButton(isCompatible); enableUpdateButton(isCompatible);
@ -130,7 +130,7 @@ void DlgUpdate::finishedUpdateCheck(bool needToUpdate, bool isCompatible, QVaria
} }
else else
{ {
QMessageBox::information(this, "Cockatrice Update", QMessageBox::information(this, tr("Cockatrice Update"),
tr("Your version of Cockatrice is out of date, but there are no packages" tr("Your version of Cockatrice is out of date, but there are no packages"
" available for your operating system. You may have to use a developer build or build from source" " available for your operating system. You may have to use a developer build or build from source"
" yourself. Please visit the download page.")); " yourself. Please visit the download page."));
@ -158,24 +158,24 @@ void DlgUpdate::setLabel(QString newText) {
void DlgUpdate::updateCheckError(QString errorString) { void DlgUpdate::updateCheckError(QString errorString) {
setLabel("Error"); setLabel("Error");
QMessageBox::critical(this, tr("Update Error"), "An error occurred while checking for updates: " + errorString); QMessageBox::critical(this, tr("Update Error"), tr("An error occurred while checking for updates: ") + errorString);
} }
void DlgUpdate::downloadError(QString errorString) { void DlgUpdate::downloadError(QString errorString) {
setLabel("Error"); setLabel(tr("Error"));
enableUpdateButton(true); enableUpdateButton(true);
QMessageBox::critical(this, tr("Update Error"), "An error occurred while downloading an update: " + errorString); QMessageBox::critical(this, tr("Update Error"), tr("An error occurred while downloading an update: ") + errorString);
} }
void DlgUpdate::downloadSuccessful(QUrl filepath) { void DlgUpdate::downloadSuccessful(QUrl filepath) {
setLabel("Installing..."); setLabel(tr("Installing..."));
//Try to open the installer. If it opens, quit Cockatrice //Try to open the installer. If it opens, quit Cockatrice
if (QDesktopServices::openUrl(filepath)) if (QDesktopServices::openUrl(filepath))
{ {
QMetaObject::invokeMethod((MainWindow*) parent(), "close", Qt::QueuedConnection); QMetaObject::invokeMethod((MainWindow*) parent(), "close", Qt::QueuedConnection);
close(); close();
} else { } else {
setLabel("Error"); setLabel(tr("Error"));
QMessageBox::critical(this, tr("Update Error"), "Unable to open the installer. You might be able to manually update" QMessageBox::critical(this, tr("Update Error"), "Unable to open the installer. You might be able to manually update"
" by closing Cockatrice and running the installer at " + filepath.toLocalFile() + "."); " by closing Cockatrice and running the installer at " + filepath.toLocalFile() + ".");
} }

View file

@ -44,7 +44,7 @@ void UpdateDownloader::fileFinished() {
//Save the build in a temporary directory //Save the build in a temporary directory
QFile file(fileName); QFile file(fileName);
if (!file.open(QIODevice::WriteOnly)) { if (!file.open(QIODevice::WriteOnly)) {
emit error("Could not open the file for reading."); emit error(tr("Could not open the file for reading."));
return; return;
} }