161 lines
5.6 KiB
C++
161 lines
5.6 KiB
C++
#ifndef MAINWINDOW_H
|
|
#define MAINWINDOW_H
|
|
|
|
#include <QMainWindow>
|
|
#include <QFileDialog>
|
|
#include <QTableView>
|
|
#include <QTreeView>
|
|
#include <QListView>
|
|
#include <QStringListModel>
|
|
#include <QStandardItemModel>
|
|
#include <QTranslator>
|
|
#include <QDir>
|
|
#include <QString>
|
|
#include <QTimer>
|
|
#include <QList>
|
|
#include <QVector>
|
|
#include <QStandardItem>
|
|
#include <QSettings>
|
|
#include <QtConcurrent>
|
|
|
|
#include "drawingsetdialog.h"
|
|
#include "plottersetdialog.h"
|
|
#include "historydialog.h"
|
|
#include "printviewwindow.h"
|
|
#include "printnumbersetdialog.h"
|
|
#include "startsetdialog.h"
|
|
#include "printinfodialog.h"
|
|
#include "addmachinedialog.h"
|
|
#include "datafile/hpgl/importhpgl.h"
|
|
#include "machine/bmp/creatprintbmp.h"
|
|
|
|
//文件列表
|
|
#define COLUMN_NUM 9 //列数
|
|
#define COLUMN_COLWIDTH 96 //列宽
|
|
#define COLUMN_FILENAME 0 //第1列-文件名称
|
|
#define COLUMN_LENGTH 1 //第2列-文件长度
|
|
#define COLUMN_WIDTH 2 //第3列-文件宽度
|
|
#define COLUMN_START 3 //第4列-文件起始打印点
|
|
#define COLUMN_PRINTEDLENGTH 4 //第5列-文件已打印长度
|
|
#define COLUMN_PRINTPROGRESS 5 //第6列-文件打印进度
|
|
#define COLUMN_NUMBERS 6 //第7列-文件打印数量
|
|
#define COLUMN_STATE 7 //第8列-文件打印状态
|
|
#define COLUMN_FILEPATH 8 //第9列-文件路径
|
|
|
|
//机器连接列表
|
|
#define CONN_COLUMN_NUM 5 //列数
|
|
#define CONN_COLUMN_COLWIDTH 100 //列宽
|
|
#define CONN_COLUMN_MCNAME 0 //第1列-机器名称
|
|
#define CONN_COLUMN_MCIP 1 //第2列-机器IP
|
|
#define CONN_COLUMN_MCCONSTATE 2 //第3列-机器连接状态
|
|
#define CONN_COLUMN_MCWORKSTATE 3 //第4列-机器工作状态
|
|
#define CONN_COLUMN_MCPROGRESS 4 //第5列-机器打印进度
|
|
|
|
#define AUTOPRINT 1
|
|
#define NOAUTOPRINT 0
|
|
|
|
namespace Ui {
|
|
class MainWindow;
|
|
}
|
|
|
|
class MainWindow : public QMainWindow
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit MainWindow(QWidget *parent = 0);
|
|
~MainWindow();
|
|
|
|
private:
|
|
Ui::MainWindow *ui;
|
|
DrawingSetDialog *m_drawingSetDlg;
|
|
PlotterSetDialog *m_plotterSetDlg;
|
|
HistoryDialog *m_historyDlg;
|
|
PrintViewWindow *m_printViewWi;
|
|
PrintInfoDialog *m_printInfoDlg;
|
|
MyGraphicsView *m_preView;
|
|
QTimer * m_pTimer;//建立连接的定时器
|
|
|
|
int m_curMcIdx;//列表所选机器索引
|
|
McFilesInfo m_curFilesInfo;//当前文件信息
|
|
QStandardItemModel *m_tabelViewModelFile;
|
|
QStandardItemModel *m_tabelViewModelConn;
|
|
int m_curFileRow;//当前选中文件索引
|
|
int m_curPrintFileIdx;//当前打印的文件索引
|
|
int m_curBlockRow;//数据块
|
|
QString m_printPath;
|
|
int m_sortType;//排序类型
|
|
|
|
int m_workState;//工作状态(开始、停止)
|
|
int m_printMode;//打印模式(自动、非自动)
|
|
|
|
int m_breakAutoLoadThread;//打断自动加载文件线程
|
|
QFuture<void> m_autoPrintLoadThread;//自动绘图目录加载线程
|
|
double m_rotateAngle;
|
|
QSettings *m_pSettings;
|
|
|
|
private:
|
|
void closeEvent(QCloseEvent *e);
|
|
void reflushPreview(int row);
|
|
void reflushMcFileInfo();
|
|
void changeRowData(int move);
|
|
bool deleteDir(QString path);
|
|
void startCreatBmpAndSend(int mcIdx = -1);//开始创建位图并发送
|
|
void stopPrint(int mcIdx = -1);//停止打印
|
|
CreatPictureStr creatFilePicture(McFilesInfo & mcFileInfo,int paperWidth,int butSpace,int rightSpace,s16 penWidth = 1);
|
|
//刷新连接状态
|
|
void refConnectUi();//刷新连接状态(1秒)
|
|
void refConnectUi(Machine * pMachine,int & linkSta, int idx);
|
|
void refreshMcListShow();//刷新机器列表显示
|
|
void refreshOneMcShow(int row,int idx);//刷新单个机器信息显示
|
|
int refreshMcFileListShow(int idx);
|
|
void refreshBtnEnable();//刷新按钮可按状态
|
|
void switchLanguage(s16 languageType);
|
|
|
|
public:
|
|
void initAllWinForm();
|
|
void iniViewModel();
|
|
void loadAutoPrintDirFiles();//加载自动绘图目录的文件
|
|
|
|
private slots:
|
|
void slotAddNewFileToList(int newFlag);
|
|
void slotFileListMenu(QPoint pos);
|
|
void slotMcListMenu(QPoint pos);
|
|
void slotPrintPreview();
|
|
void slotPrintNumberSetDlgShow();
|
|
void slotStartSetDlgShow();
|
|
void slotViewPrintInfo();
|
|
void slotDeleteFile();//删除文件
|
|
void slotDeleteMc();//删除机器
|
|
void slotLoadAutoPrintFiles();
|
|
void onOneSecondTimer();//1秒定时器
|
|
void slotDeleteFileFromList(int mcNum, int fileIdx, int refreshFlag = 0);//从列表中删除已打印完成的文件
|
|
void slotRefreshPrintProgress(int mcNum, int fileIdx); //刷新打印进度
|
|
|
|
private slots:
|
|
void on_actionDrawing_Setting_triggered();
|
|
void on_actionPlotter_Setting_triggered();
|
|
void on_actionlog_triggered();
|
|
void on_actionOpen_File_triggered();
|
|
void on_tableView_fileList_clicked(const QModelIndex &index);
|
|
void on_pushButton_up_clicked();
|
|
void on_pushButton_down_clicked();
|
|
void on_pushButton_delete_clicked();
|
|
void on_pushButton_preview_clicked();
|
|
void on_actionOpenFileIcon_triggered();
|
|
void on_actionOpen_Image_triggered();
|
|
void on_actionOpenImageIcon_triggered();
|
|
void on_actionAuto_Print_Dir_triggered();
|
|
void on_actionStart_triggered();
|
|
void on_actionStartIcon_triggered();
|
|
void on_actionPause_triggered();
|
|
void on_actionPauseIcon_triggered();
|
|
void on_actionAddMachine_triggered();
|
|
void on_actionDeletMachine_triggered();
|
|
void on_tableView_Connection_clicked(const QModelIndex &index);
|
|
void on_actionChinese_triggered();
|
|
void on_actionEnglish_triggered();
|
|
};
|
|
|
|
#endif // MAINWINDOW_H
|