mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJClient.git
synced 2026-03-28 05:25:39 +03:00
feat: add scenario conflict resolver
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -16,10 +16,23 @@ void UpdateFileSlot::fill(QString itemName, FileData serverData, FileData localD
|
||||
ui->Path->setText(itemName);
|
||||
local = localData;
|
||||
|
||||
bool haveData = serverData.lastUpdate != "нет";
|
||||
|
||||
QString result = " Сервер: ";
|
||||
QDateTime serverFileTime = QDateTime::fromString(serverData.lastUpdate,"dd.MM.yyyy hh:mm:ss");
|
||||
|
||||
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(serverFileTime.toString("dd.MM.yyyy"));
|
||||
|
||||
result.append(" Локально: ");
|
||||
result.append(localFileTime.toString("dd.MM.yyyy"));
|
||||
ui->Dates->setText(result);
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>0</y>
|
||||
<width>721</width>
|
||||
<width>701</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -42,17 +42,17 @@
|
||||
<widget class="QLabel" name="Image">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>755</x>
|
||||
<y>5</y>
|
||||
<width>31</width>
|
||||
<height>31</height>
|
||||
<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/checked.png</pixmap>
|
||||
<pixmap resource="../resources.qrc">:/resource/Icons/new.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Обнаружены новые файлы:</string>
|
||||
<string>Обнаружены новые или измененные файлы:</string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>false</bool>
|
||||
|
||||
Reference in New Issue
Block a user