All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Migration Guide

Migrating applications written in Cornerstone 1.2 require changes before they can be compiled with Cornerstone 2.0.

There are not many high-level changes, but several smaller implementation details have changed. A brief list of changes is described below:

  • Widgets now use smart pointers
  • QString and QByteArray used as basic string types
  • Some widgets have been renamed
  • A new rendering API
  • ValueObjects are renamed to Attributes

Package Layout

There have been changes in Cornerstone 2.0 to layout of files in the packages. Everything in Cornerstone is now installed under a single directory. The goal of this change is to allow multiple different Cornerstone versions to co-exists at the same time.

You can use CORNERSTONE_SDK_ROOT environment variable to select which version of the SDK things are compiled against.

QString and QByteArray

All string manipulation in Cornerstone SDK is now done using QStrings and QByteArrays. This means that all std::string, std::wstring, const char*, etc. code should be converted to use the new classes. This is usually easily done by just changing the variable types. One thing to keep in mind is that these changes affect virtual function overloading rules, so care must be taken to check functions like the ones below:

void Widget::eventProcess(const QByteArray &, ...) {}

New classes

Some old widgets have been replaced by new ones.

Removed Classes

Some classes have been removed. Typically because they were not considered to be generic enough to be included in an SDK.

Attributes

All ValueObjects have been replaced by Attributes (ValueXYZ is now AttributeXYZ). Attributes store multiple values of different layers based on importance. These layers are in order of importance:

  • Default
  • Style
  • User
  • Style !important

Generally the migration from ValueObjects can be done simply by replaceing Valuable::Value* with Valuable::Attribute*.

Changes in Widget

Widget now has new input-processing functions like Widget::processMarkers, Widget::processPens, Widget::fingerUp, Widget::fingerDown, etc.

The Widget::update() function has new parameters. Instead of simply dt, it now gets a struct FrameInfo as parameter which contains much more information about the current frame than before (and also the delta time, dt).

The Widget::setStyle() function no longer exists. The functionality that used to be implement in setStyle() should be implement using attribute listeners to properly capture value changes after from all sources, like CSS modification. You must never override setStyle() or manually call it in Cornerstone 2.0.

The Widget::setColor() has been replaced with Widget::setBackgroundColor(), also color() function has been replaced with backgroundColor().

The accessors tap IDs have been removed (tapIdsBegin/End). The entire tap collection can now be accessed using Widget::tapIds().

All render functions are now const. For example, Widget::renderContent(). This is to enforce not modifying widget state from render as it will break applications when using multi-threaded rendering.

Widget Pointers

All widgets now use smart pointers. The raw widget pointer (Widget*) has been replaced with an intrusive smart pointer, WidgetPtr. Use this pointer if you want to keep a widget alive as long as the pointer exists. There is also a weak intrusive pointer (WidgetWeakPtr) available to break cyclic dependencies. Use this pointer, when you do not want to keep the widget alive with the pointer (ie. the pointer can become nullptr). All widget types in the SDK have an alias pointer defined for them, e.g. VideoWidgetPtr, TextWidgetPtr, ImageWidgetPtr, etc.

To declare the pointer types for you own inherited widget classes, use the following macro:

// Use this macro in the header file of your class to create MyClassPtr and
// MyClassWeakPtr typedefs.
INTRUSIVE_PTR_TYPEDEF(MyClass)

Rendering Engine

All old rendering routines in Luminous::RenderContext are now deprecated. New ones exist to replace those function that should be used instead. The new functions take the Luminous::Style class as argument.

Most of the OpenGL state-management has been hidden from the user.

Use Luminous::CustomOpenGL guard to protect direct access to OpenGL functions.

Private Implementations

Many classes in Cornerstone SDK now use the PIMPL pattern. This means the private class members are hidden behind an opaque pointer. The reasoning for this change was to maintain better binary compatibility between different releases and it also reduces include-dependencies during compilation. Use the accessor functions to access the private data when needed.

Library Changes

  • The Fluffy CSS library has been renamed to Stylish.
  • The TheadedRendering library has been merged with other libraries (mainly Luminous and MultiWidgets)