kdepreferencesdialog.cpp
来自「celestia源代码」· C++ 代码 · 共 746 行 · 第 1/3 页
CPP
746 行
/*************************************************************************** kdepreferencesdialog.cpp - description ------------------- begin : Sun Jul 21 2002 copyright : (C) 2002 by chris email : chris@tux.teyssier.org ***************************************************************************//*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/#include <qvbox.h>#include <kmainwindow.h>#include <kpushbutton.h>#include <qtextedit.h>#include <qcombobox.h>#include <klocale.h>#include <kconfig.h>#include <kiconloader.h>#include <qframe.h>#include <qgrid.h>#include <qcheckbox.h>#include <qvgroupbox.h>#include <qslider.h>#include <kkeydialog.h>#include <qspinbox.h>#include <qlabel.h>#include <qlayout.h>#include "kdeapp.h"#include "kdepreferencesdialog.h"#include "celengine/render.h"#include "celengine/glcontext.h"static uint32 FilterOtherLocations = ~(Location::City | Location::Observatory | Location::LandingSite | Location::Crater | Location::Mons | Location::Terra | Location::Vallis | Location::Mare);KdePreferencesDialog::KdePreferencesDialog(QWidget* parent, CelestiaCore* core) : KDialogBase (KDialogBase::IconList, "", KDialogBase::Ok | KDialogBase::Apply | KDialogBase::Cancel, KDialogBase::Ok,parent){ setCaption(i18n("Celestia Preferences")); appCore=core; this->parent = (KdeApp*)parent; // Render page QGrid* renderFrame = addGridPage(2, Qt::Horizontal, i18n("Rendering"), i18n("Rendering"), KGlobal::iconLoader()->loadIcon("configure", KIcon::NoGroup)); int renderFlags = appCore->getRenderer()->getRenderFlags(); savedRendererFlags = renderFlags; KActionCollection* actionColl = ((KdeApp*)parent)->actionCollection(); QGroupBox* showGroup = new QGroupBox(1, Qt::Horizontal, i18n("Show"), renderFrame); QCheckBox* showStarsCheck = new QCheckBox(i18n("Stars"), showGroup); actionColl->action("showStars")->connect(showStarsCheck, SIGNAL(clicked()), SLOT(activate())); showStarsCheck->setChecked(renderFlags & Renderer::ShowStars); QCheckBox* showAutoMagCheck = new QCheckBox(i18n("Auto Magnitudes"), showGroup); actionColl->action("showAutoMag")->connect(showAutoMagCheck, SIGNAL(clicked()), SLOT(activate())); showAutoMagCheck->setChecked(renderFlags & Renderer::ShowAutoMag); QCheckBox* showPlanetsCheck = new QCheckBox(i18n("Planets"), showGroup); actionColl->action("showPlanets")->connect(showPlanetsCheck, SIGNAL(clicked()), SLOT(activate())); showPlanetsCheck->setChecked(renderFlags & Renderer::ShowPlanets); QCheckBox* showGalaxiesCheck = new QCheckBox(i18n("Galaxies"), showGroup); actionColl->action("showGalaxies")->connect(showGalaxiesCheck, SIGNAL(clicked()), SLOT(activate())); showGalaxiesCheck->setChecked(renderFlags & Renderer::ShowGalaxies); QCheckBox* showNebulaeCheck = new QCheckBox(i18n("Nebulae"), showGroup); actionColl->action("showNebulae")->connect(showNebulaeCheck, SIGNAL(clicked()), SLOT(activate())); showNebulaeCheck->setChecked(renderFlags & Renderer::ShowNebulae); QCheckBox* showOpenClustersCheck = new QCheckBox(i18n("Open Clusters"), showGroup); actionColl->action("showOpenClusters")->connect(showOpenClustersCheck, SIGNAL(clicked()), SLOT(activate())); showOpenClustersCheck->setChecked(renderFlags & Renderer::ShowOpenClusters); QCheckBox* showAtmospheresCheck = new QCheckBox(i18n("Atmospheres"), showGroup); actionColl->action("showAtmospheres")->connect(showAtmospheresCheck, SIGNAL(clicked()), SLOT(activate())); showAtmospheresCheck->setChecked(renderFlags & Renderer::ShowAtmospheres); QCheckBox* showCloudMapsCheck = new QCheckBox(i18n("Clouds"), showGroup); actionColl->action("showCloudMaps")->connect(showCloudMapsCheck, SIGNAL(clicked()), SLOT(activate())); showCloudMapsCheck->setChecked(renderFlags & Renderer::ShowCloudMaps); QCheckBox* showNightMapsCheck = new QCheckBox(i18n("Night Side Lights"), showGroup); actionColl->action("showNightMaps")->connect(showNightMapsCheck, SIGNAL(clicked()), SLOT(activate())); showNightMapsCheck->setChecked(renderFlags & Renderer::ShowNightMaps); QCheckBox* showEclipseShadowsCheck = new QCheckBox(i18n("Eclipse Shadows"), showGroup); actionColl->action("showEclipseShadows")->connect(showEclipseShadowsCheck, SIGNAL(clicked()), SLOT(activate())); showEclipseShadowsCheck->setChecked(renderFlags & Renderer::ShowEclipseShadows); QCheckBox* showCometTailsCheck = new QCheckBox(i18n("Comet Tails"), showGroup); actionColl->action("showCometTails")->connect(showCometTailsCheck, SIGNAL(clicked()), SLOT(activate())); showCometTailsCheck->setChecked(renderFlags & Renderer::ShowCometTails); QCheckBox* showOrbitsCheck = new QCheckBox(i18n("Orbits"), showGroup); actionColl->action("showOrbits")->connect(showOrbitsCheck, SIGNAL(clicked()), SLOT(activate())); showOrbitsCheck->setChecked(renderFlags & Renderer::ShowOrbits); QCheckBox* showPartialTrajectoriesCheck = new QCheckBox(i18n("Partial Trajectories"), showGroup); actionColl->action("showPartialTrajectories")->connect(showPartialTrajectoriesCheck, SIGNAL(clicked()), SLOT(activate())); showPartialTrajectoriesCheck->setChecked(renderFlags & Renderer::ShowPartialTrajectories); QCheckBox* showSmoothLinesCheck = new QCheckBox(i18n("Smooth Orbit Lines"), showGroup); actionColl->action("showSmoothLines")->connect(showSmoothLinesCheck, SIGNAL(clicked()), SLOT(activate())); showSmoothLinesCheck->setChecked(renderFlags & Renderer::ShowSmoothLines); QCheckBox* showCelestialSphereCheck = new QCheckBox(i18n("Celestial Grid"), showGroup); actionColl->action("showCelestialSphere")->connect(showCelestialSphereCheck, SIGNAL(clicked()), SLOT(activate())); showCelestialSphereCheck->setChecked(renderFlags & Renderer::ShowCelestialSphere); QCheckBox* showDiagramsCheck = new QCheckBox(i18n("Constellations"), showGroup); actionColl->action("showDiagrams")->connect(showDiagramsCheck, SIGNAL(clicked()), SLOT(activate())); showDiagramsCheck->setChecked(renderFlags & Renderer::ShowDiagrams); QCheckBox* showMarkersCheck = new QCheckBox(i18n("Markers"), showGroup); actionColl->action("showMarkers")->connect(showMarkersCheck, SIGNAL(clicked()), SLOT(activate())); showMarkersCheck->setChecked(renderFlags & Renderer::ShowMarkers); QCheckBox* showRingShadowsCheck = new QCheckBox(i18n("Ring Shadows"), showGroup); actionColl->action("showRingShadows")->connect(showRingShadowsCheck, SIGNAL(clicked()), SLOT(activate())); showRingShadowsCheck->setChecked(renderFlags & Renderer::ShowRingShadows); QCheckBox* showBoundariesCheck = new QCheckBox(i18n("Constellation Boundaries"), showGroup); actionColl->action("showBoundaries")->connect(showBoundariesCheck, SIGNAL(clicked()), SLOT(activate())); showBoundariesCheck->setChecked(renderFlags & Renderer::ShowBoundaries); QVBox* vbox1 = new QVBox(renderFrame); int labelMode = appCore->getRenderer()->getLabelMode(); savedLabelMode = labelMode; int orbitMask = appCore->getRenderer()->getOrbitMask(); savedOrbitMask = orbitMask; QGroupBox* labelGroup = new QGroupBox(0, Qt::Horizontal, i18n("Orbits / Labels"), vbox1); QGridLayout* labelGroupLayout = new QGridLayout( labelGroup->layout() ); labelGroupLayout->setAlignment( Qt::AlignTop ); QLabel* orbitsLabel = new QLabel(i18n("Orbits"), labelGroup); labelGroupLayout->addWidget(orbitsLabel, 0, 0); QLabel* labelsLabel = new QLabel(i18n("Labels"), labelGroup); labelGroupLayout->addWidget(labelsLabel, 0, 1); QCheckBox* showStarLabelsCheck = new QCheckBox(i18n("Stars"), labelGroup); actionColl->action("showStarLabels")->connect(showStarLabelsCheck, SIGNAL(clicked()), SLOT(activate())); showStarLabelsCheck->setChecked(labelMode & Renderer::StarLabels); labelGroupLayout->addWidget(showStarLabelsCheck, 1, 1); QCheckBox* showPlanetOrbitsCheck = new QCheckBox("", labelGroup); actionColl->action("showPlanetOrbits")->connect(showPlanetOrbitsCheck, SIGNAL(clicked()), SLOT(activate())); showPlanetOrbitsCheck->setChecked(orbitMask & Body::Planet); labelGroupLayout->addWidget(showPlanetOrbitsCheck, 3, 0, Qt::AlignHCenter); QCheckBox* showPlanetLabelsCheck = new QCheckBox(i18n("Planets"), labelGroup); actionColl->action("showPlanetLabels")->connect(showPlanetLabelsCheck, SIGNAL(clicked()), SLOT(activate())); showPlanetLabelsCheck->setChecked(labelMode & Renderer::PlanetLabels); labelGroupLayout->addWidget(showPlanetLabelsCheck, 3, 1); QCheckBox* showMoonOrbitsCheck = new QCheckBox("", labelGroup); actionColl->action("showMoonOrbits")->connect(showMoonOrbitsCheck, SIGNAL(clicked()), SLOT(activate())); showMoonOrbitsCheck->setChecked(orbitMask & Body::Moon); labelGroupLayout->addWidget(showMoonOrbitsCheck, 4, 0, Qt::AlignHCenter); QCheckBox* showMoonLabelsCheck = new QCheckBox(i18n("Moons"), labelGroup); actionColl->action("showMoonLabels")->connect(showMoonLabelsCheck, SIGNAL(clicked()), SLOT(activate())); showMoonLabelsCheck->setChecked(labelMode & Renderer::MoonLabels); labelGroupLayout->addWidget(showMoonLabelsCheck, 4, 1); QCheckBox* showCometOrbitsCheck = new QCheckBox("", labelGroup); actionColl->action("showCometOrbits")->connect(showCometOrbitsCheck, SIGNAL(clicked()), SLOT(activate())); showCometOrbitsCheck->setChecked(orbitMask & Body::Comet); labelGroupLayout->addWidget(showCometOrbitsCheck, 5, 0, Qt::AlignHCenter); QCheckBox* showCometLabelsCheck = new QCheckBox(i18n("Comets"), labelGroup); actionColl->action("showCometLabels")->connect(showCometLabelsCheck, SIGNAL(clicked()), SLOT(activate())); showCometLabelsCheck->setChecked(labelMode & Renderer::CometLabels); labelGroupLayout->addWidget(showCometLabelsCheck, 5, 1); QCheckBox* showConstellationLabelsCheck = new QCheckBox(i18n("Constellations"), labelGroup); actionColl->action("showConstellationLabels")->connect(showConstellationLabelsCheck, SIGNAL(clicked()), SLOT(activate())); showConstellationLabelsCheck->setChecked(labelMode & Renderer::ConstellationLabels); labelGroupLayout->addWidget(showConstellationLabelsCheck, 6, 1); QCheckBox* showI18nConstellationLabelsCheck = new QCheckBox(i18n("Constellations in Latin"), labelGroup); actionColl->action("showI18nConstellationLabels")->connect(showI18nConstellationLabelsCheck, SIGNAL(clicked()), SLOT(activate())); showI18nConstellationLabelsCheck->setChecked(!(labelMode & Renderer::I18nConstellationLabels)); labelGroupLayout->addWidget(showI18nConstellationLabelsCheck, 7, 1); QCheckBox* showGalaxyLabelsCheck = new QCheckBox(i18n("Galaxies"), labelGroup); actionColl->action("showGalaxyLabels")->connect(showGalaxyLabelsCheck, SIGNAL(clicked()), SLOT(activate())); showGalaxyLabelsCheck->setChecked(labelMode & Renderer::GalaxyLabels); labelGroupLayout->addWidget(showGalaxyLabelsCheck, 8, 1); QCheckBox* showNebulaLabelsCheck = new QCheckBox(i18n("Nebulae"), labelGroup); actionColl->action("showNebulaLabels")->connect(showNebulaLabelsCheck, SIGNAL(clicked()), SLOT(activate())); showNebulaLabelsCheck->setChecked(labelMode & Renderer::NebulaLabels); labelGroupLayout->addWidget(showNebulaLabelsCheck, 9, 1); QCheckBox* showOpenClusterLabelsCheck = new QCheckBox(i18n("Open Clusters"), labelGroup); actionColl->action("showOpenClusterLabels")->connect(showOpenClusterLabelsCheck, SIGNAL(clicked()), SLOT(activate())); showOpenClusterLabelsCheck->setChecked(labelMode & Renderer::OpenClusterLabels); labelGroupLayout->addWidget(showOpenClusterLabelsCheck, 10, 1); QCheckBox* showAsteroidOrbitsCheck = new QCheckBox("", labelGroup); actionColl->action("showAsteroidOrbits")->connect(showAsteroidOrbitsCheck, SIGNAL(clicked()), SLOT(activate())); showAsteroidOrbitsCheck->setChecked(orbitMask & Body::Asteroid); labelGroupLayout->addWidget(showAsteroidOrbitsCheck, 11, 0, Qt::AlignHCenter); QCheckBox* showAsteroidLabelsCheck = new QCheckBox(i18n("Asteroids"), labelGroup); actionColl->action("showAsteroidLabels")->connect(showAsteroidLabelsCheck, SIGNAL(clicked()), SLOT(activate())); showAsteroidLabelsCheck->setChecked(labelMode & Renderer::AsteroidLabels); labelGroupLayout->addWidget(showAsteroidLabelsCheck, 11, 1); QCheckBox* showSpacecraftOrbitsCheck = new QCheckBox("", labelGroup); actionColl->action("showSpacecraftOrbits")->connect(showSpacecraftOrbitsCheck, SIGNAL(clicked()), SLOT(activate())); showSpacecraftOrbitsCheck->setChecked(orbitMask & Body::Spacecraft); labelGroupLayout->addWidget(showSpacecraftOrbitsCheck, 12, 0, Qt::AlignHCenter); QCheckBox* showSpacecraftLabelsCheck = new QCheckBox(i18n("Spacecrafts"), labelGroup); actionColl->action("showSpacecraftLabels")->connect(showSpacecraftLabelsCheck, SIGNAL(clicked()), SLOT(activate())); showSpacecraftLabelsCheck->setChecked(labelMode & Renderer::SpacecraftLabels); labelGroupLayout->addWidget(showSpacecraftLabelsCheck, 12, 1); QCheckBox* showLocationLabelsCheck = new QCheckBox(i18n("Locations"), labelGroup); actionColl->action("showLocationLabels")->connect(showLocationLabelsCheck, SIGNAL(clicked()), SLOT(activate())); showLocationLabelsCheck->setChecked(labelMode & Renderer::LocationLabels); labelGroupLayout->addWidget(showLocationLabelsCheck, 13, 1); QSpacerItem* spacer = new QSpacerItem( 151, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); labelGroupLayout->addItem( spacer, 0, 2 ); savedAmbientLightLevel = int(appCore->getRenderer()->getAmbientLightLevel() * 100); QGroupBox* ambientLightGroup = new QGroupBox(1, Qt::Vertical, i18n("Ambient Light"), vbox1);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?