File indexing completed on 2025-09-18 09:32:16
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef ROOT7_RWebDisplayArgs
0014 #define ROOT7_RWebDisplayArgs
0015
0016 #include <string>
0017 #include <memory>
0018
0019 class THttpServer;
0020
0021 namespace ROOT {
0022
0023 class RLogChannel;
0024
0025
0026 ROOT::RLogChannel &WebGUILog();
0027
0028 class RWebWindow;
0029
0030 class RWebDisplayArgs {
0031
0032 friend class RWebWindow;
0033
0034 public:
0035 enum EBrowserKind {
0036 kChrome,
0037 kEdge,
0038 kSafari,
0039 kFirefox,
0040 kNative,
0041 kCEF,
0042 kQt6,
0043 kLocal,
0044 kDefault,
0045 kServer,
0046 kEmbedded,
0047 kOff,
0048 kOn,
0049 kCustom
0050 };
0051
0052 protected:
0053 EBrowserKind fKind{kNative};
0054 std::string fUrl;
0055 std::string fExtraArgs;
0056 std::string fPageContent;
0057 std::string fRedirectOutput;
0058 std::string fWidgetKind;
0059 bool fBatchMode{false};
0060 bool fHeadless{false};
0061 bool fStandalone{true};
0062 THttpServer *fServer{nullptr};
0063 int fWidth{0};
0064 int fHeight{0};
0065 int fX{-1};
0066 int fY{-1};
0067 std::string fUrlOpt;
0068 std::string fExec;
0069 void *fDriverData{nullptr};
0070
0071 std::shared_ptr<RWebWindow> fMaster;
0072 unsigned fMasterConnection{0};
0073 int fMasterChannel{-1};
0074
0075 bool SetSizeAsStr(const std::string &str);
0076 bool SetPosAsStr(const std::string &str);
0077
0078 public:
0079 RWebDisplayArgs();
0080
0081 RWebDisplayArgs(const std::string &browser);
0082
0083 RWebDisplayArgs(const char *browser);
0084
0085 RWebDisplayArgs(int width, int height, int x = -1, int y = -1, const std::string &browser = "");
0086
0087 RWebDisplayArgs(std::shared_ptr<RWebWindow> master, unsigned conndid = 0, int channel = -1);
0088
0089 virtual ~RWebDisplayArgs();
0090
0091 RWebDisplayArgs &SetBrowserKind(const std::string &kind);
0092
0093 RWebDisplayArgs &SetBrowserKind(EBrowserKind kind) { fKind = kind; return *this; }
0094
0095 EBrowserKind GetBrowserKind() const { return fKind; }
0096 std::string GetBrowserName() const;
0097
0098 void SetMasterWindow(std::shared_ptr<RWebWindow> master, unsigned connid = 0, int channel = -1);
0099
0100
0101 bool IsInteractiveBrowser() const
0102 {
0103 return !IsHeadless() &&
0104 ((GetBrowserKind() == kOn) || (GetBrowserKind() == kNative) || (GetBrowserKind() == kChrome) ||
0105 (GetBrowserKind() == kEdge) || (GetBrowserKind() == kSafari) || (GetBrowserKind() == kFirefox) ||
0106 (GetBrowserKind() == kDefault) || (GetBrowserKind() == kCustom));
0107 }
0108
0109
0110 bool IsLocalDisplay() const
0111 {
0112 return (GetBrowserKind() == kLocal) || (GetBrowserKind() == kCEF) || (GetBrowserKind() == kQt6);
0113 }
0114
0115
0116 bool IsSupportHeadless() const
0117 {
0118 return (GetBrowserKind() == kNative) || (GetBrowserKind() == kDefault) || (GetBrowserKind() == kOn) ||
0119 (GetBrowserKind() == kChrome) || (GetBrowserKind() == kEdge) || (GetBrowserKind() == kFirefox) ||
0120 (GetBrowserKind() == kCEF) || (GetBrowserKind() == kQt6);
0121 }
0122
0123
0124 RWebDisplayArgs &SetUrl(const std::string &url) { fUrl = url; return *this; }
0125
0126 const std::string &GetUrl() const { return fUrl; }
0127
0128
0129 RWebDisplayArgs &SetWidgetKind(const std::string &kind) { fWidgetKind = kind; return *this; }
0130
0131 const std::string &GetWidgetKind() const { return fWidgetKind; }
0132
0133
0134 RWebDisplayArgs &SetPageContent(const std::string &cont) { fPageContent = cont; return *this; }
0135
0136 const std::string &GetPageContent() const { return fPageContent; }
0137
0138
0139
0140 void SetStandalone(bool on = true) { fStandalone = on; }
0141
0142 bool IsStandalone() const { return fStandalone; }
0143
0144
0145 RWebDisplayArgs &SetUrlOpt(const std::string &opt) { fUrlOpt = opt; return *this; }
0146
0147 const std::string &GetUrlOpt() const { return fUrlOpt; }
0148
0149
0150 void AppendUrlOpt(const std::string &opt);
0151
0152
0153 std::string GetFullUrl() const;
0154
0155
0156 void SetBatchMode(bool on = true) { fBatchMode = on; }
0157
0158 bool IsBatchMode() const { return fBatchMode; }
0159
0160
0161 void SetHeadless(bool on = true) { fHeadless = on; }
0162
0163 bool IsHeadless() const { return fHeadless; }
0164
0165
0166 RWebDisplayArgs &SetWidth(int w = 0) { fWidth = w; return *this; }
0167
0168 RWebDisplayArgs &SetHeight(int h = 0) { fHeight = h; return *this; }
0169
0170 RWebDisplayArgs &SetSize(int w, int h) { fWidth = w; fHeight = h; return *this; }
0171
0172
0173 RWebDisplayArgs &SetX(int x = -1) { fX = x; return *this; }
0174
0175 RWebDisplayArgs &SetY(int y = -1) { fY = y; return *this; }
0176
0177 RWebDisplayArgs &SetPos(int x = -1, int y = -1) { fX = x; fY = y; return *this; }
0178
0179
0180 int GetWidth() const { return fWidth; }
0181
0182 int GetHeight() const { return fHeight; }
0183
0184 int GetX() const { return fX; }
0185
0186 int GetY() const { return fY; }
0187
0188
0189 void SetExtraArgs(const std::string &args) { fExtraArgs = args; }
0190
0191 const std::string &GetExtraArgs() const { return fExtraArgs; }
0192
0193
0194 void SetRedirectOutput(const std::string &fname = "") { fRedirectOutput = fname; }
0195
0196 const std::string &GetRedirectOutput() const { return fRedirectOutput; }
0197
0198
0199 void SetCustomExec(const std::string &exec);
0200
0201 std::string GetCustomExec() const;
0202
0203
0204 void SetHttpServer(THttpServer *serv) { fServer = serv; }
0205
0206 THttpServer *GetHttpServer() const { return fServer; }
0207
0208
0209 void SetDriverData(void *data) { fDriverData = data; }
0210
0211 void *GetDriverData() const { return fDriverData; }
0212
0213 static std::string GetQt5EmbedQualifier(const void *qparent, const std::string &urlopt = "", unsigned qtversion = 0x60000);
0214
0215 static std::string GetQtEmbedQualifier(const void *qparent, const std::string &urlopt = "", unsigned qtversion = 0x60000);
0216
0217 };
0218
0219 }
0220
0221 #endif