1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File: LightApp_AboutDlg.cxx
23 // Created: 03.06.2005 13:52:45
24 // Author: Sergey TELKOV
26 #include "LightApp_AboutDlg.h"
28 #include <SUIT_Session.h>
29 #include <SUIT_ResourceMgr.h>
31 #include <QtxGridBox.h>
34 #include <QVBoxLayout>
40 LightApp_AboutDlg::LightApp_AboutDlg( const QString& defName, const QString& defVer, QWidget* parent )
41 : QtxDialog( parent, true, false, None )
43 setObjectName( "salome_about_dialog" );
45 SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
47 QPixmap ico = resMgr->loadPixmap( "LightApp", tr( "ICO_ABOUT" ), false );
51 QPalette pal = palette();
53 pal.setBrush( QPalette::Active, QPalette::WindowText, QBrush( Qt::darkBlue ) );
54 pal.setBrush( QPalette::Active, QPalette::Window, QBrush( Qt::white ) );
56 pal.setBrush( QPalette::Inactive, QPalette::WindowText, QBrush( Qt::darkBlue ) );
57 pal.setBrush( QPalette::Inactive, QPalette::Window, QBrush( Qt::white ) );
59 pal.setBrush( QPalette::Disabled, QPalette::WindowText, QBrush( Qt::darkBlue ) );
60 pal.setBrush( QPalette::Disabled, QPalette::Window, QBrush( Qt::white ) );
64 QVBoxLayout* main = new QVBoxLayout( mainFrame() );
65 QtxGridBox* base = new QtxGridBox( 1, Qt::Horizontal, mainFrame(), 0, 0 );
66 base->setInsideMargin( 0 );
67 main->addWidget( base );
69 QLabel* screen = new QLabel( base );
70 screen->setScaledContents( true );
71 screen->setAlignment( Qt::AlignCenter );
72 screen->setFrameStyle( QFrame::Box | QFrame::Plain );
74 QLabel* title = new QLabel( base );
75 title->setAlignment( Qt::AlignCenter );
76 changeFont( title, true, false, false, 5 );
78 QLabel* version = new QLabel( base );
79 version->setAlignment( Qt::AlignCenter );
80 changeFont( version, false, true, false, 2 );
82 QLabel* copyright = new QLabel( base );
83 copyright->setAlignment( Qt::AlignCenter );
84 changeFont( copyright, false, false, false, 1 );
86 QLabel* license = new QLabel( base );
87 license->setAlignment( Qt::AlignCenter );
88 changeFont( license, false, false, false, 1 );
90 screen->setPixmap( resMgr->loadPixmap( "LightApp", tr( "ABOUT" ), false ) );
93 QString titleText = tr( "ABOUT_TITLE" );
94 if ( titleText == "ABOUT_TITLE" )
96 title->setText( titleText );
99 QString verText = tr( "ABOUT_VERSION" );
100 if ( verText.contains( "%1" ) )
101 verText = verText.arg( defVer );
102 version->setText( verText );
103 checkLabel( version );
105 copyright->setText( tr( "ABOUT_COPYRIGHT" ) );
106 checkLabel( copyright );
108 license->setText( tr( "ABOUT_LICENSE" ) );
109 checkLabel( license );
111 QString capText = tr( "ABOUT_CAPTION" );
112 if ( capText.contains( "%1" ) )
113 capText = capText.arg( defName );
114 setWindowTitle( capText );
116 setSizeGripEnabled( false );
120 LightApp_AboutDlg::~LightApp_AboutDlg()
125 /*!On mouse press event.*/
126 void LightApp_AboutDlg::mousePressEvent( QMouseEvent* )
131 /*!Change font of widget \a wid.
132 *\param wid - QWidget
133 *\param bold - boolean value
134 *\param italic - boolean value
135 *\param underline - boolean value
136 *\param inc - integer increment for font point size.
138 void LightApp_AboutDlg::changeFont( QWidget* wid, const bool bold, const bool italic,
139 const bool underline, const int inc ) const
144 QFont widFont = wid->font();
145 widFont.setBold( bold );
146 widFont.setItalic( italic );
147 widFont.setUnderline( underline );
148 widFont.setPointSize( widFont.pointSize() + inc );
151 /*!Check lable \a lab.*/
152 void LightApp_AboutDlg::checkLabel( QLabel* lab ) const
157 bool vis = !lab->text().trimmed().isEmpty() ||
158 ( lab->pixmap() && !lab->pixmap()->isNull() );
159 vis ? lab->show() : lab->hide();