TelegramTUI/inc/tgtui.h

48 lines
664 B
C++

#pragma once
#include <thread>
#include "slimchat.h"
#include "tgclient.h"
class View;
class ViewChat;
class ViewChatList;
class TgTUI {
public:
TgTUI();
~TgTUI();
void run();
void stop();
const std::vector<SlimChat>& getChats();
private:
enum class ViewMode {
ChatList = 0,
Chat = 1,
};
void initDoneCB();
void threadLoop();
void handleNewChat(objptr<td_api::chat> chat);
void switchToView(ViewMode vm);
TGClient tgclient;
ViewMode currentViewMode;
View* currentView = nullptr;
ViewChatList* viewChatList = nullptr;
ViewChat* viewChat = nullptr;
std::vector<SlimChat> chats;
bool shouldRun = false;
std::thread tuiThread;
};