SearchDialog.cpp   SearchDialog.cpp 
skipping to change at line 134 skipping to change at line 134
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) SearchDialog::SearchDialog(QObject* parent)
: StelDialog(parent) : StelDialog("Search", parent)
, simbadReply(NULL) , simbadReply(NULL)
, flagHasSelectedText(false)
{ {
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;
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(); 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()
{ {
skipping to change at line 468 skipping to change at line 466
// make up vector more stable. // make up vector more stable.
// Strictly mount should be in a new J2000 m ode, but this here also stabilizes searching J2000 coordinates. // Strictly mount should be in a new J2000 m ode, but this here also stabilizes searching J2000 coordinates.
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 equatorial: case equatorial:
{ {
StelUtils::spheToRect(spinLong, spinLat, pos); StelUtils::spheToRect(spinLong, spinLat, pos);
pos = core->equinoxEquToJ2000(pos); pos = core->equinoxEquToJ2000(pos, StelCore::Refract ionOff);
if ( (mountMode==StelMovementMgr::MountEquinoxEquato rial) && (fabs(spinLat)> (0.9*M_PI/2.0)) ) if ( (mountMode==StelMovementMgr::MountEquinoxEquato rial) && (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 horizontal: case horizontal:
skipping to change at line 531 skipping to change at line 529
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, StelCore::Refract ionOff);
break; break;
} }
} }
mvmgr->setFlagTracking(false); mvmgr->setFlagTracking(false);
mvmgr->moveToJ2000(pos, aimUp, 0.05); mvmgr->moveToJ2000(pos, aimUp, 0.05);
mvmgr->setFlagLockEquPos(useLockPosition); mvmgr->setFlagLockEquPos(useLockPosition);
} }
void SearchDialog::onSearchTextChanged(const QString& text) void SearchDialog::onSearchTextChanged(const QString& text)
{ {
skipping to change at line 565 skipping to change at line 563
QString trimmedText = text.trimmed().toLower(); QString trimmedText = text.trimmed().toLower();
if (trimmedText.isEmpty()) { if (trimmedText.isEmpty()) {
ui->completionLabel->clearValues(); ui->completionLabel->clearValues();
ui->completionLabel->selectFirst(); ui->completionLabel->selectFirst();
ui->simbadStatusLabel->setText(""); ui->simbadStatusLabel->setText("");
ui->pushButtonGotoSearchSkyObject->setEnabled(false); ui->pushButtonGotoSearchSkyObject->setEnabled(false);
} else { } else {
if (useSimbad) if (useSimbad)
{ {
simbadReply = simbadSearcher->lookup(simbadServerUrl , trimmedText, 3); simbadReply = simbadSearcher->lookup(simbadServerUrl , trimmedText, 4);
onSimbadStatusChanged(); onSimbadStatusChanged();
connect(simbadReply, SIGNAL(statusChanged()), this, SLOT(onSimbadStatusChanged())); connect(simbadReply, SIGNAL(statusChanged()), this, SLOT(onSimbadStatusChanged()));
} }
QString greekText = substituteGreek(trimmedText); QString greekText = substituteGreek(trimmedText);
QStringList matches; QStringList matches;
if(greekText != trimmedText) { if(greekText != trimmedText)
matches = objectMgr->listMatchingObjects(trimmedText {
, 5, useStartOfWords, false); matches = objectMgr->listMatchingObjects(trimmedTex
matches += objectMgr->listMatchingObjects(trimmedTex t, 8, useStartOfWords, false);
t, 5, useStartOfWords, true); matches += objectMgr->listMatchingObjects(trimmedTex
matches += objectMgr->listMatchingObjects(greekText, t, 8, useStartOfWords, true);
(15 - matches.size()), useStartOfWords, false); matches += objectMgr->listMatchingObjects(greekText,
matches += objectMgr->listMatchingObjects(greekText, (18 - matches.size()), useStartOfWords, false);
(15 - matches.size()), useStartOfWords, true); matches += objectMgr->listMatchingObjects(greekText,
} else { (18 - matches.size()), useStartOfWords, true);
matches = objectMgr->listMatchingObjects(trimmedText }
, 10, useStartOfWords, false); else
matches += objectMgr->listMatchingObjects(trimmedTex {
t, 10, useStartOfWords, true); matches = objectMgr->listMatchingObjects(trimmedTex
t, 13, useStartOfWords, false);
matches += objectMgr->listMatchingObjects(trimmedTex
t, 13, useStartOfWords, true);
} }
// remove possible duplicates from completion list // remove possible duplicates from completion list
matches.removeDuplicates(); matches.removeDuplicates();
matches.sort(Qt::CaseInsensitive); matches.sort(Qt::CaseInsensitive);
// objects with short names should be searched first // objects with short names should be searched first
// examples: Moon, Hydra (moon); Jupiter, Ghost of Jupiter // examples: Moon, Hydra (moon); Jupiter, Ghost of Jupiter
stringLengthCompare comparator; stringLengthCompare comparator;
qSort(matches.begin(), matches.end(), comparator); qSort(matches.begin(), matches.end(), comparator);
skipping to change at line 657 skipping to change at line 658
flagHasSelectedText = false; flagHasSelectedText = false;
} }
else else
sso->setText(sso->text() + sender->text()); sso->setText(sso->text() + sender->text());
} }
sso->setFocus(); sso->setFocus();
} }
void SearchDialog::gotoObject() void SearchDialog::gotoObject()
{ {
QString name = ui->completionLabel->getSelected(); gotoObject(ui->completionLabel->getSelected());
gotoObject(name);
} }
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))
{ {
skipping to change at line 736 skipping to change at line 736
{ {
GETSTELMODULE(StelObjectMgr)->unSelect(); GETSTELMODULE(StelObjectMgr)->unSelect();
} }
} }
} }
simbadResults.clear(); simbadResults.clear();
} }
void SearchDialog::gotoObject(QListWidgetItem *item) void SearchDialog::gotoObject(QListWidgetItem *item)
{ {
QString objName = item->text(); gotoObject(item->text());
gotoObject(objName);
} }
void SearchDialog::searchListChanged(const QString &newText) void SearchDialog::searchListChanged(const QString &newText)
{ {
QList<QListWidgetItem*> items = ui->objectsListWidget->findItems(new Text, Qt::MatchStartsWith); QList<QListWidgetItem*> items = ui->objectsListWidget->findItems(new Text, Qt::MatchStartsWith);
ui->objectsListWidget->clearSelection(); ui->objectsListWidget->clearSelection();
if (!items.isEmpty()) if (!items.isEmpty())
{ {
items.at(0)->setSelected(true); items.at(0)->setSelected(true);
ui->objectsListWidget->scrollToItem(items.at(0)); ui->objectsListWidget->scrollToItem(items.at(0));
 End of changes. 10 change blocks. 
25 lines changed or deleted 24 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/