[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: =?utf-8?q?=5Bdigikam/development/2=2E0=5D_/=3A_optimize_layout_o?=
From: Gilles Caulier <caulier.gilles () gmail ! com>
Date: 2011-02-16 14:54:26
Message-ID: 20110216145426.64D73A609B () git ! kde ! org
[Download RAW message or body]
Git commit f969def89b5f716a43d253d1443bc5c6a075de0a by Gilles Caulier.
Committed on 16/02/2011 at 15:53.
Pushed by cgilles into branch 'development/2.0'.
optimize layout of Assign Labels context menu entries
M +13 -19 digikam/contextmenuhelper.cpp
M +5 -31 digikam/contextmenuhelper.h
M +1 -3 digikam/digikamimageview.cpp
M +1 -3 digikam/imagepreviewview.cpp
M +1 -1 libs/widgets/common/colorlabelwidget.cpp
M +1 -1 libs/widgets/common/picklabelwidget.cpp
M +1 -1 libs/widgets/common/ratingwidget.cpp
M +18 -21 utilities/imageeditor/editor/imagewindow.cpp
M +1 -3 utilities/lighttable/lighttablebar.cpp
M +1 -3 utilities/lighttable/lighttablepreview.cpp
http://commits.kde.org/digikam/f969def89b5f716a43d253d1443bc5c6a075de0a
diff --git a/digikam/contextmenuhelper.cpp b/digikam/contextmenuhelper.cpp
index 90bdfa4..14ac64d 100644
--- a/digikam/contextmenuhelper.cpp
+++ b/digikam/contextmenuhelper.cpp
@@ -470,30 +470,24 @@ void ContextMenuHelper::addRemoveTagsMenu(imageIds& ids)
this, SIGNAL(signalRemoveTag(int)));
}
-void ContextMenuHelper::addPickLabelAction()
-{
- PickLabelMenuAction* menu = new PickLabelMenuAction(d->parent);
- addAction(menu);
-
- connect(menu, SIGNAL(signalPickLabelChanged(int)),
+void ContextMenuHelper::addLabelsAction()
+{
+ KMenu* menuLabels = new KMenu(i18n("Assign Labels"), d->parent);
+ PickLabelMenuAction* pmenu = new PickLabelMenuAction(d->parent);
+ ColorLabelMenuAction* cmenu = new ColorLabelMenuAction(d->parent);
+ RatingMenuAction* rmenu = new RatingMenuAction(d->parent);
+ menuLabels->addAction(pmenu);
+ menuLabels->addAction(cmenu);
+ menuLabels->addAction(rmenu);
+ addSubMenu(menuLabels);
+
+ connect(pmenu, SIGNAL(signalPickLabelChanged(int)),
this, SIGNAL(signalAssignPickLabel(int)));
-}
-
-void ContextMenuHelper::addColorLabelAction()
-{
- ColorLabelMenuAction* menu = new ColorLabelMenuAction(d->parent);
- addAction(menu);
- connect(menu, SIGNAL(signalColorLabelChanged(int)),
+ connect(cmenu, SIGNAL(signalColorLabelChanged(int)),
this, SIGNAL(signalAssignColorLabel(int)));
-}
-
-void ContextMenuHelper::addRatingMenu()
-{
- RatingMenuAction* menu = new RatingMenuAction(d->parent);
- addAction(menu);
- connect(menu, SIGNAL(signalRatingChanged(int)),
+ connect(rmenu, SIGNAL(signalRatingChanged(int)),
this, SIGNAL(signalAssignRating(int)));
}
diff --git a/digikam/contextmenuhelper.h b/digikam/contextmenuhelper.h
index 61c9bd0..ac9ecdc 100644
--- a/digikam/contextmenuhelper.h
+++ b/digikam/contextmenuhelper.h
@@ -280,9 +280,9 @@ public:
void addCreateTagFromAddressbookMenu();
/**
- * Add "Pick Label" action.
+ * Add "Pick/Color/Rating Labels" action.
*
- * This action will provide methods to assign pick label to the currently \
selected items. + * This action will provide methods to assign pick/color/rating \
labels to the currently selected items.
*
* To make this menu work, you need to run exec() from this class, otherwise the \
signals
* are not emitted and you will not be able to react on triggered actions from \
this menu. @@ -290,36 +290,10 @@ public:
*
* @see exec()
* @see signalAssignPickLabel()
+ * @see signalAssignColorLabel()
+ * @see signalAssignRating()
*/
- void addPickLabelAction();
-
- /**
- * Add "Color Label" action.
- *
- * This action will provide methods to assign color label to the currently \
selected items.
- *
- * To make this menu work, you need to run exec() from this class, otherwise the \
signals
- * are not emitted and you will not be able to react on triggered actions from \
this menu.
- * Make sure to connect the signals to the appropriate slots in the context menu \
handling method.
- *
- * @see exec()
- * @see signalAssignColorLabel()
- */
- void addColorLabelAction();
-
- /**
- * Add "Rating" menu.
- *
- * This menu will provide methods to assign ratings to the currently selected \
items.
- *
- * To make this menu work, you need to run exec() from this class, otherwise the \
signals
- * are not emitted and you will not be able to react on triggered actions from \
this menu.
- * Make sure to connect the signals to the appropriate slots in the context menu \
handling method.
- *
- * @see exec()
- * @see signalAssignRating()
- */
- void addRatingMenu();
+ void addLabelsAction();
/**
* Add some of the KIPI actions to the menu.
diff --git a/digikam/digikamimageview.cpp b/digikam/digikamimageview.cpp
index 06d664a..0e1af91 100644
--- a/digikam/digikamimageview.cpp
+++ b/digikam/digikamimageview.cpp
@@ -284,9 +284,7 @@ void DigikamImageView::showContextMenuOnInfo(QContextMenuEvent* \
event, const Ima cmhelper.addRemoveTagsMenu(selectedImageIDs);
cmhelper.addSeparator();
// --------------------------------------------------------
- cmhelper.addPickLabelAction();
- cmhelper.addColorLabelAction();
- cmhelper.addRatingMenu();
+ cmhelper.addLabelsAction();
// special action handling --------------------------------
diff --git a/digikam/imagepreviewview.cpp b/digikam/imagepreviewview.cpp
index 9f5f37b..8e32c27 100644
--- a/digikam/imagepreviewview.cpp
+++ b/digikam/imagepreviewview.cpp
@@ -398,9 +398,7 @@ void ImagePreviewView::showContextMenu(const ImageInfo& info, \
QGraphicsSceneCont
// --------------------------------------------------------
- cmhelper.addPickLabelAction();
- cmhelper.addColorLabelAction();
- cmhelper.addRatingMenu();
+ cmhelper.addLabelsAction();
// special action handling --------------------------------
diff --git a/libs/widgets/common/colorlabelwidget.cpp \
b/libs/widgets/common/colorlabelwidget.cpp index 8cdfa18..89ec38f 100644
--- a/libs/widgets/common/colorlabelwidget.cpp
+++ b/libs/widgets/common/colorlabelwidget.cpp
@@ -506,7 +506,7 @@ void ColorLabelSelector::slotColorLabelChanged(int id)
ColorLabelMenuAction::ColorLabelMenuAction(QMenu* parent)
: KActionMenu(parent)
{
- setText(i18n("Assign Color Label"));
+ setText(i18n("Color"));
QWidgetAction* wa = new QWidgetAction(this);
ColorLabelWidget* clw = new ColorLabelWidget(parent);
wa->setDefaultWidget(clw);
diff --git a/libs/widgets/common/picklabelwidget.cpp \
b/libs/widgets/common/picklabelwidget.cpp index 907500e..af8c66e 100644
--- a/libs/widgets/common/picklabelwidget.cpp
+++ b/libs/widgets/common/picklabelwidget.cpp
@@ -352,7 +352,7 @@ void PickLabelSelector::slotPickLabelChanged(int id)
PickLabelMenuAction::PickLabelMenuAction(QMenu* parent)
: KActionMenu(parent)
{
- setText(i18n("Assign Pick Label"));
+ setText(i18n("Pick"));
QWidgetAction* wa = new QWidgetAction(this);
PickLabelWidget* plw = new PickLabelWidget(parent);
wa->setDefaultWidget(plw);
diff --git a/libs/widgets/common/ratingwidget.cpp \
b/libs/widgets/common/ratingwidget.cpp index 4875622..aa53731 100644
--- a/libs/widgets/common/ratingwidget.cpp
+++ b/libs/widgets/common/ratingwidget.cpp
@@ -516,7 +516,7 @@ void RatingBox::slotUpdateDescription(int rating)
RatingMenuAction::RatingMenuAction(QMenu* parent)
: KActionMenu(parent)
{
- setText(i18n("Assign Rating"));
+ setText(i18n("Rating"));
QWidgetAction* wa = new QWidgetAction(this);
RatingBox* rb = new RatingBox(parent);
wa->setDefaultWidget(rb);
diff --git a/utilities/imageeditor/editor/imagewindow.cpp \
b/utilities/imageeditor/editor/imagewindow.cpp index 3a22ba7..b0818bd 100644
--- a/utilities/imageeditor/editor/imagewindow.cpp
+++ b/utilities/imageeditor/editor/imagewindow.cpp
@@ -798,28 +798,24 @@ void ImageWindow::slotContextMenu()
m_contextMenu->addSeparator();
- // Assign Pick Label -------------------------------------------
-
- PickLabelMenuAction* pickLabelMenu = new PickLabelMenuAction(m_contextMenu);
- m_contextMenu->addAction(pickLabelMenu);
-
- connect(pickLabelMenu, SIGNAL(signalPickLabelChanged(int)),
+ // Assign Labels -------------------------------------------
+
+ KMenu* menuLabels = new KMenu(i18n("Assign Labels"), \
m_contextMenu); + PickLabelMenuAction* pmenu = new \
PickLabelMenuAction(m_contextMenu); + ColorLabelMenuAction* cmenu = new \
ColorLabelMenuAction(m_contextMenu); + RatingMenuAction* rmenu = new \
RatingMenuAction(m_contextMenu); + menuLabels->addAction(pmenu);
+ menuLabels->addAction(cmenu);
+ menuLabels->addAction(rmenu);
+ m_contextMenu->addMenu(menuLabels);
+
+ connect(pmenu, SIGNAL(signalPickLabelChanged(int)),
this, SLOT(slotAssignPickLabel(int)));
- // Assign Color Label -------------------------------------------
-
- ColorLabelMenuAction* colorLabelMenu = new \
ColorLabelMenuAction(m_contextMenu);
- m_contextMenu->addAction(colorLabelMenu);
-
- connect(colorLabelMenu, SIGNAL(signalColorLabelChanged(int)),
+ connect(cmenu, SIGNAL(signalColorLabelChanged(int)),
this, SLOT(slotAssignColorLabel(int)));
- // Assign Star Rating -------------------------------------------
-
- RatingMenuAction* ratingMenu = new RatingMenuAction(m_contextMenu);
- m_contextMenu->addAction(ratingMenu);
-
- connect(ratingMenu, SIGNAL(signalRatingChanged(int)),
+ connect(rmenu, SIGNAL(signalRatingChanged(int)),
this, SLOT(slotAssignRating(int)));
// --------------------------------------------------------------
@@ -828,9 +824,10 @@ void ImageWindow::slotContextMenu()
delete assignTagsMenu;
delete removeTagsMenu;
- delete colorLabelMenu;
- delete pickLabelMenu;
- delete ratingMenu;
+ delete cmenu;
+ delete pmenu;
+ delete rmenu;
+ delete menuLabels;
}
}
diff --git a/utilities/lighttable/lighttablebar.cpp \
b/utilities/lighttable/lighttablebar.cpp index 700d55c..d1ae031 100644
--- a/utilities/lighttable/lighttablebar.cpp
+++ b/utilities/lighttable/lighttablebar.cpp
@@ -919,9 +919,7 @@ void LightTableBar::contentsMouseReleaseEvent(QMouseEvent* e)
cmhelper.addAction(removeAction);
cmhelper.addSeparator();
// ------------------------------------------------
- cmhelper.addPickLabelAction();
- cmhelper.addColorLabelAction();
- cmhelper.addRatingMenu();
+ cmhelper.addLabelsAction();
cmhelper.addSeparator();
// ------------------------------------------------
}
diff --git a/utilities/lighttable/lighttablepreview.cpp \
b/utilities/lighttable/lighttablepreview.cpp index 9e136e0..c3d2d24 100644
--- a/utilities/lighttable/lighttablepreview.cpp
+++ b/utilities/lighttable/lighttablepreview.cpp
@@ -392,9 +392,7 @@ void LightTablePreview::slotContextMenu()
cmhelper.addRemoveTagsMenu(idList);
cmhelper.addSeparator();
// --------------------------------------------------------
- cmhelper.addPickLabelAction();
- cmhelper.addColorLabelAction();
- cmhelper.addRatingMenu();
+ cmhelper.addLabelsAction();
// special action handling --------------------------------
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic