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> </size>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Advanced configuration</string> <string notr="true">Advanced</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="0" column="0">

View File

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

View File

@ -306,7 +306,7 @@ void AwesomeWidget::createConfigurationInterface(KConfigDialog *parent)
// appearance // appearance
KConfigGroup cg = config(); KConfigGroup cg = config();
CFont font(cg.readEntry("fontFamily", "Terminus")); CFont font = CFont(cg.readEntry("fontFamily", "Terminus"));
font.setPointSize(cg.readEntry("fontSize", 10)); font.setPointSize(cg.readEntry("fontSize", 10));
font.setCurrentColor(QColor(cg.readEntry("fontColor", "#000000"))); font.setCurrentColor(QColor(cg.readEntry("fontColor", "#000000")));
font.setHtmlWeight(cg.readEntry("fontWeight", 400)); font.setHtmlWeight(cg.readEntry("fontWeight", 400));
@ -600,11 +600,11 @@ void AwesomeWidget::configChanged()
formatLine[0] = QString("<html><head><meta name=\"qrichtext\" content=\"1\" />\ formatLine[0] = QString("<html><head><meta name=\"qrichtext\" content=\"1\" />\
<style type=\"text/css\">p, li { white-space: pre-wrap; }</style>\ <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;\">") </head><body style=\"font-family:'%1'; font-size:%2pt; font-weight:%3; font-style:%4; color:%5;\">")
.arg(font.family()) .arg(font.family())
.arg(font.pointSize()) .arg(font.pointSize())
.arg(font.htmlWeight()) .arg(font.htmlWeight())
.arg(fontStyle) .arg(fontStyle)
.arg(font.color().name()); .arg(font.color().name());
formatLine[1] = QString("</body></html>"); formatLine[1] = QString("</body></html>");
// counts // counts

View File

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

View File

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

View File

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

View File

@ -20,7 +20,7 @@ include_directories (${CMAKE_SOURCE_DIR}
set (PLUGIN_NAME ${SUBPROJECT}) set (PLUGIN_NAME ${SUBPROJECT})
file (GLOB SUBPROJECT_DESKTOP_IN *.desktop) file (GLOB SUBPROJECT_DESKTOP_IN *.desktop)
file (RELATIVE_PATH SUBPROJECT_DESKTOP ${CMAKE_SOURCE_DIR} ${SUBPROJECT_DESKTOP_IN}) 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) file (GLOB SUBPROJECT_UI *.ui)
# prepare # prepare

View File

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

View File

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

View File

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

View File

@ -17,7 +17,7 @@
</size> </size>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string notr="true">Toggle Window</string> <string notr="true">Toggle</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="0" column="0">
@ -45,19 +45,6 @@
<item> <item>
<widget class="QListWidget" name="listWidget_list"/> <widget class="QListWidget" name="listWidget_list"/>
</item> </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> </layout>
</widget> </widget>
</widget> </widget>

View File

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