Make some more error messages translateable.
This commit is contained in:
parent
a01b1707de
commit
4a24ea6c38
@ -40,6 +40,7 @@ ELSEIF(MINGW)
|
|||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -Wall")
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -Wall")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Werror=return-type")
|
||||||
################################ 3rd Party Libs ################################
|
################################ 3rd Party Libs ################################
|
||||||
|
|
||||||
# Find the required Qt parts
|
# Find the required Qt parts
|
||||||
|
@ -757,7 +757,7 @@ void MainWindow::on_actionAddInstance_triggered()
|
|||||||
auto &loader = InstanceFactory::get();
|
auto &loader = InstanceFactory::get();
|
||||||
|
|
||||||
auto error = loader.createInstance(newInstance, newInstDlg.selectedVersion(), instDir);
|
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)
|
switch (error)
|
||||||
{
|
{
|
||||||
case InstanceFactory::NoCreateError:
|
case InstanceFactory::NoCreateError:
|
||||||
@ -768,21 +768,21 @@ void MainWindow::on_actionAddInstance_triggered()
|
|||||||
|
|
||||||
case InstanceFactory::InstExists:
|
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();
|
CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
case InstanceFactory::CantCreateDir:
|
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();
|
CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
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();
|
CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -828,7 +828,7 @@ void MainWindow::on_actionCopyInstance_triggered()
|
|||||||
BaseInstance *newInstance = NULL;
|
BaseInstance *newInstance = NULL;
|
||||||
auto error = loader.copyInstance(newInstance, m_selectedInstance, instDir);
|
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)
|
switch (error)
|
||||||
{
|
{
|
||||||
case InstanceFactory::NoCreateError:
|
case InstanceFactory::NoCreateError:
|
||||||
@ -839,21 +839,21 @@ void MainWindow::on_actionCopyInstance_triggered()
|
|||||||
|
|
||||||
case InstanceFactory::InstExists:
|
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();
|
CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case InstanceFactory::CantCreateDir:
|
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();
|
CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
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();
|
CustomMessageBox::selectable(this, tr("Error"), errorMsg, QMessageBox::Warning)->show();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,6 @@ void OneSixUpdate::versionFileStart()
|
|||||||
void OneSixUpdate::versionFileFinished()
|
void OneSixUpdate::versionFileFinished()
|
||||||
{
|
{
|
||||||
NetActionPtr DlJob = specificVersionDownloadJob->first();
|
NetActionPtr DlJob = specificVersionDownloadJob->first();
|
||||||
OneSixInstance *inst = (OneSixInstance *)m_inst;
|
|
||||||
|
|
||||||
QString version_id = targetVersion->descriptor();
|
QString version_id = targetVersion->descriptor();
|
||||||
QString inst_dir = m_inst->instanceRoot();
|
QString inst_dir = m_inst->instanceRoot();
|
||||||
@ -152,7 +151,7 @@ void OneSixUpdate::assetIndexStart()
|
|||||||
QString assetName = version->assets;
|
QString assetName = version->assets;
|
||||||
QUrl indexUrl = "http://" + URLConstants::AWS_DOWNLOAD_INDEXES + assetName + ".json";
|
QUrl indexUrl = "http://" + URLConstants::AWS_DOWNLOAD_INDEXES + assetName + ".json";
|
||||||
QString localPath = 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 metacache = MMC->metacache();
|
||||||
auto entry = metacache->resolveEntry("asset_indexes", localPath);
|
auto entry = metacache->resolveEntry("asset_indexes", localPath);
|
||||||
@ -198,7 +197,7 @@ void OneSixUpdate::assetIndexFinished()
|
|||||||
if (dls.size())
|
if (dls.size())
|
||||||
{
|
{
|
||||||
setStatus(tr("Getting the assets files from Mojang..."));
|
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)
|
for (auto dl : dls)
|
||||||
job->addNetAction(dl);
|
job->addNetAction(dl);
|
||||||
jarlibDownloadJob.reset(job);
|
jarlibDownloadJob.reset(job);
|
||||||
@ -255,7 +254,7 @@ void OneSixUpdate::jarlibStart()
|
|||||||
QString localPath = version_id + "/" + version_id + ".jar";
|
QString localPath = version_id + "/" + version_id + ".jar";
|
||||||
QString urlstr = "http://" + URLConstants::AWS_DOWNLOAD_VERSIONS + localPath;
|
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 metacache = MMC->metacache();
|
||||||
auto entry = metacache->resolveEntry("versions", localPath);
|
auto entry = metacache->resolveEntry("versions", localPath);
|
||||||
|
@ -38,7 +38,7 @@ VersionFinal::VersionFinal(OneSixInstance *instance, QObject *parent)
|
|||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VersionFinal::reload(const bool onlyVanilla, const QStringList &external)
|
void VersionFinal::reload(const bool onlyVanilla, const QStringList &external)
|
||||||
{
|
{
|
||||||
//FIXME: source of epic failure.
|
//FIXME: source of epic failure.
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
|
@ -38,7 +38,7 @@ public:
|
|||||||
virtual int columnCount(const QModelIndex &parent) const;
|
virtual int columnCount(const QModelIndex &parent) const;
|
||||||
virtual Qt::ItemFlags flags(const QModelIndex &index) 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();
|
void clear();
|
||||||
|
|
||||||
bool canRemove(const int index) const;
|
bool canRemove(const int index) const;
|
||||||
|
@ -54,7 +54,7 @@ void YggdrasilTask::executeTask()
|
|||||||
counter.setSingleShot(false);
|
counter.setSingleShot(false);
|
||||||
counter.start(time_step);
|
counter.start(time_step);
|
||||||
progress(0, timeout_max);
|
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);
|
connect(&counter, &QTimer::timeout, this, &YggdrasilTask::heartbeat);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,6 +76,12 @@ void YggdrasilTask::abort()
|
|||||||
m_netReply->abort();
|
m_netReply->abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void YggdrasilTask::abortByTimeout()
|
||||||
|
{
|
||||||
|
progress(timeout_max, timeout_max);
|
||||||
|
m_netReply->abort();
|
||||||
|
}
|
||||||
|
|
||||||
void YggdrasilTask::sslErrors(QList<QSslError> errors)
|
void YggdrasilTask::sslErrors(QList<QSslError> errors)
|
||||||
{
|
{
|
||||||
int i = 1;
|
int i = 1;
|
||||||
|
@ -120,7 +120,7 @@ slots:
|
|||||||
public
|
public
|
||||||
slots:
|
slots:
|
||||||
virtual void abort() override;
|
virtual void abort() override;
|
||||||
|
void abortByTimeout();
|
||||||
protected:
|
protected:
|
||||||
// FIXME: segfault disaster waiting to happen
|
// FIXME: segfault disaster waiting to happen
|
||||||
MojangAccount *m_account = nullptr;
|
MojangAccount *m_account = nullptr;
|
||||||
|
@ -408,7 +408,7 @@ void InstanceList::loadFTBInstances(QMap<QString, QString> &groupMap,
|
|||||||
QLOG_INFO() << "Loading existing " << record.name;
|
QLOG_INFO() << "Loading existing " << record.name;
|
||||||
BaseInstance *instPtr = NULL;
|
BaseInstance *instPtr = NULL;
|
||||||
auto error = InstanceFactory::get().loadInstance(instPtr, record.instanceDir);
|
auto error = InstanceFactory::get().loadInstance(instPtr, record.instanceDir);
|
||||||
if (!instPtr || error != InstanceFactory::NoCreateError)
|
if (!instPtr || error != InstanceFactory::NoLoadError)
|
||||||
continue;
|
continue;
|
||||||
instPtr->setGroupInitial("FTB");
|
instPtr->setGroupInitial("FTB");
|
||||||
instPtr->setName(record.name);
|
instPtr->setName(record.name);
|
||||||
|
@ -22,12 +22,12 @@ Task::Task(QObject *parent) : ProgressProvider(parent)
|
|||||||
|
|
||||||
QString Task::getStatus() const
|
QString Task::getStatus() const
|
||||||
{
|
{
|
||||||
return m_status;
|
return m_statusString;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Task::setStatus(const QString &new_status)
|
void Task::setStatus(const QString &new_status)
|
||||||
{
|
{
|
||||||
m_status = new_status;
|
m_statusString = new_status;
|
||||||
emit status(new_status);
|
emit status(new_status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ slots:
|
|||||||
void setProgress(int progress);
|
void setProgress(int progress);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QString m_status;
|
QString m_statusString;
|
||||||
int m_progress = 0;
|
int m_progress = 0;
|
||||||
bool m_running = false;
|
bool m_running = false;
|
||||||
bool m_succeeded = false;
|
bool m_succeeded = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user