void FAssetTypeActions_StaticMesh::ExecuteCreateDestructibleMesh(TArray<TWeakObjectPtr<UStaticMesh>> Objects)
{
	TArray< UObject* > Assets;
	for (auto ObjIt = Objects.CreateConstIterator(); ObjIt; ++ObjIt)
	{
		auto Object = (*ObjIt).Get();
		if ( Object )
		{
			FText ErrorMsg;
			FDestructibleMeshEditorModule& DestructibleMeshEditorModule = FModuleManager::LoadModuleChecked<FDestructibleMeshEditorModule>( "DestructibleMeshEditor" );
			UDestructibleMesh* DestructibleMesh = DestructibleMeshEditorModule.CreateDestructibleMeshFromStaticMesh(Object->GetOuter(), Object, NAME_None, Object->GetFlags(), ErrorMsg);
			if ( DestructibleMesh )
			{
				FAssetEditorManager::Get().OpenEditorForAsset(DestructibleMesh);
				Assets.Add(DestructibleMesh);
			}
			else if ( !ErrorMsg.IsEmpty() )
			{
				FNotificationInfo ErrorNotification( ErrorMsg );
				FSlateNotificationManager::Get().AddNotification(ErrorNotification);
			}
		}
	}
	if ( Assets.Num() > 0 )
	{
		FAssetTools::Get().SyncBrowserToAssets(Assets);
	}
}
void FMessageLogListingViewModel::NotifyIfAnyMessages( const FText& Message, EMessageSeverity::Type SeverityFilter, bool bForce )
{
	// Note we use page 0 in this function, as that is the page that will
	// have most recently had messages added to it.

	if ( bForce || NumMessagesPresent(0, SeverityFilter) > 0 )
	{
		FText NotificationMessage;
		if(Message.IsEmpty())
		{
			if(MessageLogListingModel->NumMessages(0) > 0)
			{
				// no message passed in, so we need to make a default - use the last message we output
				FFormatNamedArguments Args;
				Args.Add( TEXT("LogLabel"), LogLabel );
				Args.Add( TEXT("LastMessage"), MessageLogListingModel->GetMessageAtIndex(0, MessageLogListingModel->NumMessages(0) - 1)->ToText() );
				NotificationMessage = FText::Format( LOCTEXT("DefaultNoMessageToLastMessage", "{LogLabel}: {LastMessage}"), Args );
			}
			else
			{
				// no present messages & no message passed in, use the log label as a default
				NotificationMessage = LogLabel;
			}
		}
		else
		{
			NotificationMessage = Message;
		}

		FNotificationInfo ErrorNotification(NotificationMessage);
		ErrorNotification.Image = FEditorStyle::GetBrush(FTokenizedMessage::GetSeverityIconName(HighestSeverityPresent(0)));
		ErrorNotification.bFireAndForget = true;
		ErrorNotification.Hyperlink = FSimpleDelegate::CreateSP(this, &FMessageLogListingViewModel::OpenMessageLog);
		ErrorNotification.HyperlinkText = LOCTEXT("ShowMessageLogHyperlink", "Show Message Log");
		ErrorNotification.ExpireDuration = 8.0f; // Need this message to last a little longer than normal since the user may want to "Show Log"
		ErrorNotification.bUseThrobber = true;

		FSlateNotificationManager::Get().AddNotification(ErrorNotification);
	}
}
Ejemplo n.º 3
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;
	}
}
Ejemplo n.º 4
0
	bool Core::ReinitStorage ()
	{
		Pools_.clear ();
		ChannelsModel_->Clear ();

		const QString& strType = XmlSettingsManager::Instance ()->
				property ("StorageType").toString ();
		try
		{
			StorageBackend_ = StorageBackend::Create (strType);
		}
		catch (const std::runtime_error& s)
		{
			ErrorNotification (tr ("Storage error"),
					QTextCodec::codecForName ("UTF-8")->
					toUnicode (s.what ()));
			return false;
		}
		catch (...)
		{
			ErrorNotification (tr ("Storage error"),
					tr ("Aggregator: general storage initialization error."));
			return false;
		}

		emit storageChanged ();

		const int feedsTable = 1;
		const int channelsTable = 1;
		const int itemsTable = 6;

		if (StorageBackend_->UpdateFeedsStorage (XmlSettingsManager::Instance ()->
				Property (strType + "FeedsTableVersion", feedsTable).toInt (),
				feedsTable))
			XmlSettingsManager::Instance ()->setProperty (qPrintable (strType + "FeedsTableVersion"),
					feedsTable);
		else
			return false;

		if (StorageBackend_->UpdateChannelsStorage (XmlSettingsManager::Instance ()->
				Property (strType + "ChannelsTableVersion", channelsTable).toInt (),
				channelsTable))
			XmlSettingsManager::Instance ()->setProperty (qPrintable (strType + "ChannelsTableVersion"),
					channelsTable);
		else
			return false;

		if (StorageBackend_->UpdateItemsStorage (XmlSettingsManager::Instance ()->
				Property (strType + "ItemsTableVersion", itemsTable).toInt (),
				itemsTable))
			XmlSettingsManager::Instance ()->setProperty (qPrintable (strType + "ItemsTableVersion"),
					itemsTable);
		else
			return false;

		StorageBackend_->Prepare ();

		ids_t feeds;
		StorageBackend_->GetFeedsIDs (feeds);
		Q_FOREACH (IDType_t feedId, feeds)
		{
			channels_shorts_t channels;
			StorageBackend_->GetChannels (channels, feedId);
			std::for_each (channels.begin (), channels.end (),
					[this] (ChannelShort chan)
						{ ChannelsModel_->AddChannel (chan); });
		}
Ejemplo n.º 5
0
	void Core::Handle (LeechCraft::Entity e)
	{
		QUrl url = e.Entity_.toUrl ();
		if (e.Mime_ == "text/x-opml")
		{
			if (url.scheme () == "file")
				StartAddingOPML (url.toLocalFile ());
			else
			{
				QString name = LeechCraft::Util::GetTemporaryName ();

				LeechCraft::Entity e = Util::MakeEntity (url,
						name,
						LeechCraft::Internal |
							LeechCraft::DoNotNotifyUser |
							LeechCraft::DoNotSaveInHistory |
							LeechCraft::NotPersistent |
							LeechCraft::DoNotAnnounceEntity);
				PendingOPML po =
				{
					name
				};

				int id = -1;
				QObject *pr;
				emit delegateEntity (e, &id, &pr);
				if (id == -1)
				{
					ErrorNotification (tr ("Import error"),
							tr ("Could not find plugin to download OPML %1.")
								.arg (url.toString ()));
					return;
				}

				HandleProvider (pr, id);
				PendingOPMLs_ [id] = po;
			}

			QMap<QString, QVariant> s = e.Additional_;
			if (s.contains ("ShowTrayIcon"))
				XmlSettingsManager::Instance ()->setProperty ("ShowIconInTray",
						s.value ("ShowIconInTray").toBool ());
			if (s.contains ("UpdateOnStartup"))
				XmlSettingsManager::Instance ()->setProperty ("UpdateOnStartup",
						s.value ("UpdateOnStartup").toBool ());
			if (s.contains ("UpdateTimeout"))
				XmlSettingsManager::Instance ()->setProperty ("UpdateInterval",
						s.value ("UpdateTimeout").toInt ());
			if (s.contains ("MaxArticles"))
				XmlSettingsManager::Instance ()->setProperty ("ItemsPerChannel",
						s.value ("MaxArticles").toInt ());
			if (s.contains ("MaxAge"))
				XmlSettingsManager::Instance ()->setProperty ("ItemsMaxAge",
						s.value ("MaxAge").toInt ());
		}
		else
		{
			QString str = url.toString ();
			if (str.startsWith ("feed://"))
				str.replace (0, 4, "http");
			else if (str.startsWith ("feed:"))
				str.remove  (0, 5);
			else if (str.startsWith ("itpc://"))
				str.replace (0, 4, "http");

			LeechCraft::Aggregator::AddFeed af (str);
			if (af.exec () == QDialog::Accepted)
				AddFeed (af.GetURL (),
						af.GetTags ());
		}
	}
Ejemplo n.º 6
0
	void Core::Handle (Entity e)
	{
		QUrl url = e.Entity_.toUrl ();
		if (e.Mime_ == "text/x-opml")
		{
			if (url.scheme () == "file")
				StartAddingOPML (url.toLocalFile ());
			else
			{
				const auto& name = Util::GetTemporaryName ();

				const auto& dlEntity = Util::MakeEntity (url,
						name,
						Internal |
							DoNotNotifyUser |
							DoNotSaveInHistory |
							NotPersistent |
							DoNotAnnounceEntity);

				const auto& handleResult = Proxy_->GetEntityManager ()->DelegateEntity (dlEntity);
				if (!handleResult)
				{
					ErrorNotification (tr ("Import error"),
							tr ("Could not find plugin to download OPML %1.")
								.arg (url.toString ()));
					return;
				}

				HandleProvider (handleResult.Handler_, handleResult.ID_);
				PendingOPMLs_ [handleResult.ID_] = PendingOPML { name };
			}

			const auto& s = e.Additional_;
			if (s.contains ("UpdateOnStartup"))
				XmlSettingsManager::Instance ()->setProperty ("UpdateOnStartup",
						s.value ("UpdateOnStartup").toBool ());
			if (s.contains ("UpdateTimeout"))
				XmlSettingsManager::Instance ()->setProperty ("UpdateInterval",
						s.value ("UpdateTimeout").toInt ());
			if (s.contains ("MaxArticles"))
				XmlSettingsManager::Instance ()->setProperty ("ItemsPerChannel",
						s.value ("MaxArticles").toInt ());
			if (s.contains ("MaxAge"))
				XmlSettingsManager::Instance ()->setProperty ("ItemsMaxAge",
						s.value ("MaxAge").toInt ());
		}
		else
		{
			QString str = url.toString ();
			if (str.startsWith ("feed://"))
				str.replace (0, 4, "http");
			else if (str.startsWith ("feed:"))
				str.remove  (0, 5);
			else if (str.startsWith ("itpc://"))
				str.replace (0, 4, "http");

			class AddFeed af { str };
			if (af.exec () == QDialog::Accepted)
				AddFeed (af.GetURL (),
						af.GetTags ());
		}
	}