mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJClient.git
synced 2026-03-28 05:25:39 +03:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
38dda10685 | ||
|
|
eb70ed9a6e | ||
|
|
4edfae5740 | ||
|
|
1d76e9785b |
@@ -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 {
|
||||
|
||||
|
||||
@@ -189,13 +189,10 @@ bool DataParser::xmlParser(const QByteArray& array)
|
||||
if (name == "AccessType")
|
||||
{
|
||||
serverAuth->AccessType = value;
|
||||
postProcessSystem->checkAccessType(value);
|
||||
//recognizeSystem->checkAccessType(value);
|
||||
}
|
||||
}
|
||||
|
||||
postProcessSystem->saveLoginData(serverAuth);
|
||||
//emit recognizeSystem->sigSaveLoginData(serverAuth);
|
||||
}
|
||||
|
||||
if(xmlReader.name() == "VersionData")
|
||||
@@ -259,6 +256,7 @@ bool DataParser::xmlParser(const QByteArray& array)
|
||||
|
||||
xmlReader.readNext();
|
||||
}
|
||||
emit postProcessSystem->sigCallUpdateList();
|
||||
}
|
||||
|
||||
xmlReader.readNext();
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
void ExternalExecuter::callApp()
|
||||
{
|
||||
QProcess *myProcess = new QProcess(this);
|
||||
QStringList args;
|
||||
args << "1";
|
||||
QStringList args = QCoreApplication::arguments();
|
||||
args.removeFirst();
|
||||
|
||||
myProcess->start(programPath,args);
|
||||
myProcess->waitForStarted();
|
||||
@@ -21,10 +21,11 @@ bool ExternalExecuter::findApp()
|
||||
|
||||
if(iterator.fileInfo().fileName() == applicationEXEName){
|
||||
programPath = iterator.fileInfo().absoluteFilePath();
|
||||
isAvailable = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
isAvailable = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -37,3 +38,8 @@ void ExternalExecuter::setIsAutoStart(bool value)
|
||||
{
|
||||
isAutoStart = value;
|
||||
}
|
||||
|
||||
bool ExternalExecuter::getIsAvailable() const
|
||||
{
|
||||
return isAvailable;
|
||||
}
|
||||
|
||||
@@ -23,9 +23,12 @@ public:
|
||||
bool getIsAutoStart() const;
|
||||
void setIsAutoStart(bool value);
|
||||
|
||||
bool getIsAvailable() const;
|
||||
|
||||
private:
|
||||
QString programPath;
|
||||
bool isAutoStart;
|
||||
bool isAvailable;
|
||||
};
|
||||
|
||||
#endif // EXTERNALEXECUTER_H
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -13,12 +13,15 @@ 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)
|
||||
{
|
||||
QList<FileData> *files = new QList<FileData>;
|
||||
|
||||
serverFiles = new QList<FileData>;
|
||||
QMutableListIterator<FileData> iterator(localStreamingHash);
|
||||
|
||||
for (auto &item:localStreamingHash)
|
||||
@@ -26,6 +29,13 @@ void HashComparer::CompareDeltas(QList<FileData> *serverStreamingHash, QList<Fil
|
||||
if(!serverStreamingHash->contains(item))
|
||||
{
|
||||
if (item.path.contains("docs.xml")) continue; //фильтр на docs
|
||||
if (item.path.contains("CfiList.xml")) continue;
|
||||
|
||||
qint32 fileDataIndex = findIndexByPath(*serverStreamingHash, item.path);
|
||||
if (fileDataIndex != -1)
|
||||
{
|
||||
serverFiles->append(serverStreamingHash->at(fileDataIndex));
|
||||
}
|
||||
files->append(item);
|
||||
}
|
||||
}
|
||||
@@ -34,6 +44,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 +63,19 @@ 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 = FileData();
|
||||
server.lastUpdate = "нет";
|
||||
|
||||
if (serverFiles->size() > i)
|
||||
{
|
||||
server = serverFiles->at(i);
|
||||
}
|
||||
|
||||
emit sigAddToList(local,server);
|
||||
}
|
||||
|
||||
emit sigHaveDelta();
|
||||
@@ -57,7 +88,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++)
|
||||
{
|
||||
@@ -70,5 +101,5 @@ QList<FileData> *HashComparer::getFilesForUpdate() const
|
||||
completeList->replace(i,data);
|
||||
}
|
||||
|
||||
return filesForUpdate;
|
||||
return completeList;
|
||||
}
|
||||
|
||||
@@ -23,10 +23,15 @@ public:
|
||||
signals:
|
||||
void sigCallCheck();
|
||||
void sigHaveDelta();
|
||||
void sigAddToList(FileData local, FileData server);
|
||||
QList<FileData> *sigGetUpdateList() const;
|
||||
|
||||
private:
|
||||
UpdateNotifyWidget* updateWidget;
|
||||
QList<FileData> *filesForUpdate;
|
||||
QList<FileData> *serverFiles;
|
||||
VersionContainer *versionContainer;
|
||||
quint32 findIndexByPath(const QList<FileData> &serverStreamingHash, QString path);
|
||||
};
|
||||
|
||||
#endif // HASHCOMPARER_H
|
||||
|
||||
@@ -69,14 +69,6 @@ void PostProcessorSystem::compareFiles()
|
||||
updateController->updateFilesOnServer(hashComparer->getFilesForUpdate());
|
||||
}
|
||||
|
||||
void PostProcessorSystem::checkAccessType(const QString& type)
|
||||
{
|
||||
if(type == "instructor")
|
||||
{
|
||||
emit sigCallUpdateList();
|
||||
}
|
||||
}
|
||||
|
||||
void PostProcessorSystem::saveLoginData(ServerAuthorization *auth)
|
||||
{
|
||||
emit sigSaveLoginData(auth);
|
||||
|
||||
@@ -21,7 +21,6 @@ public:
|
||||
void serverBlocked();
|
||||
void startCompare();
|
||||
void compareFiles();
|
||||
void checkAccessType(const QString& type);
|
||||
void saveLoginData(ServerAuthorization *auth);
|
||||
void setServerVersion(StreamingVersionData *serverVersion);
|
||||
void calculateCommonHash();
|
||||
|
||||
@@ -38,7 +38,7 @@ signals:
|
||||
void sigSendPacketType(PacketType packetType);
|
||||
void sigSendPacketTypeWithDelay(PacketType packetType,int delay);
|
||||
void sigSendToInlineLog(QString message);
|
||||
void sigCallUpdateList();
|
||||
//void sigCallUpdateList();
|
||||
|
||||
private:
|
||||
VersionContainer *versionContainer;
|
||||
|
||||
@@ -8,6 +8,7 @@ struct FileData
|
||||
{
|
||||
QString path;
|
||||
QString hash;
|
||||
QString lastUpdate;
|
||||
|
||||
bool operator==(const FileData& other)const
|
||||
{
|
||||
|
||||
@@ -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 \
|
||||
|
||||
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="I3" Password="2be9bd7a3434f7038ca27d1918de58bd" 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'?>
|
||||
<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 Port="6000" Address="192.168.100.83" Language="RUS" AutoStart="0"/>
|
||||
<VersionData Version="customND" isChangable="1" Created="Пт мар 6 10:49:55 2026"/>
|
||||
</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="GETSERVERDATALIST"/>
|
||||
|
||||
@@ -14,8 +14,10 @@ void CommonButtonGroupWidget::initialize()
|
||||
ui->loadingProgressBar->hide();
|
||||
ui->updateButton->hide();
|
||||
ui->startButton->hide();
|
||||
ui->startButton->setEnabled(false);
|
||||
ui->startButton->setEnabled(false);
|
||||
ui->offlineStartButton->hide();
|
||||
show();
|
||||
down = ui->downlayout;
|
||||
}
|
||||
|
||||
void CommonButtonGroupWidget::updateProgressBar(float value)
|
||||
@@ -23,13 +25,19 @@ void CommonButtonGroupWidget::updateProgressBar(float value)
|
||||
ui->loadingProgressBar->setValue(value);
|
||||
}
|
||||
|
||||
QHBoxLayout *CommonButtonGroupWidget::getDown() const
|
||||
{
|
||||
return down;
|
||||
}
|
||||
|
||||
void CommonButtonGroupWidget::loadCompleteState()
|
||||
{
|
||||
show();
|
||||
ui->updateButton->hide();
|
||||
ui->startButton->setEnabled(true);
|
||||
ui->loadingProgressBar->setValue(100);
|
||||
ui->startButton->show();
|
||||
ui->offlineStartButton->show();
|
||||
ui->loadingProgressBar->setValue(100);
|
||||
ui->loadingProgressBar->hide();
|
||||
}
|
||||
|
||||
@@ -39,7 +47,9 @@ void CommonButtonGroupWidget::lastVerInstalledState()
|
||||
ui->updateButton->hide();
|
||||
ui->loadingProgressBar->hide();
|
||||
ui->startButton->setEnabled(true);
|
||||
hideSpacer(true);
|
||||
ui->startButton->show();
|
||||
ui->offlineStartButton->show();
|
||||
}
|
||||
|
||||
void CommonButtonGroupWidget::disconnectState()
|
||||
@@ -48,16 +58,32 @@ void CommonButtonGroupWidget::disconnectState()
|
||||
ui->loadingProgressBar->hide();
|
||||
ui->updateButton->hide();
|
||||
ui->updateButton->setEnabled(false);
|
||||
ui->offlineStartButton->hide();
|
||||
hideSpacer(false);
|
||||
}
|
||||
|
||||
void CommonButtonGroupWidget::startUpdateState()
|
||||
{
|
||||
ui->updateButton->hide();
|
||||
ui->startButton->hide();
|
||||
ui->offlineStartButton->hide();
|
||||
ui->loadingProgressBar->setValue(0);
|
||||
ui->loadingProgressBar->show();
|
||||
}
|
||||
|
||||
void CommonButtonGroupWidget::loginState()
|
||||
{
|
||||
bool isAvailable = emit sigAppAvailable();
|
||||
if (isAvailable)
|
||||
{
|
||||
ui->offlineStartButton->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->offlineStartButton->hide();
|
||||
}
|
||||
}
|
||||
|
||||
void CommonButtonGroupWidget::showProgressBar(bool flag)
|
||||
{
|
||||
if (flag) ui->loadingProgressBar->show();
|
||||
@@ -67,6 +93,7 @@ void CommonButtonGroupWidget::showProgressBar(bool flag)
|
||||
void CommonButtonGroupWidget::needUpdateState(bool flag)
|
||||
{
|
||||
show();
|
||||
hideSpacer(true);
|
||||
ui->loadingProgressBar->hide();
|
||||
ui->startButton->hide();
|
||||
ui->updateButton->setEnabled(flag);
|
||||
@@ -75,6 +102,9 @@ void CommonButtonGroupWidget::needUpdateState(bool flag)
|
||||
|
||||
void CommonButtonGroupWidget::startButtonActive(bool flag)
|
||||
{
|
||||
if(flag) ui->offlineStartButton->show();
|
||||
else ui->offlineStartButton->hide();
|
||||
|
||||
ui->startButton->setEnabled(flag);
|
||||
}
|
||||
|
||||
@@ -96,6 +126,13 @@ CommonButtonGroupWidget::~CommonButtonGroupWidget()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void CommonButtonGroupWidget::hideSpacer(bool flag)
|
||||
{
|
||||
if(flag) ui->horizontalSpacer->changeSize(0,0,QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||
else ui->horizontalSpacer->changeSize(40,20,QSizePolicy::Expanding,QSizePolicy::Minimum);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CommonButtonGroupWidget::on_offlineStartButton_clicked()
|
||||
{
|
||||
emit sigStartOfflineUnityClient();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef COMMONBUTTONGROUPWIDGET_H
|
||||
#define COMMONBUTTONGROUPWIDGET_H
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QWidget>
|
||||
#include <Core/tcpclient.h>
|
||||
|
||||
@@ -20,6 +21,7 @@ public:
|
||||
void lastVerInstalledState();
|
||||
void disconnectState();
|
||||
void startUpdateState();
|
||||
void loginState();
|
||||
void showProgressBar(bool flag);
|
||||
void needUpdateState(bool flag);
|
||||
void startButtonActive(bool flag);
|
||||
@@ -28,16 +30,22 @@ signals:
|
||||
void sigSendPacket(PacketType packet);
|
||||
void sigUpdateCommonWidget();
|
||||
void sigStartUnityClient();
|
||||
void sigStartOfflineUnityClient();
|
||||
bool sigAppAvailable();
|
||||
|
||||
private slots:
|
||||
void on_updateButton_clicked();
|
||||
void on_startButton_clicked();
|
||||
void on_offlineStartButton_clicked();
|
||||
|
||||
public:
|
||||
void updateProgressBar(float value);
|
||||
QHBoxLayout *getDown() const;
|
||||
|
||||
private:
|
||||
Ui::CommonButtonGroupWidget *ui;
|
||||
QHBoxLayout *down;
|
||||
void hideSpacer(bool flag);
|
||||
};
|
||||
|
||||
#endif // COMMONBUTTONGROUPWIDGET_H
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>520</width>
|
||||
<width>763</width>
|
||||
<height>45</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@@ -30,12 +30,12 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>520</width>
|
||||
<width>761</width>
|
||||
<height>45</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@@ -99,14 +99,14 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<width>500</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
@@ -143,7 +143,7 @@
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<width>500</width>
|
||||
<height>35</height>
|
||||
</size>
|
||||
</property>
|
||||
@@ -158,6 +158,47 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="offlineStartButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>250</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeIncrement">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Запуск в автономном режиме</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
|
||||
EntryWidget::EntryWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::EntryWidget)
|
||||
ui(new Ui::EntryWidget),
|
||||
isAppAvailable(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
@@ -22,6 +23,7 @@ void EntryWidget::initialize()
|
||||
void EntryWidget::disconnectState()
|
||||
{
|
||||
show();
|
||||
setAppAvailable(emit sigAppAvalable());
|
||||
ui->offlineWidget->show();
|
||||
ui->loginWidget->hide();
|
||||
}
|
||||
@@ -69,7 +71,6 @@ void EntryWidget::fillSettings(Settings *settings)
|
||||
{
|
||||
ui->serverInputField->setText(settings->Address);
|
||||
ui->portInputField->setText(settings->Port);
|
||||
//ui->mathModelUsecheckBox->setChecked(settings->mathModelUse);
|
||||
}
|
||||
|
||||
void EntryWidget::isActive(bool flag)
|
||||
@@ -83,6 +84,22 @@ bool EntryWidget::getLoginWidgetIsHidden()
|
||||
return ui->loginWidget->isHidden();
|
||||
}
|
||||
|
||||
void EntryWidget::setAppAvailable(bool flag)
|
||||
{
|
||||
isAppAvailable = flag;
|
||||
|
||||
if (flag)
|
||||
{
|
||||
QString text = tr("Связь с сервером не установлена! Проверьте настройки или запустите в автономном режиме");
|
||||
ui->offlineNotifyLabel->setText(text);
|
||||
}
|
||||
else
|
||||
{
|
||||
QString text = tr("Связь с сервером не установлена! Проверьте настройки подключения и загрузите клиент с сервера");
|
||||
ui->offlineNotifyLabel->setText(text);
|
||||
}
|
||||
}
|
||||
|
||||
QString EntryWidget::getAddress(){
|
||||
return ui->serverInputField->text();
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ public:
|
||||
void fillSettings(Settings *settings);
|
||||
void isActive(bool flag);
|
||||
bool getLoginWidgetIsHidden();
|
||||
void setAppAvailable(bool flag);
|
||||
ClientAutorization* getAuthData();
|
||||
|
||||
QString getAddress();
|
||||
@@ -30,6 +31,7 @@ public:
|
||||
signals:
|
||||
void sigTryLogin();
|
||||
void sigSaveServerSettings();
|
||||
bool sigAppAvalable();
|
||||
|
||||
private slots:
|
||||
void on_loginButton_clicked();
|
||||
@@ -37,6 +39,7 @@ private slots:
|
||||
|
||||
private:
|
||||
Ui::EntryWidget *ui;
|
||||
bool isAppAvailable;
|
||||
};
|
||||
|
||||
#endif // ENTRYWIDGET_H
|
||||
|
||||
@@ -351,7 +351,7 @@
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Связь с сервером не установлена! Проверьте настройки или запустите в автономном режиме</string>
|
||||
<string>тест</string>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
|
||||
87
Widgets/updatefileslot.cpp
Normal file
87
Widgets/updatefileslot.cpp
Normal file
@@ -0,0 +1,87 @@
|
||||
#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;
|
||||
|
||||
bool haveData = serverData.lastUpdate != "нет";
|
||||
|
||||
QString result = " Сервер: ";
|
||||
|
||||
QDateTime serverFileTime;
|
||||
if (haveData)
|
||||
{
|
||||
serverFileTime = QDateTime::fromString(serverData.lastUpdate,"dd.MM.yyyy hh:mm:ss");
|
||||
result.append(serverFileTime.toString("dd.MM.yyyy"));
|
||||
}
|
||||
else
|
||||
{
|
||||
result.append("НЕТ");
|
||||
}
|
||||
|
||||
QDateTime localFileTime = QDateTime::fromString(localData.lastUpdate,"dd.MM.yyyy hh:mm:ss");
|
||||
|
||||
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>701</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>735</x>
|
||||
<y>-4</y>
|
||||
<width>51</width>
|
||||
<height>51</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../resources.qrc">:/resource/Icons/new.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>
|
||||
@@ -28,11 +28,18 @@ 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);
|
||||
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()
|
||||
@@ -124,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;
|
||||
@@ -21,11 +22,12 @@ 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);
|
||||
void closeWindow();
|
||||
QList<FileData> *getUpdateList();
|
||||
signals:
|
||||
void sigLoadToServerBehaviour();
|
||||
void sigUndoCurrentChanges();
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Обнаружены новые файлы:</string>
|
||||
<string>Обнаружены новые или измененные файлы:</string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>false</bool>
|
||||
|
||||
@@ -12,6 +12,7 @@ void Bootstrap::initialize()
|
||||
{
|
||||
qRegisterMetaType<PacketType>("PacketType");
|
||||
qRegisterMetaType<ErrorsEnum>("ErrorsEnum");
|
||||
qRegisterMetaType<FileData>("FileData");
|
||||
|
||||
widgetManager->initialize();
|
||||
coreManager->initialize(widgetManager, workerThread);
|
||||
|
||||
@@ -47,7 +47,7 @@ void CoreManager::initialize(WidgetManager *widgetManager,QThread *workerThread)
|
||||
|
||||
void CoreManager::start()
|
||||
{
|
||||
checkAppAvailable();
|
||||
//checkAppAvailable();
|
||||
}
|
||||
|
||||
void CoreManager::loadStaticData()
|
||||
@@ -56,8 +56,6 @@ void CoreManager::loadStaticData()
|
||||
setLanguage(settings->Language);
|
||||
setLocalVersion();
|
||||
externalExecuter->setIsAutoStart(settings->isAutoStart);
|
||||
bool appAvailable = externalExecuter->findApp();
|
||||
widgetManager->setAppAvailable(appAvailable);
|
||||
emit sigSetLoadSettings(settings);
|
||||
}
|
||||
|
||||
@@ -94,7 +92,6 @@ void CoreManager::binding()
|
||||
connect(recognizeSystem,&RecognizeSystem::sigSendPacketType,this,&CoreManager::sendPacketType,Qt::AutoConnection);
|
||||
connect(recognizeSystem,&RecognizeSystem::sigSendPacketTypeWithDelay,sendSystem,&SendSystem::sendPacketTypeWithDelay,Qt::AutoConnection);
|
||||
connect(recognizeSystem,&RecognizeSystem::sigSendToInlineLog,this,&CoreManager::setInlineDebug,Qt::AutoConnection);
|
||||
connect(recognizeSystem,&RecognizeSystem::sigCallUpdateList,this,&CoreManager::callUpdateList,Qt::AutoConnection);
|
||||
|
||||
connect(hashComparer,&HashComparer::sigCallCheck,this,&CoreManager::checkUpdate);
|
||||
connect(hashComparer,&HashComparer::sigHaveDelta,this,&CoreManager::checkUpdateInfo);
|
||||
@@ -106,9 +103,12 @@ void CoreManager::binding()
|
||||
connect(tcpClient,&TCPClient::sigServerDisconnect,widgetManager,&WidgetManager::setServerDisconnectState,Qt::AutoConnection);
|
||||
|
||||
connect(sendSystem,&SendSystem::sigSend,this,&CoreManager::calcUpdateProgress,Qt::AutoConnection);
|
||||
|
||||
connect(sendSystem,&SendSystem::sigGetXmlAnswer,dataParserOutput,&DataParserOutput::xmlAnswer_notify,Qt::DirectConnection);
|
||||
|
||||
connect(widgetManager->getEntryWidget(),&EntryWidget::sigAppAvalable,externalExecuter,&ExternalExecuter::findApp,Qt::DirectConnection);
|
||||
connect(widgetManager->getMainWindow(),&MainWindow::sigAppAvailable,externalExecuter,&ExternalExecuter::findApp,Qt::DirectConnection);
|
||||
connect(widgetManager->getCommonButtonGroupWidget(),&CommonButtonGroupWidget::sigAppAvailable,externalExecuter,&ExternalExecuter::findApp,Qt::DirectConnection);
|
||||
connect(widgetManager,&WidgetManager::sigAppAvailable,externalExecuter,&ExternalExecuter::findApp,Qt::DirectConnection);
|
||||
}
|
||||
|
||||
void CoreManager::initializeSystems()
|
||||
@@ -151,9 +151,10 @@ 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);
|
||||
connect(widgetManager->getCommonButtonGroupWidget(),&CommonButtonGroupWidget::sigStartOfflineUnityClient,this,&CoreManager::startOffline,Qt::AutoConnection);
|
||||
|
||||
}
|
||||
|
||||
@@ -254,11 +255,11 @@ void CoreManager::setInlineDebug(QString text)
|
||||
|
||||
void CoreManager::checkAccessType(const QString& accessType)
|
||||
{
|
||||
if (accessType == traineeTypeName)
|
||||
if (accessType == traineeTypeName)//если обучаемый вызываем обновление
|
||||
{
|
||||
checkUpdate();
|
||||
}
|
||||
else
|
||||
else //если инструктор запрашивание версионирование
|
||||
{
|
||||
emit sigSendXMLAnswer(cmd_CheckVersionList);
|
||||
}
|
||||
@@ -345,8 +346,6 @@ void CoreManager::undoCurrentChanges()
|
||||
isRecovery = true;
|
||||
widgetManager->setUndoCurrentChangesState();
|
||||
emit sigSendCheckUpdate();
|
||||
//emit sigSendPacketType(PacketType::TYPE_UPDATE);
|
||||
//тут был таймер
|
||||
isRecovery = false;
|
||||
}
|
||||
|
||||
@@ -380,7 +379,6 @@ void CoreManager::saveServerSettingsWithConnect()
|
||||
emit sigSendXMLAnswer(cmd_Disable);
|
||||
tcpClient->setDisconnect();
|
||||
entryWidget->showLoginWidget(true);
|
||||
widgetManager->getMainWindow()->showOfflineButton(true);
|
||||
widgetManager->activateLoadingAnimation(false);
|
||||
}
|
||||
|
||||
@@ -392,12 +390,6 @@ void CoreManager::createNewServerSettings()
|
||||
dataParserOutput->createServerSettings();
|
||||
}
|
||||
|
||||
void CoreManager::checkAppAvailable()
|
||||
{
|
||||
bool isAvailable = externalExecuter->findApp();
|
||||
widgetManager->setAppAvailable(isAvailable);
|
||||
}
|
||||
|
||||
void CoreManager::setLanguage(const QString& language)
|
||||
{
|
||||
if (language == "RUS")
|
||||
|
||||
@@ -43,9 +43,6 @@ public:
|
||||
void sendPacketType(PacketType packetType);
|
||||
|
||||
void saveServerSettingsWithConnect();
|
||||
|
||||
|
||||
void checkAppAvailable();
|
||||
void exit();
|
||||
void initializeWidgets();
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent),
|
||||
ui(new Ui::MainWindow),
|
||||
bottomRightPosition(QRect(530,506,250,40)),
|
||||
offlinePosition(240,340,300,40)
|
||||
offlinePosition(240,350,300,40)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setAttribute(Qt::WA_TranslucentBackground);
|
||||
@@ -44,7 +44,8 @@ void MainWindow::initialize(ResourceManager *resourceManager)
|
||||
bindConnection();
|
||||
this->resourceManager = resourceManager;
|
||||
ui->LanguageWidget->hide();
|
||||
|
||||
ui->offlineStartButton->setGeometry(offlinePosition);
|
||||
ui->offlineStartButton->hide();
|
||||
}
|
||||
|
||||
void MainWindow::setStartState()
|
||||
@@ -74,9 +75,7 @@ void MainWindow::bindConnection()
|
||||
void MainWindow::loadCompleteState()
|
||||
{
|
||||
ui->inlineTextDebug->setText(tr("Обновление завершено"));
|
||||
ui->offlineStartButton->setEnabled(true);
|
||||
ui->autostartCheckBox->hide();
|
||||
ui->offlineStartButton->show();
|
||||
}
|
||||
|
||||
bool MainWindow::getIsAutoStart()
|
||||
@@ -133,15 +132,9 @@ void MainWindow::serverNotifyShow(QString text, int durationMS)
|
||||
void MainWindow::setLoginSuccessState()
|
||||
{
|
||||
ui->settingsButton->hide();
|
||||
ui->offlineStartButton->show();
|
||||
ui->versionLayoutWidget->show();
|
||||
}
|
||||
|
||||
void MainWindow::setStartOfflineButton(bool isAvailable)
|
||||
{
|
||||
ui->offlineStartButton->setEnabled(isAvailable);
|
||||
}
|
||||
|
||||
void MainWindow::setClientVersionName(const QString& versionName)
|
||||
{
|
||||
ui->valueClientVersion->setText(versionName);
|
||||
@@ -153,9 +146,7 @@ void MainWindow::showConnectionEmpty()
|
||||
QPalette palette = ui->notificationLabel->palette();
|
||||
palette.setColor(ui->notificationLabel->foregroundRole(),Qt::red);
|
||||
ui->notificationLabel->setText(tr("Соединение отсутсвует"));
|
||||
ui->offlineStartButton->show();
|
||||
ui->offlineStartButton->setGeometry(offlinePosition);
|
||||
ui->offlineStartButton->raise();
|
||||
|
||||
ui->settingsButton->show();
|
||||
ui->unsafeChangingButton->hide();
|
||||
}
|
||||
@@ -178,9 +169,6 @@ void MainWindow::slotConnectionState(bool flag)
|
||||
{
|
||||
palette.setColor(ui->notificationLabel->foregroundRole(),Qt::green);
|
||||
ui->notificationLabel->setText(tr("Соединение установлено"));
|
||||
|
||||
ui->offlineStartButton->show();
|
||||
ui->offlineStartButton->setGeometry(bottomRightPosition);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -193,11 +181,19 @@ void MainWindow::slotConnectionState(bool flag)
|
||||
|
||||
void MainWindow::slotServerDisconnect()
|
||||
{
|
||||
checkApp();
|
||||
ui->autostartCheckBox->hide();
|
||||
ui->inlineTextDebug->setText("");
|
||||
slotConnectionState(false);
|
||||
}
|
||||
|
||||
void MainWindow::checkApp()
|
||||
{
|
||||
bool isAvailable = emit sigAppAvailable();
|
||||
if (isAvailable) ui->offlineStartButton->show();
|
||||
else ui->offlineStartButton->hide();
|
||||
}
|
||||
|
||||
void MainWindow::slotDisableNotify()
|
||||
{
|
||||
ui->notificationLabel->hide();
|
||||
@@ -209,14 +205,6 @@ void MainWindow::slotDisableNotify()
|
||||
timer->stop();
|
||||
}
|
||||
|
||||
void MainWindow::showOfflineButton(bool flag)
|
||||
{
|
||||
if (flag)
|
||||
ui->offlineStartButton->show();
|
||||
else
|
||||
ui->offlineStartButton->hide();
|
||||
}
|
||||
|
||||
void MainWindow::on_settingsButton_clicked()
|
||||
{
|
||||
emit sigShowSettings(true);
|
||||
@@ -233,14 +221,14 @@ void MainWindow::loadToServer()
|
||||
{
|
||||
ui->mainFrame->show();
|
||||
ui->inlineTextDebug->setText(tr("Отправка файлов..."));
|
||||
ui->offlineStartButton->setEnabled(false);
|
||||
//ui->offlineStartButton->setEnabled(false);
|
||||
ui->unsafeChangingButton->hide();
|
||||
}
|
||||
|
||||
void MainWindow::undoCurrentChanges()
|
||||
{
|
||||
ui->mainFrame->show();
|
||||
ui->offlineStartButton->setEnabled(false);
|
||||
//ui->offlineStartButton->setEnabled(false);
|
||||
ui->unsafeChangingButton->hide();
|
||||
}
|
||||
|
||||
@@ -260,7 +248,8 @@ void MainWindow::on_exitButton_clicked()
|
||||
void MainWindow::slotShowUpdateInfo()
|
||||
{
|
||||
ui->unsafeChangingButton->show();
|
||||
ui->offlineStartButton->setGeometry(bottomRightPosition);
|
||||
//ui->offlineStartButton->setGeometry(bottomRightPosition);
|
||||
//ui->offlineStartButton->setParent(ui->changeButtonGroup->widget());
|
||||
}
|
||||
|
||||
void MainWindow::setUpUi()
|
||||
@@ -268,9 +257,10 @@ void MainWindow::setUpUi()
|
||||
ui->notificationLabel->hide();
|
||||
ui->unsafeChangingButton->hide();
|
||||
|
||||
ui->offlineStartButton->show();
|
||||
ui->offlineStartButton->setEnabled(false);
|
||||
ui->offlineStartButton->setGeometry(bottomRightPosition);
|
||||
//ui->offlineStartButton->show();
|
||||
//ui->offlineStartButton->setEnabled(false);
|
||||
//ui->offlineStartButton->setGeometry(bottomRightPosition);
|
||||
//ui->offlineStartButton->setParent(ui->changeButtonGroup->widget());
|
||||
|
||||
ui->settingsButton->setIcon(*resourceManager->getSettingsIcon());
|
||||
|
||||
@@ -324,9 +314,14 @@ QHBoxLayout *MainWindow::getDisplayLayout() const
|
||||
return ui->displayLayout;
|
||||
}
|
||||
|
||||
QPushButton *MainWindow::getStartOfflineButton() const
|
||||
{
|
||||
return ui->offlineStartButton;
|
||||
}
|
||||
|
||||
void MainWindow::addWidgetToChangeGroup(CommonButtonGroupWidget *commonWidgetGroup)
|
||||
{
|
||||
ui->changButtonGroup->addWidget(commonWidgetGroup);
|
||||
ui->changeButtonGroup->addWidget(commonWidgetGroup);
|
||||
}
|
||||
|
||||
void MainWindow::addWidgetToInteractiveGroup(EntryWidget *entryWidget)
|
||||
|
||||
10
mainwindow.h
10
mainwindow.h
@@ -4,6 +4,7 @@
|
||||
#include <QMainWindow>
|
||||
#include <QDebug>
|
||||
#include <QHBoxLayout>
|
||||
#include <QPushButton>
|
||||
|
||||
#include <Widgets/commonbuttongroupwidget.h>
|
||||
#include <Widgets/updatenotifywidget.h>
|
||||
@@ -43,14 +44,13 @@ public:
|
||||
void setNeedUpdateState(const QString ¬ifyText);
|
||||
void setLastVersionState();
|
||||
void showConnectionEmpty();
|
||||
void showOfflineButton(bool flag);
|
||||
void setStartOfflineButton(bool isAvailable);
|
||||
void setStartState();
|
||||
void serverNotifyShow(QString text, int durationMS = 3000);
|
||||
void showError(ErrorsEnum errorNum);
|
||||
|
||||
QHBoxLayout *getDisplayLayout() const;
|
||||
void serverBlockedState();
|
||||
QPushButton *getStartOfflineButton() const;
|
||||
|
||||
public slots:
|
||||
void slotShowUpdateInfo();
|
||||
void slotConnectionState(bool flag);
|
||||
@@ -66,6 +66,8 @@ signals:
|
||||
void sigExit();
|
||||
void sigTryLogin();
|
||||
void sigStartOffline();
|
||||
bool sigAppAvailable();
|
||||
|
||||
|
||||
private slots:
|
||||
void on_settingsButton_clicked();
|
||||
@@ -84,11 +86,13 @@ private:
|
||||
QPixmap background;
|
||||
QRect bottomRightPosition;
|
||||
QRect offlinePosition;
|
||||
QPushButton startOfflineButton;
|
||||
void bindClient();
|
||||
void bindConnection();
|
||||
void setUpUi();
|
||||
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void checkApp();
|
||||
protected:
|
||||
virtual void keyPressEvent(QKeyEvent *event);
|
||||
};
|
||||
|
||||
@@ -249,9 +249,9 @@
|
||||
<widget class="QWidget" name="versionLayoutWidget" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>529</x>
|
||||
<x>540</x>
|
||||
<y>450</y>
|
||||
<width>250</width>
|
||||
<width>241</width>
|
||||
<height>60</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -420,46 +420,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="offlineStartButton">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>530</x>
|
||||
<y>511</y>
|
||||
<width>250</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>250</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>1500</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Запуск в автономном режиме</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="verticalLayoutWidget_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
@@ -478,9 +438,9 @@
|
||||
<widget class="QWidget" name="verticalLayoutWidget_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<x>10</x>
|
||||
<y>440</y>
|
||||
<width>511</width>
|
||||
<width>501</width>
|
||||
<height>61</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -520,6 +480,46 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="offlineStartButton">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>240</x>
|
||||
<y>350</y>
|
||||
<width>300</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>250</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>1500</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Запуск в автономном режиме</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="headerWidget" native="true">
|
||||
<property name="geometry">
|
||||
@@ -617,13 +617,13 @@
|
||||
<widget class="QWidget" name="verticalLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<x>20</x>
|
||||
<y>550</y>
|
||||
<width>531</width>
|
||||
<height>41</height>
|
||||
<width>761</width>
|
||||
<height>42</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="changButtonGroup">
|
||||
<layout class="QHBoxLayout" name="changeButtonGroup">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
|
||||
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>
|
||||
|
||||
@@ -129,7 +129,9 @@ void WidgetManager::setConnectionState(bool isConnected)
|
||||
mainWindow->slotConnectionState(isConnected);
|
||||
if (isConnected)
|
||||
{
|
||||
mainWindow->getStartOfflineButton()->hide();
|
||||
entryWidget->showLoginWidget(true);
|
||||
commonButtonGroupWidget->loginState();
|
||||
}
|
||||
waitAnimationWidget->hideWithStop();
|
||||
}
|
||||
@@ -169,12 +171,6 @@ void WidgetManager::showMainFrame(bool flag)
|
||||
mainWindow->showMainFrame(flag);
|
||||
}
|
||||
|
||||
void WidgetManager::setAppAvailable(bool isAvailable)
|
||||
{
|
||||
commonButtonGroupWidget->startButtonActive(isAvailable);
|
||||
mainWindow->setStartOfflineButton(isAvailable);
|
||||
}
|
||||
|
||||
void WidgetManager::showSettings(bool isActive)
|
||||
{
|
||||
entryWidget->settingsState();
|
||||
|
||||
@@ -45,13 +45,14 @@ public:
|
||||
|
||||
void setUndoCurrentChangesState();
|
||||
void showMainFrame(bool flag);
|
||||
void setAppAvailable(bool isAvailable);
|
||||
void slotInlineDebug(const QString &text);
|
||||
public slots:
|
||||
void showSettings(bool isActive);
|
||||
void slotSetLoadSettings(Settings *settings);
|
||||
void slotActivateLoadAnimation(bool flag);
|
||||
|
||||
signals:
|
||||
bool sigAppAvailable();
|
||||
|
||||
private:
|
||||
MainWindow *mainWindow;
|
||||
|
||||
Reference in New Issue
Block a user