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:
108
ChatClient/include/historymessagewidget.h
Normal file
108
ChatClient/include/historymessagewidget.h
Normal file
@ -0,0 +1,108 @@
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
#include <QGridLayout>
|
||||
#include <QRadioButton>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QLabel>
|
||||
#include <QDateTimeEdit>
|
||||
#include <QScrollArea>
|
||||
#include <QScrollBar>
|
||||
#include <QFileDialog>
|
||||
|
||||
#include "debug.h"
|
||||
#include "model/data.h"
|
||||
|
||||
using model::Message;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
/// 表示一个历史消息元素
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class HistoryItem : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
HistoryItem() {}
|
||||
|
||||
static HistoryItem* makeHistoryItem(const Message& message);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
/// 展示历史消息窗口
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class HistoryMessageWidget : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
HistoryMessageWidget(QWidget *parent);
|
||||
|
||||
//在窗口中添加一个历史消息
|
||||
void addHistoryMessage(const Message& message);
|
||||
|
||||
//清空窗口中所有的历史消息
|
||||
void clear();
|
||||
|
||||
void clickSearchBtn();
|
||||
void clickSearchBtnDone();
|
||||
|
||||
private:
|
||||
void initScrollArea(QGridLayout* layout);
|
||||
|
||||
QRadioButton* keyRadioBtn;
|
||||
QRadioButton* timeRadioBtn;
|
||||
QLineEdit* searchEdit;
|
||||
|
||||
QDateTimeEdit* begTimeEdit;
|
||||
QDateTimeEdit* endTimeEdit;
|
||||
|
||||
//持有所有的历史消息结果的容器对象
|
||||
QWidget* container;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
/// 展示图片历史消息
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class ImageButton : public QPushButton
|
||||
{
|
||||
public:
|
||||
ImageButton(const QString& fileId, const QByteArray& content);
|
||||
void updateUI(const QString& fileId, const QByteArray& content);
|
||||
|
||||
private:
|
||||
QString fileId;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
/// 展示文件历史消息
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class FileLabel : public QLabel {
|
||||
public:
|
||||
FileLabel(const QString& fileId, const QString& filename);
|
||||
void getContentDone(const QString& fileId, const QByteArray& fileContent);
|
||||
|
||||
void mousePressEvent(QMouseEvent* event) override;
|
||||
|
||||
private:
|
||||
QString fileId;
|
||||
QByteArray content;
|
||||
QString filename;
|
||||
bool loadDone = false;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
/// 展示语音历史消息
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class SpeechLabel : public QLabel {
|
||||
public:
|
||||
SpeechLabel(const QString& fileId);
|
||||
|
||||
void getContentDone(const QString& fileId, const QByteArray& content);
|
||||
|
||||
void mousePressEvent(QMouseEvent* event);
|
||||
|
||||
private:
|
||||
QString fileId;
|
||||
QByteArray content;
|
||||
bool loadDone = false;
|
||||
};
|
||||
Reference in New Issue
Block a user