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:
@@ -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
|
||||
|
||||
@@ -29,8 +29,13 @@ 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);
|
||||
if (item.path.contains("CfiList.xml")) continue;
|
||||
|
||||
qint32 fileDataIndex = findIndexByPath(*serverStreamingHash, item.path);
|
||||
if (fileDataIndex != -1)
|
||||
{
|
||||
serverFiles->append(serverStreamingHash->at(fileDataIndex));
|
||||
}
|
||||
files->append(item);
|
||||
}
|
||||
}
|
||||
@@ -62,7 +67,14 @@ void HashComparer::showDeltas()
|
||||
for (int i = 0; i < filesForUpdate->size(); i++)
|
||||
{
|
||||
FileData local = filesForUpdate->at(i);
|
||||
FileData server = serverFiles->at(i);
|
||||
FileData server = FileData();
|
||||
server.lastUpdate = "нет";
|
||||
|
||||
if (serverFiles->size() > i)
|
||||
{
|
||||
server = serverFiles->at(i);
|
||||
}
|
||||
|
||||
emit sigAddToList(local,server);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<AuthData Login="I1" Password="b59c67bf196a4758191e42f76670ceba" InstructorName="Колобков В.Р." ClientName="Колобков В.Р." AccessType="instructor"/>
|
||||
<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
File diff suppressed because it is too large
Load Diff
@@ -15,7 +15,9 @@ void CommonButtonGroupWidget::initialize()
|
||||
ui->updateButton->hide();
|
||||
ui->startButton->hide();
|
||||
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 localFileTime = QDateTime::fromString(localData.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(" Локально: ");
|
||||
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>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -106,9 +104,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()
|
||||
@@ -154,6 +155,7 @@ void CoreManager::initializeWidgets()
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
@@ -345,8 +347,6 @@ void CoreManager::undoCurrentChanges()
|
||||
isRecovery = true;
|
||||
widgetManager->setUndoCurrentChangesState();
|
||||
emit sigSendCheckUpdate();
|
||||
//emit sigSendPacketType(PacketType::TYPE_UPDATE);
|
||||
//тут был таймер
|
||||
isRecovery = false;
|
||||
}
|
||||
|
||||
@@ -380,7 +380,6 @@ void CoreManager::saveServerSettingsWithConnect()
|
||||
emit sigSendXMLAnswer(cmd_Disable);
|
||||
tcpClient->setDisconnect();
|
||||
entryWidget->showLoginWidget(true);
|
||||
widgetManager->getMainWindow()->showOfflineButton(true);
|
||||
widgetManager->activateLoadingAnimation(false);
|
||||
}
|
||||
|
||||
@@ -392,12 +391,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>
|
||||
|
||||
@@ -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