diff --git a/api/app/app.h b/api/app/app.h index 03c88e4e..70302aeb 100644 --- a/api/app/app.h +++ b/api/app/app.h @@ -1,9 +1,6 @@ #ifndef AP_H #define AP_H -#include -#include - using namespace std; namespace app { diff --git a/api/computer/computer.h b/api/computer/computer.h index 510faf0a..cb971f67 100644 --- a/api/computer/computer.h +++ b/api/computer/computer.h @@ -1,8 +1,6 @@ #ifndef COMPUTER_H #define COMPUTER_H -#include - namespace computer { string getRamUsage(json input); } diff --git a/api/debug/debug.cpp b/api/debug/debug.cpp index ba094c1c..2172d348 100644 --- a/api/debug/debug.cpp +++ b/api/debug/debug.cpp @@ -1,7 +1,6 @@ #include #include #include "lib/json.hpp" -#include "settings.h" #include "lib/easylogging/easylogging++.h" using namespace std; diff --git a/api/filesystem/filesystem.cpp b/api/filesystem/filesystem.cpp index 1e2b74cb..b8ae159d 100644 --- a/api/filesystem/filesystem.cpp +++ b/api/filesystem/filesystem.cpp @@ -24,7 +24,7 @@ namespace fs { string path = input["path"]; #if defined(__linux__) || defined(__APPLE__) if(mkdir(path.c_str(), 0700) == 0) { - #elif defined(_WIN32 + #elif defined(_WIN32) if(CreateDirectory(path.c_str(), NULL)) { #endif output["success"] = true; diff --git a/api/filesystem/filesystem.h b/api/filesystem/filesystem.h index 924a3fdd..6c6a07be 100644 --- a/api/filesystem/filesystem.h +++ b/api/filesystem/filesystem.h @@ -1,4 +1,3 @@ -#include #ifndef FILESYSTEM_H #define FILESYSTEM_H diff --git a/api/os/os.cpp b/api/os/os.cpp index 4635d0a1..a932a1da 100644 --- a/api/os/os.cpp +++ b/api/os/os.cpp @@ -9,7 +9,6 @@ #include #include #include -#include "platform/platform.h" #if defined(__APPLE__) #include @@ -17,12 +16,17 @@ #include #elif defined(_WIN32) +#include +#include +#include #include #pragma comment(lib, "Comdlg32.lib") #pragma comment(lib, "Shell32.lib") #endif +#include "platform/platform.h" + using namespace std; @@ -210,8 +214,8 @@ namespace os { } string showMessageBox(json input) { - json output; #if defined(__linux__) + json output; map messageTypes = {{"INFO", "info"}, {"WARN", "warning"}, {"ERROR", "error"}, {"QUESTION", "question"}}; string messageType; @@ -229,31 +233,34 @@ namespace os { output["success"] = true; #elif defined(__APPLE__) || defined(_WIN32) - + string title = input["title"]; + string content = input["content"]; + string type = input["type"]; + #if defined(__APPLE__) - __block json output; - __block boxer::Selection msgSel; + __block json output; + __block boxer::Selection msgSel; #elif defined(_WIN32) - json output; - boxer::Selection msgSel; + json output; + boxer::Selection msgSel; #endif #if defined(__APPLE__) dispatch_sync(dispatch_get_main_queue(), ^{ #endif - if(type == "INFO") - msgSel = boxer::show(content.c_str(), title.c_str(), boxer::Style::Info); - else if(type == "WARN") - msgSel = boxer::show(content.c_str(), title.c_str(), boxer::Style::Warning); - else if(type == "ERROR") - msgSel = boxer::show(content.c_str(), title.c_str(), boxer::Style::Error); - else if(type == "QUESTION") { - msgSel = boxer::show(content.c_str(), title.c_str(), boxer::Style::Question, - boxer::Buttons::YesNo); - output["yesButtonClicked"] = msgSel == boxer::Selection::Yes; - } - else - output["error"] = "Invalid message type: '" + type + "' provided"; + if(type == "INFO") + msgSel = boxer::show(content.c_str(), title.c_str(), boxer::Style::Info); + else if(type == "WARN") + msgSel = boxer::show(content.c_str(), title.c_str(), boxer::Style::Warning); + else if(type == "ERROR") + msgSel = boxer::show(content.c_str(), title.c_str(), boxer::Style::Error); + else if(type == "QUESTION") { + msgSel = boxer::show(content.c_str(), title.c_str(), boxer::Style::Question, + boxer::Buttons::YesNo); + output["yesButtonClicked"] = msgSel == boxer::Selection::Yes; + } + else + output["error"] = "Invalid message type: '" + type + "' provided"; #if defined(__APPLE__) }); #endif diff --git a/api/os/os.h b/api/os/os.h index e37dd172..96ef9a7f 100644 --- a/api/os/os.h +++ b/api/os/os.h @@ -1,8 +1,6 @@ #ifndef OS_H #define OS_H -#include - namespace os { string execCommand(json input); string getEnvar(json input); diff --git a/api/storage/storage.h b/api/storage/storage.h index c81b97b2..08e6d677 100644 --- a/api/storage/storage.h +++ b/api/storage/storage.h @@ -1,8 +1,6 @@ #ifndef STORAGE_H #define STORAGE_H -#include - using namespace std; namespace storage { diff --git a/api/window/window.cpp b/api/window/window.cpp index 1a6170c3..11676db0 100644 --- a/api/window/window.cpp +++ b/api/window/window.cpp @@ -24,6 +24,9 @@ using namespace std; using json = nlohmann::json; +#if defined(_WIN32) +using namespace Gdiplus; +#endif webview::webview *nativeWindow; #if defined(__linux__) @@ -109,7 +112,7 @@ namespace window { nativeWindow->run(); } #elif defined(_WIN32) - void __showWindow(int height, int width, + void __createWindow(int height, int width, bool fullScreen, string title, bool alwaysOnTop, void* icon, bool enableInspector, bool borderless, bool maximize, bool hidden, string url) { diff --git a/api/window/window.h b/api/window/window.h index a5487e1d..ec6407ba 100644 --- a/api/window/window.h +++ b/api/window/window.h @@ -1,9 +1,6 @@ #ifndef WI_H #define WI_H -#include -#include - using namespace std; namespace window { diff --git a/bin/WebView2Loader.dll b/bin/WebView2Loader.dll new file mode 100644 index 00000000..2805c272 Binary files /dev/null and b/bin/WebView2Loader.dll differ diff --git a/bin/neutralino.exe b/bin/neutralino.exe new file mode 100644 index 00000000..f571c7c2 Binary files /dev/null and b/bin/neutralino.exe differ diff --git a/build_windows.bat b/build_windows.bat index 59a15bd1..8a1702ec 100644 --- a/build_windows.bat +++ b/build_windows.bat @@ -31,30 +31,30 @@ if EXIST bin\neutralino.exe ( ) cl /std:c++17 ^ -/I ../core-shared ^ -/I src/platform/webview2 ^ +/I . ^ +/I platform/windows/webview2 ^ /EHsc ^ -../core-shared/main.cpp ^ -../core-shared/settings.cpp ^ -../core-shared/resources.cpp ^ -../core-shared/router.cpp ^ -../core-shared/auth/authbasic.cpp ^ -../core-shared/ping/ping.cpp ^ -../core-shared/helpers.cpp ^ -../core-shared/permission.cpp ^ -../core-shared/server/neuserver.cpp ^ -../core-shared/lib/easylogging/easylogging++.cc ^ -../core-shared/lib/boxer/boxer_win.cpp ^ -src/platform/windows.cpp ^ -src/api/computer/computer.cpp ^ -src/api/filesystem/filesystem.cpp ^ -src/api/os/os.cpp ^ -src/api/storage/storage.cpp ^ -src/api/debug/debug.cpp ^ -src/api/app/app.cpp ^ -src/api/window/window.cpp ^ +main.cpp ^ +settings.cpp ^ +resources.cpp ^ +server/neuserver.cpp ^ +server/router.cpp ^ +auth/authbasic.cpp ^ +auth/permission.cpp ^ +server/ping.cpp ^ +helpers.cpp ^ +lib/easylogging/easylogging++.cc ^ +lib/boxer/boxer_win.cpp ^ +platform/windows/platform.cpp ^ +api/computer/computer.cpp ^ +api/filesystem/filesystem.cpp ^ +api/os/os.cpp ^ +api/storage/storage.cpp ^ +api/debug/debug.cpp ^ +api/app/app.cpp ^ +api/window/window.cpp ^ /DELPP_NO_DEFAULT_LOG_FILE ^ -/link dll/WebView2Loader.dll.lib "/OUT:bin\neutralino.exe" +/link platform/windows/webview2/WebView2Loader.dll.lib "/OUT:bin\neutralino.exe" if EXIST bin\neutralino.exe ( echo Neutralino binary is compiled in to bin/netralino.exe diff --git a/platform/windows/dll/WebView2Loader.dll b/platform/windows/dll/WebView2Loader.dll deleted file mode 100644 index fe60b075..00000000 Binary files a/platform/windows/dll/WebView2Loader.dll and /dev/null differ diff --git a/platform/windows/dll/webview.dll b/platform/windows/dll/webview.dll deleted file mode 100644 index 33b5d878..00000000 Binary files a/platform/windows/dll/webview.dll and /dev/null differ diff --git a/platform/windows/dll/WebView2Loader.dll.lib b/platform/windows/webview2/WebView2Loader.dll.lib similarity index 100% rename from platform/windows/dll/WebView2Loader.dll.lib rename to platform/windows/webview2/WebView2Loader.dll.lib diff --git a/settings.cpp b/settings.cpp index 3d657cd0..2ee47709 100644 --- a/settings.cpp +++ b/settings.cpp @@ -18,6 +18,7 @@ #elif defined(__APPLE__) #define OS_NAME "Darwin" #endif +#define NL_VERSION "2.2.0" #define APP_CONFIG_FILE "/neutralino.config.json" @@ -66,7 +67,7 @@ namespace settings { string getGlobalVars(){ string jsSnippet = "var NL_OS='" + std::string(OS_NAME) + "';"; - jsSnippet += "var NL_VERSION='2.1.1';"; + jsSnippet += "var NL_VERSION='" + std::string(NL_VERSION) + "';"; jsSnippet += "var NL_APPID='" + options["applicationId"].get() + "';"; jsSnippet += "var NL_PORT=" + std::to_string(options["port"].get()) + ";"; jsSnippet += "var NL_MODE='" + options["defaultMode"].get() + "';";