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 <QDialog>
25#include <QLineEdit>
26#include <QGroupBox>
27#include <QPushButton>
28#include "ores.qt/ClientManager.hpp"
29
30namespace ores::qt {
31
43class MyAccountDialog : public QDialog {
44 Q_OBJECT
45
46private:
47 inline static std::string_view logger_name = "ores.qt.my_account_dialog";
48
49 static auto& lg() {
50 using namespace ores::logging;
51 static auto instance = make_logger(logger_name);
52 return instance;
53 }
54
55public:
61 explicit MyAccountDialog(ClientManager* clientManager, QWidget* parent = nullptr);
62 ~MyAccountDialog() override;
63
64private slots:
65 void onChangePasswordClicked();
66 void onChangePasswordResult(bool success, const QString& error_message);
67 void onSaveEmailClicked();
68 void onSaveEmailResult(bool success, const QString& error_message);
69 void onViewSessionsClicked();
70 void onCloseClicked();
71 void updatePasswordMatchIndicator();
72
73signals:
74 void changePasswordCompleted(bool success, const QString& error_message);
75 void saveEmailCompleted(bool success, const QString& error_message);
76
77private:
78 void setupUI();
79 void loadAccountInfo();
80 void loadSessionInfo();
81 void enablePasswordForm(bool enabled);
82 bool validatePasswordInput();
83
84private:
85 // Account info section
86 QLineEdit* username_edit_;
87 QLineEdit* email_edit_;
88 QPushButton* save_email_button_;
89 QLabel* email_status_label_;
90
91 // Sessions section
92 QGroupBox* sessions_group_;
93 QLabel* active_sessions_label_;
94 QLabel* current_session_label_;
95 QPushButton* view_sessions_button_;
96
97 // Password change section
98 QGroupBox* password_group_;
99 QLineEdit* new_password_edit_;
100 QLineEdit* confirm_password_edit_;
101 QPushButton* change_password_button_;
102 QLabel* password_status_label_;
103
104 // Dialog buttons
105 QPushButton* close_button_;
106
107 // Dependencies
108 ClientManager* clientManager_;
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 AboutDialog.hpp:35
Manages the lifecycle of the network client and IO context.
Definition ClientManager.hpp:90
Dialog for users to manage their own account details.
Definition MyAccountDialog.hpp:43