diff options
-rw-r--r-- | filedisplay.cpp | 2 | ||||
-rw-r--r-- | helper.cpp | 11 | ||||
-rw-r--r-- | helper.h | 2 |
3 files changed, 7 insertions, 8 deletions
diff --git a/filedisplay.cpp b/filedisplay.cpp index 4a64f88..2b1c6d5 100644 --- a/filedisplay.cpp +++ b/filedisplay.cpp @@ -246,7 +246,7 @@ void FileData::FileDataRecursive(QJsonValue start, QStandardItem *appendTo){ for(it = startObject.constBegin(); it != startObject.constEnd(); ++it){ QVariantList data = QVariantList() << it.key() << it.value().toVariant(); if(it.key() == "duration"){ - qint64 seconds = static_cast<qint64>(it.value().toString().toDouble()); + int seconds = static_cast<int>(it.value().toString().toDouble()); Helper::Duration dur(seconds); data[1] = dur.toString(); } @@ -33,14 +33,14 @@ namespace Helper { do { read = file.read(data.data(), 4096); if(read > 0){ - h.addData(data.data(), read); + h.addData(data.data(), static_cast<int>(read)); } } while (read == 4096); QByteArray res = h.result(); retval = res.toHex().toLower(); }else{ QByteArray data(512, '\0'); - int offset = info.size() / 3; + qint64 offset = info.size() / 3; file.seek(offset); int numBytes = 512 * 1024; int readBytes = 0; @@ -51,7 +51,7 @@ namespace Helper { }else{ return QString(); } - h.addData(data.data(), read); + h.addData(data.data(), static_cast<int>(read)); } while(readBytes < numBytes); QByteArray res = h.result(); retval = res.toHex().toLower(); @@ -79,14 +79,13 @@ namespace Helper { QJsonDocument jDoc = ffpmegData(file); QJsonObject jObj = jDoc.object(); QJsonValue durationV = jObj["format"].toObject()["duration"]; - int seconds = durationV.toVariant().toDouble(); + int seconds = static_cast<int>(durationV.toVariant().toDouble()); int interval = seconds / 4; QImage img1 = snapshot(file, 60); QImage img2 = snapshot(file, interval * 2); QImage img3 = snapshot(file, interval * 3); QImage img4 = snapshot(file, seconds - 60); QImage retval(640 * 2 + 10, img1.height() * 2 + 10, QImage::Format_ARGB32); - //retval.fill(Qt::red); QPainter p(&retval); p.drawImage(0, 0, img1); p.drawImage(650, 0, img2); @@ -174,7 +173,7 @@ namespace Helper { Duration::Duration() : mHours(0), mMinutes(0), mSeconds(0) {} - Duration::Duration(qint64 seconds){ + Duration::Duration(int seconds){ int sec(0), min(0), h(0); // get hours h = (seconds / 60 / 60); @@ -17,7 +17,7 @@ namespace Helper { class Duration { public: Duration(); - Duration(qint64 seconds); + Duration(int seconds); Duration(const QString &dur); Duration operator+(const Duration &dur) const; const QString toString() const; |