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::utility::log;
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 onCloseClicked();
70
71signals:
72 void changePasswordCompleted(bool success, const QString& error_message);
73 void saveEmailCompleted(bool success, const QString& error_message);
74
75private:
76 void setupUI();
77 void loadAccountInfo();
78 void enablePasswordForm(bool enabled);
79 bool validatePasswordInput();
80
81private:
82 // Account info section
83 QLineEdit* username_edit_;
84 QLineEdit* email_edit_;
85 QPushButton* save_email_button_;
86 QLabel* email_status_label_;
87
88 // Password change section
89 QGroupBox* password_group_;
90 QLineEdit* new_password_edit_;
91 QLineEdit* confirm_password_edit_;
92 QPushButton* change_password_button_;
93 QLabel* password_status_label_;
94
95 // Dialog buttons
96 QPushButton* close_button_;
97
98 // Dependencies
99 ClientManager* clientManager_;
100};
101
102}
103
104#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:56
Dialog for users to manage their own account details.
Definition MyAccountDialog.hpp:43