void MusicDataDownloadThread::downLoadFinished() { if(!m_file) { deleteAll(); return; } m_timer.stop(); m_file->flush(); m_file->close(); QVariant redirectionTarget = m_reply->attribute(QNetworkRequest::RedirectionTargetAttribute); if(m_reply->error()) { m_file->remove(); } else if(!redirectionTarget.isNull()) { m_redirection = true; m_reply->deleteLater(); m_file->open(QIODevice::WriteOnly); m_file->resize(0); startRequest(m_reply->url().resolved(redirectionTarget.toUrl())); return; } else { emit downLoadDataChanged("Data"); M_LOGGER_INFO("data download has finished!"); } deleteAll(); }
void HCTree::deleteAll(HCNode *root) { if (root == 0) return; deleteAll(root->c0); deleteAll(root->c1); delete(root); root = 0; }
void Parser::close(void) { if (file) { gzclose(file); file = NULL; } deleteAll(calls); deleteAll(functions); deleteAll(structs); deleteAll(enums); deleteAll(bitmasks); }
void deleteAllWorld(){ deleteAll(wWalls); deleteAll(wEntities); deleteAll(wSoftEntities); //delete every light and set it to null for(int i=0; i<LIGHT_COUNT;i++){ if(wLights[i]!=NULL){ delete wLights[i]; wLights[i]=NULL; } } }
void MusicRadioSongsThread::downLoadFinished() { if(m_reply == nullptr) { deleteAll(); return; } if(m_reply->error() == QNetworkReply::NoError) { QByteArray bytes = m_reply->readAll(); #ifdef MUSIC_QT_5 QJsonParseError jsonError; QJsonDocument parseDoucment = QJsonDocument::fromJson(bytes, &jsonError); ///Put the data into Json if(jsonError.error != QJsonParseError::NoError || !parseDoucment.isObject()) { deleteAll(); return ; } QJsonObject jsonObject = parseDoucment.object(); if(jsonObject.contains("data")) { jsonObject = jsonObject.value("data").toObject(); if(jsonObject.contains("songList")) { QJsonArray array = jsonObject.value("songList").toArray(); foreach(QJsonValue value, array) { if(!value.isObject()) { continue; } QJsonObject object = value.toObject(); m_songInfo.m_songUrl = object.value("songLink").toString(); m_songInfo.m_songName = object.value("songName").toString(); m_songInfo.m_artistName = object.value("artistName").toString(); m_songInfo.m_songPicUrl = object.value("songPicRadio").toString(); m_songInfo.m_albumName = object.value("albumName").toString(); QString lrcLink = object.value("lrcLink").toString(); if(!lrcLink.contains( LRC_PREFIX )) { lrcLink = LRC_PREFIX + lrcLink; } m_songInfo.m_lrcUrl = lrcLink; } }
/*! The SLRefGroup::shapeInit checks the validity of the referenced node. To avoid endless loops a refShape node is not allowed to refShape its ancestors. An ancestor of a refShape node is group node followed along the previous pointers with lower depth than the depth of the refShape node. */ void SLRefGroup::shapeInit(SLSceneView* sv) { // cummulate wm with referenced wm SLShape* ref = (SLShape*)_refGroup; _wm *= ref->m(); _wmI.setMatrix(_wm.inverse()); _wmN.setMatrix(_wmI.mat3()); _wmN.transpose(); // check circular references SLNode* parent = this->parent(); while (parent) { if (parent==_refGroup) SL_EXIT_MSG("Reference node produces a never ending loop."); parent = parent->parent(); } // set transparency flag _aabb.hasAlpha(((SLShape*)_refGroup)->aabb()->hasAlpha()); // delete all child references if (_first) deleteAll(); // loop through the referenced group and add a SLRefShape or SLRefGroup SLNode* current = ((SLGroup*)_refGroup)->first(); while (current) { if (typeid(*current)==typeid(SLGroup)) addNode(new SLRefGroup((SLGroup*)current, name()+"_"+current->name())); else addNode(new SLRefShape((SLShape*)current, name()+"_"+current->name())); ((SLShape*)_last)->wm(_wm); ((SLShape*)_last)->depth(depth()+1); ((SLShape*)_last)->shapeInit(sv); current = current->next(); } }
PluginManager::~PluginManager() { writeSettings(); stopAll(); deleteAll(); qDeleteAll(m_pluginSpecs); }
void Parser::setBookmark(const ParseBookmark &bookmark) { file->setCurrentOffset(bookmark.offset); next_call_no = bookmark.next_call_no; // Simply ignore all pending calls deleteAll(calls); }
int main(int argc, char *argv[]){ if(argc<3){ printf("useage:./solve file time_limit\n"); return 0; } srand(11); read_inst(argv[1]); int time_limit=atoi(argv[2]); //solveIP(10); solveLP(); cpu_time(); int cnt=0; double ratio=0.5; int i=len_rdCost1-1; double maxRdc=0.0; maxIte=n*10; while(cpu_time()<time_limit && maxRdc<UB-LB-EPSILON){ double t_remain=time_limit-cpu_time(); if(t_remain<EPSILON) break; if(i<0) maxRdc= UB - LB; else maxRdc=rdCost_sort1[i].value-EPSILON; printf("iteration %d, cup_time:%lf, maxRdc %lf, LB =%lf\n", cnt, cpu_time(),maxRdc, LB); solveIP(t_remain,cnt, maxRdc); cnt++; printf("--------------\n\n"); i--; //while(i>=0&&rdCost_sort1[i].value<maxRdc+0.1){i--;} } printf("best LB is %lf, cpu_time %lf\n", LB, cpu_time()); deleteAll(); return 0; }
void MusicDownLoadQueryKWThread::startToPage(int offset) { if(!m_manager) { return; } M_LOGGER_INFO(QString("%1 startToPage %2").arg(getClassName()).arg(offset)); deleteAll(); QUrl musicUrl = MusicUtils::Algorithm::mdII(KW_SONG_SEARCH_URL, false) .arg(m_searchText).arg(offset).arg(m_pageSize); m_interrupt = true; m_pageTotal = 0; m_pageIndex = offset; QNetworkRequest request; request.setUrl(musicUrl); request.setRawHeader("Content-Type", "application/x-www-form-urlencoded"); request.setRawHeader("User-Agent", MusicUtils::Algorithm::mdII(KW_UA_URL_1, ALG_UA_KEY, false).toUtf8()); setSslConfiguration(&request); m_reply = m_manager->get(request); connect(m_reply, SIGNAL(finished()), SLOT(downLoadFinished())); connect(m_reply, SIGNAL(error(QNetworkReply::NetworkError)), SLOT(replyError(QNetworkReply::NetworkError))); }
void MAX7219::displayText(){ //printf("Start displayText()\n"); vector<MAX7219::Punkt> ausgabe = MAX7219::text; //printf("vector übergeben\n"); int displayIndex=0; int maxX = findMax(MAX7219::text); //printf("maxX: %d\n", maxX); //printf("Start while\n"); while(displayIndex-2 < maxX) { deleteAll(); MAX7219_buffer_out(); int zweiDimArray[8][8] = {0}; //printf("displayIndex: %d\n", displayIndex); //zweiDimArray[8][8] = { 0 }; for(int i = 0; i < ausgabe.size();i++){ if(ausgabe.at(i).x<displayIndex+8 && ausgabe.at(i).x>=displayIndex) { zweiDimArray[ausgabe.at(i).x - displayIndex][ausgabe.at(i).y] = 1; } } displayIndex++; //printf("Print Led\n"); displayZeichen(zweiDimArray); MAX7219_buffer_out(); // Output the buffer //usleep(200000); usleep(200000); } //printf("Ende displayText()\n"); }
/*------------------------------------------------------------*/ void cleanUp( void ) { #if defined(SHOW_OBJECTS_AT_EXIT) MyObject* t; t = head; while( t != NULL ) { switch( t->type ) { case OBJ_RECTANGLE: printf( "\nRectangle with coordinates (%d,%d) and (%d,%d)\n", t->x0, t->y0, t->x1, t->y1 ); break; case OBJ_SQUARE: printf( "\nSquare with coordinates (%d,%d) and (%d,%d)\n", t->x0, t->y0, t->x1, t->y1 ); break; default: printf( "\nUnknown object type found.\n" ); break; }; // switch. // always show the colors for all objects. printf( "Colors: Red - %f, Green - %f, Blue - %f\n", t->r, t->g, t->b ); t = t->next; }// while #endif deleteAll(); // post any quitting messages... printf( "Good bye\n" ); }
returnValue BoxConstraint::init( const Grid& grid_ ){ deleteAll(); grid = grid_; nb = 0; var = 0; index = 0; blb = 0; bub = 0; residuumXL = new DMatrix[grid.getNumPoints()]; residuumXU = new DMatrix[grid.getNumPoints()]; residuumXAL = new DMatrix[grid.getNumPoints()]; residuumXAU = new DMatrix[grid.getNumPoints()]; residuumPL = new DMatrix[1 ]; residuumPU = new DMatrix[1 ]; residuumUL = new DMatrix[grid.getNumPoints()]; residuumUU = new DMatrix[grid.getNumPoints()]; residuumWL = new DMatrix[grid.getNumPoints()]; residuumWU = new DMatrix[grid.getNumPoints()]; return SUCCESSFUL_RETURN; }
/*------------------------------------------------------------*/ void handleMenu( int value ) { switch( value ) { case MENU_EDIT: p_state = EDIT_OBJ; break; case MENU_DELETE: p_state = DELETE_OBJ; break; case MENU_CLEAR: deleteAll(); break; case MENU_SWAP: #if defined(SHOW_TEXT_STEPS) printf( "Swapping buffers.\n" ); #endif glutSwapBuffers(); glutSwapBuffers(); break; case MENU_EXIT: cleanUp(); exit(0); }; }
void VideoCapture::onSave() { myTimer.stop(); QString fileFormat="mpg"; QString initialPath = QDir::currentPath() + "/"+myFileName+"." + fileFormat; QString fileName = QFileDialog::getSaveFileName(myParent, tr("Save As"), initialPath, tr("%1 Files (*.%2);;All Files (*)") .arg(QString(fileFormat.toUpper())) .arg(QString(fileFormat))); if (fileName.isEmpty()) { return; } else { // QMessageBox::information(0, "start", fileName); /* for (int i = 1; i<=myFrame;i++) { QString fn = myFileName+QString::number(i).rightJustified (5, '0'); QImage img; bool ok; ok = img.load (fn+".bmp"); if (!ok) { QMessageBox::warning (0, "gif", fn+".bmp"); } ok = img.save(fn+".jpg"); if (!ok) { QMessageBox::warning (0, "jpeg", fn+".jpg"); } // QFile::remove (fn+".bmp"); } */ int sW = Options::VideoWidth; int sH = Options::VideoHeight; int r = Options::VideoRate; QString command; QString keys = //" -t "+ QString::number(endTime)+ QString::number(sW) + " "+QString::number(sH)+" " + QString::number(r); QString bat = QCoreApplication::applicationDirPath ()+"/"; command = bat + "mpeg.bat "+myFileName+" "+ fileName + " "+ keys;// +" >a.txt"; // "D:/PRADISWORK/bin/debug-vc6/ffmpeg.exe -f image2 -i "+myFileName+"%%05d.bmp -target vcd -sameq -y "+ fileName + " >a.txt"; command = command.replace("\\","/"); // qWarning(command); // system ("cd "+); // QMessageBox::warning (0, "jpeg", command); system(command.toAscii().data()); deleteAll(); } };
DLXSolver::~DLXSolver() { #ifdef DLX_LOG qDebug() << "DLXSolver destructor entered"; #endif deleteAll(); delete mCorner; }
EvaluationPoint& EvaluationPoint::operator=( const EvaluationPoint& rhs ) { if( this != &rhs ) { deleteAll(); copy(rhs); } return *this; }
template <typename T> TevaluationPoint<T>& TevaluationPoint<T>::operator=( const TevaluationPoint<T>& rhs ){ if( this != &rhs ){ deleteAll(); copy(rhs); } return *this; }
CFunction& CFunction::operator=( const CFunction& arg ){ if ( this != &arg ){ deleteAll(); copy(arg); } return *this; }
void MusicData2DownloadThread::dataGetFinished() { if(!m_dataReply) { return; } m_timer.stop(); if(m_dataReply->error() == QNetworkReply::NoError) { QByteArray bytes = m_dataReply->readAll(); #ifdef MUSIC_QT_5 QJsonParseError jsonError; QJsonDocument parseDoucment = QJsonDocument::fromJson(bytes, &jsonError); if(jsonError.error != QJsonParseError::NoError || !parseDoucment.isObject()) { return ; } QJsonObject jsonObject = parseDoucment.object(); if(jsonObject.value("code").toInt() == 1) { m_url = jsonObject.value("data").toObject().value("singerPic").toString(); #else QScriptEngine engine; QScriptValue sc = engine.evaluate("value=" + QString(bytes)); if(sc.property("code").toInt32() == 1) { m_url = sc.property("data").property("singerPic").toString(); #endif emit data2urlHasChanged(m_url); MusicDataDownloadThread::startToDownload(); } else { deleteAll(); } } } void MusicData2DownloadThread::dataReplyError(QNetworkReply::NetworkError) { emit musicDownLoadFinished("The data2 create failed"); deleteAll(); }
void MTrie::deleteAll(MNode *root) { if (root == 0) return; for (int i = 0; i < 26; ++i) { deleteAll(root->children[0]); } delete root; }
void YbSendCoinsDialog::createWidget() { QPixmap sendPix(":icons/sendindialog"); QString titleStr(tr("发送")); QString titleInfoStr(tr("立即向任意元宝币地址发送元宝币。")); title = new YbMessageDialogTitle(sendPix, titleStr, titleInfoStr, this); this->setMinimumHeight(370); this->setMinimumWidth(550); setAutoFillBackground(true); QPalette pa = palette(); pa.setColor(QPalette::Background,QColor(255, 255, 255)); setStyleSheet("QLineEdit{border: 2px groove rgb(211, 211, 211)} QScrollArea{border: hide}"); this->setPalette(pa); connect(buttonBar, SIGNAL(cancel()), this, SLOT(cancel())); connect(buttonBar, SIGNAL(deleteAll()), this, SLOT(deleteAll())); connect(buttonBar, SIGNAL(clear()), this, SLOT(clear())); connect(buttonBar, SIGNAL(send()), this, SLOT(send())); receiversForm = new ReceiversForm(this); connect(receiversForm, SIGNAL(addAsLabel(QString&)), this, SLOT(getAddAsLabel(QString&))); boldFont.setBold(true); addAsLabel->setMinimumHeight(25); addAsLabel->setMinimumWidth(382); addAsLabel->setToolTip(tr("输入标签")); QHBoxLayout *labelLayout = new QHBoxLayout; QLabel *labelText = new QLabel(tr("标签:")); labelText->setFont(boldFont); labelLayout->addSpacing(20); labelLayout->addWidget(labelText); labelLayout->addWidget(addAsLabel); labelLayout->addSpacing(28); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->setMargin(0); mainLayout->addWidget(title); mainLayout->addWidget(receiversForm); mainLayout->addLayout(labelLayout); mainLayout->addWidget(buttonBar); setLayout(mainLayout); }
String::~String() { if (isDeletable() == true) { deleteAll(); } #ifndef NDEBUG Inspector::removeItem(this); #endif }
void MainWindow::restartGame() { if(gamepause == false) { deleteAll(); gameInit(); dataInit(); setBtn(); } }
// Assignment operator CLHelper::DeviceInfo& CLHelper::DeviceInfo::operator=(const DeviceInfo& obj) { if(this != &obj) { deleteAll(); assignAll(obj); } return *this; }
void VideoCapture::onStart() { timeout = 1000 / Options::VideoFrames; myFrame = 0; deleteAll(); myTime.start(); myTimer.start(timeout); endTime = 0; };
void MusicKGSongSuggestThread::downLoadFinished() { if(!m_reply || !m_manager) { deleteAll(); return; } M_LOGGER_INFO(QString("%1 downLoadFinished").arg(getClassName())); m_items.clear(); m_interrupt = false; if(m_reply->error() == QNetworkReply::NoError) { QByteArray bytes = m_reply->readAll(); QJson::Parser parser; bool ok; QVariant data = parser.parse(bytes, &ok); if(ok) { QVariantMap value = data.toMap(); if(value["error_code"].toInt() == 0 && value.contains("data")) { QVariantList datas = value["data"].toList(); foreach(const QVariant &var, datas) { if(m_interrupt) return; if(var.isNull()) { continue; } value = var.toMap(); if(value["LableName"].toString().isEmpty()) { foreach(const QVariant &var, value["RecordDatas"].toList()) { if(m_interrupt) return; if(var.isNull()) { continue; } value = var.toMap(); MusicResultsItem item; item.m_name = value["HintInfo"].toString(); m_items << item; } } break; } }
void MusicTranslationThread::downLoadFinished() { if(m_reply && m_reply->error() == QNetworkReply::NoError) { QByteArray bytes = m_reply->readAll(); #ifdef MUSIC_GREATER_NEW QJsonParseError jsonError; QJsonDocument parseDoucment = QJsonDocument::fromJson(bytes, &jsonError); ///Put the data into Json if(jsonError.error != QJsonParseError::NoError || !parseDoucment.isObject()) { deleteAll(); emit downLoadDataChanged(QString()); return ; } QJsonObject jsonObject = parseDoucment.object(); if(jsonObject.contains("error")) { emit downLoadDataChanged(QString()); deleteAll(); return ; } if(jsonObject.contains("trans_result")) { jsonObject = jsonObject.value("trans_result").toObject(); if(jsonObject.contains("data")) { QJsonArray array = jsonObject.value("data").toArray(); foreach(QJsonValue value, array) { if(!value.isObject()) { continue; } QJsonObject obj = value.toObject(); emit downLoadDataChanged(obj.value("dst").toString()); break; } }
GvScene::~GvScene() { TRACE("::~GvScene() %p\n",this); // give proper ordering of deletes deleteAll(); /* if (GvScene::getCurrent() == this) GvScene::setCurrent(NULL); */ }
bool deleteAll(const char* filePath, bool deleteRoot) { PHYSFS_Stat fileStat; if (PHYSFS_stat(filePath, &fileStat) == 0) { return false; } bool ret = false; if (fileStat.filetype == PHYSFS_FILETYPE_DIRECTORY) { auto paths = PHYSFS_enumerateFiles(filePath); if (paths != nullptr) { auto writeDir = PHYSFS_getWriteDir(); if (writeDir != nullptr) { for (char** path = paths; *path != nullptr; path++) { auto fullPath = std::string(filePath) + '/' + *path; if (PHYSFS_stat(fullPath.c_str(), &fileStat) == 0) { continue; } if (fileStat.filetype == PHYSFS_FILETYPE_DIRECTORY) { deleteAll(fullPath.c_str(), true); } else { auto realDir = PHYSFS_getRealDir(fullPath.c_str()); if (realDir != nullptr) { if (std::strcmp(writeDir, realDir) == 0) { ret = PHYSFS_delete(fullPath.c_str()) != 0; } } } } } PHYSFS_freeList(paths); } if (deleteRoot == true) { ret = PHYSFS_delete(filePath) != 0; } } else { ret = PHYSFS_delete(filePath) != 0; } return ret; }