Salome HOME
no message
[modules/gui.git] / src / SUIT / SUIT_ResourceMgr.cxx
1 #include "SUIT_ResourceMgr.h"
2
3 /*!
4     Constructor
5 */
6 SUIT_ResourceMgr::SUIT_ResourceMgr( const QString& app, const QString& resVarTemplate )
7 : QtxResourceMgr( app, resVarTemplate )
8 {
9 }
10
11 /*!
12     Destructor
13 */
14 SUIT_ResourceMgr::~SUIT_ResourceMgr()
15 {
16 }
17
18 /*!
19     Returns the version of application
20 */
21 QString SUIT_ResourceMgr::version() const
22 {
23   return myVersion;
24 }
25
26 /*!
27     Sets the version of application
28 */
29 void SUIT_ResourceMgr::setVersion( const QString& ver )
30 {
31   myVersion = ver;
32 }
33
34 /*!
35     Loads a doc page from 'prefix' resources and indetified by 'id'
36 */
37 QString SUIT_ResourceMgr::loadDoc( const QString& prefix, const QString& id ) const
38 {
39   QString docSection = option( "doc_section_name" );
40   if ( docSection.isEmpty() )
41     docSection = QString( "docs" );
42
43   return path( docSection, prefix, id );
44 }
45
46 /*!
47     Returns the user file name for specified application
48 */
49 QString SUIT_ResourceMgr::userFileName( const QString& appName ) const
50 {
51   QString pathName = QtxResourceMgr::userFileName( appName );
52
53   if ( !version().isEmpty() )
54   {
55     int idx = pathName.findRev( appName );
56     if ( idx != -1 )
57       pathName.replace( idx, appName.length(), appName + version() );
58   }
59
60   return pathName;
61 }