fucking heisenbug
This commit is contained in:
arcan1s 2014-08-04 22:05:29 +04:00
parent 209c3b9616
commit 3a0f0c252e
2 changed files with 19 additions and 13 deletions

View File

@ -79,15 +79,19 @@ Netctl::Netctl(QObject *parent, const QVariantList &args)
Netctl::~Netctl() Netctl::~Netctl()
{ {
// if (debug) qDebug() << "[PLASMOID]" << "[~Netctl]"; if (debug) qDebug() << "[PLASMOID]" << "[~Netctl]";
// // actions
// delete startProfileMenu; // delete startProfileMenu;
// delete switchToProfileMenu; // delete switchToProfileMenu;
// // dataengine
// disconnectFromEngine();
// delete netctlEngine;
// // ui
// delete iconWidget; // delete iconWidget;
// delete textLabel; // delete textLabel;
// delete fullSpaceLayout; // delete layout;
// delete graphicsWidget; // delete graphicsWidget;
// delete netctlEngine;
} }
@ -104,14 +108,16 @@ void Netctl::init()
netctlEngine = dataEngine(QString("netctl")); netctlEngine = dataEngine(QString("netctl"));
createActions(); createActions();
// generate ui // generate ui
graphicsWidget.setAttribute(Qt::WA_TranslucentBackground, true); graphicsWidget = new QWidget();
this->setWidget(&graphicsWidget); graphicsWidget->setAttribute(Qt::WA_TranslucentBackground, true);
this->setWidget(graphicsWidget);
// layouts // layouts
layout = new QHBoxLayout(&graphicsWidget); layout = new QHBoxLayout(graphicsWidget);
layout->setContentsMargins(1, 1, 1, 1); layout->setContentsMargins(1, 1, 1, 1);
iconLabel = new IconLabel(this, debug); iconLabel = new IconLabel(this, debug);
layout->addWidget(iconLabel); layout->addWidget(iconLabel);
layout->addWidget(&textLabel); textLabel = new QLabel(graphicsWidget);
layout->addWidget(textLabel);
// read variables // read variables
configChanged(); configChanged();
@ -225,10 +231,10 @@ void Netctl::updateInterface(bool setShown)
if (debug) qDebug() << "[PLASMOID]" << "[updateInterface]" << ":" << "State" << setShown; if (debug) qDebug() << "[PLASMOID]" << "[updateInterface]" << ":" << "State" << setShown;
if (setShown) if (setShown)
layout->addWidget(&textLabel); layout->addWidget(textLabel);
else else
layout->removeWidget(&textLabel); layout->removeWidget(textLabel);
graphicsWidget.adjustSize(); graphicsWidget->adjustSize();
this->resize(1, 1); this->resize(1, 1);
} }
@ -506,7 +512,7 @@ void Netctl::dataUpdated(const QString &sourceName, const Plasma::DataEngine::Da
if (bigInterface[QString("netDev")]) if (bigInterface[QString("netDev")])
text.append(info[QString("interfaces")]); text.append(info[QString("interfaces")]);
if (bigInterface[QString("main")]) if (bigInterface[QString("main")])
textLabel.setText(formatLine[0] + text.join(QString("<br>")) + formatLine[1]); textLabel->setText(formatLine[0] + text.join(QString("<br>")) + formatLine[1]);
} }
else if (sourceName == QString("extIp")) { else if (sourceName == QString("extIp")) {
info[QString("extIp")] = value; info[QString("extIp")] = value;

View File

@ -93,10 +93,10 @@ protected:
private: private:
// ui // ui
QWidget graphicsWidget; QWidget *graphicsWidget;
QHBoxLayout *layout; QHBoxLayout *layout;
IconLabel *iconLabel; IconLabel *iconLabel;
QLabel textLabel; QLabel *textLabel;
// information // information
bool status; bool status;
QMap<QString, QString> info; QMap<QString, QString> info;