Skip to content

Save packed project feature#1345

Merged
dictoon merged 13 commits intoappleseedhq:masterfrom
glebmish:save-packed-project
Mar 23, 2017
Merged

Save packed project feature#1345
dictoon merged 13 commits intoappleseedhq:masterfrom
glebmish:save-packed-project

Conversation

@glebmish
Copy link
Copy Markdown
Contributor

@glebmish glebmish commented Mar 22, 2017

Added minizip library sources needed to create zip files and wrapped it with zipper.cpp which is renamed from unzipper.cpp and became wrapper over all minizip library.
Implemented ability to save packed projects to projectfilewriter.cpp. Refactored it to consider file extension to choose between saving plain and packed project
Added ability to save appleseedz in UI

Copy link
Copy Markdown
Member

@dictoon dictoon left a comment

Choose a reason for hiding this comment

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

Top quality work as usual!

There is just a number of mostly cometics details to address before we can merge this.

Thanks!


} // namespace foundation


Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove one redundant blank line.


namespace foundation
{

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove blank line.

class ZipException
: public foundation::Exception
{
public:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Indent with two spaces.

this,
"Save As...",
"Project Files (*.appleseed)",
"Project Files (*.appleseed);;Packed project files (*.appleseedz)",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Use title capitalization: Packed Project Files

Also rename Project Files to Plain Project Files.

}
}

QString get_extension(ParamArray& settings, const QString& target_dialog) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Braces always go on their own line.


bf::create_directory(temp_project_filepath.parent_path());

bool success = write_project_file(project,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Make success const.

Fix indentation, I suggest this:

const bool success =
    write_project_file(
        project,
        temp_project_filepath.c_str(),
        options | ProjectFileWriter::CopyAllAssets);

options | ProjectFileWriter::CopyAllAssets);
if (!success)
{
RENDERER_LOG_ERROR("Failed to save project %s.", filepath);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Use lower case for log messages (fix everywhere).


class APPLESEED_DLLSYMBOL ProjectFileWriter
{
private:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Private declarations go after public ones.

class APPLESEED_DLLSYMBOL ProjectFileWriter
{
private:
// Write a project file to disk. Return true on success, false otherwise
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

End full line comments with a period (fix everywhere).

private:
// Write a project file to disk. Return true on success, false otherwise
static bool write_project_file(
const Project& project,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fix indentation.

@dictoon
Copy link
Copy Markdown
Member

dictoon commented Mar 22, 2017

Ah, you'll also need to fix the build, Travis complains with gcc 6. The error message is interesting :)


if (uPosFound!=0)
break;
if (uPosFound != 0)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I believe you introduced a bug here. I think the initial logic was correct, there was just an indentation problem that was tripping the compiler (one reason why we're so strict on indentation!)

const std::string& extension);

//
// Retrieves
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Re-unite the two pieces of the sentence into one?

const Project& project,
const char* filepath,
const int options)
const Project& project,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please follow the indentation style of the other functions: arguments are indented normally (4 spaces).

private:
// Write a project file to disk. Return true on success, false otherwise.
static bool write_project_file(
const Project& project,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Follow the indentation style of the other functions.

Copy link
Copy Markdown
Contributor Author

@glebmish glebmish Mar 23, 2017

Choose a reason for hiding this comment

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

Sorry for this indentation issues, I'm setting up indentation settings in IDE so it corresponds to your codestyle.
What should be indented with 4 spaces and what with 2?
As I see now:

  1. In constructor before ':' it should be 2 spaces
  2. In multi-line function invocation it should be 4
  3. In multi-line function declaration it should be 4 as well

Copy link
Copy Markdown
Member

@dictoon dictoon Mar 23, 2017

Choose a reason for hiding this comment

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

So, the general rule for indentation is 4 spaces, no tabs (ever).

The only things that are indented with 2 spaces are:

  • initializer and inheritance lists
  • public, protected, private, case and default keywords

Everything else is indented with 4 spaces.

Example:

class Derived
  : public Base
{
  public:
    Derived()
      : Base(11)
    {
    }
    
    void foo(
        const int y,
        const int z);
  
  private:
    int bar(const int x)
    {
        switch (x)
        {
          case 1: return 2;
          case 2: return 4;
          default: return 0;
        }
    }
};

@glebmish
Copy link
Copy Markdown
Contributor Author

Thanks for detailed comments!
Hope it's okay now

@dictoon
Copy link
Copy Markdown
Member

dictoon commented Mar 23, 2017

It is, thanks! Will merge once Travis passed.

@glebmish
Copy link
Copy Markdown
Contributor Author

Great!
Later I'll make tests and save scenario we've discussed in slack and submit it with other PRs

@dictoon dictoon merged commit a7210ca into appleseedhq:master Mar 23, 2017
@glebmish glebmish deleted the save-packed-project branch May 31, 2017 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants