From e845537b7ef43a27f125a71587a4e40d8c4f70c8 Mon Sep 17 00:00:00 2001 From: stv Date: Thu, 9 Jun 2005 09:36:29 +0000 Subject: [PATCH] no message --- src/Qtx/QtxResourceEditor.cxx | 1016 --------------------------------- src/Qtx/QtxResourceEditor.h | 244 -------- 2 files changed, 1260 deletions(-) delete mode 100755 src/Qtx/QtxResourceEditor.cxx delete mode 100755 src/Qtx/QtxResourceEditor.h diff --git a/src/Qtx/QtxResourceEditor.cxx b/src/Qtx/QtxResourceEditor.cxx deleted file mode 100755 index 021d7ee95..000000000 --- a/src/Qtx/QtxResourceEditor.cxx +++ /dev/null @@ -1,1016 +0,0 @@ -// File: QtxResourceEditor.cxx -// Created: -// Author: Sergey TELKOV -// Copyright: - -#include "QtxResourceEditor.h" - -/* - Class: QtxResourceEditor::Item - Descr: Class for incapsulation of one preference item -*/ - -//======================================================================= -//function : Item -//purpose : -//======================================================================= - -QtxResourceEditor::Item::Item( QtxResourceEditor* ed ) -:myType( -1 ), -myEditor( ed ) -{ - myId = GenerateId(); -} - -//======================================================================= -//function : ~Item -//purpose : -//======================================================================= - -QtxResourceEditor::Item::~Item() -{ -} - -//======================================================================= -//function : GetId -//purpose : -//======================================================================= - -int QtxResourceEditor::Item::GetId() const -{ - return myId; -} - -//======================================================================= -//function : GetId -//purpose : -//======================================================================= - -int QtxResourceEditor::Item::GetType() const -{ - return myType; -} - -//======================================================================= -//function : Set -//purpose : -//======================================================================= - -void QtxResourceEditor::Item::Set( const QString& sect, const QString& name, - const int type, const QString& label ) -{ - myType = type; - myName = name; - myLabel = label; - mySection = sect; -} - -//======================================================================= -//function : Get -//purpose : -//======================================================================= - -QString QtxResourceEditor::Item::Get( QString& name, int& type, QString& label ) const -{ - type = myType; - name = myName; - label = myLabel; - return mySection; -} - -//======================================================================= -//function : SetList -//purpose : -//======================================================================= - -void QtxResourceEditor::Item::SetList( const QValueList&, const QStringList& ) -{ -} - -//======================================================================= -//function : SetRange -//purpose : -//======================================================================= - -void QtxResourceEditor::Item::SetRange( const double, const double, const double, const double ) -{ -} - -//======================================================================= -//function : Update -//purpose : default implementation do nothing -//======================================================================= - -void QtxResourceEditor::Item::Update() -{ -} - -//======================================================================= -//function : -//purpose : -//======================================================================= - -bool QtxResourceEditor::Item::GetInteger( const QString& sect, const QString& name, int& val ) const -{ - bool ok = resMgr() && resMgr()->hasValue( sect, name ); - if( ok ) - val = resMgr()->integerValue( sect, name ); - return ok; -} - -//======================================================================= -//function : -//purpose : -//======================================================================= - -bool QtxResourceEditor::Item::GetBoolean( const QString& sect, const QString& name, bool& val ) const -{ - bool ok = resMgr() && resMgr()->hasValue( sect, name ); - if( ok ) - val = resMgr()->booleanValue( sect, name ); - return ok; -} - -//======================================================================= -//function : -//purpose : -//======================================================================= - -bool QtxResourceEditor::Item::GetDouble( const QString& sect, const QString& name, double& val ) const -{ - bool ok = resMgr() && resMgr()->hasValue( sect, name ); - if( ok ) - val = resMgr()->doubleValue( sect, name ); - return ok; -} - -//======================================================================= -//function : -//purpose : -//======================================================================= - -bool QtxResourceEditor::Item::GetString( const QString& sect, const QString& name, QString& val ) const -{ - bool ok = resMgr() && resMgr()->hasValue( sect, name ); - if( ok ) - val = resMgr()->stringValue( sect, name ); - return ok; -} - -//======================================================================= -//function : -//purpose : -//======================================================================= - -bool QtxResourceEditor::Item::GetColor( const QString& sect, const QString& name, QColor& val ) const -{ - bool ok = resMgr() && resMgr()->hasValue( sect, name ); - if( ok ) - val = resMgr()->colorValue( sect, name ); - return ok; -} - -//======================================================================= -//function : -//purpose : -//======================================================================= - -void QtxResourceEditor::Item::SetInteger( const QString& sect, const QString& name, const int val ) -{ - if( resMgr() ) - resMgr()->setValue( sect, name, val ); -} - -//======================================================================= -//function : -//purpose : -//======================================================================= - -void QtxResourceEditor::Item::SetBoolean( const QString& sect, const QString& name, const bool val ) -{ - if( resMgr() ) - resMgr()->setValue( sect, name, val ); -} - -//======================================================================= -//function : -//purpose : -//======================================================================= - -void QtxResourceEditor::Item::SetDouble( const QString& sect, const QString& name, const double val ) -{ - if( resMgr() ) - resMgr()->setValue( sect, name, val ); -} - -//======================================================================= -//function : -//purpose : -//======================================================================= - -void QtxResourceEditor::Item::SetString( const QString& sect, const QString& name, const QString& val ) -{ - if( resMgr() ) - resMgr()->setValue( sect, name, val ); -} - -//======================================================================= -//function : -//purpose : -//======================================================================= - -void QtxResourceEditor::Item::SetColor( const QString& sect, const QString& name, const QColor& val ) -{ - if( resMgr() ) - resMgr()->setValue( sect, name, val ); -} - -//======================================================================= -//function : -//purpose : -//======================================================================= - -QtxResourceMgr* QtxResourceEditor::Item::resMgr() const -{ - return myEditor ? myEditor->resMgr() : NULL; -} - -/* - Class: QtxResourceEditor::Group - Descr: Class for incapsulation of one group of preferences. -*/ - -//======================================================================= -//function : Group -//purpose : -//======================================================================= - -QtxResourceEditor::Group::Group( const QString& theName ) -: myName( theName ) -{ -} - -//======================================================================= -//function : ~Group -//purpose : -//======================================================================= - -QtxResourceEditor::Group::~Group() -{ -} - -//======================================================================= -//function : GetName -//purpose : -//======================================================================= - -QString QtxResourceEditor::Group::GetName() const -{ - return myName; -} - -//======================================================================= -//function : SetName -//purpose : -//======================================================================= - -void QtxResourceEditor::Group::SetName( const QString& name ) -{ - myName = name; -} - -//======================================================================= -//function : Add -//purpose : -//======================================================================= - -int QtxResourceEditor::Group::Add( const QString& sect, const QString& name, - const int type, const QString& label ) -{ - int id = -1; - Item* item = createItem( type, label ); - if ( item ) - { - item->Set( sect, name, type, label ); - myItems.append( item ); - id = item->GetId(); - } - return id; -} - -//======================================================================= -//function : IsExist -//purpose : -//======================================================================= - -bool QtxResourceEditor::Group::IsExist( const int id ) const -{ - bool res = false; - for ( QPtrListIterator it( myItems ); it.current() && !res; ++it ) - if ( it.current()->GetId() == id ) - res = true; - return res; -} - -//======================================================================= -//function : SetList -//purpose : -//======================================================================= - -void QtxResourceEditor::Group::SetList( const int id, const QValueList& ids, - const QStringList& names ) -{ - Item* item = getItem( id ); - if ( item ) - item->SetList( ids, names ); -} - -//======================================================================= -//function : SetRange -//purpose : -//======================================================================= - -void QtxResourceEditor::Group::SetRange( const int id, const double min, const double max, - const double prec, const double step ) -{ - Item* item = getItem( id ); - if ( item ) - item->SetRange( min, max, prec, step ); -} - -//======================================================================= -//function : SetColumns -//purpose : -//======================================================================= - -void QtxResourceEditor::Group::SetColumns( const int ) -{ -} - -//======================================================================= -//function : SetTitle -//purpose : -//======================================================================= - -void QtxResourceEditor::Group::SetTitle( const QString& ) -{ -} - -//======================================================================= -//function : Store -//purpose : -//======================================================================= - -void QtxResourceEditor::Group::Store() -{ - for ( QPtrListIterator it( myItems ); it.current(); ++it ) - it.current()->Store(); -} - -//======================================================================= -//function : Retrieve -//purpose : -//======================================================================= - -void QtxResourceEditor::Group::Retrieve() -{ - for ( QPtrListIterator it( myItems ); it.current(); ++it ) - it.current()->Retrieve(); -} - -//======================================================================= -//function : Update -//purpose : default implementation invoke update of all items -//======================================================================= - -void QtxResourceEditor::Group::Update() -{ - for ( QPtrListIterator it( myItems ); it.current(); ++it ) - it.current()->Update(); -} - -//======================================================================= -//function : getItem -//purpose : -//======================================================================= - -QtxResourceEditor::Item* QtxResourceEditor::Group::getItem( const int id ) const -{ - Item* anItem = 0; - for ( QPtrListIterator it( myItems ); it.current() && !anItem; ++it ) - if ( it.current()->GetId() == id ) - anItem = it.current(); - return anItem; -} - -/* - Class: QtxResourceEditor::Tab - Descr: Class for incapsulation of one tab of preferences. -*/ - -//======================================================================= -//function : Tab -//purpose : -//======================================================================= - -QtxResourceEditor::Tab::Tab( const QString& name ) -: myName( name ) -{ -} - -//======================================================================= -//function : ~Tab -//purpose : -//======================================================================= - -QtxResourceEditor::Tab::~Tab() -{ -} - -//======================================================================= -//function : Add -//purpose : -//======================================================================= - -int QtxResourceEditor::Tab::Add( const QString& group, const QString& sect, - const QString& name, const int type, const QString& label ) -{ - Group* aGroup = getGroup( group ); - if ( !aGroup ) - { - aGroup = createGroup( group ); - myGroups.append( aGroup ); - } - - if ( aGroup ) - return aGroup->Add( sect, name, type, label ); - else - return -1; -} - -//======================================================================= -//function : GetName -//purpose : -//======================================================================= - -QString QtxResourceEditor::Tab::GetName() const -{ - return myName; -} - -//======================================================================= -//function : SetList -//purpose : -//======================================================================= - -void QtxResourceEditor::Tab::SetList( const int id, const QValueList& ids, - const QStringList& names ) -{ - QString group; - if ( IsExist( id, group ) ) - { - Group* aGroup = getGroup( group ); - if ( aGroup ) - aGroup->SetList( id, ids, names ); - } -} - -//======================================================================= -//function : SetRange -//purpose : -//======================================================================= - -void QtxResourceEditor::Tab::SetRange( const int id, const double min, const double max, - const double prec, const double step ) -{ - QString group; - if ( IsExist( id, group ) ) - { - Group* aGroup = getGroup( group ); - if ( aGroup ) - aGroup->SetRange( id, min, max, prec, step ); - } -} - -//======================================================================= -//function : getGroup -//purpose : -//======================================================================= - -bool QtxResourceEditor::Tab::IsExist( const int id, QString& group ) const -{ - Group* aGroup = 0; - for ( QPtrListIterator it( myGroups ); it.current() && !aGroup; ++it ) - if ( it.current()->IsExist( id ) ) - aGroup = it.current(); - - if ( aGroup ) - group = aGroup->GetName(); - - return aGroup; -} - -//======================================================================= -//function : SetColumns -//purpose : -//======================================================================= - -void QtxResourceEditor::Tab::SetColumns( const QString& group, const int cols ) -{ - Group* aGroup = getGroup( group ); - if ( aGroup ) - aGroup->SetColumns( cols ); -} - -//======================================================================= -//function : SetTitle -//purpose : -//======================================================================= - -void QtxResourceEditor::Tab::SetTitle( const QString& ) -{ -} - -//======================================================================= -//function : SetTitle -//purpose : -//======================================================================= - -void QtxResourceEditor::Tab::SetTitle( const QString& title, const QString& group ) -{ - Group* aGroup = getGroup( group ); - if ( aGroup ) - aGroup->SetTitle( title ); -} - -//======================================================================= -//function : Store -//purpose : -//======================================================================= - -void QtxResourceEditor::Tab::Store() -{ - for ( QPtrListIterator it( myGroups ); it.current(); ++it ) - it.current()->Store(); -} - -//======================================================================= -//function : Retrieve -//purpose : -//======================================================================= - -void QtxResourceEditor::Tab::Retrieve() -{ - for ( QPtrListIterator it( myGroups ); it.current(); ++it ) - it.current()->Retrieve(); -} - -//======================================================================= -//function : Update -//purpose : default implementation invoke update of all groups -//======================================================================= - -void QtxResourceEditor::Tab::Update() -{ - for ( QPtrListIterator it( myGroups ); it.current(); ++it ) - it.current()->Update(); -} - -//======================================================================= -//function : getGroup -//purpose : -//======================================================================= - -QtxResourceEditor::Group* QtxResourceEditor::Tab::getGroup( const QString& name ) const -{ - Group* aGroup = 0; - for ( QPtrListIterator it( myGroups ); it.current() && !aGroup; ++it ) - if ( it.current()->GetName() == name ) - aGroup = it.current(); - return aGroup; -} - -/* - Class: QtxResourceEditor::Category - Descr: Class for incapsulation of one tab widget of preferences. -*/ - -//======================================================================= -//function : Category -//purpose : -//======================================================================= - -QtxResourceEditor::Category::Category( const QString& name ) -: myName( name ) -{ -} - -//======================================================================= -//function : ~Category -//purpose : -//======================================================================= - -QtxResourceEditor::Category::~Category() -{ -} - -//======================================================================= -//function : Add -//purpose : -//======================================================================= - -int QtxResourceEditor::Category::Add( const QString& tab, const QString& group, - const QString& sect, const QString& name, - const int type, const QString& label ) -{ - Tab* aTab = getTab( tab ); - if ( !aTab ) - { - aTab = createTab( tab ); - myTabs.append( aTab ); - } - - if ( aTab ) - return aTab->Add( group, sect, name, type, label ); - else - return -1; -} - -//======================================================================= -//function : GetName -//purpose : -//======================================================================= - -QString QtxResourceEditor::Category::GetName() const -{ - return myName; -} - -//======================================================================= -//function : SetList -//purpose : -//======================================================================= - -void QtxResourceEditor::Category::SetList( const int id, const QValueList& ids, - const QStringList& names ) -{ - QString tab, group; - if ( IsExist( id, tab, group ) ) - { - Tab* aTab = getTab( tab ); - if ( aTab ) - aTab->SetList( id, ids, names ); - } -} - -//======================================================================= -//function : SetRange -//purpose : -//======================================================================= - -void QtxResourceEditor::Category::SetRange( const int id, const double min, const double max, - const double prec, const double step ) -{ - QString tab, group; - if ( IsExist( id, tab, group ) ) - { - Tab* aTab = getTab( tab ); - if ( aTab ) - aTab->SetRange( id, min, max, prec, step ); - } -} - -//======================================================================= -//function : getGroup -//purpose : -//======================================================================= - -bool QtxResourceEditor::Category::IsExist( const int id, QString& tab, QString& group ) const -{ - Tab* aTab = 0; - for ( QPtrListIterator it( myTabs ); it.current() && !aTab; ++it ) - if ( it.current()->IsExist( id, group ) ) - aTab = it.current(); - - if ( aTab ) - tab = aTab->GetName(); - - return aTab; -} - -//======================================================================= -//function : SetColumns -//purpose : -//======================================================================= - -void QtxResourceEditor::Category::SetColumns( const QString& tab, const QString& group, const int cols ) -{ - Tab* aTab = getTab( tab ); - if ( aTab ) - aTab->SetColumns( group, cols ); -} - -//======================================================================= -//function : SetTitle -//purpose : -//======================================================================= - -void QtxResourceEditor::Category::SetTitle( const QString& ) -{ -} - -//======================================================================= -//function : SetTitle -//purpose : -//======================================================================= - -void QtxResourceEditor::Category::SetTitle( const QString& title, const QString& tab ) -{ - Tab* aTab = getTab( tab ); - if ( aTab ) - aTab->SetTitle( title ); -} - -//======================================================================= -//function : SetTitle -//purpose : -//======================================================================= - -void QtxResourceEditor::Category::SetTitle( const QString& title, const QString& tab, const QString& group ) -{ - Tab* aTab = getTab( tab ); - if ( aTab ) - aTab->SetTitle( title, group ); -} - -//======================================================================= -//function : Store -//purpose : -//======================================================================= - -void QtxResourceEditor::Category::Store() -{ - for ( QPtrListIterator it( myTabs ); it.current(); ++it ) - it.current()->Store(); -} - -//======================================================================= -//function : Retrieve -//purpose : -//======================================================================= - -void QtxResourceEditor::Category::Retrieve() -{ - for ( QPtrListIterator it( myTabs ); it.current(); ++it ) - it.current()->Retrieve(); -} - -//======================================================================= -//function : Update -//purpose : default implementation invoke update of all groups -//======================================================================= - -void QtxResourceEditor::Category::Update() -{ - for ( QPtrListIterator it( myTabs ); it.current(); ++it ) - it.current()->Update(); -} - -//======================================================================= -//function : getTab -//purpose : -//======================================================================= - -QtxResourceEditor::Tab* QtxResourceEditor::Category::getTab( const QString& name ) const -{ - Tab* aTab = 0; - for ( QPtrListIterator it( myTabs ); it.current() && !aTab; ++it ) - if ( it.current()->GetName() == name ) - aTab = it.current(); - return aTab; -} - -/* - Class: QtxResourceEditor - Descr: Class for managing preferences items, also container of tabs -*/ - -//======================================================================= -//function : QtxResourceEditor -//purpose : -//======================================================================= - -QtxResourceEditor::QtxResourceEditor( QtxResourceMgr* mgr ) -: myResMgr( mgr ) -{ -} - -//======================================================================= -//function : ~QtxResourceEditor -//purpose : -//======================================================================= - -QtxResourceEditor::~QtxResourceEditor() -{ -} - -//======================================================================= -//function : GenerateId -//purpose : -//======================================================================= - -int QtxResourceEditor::GenerateId() -{ - static int id = 1; - return id++; -} - -//======================================================================= -//function : Add -//purpose : -//======================================================================= - -int QtxResourceEditor::Add( const QString& cat, const QString& tab, - const QString& group, const QString& sect, - const QString& name, const int type, const QString& label ) -{ - Category* aCat = getCategory( cat ); - if ( !aCat ) - { - aCat = createCategory( cat ); - myCategories.append( aCat ); - } - return aCat->Add( tab, group, sect, name, type, label ); -} - -//======================================================================= -//function : IsExist -//purpose : -//======================================================================= - -bool QtxResourceEditor::IsExist( const int id, QString& cat, - QString& tab, QString& group ) const -{ - Category* aCat = 0; - for ( QPtrListIterator it( myCategories ); it.current() && !aCat; ++it ) - if ( it.current()->IsExist( id, tab, group ) ) - aCat = it.current(); - - if ( aCat ) - cat = aCat->GetName(); - - return aCat; -} - -//======================================================================= -//function : SetList -//purpose : -//======================================================================= - -void QtxResourceEditor::SetList( const int id, const QValueList& ids, const QStringList& names ) -{ - QString cat, tab, group; - if ( IsExist( id, cat, tab, group ) ) - { - Category* aCat = getCategory( cat ); - if ( aCat ) - aCat->SetList( id, ids, names ); - } -} - -//======================================================================= -//function : SetRange -//purpose : -//======================================================================= - -void QtxResourceEditor::SetRange( const int id, const double min, const double max, - const double prec, const double step ) -{ - QString cat, tab, group; - if ( IsExist( id, cat, tab, group ) ) - { - Category* aCat = getCategory( cat ); - if ( aCat ) - aCat->SetRange( id, min, max, prec, step ); - } -} - -//======================================================================= -//function : SetColumns -//purpose : -//======================================================================= - -void QtxResourceEditor::SetColumns( const QString& cat, const QString& tab, - const QString& group, const int cols ) -{ - Category* aCat = getCategory( cat ); - if ( aCat ) - aCat->SetColumns( tab, group, cols ); -} - -//======================================================================= -//function : SetTitle -//purpose : -//======================================================================= - -void QtxResourceEditor::SetTitle( const QString& title, const QString& cat ) -{ - Category* aCat = getCategory( cat ); - if ( aCat ) - aCat->SetTitle( title ); -} - -//======================================================================= -//function : SetTitle -//purpose : -//======================================================================= - -void QtxResourceEditor::SetTitle( const QString& title, const QString& cat, const QString& tab ) -{ - Category* aCat = getCategory( cat ); - if ( aCat ) - aCat->SetTitle( title, tab ); -} - -//======================================================================= -//function : SetTitle -//purpose : -//======================================================================= - -void QtxResourceEditor::SetTitle( const QString& title, const QString& cat, - const QString& tab, const QString& group ) -{ - Category* aCat = getCategory( cat ); - if ( aCat ) - aCat->SetTitle( title, tab, group ); -} - -//======================================================================= -//function : Store -//purpose : -//======================================================================= - -void QtxResourceEditor::Store() -{ - for ( QPtrListIterator it( myCategories ); it.current(); ++it ) - it.current()->Store(); - - //for ( QPtrListIterator pmIt( myPrefMgrs ); pmIt.current(); ++pmIt ) - // pmIt.current()->UpdatePreferences(); -} - -//======================================================================= -//function : Retrieve -//purpose : -//======================================================================= - -void QtxResourceEditor::Retrieve() -{ - for ( QPtrListIterator it( myCategories ); it.current(); ++it ) - it.current()->Retrieve(); -} - -//======================================================================= -//function : Update -//purpose : invoke update of all tabs -//======================================================================= - -void QtxResourceEditor::Update() -{ - for ( QPtrListIterator it( myCategories ); it.current(); ++it ) - it.current()->Update(); -} - -//======================================================================= -//function : getCategory -//purpose : -//======================================================================= - -QtxResourceEditor::Category* QtxResourceEditor::getCategory( const QString& name ) const -{ - Category* aCat = 0; - for ( QPtrListIterator it( myCategories ); it.current() && !aCat; ++it ) - if ( it.current()->GetName() == name ) - aCat = it.current(); - return aCat; -} - -//======================================================================= -//function : categories -//purpose : -//======================================================================= - -const QtxResourceEditor::CategoryList& QtxResourceEditor::categories() const -{ - return myCategories; -} - -//======================================================================= -//function : categories -//purpose : -//======================================================================= - -QtxResourceMgr* QtxResourceEditor::resMgr() const -{ - return myResMgr; -} \ No newline at end of file diff --git a/src/Qtx/QtxResourceEditor.h b/src/Qtx/QtxResourceEditor.h deleted file mode 100755 index cd7434557..000000000 --- a/src/Qtx/QtxResourceEditor.h +++ /dev/null @@ -1,244 +0,0 @@ -// File: QtxResourceEditor.h -// Created: -// Author: Sergey TELKOV -// Copyright: - -#ifndef QTXPREFERENCESEDITOR_H -#define QTXPREFERENCESEDITOR_H - -#ifdef WIN32 -#pragma warning( disable:4251 ) -#endif - - -#include "Qtx.h" -#include "QtxResourceMgr.h" - - -class QString; - -#include -#include - -/* - Class: QtxResourceEditor - Descr: -*/ - -class QTX_EXPORT QtxResourceEditor -{ -public: - - class Tab; - class Item; - class Group; - class Category; - - enum { Space, Bool, Color, String, List, RealSpin, IntegerSpin, RealEdit, IntegerEdit }; - -public: - QtxResourceEditor( QtxResourceMgr* ); - virtual ~QtxResourceEditor(); - - int Add( const QString&, const QString&, const QString&, - const QString&, const QString&, const int, const QString& ); - - void SetList( const int, const QValueList&, const QStringList& ); - void SetRange( const int, const double, const double, const double = 3, const double = -1 ); - bool IsExist( const int, QString&, QString&, QString& ) const; - - void SetColumns( const QString&, const QString&, const QString&, const int ); - - void SetTitle( const QString&, const QString& ); - void SetTitle( const QString&, const QString&, const QString& ); - void SetTitle( const QString&, const QString&, const QString&, const QString& ); - - void Store(); - void Retrieve(); - - static int GenerateId(); - - virtual void Update(); - - QtxResourceMgr* resMgr() const; - -protected: - typedef QPtrList CategoryList; - -protected: - virtual Category* createCategory( const QString& ) = 0; - Category* getCategory( const QString& ) const; - const CategoryList& categories() const; - - //typedef QPtrList ResMgrList; - -private: - QtxResourceMgr* myResMgr; - CategoryList myCategories; -}; - -/* - Class: QtxResourceEditor::Item - Descr: Class for incapsulation of one preference item -*/ - -class QtxResourceEditor::Item -{ -public: - Item( QtxResourceEditor* ); - virtual ~Item(); - - QString Get( QString&, int&, QString& ) const; - virtual void Set( const QString&, const QString&, const int, const QString& ); - virtual void Update(); - - int GetId() const; - int GetType() const; - - virtual void SetList( const QValueList&, const QStringList& ); - virtual void SetRange( const double, const double, const double = 3, const double = -1 ); - - virtual void Store() = 0; - virtual void Retrieve() = 0; - - bool GetInteger( const QString&, const QString&, int& ) const; - bool GetBoolean( const QString&, const QString&, bool& ) const; - bool GetDouble( const QString&, const QString&, double& ) const; - bool GetString( const QString&, const QString&, QString& ) const; - bool GetColor( const QString&, const QString&, QColor& ) const; - void SetInteger( const QString&, const QString&, const int ); - void SetBoolean( const QString&, const QString&, const bool ); - void SetDouble( const QString&, const QString&, const double ); - void SetString( const QString&, const QString&, const QString& ); - void SetColor( const QString&, const QString&, const QColor& ); - -private: - QtxResourceMgr* resMgr() const; - -private: - int myId, myType; - QString myName, myLabel, mySection; - QtxResourceEditor* myEditor; -}; - -/* - Class: QtxResourceEditor::Group - Descr: Class for incapsulation of one group of preferences (container of items) -*/ - -class QtxResourceEditor::Group -{ -public: - Group( const QString& ); - virtual ~Group(); - - QString GetName() const; - virtual void SetName( const QString& ); - - virtual void SetColumns( const int ); - virtual void SetTitle( const QString& ); - virtual void Update(); - - int Add( const QString&, const QString&, const int, const QString& ); - - void SetList( const int, const QValueList&, const QStringList& ); - void SetRange( const int, const double, const double, const double = 3, const double = -1 ); - - bool IsExist( const int ) const; - - void Store(); - void Retrieve(); - -protected: - virtual Item* createItem( const int, const QString& = QString::null ) = 0; - Item* getItem( const int ) const; - -private: - QString myName; - QPtrList myItems; -}; - -/* - Class: QtxResourceEditor::Tab - Descr: Class for incapsulation of one set of preferences (container of groups) -*/ - -class QtxResourceEditor::Tab -{ -public: - Tab( const QString& ); - virtual ~Tab(); - - QString GetName() const; - int Add( const QString&, const QString&, - const QString&, const int, const QString& ); - - virtual void SetTitle( const QString& ); - void SetTitle( const QString&, const QString& ); - - void SetColumns( const QString&, const int ); - - void SetList( const int, const QValueList&, const QStringList& ); - void SetRange( const int, const double, const double, const double = 3, const double = -1 ); - - bool IsExist( const int, QString& ) const; - - void Store(); - void Retrieve(); - - virtual void Update(); - -protected: - virtual Group* createGroup( const QString& ) = 0; - Group* getGroup( const QString& ) const; - -private: - QString myName; - QPtrList myGroups; -}; - -/* - Class: QtxResourceEditor::Category - Descr: Class for incapsulation of one set of tabs -*/ - -class QtxResourceEditor::Category -{ -public: - Category( const QString& ); - virtual ~Category(); - - QString GetName() const; - int Add( const QString&, const QString&, const QString&, - const QString&, const int, const QString& ); - - virtual void SetTitle( const QString& ); - void SetTitle( const QString&, const QString& ); - void SetTitle( const QString&, const QString&, const QString& ); - - void SetColumns( const QString&, const QString&, const int ); - - void SetList( const int, const QValueList&, const QStringList& ); - void SetRange( const int, const double, const double, const double = 3, const double = -1 ); - - bool IsExist( const int, QString&, QString& ) const; - - void Store(); - void Retrieve(); - - virtual void Update(); - -protected: - virtual Tab* createTab( const QString& ) = 0; - Tab* getTab( const QString& ) const; - -private: - QString myName; - QPtrList myTabs; -}; - -#ifdef WNT -#pragma warning( default:4251 ) -#endif - -#endif -- 2.39.2