Skip to content

Commit

Permalink
fix description in modrinth dialog and prevent opening multiple dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
kaniol-lck committed Oct 20, 2021
1 parent 51bc42a commit 40a2aa0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Soon....

### v1.0.0 beta.4

*WIP*
*2021.10.20*

Added Linux/MacOS app packages.
添加了Linux和MacOS的打包。
Expand All @@ -31,8 +31,8 @@ Added option to ignore mod update, you can ignore certain versions not suitable
Added support to color code format of local mod name, author name and description.
添加了对本地mod的名称、作者名字和描述的颜色代码格式的支持。

Attempted to improve performance, may introduce some **crashes**.
试图优化了一些性能,也许会引入一些**崩溃**
Attempted to optimize memory usage, may introduce some **crashes**.
试图优化了一些内存占用,也许会引入一些**崩溃**

Standardized data storage paths.
规范化软件数据存储路径。
Expand Down
5 changes: 4 additions & 1 deletion src/ui/curseforge/curseforgemodbrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ void CurseforgeModBrowser::updateLocalPathList()

void CurseforgeModBrowser::search()
{
if(ui->searchText->text() == currentName_) return;
// if(ui->searchText->text() == currentName_) return;
currentName_ = ui->searchText->text();
getModList(currentName_);
}
Expand Down Expand Up @@ -190,6 +190,8 @@ void CurseforgeModBrowser::getModList(QString name, int index, int needMore)
void CurseforgeModBrowser::on_modListWidget_doubleClicked(const QModelIndex &index)
{
auto item = ui->modListWidget->item(index.row());
if(item->data(Qt::UserRole + 1).toBool()) return;
item->setData(Qt::UserRole + 1, true);
if(!item->text().isEmpty()) return;
auto widget = dynamic_cast<CurseforgeModItemWidget*>(ui->modListWidget->itemWidget(item));
auto mod = widget->mod();
Expand All @@ -200,6 +202,7 @@ void CurseforgeModBrowser::on_modListWidget_doubleClicked(const QModelIndex &ind
connect(this, &CurseforgeModBrowser::downloadPathChanged, dialog, &CurseforgeModDialog::setDownloadPath);
connect(dialog, &CurseforgeModDialog::accepted, widget, [=]{
mod->setParent(widget);
item->setData(Qt::UserRole + 1, false);
});
dialog->show();
}
Expand Down
4 changes: 2 additions & 2 deletions src/ui/modrinth/modrinthmodbrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void ModrinthModBrowser::updateVersionList()
isUiSet_ = false;
ui->versionSelect->clear();
ui->versionSelect->addItem(tr("Any"));
for(const auto &version : GameVersion::modrinthVersionList())
for(auto &&version : GameVersion::modrinthVersionList())
ui->versionSelect->addItem(version);
isUiSet_ = true;
}
Expand Down Expand Up @@ -102,7 +102,7 @@ void ModrinthModBrowser::updateLocalPathList()

void ModrinthModBrowser::search()
{
if(ui->searchText->text() == currentName_) return;
// if(ui->searchText->text() == currentName_) return;
currentName_ = ui->searchText->text();
getModList(currentName_);
}
Expand Down
5 changes: 2 additions & 3 deletions src/ui/modrinth/modrinthmoddialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,9 @@ ModrinthModDialog::ModrinthModDialog(QWidget *parent, ModrinthMod *mod, LocalMod
auto updateFullInfo = [=]{
if(!bl) updateBasicInfo();
auto text = mod->modInfo().description();
QTextDocument doc;
doc.setMarkdown(text);
text.replace(QRegExp("<br ?/?>"), "\n");
ui->websiteButton->setVisible(!mod_->modInfo().websiteUrl().isEmpty());
ui->modDescription->setHtml(doc.toHtml());
ui->modDescription->setMarkdown(text);
ui->modDescription->setCursor(Qt::ArrowCursor);

//update file list
Expand Down

0 comments on commit 40a2aa0

Please sign in to comment.