コード例 #1
0
bool
MediaPluginGStreamer010::update(int milliseconds)
{
	if (!mDoneInit)
		return false; // error

	//writeToLog("updating media...");
	
	// sanity check
	if (NULL == mPump ||
	    NULL == mPlaybin)
	{
		writeToLog("dead media...");
		return false;
	}

	// see if there's an outstanding seek wanted
	if (mSeekWanted &&
	    // bleh, GST has to be happy that the movie is really truly playing
	    // or it may quietly ignore the seek (with rtsp:// at least).
	    (GST_STATE(mPlaybin) == GST_STATE_PLAYING))
	{
		seek(mSeekDestination);
		mSeekWanted = false;
	}

	// *TODO: time-limit - but there isn't a lot we can do here, most
	// time is spent in gstreamer's own opaque worker-threads.  maybe
	// we can do something sneaky like only unlock the video object
	// for 'milliseconds' and otherwise hold the lock.
	while (g_main_context_pending(g_main_loop_get_context(mPump)))
	{
	       g_main_context_iteration(g_main_loop_get_context(mPump), FALSE);
	}

	// check for availability of a new frame
	
	if (mVideoSink)
	{
	        GST_OBJECT_LOCK(mVideoSink);
		if (mVideoSink->retained_frame_ready)
		{
			writeToLog("NEW FRAME READY");

			if (mVideoSink->retained_frame_width != mCurrentWidth ||
			    mVideoSink->retained_frame_height != mCurrentHeight)
				// *TODO: also check for change in format
			{
				// just resize container, don't consume frame
				int neww = mVideoSink->retained_frame_width;
				int newh = mVideoSink->retained_frame_height;

				int newd = 4;
				mTextureFormatPrimary = GL_RGBA;
				mTextureFormatType = GL_UNSIGNED_INT_8_8_8_8_REV;

				/*
				int newd = SLVPixelFormatBytes[mVideoSink->retained_frame_format];
				if (SLV_PF_BGRX == mVideoSink->retained_frame_format)
				{
					mTextureFormatPrimary = GL_BGRA;
					mTextureFormatType = GL_UNSIGNED_INT_8_8_8_8_REV;
				}
				else
				{
					mTextureFormatPrimary = GL_RGBA;
					mTextureFormatType = GL_UNSIGNED_INT_8_8_8_8_REV;
				}
				*/

				GST_OBJECT_UNLOCK(mVideoSink);

				mCurrentRowbytes = neww * newd;
				writeToLog("video container resized to %dx%d",
					 neww, newh);

				mDepth = newd;
				mCurrentWidth = neww;
				mCurrentHeight = newh;
				sizeChanged();
				return true;
			}

			if (mPixels &&
			    mCurrentHeight <= mHeight &&
			    mCurrentWidth <= mWidth &&
			    !mTextureSegmentName.empty())
			{
				// we're gonna totally consume this frame - reset 'ready' flag
				mVideoSink->retained_frame_ready = FALSE;
				int destination_rowbytes = mWidth * mDepth;
				for (int row=0; row<mCurrentHeight; ++row)
				{
					memcpy(&mPixels
					        [destination_rowbytes * row],
					       &mVideoSink->retained_frame_data
					        [mCurrentRowbytes * row],
					       mCurrentRowbytes);
				}

				GST_OBJECT_UNLOCK(mVideoSink);
				writeToLog("NEW FRAME REALLY TRULY CONSUMED, TELLING HOST");

				setDirty(0,0,mCurrentWidth,mCurrentHeight);
			}
			else
			{
				// new frame ready, but we're not ready to
				// consume it.

				GST_OBJECT_UNLOCK(mVideoSink);

				writeToLog("NEW FRAME not consumed, still waiting for a shm segment and/or shm resize");
			}

			return true;
		}
		else
		{
			// nothing to do yet.
			GST_OBJECT_UNLOCK(mVideoSink);
			return true;
		}
	}

	return true;
}
コード例 #2
0
ファイル: gdvcanvas2d.cpp プロジェクト: jobusch/gdv-labor
void GdvCanvas2D::resizeEvent(QResizeEvent* pe)
{
    Q_UNUSED(pe);
    buffer2D = QImage(this->size(), QImage::Format_RGB32);
    emit sizeChanged(this->width(), this->height());
}
コード例 #3
0
void QDeclarativeGraphicsGeoMap::setPlugin(QDeclarativeGeoServiceProvider *plugin)
{
    if (plugin_) {
        qmlInfo(this) << tr("Plugin is a write-once property, and cannot be set again.");
        return;
    }

    plugin_ = plugin;

    emit pluginChanged(plugin_);

    serviceProvider_ = new QGeoServiceProvider(plugin_->name(),
            plugin_->parameterMap());

    if (serviceProvider_->error() != QGeoServiceProvider::NoError) {
        qWarning() << serviceProvider_->errorString();
        delete serviceProvider_;
        serviceProvider_ = 0;
        return;
    }

    mappingManager_ = serviceProvider_->mappingManager();
    if (!mappingManager_ || serviceProvider_->error() != QGeoServiceProvider::NoError) {
        qWarning() << serviceProvider_->errorString();
        delete serviceProvider_;
        serviceProvider_ = 0;
        delete mappingManager_;
        mappingManager_ = 0;
        return;
    }

    mapData_ = mappingManager_->createMapData();
    mapData_->init();
    //mapData_->setParentItem(this);

    // setters
    mapData_->setWindowSize(size_);
    mapData_->setZoomLevel(zoomLevel_);

    if (center_)
        mapData_->setCenter(center_->coordinate());
    else
        mapData_->setCenter(*initialCoordinate);

    mapData_->setMapType(QGraphicsGeoMap::MapType(mapType_));
    mapData_->setConnectivityMode(QGraphicsGeoMap::ConnectivityMode(connectivityMode_));

    // Populate the map objects.
    populateMap();
    // setup signals
    connect(mapData_,
            SIGNAL(updateMapDisplay(QRectF)),
            this,
            SLOT(updateMapDisplay(QRectF)));

    connect(mapData_,
            SIGNAL(centerChanged(QGeoCoordinate)),
            this,
            SLOT(internalCenterChanged(QGeoCoordinate)));

    connect(mapData_,
            SIGNAL(mapTypeChanged(QGraphicsGeoMap::MapType)),
            this,
            SLOT(internalMapTypeChanged(QGraphicsGeoMap::MapType)));

    connect(mapData_,
            SIGNAL(connectivityModeChanged(QGraphicsGeoMap::ConnectivityMode)),
            this,
            SLOT(internalConnectivityModeChanged(QGraphicsGeoMap::ConnectivityMode)));

    connect(mapData_,
            SIGNAL(windowSizeChanged(QSizeF)),
            this,
            SIGNAL(sizeChanged(QSizeF)));

    connect(mapData_,
            SIGNAL(zoomLevelChanged(qreal)),
            this,
            SIGNAL(zoomLevelChanged(qreal)));
}
コード例 #4
0
QgsComposerItemWidget::QgsComposerItemWidget( QWidget* parent, QgsComposerItem* item )
    : QgsComposerItemBaseWidget( parent, item )
    , mItem( item )
    , mFreezeXPosSpin( false )
    , mFreezeYPosSpin( false )
    , mFreezeWidthSpin( false )
    , mFreezeHeightSpin( false )
    , mFreezePageSpin( false )
{

  setupUi( this );

  //make button exclusive
  QButtonGroup* buttonGroup = new QButtonGroup( this );
  buttonGroup->addButton( mUpperLeftCheckBox );
  buttonGroup->addButton( mUpperMiddleCheckBox );
  buttonGroup->addButton( mUpperRightCheckBox );
  buttonGroup->addButton( mMiddleLeftCheckBox );
  buttonGroup->addButton( mMiddleCheckBox );
  buttonGroup->addButton( mMiddleRightCheckBox );
  buttonGroup->addButton( mLowerLeftCheckBox );
  buttonGroup->addButton( mLowerMiddleCheckBox );
  buttonGroup->addButton( mLowerRightCheckBox );
  buttonGroup->setExclusive( true );

  setValuesForGuiElements();
  connect( mItem->composition(), SIGNAL( paperSizeChanged() ), this, SLOT( setValuesForGuiPositionElements() ) );
  connect( mItem, SIGNAL( sizeChanged() ), this, SLOT( setValuesForGuiPositionElements() ) );
  connect( mItem, SIGNAL( itemChanged() ), this, SLOT( setValuesForGuiNonPositionElements() ) );

  connect( mTransparencySlider, SIGNAL( valueChanged( int ) ), mTransparencySpnBx, SLOT( setValue( int ) ) );

  QgsExpressionContext* context = mItem->createExpressionContext();
  mVariableEditor->setContext( context );
  mVariableEditor->setEditableScopeIndex( context->scopeCount() - 1 );
  delete context;

  connect( mVariableEditor, SIGNAL( scopeChanged() ), this, SLOT( variablesChanged() ) );

  //connect atlas signals to data defined buttons
  QgsAtlasComposition* atlas = atlasComposition();
  if ( atlas )
  {
    //repopulate data defined buttons if atlas layer changes
    connect( atlas, SIGNAL( coverageLayerChanged( QgsVectorLayer* ) ),
             this, SLOT( populateDataDefinedButtons() ) );
    connect( atlas, SIGNAL( toggled( bool ) ), this, SLOT( populateDataDefinedButtons() ) );
  }

  //connect data defined buttons
  connect( mXPositionDDBtn, SIGNAL( dataDefinedChanged( const QString& ) ), this, SLOT( updateDataDefinedProperty() ) );
  connect( mXPositionDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedProperty() ) );

  connect( mYPositionDDBtn, SIGNAL( dataDefinedChanged( const QString& ) ), this, SLOT( updateDataDefinedProperty() ) );
  connect( mYPositionDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedProperty() ) );

  connect( mWidthDDBtn, SIGNAL( dataDefinedChanged( const QString& ) ), this, SLOT( updateDataDefinedProperty() ) );
  connect( mWidthDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedProperty() ) );

  connect( mHeightDDBtn, SIGNAL( dataDefinedChanged( const QString& ) ), this, SLOT( updateDataDefinedProperty() ) );
  connect( mHeightDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedProperty() ) );

  connect( mItemRotationDDBtn, SIGNAL( dataDefinedChanged( const QString& ) ), this, SLOT( updateDataDefinedProperty() ) );
  connect( mItemRotationDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedProperty() ) );

  connect( mTransparencyDDBtn, SIGNAL( dataDefinedChanged( const QString& ) ), this, SLOT( updateDataDefinedProperty() ) );
  connect( mTransparencyDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedProperty() ) );

  connect( mBlendModeDDBtn, SIGNAL( dataDefinedChanged( const QString& ) ), this, SLOT( updateDataDefinedProperty() ) );
  connect( mBlendModeDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedProperty() ) );

  connect( mExcludePrintsDDBtn, SIGNAL( dataDefinedChanged( const QString& ) ), this, SLOT( updateDataDefinedProperty() ) );
  connect( mExcludePrintsDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedProperty() ) );
}
コード例 #5
0
void MediaPlayerPrivateAVFoundation::dispatchNotification()
{
    ASSERT(isMainThread());

    Notification notification = Notification();
    {
        MutexLocker lock(m_queueMutex);
        
        if (m_queuedNotifications.isEmpty())
            return;
        
        if (!m_delayCallbacks) {
            // Only dispatch one notification callback per invocation because they can cause recursion.
            notification = m_queuedNotifications.first();
            m_queuedNotifications.remove(0);
        }
        
        if (!m_queuedNotifications.isEmpty() && !m_mainThreadCallPending)
            callOnMainThread(mainThreadCallback, this);
        
        if (!notification.isValid())
            return;
    }

    LOG(Media, "MediaPlayerPrivateAVFoundation::dispatchNotification(%p) - dispatching %d", this, static_cast<int>(notification.type()));

    switch (notification.type()) {
    case Notification::ItemDidPlayToEndTime:
        didEnd();
        break;
    case Notification::ItemTracksChanged:
        tracksChanged();
        updateStates();
        break;
    case Notification::ItemStatusChanged:
        updateStates();
        break;
    case Notification::ItemSeekableTimeRangesChanged:
        seekableTimeRangesChanged();
        updateStates();
        break;
    case Notification::ItemLoadedTimeRangesChanged:
        loadedTimeRangesChanged();
        updateStates();
        break;
    case Notification::ItemPresentationSizeChanged:
        sizeChanged();
        updateStates();
        break;
    case Notification::ItemIsPlaybackLikelyToKeepUpChanged:
        updateStates();
        break;
    case Notification::ItemIsPlaybackBufferEmptyChanged:
        updateStates();
        break;
    case Notification::ItemIsPlaybackBufferFullChanged:
        updateStates();
        break;
    case Notification::PlayerRateChanged:
        updateStates();
        rateChanged();
        break;
    case Notification::PlayerTimeChanged:
        timeChanged(notification.time());
        break;
    case Notification::SeekCompleted:
        seekCompleted(notification.finished());
        break;
    case Notification::AssetMetadataLoaded:
        metadataLoaded();
        updateStates();
        break;
    case Notification::AssetPlayabilityKnown:
        updateStates();
        playabilityKnown();
        break;
    case Notification::DurationChanged:
        invalidateCachedDuration();
        break;
    case Notification::ContentsNeedsDisplay:
        contentsNeedsDisplay();
        break;
    case Notification::InbandTracksNeedConfiguration:
#if HAVE(AVFOUNDATION_TEXT_TRACK_SUPPORT)
        m_inbandTrackConfigurationPending = false;
        configureInbandTracks();
#endif
        break;

    case Notification::None:
        ASSERT_NOT_REACHED();
        break;
    }
}
コード例 #6
0
ファイル: openglrenderer.cpp プロジェクト: jobusch/gdv-labor
void OpenGLRenderer::initialize() {
    std::srand(std::time(0));
    glEnable(GL_DEPTH_TEST);
    //glEnable(GL_CULL_FACE);
    //glEnable(GL_TEXTURE_2D); // Einem Befehl wurde ein falscher Wert übergeben --> wurde in OpenGL 3.x entfernt (deprecated in 2.x)
    //glEnable(GL_BLEND);
    //glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    checkForErrors();

    initializeVAOs();
    initializeMeshShader();
    initializeFinalShader();
    initializeAddShader();
    initializeStarWarsShader();

    // Textur-Handler erzeugen
    glGenTextures(1, &texture_ID);

    sizeChanged(523, 482); // sonst sind viewWidth & viewHeight noch uninitialisiert, was zu Fehlern beim Rendern mit den FBOs und bei configureFBOTextures() führt

    // FBOs zugehörige Texturen für Transparenz & PostScreen-Effekte initialisieren
    initializeFBO(fbo1, colorTexture1, depthTexture1);
    initializeFBO(fbo2, colorTexture2, depthTexture2);
    initializeFBO(fbo3, colorTexture3, depthTexture3);

    /*// Texturhandles erstellen
    glGenTextures(1, &colorTexture1);
    glGenTextures(1, &depthTexture1);
    glGenTextures(1, &colorTexture2);
    glGenTextures(1, &depthTexture2);
    glGenTextures(1, &colorTexture3);
    glGenTextures(1, &depthTexture3);
    checkForErrors();
    // Konfiguriert leere Color- und Depth-Texturen in Bildschirmgröße, in die am Ende die leeren Dreiecke aus dem VBO_fbo gerendert werden können
    configureFBOTextures(colorTexture1, depthTexture1);
    configureFBOTextures(colorTexture2, depthTexture2);
    configureFBOTextures(colorTexture3, depthTexture3);
    checkForErrors();
    // Erzeuge neue FBOs
    glGenFramebuffers(1, &fbo1);
    glBindFramebuffer(GL_FRAMEBUFFER, fbo1);
    glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, colorTexture1, 0);   // Verknüpfe Color-Textur 1 mit dem FBO
    glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, depthTexture1, 0);    // Verknüpfe Depth-Textur 1 mit dem FBO

    glGenFramebuffers(1, &fbo2);
    glBindFramebuffer(GL_FRAMEBUFFER, fbo2);
    glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, colorTexture2, 0);   // Verknüpfe Color-Textur 2 mit dem FBO
    glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, depthTexture2, 0);    // Verknüpfe Depth-Textur 2 mit dem FBO

    glGenFramebuffers(1, &fbo3);
    glBindFramebuffer(GL_FRAMEBUFFER, fbo3);
    glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, colorTexture3, 0);   // Verknüpfe Color-Textur 3 mit dem FBO
    glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, depthTexture3, 0);    // Verknüpfe Depth-Textur 3 mit dem FBO


    if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
        qDebug ( ) << "Error, FBO not complete!";
    }
    // gebundene Framebuffer wieder loslösen
    glBindFramebuffer(GL_FRAMEBUFFER, 0);

    checkForErrors();*/
}
コード例 #7
0
ファイル: CQFontChooser.cpp プロジェクト: colinw7/CQUtil
void
CQFontChooser::
styleChanged()
{
  sizeChanged();
}
コード例 #8
0
void choseCAndF::setSize(const int& numberForSize)
{
    fontSize=numberForSize;
    emit sizeChanged(fontSize);
}
コード例 #9
0
/**
  This method is EXTREMELY important.
  Virtually every geometry-editing-function passes through here.
*/
bool EdgeWidget::setPosition(int location, ScreenEdge edge, const QSize &newSize)
{
	// Store some important variables to be able to restore them if things don't go well.
	QRect oldDg = _desiredGeometry;
	ScreenEdge oldEdge = _edge;

	// This really is not the best way to solve the problem with posdragging, but for now it will suffice.
	QPoint oldPosDragging;
	if (_posDragging)
		oldPosDragging = *_posDragging;

	// Set the size of desiredGeometry to do the coming calculations on the new desired size (location and such)
	_desiredGeometry.setSize(newSize);

	// Make sure we only deal with "real" edges, we don't want to have to check for SameEdge everywhere.
	if (edge == SameEdge)
		edge = oldEdge;

	// We only tranpose for now, we don't emit edgeChange-signals to trigger reorienting widgets,
	// in case things don't work out with the new geometry.
	if ((edge != oldEdge) && _edgeAdjust)
			adjustOrientation(_desiredGeometry, edge);

	// Do all coming calculations based on the new edge
	_edge = edge;

	// Check we're not moving out of screen
	int minLocation = 0;
	int maxLocation = (orientation(edge) == Horizontal)?
			_screen->width() - _desiredGeometry.width():
			_screen->height() - _desiredGeometry.height();
	if (location < minLocation)
		location = minLocation;
	if (location > maxLocation)
		location = maxLocation;

	// Now, we should have figured the final size, edge and location, just make it so.
	switch (edge)
	{
		case TopEdge:
			_desiredGeometry.moveLeft(location);
			_desiredGeometry.moveTop(-_currentOffset);
			break;
		case BottomEdge:
			_desiredGeometry.moveLeft(location);
			_desiredGeometry.moveBottom(_screen->height()+_currentOffset);
			break;
		case LeftEdge:
			_desiredGeometry.moveLeft(-_currentOffset);
			_desiredGeometry.moveTop(location);
			break;
		case RightEdge:
			_desiredGeometry.moveRight(_screen->width()+_currentOffset);
			_desiredGeometry.moveTop(location);
			break;
		default:
			_desiredGeometry.moveLeft(0);
			_desiredGeometry.moveTop(0);
	}

	// Check for collsion, this is a recursive call.
	if (EdgeWidgetManager::instance()->checkCollision(*this))
	{
		// If things did not work out, restore the desired geometry and edge to the way they were before.
		_desiredGeometry = oldDg;
		_edge = oldEdge;

		if (_posDragging)
			*_posDragging = oldPosDragging;

		// False indicates the new geometry had unresolved collisions.
		return false;
	}
	else
	{
		// Apply the new geometry
		QWidget::setGeometry(_desiredGeometry);

		// Ok, new geometry was OK, emit the edgechange signal and give the widget a chance to adjust.
		if (oldEdge != edge)
			emit edgeChanged(oldEdge, edge);

		if (pos() != _desiredGeometry.topLeft())
		{
			if (!_posDragging)
				emit positionChanged();
			emit positionChanging();
		}

		if (size() != _desiredGeometry.size())
		{
			if (!_sizeDragging)
				emit sizeChanged();
			emit sizeChanging();
		}

		// True indicates there were no unresolved problems with the new geometry.
		return true;
	}
}
コード例 #10
0
void ContainerStatus::resizeEvent(QResizeEvent *e)
{
    QStatusBar::resizeEvent(e);
    emit sizeChanged(width());
}
コード例 #11
0
ファイル: backupinfo.cpp プロジェクト: LillyFoxBlogs/Sachesi
void BackupInfo::setSize(const qint64 &val) {
    _size = val;
    emit sizeChanged();
}
コード例 #12
0
ファイル: tankitem.cpp プロジェクト: AddictXQ/subsurface
void TankItem::setHorizontalAxis(DiveCartesianAxis *horizontal)
{
	hAxis = horizontal;
	connect(hAxis, SIGNAL(sizeChanged()), this, SLOT(modelDataChanged()));
	modelDataChanged();
}
コード例 #13
0
ファイル: PlaylistFileSize.cpp プロジェクト: cancamilo/amarok
void
ConstraintTypes::PlaylistFileSizeEditWidget::on_spinBox_Size_valueChanged( const int l )
{
    emit sizeChanged( l );
    emit updated();
}
コード例 #14
0
ファイル: snake.cpp プロジェクト: DexterLB/snake
void Snake::setSize(QSize size)
{
    this->m_size = size;
    emit sizeChanged();
}
コード例 #15
0
ファイル: new_game_dialog.cpp プロジェクト: chtitux/tanglet
NewGameDialog::NewGameDialog(QWidget* parent)
    : QDialog(parent, Qt::MSWindowsFixedSizeDialogHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint), m_minimum(3)
{
    setWindowTitle(tr("New Game"));

    QVBoxLayout* layout = new QVBoxLayout(this);

    QSettings settings;
    int previous_timer = settings.value("Board/TimerMode", Clock::Tanglet).toInt();

    // Create size buttons
    m_normal_size = new QToolButton(this);
    m_normal_size->setAutoExclusive(true);
    m_normal_size->setAutoRaise(true);
    m_normal_size->setCheckable(true);
    m_normal_size->setIconSize(QSize(64, 64));
    m_normal_size->setIcon(QPixmap(":/preview/normal.png"));
    m_normal_size->setText(Board::sizeToString(4));
    m_normal_size->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    connect(m_normal_size, SIGNAL(clicked()), this, SLOT(sizeChanged()));

    m_large_size = new QToolButton(this);
    m_large_size->setAutoExclusive(true);
    m_large_size->setAutoRaise(true);
    m_large_size->setCheckable(true);
    m_large_size->setIconSize(QSize(64, 64));
    m_large_size->setIcon(QPixmap(":/preview/large.png"));
    m_large_size->setText(Board::sizeToString(5));
    m_large_size->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    connect(m_large_size, SIGNAL(clicked()), this, SLOT(sizeChanged()));

    if (settings.value("Board/Size", 4).toInt() == 4) {
        m_normal_size->setChecked(true);
    } else {
        m_large_size->setChecked(true);
    }

    QHBoxLayout* size_buttons = new QHBoxLayout;
    size_buttons->setMargin(0);
    size_buttons->addStretch();
    size_buttons->addWidget(m_normal_size);
    size_buttons->addWidget(m_large_size);
    size_buttons->addStretch();
    layout->addLayout(size_buttons);
    layout->addSpacing(6);

    // Create word options
    m_density = new QComboBox(this);
    for (int i = 0; i < 4; ++i) {
        m_density->addItem(densityString(i));
    }
    m_density->setCurrentIndex(settings.value("Board/Density", 1).toInt());

    m_length = new QComboBox(this);
    for (int i = 0; i < 4; ++i) {
        m_length->addItem("");
    }
    connect(m_length, SIGNAL(currentIndexChanged(int)), this, SLOT(lengthChanged(int)));
    m_minimum = settings.value("Board/Minimum", 3).toInt();
    if (m_large_size->isChecked()) {
        --m_minimum;
    }
    m_length->setCurrentIndex(qBound(0, m_minimum - 3, 4));
    sizeChanged();

    QFormLayout* options_layout = new QFormLayout;
    options_layout->setFormAlignment(Qt::AlignHCenter | Qt::AlignTop);
    options_layout->setLabelAlignment(Qt::AlignRight | Qt::AlignVCenter);
    options_layout->addRow(tr("Amount of Words:"), m_density);
    options_layout->addRow(tr("Minimum Word Length:"), m_length);
    layout->addLayout(options_layout);
    layout->addSpacing(6);

    // Create timer buttons
    QSignalMapper* mapper = new QSignalMapper(this);
    connect(mapper, SIGNAL(mapped(int)), this, SLOT(timerChosen(int)));

    QList<TimerDescription> timers;
    for (int i = Clock::Tanglet; i < Clock::TotalTimers; ++i) {
        timers.append(i);
    }
    qSort(timers);
    foreach (const TimerDescription& timer, timers) {
        QCommandLinkButton* button = new QCommandLinkButton(timer.name(), timer.description(), this);
        button->setMinimumWidth(500);
        connect(button, SIGNAL(clicked()), mapper, SLOT(map()));
        mapper->setMapping(button, timer.id());
        layout->addWidget(button);

        if (timer.id() == previous_timer) {
            button->setDefault(true);
            button->setFocus();
        }
    }
コード例 #16
0
ファイル: statistictablemodel.cpp プロジェクト: KDE/okteta
void StatisticTableModel::update( int size )
{
    mSize = size;
    emit dataChanged( index(0,CountId), index(StatisticsByteSetSize-1,PercentId) );
    emit sizeChanged( mSize );
}
コード例 #17
0
void MainWindow::resizeEvent(QResizeEvent *re){
	emit sizeChanged();
	
}
コード例 #18
0
void DotMatrixRepresentation::onWidgetSizeChanged(const QSize &s)
{
	dmWidget->setSize(s);

	emit sizeChanged(s);
}
コード例 #19
0
ファイル: pagesview.cpp プロジェクト: Kalarel/leechcraft
	void PagesView::resizeEvent (QResizeEvent *e)
	{
		QGraphicsView::resizeEvent (e);
		emit sizeChanged ();
	}
コード例 #20
0
void
QmlChoiseModel::emitSizeChanged(const QModelIndex &, int, int) {
    emit sizeChanged();
}
コード例 #21
0
ファイル: qmlrulesmodel.cpp プロジェクト: fmayet/profilematic
void
QmlRulesModel::emitSizeChanged(const QModelIndex &, int, int) {
    emit sizeChanged();
}
コード例 #22
0
void CDoodFileViewManager::setSize(long long data)
{
    setField(mSize,data,"size");
    emit sizeChanged();
}
コード例 #23
0
void MediaPlayerPrivateAVFoundation::dispatchNotification()
{
    ASSERT(isMainThread());

    Notification notification = Notification();
    {
        MutexLocker lock(m_queueMutex);
        
        if (m_queuedNotifications.isEmpty())
            return;
        
        if (!m_delayCallbacks) {
            // Only dispatch one notification callback per invocation because they can cause recursion.
            notification = m_queuedNotifications.first();
            m_queuedNotifications.remove(0);
        }
        
        if (!m_queuedNotifications.isEmpty() && !m_mainThreadCallPending)
            callOnMainThread(mainThreadCallback, this);
        
        if (!notification.isValid())
            return;
    }

    LOG(Media, "MediaPlayerPrivateAVFoundation::dispatchNotification(%p) - dispatching %d", this, static_cast<int>(notification.type()));

    switch (notification.type()) {
    case Notification::ItemDidPlayToEndTime:
        didEnd();
        break;
    case Notification::ItemTracksChanged:
        tracksChanged();
        break;
    case Notification::ItemStatusChanged:
        loadStateChanged();
        break;
    case Notification::ItemSeekableTimeRangesChanged:
        seekableTimeRangesChanged();
        loadStateChanged();
        break;
    case Notification::ItemLoadedTimeRangesChanged:
        loadedTimeRangesChanged();
        loadStateChanged();
        break;
    case Notification::ItemPresentationSizeChanged:
        sizeChanged();
        break;
    case Notification::ItemIsPlaybackLikelyToKeepUpChanged:
        loadStateChanged();
        break;
    case Notification::ItemIsPlaybackBufferEmptyChanged:
        loadStateChanged();
        break;
    case Notification::ItemIsPlaybackBufferFullChanged:
        loadStateChanged();
        break;
    case Notification::PlayerRateChanged:
        rateChanged();
        break;
    case Notification::PlayerTimeChanged:
        timeChanged(notification.time());
        break;
    case Notification::AssetMetadataLoaded:
        metadataLoaded();
        break;
    case Notification::AssetPlayabilityKnown:
        playabilityKnown();
        break;
    case Notification::None:
        ASSERT_NOT_REACHED();
        break;
    }
}
コード例 #24
0
void DiveEventItem::setVerticalAxis(DiveCartesianAxis *axis)
{
	vAxis = axis;
	recalculatePos(true);
	connect(vAxis, SIGNAL(sizeChanged()), this, SLOT(recalculatePos()));
}
コード例 #25
0
void MeanDepthLine::setAxis(DiveCartesianAxis *a)
{
    connect(a, SIGNAL(sizeChanged()), this, SLOT(axisLineChanged()));
}
コード例 #26
0
void MediaPluginGStreamer010::receiveMessage(const char *message_string)
{
	//std::cerr << "MediaPluginGStreamer010::receiveMessage: received message: \"" << message_string << "\"";

	LLPluginMessage message_in;

	if(message_in.parse(message_string) >= 0)
	{
		std::string message_class = message_in.getClass();
		std::string message_name = message_in.getName();
		if(message_class == LLPLUGIN_MESSAGE_CLASS_BASE)
		{
			if(message_name == "init")
			{
				LLPluginMessage message("base", "init_response");
				LLSD versions = LLSD::emptyMap();
				versions[LLPLUGIN_MESSAGE_CLASS_BASE] = LLPLUGIN_MESSAGE_CLASS_BASE_VERSION;
				versions[LLPLUGIN_MESSAGE_CLASS_MEDIA] = LLPLUGIN_MESSAGE_CLASS_MEDIA_VERSION;
				versions[LLPLUGIN_MESSAGE_CLASS_MEDIA_TIME] = LLPLUGIN_MESSAGE_CLASS_MEDIA_TIME_VERSION;
				message.setValueLLSD("versions", versions);

				if ( load() )
				{
					writeToLog("GStreamer010 media instance set up");
				}
				else
				{
					writeToLog("GStreamer010 media instance failed to set up");
				}

				message.setValue("plugin_version", getVersion());
				sendMessage(message);
			}
			else if(message_name == "idle")
			{
				// no response is necessary here.
				double time = message_in.getValueReal("time");
				
				// Convert time to milliseconds for update()
				update((int)(time * 1000.0f));
			}
			else if(message_name == "cleanup")
			{
				writeToLog("MediaPluginGStreamer010::receiveMessage: cleanup");
				unload();
				closedown();

				// Reply once we're done
				LLPluginMessage message("base", "cleanup_reply");
				sendMessage(message);

				// Now suicide. Because It is the only honorable thing to do.
				// JUST BE CAREFUL! 
				// http://www.parashift.com/c++-faq-lite/delete-this.html	
				delete this;
				return;
			}
			else if(message_name == "shm_added")
			{
				SharedSegmentInfo info;
				info.mAddress = message_in.getValuePointer("address");
				info.mSize = (size_t)message_in.getValueS32("size");
				std::string name = message_in.getValue("name");

				std::ostringstream str;
				writeToLog("MediaPluginGStreamer010::receiveMessage: shared memory added, name: %s, size: %d, address: %p", name.c_str(), int(info.mSize), info.mAddress);

				mSharedSegments.insert(SharedSegmentMap::value_type(name, info));
			}
			else if(message_name == "shm_remove")
			{
				std::string name = message_in.getValue("name");

				writeToLog("MediaPluginGStreamer010::receiveMessage: shared memory remove, name = %s", name.c_str());
				
				SharedSegmentMap::iterator iter = mSharedSegments.find(name);
				if(iter != mSharedSegments.end())
				{
					if(mPixels == iter->second.mAddress)
					{
						// This is the currently active pixel buffer.  Make sure we stop drawing to it.
						mPixels = NULL;
						mTextureSegmentName.clear();
						
						// Make sure the movie decoder is no longer pointed at the shared segment.
						sizeChanged();						
					}
					mSharedSegments.erase(iter);
				}
				else
				{
					writeToLog("MediaPluginGStreamer010::receiveMessage: unknown shared memory region!");
				}

				// Send the response so it can be cleaned up.
				LLPluginMessage message("base", "shm_remove_response");
				message.setValue("name", name);
				sendMessage(message);
			}
			else
			{
				std::ostringstream str;
				writeToLog("MediaPluginGStreamer010::receiveMessage: unknown base message: %s", message_name.c_str());
			}
		}
		else if(message_class == LLPLUGIN_MESSAGE_CLASS_MEDIA)
		{
			if(message_name == "init")
			{
				// Plugin gets to decide the texture parameters to use.
				LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "texture_params");
				// lame to have to decide this now, it depends on the movie.  Oh well.
				mDepth = 4;

				mCurrentWidth = 1;
				mCurrentHeight = 1;
				mPreviousWidth = 1;
				mPreviousHeight = 1;
				mNaturalWidth = 1;
				mNaturalHeight = 1;
				mWidth = 1;
				mHeight = 1;
				mTextureWidth = 1;
				mTextureHeight = 1;

				message.setValueU32("format", GL_RGBA);
				message.setValueU32("type", GL_UNSIGNED_INT_8_8_8_8_REV);

				message.setValueS32("depth", mDepth);
				message.setValueS32("default_width", mWidth);
				message.setValueS32("default_height", mHeight);
				message.setValueU32("internalformat", GL_RGBA8);
				message.setValueBoolean("coords_opengl", true);	// true == use OpenGL-style coordinates, false == (0,0) is upper left.
				message.setValueBoolean("allow_downsample", true); // we respond with grace and performance if asked to downscale
				sendMessage(message);
			}
			else if(message_name == "size_change")
			{
				std::string name = message_in.getValue("name");
				S32 width = message_in.getValueS32("width");
				S32 height = message_in.getValueS32("height");
				S32 texture_width = message_in.getValueS32("texture_width");
				S32 texture_height = message_in.getValueS32("texture_height");

				std::ostringstream str;
				writeToLog("---->Got size change instruction from application with shm name: %s - size is %d x %d", name.c_str(), width, height);

				LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "size_change_response");
				message.setValue("name", name);
				message.setValueS32("width", width);
				message.setValueS32("height", height);
				message.setValueS32("texture_width", texture_width);
				message.setValueS32("texture_height", texture_height);
				sendMessage(message);

				if(!name.empty())
				{
					// Find the shared memory region with this name
					SharedSegmentMap::iterator iter = mSharedSegments.find(name);
					if(iter != mSharedSegments.end())
					{
						writeToLog("*** Got size change with matching shm, new size is %d x %d", width, height);
						writeToLog("*** Got size change with matching shm, texture size size is %d x %d", texture_width, texture_height);

						mPixels = (unsigned char*)iter->second.mAddress;
						mTextureSegmentName = name;
						mWidth = width;
						mHeight = height;

						if (texture_width > 1 ||
						    texture_height > 1) // not a dummy size from the app, a real explicit forced size
						{
							writeToLog("**** = REAL RESIZE REQUEST FROM APP");
							
							GST_OBJECT_LOCK(mVideoSink);
							mVideoSink->resize_forced_always = true;
							mVideoSink->resize_try_width = texture_width;
							mVideoSink->resize_try_height = texture_height;
							GST_OBJECT_UNLOCK(mVideoSink);
 						}

						mTextureWidth = texture_width;
						mTextureHeight = texture_height;
					}
				}
			}
			else if(message_name == "load_uri")
			{
				std::string uri = message_in.getValue("uri");
				navigateTo( uri );
				sendStatus();		
			}
			else if(message_name == "mouse_event")
			{
				std::string event = message_in.getValue("event");
				S32 x = message_in.getValueS32("x");
				S32 y = message_in.getValueS32("y");
				
				if(event == "down")
				{
					mouseDown(x, y);
				}
				else if(event == "up")
				{
					mouseUp(x, y);
				}
				else if(event == "move")
				{
					mouseMove(x, y);
				};
			};
		}
		else if(message_class == LLPLUGIN_MESSAGE_CLASS_MEDIA_TIME)
		{
			if(message_name == "stop")
			{
				stop();
			}
			else if(message_name == "start")
			{
				double rate = 0.0;
				if(message_in.hasValue("rate"))
				{
					rate = message_in.getValueReal("rate");
				}
				// NOTE: we don't actually support rate.
				play(rate);
			}
			else if(message_name == "pause")
			{
				pause();
			}
			else if(message_name == "seek")
			{
				double time = message_in.getValueReal("time");
				// defer the actual seek in case we haven't
				// really truly started yet in which case there
				// is nothing to seek upon
				mSeekWanted = true;
				mSeekDestination = time;
			}
			else if(message_name == "set_loop")
			{
				bool loop = message_in.getValueBoolean("loop");
				mIsLooping = loop;
			}
			else if(message_name == "set_volume")
			{
				double volume = message_in.getValueReal("volume");
				writeToLog("MediaPluginGStreamer010::receiveMessage: set_volume: %f", volume);
				setVolume(volume);
			}
		}
		else
		{
			writeToLog("MediaPluginGStreamer010::receiveMessage: unknown message class: %s", message_class.c_str());
		}
	}
}
コード例 #27
0
void AbstractProfilePolygonItem::setHorizontalAxis(DiveCartesianAxis *horizontal)
{
	hAxis = horizontal;
	connect(hAxis, SIGNAL(sizeChanged()), this, SLOT(modelDataChanged()));
	modelDataChanged();
}
コード例 #28
0
ファイル: StelDialog.cpp プロジェクト: Stellarium/stellarium
void StelDialog::setVisible(bool v)
{
	if (v)
	{
		StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
		Q_ASSERT(gui);
		QSize screenSize = StelMainView::getInstance().size();
		QSize maxSize = 0.8*screenSize;
		if (dialog)
		{
			// reload stylesheet, in case size changed!
			dialog->setStyleSheet(gui->getStelStyle().qtStyleSheet);

			dialog->show();
			StelMainView::getInstance().scene()->setActiveWindow(proxy);
			// If the main window has been resized, it is possible the dialog
			// will be off screen.  Check for this and move it to a visible
			// position if necessary
			QPointF newPos = proxy->pos();
			if (newPos.x()>=screenSize.width())
				newPos.setX(screenSize.width() - dialog->size().width());
			if (newPos.y()>=screenSize.height())
				newPos.setY(screenSize.height() - dialog->size().height());
			if (newPos != dialog->pos())
				proxy->setPos(newPos);
			QSizeF newSize = proxy->size();
			if (newSize.width() >= maxSize.width())
				newSize.setWidth(maxSize.width());
			if (newSize.height() >= maxSize.height())
				newSize.setHeight(maxSize.height());
			if(newSize != dialog->size())
				proxy->resize(newSize);
		}
		else
		{
			QGraphicsWidget* parent = qobject_cast<QGraphicsWidget*>(this->parent());
			dialog = new QDialog(Q_NULLPTR);
			// dialog->setParent(parent);
			//dialog->setAttribute(Qt::WA_OpaquePaintEvent, true);
			connect(dialog, SIGNAL(rejected()), this, SLOT(close()));
			createDialogContent();
			dialog->setStyleSheet(gui->getStelStyle().qtStyleSheet);

			// Ensure that tooltip get rendered in red in night mode.
			connect(&StelApp::getInstance(), SIGNAL(visionNightModeChanged(bool)), this, SLOT(updateNightModeProperty()));
			updateNightModeProperty();

			proxy = new CustomProxy(parent, Qt::Tool);
			proxy->setWidget(dialog);
			QSizeF size = proxy->size();

			connect(proxy, SIGNAL(sizeChanged(QSizeF)), this, SLOT(handleDialogSizeChanged(QSizeF)));

			int newX, newY;

			// Retrieve panel locations from config.ini, but shift if required to a visible position.
			// else centre dialog according to current window size.
			QSettings *conf=StelApp::getInstance().getSettings();
			Q_ASSERT(conf);
			QString confNamePt="DialogPositions/" + dialogName;
			QString storedPosString=conf->value(confNamePt,
							    QString("%1,%2")
							    .arg((int)((screenSize.width()  - size.width() )/2))
							    .arg((int)((screenSize.height() - size.height())/2)))
					.toString();
			QStringList posList=storedPosString.split(",");
			if (posList.length()==2)
			{
				newX=posList.at(0).toInt();
				newY=posList.at(1).toInt();
			}
			else	// in case there is an invalid string?
			{
				newX=(int)((screenSize.width()  - size.width() )/2);
				newY=(int)((screenSize.height() - size.height())/2);
			}

			if (newX>=screenSize.width())
				newX= (screenSize.width()  - dialog->size().width());
			if (newY>=screenSize.height())
				newY= (screenSize.height() - dialog->size().height());

			// Make sure that the window's title bar is accessible
			if (newY <-0)
				newY = 0;
			proxy->setPos(newX, newY);
			proxy->setWindowFrameMargins(2,0,2,2);
			// (this also changes the bounding rectangle size)

			// Retrieve stored panel sizes, scale panel up if it was stored larger than default.
			QString confNameSize="DialogSizes/" + dialogName;
			QString storedSizeString=conf->value(confNameSize, QString("0,0")).toString();
			QStringList sizeList=storedSizeString.split(",");
			if (sizeList.length()==2)
			{
				newX=sizeList.at(0).toInt();
				newY=sizeList.at(1).toInt();
			}
			else	// in case there is an invalid string?
			{
				newX=0;
				newY=0;
			}
			// resize only if number was valid and larger than default loaded size.
			if ( (newX>=proxy->size().width()) || (newY>=proxy->size().height()) )
			{
				//qDebug() << confNameSize << ": resize to " << storedSizeString;
				proxy->resize(qMax((qreal)newX, proxy->size().width()), qMax((qreal)newY, proxy->size().height()));
			}
			if(proxy->size().width() > maxSize.width() || proxy->size().height() > maxSize.height())
			{
				proxy->resize(maxSize);
			}
			handleDialogSizeChanged(proxy->size()); // This may trigger internal updates in subclasses. E.g. LocationPanel location arrow.

			// The caching is buggy on all platforms with Qt 4.5.2
			// Disabled on mac for the moment (https://github.com/Stellarium/stellarium/issues/393)
			#ifndef Q_OS_MAC
			proxy->setCacheMode(QGraphicsItem::ItemCoordinateCache);
			#endif

			proxy->setZValue(100);
			StelMainView::getInstance().scene()->setActiveWindow(proxy);
		}
		proxy->setFocus();
	}
	else
	{