diff options
| author | LostDragonist <lost.dragonist@gmail.com> | 2019-01-30 20:32:48 -0600 |
|---|---|---|
| committer | LostDragonist <lost.dragonist@gmail.com> | 2019-01-30 20:32:48 -0600 |
| commit | 4b522f40e88e1350434aaa7d77fc60cb7ca36930 (patch) | |
| tree | ab162fb185d043fbb29a9984ba24b1daf906f765 /src | |
| parent | 6d453505468ccf86966c358d57aa820b18def4ec (diff) | |
Make logs more consistent in format and content
Diffstat (limited to 'src')
| -rw-r--r-- | src/categories.cpp | 12 | ||||
| -rw-r--r-- | src/directoryrefresher.cpp | 9 | ||||
| -rw-r--r-- | src/executableslist.cpp | 4 | ||||
| -rw-r--r-- | src/installationmanager.cpp | 2 | ||||
| -rw-r--r-- | src/loadmechanism.cpp | 4 | ||||
| -rw-r--r-- | src/mainwindow.cpp | 4 | ||||
| -rw-r--r-- | src/modinfo.cpp | 4 | ||||
| -rw-r--r-- | src/modinfodialog.cpp | 2 | ||||
| -rw-r--r-- | src/modlistsortproxy.cpp | 4 | ||||
| -rw-r--r-- | src/organizercore.cpp | 10 | ||||
| -rw-r--r-- | src/overwriteinfodialog.cpp | 2 | ||||
| -rw-r--r-- | src/pluginlist.cpp | 6 | ||||
| -rw-r--r-- | src/profile.cpp | 22 |
13 files changed, 46 insertions, 39 deletions
diff --git a/src/categories.cpp b/src/categories.cpp index 4d89eff9..9e5fa9f7 100644 --- a/src/categories.cpp +++ b/src/categories.cpp @@ -72,7 +72,7 @@ void CategoryFactory::loadCategories() bool ok = false;
int temp = iter->toInt(&ok);
if (!ok) {
- qCritical("invalid id %s", iter->constData());
+ qCritical("invalid category id %s", iter->constData());
}
nexusIDs.push_back(temp);
}
@@ -268,7 +268,7 @@ void CategoryFactory::loadDefaultCategories() int CategoryFactory::getParentID(unsigned int index) const
{
if (index >= m_Categories.size()) {
- throw MyException(QObject::tr("invalid index %1").arg(index));
+ throw MyException(QObject::tr("invalid category index: %1").arg(index));
}
return m_Categories[index].m_ParentID;
@@ -303,7 +303,7 @@ bool CategoryFactory::isDecendantOf(int id, int parentID) const bool CategoryFactory::hasChildren(unsigned int index) const
{
if (index >= m_Categories.size()) {
- throw MyException(QObject::tr("invalid index %1").arg(index));
+ throw MyException(QObject::tr("invalid category index: %1").arg(index));
}
return m_Categories[index].m_HasChildren;
@@ -313,7 +313,7 @@ bool CategoryFactory::hasChildren(unsigned int index) const QString CategoryFactory::getCategoryName(unsigned int index) const
{
if (index >= m_Categories.size()) {
- throw MyException(QObject::tr("invalid index %1").arg(index));
+ throw MyException(QObject::tr("invalid category index: %1").arg(index));
}
return m_Categories[index].m_Name;
@@ -323,7 +323,7 @@ QString CategoryFactory::getCategoryName(unsigned int index) const int CategoryFactory::getCategoryID(unsigned int index) const
{
if (index >= m_Categories.size()) {
- throw MyException(QObject::tr("invalid index %1").arg(index));
+ throw MyException(QObject::tr("invalid category index: %1").arg(index));
}
return m_Categories[index].m_ID;
@@ -334,7 +334,7 @@ int CategoryFactory::getCategoryIndex(int ID) const {
std::map<int, unsigned int>::const_iterator iter = m_IDMap.find(ID);
if (iter == m_IDMap.end()) {
- throw MyException(QObject::tr("invalid category id %1").arg(ID));
+ throw MyException(QObject::tr("invalid category id: %1").arg(ID));
}
return iter->second;
}
diff --git a/src/directoryrefresher.cpp b/src/directoryrefresher.cpp index c48b77d9..eded70b0 100644 --- a/src/directoryrefresher.cpp +++ b/src/directoryrefresher.cpp @@ -125,6 +125,10 @@ void DirectoryRefresher::addModFilesToStructure(DirectoryEntry *directoryStructu // files to this mod
FilesOrigin &origin = directoryStructure->createOrigin(ToWString(modName), directoryW, priority);
for (const QString &filename : stealFiles) {
+ if (filename.isEmpty()) {
+ qWarning("Trying to find file with no name");
+ continue;
+ }
QFileInfo fileInfo(filename);
FileEntry::Ptr file = directoryStructure->findFile(ToWString(fileInfo.fileName()));
if (file.get() != nullptr) {
@@ -135,7 +139,10 @@ void DirectoryRefresher::addModFilesToStructure(DirectoryEntry *directoryStructu origin.addFile(file->getIndex());
file->addOrigin(origin.getID(), file->getFileTime(), L"", -1);
} else {
- qWarning("%s not found", qUtf8Printable(fileInfo.fileName()));
+ QString warnStr = fileInfo.absolutePath();
+ if (warnStr.isEmpty())
+ warnStr = filename;
+ qWarning("file not found: %1", qUtf8Printable(warnStr));
}
}
} else {
diff --git a/src/executableslist.cpp b/src/executableslist.cpp index 21cb6ed4..ae4ebdbf 100644 --- a/src/executableslist.cpp +++ b/src/executableslist.cpp @@ -75,7 +75,7 @@ const Executable &ExecutablesList::find(const QString &title) const return exe;
}
}
- throw std::runtime_error(QString("invalid name %1").arg(title).toLocal8Bit().constData());
+ throw std::runtime_error(QString("invalid executable name: %1").arg(title).toLocal8Bit().constData());
}
@@ -86,7 +86,7 @@ Executable &ExecutablesList::find(const QString &title) return exe;
}
}
- throw std::runtime_error(QString("invalid executable name %1").arg(title).toLocal8Bit().constData());
+ throw std::runtime_error(QString("invalid executable name: %1").arg(title).toLocal8Bit().constData());
}
diff --git a/src/installationmanager.cpp b/src/installationmanager.cpp index 6719c84a..83128e4b 100644 --- a/src/installationmanager.cpp +++ b/src/installationmanager.cpp @@ -762,7 +762,7 @@ bool InstallationManager::install(const QString &fileName, if (fileInfo.dir() == QDir(m_DownloadsDirectory)) { m_CurrentFile = fileInfo.fileName(); } - qDebug("using mod name \"%s\" (id %d) -> %s", modName->toUtf8().constData(), modID, qUtf8Printable(m_CurrentFile)); + qDebug("using mod name \"%s\" (id %d) -> %s", qUtf8Printable(modName), modID, qUtf8Printable(m_CurrentFile)); //If there's an archive already open, close it. This happens with the bundle //installer when it uncompresses a split archive, then finds it has a real archive diff --git a/src/loadmechanism.cpp b/src/loadmechanism.cpp index ebbb5de3..8f0529ce 100644 --- a/src/loadmechanism.cpp +++ b/src/loadmechanism.cpp @@ -100,7 +100,7 @@ bool LoadMechanism::hashIdentical(const QString &fileNameLHS, const QString &fil {
QFile fileLHS(fileNameLHS);
if (!fileLHS.open(QIODevice::ReadOnly)) {
- throw MyException(QObject::tr("%1 not found").arg(fileNameLHS));
+ throw MyException(QObject::tr("file not found: %1").arg(qUtf8Printable(fileNameLHS)));
}
QByteArray dataLHS = fileLHS.readAll();
QByteArray hashLHS = QCryptographicHash::hash(dataLHS, QCryptographicHash::Md5);
@@ -109,7 +109,7 @@ bool LoadMechanism::hashIdentical(const QString &fileNameLHS, const QString &fil QFile fileRHS(fileNameRHS);
if (!fileRHS.open(QIODevice::ReadOnly)) {
- throw MyException(QObject::tr("%1 not found").arg(fileNameRHS));
+ throw MyException(QObject::tr("file not found: %1").arg(qUtf8Printable(fileNameRHS)));
}
QByteArray dataRHS = fileRHS.readAll();
QByteArray hashRHS = QCryptographicHash::hash(dataRHS, QCryptographicHash::Md5);
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index fccb5efe..8bcf7ba7 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -5186,7 +5186,7 @@ void MainWindow::previewDataFile() const FileEntry::Ptr file = m_OrganizerCore.directoryStructure()->searchFile(ToWString(fileName), nullptr);
if (file.get() == nullptr) {
- reportError(tr("file not found: %1").arg(fileName));
+ reportError(tr("file not found: %1").arg(qUtf8Printable(fileName)));
return;
}
@@ -6339,7 +6339,7 @@ void MainWindow::dropLocalFile(const QUrl &url, const QString &outputDir, bool m {
QFileInfo file(url.toLocalFile());
if (!file.exists()) {
- qWarning("invalid source file %s", qUtf8Printable(file.absoluteFilePath()));
+ qWarning("invalid source file: %s", qUtf8Printable(file.absoluteFilePath()));
return;
}
QString target = outputDir + "/" + file.fileName();
diff --git a/src/modinfo.cpp b/src/modinfo.cpp index 1c6139f6..7ae41b02 100644 --- a/src/modinfo.cpp +++ b/src/modinfo.cpp @@ -110,7 +110,7 @@ QString ModInfo::getContentTypeName(int contentType) case CONTENT_INI: return tr("INI files"); case CONTENT_MODGROUP: return tr("ModGroup files"); - default: throw MyException(tr("invalid content type %1").arg(contentType)); + default: throw MyException(tr("invalid content type: %1").arg(contentType)); } } @@ -133,7 +133,7 @@ ModInfo::Ptr ModInfo::getByIndex(unsigned int index) QMutexLocker locker(&s_Mutex); if (index >= s_Collection.size() && index != ULONG_MAX) { - throw MyException(tr("invalid mod index %1").arg(index)); + throw MyException(tr("invalid mod index: %1").arg(index)); } if (index == ULONG_MAX) return s_Collection[ModInfo::getIndex("Overwrite")]; return s_Collection[index]; diff --git a/src/modinfodialog.cpp b/src/modinfodialog.cpp index d2e5e84f..04506374 100644 --- a/src/modinfodialog.cpp +++ b/src/modinfodialog.cpp @@ -1431,7 +1431,7 @@ void ModInfoDialog::previewDataFile() const FileEntry::Ptr file = m_OrganizerCore->directoryStructure()->searchFile(ToWString(fileName), nullptr);
if (file.get() == nullptr) {
- reportError(tr("file not found: %1").arg(fileName));
+ reportError(tr("file not found: %1").arg(qUtf8Printable(fileName)));
return;
}
diff --git a/src/modlistsortproxy.cpp b/src/modlistsortproxy.cpp index 99f0efef..2d9ea4a5 100644 --- a/src/modlistsortproxy.cpp +++ b/src/modlistsortproxy.cpp @@ -474,13 +474,13 @@ bool ModListSortProxy::filterAcceptsRow(int row, const QModelIndex &parent) cons }
if (row >= static_cast<int>(m_Profile->numMods())) {
- qWarning("invalid row idx %d", row);
+ qWarning("invalid row index: %d", row);
return false;
}
QModelIndex idx = sourceModel()->index(row, 0, parent);
if (!idx.isValid()) {
- qDebug("invalid index");
+ qDebug("invalid mod index");
return false;
}
if (sourceModel()->hasChildren(idx)) {
diff --git a/src/organizercore.cpp b/src/organizercore.cpp index 10b6fd8b..4fa09ab6 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -1010,7 +1010,7 @@ MOBase::IModInterface *OrganizerCore::installMod(const QString &fileName, emit modInstalled(modName);
return modInfo.data();
} else {
- reportError(tr("mod \"%1\" not found").arg(modName));
+ reportError(tr("mod not found: %1").arg(qUtf8Printable(modName)));
}
} else if (m_InstallationManager.wasCancelled()) {
QMessageBox::information(qApp->activeWindow(), tr("Installation cancelled"),
@@ -1068,7 +1068,7 @@ void OrganizerCore::installDownload(int index) m_ModInstalled(modName);
} else {
- reportError(tr("mod \"%1\" not found").arg(modName));
+ reportError(tr("mod not found: %1").arg(qUtf8Printable(modName)));
}
m_DownloadManager.markInstalled(index);
@@ -1129,7 +1129,7 @@ QStringList OrganizerCore::findFiles( }
}
} else {
- qWarning("directory %s not found", qUtf8Printable(path));
+ qWarning("directory not found: %1", qUtf8Printable(path));
}
return result;
}
@@ -1148,7 +1148,7 @@ QStringList OrganizerCore::getFileOrigins(const QString &fileName) const ToQString(m_DirectoryStructure->getOriginByID(i.first).getName()));
}
} else {
- qDebug("%s not found", qUtf8Printable(fileName));
+ qWarning("file not found: %1", qUtf8Printable(fileName));
}
return result;
}
@@ -1294,7 +1294,7 @@ HANDLE OrganizerCore::spawnBinaryProcess(const QFileInfo &binary, if (!binary.exists()) {
reportError(
- tr("Executable \"%1\" not found").arg(binary.absoluteFilePath()));
+ tr("Executable not found: %1").arg(qUtf8Printable(binary.absoluteFilePath())));
return INVALID_HANDLE_VALUE;
}
diff --git a/src/overwriteinfodialog.cpp b/src/overwriteinfodialog.cpp index 4d35a2c3..d1289c91 100644 --- a/src/overwriteinfodialog.cpp +++ b/src/overwriteinfodialog.cpp @@ -110,7 +110,7 @@ void OverwriteInfoDialog::setModInfo(ModInfo::Ptr modInfo) if (QDir(modInfo->absolutePath()).exists()) {
m_FileSystemModel->setRootPath(modInfo->absolutePath());
} else {
- throw MyException(tr("%1 not found").arg(modInfo->absolutePath()));
+ throw MyException(tr("mod not found: %1").arg(qUtf8Printable(modInfo->absolutePath())));
}
}
diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index b2fabbe0..56a5c91f 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -298,7 +298,7 @@ void PluginList::enableESP(const QString &name, bool enable) emit writePluginsList();
} else {
- reportError(tr("esp not found: %1").arg(name));
+ reportError(tr("Plugin not found: %1").arg(qUtf8Printable(name)));
}
}
@@ -694,7 +694,7 @@ void PluginList::setState(const QString &name, PluginStates state) { m_ESPs[iter->second].m_Enabled = (state == IPluginList::STATE_ACTIVE) ||
m_ESPs[iter->second].m_ForceEnabled;
} else {
- qWarning("plugin %s not found", qUtf8Printable(name));
+ qWarning("Plugin not found: %1", qUtf8Printable(name));
}
}
@@ -824,7 +824,7 @@ void PluginList::updateIndices() continue;
}
if (m_ESPs[i].m_Priority >= static_cast<int>(m_ESPs.size())) {
- qCritical("invalid priority %d", m_ESPs[i].m_Priority);
+ qCritical("invalid plugin priority: %d", m_ESPs[i].m_Priority);
continue;
}
m_ESPsByName[m_ESPs[i].m_Name.toLower()] = i;
diff --git a/src/profile.cpp b/src/profile.cpp index 629e043f..a5e3bc54 100644 --- a/src/profile.cpp +++ b/src/profile.cpp @@ -78,7 +78,7 @@ Profile::Profile(const QString &name, IPluginGame const *gamePlugin, bool useDef QDir profileBase(profilesDir); QString fixedName = name; if (!fixDirectoryName(fixedName)) { - throw MyException(tr("invalid profile name %1").arg(name)); + throw MyException(tr("invalid profile name: %1").arg(qUtf8Printable(name))); } if (!profileBase.exists() || !profileBase.mkdir(fixedName)) { @@ -416,19 +416,19 @@ void Profile::refreshModStatus() m_ModStatus[modIndex].m_Enabled = enabled; if (m_ModStatus[modIndex].m_Priority == -1) { if (static_cast<size_t>(index) >= m_ModStatus.size()) { - throw MyException(tr("invalid index %1").arg(index)); + throw MyException(tr("invalid mod index: %1").arg(index)); } m_ModStatus[modIndex].m_Priority = index++; } } else { qWarning("no mod state for \"%s\" (profile \"%s\")", - qUtf8Printable(modName), m_Directory.path().toUtf8().constData()); + qUtf8Printable(modName), qUtf8Printable(m_Directory.path())); // need to rewrite the modlist to fix this modStatusModified = true; } } else { - qDebug("mod \"%s\" (profile \"%s\") not found", - qUtf8Printable(modName), m_Directory.path().toUtf8().constData()); + qDebug("mod not found: \"%s\" (profile \"%s\")", + qUtf8Printable(modName), qUtf8Printable(m_Directory.path())); // need to rewrite the modlist to fix this modStatusModified = true; } @@ -455,7 +455,7 @@ void Profile::refreshModStatus() m_ModStatus[i].m_Priority = numKnownMods - m_ModStatus[i].m_Priority - 1; } else { if (static_cast<size_t>(index) >= m_ModStatus.size()) { - throw MyException(tr("invalid index %1").arg(index)); + throw MyException(tr("invalid mod index: %1").arg(index)); } if (modInfo->hasFlag(ModInfo::FLAG_FOREIGN)) { m_ModStatus[i].m_Priority = --topInsert; @@ -552,7 +552,7 @@ unsigned int Profile::modIndexByPriority(int priority) const void Profile::setModEnabled(unsigned int index, bool enabled) { if (index >= m_ModStatus.size()) { - throw MyException(tr("invalid index %1").arg(index)); + throw MyException(tr("invalid mod index: %1").arg(index)); } ModInfo::Ptr modInfo = ModInfo::getByIndex(index); @@ -573,7 +573,7 @@ void Profile::setModsEnabled(const QList<unsigned int> &modsToEnable, const QLis QList<unsigned int> dirtyMods; for (auto idx : modsToEnable) { if (idx >= m_ModStatus.size()) { - qCritical() << tr("invalid index %1").arg(idx); + qCritical() << tr("invalid mod index: %1").arg(idx); continue; } if (!m_ModStatus[idx].m_Enabled) { @@ -583,7 +583,7 @@ void Profile::setModsEnabled(const QList<unsigned int> &modsToEnable, const QLis } for (auto idx : modsToDisable) { if (idx >= m_ModStatus.size()) { - qCritical() << tr("invalid index %1").arg(idx); + qCritical() << tr("invalid mod index: %1").arg(idx); continue; } if (ModInfo::getByIndex(idx)->alwaysEnabled()) { @@ -602,7 +602,7 @@ void Profile::setModsEnabled(const QList<unsigned int> &modsToEnable, const QLis bool Profile::modEnabled(unsigned int index) const { if (index >= m_ModStatus.size()) { - throw MyException(tr("invalid index %1").arg(index)); + throw MyException(tr("invalid mod index: %1").arg(index)); } return m_ModStatus[index].m_Enabled; @@ -612,7 +612,7 @@ bool Profile::modEnabled(unsigned int index) const int Profile::getModPriority(unsigned int index) const { if (index >= m_ModStatus.size()) { - throw MyException(tr("invalid index %1").arg(index)); + throw MyException(tr("invalid mod index: %1").arg(index)); } return m_ModStatus[index].m_Priority; |
