GH-3720 Fix UI inconsistencies with Modplatforms
Fixes GH-3118 Fixes GH-3720 Fixes GH-3731 Icons and Ok button state will now switch consistently when moving between tabs. ATLaunchers packlist is now no longer redownloaded each time you open its Tab. All lists are striped now. And all search and filter fields now have a placeholder text.
This commit is contained in:
parent
5f8d07c009
commit
f7c144c393
@ -173,6 +173,14 @@ void NewInstanceDialog::setSuggestedIconFromFile(const QString &path, const QStr
|
||||
ui->iconButton->setIcon(QIcon(path));
|
||||
}
|
||||
|
||||
void NewInstanceDialog::setSuggestedIcon(const QString &key)
|
||||
{
|
||||
auto icon = MMC->icons()->getIcon(key);
|
||||
importIcon = false;
|
||||
|
||||
ui->iconButton->setIcon(icon);
|
||||
}
|
||||
|
||||
InstanceTask * NewInstanceDialog::extractTask()
|
||||
{
|
||||
InstanceTask * extracted = creationTask.get();
|
||||
|
@ -43,6 +43,7 @@ public:
|
||||
|
||||
void setSuggestedPack(const QString & name = QString(), InstanceTask * task = nullptr);
|
||||
void setSuggestedIconFromFile(const QString &path, const QString &name);
|
||||
void setSuggestedIcon(const QString &key);
|
||||
|
||||
InstanceTask * extractTask();
|
||||
|
||||
|
@ -71,6 +71,7 @@ void ImportPage::updateState()
|
||||
{
|
||||
QFileInfo fi(url.fileName());
|
||||
dialog->setSuggestedPack(fi.completeBaseName(), new InstanceImportTask(url));
|
||||
dialog->setSuggestedIcon("default");
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -83,6 +84,7 @@ void ImportPage::updateState()
|
||||
// hook, line and sinker.
|
||||
QFileInfo fi(url.fileName());
|
||||
dialog->setSuggestedPack(fi.completeBaseName(), new InstanceImportTask(url));
|
||||
dialog->setSuggestedIcon("default");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -82,10 +82,19 @@ BaseVersionPtr VanillaPage::selectedVersion() const
|
||||
|
||||
void VanillaPage::suggestCurrent()
|
||||
{
|
||||
if(m_selectedVersion && isOpened)
|
||||
if (!isOpened)
|
||||
{
|
||||
dialog->setSuggestedPack(m_selectedVersion->descriptor(), new InstanceCreationTask(m_selectedVersion));
|
||||
return;
|
||||
}
|
||||
|
||||
if(!m_selectedVersion)
|
||||
{
|
||||
dialog->setSuggestedPack();
|
||||
return;
|
||||
}
|
||||
|
||||
dialog->setSuggestedPack(m_selectedVersion->descriptor(), new InstanceCreationTask(m_selectedVersion));
|
||||
dialog->setSuggestedIcon("default");
|
||||
}
|
||||
|
||||
void VanillaPage::setSelectedVersion(BaseVersionPtr version)
|
||||
|
@ -44,16 +44,30 @@ bool AtlPage::shouldDisplay() const
|
||||
}
|
||||
|
||||
void AtlPage::openedImpl()
|
||||
{
|
||||
if(!initialized)
|
||||
{
|
||||
listModel->request();
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
suggestCurrent();
|
||||
}
|
||||
|
||||
void AtlPage::suggestCurrent()
|
||||
{
|
||||
if(isOpened) {
|
||||
dialog->setSuggestedPack(selected.name, new ATLauncher::PackInstallTask(this, selected.safeName, selectedVersion));
|
||||
if(!isOpened)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (selectedVersion.isEmpty())
|
||||
{
|
||||
dialog->setSuggestedPack();
|
||||
return;
|
||||
}
|
||||
|
||||
dialog->setSuggestedPack(selected.name, new ATLauncher::PackInstallTask(this, selected.safeName, selectedVersion));
|
||||
auto editedLogoName = selected.safeName;
|
||||
auto url = QString(BuildConfig.ATL_DOWNLOAD_SERVER_URL + "launcher/images/%1.png").arg(selected.safeName.toLower());
|
||||
listModel->getLogo(selected.safeName, url, [this, editedLogoName](QString logo)
|
||||
|
@ -81,4 +81,6 @@ private:
|
||||
|
||||
ATLauncher::IndexedPack selected;
|
||||
QString selectedVersion;
|
||||
|
||||
bool initialized = false;
|
||||
};
|
||||
|
@ -21,6 +21,9 @@
|
||||
<height>48</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
@ -48,7 +51,14 @@
|
||||
<item row="2" column="0" colspan="2">
|
||||
<layout class="QGridLayout" name="gridLayout_4" columnstretch="0,0,0" rowminimumheight="0" columnminimumwidth="0,0,0">
|
||||
<item row="0" column="2">
|
||||
<widget class="QComboBox" name="versionSelectionBox"/>
|
||||
<widget class="QComboBox" name="versionSelectionBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label">
|
||||
|
@ -18,6 +18,8 @@ FlamePage::FlamePage(NewInstanceDialog* dialog, QWidget *parent)
|
||||
ui->packView->setModel(listModel);
|
||||
|
||||
ui->versionSelectionBox->setMaxVisibleItems(10);
|
||||
// fix height for themes that dont respect max visible like fusion
|
||||
ui->versionSelectionBox->setStyleSheet("combobox-popup: 0;");
|
||||
|
||||
// index is used to set the sorting with the curseforge api
|
||||
ui->sortByBox->addItem(tr("Sort by featured"));
|
||||
@ -157,6 +159,12 @@ void FlamePage::suggestCurrent()
|
||||
return;
|
||||
}
|
||||
|
||||
if (selectedVersion.isEmpty())
|
||||
{
|
||||
dialog->setSuggestedPack();
|
||||
return;
|
||||
}
|
||||
|
||||
dialog->setSuggestedPack(current.name, new InstanceImportTask(selectedVersion));
|
||||
QString editedLogoName;
|
||||
editedLogoName = "curseforge_" + current.logoName.section(".", 0, 0);
|
||||
|
@ -60,16 +60,24 @@ bool FtbPage::shouldDisplay() const
|
||||
|
||||
void FtbPage::openedImpl()
|
||||
{
|
||||
dialog->setSuggestedPack();
|
||||
triggerSearch();
|
||||
suggestCurrent();
|
||||
}
|
||||
|
||||
void FtbPage::suggestCurrent()
|
||||
{
|
||||
if(isOpened)
|
||||
if(!isOpened)
|
||||
{
|
||||
dialog->setSuggestedPack(selected.name, new ModpacksCH::PackInstallTask(selected, selectedVersion));
|
||||
return;
|
||||
}
|
||||
|
||||
if (selectedVersion.isEmpty())
|
||||
{
|
||||
dialog->setSuggestedPack();
|
||||
return;
|
||||
}
|
||||
|
||||
dialog->setSuggestedPack(selected.name, new ModpacksCH::PackInstallTask(selected, selectedVersion));
|
||||
for(auto art : selected.art) {
|
||||
if(art.type == "square") {
|
||||
QString editedLogoName;
|
||||
@ -82,7 +90,6 @@ void FtbPage::suggestCurrent()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FtbPage::triggerSearch()
|
||||
{
|
||||
|
@ -32,7 +32,11 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLineEdit" name="searchEdit"/>
|
||||
<widget class="QLineEdit" name="searchEdit">
|
||||
<property name="placeholderText">
|
||||
<string>Search and filter ...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="searchButton">
|
||||
@ -51,6 +55,9 @@
|
||||
<height>48</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
|
@ -122,10 +122,17 @@ void Page::openedImpl()
|
||||
|
||||
void Page::suggestCurrent()
|
||||
{
|
||||
if(isOpened)
|
||||
if(!isOpened)
|
||||
{
|
||||
if(!selected.broken)
|
||||
return;
|
||||
}
|
||||
|
||||
if(!selected.broken || !selectedVersion.isEmpty())
|
||||
{
|
||||
dialog->setSuggestedPack();
|
||||
return;
|
||||
}
|
||||
|
||||
dialog->setSuggestedPack(selected.name, new PackInstallTask(selected, selectedVersion));
|
||||
QString editedLogoName;
|
||||
if(selected.logo.toLower().startsWith("ftb"))
|
||||
@ -161,12 +168,6 @@ void Page::suggestCurrent()
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dialog->setSuggestedPack();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Page::ftbPackDataDownloadSuccessfully(ModpackList publicPacks, ModpackList thirdPartyPacks)
|
||||
{
|
||||
|
@ -29,6 +29,9 @@
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
@ -52,6 +55,9 @@
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@ -69,6 +75,9 @@
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
|
@ -72,7 +72,7 @@ int Technic::ListModel::rowCount(const QModelIndex&) const
|
||||
|
||||
void Technic::ListModel::searchWithTerm(const QString& term)
|
||||
{
|
||||
if(currentSearchTerm == term) {
|
||||
if(currentSearchTerm == term && currentSearchTerm.isNull() == term.isNull()) {
|
||||
return;
|
||||
}
|
||||
currentSearchTerm = term;
|
||||
@ -93,9 +93,18 @@ void Technic::ListModel::searchWithTerm(const QString& term)
|
||||
void Technic::ListModel::performSearch()
|
||||
{
|
||||
NetJob *netJob = new NetJob("Technic::Search");
|
||||
auto searchUrl = QString(
|
||||
QString searchUrl = "";
|
||||
if (currentSearchTerm.isEmpty()) {
|
||||
searchUrl = QString(
|
||||
"https://api.technicpack.net/trending?build=multimc"
|
||||
).arg(currentSearchTerm);
|
||||
}
|
||||
else
|
||||
{
|
||||
searchUrl = QString(
|
||||
"https://api.technicpack.net/search?build=multimc&q=%1"
|
||||
).arg(currentSearchTerm);
|
||||
}
|
||||
netJob->addNetAction(Net::Download::makeByteArray(QUrl(searchUrl), &response));
|
||||
jobPtr = netJob;
|
||||
jobPtr->start();
|
||||
|
@ -60,7 +60,8 @@ bool TechnicPage::shouldDisplay() const
|
||||
|
||||
void TechnicPage::openedImpl()
|
||||
{
|
||||
dialog->setSuggestedPack();
|
||||
suggestCurrent();
|
||||
triggerSearch();
|
||||
}
|
||||
|
||||
void TechnicPage::triggerSearch() {
|
||||
@ -95,8 +96,7 @@ void TechnicPage::suggestCurrent()
|
||||
return;
|
||||
}
|
||||
|
||||
QString editedLogoName;
|
||||
editedLogoName = "technic_" + current.logoName.section(".", 0, 0);
|
||||
QString editedLogoName = "technic_" + current.logoName.section(".", 0, 0);
|
||||
model->getLogo(current.logoName, current.logoUrl, [this, editedLogoName](QString logo)
|
||||
{
|
||||
dialog->setSuggestedIconFromFile(logo, editedLogoName);
|
||||
@ -105,9 +105,9 @@ void TechnicPage::suggestCurrent()
|
||||
if (current.metadataLoaded)
|
||||
{
|
||||
metadataLoaded();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
NetJob *netJob = new NetJob(QString("Technic::PackMeta(%1)").arg(current.name));
|
||||
std::shared_ptr<QByteArray> response = std::make_shared<QByteArray>();
|
||||
QString slug = current.slug;
|
||||
@ -166,7 +166,6 @@ void TechnicPage::suggestCurrent()
|
||||
});
|
||||
netJob->start();
|
||||
}
|
||||
}
|
||||
|
||||
// expects current.metadataLoaded to be true
|
||||
void TechnicPage::metadataLoaded()
|
||||
|
@ -27,7 +27,11 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="searchEdit"/>
|
||||
<widget class="QLineEdit" name="searchEdit">
|
||||
<property name="placeholderText">
|
||||
<string>Search and filter ...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="searchButton">
|
||||
|
Loading…
Reference in New Issue
Block a user