summaryrefslogtreecommitdiffstats
path: root/src/libgui/project_manager.h
blob: 8c335793ca6d811f68777ec0c9da514ad902977b (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
/***************************************************************************
 *   Copyright (C) 2005-2006 Nicolas Hadacek <hadacek@kde.org>             *
 *   Copyright (C) 2003 Alain Gibaud <alain.gibaud@free.fr>                *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 ***************************************************************************/
#ifndef PROJECT_MANAGER_H
#define PROJECT_MANAGER_H

#include "common/global/purl.h"
#include "common/gui/misc_gui.h"
#include "common/gui/list_view.h"
#include "project_manager_ui.h"
class Project;
class Editor;
namespace Coff { class SectionParser; }

namespace ProjectManager
{

class View : public ListView
{
Q_OBJECT
  TQ_OBJECT
public:
  View(TQWidget *tqparent);
  virtual ~View();

  bool editProject();
  bool newProject();
  bool openProject();
  bool openProject(const PURL::Url &url);
  void closeProject();
  Project *project() const { return _project; }

  void setStandalone(const PURL::Url &url, PURL::FileType type);
  PURL::Url projectUrl() const { return _rootItem->url(); }
  PURL::Url standaloneGenerator(const PURL::Url &url, PURL::FileType &type) const;
  PURL::Url linkerScriptUrl() const;
  PURL::Url selectedUrl() const;
  void removeFile(const PURL::Url &url);
  void select(const Editor *e);
  void insertFile(const PURL::Url &url);
  bool contains(const PURL::Url &url) const { return findFileItem(url); }
  void addExternalFile(const PURL::Url &url, FileOrigin fileOrigin);
  bool isExternalFile(const PURL::Url &url) const;
  void removeExternalFiles();

  bool isModified() const { return _modified; }
  void setModified(bool modified) { _modified = modified; }
  bool needsRecompile() const;

public slots:
  void insertSourceFiles();
  void insertObjectFiles();
  void insertCurrentFile();
  void updateGUI();

private slots:
  void init();
  void contextMenu(TQListViewItem *item, const TQPoint &pos, int column);
  void clicked(int button, TQListViewItem *item, const TQPoint &pos, int column);
  void renamed(TQListViewItem *item, int column, const TQString &text);
  void modified(const PURL::Url &url);
  void filesReordered();

signals:
  void guiChanged();

private:
  Project          *_project;
  RootItem         *_rootItem;
  DeviceItem       *_deviceItem;
  LinkerScriptItem *_linkerScriptItem;
  class ProjectData {
  public:
    PURL::FileType type;
    TQMap<PURL::Url, FileOrigin> externals;
  };
  TQMap<PURL::Url, ProjectData> _standaloneData;
  ProjectData _projectData;
  bool _modified;

  HeaderItem *findHeaderItem(Group group) const;
  HeaderItem *headerItem(Group group);
  FileItem *findFileItem(const PURL::Url &url) const;
  FileItem *findFileItem(PURL::FileType type) const;
  TQListViewItem *findItem(const TQString &name) const;
  virtual TQDragObject *dragObject();
  virtual bool acceptDrag(TQDropEvent* e) const;
  virtual TQString tooltip(TQListViewItem *item, int col) const;
  void addExternalFiles();
  void rightClicked(TQListViewItem *item, const TQPoint &pos);
  void leftClicked(TQListViewItem *item);
  void addFile(const PURL::Url &url, PURL::FileType type, FileOrigin origin);
  void setProject(Project *project);
  void initListView();
  ProjectData &projectData();
  const ProjectData &projectData() const;
};

} // namespace

#endif