23#include <tulip/PluginContext.h>
24#include <tulip/Plugin.h>
25#include <tulip/TlpQtTools.h>
39static const std::string PERSPECTIVE_CATEGORY =
"Perspective";
49 PerspectiveContext() : mainWindow(
nullptr), project(
nullptr) {}
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)
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);
309 void resetWindowTitle();
354 virtual void logMessage(QtMsgType,
const QMessageLogContext &,
const QString &) {}
356Q_DECLARE_OPERATORS_FOR_FLAGS(Perspective::ProgressOptions)
A Perspective is a Tulip plugin that completely re-defines the user interface.
static tlp::Perspective * instance()
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 Graph * currentGraph()
std::string category() const override
A string identifier for a plugin used for categorization purposes.
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...
static T * typedInstance()
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
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
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.
Perspective(const tlp::PluginContext *c)
Constructs a perspective object.
static void showLogMessages()
a static function to display the log messages
QMainWindow * mainWindow() const
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.
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
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...
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.
virtual std::string name() const =0
Returns the name of the plug-in, as registered in the Tulip plug-in system. This name must be unique,...
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.