kdeapp.cpp
来自「celestia源代码」· C++ 代码 · 共 1,548 行 · 第 1/5 页
CPP
1,548 行
((KToggleAction*)action("showOrbits"))->setChecked(rFlags & Renderer::ShowOrbits); ((KToggleAction*)action("showAsteroidOrbits"))->setChecked(orbitMask & Body::Asteroid); ((KToggleAction*)action("showCometOrbits"))->setChecked(orbitMask & Body::Comet); ((KToggleAction*)action("showMoonOrbits"))->setChecked(orbitMask & Body::Moon); ((KToggleAction*)action("showPlanetOrbits"))->setChecked(orbitMask & Body::Planet); ((KToggleAction*)action("showSpacecraftOrbits"))->setChecked(orbitMask & Body::Spacecraft); ((KToggleAction*)action("showCelestialSphere"))->setChecked(rFlags & Renderer::ShowCelestialSphere); ((KToggleAction*)action("showNightMaps"))->setChecked(rFlags & Renderer::ShowNightMaps); ((KToggleAction*)action("showMarkers"))->setChecked(rFlags & Renderer::ShowMarkers); ((KToggleAction*)action("showAtmospheres"))->setChecked(rFlags & Renderer::ShowAtmospheres); ((KToggleAction*)action("showSmoothLines"))->setChecked(rFlags & Renderer::ShowSmoothLines); ((KToggleAction*)action("showEclipseShadows"))->setChecked(rFlags & Renderer::ShowEclipseShadows); ((KToggleAction*)action("showRingShadows"))->setChecked(rFlags & Renderer::ShowRingShadows); ((KToggleAction*)action("showBoundaries"))->setChecked(rFlags & Renderer::ShowBoundaries); ((KToggleAction*)action("showAutoMag"))->setChecked(rFlags & Renderer::ShowAutoMag); ((KToggleAction*)action("showCometTails"))->setChecked(rFlags & Renderer::ShowCometTails); int lMode = renderer->getLabelMode(); ((KToggleAction*)action("showStarLabels"))->setChecked(lMode & Renderer::StarLabels); ((KToggleAction*)action("showPlanetLabels"))->setChecked(lMode & Renderer::PlanetLabels); ((KToggleAction*)action("showMoonLabels"))->setChecked(lMode & Renderer::MoonLabels); ((KToggleAction*)action("showCometLabels"))->setChecked(lMode & Renderer::CometLabels); ((KToggleAction*)action("showConstellationLabels"))->setChecked(lMode & Renderer::ConstellationLabels); ((KToggleAction*)action("showI18nConstellationLabels"))->setChecked(!(lMode & Renderer::I18nConstellationLabels)); ((KToggleAction*)action("showGalaxyLabels"))->setChecked(lMode & Renderer::GalaxyLabels); ((KToggleAction*)action("showNebulaLabels"))->setChecked(lMode & Renderer::NebulaLabels); ((KToggleAction*)action("showOpenClusterLabels"))->setChecked(lMode & Renderer::OpenClusterLabels); ((KToggleAction*)action("showAsteroidLabels"))->setChecked(lMode & Renderer::AsteroidLabels); ((KToggleAction*)action("showSpacecraftLabels"))->setChecked(lMode & Renderer::SpacecraftLabels); ((KToggleAction*)action("showLocationLabels"))->setChecked(lMode & Renderer::LocationLabels); switch (renderer->getGLContext()->getRenderPath()) { case GLContext::GLPath_Basic: ((KToggleAction*)action("renderPathBasic"))->setChecked(true); break; case GLContext::GLPath_Multitexture: ((KToggleAction*)action("renderPathMultitexture"))->setChecked(true); break; case GLContext::GLPath_NvCombiner: ((KToggleAction*)action("renderPathNvCombiner"))->setChecked(true); break; case GLContext::GLPath_DOT3_ARBVP: ((KToggleAction*)action("renderPathDOT3ARBVP"))->setChecked(true); break; case GLContext::GLPath_NvCombiner_NvVP: ((KToggleAction*)action("renderPathNvCombinerNvVP"))->setChecked(true); break; case GLContext::GLPath_NvCombiner_ARBVP: ((KToggleAction*)action("renderPathNvCombinerARBVP"))->setChecked(true); break; case GLContext::GLPath_ARBFP_ARBVP: ((KToggleAction*)action("renderPathARBFPARBVP"))->setChecked(true); break; case GLContext::GLPath_NV30: ((KToggleAction*)action("renderPathNV30"))->setChecked(true); break; case GLContext::GLPath_GLSL: ((KToggleAction*)action("renderPathGLSL"))->setChecked(true); break; }}void KdeApp::resyncAmbient() {}void KdeApp::resyncFaintest() {}void KdeApp::resyncVerbosity() {}void KdeApp::initActions(){ KStdAction::open(this, SLOT(slotFileOpen()), actionCollection()); openRecent = KStdAction::openRecent(this, SLOT(slotFileOpenRecent(const KURL&)), actionCollection()); openRecent->loadEntries(KGlobal::config()); connect(openRecent, SIGNAL(urlSelected(const KURL&)), SLOT(slotOpenFileURL(const KURL&))); KStdAction::quit(this, SLOT(slotClose()), actionCollection()); KStdAction::configureToolbars( this, SLOT( slotConfigureToolbars() ), actionCollection() ); new KAction(i18n("Go to &URL..."), 0, ALT + Key_G, this, SLOT(slotGoTo()), actionCollection(), "go_to"); new KAction(i18n("Go to &Long/Lat..."), 0, ALT + Key_L, this, SLOT(slotGoToLongLat()), actionCollection(), "go_to_long_lat"); backAction = new KToolBarPopupAction( i18n("&Back"), "back", KStdAccel::key(KStdAccel::Back), this, SLOT( slotBack() ), actionCollection(), KStdAction::stdName( KStdAction::Back ) ); forwardAction = new KToolBarPopupAction( i18n("&Forward"), "forward", KStdAccel::key(KStdAccel::Forward), this, SLOT( slotForward() ), actionCollection(), KStdAction::stdName( KStdAction::Forward ) ); connect( backAction->popupMenu(), SIGNAL( aboutToShow() ), SLOT( slotBackAboutToShow() ) ); connect( backAction->popupMenu(), SIGNAL( activated( int ) ), SLOT( slotBackActivated( int ) ) ); connect( forwardAction->popupMenu(), SIGNAL( aboutToShow() ), SLOT( slotForwardAboutToShow() ) ); connect( forwardAction->popupMenu(), SIGNAL( activated( int ) ), SLOT( slotForwardActivated( int ) ) ); new KAction(i18n("Home"), "gohome", CTRL + Key_Home, this, SLOT(slotHome()), actionCollection(), "home"); action("go_forward")->setEnabled(false); action("go_back")->setEnabled(false); KStdAction::zoomIn(this, SLOT(slotZoomIn()), actionCollection()); KStdAction::zoomOut(this, SLOT(slotZoomOut()), actionCollection()); KActionMenu *bookmarks = new KActionMenu( i18n("Bookmarks"), "bookmark", actionCollection(), "bookmarks" ); new KCelBookmarkMenu( KCelBookmarkManager::self(), this, bookmarks->popupMenu(), actionCollection(), true, true ); KStdAction::preferences(this, SLOT(slotPreferences()), actionCollection()); KStdAction::configureToolbars(this, SLOT(slotConfigureToolbars()), actionCollection()); KStdAction::keyBindings(this, SLOT(slotKeyBindings()), actionCollection()); KShortcut fullscreen_shortcut(CTRL + Key_F); fullscreen_shortcut.append(KKeySequence(QKeySequence(ALT + Key_Return))); //fullscreen_shortcut.append(KShortcut(ALT + Key_Return)); new KAction(i18n("Full Screen"), "window_fullscreen", fullscreen_shortcut, this, SLOT(slotFullScreen()), actionCollection(), "fullScreen"); KShortcut copy_url_shortcut(CTRL + Key_C); copy_url_shortcut.append(KKeySequence(QKeySequence(CTRL + Key_Insert))); //copy_url_shortcut.append(KShortcut(CTRL + Key_Insert)); new KAction(i18n("Copy URL"), "edit_copy", copy_url_shortcut, this, SLOT(slotCopyUrl()), actionCollection(), "copyUrl"); new KAction(i18n("Set Time..."), "kalarm", ALT + Key_T, this, SLOT(slotSetTime()), actionCollection(), "setTime"); new KAction(i18n("Set Time to Now"), "player_eject", Key_Exclam, this, SLOT(slotSetTimeNow()), actionCollection(), "setTimeNow"); new KAction(i18n("Accelerate Time"), "1uparrow", Key_L, this, SLOT(slotAccelerateTime()), actionCollection(), "accelerateTime"); new KAction(i18n("Decelerate Time"), "1downarrow", Key_K, this, SLOT(slotSlowDownTime()), actionCollection(), "slowDownTime"); new KAction(i18n("Pause Time"), "player_pause", Key_Space, this, SLOT(slotPauseTime()), actionCollection(), "pauseTime"); new KAction(i18n("Reverse Time"), "reload", Key_J, this, SLOT(slotReverseTime()), actionCollection(), "reverseTime"); new KAction(i18n("Split View Vertically"), "view_top_bottom", CTRL + Key_R, this, SLOT(slotSplitH()), actionCollection(), "splitH"); new KAction(i18n("Split View Horizontally"), "view_left_right", CTRL + Key_U, this, SLOT(slotSplitV()), actionCollection(), "splitV"); new KAction(i18n("Cycle View"), "rotate_cw", Key_Tab, this, SLOT(slotCycleView()), actionCollection(), "cycleView"); new KAction(i18n("Single View"), "view_remove", CTRL + Key_D, this, SLOT(slotSingleView()), actionCollection(), "singleView"); new KAction(i18n("Delete View"), "view_remove", Key_Delete, this, SLOT(slotDeleteView()), actionCollection(), "deleteView"); KToggleAction* framesVisible = new KToggleAction(i18n("Frames Visible"), 0, 0, this, SLOT(slotToggleFramesVisible()), actionCollection(), "framesVisible"); KGlobal::config()->setGroup("Preferences"); if (KGlobal::config()->hasKey("FramesVisible")) { bool visible = KGlobal::config()->readBoolEntry("FramesVisible"); framesVisible->setChecked(visible); appCore->setFramesVisible(visible); } else { framesVisible->setChecked(appCore->getFramesVisible()); } KToggleAction* activeFrameVisible = new KToggleAction(i18n("Active Frame Visible"), 0, 0, this, SLOT(slotToggleActiveFrameVisible()), actionCollection(), "activeFrameVisible"); if (KGlobal::config()->hasKey("ActiveFrameVisible")) { bool visible = KGlobal::config()->readBoolEntry("ActiveFrameVisible"); activeFrameVisible->setChecked(visible); appCore->setActiveFrameVisible(visible); } else { activeFrameVisible->setChecked(appCore->getActiveFrameVisible()); } KToggleAction* timeSync = new KToggleAction(i18n("Synchronize Time"), 0, 0, this, SLOT(slotToggleSyncTime()), actionCollection(), "syncTime"); if (KGlobal::config()->hasKey("SyncTime")) { bool sync = KGlobal::config()->readBoolEntry("SyncTime"); timeSync->setChecked(sync); appCore->getSimulation()->setSyncTime(sync); } else { timeSync->setChecked(appCore->getSimulation()->getSyncTime()); } new KAction(i18n("Alt-Azimuth Mode"), 0, ALT + Key_F, this, SLOT(slotAltAzMode()), actionCollection(), "altAzMode"); new KAction(i18n("Go To Surface"), 0, CTRL + Key_G, this, SLOT(slotGoToSurface()), actionCollection(), "goToSurface"); new KAction(i18n("Celestial Browser"), 0, ALT + Key_C, this, SLOT(slotCelestialBrowser()), actionCollection(), "celestialBrowser"); new KAction(i18n("Eclipse Finder"), 0, ALT + Key_E, this, SLOT(slotEclipseFinder()), actionCollection(), "eclipseFinder"); int rFlags, lMode, oMask; uint32 lFilter; bool isLocal = true; if (KGlobal::config()->hasKey("RendererFlags")) rFlags = KGlobal::config()->readNumEntry("RendererFlags"); else rFlags = appCore->getRenderer()->getRenderFlags(); if (KGlobal::config()->hasKey("LabelMode")) lMode = KGlobal::config()->readNumEntry("LabelMode"); else lMode = appCore->getRenderer()->getLabelMode(); if (KGlobal::config()->hasKey("LocationFilter")) lFilter = KGlobal::config()->readUnsignedNumEntry("LocationFilter"); else lFilter = appCore->getSimulation()->getActiveObserver()->getLocationFilter(); appCore->getSimulation()->getActiveObserver()->setLocationFilter(lFilter); oMask = appCore->getRenderer()->getOrbitMask(); if (KGlobal::config()->hasKey("TimeZoneBias")) isLocal = (KGlobal::config()->readNumEntry("TimeZoneBias") != 0); ///////////////////////////////////////// // Render Flags KToggleAction* showStars = new KToggleAction(i18n("Show Stars"), 0, this, SLOT(slotShowStars()), actionCollection(), "showStars"); showStars->setChecked(rFlags & Renderer::ShowStars); KToggleAction* showPlanets = new KToggleAction(i18n("Show Planets"), 0, this, SLOT(slotShowPlanets()), actionCollection(), "showPlanets"); showPlanets->setChecked(rFlags & Renderer::ShowPlanets); KToggleAction* showGalaxies = new KToggleAction(i18n("Show Galaxies"), Key_U, this, SLOT(slotShowGalaxies()), actionCollection(), "showGalaxies"); showGalaxies->setChecked(rFlags & Renderer::ShowGalaxies); KToggleAction* showPartialTrajectories = new KToggleAction(i18n("Show Partial Trajectories"), 0, this, SLOT(slotShowPartialTrajectories()), actionCollection(), "showPartialTrajectories"); showPartialTrajectories->setChecked(rFlags & Renderer::ShowPartialTrajectories); KToggleAction* showNebulae = new KToggleAction(i18n("Show Nebulae"), Key_AsciiCircum, this, SLOT(slotShowNebulae()), actionCollection(), "showNebulae"); showNebulae->setChecked(rFlags & Renderer::ShowNebulae); KToggleAction* showOpenClusters = new KToggleAction(i18n("Show Open Clusters"), 0, this, SLOT(slotShowOpenClusters()), actionCollection(), "showOpenClusters"); showOpenClusters->setChecked(rFlags & Renderer::ShowOpenClusters); KToggleAction* showDiagrams = new KToggleAction(i18n("Show Constellations"), Key_Slash, this, SLOT(slotShowDiagrams()), actionCollection(), "showDiagrams"); showDiagrams->setChecked(rFlags & Renderer::ShowDiagrams); KToggleAction* showCloudMaps = new KToggleAction(i18n("Show CloudMaps"), Key_I, this, SLOT(slotShowCloudMaps()), actionCollection(), "showCloudMaps"); showCloudMaps->setChecked(rFlags & Renderer::ShowCloudMaps); KToggleAction* showOrbits = new KToggleAction(i18n("Show Orbits"), Key_O, this, SLOT(slotShowOrbits()), actionCollection(), "showOrbits"); showOrbits->setChecked(rFlags & Renderer::ShowOrbits); KToggleAction* showAsteroidOrbits = new KToggleAction(i18n("Show Asteroid Orbits"), 0, this, SLOT(slotShowAsteroidOrbits()), actionCollection(), "showAsteroidOrbits"); showAsteroidOrbits->setChecked(oMask & Body::Asteroid); KToggleAction* showCometOrbits = new KToggleAction(i18n("Show Comet Orbits"), 0, this, SLOT(slotShowCometOrbits()), actionCollection(), "showCometOrbits"); showCometOrbits->setChecked(oMask & Body::Comet); KToggleAction* showMoonOrbits = new KToggleAction(i18n("Show Moon Orbits"), 0, this, SLOT(slotShowMoonOrbits()), actionCollection(), "showMoonOrbits"); showMoonOrbits->setChecked(oMask & Body::Moon); KToggleAction* showPlanetOrbits = new KToggleAction(i18n("Show Planet Orbits"), 0, this, SLOT(slotShowPlanetOrbits()), actionCollection(), "showPlanetOrbits"); showPlanetOrbits->setChecked(oMask & Body::Planet); KToggleAction* showSpacecraftOrbits = new KToggleAction(i18n("Show Spacecraft Orbits"), 0, this, SLOT(slotShowSpacecraftOrbits()), actionCollection(), "showSpacecraftOrbits"); showSpacecraftOrbits->setChecked(oMask & Body::Spacecraft); KToggleAction* showCelestialSphere = new KToggleAction(i18n("Show Celestial Grid"), Key_Semicolon, this, SLOT(slotShowCelestialSphere()), actionCollection(), "showCelestialSphere"); showCelestialSphere->setChecked(rFlags & Renderer::ShowCelestialSphere); KToggleAction* showNightMaps = new KToggleAction(i18n("Show Night Side Lights"), CTRL + Key_L, this, SLOT(slotShowNightMaps()), actionCollection(), "showNightMaps"); showNightMaps->setChecked(rFlags & Renderer::ShowNightMaps); KToggleAction* showMarkers = new KToggleAction(i18n("Show Markers"), CTRL + Key_K, this, SLOT(slotShowMarkers()), actionCollection(), "showMarkers"); showMarkers->setChecked(rFlags & Renderer::ShowMarkers); KToggleAction* showAtmospheres = new KToggleAction(i18n("Show Atmospheres"), CTRL + Key_A, this, SLOT(slotShowAtmospheres()), actionCollection(), "showAtmospheres"); showAtmospheres->setChecked(rFlags & Renderer::ShowAtmospheres); KToggleAction* showSmoothLines = new KToggleAction(i18n("Show Smooth Orbit Lines"), CTRL + Key_X, this, SLOT(slotShowSmoothLines()), actionCollection(), "showSmoothLines"); showSmoothLines->setChecked(rFlags & Renderer::ShowSmoothLines); KToggleAction* showEclipseShadows = new KToggleAction(i18n("Show Eclipse Shadows"), CTRL + Key_E, this, SLOT(slotShowEclipseShadows()), actionCollection(), "showEclipseShadows"); showEclipseShadows->setChecked(rFlags & Renderer::ShowEclipseShadows); new KAction(i18n("Cycle Star Mode"), CTRL + Key_S, this, SLOT(slotCycleStarMode()), actionCollection(), "cycleStarMode"); KToggleAction* showRingShadows = new KToggleAction(i18n("Show Ring Shadows"), 0, this, SLOT(slotShowRingShadows()), actionCollection(), "showRingShadows"); showRingShadows->setChecked(rFlags & Renderer::ShowRingShadows); KToggleAction* showBoundaries = new KToggleAction(i18n("Show Boundaries"), CTRL + Key_B, this, SLOT(slotShowBoundaries()), actionCollection(), "showBoundaries"); showBoundaries->setChecked(rFlags & Renderer::ShowBoundaries); new KToggleAction(i18n("Auto Magnitudes"), CTRL + Key_Y, this, SLOT(slotShowAutoMag()), actionCollection(), "showAutoMag"); showBoundaries->setChecked(rFlags & Renderer::ShowAutoMag); KToggleAction* showCometTails = new KToggleAction(i18n("Show Comet Tails"), CTRL + Key_T, this, SLOT(slotShowCometTails()), actionCollection(), "showCometTails"); showCometTails->setChecked(rFlags & Renderer::ShowCometTails); KToggleAction* showStarLabels = new KToggleAction(i18n("Show Star Labels"), Key_B, this, SLOT(slotShowStarLabels()), actionCollection(), "showStarLabels"); showStarLabels->setChecked(lMode & Renderer::StarLabels); ///////////////////////////////////////// // Label Mode KToggleAction* showPlanetLabels = new KToggleAction(i18n("Show Planet Labels"), Key_P, this, SLOT(slotShowPlanetLabels()), actionCollection(), "showPlanetLabels"); showPlanetLabels->setChecked(lMode & Renderer::PlanetLabels); KToggleAction* showMoonLabels = new KToggleAction(i18n("Show Moon Labels"), Key_M, this, SLOT(slotShowMoonLabels()), actionCollection(), "showMoonLabels"); showMoonLabels->setChecked(lMode & Renderer::MoonLabels); KToggleAction* showCometLabels = new KToggleAction(i18n("Show Comet Labels"), SHIFT + Key_W, this, SLOT(slotShowCometLabels()), actionCollection(), "showCometLabels"); showMoonLabels->setChecked(lMode & Renderer::CometLabels); KToggleAction* showConstellationLabels = new KToggleAction(i18n("Show Constellation Labels"), Key_Equal, this, SLOT(slotShowConstellationLabels()), actionCollection(), "showConstellationLabels"); showConstellationLabels->setChecked(lMode & Renderer::ConstellationLabels); KToggleAction* showI18nConstellationLabels = new KToggleAction(i18n("Constellation Labels in Latin"), 0, this, SLOT(slotShowI18nConstellationLabels()), actionCollection(), "showI18nConstellationLabels"); showI18nConstellationLabels->setChecked(!(lMode & Renderer::I18nConstellationLabels)); KToggleAction* showGalaxyLabels = new KToggleAction(i18n("Show Galaxy Labels"), Key_E, this, SLOT(slotShowGalaxyLabels()), actionCollection(), "showGalaxyLabels"); showGalaxyLabels->setChecked(lMode & Renderer::GalaxyLabels); KToggleAction* showNebulaLabels = new KToggleAction(i18n("Show Nebula Labels"), 0, this, SLOT(slotShowNebulaLabels()), actionCollection(), "showNebulaLabels"); showNebulaLabels->setChecked(lMode & Renderer::NebulaLabels); KToggleAction* showOpenClusterLabels = new KToggleAction(i18n("Show Open Cluster Labels"), 0, this, SLOT(slotShowOpenClusterLabels()), actionCollection(), "showOpenClusterLabels"); showOpenClusterLabels->setChecked(lMode & Renderer::OpenClusterLabels); KToggleAction* showAsteroidLabels = new KToggleAction(i18n("Show Asteroid Labels"), Key_W, this, SLOT(slotShowAsteroidLabels()), actionCollection(), "showAsteroidLabels"); showAsteroidLabels->setChecked(lMode & Renderer::AsteroidLabels); KToggleAction* showSpacecraftLabels = new KToggleAction(i18n("Show Spacecraft Labels"), Key_N, this, SLOT(slotShowSpacecraftLabels()), actionCollection(), "showSpacecraftLabels"); showSpacecraftLabels->setChecked(lMode & Renderer::SpacecraftLabels); KToggleAction* showLocationLabels = new KToggleAction(i18n("Show Location Labels"), Key_Ampersand, this, SLOT(slotShowLocationLabels()), actionCollection(), "showLocationLabels"); showLocationLabels->setChecked(lMode & Renderer::LocationLabels); KToggleAction* displayLocalTime = new KToggleAction(i18n("Display Local Time"), ALT + Key_U, this, SLOT(slotDisplayLocalTime()), actionCollection(), "displayLocalTime"); displayLocalTime->setChecked(isLocal);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?