diff --git a/.gitignore b/.gitignore index 57d9462..e39ccbc 100644 --- a/.gitignore +++ b/.gitignore @@ -51,6 +51,9 @@ web_modules/ # Optional npm cache directory .npm +# Optional npm lock file +*-lock.json + # Optional eslint cache .eslintcache diff --git a/CHANGES.txt b/CHANGES.txt new file mode 100644 index 0000000..e61e813 --- /dev/null +++ b/CHANGES.txt @@ -0,0 +1,6 @@ +Version 1.1.0: +* Added App Configuration (Configuration.json) - You can dynamically customize the [File] menu +* Fixed ShowHome() - Rebuilding the WebView gadget is no longer required + +Version 1.0.0: +Initial Version diff --git a/Configuration.json b/Configuration.json new file mode 100644 index 0000000..3f30fcf --- /dev/null +++ b/Configuration.json @@ -0,0 +1,20 @@ +{ + "Menus": [ + { + "OpenIn": "browser", + "Url" : "https://www.tugi.ch", + "Title" : "My Website" + }, + { + "OpenIn": "process", + "Url" : "ms-quick-assist://", + "Title" : "Start Quick Assist" + }, + { + "OpenIn": "process", + "Url" : "https://download.teamviewer.com/download/TeamViewerQS_x64.exe", + "Title" : "Start TeamViewer Quick Assist" + } + ], + "Version" : "1.1.0" +} diff --git a/Forms/MainWindow.pbf b/Forms/MainWindow.pbf index 825b34b..844800d 100644 --- a/Forms/MainWindow.pbf +++ b/Forms/MainWindow.pbf @@ -11,31 +11,12 @@ Global MainWindow Global WebView_Index -Enumeration FormMenu - #MenuItem_StartQuickAssist - #MenuItem_StartTeamViewerQS - #MenuItem_QuitApplication - #MenuItem_Home -EndEnumeration - Declare ResizeGadgetsMainWindow() -Declare QuitApplication(Event) -Declare WebView_Home(Event) -Declare StartTeamViewerQS(Event) -Declare StartQuickAssist(Event) Procedure OpenMainWindow(x = 0, y = 0, width = 1400, height = 950) MainWindow = OpenWindow(#PB_Any, x, y, width, height, "Supportcenter", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_ScreenCentered) SetWindowColor(MainWindow, RGB(255,255,255)) - CreateMenu(0, WindowID(MainWindow)) - MenuTitle("File") - MenuItem(#MenuItem_StartQuickAssist, "Start Quick Assist") - MenuItem(#MenuItem_StartTeamViewerQS, "Start TeamViewer QuickAssist") - MenuBar() - MenuItem(#MenuItem_QuitApplication, "Quit") - MenuTitle("Browse") - MenuItem(#MenuItem_Home, "Home") WebView_Index = WebViewGadget(#PB_Any, 0, 0, 1400, 928) EndProcedure @@ -43,7 +24,7 @@ Procedure ResizeGadgetsMainWindow() Protected FormWindowWidth, FormWindowHeight FormWindowWidth = WindowWidth(MainWindow) FormWindowHeight = WindowHeight(MainWindow) - ResizeGadget(WebView_Index, 0, 0, FormWindowWidth - 0, FormWindowHeight - MenuHeight() - 0) + ResizeGadget(WebView_Index, 0, 0, FormWindowWidth - 0, FormWindowHeight - 22) EndProcedure Procedure MainWindow_Events(event) @@ -55,14 +36,6 @@ Procedure MainWindow_Events(event) Case #PB_Event_Menu Select EventMenu() - Case #MenuItem_StartQuickAssist - StartQuickAssist(EventMenu()) - Case #MenuItem_StartTeamViewerQS - StartTeamViewerQS(EventMenu()) - Case #MenuItem_QuitApplication - QuitApplication(EventMenu()) - Case #MenuItem_Home - WebView_Home(EventMenu()) EndSelect Case #PB_Event_Gadget diff --git a/Installer/Supportcenter.aip b/Installer/Supportcenter.aip index 57dec27..c0caf8b 100644 --- a/Installer/Supportcenter.aip +++ b/Installer/Supportcenter.aip @@ -11,10 +11,10 @@ - + - + @@ -67,6 +67,7 @@ + diff --git a/Supportcenter.exe b/Supportcenter.exe index 3b7d0e0..60943fd 100644 Binary files a/Supportcenter.exe and b/Supportcenter.exe differ diff --git a/Supportcenter.pb b/Supportcenter.pb index 88a6f3f..3799f95 100644 --- a/Supportcenter.pb +++ b/Supportcenter.pb @@ -11,11 +11,28 @@ EnableExplicit UsePNGImageDecoder() ;------------------------------------------------------------------------------------ -;- Variables, Enumerations and Maps +;- Structures +;------------------------------------------------------------------------------------ +Structure Menu + OpenIn.s + Url.s + Title.s +EndStructure + +Structure Configuration + List Menus.Menu() +EndStructure + +;------------------------------------------------------------------------------------ +;- Variables, Enumerations, Lists and Maps ;------------------------------------------------------------------------------------ Global Event = #Null, Quit = #False +Global Customization.Configuration +#JSON_Parser = 0 + +; Files Global IndexFile.s = "file://" + GetCurrentDirectory() + "Web/src/index.html" -Global TeamViewerQuickSupport.s = "https://download.teamviewer.com/download/TeamViewerQS_x64.exe" +Global ConfigurationFile.s = GetCurrentDirectory() + "Configuration.json" ;------------------------------------------------------------------------------------ ;- Forms @@ -31,35 +48,81 @@ Procedure ShowMainWindow() BindEvent(#PB_Event_SizeWindow, @ResizeGadgetsMainWindow(), MainWindow) EndProcedure -Procedure ShowHome() - SetGadgetText(WebView_Index, IndexFile) +Procedure LoadConfiguration() + If LoadJSON(#JSON_Parser, ConfigurationFile) + ;Debug "JSON object data from file:" + ;Debug ComposeJSON(#JSON_Parser, #PB_JSON_PrettyPrint) + ExtractJSONStructure(JSONValue(#JSON_Parser), Customization, Configuration) + FreeJSON(#JSON_Parser) + Else + Debug "Can't read the configuration or the file is empty: " + ConfigurationFile + EndIf EndProcedure -Procedure WebView_Home(EventType) - Debug "Inject JavaScript in WebView..." - FreeGadget(WebView_Index) - WebView_Index = WebViewGadget(#PB_Any, 0, 0, WindowWidth(MainWindow), WindowHeight(MainWindow)-3, #PB_WebView_Debug) - ShowHome() +Procedure WebView_Home() + Debug "WebView: Show Local File: " + IndexFile + If IsGadget(WebView_Index) : SetGadgetText(WebView_Index, IndexFile) : EndIf EndProcedure -Procedure StartQuickAssist(EventType) - Debug "Starting Microsoft Quick Assist by Protocol..." - RunProgram("ms-quick-assist://") +Procedure Menu_Quit() + End EndProcedure -Procedure StartTeamViewerQS(EventType) - RunProgram(TeamViewerQuickSupport) +Procedure Menu_EventHandler() + Protected Entry = EventGadget(), i = 1 + Protected OpenIn.s, Url.s + + ForEach Customization\Menus() + If Entry = i + OpenIn = Customization\Menus()\OpenIn + Url = Customization\Menus()\Url + EndIf + + ; Counter + i+1 + Next + + Debug "Open-in ("+OpenIn+") with url: " + Url + Select OpenIn + Case "process": + RunProgram(Url) + Case "browser": + If IsGadget(WebView_Index) : SetGadgetText(WebView_Index, Url) : EndIf + EndSelect + EndProcedure -Procedure QuitApplication(EventType) - End +Procedure BuildMenu() + Protected i = 1 + + If CreateMenu(0, WindowID(MainWindow)) + MenuTitle("File") + + ForEach Customization\Menus() + MenuItem(i, Customization\Menus()\Title) + BindMenuEvent(0, i, @Menu_EventHandler()) + + ; Counter + i+1 + Next + + MenuBar() + MenuItem(98, "&Quit") + BindMenuEvent(0, 98, @Menu_Quit()) + + MenuTitle("Browse") + MenuItem(99, "Home") + BindMenuEvent(0, 99, @WebView_Home()) + EndIf EndProcedure ;------------------------------------------------------------------------------------ ;- Main Loop ;------------------------------------------------------------------------------------ ShowMainWindow() -ShowHome() +LoadConfiguration() +BuildMenu() +WebView_Home() ;------------------------------------------------------------------------------------ ;- Event Loop @@ -77,9 +140,10 @@ Repeat EndSelect Until Quit = #True + ; IDE Options = PureBasic 6.10 LTS (Windows - x64) -; CursorPosition = 47 -; FirstLine = 22 -; Folding = -- +; CursorPosition = 89 +; FirstLine = 44 +; Folding = 1- ; EnableXP ; DPIAware \ No newline at end of file diff --git a/Supportcenter.pbp b/Supportcenter.pbp index 2f0d76f..24fa051 100644 --- a/Supportcenter.pbp +++ b/Supportcenter.pbp @@ -7,16 +7,28 @@
- +
- + + + + + - - + + + + + + + + + +
@@ -27,10 +39,10 @@ Supportcenter.ico - - - - + + + +
diff --git a/Web/src/dist/main.min.css b/Web/src/dist/main.min.css index 522812a..70b3233 100644 --- a/Web/src/dist/main.min.css +++ b/Web/src/dist/main.min.css @@ -563,10 +563,6 @@ video { margin-top: 2.5rem; margin-bottom: 2.5rem; } -.my-6 { - margin-top: 1.5rem; - margin-bottom: 1.5rem; -} .my-8 { margin-top: 2rem; margin-bottom: 2rem; @@ -583,9 +579,6 @@ video { .ml-2 { margin-left: 0.5rem; } -.ml-6 { - margin-left: 1.5rem; -} .mr-4 { margin-right: 1rem; } @@ -604,9 +597,6 @@ video { .hidden { display: none; } -.h-14 { - height: 3.5rem; -} .h-16 { height: 4rem; } @@ -697,110 +687,29 @@ video { .bg-black\/30 { background-color: rgb(0 0 0 / 0.3); } -.bg-cyan-800 { - --tw-bg-opacity: 1; - background-color: rgb(21 94 117 / var(--tw-bg-opacity)); -} .bg-gray-50 { --tw-bg-opacity: 1; background-color: rgb(249 250 251 / var(--tw-bg-opacity)); } -.bg-gray-900 { +.bg-sky-600 { --tw-bg-opacity: 1; - background-color: rgb(17 24 39 / var(--tw-bg-opacity)); + background-color: rgb(2 132 199 / var(--tw-bg-opacity)); } .bg-white { --tw-bg-opacity: 1; background-color: rgb(255 255 255 / var(--tw-bg-opacity)); } -.bg-sky-800 { - --tw-bg-opacity: 1; - background-color: rgb(7 89 133 / var(--tw-bg-opacity)); -} -.bg-sky-600 { - --tw-bg-opacity: 1; - background-color: rgb(2 132 199 / var(--tw-bg-opacity)); -} -.bg-gradient-to-r { - background-image: linear-gradient(to right, var(--tw-gradient-stops)); -} .bg-gradient-to-t { background-image: linear-gradient(to top, var(--tw-gradient-stops)); } -.from-cyan-600\/50 { - --tw-gradient-from: rgb(8 145 178 / 0.5) var(--tw-gradient-from-position); - --tw-gradient-to: rgb(8 145 178 / 0) var(--tw-gradient-to-position); - --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); -} -.from-sky-800 { - --tw-gradient-from: #075985 var(--tw-gradient-from-position); - --tw-gradient-to: rgb(7 89 133 / 0) var(--tw-gradient-to-position); - --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); -} -.from-green-600\/50 { - --tw-gradient-from: rgb(22 163 74 / 0.5) var(--tw-gradient-from-position); - --tw-gradient-to: rgb(22 163 74 / 0) var(--tw-gradient-to-position); - --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); -} -.from-emerald-600\/50 { - --tw-gradient-from: rgb(5 150 105 / 0.5) var(--tw-gradient-from-position); - --tw-gradient-to: rgb(5 150 105 / 0) var(--tw-gradient-to-position); - --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); -} -.from-emerald-600 { - --tw-gradient-from: #059669 var(--tw-gradient-from-position); - --tw-gradient-to: rgb(5 150 105 / 0) var(--tw-gradient-to-position); - --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); -} -.from-lime-600 { - --tw-gradient-from: #65a30d var(--tw-gradient-from-position); - --tw-gradient-to: rgb(101 163 13 / 0) var(--tw-gradient-to-position); - --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); -} .from-sky-600 { --tw-gradient-from: #0284c7 var(--tw-gradient-from-position); --tw-gradient-to: rgb(2 132 199 / 0) var(--tw-gradient-to-position); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); } -.to-cyan-400\/60 { - --tw-gradient-to: rgb(34 211 238 / 0.6) var(--tw-gradient-to-position); -} -.to-sky-900 { - --tw-gradient-to: #0c4a6e var(--tw-gradient-to-position); -} -.to-green-400\/60 { - --tw-gradient-to: rgb(74 222 128 / 0.6) var(--tw-gradient-to-position); -} -.to-emerald-400\/60 { - --tw-gradient-to: rgb(52 211 153 / 0.6) var(--tw-gradient-to-position); -} -.to-emerald-400 { - --tw-gradient-to: #34d399 var(--tw-gradient-to-position); -} -.to-lime-400 { - --tw-gradient-to: #a3e635 var(--tw-gradient-to-position); -} -.to-lime-600 { - --tw-gradient-to: #65a30d var(--tw-gradient-to-position); -} -.to-emerald-600 { - --tw-gradient-to: #059669 var(--tw-gradient-to-position); -} -.to-sky-600 { - --tw-gradient-to: #0284c7 var(--tw-gradient-to-position); -} -.to-sky-400 { - --tw-gradient-to: #38bdf8 var(--tw-gradient-to-position); -} .to-sky-500 { --tw-gradient-to: #0ea5e9 var(--tw-gradient-to-position); } -.stroke-cyan-800 { - stroke: #155e75; -} -.stroke-sky-800 { - stroke: #075985; -} .stroke-sky-600 { stroke: #0284c7; } @@ -834,14 +743,6 @@ video { padding-top: 7rem; padding-bottom: 7rem; } -.py-3 { - padding-top: 0.75rem; - padding-bottom: 0.75rem; -} -.py-3\.5 { - padding-top: 0.875rem; - padding-bottom: 0.875rem; -} .ps-10 { padding-inline-start: 2.5rem; } @@ -862,14 +763,6 @@ video { font-size: 1.875rem; line-height: 2.25rem; } -.text-base { - font-size: 1rem; - line-height: 1.5rem; -} -.text-lg { - font-size: 1.125rem; - line-height: 1.75rem; -} .text-sm { font-size: 0.875rem; line-height: 1.25rem; @@ -897,18 +790,6 @@ video { .tracking-tight { letter-spacing: -0.025em; } -.text-cyan-800 { - --tw-text-opacity: 1; - color: rgb(21 94 117 / var(--tw-text-opacity)); -} -.text-cyan-900 { - --tw-text-opacity: 1; - color: rgb(22 78 99 / var(--tw-text-opacity)); -} -.text-gray-300 { - --tw-text-opacity: 1; - color: rgb(209 213 219 / var(--tw-text-opacity)); -} .text-gray-500 { --tw-text-opacity: 1; color: rgb(107 114 128 / var(--tw-text-opacity)); @@ -921,6 +802,10 @@ video { --tw-text-opacity: 1; color: rgb(17 24 39 / var(--tw-text-opacity)); } +.text-sky-800 { + --tw-text-opacity: 1; + color: rgb(7 89 133 / var(--tw-text-opacity)); +} .text-white { --tw-text-opacity: 1; color: rgb(255 255 255 / var(--tw-text-opacity)); @@ -928,22 +813,6 @@ video { .text-white\/90 { color: rgb(255 255 255 / 0.9); } -.text-sky-900 { - --tw-text-opacity: 1; - color: rgb(12 74 110 / var(--tw-text-opacity)); -} -.text-sky-600 { - --tw-text-opacity: 1; - color: rgb(2 132 199 / var(--tw-text-opacity)); -} -.text-sky-700 { - --tw-text-opacity: 1; - color: rgb(3 105 161 / var(--tw-text-opacity)); -} -.text-sky-800 { - --tw-text-opacity: 1; - color: rgb(7 89 133 / var(--tw-text-opacity)); -} .shadow { --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1); --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color); @@ -971,30 +840,14 @@ video { .hover\:bg-black\/40:hover { background-color: rgb(0 0 0 / 0.4); } -.hover\:bg-cyan-900:hover { - --tw-bg-opacity: 1; - background-color: rgb(22 78 99 / var(--tw-bg-opacity)); -} .hover\:bg-gray-100:hover { --tw-bg-opacity: 1; background-color: rgb(243 244 246 / var(--tw-bg-opacity)); } -.hover\:bg-gray-700:hover { - --tw-bg-opacity: 1; - background-color: rgb(55 65 81 / var(--tw-bg-opacity)); -} .hover\:bg-sky-800:hover { --tw-bg-opacity: 1; background-color: rgb(7 89 133 / var(--tw-bg-opacity)); } -.hover\:bg-sky-600:hover { - --tw-bg-opacity: 1; - background-color: rgb(2 132 199 / var(--tw-bg-opacity)); -} -.hover\:text-white:hover { - --tw-text-opacity: 1; - color: rgb(255 255 255 / var(--tw-text-opacity)); -} .focus\:border-sky-500:focus { --tw-border-opacity: 1; border-color: rgb(14 165 233 / var(--tw-border-opacity)); @@ -1008,10 +861,6 @@ video { --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color); box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); } -.focus\:ring-blue-300:focus { - --tw-ring-opacity: 1; - --tw-ring-color: rgb(147 197 253 / var(--tw-ring-opacity)); -} .focus\:ring-sky-300:focus { --tw-ring-opacity: 1; --tw-ring-color: rgb(125 211 252 / var(--tw-ring-opacity));