[Digikam-devel] [Bug 124425] [Improvement] Start index number counting on selected images instead of all images

Gilles Caulier caulier.gilles at free.fr
Thu Jul 20 20:26:51 BST 2006


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=124425         
caulier.gilles free fr changed:

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



------- Additional Comments From caulier.gilles free fr  2006-07-20 21:26 -------
SVN commit 564659 by cgilles:

digikam from trunk : improvements of Camera Gui again !!!

Now the custom prefix index depand of current images selection in the camera icon items. A screenshot :

http://digikam3rdparty.free.fr/Screenshots/cameragui_custom_index_and_ pictures_selection.png

BUG: 124425

 M  +49 -9     cameraiconview.cpp  
 M  +1 -0      cameraiconview.h  
 M  +15 -3     cameraui.cpp  
 M  +1 -0      cameraui.h  


--- trunk/extragear/graphics/digikam/utilities/cameragui/cameraiconview.cpp #564658:564659
 @ -89,7 +89,7  @
     setMinimumSize(450, 400);
 
     connect(this, SIGNAL(signalSelectionChanged()),
-            this, SLOT(slotSelectionChanged()));
+            this, SLOT(slotDownloadNameChanged()));
             
     connect(this, SIGNAL(signalRightButtonClicked(IconItem*, const QPoint&)),
             this, SLOT(slotContextMenu(IconItem*, const QPoint&)));
 @ -195,20 +195,60  @
     
     viewport()->setUpdatesEnabled(false);
 
+    int  index=0;
+    bool hasSelection=false;
     for (IconItem* item = firstItem(); item; item = item->nextItem())
     {
-        CameraIconViewItem* viewItem = static_cast<CameraIconViewItem*>(item);
+        if (item->isSelected())
+        {
+            hasSelection = true;
+            break;
+        }
+    }
 
-        QString downloadName;
+    emit signalNewSelection(hasSelection);
 
-        if (!useDefault)
-            downloadName = getTemplatedName( nameTemplate, viewItem->itemInfo(), 
-                                             d->groupItem->index(viewItem) );
-        else
-            downloadName = getCasedName( d->renamer->changeCase(), viewItem->itemInfo() );
+    if (hasSelection)
+    {
+        // Camera items selection.
+    
+        for (IconItem* item = firstItem(); item; item = item->nextItem())
+        {
+            QString downloadName;
+            CameraIconViewItem* viewItem = static_cast<CameraIconViewItem*>(item);
+            if (viewItem->isSelected())
+            {
+                if (!useDefault)
+                    downloadName = getTemplatedName( nameTemplate, viewItem->itemInfo(), index );
+                else
+                    downloadName = getCasedName( d->renamer->changeCase(), viewItem->itemInfo() );
 
-        viewItem->setDownloadName( downloadName );
+                index++;
+            }
+            else 
+                downloadName = getCasedName( d->renamer->changeCase(), viewItem->itemInfo() );
+    
+            viewItem->setDownloadName( downloadName );
+        }
     }
+    else
+    {
+        // No camera item selection.
+    
+        for (IconItem* item = firstItem(); item; item = item->nextItem())
+        {
+            QString downloadName;
+            CameraIconViewItem* viewItem = static_cast<CameraIconViewItem*>(item);
+    
+            if (!useDefault)
+                downloadName = getTemplatedName( nameTemplate, viewItem->itemInfo(), 
+                                                d->groupItem->index(viewItem) );
+            else
+                downloadName = getCasedName( d->renamer->changeCase(), viewItem->itemInfo() );
+    
+            viewItem->setDownloadName( downloadName );
+        }
+    }
 
     rearrangeItems();
     viewport()->setUpdatesEnabled(true);
--- trunk/extragear/graphics/digikam/utilities/cameragui/cameraiconview.h #564658:564659
 @ -73,6 +73,7  @
 
     void signalDownload();
     void signalDelete();
+    void signalNewSelection(bool);
     
 public slots:
 
--- trunk/extragear/graphics/digikam/utilities/cameragui/cameraui.cpp #564658:564659
 @ -222,9 +222,9  @
     QWhatsThis::add( d->setCredits, i18n("<p>Toogle on this option to store default credit and copyright information "
                                          "into IPTC tags using main digiKam metadata settings."));
     QWhatsThis::add( d->fixDateTimeCheck, i18n("<p>Toogle on this option to set date and time metadata "
-                                               "tags to the right values if your camera don't set "
-                                               "properly these tags when pictures are taken. The values will"
-                                               "be saved in the DateTimeDigitized and DateTimeCreated EXIF/IPTC fields."));
+                    "tags to the right values if your camera don't set "
+                    "properly these tags when pictures are taken. The values will"
+                    "be saved in the DateTimeDigitized and DateTimeCreated EXIF/IPTC fields."));
                                                
     grid->addMultiCellWidget(d->renameCustomizer, 0, 0, 0, 1);
     grid->addMultiCellWidget(exifBox, 1, 1, 0, 1);
 @ -328,6 +328,9  @
     connect(d->view, SIGNAL(signalDelete()),
             this, SLOT(slotDeleteSelected()));
 
+    connect(d->view, SIGNAL(signalNewSelection(bool)),
+            this, SLOT(slotNewSelection(bool)));
+
     // -------------------------------------------------------------------------
     
     connect(d->rightSidebar, SIGNAL(signalFirstItem()),
 @ -914,6 +917,15  @
     d->rightSidebar->itemChanged(item->itemInfo(), url, exifData, d->view, item);
 }
 
+void CameraUI::slotNewSelection(bool hasSelection)
+{
+    if (!d->renameCustomizer->useDefault())
+    {
+        d->downloadMenu->setItemEnabled(0, hasSelection);
+        d->downloadMenu->setItemEnabled(1, !hasSelection);
+    }
+}
+
 void CameraUI::slotItemsSelected(CameraIconViewItem* item, bool selected)
 {
     d->downloadMenu->setItemEnabled(0, selected);
--- trunk/extragear/graphics/digikam/utilities/cameragui/cameraui.h #564658:564659
 @ -102,6 +102,7  @
     void slotSkipped(const QString&, const QString&);
     void slotDeleted(const QString&, const QString&);
     
+    void slotNewSelection(bool);
     void slotItemsSelected(CameraIconViewItem* item, bool selected);
     
     void slotExifFromFile(const QString& folder, const QString& file);



More information about the Digikam-devel mailing list