Changeset View
Changeset View
Standalone View
Standalone View
tests/osd/osdtest.cpp
Show All 31 Lines | 31 | OsdTest::OsdTest(QObject *parent) | |||
---|---|---|---|---|---|
32 | : QObject(parent) | 32 | : QObject(parent) | ||
33 | { | 33 | { | ||
34 | } | 34 | } | ||
35 | 35 | | |||
36 | OsdTest::~OsdTest() | 36 | OsdTest::~OsdTest() | ||
37 | { | 37 | { | ||
38 | } | 38 | } | ||
39 | 39 | | |||
40 | OsdManager *OsdTest::getOsdManager() | ||||
41 | { | ||||
42 | if (m_osdManager) | ||||
43 | return m_osdManager; | ||||
44 | m_osdManager = new OsdManager(this); | ||||
45 | return m_osdManager; | ||||
46 | } | ||||
47 | | ||||
40 | void OsdTest::showOutputIdentifiers() | 48 | void OsdTest::showOutputIdentifiers() | ||
41 | { | 49 | { | ||
42 | if (!m_useDBus) { | 50 | if (!m_useDBus) { | ||
43 | QTimer::singleShot(5500, qApp, &QCoreApplication::quit); | 51 | QTimer::singleShot(5500, qApp, &QCoreApplication::quit); | ||
44 | KScreen::OsdManager::self()->showOutputIdentifiers(); | 52 | getOsdManager()->showOutputIdentifiers(); | ||
45 | } else { | 53 | } else { | ||
46 | QDBusMessage msg = QDBusMessage::createMethodCall( | 54 | QDBusMessage msg = QDBusMessage::createMethodCall( | ||
47 | QLatin1Literal("org.kde.kscreen.osdService"), | 55 | QLatin1Literal("org.kde.kscreen.osdService"), | ||
48 | QLatin1Literal("/org/kde/kscreen/osdService"), | 56 | QLatin1Literal("/org/kde/kscreen/osdService"), | ||
49 | QLatin1Literal("org.kde.kscreen.osdService"), | 57 | QLatin1Literal("org.kde.kscreen.osdService"), | ||
50 | QLatin1Literal("showOutputIdentifiers") | 58 | QLatin1Literal("showOutputIdentifiers") | ||
51 | ); | 59 | ); | ||
52 | //msg << icon << text; | 60 | //msg << icon << text; | ||
Show All 9 Lines | |||||
62 | { | 70 | { | ||
63 | m_useDBus = yesno; | 71 | m_useDBus = yesno; | ||
64 | } | 72 | } | ||
65 | 73 | | |||
66 | void OsdTest::showGenericOsd(const QString& icon, const QString& message) | 74 | void OsdTest::showGenericOsd(const QString& icon, const QString& message) | ||
67 | { | 75 | { | ||
68 | if (!m_useDBus) { | 76 | if (!m_useDBus) { | ||
69 | QTimer::singleShot(5500, qApp, &QCoreApplication::quit); | 77 | QTimer::singleShot(5500, qApp, &QCoreApplication::quit); | ||
70 | KScreen::OsdManager::self()->showOsd(!icon.isEmpty() ? icon : QStringLiteral("preferences-desktop-display-randr"), | 78 | getOsdManager()->showOsd(!icon.isEmpty() ? icon : QStringLiteral("preferences-desktop-display-randr"), | ||
71 | !message.isEmpty() ? message : QStringLiteral("On-Screen-Display")); | 79 | !message.isEmpty() ? message : QStringLiteral("On-Screen-Display")); | ||
72 | } else { | 80 | } else { | ||
73 | qCWarning(KSCREEN_KDED) << "Implement me."; | 81 | qCWarning(KSCREEN_KDED) << "Implement me."; | ||
74 | QTimer::singleShot(100, qApp, &QCoreApplication::quit); | 82 | QTimer::singleShot(100, qApp, &QCoreApplication::quit); | ||
75 | } | 83 | } | ||
76 | } | 84 | } | ||
77 | 85 | | |||
78 | void OsdTest::showActionSelector() | 86 | void OsdTest::showActionSelector() | ||
79 | { | 87 | { | ||
80 | if (!m_useDBus) { | 88 | if (!m_useDBus) { | ||
81 | auto action = KScreen::OsdManager::self()->showActionSelector(); | 89 | auto action = getOsdManager()->showActionSelector(); | ||
82 | connect(action, &KScreen::OsdAction::selected, | 90 | connect(action, &KScreen::OsdAction::selected, | ||
83 | [](KScreen::OsdAction::Action action) { | 91 | [](KScreen::OsdAction::Action action) { | ||
84 | qCDebug(KSCREEN_KDED) << "Selected action:" << action; | 92 | qCDebug(KSCREEN_KDED) << "Selected action:" << action; | ||
85 | qApp->quit(); | 93 | qApp->quit(); | ||
86 | }); | 94 | }); | ||
87 | } else { | 95 | } else { | ||
88 | qCWarning(KSCREEN_KDED) << "Implement me."; | 96 | qCWarning(KSCREEN_KDED) << "Implement me."; | ||
89 | QTimer::singleShot(100, qApp, &QCoreApplication::quit); | 97 | QTimer::singleShot(100, qApp, &QCoreApplication::quit); | ||
90 | } | 98 | } | ||
91 | } | 99 | } | ||
92 | 100 | | |||
93 | } // ns | 101 | } // ns |