Converted project to C++.
This commit is contained in:
		@@ -1 +0,0 @@
 | 
			
		||||
from .project_manager import ProjectManager
 | 
			
		||||
@@ -1,90 +0,0 @@
 | 
			
		||||
from typing import Iterable
 | 
			
		||||
 | 
			
		||||
from model.project import Project
 | 
			
		||||
from model import Project, RecentProject
 | 
			
		||||
from storage import AppDataStorage
 | 
			
		||||
 | 
			
		||||
class ProjectManager(object):
 | 
			
		||||
 | 
			
		||||
    def __init__(self, appDataStorage : AppDataStorage):
 | 
			
		||||
        self.__appDataStorage = appDataStorage
 | 
			
		||||
        self.__recentProjects : dict = None
 | 
			
		||||
 | 
			
		||||
    """
 | 
			
		||||
    Gets a list of recent projects. The list is lazily loaded on the first call.
 | 
			
		||||
 | 
			
		||||
    Returns:
 | 
			
		||||
        list of RecentProjects
 | 
			
		||||
    """
 | 
			
		||||
    def getRecentProjects(self) -> Iterable[RecentProject]:
 | 
			
		||||
        if self.__recentProjects is None:
 | 
			
		||||
            self.__recentProjects = {}
 | 
			
		||||
            for item in self.__appDataStorage.readRecentProjects():
 | 
			
		||||
                self.__recentProjects[item.path] = item
 | 
			
		||||
 | 
			
		||||
        return self.__recentProjects.values()
 | 
			
		||||
 | 
			
		||||
    """
 | 
			
		||||
    Pins a recent project.
 | 
			
		||||
 | 
			
		||||
    Args:
 | 
			
		||||
        entry: recent project
 | 
			
		||||
        isPinned: pinned or not
 | 
			
		||||
    """
 | 
			
		||||
    def pinRecentProject(self, entry : RecentProject, isPinned : bool = True):
 | 
			
		||||
        entry.pinned = isPinned
 | 
			
		||||
        self.__appDataStorage.writeRecentProjects(self.__recentProjects.values())
 | 
			
		||||
 | 
			
		||||
    """
 | 
			
		||||
    Deletes a recent project.
 | 
			
		||||
 | 
			
		||||
    Args:
 | 
			
		||||
        entry: recent project
 | 
			
		||||
    """
 | 
			
		||||
    def deleteRecentProject(self, entry : RecentProject):
 | 
			
		||||
        self.__recentProjects.pop(entry.path, None)
 | 
			
		||||
        self.__appDataStorage.writeRecentProjects(self.__recentProjects.values())
 | 
			
		||||
 | 
			
		||||
    """
 | 
			
		||||
    Creates a new project at the given path, and returns the created project.
 | 
			
		||||
 | 
			
		||||
    Args:
 | 
			
		||||
        path: path to project file
 | 
			
		||||
    """
 | 
			
		||||
    def newProject(self, path : str) -> Project:
 | 
			
		||||
        return Project(path)
 | 
			
		||||
 | 
			
		||||
    """
 | 
			
		||||
    Opens an existing project.
 | 
			
		||||
 | 
			
		||||
    Args:
 | 
			
		||||
        path: path to project file
 | 
			
		||||
    """
 | 
			
		||||
    def openProject(self, path : str) -> Project:
 | 
			
		||||
        return Project(path)
 | 
			
		||||
 | 
			
		||||
    # def debug_populateRecentProjects(self):
 | 
			
		||||
    #     self.__recentProjects['/home/tibi/Videos/project.pro'] = {
 | 
			
		||||
    #         'name' : 'Debug project',
 | 
			
		||||
    #         'path' : '/home/tibi/Videos/project.pro',
 | 
			
		||||
    #         'pinned' : True,
 | 
			
		||||
    #         'date' : 1
 | 
			
		||||
    #     }
 | 
			
		||||
    #     self.__recentProjects['/home/tibi/Videos/project2.pro'] = {
 | 
			
		||||
    #         'name' : 'Debug project 2',
 | 
			
		||||
    #         'path' : '/home/tibi/Videos/project2.pro',
 | 
			
		||||
    #         'pinned' : False,
 | 
			
		||||
    #         'date' : 2
 | 
			
		||||
    #     }
 | 
			
		||||
    #     self.__recentProjects['/home/tibi/Videos/project3.pro'] = {
 | 
			
		||||
    #         'name' : 'Debug project 3',
 | 
			
		||||
    #         'path' : '/home/tibi/Videos/project3.pro',
 | 
			
		||||
    #         'pinned' : False,
 | 
			
		||||
    #         'date' : 3
 | 
			
		||||
    #     }
 | 
			
		||||
    #     self.__recentProjects['/home/tibi/Videos/project4.pro'] = {
 | 
			
		||||
    #         'name' : 'Debug project 4',
 | 
			
		||||
    #         'path' : '/home/tibi/Videos/project4.pro',
 | 
			
		||||
    #         'pinned' : False,
 | 
			
		||||
    #         'date' : 4
 | 
			
		||||
    #     }
 | 
			
		||||
							
								
								
									
										11
									
								
								business/projectmanager.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								business/projectmanager.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
#include "projectmanager.h"
 | 
			
		||||
 | 
			
		||||
namespace Ember
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
ProjectManager::ProjectManager()
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										14
									
								
								business/projectmanager.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								business/projectmanager.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
			
		||||
#ifndef PROJECTMANAGER_H
 | 
			
		||||
#define PROJECTMANAGER_H
 | 
			
		||||
 | 
			
		||||
namespace Ember
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
class ProjectManager
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    ProjectManager();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
#endif // PROJECTMANAGER_H
 | 
			
		||||
		Reference in New Issue
	
	Block a user