diff --git a/sources/awesome-widget-kf5/package/contents/ui/main.qml b/sources/awesome-widget-kf5/package/contents/ui/main.qml index 83b1fcb..10a2c08 100644 --- a/sources/awesome-widget-kf5/package/contents/ui/main.qml +++ b/sources/awesome-widget-kf5/package/contents/ui/main.qml @@ -59,6 +59,7 @@ Item { } signal needUpdate + signal sizeUpdate // init @@ -67,8 +68,7 @@ Item { Layout.fillWidth: plasmoid.formFactor != PlasmaCore.Planar Layout.fillHeight: plasmoid.formFactor != PlasmaCore.Planar - Layout.minimumHeight: plasmoid.configuration.height == 0 ? text.contentHeight : plasmoid.configuration.height - Layout.minimumWidth: plasmoid.configuration.width == 0 ? text.contentWidth : plasmoid.configuration.width + Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter Plasmoid.icon: "utilities-system-monitor" Plasmoid.backgroundHints: plasmoid.configuration.background ? "DefaultBackground" : "NoBackground" @@ -160,7 +160,7 @@ Item { plasmoid.setAction("checkUpdates", i18n("Check updates"), "system-software-update") // plasmoid.setAction("report", i18n("Mail to developers"), "email") // init submodule - Plasmoid.userConfiguringChanged(true) + Plasmoid.userConfiguringChanged(false) } onNeedUpdate: { @@ -168,13 +168,37 @@ Item { text.text = AWKeys.parsePattern() tooltip.text = AWKeys.toolTipImage() + + sizeUpdate() + } + + onSizeUpdate: { + if (debug) console.log("[main::onSizeUpdate]") + + if (plasmoid.configuration.height == 0) { + Layout.minimumHeight = text.contentHeight + Layout.maximumHeight = -1 + } else { + Layout.minimumHeight = plasmoid.configuration.height + Layout.maximumHeight = plasmoid.configuration.height + } + if (plasmoid.configuration.width == 0) { + Layout.minimumWidth = text.contentWidth + Layout.maximumWidth = -1 + } else { + Layout.minimumWidth = plasmoid.configuration.width + Layout.maximumWidth = plasmoid.configuration.width + } } Plasmoid.onUserConfiguringChanged: { + if (plasmoid.userConfiguring) return if (debug) console.log("[main::onUserConfiguringChanged]") // init submodule AWKeys.initKeys(plasmoid.configuration.text, tooltipSettings, plasmoid.configuration.notify) + + needUpdate() } function action_checkUpdates() { diff --git a/sources/desktop-panel-kf5/package/contents/ui/main.qml b/sources/desktop-panel-kf5/package/contents/ui/main.qml index 68ebe73..44d9a5f 100644 --- a/sources/desktop-panel-kf5/package/contents/ui/main.qml +++ b/sources/desktop-panel-kf5/package/contents/ui/main.qml @@ -35,7 +35,6 @@ Item { "tooltipType": plasmoid.configuration.tooltipType, "tooltipWidth": plasmoid.configuration.tooltipWidth } - property bool initializated: false signal needUpdate signal needTooltipUpdate @@ -46,6 +45,8 @@ Item { Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation Plasmoid.compactRepresentation: Plasmoid.fullRepresentation + Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter + Plasmoid.icon: "utilities-system-monitor" Plasmoid.backgroundHints: plasmoid.configuration.background ? "DefaultBackground" : "NoBackground" @@ -127,7 +128,7 @@ Item { repeater.itemAt(i).update() } - if (!initializated) sizeUpdate() + sizeUpdate() needTooltipUpdate() } @@ -142,14 +143,26 @@ Item { onSizeUpdate: { if (debug) console.log("[main::onSizeUpdate]") - var newHeight = 0 - var newWidth = 0 - for (var i=0; ilineEdit_comment->setText(m_comment); ui->label_numberValue->setText(QString("%1").arg(m_number)); ui->lineEdit_ticker->setText(m_ticker); - if (m_active) - ui->checkBox_active->setCheckState(Qt::Checked); - else - ui->checkBox_active->setCheckState(Qt::Unchecked); + ui->checkBox_active->setCheckState(m_active ? Qt::Checked : Qt::Unchecked); ui->spinBox_interval->setValue(m_interval); int ret = exec(); diff --git a/sources/extsysmon/extscript.cpp b/sources/extsysmon/extscript.cpp index 75b00ec..12e85e4 100644 --- a/sources/extsysmon/extscript.cpp +++ b/sources/extsysmon/extscript.cpp @@ -320,14 +320,12 @@ QString ExtScript::run() if (times == 1) { QStringList cmdList; - if (!m_prefix.isEmpty()) - cmdList.append(m_prefix); + if (!m_prefix.isEmpty()) cmdList.append(m_prefix); cmdList.append(m_executable); if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmdList.join(QChar(' ')); TaskResult process = runTask(cmdList.join(QChar(' '))); if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode; - if (process.exitCode != 0) - if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error; + if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error; QString info = QString("%1 : %2").arg(process.exitCode) .arg(QTextCodec::codecForMib(106)->toUnicode(process.error).trimmed()); @@ -340,6 +338,7 @@ QString ExtScript::run() case stderr2stdout: value = QString("%1\t%2").arg(info).arg(qoutput); break; + case nothing: default: if (debug) qDebug() << PDEBUG << ":" << "Debug" << info; value = qoutput; @@ -364,14 +363,8 @@ int ExtScript::showConfiguration() ui->label_numberValue->setText(QString("%1").arg(m_number)); ui->lineEdit_command->setText(m_executable); ui->lineEdit_prefix->setText(m_prefix); - if (m_active) - ui->checkBox_active->setCheckState(Qt::Checked); - else - ui->checkBox_active->setCheckState(Qt::Unchecked); - if (m_output) - ui->checkBox_output->setCheckState(Qt::Checked); - else - ui->checkBox_output->setCheckState(Qt::Unchecked); + ui->checkBox_active->setCheckState(m_active ? Qt::Checked : Qt::Unchecked); + ui->checkBox_output->setCheckState(m_output ? Qt::Checked : Qt::Unchecked); ui->comboBox_redirect->setCurrentIndex(static_cast(m_redirect)); ui->spinBox_interval->setValue(m_interval); @@ -423,7 +416,7 @@ void ExtScript::writeConfiguration() settings.setValue(QString("X-AW-ApiVersion"), m_apiVersion); settings.setValue(QString("X-AW-Prefix"), m_prefix); settings.setValue(QString("X-AW-Active"), QVariant(m_active).toString()); - settings.setValue(QString("X-AW-Output"), QVariant(m_active).toString()); + settings.setValue(QString("X-AW-Output"), QVariant(m_output).toString()); settings.setValue(QString("X-AW-Redirect"), strRedirect()); settings.setValue(QString("X-AW-Interval"), m_interval); settings.setValue(QString("X-AW-Number"), m_number); diff --git a/sources/extsysmon/extupgrade.cpp b/sources/extsysmon/extupgrade.cpp index b76f767..f21e9cf 100644 --- a/sources/extsysmon/extupgrade.cpp +++ b/sources/extsysmon/extupgrade.cpp @@ -270,10 +270,7 @@ int ExtUpgrade::showConfiguration() ui->lineEdit_comment->setText(m_comment); ui->label_numberValue->setText(QString("%1").arg(m_number)); ui->lineEdit_command->setText(m_executable); - if (m_active) - ui->checkBox_active->setCheckState(Qt::Checked); - else - ui->checkBox_active->setCheckState(Qt::Unchecked); + ui->checkBox_active->setCheckState(m_active ? Qt::Checked : Qt::Unchecked); ui->spinBox_null->setValue(m_null); ui->spinBox_interval->setValue(m_interval);