[Marble-commits] KDE/kdeedu/marble/src/plugins/render/weather
Jens-Michael Hoffmann
jensmh at gmx.de
Fri Mar 26 16:13:20 CET 2010
SVN commit 1107710 by jmhoffmann:
WeatherPlugin: move include directive for generated ui header to source file.
This made the nice side effect possible that the ui widget is only created if the
configuration dialog is used.
M +26 -22 WeatherPlugin.cpp
M +6 -2 WeatherPlugin.h
--- trunk/KDE/kdeedu/marble/src/plugins/render/weather/WeatherPlugin.cpp #1107709:1107710
@@ -12,6 +12,7 @@
#include "WeatherPlugin.h"
// Marble
+#include "ui_WeatherConfigWidget.h"
#include "WeatherData.h"
#include "WeatherModel.h"
#include "PluginAboutDialog.h"
@@ -36,6 +37,7 @@
m_icon(),
m_aboutDialog( 0 ),
m_configDialog( 0 ),
+ ui_configWidget( 0 ),
m_settings()
{
setNameId( "weather" );
@@ -55,6 +57,7 @@
{
delete m_aboutDialog;
delete m_configDialog;
+ delete ui_configWidget;
}
void WeatherPlugin::initialize()
@@ -118,13 +121,14 @@
if ( !m_configDialog ) {
// Initializing configuration dialog
m_configDialog = new QDialog();
- ui_configWidget.setupUi( m_configDialog );
+ ui_configWidget = new Ui::WeatherConfigWidget;
+ ui_configWidget->setupUi( m_configDialog );
readSettings();
- connect( ui_configWidget.m_buttonBox, SIGNAL( accepted() ),
+ connect( ui_configWidget->m_buttonBox, SIGNAL( accepted() ),
SLOT( writeSettings() ) );
- connect( ui_configWidget.m_buttonBox, SIGNAL( rejected() ),
+ connect( ui_configWidget->m_buttonBox, SIGNAL( rejected() ),
SLOT( readSettings() ) );
- QPushButton *applyButton = ui_configWidget.m_buttonBox->button( QDialogButtonBox::Apply );
+ QPushButton *applyButton = ui_configWidget->m_buttonBox->button( QDialogButtonBox::Apply );
connect( applyButton, SIGNAL( clicked() ),
this, SLOT( writeSettings() ) );
}
@@ -206,33 +210,33 @@
// Information
if ( m_settings.value( "showCondition" ).toBool() )
- ui_configWidget.m_weatherConditionBox->setCheckState( Qt::Checked );
+ ui_configWidget->m_weatherConditionBox->setCheckState( Qt::Checked );
else
- ui_configWidget.m_weatherConditionBox->setCheckState( Qt::Unchecked );
+ ui_configWidget->m_weatherConditionBox->setCheckState( Qt::Unchecked );
if ( m_settings.value( "showTemperature" ).toBool() )
- ui_configWidget.m_temperatureBox->setCheckState( Qt::Checked );
+ ui_configWidget->m_temperatureBox->setCheckState( Qt::Checked );
else
- ui_configWidget.m_temperatureBox->setCheckState( Qt::Unchecked );
+ ui_configWidget->m_temperatureBox->setCheckState( Qt::Unchecked );
if ( m_settings.value( "showWindDirection" ).toBool() )
- ui_configWidget.m_windDirectionBox->setCheckState( Qt::Checked );
+ ui_configWidget->m_windDirectionBox->setCheckState( Qt::Checked );
else
- ui_configWidget.m_windDirectionBox->setCheckState( Qt::Unchecked );
+ ui_configWidget->m_windDirectionBox->setCheckState( Qt::Unchecked );
if ( m_settings.value( "showWindSpeed" ).toBool() )
- ui_configWidget.m_windSpeedBox->setCheckState( Qt::Checked );
+ ui_configWidget->m_windSpeedBox->setCheckState( Qt::Checked );
else
- ui_configWidget.m_windSpeedBox->setCheckState( Qt::Unchecked );
+ ui_configWidget->m_windSpeedBox->setCheckState( Qt::Unchecked );
// Units
- ui_configWidget.m_temperatureComboBox
+ ui_configWidget->m_temperatureComboBox
->setCurrentIndex( m_settings.value( "temperatureUnit" ).toInt() );
- ui_configWidget.m_windSpeedComboBox
+ ui_configWidget->m_windSpeedComboBox
->setCurrentIndex( m_settings.value( "windSpeedUnit" ).toInt() );
- ui_configWidget.m_pressureComboBox
+ ui_configWidget->m_pressureComboBox
->setCurrentIndex( m_settings.value( "pressureUnit" ).toInt() );
}
@@ -240,18 +244,18 @@
{
// Information
m_settings.insert( "showCondition",
- ui_configWidget.m_weatherConditionBox->checkState() == Qt::Checked );
+ ui_configWidget->m_weatherConditionBox->checkState() == Qt::Checked );
m_settings.insert( "showTemperature",
- ui_configWidget.m_temperatureBox->checkState() == Qt::Checked );
+ ui_configWidget->m_temperatureBox->checkState() == Qt::Checked );
m_settings.insert( "showWindDirection",
- ui_configWidget.m_windDirectionBox->checkState() == Qt::Checked );
+ ui_configWidget->m_windDirectionBox->checkState() == Qt::Checked );
m_settings.insert( "showWindSpeed",
- ui_configWidget.m_windSpeedBox->checkState() == Qt::Checked );
+ ui_configWidget->m_windSpeedBox->checkState() == Qt::Checked );
// Units
- m_settings.insert( "temperatureUnit", ui_configWidget.m_temperatureComboBox->currentIndex() );
- m_settings.insert( "windSpeedUnit", ui_configWidget.m_windSpeedComboBox->currentIndex() );
- m_settings.insert( "pressureUnit", ui_configWidget.m_pressureComboBox->currentIndex() );
+ m_settings.insert( "temperatureUnit", ui_configWidget->m_temperatureComboBox->currentIndex() );
+ m_settings.insert( "windSpeedUnit", ui_configWidget->m_windSpeedComboBox->currentIndex() );
+ m_settings.insert( "pressureUnit", ui_configWidget->m_pressureComboBox->currentIndex() );
emit settingsChanged( nameId() );
}
--- trunk/KDE/kdeedu/marble/src/plugins/render/weather/WeatherPlugin.h #1107709:1107710
@@ -12,13 +12,17 @@
#define WEATHERPLUGIN_H
#include "AbstractDataPlugin.h"
-#include "ui_WeatherConfigWidget.h"
// Qt
#include <QtCore/QHash>
class QIcon;
+namespace Ui
+{
+ class WeatherConfigWidget;
+}
+
namespace Marble
{
@@ -69,7 +73,7 @@
mutable QIcon m_icon;
mutable PluginAboutDialog *m_aboutDialog;
mutable QDialog * m_configDialog;
- mutable Ui::WeatherConfigWidget ui_configWidget;
+ mutable Ui::WeatherConfigWidget * ui_configWidget;
QHash<QString,QVariant> m_settings;
};
More information about the Marble-commits
mailing list