85 lines
2.0 KiB
C++
85 lines
2.0 KiB
C++
#ifndef DIALOG_EXPORT_H
|
||
#define DIALOG_EXPORT_H
|
||
|
||
#include <QDialog>
|
||
#include <vector>
|
||
|
||
// u can ONLY comment following line if u want to use filedialog as system present !
|
||
#include "custom_file_dialog.h"
|
||
|
||
struct SupportType
|
||
{
|
||
public:
|
||
SupportType(const QString &e, const QString &t, int a)
|
||
{
|
||
ext = e;
|
||
title = t;
|
||
attr = a;
|
||
}
|
||
|
||
QString ext;
|
||
QString title;
|
||
int attr;
|
||
};
|
||
|
||
namespace Ui {
|
||
class Dialog_Export;
|
||
}
|
||
|
||
|
||
class Dialog_Export : public QDialog
|
||
#ifdef USE_FILE_DLG_WITHOUT_PROMPT
|
||
, public custom_file_dlg<Dialog_Export>
|
||
#endif
|
||
{
|
||
Q_OBJECT
|
||
|
||
|
||
public:
|
||
explicit Dialog_Export(int total, const std::vector<int> &selectedIndexs, QWidget *parent = nullptr);
|
||
~Dialog_Export();
|
||
|
||
QString getSavePath();
|
||
QString getSaveName();
|
||
QString getSaveExt();
|
||
int getJpegQuality();
|
||
int getTiffCompressionBW();
|
||
int getTiffCompression();
|
||
int getTiffQuality();
|
||
bool isOcr();
|
||
bool isSaveAsMultiPage();
|
||
void getSaveIndexs(std::vector<int> &indexs);
|
||
|
||
private slots:
|
||
void on_dialog_accepted();
|
||
void on_filterSelected(const QString& filterName);
|
||
void on_btn_option_clicked();
|
||
void on_radio_nominatedPages_toggled(bool checked);
|
||
void on_lineEdit_nominatePages_textChanged(const QString& arg1);
|
||
|
||
#ifdef USE_FILE_DLG_WITHOUT_PROMPT
|
||
void on_file_dialog_textChanged(const QString &path) override;
|
||
void on_file_dialog_returnPressed() override;
|
||
#endif
|
||
|
||
private:
|
||
bool isNominatedPagesLegal(const QString& page);
|
||
void makeSaveIndexs();
|
||
bool is_support_file_type(const QString& ext); // ext is like as '.bmp' '.png' ...
|
||
bool avoid_overwriting(const QString& path_file); // 判断文件是否存在,若存在则提示用户是否覆盖。返回true表示用户希望重新选择
|
||
|
||
private:
|
||
Ui::Dialog_Export *ui;
|
||
std::vector<SupportType> m_supportType;
|
||
int m_total;
|
||
std::vector<int> m_selectedIndexs;
|
||
|
||
QString m_savePath;
|
||
QString m_saveName;
|
||
QString m_saveExt;
|
||
std::vector<int> m_saveIndexs;
|
||
int m_suffix;
|
||
};
|
||
|
||
#endif // DIALOG_EXPORT_H
|