Add interface for launcher
This commit is contained in:
parent
0dbc91c371
commit
d9a5064ea6
3 changed files with 43 additions and 7 deletions
|
@ -113,6 +113,16 @@ bool MainWindow::pinned(const QString &desktop)
|
|||
return m_appModel->isDesktopPinned(desktop);
|
||||
}
|
||||
|
||||
QRect MainWindow::primaryGeometry() const
|
||||
{
|
||||
return geometry();
|
||||
}
|
||||
|
||||
int MainWindow::direction() const
|
||||
{
|
||||
return DockSettings::self()->direction();
|
||||
}
|
||||
|
||||
void MainWindow::setDirection(int direction)
|
||||
{
|
||||
DockSettings::self()->setDirection(static_cast<DockSettings::Direction>(direction));
|
||||
|
@ -337,7 +347,7 @@ void MainWindow::onPositionChanged()
|
|||
updateViewStruts();
|
||||
}
|
||||
|
||||
emit positionChanged();
|
||||
emit directionChanged();
|
||||
}
|
||||
|
||||
void MainWindow::onIconSizeChanged()
|
||||
|
@ -350,10 +360,16 @@ void MainWindow::onIconSizeChanged()
|
|||
|
||||
void MainWindow::onVisibilityChanged()
|
||||
{
|
||||
if (m_activity->launchPad()) {
|
||||
m_hideTimer->stop();
|
||||
clearViewStruts();
|
||||
setVisible(true);
|
||||
return;
|
||||
}
|
||||
|
||||
// Always show
|
||||
// Must remain displayed when launchpad is opened.
|
||||
if (m_settings->visibility() == DockSettings::AlwaysShow
|
||||
|| m_activity->launchPad()) {
|
||||
if (m_settings->visibility() == DockSettings::AlwaysShow) {
|
||||
m_hideTimer->stop();
|
||||
|
||||
setGeometry(windowRect());
|
||||
|
@ -366,9 +382,6 @@ void MainWindow::onVisibilityChanged()
|
|||
}
|
||||
}
|
||||
|
||||
if (m_activity->launchPad())
|
||||
return;
|
||||
|
||||
if (m_settings->visibility() == DockSettings::IntellHide) {
|
||||
clearViewStruts();
|
||||
setGeometry(windowRect());
|
||||
|
@ -434,3 +447,10 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *e)
|
|||
|
||||
return QQuickView::eventFilter(obj, e);
|
||||
}
|
||||
|
||||
void MainWindow::resizeEvent(QResizeEvent *e)
|
||||
{
|
||||
emit primaryGeometryChanged();
|
||||
|
||||
QQuickView::resizeEvent(e);
|
||||
}
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
class MainWindow : public QQuickView
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QRect primaryGeometry READ primaryGeometry NOTIFY primaryGeometryChanged)
|
||||
Q_PROPERTY(int direction READ direction NOTIFY directionChanged)
|
||||
|
||||
public:
|
||||
explicit MainWindow(QQuickView *parent = nullptr);
|
||||
|
@ -42,6 +44,9 @@ public:
|
|||
void remove(const QString &desktop);
|
||||
bool pinned(const QString &desktop);
|
||||
|
||||
QRect primaryGeometry() const;
|
||||
int direction() const;
|
||||
|
||||
void setDirection(int direction);
|
||||
void setIconSize(int iconSize);
|
||||
void setVisibility(int visibility);
|
||||
|
@ -51,7 +56,8 @@ public:
|
|||
signals:
|
||||
void resizingFished();
|
||||
void iconSizeChanged();
|
||||
void positionChanged();
|
||||
void directionChanged();
|
||||
void primaryGeometryChanged();
|
||||
|
||||
private:
|
||||
QRect windowRect() const;
|
||||
|
@ -74,6 +80,7 @@ private slots:
|
|||
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *e) override;
|
||||
void resizeEvent(QResizeEvent *) override;
|
||||
|
||||
private:
|
||||
Activity *m_activity;
|
||||
|
|
|
@ -11,5 +11,14 @@
|
|||
<method name="setDirection"><arg name="direction" type="i" direction="in"/></method>
|
||||
<method name="setIconSize"><arg name="iconSize" type="i" direction="in"/></method>
|
||||
<method name="setVisibility"><arg name="visibility" type="i" direction="in"/></method>
|
||||
|
||||
<property name="primaryGeometry" type="(iiii)" access="read">
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName" value="QRect"/>
|
||||
</property>
|
||||
|
||||
<property name="direction" type="i" access="read"></property>
|
||||
|
||||
<signal name="primaryGeometryChanged"></signal>
|
||||
<signal name="directionChanged"></signal>
|
||||
</interface>
|
||||
</node>
|
||||
|
|
Loading…
Reference in a new issue