ledok
This commit is contained in:
parent
78549a6307
commit
377842f83e
|
@ -55,7 +55,6 @@ SOURCES += \
|
|||
base/changepasswordform.cpp \
|
||||
base/customprogressindicator.cpp \
|
||||
base/loemptydialog.cpp \
|
||||
base/pixbmpshowdialog.cpp \
|
||||
base/softconfigdialog.cpp \
|
||||
base/switchcontrol.cpp \
|
||||
base/taesclass.cpp \
|
||||
|
@ -147,7 +146,6 @@ HEADERS += \
|
|||
base/changepasswordform.h \
|
||||
base/customprogressindicator.h \
|
||||
base/loemptydialog.h \
|
||||
base/pixbmpshowdialog.h \
|
||||
base/softconfigdialog.h \
|
||||
base/switchcontrol.h \
|
||||
base/taesclass.h \
|
||||
|
@ -234,14 +232,12 @@ HEADERS += \
|
|||
program/wprogrampublishitem.h \
|
||||
|
||||
FORMS += \
|
||||
base/pixbmpshowdialog.ui \
|
||||
base/updateledset3dialog.ui \
|
||||
base/x_uimsgboxok.ui \
|
||||
mguangyingpinwidget.ui \
|
||||
device/controlpowerschedule.ui \
|
||||
device/controltestwidget.ui \
|
||||
device/controlvolumeschedule.ui \
|
||||
program/wplanitem.ui \
|
||||
|
||||
TRANSLATIONS += \
|
||||
translations/app_zh_CN.ts \
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
#include "pixbmpshowdialog.h"
|
||||
#include "ui_pixbmpshowdialog.h"
|
||||
#include <QPainter>
|
||||
PixbmpShowDialog::PixbmpShowDialog(QWidget *parent) :
|
||||
BaseDlg(parent),
|
||||
ui(new Ui::PixbmpShowDialog)
|
||||
{
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
ui->setupUi(this);
|
||||
|
||||
}
|
||||
|
||||
PixbmpShowDialog::~PixbmpShowDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
void PixbmpShowDialog::ResizeByPixmap(int w,int h)
|
||||
{
|
||||
m_iWidth=w;
|
||||
m_iHeight=h;
|
||||
int iWidth=w;
|
||||
int iHeight=h;
|
||||
if(iWidth<rect().width()&&iHeight<rect().height())
|
||||
this->resize(iWidth,iHeight);
|
||||
else {
|
||||
if(iWidth>iHeight)
|
||||
this->resize(rect().height()*iWidth/iHeight,rect().height());
|
||||
else
|
||||
this->resize(rect().width(),rect().width()*iHeight/iWidth);
|
||||
}
|
||||
}
|
||||
void PixbmpShowDialog::paintEvent(QPaintEvent * event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
QPainter painter(this);
|
||||
//painter.eraseRect(rect());
|
||||
// painter.scale(m_PixMap.width(), m_PixMap.height());
|
||||
QRectF sourceRt(0,0,m_iWidth,m_iHeight);
|
||||
painter.drawPixmap(rect(), m_PixMap,sourceRt);
|
||||
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
#ifndef PIXBMPSHOWDIALOG_H
|
||||
#define PIXBMPSHOWDIALOG_H
|
||||
|
||||
#include <basedlg.h>
|
||||
|
||||
namespace Ui {
|
||||
class PixbmpShowDialog;
|
||||
}
|
||||
|
||||
class PixbmpShowDialog : public BaseDlg
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PixbmpShowDialog(QWidget *parent = nullptr);
|
||||
~PixbmpShowDialog();
|
||||
QPixmap m_PixMap;
|
||||
void ResizeByPixmap(int w,int h);
|
||||
int m_iWidth;
|
||||
int m_iHeight;
|
||||
|
||||
public:
|
||||
virtual void paintEvent(QPaintEvent *);
|
||||
|
||||
private:
|
||||
Ui::PixbmpShowDialog *ui;
|
||||
|
||||
};
|
||||
|
||||
#endif // PIXBMPSHOWDIALOG_H
|
|
@ -1,88 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PixbmpShowDialog</class>
|
||||
<widget class="QDialog" name="PixbmpShowDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<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="pushButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>X</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>pushButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>PixbmpShowDialog</receiver>
|
||||
<slot>close()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>199</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>199</x>
|
||||
<y>149</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -6,16 +6,12 @@
|
|||
#include <QPushButton>
|
||||
#include <QSettings>
|
||||
|
||||
SoftConfigDialog::SoftConfigDialog(QWidget *parent) : BaseDlg(parent) {
|
||||
SoftConfigDialog::SoftConfigDialog(QWidget *parent) : QDialog(parent) {
|
||||
setWindowFlag(Qt::WindowContextHelpButtonHint, 0);
|
||||
resize(400, 300);
|
||||
setWindowTitle(tr("Software Config"));
|
||||
auto vbox = new QVBoxLayout(this);
|
||||
|
||||
auto pushButton = new QPushButton("X");
|
||||
pushButton->setMinimumSize(30, 24);
|
||||
connect(pushButton, &QPushButton::clicked, this, &QWidget::close);
|
||||
vbox->addWidget(pushButton, 0, Qt::AlignRight);
|
||||
|
||||
press_fd = new QCheckBox(tr("Video compress to")+" 720p");
|
||||
press_fd->setChecked(gVideoCompress);
|
||||
vbox->addWidget(press_fd);
|
||||
|
@ -31,7 +27,7 @@ SoftConfigDialog::SoftConfigDialog(QWidget *parent) : BaseDlg(parent) {
|
|||
hbox->addWidget(anti_fd, 0, Qt::AlignTop);
|
||||
|
||||
auto anti_tip = new QLabel(tr("TextAntilaTip"));
|
||||
anti_tip->setStyleSheet("color:#FF0000;");
|
||||
anti_tip->setStyleSheet("QLabel{color: #f00;}");
|
||||
anti_tip->setWordWrap(true);
|
||||
hbox->addWidget(anti_tip);
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
#ifndef SOFTCONFIGDIALOG_H
|
||||
#define SOFTCONFIGDIALOG_H
|
||||
|
||||
#include "basedlg.h"
|
||||
#include <QDialog>
|
||||
#include <QCheckBox>
|
||||
|
||||
class SoftConfigDialog : public BaseDlg {
|
||||
class SoftConfigDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SoftConfigDialog(QWidget *parent = nullptr);
|
||||
explicit SoftConfigDialog(QWidget *parent = 0);
|
||||
|
||||
QCheckBox *press_fd, *trans_fd, *anti_fd, *guangying_fd, *fdWidthSplit;
|
||||
};
|
||||
|
|
|
@ -1216,21 +1216,29 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
json.insert("_id", "GetMinBrightness");
|
||||
json.insert("_type", "GetMinBrightness");
|
||||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("GetMinBrightness"));
|
||||
auto waitingDlg = new WaitingDlg(this, tr("GetMinBrightness")+" ...");
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [this, reply, waitingDlg] {
|
||||
auto brightLevel = card->BrightnessLevel;
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSingleGetReply
|
||||
waitingDlg->success();
|
||||
fdMinBright->setText(QString::number(json["minBrightnessPercentage"].toInt()));
|
||||
auto value = json["minBrightnessPercentage"].toInt(-1);
|
||||
if(value==-1) value = qRound(json["brightness"].toInt() * 100.0 / brightLevel);
|
||||
fdMinBright->setText(QString::number(value));
|
||||
});
|
||||
} else {
|
||||
foreach(auto card, *gSelCards) {
|
||||
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||
auto cardId = card->m_strCardId;
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
||||
auto brightLevel = card->BrightnessLevel;
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
QJsonDocument json;
|
||||
QString err = checkReplyForJson(reply, &json);
|
||||
if(err.isEmpty()) err = QString::number(json["minBrightnessPercentage"].toInt());
|
||||
if(err.isEmpty()) {
|
||||
auto value = json["minBrightnessPercentage"].toInt(-1);
|
||||
if(value==-1) value = qRound(json["brightness"].toInt() * 100.0 / brightLevel);
|
||||
err = QString::number(value)+"%";
|
||||
}
|
||||
gFdResInfo->append(cardId+" "+tr("GetMinBrightness")+" "+err);
|
||||
});
|
||||
}
|
||||
|
@ -1285,21 +1293,29 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
json.insert("_id", "GetMaxBrightness");
|
||||
json.insert("_type", "GetMaxBrightness");
|
||||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("GetMaxBrightness"));
|
||||
auto waitingDlg = new WaitingDlg(this, tr("GetMaxBrightness")+" ...");
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [this, reply, waitingDlg] {
|
||||
auto brightLevel = card->BrightnessLevel;
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSingleGetReply
|
||||
waitingDlg->success();
|
||||
fdMaxBright->setText(QString::number(json["maxBrightnessPercentage"].toInt()));
|
||||
auto value = json["maxBrightnessPercentage"].toInt(-1);
|
||||
if(value==-1) value = qRound(json["brightness"].toInt() * 100.0 / brightLevel);
|
||||
fdMaxBright->setText(QString::number(value));
|
||||
});
|
||||
} else {
|
||||
foreach(auto card, *gSelCards) {
|
||||
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||
auto cardId = card->m_strCardId;
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
||||
auto brightLevel = card->BrightnessLevel;
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
QJsonDocument json;
|
||||
QString err = checkReplyForJson(reply, &json);
|
||||
if(err.isEmpty()) err = QString::number(json["maxBrightnessPercentage"].toInt());
|
||||
if(err.isEmpty()) {
|
||||
auto value = json["maxBrightnessPercentage"].toInt(-1);
|
||||
if(value==-1) value = qRound(json["brightness"].toInt() * 100.0 / brightLevel);
|
||||
err = QString::number(value)+"%";
|
||||
}
|
||||
gFdResInfo->append(cardId+" "+tr("GetMaxBrightness")+" "+err);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -209,7 +209,7 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
|
|||
auto waitingDlg = new WaitingDlg(this, tr("GetMinBrightness")+" ...");
|
||||
Def_CtrlReqPre
|
||||
auto brightLevel = card->BrightnessLevel;
|
||||
connect(reply, &QNetworkReply::finished, this, [this, reply, waitingDlg, brightLevel] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSingleGetReply
|
||||
waitingDlg->success();
|
||||
auto value = json["minBrightnessPercentage"].toInt(-1);
|
||||
|
@ -221,7 +221,7 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
|
|||
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||
auto cardId = card->m_strCardId;
|
||||
auto brightLevel = card->BrightnessLevel;
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, cardId, brightLevel] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
QJsonDocument json;
|
||||
QString err = checkReplyForJson(reply, &json);
|
||||
if(err.isEmpty()) {
|
||||
|
|
|
@ -326,27 +326,18 @@ CtrlNetworkPanel::CtrlNetworkPanel(QWidget *parent) : QWidget(parent) {
|
|||
return;
|
||||
}
|
||||
auto isWifi = fdIsWifi->isChecked();
|
||||
if(isWifi) {
|
||||
QJsonObject json;
|
||||
json.insert("_id", "SetSwitchWiFi");
|
||||
json.insert("_type", "SetSwitchWiFi");
|
||||
json.insert("enable", isWifi);
|
||||
QString tip;
|
||||
json.insert("enable", true);
|
||||
QJsonObject json2;
|
||||
if(isWifi) {
|
||||
tip = tr("ConfigurationWiFi");
|
||||
json2.insert("_id", "ConfigurationWiFi");
|
||||
json2.insert("_type", "ConfigurationWiFi");
|
||||
json2.insert("ssid", fdWifiName->currentText());
|
||||
json2.insert("password", fdWifiPassword->text());
|
||||
} else if(fdIsHotspot->isChecked()) {
|
||||
tip = tr("ConfigurationHotSpot");
|
||||
json2.insert("_id", "ConfigurationHotSpot");
|
||||
json2.insert("_type", "ConfigurationHotSpot");
|
||||
json2.insert("apName", fdHotspotName->text());
|
||||
json2.insert("password", fdHotspotPassword->text());
|
||||
}
|
||||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tip+" ...");
|
||||
auto waitingDlg = new WaitingDlg(this, tr("ConfigurationWiFi")+" ...");
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, card, [=] {
|
||||
QString err = checkReplyForJson(reply);
|
||||
|
@ -367,17 +358,35 @@ CtrlNetworkPanel::CtrlNetworkPanel(QWidget *parent) : QWidget(parent) {
|
|||
connect(reply, &QNetworkReply::finished, card, [=] {
|
||||
QString err = checkReplyForJson(reply);
|
||||
if(! err.isEmpty()) {
|
||||
gFdResInfo->append(card->m_strCardId+" "+tip+" "+err);
|
||||
gFdResInfo->append(card->m_strCardId+" "+tr("ConfigurationWiFi")+" "+err);
|
||||
return;
|
||||
}
|
||||
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json2);
|
||||
connect(reply, &QNetworkReply::finished, card, [=] {
|
||||
QString err = checkReplyForJson(reply);
|
||||
gFdResInfo->append(card->m_strCardId+" "+tip+" "+(err.isEmpty()?QCoreApplication::translate("Def","Success"):err));
|
||||
gFdResInfo->append(card->m_strCardId+" "+tr("ConfigurationWiFi")+" "+(err.isEmpty()?QCoreApplication::translate("Def","Success"):err));
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
QJsonObject json;
|
||||
json.insert("_id", "ConfigurationHotSpot");
|
||||
json.insert("_type", "ConfigurationHotSpot");
|
||||
json.insert("apName", fdHotspotName->text());
|
||||
json.insert("password", fdHotspotPassword->text());
|
||||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("ConfigurationHotSpot")+" ...");
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, card, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
foreach(auto card, *gSelCards) {
|
||||
Def_CtrlSetMulti(tr("ConfigurationHotSpot"));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
hBox->addWidget(btnWiFiSet);
|
||||
hBox->addSpacing(50);
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include <QHttpMultiPart>
|
||||
#include <QUuid>
|
||||
#include <QBuffer>
|
||||
#include "base/pixbmpshowdialog.h"
|
||||
#include <QThread>
|
||||
#include <QTcpSocket>
|
||||
#include <QHostAddress>
|
||||
|
@ -428,19 +427,8 @@ void DeviceItem::OnProHttpResponse(QString url, QString postMD5, QByteArray data
|
|||
} else if(strType == "GetScreenshotFull") {
|
||||
MACRO_ASKTIME_STOP
|
||||
MACRO_POSTING_DLG_UNLOCK
|
||||
|
||||
qDebug()<<"GetScreenshotFull";
|
||||
QString iTemp=jsonObject["data"].toString();
|
||||
QByteArray byte_array =iTemp.toLatin1();
|
||||
QByteArray Ret_bytearray = QByteArray::fromBase64(byte_array);
|
||||
//QBuffer buffer(&Ret_bytearray);
|
||||
//buffer.open(QIODevice::WriteOnly);
|
||||
//QPixmap imageresult;
|
||||
//imageresult.loadFromData(Ret_bytearray);
|
||||
PixbmpShowDialog *dlg=new PixbmpShowDialog(m_pWnd);
|
||||
dlg->m_PixMap.loadFromData(Ret_bytearray);
|
||||
dlg->ResizeByPixmap(mCard->m_iWidth,mCard->m_iHeight);
|
||||
dlg->exec();
|
||||
ImgDlg dlg(QByteArray::fromBase64(jsonObject["data"].toString().toLatin1()), m_pWnd);
|
||||
dlg.exec();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -469,3 +457,18 @@ void DeviceItem::DeletePostingDlg()
|
|||
m_PostingDlg=nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
ImgDlg::ImgDlg(const QByteArray &data, QWidget *parent) : QDialog(parent) {
|
||||
setWindowFlag(Qt::WindowContextHelpButtonHint, 0);
|
||||
setWindowTitle(tr("Screenshot"));
|
||||
mImg.loadFromData(data);
|
||||
auto www = mImg.width();
|
||||
auto hhh = mImg.height();
|
||||
if(www <= 1600 && hhh <= 900) resize(www, hhh);
|
||||
else if(www > hhh) resize(900 * www / hhh, 900);
|
||||
else resize(1600, 1600 * hhh / www);
|
||||
}
|
||||
void ImgDlg::paintEvent(QPaintEvent *) {
|
||||
QPainter painter(this);
|
||||
painter.drawImage(rect(), mImg);
|
||||
}
|
||||
|
|
|
@ -75,4 +75,11 @@ private:
|
|||
QTimer *m_pGetAskTimer=nullptr;
|
||||
};
|
||||
|
||||
class ImgDlg : public QDialog {
|
||||
public:
|
||||
explicit ImgDlg(const QByteArray &, QWidget *parent = 0);
|
||||
QImage mImg;
|
||||
public:
|
||||
void paintEvent(QPaintEvent *) override;
|
||||
};
|
||||
#endif // DEVICEITEM_H
|
||||
|
|
|
@ -419,29 +419,13 @@ void ProgPanel::FilterProgram(const QString &strtemp){
|
|||
|
||||
}
|
||||
|
||||
ProgPortDlg::ProgPortDlg(QWidget *parent, QString title) : BaseDlg(parent) {
|
||||
ProgPortDlg::ProgPortDlg(QWidget *parent, QString title) : QDialog(parent) {
|
||||
setWindowFlag(Qt::WindowContextHelpButtonHint, 0);
|
||||
resize(600, 400);
|
||||
setWindowTitle(title);
|
||||
|
||||
auto vBox = new VBox(this);
|
||||
auto hBox = new HBox(vBox);
|
||||
hBox->setContentsMargins(0, 0, 0, 0);
|
||||
hBox->addStretch();
|
||||
|
||||
auto fdTitle = new QLabel(title);
|
||||
fdTitle->setStyleSheet("QLabel{font-size:16px;}");
|
||||
hBox->addWidget(fdTitle);
|
||||
hBox->addStretch();
|
||||
|
||||
bnClose = new QPushButton("X");
|
||||
bnClose->setFixedSize(30, 24);
|
||||
connect(bnClose, &QPushButton::clicked, this, &BaseDlg::close);
|
||||
hBox->addWidget(bnClose);
|
||||
|
||||
auto line = new QFrame;
|
||||
line->setFrameShape(QFrame::HLine);
|
||||
line->setFrameShadow(QFrame::Sunken);
|
||||
vBox->addWidget(line);
|
||||
|
||||
vBox->setContentsMargins(0, 0, 0, 6);
|
||||
|
||||
table = new QTableWidget(0, 2);
|
||||
table->setSelectionMode(QTableWidget::NoSelection);
|
||||
|
@ -453,7 +437,7 @@ ProgPortDlg::ProgPortDlg(QWidget *parent, QString title) : BaseDlg(parent) {
|
|||
table->setHorizontalHeaderLabels({tr("Solution Name"), tr("Progress")});
|
||||
vBox->addWidget(table);
|
||||
|
||||
hBox = new HBox(vBox);
|
||||
auto hBox = new HBox(vBox);
|
||||
hBox->addStretch();
|
||||
|
||||
bnOK = new QPushButton(title);
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
|
||||
#include "base/loqtreewidget.h"
|
||||
#include "program/progitem.h"
|
||||
#include "basedlg.h"
|
||||
#include <QPushButton>
|
||||
#include <QSettings>
|
||||
#include <QTableWidget>
|
||||
#include <QDialog>
|
||||
|
||||
class ProgPanel : public QWidget {
|
||||
Q_OBJECT
|
||||
|
@ -39,13 +39,12 @@ private:
|
|||
QPushButton *bnSend, *btnPlay;
|
||||
};
|
||||
|
||||
class ProgPortDlg : public BaseDlg {
|
||||
Q_OBJECT
|
||||
class ProgPortDlg : public QDialog {
|
||||
public:
|
||||
ProgPortDlg(QWidget *parent, QString title);
|
||||
|
||||
QTableWidget *table{0};
|
||||
QPushButton *bnOK, *bnClose;
|
||||
QPushButton *bnOK;
|
||||
};
|
||||
|
||||
#endif // PROGPANEL_H
|
||||
|
|
|
@ -4,30 +4,13 @@
|
|||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
|
||||
ProgCreateDlg::ProgCreateDlg(QString name, int width, int height, QString remarks, QString widths, QWidget *parent) : BaseDlg(parent) {
|
||||
ProgCreateDlg::ProgCreateDlg(QString name, int width, int height, QString remarks, QString widths, QWidget *parent) : QDialog(parent) {
|
||||
setWindowFlag(Qt::WindowContextHelpButtonHint, 0);
|
||||
setWindowTitle(tr("Solution Information"));
|
||||
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"));
|
||||
auto label = new QLabel(tr("Solution Name"));
|
||||
label->setMinimumWidth(90);
|
||||
label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||
hBox->addWidget(label);
|
||||
|
@ -77,11 +60,6 @@ ProgCreateDlg::ProgCreateDlg(QString name, int width, int height, QString remark
|
|||
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("每段打折宽度 (用空格分隔)"));
|
||||
|
@ -95,6 +73,8 @@ ProgCreateDlg::ProgCreateDlg(QString name, int width, int height, QString remark
|
|||
fdSplitWidths->setVisible(false);
|
||||
}
|
||||
|
||||
vBox->addSpacing(6);
|
||||
|
||||
hBox = new HBox(vBox);
|
||||
hBox->addStretch();
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#ifndef PROGCREATEDLG_H
|
||||
#define PROGCREATEDLG_H
|
||||
|
||||
#include "basedlg.h"
|
||||
#include <QDialog>
|
||||
#include <QLineEdit>
|
||||
#include <QTextEdit>
|
||||
#include <QSpinBox>
|
||||
|
||||
class ProgCreateDlg : public BaseDlg {
|
||||
class ProgCreateDlg : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ProgCreateDlg(QString name, int width, int height, QString remarks, QString, QWidget *parent = nullptr);
|
||||
|
|
|
@ -40,6 +40,8 @@ QWidget *gProgEditorWin;
|
|||
ProgEditorWin::ProgEditorWin(ProgItem *progItem, QWidget *parent) : QDialog(parent), mProgItem(progItem) {
|
||||
gProgEditorWin = this;
|
||||
gProgItem = progItem;
|
||||
setWindowFlag(Qt::WindowContextHelpButtonHint, 0);
|
||||
setWindowFlag(Qt::WindowMaximizeButtonHint);
|
||||
setAttribute(Qt::WA_AlwaysShowToolTips);
|
||||
if(parent && ! parent->isMaximized()) resize(parent->size());
|
||||
else resize(1280, 720);
|
||||
|
@ -244,7 +246,7 @@ ProgEditorWin::ProgEditorWin(ProgItem *progItem, QWidget *parent) : QDialog(pare
|
|||
auto files = QFileDialog::getOpenFileNames(this, tr("Select File"), gFileHome, EPhoto::filters());
|
||||
for(int i=0; i<files.count(); i++) {
|
||||
auto ePhoto = EPhoto::create(files[i], mPageItem);
|
||||
if(ePhoto==nullptr) continue;
|
||||
if(ePhoto==0) continue;
|
||||
auto rect = Tools::centerRect(ePhoto->img.width(), ePhoto->img.height(), mProgItem->mWidth, mProgItem->mHeight);
|
||||
ePhoto->setPos(rect.topLeft());
|
||||
ePhoto->setSize(rect.width(), rect.height());
|
||||
|
|
|
@ -1,115 +1,125 @@
|
|||
#include "wplanitem.h"
|
||||
#include "ui_wplanitem.h"
|
||||
#include "gutil/qgui.h"
|
||||
#include <QJsonArray>
|
||||
|
||||
wPlanItem::wPlanItem(QListWidgetItem *item, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::wPlanItem),
|
||||
m_item(item)
|
||||
{
|
||||
wPlanItem::wPlanItem(QListWidgetItem *item, const QJsonObject *json) : m_item(item) {
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
ui->setupUi(this);
|
||||
initBegin();
|
||||
ui->sMon ->setChecked(true);
|
||||
ui->sTues->setChecked(true);
|
||||
ui->sWed ->setChecked(true);
|
||||
ui->sThur->setChecked(true);
|
||||
ui->sFri ->setChecked(true);
|
||||
ui->sSat ->setChecked(true);
|
||||
ui->sSun ->setChecked(true);
|
||||
initEnd();
|
||||
|
||||
auto vBox = new VBox(this);
|
||||
vBox->setContentsMargins(6, 6, 0, 6);
|
||||
auto hBox = new HBox(vBox);
|
||||
|
||||
fdIdx = new QLabel("1");
|
||||
hBox->addWidget(fdIdx);
|
||||
|
||||
tStart = new QTimeEdit;
|
||||
tStart->setDisplayFormat("HH:mm");
|
||||
hBox->addWidget(tStart);
|
||||
|
||||
tEnd = new QTimeEdit;
|
||||
tEnd->setDisplayFormat("HH:mm");
|
||||
tEnd->setTime(QTime(23, 59, 59));
|
||||
|
||||
hBox->addWidget(tEnd);
|
||||
|
||||
bnDel = new QPushButton;
|
||||
hBox->addWidget(bnDel);
|
||||
|
||||
hBox = new HBox(vBox);
|
||||
|
||||
sMon = new QPushButton(tr("M"));
|
||||
sMon ->setCheckable(true);
|
||||
sMon ->setProperty("ssName", "weeklySelector");
|
||||
hBox->addWidget(sMon);
|
||||
hBox->addStretch();
|
||||
|
||||
sTues = new QPushButton(tr("Tu"));
|
||||
sTues->setCheckable(true);
|
||||
sTues->setProperty("ssName", "weeklySelector");
|
||||
hBox->addWidget(sTues);
|
||||
hBox->addStretch();
|
||||
|
||||
sWed = new QPushButton(tr("W"));
|
||||
sWed ->setCheckable(true);
|
||||
sWed ->setProperty("ssName", "weeklySelector");
|
||||
hBox->addWidget(sWed);
|
||||
hBox->addStretch();
|
||||
|
||||
sThur = new QPushButton(tr("Th"));
|
||||
sThur->setCheckable(true);
|
||||
sThur->setProperty("ssName", "weeklySelector");
|
||||
hBox->addWidget(sThur);
|
||||
hBox->addStretch();
|
||||
|
||||
sFri = new QPushButton(tr("F"));
|
||||
sFri ->setCheckable(true);
|
||||
sFri ->setProperty("ssName", "weeklySelector");
|
||||
hBox->addWidget(sFri);
|
||||
hBox->addStretch();
|
||||
|
||||
sSat = new QPushButton(tr("Sa"));
|
||||
sSat ->setCheckable(true);
|
||||
sSat ->setProperty("ssName", "weeklySelector");
|
||||
hBox->addWidget(sSat);
|
||||
hBox->addStretch();
|
||||
|
||||
sSun = new QPushButton(tr("Su"));
|
||||
sSun ->setCheckable(true);
|
||||
sSun ->setProperty("ssName", "weeklySelector");
|
||||
hBox->addWidget(sSun);
|
||||
|
||||
if(json==0) {
|
||||
sMon ->setChecked(true);
|
||||
sTues->setChecked(true);
|
||||
sWed ->setChecked(true);
|
||||
sThur->setChecked(true);
|
||||
sFri ->setChecked(true);
|
||||
sSat ->setChecked(true);
|
||||
sSun ->setChecked(true);
|
||||
} else {
|
||||
tStart->setTime(QTime::fromString(json->value("start").toString(), "hh:mm"));
|
||||
tEnd->setTime(QTime::fromString(json->value("end").toString(), "hh:mm"));
|
||||
auto oWeekly = json->value("weekly").toArray();
|
||||
sMon ->setChecked(oWeekly.contains(1));
|
||||
sTues->setChecked(oWeekly.contains(2));
|
||||
sWed ->setChecked(oWeekly.contains(3));
|
||||
sThur->setChecked(oWeekly.contains(4));
|
||||
sFri ->setChecked(oWeekly.contains(5));
|
||||
sSat ->setChecked(oWeekly.contains(6));
|
||||
sSun ->setChecked(oWeekly.contains(7));
|
||||
}
|
||||
connect(tStart, SIGNAL(timeChanged(const QTime&)), this, SLOT(onItemChanged()));
|
||||
connect(tEnd, SIGNAL(timeChanged(const QTime&)), this, SLOT(onItemChanged()));
|
||||
connect(sMon, SIGNAL(toggled(bool)), this, SLOT(onItemChanged()));
|
||||
connect(sTues, SIGNAL(toggled(bool)), this, SLOT(onItemChanged()));
|
||||
connect(sWed, SIGNAL(toggled(bool)), this, SLOT(onItemChanged()));
|
||||
connect(sThur, SIGNAL(toggled(bool)), this, SLOT(onItemChanged()));
|
||||
connect(sFri, SIGNAL(toggled(bool)), this, SLOT(onItemChanged()));
|
||||
connect(sSat, SIGNAL(toggled(bool)), this, SLOT(onItemChanged()));
|
||||
connect(sSun, SIGNAL(toggled(bool)), this, SLOT(onItemChanged()));
|
||||
connect(bnDel, SIGNAL(clicked(bool)), this, SLOT(onDelete(bool)));
|
||||
}
|
||||
|
||||
wPlanItem::wPlanItem(const QJsonObject &oRoot, QListWidgetItem *item, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::wPlanItem),
|
||||
m_item(item)
|
||||
{
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
ui->setupUi(this);
|
||||
initBegin();
|
||||
setPlan(oRoot);
|
||||
initEnd();
|
||||
}
|
||||
|
||||
void wPlanItem::initBegin()
|
||||
{
|
||||
ui->sMon ->setCheckable(true);
|
||||
ui->sTues->setCheckable(true);
|
||||
ui->sWed ->setCheckable(true);
|
||||
ui->sThur->setCheckable(true);
|
||||
ui->sFri ->setCheckable(true);
|
||||
ui->sSat ->setCheckable(true);
|
||||
ui->sSun ->setCheckable(true);
|
||||
ui->sMon ->setProperty("ssName", "weeklySelector");
|
||||
ui->sTues->setProperty("ssName", "weeklySelector");
|
||||
ui->sWed ->setProperty("ssName", "weeklySelector");
|
||||
ui->sThur->setProperty("ssName", "weeklySelector");
|
||||
ui->sFri ->setProperty("ssName", "weeklySelector");
|
||||
ui->sSat ->setProperty("ssName", "weeklySelector");
|
||||
ui->sSun ->setProperty("ssName", "weeklySelector");
|
||||
}
|
||||
|
||||
void wPlanItem::initEnd()
|
||||
{
|
||||
connect(ui->tStart, SIGNAL(timeChanged(const QTime&)), this, SLOT(onItemChanged()));
|
||||
connect(ui->tEnd, SIGNAL(timeChanged(const QTime&)), this, SLOT(onItemChanged()));
|
||||
connect(ui->sMon, SIGNAL(toggled(bool)), this, SLOT(onItemChanged()));
|
||||
connect(ui->sTues, SIGNAL(toggled(bool)), this, SLOT(onItemChanged()));
|
||||
connect(ui->sWed, SIGNAL(toggled(bool)), this, SLOT(onItemChanged()));
|
||||
connect(ui->sThur, SIGNAL(toggled(bool)), this, SLOT(onItemChanged()));
|
||||
connect(ui->sFri, SIGNAL(toggled(bool)), this, SLOT(onItemChanged()));
|
||||
connect(ui->sSat, SIGNAL(toggled(bool)), this, SLOT(onItemChanged()));
|
||||
connect(ui->sSun, SIGNAL(toggled(bool)), this, SLOT(onItemChanged()));
|
||||
connect(ui->bnDel, SIGNAL(clicked(bool)), this, SLOT(onDelete(bool)));
|
||||
}
|
||||
|
||||
wPlanItem::~wPlanItem()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void wPlanItem::onItemChanged()
|
||||
{
|
||||
void wPlanItem::onItemChanged(){
|
||||
emit sigItemChanged(m_item);
|
||||
}
|
||||
|
||||
void wPlanItem::onDelete(bool)
|
||||
{
|
||||
void wPlanItem::onDelete(bool){
|
||||
emit sigDelete(m_item);
|
||||
}
|
||||
|
||||
void wPlanItem::setNum(int n)
|
||||
{
|
||||
ui->wNum->setText(QString("%1").arg(n));
|
||||
}
|
||||
|
||||
void wPlanItem::setPlan(const QJsonObject &oRoot)
|
||||
{
|
||||
QJsonArray oWeekly = oRoot["weekly"].toArray();
|
||||
ui->tStart->setTime(QTime::fromString(oRoot["start"].toString(), "hh:mm"));
|
||||
ui->tEnd->setTime(QTime::fromString(oRoot["end"].toString(), "hh:mm"));
|
||||
ui->sMon ->setChecked(oWeekly.contains(QJsonValue(1)));
|
||||
ui->sTues->setChecked(oWeekly.contains(QJsonValue(2)));
|
||||
ui->sWed ->setChecked(oWeekly.contains(QJsonValue(3)));
|
||||
ui->sThur->setChecked(oWeekly.contains(QJsonValue(4)));
|
||||
ui->sFri ->setChecked(oWeekly.contains(QJsonValue(5)));
|
||||
ui->sSat ->setChecked(oWeekly.contains(QJsonValue(6)));
|
||||
ui->sSun ->setChecked(oWeekly.contains(QJsonValue(7)));
|
||||
}
|
||||
|
||||
QJsonObject wPlanItem::planJson() const
|
||||
{
|
||||
QJsonObject wPlanItem::planJson() const {
|
||||
QJsonObject oRoot;
|
||||
QJsonArray oWeekly;
|
||||
if(ui->sMon ->isChecked()) oWeekly.append(QJsonValue(1));
|
||||
if(ui->sTues->isChecked()) oWeekly.append(QJsonValue(2));
|
||||
if(ui->sWed ->isChecked()) oWeekly.append(QJsonValue(3));
|
||||
if(ui->sThur->isChecked()) oWeekly.append(QJsonValue(4));
|
||||
if(ui->sFri ->isChecked()) oWeekly.append(QJsonValue(5));
|
||||
if(ui->sSat ->isChecked()) oWeekly.append(QJsonValue(6));
|
||||
if(ui->sSun ->isChecked()) oWeekly.append(QJsonValue(7));
|
||||
oRoot["start"] = ui->tStart->time().toString("hh:mm");
|
||||
oRoot["end"] = ui->tEnd->time().toString("hh:mm");
|
||||
if(sMon ->isChecked()) oWeekly.append(QJsonValue(1));
|
||||
if(sTues->isChecked()) oWeekly.append(QJsonValue(2));
|
||||
if(sWed ->isChecked()) oWeekly.append(QJsonValue(3));
|
||||
if(sThur->isChecked()) oWeekly.append(QJsonValue(4));
|
||||
if(sFri ->isChecked()) oWeekly.append(QJsonValue(5));
|
||||
if(sSat ->isChecked()) oWeekly.append(QJsonValue(6));
|
||||
if(sSun ->isChecked()) oWeekly.append(QJsonValue(7));
|
||||
oRoot["start"] = tStart->time().toString("hh:mm");
|
||||
oRoot["end"] = tEnd->time().toString("hh:mm");
|
||||
oRoot["weekly"] = oWeekly;
|
||||
return oRoot;
|
||||
}
|
||||
|
|
|
@ -1,33 +1,19 @@
|
|||
#ifndef WPLANITEM_H
|
||||
#define WPLANITEM_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QPushButton>
|
||||
#include <QListWidgetItem>
|
||||
#include <QJsonValue>
|
||||
#include <QJsonArray>
|
||||
#include <QLabel>
|
||||
#include <QTimeEdit>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonDocument>
|
||||
|
||||
namespace Ui {
|
||||
class wPlanItem;
|
||||
}
|
||||
|
||||
class wPlanItem : public QWidget
|
||||
{
|
||||
class wPlanItem : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit wPlanItem(QListWidgetItem *item, QWidget *parent = nullptr);
|
||||
explicit wPlanItem(const QJsonObject &oRoot, QListWidgetItem *item, QWidget *parent = nullptr);
|
||||
~wPlanItem();
|
||||
explicit wPlanItem(QListWidgetItem *item, const QJsonObject * = 0);
|
||||
|
||||
void setNum(int n);
|
||||
void setPlan(const QJsonObject &oRoot);
|
||||
QJsonObject planJson() const;
|
||||
|
||||
private:
|
||||
void initBegin();
|
||||
void initEnd();
|
||||
QLabel *fdIdx;
|
||||
|
||||
signals:
|
||||
void sigItemChanged(QListWidgetItem *);
|
||||
|
@ -38,8 +24,18 @@ protected slots:
|
|||
void onDelete(bool);
|
||||
|
||||
private:
|
||||
Ui::wPlanItem *ui;
|
||||
QListWidgetItem *m_item;
|
||||
|
||||
QTimeEdit *tStart;
|
||||
QTimeEdit *tEnd;
|
||||
QPushButton *bnDel;
|
||||
QPushButton *sMon;
|
||||
QPushButton *sTues;
|
||||
QPushButton *sWed;
|
||||
QPushButton *sThur;
|
||||
QPushButton *sFri;
|
||||
QPushButton *sSat;
|
||||
QPushButton *sSun;
|
||||
};
|
||||
|
||||
#endif // WPLANITEM_H
|
||||
|
|
|
@ -1,351 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>wPlanItem</class>
|
||||
<widget class="QWidget" name="wPlanItem">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>318</width>
|
||||
<height>80</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="wNum">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>1</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTimeEdit" name="tStart">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="displayFormat">
|
||||
<string notr="true">HH:mm</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTimeEdit" name="tEnd">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="displayFormat">
|
||||
<string notr="true">HH:mm</string>
|
||||
</property>
|
||||
<property name="time">
|
||||
<time>
|
||||
<hour>23</hour>
|
||||
<minute>59</minute>
|
||||
<second>59</second>
|
||||
</time>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="bnDel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Every week:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="sMon">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>M</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<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="sTues">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Tu</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<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="sWed">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>W</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<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="sThur">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Th</string>
|
||||
</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>
|
||||
<item>
|
||||
<widget class="QPushButton" name="sFri">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>F</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<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="sSat">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sa</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<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="sSun">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Su</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,23 +1,18 @@
|
|||
#include "wplanlist.h"
|
||||
#include "wplanitem.h"
|
||||
#include <QJsonArray>
|
||||
|
||||
wPlanList::wPlanList(QWidget *parent) : QListWidget(parent)
|
||||
{
|
||||
wPlanList::wPlanList(QWidget *parent) : QListWidget(parent) {
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
setFrameShape(QListWidget::NoFrame);
|
||||
}
|
||||
|
||||
void wPlanList::adjustItemNum()
|
||||
{
|
||||
void wPlanList::adjustItemNum() {
|
||||
int n = count();
|
||||
for(int i=0; i<n; i++) {
|
||||
wPlanItem *w = static_cast<wPlanItem*>(itemWidget(item(i)));
|
||||
w->setNum(i+1);
|
||||
}
|
||||
for(int i=0; i<n; i++) static_cast<wPlanItem*>(itemWidget(item(i)))->fdIdx->setNum(i+1);
|
||||
}
|
||||
|
||||
QJsonArray wPlanList::plansJson()
|
||||
{
|
||||
QJsonArray wPlanList::plansJson() {
|
||||
QJsonArray oRoot;
|
||||
int n = count();
|
||||
for(int i=0; i<n; i++) {
|
||||
|
@ -48,7 +43,8 @@ void wPlanList::onRestorePlan(const QJsonArray &jRoot)
|
|||
for(int i=0; i<n; i++) {
|
||||
QListWidgetItem *item = new QListWidgetItem();
|
||||
item->setFlags(item->flags() & ~Qt::ItemIsSelectable);
|
||||
wPlanItem *widget = new wPlanItem(jRoot.at(i).toObject(), item);
|
||||
auto json = jRoot.at(i).toObject();
|
||||
wPlanItem *widget = new wPlanItem(item, &json);
|
||||
addItem(item);
|
||||
setItemWidget(item, widget);
|
||||
setCurrentItem(item);
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
#include <QListWidget>
|
||||
#include <QListWidgetItem>
|
||||
|
||||
class wPlanList : public QListWidget
|
||||
{
|
||||
class wPlanList : public QListWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit wPlanList(QWidget *parent = 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
Loading…
Reference in New Issue
Block a user