Qt4 front-end improvements:
- Added light time delay to Time menu - Created Display menu, with actions to toggle various rendering features and control star visibility (limiting magnitude and automag) - Added all new actions to CelestiaActions pool; these can be used in the toolbar, menu, or (with slightly more effort) in a preferences dialog.ver1_6_1
parent
9040afc7f9
commit
1032bb17ab
|
@ -1008,6 +1008,37 @@ void CelestiaAppWindow::createMenus()
|
|||
connect(setTimeAct, SIGNAL(triggered()), this, SLOT(slotShowTimeDialog()));
|
||||
timeMenu->addAction(setTimeAct);
|
||||
|
||||
timeMenu->addAction(actions->lightTimeDelayAction);
|
||||
|
||||
|
||||
/****** Display menu ******/
|
||||
displayMenu = menuBar()->addMenu(tr("&Display"));
|
||||
displayMenu->addAction(actions->atmospheresAction);
|
||||
displayMenu->addAction(actions->cloudsAction);
|
||||
displayMenu->addAction(actions->cometTailsAction);
|
||||
displayMenu->addAction(actions->nightSideLightsAction);
|
||||
|
||||
QMenu* deepSkyMenu = displayMenu->addMenu(tr("Dee&p Sky Objects"));
|
||||
deepSkyMenu->addAction(actions->galaxiesAction);
|
||||
deepSkyMenu->addAction(actions->nebulaeAction);
|
||||
|
||||
QMenu* shadowMenu = displayMenu->addMenu(tr("&Shadows"));
|
||||
shadowMenu->addAction(actions->ringShadowsAction);
|
||||
shadowMenu->addAction(actions->eclipseShadowsAction);
|
||||
shadowMenu->addAction(actions->cloudShadowsAction);
|
||||
|
||||
displayMenu->addSeparator();
|
||||
|
||||
displayMenu->addAction(actions->increaseLimitingMagAction);
|
||||
displayMenu->addAction(actions->decreaseLimitingMagAction);
|
||||
displayMenu->addAction(actions->autoMagAction);
|
||||
|
||||
QMenu* starStyleMenu = displayMenu->addMenu(tr("Star St&yle"));
|
||||
starStyleMenu->addAction(actions->pointStarAction);
|
||||
starStyleMenu->addAction(actions->fuzzyPointStarAction);
|
||||
starStyleMenu->addAction(actions->scaledDiscStarAction);
|
||||
|
||||
|
||||
/****** Bookmark menu ******/
|
||||
bookmarkMenu = menuBar()->addMenu(tr("&Bookmarks"));
|
||||
|
||||
|
|
|
@ -120,6 +120,7 @@ class CelestiaAppWindow : public QMainWindow
|
|||
QMenu* fileMenu;
|
||||
QMenu* navMenu;
|
||||
QMenu* timeMenu;
|
||||
QMenu* displayMenu;
|
||||
QMenu* bookmarkMenu;
|
||||
QMenu* viewMenu;
|
||||
QMenu* helpMenu;
|
||||
|
|
|
@ -125,23 +125,86 @@ CelestiaActions::CelestiaActions(QObject* parent,
|
|||
labelLocationsAction = createCheckableAction(tr("Locations"), labelsMenu, Renderer::LocationLabels);
|
||||
labelConstellationsAction = createCheckableAction(tr("Constellations"), labelsMenu, Renderer::ConstellationLabels);
|
||||
|
||||
connect(labelGalaxiesAction, SIGNAL(triggered()), this, SLOT(slotToggleLabel()));
|
||||
connect(labelNebulaeAction, SIGNAL(triggered()), this, SLOT(slotToggleLabel()));
|
||||
connect(labelOpenClustersAction, SIGNAL(triggered()), this, SLOT(slotToggleLabel()));
|
||||
connect(labelStarsAction, SIGNAL(triggered()), this, SLOT(slotToggleLabel()));
|
||||
connect(labelPlanetsAction, SIGNAL(triggered()), this, SLOT(slotToggleLabel()));
|
||||
connect(labelDwarfPlanetsAction, SIGNAL(triggered()), this, SLOT(slotToggleLabel()));
|
||||
connect(labelMoonsAction, SIGNAL(triggered()), this, SLOT(slotToggleLabel()));
|
||||
connect(labelMinorMoonsAction, SIGNAL(triggered()), this, SLOT(slotToggleLabel()));
|
||||
connect(labelAsteroidsAction, SIGNAL(triggered()), this, SLOT(slotToggleLabel()));
|
||||
connect(labelCometsAction, SIGNAL(triggered()), this, SLOT(slotToggleLabel()));
|
||||
connect(labelSpacecraftAction, SIGNAL(triggered()), this, SLOT(slotToggleLabel()));
|
||||
connect(labelLocationsAction, SIGNAL(triggered()), this, SLOT(slotToggleLabel()));
|
||||
connect(labelGalaxiesAction, SIGNAL(triggered()), this, SLOT(slotToggleLabel()));
|
||||
connect(labelNebulaeAction, SIGNAL(triggered()), this, SLOT(slotToggleLabel()));
|
||||
connect(labelOpenClustersAction, SIGNAL(triggered()), this, SLOT(slotToggleLabel()));
|
||||
connect(labelStarsAction, SIGNAL(triggered()), this, SLOT(slotToggleLabel()));
|
||||
connect(labelPlanetsAction, SIGNAL(triggered()), this, SLOT(slotToggleLabel()));
|
||||
connect(labelDwarfPlanetsAction, SIGNAL(triggered()), this, SLOT(slotToggleLabel()));
|
||||
connect(labelMoonsAction, SIGNAL(triggered()), this, SLOT(slotToggleLabel()));
|
||||
connect(labelMinorMoonsAction, SIGNAL(triggered()), this, SLOT(slotToggleLabel()));
|
||||
connect(labelAsteroidsAction, SIGNAL(triggered()), this, SLOT(slotToggleLabel()));
|
||||
connect(labelCometsAction, SIGNAL(triggered()), this, SLOT(slotToggleLabel()));
|
||||
connect(labelSpacecraftAction, SIGNAL(triggered()), this, SLOT(slotToggleLabel()));
|
||||
connect(labelLocationsAction, SIGNAL(triggered()), this, SLOT(slotToggleLabel()));
|
||||
connect(labelConstellationsAction, SIGNAL(triggered()), this, SLOT(slotToggleLabel()));
|
||||
|
||||
labelsAction->setMenu(labelsMenu);
|
||||
|
||||
galaxiesAction = createCheckableAction(tr("Galaxies"), Renderer::ShowGalaxies);
|
||||
galaxiesAction->setShortcut(QString("U"));
|
||||
nebulaeAction = createCheckableAction(tr("Nebulae"), Renderer::ShowNebulae);
|
||||
nebulaeAction->setShortcut(QString("^"));
|
||||
openClustersAction = createCheckableAction(tr("Open Clusters"), Renderer::ShowOpenClusters);
|
||||
connect(galaxiesAction, SIGNAL(triggered()), this, SLOT(slotToggleRenderFlag()));
|
||||
connect(nebulaeAction, SIGNAL(triggered()), this, SLOT(slotToggleRenderFlag()));
|
||||
connect(openClustersAction, SIGNAL(triggered()), this, SLOT(slotToggleRenderFlag()));
|
||||
|
||||
cloudsAction = createCheckableAction(tr("Clouds"), Renderer::ShowCloudMaps);
|
||||
cloudsAction->setShortcut(QString("I"));
|
||||
nightSideLightsAction = createCheckableAction(tr("Night Side Lights"), Renderer::ShowNightMaps);
|
||||
nightSideLightsAction->setShortcut(QString("Ctrl+L"));
|
||||
cometTailsAction = createCheckableAction(tr("Comet Tails"), Renderer::ShowCometTails);
|
||||
atmospheresAction = createCheckableAction(tr("Atmospheres"), Renderer::ShowAtmospheres);
|
||||
atmospheresAction->setShortcut(QString("Ctrl+A"));
|
||||
connect(cloudsAction, SIGNAL(triggered()), this, SLOT(slotToggleRenderFlag()));
|
||||
connect(nightSideLightsAction, SIGNAL(triggered()), this, SLOT(slotToggleRenderFlag()));
|
||||
connect(cometTailsAction, SIGNAL(triggered()), this, SLOT(slotToggleRenderFlag()));
|
||||
connect(atmospheresAction, SIGNAL(triggered()), this, SLOT(slotToggleRenderFlag()));
|
||||
|
||||
ringShadowsAction = createCheckableAction(tr("Ring Shadows"), Renderer::ShowRingShadows);
|
||||
eclipseShadowsAction = createCheckableAction(tr("Eclipse Shadows"), Renderer::ShowEclipseShadows);
|
||||
eclipseShadowsAction->setShortcut(QKeySequence("Ctrl+E"));
|
||||
cloudShadowsAction = createCheckableAction(tr("Cloud Shadows"), Renderer::ShowCloudShadows);
|
||||
connect(ringShadowsAction, SIGNAL(triggered()), this, SLOT(slotToggleRenderFlag()));
|
||||
connect(eclipseShadowsAction, SIGNAL(triggered()), this, SLOT(slotToggleRenderFlag()));
|
||||
connect(cloudShadowsAction, SIGNAL(triggered()), this, SLOT(slotToggleRenderFlag()));
|
||||
|
||||
lowResAction = createCheckableAction(tr("Low"), lores);
|
||||
mediumResAction = createCheckableAction(tr("Medium"), lores);
|
||||
highResAction = createCheckableAction(tr("High"), lores);
|
||||
connect(lowResAction, SIGNAL(triggered()), this, SLOT(slotSetTextureResolution()));
|
||||
connect(mediumResAction, SIGNAL(triggered()), this, SLOT(slotSetTextureResolution()));
|
||||
connect(highResAction, SIGNAL(triggered()), this, SLOT(slotSetTextureResolution()));
|
||||
|
||||
autoMagAction = createCheckableAction(tr("Auto Magnitude"), Renderer::ShowAutoMag);
|
||||
autoMagAction->setShortcut(QKeySequence("Ctrl+Y"));
|
||||
autoMagAction->setToolTip(tr("Faintest visible magnitude based on field of view"));
|
||||
connect(autoMagAction, SIGNAL(triggered()), this, SLOT(slotToggleRenderFlag()));
|
||||
|
||||
increaseLimitingMagAction = new QAction(tr("More Stars Visible"), this);
|
||||
increaseLimitingMagAction->setData(0.1);
|
||||
increaseLimitingMagAction->setShortcut(QString("]"));
|
||||
decreaseLimitingMagAction = new QAction(tr("Fewer Stars Visible"), this);
|
||||
decreaseLimitingMagAction->setData(-0.1);
|
||||
decreaseLimitingMagAction->setShortcut(QString("["));
|
||||
connect(increaseLimitingMagAction, SIGNAL(triggered()), this, SLOT(slotAdjustLimitingMagnitude()));
|
||||
connect(decreaseLimitingMagAction, SIGNAL(triggered()), this, SLOT(slotAdjustLimitingMagnitude()));
|
||||
|
||||
pointStarAction = createCheckableAction(tr("Points"), Renderer::PointStars);
|
||||
fuzzyPointStarAction = createCheckableAction(tr("Fuzzy Points"), Renderer::FuzzyPointStars);
|
||||
scaledDiscStarAction = createCheckableAction(tr("Scaled Discs"), Renderer::ScaledDiscStars);
|
||||
connect(pointStarAction, SIGNAL(triggered()), this, SLOT(slotSetStarStyle()));
|
||||
connect(fuzzyPointStarAction, SIGNAL(triggered()), this, SLOT(slotSetStarStyle()));
|
||||
connect(scaledDiscStarAction, SIGNAL(triggered()), this, SLOT(slotSetStarStyle()));
|
||||
|
||||
lightTimeDelayAction = new QAction(tr("Light Time Delay"), this);
|
||||
lightTimeDelayAction->setCheckable(true);
|
||||
lightTimeDelayAction->setToolTip("Subtract one-way light travel time to selected object");
|
||||
connect(lightTimeDelayAction, SIGNAL(triggered()), this, SLOT(slotSetLightTimeDelay()));
|
||||
|
||||
syncWithRenderer(appCore->getRenderer());
|
||||
syncWithAppCore();
|
||||
appCore->getRenderer()->addWatcher(this);
|
||||
}
|
||||
|
||||
|
@ -157,6 +220,8 @@ void CelestiaActions::syncWithRenderer(const Renderer* renderer)
|
|||
int renderFlags = renderer->getRenderFlags();
|
||||
int labelMode = renderer->getLabelMode();
|
||||
int orbitMask = renderer->getOrbitMask();
|
||||
int textureRes = renderer->getResolution();
|
||||
Renderer::StarStyle starStyle = renderer->getStarStyle();
|
||||
|
||||
eqGridAction->setChecked(renderFlags & Renderer::ShowCelestialSphere);
|
||||
markersAction->setChecked(renderFlags & Renderer::ShowMarkers);
|
||||
|
@ -186,6 +251,41 @@ void CelestiaActions::syncWithRenderer(const Renderer* renderer)
|
|||
asteroidOrbitsAction->setChecked(orbitMask & Body::Asteroid);
|
||||
cometOrbitsAction->setChecked(orbitMask & Body::Comet);
|
||||
spacecraftOrbitsAction->setChecked(orbitMask & Body::Spacecraft);
|
||||
|
||||
// Texture resolution
|
||||
lowResAction->setChecked(textureRes == lores);
|
||||
mediumResAction->setChecked(textureRes == medres);
|
||||
highResAction->setChecked(textureRes == hires);
|
||||
|
||||
// Star style
|
||||
pointStarAction->setChecked(starStyle == Renderer::PointStars);
|
||||
fuzzyPointStarAction->setChecked(starStyle == Renderer::FuzzyPointStars);
|
||||
scaledDiscStarAction->setChecked(starStyle == Renderer::ScaledDiscStars);
|
||||
|
||||
// Features
|
||||
cloudsAction->setChecked(renderFlags & Renderer::ShowCloudMaps);
|
||||
cometTailsAction->setChecked(renderFlags & Renderer::ShowCometTails);
|
||||
atmospheresAction->setChecked(renderFlags & Renderer::ShowAtmospheres);
|
||||
nightSideLightsAction->setChecked(renderFlags & Renderer::ShowNightMaps);
|
||||
|
||||
// Deep sky object visibility
|
||||
galaxiesAction->setChecked(renderFlags & Renderer::ShowGalaxies);
|
||||
nebulaeAction->setChecked(renderFlags & Renderer::ShowNebulae);
|
||||
openClustersAction->setChecked(renderFlags & Renderer::ShowOpenClusters);
|
||||
|
||||
// Shadows
|
||||
ringShadowsAction->setChecked(renderFlags & Renderer::ShowRingShadows);
|
||||
eclipseShadowsAction->setChecked(renderFlags & Renderer::ShowEclipseShadows);
|
||||
cloudShadowsAction->setChecked(renderFlags & Renderer::ShowCloudShadows);
|
||||
|
||||
// Star visibility
|
||||
autoMagAction->setChecked(renderFlags & Renderer::ShowAutoMag);
|
||||
}
|
||||
|
||||
|
||||
void CelestiaActions::syncWithAppCore()
|
||||
{
|
||||
lightTimeDelayAction->setChecked(appCore->getLightDelayActive());
|
||||
}
|
||||
|
||||
|
||||
|
@ -228,6 +328,66 @@ void CelestiaActions::slotToggleOrbit()
|
|||
}
|
||||
|
||||
|
||||
void CelestiaActions::slotSetStarStyle()
|
||||
{
|
||||
QAction* act = qobject_cast<QAction*>(sender());
|
||||
if (act != NULL)
|
||||
{
|
||||
Renderer::StarStyle starStyle = (Renderer::StarStyle) act->data().toInt();
|
||||
appCore->getRenderer()->setStarStyle(starStyle);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CelestiaActions::slotSetTextureResolution()
|
||||
{
|
||||
QAction* act = qobject_cast<QAction*>(sender());
|
||||
if (act != NULL)
|
||||
{
|
||||
int textureResolution = act->data().toInt();
|
||||
appCore->getRenderer()->setResolution(textureResolution);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CelestiaActions::slotAdjustLimitingMagnitude()
|
||||
{
|
||||
QAction* act = qobject_cast<QAction*>(sender());
|
||||
if (act != NULL)
|
||||
{
|
||||
Renderer* renderer = appCore->getRenderer();
|
||||
float change = (float) act->data().toDouble();
|
||||
|
||||
QString notification;
|
||||
if (renderer->getRenderFlags() & Renderer::ShowAutoMag)
|
||||
{
|
||||
float newLimitingMag = qBound(6.0f, renderer->getFaintestAM45deg() + change, 12.0f);
|
||||
renderer->setFaintestAM45deg(newLimitingMag);
|
||||
appCore->setFaintestAutoMag();
|
||||
|
||||
notification = tr("Auto magnitude limit at 45 degrees: %L1").arg(newLimitingMag, 0, 'f', 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
float newLimitingMag = qBound(1.0f, appCore->getSimulation()->getFaintestVisible() + change * 2, 15.0f);
|
||||
appCore->setFaintest(newLimitingMag);
|
||||
|
||||
notification = tr("Magnitude limit: %L1").arg(newLimitingMag, 0, 'f', 2);
|
||||
}
|
||||
|
||||
appCore->flash(notification.toUtf8().data());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CelestiaActions::slotSetLightTimeDelay()
|
||||
{
|
||||
// TODO: CelestiaCore class should offer an API for enabling/disabling light
|
||||
// time delay.
|
||||
appCore->charEntered('-');
|
||||
}
|
||||
|
||||
|
||||
// Convenience method to create a checkable action for a menu and set the data
|
||||
// to the specified integer value.
|
||||
QAction* CelestiaActions::createCheckableAction(const QString& text, QMenu* menu, int data)
|
||||
|
@ -239,3 +399,15 @@ QAction* CelestiaActions::createCheckableAction(const QString& text, QMenu* menu
|
|||
|
||||
return act;
|
||||
}
|
||||
|
||||
|
||||
// Convenience method to create a checkable action and set the data
|
||||
// to the specified integer value.
|
||||
QAction* CelestiaActions::createCheckableAction(const QString& text, int data)
|
||||
{
|
||||
QAction* act = new QAction(text, this);
|
||||
act->setCheckable(true);
|
||||
act->setData(data);
|
||||
|
||||
return act;
|
||||
}
|
||||
|
|
|
@ -35,10 +35,16 @@ Q_OBJECT
|
|||
void slotToggleRenderFlag();
|
||||
void slotToggleLabel();
|
||||
void slotToggleOrbit();
|
||||
void slotSetStarStyle();
|
||||
void slotSetTextureResolution();
|
||||
void slotAdjustLimitingMagnitude();
|
||||
void slotSetLightTimeDelay();
|
||||
|
||||
private:
|
||||
void syncWithRenderer(const Renderer* renderer);
|
||||
void syncWithAppCore();
|
||||
QAction* createCheckableAction(const QString& text, QMenu* menu, int data);
|
||||
QAction* createCheckableAction(const QString& text, int data);
|
||||
|
||||
public:
|
||||
QAction* eqGridAction;
|
||||
|
@ -77,6 +83,32 @@ Q_OBJECT
|
|||
|
||||
QAction* labelsAction;
|
||||
|
||||
QAction* cloudsAction;
|
||||
QAction* cometTailsAction;
|
||||
QAction* atmospheresAction;
|
||||
QAction* nightSideLightsAction;
|
||||
QAction* ringShadowsAction;
|
||||
QAction* eclipseShadowsAction;
|
||||
QAction* cloudShadowsAction;
|
||||
|
||||
QAction* lightTimeDelayAction;
|
||||
|
||||
QAction* verbosityLowAction;
|
||||
QAction* verbosityMediumAction;
|
||||
QAction* verbosityHighAction;
|
||||
|
||||
QAction* lowResAction;
|
||||
QAction* mediumResAction;
|
||||
QAction* highResAction;
|
||||
|
||||
QAction* pointStarAction;
|
||||
QAction* fuzzyPointStarAction;
|
||||
QAction* scaledDiscStarAction;
|
||||
|
||||
QAction* autoMagAction;
|
||||
QAction* increaseLimitingMagAction;
|
||||
QAction* decreaseLimitingMagAction;
|
||||
|
||||
private:
|
||||
CelestiaCore* appCore;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue