Changeset View
Changeset View
Standalone View
Standalone View
shell/shellcorona.cpp
Show All 15 Lines | |||||
16 | * | 16 | * | ||
17 | * You should have received a copy of the GNU Library General Public | 17 | * You should have received a copy of the GNU Library General Public | ||
18 | * License along with this program; if not, write to the | 18 | * License along with this program; if not, write to the | ||
19 | * Free Software Foundation, Inc., | 19 | * Free Software Foundation, Inc., | ||
20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
21 | */ | 21 | */ | ||
22 | 22 | | |||
23 | #include "shellcorona.h" | 23 | #include "shellcorona.h" | ||
24 | #include "strutmanager.h" | ||||
24 | 25 | | |||
25 | #include <config-plasma.h> | 26 | #include <config-plasma.h> | ||
26 | 27 | | |||
27 | #include <QApplication> | 28 | #include <QApplication> | ||
28 | #include <QDebug> | 29 | #include <QDebug> | ||
29 | #include <QMenu> | 30 | #include <QMenu> | ||
30 | #include <QQmlContext> | 31 | #include <QQmlContext> | ||
31 | #include <QDBusConnection> | 32 | #include <QDBusConnection> | ||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Line(s) | 102 | ShellCorona::ShellCorona(QObject *parent) | |||
102 | : Plasma::Corona(parent), | 103 | : Plasma::Corona(parent), | ||
103 | m_config(KSharedConfig::openConfig(QStringLiteral("plasmarc"))), | 104 | m_config(KSharedConfig::openConfig(QStringLiteral("plasmarc"))), | ||
104 | m_screenPool(new ScreenPool(KSharedConfig::openConfig(), this)), | 105 | m_screenPool(new ScreenPool(KSharedConfig::openConfig(), this)), | ||
105 | m_activityController(new KActivities::Controller(this)), | 106 | m_activityController(new KActivities::Controller(this)), | ||
106 | m_addPanelAction(nullptr), | 107 | m_addPanelAction(nullptr), | ||
107 | m_addPanelsMenu(nullptr), | 108 | m_addPanelsMenu(nullptr), | ||
108 | m_interactiveConsole(nullptr), | 109 | m_interactiveConsole(nullptr), | ||
109 | m_waylandPlasmaShell(nullptr), | 110 | m_waylandPlasmaShell(nullptr), | ||
110 | m_closingDown(false) | 111 | m_closingDown(false), | ||
112 | m_strutManager(new StrutManager(this)) | ||||
111 | { | 113 | { | ||
112 | setupWaylandIntegration(); | 114 | setupWaylandIntegration(); | ||
113 | qmlRegisterUncreatableType<DesktopView>("org.kde.plasma.shell", 2, 0, "Desktop", QStringLiteral("It is not possible to create objects of type Desktop")); | 115 | qmlRegisterUncreatableType<DesktopView>("org.kde.plasma.shell", 2, 0, "Desktop", QStringLiteral("It is not possible to create objects of type Desktop")); | ||
114 | qmlRegisterUncreatableType<PanelView>("org.kde.plasma.shell", 2, 0, "Panel", QStringLiteral("It is not possible to create objects of type Panel")); | 116 | qmlRegisterUncreatableType<PanelView>("org.kde.plasma.shell", 2, 0, "Panel", QStringLiteral("It is not possible to create objects of type Panel")); | ||
115 | 117 | | |||
116 | m_lookAndFeelPackage = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/LookAndFeel")); | 118 | m_lookAndFeelPackage = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/LookAndFeel")); | ||
117 | KConfigGroup cg(KSharedConfig::openConfig(QStringLiteral("kdeglobals")), "KDE"); | 119 | KConfigGroup cg(KSharedConfig::openConfig(QStringLiteral("kdeglobals")), "KDE"); | ||
118 | const QString packageName = cg.readEntry("LookAndFeelPackage", QString()); | 120 | const QString packageName = cg.readEntry("LookAndFeelPackage", QString()); | ||
▲ Show 20 Lines • Show All 917 Lines • ▼ Show 20 Line(s) | 1036 | { | |||
1036 | if (!view) { | 1038 | if (!view) { | ||
1037 | qWarning() << "requesting unexisting screen" << id; | 1039 | qWarning() << "requesting unexisting screen" << id; | ||
1038 | QScreen *s = qGuiApp->primaryScreen(); | 1040 | QScreen *s = qGuiApp->primaryScreen(); | ||
1039 | return s ? s->geometry() : QRect(); | 1041 | return s ? s->geometry() : QRect(); | ||
1040 | } | 1042 | } | ||
1041 | return view->geometry(); | 1043 | return view->geometry(); | ||
1042 | } | 1044 | } | ||
1043 | 1045 | | |||
1044 | QRegion ShellCorona::availableScreenRegion(int id) const | 1046 | QRegion ShellCorona::availableScreenRegion(int id) const | ||
1045 | { | 1047 | { | ||
mvourlakos: indent issues for all function | |||||
1048 | return m_strutManager->availableScreenRegion(id); | ||||
1049 | } | ||||
1050 | | ||||
1051 | QRegion ShellCorona::_availableScreenRegion(int id) const | ||||
mvourlakos: I think is missing a "{" here | |||||
1052 | { | ||||
1046 | DesktopView* view = m_desktopViewforId.value(id); | 1053 | DesktopView* view = m_desktopViewforId.value(id); | ||
1047 | if (!view) { | 1054 | if (!view) { | ||
1048 | //each screen should have a view | 1055 | //each screen should have a view | ||
1049 | qWarning() << "requesting unexisting screen" << id; | 1056 | qWarning() << "requesting unexisting screen" << id; | ||
1050 | QScreen *s = qGuiApp->primaryScreen(); | 1057 | QScreen *s = qGuiApp->primaryScreen(); | ||
1051 | return s ? s->availableGeometry() : QRegion(); | 1058 | return s ? s->availableGeometry() : QRegion(); | ||
1052 | } | 1059 | } | ||
1053 | 1060 | | |||
1054 | QRegion r = view->geometry(); | 1061 | QRegion r = view->geometry(); | ||
1055 | for (const PanelView *v : m_panelViews) { | 1062 | for (const PanelView *v : m_panelViews) { | ||
1056 | if (v->isVisible() && view->screen() == v->screen() && v->visibilityMode() != PanelView::AutoHide) { | 1063 | if (v->isVisible() && view->screen() == v->screen() && v->visibilityMode() != PanelView::AutoHide) { | ||
1057 | //if the panel is being moved around, we still want to calculate it from the edge | 1064 | //if the panel is being moved around, we still want to calculate it from the edge | ||
1058 | r -= v->geometryByDistance(0); | 1065 | r -= v->geometryByDistance(0); | ||
1059 | } | 1066 | } | ||
1060 | } | 1067 | } | ||
1061 | return r; | 1068 | return r; | ||
1062 | } | 1069 | } | ||
1063 | 1070 | | |||
1064 | QRect ShellCorona::availableScreenRect(int id) const | 1071 | QRect ShellCorona::availableScreenRect(int id) const | ||
1065 | { | 1072 | { | ||
1073 | return m_strutManager->availableScreenRect(id); | ||||
1074 | } | ||||
davidedmundson: Why not a union? One can have a panel and latte? | |||||
1075 | | ||||
1076 | QRect ShellCorona::_availableScreenRect(int id) const | ||||
1077 | { | ||||
1066 | DesktopView *view = m_desktopViewforId.value(id); | 1078 | DesktopView *view = m_desktopViewforId.value(id); | ||
1067 | if (!view) { | 1079 | if (!view) { | ||
1068 | //each screen should have a view | 1080 | //each screen should have a view | ||
1069 | qWarning() << "requesting unexisting screen" << id; | 1081 | qWarning() << "requesting unexisting screen" << id; | ||
1070 | QScreen *s = qGuiApp->primaryScreen(); | 1082 | QScreen *s = qGuiApp->primaryScreen(); | ||
1071 | return s ? s->availableGeometry() : QRect(); | 1083 | return s ? s->availableGeometry() : QRect(); | ||
1072 | } | 1084 | } | ||
1073 | 1085 | | |||
▲ Show 20 Lines • Show All 1120 Lines • Show Last 20 Lines |
indent issues for all function