mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-03 00:15:21 +00:00
feat: 限制缩放情况下任务栏的最小高度,防止显示图标异常
任务栏的最小高度范围为40-100,在开启缩放情况下,最小就不应该是40,比如开启1.25倍时,应为50才对 Log: 限制缩放情况下任务栏的最小高度,防止显示图标异常 Change-Id: I2b27f708636c4a0ff80f65e9bccc3bd4641fe201 Reviewed-on: http://gerrit.uniontech.com/c/dde-dock/+/3024 Reviewed-by: <mailman@uniontech.com> Reviewed-by: fanpengcheng <fanpengcheng@uniontech.com> Reviewed-by: pengwenhao <pengwenhao@uniontech.com> Tested-by: <mailman@uniontech.com>
This commit is contained in:
parent
648b990fc8
commit
26df6a2871
@ -151,12 +151,11 @@ void MultiScreenWorker::onAutoHideChanged(bool autoHide)
|
||||
|
||||
void MultiScreenWorker::updateDaemonDockSize(int dockSize)
|
||||
{
|
||||
const qreal scale = qApp->devicePixelRatio();
|
||||
m_dockInter->setWindowSize(uint(dockSize * scale));
|
||||
m_dockInter->setWindowSize(uint(dockSize));
|
||||
if (m_displayMode == DisplayMode::Fashion)
|
||||
m_dockInter->setWindowSizeFashion(uint(dockSize * scale));
|
||||
m_dockInter->setWindowSizeFashion(uint(dockSize));
|
||||
else
|
||||
m_dockInter->setWindowSizeEfficient(uint(dockSize * scale));
|
||||
m_dockInter->setWindowSizeEfficient(uint(dockSize));
|
||||
}
|
||||
|
||||
void MultiScreenWorker::onDragStateChanged(bool draging)
|
||||
@ -1347,7 +1346,7 @@ QRect MultiScreenWorker::getDockShowGeometry(const QString &screenName, const Po
|
||||
if (withoutScale) {//后端真实大小
|
||||
foreach (Monitor *inter, validMonitorList(m_monitorInfo)) {
|
||||
if (inter->name() == screenName) {
|
||||
const int dockSize = int(displaymode == DisplayMode::Fashion ? m_dockInter->windowSizeFashion() : m_dockInter->windowSizeEfficient()) * scale;
|
||||
const int dockSize = int(displaymode == DisplayMode::Fashion ? m_dockInter->windowSizeFashion() : m_dockInter->windowSizeEfficient());
|
||||
switch (static_cast<Position>(pos)) {
|
||||
case Top: {
|
||||
rect.setX(inter->x() + WINDOWMARGIN);
|
||||
@ -1383,7 +1382,8 @@ QRect MultiScreenWorker::getDockShowGeometry(const QString &screenName, const Po
|
||||
} else {//前端真实大小
|
||||
foreach (Monitor *inter, validMonitorList(m_monitorInfo)) {
|
||||
if (inter->name() == screenName) {
|
||||
const int dockSize = int(displaymode == DisplayMode::Fashion ? m_dockInter->windowSizeFashion() : m_dockInter->windowSizeEfficient());
|
||||
// 注意这里的dockSize是除以缩放的
|
||||
const int dockSize = int(displaymode == DisplayMode::Fashion ? m_dockInter->windowSizeFashion() : m_dockInter->windowSizeEfficient()) / scale;
|
||||
switch (static_cast<Position>(pos)) {
|
||||
case Top: {
|
||||
rect.setX(inter->x() + WINDOWMARGIN);
|
||||
|
@ -352,13 +352,13 @@ void MainWindow::resetDragWindow()
|
||||
|
||||
if (m_multiScreenWorker->position() == Position::Left
|
||||
|| m_multiScreenWorker->position() == Position::Right) {
|
||||
m_dockSize = this->width();
|
||||
m_dockSize = this->width() * qApp->devicePixelRatio();
|
||||
} else {
|
||||
m_dockSize = this->height();
|
||||
m_dockSize = this->height() * qApp->devicePixelRatio();
|
||||
}
|
||||
|
||||
// 通知窗管和后端更新数据
|
||||
m_multiScreenWorker->updateDaemonDockSize(m_dockSize / qApp->devicePixelRatio()); // 1.先更新任务栏高度
|
||||
m_multiScreenWorker->updateDaemonDockSize(m_dockSize); // 1.先更新任务栏高度
|
||||
m_multiScreenWorker->requestUpdateFrontendGeometry(); // 2.再更新任务栏位置,保证先1再2
|
||||
m_multiScreenWorker->requestNotifyWindowManager();
|
||||
|
||||
@ -375,41 +375,39 @@ void MainWindow::onMainWindowSizeChanged(QPoint offset)
|
||||
, m_multiScreenWorker->position()
|
||||
, HideMode::KeepShowing,
|
||||
m_multiScreenWorker->displayMode());
|
||||
const qreal scale = qApp->devicePixelRatio();
|
||||
QRect newRect;
|
||||
switch (m_multiScreenWorker->position()) {
|
||||
case Top: {
|
||||
newRect.setX(rect.x());
|
||||
newRect.setY(rect.y());
|
||||
newRect.setWidth(rect.width());
|
||||
newRect.setHeight(qBound(MAINWINDOW_MIN_SIZE, rect.height() + offset.y(), MAINWINDOW_MAX_SIZE));
|
||||
newRect.setHeight(qBound(qMax(int(MAINWINDOW_MIN_SIZE / scale), MAINWINDOW_MIN_SIZE), rect.height() + offset.y(), int(MAINWINDOW_MAX_SIZE / scale)));
|
||||
}
|
||||
break;
|
||||
case Bottom: {
|
||||
newRect.setX(rect.x());
|
||||
newRect.setY(rect.y() + rect.height() - qBound(MAINWINDOW_MIN_SIZE, rect.height() - offset.y(), MAINWINDOW_MAX_SIZE));
|
||||
newRect.setY(rect.y() + rect.height() - qBound(qMax(int(MAINWINDOW_MIN_SIZE / scale), MAINWINDOW_MIN_SIZE), rect.height() - offset.y(), int(MAINWINDOW_MAX_SIZE / scale)));
|
||||
newRect.setWidth(rect.width());
|
||||
newRect.setHeight(qBound(MAINWINDOW_MIN_SIZE, rect.height() - offset.y(), MAINWINDOW_MAX_SIZE ));
|
||||
newRect.setHeight(qBound(qMax(int(MAINWINDOW_MIN_SIZE / scale), MAINWINDOW_MIN_SIZE), rect.height() - offset.y(), int(MAINWINDOW_MAX_SIZE / scale) ));
|
||||
}
|
||||
break;
|
||||
case Left: {
|
||||
newRect.setX(rect.x());
|
||||
newRect.setY(rect.y());
|
||||
newRect.setWidth(qBound(MAINWINDOW_MIN_SIZE, rect.width() + offset.x(), MAINWINDOW_MAX_SIZE));
|
||||
newRect.setWidth(qBound(qMax(int(MAINWINDOW_MIN_SIZE / scale), MAINWINDOW_MIN_SIZE), rect.width() + offset.x(), int(MAINWINDOW_MAX_SIZE / scale)));
|
||||
newRect.setHeight(rect.height());
|
||||
}
|
||||
break;
|
||||
case Right: {
|
||||
newRect.setX(rect.x() + rect.width() - qBound(MAINWINDOW_MIN_SIZE, rect.width() - offset.x(), MAINWINDOW_MAX_SIZE));
|
||||
newRect.setX(rect.x() + rect.width() - qBound(qMax(int(MAINWINDOW_MIN_SIZE / scale), MAINWINDOW_MIN_SIZE), rect.width() - offset.x(), int(MAINWINDOW_MAX_SIZE / scale)));
|
||||
newRect.setY(rect.y());
|
||||
newRect.setWidth(qBound(MAINWINDOW_MIN_SIZE, rect.width() - offset.x(), MAINWINDOW_MAX_SIZE));
|
||||
newRect.setWidth(qBound(qMax(int(MAINWINDOW_MIN_SIZE / scale), MAINWINDOW_MIN_SIZE), rect.width() - offset.x(), int(MAINWINDOW_MAX_SIZE / scale)));
|
||||
newRect.setHeight(rect.height());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
const Position pos = m_multiScreenWorker->position();
|
||||
m_dockSize = ((pos == Position::Top || pos == Position::Bottom) ? newRect.height() : newRect.width());
|
||||
|
||||
// 更新界面大小
|
||||
m_mainPanel->setFixedSize(newRect.size());
|
||||
setFixedSize(newRect.size());
|
||||
|
@ -82,16 +82,6 @@ AdaptersManager::AdaptersManager(QObject *parent)
|
||||
}
|
||||
}
|
||||
|
||||
//QMap<QString, const Adapter *> AdaptersManager::adapters() const
|
||||
//{
|
||||
// return m_adapters;
|
||||
//}
|
||||
|
||||
//const Adapter *AdaptersManager::adapterById(const QString &id)
|
||||
//{
|
||||
// return m_adapters.keys().contains(id) ? m_adapters[id] : nullptr;
|
||||
//}
|
||||
|
||||
void AdaptersManager::setAdapterPowered(const Adapter *adapter, const bool &powered)
|
||||
{
|
||||
if (!adapter)
|
||||
@ -122,18 +112,6 @@ void AdaptersManager::setAdapterPowered(const Adapter *adapter, const bool &powe
|
||||
}
|
||||
}
|
||||
|
||||
//void AdaptersManager::connectAllPairedDevice(const Adapter *adapter)
|
||||
//{
|
||||
// for (const Device *d : adapter->paredDevices()) {
|
||||
// Device *vd = const_cast<Device *>(d);
|
||||
// if (vd) {
|
||||
// QDBusObjectPath path(vd->id());
|
||||
// m_bluetoothInter->ConnectDevice(path);
|
||||
// qDebug() << "connect to device: " << vd->name();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
void AdaptersManager::connectDevice(Device *device, Adapter *adapter)
|
||||
{
|
||||
if (device) {
|
||||
|
@ -34,11 +34,7 @@ class AdaptersManager : public QObject
|
||||
public:
|
||||
explicit AdaptersManager(QObject *parent = nullptr);
|
||||
|
||||
// QMap<QString, const Adapter *> adapters() const;
|
||||
// const Adapter *adapterById(const QString &id);
|
||||
|
||||
void setAdapterPowered(const Adapter *adapter, const bool &powered);
|
||||
// void connectAllPairedDevice(const Adapter *adapter);
|
||||
void connectDevice(Device *device, Adapter *adapter);
|
||||
bool defaultAdapterInitPowerState();
|
||||
int adaptersCount();
|
||||
|
Loading…
x
Reference in New Issue
Block a user