Salome HOME
Updated copyright comment
[modules/yacs.git] / src / salomegui / Yacsgui_Resource.cxx
index e9822d4e566369c891357955e21be4fd18fd2f8a..e8e6c78abf4e33437dca95572a01c9c1023327f4 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2006-2013  CEA/DEN, EDF R&D
+// Copyright (C) 2006-2024  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -50,11 +50,11 @@ bool Yacsgui_Resource::booleanValue(const QString& name, const bool def) const {
   return _resource->booleanValue(RESOURCE_YACS, name, def);
 }
 
-QFont Yacsgui_Resource::fontValue(const QString& name, const QFont def) const {
+QFont Yacsgui_Resource::fontValue(const QString& name, const QFont& def) const {
   return _resource->fontValue(RESOURCE_YACS, name, def);
 }
 
-QColor Yacsgui_Resource::colorValue(const QString& name, const QColor def) const {
+QColor Yacsgui_Resource::colorValue(const QString& name, const QColor& def) const {
   return _resource->colorValue(RESOURCE_YACS, name, def);
 }
 
@@ -69,7 +69,7 @@ QColor Yacsgui_Resource::colorValue(const QString& name, const int h, const int
   return colorValue(name, col);
 }
 
-QString Yacsgui_Resource::stringValue(const QString& name, const QString def) const {
+QString Yacsgui_Resource::stringValue(const QString& name, const QString& def) const {
   return _resource->stringValue(RESOURCE_YACS, name, def);
 }
 
@@ -88,15 +88,15 @@ void Yacsgui_Resource::setValue( const QString& name, const bool val ) {
     _resource->setValue(RESOURCE_YACS, name, val);
 }
 
-void Yacsgui_Resource::setValue( const QString& name, const QFont val ) {
+void Yacsgui_Resource::setValue( const QString& name, const QFont& val ) {
     _resource->setValue(RESOURCE_YACS, name, val);
 }
 
-void Yacsgui_Resource::setValue( const QString& name, const QColor val ) {
+void Yacsgui_Resource::setValue( const QString& name, const QColor& val ) {
     _resource->setValue(RESOURCE_YACS, name, val);
 }
 
-void Yacsgui_Resource::setValue( const QString& name, const QString val ) {
+void Yacsgui_Resource::setValue( const QString& name, const QString& val ) {
     _resource->setValue(RESOURCE_YACS, name, val);
 }
 
@@ -118,18 +118,26 @@ void Yacsgui_Resource::createPreferences(Yacsgui* swm)
   swm->addPreference( "Ensure Node Visible When Moved", presentationGroup, LightApp_Preferences::Bool, RESOURCE_YACS, "ensureVisibleWhenMoved" );
   swm->addPreference( "Tabified Panels Up", presentationGroup, LightApp_Preferences::Bool, RESOURCE_YACS, "tabPanelsUp" );
   int priority = swm->addPreference( "DockWidget priority", presentationGroup, LightApp_Preferences::Selector, RESOURCE_YACS, "dockWidgetPriority" );
+  swm->addPreference( "Progress bar color", presentationGroup, LightApp_Preferences::Color, RESOURCE_YACS, "progressBarColor" );
+  int progressLabel = swm->addPreference( "Progress bar label", presentationGroup, LightApp_Preferences::Selector, RESOURCE_YACS, "progressBarLabel" );
 
-  QStringList priorityList;
-  priorityList.append( "Horizontal" );
-  priorityList.append( "Vertical" );
-
+  QStringList stringsList;
+  stringsList.append( "Horizontal" );
+  stringsList.append( "Vertical" );
   QList<QVariant> indexesList;
   indexesList.append(0);
   indexesList.append(1);
-
-  swm->setPreferenceProperty( priority, "strings", priorityList );
+  swm->setPreferenceProperty( priority, "strings", stringsList );
   swm->setPreferenceProperty( priority, "indexes", indexesList );
 
+  stringsList.clear();
+  indexesList.clear();
+
+  stringsList << "Percentage: \"50%\"" << "Nb.steps: \"5/10\"" << "Both: \"50% (5/10)\"";
+  indexesList << 0 << 1 << 2;
+  swm->setPreferenceProperty( progressLabel, "strings", stringsList );
+  swm->setPreferenceProperty( progressLabel, "indexes", indexesList );
+
   int pythonGroup = swm->addPreference( "Python", genTab );
 
   swm->addPreference( "Python Script Font", pythonGroup, LightApp_Preferences::Font, RESOURCE_YACS, "font" );
@@ -286,6 +294,8 @@ void Yacsgui_Resource::preferencesChanged()
   Resource::ensureVisibleWhenMoved = booleanValue("ensureVisibleWhenMoved", ENSUREVISIBLEWHENMOVED);
   Resource::tabPanelsUp = booleanValue("tabPanelsUp", TABPANELSUP);
   Resource::dockWidgetPriority   = integerValue( "dockWidgetPriority" , DOCKWIDGETPRIORITY);
+  Resource::progressBarColor = colorValue("progressBarColor", PROGRESSBARCOLOR);
+  Resource::progressBarLabel = integerValue( "progressBarLabel" , PROGRESSBARLABEL);
 
   // Color of state of nodes
   Resource::editedNodeBrushColor = colorValue(_editedNodeBrushColor, EDITEDNODEBRUSHCOLOR);