2 #include <JS/ConsolePanel.hpp>
3 #include <JS/JSProcessModel.hpp>
4 #include <Library/LibraryInterface.hpp>
5 #include <Library/ProcessesItemModel.hpp>
15 SCORE_CONCRETE(
"6e72e377-efdd-4e3c-9900-922b618e7d70")
18 JS::PanelDelegate* panel{};
20 QSet<QString> acceptedFiles()
const noexcept
override {
return {
"mjs"}; }
22 bool add(
const QString& path)
25 if(!f.open(QIODevice::ReadOnly))
29 panel = &score::GUIAppContext().
panel<JS::PanelDelegate>();
31 panel->importModule(path);
35 void addPath(std::string_view path)
override
37 add(QString::fromUtf8(path.data(), path.length()));
50 SCORE_CONCRETE(
"21f405da-a249-4e39-b405-9173aff11b26")
52 QSet<QString> acceptedFiles()
const noexcept
override {
return {
"js"}; }
57 if(!f.open(QIODevice::ReadOnly))
60 auto& p = ctx.app.
panel<JS::PanelDelegate>();
61 if(QFileInfo{f}.suffix() ==
"mjs")
67 auto data = f.readAll();
78 SCORE_CONCRETE(
"5231ea8b-da66-4c6f-9e34-d9a79cbc494a")
80 QSet<QString> acceptedFiles()
const noexcept
override {
return {
"qml"}; }
82 static inline const QRegularExpression scoreImport{
"import Score [0-9].[0-9]"};
91 QModelIndex node = model.find(key);
92 if(node == QModelIndex{})
95 categories.init(node, ctx);
98 void addPath(std::string_view path)
override
100 QFileInfo file{QString::fromUtf8(path.data(), path.length())};
102 pdata.prettyName = file.completeBaseName();
104 pdata.customData = [&] {
105 QFile f(file.absoluteFilePath());
106 f.open(QIODevice::ReadOnly);
107 return f.readAll().trimmed();
111 auto matches = scoreImport.match(pdata.customData);
114 categories.add(file, std::move(pdata));
Definition: LibraryHandler.hpp:49
Definition: LibraryHandler.hpp:77
Definition: LibraryHandler.hpp:14
Definition: LibraryInterface.hpp:22
Definition: ProcessesItemModel.hpp:45
Definition: ProcessesItemModel.hpp:32
Definition: ProcessesItemModel.hpp:86
Definition: ObjectMatches.hpp:6
Definition: DocumentContext.hpp:18
Specializes ApplicationContext with the QMainWindow.
Definition: GUIApplicationContext.hpp:15
T & panel() const
Access to a specific PanelDelegate.
Definition: GUIApplicationContext.hpp:36