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

List:       kde-commits
Subject:    extragear/graphics/digikam/utilities/fuzzysearch
From:       Andi Clemens <andi.clemens () gmx ! net>
Date:       2009-11-03 10:07:14
Message-ID: 1257242834.448416.7874.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1044243 by aclemens:

first stage of code cleanup / simplification. I will now try to remove some
layouts, we are using way too many in here.
Also the width of some widgets is too big for the sidebar.

 M  +61 -50    fuzzysearchview.cpp  
 M  +4 -0      fuzzysearchview.h  


--- trunk/extragear/graphics/digikam/utilities/fuzzysearch/fuzzysearchview.cpp \
#1044242:1044243 @@ -171,22 +171,59 @@
 {
     d->thumbLoadThread = ThumbnailLoadThread::defaultThread();
 
-    QWidget *panel = new QWidget(viewport());
-    panel->setAutoFillBackground(false);
-    setWidget(panel);
     setWidgetResizable(true);
     setAttribute(Qt::WA_DeleteOnClose);
     setAcceptDrops(true);
-    viewport()->setAutoFillBackground(false);
     viewport()->setAcceptDrops(true);
 
-    QVBoxLayout *vlay    = new QVBoxLayout(panel);
-    d->tabWidget         = new KTabWidget(panel);
+    // ---------------------------------------------------------------
 
+    QWidget *imagePanel    = setupFindSimilarPanel();
+    QWidget *sketchPanel   = setupSketchPanel();
+    d->findDuplicatesPanel = new FindDuplicatesView();
+
+    d->tabWidget = new KTabWidget();
+    d->tabWidget->insertTab(FuzzySearchViewPriv::SIMILARS,   imagePanel,             \
i18n("Image")); +    d->tabWidget->insertTab(FuzzySearchViewPriv::SKETCH,     \
sketchPanel,            i18n("Sketch")); +    \
d->tabWidget->insertTab(FuzzySearchViewPriv::DUPLICATES, d->findDuplicatesPanel, \
i18n("Duplicates")); +
     // ---------------------------------------------------------------
-    // Find Similar Images Panel
 
-    QWidget *imagePanel = new QWidget(panel);
+    d->folderView            = new KVBox();
+    d->fuzzySearchFolderView = new FuzzySearchFolderView(d->folderView);
+    d->searchFuzzyBar        = new SearchTextBar(d->folderView, \
"FuzzySearchViewSearchFuzzyBar"); +    \
d->folderView->setSpacing(KDialog::spacingHint()); +    d->folderView->setMargin(0);
+
+    // ---------------------------------------------------------------
+
+    QWidget *mainWidget     = new QWidget(this);
+    QVBoxLayout *mainLayout = new QVBoxLayout();
+    mainLayout->addWidget(d->tabWidget);
+    mainLayout->addWidget(d->folderView);
+    mainLayout->setMargin(0);
+    mainLayout->setSpacing(0);
+    mainWidget->setLayout(mainLayout);
+
+    setWidget(mainWidget);
+    setAutoFillBackground(false);
+    mainWidget->setAutoFillBackground(false);
+    viewport()->setAutoFillBackground(false);
+
+    // ---------------------------------------------------------------
+
+    readConfig();
+    setupConnections();
+
+    // ---------------------------------------------------------------
+
+    slotCheckNameEditSketchConditions();
+    slotCheckNameEditImageConditions();
+}
+
+QWidget* FuzzySearchView::setupFindSimilarPanel()
+{
+    QWidget* imagePanel = new QWidget;
     QGridLayout *grid   = new QGridLayout(imagePanel);
     QWidget *box2       = new QWidget(imagePanel);
     QVBoxLayout *vlay3  = new QVBoxLayout(box2);
@@ -227,9 +264,9 @@
     d->levelImage->setSingleStep(1);
     d->levelImage->setValue(90);
     d->levelImage->setWhatsThis(i18n("Select here the approximate threshold "
-                                     "value, as a percentage. "
-                                     "This value is used by the algorithm to \
                distinguish two "
-                                     "similar images. The default value is 90."));
+            "value, as a percentage. "
+            "This value is used by the algorithm to distinguish two "
+            "similar images. The default value is 90."));
 
     hbox3->setStretchFactor(resultsLabel2, 10);
     hbox3->setMargin(0);
