SearchDialog.cpp   SearchDialog.cpp 
skipping to change at line 48 skipping to change at line 48
#include <QPushButton> #include <QPushButton>
#include <QSettings> #include <QSettings>
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>
#include <QtAlgorithms> #include <QtAlgorithms>
#include <QTextEdit> #include <QTextEdit>
#include <QLineEdit> #include <QLineEdit>
#include <QComboBox> #include <QComboBox>
#include <QMenu> #include <QMenu>
#include <QMetaEnum> #include <QMetaEnum>
#include <QClipboard>
#include "SimbadSearcher.hpp" #include "SimbadSearcher.hpp"
// Start of members for class CompletionLabel // Start of members for class CompletionLabel
CompletionLabel::CompletionLabel(QWidget* parent) : QLabel(parent), selecte dIdx(0) CompletionLabel::CompletionLabel(QWidget* parent) : QLabel(parent), selecte dIdx(0)
{ {
} }
CompletionLabel::~CompletionLabel() CompletionLabel::~CompletionLabel()
{ {
skipping to change at line 128 skipping to change at line 129
newText+=values[i]; newText+=values[i];
if (i!=values.size()-1) if (i!=values.size()-1)
newText += ", "; newText += ", ";
} }
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;
QString SearchDialog::extSearchText = "";
SearchDialog::SearchDialog(QObject* parent) : StelDialog(parent), simbadRep ly(NULL) SearchDialog::SearchDialog(QObject* parent) : StelDialog(parent), simbadRep ly(NULL)
{ {
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;
greekLetters.insert("alpha", QString(QChar(0x03B1)));
greekLetters.insert("beta", QString(QChar(0x03B2)));
greekLetters.insert("gamma", QString(QChar(0x03B3)));
greekLetters.insert("delta", QString(QChar(0x03B4)));
greekLetters.insert("epsilon", QString(QChar(0x03B5)));
greekLetters.insert("zeta", QString(QChar(0x03B6)));
greekLetters.insert("eta", QString(QChar(0x03B7)));
greekLetters.insert("theta", QString(QChar(0x03B8)));
greekLetters.insert("iota", QString(QChar(0x03B9)));
greekLetters.insert("kappa", QString(QChar(0x03BA)));
greekLetters.insert("lambda", QString(QChar(0x03BB)));
greekLetters.insert("mu", QString(QChar(0x03BC)));
greekLetters.insert("nu", QString(QChar(0x03BD)));
greekLetters.insert("xi", QString(QChar(0x03BE)));
greekLetters.insert("omicron", QString(QChar(0x03BF)));
greekLetters.insert("pi", QString(QChar(0x03C0)));
greekLetters.insert("rho", QString(QChar(0x03C1)));
greekLetters.insert("sigma", QString(QChar(0x03C3))); // second lowe
r-case sigma shouldn't affect anything
greekLetters.insert("tau", QString(QChar(0x03C4)));
greekLetters.insert("upsilon", QString(QChar(0x03C5)));
greekLetters.insert("phi", QString(QChar(0x03C6)));
greekLetters.insert("chi", QString(QChar(0x03C7)));
greekLetters.insert("psi", QString(QChar(0x03C8)));
greekLetters.insert("omega", QString(QChar(0x03C9)));
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();
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;
skipping to change at line 254 skipping to change at line 229
} }
void SearchDialog::populateCoordinateAxis() void SearchDialog::populateCoordinateAxis()
{ {
bool withDecimalDegree = StelApp::getInstance().getFlagShowDecimalDe grees();; bool withDecimalDegree = StelApp::getInstance().getFlagShowDecimalDe grees();;
bool xnormal = true; bool xnormal = true;
ui->AxisXSpinBox->setDecimals(2); ui->AxisXSpinBox->setDecimals(2);
ui->AxisYSpinBox->setDecimals(2); ui->AxisYSpinBox->setDecimals(2);
// Allow rotating through longitudinal coordinates, but stop at pole
s.
ui->AxisXSpinBox->setMinimum( 0., true);
ui->AxisXSpinBox->setMaximum(360., true);
ui->AxisXSpinBox->setWrapping(true);
ui->AxisYSpinBox->setMinimum(-90., true);
ui->AxisYSpinBox->setMaximum( 90., true);
ui->AxisYSpinBox->setWrapping(false);
switch (getCurrentCoordinateSystem()) { switch (getCurrentCoordinateSystem()) {
case equatorialJ2000: case equatorialJ2000:
case equatorial: case equatorial:
{ {
ui->AxisXLabel->setText(q_("Right ascension")); ui->AxisXLabel->setText(q_("Right ascension"));
ui->AxisXSpinBox->setDisplayFormat(AngleSpinBox::HMS Letters); ui->AxisXSpinBox->setDisplayFormat(AngleSpinBox::HMS Letters);
ui->AxisXSpinBox->setPrefixType(AngleSpinBox::Normal ); ui->AxisXSpinBox->setPrefixType(AngleSpinBox::Normal );
ui->AxisYLabel->setText(q_("Declination")); ui->AxisYLabel->setText(q_("Declination"));
ui->AxisYSpinBox->setDisplayFormat(AngleSpinBox::DMS Symbols); ui->AxisYSpinBox->setDisplayFormat(AngleSpinBox::DMS Symbols);
ui->AxisYSpinBox->setPrefixType(AngleSpinBox::Normal Plus); ui->AxisYSpinBox->setPrefixType(AngleSpinBox::Normal Plus);
skipping to change at line 325 skipping to change at line 308
ui->AxisYSpinBox->setRadians(0.); ui->AxisYSpinBox->setRadians(0.);
conf->setValue("search/coordinate_system", currentCoordinateSystemID ); conf->setValue("search/coordinate_system", currentCoordinateSystemID );
} }
// Initialize the dialog widgets and connect the signals/slots // Initialize the dialog widgets and connect the signals/slots
void SearchDialog::createDialogContent() void SearchDialog::createDialogContent()
{ {
ui->setupUi(dialog); ui->setupUi(dialog);
connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SL OT(retranslate())); connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SL OT(retranslate()));
connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())) ; connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())) ;
connect(ui->TitleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMove dTo(QPoint)));
connect(ui->lineEditSearchSkyObject, SIGNAL(textChanged(const QStrin g&)), connect(ui->lineEditSearchSkyObject, SIGNAL(textChanged(const QStrin g&)),
this, SLOT(onSearchTextChanged(const QString&))); this, SLOT(onSearchTextChanged(const QString&)));
connect(ui->pushButtonGotoSearchSkyObject, SIGNAL(clicked()), this, SLOT(gotoObject())); connect(ui->pushButtonGotoSearchSkyObject, SIGNAL(clicked()), this, SLOT(gotoObject()));
onSearchTextChanged(ui->lineEditSearchSkyObject->text()); onSearchTextChanged(ui->lineEditSearchSkyObject->text());
connect(ui->lineEditSearchSkyObject, SIGNAL(returnPressed()), this, SLOT(gotoObject())); connect(ui->lineEditSearchSkyObject, SIGNAL(returnPressed()), this, SLOT(gotoObject()));
connect(ui->lineEditSearchSkyObject, SIGNAL(selectionChanged()), thi s, SLOT(setHasSelectedFlag())); connect(ui->lineEditSearchSkyObject, SIGNAL(selectionChanged()), thi s, SLOT(setHasSelectedFlag()));
connect(ui->lineEditSearchSkyObject, SIGNAL(customContextMenuRequest ed(QPoint)), this, SLOT(showContextMenu(QPoint))); connect(ui->lineEditSearchSkyObject, SIGNAL(customContextMenuRequest ed(QPoint)), this, SLOT(showContextMenu(QPoint)));
ui->lineEditSearchSkyObject->installEventFilter(this); ui->lineEditSearchSkyObject->installEventFilter(this);
skipping to change at line 442 skipping to change at line 426
ui->coordinateSystemLabel->setVisible(false); ui->coordinateSystemLabel->setVisible(false);
ui->coordinateSystemComboBox->setVisible(false); ui->coordinateSystemComboBox->setVisible(false);
} }
void SearchDialog::manualPositionChanged() void SearchDialog::manualPositionChanged()
{ {
ui->completionLabel->clearValues(); ui->completionLabel->clearValues();
StelCore* core = StelApp::getInstance().getCore(); StelCore* core = StelApp::getInstance().getCore();
StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementMgr); StelMovementMgr* mvmgr = GETSTELMODULE(StelMovementMgr);
Vec3d pos; Vec3d pos;
Vec3d aimUp;
double spinLong=ui->AxisXSpinBox->valueRadians();
double spinLat=ui->AxisYSpinBox->valueRadians();
// Since 0.15: proper handling of aimUp vector. This does not depend
on the searched coordinate system, but on the MovementManager's C.S.
// However, if those are identical, we have a problem when we want t
o look right into the pole. (e.g. zenith), which requires a special up vect
or.
// aimUp depends on MovementMgr::MountMode mvmgr->mountMode!
mvmgr->setViewUpVector(Vec3d(0., 0., 1.));
aimUp=mvmgr->getViewUpVectorJ2000();
StelMovementMgr::MountMode mountMode=mvmgr->getMountMode();
switch (getCurrentCoordinateSystem()) { switch (getCurrentCoordinateSystem()) {
case equatorialJ2000: case equatorialJ2000:
{ {
StelUtils::spheToRect(ui->AxisXSpinBox->valueRadians StelUtils::spheToRect(spinLong, spinLat, pos);
(), ui->AxisYSpinBox->valueRadians(), pos); if ( (mountMode==StelMovementMgr::MountEquinoxEquato
rial) && (fabs(spinLat)> (0.9*M_PI/2.0)) )
{
// make up vector more stable.
// 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. ));
aimUp=mvmgr->getViewUpVectorJ2000();
}
break; break;
} }
case equatorial: case equatorial:
{ {
StelUtils::spheToRect(ui->AxisXSpinBox->valueRadians (), ui->AxisYSpinBox->valueRadians(), pos); StelUtils::spheToRect(spinLong, spinLat, pos);
pos = core->equinoxEquToJ2000(pos); pos = core->equinoxEquToJ2000(pos);
if ( (mountMode==StelMovementMgr::MountEquinoxEquato
rial) && (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; break;
} }
case horizontal: case horizontal:
{ {
double cx; double cx;
cx = 3.*M_PI - ui->AxisXSpinBox->valueRadians(); // cx = 3.*M_PI - spinLong; // N is zero, E is 90 degre
N is zero, E is 90 degrees es
if (cx > M_PI*2) if (cx > 2.*M_PI)
cx -= M_PI*2; cx -= 2.*M_PI;
StelUtils::spheToRect(cx, ui->AxisYSpinBox->valueRad StelUtils::spheToRect(cx, spinLat, pos);
ians(), pos);
pos = core->altAzToJ2000(pos); pos = core->altAzToJ2000(pos);
if ( (mountMode==StelMovementMgr::MountAltAzimuthal)
&& (fabs(spinLat)> (0.9*M_PI/2.0)) )
{
// make up vector more stable.
mvmgr->setViewUpVector(Vec3d(-cos(cx), -sin(
cx), 0.) * (spinLat>0. ? 1. : -1. ));
aimUp=mvmgr->getViewUpVectorJ2000();
}
break; break;
} }
case galactic: case galactic:
{ {
StelUtils::spheToRect(ui->AxisXSpinBox->valueRadians (), ui->AxisYSpinBox->valueRadians(), 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)) )
{
// make up vector more stable.
mvmgr->setViewUpVector(Vec3d(-cos(spinLong),
-sin(spinLong), 0.) * (spinLat>0. ? 1. : -1. ));
aimUp=mvmgr->getViewUpVectorJ2000();
}
break; break;
} }
case eclipticJ2000: case eclipticJ2000:
{ {
double ra, dec; double ra, dec;
StelUtils::eclToEqu(ui->AxisXSpinBox->valueRadians() , ui->AxisYSpinBox->valueRadians(), core->getCurrentPlanet()->getRotObliqui ty(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(ui->AxisXSpinBox->valueRadians() , ui->AxisYSpinBox->valueRadians(), core->getCurrentPlanet()->getRotObliqui ty(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, 0.05); mvmgr->moveToJ2000(pos, aimUp, 0.05);
} }
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 523 skipping to change at line 545
if (useSimbad) if (useSimbad)
{ {
simbadReply = simbadSearcher->lookup(simbadServerUrl , trimmedText, 3); simbadReply = simbadSearcher->lookup(simbadServerUrl , trimmedText, 3);
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->listMatchingObjectsI18n(trimmed matches = objectMgr->listMatchingObjects(trimmedText
Text, 3, useStartOfWords); , 5, useStartOfWords, false);
matches += objectMgr->listMatchingObjects(trimmedTex matches += objectMgr->listMatchingObjects(trimmedTex
t, 3, useStartOfWords); t, 5, useStartOfWords, true);
matches += objectMgr->listMatchingObjectsI18n(greekT matches += objectMgr->listMatchingObjects(greekText,
ext, (8 - matches.size()), useStartOfWords); (15 - matches.size()), useStartOfWords, false);
matches += objectMgr->listMatchingObjects(greekText,
(15 - matches.size()), useStartOfWords, true);
} else { } else {
matches = objectMgr->listMatchingObjectsI18n(trimmed matches = objectMgr->listMatchingObjects(trimmedText
Text, 5, useStartOfWords); , 10, useStartOfWords, false);
matches += objectMgr->listMatchingObjects(trimmedTex matches += objectMgr->listMatchingObjects(trimmedTex
t, 5, useStartOfWords); t, 10, 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 620 skipping to change at line 643
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(); close();
Vec3d pos = simbadResults[nameI18n]; Vec3d pos = simbadResults[nameI18n];
Vec3d aimUp;
objectMgr->unSelect(); objectMgr->unSelect();
mvmgr->moveToJ2000(pos, mvmgr->getAutoMoveDuration()); mvmgr->setViewUpVector(Vec3d(0., 0., 1.));
aimUp=mvmgr->getViewUpVectorJ2000();
mvmgr->moveToJ2000(pos, aimUp, mvmgr->getAutoMoveDuration())
;
ui->lineEditSearchSkyObject->clear(); ui->lineEditSearchSkyObject->clear();
ui->completionLabel->clearValues(); ui->completionLabel->clearValues();
} }
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();
skipping to change at line 684 skipping to change at line 710
event->accept(); event->accept();
return true; return true;
} }
if (keyEvent->key() == Qt::Key_Up) if (keyEvent->key() == Qt::Key_Up)
{ {
ui->completionLabel->selectPrevious(); ui->completionLabel->selectPrevious();
event->accept(); event->accept();
return true; return true;
} }
} }
if (event->type() == QEvent::Show)
{
if (!extSearchText.isEmpty())
{
ui->lineEditSearchSkyObject->setText(extSearchText);
ui->lineEditSearchSkyObject->selectAll();
extSearchText.clear();
}
}
return false; return false;
} }
QString SearchDialog::substituteGreek(const QString& keyString) QString SearchDialog::substituteGreek(const QString& keyString)
{ {
if (!keyString.contains(' ')) if (!keyString.contains(' '))
return getGreekLetterByName(keyString); return getGreekLetterByName(keyString);
else else
{ {
QStringList nameComponents = keyString.split(" ", QString::S kipEmptyParts); QStringList nameComponents = keyString.split(" ", QString::S kipEmptyParts);
if(!nameComponents.empty()) if(!nameComponents.empty())
nameComponents[0] = getGreekLetterByName(nameCompone nts[0]); nameComponents[0] = getGreekLetterByName(nameCompone nts[0]);
return nameComponents.join(" "); return nameComponents.join(" ");
} }
} }
QString SearchDialog::getGreekLetterByName(const QString& potentialGreekLet terName) QString SearchDialog::getGreekLetterByName(const QString& potentialGreekLet terName)
{ {
if(greekLetters.contains(potentialGreekLetterName)) if(staticData.greekLetters.contains(potentialGreekLetterName))
return greekLetters[potentialGreekLetterName.toLower()]; return staticData.greekLetters[potentialGreekLetterName.toLo
wer()];
// There can be indices (e.g. "α1 Cen" instead of "α Cen A"), so str ip // There can be indices (e.g. "α1 Cen" instead of "α Cen A"), so str ip
// any trailing digit. // any trailing digit.
int lastCharacterIndex = potentialGreekLetterName.length()-1; int lastCharacterIndex = potentialGreekLetterName.length()-1;
if(potentialGreekLetterName.at(lastCharacterIndex).isDigit()) if(potentialGreekLetterName.at(lastCharacterIndex).isDigit())
{ {
QChar digit = potentialGreekLetterName.at(lastCharacterIndex ); QChar digit = potentialGreekLetterName.at(lastCharacterIndex );
QString name = potentialGreekLetterName.left(lastCharacterIn dex); QString name = potentialGreekLetterName.left(lastCharacterIn dex);
if(greekLetters.contains(name)) if(staticData.greekLetters.contains(name))
return greekLetters[name.toLower()] + digit; return staticData.greekLetters[name.toLower()] + dig
it;
} }
return potentialGreekLetterName; return potentialGreekLetterName;
} }
void SearchDialog::populateSimbadServerList() void SearchDialog::populateSimbadServerList()
{ {
Q_ASSERT(ui->serverListComboBox); Q_ASSERT(ui->serverListComboBox);
QComboBox* servers = ui->serverListComboBox; QComboBox* servers = ui->serverListComboBox;
skipping to change at line 758 skipping to change at line 793
conf->setValue("search/simbad_server_url", simbadServerUrl); conf->setValue("search/simbad_server_url", simbadServerUrl);
} }
void SearchDialog::updateListWidget(int index) void SearchDialog::updateListWidget(int index)
{ {
QString moduleId = ui->objectTypeComboBox->itemData(index).toString( ); QString moduleId = ui->objectTypeComboBox->itemData(index).toString( );
ui->objectsListWidget->clear(); ui->objectsListWidget->clear();
bool englishNames = ui->searchInEnglishCheckBox->isChecked(); bool englishNames = ui->searchInEnglishCheckBox->isChecked();
ui->objectsListWidget->addItems(objectMgr->listAllModuleObjects(modu leId, englishNames)); ui->objectsListWidget->addItems(objectMgr->listAllModuleObjects(modu leId, englishNames));
ui->objectsListWidget->sortItems(Qt::AscendingOrder); ui->objectsListWidget->sortItems(Qt::AscendingOrder);
connect(ui->objectsListWidget, SIGNAL(itemClicked(QListWidgetItem*)) connect(ui->objectsListWidget, SIGNAL(itemClicked(QListWidgetItem*))
, this, SLOT(gotoObject(QListWidgetItem*))); ,
this, SLOT(gotoObject(QListWidgetItem*)),
Qt::UniqueConnection); //bugfix: prevent multiple connection
s, which seems to have happened before
} }
void SearchDialog::updateListTab() void SearchDialog::updateListTab()
{ {
if (StelApp::getInstance().getLocaleMgr().getAppLanguage().startsWit h("en")) if (StelApp::getInstance().getLocaleMgr().getAppLanguage().startsWit h("en"))
{ {
// hide "names in English" checkbox // hide "names in English" checkbox
ui->searchInEnglishCheckBox->hide(); ui->searchInEnglishCheckBox->hide();
} }
else else
skipping to change at line 792 skipping to change at line 829
} }
ui->objectTypeComboBox->model()->sort(0, Qt::AscendingOrder); ui->objectTypeComboBox->model()->sort(0, Qt::AscendingOrder);
ui->objectTypeComboBox->blockSignals(false); ui->objectTypeComboBox->blockSignals(false);
updateListWidget(ui->objectTypeComboBox->currentIndex()); updateListWidget(ui->objectTypeComboBox->currentIndex());
} }
void SearchDialog::showContextMenu(const QPoint &pt) void SearchDialog::showContextMenu(const QPoint &pt)
{ {
QMenu *menu = ui->lineEditSearchSkyObject->createStandardContextMenu (); QMenu *menu = ui->lineEditSearchSkyObject->createStandardContextMenu ();
menu->addSeparator(); menu->addSeparator();
menu->addAction(q_("Paste and Search"), this, SLOT(pasteAndGo())); QString clipText;
QClipboard *clipboard = QApplication::clipboard();
if (clipboard)
clipText = clipboard->text();
if (!clipText.isEmpty())
{
if (clipText.length()>12)
clipText = clipText.right(9) + "...";
clipText = "\t(" + clipText + ")";
}
menu->addAction(q_("Paste and Search") + clipText, this, SLOT(pasteA
ndGo()));
menu->exec(ui->lineEditSearchSkyObject->mapToGlobal(pt)); menu->exec(ui->lineEditSearchSkyObject->mapToGlobal(pt));
delete menu; delete menu;
} }
void SearchDialog::pasteAndGo() void SearchDialog::pasteAndGo()
{ {
ui->lineEditSearchSkyObject->clear(); // clear current text ui->lineEditSearchSkyObject->clear(); // clear current text
ui->lineEditSearchSkyObject->paste(); // paste text from clipboard ui->lineEditSearchSkyObject->paste(); // paste text from clipboard
gotoObject(); // go to first finded object gotoObject(); // go to first finded object
} }
 End of changes. 26 change blocks. 
61 lines changed or deleted 125 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/