Skip to content

Commit

Permalink
Theme and dependency updates 🌺
Browse files Browse the repository at this point in the history
Contains minorly breaking changes.
- Updated Readme
- Updated config value names for a more readable .ini file
- Set editor shadow, line number area and indicator fallbacks to true
- Updated bit7z to v4-RC
- Updated Dark and Solarized themes' scroll bar colors
  • Loading branch information
fairybow committed Jan 23, 2023
1 parent 249b4ee commit 835619d
Show file tree
Hide file tree
Showing 49 changed files with 1,010 additions and 620 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
</kbd>
</p>
<p align="center">
<a href="https://github.com/fairybow/fernanda/releases/"><img src="https://img.shields.io/github/v/release/fairybow/fernanda?include_prereleases&color=f34b7d" alt="release"/></a>
<a href="LICENSE"><img src="https://img.shields.io/github/license/fairybow/fernanda?color=orange" alt="license: GPL-3.0"/></a>
<a href="https://github.com/fairybow/fernanda/releases/"><img src="https://img.shields.io/github/v/release/fairybow/fernanda?include_prereleases&color=f34b7d" alt="Latest Release"/></a>
<a href="LICENSE"><img src="https://img.shields.io/github/license/fairybow/fernanda?color=orange" alt="License: GPL-3.0"/></a>
<br>
<a href="https://www.qt.io/"><img src="https://img.shields.io/badge/Qt-v6.4.1-brightgreen?logo=qt" alt="Qt v6.4.1"/></a>
<a href="https://github.com/rikyoz/bit7z"><img src="https://img.shields.io/badge/Bit7z-v4.0.0--beta-blue" alt="Bit7z v4.0.0-beta"/></a>
<a href="https://github.com/rikyoz/bit7z"><img src="https://img.shields.io/badge/Bit7z-v4.0.0--RC-blue" alt="Bit7z v4.0.0-RC"/></a>
<a href="https://www.7-zip.org/"><img src="https://img.shields.io/badge/7zip-v22.01-ffbf00" alt="7zip v22.01"/></a>
<br>
<a href="#install"><img src="https://img.shields.io/badge/Windows%20(x64)-5B5B5B?logo=windows" alt="Platform Windows (x64)"/></a>
Expand Down
2 changes: 1 addition & 1 deletion fernanda/docs/bit7z/BUILD.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v4.0.0-beta msvc2019_x64
v4.0.0-rc msvc2019_x64
302 changes: 191 additions & 111 deletions fernanda/docs/bit7z/README.md

Large diffs are not rendered by default.

Binary file removed fernanda/docs/zips/bit7z-v4.0.0-beta-msvc2019_x64.7z
Binary file not shown.
Binary file not shown.
36 changes: 18 additions & 18 deletions fernanda/fernanda.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,24 @@
<ClInclude Include="src\keyfilter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\archiver.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\dom.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\story.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\icon.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\layout.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\style.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\bit7z\include\bit7z.hpp">
<Filter>Header Files\Includes\bit7z</Filter>
</ClInclude>
Expand Down Expand Up @@ -314,24 +332,6 @@
<ClInclude Include="include\bit7z\include\bitwindows.hpp">
<Filter>Header Files\Includes\bit7z</Filter>
</ClInclude>
<ClInclude Include="src\archiver.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\dom.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\story.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\icon.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\layout.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\style.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<QtMoc Include="src\fernanda.h">
Expand Down
37 changes: 28 additions & 9 deletions fernanda/include/bit7z/include/bit7zlibrary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,39 @@ struct IOutArchive;
struct GUID;
#endif

//! \cond IGNORE_BLOCK_IN_DOXYGEN
//! @cond IGNORE_BLOCK_IN_DOXYGEN
template< typename T >
class CMyComPtr;
//! \endcond
//! @endcond