@@ -244,16 +281,16 @@
     d->nameEditImage = new KLineEdit(hbox4);
     d->nameEditImage->setClearButtonShown(true);
     d->nameEditImage->setWhatsThis(i18n("Enter the name of the current similar image \
                search to save in the "
-                                        "\"My Fuzzy Searches\" view."));
+            "\"My Fuzzy Searches\" view."));
 
     d->saveBtnImage  = new QToolButton(hbox4);
     d->saveBtnImage->setIcon(SmallIcon("document-save"));
     d->saveBtnImage->setEnabled(false);
     d->saveBtnImage->setToolTip(i18n("Save current similar image search to a new \
                virtual Album"));
     d->saveBtnImage->setWhatsThis(i18n("If you press this button, the current "
-                                       "similar image search will be saved to a new \
                search "
-                                       "virtual album using name "
-                                       "set on the left side."));
+            "similar image search will be saved to a new search "
+            "virtual album using name "
+            "set on the left side."));
 
     // ---------------------------------------------------------------
 
@@ -269,10 +306,12 @@
     grid->setMargin(KDialog::spacingHint());
     grid->setSpacing(KDialog::spacingHint());
 
-    // ---------------------------------------------------------------
-    // Find by Sketch Panel
+    return imagePanel;
+}
 
-    QWidget *sketchPanel = new QWidget(panel);
+QWidget* FuzzySearchView::setupSketchPanel()
+{
+    QWidget *sketchPanel = new QWidget;
     QGridLayout *grid2   = new QGridLayout(sketchPanel);
     QWidget *box         = new QWidget(sketchPanel);
     QVBoxLayout *vlay2   = new QVBoxLayout(box);
@@ -377,34 +416,11 @@
     grid2->setMargin(KDialog::spacingHint());
     grid2->setSpacing(KDialog::spacingHint());
 
-    // ---------------------------------------------------------------
-    // Find Duplicates Panel
+    return sketchPanel;
+}
 
-    d->findDuplicatesPanel = new FindDuplicatesView(panel);
-
-    d->tabWidget->insertTab(FuzzySearchViewPriv::SIMILARS,   imagePanel,             \
                i18n("Image"));
-    d->tabWidget->insertTab(FuzzySearchViewPriv::SKETCH,     sketchPanel,            \
                i18n("Sketch"));
-    d->tabWidget->insertTab(FuzzySearchViewPriv::DUPLICATES, d->findDuplicatesPanel, \
                i18n("Duplicates"));
-
-    // ---------------------------------------------------------------
-
-    d->folderView            = new KVBox(panel);
-    d->fuzzySearchFolderView = new FuzzySearchFolderView(d->folderView);
-    d->searchFuzzyBar        = new SearchTextBar(d->folderView, \
                "FuzzySearchViewSearchFuzzyBar");
-    d->folderView->setSpacing(KDialog::spacingHint());
-    d->folderView->setMargin(0);
-
-    // ---------------------------------------------------------------
-
-    vlay->addWidget(d->tabWidget);
-    vlay->addWidget(d->folderView);
-    vlay->setMargin(0);
-    vlay->setSpacing(0);
-
-    readConfig();
-
-    // ---------------------------------------------------------------
-
+void FuzzySearchView::setupConnections()
+{
     connect(d->tabWidget, SIGNAL(currentChanged(int)),
             this, SLOT(slotTabChanged(int)));
 
@@ -473,11 +489,6 @@
 
     connect(d->findDuplicatesPanel, SIGNAL(signalUpdateFingerPrints()),
             this, SIGNAL(signalUpdateFingerPrints()));
-
-    // ---------------------------------------------------------------
-
-    slotCheckNameEditSketchConditions();
-    slotCheckNameEditImageConditions();
 }
 
 FuzzySearchView::~FuzzySearchView()
--- trunk/extragear/graphics/digikam/utilities/fuzzysearch/fuzzysearchview.h \
#1044242:1044243 @@ -87,6 +87,10 @@
 
     void setColor(QColor c);
 
+    QWidget* setupFindSimilarPanel();
+    QWidget* setupSketchPanel();
+    void     setupConnections();
+
 private Q_SLOTS:
 
     void slotTabChanged(int);


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

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