ledok增加超宽节目

This commit is contained in:
gangphon 2022-09-30 18:08:39 +08:00
parent d145c6128e
commit 7626902534
19 changed files with 1875 additions and 2224 deletions

View File

@ -123,16 +123,16 @@ SOURCES += \
wProgramManager/mconverter.cpp \
wProgramManager/pageeditor.cpp \
wProgramManager/pagelistitem.cpp \
wProgramManager/progcreatedlg.cpp \
wProgramManager/progeditorwin.cpp \
wProgramManager/progitem.cpp \
wProgramManager/sendprogramdialog.cpp \
wProgramManager/sendprogthread.cpp \
wProgramManager/threadexportprogrampro.cpp \
wProgramManager/usbdetectdialog.cpp \
wProgramManager/wexportprogramitem.cpp \
wProgramManager/wnewprogram.cpp \
wProgramManager/wplanitem.cpp \
wProgramManager/wplanlist.cpp \
wProgramManager/wprogramitem.cpp \
wProgramManager/wprogrampublishitem.cpp \
HEADERS += \
@ -222,16 +222,16 @@ HEADERS += \
wProgramManager/mconverter.h \
wProgramManager/pageeditor.h \
wProgramManager/pagelistitem.h \
wProgramManager/progcreatedlg.h \
wProgramManager/progeditorwin.h \
wProgramManager/progitem.h \
wProgramManager/sendprogramdialog.h \
wProgramManager/sendprogthread.h \
wProgramManager/threadexportprogrampro.h \
wProgramManager/usbdetectdialog.h \
wProgramManager/wexportprogramitem.h \
wProgramManager/wnewprogram.h \
wProgramManager/wplanitem.h \
wProgramManager/wplanlist.h \
wProgramManager/wprogramitem.h \
wProgramManager/wprogrampublishitem.h \
FORMS += \
@ -252,7 +252,6 @@ FORMS += \
wDevicesManager/controlvolumeschedule.ui \
wDevicesManager/controlvolumewidget.ui \
wDevicesManager/upgradeapkdialog.ui \
wProgramManager/wnewprogram.ui \
wProgramManager/wplanitem.ui \
TRANSLATIONS += \

View File

