Contents |
Author: Matt Williams
In this tutorial, we're going to be showing you how to utilise KConfig XT in an application. It is recommended that you read Development/Tutorials/Using KConfig XT before continuing in order to familiarise yourself with the framework.
At first we make new File called tutorial4.kcfg within the source directory of your project.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE kcfg SYSTEM "http://www.kde.org/standards/kcfg/1.0/kcfg.xsd">
<kcfg>
<kcfgfile name="kjotsrc"/>
<include>kglobalsettings.h</include>
<group name="kjots">
<entry name="showAction" type="Bool">
<label>Whether setupAction is called</label>
<default>true</default>
</entry>
</group>
</kcfg>
This code makes a setting of the type bool, which determines whether we want to do something. Then we set the default value to be true.
Always start the value of <entry name=""> in lower case since KConfig XT sets them to lower case within the generated headers either way. If you don't this could give you some nearly untraceable errors
Now we make a new File called tutorial4.kcfgc.
File=tutorial4.kcfg
ClassName=tutorial4
Singleton=true
Mutators=true
This should set up your configuration for now.
TODO
TODO
TODO
TODO
TODO
PROJECT(tutorial4)
FIND_PACKAGE(KDE4 REQUIRED) INCLUDE_DIRECTORIES( ${KDE4_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR})
SET(tutorial4_SRCS
main.cpp mainwindow.cpp
)
KDE4_ADD_KCFG_FILES(tutorial4_SRCS settings.kcfgc)
KDE4_ADD_EXECUTABLE(tutorial4 ${tutorial4_SRCS})
TARGET_LINK_LIBRARIES( tutorial4 ${KDE4_KDEUI_LIBS})
install( TARGETS tutorial4 DESTINATION ${BIN_INSTALL_DIR}) install( FILES tutorial4ui.rc DESTINATION ${DATA_INSTALL_DIR}/tutorial4) install( FILES tutorial4.kcfg DESTINATION ${KCFG_INSTALL_DIR} )
TODO