129
130
SearchDialog::SearchDialogStaticData SearchDialog::staticData;
130
131
QString SearchDialog::extSearchText = "";
132
SearchDialog::SearchDialog(QObject* parent) : StelDialog(parent), simbadReply(NULL)
133
SearchDialog::SearchDialog(QObject* parent)
134
137
dialogName = "Search";
135
138
ui = new Ui_searchDialogForm;
142
145
conf = StelApp::getInstance().getSettings();
143
146
useSimbad = conf->value("search/flag_search_online", true).toBool();
144
147
useStartOfWords = conf->value("search/flag_start_words", false).toBool();
148
useLockPosition = conf->value("search/flag_lock_position", true).toBool();
145
149
simbadServerUrl = conf->value("search/simbad_server_url", DEF_SIMBAD_URL).toString();
146
150
setCurrentCoordinateSystemKey(conf->value("search/coordinate_system", "equatorialJ2000").toString());
209
213
csys->addItem(qc_("Equatorial", "coordinate system"), "equatorial");
210
214
csys->addItem(qc_("Horizontal", "coordinate system"), "horizontal");
211
215
csys->addItem(qc_("Galactic", "coordinate system"), "galactic");
216
csys->addItem(qc_("Supergalactic", "coordinate system"), "supergalactic");
212
217
csys->addItem(qc_("Ecliptic", "coordinate system"), "ecliptic");
213
218
csys->addItem(qc_("Ecliptic (J2000.0)", "coordinate system"), "eclipticJ2000");
361
367
connect(ui->psiPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLetterClicked()));
362
368
connect(ui->omegaPushButton, SIGNAL(clicked(bool)), this, SLOT(greekLetterClicked()));
364
connect(ui->checkBoxUseSimbad, SIGNAL(clicked(bool)), this, SLOT(enableSimbadSearch(bool)));
365
ui->checkBoxUseSimbad->setChecked(useSimbad);
370
connect(ui->simbadGroupBox, SIGNAL(clicked(bool)), this, SLOT(enableSimbadSearch(bool)));
371
ui->simbadGroupBox->setChecked(useSimbad);
367
373
populateSimbadServerList();
368
374
idx = ui->serverListComboBox->findData(simbadServerUrl, Qt::UserRole, Qt::MatchCaseSensitive);
377
383
connect(ui->checkBoxUseStartOfWords, SIGNAL(clicked(bool)), this, SLOT(enableStartOfWordsAutofill(bool)));
378
384
ui->checkBoxUseStartOfWords->setChecked(useStartOfWords);
386
connect(ui->checkBoxLockPosition, SIGNAL(clicked(bool)), this, SLOT(enableLockPosition(bool)));
387
ui->checkBoxLockPosition->setChecked(useLockPosition);
380
389
// list views initialization
381
390
connect(ui->objectTypeComboBox, SIGNAL(activated(int)), this, SLOT(updateListWidget(int)));
382
391
connect(ui->searchInListLineEdit, SIGNAL(textChanged(QString)), this, SLOT(searchListChanged(QString)));
406
415
conf->setValue("search/flag_start_words", useStartOfWords);
418
void SearchDialog::enableLockPosition(bool enable)
420
useLockPosition = enable;
421
conf->setValue("search/flag_lock_position", useLockPosition);
409
424
void SearchDialog::setSimpleStyle()
411
426
ui->AxisXSpinBox->setVisible(false);
510
StelUtils::spheToRect(spinLong, spinLat, pos);
511
pos = core->supergalacticToJ2000(pos);
512
if ( (mountMode==StelMovementMgr::MountSupergalactic) && (fabs(spinLat)> (0.9*M_PI/2.0)) )
514
// make up vector more stable.
515
mvmgr->setViewUpVector(Vec3d(-cos(spinLong), -sin(spinLong), 0.) * (spinLat>0. ? 1. : -1. ));
516
aimUp=mvmgr->getViewUpVectorJ2000();
493
520
case eclipticJ2000:
509
536
mvmgr->setFlagTracking(false);
510
537
mvmgr->moveToJ2000(pos, aimUp, 0.05);
538
mvmgr->setFlagLockEquPos(useLockPosition);
513
541
void SearchDialog::onSearchTextChanged(const QString& text)
640
668
StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementMgr);
641
669
if (simbadResults.contains(nameI18n))
644
Vec3d pos = simbadResults[nameI18n];
646
objectMgr->unSelect();
647
mvmgr->setViewUpVector(Vec3d(0., 0., 1.));
648
aimUp=mvmgr->getViewUpVectorJ2000();
649
mvmgr->moveToJ2000(pos, aimUp, mvmgr->getAutoMoveDuration());
650
ui->lineEditSearchSkyObject->clear();
651
ui->completionLabel->clearValues();
671
if (objectMgr->findAndSelect(nameI18n))
673
const QList<StelObjectP> newSelected = objectMgr->getSelectedObject();
674
if (!newSelected.empty())
677
ui->lineEditSearchSkyObject->clear();
678
ui->completionLabel->clearValues();
679
// Can't point to home planet
680
if (newSelected[0]->getEnglishName()!=StelApp::getInstance().getCore()->getCurrentLocation().planetName)
682
mvmgr->moveToObject(newSelected[0], mvmgr->getAutoMoveDuration());
683
mvmgr->setFlagTracking(true);
687
GETSTELMODULE(StelObjectMgr)->unSelect();
694
GETSTELMODULE(CustomObjectMgr)->addCustomObject(nameI18n, simbadResults[nameI18n]);
695
ui->lineEditSearchSkyObject->clear();
696
ui->completionLabel->clearValues();
697
if (objectMgr->findAndSelect(nameI18n))
699
const QList<StelObjectP> newSelected = objectMgr->getSelectedObject();
700
// Can't point to home planet
701
if (newSelected[0]->getEnglishName()!=StelApp::getInstance().getCore()->getCurrentLocation().planetName)
703
mvmgr->moveToObject(newSelected[0], mvmgr->getAutoMoveDuration());
704
mvmgr->setFlagTracking(true);
708
GETSTELMODULE(StelObjectMgr)->unSelect();
653
713
else if (objectMgr->findAndSelectI18n(nameI18n) || objectMgr->findAndSelect(nameI18n))