Make some more error messages translateable.

This commit is contained in:
Petr Mrázek 2014-03-23 19:07:13 +01:00
parent a01b1707de
commit 4a24ea6c38
10 changed files with 26 additions and 20 deletions

View File

@ -40,6 +40,7 @@ ELSEIF(MINGW)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -Wall")
ENDIF()
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Werror=return-type")
################################ 3rd Party Libs ################################
# Find the required Qt parts

View File

@ -757,7 +757,7 @@ void MainWindow::on_actionAddInstance_triggered()
auto &loader = InstanceFactory::get();
auto error = loader.createInstance(newInstance, newInstDlg.selectedVersion(), instDir);
QString errorMsg = QString("Failed to create instance %1: ").arg(instDirName);
QString errorMsg = tr("Failed to create instance %1: ").arg(instDirName);
switch (error)
{
case InstanceFactory::NoCreateError:
@ -768,21 +768,21 @@ void MainWindow::on_actionAddInstance_triggered()
case InstanceFactory::InstExists:
{
errorMsg += "An instance with the given directory name already exists.";
errorMsg += tr("An instance with the given directory name already exists.");
CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show();
return;
}
case InstanceFactory::CantCreateDir:
{
errorMsg += "Failed to create the instance directory.";
errorMsg += tr("Failed to create the instance directory.");
CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show();
return;
}
default:
{
errorMsg += QString("Unknown instance loader error %1").arg(error);
errorMsg += tr("Unknown instance loader error %1").arg(error);
CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show();
return;
}
@ -828,7 +828,7 @@ void MainWindow::on_actionCopyInstance_triggered()
BaseInstance *newInstance = NULL;
auto error = loader.copyInstance(newInstance, m_selectedInstance, instDir);
QString errorMsg = QString("Failed to create instance %1: ").arg(instDirName);
QString errorMsg = tr("Failed to create instance %1: ").arg(instDirName);
switch (error)
{
case InstanceFactory::NoCreateError:
@ -839,21 +839,21 @@ void MainWindow::on_actionCopyInstance_triggered()
case InstanceFactory::InstExists:
{
errorMsg += "An instance with the given directory name already exists.";
errorMsg += tr("An instance with the given directory name already exists.");
CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show();
break;
}
case InstanceFactory::CantCreateDir:
{
errorMsg += "Failed to create the instance directory.";
errorMsg += tr("Failed to create the instance directory.");
CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show();
break;
}
default:
{
errorMsg += QString("Unknown instance loader error %1").arg(error);
errorMsg += tr("Unknown instance loader error %1").arg(error);
CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show();
break;
}

View File

@ -96,7 +96,6 @@ void OneSixUpdate::versionFileStart()
void OneSixUpdate::versionFileFinished()
{
NetActionPtr DlJob = specificVersionDownloadJob->first();
OneSixInstance *inst = (OneSixInstance *)m_inst;
QString version_id = targetVersion->descriptor();
QString inst_dir = m_inst->instanceRoot();
@ -152,7 +151,7 @@ void OneSixUpdate::assetIndexStart()
QString assetName = version->assets;
QUrl indexUrl = "http://" + URLConstants::AWS_DOWNLOAD_INDEXES + assetName + ".json";
QString localPath = assetName + ".json";
auto job = new NetJob("Asset index for " + inst->name());
auto job = new NetJob(tr("Asset index for %1").arg(inst->name()));
auto metacache = MMC->metacache();
auto entry = metacache->resolveEntry("asset_indexes", localPath);
@ -198,7 +197,7 @@ void OneSixUpdate::assetIndexFinished()
if (dls.size())
{
setStatus(tr("Getting the assets files from Mojang..."));
auto job = new NetJob("Assets for " + inst->name());
auto job = new NetJob(tr("Assets for %1").arg(inst->name()));
for (auto dl : dls)
job->addNetAction(dl);
jarlibDownloadJob.reset(job);
@ -255,7 +254,7 @@ void OneSixUpdate::jarlibStart()
QString localPath = version_id + "/" + version_id + ".jar";
QString urlstr = "http://" + URLConstants::AWS_DOWNLOAD_VERSIONS + localPath;
auto job = new NetJob("Libraries for instance " + inst->name());
auto job = new NetJob(tr("Libraries for instance %1").arg(inst->name()));
auto metacache = MMC->metacache();
auto entry = metacache->resolveEntry("versions", localPath);

View File

@ -38,7 +38,7 @@ VersionFinal::VersionFinal(OneSixInstance *instance, QObject *parent)
clear();
}
bool VersionFinal::reload(const bool onlyVanilla, const QStringList &external)
void VersionFinal::reload(const bool onlyVanilla, const QStringList &external)
{
//FIXME: source of epic failure.
beginResetModel();

View File

@ -38,7 +38,7 @@ public:
virtual int columnCount(const QModelIndex &parent) const;
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
bool reload(const bool onlyVanilla = false, const QStringList &external = QStringList());
void reload(const bool onlyVanilla = false, const QStringList &external = QStringList());
void clear();
bool canRemove(const int index) const;

View File

@ -54,7 +54,7 @@ void YggdrasilTask::executeTask()
counter.setSingleShot(false);
counter.start(time_step);
progress(0, timeout_max);
connect(&timeout_keeper, &QTimer::timeout, this, &YggdrasilTask::abort);
connect(&timeout_keeper, &QTimer::timeout, this, &YggdrasilTask::abortByTimeout);
connect(&counter, &QTimer::timeout, this, &YggdrasilTask::heartbeat);
}
@ -76,6 +76,12 @@ void YggdrasilTask::abort()
m_netReply->abort();
}
void YggdrasilTask::abortByTimeout()
{
progress(timeout_max, timeout_max);
m_netReply->abort();
}
void YggdrasilTask::sslErrors(QList<QSslError> errors)
{
int i = 1;

View File

@ -120,7 +120,7 @@ slots:
public
slots:
virtual void abort() override;
void abortByTimeout();
protected:
// FIXME: segfault disaster waiting to happen
MojangAccount *m_account = nullptr;

View File

@ -408,7 +408,7 @@ void InstanceList::loadFTBInstances(QMap<QString, QString> &groupMap,
QLOG_INFO() << "Loading existing " << record.name;
BaseInstance *instPtr = NULL;
auto error = InstanceFactory::get().loadInstance(instPtr, record.instanceDir);
if (!instPtr || error != InstanceFactory::NoCreateError)
if (!instPtr || error != InstanceFactory::NoLoadError)
continue;
instPtr->setGroupInitial("FTB");
instPtr->setName(record.name);

View File

@ -22,12 +22,12 @@ Task::Task(QObject *parent) : ProgressProvider(parent)
QString Task::getStatus() const
{
return m_status;
return m_statusString;
}
void Task::setStatus(const QString &new_status)
{
m_status = new_status;
m_statusString = new_status;
emit status(new_status);
}

View File

@ -58,7 +58,7 @@ slots:
void setProgress(int progress);
protected:
QString m_status;
QString m_statusString;
int m_progress = 0;
bool m_running = false;
bool m_succeeded = false;