From d13f6bb870cdda71257f665367be8ef9fca86255 Mon Sep 17 00:00:00 2001 From: Mikaƫl Capelle Date: Tue, 17 May 2022 11:47:01 +0200 Subject: Apply clang-format. --- src/pluginlist.h | 215 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 108 insertions(+), 107 deletions(-) (limited to 'src/pluginlist.h') diff --git a/src/pluginlist.h b/src/pluginlist.h index c21a6cee..e7a65c81 100644 --- a/src/pluginlist.h +++ b/src/pluginlist.h @@ -20,40 +20,42 @@ along with Mod Organizer. If not, see . #ifndef PLUGINLIST_H #define PLUGINLIST_H +#include "loot.h" +#include "profile.h" #include #include -#include "profile.h" -#include "loot.h" -namespace MOBase { class IPluginGame; } +namespace MOBase +{ +class IPluginGame; +} -#include -#include -#include -#include #include +#include +#include #include +#include +#include #pragma warning(push) -#pragma warning(disable: 4100) +#pragma warning(disable : 4100) #ifndef Q_MOC_RUN -#include #include +#include #endif -#include #include +#include class OrganizerCore; - template -class ChangeBracket { +class ChangeBracket +{ public: - ChangeBracket(C *model) - : m_Model(nullptr) + ChangeBracket(C* model) : m_Model(nullptr) { - QVariant var = model->property("__aboutToChange"); + QVariant var = model->property("__aboutToChange"); bool aboutToChange = var.isValid() && var.toBool(); if (!aboutToChange) { model->layoutAboutToBeChanged(); @@ -61,11 +63,10 @@ public: m_Model = model; } } - ~ChangeBracket() { - finish(); - } + ~ChangeBracket() { finish(); } - void finish() { + void finish() + { if (m_Model != nullptr) { m_Model->layoutChanged(); m_Model->setProperty("__aboutToChange", false); @@ -74,11 +75,9 @@ public: } private: - C *m_Model; + C* m_Model; }; - - /** * @brief model representing the plugins (.esp/.esm) in the current virtual data folder **/ @@ -86,9 +85,10 @@ class PluginList : public QAbstractItemModel { Q_OBJECT friend class ChangeBracket; -public: - enum EColumn { +public: + enum EColumn + { COL_NAME, COL_FLAGS, COL_PRIORITY, @@ -101,18 +101,18 @@ public: friend class PluginListProxy; - using SignalRefreshed = boost::signals2::signal; - using SignalPluginMoved = boost::signals2::signal; - using SignalPluginStateChanged = boost::signals2::signal&)>; + using SignalRefreshed = boost::signals2::signal; + using SignalPluginMoved = boost::signals2::signal; + using SignalPluginStateChanged = + boost::signals2::signal&)>; public: - /** * @brief constructor * * @param parent parent object **/ - PluginList(OrganizerCore &organizer); + PluginList(OrganizerCore& organizer); ~PluginList(); @@ -120,14 +120,14 @@ public: * @brief does a complete refresh of the list * * @param profileName name of the current profile - * @param baseDirectory the root directory structure representing the virtual data directory + * @param baseDirectory the root directory structure representing the virtual data + *directory * @param lockedOrderFile list of plugins that shouldn't change load order * @todo the profile is not used? If it was, we should pass the Profile-object instead **/ - void refresh(const QString &profileName - , const MOShared::DirectoryEntry &baseDirectory - , const QString &lockedOrderFile - , bool refresh); + void refresh(const QString& profileName, + const MOShared::DirectoryEntry& baseDirectory, + const QString& lockedOrderFile, bool refresh); /** * @brief enable a plugin based on its name @@ -135,7 +135,7 @@ public: * @param name name of the plugin to enable * @param enable set to true to enable the esp, false to disable it **/ - void enableESP(const QString &name, bool enable = true); + void enableESP(const QString& name, bool enable = true); /** * @brief test if a plugin is enabled @@ -143,7 +143,7 @@ public: * @param name name of the plugin to look up * @return true if the plugin is enabled, false otherwise **/ - bool isEnabled(const QString &name); + bool isEnabled(const QString& name); /** * @brief clear all additional information we stored on plugins @@ -154,14 +154,14 @@ public: * @brief reset additional information on a mod * @param name name of the plugin to clear the information of */ - void clearInformation(const QString &name); + void clearInformation(const QString& name); /** * @brief add additional information on a mod (i.e. from loot) * @param name name of the plugin to add information about * @param message the message to add to the plugin */ - void addInformation(const QString &name, const QString &message); + void addInformation(const QString& name, const QString& message); /** * adds information from a loot report @@ -182,21 +182,24 @@ public: * * @param lockedOrderFileName path of the lockedorder.txt to write to **/ - void saveTo(const QString &lockedOrderFileName) const; + void saveTo(const QString& lockedOrderFileName) const; /** * @brief save the current load order * * the load order used by the game is defined by the last modification time which this - * function sets. An exception is newer version of skyrim where the load order is defined - * by the order of files in plugins.txt - * @param directoryStructure the root directory structure representing the virtual data directory - * @return true on success or if there was nothing to save, false if the load order can't be saved, i.e. because files are locked - * @todo since this works on actual files the load order can't be configured per-profile. Files of the same name - * in different mods can also have different load orders which makes this very intransparent + * function sets. An exception is newer version of skyrim where the load order is + *defined by the order of files in plugins.txt + * @param directoryStructure the root directory structure representing the virtual + *data directory + * @return true on success or if there was nothing to save, false if the load order + *can't be saved, i.e. because files are locked + * @todo since this works on actual files the load order can't be configured + *per-profile. Files of the same name in different mods can also have different load + *orders which makes this very intransparent * @note also stores to disk the list of locked esps **/ - bool saveLoadOrder(MOShared::DirectoryEntry &directoryStructure); + bool saveLoadOrder(MOShared::DirectoryEntry& directoryStructure); /** * @return number of enabled plugins in the list @@ -216,24 +219,22 @@ public: // highlight plugins contained in the mods at the given indices // - void highlightPlugins( - const std::vector& modIndices, - const MOShared::DirectoryEntry &directoryEntry); + void highlightPlugins(const std::vector& modIndices, + const MOShared::DirectoryEntry& directoryEntry); void refreshLoadOrder(); void disconnectSlots(); public: - QStringList pluginNames() const; - PluginStates state(const QString &name) const; - void setState(const QString &name, PluginStates state); - int priority(const QString &name) const; - int loadOrder(const QString &name) const; + PluginStates state(const QString& name) const; + void setState(const QString& name, PluginStates state); + int priority(const QString& name) const; + int loadOrder(const QString& name) const; bool setPriority(const QString& name, int newPriority); - QStringList masters(const QString &name) const; - QString origin(const QString &name) const; + QStringList masters(const QString& name) const; + QString origin(const QString& name) const; void setLoadOrder(const QStringList& pluginList); bool hasMasterExtension(const QString& name) const; @@ -242,21 +243,26 @@ public: bool isLightFlagged(const QString& name) const; boost::signals2::connection onRefreshed(const std::function& callback); - boost::signals2::connection onPluginMoved(const std::function& func); - boost::signals2::connection onPluginStateChanged(const std::function&)> &func); - -public: // implementation of the QAbstractTableModel interface - - virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; - virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; - virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); - virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; - virtual Qt::ItemFlags flags(const QModelIndex &index) const; + boost::signals2::connection + onPluginMoved(const std::function& func); + boost::signals2::connection onPluginStateChanged( + const std::function&)>& func); + +public: // implementation of the QAbstractTableModel interface + virtual int rowCount(const QModelIndex& parent = QModelIndex()) const; + virtual int columnCount(const QModelIndex& parent = QModelIndex()) const; + virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; + virtual bool setData(const QModelIndex& index, const QVariant& value, + int role = Qt::EditRole); + virtual QVariant headerData(int section, Qt::Orientation orientation, + int role = Qt::DisplayRole) const; + virtual Qt::ItemFlags flags(const QModelIndex& index) const; virtual Qt::DropActions supportedDropActions() const { return Qt::MoveAction; } - virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent); - virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; - virtual QModelIndex parent(const QModelIndex &child) const; + virtual bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, + int column, const QModelIndex& parent); + virtual QModelIndex index(int row, int column, + const QModelIndex& parent = QModelIndex()) const; + virtual QModelIndex parent(const QModelIndex& child) const; public slots: @@ -284,7 +290,7 @@ public slots: * @brief The currently managed game has changed * @param gamePlugin */ - void managedGameChanged(MOBase::IPluginGame const *gamePlugin); + void managedGameChanged(MOBase::IPluginGame const* gamePlugin); /** * @brief Generate the plugin indexes because something was changed @@ -293,24 +299,22 @@ public slots: signals: - /** - * @brief emitted when the plugin list changed, i.e. the load order was modified or a plugin was checked/unchecked - * @note this is currently only used to signal that there are changes that can be saved, it does - * not immediately cause anything to be written to disc - **/ - void esplist_changed(); - - void writePluginsList(); + /** + * @brief emitted when the plugin list changed, i.e. the load order was modified or a + *plugin was checked/unchecked + * @note this is currently only used to signal that there are changes that can be + *saved, it does not immediately cause anything to be written to disc + **/ + void esplist_changed(); + void writePluginsList(); private: - struct ESPInfo { - ESPInfo( - const QString &name, bool enabled, const QString &originName, - const QString &fullPath, bool hasIni, std::set archives, - bool lightSupported); + ESPInfo(const QString& name, bool enabled, const QString& originName, + const QString& fullPath, bool hasIni, std::set archives, + bool lightSupported); QString name; QString fullPath; @@ -333,26 +337,23 @@ private: std::set masters; mutable std::set masterUnset; - bool operator < (const ESPInfo& str) const - { - return (loadOrder < str.loadOrder); - } + bool operator<(const ESPInfo& str) const { return (loadOrder < str.loadOrder); } }; - struct AdditionalInfo { + struct AdditionalInfo + { QStringList messages; Loot::Plugin loot; }; private: - void syncLoadOrder(); void updateIndices(); - void writeLockedOrder(const QString &fileName) const; + void writeLockedOrder(const QString& fileName) const; - void readLockedOrderFrom(const QString &fileName); - void setPluginPriority(int row, int &newPriority, bool isForced=false); + void readLockedOrderFrom(const QString& fileName); + void setPluginPriority(int row, int& newPriority, bool isForced = false); void changePluginPriority(std::vector rows, int newPriority); void testMasters(); @@ -364,7 +365,8 @@ private: int findPluginByPriority(int priority); /** - * @brief Notify MO2 plugins that the states of the given plugins have changed to the given state. + * @brief Notify MO2 plugins that the states of the given plugins have changed to the + * given state. * * @param pluginNames Names of the plugin. * @param state New state of the plugin. @@ -373,7 +375,6 @@ private: void pluginStatesChanged(QStringList const& pluginNames, PluginStates state) const; private: - OrganizerCore& m_Organizer; std::vector m_ESPs; @@ -384,7 +385,8 @@ private: std::map m_LockedOrder; - std::map m_AdditionalInfo; // maps esp names to boss information + std::map + m_AdditionalInfo; // maps esp names to boss information QString m_CurrentProfile; QFontMetrics m_FontMetrics; @@ -397,17 +399,16 @@ private: QElapsedTimer m_LastCheck; - const MOBase::IPluginGame *m_GamePlugin; - + const MOBase::IPluginGame* m_GamePlugin; - QVariant displayData(const QModelIndex &modelIndex) const; - QVariant checkstateData(const QModelIndex &modelIndex) const; - QVariant foregroundData(const QModelIndex &modelIndex) const; - QVariant backgroundData(const QModelIndex &modelIndex) const; - QVariant fontData(const QModelIndex &modelIndex) const; - QVariant alignmentData(const QModelIndex &modelIndex) const; - QVariant tooltipData(const QModelIndex &modelIndex) const; - QVariant iconData(const QModelIndex &modelIndex) const; + QVariant displayData(const QModelIndex& modelIndex) const; + QVariant checkstateData(const QModelIndex& modelIndex) const; + QVariant foregroundData(const QModelIndex& modelIndex) const; + QVariant backgroundData(const QModelIndex& modelIndex) const; + QVariant fontData(const QModelIndex& modelIndex) const; + QVariant alignmentData(const QModelIndex& modelIndex) const; + QVariant tooltipData(const QModelIndex& modelIndex) const; + QVariant iconData(const QModelIndex& modelIndex) const; QString makeLootTooltip(const Loot::Plugin& loot) const; bool isProblematic(const ESPInfo& esp, const AdditionalInfo* info) const; @@ -416,4 +417,4 @@ private: #pragma warning(pop) -#endif // PLUGINLIST_H +#endif // PLUGINLIST_H -- cgit v1.3.1