[Kstars-devel] [kstars] kstars: Move image and info links in the popup menu into dedicated submenus.

Akarsh Simha akarsh.simha at kdemail.net
Tue May 14 06:31:14 UTC 2013


Git commit d6fabeb5a8d9d77e948e9b204598b50a5256ea35 by Akarsh Simha.
Committed on 14/05/2013 at 08:12.
Pushed by asimha into branch 'master'.

Move image and info links in the popup menu into dedicated submenus.

The popup menu for some objects would end up becoming too long because
of the number of information and image links. So moving them into
dedicated submenus helps keep the context menu short and improves
usability. Besides, grouping the links as image / info resources helps
users find them more easily.

I decided not to put the DSS / SDSS imagery under the image links
submenu, because they are available for any point on the sky (within
the footprints of the surveys). If we ever create a submenu for sky
surveys, it should possibly go in there.

CCMAIL: kstars-devel at kde.org

M  +20   -11   kstars/kspopupmenu.cpp

http://commits.kde.org/kstars/d6fabeb5a8d9d77e948e9b204598b50a5256ea35

diff --git a/kstars/kspopupmenu.cpp b/kstars/kspopupmenu.cpp
index bd73587..766c265 100644
--- a/kstars/kspopupmenu.cpp
+++ b/kstars/kspopupmenu.cpp
@@ -414,12 +414,16 @@ void KSPopupMenu::addLinksToMenu( SkyObject *obj, bool showDSS ) {
     itList  = obj->ImageList().constBegin();
     itTitle = obj->ImageTitle().constBegin();
     itListEnd = obj->ImageList().constEnd();
-
-    for ( ; itList != itListEnd; ++itList ) {
-        QString t = QString(*itTitle);
-        sURL = QString(*itList);
-        addAction( i18nc( "Image/info menu item (should be translated)", t.toLocal8Bit() ), ks->map(), SLOT( slotImage() ) );
-        ++itTitle;
+    if( ! obj->ImageList().isEmpty() ) {
+        QMenu *imageLinkSubMenu= new QMenu();
+        imageLinkSubMenu->setTitle( i18n( "Image Resources" ) );
+        for ( ; itList != itListEnd; ++itList ) {
+            QString t = QString(*itTitle);
+            sURL = QString(*itList);
+            imageLinkSubMenu->addAction( i18nc( "Image/info menu item (should be translated)", t.toLocal8Bit() ), ks->map(), SLOT( slotImage() ) );
+            ++itTitle;
+        }
+        addMenu( imageLinkSubMenu );
     }
 
     if ( showDSS ) {
@@ -434,11 +438,16 @@ void KSPopupMenu::addLinksToMenu( SkyObject *obj, bool showDSS ) {
     itTitle = obj->InfoTitle().constBegin();
     itListEnd = obj->InfoList().constEnd();
 
-    for ( ; itList != itListEnd; ++itList ) {
-        QString t = QString(*itTitle);
-        sURL = QString(*itList);
-        addAction( i18nc( "Image/info menu item (should be translated)", t.toLocal8Bit() ), ks->map(), SLOT( slotInfo() ) );
-        ++itTitle;
+    if( ! obj->InfoList().isEmpty() ) {
+        QMenu *infoLinkSubMenu= new QMenu();
+        infoLinkSubMenu->setTitle( i18n( "Information Resources" ) );
+        for ( ; itList != itListEnd; ++itList ) {
+            QString t = QString(*itTitle);
+            sURL = QString(*itList);
+            infoLinkSubMenu->addAction( i18nc( "Image/info menu item (should be translated)", t.toLocal8Bit() ), ks->map(), SLOT( slotInfo() ) );
+            ++itTitle;
+        }
+        addMenu( infoLinkSubMenu );
     }
 }
 



More information about the Kstars-devel mailing list