另存为增加使用当前日期建立子文件夹
This commit is contained in:
parent
5b3b400b17
commit
86a3847741
Binary file not shown.
|
@ -1465,6 +1465,11 @@ Please make sure the two passwords are the same.</source>
|
|||
<source>Compression Option</source>
|
||||
<translation>压缩选项</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dialog_saveas.ui" line="32"/>
|
||||
<source>Use subfolder based on current date</source>
|
||||
<translation>使用当前日期建立子文件夹</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Dialog_SaveQuality</name>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "app_cfg.h"
|
||||
#include <assert.h>
|
||||
#include <qabstractproxymodel.h>
|
||||
#include <QDateTime>
|
||||
|
||||
class del_delegate : public QAbstractProxyModel
|
||||
{
|
||||
|
@ -99,6 +100,9 @@ Dialog_SaveAs::Dialog_SaveAs(QWidget *parent) :
|
|||
m_suffix = 0;
|
||||
ui->fileDialog->selectNameFilter(ui->fileDialog->nameFilters().at(m_suffix));
|
||||
ui->btn_option->setEnabled(0 == m_suffix || 3 == m_suffix);
|
||||
ui->cbox_subFolder->setChecked(false);
|
||||
|
||||
ui->cbox_subFolder->setChecked(getCfgValue("saveAs", "subFolderByTime", false));
|
||||
}
|
||||
|
||||
Dialog_SaveAs::~Dialog_SaveAs()
|
||||
|
@ -183,13 +187,27 @@ void Dialog_SaveAs::on_dialog_accepted()
|
|||
{
|
||||
QString path = selectedFile.left(pos + 1);
|
||||
QString name = selectedFile.right(selectedFile.count() - pos - 1);
|
||||
|
||||
bool checked = ui->cbox_subFolder->isChecked();
|
||||
QString dirName = NULL;
|
||||
if(checked)
|
||||
{
|
||||
dirName = path + QDateTime::currentDateTime().toString("yy-MM-dd hh.mm.ss");
|
||||
QDir dir(dirName);
|
||||
if(!dir.exists())
|
||||
{
|
||||
dir.mkdir(dirName);
|
||||
}
|
||||
}
|
||||
path = dirName;
|
||||
if(name.endsWith(extName))
|
||||
m_savePath = getStdFileName(path + name);
|
||||
m_savePath = getStdFileName(path + "/" + name);
|
||||
else
|
||||
m_savePath = getStdFileName(path + name + extName);
|
||||
m_savePath = getStdFileName(path + "/" + name + extName);
|
||||
}
|
||||
|
||||
saveCfgValue("saveAs", "suffix", m_suffix);
|
||||
saveCfgValue("saveAs", "subFolderByTime", ui->cbox_subFolder->isChecked());
|
||||
accept();
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<property name="windowTitle">
|
||||
<string>Save As</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QFileDialog" name="fileDialog" native="true"/>
|
||||
</item>
|
||||
|
@ -26,6 +26,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cbox_subFolder">
|
||||
<property name="text">
|
||||
<string>Use subfolder based on current date</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
|
|
|
@ -1171,6 +1171,10 @@ Please make sure the two passwords are the same.</source>
|
|||
<source>Compression Option</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Use subfolder based on current date</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Dialog_WriteSettings</name>
|
||||
|
|
Loading…
Reference in New Issue