[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [marble/esasocis-2012-eclipse] src/plugins/render/eclipses: EclipsesPlugin: Implement reading and wr
From: Rene Kuettner <rene () bitkanal ! net>
Date: 2013-01-17 18:29:09
Message-ID: 20130117182909.6763AA60D4 () git ! kde ! org
[Download RAW message or body]
Git commit feee8cef4df97133cc7019b6dd1e8621cec03d96 by Rene Kuettner.
Committed on 17/01/2013 at 19:28.
Pushed by renek into branch 'esasocis-2012-eclipse'.
EclipsesPlugin: Implement reading and writing of settings
M +24 -21 src/plugins/render/eclipses/EclipsesConfigDialog.ui
M +104 -46 src/plugins/render/eclipses/EclipsesPlugin.cpp
M +1 -0 src/plugins/render/eclipses/EclipsesPlugin.h
http://commits.kde.org/marble/feee8cef4df97133cc7019b6dd1e8621cec03d96
diff --git a/src/plugins/render/eclipses/EclipsesConfigDialog.ui \
b/src/plugins/render/eclipses/EclipsesConfigDialog.ui index 117f110..1ce549d 100644
--- a/src/plugins/render/eclipses/EclipsesConfigDialog.ui
+++ b/src/plugins/render/eclipses/EclipsesConfigDialog.ui
@@ -17,7 +17,7 @@
<string>Eclipses Configuration</string>
</property>
<property name="modal">
- <bool>true</bool>
+ <bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
@@ -37,7 +37,7 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
- <widget class="QCheckBox" name="checkBoxEnableLunarEcl">
+ <widget class="QCheckBox" name="checkBoxEnableLunarEclipses">
<property name="enabled">
<bool>false</bool>
</property>
@@ -47,7 +47,7 @@
</widget>
</item>
<item>
- <widget class="QCheckBox" name="checkBox">
+ <widget class="QCheckBox" name="checkBoxShowEclipseControlWidget">
<property name="enabled">
<bool>false</bool>
</property>
@@ -64,84 +64,87 @@
<property name="title">
<string>&Eclipse Elements</string>
</property>
+ <property name="checkable">
+ <bool>false</bool>
+ </property>
<layout class="QGridLayout" name="gridLayout">
<item row="6" column="0">
- <widget class="QCheckBox" name="checkBoxNorthernPenumbra">
+ <widget class="QCheckBox" name="checkBoxShowNorthernPenumbra">
<property name="text">
<string>&Northern Penumbra</string>
</property>
<property name="checked">
- <bool>true</bool>
+ <bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="0">
- <widget class="QCheckBox" name="checkBoxUmbra">
+ <widget class="QCheckBox" name="checkBoxShowUmbra">
<property name="text">
<string>&Umbra</string>
</property>
<property name="checked">
- <bool>true</bool>
+ <bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0">
- <widget class="QCheckBox" name="checkBoxMaximum">
+ <widget class="QCheckBox" name="checkBoxShowMaximum">
<property name="text">
<string>Position of Eclipse &Maximum</string>
</property>
<property name="checked">
- <bool>true</bool>
+ <bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="1">
- <widget class="QCheckBox" name="checkBoxCentralLine">
+ <widget class="QCheckBox" name="checkBoxShowCentralLine">
<property name="text">
<string>Central &Line</string>
</property>
<property name="checked">
- <bool>true</bool>
+ <bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="1">
- <widget class="QCheckBox" name="checkBoxFullPenUmbra">
+ <widget class="QCheckBox" name="checkBoxShowFullPenumbra">
<property name="text">
<string>Full &Penumbra</string>
</property>
<property name="checked">
- <bool>true</bool>
+ <bool>false</bool>
</property>
</widget>
</item>
<item row="6" column="1">
- <widget class="QCheckBox" name="checkBoxSunsetBoundaries">
+ <widget class="QCheckBox" name="checkBoxShowSunBoundaries">
<property name="text">
<string>Sunrise and Sunset &Boundaries</string>
</property>
<property name="checked">
- <bool>true</bool>
+ <bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="0">
- <widget class="QCheckBox" name="checkBoxSouthernPenumbra">
+ <widget class="QCheckBox" name="checkBoxShowSouthernPenumbra">
<property name="text">
<string>&Southern Penumbra</string>
</property>
<property name="checked">
- <bool>true</bool>
+ <bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="1">
- <widget class="QCheckBox" name="checkBox60MagPenUmbra">
+ <widget class="QCheckBox" name="checkBoxShow60MagPenumbra">
<property name="text">
<string>Penumbra with 60% Ma&gnitude</string>
</property>
<property name="checked">
- <bool>true</bool>
+ <bool>false</bool>
</property>
</widget>
</item>
@@ -149,7 +152,7 @@
</widget>
</item>
<item>
- <spacer name="verticalSpacer1">
+ <spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@@ -171,7 +174,7 @@
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::Reset</set>
</property>
</widget>
</item>
diff --git a/src/plugins/render/eclipses/EclipsesPlugin.cpp \
b/src/plugins/render/eclipses/EclipsesPlugin.cpp index 23ca336..fc5c428 100644
--- a/src/plugins/render/eclipses/EclipsesPlugin.cpp
+++ b/src/plugins/render/eclipses/EclipsesPlugin.cpp
@@ -24,6 +24,7 @@
#include "ui_EclipsesConfigDialog.h"
#include "ui_EclipsesReminderDialog.h"
+#include <QPushButton>
#include <QTreeWidget>
#include <QTreeWidgetItem>
@@ -67,7 +68,6 @@ EclipsesPlugin::EclipsesPlugin( const MarbleModel *marbleModel )
connect( this, SIGNAL(settingsChanged(QString)),
SLOT(updateSettings()) );
- setSettings( QHash<QString, QVariant>() );
setEnabled( true );
}
@@ -167,6 +167,13 @@ void EclipsesPlugin::initialize()
m_configWidget = new Ui::EclipsesConfigDialog();
m_configWidget->setupUi( m_configDialog );
+ connect( m_configDialog, SIGNAL(accepted()),
+ this, SLOT(writeSettings()) );
+ connect( m_configDialog, SIGNAL(rejected()),
+ this, SLOT(readSettings()) );
+ connect( m_configWidget->buttonBox->button( QDialogButtonBox::Reset ),
+ SIGNAL(clicked()), this, SLOT(readSettings()) );
+
m_listDialog = new EclipsesListDialog( marbleModel() );
connect( m_listDialog, SIGNAL(buttonShowClicked(int, int)),
this, SLOT(showEclipse(int,int)) );
@@ -192,6 +199,7 @@ void EclipsesPlugin::initialize()
m_isInitialized = true;
+ readSettings();
updateEclipses();
updateMenuItems();
updateSettings();
@@ -240,70 +248,85 @@ bool EclipsesPlugin::render( GeoPainter *painter,
bool EclipsesPlugin::renderItem( GeoPainter *painter, EclipsesItem *item )
{
+ QList<GeoDataCoordinates>::const_iterator ci;
int phase = item->phase();
// plot central line for central eclipses
- painter->setPen( Qt::black );
- painter->drawPolyline( item->centralLine() );
+ if( m_configWidget->checkBoxShowCentralLine->isChecked() ) {
+ painter->setPen( Qt::black );
+ painter->drawPolyline( item->centralLine() );
+ }
- if( phase > 3 ) // total or annular eclipse
+ // total or annular eclipse
+ if( m_configWidget->checkBoxShowUmbra->isChecked() && phase > 3 )
{
painter->setPen( Oxygen::aluminumGray4 );
QColor sunBoundingBrush ( Oxygen::aluminumGray4 );
sunBoundingBrush.setAlpha( 128 );
painter->setBrush( sunBoundingBrush );
painter->drawPolygon( item->umbra() );
- }
- // draw shadow cones
- QList<GeoDataCoordinates>::const_iterator ci;
-
- painter->setPen( Qt::black );
- ci = item->shadowConeUmbra().constBegin();
- for ( ; ci != item->shadowConeUmbra().constEnd(); ++ci ) {
- painter->drawEllipse( *ci, 2, 2 );
+ // draw shadow cone
+ painter->setPen( Qt::black );
+ ci = item->shadowConeUmbra().constBegin();
+ for ( ; ci != item->shadowConeUmbra().constEnd(); ++ci ) {
+ painter->drawEllipse( *ci, 2, 2 );
+ }
}
- painter->setPen( Qt::blue );
- ci = item->shadowConePenUmbra().constBegin();
- for ( ; ci != item->shadowConePenUmbra().constEnd(); ++ci ) {
- painter->drawEllipse( *ci, 2, 2 );
- }
+ // penumbra shadow cones
- painter->setPen( Qt::magenta );
- ci = item->shadowCone60MagPenUmbra().constBegin();
- for ( ; ci != item->shadowCone60MagPenUmbra().constEnd(); ++ci ) {
- painter->drawEllipse( *ci, 3, 3 );
+ if( m_configWidget->checkBoxShowFullPenumbra->isChecked() ) {
+ painter->setPen( Qt::blue );
+ ci = item->shadowConePenUmbra().constBegin();
+ for ( ; ci != item->shadowConePenUmbra().constEnd(); ++ci ) {
+ painter->drawEllipse( *ci, 2, 2 );
+ }
}
- // mark point of maximum eclipse
+ if( m_configWidget->checkBoxShow60MagPenumbra->isChecked() ) {
+ painter->setPen( Qt::magenta );
+ ci = item->shadowCone60MagPenUmbra().constBegin();
+ for ( ; ci != item->shadowCone60MagPenUmbra().constEnd(); ++ci ) {
+ painter->drawEllipse( *ci, 3, 3 );
+ }
+ }
- painter->setPen( Qt::white );
- QColor sunBoundingBrush ( Qt::white );
- sunBoundingBrush.setAlpha( 128 );
- painter->setBrush( sunBoundingBrush );
+ if( m_configWidget->checkBoxShowMaximum->isChecked() ) {
+ // mark point of maximum eclipse
+ painter->setPen( Qt::white );
+ QColor sunBoundingBrush ( Qt::white );
+ sunBoundingBrush.setAlpha( 128 );
+ painter->setBrush( sunBoundingBrush );
- painter->drawEllipse( item->maxLocation(), 15, 15 );
- painter->setPen( Oxygen::brickRed4 );
- painter->drawText( item->maxLocation(), tr( "Maximum of Eclipse" ) );
+ painter->drawEllipse( item->maxLocation(), 15, 15 );
+ painter->setPen( Oxygen::brickRed4 );
+ painter->drawText( item->maxLocation(), tr( "Maximum of Eclipse" ) );
+ }
- // southern boundary
- painter->setPen( Oxygen::brickRed4 );
- painter->drawPolyline( item->southernPenUmbra() );
+ if( m_configWidget->checkBoxShowSouthernPenumbra->isChecked() ) {
+ // southern boundary
+ painter->setPen( Oxygen::brickRed4 );
+ painter->drawPolyline( item->southernPenUmbra() );
+ }
- // northern boundary
- painter->setPen( Oxygen::brickRed4 );
- painter->drawPolyline( item->northernPenUmbra() );
+ if( m_configWidget->checkBoxShowNorthernPenumbra->isChecked() ) {
+ // northern boundary
+ painter->setPen( Oxygen::brickRed4 );
+ painter->drawPolyline( item->northernPenUmbra() );
+ }
- // Sunrise / Sunset Boundaries
- painter->setPen( Oxygen::hotOrange5 );
- const QList<GeoDataLinearRing> boundaries = item->sunBoundaries();
- QList<GeoDataLinearRing>::const_iterator i = boundaries.constBegin();
- for( ; i != boundaries.constEnd(); ++i ) {
- QColor sunBoundingBrush ( Oxygen::hotOrange5 );
- sunBoundingBrush.setAlpha( 64 );
- painter->setBrush( sunBoundingBrush );
- painter->drawPolygon( *i );
+ if( m_configWidget->checkBoxShowSunBoundaries->isChecked() ) {
+ // Sunrise / Sunset Boundaries
+ painter->setPen( Oxygen::hotOrange5 );
+ const QList<GeoDataLinearRing> boundaries = item->sunBoundaries();
+ QList<GeoDataLinearRing>::const_iterator i = boundaries.constBegin();
+ for( ; i != boundaries.constEnd(); ++i ) {
+ QColor sunBoundingBrush ( Oxygen::hotOrange5 );
+ sunBoundingBrush.setAlpha( 64 );
+ painter->setBrush( sunBoundingBrush );
+ painter->drawPolygon( *i );
+ }
}
return true;
@@ -317,17 +340,52 @@ QHash<QString, QVariant> EclipsesPlugin::settings() const
void EclipsesPlugin::setSettings( const QHash<QString, QVariant> &settings )
{
m_settings = settings;
-
- readSettings();
emit settingsChanged( nameId() );
}
void EclipsesPlugin::readSettings()
{
+ m_configWidget->checkBoxEnableLunarEclipses->setChecked(
+ m_settings.value( "enableLunarEclipses", false ).toBool() );
+ m_configWidget->checkBoxShowMaximum->setChecked(
+ m_settings.value( "showMaximum", true ).toBool() );
+ m_configWidget->checkBoxShowUmbra->setChecked(
+ m_settings.value( "showUmbra", true ).toBool() );
+ m_configWidget->checkBoxShowSouthernPenumbra->setChecked(
+ m_settings.value( "showSouthernPenumbra", true ).toBool() );
+ m_configWidget->checkBoxShowNorthernPenumbra->setChecked(
+ m_settings.value( "showNorthernPenumbra", true ).toBool() );
+ m_configWidget->checkBoxShowCentralLine->setChecked(
+ m_settings.value( "showCentralLine", true ).toBool() );
+ m_configWidget->checkBoxShowFullPenumbra->setChecked(
+ m_settings.value( "showFullPenumbra", true ).toBool() );
+ m_configWidget->checkBoxShow60MagPenumbra->setChecked(
+ m_settings.value( "show60MagPenumbra", false ).toBool() );
+ m_configWidget->checkBoxShowSunBoundaries->setChecked(
+ m_settings.value( "showSunBoundaries", true ).toBool() );
}
void EclipsesPlugin::writeSettings()
{
+ m_settings.insert( "enableLunarEclipses",
+ m_configWidget->checkBoxEnableLunarEclipses->isChecked() );
+ m_settings.insert( "showMaximum",
+ m_configWidget->checkBoxShowMaximum->isChecked() );
+ m_settings.insert( "showUmbra",
+ m_configWidget->checkBoxShowUmbra->isChecked() );
+ m_settings.insert( "showSouthernPenumbra",
+ m_configWidget->checkBoxShowSouthernPenumbra->isChecked() );
+ m_settings.insert( "showNorthernPenumbra",
+ m_configWidget->checkBoxShowNorthernPenumbra->isChecked() );
+ m_settings.insert( "showCentralLine",
+ m_configWidget->checkBoxShowCentralLine->isChecked() );
+ m_settings.insert( "showFullPenumbra",
+ m_configWidget->checkBoxShowFullPenumbra->isChecked() );
+ m_settings.insert( "show60MagPenumbra",
+ m_configWidget->checkBoxShow60MagPenumbra->isChecked() );
+ m_settings.insert( "showSunBoundaries",
+ m_configWidget->checkBoxShowSunBoundaries->isChecked() );
+
emit settingsChanged( nameId() );
}
diff --git a/src/plugins/render/eclipses/EclipsesPlugin.h \
b/src/plugins/render/eclipses/EclipsesPlugin.h index f5e4a4a..350eeb2 100644
--- a/src/plugins/render/eclipses/EclipsesPlugin.h
+++ b/src/plugins/render/eclipses/EclipsesPlugin.h
@@ -103,6 +103,7 @@ private:
QMenu *m_eclipsesListMenu;
int m_menuYear;
+ // dialogs
QDialog *m_configDialog;
Ui::EclipsesConfigDialog *m_configWidget;
EclipsesListDialog *m_listDialog;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic