telexPage->setEnabled( false );
telexLayout->addWidget( telexPage );
+ /* Contextual & Index Buttons */
+ QSignalMapper *contextButtonMapper = new QSignalMapper( this );
+ QToolButton *contextButton = NULL;
+ QPixmap iconPixmap( telexOn->minimumHeight(), telexOn->minimumHeight() );
+ iconPixmap.fill( Qt::transparent );
+ QPainter iconPixmapPainter( &iconPixmap );
+ QRadialGradient iconPixmapPainterGradient( iconPixmap.rect().center(),
+ iconPixmap.rect().width() / 2,
+ iconPixmap.rect().center() / 2 );
+
+#define CREATE_CONTEXT_BUTTON(color, key) \
+ iconPixmapPainterGradient.setColorAt( 0, QColor( color ).lighter(150) );\
+ iconPixmapPainterGradient.setColorAt( 1.0, QColor( color ) );\
+ iconPixmapPainter.setBrush( iconPixmapPainterGradient );\
+ iconPixmapPainter.drawEllipse( iconPixmap.rect().adjusted( 0, 0, -1, -1 ) );\
+ contextButton = new QToolButton();\
+ setupButton( contextButton );\
+ contextButton->setIcon( iconPixmap );\
+ contextButton->setEnabled( false );\
+ contextButtonMapper->setMapping( contextButton, key << 16 );\
+ CONNECT( contextButton, clicked(), contextButtonMapper, map() );\
+ CONNECT( contextButtonMapper, mapped( int ),\
+ THEMIM->getIM(), telexSetPage( int ) );\
+ CONNECT( THEMIM->getIM(), teletextActivated( bool ), contextButton, setEnabled( bool ) );\
+ telexLayout->addWidget( contextButton )
+
+ CREATE_CONTEXT_BUTTON("grey", 'i'); /* index */
+ CREATE_CONTEXT_BUTTON("red", 'r');
+ CREATE_CONTEXT_BUTTON("green", 'g');
+ CREATE_CONTEXT_BUTTON("yellow", 'y');
+ CREATE_CONTEXT_BUTTON("blue", 'b');
+
+#undef CREATE_CONTEXT_BUTTON
+
/* Page change and set */
CONNECT( telexPage, valueChanged( int ),
THEMIM->getIM(), telexSetPage( int ) );