ORE Studio 0.0.4
Loading...
Searching...
No Matches
TelemetrySettingsDialog.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2025 Marco Craveiro <marco.craveiro@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20#ifndef ORES_QT_TELEMETRYSETTINGSDIALOG_HPP
21#define ORES_QT_TELEMETRYSETTINGSDIALOG_HPP
22
23#include <QDialog>
24#include <QCheckBox>
25#include <QComboBox>
26#include <QLineEdit>
27#include <QSpinBox>
28#include <QPushButton>
29#include <QTabWidget>
30#include "ores.logging/make_logger.hpp"
31#include "ores.logging/logging_options.hpp"
32
33namespace ores::qt {
34
47class TelemetrySettingsDialog : public QDialog {
48 Q_OBJECT
49
50private:
51 inline static std::string_view logger_name = "ores.qt.telemetry_settings_dialog";
52
53 static auto& lg() {
54 using namespace ores::logging;
55 static auto instance = make_logger(logger_name);
56 return instance;
57 }
58
59public:
64 explicit TelemetrySettingsDialog(QWidget* parent = nullptr);
65 ~TelemetrySettingsDialog() override;
66
72
77 static bool isCompressionEnabled();
78
83 static QString compressionAlgorithm();
84
89 static bool isStreamingEnabled();
90
95 static int streamingBatchSize();
96
101 static int streamingFlushInterval();
102
107 static QString settingsPrefix() { return "telemetry"; }
108
109private slots:
110 void onApplyClicked();
111 void onCancelClicked();
112 void onBrowseLogDirectoryClicked();
113 void onBrowseTelemetryDirectoryClicked();
114 void onLoggingEnabledChanged(Qt::CheckState state);
115 void onTelemetryExportEnabledChanged(Qt::CheckState state);
116 void onCompressionEnabledChanged(Qt::CheckState state);
117
118private:
119 void setupUI();
120 void loadSettings();
121 void saveSettings();
122 void applySettings();
123 void updateLoggingGroupEnabled();
124 void updateTelemetryGroupEnabled();
125 void updateCompressionGroupEnabled();
126
127private:
128 // Tab widget
129 QTabWidget* tab_widget_;
130
131 // Logging tab
132 QCheckBox* logging_enabled_checkbox_;
133 QComboBox* log_level_combo_;
134 QCheckBox* console_output_checkbox_;
135 QLineEdit* log_directory_edit_;
136 QPushButton* log_directory_browse_;
137 QLineEdit* log_filename_edit_;
138 QCheckBox* include_pid_checkbox_;
139 QLineEdit* tag_filter_edit_;
140
141 // Telemetry export tab
142 QCheckBox* telemetry_enabled_checkbox_;
143 QLineEdit* telemetry_output_file_edit_;
144 QLineEdit* telemetry_directory_edit_;
145 QPushButton* telemetry_directory_browse_;
146 QCheckBox* streaming_enabled_checkbox_;
147 QSpinBox* batch_size_spin_;
148 QSpinBox* flush_interval_spin_;
149
150 // Network tab
151 QCheckBox* compression_enabled_checkbox_;
152 QComboBox* compression_algorithm_combo_;
153
154 // Dialog buttons
155 QPushButton* apply_button_;
156 QPushButton* cancel_button_;
157};
158
159}
160
161#endif
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:35
Options related to logging.
Definition logging_options.hpp:32
Dialog for configuring logging and telemetry settings.
Definition TelemetrySettingsDialog.hpp:47
static logging::logging_options loadLoggingSettings()
Load logging options from QSettings.
Definition TelemetrySettingsDialog.cpp:287
static QString settingsPrefix()
Get the settings key prefix for telemetry settings.
Definition TelemetrySettingsDialog.hpp:107
static bool isCompressionEnabled()
Check if compression is enabled in QSettings.
Definition TelemetrySettingsDialog.cpp:409
static bool isStreamingEnabled()
Check if telemetry streaming to server is enabled in QSettings.
Definition TelemetrySettingsDialog.cpp:429
static int streamingFlushInterval()
Get streaming flush interval from QSettings.
Definition TelemetrySettingsDialog.cpp:449
static QString compressionAlgorithm()
Get compression algorithm from QSettings.
Definition TelemetrySettingsDialog.cpp:419
static int streamingBatchSize()
Get streaming batch size from QSettings.
Definition TelemetrySettingsDialog.cpp:439