Bug 112933 - JJ: replace double spinboxes in koffice applications with the KoUnitDoubleSpinBox
Summary: JJ: replace double spinboxes in koffice applications with the KoUnitDoubleSpi...
Status: RESOLVED FIXED
Alias: None
Product: koffice
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: KOffice Bug Wranglers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-20 10:50 UTC by Thomas Zander
Modified: 2005-11-18 00:18 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patches for bug 112933 (150.00 KB, application/x-tar)
2005-11-07 23:55 UTC, maju
Details
Kpreseneter files (trunk) (30.00 KB, patch)
2005-11-15 22:34 UTC, maju
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Zander 2005-09-20 10:50:39 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources

In various places in koffice we use a double spinbox and a label in front shows the currently used units (inch/cm/etc).

We need to replace all those with a KoUnitDoubleSpinBox instance instead.
so;
- change header file to make the member a KoUnitDoubleSpinBox  instead of a KDoubleNumInput.
- change the creation to be like this:
foo = new KoUnitDoubleSpinBox( indentFrame, 0, 9999, 1, 0.0, m_unit );
- remove the unit label so, for example:
 lLeft = new QLabel( i18n("&Left (%1):").arg(unitName), indentFrame );
becomes:
 lLeft = new QLabel( i18n("&Left:"), indentFrame );

thats it.
Comment 1 maju 2005-10-26 17:46:40 UTC
Hi!

I started doing it.
I look through the sources and there are some FIXME comments, but I
guess I have to grep for something like:
"KoUnit::unitName"
and 
"(%1):"

Is there any better way to find all accurances to change?
Comment 2 Thomas Zander 2005-10-26 18:07:46 UTC
I'd say that searching for KDoubleNumInput is a good way to do so, the other is to look at the dialogs while running the applications.
Comment 3 maju 2005-10-26 19:28:59 UTC
I'll look for KDoubleNumInput, but I don't think looking for all the dialogs while  running KOffice is a good idea. I just simply cannot go to every dialog in all the applications (but of course I'll test changes when running them applictions).
Anyway, I'll try to get all of them done.
Comment 4 maju 2005-10-28 19:27:10 UTC
There's a problem/decision to make:
KoUnitDoubleSpinBox's constructor takes values in points and KDoubleNumInput's setRange takes values which are unit independent so:

   eLeft = new KoUnitDoubleSpinBox( indentFrame, 0, 9999, 1, 0.0, m_unit );<-here we set the stepping to one pt
doesn't mean the same
   eLeft->setRange( 0, 9999, 1, false);<-here we set the stepping to one not dependantly on units
It's not a big deal, but what should I do:
a) leave the call to setRange (or call the constructor using fromUserValue(1)) every time I change from one class to the other
b) delete call to setRange? In this case the functionality will change a bit.

And the other thing:
Not only creation and labe has to change:

 double KoIndentSpacingWidget::leftIndent() const
 {
-    return QMAX(0,KoUnit::fromUserValue( eLeft->value(), m_unit )); 
+    return QMAX(0, eLeft->value() ); 
 }

Calls to setValue can stay but it's better to change it to changeValue
-    eWidth->setValue( KoUnit::toUserValue( selectedTab->ptWidth, m_unit ) ); 
+    eWidth->changeValue( selectedTab->ptWidth ); 
Comment 5 Thomas Zander 2005-10-28 20:00:05 UTC
Hi,
The range tends to be done for visual purposes. The 9999 means 4 digits will be used, so thats OK if it stays the way it is.
Only when some other value than 0 or a number of nines is used should it be converted.

The two other changes you mention are good ones.

Thanks for looking into this!
Comment 6 maju 2005-11-07 23:55:55 UTC
Created attachment 13326 [details]
Patches for bug 112933

I grepped for:
KDoubleNumInput
KDoubleSpinBox
unitName
and I run through the applications.

FILES MODIFIED:
*lib/kotext/koParagDia.cc/h - kword new file->Ctrl+Alt+P (or right
click->Paragraph...)
*kpresenter/kpresenter_dlg_config.cc/h - kpresenter->menu Settings->configure
KPresenter
*kpresenter/kprhelplinedia.cc/h - kpresenter->right mouse->Add new help Line,
Add new help point; rigth click on help line/help point; don't forget to enable
help lines (right click on the document->Help lines)
*kpresenter/kprduplicateobjdia.cc/h - kpresenter->Select
object->Edit->Duplicate object
*kword/kwconfig.cc
*kpresenter/generalpropertyui.ui + kpresenter/generalproperty.cc/h - Click on
any object in KPresenter->right click->properties->general
*kpresenter/marginui.ui + kpresenter/kpmarginwidget.cc/h - Click on a text
object in KPresenter->right click->properties->text
*lib/kotext/koFontDia.h/cc - kword->right click->Font...
*kspread/dialogs/kspread_dlg_layout.h/cc ->right click on the cell->Cell
Format...
*lib/kofficeui/koPageLayoutDia.h/cc->kword->Format menu->Page layout
*kspread/dialogs/kspread_dlg_resize2.cc/h ->kspread->select row/column->right
click->resize..
*karbon/tools/vellipsetool.cc/h - karbon->toolbar->ellpise->click on the
document
*karbon/tools/vsinustool.cc/h - karbon->toolbar->sinus->click on the document
*karbon/tools/vrectangletool.cc/h - karbon->toolbar->recangle->click on the
document
*karbon/tools/vroundrecttool.cc/h - karbon->toolbar->roundrect->click on the
document
*karbon/tools/vpolygontool.cc/h - karbon->toolbar->polygon->click on the
document
*karbon/tools/vstartool.cc/h - karbon->toolbar->star->click on the document
*karbon/tools/vspiraltool.cc/h - karbon->toolbar->spiral->click on the document

*lib/kofficeui/koUnitWidgets.h/cc

All changes were verified by running the applications and checking if they
behave the same way as before the changes

I added new constructor and a function to KoUnitDoubleSpinBox class

Tymoteusz Majewski, maju7@o2.pl
Comment 7 Inge Wallin 2005-11-08 14:53:21 UTC
Hi Tymoteusz and thanks for the patch.  I will look it and apply it during this week.  (I am at work right now)
Comment 8 Inge Wallin 2005-11-10 22:35:03 UTC
SVN commit 479546 by ingwa:

Apply the lion share of a patch from Tymoteusz Majewski that fixes
most of Bug 112933: JJ: replace double spinboxes in koffice
applications with the KoUnitDoubleSpinBox

The part of the patch that is about KPresenter couldn't be applied
because the file kpresenter/generalpropertyui.ui was changed since the
patch was made, and I just couldn't sort it out.  Sorry.

CCBUG: 112933



 M  +2 -2      karbon/tools/vellipsetool.cc  
 M  +3 -3      karbon/tools/vpolygontool.cc  
 M  +2 -2      karbon/tools/vrectangletool.cc  
 M  +21 -23    karbon/tools/vroundrecttool.cc  
 M  +4 -4      karbon/tools/vroundrecttool.h  
 M  +4 -4      karbon/tools/vsinustool.cc  
 M  +2 -2      karbon/tools/vspiraltool.cc  
 M  +3 -3      karbon/tools/vstartool.cc  
 M  +1 -1      kword/KWConfig.cpp  
 M  +40 -36    lib/kofficeui/koPageLayoutDia.cc  
 M  +7 -7      lib/kofficeui/koPageLayoutDia.h  
 M  +13 -6     lib/kofficeui/koUnitWidgets.cc  
 M  +3 -1      lib/kofficeui/koUnitWidgets.h  
 M  +40 -32    lib/kotext/koParagDia.cc  
 M  +5 -3      lib/kotext/koParagDia.h  
Comment 9 Inge Wallin 2005-11-10 22:36:36 UTC
SVN commit 479547 by ingwa:

Oops.  forgot to commit in kspread.

CCBUG: 112933



 M  +1 -0      dialogs/kspread_dlg_layout.h  
 M  +1 -0      dialogs/kspread_dlg_resize2.cc  
 M  +2 -0      kspread_doc.cc  


--- trunk/koffice/kspread/dialogs/kspread_dlg_layout.h #479546:479547
@@ -45,6 +45,7 @@
 #include <qpushbutton.h>
 #include <qcheckbox.h>
 
+class KoUnitDoubleSpinBox;
 class QPixmap;
 class QRadioButton;
 class QPushButton;
--- trunk/koffice/kspread/dialogs/kspread_dlg_resize2.cc #479546:479547
@@ -29,6 +29,7 @@
 #include <knuminput.h>
 
 #include <koUnit.h>
+#include <koUnitWidgets.h>//for KoUnitDoubleSpinBox
 
 #include "kspread_dlg_resize2.h"
 #include <kspread_global.h>
--- trunk/koffice/kspread/kspread_doc.cc #479546:479547
@@ -1514,6 +1514,8 @@
 void KSpreadDoc::paintContent( QPainter& painter, const QRect& rect,
                                bool transparent, double zoomX, double /*zoomY*/ )
 {
+    kdDebug(36001) << "paintContent() called on " << rect << endl;
+
   //  ElapsedTime et( "KSpreadDoc::paintContent1" );
     //kdDebug(36001) << "KSpreadDoc::paintContent m_zoom=" << m_zoom << " zoomX=" << zoomX << " zoomY=" << zoomY << " transparent=" << transparent << endl;
 
Comment 10 Inge Wallin 2005-11-10 22:38:12 UTC
Tymoteusz,

I am sorry, but as you see above, I couldn't make it in kpresenter.  Do you think you could redo just that part, and I will apply it really quickly this time.  Then we can close this bug.
Comment 11 Thomas Zander 2005-11-10 22:59:42 UTC
Redo it based on svn trunk, naturally.
Since some changes seemed to be based on the latest source release from quite some time ago.
Comment 12 maju 2005-11-15 22:34:12 UTC
Created attachment 13478 [details]
Kpreseneter files (trunk)

Here are the missing files.

I was sure trunk has to be compiled with Qt4 and that's why I was working with
the 1.4 sources. Now I'm working with the trunk.
Comment 13 Inge Wallin 2005-11-18 00:18:39 UTC
SVN commit 481121 by ingwa:

Finally fix bug 112933: JJ: replace double spinboxes in koffice
applications with the KoUnitDoubleSpinBox

Thanks for the patch, maju.

BUG: 112933



 M  +23 -14    kpresenter/generalproperty.cc  
 M  +55 -38    kpresenter/generalpropertyui.ui  
 M  +24 -14    kpresenter/kpmarginwidget.cc  
 M  +70 -54    kpresenter/marginui.ui  
 M  +1 -1      lib/kofficeui/koUnitWidgets.cc