• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.12
  • kdeedu
  • marble
  • src
  • lib
  • marble
SunControlWidget.cpp
Go to the documentation of this file.
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2008 David Roberts <dvdr18@gmail.com>
9 // Copyright 2008 Inge Wallin <inge@lysator.liu.se>
10 // Copyright 2010 Harshit Jain <hjain.itbhu@gmail.com>
11 // Copyright 2012 Mohammed Nafees <nafees.technocool@gmail.com>
12 //
13 
14 // Own
15 #include "SunControlWidget.h"
16 #include "ui_SunControlWidget.h"
17 
18 // Qt
19 #include <QShowEvent>
20 
21 // Marble
22 #include "MarbleDebug.h"
23 #include "MarbleWidget.h"
24 
25 using namespace Marble;
26 /* TRANSLATOR Marble::SunControlWidget */
27 
28 SunControlWidget::SunControlWidget( MarbleWidget* marbleWidget, QWidget* parent )
29  : QDialog( parent ),
30  m_uiWidget( new Ui::SunControlWidget ),
31  m_marbleWidget( marbleWidget ),
32  m_shadow( "shadow" )
33 {
34  m_uiWidget->setupUi( this );
35 
36  m_uiWidget->lockWarningLabel->hide();
37 
38  connect( m_uiWidget->applyButton, SIGNAL(clicked()), this, SLOT(apply()) );
39  connect( m_uiWidget->cancelButton, SIGNAL(clicked()), this, SLOT(reject()) );
40  connect( m_uiWidget->okButton, SIGNAL(clicked()), this, SLOT(apply()) );
41  connect( m_uiWidget->okButton, SIGNAL(clicked()), this, SLOT(accept()) );
42 
43  setModal( false );
44 
45 }
46 
47 SunControlWidget::~SunControlWidget()
48 {
49  delete m_uiWidget;
50 }
51 
52 void SunControlWidget::apply()
53 {
54  if( m_uiWidget->sunShading->isChecked() )
55  {
56  if( m_uiWidget->showShadow->isChecked() )
57  {
58  emit showSun( true );
59  m_marbleWidget->setShowCityLights( false );
60  m_shadow = "shadow";
61  }
62  else if( m_uiWidget->showNightMap->isChecked() )
63  {
64  emit showSun( true );
65  m_marbleWidget->setShowCityLights( true );
66  m_shadow = "nightmap";
67  }
68  }
69  else
70  {
71  emit showSun( false );
72  m_marbleWidget->setShowCityLights( false );
73  }
74 
75  if( m_uiWidget->lockToSubSolarPointCheckBox->isChecked() )
76  {
77  m_marbleWidget->setLockToSubSolarPoint( true );
78  emit isLockedToSubSolarPoint( true );
79  }
80  else
81  {
82  m_marbleWidget->setLockToSubSolarPoint( false );
83  emit isLockedToSubSolarPoint( false );
84  }
85 
86  if( m_uiWidget->subSolarIconCheckBox->isChecked() )
87  {
88  m_marbleWidget->setSubSolarPointIconVisible( true );
89  emit isSubSolarPointIconVisible( true );
90  }
91  else
92  {
93  m_marbleWidget->setSubSolarPointIconVisible( false );
94  emit isSubSolarPointIconVisible( false );
95  }
96 }
97 
98 void SunControlWidget::setSunShading( bool active )
99 {
100  m_uiWidget->sunShading->setChecked( active );
101 }
102 
103 void SunControlWidget::showEvent( QShowEvent* event )
104 {
105  if( !event->spontaneous() )
106  {
107  // Loading all options
108  if( m_marbleWidget->showSunShading() )
109  {
110  m_uiWidget->sunShading->setChecked( true );
111  m_uiWidget->showShadow->setChecked( m_marbleWidget->showSunShading() );
112  m_uiWidget->showNightMap->setChecked( m_marbleWidget->showCityLights() );
113  }
114  else
115  {
116  m_uiWidget->showShadow->setChecked( false );
117  if( m_shadow == "shadow" )
118  {
119  m_uiWidget->showShadow->setChecked( true );
120  }
121  else
122  {
123  m_uiWidget->showNightMap->setChecked( true );
124  }
125  }
126  m_uiWidget->subSolarIconCheckBox->setChecked( m_marbleWidget->isSubSolarPointIconVisible() );
127  m_uiWidget->lockToSubSolarPointCheckBox->setChecked( m_marbleWidget->isLockedToSubSolarPoint() );
128  }
129 }
130 
131 #include "SunControlWidget.moc"
Marble::MarbleWidget::isSubSolarPointIconVisible
bool isSubSolarPointIconVisible
Definition: MarbleWidget.h:126
Marble::MarbleWidget::setShowCityLights
void setShowCityLights(bool visible)
Set whether city lights instead of night shadow are visible.
Definition: MarbleWidget.cpp:936
Marble::SunControlWidget::SunControlWidget
SunControlWidget(MarbleWidget *marbleWidget, QWidget *parent=0)
Definition: SunControlWidget.cpp:28
QDialog
Marble::SunControlWidget::showEvent
void showEvent(QShowEvent *event)
Definition: SunControlWidget.cpp:103
QWidget
Marble::SunControlWidget::showSun
void showSun(bool show)
Marble::SunControlWidget
Definition: SunControlWidget.h:31
Marble::SunControlWidget::m_shadow
QString m_shadow
Definition: SunControlWidget.h:55
MarbleDebug.h
Marble::SunControlWidget::setSunShading
void setSunShading(bool)
Definition: SunControlWidget.cpp:98
Marble::MarbleWidget::showCityLights
bool showCityLights
Definition: MarbleWidget.h:124
Marble::MarbleWidget
A widget class that displays a view of the earth.
Definition: MarbleWidget.h:102
Marble::MarbleWidget::setSubSolarPointIconVisible
void setSubSolarPointIconVisible(bool visible)
Set whether the sun icon is shown in the sub solar point.
Definition: MarbleWidget.cpp:951
Marble::SunControlWidget::~SunControlWidget
virtual ~SunControlWidget()
Definition: SunControlWidget.cpp:47
Marble::SunControlWidget::m_marbleWidget
MarbleWidget *const m_marbleWidget
Definition: SunControlWidget.h:54
Marble::MarbleWidget::isLockedToSubSolarPoint
bool isLockedToSubSolarPoint
Definition: MarbleWidget.h:125
Marble::SunControlWidget::isLockedToSubSolarPoint
void isLockedToSubSolarPoint(bool show)
Marble::MarbleWidget::setLockToSubSolarPoint
void setLockToSubSolarPoint(bool visible)
Set the globe locked to the sub solar point.
Definition: MarbleWidget.cpp:943
Marble::MarbleWidget::showSunShading
bool showSunShading
Definition: MarbleWidget.h:123
Marble::SunControlWidget::isSubSolarPointIconVisible
void isSubSolarPointIconVisible(bool show)
MarbleWidget.h
This file contains the headers for MarbleWidget.
SunControlWidget.h
Marble::SunControlWidget::m_uiWidget
Ui::SunControlWidget * m_uiWidget
Definition: SunControlWidget.h:53
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:53 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal