|
|
@ -642,19 +642,31 @@ void UBFeaturesController::importImage(const QImage &image, const QString &fileN |
|
|
|
void UBFeaturesController::importImage( const QImage &image, const UBFeature &destination, const QString &fileName ) |
|
|
|
void UBFeaturesController::importImage( const QImage &image, const UBFeature &destination, const QString &fileName ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QString mFileName = fileName; |
|
|
|
QString mFileName = fileName; |
|
|
|
|
|
|
|
QString filePath; |
|
|
|
|
|
|
|
UBFeature dest = destination; |
|
|
|
if (mFileName.isNull()) { |
|
|
|
if (mFileName.isNull()) { |
|
|
|
QDateTime now = QDateTime::currentDateTime(); |
|
|
|
QDateTime now = QDateTime::currentDateTime(); |
|
|
|
mFileName = tr("ImportedImage") + "-" + now.toString("dd-MM-yyyy hh-mm-ss") + ".png"; |
|
|
|
static int imageCounter = 0; |
|
|
|
|
|
|
|
mFileName = tr("ImportedImage") + "-" + now.toString("dd-MM-yyyy hh-mm-ss"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
filePath = dest.getFullPath().toLocalFile() + "/" + mFileName; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (QFile::exists(filePath+".png")) |
|
|
|
|
|
|
|
mFileName += QString("-[%1]").arg(++imageCounter); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
imageCounter = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mFileName += ".png"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UBFeature dest = destination; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( !destination.getFullVirtualPath().startsWith( picturesElement.getFullVirtualPath(), Qt::CaseInsensitive ) ) |
|
|
|
if ( !destination.getFullVirtualPath().startsWith( picturesElement.getFullVirtualPath(), Qt::CaseInsensitive ) ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
dest = picturesElement; |
|
|
|
dest = picturesElement; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QString filePath = dest.getFullPath().toLocalFile() + "/" + mFileName; |
|
|
|
filePath = dest.getFullPath().toLocalFile() + "/" + mFileName; |
|
|
|
image.save(filePath); |
|
|
|
image.save(filePath); |
|
|
|
|
|
|
|
|
|
|
|
QImage thumb = createThumbnail( filePath ); |
|
|
|
QImage thumb = createThumbnail( filePath ); |
|
|
|