From c007fabe12ffb9f99d93fcc5419c5d7efab699c7 Mon Sep 17 00:00:00 2001 From: arcan1s Date: Sat, 6 Sep 2014 15:43:53 +0400 Subject: [PATCH] some fixes --- sources/awesome-widget/advanced.ui | 2 +- sources/awesome-widget/appearance.ui | 2 +- sources/awesome-widget/configuration.cpp | 12 +-- sources/awesome-widget/deconfig.ui | 2 +- sources/awesome-widget/tooltipconfig.ui | 2 +- sources/awesome-widget/widget.ui | 2 +- sources/desktop-panel/CMakeLists.txt | 2 +- sources/desktop-panel/appearance.ui | 6 +- sources/desktop-panel/desktop-panel.cpp | 123 ++++++++++++----------- sources/desktop-panel/desktop-panel.h | 3 +- sources/desktop-panel/toggle.ui | 15 +-- sources/desktop-panel/widget.ui | 2 +- 12 files changed, 83 insertions(+), 90 deletions(-) diff --git a/sources/awesome-widget/advanced.ui b/sources/awesome-widget/advanced.ui index d38e420..8768e2b 100644 --- a/sources/awesome-widget/advanced.ui +++ b/sources/awesome-widget/advanced.ui @@ -29,7 +29,7 @@ - Advanced configuration + Advanced diff --git a/sources/awesome-widget/appearance.ui b/sources/awesome-widget/appearance.ui index 14f36cc..0614fe1 100644 --- a/sources/awesome-widget/appearance.ui +++ b/sources/awesome-widget/appearance.ui @@ -29,7 +29,7 @@ - Appearance configuration + Appearance diff --git a/sources/awesome-widget/configuration.cpp b/sources/awesome-widget/configuration.cpp index d21d136..dc00843 100644 --- a/sources/awesome-widget/configuration.cpp +++ b/sources/awesome-widget/configuration.cpp @@ -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)); @@ -600,11 +600,11 @@ void AwesomeWidget::configChanged() formatLine[0] = QString("\ \ ") - .arg(font.family()) - .arg(font.pointSize()) - .arg(font.htmlWeight()) - .arg(fontStyle) - .arg(font.color().name()); + .arg(font.family()) + .arg(font.pointSize()) + .arg(font.htmlWeight()) + .arg(fontStyle) + .arg(font.color().name()); formatLine[1] = QString(""); // counts diff --git a/sources/awesome-widget/deconfig.ui b/sources/awesome-widget/deconfig.ui index e5d1971..f9f7b18 100644 --- a/sources/awesome-widget/deconfig.ui +++ b/sources/awesome-widget/deconfig.ui @@ -29,7 +29,7 @@ - DE Configuration + DE diff --git a/sources/awesome-widget/tooltipconfig.ui b/sources/awesome-widget/tooltipconfig.ui index 20e48fd..e7562dd 100644 --- a/sources/awesome-widget/tooltipconfig.ui +++ b/sources/awesome-widget/tooltipconfig.ui @@ -29,7 +29,7 @@ - Tooltip configuration + Tooltip diff --git a/sources/awesome-widget/widget.ui b/sources/awesome-widget/widget.ui index ee7101f..d71c3f0 100644 --- a/sources/awesome-widget/widget.ui +++ b/sources/awesome-widget/widget.ui @@ -29,7 +29,7 @@ - Widget configuration + Widget diff --git a/sources/desktop-panel/CMakeLists.txt b/sources/desktop-panel/CMakeLists.txt index 0004e8d..4dc1c7e 100644 --- a/sources/desktop-panel/CMakeLists.txt +++ b/sources/desktop-panel/CMakeLists.txt @@ -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 diff --git a/sources/desktop-panel/appearance.ui b/sources/desktop-panel/appearance.ui index 22623b9..3b0c659 100644 --- a/sources/desktop-panel/appearance.ui +++ b/sources/desktop-panel/appearance.ui @@ -17,7 +17,7 @@ - Configuration Window + Apearance @@ -346,8 +346,8 @@ 0 0 - 448 - 289 + 406 + 167 diff --git a/sources/desktop-panel/desktop-panel.cpp b/sources/desktop-panel/desktop-panel.cpp index 17af753..2317196 100644 --- a/sources/desktop-panel/desktop-panel.cpp +++ b/sources/desktop-panel/desktop-panel.cpp @@ -32,22 +32,16 @@ #include #include +#include #include -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 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] = ("

"); - currentFormatLine[1] = ("

"); + 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("\ + \ + ") + .arg(font.family()) + .arg(font.pointSize()) + .arg(font.htmlWeight()) + .arg(fontStyle) + .arg(font.color().name()); + currentFormatLine[1] = QString(""); - 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] = ("

"); - formatLine[1] = ("

"); + 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("\ + \ + ") + .arg(font.family()) + .arg(font.pointSize()) + .arg(font.htmlWeight()) + .arg(fontStyle) + .arg(font.color().name()); + formatLine[1] = QString(""); reinit(); } diff --git a/sources/desktop-panel/desktop-panel.h b/sources/desktop-panel/desktop-panel.h index aed7bcb..d9232e4 100644 --- a/sources/desktop-panel/desktop-panel.h +++ b/sources/desktop-panel/desktop-panel.h @@ -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(); diff --git a/sources/desktop-panel/toggle.ui b/sources/desktop-panel/toggle.ui index 234a7d5..87a8c4d 100644 --- a/sources/desktop-panel/toggle.ui +++ b/sources/desktop-panel/toggle.ui @@ -17,7 +17,7 @@ - Toggle Window + Toggle @@ -45,19 +45,6 @@ - - - - Qt::Vertical - - - - 20 - 152 - - - - diff --git a/sources/desktop-panel/widget.ui b/sources/desktop-panel/widget.ui index 4261585..1371663 100644 --- a/sources/desktop-panel/widget.ui +++ b/sources/desktop-panel/widget.ui @@ -17,7 +17,7 @@ - Configuration Window + Widget