QStringList ITmagesApplet::loadImgFromFolder(const QString folder) { QStringList files; QDirIterator dirit(folder, QDirIterator::Subdirectories); while (dirit.hasNext()) { if (dirit.fileName().contains(QRegExp("png$|jpg$|jpeg$|gif$", Qt::CaseInsensitive))) files.append(dirit.filePath()); dirit.next(); } return files; }
void BattleReport::init() { try { UInt32 maxid = 0; std::string sql = "SELECT maxid from reportid where type = 0"; if(_type) sql = "SELECT maxid from reportid where type = 1"; std::unique_ptr<DB::DBExecutor> execu(DB::gObjectDBConnectionMgr->GetExecutor()); if (execu.get() != NULL && execu->isConnected()) { GData::DBReportId dbexp; if(execu->Prepare(sql.c_str(), dbexp) == DB::DB_OK) { if(execu->Next() == DB::DB_OK) { maxid = dbexp.id; } else { DB1().PushUpdateData("insert into reportid values(0,%d)",_type); } } if (maxid > 0) { if(!_type) { lastMaxId0 = maxid; IDGenerator::gBattleOidGenerator0.Init(maxid); } else { lastMaxId1 = maxid; IDGenerator::gBattleOidGenerator1.Init(maxid); } return; } } DirectoryIterator dirit(_type ? cfg.reportPath1 : cfg.reportPath0); DirectoryIterator end; while (dirit != end) { DirectoryIterator dirit2(dirit.path().toString()); while (dirit2 != end) { DirectoryIterator dirit3(dirit2.path().toString()); while (dirit3 != end) { UInt32 id = atoi(dirit3.path().getBaseName().c_str()); if(id > 0) { if(id > maxid) maxid = id; //_reports[id].clear(); _reports.insert(std::make_pair(id, std::vector<UInt8>())); } ++dirit3; } ++dirit2; } ++dirit; } if(!_type) IDGenerator::gBattleOidGenerator0.Init(maxid); else IDGenerator::gBattleOidGenerator1.Init(maxid); } catch(...) { return; } }