344 lines
8.8 KiB
C++
344 lines
8.8 KiB
C++
#ifndef MAINWINDOW_H
|
||
#define MAINWINDOW_H
|
||
|
||
#include <QMainWindow>
|
||
#include <QLineEdit>
|
||
#include <QListWidgetItem>
|
||
#include <QTranslator>
|
||
#include <QtWidgets>
|
||
#include <QPropertyAnimation>
|
||
#include "HGImgView.h"
|
||
#include "HGImgThumb.h"
|
||
#include "dialog_aquireinto.h"
|
||
#include "widget_imgproc_base.h"
|
||
#include "widget_imgproc_sidebar.h"
|
||
#include "imgfmt/HGImgFmt.h"
|
||
#include "base/HGMsgPump.h"
|
||
#include "VersionDll.h"
|
||
#include "device_user.h"
|
||
|
||
QT_BEGIN_NAMESPACE
|
||
namespace Ui { class MainWindow; }
|
||
QT_END_NAMESPACE
|
||
|
||
class HGLineEdit : public QLineEdit
|
||
{
|
||
Q_OBJECT
|
||
public:
|
||
HGLineEdit(QWidget* parent)
|
||
: QLineEdit(parent)
|
||
{
|
||
|
||
}
|
||
|
||
protected:
|
||
void focusInEvent(QFocusEvent* e)
|
||
{
|
||
(void)e;
|
||
QString text = this->text();
|
||
QStringList list = text.split("/");
|
||
text = list.first();
|
||
this->setText(text);
|
||
this->selectAll();
|
||
|
||
QLineEdit::focusInEvent(e);
|
||
}
|
||
};
|
||
|
||
enum askIfClear
|
||
{
|
||
cancelScan = 0,
|
||
clearAndScan,
|
||
notClearAndScan
|
||
};
|
||
|
||
class MainWindow : public QMainWindow
|
||
{
|
||
Q_OBJECT
|
||
|
||
public:
|
||
MainWindow(const QString& appLang, QWidget *parent = nullptr);
|
||
virtual ~MainWindow() override;
|
||
|
||
void exitFullScreen();
|
||
static HGResult saveImage(HGImage image, const HGImgFmtSaveInfo* info, bool ocr, const HGChar *fileName);
|
||
static QString getLogInfo(HGResult ret);
|
||
static void HGAPI ocrThreadFunc(HGThread thread, HGPointer param);
|
||
static void HGAPI ocrMsgPumpFunc(HGMsgPump msgPump, const HGMsg* msg, HGPointer param);
|
||
|
||
private slots:
|
||
void on_act_90Left_triggered();
|
||
|
||
void on_act_90Right_triggered();
|
||
|
||
void on_act_180_triggered();
|
||
|
||
void on_act_fitWindowSize_triggered();
|
||
|
||
void on_act_fitWindowWidth_triggered();
|
||
|
||
void on_act_realSize_triggered();
|
||
|
||
void on_act_zoomIn_triggered();
|
||
|
||
void on_act_zoomOut_triggered();
|
||
|
||
void on_act_statusBar_triggered(bool checked);
|
||
|
||
void on_act_toolBar_triggered(bool checked);
|
||
|
||
void on_act_colorInfo_triggered(bool checked);
|
||
|
||
void on_act_fullscreen_triggered();
|
||
|
||
void on_act_autoSave_triggered();
|
||
|
||
signals:
|
||
void post_new_image(QString fileName);
|
||
|
||
private slots:
|
||
void on_AcquireInto2();
|
||
void on_reloadAcquireIntoCfg();
|
||
void on_m_acquireIntoCfg_changed(QString schemeName);
|
||
void on_itemCountChanged(int count);
|
||
void on_itemSelectingChanged();
|
||
void on_currItemChanged(int index);
|
||
void on_itemDoubleClicked(int index);
|
||
void on_thumbContextMenu(int index);
|
||
void on_viewerScale(double scale);
|
||
void on_viewerMousePos(int x, int y);
|
||
void on_thumbDrop(const QObject *source, const QStringList &fileNames, int pos);
|
||
void on_viewerDrop(const QObject *source, const QStringList &fileNames);
|
||
void on_viewerDblClick();
|
||
void on_act_moveTo_triggered();
|
||
void on_act_thumbGrid_triggered(bool checked);
|
||
void on_dialog_adjust_applyToImage(HGImage img);
|
||
void on_dialog_multirotate_refreshImgFile(const QString &fileName);
|
||
void on_multiPageLineEditFinished();
|
||
void on_clearCache();
|
||
void on_post_new_image(QString fileName);
|
||
void on_newImage(void *image);
|
||
void on_scanFinishEvent();
|
||
void on_scanWorkingEvent();
|
||
void on_m_pbtn_push_clicked();
|
||
void on_dialog_sideBar_applyToImage(HGImage img, int brightness, int contrast, double gamma, bool enhanceText);
|
||
void on_dialog_sideBar_finish(bool ok);
|
||
|
||
void on_act_thumbnailBar_triggered(bool checked);
|
||
|
||
void on_act_previous_triggered();
|
||
|
||
void on_act_next_triggered();
|
||
|
||
void on_act_first_triggered();
|
||
|
||
void on_act_last_triggered();
|
||
|
||
void on_act_openPageNum_triggered();
|
||
|
||
void on_act_previousPage_triggered();
|
||
|
||
void on_act_nextPage_triggered();
|
||
|
||
void on_act_firstPage_triggered();
|
||
|
||
void on_act_lastPage_triggered();
|
||
|
||
void on_act_adjust_triggered();
|
||
|
||
void on_act_open_triggered();
|
||
|
||
void on_act_insert_triggered();
|
||
|
||
void on_act_closeFile_triggered();
|
||
|
||
void on_act_closeAll_triggered();
|
||
|
||
void on_act_exit_triggered();
|
||
|
||
void on_act_save_triggered();
|
||
|
||
void on_act_saveAs_triggered();
|
||
|
||
void on_act_Export_triggered();
|
||
|
||
void on_act_imageInfo_triggered();
|
||
|
||
void on_act_multiRotate_triggered();
|
||
|
||
void on_act_autoCrop_triggered();
|
||
|
||
void on_act_signIn_triggered();
|
||
|
||
void on_act_passwordChange_triggered();
|
||
|
||
void on_act_signOut_triggered();
|
||
|
||
void on_act_log_triggered();
|
||
|
||
void on_act_clrCache_triggered();
|
||
|
||
void on_act_consume_triggered();
|
||
|
||
void on_act_clearRoller_triggered();
|
||
|
||
void on_act_help_triggered();
|
||
|
||
void on_act_about_triggered();
|
||
|
||
void on_act_scannerSettings_triggered();
|
||
|
||
void on_act_acquire_triggered();
|
||
|
||
void on_act_acquireSingle_triggered();
|
||
|
||
void on_act_acquireInto_triggered();
|
||
|
||
void on_act_insertFromScanner_triggered();
|
||
|
||
void on_act_imageEdit_triggered();
|
||
|
||
void on_act_sortPages_triggered();
|
||
|
||
void on_actionact_update_triggered();
|
||
|
||
void on_act_feedback_triggered();
|
||
|
||
void on_act_driver_log_triggered();
|
||
|
||
void on_act_device_log_triggered();
|
||
|
||
void on_act_simpCN_triggered();
|
||
|
||
void on_act_English_triggered();
|
||
|
||
void on_act_deleteFile_triggered();
|
||
|
||
void on_act_selectDevice_triggered();
|
||
|
||
protected:
|
||
virtual void closeEvent(QCloseEvent *e) override;
|
||
virtual void resizeEvent(QResizeEvent *e) override;
|
||
|
||
private:
|
||
static void HGAPI CrashFunc(HGPointer crashAddr, HGPointer param);
|
||
|
||
QString getCacheFileName(HGImage img);
|
||
HGImage createImage();
|
||
int getMultiPageCount();
|
||
void updateStatusBarPixelInfo();
|
||
void updateActionStatus();
|
||
void startSaveMessageBox(QWidget* parent);
|
||
askIfClear startScanMessageBox(QWidget* parent);
|
||
QString passwordEncrypt(const QString& password);
|
||
QString passwordDecrypt(const QString& transcode);
|
||
bool judgeDiskSpace(QString currentPath);
|
||
void upgradeApp(QString pkgPath);
|
||
bool isLimitAccessFolder(int type); //type:1-aquire,2-aquireInto
|
||
static QString GetDevType(const QString& fwVersion, bool &canLock);
|
||
void deleteOverdueLogFile(const QString& logFilePath);
|
||
void deleteUpgradePkg(const QString& cfgFilePath);
|
||
void initAcquireIntoComboBox();
|
||
void updateSideBar();
|
||
void deleteDevUser();
|
||
|
||
#if !defined(HG_CMP_MSC)
|
||
void checkRollerLife();
|
||
#endif
|
||
|
||
private:
|
||
Ui::MainWindow *ui;
|
||
DeviceUserMgr *m_devUserMgr;
|
||
DeviceUser *m_devUser;
|
||
QAction *m_act_acquireInto2;
|
||
QComboBox *m_cbtn_acquireIntoCfg;
|
||
QString m_currLang;
|
||
VersionDll *m_versionDll;
|
||
QString m_password;
|
||
bool m_admin_loggedIn;
|
||
HGImgView *m_view;
|
||
HGImgThumb *m_thumb;
|
||
std::list<QString> m_curBatchFileList;
|
||
std::list<QString> m_curBatchTmpFileList;
|
||
QMenu *m_thumbMenu;
|
||
QMenu* m_menu_imageInsert;
|
||
QAction *m_moveToAction;
|
||
QAction* m_act_thumbGrid;
|
||
QListWidget* m_listwidget;
|
||
QMenu *m_menu_language;
|
||
QAction *m_act_simpCN;
|
||
QAction *m_act_English;
|
||
QPushButton *m_pbtn_push;
|
||
Widget_Imgproc_SideBar *m_widget_sideBar;
|
||
QPropertyAnimation *m_propertyAnimation;
|
||
QPropertyAnimation *m_propertyAnimation2;
|
||
|
||
bool auto_save_changes_;
|
||
bool save_from_changed_;
|
||
typedef struct _save_opt
|
||
{
|
||
QString path;
|
||
int index;
|
||
int jpegQuality;
|
||
int tiffCompressionBW;
|
||
int tiffCompression;
|
||
int tiffQuality;
|
||
bool isOcr;
|
||
}SAVEOPT;
|
||
SAVEOPT auto_save_info_;
|
||
|
||
union VIDPID
|
||
{
|
||
struct
|
||
{
|
||
unsigned short VID;
|
||
unsigned short PID;
|
||
};
|
||
unsigned int Value;
|
||
};
|
||
|
||
QString m_currFilePath;
|
||
int m_currIndex;
|
||
int m_multiPageCount;
|
||
int m_multiIndex;
|
||
bool m_modify; // m_view上面的图像是否改变
|
||
enum ScanType
|
||
{
|
||
ScanType_None,
|
||
ScanType_ScanToCache,
|
||
ScanType_SingleScanToCache,
|
||
ScanType_ScanInto,
|
||
ScanType_InsertScanInto
|
||
};
|
||
ScanType m_scanType; // 1-扫描到缓存目录,2-单张扫描到缓存目录,3-扫描到指定目录,4-插入扫描到指定目录
|
||
int m_scanInsertPos; // 扫描插入位置,-1表示插入到最后
|
||
QString m_scanFileName;
|
||
HGImgFmtWriter m_scanImgFmtWriter;
|
||
AquireIntoSaveParam m_aquireIntoSaveParam;
|
||
bool m_aquireIntoInBlank;
|
||
int m_aquireIntoBatchStartIndex;
|
||
int m_aquireIntoPageIndex;
|
||
int m_aquireIntoMultiPageCount;
|
||
bool m_isScanning;
|
||
bool m_closeTip;
|
||
int m_currScanCount;
|
||
QString m_devSerialNum;
|
||
QString m_devVersionNum;
|
||
QString m_currDeviceName;
|
||
QString m_devPid;
|
||
const char* m_oemName;
|
||
bool m_cacheDirNotify;
|
||
bool m_AquirePathNotify;
|
||
bool m_bSideflag;
|
||
bool m_bSideEditing;
|
||
HGMsgPump m_ocrMsgPump;
|
||
HGThread m_ocrThread;
|
||
|
||
class HGLineEdit* m_multiPageLineEdit;
|
||
class Widget_StatusBar *m_wndStatusBar;
|
||
class Dialog_AquireInto *m_dialogAcquireinto;
|
||
class Dialog_FullScreen *m_dlgFullScreen;
|
||
class Dialog_WaitingOcr *m_dlgWaitingOcr;
|
||
};
|
||
#endif // MAINWINDOW_H
|