Exemplo n.º 1
0
QGLCubeItem::QGLCubeItem(QQuickItem *parent) :
    QGLItem(parent),
    m_cubePointer(NULL),
    m_size(QVector3D(1,1,1)),
    m_color(QColor(Qt::yellow)),
    m_centered(false),
    m_selected(false)
{
    connect(this, SIGNAL(sizeChanged(QVector3D)),
            this, SIGNAL(needsUpdate()));
    connect(this, SIGNAL(colorChanged(QColor)),
            this, SIGNAL(needsUpdate()));
    connect(this, SIGNAL(centeredChanged(bool)),
            this, SIGNAL(needsUpdate()));
}
Exemplo n.º 2
0
void TexturePlaneNode::traverse( osg::NodeVisitor& nv )
{
    if ( nv.getVisitorType()==osg::NodeVisitor::UPDATE_VISITOR )
    {
	if ( needsUpdate() )
	    updateGeometry();
    }
    else if ( nv.getVisitorType()==osg::NodeVisitor::CULL_VISITOR )
    {
	osgUtil::CullVisitor* cv = dynamic_cast<osgUtil::CullVisitor*>(&nv);

	if ( getStateSet() )
	    cv->pushStateSet( getStateSet() );

	if ( _texture && _texture->getSetupStateSet() )
	    cv->pushStateSet( _texture->getSetupStateSet() );

	for ( unsigned int idx=0; idx<_geometries.size(); idx++ )
	{
	    cv->pushStateSet( _statesets[idx] );
	    cv->addDrawable( _geometries[idx], cv->getModelViewMatrix() );
	    cv->popStateSet();
	}

	if ( _texture && _texture->getSetupStateSet() )
	    cv->popStateSet();

	if ( getStateSet() )
	    cv->popStateSet();
    }
}
Exemplo n.º 3
0
Button* WelcomeScreen::addButton(int x, int y, const QIcon& icon, const QString& text)
{
    if (m_buttons.contains(Coord(x, y))) {
        return m_buttons[Coord(x, y)];
    }
    else {
        Button* button = new Button(this, icon, m_font, text);
        if (!m_buttons.isEmpty()) {
            Button* other = *m_buttons.begin();
            if (other->size().width() >= button->size().width()) {
                button->setWidth(other->size().width());
            }
            else {
                for (Buttons::const_iterator i = m_buttons.constBegin();
                     i != m_buttons.constEnd(); ++i) {
                    (*i)->setWidth(button->size().width());
                }
            }
        }
        m_buttons.insert(Coord(x, y), button);
        button->show();
        update();
        connect(button, SIGNAL(needsUpdate()), this, SLOT(update()));
        
        kDebug() << "added button" << button;
        
        return button;
    }
}
Exemplo n.º 4
0
void RootItem::determineChildren()
{
	if (node() && needsUpdate() == FullUpdate) SAFE_DELETE_ITEM(item_);

	if (item_ && node() && item_->node() != node() ) SAFE_DELETE_ITEM(item_);

	if (!item_ && node()) item_ = renderer()->render(this, node());
}
Exemplo n.º 5
0
void MatrixModeIdle::update()
{
    // If the update timer has elapsed, update the animation
    if (needsUpdate())
    {
        // Nothing to do
    }
}
Exemplo n.º 6
0
	/**@brief Update file and return whether the file had to be
	 *
	 * @return Whether the file needed to be updated
	 */
	bool update() {
		std::lock_guard<std::mutex> lock(mut_);
		if (needsUpdate()) {
			load();
			return true;
		}
		return false;
	}
Exemplo n.º 7
0
void Button::removeEditor()
{
    m_editor->hide();
    m_editor->deleteLater();
    m_editor = 0;
    
    computeSize();
    repaint();
    emit needsUpdate();
}
Exemplo n.º 8
0
	bool LaTeX::updateBibs()
	{
		KileDocument::TextInfo *docinfo = manager()->info()->docManager()->textInfoFor(source());
                if ( docinfo )
                {
			if ( manager()->info()->allBibliographies()->count() > 0 )
				return needsUpdate ( baseDir() + '/' + S() + ".bbl" , manager()->info()->lastModifiedFile(docinfo) );
		}

		return false;
	}
Exemplo n.º 9
0
	bool LaTeX::updateIndex()
	{
		KileDocument::TextInfo *docinfo = manager()->info()->docManager()->textInfoFor(source());
		if ( docinfo )
		{
			const QStringList *pckgs = manager()->info()->allPackages();
				if ( pckgs->contains("makeidx") )
					return needsUpdate ( baseDir() + '/' + S() + ".ind", manager()->info()->lastModifiedFile(docinfo) );
		}

		return false;
	}
Exemplo n.º 10
0
void GLWidget::setVisFrame(VisFrame *f)
{
	if (!initialScene)
	{
		initialScene = f;
	}

	scene = f;

	callListUptodate = false;
	emit needsUpdate();
}
Exemplo n.º 11
0
//static
TrackTagUpdater*
TrackTagUpdater::create(const QString& webServiceUrl, unsigned tagValidityDays, unsigned interRequestDelayMins)
{
    QThread* thread = new QThread();

    TrackTagUpdater* updater = new TrackTagUpdater(webServiceUrl, tagValidityDays, interRequestDelayMins);
    updater->moveToThread(thread);

    connect(thread, SIGNAL(started()), updater, SLOT(needsUpdate()));
    thread->start();

    return updater;
}
Exemplo n.º 12
0
Material::Material(Material_t tag)
    : tag(tag),
      vertexShader(this),
      fragmentShader(this),
      index0AttributeName(this)
{
    mId = Material::MaterialIdCount++;

    mUuid = Math::generateUUID();

    mName = "";

    side() = kFrontSide;

    opacity() = 1.0f;
    transparent() = false;

    blending() = kNormalBlending;

    blendSrc() = kSrcAlphaFactor;
    blendDst() = kOneMinusSrcAlphaFactor;
    blendEquation() = kAddEquation;

    depthTest() = true;
    depthWrite() = true;

    polygonOffset() = false;
    polygonOffsetFactor() = 0;
    polygonOffsetUnits() = 0;

    // mAlphaTest = 0;

    overdraw() = 0; // Overdrawn pixels (typically between 0 and 1) for fixing antialiasing gaps in CanvasRenderer

    visible() = true;

    needsUpdate() = true;

    // By default, bind position to attribute index 0. In WebGL, attribute 0
    // should always be used to avoid potentially expensive emulation.
    index0AttributeName("position");

    linewidth() = 1.0f;
    metal() = false;
    perPixel() = true;
    shading() = kNoShading;
	vertexColors() = kNoColors;
    wireframe() = false;
    wireframeLinewidth() = 1.0f;
}
Exemplo n.º 13
0
void RivenVideo::disable() {
	if (needsUpdate()) {
		drawNextFrame();
	}

	if (_video) {
		Common::Rect targetRect = Common::Rect(_video->getWidth(), _video->getHeight());
		targetRect.translate(_x, _y);

		_vm->_gfx->copySystemRectToScreen(targetRect);
	}

	_enabled = false;
}
Exemplo n.º 14
0
void Button::setEditor(EditorFactory& factory)
{
    // remove old editor if existent
    delete m_editor;
    
    // create a new editor
    m_editor = factory.createEditor(topLevelCanvas());
    
    // update button
    m_size.setWidth(32 * 6);
    emit needsUpdate();
    repaint();
    m_editor->show();
    
    m_editor->setFocus();
}
Exemplo n.º 15
0
void MasterTableCache::updateTab() {
	collectFiles();
	if (needsUpdate()) {
		masterTab_ = table();
		for (const auto & file : files_) {
			if (njh::files::normalize(file.first)
					== njh::files::normalize(tabOpts_.out_.outFilename_)) {
				continue;
			}
			table fileTab = table(file.first.string(), tabOpts_.outDelim_,
					tabOpts_.hasHeader_);
			if (masterTab_.content_.empty()) {
				masterTab_ = fileTab;
			} else {
				masterTab_.rbind(fileTab, false);
			}
		}
	}
}
Exemplo n.º 16
0
GLWidget::GLWidget(QWidget *parent):
	QGLWidget(parent)
{
	mainWindow = (MainWindow *)parent;

	enableCalllist = false;
	callListUptodate = false;

	xRot = yRot = zRot = 0.0;
	xTrans = yTrans = 0.0;
	zTrans = -15.0;
	scene = NULL;
	initialScene = NULL;
	visibleBrokenEdges = false;

	setAutoFillBackground(false);

	connect(this, SIGNAL(needsUpdate()),
		this, SLOT(updateGL()));
}
Exemplo n.º 17
0
void Settings::restore()
{
    Settings appSettings;

    if ( isLastSaveUnfinished() ) {
        log("Restoring application settings", LogWarning);

        if ( appSettings.isEmpty() ) {
            log("Cannot restore application settings", LogError);
        } else {
            QSettings settings;
            copySettings(appSettings.m_settings, &settings);
        }

        endSave();
    } else {
        const QSettings settings;
        if ( needsUpdate(appSettings, settings) )
            copySettings(settings, &appSettings.m_settings);
    }
}
Exemplo n.º 18
0
void MoviePlayerDXA::nextFrame() {
	if (_bgSoundStream && _vm->_mixer->isSoundHandleActive(_bgSound) && needsUpdate()) {
		copyFrameToBuffer(_vm->getBackBuf(), 465, 222, _vm->_screenWidth);
		return;
	}

	if (_vm->_interactiveVideo == TYPE_LOOPING && endOfVideo()) {
		rewind();
		startSound();
	}

	if (!endOfVideo()) {
		if (_vm->_interactiveVideo == TYPE_OMNITV) {
			copyFrameToBuffer(_vm->getBackBuf(), 465, 222, _vm->_screenWidth);
		} else if (_vm->_interactiveVideo == TYPE_LOOPING) {
			copyFrameToBuffer(_vm->getBackBuf(), (_vm->_screenWidth - getWidth()) / 2, (_vm->_screenHeight - getHeight()) / 2, _vm->_screenWidth);
		}
	} else if (_vm->_interactiveVideo == TYPE_OMNITV) {
		close();
		_vm->_interactiveVideo = 0;
		_vm->_variableArray[254] = 6747;
	}
}
Exemplo n.º 19
0
void SampleTCOView::paintEvent( QPaintEvent * pe )
{
	QPainter painter( this );

	if( !needsUpdate() )
	{
		painter.drawPixmap( 0, 0, m_paintPixmap );
		return;
	}

	setNeedsUpdate( false );

	if (m_paintPixmap.isNull() || m_paintPixmap.size() != size())
	{
		m_paintPixmap = QPixmap(size());
	}

	QPainter p( &m_paintPixmap );

	QLinearGradient lingrad( 0, 0, 0, height() );
	QColor c;
	bool muted = m_tco->getTrack()->isMuted() || m_tco->isMuted();

	// state: selected, muted, normal
	c = isSelected() ? selectedColor() : ( muted ? mutedBackgroundColor() 
		: painter.background().color() );

	lingrad.setColorAt( 1, c.darker( 300 ) );
	lingrad.setColorAt( 0, c );

	// paint a black rectangle under the pattern to prevent glitches with transparent backgrounds
	p.fillRect( rect(), QColor( 0, 0, 0 ) );

	if( gradient() )
	{
		p.fillRect( rect(), lingrad );
	}
	else
	{
		p.fillRect( rect(), c );
	}

	p.setPen( !muted ? painter.pen().brush().color() : mutedColor() );

	const int spacing = TCO_BORDER_WIDTH + 1;
	const float ppt = fixedTCOs() ?
			( parentWidget()->width() - 2 * TCO_BORDER_WIDTH )
					/ (float) m_tco->length().getTact() :
								pixelsPerTact();

	float nom = Engine::getSong()->getTimeSigModel().getNumerator();
	float den = Engine::getSong()->getTimeSigModel().getDenominator();
	float ticksPerTact = DefaultTicksPerTact * nom / den;
	
	float offset =  m_tco->startTimeOffset() / ticksPerTact * pixelsPerTact();
	QRect r = QRect( TCO_BORDER_WIDTH + offset, spacing,
			qMax( static_cast<int>( m_tco->sampleLength() * ppt / ticksPerTact ), 1 ), rect().bottom() - 2 * spacing );
	m_tco->m_sampleBuffer->visualize( p, r, pe->rect() );

	QFileInfo fileInfo(m_tco->m_sampleBuffer->audioFile());
	QString filename = fileInfo.fileName();
	paintTextLabel(filename, p);

	// disable antialiasing for borders, since its not needed
	p.setRenderHint( QPainter::Antialiasing, false );

	// inner border
	p.setPen( c.lighter( 160 ) );
	p.drawRect( 1, 1, rect().right() - TCO_BORDER_WIDTH, 
		rect().bottom() - TCO_BORDER_WIDTH );

	// outer border
	p.setPen( c.darker( 300 ) );
	p.drawRect( 0, 0, rect().right(), rect().bottom() );

	// draw the 'muted' pixmap only if the pattern was manualy muted
	if( m_tco->isMuted() )
	{
		const int spacing = TCO_BORDER_WIDTH;
		const int size = 14;
		p.drawPixmap( spacing, height() - ( size + spacing ),
			embed::getIconPixmap( "muted", size, size ) );
	}

	// recording sample tracks is not possible at the moment 

	/* if( m_tco->isRecord() )
	{
		p.setFont( pointSize<7>( p.font() ) );

		p.setPen( textShadowColor() );
		p.drawText( 10, p.fontMetrics().height()+1, "Rec" );
		p.setPen( textColor() );
		p.drawText( 9, p.fontMetrics().height(), "Rec" );

		p.setBrush( QBrush( textColor() ) );
		p.drawEllipse( 4, 5, 4, 4 );
	}*/

	p.end();

	painter.drawPixmap( 0, 0, m_paintPixmap );
}
Exemplo n.º 20
0
bool View3D::needsRepaint() const
{
    return background != lastBackground || needsUpdate();
}
Exemplo n.º 21
0
void SampleTCOView::paintEvent( QPaintEvent * pe )
{
	QPainter painter( this );

	if( !needsUpdate() )
	{
		painter.drawPixmap( 0, 0, m_paintPixmap );
		return;
	}

	setNeedsUpdate( false );

	m_paintPixmap = m_paintPixmap.isNull() == true || m_paintPixmap.size() != size() 
		? QPixmap( size() ) : m_paintPixmap;

	QPainter p( &m_paintPixmap );

	QLinearGradient lingrad( 0, 0, 0, height() );
	QColor c;
	bool muted = m_tco->getTrack()->isMuted() || m_tco->isMuted();
	
	// state: selected, muted, normal
	c = isSelected() ? selectedColor() : ( muted ? mutedBackgroundColor() 
		: painter.background().color() );

	lingrad.setColorAt( 1, c.darker( 300 ) );
	lingrad.setColorAt( 0, c );
	
	if( gradient() )
	{
		p.fillRect( rect(), lingrad );
	}
	else
	{
		p.fillRect( rect(), c );
	}

	p.setPen( !muted ? painter.pen().brush().color() : mutedColor() );
	
	const int spacing = TCO_BORDER_WIDTH + 1;
	
	QRect r = QRect( TCO_BORDER_WIDTH, spacing,
			qMax( static_cast<int>( m_tco->sampleLength() *
				pixelsPerTact() / DefaultTicksPerTact ), 1 ),
					rect().bottom() - 2 * spacing );
	m_tco->m_sampleBuffer->visualize( p, r, pe->rect() );

	// disable antialiasing for borders, since its not needed
	p.setRenderHint( QPainter::Antialiasing, false );

	if( r.width() < width() - 1 )
	{
		p.drawLine( r.x(), r.y() + r.height() / 2,
			rect().right() - TCO_BORDER_WIDTH, r.y() + r.height() / 2 );
	}

	// inner border
	p.setPen( c.lighter( 160 ) );
	p.drawRect( 1, 1, rect().right() - TCO_BORDER_WIDTH, 
		rect().bottom() - TCO_BORDER_WIDTH );
		
	// outer border
	p.setPen( c.darker( 300 ) );
	p.drawRect( 0, 0, rect().right(), rect().bottom() );
	
	// draw the 'muted' pixmap only if the pattern was manualy muted
	if( m_tco->isMuted() )
	{
		const int spacing = TCO_BORDER_WIDTH;
		const int size = 14;
		p.drawPixmap( spacing, height() - ( size + spacing ),
			embed::getIconPixmap( "muted", size, size ) );
	}
	
	// recording sample tracks is not possible at the moment 
	
	/* if( m_tco->isRecord() )
	{
		p.setFont( pointSize<7>( p.font() ) );

		p.setPen( textShadowColor() );
		p.drawText( 10, p.fontMetrics().height()+1, "Rec" );
		p.setPen( textColor() );
		p.drawText( 9, p.fontMetrics().height(), "Rec" );

		p.setBrush( QBrush( textColor() ) );
		p.drawEllipse( 4, 5, 4, 4 );
	}*/
	
	p.end();
	
	painter.drawPixmap( 0, 0, m_paintPixmap );
}
Exemplo n.º 22
0
void GLWidget::setVisibleBrokenEdges(bool visible)
{
	visibleBrokenEdges = visible;
	callListUptodate = false;
	emit needsUpdate();
}
Exemplo n.º 23
0
void GLWidget::wheelEvent(QWheelEvent *event)
{
	zTrans += event->delta()/100;
	emit needsUpdate();
}
Exemplo n.º 24
0
void BBTCOView::paintEvent( QPaintEvent * )
{
	QPainter painter( this );

	if( !needsUpdate() )
	{
		painter.drawPixmap( 0, 0, m_paintPixmap );
		return;
	}

	setNeedsUpdate( false );

	m_paintPixmap = m_paintPixmap.isNull() == true || m_paintPixmap.size() != size() 
		? QPixmap( size() ) : m_paintPixmap;

	QPainter p( &m_paintPixmap );

	QLinearGradient lingrad( 0, 0, 0, height() );
	QColor c;
	bool muted = m_bbTCO->getTrack()->isMuted() || m_bbTCO->isMuted();
	
	// state: selected, muted, default, user selected
	c = isSelected() ? selectedColor() : ( muted ? mutedBackgroundColor() 
		: ( m_bbTCO->m_useStyleColor ? painter.background().color() 
		: m_bbTCO->colorObj() ) );
	
	lingrad.setColorAt( 0, c.light( 130 ) );
	lingrad.setColorAt( 1, c.light( 70 ) );
	
	if( gradient() )
	{
		p.fillRect( rect(), lingrad );
	}
	else
	{
		p.fillRect( rect(), c );
	}
	
	// bar lines
	const int lineSize = 3;
	p.setPen( c.darker( 200 ) );

	tact_t t = Engine::getBBTrackContainer()->lengthOfBB( m_bbTCO->bbTrackIndex() );
	if( m_bbTCO->length() > MidiTime::ticksPerTact() && t > 0 )
	{
		for( int x = static_cast<int>( t * pixelsPerTact() );
								x < width() - 2;
			x += static_cast<int>( t * pixelsPerTact() ) )
		{
			p.drawLine( x, TCO_BORDER_WIDTH, x, TCO_BORDER_WIDTH + lineSize );
			p.drawLine( x, rect().bottom() - ( TCO_BORDER_WIDTH + lineSize ),
			 	x, rect().bottom() - TCO_BORDER_WIDTH );
		}
	}

	// pattern name
	p.setRenderHint( QPainter::TextAntialiasing );

	if(  m_staticTextName.text() != m_bbTCO->name() )
	{
		m_staticTextName.setText( m_bbTCO->name() );
	}

	QFont font;
	font.setHintingPreference( QFont::PreferFullHinting );
	font.setPointSize( 8 );
	p.setFont( font );

	const int textTop = TCO_BORDER_WIDTH + 1;
	const int textLeft = TCO_BORDER_WIDTH + 1;

	p.setPen( textShadowColor() );
	p.drawStaticText( textLeft + 1, textTop + 1, m_staticTextName );
	p.setPen( textColor() );
	p.drawStaticText( textLeft, textTop, m_staticTextName );

	// inner border
	p.setPen( c.lighter( 130 ) );
	p.drawRect( 1, 1, rect().right() - TCO_BORDER_WIDTH,
		rect().bottom() - TCO_BORDER_WIDTH );	

	// outer border
	p.setPen( c.darker( 300 ) );
	p.drawRect( 0, 0, rect().right(), rect().bottom() );
	
	// draw the 'muted' pixmap only if the pattern was manualy muted
	if( m_bbTCO->isMuted() )
	{
		const int spacing = TCO_BORDER_WIDTH;
		const int size = 14;
		p.drawPixmap( spacing, height() - ( size + spacing ),
			embed::getIconPixmap( "muted", size, size ) );
	}
	
	p.end();
	
	painter.drawPixmap( 0, 0, m_paintPixmap );
	
}
Exemplo n.º 25
0
void GLWidget::translateXY(double dx, double dy)
{
	xTrans += dx;
	yTrans += dy;
	emit needsUpdate();
}
Exemplo n.º 26
0
void GLWidget::rotateY(double dy)
{
	yRot += dy;
	emit needsUpdate();
}