diff --git a/CMakeLists.txt b/CMakeLists.txt index 694c3cb..8ae21aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,67 +1,67 @@ cmake_minimum_required(VERSION 3.10) project(kcm_bolt) set(CMAKE_CXX_STANDARD 14) ################################################# # Dependencies set(QT5_VERSION "5.10") -set(KF5_VERSION "5.40") +set(KF5_VERSION "5.70") find_package(ECM ${KF5_VERSION} REQUIRED) set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH}) include(KDEInstallDirs) include(KDECMakeSettings) include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) include(KDEClangFormat) include(ECMQtDeclareLoggingCategory) include(GenerateExportHeader) include(CheckIncludeFiles) include(CheckSymbolExists) include(FeatureSummary) kde_enable_exceptions() ################################################# # Dependencies find_package(Qt5Core ${QT_VERSION} REQUIRED) find_package(Qt5Quick ${QT_VERSION} REQUIRED) find_package(Qt5DBus ${QT_VERSION} REQUIRED) if (BUILD_TESTING) find_package(Qt5Test ${QT_VERSION} REQUIRED) endif() find_package(KF5CoreAddons ${KF5_VERSION} REQUIRED) find_package(KF5KCMUtils ${KF5_VERSION} REQUIRED) find_package(KF5Declarative ${KF5_VERSION} REQUIRED) find_package(KF5I18n ${KF5_VERSION} REQUIRED) find_package(KF5DBusAddons ${KF5_VERSION} REQUIRED) find_package(KF5Notifications ${KF5_VERSION} REQUIRED) find_package(Bolt) set_package_properties(Bolt PROPERTIES DESCRIPTION "Thunderbolt device manager" URL "https://gitlab.freedesktop.org/bolt/bolt" PURPOSE "Runtime-only dependency for Thunderbolt KCM" TYPE RUNTIME) ################################################# if (EXISTS "${CMAKE_SOURCE_DIR}/.git") add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x060000) endif() if (BUILD_TESTING) add_subdirectory(autotests) endif() add_subdirectory(src) ################################################ # add clang-format target for all our real source files file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h) kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES}) feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/src/kcm/package/contents/ui/DeviceList.qml b/src/kcm/package/contents/ui/DeviceList.qml index e9c949e..1845f4e 100644 --- a/src/kcm/package/contents/ui/DeviceList.qml +++ b/src/kcm/package/contents/ui/DeviceList.qml @@ -1,121 +1,124 @@ /* * Copyright (c) 2018 - 2019 Daniel Vrátil * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License or (at your option) version 3 or any later version * accepted by the membership of KDE e.V. (or its successor approved * by the membership of KDE e.V.), which shall act as a proxy * defined in Section 14 of version 3 of the license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ import QtQuick 2.7 import QtQuick.Layouts 1.1 import QtQuick.Controls 2.3 -import org.kde.kirigami 2.4 as Kirigami +import org.kde.kirigami 2.12 as Kirigami import org.kde.kquickcontrolsaddons 2.0 as KQCAddons import org.kde.kcm 1.2 as KCM import org.kde.bolt 0.1 as Bolt import "utils.js" as Utils KCM.ScrollViewKCM { id: page property Bolt.DeviceModel deviceModel: null signal itemClicked(Bolt.Device device) header: RowLayout { CheckBox { id: enableBox text: i18n("Enable Thunderbolt devices") checked: deviceModel.manager.authMode == Bolt.Bolt.AuthMode.Enabled onToggled: { deviceModel.manager.authMode = enableBox.checked ? Bolt.Bolt.AuthMode.Enabled : Bolt.Bolt.AuthMode.Disabled } } } view: ListView { id: view model: deviceModel enabled: enableBox.checked property int _evalTrigger: 0 Timer { interval: 2000 running: view.visible repeat: true onTriggered: view._evalTrigger++; } - Kirigami.Heading { + Kirigami.PlaceholderMessage { anchors.centerIn: parent + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: Kirigami.Units.largeSpacing + visible: view.count === 0 - level: 2 + text: i18n("No Thunderbolt devices connected") - opacity: 0.3 } delegate: Kirigami.AbstractListItem { id: item width: view.width RowLayout { id: layout spacing: Kirigami.Units.smallSpacing * 2 property bool indicateActiveFocus: item.pressed || Kirigami.Settings.tabletMode || item.activeFocus || (item.ListView.view ? item.ListView.view.activeFocus : false) BusyIndicator { id: busyIndicator visible: model.device.status == Bolt.Bolt.Status.Authorizing running: visible Layout.minimumHeight: Kirigami.Units.iconSizes.smallMedium Layout.maximumHeight: Layout.minimumHeight Layout.minimumWidth: height } Label { id: label text: model.device.label Layout.fillWidth: true Layout.topMargin: Kirigami.Units.smallSpacing Layout.bottomMargin: Kirigami.Units.smallSpacing color: parent.indicateActiveFocus && (item.highlighted || item.checked || item.pressed) ? item.activeTextColor : item.textColor elide: Text.ElideRight font: item.font } Label { id: statusLabel Layout.alignment: Qt.AlignRight property var _deviceStatus: Utils.deviceStatus(model.device, true) text: view._evalTrigger, _deviceStatus.text color: _deviceStatus.color } } onClicked: { page.itemClicked(model.device) } } } }