bugfix:version info complete

This commit is contained in:
semenov
2025-01-22 10:14:43 +03:00
parent 2020a05dae
commit baf5f535f9
7 changed files with 65 additions and 25 deletions

View File

@@ -170,7 +170,7 @@ void InstructorsAndTraineesWidget::checkLoginResult(ServerAuthorization *serverA
ui->btnAuthorizationInstructor->setText(tr("Deauthorization Instructor")); ui->btnAuthorizationInstructor->setText(tr("Deauthorization Instructor"));
updateLabelLoggedInInstructor(serverAuth->Login, serverAuth->ClientName); updateLabelLoggedInInstructor(serverAuth->Login, serverAuth->ClientName);
connectorToServer->setLoginName(loginInstructorLoggedInLocal); connectorToServer->setLoginName(nameInstructorLoggedInLocal);
QMessageBox::information(this, tr("Instructor authorization"), tr("Successfully!")); QMessageBox::information(this, tr("Instructor authorization"), tr("Successfully!"));
} }
else else

View File

@@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>325</width> <width>344</width>
<height>200</height> <height>200</height>
</rect> </rect>
</property> </property>
@@ -61,7 +61,7 @@
<item> <item>
<widget class="QLabel" name="prevVerTitle"> <widget class="QLabel" name="prevVerTitle">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@@ -73,6 +73,12 @@
</item> </item>
<item> <item>
<widget class="QLabel" name="prevVerValue"> <widget class="QLabel" name="prevVerValue">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>150</horstretch>
<verstretch>30</verstretch>
</sizepolicy>
</property>
<property name="text"> <property name="text">
<string>TextLabel</string> <string>TextLabel</string>
</property> </property>
@@ -92,13 +98,25 @@
<number>5</number> <number>5</number>
</property> </property>
<property name="rightMargin"> <property name="rightMargin">
<number>20</number> <number>5</number>
</property> </property>
<property name="bottomMargin"> <property name="bottomMargin">
<number>5</number> <number>5</number>
</property> </property>
<item> <item>
<widget class="QLabel" name="newNameVersionTitle"> <widget class="QLabel" name="newNameVersionTitle">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>99</horstretch>
<verstretch>40</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text"> <property name="text">
<string>Новое название:</string> <string>Новое название:</string>
</property> </property>
@@ -108,8 +126,8 @@
<widget class="QLineEdit" name="lineEdit"> <widget class="QLineEdit" name="lineEdit">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>150</horstretch>
<verstretch>0</verstretch> <verstretch>30</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
@@ -126,6 +144,19 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</item> </item>
<item> <item>

View File

