Add reconnect button to disconnection notice.#1102
Add reconnect button to disconnection notice.#1102WisoAltred wants to merge 9 commits intomasterfrom
Conversation
Reads and begins the connection process to the last server the user disconnected from. Doesn't complete the connection process.. yet.
src/debug_functions.h
Outdated
| class debug_functions : public QObject | ||
| { | ||
| Q_OBJECT | ||
|
|
||
| public: | ||
| explicit debug_functions(AOApplication *parent); | ||
| AOApplication *ao_app; | ||
|
|
||
| void call_notice_reconnect(QString message); | ||
| }; |
There was a problem hiding this comment.
What's the reasoning behind making this an object over a simple function call? I don't see a reason as to why it would be.
There was a problem hiding this comment.
It was made into an object because I needed to pass the parent / ao_app into the function of call_notice_reconnect. Couldn't find a way of doing that without extending the QObject from a class.
Do you know an example implementation for doing it without having to do that?
There was a problem hiding this comment.
Simply add a bool prompt_choice(QString message) which either allow you to accept or cancel. That way you keep it within a singular function and can use it elsewhere within the code. Additionally, the return value will make it easy on whatever reconnecting is wanted by the user or not.
| // if (is_lobby_constructed()) | ||
| // {} | ||
| // l_dialog->exec(); |
There was a problem hiding this comment.
I can't remove these, this snippet is for the execution of the lobby settings when the settings button is pressed.
Currently, pressing it causes a disconnection for the purposes of testing the reconnection button.
src/aoapplication.cpp
Outdated
| call_notice(tr("Disconnected from server.")); | ||
| construct_lobby(); | ||
| destruct_courtroom(); | ||
| // call_notice(tr("Disconnected from server.")); |
There was a problem hiding this comment.
Remove rather than comment out.
src/aoapplication.cpp
Outdated
| : QObject(parent) | ||
| { | ||
| net_manager = new NetworkManager(this); | ||
| debug_func = new debug_functions(this); |
There was a problem hiding this comment.
debug_func is too vague as a variable name.
debug_functions is meaningless as a class name nor does it follow at all any kind of somewhat established naming convention.
src/debug_functions.cpp
Outdated
|
|
||
| void debug_functions::call_notice_reconnect(QString p_message) | ||
| { | ||
| auto *msgBox = new QMessageBox; |
There was a problem hiding this comment.
Should be a member variable.
src/debug_functions.cpp
Outdated
| QTimer intervalTimer; | ||
| intervalTimer.setInterval(1000); | ||
|
|
||
| int counter = 3; |
There was a problem hiding this comment.
Should be a member variable.
src/debug_functions.h
Outdated
| class debug_functions : public QObject | ||
| { | ||
| Q_OBJECT | ||
|
|
||
| public: | ||
| explicit debug_functions(AOApplication *parent); | ||
| AOApplication *ao_app; | ||
|
|
||
| void call_notice_reconnect(QString message); | ||
| }; |
There was a problem hiding this comment.
Simply add a bool prompt_choice(QString message) which either allow you to accept or cancel. That way you keep it within a singular function and can use it elsewhere within the code. Additionally, the return value will make it easy on whatever reconnecting is wanted by the user or not.
…ead. Co-Authored-By: Leifa <26681464+TrickyLeifa@users.noreply.github.com>
Reconnects to last server fully. Sends to character select screen.
| class Lobby; | ||
| class Courtroom; | ||
| class Options; | ||
| class debug_functions; |
|
|
||
| void NetworkManager::reconnect_to_last_server() | ||
| { | ||
| connect(this, &NetworkManager::server_connected, this, &NetworkManager::join_to_server); |
There was a problem hiding this comment.
This needs disconnected after rejoining the server.
Reads and begins the connection process to the last server the user disconnected from. Doesn't complete the connection process.