add user config infrastructure

This commit is contained in:
Eon S. Jeon 2018-11-16 18:56:05 +09:00
parent 72b7b2cc68
commit cce5da1f4f
3 changed files with 207 additions and 1 deletions

View File

@ -7,6 +7,8 @@ PACKAGE_DIR = pkg
FILE_SCRIPT = $(PACKAGE_DIR)/contents/code/script.js
FILE_META = $(PACKAGE_DIR)/metadata.desktop
FILE_QML = $(PACKAGE_DIR)/contents/ui/main.qml
FILE_CONFIG_XML = $(PACKAGE_DIR)/contents/config/main.xml
FILE_CONFIG_UI = $(PACKAGE_DIR)/contents/ui/config.ui
all: $(PACKAGE_DIR)
@ -33,6 +35,7 @@ $(PACKAGE_FILE): $(PACKAGE_DIR)
@7z a -tzip $(PACKAGE_FILE) ./$(PACKAGE_DIR)/*
$(PACKAGE_DIR): $(FILE_SCRIPT) $(FILE_META) $(FILE_QML)
$(PACKAGE_DIR): $(FILE_CONFIG_XML) $(FILE_CONFIG_UI)
@touch $@
$(FILE_SCRIPT): src/common.ts
@ -48,7 +51,15 @@ $(FILE_META): res/metadata.desktop
sed "s/0\.0/$(PACKAGE_VER)/" $< > $(FILE_META)
$(FILE_QML): res/main.qml
@mkdir -vp `dirname $(FILE_QML)`
@mkdir -vp `dirname $@`
@cp -v $< $@
$(FILE_CONFIG_XML): res/config.xml
@mkdir -vp `dirname $@`
@cp -v $< $@
$(FILE_CONFIG_UI): res/config.ui
@mkdir -vp `dirname $@`
@cp -v $< $@
.PHONY: all clean install package

155
res/config.ui Normal file
View File

@ -0,0 +1,155 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>KrohnkiteConfigForm</class>
<widget class="QWidget" name="KrohnkiteConfigForm">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>400</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTabWidget" name="configTabs">
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="layoutTab">
<attribute name="title">
<string>Layout</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Enable/disable Layout</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="leftMargin">
<number>40</number>
</property>
<item>
<widget class="QCheckBox" name="kcfg_enableTileLayout">
<property name="text">
<string>Tile Layout</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="tristate">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="kcfg_enableMonocleLayout">
<property name="text">
<string>Monocle Layout</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="kcfg_enableSpreadLayout">
<property name="text">
<string>Spread Layout</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="kcfg_enableStairLayout">
<property name="text">
<string>Stair Layout</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="rulesTab">
<attribute name="title">
<string>Rules</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="rulesLayout">
<property name="sizeConstraint">
<enum>QLayout::SetMaximumSize</enum>
</property>
<item>
<widget class="QLabel" name="ignoreLabel">
<property name="text">
<string>Ignore (Window Class)</string>
</property>
<property name="textInteractionFlags">
<set>Qt::NoTextInteraction</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="kcfg_ignoreClass"/>
</item>
<item>
<widget class="QLabel" name="floatingLabel">
<property name="text">
<string>Set Float (Window Class)</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="kcfg_floatingClass"/>
</item>
<item>
<spacer name="rulesIntroSpace">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

40
res/config.xml Normal file
View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name=""/>
<group name="">
<entry name="enableTileLayout" type="Bool">
<label>Enable/disable Tile layout</label>
<default>true</default>
</entry>
<entry name="enableMonocleLayout" type="Bool">
<label>Enable/disable Monocle layout</label>
<default>true</default>
</entry>
<entry name="enableSpreadLayout" type="Bool">
<label>Enable/disable Spread layout</label>
<default>true</default>
</entry>
<entry name="enableStairLayout" type="Bool">
<label>Enable/disable Stair layout</label>
<default>true</default>
</entry>
<entry name="ignoreClass" type="String">
<label>Ignore windows with certain classes(comma-separated list)</label>
<default>krunner</default>
</entry>
<entry name="floatingClass" type="String">
<label>Float windows with certain classes(comma-separated list)</label>
<default></default>
</entry>
</group>
</kcfg>