mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJClient.git
synced 2026-03-28 05:25:39 +03:00
feat: choosing complete
This commit is contained in:
@@ -124,8 +124,8 @@ QList<FileData> UpdateController::calculateHash(const QString& path,const QStrin
|
||||
return *hashes;
|
||||
}
|
||||
|
||||
void UpdateController::updateFilesOnServer(QList<FileData> *fileSendList){
|
||||
|
||||
void UpdateController::updateFilesOnServer(QList<FileData> *fileSendList)
|
||||
{
|
||||
QListIterator<FileData> serverIterator(*fileSendList);
|
||||
try {
|
||||
|
||||
|
||||
@@ -13,6 +13,9 @@ void HashComparer::initialize(VersionContainer *versionContainer,UpdateNotifyWid
|
||||
this->versionContainer = versionContainer;
|
||||
this->updateWidget = updateWidget;
|
||||
filesForUpdate = new QList<FileData>;
|
||||
|
||||
connect(this,&HashComparer::sigAddToList,updateWidget,&UpdateNotifyWidget::addToList,Qt::QueuedConnection);
|
||||
connect(this,&HashComparer::sigGetUpdateList,updateWidget,&UpdateNotifyWidget::getUpdateList,Qt::DirectConnection);
|
||||
}
|
||||
|
||||
void HashComparer::CompareDeltas(QList<FileData> *serverStreamingHash, QList<FileData> localStreamingHash)
|
||||
@@ -60,7 +63,7 @@ void HashComparer::showDeltas()
|
||||
{
|
||||
FileData local = filesForUpdate->at(i);
|
||||
FileData server = serverFiles->at(i);
|
||||
updateWidget->addToList(local,server);
|
||||
emit sigAddToList(local,server);
|
||||
}
|
||||
|
||||
emit sigHaveDelta();
|
||||
@@ -73,7 +76,7 @@ quint16 HashComparer::getFileUpdateCount() const
|
||||
|
||||
QList<FileData> *HashComparer::getFilesForUpdate() const
|
||||
{
|
||||
QList<FileData> *completeList = filesForUpdate;
|
||||
QList<FileData> *completeList = emit sigGetUpdateList();
|
||||
|
||||
for (int i = 0; i < completeList->count();i++)
|
||||
{
|
||||
@@ -86,5 +89,5 @@ QList<FileData> *HashComparer::getFilesForUpdate() const
|
||||
completeList->replace(i,data);
|
||||
}
|
||||
|
||||
return filesForUpdate;
|
||||
return completeList;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,9 @@ public:
|
||||
signals:
|
||||
void sigCallCheck();
|
||||
void sigHaveDelta();
|
||||
void sigAddToList(FileData local, FileData server);
|
||||
QList<FileData> *sigGetUpdateList() const;
|
||||
|
||||
private:
|
||||
UpdateNotifyWidget* updateWidget;
|
||||
QList<FileData> *filesForUpdate;
|
||||
|
||||
@@ -32,6 +32,7 @@ SOURCES += \
|
||||
Core\tools.cpp\
|
||||
Core\hashcomparer.cpp \
|
||||
UI/resourcemanager.cpp \
|
||||
Widgets/updatefileslot.cpp \
|
||||
Widgets/waitanimationwidget.cpp \
|
||||
Widgets\commonbuttongroupwidget.cpp \
|
||||
Widgets\entrywidget.cpp \
|
||||
@@ -66,6 +67,7 @@ HEADERS += \
|
||||
Data\FileData.h\
|
||||
Data\Datas.h \
|
||||
UI/resourcemanager.h \
|
||||
Widgets/updatefileslot.h \
|
||||
Widgets/waitanimationwidget.h \
|
||||
Widgets\commonbuttongroupwidget.h \
|
||||
Widgets\entrywidget.h \
|
||||
@@ -78,6 +80,7 @@ HEADERS += \
|
||||
widgetmanager.h
|
||||
|
||||
FORMS += \
|
||||
Widgets/updatefileslot.ui \
|
||||
Widgets/waitanimationwidget.ui \
|
||||
Widgets\commonbuttongroupwidget.ui \
|
||||
Widgets\entrywidget.ui \
|
||||
|
||||
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"?>
|
||||
<ServerSettingsContainer>
|
||||
<ServerSettings Address="192.168.100.83" Port="6000" Language="RUS" AutoStart="0"/>
|
||||
<VersionData Version="-----" isChangable="0"/>
|
||||
<VersionData Version="customND" isChangable="1"/>
|
||||
</ServerSettingsContainer>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
74
Widgets/updatefileslot.cpp
Normal file
74
Widgets/updatefileslot.cpp
Normal file
@@ -0,0 +1,74 @@
|
||||
#include "updatefileslot.h"
|
||||
#include "ui_updatefileslot.h"
|
||||
|
||||
#include <QDateTime>
|
||||
|
||||
UpdateFileSlot::UpdateFileSlot(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::UpdateFileSlot),
|
||||
needUpdate(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
void UpdateFileSlot::fill(QString itemName, FileData serverData, FileData localData)
|
||||
{
|
||||
ui->Path->setText(itemName);
|
||||
local = localData;
|
||||
|
||||
QString result = " Сервер: ";
|
||||
QDateTime serverFileTime = QDateTime::fromString(serverData.lastUpdate,"dd.MM.yyyy hh:mm:ss");
|
||||
QDateTime localFileTime = QDateTime::fromString(localData.lastUpdate,"dd.MM.yyyy hh:mm:ss");
|
||||
result.append(serverFileTime.toString("dd.MM.yyyy"));
|
||||
result.append(" Локально: ");
|
||||
result.append(localFileTime.toString("dd.MM.yyyy"));
|
||||
ui->Dates->setText(result);
|
||||
|
||||
bool newest = localFileTime > serverFileTime;
|
||||
|
||||
ui->UpdateCheckBox->setChecked(newest);
|
||||
QPixmap pixmap;
|
||||
if (newest)
|
||||
{
|
||||
pixmap.load(":/resource/Icons/new.png");
|
||||
}
|
||||
else
|
||||
{
|
||||
pixmap.load(nullptr);
|
||||
}
|
||||
|
||||
QPixmap scaled = pixmap.scaled(ui->Image->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
ui->Image->setPixmap(scaled);
|
||||
}
|
||||
|
||||
UpdateFileSlot::~UpdateFileSlot()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
FileData UpdateFileSlot::getLocal() const
|
||||
{
|
||||
return local;
|
||||
}
|
||||
|
||||
bool UpdateFileSlot::getNeedUpdate() const
|
||||
{
|
||||
return needUpdate;
|
||||
}
|
||||
|
||||
void UpdateFileSlot::setNeedUpdate(bool value)
|
||||
{
|
||||
needUpdate = value;
|
||||
}
|
||||
|
||||
void UpdateFileSlot::on_UpdateCheckBox_stateChanged(int arg1)
|
||||
{
|
||||
if (ui->UpdateCheckBox->checkState() == Qt::Checked)
|
||||
{
|
||||
needUpdate = true;
|
||||
}
|
||||
else if (ui->UpdateCheckBox->checkState() == Qt::Unchecked)
|
||||
{
|
||||
needUpdate = false;
|
||||
}
|
||||
}
|
||||
36
Widgets/updatefileslot.h
Normal file
36
Widgets/updatefileslot.h
Normal file
@@ -0,0 +1,36 @@
|
||||
#ifndef UPDATEFILESLOT_H
|
||||
#define UPDATEFILESLOT_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include <Data/FileData.h>
|
||||
|
||||
namespace Ui {
|
||||
class UpdateFileSlot;
|
||||
}
|
||||
|
||||
class UpdateFileSlot : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit UpdateFileSlot(QWidget *parent = nullptr);
|
||||
void fill(QString itemName, FileData serverData, FileData localData);
|
||||
|
||||
bool getNeedUpdate() const;
|
||||
void setNeedUpdate(bool value);
|
||||
FileData getLocal() const;
|
||||
|
||||
~UpdateFileSlot();
|
||||
|
||||
|
||||
private slots:
|
||||
void on_UpdateCheckBox_stateChanged(int arg1);
|
||||
|
||||
private:
|
||||
Ui::UpdateFileSlot *ui;
|
||||
FileData local;
|
||||
bool needUpdate;
|
||||
};
|
||||
|
||||
#endif // UPDATEFILESLOT_H
|
||||
79
Widgets/updatefileslot.ui
Normal file
79
Widgets/updatefileslot.ui
Normal file
@@ -0,0 +1,79 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>UpdateFileSlot</class>
|
||||
<widget class="QWidget" name="UpdateFileSlot">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>789</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Frame</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="horizontalLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>0</y>
|
||||
<width>721</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="mainLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="Path">
|
||||
<property name="text">
|
||||
<string>/RUS/Scens/XXX-X-XX-XX-XX-XXXXXX-XXXX-X</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="Dates">
|
||||
<property name="text">
|
||||
<string>XXXXXXX XXxXXxXXX XXXXXXXXx XXxXXxXXXX</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QLabel" name="Image">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>755</x>
|
||||
<y>5</y>
|
||||
<width>31</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../resources.qrc">:/resource/Icons/checked.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="UpdateCheckBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>6</x>
|
||||
<y>10</y>
|
||||
<width>21</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../resources.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -32,11 +32,14 @@ void UpdateNotifyWidget::addToList(FileData localFileData,FileData serverFileDat
|
||||
{
|
||||
QString itemName = localFileData.path;
|
||||
itemName = itemName.remove(streamingAssetsPath);
|
||||
itemName.append("Сервер: ");
|
||||
itemName.append(serverFileData.lastUpdate);
|
||||
itemName.append("Локально: ");
|
||||
itemName.append(localFileData.lastUpdate);
|
||||
ui->updateListWidget->addItem(itemName);
|
||||
UpdateFileSlot *slot = new UpdateFileSlot();
|
||||
QListWidgetItem *widgetItem = new QListWidgetItem();
|
||||
|
||||
widgetItem->setSizeHint(QSize(slot->width(),slot->height()));
|
||||
ui->updateListWidget->addItem(widgetItem);
|
||||
ui->updateListWidget->setItemWidget(widgetItem,slot);
|
||||
|
||||
slot->fill(itemName,serverFileData,localFileData);
|
||||
}
|
||||
|
||||
void UpdateNotifyWidget::showTryChangeBase()
|
||||
@@ -128,6 +131,24 @@ void UpdateNotifyWidget::closeWindow()
|
||||
on_closeButton_clicked();
|
||||
}
|
||||
|
||||
QList<FileData> *UpdateNotifyWidget::getUpdateList()
|
||||
{
|
||||
QList<FileData> *realUpdateList = new QList<FileData>();
|
||||
|
||||
for (int i = 0; i < ui->updateListWidget->count(); i++) {
|
||||
QListWidgetItem *item = ui->updateListWidget->item(i);
|
||||
UpdateFileSlot *slot = qobject_cast<UpdateFileSlot*>(ui->updateListWidget->itemWidget(item));
|
||||
|
||||
if (slot && slot->getNeedUpdate())
|
||||
{
|
||||
realUpdateList->append(slot->getLocal());
|
||||
}
|
||||
}
|
||||
|
||||
return realUpdateList;
|
||||
|
||||
}
|
||||
|
||||
void UpdateNotifyWidget::setUpdateState()
|
||||
{
|
||||
ui->undoChangesButton->show();
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <Data/FileData.h>
|
||||
#include <Core/versioncontainer.h>
|
||||
#include <Widgets/updatefileslot.h>
|
||||
|
||||
namespace Ui {
|
||||
class UpdateNotifyWidget;
|
||||
@@ -26,6 +27,7 @@ public:
|
||||
void showTryChangeBase();
|
||||
void setVersionContainer(VersionContainer *versionContainer);
|
||||
void closeWindow();
|
||||
QList<FileData> *getUpdateList();
|
||||
signals:
|
||||
void sigLoadToServerBehaviour();
|
||||
void sigUndoCurrentChanges();
|
||||
|
||||
@@ -12,6 +12,7 @@ void Bootstrap::initialize()
|
||||
{
|
||||
qRegisterMetaType<PacketType>("PacketType");
|
||||
qRegisterMetaType<ErrorsEnum>("ErrorsEnum");
|
||||
qRegisterMetaType<FileData>("FileData");
|
||||
|
||||
widgetManager->initialize();
|
||||
coreManager->initialize(widgetManager, workerThread);
|
||||
|
||||
@@ -151,7 +151,7 @@ void CoreManager::initializeWidgets()
|
||||
|
||||
connect(widgetManager->getMainWindow(),&MainWindow::sigChangeLanguage,this,&CoreManager::setLanguage,Qt::AutoConnection);
|
||||
connect(widgetManager->getMainWindow(),&MainWindow::sigShowUpdateInfo,this,&CoreManager::checkUpdateInfo,Qt::AutoConnection);
|
||||
connect(widgetManager->getMainWindow(),&MainWindow::sigExit,this,&CoreManager::exit,Qt::AutoConnection);
|
||||
connect(widgetManager->getMainWindow(),&MainWindow::sigExit,this,&CoreManager::exit,Qt::DirectConnection);
|
||||
connect(widgetManager->getMainWindow(),&MainWindow::sigTryLogin,this,&CoreManager::tryLogin,Qt::AutoConnection);
|
||||
connect(widgetManager->getMainWindow(),&MainWindow::sigStartOffline,this,&CoreManager::startOffline,Qt::AutoConnection);
|
||||
|
||||
|
||||
BIN
resource/Icons/new.png
Normal file
BIN
resource/Icons/new.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1017 B |
@@ -17,5 +17,6 @@
|
||||
<file>resource/Icons/caution.png</file>
|
||||
<file>resource/Icons/close.png</file>
|
||||
<file>resource/Icons/planeCustom.png</file>
|
||||
<file>resource/Icons/new.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
Reference in New Issue
Block a user