ORE Studio 0.0.4
Loading...
Searching...
No Matches
CurrencyController.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2024 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_CURRENCY_CONTROLLER_HPP
21#define ORES_QT_CURRENCY_CONTROLLER_HPP
22
23#include <QPointer>
24#include <QList>
25#include <QDateTime>
26#include "ores.qt/EntityController.hpp"
27#include "ores.risk/domain/currency.hpp"
28#include "ores.utility/log/make_logger.hpp"
29
30namespace ores::qt {
31
32class DetachableMdiSubWindow;
33
53 Q_OBJECT
54
55private:
56 inline static std::string_view logger_name =
57 "ores.qt.currency_controller";
58
59 [[nodiscard]] static auto& lg() {
60 using namespace ores::utility::log;
61 static auto instance = make_logger(logger_name);
62 return instance;
63 }
64
65public:
77 explicit CurrencyController(
78 QMainWindow* mainWindow,
79 QMdiArea* mdiArea,
80 ClientManager* clientManager,
81 const QString& username,
82 QList<DetachableMdiSubWindow*>& allDetachableWindows,
83 QObject* parent = nullptr);
84
91 ~CurrencyController() override;
92
101 void showListWindow() override;
102
111 void closeAllWindows() override;
112
113private slots:
120 void onAddNewRequested();
121
131 void onShowCurrencyDetails(const risk::domain::currency& currency);
132
142 void onShowCurrencyHistory(const QString& isoCode);
143
153 void onNotificationReceived(const QString& eventType, const QDateTime& timestamp);
154
155private:
163 QList<DetachableMdiSubWindow*>& allDetachableWindows_;
164
172 QPointer<DetachableMdiSubWindow> currencyListWindow_;
173};
174
175}
176
177#endif
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:35
Implements logging for ORE Studio.
Definition lifecycle_manager.hpp:30
Manages the lifecycle of the network client and IO context.
Definition ClientManager.hpp:47
Controller managing all currency-related windows and operations.
Definition CurrencyController.hpp:52
void closeAllWindows() override
Closes all windows managed by this controller.
Definition CurrencyController.cpp:169
~CurrencyController() override
Destroys the currency controller.
Definition CurrencyController.cpp:81
void showListWindow() override
Shows the currency list window.
Definition CurrencyController.cpp:91
Abstract base class for entity controllers.
Definition EntityController.hpp:43
Represents a currency with its metadata and formatting rules.
Definition currency.hpp:30