Merge branch 'PrismLauncher:develop' into toolbar-icons
This commit is contained in:
@ -366,33 +366,28 @@ void ModUpdateDialog::appendMod(CheckUpdateTask::UpdatableMod const& info)
|
||||
auto changelog = new QTreeWidgetItem(changelog_item);
|
||||
auto changelog_area = new QTextBrowser();
|
||||
|
||||
QString text = info.changelog;
|
||||
switch (info.provider) {
|
||||
case ModPlatform::Provider::MODRINTH: {
|
||||
HoeDown h;
|
||||
// HoeDown bug?: \n aren't converted to <br>
|
||||
auto text = h.process(info.changelog.toUtf8());
|
||||
text = h.process(info.changelog.toUtf8());
|
||||
|
||||
// Don't convert if there's an HTML tag right after (Qt rendering weirdness)
|
||||
text.remove(QRegularExpression("(\n+)(?=<)"));
|
||||
text.replace('\n', "<br>");
|
||||
|
||||
changelog_area->setHtml(text);
|
||||
break;
|
||||
}
|
||||
case ModPlatform::Provider::FLAME: {
|
||||
changelog_area->setHtml(info.changelog);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
changelog_area->setHtml(text);
|
||||
changelog_area->setOpenExternalLinks(true);
|
||||
changelog_area->setLineWrapMode(QTextBrowser::LineWrapMode::NoWrap);
|
||||
changelog_area->setLineWrapMode(QTextBrowser::LineWrapMode::WidgetWidth);
|
||||
changelog_area->setVerticalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAsNeeded);
|
||||
|
||||
// HACK: Is there a better way of achieving this?
|
||||
auto font_height = QFontMetrics(changelog_area->font()).height();
|
||||
changelog_area->setMaximumHeight((changelog_area->toPlainText().count(QRegularExpression("\n|<br>")) + 2) * font_height);
|
||||
|
||||
ui->modTreeWidget->setItemWidget(changelog, 0, changelog_area);
|
||||
|
||||
ui->modTreeWidget->addTopLevelItem(item_top);
|
||||
|
@ -310,9 +310,12 @@ void LauncherPage::applySettings()
|
||||
s->set("IconTheme", "flat");
|
||||
break;
|
||||
case 7:
|
||||
s->set("IconTheme", "multimc");
|
||||
s->set("IconTheme", "flat_white");
|
||||
break;
|
||||
case 8:
|
||||
s->set("IconTheme", "multimc");
|
||||
break;
|
||||
case 9:
|
||||
s->set("IconTheme", "custom");
|
||||
break;
|
||||
}
|
||||
@ -408,14 +411,18 @@ void LauncherPage::loadSettings()
|
||||
{
|
||||
ui->themeComboBox->setCurrentIndex(6);
|
||||
}
|
||||
else if (theme == "multimc")
|
||||
else if (theme == "flat_white")
|
||||
{
|
||||
ui->themeComboBox->setCurrentIndex(7);
|
||||
}
|
||||
else if (theme == "custom")
|
||||
else if (theme == "multimc")
|
||||
{
|
||||
ui->themeComboBox->setCurrentIndex(8);
|
||||
}
|
||||
else if (theme == "custom")
|
||||
{
|
||||
ui->themeComboBox->setCurrentIndex(9);
|
||||
}
|
||||
|
||||
{
|
||||
auto currentTheme = s->get("ApplicationTheme").toString();
|
||||
|
@ -300,6 +300,11 @@
|
||||
<string>Flat</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Flat (White)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Legacy</string>
|
||||
|
@ -267,18 +267,25 @@ void ListModel::searchRequestFailed(QString reason)
|
||||
.arg(m_parent->displayName())
|
||||
.arg(tr("API version too old!\nPlease update %1!").arg(BuildConfig.LAUNCHER_DISPLAYNAME)));
|
||||
}
|
||||
|
||||
jobPtr.reset();
|
||||
searchState = Finished;
|
||||
}
|
||||
|
||||
void ListModel::searchRequestAborted()
|
||||
{
|
||||
if (searchState != ResetRequested)
|
||||
qCritical() << "Search task in ModModel aborted by an unknown reason!";
|
||||
|
||||
// Retry fetching
|
||||
jobPtr.reset();
|
||||
|
||||
if (searchState == ResetRequested) {
|
||||
beginResetModel();
|
||||
modpacks.clear();
|
||||
endResetModel();
|
||||
beginResetModel();
|
||||
modpacks.clear();
|
||||
endResetModel();
|
||||
|
||||
nextSearchOffset = 0;
|
||||
performPaginatedSearch();
|
||||
} else {
|
||||
searchState = Finished;
|
||||
}
|
||||
nextSearchOffset = 0;
|
||||
performPaginatedSearch();
|
||||
}
|
||||
|
||||
void ListModel::infoRequestFinished(QJsonDocument& doc, ModPlatform::IndexedPack& pack, const QModelIndex& index)
|
||||
|
@ -51,6 +51,7 @@ class ListModel : public QAbstractListModel {
|
||||
public slots:
|
||||
void searchRequestFinished(QJsonDocument& doc);
|
||||
void searchRequestFailed(QString reason);
|
||||
void searchRequestAborted();
|
||||
|
||||
void infoRequestFinished(QJsonDocument& doc, ModPlatform::IndexedPack& pack, const QModelIndex& index);
|
||||
|
||||
|
@ -31,7 +31,7 @@ QPalette DarkTheme::colorScheme()
|
||||
darkPalette.setColor(QPalette::ButtonText, Qt::white);
|
||||
darkPalette.setColor(QPalette::BrightText, Qt::red);
|
||||
darkPalette.setColor(QPalette::Link, QColor(47,163,198));
|
||||
darkPalette.setColor(QPalette::Highlight, QColor(145,205,92));
|
||||
darkPalette.setColor(QPalette::Highlight, QColor(150,219,89));
|
||||
darkPalette.setColor(QPalette::HighlightedText, Qt::black);
|
||||
darkPalette.setColor(QPalette::PlaceholderText, Qt::darkGray);
|
||||
return fadeInactive(darkPalette, fadeAmount(), fadeColor());
|
||||
|
Reference in New Issue
Block a user