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 : Style_ResourceMgr.cxx
23 // Author : Vadim SANDLER, Open CASCADE S.A.S (vadim.sandler@opencascade.com)
25 #include "Style_ResourceMgr.h"
28 \class Style_ResourceMgr
29 \brief SALOME style resources manager.
31 This class is used to manage the SALOME style themes throughout the application
32 in the similar way as QtxResourceMgr does it with application preferences.
34 Standard SALOME themes are stored in the global application settings files
35 (named as SalomeStyle.xml). User-defined themes are stored in user's home
36 directory - in the file .SalomeStylerc.
38 The Style_ResourceMgr class is used by SALOME style preferences dialog box
39 (Style_PrefDlg class).
45 Style_ResourceMgr::Style_ResourceMgr()
46 : QtxResourceMgr( "SalomeStyle", "%1Config" )
48 if ( dirList().isEmpty() && ::getenv( "GUI_ROOT_DIR" ) )
49 setDirList( QStringList() << Qtx::addSlash( ::getenv( "GUI_ROOT_DIR" ) ) + "share/salome/resources/gui" );
50 setCurrentFormat( "xml" );
56 Style_ResourceMgr::~Style_ResourceMgr()
61 \brief Get list of avaiable SALOME themes
62 \param type themes type
63 \param sort if \c true (default), returns a list of themes sorted by name
64 \return list of avaiable themes names
66 QStringList Style_ResourceMgr::styles( StyleType type, bool sort )
70 WorkingMode m = workingMode();
74 setWorkingMode( IgnoreUserValues );
79 setWorkingMode( AllowUserValues );
81 setWorkingMode( IgnoreUserValues );
82 QMutableListIterator<QString> it( sl );
83 while ( it.hasNext() ) {
84 QString s = it.next();
85 if ( hasSection( s ) ) it.remove();
90 setWorkingMode( AllowUserValues );