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

List:       kde-bugs-dist
Subject:    [Bug 111641] When several printing images in a row,
From:       Angelo Naselli <anaselli () linux ! it>
Date:       2006-12-31 16:21:24
Message-ID: 20061231162124.13189.qmail () ktown ! kde ! org
[Download RAW message or body]

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
         
http://bugs.kde.org/show_bug.cgi?id=111641         
anaselli linux it changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From anaselli linux it  2006-12-31 17:21 -------
SVN commit 618214 by anaselli:

gwenview now prints a picture at a time, if more than one are selected only the last one is printed.

BUG: 111641
CCMAIL: gwenview-general lists sourceforge net

 M  +3 -3      document.cpp  
 M  +17 -10    printdialog.cpp  
 M  +6 -0      printdialog.h  
 M  +3 -3      printdialogpagebase.ui  


--- trunk/extragear/graphics/gwenview/gvcore/document.cpp #618213:618214
 @ -388,13 +388,13  @
 	int scaling = printer->option( "app-gwenview-scale" ).toInt();
 
 	QSize size = image.size();
-	if (scaling==1 /* Fit to page */) {
+	if (scaling==GV_FITTOPAGE /* Fit to page */) {
 		bool enlargeToFit = printer->option( "app-gwenview-enlargeToFit" ) != f;
 		if ((image.width() > pdWidth || image.height() > pdHeight) || enlargeToFit) {
 			size.scale( pdWidth, pdHeight, QSize::ScaleMin );
 		}
 	} else {
-		if (scaling==2 /* Scale To */) {
+		if (scaling==GV_SCALE /* Scale To */) {
 			int unit = (printer->option("app-gwenview-scaleUnit").isEmpty() ?
 				GV_INCHES : printer->option("app-gwenview-scaleUnit").toInt());
 			double inches = 1;
 @ -410,7 +410,7  @
 			size.setWidth( int(wImg * printer->resolution()) );
 			size.setHeight( int(hImg * printer->resolution()) );
 		} else {
-			/* No scaling */
+			/* GV_NOSCALE: no scaling */
 			size = image.size();
 		}
 
--- trunk/extragear/graphics/gwenview/gvcore/printdialog.cpp #618213:618214
 @ -37,6 +37,7  @
 #include "document.h"
 #include "printdialogpagebase.h"
 #include "printdialog.moc"
+
 namespace Gwenview {
 
 
 @ -99,9 +100,9  @
 	opts["app-gwenview-printFilename"] = mContent->mAddFileName->isChecked() ? STR_TRUE : STR_FALSE;
 	opts["app-gwenview-printComment"] = mContent->mAddComment->isChecked() ? STR_TRUE : STR_FALSE;
 	opts["app-gwenview-scale"] = QString::number(
-		mContent->mNoScale->isChecked() ? 0
-		: mContent->mFitToPage->isChecked() ? 1
-		: 2);
+		mContent->mNoScale->isChecked() ? GV_NOSCALE
+		: mContent->mFitToPage->isChecked() ? GV_FITTOPAGE
+		: GV_SCALE);
 	opts["app-gwenview-fitToPage"] = mContent->mFitToPage->isChecked() ? STR_TRUE : STR_FALSE;
 	opts["app-gwenview-enlargeToFit"] = mContent->mEnlargeToFit->isChecked() ? STR_TRUE : STR_FALSE;
 
 @ -125,13 +126,14  @
 
 	mContent->mAddFileName->setChecked( opts["app-gwenview-printFilename"] == STR_TRUE );
 	mContent->mAddComment->setChecked( opts["app-gwenview-printComment"] == STR_TRUE );
-	
-	val = opts["app-gwenview-scale"].toInt( &ok );
-	if (ok) {
-		mContent->mScaleGroup->setButton( val );
-	} else {
-		mContent->mScaleGroup->setButton( 0 );
-	}
+	// Starts from id 1 because 0 is returned if not ok, and seems to have a weird
+	// problem with id 2 (last id) otherwise :(
+	ScaleId scaleButtonId = static_cast<ScaleId>( opts["app-gwenview-scale"].toInt( &ok ) );
+ 	if (ok) {
+		mContent->mScaleGroup->setButton( scaleButtonId );
+ 	} else {
+ 		mContent->mScaleGroup->setButton( GV_NOSCALE );
+ 	}
 	mContent->mEnlargeToFit->setChecked( opts["app-gwenview-enlargeToFit"] == STR_TRUE );
 
 	Unit unit = static_cast<Unit>( opts["app-gwenview-scaleUnit"].toInt( &ok ) );
 @ -250,12 +252,17  @
 
 void PrintDialogPage::toggleRatio(bool enable) {
 	if (!enable) return;
+	// choosing a startup value of 15x10 cm (common photo dimention)
+	// mContent->mHeight->value() or mContent->mWidth->value()
+	// are usually empty at startup and hxw (0x0) isn't good IMO keeping ratio
 	double hValue, wValue;
 	if (mDocument->height() > mDocument->width()) {
 		hValue = mContent->mHeight->value();
+		if (!hValue) hValue = 150*unitToMM(mPreviousUnit);
 		wValue = (mDocument->width() * hValue)/ mDocument->height();
 	} else {
 		wValue = mContent->mWidth->value();
+		if (!wValue) wValue = 150*unitToMM(mPreviousUnit);
 		hValue = (mDocument->height() * wValue)/ mDocument->width();
 	}
 	
--- trunk/extragear/graphics/gwenview/gvcore/printdialog.h #618213:618214
 @ -40,6 +40,12  @
 	GV_INCHES
 };
 
+enum ScaleId {
+	GV_NOSCALE=1,
+	GV_FITTOPAGE,
+	GV_SCALE
+};
+
 class LIBGWENVIEW_EXPORT PrintDialogPage : public KPrintDialogPage {
 	Q_OBJECT
 
--- trunk/extragear/graphics/gwenview/gvcore/printdialogpagebase.ui #618213:618214
 @ -151,7 +151,7  @
                         <bool>true</bool>
                     </property>
                     <property name="buttonGroupId">
-                        <number>0</number>
+                        <number>1</number>
                     </property>
                 </widget>
                 <widget class="QRadioButton">
 @ -165,7 +165,7  @
                         <bool>false</bool>
                     </property>
                     <property name="buttonGroupId">
-                        <number>1</number>
+                        <number>2</number>
                     </property>
                 </widget>
                 <widget class="QLayoutWidget">
 @ -231,7 +231,7  @
                         <string>&amp;Scale to:</string>
                     </property>
                     <property name="buttonGroupId">
-                        <number>2</number>
+                        <number>3</number>
                     </property>
                 </widget>
                 <widget class="QLayoutWidget">
[prev in list] [next in list] [prev in thread] [next in thread] 

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