[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kscreen/sebas/osd] /: various cleanups
From:       Sebastian_Kügler <sebas () kde ! org>
Date:       2016-12-02 11:10:28
Message-ID: E1cCljY-0006KE-7e () code ! kde ! org
[Download RAW message or body]

Git commit 6f1eb00ba612ac1f3af8789521075c9147604b54 by Sebastian Kügler.
Committed on 25/11/2016 at 02:40.
Pushed by sebas into branch 'sebas/osd'.

various cleanups

M  +5    -10   kded/osd.cpp
M  +0    -16   kded/qml/Osd.qml
M  +4    -30   kded/qml/OsdItem.qml
M  +1    -12   tests/osd/osdtest.cpp

https://commits.kde.org/kscreen/6f1eb00ba612ac1f3af8789521075c9147604b54

diff --git a/kded/osd.cpp b/kded/osd.cpp
index 7ad0fa8..c1b207b 100644
--- a/kded/osd.cpp
+++ b/kded/osd.cpp
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2014 (c) Martin Klapetek <mklapetek@kde.org>
+ *  Copyright 2014 Martin Klapetek <mklapetek@kde.org>
  *  Copyright 2016 Sebastian Kügler <sebas@kde.org>
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -19,18 +19,16 @@
 
 #include "osd.h"
 #include "utils.h"
+#include "debug.h"
 
 #include <KScreen/Mode>
 
 #include <QLoggingCategory>
 #include <QTimer>
-// #include <QWindow>
 #include <QStandardPaths>
-#include <QDebug>
-// #include <QUrl>
-// #include <QQuickItem>
 #include <KDeclarative/QmlObject>
 
+
 namespace KScreen {
 
 Osd::Osd(QObject *parent)
@@ -39,13 +37,13 @@ Osd::Osd(QObject *parent)
     , m_osdObject(new KDeclarative::QmlObject(this))
 {
     if (m_osdPath.isEmpty()) {
-        qWarning() << "Failed to find OSD QML file" << m_osdPath;
+        qCWarning(KSCREEN_KDED) << "Failed to find OSD QML file" << m_osdPath;
     }
 
     m_osdObject->setSource(QUrl::fromLocalFile(m_osdPath));
 
     if (m_osdObject->status() != QQmlComponent::Ready) {
-        qWarning() << "Failed to load OSD QML file" << m_osdPath;
+        qCWarning(KSCREEN_KDED) << "Failed to load OSD QML file" << m_osdPath;
         return;
     }
 
@@ -78,7 +76,6 @@ void Osd::showOutputIdentifier(const KScreen::OutputPtr output)
     rootObject->setProperty("modeName", Utils::sizeToString(realSize));
     rootObject->setProperty("outputName", Utils::outputName(output));
     rootObject->setProperty("icon", \
                QStringLiteral("preferences-desktop-display-randr"));
-    //QTimer::singleShot(200, this, &Osd::showOsd);
     showOsd();
 }
 
@@ -128,9 +125,7 @@ void Osd::hideOsd()
     if (!rootObject) {
         return;
     }
-
     rootObject->setProperty("visible", false);
-
     // this is needed to prevent fading from "old" values when the OSD shows up
     rootObject->setProperty("osdValue", 0);
 }
diff --git a/kded/qml/Osd.qml b/kded/qml/Osd.qml
index 030b9ee..7944de3 100644
--- a/kded/qml/Osd.qml
+++ b/kded/qml/Osd.qml
@@ -18,8 +18,6 @@
 import QtQuick 2.0
 import QtQuick.Window 2.2
 import org.kde.plasma.core 2.0 as PlasmaCore
-import org.kde.plasma.components 2.0 as PlasmaComponents
-import org.kde.plasma.extras 2.0 as PlasmaExtra
 
 PlasmaCore.Dialog {
     id: root
@@ -40,20 +38,6 @@ PlasmaCore.Dialog {
     property string outputName
     property string modeName
 
-
-    Behavior on opacity {
-        SequentialAnimation {
-            // prevent press and hold from flickering
-            PauseAnimation { duration: root.timeout * 0.8 }
-
-            NumberAnimation {
-                duration: root.timeout * 0.2
-                easing.type: Easing.InQuad
-            }
-        }
-        enabled: root.animateOpacity
-    }
-
     mainItem: Loader {
         source: itemSource
         onItemChanged: {
diff --git a/kded/qml/OsdItem.qml b/kded/qml/OsdItem.qml
index 1fc350b..6507cd1 100644
--- a/kded/qml/OsdItem.qml
+++ b/kded/qml/OsdItem.qml
@@ -15,40 +15,19 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-import QtQuick 2.0
+import QtQuick 2.5
+import QtQuick.Window 2.2
+
 import org.kde.plasma.core 2.0 as PlasmaCore
-import org.kde.plasma.components 2.0 as PlasmaComponents
 import org.kde.plasma.extras 2.0 as PlasmaExtra
-import QtQuick.Window 2.2
 
 Item {
     property QtObject rootItem
-    //height: Math.min(units.gridUnit * 15, Screen.desktopAvailableHeight / 5)
-    //width: 1000//Screen.desktopAvailableHeight * 0.8//Math.min(height * 10, \
                Screen.desktopAvailableWidth * 0.8)
-//     height: rootItem.outputHeight + units.gridUnit
-//     width: rootItem.outputWidth + units.gridUnit
-//     objectName: "dialog"
-
-    //  /--------------------\
-    //  |      spacing       |
-    //  | /----------------\ |
-    //  | |                | |
-    //  | |      icon      | |
-    //  | |                | |
-    //  | |                | |
-    //  | \----------------/ |
-    //  |      spacing       |
-    //  | [progressbar/text] |
-    //  |      spacing       |
-    //  \--------------------/
 
     PlasmaCore.IconItem {
         id: icon
-
-        height: parent.height - label.height
-                              - ((units.smallSpacing/2) * 3) //it's an svg
+        height: parent.height - label.height - ((units.smallSpacing/2) * 3)
         width: parent.width
-
         source: rootItem.icon
     }
 
@@ -69,9 +48,4 @@ Item {
         minimumPointSize: theme.defaultFont.pointSize
         fontSizeMode: Text.HorizontalFit
     }
-
-    Component.onCompleted: {
-        print("Desktopw:" + Screen.desktopAvailableWidth)
-        print("Desktoph:" + Screen.desktopAvailableHeight)
-    }
 }
diff --git a/tests/osd/osdtest.cpp b/tests/osd/osdtest.cpp
index f6bdd50..0a3872b 100644
--- a/tests/osd/osdtest.cpp
+++ b/tests/osd/osdtest.cpp
@@ -17,19 +17,9 @@
  *************************************************************************************/
  
 #include "osdtest.h"
-#include "../../kded/osd.h"
 #include "../../kded/osdmanager.h"
-#include "../../kcm/src/utils.h"
-
-#include <KScreen/Config>
-#include <KScreen/GetConfigOperation>
-#include <KScreen/Output>
 
 #include <QCoreApplication>
-#include <QStandardPaths>
-#include <QTimer>
-#include <QRect>
-
 #include <QLoggingCategory>
 
 Q_LOGGING_CATEGORY(KSCREEN_KDED, "kscreen.kded")
@@ -48,8 +38,7 @@ void OsdTest::start()
 {
     QTimer::singleShot(5500, qApp, &QCoreApplication::quit);
     KScreen::OsdManager::self()->showOutputIdentifiers();
-    //QTimer::singleShot(200, KScreen::OsdManager::self(), \
&KScreen::OsdManager::showOutputIdentifiers);  }
 
 
-} // ns
\ No newline at end of file
+} // ns


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic