00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef KDE_MAIN_WINDOW_H
00019 #define KDE_MAIN_WINDOW_H
00020
00021 #ifdef HAVE_CONFIG_H
00022 #include <config.h>
00023 #endif
00024
00025 #include <time.h>
00026 #include <kapp.h>
00027 #include <qwidget.h>
00028 #include <kmainwindow.h>
00029 #include <kaction.h>
00030 #include <qvaluestack.h>
00031 #include <kurl.h>
00032 #include <kdialogbase.h>
00033
00034 #include <kbookmarkmanager.h>
00035 #include <kbookmarkbar.h>
00036 #include "kcelbookmarkowner.h"
00037 #include "celestiacore.h"
00038 #include "kdeglwidget.h"
00039 #include "celengine/render.h"
00040 #include "celengine/glcontext.h"
00041 #include "url.h"
00042
00043 class KdeApp;
00044
00045 class KdeAlerter : public CelestiaCore::Alerter
00046 {
00047 public:
00048 KdeAlerter(QWidget* parent = 0);
00049 virtual ~KdeAlerter() {};
00050 virtual void fatalError(const std::string&);
00051 protected:
00052 QWidget* parent;
00053 };
00054
00055 class KdeWatcher : public CelestiaWatcher {
00056 public:
00057 KdeWatcher(CelestiaCore* core, KdeApp* app) : CelestiaWatcher(*core),kdeapp(app) {};
00058 virtual void notifyChange(CelestiaCore*, int);
00059 protected:
00060 KdeApp *kdeapp;
00061 };
00062
00063
00064 class KdeApp : public KMainWindow, virtual public KCelBookmarkOwner
00065 {
00066 Q_OBJECT
00067 friend void KdeWatcher::notifyChange(CelestiaCore*, int);
00068
00069 public:
00071 KdeApp(std::string config, std::string dir, std::vector<std::string> extrasDirs, bool fullscreen, bool disableSplash);
00073 ~KdeApp() {};
00074
00075 QString getOpenGLInfo();
00076
00077 void dragEnterEvent(QDragEnterEvent* event);
00078 void dropEvent(QDropEvent* event);
00079 void setStartURL(KURL url);
00080 void goToURL(const KURL& url);
00081
00082 void openBookmarkURL(const QString& _url);
00083 Url currentUrl(Url::UrlType type = Url::Absolute) const ;
00084 QString currentIcon() const;
00085 const KActionCollection* getActionCollection() { return actionCollection(); }
00086
00087 public slots:
00088 void celestia_tick() { appCore->tick(); glWidget->updateGL(); }
00089 void slotFileOpen();
00090 void slotFileOpenRecent(const KURL&);
00091 void slotNull();
00092 void slotClose();
00093 void slotHome();
00094 void slotZoomIn();
00095 void slotZoomOut();
00096 void slotToggleToolbar();
00097 void slotToggleMenubar();
00098 void slotConfigureToolbars();
00099 void slotNewToolbarConfig();
00100 void slotKeyBindings();
00101 void slotOpenGLInfo();
00102 void slotPreferences();
00103 void slotSetTime();
00104 void slotSetTimeNow();
00105 void slotAccelerateTime();
00106 void slotSlowDownTime();
00107 void slotPauseTime();
00108 void slotReverseTime();
00109 void slotCenterCO();
00110
00111 void slotShowStars();
00112 void slotShowPlanets();
00113 void slotShowGalaxies();
00114 void slotShowNebulae();
00115 void slotShowOpenClusters();
00116 void slotShowPartialTrajectories();
00117 void slotShowDiagrams();
00118 void slotShowCloudMaps();
00119
00120 void slotShowOrbits();
00121 void slotShowAsteroidOrbits();
00122 void slotShowCometOrbits();
00123 void slotShowMoonOrbits();
00124 void slotShowPlanetOrbits();
00125 void slotShowSpacecraftOrbits();
00126 void slotShowCelestialSphere();
00127 void slotShowNightMaps();
00128 void slotShowMarkers();
00129 void slotShowAtmospheres();
00130 void slotShowSmoothLines();
00131 void slotShowEclipseShadows();
00132 void slotCycleStarMode();
00133 void slotShowRingShadows();
00134 void slotShowBoundaries();
00135 void slotShowAutoMag();
00136 void slotShowCometTails();
00137
00138 void slotShowStarLabels();
00139 void slotShowPlanetLabels();
00140 void slotShowMoonLabels();
00141 void slotShowCometLabels();
00142 void slotShowConstellationLabels();
00143 void slotShowI18nConstellationLabels();
00144 void slotShowGalaxyLabels();
00145 void slotShowNebulaLabels();
00146 void slotShowOpenClusterLabels();
00147 void slotShowAsteroidLabels();
00148 void slotShowSpacecraftLabels();
00149 void slotShowLocationLabels();
00150
00151 void slotShowCityLocations();
00152 void slotShowObservatoryLocations();
00153 void slotShowLandingSiteLocations();
00154 void slotShowCraterLocations();
00155 void slotShowMonsLocations();
00156 void slotShowTerraLocations();
00157 void slotShowVallisLocations();
00158 void slotShowMareLocations();
00159 void slotShowOtherLocations();
00160 void slotMinFeatureSize(int size);
00161
00162 void slotAmbientLightLevel(float l);
00163 void slotFaintestVisible(float m);
00164 void slotHudDetail(int l);
00165 void slotSplitH();
00166 void slotSplitV();
00167 void slotCycleView();
00168 void slotToggleFramesVisible();
00169 void slotToggleActiveFrameVisible();
00170 void slotToggleSyncTime();
00171 void slotAltAzMode();
00172 void slotSingleView();
00173 void slotDeleteView();
00174 void slotSetRenderPathBasic();
00175 void slotSetRenderPathMultitexture();
00176 void slotSetRenderPathNvCombiner();
00177 void slotSetRenderPathDOT3ARBVP();
00178 void slotSetRenderPathNvCombinerNvVP();
00179 void slotSetRenderPathNvCombinerARBVP();
00180 void slotSetRenderPathARBFPARBVP();
00181 void slotSetRenderPathNV30();
00182 void slotSetRenderPathGLSL();
00183 void slotCycleRenderPath();
00184
00185 void slotCelestialBrowser();
00186 void slotEclipseFinder();
00187
00188 void slotDisplayLocalTime();
00189 void slotWireframeMode();
00190 void slotGrabImage();
00191 void slotFullScreen();
00192
00193 void slotBack();
00194 void slotForward();
00195 void slotCopyUrl();
00196 void slotGoTo();
00197 void slotGoToLongLat();
00198 void slotGoToSurface();
00199
00200 void slotShowBookmarkBar();
00201
00202 void slotOpenFileURL(const KURL& url);
00203 void slotBackAboutToShow();
00204 void slotBackActivated (int i);
00205 void slotForwardAboutToShow();
00206 void slotForwardActivated(int i);
00207
00208 void initBookmarkBar();
00209
00210 static void popupMenu(float x, float y, Selection sel);
00211
00212 protected:
00213 CelestiaCore* appCore;
00214 Renderer* renderer;
00215 Simulation* sim;
00216 KdeGlWidget* glWidget;
00217 void initActions();
00218 KRecentFilesAction *openRecent;
00219 KBookmarkBar *bookmarkBar;
00220
00221 bool queryExit();
00222 bool queryClose();
00223
00224 KToggleAction* toggleMenubar;
00225 KToggleAction* toggleToolbar;
00226
00227 void resyncMenus();
00228 void resyncAmbient();
00229 void resyncFaintest();
00230 void resyncVerbosity();
00231 void resyncHistory();
00232
00233 KdeWatcher *kdewatcher;
00234
00235 KToolBarPopupAction *backAction, *forwardAction;
00236 static KdeApp* app;
00237
00238 KActionCollection* bookmarkBarActionCollection;
00239 };
00240
00241 class LongLatDialog : public KDialogBase {
00242 Q_OBJECT
00243
00244 public:
00245 LongLatDialog(QWidget* parent, CelestiaCore* appCore);
00246
00247 private slots:
00248 void slotOk();
00249 void slotApply();
00250 void slotCancel();
00251
00252 private:
00253 CelestiaCore* appCore;
00254 QLineEdit *altEdit, *longEdit, *latEdit, *objEdit;
00255 QComboBox *longSign, *latSign;
00256
00257 };
00258
00259
00260 #endif