fix: Polish usage in some cases
Also fiz some typos
This commit is contained in:
@ -59,14 +59,15 @@ auto ModPage::eventFilter(QObject* watched, QEvent* event) -> bool
|
||||
|
||||
void ModPage::filterMods()
|
||||
{
|
||||
filter_dialog.execWithInstance(static_cast<MinecraftInstance*>(m_instance));
|
||||
|
||||
auto ret = filter_dialog.execWithInstance(static_cast<MinecraftInstance*>(m_instance));
|
||||
m_filter = filter_dialog.getFilter();
|
||||
|
||||
listModel->refresh();
|
||||
if(ui->versionSelectionBox->count() > 0){
|
||||
if(ret == QDialog::DialogCode::Accepted){
|
||||
listModel->refresh();
|
||||
|
||||
int prev_count = ui->versionSelectionBox->count();
|
||||
ui->versionSelectionBox->clear();
|
||||
updateModVersions();
|
||||
updateModVersions(prev_count);
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,7 +153,7 @@ void ModPage::retranslate()
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
|
||||
void ModPage::updateModVersions()
|
||||
void ModPage::updateModVersions(int prev_count)
|
||||
{
|
||||
auto packProfile = (dynamic_cast<MinecraftInstance*>(m_instance))->getPackProfile();
|
||||
|
||||
@ -173,9 +174,11 @@ void ModPage::updateModVersions()
|
||||
if(valid || m_filter->versions.size() == 0)
|
||||
ui->versionSelectionBox->addItem(version.version, QVariant(i));
|
||||
}
|
||||
if (ui->versionSelectionBox->count() == 0) { ui->versionSelectionBox->addItem(tr("No valid version found!"), QVariant(-1)); }
|
||||
if (ui->versionSelectionBox->count() == 0 && prev_count != 0) {
|
||||
ui->versionSelectionBox->addItem(tr("No valid version found!"), QVariant(-1));
|
||||
ui->modSelectionButton->setText(tr("Cannot select invalid version :("));
|
||||
}
|
||||
|
||||
ui->modSelectionButton->setText(tr("Cannot select invalid version :("));
|
||||
updateSelectionButton();
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ class ModPage : public QWidget, public BasePage {
|
||||
auto getFilter() const -> const std::shared_ptr<FilterModsDialog::Filter> { return m_filter; }
|
||||
|
||||
auto getCurrent() -> ModPlatform::IndexedPack& { return current; }
|
||||
void updateModVersions();
|
||||
void updateModVersions(int prev_count = -1);
|
||||
|
||||
void openedImpl() override;
|
||||
auto eventFilter(QObject* watched, QEvent* event) -> bool override;
|
||||
|
@ -67,22 +67,22 @@ auto FlameModPage::validateVersion(ModPlatform::IndexedVersion& ver, QString min
|
||||
return ver.mcVersion.contains(mineVer);
|
||||
}
|
||||
|
||||
// We override this so that it refreshes correctly, otherwise it wouldn't show
|
||||
// any mod on the mod list, because the CF API does not support it :(
|
||||
// We override this so that it refreshes correctly, otherwise it would show
|
||||
// invalid mods on the mod list, because the API would return mods for the
|
||||
// wrong mod loader :(
|
||||
void FlameModPage::filterMods()
|
||||
{
|
||||
filter_dialog.execWithInstance(static_cast<MinecraftInstance*>(m_instance));
|
||||
|
||||
int prev_size = m_filter->versions.size();
|
||||
auto ret = filter_dialog.execWithInstance(static_cast<MinecraftInstance*>(m_instance));
|
||||
m_filter = filter_dialog.getFilter();
|
||||
int new_size = m_filter->versions.size();
|
||||
|
||||
if(new_size <= 1 && new_size != prev_size)
|
||||
listModel->refresh();
|
||||
if(ret == QDialog::DialogCode::Accepted){
|
||||
// CF API can't handle well this
|
||||
if(!m_filter->versions.empty())
|
||||
listModel->refresh();
|
||||
|
||||
if(ui->versionSelectionBox->count() > 0){
|
||||
int prev_count = ui->versionSelectionBox->count();
|
||||
ui->versionSelectionBox->clear();
|
||||
updateModVersions();
|
||||
updateModVersions(prev_count);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user