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>
16 SalomeApp_AboutDlg::SalomeApp_AboutDlg( const QString& defName, const QString& defVer, QWidget* parent )
17 : QtxDialog( parent, "salome_about_dialog", true, false, None )
19 SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
21 QPixmap ico = resMgr->loadPixmap( "SalomeApp", tr( "ICO_ABOUT" ) );
26 QVBoxLayout* main = new QVBoxLayout( mainFrame() );
27 QGroupBox* base = new QGroupBox( 1, Qt::Horizontal, "", mainFrame() );
28 base->setFrameStyle( QFrame::NoFrame );
29 base->setInsideMargin( 0 );
30 main->addWidget( base );
32 QLabel* screen = new QLabel( base );
33 screen->setScaledContents( true );
34 screen->setAlignment( Qt::AlignCenter );
35 screen->setFrameStyle( QFrame::Box | QFrame::Plain );
37 QLabel* title = new QLabel( base );
38 title->setAlignment( Qt::AlignCenter );
39 changeFont( title, true, false, false, 5 );
41 QLabel* version = new QLabel( base );
42 version->setAlignment( Qt::AlignCenter );
43 changeFont( version, false, true, false, 2 );
45 QLabel* copyright = new QLabel( base );
46 copyright->setAlignment( Qt::AlignCenter );
47 changeFont( copyright, false, false, false, 1 );
49 QLabel* license = new QLabel( base );
50 license->setAlignment( Qt::AlignCenter );
51 changeFont( license, false, false, false, 1 );
53 screen->setPixmap( resMgr->loadPixmap( "SalomeApp", tr( "ABOUT" ) ) );
56 QString titleText = tr( "ABOUT_TITLE" );
57 if ( titleText == "ABOUT_TITLE" )
59 title->setText( titleText );
62 QString verText = tr( "ABOUT_VERSION" );
63 if ( verText.contains( "%1" ) )
64 verText = verText.arg( defVer );
65 version->setText( verText );
66 checkLabel( version );
68 copyright->setText( tr( "ABOUT_COPYRIGHT" ) );
69 checkLabel( copyright );
71 license->setText( tr( "ABOUT_LICENSE" ) );
72 checkLabel( license );
74 QString capText = tr( "ABOUT_VERSION" );
75 if ( capText.contains( "%1" ) )
76 capText = capText.arg( defName );
77 setCaption( capText );
79 setSizeGripEnabled( false );
82 SalomeApp_AboutDlg::~SalomeApp_AboutDlg()
86 void SalomeApp_AboutDlg::mousePressEvent( QMouseEvent* )
91 void SalomeApp_AboutDlg::changeFont( QWidget* wid, const bool bold, const bool italic,
92 const bool underline, const int inc ) const
97 QFont widFont = wid->font();
98 widFont.setBold( bold );
99 widFont.setItalic( italic );
100 widFont.setUnderline( underline );
101 widFont.setPointSize( widFont.pointSize() + inc );
104 void SalomeApp_AboutDlg::checkLabel( QLabel* lab ) const
109 bool vis = !lab->text().stripWhiteSpace().isEmpty() ||
110 ( lab->pixmap() && !lab->pixmap()->isNull() );
111 vis ? lab->show() : lab->hide();