ORE Studio 0.0.4
Loading...
Searching...
No Matches
FraConventionDetailDialog.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_FRA_CONVENTION_DETAIL_DIALOG_HPP
21#define ORES_QT_FRA_CONVENTION_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.refdata.api/domain/fra_convention.hpp"
28
29
30namespace Ui {
31class FraConventionDetailDialog;
32}
33
34namespace ores::qt {
35
44 Q_OBJECT
45
46private:
47 inline static std::string_view logger_name =
48 "ores.qt.fra_convention_detail_dialog";
49
50 [[nodiscard]] static auto& lg() {
51 using namespace ores::logging;
52 static auto instance = make_logger(logger_name);
53 return instance;
54 }
55
56public:
57 explicit FraConventionDetailDialog(QWidget* parent = nullptr);
59
60 void setClientManager(ClientManager* clientManager);
61 void setUsername(const std::string& username);
62 void setConvention(const refdata::domain::fra_convention& fc);
63 void setCreateMode(bool createMode);
64 void setReadOnly(bool readOnly);
65
66
67signals:
68 void fcSaved(const QString& code);
69 void fcDeleted(const QString& code);
70
71private slots:
72 void onSaveClicked();
73 void onDeleteClicked();
74 void onCodeChanged(const QString& text);
75 void onFieldChanged();
76
77protected:
78 QTabWidget* tabWidget() const override;
79 QWidget* provenanceTab() const override;
80 ProvenanceWidget* provenanceWidget() const override;
81 bool hasUnsavedChanges() const override { return hasChanges_; }
82
83private:
84 void setupUi();
85 void setupConnections();
86 void updateUiFromConvention();
87 void updateConventionFromUi();
88 void updateSaveButtonState();
89 bool validateInput();
90
91
92 Ui::FraConventionDetailDialog* ui_;
93 ClientManager* clientManager_;
94 std::string username_;
96 bool createMode_{true};
97 bool readOnly_{false};
98 bool hasChanges_{false};
99
100};
101
102}
103
104#endif
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AccountController.hpp:32
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
Detail dialog for viewing and editing FRA convention records.
Definition FraConventionDetailDialog.hpp:43
ProvenanceWidget * provenanceWidget() const override
Returns the promoted ProvenanceWidget (named "provenanceWidget" in .ui).
Definition FraConventionDetailDialog.cpp:56
bool hasUnsavedChanges() const override
Definition FraConventionDetailDialog.hpp:81
QTabWidget * tabWidget() const override
Returns the dialog's QTabWidget (named "tabWidget" in .ui).
Definition FraConventionDetailDialog.cpp:48
QWidget * provenanceTab() const override
Returns the Provenance tab widget (named "provenanceTab" in .ui).
Definition FraConventionDetailDialog.cpp:52
Conventions for a forward rate agreement (FRA).
Definition fra_convention.hpp:36