mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-25 07:57:19 +00:00
update graphicalitem
This commit is contained in:
parent
2c3c575493
commit
ca60a85241
@ -725,11 +725,11 @@ void AwesomeWidget::addBar()
|
|||||||
if (!name.endsWith(QString(".desktop"))) name += QString(".desktop");
|
if (!name.endsWith(QString(".desktop"))) name += QString(".desktop");
|
||||||
QStringList bars;
|
QStringList bars;
|
||||||
bars.append(keys.filter((QRegExp(QString("cpu(?!cl).*")))));
|
bars.append(keys.filter((QRegExp(QString("cpu(?!cl).*")))));
|
||||||
bars.append(keys.filter((QRegExp(QString("gpu")))));
|
bars.append(keys.filter((QRegExp(QString("^gpu$")))));
|
||||||
bars.append(keys.filter((QRegExp(QString("mem")))));
|
bars.append(keys.filter((QRegExp(QString("^mem$")))));
|
||||||
bars.append(keys.filter((QRegExp(QString("swap")))));
|
bars.append(keys.filter((QRegExp(QString("^swap$")))));
|
||||||
bars.append(keys.filter((QRegExp(QString("hdd[0-9].*")))));
|
bars.append(keys.filter((QRegExp(QString("^hdd[0-9].*")))));
|
||||||
bars.append(keys.filter((QRegExp(QString("bat.*")))));
|
bars.append(keys.filter((QRegExp(QString("^bat.*")))));
|
||||||
|
|
||||||
GraphicalItem *item = new GraphicalItem(0, name, dirs, debug);
|
GraphicalItem *item = new GraphicalItem(0, name, dirs, debug);
|
||||||
item->setName(QString("bar%1").arg(number));
|
item->setName(QString("bar%1").arg(number));
|
||||||
@ -832,12 +832,12 @@ void AwesomeWidget::editBar(QListWidgetItem *item)
|
|||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
QStringList bars;
|
QStringList bars;
|
||||||
bars.append(keys.filter((QRegExp(QString("cpu(?!cl).*")))));
|
bars.append(keys.filter((QRegExp(QString("^cpu(?!cl).*")))));
|
||||||
bars.append(keys.filter((QRegExp(QString("gpu$")))));
|
bars.append(keys.filter((QRegExp(QString("^gpu$")))));
|
||||||
bars.append(keys.filter((QRegExp(QString("mem$")))));
|
bars.append(keys.filter((QRegExp(QString("^mem$")))));
|
||||||
bars.append(keys.filter((QRegExp(QString("swap$")))));
|
bars.append(keys.filter((QRegExp(QString("^swap$")))));
|
||||||
bars.append(keys.filter((QRegExp(QString("hdd[0-9].*")))));
|
bars.append(keys.filter((QRegExp(QString("^hdd[0-9].*")))));
|
||||||
bars.append(keys.filter((QRegExp(QString("bat.*")))));
|
bars.append(keys.filter((QRegExp(QString("^bat.*")))));
|
||||||
|
|
||||||
for (int i=0; i<graphicalItems.count(); i++) {
|
for (int i=0; i<graphicalItems.count(); i++) {
|
||||||
if (graphicalItems[i]->getFileName() != item->text()) continue;
|
if (graphicalItems[i]->getFileName() != item->text()) continue;
|
||||||
|
@ -93,13 +93,13 @@ QString GraphicalItem::getImage(const float value)
|
|||||||
// inactive
|
// inactive
|
||||||
pen.setColor(inactive);
|
pen.setColor(inactive);
|
||||||
circle = scene->addEllipse(0.0, 0.0, _width, _height, pen, QBrush(inactive, Qt::SolidPattern));
|
circle = scene->addEllipse(0.0, 0.0, _width, _height, pen, QBrush(inactive, Qt::SolidPattern));
|
||||||
circle->setSpanAngle((1.0 - percent) * 360.0 * 16.0);
|
circle->setSpanAngle(- (1.0 - percent) * 360.0 * 16.0);
|
||||||
circle->setStartAngle(180.0 * 16.0 - (1.0 - percent) * 360.0 * 16.0);
|
circle->setStartAngle(90.0 * 16.0 - percent * 360.0 * 16.0);
|
||||||
// active
|
// active
|
||||||
pen.setColor(active);
|
pen.setColor(active);
|
||||||
circle = scene->addEllipse(0.0, 0.0, _width, _height, pen, QBrush(active, Qt::SolidPattern));
|
circle = scene->addEllipse(0.0, 0.0, _width, _height, pen, QBrush(active, Qt::SolidPattern));
|
||||||
circle->setSpanAngle(percent * 360.0 * 16.0);
|
circle->setSpanAngle(- percent * 360.0 * 16.0);
|
||||||
circle->setStartAngle(180.0 * 16.0);
|
circle->setStartAngle(90.0 * 16.0);
|
||||||
// scale
|
// scale
|
||||||
scale[0] = -2 *(int)_direction + 1;
|
scale[0] = -2 *(int)_direction + 1;
|
||||||
break;
|
break;
|
||||||
@ -385,18 +385,17 @@ void GraphicalItem::showConfiguration(const QStringList tags)
|
|||||||
ui->spinBox_width->setValue(_width);
|
ui->spinBox_width->setValue(_width);
|
||||||
|
|
||||||
int ret = exec();
|
int ret = exec();
|
||||||
if (ret == 1) {
|
if (ret != 1) return;
|
||||||
setName(ui->label_nameValue->text());
|
setName(ui->label_nameValue->text());
|
||||||
setComment(ui->lineEdit_comment->text());
|
setComment(ui->lineEdit_comment->text());
|
||||||
setBar(ui->comboBox_value->currentText());
|
setBar(ui->comboBox_value->currentText());
|
||||||
setActiveColor(ui->pushButton_activeColor->text());
|
setActiveColor(ui->pushButton_activeColor->text().remove(QChar('&')));
|
||||||
setInactiveColor(ui->pushButton_inactiveColor->text());
|
setInactiveColor(ui->pushButton_inactiveColor->text().remove(QChar('&')));
|
||||||
setType(ui->comboBox_type->currentText());
|
setType(ui->comboBox_type->currentText());
|
||||||
setDirection(ui->comboBox_direction->currentText());
|
setDirection(ui->comboBox_direction->currentText());
|
||||||
setHeight(ui->spinBox_height->value());
|
setHeight(ui->spinBox_height->value());
|
||||||
setWidth(ui->spinBox_width->value());
|
setWidth(ui->spinBox_width->value());
|
||||||
writeConfiguration();
|
writeConfiguration();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -441,6 +440,7 @@ void GraphicalItem::changeColor()
|
|||||||
QColor color = stringToColor(((QPushButton *)sender())->text());
|
QColor color = stringToColor(((QPushButton *)sender())->text());
|
||||||
QColor newColor = QColorDialog::getColor(color, 0, i18n("Select color"),
|
QColor newColor = QColorDialog::getColor(color, 0, i18n("Select color"),
|
||||||
QColorDialog::ShowAlphaChannel);
|
QColorDialog::ShowAlphaChannel);
|
||||||
|
if (!newColor.isValid()) return;
|
||||||
|
|
||||||
QStringList colorText;
|
QStringList colorText;
|
||||||
colorText.append(QString("%1").arg(newColor.red()));
|
colorText.append(QString("%1").arg(newColor.red()));
|
||||||
@ -454,6 +454,7 @@ void GraphicalItem::changeColor()
|
|||||||
QColor GraphicalItem::stringToColor(const QString color)
|
QColor GraphicalItem::stringToColor(const QString color)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Color" << color;
|
||||||
|
|
||||||
QColor qcolor;
|
QColor qcolor;
|
||||||
QStringList listColor = color.split(QChar(','));
|
QStringList listColor = color.split(QChar(','));
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>420</width>
|
<width>416</width>
|
||||||
<height>329</height>
|
<height>325</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -73,7 +73,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboBox_value">
|
<widget class="QComboBox" name="comboBox_value">
|
||||||
<property name="editable">
|
<property name="editable">
|
||||||
<bool>true</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -94,7 +94,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_activeColor">
|
<widget class="QPushButton" name="pushButton_activeColor">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string notr="true"/>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -115,7 +115,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_inactiveColor">
|
<widget class="QPushButton" name="pushButton_inactiveColor">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string notr="true"/>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user