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/): Aseprite is being developed by [Igara Studio](https://www.igarastudio.com/):
* [David Capello](https://davidcapello.com/): Lead developer, * [David Capello](https://davidcapello.com/)
bug fixing & new features in desktop & web, and user support. * [Gaspar Capello](https://github.com/Gasparoken)
* [Gaspar Capello](https://github.com/Gasparoken): Developer, * [Martin Capello](https://github.com/martincapello)
bug fixing & new features in desktop, and user support.
* [Martin Capello](https://github.com/martincapello): Developer,
new store website.
## Credits ## Credits

View File

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

View File

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

View File

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

View File

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

View File

@ -276,12 +276,13 @@ bool MainWindow::isHomeSelected() const
return (m_homeView && m_workspace->activeView() == m_homeView); 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) if (!m_browserView)
m_browserView = new BrowserView; m_browserView = new BrowserView;
m_browserView->loadFile(filename); m_browserView->loadFile(filename, section);
if (!m_browserView->parent()) { if (!m_browserView->parent()) {
m_workspace->addView(m_browserView); m_workspace->addView(m_browserView);

View File

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