comparison main/MainWindow.cpp @ 703:049a9418cc27

Start up with the correct values of toggleable menu entries
author Chris Cannam
date Fri, 28 Mar 2014 15:43:04 +0000
parents 7f7fba33b7de
children d1c5444be23d
comparison
equal deleted inserted replaced
702:c7945dad2f49 703:049a9418cc27
912 action = new QAction(tr("Show &Centre Line"), this); 912 action = new QAction(tr("Show &Centre Line"), this);
913 action->setShortcut(tr("'")); 913 action->setShortcut(tr("'"));
914 action->setStatusTip(tr("Show or hide the centre line")); 914 action->setStatusTip(tr("Show or hide the centre line"));
915 connect(action, SIGNAL(triggered()), this, SLOT(toggleCentreLine())); 915 connect(action, SIGNAL(triggered()), this, SLOT(toggleCentreLine()));
916 action->setCheckable(true); 916 action->setCheckable(true);
917 action->setChecked(true); 917 action->setChecked(m_viewManager->shouldShowCentreLine());
918 m_keyReference->registerShortcut(action); 918 m_keyReference->registerShortcut(action);
919 menu->addAction(action); 919 menu->addAction(action);
920 920
921 action = new QAction(tr("Toggle All Time Rulers"), this); 921 action = new QAction(tr("Toggle All Time Rulers"), this);
922 action->setShortcut(tr("#")); 922 action->setShortcut(tr("#"));
927 927
928 menu->addSeparator(); 928 menu->addSeparator();
929 929
930 QActionGroup *overlayGroup = new QActionGroup(this); 930 QActionGroup *overlayGroup = new QActionGroup(this);
931 931
932 ViewManager::OverlayMode mode = m_viewManager->getOverlayMode();
933
932 action = new QAction(tr("Show &No Overlays"), this); 934 action = new QAction(tr("Show &No Overlays"), this);
933 action->setShortcut(tr("0")); 935 action->setShortcut(tr("0"));
934 action->setStatusTip(tr("Hide times, layer names, and scale")); 936 action->setStatusTip(tr("Hide times, layer names, and scale"));
935 connect(action, SIGNAL(triggered()), this, SLOT(showNoOverlays())); 937 connect(action, SIGNAL(triggered()), this, SLOT(showNoOverlays()));
936 action->setCheckable(true); 938 action->setCheckable(true);
937 action->setChecked(false); 939 action->setChecked(mode == ViewManager::NoOverlays);
938 overlayGroup->addAction(action); 940 overlayGroup->addAction(action);
939 m_keyReference->registerShortcut(action); 941 m_keyReference->registerShortcut(action);
940 menu->addAction(action); 942 menu->addAction(action);
941 943
942 action = new QAction(tr("Show &Minimal Overlays"), this); 944 action = new QAction(tr("Show &Minimal Overlays"), this);
943 action->setShortcut(tr("9")); 945 action->setShortcut(tr("9"));
944 action->setStatusTip(tr("Show times and basic scale")); 946 action->setStatusTip(tr("Show times and basic scale"));
945 connect(action, SIGNAL(triggered()), this, SLOT(showMinimalOverlays())); 947 connect(action, SIGNAL(triggered()), this, SLOT(showMinimalOverlays()));
946 action->setCheckable(true); 948 action->setCheckable(true);
947 action->setChecked(true); 949 action->setChecked(mode == ViewManager::MinimalOverlays);
948 overlayGroup->addAction(action); 950 overlayGroup->addAction(action);
949 m_keyReference->registerShortcut(action); 951 m_keyReference->registerShortcut(action);
950 menu->addAction(action); 952 menu->addAction(action);
951 953
952 action = new QAction(tr("Show &All Overlays"), this); 954 action = new QAction(tr("Show &All Overlays"), this);
953 action->setShortcut(tr("8")); 955 action->setShortcut(tr("8"));
954 action->setStatusTip(tr("Show times, layer names, and scale")); 956 action->setStatusTip(tr("Show times, layer names, and scale"));
955 connect(action, SIGNAL(triggered()), this, SLOT(showAllOverlays())); 957 connect(action, SIGNAL(triggered()), this, SLOT(showAllOverlays()));
956 action->setCheckable(true); 958 action->setCheckable(true);
957 action->setChecked(false); 959 action->setChecked(mode == ViewManager::AllOverlays);
958 overlayGroup->addAction(action); 960 overlayGroup->addAction(action);
959 m_keyReference->registerShortcut(action); 961 m_keyReference->registerShortcut(action);
960 menu->addAction(action); 962 menu->addAction(action);
961 963
962 menu->addSeparator(); 964 menu->addSeparator();