mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-04 02:34:45 +00:00
Revert "Initial splashscreen rework (!31)"
This reverts commit 2291872e23.
This commit is contained in:
parent
2291872e23
commit
294ee2a4be
7 changed files with 21 additions and 184 deletions
|
|
@ -1,7 +1,6 @@
|
||||||
set(homescreen_SRCS
|
set(homescreen_SRCS
|
||||||
homescreen.cpp
|
homescreen.cpp
|
||||||
applicationlistmodel.cpp
|
applicationlistmodel.cpp
|
||||||
colouraverage.cpp
|
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(plasma_containment_phone_homescreen MODULE ${homescreen_SRCS})
|
add_library(plasma_containment_phone_homescreen MODULE ${homescreen_SRCS})
|
||||||
|
|
|
||||||
|
|
@ -1,57 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* Copyright (C) 2019 Carson Black <uhhadd@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) any later version. *
|
|
||||||
* *
|
|
||||||
* 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, write to the *
|
|
||||||
* Free Software Foundation, Inc., *
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QColor>
|
|
||||||
#include <QImage>
|
|
||||||
#include <QDebug>
|
|
||||||
#include <signal.h>
|
|
||||||
|
|
||||||
#include "colouraverage.h"
|
|
||||||
|
|
||||||
ColourAverage::ColourAverage(QObject* parent) : QObject(parent) {}
|
|
||||||
|
|
||||||
QColor ColourAverage::averageColour(QImage img) {
|
|
||||||
int r = 0;
|
|
||||||
int g = 0;
|
|
||||||
int b = 0;
|
|
||||||
int c = 0;
|
|
||||||
|
|
||||||
for (int i = 0; i < img.width(); i++) {
|
|
||||||
for (int ii = 0; ii < img.height(); ii++) {
|
|
||||||
QRgb pix = img.pixel(i, ii);
|
|
||||||
if (pix == 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
c++;
|
|
||||||
r += qRed(pix);
|
|
||||||
g += qGreen(pix);
|
|
||||||
b += qBlue(pix);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
r = r / c;
|
|
||||||
g = g / c;
|
|
||||||
b = b / c;
|
|
||||||
|
|
||||||
QColor color = QColor::fromRgb(r,g,b);
|
|
||||||
|
|
||||||
color.setHsv(color.hue(), color.saturation() / 4, color.value());
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* Copyright (C) 2019 Carson Black *
|
|
||||||
* *
|
|
||||||
* 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) any later version. *
|
|
||||||
* *
|
|
||||||
* 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, write to the *
|
|
||||||
* Free Software Foundation, Inc., *
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QColor>
|
|
||||||
#include <QImage>
|
|
||||||
|
|
||||||
class ColourAverage : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit ColourAverage(QObject* parent = nullptr);
|
|
||||||
Q_INVOKABLE QColor averageColour(QImage img);
|
|
||||||
};
|
|
||||||
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
#include "homescreen.h"
|
#include "homescreen.h"
|
||||||
#include "applicationlistmodel.h"
|
#include "applicationlistmodel.h"
|
||||||
#include "colouraverage.h"
|
|
||||||
|
|
||||||
#include <QtQml>
|
#include <QtQml>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
@ -29,13 +28,6 @@ HomeScreen::HomeScreen(QObject *parent, const QVariantList &args)
|
||||||
: Plasma::Containment(parent, args)
|
: Plasma::Containment(parent, args)
|
||||||
{
|
{
|
||||||
qmlRegisterUncreatableType<ApplicationListModel>("org.kde.phone.homescreen", 1, 0, "ApplicationListModel", QStringLiteral("Cannot create item of type ApplicationListModel"));
|
qmlRegisterUncreatableType<ApplicationListModel>("org.kde.phone.homescreen", 1, 0, "ApplicationListModel", QStringLiteral("Cannot create item of type ApplicationListModel"));
|
||||||
qmlRegisterSingletonType<ColourAverage>("org.kde.phone.homescreen", 1, 0, "ColourAverage", [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QObject * {
|
|
||||||
Q_UNUSED(engine);
|
|
||||||
Q_UNUSED(scriptEngine);
|
|
||||||
|
|
||||||
ColourAverage *obj = new ColourAverage();
|
|
||||||
return obj;
|
|
||||||
});
|
|
||||||
|
|
||||||
setHasConfigurationInterface(true);
|
setHasConfigurationInterface(true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,6 @@ import QtQuick.Window 2.2
|
||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||||
import QtGraphicalEffects 1.12
|
|
||||||
|
|
||||||
import org.kde.phone.homescreen 1.0
|
|
||||||
|
|
||||||
Window {
|
Window {
|
||||||
id: window
|
id: window
|
||||||
|
|
@ -55,26 +52,24 @@ Window {
|
||||||
state: "closed"
|
state: "closed"
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: PlasmaCore.Theme.backgroundColor
|
color: background.backgroundColor
|
||||||
Rectangle {
|
|
||||||
id: rect
|
ColumnLayout {
|
||||||
anchors.fill: parent
|
|
||||||
}
|
|
||||||
PlasmaCore.IconItem {
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
PlasmaCore.IconItem {
|
||||||
id: icon
|
id: icon
|
||||||
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
|
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
|
||||||
width: units.iconSizes.enormous
|
Layout.preferredWidth: units.iconSizes.enormous
|
||||||
height: width
|
Layout.preferredHeight: Layout.preferredWidth
|
||||||
|
Layout.alignment: Qt.AlignCenter
|
||||||
}
|
}
|
||||||
DropShadow {
|
PlasmaExtras.Heading {
|
||||||
anchors.fill: icon
|
text: window.title
|
||||||
horizontalOffset: 0
|
Layout.alignment: Qt.AlignCenter
|
||||||
verticalOffset: 0
|
}
|
||||||
radius: 8.0
|
/* PlasmaComponents.BusyIndicator {
|
||||||
samples: 17
|
Layout.alignment: Qt.AlignCenter
|
||||||
color: "#80000000"
|
}*/
|
||||||
source: icon
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -108,12 +103,7 @@ Window {
|
||||||
from: "closed"
|
from: "closed"
|
||||||
SequentialAnimation {
|
SequentialAnimation {
|
||||||
ScriptAction {
|
ScriptAction {
|
||||||
script: {
|
script: window.visible = true;
|
||||||
window.visible = true;
|
|
||||||
icon.grabToImage((img) => {
|
|
||||||
rect.color = ColourAverage.averageColour(img.image)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
PropertyAnimation {
|
PropertyAnimation {
|
||||||
target: background
|
target: background
|
||||||
|
|
|
||||||
|
|
@ -48,8 +48,6 @@ ContainmentLayoutManager.ItemContainer {
|
||||||
|
|
||||||
editModeCondition: ContainmentLayoutManager.ItemContainer.AfterPressAndHold
|
editModeCondition: ContainmentLayoutManager.ItemContainer.AfterPressAndHold
|
||||||
|
|
||||||
signal launch(int x, int y, var source, string title)
|
|
||||||
|
|
||||||
onDragActiveChanged: {
|
onDragActiveChanged: {
|
||||||
launcherDragManager.active = dragActive
|
launcherDragManager.active = dragActive
|
||||||
if (dragActive) {
|
if (dragActive) {
|
||||||
|
|
@ -90,8 +88,9 @@ ContainmentLayoutManager.ItemContainer {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
clickFedbackAnimation.target = delegate;
|
clickFedbackAnimation.target = delegate;
|
||||||
clickFedbackAnimation.running = true;
|
clickFedbackAnimation.running = true;
|
||||||
|
feedbackWindow.title = modelData.ApplicationNameRole;
|
||||||
delegate.launch(delegate.x + (units.smallSpacing * 2), delegate.y + (units.smallSpacing * 2), icon.source, modelData.ApplicationNameRole)
|
feedbackWindow.icon = modelData.ApplicationIconRole;
|
||||||
|
feedbackWindow.state = "open";
|
||||||
|
|
||||||
plasmoid.nativeInterface.applicationListModel.runApplication(modelData.ApplicationStorageIdRole);
|
plasmoid.nativeInterface.applicationListModel.runApplication(modelData.ApplicationStorageIdRole);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,58 +39,6 @@ LauncherContainer {
|
||||||
|
|
||||||
frame.width: width
|
frame.width: width
|
||||||
|
|
||||||
PlasmaCore.IconItem {
|
|
||||||
id: effect
|
|
||||||
height: 64
|
|
||||||
width: 64
|
|
||||||
visible: false
|
|
||||||
x: 0
|
|
||||||
y: 0
|
|
||||||
|
|
||||||
source: "pattern-kde"
|
|
||||||
property string title
|
|
||||||
|
|
||||||
SequentialAnimation {
|
|
||||||
id: woosh
|
|
||||||
ScriptAction {
|
|
||||||
script: effect.visible = true
|
|
||||||
}
|
|
||||||
ParallelAnimation {
|
|
||||||
NumberAnimation {
|
|
||||||
target: effect
|
|
||||||
property: "opacity"
|
|
||||||
from: 0.9
|
|
||||||
to: 0
|
|
||||||
duration: 200
|
|
||||||
}
|
|
||||||
NumberAnimation {
|
|
||||||
target: effect
|
|
||||||
property: "scale"
|
|
||||||
from: 1
|
|
||||||
to: 3
|
|
||||||
duration: 200
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ScriptAction {
|
|
||||||
script: {
|
|
||||||
feedbackWindow.title = effect.title
|
|
||||||
feedbackWindow.icon = effect.source
|
|
||||||
feedbackWindow.state = "open"
|
|
||||||
effect.visible = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function swoosh(x, y, sauce, title) {
|
|
||||||
effect.x = x
|
|
||||||
effect.y = y
|
|
||||||
effect.source = sauce
|
|
||||||
effect.visible = true
|
|
||||||
effect.title = title
|
|
||||||
woosh.restart()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
parent: root.flow
|
parent: root.flow
|
||||||
model: plasmoid.nativeInterface.applicationListModel
|
model: plasmoid.nativeInterface.applicationListModel
|
||||||
|
|
@ -115,10 +63,6 @@ LauncherContainer {
|
||||||
appletsLayout.restoreItem(delegate);
|
appletsLayout.restoreItem(delegate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onLaunch: (a, b, c, d) => {
|
|
||||||
print(a,b,c,d)
|
|
||||||
effect.swoosh(a, b, c, d)
|
|
||||||
}
|
|
||||||
onParentFromLocationChanged: {
|
onParentFromLocationChanged: {
|
||||||
if (!launcherDragManager.active && parent != parentFromLocation) {
|
if (!launcherDragManager.active && parent != parentFromLocation) {
|
||||||
parent = parentFromLocation;
|
parent = parentFromLocation;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue