mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 15:37:23 +00:00
fix text edit dp configuration interface
This commit is contained in:
parent
43daae5529
commit
4907496a2e
@ -4,6 +4,7 @@ Ver.2.0.2:
|
||||
- remove ps stats from notification
|
||||
* yet another fix cpu* and cpucl*
|
||||
* rewrite DP configuration interface
|
||||
* fix non-standard temp units
|
||||
|
||||
Ver.2.0.1:
|
||||
+ add support of custom interfaces
|
||||
|
@ -4,6 +4,7 @@
|
||||
- удалено ps stats из уведомлений
|
||||
* еще один фикс тегов cpu* и cpucl
|
||||
* переписан конфигурационный интерфейс DP
|
||||
* исправлены нестандартные единицы температуры
|
||||
|
||||
Вер.2.0.1:
|
||||
+ добавлена поддержка кастомных интерфейсов
|
||||
|
@ -768,9 +768,9 @@ void AwesomeWidget::setFontFormating()
|
||||
false, false);
|
||||
if (font != defaultFont) {
|
||||
QString selectedText = uiWidConfig.textEdit_elements->textCursor().selectedText();
|
||||
uiWidConfig.textEdit_elements->insertPlainText(QString("<font color=\"%1\" face=\"%2\" size=\"%3\">")
|
||||
uiWidConfig.textEdit_elements->insertPlainText(QString("<span style=\"color:%1; font-family:'%2'; font-size:%3pt;\">")
|
||||
.arg(font.color().name()).arg(font.family()).arg(font.pointSize()) +
|
||||
selectedText + QString("</font>"));
|
||||
selectedText + QString("</span>"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <Plasma/Theme>
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QGraphicsLinearLayout>
|
||||
#include <QGraphicsGridLayout>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include <QGraphicsView>
|
||||
#include <QProcessEnvironment>
|
||||
@ -106,7 +106,7 @@ void DesktopPanel::init()
|
||||
|
||||
extsysmonEngine = dataEngine(QString("ext-sysmon"));
|
||||
|
||||
layout = new QGraphicsLinearLayout();
|
||||
layout = new QGraphicsGridLayout();
|
||||
layout->setContentsMargins(1, 1, 1, 1);
|
||||
setLayout(layout);
|
||||
|
||||
@ -192,7 +192,7 @@ void DesktopPanel::reinit()
|
||||
}
|
||||
labels.clear();
|
||||
// layout
|
||||
layout = new QGraphicsLinearLayout();
|
||||
layout = new QGraphicsGridLayout();
|
||||
layout->setContentsMargins(1, 1, 1, 1);
|
||||
setLayout(layout);
|
||||
|
||||
@ -200,25 +200,18 @@ void DesktopPanel::reinit()
|
||||
// layout
|
||||
if (configuration[QString("background")].toInt() == 0)
|
||||
setBackgroundHints(NoBackground);
|
||||
if (configuration[QString("layout")].toInt() == 0)
|
||||
layout->setOrientation(Qt::Horizontal);
|
||||
else
|
||||
layout->setOrientation(Qt::Vertical);
|
||||
// left stretch
|
||||
if (configuration[QString("leftStretch")].toInt() == 2)
|
||||
layout->addStretch(1);
|
||||
// labels
|
||||
for (int i=0; i<desktopNames.count(); i++) {
|
||||
labels.append(new CustomPlasmaLabel(this, i));
|
||||
labels[i]->setWordWrap(false);
|
||||
qDebug() << labels[i]->styleSheet();
|
||||
layout->addItem(labels[i]);
|
||||
if (configuration[QString("layout")].toInt() == 0)
|
||||
layout->addItem(labels[i], 0, i);
|
||||
else
|
||||
layout->addItem(labels[i], i, 0);
|
||||
}
|
||||
// right stretch
|
||||
if (configuration[QString("rightStretch")].toInt() == 2)
|
||||
layout->addStretch(1);
|
||||
|
||||
updateText();
|
||||
updateText(true);
|
||||
// layout->updateGeometry();
|
||||
resize(10, 10);
|
||||
}
|
||||
|
||||
@ -264,14 +257,16 @@ void DesktopPanel::setCurrentDesktop(const int number)
|
||||
}
|
||||
|
||||
|
||||
void DesktopPanel::updateText()
|
||||
void DesktopPanel::updateText(const bool first)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
if (labels.isEmpty()) return;
|
||||
QString line, text;
|
||||
for (int i=0; i<labels.count(); i++) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Label" << i;
|
||||
if (first)
|
||||
line = configuration[QString("pattern")];
|
||||
else
|
||||
line = parsePattern(configuration[QString("pattern")], i);
|
||||
if (currentDesktop == i + 1)
|
||||
text = currentFormatLine[0] + line + currentFormatLine[1];
|
||||
@ -322,14 +317,6 @@ void DesktopPanel::createConfigurationInterface(KConfigDialog *parent)
|
||||
uiWidConfig.checkBox_layout->setCheckState(Qt::Unchecked);
|
||||
else
|
||||
uiWidConfig.checkBox_layout->setCheckState(Qt::Checked);
|
||||
if (configuration[QString("leftStretch")].toInt() == 0)
|
||||
uiWidConfig.checkBox_leftStretch->setCheckState(Qt::Unchecked);
|
||||
else
|
||||
uiWidConfig.checkBox_leftStretch->setCheckState(Qt::Checked);
|
||||
if (configuration[QString("rightStretch")].toInt() == 0)
|
||||
uiWidConfig.checkBox_rightStretch->setCheckState(Qt::Unchecked);
|
||||
else
|
||||
uiWidConfig.checkBox_rightStretch->setCheckState(Qt::Checked);
|
||||
uiWidConfig.spinBox_interval->setValue(configuration[QString("interval")].toInt());
|
||||
uiWidConfig.comboBox_mark->setItemText(uiWidConfig.comboBox_mark->count()-1, configuration[QString("mark")]);
|
||||
uiWidConfig.comboBox_mark->setCurrentIndex(uiWidConfig.comboBox_mark->count()-1);
|
||||
@ -408,8 +395,6 @@ void DesktopPanel::configAccepted()
|
||||
cg.writeEntry("pattern", uiWidConfig.textEdit_elements->toPlainText());
|
||||
cg.writeEntry("background", QString::number(uiWidConfig.checkBox_background->checkState()));
|
||||
cg.writeEntry("layout", QString::number(uiWidConfig.checkBox_layout->checkState()));
|
||||
cg.writeEntry("leftStretch", QString::number(uiWidConfig.checkBox_leftStretch->checkState()));
|
||||
cg.writeEntry("rightStretch", QString::number(uiWidConfig.checkBox_rightStretch->checkState()));
|
||||
cg.writeEntry("interval", QString::number(uiWidConfig.spinBox_interval->value()));
|
||||
cg.writeEntry("mark", uiWidConfig.comboBox_mark->currentText());
|
||||
cg.writeEntry("desktopcmd", uiWidConfig.lineEdit_desktopcmd->text());
|
||||
@ -448,10 +433,8 @@ void DesktopPanel::configChanged()
|
||||
configuration[QString("desktopcmd")] = cg.readEntry("desktopcmd", "qdbus org.kde.kwin /KWin setCurrentDesktop $number");
|
||||
configuration[QString("interval")] = cg.readEntry("interval", "1000");
|
||||
configuration[QString("layout")] = cg.readEntry("layout", "0");
|
||||
configuration[QString("leftStretch")] = cg.readEntry("leftStretch", "2");
|
||||
configuration[QString("mark")] = cg.readEntry("mark", "¤");
|
||||
configuration[QString("panels")] = cg.readEntry("panels", "-1");
|
||||
configuration[QString("rightStretch")] = cg.readEntry("rightStretch", "2");
|
||||
|
||||
extsysmonEngine->connectSource(QString("desktop"), this, configuration[QString("interval")].toInt());
|
||||
|
||||
@ -506,9 +489,9 @@ void DesktopPanel::setFontFormating()
|
||||
CFont font = CFontDialog::getFont(i18n("Select font"), defaultFont,
|
||||
false, false);
|
||||
QString selectedText = uiWidConfig.textEdit_elements->textCursor().selectedText();
|
||||
uiWidConfig.textEdit_elements->insertPlainText(QString("<font color=\"%1\" face=\"%2\" size=\"%3\">")
|
||||
uiWidConfig.textEdit_elements->insertPlainText(QString("<span style=\"color:%1; font-family:'%2'; font-size:%3pt;\">")
|
||||
.arg(font.color().name()).arg(font.family()).arg(font.pointSize()) +
|
||||
selectedText + QString("</font>"));
|
||||
selectedText + QString("</span>"));
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <ui_widget.h>
|
||||
|
||||
|
||||
class QGraphicsLinearLayout;
|
||||
class QGraphicsGridLayout;
|
||||
class DesktopPanel;
|
||||
|
||||
|
||||
@ -86,9 +86,9 @@ private:
|
||||
// functions
|
||||
QList<Plasma::Containment *> getPanels();
|
||||
QString panelLocationToStr(Plasma::Location loc);
|
||||
void updateText();
|
||||
void updateText(const bool first = false);
|
||||
// ui
|
||||
QGraphicsLinearLayout *layout;
|
||||
QGraphicsGridLayout *layout;
|
||||
QList<CustomPlasmaLabel *> labels;
|
||||
// debug
|
||||
bool debug;
|
||||
|
@ -20,7 +20,7 @@
|
||||
<string notr="true">Widget</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="6" column="0">
|
||||
<item row="4" column="0">
|
||||
<layout class="QHBoxLayout" name="layout_interval">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_interval">
|
||||
@ -75,13 +75,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="checkBox_leftStretch">
|
||||
<property name="text">
|
||||
<string>Add stretch to left/top of the layout</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="checkBox_background">
|
||||
<property name="text">
|
||||
@ -89,7 +82,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<item row="5" column="0">
|
||||
<layout class="QHBoxLayout" name="layout_mark">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_mark">
|
||||
@ -186,13 +179,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QCheckBox" name="checkBox_rightStretch">
|
||||
<property name="text">
|
||||
<string>Add stretch to right/bottom of the layout</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="checkBox_layout">
|
||||
<property name="text">
|
||||
@ -200,7 +186,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<item row="6" column="0">
|
||||
<layout class="QHBoxLayout" name="layout_desktopcmd">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_desktopcmd">
|
||||
|
Loading…
Reference in New Issue
Block a user