2016-12-25 09:25:27 +02:00
/*
* Copyright 2014 Bhushan Shah < bhush94 @ gmail . com >
* Copyright 2014 Marco Martin < notmart @ gmail . com >
*
* This program 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 ) version 3 or any later version
* accepted by the membership of KDE e . V . ( or its successor approved
* by the membership of KDE e . V . ) , which shall act as a proxy
* defined in Section 14 of version 3 of the license .
*
* This program 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 < http : //www.gnu.org/licenses/>
*/
# ifndef NOWDOCKVIEW_H
# define NOWDOCKVIEW_H
# include "plasmaquick/configview.h"
# include "plasmaquick/containmentview.h"
# include "visibilitymanager.h"
# include <QQuickView>
# include <QQmlListProperty>
# include <QScreen>
# include <QPointer>
# include <QTimer>
namespace Plasma {
class Types ;
class Corona ;
class Containment ;
}
/*namespace Candil {
class Dock ;
class DockView ;
class DockConfigView ;
class VisibilityManager ;
} */
2016-12-30 02:20:06 -05:00
namespace Latte {
2016-12-30 16:25:27 -05:00
class DockView : public PlasmaQuick : : ContainmentView {
2016-12-25 09:25:27 +02:00
Q_OBJECT
Q_PROPERTY ( bool compositing READ compositing NOTIFY compositingChanged )
Q_PROPERTY ( int height READ height NOTIFY heightChanged )
Q_PROPERTY ( int length READ length WRITE setLength NOTIFY lengthChanged )
Q_PROPERTY ( int maxLength READ maxLength WRITE setMaxLength NOTIFY maxLengthChanged )
Q_PROPERTY ( int maxThickness READ maxThickness WRITE setMaxThickness NOTIFY maxThicknessChanged )
Q_PROPERTY ( int offset READ offset WRITE setOffset NOTIFY offsetChanged )
Q_PROPERTY ( int width READ width NOTIFY widthChanged )
Q_PROPERTY ( QRect maskArea READ maskArea WRITE setMaskArea NOTIFY maskAreaChanged )
Q_PROPERTY ( VisibilityManager * visibility READ visibility NOTIFY visibilityChanged )
Q_PROPERTY ( QQmlListProperty < QScreen > screens READ screens )
public :
2016-12-30 16:25:27 -05:00
DockView ( Plasma : : Corona * corona , QScreen * targetScreen = nullptr ) ;
virtual ~ DockView ( ) ;
2016-12-25 09:25:27 +02:00
void init ( ) ;
// Candil::VisibilityManager *visibility();
int maxThickness ( ) const ;
void setMaxThickness ( int thickness ) ;
int length ( ) const ;
void setLength ( int length ) ;
QRect maskArea ( ) const ;
void setMaskArea ( QRect area ) ;
int maxLength ( ) const ;
void setMaxLength ( int maxLength ) ;
// Dock::Alignment alignment() const;
// void setAlignment(Dock::Alignment align);
int offset ( ) const ;
void setOffset ( int offset ) ;
void updateOffset ( ) ;
VisibilityManager * visibility ( ) ;
bool compositing ( ) const ;
int currentThickness ( ) const ;
void adaptToScreen ( QScreen * screen ) ;
QQmlListProperty < QScreen > screens ( ) ;
static int countScreens ( QQmlListProperty < QScreen > * property ) ;
static QScreen * atScreens ( QQmlListProperty < QScreen > * property , int index ) ;
public slots :
Q_INVOKABLE void addNewDock ( ) ;
2016-12-29 20:34:21 +02:00
//used from the configuration window
Q_INVOKABLE QList < int > freeEdges ( ) const ;
2016-12-25 09:25:27 +02:00
Q_INVOKABLE void initialize ( ) ;
2016-12-25 16:18:31 +02:00
Q_INVOKABLE void removeDock ( ) ;
2016-12-30 19:26:48 -05:00
Q_INVOKABLE void setLocalDockGeometry ( const QRect & geometry ) ;
2016-12-25 09:25:27 +02:00
void resizeWindow ( ) ;
void restoreConfig ( ) ;
void saveConfig ( ) ;
void updateDockPosition ( ) ;
protected slots :
void showConfigurationInterface ( Plasma : : Applet * applet ) override ;
protected :
bool event ( QEvent * ev ) override ;
// void showEvent(QShowEvent *ev) override;
signals :
// void visibilityChanged();
2016-12-29 15:41:00 +02:00
void addInternalViewSplitter ( ) ;
2016-12-30 13:46:56 +02:00
void eventTriggered ( QEvent * ev ) ;
2016-12-25 09:25:27 +02:00
void alignmentChanged ( ) ;
void compositingChanged ( ) ;
void heightChanged ( ) ;
void lengthChanged ( ) ;
2016-12-30 20:24:21 +02:00
void localDockGeometryChanged ( ) ;
2016-12-25 09:25:27 +02:00
void maskAreaChanged ( ) ;
void maxLengthChanged ( ) ;
void maxThicknessChanged ( ) ;
void offsetChanged ( ) ;
2016-12-29 15:41:00 +02:00
void removeInternalViewSplitter ( ) ;
2016-12-25 09:25:27 +02:00
void visibilityChanged ( ) ;
void widthChanged ( ) ;
2016-12-30 16:25:27 -05:00
public slots :
2016-12-25 09:25:27 +02:00
void updateDockPositionSlot ( ) ;
2016-12-30 20:24:21 +02:00
void updateAbsDockGeometry ( ) ;
2016-12-25 09:25:27 +02:00
private :
bool m_secondInitPass ;
int m_offset { 0 } ;
int m_maxThickness { 24 } ;
int m_length { 0 } ;
int m_maxLength { INT_MAX } ;
2016-12-30 20:24:21 +02:00
QRect m_localDockGeometry ;
2016-12-25 09:25:27 +02:00
QRect m_maskArea ;
QPointer < PlasmaQuick : : ConfigView > m_configView ;
QTimer m_timerGeometry ;
QTimer m_lockGeometry ;
Plasma : : Theme * theme { nullptr } ;
QPointer < VisibilityManager > m_visibility ;
bool containmentContainsPosition ( const QPointF & point ) const ;
QPointF positionAdjustedForContainment ( const QPointF & point ) const ;
void initWindow ( ) ;
} ;
2016-12-30 02:20:06 -05:00
}
2016-12-25 09:25:27 +02:00
# endif