MCPcopy Create free account
hub / github.com/MultiMC/Launcher / ModFolderPage

Method ModFolderPage

launcher/ui/pages/instance/ModFolderPage.cpp:131–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129};
130
131ModFolderPage::ModFolderPage(
132 BaseInstance *inst,
133 std::shared_ptr<ModFolderModel> mods,
134 QString id,
135 QString iconName,
136 QString displayName,
137 QString helpPage,
138 QWidget *parent
139) :
140 QMainWindow(parent),
141 ui(new Ui::ModFolderPage)
142{
143 ui->setupUi(this);
144 ui->actionsToolbar->insertSpacer(ui->actionView_configs);
145
146 m_inst = inst;
147 on_RunningState_changed(m_inst && m_inst->isRunning());
148 m_mods = mods;
149 m_id = id;
150 m_displayName = displayName;
151 m_iconName = iconName;
152 m_helpName = helpPage;
153 m_fileSelectionFilter = "%1 (*.zip *.jar)";
154 m_filterModel = new ModSortProxy(this);
155 m_filterModel->setDynamicSortFilter(true);
156 m_filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
157 m_filterModel->setSortCaseSensitivity(Qt::CaseInsensitive);
158 m_filterModel->setSourceModel(m_mods.get());
159 m_filterModel->setFilterKeyColumn(-1);
160 ui->modTreeView->setModel(m_filterModel);
161 ui->modTreeView->installEventFilter(this);
162 ui->modTreeView->sortByColumn(1, Qt::AscendingOrder);
163 ui->modTreeView->setContextMenuPolicy(Qt::CustomContextMenu);
164 connect(ui->modTreeView, &ModListView::customContextMenuRequested, this, &ModFolderPage::ShowContextMenu);
165 connect(ui->modTreeView, &ModListView::activated, this, &ModFolderPage::modItemActivated);
166
167 auto smodel = ui->modTreeView->selectionModel();
168 connect(smodel, &QItemSelectionModel::currentChanged, this, &ModFolderPage::modCurrent);
169 connect(ui->filterEdit, &QLineEdit::textChanged, this, &ModFolderPage::on_filterTextChanged);
170 connect(m_inst, &BaseInstance::runningStatusChanged, this, &ModFolderPage::on_RunningState_changed);
171}
172
173void ModFolderPage::modItemActivated(const QModelIndex&)
174{

Callers

nothing calls this directly

Calls 6

insertSpacerMethod · 0.80
setSourceModelMethod · 0.80
setupUiMethod · 0.45
isRunningMethod · 0.45
getMethod · 0.45
setModelMethod · 0.45

Tested by

no test coverage detected