mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
add elapsed time to the image name
Add elapsed time to the image name when inserting an image. Signed-off-by: Le Tan <tamlokveer@gmail.com>
This commit is contained in:
parent
3ae3462597
commit
de8b54afa7
@ -9,6 +9,7 @@
|
|||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
|
#include <QDateTime>
|
||||||
|
|
||||||
VUtils::VUtils()
|
VUtils::VUtils()
|
||||||
{
|
{
|
||||||
@ -71,6 +72,9 @@ QString VUtils::generateImageFileName(const QString &path, const QString &title,
|
|||||||
QString baseName(title.toLower());
|
QString baseName(title.toLower());
|
||||||
baseName.replace(regExp, "_");
|
baseName.replace(regExp, "_");
|
||||||
baseName.prepend('_');
|
baseName.prepend('_');
|
||||||
|
|
||||||
|
// Add current time to make the name be most likely unique
|
||||||
|
baseName = baseName + '_' + QString::number(QDateTime::currentDateTime().toTime_t());
|
||||||
QString imageName = baseName + "." + format.toLower();
|
QString imageName = baseName + "." + format.toLower();
|
||||||
QString filePath = QDir(path).filePath(imageName);
|
QString filePath = QDir(path).filePath(imageName);
|
||||||
int index = 1;
|
int index = 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user