improve text node xml

This commit is contained in:
2019-11-29 02:17:54 +01:00
parent c6173987af
commit 26257e5a37
5 changed files with 59 additions and 28 deletions

View File

@@ -1,6 +1,7 @@
#include "pch.h"
#include "app.h"
#include "action.h"
#include "settings.h"
#include "node_dialog_open.h"
#include "node_dialog_browse.h"
#include "node_dialog_resize.h"
@@ -9,6 +10,7 @@
#include "node_changelog.h"
#include "node_usermanual.h"
#include "node_dialog_export_ppbr.h"
#include "node_remote_page.h"
#include <codec_api.h>
#define MP4V2_NO_STDINT_DEFS
@@ -838,3 +840,32 @@ void App::dialog_export_mp4()
pb->destroy();
}).detach();
}
void App::dialog_whatsnew()
{
auto whatsnew = std::make_shared<NodeRemotePage>();
whatsnew->m_manager = &layout;
whatsnew->init();
whatsnew->load_url("https://panopainter.com/app-content/whatsnew.xml", [this, whatsnew](bool success) {
if (success)
{
int last_id = Settings::value_or<Serializer::Integer>("whatsnew-id", 0);
if (whatsnew->m_page_id <= g_version_build && whatsnew->m_page_id > last_id)
{
whatsnew->set_title(fmt::format("What's new in version {}", g_version_number));
layout[main_id]->add_child(whatsnew);
}
whatsnew->add_button("Reload", 120, [this, whatsnew](Node*) {
whatsnew->reload();
});
whatsnew->add_button("Read Later", 120, [this, whatsnew](Node*) {
whatsnew->destroy();
});
whatsnew->add_button("Close", 100, [this, whatsnew](Node*) {
Settings::set<Serializer::Integer>("whatsnew-id", whatsnew->m_page_id);
Settings::save();
whatsnew->destroy();
});
}
});
}