ORE Studio 0.0.4
Loading...
Searching...
No Matches
PricingModelProductDetailDialog.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2026 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_PRICING_MODEL_PRODUCT_DETAIL_DIALOG_HPP
21#define ORES_QT_PRICING_MODEL_PRODUCT_DETAIL_DIALOG_HPP
22
23#include <vector>
24#include "ores.qt/ClientManager.hpp"
25#include "ores.qt/DetailDialogBase.hpp"
26#include "ores.logging/make_logger.hpp"
27#include "ores.analytics.api/domain/pricing_model_product.hpp"
28
29#include "ores.analytics.api/domain/pricing_engine_type.hpp"
30
31
32namespace Ui {
33class PricingModelProductDetailDialog;
34}
35
36namespace ores::qt {
37
46 Q_OBJECT
47
48private:
49 inline static std::string_view logger_name =
50 "ores.qt.pricing_model_product_detail_dialog";
51
52 [[nodiscard]] static auto& lg() {
53 using namespace ores::logging;
54 static auto instance = make_logger(logger_name);
55 return instance;
56 }
57
58public:
59 explicit PricingModelProductDetailDialog(QWidget* parent = nullptr);
61
62 void setClientManager(ClientManager* clientManager);
63 void setUsername(const std::string& username);
64 void setProduct(const analytics::domain::pricing_model_product& product);
65 void setCreateMode(bool createMode);
66 void setReadOnly(bool readOnly);
67
68 void setPricingEngineTypes(const std::vector<analytics::domain::pricing_engine_type>& items);
69
70
71signals:
72 void productSaved(const QString& code);
73 void productDeleted(const QString& code);
74
75private slots:
76 void onSaveClicked();
77 void onDeleteClicked();
78 void onCodeChanged(const QString& text);
79 void onFieldChanged();
80
81protected:
82 QTabWidget* tabWidget() const override;
83 QWidget* provenanceTab() const override;
84 ProvenanceWidget* provenanceWidget() const override;
85 bool hasUnsavedChanges() const override { return hasChanges_; }
86
87private:
88 void setupUi();
89 void setupConnections();
90 void setupCombos();
91 void updateUiFromProduct();
92 void updateProductFromUi();
93 void updateSaveButtonState();
94 bool validateInput();
95
96 void populatePricingEngineTypes();
97
98
99 Ui::PricingModelProductDetailDialog* ui_;
100 ClientManager* clientManager_;
101 std::string username_;
103 bool createMode_{true};
104 bool readOnly_{false};
105 bool hasChanges_{false};
106
107 std::vector<analytics::domain::pricing_engine_type> pricingEngineTypes_;
108
109};
110
111}
112
113#endif
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AccountController.hpp:32
Per-product model and engine assignment within a pricing model config.
Definition pricing_model_product.hpp:38
Detail dialog for viewing and editing pricing model product records.
Definition PricingModelProductDetailDialog.hpp:45
ProvenanceWidget * provenanceWidget() const override
Returns the promoted ProvenanceWidget (named "provenanceWidget" in .ui).
Definition PricingModelProductDetailDialog.cpp:59
bool hasUnsavedChanges() const override
Definition PricingModelProductDetailDialog.hpp:85
QTabWidget * tabWidget() const override
Returns the dialog's QTabWidget (named "tabWidget" in .ui).
Definition PricingModelProductDetailDialog.cpp:51
QWidget * provenanceTab() const override
Returns the Provenance tab widget (named "provenanceTab" in .ui).
Definition PricingModelProductDetailDialog.cpp:55
Manages the lifecycle of the NATS client and login state.
Definition ClientManager.hpp:123
Base class for all detail dialogs.
Definition DetailDialogBase.hpp:75
Widget displaying the 6 standard record provenance fields.
Definition ProvenanceWidget.hpp:40