mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJClient.git
synced 2026-03-28 05:25:39 +03:00
feat: add files time
This commit is contained in:
@@ -93,6 +93,7 @@ void DataParserOutput::createFileDataList(const QList<FileData>& fileDataList,co
|
|||||||
|
|
||||||
xmlWriter.writeAttribute("Path",data.path);
|
xmlWriter.writeAttribute("Path",data.path);
|
||||||
xmlWriter.writeAttribute("Hash",data.hash);
|
xmlWriter.writeAttribute("Hash",data.hash);
|
||||||
|
xmlWriter.writeAttribute("LastUpdate",data.lastUpdate);
|
||||||
|
|
||||||
xmlWriter.writeEndElement();
|
xmlWriter.writeEndElement();
|
||||||
}
|
}
|
||||||
@@ -333,6 +334,8 @@ QList<FileData>* DataParserOutput::xmlFileDataParse(const QByteArray& array,cons
|
|||||||
data.path = value;
|
data.path = value;
|
||||||
else if(name == "Hash")
|
else if(name == "Hash")
|
||||||
data.hash = value;
|
data.hash = value;
|
||||||
|
else if(name == "LastUpdate")
|
||||||
|
data.lastUpdate = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(data.path.contains(filter))
|
if(data.path.contains(filter))
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ void FastHashCalculator::calculateHashes(const QString& path, const QString& ign
|
|||||||
|
|
||||||
QtConcurrent::map(files, [this](const QString &filePath)
|
QtConcurrent::map(files, [this](const QString &filePath)
|
||||||
{
|
{
|
||||||
|
QFileInfo fileInfo(filePath);
|
||||||
QByteArray hash = calculateFileHashOptimized(filePath);
|
QByteArray hash = calculateFileHashOptimized(filePath);
|
||||||
QMutexLocker locker(&_mutex);
|
QMutexLocker locker(&_mutex);
|
||||||
FileData currentFile;
|
FileData currentFile;
|
||||||
@@ -68,7 +69,7 @@ void FastHashCalculator::calculateHashes(const QString& path, const QString& ign
|
|||||||
|
|
||||||
currentFile.path = Tools::createLocalPath(filePath);
|
currentFile.path = Tools::createLocalPath(filePath);
|
||||||
currentFile.hash = hash.toHex();
|
currentFile.hash = hash.toHex();
|
||||||
|
currentFile.lastUpdate = fileInfo.fileTime(QFileDevice::FileModificationTime).toString("dd.MM.yyyy hh:mm:ss");
|
||||||
hashList->append(currentFile);
|
hashList->append(currentFile);
|
||||||
}).waitForFinished();
|
}).waitForFinished();
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ void HashComparer::initialize(VersionContainer *versionContainer,UpdateNotifyWid
|
|||||||
void HashComparer::CompareDeltas(QList<FileData> *serverStreamingHash, QList<FileData> localStreamingHash)
|
void HashComparer::CompareDeltas(QList<FileData> *serverStreamingHash, QList<FileData> localStreamingHash)
|
||||||
{
|
{
|
||||||
QList<FileData> *files = new QList<FileData>;
|
QList<FileData> *files = new QList<FileData>;
|
||||||
|
serverFiles = new QList<FileData>;
|
||||||
QMutableListIterator<FileData> iterator(localStreamingHash);
|
QMutableListIterator<FileData> iterator(localStreamingHash);
|
||||||
|
|
||||||
for (auto &item:localStreamingHash)
|
for (auto &item:localStreamingHash)
|
||||||
@@ -26,6 +26,8 @@ void HashComparer::CompareDeltas(QList<FileData> *serverStreamingHash, QList<Fil
|
|||||||
if(!serverStreamingHash->contains(item))
|
if(!serverStreamingHash->contains(item))
|
||||||
{
|
{
|
||||||
if (item.path.contains("docs.xml")) continue; //фильтр на docs
|
if (item.path.contains("docs.xml")) continue; //фильтр на docs
|
||||||
|
quint32 fileDataIndex = findIndexByPath(*serverStreamingHash, item.path);
|
||||||
|
serverFiles->append(serverStreamingHash->at(fileDataIndex));
|
||||||
files->append(item);
|
files->append(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -34,6 +36,17 @@ void HashComparer::CompareDeltas(QList<FileData> *serverStreamingHash, QList<Fil
|
|||||||
showDeltas();
|
showDeltas();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
quint32 HashComparer::findIndexByPath(const QList<FileData> &serverStreamingHash,QString path)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < serverStreamingHash.size(); i++)
|
||||||
|
{
|
||||||
|
if(serverStreamingHash.at(i).path == path)
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
void HashComparer::showDeltas()
|
void HashComparer::showDeltas()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -42,9 +55,12 @@ void HashComparer::showDeltas()
|
|||||||
emit sigCallCheck();
|
emit sigCallCheck();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (auto &item:*filesForUpdate)
|
|
||||||
|
for (int i = 0; i < filesForUpdate->size(); i++)
|
||||||
{
|
{
|
||||||
updateWidget->addToList(item);
|
FileData local = filesForUpdate->at(i);
|
||||||
|
FileData server = serverFiles->at(i);
|
||||||
|
updateWidget->addToList(local,server);
|
||||||
}
|
}
|
||||||
|
|
||||||
emit sigHaveDelta();
|
emit sigHaveDelta();
|
||||||
|
|||||||
@@ -26,7 +26,9 @@ signals:
|
|||||||
private:
|
private:
|
||||||
UpdateNotifyWidget* updateWidget;
|
UpdateNotifyWidget* updateWidget;
|
||||||
QList<FileData> *filesForUpdate;
|
QList<FileData> *filesForUpdate;
|
||||||
|
QList<FileData> *serverFiles;
|
||||||
VersionContainer *versionContainer;
|
VersionContainer *versionContainer;
|
||||||
|
quint32 findIndexByPath(const QList<FileData> &serverStreamingHash, QString path);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // HASHCOMPARER_H
|
#endif // HASHCOMPARER_H
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ struct FileData
|
|||||||
{
|
{
|
||||||
QString path;
|
QString path;
|
||||||
QString hash;
|
QString hash;
|
||||||
|
QString lastUpdate;
|
||||||
|
|
||||||
bool operator==(const FileData& other)const
|
bool operator==(const FileData& other)const
|
||||||
{
|
{
|
||||||
|
|||||||
2
StaticData/authData.xml
Normal file
2
StaticData/authData.xml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<AuthData Login="I1" Password="b59c67bf196a4758191e42f76670ceba" InstructorName="Колобков В.Р." ClientName="Колобков В.Р." AccessType="instructor"/>
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ServerSettingsContainer>
|
<ServerSettingsContainer>
|
||||||
<ServerSettings AutoStart="0" Port="6000" Address="192.168.100.134" Language="RUS"/>
|
<ServerSettings Address="192.168.100.83" Port="6000" Language="RUS" AutoStart="0"/>
|
||||||
<VersionData Created="Пн дек 22 15:46:11 2025" isChangable="1" Version="max2"/>
|
<VersionData Version="-----" isChangable="0"/>
|
||||||
</ServerSettingsContainer>
|
</ServerSettingsContainer>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,2 +1,2 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ClientNotify Code="DISABLE"/>
|
<ClientNotify Code="CHECKVERSIONLIST"/>
|
||||||
|
|||||||
@@ -28,10 +28,14 @@ void UpdateNotifyWidget::setVersionContainer(VersionContainer *versionContainer)
|
|||||||
this->versionContainer = versionContainer;
|
this->versionContainer = versionContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateNotifyWidget::addToList(FileData fileData)
|
void UpdateNotifyWidget::addToList(FileData localFileData,FileData serverFileData)
|
||||||
{
|
{
|
||||||
QString itemName = fileData.path;
|
QString itemName = localFileData.path;
|
||||||
itemName = itemName.remove(streamingAssetsPath);
|
itemName = itemName.remove(streamingAssetsPath);
|
||||||
|
itemName.append("Сервер: ");
|
||||||
|
itemName.append(serverFileData.lastUpdate);
|
||||||
|
itemName.append("Локально: ");
|
||||||
|
itemName.append(localFileData.lastUpdate);
|
||||||
ui->updateListWidget->addItem(itemName);
|
ui->updateListWidget->addItem(itemName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public:
|
|||||||
explicit UpdateNotifyWidget(QWidget *parent = nullptr);
|
explicit UpdateNotifyWidget(QWidget *parent = nullptr);
|
||||||
~UpdateNotifyWidget();
|
~UpdateNotifyWidget();
|
||||||
void initialize(QPoint startPos);
|
void initialize(QPoint startPos);
|
||||||
void addToList(FileData fileData);
|
void addToList(FileData localFileData,FileData serverFileData);
|
||||||
void showWithFill();
|
void showWithFill();
|
||||||
void showTryChangeBase();
|
void showTryChangeBase();
|
||||||
void setVersionContainer(VersionContainer *versionContainer);
|
void setVersionContainer(VersionContainer *versionContainer);
|
||||||
|
|||||||
Reference in New Issue
Block a user