start a KDELearningProject

to learn kde stuff. kirigami will come later.
This commit is contained in:
Fries 2023-06-25 22:24:48 -07:00
commit a694946fb9
8 changed files with 131 additions and 0 deletions

3
.clang-format Normal file
View file

@ -0,0 +1,3 @@
BasedOnStyle: WebKit
UseTab: Always
TabWidth: 4

4
.editorconfig Normal file
View file

@ -0,0 +1,4 @@
[*]
indent_style = tab
end_of_line = lf
insert_final_newline = true

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
/build*
/.cache

16
.vscode/launch.json vendored Normal file
View file

@ -0,0 +1,16 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug",
"program": "${command:cmake.launchTargetPath}",
"args": [],
"cwd": "${workspaceFolder}"
}
]
}

30
CMakeLists.txt Normal file
View file

@ -0,0 +1,30 @@
cmake_minimum_required(VERSION 3.18)
project(KDELearningProject)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_STANDARD 20)
set(QT_MIN_VERSION "5.15.2")
set(KF5_MIN_VERSION "5.78.0")
find_package(ECM 1.0.0 REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(FeatureSummary)
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
Core
Widgets
)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
CoreAddons
I18n
WidgetsAddons
)
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
add_subdirectory(src)

15
src/CMakeLists.txt Normal file
View file

@ -0,0 +1,15 @@
add_executable(hello hello.cc)
target_link_libraries(hello
Qt5::Widgets
KF5::CoreAddons
KF5::WidgetsAddons
)
add_executable(internationalization internationalization.cc)
target_link_libraries(internationalization
Qt5::Widgets
KF5::CoreAddons
KF5::WidgetsAddons
KF5::I18n
)

16
src/hello.cc Normal file
View file

@ -0,0 +1,16 @@
#include <QApplication>
#include <KMessageBox>
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
KGuiItem primaryAction(
"Meow", QString(),
"Meow", "A Meowy button."
);
return KMessageBox::questionTwoActions(
nullptr, "Meowy World", "Meowy Title",
primaryAction, KStandardGuiItem::cancel()
) == KMessageBox::PrimaryAction ? EXIT_SUCCESS : EXIT_FAILURE;
}

View file

@ -0,0 +1,45 @@
#include <KAboutData>
#include <KLocalizedString>
#include <KMessageBox>
#include <QApplication>
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
KAboutData aboutData(
// Internal name
QStringLiteral("internationalization"),
// Displayed name
i18n("Internationalization"),
// Version
QStringLiteral("1.0"),
// Short Description
i18n("an experiment that displays a KMessageBox."),
KAboutLicense::Custom,
// Long Description
i18n("this is an experiment app to learn how to use KMessageBox's."),
// Program homepage
QStringLiteral("https://git.fries.gay/fries/KDELearningProject"));
KAboutData::setApplicationData(aboutData);
KGuiItem primaryAction(
i18n("Meow"), QString(),
i18n("This is a Meowy tooltip."),
i18n("This is Meowy help text."));
KMessageBox::ButtonCode box = KMessageBox::questionTwoActions(
// Parent
nullptr,
// Message Box content
i18n("Meowy World!"),
// Title
i18n("Meowy Title"),
// Primary button
primaryAction,
// Secondary button
KStandardGuiItem::cancel());
return box == KMessageBox::PrimaryAction ? EXIT_SUCCESS : EXIT_FAILURE;
}