diff options
| author | Silarn <jrim@rimpo.org> | 2019-12-14 18:11:57 -0600 |
|---|---|---|
| committer | Silarn <jrim@rimpo.org> | 2019-12-14 18:11:57 -0600 |
| commit | 51e3e078be10a085702014b4b873d69c502e8b0a (patch) | |
| tree | 0cb906764d1f5ece8963c238aa99de9f7b6552af | |
| parent | fde5fa279746c90180223942a44f865859f85cb3 (diff) | |
Fix problem with translated unmanaged mods and origin names
- (Also adds translatable strings to directoryentry.cpp)
| -rw-r--r-- | src/lootdialog.h | 1 | ||||
| -rw-r--r-- | src/modinfoforeign.cpp | 8 | ||||
| -rw-r--r-- | src/modinfoforeign.h | 5 | ||||
| -rw-r--r-- | src/organizer_en.ts | 53 | ||||
| -rw-r--r-- | src/shared/directoryentry.cpp | 19 |
5 files changed, 66 insertions, 20 deletions
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; } <context> <name>ModInfoForeign</name> <message> - <location filename="modinfoforeign.cpp" line="47"/> + <location filename="modinfoforeign.cpp" line="42"/> <source>This pseudo mod represents content managed outside MO. It isn't modified by MO.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="modinfoforeign.cpp" line="61"/> + <location filename="modinfoforeign.cpp" line="56"/> <source>DLC: </source> <translation type="unfinished"></translation> </message> <message> - <location filename="modinfoforeign.cpp" line="64"/> + <location filename="modinfoforeign.cpp" line="60"/> <source>Creation Club: </source> <translation type="unfinished"></translation> </message> <message> - <location filename="modinfoforeign.cpp" line="67"/> + <location filename="modinfoforeign.cpp" line="64"/> <source>Unmanaged: </source> <translation type="unfinished"></translation> </message> @@ -6771,6 +6771,51 @@ You can restart Mod Organizer as administrator and try launching the program aga <oldsource>%1 is loaded. This program is known to cause issues with Mod Organizer, such as freezing or blank windows. Consider uninstalling it. (%2)</oldsource> <translation type="unfinished"></translation> </message> + <message> + <location filename="shared/directoryentry.cpp" line="87"/> + <source>invalid origin name: </source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="shared/directoryentry.cpp" line="110"/> + <source>failed to change name lookup from {} to {}</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="shared/directoryentry.cpp" line="524"/> + <source>failed to determine file time</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="shared/directoryentry.cpp" line="546"/> + <source>invalid bsa file: </source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="shared/directoryentry.cpp" line="722"/> + <source>file "{}" not in directory "{}"</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="shared/directoryentry.cpp" line="727"/> + <source>file "{}" not in directory "{}", directory empty</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="shared/directoryentry.cpp" line="851"/> + <source>unexpected end of path</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="shared/directoryentry.cpp" line="995"/> + <source>invalid file index for remove: {}</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="shared/directoryentry.cpp" line="1009"/> + <source>invalid file index for remove (for origin): {}</source> + <translation type="unfinished"></translation> + </message> </context> <context> <name>QueryOverwriteDialog</name> 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 <http://www.gnu.org/licenses/>. #include <algorithm>
#include <map>
#include <atomic>
+#include <QObject>
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);
}
}
|
