Commit 82c89591 authored by Jasem Mutlaq's avatar Jasem Mutlaq
Browse files

Fix warning and remove OpenGL stuff. OpenGL is used in KStars Lite only.

parent 6881b86a
......@@ -59,16 +59,9 @@ KStars *KStars::pinstance = 0;
KStars::KStars( bool doSplash, bool clockrun, const QString &startdate )
: KXmlGuiWindow(), colorActionMenu(0), fovActionMenu(0), m_KStarsData(0), m_SkyMap(0), m_TimeStepBox(0),
m_ExportImageDialog(0), m_PrintingWizard(0), m_FindDialog(0),
m_AstroCalc(0), m_AltVsTime(0), m_SkyCalendar(0), m_ScriptBuilder(0),
m_ExportImageDialog(0), m_PrintingWizard(0), m_FindDialog(0), m_AstroCalc(0), m_AltVsTime(0), m_SkyCalendar(0), m_ScriptBuilder(0),
m_PlanetViewer(0), m_WUTDialog(0), m_JMoonTool(0), m_MoonPhaseTool(0), m_FlagManager(0), m_HorizonManager(0), m_EyepieceView(0),
//FIXME Port to QML2
//#if 0
m_WIView(0), m_ObsConditions(0), m_wiDock(0),
//#endif
m_addDSODialog(0),
DialogIsObsolete(false), StartClockRunning( clockrun ),
StartDateString( startdate )
m_addDSODialog(0), m_WIView(0), m_ObsConditions(0), m_wiDock(0), DialogIsObsolete(false), StartClockRunning( clockrun ), StartDateString( startdate )
{
// Initialize logging settings
if (Options::disableLogging())
......@@ -202,13 +195,7 @@ void KStars::applyConfig( bool doApplyFocus ) {
}
actionCollection()->action("coordsys")->setText(
Options::useAltAz() ? i18n("Switch to star globe view (Equatorial &Coordinates)"): i18n("Switch to horizonal view (Horizontal &Coordinates)") );
#ifdef HAVE_OPENGL
Q_ASSERT( SkyMap::Instance() ); // This assert should not fail, because SkyMap is already created by now. Just throwing it in anyway.
actionCollection()->action("opengl")->setText( (Options::useGL() ? i18n("Switch to QPainter backend"): i18n("Switch to OpenGL backend")) );
#endif
Options::useAltAz() ? i18n("Switch to star globe view (Equatorial &Coordinates)"): i18n("Switch to horizonal view (Horizontal &Coordinates)") );
actionCollection()->action("show_time_box" )->setChecked( Options::showTimeBox() );
actionCollection()->action("show_location_box" )->setChecked( Options::showGeoBox() );
......
......@@ -234,13 +234,7 @@ void KStars::initActions() {
actionCollection()->addAction("coordsys", this, SLOT( slotCoordSys() ) )
<< (Options::useAltAz() ? i18n("Switch to star globe view (Equatorial &Coordinates)"): i18n("Switch to horizonal view (Horizontal &Coordinates)"))
<< QKeySequence("Space" );
#ifdef HAVE_OPENGL
Q_ASSERT( SkyMap::Instance() ); // This assert should not fail, because SkyMap is already created by now. Just throwing it in anyway.
actionCollection()->addAction("opengl", SkyMap::Instance(), SLOT( slotToggleGL() ) )
<< (Options::useGL() ? i18n("Switch to QPainter backend"): i18n("Switch to OpenGL backend"));
#endif
<< QKeySequence("Space" );
actionCollection()->addAction("project_lambert", this, SLOT( slotMapProjection() ) )
<< i18n("&Lambert Azimuthal Equal-area" )
......
......@@ -215,52 +215,18 @@ SkyMap::SkyMap() :
connect(this, SIGNAL( positionChanged( SkyPoint*) ),
m_objBox, SLOT( slotPointChanged(SkyPoint*) ) );
#ifdef HAVE_OPENGL
m_SkyMapQDraw = new SkyMapQDraw( this );
m_SkyMapQDraw->setMouseTracking( true );
m_SkyMapGLDraw = new SkyMapGLDraw( this );
m_SkyMapGLDraw->setMouseTracking( true );
m_SkyMapGLDraw->hide();
m_SkyMapQDraw->hide();
if( Options::useGL() )
m_SkyMapDraw = m_SkyMapGLDraw;
else
m_SkyMapDraw = m_SkyMapQDraw;
#else
m_SkyMapDraw = new SkyMapQDraw( this );
m_SkyMapDraw->setMouseTracking( true );
#endif
m_SkyMapDraw->setParent( this->viewport() );
m_SkyMapDraw->show();
/*
m_Scene = new QGraphicsScene( rect() );
setScene( m_Scene );
*/
#ifdef HAVE_OPENGL
// If GL is enabled, the InfoBoxes work only with native painting.
m_iboxes = new InfoBoxes( m_SkyMapQDraw );
#else
m_iboxes = new InfoBoxes( m_SkyMapDraw );
#endif
m_iboxes->setVisible( Options::showInfoBoxes() );
m_iboxes->addInfoBox(m_timeBox);
m_iboxes->addInfoBox(m_geoBox);
m_iboxes->addInfoBox(m_objBox);
/*
( m_Scene->addWidget( m_iboxes ) )->setAcceptedMouseButtons( Qt::NoButton );
*/
// JM 2016-05-03: What is this needed for? why update skymap every 30 ms? It is now disabled since it degrades performance significantly.
//The update timer will be destructed when SkyMap is..
//QTimer *update = new QTimer(this);
//update->setInterval(30);
//connect(update, SIGNAL(timeout()), this, SLOT(update()) );
//update->start();
m_iboxes->addInfoBox(m_objBox);
}
......@@ -1104,50 +1070,6 @@ bool SkyMap::isSlewing() const {
return (slewing || ( clockSlewing && data->clock()->isActive() ) );
}
#ifdef HAVE_OPENGL
void SkyMap::slotToggleGL() {
Q_ASSERT( m_SkyMapGLDraw );
Q_ASSERT( m_SkyMapQDraw );
m_SkyMapDraw->setParent( 0 );
m_SkyMapDraw->hide();
if( Options::useGL() ) {
// Do NOT use GL
Options::setUseGL( false );
m_SkyMapDraw = m_SkyMapQDraw;
KStars::Instance()->actionCollection()->action( "opengl" )->setText(i18n("Switch to OpenGL backend"));
}
else {
// Use GL
QString message = i18n("This version of KStars comes with new experimental OpenGL support. Our experience is that OpenGL works "
"much faster on machines with hardware acceleration. Would you like to switch to OpenGL painting backends?");
int result = KMessageBox::warningYesNo( this, message,
i18n("Switch to OpenGL backend"),
KStandardGuiItem::yes(),
KStandardGuiItem::no(),
"dag_opengl_switch" );
if ( result == KMessageBox::Yes ) {
KMessageBox::information( this, i18n("Infoboxes will be disabled as they do not work correctly when using OpenGL backends as of this version"),
i18n("Switch to OpenGL backend"),
"dag_opengl_infoboxes" );
Options::setUseGL( true );
m_SkyMapDraw = m_SkyMapGLDraw;
KStars::Instance()->actionCollection()->action( "opengl" )->setText(i18n("Switch to QPainter backend"));
}
}
m_SkyMapDraw->setParent( viewport() );
m_SkyMapDraw->show();
m_SkyMapDraw->resize( size() );
}
#endif
#ifdef HAVE_XPLANET
void SkyMap::startXplanet( const QString & outputFile ) {
QString year, month, day, hour, minute, seconde, fov;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment