about summary refs log tree commit diff
path: root/tools/eaglemode/plugins/yatracker/src/PlYaTracker/PlYaTracker.cpp
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@tvl.su>2024-08-30T22·36+0300
committertazjin <tazjin@tvl.su>2024-09-02T21·26+0000
commit84bdc582ea9edebc844b0e25e18a16d22c1bc587 (patch)
treefdba6077e4515029df34bfefcdc027488e2d61b1 /tools/eaglemode/plugins/yatracker/src/PlYaTracker/PlYaTracker.cpp
parent18578c3458187bad901ce559131922e856162fb5 (diff)
feat(eaglemode/plugins): bootstrap Yandex Tracker plugin r/8638
Bootstraps a plugin (that doesn't do anything yet) for accessing Yandex Tracker
through Eagle Mode.

This commit only initialises the plugin files, it doesn't actually do anything
other than print the word "Loaded".

API docs for future development: https://yandex.cloud/ru/docs/tracker/about-api

The next steps will be to figure out the emModel classes and the threading model
for fetching the remote data.

Change-Id: Ifce8bc2a61c4fd0c4a591013acbf428a9f5803f8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12398
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Diffstat (limited to 'tools/eaglemode/plugins/yatracker/src/PlYaTracker/PlYaTracker.cpp')
-rw-r--r--tools/eaglemode/plugins/yatracker/src/PlYaTracker/PlYaTracker.cpp58
1 files changed, 58 insertions, 0 deletions
diff --git a/tools/eaglemode/plugins/yatracker/src/PlYaTracker/PlYaTracker.cpp b/tools/eaglemode/plugins/yatracker/src/PlYaTracker/PlYaTracker.cpp
new file mode 100644
index 000000000000..9bf05a17179f
--- /dev/null
+++ b/tools/eaglemode/plugins/yatracker/src/PlYaTracker/PlYaTracker.cpp
@@ -0,0 +1,58 @@
+#include <emCore/emFilePanel.h>
+#include <emCore/emFpPlugin.h>
+#include <emCore/emRecFileModel.h>
+#include <emCore/emToolkit.h>
+
+class PlYaTrackerConfig final : public emRecFileModel, public emStructRec {
+ public:
+  static emRef<PlYaTrackerConfig> Acquire(emContext& context,
+                                          const emString& name,
+                                          bool common = true);
+
+  virtual const char* GetFormatName() const;
+
+  emStringRec URL;
+  emStringRec Token;
+
+ protected:
+  PlYaTrackerConfig(emContext& context, const emString& name);
+};
+
+emRef<PlYaTrackerConfig> PlYaTrackerConfig::Acquire(emContext& context,
+                                                    const emString& name,
+                                                    bool common) {
+  EM_IMPL_ACQUIRE(PlYaTrackerConfig, context, name, common)
+}
+
+const char* PlYaTrackerConfig::GetFormatName() const { return "PlYaTracker"; }
+
+PlYaTrackerConfig::PlYaTrackerConfig(emContext& context, const emString& name)
+    : emRecFileModel(context, name),
+      emStructRec(),
+      URL(this, "URL"),
+      Token(this, "Token") {
+  PostConstruct(*this);
+}
+
+class PlYaTrackerFilePanel : public emFilePanel {
+ public:
+  PlYaTrackerFilePanel(ParentArg parent, const emString& name,
+                       emRef<PlYaTrackerConfig> config);
+
+ private:
+  emRef<PlYaTrackerConfig> Config;
+};
+
+PlYaTrackerFilePanel::PlYaTrackerFilePanel(ParentArg parent,
+                                           const emString& name,
+                                           emRef<PlYaTrackerConfig> config)
+    : emFilePanel(parent, name, config), Config(config) {}
+
+extern "C" {
+emPanel* PlYaTrackerPluginFunc(emPanel::ParentArg parent, const emString& name,
+                               const emString& path, emFpPlugin* plugin,
+                               emString* errorBuf) {
+  return new PlYaTrackerFilePanel(
+      parent, name, PlYaTrackerConfig::Acquire(parent.GetRootContext(), path));
+}
+}