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

List:       kde-commits
Subject:    kdeutils/kcalc
From:       Klaus Niederkrüger <kniederk () mi ! uni-koeln ! de>
Date:       2004-12-19 13:07:01
Message-ID: 20041219130701.A348F1BB36 () office ! kde ! org
[Download RAW message or body]

CVS commit by kniederk: 

Finished scientific constants


  M +4 -0      ChangeLog   1.73
  M +17 -2     kcalc.cpp   1.188
  M +1 -0      kcalc.h   1.95
  M +10 -4     kcalc_const_menu.cpp   1.3


--- kdeutils/kcalc/ChangeLog  #1.72:1.73
@@ -1,3 +1,7 @@
 2004-12-17 Klaus Niederkrüger <kniederk@math.uni-koeln.de>
+        * almost finished feature which allows to choose from list
+          of scientific constants
+
+2004-12-17 Klaus Niederkrüger <kniederk@math.uni-koeln.de>
         * started implementation of a list of scientific constants
 

--- kdeutils/kcalc/kcalc_const_menu.cpp  #1.2:1.3
@@ -24,10 +24,16 @@
 #include "kcalc_const_menu.h"
 
-#define NUM_CONST 3
+#define NUM_CONST 9
 
 const struct science_constant KCalcConstMenu::Constants[] = {
-  {"Pi", i18n("Pi"), "", "3.14", Mathematics},
-  {"e", i18n("Euler number"), "", "2.71", Mathematics},
-  {"c", i18n("Light speed"), "", "3e8", Physics}
+  {QString::fromUtf8("Ï€"), i18n("Pi"), "", "3.14159265358979323846264338327950288", \
Mathematics}, +  {"e", i18n("Euler number"), "", \
"2.71828182845904523536028747135266249", Mathematics}, +  {"c", i18n("Light speed"), \
"", "2.99792458e8", Physics}, +  {"h", i18n("Planck's constant"), "", \
"6.6260693e-34", Physics}, +  {"G", i18n("Constant of gravitation"), "", \
"6.6742e-11", Physics}, +  {"e", i18n("Elementary charge"), "", "1.60217653e-19", \
Physics}, +  {"µ0", i18n("Permeability of vacuum"), "", "1.2566370614e-6", Physics},
+  {QString::fromUtf8("\0x3B5"), i18n("Permittivity of vacuum"), "", \
"8.854187817e-12", Physics}, +  {"NA", i18n("Avogadro's number"), "", "6.0221415e23", \
Chemistry}  };
 

--- kdeutils/kcalc/kcalc.cpp  #1.187:1.188
@@ -55,4 +55,5 @@
 #include <kglobalsettings.h>
 #include <kkeydialog.h>
+#include <kmenubar.h>
 #include <knotifyclient.h>
 #include <knumvalidator.h>
@@ -1006,4 +1007,17 @@ void KCalculator::setupConstantsKeys(QWi
 
         changeButtonNames();
+
+        // add menu with scientific constants
+        KCalcConstMenu *tmp_menu = new KCalcConstMenu(this);
+        menuBar()->insertItem(i18n("&Constants"), tmp_menu);
+        connect(tmp_menu, SIGNAL(activated(int)), this,
+                SLOT(slotConstantToDisplay(int)));
+}
+
+void KCalculator::slotConstantToDisplay(int constant)
+{
+        calc_display->setAmount(KCalcConstMenu::Constants[constant].value);
+
+        UpdateDisplay(false);
 }
 
@@ -2018,6 +2032,7 @@ void KCalculator::slotConstantsShow(bool
 }
 
-// This function is for setting the constant names configured in the kcalc settings \
                menue. If the user doesn't
-// enter a name for the constant C1 to C6 is used.
+// This function is for setting the constant names configured in the
+// kcalc settings menu. If the user doesn't enter a name for the
+// constant C1 to C6 is used.
 void KCalculator::changeButtonNames()
 {

--- kdeutils/kcalc/kcalc.h  #1.94:1.95
@@ -151,4 +151,5 @@ protected slots:
     void slotConstclicked(int);
 
+    void slotConstantToDisplay(int constant);
     void slotChooseScientificConst0(int option);
     void slotChooseScientificConst1(int option);


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

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