/**
* @brief The main namespace of the bit7z library.
*/
namespace bit7z {
#ifdef _WIN32
constexpr auto default_library = BIT7Z_STRING("7z.dll");

/**
* @brief The default file path for the 7-zip shared library to be used by bit7z
* in case the user doesn't pass a path to the constructor of the Bit7zLibrary class.
*
* @note On Windows, the default library is "7z.dll", and it is searched following the Win32 API rules
* (https://learn.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order).
*
* @note On Linux, the default library is the absolute path to the "7z.so" installed by p7zip.
*
* @note In all other cases, the value will be the relative path to a "7z.so" in the working directory of the program.
*/
#ifdef __DOXYGEN__
constexpr auto default_library = "<platform-dependent value>";
#elif defined( _WIN32 )
constexpr auto default_library = BIT7Z_STRING( "7z.dll" );
#elif defined( __linux__ )
constexpr auto default_library = "/usr/lib/p7zip/7z.so"; //default installation path of p7zip shared library
constexpr auto default_library = "/usr/lib/p7zip/7z.so"; // Default installation path of the p7zip shared library.
#else
constexpr auto default_library = "./7z.so";
#endif

/**
* @brief The Bit7zLibrary class allows the access to the basic functionalities provided by the 7z DLLs.
* @brief The Bit7zLibrary class allows accessing the basic functionalities provided by the 7z DLLs.
*/
class Bit7zLibrary final {
public:
Expand Down Expand Up @@ -66,10 +83,11 @@ class Bit7zLibrary final {
/**
* @brief Initiates the 7-zip object needed to create a new archive or use an old one.
*
* @note Usually this method should not be called directly by users of the bit7z library.
* @note Usually, this method should not be called directly by users of the bit7z library.
*
* @param format_ID GUID of the archive format (see BitInFormat's guid() method).
* @param interface_ID ID of the archive interface to be requested (IID_IInArchive or IID_IOutArchive).
* @param format_ID Pointer to the GUID of the archive format (see BitInFormat's guid() method).
* @param interface_ID Pointer to the GUID of the archive interface to be requested
* (IID_IInArchive or IID_IOutArchive).
* @param out_object Pointer to a CMyComPtr of an object implementing the requested interface.
*/
void createArchiveObject( const GUID* format_ID, const GUID* interface_ID, void** out_object ) const;
Expand All @@ -85,6 +103,7 @@ class Bit7zLibrary final {
HMODULE mLibrary;
CreateObjectFunc mCreateObjectFunc;
};

} // namespace bit7z

#endif // BIT7ZLIBRARY_HPP
69 changes: 59 additions & 10 deletions fernanda/include/bit7z/include/bitabstractarchivecreator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#ifndef BITABSTRACTARCHIVECREATOR_HPP
#define BITABSTRACTARCHIVECREATOR_HPP

#include <map>
#include <memory>

#include "bitabstractarchivehandler.hpp"
Expand All @@ -22,17 +23,19 @@ struct IOutStream;
struct ISequentialOutStream;

namespace bit7z {

using std::ostream;

struct ArchiveProperties {
vector< const wchar_t* > names;
vector< BitPropVariant > values;
};
class ArchiveProperties;

/**
* @brief Enumeration representing how an archive creator should deal when the output archive already exists.
*/
enum struct UpdateMode {
None,
Append,
Overwrite
None, ///< The creator will throw an exception (unless the OverwriteMode is not None).
Append, ///< The creator will append the new items to the existing archive.
Update, ///< New items whose path already exists in the archive will overwrite the old ones, other will be appended.
BIT7Z_DEPRECATED_ENUMERATOR( Overwrite, Update, "Since v4.0; please use the UpdateMode::Update enumerator." ) ///< @deprecated since v4.0; please use the UpdateMode::Update enumerator.
};

/**
Expand Down Expand Up @@ -131,7 +134,7 @@ class BitAbstractArchiveCreator : public BitAbstractArchiveHandler {
*
* When setting a password, the produced archive will be encrypted using the default
* cryptographic method of the output format. If the format is 7z, and the option
* "crypt_headers" is set to true, also the headers of the archive will be encrypted,
* "crypt_headers" is set to true, the headers of the archive will be encrypted,
* resulting in a password request every time the output file will be opened.
*
* @note Calling setPassword when the output format doesn't support archive encryption
Expand Down Expand Up @@ -199,6 +202,19 @@ class BitAbstractArchiveCreator : public BitAbstractArchiveHandler {
*/
virtual void setUpdateMode( UpdateMode mode );

/**
* @brief Sets whether the creator can update existing archives or not.
*
* @deprecated since v4.0; it is provided just for an easier transition from the old v3 API.
*
* @note If set to false, a subsequent compression operation may throw an exception
* if it targets an existing archive.
*
* @param can_update if true, compressing operations will update existing archives.
*/
BIT7Z_DEPRECATED_MSG( "Since v4.0; please use the overloaded function that takes an UpdateMode enumerator." )
void setUpdateMode( bool can_update );

/**
* @brief Sets the volume_size (in bytes) of the output archive volumes.
*
Expand All @@ -215,9 +231,38 @@ class BitAbstractArchiveCreator : public BitAbstractArchiveHandler {
*/
void setThreadsCount( uint32_t threads_count ) noexcept;

protected:
const BitInOutFormat& mFormat;
/**
* @brief Sets a property for the output archive format as described by the 7-zip documentation
* (e.g. https://sevenzip.osdn.jp/chm/cmdline/switches/method.htm).
*
* @tparam T An integral type (i.e., a bool or an integer type).
*
* @param name The string name of the property to be set.
* @param value The value to be used for the property.
*/
template< std::size_t N, typename T, typename = typename std::enable_if< std::is_integral< T >::value >::type >
void setFormatProperty( const wchar_t (&name)[N], T value ) noexcept { // NOLINT(*-avoid-c-arrays)
mExtraProperties[ name ] = value;
}

/**
* @brief Sets a property for the output archive format as described by the 7-zip documentation
* (e.g. https://sevenzip.osdn.jp/chm/cmdline/switches/method.htm).
*
* For example, passing the string L"tm" with a false value while creating a .7z archive
* will disable storing the last modified timestamps of the compressed files.
*
* @tparam T A non-integral type (i.e., a string).
*
* @param name The string name of the property to be set.
* @param value The value to be used for the property.
*/
template< std::size_t N, typename T, typename = typename std::enable_if< !std::is_integral< T >::value >::type >
void setFormatProperty( const wchar_t (&name)[N], const T& value ) noexcept { // NOLINT(*-avoid-c-arrays)
mExtraProperties[ name ] = value;
}

protected:
BitAbstractArchiveCreator( const Bit7zLibrary& lib,
const BitInOutFormat& format,
tstring password = {},
Expand All @@ -228,6 +273,8 @@ class BitAbstractArchiveCreator : public BitAbstractArchiveHandler {
friend class BitOutputArchive;

private:
const BitInOutFormat& mFormat;

UpdateMode mUpdateMode;
BitCompressionLevel mCompressionLevel;
BitCompressionMethod mCompressionMethod;
Expand All @@ -237,7 +284,9 @@ class BitAbstractArchiveCreator : public BitAbstractArchiveHandler {
bool mSolidMode;
uint64_t mVolumeSize;
uint32_t mThreadsCount;
std::map< std::wstring, BitPropVariant > mExtraProperties;
};

} // namespace bit7z

#endif // BITABSTRACTARCHIVECREATOR_HPP
50 changes: 39 additions & 11 deletions fernanda/include/bit7z/include/bitabstractarchivehandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "bitdefines.hpp"

namespace bit7z {

using std::function;

class BitInFormat;
Expand Down Expand Up @@ -49,6 +50,17 @@ using FileCallback = function< void( tstring ) >;
*/
using PasswordCallback = function< tstring() >;

/**
* @brief Enumeration representing how a handler should deal when an output file already exists.
*/
enum struct OverwriteMode {
None = 0, ///< The handler will throw an exception if the output file or buffer already exists.
Overwrite, ///< The handler will overwrite the old file or buffer with the new one.
Skip, ///< The handler will skip writing to the output file or buffer.
//TODO: RenameOutput,
//TODO: RenameExisting
};

/**
* @brief Abstract class representing a generic archive handler.
*/
Expand Down Expand Up @@ -80,13 +92,13 @@ class BitAbstractArchiveHandler {
BIT7Z_NODISCARD tstring password() const;

/**
* @return true if the directory structure must be preserved while extracting or compressing
* the archive, false otherwise.
* @return a boolean value indicating whether the directory structure must be preserved while extracting
* or compressing the archive.
*/
BIT7Z_NODISCARD bool retainDirectories() const noexcept;

/**
* @return true if a password is defined, false otherwise.
* @return a boolean value indicating whether a password is defined or not.
*/
BIT7Z_NODISCARD bool isPasswordDefined() const noexcept;

Expand Down Expand Up @@ -115,13 +127,18 @@ class BitAbstractArchiveHandler {
*/
BIT7Z_NODISCARD PasswordCallback passwordCallback() const;

/**
* @return the current OverwriteMode.
*/
BIT7Z_NODISCARD OverwriteMode overwriteMode() const;

/**
* @brief Sets up a password to be used by the archive handler.
*
* The password will be used to encrypt/decrypt archives by using the default
* cryptographic method of the archive format.
*
* @note Calling setPassword when the input archive is not encrypted does not have effect on
* @note Calling setPassword when the input archive is not encrypted does not have any effect on
* the extraction process.
*
* @note Calling setPassword when the output format doesn't support archive encryption
Expand All @@ -130,7 +147,7 @@ class BitAbstractArchiveHandler {
*
* @note After a password has been set, it will be used for every subsequent operation.
* To disable the use of the password, you need to call the clearPassword method, which is equivalent
* to call setPassword(L"").
* to calling setPassword(L"").
*
* @param password the password to be used.
*/
Expand All @@ -146,7 +163,7 @@ class BitAbstractArchiveHandler {
void clearPassword() noexcept;

/**
* @brief Sets whether methods output will preserve the input's directory structure or not.
* @brief Sets whether the operations' output will preserve the input's directory structure or not.
*
* @param retain the setting for preserving or not the input directory structure
*/
Expand All @@ -163,7 +180,7 @@ class BitAbstractArchiveHandler {
* @brief Sets the function to be called when the processed size of the ongoing operation is updated.
*
* @note The completion percentage of the current operation can be obtained by calculating
* static_cast<int>( ( 100.0 * processed_size ) / total_size ).
* `static_cast<int>( ( 100.0 * processed_size ) / total_size )`.
*
* @param callback the progress callback to be used.
*/
Expand All @@ -174,7 +191,7 @@ class BitAbstractArchiveHandler {
* ongoing operation are known.
*
* @note The ratio percentage of a compression operation can be obtained by calculating
* static_cast<int>( ( 100.0 * output_size ) / input_size ).
* `static_cast<int>( ( 100.0 * output_size ) / input_size )`.
*
* @param callback the ratio callback to be used.
*/
Expand All @@ -194,21 +211,32 @@ class BitAbstractArchiveHandler {
*/
void setPasswordCallback( const PasswordCallback& callback );

/**
* @brief Sets how the handler should behave when it tries to output to an existing file or buffer.
*
* @param mode the OverwriteMode to be used by the handler.
*/
void setOverwriteMode( OverwriteMode mode );

protected:
explicit BitAbstractArchiveHandler( const Bit7zLibrary& lib,
tstring password = {},
OverwriteMode overwrite_mode = OverwriteMode::None );

private:
const Bit7zLibrary& mLibrary;
tstring mPassword;
bool mRetainDirectories;
OverwriteMode mOverwriteMode;

explicit BitAbstractArchiveHandler( const Bit7zLibrary& lib, tstring password = {} );

private:
//CALLBACKS
TotalCallback mTotalCallback;
ProgressCallback mProgressCallback;
RatioCallback mRatioCallback;
FileCallback mFileCallback;
PasswordCallback mPasswordCallback;
};

} // namespace bit7z

#endif // BITABSTRACTARCHIVEHANDLER_HPP
Loading

0 comments on commit 835619d

Please sign in to comment.