Changeset 127 for smplayer/vendor/current/src/findsubtitles
- Timestamp:
- Mar 29, 2012, 3:09:42 PM (13 years ago)
- Location:
- smplayer/vendor/current/src/findsubtitles
- Files:
-
- 2 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
smplayer/vendor/current/src/findsubtitles/findsubtitles.pro
r121 r127 11 11 HEADERS += simplehttp.h \ 12 12 osparser.h \ 13 ../filehash.h \ 13 14 ../lineedit_with_icon.h \ 14 15 ../filechooser.h \ … … 19 20 SOURCES += simplehttp.cpp \ 20 21 osparser.cpp \ 22 ../filehash.cpp \ 21 23 ../lineedit_with_icon.cpp \ 22 24 ../filechooser.cpp \ -
smplayer/vendor/current/src/findsubtitles/findsubtitleswindow.cpp
r121 r127 21 21 #include "simplehttp.h" 22 22 #include "osparser.h" 23 #include "filehash.h" 23 24 #include "languages.h" 24 25 #include <QStandardItemModel> … … 244 245 table->setRowCount(0); 245 246 246 QString hash = OSParser::calculateHash(filename);247 QString hash = FileHash::calculateHash(filename); 247 248 if (hash.isEmpty()) { 248 249 qWarning("FindSubtitlesWindow::setMovie: hash invalid. Doing nothing."); -
smplayer/vendor/current/src/findsubtitles/osparser.cpp
r121 r127 19 19 #include "osparser.h" 20 20 #include <QDomDocument> 21 #include <QFile>22 #include <QDataStream>21 //#include <QFile> 22 //#include <QDataStream> 23 23 24 24 OSParser::OSParser() { … … 81 81 } 82 82 83 // From the patch by Kamil Dziobek turbos11(at)gmail.com84 // (c) Kamil Dziobek turbos11(at)gmail.com | BSD or GPL or public domain85 QString OSParser::calculateHash(QString filename) {86 QFile file(filename);87 88 if (!file.exists()) {89 qWarning("OSParser:calculateHash: error hashing file. File doesn't exist.");90 return QString();91 }92 93 file.open(QIODevice::ReadOnly);94 QDataStream in(&file);95 in.setByteOrder(QDataStream::LittleEndian);96 quint64 size=file.size ();97 quint64 hash=size;98 quint64 a;99 for(int i = 0; i < 8192; i++) {100 in >> a ; hash += a;101 };102 file.seek(size-65536);103 for(int i = 0; i < 8192; i++) {104 in >> a ; hash += a;105 };106 107 QString hexhash = QString("%1").arg(hash, 16, 16, QChar('0'));108 109 return hexhash;110 }111 -
smplayer/vendor/current/src/findsubtitles/osparser.h
r121 r127 41 41 QList<OSSubtitle> subtitleList() { return s_list; }; 42 42 43 static QString calculateHash(QString filename);44 45 43 protected: 46 44 QDomDocument dom_document;
Note:
See TracChangeset
for help on using the changeset viewer.