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

List:       kde-commits
Subject:    koffice/lib/kofficeui
From:       Thomas Zander <zander () kde ! org>
Date:       2005-12-12 9:28:16
Message-ID: 1134379696.295360.16729.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 487841 by zander:

Add enable slots to enable 'WP'/'DTP' mode widgets on off


 M  +7 -1      KoPageLayoutColumns.cpp  
 M  +22 -1     KoPageLayoutColumns.h  
 M  +18 -4     KoPageLayoutSize.cpp  
 M  +34 -0     KoPageLayoutSize.h  
 M  +1 -1      koPageLayoutDia.cc  


--- trunk/koffice/lib/kofficeui/KoPageLayoutColumns.cpp #487840:487841
@@ -25,7 +25,7 @@
 #include <qlabel.h>
 #include <qlayout.h>
 
-KoPageLayoutColumns::KoPageLayoutColumns(QWidget *parent, const KoPageLayout& \
layout, KoUnit::Unit unit,const KoColumns& columns) \
+KoPageLayoutColumns::KoPageLayoutColumns(QWidget *parent, const KoColumns& columns, \
KoUnit::Unit unit, const KoPageLayout& layout)  : KoPageLayoutColumnsBase(parent) {
     m_columns = columns;
     QHBoxLayout *lay = new QHBoxLayout(previewPane);
@@ -46,6 +46,12 @@
     connect( m_spacing, SIGNAL( valueChangedPt(double) ), this, SLOT( nSpaceChanged( \
double ) ) );  }
 
+void KoPageLayoutColumns::setEnableColumns(bool on) {
+    nColumns->setEnabled(on);
+    m_spacing->setEnabled(on);
+    nColChanged(on ? nColumns->value(): 1 );
+}
+
 void KoPageLayoutColumns::nColChanged( int columns ) {
     m_columns.columns = columns;
     m_preview->setPageColumns( m_columns );
--- trunk/koffice/lib/kofficeui/KoPageLayoutColumns.h #487840:487841
@@ -30,14 +30,35 @@
 class KoUnitDoubleSpinBox;
 class KoPagePreview;
 
+/**
+ * This class is a widget that shows the KoColumns data structure and allows the \
user to change it. + */
 class KoPageLayoutColumns : public KoPageLayoutColumnsBase {
     Q_OBJECT
 
 public:
-    KoPageLayoutColumns(QWidget *parent, const KoPageLayout& layout, KoUnit::Unit \
unit,const KoColumns& columns); +    /**
+     * Contructor
+     * @param parent the parent widget
+     * @param columns the KoColumns data structure that this dialog should be \
initialzed with +     * @param unit the unit-type (mm/cm/inch) that the dialog should \
show +     * @param layout the page layout that the preview should be initialzed \
with. +     */
+    KoPageLayoutColumns(QWidget *parent, const KoColumns& columns, KoUnit::Unit \
unit, const KoPageLayout& layout);  
+    /**
+     * Update the page preview widget with the param layout.
+     * @param layout the new layout
+     */
     void setLayout(KoPageLayout &layout);
+public slots:
 
+    /**
+     * Enable the user to edit the columns
+     * @param on if true enable the user to change the columns count
+     */
+    void setEnableColumns(bool on);
+
 signals:
     void propertyChange(KoColumns &columns);
 
--- trunk/koffice/lib/kofficeui/KoPageLayoutSize.cpp #487840:487841
@@ -135,25 +135,21 @@
     ebrLeft = new KoUnitDoubleSpinBox( marginsFrame, "Left" );
     marginsLayout->addWidget( ebrLeft, 1, 0 );
     connect( ebrLeft, SIGNAL( valueChangedPt( double ) ), this, SLOT( leftChanged( \
                double ) ) );
-    if ( !enableBorders ) ebrLeft->setEnabled( false );
 
     // right margin
     ebrRight = new KoUnitDoubleSpinBox( marginsFrame, "Right" );
     marginsLayout->addWidget( ebrRight, 1, 2 );
     connect( ebrRight, SIGNAL( valueChangedPt( double ) ), this, SLOT( rightChanged( \
                double ) ) );
-    if ( !enableBorders ) ebrRight->setEnabled( false );
 
     // top margin
     ebrTop = new KoUnitDoubleSpinBox( marginsFrame, "Top" );
     marginsLayout->addWidget( ebrTop, 0, 1 , Qt::AlignCenter );
     connect( ebrTop, SIGNAL( valueChangedPt( double ) ), this, SLOT( topChanged( \
                double ) ) );
-    if ( !enableBorders ) ebrTop->setEnabled( false );
 
     // bottom margin
     ebrBottom = new KoUnitDoubleSpinBox( marginsFrame, "Bottom" );
     marginsLayout->addWidget( ebrBottom, 2, 1, Qt::AlignCenter );
     connect( ebrBottom, SIGNAL( valueChangedPt( double ) ), this, SLOT( \
                bottomChanged( double ) ) );
-    if ( !enableBorders ) ebrBottom->setEnabled( false );
 
     // ------------- preview -----------
     pgPreview = new KoPagePreview( this, "Preview", m_layout );
@@ -172,8 +168,26 @@
     setValues();
     updatePreview();
     pgPreview->setPageColumns( columns );
+    setEnableBorders(enableBorders);
 }
 
+void KoPageLayoutSize::setEnableBorders(bool on) {
+    ebrLeft->setEnabled( on );
+    ebrRight->setEnabled( on );
+    ebrTop->setEnabled( on );
+    ebrBottom->setEnabled( on );
+
+    // update m_layout
+    m_layout.ptLeft = on?ebrLeft->value():0;
+    m_layout.ptRight = on?ebrRight->value():0;
+    m_layout.ptTop = on?ebrTop->value():0;
+    m_layout.ptBottom = on?ebrBottom->value():0;
+
+    // use updated m_layout
+    updatePreview();
+    emit propertyChange(m_layout);
+}
+
 void KoPageLayoutSize::updatePreview() {
     pgPreview->setPageLayout( m_layout );
 }
--- trunk/koffice/lib/kofficeui/KoPageLayoutSize.h #487840:487841
@@ -31,20 +31,54 @@
 class KoUnitDoubleSpinBox;
 class KoPageLayoutColumns;
 
+/**
+ * This class is a widget that shows the KoPageLayout data structure and allows the \
user to change it. + */
 class KoPageLayoutSize : public QWidget {
     Q_OBJECT
 
 public:
+    /**
+     * Contructor
+     * @param parent the parent widget
+     * @param layout the page layout that this widget should be initialzed with.
+     * @param unit the unit-type (mm/cm/inch) that the dialog should show
+     * @param columns the KoColumns (amout of columns) that the preview should be \
initialized with +     * @param unitChooser if true a combobox with the unit-type is \
shown for the user to change +     * @param enableBorders if true enable the user to \
change the margins (aka borders) of the page +     */
     KoPageLayoutSize(QWidget *parent, const KoPageLayout& layout, KoUnit::Unit unit,
             const KoColumns& columns, bool unitChooser, bool enableBorders);
 
+    /**
+     * @return if the dialog is in a sane state and the values can be used.
+     */
     bool queryClose();
+    /**
+     * Update the page preview widget with the param columns.
+     * @param columns the new columns
+     */
     void setColumns(KoColumns &columns);
 
 public slots:
+    /**
+     * Set a new unit for the widget updating the widgets.
+     * @param unit the new unit
+     */
     void setUnit( KoUnit::Unit unit );
+    /**
+     * Enable the user to edit the page border size
+     * @param on if true enable the user to change the margins (aka borders) of the \
page +     */
+    void setEnableBorders(bool on);
 
 signals:
+    /**
+     * Emitted whenever the user changed something in the dialog.
+     * @param layout the update layout structure with currently displayed info.
+     * Note that the info may not be fully correct and physically possible (in which
+     * case queryClose will return false)
+     */
     void propertyChange(KoPageLayout &layout);
 
 protected:
--- trunk/koffice/lib/kofficeui/koPageLayoutDia.cc #487840:487841
@@ -355,7 +355,7 @@
 {
     QWidget *tab3 = addPage(i18n( "Col&umns" ));
     QHBoxLayout *lay = new QHBoxLayout(tab3);
-    m_columnsTab = new KoPageLayoutColumns(tab3, m_layout, m_unit, m_column);
+    m_columnsTab = new KoPageLayoutColumns(tab3, m_column, m_unit, m_layout);
     m_columnsTab->layout()->setMargin(0);
     lay->addWidget(m_columnsTab);
     m_columnsTab->show();


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

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