support debug flags from the runtime

--the user is able to set some additional
debug flags in --debug state by just executing
the application.

supported flags:
--with-window: provides a separate window
to show metrics from each separate dock
--graphics: visual indicator for the various
elements
--mask: additional debug messages concerning
mask calculations
pull/1/head
Michail Vourlakos 8 years ago
parent c3b72f6d80
commit 41e79cf188

@ -41,9 +41,10 @@
namespace Latte {
DockCorona::DockCorona(QObject *parent)
DockCorona::DockCorona(QStringList debugFlags, QObject *parent)
: Plasma::Corona(parent),
m_activityConsumer(new KActivities::Consumer(this))
m_activityConsumer(new KActivities::Consumer(this)),
m_debugFlags(debugFlags)
{
KPackage::Package package(new DockPackage(this));
@ -238,6 +239,11 @@ void DockCorona::closeApplication()
qGuiApp->quit();
}
QStringList DockCorona::debugFlags() const
{
return m_debugFlags;
}
void DockCorona::aboutApplication()
{
if (aboutDialog) {

@ -43,7 +43,7 @@ class DockCorona : public Plasma::Corona {
Q_OBJECT
public:
DockCorona(QObject *parent = nullptr);
DockCorona(QStringList debugFlags = QStringList(), QObject *parent = nullptr);
virtual ~DockCorona();
int numScreens() const override;
@ -53,6 +53,8 @@ public:
QList<Plasma::Types::Location> freeEdges(int screen) const;
QStringList debugFlags() const;
int docksCount(int screen) const;
int screenForContainment(const Plasma::Containment *containment) const override;
@ -83,6 +85,7 @@ private:
bool m_activitiesStarting{true};
QStringList m_debugFlags;
QHash<const Plasma::Containment *, DockView *> m_dockViews;
QHash<const Plasma::Containment *, DockView *> m_waitingDockViews;

@ -404,6 +404,16 @@ void DockView::setShadow(int shadow)
emit shadowChanged();
}
QStringList DockView::debugFlags() const
{
DockCorona *dockCorona = qobject_cast<DockCorona *>(this->corona());
if (dockCorona)
return dockCorona->debugFlags();
return QStringList();
}
bool DockView::tasksPresent()
{
foreach (Plasma::Applet *applet, containment()->applets()) {

@ -49,6 +49,7 @@ class DockView : public PlasmaQuick::ContainmentView {
Q_PROPERTY(int maxThickness READ maxThickness WRITE setMaxThickness NOTIFY maxThicknessChanged)
Q_PROPERTY(int normalThickness READ normalThickness WRITE setNormalThickness NOTIFY normalThicknessChanged)
Q_PROPERTY(int shadow READ shadow WRITE setShadow NOTIFY shadowChanged)
Q_PROPERTY(QStringList debugFlags READ debugFlags NOTIFY debugFlagsChanged)
Q_PROPERTY(QRect maskArea READ maskArea WRITE setMaskArea NOTIFY maskAreaChanged)
Q_PROPERTY(VisibilityManager *visibility READ visibility NOTIFY visibilityChanged)
@ -82,6 +83,8 @@ public:
QRect maskArea() const;
void setMaskArea(QRect area);
QStringList debugFlags() const;
VisibilityManager *visibility();
QQmlListProperty<QScreen> screens();
@ -112,6 +115,7 @@ signals:
void removeInternalViewSplitter();
void eventTriggered(QEvent *ev);
void debugFlagsChanged();
void dockLocationChanged();
void docksCountChanged();
void widthChanged();

@ -70,11 +70,25 @@ int main(int argc, char **argv)
"%{if-critical}\n%{backtrace depth=8 separator=\"\n\"}%{endif}" CNORMAL));
// qputenv("QT_QUICK_CONTROLS_1_STYLE", "Desktop");
QStringList debugFlags;
if (!app.arguments().contains(QLatin1String("--debug"))) {
qInstallMessageHandler(noMessageOutput);
} else {
if (app.arguments().contains(QLatin1String("--with-window"))) {
debugFlags.append("--with-window");
}
if (app.arguments().contains(QLatin1String("--graphics"))) {
debugFlags.append("--graphics");
}
if (app.arguments().contains(QLatin1String("--mask"))) {
debugFlags.append("--mask");
}
}
Latte::DockCorona corona;
Latte::DockCorona corona(debugFlags);
return app.exec();
}

@ -0,0 +1,296 @@
/*
* Copyright 2016 Smith AR <audoban@openmailbox.org>
* 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.1
import QtQuick.Window 2.2
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.latte 0.1 as Latte
Window{
width: 370
height: 450
visible: true
property string space:" : "
Grid{
columns: 2
Text{
text: "Window Width"+space
}
Text{
text: dock.width
}
Text{
text: "Window Height"+space
}
Text{
text: dock.height
}
Text{
text: "Contents Width"+space
}
Text{
text: layoutsContainer.contentsWidth
}
Text{
text: "Contents Height"+space
}
Text{
text: layoutsContainer.contentsHeight
}
Text{
text: "Max Length (user)"+space
}
Text{
text: plasmoid.configuration.maxLength +"%"
}
Text{
text: "Max Length (pixels)"+space
}
Text{
text: root.maxLength
}
Text{
text: "Mask"+space
}
Text{
text: dock.maskArea.x +", "+ dock.maskArea.y+" "+dock.maskArea.width+"x"+dock.maskArea.height
}
Text{
text: " ----------- "
}
Text{
text: " ----------- "
}
Text{
text: "Location"+space
}
Text{
text: {
switch(plasmoid.location){
case PlasmaCore.Types.LeftEdge:
return "Left Edge";
break;
case PlasmaCore.Types.RightEdge:
return "Right Edge";
break;
case PlasmaCore.Types.TopEdge:
return "Top Edge";
break;
case PlasmaCore.Types.BottomEdge:
return "Bottom Edge";
break;
}
return " <unknown>";
}
}
Text{
text: "Alignment"+space
}
Text{
text: {
switch(plasmoid.configuration.panelPosition){
case Latte.Dock.Left:
return "Left";
break;
case Latte.Dock.Right:
return "Right";
break;
case Latte.Dock.Center:
return "Center";
break;
case Latte.Dock.Top:
return "Top";
break;
case Latte.Dock.Bottom:
return "Bottom";
break;
case Latte.Dock.Justify:
return "Justify";
break;
}
return "<unknown>";
}
}
Text{
text: "Visibility"+space
}
Text{
text: {
switch(dock.visibility.mode){
case Latte.Dock.AlwaysVisible:
return "Always Visible";
break;
case Latte.Dock.AutoHide:
return "Auto Hide";
break;
case Latte.Dock.DodgeActive:
return "Dodge Active";
break;
case Latte.Dock.DodgeMaximized:
return "Dodge Maximized";
break;
case Latte.Dock.DodgeAllWindows:
return "Dodge All Windows";
break;
}
return "<unknown>";
}
}
Text{
text: "Zoom Factor"+space
}
Text{
text: root.zoomFactor
}
Text{
text: " ----------- "
}
Text{
text: " ----------- "
}
Text{
text: "Icon Size (user)"+space
}
Text{
text: plasmoid.configuration.iconSize
}
Text{
text: "Icon Size (automatic)"+space
}
Text{
text: root.automaticIconSizeBasedSize
}
Text{
text: "Icon Size (current)"+space
}
Text{
text: root.iconSize
}
Text{
text: " ----------- "
}
Text{
text: " ----------- "
}
Text{
text: "Show Panel Background (user)"+space
}
Text{
text: {
if (plasmoid.configuration.useThemePanel)
return "Yes";
else
return "Now";
}
}
Text{
text: "Panel Background Size(user)"+space
}
Text{
text: plasmoid.configuration.panelSize
}
Text{
text: "Panel Background Size(automatic)"+space
}
Text{
text: root.realPanelSize
}
Text{
text: "Panel Background Shadow"+space
}
Text{
text: root.panelShadow
}
Text{
text: " ----------- "
}
Text{
text: " ----------- "
}
Text{
text: "Mask - Normal Thickness"+space
}
Text{
text: visibilityManager.thicknessNormal
}
Text{
text: "Thickness Uses Panel Size"+space
}
Text{
text: visibilityManager.panelIsBiggerFromIconSize
}
}
}

@ -35,7 +35,7 @@ Item{
property QtObject window
property bool debugMagager: false
property bool debugMagager: dock && dock.debugFlags.indexOf("--mask")>=0
property bool inStartup: root.inStartup
property bool normalState : false // this is being set from updateMaskArea

@ -42,7 +42,7 @@ DragDrop.DropArea {
////
////BEGIN properties
property bool debugMode: false
property bool debugMode: dock && dock.debugFlags.indexOf("--graphics")>=0
property bool automaticSize: plasmoid.configuration.automaticIconSize
property bool confirmedDragEntered: false
@ -1026,6 +1026,11 @@ DragDrop.DropArea {
///////////////BEGIN UI elements
Loader{
active: dock && dock.debugFlags.indexOf("--with-window")>=0
sourceComponent: DebugWindow{}
}
/*Loader{
anchors.fill: parent
active: root.editMode

Loading…
Cancel
Save