[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/office/skrooge/skgbasegui
From:       Stephane Mankowski <stephane () mankowski ! fr>
Date:       2010-05-22 7:58:00
Message-ID: 20100522075800.E3B92AC8BC () svn ! kde ! org
[Download RAW message or body]

SVN commit 1129392 by smankowski:

New feature: Stability of colors in graph
New feature: Selection of colors in graph (saved and restored)

 M  +21 -23    skgtablewithgraph.cpp  


--- trunk/extragear/office/skrooge/skgbasegui/skgtablewithgraph.cpp #1129391:1129392
@@ -79,6 +79,13 @@
 {
     ui.setupUi ( this );
 
+    ui.kDisplayMode->addItem ( KIcon ( "skg-chart-bar-stacked" ), i18nc ( "Noun, a \
type of graph, with bars stacked upon each other","Stack" ) ); +    \
ui.kDisplayMode->addItem ( KIcon ( "skg-chart-bar" ), i18nc ( "Noun, a type of graph, \
with bars placed besides each other","Histogram" ) ); +    ui.kDisplayMode->addItem ( \
KIcon ( "skg-chart-pie" ), i18nc ( "Noun, a type of graph that looks like a sliced \
pie","Pie" ) ); +    ui.kDisplayMode->addItem ( KIcon ( "skg-chart-ring" ), i18nc ( \
"Noun, a type of graph that looks like concentric slices of a pie (a la \
filelight)","Concentric pie" ) ); +    ui.kDisplayMode->addItem ( KIcon ( \
"skg-chart-scatter" ), i18nc ( "Noun, a type of graph with only points","Point" ) ); \
+    ui.kDisplayMode->addItem ( KIcon ( "skg-chart-line" ), i18nc ( "Noun, a type of \
graph with only lines","Line" ) ); +
     timer = new QTimer ( this );
     timer->setSingleShot ( true );
     connect ( timer, SIGNAL ( timeout() ), this, SLOT ( refresh() ) );
@@ -152,13 +159,6 @@
     }
     ui.kTable->verticalHeader()->setDefaultSectionSize ( \
ui.kTable->verticalHeader()->minimumSectionSize() );  
-    ui.kDisplayMode->addItem ( KIcon ( "skg-chart-bar-stacked" ), i18nc ( "Noun, a \
                type of graph, with bars stacked upon each other","Stack" ) );
-    ui.kDisplayMode->addItem ( KIcon ( "skg-chart-bar" ), i18nc ( "Noun, a type of \
                graph, with bars placed besides each other","Histogram" ) );
-    ui.kDisplayMode->addItem ( KIcon ( "skg-chart-pie" ), i18nc ( "Noun, a type of \
                graph that looks like a sliced pie","Pie" ) );
-    ui.kDisplayMode->addItem ( KIcon ( "skg-chart-ring" ), i18nc ( "Noun, a type of \
graph that looks like concentric slices of a pie (a la filelight)","Concentric pie" ) \
                );
-    ui.kDisplayMode->addItem ( KIcon ( "skg-chart-scatter" ), i18nc ( "Noun, a type \
                of graph with only points","Point" ) );
-    ui.kDisplayMode->addItem ( KIcon ( "skg-chart-line" ), i18nc ( "Noun, a type of \
                graph with only lines","Line" ) );
-
     connect ( ui.kDisplayMode, SIGNAL ( currentIndexChanged ( int ) ), this, SLOT ( \
                redrawGraphDelayed() ), Qt::QueuedConnection );
     connect ( ui.kAllPositive, SIGNAL ( stateChanged ( int ) ), this, SLOT ( \
                redrawGraphDelayed() ), Qt::QueuedConnection );
     connect ( ui.graphicView, SIGNAL ( resized() ), this, SLOT ( \
redrawGraphDelayed() ), Qt::QueuedConnection ); @@ -281,12 +281,13 @@
     root.setAttribute ( "limitVisible", limitVisible ? "Y" : "N" );
     root.setAttribute ( "linearRegressionVisible", linearRegressionVisible ? "Y" : \
"N" );  root.setAttribute ( "legendVisible", legendVisible ? "Y" : "N" );
-    QDomElement colors = doc.createElement ( "colors" );
-    root.appendChild ( colors );
     QMapIterator<QString, QColor> i(mapTitleColor);
     while (i.hasNext()) {
         i.next();
-        colors.setAttribute ( i.key(), i.value().name() );
+        QDomElement color = doc.createElement ( "color" );
+        root.appendChild ( color );
+        color.setAttribute ( "key", i.key() );
+        color.setAttribute ( "value", i.value().name() );
     }
 
     QHeaderView* horizontalHeader=ui.kTable->horizontalHeader();
@@ -305,6 +306,16 @@
     {
         QDomElement root = doc.documentElement();
 
+        mapTitleColor.clear();
+
+        QDomNodeList colors=root.elementsByTagName("color");
+        int nb=colors.count();
+        for (int i=0; i<nb; ++i)
+        {
+            QDomElement c=colors.at(i).toElement();
+            mapTitleColor[c.attribute("key")]=QColor(c.attribute("value"));
+        }
+
         QString splitterState=root.attribute ( "splitterState" );
         if ( !splitterState.isEmpty() ) ui.splitter->restoreState ( \
QByteArray::fromHex ( splitterState.toAscii() ) );  QString graphMode=root.attribute \
( "graphMode" ); @@ -343,19 +354,6 @@
             if ( actShowLinearRegression ) actShowLinearRegression->setChecked ( \
linearRegressionVisible );  }
 
-        mapTitleColor.clear();
-        QDomElement colors=root.firstChildElement ( "colors" );
-        if (!colors.isNull())
-        {
-            QDomNamedNodeMap colorsAttributes=colors.attributes ();
-            int nb=colorsAttributes.count();
-            for (int i=0; i<nb; ++i)
-            {
-                QDomNode c=colorsAttributes.item (i);
-                mapTitleColor[c.nodeName()]=QColor(c.nodeValue());
-            }
-        }
-
         QString sortOrder=root.attribute ( "sortOrder" );
         QString sortColumn=root.attribute ( "sortColumn" );
         if ( sortOrder.isEmpty() ) sortOrder='0';


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic