introduce Layouter Debug mode

--really handy and beautiful in order to confirm the
calculations that are valid. Already a bug was found
for ParabolicEffect. There is 1px difference between
hovering Tasks and Applets
pull/15/head
Michail Vourlakos 5 years ago
parent afb4279e09
commit 66f8cce6d9

@ -153,6 +153,11 @@ int main(int argc, char **argv)
localGeometryOption.setFlags(QCommandLineOption::HiddenFromHelp);
parser.addOption(localGeometryOption);
QCommandLineOption layouterOption(QStringList() << QStringLiteral("layouter"));
layouterOption.setDescription(QStringLiteral("Show visual debug tags for items sizes."));
layouterOption.setFlags(QCommandLineOption::HiddenFromHelp);
parser.addOption(layouterOption);
QCommandLineOption filterDebugTextOption(QStringList() << QStringLiteral("debug-text"));
filterDebugTextOption.setDescription(QStringLiteral("Show only debug messages that contain specific text."));
filterDebugTextOption.setFlags(QCommandLineOption::HiddenFromHelp);

@ -1356,13 +1356,10 @@ void View::setInterfacesGraphicObj(Latte::Interfaces *ifaces)
m_interfacesGraphicObj = ifaces;
qDebug() << " @#$@#$@#$@#$ @#$ @#$ @#$ @#$ SETINTERFACESGRAPHICOBJECT 111";
if (containment()) {
QQuickItem *containmentGraphicItem = qobject_cast<QQuickItem *>(containment()->property("_plasma_graphicObject").value<QObject *>());
qDebug() << " @#$@#$@#$@#$ @#$ @#$ @#$ @#$ SETINTERFACESGRAPHICOBJECT 222";
if (containmentGraphicItem) {
qDebug() << " @#$@#$@#$@#$ @#$ @#$ @#$ @#$ SETINTERFACESGRAPHICOBJECT 333";
containmentGraphicItem->setProperty("_latte_view_interfacesobject", QVariant::fromValue(m_interfacesGraphicObj));
}
}

@ -33,6 +33,7 @@ import org.kde.latte.components 1.0 as LatteComponents
import "colorizer" as Colorizer
import "communicator" as Communicator
import "indicator" as Indicator
import "../debug" as Debug
Item {
id: appletItem
@ -1077,6 +1078,18 @@ Item {
onReleased: mouse.accepted = false;
}
//! Debug Elements
Loader{
anchors.bottom: parent.bottom
anchors.left: parent.left
active: root.debugModeLayouter
sourceComponent: Debug.Tag{
label.text: root.isHorizontal ? appletItem.width : appletItem.height
label.color: appletItem.needsFillSpace ? "green" : "white"
}
}
//! A timer is needed in order to handle also touchpads that probably
//! send too many signals very fast. This way the signals per sec are limited.
//! The user needs to have a steady normal scroll in order to not

@ -0,0 +1,44 @@
/*
* Copyright 2020 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock 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.
*
* Latte-Dock 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/>.
*/
import QtQuick 2.0
Item {
id: tag
width: _label.width + 4
height: _label.height + 4
readonly property alias background: _background
readonly property alias label: _label
Rectangle {
id: _background
anchors.fill: parent
color: "black"
}
Text {
id: _label
anchors.centerIn: parent
text: " --- "
color: "white"
font.pointSize: 11
}
}

@ -166,6 +166,7 @@ Abilities.AbilityGrid {
onShownAppletsChanged: layoutsContainer.updateSizeForAppletsInFill();
onSizeWithNoFillAppletsChanged: layoutsContainer.updateSizeForAppletsInFill();
//////////////////////////BEGIN states
//user set Panel Positions
// 0-Center, 1-Left, 2-Right, 3-Top, 4-Bottom

@ -29,6 +29,7 @@ import org.kde.latte.core 0.2 as LatteCore
import org.kde.latte.private.containment 0.1 as LatteContainment
import "./abilities" as AbilitiesTypes
import "../debug" as Debug
import "../../code/HeuristicTools.js" as HeuristicTools
Item{
@ -310,6 +311,97 @@ Item{
}
}
//! Debug Elements
Loader{
anchors.top: debugLayout.top
anchors.horizontalCenter: debugLayout.horizontalCenter
active: root.debugModeLayouter
readonly property Item debugLayout: _startLayout
sourceComponent: Debug.Tag{
background.color: "white"
label.text: tagText
label.color: "black"
label.font.pointSize: 13
readonly property int layoutLength: root.isHorizontal ? debugLayout.width : debugLayout.height
readonly property string tagText: {
return "no_show:" + debugLayout.shownApplets + " / no_fill:" + debugLayout.fillApplets + " / reg_len:" + debugLayout.sizeWithNoFillApplets + " / tot_len:"+layoutLength;
}
}
}
Loader{
anchors.top: debugLayout.top
anchors.horizontalCenter: debugLayout.horizontalCenter
active: root.debugModeLayouter
readonly property Item debugLayout: _endLayout
sourceComponent: Debug.Tag{
background.color: "white"
label.text: tagText
label.color: "black"
label.font.pointSize: 13
readonly property int layoutLength: root.isHorizontal ? debugLayout.width : debugLayout.height
readonly property string tagText: {
return "no_show:" + debugLayout.shownApplets + " / no_fill:" + debugLayout.fillApplets + " / reg_len:" + debugLayout.sizeWithNoFillApplets + " / tot_len:"+layoutLength;
}
}
}
Loader{
anchors.top: debugLayout.top
anchors.horizontalCenter: debugLayout.horizontalCenter
active: root.debugModeLayouter
z:70
readonly property Item debugLayout: _mainLayout
sourceComponent: Debug.Tag{
background.color: "white"
label.text: tagText
label.color: "black"
label.font.pointSize: 13
readonly property int layoutLength: root.isHorizontal ? debugLayout.width : debugLayout.height
readonly property string tagText: {
return "no_show:" + debugLayout.shownApplets + " / no_fill:" + debugLayout.fillApplets + " / reg_len:" + debugLayout.sizeWithNoFillApplets + " / tot_len:"+layoutLength;
}
}
}
Loader{
anchors.top: _mainLayout.top
anchors.left: parent.left
active: root.debugModeLayouter
readonly property Item debugLayout: layoutsContainer
sourceComponent: Debug.Tag{
background.color: "blue"
label.text: tagText
label.color: "yellow"
label.font.pointSize: 13
label.font.bold: true
readonly property int layoutLength: root.isHorizontal ? debugLayout.width : debugLayout.height
readonly property int layoutsLength: {
if (root.isVertical) {
return _startLayout.height + _mainLayout.height + _endLayout.height;
}
return _startLayout.width + _mainLayout.width + _endLayout.width;
}
readonly property string tagText: {
return "MAX:" + root.maxLength + " / TOT:"+layoutLength + " / LAYS:"+ layoutsLength;
}
}
}
//! This timer is needed in order to reduce the calls to heavy cpu function
//! HeuristicTools.updateSizeForAppletsInFill()
Timer{

@ -41,6 +41,7 @@ import "editmode" as EditMode
import "indicators" as Indicators
import "layouts" as Layouts
import "./background" as Background
import "./debug" as Debug
import "../code/LayoutManager.js" as LayoutManager
Item {
@ -64,6 +65,7 @@ Item {
////BEGIN properties
property bool debugMode: Qt.application.arguments.indexOf("--graphics")>=0
property bool debugModeLayouter: Qt.application.arguments.indexOf("--layouter")>=0
property bool debugModeLocalGeometry: Qt.application.arguments.indexOf("--localgeometry")>=0
property bool debugModeSpacers: Qt.application.arguments.indexOf("--spacers")>=0
property bool debugModeTimers: Qt.application.arguments.indexOf("--timers")>=0
@ -1398,7 +1400,7 @@ Item {
Loader{
active: root.debugModeWindow
sourceComponent: DebugWindow{}
sourceComponent: Debug.DebugWindow{}
}
EditMode.Visual{

Loading…
Cancel
Save