File indexing completed on 2024-04-21 05:46:35
0001 // SPDX-License-Identifier: GPL-3.0-or-later 0002 /* 0003 Copyright 2017 - 2020 Martin Koller, kollix@aon.at 0004 0005 This file is part of liquidshell. 0006 0007 liquidshell is free software: you can redistribute it and/or modify 0008 it under the terms of the GNU General Public License as published by 0009 the Free Software Foundation, either version 3 of the License, or 0010 (at your option) any later version. 0011 0012 liquidshell is distributed in the hope that it will be useful, 0013 but WITHOUT ANY WARRANTY; without even the implied warranty of 0014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0015 GNU General Public License for more details. 0016 0017 You should have received a copy of the GNU General Public License 0018 along with liquidshell. If not, see <http://www.gnu.org/licenses/>. 0019 */ 0020 0021 #ifndef DESKTOP_WIDGET_H 0022 #define DESKTOP_WIDGET_H 0023 0024 #include <QWidget> 0025 #include <QPixmap> 0026 #include <QVector> 0027 class DesktopPanel; 0028 class DesktopApplet; 0029 class ConfigureDesktopDialog; 0030 0031 class DesktopWidget : public QWidget 0032 { 0033 Q_OBJECT 0034 0035 public: 0036 DesktopWidget(); 0037 0038 struct Wallpaper 0039 { 0040 QString fileName, mode; 0041 QColor color; 0042 QVector<QPixmap> pixmaps; // per screen 0043 }; 0044 0045 // since on X11 QScreen:available* methods do not deliver the true 0046 // values (according to Qt doc: This is a limitation in X11 window manager specification.) 0047 static QRect availableGeometry(); 0048 static QSize availableSize(); 0049 0050 protected: 0051 void paintEvent(QPaintEvent *event) override; 0052 0053 private Q_SLOTS: 0054 void loadSettings(); 0055 void placePanel(); 0056 void desktopChanged(); 0057 void configureWallpaper(); 0058 void configureDisplay(); 0059 void addApplet(const QString &type); 0060 void removeApplet(DesktopApplet *applet); 0061 0062 private: 0063 void saveAppletsList(); 0064 0065 private: 0066 DesktopPanel *panel = nullptr; 0067 ConfigureDesktopDialog *dialog = nullptr; 0068 0069 QVector<Wallpaper> wallpapers; 0070 int currentDesktop = -1; 0071 0072 QVector<DesktopApplet *> applets; 0073 static int appletNum; 0074 static DesktopWidget *instance; 0075 }; 0076 0077 #endif