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

List:       kde-commits
Subject:    branches/extragear/graphics/digikam/utilities/facedetection
From:       Marcel Wiesweg <marcel.wiesweg () gmx ! de>
Date:       2010-09-30 21:08:12
Message-ID: 20100930210812.B4A38AC891 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1181383 by mwiesweg:

Polish UI of the AssignNameWidget.

Looks now much more like I want it to. There are still some rough
edges though (and missing functionality)

It would be desirable to have the popup boxes really pop out
and not be clipped to the scene, but this behavior is broken in Qt 4.6.2.

There are also two different popup boxes now, one from the line edit
and one from the combo box. There is room for improvement as well.


 M  +42 -25    assignnamewidget.cpp  
 M  +1 -0      assignnamewidget.h  
 M  +12 -3     facegroup.cpp  


--- branches/extragear/graphics/digikam/utilities/facedetection/assignnamewidget.cpp \
#1181382:1181383 @@ -25,7 +25,6 @@
 
 // Qt includes
 
-#include <QDialogButtonBox>
 #include <QGridLayout>
 #include <QKeyEvent>
 #include <QToolButton>
@@ -42,8 +41,11 @@
 // Local includes
 
 #include "addtagscombobox.h"
+#include "addtagscompletionbox.h"
+#include "addtagslineedit.h"
 #include "album.h"
 #include "albummanager.h"
+#include "albumtreeview.h"
 #include "dimg.h"
 #include "imageinfo.h"
 
@@ -63,7 +65,6 @@
         confirmButton  = 0;
         rejectButton   = 0;
         layout         = 0;
-        buttonBox      = 0;
         tagModel       = 0;
         tagFilterModel = 0;
         tagFilteredModel = 0;
@@ -93,7 +94,6 @@
     AlbumPointer<TAlbum>              parentTag;
 
     QGridLayout*                      layout;
-    QDialogButtonBox*                 buttonBox;
 
     AssignNameWidget* const           q;
 };
@@ -102,8 +102,10 @@
 {
     delete comboBox;
     comboBox  = 0;
-    delete buttonBox;
-    buttonBox = 0;
+    delete confirmButton;
+    confirmButton = 0;
+    delete rejectButton;
+    rejectButton = 0;
 }
 
 QToolButton* AssignNameWidget::AssignNameWidgetPriv::createToolButton(const \
KGuiItem& gui) @@ -116,7 +118,6 @@
     return b;
 }
 
-
 void AssignNameWidget::AssignNameWidgetPriv::checkWidgets()
 {
     if (mode == InvalidMode)
@@ -136,20 +137,26 @@
 
         if (parentTag)
             comboBox->setParentTag(parentTag);
+
+        comboBox->setMinimumContentsLength(15);
+        /*comboBox->lineEdit()->completionBox()->setObjectName("addTagsComboBox-completionBox");
 +        comboBox->lineEdit()->completionBox()->setFrameStyle(QFrame::StyledPanel);
+        comboBox->view()->parentWidget()->setObjectName("addTagsComboBox-viewContainer");*/
  }
 
-    if (!buttonBox)
+    if (!confirmButton)
     {
-        buttonBox     = new QDialogButtonBox(Qt::Horizontal);
         confirmButton = createToolButton(KStandardGuiItem::ok());
-        rejectButton  = createToolButton(KStandardGuiItem::del());
-        buttonBox->addButton(confirmButton, QDialogButtonBox::AcceptRole);
-        buttonBox->addButton(rejectButton,  QDialogButtonBox::RejectRole);
-
-        q->connect(buttonBox, SIGNAL(accepted()),
+        confirmButton->setText(i18n("Confirm"));
+        //confirmButton->setToolTip(i18n("Confirm that the selected person is shown \
here")); +        q->connect(confirmButton, SIGNAL(clicked()),
                    q, SLOT(slotConfirm()));
+    }
 
-        q->connect(buttonBox, SIGNAL(rejected()),
+    if (!rejectButton)
+    {
+        rejectButton  = createToolButton(KStandardGuiItem::remove());
+        q->connect(rejectButton, SIGNAL(clicked()),
                    q, SLOT(slotReject()));
     }
 }
@@ -160,18 +167,21 @@
         return;
 
     layout->removeWidget(comboBox);
-    layout->removeWidget(buttonBox);
+    layout->removeWidget(confirmButton);
+    layout->removeWidget(rejectButton);
 
     if (layoutMode == AssignNameWidget::FullLine)
     {
         layout->addWidget(comboBox,  0, 0);
-        layout->addWidget(buttonBox, 0, 1);
+        layout->addWidget(confirmButton, 0, 1);
+        layout->addWidget(rejectButton, 0, 2);
         layout->setColumnStretch(0, 1);
     }
