Changeset View
Changeset View
Standalone View
Standalone View
kcms/input/backends/x11/kapplymousetheme.cpp
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * main.cpp | ||||
3 | * | ||||
4 | * Copyright (c) 1999 Matthias Hoelzer-Kluepfel <hoelzer@kde.org> | ||||
5 | * Copyright (c) 2005 Lubos Lunak <l.lunak@kde.org> | ||||
6 | * Copyright (c) 2017 Xuetian Weng <wengxt@gmail.com> | ||||
7 | * | ||||
8 | * Requires the Qt widget libraries, available at no cost at | ||||
9 | * http://www.troll.no/ | ||||
10 | * | ||||
11 | * This program is free software; you can redistribute it and/or modify | ||||
12 | * it under the terms of the GNU General Public License as published by | ||||
13 | * the Free Software Foundation; either version 2 of the License, or | ||||
14 | * (at your option) any later version. | ||||
15 | * | ||||
16 | * This program is distributed in the hope that it will be useful, | ||||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
19 | * GNU General Public License for more details. | ||||
20 | * | ||||
21 | * You should have received a copy of the GNU General Public License | ||||
22 | * along with this program; if not, write to the Free Software | ||||
23 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||||
24 | */ | ||||
25 | #include <QGuiApplication> | ||||
26 | #include <QFile> | ||||
27 | | ||||
28 | #include "mousebackend.h" | ||||
29 | | ||||
30 | int main( int argc, char* argv[] ) | ||||
31 | { | ||||
32 | int ret = 0; | ||||
33 | QGuiApplication app(argc, argv); | ||||
34 | if( argc != 3 ) | ||||
35 | return 1; | ||||
36 | QString theme = QFile::decodeName(argv[ 1 ]); | ||||
37 | QString size = QFile::decodeName(argv[ 2 ]); | ||||
38 | auto backend = MouseBackend::implementation(); | ||||
39 | if (!backend || !backend->isValid()) { | ||||
40 | return 2; | ||||
41 | } | ||||
42 | | ||||
43 | // Note: If you update this code, update main.cpp as well. | ||||
44 | | ||||
45 | // use a default value for theme only if it's not configured at all, not even in X resources | ||||
46 | if(theme.isEmpty() && backend->currentCursorTheme().isEmpty()) | ||||
47 | { | ||||
48 | theme = "breeze_cursors"; | ||||
49 | ret = 10; // means to switch to default | ||||
50 | } | ||||
51 | | ||||
52 | backend->applyCursorTheme(theme, size.toInt()); | ||||
53 | return ret; | ||||
54 | } |