Pulsars.cpp   Pulsars.cpp 
skipping to change at line 172 skipping to change at line 172
GlowIcon = new QPixmap(":/graphicsGui/glow32x32.png"); GlowIcon = new QPixmap(":/graphicsGui/glow32x32.png");
OnIcon = new QPixmap(":/Pulsars/btPulsars-on.png"); OnIcon = new QPixmap(":/Pulsars/btPulsars-on.png");
OffIcon = new QPixmap(":/Pulsars/btPulsars-off.png"); OffIcon = new QPixmap(":/Pulsars/btPulsars-off.png");
setFlagShowPulsars(getEnableAtStartup()); setFlagShowPulsars(getEnableAtStartup());
setFlagShowPulsarsButton(flagShowPulsarsButton); setFlagShowPulsarsButton(flagShowPulsarsButton);
connect(gui->getGuiAction("actionShow_Pulsars_ConfigDialog") , SIGNAL(toggled(bool)), configDialog, SLOT(setVisible(bool))); connect(gui->getGuiAction("actionShow_Pulsars_ConfigDialog") , SIGNAL(toggled(bool)), configDialog, SLOT(setVisible(bool)));
connect(configDialog, SIGNAL(visibleChanged(bool)), gui->get GuiAction("actionShow_Pulsars_ConfigDialog"), SLOT(setChecked(bool))); connect(configDialog, SIGNAL(visibleChanged(bool)), gui->get GuiAction("actionShow_Pulsars_ConfigDialog"), SLOT(setChecked(bool)));
if (flagShowPulsarsButton) connect(gui->getGuiAction("actionShow_Pulsars"), SIGNAL(togg
{ led(bool)), this, SLOT(setFlagShowPulsars(bool)));
connect(gui->getGuiAction("actionShow_Pulsars"), SIG
NAL(toggled(bool)), this, SLOT(setFlagShowPulsars(bool)));
}
} }
catch (std::runtime_error &e) catch (std::runtime_error &e)
{ {
qWarning() << "Pulsars::init error: " << e.what(); qWarning() << "Pulsars::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 334 skipping to change at line 331
foreach(const PulsarP& pulsar, psr) foreach(const PulsarP& pulsar, psr)
{ {
if (pulsar->getNameI18n().toUpper() == nameI18n.toUpper()) if (pulsar->getNameI18n().toUpper() == nameI18n.toUpper())
return qSharedPointerCast<StelObject>(pulsar); return qSharedPointerCast<StelObject>(pulsar);
} }
return NULL; return NULL;
} }
QStringList Pulsars::listMatchingObjectsI18n(const QString& objPrefix, int maxNbItem) const QStringList Pulsars::listMatchingObjectsI18n(const QString& objPrefix, int maxNbItem, bool useStartOfWords) const
{ {
QStringList result; QStringList result;
if (!flagShowPulsars) if (!flagShowPulsars)
return result; return result;
if (maxNbItem==0) if (maxNbItem==0)
return result; return result;
QString psrn; QString psrn;
bool find;
foreach(const PulsarP& pulsar, psr) foreach(const PulsarP& pulsar, psr)
{ {
psrn = pulsar->getNameI18n(); psrn = pulsar->getNameI18n();
if (psrn.contains(objPrefix, Qt::CaseInsensitive)) find = false;
if (useStartOfWords)
{
if (psrn.toUpper().left(objPrefix.length()) == objPr
efix.toUpper())
find = true;
}
else
{
if (psrn.contains(objPrefix, Qt::CaseInsensitive))
find = true;
}
if (find)
{ {
result << psrn; result << psrn;
} }
} }
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 Pulsars::listMatchingObjects(const QString& objPrefix, int maxN bItem) const QStringList Pulsars::listMatchingObjects(const QString& objPrefix, int maxN bItem, bool useStartOfWords) const
{ {
QStringList result; QStringList result;
if (!flagShowPulsars) if (!flagShowPulsars)
return result; return result;
if (maxNbItem==0) if (maxNbItem==0)
return result; return result;
QString psrn; QString psrn;
bool find;
foreach(const PulsarP& pulsar, psr) foreach(const PulsarP& pulsar, psr)
{ {
psrn = pulsar->getEnglishName(); psrn = pulsar->getEnglishName();
if (psrn.contains(objPrefix, Qt::CaseInsensitive)) find = false;
if (useStartOfWords)
{
if (psrn.toUpper().left(objPrefix.length()) == objPr
efix.toUpper())
find = true;
}
else
{
if (psrn.contains(objPrefix, Qt::CaseInsensitive))
find = true;
}
if (find)
{ {
result << psrn; result << psrn;
} }
} }
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/