[Kde-imaging] branches/extragear/kde3/libs/kipi-plugins/slideshow

Valerio Fuoglio valerio at ulteo.com
Mon Jun 18 02:08:34 CEST 2007


SVN commit 676928 by vfuoglio:

Progress indicator printing doesn't depend from file name printing anymore.

GUI:
CCMAIL: kde-imaging at kde.org


 M  +30 -5     slideshow.cpp  
 M  +2 -0      slideshow.h  
 M  +5 -0      slideshowconfig.cpp  
 M  +60 -22    slideshowconfigbase.ui  
 M  +36 -8     slideshowgl.cpp  
 M  +2 -0      slideshowgl.h  


--- branches/extragear/kde3/libs/kipi-plugins/slideshow/slideshow.cpp #676927:676928
@@ -175,6 +175,7 @@
 {
     m_delay                 = m_config->readNumEntry("Delay", 1500);
     m_printName         = m_config->readBoolEntry("Print Filename", true);
+    m_printProgress     = m_config->readBoolEntry("Print Progress Indicator", true);
     m_printComments     = m_config->readBoolEntry("Print Comments", false);
     m_loop                  = m_config->readBoolEntry("Loop", false);
     
@@ -353,6 +354,9 @@
     if (m_printName)
         printFilename();
     
+    if (m_printProgress)
+        printProgress();
+    
     if (m_printComments && m_ImagesHasComments)
         printComments();
 }
@@ -398,6 +402,9 @@
     if (m_printName)
         printFilename();
     
+    if (m_printProgress)
+        printProgress();
+    
     if (m_printComments)
         printComments();
 }
@@ -426,11 +433,6 @@
     p.begin(m_currImage->qpixmap());
 
     QString filename(m_currImage->filename());
-    filename += " (";
-    filename += QString::number(m_fileIndex + 1);
-    filename += "/";
-    filename += QString::number(m_fileList.count());
-    filename += ")";
 
     p.setPen(QColor("black"));
     for (int x=9; x<=11; x++)
@@ -523,6 +525,29 @@
 
 /////////////////////////////////////////////////////////////////////////////////////////////////////
 
