fix bug 145491
This commit is contained in:
parent
110d6c0bad
commit
526de94aec
|
@ -49,7 +49,7 @@
|
||||||
#define FRAME_LAYOUT_MARGINS 16,0,16,0
|
#define FRAME_LAYOUT_MARGINS 16,0,16,0
|
||||||
#define FRAME_LAYOUT_SPACING 8
|
#define FRAME_LAYOUT_SPACING 8
|
||||||
#define LABEL_WIDTH 136
|
#define LABEL_WIDTH 136
|
||||||
#define LINE_EDIT_HEIGHT 36
|
#define IP_FRAME_MAX_HEIGHT 76
|
||||||
|
|
||||||
Proxy::Proxy() : mFirstLoad(true)
|
Proxy::Proxy() : mFirstLoad(true)
|
||||||
{
|
{
|
||||||
|
@ -233,7 +233,6 @@ void Proxy::initUi(QWidget *widget)
|
||||||
mUrlLabel->setFixedWidth(136);
|
mUrlLabel->setFixedWidth(136);
|
||||||
|
|
||||||
mUrlLineEdit = new QLineEdit(mUrlFrame);
|
mUrlLineEdit = new QLineEdit(mUrlFrame);
|
||||||
mUrlLineEdit->setFixedHeight(36);
|
|
||||||
|
|
||||||
mUrlLayout->addWidget(mUrlLabel);
|
mUrlLayout->addWidget(mUrlLabel);
|
||||||
mUrlLayout->addWidget(mUrlLineEdit);
|
mUrlLayout->addWidget(mUrlLineEdit);
|
||||||
|
@ -255,7 +254,6 @@ void Proxy::initUi(QWidget *widget)
|
||||||
mHTTPLineEdit_1 = new QLineEdit(mHTTPFrame);
|
mHTTPLineEdit_1 = new QLineEdit(mHTTPFrame);
|
||||||
mHTTPLineEdit_1->resize(300, 36);
|
mHTTPLineEdit_1->resize(300, 36);
|
||||||
mHTTPLineEdit_2 = new QLineEdit(mHTTPFrame);
|
mHTTPLineEdit_2 = new QLineEdit(mHTTPFrame);
|
||||||
mHTTPLineEdit_2->setFixedHeight(36);
|
|
||||||
mHTTPLineEdit_2->setValidator(new QRegExpValidator(QRegExp("[0-9]*") , this));
|
mHTTPLineEdit_2->setValidator(new QRegExpValidator(QRegExp("[0-9]*") , this));
|
||||||
mHTTPLayout_1->addWidget(mHTTPLabel);
|
mHTTPLayout_1->addWidget(mHTTPLabel);
|
||||||
mHTTPLayout_1->addWidget(mHTTPLineEdit_1);
|
mHTTPLayout_1->addWidget(mHTTPLineEdit_1);
|
||||||
|
@ -278,7 +276,6 @@ void Proxy::initUi(QWidget *widget)
|
||||||
mHTTPSLineEdit_1 = new QLineEdit(mHTTPSFrame);
|
mHTTPSLineEdit_1 = new QLineEdit(mHTTPSFrame);
|
||||||
mHTTPSLineEdit_1->resize(300, 36);
|
mHTTPSLineEdit_1->resize(300, 36);
|
||||||
mHTTPSLineEdit_2 = new QLineEdit(mHTTPSFrame);
|
mHTTPSLineEdit_2 = new QLineEdit(mHTTPSFrame);
|
||||||
mHTTPSLineEdit_2->setFixedHeight(36);
|
|
||||||
mHTTPSLineEdit_2->setValidator(new QRegExpValidator(QRegExp("[0-9]*") , this));
|
mHTTPSLineEdit_2->setValidator(new QRegExpValidator(QRegExp("[0-9]*") , this));
|
||||||
mHTTPSLayout->addWidget(mHTTPSLabel);
|
mHTTPSLayout->addWidget(mHTTPSLabel);
|
||||||
mHTTPSLayout->addWidget(mHTTPSLineEdit_1);
|
mHTTPSLayout->addWidget(mHTTPSLineEdit_1);
|
||||||
|
@ -301,7 +298,6 @@ void Proxy::initUi(QWidget *widget)
|
||||||
mFTPLineEdit_1 = new QLineEdit(mFTPFrame);
|
mFTPLineEdit_1 = new QLineEdit(mFTPFrame);
|
||||||
mFTPLineEdit_1->resize(300, 36);
|
mFTPLineEdit_1->resize(300, 36);
|
||||||
mFTPLineEdit_2 = new QLineEdit(mFTPFrame);
|
mFTPLineEdit_2 = new QLineEdit(mFTPFrame);
|
||||||
mFTPLineEdit_2->setFixedHeight(36);
|
|
||||||
mFTPLineEdit_2->setValidator(new QRegExpValidator(QRegExp("[0-9]*") , this));
|
mFTPLineEdit_2->setValidator(new QRegExpValidator(QRegExp("[0-9]*") , this));
|
||||||
mFTPLayout->addWidget(mFTPLabel);
|
mFTPLayout->addWidget(mFTPLabel);
|
||||||
mFTPLayout->addWidget(mFTPLineEdit_1);
|
mFTPLayout->addWidget(mFTPLineEdit_1);
|
||||||
|
@ -324,7 +320,6 @@ void Proxy::initUi(QWidget *widget)
|
||||||
mSOCKSLineEdit_1 = new QLineEdit(mSOCKSFrame);
|
mSOCKSLineEdit_1 = new QLineEdit(mSOCKSFrame);
|
||||||
mSOCKSLineEdit_1->resize(300, 36);
|
mSOCKSLineEdit_1->resize(300, 36);
|
||||||
mSOCKSLineEdit_2 = new QLineEdit(mSOCKSFrame);
|
mSOCKSLineEdit_2 = new QLineEdit(mSOCKSFrame);
|
||||||
mSOCKSLineEdit_2->setFixedHeight(36);
|
|
||||||
mSOCKSLineEdit_2->setValidator(new QRegExpValidator(QRegExp("[0-9]*") , this));
|
mSOCKSLineEdit_2->setValidator(new QRegExpValidator(QRegExp("[0-9]*") , this));
|
||||||
mSOCKSLayout->addWidget(mSOCKSLabel);
|
mSOCKSLayout->addWidget(mSOCKSLabel);
|
||||||
mSOCKSLayout->addWidget(mSOCKSLineEdit_1);
|
mSOCKSLayout->addWidget(mSOCKSLineEdit_1);
|
||||||
|
@ -1008,27 +1003,23 @@ void Proxy::setAppProxyFrameUi(QWidget *widget)
|
||||||
//IP地址ui布局
|
//IP地址ui布局
|
||||||
m_ipAddressFrame = new QFrame(m_appProxyFrame);
|
m_ipAddressFrame = new QFrame(m_appProxyFrame);
|
||||||
m_ipAddressFrame->setMinimumSize(QSize(550, 60));
|
m_ipAddressFrame->setMinimumSize(QSize(550, 60));
|
||||||
m_ipAddressFrame->setMaximumSize(QSize(16777215, 88));
|
m_ipAddressFrame->setMaximumSize(QSize(16777215, IP_FRAME_MAX_HEIGHT));
|
||||||
m_ipAddressFrame->setFrameShape(QFrame::NoFrame);
|
m_ipAddressFrame->setFrameShape(QFrame::NoFrame);
|
||||||
m_ipAddressLabel = new QLabel(tr("IP address"), m_ipAddressFrame);
|
m_ipAddressLabel = new QLabel(tr("IP address"), m_ipAddressFrame);
|
||||||
m_ipAddressLabel->setFixedWidth(LABEL_WIDTH);
|
m_ipAddressLabel->setFixedWidth(LABEL_WIDTH);
|
||||||
m_ipHintsLabel = new QLabel(m_ipAddressFrame);
|
m_ipHintsLabel = new QLabel(m_ipAddressFrame);
|
||||||
|
m_ipHintsLabel->setFixedHeight(20);
|
||||||
m_ipHintsLabel->setContentsMargins(8, 0, 0, 0);
|
m_ipHintsLabel->setContentsMargins(8, 0, 0, 0);
|
||||||
m_ipAddressLineEdit = new QLineEdit(m_ipAddressFrame);
|
m_ipAddressLineEdit = new QLineEdit(m_ipAddressFrame);
|
||||||
m_ipAddressLineEdit->setFixedHeight(LINE_EDIT_HEIGHT);
|
m_ipAddressLineEdit->setMinimumHeight(36);
|
||||||
m_ipAddressLineEdit->setPlaceholderText(tr("Required")); //必填
|
m_ipAddressLineEdit->setPlaceholderText(tr("Required")); //必填
|
||||||
|
|
||||||
QWidget *ipInputWidget = new QWidget(m_ipAddressFrame);
|
QGridLayout *ipAddressLayout = new QGridLayout(m_ipAddressFrame);
|
||||||
QVBoxLayout *ipVLayout = new QVBoxLayout(ipInputWidget);
|
ipAddressLayout->setContentsMargins(16, 0, 16, 0);
|
||||||
ipVLayout->setContentsMargins(0, 0, 0, 0);
|
ipAddressLayout->setVerticalSpacing(0);
|
||||||
ipVLayout->setSpacing(3);
|
ipAddressLayout->addWidget(m_ipAddressLabel, 0, 0);
|
||||||
ipVLayout->addWidget(m_ipAddressLineEdit);
|
ipAddressLayout->addWidget(m_ipAddressLineEdit, 0, 1);
|
||||||
ipVLayout->addWidget(m_ipHintsLabel);
|
ipAddressLayout->addWidget(m_ipHintsLabel, 1, 1);
|
||||||
|
|
||||||
QFormLayout *ipAddressLayout = new QFormLayout(m_ipAddressFrame);
|
|
||||||
ipAddressLayout->setContentsMargins(16, 12, 16, 12);
|
|
||||||
ipAddressLayout->setSpacing(FRAME_LAYOUT_SPACING);
|
|
||||||
ipAddressLayout->addRow(m_ipAddressLabel, ipInputWidget);
|
|
||||||
|
|
||||||
// IP的正则格式限制
|
// IP的正则格式限制
|
||||||
QRegExp rx("\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b");
|
QRegExp rx("\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b");
|
||||||
|
@ -1228,7 +1219,7 @@ bool Proxy::getipEditState(QString text)
|
||||||
void Proxy::onipEditStateChanged()
|
void Proxy::onipEditStateChanged()
|
||||||
{
|
{
|
||||||
if (!getipEditState(m_ipAddressLineEdit->text())) {
|
if (!getipEditState(m_ipAddressLineEdit->text())) {
|
||||||
m_ipAddressFrame->setFixedHeight(88);
|
m_ipAddressFrame->setFixedHeight(IP_FRAME_MAX_HEIGHT);
|
||||||
m_ipHintsLabel->show();
|
m_ipHintsLabel->show();
|
||||||
} else {
|
} else {
|
||||||
m_ipHintsLabel->hide();
|
m_ipHintsLabel->hide();
|
||||||
|
|
|
@ -1167,7 +1167,26 @@ void NetDetail::setNetTabToolTip()
|
||||||
NetTabBar::NetTabBar(QWidget *parent)
|
NetTabBar::NetTabBar(QWidget *parent)
|
||||||
:KTabBar(KTabBarStyle::SegmentDark, parent)
|
:KTabBar(KTabBarStyle::SegmentDark, parent)
|
||||||
{
|
{
|
||||||
|
//模式切换
|
||||||
|
QDBusConnection::sessionBus().connect(QString("com.kylin.statusmanager.interface"),
|
||||||
|
QString("/"),
|
||||||
|
QString("com.kylin.statusmanager.interface"),
|
||||||
|
QString("mode_change_signal"), this, SLOT(onModeChanged(bool)));
|
||||||
|
//模式获取
|
||||||
|
QDBusInterface interface(QString("com.kylin.statusmanager.interface"),
|
||||||
|
QString("/"),
|
||||||
|
QString("com.kylin.statusmanager.interface"),
|
||||||
|
QDBusConnection::sessionBus());
|
||||||
|
if(!interface.isValid()) {
|
||||||
|
this->setFixedHeight(TAB_HEIGHT);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QDBusReply<bool> reply = interface.call("get_current_tabletmode");
|
||||||
|
if (!reply.isValid()) {
|
||||||
|
this->setFixedHeight(TAB_HEIGHT);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
onModeChanged(reply.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
NetTabBar::~NetTabBar()
|
NetTabBar::~NetTabBar()
|
||||||
|
@ -1190,6 +1209,15 @@ QSize NetTabBar::minimumTabSizeHint(int index) const
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NetTabBar::onModeChanged(bool mode)
|
||||||
|
{
|
||||||
|
if (mode) {
|
||||||
|
this->setFixedHeight(TAB_HEIGHT_TABLET); // 平板模式
|
||||||
|
} else {
|
||||||
|
this->setFixedHeight(TAB_HEIGHT); // PC模式
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ThreadObject::ThreadObject(QString deviceName, QObject *parent)
|
ThreadObject::ThreadObject(QString deviceName, QObject *parent)
|
||||||
:m_devName(deviceName), QObject(parent)
|
:m_devName(deviceName), QObject(parent)
|
||||||
{
|
{
|
||||||
|
|
|
@ -67,7 +67,11 @@ protected:
|
||||||
QSize sizeHint() const;
|
QSize sizeHint() const;
|
||||||
QSize minimumTabSizeHint(int index) const;
|
QSize minimumTabSizeHint(int index) const;
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void onModeChanged(bool mode);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class ThreadObject : public QObject
|
class ThreadObject : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
Loading…
Reference in New Issue