删除代码中多余成员变量,去除一些无用的打印,删除没有特殊功能的函数实现

This commit is contained in:
chenxuechao 2022-07-04 15:44:42 +08:00
parent fe9d7143a2
commit bd1fb4f99b
8 changed files with 6 additions and 67 deletions

View File

@ -18,16 +18,14 @@
BlacklistItem::BlacklistItem(QString staMac, QString staName, QWidget *parent) :
QFrame(parent),
m_mac(staMac),
m_hostName(staName)
m_mac(staMac)
{
qDebug()<<"---CXC---"<<m_mac<<Q_FUNC_INFO<<__LINE__;
this->setMinimumHeight(60);
this->setFixedHeight(60);
QHBoxLayout *hItemLayout = new QHBoxLayout(this);
hItemLayout->setContentsMargins(ITEM_MARGINS);
QLabel *nameLabel = new QLabel(m_hostName, this);
QLabel *nameLabel = new QLabel(staName, this);
m_removeFromBlacklistBtn = new KBorderlessButton(this);
m_removeFromBlacklistBtn->setText(tr("Remove"));
hItemLayout->setSpacing(0);
@ -39,16 +37,10 @@ BlacklistItem::BlacklistItem(QString staMac, QString staName, QWidget *parent) :
this->setLayout(hItemLayout);
}
BlacklistItem::~BlacklistItem()
{
}
bool BlacklistItem::eventFilter(QObject *w, QEvent *e)
{
if (e->type() == QEvent::MouseButtonRelease) {
if (w == m_removeFromBlacklistBtn) {
qDebug() << "--cxc--" << Q_FUNC_INFO << __LINE__ << m_mac;
emit onBtnClicked(m_mac);
return true;
}

View File

@ -19,13 +19,9 @@ public:
~BlacklistItem();
protected:
QFrame * m_itemFrame = nullptr;
QLabel * m_nameLabel = nullptr;
KBorderlessButton *m_removeFromBlacklistBtn = nullptr;
QString m_mac;
QString m_hostName;
bool eventFilter(QObject *w, QEvent *e);
signals:

View File

@ -30,15 +30,6 @@ BlacklistPage::BlacklistPage(QWidget *parent) : QWidget(parent)
Vlayout->addWidget(blacklistFrame);
}
BlacklistPage::~BlacklistPage()
{
}
void BlacklistPage::paintEvent(QPaintEvent *event)
{
QWidget::paintEvent(event);
}
QFrame* BlacklistPage::myLine()
{
QFrame *line = new QFrame(this);
@ -107,11 +98,6 @@ void BlacklistPage::onsetStaIntoBlacklist(QString staMac)
qWarning() << "[mobilehotspot]Getstainfo error:" << reply.errorMessage();
return ;
}
for (int i = 0; i < reply.arguments().size(); i++) {
if (reply.arguments().at(i).isValid()) {
qDebug() << "--cxc--" << Q_FUNC_INFO << __LINE__ << reply.arguments().at(i);
}
}
refreshBlacklist();
return ;
@ -150,12 +136,6 @@ bool BlacklistPage::removeStaFromBlacklist(QString staMac)
return false;
}
for (int i = 0; i < reply.arguments().size(); i++) {
if (reply.arguments().at(i).isValid()) {
qDebug() << Q_FUNC_INFO << __LINE__ << reply.arguments().at(i);
}
}
return true;
}
@ -187,11 +167,7 @@ void BlacklistPage::onRemoveFromBlacklistBtnClicked(QString staMac)
if (staMac.isNull() || staMac.isEmpty()) {
return;
}
qDebug() << Q_FUNC_INFO << __LINE__ <<staMac;
removeStaFromBlacklist(staMac);
/*if ()*/ {
refreshBlacklist();
}
refreshBlacklist();
}

View File

@ -31,7 +31,6 @@ public:
}
private:
void paintEvent(QPaintEvent *event);
QFrame* myLine();

View File

@ -18,15 +18,14 @@
ConnectDevListItem::ConnectDevListItem(QString staMac, QString staName, QWidget *parent) :
QFrame(parent),
m_mac(staMac),
m_hostName(staName)
m_mac(staMac)
{
this->setMinimumSize(FRAME_MIN_SIZE);
this->setFixedHeight(60);
QHBoxLayout *hItemLayout = new QHBoxLayout(this);
hItemLayout->setContentsMargins(ITEM_MARGINS);
QLabel *nameLabel = new QLabel(m_hostName, this);
QLabel *nameLabel = new QLabel(staName, this);
m_dragIntoBlackListBtn = new KBorderlessButton(this);
m_dragIntoBlackListBtn->setText(tr("drag into blacklist"));
hItemLayout->setSpacing(0);
@ -35,19 +34,13 @@ ConnectDevListItem::ConnectDevListItem(QString staMac, QString staName, QWidget
hItemLayout->addWidget(m_dragIntoBlackListBtn, Qt::AlignRight);
m_dragIntoBlackListBtn->installEventFilter(this);
// this->setLayout(hItemLayout);
}
ConnectDevListItem::~ConnectDevListItem()
{
this->setLayout(hItemLayout);
}
bool ConnectDevListItem::eventFilter(QObject *w, QEvent *e)
{
if (e->type() == QEvent::MouseButtonRelease) {
if (w == m_dragIntoBlackListBtn) {
qDebug() << "--cxc--" << Q_FUNC_INFO << __LINE__ <<m_mac;
emit onBtnClicked(m_mac);
return true;
}

View File

@ -19,13 +19,9 @@ public:
~ConnectDevListItem();
protected:
QFrame * m_itemFrame = nullptr;
QLabel * m_nameLabel = nullptr;
KBorderlessButton *m_dragIntoBlackListBtn = nullptr;
QString m_mac;
QString m_hostName;
bool eventFilter(QObject *w, QEvent *e);
signals:

View File

@ -31,15 +31,6 @@ ConnectdevPage::ConnectdevPage(QWidget *parent) :
Vlayout->addWidget(staistFrame);
}
ConnectdevPage::~ConnectdevPage()
{
}
void ConnectdevPage::paintEvent(QPaintEvent *event)
{
QWidget::paintEvent(event);
}
QFrame* ConnectdevPage::myLine()
{
QFrame *line = new QFrame(this);
@ -117,7 +108,6 @@ void ConnectdevPage::clearStaListLayout()
void ConnectdevPage::onStaDevAdded(bool istrue, QString staMac, QString staName)
{
if (!m_staMap.keys().contains(staMac)) {
qDebug()<< Q_FUNC_INFO << __LINE__ << istrue << staMac << staName;
onStaDevChanged(istrue, staMac, staName);
}
}
@ -125,7 +115,6 @@ void ConnectdevPage::onStaDevAdded(bool istrue, QString staMac, QString staName)
void ConnectdevPage::onStaDevRemoved(bool istrue, QString staMac, QString staName)
{
if (m_staMap.keys().contains(staMac)) {
qDebug()<< Q_FUNC_INFO << __LINE__ << istrue << staMac << staName;
onStaDevChanged(istrue, staMac, staName);
}
}

View File

@ -30,8 +30,6 @@ public:
}
private:
void paintEvent(QPaintEvent *event);
QFrame* myLine();
TitleLabel *m_titleLabel = nullptr;