Skip to content

Commit

Permalink
Start working on extensions tab in settings.
Browse files Browse the repository at this point in the history
  • Loading branch information
Holt59 committed Aug 5, 2024
1 parent 3f90b9e commit 680eed7
Show file tree
Hide file tree
Showing 15 changed files with 550 additions and 355 deletions.
3 changes: 2 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,8 @@ mo2_add_filter(NAME src/settingsdialog GROUPS
settingsdialoggeneral
settingsdialognexus
settingsdialogpaths
settingsdialogplugins
settingsdialogextensions
settingsdialogextensionrow
settingsdialogworkarounds
settingsdialogmodlist
settingsdialogtheme
Expand Down
11 changes: 6 additions & 5 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,15 @@ void setFilterShortcuts(QWidget* widget, QLineEdit* edit)
}

MainWindow::MainWindow(Settings& settings, OrganizerCore& organizerCore,
PluginManager& pluginManager, ThemeManager& themeManager,
ExtensionManager& extensionManager, PluginManager& pluginManager,
ThemeManager& themeManager,
TranslationManager& translationManager, QWidget* parent)
: QMainWindow(parent), ui(new Ui::MainWindow), m_WasVisible(false),
m_FirstPaint(true), m_linksSeparator(nullptr), m_Tutorial(this, "MainWindow"),
m_OldProfileIndex(-1), m_OldExecutableIndex(-1),
m_CategoryFactory(CategoryFactory::instance()), m_OrganizerCore(organizerCore),
m_PluginManager(pluginManager), m_ThemeManager(themeManager),
m_TranslationManager(translationManager),
m_ExtensionManager(extensionManager), m_PluginManager(pluginManager),
m_ThemeManager(themeManager), m_TranslationManager(translationManager),
m_ArchiveListWriter(std::bind(&MainWindow::saveArchiveList, this)),
m_LinkToolbar(nullptr), m_LinkDesktop(nullptr), m_LinkStartMenu(nullptr),
m_NumberOfProblems(0), m_ProblemsCheckRequired(false)
Expand Down Expand Up @@ -2719,8 +2720,8 @@ void MainWindow::on_actionSettings_triggered()
const bool oldCheckForUpdates = settings.checkForUpdates();
const int oldMaxDumps = settings.diagnostics().maxCoreDumps();

SettingsDialog dialog(m_PluginManager, m_ThemeManager, m_TranslationManager, settings,
this);
SettingsDialog dialog(m_ExtensionManager, m_PluginManager, m_ThemeManager,
m_TranslationManager, settings, this);
dialog.exec();

auto e = dialog.exitNeeded();
Expand Down
5 changes: 4 additions & 1 deletion src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include <uibase/tutorialcontrol.h>

#include "delayedfilewriter.h"
#include "extensionmanager.h"
#include "iuserinterface.h"
#include "modinfo.h"
#include "modlistbypriorityproxy.h"
Expand Down Expand Up @@ -128,7 +129,8 @@ class MainWindow : public QMainWindow, public IUserInterface

public:
explicit MainWindow(Settings& settings, OrganizerCore& organizerCore,
PluginManager& pluginManager, ThemeManager& themeManager,
ExtensionManager& extensionManager, PluginManager& pluginManager,
ThemeManager& themeManager,
TranslationManager& translationManager, QWidget* parent = 0);
~MainWindow();

Expand Down Expand Up @@ -298,6 +300,7 @@ private slots:
QTime m_StartTime;

OrganizerCore& m_OrganizerCore;
ExtensionManager& m_ExtensionManager;
PluginManager& m_PluginManager;
ThemeManager& m_ThemeManager;
TranslationManager& m_TranslationManager;
Expand Down
3 changes: 2 additions & 1 deletion src/moapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,8 @@ int MOApplication::run(MOMultiProcess& multiProcess)