@@ -14,12 +14,20 @@ public:
this->createData = data; this->createData = data;
this->size = size; this->size = size;
this->isChangeable = true; this->isChangeable = true;
this->author = "";
} }
StreamingVersionData(){}; StreamingVersionData(){};
~StreamingVersionData(); ~StreamingVersionData();
void fill(StreamingVersionData* data)
{
this->absolutePath = data->getAbsolutPath();
this->viewName = data->getViewName();
this->createData = data->getCreateData();
this->size = data->getSize();
this->isChangeable = data->getIsChangeable();
this->author = data->getAuthor();
}
QString getAbsolutPath() const QString getAbsolutPath() const
{ {
return absolutePath; return absolutePath;

View File

@@ -170,22 +170,13 @@ void AssetsManager::addVersion(StreamingVersionData *data)
void AssetsManager::createCopyVersion(QString versionName,QString newVersionName,QString author) void AssetsManager::createCopyVersion(QString versionName,QString newVersionName,QString author)
{ {
qDebug() << "assetManager thread ID " << QThread::currentThreadId(); qDebug() << "assetManager thread ID " << QThread::currentThreadId();
QListIterator<StreamingVersionData*> iterator(*datas);
StreamingVersionData* data = new StreamingVersionData; StreamingVersionData* data = new StreamingVersionData;
while (iterator.hasNext()) data->setAbsolutePath(Tools::createSharedPath("/" + newVersionName));
{
StreamingVersionData *version = iterator.next();
if (version->getViewName() == versionName)
{
data->setAbsolutePath(version->getAbsolutPath());
}
}
data->setAuthor(author); data->setAuthor(author);
data->setIsChangeable(true); data->setIsChangeable(true);
data->setViewName(newVersionName); data->setViewName(newVersionName);
data->setCreateData(QDateTime::currentDateTime());
datas->append(data); datas->append(data);
qDebug() << "Version for copy " << versionName; qDebug() << "Version for copy " << versionName;
@@ -282,7 +273,7 @@ void AssetsManager::copyAllRecurse(QString source,QString destination)
void AssetsManager::writeVersionsToFile(QList<StreamingVersionData*> version,bool isFirst) void AssetsManager::writeVersionsToFile(QList<StreamingVersionData*> version,bool isFirst)
{ {
QList<SXmlAnswerTag> listTag; QList<SXmlAnswerTag> listTag;
datas->clear();
QFile file(versionListFile); QFile file(versionListFile);
foreach(StreamingVersionData* ver,version) foreach(StreamingVersionData* ver,version)
@@ -337,10 +328,10 @@ void AssetsManager::writeVersionsToFile(QList<StreamingVersionData*> version,boo
void AssetsManager::createFirstVersionListXML(QList<StreamingVersionData*> version) //TODO: переименовать и перебросить в AssetManager void AssetsManager::createFirstVersionListXML(QList<StreamingVersionData*> version) //TODO: переименовать и перебросить в AssetManager
{ {
QFile file(versionListFile); QFile file(versionListFile);
QList<StreamingVersionData*> *temp = new QList<StreamingVersionData*>();
if(!file.exists()) if(!file.exists())
{ {
writeVersionsToFile(version,true); writeVersionsToFile(version,true);
} }
else else
{ {
@@ -353,16 +344,20 @@ void AssetsManager::createFirstVersionListXML(QList<StreamingVersionData*> versi
{ {
if(ver->getViewName() == data->getViewName()) if(ver->getViewName() == data->getViewName())
{ {
data->setAbsolutePath(ver->getAbsolutPath()); StreamingVersionData *tempData = new StreamingVersionData;
tempData->fill(data);
tempData->setAbsolutePath(ver->getAbsolutPath());
temp->append(tempData);
break; break;
} }
} }
} }
writeVersionsToFile(*datas,false); writeVersionsToFile(*temp,false);
} }
} }
void AssetsManager::saveVersionToFile(StreamingVersionData *streamingVersion) //TODO: переименовать и перебросить в AssetManager void AssetsManager::saveVersionToFile(StreamingVersionData *streamingVersion) //TODO: переименовать и перебросить в AssetManager

View File

@@ -66,6 +66,11 @@ QString Tools::createStreamingToRealPath(QString path,StreamingVersionData* stre
} }
QString Tools::createVersionHashFilepath(QString fileName)
{
return staticDataFolderName + "/" + fileName + "Hash.xml";
}
QString Tools::createUpdateFilePath(QString path) QString Tools::createUpdateFilePath(QString path)
{ {
//qDebug() << "Full path: " << path; //qDebug() << "Full path: " << path;

View File

@@ -56,6 +56,7 @@ public:
static QString createSharedPath(QString path); static QString createSharedPath(QString path);
static QString createRealPath(QString path,StreamingVersionData* currentVersionData); static QString createRealPath(QString path,StreamingVersionData* currentVersionData);
static QString createStreamingToRealPath(QString path, StreamingVersionData *streamingVersionData); static QString createStreamingToRealPath(QString path, StreamingVersionData *streamingVersionData);
static QString createVersionHashFilepath(QString fileName);
}; };

View File

@@ -428,7 +428,7 @@ void UpdateController::calculateSharedHash()
if (fileInfo.fileName() == "." || fileInfo.fileName() == "..") if (fileInfo.fileName() == "." || fileInfo.fileName() == "..")
continue; continue;
QString fileName = staticDataFolderName + "/" + fileInfo.fileName() + "Hash.xml"; QString fileName = Tools::createVersionHashFilepath(fileInfo.fileName());
fileList = calculateHash(fileInfo.absoluteFilePath()); fileList = calculateHash(fileInfo.absoluteFilePath());
saveHash(fileName,fileList); saveHash(fileName,fileList);