Commit bac91c72 authored by Frédéric Larue's avatar Frédéric Larue

Demo mode added that makes it possible to show logos of the university, the lab and the team.

parent 7066ecf5
......@@ -5,11 +5,14 @@ message( STATUS " - " ${CURRENT_TARGET} )
project( ${CURRENT_TARGET} LANGUAGES CXX )
set( CMAKE_AUTOMOC ON )
set( CMAKE_AUTORCC ON )
file( GLOB LIB_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.h )
file( GLOB LIB_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp )
file( GLOB LIB_RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.qrc )
generate_resource_solution_folders( ${LIB_RESOURCES} ALL_RESOURCE_FILES )
add_library( ${PROJECT_NAME} SHARED ${LIB_HEADERS} ${LIB_SOURCES} )
add_library( ${PROJECT_NAME} SHARED ${LIB_HEADERS} ${LIB_SOURCES} ${LIB_RESOURCES} ${ALL_RESOURCE_FILES} )
if( WIN32 )
target_link_libraries( ${CURRENT_TARGET}
......
......@@ -40,6 +40,8 @@ float GLViewer::Shininess = 80.0f;
QString GLViewer::s_MetricGrid2DSuffix;
QString GLViewer::s_MetricGrid3DSuffix;
QImage GLViewer::s_Logos[4];
......@@ -839,6 +841,53 @@ void GLViewer::manageAnimations()
}
void GLViewer::setDemoModeEnabled( bool enabled )
{
if( m_IsDemoModeEnabled = enabled )
{
updateDemoModeLogos();
update();
}
}
void GLViewer::updateDemoModeLogos()
{
if( m_IsDemoModeEnabled )
{
if( s_Logos[0].isNull() )
{
s_Logos[0] = QImage( ":/images/resources/unistra-logo.png" );
s_Logos[1] = QImage( ":/images/resources/igg-logo.png" );
s_Logos[2] = QImage( ":/images/resources/icube-logo.png" );
}
int h = int(0.075f * height());
if( h != m_CurrentLogos[0].height() )
for( int i=0; i<3; ++i )
{
h = int(((i == 1)? 0.09f : 0.075f) * height());
int w = int(float(h)*s_Logos[i].width()/s_Logos[i].height());
m_CurrentLogos[i] = s_Logos[i].scaled( QSize(w,h), Qt::KeepAspectRatio, Qt::SmoothTransformation );
}
}
}
void GLViewer::displayDemoModeLogos()
{
if( m_IsDemoModeEnabled )
{
QPainter painter;
painter.begin( this );
painter.drawImage( 25, height()-m_CurrentLogos[0].height()-10, m_CurrentLogos[0] );
painter.drawImage( (width()-m_CurrentLogos[1].width())/2, height()-m_CurrentLogos[1].height()-10, m_CurrentLogos[1] );
painter.drawImage( width()-m_CurrentLogos[2].width()-25, height()-m_CurrentLogos[2].height()-10, m_CurrentLogos[2] );
painter.end();
}
}
void GLViewer::paintGL()
{
manageAnimations();
......@@ -1006,6 +1055,8 @@ void GLViewer::paintGL()
// Display the information bar.
m_InfoBarManager->display();
displayDemoModeLogos();
}
......@@ -1154,6 +1205,8 @@ void GLViewer::resizeGL( int width, int height )
m_SelectionCurrentTool->onResize();
updateSelectionZBuffer();
updateDemoModeLogos();
}
......
......@@ -60,7 +60,7 @@ public:
class GLVIEWER_API NavigationControl
{
GLViewer *m_Viewer;
GLViewer *m_Viewer;
public:
inline NavigationControl( GLViewer *viewer ) : m_Viewer(viewer) {}
......@@ -130,6 +130,12 @@ protected:
static QString s_MetricGrid2DSuffix;
static QString s_MetricGrid3DSuffix;
static QImage s_Logos[4];
bool m_IsDemoModeEnabled = false;
QImage m_CurrentLogos[4];
void updateDemoModeLogos();
void displayDemoModeLogos();
public:
static QVector3D BgTopColor;
static QVector3D BgBottomColor;
......@@ -458,6 +464,9 @@ public slots:
inline void setMetricGrid2DSuffix( const QString& suffix ) { s_MetricGrid2DSuffix = suffix; }
inline void setMetricGrid3DSuffix( const QString& suffix ) { s_MetricGrid3DSuffix = suffix; }
void setDemoModeEnabled( bool enabled );
inline void setDemoModeDisabled( bool disabled ) { setDemoModeEnabled( !disabled ); }
};
......
<RCC>
<qresource prefix="/images">
<file>resources/icube-logo.png</file>
<file>resources/igg-logo.png</file>
<file>resources/unistra-logo.png</file>
</qresource>
</RCC>
......@@ -248,7 +248,8 @@ void UIMainWindow::init()
connect( ui->actionCloseProject, SIGNAL(triggered()), this, SLOT(closeCurrentProject()) );
connect( ui->comboTypeFilter, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(updateCurrentProjectContent()) );
connect( ui->actionAbout, SIGNAL(triggered()), this, SLOT(showAboutDialog()) );
connect( ui->actionDisplayPluginsList, SIGNAL(triggered()), this, SLOT(displayPluginsList()) );
connect( ui->actionShowLogos, SIGNAL(toggled(bool)), m_CurrentViewer, SLOT(setDemoModeEnabled(bool)) );
connect( ui->actionDisplayPluginsList, SIGNAL(triggered()), this, SLOT(displayPluginsList()) );
connect( ui->action2DViewer, SIGNAL(triggered()), this, SLOT(setDefault3DViewer()) );
connect( ui->action3DViewer, SIGNAL(triggered()), this, SLOT(setDefault2DViewer()) );
connect( ui->actionClone, SIGNAL(triggered()), this, SLOT(cloneSelectedManageables()) );
......
......@@ -70,6 +70,7 @@
<string>Help</string>
</property>
<addaction name="actionDisplayPluginsList"/>
<addaction name="actionShowLogos"/>
<addaction name="actionAbout"/>
</widget>
<widget class="QMenu" name="menuSettings">
......@@ -830,6 +831,14 @@
<string>Render options</string>
</property>
</action>
<action name="actionShowLogos">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Show logos</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment