diff options
| author | Tannin <devnull@localhost> | 2013-12-14 13:23:13 +0100 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2013-12-14 13:23:13 +0100 |
| commit | 14ac234daf1680b0685f6bea3e74aa09dfcf38ef (patch) | |
| tree | 643c053d77c53c138f7c325bec695bfdc1c044a1 /src | |
| parent | 22b8eb7c5a5d3a0d7033bbb57b2d248fc7c0fe11 (diff) | |
- plugin list now highlights plugins with attached ini files
- bugfix: opening nexus through the globe icon used the nmm.nexusmods.com url
Diffstat (limited to 'src')
| -rw-r--r-- | src/mainwindow.cpp | 2 | ||||
| -rw-r--r-- | src/pluginlist.cpp | 23 | ||||
| -rw-r--r-- | src/pluginlist.h | 4 | ||||
| -rw-r--r-- | src/resources.qrc | 1 | ||||
| -rw-r--r-- | src/resources/mail-attachment.png | bin | 0 -> 649 bytes | |||
| -rw-r--r-- | src/shared/directoryentry.cpp | 4 | ||||
| -rw-r--r-- | src/shared/directoryentry.h | 9 | ||||
| -rw-r--r-- | src/shared/util.cpp | 3 |
8 files changed, 27 insertions, 19 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 17f2de09..3a543e0b 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -4031,7 +4031,7 @@ void MainWindow::on_actionNexus_triggered() ::ShellExecuteW(NULL, L"open", nxmPath.c_str(), (std::wstring(L"reg ") + GameInfo::instance().getGameShortName() + L" \"" + executable + L"\"").c_str(), NULL, SW_SHOWNORMAL); - ::ShellExecuteW(NULL, L"open", GameInfo::instance().getNexusPage().c_str(), NULL, NULL, SW_SHOWNORMAL); + ::ShellExecuteW(NULL, L"open", GameInfo::instance().getNexusPage(false).c_str(), NULL, NULL, SW_SHOWNORMAL); ui->tabWidget->setCurrentIndex(4); } diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index 8eeed76e..20d4d357 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -146,7 +146,11 @@ void PluginList::refresh(const QString &profileName, const DirectoryEntry &baseD bool archive = false; try { FilesOrigin &origin = baseDirectory.getOriginByID(current->getOrigin(archive)); - m_ESPs.push_back(ESPInfo(filename, forceEnabled, current->getFileTime(), ToQString(origin.getName()), ToQString(current->getFullPath()))); + + QString iniPath = QFileInfo(filename).baseName() + ".ini"; + bool hasIni = baseDirectory.findFile(ToWString(iniPath)).get() != NULL; + + m_ESPs.push_back(ESPInfo(filename, forceEnabled, current->getFileTime(), ToQString(origin.getName()), ToQString(current->getFullPath()), hasIni)); } catch (const std::exception &e) { reportError(tr("failed to update esp info for file %1 (source id: %2), error: %3").arg(filename).arg(current->getOrigin(archive)).arg(e.what())); } @@ -724,7 +728,9 @@ QVariant PluginList::data(const QModelIndex &modelIndex, int role) const return QIcon(":/MO/gui/warning"); } else if (m_LockedOrder.find(m_ESPs[index].m_Name.toLower()) != m_LockedOrder.end()) { return QIcon(":/MO/gui/locked"); - } else if (m_ESPs[index].m_IsDummy && m_ESPs[index].m_Enabled) { + } else if (m_ESPs[index].m_HasIni) { + return QIcon(":/MO/gui/attachment"); + } else if (m_ESPs[index].m_IsDummy && m_ESPs[index].m_Enabled && !m_ESPs[index].m_HasIni) { return QIcon(":/MO/gui/edit_clear"); } else { return QVariant(); @@ -759,7 +765,10 @@ QVariant PluginList::data(const QModelIndex &modelIndex, int role) const m_ESPs[index].m_MasterUnset.begin(), m_ESPs[index].m_MasterUnset.end(), std::inserter(enabledMasters, enabledMasters.end())); text += "<br>" + tr("Enabled Masters") + ": " + SetJoin(enabledMasters, ", "); - if (m_ESPs[index].m_IsDummy) { + if (m_ESPs[index].m_HasIni) { + text += "<br>There is an ini file connected to this esp. Its settings will be added to your game settings, overwriting " + "in case of conflicts."; + } else if (m_ESPs[index].m_IsDummy) { text += "<br>This file is a dummy! It exists only so the bsa with the same name gets loaded. With MO you don't need this: " "If you enable the archive with the same name in the \"Archive\" tab you can disable this plugin."; } @@ -1021,9 +1030,11 @@ bool PluginList::eventFilter(QObject *obj, QEvent *event) } -PluginList::ESPInfo::ESPInfo(const QString &name, bool enabled, FILETIME time, const QString &originName, const QString &fullPath) - : m_Name(name), m_Enabled(enabled), m_ForceEnabled(enabled), m_Removed(false), m_Priority(0), - m_LoadOrder(-1), m_Time(time), m_OriginName(originName) +PluginList::ESPInfo::ESPInfo(const QString &name, bool enabled, FILETIME time, + const QString &originName, const QString &fullPath, + bool hasIni) + : m_Name(name), m_Enabled(enabled), m_ForceEnabled(enabled), m_Removed(false), + m_Priority(0), m_LoadOrder(-1), m_Time(time), m_OriginName(originName), m_HasIni(hasIni) { try { ESP::File file(ToWString(fullPath)); diff --git a/src/pluginlist.h b/src/pluginlist.h index 2f1a3f5f..64c914df 100644 --- a/src/pluginlist.h +++ b/src/pluginlist.h @@ -131,7 +131,6 @@ public: */ int enabledCount() const; - QString getName(int index) const { return m_ESPs.at(index).m_Name; } int getPriority(int index) const { return m_ESPs.at(index).m_Priority; } bool isESPLocked(int index) const; @@ -193,7 +192,7 @@ private: struct ESPInfo { - ESPInfo(const QString &name, bool enabled, FILETIME time, const QString &originName, const QString &fullPath); + ESPInfo(const QString &name, bool enabled, FILETIME time, const QString &originName, const QString &fullPath, bool hasIni); QString m_Name; QString m_FullPath; bool m_Enabled; @@ -205,6 +204,7 @@ private: QString m_OriginName; bool m_IsMaster; bool m_IsDummy; + bool m_HasIni; std::set<QString> m_Masters; mutable std::set<QString> m_MasterUnset; }; diff --git a/src/resources.qrc b/src/resources.qrc index 3f27e2cc..1582a3f2 100644 --- a/src/resources.qrc +++ b/src/resources.qrc @@ -51,5 +51,6 @@ <file alias="emblem_notes">resources/accessories-text-editor.png</file> <file alias="version_date">resources/x-office-calendar.png</file> <file alias="warning_16">resources/dialog-warning_16.png</file> + <file alias="attachment">resources/mail-attachment.png</file> </qresource> </RCC> diff --git a/src/resources/mail-attachment.png b/src/resources/mail-attachment.png Binary files differnew file mode 100644 index 00000000..529bb7f5 --- /dev/null +++ b/src/resources/mail-attachment.png diff --git a/src/shared/directoryentry.cpp b/src/shared/directoryentry.cpp index 685e14a9..a232ea19 100644 --- a/src/shared/directoryentry.cpp +++ b/src/shared/directoryentry.cpp @@ -759,7 +759,7 @@ DirectoryEntry *DirectoryEntry::findSubDirectoryRecursive(const std::wstring &pa }
-const FileEntry::Ptr DirectoryEntry::findFile(const std::wstring &name)
+const FileEntry::Ptr DirectoryEntry::findFile(const std::wstring &name) const
{
auto iter = m_Files.find(name);
if (iter != m_Files.end()) {
@@ -840,7 +840,7 @@ FileEntry::Ptr FileRegister::createFile(const std::wstring &name, DirectoryEntry }
-FileEntry::Ptr FileRegister::getFile(FileEntry::Index index)
+FileEntry::Ptr FileRegister::getFile(FileEntry::Index index) const
{
auto iter = m_Files.find(index);
if (iter != m_Files.end()) {
diff --git a/src/shared/directoryentry.h b/src/shared/directoryentry.h index 1ad9816c..22f00a74 100644 --- a/src/shared/directoryentry.h +++ b/src/shared/directoryentry.h @@ -168,7 +168,7 @@ public: bool indexValid(FileEntry::Index index) const;
FileEntry::Ptr createFile(const std::wstring &name, DirectoryEntry *parent);
- FileEntry::Ptr getFile(FileEntry::Index index);
+ FileEntry::Ptr getFile(FileEntry::Index index) const;
void removeFile(FileEntry::Index index);
void removeOrigin(FileEntry::Index index, int originID);
@@ -233,11 +233,10 @@ public: * @param name name of the file
* @return fileentry object for the file or NULL if no file matches
*/
- const FileEntry::Ptr findFile(const std::wstring &name);
+ const FileEntry::Ptr findFile(const std::wstring &name) const;
- /** search through this directory and all subdirectories for a file by the specified name.
- if directory is not NULL, the referenced variable will be set to true if the path refers to a directory.
- the returned pointer is NULL in that case */
+ /** search through this directory and all subdirectories for a file by the specified name (relative path).
+ if directory is not NULL, the referenced variable will be set to the path containing the file */
const FileEntry::Ptr searchFile(const std::wstring &path, const DirectoryEntry **directory) const;
void insertFile(const std::wstring &filePath, FilesOrigin &origin, FILETIME fileTime);
diff --git a/src/shared/util.cpp b/src/shared/util.cpp index 4378e03c..22657e6c 100644 --- a/src/shared/util.cpp +++ b/src/shared/util.cpp @@ -69,7 +69,6 @@ std::string ToString(const std::wstring &source, bool utf8) ::WideCharToMultiByte(CP_UTF8, 0, source.c_str(), -1, buffer, MAX_PATH, NULL, NULL);
} else {
::WideCharToMultiByte(GetACP(), 0, source.c_str(), -1, buffer, MAX_PATH, NULL, NULL);
-// wcstombs(buffer, source.c_str(), MAX_PATH);
}
return std::string(buffer);
}
@@ -80,9 +79,7 @@ std::wstring ToWString(const std::string &source, bool utf8) if (utf8) {
::MultiByteToWideChar(CP_UTF8, 0, source.c_str(), -1, buffer, MAX_PATH);
} else {
- // codepage encoding
::MultiByteToWideChar(GetACP(), 0, source.c_str(), -1, buffer, MAX_PATH);
-// mbstowcs(buffer, source.c_str(), MAX_PATH);
}
return std::wstring(buffer);
}
|
