mirror of
				https://github.com/arcan1s/awesome-widgets.git
				synced 2025-10-31 05:13:40 +00:00 
			
		
		
		
	update graphicalitem
This commit is contained in:
		| @ -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; i<graphicalItems.count(); i++) { | ||||
|         if (graphicalItems[i]->getFileName() != item->text()) continue; | ||||
|  | ||||
| @ -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(',')); | ||||
|  | ||||
| @ -6,8 +6,8 @@ | ||||
|    <rect> | ||||
|     <x>0</x> | ||||
|     <y>0</y> | ||||
|     <width>420</width> | ||||
|     <height>329</height> | ||||
|     <width>416</width> | ||||
|     <height>325</height> | ||||
|    </rect> | ||||
|   </property> | ||||
|   <property name="windowTitle"> | ||||
| @ -73,7 +73,7 @@ | ||||
|      <item> | ||||
|       <widget class="QComboBox" name="comboBox_value"> | ||||
|        <property name="editable"> | ||||
|         <bool>true</bool> | ||||
|         <bool>false</bool> | ||||
|        </property> | ||||
|       </widget> | ||||
|      </item> | ||||
| @ -94,7 +94,7 @@ | ||||
|      <item> | ||||
|       <widget class="QPushButton" name="pushButton_activeColor"> | ||||
|        <property name="text"> | ||||
|         <string/> | ||||
|         <string notr="true"/> | ||||
|        </property> | ||||
|       </widget> | ||||
|      </item> | ||||
| @ -115,7 +115,7 @@ | ||||
|      <item> | ||||
|       <widget class="QPushButton" name="pushButton_inactiveColor"> | ||||
|        <property name="text"> | ||||
|         <string/> | ||||
|         <string notr="true"/> | ||||
|        </property> | ||||
|       </widget> | ||||
|      </item> | ||||
|  | ||||
		Reference in New Issue
	
	Block a user