Cube GUI Plugin User Guide  (CubeGUI 4.4.4, revision 18494)
How to develop a Cube GUI Plugin, road map and examples
/****************************************************************************
** CUBE http://www.scalasca.org/ **
*****************************************************************************
** Copyright (c) 1998-2017 **
** Forschungszentrum Juelich GmbH, Juelich Supercomputing Centre **
** **
** This software may be modified and distributed under the terms of **
** a BSD-style license. See the COPYING file in the package base **
** directory for details. **
****************************************************************************/
#include <QVBoxLayout>
#include <QtPlugin>
#include "SimpleExample.h"
#include "PluginServices.h"
using namespace cubepluginapi;
using namespace simpleexampleplugin;
#if QT_VERSION < 0x050000
Q_EXPORT_PLUGIN2( SimpleExamplePlugin, SimpleExample ); // ( PluginName, ClassName )
#endif
SimpleExample::SimpleExample()
{
// The constructor should be empty, use cubeOpened to initialize. If Qt widgets or
// signals/slots are used in constructor, they have to be deleted in destructor,
// otherwise cube may crash if the plugin is unloaded.
}
bool
SimpleExample::cubeOpened( PluginServices* service )
{
this->service = service;
widget_ = new QWidget();
qlabel_ = new QLabel( "example string" );
QVBoxLayout* layout = new QVBoxLayout();
widget_->setLayout( layout );
layout->addWidget( qlabel_ );
service->addTab( SYSTEM, this );
connect( service, SIGNAL( treeItemIsSelected( cubepluginapi::TreeType, cubepluginapi::TreeItem* ) ),
this, SLOT( treeItemIsSelected( cubepluginapi::TreeType, cubepluginapi::TreeItem* ) ) );
return true; // initialisation is ok => plugin should be shown
}
void
SimpleExample::cubeClosed()
{
delete widget_;
}
void
SimpleExample::version( int& major, int& minor, int& bugfix ) const
{
major = 1;
minor = 0;
bugfix = 0;
}
QString
SimpleExample::name() const
{
return "Simple Example";
}
QString
SimpleExample::getHelpText() const
{
return "Just a simple example.";
}
QWidget*
SimpleExample::widget()
{
return widget_;
}
QString
SimpleExample::label() const
{
return "Example Plugin Label";
}
void
SimpleExample::treeItemIsSelected( TreeType type, TreeItem* item )
{
QString txt = item->getName() + " " + QString::number( item->getValue() );
qlabel_->setText( txt );
}

Cube Writer Library    Copyright © 1998–2017 Forschungszentrum Jülich GmbH, Jülich Supercomputing Centre
Copyright © 2009–2015 German Research School for Simulation Sciences GmbH, Laboratory for Parallel Programming