summaryrefslogtreecommitdiffstats
path: root/src/projectmanager.h
blob: 3c1b3599929394f82fe705e69e81255e15020752 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#ifndef __PROJECTMANAGER_H__
#define __PROJECTMANAGER_H__


#include <tqstring.h>
#include <tqobject.h>
#include <tqdict.h>


#include <kxmlguiclient.h>
#include <kservice.h>
#include <kurl.h>

class TDEAction;
class TDESelectAction;
class KService;
class ProjectInfo;
class ProjectSession;
class TDERecentFilesAction;
class TDevPlugin;


class ProjectInfo
{
public:
  KURL         m_projectURL;
  TQDomDocument m_document;
  TQString      m_profileName;
  TQString      m_projectName;
  TQString      m_projectPlugin, m_language, m_activeLanguage, m_vcsPlugin;
  TQStringList  m_ignoreParts, m_keywords;

  TQString sessionFile() const;
};

/**
Project manager.
Loads and unloads projects.
*/
class ProjectManager : public TQObject, public KXMLGUIClient
{
  Q_OBJECT
  

public:

  ~ProjectManager();

  static TQString projectDirectory( const TQString& path, bool absolute );

  static ProjectManager *getInstance();

  void loadSettings();
  void saveSettings();
  void loadDefaultProject();

  bool projectLoaded() const;

  KURL projectFile() const;
  TQString projectName() const;

  void createActions( TDEActionCollection* ac );

  ProjectSession* projectSession() const;

public slots:
  bool loadProject( const KURL& url);
  bool loadTDevelop2Project( const KURL& url);
  bool closeProject( bool exiting = false );

private slots:
  void slotOpenProject();
  void slotProjectOptions();

  void slotLoadProject();

  void loadLocalParts();

private:
  ProjectManager();

  void setupActions();
  void getGeneralInfo();

  bool loadProjectFile();
  bool saveProjectFile();

  bool loadProjectPart();
  void unloadProjectPart();

  bool loadLanguageSupport(const TQString& lang);
  void unloadLanguageSupport();

//   TQString profileByAttributes(const TQString &language, const TQStringList &keywords);

  ProjectInfo *m_info;

  TDEAction *m_closeProjectAction, *m_projectOptionsAction;
  TDERecentFilesAction *m_openRecentProjectAction;

  static ProjectManager *s_instance;

  ProjectSession* m_pProjectSession;

  TDevPlugin *m_vcsPlugin;
  TQString m_vcsName;

  TQString m_oldProfileName;
};


#endif