mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-16 15:32:15 -07:00
Readd dropped method.
This commit is contained in:
parent
9581044e3b
commit
d8e0648caf
1 changed files with 36 additions and 0 deletions
|
|
@ -235,6 +235,42 @@ void DeckEditorDatabaseDisplayWidget::saveDbHeaderState()
|
||||||
SettingsCache::instance().layouts().setDeckEditorDbHeaderState(databaseView->header()->saveState());
|
SettingsCache::instance().layouts().setDeckEditorDbHeaderState(databaseView->header()->saveState());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DeckEditorDatabaseDisplayWidget::showSearchSyntaxHelp()
|
||||||
|
{
|
||||||
|
|
||||||
|
QFile file("theme:help/search.md");
|
||||||
|
|
||||||
|
if (!file.open(QFile::ReadOnly | QFile::Text)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QTextStream in(&file);
|
||||||
|
QString text = in.readAll();
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
// Poor Markdown Converter
|
||||||
|
auto opts = QRegularExpression::MultilineOption;
|
||||||
|
text = text.replace(QRegularExpression("^(###)(.*)", opts), "<h3>\\2</h3>")
|
||||||
|
.replace(QRegularExpression("^(##)(.*)", opts), "<h2>\\2</h2>")
|
||||||
|
.replace(QRegularExpression("^(#)(.*)", opts), "<h1>\\2</h1>")
|
||||||
|
.replace(QRegularExpression("^------*", opts), "<hr />")
|
||||||
|
.replace(QRegularExpression(R"(\[([^[]+)\]\(([^\)]+)\))", opts), R"(<a href='\2'>\1</a>)");
|
||||||
|
|
||||||
|
auto browser = new QTextBrowser;
|
||||||
|
browser->setParent(this, Qt::Window | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint |
|
||||||
|
Qt::WindowCloseButtonHint | Qt::WindowFullscreenButtonHint);
|
||||||
|
browser->setWindowTitle("Search Help");
|
||||||
|
browser->setReadOnly(true);
|
||||||
|
browser->setMinimumSize({500, 600});
|
||||||
|
|
||||||
|
QString sheet = QString("a { text-decoration: underline; color: rgb(71,158,252) };");
|
||||||
|
browser->document()->setDefaultStyleSheet(sheet);
|
||||||
|
|
||||||
|
browser->setHtml(text);
|
||||||
|
connect(browser, &QTextBrowser::anchorClicked, [this](const QUrl &link) { searchEdit->setText(link.fragment()); });
|
||||||
|
browser->show();
|
||||||
|
}
|
||||||
|
|
||||||
void DeckEditorDatabaseDisplayWidget::setFilterTree(FilterTree *filterTree)
|
void DeckEditorDatabaseDisplayWidget::setFilterTree(FilterTree *filterTree)
|
||||||
{
|
{
|
||||||
databaseDisplayModel->setFilterTree(filterTree);
|
databaseDisplayModel->setFilterTree(filterTree);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue