[Uml-devel] KDE/kdesdk/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Wed Feb 21 21:32:01 UTC 2007


SVN commit 636081 by okellogg:

Apply attachment 19728 from Antoine Dopffer
> I have an miscelleanous option "Turn on footer and page numbers when
> printing" in the general settings.
> By default, the footer is printed but you can turn it off. 
 
FEATURE:69113


 A             ChangeLog.2  
 M  +6 -1      umbrello/dialogs/settingsdlg.cpp  
 M  +1 -0      umbrello/dialogs/settingsdlg.h  
 M  +1 -0      umbrello/optionstate.h  
 M  +2 -0      umbrello/uml.cpp  
 M  +25 -10    umbrello/umlview.cpp  


--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/settingsdlg.cpp #636080:636081
@@ -148,6 +148,9 @@
     m_GeneralWidgets.angularLinesCB -> setChecked( m_pOptionState->generalState.angularlines );
     miscLayout -> addWidget( m_GeneralWidgets.angularLinesCB, 1, 1 );
 
+    m_GeneralWidgets.footerPrintingCB = new QCheckBox( i18n("Turn on footer and page numbers when printing"), m_GeneralWidgets.miscGB );
+    m_GeneralWidgets.footerPrintingCB -> setChecked( m_pOptionState->generalState.footerPrinting );
+    miscLayout -> addWidget( m_GeneralWidgets.footerPrintingCB, 2, 0 );
     //setup autosave settings
 
     m_GeneralWidgets.autosaveGB = new Q3GroupBox( i18n("Autosave"), page );
@@ -354,7 +357,8 @@
 
 void SettingsDlg::slotApply() {
     applyPage( currentPage() );
-    emit applyClicked();
+    //do no emit signal applyClicked in the slot slotApply -> infinite loop 
+    //emit applyClicked();
 }
 
 void SettingsDlg::slotOk() {
@@ -421,6 +425,7 @@
         m_pOptionState->generalState.tabdiagrams = m_GeneralWidgets.tabdiagramsCB->isChecked();
         m_pOptionState->generalState.newcodegen = m_GeneralWidgets.newcodegenCB->isChecked();
         m_pOptionState->generalState.angularlines = m_GeneralWidgets.angularLinesCB->isChecked();
+        m_pOptionState->generalState.footerPrinting = m_GeneralWidgets.footerPrintingCB->isChecked();
         m_pOptionState->generalState.autosave = m_GeneralWidgets.autosaveCB -> isChecked();
         m_pOptionState->generalState.autosavetime = m_GeneralWidgets.timeISB -> value();
         // 2004-05-17 Achim Spangler: retrieve Suffix setting from dialog entry
--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/settingsdlg.h #636080:636081
@@ -102,6 +102,7 @@
         QCheckBox * tabdiagramsCB;
         QCheckBox * newcodegenCB;
         QCheckBox * angularLinesCB;
+        QCheckBox * footerPrintingCB;
         QCheckBox * autosaveCB;
         QCheckBox * logoCB;
         QCheckBox * tipCB;
--- trunk/KDE/kdesdk/umbrello/umbrello/optionstate.h #636080:636081
@@ -34,6 +34,7 @@
     bool tabdiagrams;
     bool newcodegen;
     bool angularlines;
+    bool footerPrinting;
     bool autosave;
     int time;        //old autosave time, kept for compatibility
     int autosavetime;
--- trunk/KDE/kdesdk/umbrello/umbrello/uml.cpp #636080:636081
@@ -605,6 +605,7 @@
     cg.writeEntry( "tabdiagrams", optionState.generalState.tabdiagrams );
     cg.writeEntry( "newcodegen", optionState.generalState.newcodegen );
     cg.writeEntry( "angularlines", optionState.generalState.angularlines );
+    cg.writeEntry( "footerPrinting", optionState.generalState.footerPrinting );
     cg.writeEntry( "autosave", optionState.generalState.autosave );
     cg.writeEntry( "time", optionState.generalState.time );
     cg.writeEntry( "autosavetime", optionState.generalState.autosavetime );
@@ -1203,6 +1204,7 @@
     optionState.generalState.newcodegen = false;
 #endif
     optionState.generalState.angularlines = m_config->readEntry("angularlines", false);
+    optionState.generalState.footerPrinting = m_config->readEntry("footerPrinting", true);
     optionState.generalState.autosave = m_config->readEntry("autosave", true);
     optionState.generalState.time = m_config->readEntry("time", 0); //old autosavetime value kept for compatibility
     optionState.generalState.autosavetime = m_config->readEntry("autosavetime", 0);
--- trunk/KDE/kdesdk/umbrello/umbrello/umlview.cpp #636080:636081
@@ -321,9 +321,22 @@
     // + fontHeight   for foot-text
     // ==============
     // (2*fontHeight) + 7
-    int footHeight = (2*fontHeight) + 7;
-    int footTop    = rect.y() + diagramHeight  + 4+fontHeight;
-    int drawHeight = diagramHeight  + footHeight;
+    int footHeight;
+    int footTop;
+    int drawHeight;
+    bool isFooter = getOptionState().generalState.footerPrinting;
+    if (isFooter)
+    {
+        footHeight = (2*fontHeight) + 7;
+        footTop    = rect.y() + diagramHeight  + 4+fontHeight;
+        drawHeight = diagramHeight  + footHeight;
+    }
+    else
+    {
+        footHeight = 0;
+        footTop    = rect.y() + diagramHeight;
+        drawHeight = diagramHeight;
+    }
 
     // set window of painter to dimensions of diagram
     // set window to viewport relation so that x:y isn't changed
@@ -357,13 +370,15 @@
     // get Diagram
     getDiagram(QRect(rect.x(), rect.y(), windowWidth, diagramHeight), pPainter);
 
-    //draw foot note
-    QString string = i18n("Diagram: %2 Page %1", 1, getName());
-    QColor textColor(50, 50, 50);
-    pPainter.setPen(textColor);
-    pPainter.drawLine(rect.x(), footTop    , windowWidth, footTop);
-    pPainter.drawText(rect.x(), footTop + 3, windowWidth, fontHeight, Qt::AlignLeft, string);
-
+    if (isFooter)
+    {
+        //draw foot note
+        QString string = i18n("Diagram: %2 Page %1", 1, getName());
+        QColor textColor(50, 50, 50);
+        pPainter.setPen(textColor);
+        pPainter.drawLine(rect.x(), footTop    , windowWidth, footTop);
+        pPainter.drawText(rect.x(), footTop + 3, windowWidth, fontHeight, Qt::AlignLeft, string);
+    }
     // now restore scaling
     pPainter.restore();
 




More information about the umbrello-devel mailing list