mirror of
https://github.com/ModOrganizer2/modorganizer.git
synced 2026-07-27 13:58:24 -07:00
Make logs more consistent in format and content
This commit is contained in:
+6
-6
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
+2
-2
@@ -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();
|
||||
|
||||
+2
-2
@@ -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];
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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())));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -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;
|
||||
|
||||
+11
-11
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user