Quasars.cpp   Quasars.cpp 
skipping to change at line 167 skipping to change at line 167
GlowIcon = new QPixmap(":/graphicsGui/glow32x32.png"); GlowIcon = new QPixmap(":/graphicsGui/glow32x32.png");
OnIcon = new QPixmap(":/Quasars/btQuasars-on.png"); OnIcon = new QPixmap(":/Quasars/btQuasars-on.png");
OffIcon = new QPixmap(":/Quasars/btQuasars-off.png"); OffIcon = new QPixmap(":/Quasars/btQuasars-off.png");
setFlagShowQuasars(getEnableAtStartup()); setFlagShowQuasars(getEnableAtStartup());
setFlagShowQuasarsButton(flagShowQuasarsButton); setFlagShowQuasarsButton(flagShowQuasarsButton);
connect(gui->getGuiAction("actionShow_Quasars_ConfigDialog") , SIGNAL(toggled(bool)), configDialog, SLOT(setVisible(bool))); connect(gui->getGuiAction("actionShow_Quasars_ConfigDialog") , SIGNAL(toggled(bool)), configDialog, SLOT(setVisible(bool)));
connect(configDialog, SIGNAL(visibleChanged(bool)), gui->get GuiAction("actionShow_Quasars_ConfigDialog"), SLOT(setChecked(bool))); connect(configDialog, SIGNAL(visibleChanged(bool)), gui->get GuiAction("actionShow_Quasars_ConfigDialog"), SLOT(setChecked(bool)));
if (flagShowQuasarsButton) connect(gui->getGuiAction("actionShow_Quasars"), SIGNAL(togg
{ led(bool)), this, SLOT(setFlagShowQuasars(bool)));
connect(gui->getGuiAction("actionShow_Quasars"), SIG
NAL(toggled(bool)), this, SLOT(setFlagShowQuasars(bool)));
}
} }
catch (std::runtime_error &e) catch (std::runtime_error &e)
{ {
qWarning() << "Quasars::init error: " << e.what(); qWarning() << "Quasars::init error: " << e.what();
return; return;
} }
// A timer for hiding alert messages // A timer for hiding alert messages
messageTimer = new QTimer(this); messageTimer = new QTimer(this);
messageTimer->setSingleShot(true); // recurring check for update messageTimer->setSingleShot(true); // recurring check for update
skipping to change at line 330 skipping to change at line 327
foreach(const QuasarP& quasar, QSO) foreach(const QuasarP& quasar, QSO)
{ {
if (quasar->getNameI18n().toUpper() == nameI18n.toUpper()) if (quasar->getNameI18n().toUpper() == nameI18n.toUpper())
return qSharedPointerCast<StelObject>(quasar); return qSharedPointerCast<StelObject>(quasar);
} }
return NULL; return NULL;
} }
QStringList Quasars::listMatchingObjectsI18n(const QString& objPrefix, int maxNbItem) const QStringList Quasars::listMatchingObjectsI18n(const QString& objPrefix, int maxNbItem, bool useStartOfWords) const
{ {
QStringList result; QStringList result;
if (!flagShowQuasars) if (!flagShowQuasars)
return result; return result;
if (maxNbItem==0) if (maxNbItem==0)
return result; return result;
QString qson; QString qson;
bool find;
foreach(const QuasarP& quasar, QSO) foreach(const QuasarP& quasar, QSO)
{ {
qson = quasar->getNameI18n(); qson = quasar->getNameI18n();
if (qson.contains(objPrefix, Qt::CaseInsensitive)) find = false;
if (useStartOfWords)
{
if (qson.toUpper().left(objPrefix.length()) == objPr
efix.toUpper())
find = true;
}
else
{
if (qson.contains(objPrefix, Qt::CaseInsensitive))
find = true;
}
if (find)
{ {
result << qson; result << qson;
} }
} }
result.sort(); result.sort();
if (result.size()>maxNbItem) if (result.size()>maxNbItem)
result.erase(result.begin()+maxNbItem, result.end()); result.erase(result.begin()+maxNbItem, result.end());
return result; return result;
} }
QStringList Quasars::listMatchingObjects(const QString& objPrefix, int maxN bItem) const QStringList Quasars::listMatchingObjects(const QString& objPrefix, int maxN bItem, bool useStartOfWords) const
{ {
QStringList result; QStringList result;
if (!flagShowQuasars) if (!flagShowQuasars)
return result; return result;
if (maxNbItem==0) if (maxNbItem==0)
return result; return result;
QString qson; QString qson;
bool find;
foreach(const QuasarP& quasar, QSO) foreach(const QuasarP& quasar, QSO)
{ {
qson = quasar->getEnglishName(); qson = quasar->getEnglishName();
if (qson.contains(objPrefix, Qt::CaseInsensitive)) find = false;
if (useStartOfWords)
{
if (qson.toUpper().left(objPrefix.length()) == objPr
efix.toUpper())
find = true;
}
else
{
if (qson.contains(objPrefix, Qt::CaseInsensitive))
find = true;
}
if (find)
{ {
result << qson; result << qson;
} }
} }
result.sort(); result.sort();
if (result.size()>maxNbItem) if (result.size()>maxNbItem)
result.erase(result.begin()+maxNbItem, result.end()); result.erase(result.begin()+maxNbItem, result.end());
return result; return result;
} }
 End of changes. 9 change blocks. 
11 lines changed or deleted 34 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/