demo license checker

This commit is contained in:
2018-07-18 01:30:39 +02:00
parent fa4063eeb5
commit 9b1ced76c2
4 changed files with 28 additions and 0 deletions

View File

@@ -127,6 +127,22 @@ void App::download(std::string filename, std::function<void(float)> progress)
}
}
bool App::check_license()
{
CURL *curl = curl_easy_init();
if (curl)
{
std::string url = "http://omigamedev.com/panopainter/79516B99-8E67-40AD-B12F-149A5A9C2E15";
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L);
auto err = curl_easy_perform(curl);
curl_easy_cleanup(curl);
if (err == CURLcode::CURLE_OK)
return true;
}
return false;
}
void App::upload(std::string filename, std::string name, std::function<void(float)> progress)
{
CURL *curl;

View File

@@ -148,6 +148,7 @@ public:
void cloud_browse();
void upload(std::string filename, std::string name = "", std::function<void(float)> progress = nullptr);
void download(std::string filename, std::function<void(float)> progress = nullptr);
bool check_license();
std::shared_ptr<NodeProgressBar> show_progress(const std::string& title);

View File

@@ -911,6 +911,8 @@ void ui::Canvas::import_equirectangular_thread(std::string file_path)
void ui::Canvas::export_equirectangular(std::string file_path)
{
if (!App::I.check_license())
return;
std::thread t(&ui::Canvas::export_equirectangular_thread, this, file_path);
t.detach();
}
@@ -1152,6 +1154,8 @@ void ui::Canvas::inject_xmp(std::string jpg_path)
void ui::Canvas::export_anim(std::string data_path)
{
if (!App::I.check_license())
return;
// save viewport and clear color states
GLint vp[4];
GLfloat cc[4];
@@ -1263,6 +1267,8 @@ void ui::Canvas::export_anim(std::string data_path)
void ui::Canvas::export_cubes(std::string data_path)
{
if (!App::I.check_license())
return;
#ifdef __OBJC__
NSMutableArray* files = [NSMutableArray array];
#endif
@@ -1343,6 +1349,8 @@ void ui::Canvas::export_cubes(std::string data_path)
void ui::Canvas::project_save(std::string file_path)
{
if (!App::I.check_license())
return;
std::thread t(&ui::Canvas::project_save_thread, this, file_path);
t.detach();
}

View File

@@ -264,6 +264,9 @@ int main(int argc, char** argv)
WNDCLASS wc;
PIXELFORMATDESCRIPTOR pfd;
if (!App::I.check_license())
return -1;
if (argc == 1)
App::I.initLog();