1 // File: SalomeApp_AboutDlg.cxx
2 // Created: 03.06.2005 13:52:45
3 // Author: Sergey TELKOV
4 // Copyright (C) CEA 2005
6 #include "SalomeApp_AboutDlg.h"
8 #include <SUIT_Session.h>
9 #include <SUIT_ResourceMgr.h>
14 #include <qgroupbox.h>
17 SalomeApp_AboutDlg::SalomeApp_AboutDlg( const QString& defName, const QString& defVer, QWidget* parent )
18 : QtxDialog( parent, "salome_about_dialog", true, false, None )
20 SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
22 QPixmap ico = resMgr->loadPixmap( "SalomeApp", tr( "APP_DEFAULT_ICO" ), false );
26 QPalette pal = palette();
27 QColorGroup cg = pal.active();
28 cg.setColor( QColorGroup::Foreground, Qt::darkBlue );
29 cg.setColor( QColorGroup::Background, Qt::white );
30 pal.setActive( cg ); pal.setInactive( cg ); pal.setDisabled( cg );
33 QVBoxLayout* main = new QVBoxLayout( mainFrame() );
34 QGroupBox* base = new QGroupBox( 1, Qt::Horizontal, "", mainFrame() );
35 base->setFrameStyle( QFrame::NoFrame );
36 base->setInsideMargin( 0 );
37 main->addWidget( base );
39 QLabel* screen = new QLabel( base );
40 screen->setScaledContents( true );
41 screen->setAlignment( Qt::AlignCenter );
42 screen->setFrameStyle( QFrame::Box | QFrame::Plain );
44 QLabel* title = new QLabel( base );
45 title->setAlignment( Qt::AlignCenter );
46 changeFont( title, true, false, false, 5 );
48 QLabel* version = new QLabel( base );
49 version->setAlignment( Qt::AlignCenter );
50 changeFont( version, false, true, false, 2 );
52 QLabel* copyright = new QLabel( base );
53 copyright->setAlignment( Qt::AlignCenter );
54 changeFont( copyright, false, false, false, 1 );
56 QLabel* license = new QLabel( base );
57 license->setAlignment( Qt::AlignCenter );
58 changeFont( license, false, false, false, 1 );
60 screen->setPixmap( resMgr->loadPixmap( "SalomeApp", tr( "ABOUT" ), false ) );
63 QString titleText = tr( "ABOUT_TITLE" );
64 if ( titleText == "ABOUT_TITLE" )
66 title->setText( titleText );
69 QString verText = tr( "ABOUT_VERSION" );
70 if ( verText.contains( "%1" ) )
71 verText = verText.arg( defVer );
72 version->setText( verText );
73 checkLabel( version );
75 copyright->setText( tr( "ABOUT_COPYRIGHT" ) );
76 checkLabel( copyright );
78 license->setText( tr( "ABOUT_LICENSE" ) );
79 checkLabel( license );
81 QString capText = tr( "ABOUT_CAPTION" );
82 if ( capText.contains( "%1" ) )
83 capText = capText.arg( defName );
84 setCaption( capText );
86 setSizeGripEnabled( false );
90 SalomeApp_AboutDlg::~SalomeApp_AboutDlg()
95 /*!On mouse press event.*/
96 void SalomeApp_AboutDlg::mousePressEvent( QMouseEvent* )
101 /*!Change font of widget \a wid.
102 *\param wid - QWidget
103 *\param bold - boolean value
104 *\param italic - boolean value
105 *\param underline - boolean value
106 *\param inc - integer increment for font point size.
108 void SalomeApp_AboutDlg::changeFont( QWidget* wid, const bool bold, const bool italic,
109 const bool underline, const int inc ) const
114 QFont widFont = wid->font();
115 widFont.setBold( bold );
116 widFont.setItalic( italic );
117 widFont.setUnderline( underline );
118 widFont.setPointSize( widFont.pointSize() + inc );
121 /*!Check lable \a lab.*/
122 void SalomeApp_AboutDlg::checkLabel( QLabel* lab ) const
127 bool vis = !lab->text().stripWhiteSpace().isEmpty() ||
128 ( lab->pixmap() && !lab->pixmap()->isNull() );
129 vis ? lab->show() : lab->hide();