feat: change buttonsView

* add buttonsView common(complete)
* add buttonsView instructor(notWorking)
* BUGFIX sendSystem meth update files
* BUGFIX updateController meth checkNeedUpdate
This commit is contained in:
semenov
2024-12-11 17:10:34 +03:00
parent 93705b54fe
commit 077208afdd
80 changed files with 145071 additions and 8038 deletions

View File

@@ -7,17 +7,16 @@ UpdateController::UpdateController(DataParser *parser,SendSystem *sendSystem, QO
{
this->dataParser = parser;
this->sendSystem = sendSystem;
localPath = QDir::currentPath() + applicationFolderName;
calculateStreamingHash();
applicationFolderPath = QDir::currentPath() + applicationFolderName;
//calculateStreamingHash();
}
void UpdateController::calculateCommonHash()
{
fileDataList.clear();
calculateHash(localPath);
calculateHash(applicationFolderPath);
dataParser->createFileDataList(fileDataList,hashFilename);
qDebug() << "UpdateController threadID " << QThread::currentThreadId();
qDebug() << " OR " << thread();
}
void UpdateController::calculateStreamingHash()
@@ -31,17 +30,16 @@ void UpdateController::calculateHash(QString path)
{
qDebug() << "Try calculate";
QDirIterator iterator(path,QDirIterator::Subdirectories);
QDir dir(path);
QDirIterator iterator(dir,QDirIterator::Subdirectories);
fileDataList.clear();
QList<FileData> *files = new QList<FileData>;
QList<FileData> * folders = new QList<FileData>;
QList<FileData> *folders = new QList<FileData>;
if(!QDir(applicationFolderName).exists()){ //проверка на наличие папки
QDir().mkdir(applicationFolderName);
if(!QDir(path).exists()){ //проверка на наличие папки
QDir().mkdir(path);
}
QDir dir(path);
QString hashString;
while (iterator.hasNext())

View File

@@ -38,7 +38,7 @@ signals:
private:
DataParser *dataParser;
SendSystem *sendSystem;
QString localPath;
QString applicationFolderPath;
QList<FileData> fileDataList;
void calculateHash(QString path);

View File

@@ -20,12 +20,25 @@ RecognizeSystem::~RecognizeSystem()
}
void RecognizeSystem::initialize(UpdateController *updateController,DataParser *dataParser,MainWindow *mainWindow)
void RecognizeSystem::initialize(UpdateController *updateController,
DataParser *dataParser,
MainWindow *mainWindow,
HashComparer *hashComparer,
TCPClient *client)
{
this->updateController = updateController;
this->dataParser = dataParser;
this->mainWindow = mainWindow;
connect(this,&RecognizeSystem::sigSaveLoginData,dataParser,&DataParser::createAuthData);
connect(this,&RecognizeSystem::sigStartCompare,hashComparer,&HashComparer::CompareDeltas);
connect(this,&RecognizeSystem::sigUpdateBytesAvailable,mainWindow,&MainWindow::updateProgress,Qt::QueuedConnection);
connect(this,&RecognizeSystem::sigLoadComplete,mainWindow,&MainWindow::loadComplete);
connect(this,&RecognizeSystem::sigNeedUpdate,mainWindow,&MainWindow::setNeedUpdate);
connect(this,&RecognizeSystem::sigSocketDisabled,mainWindow,&MainWindow::lostConnection);
connect(this,&RecognizeSystem::sigSaveLoginData,mainWindow,&MainWindow::checkLoginResult); //TODO: прибратся! 2 бинда на 1 сигнал
connect(this,&RecognizeSystem::sigSocketWaitForReadyRead,client,&TCPClient::waitRead,Qt::DirectConnection);
connect(this,&RecognizeSystem::sigServerBlocked,mainWindow,&MainWindow::serverBlocked);
}
void RecognizeSystem::recognize(QTcpSocket *socket)

View File

@@ -10,6 +10,8 @@
class UpdateController;
class MainWindow;
class HashComparer;
class TCPClient;
class RecognizeSystem : public QObject
{
@@ -19,7 +21,11 @@ class RecognizeSystem : public QObject
public:
explicit RecognizeSystem(QObject *parent = 0);
~RecognizeSystem();
void initialize(UpdateController* updateController,DataParser *dataParser,MainWindow *mainWindow);
void initialize(UpdateController* updateController,
DataParser *dataParser,
MainWindow *mainWindow,
HashComparer *hashComparer,
TCPClient *client);
void recognize(QTcpSocket *socket);
signals:

View File

@@ -18,7 +18,7 @@ void SendSystem::setSocket(QTcpSocket *socket)
}
void SendSystem::sendDisable()
void SendSystem:: sendDisable()
{
QDataStream stream(socket);
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);