| 129 | }; |
| 130 | |
| 131 | ModFolderPage::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 | |
| 173 | void ModFolderPage::modItemActivated(const QModelIndex&) |
| 174 | { |
nothing calls this directly
no test coverage detected