解决另存为和导出,与保存路径文件同名时,未做替换文件提醒的问题
This commit is contained in:
parent
20ab0c7f80
commit
564083ec05
|
@ -1,4 +1,4 @@
|
||||||
#include "dialog_export.h"
|
#include "dialog_export.h"
|
||||||
#include "ui_dialog_export.h"
|
#include "ui_dialog_export.h"
|
||||||
#include <QButtonGroup>
|
#include <QButtonGroup>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
@ -86,6 +86,8 @@ Dialog_Export::Dialog_Export(int total, const std::vector<int> &selectedIndexs,
|
||||||
QRegExp rx("[^\\\\/:*?\"<>|]+$");
|
QRegExp rx("[^\\\\/:*?\"<>|]+$");
|
||||||
QRegExpValidator *pReg = new QRegExpValidator(rx, this);
|
QRegExpValidator *pReg = new QRegExpValidator(rx, this);
|
||||||
edit->setValidator(pReg);
|
edit->setValidator(pReg);
|
||||||
|
|
||||||
|
connect(edit, SIGNAL(editingFinished()), this, SLOT(on_editingFinished()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -340,6 +342,61 @@ void Dialog_Export::on_lineEdit_nominatePages_textChanged(const QString& arg1)
|
||||||
ui->lab_warning->setText(tr("Input is not valid.\nPage range will be 'Chosen Pages'."));
|
ui->lab_warning->setText(tr("Input is not valid.\nPage range will be 'Chosen Pages'."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Dialog_Export::on_editingFinished()
|
||||||
|
{
|
||||||
|
QString extName;
|
||||||
|
switch (m_suffix)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
extName = ".jpg";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
extName = ".bmp";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
extName = ".png";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
extName = ".ppm";
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
extName = ".pgm";
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
extName = ".pbm";
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
extName = ".tif";
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
extName = ".pdf";
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
extName = ".ofd";
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
extName = ".gif";
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
extName = ".pdf";
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
extName = ".ofd";
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
extName = ".rtf";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
QLineEdit* lineEdit = qobject_cast<QLineEdit*>(sender());
|
||||||
|
QString fileName = lineEdit->text();
|
||||||
|
|
||||||
|
if (!fileName.endsWith(extName))
|
||||||
|
{
|
||||||
|
lineEdit->setText(fileName + extName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef USE_FILE_DLG_WITHOUT_PROMPT
|
#ifdef USE_FILE_DLG_WITHOUT_PROMPT
|
||||||
void Dialog_Export::on_file_dialog_textChanged(const QString &path)
|
void Dialog_Export::on_file_dialog_textChanged(const QString &path)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef DIALOG_EXPORT_H
|
#ifndef DIALOG_EXPORT_H
|
||||||
#define DIALOG_EXPORT_H
|
#define DIALOG_EXPORT_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
@ -56,6 +56,7 @@ private slots:
|
||||||
void on_btn_option_clicked();
|
void on_btn_option_clicked();
|
||||||
void on_radio_nominatedPages_toggled(bool checked);
|
void on_radio_nominatedPages_toggled(bool checked);
|
||||||
void on_lineEdit_nominatePages_textChanged(const QString& arg1);
|
void on_lineEdit_nominatePages_textChanged(const QString& arg1);
|
||||||
|
void on_editingFinished();
|
||||||
|
|
||||||
#ifdef USE_FILE_DLG_WITHOUT_PROMPT
|
#ifdef USE_FILE_DLG_WITHOUT_PROMPT
|
||||||
void on_file_dialog_textChanged(const QString &path) override;
|
void on_file_dialog_textChanged(const QString &path) override;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "dialog_saveas.h"
|
#include "dialog_saveas.h"
|
||||||
#include "ui_dialog_saveas.h"
|
#include "ui_dialog_saveas.h"
|
||||||
#include "dialog_writesettings.h"
|
#include "dialog_writesettings.h"
|
||||||
#include "base/HGBase.h"
|
#include "base/HGBase.h"
|
||||||
|
@ -87,6 +87,8 @@ Dialog_SaveAs::Dialog_SaveAs(bool isSaveAs, QWidget *parent) :
|
||||||
QRegExp rx("[^\\\\/:*?\"<>|]+$");
|
QRegExp rx("[^\\\\/:*?\"<>|]+$");
|
||||||
QRegExpValidator *pReg = new QRegExpValidator(rx, this);
|
QRegExpValidator *pReg = new QRegExpValidator(rx, this);
|
||||||
edit->setValidator(pReg);
|
edit->setValidator(pReg);
|
||||||
|
|
||||||
|
connect(edit, SIGNAL(editingFinished()), this, SLOT(on_editingFinished()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,3 +286,58 @@ void Dialog_SaveAs::on_btn_option_clicked()
|
||||||
Dialog_WriteSettings dlg(m_suffix, this);
|
Dialog_WriteSettings dlg(m_suffix, this);
|
||||||
dlg.exec();
|
dlg.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Dialog_SaveAs::on_editingFinished()
|
||||||
|
{
|
||||||
|
QString extName;
|
||||||
|
switch (m_suffix)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
extName = ".jpg";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
extName = ".bmp";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
extName = ".png";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
extName = ".ppm";
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
extName = ".pgm";
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
extName = ".pbm";
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
extName = ".tif";
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
extName = ".pdf";
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
extName = ".ofd";
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
extName = ".gif";
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
extName = ".pdf";
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
extName = ".ofd";
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
extName = ".rtf";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
QLineEdit* lineEdit = qobject_cast<QLineEdit*>(sender());
|
||||||
|
QString fileName = lineEdit->text();
|
||||||
|
|
||||||
|
if (!fileName.endsWith(extName))
|
||||||
|
{
|
||||||
|
lineEdit->setText(fileName + extName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef DIALOG_SAVEAS_H
|
#ifndef DIALOG_SAVEAS_H
|
||||||
#define DIALOG_SAVEAS_H
|
#define DIALOG_SAVEAS_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
@ -27,6 +27,7 @@ private slots:
|
||||||
void on_dialog_accepted();
|
void on_dialog_accepted();
|
||||||
void on_filterSelected(const QString& filterName);
|
void on_filterSelected(const QString& filterName);
|
||||||
void on_btn_option_clicked();
|
void on_btn_option_clicked();
|
||||||
|
void on_editingFinished();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::Dialog_SaveAs *ui;
|
Ui::Dialog_SaveAs *ui;
|
||||||
|
|
Loading…
Reference in New Issue