1
0
mirror of https://github.com/QRouland/UTPass.git synced 2025-06-24 22:42:28 +00:00

Refactor cloning feature and ui

This commit is contained in:
2025-01-17 10:40:54 +01:00
parent beaad58af2
commit c0757da47b
26 changed files with 805 additions and 385 deletions

View File

@ -58,3 +58,9 @@ bool Utils::rmDir(QUrl dir_url)
QDir dir(dir_url.toLocalFile());
return dir.removeRecursively();
}
QString Utils::manifestPath(){
auto path = QDir(QDir::currentPath()).filePath("manifest_.json");
qDebug() << "Manifest path : " << path;
return path;
}

View File

@ -5,17 +5,70 @@
#include <QUrl>
#include <QQuickWindow>
/**
* @class Utils
* @brief A utility class that provides helper functions for file and directory operations.
*
* The `Utils` class contains various helper methods such as for managing files and directories, including unzipping files
* and removing files or directories.
*/
class Utils : public QObject
{
Q_OBJECT
public:
/**
* @brief Default constructor for the Utils class.
*/
Utils() = default;
/**
* @brief Default destructor for the Utils class.
*/
~Utils() override = default;
/**
* @brief Unzips a ZIP file to the specified output directory.
*
* This method extracts the contents of a ZIP file from the specified URL and saves them to the provided
* output directory path.
*
* @param zip_url The URL of the ZIP file to unzip.
* @param dir_out The output directory where the contents of the ZIP file should be extracted.
* @return `true` if the unzipping operation was successful, `false` otherwise.
*/
Q_INVOKABLE bool unzip(QUrl zip_url, QString dir_out);
/**
* @brief Removes a file at the specified URL.
*
* This method deletes a file at the specified URL.
*
* @param file_url The URL of the file to delete.
* @return `true` if the file was successfully removed, `false` otherwise.
*/
Q_INVOKABLE bool rmFile(QUrl file_url);
/**
* @brief Removes a directory at the specified URL.
*
* This method deletes a directory at the specified URL, along with its contents.
*
* @param dir_url The URL of the directory to remove.
* @return `true` if the directory was successfully removed, `false` otherwise.
*/
Q_INVOKABLE bool rmDir(QUrl dir_url);
/**
* @brief Retrieves the path to the manifest data.
*
* This function returns the full path to the manifest file used by the application.
*
* @return A QString containing the manifest file path.
*/
Q_INVOKABLE QString manifestPath();
};
#endif