void Ut_WidgetNotificationSink::testNotificationShownOnlyIfItContainsText()
{
    TestNotificationParameters parameters("", "", "");
    bool ret1( m_subject->containsText(Notification(3, 1, 0, parameters, Notification::ApplicationEvent, 1020)) );
    QCOMPARE(false, ret1);
    TestNotificationParameters parameters2("title", "subtitle", "buttonicon1");
    bool ret2( m_subject->containsText(Notification(3, 1, 0, parameters2, Notification::ApplicationEvent, 1020)) );
    QCOMPARE(true, ret2);
}
void Ut_WidgetNotificationSink::testInfoBannerClickingWhenNotUserRemovable(TestNotificationParameters &parameters)
{
    // Create info banner from the parameters by first adding an action into the parameters
    QApplication::processEvents();
    uint notificationID = 0;
    parameters.add(NotificationWidgetParameterFactory::createActionParameter("content0 0 0 0"));
    QScopedPointer<MBanner> infoBanner(m_subject->createInfoBanner(Notification(notificationID, 0, 1, parameters, Notification::ApplicationEvent, 1000)));

    // Listen to triggered signals of info banner action
    QCOMPARE(actions.count(), 1);
    MRemoteAction *action = dynamic_cast<MRemoteAction *>(actions[infoBanner.data()].at(0));
    QVERIFY(action != NULL);

    // Listen to notification removal requests of WidgetNotificationSink
    QSignalSpy notificationRemovalRequested(m_subject, SIGNAL(notificationRemovalRequested(uint)));

    // Click the infoBanner
    connect(this, SIGNAL(click()), infoBanner.data(), SIGNAL(clicked()));
    emit click();
    disconnect(this, SIGNAL(click()), infoBanner.data(), SIGNAL(clicked()));
    QApplication::processEvents();

    // Verify that action was triggered even though the info banner is not user removable
    QCOMPARE(actionTriggeredCount, 1);

    // Verify that request for notification removal was not emitted since the info banner is not user removable
    QCOMPARE(notificationRemovalRequested.count(), 0);
}
void FEditorLiveStreaming::StopBroadcastingEditor()
{
	if( IsBroadcastingEditor() )
	{
		CloseBroadcastStatusWindow();

		LiveStreamer->StopWebCam();
		LiveStreamer->StopBroadcasting();

		// Unregister for status changes
		LiveStreamer->OnStatusChanged().RemoveAll( this );
		LiveStreamer->OnChatMessage().RemoveAll( this );

		LiveStreamer = nullptr;

		// Tell our notification to start expiring
		TSharedPtr< SNotificationItem > Notification( NotificationWeakPtr.Pin() );
		if( Notification.IsValid() )
		{
			Notification->ExpireAndFadeout();
		}

		bIsBroadcasting = false;
		for( int32 BufferIndex = 0; BufferIndex < 2; ++BufferIndex )
		{
			ReadbackBuffers[BufferIndex].Reset();
		}
		ReadbackBufferIndex = 0;
		SubmittedVideoFrameCount = 0;
	}
}
Esempio n. 4
0
void InventoryWindow::OpenDownloadProgess(const QString &asset_id, const QString &name)
{
    // Make one custom widget as download manager, untill then disable this because its quite intrusive for a user to pop up dialogs
    // and they dont atm come to from and the position is calculated with inv window or something strange

    /*
        QMessageBox *msgBox = new QMessageBox(QMessageBox::Information, "", "Downloading asset " + asset_id, QMessageBox::Ok);
        msgBox->setModal(false);
        downloadDialogs_[asset_id] = msgBox;

        boost::shared_ptr<UiServices::UiModule> ui_module =
            framework_->GetModuleManager()->GetModule<UiServices::UiModule>().lock();
        if (ui_module.get())
        {
            QPointF pos = mainWidget_->mapToGlobal(QPoint(0, 0));
            pos.setX(pos.x() + offset_);
            pos.setY(pos.y() + offset_);
            offset_ += 20;

            ui_module->GetSceneManager()->AddWidgetToScene(
                msgBox, UiServices::UiWidgetProperties(pos, msgBox->size(), Qt::Dialog, "Download: " + name, false));
        }

        msgBox->show();
    */

#ifndef UISERVICE_TEST
    ///\todo Find a way to update the download process if possible
    UiServices::ProgressController *progress_controller = new UiServices::ProgressController();
    emit Notification(new UiServices::ProgressNotification("Downloading " + name + " from inventory", progress_controller));
    progress_controller->Start(11);
    notification_progress_map_[asset_id] = progress_controller;
#endif
}
///////////////////////////////////////////////////////////////////////////////
// ChangeOccurred - Process a change.  This stores all information needed to
//                  process the change when DistributeQueuedChanges is called.
Error
ChangeManager::ChangeOccurred(
    ISubject* pInChangedSubject,
    System::Changes::BitMask uInChangedBits
) {
    Error curError = Errors::Undefined;
    ASSERT(pInChangedSubject);

    if (pInChangedSubject) {
        if (!uInChangedBits) {
            // The subject is shutting down - remove its reference
            curError = RemoveSubject(pInChangedSubject);
        } else {
            // Get thread local notification list
            //NotifyList& notifyList = *m_tlsNotifyList.get();
            std::vector<Notification>& notifyList = GetNotifyList(m_tlsNotifyList);

            // IMPLEMENTATION NOTE
            // Don't check for duplicate instertions
            //
            // For the sake of performance and scalability don't do any operations
            // that may require locks (requesting ID or checking shared data structures).
            // Frequent locking hurts incomparably more than even high percentage
            // of duplicated insertions, especially taking into account that the memory
            // is preallocated most of the time.
            notifyList.push_back(Notification(pInChangedSubject, uInChangedBits));
            curError = Errors::Success;
        }
    }

    return curError;
}
void NotifierListener::onNotify(int32_t msg_type,
        int32_t ext1,
        int32_t ext2,
        int32_t ext3) {
    Mutex::Autolock l(mMutex);
    mNotifications.push_back(Notification(msg_type, ext1, ext2, ext3));
    mNewNotification.signal();
}
void Ut_WidgetNotificationSink::testWhenNotificationsCreatedAreNotClickableWhenClickingThemDoesNotWork()
{
    TestNotificationParameters parameters("title1", "subtitle1", "buttonicon1");
    m_subject->setNotificationsClickable(false);
    QScopedPointer<MBanner> infoBanner(m_subject->createInfoBanner(Notification(3, 1, 0, parameters, Notification::ApplicationEvent, 1020)));
    bool ret = disconnect(infoBanner.data(), SIGNAL(clicked()), m_subject, SLOT(infoBannerClicked()));
    QCOMPARE(ret, false);
}
void Ut_WidgetNotificationSink::testInfoBannerClicking()
{
    uint notificationID = 0;

    // Create info banner
    QApplication::processEvents();
    TestNotificationParameters parameters;
    parameters.add(NotificationWidgetParameterFactory::createActionParameter("content0 0 0 0"));
    QScopedPointer<MBanner> infoBanner(m_subject->createInfoBanner(Notification(notificationID, 0, 1, parameters, Notification::ApplicationEvent, 1000)));

    // Listen to triggered signals of info banner action
    QCOMPARE(actions.count(), 1);
    MRemoteAction *action = dynamic_cast<MRemoteAction *>(actions[infoBanner.data()].at(0));
    QVERIFY(action != NULL);

    // Listen to notification removal requests of WidgetNotificationSink
    QSignalSpy notificationRemovalRequested(m_subject, SIGNAL(notificationRemovalRequested(uint)));

    // Click the infoBanner
    connect(this, SIGNAL(click()), infoBanner.data(), SIGNAL(clicked()));
    emit click();
    disconnect(this, SIGNAL(click()), infoBanner.data(), SIGNAL(clicked()));
    QApplication::processEvents();

    // Verify that action was triggered
    QCOMPARE(actionTriggeredCount, 1);

    // Verify that request for notification removal was emitted
    QCOMPARE(notificationRemovalRequested.count(), 1);
    QCOMPARE(notificationRemovalRequested.first().at(0).toUInt(), notificationID);

    // Create a group info banner
    uint groupID = 1;
    TestNotificationParameters groupParameters;
    groupParameters.add(NotificationWidgetParameterFactory::createActionParameter("content1 1 1 1"));
    infoBanner.reset(m_subject->createInfoBanner(Notification::ApplicationEvent, groupID, groupParameters));

    // Listen to triggered signals of info banner action
    QCOMPARE(actions.count(), 2);
    action = dynamic_cast<MRemoteAction *>(actions[infoBanner.data()].at(0));
    QVERIFY(action != NULL);

    // Listen to notification removal requests of WidgetNotificationSink
    QSignalSpy notificationGroupClearingRequested(m_subject, SIGNAL(notificationGroupClearingRequested(uint)));

    // Click the infoBanner
    connect(this, SIGNAL(click()), infoBanner.data(), SIGNAL(clicked()));
    emit click();
    disconnect(this, SIGNAL(click()), infoBanner.data(), SIGNAL(clicked()));
    QApplication::processEvents();

    // Verify that action was triggered
    QCOMPARE(actionTriggeredCount, 2);

    // Verify that request for notification removal was emitted
    QCOMPARE(notificationGroupClearingRequested.count(), 1);
    QCOMPARE(notificationGroupClearingRequested.first().at(0).toUInt(), groupID);
}
Esempio n. 9
0
void InventoryWindow::UploadStarted(const QString &filename)
{
#ifndef UISERVICE_TEST
    // No way to have any real upload progress info with current current HTTP upload path.
    UiServices::ProgressController *progress_controller = new UiServices::ProgressController();
    emit Notification(new UiServices::ProgressNotification("Uploading " + filename + " to inventory", progress_controller));
    progress_controller->Start(50);
    notification_progress_map_[filename] = progress_controller;
#endif
}
void Ut_WidgetNotificationSink::testInfoBannerCreationWhenPrivacyIsHonoredButNotEnabled()
{
    m_subject->setHonorPrivacySetting(true);
    TestNotificationParameters parameters("title1", "subtitle1", "buttonicon1");
    QScopedPointer<MBanner> infoBanner(m_subject->createInfoBanner(Notification(3, 1, 0, parameters, Notification::ApplicationEvent, 1020)));
    QCOMPARE(infoBanner->objectName(), QString("EventBanner"));
    QCOMPARE(infoBanner->title(), QString("title1"));
    QCOMPARE(infoBanner->subtitle(), QString("subtitle1"));
    QCOMPARE(infoBanner->iconID(), QString("buttonicon1"));
}
void Ut_WidgetNotificationSink::testInfoBannerCreationWithoutRemoteAction()
{
    TestNotificationParameters parameters("title1", "subtitle1", "buttonicon1");
    QScopedPointer<MBanner> infoBanner(m_subject->createInfoBanner(Notification(3, 1, 0, parameters, Notification::ApplicationEvent, 1020)));
    QCOMPARE(infoBanner->objectName(), QString("EventBanner"));
    QCOMPARE(infoBanner->title(), QString("title1"));
    QCOMPARE(infoBanner->subtitle(), QString("subtitle1"));
    QCOMPARE(infoBanner->iconID(), QString("buttonicon1"));
    QCOMPARE(infoBanner->actions().count(), 0);
}
Esempio n. 12
0
void Notifier::notify(void * sender, Update::t n, void * data){

	if(!hasHandlers() || handlers()[n].empty()) return;

	// call handlers in FIFO order
	int i=handlers()[n].size();
	while(i--){
		Handler& h = handlers()[n][i];
		if(h.handler) h.handler(Notification(sender, h.receiver, data));
	}
}
void Ut_WidgetNotificationSink::testInfoBannerCreationWhenPrivacyIsHonoredAndEnabledButNoCatalogNameDefined()
{
    m_subject->setHonorPrivacySetting(true);
    gMGConfPrivateNotificationValue = true;
    TestNotificationParameters parameters("title1", "subtitle1", "buttonicon1");
    parameters.add(NotificationWidgetParameterFactory::genericTextIdKey(), "translationid");
    QScopedPointer<MBanner> infoBanner(m_subject->createInfoBanner(Notification(3, 1, 0, parameters, Notification::ApplicationEvent, 1020)));
    QCOMPARE(infoBanner->objectName(), QString("EventBanner"));
    QCOMPARE(infoBanner->title(), QString());
    QCOMPARE(infoBanner->subtitle(), QString());
    QCOMPARE(infoBanner->iconID(), QString("buttonicon1"));
}
		void NotificationOSDLayer::ShowNotification(const char* Format, ...)
		{
			if (Format == nullptr)
				return;

			char Buffer[0x1000] = { 0 };
			va_list Args;
			va_start(Args, Format);
			vsprintf_s(Buffer, sizeof(Buffer), Format, Args);
			va_end(Args);

			if (strlen(Buffer))
				Queue.push(Notification(Buffer));
		}
