mirror of
https://github.com/ModOrganizer2/modorganizer.git
synced 2026-07-27 13:58:24 -07:00
fixed includes because shared/ isn't in the path anymore removed unused modeltest files
73 lines
2.0 KiB
C++
73 lines
2.0 KiB
C++
#include "modinfooverwrite.h"
|
|
|
|
#include "shared/appconfig.h"
|
|
#include "settings.h"
|
|
|
|
#include <QApplication>
|
|
#include <QDirIterator>
|
|
|
|
ModInfoOverwrite::ModInfoOverwrite(PluginContainer *pluginContainer, MOShared::DirectoryEntry **directoryStructure)
|
|
: ModInfoWithConflictInfo(pluginContainer, directoryStructure)
|
|
{
|
|
testValid();
|
|
}
|
|
|
|
bool ModInfoOverwrite::isEmpty() const
|
|
{
|
|
QDirIterator iter(absolutePath(), QDir::NoDotAndDotDot | QDir::Files | QDir::Dirs);
|
|
if (!iter.hasNext()) return true;
|
|
iter.next();
|
|
if ((iter.fileName() == "meta.ini") && !iter.hasNext()) return true;
|
|
return false;
|
|
}
|
|
|
|
QString ModInfoOverwrite::absolutePath() const
|
|
{
|
|
return Settings::instance().paths().overwrite();
|
|
}
|
|
|
|
std::vector<ModInfo::EFlag> ModInfoOverwrite::getFlags() const
|
|
{
|
|
std::vector<ModInfo::EFlag> result;
|
|
result.push_back(FLAG_OVERWRITE);
|
|
if (m_PluginSelected)
|
|
result.push_back(FLAG_PLUGIN_SELECTED);
|
|
for (auto flag : ModInfoWithConflictInfo::getFlags())
|
|
result.push_back(flag);
|
|
return result;
|
|
}
|
|
|
|
std::vector<ModInfo::EConflictFlag> ModInfoOverwrite::getConflictFlags() const
|
|
{
|
|
std::vector<ModInfo::EConflictFlag> result;
|
|
result.push_back(FLAG_OVERWRITE_CONFLICT);
|
|
for (auto flag : ModInfoWithConflictInfo::getConflictFlags())
|
|
result.push_back(flag);
|
|
return result;
|
|
}
|
|
|
|
int ModInfoOverwrite::getHighlight() const
|
|
{
|
|
int highlight = (isValid() ? HIGHLIGHT_IMPORTANT : HIGHLIGHT_INVALID) | HIGHLIGHT_CENTER;
|
|
auto flags = getFlags();
|
|
if (std::find(flags.begin(), flags.end(), ModInfo::FLAG_PLUGIN_SELECTED) != flags.end())
|
|
highlight |= HIGHLIGHT_PLUGIN;
|
|
return highlight;
|
|
}
|
|
|
|
QString ModInfoOverwrite::getDescription() const
|
|
{
|
|
return tr("This pseudo mod contains files from the virtual data tree that got "
|
|
"modified (i.e. by the construction kit)");
|
|
}
|
|
|
|
QStringList ModInfoOverwrite::archives(bool checkOnDisk)
|
|
{
|
|
QStringList result;
|
|
QDir dir(this->absolutePath());
|
|
for (const QString &archive : dir.entryList(QStringList({ "*.bsa", "*.ba2" }))) {
|
|
result.append(this->absolutePath() + "/" + archive);
|
|
}
|
|
return result;
|
|
}
|