Changeset View
Changeset View
Standalone View
Standalone View
kstars/kstarsinit.cpp
Show First 20 Lines • Show All 125 Lines • ▼ Show 20 Line(s) | |||||
126 | QAction *newToggleAction(KActionCollection *col, QString name, QString text, QObject *receiver, const char *member) | 126 | QAction *newToggleAction(KActionCollection *col, QString name, QString text, QObject *receiver, const char *member) | ||
127 | { | 127 | { | ||
128 | QAction *ka = col->add<KToggleAction>(name) << text; | 128 | QAction *ka = col->add<KToggleAction>(name) << text; | ||
129 | QObject::connect(ka, SIGNAL(toggled(bool)), receiver, member); | 129 | QObject::connect(ka, SIGNAL(toggled(bool)), receiver, member); | ||
130 | return ka; | 130 | return ka; | ||
131 | } | 131 | } | ||
132 | } | 132 | } | ||
133 | 133 | | |||
134 | // Resource file override - used by UI tests | ||||
135 | QString KStars::m_KStarsUIResource = "kstarsui.rc"; | ||||
murveit: FWIW, I would have preferred this to be either in the header or at the top of the file, just to… | |||||
136 | bool KStars::setResourceFile(QString const rc) | ||||
137 | { | ||||
138 | if (QFile(rc).exists()) | ||||
139 | { | ||||
140 | m_KStarsUIResource = rc; | ||||
141 | return true; | ||||
142 | } | ||||
143 | else return false; | ||||
144 | } | ||||
145 | | ||||
146 | | ||||
134 | void KStars::initActions() | 147 | void KStars::initActions() | ||
135 | { | 148 | { | ||
136 | // Check if we have this specific Breeze icon. If not, try to set the theme search path and if appropriate, the icon theme rcc file | 149 | // Check if we have this specific Breeze icon. If not, try to set the theme search path and if appropriate, the icon theme rcc file | ||
137 | // in each OS | 150 | // in each OS | ||
138 | if (!QIcon::hasThemeIcon(QLatin1String("kstars_flag"))) | 151 | if (!QIcon::hasThemeIcon(QLatin1String("kstars_flag"))) | ||
139 | KSTheme::Manager::instance()->setIconTheme(KSTheme::Manager::BREEZE_DARK_THEME); | 152 | KSTheme::Manager::instance()->setIconTheme(KSTheme::Manager::BREEZE_DARK_THEME); | ||
140 | 153 | | |||
141 | QAction *ka; | 154 | QAction *ka; | ||
▲ Show 20 Lines • Show All 786 Lines • ▼ Show 20 Line(s) | 936 | { | |||
928 | connect(m_SkyMap, SIGNAL(mousePointChanged(SkyPoint*)), SLOT(slotShowPositionBar(SkyPoint*))); | 941 | connect(m_SkyMap, SIGNAL(mousePointChanged(SkyPoint*)), SLOT(slotShowPositionBar(SkyPoint*))); | ||
929 | connect(m_SkyMap, SIGNAL(zoomChanged()), SLOT(slotZoomChanged())); | 942 | connect(m_SkyMap, SIGNAL(zoomChanged()), SLOT(slotZoomChanged())); | ||
930 | setCentralWidget(m_SkyMap); | 943 | setCentralWidget(m_SkyMap); | ||
931 | 944 | | |||
932 | //Initialize menus, toolbars, and statusbars | 945 | //Initialize menus, toolbars, and statusbars | ||
933 | initStatusBar(); | 946 | initStatusBar(); | ||
934 | initActions(); | 947 | initActions(); | ||
935 | 948 | | |||
936 | // Provide resource file explicitely for UI tests to display resources properly | 949 | // Setup GUI from the settings file | ||
937 | setupGUI(StandardWindowOptions(Default), ":/kxmlgui5/kstars/kstarsui.rc"); | 950 | // UI tests provide the default settings file from the resources explicitly file to render UI properly | ||
951 | setupGUI(StandardWindowOptions(Default), m_KStarsUIResource); | ||||
938 | 952 | | |||
939 | //get focus of keyboard and mouse actions (for example zoom in with +) | 953 | //get focus of keyboard and mouse actions (for example zoom in with +) | ||
940 | map()->QWidget::setFocus(); | 954 | map()->QWidget::setFocus(); | ||
941 | resize(Options::windowWidth(), Options::windowHeight()); | 955 | resize(Options::windowWidth(), Options::windowHeight()); | ||
942 | 956 | | |||
943 | // check zoom in/out buttons | 957 | // check zoom in/out buttons | ||
944 | if (Options::zoomFactor() >= MAXZOOM) | 958 | if (Options::zoomFactor() >= MAXZOOM) | ||
945 | actionCollection()->action("zoom_in")->setEnabled(false); | 959 | actionCollection()->action("zoom_in")->setEnabled(false); | ||
Show All 16 Lines |
FWIW, I would have preferred this to be either in the header or at the top of the file, just to make the constant more visible, but I don't know if we have a standard on that. In any event, I'm certainly OK with this this also proceeding as is and being merged into the codebase.