Tulip  6.0.0
Large graphs analysis and drawing
tlp::Perspective Class Referenceabstract

#include <Perspective.h>

+ Inheritance diagram for tlp::Perspective:
+ Collaboration diagram for tlp::Perspective:

Public Types

enum  ProgressOption { NoProgressOption = 0x0 , IsPreviewable = 0x1 , IsCancellable = 0x2 , IsStoppable = 0x4 }
 

Public Slots

virtual bool terminated ()
 

Signals

void resetWindowTitle ()
 

Public Member Functions

 Perspective (const tlp::PluginContext *c)
 
std::string category () const override
 
virtual void centerPanelsForGraph (tlp::Graph *)
 
virtual GraphcurrentGraph ()
 
std::string icon () const override
 
bool isReservedPropertyName (QString name)
 
QMainWindow * mainWindow () const
 
bool needRestart ()
 
virtual PluginProgressprogress (ProgressOptions options=ProgressOptions(IsPreviewable|IsStoppable|IsCancellable))
 
virtual void redrawPanels (bool center=false)=0
 
void registerReservedProperty (QString)
 
void resetTitle ()
 
virtual void start (tlp::PluginProgress *progress)=0
 
virtual void usage (std::string &usage_str) const
 
- Public Member Functions inherited from tlp::Plugin
virtual std::string author () const =0
 
virtual std::string date () const =0
 
void declareDeprecatedName (const std::string &oldName)
 
std::string deprecatedName ()
 
virtual std::string group () const =0
 
virtual int id () const
 
virtual std::string info () const =0
 
virtual std::string major () const
 
virtual std::string minor () const
 
virtual std::string name () const =0
 
virtual std::string programmingLanguage () const
 
virtual std::string release () const =0
 
virtual std::string tulipMajor () const
 
virtual std::string tulipMinor () const
 
virtual std::string tulipRelease () const =0
 

Static Public Member Functions

static tlp::Perspectiveinstance ()
 
static void redirectStatusTipOfMenu (QMenu *menu)
 
static void setInstance (tlp::Perspective *)
 
static void setStyleSheet (QWidget *w)
 
static void showLogMessage (QtMsgType type, const QMessageLogContext &context, const QString &msg)
 
static void showLogMessages ()
 
static void showStatusMessage (const QString &msg)
 
static void showStatusMessage (const std::string &msg)
 
static QString styleSheet ()
 
template<typename T >
static T * typedInstance ()
 

Public Attributes

bool _restartNeeded
 

Protected Slots

virtual void clearStatusMessage ()
 
void createPerspective (const QString &name)
 
virtual void displayLogMessages ()
 
virtual void displayStatusMessage (const QString &s)
 
virtual void logMessage (QtMsgType, const QMessageLogContext &, const QString &)
 
virtual void openProjectFile (const QString &path)
 
void showFullScreen (bool f)
 
void showStatusTipOf (QAction *action)
 

Protected Attributes

QString _externalFile
 
QMainWindow * _mainWindow
 
QVariantMap _parameters
 
TulipProject * _project
 
- Protected Attributes inherited from tlp::Plugin
std::string oldName
 

Detailed Description

A Perspective is a Tulip plugin that completely re-defines the user interface.

A Perspective aims at using the multiple features available in Tulip to create a complete, coherent workflow dedicated to a particular use-case. The main perspective is called "Tulip". This perspective unveils all the Tulip features and aims at being a protyping and researching platform.

It is the Perspective's responsibility to offer the possibility to display graphs, run plugins, etc. A lot of helper classes can be found into the tulip-gui API like pre-made widgets, Qt models, etc.

Perspective's data is stored into a TulipProject. A TulipProject is an archive capable of containing heterogeneous data (like multiple graphs, textures, extra files, etc). When a TulipProject gets saved by a perspective, it is linked to it in its meta-information. Creating a Perspective primarily into implementing the start() method that builds the GUI. This method will be called by the overleying system when a new perspective is launched. The rest of the logic implementation is left to the developer.

Definition at line 77 of file Perspective.h.

Constructor & Destructor Documentation

◆ Perspective()

tlp::Perspective::Perspective ( const tlp::PluginContext c)

Constructs a perspective object.

Warning
There should not be any logic implemented into the Perspective's constructor. See the start method instead.

Member Function Documentation

◆ category()

std::string tlp::Perspective::category ( ) const
inlineoverridevirtual

A string identifier for a plugin used for categorization purposes.

Returns
std::string the category of the plugin.

Implements tlp::Plugin.

Definition at line 137 of file Perspective.h.

◆ centerPanelsForGraph()

virtual void tlp::Perspective::centerPanelsForGraph ( tlp::Graph )
virtual

Tells the perspective that the visualizations for a given graph should be centered.

Note
By default, this method does nothing.

◆ clearStatusMessage

virtual void tlp::Perspective::clearStatusMessage ( )
protectedvirtualslot

a virtual function to clear the last status message

◆ createPerspective

void tlp::Perspective::createPerspective ( const QString &  name)
protectedslot

Open a new Perspective without a project.

Parameters
nameThe name of the Perspective to create.

◆ currentGraph()

virtual Graph* tlp::Perspective::currentGraph ( )
inlinevirtual
Returns
The Perspective's current graph.

Definition at line 204 of file Perspective.h.

◆ displayLogMessages

virtual void tlp::Perspective::displayLogMessages ( )
inlineprotectedvirtualslot

a virtual function to display the whole logs

Definition at line 349 of file Perspective.h.

◆ displayStatusMessage

virtual void tlp::Perspective::displayStatusMessage ( const QString &  s)
protectedvirtualslot

a virtual function to display a status message

◆ icon()

std::string tlp::Perspective::icon ( ) const
inlineoverridevirtual

The icon (preferably a thumbnail) of the plugin.

Returns
std::string the icon path

Reimplemented from tlp::Plugin.

Definition at line 140 of file Perspective.h.

◆ instance()

static tlp::Perspective* tlp::Perspective::instance ( )
static

Since a Perspective has its own process to work in, there can be only one perspective instance by process. In order to ease the development process, Perspective are available as a singleton in order for child widgets and plugins to be able to access to the features of a Perspective. This architecture was added for developers who want to create an application containing several plugins grouped into Perspective.

Returns
The perspective singleton

◆ isReservedPropertyName()

bool tlp::Perspective::isReservedPropertyName ( QString  name)

Checks if the name corresponds to a reserved properties. Perspectives are allowed to reserve graph properties. A reserved graph properties is a core property that cannot be deleted by the user and cannot be renamed.

Returns
true if the perspective is registered.

◆ logMessage

virtual void tlp::Perspective::logMessage ( QtMsgType  ,
const QMessageLogContext &  ,
const QString &   
)
inlineprotectedvirtualslot

a virtual function to log a message

Definition at line 354 of file Perspective.h.

◆ mainWindow()

QMainWindow* tlp::Perspective::mainWindow ( ) const
Returns
The Perspective's main window.

◆ needRestart()

bool tlp::Perspective::needRestart ( )
inline

a function to indicate restart

Definition at line 246 of file Perspective.h.

◆ openProjectFile

virtual void tlp::Perspective::openProjectFile ( const QString &  path)
protectedvirtualslot

Open a new Tulip Project.

Parameters
paththe absolute path of the project file.

◆ progress()

virtual PluginProgress* tlp::Perspective::progress ( ProgressOptions  options = ProgressOptions(IsPreviewable|IsStoppable|IsCancellable))
virtual

Creates a progress handler and returns it. This method allows lower-level widgets to create top-level progress bars directly from the Perspective.

Returns

◆ redirectStatusTipOfMenu()

static void tlp::Perspective::redirectStatusTipOfMenu ( QMenu *  menu)
static

a static function to enable the redirection of the statusTip or toolTip of menu actions

◆ redrawPanels()

virtual void tlp::Perspective::redrawPanels ( bool  center = false)
pure virtual

Tells the perspective that the graph visualizations should be redrawn.

Parameters
centerif true, visualization should also be centered (eg. the layout has been changed)

◆ registerReservedProperty()

void tlp::Perspective::registerReservedProperty ( QString  )

Sets a new property name as registered.

◆ setInstance()

static void tlp::Perspective::setInstance ( tlp::Perspective )
static

Called at the beginning of the tulip exe to set the Perspective singleton.

See also
instance()

◆ setStyleSheet()

static void tlp::Perspective::setStyleSheet ( QWidget *  w)
static

a static function to set the same style sheet as the instance main window style sheet

◆ showFullScreen

void tlp::Perspective::showFullScreen ( bool  f)
protectedslot

Call this slot to switch to full screen or windowed mode.

Parameters
fis true, switch to full screen mode. If false, switch to windowed mode

◆ showLogMessage()

static void tlp::Perspective::showLogMessage ( QtMsgType  type,
const QMessageLogContext &  context,
const QString &  msg 
)
inlinestatic

a static function to log a message see qInstallMessageHandler

Definition at line 274 of file Perspective.h.

◆ showLogMessages()

static void tlp::Perspective::showLogMessages ( )
inlinestatic

a static function to display the log messages

Definition at line 282 of file Perspective.h.

◆ showStatusMessage() [1/2]

static void tlp::Perspective::showStatusMessage ( const QString &  msg)
inlinestatic

a static function to ease the display of status messages

Definition at line 253 of file Perspective.h.

◆ showStatusMessage() [2/2]

static void tlp::Perspective::showStatusMessage ( const std::string &  msg)
inlinestatic

a static function to ease the display of status messages

Definition at line 260 of file Perspective.h.

+ Here is the call graph for this function:

◆ showStatusTipOf

void tlp::Perspective::showStatusTipOf ( QAction *  action)
protectedslot

Show the statusTip (or the toolTip) of an action.

Parameters
actiona QAction

◆ start()

virtual void tlp::Perspective::start ( tlp::PluginProgress progress)
pure virtual

Build the main window GUI and starts the workflow. When this method is called, it means that the Perspective is responsible of the application workflow until the application is closed by the user.

Parameters
progressA progress handler

◆ styleSheet()

static QString tlp::Perspective::styleSheet ( )
static

a static function to get the instance main window style sheet

◆ terminated

virtual bool tlp::Perspective::terminated ( )
inlinevirtualslot

Called when the user wants to close the application.

Returns
Returning false prevents the window from being closed but the Perspective will have to implement its own way of closing the application.

Definition at line 304 of file Perspective.h.

◆ typedInstance()

template<typename T >
static T* tlp::Perspective::typedInstance ( )
inlinestatic
Returns
A typed instance of the perspective singleton.

Definition at line 165 of file Perspective.h.

◆ usage()

virtual void tlp::Perspective::usage ( std::string &  usage_str) const
inlinevirtual

usage Displays a usage message when called from the tulip executable

Definition at line 197 of file Perspective.h.

Member Data Documentation

◆ _externalFile

QString tlp::Perspective::_externalFile
protected

If the user provided a file to the tulip exe but this file is not recognized as a valid TulipProject, the full path of the file will be stored into the _externalFile member.

Note
Remember that perspectives should always store their data into TulipProject in order to keep a consistent workflow.

Definition at line 120 of file Perspective.h.

◆ _mainWindow

QMainWindow* tlp::Perspective::_mainWindow
protected

The main window on which the perspective should build the GUI.

It is not the Perspective's responsibility to destroy the main window when the application gets closed. Generally speaking, destroying the _mainWindow pointer could lead to undefined behavior.

Definition at line 112 of file Perspective.h.

◆ _parameters

QVariantMap tlp::Perspective::_parameters
protected

Contains extra parameters that have not been parsed by the overleying system. Those are considered to be Perspective-specific and are forwarded into this variable.

Definition at line 126 of file Perspective.h.

◆ _project

TulipProject* tlp::Perspective::_project
protected

The project associated to this perspective. This project can be empty or contain data depending on how the Perspective was launched: To launch a perspective, the tulip executable is called with the following arguments:

tulip exe [--perspective=Name] [file_path]

@list

  • The –perspective argument forces Tulip to start the "Name" perspective. Even if the project states otherwise. If this argument is not specified, Tulip will look in the project's meta-data to dertermine the perspective to launch.
  • file_path is the absolute path of the project archive to associate with the perspective. If file_path is not given, the –perspective argument must be declared in order for Tulip to know what perspective to launch. In this case, _project will point to an empty (but valid!) project. @endlist

Definition at line 103 of file Perspective.h.