Fix typo
This commit is contained in:
parent
e3202b7fc5
commit
537d31289d
|
@ -45,7 +45,7 @@ RenameFilesDialog::RenameFilesDialog(QWidget *parent) :
|
||||||
m_ui->externalScriptPage->setBackgroundRole(QPalette::Base);
|
m_ui->externalScriptPage->setBackgroundRole(QPalette::Base);
|
||||||
|
|
||||||
// setup preview tree view
|
// setup preview tree view
|
||||||
m_engine = new RemamingEngine(this);
|
m_engine = new RenamingEngine(this);
|
||||||
m_ui->currentTreeView->setModel(m_engine->currentModel());
|
m_ui->currentTreeView->setModel(m_engine->currentModel());
|
||||||
m_ui->previewTreeView->setModel(m_engine->previewModel());
|
m_ui->previewTreeView->setModel(m_engine->previewModel());
|
||||||
|
|
||||||
|
@ -82,9 +82,9 @@ RenameFilesDialog::RenameFilesDialog(QWidget *parent) :
|
||||||
connect(m_ui->generatePreviewPushButton, &QPushButton::clicked, this, &RenameFilesDialog::startGeneratingPreview);
|
connect(m_ui->generatePreviewPushButton, &QPushButton::clicked, this, &RenameFilesDialog::startGeneratingPreview);
|
||||||
connect(m_ui->applyChangingsPushButton, &QPushButton::clicked, this, &RenameFilesDialog::startApplyChangings);
|
connect(m_ui->applyChangingsPushButton, &QPushButton::clicked, this, &RenameFilesDialog::startApplyChangings);
|
||||||
connect(m_ui->abortClosePushButton, &QPushButton::clicked, this, &RenameFilesDialog::abortClose);
|
connect(m_ui->abortClosePushButton, &QPushButton::clicked, this, &RenameFilesDialog::abortClose);
|
||||||
connect(m_engine, &RemamingEngine::previewGenerated, this, &RenameFilesDialog::showPreviewResults);
|
connect(m_engine, &RenamingEngine::previewGenerated, this, &RenameFilesDialog::showPreviewResults);
|
||||||
connect(m_engine, &RemamingEngine::changingsApplied, this, &RenameFilesDialog::showChangsingsResults);
|
connect(m_engine, &RenamingEngine::changingsApplied, this, &RenameFilesDialog::showChangsingsResults);
|
||||||
connect(m_engine, &RemamingEngine::progress, this, &RenameFilesDialog::showPreviewProgress);
|
connect(m_engine, &RenamingEngine::progress, this, &RenameFilesDialog::showPreviewProgress);
|
||||||
connect(m_ui->currentTreeView, &QTreeView::customContextMenuRequested, this, &RenameFilesDialog::showTreeViewContextMenu);
|
connect(m_ui->currentTreeView, &QTreeView::customContextMenuRequested, this, &RenameFilesDialog::showTreeViewContextMenu);
|
||||||
connect(m_ui->previewTreeView, &QTreeView::customContextMenuRequested, this, &RenameFilesDialog::showTreeViewContextMenu);
|
connect(m_ui->previewTreeView, &QTreeView::customContextMenuRequested, this, &RenameFilesDialog::showTreeViewContextMenu);
|
||||||
connect(m_ui->currentTreeView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &RenameFilesDialog::currentItemSelected);
|
connect(m_ui->currentTreeView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &RenameFilesDialog::currentItemSelected);
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
QT_FORWARD_DECLARE_CLASS(QItemSelection)
|
QT_FORWARD_DECLARE_CLASS(QItemSelection)
|
||||||
|
|
||||||
namespace RenamingUtility {
|
namespace RenamingUtility {
|
||||||
class RemamingEngine;
|
class RenamingEngine;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace QtGui {
|
namespace QtGui {
|
||||||
|
@ -56,7 +56,7 @@ private slots:
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<Ui::RenameFilesDialog> m_ui;
|
std::unique_ptr<Ui::RenameFilesDialog> m_ui;
|
||||||
JavaScriptHighlighter *m_highlighter;
|
JavaScriptHighlighter *m_highlighter;
|
||||||
RenamingUtility::RemamingEngine *m_engine;
|
RenamingUtility::RenamingEngine *m_engine;
|
||||||
int m_itemsProcessed;
|
int m_itemsProcessed;
|
||||||
int m_errorsOccured;
|
int m_errorsOccured;
|
||||||
bool m_changingSelection;
|
bool m_changingSelection;
|
||||||
|
|
|
@ -29,7 +29,7 @@ class FileSystemItem
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FileSystemItem(ItemStatus status = ItemStatus::Current, ItemType type = ItemType::File, const QString &name = QString(), FileSystemItem *parent = nullptr);
|
explicit FileSystemItem(ItemStatus status = ItemStatus::Current, ItemType type = ItemType::File, const QString &name = QString(), FileSystemItem *parent = nullptr);
|
||||||
~FileSystemItem();
|
~FileSystemItem();
|
||||||
FileSystemItem(const FileSystemItem &other) = delete;
|
FileSystemItem(const FileSystemItem &other) = delete;
|
||||||
FileSystemItem &operator =(const FileSystemItem &other) = delete;
|
FileSystemItem &operator =(const FileSystemItem &other) = delete;
|
||||||
|
|
|
@ -17,8 +17,8 @@ class FileSystemItemModel : public QAbstractItemModel
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FileSystemItemModel(FileSystemItem *rootItem, QObject *parent = nullptr);
|
explicit FileSystemItemModel(FileSystemItem *rootItem, QObject *parent = nullptr);
|
||||||
virtual ~FileSystemItemModel();
|
~FileSystemItemModel();
|
||||||
|
|
||||||
void setRootItem(FileSystemItem *rootItem);
|
void setRootItem(FileSystemItem *rootItem);
|
||||||
QVariant data(const QModelIndex &index, int role) const;
|
QVariant data(const QModelIndex &index, int role) const;
|
||||||
|
|
|
@ -12,7 +12,7 @@ class FilteredFileSystemItemModel : public QSortFilterProxyModel
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FilteredFileSystemItemModel(ItemStatus statusFilter = ItemStatus::Current, QObject *parent = nullptr);
|
explicit FilteredFileSystemItemModel(ItemStatus statusFilter = ItemStatus::Current, QObject *parent = nullptr);
|
||||||
|
|
||||||
ItemStatus statusFilter() const;
|
ItemStatus statusFilter() const;
|
||||||
void setStatusFilter(ItemStatus statusFilter);
|
void setStatusFilter(ItemStatus statusFilter);
|
||||||
|
|
|
@ -16,7 +16,7 @@ using namespace ThreadingUtils;
|
||||||
|
|
||||||
namespace RenamingUtility {
|
namespace RenamingUtility {
|
||||||
|
|
||||||
RemamingEngine::RemamingEngine(QObject *parent) :
|
RenamingEngine::RenamingEngine(QObject *parent) :
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
#ifndef TAGEDITOR_NO_JSENGINE
|
#ifndef TAGEDITOR_NO_JSENGINE
|
||||||
m_tagEditorQObj(new TagEditorObject(&m_engine)),
|
m_tagEditorQObj(new TagEditorObject(&m_engine)),
|
||||||
|
@ -33,12 +33,12 @@ RemamingEngine::RemamingEngine(QObject *parent) :
|
||||||
#ifndef TAGEDITOR_NO_JSENGINE
|
#ifndef TAGEDITOR_NO_JSENGINE
|
||||||
m_engine.globalObject().setProperty(QStringLiteral("tageditor"), m_tagEditorJsObj);
|
m_engine.globalObject().setProperty(QStringLiteral("tageditor"), m_tagEditorJsObj);
|
||||||
#endif
|
#endif
|
||||||
connect(this, &RemamingEngine::previewGenerated, this, &RemamingEngine::processPreviewGenerated);
|
connect(this, &RenamingEngine::previewGenerated, this, &RenamingEngine::processPreviewGenerated);
|
||||||
connect(this, &RemamingEngine::changingsApplied, this, &RemamingEngine::processChangingsApplied);
|
connect(this, &RenamingEngine::changingsApplied, this, &RenamingEngine::processChangingsApplied);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TAGEDITOR_NO_JSENGINE
|
#ifndef TAGEDITOR_NO_JSENGINE
|
||||||
bool RemamingEngine::setProgram(const TAGEDITOR_JS_VALUE &program)
|
bool RenamingEngine::setProgram(const TAGEDITOR_JS_VALUE &program)
|
||||||
{
|
{
|
||||||
if(TAGEDITOR_JS_IS_VALID_PROG(program)) {
|
if(TAGEDITOR_JS_IS_VALID_PROG(program)) {
|
||||||
m_errorMessage.clear();
|
m_errorMessage.clear();
|
||||||
|
@ -56,7 +56,7 @@ bool RemamingEngine::setProgram(const TAGEDITOR_JS_VALUE &program)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool RemamingEngine::setProgram(const QString &program)
|
bool RenamingEngine::setProgram(const QString &program)
|
||||||
{
|
{
|
||||||
#ifndef TAGEDITOR_NO_JSENGINE
|
#ifndef TAGEDITOR_NO_JSENGINE
|
||||||
return setProgram(m_engine.evaluate(QStringLiteral("(function(){") % program % QStringLiteral("})")));
|
return setProgram(m_engine.evaluate(QStringLiteral("(function(){") % program % QStringLiteral("})")));
|
||||||
|
@ -67,7 +67,7 @@ bool RemamingEngine::setProgram(const QString &program)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RemamingEngine::generatePreview(const QDir &rootDirectory, bool includeSubdirs)
|
bool RenamingEngine::generatePreview(const QDir &rootDirectory, bool includeSubdirs)
|
||||||
{
|
{
|
||||||
#ifndef TAGEDITOR_NO_JSENGINE
|
#ifndef TAGEDITOR_NO_JSENGINE
|
||||||
TryLocker<> locker(m_mutex);
|
TryLocker<> locker(m_mutex);
|
||||||
|
@ -94,7 +94,7 @@ bool RemamingEngine::generatePreview(const QDir &rootDirectory, bool includeSubd
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RemamingEngine::applyChangings()
|
bool RenamingEngine::applyChangings()
|
||||||
{
|
{
|
||||||
if(!m_rootItem) {
|
if(!m_rootItem) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -117,7 +117,7 @@ bool RemamingEngine::applyChangings()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RemamingEngine::isBusy()
|
bool RenamingEngine::isBusy()
|
||||||
{
|
{
|
||||||
if(m_mutex.tryLock()) {
|
if(m_mutex.tryLock()) {
|
||||||
m_mutex.unlock();
|
m_mutex.unlock();
|
||||||
|
@ -127,17 +127,17 @@ bool RemamingEngine::isBusy()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemamingEngine::abort()
|
void RenamingEngine::abort()
|
||||||
{
|
{
|
||||||
m_aborted.store(1);
|
m_aborted.store(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RemamingEngine::isAborted()
|
bool RenamingEngine::isAborted()
|
||||||
{
|
{
|
||||||
return m_aborted.load();
|
return m_aborted.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RemamingEngine::clearPreview()
|
bool RenamingEngine::clearPreview()
|
||||||
{
|
{
|
||||||
TryLocker<> locker(m_mutex);
|
TryLocker<> locker(m_mutex);
|
||||||
if(locker) {
|
if(locker) {
|
||||||
|
@ -149,7 +149,7 @@ bool RemamingEngine::clearPreview()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FileSystemItemModel *RemamingEngine::model()
|
FileSystemItemModel *RenamingEngine::model()
|
||||||
{
|
{
|
||||||
if(!m_model) {
|
if(!m_model) {
|
||||||
m_model = new FileSystemItemModel(m_rootItem.get(), this);
|
m_model = new FileSystemItemModel(m_rootItem.get(), this);
|
||||||
|
@ -157,7 +157,7 @@ FileSystemItemModel *RemamingEngine::model()
|
||||||
return m_model;
|
return m_model;
|
||||||
}
|
}
|
||||||
|
|
||||||
FilteredFileSystemItemModel *RemamingEngine::currentModel()
|
FilteredFileSystemItemModel *RenamingEngine::currentModel()
|
||||||
{
|
{
|
||||||
if(!m_currentModel) {
|
if(!m_currentModel) {
|
||||||
m_currentModel = new FilteredFileSystemItemModel(ItemStatus::Current, this);
|
m_currentModel = new FilteredFileSystemItemModel(ItemStatus::Current, this);
|
||||||
|
@ -166,7 +166,7 @@ FilteredFileSystemItemModel *RemamingEngine::currentModel()
|
||||||
return m_currentModel;
|
return m_currentModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
FilteredFileSystemItemModel *RemamingEngine::previewModel()
|
FilteredFileSystemItemModel *RenamingEngine::previewModel()
|
||||||
{
|
{
|
||||||
if(!m_previewModel) {
|
if(!m_previewModel) {
|
||||||
m_previewModel = new FilteredFileSystemItemModel(ItemStatus::New, this);
|
m_previewModel = new FilteredFileSystemItemModel(ItemStatus::New, this);
|
||||||
|
@ -175,24 +175,24 @@ FilteredFileSystemItemModel *RemamingEngine::previewModel()
|
||||||
return m_previewModel;
|
return m_previewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemamingEngine::processPreviewGenerated()
|
void RenamingEngine::processPreviewGenerated()
|
||||||
{
|
{
|
||||||
setRootItem(move(m_newlyGeneratedRootItem));
|
setRootItem(move(m_newlyGeneratedRootItem));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemamingEngine::processChangingsApplied()
|
void RenamingEngine::processChangingsApplied()
|
||||||
{
|
{
|
||||||
updateModel(nullptr);
|
updateModel(nullptr);
|
||||||
updateModel(m_rootItem.get());
|
updateModel(m_rootItem.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void RemamingEngine::setRootItem(unique_ptr<FileSystemItem> &&rootItem)
|
inline void RenamingEngine::setRootItem(unique_ptr<FileSystemItem> &&rootItem)
|
||||||
{
|
{
|
||||||
updateModel(rootItem.get());
|
updateModel(rootItem.get());
|
||||||
m_rootItem = move(rootItem);
|
m_rootItem = move(rootItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemamingEngine::updateModel(FileSystemItem *rootItem)
|
void RenamingEngine::updateModel(FileSystemItem *rootItem)
|
||||||
{
|
{
|
||||||
if(m_model) {
|
if(m_model) {
|
||||||
m_model->setRootItem(rootItem);
|
m_model->setRootItem(rootItem);
|
||||||
|
@ -200,7 +200,7 @@ void RemamingEngine::updateModel(FileSystemItem *rootItem)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TAGEDITOR_NO_JSENGINE
|
#ifndef TAGEDITOR_NO_JSENGINE
|
||||||
unique_ptr<FileSystemItem> RemamingEngine::generatePreview(const QDir &dir, FileSystemItem *parent)
|
unique_ptr<FileSystemItem> RenamingEngine::generatePreview(const QDir &dir, FileSystemItem *parent)
|
||||||
{
|
{
|
||||||
auto item = make_unique<FileSystemItem>(ItemStatus::Current, ItemType::Dir, dir.dirName(), parent);
|
auto item = make_unique<FileSystemItem>(ItemStatus::Current, ItemType::Dir, dir.dirName(), parent);
|
||||||
item->setApplied(false);
|
item->setApplied(false);
|
||||||
|
@ -234,7 +234,7 @@ unique_ptr<FileSystemItem> RemamingEngine::generatePreview(const QDir &dir, File
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void RemamingEngine::applyChangings(FileSystemItem *parentItem)
|
void RenamingEngine::applyChangings(FileSystemItem *parentItem)
|
||||||
{
|
{
|
||||||
for(FileSystemItem *item : parentItem->children()) {
|
for(FileSystemItem *item : parentItem->children()) {
|
||||||
if(!item->applied() && !item->errorOccured()) {
|
if(!item->applied() && !item->errorOccured()) {
|
||||||
|
@ -308,7 +308,7 @@ void RemamingEngine::applyChangings(FileSystemItem *parentItem)
|
||||||
emit progress(m_itemsProcessed, m_errorsOccured);
|
emit progress(m_itemsProcessed, m_errorsOccured);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemamingEngine::setError(const QList<FileSystemItem *> items)
|
void RenamingEngine::setError(const QList<FileSystemItem *> items)
|
||||||
{
|
{
|
||||||
for(FileSystemItem *item : items) {
|
for(FileSystemItem *item : items) {
|
||||||
item->setErrorOccured(true);
|
item->setErrorOccured(true);
|
||||||
|
@ -317,7 +317,7 @@ void RemamingEngine::setError(const QList<FileSystemItem *> items)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TAGEDITOR_NO_JSENGINE
|
#ifndef TAGEDITOR_NO_JSENGINE
|
||||||
void RemamingEngine::executeScriptForItem(const QFileInfo &fileInfo, FileSystemItem *item)
|
void RenamingEngine::executeScriptForItem(const QFileInfo &fileInfo, FileSystemItem *item)
|
||||||
{
|
{
|
||||||
// make file info for the specified item available in the script
|
// make file info for the specified item available in the script
|
||||||
m_tagEditorQObj->setFileInfo(fileInfo, item);
|
m_tagEditorQObj->setFileInfo(fileInfo, item);
|
||||||
|
|
|
@ -27,12 +27,12 @@ class FileSystemItemModel;
|
||||||
class FilteredFileSystemItemModel;
|
class FilteredFileSystemItemModel;
|
||||||
class TagEditorObject;
|
class TagEditorObject;
|
||||||
|
|
||||||
class RemamingEngine : public QObject
|
class RenamingEngine : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RemamingEngine(QObject *parent = nullptr);
|
explicit RenamingEngine(QObject *parent = nullptr);
|
||||||
|
|
||||||
FileSystemItem *rootItem() const;
|
FileSystemItem *rootItem() const;
|
||||||
#ifndef TAGEDITOR_NO_JSENGINE
|
#ifndef TAGEDITOR_NO_JSENGINE
|
||||||
|
@ -100,34 +100,34 @@ private:
|
||||||
int m_errorLineNumber;
|
int m_errorLineNumber;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline FileSystemItem *RemamingEngine::rootItem() const
|
inline FileSystemItem *RenamingEngine::rootItem() const
|
||||||
{
|
{
|
||||||
return m_rootItem.get();
|
return m_rootItem.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TAGEDITOR_NO_JSENGINE
|
#ifndef TAGEDITOR_NO_JSENGINE
|
||||||
inline const TAGEDITOR_JS_VALUE &RemamingEngine::scriptProgram() const
|
inline const TAGEDITOR_JS_VALUE &RenamingEngine::scriptProgram() const
|
||||||
{
|
{
|
||||||
return m_program;
|
return m_program;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
inline const QDir &RemamingEngine::rootDirectory() const
|
inline const QDir &RenamingEngine::rootDirectory() const
|
||||||
{
|
{
|
||||||
return m_dir;
|
return m_dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool RemamingEngine::subdirsIncluded() const
|
inline bool RenamingEngine::subdirsIncluded() const
|
||||||
{
|
{
|
||||||
return m_includeSubdirs;
|
return m_includeSubdirs;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const QString &RemamingEngine::errorMessage() const
|
inline const QString &RenamingEngine::errorMessage() const
|
||||||
{
|
{
|
||||||
return m_errorMessage;
|
return m_errorMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int RemamingEngine::errorLineNumber() const
|
inline int RenamingEngine::errorLineNumber() const
|
||||||
{
|
{
|
||||||
return m_errorLineNumber;
|
return m_errorLineNumber;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ class TagEditorObject : public QObject
|
||||||
Q_PROPERTY(QString newRelativeDirectory READ newRelativeDirectory WRITE move)
|
Q_PROPERTY(QString newRelativeDirectory READ newRelativeDirectory WRITE move)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TagEditorObject(TAGEDITOR_JS_ENGINE *engine);
|
explicit TagEditorObject(TAGEDITOR_JS_ENGINE *engine);
|
||||||
|
|
||||||
ActionType action() const;
|
ActionType action() const;
|
||||||
void setFileInfo(const QFileInfo &file, FileSystemItem *item);
|
void setFileInfo(const QFileInfo &file, FileSystemItem *item);
|
||||||
|
|
|
@ -4334,6 +4334,9 @@ Remarks
|
||||||
<comment>Necessary for lupdate.</comment>
|
<comment>Necessary for lupdate.</comment>
|
||||||
<translation></translation>
|
<translation></translation>
|
||||||
</message>
|
</message>
|
||||||
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>RenamingUtility::RenamingEngine</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../renamingutility/renamingengine.cpp" line="52"/>
|
<location filename="../renamingutility/renamingengine.cpp" line="52"/>
|
||||||
<source>Program is not callable.</source>
|
<source>Program is not callable.</source>
|
||||||
|
|
|
@ -4334,6 +4334,9 @@ Remarks
|
||||||
<comment>Necessary for lupdate.</comment>
|
<comment>Necessary for lupdate.</comment>
|
||||||
<translation></translation>
|
<translation></translation>
|
||||||
</message>
|
</message>
|
||||||
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>RenamingUtility::RenamingEngine</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../renamingutility/renamingengine.cpp" line="52"/>
|
<location filename="../renamingutility/renamingengine.cpp" line="52"/>
|
||||||
<source>Program is not callable.</source>
|
<source>Program is not callable.</source>
|
||||||
|
|
Loading…
Reference in New Issue