X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FLightApp%2FLightApp_AboutDlg.cxx;h=2fc1436d8834b71365d6bdbc5752e6381ac61bb5;hb=50bdc819dd64504173ee708bc4bbcbbf4d45f300;hp=689d4165cbab78017d36df04d391fc9320a6c53d;hpb=642cc0c19c61be7fde4b0574db044d6551d139e9;p=modules%2Fgui.git diff --git a/src/LightApp/LightApp_AboutDlg.cxx b/src/LightApp/LightApp_AboutDlg.cxx index 689d4165c..2fc1436d8 100644 --- a/src/LightApp/LightApp_AboutDlg.cxx +++ b/src/LightApp/LightApp_AboutDlg.cxx @@ -1,40 +1,95 @@ +// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + // File: LightApp_AboutDlg.cxx // Created: 03.06.2005 13:52:45 // Author: Sergey TELKOV -// Copyright (C) CEA 2005 - +// #include "LightApp_AboutDlg.h" +#include "LightApp_Application.h" #include #include -#include -#include -#include -#include +#include + +#include +#include +#include +#include +#include +#include +#include /*!Constructor.*/ LightApp_AboutDlg::LightApp_AboutDlg( const QString& defName, const QString& defVer, QWidget* parent ) -: QtxDialog( parent, "salome_about_dialog", true, false, None ) +: QtxDialog( parent, true, false, None ) { + setObjectName( "salome_about_dialog" ); + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); QPixmap ico = resMgr->loadPixmap( "LightApp", tr( "ICO_ABOUT" ), false ); if ( !ico.isNull() ) - setIcon( ico ); + setWindowIcon( ico ); QPalette pal = palette(); - QColorGroup cg = pal.active(); - cg.setColor( QColorGroup::Foreground, Qt::darkBlue ); - cg.setColor( QColorGroup::Background, Qt::white ); - pal.setActive( cg ); pal.setInactive( cg ); pal.setDisabled( cg ); + + pal.setBrush( QPalette::Active, QPalette::WindowText, QBrush( Qt::darkBlue ) ); + pal.setBrush( QPalette::Active, QPalette::Window, QBrush( Qt::white ) ); + + pal.setBrush( QPalette::Inactive, QPalette::WindowText, QBrush( Qt::darkBlue ) ); + pal.setBrush( QPalette::Inactive, QPalette::Window, QBrush( Qt::white ) ); + + + pal.setBrush( QPalette::Disabled, QPalette::WindowText, QBrush( Qt::darkBlue ) ); + pal.setBrush( QPalette::Disabled, QPalette::Window, QBrush( Qt::white ) ); + + + setPalette(pal); - QVBoxLayout* main = new QVBoxLayout( mainFrame() ); - QGroupBox* base = new QGroupBox( 1, Qt::Horizontal, "", mainFrame() ); - base->setFrameStyle( QFrame::NoFrame ); + QTabWidget* tw = new QTabWidget( mainFrame() ); + + QGridLayout* main = new QGridLayout( mainFrame() ); + main->addWidget( tw, 0, 0, 1, 3 ); + + QtxGridBox* base = new QtxGridBox( 1, Qt::Horizontal, tw, 0, 0 ); base->setInsideMargin( 0 ); - main->addWidget( base ); + + tw->addTab(base, tr("ABOUT_BASE") ); + + tw->addTab(getModulesInfoWidget(tw), tr("ABOUT_MODULE_INFOS") ); + + QPushButton * btn = new QPushButton( tr("ABOUT_CLOSE"), mainFrame() ); + + main->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum), 1, 0, 1, 1); + + main->addWidget( btn, 1, 1, 1, 1); + + main->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum), 1, 2, 1, 1); + + connect(btn, SIGNAL( clicked() ), this, SLOT( accept()) ); + QLabel* screen = new QLabel( base ); screen->setScaledContents( true ); @@ -81,7 +136,7 @@ LightApp_AboutDlg::LightApp_AboutDlg( const QString& defName, const QString& def QString capText = tr( "ABOUT_CAPTION" ); if ( capText.contains( "%1" ) ) capText = capText.arg( defName ); - setCaption( capText ); + setWindowTitle( capText ); setSizeGripEnabled( false ); } @@ -92,12 +147,6 @@ LightApp_AboutDlg::~LightApp_AboutDlg() //! Do nothing. } -/*!On mouse press event.*/ -void LightApp_AboutDlg::mousePressEvent( QMouseEvent* ) -{ - accept(); -} - /*!Change font of widget \a wid. *\param wid - QWidget *\param bold - boolean value @@ -124,7 +173,39 @@ void LightApp_AboutDlg::checkLabel( QLabel* lab ) const if ( !lab ) return; - bool vis = !lab->text().stripWhiteSpace().isEmpty() || + bool vis = !lab->text().trimmed().isEmpty() || ( lab->pixmap() && !lab->pixmap()->isNull() ); vis ? lab->show() : lab->hide(); } + +/*! Return widget with info about versions of modules */ +QWidget* LightApp_AboutDlg::getModulesInfoWidget(QWidget* parent) const { + + QWidget* modulesInfo = new QWidget(parent); + QGridLayout* gridLayout = new QGridLayout(modulesInfo); + + LightApp_Application* app = dynamic_cast(SUIT_Session::session()->activeApplication()); + if(app) { + + CAM_Application::ModuleShortInfoList info = app->getVersionInfo(); + + CAM_Application::ModuleShortInfoList::const_iterator it = info.constBegin(); + int i = 0; + + QString unknownVersion = tr("ABOUT_UNKNOWN_VERSION"); + + while (it != info.constEnd()) { + QLabel * name = new QLabel( "

" + (*it).name + ":

", modulesInfo); + QString v = (*it).version.isEmpty() ? unknownVersion : (*it).version; + QLabel * version = new QLabel("

" + v + "

",modulesInfo); + gridLayout->addWidget(name , i, 0); + gridLayout->addWidget(version , i, 1); + gridLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum), i, 2); + it++; + i++; + } + gridLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), i, 0); + gridLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), i, 1); + } + return modulesInfo; +}