diff options
| author | TrickyLeifa <date.epoch@gmail.com> | 2024-05-15 00:00:17 +0200 |
|---|---|---|
| committer | TrickyLeifa <date.epoch@gmail.com> | 2024-05-15 00:04:16 +0200 |
| commit | c9f52b7223685d2e7fca925594171f94dd8c6e3b (patch) | |
| tree | 740bb32a40da98a4d52836432f59a16b31333900 /src/lobby.h | |
| parent | 951766666621fa77e257e6b5616fe4ab1eb2a52f (diff) | |
Ported to CMake, ...
* Ported the project to CMake
* Android and Mac support dropped for the time
being.
* Tests, BASS and Discord-RPC are now options
* Restructured and reformated the project.
* Merged `include` and `src`
* Renamed `resource` to `data`
* Renamed various files
* External libraries headers are no longer included in `src`
* Replaced header guards with #pragma once
* Multiple refactors (keywords, headers)
* Added Qt6 compatibility
* Removed various unused functions and headers
* Reworked AOPacket
* When content is passed to AOPacket, it should be ensured that the content is already decoded.
* Encoding/decoding are now static methods.
* Fixed various memory leaks
* Removed animation code for AOImage
* AOImage is always using static images
* Simplified ChatLogPiece
Diffstat (limited to 'src/lobby.h')
| -rw-r--r-- | src/lobby.h | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/src/lobby.h b/src/lobby.h new file mode 100644 index 00000000..4b4d6240 --- /dev/null +++ b/src/lobby.h @@ -0,0 +1,112 @@ +#pragma once + +#include <QLabel> +#include <QLineEdit> +#include <QPushButton> +#include <QTextBrowser> +#include <QTreeWidget> +#include <QTreeWidgetItem> + +#include "file_functions.h" +#include "networkmanager.h" +#include <QMainWindow> + +#ifdef ANDROID +#include <QtAndroidExtras/QtAndroid> +#endif + +class AOApplication; + +class Lobby : public QMainWindow +{ + Q_OBJECT + +public: + Lobby(AOApplication *p_ao_app, NetworkManager *p_net_man = nullptr); + ~Lobby(); + + void set_player_count(int players_online, int max_players); + void set_server_description(const QString &server_description); + void list_servers(); + int get_selected_server(); + int pageSelected(); + +private: + AOApplication *ao_app; + NetworkManager *net_manager; + + const QString DEFAULT_UI = "lobby.ui"; + + void list_favorites(); + void list_demos(); + void get_motd(); + void check_for_updates(); + void reset_selection(); + + int last_index = -1; + + enum TabPage + { + SERVER, + FAVORITES, + DEMOS + }; + + // UI-file Lobby + + // Top Row + QLabel *ui_game_version_lbl; + QPushButton *ui_settings_button; + QPushButton *ui_about_button; + + // Server, Favs and Demo lists + QTabWidget *ui_connections_tabview; + + QTreeWidget *ui_serverlist_tree; + QLineEdit *ui_serverlist_search; + + QTreeWidget *ui_favorites_tree; + QLineEdit *ui_favorites_search; + + QTreeWidget *ui_demo_tree; + QLineEdit *ui_demo_search; + + QPushButton *ui_add_to_favorite_button; + QPushButton *ui_add_server_button; + QPushButton *ui_remove_from_favorites_button; + QPushButton *ui_edit_favorite_button; + QPushButton *ui_direct_connect_button; + QPushButton *ui_refresh_button; + + // Serverinfo / MOTD Horizontal Row + QTextBrowser *ui_motd_text; + + QLabel *ui_server_player_count_lbl; + QTextBrowser *ui_server_description_text; + QPushButton *ui_connect_button; + + // Optional Widget + QTextBrowser *ui_game_changelog_text; + + void loadUI(); + void reloadUi(); + + TabPage current_page = SERVER; + +private Q_SLOTS: + void on_tab_changed(int index); + void on_refresh_released(); + void on_direct_connect_released(); + void on_add_to_fav_released(); + void on_add_server_to_fave_released(); + void on_edit_favorite_released(); + void on_remove_from_fav_released(); + void on_about_clicked(); + void on_server_list_clicked(QTreeWidgetItem *p_item, int column); + void on_list_doubleclicked(QTreeWidgetItem *p_item, int column); + void on_favorite_tree_clicked(QTreeWidgetItem *p_item, int column); + void on_server_search_edited(QString p_text); + void on_demo_clicked(QTreeWidgetItem *item, int column); + void onReloadThemeRequested(); // Oh boy. + void onSettingsRequested(); +}; |
