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("Hash",data.hash);
|
||||
xmlWriter.writeAttribute("LastUpdate",data.lastUpdate);
|
||||
|
||||
xmlWriter.writeEndElement();
|
||||
}
|
||||
@@ -333,6 +334,8 @@ QList<FileData>* DataParserOutput::xmlFileDataParse(const QByteArray& array,cons
|
||||
data.path = value;
|
||||
else if(name == "Hash")
|
||||
data.hash = value;
|
||||
else if(name == "LastUpdate")
|
||||
data.lastUpdate = value;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
QFileInfo fileInfo(filePath);
|
||||
QByteArray hash = calculateFileHashOptimized(filePath);
|
||||
QMutexLocker locker(&_mutex);
|
||||
FileData currentFile;
|
||||
@@ -68,7 +69,7 @@ void FastHashCalculator::calculateHashes(const QString& path, const QString& ign
|
||||
|
||||
currentFile.path = Tools::createLocalPath(filePath);
|
||||
currentFile.hash = hash.toHex();
|
||||
|
||||
currentFile.lastUpdate = fileInfo.fileTime(QFileDevice::FileModificationTime).toString("dd.MM.yyyy hh:mm:ss");
|
||||
hashList->append(currentFile);
|
||||
}).waitForFinished();
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ void HashComparer::initialize(VersionContainer *versionContainer,UpdateNotifyWid
|
||||
void HashComparer::CompareDeltas(QList<FileData> *serverStreamingHash, QList<FileData> localStreamingHash)
|
||||
{
|
||||
QList<FileData> *files = new QList<FileData>;
|
||||
|
||||
serverFiles = new QList<FileData>;
|
||||
QMutableListIterator<FileData> iterator(localStreamingHash);
|
||||
|
||||
for (auto &item:localStreamingHash)
|
||||
@@ -26,6 +26,8 @@ void HashComparer::CompareDeltas(QList<FileData> *serverStreamingHash, QList<Fil
|
||||
if(!serverStreamingHash->contains(item))
|
||||
{
|
||||
if (item.path.contains("docs.xml")) continue; //фильтр на docs
|
||||
quint32 fileDataIndex = findIndexByPath(*serverStreamingHash, item.path);
|
||||
serverFiles->append(serverStreamingHash->at(fileDataIndex));
|
||||
files->append(item);
|
||||
}
|
||||
}
|
||||
@@ -34,6 +36,17 @@ void HashComparer::CompareDeltas(QList<FileData> *serverStreamingHash, QList<Fil
|
||||
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()
|
||||
{
|
||||
|
||||
@@ -42,9 +55,12 @@ void HashComparer::showDeltas()
|
||||
emit sigCallCheck();
|
||||
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();
|
||||
|
||||
@@ -26,7 +26,9 @@ signals:
|
||||
private:
|
||||
UpdateNotifyWidget* updateWidget;
|
||||
QList<FileData> *filesForUpdate;
|
||||
QList<FileData> *serverFiles;
|
||||
VersionContainer *versionContainer;
|
||||
quint32 findIndexByPath(const QList<FileData> &serverStreamingHash, QString path);
|
||||
};
|
||||
|
||||
#endif // HASHCOMPARER_H
|
||||
|
||||
@@ -8,6 +8,7 @@ struct FileData
|
||||
{
|
||||
QString path;
|
||||
QString hash;
|
||||
QString lastUpdate;
|
||||
|
||||
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>
|
||||
<ServerSettings AutoStart="0" Port="6000" Address="192.168.100.134" Language="RUS"/>
|
||||
<VersionData Created="Пн дек 22 15:46:11 2025" isChangable="1" Version="max2"/>
|
||||
<ServerSettings Address="192.168.100.83" Port="6000" Language="RUS" AutoStart="0"/>
|
||||
<VersionData Version="-----" isChangable="0"/>
|
||||
</ServerSettingsContainer>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,2 +1,2 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
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.append("Сервер: ");
|
||||
itemName.append(serverFileData.lastUpdate);
|
||||
itemName.append("Локально: ");
|
||||
itemName.append(localFileData.lastUpdate);
|
||||
ui->updateListWidget->addItem(itemName);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ public:
|
||||
explicit UpdateNotifyWidget(QWidget *parent = nullptr);
|
||||
~UpdateNotifyWidget();
|
||||
void initialize(QPoint startPos);
|
||||
void addToList(FileData fileData);
|
||||
void addToList(FileData localFileData,FileData serverFileData);
|
||||
void showWithFill();
|
||||
void showTryChangeBase();
|
||||
void setVersionContainer(VersionContainer *versionContainer);
|
||||
|
||||
Reference in New Issue
Block a user