Esempio n. 15
0
status_t
Schedulable::QuaRecord()
{
	if (record.block) {
		instanceLock.lock();
		for (Instance *inst: instances) {
			if (inst->status == STATUS_RUNNING) {
				Notification(record.block, inst, inst->sym, inst->recordStack);
			}
		}
		instanceLock.unlock();
	}
	return B_NO_ERROR;
}
void Ut_WidgetNotificationSink::testInfoBannerCreationWithRemoteAction()
{
    TestNotificationParameters parameters("title0", "subtitle0", "buttonicon0", "content0 0 0 0");

    QScopedPointer<MBanner> infoBanner(m_subject->createInfoBanner(Notification(3, 1, 0, parameters, Notification::ApplicationEvent, 1020)));
    QCOMPARE(infoBanner->objectName(), QString("EventBanner"));
    QCOMPARE(infoBanner->title(), QString("title0"));
    QCOMPARE(infoBanner->subtitle(), QString("subtitle0"));
    QCOMPARE(infoBanner->iconID(), QString("buttonicon0"));
    QCOMPARE(infoBanner->actions().count(), 1);
    MRemoteAction *remoteAction = dynamic_cast<MRemoteAction *>(infoBanner->actions().at(0));
    QVERIFY(remoteAction != NULL);
    QCOMPARE(remoteAction->toString(), QString("content0 0 0 0"));
}
void Ut_WidgetNotificationSink::testWhenNotificationsCreatedThenImageIsSetCorrectly()
{
    QFETCH(QString, iconId);
    QFETCH(QString, imageId);
    QFETCH(QString, verifyImageId);
    QFETCH(bool, verifyPixmap);

    TestNotificationParameters parameters("", "", iconId);
    parameters.add(NotificationWidgetParameterFactory::createImageIdParameter(imageId));
    QScopedPointer<MBanner> infoBanner(m_subject->createInfoBanner(Notification(3, 1, 0, parameters, Notification::ApplicationEvent, 1020)));
    QCOMPARE(infoBanner->iconID(), verifyImageId);
    QCOMPARE(gPixmapLoaded, verifyPixmap);
    QCOMPARE(gPixmapSet, verifyPixmap);
}
void Ut_WidgetNotificationSink::testInfoBannerCreationWithSystemEvent()
{
    TestNotificationParameters parameters("title1", "subtitle1", "buttonicon1");
    //Adding a timestamp to parameters to test that it doesnt get added to SystemBanners
    uint timestamp = QDateTime::currentDateTime().toTime_t();
    parameters.add("timestamp", timestamp);
    QScopedPointer<MBanner> infoBanner(m_subject->createInfoBanner(Notification(3, 1, 0, parameters, Notification::SystemEvent, 1020)));
    QCOMPARE(infoBanner->objectName(), QString("SystemBanner"));
    // Check that title is not set for system event
    QCOMPARE(infoBanner->title(), QString("subtitle1"));
    QCOMPARE(infoBanner->subtitle(), QString(""));
    QCOMPARE(infoBanner->iconID(), QString("buttonicon1"));
    QCOMPARE(infoBanner->actions().count(), 0);
    QVERIFY(infoBanner->bannerTimeStamp().isNull());
}
void FEditorLiveStreaming::BroadcastEditorVideoFrame()
{
	if( ensure( IsBroadcastingEditor() ) )
	{
		// Check to see if we're streaming live video.  If so, we'll want to push new frames to be broadcast.
		if( LiveStreamer->IsBroadcasting() )
		{
			// Is this live streamer ready to accept new frames?
			if( LiveStreamer->IsReadyForVideoFrames() )
			{
				FSlateRenderer* SlateRenderer = FSlateApplication::Get().GetRenderer().Get();

				const FMappedTextureBuffer& CurrentBuffer = ReadbackBuffers[ReadbackBufferIndex];

				if ( CurrentBuffer.IsValid() )
				{
					//TODO PushVideoFrame Needs to Take Width and Height
					LiveStreamer->PushVideoFrame((FColor*)CurrentBuffer.Data/*, CurrentBuffer.Width, CurrentBuffer.Height*/);
					++SubmittedVideoFrameCount;

					// If this is the first frame we've submitted, then we can fade out our notification UI, since broadcasting is in progress
					if( SubmittedVideoFrameCount == 1 )
					{
						TSharedPtr< SNotificationItem > Notification( NotificationWeakPtr.Pin() );
						if( Notification.IsValid() )
						{
							Notification->ExpireAndFadeout();
						}
					}

					SlateRenderer->UnmapVirtualScreenBuffer();
				}

				TArray<FString> UnusedKeypressBuffer;
				SlateRenderer->CopyWindowsToVirtualScreenBuffer( UnusedKeypressBuffer );
				SlateRenderer->MapVirtualScreenBuffer(&ReadbackBuffers[ReadbackBufferIndex]);

				// Ping pong between buffers
				ReadbackBufferIndex = ( ReadbackBufferIndex + 1 ) % 2;
			}
		}
		else
		{
			// If our streaming service has stopped broadcasting for some reason, then we'll cancel our broadcast
			StopBroadcastingEditor();
		}
	}
}
void Ut_WidgetNotificationSink::testInfoBannerCreationWhenPrivacyIsHonoredAndEnabledAndCatalogPresentPlural()
{
    QString catalogue("translationcatalogue");
    m_subject->setHonorPrivacySetting(true);
    gMGConfPrivateNotificationValue = true;
    TestNotificationParameters parameters("title1", "subtitle1", "buttonicon1");
    parameters.add(NotificationWidgetParameterFactory::genericTextIdKey(), "translationid");
    parameters.add(NotificationWidgetParameterFactory::genericTextCatalogueKey(), catalogue);
    parameters.add(GenericNotificationParameterFactory::countKey(), "2");
    QScopedPointer<MBanner> infoBanner(m_subject->createInfoBanner(Notification(3, 1, 2, parameters, Notification::ApplicationEvent, 1020)));
    QCOMPARE(infoBanner->objectName(), QString("EventBanner"));
    QCOMPARE(infoBanner->title(), QString("translatedpluralstring 2"));
    QCOMPARE(infoBanner->subtitle(), QString());
    QCOMPARE(infoBanner->iconID(), QString("buttonicon1"));
    QCOMPARE(gInstalledTrCatalog, catalogue);
    QCOMPARE(gSetDefaultLocale, gInstalledCatalogLocale);
}
Esempio n. 21
0
void UUnrealEdEngine::OnPackageCheckedOut(const FSourceControlOperationRef& SourceControlOp, ECommandResult::Type ResultType, TWeakObjectPtr<UPackage> Package)
{
	if (Package.IsValid())
	{
		// Get the source control state of the package
		ISourceControlProvider& SourceControlProvider = ISourceControlModule::Get().GetProvider();
		FSourceControlStatePtr SourceControlState = SourceControlProvider.GetState(Package.Get(), EStateCacheUsage::Use);

		FFormatNamedArguments Arguments;
		Arguments.Add(TEXT("Package"), FText::FromString(Package->GetName()));

		if (ResultType == ECommandResult::Succeeded)
		{
			if (SourceControlState.IsValid() && SourceControlState->IsCheckedOut())
	{
				FNotificationInfo Notification(FText::Format(NSLOCTEXT("SourceControl", "AutoCheckOutNotification", "Package '{Package}' automatically checked out."), Arguments));
				Notification.bFireAndForget = true;
				Notification.ExpireDuration = 4.0f;
				Notification.bUseThrobber = true;

				FSlateNotificationManager::Get().AddNotification(Notification);

				return;
			}
		}

		FNotificationInfo ErrorNotification(FText::Format(NSLOCTEXT("SourceControl", "AutoCheckOutFailedNotification", "Unable to automatically check out Package '{Package}'."), Arguments));
		ErrorNotification.bFireAndForget = true;
		ErrorNotification.ExpireDuration = 4.0f;
		ErrorNotification.bUseThrobber = true;

		FSlateNotificationManager::Get().AddNotification(ErrorNotification);

		// Automatic checkout failed - pop up the notification for manual checkout
		PackageToNotifyState.Add(Package, SourceControlState->CanCheckout() ? NS_PendingPrompt : NS_PendingWarning);
		bNeedToPromptForCheckout = true;
	}
}
void MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification(Notification::Type type, double time)
{
    LOG(Media, "MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification(%p) - notification %d", this, static_cast<int>(type));
    m_queueMutex.lock();

    // It is important to always process the properties in the order that we are notified, 
    // so always go through the queue because notifications happen on different threads.
    m_queuedNotifications.append(Notification(type, time));

    bool delayDispatch = m_delayCallbacks || !isMainThread();
    if (delayDispatch && !m_mainThreadCallPending) {
        m_mainThreadCallPending = true;
        callOnMainThread(mainThreadCallback, this);
    }

    m_queueMutex.unlock();

    if (delayDispatch) {
        LOG(Media, "MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification(%p) - early return", this);
        return;
    }

    dispatchNotification();
}
Notification Military::priorityNotification() const
{
  return Notification();
}
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;
    }

    if (notification.type() != Notification::FunctionType)
        LOG(Media, "MediaPlayerPrivateAVFoundation::dispatchNotification(%p) - dispatching %s", this, notificationName(notification));

    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:
        m_inbandTrackConfigurationPending = false;
        configureInbandTracks();
        break;
    case Notification::FunctionType:
        notification.function()();
        break;
    case Notification::TargetIsWirelessChanged:
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
        playbackTargetIsWirelessChanged();
#endif
        break;

    case Notification::None:
        ASSERT_NOT_REACHED();
        break;
    }
}
void MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification(Notification::Type type, bool finished)
{
    scheduleMainThreadNotification(Notification(type, finished));
}
void MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification(Notification::Type type, const MediaTime& time)
{
    scheduleMainThreadNotification(Notification(type, time));
}
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::None:
        ASSERT_NOT_REACHED();
        break;
    }
}
Esempio n. 28
0
void InventoryWindow::CreateNotification(QString message, int hide_time)
{
#ifndef UISERVICE_TEST
    emit Notification(new UiServices::MessageNotification(message, hide_time));
#endif
}
Esempio n. 29
0
void Admin::addNotification(Lesson lesson){
	this->listNotification.push_back(Notification("Add of Lesson", "Lesson " + lesson.getName() + " requires your validation", tm()));
}
void FEditorLiveStreaming::BroadcastStatusCallback( const FLiveStreamingStatus& Status )
{
	TSharedPtr< SNotificationItem > Notification( NotificationWeakPtr.Pin() );
	if( Notification.IsValid() )
	{
		// Don't bother clobbering existing message with text about web cam starting/stopping, unless we're already broadcasting.
		// We want to make sure people see the persistent text about login state.
		if( SubmittedVideoFrameCount > 0 ||
			( Status.StatusType != FLiveStreamingStatus::EStatusType::WebCamStarted &&
			  Status.StatusType != FLiveStreamingStatus::EStatusType::WebCamStopped &&
			  Status.StatusType != FLiveStreamingStatus::EStatusType::WebCamTextureNotReady &&
			  Status.StatusType != FLiveStreamingStatus::EStatusType::WebCamTextureReady &&
			  Status.StatusType != FLiveStreamingStatus::EStatusType::ChatConnected &&
			  Status.StatusType != FLiveStreamingStatus::EStatusType::ChatDisconnected ) )
		{
			Notification->SetText( Status.CustomStatusDescription );
		}
	}
	else
	{
		// Only spawn a notification if we're actually still trying to broadcast, not if we're stopping broadcasting.  We don't want
		// to revive our notification that we intentionally expired.
		if( bIsBroadcasting )
		{
			FNotificationInfo Info( Status.CustomStatusDescription );
			Info.FadeInDuration = 0.1f;
			Info.FadeOutDuration = 0.5f;
			Info.ExpireDuration = 1.5f;
			Info.bUseThrobber = false;
			Info.bUseSuccessFailIcons = true;
			Info.bUseLargeFont = true;
			Info.bFireAndForget = false;
			Info.bAllowThrottleWhenFrameRateIsLow = false;
			NotificationWeakPtr = FSlateNotificationManager::Get().AddNotification( Info );
		}
	}

	Notification = NotificationWeakPtr.Pin();
	if( Notification.IsValid() )
	{
		SNotificationItem::ECompletionState State = SNotificationItem::CS_Pending;
		if( Status.StatusType == FLiveStreamingStatus::EStatusType::Failure )
		{
			State = SNotificationItem::CS_Fail;
		}
		else if( Status.StatusType == FLiveStreamingStatus::EStatusType::BroadcastStarted ||
				 Status.StatusType == FLiveStreamingStatus::EStatusType::WebCamStarted ||
				 Status.StatusType == FLiveStreamingStatus::EStatusType::ChatConnected )
		{
			State = SNotificationItem::CS_Success;
		}

		Notification->SetCompletionState( State );
	}

	// If the web cam just turned on, then we'll go ahead and show it
	if( Status.StatusType == FLiveStreamingStatus::EStatusType::WebCamTextureReady )
	{	
		bool bIsImageFlippedHorizontally = false;
		bool bIsImageFlippedVertically = false;
		UTexture2D* WebCamTexture = LiveStreamer->GetWebCamTexture( bIsImageFlippedHorizontally, bIsImageFlippedVertically );
		if( ensure( WebCamTexture != nullptr ) )
		{
			IMainFrameModule& MainFrameModule = FModuleManager::LoadModuleChecked<IMainFrameModule>( TEXT( "MainFrame" ) );
			check( MainFrameModule.IsWindowInitialized() );
			auto RootWindow = MainFrameModule.GetParentWindow();
			check( RootWindow.IsValid() );

			// Allow the user to customize the image mirroring, too!
			const auto& Settings = *GetDefault< UEditorLiveStreamingSettings >();
			if( Settings.bMirrorWebCamImage )
			{
				bIsImageFlippedHorizontally = !bIsImageFlippedHorizontally;
			}

			// How many pixels from the edge of the main frame window to where the broadcast status window appears
			const int WindowBorderPadding = 50;

			// @todo livestream: Currently this window is not created as "topmost".  We don't really want it to be OS-topmost, but we do want it to be the most
			// topmost "regular" window in our application (not on top of tooltips, etc.)

			// Create a window that will show the web cam video feed
			BroadcastStatusWindow = SNew( SWindow )
				.Title( LOCTEXT( "StreamingWindowTitle", "Web Camera" ) )
				.ClientSize( FVector2D( WebCamTexture->GetSizeX(), WebCamTexture->GetSizeY() ) )
				.ScreenPosition( FVector2D( 
					RootWindow->GetRectInScreen().Right - WebCamTexture->GetSizeX() - WindowBorderPadding, 
					RootWindow->GetRectInScreen().Top +  WindowBorderPadding ) )

				// @todo livestream: Ideally the user could freely resize the window, but it gets a bit tricky to preserve the web cam aspect.  Plus, we don't really like how letterboxing/columnboxing looks with this.
				.SizingRule( ESizingRule::FixedSize )

				.AutoCenter( EAutoCenter::None )
				.bDragAnywhere( true )
				.SupportsMaximize( true )
				.SupportsMinimize( true )
				.FocusWhenFirstShown( false )
				.ActivateWhenFirstShown( false )
				.SaneWindowPlacement( false );

			WebCamDynamicImageBrush = MakeShareable( new FSlateDynamicImageBrush( 
				WebCamTexture,
				FVector2D( WebCamTexture->GetSizeX(), WebCamTexture->GetSizeY() ),
				WebCamTexture->GetFName() ) );

			// If the web cam image is coming in flipped, we'll apply mirroring to the Slate brush
			if( bIsImageFlippedHorizontally && bIsImageFlippedVertically )
			{
				WebCamDynamicImageBrush->Mirroring = ESlateBrushMirrorType::Both;
			}
			else if( bIsImageFlippedHorizontally )
			{ 
				WebCamDynamicImageBrush->Mirroring = ESlateBrushMirrorType::Horizontal;
			}
			else if( bIsImageFlippedVertically )
			{ 
				WebCamDynamicImageBrush->Mirroring = ESlateBrushMirrorType::Vertical;
			}

			// @todo livestream: Currently if the user closes the window, the camera is deactivated and it doesn't turn back on unless the broadcast is restarted.  We could allow the camera to be reactivated though.
			BroadcastStatusWindow->SetOnWindowClosed( 
				FOnWindowClosed::CreateStatic( []( const TSharedRef<SWindow>& Window, FEditorLiveStreaming* This ) 
				{
					// User closed the broadcast status window, so go ahead and shut down the web cam
					This->LiveStreamer->StopWebCam();
					This->BroadcastStatusWindow.Reset();
					This->WebCamDynamicImageBrush.Reset();
				}, 
				this ) );

			BroadcastStatusWindow->SetContent( 
				SNew( SImage )
					.Image( WebCamDynamicImageBrush.Get() )
			);

			FSlateApplication::Get().AddWindowAsNativeChild(
				BroadcastStatusWindow.ToSharedRef(), 
				RootWindow.ToSharedRef() );
		}

	}
	else if( Status.StatusType == FLiveStreamingStatus::EStatusType::WebCamTextureNotReady )
	{
		CloseBroadcastStatusWindow();
	}
}