int StatusBar::removeWidget(lua_State * L) // ( QWidget * widget ) { QStatusBar* obj = ObjectHelper<QStatusBar>::check( L, 1); QWidget* widget = ObjectHelper<QWidget>::check( L, 2); obj->removeWidget( widget ) ; return 0; }
void db_key::newItem(QString name) { NewKey *dlg = new NewKey(qApp->activeWindow(), name); QProgressBar *bar; QStatusBar *status = mainwin->statusBar(); pki_evp *nkey = NULL; pki_scard *cardkey = NULL; pki_key *key = NULL; if (!dlg->exec()) { delete dlg; return; } int ksize = dlg->getKeysize(); if (ksize > 0) { if (ksize < 32) { QMessageBox::warning(NULL, XCA_TITLE, tr("Key size too small !")); delete dlg; return; } if (ksize < 1024 || ksize > 8192) if (QMessageBox::warning(NULL, XCA_TITLE, tr("You are sure to create a key of the size: %1 ?").arg(ksize), QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) { delete dlg; return; } } mainwin->repaint(); bar = new QProgressBar(); status->addPermanentWidget(bar, 1); try { if (dlg->isToken()) { key = cardkey = new pki_scard(dlg->keyDesc->text()); cardkey->generateKey_card(dlg->getKeyCardSlot(), ksize, bar); } else { key = nkey = new pki_evp(dlg->keyDesc->text()); nkey->generate(ksize, dlg->getKeytype(), bar, dlg->getKeyCurve_nid()); } key = (pki_key*)insert(key); emit keyDone(key->getIntNameWithType()); createSuccess(key); } catch (errorEx &err) { delete key; mainwin->Error(err); } status->removeWidget(bar); delete bar; delete dlg; }
/** Preprocess the whole sound file, by looping through and processing every chunk in the file. A progress bar is displayed in the toolbar, because this can be time consuming. */ void SoundFile::preProcess() { //jumpToChunk(0); gdata->setDoingActiveAnalysis(true); myassert(firstTimeThrough == true); readChunk(bufferSize() - offset()); //readChunk(framesPerChunk()); //processNewChunk(); //printf("preProcessing\n"); //for(int j=0; j<numChannels(); j++) // channels(j)->setframesPerChunk(toRead); // Create a progress bar in the status bar to tell the user we're preprocessing MainWindow *theMainWindow = (MainWindow*) qApp->mainWidget(); QStatusBar *theStatusBar = theMainWindow->statusBar(); QLabel *message = new QLabel("Preprocessing data:", theStatusBar, "message"); //QLabel *message = new QLabel("Preprocessing data:", theMainWindow, "message"); //QProgressBar *progress = new QProgressBar(stream->totalFrames() / framesPerChunk(), theMainWindow, "progress bar"); Q3ProgressBar *progress = new Q3ProgressBar(stream->totalFrames() / framesPerChunk(), theStatusBar, "progress bar"); progress->setProgress(0); progress->setMaximumHeight(16); theStatusBar->addWidget(message); theStatusBar->addWidget(progress); message->show(); progress->show(); int frameCount = 1; int updateInterval = MAX(1, progress->totalSteps() / 50); // We'll update 50 times only //while(read_n(toRead, stream) == toRead) { // put data in channels while(readChunk(framesPerChunk()) == framesPerChunk()) { // put data in channels //printf("pos = %d\n", stream->pos); //processNewChunk(); //incrementChunkNum(); frameCount++; if (frameCount % updateInterval == 0) { progress->setProgress(progress->progress() + updateInterval); qApp->processEvents(); frameCount = 1; } } //printf("totalChunks=%d\n", totalChunks()); //printf("currentChunks=%d\n", currentChunk()); filteredStream->close(); filteredStream->open_read(filteredFilename); jumpToChunk(0); progress->setProgress(progress->totalSteps()); theStatusBar->removeWidget(progress); theStatusBar->removeWidget(message); delete progress; delete message; gdata->setDoingActiveAnalysis(false); firstTimeThrough = false; //printf("freqLookup.size()=%d\n", channels(0)->freqLookup.size()); }