ledok
This commit is contained in:
parent
e54f367005
commit
c311554cee
|
@ -551,22 +551,13 @@ QWidget* EAClock::attrWgt() {
|
||||||
|
|
||||||
bool EAClock::save(const QString &pRoot){
|
bool EAClock::save(const QString &pRoot){
|
||||||
if(m_attr.hasDialImg) {
|
if(m_attr.hasDialImg) {
|
||||||
QString file0 = m_attr.path + PAGEDEL_SUFFIX + "/" + m_attr.name;
|
auto old_file = m_attr.path + PAGEDEL_SUFFIX + "/" + m_attr.name;
|
||||||
QString file1 = m_attr.path + "/" + m_attr.name;
|
if(! QFileInfo::exists(old_file)) {
|
||||||
QFile f0(file0);
|
old_file = m_attr.path + "/" + m_attr.name;
|
||||||
QFile f1(file1);
|
if(! QFileInfo::exists(old_file)) return false; //自己画点,不用背景表盘
|
||||||
QString old_file;
|
|
||||||
QString new_file = pRoot + "/" + m_attr.name;
|
|
||||||
if(f0.exists()) {
|
|
||||||
old_file = file0;
|
|
||||||
} else if(f1.exists()) {
|
|
||||||
old_file = file1;
|
|
||||||
} else {//自己画点,不用背景表盘
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
QFile old_f(old_file);
|
auto new_file = pRoot + "/" + m_attr.name;
|
||||||
QFile new_f(new_file);
|
if(! QFileInfo::exists(new_file)) QFile(old_file).copy(new_file);
|
||||||
if(!new_f.exists()) old_f.copy(new_file);
|
|
||||||
} else {
|
} else {
|
||||||
auto filename = QString("%1-%2-%3-%4-%5.png").arg((int)zValue()).arg((int)x()).arg((int)y()).arg((int)mWidth).arg((int)mHeight);
|
auto filename = QString("%1-%2-%3-%4-%5.png").arg((int)zValue()).arg((int)x()).arg((int)y()).arg((int)mWidth).arg((int)mHeight);
|
||||||
m_attr.path = pRoot;
|
m_attr.path = pRoot;
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
#include "globaldefine.h"
|
#include "globaldefine.h"
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
#include "program/eenviron.h"
|
#include "program/eenviron.h"
|
||||||
#include "program/etext.h"
|
|
||||||
#include "program/evideo.h"
|
#include "program/evideo.h"
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
|
@ -45,7 +44,7 @@ void GenTmpThread::run() {
|
||||||
}
|
}
|
||||||
|
|
||||||
//扫描节目, 返回多个节目数组
|
//扫描节目, 返回多个节目数组
|
||||||
QStringList pageNames = QDir(srcDir).entryList(QDir::Dirs | QDir::NoDotAndDotDot);
|
auto pageNames = QDir(srcDir).entryList(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||||
//查询 order 属性, 将最上层的放在转换后 layers 的最前面
|
//查询 order 属性, 将最上层的放在转换后 layers 的最前面
|
||||||
//一个 page.json 对应节目任务中的一个 items 里的 program
|
//一个 page.json 对应节目任务中的一个 items 里的 program
|
||||||
std::vector<JObj> pageJsons;
|
std::vector<JObj> pageJsons;
|
||||||
|
@ -461,11 +460,13 @@ JObj GenTmpThread::convertDClock(const JValue &json){
|
||||||
JObj GenTmpThread::convertAClock(const JValue &json) {
|
JObj GenTmpThread::convertAClock(const JValue &json) {
|
||||||
auto widget = json["widget"];
|
auto widget = json["widget"];
|
||||||
if(widget.isNull()) widget = json;
|
if(widget.isNull()) widget = json;
|
||||||
QString srcFile = srcPageDir + "/" + widget["selfCreateDialName"].toString();
|
auto srcFile = srcPageDir + "/" + widget["selfCreateDialName"].toString();
|
||||||
QFile srcQFile(srcFile);
|
if(! QFileInfo::exists(srcFile)) {
|
||||||
if(! srcQFile.exists()) return JObj();
|
srcFile = srcPageDir + "/" + widget["name"].toString();
|
||||||
|
if(! QFileInfo::exists(srcFile)) return JObj();
|
||||||
|
}
|
||||||
QString id = Tools::fileMd5(srcFile);
|
QString id = Tools::fileMd5(srcFile);
|
||||||
srcQFile.copy(dstDir+"/"+id);
|
QFile(srcFile).copy(dstDir+"/"+id);
|
||||||
JObj oRes;
|
JObj oRes;
|
||||||
oRes["_type"] = "AnalogClock";
|
oRes["_type"] = "AnalogClock";
|
||||||
oRes["id"] = id;
|
oRes["id"] = id;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user