1 // Copyright (C) 2015-2016 OPEN CASCADE
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, or (at your option) any later version.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // File : PyViewer_Settings.cxx
20 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
23 #include "PyViewer_Settings.h"
25 #include <QtxResourceMgr.h>
27 PyViewer_Settings::PyViewer_Settings( QtxResourceMgr* resMgr ) :
33 PyViewer_Settings::PyViewer_Settings( QtxResourceMgr* resMgr, const QString& group ) :
40 void PyViewer_Settings::load()
42 if ( !myResMgr ) return;
43 QString group = myGroup.isEmpty() ? option( snEditor ) : myGroup;
44 setHighlightCurrentLine( myResMgr->booleanValue( group, option( snHighlightCurrentLine ), highlightCurrentLine() ) );
45 setTextWrapping( myResMgr->booleanValue( group, option( snTextWrapping ), textWrapping() ) );
46 setCenterCursorOnScroll( myResMgr->booleanValue( group, option( snCenterCursorOnScroll ), centerCursorOnScroll() ) );
47 setLineNumberArea( myResMgr->booleanValue( group, option( snLineNumberArea ), lineNumberArea() ) );
48 setVerticalEdge( myResMgr->booleanValue( group, option( snVerticalEdge ), verticalEdge() ) );
49 setNumberColumns( myResMgr->integerValue( group, option( snNumberColumns ), numberColumns() ) );
50 setTabSpaceVisible( myResMgr->booleanValue( group, option( snTabSpaceVisible ), tabSpaceVisible() ) );
51 setTabSize( myResMgr->integerValue( group, option( snTabSize ), tabSize() ) );
52 setFont( myResMgr->fontValue( group, option( snFont ), font() ) );
53 setCompletionPolicy( myResMgr->integerValue( group, option( snCompletionPolicy ),
54 completionPolicy() ) );
57 void PyViewer_Settings::save()
59 if ( !myResMgr ) return;
60 QString group = myGroup.isEmpty() ? option( snEditor ) : myGroup;
61 myResMgr->setValue( group, option( snHighlightCurrentLine ), highlightCurrentLine() );
62 myResMgr->setValue( group, option( snTextWrapping ), textWrapping() );
63 myResMgr->setValue( group, option( snCenterCursorOnScroll ), centerCursorOnScroll() );
64 myResMgr->setValue( group, option( snLineNumberArea ), lineNumberArea() );
65 myResMgr->setValue( group, option( snVerticalEdge ), verticalEdge() );
66 myResMgr->setValue( group, option( snNumberColumns ), numberColumns() );
67 myResMgr->setValue( group, option( snTabSpaceVisible ), tabSpaceVisible() );
68 myResMgr->setValue( group, option( snTabSize ), tabSize() );
69 myResMgr->setValue( group, option( snFont ), font() );
70 myResMgr->setValue( group, option( snCompletionPolicy ), completionPolicy() );