summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorProject579 <star579avatar@gmail.com>2018-08-20 12:55:02 -0500
committerLostDragonist <lost.dragonist@gmail.com>2018-12-12 20:16:54 -0600
commit57178f898838afed6e7a50413899d6082aad9989 (patch)
treef4c7a00c5aa141225c2c2d6c4b6172761cd13b40 /src
parent49159de5d7084bf1ac159e3e37e2b406cdd87dbf (diff)
Added button to disable Archives in Data Tree and entirely.
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow.cpp56
-rw-r--r--src/mainwindow.h3
-rw-r--r--src/mainwindow.ui46
-rw-r--r--src/organizercore.cpp24
-rw-r--r--src/organizercore.h3
-rw-r--r--src/settings.cpp10
-rw-r--r--src/settings.h6
-rw-r--r--src/settingsdialog.ui21
8 files changed, 147 insertions, 22 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index d7ae18fb..0d3abce5 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -448,6 +448,19 @@ MainWindow::MainWindow(QSettings &initSettings
ui->profileBox->setCurrentText(m_OrganizerCore.currentProfile()->name());
+ if (m_OrganizerCore.getArchiveParsing())
+ {
+ ui->showArchiveDataCheckBox->setCheckState(Qt::Checked);
+ ui->showArchiveDataCheckBox->setEnabled(true);
+ m_showArchiveData = true;
+ }
+ else
+ {
+ ui->showArchiveDataCheckBox->setCheckState(Qt::Unchecked);
+ ui->showArchiveDataCheckBox->setEnabled(false);
+ m_showArchiveData = false;
+ }
+
refreshExecutablesList();
updateToolBar();
@@ -1250,11 +1263,15 @@ void MainWindow::updateTo(QTreeWidgetItem *subTree, const std::wstring &director
if (conflictsOnly && (current->getAlternatives().size() == 0)) {
continue;
}
+
+ bool isArchive = false;
+ int originID = current->getOrigin(isArchive);
+ if (!m_showArchiveData && isArchive) {
+ continue;
+ }
QString fileName = ToQString(current->getName());
QStringList columns(fileName);
- bool isArchive = false;
- int originID = current->getOrigin(isArchive);
FilesOrigin origin = m_OrganizerCore.directoryStructure()->getOriginByID(originID);
QString source("data");
unsigned int modIndex = ModInfo::getIndex(ToQString(origin.getName()));
@@ -4351,6 +4368,27 @@ void MainWindow::on_actionSettings_triggered()
m_OrganizerCore.profileRefresh();
}
+ const auto state = settings.archiveParsing();
+ if (state != m_OrganizerCore.getArchiveParsing())
+ {
+ m_OrganizerCore.setArchiveParsing(state);
+ if (!state)
+ {
+ ui->showArchiveDataCheckBox->setCheckState(Qt::Unchecked);
+ ui->showArchiveDataCheckBox->setEnabled(false);
+ m_showArchiveData = false;
+ }
+ else
+ {
+ ui->showArchiveDataCheckBox->setCheckState(Qt::Checked);
+ ui->showArchiveDataCheckBox->setEnabled(true);
+ m_showArchiveData = true;
+ }
+ m_OrganizerCore.refreshModList();
+ m_OrganizerCore.refreshDirectoryStructure();
+ m_OrganizerCore.refreshLists();
+ }
+
if (settings.getCacheDirectory() != oldCacheDirectory) {
NexusInterface::instance(&m_PluginContainer)->setCacheDirectory(settings.getCacheDirectory());
}
@@ -5985,3 +6023,17 @@ void MainWindow::sendSelectedModsToSeparator_clicked()
}
settings.setValue(key, dialog.saveGeometry());
}
+
+void MainWindow::on_showArchiveDataCheckBox_toggled(const bool checked)
+{
+ if (m_OrganizerCore.getArchiveParsing() && checked)
+ {
+ m_showArchiveData = checked;
+ }
+ else
+ {
+ m_showArchiveData = false;
+ }
+ refreshDataTree();
+}
+
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 69d08337..ad88c42c 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -373,6 +373,8 @@ private:
bool m_closing{ false };
+ bool m_showArchiveData{ true };
+
std::vector<std::pair<QString, QHeaderView*>> m_PersistedGeometry;
MOBase::DelayedFileWriter m_ArchiveListWriter;
@@ -600,6 +602,7 @@ private slots: // ui slots
void on_btnRefreshDownloads_clicked();
void on_categoriesList_customContextMenuRequested(const QPoint &pos);
void on_conflictsCheckBox_toggled(bool checked);
+ void on_showArchiveDataCheckBox_toggled(bool checked);
void on_dataTree_customContextMenuRequested(const QPoint &pos);
void on_executablesListBox_currentIndexChanged(int index);
void on_modList_customContextMenuRequested(const QPoint &pos);
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index 41365768..fba246f5 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -1152,19 +1152,39 @@ p, li { white-space: pre-wrap; }
</item>
</layout>
</item>
- <item>
- <widget class="QCheckBox" name="conflictsCheckBox">
- <property name="toolTip">
- <string>Filter the above list so that only conflicts are displayed.</string>
- </property>
- <property name="whatsThis">
- <string>Filter the above list so that only conflicts are displayed.</string>
- </property>
- <property name="text">
- <string>Show only conflicts</string>
- </property>
- </widget>
- </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_12">
+ <item>
+ <widget class="QCheckBox" name="conflictsCheckBox">
+ <property name="toolTip">
+ <string>Filters the above list so that only conflicts are displayed.</string>
+ </property>
+ <property name="whatsThis">
+ <string>Filters the above list so that only conflicts are displayed.</string>
+ </property>
+ <property name="text">
+ <string>Show only conflicts</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="showArchiveDataCheckBox">
+ <property name="toolTip">
+ <string>Filters the above list so that files from archives are not shown</string>
+ </property>
+ <property name="statusTip">
+ <string />
+ </property>
+ <property name="whatsThis">
+ <string>Filters the above list so that files from archives are not shown</string>
+ </property>
+ <property name="text">
+ <string>Show files from Archives</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
</layout>
</widget>
<widget class="QWidget" name="savesTab">
diff --git a/src/organizercore.cpp b/src/organizercore.cpp
index f19f56c3..d21fa844 100644
--- a/src/organizercore.cpp
+++ b/src/organizercore.cpp
@@ -786,6 +786,16 @@ std::wstring OrganizerCore::crashDumpsPath() {
).toStdWString();
}
+bool OrganizerCore::getArchiveParsing() const
+{
+ return m_ArchiveParsing;
+}
+
+void OrganizerCore::setArchiveParsing(const bool archiveParsing)
+{
+ m_ArchiveParsing = archiveParsing;
+}
+
void OrganizerCore::setCurrentProfile(const QString &profileName)
{
if ((m_CurrentProfile != nullptr)
@@ -1925,12 +1935,14 @@ IPluginGame const *OrganizerCore::managedGame() const
std::vector<QString> OrganizerCore::enabledArchives()
{
std::vector<QString> result;
- QFile archiveFile(m_CurrentProfile->getArchivesFileName());
- if (archiveFile.open(QIODevice::ReadOnly)) {
- while (!archiveFile.atEnd()) {
- result.push_back(QString::fromUtf8(archiveFile.readLine()).trimmed());
- }
- archiveFile.close();
+ if (m_ArchiveParsing) {
+ QFile archiveFile(m_CurrentProfile->getArchivesFileName());
+ if (archiveFile.open(QIODevice::ReadOnly)) {
+ while (!archiveFile.atEnd()) {
+ result.push_back(QString::fromUtf8(archiveFile.readLine()).trimmed());
+ }
+ archiveFile.close();
+ }
}
return result;
}
diff --git a/src/organizercore.h b/src/organizercore.h
index 086fa11d..d0964ed5 100644
--- a/src/organizercore.h
+++ b/src/organizercore.h
@@ -211,6 +211,8 @@ public:
bool onFinishedRun(const std::function<void (const QString &, unsigned int)> &func);
void refreshModList(bool saveChanges = true);
QStringList modsSortedByProfilePriority() const;
+ bool getArchiveParsing() const;
+ void setArchiveParsing(bool archiveParsing);
public: // IPluginDiagnose interface
@@ -335,6 +337,7 @@ private:
bool m_AskForNexusPW;
bool m_DirectoryUpdate;
bool m_ArchivesInit;
+ bool m_ArchiveParsing{ m_Settings.archiveParsing() };
MOBase::DelayedFileWriter m_PluginListsWriter;
UsvfsConnector m_USVFS;
diff --git a/src/settings.cpp b/src/settings.cpp
index 18e893cb..eb5b372f 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -474,6 +474,11 @@ uint Settings::getMotDHash() const
return m_Settings.value("motd_hash", 0).toUInt();
}
+bool Settings::archiveParsing() const
+{
+ return m_Settings.value("Settings/archive_parsing", true).toBool();
+}
+
QVariant Settings::pluginSetting(const QString &pluginName, const QString &key) const
{
auto iterPlugin = m_PluginSettings.find(pluginName);
@@ -1085,6 +1090,7 @@ Settings::WorkaroundsTab::WorkaroundsTab(Settings *m_parent,
, m_forceEnableBox(m_dialog.findChild<QCheckBox *>("forceEnableBox"))
, m_displayForeignBox(m_dialog.findChild<QCheckBox *>("displayForeignBox"))
, m_lockGUIBox(m_dialog.findChild<QCheckBox *>("lockGUIBox"))
+ , m_enableArchiveParsingBox(m_dialog.findChild<QCheckBox *>("enableArchiveParsingBox"))
{
m_appIDEdit->setText(m_parent->getSteamAppID());
@@ -1119,7 +1125,8 @@ Settings::WorkaroundsTab::WorkaroundsTab(Settings *m_parent,
m_forceEnableBox->setChecked(m_parent->forceEnableCoreFiles());
m_displayForeignBox->setChecked(m_parent->displayForeign());
m_lockGUIBox->setChecked(m_parent->lockGUI());
-
+ m_enableArchiveParsingBox->setChecked(m_parent->archiveParsing());
+
m_dialog.setExecutableBlacklist(m_parent->executablesBlacklist());
}
@@ -1137,6 +1144,7 @@ void Settings::WorkaroundsTab::update()
m_Settings.setValue("Settings/force_enable_core_files", m_forceEnableBox->isChecked());
m_Settings.setValue("Settings/display_foreign", m_displayForeignBox->isChecked());
m_Settings.setValue("Settings/lock_gui", m_lockGUIBox->isChecked());
+ m_Settings.setValue("Settings/archive_parsing", m_enableArchiveParsingBox->isChecked());
m_Settings.setValue("Settings/executable_blacklist", m_dialog.getExecutableBlacklist());
diff --git a/src/settings.h b/src/settings.h
index 912864e2..3694bfad 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -281,6 +281,11 @@ public:
void setMotDHash(uint hash);
/**
+ * @return true if the user wants to have archives being parsed to show conflicts and contents
+ */
+ bool archiveParsing() const;
+
+ /**
* @return hash of the last displayed message of the day
**/
uint getMotDHash() const;
@@ -514,6 +519,7 @@ private:
QCheckBox *m_forceEnableBox;
QCheckBox *m_displayForeignBox;
QCheckBox *m_lockGUIBox;
+ QCheckBox *m_enableArchiveParsingBox;
};
private slots:
diff --git a/src/settingsdialog.ui b/src/settingsdialog.ui
index 0412fc10..51f35683 100644
--- a/src/settingsdialog.ui
+++ b/src/settingsdialog.ui
@@ -1100,6 +1100,27 @@ programs you are intentionally running.</string>
</property>
</widget>
</item>
+ <item>
+ <widget class="QCheckBox" name="enableArchiveParsingBox">
+ <property name="toolTip">
+ <string>Enable parsing of Archives Archives, has effects on perfromance.</string>
+ </property>
+ <property name="whatsThis">
+ <string>
+ By default Mod Organizer will parse Archive files to calculate conflicts between themselves and loose files, this process has a noticeable cost in performance.
+ This feature should not be confused from the one offered by ModOrganizer 1, ModOrganizer 2 will only show conflicts with archives NOT load them into the game or program.
+
+ If you disable this feature, MO will only display conflicts with Loose files.
+ </string>
+ </property>
+ <property name="text">
+ <string>Enable parsing of Archives</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
<item>
<widget class="QPushButton" name="resetGeometryBtn">
<property name="toolTip">