Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Extensions #1848

Open
wants to merge 23 commits into
base: dev/vcpkg
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ edit
/msbuild.log
/*std*.log
/*build
.vscode

/src/version.aps
14 changes: 5 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@ set(MO2_CMAKE_DEPRECATED_UIBASE_INCLUDE ON)

project(organizer)

# if MO2_INSTALL_IS_BIN is set, this means that we should install directly into the
# installation prefix, without the bin/ subfolder, typically for a standalone build
# to update an existing install
if (MO2_INSTALL_IS_BIN)
set(_bin ".")
else()
set(_bin bin)
endif()
find_package(mo2-cmake CONFIG REQUIRED)

set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1)

add_subdirectory(src)
add_subdirectory(themes)

set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT organizer)

install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dump_running_process.bat DESTINATION ${_bin})
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dump_running_process.bat DESTINATION ${MO2_INSTALL_BIN})
2 changes: 1 addition & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"value": "x64"
},
"cacheVariables": {
"CMAKE_CXX_FLAGS": "/EHsc /MP /W4",
"CMAKE_CXX_FLAGS": "/EHsc /MP /W3",
"VCPKG_TARGET_TRIPLET": {
"type": "STRING",
"value": "x64-windows-static-md"
Expand Down
53 changes: 30 additions & 23 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ set_target_properties(organizer PROPERTIES

# disable translations because we want to be able to install somewhere else if
# required
mo2_configure_target(organizer WARNINGS 4 TRANSLATIONS OFF)
mo2_configure_target(organizer WARNINGS 3 TRANSLATIONS OFF)

# we add translations "manually" to handle MO2_INSTALL_IS_BIN
mo2_add_translations(organizer
INSTALL_RELEASE
INSTALL_DIRECTORY "${_bin}/translations"
INSTALL_DIRECTORY "${MO2_INSTALL_BIN}/translations"
SOURCES ${CMAKE_CURRENT_SOURCE_DIR})

mo2_set_project_to_run_from_install(
organizer EXECUTABLE ${CMAKE_INSTALL_PREFIX}/${_bin}/ModOrganizer.exe)
organizer EXECUTABLE ${CMAKE_INSTALL_PREFIX}/${MO2_INSTALL_BIN}/ModOrganizer.exe)

target_link_libraries(organizer PRIVATE
Shlwapi Bcrypt
Expand All @@ -44,36 +44,30 @@ target_link_libraries(organizer PRIVATE
Qt6::WebEngineWidgets Qt6::WebSockets Version Dbghelp)

install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/dlls.manifest.qt6"
DESTINATION ${_bin}/dlls
DESTINATION ${MO2_INSTALL_BIN}/dlls
CONFIGURATIONS Release RelWithDebInfo
RENAME dlls.manifest)
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/dlls.manifest.debug.qt6"
DESTINATION ${_bin}/dlls
DESTINATION ${MO2_INSTALL_BIN}/dlls
CONFIGURATIONS Debug
RENAME dlls.manifest)

if (NOT MO2_SKIP_STYLESHEETS_INSTALL)
install(
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/stylesheets"
DESTINATION ${_bin})
endif()

if (NOT MO2_SKIP_TUTORIALS_INSTALL)
install(
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/tutorials"
DESTINATION ${_bin})
DESTINATION ${MO2_INSTALL_BIN})
endif()

install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/resources/markdown.html"
DESTINATION ${_bin}/resources)
DESTINATION ${MO2_INSTALL_BIN}/resources)

# install ModOrganizer.exe itself
install(FILES $<TARGET_FILE:organizer> DESTINATION ${_bin})
install(FILES $<TARGET_FILE:organizer> DESTINATION ${MO2_INSTALL_BIN})

# install dependencies DLLs
install(FILES $<TARGET_FILE:mo2::libbsarch> DESTINATION ${_bin}/dlls)
install(FILES $<TARGET_FILE:mo2::archive> DESTINATION ${_bin}/dlls)
install(FILES $<TARGET_FILE:7zip::7zip> DESTINATION ${_bin}/dlls)
install(FILES $<TARGET_FILE:mo2::libbsarch> DESTINATION ${MO2_INSTALL_BIN}/dlls)
install(FILES $<TARGET_FILE:mo2::archive> DESTINATION ${MO2_INSTALL_BIN}/dlls)
install(FILES $<TARGET_FILE:7zip::7zip> DESTINATION ${MO2_INSTALL_BIN}/dlls)

# this may copy over the ones from uibase/usvfs
# - when building with mob, this should not matter as the files should be identical
Expand All @@ -89,15 +83,15 @@ install(FILES
$<TARGET_FILE:usvfs_x86::usvfs_dll>
$<TARGET_FILE:usvfs_x64::usvfs_proxy>
$<TARGET_FILE:usvfs_x86::usvfs_proxy>
DESTINATION ${_bin})
DESTINATION ${MO2_INSTALL_BIN})

# do not install PDB if CMAKE_INSTALL_PREFIX is "bin"
if (NOT MO2_INSTALL_IS_BIN)
install(FILES $<TARGET_PDB_FILE:organizer> DESTINATION pdb)
endif()

mo2_deploy_qt(
DIRECTORY ${_bin}
DIRECTORY ${MO2_INSTALL_BIN}
BINARIES ModOrganizer.exe $<TARGET_FILE_NAME:mo2::uibase>)

# set source groups for VS
Expand Down Expand Up @@ -127,20 +121,29 @@ mo2_add_filter(NAME src/categories GROUPS

mo2_add_filter(NAME src/core GROUPS
archivefiletree
githubpp
github
inibakery
installationmanager
nexusinterface
nxmaccessmanager
organizercore
game_features
plugincontainer
apiuseraccount
processrunner
qdirfiletree
virtualfiletree
uilocker
)

mo2_add_filter(NAME src/extensions GROUPS
game_features
thememanager
translationmanager
extensionmanager
extensionwatcher
pluginmanager
proxyqt
)

mo2_add_filter(NAME src/dialogs GROUPS
aboutdialog
activatemodsdialog
Expand Down Expand Up @@ -276,6 +279,7 @@ mo2_add_filter(NAME src/proxies GROUPS
downloadmanagerproxy
gamefeaturesproxy
modlistproxy
extensionlistproxy
organizerproxy
pluginlistproxy
proxyutils
Expand All @@ -292,6 +296,7 @@ mo2_add_filter(NAME src/register GROUPS
)

mo2_add_filter(NAME src/settings GROUPS
extensionsettings
settings
settingsutilities
)
Expand All @@ -302,7 +307,9 @@ mo2_add_filter(NAME src/settingsdialog GROUPS
settingsdialoggeneral
settingsdialognexus
settingsdialogpaths
settingsdialogplugins
settingsdialogextensions
settingsdialogextensionrow
settingsdialogextensioninfo
settingsdialogworkarounds
settingsdialogmodlist
settingsdialogtheme
Expand Down
2 changes: 0 additions & 2 deletions src/categoriesdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#define CATEGORIESDIALOG_H

#include "categories.h"
#include "plugincontainer.h"
#include "tutorabledialog.h"
#include <set>

Expand Down Expand Up @@ -71,7 +70,6 @@ private slots:

private:
Ui::CategoriesDialog* ui;
PluginContainer* m_PluginContainer;
int m_ContextRow;

int m_HighestID;
Expand Down
3 changes: 2 additions & 1 deletion src/commandline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -828,8 +828,9 @@ std::optional<int> ReloadPluginCommand::runPostOrganizer(OrganizerCore& core)
QDir(qApp->applicationDirPath() + "/" + ToQString(AppConfig::pluginPath()))
.absoluteFilePath(name);

// TODO: reload extension, not plugin
log::debug("reloading plugin from {}", filepath);
core.pluginContainer().reloadPlugin(filepath);
// core.pluginManager().reloadPlugin(filepath);

return {};
}
Expand Down
10 changes: 5 additions & 5 deletions src/createinstancedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class DirectoryCreator
std::vector<QDir> m_created;
};

CreateInstanceDialog::CreateInstanceDialog(const PluginContainer& pc, Settings* s,
CreateInstanceDialog::CreateInstanceDialog(const PluginManager& pc, Settings* s,
QWidget* parent)
: QDialog(parent), ui(new Ui::CreateInstanceDialog), m_pc(pc), m_settings(s),
m_switching(false), m_singlePage(false)
Expand Down Expand Up @@ -133,13 +133,13 @@ CreateInstanceDialog::CreateInstanceDialog(const PluginContainer& pc, Settings*

addShortcutAction(QKeySequence::Find, Actions::Find);

addShortcut(Qt::ALT + Qt::Key_Left, [&] {
addShortcut(Qt::ALT | Qt::Key_Left, [&] {
back();
});
addShortcut(Qt::ALT + Qt::Key_Right, [&] {
addShortcut(Qt::ALT | Qt::Key_Right, [&] {
next(false);
});
addShortcut(Qt::CTRL + Qt::Key_Return, [&] {
addShortcut(Qt::CTRL | Qt::Key_Return, [&] {
next();
});

Expand All @@ -161,7 +161,7 @@ Ui::CreateInstanceDialog* CreateInstanceDialog::getUI()
return ui.get();
}

const PluginContainer& CreateInstanceDialog::pluginContainer()
const PluginManager& CreateInstanceDialog::pluginManager()
{
return m_pc;
}
Expand Down
9 changes: 4 additions & 5 deletions src/createinstancedialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace cid
class Page;
}

class PluginContainer;
class PluginManager;
class Settings;

// this is a wizard for creating a new instance, it is made out of Page objects,
Expand Down Expand Up @@ -90,13 +90,12 @@ class CreateInstanceDialog : public QDialog
ProfileSettings profileSettings;
};

CreateInstanceDialog(const PluginContainer& pc, Settings* s,
QWidget* parent = nullptr);
CreateInstanceDialog(const PluginManager& pc, Settings* s, QWidget* parent = nullptr);

~CreateInstanceDialog();

Ui::CreateInstanceDialog* getUI();
const PluginContainer& pluginContainer();
const PluginManager& pluginManager();
Settings* settings();

// disables all the pages except for the given one, used on startup when some
Expand Down Expand Up @@ -185,7 +184,7 @@ class CreateInstanceDialog : public QDialog

private:
std::unique_ptr<Ui::CreateInstanceDialog> ui;
const PluginContainer& m_pc;
const PluginManager& m_pc;
Settings* m_settings;
std::vector<std::unique_ptr<cid::Page>> m_pages;
QString m_originalNext;
Expand Down
4 changes: 2 additions & 2 deletions src/createinstancedialogpages.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "createinstancedialogpages.h"
#include "filesystemutilities.h"
#include "instancemanager.h"
#include "plugincontainer.h"
#include "pluginmanager.h"
#include "settings.h"
#include "settingsdialognexus.h"
#include "shared/appconfig.h"
Expand Down Expand Up @@ -55,7 +55,7 @@ void PlaceholderLabel::setVisible(bool b)
}

Page::Page(CreateInstanceDialog& dlg)
: ui(dlg.getUI()), m_dlg(dlg), m_pc(dlg.pluginContainer()), m_skip(false),
: ui(dlg.getUI()), m_dlg(dlg), m_pc(dlg.pluginManager()), m_skip(false),
m_firstActivation(true)
{}

Expand Down
2 changes: 1 addition & 1 deletion src/createinstancedialogpages.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class Page
protected:
Ui::CreateInstanceDialog* ui;
CreateInstanceDialog& m_dlg;
const PluginContainer& m_pc;
const PluginManager& m_pc;
bool m_skip;
bool m_firstActivation;

Expand Down
6 changes: 3 additions & 3 deletions src/datatab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ using namespace MOBase;
// in mainwindow.cpp
QString UnmanagedModName();

DataTab::DataTab(OrganizerCore& core, PluginContainer& pc, QWidget* parent,
DataTab::DataTab(OrganizerCore& core, PluginManager& pc, QWidget* parent,
Ui::MainWindow* mwui)
: m_core(core), m_pluginContainer(pc), m_parent(parent),
: m_core(core), m_pluginManager(pc), m_parent(parent),
ui{mwui->tabWidget,
mwui->dataTab,
mwui->dataTabRefresh,
Expand All @@ -26,7 +26,7 @@ DataTab::DataTab(OrganizerCore& core, PluginContainer& pc, QWidget* parent,
mwui->dataTabShowHiddenFiles},
m_needUpdate(true)
{
m_filetree.reset(new FileTree(core, m_pluginContainer, ui.tree));
m_filetree.reset(new FileTree(core, m_pluginManager, ui.tree));
m_filter.setUseSourceSort(true);
m_filter.setFilterColumn(FileTreeModel::FileName);
m_filter.setEdit(mwui->dataTabFilter);
Expand Down
7 changes: 3 additions & 4 deletions src/datatab.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class MainWindow;
}
class OrganizerCore;
class Settings;
class PluginContainer;
class PluginManager;
class FileTree;

namespace MOShared
Expand All @@ -27,8 +27,7 @@ class DataTab : public QObject
Q_OBJECT;

public:
DataTab(OrganizerCore& core, PluginContainer& pc, QWidget* parent,
Ui::MainWindow* ui);
DataTab(OrganizerCore& core, PluginManager& pc, QWidget* parent, Ui::MainWindow* ui);

void saveState(Settings& s) const;
void restoreState(const Settings& s);
Expand Down Expand Up @@ -58,7 +57,7 @@ class DataTab : public QObject
};

OrganizerCore& m_core;
PluginContainer& m_pluginContainer;
PluginManager& m_pluginManager;
QWidget* m_parent;
DataTabUi ui;
std::unique_ptr<FileTree> m_filetree;
Expand Down
34 changes: 0 additions & 34 deletions src/disableproxyplugindialog.cpp

This file was deleted.

Loading
Loading