mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
add auto hide check
Change-Id: I002c5c9fd147d6da9c6c83c596100c3e5bc3857e
This commit is contained in:
parent
513c28c0d6
commit
e10e6dc2d2
@ -29,6 +29,8 @@ const QList<DockItem *> DockItemController::itemList() const
|
||||
|
||||
void DockItemController::itemMove(DockItem * const moveItem, DockItem * const replaceItem)
|
||||
{
|
||||
Q_ASSERT(moveItem != replaceItem);
|
||||
|
||||
const DockItem::ItemType moveType = moveItem->itemType();
|
||||
const DockItem::ItemType replaceType = replaceItem->itemType();
|
||||
|
||||
@ -53,7 +55,7 @@ void DockItemController::itemMove(DockItem * const moveItem, DockItem * const re
|
||||
emit itemMoved(moveItem, replaceIndex);
|
||||
|
||||
// for app move, index 0 is launcher item, need to pass it.
|
||||
if (moveItem->itemType() == DockItem::App)
|
||||
if (moveItem->itemType() == DockItem::App && replaceItem->itemType() == DockItem::App)
|
||||
m_appInter->MoveEntry(moveIndex - 1, replaceIndex - 1);
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,8 @@
|
||||
DockSettings::DockSettings(QWidget *parent)
|
||||
: QObject(parent),
|
||||
|
||||
m_autoHide(true),
|
||||
|
||||
m_settingsMenu(this),
|
||||
m_fashionModeAct(tr("Fashion Mode"), this),
|
||||
m_efficientModeAct(tr("Efficient Mode"), this),
|
||||
@ -124,6 +126,11 @@ int DockSettings::screenHeight() const
|
||||
return m_displayInter->screenHeight();
|
||||
}
|
||||
|
||||
bool DockSettings::autoHide() const
|
||||
{
|
||||
return m_autoHide;
|
||||
}
|
||||
|
||||
HideState DockSettings::hideState() const
|
||||
{
|
||||
return m_hideState;
|
||||
@ -141,6 +148,8 @@ const QSize DockSettings::windowSize() const
|
||||
|
||||
void DockSettings::showDockSettingsMenu()
|
||||
{
|
||||
setAutoHide(false);
|
||||
|
||||
m_fashionModeAct.setChecked(m_displayMode == Fashion);
|
||||
m_efficientModeAct.setChecked(m_displayMode == Efficient);
|
||||
m_topPosAct.setChecked(m_position == Top);
|
||||
@ -155,6 +164,8 @@ void DockSettings::showDockSettingsMenu()
|
||||
m_smartHideAct.setChecked(m_hideMode == SmartHide);
|
||||
|
||||
m_settingsMenu.exec();
|
||||
|
||||
setAutoHide(true);
|
||||
}
|
||||
|
||||
void DockSettings::updateGeometry()
|
||||
@ -162,6 +173,15 @@ void DockSettings::updateGeometry()
|
||||
|
||||
}
|
||||
|
||||
void DockSettings::setAutoHide(const bool autoHide)
|
||||
{
|
||||
if (m_autoHide == autoHide)
|
||||
return;
|
||||
|
||||
m_autoHide = autoHide;
|
||||
emit autoHideChanged(m_autoHide);
|
||||
}
|
||||
|
||||
void DockSettings::menuActionClicked(DAction *action)
|
||||
{
|
||||
Q_ASSERT(action);
|
||||
|
@ -29,6 +29,7 @@ public:
|
||||
HideState hideState() const;
|
||||
Position position() const;
|
||||
int screenHeight() const;
|
||||
bool autoHide() const;
|
||||
const QRect primaryRect() const;
|
||||
const QSize windowSize() const;
|
||||
|
||||
@ -36,12 +37,14 @@ public:
|
||||
|
||||
signals:
|
||||
void dataChanged() const;
|
||||
void autoHideChanged(const bool autoHide) const;
|
||||
void windowVisibleChanegd() const;
|
||||
void windowHideModeChanged() const;
|
||||
void windowGeometryChanged() const;
|
||||
|
||||
public slots:
|
||||
void updateGeometry();
|
||||
void setAutoHide(const bool autoHide);
|
||||
|
||||
private slots:
|
||||
void menuActionClicked(DAction *action);
|
||||
@ -60,6 +63,7 @@ private:
|
||||
|
||||
private:
|
||||
int m_iconSize;
|
||||
bool m_autoHide;
|
||||
Position m_position;
|
||||
HideMode m_hideMode;
|
||||
HideState m_hideState;
|
||||
|
@ -114,6 +114,7 @@ void MainWindow::initConnections()
|
||||
connect(m_settings, &DockSettings::windowGeometryChanged, this, &MainWindow::updateGeometry, Qt::QueuedConnection);
|
||||
connect(m_settings, &DockSettings::windowHideModeChanged, this, &MainWindow::setStrutPartial, Qt::QueuedConnection);
|
||||
connect(m_settings, &DockSettings::windowVisibleChanegd, this, &MainWindow::updatePanelVisible, Qt::QueuedConnection);
|
||||
connect(m_settings, &DockSettings::autoHideChanged, this, &MainWindow::updatePanelVisible);
|
||||
|
||||
connect(m_panelHideAni, &QPropertyAnimation::finished, this, &MainWindow::updateGeometry);
|
||||
|
||||
@ -326,8 +327,21 @@ void MainWindow::updatePanelVisible()
|
||||
if (state == Unknown)
|
||||
return;
|
||||
|
||||
if (state == Show)
|
||||
expand();
|
||||
else
|
||||
narrow();
|
||||
do
|
||||
{
|
||||
if (state != Hide)
|
||||
break;
|
||||
|
||||
if (!m_settings->autoHide())
|
||||
break;
|
||||
|
||||
QRect r(pos(), size());
|
||||
if (r.contains(QCursor::pos()))
|
||||
break;
|
||||
|
||||
return narrow();
|
||||
|
||||
} while (false);
|
||||
|
||||
return expand();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user