some fixes

This commit is contained in:
arcan1s 2014-09-06 15:43:53 +04:00
parent 3b11e39e99
commit c007fabe12
12 changed files with 83 additions and 90 deletions

View File

@ -29,7 +29,7 @@
</size>
</property>
<property name="windowTitle">
<string>Advanced configuration</string>
<string notr="true">Advanced</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">

View File

@ -29,7 +29,7 @@
</size>
</property>
<property name="windowTitle">
<string>Appearance configuration</string>
<string notr="true">Appearance</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">

View File

@ -306,7 +306,7 @@ void AwesomeWidget::createConfigurationInterface(KConfigDialog *parent)
// appearance
KConfigGroup cg = config();
CFont font(cg.readEntry("fontFamily", "Terminus"));
CFont font = CFont(cg.readEntry("fontFamily", "Terminus"));
font.setPointSize(cg.readEntry("fontSize", 10));
font.setCurrentColor(QColor(cg.readEntry("fontColor", "#000000")));
font.setHtmlWeight(cg.readEntry("fontWeight", 400));

View File

@ -29,7 +29,7 @@
</size>
</property>
<property name="windowTitle">
<string>DE Configuration</string>
<string notr="true">DE</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">

View File

@ -29,7 +29,7 @@
</size>
</property>
<property name="windowTitle">
<string>Tooltip configuration</string>
<string notr="true">Tooltip</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>

View File

@ -29,7 +29,7 @@
</size>
</property>
<property name="windowTitle">
<string>Widget configuration</string>
<string notr="true">Widget</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>

View File

@ -20,7 +20,7 @@ include_directories (${CMAKE_SOURCE_DIR}
set (PLUGIN_NAME ${SUBPROJECT})
file (GLOB SUBPROJECT_DESKTOP_IN *.desktop)
file (RELATIVE_PATH SUBPROJECT_DESKTOP ${CMAKE_SOURCE_DIR} ${SUBPROJECT_DESKTOP_IN})
file (GLOB SUBPROJECT_SOURCE *.cpp)
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/fontdialog/*.cpp)
file (GLOB SUBPROJECT_UI *.ui)
# prepare

View File

@ -17,7 +17,7 @@
</size>
</property>
<property name="windowTitle">
<string notr="true">Configuration Window</string>
<string notr="true">Apearance</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
@ -346,8 +346,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>448</width>
<height>289</height>
<width>406</width>
<height>167</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">

View File

@ -32,22 +32,16 @@
#include <QProcessEnvironment>
#include <QTextCodec>
#include <fontdialog/fontdialog.h>
#include <pdebug/pdebug.h>
CustomPlasmaLabel::CustomPlasmaLabel(DesktopPanel *wid, const int num)
CustomPlasmaLabel::CustomPlasmaLabel(DesktopPanel *wid, const int num, const bool debugCmd)
: Plasma::Label(wid),
debug(debugCmd),
number(num),
widget(wid)
{
// debug
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
if (debugEnv == QString("yes"))
debug = true;
else
debug = false;
if (debug) qDebug() << PDEBUG << ":" << "Init label" << number;
}
@ -345,35 +339,33 @@ void DesktopPanel::createConfigurationInterface(KConfigDialog *parent)
uiWidConfig.lineEdit_desktopcmd->setText(configuration[QString("desktopcmd")]);
KConfigGroup cg = config();
QString fontFamily = cg.readEntry("currentFontFamily", "Terminus");
int fontSize = cg.readEntry("currentFontSize", 10);
QString fontColor = cg.readEntry("currentFontColor", "#ff0000");
int fontWeight = cg.readEntry("currentFontWeight", 400);
QString fontStyle = cg.readEntry("currentFontStyle", "normal");
QFont font = QFont(fontFamily, 12, 400, false);
uiAppConfig.fontComboBox_fontActive->setCurrentFont(font);
uiAppConfig.spinBox_fontSizeActive->setValue(fontSize);
uiAppConfig.kcolorcombo_fontColorActive->setColor(fontColor);
uiAppConfig.spinBox_fontWeightActive->setValue(fontWeight);
if (fontStyle == QString("normal"))
uiAppConfig.comboBox_fontStyleActive->setCurrentIndex(0);
else if (fontStyle == QString("italic"))
CFont font(cg.readEntry("currentFontFamily", "Terminus"));
font.setPointSize(cg.readEntry("currentFontSize", 10));
font.setCurrentColor(QColor(cg.readEntry("currentFontColor", "#ff0000")));
font.setHtmlWeight(cg.readEntry("currentFontWeight", 400));
font.setItalic(cg.readEntry("currentFontStyle", "normal") == QString("italic"));
uiAppConfig.fontComboBox_fontActive->setCurrentFont(font.toQFont());
uiAppConfig.spinBox_fontSizeActive->setValue(font.pointSize());
uiAppConfig.kcolorcombo_fontColorActive->setColor(font.color());
if (font.italic())
uiAppConfig.comboBox_fontStyleActive->setCurrentIndex(1);
else
uiAppConfig.comboBox_fontStyleActive->setCurrentIndex(0);
uiAppConfig.spinBox_fontWeightActive->setValue(font.htmlWeight());
fontFamily = cg.readEntry("fontFamily", "Terminus");
fontSize = cg.readEntry("fontSize", 10);
fontColor = cg.readEntry("fontColor", "#000000");
fontWeight = cg.readEntry("fontWeight", 400);
fontStyle = cg.readEntry("fontStyle", "normal");
font = QFont(fontFamily, 12, 400, FALSE);
uiAppConfig.fontComboBox_fontInactive->setCurrentFont(font);
uiAppConfig.spinBox_fontSizeInactive->setValue(fontSize);
uiAppConfig.kcolorcombo_fontColorInactive->setColor(fontColor);
uiAppConfig.spinBox_fontWeightInactive->setValue(fontWeight);
if (fontStyle == "normal")
uiAppConfig.comboBox_fontStyleInactive->setCurrentIndex(0);
else if (fontStyle == "italic")
font = CFont(cg.readEntry("fontFamily", "Terminus"));
font.setPointSize(cg.readEntry("fontSize", 10));
font.setCurrentColor(QColor(cg.readEntry("fontColor", "#000000")));
font.setHtmlWeight(cg.readEntry("fontWeight", 400));
font.setItalic(cg.readEntry("fontStyle", "normal") == QString("italic"));
uiAppConfig.fontComboBox_fontInactive->setCurrentFont(font.toQFont());
uiAppConfig.spinBox_fontSizeInactive->setValue(font.pointSize());
uiAppConfig.kcolorcombo_fontColorInactive->setColor(font.color());
if (font.italic())
uiAppConfig.comboBox_fontStyleInactive->setCurrentIndex(1);
else
uiAppConfig.comboBox_fontStyleInactive->setCurrentIndex(0);
uiAppConfig.spinBox_fontWeightInactive->setValue(font.htmlWeight());
uiToggleConfig.listWidget_list->clear();
QList<Plasma::Containment *> panels = getPanels();
@ -454,31 +446,44 @@ void DesktopPanel::configChanged()
extsysmonEngine->connectSource(QString("desktop"), this, configuration[QString("interval")].toInt());
QString fontFamily = cg.readEntry("currentFontFamily", "Terminus");
int fontSize = cg.readEntry("currentFontSize", 10);
QString fontColor = cg.readEntry("currentFontColor", "#ff0000");
int fontWeight = cg.readEntry("currentFontWeight", 400);
QString fontStyle = cg.readEntry("currentFontStyle", "normal");
currentFormatLine[0] = ("<pre><p align=\"center\"><span style=\" font-family:'" + fontFamily + \
"'; font-style:" + fontStyle + \
"; font-size:" + QString::number(fontSize) + \
"pt; font-weight:" + QString::number(fontWeight) + \
"; color:" + fontColor + \
";\">");
currentFormatLine[1] = ("</span></p></pre>");
CFont font = CFont(cg.readEntry("currentFontFamily", "Terminus"));
font.setPointSize(cg.readEntry("currentFontSize", 10));
font.setCurrentColor(QColor(cg.readEntry("currentFontColor", "#ff0000")));
font.setHtmlWeight(cg.readEntry("currentFontWeight", 400));
font.setItalic(cg.readEntry("currentFontStyle", "normal") == QString("italic"));
QString fontStyle;
if (font.italic())
fontStyle = QString("italic");
else
fontStyle = QString("normal");
currentFormatLine[0] = QString("<html><head><meta name=\"qrichtext\" content=\"1\" />\
<style type=\"text/css\">p, li { white-space: pre-wrap; }</style>\
</head><body style=\"font-family:'%1'; font-size:%2pt; font-weight:%3; font-style:%4; color:%5;\">")
.arg(font.family())
.arg(font.pointSize())
.arg(font.htmlWeight())
.arg(fontStyle)
.arg(font.color().name());
currentFormatLine[1] = QString("</body></html>");
fontFamily = cg.readEntry("fontFamily", "Terminus");
fontSize = cg.readEntry("fontSize", 10);
fontColor = cg.readEntry("fontColor", "#000000");
fontWeight = cg.readEntry("fontWeight", 400);
fontStyle = cg.readEntry("fontStyle", "normal");
formatLine[0] = ("<pre><p align=\"center\"><span style=\" font-family:'" + fontFamily + \
"'; font-style:" + fontStyle + \
"; font-size:" + QString::number(fontSize) + \
"pt; font-weight:" + QString::number(fontWeight) + \
"; color:" + fontColor + \
";\">");
formatLine[1] = ("</span></p></pre>");
font = CFont(cg.readEntry("fontFamily", "Terminus"));
font.setPointSize(cg.readEntry("fontSize", 10));
font.setCurrentColor(QColor(cg.readEntry("fontColor", "#000000")));
font.setHtmlWeight(cg.readEntry("fontWeight", 400));
font.setItalic(cg.readEntry("fontStyle", "normal") == QString("italic"));
if (font.italic())
fontStyle = QString("italic");
else
fontStyle = QString("normal");
formatLine[0] = QString("<html><head><meta name=\"qrichtext\" content=\"1\" />\
<style type=\"text/css\">p, li { white-space: pre-wrap; }</style>\
</head><body style=\"font-family:'%1'; font-size:%2pt; font-weight:%3; font-style:%4; color:%5;\">")
.arg(font.family())
.arg(font.pointSize())
.arg(font.htmlWeight())
.arg(fontStyle)
.arg(font.color().name());
formatLine[1] = QString("</body></html>");
reinit();
}

View File

@ -37,7 +37,8 @@ class CustomPlasmaLabel : public Plasma::Label
Q_OBJECT
public:
CustomPlasmaLabel(DesktopPanel *wid, const int num);
CustomPlasmaLabel(DesktopPanel *wid, const int num,
const bool debugCmd = false);
~CustomPlasmaLabel();
int getNumber();

View File

@ -17,7 +17,7 @@
</size>
</property>
<property name="windowTitle">
<string notr="true">Toggle Window</string>
<string notr="true">Toggle</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
@ -45,19 +45,6 @@
<item>
<widget class="QListWidget" name="listWidget_list"/>
</item>
<item>
<spacer name="spacer_widget">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>152</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>

View File

@ -17,7 +17,7 @@
</size>
</property>
<property name="windowTitle">
<string notr="true">Configuration Window</string>
<string notr="true">Widget</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">