From aa9a1fc07fb612547c1d1c5074d669b2dd258af9 Mon Sep 17 00:00:00 2001 From: Silarn Date: Wed, 3 Jul 2019 13:04:27 -0500 Subject: Refactor obsolete methods --- src/modinfoforeign.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/modinfoforeign.cpp') diff --git a/src/modinfoforeign.cpp b/src/modinfoforeign.cpp index b599d4eb..7312d5b7 100644 --- a/src/modinfoforeign.cpp +++ b/src/modinfoforeign.cpp @@ -55,7 +55,7 @@ ModInfoForeign::ModInfoForeign(const QString &modName, PluginContainer *pluginContainer) : ModInfoWithConflictInfo(pluginContainer, directoryStructure), m_ReferenceFile(referenceFile), m_Archives(archives) { - m_CreationTime = QFileInfo(referenceFile).created(); + m_CreationTime = QFileInfo(referenceFile).birthTime(); switch (modType) { case ModInfo::EModType::MOD_DLC: m_Name = tr("DLC: ") + modName; -- cgit v1.3.1 From 51e3e078be10a085702014b4b873d69c502e8b0a Mon Sep 17 00:00:00 2001 From: Silarn Date: Sat, 14 Dec 2019 18:11:57 -0600 Subject: Fix problem with translated unmanaged mods and origin names - (Also adds translatable strings to directoryentry.cpp) --- src/lootdialog.h | 1 + src/modinfoforeign.cpp | 8 +++---- src/modinfoforeign.h | 5 ++-- src/organizer_en.ts | 53 +++++++++++++++++++++++++++++++++++++++---- src/shared/directoryentry.cpp | 19 ++++++++-------- 5 files changed, 66 insertions(+), 20 deletions(-) (limited to 'src/modinfoforeign.cpp') diff --git a/src/lootdialog.h b/src/lootdialog.h index bc8c01fb..3cec15c6 100644 --- a/src/lootdialog.h +++ b/src/lootdialog.h @@ -42,6 +42,7 @@ protected: class LootDialog : public QDialog { + Q_OBJECT; public: LootDialog(QWidget* parent, OrganizerCore& core, Loot& loot); ~LootDialog(); diff --git a/src/modinfoforeign.cpp b/src/modinfoforeign.cpp index 7312d5b7..84199eae 100644 --- a/src/modinfoforeign.cpp +++ b/src/modinfoforeign.cpp @@ -8,11 +8,6 @@ using namespace MOBase; using namespace MOShared; -QString ModInfoForeign::name() const -{ - return m_Name; -} - QDateTime ModInfoForeign::creationTime() const { return m_CreationTime; @@ -59,11 +54,14 @@ ModInfoForeign::ModInfoForeign(const QString &modName, switch (modType) { case ModInfo::EModType::MOD_DLC: m_Name = tr("DLC: ") + modName; + m_InternalName = QString("DLC: ") + modName; break; case ModInfo::EModType::MOD_CC: m_Name = tr("Creation Club: ") + modName; + m_InternalName = QString("Creation Club: ") + modName; break; default: m_Name = tr("Unmanaged: ") + modName; + m_InternalName = QString("Unmanaged: ") + modName; } } diff --git a/src/modinfoforeign.h b/src/modinfoforeign.h index 72fbb04f..3308d42f 100644 --- a/src/modinfoforeign.h +++ b/src/modinfoforeign.h @@ -35,8 +35,8 @@ public: virtual void track(bool) {} virtual void parseNexusInfo() {} virtual bool isEmpty() const { return false; } - virtual QString name() const; - virtual QString internalName() const { return name(); } + virtual QString name() const { return m_Name; } + virtual QString internalName() const { return m_InternalName; } virtual QString comments() const { return ""; } virtual QString notes() const { return ""; } virtual QDateTime creationTime() const; @@ -72,6 +72,7 @@ protected: private: QString m_Name; + QString m_InternalName; QString m_ReferenceFile; QStringList m_Archives; QDateTime m_CreationTime; diff --git a/src/organizer_en.ts b/src/organizer_en.ts index 271599e4..2540b1ba 100644 --- a/src/organizer_en.ts +++ b/src/organizer_en.ts @@ -4035,22 +4035,22 @@ p, li { white-space: pre-wrap; } ModInfoForeign - + This pseudo mod represents content managed outside MO. It isn't modified by MO. - + DLC: - + Creation Club: - + Unmanaged: @@ -6771,6 +6771,51 @@ You can restart Mod Organizer as administrator and try launching the program aga %1 is loaded. This program is known to cause issues with Mod Organizer, such as freezing or blank windows. Consider uninstalling it. (%2) + + + invalid origin name: + + + + + failed to change name lookup from {} to {} + + + + + failed to determine file time + + + + + invalid bsa file: + + + + + file "{}" not in directory "{}" + + + + + file "{}" not in directory "{}", directory empty + + + + + unexpected end of path + + + + + invalid file index for remove: {} + + + + + invalid file index for remove (for origin): {} + + QueryOverwriteDialog diff --git a/src/shared/directoryentry.cpp b/src/shared/directoryentry.cpp index 2cdbac74..00bf319e 100644 --- a/src/shared/directoryentry.cpp +++ b/src/shared/directoryentry.cpp @@ -32,6 +32,7 @@ along with Mod Organizer. If not, see . #include #include #include +#include namespace MOShared { @@ -83,7 +84,7 @@ public: return m_Origins[iter->second]; } else { std::ostringstream stream; - stream << "invalid origin name: " << ToString(name, false); + stream << QObject::tr("invalid origin name: ").toStdString() << ToString(name, true); throw std::runtime_error(stream.str()); } } @@ -106,7 +107,7 @@ public: m_OriginsNameMap.erase(iter); m_OriginsNameMap[newName] = idx; } else { - log::error("failed to change name lookup from {} to {}", oldName, newName); + log::error(QObject::tr("failed to change name lookup from {} to {}").toStdString(), oldName, newName); } } @@ -520,7 +521,7 @@ void DirectoryEntry::addFromBSA(const std::wstring &originName, std::wstring &di WIN32_FILE_ATTRIBUTE_DATA fileData; if (::GetFileAttributesExW(fileName.c_str(), GetFileExInfoStandard, &fileData) == 0) { - throw windows_error("failed to determine file time"); + throw windows_error(QObject::tr("failed to determine file time").toStdString()); } FILETIME now; ::GetSystemTimeAsFileTime(&now); @@ -542,7 +543,7 @@ void DirectoryEntry::addFromBSA(const std::wstring &originName, std::wstring &di BSA::EErrorCode res = archive.read(ToString(fileName, false).c_str(), false); if ((res != BSA::ERROR_NONE) && (res != BSA::ERROR_INVALIDHASHES)) { std::ostringstream stream; - stream << "invalid bsa file: " << ToString(fileName, false) << " errorcode " << res << " - " << ::GetLastError(); + stream << QObject::tr("invalid bsa file: ").toStdString() << ToString(fileName, false) << " errorcode " << res << " - " << ::GetLastError(); throw std::runtime_error(stream.str()); } @@ -718,12 +719,12 @@ void DirectoryEntry::removeFile(FileEntry::Index index) m_Files.erase(iter); } else { log::error( - "file \"{}\" not in directory \"{}\"", + QObject::tr("file \"{}\" not in directory \"{}\"").toStdString(), m_FileRegister->getFile(index)->getName(), this->getName()); } } else { log::error( - "file \"{}\" not in directory \"{}\", directory empty", + QObject::tr("file \"{}\" not in directory \"{}\", directory empty").toStdString(), m_FileRegister->getFile(index)->getName(), this->getName()); } } @@ -847,7 +848,7 @@ const FileEntry::Ptr DirectoryEntry::searchFile(const std::wstring &path, const DirectoryEntry *temp = findSubDirectory(pathComponent); if (temp != nullptr) { if (len >= path.size()) { - log::error("unexpected end of path"); + log::error(QObject::tr("unexpected end of path").toStdString()); return FileEntry::Ptr(); } return temp->searchFile(path.substr(len + 1), directory); @@ -991,7 +992,7 @@ bool FileRegister::removeFile(FileEntry::Index index) m_Files.erase(index); return true; } else { - log::error("invalid file index for remove: {}", index); + log::error(QObject::tr("invalid file index for remove: {}").toStdString(), index); return false; } } @@ -1005,7 +1006,7 @@ void FileRegister::removeOrigin(FileEntry::Index index, int originID) m_Files.erase(iter); } } else { - log::error("invalid file index for remove (for origin): {}", index); + log::error(QObject::tr("invalid file index for remove (for origin): {}").toStdString(), index); } } -- cgit v1.3.1