Init
This commit is contained in:
parent
10345cfa2e
commit
82c7ece541
6 changed files with 87 additions and 0 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
cmake-build-debug
|
||||||
|
build
|
||||||
|
.idea
|
24
CMakeLists.txt
Normal file
24
CMakeLists.txt
Normal file
|
@ -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)
|
12
src/CMakeLists.txt
Normal file
12
src/CMakeLists.txt
Normal file
|
@ -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})
|
14
src/main.cpp
Normal file
14
src/main.cpp
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#include <iostream>
|
||||||
|
#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;
|
||||||
|
}
|
13
src/solid-test.cpp
Normal file
13
src/solid-test.cpp
Normal file
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
21
src/solid-test.h
Normal file
21
src/solid-test.h
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
//
|
||||||
|
// Created by florian on 06/01/24.
|
||||||
|
//
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QEventLoop>
|
||||||
|
|
||||||
|
#include <QtCore>
|
||||||
|
#include <solid/device.h>
|
||||||
|
#include <solid/deviceinterface.h>
|
||||||
|
|
||||||
|
class SolidTest : public QCoreApplication {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
SolidTest(int &argc, char **argv)
|
||||||
|
: QCoreApplication(argc, argv) {}
|
||||||
|
|
||||||
|
static void listDevices();
|
||||||
|
};
|
Loading…
Reference in a new issue