23#include <tulip/PluginContext.h>
24#include <tulip/Plugin.h>
25#include <tulip/TlpQtTools.h>
40static const std::string PERSPECTIVE_CATEGORY =
"Perspective";
51 QMainWindow *mainWindow;
52 TulipProject *project;
54 QVariantMap parameters;
86 QSet<QString> _reservedProperties;
87 QTcpSocket *_agentSocket;
88 unsigned int _perspectiveId;
90 void sendAgentMessage(
const QString &);
91 void notifyProjectLocation(
const QString &path);
135 bool checkSocketConnected();
138 enum ProgressOption {
139 NoProgressOption = 0x0,
144 Q_DECLARE_FLAGS(ProgressOptions, ProgressOption)
146 std::
string category()
const override {
147 return PERSPECTIVE_CATEGORY;
149 std::string
icon()
const override {
150 return ":/tulip/gui/icons/32/plugin_controller.png";
173 template <
typename T>
175 return dynamic_cast<T *
>(instance());
201 progress(ProgressOptions options = ProgressOptions(IsPreviewable | IsStoppable | IsCancellable));
206 virtual void usage(std::string &usage_str)
const {
207 usage_str =
"No options for this perspective.";
241 emit resetWindowTitle();
249 return _restartNeeded;
256 instance()->displayStatusMessage(msg);
277 const QString &msg) {
278 instance()->logMessage(type, context, msg);
285 instance()->displayLogMessages();
311 void resetWindowTitle();
386 virtual void logMessage(QtMsgType,
const QMessageLogContext &,
const QString &) {}
388Q_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.
static tlp::Perspective * instance()
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...
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_perspective executable
void showTrayMessage(const QString &s)
Send a message to the Tulip agent to make him display a message in the system notification area.
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.
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.
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.
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_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.