1 // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // File: LightApp_AboutDlg.cxx
20 // Created: 03.06.2005 13:52:45
21 // Author: Sergey TELKOV
22 // Copyright (C) CEA 2005
24 #include "LightApp_AboutDlg.h"
26 #include <SUIT_Session.h>
27 #include <SUIT_ResourceMgr.h>
32 #include <qgroupbox.h>
35 LightApp_AboutDlg::LightApp_AboutDlg( const QString& defName, const QString& defVer, QWidget* parent )
36 : QtxDialog( parent, "salome_about_dialog", true, false, None )
38 SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
40 QPixmap ico = resMgr->loadPixmap( "LightApp", tr( "ICO_ABOUT" ), false );
44 QPalette pal = palette();
45 QColorGroup cg = pal.active();
46 cg.setColor( QColorGroup::Foreground, Qt::darkBlue );
47 cg.setColor( QColorGroup::Background, Qt::white );
48 pal.setActive( cg ); pal.setInactive( cg ); pal.setDisabled( cg );
51 QVBoxLayout* main = new QVBoxLayout( mainFrame() );
52 QGroupBox* base = new QGroupBox( 1, Qt::Horizontal, "", mainFrame() );
53 base->setFrameStyle( QFrame::NoFrame );
54 base->setInsideMargin( 0 );
55 main->addWidget( base );
57 QLabel* screen = new QLabel( base );
58 screen->setScaledContents( true );
59 screen->setAlignment( Qt::AlignCenter );
60 screen->setFrameStyle( QFrame::Box | QFrame::Plain );
62 QLabel* title = new QLabel( base );
63 title->setAlignment( Qt::AlignCenter );
64 changeFont( title, true, false, false, 5 );
66 QLabel* version = new QLabel( base );
67 version->setAlignment( Qt::AlignCenter );
68 changeFont( version, false, true, false, 2 );
70 QLabel* copyright = new QLabel( base );
71 copyright->setAlignment( Qt::AlignCenter );
72 changeFont( copyright, false, false, false, 1 );
74 QLabel* license = new QLabel( base );
75 license->setAlignment( Qt::AlignCenter );
76 changeFont( license, false, false, false, 1 );
78 screen->setPixmap( resMgr->loadPixmap( "LightApp", tr( "ABOUT" ), false ) );
81 QString titleText = tr( "ABOUT_TITLE" );
82 if ( titleText == "ABOUT_TITLE" )
84 title->setText( titleText );
87 QString verText = tr( "ABOUT_VERSION" );
88 if ( verText.contains( "%1" ) )
89 verText = verText.arg( defVer );
90 version->setText( verText );
91 checkLabel( version );
93 copyright->setText( tr( "ABOUT_COPYRIGHT" ) );
94 checkLabel( copyright );
96 license->setText( tr( "ABOUT_LICENSE" ) );
97 checkLabel( license );
99 QString capText = tr( "ABOUT_CAPTION" );
100 if ( capText.contains( "%1" ) )
101 capText = capText.arg( defName );
102 setCaption( capText );
104 setSizeGripEnabled( false );
108 LightApp_AboutDlg::~LightApp_AboutDlg()
113 /*!On mouse press event.*/
114 void LightApp_AboutDlg::mousePressEvent( QMouseEvent* )
119 /*!Change font of widget \a wid.
120 *\param wid - QWidget
121 *\param bold - boolean value
122 *\param italic - boolean value
123 *\param underline - boolean value
124 *\param inc - integer increment for font point size.
126 void LightApp_AboutDlg::changeFont( QWidget* wid, const bool bold, const bool italic,
127 const bool underline, const int inc ) const
132 QFont widFont = wid->font();
133 widFont.setBold( bold );
134 widFont.setItalic( italic );
135 widFont.setUnderline( underline );
136 widFont.setPointSize( widFont.pointSize() + inc );
139 /*!Check lable \a lab.*/
140 void LightApp_AboutDlg::checkLabel( QLabel* lab ) const
145 bool vis = !lab->text().stripWhiteSpace().isEmpty() ||
146 ( lab->pixmap() && !lab->pixmap()->isNull() );
147 vis ? lab->show() : lab->hide();