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>
41 static const std::string PERSPECTIVE_CATEGORY =
"Perspective";
52 QMainWindow *mainWindow;
53 TulipProject *project;
55 QVariantMap parameters;
87 QSet<QString> _reservedProperties;
88 QTcpSocket *_agentSocket;
89 unsigned int _perspectiveId;
91 void sendAgentMessage(
const QString &);
92 void notifyProjectLocation(
const QString &path);
136 bool checkSocketConnected();
139 enum ProgressOption {
140 NoProgressOption = 0x0,
145 Q_DECLARE_FLAGS(ProgressOptions, ProgressOption)
147 std::
string category()
const override {
148 return PERSPECTIVE_CATEGORY;
150 std::string
icon()
const override {
151 return ":/tulip/gui/icons/32/plugin_controller.png";
174 template <
typename T>
176 return dynamic_cast<T *
>(instance());
202 progress(ProgressOptions options = ProgressOptions(IsPreviewable | IsStoppable | IsCancellable));
207 virtual void usage(std::string &usage_str)
const {
208 usage_str =
"No options for this perspective.";
249 emit resetWindowTitle();
257 return _restartNeeded;
264 instance()->displayStatusMessage(msg);
285 const QString &msg) {
286 instance()->logMessage(type, context, msg);
293 instance()->displayLogMessages();
319 void resetWindowTitle();
394 virtual void logMessage(QtMsgType,
const QMessageLogContext &,
const QString &) {}
396 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.
void showPluginsCenter()
Send a message to the Tulip agent to make him display the Plugins Center page.
void showErrorMessage(const QString &title, const QString &s)
Send a message to the Tulip agent to make him display an error message that will be shown in the syst...
QMainWindow * _mainWindow
The main window on which the perspective should build the GUI.
void showProjectsPage()
Send a message to the Tulip agent to make him display the Projects page.
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_perspective executable
virtual Graph * currentGraph()
void showTrayMessage(const QString &s)
Send a message to the Tulip agent to make him display a message in the system notification area.
static T * typedInstance()
void createPerspective(const QString &name)
Send a message to the Tulip agent to make him 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.
void showAboutPage()
Send a message to the Tulip agent to make him display the "About us" page.
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)
Send a message to the Tulip agent to make him 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_perspective 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.