Save packed project feature#1345
Conversation
Source files needed for creating zip files
Wrapper allows to zip all files provided in filenames_to_zip to zip_filename archive. Used for saving packed projects.
dictoon
left a comment
There was a problem hiding this comment.
Top quality work as usual!
There is just a number of mostly cometics details to address before we can merge this.
Thanks!
|
|
||
| } // namespace foundation | ||
|
|
||
|
|
There was a problem hiding this comment.
Remove one redundant blank line.
|
|
||
| namespace foundation | ||
| { | ||
|
|
| class ZipException | ||
| : public foundation::Exception | ||
| { | ||
| public: |
| this, | ||
| "Save As...", | ||
| "Project Files (*.appleseed)", | ||
| "Project Files (*.appleseed);;Packed project files (*.appleseedz)", |
There was a problem hiding this comment.
Use title capitalization: Packed Project Files
Also rename Project Files to Plain Project Files.
| } | ||
| } | ||
|
|
||
| QString get_extension(ParamArray& settings, const QString& target_dialog) { |
There was a problem hiding this comment.
Braces always go on their own line.
|
|
||
| bf::create_directory(temp_project_filepath.parent_path()); | ||
|
|
||
| bool success = write_project_file(project, |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Use lower case for log messages (fix everywhere).
|
|
||
| class APPLESEED_DLLSYMBOL ProjectFileWriter | ||
| { | ||
| private: |
There was a problem hiding this comment.
Private declarations go after public ones.
| class APPLESEED_DLLSYMBOL ProjectFileWriter | ||
| { | ||
| private: | ||
| // Write a project file to disk. Return true on success, false otherwise |
There was a problem hiding this comment.
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, |
|
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) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Re-unite the two pieces of the sentence into one?
| const Project& project, | ||
| const char* filepath, | ||
| const int options) | ||
| const Project& project, |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
Follow the indentation style of the other functions.
There was a problem hiding this comment.
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:
- In constructor before ':' it should be 2 spaces
- In multi-line function invocation it should be 4
- In multi-line function declaration it should be 4 as well
There was a problem hiding this comment.
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,caseanddefaultkeywords
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;
}
}
};
|
Thanks for detailed comments! |
|
It is, thanks! Will merge once Travis passed. |
|
Great! |
Added
miniziplibrary sources needed to create zip files and wrapped it withzipper.cppwhich is renamed fromunzipper.cppand 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 projectAdded ability to save appleseedz in UI