ORE Studio 0.0.4
Loading...
Searching...
No Matches
MyAccountDialog.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_MYACCOUNTDIALOG_HPP
21#define ORES_QT_MYACCOUNTDIALOG_HPP
22
23#include <QLabel>
24#include <QWidget>
25#include <QTabWidget>
26#include <QToolBar>
27#include <QLineEdit>
28#include <QPushButton>
29#include "ores.qt/ClientManager.hpp"
30
31namespace ores::qt {
32
45class MyAccountDialog : public QWidget {
46 Q_OBJECT
47
48private:
49 inline static std::string_view logger_name = "ores.qt.my_account_dialog";
50
51 static auto& lg() {
52 using namespace ores::logging;
53 static auto instance = make_logger(logger_name);
54 return instance;
55 }
56
57public:
63 explicit MyAccountDialog(ClientManager* clientManager, QWidget* parent = nullptr);
64 ~MyAccountDialog() override;
65
66private slots:
67 void onChangePasswordClicked();
68 void onChangePasswordResult(bool success, const QString& error_message);
69 void onSaveEmailClicked();
70 void onSaveEmailResult(bool success, const QString& error_message);
71 void onViewSessionsClicked();
72
73signals:
74 void changePasswordCompleted(bool success, const QString& error_message);
75 void saveEmailCompleted(bool success, const QString& error_message);
76 void viewSessionHistoryRequested();
77
78private:
79 void setupUI();
80 void loadAccountInfo();
81 void loadSessionInfo();
82 void enablePasswordForm(bool enabled);
83 bool validatePasswordInput();
84
85private:
86 // Toolbar
87 QToolBar* toolbar_;
88
89 // Tab widget
90 QTabWidget* tabWidget_;
91
92 // Account info section (General tab)
93 QLineEdit* username_edit_;
94 QLineEdit* email_edit_;
95 QPushButton* save_email_button_;
96 QLabel* email_status_label_;
97
98 // Sessions section (Sessions tab)
99 QLabel* active_sessions_label_;
100 QLabel* current_session_label_;
101 QPushButton* view_sessions_button_;
102
103 // Password change section (Security tab)
104 QLineEdit* new_password_edit_;
105 QLineEdit* confirm_password_edit_;
106 QPushButton* change_password_button_;
107 QLabel* password_status_label_;
108
109 // Dependencies
110 ClientManager* clientManager_;
111};
112
113}
114
115#endif
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:29
Manages the lifecycle of the NATS client and login state.
Definition ClientManager.hpp:109
Widget for users to manage their own account details.
Definition MyAccountDialog.hpp:45