void ID3v2_Tag::setComment(const wxString &s) { //if(s.IsEmpty()) { // removeFrames("COMM"); // return; //} //if(!d->frameListMap["COMM"].isEmpty()) // d->frameListMap["COMM"].front()->setText(s); // we do not remove all frames as this will remove MusicMatch etc. ID3v2_CommentsFrame* f = findCommentFrame(); if( f ) { if( s.IsEmpty() ) { removeFrame(f); } else { f->setText(s); } } else if( !s.IsEmpty() ) { f = new ID3v2_CommentsFrame(m_factory->defaultTextEncoding()); addFrame(f); f->setText(s); } }
void KTMainWindow::ui4project(QWidget *widget) { connect(widget, SIGNAL(requestInsertFrame(bool)), m_projectManager, SLOT(createFrame(bool))); connect(widget, SIGNAL(requestInsertLayer()), m_projectManager, SLOT(createLayer())); connect(widget, SIGNAL(frameSelected( int, int )), this, SLOT(selectFrame(int,int))); connect(widget, SIGNAL(layerVisibilityChanged( int, bool)), m_projectManager, SLOT(setLayerVisibility( int, bool))); connect(widget, SIGNAL(layerSelected( int)), m_projectManager, SLOT(setCurrentLayer( int))); connect(widget, SIGNAL(requestCopyFrame(int)), m_projectManager, SLOT(copyFrame(int))); connect(widget, SIGNAL(requestPasteFrame(int)), m_projectManager, SLOT(pasteFrame(int))); connect(widget, SIGNAL(requestCloneFrame(int, int)), m_projectManager, SLOT(cloneFrame(int, int))); connect(widget, SIGNAL(requestMoveFrame(bool)), m_projectManager, SLOT(moveFrame(bool))); connect(widget, SIGNAL(requestRemoveFrame()), m_projectManager, SLOT(removeFrame())); connect(widget, SIGNAL(requestLockFrame()), m_projectManager, SLOT(lockCurrentFrame())); connect(widget, SIGNAL(requestRemoveLayer(int)), m_projectManager, SLOT(removeLayer(int))); connect(widget, SIGNAL(requestMoveLayer(bool)), m_projectManager, SLOT(moveLayer(bool))); connect(widget, SIGNAL(requestRenameLayer(int, const QString &)), m_projectManager, SLOT(renameLayer(int , const QString &))); connect(widget, SIGNAL(requestRenameFrame(int, int, const QString &)), m_projectManager, SLOT(renameFrame(int, int, const QString &))); }
void KWFrameSet::removeFrame(KWFrame *frame, KoShape *shape) { Q_ASSERT(frame); if (frame->isCopy()) { KWCopyShape* copyShape = dynamic_cast<KWCopyShape*>(frame->shape()); if (copyShape && copyShape->original()) { KWFrame *originalFrame = dynamic_cast<KWFrame*>(copyShape->original()->applicationData()); if (originalFrame) { originalFrame->removeCopy(frame); } } } else { //TODO use the copyFrame-list the KWFrame's remembers now // Loop over all frames to see if there is a copy frame that references the removed // frame; if it does, then delete the copy too. for(int i = frames().count() - 1; i >= 0; --i) { KWFrame *frame = frames()[i]; if (KWCopyShape *cs = dynamic_cast<KWCopyShape*>(frame->shape())) { if (cs->original() == shape) { Q_ASSERT(frame->frameSet() == this); frame->cleanupShape(cs); removeFrame(frame, cs); delete cs; } } } } if (m_frames.removeAll(frame)) { frame->setFrameSet(0); emit frameRemoved(frame); } }
/* Output code for put() / get() */ void outputPutGet(char *intStr) { placeFunLabel("put"); /* put(n) */ createFrame(FALSE, NULL); /* call printf("%d", n) */ outputCmd("pushl\t8(%ebp)", 0); /* push n */ outputCmd("pushl", 0); fprintf(OUTPUT, intStr); /* push "%d" */ outputCmd("call\tprintf", 0); removeFrame(FALSE, NULL); placeFunLabel("get"); /* n = get() */ createFrame(FALSE, NULL); /* call scanf("%d", &x) */ outputCmd("subl\t$4, %esp", 0); /* make room for temporary x at -4(%ebp) */ outputCmd("leal\t-4(%ebp), %eax", 0); outputCmd("pushl\t%eax", 0); /* push its address */ outputCmd("pushl", 0); fprintf(OUTPUT, intStr); /* push "%d" */ outputCmd("call\tscanf", 0); outputCmd("movl\t-4(%ebp), %eax", 0); /* return x */ removeFrame(FALSE, NULL); }
void KWFrameSet::cleanupFrames() { kDebug(32001) << "type=" << m_type << "frameCount=" << frames().count(); while (!frames().isEmpty()) { // deleting a shape can result in multiple KWFrame's and shapes being deleted (e.g. copy-shapes) KWFrame *f = frames().last(); if (f->shape()) { delete f->shape(); // deletes also the KWFrame and calls KWFrameSet::removeFrame Q_ASSERT(!frames().contains(f)); } else { removeFrame(f); } } }
void ID3v2_Tag::removeFrames(const wxString &id) { /*FrameList l = d->frameListMap[id]; for(FrameList::Iterator it = l.begin(); it != l.end(); ++it) removeFrame(*it, true);*/ ID3v2_FrameList* l = frameList(id); if( l ) { ID3v2_FrameList::Node* first; while( (first=l->GetFirst()) != NULL ) { removeFrame(first->GetData(), true); } } }
/* Generate code for function */ void genFun(node *funnode) { node *funname = funnode->internal.child[1]; node *funstmts = funnode->internal.child[3]; placeFunLabel(funname->ident.STentry->lexptr); currentfundesc = funname->ident.decl; initLabel(&funend, "funend"); createFrame(TRUE, funname->ident.STentry->lexptr); genStmtList(funstmts, &funend); placeLabel(&funend); removeFrame(TRUE, funname->ident.STentry->lexptr); }
/* Output header code */ void outputHeader() { fprintf(OUTPUT, ".globl main"); fprintf(OUTPUT, "\nmain:"); createFrame(TRUE, NULL); /* set global pointer */ outputCmd("movl", 0); fprintf(OUTPUT, "$globals"); printComma = TRUE; outputReg(GLOBALREG); /* call YOCO() */ outputCmd("call", 0); outputFunLabel("YOCO"); /* return 0 from main */ outputCmd("xorl\t%eax, %eax", 0); removeFrame(TRUE, NULL); }
void QgsComposerMultiFrame::handlePageChange() { if ( mComposition->numPages() < 1 ) { return; } if ( mResizeMode != RepeatOnEveryPage ) { return; } //remove items beginning on non-existing pages for ( int i = mFrameItems.size() - 1; i >= 0; --i ) { QgsComposerFrame* frame = mFrameItems[i]; int page = frame->pos().y() / ( mComposition->paperHeight() + mComposition->spaceBetweenPages() ); if ( page > ( mComposition->numPages() - 1 ) ) { removeFrame( i ); } } //page number of the last item QgsComposerFrame* lastFrame = mFrameItems.last(); int lastItemPage = lastFrame->pos().y() / ( mComposition->paperHeight() + mComposition->spaceBetweenPages() ); for ( int i = lastItemPage + 1; i < mComposition->numPages(); ++i ) { //copy last frame to current page QgsComposerFrame* newFrame = new QgsComposerFrame( mComposition, this, lastFrame->pos().x(), lastFrame->pos().y() + mComposition->paperHeight() + mComposition->spaceBetweenPages(), lastFrame->rect().width(), lastFrame->rect().height() ); addFrame( newFrame, false ); lastFrame = newFrame; } recalculateFrameSizes(); update(); }
void QgsComposerMultiFrame::recalculateFrameSizes() { if ( mFrameItems.size() < 1 ) { return; } QSizeF size = totalSize(); double totalHeight = size.height(); if ( totalHeight < 1 ) { return; } double currentY = 0; double currentHeight = 0; QgsComposerFrame* currentItem = 0; for ( int i = 0; i < mFrameItems.size(); ++i ) { if ( currentY >= totalHeight ) { if ( mResizeMode == ExtendToNextPage ) //remove unneeded frames in extent mode { for ( int j = mFrameItems.size(); j > i; --j ) { removeFrame( j - 1 ); } } return; } currentItem = mFrameItems.value( i ); currentHeight = currentItem->rect().height(); currentItem->setContentSection( QRectF( 0, currentY, currentItem->rect().width(), currentHeight ) ); currentItem->update(); currentY += currentHeight; } //at end of frames but there is still content left. Add other pages if ResizeMode == if ( mResizeMode == ExtendToNextPage ) { while ( currentY < totalHeight ) { //find out on which page the lower left point of the last frame is int page = currentItem->transform().dy() / ( mComposition->paperHeight() + mComposition->spaceBetweenPages() ); //add new pages if necessary if ( mComposition->numPages() < ( page + 2 ) ) { mComposition->setNumPages( page + 2 ); } //copy last frame QgsComposerFrame* newFrame = new QgsComposerFrame( mComposition, this, currentItem->transform().dx(), currentItem->transform().dy() + mComposition->paperHeight() + mComposition->spaceBetweenPages(), currentItem->rect().width(), currentItem->rect().height() ); newFrame->setContentSection( QRectF( 0, currentY, newFrame->rect().width(), newFrame->rect().height() ) ); currentY += newFrame->rect().height(); currentItem = newFrame; addFrame( newFrame, false ); } } }
// it will mark the frame that belong // to that address as being unoccuppied void dealloc_block(physical_address add) { removeFrame(add); }
void QgsComposerMultiFrame::recalculateFrameSizes() { if ( mFrameItems.empty() ) { return; } QSizeF size = totalSize(); double totalHeight = size.height(); if ( totalHeight < 1 ) { return; } double currentY = 0; double currentHeight = 0; QgsComposerFrame *currentItem = nullptr; for ( int i = 0; i < mFrameItems.size(); ++i ) { if ( mResizeMode != RepeatOnEveryPage && currentY >= totalHeight ) { if ( mResizeMode == RepeatUntilFinished || mResizeMode == ExtendToNextPage ) //remove unneeded frames in extent mode { bool removingPages = true; for ( int j = mFrameItems.size(); j > i; --j ) { int numPagesBefore = mComposition->numPages(); removeFrame( j - 1, removingPages ); //if removing the frame didn't also remove the page, then stop removing pages removingPages = removingPages && ( mComposition->numPages() < numPagesBefore ); } return; } } currentItem = mFrameItems.value( i ); currentHeight = currentItem->rect().height(); if ( mResizeMode == RepeatOnEveryPage ) { currentItem->setContentSection( QRectF( 0, 0, currentItem->rect().width(), currentHeight ) ); } else { currentHeight = findNearbyPageBreak( currentY + currentHeight ) - currentY; currentItem->setContentSection( QRectF( 0, currentY, currentItem->rect().width(), currentHeight ) ); } currentItem->update(); currentY += currentHeight; } //at end of frames but there is still content left. Add other pages if ResizeMode == if ( mResizeMode != UseExistingFrames ) { while ( ( mResizeMode == RepeatOnEveryPage ) || currentY < totalHeight ) { //find out on which page the lower left point of the last frame is int page = std::floor( ( currentItem->pos().y() + currentItem->rect().height() ) / ( mComposition->paperHeight() + mComposition->spaceBetweenPages() ) ) + 1; if ( mResizeMode == RepeatOnEveryPage ) { if ( page >= mComposition->numPages() ) { break; } } else { //add an extra page if required if ( mComposition->numPages() < ( page + 1 ) ) { mComposition->setNumPages( page + 1 ); } } double frameHeight = 0; if ( mResizeMode == RepeatUntilFinished || mResizeMode == RepeatOnEveryPage ) { frameHeight = currentItem->rect().height(); } else //mResizeMode == ExtendToNextPage { frameHeight = ( currentY + mComposition->paperHeight() ) > totalHeight ? totalHeight - currentY : mComposition->paperHeight(); } double newFrameY = page * ( mComposition->paperHeight() + mComposition->spaceBetweenPages() ); if ( mResizeMode == RepeatUntilFinished || mResizeMode == RepeatOnEveryPage ) { newFrameY += currentItem->pos().y() - ( page - 1 ) * ( mComposition->paperHeight() + mComposition->spaceBetweenPages() ); } //create new frame QgsComposerFrame *newFrame = createNewFrame( currentItem, QPointF( currentItem->pos().x(), newFrameY ), QSizeF( currentItem->rect().width(), frameHeight ) ); if ( mResizeMode == RepeatOnEveryPage ) { newFrame->setContentSection( QRectF( 0, 0, newFrame->rect().width(), newFrame->rect().height() ) ); currentY += frameHeight; } else { double contentHeight = findNearbyPageBreak( currentY + newFrame->rect().height() ) - currentY; newFrame->setContentSection( QRectF( 0, currentY, newFrame->rect().width(), contentHeight ) ); currentY += contentHeight; } currentItem = newFrame; } } }
void QgsComposerMultiFrame::recalculateFrameSizes() { if ( mFrameItems.size() < 1 ) { return; } QSizeF size = totalSize(); double totalHeight = size.height(); if ( totalHeight < 1 ) { return; } double currentY = 0; double currentHeight = 0; QgsComposerFrame* currentItem = 0; for ( int i = 0; i < mFrameItems.size(); ++i ) { if ( mResizeMode != RepeatOnEveryPage && currentY >= totalHeight ) { if ( mResizeMode == RepeatUntilFinished || mResizeMode == ExtendToNextPage ) //remove unneeded frames in extent mode { for ( int j = mFrameItems.size(); j > i; --j ) { removeFrame( j - 1 ); } } return; } currentItem = mFrameItems.value( i ); currentHeight = currentItem->rect().height(); if ( mResizeMode == RepeatOnEveryPage ) { currentItem->setContentSection( QRectF( 0, 0, currentItem->rect().width(), currentHeight ) ); } else { currentItem->setContentSection( QRectF( 0, currentY, currentItem->rect().width(), currentHeight ) ); } currentItem->update(); currentY += currentHeight; } //at end of frames but there is still content left. Add other pages if ResizeMode == if ( mResizeMode != UseExistingFrames ) { while (( mResizeMode == RepeatOnEveryPage ) || currentY < totalHeight ) { //find out on which page the lower left point of the last frame is int page = currentItem->pos().y() / ( mComposition->paperHeight() + mComposition->spaceBetweenPages() ); if ( mResizeMode == RepeatOnEveryPage ) { if ( page > mComposition->numPages() - 2 ) { break; } } else { if ( mComposition->numPages() < ( page + 2 ) ) { mComposition->setNumPages( page + 2 ); } } double frameHeight = 0; if ( mResizeMode == RepeatUntilFinished || mResizeMode == RepeatOnEveryPage ) { frameHeight = currentItem->rect().height(); } else //mResizeMode == ExtendToNextPage { frameHeight = ( currentY + mComposition->paperHeight() ) > totalHeight ? totalHeight - currentY : mComposition->paperHeight(); } double newFrameY = ( page + 1 ) * ( mComposition->paperHeight() + mComposition->spaceBetweenPages() ); if ( mResizeMode == RepeatUntilFinished || mResizeMode == RepeatOnEveryPage ) { newFrameY += currentItem->pos().y() - page * ( mComposition->paperHeight() + mComposition->spaceBetweenPages() ); } QgsComposerFrame* newFrame = new QgsComposerFrame( mComposition, this, currentItem->pos().x(), newFrameY, currentItem->rect().width(), frameHeight ); if ( mResizeMode == RepeatOnEveryPage ) { newFrame->setContentSection( QRectF( 0, 0, newFrame->rect().width(), newFrame->rect().height() ) ); } else { newFrame->setContentSection( QRectF( 0, currentY, newFrame->rect().width(), newFrame->rect().height() ) ); } currentY += frameHeight; currentItem = newFrame; addFrame( newFrame, false ); } } }
void Cpp2Channel::readDataAvailable(size_t len) noexcept { assert(recvCallback_); assert(len > 0); DestructorGuard dg(this); queue_->postallocate(len); if (recvCallback_ && recvCallback_->shouldSample() && !sample_) { sample_.reset(new RecvCallback::sample); sample_->readBegin = Util::currentTimeUsec(); } // Remaining for this packet. Will update the class member // variable below for the next call to getReadBuffer size_t remaining = 0; while (true) { unique_ptr<IOBuf> unframed; try { if (protectionState_ == ProtectionState::INVALID) { throw TTransportException("protection state is invalid"); } // If we have a full frame already in a queue ready to go, use // it. if (protectionState_ != ProtectionState::VALID && queue_->front()) { unframed = removeFrame(queue_.get(), remaining); } else if (protectionState_ == ProtectionState::VALID && pendingPlaintext_->front()) { unframed = removeFrame(pendingPlaintext_.get(), remaining); } // We should either get a buffer back, or a remaining indicator. // Never both. Neither is possible, if the length of the framed // data is zero. assert(!(unframed && remaining > 0)); // If there wasn't a full message available and we have a // protection layer, attempt to unwrap the next piece of // ciphertext. if (!unframed && protectionState_ == ProtectionState::VALID && queue_->front()) { assert(saslEndpoint_ != NULL); unique_ptr<IOBuf> unwrapped = saslEndpoint_->unwrap(queue_.get(), &remaining); assert(!(unwrapped && remaining > 0)); if (unwrapped) { pendingPlaintext_->append(std::move(unwrapped)); // Start again from the top. continue; } } } catch (const std::exception& e) { if (recvCallback_) { VLOG(5) << "Failed to read a message header"; recvCallback_->messageReceiveError(std::current_exception()); } else { LOG(ERROR) << "Failed to read a message header"; } closeNow(); return; } if (remaining > 0) { this->remaining_ = remaining; return; } if (!unframed) { break; } if (!recvCallback_) { LOG(ERROR) << "Received a message, but no recvCallback_ installed!"; continue; } if (sample_) { sample_->readEnd = Util::currentTimeUsec(); } recvCallback_->messageReceived(std::move(unframed), std::move(sample_)); if (closing_) { return; // don't call more callbacks if we are going to be destroyed } } this->remaining_ = 2048; }
QWzmViewer::QWzmViewer(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow()), psModel(NULL), timer(new QTimer(this)) { QSettings settings; ui->setupUi(this); connectorsModel.setColumnCount(4); connectorsModel.setHeaderData(0, Qt::Horizontal, QString("X")); connectorsModel.setHeaderData(1, Qt::Horizontal, QString("Y")); connectorsModel.setHeaderData(2, Qt::Horizontal, QString("Z")); connectorsModel.setHeaderData(3, Qt::Horizontal, QString(tr("Type"))); animationModel.setColumnCount(8); animationModel.setHeaderData(0, Qt::Horizontal, QString(tr("Time"))); animationModel.setHeaderData(1, Qt::Horizontal, QString("Tex")); animationModel.setHeaderData(2, Qt::Horizontal, QString("Trs X")); animationModel.setHeaderData(3, Qt::Horizontal, QString("Trs Y")); animationModel.setHeaderData(4, Qt::Horizontal, QString("Trs Z")); animationModel.setHeaderData(5, Qt::Horizontal, QString("Rot X")); animationModel.setHeaderData(6, Qt::Horizontal, QString("Rot Y")); animationModel.setHeaderData(7, Qt::Horizontal, QString("Rot Z")); fileNameLabel = new QLabel(tr("No file loaded"), ui->statusBar); selectedMeshComboBox = new QComboBox(ui->statusBar); selectedMeshComboBox->setToolTip(tr("Selected Mesh")); selectedMeshComboBox->setEnabled(false); visibleMeshComboBox = new QComboBox(ui->statusBar); visibleMeshComboBox->setEnabled(false); visibleMeshComboBox->setToolTip(tr("Visible Mesh")); visibleMeshComboBox->addItem(tr("All")); teamComboBox = new QComboBox(ui->statusBar); teamComboBox->setToolTip(tr("Team Colour")); teamComboBox->addItem(tr("Green")); teamComboBox->addItem(tr("Yellow")); teamComboBox->addItem(tr("Grey")); teamComboBox->addItem(tr("Black")); teamComboBox->addItem(tr("Red")); teamComboBox->addItem(tr("Blue")); teamComboBox->addItem(tr("Pink")); teamComboBox->addItem(tr("Cyan")); scaleSlider = new QSlider(ui->statusBar); scaleSlider->setToolTip(tr("Scale")); scaleSlider->setRange(1, 1000); scaleSlider->setValue(100); scaleSlider->setOrientation(Qt::Horizontal); scaleSlider->setEnabled(false); ui->statusBar->addPermanentWidget(fileNameLabel); ui->statusBar->addPermanentWidget(selectedMeshComboBox); ui->statusBar->addPermanentWidget(visibleMeshComboBox); ui->statusBar->addPermanentWidget(teamComboBox); ui->statusBar->addPermanentWidget(scaleSlider); ui->connectorTableView->setModel(&connectorsModel); ui->animationTableView->setModel(&animationModel); ui->animationDockWidget->hide(); ui->connectorDockWidget->hide(); connect(timer, SIGNAL(timeout()), this, SLOT(tick())); connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(actionOpen())); connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(actionSave())); connect(ui->actionSaveAs, SIGNAL(triggered()), this, SLOT(actionSaveAs())); connect(ui->actionQuit, SIGNAL(triggered()), QApplication::instance(), SLOT(quit())); connect(ui->actionImport_3DS, SIGNAL(triggered()), this, SLOT(open3DS())); connect(ui->actionWireframe, SIGNAL(triggered()), this, SLOT(toggleWireframe())); connect(ui->actionHelpContents, SIGNAL(triggered()), ui->glView, SLOT(help())); connect(ui->actionAboutQt, SIGNAL(triggered()), QApplication::instance(), SLOT(aboutQt())); connect(ui->actionAboutApplication, SIGNAL(triggered()), this, SLOT(actionAboutApplication())); connect(ui->actionAxis, SIGNAL(triggered()), ui->glView, SLOT(toggleAxisIsDrawn())); connect(ui->actionCulling, SIGNAL(triggered()), this, SLOT(toggleCulling())); connect(ui->actionAnimation, SIGNAL(triggered()), this, SLOT(toggleAnimation())); connect(ui->actionScaleModel, SIGNAL(triggered()), this, SLOT(toggleScale())); connect(selectedMeshComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setMesh(int))); connect(visibleMeshComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setVisibleMesh(int))); connect(teamComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setTeam(int))); connect(ui->actionSwapYZ, SIGNAL(triggered()), this, SLOT(toggleSwapYZ())); connect(ui->actionReverseWinding, SIGNAL(triggered()), this, SLOT(toggleReverseWinding())); connect(ui->actionFlipVerticalTexCoords, SIGNAL(triggered()), this, SLOT(toggleFlipVerticalTexCoords())); connect(ui->actionFramesEditor, SIGNAL(toggled(bool)), this, SLOT(toggleEditAnimation(bool))); connect(ui->actionConnectorsEditor, SIGNAL(toggled(bool)), this, SLOT(toggleEditConnectors(bool))); connect(ui->animationDockWidget, SIGNAL(visibilityChanged(bool)), ui->actionFramesEditor, SLOT(setChecked(bool))); connect(ui->connectorDockWidget, SIGNAL(visibilityChanged(bool)), ui->actionConnectorsEditor, SLOT(setChecked(bool))); connect(ui->prependFrameButton, SIGNAL(pressed()), this, SLOT(prependFrame())); connect(ui->appendFrameButton, SIGNAL(pressed()), this, SLOT(appendFrame())); connect(ui->removeFrameButton, SIGNAL(pressed()), this, SLOT(removeFrame())); // Set defaults toggleAnimation(); ui->actionSave->setEnabled(false); ui->actionSaveAs->setEnabled(false); restoreGeometry(settings.value("geometry").toByteArray()); restoreState(settings.value("windowState").toByteArray()); timer->start(25); }