diff --git a/3rdparty/CefViewCore/include/CefVersion.h b/3rdparty/CefViewCore/include/CefVersion.h deleted file mode 100644 index 298eb77..0000000 --- a/3rdparty/CefViewCore/include/CefVersion.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// CefVersion.h -// CefViewCore -// -// Created by Sheen Tian on 2025/1/19. -// This file was generated during CMake configuring. -// Do not edit this file directly by manual. -// Edit the CefVersion.h.in and then re-config project with CMake. -// - -#ifndef CefVersion_h -#define CefVersion_h -#pragma once - -// clang-format off -#define CEF_VERSION "134.3.5+g36934eb+chromium-134.0.6998.89" -#define CEF_VERSION_MAJOR 134 -#define CEF_VERSION_MINOR 3 -#define CEF_VERSION_PATCH 5 -#define CEF_COMMIT_NUMBER 3154 -#define CEF_COMMIT_HASH "36934ebbc5279631116b9e2b71d8b22acbcd1574" -// clang-format on - -#endif // CefVersion diff --git a/3rdparty/CefViewCore/include/CefViewBrowserApp.h b/3rdparty/CefViewCore/include/CefViewBrowserApp.h deleted file mode 100644 index e4b49a2..0000000 --- a/3rdparty/CefViewCore/include/CefViewBrowserApp.h +++ /dev/null @@ -1,129 +0,0 @@ -// -// CefViewBrowserApp.h -// CefViewCore -// -// Created by Sheen Tian on 2020/6/11. -// - -#ifndef CefViewBrowserApp_h -#define CefViewBrowserApp_h -#pragma once - -#pragma region stl_headers -#include -#include -#pragma endregion - -#include -#include -#include - -struct FolderResourceMapping -{ - CefString path; - CefString url; - int priority; -}; - -struct ArchiveResourceMapping -{ - CefString path; - CefString url; - CefString password; - int priority; -}; - -class CefViewBrowserApp - : public CefApp - , public CefBrowserProcessHandler -{ - IMPLEMENT_REFCOUNTING(CefViewBrowserApp); - -private: - // The name of the bridge object - CefString builtin_scheme_name_; - CefString bridge_object_name_; - std::unordered_map client_handler_map_; - - // The app delegate - CefViewBrowserAppDelegateInterface::WeakPtr app_delegate_; - - std::list folderResourceMappingList_; - - std::list archiveResourceMappingList_; - -public: - CefViewBrowserApp(const CefString& scheme_name, - const CefString& bridge_name, - CefViewBrowserAppDelegateInterface::RefPtr delegate); - - ~CefViewBrowserApp(); - - void CheckInClient(void* ctx, const CefViewBrowserClientDelegateInterface::RefPtr& handler); - - void CheckOutClient(void* ctx); - - CefViewBrowserClientDelegateInterface::RefPtr GetClientHandler(void* ctx); - - void AddLocalFolderResource(const CefString& path, const CefString& url, int priority = 0); - const std::list& FolderResourceMappingList(); - - void AddArchiveResource(const CefString& path, - const CefString& url, - const CefString& password = "", - int priority = 0); - const std::list& ArchiveResourceMappingList(); - - bool AddGlobalCookie(const CefString& name, - const CefString& value, - const CefString& domain, - const CefString& url); - - bool DeleteAllCookies(); - - bool AddCrossOriginWhitelistEntry(const CefString& sourceOrigin, - const CefString& targetSchema, - const CefString& targetDomain, - bool allowTargetSubdomains); - - bool RemoveCrossOriginWhitelistEntry(const CefString& sourceOrigin, - const CefString& targetSchema, - const CefString& targetDomain, - bool allowTargetSubdomains); - - bool ClearCrossOriginWhitelistEntry(); - - bool IsSafeToExit(); - -private: -#pragma region CefApp - ////////////////////////////////////////////////////////////////////////// - // CefApp methods: - virtual void OnBeforeCommandLineProcessing(const CefString& process_type, - CefRefPtr command_line) override; - - virtual void OnRegisterCustomSchemes(CefRawPtr registrar) override; - - virtual CefRefPtr GetResourceBundleHandler() override; - - virtual CefRefPtr GetBrowserProcessHandler() override; - - virtual CefRefPtr GetRenderProcessHandler() override; - -#pragma endregion - -#pragma region CefBrowserProcessHandler - ////////////////////////////////////////////////////////////////////////// - // CefBrowserProcessHandler methods: - virtual void OnContextInitialized() override; - - virtual void OnBeforeChildProcessLaunch(CefRefPtr command_line) override; - - virtual void OnScheduleMessagePumpWork(int64_t delay_ms) override; - - CefRefPtr GetDefaultClient() override; - -#pragma endregion -}; - -#endif diff --git a/3rdparty/CefViewCore/include/CefViewBrowserAppDelegate.h b/3rdparty/CefViewCore/include/CefViewBrowserAppDelegate.h deleted file mode 100644 index 82f0c26..0000000 --- a/3rdparty/CefViewCore/include/CefViewBrowserAppDelegate.h +++ /dev/null @@ -1,59 +0,0 @@ -// -// CefViewBrowserAppDelegate.h -// CefViewCore -// -// Created by Sheen Tian on 2020/6/11. -// - -#ifndef CefViewBrowserAppDelegate_h -#define CefViewBrowserAppDelegate_h -#pragma once - -#pragma region stl_headers -#include -#pragma endregion - -#include - -/// -/// -/// -class CefViewBrowserAppDelegateInterface -{ -public: - /// - /// - /// - typedef std::shared_ptr RefPtr; - - /// - /// - /// - typedef std::weak_ptr WeakPtr; - - /// - /// - /// - virtual ~CefViewBrowserAppDelegateInterface(){}; - - /// - /// - /// - /// - /// - virtual void onBeforeCommandLineProcessing(const CefString& process_type, CefRefPtr command_line) = 0; - - /// - /// - /// - /// - virtual void onBeforeChildProcessLaunch(CefRefPtr command_line) = 0; - - /// - /// - /// - /// - virtual void onScheduleMessageLoopWork(int64_t delay_ms) = 0; -}; - -#endif diff --git a/3rdparty/CefViewCore/include/CefViewBrowserClient.h b/3rdparty/CefViewCore/include/CefViewBrowserClient.h deleted file mode 100644 index 94123e8..0000000 --- a/3rdparty/CefViewCore/include/CefViewBrowserClient.h +++ /dev/null @@ -1,477 +0,0 @@ -// -// CefViewBrowserClient.h -// CefViewCore -// -// Created by Sheen Tian on 2020/6/11. -// - -#ifndef CefViewBrowserHandler_h -#define CefViewBrowserHandler_h -#pragma once - -#pragma region stl_headers -#include -#pragma endregion - -#include -#include -#include - -#if CEF_VERSION_MAJOR < 122 -#define CEFVIEW_MAIN_FRAME (0) -#define CEFVIEW_ALL_FRAMES (-1) -#else -#define CEFVIEW_MAIN_FRAME ("0") -#define CEFVIEW_ALL_FRAMES ("-1") -#endif - -/// -/// Forward declaration -/// -class CefViewQueryHandler; - -/// -/// -/// -class CefViewBrowserClient - : public CefClient - , public CefContextMenuHandler - , public CefDialogHandler - , public CefDisplayHandler - , public CefDownloadHandler - , public CefDragHandler - , public CefFindHandler - , public CefFocusHandler - , public CefJSDialogHandler - , public CefKeyboardHandler - , public CefLifeSpanHandler - , public CefLoadHandler - , public CefRequestHandler - , public CefResourceRequestHandler - , public CefRenderHandler -{ - IMPLEMENT_REFCOUNTING(CefViewBrowserClient); - -private: - /// - /// - /// - CefRefPtr app_; - - /// - /// - /// - CefViewBrowserClientDelegateInterface::WeakPtr client_delegate_; - - // flags - bool is_closing_; - bool close_by_native_; - bool initial_navigation_; - - // message router - CefMessageRouterConfig message_router_config_; - CefRefPtr message_router_; - CefRefPtr message_router_handler_; - - // resource manager - CefRefPtr resource_manager_; - - // browser map - std::unordered_map> browser_map_; - -public: - /// - /// - /// - /// - /// - CefViewBrowserClient(CefRefPtr app, CefViewBrowserClientDelegateInterface::RefPtr delegate); - - /// - /// - /// - ~CefViewBrowserClient(); - - /// - /// - /// - /// - int GetBrowserCount() { return static_cast(browser_map_.size()); } - - /// - /// - /// - void CloseAllBrowsers(); - - /// - /// - /// - /// - /// - /// - void AddLocalDirectoryResourceProvider(const CefString& dir_path, const CefString& url, int priority = 0); - - /// - /// - /// - /// - /// - /// - /// - void AddArchiveResourceProvider(const CefString& archive_path, - const CefString& url, - const CefString& password, - int priority = 0); - - bool TriggerEvent(CefRefPtr browser, const CefFrameId& frame_id, const CefRefPtr msg); - - /// - /// - /// - /// - /// - /// - /// - /// - bool ResponseQuery(const int64_t query, bool success, const CefString& response, int error); - - /// - /// - /// - /// - /// - /// - /// - /// - /// - bool AsyncExecuteJSCode(CefRefPtr browser, - CefRefPtr frame, - const CefString& code, - const CefString& url, - const CefString& context); - -protected: - bool DispatchRenderMessage(CefRefPtr browser, - CefRefPtr frame, - CefRefPtr message); - - bool OnRenderFocusedNodeChangedMessage(CefRefPtr browser, - CefRefPtr frame, - CefRefPtr message); - - bool OnRenderInvokeMethodMessage(CefRefPtr browser, - CefRefPtr frame, - CefRefPtr message); - - bool OnRenderReportJSResultMessage(CefRefPtr browser, - CefRefPtr frame, - CefRefPtr message); - - // CefClient methods: -#pragma region CefContextMenuHandler - virtual bool OnProcessMessageReceived(CefRefPtr browser, - CefRefPtr frame, - CefProcessId source_process, - CefRefPtr message) override; -#pragma endregion - - // CefContextMenuHandler methods -#pragma region CefContextMenuHandler - virtual CefRefPtr GetContextMenuHandler() override; - virtual void OnBeforeContextMenu(CefRefPtr browser, - CefRefPtr frame, - CefRefPtr params, - CefRefPtr model) override; - virtual bool RunContextMenu(CefRefPtr browser, - CefRefPtr frame, - CefRefPtr params, - CefRefPtr model, - CefRefPtr callback) override; - virtual bool OnContextMenuCommand(CefRefPtr browser, - CefRefPtr frame, - CefRefPtr params, - int command_id, - EventFlags event_flags) override; - virtual void OnContextMenuDismissed(CefRefPtr browser, CefRefPtr frame) override; -#pragma endregion - - // CefDialogHandler -#pragma region CefDialogHandler - virtual CefRefPtr GetDialogHandler() override; - -#if CEF_VERSION_MAJOR < 102 - virtual bool OnFileDialog(CefRefPtr browser, - FileDialogMode mode, - const CefString& title, - const CefString& default_file_path, - const std::vector& accept_filters, - int selected_accept_filter, - CefRefPtr callback) override; -#elif CEF_VERSION_MAJOR < 126 - virtual bool OnFileDialog(CefRefPtr browser, - FileDialogMode mode, - const CefString& title, - const CefString& default_file_path, - const std::vector& accept_filters, - CefRefPtr callback) override; -#else - virtual bool OnFileDialog(CefRefPtr browser, - FileDialogMode mode, - const CefString& title, - const CefString& default_file_path, - const std::vector& accept_filters, - const std::vector& accept_extensions, - const std::vector& accept_descriptions, - CefRefPtr callback) override; -#endif - -#pragma endregion - - // CefDisplayHandler methods -#pragma region CefDisplayHandler - virtual CefRefPtr GetDisplayHandler() override; - virtual void OnAddressChange(CefRefPtr browser, CefRefPtr frame, const CefString& url) override; - virtual void OnTitleChange(CefRefPtr browser, const CefString& title) override; - virtual void OnFaviconURLChange(CefRefPtr browser, const std::vector& icon_urls) override; - virtual void OnFullscreenModeChange(CefRefPtr browser, bool fullscreen) override; - virtual bool OnTooltip(CefRefPtr browser, CefString& text) override; - virtual void OnStatusMessage(CefRefPtr browser, const CefString& value) override; - virtual bool OnConsoleMessage(CefRefPtr browser, - cef_log_severity_t level, - const CefString& message, - const CefString& source, - int line) override; - virtual bool OnAutoResize(CefRefPtr browser, const CefSize& new_size) override; - virtual void OnLoadingProgressChange(CefRefPtr browser, double progress) override; - virtual bool OnCursorChange(CefRefPtr browser, - CefCursorHandle cursor, - cef_cursor_type_t type, - const CefCursorInfo& custom_cursor_info) override; -#pragma endregion - - // CefDownloadHandler -#pragma region CefDownloadHandler - virtual CefRefPtr GetDownloadHandler() override; -#if CEF_VERSION_MAJOR < 125 - virtual void OnBeforeDownload(CefRefPtr browser, - CefRefPtr download_item, - const CefString& suggested_name, - CefRefPtr callback) override; -#else - virtual bool OnBeforeDownload(CefRefPtr browser, - CefRefPtr download_item, - const CefString& suggested_name, - CefRefPtr callback) override; -#endif - - void OnDownloadUpdated(CefRefPtr browser, - CefRefPtr download_item, - CefRefPtr callback) override; -#pragma endregion - - // CefDragHandler methods -#pragma region CefDragHandler - virtual CefRefPtr GetDragHandler() override; - virtual bool OnDragEnter(CefRefPtr browser, - CefRefPtr dragData, - CefDragHandler::DragOperationsMask mask) override; - - virtual void OnDraggableRegionsChanged(CefRefPtr browser, - CefRefPtr frame, - const std::vector& regions) override; -#pragma endregion - - // CefFindHandler methods -#pragma region CefFindHandler - virtual CefRefPtr GetFindHandler() override; - virtual void OnFindResult(CefRefPtr browser, - int identifier, - int count, - const CefRect& selectionRect, - int activeMatchOrdinal, - bool finalUpdate) override; -#pragma endregion - - // CefFocusHandler methods -#pragma region CefFocusHandler - virtual CefRefPtr GetFocusHandler() override; - void OnTakeFocus(CefRefPtr browser, bool next) override; - bool OnSetFocus(CefRefPtr browser, FocusSource source) override; - void OnGotFocus(CefRefPtr browser) override; -#pragma endregion - - // CefJSDialogHandler methods -#pragma region CefJSDialogHandler - virtual CefRefPtr GetJSDialogHandler() override; - virtual bool OnJSDialog(CefRefPtr browser, - const CefString& origin_url, - JSDialogType dialog_type, - const CefString& message_text, - const CefString& default_prompt_text, - CefRefPtr callback, - bool& suppress_message) override; - virtual bool OnBeforeUnloadDialog(CefRefPtr browser, - const CefString& message_text, - bool is_reload, - CefRefPtr callback) override; - virtual void OnResetDialogState(CefRefPtr browser) override; - virtual void OnDialogClosed(CefRefPtr browser) override; -#pragma endregion - - // CefKeyboardHandler methods -#pragma region CefKeyboardHandler - virtual CefRefPtr GetKeyboardHandler() override; - virtual bool OnPreKeyEvent(CefRefPtr browser, - const CefKeyEvent& event, - CefEventHandle os_event, - bool* is_keyboard_shortcut) override; - virtual bool OnKeyEvent(CefRefPtr browser, const CefKeyEvent& event, CefEventHandle os_event) override; -#pragma endregion - - // CefLifeSpanHandler methods: -#pragma region CefLifeSpanHandler - virtual CefRefPtr GetLifeSpanHandler() override; - virtual bool OnBeforePopup(CefRefPtr browser, - CefRefPtr frame, -#if CEF_VERSION_MAJOR > 131 - int popup_id, -#endif - const CefString& target_url, - const CefString& target_frame_name, - CefLifeSpanHandler::WindowOpenDisposition target_disposition, - bool user_gesture, - const CefPopupFeatures& popupFeatures, - CefWindowInfo& windowInfo, - CefRefPtr& client, - CefBrowserSettings& settings, - CefRefPtr& extra_info, - bool* no_javascript_access) override; - virtual void OnAfterCreated(CefRefPtr browser) override; - virtual bool DoClose(CefRefPtr browser) override; - virtual void OnBeforeClose(CefRefPtr browser) override; -#pragma endregion - - // CefLoadHandler methods -#pragma region CefLoadHandler - virtual CefRefPtr GetLoadHandler() override; - virtual void OnLoadingStateChange(CefRefPtr browser, - bool isLoading, - bool canGoBack, - bool canGoForward) override; - virtual void OnLoadStart(CefRefPtr browser, - CefRefPtr frame, - TransitionType transition_type) override; - virtual void OnLoadEnd(CefRefPtr browser, CefRefPtr frame, int httpStatusCode) override; - virtual void OnLoadError(CefRefPtr browser, - CefRefPtr frame, - ErrorCode errorCode, - const CefString& errorText, - const CefString& failedUrl) override; -#pragma endregion - - // CefRenderHandler -#pragma region CefRenderHandler - virtual CefRefPtr GetRenderHandler() override; - virtual CefRefPtr GetAccessibilityHandler() override; - virtual bool GetRootScreenRect(CefRefPtr browser, CefRect& rect) override; - virtual void GetViewRect(CefRefPtr browser, CefRect& rect) override; - virtual bool GetScreenPoint(CefRefPtr browser, int viewX, int viewY, int& screenX, int& screenY) override; - virtual bool GetScreenInfo(CefRefPtr browser, CefScreenInfo& screen_info) override; - virtual void OnPopupShow(CefRefPtr browser, bool show) override; - virtual void OnPopupSize(CefRefPtr browser, const CefRect& rect) override; - virtual void OnPaint(CefRefPtr browser, - PaintElementType type, - const RectList& dirtyRects, - const void* buffer, - int width, - int height) override; -#if CEF_VERSION_MAJOR < 124 - virtual void OnAcceleratedPaint(CefRefPtr browser, - PaintElementType type, - const RectList& dirtyRects, - void* shared_handle) override; -#else - virtual void OnAcceleratedPaint(CefRefPtr browser, - PaintElementType type, - const RectList& dirtyRects, - const CefAcceleratedPaintInfo& info) override; -#endif - virtual bool StartDragging(CefRefPtr browser, - CefRefPtr drag_data, - CefRenderHandler::DragOperationsMask allowed_ops, - int x, - int y) override; - virtual void UpdateDragCursor(CefRefPtr browser, DragOperation operation) override; - virtual void OnScrollOffsetChanged(CefRefPtr browser, double x, double y) override; - virtual void OnImeCompositionRangeChanged(CefRefPtr browser, - const CefRange& selected_range, - const RectList& character_bounds) override; - virtual void OnTextSelectionChanged(CefRefPtr browser, - const CefString& selected_text, - const CefRange& selected_range) override; - virtual void OnVirtualKeyboardRequested(CefRefPtr browser, TextInputMode input_mode) override; -#pragma endregion - - // CefRequestHandler methods -#pragma region CefRequestHandler - virtual CefRefPtr GetRequestHandler() override; - virtual bool OnBeforeBrowse(CefRefPtr browser, - CefRefPtr frame, - CefRefPtr request, - bool user_gesture, - bool is_redirect) override; - - virtual bool OnOpenURLFromTab(CefRefPtr browser, - CefRefPtr frame, - const CefString& target_url, - CefRequestHandler::WindowOpenDisposition target_disposition, - bool user_gesture) override; -#if CEF_VERSION_MAJOR > 91 && CEF_VERSION_MAJOR < 109 - virtual bool OnQuotaRequest(CefRefPtr browser, - const CefString& origin_url, - int64 new_size, - CefRefPtr callback) override; -#endif - -#if CEF_VERSION_MAJOR < 124 - virtual void OnRenderProcessTerminated(CefRefPtr browser, TerminationStatus status) override; -#else - virtual void OnRenderProcessTerminated(CefRefPtr browser, - TerminationStatus status, - int error_code, - const CefString& error_string) override; -#endif - -#pragma endregion - - // CefResourceRequestHandler -#pragma region CefResourceRequestHandler - virtual CefRefPtr GetResourceRequestHandler(CefRefPtr browser, - CefRefPtr frame, - CefRefPtr request, - bool is_navigation, - bool is_download, - const CefString& request_initiator, - bool& disable_default_handling) override; - - virtual ReturnValue OnBeforeResourceLoad(CefRefPtr browser, - CefRefPtr frame, - CefRefPtr request, -#if CEF_VERSION_MAJOR > 91 - CefRefPtr callback -#else - CefRefPtr callback -#endif - ) override; - - virtual CefRefPtr GetResourceHandler(CefRefPtr browser, - CefRefPtr frame, - CefRefPtr request) override; - - virtual void OnProtocolExecution(CefRefPtr browser, - CefRefPtr frame, - CefRefPtr request, - bool& allow_os_execution) override; -#pragma endregion -}; -#endif diff --git a/3rdparty/CefViewCore/include/CefViewBrowserClientDelegate.h b/3rdparty/CefViewCore/include/CefViewBrowserClientDelegate.h deleted file mode 100644 index b31e994..0000000 --- a/3rdparty/CefViewCore/include/CefViewBrowserClientDelegate.h +++ /dev/null @@ -1,311 +0,0 @@ -// -// CefViewBrowserHandlerDelegate.h -// CefViewCore -// -// Created by Sheen Tian on 2020/6/11. -// - -#ifndef CefViewBrowserHandlerDelegate_h -#define CefViewBrowserHandlerDelegate_h -#pragma once - -#pragma region stl_headers -#include -#pragma endregion - -#include - -/// -/// -/// -class CefViewBrowserClientDelegateInterface -{ -public: - /// - /// - /// - typedef std::shared_ptr RefPtr; - - /// - /// - /// - typedef std::weak_ptr WeakPtr; - - /// - /// - /// - virtual ~CefViewBrowserClientDelegateInterface() {} - - /// - /// - /// - /// - /// - /// - virtual void processUrlRequest(CefRefPtr& browser, CefRefPtr& frame, const CefString& url) = 0; - - /// - /// - /// - /// - /// - /// - /// - virtual void processQueryRequest(CefRefPtr& browser, - CefRefPtr& frame, - const CefString& query, - const int64_t query_id) = 0; - - /// - /// - /// - /// - /// - /// - virtual void focusedEditableNodeChanged(CefRefPtr& browser, - CefRefPtr& frame, - bool focusOnEditableNode) = 0; - - /// - /// - /// - /// - /// - /// - /// - virtual void invokeMethodNotify(CefRefPtr& browser, - CefRefPtr& frame, - const CefString& method, - const CefRefPtr& arguments) = 0; - - /// - /// - /// - /// - /// - /// - /// - virtual void reportJSResult(CefRefPtr& browser, - CefRefPtr& frame, - const CefString& context, - const CefRefPtr& result) = 0; - - // context menu handler -#pragma region ContextMenuHandler - virtual void onBeforeContextMenu(CefRefPtr& browser, - CefRefPtr& frame, - CefRefPtr& params, - CefRefPtr& model) = 0; - virtual bool onRunContextMenu(CefRefPtr& browser, - CefRefPtr& frame, - CefRefPtr& params, - CefRefPtr& model, - CefRefPtr& callback) = 0; - virtual bool onContextMenuCommand(CefRefPtr& browser, - CefRefPtr& frame, - CefRefPtr& params, - int command_id, - CefContextMenuHandler::EventFlags event_flags) = 0; - virtual void onContextMenuDismissed(CefRefPtr& browser, CefRefPtr& frame) = 0; -#pragma endregion - - // dialog handler -#pragma region DialogHandler - virtual bool onFileDialog(CefRefPtr& browser, - CefBrowserHost::FileDialogMode mode, - const CefString& title, - const CefString& default_file_path, - const std::vector& accept_filters, -#if CEF_VERSION_MAJOR < 102 - int selected_accept_filter, -#endif - CefRefPtr& callback) - { - return false; - }; -#pragma endregion - - // display handler -#pragma region DisplayHandler - virtual void addressChanged(CefRefPtr& browser, CefRefPtr& frame, const CefString& url) = 0; - - virtual void titleChanged(CefRefPtr& browser, const CefString& title) = 0; - - virtual void faviconURLChanged(CefRefPtr& browser, const std::vector& icon_urls) = 0; - - virtual bool tooltipMessage(CefRefPtr& browser, const CefString& text) = 0; - - virtual void fullscreenModeChanged(CefRefPtr& browser, bool fullscreen) = 0; - - virtual void statusMessage(CefRefPtr& browser, const CefString& value) = 0; - - virtual void loadingProgressChanged(CefRefPtr& browser, double progress) = 0; - - virtual void consoleMessage(CefRefPtr& browser, const CefString& message, int level) = 0; - - virtual bool cursorChanged(CefRefPtr& browser, - CefCursorHandle cursor, - cef_cursor_type_t type, - const CefCursorInfo& custom_cursor_info) = 0; -#pragma endregion - - // download hander -#pragma region DownloadHandler - virtual void onBeforeDownload(CefRefPtr& browser, - CefRefPtr& download_item, - const CefString& suggested_name, - CefRefPtr& callback) = 0; - - virtual void onDownloadUpdated(CefRefPtr& browser, - CefRefPtr& download_item, - CefRefPtr& callback) = 0; -#pragma endregion - - // drag hander -#pragma region DragHandler - virtual bool onDragEnter(CefRefPtr& browser, - CefRefPtr& dragData, - CefDragHandler::DragOperationsMask mask) - { - return true; - } - - virtual void draggableRegionChanged(CefRefPtr& browser, - CefRefPtr& frame, - const std::vector& regions) = 0; -#pragma endregion - - // focus handler -#pragma region FocusHandler - virtual void takeFocus(CefRefPtr& browser, bool next) = 0; - - virtual bool setFocus(CefRefPtr& browser) = 0; - - virtual void gotFocus(CefRefPtr& browser) = 0; -#pragma endregion - -// JS dialog handler -#pragma region JSDialogHandler - virtual bool onJSDialog(CefRefPtr& browser, - const CefString& origin_url, - CefJSDialogHandler::JSDialogType dialog_type, - const CefString& message_text, - const CefString& default_prompt_text, - CefRefPtr& callback, - bool& suppress_message) = 0; - - virtual bool onBeforeUnloadDialog(CefRefPtr& browser, - const CefString& message_text, - bool is_reload, - CefRefPtr& callback) = 0; - virtual void onResetDialogState(CefRefPtr& browser) = 0; - virtual void onDialogClosed(CefRefPtr& browser) = 0; -#pragma endregion - - // keyboard handler -#pragma region KeyboardHandler - virtual bool onPreKeyEvent(CefRefPtr& browser, - const CefKeyEvent& event, - CefEventHandle os_event, - bool* is_keyboard_shortcut) = 0; - - virtual bool onKeyEvent(CefRefPtr& browser, const CefKeyEvent& event, CefEventHandle os_event) = 0; -#pragma endregion - - // life span handler -#pragma region LifeSpanHandler - virtual bool onBeforePopup(CefRefPtr& browser, - CefRefPtr& frame, - const CefString& targetUrl, - const CefString& targetFrameName, - CefLifeSpanHandler::WindowOpenDisposition targetDisposition, - CefWindowInfo& windowInfo, - CefBrowserSettings& settings, - bool& DisableJavascriptAccess) = 0; - virtual void onAfterCreate(CefRefPtr& browser) = 0; - - virtual bool doClose(CefRefPtr& browser) = 0; - - virtual bool requestClose(CefRefPtr& browser) = 0; - - virtual void onBeforeClose(CefRefPtr& browser) = 0; -#pragma endregion - - // load handler -#pragma region LoadHandler - virtual void loadingStateChanged(CefRefPtr& browser, - bool isLoading, - bool canGoBack, - bool canGoForward) = 0; - - virtual void loadStart(CefRefPtr& browser, CefRefPtr& frame, int transition_type) = 0; - - virtual void loadEnd(CefRefPtr& browser, CefRefPtr& frame, int httpStatusCode) = 0; - - virtual void loadError(CefRefPtr& browser, - CefRefPtr& frame, - int errorCode, - const CefString& errorMsg, - const CefString& failedUrl, - bool& handled) = 0; -#pragma endregion - - // Off screen rendering -#pragma region RenderHandler - virtual bool getRootScreenRect(CefRefPtr& browser, CefRect& rect) { return false; } - virtual void getViewRect(CefRefPtr& browser, CefRect& rect) {} - virtual bool getScreenPoint(CefRefPtr& browser, int viewX, int viewY, int& screenX, int& screenY) - { - return false; - } - virtual bool getScreenInfo(CefRefPtr& browser, CefScreenInfo& screen_info) { return false; } - virtual void onPopupShow(CefRefPtr& browser, bool show) {} - virtual void onPopupSize(CefRefPtr& browser, const CefRect& rect) {} - virtual void onPaint(CefRefPtr& browser, - CefRenderHandler::PaintElementType type, - const CefRenderHandler::RectList& dirtyRects, - const void* buffer, - int width, - int height) - { - } -#if CEF_VERSION_MAJOR < 124 - virtual void onAcceleratedPaint(CefRefPtr& browser, - CefRenderHandler::PaintElementType type, - const CefRenderHandler::RectList& dirtyRects, - void* shared_handle) - { - } -#else - virtual void onAcceleratedPaint(CefRefPtr& browser, - CefRenderHandler::PaintElementType type, - const CefRenderHandler::RectList& dirtyRects, - const CefAcceleratedPaintInfo& info) - { - } -#endif - virtual bool startDragging(CefRefPtr& browser, - CefRefPtr& drag_data, - CefRenderHandler::DragOperationsMask allowed_ops, - int x, - int y) - { - return false; - } - virtual void updateDragCursor(CefRefPtr& browser, CefRenderHandler::DragOperation operation) {} - virtual void onScrollOffsetChanged(CefRefPtr& browser, double x, double y) {} - virtual void onImeCompositionRangeChanged(CefRefPtr& browser, - const CefRange& selected_range, - const CefRenderHandler::RectList& character_bounds) - { - } - virtual void onTextSelectionChanged(CefRefPtr& browser, - const CefString& selected_text, - const CefRange& selected_range) - { - } - virtual void onVirtualKeyboardRequested(CefRefPtr& browser, CefRenderHandler::TextInputMode input_mode) {} -#pragma endregion -}; - -#endif diff --git a/3rdparty/CefViewCore/include/CefViewCoreGlobal.h b/3rdparty/CefViewCore/include/CefViewCoreGlobal.h deleted file mode 100644 index 0557270..0000000 --- a/3rdparty/CefViewCore/include/CefViewCoreGlobal.h +++ /dev/null @@ -1,44 +0,0 @@ -// -// CefViewCoreGlobal.h -// CefViewCore -// -// Created by Sheen Tian on 2023/5/30. -// - -#ifndef CefViewCoreGlobal_h -#define CefViewCoreGlobal_h -#pragma once - -#pragma region stl_headers -#include -#include -#pragma endregion - -#pragma region cef_headers -#include -#include -#include -#include -#include -#include -#include -#pragma endregion - -#if CEF_VERSION_MAJOR < 122 -using CefFrameId = int64_t; -#else -using CefFrameId = CefString; - -template<> -struct std::hash -{ - std::size_t operator()(const CefFrameId& k) const - { - using std::hash; - using std::string; - return std::hash()(k.ToString()); - } -}; -#endif // CEF_VERSION_MAJOR < 122 - -#endif // CefViewCoreGlobal_h diff --git a/3rdparty/CefViewCore/include/CefViewCoreProtocol.h b/3rdparty/CefViewCore/include/CefViewCoreProtocol.h deleted file mode 100644 index e97b18a..0000000 --- a/3rdparty/CefViewCore/include/CefViewCoreProtocol.h +++ /dev/null @@ -1,135 +0,0 @@ -// -// CefViewCoreProtocol.h -// CefViewCore -// -// Created by Sheen Tian on 2020/6/11. -// This file was generated during CMake configuring. -// Do not edit this file directly by manual. -// Edit the CefViewCoreProtocol.h.in and then re-config project with CMake. -// - -#ifndef CefViewCoreProtocol_h -#define CefViewCoreProtocol_h -#pragma once - -/// -/// CefView Helper Process Name -/// -#define kCefViewRenderProcessName "CefViewWing" - -/// -/// -/// -#define kCefViewQueryFuntionName "cefViewQuery" - -/// -/// -/// -#define kCefViewQueryCancelFunctionName "cefViewQueryCancel" - -/// -/// -/// -#define kCefViewBridgeObjectNameKey "bridge-obj-name" - -/// -/// -/// -#define kCefViewBuiltinSchemeNameKey "builtin-scheme-name" - -/// -/// -/// -#define kCefViewWindowsJobNameKey "windows-job-name" - -/// -/// -/// -#define kCefViewDefaultBridgeObjectName "CefViewClient" - -/// -/// -/// -#define kCefViewDefaultBuiltinSchemaName "CefView" - -/// -/// CEFVIEWClient.invokeMethod("method_name", ...) -/// -#define kCefViewInvokeMethodFunctionName "invoke" - -/// -/// CEFVIEWClient.addEventListener(type, listener) -/// -#define kCefViewAddEventListenerFunctionName "addEventListener" - -/// -/// CEFVIEWClient.removeEventListener(type, listener) -/// -#define kCefViewRemoveEventListenerFunctionName "removeEventListener" - -/// -/// this message is sent from render process to browser process -/// and is processed in the Qt UI thread -/// -/// -#define kCefViewClientRenderFocusedNodeChangedMessage "CefViewClientRender.FocusedNodeChanged" - -/// -/// this message is sent from render process to browser process -/// and is processed in the Qt UI thread -/// -/// -#define kCefViewClientRenderReportJSResultMessage "CefViewClientRender.ReportJSResult" - -/// -/// this message is sent from render process to browser process -/// and is processed in the Qt UI thread -/// -/// format -/// msg.name -/// msg.arg[0]: function name -/// msg.arg[1~...]: function parameters -/// -#define kCefViewClientRenderInvokeMethodMessage "CefViewClientRender.InvokeMethod" - -/// -/// this message is sent from browser process to render process -/// and is processed in the CefRenderer_Main thread -/// -/// format: -/// msg.name: -/// msg.arg[0]: function name -/// msg.arg[1~...]: function parameters -/// -#define kCefViewClientBrowserTriggerEventMessage "CefViewClientBrowser.TriggerEvent" - -/// -/// window.__cefview_report_js_result__(context, result) -/// context must be double -/// -#define kCefViewReportJSResultFunctionName "__cefview_report_js_result__" - -/// -/// -/// -#define kCefViewResourceDirectoryName "resources" - -/// -/// -/// -#define kCefViewLocalesDirectoryName "locales" - -/// -/// -/// -#if defined(OS_WINDOWS) -#define kCefViewDefaultUserAgent "CefView/1.0 (Windows; en-us)" -#elif defined(OS_MACOS) -#define kCefViewDefaultUserAgent "CefView/1.0 (macOS; en-us)" -#elif defined(OS_LINUX) -#define kCefViewDefaultUserAgent "CefView/1.0 (Linux; en-us)" -#else -#define kCefViewDefaultUserAgent "CefView/1.0 (Unknown; en-us)" -#endif - -#endif diff --git a/3rdparty/CefViewCore/lib/libCefViewCore.a b/3rdparty/CefViewCore/lib/libCefViewCore.a deleted file mode 100644 index b22328b..0000000 Binary files a/3rdparty/CefViewCore/lib/libCefViewCore.a and /dev/null differ diff --git a/3rdparty/QCefView/include/CefVersion.h b/3rdparty/QCefView/include/CefVersion.h deleted file mode 100644 index 298eb77..0000000 --- a/3rdparty/QCefView/include/CefVersion.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// CefVersion.h -// CefViewCore -// -// Created by Sheen Tian on 2025/1/19. -// This file was generated during CMake configuring. -// Do not edit this file directly by manual. -// Edit the CefVersion.h.in and then re-config project with CMake. -// - -#ifndef CefVersion_h -#define CefVersion_h -#pragma once - -// clang-format off -#define CEF_VERSION "134.3.5+g36934eb+chromium-134.0.6998.89" -#define CEF_VERSION_MAJOR 134 -#define CEF_VERSION_MINOR 3 -#define CEF_VERSION_PATCH 5 -#define CEF_COMMIT_NUMBER 3154 -#define CEF_COMMIT_HASH "36934ebbc5279631116b9e2b71d8b22acbcd1574" -// clang-format on - -#endif // CefVersion diff --git a/3rdparty/QCefView/include/QCefConfig.h b/3rdparty/QCefView/include/QCefConfig.h deleted file mode 100644 index e3641d8..0000000 --- a/3rdparty/QCefView/include/QCefConfig.h +++ /dev/null @@ -1,320 +0,0 @@ -/* - * File: QCefConfig.h - * Project: QCefView - * Created: 21nd January 2021 - * Author: Sheen - * Source: https://github.com/cefview/qcefview - * Docs: https://cefview.github.io/QCefView/ - */ -#ifndef QCEFCONFIG_H -#define QCEFCONFIG_H -#pragma once -#include - -#pragma region qt_headers -#include -#include -#include -#include -#pragma endregion - -class QCefConfigPrivate; - -/// -/// Represents the CEF setting. For more details please refer to: -/// https://bitbucket.org/chromiumembedded/cef/wiki/GeneralUsage.md#markdown-header-cefsettings -/// -class QCEFVIEW_EXPORT QCefConfig -{ - Q_DECLARE_PRIVATE(QCefConfig) - QScopedPointer d_ptr; - -public: - /// - /// Represents the log severity - /// - enum LogLevel - { - /// Default logging (currently INFO logging) - LOGSEVERITY_DEFAULT, - - /// Verbose logging - LOGSEVERITY_VERBOSE, - - /// DEBUG logging - LOGSEVERITY_DEBUG, - - /// INFO logging - LOGSEVERITY_INFO, - - /// WARNING logging - LOGSEVERITY_WARNING, - - /// ERROR logging - LOGSEVERITY_ERROR, - - /// FATAL logging - LOGSEVERITY_FATAL, - - /// Disable logging to file for all messages, and to stderr for messages with severity less than FATAL - LOGSEVERITY_DISABLE = 99 - }; - -public: - /// - /// Constructs a CEF config instance - /// - QCefConfig(); - - /// - /// Constructs a CEF setting from existing one - /// - QCefConfig(const QCefConfig& other); - - /// - /// Assigns an existing config to current - /// - QCefConfig& operator=(const QCefConfig& other); - - /// - /// Destructs the config - /// - ~QCefConfig(); - - /// - /// Adds a switch to the commandline args used to initialize the CEF - /// - /// The switch name - void addCommandLineSwitch(const QString& smitch); - - /// - /// Adds a switch with value to the commandline args used to initialize the CEF - /// - /// The swtich name - /// The switch value - void addCommandLineSwitchWithValue(const QString& smitch, const QString& v); - - /// - /// Sets the flag to enable/disable OSR mode - /// - /// True to enable OSR mode, false to disable - void setWindowlessRenderingEnabled(const bool enabled); - - /// - /// Gets the OSR mode flag - /// - /// The flag indicates the enable/disable of OSR mode - const QVariant WindowlessRenderingEnabled() const; - -#if !defined(Q_OS_MACOS) - /// - /// Sets the browser subprocess path - /// - /// The path to the sub process executable - void setBrowserSubProcessPath(const QString& path); - - /// - /// Gets the browser subprocess path - /// - const QString browserSubProcessPath() const; - - /// - /// Sets the resource directory path - /// - /// The resource directory path - void setResourceDirectoryPath(const QString& path); - - /// - /// Gets the resource directory path - /// - const QString resourceDirectoryPath() const; - - /// - /// Sets the locales directory path - /// - /// The locales directory path - void setLocalesDirectoryPath(const QString& path); - - /// - /// Gets the locales directory path - /// - const QString localesDirectoryPath() const; -#endif - - /// - /// Sets the log level - /// - /// - void setLogLevel(const LogLevel lvl); - - /// - /// Gets the log level - /// - /// The current log level - const QCefConfig::LogLevel logLevel() const; - - /// - /// Sets the locale - /// - /// The locale to use. If empty the default locale of "en-US" will be used. This value is ignored - /// on Linux where locale is determined using environment variable parsing with the precedence order: LANGUAGE, - /// LC_ALL, LC_MESSAGES and LANG. Also configurable using the "lang" command-line switch. - void setLocale(const QString& locale); - - /// - /// Gets the locale - /// - const QString locale() const; - - /// - /// Sets the user agent - /// - /// The user agent - void setUserAgent(const QString& agent); - - /// - /// Gets the user agent - /// - const QString userAgent() const; - - /// - /// Sets the cache directory path - /// - /// The cache path - void setCachePath(const QString& path); - - /// - /// Gets the cache directory path - /// - const QString cachePath() const; - -#if CEF_VERSION_MAJOR < 115 - /// - /// Sets the user data directory path - /// - /// The user data directory path - void setUserDataPath(const QString& path); - - /// - /// Gets the user data directory path - /// - const QString userDataPath() const; - -#else - - /// - /// Gets the root cache directory path - /// - const QString rootCachePath() const; - - /// - /// Sets the root cache directory path - /// - /// The root cache directory path - void setRootCachePath(const QString& path); -#endif - - /// - /// Sets the bridge object name - /// - /// The bridge object name - /// - /// The bridge object represents a Javascript object which will be inserted - /// into all browser and frames. This object is designated for communicating - /// between Javascript in web content and native context(C/C++) code. - /// This object is set as an property of window object. That means it can be - /// obtained by calling window.bridgeObject in the Javascript code - /// - void setBridgeObjectName(const QString& name); - - /// - /// Gets the bridge object name - /// - const QString bridgeObjectName() const; - - /// - /// Sets the built-in scheme name - /// - /// The scheme name - /// - /// The default value is CefView - /// - void setBuiltinSchemeName(const QString& name); - - /// - /// Gets the built-in scheme object name - /// - const QString builtinSchemeName() const; - - /// - /// Sets the background color of the web page - /// - /// The color to be set - /// - /// This only works if the web page has no background color set. The alpha component value - /// will be adjusted to 0 or 255, it means if you pass a value with alpha value - /// in the range of [1, 255], it will be accepted as 255. The default value is qRgba(255, 255, 255, 255) - /// - void setBackgroundColor(const QColor& color); - - /// - /// Gets the background color - /// - const QVariant backgroundColor() const; - - /// - /// Sets the acceptable language list - /// - /// Comma delimited ordered list of language codes without any whitespace - /// that will be used in the "Accept-Language" HTTP header. - void setAcceptLanguageList(const QString& languages); - - /// - /// Get the acceptable language list - /// - const QString acceptLanguageList() const; - - /// - /// Sets whether to persist session cookie - /// - /// True if to persist session cookie - void setPersistSessionCookies(bool enabled); - - /// - /// Gets whether to persist session cookie - /// - const QVariant persistSessionCookies() const; - -#if CEF_VERSION_MAJOR < 128 - /// - /// Sets whether to persist user preferences - /// - /// True if to persist user preferences - void setPersistUserPreferences(bool enabled); - - /// - /// Gets whether to persist user preferences - /// - const QVariant persistUserPreferences() const; -#endif - - /// - /// Sets the remote debugging port - /// - /// The port to use - /// - /// CEF supports the remote debugging with Dev Tools in Chrome/Edge. - /// if this value is set then you can debug the web application by - /// accessing http://127.0.0.1:port from Chrome/Edge - /// - void setRemoteDebuggingPort(short port); - - /// - /// Gets the remote debugging port - /// - const QVariant remoteDebuggingPort() const; -}; - -Q_DECLARE_METATYPE(QCefConfig); - -#endif diff --git a/3rdparty/QCefView/include/QCefContext.h b/3rdparty/QCefView/include/QCefContext.h deleted file mode 100644 index 8e0d45d..0000000 --- a/3rdparty/QCefView/include/QCefContext.h +++ /dev/null @@ -1,149 +0,0 @@ -/* - * File: QCefContext.h - * Project: QCefView - * Created: 29th March 2016 - * Author: Sheen - * Source: https://github.com/cefview/qcefview - * Docs: https://cefview.github.io/QCefView/ - */ -#ifndef QCEFCONTEXT_H -#define QCEFCONTEXT_H -#pragma once -#include - -#pragma region qt_headers -#include -#include -#pragma endregion - -#include - -class QCefContextPrivate; - -/// -/// Represents the CEF context -/// -class QCEFVIEW_EXPORT QCefContext : public QObject -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QCefContext) - QScopedPointer d_ptr; - - friend class QCefView; - -public: - /// - /// Constructs the CEF context - /// - /// The application - /// The argument count - /// The argument list pointer - /// The instance - QCefContext(QCoreApplication* app, int argc, char** argv, const QCefConfig* config); - - /// - /// Gets the unique default instance - /// - /// The default instance - static QCefContext* instance(); - - /// - /// Destructs the CEF context - /// - ~QCefContext(); - - /// - /// Adds a url mapping item with local web resource directory. This works for all instances - /// created subsequently - /// - /// The path to the local resource directory - /// The url to be mapped to - /// The priority - void addLocalFolderResource(const QString& path, const QString& url, int priority = 0); - - /// - /// Adds a url mapping item with local archive (.zip) file which contains the web resource. This works for all instances created subsequently - /// - /// The path to the local archive file - /// The url to be mapped to - /// The password of the archive - /// The priority - void addArchiveResource(const QString& path, const QString& url, const QString& password = "", int priority = 0); - - /// - /// Adds a cookie to the CEF context, this cookie is accessible from all browsers created with this context - /// - /// The cookie item name - /// The cookie item value - /// The applicable domain name - /// The applicable url - /// True on success; otherwise false - bool addCookie(const QString& name, const QString& value, const QString& domain, const QString& url); - - /// - /// Deletes all cookies from the CEF context - /// - /// True on success; otherwise false - bool deleteAllCookies(); - - /// - /// Adds an entry to the cross-origin access whitelist. For details please refer to: - /// https://github.com/chromiumembedded/cef/blob/605c2bac86415dcec1e2902cdc46dc11c1ad026a/include/cef_origin_whitelist.h#L81C23-L81C23 - /// - /// The source origin - /// The target schema - /// The target domain - /// Whether to allow subdomain or not - /// True on success; otherwise false - bool addCrossOriginWhitelistEntry(const QString& sourceOrigin, - const QString& targetSchema, - const QString& targetDomain, - bool allowTargetSubdomains); - - /// - /// Removes an entry from the cross-origin access whitelist. For details please refer to: - /// https://github.com/chromiumembedded/cef/blob/605c2bac86415dcec1e2902cdc46dc11c1ad026a/include/cef_origin_whitelist.h#L91C12-L91C12 - /// - /// The source origin - /// The target schema - /// The target domain - /// Whether to allow subdomain or not - /// True on success; otherwise false - bool removeCrossOriginWhitelistEntry(const QString& sourceOrigin, - const QString& targetSchema, - const QString& targetDomain, - bool allowTargetSubdomains); - - /// - /// Removes all entries from the cross-origin access whitelist. - /// - bool clearCrossOriginWhitelistEntry(); - - /// - /// Gets the QCefConfig - /// - /// The QCefConfig instance - const QCefConfig* cefConfig() const; - -protected: - /// - /// Initialize the CEF context - /// - /// The instance - /// True on success; otherwise false - bool init(const QCefConfig* config); - - /// - /// Uninitialize the CEF context - /// - void uninit(); - -private: - /// - /// The default instance - /// - static QCefContext* s_self; -}; - -#endif // QCEFCONTEXT_H diff --git a/3rdparty/QCefView/include/QCefDownloadItem.h b/3rdparty/QCefView/include/QCefDownloadItem.h deleted file mode 100644 index c234db4..0000000 --- a/3rdparty/QCefView/include/QCefDownloadItem.h +++ /dev/null @@ -1,177 +0,0 @@ -/* - * File: QCefDownloadItem.h - * Project: QCefView - * Created: 13th July 2022 - * Author: Sheen - * Source: https://github.com/cefview/qcefview - * Docs: https://cefview.github.io/QCefView/ - */ -#ifndef QCEFDOWNLOADITEM_H -#define QCEFDOWNLOADITEM_H -#pragma once -#include - -#pragma region qt_headers -#include -#include -#include -#pragma endregion - -class QCefDownloadItemPrivate; - -/// -/// Represents the download item -/// -class QCEFVIEW_EXPORT QCefDownloadItem -{ - Q_DECLARE_PRIVATE(QCefDownloadItem) - QScopedPointer d_ptr; - - Q_DISABLE_COPY(QCefDownloadItem) - QCefDownloadItem(QCefDownloadItem&&) = delete; - QCefDownloadItem& operator=(QCefDownloadItem&&) = delete; - - friend class QCefView; - - /// - /// Constructs a download item instance - /// - QCefDownloadItem(); - -public: - /// - /// Destructs the download item instance - /// - ~QCefDownloadItem(); - - /// - /// Starts to download the item. - /// - /// The full path name (must include file name) to save the downloaded item - /// Whether to use the default 'Save As...' dialog or not - /// - /// The 'path' parameter only works when 'useDefaultDialog' is set to false. - /// If you set 'useDefaultDialog' to true then you cannot control the initial - /// location of the opened 'Save As...' dialog, it is determined by CEF internal implementation. - /// - void start(const QString& path, bool useDefaultDialog = true) const; - - /// - /// Pauses the download - /// - void pause() const; - - /// - /// Resume the download - /// - void resume() const; - - /// - /// Cancels the download - /// - void cancel() const; - - /// - /// Gets whether the download is started - /// - /// - bool isStarted() const; - - /// - /// Gets whether the download is in progress - /// - /// True if the download is in progress; otherwise false - bool isInProgress() const; - - /// - /// Gets whether the download is complete - /// - /// True if the download is complete; otherwise false - bool isComplete() const; - - /// - /// Gets whether the download has been canceled or interrupted - /// - /// True if the download has been canceled or interrupted; otherwise false - bool isCanceled() const; - - /// - /// Gets current download speed - /// - /// A simple speed estimate in bytes/s - qint64 currentSpeed() const; - - /// - /// Gets the completion percentage - /// - /// The rough percent complete or -1 if the receive total size is unknown - int percentComplete() const; - - /// - /// Gets total number of bytes - /// - /// The total number of bytes - qint64 totalBytes() const; - - /// - /// Gets number of received bytes - /// - /// The number of received bytes - qint64 receivedBytes() const; - - /// - /// Gets the time that the download started - /// - /// The time that the download started - QDateTime startTime() const; - - /// - /// Gets the time that the download ended - /// - /// The time that the download ended - QDateTime endTime() const; - - /// - /// Gets the full path to the downloaded or downloading file - /// - /// The full path to the downloaded or downloading file - QString fullPath() const; - - /// - /// Gets the unique identifier for this download - /// - /// The unique identifier for this download - quint32 id() const; - - /// - /// Gets the URL - /// - /// The the URL - QString url() const; - - /// - /// Gets the original URL before any redirections - /// - /// The original URL before any redirections - QString originalUrl() const; - - /// - /// Gets the suggested file name - /// - /// The suggested file name - QString suggestedFileName() const; - - /// - /// Gets the content disposition - /// - /// The the content disposition - QString contentDisposition() const; - - /// - /// Gets the mime type - /// - /// The mime type - QString mimeType() const; -}; - -#endif /// QCEFDOWNLOADITEM_H diff --git a/3rdparty/QCefView/include/QCefEvent.h b/3rdparty/QCefView/include/QCefEvent.h deleted file mode 100644 index 4f64d0c..0000000 --- a/3rdparty/QCefView/include/QCefEvent.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * File: QCefEvent.h - * Project: QCefView - * Created: 29th March 2016 - * Author: Sheen - * Source: https://github.com/cefview/qcefview - * Docs: https://cefview.github.io/QCefView/ - */ -#ifndef QCEFEVENT_H -#define QCEFEVENT_H -#pragma once -#include - -#pragma region qt_headers -#include -#include -#include -#pragma endregion - -class QCefEventPrivate; - -/// -/// Represents the event sent from native context(C/C++ code) to the web context(javascript) -/// -class QCEFVIEW_EXPORT QCefEvent -{ - Q_DECLARE_PRIVATE(QCefEvent) - QScopedPointer d_ptr; - - friend class QCefView; - -public: - /// - /// Constructs an event instance - /// - QCefEvent(); - - /// - /// Constructs an event instance with name - /// - /// The event name - QCefEvent(const QString& name); - - /// - /// Constructs an event instance from existing one - /// - /// The other event instance - QCefEvent(const QCefEvent& other); - - /// - /// Assigns an existing event instance to current - /// - /// The other event instance - QCefEvent& operator=(const QCefEvent& other); - - /// - /// Destructs the event instance - /// - ~QCefEvent(); - - /// - /// Sets the event name - /// - /// The name to be set - void setEventName(const QString& name); - - /// - /// Gets the event name - /// - /// The event name - const QString eventName() const; - - /// - /// Sets the argument list - /// - /// The argument list - void setArguments(const QVariantList& args); - - /// - /// Gets the argument list - /// - /// The argument list - QVariantList& arguments(); -}; - -Q_DECLARE_METATYPE(QCefEvent); - -#endif // QCEFEVENT_H diff --git a/3rdparty/QCefView/include/QCefQuery.h b/3rdparty/QCefView/include/QCefQuery.h deleted file mode 100644 index b3833cb..0000000 --- a/3rdparty/QCefView/include/QCefQuery.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * File: QCefQuery.h - * Project: QCefView - * Created: 29th March 2016 - * Author: Sheen - * Source: https://github.com/cefview/qcefview - * Docs: https://cefview.github.io/QCefView/ - */ -#ifndef QCEFQUERY_H -#define QCEFQUERY_H -#pragma once -#include - -#pragma region stl_headers -#include -#pragma endregion - -#pragma region qt_headers -#include -#include -#pragma endregion - -class QCefQueryPrivate; -class QCefViewPrivate; - -/// -/// Represents the query request sent from the web content(Javascript) -/// -class QCEFVIEW_EXPORT QCefQuery -{ - Q_DECLARE_PRIVATE(QCefQuery) - QSharedPointer d_ptr; - - friend class QCefViewPrivate; - -protected: - /// - /// Constructs a query instance with request context and query id - /// - /// The source CefView - /// The request context - /// The query id - QCefQuery(QCefViewPrivate* source, const QString& req, const int64_t query); - - /// - /// Marks the query as replied (for internal use only) - /// - void markAsReplied() const; - -public: - /// - /// Constructs a query instance - /// - QCefQuery(); - - /// - /// Destructs a query instance - /// - ~QCefQuery(); - - /// - /// Gets the query content - /// - /// The content string - const QString request() const; - - /// - /// Gets the query id - /// - /// The query id - const qint64 id() const; - - /// - /// Gets the response content string - /// - /// The response content string - const QString response() const; - - /// - /// Gets the response result - /// - /// The respone result - const bool result() const; - - /// - /// Gets the response error - /// - /// The response error - const int error() const; - - /// - /// Sets the response - /// - /// True if the query is successful; otherwise false - /// The response content string - /// The response error - void setResponseResult(bool success, const QString& response, int error = 0) const; - - /// - /// Replies the query - /// - /// The result - /// The response data - /// The error code - void reply(bool success, const QString& response, int error = 0) const; -}; - -Q_DECLARE_METATYPE(QCefQuery); -#endif // QCEFQUERY_H diff --git a/3rdparty/QCefView/include/QCefSetting.h b/3rdparty/QCefView/include/QCefSetting.h deleted file mode 100644 index 0e33ef9..0000000 --- a/3rdparty/QCefView/include/QCefSetting.h +++ /dev/null @@ -1,419 +0,0 @@ -/* - * File: QCefSetting.h - * Project: QCefView - * Created: 29th March 2016 - * Author: Sheen - * Source: https://github.com/cefview/qcefview - * Docs: https://cefview.github.io/QCefView/ - */ -#ifndef QCEFSETTING_H -#define QCEFSETTING_H -#pragma once -#include - -#pragma region qt_headers -#include -#include -#include -#include -#pragma endregion - -class QCefSettingPrivate; - -/// -/// Represents the settings for individual browser -/// -class QCEFVIEW_EXPORT QCefSetting -{ - Q_DECLARE_PRIVATE(QCefSetting) - QScopedPointer d_ptr; - - friend class QCefView; - -public: - /// - /// Constructs the QCefSetting instance - /// - QCefSetting(); - - /// - /// Constructs the QCefSetting instance from existing one - /// - /// The existing QCefSetting instance - QCefSetting(const QCefSetting& other); - - /// - /// Assigns the existing QCefSetting instance to current - /// - /// - QCefSetting& operator=(const QCefSetting& other); - - /// - /// Destructs the instance - /// - ~QCefSetting(); - - /// - /// Sets the initial size of the browser - /// - /// The initial size - void setWindowInitialSize(const QSize& size); - - /// - /// Gets the initial size of the browser - /// - /// - const QSize windowInitialSize() const; - - /// - /// Sets the standard font family - /// - /// The font family - void setStandardFontFamily(const QString& value); - - /// - /// Gets the standard font family - /// - /// The font family - const QString standardFontFamily() const; - - /// - /// Sets the fixed font family - /// - /// The font family - void setFixedFontFamily(const QString& value); - - /// - /// Gets the fixed font family - /// - /// The font family - const QString fixedFontFamily() const; - - /// - /// Sets the serif font family - /// - /// The font family - void setSerifFontFamily(const QString& value); - - /// - /// Gets the serif font family - /// - /// The font family - const QString serifFontFamily() const; - - /// - /// Sets the sans serif font family - /// - /// The font family - void setSansSerifFontFamily(const QString& value); - - /// - /// Gets the sans serif font family - /// - /// The font family - const QString sansSerifFontFamily() const; - - /// - /// Sets the cursive font family - /// - /// The font family - void setCursiveFontFamily(const QString& value); - - /// - /// Gets the cursive font family - /// - /// The font family - const QString cursiveFontFamily() const; - - /// - /// Sets the fantasy font family - /// - /// The font family - void setFantasyFontFamily(const QString& value); - - /// - /// Gets the fantasy font family - /// - /// The font family - const QString fantasyFontFamily() const; - - /// - /// Sets the default encoding - /// - /// The encoding name - void setDefaultEncoding(const QString& value); - - /// - /// Gets the default encoding - /// - /// The encoding name - const QString defaultEncoding() const; - -#if CEF_VERSION_MAJOR < 118 - /// - /// Sets the acceptable language list - /// - /// The acceptable languate list - void setAcceptLanguageList(const QString& value); - - /// - /// Gets the acceptable language list - /// - /// The acceptable languate list - const QString acceptLanguageList() const; -#endif - - /// - /// Sets the frame rate in window less mode - /// - /// The frame rate - void setWindowlessFrameRate(const int value); - - /// - /// Gets the frame rate in window less mode - /// - /// The frame rate - const QVariant windowlessFrameRate() const; - - /// - /// Sets the default font size - /// - /// The font size - void setDefaultFontSize(const int value); - - /// - /// Gets the default font size - /// - /// The font size - const QVariant defaultFontSize() const; - - /// - /// Sets the default fixed font size - /// - /// The font size - void setDefaultFixedFontSize(const int value); - - /// - /// Gets the default fixed font size - /// - /// The font size - const QVariant defaultFixedFontSize() const; - - /// - /// Sets the minimum font size - /// - /// The font size - void setMinimumFontSize(const int value); - - /// - /// Gets the minimum font size - /// - /// The font size - const QVariant minimumFontSize() const; - - /// - /// Sets the minimum logical font size - /// - /// The font size - void setMinimumLogicalFontSize(const int value); - - /// - /// Gets the minimum logical font size - /// - /// The font size - const QVariant minimumLogicalFontSize() const; - - /// - /// Sets to enable or disable remote fonts - /// - /// True to enable; false to disable - void setRemoteFonts(const bool value); - - /// - /// Gets whether to enable or disable the remote fonts - /// - /// True to enable; false to disable - const QVariant remoteFonts() const; - - /// - /// Sets to enable or disable Javascript - /// - /// True to enable; false to disable - void setJavascript(const bool value); - - /// - /// Gets whether to enable or disable Javascript - /// - /// True to enable; false to disable - const QVariant javascript() const; - - /// - /// Sets to enable or disable the permission of closing window from Javascript - /// - /// True to enable; false to disable - void setJavascriptCloseWindows(const bool value); - - /// - /// Gets whether to enable or disable the permission of closing window from Javascript - /// - /// True to enable; false to disable - const QVariant javascriptCloseWindows() const; - - /// - /// Sets to enable or disable the permission of accessing clipboard from Javascript - /// - /// True to enable; false to disable - void setJavascriptAccessClipboard(const bool value); - - /// - /// Gets whether to enable or disable the permission of accessing clipboard from Javascript - /// - /// True to enable; false to disable - const QVariant javascriptAccessClipboard() const; - - /// - /// Sets to enable or disable the permission of pasting DOM in Javascript - /// - /// True to enable; false to disable - void setJavascriptDomPaste(const bool value); - - /// - /// Gets whether to enable or disable the permission of pasting DOM in Javascript - /// - /// True to enable; false to disable - const QVariant javascriptDomPaste() const; - -#if CEF_VERSION_MAJOR < 100 - /// - /// Sets to enable or disable plugins - /// - /// True to enable; false to disable - void setPlugins(const bool value); - - /// - /// Gets whether to enable or disable plugins - /// - /// True to enable; false to disable - const QVariant plugins() const; -#endif - - /// - /// Sets to enable or disable the permission of loading images - /// - /// True to enable; false to disable - void setImageLoading(const bool value); - - /// - /// Gets whether to enable or disable the permission of loading images - /// - /// True to enable; false to disable - const QVariant imageLoading() const; - - /// - /// Sets to enable or disable the shrinking image standalone to fit - /// - /// True to enable; false to disable - void setImageShrinkStandaloneToFit(const bool value); - - /// - /// Gets whether to enable or disable the shrinking image standalone to fit - /// - /// True to enable; false to disable - const QVariant imageShrinkStandaloneToFit() const; - - /// - /// Sets to enable or disable the resizing of text area - /// - /// True to enable; false to disable - void setTextAreaResize(const bool value); - - /// - /// Gets whether to enable or disable the resizing of text area - /// - /// True to enable; false to disable - const QVariant textAreaResize() const; - - /// - /// Sets to enable or disable tab to links - /// - /// True to enable; false to disable - void setTabToLinks(const bool value); - - /// - /// Gets whether to enable or disable tab to links - /// - /// True to enable; false to disable - const QVariant tabToLinks() const; - - /// - /// Sets to enable or disable local storage - /// - /// True to enable; false to disable - void setLocalStorage(const bool value); - - /// - /// Gets whether to enable or disable local storage - /// - /// True to enable; false to disable - const QVariant localStorage() const; - - /// - /// Sets to enable or disable database - /// - /// True to enable; false to disable - void setDatabases(const bool value); - - /// - /// Gets whether to enable or disable database - /// - /// True to enable; false to disable - const QVariant databases() const; - - /// - /// Sets to enable or disable webGL - /// - /// True to enable; false to disable - void setWebGL(const bool value); - - /// - /// Gets whether to enable or disable webGL - /// - /// True to enable; false to disable - const QVariant webGL() const; - - /// - /// Sets the background color - /// - /// The color - /// - /// This only works if the web page has no background color set. The alpha component value - /// will be adjusted to 0 or 255, it means if you pass a value with alpha value - /// in the range of [1, 255], it will be accepted as 255. The default value is inherited from - /// - /// - void setBackgroundColor(const QColor& value); - - /// - /// Gets the background color - /// - /// The color - const QVariant backgroundColor() const; - - #if CEF_VERSION_MAJOR >= 125 - /// - /// - /// - /// - void setHardwareAcceleration(const bool value); - - /// - /// - /// - /// - const bool hardwareAcceleration() const; - #endif -}; - -Q_DECLARE_METATYPE(QCefSetting); - -#endif diff --git a/3rdparty/QCefView/include/QCefView.h b/3rdparty/QCefView/include/QCefView.h deleted file mode 100644 index 3d5ef2f..0000000 --- a/3rdparty/QCefView/include/QCefView.h +++ /dev/null @@ -1,604 +0,0 @@ -/* - * File: QCefView.h - * Project: QCefView - * Created: 29th March 2016 - * Author: Sheen - * Source: https://github.com/cefview/qcefview - * Docs: https://cefview.github.io/QCefView/ - */ -#ifndef QCEFVIEW_H -#define QCEFVIEW_H -#pragma once -#include - -#pragma region qt_headers -#include -#include -#include -#include -#pragma endregion - -#include -#include -#include -#include - -/// -/// Type alias for CEF browser id -/// -#define QCefBrowserId int - -/// -/// Type alias for CEF frame id -/// -#if CEF_VERSION_MAJOR < 122 -#define QCefFrameId qint64 -#else -#define QCefFrameId QString -#endif - -/// -/// Private implementation -/// -class QCefViewPrivate; - -/// -/// Represents the CEF browser view -/// -class QCEFVIEW_EXPORT QCefView : public QWidget -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QCefView) - Q_DISABLE_COPY(QCefView) - QScopedPointer d_ptr; - -public: - /// - /// The main frame identity - /// - static const QCefFrameId MainFrameID; - - /// - /// The identifier for all frames - /// - static const QCefFrameId AllFrameID; - - /// - /// Represents the CEF pop-up windows open disposition - /// - enum CefWindowOpenDisposition - { - CefWindowOpenDispositionUnknown, - CefWindowOpenDispositionCurrentTab, - CefWindowOpenDispositionSingletonTab, - CefWindowOpenDispositionNewForeGroundTab, - CefWindowOpenDispositionNewBackgroundTab, - CefWindowOpenDispositionNewPopup, - CefWindowOpenDispositionNewWindow, - CefWindowOpenDispositionSaveToDisk, - CefWindowOpenDispositionOffTheRecord, - CefWindowOpenDispositionIgnoreAction, - }; - Q_ENUM(CefWindowOpenDisposition) - -public: - /// - /// Constructs a QCefView instance - /// - /// The target url - /// The instance - /// The parent - /// The Qt WindowFlags - QCefView(const QString& url, - const QCefSetting* setting, - QWidget* parent = nullptr, - Qt::WindowFlags f = Qt::WindowFlags()); - - /// - /// Constructs a QCefView instance - /// - /// The parent - /// The Qt WindowFlags - QCefView(QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags()); - - /// - /// Destructs the QCefView instance - /// - ~QCefView(); - - /// - /// Adds a url mapping item with local web resource directory - /// - /// The path to the local resource directory - /// The url to be mapped to - /// The priority - void addLocalFolderResource(const QString& path, const QString& url, int priority = 0); - - /// - /// Adds a url mapping item with local archive (.zip) file which contains the web resource - /// - /// The path to the local archive file - /// The url to be mapped to - /// The password of the archive - /// The priority - void addArchiveResource(const QString& path, const QString& url, const QString& password = "", int priority = 0); - - /// - /// Gets the browser id - /// - /// The browser id - QCefBrowserId browserId(); - - /// - /// Navigates to the content. - /// - /// The content - void navigateToString(const QString& content); - - /// - /// Navigates to the URL - /// - /// The url - void navigateToUrl(const QString& url); - - /// - /// Checks whether the browser can go back - /// - /// True if can; otherwise false - bool browserCanGoBack(); - - /// - /// Checks whether the browser can go forward - /// - /// True if can; otherwise false - bool browserCanGoForward(); - - /// - /// Requires the browser to go back - /// - void browserGoBack(); - - /// - /// Requires the browser to go forward - /// - void browserGoForward(); - - /// - /// Checks whether the browser is loading - /// - /// True if it is loading; otherwise false - bool browserIsLoading(); - - /// - /// Requires the browser to reload - /// - void browserReload(); - - /// - /// Requires the browser to stop load - /// - void browserStopLoad(); - - /// - /// Triggers the event for main frame - /// - /// The instance - /// True on successful; otherwise false - bool triggerEvent(const QCefEvent& event); - - /// - /// Triggers the event for specified frame - /// - /// The instance - /// The frame id - /// True on successful; otherwise false - bool triggerEvent(const QCefEvent& event, const QCefFrameId& frameId); - - /// - /// Broad cast the event for all frames - /// - /// The instance - /// True on successful; otherwise false - bool broadcastEvent(const QCefEvent& event); - - /// - /// Response the request - /// - /// The query instance - /// True on successful; otherwise false - bool responseQCefQuery(const QCefQuery& query); - - /// - /// Executes javascript code in specified frame, this method does not report the result of the javascript. - /// To get the result of the javascript execution use - /// - /// The frame id - /// The javascript code - /// - /// The URL where the script in question can be found, if any. The renderer may request this URL to show the developer - /// the source of the error - /// - /// True on successful; otherwise false - bool executeJavascript(const QCefFrameId& frameId, const QString& code, const QString& url); - - /// - /// Executes javascript code in specified frame and the result will be reported through signal - /// - /// The frame id - /// The javascript code - /// - /// The URL where the script in question can be found, if any. The renderer may request this URL to show the developer - /// the source of the error - /// - /// The context used to identify the one execution - /// True on successful; otherwise false - bool executeJavascriptWithResult(const QCefFrameId& frameId, - const QString& code, - const QString& url, - const QString& context); - - /// - /// Sets the preference for this browser - /// - /// The preference name - /// - /// The preference value, if this value is QVariant::UnknownType or QVariant::Invalid, the - /// preference will be restored to default value - /// - /// The error message populated on failure - /// True on successful; otherwise false - bool setPreference(const QString& name, const QVariant& value, const QString& error); - - /// - /// Sets whether to disable the context menu for popup browser - /// - /// True to disable; otherwise false - void setDisablePopupContextMenu(bool disable); - - /// - /// Gets whether to disable the context menu for popup browser - /// - /// True to disable; otherwise false - bool isPopupContextMenuDisabled(); - - /// - /// Detects whether this browser has a devtools opened - /// - /// True if opend already; otherwise false - bool hasDevTools(); - - /// - /// Opens the devtools dialog - /// - void showDevTools(); - - /// - /// Closes the devtools dialog - /// - void closeDevTools(); - - /// - /// Sets whether to enable drag and drop - /// - /// True to enable; otherwise false - /// - /// This function does not work for OSR mode. There is a problem, when dragging a file to a non dragging area, - /// the content of the file will be displayed. You need to solve the problem yourself. - /// - void setEnableDragAndDrop(bool enable); - - /// - /// Gets whether to enable drag and drop - /// - /// True to enable; otherwise false - bool isDragAndDropEnabled() const; - -signals: - /// - /// Gets called on loading state changed - /// - /// Indicates the browser id - /// Indicates the browser is loading - /// Indicates the browser can go back - /// Indicates the browser can go forward - void loadingStateChanged(const QCefBrowserId& browserId, bool isLoading, bool canGoBack, bool canGoForward); - - /// - /// Gets called on loading starts - /// - /// Indicates the browser id - /// Indicates the frame id - /// Indicates the whether this is the main frame - /// transition type - void loadStart(const QCefBrowserId& browserId, const QCefFrameId& frameId, bool isMainFrame, int transitionType); - - /// - /// Gets called on loading ends - /// - /// Indicates the browser id - /// Indicates the frame id - /// Indicates the whether this is the main frame - /// The HTTP status code - void loadEnd(const QCefBrowserId& browserId, const QCefFrameId& frameId, bool isMainFrame, int httpStatusCode); - - /// - /// Gets called on loading failed due to error - /// - /// Indicates the browser id - /// Indicates the frame id - /// Indicates the whether this is the main frame - /// The error code - /// The error message - /// The url caused the failure - void loadError(const QCefBrowserId& browserId, - const QCefFrameId& frameId, - bool isMainFrame, - int errorCode, - const QString& errorMsg, - const QString& failedUrl); - - /// - /// Gets called on draggable region changed - /// - /// The new draggable region - /// The new non-draggable region - void draggableRegionChanged(const QRegion& draggableRegion, const QRegion& nonDraggableRegion); - - /// - /// Gets called on the address changed - /// - /// The frame id - /// The address - void addressChanged(const QCefFrameId& frameId, const QString& url); - - /// - /// Gets called on title changed - /// - /// The title - void titleChanged(const QString& title); - - /// - /// Gets called on favicon url changed - /// - /// The urls - void faviconURLChanged(const QStringList& urls); - - /// - /// Gets called on fullscreen mode changed - /// - /// The current fullscreen mode - void fullscreenModeChanged(bool fullscreen); - - /// - /// Gets called on status message changed - /// - /// The status message - void statusMessage(const QString& message); - - /// - /// Gets called on console message from the web content - /// - /// The message - /// The level - void consoleMessage(const QString& message, int level); - - /// - /// Gets called on loading progress changed - /// - /// Current progress - void loadingProgressChanged(double progress); - - /// - /// Gets called on built-in scheme URL access - /// - /// The browser id - /// The frame id - /// The full url - void cefUrlRequest(const QCefBrowserId& browserId, const QCefFrameId& frameId, const QString& url); - - /// - /// Gets called on new request - /// - /// The browser id - /// The frame id - /// The query request - void cefQueryRequest(const QCefBrowserId& browserId, const QCefFrameId& frameId, const QCefQuery& query); - - /// - /// Gets called on invoking method request from web content(Javascript) - /// - /// The browser id - /// The frame id - /// The method name - /// The arguments list - void invokeMethod(const QCefBrowserId& browserId, - const QCefFrameId& frameId, - const QString& method, - const QVariantList& arguments); - - /// - /// Gets called on the result of the javascript executed with returned - /// - /// The browser id - /// The frame id - /// The context - /// The result - void reportJavascriptResult(const QCefBrowserId& browserId, - const QCefFrameId& frameId, - const QString& context, - const QVariant& result); - - /// - /// Gets called after the native browser window created. This slot does not work for OSR mode. - /// - /// The native browser windows - void nativeBrowserCreated(QWindow* window); - -protected: - /// - /// Gets called before a new browser created (only for browser created by non-JavaScript) - /// - /// The source frame id - /// The target URL - /// The target name - /// Target window open method - /// Rect to be used for the popup - /// Settings to be used for the popup - /// True to cancel the popup; false to allow - /// - virtual QCefView* onNewBrowser(const QCefFrameId& sourceFrameId, - const QString& url, - const QString& name, - QCefView::CefWindowOpenDisposition targetDisposition, - QRect& rect, - QCefSetting& settings); - - /// - /// Gets called before the popup browser created (only for browser created by JavaScript) - /// - /// The source frame id - /// The target URL - /// The target name - /// Target window open method - /// Rect to be used for the popup - /// Settings to be used for the popup - /// True to cancel the popup; false to allow - virtual bool onNewPopup(const QCefFrameId& frameId, - const QString& targetUrl, - QString& targetFrameName, - QCefView::CefWindowOpenDisposition targetDisposition, - QRect& rect, - QCefSetting& settings, - bool& disableJavascriptAccess); - - /// - /// Gets called on new download item was required. Keep reference to the download item - /// and call method to allow and start the download, - /// Ignore the download item to disallow the download - /// - /// The new download item - /// The new suggested name - virtual void onNewDownloadItem(const QSharedPointer& item, const QString& suggestedName); - - /// - /// Gets called on download item updated. To get this method called method must - /// be called in method - /// - /// The download item - virtual void onUpdateDownloadItem(const QSharedPointer& item); - - /// - /// Gets called on close request from web - /// - /// True to allow the close, false to cancel the close - virtual bool onRequestCloseFromWeb(); - -#pragma region QWidget -public slots: - /// - /// - /// - inline void setFocus() { setFocus(Qt::OtherFocusReason); } - -public: - /// - /// Please refer to QWidget::setFocus - /// - void setFocus(Qt::FocusReason reason); - - /// - /// Please refer to QWidget::inputMethodQuery - /// - QVariant inputMethodQuery(Qt::InputMethodQuery query) const override; - - /// - /// Renders the view content to target painter - /// - /// The target painter - void render(QPainter* painter); - -protected: - /// - /// Please refer to QWidget::paintEngine - /// - QPaintEngine* paintEngine() const override; - - /// - /// Please refer to QWidget::paintEvent - /// - void paintEvent(QPaintEvent* event) override; - - /// - /// Please refer to QWidget::inputMethodEvent - /// - void inputMethodEvent(QInputMethodEvent* event) override; - - /// - /// Please refer to QWidget::showEvent - /// - void showEvent(QShowEvent* event) override; - - /// - /// Please refer to QWidget::hideEvent - /// - void hideEvent(QHideEvent* event) override; - - /// - /// Please refer to QWidget::focusInEvent - /// - void focusInEvent(QFocusEvent* event) override; - - /// - /// Please refer to QWidget::focusOutEvent - /// - void focusOutEvent(QFocusEvent* event) override; - - /// - /// Please refer to QWidget::resizeEvent - /// - void resizeEvent(QResizeEvent* event) override; - - /// - /// Please refer to QWidget::keyPressEvent - /// - void keyPressEvent(QKeyEvent* event) override; - - /// - /// Please refer to QWidget::keyReleaseEvent - /// - void keyReleaseEvent(QKeyEvent* event) override; - - /// - /// Please refer to QWidget::mouseMoveEvent - /// - void mouseMoveEvent(QMouseEvent* event) override; - - /// - /// Please refer to QWidget::mousePressEvent - /// - void mousePressEvent(QMouseEvent* event) override; - - /// - /// Please refer to QWidget::mouseReleaseEvent - /// - void mouseReleaseEvent(QMouseEvent* event) override; - - /// - /// Please refer to QWidget::wheelEvent - /// - void wheelEvent(QWheelEvent* event) override; - - /// - /// Please refer to QWidget::leaveEvent - /// - void leaveEvent(QEvent* event) override; - - /// - /// Please refer to QWidget::contextMenuEvent - /// - void contextMenuEvent(QContextMenuEvent* event) override; -#pragma endregion -}; - -#endif // QCEFVIEW_H diff --git a/3rdparty/QCefView/include/QCefView_global.h b/3rdparty/QCefView/include/QCefView_global.h deleted file mode 100644 index ca97a04..0000000 --- a/3rdparty/QCefView/include/QCefView_global.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * File: QCefView_global.h - * Project: QCefView - * Created: 29th March 2016 - * Author: Sheen - * Source: https://github.com/cefview/qcefview - * Docs: https://cefview.github.io/QCefView/ - */ -#ifndef QCEFEVIEW_GLOBAL_H -#define QCEFEVIEW_GLOBAL_H -#pragma once - -// clang-format off -#pragma region qt_headers -#include -#include -#pragma endregion - -#ifdef QCEFVIEW_STATIC - // Static library, no need export - #define QCEFVIEW_EXPORT -#else - // Dynamic library - #ifdef QCEFVIEW_LIB - // Build QCefView project, export API - #define QCEFVIEW_EXPORT Q_DECL_EXPORT - #else - // Referenced by other project, import API - #define QCEFVIEW_EXPORT Q_DECL_IMPORT - #if _WIN32 - #pragma comment(lib, "QCefView.lib") - #endif - #endif -#endif -// clang-format on - -// CEF version numbers -#include - -#endif // QCEFEVIEW_GLOBAL_H diff --git a/3rdparty/QCefView/lib/libQCefView.a b/3rdparty/QCefView/lib/libQCefView.a deleted file mode 100644 index 516ca08..0000000 Binary files a/3rdparty/QCefView/lib/libQCefView.a and /dev/null differ diff --git a/3rdparty_build/QCefView/CMakeLists.txt b/3rdparty_build/QCefView/CMakeLists.txt deleted file mode 100644 index 978d467..0000000 --- a/3rdparty_build/QCefView/CMakeLists.txt +++ /dev/null @@ -1,241 +0,0 @@ -# -# The main config file for QCefView -# -cmake_minimum_required(VERSION 3.21) -project(QCefView) - -set(CMAKE_FOLDER "QCefView") - -# arguments: -# CEF_SDK_VERSION: -# - specify the CEF version to be used, -# - refer to: cmake\CefViewCoreConfig.cmake -# -# QT_SDK_DIR: -# - specify the Qt SDK path -# - refer to: cmake\QtConfig.cmake -# -SET(QT_SDK_DIR "D:/Dev/Qt/6.8.0/mingw1310_static_x64/lib/cmake") - -#变量缓存清理,获取所有缓存变量列表 -get_cmake_property(cache_vars CACHE_VARIABLES) - -# 遍历变量并删除匹配项 -foreach(var IN LISTS cache_vars) - if(var MATCHES "^BUILD_") - unset(${var} CACHE) - endif() - if(var MATCHES "^STATIC_") - unset(${var} CACHE) - endif() - if(var MATCHES "^USE_") - unset(${var} CACHE) - endif() -endforeach() -# options -option(BUILD_DEMO "Build the demo" OFF) -option(BUILD_STATIC "Build QCefView as static library" ON) -option(STATIC_CRT "Use MultiThreaded linkage for MSVC" OFF) -option(USE_SANDBOX "Enable CEF Sandbox" OFF) -option(USE_WIN_DCOMPOSITION "Enabled Windows direct composition for hardware rendering, _WIN32_WINNT >= 0x602 (Windows 8) is required" ON) -# Only works for Windows & Linux, always enabled on macOS -# If enable then: -# CefSettings.multi_threaded_message_loop = false && CefSettings.external_message_pump = true -# else: -# CefSettings.multi_threaded_message_loop = true && CefSettings.external_message_pump = false -option(USE_QT_EVENT_LOOP "Enable the integration of CEF message loop thread into Qt event loop" ON) - -# append cmake config module path -list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") - -# 指定仅支持 Debug 和 Release 两种配置 -set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE) - -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose build type" FORCE) -endif() - -# Use folders in the resulting project files. -set_property(GLOBAL PROPERTY USE_FOLDERS ON) - -# C standard -set(CMAKE_C_STANDARD_REQUIRED ON) -set(CMAKE_C_STANDARD 11) - -# C++ standard -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_STANDARD 17) - -# 禁用弃用警告 -if(MSVC) - add_definitions(-D_SILENCE_CXX17_RESULT_OF_DEPRECATION_WARNING=1) -elseif(MINGW) - add_compile_options(-Wno-deprecated-declarations) -endif() - -# Determine the project architecture. -if(CMAKE_SIZEOF_VOID_P MATCHES 8) - set(PROJECT_ARCH "x86_64") - else() - set(PROJECT_ARCH "x86") - endif() - -if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") - set(OS_MACOS 1) - set(OS_POSIX 1) - add_definitions( - -DOS_MACOS=1 - -DOS_POSIX=1 - ) - add_compile_options( - #"-g" - "$<$:-O0>" - "$<$:-O3>" - ) - - # Target architecture. - if(PROJECT_ARCH STREQUAL "x86_64") - set(CMAKE_OSX_ARCHITECTURES "x86_64") - elseif(PROJECT_ARCH STREQUAL "arm64") - set(CMAKE_OSX_ARCHITECTURES "arm64") - else() - set(CMAKE_OSX_ARCHITECTURES "i386") - endif() -elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") - set(OS_LINUX 1) - set(OS_POSIX 1) - add_definitions(-DOS_LINUX=1 -DOS_POSIX=1) - add_compile_options( - "-g" - "$<$:-O0>" - "$<$:-O3>" - ) - - if(PROJECT_ARCH STREQUAL "x86_64") - # x86 64-bit architecture. - add_compile_options(-m64 -march=x86-64) - add_link_options(-m64) - elseif(PROJECT_ARCH STREQUAL "x86") - # x86 32-bit architecture. - add_compile_options(-m32) - add_link_options(-m32) - endif() -elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") - if(MSVC) - set(OS_WINDOWS 1) - - # Disable the sandbox on Windows, because the sandbox.lib is MT which is conflict with Qt - set(USE_SANDBOX OFF CACHE BOOL "Disable sandbox on Windows" FORCE) - add_definitions( - -DOS_WINDOWS=1 - -D_WIN32_WINNT=0x0A00 - ) - - if(USE_WIN_DCOMPOSITION) - add_definitions( - -DENABLE_WINDOWS_DIRECT_COMPOSITION=1 - ) - endif() - - add_compile_options( - /W3 - /WX - /M$,T,D>$<$:d> - ) - add_link_options(/DEBUG) - elseif(MINGW) - set(OS_WINDOWS 1) - add_definitions( - -DOS_WINDOWS=1 - -D_WIN32_WINNT=0x0A00 - ) - if(USE_WIN_DCOMPOSITION) - add_definitions( - -DENABLE_WINDOWS_DIRECT_COMPOSITION=1 - ) - endif() - add_definitions( - -DOS_WINDOWS=1 - -D_WIN32_WINNT=0x0A00 - ) - endif() -endif() - -if(BUILD_STATIC) - set(QCEFVIEW_LIB_TYPE STATIC) - add_definitions(-DQCEFVIEW_STATIC=1) -else() - set(QCEFVIEW_LIB_TYPE SHARED) -endif() - -# detect whether we are in sub folder -get_directory_property(QCefView_HAS_PARENT_DIRECTORY PARENT_DIRECTORY) - -if(NOT QCefView_HAS_PARENT_DIRECTORY) - message(STATUS "QCefView is not in subdirectory, put all output together") - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output/$/bin) - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output/$/lib) - if(BUILD_STATIC) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output/$/lib) - else() - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output/$/bin) - endif() -endif() -message(STATUS "QCEFVIEW_RUNTIME_OUTPUT_DIRECTORY: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") -message(STATUS "QCEFVIEW_LIBRARY_OUTPUT_DIRECTORY: ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") -message(STATUS "QCEFVIEW_ARCHIVE_OUTPUT_DIRECTORY: ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}") -# Config the QT package -# ############################################################## -set(QT_SDK_DIR "" CACHE PATH "Qt build toolchain path") -include(QtConfig) -set(Qt_VERSION ${Qt${QT_VERSION_MAJOR}Core_VERSION}) - -# ############################################################## -# thirdparty CefViewCore -add_subdirectory(thirdparty) - -if(OS_MACOS) - # detect minimum deployment target by Qt - if(${Qt_VERSION} VERSION_GREATER_EQUAL 6.5) - set(QT_MIN_DEPLOYMENT_TARGET 11.0) - elseif(${Qt_VERSION} VERSION_GREATER_EQUAL 6.2) - set(QT_MIN_DEPLOYMENT_TARGET 10.14) - elseif(${Qt_VERSION} VERSION_GREATER_EQUAL 5.14) - set(QT_MIN_DEPLOYMENT_TARGET 10.13) - elseif(${Qt_VERSION} VERSION_GREATER_EQUAL 5.13) - set(QT_MIN_DEPLOYMENT_TARGET 10.12) - elseif(${Qt_VERSION} VERSION_GREATER_EQUAL 5.10) - set(QT_MIN_DEPLOYMENT_TARGET 10.11) - else() - set(QT_MIN_DEPLOYMENT_TARGET 10.10) - endif() - - # detect minimum deployment target by CEF - # plese refer to: https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding.md - if(${CEF_VERSION_MAJOR} VERSION_GREATER_EQUAL 117) - set(CEF_MIN_DEPLOYMENT_TARGET 10.15) - elseif(${CEF_VERSION_MAJOR} VERSION_GREATER_EQUAL 104) - set(CEF_MIN_DEPLOYMENT_TARGET 10.13) - else() - set(CEF_MIN_DEPLOYMENT_TARGET 10.11) - endif() - - # use the greater one as the minimum deployment target - if(${QT_MIN_DEPLOYMENT_TARGET} VERSION_LESS ${CEF_MIN_DEPLOYMENT_TARGET}) - set(CMAKE_OSX_DEPLOYMENT_TARGET ${CEF_MIN_DEPLOYMENT_TARGET}) - else() - set(CMAKE_OSX_DEPLOYMENT_TARGET ${QT_MIN_DEPLOYMENT_TARGET}) - endif() -endif() - -# Config QCefView target -# ############################################################## -add_subdirectory(src) - -# Config the Demo project -# ############################################################## -if(BUILD_DEMO) - add_subdirectory(example/QCefViewTest) -endif() - -# ############################################################## diff --git a/3rdparty_build/QCefView/cmake/QtConfig.cmake b/3rdparty_build/QCefView/cmake/QtConfig.cmake deleted file mode 100644 index 754c1be..0000000 --- a/3rdparty_build/QCefView/cmake/QtConfig.cmake +++ /dev/null @@ -1,33 +0,0 @@ -# ################################################################################ -# -# The Qt SDK path -# You can set the environment variable via -# 1. command line -# Windows: SET QTDIR=PATH/TO/QT -# Non-Windows: export QTDIR=PATH/TO/QT -# 2. modifying the value below directly -# - -# Qt build toolchain path not set or doesn't exist -# try to read from environment QTDIR -if(NOT EXISTS ${QT_SDK_DIR}) - message(STATUS "QT_SDK_DIR not found, try to read from environment variable: QTDIR") - set(QT_SDK_DIR "$ENV{QTDIR}" CACHE STRING "QT_SDK_DIR read from environment variable: QTDIR" FORCE) -endif() - -# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!NOTE!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -# You must make sure the target platform and architecture -# of QT binaries math the ones of CEF binaries -# Qt linux-x86 + CEF linux-x86 -# Qt linux-x86_64 + CEF linux-x86_64 -# Qt windows-x86 + CEF windows-x86 -# Qt windows-x86_64 + CEF windows-x86_64 -# Qt macos-x86_64 + CEF macos-x86_64 -# Qt macos-arm64 + CEF macos-arm64 -# - -# find required components -message(STATUS "Qt SDK dir: " ${QT_SDK_DIR}) -set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QT_SDK_DIR}) -find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Gui Widgets REQUIRED) -find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Widgets REQUIRED) \ No newline at end of file diff --git a/3rdparty_build/QCefView/src/CMakeLists.txt b/3rdparty_build/QCefView/src/CMakeLists.txt deleted file mode 100644 index b3f67c9..0000000 --- a/3rdparty_build/QCefView/src/CMakeLists.txt +++ /dev/null @@ -1,253 +0,0 @@ -# ## QCefView -# ############################################################################################### -set(CMAKE_GLOBAL_AUTOGEN_TARGET OFF) -set(CMAKE_AUTOMOC ON) -set(CMAKE_INCLUDE_CURRENT_DIR ON) -find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Gui Widgets REQUIRED) -find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Widgets REQUIRED) - -file(GLOB_RECURSE QCefView_INCLUDE_FILES - "${CMAKE_CURRENT_SOURCE_DIR}/../include/*.h" -) -source_group( - TREE "${CMAKE_CURRENT_SOURCE_DIR}/../include" - PREFIX Include - FILES ${QCefView_INCLUDE_FILES} -) - -file(GLOB QCefView_SRC_FILES - "${CMAKE_CURRENT_SOURCE_DIR}/*.h" - "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" -) -source_group( - TREE ${CMAKE_CURRENT_SOURCE_DIR} - PREFIX Source - FILES ${QCefView_SRC_FILES} -) - -file(GLOB_RECURSE QCefView_details_SRC_FILES - "${CMAKE_CURRENT_SOURCE_DIR}/details/*.h" - "${CMAKE_CURRENT_SOURCE_DIR}/details/*.cpp" -) -source_group( - TREE ${CMAKE_CURRENT_SOURCE_DIR} - PREFIX Source - FILES ${QCefView_details_SRC_FILES} -) - -if(USE_SANDBOX AND(OS_WINDOWS OR OS_MACOS)) - add_definitions(-DCEF_USE_SANDBOX) -endif() - -if(USE_QT_EVENT_LOOP) - add_definitions(-DCEF_USE_QT_EVENT_LOOP) -endif() - -if(OS_WINDOWS) - file(GLOB_RECURSE QCefView_Windows_SRC_FILES - "${CMAKE_CURRENT_SOURCE_DIR}/win/*.h" - "${CMAKE_CURRENT_SOURCE_DIR}/win/*.cpp" - ) - source_group( - TREE "${CMAKE_CURRENT_SOURCE_DIR}/win" - PREFIX Source - FILES ${QCefView_Windows_SRC_FILES} - ) - - add_library(QCefView ${QCEFVIEW_LIB_TYPE} - ${QCefView_INCLUDE_FILES} - ${QCefView_SRC_FILES} - ${QCefView_details_SRC_FILES} - ${QCefView_Windows_SRC_FILES} - ) - - target_compile_definitions(QCefView PRIVATE - UNICODE - _UNICODE - QCEFVIEW_LIB - ) - - target_link_options(QCefView PRIVATE - "/DELAYLOAD:libcef.dll" - ) - - target_link_libraries(QCefView - PRIVATE - d3d11 - d3dcompiler - dcomp - ) - - # add_custom_command(TARGET QCefView - # PRE_BUILD - - # # copy binary files of CefViewCore - # COMMAND ${CMAKE_COMMAND} - # -E copy_directory - # "$" - # "$/CefView" - - # # gnerate a file contains timestamp - # COMMAND ${CMAKE_COMMAND} - # -E echo "/* Auto Build Trigger */" > "${CMAKE_BINARY_DIR}/auto_rebuild.cpp" - # ) -endif() # OS_WINDOWS - -if(OS_LINUX) - find_package(Qt${QT_VERSION_MAJOR}Gui ${QT_MIN_VERSION} CONFIG REQUIRED Private) - - file(GLOB_RECURSE QCefView_Linux_SRC_FILES - "${CMAKE_CURRENT_SOURCE_DIR}/linux/*.h" - "${CMAKE_CURRENT_SOURCE_DIR}/linux/*.cpp" - ) - source_group( - TREE "${CMAKE_CURRENT_SOURCE_DIR}/linux" - PREFIX Source - FILES ${QCefView_Linux_SRC_FILES} - ) - - add_library(QCefView ${QCEFVIEW_LIB_TYPE} - ${QCefView_INCLUDE_FILES} - ${QCefView_SRC_FILES} - ${QCefView_details_SRC_FILES} - ${QCefView_Linux_SRC_FILES} - ) - - target_compile_definitions(QCefView - PRIVATE - QCEFVIEW_LIB - ) - - set_target_properties(${PROJECT_NAME} - PROPERTIES - INSTALL_RPATH "$ORIGIN" - BUILD_WITH_INSTALL_RPATH TRUE - ) - - add_custom_command(TARGET QCefView - PRE_BUILD - - # copy binary files of CefViewCore - COMMAND ${CMAKE_COMMAND} - -E copy_directory - "$" - "$" - ) -endif() # OS_LINUX - -if(OS_MACOS) - file(GLOB_RECURSE QCefView_INCLUDE_HEADERS - "${CMAKE_CURRENT_SOURCE_DIR}/../include/*.h" - ) - source_group( - TREE "${CMAKE_CURRENT_SOURCE_DIR}/../include" - PREFIX Include - FILES ${QCefView_INCLUDE_HEADERS} - ) - - file(GLOB_RECURSE QCefView_macOS_SRC_FILES - "${CMAKE_CURRENT_SOURCE_DIR}/mac/*.h" - "${CMAKE_CURRENT_SOURCE_DIR}/mac/*.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/mac/*.mm" - ) - source_group( - TREE "${CMAKE_CURRENT_SOURCE_DIR}/mac" - PREFIX Source - FILES ${QCefView_macOS_SRC_FILES} - ) - set(QCefView_INFO_PLIST_FILE "${CMAKE_CURRENT_LIST_DIR}/mac/Info.plist") - - add_library(QCefView ${QCEFVIEW_LIB_TYPE} - ${QCefView_INCLUDE_FILES} - ${QCefView_SRC_FILES} - ${QCefView_details_SRC_FILES} - ${QCefView_macOS_SRC_FILES} - ${QCefView_INFO_PLIST_FILE} - ) - - find_library(METAL_FRAMEWORK Metal) - find_library(QUARTZCORE_FRAMEWORK QuartzCore) - target_link_libraries(QCefView - PRIVATE - ${METAL_FRAMEWORK} - ${QUARTZCORE_FRAMEWORK} - ) - - set_target_properties(QCefView - PROPERTIES - FRAMEWORK TRUE - - # compiler settings - COMPILE_FLAGS "-fobjc-arc" - CLANG_ENABLE_OBJC_ARC "YES" - - # xcode settings - PUBLIC_HEADER "${QCefView_INCLUDE_HEADERS}" - MACOSX_FRAMEWORK_INFO_PLIST "${QCefView_INFO_PLIST_FILE}" - XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "com.cefview.qcefview" - XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "gnu++11" # -std=gnu++11 - XCODE_ATTRIBUTE_CLANG_LINK_OBJC_RUNTIME "NO" # -fno-objc-link-runtime - XCODE_ATTRIBUTE_COPY_PHASE_STRIP "NO" - XCODE_ATTRIBUTE_DEAD_CODE_STRIPPING[variant=Release] "YES" # -Wl,-dead_strip - XCODE_ATTRIBUTE_GCC_C_LANGUAGE_STANDARD "c99" # -std=c99 - XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@executable_path/../Frameworks @loader_path/Frameworks" - ) - - add_custom_command(TARGET QCefView - POST_BUILD - - # create plugins directory - COMMAND mkdir -p - "$/Resources/PlugIns/" - - # copy the CefViewCore binaries to resource directory - COMMAND cp -a - "$/../" - "$/Resources/PlugIns/" - - # adjust file permission - COMMAND - cd "$/Resources/PlugIns/Chromium Embedded Framework.framework/Resources" && chmod +rw *.bin - - # sign the cef framework - COMMAND codesign - --force - --sign - - "$/Resources/PlugIns/Chromium Embedded Framework.framework" - ) -endif() # OS_MACOS - -target_compile_definitions(QCefView PRIVATE NOMINMAX) - -target_include_directories(QCefView - PUBLIC - "${CMAKE_CURRENT_SOURCE_DIR}/../include" - PRIVATE - ${CefViewCore_EXPORT_INCLUDE_PATH} -) - -add_dependencies(QCefView - CefViewCore::CefViewCore -) - -target_link_libraries(QCefView - PUBLIC - Qt${QT_VERSION_MAJOR}::Gui - Qt${QT_VERSION_MAJOR}::Core - Qt${QT_VERSION_MAJOR}::Widgets - PRIVATE - CefViewCore::CefViewCore -) - -# install QCefView files -install( - TARGETS QCefView - ARCHIVE DESTINATION "QCefView/lib$<$:/Debug>" - LIBRARY DESTINATION "QCefView/bin$<$:/Debug>" - FRAMEWORK DESTINATION "QCefView/lib$<$:/Debug>" -) - -if(NOT OS_MACOS) - install(DIRECTORY "${CMAKE_SOURCE_DIR}/include" DESTINATION "QCefView") - install(DIRECTORY "$/" DESTINATION "QCefView/bin$<$:/Debug>") -endif() diff --git a/3rdparty_build/QCefView/thirdparty/CMakeLists.txt b/3rdparty_build/QCefView/thirdparty/CMakeLists.txt deleted file mode 100644 index 51bc198..0000000 --- a/3rdparty_build/QCefView/thirdparty/CMakeLists.txt +++ /dev/null @@ -1,272 +0,0 @@ -# ## QCefView -# ############################################################################################### -set(CMAKE_GLOBAL_AUTOGEN_TARGET OFF) -set(CMAKE_AUTOMOC ON) -set(CMAKE_INCLUDE_CURRENT_DIR ON) -find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Gui Widgets REQUIRED) -find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Widgets REQUIRED) - -file(GLOB_RECURSE QCefView_INCLUDE_FILES - "${CMAKE_CURRENT_SOURCE_DIR}/../include/*.h" -) -source_group( - TREE "${CMAKE_CURRENT_SOURCE_DIR}/../include" - PREFIX Include - FILES ${QCefView_INCLUDE_FILES} -) - -file(GLOB QCefView_SRC_FILES - "${CMAKE_CURRENT_SOURCE_DIR}/*.h" - "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" -) -source_group( - TREE ${CMAKE_CURRENT_SOURCE_DIR} - PREFIX Source - FILES ${QCefView_SRC_FILES} -) - -file(GLOB_RECURSE QCefView_details_SRC_FILES - "${CMAKE_CURRENT_SOURCE_DIR}/details/*.h" - "${CMAKE_CURRENT_SOURCE_DIR}/details/*.cpp" -) -source_group( - TREE ${CMAKE_CURRENT_SOURCE_DIR} - PREFIX Source - FILES ${QCefView_details_SRC_FILES} -) - -if(USE_SANDBOX AND(OS_WINDOWS OR OS_MACOS)) - add_definitions(-DCEF_USE_SANDBOX) -endif() - -if(USE_QT_EVENT_LOOP) - add_definitions(-DCEF_USE_QT_EVENT_LOOP) -endif() - -if(OS_WINDOWS) - file(GLOB_RECURSE QCefView_Windows_SRC_FILES - "${CMAKE_CURRENT_SOURCE_DIR}/win/*.h" - "${CMAKE_CURRENT_SOURCE_DIR}/win/*.cpp" - ) - source_group( - TREE "${CMAKE_CURRENT_SOURCE_DIR}/win" - PREFIX Source - FILES ${QCefView_Windows_SRC_FILES} - ) - - add_library(QCefView ${QCEFVIEW_LIB_TYPE} - ${QCefView_INCLUDE_FILES} - ${QCefView_SRC_FILES} - ${QCefView_details_SRC_FILES} - ${QCefView_Windows_SRC_FILES} - ) - - target_compile_definitions(QCefView PRIVATE - UNICODE - _UNICODE - QCEFVIEW_LIB - ) - if(MSVC) - target_link_options(QCefView PRIVATE - "/DELAYLOAD:libcef.dll" - ) - add_custom_command(TARGET QCefView - PRE_BUILD - - # copy binary files of CefViewCore - COMMAND ${CMAKE_COMMAND} - -E copy_directory - "$" - "$/CefView" - - # gnerate a file contains timestamp - COMMAND ${CMAKE_COMMAND} - -E echo "/* Auto Build Trigger */" > "${CMAKE_BINARY_DIR}/auto_rebuild.cpp" - ) - elseif(MINGW) - target_link_options(QCefView PRIVATE - "-Wl,--enable-auto-import" - "-Wl,--as-needed" - "-lcef" - ) - add_custom_command(TARGET QCefView - PRE_BUILD - - # copy binary files of CefViewCore - COMMAND ${CMAKE_COMMAND} - -E copy_directory - "$" - "$/CefView" - - # generate a file contains timestamp - COMMAND ${CMAKE_COMMAND} - -E echo "/* Auto Build Trigger */" > "${CMAKE_BINARY_DIR}/auto_rebuild.cpp" - ) - endif() - - target_link_libraries(QCefView - PRIVATE - d3d11 - d3dcompiler - dcomp - ) -endif() # OS_WINDOWS - -if(OS_LINUX) - find_package(Qt${QT_VERSION_MAJOR}Gui ${QT_MIN_VERSION} CONFIG REQUIRED Private) - - file(GLOB_RECURSE QCefView_Linux_SRC_FILES - "${CMAKE_CURRENT_SOURCE_DIR}/linux/*.h" - "${CMAKE_CURRENT_SOURCE_DIR}/linux/*.cpp" - ) - source_group( - TREE "${CMAKE_CURRENT_SOURCE_DIR}/linux" - PREFIX Source - FILES ${QCefView_Linux_SRC_FILES} - ) - - add_library(QCefView ${QCEFVIEW_LIB_TYPE} - ${QCefView_INCLUDE_FILES} - ${QCefView_SRC_FILES} - ${QCefView_details_SRC_FILES} - ${QCefView_Linux_SRC_FILES} - ) - - target_compile_definitions(QCefView - PRIVATE - QCEFVIEW_LIB - ) - - set_target_properties(${PROJECT_NAME} - PROPERTIES - INSTALL_RPATH "$ORIGIN" - BUILD_WITH_INSTALL_RPATH TRUE - ) - - add_custom_command(TARGET QCefView - PRE_BUILD - - # copy binary files of CefViewCore - COMMAND ${CMAKE_COMMAND} - -E copy_directory - "$" - "$" - ) -endif() # OS_LINUX - -if(OS_MACOS) - file(GLOB_RECURSE QCefView_INCLUDE_HEADERS - "${CMAKE_CURRENT_SOURCE_DIR}/../include/*.h" - ) - source_group( - TREE "${CMAKE_CURRENT_SOURCE_DIR}/../include" - PREFIX Include - FILES ${QCefView_INCLUDE_HEADERS} - ) - - file(GLOB_RECURSE QCefView_macOS_SRC_FILES - "${CMAKE_CURRENT_SOURCE_DIR}/mac/*.h" - "${CMAKE_CURRENT_SOURCE_DIR}/mac/*.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/mac/*.mm" - ) - source_group( - TREE "${CMAKE_CURRENT_SOURCE_DIR}/mac" - PREFIX Source - FILES ${QCefView_macOS_SRC_FILES} - ) - set(QCefView_INFO_PLIST_FILE "${CMAKE_CURRENT_LIST_DIR}/mac/Info.plist") - - add_library(QCefView ${QCEFVIEW_LIB_TYPE} - ${QCefView_INCLUDE_FILES} - ${QCefView_SRC_FILES} - ${QCefView_details_SRC_FILES} - ${QCefView_macOS_SRC_FILES} - ${QCefView_INFO_PLIST_FILE} - ) - - find_library(METAL_FRAMEWORK Metal) - find_library(QUARTZCORE_FRAMEWORK QuartzCore) - target_link_libraries(QCefView - PRIVATE - ${METAL_FRAMEWORK} - ${QUARTZCORE_FRAMEWORK} - ) - - set_target_properties(QCefView - PROPERTIES - FRAMEWORK TRUE - - # compiler settings - COMPILE_FLAGS "-fobjc-arc" - CLANG_ENABLE_OBJC_ARC "YES" - - # xcode settings - PUBLIC_HEADER "${QCefView_INCLUDE_HEADERS}" - MACOSX_FRAMEWORK_INFO_PLIST "${QCefView_INFO_PLIST_FILE}" - XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "com.cefview.qcefview" - XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "gnu++11" # -std=gnu++11 - XCODE_ATTRIBUTE_CLANG_LINK_OBJC_RUNTIME "NO" # -fno-objc-link-runtime - XCODE_ATTRIBUTE_COPY_PHASE_STRIP "NO" - XCODE_ATTRIBUTE_DEAD_CODE_STRIPPING[variant=Release] "YES" # -Wl,-dead_strip - XCODE_ATTRIBUTE_GCC_C_LANGUAGE_STANDARD "c99" # -std=c99 - XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@executable_path/../Frameworks @loader_path/Frameworks" - ) - - add_custom_command(TARGET QCefView - POST_BUILD - - # create plugins directory - COMMAND mkdir -p - "$/Resources/PlugIns/" - - # copy the CefViewCore binaries to resource directory - COMMAND cp -a - "$/../" - "$/Resources/PlugIns/" - - # adjust file permission - COMMAND - cd "$/Resources/PlugIns/Chromium Embedded Framework.framework/Resources" && chmod +rw *.bin - - # sign the cef framework - COMMAND codesign - --force - --sign - - "$/Resources/PlugIns/Chromium Embedded Framework.framework" - ) -endif() # OS_MACOS - -target_compile_definitions(QCefView PRIVATE NOMINMAX) - -target_include_directories(QCefView - PUBLIC - "${CMAKE_CURRENT_SOURCE_DIR}/../include" - PRIVATE - ${CefViewCore_EXPORT_INCLUDE_PATH} -) -message(STATUS "CefViewCore_EXPORT_INCLUDE_PATH: ${CefViewCore_EXPORT_INCLUDE_PATH}") - -add_dependencies(QCefView - CefViewCore::CefViewCore -) - -target_link_libraries(QCefView - PUBLIC - Qt${QT_VERSION_MAJOR}::Gui - Qt${QT_VERSION_MAJOR}::Core - Qt${QT_VERSION_MAJOR}::Widgets - CefViewCore::CefViewCore -) - -# install QCefView files -install( - TARGETS QCefView - ARCHIVE DESTINATION "QCefView/lib$<$:/Debug>" - LIBRARY DESTINATION "QCefView/bin$<$:/Debug>" - FRAMEWORK DESTINATION "QCefView/lib$<$:/Debug>" -) - -if(NOT OS_MACOS) - install(DIRECTORY "${CMAKE_SOURCE_DIR}/include" DESTINATION "QCefView") - install(DIRECTORY "$/" DESTINATION "QCefView/bin$<$:/Debug>") -endif() diff --git a/3rdparty_build/QCefView/默认静态编译注意事项.txt b/3rdparty_build/QCefView/默认静态编译注意事项.txt deleted file mode 100644 index 3000d62..0000000 --- a/3rdparty_build/QCefView/默认静态编译注意事项.txt +++ /dev/null @@ -1,23 +0,0 @@ -使用情况CMakelists.txt -add_definitions(-DQCEFVIEW_STATIC) -#libcef_dll_wrapper -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/libcef_dll_wrapper) -link_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/libcef_dll_wrapper/lib) - -#QCefViewCore -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/CefViewCore/include) -link_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/CefViewCore/lib) - -#QCefView -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/QCefView/include) -link_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/QCefView/lib) - -target_link_libraries(${PROJECT_NAME} PRIVATE - -lQCefView - -lCefViewCore - -lcef_dll_wrapper - -lcef - d3d11 - d3dcompiler - dcomp -) \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index f820215..59ad11b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,13 +77,6 @@ add_definitions(-DCEF_USE_QT_EVENT_LOOP) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/libcef_dll_wrapper) link_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/libcef_dll_wrapper/lib) -#QCefViewCore -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/CefViewCore/include) -link_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/CefViewCore/lib) - -#QCefView -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/QCefView/include) -link_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/QCefView/lib) #查找QT模块 FIND_PACKAGE(Qt6 REQUIRED Core Gui Widgets) @@ -165,8 +158,6 @@ target_link_libraries(${PROJECT_NAME} PRIVATE LaTeX libcmark-gfm_static libcmark-gfm-extensions_static - -lQCefView - -lCefViewCore -lcef_dll_wrapper -lcef d3d11 diff --git a/src/Cef/CefViewWidget.cpp b/src/Cef/CefViewWidget.cpp deleted file mode 100644 index 24d6e30..0000000 --- a/src/Cef/CefViewWidget.cpp +++ /dev/null @@ -1,106 +0,0 @@ -#include "CefViewWidget.h" - -CefViewWidget::CefViewWidget(const QString url, const QCefSetting* setting, QWidget* parent /* = 0*/) - : QCefView(url, setting, parent) -{ - // setStyleSheet("background: blue;"); - - connect(this, &CefViewWidget::draggableRegionChanged, this, &CefViewWidget::onDraggableRegionChanged); - connect(this, &CefViewWidget::nativeBrowserCreated, this, &CefViewWidget::onNativeBrowserWindowCreated); -} - -CefViewWidget::~CefViewWidget() {} - -void -CefViewWidget::onScreenChanged(QScreen* screen) -{ - if (!m_pCefWindow) - return; - - updateMask(); -} - -void -CefViewWidget::onNativeBrowserWindowCreated(QWindow* window) -{ - m_pCefWindow = window; - if (!m_pCefWindow) - return; - - connect(this->window()->windowHandle(), SIGNAL(screenChanged(QScreen*)), this, SLOT(onScreenChanged(QScreen*))); - - updateMask(); -} - -void -CefViewWidget::onDraggableRegionChanged(const QRegion& draggableRegion, const QRegion& nonDraggableRegion) -{ - m_draggableRegion = draggableRegion; - m_nonDraggableRegion = nonDraggableRegion; -} - -bool -CefViewWidget::onNewPopup(const QCefFrameId& sourceFrameId, - const QString& targetUrl, - QString& targetFrameName, - QCefView::CefWindowOpenDisposition targetDisposition, - QRect& rect, - QCefSetting& settings, - bool& disableJavascriptAccess) -{ - // create new QCefView as popup browser - // settings.setBackgroundColor(Qt::red); - return false; -} - -void -CefViewWidget::onNewDownloadItem(const QSharedPointer& item, const QString& suggestedName) -{ - // keep the item into list or map, and call item->start() to allow the download - - DownloadManager::getInstance().AddNewDownloadItem(item); -} - -void -CefViewWidget::onUpdateDownloadItem(const QSharedPointer& item) -{ - - // control the download by invoking item->pause(), item->resume(), item->cancel() - - DownloadManager::getInstance().UpdateDownloadItem(item); -} - -void -CefViewWidget::resizeEvent(QResizeEvent* event) -{ - // update mask first, because the new mask will be - // used in the QCefView::resizeEvent - updateMask(); - - QCefView::resizeEvent(event); -} - -void -CefViewWidget::mousePressEvent(QMouseEvent* event) -{ - QCefView::mousePressEvent(event); - if (event->buttons().testFlag(Qt::LeftButton) && m_draggableRegion.contains(event->pos())) { - HWND hWnd = ::GetAncestor((HWND)(window()->windowHandle()->winId()), GA_ROOT); - POINT pt; - ::GetCursorPos(&pt); - ::ReleaseCapture(); - ::SendMessage(hWnd, WM_NCLBUTTONDOWN, HTCAPTION, POINTTOPOINTS(pt)); - } -} - -void -CefViewWidget::updateMask() -{ - // create a rect with rounded corner (50px radius) as mask - QPainterPath path; - path.addRoundedRect(rect(), 0, 0); - QRegion mask = QRegion(path.toFillPolygon().toPolygon()); - - // apply the mask - setMask(mask); -} diff --git a/src/Cef/CefViewWidget.h b/src/Cef/CefViewWidget.h deleted file mode 100644 index 04f321a..0000000 --- a/src/Cef/CefViewWidget.h +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef CUSTOMCEFVIEW_H -#define CUSTOMCEFVIEW_H - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include "DownloadManager.h" -/// -/// Represents the customized QCefView -/// -class CefViewWidget : public QCefView -{ - Q_OBJECT - -public: - CefViewWidget(const QString url, const QCefSetting* setting, QWidget* parent = 0); - - ~CefViewWidget(); - -protected slots: - void onScreenChanged(QScreen* screen); - - void onNativeBrowserWindowCreated(QWindow* window); - - void onDraggableRegionChanged(const QRegion& draggableRegion, const QRegion& nonDraggableRegion); - -protected: - bool onNewPopup(const QCefFrameId& sourceFrameId, - const QString& targetUrl, - QString& targetFrameName, - QCefView::CefWindowOpenDisposition targetDisposition, - QRect& rect, - QCefSetting& settings, - bool& disableJavascriptAccess) override; - - void onNewDownloadItem(const QSharedPointer& item, const QString& suggestedName) override; - - void onUpdateDownloadItem(const QSharedPointer& item) override; - -protected: - void resizeEvent(QResizeEvent* event) override; - - void mousePressEvent(QMouseEvent* event) override; - -private: - void updateMask(); - -private: - QWindow* m_pCefWindow = nullptr; - - int m_iCornerRadius = 50; - - QRegion m_draggableRegion; - - QRegion m_nonDraggableRegion; -}; - -#endif // CUSTOMCEFVIEW_H diff --git a/src/Cef/CefWidget.cpp b/src/Cef/CefWidget.cpp deleted file mode 100644 index 6974d3e..0000000 --- a/src/Cef/CefWidget.cpp +++ /dev/null @@ -1,214 +0,0 @@ -#include "CefWidget.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -CefWidget::CefWidget(QWidget *parent) - : QWidget(parent /*, Qt::FramelessWindowHint*/) -{ - m_Layout = new QVBoxLayout; - m_OptionsLayout = new QHBoxLayout; - m_BrowserLayout = new QHBoxLayout; - m_NewBrowser = new QPushButton(tr("New Browser")); - m_ExitAllBrowser = new QPushButton(tr("Exit ALL Browser")); - m_DevTools = new QPushButton(tr("DevTools")); - m_CallJSCode = new QPushButton(tr("Call JS Code")); - m_SetFocus = new QPushButton(tr("Set Focus")); - m_BtnToUrl = new QPushButton(tr("To Url")); - m_TextToUrl = new QLineEdit(); - m_TextToUrl->setPlaceholderText(tr("输入前往url地址")); - - m_OptionsLayout->addWidget(m_NewBrowser); - m_OptionsLayout->addWidget(m_TextToUrl); - m_OptionsLayout->addWidget(m_BtnToUrl); - m_OptionsLayout->addWidget(m_SetFocus); - m_OptionsLayout->addWidget(m_CallJSCode); - m_OptionsLayout->addWidget(m_DevTools); - m_OptionsLayout->addWidget(m_ExitAllBrowser); - m_OptionsLayout->setStretch(1,7); - m_Layout->addLayout(m_OptionsLayout); - m_Layout->addLayout(m_BrowserLayout); - m_Layout->setStretch(0,2); - m_Layout->setStretch(1,8); - setLayout(m_Layout); - connect(m_BtnToUrl, &QPushButton::clicked, this, &CefWidget::onBtnToUrl); - connect(m_DevTools, &QPushButton::clicked, this, &CefWidget::onBtnShowDevToolsClicked); - connect(m_SetFocus, &QPushButton::clicked, this, &CefWidget::onBtnSetFocusClicked); - connect(m_CallJSCode, &QPushButton::clicked, this, &CefWidget::onBtnCallJSCodeClicked); - connect(m_NewBrowser, &QPushButton::clicked, this, &CefWidget::onBtnNewBrowserClicked); - connect(m_ExitAllBrowser, &QPushButton::clicked, qApp, &QCoreApplication::quit); - setMinimumSize(1000, 800); - initBrowser(); -} - -CefWidget::~CefWidget() {} - -void CefWidget::initBrowser() -{ - if (m_CefWidget) - { - m_CefWidget->deleteLater(); - m_CefWidget = nullptr; - } - setting.setHardwareAcceleration(true); - m_CefWidget = new CefViewWidget("https://www.bilibili.com/", &setting, this); - connect(m_CefWidget, &QCefView::invokeMethod, this, &CefWidget::onInvokeMethod); - connect(m_CefWidget, &QCefView::cefUrlRequest, this, &CefWidget::onQCefUrlRequest); - connect(m_CefWidget, &QCefView::cefQueryRequest, this, &CefWidget::onQCefQueryRequest); - connect(m_CefWidget, &QCefView::reportJavascriptResult, this, &CefWidget::onJavascriptResult); - connect(m_CefWidget, &QCefView::loadStart, this, &CefWidget::onLoadStart); - connect(m_CefWidget, &QCefView::loadEnd, this, &CefWidget::onLoadEnd); - connect(m_CefWidget, &QCefView::loadError, this, &CefWidget::onLoadError); - m_BrowserLayout->addWidget(m_CefWidget); -} -void CefWidget::onBtnToUrl() -{ - - if (!m_TextToUrl->text().isEmpty()) - { - m_CefWidget->navigateToUrl(m_TextToUrl->text()); - } -} - -void CefWidget::onInvokeMethod(const QCefBrowserId &browserId, - const QCefFrameId &frameId, - const QString &method, - const QVariantList &arguments) -{ - // extract the arguments and dispatch the invocation to corresponding handler - if (0 == method.compare("TestMethod")) - { - QString title("QCef InvokeMethod Notify"); - QString text = QString("================== Current Thread: QT_UI ==================\r\n" - "Frame: %1\r\n" - "Method: %2\r\n" - "Arguments:\r\n") - .arg(frameId) - .arg(method); - - for (int i = 0; i < arguments.size(); i++) - { - auto jv = QJsonValue::fromVariant(arguments[i]); - - // clang-format off - text.append( - QString("%1 Type:%2, Value:%3\r\n") - .arg(i).arg(arguments[i].typeName()).arg(arguments[i].toString()) - ); - // clang-format on - } - - auto jsonValue = QJsonDocument::fromVariant(arguments); - auto jsonString = QString(jsonValue.toJson()); - text.append(QString("\r\nArguments List in JSON format:\r\n%1").arg(jsonString)); - - QMessageBox::information(this->window(), title, text); - } - else - { - } -} - -void CefWidget::onQCefUrlRequest(const QCefBrowserId &browserId, const QCefFrameId &frameId, const QString &url) -{ - QString title("QCef URL Request"); - QString text = QString("Current Thread: QT_UI\r\n" - "URL: %1") - .arg(url); - - QMessageBox::information(this->window(), title, text); -} - -void CefWidget::onQCefQueryRequest(const QCefBrowserId &browserId, const QCefFrameId &frameId, const QCefQuery &query) -{ - QString title("QCef Query Request"); - QString text = QString("Current Thread: QT_UI\r\n" - "Query: %1") - .arg(query.request()); - - QMessageBox::information(this->window(), title, text); - - QString response = query.request().toUpper(); - query.setResponseResult(true, response); - m_CefWidget->responseQCefQuery(query); -} - -void CefWidget::onJavascriptResult(const QCefBrowserId &browserId, - const QCefFrameId &frameId, - const QString &context, - const QVariant &result) -{ - auto jsonValue = QJsonDocument::fromVariant(result); - auto jsonString = QString(jsonValue.toJson()); - - QString title("Javascript result notification"); - QString text = QString("Context: %1\r\nResult in JSON format:\r\n%2").arg(context).arg(jsonString); - - QMessageBox::information(this->window(), title, text); -} - -void CefWidget::onLoadingStateChanged(const QCefBrowserId &browserId, bool isLoading, bool canGoBack, bool canGoForward) -{ - qDebug() << "onLoadingStateChanged, browserId:" << browserId << ", isLoading:" << isLoading - << ", canGoBack:" << canGoBack << ", canGoForward:" << canGoForward; -} - -void CefWidget::onLoadStart(const QCefBrowserId &browserId, - const QCefFrameId &frameId, - bool isMainFrame, - int transitionType) -{ - qDebug() << "onLoadStart, browserId:" << browserId << ", frameId:" << frameId << ", isMainFrame:" << isMainFrame - << ", transitionType:" << transitionType; -} - -void CefWidget::onLoadEnd(const QCefBrowserId &browserId, const QCefFrameId &frameId, bool isMainFrame, int httpStatusCode) -{ - qDebug() << "onLoadEnd, browserId:" << browserId << ", frameId:" << frameId << ", isMainFrame:" << isMainFrame - << ", httpStatusCode:" << httpStatusCode; -} - -void CefWidget::onLoadError(const QCefBrowserId &browserId, - const QCefFrameId &frameId, - bool isMainFrame, - int errorCode, - const QString &errorMsg, - const QString &failedUrl) -{ - qDebug() << "onLoadError, browserId:" << browserId << ", frameId:" << frameId << ", isMainFrame:" << isMainFrame - << ", errorCode:" << errorCode; -} - -void CefWidget::onBtnShowDevToolsClicked() -{ - if (m_CefWidget) - { - m_CefWidget->showDevTools(); - } -} - -void CefWidget::onBtnCallJSCodeClicked() -{ - QString context = "helloQCefView"; - QString code = "alert('hello QCefView'); return {k1: 'str', k2: true, k3: 100};"; - m_CefWidget->executeJavascriptWithResult(QCefView::MainFrameID, code, "", context); -} - -void CefWidget::onBtnSetFocusClicked() -{ - if (m_CefWidget) - { - m_CefWidget->setFocus(); - } -} -void CefWidget::onBtnNewBrowserClicked() -{ -} \ No newline at end of file diff --git a/src/Cef/CefWidget.h b/src/Cef/CefWidget.h deleted file mode 100644 index 3f289e5..0000000 --- a/src/Cef/CefWidget.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef CEFWIDGET_H -#define CEFWIDGET_H - -#include -#include -#include -#include -#include -#include -#include "CefViewWidget.h" - -class CefWidget : public QWidget -{ - Q_OBJECT - -public: - CefWidget(QWidget* parent = 0); - ~CefWidget(); -private: - void initBrowser(); -private: - QVBoxLayout* m_Layout={}; - QHBoxLayout* m_OptionsLayout={}; - QHBoxLayout* m_BrowserLayout={}; - QPushButton* m_NewBrowser={}; - QPushButton* m_ExitAllBrowser={}; - QPushButton* m_DevTools={}; - QPushButton* m_CallJSCode={}; - QPushButton* m_SetFocus={}; - QLineEdit* m_TextToUrl={}; - QPushButton* m_BtnToUrl={}; - QCefView* m_CefWidget ={}; - QCefSetting setting; - -protected: - void createLeftCefView(); -// QCefView slots -protected slots: - void onInvokeMethod(const QCefBrowserId& browserId, - const QCefFrameId& frameId, - const QString& method, - const QVariantList& arguments); - void onQCefUrlRequest(const QCefBrowserId& browserId, const QCefFrameId& frameId, const QString& url); - void onQCefQueryRequest(const QCefBrowserId& browserId, const QCefFrameId& frameId, const QCefQuery& query); - void onJavascriptResult(const QCefBrowserId& browserId, - const QCefFrameId& frameId, - const QString& context, - const QVariant& result); - void onLoadingStateChanged(const QCefBrowserId& browserId, bool isLoading, bool canGoBack, bool canGoForward); - void onLoadStart(const QCefBrowserId& browserId, const QCefFrameId& frameId, bool isMainFrame, int transitionType); - void onLoadEnd(const QCefBrowserId& browserId, const QCefFrameId& frameId, bool isMainFrame, int httpStatusCode); - void onLoadError(const QCefBrowserId& browserId, - const QCefFrameId& frameId, - bool isMainFrame, - int errorCode, - const QString& errorMsg, - const QString& failedUrl); - -//ui slots -protected slots: - void onBtnShowDevToolsClicked(); - void onBtnSetFocusClicked(); - void onBtnCallJSCodeClicked(); - void onBtnNewBrowserClicked(); - - void onBtnToUrl(); -}; - -#endif // QCEFVIEWTEST_H diff --git a/src/Cef/DownloadManager.cpp b/src/Cef/DownloadManager.cpp deleted file mode 100644 index 38ada2a..0000000 --- a/src/Cef/DownloadManager.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#include "DownloadManager.h" - -#include - -DownloadManager& -DownloadManager::getInstance() -{ - static DownloadManager s_instance; - return s_instance; -} - -void -DownloadManager::AddNewDownloadItem(const QSharedPointer& item) -{ - qDebug() << "DownloadManager::AddNewDownloadItem:" - << " id: " << item->id() << "\n" - << " name: " << item->suggestedFileName() << "\n" - << " path: " << item->fullPath() << "\n" - << " percent: " << item->percentComplete() << "%, " << item->totalBytes() << "/" << item->receivedBytes() - << "\n" - << " canceled: " << item->isCanceled() << "\n" - << " complete: " << item->isComplete(); - - m_mapDownloadingItem[item->id()] = item; - item->start("", true); -} - -void -DownloadManager::UpdateDownloadItem(const QSharedPointer& item) -{ - qDebug() << "DownloadManager::UpdateDownloadItem:" - << " id: " << item->id() << "\n" - << " name: " << item->suggestedFileName() << "\n" - << " path: " << item->fullPath() << "\n" - << " percent: " << item->percentComplete() << "%, " << item->totalBytes() << "/" << item->receivedBytes() - << "\n" - << " canceled: " << item->isCanceled() << "\n" - << " complete: " << item->isComplete(); - - if (item->isCanceled() || item->isComplete()) - m_mapDownloadingItem.remove(item->id()); -} - -DownloadManager::DownloadManager() {} - -DownloadManager::~DownloadManager() -{ - for (auto& item : m_mapDownloadingItem) { - item->cancel(); - } - m_mapDownloadingItem.clear(); -} diff --git a/src/Cef/DownloadManager.h b/src/Cef/DownloadManager.h deleted file mode 100644 index e21c76d..0000000 --- a/src/Cef/DownloadManager.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef DOWNLOADMANAGER_H -#define DOWNLOADMANAGER_H -#pragma once - -#include -#include - -#include - -class DownloadManager -{ -public: - static DownloadManager& getInstance(); - - void AddNewDownloadItem(const QSharedPointer& item); - - void UpdateDownloadItem(const QSharedPointer& item); - -private: - DownloadManager(); - ~DownloadManager(); - - QMap> m_mapDownloadingItem; -}; - -#endif diff --git a/src/compatibility.manifest b/src/compatibility.manifest deleted file mode 100644 index 755c272..0000000 --- a/src/compatibility.manifest +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/src/ctai.exe.manifest b/src/ctai.exe.manifest deleted file mode 100644 index d36f084..0000000 --- a/src/ctai.exe.manifest +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/src/main.cpp b/src/main.cpp index 44366dc..ef61492 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4,41 +4,10 @@ #include "sui_base_ex.h" #include "ctai.h" #include -#include -#include "cef/CefWidget.h" int main(int argc, char *argv[]) { - QString exeDir = QDir::currentPath(); - QApplication a(argc, argv); - QCefConfig config; - config.setUserAgent("QCefViewTest"); - config.setLogLevel(QCefConfig::LOGSEVERITY_VERBOSE); - config.setBridgeObjectName("CallBridge"); - config.setBuiltinSchemeName("CefView"); - config.setWindowlessRenderingEnabled(true); - config.addCommandLineSwitch("single-process"); - config.addCommandLineSwitch("use-alloy-style"); - config.addCommandLineSwitch("off-screen-rendering-enabled"); - config.addCommandLineSwitch("multi-threaded-message-loop"); - config.addCommandLineSwitch("external-message-pump"); - config.addCommandLineSwitch("enable-chrome-runtime"); - config.addCommandLineSwitch("enable-gpu"); - config.addCommandLineSwitch("use-views"); - config.addCommandLineSwitch("site-per-process"); - config.addCommandLineSwitch("no-sandbox"); - config.addCommandLineSwitch("in-process-gpu"); - config.addCommandLineSwitch("use-mock-keychain"); - config.addCommandLineSwitchWithValue("ignore-certificate-errors","true"); - config.addCommandLineSwitchWithValue("enable-gpu-rasterizatio","true"); - config.addCommandLineSwitchWithValue("enable-accelerated-video","true"); - config.addCommandLineSwitchWithValue("use-fake-ui-for-media-stream","true"); - config.addCommandLineSwitchWithValue("use-fake-device-for-media-stream","true"); - config.addCommandLineSwitchWithValue("renderer-process-limit", "1"); - config.addCommandLineSwitchWithValue("disable-features", "BlinkGenPropertyTrees,TranslateUI,site-per-process"); - QCefContext cefContext(&a, argc, argv, &config); - CefWidget cw; - cw.show(); + QApplication a(argc, argv); qputenv("QT_QPA_PLATFORM", "windows:fontengine=freetype"); // 加载语言包 QTranslator qtBaseTranslator; diff --git a/src/sui.h b/src/sui.h index 4ef515f..87c43a2 100644 --- a/src/sui.h +++ b/src/sui.h @@ -2,7 +2,6 @@ #define SUI_H #include "sui_title.h" - typedef enum { UP=0, DOWN=1,