Changeset View
Changeset View
Standalone View
Standalone View
kded/osdaction.cpp
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright 2016 Sebastian Kügler <sebas@kde.org> | ||||
3 | * Copyright (c) 2018 Kai Uwe Broulik <kde@broulik.de> | ||||
4 | * Work sponsored by the LiMux project of | ||||
5 | * the city of Munich. | ||||
6 | * | ||||
7 | * This program is free software; you can redistribute it and/or modify | ||||
8 | * it under the terms of the GNU General Public License as published by | ||||
9 | * the Free Software Foundation; either version 2 of the License, or | ||||
10 | * (at your option) any later version. | ||||
11 | * | ||||
12 | * This program is distributed in the hope that it will be useful, | ||||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
15 | * GNU General Public License for more details. | ||||
16 | * | ||||
17 | * You should have received a copy of the GNU General Public License | ||||
18 | * along with this program; if not, write to the Free Software | ||||
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||||
20 | */ | ||||
21 | | ||||
22 | #include "osdaction.h" | ||||
23 | | ||||
24 | #include <KLocalizedString> | ||||
25 | | ||||
26 | using namespace KScreen; | ||||
27 | | ||||
28 | OsdAction::OsdAction(QObject *parent) | ||||
29 | : QObject(parent) | ||||
30 | { | ||||
31 | } | ||||
32 | | ||||
33 | QVector<int> OsdAction::actionOrder() const | ||||
34 | { | ||||
35 | return { | ||||
36 | SwitchToExternal, | ||||
37 | SwitchToInternal, | ||||
38 | Clone, | ||||
39 | ExtendLeft, | ||||
40 | ExtendRight, | ||||
41 | NoAction | ||||
42 | }; | ||||
43 | } | ||||
44 | | ||||
45 | QString OsdAction::actionLabel(OsdAction::Action action) const | ||||
46 | { | ||||
47 | switch (action) { | ||||
48 | // this is built by both daemon and plasmoid, needs explicit translation domain here | ||||
49 | case SwitchToExternal: return i18nd("kscreen", "Switch to external screen"); | ||||
50 | case SwitchToInternal: return i18nd("kscreen", "Switch to laptop screen"); | ||||
51 | case Clone: return i18nd("kscreen", "Unify outputs"); | ||||
52 | case ExtendLeft: return i18nd("kscreen", "Extend to left"); | ||||
53 | case ExtendRight: return i18nd("kscreen", "Extend to right"); | ||||
54 | case NoAction: return i18nd("kscreen", "Leave unchanged"); | ||||
55 | } | ||||
56 | | ||||
57 | Q_UNREACHABLE(); | ||||
58 | return QString(); | ||||
59 | } | ||||
60 | | ||||
61 | QString OsdAction::actionIconName(OsdAction::Action action) const | ||||
62 | { | ||||
63 | switch (action) { | ||||
64 | case SwitchToExternal: return QStringLiteral("osd-shutd-laptop"); | ||||
65 | case SwitchToInternal: return QStringLiteral("osd-shutd-screen"); | ||||
66 | case Clone: return QStringLiteral("osd-duplicate"); | ||||
67 | case ExtendLeft: return QStringLiteral("osd-sbs-left"); | ||||
68 | case ExtendRight: return QStringLiteral("osd-sbs-sright"); | ||||
69 | case NoAction: return QStringLiteral("dialog-cancel"); | ||||
70 | } | ||||
71 | | ||||
72 | Q_UNREACHABLE(); | ||||
73 | return QString(); | ||||
74 | } | ||||
75 | | ||||
76 | #include "osdaction.moc" |