mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJClient.git
synced 2026-03-28 05:25:39 +03:00
feat: standAloneLoading
This commit is contained in:
@@ -3,10 +3,14 @@
|
||||
#include "FileData.h"
|
||||
#include "tools.h"
|
||||
|
||||
#include <QDir>
|
||||
|
||||
DataParser::DataParser(QObject *parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
|
||||
if(!QDir("StaticData").exists()){
|
||||
QDir().mkdir("StaticData");
|
||||
}
|
||||
}
|
||||
|
||||
DataParser::~DataParser()
|
||||
@@ -112,6 +116,20 @@ void DataParser::CreateAuthData(ServerAuthorization *serverAuth)
|
||||
|
||||
}
|
||||
|
||||
void DataParser::AddRunData(QList<int> displays)
|
||||
{
|
||||
QFile file(displayTemp);
|
||||
file.open(QIODevice::ReadWrite);
|
||||
|
||||
QXmlStreamWriter xmlWriter(&file);
|
||||
xmlWriter.setAutoFormatting(true);
|
||||
xmlWriter.writeStartElement("DisplayInfo");
|
||||
xmlWriter.writeAttribute("DisplayCount",QString::number(displays.length()));
|
||||
xmlWriter.writeEndElement();
|
||||
file.close();
|
||||
|
||||
}
|
||||
|
||||
ServerSettings *DataParser::GetServerSettings()
|
||||
{
|
||||
ServerSettings *settings = new ServerSettings;
|
||||
|
||||
@@ -22,6 +22,7 @@ public:
|
||||
void CreateXML(QList<FileData> fileDataList);
|
||||
void CreateAuthMessage(ClientAutorization *auth);
|
||||
void CreateAuthData(ServerAuthorization *serverAuth);
|
||||
void AddRunData(QList<int> displays);
|
||||
|
||||
private:
|
||||
ClientAutorization *authPassCache;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "externalexecuter.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
|
||||
ExternalExecuter::ExternalExecuter()
|
||||
{
|
||||
@@ -13,12 +15,13 @@ ExternalExecuter::~ExternalExecuter()
|
||||
|
||||
void ExternalExecuter::CallApp()
|
||||
{
|
||||
QProcess myProcess(this);
|
||||
QProcess *myProcess = new QProcess(this);
|
||||
QStringList args;
|
||||
args << "1";
|
||||
|
||||
myProcess.start(programPath,args);
|
||||
myProcess.waitForFinished(-1);
|
||||
myProcess->start(programPath,args);
|
||||
myProcess->waitForFinished(3000);
|
||||
QCoreApplication::exit();
|
||||
}
|
||||
|
||||
bool ExternalExecuter::FindApp()
|
||||
|
||||
@@ -31,11 +31,6 @@ void RecognizeSystem::Recognize(QTcpSocket *socket)
|
||||
|
||||
while(socket->bytesAvailable())
|
||||
{
|
||||
|
||||
if(!stream.commitTransaction()){
|
||||
qDebug() << "BUSY, WAIT";
|
||||
}
|
||||
|
||||
if(packetType == PacketType::TYPE_NONE){ //определение первичного пакета
|
||||
|
||||
stream.startTransaction();
|
||||
|
||||
@@ -1,24 +1,90 @@
|
||||
#include "screenchecker.h"
|
||||
|
||||
ScreenChecker::ScreenChecker()
|
||||
#include <QLabel>
|
||||
|
||||
|
||||
|
||||
ScreenChecker::ScreenChecker(DataParser *dataParser, QHBoxLayout *layout, QObject *parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
screenCount = 0;
|
||||
this->layout = layout;
|
||||
this->dataParser = dataParser;
|
||||
}
|
||||
|
||||
void ScreenChecker::Check()
|
||||
{
|
||||
screens = QGuiApplication::screens();
|
||||
|
||||
for (int i = 0; i < screens.size();i++){
|
||||
|
||||
for (int i = 0; i < screens.size();i++)
|
||||
{
|
||||
QScreen *display = screens[i];
|
||||
qDebug() << screens[i]->name();
|
||||
screenCount++;
|
||||
|
||||
QString sizeText = QString::number(display->size().width()) + "x" + QString::number(display->size().height());
|
||||
sizeText.append("\n");
|
||||
sizeText.append(QString::number(display->refreshRate()) + "Hz");
|
||||
QPushButton *button = new QPushButton(sizeText);
|
||||
buttons.append(button);
|
||||
|
||||
layout->addWidget(button);
|
||||
float width = display->size().width();
|
||||
float height = display->size().height();
|
||||
float ratio = width / height;
|
||||
|
||||
QSize *sizeResult;
|
||||
if(height > width){
|
||||
sizeResult = new QSize(90,90 / ratio);
|
||||
}else{
|
||||
sizeResult = new QSize(150,150 / ratio);
|
||||
}
|
||||
|
||||
button->setMinimumSize(*sizeResult);
|
||||
button->setMaximumSize(*sizeResult);
|
||||
button->setCheckable(true);
|
||||
|
||||
connect(button,&QPushButton::clicked,this,&ScreenChecker::UpdateDisplayData);
|
||||
|
||||
if(i == 0){
|
||||
button->setChecked(true);
|
||||
button->setFlat(true);
|
||||
QPalette palette= button->palette();
|
||||
button->setEnabled(false);
|
||||
palette.setColor(QPalette::Background,QColor(Qt::blue));
|
||||
palette.setColor(QPalette::ButtonText,QColor(Qt::black));
|
||||
button->setPalette(palette);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
qDebug() << "Now worked: " << screenCount <<" displays" << endl;
|
||||
UpdateDisplayData();
|
||||
}
|
||||
|
||||
void ScreenChecker::UpdateDisplayData()
|
||||
{
|
||||
QList<int> *displays = new QList<int>;
|
||||
|
||||
for (int i = 0; i <buttons.count();i++)
|
||||
{
|
||||
if(buttons[i]->isChecked()){
|
||||
displays->append(i);
|
||||
}
|
||||
}
|
||||
|
||||
dataParser->AddRunData(*displays);
|
||||
}
|
||||
|
||||
QString ScreenChecker::getScreenCount() const
|
||||
{
|
||||
return QString::number(screenCount);
|
||||
}
|
||||
|
||||
ScreenChecker::~ScreenChecker()
|
||||
{
|
||||
for (int i = 0; i < buttons.size(); i++)
|
||||
{
|
||||
delete buttons[i];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,34 @@
|
||||
#ifndef SCREENCHECKER_H
|
||||
#define SCREENCHECKER_H
|
||||
|
||||
#include "dataparser.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QScreen>
|
||||
#include <QGuiApplication>
|
||||
#include <QDebug>
|
||||
#include <QPushButton>
|
||||
#include <QHBoxLayout>
|
||||
|
||||
class ScreenChecker
|
||||
class ScreenChecker : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ScreenChecker();
|
||||
explicit ScreenChecker(DataParser *dataParser, QHBoxLayout *layout,QObject *parent = nullptr);
|
||||
~ScreenChecker();
|
||||
void Check();
|
||||
void UpdateDisplayData();
|
||||
QString getScreenCount() const;
|
||||
|
||||
|
||||
private:
|
||||
DataParser *dataParser;
|
||||
QWidget *widget;
|
||||
QHBoxLayout *layout;
|
||||
qint64 screenCount;
|
||||
QList<QScreen *> screens;
|
||||
QList<QPushButton *> buttons;
|
||||
};
|
||||
|
||||
#endif // SCREENCHECKER_H
|
||||
|
||||
@@ -7,10 +7,11 @@
|
||||
|
||||
#define TCP_READ_TIMEOUT 1000
|
||||
|
||||
static QString hashFilename = "hash.xml";
|
||||
static QString settingsName = "settings.xml";
|
||||
static QString tempName = "temp.xml";
|
||||
static QString authTempName = "authData.xml";
|
||||
static QString hashFilename = "StaticData/hash.xml";
|
||||
static QString settingsName = "StaticData/settings.xml";
|
||||
static QString tempName = "StaticData/temp.xml";
|
||||
static QString authTempName = "StaticData/authData.xml";
|
||||
static QString displayTemp = "StaticData/displayData.xml";
|
||||
|
||||
enum PacketType{
|
||||
TYPE_NONE = 0,
|
||||
|
||||
Reference in New Issue
Block a user