SearchDialog.cpp   SearchDialog.cpp 
skipping to change at line 30 skipping to change at line 30
#include "Dialog.hpp" #include "Dialog.hpp"
#include "SearchDialog.hpp" #include "SearchDialog.hpp"
#include "ui_searchDialogGui.h" #include "ui_searchDialogGui.h"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelModuleMgr.hpp" #include "StelModuleMgr.hpp"
#include "StelMovementMgr.hpp" #include "StelMovementMgr.hpp"
#include "StelLocaleMgr.hpp" #include "StelLocaleMgr.hpp"
#include "StelTranslator.hpp" #include "StelTranslator.hpp"
#include "Planet.hpp" #include "Planet.hpp"
#include "CustomObjectMgr.hpp"
#include "StelObjectMgr.hpp" #include "StelObjectMgr.hpp"
#include "StelGui.hpp" #include "StelGui.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include <QDebug> #include <QDebug>
#include <QFrame> #include <QFrame>
#include <QLabel> #include <QLabel>
#include <QPushButton> #include <QPushButton>
#include <QSettings> #include <QSettings>
skipping to change at line 132 skipping to change at line 133
} }
setText(newText); setText(newText);
} }
// Start of members for class SearchDialog // Start of members for class SearchDialog
const char* SearchDialog::DEF_SIMBAD_URL = "http://simbad.u-strasbg.fr/"; const char* SearchDialog::DEF_SIMBAD_URL = "http://simbad.u-strasbg.fr/";
SearchDialog::SearchDialogStaticData SearchDialog::staticData; SearchDialog::SearchDialogStaticData SearchDialog::staticData;
QString SearchDialog::extSearchText = ""; QString SearchDialog::extSearchText = "";
SearchDialog::SearchDialog(QObject* parent) : StelDialog(parent), simbadRep SearchDialog::SearchDialog(QObject* parent)
ly(NULL) : StelDialog(parent)
, simbadReply(NULL)
{ {
dialogName = "Search"; dialogName = "Search";
ui = new Ui_searchDialogForm; ui = new Ui_searchDialogForm;
simbadSearcher = new SimbadSearcher(this); simbadSearcher = new SimbadSearcher(this);
objectMgr = GETSTELMODULE(StelObjectMgr); objectMgr = GETSTELMODULE(StelObjectMgr);
Q_ASSERT(objectMgr); Q_ASSERT(objectMgr);
flagHasSelectedText = false; flagHasSelectedText = false;
conf = StelApp::getInstance().getSettings(); conf = StelApp::getInstance().getSettings();
useSimbad = conf->value("search/flag_search_online", true).toBool(); useSimbad = conf->value("search/flag_search_online", true).toBool();
useStartOfWords = conf->value("search/flag_start_words", false).toBo ol(); useStartOfWords = conf->value("search/flag_start_words", false).toBo ol();
useLockPosition = conf->value("search/flag_lock_position", true).toB ool();
simbadServerUrl = conf->value("search/simbad_server_url", DEF_SIMBAD _URL).toString(); simbadServerUrl = conf->value("search/simbad_server_url", DEF_SIMBAD _URL).toString();
setCurrentCoordinateSystemKey(conf->value("search/coordinate_system" , "equatorialJ2000").toString()); setCurrentCoordinateSystemKey(conf->value("search/coordinate_system" , "equatorialJ2000").toString());
} }
SearchDialog::~SearchDialog() SearchDialog::~SearchDialog()
{ {
delete ui; delete ui;
if (simbadReply) if (simbadReply)
{ {
simbadReply->deleteLater(); simbadReply->deleteLater();
skipping to change at line 212 skipping to change at line 216
csys->blockSignals(true); csys->blockSignals(true);
int index = csys->currentIndex(); int index = csys->currentIndex();
QVariant selectedSystemId = csys->itemData(index); QVariant selectedSystemId = csys->itemData(index);
csys->clear(); csys->clear();
//For each coordinate system, display the localized name and store t he key as user //For each coordinate system, display the localized name and store t he key as user
//data. Unfortunately, there's no other way to do this than with a c ycle. //data. Unfortunately, there's no other way to do this than with a c ycle.
csys->addItem(qc_("Equatorial (J2000.0)", "coordinate system"), "equ atorialJ2000"); csys->addItem(qc_("Equatorial (J2000.0)", "coordinate system"), "equ atorialJ2000");
csys->addItem(qc_("Equatorial", "coordinate system"), "equatorial"); csys->addItem(qc_("Equatorial", "coordinate system"), "equatorial");
csys->addItem(qc_("Horizontal", "coordinate system"), "horizontal"); csys->addItem(qc_("Horizontal", "coordinate system"), "horizontal");
csys->addItem(qc_("Galactic", "coordinate system"), "galactic"); csys->addItem(qc_("Galactic", "coordinate system"), "galactic");
csys->addItem(qc_("Supergalactic", "coordinate system"), "supergalac tic");
csys->addItem(qc_("Ecliptic", "coordinate system"), "ecliptic"); csys->addItem(qc_("Ecliptic", "coordinate system"), "ecliptic");
csys->addItem(qc_("Ecliptic (J2000.0)", "coordinate system"), "eclip ticJ2000"); csys->addItem(qc_("Ecliptic (J2000.0)", "coordinate system"), "eclip ticJ2000");
//Restore the selection //Restore the selection
index = csys->findData(selectedSystemId, Qt::UserRole, Qt::MatchCase Sensitive); index = csys->findData(selectedSystemId, Qt::UserRole, Qt::MatchCase Sensitive);
csys->setCurrentIndex(index); csys->setCurrentIndex(index);
csys->blockSignals(false); csys->blockSignals(false);
} }
void SearchDialog::populateCoordinateAxis() void SearchDialog::populateCoordinateAxis()
skipping to change at line 264 skipping to change at line 269
ui->AxisXSpinBox->setPrefixType(AngleSpinBox::Normal Plus); ui->AxisXSpinBox->setPrefixType(AngleSpinBox::Normal Plus);
ui->AxisYLabel->setText(q_("Altitude")); ui->AxisYLabel->setText(q_("Altitude"));
ui->AxisYSpinBox->setDisplayFormat(AngleSpinBox::DMS Symbols); ui->AxisYSpinBox->setDisplayFormat(AngleSpinBox::DMS Symbols);
ui->AxisYSpinBox->setPrefixType(AngleSpinBox::Normal Plus); ui->AxisYSpinBox->setPrefixType(AngleSpinBox::Normal Plus);
xnormal = false; xnormal = false;
break; break;
} }
case ecliptic: case ecliptic:
case eclipticJ2000: case eclipticJ2000:
case galactic: case galactic:
case supergalactic:
{ {
ui->AxisXLabel->setText(q_("Longitude")); ui->AxisXLabel->setText(q_("Longitude"));
ui->AxisXSpinBox->setDisplayFormat(AngleSpinBox::DMS SymbolsUnsigned); ui->AxisXSpinBox->setDisplayFormat(AngleSpinBox::DMS SymbolsUnsigned);
ui->AxisXSpinBox->setPrefixType(AngleSpinBox::Normal Plus); ui->AxisXSpinBox->setPrefixType(AngleSpinBox::Normal Plus);
ui->AxisYLabel->setText(q_("Latitude")); ui->AxisYLabel->setText(q_("Latitude"));
ui->AxisYSpinBox->setDisplayFormat(AngleSpinBox::DMS Symbols); ui->AxisYSpinBox->setDisplayFormat(AngleSpinBox::DMS Symbols);
ui->AxisYSpinBox->setPrefixType(AngleSpinBox::Normal Plus); ui->AxisYSpinBox->setPrefixType(AngleSpinBox::Normal Plus);
xnormal = false; xnormal = false;
break; break;
} }
skipping to change at line 364 skipping to change at line 370
connect(ui->piPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLet terClicked())); connect(ui->piPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLet terClicked()));
connect(ui->rhoPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLe tterClicked())); connect(ui->rhoPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLe tterClicked()));
connect(ui->sigmaPushButton, SIGNAL(clicked(bool)), this, SLOT(greek LetterClicked())); connect(ui->sigmaPushButton, SIGNAL(clicked(bool)), this, SLOT(greek LetterClicked()));
connect(ui->tauPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLe tterClicked())); connect(ui->tauPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLe tterClicked()));
connect(ui->upsilonPushButton, SIGNAL(clicked(bool)), this, SLOT(gre ekLetterClicked())); connect(ui->upsilonPushButton, SIGNAL(clicked(bool)), this, SLOT(gre ekLetterClicked()));
connect(ui->phiPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLe tterClicked())); connect(ui->phiPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLe tterClicked()));
connect(ui->chiPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLe tterClicked())); connect(ui->chiPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLe tterClicked()));
connect(ui->psiPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLe tterClicked())); connect(ui->psiPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLe tterClicked()));
connect(ui->omegaPushButton, SIGNAL(clicked(bool)), this, SLOT(greek LetterClicked())); connect(ui->omegaPushButton, SIGNAL(clicked(bool)), this, SLOT(greek LetterClicked()));
connect(ui->checkBoxUseSimbad, SIGNAL(clicked(bool)), this, SLOT(ena connect(ui->simbadGroupBox, SIGNAL(clicked(bool)), this, SLOT(enable
bleSimbadSearch(bool))); SimbadSearch(bool)));
ui->checkBoxUseSimbad->setChecked(useSimbad); ui->simbadGroupBox->setChecked(useSimbad);
populateSimbadServerList(); populateSimbadServerList();
idx = ui->serverListComboBox->findData(simbadServerUrl, Qt::UserRole , Qt::MatchCaseSensitive); idx = ui->serverListComboBox->findData(simbadServerUrl, Qt::UserRole , Qt::MatchCaseSensitive);
if (idx==-1) if (idx==-1)
{ {
// Use University of Strasbourg as default // Use University of Strasbourg as default
idx = ui->serverListComboBox->findData(QVariant(DEF_SIMBAD_U RL), Qt::UserRole, Qt::MatchCaseSensitive); idx = ui->serverListComboBox->findData(QVariant(DEF_SIMBAD_U RL), Qt::UserRole, Qt::MatchCaseSensitive);
} }
ui->serverListComboBox->setCurrentIndex(idx); ui->serverListComboBox->setCurrentIndex(idx);
connect(ui->serverListComboBox, SIGNAL(currentIndexChanged(int)), th is, SLOT(selectSimbadServer(int))); connect(ui->serverListComboBox, SIGNAL(currentIndexChanged(int)), th is, SLOT(selectSimbadServer(int)));
connect(ui->checkBoxUseStartOfWords, SIGNAL(clicked(bool)), this, SL OT(enableStartOfWordsAutofill(bool))); connect(ui->checkBoxUseStartOfWords, SIGNAL(clicked(bool)), this, SL OT(enableStartOfWordsAutofill(bool)));
ui->checkBoxUseStartOfWords->setChecked(useStartOfWords); ui->checkBoxUseStartOfWords->setChecked(useStartOfWords);
connect(ui->checkBoxLockPosition, SIGNAL(clicked(bool)), this, SLOT(
enableLockPosition(bool)));
ui->checkBoxLockPosition->setChecked(useLockPosition);
// list views initialization // list views initialization
connect(ui->objectTypeComboBox, SIGNAL(activated(int)), this, SLOT(u pdateListWidget(int))); connect(ui->objectTypeComboBox, SIGNAL(activated(int)), this, SLOT(u pdateListWidget(int)));
connect(ui->searchInListLineEdit, SIGNAL(textChanged(QString)), this , SLOT(searchListChanged(QString))); connect(ui->searchInListLineEdit, SIGNAL(textChanged(QString)), this , SLOT(searchListChanged(QString)));
connect(ui->searchInEnglishCheckBox, SIGNAL(toggled(bool)), this, SL OT(updateListTab())); connect(ui->searchInEnglishCheckBox, SIGNAL(toggled(bool)), this, SL OT(updateListTab()));
connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(updat eListTab())); connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(updat eListTab()));
updateListTab(); updateListTab();
// Set the focus directly on the line edit // Set the focus directly on the line edit
if (ui->lineEditSearchSkyObject->isEnabled()) if (ui->lineEditSearchSkyObject->isEnabled())
ui->lineEditSearchSkyObject->setFocus(); ui->lineEditSearchSkyObject->setFocus();
skipping to change at line 409 skipping to change at line 418
useSimbad = enable; useSimbad = enable;
conf->setValue("search/flag_search_online", useSimbad); conf->setValue("search/flag_search_online", useSimbad);
} }
void SearchDialog::enableStartOfWordsAutofill(bool enable) void SearchDialog::enableStartOfWordsAutofill(bool enable)
{ {
useStartOfWords = enable; useStartOfWords = enable;
conf->setValue("search/flag_start_words", useStartOfWords); conf->setValue("search/flag_start_words", useStartOfWords);
} }
void SearchDialog::enableLockPosition(bool enable)
{
useLockPosition = enable;
conf->setValue("search/flag_lock_position", useLockPosition);
}
void SearchDialog::setSimpleStyle() void SearchDialog::setSimpleStyle()
{ {
ui->AxisXSpinBox->setVisible(false); ui->AxisXSpinBox->setVisible(false);
ui->AxisXSpinBox->setVisible(false); ui->AxisXSpinBox->setVisible(false);
ui->simbadStatusLabel->setVisible(false); ui->simbadStatusLabel->setVisible(false);
ui->AxisXLabel->setVisible(false); ui->AxisXLabel->setVisible(false);
ui->AxisYLabel->setVisible(false); ui->AxisYLabel->setVisible(false);
ui->coordinateSystemLabel->setVisible(false); ui->coordinateSystemLabel->setVisible(false);
ui->coordinateSystemComboBox->setVisible(false); ui->coordinateSystemComboBox->setVisible(false);
} }
skipping to change at line 492 skipping to change at line 507
StelUtils::spheToRect(spinLong, spinLat, pos); StelUtils::spheToRect(spinLong, spinLat, pos);
pos = core->galacticToJ2000(pos); pos = core->galacticToJ2000(pos);
if ( (mountMode==StelMovementMgr::MountGalactic) && (fabs(spinLat)> (0.9*M_PI/2.0)) ) if ( (mountMode==StelMovementMgr::MountGalactic) && (fabs(spinLat)> (0.9*M_PI/2.0)) )
{ {
// make up vector more stable. // make up vector more stable.
mvmgr->setViewUpVector(Vec3d(-cos(spinLong), -sin(spinLong), 0.) * (spinLat>0. ? 1. : -1. )); mvmgr->setViewUpVector(Vec3d(-cos(spinLong), -sin(spinLong), 0.) * (spinLat>0. ? 1. : -1. ));
aimUp=mvmgr->getViewUpVectorJ2000(); aimUp=mvmgr->getViewUpVectorJ2000();
} }
break; break;
} }
case supergalactic:
{
StelUtils::spheToRect(spinLong, spinLat, pos);
pos = core->supergalacticToJ2000(pos);
if ( (mountMode==StelMovementMgr::MountSupergalactic
) && (fabs(spinLat)> (0.9*M_PI/2.0)) )
{
// make up vector more stable.
mvmgr->setViewUpVector(Vec3d(-cos(spinLong),
-sin(spinLong), 0.) * (spinLat>0. ? 1. : -1. ));
aimUp=mvmgr->getViewUpVectorJ2000();
}
break;
}
case eclipticJ2000: case eclipticJ2000:
{ {
double ra, dec; double ra, dec;
StelUtils::eclToEqu(spinLong, spinLat, core->getCurr entPlanet()->getRotObliquity(2451545.0), &ra, &dec); StelUtils::eclToEqu(spinLong, spinLat, core->getCurr entPlanet()->getRotObliquity(2451545.0), &ra, &dec);
StelUtils::spheToRect(ra, dec, pos); StelUtils::spheToRect(ra, dec, pos);
break; break;
} }
case ecliptic: case ecliptic:
{ {
double ra, dec; double ra, dec;
StelUtils::eclToEqu(spinLong, spinLat, core->getCurr entPlanet()->getRotObliquity(core->getJDE()), &ra, &dec); StelUtils::eclToEqu(spinLong, spinLat, core->getCurr entPlanet()->getRotObliquity(core->getJDE()), &ra, &dec);
StelUtils::spheToRect(ra, dec, pos); StelUtils::spheToRect(ra, dec, pos);
pos = core->equinoxEquToJ2000(pos); pos = core->equinoxEquToJ2000(pos);
break; break;
} }
} }
mvmgr->setFlagTracking(false); mvmgr->setFlagTracking(false);
mvmgr->moveToJ2000(pos, aimUp, 0.05); mvmgr->moveToJ2000(pos, aimUp, 0.05);
mvmgr->setFlagLockEquPos(useLockPosition);
} }
void SearchDialog::onSearchTextChanged(const QString& text) void SearchDialog::onSearchTextChanged(const QString& text)
{ {
// This block needs to go before the trimmedText.isEmpty() or the SI MBAD result does not // This block needs to go before the trimmedText.isEmpty() or the SI MBAD result does not
// get properly cleared. // get properly cleared.
if (useSimbad) { if (useSimbad) {
if (simbadReply) { if (simbadReply) {
disconnect(simbadReply, disconnect(simbadReply,
SIGNAL(statusChanged()), SIGNAL(statusChanged()),
skipping to change at line 641 skipping to change at line 669
} }
void SearchDialog::gotoObject(const QString &nameI18n) void SearchDialog::gotoObject(const QString &nameI18n)
{ {
if (nameI18n.isEmpty()) if (nameI18n.isEmpty())
return; return;
StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementMgr); StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementMgr);
if (simbadResults.contains(nameI18n)) if (simbadResults.contains(nameI18n))
{ {
close(); if (objectMgr->findAndSelect(nameI18n))
Vec3d pos = simbadResults[nameI18n]; {
Vec3d aimUp; const QList<StelObjectP> newSelected = objectMgr->ge
objectMgr->unSelect(); tSelectedObject();
mvmgr->setViewUpVector(Vec3d(0., 0., 1.)); if (!newSelected.empty())
aimUp=mvmgr->getViewUpVectorJ2000(); {
mvmgr->moveToJ2000(pos, aimUp, mvmgr->getAutoMoveDuration()) close();
; ui->lineEditSearchSkyObject->clear();
ui->lineEditSearchSkyObject->clear(); ui->completionLabel->clearValues();
ui->completionLabel->clearValues(); // Can't point to home planet
if (newSelected[0]->getEnglishName()!=StelAp
p::getInstance().getCore()->getCurrentLocation().planetName)
{
mvmgr->moveToObject(newSelected[0],
mvmgr->getAutoMoveDuration());
mvmgr->setFlagTracking(true);
}
else
{
GETSTELMODULE(StelObjectMgr)->unSele
ct();
}
}
}
else
{
close();
GETSTELMODULE(CustomObjectMgr)->addCustomObject(name
I18n, simbadResults[nameI18n]);
ui->lineEditSearchSkyObject->clear();
ui->completionLabel->clearValues();
if (objectMgr->findAndSelect(nameI18n))
{
const QList<StelObjectP> newSelected = objec
tMgr->getSelectedObject();
// Can't point to home planet
if (newSelected[0]->getEnglishName()!=StelAp
p::getInstance().getCore()->getCurrentLocation().planetName)
{
mvmgr->moveToObject(newSelected[0],
mvmgr->getAutoMoveDuration());
mvmgr->setFlagTracking(true);
}
else
{
GETSTELMODULE(StelObjectMgr)->unSele
ct();
}
}
}
} }
else if (objectMgr->findAndSelectI18n(nameI18n) || objectMgr->findAn dSelect(nameI18n)) else if (objectMgr->findAndSelectI18n(nameI18n) || objectMgr->findAn dSelect(nameI18n))
{ {
const QList<StelObjectP> newSelected = objectMgr->getSelecte dObject(); const QList<StelObjectP> newSelected = objectMgr->getSelecte dObject();
if (!newSelected.empty()) if (!newSelected.empty())
{ {
close(); close();
ui->lineEditSearchSkyObject->clear(); ui->lineEditSearchSkyObject->clear();
ui->completionLabel->clearValues(); ui->completionLabel->clearValues();
// Can't point to home planet // Can't point to home planet
 End of changes. 11 change blocks. 
15 lines changed or deleted 85 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/