diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9d07ce9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +cmake-build-debug +build +.idea \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..625c731 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.27) +project(TestSolid) + +set(CMAKE_CXX_STANDARD 17) + +find_package(ECM REQUIRED NO_MODULE) +set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) + +include(KDEInstallDirs) +include(KDECMakeSettings) +include(KDECompilerSettings NO_POLICY_SCOPE) + +find_package(Qt${QT_MAJOR_VERSION} REQUIRED NO_MODULE COMPONENTS + Core +) + +find_package(KF${QT_MAJOR_VERSION} REQUIRED COMPONENTS + CoreAddons + Solid +) + +add_subdirectory(src) + +feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..85a5bd8 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,12 @@ +add_executable(TestSolid) + +target_sources(TestSolid PRIVATE + main.cpp + solid-test.cpp +) + +target_link_libraries(TestSolid + KF${QT_MAJOR_VERSION}::Solid +) + +install(TARGETS TestSolid ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..623e66b --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,14 @@ +#include +#include "solid-test.h" + +int main(int argc, char **argv) { + SolidTest app(argc, argv); + SolidTest::setApplicationName(QString("SolidTest")); + SolidTest::setApplicationVersion(QString("0.0.1")); + + std::cout << "Hello, World!" << std::endl; + + SolidTest::listDevices(); + + return 0; +} diff --git a/src/solid-test.cpp b/src/solid-test.cpp new file mode 100644 index 0000000..78e177f --- /dev/null +++ b/src/solid-test.cpp @@ -0,0 +1,13 @@ +// +// Created by florian on 06/01/24. +// + +#include "solid-test.h" + +void SolidTest::listDevices() { + const auto devices = Solid::Device::listFromType(Solid::DeviceInterface::Unknown, QString()); + for(const Solid::Device &device : devices) { + // print the name of device + qInfo() << device.udi(); + } +} \ No newline at end of file diff --git a/src/solid-test.h b/src/solid-test.h new file mode 100644 index 0000000..002340f --- /dev/null +++ b/src/solid-test.h @@ -0,0 +1,21 @@ +// +// Created by florian on 06/01/24. +// +#pragma once + +#include +#include + +#include +#include +#include + +class SolidTest : public QCoreApplication { +Q_OBJECT + +public: + SolidTest(int &argc, char **argv) + : QCoreApplication(argc, argv) {} + + static void listDevices(); +};