2023-11-20 03:08:06 +00:00
|
|
|
|
#ifndef MAINWINDOW_H
|
2022-05-03 10:25:52 +00:00
|
|
|
|
#define MAINWINDOW_H
|
|
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
|
|
|
|
#include <QLineEdit>
|
2022-07-07 08:16:41 +00:00
|
|
|
|
#include <QListWidgetItem>
|
2023-01-28 02:57:18 +00:00
|
|
|
|
#include <QTranslator>
|
2023-03-31 07:22:07 +00:00
|
|
|
|
#include <QtWidgets>
|
2023-04-08 08:33:36 +00:00
|
|
|
|
#include <QPropertyAnimation>
|
2022-05-03 10:25:52 +00:00
|
|
|
|
#include "HGImgView.h"
|
|
|
|
|
#include "HGImgThumb.h"
|
|
|
|
|
#include "dialog_aquireinto.h"
|
2023-04-08 08:33:36 +00:00
|
|
|
|
#include "widget_imgproc_base.h"
|
|
|
|
|
#include "widget_imgproc_sidebar.h"
|
2022-05-03 10:25:52 +00:00
|
|
|
|
#include "imgfmt/HGImgFmt.h"
|
2023-06-19 09:01:50 +00:00
|
|
|
|
#include "base/HGMsgPump.h"
|
2022-07-14 07:44:53 +00:00
|
|
|
|
#include "VersionDll.h"
|
2023-05-04 06:55:26 +00:00
|
|
|
|
#include "device_user.h"
|
2022-05-03 10:25:52 +00:00
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
};
|
|
|
|
|
|
2023-11-20 06:41:35 +00:00
|
|
|
|
typedef struct _save_opt
|
|
|
|
|
{
|
|
|
|
|
QString path;
|
|
|
|
|
int index;
|
|
|
|
|
int jpegQuality;
|
|
|
|
|
int tiffCompressionBW;
|
|
|
|
|
int tiffCompression;
|
|
|
|
|
int tiffQuality;
|
|
|
|
|
bool isOcr;
|
|
|
|
|
}SAVEOPT;
|
|
|
|
|
|
|
|
|
|
enum ScanType
|
|
|
|
|
{
|
|
|
|
|
ScanType_None,
|
|
|
|
|
ScanType_ScanToCache,
|
|
|
|
|
ScanType_SingleScanToCache,
|
|
|
|
|
ScanType_ScanInto,
|
|
|
|
|
ScanType_InsertScanInto
|
|
|
|
|
};
|
|
|
|
|
|
2022-05-03 10:25:52 +00:00
|
|
|
|
class MainWindow : public QMainWindow
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2023-01-29 03:18:42 +00:00
|
|
|
|
MainWindow(const QString& appLang, QWidget *parent = nullptr);
|
2022-05-03 10:25:52 +00:00
|
|
|
|
virtual ~MainWindow() override;
|
|
|
|
|
|
|
|
|
|
void exitFullScreen();
|
2023-06-19 06:52:49 +00:00
|
|
|
|
static HGResult saveImage(HGImage image, const HGImgFmtSaveInfo* info, bool ocr, const HGChar *fileName);
|
2022-11-24 09:02:26 +00:00
|
|
|
|
static QString getLogInfo(HGResult ret);
|
2023-11-20 06:41:35 +00:00
|
|
|
|
|
|
|
|
|
private:
|
2023-06-19 09:01:50 +00:00
|
|
|
|
static void HGAPI ocrThreadFunc(HGThread thread, HGPointer param);
|
|
|
|
|
static void HGAPI ocrMsgPumpFunc(HGMsgPump msgPump, const HGMsg* msg, HGPointer param);
|
2022-05-03 10:25:52 +00:00
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
|
2022-06-02 10:27:14 +00:00
|
|
|
|
void on_act_autoSave_triggered();
|
|
|
|
|
|
2023-05-19 07:50:47 +00:00
|
|
|
|
signals:
|
2023-05-20 03:47:19 +00:00
|
|
|
|
void post_new_image(QString fileName);
|
2023-09-21 03:09:42 +00:00
|
|
|
|
void preview_image();
|
2023-05-19 07:50:47 +00:00
|
|
|
|
|
2022-05-03 10:25:52 +00:00
|
|
|
|
private slots:
|
2023-03-06 09:01:57 +00:00
|
|
|
|
void on_AcquireInto2();
|
2023-03-31 07:22:07 +00:00
|
|
|
|
void on_reloadAcquireIntoCfg();
|
|
|
|
|
void on_m_acquireIntoCfg_changed(QString schemeName);
|
2023-08-14 03:53:48 +00:00
|
|
|
|
void on_keyDeleteDown();
|
2022-05-03 10:25:52 +00:00
|
|
|
|
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);
|
2022-05-14 05:22:20 +00:00
|
|
|
|
void on_thumbDrop(const QObject *source, const QStringList &fileNames, int pos);
|
|
|
|
|
void on_viewerDrop(const QObject *source, const QStringList &fileNames);
|
2022-05-03 10:25:52 +00:00
|
|
|
|
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();
|
2023-05-20 03:47:19 +00:00
|
|
|
|
void on_post_new_image(QString fileName);
|
2023-09-21 03:09:42 +00:00
|
|
|
|
void on_preview_image();
|
2023-05-04 06:55:26 +00:00
|
|
|
|
void on_newImage(void *image);
|
2023-10-17 02:47:24 +00:00
|
|
|
|
void on_abnormalImage(void *image, HGUInt *result);
|
2023-06-01 06:57:39 +00:00
|
|
|
|
void on_scanFinishEvent();
|
|
|
|
|
void on_scanWorkingEvent();
|
2023-12-04 01:07:03 +00:00
|
|
|
|
void on_clearRes();
|
2023-04-08 08:33:36 +00:00
|
|
|
|
void on_m_pbtn_push_clicked();
|
2023-04-08 10:43:46 +00:00
|
|
|
|
void on_dialog_sideBar_applyToImage(HGImage img, int brightness, int contrast, double gamma, bool enhanceText);
|
|
|
|
|
void on_dialog_sideBar_finish(bool ok);
|
2022-05-03 10:25:52 +00:00
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
|
2022-05-16 06:38:22 +00:00
|
|
|
|
void on_act_sortPages_triggered();
|
|
|
|
|
|
2022-07-07 08:16:41 +00:00
|
|
|
|
void on_actionact_update_triggered();
|
|
|
|
|
|
2022-07-20 09:30:27 +00:00
|
|
|
|
void on_act_feedback_triggered();
|
|
|
|
|
|
2022-07-26 05:44:44 +00:00
|
|
|
|
void on_act_driver_log_triggered();
|
|
|
|
|
|
|
|
|
|
void on_act_device_log_triggered();
|
|
|
|
|
|
2023-01-28 02:57:18 +00:00
|
|
|
|
void on_act_simpCN_triggered();
|
|
|
|
|
|
|
|
|
|
void on_act_English_triggered();
|
|
|
|
|
|
2023-02-03 02:21:33 +00:00
|
|
|
|
void on_act_deleteFile_triggered();
|
|
|
|
|
|
2023-05-04 06:55:26 +00:00
|
|
|
|
void on_act_selectDevice_triggered();
|
2022-05-10 10:15:37 +00:00
|
|
|
|
|
2022-05-03 10:25:52 +00:00
|
|
|
|
protected:
|
|
|
|
|
virtual void closeEvent(QCloseEvent *e) override;
|
2023-04-08 08:33:36 +00:00
|
|
|
|
virtual void resizeEvent(QResizeEvent *e) override;
|
2022-05-03 10:25:52 +00:00
|
|
|
|
|
|
|
|
|
private:
|
2022-10-12 03:51:41 +00:00
|
|
|
|
static void HGAPI CrashFunc(HGPointer crashAddr, HGPointer param);
|
2022-05-03 10:25:52 +00:00
|
|
|
|
|
2022-06-01 10:47:58 +00:00
|
|
|
|
QString getCacheFileName(HGImage img);
|
2022-05-03 10:25:52 +00:00
|
|
|
|
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);
|
2023-05-04 06:55:26 +00:00
|
|
|
|
bool judgeDiskSpace(QString currentPath);
|
2022-07-22 06:25:24 +00:00
|
|
|
|
void upgradeApp(QString pkgPath);
|
2023-02-22 07:18:06 +00:00
|
|
|
|
bool isLimitAccessFolder(int type); //type:1-aquire,2-aquireInto
|
2022-12-03 08:58:16 +00:00
|
|
|
|
static QString GetDevType(const QString& fwVersion, bool &canLock);
|
2022-11-29 07:42:18 +00:00
|
|
|
|
void deleteOverdueLogFile(const QString& logFilePath);
|
|
|
|
|
void deleteUpgradePkg(const QString& cfgFilePath);
|
2023-03-31 07:22:07 +00:00
|
|
|
|
void initAcquireIntoComboBox();
|
2023-04-08 08:33:36 +00:00
|
|
|
|
void updateSideBar();
|
2023-06-29 08:10:09 +00:00
|
|
|
|
void deleteDevUser();
|
2023-06-13 07:43:44 +00:00
|
|
|
|
|
|
|
|
|
#if !defined(HG_CMP_MSC)
|
2023-06-13 07:24:58 +00:00
|
|
|
|
void checkRollerLife();
|
2023-06-13 07:43:44 +00:00
|
|
|
|
#endif
|
2022-05-03 10:25:52 +00:00
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
Ui::MainWindow *ui;
|
2023-08-16 10:31:04 +00:00
|
|
|
|
bool m_canClose;
|
2023-05-04 06:55:26 +00:00
|
|
|
|
DeviceUserMgr *m_devUserMgr;
|
|
|
|
|
DeviceUser *m_devUser;
|
2023-12-02 08:29:10 +00:00
|
|
|
|
bool m_dsEnabled;
|
2023-03-06 09:01:57 +00:00
|
|
|
|
QAction *m_act_acquireInto2;
|
2023-03-31 07:22:07 +00:00
|
|
|
|
QComboBox *m_cbtn_acquireIntoCfg;
|
2023-01-28 07:32:08 +00:00
|
|
|
|
QString m_currLang;
|
2022-07-14 07:44:53 +00:00
|
|
|
|
VersionDll *m_versionDll;
|
2022-05-03 10:25:52 +00:00
|
|
|
|
QString m_password;
|
|
|
|
|
bool m_admin_loggedIn;
|
|
|
|
|
HGImgView *m_view;
|
|
|
|
|
HGImgThumb *m_thumb;
|
2023-08-08 10:06:03 +00:00
|
|
|
|
std::list<QString> m_curBatchFileList;
|
|
|
|
|
std::list<QString> m_curBatchTmpFileList;
|
2022-05-03 10:25:52 +00:00
|
|
|
|
QMenu *m_thumbMenu;
|
2023-01-28 07:32:08 +00:00
|
|
|
|
QMenu* m_menu_imageInsert;
|
2022-05-03 10:25:52 +00:00
|
|
|
|
QAction *m_moveToAction;
|
2023-01-28 07:32:08 +00:00
|
|
|
|
QAction* m_act_thumbGrid;
|
2022-07-07 08:16:41 +00:00
|
|
|
|
QListWidget* m_listwidget;
|
2023-01-28 07:32:08 +00:00
|
|
|
|
QMenu *m_menu_language;
|
2023-01-28 02:57:18 +00:00
|
|
|
|
QAction *m_act_simpCN;
|
|
|
|
|
QAction *m_act_English;
|
2023-04-08 08:33:36 +00:00
|
|
|
|
QPushButton *m_pbtn_push;
|
|
|
|
|
Widget_Imgproc_SideBar *m_widget_sideBar;
|
|
|
|
|
QPropertyAnimation *m_propertyAnimation;
|
|
|
|
|
QPropertyAnimation *m_propertyAnimation2;
|
2022-05-03 10:25:52 +00:00
|
|
|
|
|
2023-05-04 06:55:26 +00:00
|
|
|
|
bool auto_save_changes_;
|
|
|
|
|
bool save_from_changed_;
|
2023-11-20 06:41:35 +00:00
|
|
|
|
SAVEOPT auto_save_info_;
|
2023-02-06 08:18:47 +00:00
|
|
|
|
|
2022-05-03 10:25:52 +00:00
|
|
|
|
QString m_currFilePath;
|
|
|
|
|
int m_currIndex;
|
|
|
|
|
int m_multiPageCount;
|
|
|
|
|
int m_multiIndex;
|
|
|
|
|
bool m_modify; // m_view上面的图像是否改变
|
2023-11-20 06:41:35 +00:00
|
|
|
|
|
2023-08-08 10:06:03 +00:00
|
|
|
|
ScanType m_scanType; // 1-扫描到缓存目录,2-单张扫描到缓存目录,3-扫描到指定目录,4-插入扫描到指定目录
|
2022-05-03 10:25:52 +00:00
|
|
|
|
int m_scanInsertPos; // 扫描插入位置,-1表示插入到最后
|
2023-08-10 03:55:04 +00:00
|
|
|
|
int m_scanCurIndex;
|
2023-09-21 03:09:42 +00:00
|
|
|
|
HGLock m_lockPreviewImage;
|
|
|
|
|
HGImage m_previewImage;
|
2022-05-03 10:25:52 +00:00
|
|
|
|
QString m_scanFileName;
|
|
|
|
|
HGImgFmtWriter m_scanImgFmtWriter;
|
|
|
|
|
AquireIntoSaveParam m_aquireIntoSaveParam;
|
2022-05-16 02:43:51 +00:00
|
|
|
|
bool m_aquireIntoInBlank;
|
|
|
|
|
int m_aquireIntoBatchStartIndex;
|
|
|
|
|
int m_aquireIntoPageIndex;
|
|
|
|
|
int m_aquireIntoMultiPageCount;
|
2022-05-03 10:25:52 +00:00
|
|
|
|
bool m_isScanning;
|
2022-07-14 11:13:00 +00:00
|
|
|
|
bool m_closeTip;
|
2022-07-30 01:27:43 +00:00
|
|
|
|
int m_currScanCount;
|
2022-07-27 10:41:21 +00:00
|
|
|
|
QString m_devSerialNum;
|
|
|
|
|
QString m_devVersionNum;
|
2022-07-28 09:22:27 +00:00
|
|
|
|
QString m_currDeviceName;
|
2023-04-14 10:35:14 +00:00
|
|
|
|
QString m_devPid;
|
2023-01-13 05:56:24 +00:00
|
|
|
|
const char* m_oemName;
|
2022-11-24 15:48:08 +00:00
|
|
|
|
bool m_cacheDirNotify;
|
|
|
|
|
bool m_AquirePathNotify;
|
2023-04-08 08:33:36 +00:00
|
|
|
|
bool m_bSideflag;
|
2023-04-08 10:43:46 +00:00
|
|
|
|
bool m_bSideEditing;
|
2023-06-19 09:01:50 +00:00
|
|
|
|
HGMsgPump m_ocrMsgPump;
|
|
|
|
|
HGThread m_ocrThread;
|
2022-05-03 10:25:52 +00:00
|
|
|
|
|
|
|
|
|
class HGLineEdit* m_multiPageLineEdit;
|
|
|
|
|
class Widget_StatusBar *m_wndStatusBar;
|
2023-03-31 07:22:07 +00:00
|
|
|
|
class Dialog_AquireInto *m_dialogAcquireinto;
|
2022-05-03 10:25:52 +00:00
|
|
|
|
class Dialog_FullScreen *m_dlgFullScreen;
|
2023-06-19 09:01:50 +00:00
|
|
|
|
class Dialog_WaitingOcr *m_dlgWaitingOcr;
|
2022-05-03 10:25:52 +00:00
|
|
|
|
};
|
|
|
|
|
#endif // MAINWINDOW_H
|