{
tt.start("MOApplication::doOneRun() MainWindow setup");
MainWindow mainWindow(*m_settings, *m_core, *m_plugins, *m_themes, *m_translations);
MainWindow mainWindow(*m_settings, *m_core, *m_extensions, *m_plugins, *m_themes,
*m_translations);

// the nexus interface can show dialogs, make sure they're parented to the
// main window
Expand Down
2 changes: 1 addition & 1 deletion src/pluginmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ PluginDetails::PluginDetails(PluginManager* manager, PluginExtension const& exte

void PluginDetails::fetchRequirements()
{
m_requirements = m_plugin->requirements();
// m_requirements = m_plugin->requirements();
}

std::vector<IPluginRequirement::Problem> PluginDetails::problems() const
Expand Down
9 changes: 5 additions & 4 deletions src/settingsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,24 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.

#include "settingsdialog.h"
#include "settingsdialogdiagnostics.h"
#include "settingsdialogextensions.h"
#include "settingsdialoggeneral.h"
#include "settingsdialogmodlist.h"
#include "settingsdialognexus.h"
#include "settingsdialogpaths.h"
#include "settingsdialogplugins.h"
#include "settingsdialogtheme.h"
#include "settingsdialogworkarounds.h"
#include "ui_settingsdialog.h"

using namespace MOBase;

SettingsDialog::SettingsDialog(PluginManager& pluginManager,
SettingsDialog::SettingsDialog(ExtensionManager& extensionManager,
PluginManager& pluginManager,
ThemeManager const& themeManager,
TranslationManager const& translationManager,
Settings& settings, QWidget* parent)
: TutorableDialog("SettingsDialog", parent), ui(new Ui::SettingsDialog),
m_settings(settings), m_exit(Exit::None), m_pluginManager(&pluginManager)
m_settings(settings), m_exit(Exit::None)
{
ui->setupUi(this);

Expand All @@ -50,7 +51,7 @@ SettingsDialog::SettingsDialog(PluginManager& pluginManager,
std::unique_ptr<SettingsTab>(new DiagnosticsSettingsTab(settings, *this)));
m_tabs.push_back(std::unique_ptr<SettingsTab>(new NexusSettingsTab(settings, *this)));
m_tabs.push_back(std::unique_ptr<SettingsTab>(
new PluginsSettingsTab(settings, *m_pluginManager, *this)));
new ExtensionsSettingsTab(settings, extensionManager, pluginManager, *this)));
m_tabs.push_back(
std::unique_ptr<SettingsTab>(new WorkaroundsSettingsTab(settings, *this)));
}
Expand Down
5 changes: 3 additions & 2 deletions src/settingsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "tutorabledialog.h"

class PluginManager;
class ExtensionManager;
class Settings;
class SettingsDialog;
class ThemeManager;
Expand Down Expand Up @@ -66,7 +67,8 @@ class SettingsDialog : public MOBase::TutorableDialog
friend class SettingsTab;

public:
explicit SettingsDialog(PluginManager& pluginManager,
explicit SettingsDialog(ExtensionManager& extensionManager,
PluginManager& pluginManager,
ThemeManager const& themeManager,
TranslationManager const& translationManager,
Settings& settings, QWidget* parent = 0);
Expand Down Expand Up @@ -94,7 +96,6 @@ public slots:
Settings& m_settings;
std::vector<std::unique_ptr<SettingsTab>> m_tabs;
ExitFlags m_exit;
PluginManager* m_pluginManager;
};

#endif // SETTINGSDIALOG_H
12 changes: 3 additions & 9 deletions src/settingsdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1476,9 +1476,9 @@ If you disable this feature, MO will only display official DLCs this way. Please
</item>
</layout>
</widget>
<widget class="QWidget" name="pluginsTab">
<widget class="QWidget" name="extensionsTab">
<attribute name="title">
<string>Plugins</string>
<string>Extensions</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_9">
<item>
Expand Down Expand Up @@ -1532,13 +1532,7 @@ If you disable this feature, MO will only display official DLCs this way. Please
<number>0</number>
</property>
<item>
<widget class="QTreeWidget" name="pluginsList">
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
</widget>
<widget class="QListWidget" name="extensionsList"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
Expand Down
18 changes: 18 additions & 0 deletions src/settingsdialogextensionrow.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include "settingsdialogextensionrow.h"

#include "ui_settingsdialogextensionrow.h"

using namespace MOBase;

ExtensionListItemWidget::ExtensionListItemWidget(const IExtension& extension)
: ui{new Ui::ExtensionListItemWidget()}, m_extension{&extension}
{
ui->setupUi(this);

QIcon icon = style()->standardIcon(QStyle::SP_DialogOkButton);
ui->extensionIcon->setPixmap(extension.metadata().icon().pixmap(QSize(48, 48)));
ui->extensionName->setText(extension.metadata().name());

ui->extensionDescription->setText(extension.metadata().description());
ui->extensionAuthor->setText(extension.metadata().author().name());
}
23 changes: 23 additions & 0 deletions src/settingsdialogextensionrow.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#ifndef SETTINGSDIALOGEXTENSIONROW_H
#define SETTINGSDIALOGEXTENSIONROW_H

#include <QWidget>

#include "extension.h"

namespace Ui
{
class ExtensionListItemWidget;
}

class ExtensionListItemWidget : public QWidget
{
public:
ExtensionListItemWidget(MOBase::IExtension const& extension);

private:
Ui::ExtensionListItemWidget* ui;
const MOBase::IExtension* m_extension;
};

#endif
123 changes: 123 additions & 0 deletions src/settingsdialogextensionrow.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ExtensionListItemWidget</class>
<widget class="QWidget" name="ExtensionListItemWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>250</width>
<height>60</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<widget class="QLabel" name="extensionIcon">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>45</width>
<height>48</height>
</size>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>2</number>
</property>
<item>
<widget class="QLabel" name="extensionName">
<property name="font">
<font>
<pointsize>10</pointsize>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="extensionDescription">
<property name="font">
<font>
<pointsize>8</pointsize>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="extensionAuthor">
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
Loading

0 comments on commit 680eed7

Please sign in to comment.