diff options
| author | Tannin <devnull@localhost> | 2013-11-01 14:59:25 +0100 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2013-11-01 14:59:25 +0100 |
| commit | d1594798e6e78bb329e744a72e92d3f292f38a20 (patch) | |
| tree | dc3b8c822559655ab717841b1e22bd4c65dfff6e | |
| parent | 09bd3dbead9afd6a57684908e77aba6960ad464d (diff) | |
- added a new diagnosis to detect potential problems in regards to esp vs. asset ordering (not fully functional yet)
- new plugin interfaces to the mod list
- plugins can now query the origin (mod) of a esp/esm
- bugfix: potential access to profile before one was activated
- bugfix: regression in previous (not-yet-released) commit prevented changes to bsa list from being saved
| -rw-r--r-- | src/mainwindow.cpp | 18 | ||||
| -rw-r--r-- | src/mainwindow.h | 4 | ||||
| -rw-r--r-- | src/modlist.cpp | 40 | ||||
| -rw-r--r-- | src/modlist.h | 15 | ||||
| -rw-r--r-- | src/pluginlist.cpp | 9 | ||||
| -rw-r--r-- | src/pluginlist.h | 1 | ||||
| -rw-r--r-- | src/problemsdialog.ui | 58 |
7 files changed, 110 insertions, 35 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 967a3842..774c99f5 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -246,7 +246,7 @@ MainWindow::MainWindow(const QString &exeName, QSettings &initSettings, QWidget connect(ui->espFilterEdit, SIGNAL(textChanged(QString)), this, SLOT(espFilterChanged(QString))); connect(&m_PluginList, SIGNAL(saveTimer()), this, SLOT(savePluginList())); - connect(ui->bsaList, SIGNAL(itemsMoved()), this, SLOT(on_bsaList_itemMoved())); + connect(ui->bsaList, SIGNAL(itemsMoved()), this, SLOT(bsaList_itemMoved())); connect(ui->bsaWarning, SIGNAL(linkActivated(QString)), this, SLOT(linkClicked(QString))); @@ -1673,7 +1673,7 @@ void MainWindow::refreshSaveList() void MainWindow::refreshLists() { - if (m_DirectoryStructure->isPopulated()) { + if ((m_CurrentProfile != NULL) && m_DirectoryStructure->isPopulated()) { refreshESPList(); refreshBSAList(); } // no point in refreshing lists if no files have been added to the directory tree @@ -2104,6 +2104,11 @@ IPluginList *MainWindow::pluginList() return &m_PluginList; } +IModList *MainWindow::modList() +{ + return &m_ModList; +} + HANDLE MainWindow::startApplication(const QString &executable, const QStringList &args, const QString &cwd, const QString &profile) { QFileInfo binary; @@ -4650,13 +4655,19 @@ void MainWindow::on_bsaList_customContextMenuRequested(const QPoint &pos) menu.exec(ui->bsaList->mapToGlobal(pos)); } -void MainWindow::on_bsaList_itemMoved() +void MainWindow::bsaList_itemMoved() { saveArchiveList(); m_CheckBSATimer.start(500); } +void MainWindow::on_bsaList_itemChanged(QTreeWidgetItem*, int) +{ + saveArchiveList(); + m_CheckBSATimer.start(500); +} + void MainWindow::on_actionProblems_triggered() { // QString problemDescription; @@ -4836,3 +4847,4 @@ void MainWindow::on_showHiddenBox_toggled(bool checked) { m_DownloadManager.setShowHidden(checked); } + diff --git a/src/mainwindow.h b/src/mainwindow.h index 93a6af80..cf97d4f9 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -137,6 +137,7 @@ public: virtual QStringList findFiles(const QString &path, const std::function<bool(const QString &)> &filter) const; virtual MOBase::IDownloadManager *downloadManager(); virtual MOBase::IPluginList *pluginList(); + virtual MOBase::IModList *modList(); 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); @@ -510,7 +511,7 @@ private slots: // ui slots void on_actionEndorseMO_triggered(); void on_bsaList_customContextMenuRequested(const QPoint &pos); - void on_bsaList_itemMoved(); + void bsaList_itemMoved(); void on_btnRefreshData_clicked(); void on_categoriesList_customContextMenuRequested(const QPoint &pos); void on_compactBox_toggled(bool checked); @@ -531,6 +532,7 @@ private slots: // ui slots void on_categoriesList_itemSelectionChanged(); void on_linkButton_pressed(); void on_showHiddenBox_toggled(bool checked); + void on_bsaList_itemChanged(QTreeWidgetItem *item, int column); }; #endif // MAINWINDOW_H diff --git a/src/modlist.cpp b/src/modlist.cpp index 0fdcf6fa..541e1e6e 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -551,6 +551,46 @@ void ModList::changeModPriority(int sourceIndex, int newPriority) emit modorder_changed(); } +IModList::ModState ModList::state(const QString &name) const +{ + unsigned int modIndex = ModInfo::getIndex(name); + if (modIndex == UINT_MAX) { + return IModList::STATE_MISSING; + } else { + ModInfo::Ptr modInfo = ModInfo::getByIndex(modIndex); + if (modInfo->canBeEnabled()) { + return m_Profile->modEnabled(modIndex) ? IModList::STATE_ACTIVE : IModList::STATE_INACTIVE; + } else { + return IModList::STATE_NOTOPTIONAL; + } + } +} + +int ModList::priority(const QString &name) const +{ + unsigned int modIndex = ModInfo::getIndex(name); + if (modIndex == UINT_MAX) { + return -1; + } else { + return m_Profile->getModPriority(modIndex); + } +} + +bool ModList::setPriority(const QString &name, int newPriority) +{ + if ((newPriority < 0) || (newPriority >= static_cast<int>(m_Profile->numRegularMods()))) { + return false; + } + + unsigned int modIndex = ModInfo::getIndex(name); + if (modIndex == UINT_MAX) { + return false; + } else { + m_Profile->setModPriority(modIndex, newPriority); + notifyChange(modIndex); + return true; + } +} bool ModList::dropURLs(const QMimeData *mimeData, int row, const QModelIndex &parent) { diff --git a/src/modlist.h b/src/modlist.h index 7e76d677..cdaa24ca 100644 --- a/src/modlist.h +++ b/src/modlist.h @@ -26,6 +26,8 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "modinfo.h" #include "profile.h" +#include <imodlist.h> + #include <QFile> #include <QListWidget> #include <QNetworkReply> @@ -41,7 +43,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. * This is used in a view in the main window of MO. It combines general information about * the mods from ModInfo with status information from the Profile **/ -class ModList : public QAbstractItemModel +class ModList : public QAbstractItemModel, public MOBase::IModList { Q_OBJECT @@ -92,6 +94,17 @@ public: void changeModPriority(int sourceIndex, int newPriority); +public: + + /// \copydoc MOBase::IModList::state + virtual ModState state(const QString &name) const; + + /// \copydoc MOBase::IModList::priority + virtual int priority(const QString &name) const; + + /// \copydoc MOBase::IModList::setPriority + virtual bool setPriority(const QString &name, int newPriority); + public: // implementation of virtual functions of QAbstractItemModel virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index 74aa6ff3..456d29ee 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -611,6 +611,15 @@ bool PluginList::isMaster(const QString &name) const } } +QString PluginList::origin(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_OriginName; + } +} void PluginList::updateIndices() { diff --git a/src/pluginlist.h b/src/pluginlist.h index 2ad54d6d..4da7be4b 100644 --- a/src/pluginlist.h +++ b/src/pluginlist.h @@ -140,6 +140,7 @@ public: virtual int priority(const QString &name) const; virtual int loadOrder(const QString &name) const; virtual bool isMaster(const QString &name) const; + virtual QString origin(const QString &name) const; public: // implementation of the QAbstractTableModel interface diff --git a/src/problemsdialog.ui b/src/problemsdialog.ui index b194bf31..d3a0d959 100644 --- a/src/problemsdialog.ui +++ b/src/problemsdialog.ui @@ -49,54 +49,52 @@ <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:7.8pt; font-weight:400; font-style:normal;">
+</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p></body></html></string>
</property>
</widget>
</item>
<item>
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
- </widget>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="closeButton">
+ <property name="text">
+ <string>Close</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
+ <sender>closeButton</sender>
+ <signal>clicked()</signal>
<receiver>ProblemsDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
- <x>248</x>
- <y>254</y>
- </hint>
- <hint type="destinationlabel">
- <x>157</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>buttonBox</sender>
- <signal>rejected()</signal>
- <receiver>ProblemsDialog</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>316</x>
- <y>260</y>
+ <x>526</x>
+ <y>354</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
- <y>274</y>
+ <y>187</y>
</hint>
</hints>
</connection>
|
