| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- #include "importfile.h"
- ImportFile::ImportFile(NumberListModel *oldModel)
- {
- this->stop =false;
- this->oldModel = oldModel;
- this->all_file_size = 0;
- this->current_file_size = 0;
- this->step1Progress = 30;
- this->step2Progress = 70;
- }
- ImportFile::~ImportFile()
- {
- qDebug()<<"ImportProxy dead";
- LogHelper::writeLog("ipy trs ex");
- }
- void ImportFile::setFileList(QStringList list)
- {
- this->fileList = list;
- }
- void ImportFile::abort()
- {
- this->stop = true;
- }
- void ImportFile::setBuildType(NumberBuildType buildType)
- {
- //this->buildType = buildType;
- }
- void ImportFile::run()
- {
- this->all_file_size = 0;
- for(int i=0;i<this->fileList.size();i++)
- {
- QFileInfo fileInfo(this->fileList.at(i));
- int filesize = fileInfo.size();
- this->all_file_size += filesize;
- }
- /*emit progressMaxUpdated(all_file_size);
- for(int i=0;i<this->fileList.size();i++)
- {
- QFile file(this->fileList.at(i));
- if (file.open(QIODevice::ReadOnly))
- {
- QTextStream in(&file);
- QStringList readList;
- int current_file_size=0;
- while (!in.atEnd())
- {
- QString line = in.readLine();
- if(checkline(line))
- current_file_size +=line.size();
- readList.append(line);
- this->readnothing = false;
- if((readList.size()%pers==0 && readList.size()/pers>0) ||in.atEnd())
- {
- emit produced(current_file_size);
- //qDebug()<<"emit ";
- current_file_size = 0;
- free->acquire();
- mutex->lock();
- buffer->append(readList);
- mutex->unlock();
- used->release();
- readList.clear();
- }
- }
- }
- }
- }
- bool ImportFile::checkLine(QString line)
- {
- if(line.length()!=11 || line<"13000000000" || line>"18999999999")
- {
- return false;
- }
- else
- {
- return true;
- }*/
- }
|