mirror of
https://github.com/KDE/latte-dock.git
synced 2024-12-23 01:33:50 +03:00
provide debug messages for ViewsTable
This commit is contained in:
parent
a7ac422b31
commit
622cc6988c
@ -173,6 +173,21 @@ const T GenericTable<T>::operator[](const uint &index) const
|
||||
return m_list[index];
|
||||
}
|
||||
|
||||
template <class T>
|
||||
GenericTable<T>::operator QString() const
|
||||
{
|
||||
QString result;
|
||||
|
||||
for(int i=0; i<m_list.count(); ++i) {
|
||||
result += m_list[i].id;
|
||||
if (i<(m_list.count()-1)) {
|
||||
result += ", ";
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool GenericTable<T>::containsId(const QString &id) const
|
||||
{
|
||||
|
@ -54,6 +54,7 @@ public:
|
||||
const T operator[](const QString &id) const;
|
||||
T &operator[](const uint &index);
|
||||
const T operator[](const uint &index) const;
|
||||
operator QString() const;
|
||||
|
||||
bool containsId(const QString &id) const;
|
||||
bool containsName(const QString &name) const;
|
||||
|
@ -117,6 +117,53 @@ bool View::operator!=(const View &rhs) const
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
View::operator QString() const
|
||||
{
|
||||
QString result;
|
||||
|
||||
result += id;
|
||||
result +=" : ";
|
||||
result += isActive ? "Active" : "Inactive";
|
||||
result += " : ";
|
||||
result += onPrimary ? "Primary" : "Explicit";
|
||||
result += " : ";
|
||||
result += QString::number(screen);
|
||||
result += " : ";
|
||||
if (edge == Plasma::Types::BottomEdge) {
|
||||
result += "BottomEdge";
|
||||
} else if (edge == Plasma::Types::TopEdge) {
|
||||
result += "TopEdge";
|
||||
} else if (edge == Plasma::Types::LeftEdge) {
|
||||
result += "LeftEdge";
|
||||
} else if (edge == Plasma::Types::RightEdge) {
|
||||
result += "RightEdge";
|
||||
}
|
||||
|
||||
result += " : ";
|
||||
|
||||
if (alignment == Latte::Types::Center) {
|
||||
result += "CenterAlignment";
|
||||
} else if (alignment == Latte::Types::Left) {
|
||||
result += "LeftAlignment";
|
||||
} else if (alignment == Latte::Types::Right) {
|
||||
result += "RightAlignment";
|
||||
} else if (alignment == Latte::Types::Top) {
|
||||
result += "TopAlignment";
|
||||
} else if (alignment == Latte::Types::Bottom) {
|
||||
result += "BottomAlignment";
|
||||
} else if (alignment == Latte::Types::Justify) {
|
||||
result += "JustifyAlignment";
|
||||
}
|
||||
|
||||
result += " : ";
|
||||
result += QString::number(maxLength);
|
||||
|
||||
result += " || ";
|
||||
result += subcontainments;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool View::isCreated() const
|
||||
{
|
||||
return m_state == IsCreated;
|
||||
|
@ -76,6 +76,7 @@ public:
|
||||
View &operator=(View &&rhs);
|
||||
bool operator==(const View &rhs) const;
|
||||
bool operator!=(const View &rhs) const;
|
||||
operator QString() const;
|
||||
|
||||
protected:
|
||||
View::State m_state{IsInvalid};
|
||||
|
@ -71,6 +71,16 @@ bool ViewsTable::operator!=(const ViewsTable &rhs) const
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
void ViewsTable::print()
|
||||
{
|
||||
qDebug().noquote() << "Views initialized : " + (isInitialized ? QString("true") : QString("false"));
|
||||
qDebug().noquote() << "aa | id | active | primary | screen | edge | alignment | maxlength | subcontainments";
|
||||
|
||||
for(int i=0; i<rowCount(); ++i) {
|
||||
qDebug().noquote() << QString::number(i+1) << " | " << m_list[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -41,6 +41,8 @@ public:
|
||||
|
||||
bool isInitialized{false};
|
||||
|
||||
void print();
|
||||
|
||||
//! Operators
|
||||
ViewsTable &operator=(const ViewsTable &rhs);
|
||||
ViewsTable &operator=(ViewsTable &&rhs);
|
||||
|
@ -1489,5 +1489,10 @@ bool GenericLayout::isBroken() const
|
||||
return Layouts::Storage::self()->isBroken(this, errors);
|
||||
}
|
||||
|
||||
Latte::Data::ViewsTable GenericLayout::viewsTable() const
|
||||
{
|
||||
return Layouts::Storage::self()->views(this);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <coretypes.h>
|
||||
#include "abstractlayout.h"
|
||||
#include "../data/viewdata.h"
|
||||
#include "../data/viewstable.h"
|
||||
|
||||
// Qt
|
||||
#include <QObject>
|
||||
@ -135,6 +136,8 @@ public:
|
||||
|
||||
QList<int> viewsScreens();
|
||||
|
||||
Latte::Data::ViewsTable viewsTable() const;
|
||||
|
||||
public slots:
|
||||
Q_INVOKABLE void newView(const QString &templateFile);
|
||||
Q_INVOKABLE int viewsWithTasks() const;
|
||||
|
@ -28,6 +28,9 @@
|
||||
#include "../settingsdialog/delegates/layoutcmbitemdelegate.h"
|
||||
#include "../../data/layoutstable.h"
|
||||
#include "../../layout/abstractlayout.h"
|
||||
#include "../../layout/centrallayout.h"
|
||||
#include "../../layouts/manager.h"
|
||||
#include "../../layouts/synchronizer.h"
|
||||
|
||||
// Qt
|
||||
#include <QMessageBox>
|
||||
@ -77,11 +80,34 @@ void ViewsHandler::init()
|
||||
void ViewsHandler::reload()
|
||||
{
|
||||
o_data = m_dialog->layoutsController()->selectedLayoutCurrentData();
|
||||
|
||||
bool islayoutalreadyloaded{o_data == c_data};
|
||||
|
||||
c_data = o_data;
|
||||
|
||||
m_ui->layoutsCmb->setCurrentText(o_data.name);
|
||||
|
||||
loadLayout(c_data);
|
||||
|
||||
if (!islayoutalreadyloaded) {
|
||||
//! Views
|
||||
Data::Layout originalSelectedData = m_dialog->layoutsController()->selectedLayoutOriginalData();
|
||||
CentralLayout *central = m_dialog->corona()->layoutsManager()->synchronizer()->centralLayout(originalSelectedData.name);
|
||||
|
||||
bool islayoutactive{true};
|
||||
|
||||
if (!central) {
|
||||
islayoutactive = false;
|
||||
central = new CentralLayout(this, originalSelectedData.id);
|
||||
}
|
||||
|
||||
qDebug() << "Views For Original Layout :: " << originalSelectedData.name;
|
||||
central->viewsTable().print();
|
||||
|
||||
if (!islayoutactive) {
|
||||
central->deleteLater();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ViewsHandler::loadLayout(const Latte::Data::Layout &data)
|
||||
@ -143,6 +169,8 @@ void ViewsHandler::onCurrentLayoutIndexChanged(int row)
|
||||
m_dialog->layoutsController()->selectRow(layoutId);
|
||||
reload();
|
||||
|
||||
|
||||
|
||||
emit currentLayoutChanged();
|
||||
} else {
|
||||
//! reset combobox index
|
||||
|
Loading…
Reference in New Issue
Block a user