2016-01-09 02:56:56 +01:00
|
|
|
#ifndef RENAMINGUTILITY_SCRIPTFUNCTIONS_H
|
|
|
|
#define RENAMINGUTILITY_SCRIPTFUNCTIONS_H
|
|
|
|
|
2016-04-21 23:55:22 +02:00
|
|
|
#ifndef TAGEDITOR_NO_JSENGINE
|
|
|
|
|
2017-03-14 23:24:10 +01:00
|
|
|
#include "./jsdefs.h"
|
2016-01-09 02:56:56 +01:00
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QFileInfo)
|
|
|
|
|
|
|
|
namespace RenamingUtility {
|
|
|
|
|
|
|
|
class FileSystemItem;
|
|
|
|
enum class ItemType;
|
|
|
|
enum class ActionType;
|
|
|
|
|
2018-03-07 01:18:01 +01:00
|
|
|
class TagEditorObject : public QObject {
|
2016-01-09 02:56:56 +01:00
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(QString currentPath READ currentPath)
|
|
|
|
Q_PROPERTY(QString currentName READ currentName)
|
|
|
|
Q_PROPERTY(QString currentRelativeDirectory READ currentRelativeDirectory)
|
|
|
|
Q_PROPERTY(bool isDir READ isDir)
|
|
|
|
Q_PROPERTY(bool isFile READ isFile)
|
|
|
|
Q_PROPERTY(QString newName READ newName WRITE rename)
|
|
|
|
Q_PROPERTY(QString newRelativeDirectory READ newRelativeDirectory WRITE move)
|
2018-11-15 21:36:12 +01:00
|
|
|
Q_PROPERTY(QString note READ note)
|
2016-01-09 02:56:56 +01:00
|
|
|
|
|
|
|
public:
|
2017-01-06 21:29:43 +01:00
|
|
|
explicit TagEditorObject(TAGEDITOR_JS_ENGINE *engine);
|
2016-01-09 02:56:56 +01:00
|
|
|
|
|
|
|
ActionType action() const;
|
|
|
|
void setFileInfo(const QFileInfo &file, FileSystemItem *item);
|
|
|
|
|
|
|
|
const QString ¤tPath() const;
|
|
|
|
const QString ¤tName() const;
|
|
|
|
const QString ¤tRelativeDirectory() const;
|
|
|
|
bool isDir() const;
|
|
|
|
bool isFile() const;
|
|
|
|
const QString &newName() const;
|
|
|
|
const QString &newRelativeDirectory() const;
|
2018-11-15 21:36:12 +01:00
|
|
|
const QString ¬e() const;
|
2016-01-09 02:56:56 +01:00
|
|
|
|
2020-03-08 14:04:29 +01:00
|
|
|
public Q_SLOTS:
|
2016-01-09 02:56:56 +01:00
|
|
|
TAGEDITOR_JS_VALUE parseFileInfo(const QString &fileName);
|
|
|
|
TAGEDITOR_JS_VALUE parseFileName(const QString &fileName);
|
|
|
|
TAGEDITOR_JS_VALUE allFiles(const QString &dirName);
|
|
|
|
TAGEDITOR_JS_VALUE firstFile(const QString &dirName);
|
|
|
|
void writeLog(const QString &message);
|
|
|
|
void rename(const QString &newName);
|
|
|
|
void move(const QString &newRelativeDirectory);
|
2018-11-15 21:36:12 +01:00
|
|
|
void skip(const QString ¬e = QString());
|
2016-01-09 02:56:56 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
TAGEDITOR_JS_ENGINE *m_engine;
|
|
|
|
QString m_currentPath;
|
|
|
|
QString m_currentName;
|
|
|
|
QString m_currentRelativeDirectory;
|
|
|
|
ItemType m_currentType;
|
|
|
|
ActionType m_action;
|
|
|
|
QString m_newName;
|
|
|
|
QString m_newRelativeDirectory;
|
2018-11-15 21:36:12 +01:00
|
|
|
QString m_note;
|
2016-01-09 02:56:56 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
inline ActionType TagEditorObject::action() const
|
|
|
|
{
|
|
|
|
return m_action;
|
|
|
|
}
|
|
|
|
|
2018-11-15 21:36:12 +01:00
|
|
|
inline const QString &TagEditorObject::note() const
|
|
|
|
{
|
|
|
|
return m_note;
|
|
|
|
}
|
|
|
|
|
2016-01-09 02:56:56 +01:00
|
|
|
} // namespace RenamingUtility
|
|
|
|
|
2016-04-21 23:55:22 +02:00
|
|
|
#endif // TAGEDITOR_NO_JSENGINE
|
2016-01-09 02:56:56 +01:00
|
|
|
#endif // RENAMINGUTILITY_SCRIPTFUNCTIONS_H
|