/* * Copyright 2016 Smith AR * Michail Vourlakos * * This file is part of Latte-Dock * * Latte-Dock is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * Latte-Dock is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef PRIMARYCONFIGVIEW_H #define PRIMARYCONFIGVIEW_H // local #include #include "../../wm/windowinfowrap.h" //Qt #include #include #include #include #include // Plasma #include #include namespace Plasma { class Applet; class Containment; class FrameSvg; class Types; } namespace KWayland { namespace Client { class PlasmaShellSurface; } } namespace Latte { class Corona; class View; } namespace Latte { namespace ViewPart { class SecondaryConfigView; } } namespace Latte { namespace ViewPart { class PrimaryConfigView : public QQuickView { Q_OBJECT //! used when the secondary config window can not be shown Q_PROPERTY(bool showInlineProperties READ showInlineProperties NOTIFY showInlinePropertiesChanged) Q_PROPERTY(bool inAdvancedMode READ inAdvancedMode WRITE setInAdvancedMode NOTIFY inAdvancedModeChanged) Q_PROPERTY(bool inParentViewChange READ inParentViewChange NOTIFY inParentViewChangeChanged) Q_PROPERTY(QRect availableScreenGeometry READ availableScreenGeometry NOTIFY availableScreenGeometryChanged) Q_PROPERTY(Plasma::FrameSvg::EnabledBorders enabledBorders READ enabledBorders NOTIFY enabledBordersChanged) public: enum ConfigViewType { PrimaryConfig = 0, SecondaryConfig }; PrimaryConfigView(Latte::View *view); ~PrimaryConfigView() override; void init(); void requestActivate(); Qt::WindowFlags wFlags() const; bool inAdvancedMode() const; void setInAdvancedMode(bool advanced); bool inParentViewChange() const; bool showInlineProperties() const; bool sticker() const; QRect availableScreenGeometry() const; QRect geometryWhenVisible() const; QString validTitle() const; Plasma::FrameSvg::EnabledBorders enabledBorders() const; Latte::View *view() const; void setView(Latte::View *view); QQuickView *secondaryWindow(); public slots: Q_INVOKABLE void hideConfigWindow(); Q_INVOKABLE void setSticker(bool blockFocusLost); Q_INVOKABLE void syncGeometry(); Q_INVOKABLE void updateEffects(); signals: void availableScreenGeometryChanged(); void enabledBordersChanged(); void inAdvancedModeChanged(); void inParentViewChangeChanged(); void raiseDocksTemporaryChanged(); void showInlinePropertiesChanged(); void showSignal(); protected: void showEvent(QShowEvent *ev) override; void hideEvent(QHideEvent *ev) override; void focusOutEvent(QFocusEvent *ev) override; bool event(QEvent *e) override; void syncSlideEffect(); private slots: void immutabilityChanged(Plasma::Types::ImmutabilityType type); void onHiddenConfigurationWindowsAreDeletedChanged(); void updateAvailableScreenGeometry(View *origin = nullptr); void updateEnabledBorders(); void updateShowInlineProperties(); void updateWaylandId(); void showSecondaryWindow(); void hideSecondaryWindow(); void setShowInlineProperties(bool show); void updateViewMask(); void loadConfig(); void saveConfig(); private: void setupWaylandIntegration(); void setInParentViewChange(bool inChange); void initView(Latte::View *view); private: bool m_blockFocusLost{false}; bool m_blockFocusLostOnStartup{true}; bool m_originalByPassWM{false}; bool m_inAdvancedMode{false}; bool m_inParentViewChange{false}; bool m_inReverse{false}; //! it is used by the borders bool m_showInlineProperties{false}; Latte::Types::Visibility m_originalMode{Latte::Types::DodgeActive}; QRect m_availableScreenGeometry; QRect m_geometryWhenVisible; QPointer m_latteView; QPointer m_secConfigView; QTimer m_screenSyncTimer; QTimer m_thicknessSyncTimer; QList connections; QList viewconnections; Plasma::FrameSvg::EnabledBorders m_enabledBorders{Plasma::FrameSvg::AllBorders}; //only for the mask on disabled compositing, not to actually paint Plasma::FrameSvg *m_background{nullptr}; Latte::Corona *m_corona{nullptr}; Latte::WindowSystem::WindowId m_waylandWindowId; KWayland::Client::PlasmaShellSurface *m_shellSurface{nullptr}; }; } } #endif //PRIMARYCONFIGVIEW_H