copy / move routine
This commit is contained in:
+16
-18
@@ -142,12 +142,15 @@ void cImportDialog::onThumbnailSelected(const QItemSelection& /*selection*/, con
|
||||
return;
|
||||
}
|
||||
|
||||
QModelIndex index = ui->m_lpThumbnailView->selectionModel()->selectedIndexes()[0];
|
||||
if(!index.isValid())
|
||||
return;
|
||||
for(int x = 0;x < ui->m_lpThumbnailView->selectionModel()->selectedIndexes().count();x++)
|
||||
{
|
||||
QModelIndex index = ui->m_lpThumbnailView->selectionModel()->selectedIndexes()[x];
|
||||
if(!index.isValid())
|
||||
return;
|
||||
|
||||
cPicture* lpPicture = m_lpThumbnailSortFilterProxyModel->data(index, Qt::UserRole+1).value<cPicture*>();
|
||||
lpToolBoxInfo->setPicture(lpPicture);
|
||||
cPicture* lpPicture = m_lpThumbnailSortFilterProxyModel->data(index, Qt::UserRole+1).value<cPicture*>();
|
||||
lpToolBoxInfo->setPicture(lpPicture);
|
||||
}
|
||||
}
|
||||
|
||||
void cImportDialog::onFolderSelected(const QItemSelection& /*selection*/, const QItemSelection& /*previous*/)
|
||||
@@ -244,25 +247,20 @@ void cImportDialog::onImport()
|
||||
{
|
||||
if(m_pictureList.find(lpPicture))
|
||||
{
|
||||
if(QMessageBox::question(this, tr("File Exists"), QString(tr("%1%2%3 already exists.\nDo you want to overwrite?").arg(lpPicture->filePath()).arg(QDir::separator()).arg(lpPicture->fileName()))) == QMessageBox::No)
|
||||
if(QMessageBox::question(this, tr("File Exists"), QString(tr("%1%2%3 already exists.\nDo you want to overwrite?").arg(lpPicture->filePath()).arg("/").arg(lpPicture->fileName()))) == QMessageBox::No)
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
ui->m_lpStatusText->setText(QString("importing %1 ...").arg(lpPicture->fileName()));
|
||||
qApp->processEvents();
|
||||
|
||||
QString szSource = lpPicture->filePath() + QDir::separator() + lpPicture->fileName();
|
||||
QString szDest = m_szRootPath + QDir::separator();
|
||||
QString szDestPath = "";
|
||||
QString szSource = lpPicture->filePath() + "/" + lpPicture->fileName();
|
||||
QString szDest = m_szRootPath + "/";
|
||||
QString szDestPath = picture2Path(lpPicture);
|
||||
|
||||
if(lpPicture->dateTime().isValid())
|
||||
szDestPath.append(QString::number(lpPicture->dateTime().date().year()) + QDir::separator() + lpPicture->dateTime().date().toString("yyyy-MM-dd") + QDir::separator());
|
||||
|
||||
if(!lpPicture->cameraModel().isEmpty())
|
||||
szDestPath.append(lpPicture->cameraModel().replace("/", "_").replace("\\", "_") + QDir::separator());
|
||||
|
||||
szDest.append(szDestPath);
|
||||
szDest.append(szDestPath + "/");
|
||||
szDest.append(lpPicture->fileName());
|
||||
szDest = szDest.replace("\\", "/");
|
||||
|
||||
// if(copyFile(ui->m_lpProgress, szSource, szDest, ui->m_lpMove->isChecked()))
|
||||
if(copyFile(ui->m_lpProgress, szSource, szDest, false))
|
||||
@@ -270,7 +268,7 @@ void cImportDialog::onImport()
|
||||
ui->m_lpTotalProgress->setValue(x+1);
|
||||
qApp->processEvents();
|
||||
|
||||
lpPicture->setFilePath(szDestPath.left(szDestPath.length()-1).replace("\\", "/"));
|
||||
lpPicture->setFilePath(szDestPath);
|
||||
lpPicture->toDB();
|
||||
m_pictureList.add(lpPicture);
|
||||
}
|
||||
@@ -300,7 +298,7 @@ void cImportDialog::readDirectory(const QString& szPath, bool bRecursive)
|
||||
szDirs.removeAll("..");
|
||||
|
||||
for(int x = 0;x < szDirs.count();x++)
|
||||
readDirectory(szPath + QDir::separator() + szDirs[x], bRecursive);
|
||||
readDirectory(szPath + "/" + szDirs[x], bRecursive);
|
||||
}
|
||||
|
||||
for(int x = 0;x < szFiles.count();x++)
|
||||
|
||||
+1
-1
@@ -140,7 +140,7 @@ private:
|
||||
|
||||
\fn savePosition
|
||||
*/
|
||||
void savePosition();
|
||||
void savePosition();
|
||||
protected:
|
||||
};
|
||||
|
||||
|
||||
+5
-4
@@ -467,7 +467,7 @@ void cMainWindow::onChangeDate()
|
||||
{
|
||||
cDateTimePicker dateTimePicker;
|
||||
dateTimePicker.setWindowTitle("Date");
|
||||
dateTimePicker.setText(QString(tr("Please set a new date for \"%1\".").arg(lpPicture->filePath() + QDir::separator() + lpPicture->fileName())));
|
||||
dateTimePicker.setText(QString(tr("Please set a new date for \"%1\".").arg(lpPicture->filePath() + "/" + lpPicture->fileName())));
|
||||
dateTimePicker.setImage(lpPicture->thumbnail());
|
||||
|
||||
dateTimePicker.setDateTime(lpPicture->dateTime());
|
||||
@@ -475,11 +475,12 @@ void cMainWindow::onChangeDate()
|
||||
return;
|
||||
|
||||
lpPicture->setDateTime(dateTimePicker.dateTime());
|
||||
QString szPath = QString::number(lpPicture->dateTime().date().year()) + "/" + lpPicture->dateTime().date().toString("yyyy-MM-dd");
|
||||
// QString szPath = QString::number(lpPicture->dateTime().date().year()) + "/" + lpPicture->dateTime().date().toString("yyyy-MM-dd");
|
||||
QString szPath = picture2Path(lpPicture);
|
||||
m_lpThumbnailSortFilterProxyModel->setData(index, QVariant::fromValue(szPath), Qt::UserRole+2);
|
||||
|
||||
if(copyFile(0, m_pictureLibrary.rootPath() + QDir::separator() + lpPicture->filePath() + QDir::separator() + lpPicture->fileName(),
|
||||
m_pictureLibrary.rootPath() + QDir::separator() + szPath + QDir::separator() + lpPicture->fileName(), true))
|
||||
if(copyFile(nullptr, m_pictureLibrary.rootPath() + "/" + lpPicture->filePath() + "/" + lpPicture->fileName(),
|
||||
m_pictureLibrary.rootPath() + "/" + szPath + "/" + lpPicture->fileName(), true))
|
||||
{
|
||||
lpPicture->setFilePath(szPath);
|
||||
lpPicture->toDB();
|
||||
|
||||
+16
-1
@@ -95,8 +95,23 @@ private:
|
||||
\fn initUI
|
||||
*/
|
||||
void initUI();
|
||||
void createActions(); /*!< TODO: describe */
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn createActions
|
||||
*/
|
||||
void createActions();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn createFileActions
|
||||
*/
|
||||
void createFileActions();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn createContextActions
|
||||
*/
|
||||
void createContextActions();
|
||||
|
||||
/*!
|
||||
|
||||
+38
-7
@@ -41,6 +41,36 @@ QByteArray image2Blob(const QImage &image)
|
||||
return(ba);
|
||||
}
|
||||
|
||||
QString picture2Path(cPicture* lpPicture, const QDateTime& newDate, const QString& szNewTitle)
|
||||
{
|
||||
QString szPath("");
|
||||
|
||||
if(newDate.isValid())
|
||||
szPath = newDate.toString("yyyy/yyyy-MM-dd");
|
||||
else if(lpPicture->dateTime().isValid())
|
||||
szPath = lpPicture->dateTime().toString("yyyy/yyyy-MM-dd");
|
||||
|
||||
if(!szNewTitle.isEmpty())
|
||||
{
|
||||
if(szPath.isEmpty())
|
||||
szPath = szNewTitle;
|
||||
else
|
||||
szPath.append(" - " + szNewTitle);
|
||||
}
|
||||
else if(!lpPicture->title().isEmpty())
|
||||
{
|
||||
if(szPath.isEmpty())
|
||||
szPath = lpPicture->title();
|
||||
else
|
||||
szPath.append(" - " + lpPicture->title());
|
||||
}
|
||||
|
||||
if(!lpPicture->cameraModel().isEmpty())
|
||||
szPath.append("/" + lpPicture->cameraModel().replace("/", "_").replace("\\", "_"));
|
||||
|
||||
return(szPath);
|
||||
}
|
||||
|
||||
QString ms2String(qint64 ms)
|
||||
{
|
||||
qint64 h = ms/3600000;
|
||||
@@ -81,7 +111,7 @@ QStandardItem* insertPath(QString szPath, QStandardItem* lpRootItem)
|
||||
if(!bFound)
|
||||
break;
|
||||
|
||||
szPath1.append(szPathList[path]+QDir::separator());
|
||||
szPath1.append(szPathList[path]+"/");
|
||||
}
|
||||
|
||||
for(;path < szPathList.count();path++)
|
||||
@@ -90,7 +120,7 @@ QStandardItem* insertPath(QString szPath, QStandardItem* lpRootItem)
|
||||
QStandardItem* lpNewItem = new QStandardItem(szPathList[path]);
|
||||
lpCurRoot->appendRow(lpNewItem);
|
||||
lpNewItem->setData(QVariant::fromValue(szPath1), Qt::UserRole+2);
|
||||
szPath1.append(QDir::separator());
|
||||
szPath1.append("/");
|
||||
|
||||
lpCurRoot = lpNewItem;
|
||||
}
|
||||
@@ -98,7 +128,6 @@ QStandardItem* insertPath(QString szPath, QStandardItem* lpRootItem)
|
||||
return(lpCurRoot);
|
||||
}
|
||||
|
||||
//bool copyFile(cImportDialog* lpImportDialog, const QString& szSource, const QString& szDest, bool bDelete)
|
||||
bool copyFile(QProgressBar* lpProgressBar, const QString& szSource, const QString& szDest, bool bDelete)
|
||||
{
|
||||
QString szDestPath;
|
||||
@@ -115,14 +144,16 @@ bool copyFile(QProgressBar* lpProgressBar, const QString& szSource, const QStrin
|
||||
if(file.exists(szDestFilePath))
|
||||
file.remove(szDestFilePath);
|
||||
|
||||
if(szSource[1] == ':' && szDest[1] == ':' && szSource[0] == szDest[0] && bDelete) // move
|
||||
{
|
||||
if(dir.rename(szSource, szDest))
|
||||
return(true);
|
||||
}
|
||||
|
||||
cCopier* lpCopier = new cCopier(szSource, szDest);
|
||||
|
||||
if(lpProgressBar)
|
||||
QObject::connect(lpCopier, SIGNAL(newStatus(int)), lpProgressBar, SLOT(setValue(int)));
|
||||
// connect(copier, SIGNAL(newStatus(QString)), this, SLOT(newStatus(QString)));
|
||||
// connect(copier, SIGNAL(finished()), SIGNAL(copyFinished()));
|
||||
// connect(copier, SIGNAL(finished()), copier, SLOT(deleteLater()));
|
||||
// connect(this, SIGNAL(stopCopy()), copier, SLOT(stop()));
|
||||
|
||||
QEventLoop loop;
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include "cimportdialog.h"
|
||||
|
||||
#include <QImage>
|
||||
#include "cpicture.h"
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QStandardItem>
|
||||
#include <QTreeView>
|
||||
@@ -47,6 +49,16 @@ QImage blob2Image(const QByteArray& ba);
|
||||
\return QByteArray
|
||||
*/
|
||||
QByteArray image2Blob(const QImage& image);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn picture2Path
|
||||
\param lpPicture
|
||||
\param newDate
|
||||
\param szNewTitle
|
||||
\return QString
|
||||
*/
|
||||
QString picture2Path(cPicture* lpPicture, const QDateTime& newDate = QDateTime(), const QString& szNewTitle = "");
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
+27
-7
@@ -21,6 +21,7 @@ cPicture::cPicture(qint32 iID, QObject *parent) :
|
||||
m_szFileName(""),
|
||||
m_szFilePath(""),
|
||||
m_iFileSize(0),
|
||||
m_szTitle(""),
|
||||
m_mimeType(""),
|
||||
m_imageWidth(0),
|
||||
m_imageHeight(0),
|
||||
@@ -99,18 +100,18 @@ bool cPicture::toDB()
|
||||
}
|
||||
|
||||
if(!query.next())
|
||||
query.prepare("INSERT INTO picture (fileName, filePath, fileSize, mimeType, imageWidth, imageHeight, imageOrientation, cameraMake, cameraModel, dateTime, fNumber, iso, flashID, focalLength, lensMake, lensModel, exposureTime, exposureBias, exifVersion, dateTimeOriginal, dateTimeDigitized, whiteBalance, focalLength35, gps, duration, thumbnail) VALUES (:fileName, :filePath, :fileSize, :mimeType, :imageWidth, :imageHeight, :imageOrientation, :cameraMake, :cameraModel, :dateTime, :fNumber, :iso, :flashID, :focalLength, :lensMake, :lensModel, :exposureTime, :exposureBias, :exifVersion, :dateTimeOriginal, :dateTimeDigitized, :whiteBalance, :focalLength35, :gps, :duration, :thumbnail);");
|
||||
query.prepare("INSERT INTO picture (fileName, fileSize, title, mimeType, imageWidth, imageHeight, imageOrientation, cameraMake, cameraModel, dateTime, fNumber, iso, flashID, focalLength, lensMake, lensModel, exposureTime, exposureBias, exifVersion, dateTimeOriginal, dateTimeDigitized, whiteBalance, focalLength35, gps, duration, thumbnail) VALUES (:fileName, ::fileSize, :title, :mimeType, :imageWidth, :imageHeight, :imageOrientation, :cameraMake, :cameraModel, :dateTime, :fNumber, :iso, :flashID, :focalLength, :lensMake, :lensModel, :exposureTime, :exposureBias, :exifVersion, :dateTimeOriginal, :dateTimeDigitized, :whiteBalance, :focalLength35, :gps, :duration, :thumbnail);");
|
||||
else
|
||||
query.prepare("UPDATE picture SET fileName=:fileName, filePath=:filePath, fileSize=:fileSize, mimeType=:mimeType, imageWidth=:imageWidth, imageHeight=:imageHeight, imageOrientation=:imageOrientation, cameraMake=:cameraMake, cameraModel=:cameraModel, dateTime=:dateTime, fNumber=:fNumber, iso=:iso, flashID=:flashID, focalLength=:focalLength, lensMake=:lensMake, lensModel=:lensModel, exposureTime=:exposureTime, exposureBias=:exposureBias, exifVersion=:exifVersion, dateTimeOriginal=:dateTimeOriginal, dateTimeDigitized=:dateTimeDigitized, whiteBalance=:whiteBalance, focalLength35=:focalLength35, gps=:gps, duration=:duration, thumbnail=:thumbnail WHERE id=:id;");
|
||||
query.prepare("UPDATE picture SET fileName=:fileName, fileSize=:fileSize, title=:title, mimeType=:mimeType, imageWidth=:imageWidth, imageHeight=:imageHeight, imageOrientation=:imageOrientation, cameraMake=:cameraMake, cameraModel=:cameraModel, dateTime=:dateTime, fNumber=:fNumber, iso=:iso, flashID=:flashID, focalLength=:focalLength, lensMake=:lensMake, lensModel=:lensModel, exposureTime=:exposureTime, exposureBias=:exposureBias, exifVersion=:exifVersion, dateTimeOriginal=:dateTimeOriginal, dateTimeDigitized=:dateTimeDigitized, whiteBalance=:whiteBalance, focalLength35=:focalLength35, gps=:gps, duration=:duration, thumbnail=:thumbnail WHERE id=:id;");
|
||||
}
|
||||
else
|
||||
query.prepare("INSERT INTO picture (fileName, filePath, fileSize, mimeType, imageWidth, imageHeight, imageOrientation, cameraMake, cameraModel, dateTime, fNumber, iso, flashID, focalLength, lensMake, lensModel, exposureTime, exposureBias, exifVersion, dateTimeOriginal, dateTimeDigitized, whiteBalance, focalLength35, gps, duration, thumbnail) VALUES (:fileName, :filePath, :fileSize, :mimeType, :imageWidth, :imageHeight, :imageOrientation, :cameraMake, :cameraModel, :dateTime, :fNumber, :iso, :flashID, :focalLength, :lensMake, :lensModel, :exposureTime, :exposureBias, :exifVersion, :dateTimeOriginal, :dateTimeDigitized, :whiteBalance, :focalLength35, :gps, :duration, :thumbnail);");
|
||||
query.prepare("INSERT INTO picture (fileName, fileSize, title, mimeType, imageWidth, imageHeight, imageOrientation, cameraMake, cameraModel, dateTime, fNumber, iso, flashID, focalLength, lensMake, lensModel, exposureTime, exposureBias, exifVersion, dateTimeOriginal, dateTimeDigitized, whiteBalance, focalLength35, gps, duration, thumbnail) VALUES (:fileName, :fileSize, :title, :mimeType, :imageWidth, :imageHeight, :imageOrientation, :cameraMake, :cameraModel, :dateTime, :fNumber, :iso, :flashID, :focalLength, :lensMake, :lensModel, :exposureTime, :exposureBias, :exifVersion, :dateTimeOriginal, :dateTimeDigitized, :whiteBalance, :focalLength35, :gps, :duration, :thumbnail);");
|
||||
|
||||
|
||||
query.bindValue(":id", m_iID);
|
||||
query.bindValue(":fileName", m_szFileName);
|
||||
query.bindValue(":filePath", m_szFilePath);
|
||||
query.bindValue(":fileSize", m_iFileSize);
|
||||
query.bindValue(":title", m_szTitle);
|
||||
query.bindValue(":mimeType", m_mimeType);
|
||||
query.bindValue(":imageWidth", m_imageWidth);
|
||||
query.bindValue(":imageHeight", m_imageHeight);
|
||||
@@ -170,6 +171,16 @@ qint32 cPicture::id()
|
||||
return(m_iID);
|
||||
}
|
||||
|
||||
void cPicture::setTitle(const QString &title)
|
||||
{
|
||||
m_szTitle = title;
|
||||
}
|
||||
|
||||
QString cPicture::title()
|
||||
{
|
||||
return(m_szTitle);
|
||||
}
|
||||
|
||||
void cPicture::setMimeType(const QString &mimeType)
|
||||
{
|
||||
m_mimeType = mimeType;
|
||||
@@ -446,6 +457,8 @@ bool cPicture::operator==(const cPicture& other) const
|
||||
return(false);
|
||||
if(this->m_iFileSize != other.m_iFileSize)
|
||||
return(false);
|
||||
if(this->m_szTitle != other.m_szTitle)
|
||||
return(false);
|
||||
if(this->m_mimeType != other.m_mimeType)
|
||||
return(false);
|
||||
if(this->m_imageWidth != other.m_imageWidth)
|
||||
@@ -500,6 +513,8 @@ bool cPicture::operator==(const cPicture*& other) const
|
||||
return(false);
|
||||
if(this->m_iFileSize != other->m_iFileSize)
|
||||
return(false);
|
||||
if(this->m_szTitle != other->m_szTitle)
|
||||
return(false);
|
||||
if(this->m_mimeType != other->m_mimeType)
|
||||
return(false);
|
||||
if(this->m_imageWidth != other->m_imageWidth)
|
||||
@@ -554,6 +569,8 @@ bool cPicture::operator==(const cPicture* other) const
|
||||
return(false);
|
||||
if(this->m_iFileSize != other->m_iFileSize)
|
||||
return(false);
|
||||
if(this->m_szTitle != other->m_szTitle)
|
||||
return(false);
|
||||
if(this->m_mimeType != other->m_mimeType)
|
||||
return(false);
|
||||
if(this->m_imageWidth != other->m_imageWidth)
|
||||
@@ -608,6 +625,8 @@ bool cPicture::operator==(cPicture* other)
|
||||
return(false);
|
||||
if(this->m_iFileSize != other->m_iFileSize)
|
||||
return(false);
|
||||
if(this->m_szTitle != other->m_szTitle)
|
||||
return(false);
|
||||
if(this->m_mimeType != other->m_mimeType)
|
||||
return(false);
|
||||
if(this->m_imageWidth != other->m_imageWidth)
|
||||
@@ -684,8 +703,8 @@ bool cPictureList::load(cSplashScreen *lpSplashScreen, QProgressBar *lpProgressB
|
||||
|
||||
query.prepare("SELECT id, "
|
||||
" fileName, "
|
||||
" filePath, "
|
||||
" fileSize, "
|
||||
" title, "
|
||||
" mimeType, "
|
||||
" imageWidth, "
|
||||
" imageHeight, "
|
||||
@@ -710,7 +729,7 @@ bool cPictureList::load(cSplashScreen *lpSplashScreen, QProgressBar *lpProgressB
|
||||
" duration, "
|
||||
" thumbnail "
|
||||
"FROM picture "
|
||||
"ORDER BY filePath, "
|
||||
"ORDER BY dateTime, "
|
||||
" UPPER(fileName);");
|
||||
|
||||
if(!query.exec())
|
||||
@@ -729,8 +748,8 @@ bool cPictureList::load(cSplashScreen *lpSplashScreen, QProgressBar *lpProgressB
|
||||
{
|
||||
cPicture* lpPicture = add(query.value("id").toInt(), true);
|
||||
lpPicture->setFileName(query.value("fileName").toString());
|
||||
lpPicture->setFilePath(query.value("filePath").toString());
|
||||
lpPicture->setFileSize(query.value("fileSize").toLongLong());
|
||||
lpPicture->setTitle(query.value("title").toString());
|
||||
lpPicture->setMimeType(query.value("mimeType").toString());
|
||||
lpPicture->setImageWidth(query.value("imageWidth").toInt());
|
||||
lpPicture->setImageHeight(query.value("imageHeight").toInt());
|
||||
@@ -755,6 +774,7 @@ bool cPictureList::load(cSplashScreen *lpSplashScreen, QProgressBar *lpProgressB
|
||||
lpPicture->setGPS(query.value("gps").toString());
|
||||
lpPicture->setDuration(query.value("duration").toLongLong());
|
||||
lpPicture->setThumbnail(blob2Image(query.value("thumbnail").toByteArray()));
|
||||
lpPicture->setFilePath(picture2Path(lpPicture));
|
||||
|
||||
count++;
|
||||
if(!(count % step))
|
||||
|
||||
+16
@@ -83,6 +83,21 @@ public:
|
||||
*/
|
||||
QString mimeType();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn setTitle
|
||||
\param title
|
||||
*/
|
||||
void setTitle(const QString& title);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn title
|
||||
\return QString
|
||||
*/
|
||||
QString title();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
@@ -518,6 +533,7 @@ private:
|
||||
QString m_szFileName; /*!< TODO: describe */
|
||||
QString m_szFilePath; /*!< TODO: describe */
|
||||
qint64 m_iFileSize; /*!< TODO: describe */
|
||||
QString m_szTitle; /*!< TODO: describe */
|
||||
QImage m_thumbnail; /*!< TODO: describe */
|
||||
QString m_mimeType; /*!< TODO: describe */
|
||||
qint32 m_imageWidth; /*!< TODO: describe */
|
||||
|
||||
+2
-2
@@ -25,7 +25,7 @@ bool cPictureLibrary::openDatabase()
|
||||
QSettings settings;
|
||||
m_szRootPath = settings.value("database/rootPath", QDir::homePath()).toString();
|
||||
|
||||
QString szDB = m_szRootPath + QDir::separator() + "pictureLibrary.db";
|
||||
QString szDB = m_szRootPath + "/" + "pictureLibrary.db";
|
||||
|
||||
m_db = QSqlDatabase::addDatabase("QSQLITE");
|
||||
m_db.setHostName("localhost");
|
||||
@@ -103,9 +103,9 @@ bool cPictureLibrary::createDatabase()
|
||||
if(!createTable("CREATE TABLE picture ( "
|
||||
" id INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE, "
|
||||
" fileName TEXT, "
|
||||
" filePath TEXT, "
|
||||
" fileSize BIGINT, "
|
||||
" mimeType TEXT, "
|
||||
" title TEXT, "
|
||||
" imageWidth INTEGER, "
|
||||
" imageHeight INTEGER, "
|
||||
" imageOrientation INTEGER, "
|
||||
|
||||
@@ -28,5 +28,5 @@ bool cThumbnailSortFilterProxyModel::filterAcceptsRow(int sourceRow, const QMode
|
||||
{
|
||||
QModelIndex index0 = sourceModel()->index(sourceRow, 0, sourceParent);
|
||||
QString tmp = sourceModel()->data(index0, Qt::UserRole+2).toString();
|
||||
return(sourceModel()->data(index0, Qt::UserRole+2).toString().contains(m_szPath));
|
||||
return(sourceModel()->data(index0, Qt::UserRole+2).toString().startsWith(m_szPath));
|
||||
}
|
||||
|
||||
+25
-27
@@ -23,27 +23,35 @@ cToolBoxInfo::~cToolBoxInfo()
|
||||
|
||||
void cToolBoxInfo::setPicture(cPicture* lpPicture)
|
||||
{
|
||||
if(!lpPicture)
|
||||
{
|
||||
ui->m_lpFileNamePicture->setText("---");
|
||||
ui->m_lpPathPicture->setText("---");
|
||||
ui->m_lpDatePicture->setText("---");
|
||||
ui->m_lpSizePicture->setText("---");
|
||||
ui->m_lpCameraPicture->setText("---");
|
||||
ui->m_lpLensModelPicture->setText("---");
|
||||
ui->m_lpFNumberPicture->setText("---");
|
||||
ui->m_lpExposureTimePicture->setText("---");
|
||||
ui->m_lpExposureBiasPicture->setText("---");
|
||||
ui->m_lpISOPicture->setText("---");
|
||||
ui->m_lpFocalLengthPicture->setText("---");
|
||||
ui->m_lpFlashPicture->setText("---");
|
||||
ui->m_lpGPSPicture->setText("---");
|
||||
|
||||
ui->m_lpFileNameVideo->setText("---");
|
||||
ui->m_lpPathVideo->setText("---");
|
||||
ui->m_lpDateVideo->setText("---");
|
||||
ui->m_lpSizeVideo->setText("---");
|
||||
ui->m_lpCameraVideo->setText("---");
|
||||
ui->m_lpDurationVideo->setText("---");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(lpPicture->mimeType().startsWith("image"))
|
||||
{
|
||||
ui->m_lpCategory->setCurrentIndex(0);
|
||||
if(!lpPicture)
|
||||
{
|
||||
ui->m_lpFileNamePicture->setText("---");
|
||||
ui->m_lpPathPicture->setText("---");
|
||||
ui->m_lpDatePicture->setText("---");
|
||||
ui->m_lpSizePicture->setText("---");
|
||||
ui->m_lpCameraPicture->setText("---");
|
||||
ui->m_lpLensModelPicture->setText("---");
|
||||
ui->m_lpFNumberPicture->setText("---");
|
||||
ui->m_lpExposureTimePicture->setText("---");
|
||||
ui->m_lpExposureBiasPicture->setText("---");
|
||||
ui->m_lpISOPicture->setText("---");
|
||||
ui->m_lpFocalLengthPicture->setText("---");
|
||||
ui->m_lpFlashPicture->setText("---");
|
||||
ui->m_lpGPSPicture->setText("---");
|
||||
return;
|
||||
}
|
||||
|
||||
ui->m_lpFileNamePicture->setText(lpPicture->fileName());
|
||||
ui->m_lpPathPicture->setText(lpPicture->filePath());
|
||||
@@ -62,16 +70,6 @@ void cToolBoxInfo::setPicture(cPicture* lpPicture)
|
||||
else
|
||||
{
|
||||
ui->m_lpCategory->setCurrentIndex(1);
|
||||
if(!lpPicture)
|
||||
{
|
||||
ui->m_lpFileNameVideo->setText("---");
|
||||
ui->m_lpPathVideo->setText("---");
|
||||
ui->m_lpDateVideo->setText("---");
|
||||
ui->m_lpSizeVideo->setText("---");
|
||||
ui->m_lpCameraVideo->setText("---");
|
||||
ui->m_lpDurationVideo->setText("---");
|
||||
return;
|
||||
}
|
||||
|
||||
ui->m_lpFileNameVideo->setText(lpPicture->fileName());
|
||||
ui->m_lpPathVideo->setText(lpPicture->filePath());
|
||||
|
||||
Reference in New Issue
Block a user