diff options
| author | Tannin <devnull@localhost> | 2014-12-01 18:44:37 +0100 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2014-12-01 18:44:37 +0100 |
| commit | 226993eecee22e3cb39fc30aedfef587cc58330c (patch) | |
| tree | f62b12ff4f2db4fce2eae1dddd6781562c7ad5b1 | |
| parent | 78da5fc37ff3a488dc0db8704f2c93cef48dbb57 (diff) | |
- added error handling when a file can't be deleted from vfs
- minor bugfixes
| -rw-r--r-- | src/mainwindow.cpp | 5 | ||||
| -rw-r--r-- | src/shared/directoryentry.cpp | 12 | ||||
| -rw-r--r-- | src/shared/directoryentry.h | 10 | ||||
| -rw-r--r-- | src/version.rc | 4 |
4 files changed, 20 insertions, 11 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d3c108fc..101c8f81 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -4334,7 +4334,7 @@ void MainWindow::installTranslator(const QString &name) QTranslator *translator = new QTranslator(this); QString fileName = name + "_" + m_CurrentLanguage; if (!translator->load(fileName, qApp->applicationDirPath() + "/translations")) { - if (m_CurrentLanguage != "en_US") { + if ((m_CurrentLanguage != "en-US") && (m_CurrentLanguage != "en_US")) { qWarning("localization file %s not found", qPrintable(fileName)); } // we don't actually expect localization files for english } @@ -5238,6 +5238,9 @@ void MainWindow::on_espList_customContextMenuRequested(const QPoint &pos) void MainWindow::on_groupCombo_currentIndexChanged(int index) { + if (m_ModListSortProxy == NULL) { + return; + } QAbstractProxyModel *newModel = NULL; switch (index) { case 1: { diff --git a/src/shared/directoryentry.cpp b/src/shared/directoryentry.cpp index 0adf0812..7c0e7119 100644 --- a/src/shared/directoryentry.cpp +++ b/src/shared/directoryentry.cpp @@ -563,17 +563,19 @@ void DirectoryEntry::addFiles(FilesOrigin &origin, BSA::Folder::Ptr archiveFolde }
-void DirectoryEntry::removeFile(const std::wstring &filePath, int *origin)
+bool DirectoryEntry::removeFile(const std::wstring &filePath, int *origin)
{
size_t pos = filePath.find_first_of(L"\\/");
if (pos == std::string::npos) {
- this->remove(filePath, origin);
+ return this->remove(filePath, origin);
} else {
std::wstring dirName = filePath.substr(0, pos);
std::wstring rest = filePath.substr(pos + 1);
DirectoryEntry *entry = getSubDirectoryRecursive(dirName, false);
if (entry != NULL) {
- entry->removeFile(rest, origin);
+ return entry->removeFile(rest, origin);
+ } else {
+ return false;
}
}
}
@@ -894,14 +896,16 @@ void FileRegister::unregisterFile(FileEntry::Ptr file) }
-void FileRegister::removeFile(FileEntry::Index index)
+bool FileRegister::removeFile(FileEntry::Index index)
{
auto iter = m_Files.find(index);
if (iter != m_Files.end()) {
unregisterFile(iter->second);
m_Files.erase(index);
+ return true;
} else {
log("invalid file index for remove: %lu", index);
+ return false;
}
}
diff --git a/src/shared/directoryentry.h b/src/shared/directoryentry.h index d588ab02..c06a49a1 100644 --- a/src/shared/directoryentry.h +++ b/src/shared/directoryentry.h @@ -184,7 +184,7 @@ public: size_t size() const { return m_Files.size(); }
- void removeFile(FileEntry::Index index);
+ bool removeFile(FileEntry::Index index);
void removeOrigin(FileEntry::Index index, int originID);
void removeOriginMulti(std::set<FileEntry::Index> indices, int originID, time_t notAfter);
@@ -263,7 +263,7 @@ public: void removeFile(FileEntry::Index index);
// remove the specified file from the tree. This can be a path leading to a file in a subdirectory
- void removeFile(const std::wstring &filePath, int *origin = NULL);
+ bool removeFile(const std::wstring &filePath, int *origin = NULL);
/**
* @brief remove the specified directory
@@ -271,7 +271,7 @@ public: */
void removeDir(const std::wstring &path);
- void remove(const std::wstring &fileName, int *origin) {
+ bool remove(const std::wstring &fileName, int *origin) {
auto iter = m_Files.find(ToLower(fileName));
if (iter != m_Files.end()) {
if (origin != NULL) {
@@ -281,7 +281,9 @@ public: *origin = entry->getOrigin(ignore);
}
}
- m_FileRegister->removeFile(iter->second);
+ return m_FileRegister->removeFile(iter->second);
+ } else {
+ return false;
}
}
diff --git a/src/version.rc b/src/version.rc index 6504c5ac..51c05050 100644 --- a/src/version.rc +++ b/src/version.rc @@ -1,7 +1,7 @@ #include "Winver.h"
-#define VER_FILEVERSION 1,2,14,0
-#define VER_FILEVERSION_STR "1,2,14,0\0"
+#define VER_FILEVERSION 1,2,15,0
+#define VER_FILEVERSION_STR "1,2,15,0\0"
VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILEVERSION
|
