diff --git a/sources/awesome-widget/configuration.cpp b/sources/awesome-widget/configuration.cpp index 582e032..a9e97c5 100644 --- a/sources/awesome-widget/configuration.cpp +++ b/sources/awesome-widget/configuration.cpp @@ -725,11 +725,11 @@ void AwesomeWidget::addBar() if (!name.endsWith(QString(".desktop"))) name += QString(".desktop"); QStringList bars; bars.append(keys.filter((QRegExp(QString("cpu(?!cl).*"))))); - bars.append(keys.filter((QRegExp(QString("gpu"))))); - bars.append(keys.filter((QRegExp(QString("mem"))))); - bars.append(keys.filter((QRegExp(QString("swap"))))); - bars.append(keys.filter((QRegExp(QString("hdd[0-9].*"))))); - bars.append(keys.filter((QRegExp(QString("bat.*"))))); + bars.append(keys.filter((QRegExp(QString("^gpu$"))))); + bars.append(keys.filter((QRegExp(QString("^mem$"))))); + bars.append(keys.filter((QRegExp(QString("^swap$"))))); + bars.append(keys.filter((QRegExp(QString("^hdd[0-9].*"))))); + bars.append(keys.filter((QRegExp(QString("^bat.*"))))); GraphicalItem *item = new GraphicalItem(0, name, dirs, debug); item->setName(QString("bar%1").arg(number)); @@ -832,12 +832,12 @@ void AwesomeWidget::editBar(QListWidgetItem *item) if (debug) qDebug() << PDEBUG; QStringList bars; - bars.append(keys.filter((QRegExp(QString("cpu(?!cl).*"))))); - bars.append(keys.filter((QRegExp(QString("gpu$"))))); - bars.append(keys.filter((QRegExp(QString("mem$"))))); - bars.append(keys.filter((QRegExp(QString("swap$"))))); - bars.append(keys.filter((QRegExp(QString("hdd[0-9].*"))))); - bars.append(keys.filter((QRegExp(QString("bat.*"))))); + bars.append(keys.filter((QRegExp(QString("^cpu(?!cl).*"))))); + bars.append(keys.filter((QRegExp(QString("^gpu$"))))); + bars.append(keys.filter((QRegExp(QString("^mem$"))))); + bars.append(keys.filter((QRegExp(QString("^swap$"))))); + bars.append(keys.filter((QRegExp(QString("^hdd[0-9].*"))))); + bars.append(keys.filter((QRegExp(QString("^bat.*"))))); for (int i=0; igetFileName() != item->text()) continue; diff --git a/sources/awesome-widget/graphicalitem.cpp b/sources/awesome-widget/graphicalitem.cpp index c67424a..3e7a418 100644 --- a/sources/awesome-widget/graphicalitem.cpp +++ b/sources/awesome-widget/graphicalitem.cpp @@ -93,13 +93,13 @@ QString GraphicalItem::getImage(const float value) // inactive pen.setColor(inactive); circle = scene->addEllipse(0.0, 0.0, _width, _height, pen, QBrush(inactive, Qt::SolidPattern)); - circle->setSpanAngle((1.0 - percent) * 360.0 * 16.0); - circle->setStartAngle(180.0 * 16.0 - (1.0 - percent) * 360.0 * 16.0); + circle->setSpanAngle(- (1.0 - percent) * 360.0 * 16.0); + circle->setStartAngle(90.0 * 16.0 - percent * 360.0 * 16.0); // active pen.setColor(active); circle = scene->addEllipse(0.0, 0.0, _width, _height, pen, QBrush(active, Qt::SolidPattern)); - circle->setSpanAngle(percent * 360.0 * 16.0); - circle->setStartAngle(180.0 * 16.0); + circle->setSpanAngle(- percent * 360.0 * 16.0); + circle->setStartAngle(90.0 * 16.0); // scale scale[0] = -2 *(int)_direction + 1; break; @@ -385,18 +385,17 @@ void GraphicalItem::showConfiguration(const QStringList tags) ui->spinBox_width->setValue(_width); int ret = exec(); - if (ret == 1) { - setName(ui->label_nameValue->text()); - setComment(ui->lineEdit_comment->text()); - setBar(ui->comboBox_value->currentText()); - setActiveColor(ui->pushButton_activeColor->text()); - setInactiveColor(ui->pushButton_inactiveColor->text()); - setType(ui->comboBox_type->currentText()); - setDirection(ui->comboBox_direction->currentText()); - setHeight(ui->spinBox_height->value()); - setWidth(ui->spinBox_width->value()); - writeConfiguration(); - } + if (ret != 1) return; + setName(ui->label_nameValue->text()); + setComment(ui->lineEdit_comment->text()); + setBar(ui->comboBox_value->currentText()); + setActiveColor(ui->pushButton_activeColor->text().remove(QChar('&'))); + setInactiveColor(ui->pushButton_inactiveColor->text().remove(QChar('&'))); + setType(ui->comboBox_type->currentText()); + setDirection(ui->comboBox_direction->currentText()); + setHeight(ui->spinBox_height->value()); + setWidth(ui->spinBox_width->value()); + writeConfiguration(); } @@ -441,6 +440,7 @@ void GraphicalItem::changeColor() QColor color = stringToColor(((QPushButton *)sender())->text()); QColor newColor = QColorDialog::getColor(color, 0, i18n("Select color"), QColorDialog::ShowAlphaChannel); + if (!newColor.isValid()) return; QStringList colorText; colorText.append(QString("%1").arg(newColor.red())); @@ -454,6 +454,7 @@ void GraphicalItem::changeColor() QColor GraphicalItem::stringToColor(const QString color) { if (debug) qDebug() << PDEBUG; + if (debug) qDebug() << PDEBUG << ":" << "Color" << color; QColor qcolor; QStringList listColor = color.split(QChar(',')); diff --git a/sources/awesome-widget/graphicalitem.ui b/sources/awesome-widget/graphicalitem.ui index 03693b8..4f66036 100644 --- a/sources/awesome-widget/graphicalitem.ui +++ b/sources/awesome-widget/graphicalitem.ui @@ -6,8 +6,8 @@ 0 0 - 420 - 329 + 416 + 325 @@ -73,7 +73,7 @@ - true + false @@ -94,7 +94,7 @@ - + @@ -115,7 +115,7 @@ - +