-    else
+    else if (layoutMode == AssignNameWidget::TwoLines || layoutMode == \
AssignNameWidget::Compact)  {
-        layout->addWidget(comboBox,  0, 0);
-        layout->addWidget(buttonBox, 1, 0);
+        layout->addWidget(comboBox,  0, 0, 1, 2);
+        layout->addWidget(confirmButton, 1, 0);
+        layout->addWidget(rejectButton, 1, 1);
     }
 }
 
@@ -249,9 +259,7 @@
     {
         setStyleSheet(
             "QFrame {"
-            "  background-color: "
-            "  qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 rgba(4, 4, 4, 66%), "
-            "                  stop: 0.6 rgba(0, 0, 0, 66%), stop:1 rgba(0, 0, 0, \
66%)); " +            "  background-color: rgba(0, 0, 0, 66%); "
             "  border: 1px solid rgba(100, 100, 100, 66%); "
             "  border-radius: 8px; "
             "} "
@@ -278,10 +286,19 @@
             "} "
 
             "QComboBox { "
+            "  color: white; "
+            "  background-color: transparent; "
+            "} "
+
+            "QComboBox QAbstractItemView, KCompletionBox::item:!selected { "
+            "  color: white; "
+            "  background-color: rgba(0,0,0,80%); "
+            "} "
+            /*"KCompletionBox::item:hover, KCompletionBox::item:selected { "
             "  background-color: "
-            "    qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 \
                rgba(255,255,255,100), "
-            "      stop:1 rgba(255,255,255,0)); "
-            "} "
+            "     qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 \
rgba(150,150,150,80%), " +            "                     stop:0.5 \
rgba(25,25,25,100%), stop:1 rgba(150,150,150,80%)); " +            " } "*/
         );
     }
     else if (style == StyledFrame)
--- branches/extragear/graphics/digikam/utilities/facedetection/assignnamewidget.h \
#1181382:1181383 @@ -62,6 +62,7 @@
     {
         InvalidLayout,
         FullLine,
+        TwoLines,
         Compact
     };
 
--- branches/extragear/graphics/digikam/utilities/facedetection/facegroup.cpp \
#1181382:1181383 @@ -380,7 +380,7 @@
     AssignNameWidget* assignWidget = new AssignNameWidget;
     assignWidget->setMode(assignWidgetMode(face.type()));
     assignWidget->setBackgroundStyle(AssignNameWidget::TransparentRound);
-    assignWidget->setLayoutMode(AssignNameWidget::FullLine);
+    assignWidget->setLayoutMode(AssignNameWidget::TwoLines);
     assignWidget->setFace(info, identifier);
     checkModels();
     assignWidget->setTagModel(tagModel, filteredModel, filterModel);
@@ -421,6 +421,9 @@
         d->visibilityController->addItem(item);
 
         d->items << item;
+        /*kDebug() << assignWidget->size() << assignWidget->sizeHint() << \
assignWidget->minimumSizeHint() +                 << \
((QComboBox*)assignWidget->comboBox())->view()->sizeHint() << \
((QComboBox*)assignWidget->comboBox())->view()->minimumSizeHint() +                 \
<< assignWidget->sizePolicy() << assignWidget->comboBox()->sizeHint();*/  }
 
     d->state = FacesLoaded;
@@ -456,11 +459,15 @@
 
 void FaceGroup::slotAssigned(const TaggingAction& action, const ImageInfo& info, \
const QVariant& faceIdentifier)  {
-    int tagId         = action.tagId();
+    if (info != d->info)
+        return;
     FaceItem* item    = d->items[faceIdentifier.toInt()];
+
     DatabaseFace face = item->face();
     QRect currentRect = item->originalRect();
-    face              = d->faceIface.confirmName(d->info.id(), tagId, currentRect, \
face.region().toRect()); +
+    face              = d->faceIface.confirmName(d->info.id(), action.tagId(), \
currentRect, face.region().toRect()); +
     item->widget()->setMode(d->assignWidgetMode(face.type()));
     //item->widget()->setCurrentTag(face.tagId())
     item->setFace(face);
@@ -468,6 +475,8 @@
 
 void FaceGroup::slotRejected(const ImageInfo& info, const QVariant& faceIdentifier)
 {
+    if (info != d->info)
+        return;
     FaceItem* item = d->items.takeAt(faceIdentifier.toInt());
     d->faceIface.removeFace(item->face());
 


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

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