delete fileCommand;
fileCommand = 0;
}
+ if (addCommand)
+ {
+ delete addCommand;
+ addCommand = 0;
+ }
+ if (hashResult)
+ {
+ delete hashResult;
+ hashResult = 0;
+ }
}
QFileInfo File::file() const
if (name.isEmpty())
name = fileCommand->value(FileAnimeFlag::EnglishName).toString();
- QString fileName = tr("%1 - %2 - %3 - [%4](%5).%6")
+ QString newFileName = tr("%1 - %2 - %3 - [%4](%5).%6")
.arg(name)
.arg(fileCommand->value(FileAnimeFlag::EpNo).toString())
.arg(fileCommand->value(FileAnimeFlag::EpName).toString())
.arg(fileCommand->value(FileFlag::Crc32).toString())
.arg(fileCommand->value(FileFlag::FileType).toString());
- fileName.replace('"', "'");
- fileName.replace(QRegExp("[\\/]"), "-");
- fileName.replace(QRegExp("[\\/:*?\"<>|]"), "");
-qDebug() << fileName;
+ newFileName.replace('"', "'");
+ newFileName.replace(QRegExp("[\\/]"), "-");
+ newFileName.replace(QRegExp("[\\/:*?\"<>|]"), "");
+qDebug() << newFileName;
- QFile f(m_file.absoluteFilePath());
- if (f.rename(m_file.absolutePath() + "/" + fileName))
+ QFile file(m_file.absoluteFilePath());
+
+ if (file.fileName() == newFileName)
+ {
+ updateStatus(Renaming, Success);
+ return;
+ }
+
+ if (file.rename(m_file.absolutePath() + "/" + newFileName))
{
- m_file.setFile(f);
+ m_file.setFile(file);
qDebug() << m_file.absoluteFilePath();
updateStatus(Renaming, Success);
}
else
{
-qDebug() << f.errorString();
+qDebug() << file.errorString();
updateStatus(Renaming, Failure);
}
}
m_hashingState = m_renamingState = m_addingState = m_markingState = NotStarted;
notWorking = true;
- connect(this, SIGNAL(statusUpdate(Action,ActionState)), this, SLOT(workOnFinished(Action,ActionState)));
+ connect(this, SIGNAL(statusUpdate(AniDBUdpClient::File::Action,AniDBUdpClient::File::ActionState)), this, SLOT(workOnFinished(AniDBUdpClient::File::Action,AniDBUdpClient::File::ActionState)));
}
bool File::canContinue(ActionState state)