93 lines
2.5 KiB
C++
93 lines
2.5 KiB
C++
#ifndef MAINWIDGET_H
|
|
#define MAINWIDGET_H
|
|
|
|
#include <QWidget>
|
|
#include <QListWidgetItem>
|
|
#include <QList>
|
|
#include <QMenu>
|
|
#include <QSystemTrayIcon>
|
|
#include <QMessageBox>
|
|
#include <QTime>
|
|
#include <QFile>
|
|
#include <QProgressDialog>
|
|
#include <QDir>
|
|
#include <QDebug>
|
|
#include <QFileDialog>
|
|
#include <QScrollBar>
|
|
#include <QKeyEvent>
|
|
#include <QDate>
|
|
#include <QSoundEffect>
|
|
#include <QTimer>
|
|
#include <QDesktopServices>
|
|
#include <QPropertyAnimation>
|
|
|
|
namespace Ui {
|
|
class MainWidget;
|
|
}
|
|
|
|
class MainWidget : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit MainWidget(QString username,QWidget *parent = nullptr);
|
|
~MainWidget();
|
|
void sendFile(QString filePath,QString filename,QString name = "");
|
|
void readFile(QString filename,QByteArray data);
|
|
bool eventFilter(QObject *target, QEvent *event);
|
|
|
|
signals:
|
|
void send_text(QString sendname,QString text);
|
|
void send_to_user(QString sendname,QString to_user,QString test);
|
|
void send_file_to_all(QString sendname,QString filename,QByteArray file);
|
|
void send_file_private(QString sendname,QString filename,QByteArray file,QString name);
|
|
void exit_client();
|
|
void update_namelist(QString username);
|
|
void account_cancellation(QString username);
|
|
void Minimized();
|
|
void new_message();
|
|
|
|
private slots:
|
|
void on_send_text_clicked();
|
|
void on_save_btn_clicked();
|
|
void on_send_btn_clicked();
|
|
void on_name_list_itemDoubleClicked(QListWidgetItem *item);
|
|
void on_exit_btn_clicked();
|
|
void on_stop_clicked();
|
|
void message_reminder();
|
|
void onFlashTimerOut();
|
|
public slots:
|
|
void update_text(QString sendname,QString data);
|
|
void update_file(QString sendname,QString filename,QString file_data);
|
|
void update_file_private(QString sendname,QString filename,QString file_data);
|
|
void update_users(int count,QList<QString>online_users);
|
|
void disconnect_form_server();
|
|
void slot_new_message();
|
|
|
|
private:
|
|
Ui::MainWidget *ui;
|
|
QString username;
|
|
|
|
QPointer<QMenu> TrayMennu; //系统托盘右键菜单项
|
|
QPointer<QSystemTrayIcon> SystemTray; //系统托盘图标
|
|
|
|
//右键菜单栏选项
|
|
QPointer<QAction> ActionShow;
|
|
QPointer<QAction> ActionQuit;
|
|
|
|
QPointer<QTimer> TimerNotice;
|
|
QPointer<QTimer> TimerFlash = NULL;
|
|
uint flashCount;
|
|
|
|
QPointer<QSoundEffect> effect;
|
|
|
|
void zoom_up(QPushButton* btn);
|
|
void zoom_down(QPushButton* btn);
|
|
void CreateSystemTray();
|
|
void showEvent(QShowEvent *event);
|
|
void closeEvent(QCloseEvent *event);
|
|
void changeEvent(QEvent *event);
|
|
};
|
|
|
|
#endif // MAINWIDGET_H
|