| 322 | } |
| 323 | |
| 324 | std::string genGuiComponentHdr(const std::string& name) |
| 325 | { |
| 326 | using namespace fmt::literals; |
| 327 | |
| 328 | return fmt::format(R"(#ifndef {nameUpper}_H |
| 329 | #define {nameUpper}_H |
| 330 | |
| 331 | #include <QWidget> |
| 332 | #include <QtCore/QScopedPointer> |
| 333 | #include <componentinterface.h> |
| 334 | #include <context.h> |
| 335 | #include <memory> |
| 336 | |
| 337 | class {name}Private; |
| 338 | class QWidget; |
| 339 | struct {name}GuiInt; |
| 340 | typedef Context<{name}GuiInt> {name}Ctx; |
| 341 | |
| 342 | class {name} : public QObject, public ComponentInterface {{ |
| 343 | Q_OBJECT |
| 344 | Q_DECLARE_PRIVATE({name}) |
| 345 | |
| 346 | public: |
| 347 | {name}(); |
| 348 | explicit {name}({name}Ctx&& ctx); |
| 349 | ~{name}(); |
| 350 | |
| 351 | QWidget* mainWidget() override; |
| 352 | void setConfig(const QJsonObject& json) override; |
| 353 | void setConfig(const QWidget& qobject) override; |
| 354 | QJsonObject getConfig() const override; |
| 355 | std::shared_ptr<QWidget> getQConfig() const override; |
| 356 | void configChanged() override; |
| 357 | bool mainWidgetDocked() const override; |
| 358 | ComponentInterface::ComponentProperties getSupportedProperties() const override; |
| 359 | |
| 360 | signals: |
| 361 | void mainWidgetDockToggled(QWidget* widget) override; |
| 362 | void simBcastSnd(const QJsonObject &msg, const QVariant ¶m = QVariant()) override; |
| 363 | |
| 364 | public slots: |
| 365 | void stopSimulation() override; |
| 366 | void startSimulation() override; |
| 367 | void simBcastRcv(const QJsonObject &msg, const QVariant ¶m) override; |
| 368 | |
| 369 | private: |
| 370 | QScopedPointer<{name}Private> d_ptr; |
| 371 | }}; |
| 372 | |
| 373 | #endif //{nameUpper}_H |
| 374 | )", |
| 375 | "name"_a = name, "nameUpper"_a = str_toupper(name)); |
| 376 | } |
| 377 | |
| 378 | std::string genGuiComponentSrc(const std::string& name) |
| 379 | { |