Procházet zdrojové kódy

GMLPlayground: Make 'Open' action start in the Application source folder

Font Editor and Theme Editor already open the dialog in system folders
(/res/fonts and /res/themes). To be fair, they do have a special folder
just for their files, but I think this is good enough if you want to
start hacking an app :^)

Additionaly, this also adds a filter to show only .gml files by default.
Karol Kosek před 2 roky
rodič
revize
e02cbd9daa
1 změnil soubory, kde provedl 6 přidání a 1 odebrání
  1. 6 1
      Userland/DevTools/GMLPlayground/MainWidget.cpp

+ 6 - 1
Userland/DevTools/GMLPlayground/MainWidget.cpp

@@ -13,6 +13,7 @@
 #include <LibDesktop/Launcher.h>
 #include <LibDesktop/Launcher.h>
 #include <LibFileSystemAccessClient/Client.h>
 #include <LibFileSystemAccessClient/Client.h>
 #include <LibGUI/Application.h>
 #include <LibGUI/Application.h>
+#include <LibGUI/FileTypeFilter.h>
 #include <LibGUI/GML/AutocompleteProvider.h>
 #include <LibGUI/GML/AutocompleteProvider.h>
 #include <LibGUI/GML/Formatter.h>
 #include <LibGUI/GML/Formatter.h>
 #include <LibGUI/GML/SyntaxHighlighter.h>
 #include <LibGUI/GML/SyntaxHighlighter.h>
@@ -160,7 +161,11 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window)
     auto open_action = GUI::CommonActions::make_open_action([&](auto&) {
     auto open_action = GUI::CommonActions::make_open_action([&](auto&) {
         if (request_close() == GUI::Window::CloseRequestDecision::StayOpen)
         if (request_close() == GUI::Window::CloseRequestDecision::StayOpen)
             return;
             return;
-        auto response = FileSystemAccessClient::Client::the().open_file(&window);
+        auto response = FileSystemAccessClient::Client::the().open_file(&window, {}, "/usr/src/serenity/Userland/Applications"sv, Core::File::OpenMode::Read,
+            Vector {
+                GUI::FileTypeFilter { "GML Files", { { "gml" } } },
+                GUI::FileTypeFilter::all_files(),
+            });
         if (response.is_error())
         if (response.is_error())
             return;
             return;