MCPcopy Create free account
hub / github.com/ModOrganizer2/modorganizer / selectVariant

Function selectVariant

src/instancemanager.cpp:777–801  ·  view source on GitHub ↗

shows the game variant page of the create instance dialog so the user can pick which game variant is installed this is used below in setupInstance() when there is no variant in the ini but the game plugin requires one; this can happen when the ini is broken or when a new variant has become supported by the plugin for a game the user already has an instance for

Source from the content-addressed store, hash-verified

775// user already has an instance for
776//
777SetupInstanceResults selectVariant(Instance& instance, PluginContainer& pc)
778{
779 CreateInstanceDialog dlg(pc, nullptr);
780
781 // the variant page uses the game page to know which game was selected, so
782 // set it manually
783 dlg.getPage<cid::GamePage>()->select(instance.gamePlugin(), instance.gameDirectory());
784
785 // only show the variant page
786 dlg.setSinglePage<cid::VariantsPage>(instance.displayName());
787
788 dlg.show();
789 dlg.activateWindow();
790 dlg.raise();
791
792 if (dlg.exec() != QDialog::Accepted) {
793 return SetupInstanceResults::SelectAnother;
794 }
795
796 // this info will be used instead of the ini, which should fix this
797 // particular problem
798 instance.setVariant(dlg.creationInfo().gameVariant);
799
800 return SetupInstanceResults::TryAgain;
801}
802
803SetupInstanceResults setupInstance(Instance& instance, PluginContainer& pc)
804{

Callers 1

setupInstanceFunction · 0.85

Calls 7

gamePluginMethod · 0.80
gameDirectoryMethod · 0.80
setVariantMethod · 0.80
creationInfoMethod · 0.80
selectMethod · 0.45
displayNameMethod · 0.45
execMethod · 0.45

Tested by

no test coverage detected