capture_gif/xygifframe.h

77 lines
1.6 KiB
C++

#ifndef XYGIFFRAME_H
#define XYGIFFRAME_H
#include "xymovablewidget.h"
#include "xygifcreator.h"
#include <QTimer>
#include <QSystemTrayIcon>
namespace Ui {
class XYGifFrame;
}
class XYGifFrame : public XYMovableWidget
{
Q_OBJECT
public:
explicit XYGifFrame(QWidget *parent = nullptr);
~XYGifFrame() override;
public slots:
void doResize();
void packImages();
void setGifFile();
void active();
void start();
void stop();
void frame();
void TrayIconAction(QSystemTrayIcon::ActivationReason reason)
{
if(reason == QSystemTrayIcon::Trigger)
this->showNormal();
}
void restory(){
this->showNormal();
}
protected:
bool eventFilter(QObject *watched, QEvent *event) override;
void paintEvent(QPaintEvent *event) override;
void resizeEvent(QResizeEvent *event) override;
void mousePressEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
void wheelEvent(QWheelEvent *event) override;
private slots:
void on_quit_clicked();
private:
QImage getCurScreenImage();
// 鐢ㄤ簬resize绐楀彛
private:
bool mStartResize;
QRect mStartGeometry;
private:
Ui::XYGifFrame *ui;
QRect mRecordRect;
XYGifCreator *mGifCreator;
QTimer mTimer;
int mPixs;
QString mGifFile;
QSystemTrayIcon* m_tray; //托盘类
QMenu* m_menu; //托盘菜单
QAction* m_resetAction; //托盘按钮
QAction* m_quitAction; //托盘按钮
};
#endif // XYGIFFRAME_H