Skip to content

Commit

Permalink
splash screen shadow+bottom area now generated on-the-fly (so it work…
Browse files Browse the repository at this point in the history
…s with custom splash screens)

git-svn-id: https://code.ros.org/svn/ros-pkg/stacks/visualization/trunk@39839 eb33c2ac-9c88-4c90-87e0-44a10359b0c3
  • Loading branch information
David Gossow committed Aug 7, 2012
1 parent 369e92a commit 608fafa
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 14 deletions.
Binary file modified image_src/splash.xcf
Binary file not shown.
Binary file modified images/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/splash_overlay.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 22 additions & 12 deletions src/rviz/splash_screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@
*/

#include "rviz/splash_screen.h"
#include "rviz/load_resource.h"
#include "version.h"

#include <QPainter>
#include <QPoint>

#include <iostream>
#include <QCoreApplication>
Expand All @@ -39,26 +41,34 @@ namespace rviz
{

SplashScreen::SplashScreen( const QPixmap& pixmap )
: QSplashScreen( pixmap )
: QSplashScreen()
{
}
const int bottom_border = 27;
QPixmap splash( pixmap.width(), pixmap.height()+bottom_border );
splash.fill( QColor(0,0,0) );

void SplashScreen::showMessage( const QString& message )
{
QSplashScreen::showMessage( message, Qt::AlignLeft | Qt::AlignBottom, Qt::white );
}
QPainter painter( &splash );

void SplashScreen::drawContents ( QPainter * painter )
{
QSplashScreen::drawContents( painter );
painter.drawPixmap( QPoint(0,0), pixmap );

QPixmap overlay = loadPixmap( "package://rviz/images/splash_overlay.png" );
painter.drawTiledPixmap( QRect( 0,pixmap.height()-overlay.height(), pixmap.width(),pixmap.height() ), overlay );

// draw version info
QString version_info = "r"+QString(get_version().c_str());
version_info += " (" + QString(get_distro().c_str()) + ")";

painter->setPen( QColor(160,160,160) );
QRect r = rect();
painter.setPen( QColor(160,160,160) );
QRect r = splash.rect();
r .setRect(r.x() + 5, r.y() + 5, r.width() - 10, r.height() - 10);
painter->drawText( r, Qt::AlignRight | Qt::AlignBottom, version_info );
painter.drawText( r, Qt::AlignRight | Qt::AlignBottom, version_info );

setPixmap( splash );
}

void SplashScreen::showMessage( const QString& message )
{
QSplashScreen::showMessage( message, Qt::AlignLeft | Qt::AlignBottom, Qt::white );
}

} // end namespace rviz
2 changes: 0 additions & 2 deletions src/rviz/splash_screen.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ Q_OBJECT
public:
SplashScreen( const QPixmap& pixmap );

void drawContents ( QPainter * painter );

public Q_SLOTS:
void showMessage( const QString& message );
};
Expand Down

0 comments on commit 608fafa

Please sign in to comment.