File: GraphPerspective.h

package info (click to toggle)
tulip 4.6.0dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 139,284 kB
  • ctags: 35,942
  • sloc: cpp: 289,758; ansic: 27,264; python: 1,256; sh: 923; yacc: 522; xml: 337; makefile: 258; php: 66; lex: 55
file content (145 lines) | stat: -rw-r--r-- 3,999 bytes parent folder | download
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/**
 *
 * This file is part of Tulip (www.tulip-software.org)
 *
 * Authors: David Auber and the Tulip development Team
 * from LaBRI, University of Bordeaux
 *
 * Tulip is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation, either version 3
 * of the License, or (at your option) any later version.
 *
 * Tulip is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 */
#ifndef GRAPHPERSPECTIVE_H
#define GRAPHPERSPECTIVE_H

#include <QModelIndex>
#include <QPoint>
#include <tulip/Perspective.h>
#include <tulip/Observable.h>


class QAction;
class QHeaderView;

class GraphHierarchiesEditor;
class GraphPerspectiveLogger;

namespace tlp {
class GraphHierarchiesModel;
class View;
class BooleanProperty;
}

namespace Ui {
class GraphPerspectiveMainWindowData;
}

class GraphPerspective : public tlp::Perspective, tlp::Observable {
  Q_OBJECT
  Ui::GraphPerspectiveMainWindowData *_ui;
  tlp::GraphHierarchiesModel *_graphs;

  void reserveDefaultProperties();
  QString _lastOpenLocation;
  QString _recentDocumentsSettingsKey;

  void buildRecentDocumentsMenu();
  void addRecentDocument(const QString &path);

  void showStartPanels(tlp::Graph*);
  void applyRandomLayout(tlp::Graph*);

public:
  GraphPerspectiveLogger* _logger;

  PLUGININFORMATION("Tulip", "Tulip Team", "2011/07/11", "Analyze several graphs/subgraphs hierarchies", "1.0", "")
  std::string icon() const {
    return ":/tulip/graphperspective/icons/32/desktop.png";
  }

  GraphPerspective(const tlp::PluginContext* c);
  virtual ~GraphPerspective();
  virtual void start(tlp::PluginProgress *);
  tlp::GraphHierarchiesModel* model() const;
  void copy(tlp::Graph*, bool deleteAfter=false);
  tlp::Graph* createSubGraph(tlp::Graph*);

  void treatEvent(const tlp::Event &);

#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
  void log(QtMsgType, const QMessageLogContext &, const QString &);
#else
  void log(QtMsgType,const char*);
#endif

public slots:
  void importGraph();
  void exportGraph(tlp::Graph*g = NULL);
  void saveGraphHierarchyInTlpFile(tlp::Graph*g = NULL);
  void createPanel(tlp::Graph* g = NULL);
  bool save();
  bool saveAs(const QString& path=QString::null);
  void open(QString fileName = QString::null);
  virtual void openProjectFile(const QString &path);

  void showLogger();
  void showDocumentation();

  virtual void redrawPanels(bool center=false);
  void centerPanelsForGraph(tlp::Graph*, bool graphChanged, bool onlyGlMainView);
  void centerPanelsForGraph(tlp::Graph* g) {
    centerPanelsForGraph(g, false, false);
  }
  void closePanelsForGraph(tlp::Graph* g = NULL);
  bool setGlMainViewPropertiesForGraph(tlp::Graph* g, const std::map<std::string, tlp::PropertyInterface*>& propsMap);
  void setSearchOutput(bool);
  void setPythonPanel(bool);
  void openPreferences();

  void setAutoCenterPanelsOnDraw(bool f);

  void pluginsListChanged();

  void setWorkspaceMode();
  void setDevelopMode();

protected slots:
  void currentGraphChanged(tlp::Graph* graph);
  void refreshDockExpandControls();
  void panelFocused(tlp::View*);
  void focusedPanelGraphSet(tlp::Graph*);
  void focusedPanelSynchronized();
  void deleteSelectedElements();
  void invertSelection();
  void cancelSelection();
  void selectAll();
  void undo();
  void redo();
  void cut();
  void paste();
  void copy();
  void group();
  void createSubGraph();
  void cloneSubGraph();
  void addEmptySubGraph();
  void CSVImport();
  void logCleared();
  void findPlugins();
  void addNewGraph();
  void newProject();
  void openRecentFile();
  void changeSynchronization(bool);

protected:
  bool eventFilter(QObject *, QEvent *);
  void importGraph(const std::string& module, tlp::DataSet& data);
};

#endif // GRAPHPERSPECTIVE_H