NOISSUE Added 3rd party pack support
This commit is contained in:
parent
bbd523acb8
commit
df6e66101c
@ -172,22 +172,20 @@ void FtbListModel::requestLogo(QString file)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MetaEntryPtr entry = ENV.metacache()->resolveEntry("FTBPacks", QString("logos/%1").arg(file));
|
MetaEntryPtr entry = ENV.metacache()->resolveEntry("FTBPacks", QString("logos/%1").arg(file.section(".", 0, 0)));
|
||||||
NetJob *job = new NetJob(QString("FTB Icon Download for %1").arg(file));
|
NetJob *job = new NetJob(QString("FTB Icon Download for %1").arg(file));
|
||||||
job->addNetAction(Net::Download::makeCached(QUrl(QString("https://ftb.cursecdn.com/FTB2/static/%1").arg(file)), entry));
|
job->addNetAction(Net::Download::makeCached(QUrl(QString("https://ftb.cursecdn.com/FTB2/static/%1").arg(file)), entry));
|
||||||
|
|
||||||
QString *_file = new QString(file);
|
auto fullPath = entry->getFullPath();
|
||||||
MetaEntry *_entry = entry.get();
|
QObject::connect(job, &NetJob::finished, this, [this, file, fullPath]{
|
||||||
|
|
||||||
QObject::connect(job, &NetJob::finished, this, [this, _file, _entry]{
|
|
||||||
QPixmap pixmap;
|
QPixmap pixmap;
|
||||||
pixmap.load(_entry->getFullPath());
|
pixmap.load(fullPath);
|
||||||
pixmap = pixmap.scaled(QSize(42, 42));
|
pixmap = pixmap.scaled(QSize(42, 42));
|
||||||
emit logoLoaded(*_file, pixmap);
|
emit logoLoaded(file, pixmap);
|
||||||
});
|
});
|
||||||
|
|
||||||
QObject::connect(job, &NetJob::failed, this, [this, _file]{
|
QObject::connect(job, &NetJob::failed, this, [this, file]{
|
||||||
emit logoFailed(*_file);
|
emit logoFailed(file);
|
||||||
});
|
});
|
||||||
|
|
||||||
job->start();
|
job->start();
|
||||||
|
@ -53,7 +53,12 @@ FTBPage::FTBPage(NewInstanceDialog* dialog, QWidget *parent)
|
|||||||
connect(ui->publicPackList->selectionModel(), &QItemSelectionModel::currentChanged, this, &FTBPage::onPublicPackSelectionChanged);
|
connect(ui->publicPackList->selectionModel(), &QItemSelectionModel::currentChanged, this, &FTBPage::onPublicPackSelectionChanged);
|
||||||
connect(ui->thirdPartyPackList->selectionModel(), &QItemSelectionModel::currentChanged, this, &FTBPage::onThirdPartyPackSelectionChanged);
|
connect(ui->thirdPartyPackList->selectionModel(), &QItemSelectionModel::currentChanged, this, &FTBPage::onThirdPartyPackSelectionChanged);
|
||||||
|
|
||||||
|
connect(ui->ftbTabWidget, &QTabWidget::currentChanged, this, &FTBPage::onTabChanged);
|
||||||
|
|
||||||
ui->modpackInfo->setOpenExternalLinks(true);
|
ui->modpackInfo->setOpenExternalLinks(true);
|
||||||
|
|
||||||
|
ui->publicPackList->selectionModel()->reset();
|
||||||
|
ui->thirdPartyPackList->selectionModel()->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
FTBPage::~FTBPage()
|
FTBPage::~FTBPage()
|
||||||
@ -172,3 +177,9 @@ void FTBPage::onSortingSelectionChanged(QString data)
|
|||||||
publicFilterModel->setSorting(toSet);
|
publicFilterModel->setSorting(toSet);
|
||||||
thirdPartyFilterModel->setSorting(toSet);
|
thirdPartyFilterModel->setSorting(toSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FTBPage::onTabChanged(int tab)
|
||||||
|
{
|
||||||
|
ui->publicPackList->selectionModel()->reset();
|
||||||
|
ui->thirdPartyPackList->selectionModel()->reset();
|
||||||
|
}
|
||||||
|
@ -75,6 +75,8 @@ private slots:
|
|||||||
void onPublicPackSelectionChanged(QModelIndex first, QModelIndex second);
|
void onPublicPackSelectionChanged(QModelIndex first, QModelIndex second);
|
||||||
void onThirdPartyPackSelectionChanged(QModelIndex first, QModelIndex second);
|
void onThirdPartyPackSelectionChanged(QModelIndex first, QModelIndex second);
|
||||||
|
|
||||||
|
void onTabChanged(int tab);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool initialized = false;
|
bool initialized = false;
|
||||||
FtbModpack selectedPack;
|
FtbModpack selectedPack;
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<height>602</height>
|
<height>602</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
@ -23,7 +23,7 @@
|
|||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
@ -57,7 +57,7 @@
|
|||||||
<widget class="QComboBox" name="sortByBox"/>
|
<widget class="QComboBox" name="sortByBox"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0" rowspan="2">
|
<item row="0" column="0" rowspan="2">
|
||||||
<widget class="QTabWidget" name="tabWidget_2">
|
<widget class="QTabWidget" name="ftbTabWidget">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
@ -74,37 +74,35 @@
|
|||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>Public Packs</string>
|
<string>Public Packs</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<widget class="QTreeView" name="publicPackList">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<property name="geometry">
|
<item>
|
||||||
<rect>
|
<widget class="QTreeView" name="publicPackList">
|
||||||
<x>0</x>
|
<property name="verticalScrollBarPolicy">
|
||||||
<y>0</y>
|
<enum>Qt::ScrollBarAsNeeded</enum>
|
||||||
<width>221</width>
|
</property>
|
||||||
<height>491</height>
|
<property name="horizontalScrollBarPolicy">
|
||||||
</rect>
|
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="verticalScrollBarPolicy">
|
</widget>
|
||||||
<enum>Qt::ScrollBarAlwaysOn</enum>
|
</item>
|
||||||
</property>
|
</layout>
|
||||||
</widget>
|
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="tab_3">
|
<widget class="QWidget" name="tab_3">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>3rd Party Packs</string>
|
<string>3rd Party Packs</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<widget class="QTreeView" name="thirdPartyPackList">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<property name="geometry">
|
<item>
|
||||||
<rect>
|
<widget class="QTreeView" name="thirdPartyPackList">
|
||||||
<x>0</x>
|
<property name="verticalScrollBarPolicy">
|
||||||
<y>0</y>
|
<enum>Qt::ScrollBarAsNeeded</enum>
|
||||||
<width>221</width>
|
</property>
|
||||||
<height>491</height>
|
<property name="horizontalScrollBarPolicy">
|
||||||
</rect>
|
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="verticalScrollBarPolicy">
|
</widget>
|
||||||
<enum>Qt::ScrollBarAlwaysOn</enum>
|
</item>
|
||||||
</property>
|
</layout>
|
||||||
</widget>
|
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user