Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/editexecutablesdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ int EditExecutablesDialog::exec()

void EditExecutablesDialog::loadCustomOverwrites()
{
const auto* p = m_organizerCore.currentProfile();
const auto p = m_organizerCore.currentProfile();

for (const auto& e : m_executablesList) {
const auto s = p->setting("custom_overwrites", e.title()).toString();
Expand All @@ -152,7 +152,7 @@ void EditExecutablesDialog::loadCustomOverwrites()

void EditExecutablesDialog::loadForcedLibraries()
{
const auto* p = m_organizerCore.currentProfile();
const auto p = m_organizerCore.currentProfile();

for (const auto& e : m_executablesList) {
m_forcedLibraries.set(e.title(), p->forcedLibrariesEnabled(e.title()),
Expand Down Expand Up @@ -237,7 +237,7 @@ bool EditExecutablesDialog::commitChanges()
return false;
}

auto* profile = m_organizerCore.currentProfile();
auto profile = m_organizerCore.currentProfile();

// remove all the custom overwrites and forced libraries
for (const auto& e : m_originalExecutables) {
Expand Down
11 changes: 6 additions & 5 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1802,14 +1802,14 @@ void MainWindow::on_profileBox_currentIndexChanged(int index)

auto saveGames = m_OrganizerCore.gameFeatures().gameFeature<LocalSavegames>();
if (saveGames != nullptr) {
if (saveGames->prepareProfile(m_OrganizerCore.currentProfile())) {
if (saveGames->prepareProfile(m_OrganizerCore.currentProfile().get())) {
m_SavesTab->refreshSaveList();
}
}

auto invalidation = m_OrganizerCore.gameFeatures().gameFeature<BSAInvalidation>();
if (invalidation != nullptr) {
if (invalidation->prepareProfile(m_OrganizerCore.currentProfile())) {
if (invalidation->prepareProfile(m_OrganizerCore.currentProfile().get())) {
QTimer::singleShot(5, [this] {
m_OrganizerCore.refresh();
});
Expand Down Expand Up @@ -2048,7 +2048,8 @@ void MainWindow::checkBSAList()
ui->bsaList->blockSignals(false);
});

QStringList defaultArchives = archives->archives(m_OrganizerCore.currentProfile());
QStringList defaultArchives =
archives->archives(m_OrganizerCore.currentProfile().get());

bool warning = false;

Expand Down Expand Up @@ -2400,14 +2401,14 @@ void MainWindow::on_actionAdd_Profile_triggered()

auto saveGames = m_OrganizerCore.gameFeatures().gameFeature<LocalSavegames>();
if (saveGames != nullptr) {
if (saveGames->prepareProfile(m_OrganizerCore.currentProfile())) {
if (saveGames->prepareProfile(m_OrganizerCore.currentProfile().get())) {
m_SavesTab->refreshSaveList();
}
}

auto invalidation = m_OrganizerCore.gameFeatures().gameFeature<BSAInvalidation>();
if (invalidation != nullptr) {
if (invalidation->prepareProfile(m_OrganizerCore.currentProfile())) {
if (invalidation->prepareProfile(m_OrganizerCore.currentProfile().get())) {
QTimer::singleShot(5, [this] {
m_OrganizerCore.refresh();
});
Expand Down
2 changes: 1 addition & 1 deletion src/modinfodialogfiletree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ void FileTreeTab::onContextMenu(const QPoint& pos)
bool enableRunHooked = false;

if (enableRun || enableOpen) {
if (auto* p = core().currentProfile()) {
if (auto p = core().currentProfile()) {
if (mod().canBeEnabled()) {
const auto index = ModInfo::getIndex(mod().name());
if (index == UINT_MAX) {
Expand Down
2 changes: 1 addition & 1 deletion src/modlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ QStringList ModList::allMods() const

QStringList ModList::allModsByProfilePriority(MOBase::IProfile* profile) const
{
Profile* mo2Profile = profile == nullptr ? m_Organizer->currentProfile()
Profile* mo2Profile = profile == nullptr ? m_Organizer->currentProfile().get()
: static_cast<Profile*>(profile);

QStringList res;
Expand Down
5 changes: 3 additions & 2 deletions src/modlistview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,8 @@ void ModListView::setup(OrganizerCore& core, CategoryFactory& factory, MainWindo
});

// proxy for various group by
m_byPriorityProxy = new ModListByPriorityProxy(core.currentProfile(), core, this);
m_byPriorityProxy =
new ModListByPriorityProxy(core.currentProfile().get(), core, this);
m_byCategoryProxy = new QtGroupingProxy(QModelIndex(), ModList::COL_CATEGORY,
ModList::GroupingRole, 0, ModList::AggrRole);
m_byNexusIdProxy = new QtGroupingProxy(
Expand All @@ -758,7 +759,7 @@ void ModListView::setup(OrganizerCore& core, CategoryFactory& factory, MainWindo
});

// the top-level proxy
m_sortProxy = new ModListSortProxy(core.currentProfile(), &core);
m_sortProxy = new ModListSortProxy(core.currentProfile().get(), &core);
setModel(m_sortProxy);
connect(m_sortProxy, &ModList::modelReset, [=] {
refreshExpandedItems();
Expand Down
5 changes: 3 additions & 2 deletions src/organizercore.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,8 @@ class OrganizerCore : public QObject, public MOBase::IPluginDiagnose
m_ExecutablesList = executablesList;
}

Profile* currentProfile() const { return m_CurrentProfile.get(); }
std::shared_ptr<Profile> currentProfile() const { return m_CurrentProfile; }

void setCurrentProfile(const QString& profileName);

QStringList profileNames() const;
Expand Down Expand Up @@ -540,7 +541,7 @@ private slots:
MOBase::IPluginGame* m_GamePlugin;
ModDataContentHolder m_Contents;

std::unique_ptr<Profile> m_CurrentProfile;
std::shared_ptr<Profile> m_CurrentProfile;

Settings& m_Settings;

Expand Down
2 changes: 1 addition & 1 deletion src/organizerproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ MOBase::IGameFeatures* OrganizerProxy::gameFeatures() const
return m_GameFeaturesProxy.get();
}

MOBase::IProfile* OrganizerProxy::profile() const
std::shared_ptr<MOBase::IProfile> OrganizerProxy::profile() const
{
return m_Proxied->currentProfile();
}
Expand Down
2 changes: 1 addition & 1 deletion src/organizerproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class OrganizerProxy : public MOBase::IOrganizer
MOBase::IDownloadManager* downloadManager() const override;
MOBase::IPluginList* pluginList() const override;
MOBase::IModList* modList() const override;
MOBase::IProfile* profile() const override;
std::shared_ptr<MOBase::IProfile> profile() const override;
QStringList profileNames() const override;
std::shared_ptr<const MOBase::IProfile>
getProfile(const QString& name) const override;
Expand Down
2 changes: 1 addition & 1 deletion src/plugincontainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ void PluginContainer::startPluginsImpl(const std::vector<QObject*>& plugins) con
auto* plugin = qobject_cast<IPlugin*>(object);
auto* oproxy = organizerProxy(plugin);
oproxy->connectSignals();
oproxy->m_ProfileChanged(nullptr, m_Organizer->currentProfile());
oproxy->m_ProfileChanged(nullptr, m_Organizer->currentProfile().get());

if (m_UserInterface) {
oproxy->m_UserInterfaceInitialized(m_UserInterface->mainWindow());
Expand Down
2 changes: 1 addition & 1 deletion src/pluginlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ QString PluginList::getColumnToolTip(int column)
void PluginList::highlightPlugins(const std::vector<unsigned int>& modIndices,
const MOShared::DirectoryEntry& directoryEntry)
{
auto* profile = m_Organizer.currentProfile();
auto profile = m_Organizer.currentProfile();

for (auto& esp : m_ESPs) {
esp.modSelected = false;
Expand Down
6 changes: 3 additions & 3 deletions src/processrunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ ProcessRunner& ProcessRunner::setFromFile(QWidget* parent, const QFileInfo& targ

ProcessRunner& ProcessRunner::setFromExecutable(const Executable& exe)
{
const auto* profile = m_core.currentProfile();
const auto profile = m_core.currentProfile();
if (!profile) {
throw MyException(QObject::tr("No profile set"));
}
Expand Down Expand Up @@ -611,7 +611,7 @@ ProcessRunner& ProcessRunner::setFromFileOrExecutable(
const QString& profileOverride, const QString& forcedCustomOverwrite,
bool ignoreCustomOverwrite)
{
const auto* profile = m_core.currentProfile();
const auto profile = m_core.currentProfile();
if (!profile) {
throw MyException(QObject::tr("No profile set"));
}
Expand Down Expand Up @@ -757,7 +757,7 @@ std::optional<ProcessRunner::Results> ProcessRunner::runBinary()
{
if (m_profileName.isEmpty()) {
// get the current profile name if it wasn't overridden
const auto* profile = m_core.currentProfile();
const auto profile = m_core.currentProfile();
if (!profile) {
throw MyException(QObject::tr("No profile set"));
}
Expand Down