You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 04a8217
Browse filesBrowse the repository at this point in the historyBrowse files
AddOption(fpsRate, int32_t, 100, "", 0, "Target frame rate (frames per second) for fpsLimit 2, or if the backend cannot limit to the refresh rate (0 = no limit)")
509
+
AddOption(fpsRate, int32_t, 100, "", 0, "Target frame rate (frames per second) for fpsLimit 2, or if the backend cannot limit to the refresh rate", min(1), max(9999))
510
510
AddOption(useGLIndirectDraw, bool, true, "", 0, "Use OpenGL indirect draws to reduce number of draw calls")
Copy file name to clipboardExpand all lines: GPU/GPUTracking/display/frontend/GPUDisplayFrontend.h
+8Lines changed: 8 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -22,10 +22,13 @@
22
22
#include<mutex>
23
23
#include<condition_variable>
24
24
#include<string>
25
+
#include<utility>
26
+
#include<variant>
25
27
#include<vector>
26
28
27
29
namespaceo2::gpu
28
30
{
31
+
using GPUDisplayGUIValue = std::variant<int64_t, double, std::string>; // Value of a Qt GUI element
29
32
classGPUReconstruction;
30
33
classGPUDisplay;
31
34
classGPUDisplayBackend;
@@ -158,6 +161,11 @@ class GPUDisplayFrontend : public GPUDisplayFrontendInterface
158
161
boolmWindowFullScreen = false, mWindowMaximized = false; // Window state last requested or reported by the window system
159
162
template <typename... Args>
160
163
voidadd_key_binding(Args&&... args); // KEY_LAMBDA(key, ...) entries, the help text, and optionally the keys to show in the help text, only used in GPUDisplayFrontendConfig.cxx
164
+
template <typename... Args>
165
+
voidadd_gui_binding(Args&&... args); // GUI_LAMBDA(name, ...) entries shown in one frame of the Qt GUI, and optionally its description and a flag to place the elements horizontally (default vertically), only used in GPUDisplayFrontendConfig.cxx
166
+
voidsetGUILayout(GPUDisplayGUIChannel& channel) const; // Copy the GUI elements of the add_gui_binding calls to the channel
167
+
std::vector<GPUDisplayGUIValue> getGUIValues(); // Current values of the options of the GUI elements, by element id
168
+
voidapplyGUIValues(const std::vector<std::pair<uint32_t, GPUDisplayGUIValue>>& values); // Call the setter of the GUI elements changed in the GUI (element id, value), and show the info of their options
161
169
voidlistConfig();
162
170
const std::vector<std::string>& getHelpText() const; // Help text of all key bindings, one line per binding
std::vector<std::string> keyMapNames; // Names of the key down mapping ids (KEY_MAP_*)
58
60
std::vector<std::pair<std::string, std::string>> helpTextEntries; // Keys and text of each add_key_binding call
59
61
std::vector<std::string> helpText;
62
+
structguiElementCallbacks {
63
+
uint32_t rttiIndex;
64
+
std::function<void(const GPUDisplayGUIValue&)> set; // GUI_LAMBDA setter, applies a value from the GUI
65
+
std::function<GPUDisplayGUIValue()> get; // Current value of the option of the element
66
+
};
67
+
std::vector<guiElementCallbacks> guiElements; // By element id
68
+
std::vector<GPUDisplayGUIChannel::Frame> guiLayout; // Frames of the add_gui_binding calls
60
69
staticconstexpr std::string_view possibleKeys = " 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ#.:;>'^_"; // Bindable keys >= 32 (space), special keys < 32 are those with a name in keyNames
static std::vector<std::pair<std::string, GPUDisplayGUIValue>> guiSliderValues(std::initializer_list<GPUDisplayGUIValue> values) // Choices of GUI_SLIDER_VALUES, named by their value
static_assert(nElements >= 1 && nHorizontal <= 1 && sizeof...(Args) <= nElements + nHorizontal + 1, "add_gui_binding needs at least one GUI element, and optionally the description and the horizontal flag");
316
+
GPUDisplayGUIChannel::Frame frame;
317
+
auto addElement = [&](auto& element) {
318
+
using Type = GPUDisplayGUIChannel::ElementType;
319
+
constuint32_t id = mConfigRTTI->guiElements.size();
throwstd::runtime_error("GUI element " + element.name + ": choices are needed for radio buttons and dropdown menus, and only allowed for them and sliders");
GPUInfo("%zu options with RTTI, %u of them with a key, %zu bound keys, %zu available keys", rtti.rttiEntries.size(), nOptionsWithKey, boundKeys.size(), availableKeys.size());
453
+
GPUInfo("Help text:");
454
+
for (constauto& line : rtti.helpText) {
455
+
GPUInfo(" %s", line.c_str());
456
+
}
457
+
GPUInfo("");
458
+
GPUInfo("%zu options with RTTI, %u of them with a key, %u in the Qt GUI, %zu bound keys, %zu available keys", rtti.rttiEntries.size(), nOptionsWithKey, nOptionsInGUI, boundKeys.size(), availableKeys.size());
0 commit comments