This commit is contained in:
Gangphon 2023-05-05 17:22:54 +08:00
parent e7a5c0cf8d
commit 0bff10348c
4 changed files with 33 additions and 37 deletions

View File

@ -49,7 +49,10 @@ CtrlNetworkPanel::CtrlNetworkPanel(QWidget *parent) : QWidget(parent) {
hhh->addWidget(labelIpAddress = new QLabel); hhh->addWidget(labelIpAddress = new QLabel);
fdIP = new QLineEdit; fdIP = new QLineEdit;
fdIP->setInputMask("000.000.000.000;_"); auto ft = fdIP->font();
ft.setFamilies({"Monaco", "Consolas", "Mono-space"});
fdIP->setFont(ft);
fdIP->setInputMask("000.000.000.000");
fdIP->setAlignment(Qt::AlignCenter); fdIP->setAlignment(Qt::AlignCenter);
fdIP->setFixedWidth(160); fdIP->setFixedWidth(160);
hhh->addWidget(fdIP); hhh->addWidget(fdIP);
@ -59,7 +62,8 @@ CtrlNetworkPanel::CtrlNetworkPanel(QWidget *parent) : QWidget(parent) {
hhh->addWidget(labelMaskAddress = new QLabel); hhh->addWidget(labelMaskAddress = new QLabel);
fdMask = new QLineEdit; fdMask = new QLineEdit;
fdMask->setInputMask("000.000.000.000;_"); fdMask->setFont(ft);
fdMask->setInputMask("000.000.000.000");
fdMask->setAlignment(Qt::AlignCenter); fdMask->setAlignment(Qt::AlignCenter);
fdMask->setFixedWidth(160); fdMask->setFixedWidth(160);
hhh->addWidget(fdMask); hhh->addWidget(fdMask);
@ -69,7 +73,8 @@ CtrlNetworkPanel::CtrlNetworkPanel(QWidget *parent) : QWidget(parent) {
hhh->addWidget(labelGateway = new QLabel); hhh->addWidget(labelGateway = new QLabel);
fdGateWay = new QLineEdit; fdGateWay = new QLineEdit;
fdGateWay->setInputMask("000.000.000.000;_"); fdGateWay->setFont(ft);
fdGateWay->setInputMask("000.000.000.000");
fdGateWay->setAlignment(Qt::AlignCenter); fdGateWay->setAlignment(Qt::AlignCenter);
fdGateWay->setFixedWidth(160); fdGateWay->setFixedWidth(160);
hhh->addWidget(fdGateWay); hhh->addWidget(fdGateWay);
@ -79,7 +84,8 @@ CtrlNetworkPanel::CtrlNetworkPanel(QWidget *parent) : QWidget(parent) {
hhh->addWidget(labelDnsAddress = new QLabel); hhh->addWidget(labelDnsAddress = new QLabel);
fdDns = new QLineEdit; fdDns = new QLineEdit;
fdDns->setInputMask("000.000.000.000;_"); fdDns->setFont(ft);
fdDns->setInputMask("000.000.000.000");
fdDns->setAlignment(Qt::AlignCenter); fdDns->setAlignment(Qt::AlignCenter);
fdDns->setFixedWidth(160); fdDns->setFixedWidth(160);
hhh->addWidget(fdDns); hhh->addWidget(fdDns);

View File

@ -1,26 +1,24 @@
#include "passwordindlg.h" #include "passwordindlg.h"
#include "base/changepasswordform.h" #include "base/changepasswordform.h"
#include <QVBoxLayout> #include "gutil/qgui.h"
#include <QLabel> #include <QLabel>
#include <QPushButton> #include <QPushButton>
PasswordInChDlg::PasswordInChDlg(QWidget *parent) : BaseDlg(parent) { PasswordInChDlg::PasswordInChDlg(QWidget *parent) : QDialog(parent) {
resize(213, 136); resize(240, 150);
setStyleSheet("QDialog{background-color: #eeeeee;} QLabel{background-color: transparent;}");
auto vBox = new QVBoxLayout(this); auto vBox = new VBox(this);
vBox->addStretch(); vBox->addStretch();
auto hBox = new QHBoxLayout(); auto hBox = new HBox(vBox);
hBox->addWidget(new QLabel(tr("Input password"))); hBox->addWidget(new QLabel(tr("Input password")));
fdPassword = new QLineEdit(); fdPassword = new QLineEdit();
fdPassword->setEchoMode(QLineEdit::Password); fdPassword->setEchoMode(QLineEdit::Password);
fdPassword->setFocus(); fdPassword->setFocus();
hBox->addWidget(fdPassword); hBox->addWidget(fdPassword);
vBox->addLayout(hBox);
btnChangePassword = new QPushButton(tr("Change Password")); btnChangePassword = new QPushButton(tr("Change Password"));
btnChangePassword->setProperty("ssType", "progManageTool");
vBox->addWidget(btnChangePassword, 0, Qt::AlignRight); vBox->addWidget(btnChangePassword, 0, Qt::AlignRight);
connect(btnChangePassword, &QPushButton::clicked, this, [this]() { connect(btnChangePassword, &QPushButton::clicked, this, [this]() {
ChangePasswordForm dlg(this); ChangePasswordForm dlg(this);
@ -28,10 +26,7 @@ PasswordInChDlg::PasswordInChDlg(QWidget *parent) : BaseDlg(parent) {
}); });
vBox->addStretch(); vBox->addStretch();
btnBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal); btnBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
btnBox->button(QDialogButtonBox::Ok)->setProperty("ssType", "progManageTool"); vBox->addWidget(btnBox);
btnBox->button(QDialogButtonBox::Cancel)->setProperty("ssType", "progManageTool");
vBox->addWidget(btnBox, 0, Qt::AlignHCenter);
connect(btnBox, &QDialogButtonBox::rejected, this, &QDialog::reject); connect(btnBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
vBox->addStretch();
} }

View File

@ -1,14 +1,14 @@
#ifndef PASSWORDINDLG_H #ifndef PASSWORDINDLG_H
#define PASSWORDINDLG_H #define PASSWORDINDLG_H
#include "basedlg.h" #include <QDialog>
#include <QLineEdit> #include <QLineEdit>
#include <QDialogButtonBox> #include <QDialogButtonBox>
class PasswordInChDlg : public BaseDlg { class PasswordInChDlg : public QDialog {
Q_OBJECT Q_OBJECT
public: public:
explicit PasswordInChDlg(QWidget *parent = nullptr); explicit PasswordInChDlg(QWidget *parent = 0);
QLineEdit *fdPassword; QLineEdit *fdPassword;
QPushButton *btnChangePassword; QPushButton *btnChangePassword;

View File

@ -1,17 +1,21 @@
#include "sendprogramdialog.h" #include "sendprogramdialog.h"
#include "tools.h" #include "tools.h"
#include "cfg.h" #include "cfg.h"
#include "gutil/qgui.h"
#include <QAction> #include <QAction>
#include <QLineEdit> #include <QLineEdit>
#include <QHeaderView> #include <QHeaderView>
#include <QVBoxLayout> #include <QDialogButtonBox>
SendProgramDialog::SendProgramDialog(QString progName, QWidget *parent) : QDialog(parent), mProgName(progName) { SendProgramDialog::SendProgramDialog(QString progName, QWidget *parent) : QDialog(parent), mProgName(progName) {
#ifdef Q_OS_WINDOWS
setWindowFlag(Qt::WindowMaximizeButtonHint); setWindowFlag(Qt::WindowMaximizeButtonHint);
#endif
setWindowTitle(tr("Publish")+" "+mProgName); setWindowTitle(tr("Publish")+" "+mProgName);
resize(1024, 700); resize(1024, 700);
auto vBox = new QVBoxLayout(this);
auto hBox = new QHBoxLayout(); auto vBox = new VBox(this);
auto hBox = new HBox(vBox);
label = new QLabel(tr("success info")); label = new QLabel(tr("success info"));
hBox->addWidget(label); hBox->addWidget(label);
@ -31,7 +35,6 @@ SendProgramDialog::SendProgramDialog(QString progName, QWidget *parent) : QDialo
connect(txtSearch,SIGNAL(textChanged(const QString &)),this,SLOT(FilterProgram(const QString &))); connect(txtSearch,SIGNAL(textChanged(const QString &)),this,SLOT(FilterProgram(const QString &)));
hBox->addWidget(txtSearch); hBox->addWidget(txtSearch);
vBox->addLayout(hBox);
wDevicePublishList = new LoQTreeWidget(); wDevicePublishList = new LoQTreeWidget();
wDevicePublishList->setProperty("ssType", "topList"); wDevicePublishList->setProperty("ssType", "topList");
@ -68,11 +71,11 @@ SendProgramDialog::SendProgramDialog(QString progName, QWidget *parent) : QDialo
wDevicePublishList->setColumnWidth(ENUM_DEVICE_PUBLISH_HEADE_PROGRESS, 120); wDevicePublishList->setColumnWidth(ENUM_DEVICE_PUBLISH_HEADE_PROGRESS, 120);
vBox->addWidget(wDevicePublishList); vBox->addWidget(wDevicePublishList);
hBox = new QHBoxLayout();
hBox->addStretch();
auto btnPublish = new QPushButton(tr("Publish")); auto btnBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
connect(btnPublish, &QPushButton::clicked, this, [this] { btnBox->button(QDialogButtonBox::Ok)->setText(tr("Publish"));
connect(btnBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
connect(btnBox, &QDialogButtonBox::accepted, this, [this] {
if(mWaitCnt > 0) return; if(mWaitCnt > 0) return;
int cnt = wDevicePublishList->topLevelItemCount(); int cnt = wDevicePublishList->topLevelItemCount();
int sentCnt{0}; int sentCnt{0};
@ -114,15 +117,7 @@ SendProgramDialog::SendProgramDialog(QString progName, QWidget *parent) : QDialo
sentCnt++; sentCnt++;
} }
}); });
btnPublish->setProperty("ssType", "progManageTool"); vBox->addWidget(btnBox);
hBox->addWidget(btnPublish);
auto btnCancel = new QPushButton(tr("Cancel"));
connect(btnCancel, &QPushButton::clicked, this, &QWidget::close);
btnCancel->setProperty("ssType", "progManageTool");
hBox->addWidget(btnCancel);
vBox->addLayout(hBox);
onRefresh(); onRefresh();