commit
0975dbc3dd
@ -89,17 +89,13 @@ void ModPage::filterMods()
|
|||||||
|
|
||||||
void ModPage::triggerSearch()
|
void ModPage::triggerSearch()
|
||||||
{
|
{
|
||||||
auto changed = m_filter_widget->changed();
|
|
||||||
m_filter = m_filter_widget->getFilter();
|
m_filter = m_filter_widget->getFilter();
|
||||||
|
|
||||||
if (changed) {
|
|
||||||
m_ui->packView->clearSelection();
|
m_ui->packView->clearSelection();
|
||||||
m_ui->packDescription->clear();
|
m_ui->packDescription->clear();
|
||||||
m_ui->versionSelectionBox->clear();
|
m_ui->versionSelectionBox->clear();
|
||||||
updateSelectionButton();
|
updateSelectionButton();
|
||||||
}
|
|
||||||
|
|
||||||
static_cast<ModModel*>(m_model)->searchWithTerm(getSearchTerm(), m_ui->sortByBox->currentData().toUInt(), changed);
|
static_cast<ModModel*>(m_model)->searchWithTerm(getSearchTerm(), m_ui->sortByBox->currentData().toUInt(), m_filter_widget->changed());
|
||||||
m_fetch_progress.watch(m_model->activeSearchJob().get());
|
m_fetch_progress.watch(m_model->activeSearchJob().get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,6 +118,8 @@ void ModPage::updateVersionList()
|
|||||||
QString mcVersion = packProfile->getComponentVersion("net.minecraft");
|
QString mcVersion = packProfile->getComponentVersion("net.minecraft");
|
||||||
|
|
||||||
auto current_pack = getCurrentPack();
|
auto current_pack = getCurrentPack();
|
||||||
|
if (!current_pack)
|
||||||
|
return;
|
||||||
for (int i = 0; i < current_pack->versions.size(); i++) {
|
for (int i = 0; i < current_pack->versions.size(); i++) {
|
||||||
auto version = current_pack->versions[i];
|
auto version = current_pack->versions[i];
|
||||||
bool valid = false;
|
bool valid = false;
|
||||||
|
@ -174,7 +174,11 @@ ModPlatform::IndexedPack::Ptr ResourcePage::getCurrentPack() const
|
|||||||
void ResourcePage::updateUi()
|
void ResourcePage::updateUi()
|
||||||
{
|
{
|
||||||
auto current_pack = getCurrentPack();
|
auto current_pack = getCurrentPack();
|
||||||
|
if (!current_pack) {
|
||||||
|
m_ui->packDescription->setHtml({});
|
||||||
|
m_ui->packDescription->flush();
|
||||||
|
return;
|
||||||
|
}
|
||||||
QString text = "";
|
QString text = "";
|
||||||
QString name = current_pack->name;
|
QString name = current_pack->name;
|
||||||
|
|
||||||
@ -240,8 +244,8 @@ void ResourcePage::updateSelectionButton()
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_ui->resourceSelectionButton->setEnabled(true);
|
m_ui->resourceSelectionButton->setEnabled(true);
|
||||||
if (getCurrentPack()) {
|
if (auto current_pack = getCurrentPack(); current_pack) {
|
||||||
if (!getCurrentPack()->isVersionSelected(m_selected_version_index))
|
if (!current_pack->isVersionSelected(m_selected_version_index))
|
||||||
m_ui->resourceSelectionButton->setText(tr("Select %1 for download").arg(resourceString()));
|
m_ui->resourceSelectionButton->setText(tr("Select %1 for download").arg(resourceString()));
|
||||||
else
|
else
|
||||||
m_ui->resourceSelectionButton->setText(tr("Deselect %1 for download").arg(resourceString()));
|
m_ui->resourceSelectionButton->setText(tr("Deselect %1 for download").arg(resourceString()));
|
||||||
@ -258,6 +262,7 @@ void ResourcePage::updateVersionList()
|
|||||||
m_ui->versionSelectionBox->clear();
|
m_ui->versionSelectionBox->clear();
|
||||||
m_ui->versionSelectionBox->blockSignals(false);
|
m_ui->versionSelectionBox->blockSignals(false);
|
||||||
|
|
||||||
|
if (current_pack)
|
||||||
for (int i = 0; i < current_pack->versions.size(); i++) {
|
for (int i = 0; i < current_pack->versions.size(); i++) {
|
||||||
auto& version = current_pack->versions[i];
|
auto& version = current_pack->versions[i];
|
||||||
if (optedOut(version))
|
if (optedOut(version))
|
||||||
@ -283,7 +288,7 @@ void ResourcePage::onSelectionChanged(QModelIndex curr, QModelIndex prev)
|
|||||||
auto current_pack = getCurrentPack();
|
auto current_pack = getCurrentPack();
|
||||||
|
|
||||||
bool request_load = false;
|
bool request_load = false;
|
||||||
if (!current_pack->versionsLoaded) {
|
if (!current_pack || !current_pack->versionsLoaded) {
|
||||||
m_ui->resourceSelectionButton->setText(tr("Loading versions..."));
|
m_ui->resourceSelectionButton->setText(tr("Loading versions..."));
|
||||||
m_ui->resourceSelectionButton->setEnabled(false);
|
m_ui->resourceSelectionButton->setEnabled(false);
|
||||||
|
|
||||||
@ -292,7 +297,7 @@ void ResourcePage::onSelectionChanged(QModelIndex curr, QModelIndex prev)
|
|||||||
updateVersionList();
|
updateVersionList();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!current_pack->extraDataLoaded)
|
if (current_pack && !current_pack->extraDataLoaded)
|
||||||
request_load = true;
|
request_load = true;
|
||||||
|
|
||||||
if (request_load)
|
if (request_load)
|
||||||
@ -340,7 +345,7 @@ void ResourcePage::onResourceSelected()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
auto current_pack = getCurrentPack();
|
auto current_pack = getCurrentPack();
|
||||||
if (!current_pack->versionsLoaded)
|
if (!current_pack || !current_pack->versionsLoaded)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto& version = current_pack->versions[m_selected_version_index];
|
auto& version = current_pack->versions[m_selected_version_index];
|
||||||
@ -386,7 +391,7 @@ void ResourcePage::openUrl(const QUrl& url)
|
|||||||
const QString slug = match.captured(1);
|
const QString slug = match.captured(1);
|
||||||
|
|
||||||
// ensure the user isn't opening the same mod
|
// ensure the user isn't opening the same mod
|
||||||
if (slug != getCurrentPack()->slug) {
|
if (auto current_pack = getCurrentPack(); current_pack && slug != current_pack->slug) {
|
||||||
m_parent_dialog->selectPage(page);
|
m_parent_dialog->selectPage(page);
|
||||||
|
|
||||||
auto newPage = m_parent_dialog->getSelectedPage();
|
auto newPage = m_parent_dialog->getSelectedPage();
|
||||||
|
Loading…
Reference in New Issue
Block a user