优化转码添加LS的限制,优化缓存读取的问题
This commit is contained in:
@@ -26,6 +26,31 @@
|
||||
#include "ElaProgressBar.h"
|
||||
#include "ElaText.h"
|
||||
|
||||
namespace {
|
||||
|
||||
bool validateLsFunctionNames(QWidget *parent, const QStringList &functionNames)
|
||||
{
|
||||
QStringList nonLsNames;
|
||||
for (const QString &name : functionNames) {
|
||||
const QString trimmedName = name.trimmed();
|
||||
if (!trimmedName.isEmpty()
|
||||
&& !trimmedName.startsWith("LS_")
|
||||
&& !nonLsNames.contains(trimmedName)) {
|
||||
nonLsNames.append(trimmedName);
|
||||
}
|
||||
}
|
||||
|
||||
if (nonLsNames.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
QMessageBox::warning(parent, "提示",
|
||||
QString("不支持非LS业务转码:\n%1").arg(nonLsNames.join('\n')));
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class StatusDelegate : public QStyledItemDelegate
|
||||
{
|
||||
public:
|
||||
@@ -264,6 +289,10 @@ void BatchConvertPage::onEditRow(int row)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!validateLsFunctionNames(this, QStringList{newName})) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (newName == oldName) {
|
||||
return;
|
||||
}
|
||||
@@ -303,7 +332,13 @@ void BatchConvertPage::onAddFunction()
|
||||
btnLayout->addWidget(cancelBtn);
|
||||
layout->addLayout(btnLayout);
|
||||
|
||||
connect(okBtn, &QPushButton::clicked, &dialog, &QDialog::accept);
|
||||
connect(okBtn, &QPushButton::clicked, &dialog, [this, &dialog, textEdit]() {
|
||||
const QStringList funcNames =
|
||||
textEdit->toPlainText().split('\n', Qt::SkipEmptyParts);
|
||||
if (validateLsFunctionNames(this, funcNames)) {
|
||||
dialog.accept();
|
||||
}
|
||||
});
|
||||
connect(cancelBtn, &QPushButton::clicked, &dialog, &QDialog::reject);
|
||||
|
||||
if (dialog.exec() != QDialog::Accepted) {
|
||||
|
||||
Reference in New Issue
Block a user