Simplify About dialog

This commit is contained in:
David Capello 2021-04-13 19:08:33 -03:00
parent a926ca9055
commit a035f64d8d
7 changed files with 59 additions and 36 deletions

View File

@ -51,12 +51,9 @@ You can ask for help in:
Aseprite is being developed by [Igara Studio](https://www.igarastudio.com/):
* [David Capello](https://davidcapello.com/): Lead developer,
bug fixing & new features in desktop & web, and user support.
* [Gaspar Capello](https://github.com/Gasparoken): Developer,
bug fixing & new features in desktop, and user support.
* [Martin Capello](https://github.com/martincapello): Developer,
new store website.
* [David Capello](https://davidcapello.com/)
* [Gaspar Capello](https://github.com/Gasparoken)
* [Martin Capello](https://github.com/martincapello)
## Credits

View File

@ -6,25 +6,23 @@
<vbox>
<label text="" id="title" />
<label text="Animated sprite editor &amp;&amp; pixel art tool" />
<separator text="Developers:" horizontal="true" />
<grid columns="2">
<link text="David Capello" url="https://twitter.com/davidcapello" />
<label text="- Lead developer, new features &amp;&amp; bug fixing in desktop &amp;&amp; web" />
<link text="Gaspar Capello" url="https://twitter.com/Gasparoken" />
<label text="- Developer, new features &amp;&amp; bug fixing in desktop" />
<link text="Martin Capello" url="https://twitter.com/martincapell0" />
<label text="- Developer, new store website" />
<separator text="Contributors:" horizontal="true" cell_hspan="2" />
<link text="Ilija Melentijevic" url="https://ilkke.net/" />
<label text="- Default skin &amp;&amp; graphics introduced in v0.8" />
<hbox cell_hspan="2">
<link text="Other Contributors" url="https://www.aseprite.org/contributors/" />
<label text="&amp;&amp;" />
<link text="Third-Party Projects" url="" id="licenses" />
<hbox homogeneous="true">
<hbox>
<vbox expansive="true">
<separator text="Developer Team" horizontal="true" />
<link text="David Capello" url="https://twitter.com/davidcapello" />
<link text="Gaspar Capello" url="https://twitter.com/Gasparoken" />
<link text="Martin Capello" url="https://twitter.com/martincapell0" />
<vbox minheight="8" />
</vbox>
<separator vertical="true" />
</hbox>
</grid>
<vbox>
<separator text="Credits" horizontal="true" cell_hspan="2" />
<link text="Contributors" url="" id="credits" />
<link text="Open Source Projects" url="" id="licenses" />
</vbox>
</hbox>
<separator horizontal="true" />
<hbox>
<label text="Copyright (C) 2001-2021" />

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2020 Igara Studio S.A.
// Copyright (C) 2020-2021 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -44,6 +44,11 @@ void AboutCommand::onExecute(Context* context)
window.closeWindow(nullptr);
App::instance()->mainWindow()->showBrowser("docs/LICENSES.md");
});
window.credits()->Click.connect(
[&window]{
window.closeWindow(nullptr);
App::instance()->mainWindow()->showBrowser("README.md", "Authors");
});
window.openWindowInForeground();
}

View File

@ -90,7 +90,8 @@ public:
return m_file;
}
void loadFile(const std::string& inputFile) {
void loadFile(const std::string& inputFile,
const std::string& section = std::string()) {
std::string file = inputFile;
{
ResourceFinder rf;
@ -121,9 +122,8 @@ public:
cmark_parser_feed(parser, "\n```\n", 5);
cmark_node* root = cmark_parser_finish(parser);
if (root) {
processNode(root);
processNode(root, section);
cmark_node_free(root);
}
fclose(fp);
@ -140,6 +140,16 @@ public:
FileChange();
}
void focusSection() {
View* view = View::getView(this);
if (m_sectionWidget) {
int y = m_sectionWidget->bounds().y - bounds().y;
view->setViewScroll(gfx::Point(0, y));
m_sectionWidget = nullptr;
}
}
private:
void layoutElements(int width,
std::function<void(const gfx::Rect& bounds,
@ -265,7 +275,8 @@ private:
delete firstChild();
}
void processNode(cmark_node* root) {
void processNode(cmark_node* root,
const std::string& section) {
clear();
m_content.clear();
@ -293,8 +304,11 @@ private:
}
else {
m_content += text;
if (inHeading)
if (inHeading) {
closeContent();
if (section == text)
m_sectionWidget = lastChild();
}
}
}
break;
@ -520,6 +534,7 @@ private:
std::string m_file;
std::string m_content;
Widget* m_sectionWidget = nullptr;
};
BrowserView::BrowserView()
@ -546,9 +561,10 @@ BrowserView::~BrowserView()
delete m_textBox;
}
void BrowserView::loadFile(const std::string& file)
void BrowserView::loadFile(const std::string& file,
const std::string& section)
{
m_textBox->loadFile(file);
m_textBox->loadFile(file, section);
}
std::string BrowserView::getTabText()
@ -570,6 +586,9 @@ void BrowserView::onWorkspaceViewSelected()
{
if (auto statusBar = StatusBar::instance())
statusBar->clearText();
if (m_textBox)
m_textBox->focusSection();
}
bool BrowserView::onCloseView(Workspace* workspace, bool quitting)

View File

@ -1,4 +1,5 @@
// Aseprite
// Copyright (C) 2021 Igara Studio S.A.
// Copyright (C) 2016 David Capello
//
// This program is distributed under the terms of
@ -20,7 +21,8 @@ namespace app {
BrowserView();
~BrowserView();
void loadFile(const std::string& file);
void loadFile(const std::string& file,
const std::string& section = std::string());
// TabView implementation
std::string getTabText() override;

View File

@ -276,12 +276,13 @@ bool MainWindow::isHomeSelected() const
return (m_homeView && m_workspace->activeView() == m_homeView);
}
void MainWindow::showBrowser(const std::string& filename)
void MainWindow::showBrowser(const std::string& filename,
const std::string& section)
{
if (!m_browserView)
m_browserView = new BrowserView;
m_browserView->loadFile(filename);
m_browserView->loadFile(filename, section);
if (!m_browserView->parent()) {
m_workspace->addView(m_browserView);

View File

@ -73,7 +73,8 @@ namespace app {
void showHome();
void showDefaultStatusBar();
void showDevConsole();
void showBrowser(const std::string& filename);
void showBrowser(const std::string& filename,
const std::string& section = std::string());
bool isHomeSelected() const;
Mode getMode() const { return m_mode; }