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"));
updateLabelLoggedInInstructor(serverAuth->Login, serverAuth->ClientName);
connectorToServer->setLoginName(loginInstructorLoggedInLocal);
connectorToServer->setLoginName(nameInstructorLoggedInLocal);
QMessageBox::information(this, tr("Instructor authorization"), tr("Successfully!"));
}
else

View File

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

View File

@@ -14,12 +14,20 @@ public:
this->createData = data;
this->size = size;
this->isChangeable = true;
this->author = "";
}
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
{
return absolutePath;

View File

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

View File

@@ -56,6 +56,7 @@ public:
static QString createSharedPath(QString path);
static QString createRealPath(QString path,StreamingVersionData* currentVersionData);
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() == "..")
continue;
QString fileName = staticDataFolderName + "/" + fileInfo.fileName() + "Hash.xml";
QString fileName = Tools::createVersionHashFilepath(fileInfo.fileName());
fileList = calculateHash(fileInfo.absoluteFilePath());
saveHash(fileName,fileList);