Add visibility interface

This commit is contained in:
reionwong 2021-09-11 14:37:33 +08:00
parent 2065a08b17
commit 616e8ec83f
4 changed files with 17 additions and 0 deletions

View file

@ -199,6 +199,10 @@ bool ApplicationModel::openNewInstance(const QString &appId)
return false; return false;
QProcess process; QProcess process;
if (appId == "cutefish-launcher")
process.setArguments(QStringList() << "--show");
if (!item->exec.isEmpty()) { if (!item->exec.isEmpty()) {
QStringList args = item->exec.split(" "); QStringList args = item->exec.split(" ");
process.setProgram(args.first()); process.setProgram(args.first());

View file

@ -123,6 +123,11 @@ int MainWindow::direction() const
return DockSettings::self()->direction(); return DockSettings::self()->direction();
} }
int MainWindow::visibility() const
{
return DockSettings::self()->visibility();
}
void MainWindow::setDirection(int direction) void MainWindow::setDirection(int direction)
{ {
DockSettings::self()->setDirection(static_cast<DockSettings::Direction>(direction)); DockSettings::self()->setDirection(static_cast<DockSettings::Direction>(direction));
@ -351,6 +356,8 @@ void MainWindow::onIconSizeChanged()
void MainWindow::onVisibilityChanged() void MainWindow::onVisibilityChanged()
{ {
emit visibilityChanged();
if (m_activity->launchPad()) { if (m_activity->launchPad()) {
m_hideTimer->stop(); m_hideTimer->stop();
clearViewStruts(); clearViewStruts();

View file

@ -34,6 +34,7 @@ class MainWindow : public QQuickView
Q_OBJECT Q_OBJECT
Q_PROPERTY(QRect primaryGeometry READ primaryGeometry NOTIFY primaryGeometryChanged) Q_PROPERTY(QRect primaryGeometry READ primaryGeometry NOTIFY primaryGeometryChanged)
Q_PROPERTY(int direction READ direction NOTIFY directionChanged) Q_PROPERTY(int direction READ direction NOTIFY directionChanged)
Q_PROPERTY(int visibility READ visibility NOTIFY visibilityChanged)
public: public:
explicit MainWindow(QQuickView *parent = nullptr); explicit MainWindow(QQuickView *parent = nullptr);
@ -47,6 +48,8 @@ public:
QRect primaryGeometry() const; QRect primaryGeometry() const;
int direction() const; int direction() const;
int visibility() const;
void setDirection(int direction); void setDirection(int direction);
void setIconSize(int iconSize); void setIconSize(int iconSize);
void setVisibility(int visibility); void setVisibility(int visibility);
@ -58,6 +61,7 @@ signals:
void iconSizeChanged(); void iconSizeChanged();
void directionChanged(); void directionChanged();
void primaryGeometryChanged(); void primaryGeometryChanged();
void visibilityChanged();
private: private:
QRect windowRect() const; QRect windowRect() const;

View file

@ -17,8 +17,10 @@
</property> </property>
<property name="direction" type="i" access="read"></property> <property name="direction" type="i" access="read"></property>
<property name="visibility" type="i" access="read"></property>
<signal name="primaryGeometryChanged"></signal> <signal name="primaryGeometryChanged"></signal>
<signal name="directionChanged"></signal> <signal name="directionChanged"></signal>
<signal name="visibilityChanged"></signal>
</interface> </interface>
</node> </node>