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

List:       kde-commits
Subject:    koffice
From:       Thomas Zander <zander () kde ! org>
Date:       2010-05-26 22:32:27
Message-ID: 20100526223227.2F741AC8C0 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1130975 by zander:

Lift KoUnit::indexInList() API into the new century

 M  +2 -2      krita/ui/widgets/kis_custom_image_widget.cc  
 M  +3 -3      libs/odf/KoUnit.cpp  
 M  +9 -2      libs/odf/KoUnit.h  
 M  +1 -1      plugins/paragraphtool/Ruler.cpp  


--- trunk/koffice/krita/ui/widgets/kis_custom_image_widget.cc #1130974:1130975
@@ -111,12 +111,12 @@
 
 void KisCustomImageWidget::resolutionChanged(double res)
 {
-    if (m_widthUnit.indexInList(false) == KoUnit::Pixel) {
+    if (m_widthUnit.indexInList(KoUnit::ShowAll) == KoUnit::Pixel) {
         m_widthUnit = KoUnit(KoUnit::Pixel, res / 72.0);
         m_width = m_widthUnit.fromUserValue(doubleWidth->value());
     }
 
-    if (m_heightUnit.indexInList(false) == KoUnit::Pixel) {
+    if (m_heightUnit.indexInList(KoUnit::ShowAll) == KoUnit::Pixel) {
         m_heightUnit = KoUnit(KoUnit::Pixel, res / 72.0);
         m_height = m_heightUnit.fromUserValue(doubleHeight->value());
     }
--- trunk/koffice/libs/odf/KoUnit.cpp #1130974:1130975
@@ -37,14 +37,14 @@
     return lst;
 }
 
-
-uint KoUnit::indexInList(bool hidePixel) const
+int KoUnit::indexInList(PixelVisibility visibility) const
 {
-    if (hidePixel && m_unit > Pixel)
+    if (visibility == HidePixel && m_unit > Pixel)
         return m_unit -1;
     else
         return m_unit;
 }
+
 QString KoUnit::unitDescription(KoUnit _unit)
 {
     switch (_unit.m_unit) {
--- trunk/koffice/libs/odf/KoUnit.h #1130974:1130975
@@ -1,6 +1,8 @@
 /* This file is part of the KDE project
-   Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>, Torben Weis <weis@kde.org>
+   Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
+   Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
    Copyright (C) 2004, Nicolas GOUTTE <goutte@kde.org>
+   Copyright (C) 2010 Thomas Zander <zander@kde.org>
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
@@ -183,9 +185,14 @@
     static QString unitDescription(KoUnit unit);
     static QStringList listOfUnitName(bool hidePixel = true);
 
+    /// PixelVisibility for indexInList()
+    enum PixelVisibility {
+        ShowAll,
+        HidePixel
+    };
     /// Get the index of this unit in the list of names
     /// @param hidePixel count as if the Pixel unit hadn't been shown in the list
-    uint indexInList(bool hidePixel = true) const;
+    int indexInList(PixelVisibility visibility = HidePixel) const;
 
     /// parse common %KOffice and Odf values, like "10cm", "5mm" to pt
     static qreal parseValue(const QString &value, qreal defaultVal = 0.0);
--- trunk/koffice/plugins/paragraphtool/Ruler.cpp #1130974:1130975
@@ -43,7 +43,7 @@
     m_unit = unit;
 
     // approximately 15 points seems to be a good value for the step size
-    switch (m_unit.indexInList(false)) {
+    switch (m_unit.indexInList(KoUnit::ShowAll)) {
     case KoUnit::Millimeter:
         setStepValue(14.17325288515625502486); // 5.0 mm
         break;
[prev in list] [next in list] [prev in thread] [next in thread] 

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