Added new filter for QT browser
Added "barycenters" filter for QT Star Browser.pull/3/head
parent
90f4b6bfbd
commit
d85fde1eac
|
@ -4514,6 +4514,9 @@ msgstr ""
|
|||
msgid "Multiple Stars"
|
||||
msgstr ""
|
||||
|
||||
msgid "Barycenters"
|
||||
msgstr ""
|
||||
|
||||
msgid "Spectral Type"
|
||||
msgstr ""
|
||||
|
||||
|
|
3
po/ru.po
3
po/ru.po
|
@ -4543,6 +4543,9 @@ msgstr "Самые яркие звёзды"
|
|||
msgid "Multiple Stars"
|
||||
msgstr "Кратные звёзды"
|
||||
|
||||
msgid "Barycenters"
|
||||
msgstr "Барицентры"
|
||||
|
||||
msgid "Spectral Type"
|
||||
msgstr "Тип спектра"
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ public:
|
|||
|
||||
bool planetsFilterEnabled;
|
||||
bool multipleFilterEnabled;
|
||||
bool barycentersFilterEnabled;
|
||||
bool omitBarycenters;
|
||||
bool spectralTypeFilterEnabled;
|
||||
QRegExp spectralTypeFilter;
|
||||
|
@ -295,6 +296,7 @@ bool StarPredicate::operator()(const Star* star0, const Star* star1) const
|
|||
StarFilterPredicate::StarFilterPredicate() :
|
||||
planetsFilterEnabled(false),
|
||||
multipleFilterEnabled(false),
|
||||
barycentersFilterEnabled(false),
|
||||
omitBarycenters(true),
|
||||
spectralTypeFilterEnabled(false),
|
||||
solarSystems(NULL)
|
||||
|
@ -326,6 +328,12 @@ bool StarFilterPredicate::operator()(const Star* star) const
|
|||
return true;
|
||||
}
|
||||
|
||||
if (barycentersFilterEnabled)
|
||||
{
|
||||
if (star->getVisibility())
|
||||
return true;
|
||||
}
|
||||
|
||||
if (spectralTypeFilterEnabled)
|
||||
{
|
||||
if (!spectralTypeFilter.exactMatch(star->getSpectralType()))
|
||||
|
@ -520,8 +528,13 @@ CelestialBrowser::CelestialBrowser(CelestiaCore* _appCore, QWidget* parent) :
|
|||
filterGroupLayout->addWidget(withPlanetsFilterBox, 0, 0);
|
||||
|
||||
multipleFilterBox = new QCheckBox(_("Multiple Stars"));
|
||||
connect(multipleFilterBox, SIGNAL(clicked()), this, SLOT(slotRefreshTable()));
|
||||
connect(multipleFilterBox, SIGNAL(clicked()), this, SLOT(slotUncheckBarycentersFilterBox()));
|
||||
|
||||
barycentersFilterBox = new QCheckBox(_("Barycenters"));
|
||||
connect(barycentersFilterBox, SIGNAL(clicked()), this, SLOT(slotUncheckMultipleFilterBox()));
|
||||
|
||||
filterGroupLayout->addWidget(multipleFilterBox, 1, 0);
|
||||
filterGroupLayout->addWidget(barycentersFilterBox, 1, 1);
|
||||
|
||||
filterGroupLayout->addWidget(new QLabel(_("Spectral Type")), 0, 1);
|
||||
spectralTypeFilterBox = new QLineEdit();
|
||||
|
@ -603,6 +616,17 @@ CelestialBrowser::~CelestialBrowser()
|
|||
|
||||
|
||||
/******* Slots ********/
|
||||
void CelestialBrowser::slotUncheckMultipleFilterBox()
|
||||
{
|
||||
multipleFilterBox->setChecked(false);
|
||||
slotRefreshTable();
|
||||
}
|
||||
|
||||
void CelestialBrowser::slotUncheckBarycentersFilterBox()
|
||||
{
|
||||
barycentersFilterBox->setChecked(false);
|
||||
slotRefreshTable();
|
||||
}
|
||||
|
||||
void CelestialBrowser::slotRefreshTable()
|
||||
{
|
||||
|
@ -619,7 +643,8 @@ void CelestialBrowser::slotRefreshTable()
|
|||
StarFilterPredicate filterPred;
|
||||
filterPred.planetsFilterEnabled = withPlanetsFilterBox->checkState() == Qt::Checked;
|
||||
filterPred.multipleFilterEnabled = multipleFilterBox->checkState() == Qt::Checked;
|
||||
filterPred.omitBarycenters = true;
|
||||
filterPred.barycentersFilterEnabled = barycentersFilterBox->checkState() == Qt::Checked;
|
||||
filterPred.omitBarycenters = barycentersFilterBox->checkState() == Qt::Unchecked;
|
||||
filterPred.solarSystems = appCore->getSimulation()->getUniverse()->getSolarSystemCatalog();
|
||||
|
||||
QRegExp re(spectralTypeFilterBox->text(),
|
||||
|
|
|
@ -37,6 +37,8 @@ Q_OBJECT
|
|||
~CelestialBrowser();
|
||||
|
||||
public slots:
|
||||
void slotUncheckMultipleFilterBox();
|
||||
void slotUncheckBarycentersFilterBox();
|
||||
void slotRefreshTable();
|
||||
void slotContextMenu(const QPoint& pos);
|
||||
void slotMarkSelected();
|
||||
|
@ -58,6 +60,7 @@ Q_OBJECT
|
|||
|
||||
QCheckBox* withPlanetsFilterBox;
|
||||
QCheckBox* multipleFilterBox;
|
||||
QCheckBox* barycentersFilterBox;
|
||||
QLineEdit* spectralTypeFilterBox;
|
||||
|
||||
QComboBox* markerSymbolBox;
|
||||
|
|
Loading…
Reference in New Issue