diff options
| author | Tannin <devnull@localhost> | 2013-10-16 23:04:03 +0200 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2013-10-16 23:04:03 +0200 |
| commit | b47c89661e603336abd98d5ecd0a82f6743cab18 (patch) | |
| tree | 00f0bed2c72835ef4019831526d1a16ff0d9fd5d /src | |
| parent | 0b84cc3d45e15d2edec6a083b5139e6d7528b53d (diff) | |
- plugin (esp/esm) list is now exposed to plugins (read-only functionality right now)
- integrated fomod installer now supports file dependencies
- bugfix: integrated fomod installer crashed if the installer had no optiosn´´ns
Diffstat (limited to 'src')
| -rw-r--r-- | src/mainwindow.cpp | 5 | ||||
| -rw-r--r-- | src/mainwindow.h | 23 | ||||
| -rw-r--r-- | src/pluginlist.cpp | 40 | ||||
| -rw-r--r-- | src/pluginlist.h | 9 |
4 files changed, 54 insertions, 23 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index b7a0fc2f..de6f20cf 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -2095,6 +2095,11 @@ IDownloadManager *MainWindow::downloadManager() return &m_DownloadManager; } +IPluginList *MainWindow::pluginList() +{ + return &m_PluginList; +} + HANDLE MainWindow::startApplication(const QString &executable, const QStringList &args, const QString &cwd, const QString &profile) { QFileInfo binary; diff --git a/src/mainwindow.h b/src/mainwindow.h index dc8d20c8..a96e5fcf 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -84,28 +84,6 @@ private: } }; -public: - - typedef boost::signals2::signal<bool (const QString&), SignalCombinerAnd> SignalAboutToRunApplication; - -public: - - struct SignalCombinerAnd - { - typedef bool result_type; - template<typename InputIterator> - bool operator()(InputIterator first, InputIterator last) const - { - while (first != last) { - if (!(*first)) { - return false; - } - ++first; - } - return true; - } - }; - typedef boost::signals2::signal<bool (const QString&), SignalCombinerAnd> SignalAboutToRunApplication; public: @@ -158,6 +136,7 @@ public: virtual QStringList listDirectories(const QString &directoryName) const; virtual QStringList findFiles(const QString &path, const std::function<bool(const QString &)> &filter) const; virtual MOBase::IDownloadManager *downloadManager(); + virtual MOBase::IPluginList *pluginList(); virtual HANDLE startApplication(const QString &executable, const QStringList &args = QStringList(), const QString &cwd = "", const QString &profile = ""); virtual bool onAboutToRun(const std::function<bool(const QString&)> &func); diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index 55f8a39e..74aa6ff3 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -571,6 +571,46 @@ void PluginList::refreshLoadOrder() } } +IPluginList::PluginState PluginList::state(const QString &name) const +{ + auto iter = m_ESPsByName.find(name.toLower()); + if (iter == m_ESPsByName.end()) { + return IPluginList::STATE_MISSING; + } else { + return m_ESPs[iter->second].m_Enabled ? IPluginList::STATE_ACTIVE : IPluginList::STATE_INACTIVE; + } +} + +int PluginList::priority(const QString &name) const +{ + auto iter = m_ESPsByName.find(name.toLower()); + if (iter == m_ESPsByName.end()) { + return -1; + } else { + return m_ESPs[iter->second].m_Priority; + } +} + +int PluginList::loadOrder(const QString &name) const +{ + auto iter = m_ESPsByName.find(name.toLower()); + if (iter == m_ESPsByName.end()) { + return -1; + } else { + return m_ESPs[iter->second].m_LoadOrder; + } +} + +bool PluginList::isMaster(const QString &name) const +{ + auto iter = m_ESPsByName.find(name.toLower()); + if (iter == m_ESPsByName.end()) { + return false; + } else { + return m_ESPs[iter->second].m_IsMaster; + } +} + void PluginList::updateIndices() { diff --git a/src/pluginlist.h b/src/pluginlist.h index 60c9be95..2ad54d6d 100644 --- a/src/pluginlist.h +++ b/src/pluginlist.h @@ -25,12 +25,13 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include <QTimer> #include <vector> #include <directoryentry.h> +#include <ipluginlist.h> /** * @brief model representing the plugins (.esp/.esm) in the current virtual data folder **/ -class PluginList : public QAbstractTableModel +class PluginList : public QAbstractTableModel, public MOBase::IPluginList { Q_OBJECT @@ -134,6 +135,12 @@ public: void refreshLoadOrder(); +public: + virtual PluginState state(const QString &name) const; + virtual int priority(const QString &name) const; + virtual int loadOrder(const QString &name) const; + virtual bool isMaster(const QString &name) const; + public: // implementation of the QAbstractTableModel interface virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; |
