Skip to content
Snippets Groups Projects
qtlib_dir.h 1.07 KiB
Newer Older
akiraohgaki's avatar
akiraohgaki committed
/**
akiraohgaki's avatar
akiraohgaki committed
 * qtlib
akiraohgaki's avatar
akiraohgaki committed
 *
 * @author      Akira Ohgaki <akiraohgaki@gmail.com>
 * @copyright   Akira Ohgaki
akiraohgaki's avatar
akiraohgaki committed
 * @license     https://opensource.org/licenses/LGPL-3.0
akiraohgaki's avatar
akiraohgaki committed
 * @link        https://github.com/akiraohgaki/qtlib
akiraohgaki's avatar
akiraohgaki committed
 */

#pragma once

#include <QObject>
#include <QFileInfoList>

akiraohgaki's avatar
akiraohgaki committed
namespace qtlib {
akiraohgaki's avatar
akiraohgaki committed

class Dir : public QObject
{
    Q_OBJECT

public:
akiraohgaki's avatar
akiraohgaki committed
    explicit Dir(const QString &path = "", QObject *parent = 0);
akiraohgaki's avatar
akiraohgaki committed

akiraohgaki's avatar
akiraohgaki committed
    Dir(const Dir &other, QObject *parent = 0);
akiraohgaki's avatar
akiraohgaki committed
    Dir &operator =(const Dir &other);
akiraohgaki's avatar
akiraohgaki committed

    QString path() const;
    void setPath(const QString &path);

    bool exists();
    QFileInfoList list();
    bool make();
    bool copy(const QString &newPath);
    bool move(const QString &newPath);
    bool remove();

    static QString rootPath();
    static QString tempPath();
    static QString homePath();
    static QString genericDataPath();
    static QString genericConfigPath();
    static QString genericCachePath();
    static QString kdehomePath();

private:
    bool copyRecursively(const QString &srcPath, const QString &newPath);

    QString path_;
};

akiraohgaki's avatar
akiraohgaki committed
} // namespace qtlib