std::string ProjectManager::DoEditor(SpritePtr pNextAppButton)
{
	GSGUI_BUTTON file_r = PlaceFileMenu();

	if (file_r.text == _S_NEW_PROJ)
	{
		SaveAs();
	}
	if (file_r.text == _S_LOAD_PROJ)
	{
		Open();
	}

	SetFileNameToTitle(m_provider->GetVideo(), _ETH_PROJECT_MANAGER_WINDOW_TITLE);

	if (GetCurrentProject() == "")
	{
		ShadowPrint(Vector2(64,128),
			GS_L("-Start a new project or load an existing one.\n") \
			GS_L("-If you start a new project, all necessary files and paths will be copied to the target folder.\n") \
			GS_L("-Media files (sprites, sounds, normals) should be manually placed into their correct directories.\n") \
			GS_L("-Create .ENT entity files before building your scenes.\n"));
	}
	else
	{
		str_type::string currentProjectFilename = 
			utf8::c(Platform::GetFileName(GetCurrentFile(false))).wc_str();
			str_type::string sText = GS_L("Project loaded: ") + currentProjectFilename + GS_L("\n") +
			GS_L("We're ready to go. Press TAB or click the arrow to go to the Editors");
		ShadowPrint(Vector2(64,128), sText.c_str());
	}

	ProccessFileOpenRequests();
	return GetCurrentProject();
}
Beispiel #2
0
bool Workspace::Open(QString workPath)
{
	QDir dir;
	dir.setPath(workPath);

	projects.clear();

	if (dir.exists() == false) {
		return false;
	}

	config.workspace = workPath;

	bool ok = true;

	dir.setFilter(QDir::Dirs | QDir::Hidden | QDir::NoSymLinks);
	QFileInfoList list = dir.entryInfoList();
	for (int i = 0; i < list.size(); ++i) {
		QFileInfo fileInfo = list.at(i);
		QString projectName = fileInfo.fileName();

		if ((projectName == ".") || (projectName == "..")) {
			continue;
		}

		if (projectName.contains(".ignore") == false) {
			 QString projectPath = QDir::cleanPath(config.workspace + QDir::separator());
			 Project proj;
			 if (proj.Load(projectPath, projectName)) {
				 projects.push_back(proj);
			 } else {
				 msg.Add("Could not load project '" + projectPath + "/" + projectName + "'", mtError);
				 //ok = false;
			 }
		}        
	}

	//currentProject = "";
	//if (projects.size() > 0) {
		//SetCurrentProject(projects.at(0).name);
	//}

	if (GetCurrentProject() == NULL) {
		if (projects.size() > 0) {
			SetCurrentProject(projects.at(0).name);
		}
	}

	return ok;
}
Beispiel #3
0
bool Workspace::AddNewFile(QString fullPath)
{
	Project * project = GetCurrentProject();
	if (project == NULL) {
		return false;
	}

	if (QFileInfo(fullPath).exists()) {
		ErrorMessage("File already exists: \n" + fullPath);
		return false;
	}

	QString path = QFileInfo(fullPath).absoluteDir().absolutePath();
	if (path != config.workspace + "/" + project->name + "/source") {
		ErrorMessage("Invalid file name/path: \n" + fullPath);
		return false;
	}

	QString name = QFileInfo(fullPath).fileName();
	QString ext = QFileInfo(fullPath).suffix().toUpper();
	
	// create the file
	QFile autoFileOutput(fullPath);	
	bool ok = autoFileOutput.open(QFile::WriteOnly);
	if (ok == false) {
		ErrorMessage("Error creating the file: \n" + fullPath);
		return false;
	}
	QTextStream streamOutput(&autoFileOutput);	
	streamOutput << "/* File automatically created by MariaMole */ \n";
	autoFileOutput.close();

	modified = true;

	ProjectFile pfile;
	pfile.name = name;
	pfile.open = false;
	pfile.type = ptSource;
	project->files.push_back(pfile);

	return true;
}
void FProjectManager::GetEnabledPlugins(TArray<FString>& OutPluginNames) const
{
	// Get the default list of plugin names
	GetDefaultEnabledPlugins(OutPluginNames, true);

	// Modify that with the list of plugins in the project file
	const FProjectDescriptor *Project = GetCurrentProject();
	if(Project != NULL)
	{
		for(const FPluginReferenceDescriptor& Plugin: Project->Plugins)
		{
			if(Plugin.IsEnabledForPlatform(FPlatformMisc::GetUBTPlatform()))
			{
				OutPluginNames.AddUnique(Plugin.Name);
			}
			else
			{
				OutPluginNames.Remove(Plugin.Name);
			}
		}
	}
}
Beispiel #5
0
bool IsProjectLoaded()
{
	return GetCurrentProject() != nil;
}