+void SlideShow::printProgress()
+{
+    if (!m_currImage) return;
+
+    QPainter p;
+    p.begin(m_currImage->qpixmap());
+
+    QString progress(QString::number(m_fileIndex+1) + "/" + QString::number(m_fileList.count()));
+
+    int stringLenght = p.fontMetrics().width(progress) * progress.length();
+    
+    p.setPen(QColor("black"));
+    for (int x=9; x<=11; x++)
+        for (int y=21; y>=19; y--)
+            p.drawText(x, height()-y, progress);
+
+    p.setPen(QColor("white"));
+    p.drawText(width() - stringLenght - 10, 20, progress);
+}
+
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////
+
 EffectMethod SlideShow::getRandomEffect()
 {
     QStringList effs = Effects.keys();
--- branches/extragear/kde3/libs/kipi-plugins/slideshow/slideshow.h #676927:676928
@@ -78,6 +78,7 @@
     void          showCurrentImage();
     void          printFilename();
     void          printComments();
+    void          printProgress();
     EffectMethod  getRandomEffect();
     void          showEndOfShow();
     
@@ -92,6 +93,7 @@
     int         m_delay;
     bool        m_printName;
     bool        m_printComments;
+    bool        m_printProgress;
     QString     m_effectName;
     bool        m_loop;
 
--- branches/extragear/kde3/libs/kipi-plugins/slideshow/slideshowconfig.cpp #676927:676928
@@ -221,6 +221,7 @@
     bool  opengl;
     int   delay;
     bool  printFileName;
+    bool  printProgress;
     bool  printFileComments;
     bool  loop;
     bool  shuffle;
@@ -233,6 +234,7 @@
     opengl                = m_config->readBoolEntry("OpenGL", false);
     delay                 = m_config->readNumEntry("Delay", 1500);
     printFileName         = m_config->readBoolEntry("Print Filename", true);
+    printProgress         = m_config->readBoolEntry("Print Progress Inticator", true);
     printFileComments     = m_config->readBoolEntry("Print Comments", false);
     loop                  = m_config->readBoolEntry("Loop", false);
     shuffle               = m_config->readBoolEntry("Shuffle", false);
@@ -270,6 +272,8 @@
     m_delaySpinBox->setValue(delay);
 
     m_printNameCheckBox->setChecked(printFileName);
+    
+    m_printProgressCheckBox->setChecked(printProgress);
 
     m_printCommentsCheckBox->setChecked(printFileComments);
 
@@ -308,6 +312,7 @@
         m_config->writeEntry("Delay", m_delaySpinBox->value()*1000); 
 
     m_config->writeEntry("Print Filename", m_printNameCheckBox->isChecked());
+    m_config->writeEntry("Print Progress Indicator", m_printProgressCheckBox->isChecked());
     m_config->writeEntry("Print Comments", m_printCommentsCheckBox->isChecked());
     m_config->writeEntry("Loop", m_loopCheckBox->isChecked());
     m_config->writeEntry("Shuffle", m_shuffleCheckBox->isChecked());
--- branches/extragear/kde3/libs/kipi-plugins/slideshow/slideshowconfigbase.ui #676927:676928
@@ -11,8 +11,8 @@
         <rect>
             <x>0</x>
             <y>0</y>
-            <width>606</width>
-            <height>603</height>
+            <width>678</width>
+            <height>613</height>
         </rect>
     </property>
     <property name="sizePolicy">
@@ -605,31 +605,69 @@
                                         <property name="title">
                                             <string>Content options</string>
                                         </property>
+                                        <property name="checkable">
+                                            <bool>false</bool>
+                                        </property>
+                                        <property name="checked">
+                                            <bool>false</bool>
+                                        </property>
                                         <vbox>
                                             <property name="name">
                                                 <cstring>unnamed</cstring>
                                             </property>
-                                            <widget class="QCheckBox">
+                                            <widget class="QLayoutWidget">
                                                 <property name="name">
-                                                    <cstring>m_printNameCheckBox</cstring>
+                                                    <cstring>layout14</cstring>
                                                 </property>
-                                                <property name="sizePolicy">
-                                                    <sizepolicy>
-                                                        <hsizetype>7</hsizetype>
-                                                        <vsizetype>7</vsizetype>
-                                                        <horstretch>0</horstretch>
-                                                        <verstretch>0</verstretch>
-                                                    </sizepolicy>
-                                                </property>
-                                                <property name="text">
-                                                    <string>P&amp;rint filename</string>
-                                                </property>
-                                                <property name="accel">
-                                                    <string>Alt+R</string>
-                                                </property>
-                                                <property name="checked">
-                                                    <bool>true</bool>
-                                                </property>
+                                                <hbox>
+                                                    <property name="name">
+                                                        <cstring>unnamed</cstring>
+                                                    </property>
+                                                    <widget class="QCheckBox">
+                                                        <property name="name">
+                                                            <cstring>m_printNameCheckBox</cstring>
+                                                        </property>
+                                                        <property name="sizePolicy">
+                                                            <sizepolicy>
+                                                                <hsizetype>7</hsizetype>
+                                                                <vsizetype>7</vsizetype>
+                                                                <horstretch>0</horstretch>
+                                                                <verstretch>0</verstretch>
+                                                            </sizepolicy>
+                                                        </property>
+                                                        <property name="text">
+                                                            <string>P&amp;rint filename</string>
+                                                        </property>
+                                                        <property name="accel">
+                                                            <string>Alt+R</string>
+                                                        </property>
+                                                        <property name="checked">
+                                                            <bool>true</bool>
+                                                        </property>
+                                                    </widget>
+                                                    <widget class="QCheckBox">
+                                                        <property name="name">
+                                                            <cstring>m_printProgressCheckBox</cstring>
+                                                        </property>
+                                                        <property name="sizePolicy">
+                                                            <sizepolicy>
+                                                                <hsizetype>1</hsizetype>
+                                                                <vsizetype>1</vsizetype>
+                                                                <horstretch>0</horstretch>
+                                                                <verstretch>0</verstretch>
+                                                            </sizepolicy>
+                                                        </property>
+                                                        <property name="text">
+                                                            <string>Progress indicator</string>
+                                                        </property>
+                                                        <property name="accel">
+                                                            <string></string>
+                                                        </property>
+                                                        <property name="checked">
+                                                            <bool>true</bool>
+                                                        </property>
+                                                    </widget>
+                                                </hbox>
                                             </widget>
                                             <widget class="QCheckBox">
                                                 <property name="name">
@@ -666,7 +704,7 @@
                                                 <property name="sizeHint">
                                                     <size>
                                                         <width>21</width>
-                                                        <height>2</height>
+                                                        <height>16</height>
                                                     </size>
                                                 </property>
                                             </spacer>
--- branches/extragear/kde3/libs/kipi-plugins/slideshow/slideshowgl.cpp #676927:676928
@@ -165,6 +165,7 @@
 {
     m_delay                 = m_config->readNumEntry("Delay", 1500);
     m_printName         = m_config->readBoolEntry("Print Filename", true);
+    m_printProgress     = m_config->readBoolEntry("Print Progress Indicator", true);
     m_printComments     = m_config->readBoolEntry("Print Comments", false);
     m_loop                  = m_config->readBoolEntry("Loop", false);
     
@@ -507,8 +508,11 @@
 	if (m_printName)
 	    printFilename(black);
 	
-        if (m_printComments && m_imagesHasComments)
-            printComments(black);
+    if (m_printProgress)
+        printProgress(black);
+    
+    if (m_printComments && m_imagesHasComments)
+        printComments(black);
         
 	QImage t = convertToGLFormat(black);
 
@@ -560,11 +564,6 @@
 { 
     QFileInfo fileinfo(m_fileList[m_fileIndex].first);
     QString filename = fileinfo.fileName();
-    filename += " (";
-    filename += QString::number(m_fileIndex + 1);
-    filename += "/";
-    filename += QString::number(m_fileList.count());
-    filename += ")";    
        
     QFont fn(font());
     fn.setPointSize(fn.pointSize());
@@ -587,6 +586,35 @@
     KImageEffect::blendOnLower(0,m_height-rect.height(),textimage,layer);
 }
 
+void SlideShowGL::printProgress(QImage& layer)
+{ 
+    QString progress(QString::number(m_fileIndex + 1) + "/" + QString::number(m_fileList.count()));
+       
+    QFont fn(font());
+    fn.setPointSize(fn.pointSize());
+    fn.setBold(true);
+   
+    QFontMetrics fm(fn);
+    QRect rect=fm.boundingRect(progress);
+    rect.addCoords( 0, 0, 2, 2 );
+    
+    QPixmap pix(rect.width(),rect.height());
+    pix.fill(Qt::black);    
+
+    QPainter p(&pix);
+    
+    int stringLenght = p.fontMetrics().width(progress) * progress.length();
+    
+    p.setPen(Qt::white);
+    p.setFont(fn);
+    p.drawText(1,fn.pointSize()+1 , progress);
+    p.end();
+   
+    QImage textimage(pix.convertToImage());
+    KImageEffect::blendOnLower(m_width - stringLenght - 10,
+                               20,textimage,layer);
+}
+
 void SlideShowGL::printComments(QImage& layer)
 { 
     QString comments = m_commentsList[m_fileIndex];
@@ -644,7 +672,7 @@
 
     for ( int lineNumber = 0; lineNumber < (int)commentsByLines.count(); lineNumber++ ) {
 
-        yPos += 1.5 * m_commentsFont->pointSize();
+        yPos += int(1.5 * m_commentsFont->pointSize());
 
         QRect rect=fm.boundingRect(commentsByLines[lineNumber]);
         rect.addCoords( 0, 0, 2, 2 );
--- branches/extragear/kde3/libs/kipi-plugins/slideshow/slideshowgl.h #676927:676928
@@ -74,6 +74,7 @@
     QString     m_effectName;
     bool        m_loop;
     bool        m_printName;
+    bool        m_printProgress;
     bool        m_printComments;
     
     bool        m_imagesHasComments;
@@ -130,6 +131,7 @@
     EffectMethod  getRandomEffect();
     void          showEndOfShow();
     void          printFilename(QImage& layer);
+    void          printProgress(QImage& layer);
     void          printComments(QImage& layer);
     
     void          readSettings();


More information about the Kde-imaging mailing list