mirror of
https://gitee.com/Zhaoxin59/my-chat_-client.git
synced 2026-02-14 00:51:48 +08:00
refactor: 大规模调整项目目录结构,将ChatClient和ChatServer整合为Monorepo结构,并分为两个独立文件夹:chatclient/ 和 chatserver/。更新了ChatClient的CMakeLists.txt配置以适配新结构。
This commit is contained in:
114
ChatClient/include/mainwidget.h
Normal file
114
ChatClient/include/mainwidget.h
Normal file
@ -0,0 +1,114 @@
|
||||
#ifndef MAINWIDGET_H
|
||||
#define MAINWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QPushButton>
|
||||
#include <QLineEdit>
|
||||
#include <QMainWindow>
|
||||
|
||||
#include "debug.h"
|
||||
#include "messageeditarea.h"
|
||||
#include "messageshowarea.h"
|
||||
#include "selfinfowidget.h"
|
||||
#include "sessionfriendarea.h"
|
||||
#include "groupsessiondetailwidget.h"
|
||||
#include "addfrienddialog.h"
|
||||
#include "model/datacenter.h"
|
||||
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui {
|
||||
class MainWidget;
|
||||
}
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class MainWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
//对于单例模式最关键的部分是限制别人创建实例
|
||||
static MainWidget* instance;
|
||||
|
||||
public:
|
||||
static MainWidget* getInstance();
|
||||
|
||||
public:
|
||||
MainWidget(QWidget *parent = nullptr);
|
||||
~MainWidget();
|
||||
|
||||
private:
|
||||
Ui::MainWidget *ui;
|
||||
//窗口左侧部分
|
||||
QWidget* windowLeft;
|
||||
//窗口中间部分
|
||||
QWidget* windowMid;
|
||||
//窗口右侧部分
|
||||
QWidget* windowRight;
|
||||
//用户头像
|
||||
QPushButton* userAvatar;
|
||||
//会话标签页按钮
|
||||
QPushButton* sessionTabBtn;
|
||||
//好友标签页按钮
|
||||
QPushButton* friendTabBtn;
|
||||
//好友申请标签页按钮
|
||||
QPushButton* applyTabBtn;
|
||||
|
||||
//用户搜索框
|
||||
QLineEdit* searchEdit;
|
||||
//添加好友按钮
|
||||
QPushButton* addFriendBtn;
|
||||
|
||||
//
|
||||
SessionFriendArea* sessionFriendArea;
|
||||
|
||||
//显示会话标题
|
||||
QLabel* sessionTitleLabel;
|
||||
|
||||
//显示会话详情按钮
|
||||
QPushButton* extraBtn;
|
||||
|
||||
//消息展示区
|
||||
MessageShowArea* messageShowArea;
|
||||
|
||||
//消息编辑区
|
||||
MessageEditArea* messageEditArea;
|
||||
|
||||
enum ActiveTab {
|
||||
SESSION_LIST,
|
||||
FRIEND_LIST,
|
||||
APPLY_LIST
|
||||
};
|
||||
|
||||
ActiveTab activeTab = SESSION_LIST;
|
||||
|
||||
public:
|
||||
void initMainWindow();
|
||||
void initLeftWindow();
|
||||
void initMidWindow();
|
||||
void initRightWindow();
|
||||
|
||||
void initSignalSlot();
|
||||
void initWebSocket();
|
||||
|
||||
void switchTabToSession();
|
||||
void switchTabToFriend();
|
||||
void switchTabToApply();
|
||||
|
||||
void loadSessionList();
|
||||
void loadFriendList();
|
||||
void loadApplyList();
|
||||
|
||||
void updateFriendList();
|
||||
void updateChatSessionList();
|
||||
void updateApplyList();
|
||||
|
||||
void loadRecentMessage(const QString& chatSessionId);
|
||||
void updateRecentMessage(const QString& chatSessionId);
|
||||
|
||||
//点击好友项后,切换到会话列表的总函数,上方的switchTabToSession只是其中的一个环节
|
||||
void switchSession(const QString& userId);
|
||||
|
||||
MessageShowArea* getMessageShowArea();
|
||||
};
|
||||
#endif // MAINWIDGET_H
|
||||
Reference in New Issue
Block a user