Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Alphabetical sorting #145

Closed
wants to merge 1 commit into from
Closed

Adding Alphabetical sorting #145

wants to merge 1 commit into from

Conversation

lflo5727
Copy link

Added sorting as per QT Celestial Browser sorting issue #7.

Copy link
Member

@375gnu 375gnu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @lflo5727 !

It looks like you made your patch using a very old Celestia snapshot as it reverts some recent changes. Please rebase it to the current master.

Also you have style issues:

  • We use 4 spaces to indent, tabs are disallowed.
  • We don't use else after if(...) retun ...

I've checked your commit and found that you have committed a lot of unneeded temporary files generated by qmake.

@@ -62,20 +62,20 @@ class SolarSystemTreeModel : public QAbstractTableModel, public ModelHelper
};

void buildModel(Star* star, bool _groupByClass);


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unneeded extra new lines

class SSTMPredicate
{
public:
enum Criterion
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tabs are not allowed, use 4 spaces.


class SSTMPredicate
{
public:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add 1 white space before public:/private:

SolarSystemTreeModel::TreeItem::~TreeItem()
{
if (children != nullptr)
for (auto it = children.begin(); it != children.end(); ++it)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use C++11 style iterators

{
criterion = _criterion;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use C++03 style members initializers here

SSTMPredicate::SSTMPredicate(Criterion _criterion, const Universe *_universe) :
    criterion(_criterion),
    universe(_universe)
{}

else
{
return "";
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for braces here. Remove else so the the code becomes:

if ()
    return

if ()
    return

return

switch(criterion)
{
case ObjectType:
return strcmp(objectTypeName(ti0->obj).toStdString().c_str(), objectTypeName(ti1->obj).toStdString().c_str()) < 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

objectTypeName(ti0->obj) < objectTypeName(ti1->obj)

return strcmp(objectTypeName(ti0->obj).toStdString().c_str(), objectTypeName(ti1->obj).toStdString().c_str()) < 0;

case Alphabetical:
return strcmp(this->getName(ti0->obj).c_str(), this->getName(ti1->obj).c_str()) < 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getName(ti0->obj) < getName(ti1->obj)

SSTMFilterPredicate();
bool operator()(const SolarSystemTreeModel::TreeItem* ti) const;

unsigned int objectTypeMask;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Unused variable objectTypeMask please remove it
  2. As I see below it's RenderFlag, so uint64_t or better Renderer::RenderFlags should be used if you plan to implement it's usage. But Solar System Browser shouldn't use renderer flags to display objects.

@375gnu 375gnu added this to In progress in Release 1.7.0 Dec 1, 2018
@375gnu
Copy link
Member

375gnu commented Dec 3, 2018

@lflo5727 beside mentioned above, your code doesn't work properly. It changes positions of 1st level bodies, but ignores their children.

@375gnu 375gnu removed this from In progress in Release 1.7.0 Apr 9, 2019
@375gnu
Copy link
Member

375gnu commented May 2, 2019

No response for a half of a year so I'm closing this PR.

@375gnu 375gnu closed this May 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants