pref->addPreference( tr( "" ), dirGroup,
LightApp_Preferences::DirList, "FileDlg", "QuickDirList" );
+ pref->setItemProperty( "columns", 2, supervGroup );
pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), supervGroup,
LightApp_Preferences::Color, "SUPERVGraph", "Background" );
pref->addPreference( tr( "PREF_SUPERV_TITLE_COLOR" ), supervGroup,
int obTab = pref->addPreference( tr( "PREF_TAB_OBJBROWSER" ), salomeCat );
int objSetGroup = pref->addPreference( tr( "PREF_OBJ_BROWSER_SETTINGS" ), obTab );
+ pref->setItemProperty( "columns", 2, objSetGroup );
pref->addPreference( tr( "PREF_AUTO_SIZE_FIRST" ), objSetGroup, LightApp_Preferences::Bool,
"ObjectBrowser", "auto_size_first" );
pref->addPreference( tr( "PREF_AUTO_SIZE" ), objSetGroup, LightApp_Preferences::Bool,
QtxResourceMgr* aResMgr = pref->resourceMgr();
aSModel->initFromResource( aResMgr );
- QList<int> aGrpLst = aSModel->getGroups();
- QList<int>::iterator anIt = aGrpLst.begin(), anEnd = aGrpLst.end();
- QList<int> aPropLst;
- QList<int>::iterator aPropIt, aPropEnd;
+ QList<int> aTabLst = aSModel->getTabs();
+ QList<int>::iterator aTabIt = aTabLst.begin(), aTabEnd = aTabLst.end();
+ QList<int> aGrpLst, aPropLst;
+ QList<int>::iterator anIt, anEnd, aPropIt, aPropEnd;
int aGrpId, aPropId, aPrefId;
- for( ; anIt != anEnd; ++anIt ) {
- aGrpId = *anIt;
- int themaGroup = pref->addPreference( aSModel->getGroupTitle( aGrpId ), themaTab );
- pref->setItemProperty( "columns", aSModel->getGroupNbColumns( aGrpId ), themaGroup );
- aPropLst = aSModel->getGroupProps( aGrpId );
- for( aPropIt = aPropLst.begin(), aPropEnd = aPropLst.end(); aPropIt != aPropEnd; ++aPropIt ) {
- aPropId = *aPropIt;
- Style_Model::PropType aType = aSModel->getPropType( aPropId );
- LightApp_Preferences::PrefItemType aPType = LightApp_Preferences::Auto;
- switch( aType ) {
- case Style_Model::Bool: aPType = LightApp_Preferences::Bool; break;
- case Style_Model::Color: aPType = LightApp_Preferences::Color; break;
- case Style_Model::String: aPType = LightApp_Preferences::String; break;
- case Style_Model::IntSpin: aPType = LightApp_Preferences::IntSpin; break;
- case Style_Model::DblSpin: aPType = LightApp_Preferences::DblSpin; break;
- case Style_Model::Selector: aPType = LightApp_Preferences::Selector; break;
- case Style_Model::Font: aPType = LightApp_Preferences::Font; break;
- default: break;
- }
- aPrefId = pref->addPreference( aSModel->getPropTitle( aPropId ), themaGroup,
- aPType, aSection, aSModel->getPropName( aPropId ) );
- aSModel->getValueTo( aResMgr, aPropId, true );//set default values into resource
- if ( aPType == LightApp_Preferences::Selector ) {
- QStringList lst;
- QList<QVariant> ids;
- aSModel->getSelector( aPropId, lst, ids );
- pref->setItemProperty( "strings", lst, aPrefId );
- pref->setItemProperty( "indexes", ids, aPrefId );
+ int themaSubTab = pref->addPreference( "ThemeTabs", themaTab,
+ SUIT_PreferenceMgr::Tab );
+ for ( ; aTabIt != aTabEnd; ++aTabIt ) {
+ QList<int> aGrpLst = aSModel->getGroups( *aTabIt );
+ int themaSubSubTab = pref->addPreference( aSModel->getTabTitle( *aTabIt ), themaSubTab,
+ SUIT_PreferenceMgr::Frame );
+ for( anIt = aGrpLst.begin(), anEnd = aGrpLst.end(); anIt != anEnd; ++anIt ) {
+ aGrpId = *anIt;
+ int themaGroup = pref->addPreference( aSModel->getGroupTitle( aGrpId ), themaSubSubTab, SUIT_PreferenceMgr::GroupBox );
+ pref->setItemProperty( "columns", aSModel->getGroupNbColumns( aGrpId ), themaGroup );
+ aPropLst = aSModel->getGroupProps( aGrpId );
+ for( aPropIt = aPropLst.begin(), aPropEnd = aPropLst.end(); aPropIt != aPropEnd; ++aPropIt ) {
+ aPropId = *aPropIt;
+ Style_Model::PropType aType = aSModel->getPropType( aPropId );
+ LightApp_Preferences::PrefItemType aPType = LightApp_Preferences::Auto;
+ switch( aType ) {
+ case Style_Model::Bool: aPType = LightApp_Preferences::Bool; break;
+ case Style_Model::Color: aPType = LightApp_Preferences::Color; break;
+ case Style_Model::String: aPType = LightApp_Preferences::String; break;
+ case Style_Model::IntSpin: aPType = LightApp_Preferences::IntSpin; break;
+ case Style_Model::DblSpin: aPType = LightApp_Preferences::DblSpin; break;
+ case Style_Model::Selector: aPType = LightApp_Preferences::Selector; break;
+ case Style_Model::Font: aPType = LightApp_Preferences::Font; break;
+ default: break;
+ }
+ aPrefId = pref->addPreference( aSModel->getPropTitle( aPropId ), themaGroup,
+ aPType, aSection, aSModel->getPropName( aPropId ) );
+ aSModel->getValueTo( aResMgr, aPropId, true );//set default values into resource
+ if ( aPType == LightApp_Preferences::Selector ) {
+ QStringList lst;
+ QList<QVariant> ids;
+ aSModel->getSelector( aPropId, lst, ids );
+ pref->setItemProperty( "strings", lst, aPrefId );
+ pref->setItemProperty( "indexes", ids, aPrefId );
+ }
}
}
}
fillValue( lines_clr, "lines-color", "Color", grp_lines, Color );
// grp_font group
- fillValue( font_value, "app-font", "App Font", grp_font, Font );
+ fillValue( font_value, "app-font", "Font", grp_font, Font );
// grp_values group
fillValue( all_antialized, "all-antialized", "All borders antialized", grp_value, Bool );
fillValue( auto_raising_wdg, "is-raising-widget", "Auto raising widget", grp_value, Bool );
fillValue( slider_rad, "slider-rad", "Rounding of slider", grp_value, DblSpin );
fillValue( hor_handle_delta, "hor-hadle-delta", "Hor spacinig of handle ", grp_value, DblSpin );
fillValue( ver_handle_delta, "ver-handle-delta", "Ver spacing of handle", grp_value, DblSpin );
- fillValue( split_handle_len, "split-handle-len", "Lenght of splitter handle", grp_value, DblSpin );
+ fillValue( split_handle_len, "split-handle-len", "Length of splitter handle", grp_value, DblSpin );
fillValue( dock_wdg_sep_extent, "dock-widget-sep-extent", "DockWidget separator extent", grp_value, DblSpin );
- fillGroup( grp_style, "Predefined style", 2 );
- fillGroup( grp_color, "Colors", 3 );
- fillGroup( grp_col_values, "ColorValues", 2 );
- fillGroup( grp_lines, "Lines", 3 );
- fillGroup( grp_font, "Application font", 1 );
- fillGroup( grp_value, "Values", 2 );
+ fillGroup( grp_style, tab_value, "Predefined style", 2 );
+ fillGroup( grp_color, tab_color, "Colors", 3 );
+ fillGroup( grp_col_values, tab_color, "ColorValues", 2 );
+ fillGroup( grp_lines, tab_value, "Lines", 3 );
+ fillGroup( grp_font, tab_value, "Font", 1 );
+ fillGroup( grp_value, tab_value, "Values", 2 );
+
+ myTabs[tab_color] = QString( "Colors" );
+ myTabs[tab_value] = QString( "Values" );
}
Style_Model::~Style_Model()
for ( ; anIt != anEnd; ++anIt )
setValueFrom( theResMgr, anIt.key() );
+ //setValue( is_defined_style, QVariant( false ) );
if ( getBoolValue( is_defined_style ) )
setPredefinedStyle( getIntValue( defined_style ) );
}
return aFont;
}
-QList<int> Style_Model::getGroups() const
+QList<int> Style_Model::getTabs() const
{
- return myGroups.keys();
+ return myTabs.keys();
+}
+
+QString Style_Model::getTabTitle( int theId ) const
+{
+ return myTabs.contains( theId ) ? myTabs[theId] : "";
+}
+
+QList<int> Style_Model::getGroups( int theId ) const
+{
+ QList<int> groups;
+ GroupMap::const_iterator anIt = myGroups.begin(), anEnd = myGroups.end();
+ for ( ; anIt != anEnd; ++anIt )
+ if ( anIt.value().myTabType == theId )
+ groups.append( anIt.key() );
+ return groups;
}
QString Style_Model::getGroupTitle( int theId ) const
if ( anIt.value().myGroupId == theId )
values.append( anIt.key() );
return values;
-
}
QString Style_Model::getPropTitle( int theId ) const
myValues[theId] = aValue;
}
-void Style_Model::fillGroup( Groups theId, const QString& theTitle, int theNbCols )
+void Style_Model::fillGroup( Groups theId, Tabs theTab, const QString& theTitle, int theNbCols )
{
GroupValue aValue;
+ aValue.myTabType = theTab;
aValue.myTitle = theTitle;
aValue.myNbColumns = theNbCols;
static QString sectionName();
+ typedef enum { tab_color, tab_value } Tabs;
typedef enum { grp_style, grp_color, grp_col_values, grp_lines, grp_font, grp_value } Groups;
-
+ typedef enum { None, Bool, Color, String, IntSpin, DblSpin, Selector, Font } PropType;
typedef enum { // grp_style
is_defined_style, defined_style,
// grp colors
hor_handle_delta, ver_handle_delta, split_handle_len,
dock_wdg_sep_extent } Properties;
- typedef enum { None, Bool, Color, String, IntSpin, DblSpin, Selector, Font } PropType;
-
void reset();
void setDefaults( QApplication* );
void initFromResource( QtxResourceMgr* );
QString getStringValue( int, const bool = false ) const;
QFont getFontValue( int, const bool = false ) const;
- QList<int> getGroups() const;
+ QList<int> getTabs() const;
+ QString getTabTitle( int ) const;
+ QList<int> getGroups( int ) const;
QString getGroupTitle( int ) const;
int getGroupNbColumns( int ) const;
QList<int> getGroupProps( int ) const;
void fillValue( Properties, const QString&, const QString&,
Groups, PropType = Color );
- void fillGroup( Groups, const QString&, int );
+ void fillGroup( Groups, Tabs, const QString&, int );
private:
typedef struct {
} StyleValue;
typedef struct {
+ Tabs myTabType;
QString myTitle;
int myNbColumns;
} GroupValue;
typedef QMap<int, StyleValue> ValuesMap;
- typedef QMap<int, GroupValue> StringMap;
- ValuesMap myValues;
- StringMap myGroups;
-
- QStringList myPStyles;
- QStringList myLines;
+ typedef QMap<int, GroupValue> GroupMap;
+ typedef QMap<int, QString> StringMap;
+ ValuesMap myValues;
+ GroupMap myGroups;
+ StringMap myTabs;
+
+ QStringList myPStyles;
+ QStringList myLines;
};
#endif // STYLE_MODEL_H