@ -10,12 +10,11 @@
#include <QNetworkDatagram>
#include <QNetworkInterface>
#include <QMessageBox>
#include <QSettings>
DevicePanel *gDevicePanel;
QList<LedCard*> *gSelCards;
//设备管理响应页面
DevicePanel::DevicePanel(QWidget *parent) : QWidget(parent) {
DevicePanel::DevicePanel(QSettings &settings, QWidget *parent) : QWidget(parent) {
gDevicePanel = this;
gSelCards = &mSelCards;
setAutoFillBackground(true);
@ -70,49 +69,7 @@ DevicePanel::DevicePanel(QWidget *parent) : QWidget(parent) {
bnSpecifyIP->setItemDelegate(new QStyledItemDelegate);
connect(bnSpecifyIP, &QComboBox::textActivated, this, [this] {
if(specifyIPDlg==0) {
specifyIPDlg = new QDialog(this);
specifyIPDlg->setWindowTitle(tr("Specify IP"));
auto vBox = new VBox(specifyIPDlg);
vBox->addStretch();
auto label = new QLabel(tr("Specify IP list"));
label->setAlignment(Qt::AlignCenter);
vBox->addWidget(label);
fdIP = new QTextEdit(QSettings().value("SpecifyIP").toString());
fdIP->setPlaceholderText("192.168.1.1\n192.168.1.2\n ...");
fdIP->setMinimumWidth(160);
vBox->addWidget(fdIP);
auto hBox = new HBox(vBox);
hBox->addStretch();
auto bnSearch = new QPushButton(tr("Search"));
connect(bnSearch, &QPushButton::clicked, this, [this] {
QString ipsStr = fdIP->toPlainText();
if(ipsStr.isEmpty()) {
QMessageBox::warning(gMainWin, tr("Attention"), tr("Please input IP address!"));
return;
}
auto ips = ipsStr.split("\n", Qt::SkipEmptyParts);
if(ips.isEmpty()) {
QMessageBox::warning(gMainWin, tr("Attention"), tr("Please input IP address!"));
return;
}
QByteArray data = QJsonDocument({{"action", "getInfo"}}).toJson(QJsonDocument::Compact);
foreach(auto ip, ips) {
if(gDevicePanel->mUdpSocket.writeDatagram(data, QHostAddress(ip), 22222) != data.length()) qDebug() << "Specify IP write Failed." << ip;
}
specifyIPDlg->accept();
});
hBox->addWidget(bnSearch);
auto btnCancel = new QPushButton(tr("Cancel"));
connect(btnCancel, &QPushButton::clicked, specifyIPDlg, &QDialog::reject);
hBox->addWidget(btnCancel);
hBox->addStretch();
}
mUdpTimer.stop();
specifyIPDlg->exec();
@ -184,7 +141,8 @@ QPushButton:hover {background-color: #08b;}
}
parseInfo(document.object(), addr);
} else {
STREAM_PACKET *pStreamPacket = (STREAM_PACKET *)gram.data().data();
auto bytes = gram.data();
STREAM_PACKET *pStreamPacket = (STREAM_PACKET *)bytes.data();
LedCard *pLedCard = new LedCard(this);//alahover 没有释放
pLedCard->m_strCardId = pStreamPacket->ucSerialCode;
pLedCard->m_strCardIp = addr;
@ -193,16 +151,16 @@ QPushButton:hover {background-color: #08b;}
pOldLedCard->m_bOnLine = true;
if(pOldLedCard->CompareHTTPGetParam(pLedCard)==false) {//如果ip地址变化了
pOldLedCard->copyLedCardHTTPGetParam(pLedCard);
emit addLedCard(pOldLedCard);//发送信号到界面
addLedCard(pOldLedCard);//发送信号到界面
} else {
//post失败的概率比较小所以这里是否需要平凡的更新不需要刻意屏蔽该操作改为在其他点击操作中进行
emit clearUdpHeartbeat(pOldLedCard);
clearUdpHeartbeat(pOldLedCard);
}
delete pLedCard;
return;
}
LedCardList.append(pLedCard);
emit addLedCard(pLedCard);//发送信号到界面
addLedCard(pLedCard);//发送信号到界面
}
}
});
@ -236,6 +194,59 @@ QPushButton:hover {background-color: #08b;}
//开始轮训查找局域网内的控制卡
sendGetInfo();
mUdpTimer.start(30000);
{
specifyIPDlg = new QDialog(this);
specifyIPDlg->setWindowTitle(tr("Specify IP"));
auto vBox = new VBox(specifyIPDlg);
vBox->addStretch();
auto label = new QLabel(tr("Specify IP list"));
label->setAlignment(Qt::AlignCenter);
vBox->addWidget(label);
auto ipstr = settings.value("SpecifyIP").toString();
fdIP = new QTextEdit(ipstr);
fdIP->setPlaceholderText("192.168.1.1\n192.168.1.2\n ...");
fdIP->setMinimumWidth(160);
vBox->addWidget(fdIP);
auto hBox = new HBox(vBox);
hBox->addStretch();
auto bnSearch = new QPushButton(tr("Search"));
connect(bnSearch, &QPushButton::clicked, this, [this] {
QString ipsStr = fdIP->toPlainText();
if(ipsStr.isEmpty()) {
QMessageBox::warning(gMainWin, tr("Attention"), tr("Please input IP address!"));
return;
}
auto ips = ipsStr.split("\n", Qt::SkipEmptyParts);
if(ips.isEmpty()) {
QMessageBox::warning(gMainWin, tr("Attention"), tr("Please input IP address!"));
return;
}
QByteArray data = QJsonDocument({{"action", "getInfo"}}).toJson(QJsonDocument::Compact);
foreach(auto ip, ips) {
if(gDevicePanel->mUdpSocket.writeDatagram(data, QHostAddress(ip), 22222) != data.length()) qDebug() << "Specify IP write Failed." << ip;
}
specifyIPDlg->accept();
});
hBox->addWidget(bnSearch);
auto btnCancel = new QPushButton(tr("Cancel"));
connect(btnCancel, &QPushButton::clicked, specifyIPDlg, &QDialog::reject);
hBox->addWidget(btnCancel);
hBox->addStretch();
if(! ipstr.isEmpty()) {
auto ips = ipstr.split("\n", Qt::SkipEmptyParts);
QByteArray data = QJsonDocument({{"action", "getInfo"}}).toJson(QJsonDocument::Compact);
foreach(auto ip, ips) {
if(gDevicePanel->mUdpSocket.writeDatagram(data, QHostAddress(ip), 22222) != data.length()) qDebug() << "Specify IP write Failed." << ip;
}
}
}
mDeviceTable->hideColumn(0);
mDeviceTable->fdIsSelAll->hide();
transUi();

View File

@ -11,12 +11,13 @@
#include <QCheckBox>
#include <QComboBox>
#include <QTextEdit>
#include <QSettings>
class DeviceCtrlPanel;
class DevicePanel : public QWidget {
Q_OBJECT
public:
explicit DevicePanel(QWidget *parent = nullptr);
explicit DevicePanel(QSettings &, QWidget *parent = nullptr);
~DevicePanel();
void sendGetInfo();

View File

@ -13,6 +13,7 @@
#include <QProcess>
#include <QSettings>
#include <QButtonGroup>
#include <QHeaderView>
QWidget *gMainWin;
extern QPoint gPlayPos;
@ -227,8 +228,8 @@ MainWindow::MainWindow(QWidget *parent) : BaseWin(parent) {
vBox->addWidget(m_wTitle);
//设备管理,节目管理,高级节目管理页创建
mDevicePanel = new DevicePanel();
mProgPanel = new ProgPanel();
mDevicePanel = new DevicePanel(settings);
mProgPanel = new ProgPanel(settings);
m_wGuangYingPinWidget = new mGuangYingPinWidget();
auto hBox = new QHBoxLayout();
@ -405,6 +406,8 @@ MainWindow::~MainWindow() {
if(m_pTimerSendResoreIpOneKey->isActive()) m_pTimerSendResoreIpOneKey->stop();
delete m_pTimerSendResoreIpOneKey;
}
settings.setValue("ProgramListSortColumn", mProgPanel->mProgTree->sortColumn());
settings.setValue("ProgramListSortOrder", mProgPanel->mProgTree->header()->sortIndicatorOrder());
}
void MainWindow::changeEvent(QEvent *event) {
BaseWin::changeEvent(event);

View File

@ -7,7 +7,7 @@
#include <QMessageBox>
#include <QSettings>
ProgPanel::ProgPanel(QWidget *parent) : QWidget(parent) {
ProgPanel::ProgPanel(QSettings &settings, QWidget *parent) : QWidget(parent) {
setAttribute(Qt::WA_DeleteOnClose);
setAutoFillBackground(true);
QPalette pal;
@ -26,7 +26,15 @@ ProgPanel::ProgPanel(QWidget *parent) : QWidget(parent) {
bnNew->setFixedSize(88, 38);
bnNew->setProperty("ssType", "progManageTool");
hBox->addWidget(bnNew);
connect(bnNew, SIGNAL(clicked(bool)), this, SLOT(onNewClicked(bool)));
connect(bnNew, &QPushButton::clicked, this, [this] {
ProgCreateDlg dlg(QDateTime::currentDateTime().toString("yyyyMMddhhmmsszzz"), 512, 512, "", this);
if(dlg.exec() != QDialog::Accepted) return;
if(checkIfNameRepeated(dlg.fdName->text())) return;
auto item = new ProgItem(progDir, dlg.fdName->text(), dlg.fdWidth->value(), dlg.fdHeight->value(), dlg.fdRemark->toPlainText(), mProgTree, this);
item->save();//保存pro.json
mProgTree->adjustCheckState();
item->onEditProgram();
});
bnEdit = new QPushButton(tr("Edit"));
bnEdit->setFixedSize(QSize(88, 38));
@ -46,7 +54,11 @@ ProgPanel::ProgPanel(QWidget *parent) : QWidget(parent) {
bnImport->setFixedSize(QSize(88, 38));
bnImport->setProperty("ssType", "progManageTool");
hBox->addWidget(bnImport);
connect(bnImport, SIGNAL(clicked(bool)), this, SLOT(onImportClicked(bool)));
connect(bnImport, &QPushButton::clicked, this, [this] {
auto dlg = new TipDialog(this, ENUM_IMPORT_DLG);
connect(dlg, SIGNAL(sigAcceptData(QString,QString)), this, SLOT(onImportProgram(QString,QString)));
dlg->exec();
});
bnExport = new QPushButton(tr("Export"));
bnExport->setFixedSize(QSize(88, 38));
@ -69,10 +81,10 @@ ProgPanel::ProgPanel(QWidget *parent) : QWidget(parent) {
connect(btnPlay, &QPushButton::clicked, this, [this](){
if(PlayWin::self!=nullptr) PlayWin::self->close();
else {
int cnt = wProgramList->topLevelItemCount();
for(int i=0; i<cnt; i++) if(wProgramList->topLevelItem(i)->checkState(0) == Qt::Checked) {
wProgramItem *item = static_cast<wProgramItem*>(wProgramList->topLevelItem(i));
QString dir = progDir+"/"+item->name()+"_tmp";
int cnt = mProgTree->topLevelItemCount();
for(int i=0; i<cnt; i++) if(mProgTree->topLevelItem(i)->checkState(0) == Qt::Checked) {
auto item = static_cast<ProgItem*>(mProgTree->topLevelItem(i));
QString dir = progDir+"/"+item->m_name+"_tmp";
QFile file(dir+"/program");
if(! file.open(QIODevice::ReadOnly | QIODevice::Text)) return;
QString value = file.readAll();
@ -81,7 +93,7 @@ ProgPanel::ProgPanel(QWidget *parent) : QWidget(parent) {
QJsonObject prog = QJsonDocument::fromJson(value.toUtf8(), &jsErr).object();
if(jsErr.error) return;
if(PlayWin::self!=nullptr) PlayWin::self->close();
PlayWin::self = PlayWin::newIns(item->width(), item->height(), dir, prog);
PlayWin::self = PlayWin::newIns(item->m_width, item->m_height, dir, prog);
break;
}
}
@ -100,9 +112,9 @@ ProgPanel::ProgPanel(QWidget *parent) : QWidget(parent) {
hBox->addWidget(txtSearch);
connect(txtSearch,SIGNAL(textChanged(const QString &)),this,SLOT(FilterProgram(const QString &)));
wProgramList = new LoQTreeWidget();
wProgramList->setIndentation(10);
wProgramList->setSortingEnabled(true);
mProgTree = new LoQTreeWidget();
mProgTree->setIndentation(10);
mProgTree->setSortingEnabled(true);
m_headerItem = new QTreeWidgetItem();
for(int i=1; i<ENUM_PROGRAMLISTHEADERITEM_END; i++) m_headerItem->setTextAlignment(i, Qt::AlignCenter);
m_headerItem->setData(ENUM_PROGRAMLISTHEADERITEM_CHECK, Qt::DisplayRole, "");
@ -112,20 +124,20 @@ ProgPanel::ProgPanel(QWidget *parent) : QWidget(parent) {
m_headerItem->setData(ENUM_PROGRAMLISTHEADERITEM_LASTTIME, Qt::DisplayRole, tr("Last Modify"));
m_headerItem->setData(ENUM_PROGRAMLISTHEADERITEM_USB_EXPORT, Qt::DisplayRole, tr("Usb playback"));
m_headerItem->setData(ENUM_PROGRAMLISTHEADERITEM_SEND, Qt::DisplayRole, tr("Publish"));
wProgramList->setHeaderItem(m_headerItem);
wProgramList->header()->setSectionResizeMode(ENUM_PROGRAMLISTHEADERITEM_CHECK, QHeaderView::Fixed);
wProgramList->header()->setSectionResizeMode(ENUM_PROGRAMLISTHEADERITEM_NAME, QHeaderView::Stretch);
wProgramList->header()->setSectionResizeMode(ENUM_PROGRAMLISTHEADERITEM_RESOLUTION, QHeaderView::Stretch);
wProgramList->header()->setSectionResizeMode(ENUM_PROGRAMLISTHEADERITEM_SIZE, QHeaderView::Stretch);
wProgramList->header()->setSectionResizeMode(ENUM_PROGRAMLISTHEADERITEM_LASTTIME, QHeaderView::Stretch);
wProgramList->header()->setSectionResizeMode(ENUM_PROGRAMLISTHEADERITEM_USB_EXPORT, QHeaderView::Fixed);
wProgramList->header()->setSectionResizeMode(ENUM_PROGRAMLISTHEADERITEM_SEND, QHeaderView::Fixed);
wProgramList->header()->setStretchLastSection(false);
wProgramList->setColumnWidth(ENUM_PROGRAMLISTHEADERITEM_CHECK, 66);
wProgramList->setColumnWidth(ENUM_PROGRAMLISTHEADERITEM_USB_EXPORT, 100);
wProgramList->setColumnWidth(ENUM_PROGRAMLISTHEADERITEM_SEND, 72);
vBox->addWidget(wProgramList);
connect(wProgramList, &LoQTreeWidget::sigCheckStateChanged, this, [this](int f){
mProgTree->setHeaderItem(m_headerItem);
mProgTree->header()->setSectionResizeMode(ENUM_PROGRAMLISTHEADERITEM_CHECK, QHeaderView::Fixed);
mProgTree->header()->setSectionResizeMode(ENUM_PROGRAMLISTHEADERITEM_NAME, QHeaderView::Stretch);
mProgTree->header()->setSectionResizeMode(ENUM_PROGRAMLISTHEADERITEM_RESOLUTION, QHeaderView::Stretch);
mProgTree->header()->setSectionResizeMode(ENUM_PROGRAMLISTHEADERITEM_SIZE, QHeaderView::Stretch);
mProgTree->header()->setSectionResizeMode(ENUM_PROGRAMLISTHEADERITEM_LASTTIME, QHeaderView::Stretch);
mProgTree->header()->setSectionResizeMode(ENUM_PROGRAMLISTHEADERITEM_USB_EXPORT, QHeaderView::Fixed);
mProgTree->header()->setSectionResizeMode(ENUM_PROGRAMLISTHEADERITEM_SEND, QHeaderView::Fixed);
mProgTree->header()->setStretchLastSection(false);
mProgTree->setColumnWidth(ENUM_PROGRAMLISTHEADERITEM_CHECK, 66);
mProgTree->setColumnWidth(ENUM_PROGRAMLISTHEADERITEM_USB_EXPORT, 100);
mProgTree->setColumnWidth(ENUM_PROGRAMLISTHEADERITEM_SEND, 72);
vBox->addWidget(mProgTree);
connect(mProgTree, &LoQTreeWidget::sigCheckStateChanged, this, [this](int f){
switch(f) {
case LoQTreeWidget::CheckNone:
bnEdit->setEnabled(false);
@ -172,33 +184,21 @@ ProgPanel::ProgPanel(QWidget *parent) : QWidget(parent) {
fPro.open(QIODevice::ReadOnly);
QJsonDocument pro = QJsonDocument::fromJson(fPro.readAll());
fPro.close();
onRestoreProgram(pro);
m_pwPorgramItemList.append(new ProgItem(progDir, pro.object(), mProgTree,this));
}
}
}
readSettings();
if(settings.value("ProgramListSortOrder").toInt()==0) mProgTree->sortByColumn(settings.value("ProgramListSortColumn").toInt(),Qt::SortOrder::AscendingOrder);
else mProgTree->sortByColumn(settings.value("ProgramListSortColumn").toInt(),Qt::SortOrder::DescendingOrder);
// ui->wProgramList->setSortingEnabled( false ); //不使能QT的自动排序
// ui->wProgramList->header()->setSortIndicatorShown( true ); // 设置三角标识符可见
// ui->wProgramList->header()->setSectionsClickable( true ); // 设置标题栏单击响应使能
// connect( ui->wProgramList->header(), SIGNAL( sectionClicked(int) ), this, SLOT( OnClickColumn(int) ) );
}
ProgPanel::~ProgPanel() {
writeSettings();
}
void ProgPanel::OnClickColumn(int iColumn) {
if(iColumn!=ENUM_PROGRAMLISTHEADERITEM_CHECK && iColumn!=ENUM_PROGRAMLISTHEADERITEM_SEND) wProgramList->sortByColumn(iColumn, wProgramList->header()->sortIndicatorOrder());
}
void ProgPanel::writeSettings() {
QSettings settings;
settings.setValue("ProgramListSortColumn", wProgramList->sortColumn());
settings.setValue("ProgramListSortOrder", wProgramList->header()->sortIndicatorOrder());
}
void ProgPanel::readSettings() {
QSettings settings;
if(settings.value("ProgramListSortOrder").toInt()==0) wProgramList->sortByColumn(settings.value("ProgramListSortColumn").toInt(),Qt::SortOrder::AscendingOrder);
else wProgramList->sortByColumn(settings.value("ProgramListSortColumn").toInt(),Qt::SortOrder::DescendingOrder);
if(iColumn!=ENUM_PROGRAMLISTHEADERITEM_CHECK && iColumn!=ENUM_PROGRAMLISTHEADERITEM_SEND) mProgTree->sortByColumn(iColumn, mProgTree->header()->sortIndicatorOrder());
}
void ProgPanel::changeEvent(QEvent *event) {
QWidget::changeEvent(event);
@ -222,86 +222,60 @@ void ProgPanel::transUi() {
for(int i=0;i<m_pwPorgramItemList.count();i++) m_pwPorgramItemList.at(i)->refreshLable();
}
void ProgPanel::onNewClicked(bool f){
Q_UNUSED(f);
wNewProgram *dlg = new wNewProgram(this);
connect(dlg, SIGNAL(sigAcceptData(QString,QSize,QString)), this, SLOT(onCreateNewProgram(QString,QSize,QString)));
dlg->exec();
}
void ProgPanel::onEditClicked(bool){
int cnt = wProgramList->topLevelItemCount();
int cnt = mProgTree->topLevelItemCount();
for(int i=0; i<cnt; i++) {
if(wProgramList->topLevelItem(i)->checkState(0) == Qt::Checked) {
wProgramItem *item = static_cast<wProgramItem*>(wProgramList->topLevelItem(i));
emit item->sigEditProgram();
if(mProgTree->topLevelItem(i)->checkState(0) == Qt::Checked) {
auto item = static_cast<ProgItem*>(mProgTree->topLevelItem(i));
item->onEditProgram();
break;
}
}
}
bool ProgPanel::checkIfNameRepeated(const QString &name, QTreeWidgetItem *skip){
int cnt = wProgramList->topLevelItemCount();
int cnt = mProgTree->topLevelItemCount();
for(int i=0; i<cnt; i++) {
wProgramItem *item = static_cast<wProgramItem*>(wProgramList->topLevelItem(i));
auto item = static_cast<ProgItem*>(mProgTree->topLevelItem(i));
if(item == skip) continue;
if(name == item->name()) {
if(name == item->m_name) {
QMessageBox::warning(this, tr("Warning"), tr("Program name conflicted"));
return true;
}
}
return false;
}
void ProgPanel::onRestoreProgram(const QJsonDocument &pro)
{
m_pwPorgramItemList.append(new wProgramItem(progDir, pro.object(), wProgramList,this));
}
void ProgPanel::onCreateNewProgram(QString name, QSize res, QString remarks)
{
if(checkIfNameRepeated(name)) {
return;
}
auto item = new wProgramItem(progDir, name, res.width(), res.height(), remarks, wProgramList,this);
item->save();//保存pro.json
wProgramList->adjustCheckState();
}
void ProgPanel::onCreateNewProgramOnOpenEditProgramWidget(QString name, QSize res, QString remarks)
{
if(checkIfNameRepeated(name)) return;
auto item = new wProgramItem(progDir, name, res.width(), res.height(), remarks, wProgramList,this);
auto item = new ProgItem(progDir, name, res.width(), res.height(), remarks, mProgTree,this);
item->save();//保存pro.json
wProgramList->adjustCheckState();
mProgTree->adjustCheckState();
item->onEditProgram();
}
void ProgPanel::onDeleteClicked(bool){
auto res = QMessageBox::information(this, tr("Tip Info"), tr("You will delete the selected solution(s),are you sure?"), QMessageBox::Ok, QMessageBox::Cancel);
if(res == QMessageBox::Ok) {
int cnt = wProgramList->topLevelItemCount();
QList<wProgramItem*> list;
int cnt = mProgTree->topLevelItemCount();
QList<ProgItem*> list;
for(int i=0; i<cnt; i++) {
if(wProgramList->topLevelItem(i)->checkState(0) == Qt::Checked) {
wProgramItem *item = static_cast<wProgramItem*>(wProgramList->topLevelItem(i));
if(mProgTree->topLevelItem(i)->checkState(0) == Qt::Checked) {
auto item = static_cast<ProgItem*>(mProgTree->topLevelItem(i));
list.push_back(item);
}
}
while(!list.isEmpty()) {
wProgramItem *item = list.takeFirst();
auto item = list.takeFirst();
item->del();
delete item;
}
wProgramList->adjustCheckState();
mProgTree->adjustCheckState();
}
}
void ProgPanel::onImportClicked(bool){
TipDialog *dlg = new TipDialog(this,ENUM_IMPORT_DLG);
connect(dlg, SIGNAL(sigAcceptData(QString,QString)), this, SLOT(onImportProgram(QString,QString)));
dlg->exec();
}
void ProgPanel::onImportProgram(QString strImportDir, QString){
if(!strImportDir.isEmpty()){
wProgramList->clear();
mProgTree->clear();
//查找根路径下的项目文件夹查找文件夹下的节目pro.json信息包括节目名称大小像素备注等信息
if(!progDir.isEmpty()) {
QDir root_dir(progDir);
@ -313,7 +287,7 @@ void ProgPanel::onImportProgram(QString strImportDir, QString){
fPro.open(QIODevice::ReadOnly);
QJsonDocument pro = QJsonDocument::fromJson(fPro.readAll());
fPro.close();
onRestoreProgram(pro);
m_pwPorgramItemList.append(new ProgItem(progDir, pro.object(), mProgTree,this));
}
}
}
@ -321,60 +295,54 @@ void ProgPanel::onImportProgram(QString strImportDir, QString){
}
void ProgPanel::onExportClicked(bool){
int cnt = wProgramList->topLevelItemCount();
int cnt = mProgTree->topLevelItemCount();
QStringList selectProgramlist;
for(int i=0; i<cnt; i++) {
if(wProgramList->topLevelItem(i)->checkState(0) == Qt::Checked) {
QString string =static_cast<wProgramItem*>(wProgramList->topLevelItem(i))->GetBnName();
if(mProgTree->topLevelItem(i)->checkState(0) == Qt::Checked) {
QString string =static_cast<ProgItem*>(mProgTree->topLevelItem(i))->m_bnName->text();
selectProgramlist.append(string);
}
}
TipDialog *dlg = new TipDialog(this,ENUM_EXPORT_DLG,&selectProgramlist,0);
connect(dlg, SIGNAL(sigAcceptData(QString,QString)), this, SLOT(onExportProgram(QString,QString)));
dlg->exec();
}
void ProgPanel::onExportProgram(QString strImportDir,QString strTip1){
Q_UNUSED(strImportDir);
Q_UNUSED(strTip1);
}
void ProgPanel::FilterProgram(const QString &strtemp){
if (strtemp.isEmpty()) //显示全部
{
for (int i = 0; i< wProgramList->topLevelItemCount(); ++i)
for (int i = 0; i< mProgTree->topLevelItemCount(); ++i)
{
QTreeWidgetItem* topItem = wProgramList->topLevelItem(i);
wProgramList->setRowHidden(i,wProgramList->indexFromItem(topItem->parent()),false);
QTreeWidgetItem* topItem = mProgTree->topLevelItem(i);
mProgTree->setRowHidden(i,mProgTree->indexFromItem(topItem->parent()),false);
}
}
else
{
QList<QTreeWidgetItem*> resultList = wProgramList->findItems(strtemp, Qt::MatchContains,ENUM_PROGRAMLISTHEADERITEM_NAME); //搜索结果
QList<QTreeWidgetItem*> resultList = mProgTree->findItems(strtemp, Qt::MatchContains,ENUM_PROGRAMLISTHEADERITEM_NAME); //搜索结果
if (resultList.size() > 0)
{
for (int i = 0; i< wProgramList->topLevelItemCount(); ++i)
for (int i = 0; i< mProgTree->topLevelItemCount(); ++i)
{
QTreeWidgetItem* topItem = wProgramList->topLevelItem(i);
QTreeWidgetItem* topItem = mProgTree->topLevelItem(i);
if (resultList.contains(topItem))
wProgramList->setRowHidden(i,wProgramList->indexFromItem(topItem->parent()),false); //显示匹配的结果
mProgTree->setRowHidden(i,mProgTree->indexFromItem(topItem->parent()),false); //显示匹配的结果
else
wProgramList->setRowHidden(i,wProgramList->indexFromItem(topItem->parent()),true); //隐藏不匹配的结果
mProgTree->setRowHidden(i,mProgTree->indexFromItem(topItem->parent()),true); //隐藏不匹配的结果
}
}
else {
QList<QTreeWidgetItem*> resultList1 = wProgramList->findItems(strtemp, Qt::MatchContains,ENUM_PROGRAMLISTHEADERITEM_RESOLUTION); //搜索结果
QList<QTreeWidgetItem*> resultList1 = mProgTree->findItems(strtemp, Qt::MatchContains,ENUM_PROGRAMLISTHEADERITEM_RESOLUTION); //搜索结果
if (resultList1.size() > 0){
for (int i = 0; i< wProgramList->topLevelItemCount(); ++i){
QTreeWidgetItem* topItem = wProgramList->topLevelItem(i);
if (resultList1.contains(topItem)) wProgramList->setRowHidden(i,wProgramList->indexFromItem(topItem->parent()),false); //显示匹配的结果
else wProgramList->setRowHidden(i,wProgramList->indexFromItem(topItem->parent()),true); //隐藏不匹配的结果
for (int i = 0; i< mProgTree->topLevelItemCount(); ++i){
QTreeWidgetItem* topItem = mProgTree->topLevelItem(i);
if (resultList1.contains(topItem)) mProgTree->setRowHidden(i,mProgTree->indexFromItem(topItem->parent()),false); //显示匹配的结果
else mProgTree->setRowHidden(i,mProgTree->indexFromItem(topItem->parent()),true); //隐藏不匹配的结果
}
}
else {
for (int i = 0; i< wProgramList->topLevelItemCount(); ++i){
QTreeWidgetItem* topItem = wProgramList->topLevelItem(i);
wProgramList->setRowHidden(i,wProgramList->indexFromItem(topItem->parent()),true); //隐藏不匹配的结果
for (int i = 0; i< mProgTree->topLevelItemCount(); ++i){
QTreeWidgetItem* topItem = mProgTree->topLevelItem(i);
mProgTree->setRowHidden(i,mProgTree->indexFromItem(topItem->parent()),true); //隐藏不匹配的结果
}
}
}

View File

@ -17,39 +17,34 @@
#include <QFile>
#include <QStandardPaths>
#include <QStringList>
#include <QJsonValue>
#include <QJsonObject>
#include <QJsonDocument>
#include <QSettings>
#include "cfg.h"
#include <base/loqtreewidget.h>
#include <wProgramManager/wnewprogram.h>
#include <wProgramManager/progcreatedlg.h>
#include <wProgramManager/progeditorwin.h>
#include "wProgramManager/wprogramitem.h"
#include "wProgramManager/progitem.h"
class ProgPanel : public QWidget {
Q_OBJECT
public:
explicit ProgPanel(QWidget *parent = nullptr);
~ProgPanel();
explicit ProgPanel(QSettings &settings, QWidget *parent = nullptr);
QTreeWidgetItem *m_headerItem = nullptr;
LoQTreeWidget *mProgTree = nullptr;
protected:
void changeEvent(QEvent *) override;
void transUi();
bool checkIfNameRepeated(const QString &name, QTreeWidgetItem *skip = nullptr);
public slots:
void onNewClicked(bool f);
void onEditClicked(bool f);
void onDeleteClicked(bool f);
void onImportClicked(bool f);
void onExportClicked(bool f);
void onRestoreProgram(const QJsonDocument &pro);
void onCreateNewProgram(QString name, QSize res, QString remarks);
void onCreateNewProgramOnOpenEditProgramWidget(QString name, QSize res, QString remarks);
void onImportProgram(QString strImportDir,QString strTip1);
void onExportProgram(QString strImportDir,QString strTip1);
void FilterProgram(const QString &strtemp);
private slots:
@ -57,10 +52,7 @@ private slots:
private:
QString progDir;
QList<wProgramItem *> m_pwPorgramItemList;
void readSettings();
void writeSettings();
LoQTreeWidget *wProgramList = nullptr;
QList<ProgItem *> m_pwPorgramItemList;
QPushButton *bnNew = nullptr;
QPushButton *bnEdit = nullptr;
QPushButton *bnDelete = nullptr;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,116 @@
#include "progcreatedlg.h"
#include "gqt.h"
#include "ui_wnewprogram.h"
ProgCreateDlg::ProgCreateDlg(QString name, int width, int height, QString remarks, QWidget *parent, bool lockName) : BaseDlg(parent) {
auto vBox = new VBox(this);
auto hBox = new HBox(vBox);
hBox->setContentsMargins(0, 0, 0, 0);
hBox->addStretch();
auto label = new QLabel(tr("Solution Information"));
hBox->addWidget(label);
hBox->addStretch();
auto btnClose = new QPushButton("X");
btnClose->setProperty("ssType", "progManageTool");
connect(btnClose, &QPushButton::clicked, this, &QDialog::close);
hBox->addWidget(btnClose);
auto line = new QFrame;
line->setFrameShape(QFrame::HLine);
line->setFrameShadow(QFrame::Sunken);
vBox->addWidget(line);
hBox = new HBox(vBox);
label = new QLabel(tr("Solution Name"));
label->setMinimumWidth(90);
label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
hBox->addWidget(label);
hBox->addSpacing(6);
fdName = new QLineEdit(name);
if(lockName) fdName->setDisabled(true);
hBox->addWidget(fdName);
hBox = new HBox(vBox);
hBox->setSpacing(12);
label = new QLabel(tr("Resolution"));
label->setMinimumWidth(90);
label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
hBox->addWidget(label);
hBox->addSpacing(6);
auto label_4 = new QLabel(tr("Width"));
hBox->addWidget(label_4);
fdWidth = new QSpinBox;
fdWidth->setMaximum(99999);
fdWidth->setValue(width);
hBox->addWidget(fdWidth);
auto label_5 = new QLabel(tr("Height"));
hBox->addWidget(label_5);
fdHeight = new QSpinBox;
fdHeight->setMaximum(99999);
fdHeight->setValue(height);
hBox->addWidget(fdHeight);
hBox->addStretch();
hBox = new HBox(vBox);
label = new QLabel(tr("Remarks"));
label->setMinimumWidth(90);
label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
hBox->addWidget(label);
hBox->addSpacing(6);
fdRemark = new QTextEdit(remarks);
fdRemark->setFixedSize(300, 80);
hBox->addWidget(fdRemark);
line = new QFrame;
line->setFrameShape(QFrame::HLine);
line->setFrameShadow(QFrame::Sunken);
vBox->addWidget(line);
hBox = new HBox(vBox);
auto lbSplitWidth = new QLabel(tr("节目超宽需要打折, 请输入打折宽度"));
lbSplitWidth->setVisible(false);
hBox->addWidget(lbSplitWidth);
fdSplitWidth = new QSpinBox;
fdSplitWidth->setVisible(false);
fdSplitWidth->setMaximum(1920);
hBox->addWidget(fdSplitWidth);
hBox->addStretch();
connect(fdWidth, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, this, [this, lbSplitWidth](int value) {
if(value > 1920) {
fdSplitWidth->show();
lbSplitWidth->show();
int den = (value+1919) / 1920;
fdSplitWidth->setValue((value+den-1) / den);
} else {
fdSplitWidth->hide();
lbSplitWidth->hide();
fdSplitWidth->setValue(0);
}
});
hBox = new HBox(vBox);
hBox->addStretch();
auto bnOK = new QPushButton(tr("OK"));
connect(bnOK, &QPushButton::clicked, this, &QDialog::accept);
hBox->addWidget(bnOK);
auto bnCancel = new QPushButton(tr("Cancel"));
connect(bnCancel, &QPushButton::clicked, this, &QDialog::reject);
hBox->addWidget(bnCancel);
}

View File

@ -0,0 +1,20 @@
#ifndef PROGCREATEDLG_H
#define PROGCREATEDLG_H
#include "basedlg.h"
#include <QLineEdit>
#include <QTextEdit>
#include <QSpinBox>
class ProgCreateDlg : public BaseDlg {
Q_OBJECT
public:
ProgCreateDlg(QString name, int width, int height, QString remarks, QWidget *parent = nullptr, bool lockName = false);
QLineEdit *fdName;
QSpinBox *fdWidth;
QSpinBox *fdHeight;
QTextEdit *fdRemark;
QSpinBox *fdSplitWidth;
};
#endif // PROGCREATEDLG_H

View File

@ -21,7 +21,7 @@
#include "wProgramManager/emultiwin.h"
#include "wProgramManager/mconverter.h"
#include "wProgramManager/sendprogramdialog.h"
#include "wnewprogram.h"
#include "progcreatedlg.h"
#include <QBoxLayout>
#include <QCloseEvent>
#include <QGraphicsDropShadowEffect>
@ -108,29 +108,27 @@ ProgEditorWin::ProgEditorWin(QString &name, int &w, int &h, QString &remarks, co
toolBar->addAction(action);
action = new QAction(QIcon(":/res/ProgramManager/EditProgram/Setting.png"), tr("Setting"));
connect(action, &QAction::triggered, this, [this](){
wNewProgram *dlg = new wNewProgram(m_name, QSize(gProgWidth, gProgHeight), m_remarks, this, true);
connect(dlg, &wNewProgram::sigAcceptData, this, [this](QString , QSize size, QString remarks){
gProgWidth = size.width();
gProgHeight = size.height();
m_remarks = remarks;
emit sProgramChanged();
int n = listPage->count();
for(int i=0; i<n; i++) {
auto page = static_cast<PageListItem*>(listPage->item(i));
page->mScene->setSceneRect(0, 0, gProgWidth, gProgHeight);
page->mGraView->resetTransform();
qreal scale = qMin(page->mGraView->width() / page->mScene->width(), page->mGraView->height() / page->mScene->height());
page->mGraView->scale(scale, scale);
ProgCreateDlg dlg(m_name, gProgWidth, gProgHeight, m_remarks, this, true);
if(dlg.exec() != QDialog::Accepted) return;
gProgWidth = dlg.fdWidth->value();
gProgHeight = dlg.fdHeight->value();
m_remarks = dlg.fdRemark->toPlainText();
emit sProgramChanged();
int n = listPage->count();
for(int i=0; i<n; i++) {
auto page = static_cast<PageListItem*>(listPage->item(i));
page->mScene->setSceneRect(0, 0, gProgWidth, gProgHeight);
page->mGraView->resetTransform();
qreal scale = qMin(page->mGraView->width() / page->mScene->width(), page->mGraView->height() / page->mScene->height());
page->mGraView->scale(scale, scale);
auto items = page->mScene->items();
foreach(auto item, items) {
auto element = static_cast<EBase*>(item);
if(element->mMultiWin == nullptr) element->fitProgSize();
}
page->mScene->update();
auto items = page->mScene->items();
foreach(auto item, items) {
auto element = static_cast<EBase*>(item);
if(element->mMultiWin == nullptr) element->fitProgSize();
}
});
dlg->exec();
page->mScene->update();
}
});
toolBar->addAction(action);
toolBar->addSeparator();

View File

@ -1,4 +1,4 @@
#include "wprogramitem.h"
#include "progitem.h"
#include "tools.h"
#include "progeditorwin.h"
#include "mconverter.h"
@ -8,11 +8,7 @@
#include "sendprogramdialog.h"
#include "mainwindow.h"
wProgramItem::wProgramItem(const QString &pRoot, const QString &name, int w, int h, const QString &remarks, LoQTreeWidget *parent,QWidget *pWnd) :
QObject(parent),
QTreeWidgetItem(UserType),
m_parent(parent)
{
ProgItem::ProgItem(const QString &pRoot, const QString &name, int w, int h, const QString &remarks, LoQTreeWidget *parent,QWidget *pWnd) : QObject(parent), QTreeWidgetItem(UserType), m_parent(parent) {
m_name = name;
m_width = w;
m_height = h;
@ -24,15 +20,9 @@ wProgramItem::wProgramItem(const QString &pRoot, const QString &name, int w, int
m_orgName = m_name;
m_pWnd = pWnd;
init();
emit sigEditProgram();
}
wProgramItem::wProgramItem(const QString &pRoot, const QJsonObject &json, LoQTreeWidget *parent,QWidget *pWnd) :
QObject(parent),
QTreeWidgetItem(UserType),
m_parent(parent)
{
ProgItem::ProgItem(const QString &pRoot, const QJsonObject &json, LoQTreeWidget *parent,QWidget *pWnd) : QObject(parent), QTreeWidgetItem(UserType), m_parent(parent) {
m_name = json["name"].toString();
m_width = json["resolution"]["w"].toInt();
m_height = json["resolution"]["h"].toInt();
@ -45,11 +35,8 @@ wProgramItem::wProgramItem(const QString &pRoot, const QJsonObject &json, LoQTre
m_pWnd = pWnd;
init();
}
QString wProgramItem::GetBnName()
{
return m_bnName->text();
}
void wProgramItem::init()
void ProgItem::init()
{
auto cfg = Tools::getInstance();
setData(ENUM_PROGRAMLISTHEADERITEM_NAME, 0,m_name);
@ -79,7 +66,6 @@ QPushButton:hover {
m_bnName->setCursor(QCursor(Qt::PointingHandCursor));
m_parent->setItemWidget(this, ENUM_PROGRAMLISTHEADERITEM_NAME, m_bnName);
connect(m_bnName, SIGNAL(clicked()), this, SLOT(onEditProgram()));
connect(this,SIGNAL(sigEditProgram()),this, SLOT(onEditProgram()));
m_bnExport = new QPushButton();
m_bnExport->setCursor(QCursor(Qt::PointingHandCursor));
m_bnExport->setToolTip(tr("ExportButtonTip"));
@ -110,13 +96,13 @@ QPushButton:hover{background-color: #cccccc;}
m_parent->setItemWidget(this, ENUM_PROGRAMLISTHEADERITEM_SEND, m_bnSend);
connect(m_bnSend, SIGNAL(clicked()), this, SLOT(onSendProgram()));
}
void wProgramItem::refreshLable()
void ProgItem::refreshLable()
{
m_bnExport->setToolTip(tr("ExportButtonTip"));
m_bnSend->setToolTip(tr("SendButtonTip"));
}
QJsonObject wProgramItem::jRoot()
QJsonObject ProgItem::jRoot()
{
QJsonObject oRoot;
QJsonObject oSize;
@ -130,7 +116,7 @@ QJsonObject wProgramItem::jRoot()
return oRoot;
}
void wProgramItem::save() {
void ProgItem::save() {
QDir dRoot(mProgDir);
QDir dParent(m_strSavePath);
if(!dRoot.exists()) {
@ -151,7 +137,7 @@ void wProgramItem::save() {
}
}
void wProgramItem::del()
void ProgItem::del()
{
QDir dRoot(mProgDir);
if(dRoot.exists()) {
@ -159,7 +145,7 @@ void wProgramItem::del()
}
}
//设置列表项的值
void wProgramItem::onSetProgram()
void ProgItem::onSetProgram()
{
auto cfg = Tools::getInstance();
m_bnName->setText(m_name);
@ -172,7 +158,7 @@ void wProgramItem::onSetProgram()
save();
}
void wProgramItem::onEditProgram() {
void ProgItem::onEditProgram() {
auto editor = new ProgEditorWin(m_name, m_width, m_height, m_remarks, mProgDir, m_strSavePath, gMainWin);
connect(editor, &ProgEditorWin::sProgramChanged, this, [this]{
m_last = QDateTime::currentDateTime();
@ -183,12 +169,12 @@ void wProgramItem::onEditProgram() {
editor->show();
}
void wProgramItem::onUsbExportProgram(){
void ProgItem::onUsbExportProgram(){
auto pDlg = new UsbDetectDialog(gMainWin);
connect(pDlg, &UsbDetectDialog::acceptData, this, &wProgramItem::onUsbExportProgramPro);
connect(pDlg, &UsbDetectDialog::acceptData, this, &ProgItem::onUsbExportProgramPro);
pDlg->exec();
}
void wProgramItem::onUsbExportProgramPro(QString strPath, QString strPassword){
void ProgItem::onUsbExportProgramPro(QString strPath, QString strPassword){
LoEmptyDialog * msgbox = new LoEmptyDialog(m_pWnd);
QString strUsbProgramName = m_name;
auto converter = new mConverter(strUsbProgramName, strPath + (strPath.endsWith('/') ? "program.zip" : "/program.zip"), strPassword, this);
@ -204,7 +190,7 @@ void wProgramItem::onUsbExportProgramPro(QString strPath, QString strPassword){
msgbox->exec();
}
void wProgramItem::onSendProgram(){
void ProgItem::onSendProgram(){
LoEmptyDialog * msgbox = new LoEmptyDialog(m_pWnd);
//转换节目
auto converter = new mConverter(m_name, "", "", this);

View File

@ -0,0 +1,62 @@
#ifndef PROGITEM_H
#define PROGITEM_H
#include <QObject>
#include <QTreeWidget>
#include <QTreeWidgetItem>
#include <QDir>
#include <QDateTime>
#include <QJsonObject>
#include <QJsonDocument>
#include <QPushButton>
#include <base/loqtreewidget.h>
class ProgItem : public QObject, public QTreeWidgetItem{
Q_OBJECT
public:
explicit ProgItem(const QString &pRoot, const QString &name, int w, int h, const QString & remarks, LoQTreeWidget *parent = nullptr,QWidget *pWnd=nullptr);
explicit ProgItem(const QString &pRoot, const QJsonObject &json, LoQTreeWidget *parent = nullptr,QWidget *pWnd=nullptr);
void save();
void del();
QJsonObject jRoot();
void refreshLable();
QString m_name;
int m_width;
int m_height;
QString m_remarks;
qint64 m_fsize;
QDateTime m_last;
QPushButton *m_bnName;
public slots:
void onSetProgram();
void onEditProgram();
void onSendProgram();
void onUsbExportProgram();
void onUsbExportProgramPro(QString strPath,QString strPassword);
private:
void init();
QPushButton *m_bnExport;
QPushButton *m_bnSend;
LoQTreeWidget *m_parent;
QString m_strSavePath;
QString mProgDir;
QString m_orgName;
QWidget *m_pWnd=nullptr;
};
enum ENUM_PROGRAMLISTHEADERITEM
{
ENUM_PROGRAMLISTHEADERITEM_CHECK=0,
ENUM_PROGRAMLISTHEADERITEM_NAME,
ENUM_PROGRAMLISTHEADERITEM_RESOLUTION,
ENUM_PROGRAMLISTHEADERITEM_SIZE,
ENUM_PROGRAMLISTHEADERITEM_LASTTIME,
ENUM_PROGRAMLISTHEADERITEM_USB_EXPORT,
ENUM_PROGRAMLISTHEADERITEM_SEND,
ENUM_PROGRAMLISTHEADERITEM_END
};
#endif // PROGITEM_H

View File

@ -1,42 +0,0 @@
#include "wnewprogram.h"
#include "ui_wnewprogram.h"
wNewProgram::wNewProgram(QWidget *parent) :
BaseDlg(parent),
ui(new Ui::wNewProgram)
{
setAttribute(Qt::WA_DeleteOnClose);
ui->setupUi(this);
//ui->pName->setText(tr("New") + QDateTime::currentDateTime().toString("yyyyMMddhhmmsszzz"));
ui->pName->setText(QDateTime::currentDateTime().toString("yyyyMMddhhmmsszzz"));
ui->pWidth->setValue(512);
ui->pHeight->setValue(512);
ui->pRemarks->setText("");
connect(this, SIGNAL(accepted()), this, SLOT(onAccepted()));
}
wNewProgram::wNewProgram(QString name, QSize res, QString remarks, QWidget *parent, bool lockName) :
BaseDlg(parent),
ui(new Ui::wNewProgram)
{
setAttribute(Qt::WA_DeleteOnClose);
ui->setupUi(this);
ui->pName->setText(name);
ui->pName->setDisabled(lockName);
ui->pWidth->setValue(res.width());
ui->pHeight->setValue(res.height());
ui->pRemarks->setText(remarks);
connect(this, SIGNAL(accepted()), this, SLOT(onAccepted()));
}
wNewProgram::~wNewProgram()
{
delete ui;
}
void wNewProgram::onAccepted()
{
emit sigAcceptData(ui->pName->text(),
QSize(ui->pWidth->value(), ui->pHeight->value()),
ui->pRemarks->document()->toPlainText());
}

View File

@ -1,30 +0,0 @@
#ifndef WNEWPROGRAM_H
#define WNEWPROGRAM_H
#include <basedlg.h>
#include <QDateTime>
namespace Ui {
class wNewProgram;
}
class wNewProgram : public BaseDlg
{
Q_OBJECT
public:
explicit wNewProgram(QWidget *parent = nullptr);
wNewProgram(QString name, QSize res, QString remarks, QWidget *parent = nullptr, bool lockName = false);
~wNewProgram();
signals:
void sigAcceptData(QString name, QSize res, QString remarks);
protected slots:
void onAccepted();
private:
Ui::wNewProgram *ui;
};
#endif // WNEWPROGRAM_H

View File

@ -1,415 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>wNewProgram</class>
<widget class="QDialog" name="wNewProgram">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>434</width>
<height>236</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QFrame" name="frame">
<property name="mouseTracking">
<bool>true</bool>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Solution Information</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="maximumSize">
<size>
<width>31</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>X</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_2">
<property name="styleSheet">
<string notr="true">border-top: 1.5px solid gray; </string>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>1</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>6</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Solution Name</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLineEdit" name="pName">
<property name="minimumSize">
<size>
<width>240</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,0,0,0,0,0,1">
<property name="spacing">
<number>12</number>
</property>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Resolution</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Width</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="pWidth">
<property name="maximum">
<number>99999</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Height</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="pHeight">
<property name="maximum">
<number>99999</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Remarks</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="pRemarks">
<property name="minimumSize">
<size>
<width>240</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>240</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>1</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line">
<property name="styleSheet">
<string notr="true">border-top: 1px solid gray; </string>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="bnOK">
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="bnCancel">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>bnOK</sender>
<signal>clicked()</signal>
<receiver>wNewProgram</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>307</x>
<y>288</y>
</hint>
<hint type="destinationlabel">
<x>199</x>
<y>149</y>
</hint>
</hints>
</connection>
<connection>
<sender>bnCancel</sender>
<signal>clicked()</signal>
<receiver>wNewProgram</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>388</x>
<y>288</y>
</hint>
<hint type="destinationlabel">
<x>199</x>
<y>149</y>
</hint>
</hints>
</connection>
<connection>
<sender>pushButton</sender>
<signal>clicked()</signal>
<receiver>wNewProgram</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>407</x>
<y>22</y>
</hint>
<hint type="destinationlabel">
<x>216</x>
<y>117</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -1,90 +0,0 @@
#ifndef WPROGRAMITEM_H
#define WPROGRAMITEM_H
#include <QObject>
#include <QTreeWidget>
#include <QTreeWidgetItem>
#include <QDir>
#include <QDateTime>
#include <QJsonObject>
#include <QJsonDocument>
#include <QPushButton>
#include <base/loqtreewidget.h>
class wProgramItem : public QObject, public QTreeWidgetItem{
Q_OBJECT
Q_PROPERTY(QString name MEMBER m_name READ name WRITE setName NOTIFY nameChanged )
Q_PROPERTY(int width MEMBER m_width READ width WRITE setWidth NOTIFY widthChanged )
Q_PROPERTY(int height MEMBER m_height READ height WRITE setHeight NOTIFY heightChanged )
Q_PROPERTY(QString remarks MEMBER m_remarks READ remarks WRITE setRemarks NOTIFY remarksChanged)
Q_PROPERTY(int fsize MEMBER m_fsize READ fsize WRITE setFsize NOTIFY fsizeChanged )
Q_PROPERTY(QDateTime last MEMBER m_last READ last WRITE setLast NOTIFY lastChanged )
public:
explicit wProgramItem(const QString &pRoot, const QString &name, int w, int h, const QString & remarks, LoQTreeWidget *parent = nullptr,QWidget *pWnd=nullptr);
explicit wProgramItem(const QString &pRoot, const QJsonObject &json, LoQTreeWidget *parent = nullptr,QWidget *pWnd=nullptr);
void save();
void del();
QJsonObject jRoot();
void refreshLable();
QString name() const { return m_name; }
int width() const { return m_width; }
int height() const { return m_height; }
QString remarks() const { return m_remarks; }
qint64 fsize() const { return m_fsize; }
QDateTime last() const { return m_last; }
void setName(const QString &s) { m_name = s; }
void setWidth(int w) { m_width = w; }
void setHeight(int h) { m_height = h; }
void setRemarks(const QString &s) { m_remarks = s; }
void setFsize(qint64 n) { m_fsize = n; }
void setLast(const QDateTime &s) { m_last = s; }
QString GetBnName();
signals:
void nameChanged(const QString &);
void widthChanged(int);
void heightChanged(int);
void remarksChanged(const QString &);
void fsizeChanged(quint64);
void lastChanged(const QDateTime &);
void sigEditProgram();
protected slots:
void onSetProgram();
void onEditProgram();
void onSendProgram();
void onUsbExportProgram();
void onUsbExportProgramPro(QString strPath,QString strPassword);
private:
void init();
QPushButton *m_bnExport;
QPushButton *m_bnSend;
QString m_name;
int m_width;
int m_height;
QString m_remarks;
qint64 m_fsize;
QDateTime m_last;
LoQTreeWidget *m_parent;
QPushButton *m_bnName;
QString m_strSavePath;
QString mProgDir;
QString m_orgName;
QWidget *m_pWnd=nullptr;
};
enum ENUM_PROGRAMLISTHEADERITEM
{
ENUM_PROGRAMLISTHEADERITEM_CHECK=0,
ENUM_PROGRAMLISTHEADERITEM_NAME,
ENUM_PROGRAMLISTHEADERITEM_RESOLUTION,
ENUM_PROGRAMLISTHEADERITEM_SIZE,
ENUM_PROGRAMLISTHEADERITEM_LASTTIME,
ENUM_PROGRAMLISTHEADERITEM_USB_EXPORT,
ENUM_PROGRAMLISTHEADERITEM_SEND,
ENUM_PROGRAMLISTHEADERITEM_END
};
#endif // WPROGRAMITEM_H