16551需求:PC中最大化和窗口大小变化适配改造
This commit is contained in:
parent
537e2390fa
commit
8b7c2aabbf
|
@ -72,6 +72,16 @@ public:
|
||||||
m_funcType = type;
|
m_funcType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 设置是否平板模式
|
||||||
|
void setIsTabletMode(bool is) {
|
||||||
|
m_isTabletMode = is;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 是否平板模式
|
||||||
|
bool isTabletMode() {
|
||||||
|
return m_isTabletMode;
|
||||||
|
}
|
||||||
|
|
||||||
// 获取当前功能类型
|
// 获取当前功能类型
|
||||||
FuncTypeConverter::FunType getFuncType() {
|
FuncTypeConverter::FunType getFuncType() {
|
||||||
return m_funcType;
|
return m_funcType;
|
||||||
|
@ -126,6 +136,8 @@ private:
|
||||||
bool m_hasArg_restore = false;
|
bool m_hasArg_restore = false;
|
||||||
// 是否跟随主题
|
// 是否跟随主题
|
||||||
BlackgroundMode m_BlackgroundMode = BlackgroundMode::Auto;
|
BlackgroundMode m_BlackgroundMode = BlackgroundMode::Auto;
|
||||||
|
// 是否平板模式
|
||||||
|
bool m_isTabletMode = false;
|
||||||
|
|
||||||
QWidget * m_mainWidget = nullptr;
|
QWidget * m_mainWidget = nullptr;
|
||||||
|
|
||||||
|
|
|
@ -217,14 +217,61 @@ void MainDialog::initConnect()
|
||||||
if (isMaximized()) {
|
if (isMaximized()) {
|
||||||
showNormal();
|
showNormal();
|
||||||
m_maxBtn->setIcon(QIcon::fromTheme("window-maximize-symbolic"));
|
m_maxBtn->setIcon(QIcon::fromTheme("window-maximize-symbolic"));
|
||||||
|
m_maxBtn->setToolTip(tr("Maximize"));
|
||||||
} else {
|
} else {
|
||||||
showMaximized();
|
showMaximized();
|
||||||
m_maxBtn->setIcon(QIcon::fromTheme("window-restore-symbolic"));
|
m_maxBtn->setIcon(QIcon::fromTheme("window-restore-symbolic"));
|
||||||
|
m_maxBtn->setToolTip(tr("Normal"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//关闭按钮
|
//关闭按钮
|
||||||
connect(m_closeBtn, &QPushButton::clicked, this, &MainDialog::closeBtn);
|
connect(m_closeBtn, &QPushButton::clicked, this, &MainDialog::closeBtn);
|
||||||
|
|
||||||
|
if (Utils::isTablet()) {
|
||||||
|
//监听平板模式切换
|
||||||
|
m_statusSessionDbus = new QDBusInterface("com.kylin.statusmanager.interface",
|
||||||
|
"/",
|
||||||
|
"com.kylin.statusmanager.interface",
|
||||||
|
QDBusConnection::sessionBus(),
|
||||||
|
this);
|
||||||
|
if (m_statusSessionDbus->isValid()) {
|
||||||
|
QDBusReply<bool> is_tabletmode = m_statusSessionDbus->call("get_current_tabletmode");
|
||||||
|
GlobelBackupInfo::inst().setIsTabletMode(is_tabletmode);
|
||||||
|
if (is_tabletmode) {
|
||||||
|
if (!isMinimized())
|
||||||
|
showMaximized();
|
||||||
|
m_maxBtn->setVisible(false);
|
||||||
|
} else {
|
||||||
|
if (!isMinimized())
|
||||||
|
showNormal();
|
||||||
|
m_maxBtn->setVisible(true);
|
||||||
|
}
|
||||||
|
connect(m_statusSessionDbus, SIGNAL(mode_change_signal(bool)), this, SLOT(tabletModeChange(bool)));
|
||||||
|
} else {
|
||||||
|
m_maxBtn->setVisible(true);
|
||||||
|
|
||||||
|
qDebug() << "Create statusmanager Interface Failed When : " << QDBusConnection::systemBus().lastError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 平板模式切换
|
||||||
|
* @param isTabletMode true-平板模式;false-PC模式
|
||||||
|
*/
|
||||||
|
void MainDialog::tabletModeChange(bool isTabletMode)
|
||||||
|
{
|
||||||
|
GlobelBackupInfo::inst().setIsTabletMode(isTabletMode);
|
||||||
|
if(isTabletMode){
|
||||||
|
if (!isMinimized())
|
||||||
|
showMaximized();
|
||||||
|
m_maxBtn->setVisible(false);
|
||||||
|
} else {
|
||||||
|
if (!isMinimized())
|
||||||
|
showNormal();
|
||||||
|
m_maxBtn->setVisible(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QStackedWidget>
|
#include <QStackedWidget>
|
||||||
|
#include <QDBusInterface>
|
||||||
|
#include <QDBusReply>
|
||||||
#include "leftsiderbarwidget.h"
|
#include "leftsiderbarwidget.h"
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
@ -29,6 +31,7 @@ protected:
|
||||||
public slots:
|
public slots:
|
||||||
void sltMessageReceived(const QString &msg);
|
void sltMessageReceived(const QString &msg);
|
||||||
void closeBtn();
|
void closeBtn();
|
||||||
|
void tabletModeChange(bool isTabletMode);
|
||||||
void selected(int func_type);
|
void selected(int func_type);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -58,7 +61,8 @@ private:
|
||||||
QAction *m_backupAbout = nullptr;
|
QAction *m_backupAbout = nullptr;
|
||||||
QAction *m_backupExit = nullptr;
|
QAction *m_backupExit = nullptr;
|
||||||
|
|
||||||
// 右侧内容展示部分
|
// 监控是否平板的dbus接口
|
||||||
|
QDBusInterface * m_statusSessionDbus = nullptr;
|
||||||
|
|
||||||
Ui::MainDialog *ui;
|
Ui::MainDialog *ui;
|
||||||
};
|
};
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue