File indexing completed on 2024-04-28 15:39:42
0001 // SPDX-FileCopyrightText: 2014-2022 Jesper K. Pedersen <blackie@kde.org> 0002 // 0003 // SPDX-License-Identifier: GPL-2.0-or-later 0004 0005 #ifndef REMOTECONTROL_SCREENINFO_H 0006 #define REMOTECONTROL_SCREENINFO_H 0007 0008 #include <QObject> 0009 #include <QSize> 0010 class QScreen; 0011 0012 namespace RemoteControl 0013 { 0014 0015 class ScreenInfo : public QObject 0016 { 0017 Q_OBJECT 0018 Q_PROPERTY(double dotsPerMM MEMBER m_dotsPerMM CONSTANT) 0019 Q_PROPERTY(int overviewIconSize READ overviewIconSize NOTIFY overviewIconSizeChanged) 0020 Q_PROPERTY(int overviewColumnCount MEMBER m_overviewColumnCount NOTIFY overviewColumnCountChanged) 0021 Q_PROPERTY(int overviewSpacing READ overviewSpacing NOTIFY overviewSpacingChanged) 0022 Q_PROPERTY(int viewWidth MEMBER m_viewWidth NOTIFY viewWidthChanged) 0023 Q_PROPERTY(int viewHeight MEMBER m_viewHeight NOTIFY viewHeightChanged) 0024 Q_PROPERTY(int textHeight MEMBER m_textHeight NOTIFY textHeightChanged) 0025 0026 public: 0027 static ScreenInfo &instance(); 0028 void setScreen(QScreen *); 0029 QSize pixelForSizeInMM(int size) const; 0030 void setCategoryCount(int count); 0031 QSize screenSize() const; 0032 QSize viewSize() const; 0033 0034 int overviewIconSize() const; 0035 int overviewSpacing() const; 0036 0037 Q_SIGNALS: 0038 void overviewIconSizeChanged(); 0039 void overviewColumnCountChanged(); 0040 void overviewSpacingChanged(); 0041 void viewWidthChanged(); 0042 void viewHeightChanged(); 0043 void textHeightChanged(); 0044 0045 private Q_SLOTS: 0046 void updateLayout(); 0047 0048 private: 0049 ScreenInfo(); 0050 int possibleColumns(); 0051 int iconHeight(); 0052 0053 QScreen *m_screen; 0054 double m_dotsPerMM; 0055 int m_categoryCount = 0; 0056 int m_overviewColumnCount = 0; 0057 int m_viewWidth = 0; 0058 int m_viewHeight; 0059 int m_textHeight; 0060 }; 0061 0062 } // namespace RemoteControl 0063 0064 #endif // REMOTECONTROL_SCREENINFO_H