GUI
This commit is contained in:
parent
b3d06906ff
commit
b0d5226915
7 changed files with 317 additions and 52 deletions
|
|
@ -1,6 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include "Module.hpp"
|
||||
#include "Strings.hpp"
|
||||
#include "Map.hpp"
|
||||
#include "List.hpp"
|
||||
|
||||
namespace tp {
|
||||
|
||||
|
|
@ -14,14 +16,30 @@ namespace tp {
|
|||
tp::int1 pass[SIZE] {0};
|
||||
};
|
||||
|
||||
typedef List<String> ChatsList;
|
||||
|
||||
struct Message {
|
||||
String user;
|
||||
String text;
|
||||
};
|
||||
|
||||
typedef List<Message> ChatHistory;
|
||||
|
||||
public:
|
||||
ChatAPI() = default;
|
||||
[[nodiscard]] bool isLogged() const;
|
||||
void login(const Credentials& credentials);
|
||||
[[nodiscard]] const ChatsList* getChatsList() const;
|
||||
[[nodiscard]] const ChatHistory* getChatHistory(const String& chatName) const;
|
||||
void logout();
|
||||
void send(const String& chatName, const Message& message);
|
||||
|
||||
private:
|
||||
bool mLogged = false;
|
||||
Credentials mCredentials;
|
||||
ChatsList mChatsList;
|
||||
|
||||
Map<String, ChatHistory> mChatHistories;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,10 +4,17 @@
|
|||
|
||||
namespace tp {
|
||||
class ClientGUI {
|
||||
enum { MESSAGE_SIZE = 1024 };
|
||||
ChatAPI::Credentials mCredentials;
|
||||
bool mInvalidCredentials = false;
|
||||
char mMessageBuff[1000] {0};
|
||||
String mActiveChatName = "Not Selected";
|
||||
|
||||
public:
|
||||
ClientGUI() = default;
|
||||
void draw(ChatAPI& api);
|
||||
|
||||
private:
|
||||
void drawChat(ChatAPI& api);
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue