protobuf server
This commit is contained in:
+11
-4
@@ -19,7 +19,9 @@ void SerialApp::initialize() {
|
||||
|
||||
// Вспомогательная функция перевода HEX строки (например, "282a36ff") в ImVec4
|
||||
static ImVec4 HexToImVec4(const std::string& hex_str) {
|
||||
if (hex_str.length() < 8) return ImVec4(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
if (hex_str.length() < 8) {
|
||||
return {1.0f, 1.0f, 1.0f, 1.0f};
|
||||
}
|
||||
|
||||
unsigned int r, g, b, a;
|
||||
std::stringstream ss;
|
||||
@@ -28,7 +30,12 @@ static ImVec4 HexToImVec4(const std::string& hex_str) {
|
||||
ss << std::hex << hex_str.substr(4, 2); ss >> b; ss.clear();
|
||||
ss << std::hex << hex_str.substr(6, 2); ss >> a;
|
||||
|
||||
return ImVec4(r / 255.0f, g / 255.0f, b / 255.0f, a / 255.0f);
|
||||
return {
|
||||
static_cast<float>(r) / 255.0f,
|
||||
static_cast<float>(g) / 255.0f,
|
||||
static_cast<float>(b) / 255.0f,
|
||||
static_cast<float>(a) / 255.0f
|
||||
};
|
||||
}
|
||||
|
||||
bool SerialApp::loadTheme(const std::string& filepath) {
|
||||
@@ -82,7 +89,7 @@ bool SerialApp::loadTheme(const std::string& filepath) {
|
||||
// Читаем HEX цвета
|
||||
std::string hex_val;
|
||||
ss >> hex_val;
|
||||
if (color_map.find(key) != color_map.end()) {
|
||||
if (color_map.contains(key)) {
|
||||
style.Colors[color_map[key]] = HexToImVec4(hex_val);
|
||||
}
|
||||
} else {
|
||||
@@ -110,7 +117,7 @@ void SerialApp::renderUI() {
|
||||
payloadWindow.render(&showPayloadWindow, connectionWindow);
|
||||
}
|
||||
if (showLogWindow) {
|
||||
logWindow.render(&showLogWindow, connectionWindow);
|
||||
LogWindow::render(&showLogWindow, connectionWindow);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user