Salome HOME
ed8f3a87273d3dedfd8e2f9958cf512965bd22ff
[modules/gui.git] / src / SUIT / SUIT_ResourceMgr.cxx
1 // Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
2 // 
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.
7 // 
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/
18 //
19 #include "SUIT_ResourceMgr.h"
20
21 /*!
22     Constructor
23 */
24 SUIT_ResourceMgr::SUIT_ResourceMgr( const QString& app, const QString& resVarTemplate )
25 : QtxResourceMgr( app, resVarTemplate )
26 {
27 }
28
29 /*!
30     Destructor
31 */
32 SUIT_ResourceMgr::~SUIT_ResourceMgr()
33 {
34 }
35
36 /*!
37     Returns the version of application
38 */
39 QString SUIT_ResourceMgr::version() const
40 {
41   return myVersion;
42 }
43
44 /*!
45     Sets the version of application
46 */
47 void SUIT_ResourceMgr::setVersion( const QString& ver )
48 {
49   myVersion = ver;
50 }
51
52 /*!
53     Loads a doc page from 'prefix' resources and indetified by 'id'
54 */
55 QString SUIT_ResourceMgr::loadDoc( const QString& prefix, const QString& id ) const
56 {
57   QString docSection = option( "doc_section_name" );
58   if ( docSection.isEmpty() )
59     docSection = QString( "docs" );
60
61   return path( docSection, prefix, id );
62 }
63
64 /*!
65     Returns the user file name for specified application
66 */
67 QString SUIT_ResourceMgr::userFileName( const QString& appName ) const
68 {
69   QString pathName = QtxResourceMgr::userFileName( appName );
70
71   if ( !version().isEmpty() )
72     pathName += QString( "." ) + version();
73
74   return pathName;
75 }