From kde-commits Sat Jan 19 16:24:56 2013 From: Rene Kuettner Date: Sat, 19 Jan 2013 16:24:56 +0000 To: kde-commits Subject: [marble/esasocis-2012-eclipse] src/plugins/render/eclipses: EclipsesPlugin: Allow for years B.C. Message-Id: <20130119162456.8EC80A60C8 () git ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=135861270616994 Git commit 7bcc2ec9afc812895f6c6ce814606f41a742f753 by Rene Kuettner. Committed on 19/01/2013 at 17:24. Pushed by renek into branch 'esasocis-2012-eclipse'. EclipsesPlugin: Allow for years B.C. M +11 -6 src/plugins/render/eclipses/EclipsesBrowserDialog.cpp M +1 -0 src/plugins/render/eclipses/EclipsesBrowserDialog.h M +4 -1 src/plugins/render/eclipses/EclipsesBrowserDialog.ui http://commits.kde.org/marble/7bcc2ec9afc812895f6c6ce814606f41a742f753 diff --git a/src/plugins/render/eclipses/EclipsesBrowserDialog.cpp b/src/pl= ugins/render/eclipses/EclipsesBrowserDialog.cpp index 6e3caba..8c386ce 100644 --- a/src/plugins/render/eclipses/EclipsesBrowserDialog.cpp +++ b/src/plugins/render/eclipses/EclipsesBrowserDialog.cpp @@ -24,7 +24,8 @@ namespace Marble { EclipsesBrowserDialog::EclipsesBrowserDialog( const MarbleModel *model, QWidget *parent ) : QDialog( parent ), - m_marbleModel( model ) + m_marbleModel( model ), + m_year( 1 ) { initialize(); } @@ -36,14 +37,13 @@ EclipsesBrowserDialog::~EclipsesBrowserDialog() = void EclipsesBrowserDialog::setYear( int year ) { - if( !isVisible() ) { - m_listWidget->spinBoxYear->setValue( year ); - } + m_year =3D year; + m_listWidget->spinBoxYear->setValue( year ); } = int EclipsesBrowserDialog::year() const { - return m_listWidget->spinBoxYear->value(); + return m_year; } = void EclipsesBrowserDialog::accept() @@ -61,7 +61,12 @@ void EclipsesBrowserDialog::accept() = void EclipsesBrowserDialog::updateEclipsesBrowserForYear( int year ) { - Q_ASSERT( year >=3D 0 ); + if( year =3D=3D 0 ) { + // since year 0 make no sense, we proceed to the next valid year + setYear( ( m_year > 0 ) ? -1 : 1 ); + return; + } + m_eclModel->setYear( year ); updateButtonStates(); } diff --git a/src/plugins/render/eclipses/EclipsesBrowserDialog.h b/src/plug= ins/render/eclipses/EclipsesBrowserDialog.h index 7af45f2..3927bf2 100644 --- a/src/plugins/render/eclipses/EclipsesBrowserDialog.h +++ b/src/plugins/render/eclipses/EclipsesBrowserDialog.h @@ -98,6 +98,7 @@ private: const MarbleModel *m_marbleModel; Ui::EclipsesBrowserDialog *m_listWidget; EclipsesModel *m_eclModel; + int m_year; }; = } // namespace Marble diff --git a/src/plugins/render/eclipses/EclipsesBrowserDialog.ui b/src/plu= gins/render/eclipses/EclipsesBrowserDialog.ui index ebaa67c..0170d92 100644 --- a/src/plugins/render/eclipses/EclipsesBrowserDialog.ui +++ b/src/plugins/render/eclipses/EclipsesBrowserDialog.ui @@ -68,11 +68,14 @@ + + -100000 + 100000 - 0 + 1