Tulip  4.1.0
Better Visualization Through Research
 All Classes Files Functions Variables Enumerations Enumerator Properties Groups Pages
tlp::Perspective Class Referenceabstract

#include <Perspective.h>

Inherits QObject, and tlp::Plugin.

Public Types

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

Public Slots

virtual bool terminated ()
 

Public Member Functions

 Perspective (const tlp::PluginContext *c)
 
virtual std::string category () const
 
virtual void centerPanelsForGraph (tlp::Graph *)
 
std::string icon () const
 
bool isReservedPropertyName (QString name)
 
QMainWindow * mainWindow () const
 
virtual PluginProgressprogress (ProgressOptions options=ProgressOptions(IsPreviewable|IsStoppable|IsCancellable))
 
virtual void redrawPanels (bool center=false)=0
 
void registerReservedProperty (QString)
 
virtual void start (tlp::PluginProgress *progress)=0
 
- Public Member Functions inherited from tlp::Plugin
virtual std::string author () const =0
 
virtual std::string date () const =0
 
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 release () const =0
 
virtual std::string tulipMajor () const
 
virtual std::string tulipMinor () const
 
virtual std::string tulipRelease () const =0
 
- Public Member Functions inherited from tlp::WithParameter
template<typename T >
void addInOutParameter (const std::string &name, const std::string &help=std::string(), const std::string &defaultValue=std::string(), bool isMandatory=true)
 
template<typename T >
void addInParameter (const std::string &name, const std::string &help, const std::string &defaultValue, bool isMandatory=true)
 
template<typename T >
void addOutParameter (const std::string &name, const std::string &help=std::string(), const std::string &defaultValue=std::string(), bool isMandatory=true)
 
template<typename T >
void addParameter (const std::string &name, const std::string &help=std::string(), const std::string &defaultValue=std::string(), bool isMandatory=true)
 
const
tlp::ParameterDescriptionList
getParameters () const
 
- Public Member Functions inherited from tlp::WithDependency
void addDependency (const char *name, const char *release)
 
const std::list< Dependency > & dependencies () const
 

Static Public Member Functions

static tlp::Perspectiveinstance ()
 
static void setInstance (tlp::Perspective *)
 
template<typename T >
static T * typedInstance ()
 

Protected Slots

void createPerspective (const QString &name)
 
virtual void openProjectFile (const QString &path)
 
void showAboutPage ()
 
void showErrorMessage (const QString &title, const QString &s)
 
void showPluginsCenter ()
 
void showProjectsPage ()
 
void showTrayMessage (const QString &s)
 

Protected Attributes

QString _externalFile
 
QMainWindow * _mainWindow
 
QVariantMap _parameters
 
TulipProject_project
 

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. Perspectives are chosen by the user when first running the Tulip agent. The main perspective is called "Tulip". This perspective unveils all the Tulip features and aims at being a protyping and researching platform.

A Perspective always acts in its own process and communicate with the Tulip agent via TCP sockets. Thus, 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-informations. 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 developper.

Definition at line 69 of file Perspective.h.

Constructor & Destructor Documentation

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

virtual std::string tlp::Perspective::category ( ) const
inlinevirtual

A string identifier for a plugin used for categorization purposes.

Returns
std::string the category of the plugin.

Implements tlp::Plugin.

Definition at line 121 of file Perspective.h.

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.
void tlp::Perspective::createPerspective ( const QString &  name)
protectedslot

Send a message to the Tulip agent to make him open a new Perspective without a project.

Parameters
nameThe name of the PErspective to create.
std::string tlp::Perspective::icon ( ) const
inlinevirtual

The icon (preferably a thumbnail) of the plugin.

Returns
std::string the icon path

Reimplemented from tlp::Plugin.

Definition at line 124 of file Perspective.h.

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
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.
QMainWindow* tlp::Perspective::mainWindow ( ) const
Returns
The Perspective's main window.
virtual void tlp::Perspective::openProjectFile ( const QString &  path)
protectedvirtualslot

Send a message to the Tulip agent to make him open a new Tulip Project.

Parameters
paththe absolute path of the project file.
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
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)
void tlp::Perspective::registerReservedProperty ( QString  )

Sets a new property name as registered.

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

Called at the beginning of the tulip_perspective to set the Perspective singleton.

See Also
instance()
void tlp::Perspective::showAboutPage ( )
protectedslot

Send a message to the Tulip agent to make him display the "About us" page.

void tlp::Perspective::showErrorMessage ( const QString &  title,
const QString &  s 
)
protectedslot

Send a message to the Tulip agent to make him display an error message that will be shown in the system notification as well as on the welcome page.

Parameters
titleThe message's title.
sThe message to display.
void tlp::Perspective::showPluginsCenter ( )
protectedslot

Send a message to the Tulip agent to make him display the Plugins Center page.

void tlp::Perspective::showProjectsPage ( )
protectedslot

Send a message to the Tulip agent to make him display the Projects page.

void tlp::Perspective::showTrayMessage ( const QString &  s)
protectedslot

Send a message to the Tulip agent to make him display a message in the system notification area.

Parameters
sThe message to display.
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 reponsible of the application workflow until the application is closed by the user.

Parameters
progressA progress handler
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 205 of file Perspective.h.

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

Definition at line 146 of file Perspective.h.

Member Data Documentation

QString tlp::Perspective::_externalFile
protected

If the user provided a file to the tulip_perspective 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 105 of file Perspective.h.

QMainWindow* tlp::Perspective::_mainWindow
protected

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

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

Definition at line 99 of file Perspective.h.

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 110 of file Perspective.h.

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_perspective executable is called with the following arguments:

tulip_perspective [--perspective=Name] [file_path]
  • 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.

Definition at line 92 of file Perspective.h.