本文整理汇总了C++中Folder::getLastModifDate方法的典型用法代码示例。如果您正苦于以下问题:C++ Folder::getLastModifDate方法的具体用法?C++ Folder::getLastModifDate怎么用?C++ Folder::getLastModifDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Folder
的用法示例。
在下文中一共展示了Folder::getLastModifDate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ComparatifRenameFodler
void Synchro::ComparatifRenameFodler(QDateTime delta)
{
qDebug() << delta.toString();
std::map<int, Folder *> FolderMap = myparse.getFoldermap();
typedef std::map<int, Folder *>::iterator it_type2;
std::map<int, Folder *> OldFolderMap = oldparse.getFoldermap();
typedef std::map<int, Folder *>::iterator it_type;
QStringList ListNew, ListOld;
for (it_type2 iterator = FolderMap.begin(); iterator != FolderMap.end(); iterator++) {
Folder *fold = iterator->second;
ListNew.push_back((this->folder + fold->getChosenPath() + fold->getName()).c_str());
QString d = QString::fromStdString(fold->getLastModifDate());
long long r = QDateTime::fromString(d, "yyyy:MM:dd hh:mm:ss").msecsTo(delta);
if (r < 0)
{
std::string tmppath = this->folder + fold->getChosenPath() + fold->getName();
QString path(tmppath.c_str());
qDebug() << "Directory updated: " << path;
for (it_type iterator2 = OldFolderMap.begin(); iterator2 != OldFolderMap.end(); iterator2++) {
Folder *oldfold = iterator2->second;
if (oldfold->getId() == fold->getId())
{
std::string oldpath = this->folder + oldfold->getChosenPath() + oldfold->getName();
qDebug() << "Directory Old: " << oldpath.c_str();
if ((oldfold->getName() != fold->getName()) || (oldpath != path.toStdString()))
{
QString original = (this->folder + oldfold->getChosenPath() + oldfold->getName()).c_str();
QString dest = (this->folder + fold->getChosenPath() + fold->getName()).c_str();
QDir dir;
if (!dir.rename(original, dest)){
qDebug() << "OOOOOOO SECOURSSSSSSSS";
}
}
}
}
}
else
{
}
}
for (it_type iterator2 = OldFolderMap.begin(); iterator2 != OldFolderMap.end(); iterator2++) {
Folder *oldfold = iterator2->second;
ListOld.push_back((this->folder + oldfold->getChosenPath() + oldfold->getName()).c_str());
}
QStringList currEntryList = ListNew;
QStringList newEntryList = ListOld;
QSet<QString> newDirSet = QSet<QString>::fromList(newEntryList);
QSet<QString> currentDirSet = QSet<QString>::fromList(currEntryList);
// Files that have been added
QSet<QString> newFiles = newDirSet - currentDirSet;
QStringList newFile = newFiles.toList();
// Files that have been removed
QSet<QString> deletedFiles = currentDirSet - newDirSet;
QStringList deleteFile = deletedFiles.toList();
if (!deleteFile.isEmpty())
{
qDebug() << "Files/Dirs deleted: " << deleteFile;
foreach(QString file, deleteFile)
{
if (QDir(file).exists() == true)
return;
else
QDir().mkdir(file);
}
}