ConfigurationDialog.cpp   ConfigurationDialog.cpp 
skipping to change at line 24 skipping to change at line 24
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#include "Dialog.hpp" #include "Dialog.hpp"
#include "ConfigurationDialog.hpp" #include "ConfigurationDialog.hpp"
#include "CustomDeltaTEquationDialog.hpp"
#include "StelMainGraphicsView.hpp" #include "StelMainGraphicsView.hpp"
#include "StelMainWindow.hpp" #include "StelMainWindow.hpp"
#include "ui_configurationDialog.h" #include "ui_configurationDialog.h"
#include "StelAppGraphicsWidget.hpp" #include "StelAppGraphicsWidget.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelFileMgr.hpp" #include "StelFileMgr.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelLocaleMgr.hpp" #include "StelLocaleMgr.hpp"
#include "StelProjector.hpp" #include "StelProjector.hpp"
#include "StelObjectMgr.hpp" #include "StelObjectMgr.hpp"
skipping to change at line 63 skipping to change at line 64
#include "LabelMgr.hpp" #include "LabelMgr.hpp"
#include "ScreenImageMgr.hpp" #include "ScreenImageMgr.hpp"
#include "SkyGui.hpp" #include "SkyGui.hpp"
#include "StelJsonParser.hpp" #include "StelJsonParser.hpp"
#include "StelTranslator.hpp" #include "StelTranslator.hpp"
#include <QSettings> #include <QSettings>
#include <QDebug> #include <QDebug>
#include <QFile> #include <QFile>
#include <QFileDialog> #include <QFileDialog>
#include <QComboBox>
ConfigurationDialog::ConfigurationDialog(StelGui* agui) : StelDialog(agui), starCatalogDownloadReply(NULL), currentDownloadFile(NULL), progressBar(NUL L), gui(agui) ConfigurationDialog::ConfigurationDialog(StelGui* agui) : StelDialog(agui), starCatalogDownloadReply(NULL), currentDownloadFile(NULL), progressBar(NUL L), gui(agui)
{ {
ui = new Ui_configurationDialogForm; ui = new Ui_configurationDialogForm;
customDeltaTEquationDialog = NULL;
hasDownloadedStarCatalog = false; hasDownloadedStarCatalog = false;
isDownloadingStarCatalog = false; isDownloadingStarCatalog = false;
savedProjectionType = StelApp::getInstance().getCore()->getCurrentPr ojectionType(); savedProjectionType = StelApp::getInstance().getCore()->getCurrentPr ojectionType();
} }
ConfigurationDialog::~ConfigurationDialog() ConfigurationDialog::~ConfigurationDialog()
{ {
delete ui; delete ui;
ui = 0; ui = NULL;
delete customDeltaTEquationDialog;
customDeltaTEquationDialog = NULL;
} }
void ConfigurationDialog::retranslate() void ConfigurationDialog::retranslate()
{ {
if (dialog) { if (dialog) {
ui->retranslateUi(dialog); ui->retranslateUi(dialog);
//Hack to shrink the tabs to optimal size after language cha nge //Hack to shrink the tabs to optimal size after language cha nge
//by causing the list items to be laid out again. //by causing the list items to be laid out again.
ui->stackListWidget->setWrapping(false); ui->stackListWidget->setWrapping(false);
skipping to change at line 102 skipping to change at line 107
updateStarCatalogControlsText(); updateStarCatalogControlsText();
//Script information //Script information
//(trigger re-displaying the description of the current item ) //(trigger re-displaying the description of the current item )
#ifndef DISABLE_SCRIPTING #ifndef DISABLE_SCRIPTING
scriptSelectionChanged(ui->scriptListWidget->currentItem()-> text()); scriptSelectionChanged(ui->scriptListWidget->currentItem()-> text());
#endif #endif
//Plug-in information //Plug-in information
populatePluginsList(); populatePluginsList();
populateDeltaTAlgorithmsList();
} }
} }
void ConfigurationDialog::styleChanged() void ConfigurationDialog::styleChanged()
{ {
// Nothing for now // Nothing for now
} }
void ConfigurationDialog::updateIconsColor() void ConfigurationDialog::updateIconsColor()
{ {
skipping to change at line 224 skipping to change at line 231
ui->enableKeysNavigationCheckBox->setChecked(mvmgr->getFlagEnableMov eKeys() || mvmgr->getFlagEnableZoomKeys()); ui->enableKeysNavigationCheckBox->setChecked(mvmgr->getFlagEnableMov eKeys() || mvmgr->getFlagEnableZoomKeys());
ui->enableMouseNavigationCheckBox->setChecked(mvmgr->getFlagEnableMo useNavigation()); ui->enableMouseNavigationCheckBox->setChecked(mvmgr->getFlagEnableMo useNavigation());
connect(ui->enableKeysNavigationCheckBox, SIGNAL(toggled(bool)), mvm gr, SLOT(setFlagEnableMoveKeys(bool))); connect(ui->enableKeysNavigationCheckBox, SIGNAL(toggled(bool)), mvm gr, SLOT(setFlagEnableMoveKeys(bool)));
connect(ui->enableKeysNavigationCheckBox, SIGNAL(toggled(bool)), mvm gr, SLOT(setFlagEnableZoomKeys(bool))); connect(ui->enableKeysNavigationCheckBox, SIGNAL(toggled(bool)), mvm gr, SLOT(setFlagEnableZoomKeys(bool)));
connect(ui->enableMouseNavigationCheckBox, SIGNAL(toggled(bool)), mv mgr, SLOT(setFlagEnableMouseNavigation(bool))); connect(ui->enableMouseNavigationCheckBox, SIGNAL(toggled(bool)), mv mgr, SLOT(setFlagEnableMouseNavigation(bool)));
connect(ui->fixedDateTimeCurrentButton, SIGNAL(clicked()), this, SLO T(setFixedDateTimeToCurrent())); connect(ui->fixedDateTimeCurrentButton, SIGNAL(clicked()), this, SLO T(setFixedDateTimeToCurrent()));
connect(ui->editShortcutsPushButton, SIGNAL(clicked()), connect(ui->editShortcutsPushButton, SIGNAL(clicked()),
this, this,
SLOT(showShortcutsWindow())); SLOT(showShortcutsWindow()));
// Delta-T
populateDeltaTAlgorithmsList();
int idx = ui->deltaTAlgorithmComboBox->findData(core->getCurrentDelt
aTAlgorithmKey(), Qt::UserRole, Qt::MatchCaseSensitive);
if (idx==-1)
{
// Use Espenak & Meeus (2006) as default
idx = ui->deltaTAlgorithmComboBox->findData(QVariant("Espena
kMeeus"), Qt::UserRole, Qt::MatchCaseSensitive);
}
ui->deltaTAlgorithmComboBox->setCurrentIndex(idx);
connect(ui->deltaTAlgorithmComboBox, SIGNAL(currentIndexChanged(int)
), this, SLOT(setDeltaTAlgorithm(int)));
connect(ui->pushButtonCustomDeltaTEquationDialog, SIGNAL(clicked()),
this, SLOT(showCustomDeltaTEquationDialog()));
// Tools tab // Tools tab
ConstellationMgr* cmgr = GETSTELMODULE(ConstellationMgr); ConstellationMgr* cmgr = GETSTELMODULE(ConstellationMgr);
Q_ASSERT(cmgr); Q_ASSERT(cmgr);
ui->sphericMirrorCheckbox->setChecked(StelMainGraphicsView::getInsta nce().getStelAppGraphicsWidget()->getViewportEffect() == "sphericMirrorDist orter"); ui->sphericMirrorCheckbox->setChecked(StelMainGraphicsView::getInsta nce().getStelAppGraphicsWidget()->getViewportEffect() == "sphericMirrorDist orter");
connect(ui->sphericMirrorCheckbox, SIGNAL(toggled(bool)), this, SLOT (setSphericMirror(bool))); connect(ui->sphericMirrorCheckbox, SIGNAL(toggled(bool)), this, SLOT (setSphericMirror(bool)));
ui->gravityLabelCheckbox->setChecked(proj->getFlagGravityLabels()); ui->gravityLabelCheckbox->setChecked(proj->getFlagGravityLabels());
connect(ui->gravityLabelCheckbox, SIGNAL(toggled(bool)), StelApp::ge tInstance().getCore(), SLOT(setFlagGravityLabels(bool))); connect(ui->gravityLabelCheckbox, SIGNAL(toggled(bool)), StelApp::ge tInstance().getCore(), SLOT(setFlagGravityLabels(bool)));
ui->selectSingleConstellationButton->setChecked(cmgr->getFlagIsolate Selected()); ui->selectSingleConstellationButton->setChecked(cmgr->getFlagIsolate Selected());
connect(ui->selectSingleConstellationButton, SIGNAL(toggled(bool)), cmgr, SLOT(setFlagIsolateSelected(bool))); connect(ui->selectSingleConstellationButton, SIGNAL(toggled(bool)), cmgr, SLOT(setFlagIsolateSelected(bool)));
ui->diskViewportCheckbox->setChecked(proj->getMaskType() == StelProj ector::MaskDisk); ui->diskViewportCheckbox->setChecked(proj->getMaskType() == StelProj ector::MaskDisk);
skipping to change at line 477 skipping to change at line 496
StelCore* core = StelApp::getInstance().getCore(); StelCore* core = StelApp::getInstance().getCore();
const StelProjectorP proj = core->getProjection(StelCore::FrameJ2000 ); const StelProjectorP proj = core->getProjection(StelCore::FrameJ2000 );
Q_ASSERT(proj); Q_ASSERT(proj);
// view dialog / sky tab settings // view dialog / sky tab settings
conf->setValue("stars/absolute_scale", skyd->getAbsoluteStarScale()) ; conf->setValue("stars/absolute_scale", skyd->getAbsoluteStarScale()) ;
conf->setValue("stars/relative_scale", skyd->getRelativeStarScale()) ; conf->setValue("stars/relative_scale", skyd->getRelativeStarScale()) ;
conf->setValue("stars/flag_star_twinkle", skyd->getFlagTwinkle()); conf->setValue("stars/flag_star_twinkle", skyd->getFlagTwinkle());
conf->setValue("stars/star_twinkle_amount", skyd->getTwinkleAmount() ); conf->setValue("stars/star_twinkle_amount", skyd->getTwinkleAmount() );
conf->setValue("astro/flag_star_magnitude_limit",
skyd->getFlagStarMagnitudeLimit());
conf->setValue("astro/star_magnitude_limit",
skyd->getCustomStarMagnitudeLimit());
conf->setValue("astro/flag_nebula_magnitude_limit",
skyd->getFlagNebulaMagnitudeLimit());
conf->setValue("astro/nebula_magnitude_limit",
skyd->getCustomNebulaMagnitudeLimit());
conf->setValue("viewing/use_luminance_adaptation", skyd->getFlagLumi nanceAdaptation()); conf->setValue("viewing/use_luminance_adaptation", skyd->getFlagLumi nanceAdaptation());
conf->setValue("astro/flag_planets", ssmgr->getFlagPlanets()); conf->setValue("astro/flag_planets", ssmgr->getFlagPlanets());
conf->setValue("astro/flag_planets_hints", ssmgr->getFlagHints()); conf->setValue("astro/flag_planets_hints", ssmgr->getFlagHints());
conf->setValue("astro/flag_planets_orbits", ssmgr->getFlagOrbits()); conf->setValue("astro/flag_planets_orbits", ssmgr->getFlagOrbits());
conf->setValue("astro/flag_light_travel_time", ssmgr->getFlagLightTr avelTime()); conf->setValue("astro/flag_light_travel_time", ssmgr->getFlagLightTr avelTime());
conf->setValue("viewing/flag_moon_scaled", ssmgr->getFlagMoonScale() ); conf->setValue("viewing/flag_moon_scaled", ssmgr->getFlagMoonScale() );
conf->setValue("astro/meteor_rate", mmgr->getZHR()); conf->setValue("astro/meteor_rate", mmgr->getZHR());
// view dialog / markings tab settings // view dialog / markings tab settings
conf->setValue("viewing/flag_azimuthal_grid", glmgr->getFlagAzimutha lGrid()); conf->setValue("viewing/flag_azimuthal_grid", glmgr->getFlagAzimutha lGrid());
skipping to change at line 593 skipping to change at line 620
mvmgr->setInitFov(mvmgr->getCurrentFov()); mvmgr->setInitFov(mvmgr->getCurrentFov());
mvmgr->setInitViewDirectionToCurrent(); mvmgr->setInitViewDirectionToCurrent();
// configuration dialog / navigation tab // configuration dialog / navigation tab
conf->setValue("navigation/flag_enable_zoom_keys", mvmgr->getFlagEna bleZoomKeys()); conf->setValue("navigation/flag_enable_zoom_keys", mvmgr->getFlagEna bleZoomKeys());
conf->setValue("navigation/flag_enable_mouse_navigation", mvmgr->get FlagEnableMouseNavigation()); conf->setValue("navigation/flag_enable_mouse_navigation", mvmgr->get FlagEnableMouseNavigation());
conf->setValue("navigation/flag_enable_move_keys", mvmgr->getFlagEna bleMoveKeys()); conf->setValue("navigation/flag_enable_move_keys", mvmgr->getFlagEna bleMoveKeys());
conf->setValue("navigation/startup_time_mode", core->getStartupTimeM ode()); conf->setValue("navigation/startup_time_mode", core->getStartupTimeM ode());
conf->setValue("navigation/today_time", core->getInitTodayTime()); conf->setValue("navigation/today_time", core->getInitTodayTime());
conf->setValue("navigation/preset_sky_time", core->getPresetSkyTime( )); conf->setValue("navigation/preset_sky_time", core->getPresetSkyTime( ));
conf->setValue("navigation/time_correction_algorithm", core->getCurr entDeltaTAlgorithmKey());
conf->setValue("navigation/init_fov", mvmgr->getInitFov()); conf->setValue("navigation/init_fov", mvmgr->getInitFov());
if (mvmgr->getMountMode() == StelMovementMgr::MountAltAzimuthal) if (mvmgr->getMountMode() == StelMovementMgr::MountAltAzimuthal)
conf->setValue("navigation/viewing_mode", "horizon"); conf->setValue("navigation/viewing_mode", "horizon");
else else
conf->setValue("navigation/viewing_mode", "equator"); conf->setValue("navigation/viewing_mode", "equator");
// configuration dialog / tools tab // configuration dialog / tools tab
conf->setValue("gui/flag_show_flip_buttons", gui->getFlagShowFlipBut tons()); conf->setValue("gui/flag_show_flip_buttons", gui->getFlagShowFlipBut tons());
conf->setValue("video/viewport_effect", StelMainGraphicsView::getIns tance().getStelAppGraphicsWidget()->getViewportEffect()); conf->setValue("video/viewport_effect", StelMainGraphicsView::getIns tance().getStelAppGraphicsWidget()->getViewportEffect());
conf->setValue("projection/viewport", StelProjector::maskTypeToStrin g(proj->getMaskType())); conf->setValue("projection/viewport", StelProjector::maskTypeToStrin g(proj->getMaskType()));
skipping to change at line 1086 skipping to change at line 1114
ui->stackListWidget->setMinimumWidth(width); ui->stackListWidget->setMinimumWidth(width);
// FIXME: This works only sometimes... // FIXME: This works only sometimes...
/* /*
dialog->adjustSize(); dialog->adjustSize();
dialog->update(); dialog->update();
// ... and allow manual resize later. // ... and allow manual resize later.
ui->stackListWidget->setMinimumWidth(0); ui->stackListWidget->setMinimumWidth(0);
*/ */
} }
void ConfigurationDialog::populateDeltaTAlgorithmsList()
{
Q_ASSERT(ui->deltaTAlgorithmComboBox);
// TRANSLATORS: Full phrase is "Algorithm of DeltaT"
ui->deltaTLabel->setText(QString("%1 %2T:").arg(q_("Algorithm of")).
arg(QChar(0x0394)));
QComboBox* algorithms = ui->deltaTAlgorithmComboBox;
//Save the current selection to be restored later
algorithms->blockSignals(true);
int index = algorithms->currentIndex();
QVariant selectedAlgorithmId = algorithms->itemData(index);
algorithms->clear();
//For each algorithm, display the localized name and store the key a
s user
//data. Unfortunately, there's no other way to do this than with a c
ycle.
algorithms->addItem(q_("Without correction"), "WithoutCorrection");
algorithms->addItem(q_("Schoch (1931)"), "Schoch");
algorithms->addItem(q_("Clemence (1948)"), "Clemence");
algorithms->addItem(q_("IAU (1952)"), "IAU");
algorithms->addItem(q_("Astronomical Ephemeris (1960)"), "Astronomic
alEphemeris");
algorithms->addItem(q_("Tuckerman (1962, 1964) & Goldstine (1973)"),
"TuckermanGoldstine");
algorithms->addItem(q_("Muller & Stephenson (1975)"), "MullerStephen
son");
algorithms->addItem(q_("Stephenson (1978)"), "Stephenson1978");
algorithms->addItem(q_("Schmadel & Zech (1979)"), "SchmadelZech1979"
);
algorithms->addItem(q_("Morrison & Stephenson (1982)"), "MorrisonSte
phenson1982");
algorithms->addItem(q_("Stephenson & Morrison (1984)"), "StephensonM
orrison1984");
algorithms->addItem(q_("Stephenson & Houlden (1986)"), "StephensonHo
ulden");
algorithms->addItem(q_("Espenak (1987, 1989)"), "Espenak");
algorithms->addItem(q_("Borkowski (1988)"), "Borkowski");
algorithms->addItem(q_("Schmadel & Zech (1988)"), "SchmadelZech1988"
);
algorithms->addItem(q_("Chapront-Touze & Chapront (1991)"), "Chapron
tTouze");
algorithms->addItem(q_("Stephenson & Morrison (1995)"), "StephensonM
orrison1995");
algorithms->addItem(q_("Stephenson (1997)"), "Stephenson1997");
// The dropdown label is too long for the string, and Meeus 1998 is
very popular, this should be in the beginning of the tag.
algorithms->addItem(q_("Meeus (1998) (with Chapront, Chapront-Touze
& Francou (1997))"), "ChaprontMeeus");
algorithms->addItem(q_("JPL Horizons"), "JPLHorizons");
algorithms->addItem(q_("Meeus & Simons (2000)"), "MeeusSimons");
algorithms->addItem(q_("Montenbruck & Pfleger (2000)"), "Montenbruck
Pfleger");
algorithms->addItem(q_("Reingold & Dershowitz (2002, 2007)"), "Reing
oldDershowitz");
algorithms->addItem(q_("Morrison & Stephenson (2004, 2005)"), "Morri
sonStephenson2004");
// Espenak & Meeus (2006) used by default
algorithms->addItem(q_("Espenak & Meeus (2006)").append(" *"), "Espe
nakMeeus");
algorithms->addItem(q_("Reijs (2006)"), "Reijs");
algorithms->addItem(q_("Custom equation of %1T").arg(QChar(0x0394)),
"Custom");
//Restore the selection
index = algorithms->findData(selectedAlgorithmId, Qt::UserRole, Qt::
MatchCaseSensitive);
algorithms->setCurrentIndex(index);
//algorithms->model()->sort(0);
algorithms->blockSignals(false);
setDeltaTAlgorithmDescription();
}
void ConfigurationDialog::setDeltaTAlgorithm(int algorithmID)
{
StelCore* core = StelApp::getInstance().getCore();
QString currentAlgorithm = ui->deltaTAlgorithmComboBox->itemData(alg
orithmID).toString();
core->setCurrentDeltaTAlgorithmKey(currentAlgorithm);
setDeltaTAlgorithmDescription();
if (currentAlgorithm.contains("Custom"))
ui->pushButtonCustomDeltaTEquationDialog->setEnabled(true);
else
ui->pushButtonCustomDeltaTEquationDialog->setEnabled(false);
}
void ConfigurationDialog::setDeltaTAlgorithmDescription()
{
ui->deltaTAlgorithmDescription->document()->setDefaultStyleSheet(QSt
ring(gui->getStelStyle().htmlStyleSheet));
ui->deltaTAlgorithmDescription->setHtml(StelApp::getInstance().getCo
re()->getCurrentDeltaTAlgorithmDescription());
}
void ConfigurationDialog::showCustomDeltaTEquationDialog()
{
if (customDeltaTEquationDialog == NULL)
customDeltaTEquationDialog = new CustomDeltaTEquationDialog(
);
customDeltaTEquationDialog->setVisible(true);
}
 End of changes. 9 change blocks. 
1 lines changed or deleted 33 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/