20 #ifndef _PERSPECTIVE_H
21 #define _PERSPECTIVE_H
23 #include <tulip/PluginContext.h>
24 #include <tulip/Plugin.h>
25 #include <tulip/TlpQtTools.h>
28 #include <QVariantMap>
31 #include <QMainWindow>
39 static const std::string PERSPECTIVE_CATEGORY =
"Perspective";
50 QMainWindow *mainWindow;
51 TulipProject *project;
53 QVariantMap parameters;
81 QSet<QString> _reservedProperties;
82 unsigned int _perspectiveId;
129 enum ProgressOption {
130 NoProgressOption = 0x0,
135 Q_DECLARE_FLAGS(ProgressOptions, ProgressOption)
137 std::
string category()
const override {
138 return PERSPECTIVE_CATEGORY;
140 std::string
icon()
const override {
141 return ":/tulip/gui/icons/32/plugin_controller.png";
164 template <
typename T>
166 return dynamic_cast<T *
>(instance());
192 progress(ProgressOptions options = ProgressOptions(IsPreviewable | IsStoppable | IsCancellable));
197 virtual void usage(std::string &usage_str)
const {
198 usage_str =
"No options for this perspective.";
239 emit resetWindowTitle();
247 return _restartNeeded;
254 instance()->displayStatusMessage(msg);
275 const QString &msg) {
276 instance()->logMessage(type, context, msg);
283 instance()->displayLogMessages();
309 void resetWindowTitle();
354 virtual void logMessage(QtMsgType,
const QMessageLogContext &,
const QString &) {}
356 Q_DECLARE_OPERATORS_FOR_FLAGS(Perspective::ProgressOptions)
A context data structure for tlp::Perspective instances.
A Perspective is a Tulip plugin that completely re-defines the user interface.
virtual void centerPanelsForGraph(tlp::Graph *)
Tells the perspective that the visualizations for a given graph should be centered.
QMainWindow * _mainWindow
The main window on which the perspective should build the GUI.
virtual void start(tlp::PluginProgress *progress)=0
Build the main window GUI and starts the workflow. When this method is called, it means that the Pers...
static void setStyleSheet(QWidget *w)
a static function to set the same style sheet as the instance main window style sheet
TulipProject * _project
The project associated to this perspective. This project can be empty or contain data depending on ho...
std::string icon() const override
The icon (preferably a thumbnail) of the plugin.
static QString styleSheet()
a static function to get the instance main window style sheet
bool needRestart()
a function to indicate restart
QMainWindow * mainWindow() const
static void redirectStatusTipOfMenu(QMenu *menu)
a static function to enable the redirection of the statusTip or toolTip of menu actions
virtual bool terminated()
Called when the user wants to close the application.
virtual void usage(std::string &usage_str) const
usage Displays a usage message when called from the tulip executable
virtual Graph * currentGraph()
static T * typedInstance()
void createPerspective(const QString &name)
Open a new Perspective without a project.
virtual void displayLogMessages()
a virtual function to display the whole logs
static void showStatusMessage(const QString &msg)
a static function to ease the display of status messages
static void showStatusMessage(const std::string &msg)
a static function to ease the display of status messages
void showFullScreen(bool f)
Call this slot to switch to full screen or windowed mode.
bool isReservedPropertyName(QString name)
Checks if the name corresponds to a reserved properties. Perspectives are allowed to reserve graph pr...
virtual void redrawPanels(bool center=false)=0
Tells the perspective that the graph visualizations should be redrawn.
virtual PluginProgress * progress(ProgressOptions options=ProgressOptions(IsPreviewable|IsStoppable|IsCancellable))
Creates a progress handler and returns it. This method allows lower-level widgets to create top-level...
Perspective(const tlp::PluginContext *c)
Constructs a perspective object.
static void showLogMessages()
a static function to display the log messages
virtual void logMessage(QtMsgType, const QMessageLogContext &, const QString &)
a virtual function to log a message
static void showLogMessage(QtMsgType type, const QMessageLogContext &context, const QString &msg)
a static function to log a message see qInstallMessageHandler
void registerReservedProperty(QString)
Sets a new property name as registered.
virtual void clearStatusMessage()
a virtual function to clear the last status message
void showStatusTipOf(QAction *action)
Show the statusTip (or the toolTip) of an action.
virtual void openProjectFile(const QString &path)
Open a new Tulip Project.
static tlp::Perspective * instance()
QVariantMap _parameters
Contains extra parameters that have not been parsed by the overleying system. Those are considered to...
virtual void displayStatusMessage(const QString &s)
a virtual function to display a status message
static void setInstance(tlp::Perspective *)
Called at the beginning of the tulip exe to set the Perspective singleton.
Contains runtime parameters for a plugin.
Top-level interface for plug-ins.
PluginProcess subclasses are meant to notify about the progress state of some process (typically a pl...
QString tlpStringToQString(const std::string &toConvert)
Convert a Tulip UTF-8 encoded std::string to a QString.