mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-23 18:32:53 +00:00
kvkbd: do not use resource files for standart theme
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
4369c1a2c9
commit
31716d0c50
8 changed files with 29 additions and 223 deletions
|
@ -14,15 +14,13 @@ set(kvkbd_SRCS vkeyboard.cpp
|
|||
themeloader.cpp
|
||||
)
|
||||
|
||||
QT4_ADD_RESOURCES(kvkbd_RESOURCES_RCC resources.qrc)
|
||||
|
||||
QT4_ADD_DBUS_ADAPTOR(kvkbd_SRCS org.kde.kvkbd.Kvkbd.xml
|
||||
mainwidget.h MainWidget)
|
||||
|
||||
QT4_ADD_DBUS_ADAPTOR(kvkbd_SRCS org.kde.kvkbd.Dock.xml
|
||||
kbddock.h KbdDock)
|
||||
|
||||
add_executable(kvkbd ${kvkbd_SRCS} ${kvkbd_RC_SRCS} ${kvkbd_RESOURCES_RCC})
|
||||
add_executable(kvkbd ${kvkbd_SRCS})
|
||||
|
||||
target_link_libraries(kvkbd
|
||||
${KDE4_KDECORE_LIBS}
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
<RCC>
|
||||
<qresource prefix="/theme">
|
||||
<file>standart.xml</file>
|
||||
<file>standart.css</file>
|
||||
</qresource>
|
||||
</RCC>
|
|
@ -1,183 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<layout name="standart">
|
||||
<buttonWidth width="25">
|
||||
<item name="Esc" width="30"/>
|
||||
<item name="FKey" width="20"/>
|
||||
<item name="BackSpace" width="55"/>
|
||||
<item name="Tab" width="45"/>
|
||||
<item name="BackSlash" width="35"/>
|
||||
<item name="CapsLock" width="50"/>
|
||||
<item name="Enter" width="55"/>
|
||||
<item name="LeftShift" width="60"/>
|
||||
<item name="RightShift" width="70"/>
|
||||
<item name="LCtrl" width="35"/>
|
||||
<item name="LMeta" width="25"/>
|
||||
<item name="LAlt" width="30"/>
|
||||
<item name="Space" width="170"/>
|
||||
<item name="RAlt" width="30"/>
|
||||
<item name="RMeta" width="25"/>
|
||||
<item name="RApp" width="25"/>
|
||||
<item name="RCtrl" width="40"/>
|
||||
<item name="Insert" width="50"/>
|
||||
</buttonWidth>
|
||||
|
||||
<buttonHeight height="25">
|
||||
<item name="FKey" height="15"/>
|
||||
<item name="NumPadPlus" height="50" />
|
||||
<item name="NumPadEnter" height="50" />
|
||||
</buttonHeight>
|
||||
|
||||
<spacingHints>
|
||||
<item name="Normal" width="5"/>
|
||||
<item name="Esc" width="25"/>
|
||||
<item name="FKeys" width="10"/>
|
||||
<item name="SpecialKeys" width="25"/>
|
||||
<item name="NumPadFullRow" width="100"/>
|
||||
|
||||
</spacingHints>
|
||||
|
||||
|
||||
<part name="main">
|
||||
|
||||
<row height="FKey">
|
||||
<key code="9" width="Esc" height="FKey" label="Esc" colorGroup="other"/>
|
||||
<spacing width="Esc" />
|
||||
<key code="67" width="FKey" height="FKey" label="F1" colorGroup="function"/>
|
||||
<key code="68" width="FKey" height="FKey" label="F2" colorGroup="function"/>
|
||||
<key code="69" width="FKey" height="FKey" label="F3" colorGroup="function"/>
|
||||
<key code="70" width="FKey" height="FKey" label="F4" colorGroup="function"/>
|
||||
<spacing width="FKeys"/>
|
||||
<key code="71" width="FKey" height="FKey" label="F5" colorGroup="function"/>
|
||||
<key code="72" width="FKey" height="FKey" label="F6" colorGroup="function"/>
|
||||
<key code="73" width="FKey" height="FKey" label="F7" colorGroup="function"/>
|
||||
<key code="74" width="FKey" height="FKey" label="F8" colorGroup="function"/>
|
||||
<spacing width="FKeys"/>
|
||||
<key code="75" width="FKey" height="FKey" label="F9" colorGroup="function"/>
|
||||
<key code="76" width="FKey" height="FKey" label="F10" colorGroup="function"/>
|
||||
<key code="77" width="FKey" height="FKey" label="F11" colorGroup="function"/>
|
||||
<key code="78" width="FKey" height="FKey" label="F12" colorGroup="function"/>
|
||||
<spacing width="SpecialKeys"/>
|
||||
<key action="toggleExtension" width="FKey" height="FKey" label=" " colorGroup="settings" tooltip="Toggle Extension"/>
|
||||
<key action="toggleVisibility" width="FKey" height="FKey" label=" " colorGroup="hide" tooltip="Hide Keyboard"/>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<key code="49"/>
|
||||
<key code="10"/>
|
||||
<key code="11"/>
|
||||
<key code="12"/>
|
||||
<key code="13"/>
|
||||
<key code="14"/>
|
||||
<key code="15"/>
|
||||
<key code="16"/>
|
||||
<key code="17"/>
|
||||
<key code="18"/>
|
||||
<key code="19"/>
|
||||
<key code="20"/>
|
||||
<key code="21"/>
|
||||
<key code="22" width="BackSpace" label="⤌"/>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<key code="23" width="Tab" label="Tab"/>
|
||||
<key code="24"/>
|
||||
<key code="25"/>
|
||||
<key code="26"/>
|
||||
<key code="27"/>
|
||||
<key code="28"/>
|
||||
<key code="29"/>
|
||||
<key code="30"/>
|
||||
<key code="31"/>
|
||||
<key code="32"/>
|
||||
<key code="33"/>
|
||||
<key code="34"/>
|
||||
<key code="35"/>
|
||||
<key code="51" width="BackSlash"/>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<key code="66" width="CapsLock" label="Caps" action="caps_lock" group_name="capslock" checkable="1"/>
|
||||
<key code="38"/>
|
||||
<key code="39"/>
|
||||
<key code="40"/>
|
||||
<key code="41"/>
|
||||
<key code="42"/>
|
||||
<key code="43"/>
|
||||
<key code="44"/>
|
||||
<key code="45"/>
|
||||
<key code="46"/>
|
||||
<key code="47"/>
|
||||
<key code="48"/>
|
||||
<key code="36" width="Enter" colorGroup="enter" label="Enter"/>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<key code="50" width="LeftShift" label="⤊" action="shiftText" modifier="1" />
|
||||
<key code="52"/>
|
||||
<key code="53"/>
|
||||
<key code="54"/>
|
||||
<key code="55"/>
|
||||
<key code="56"/>
|
||||
<key code="57"/>
|
||||
<key code="58"/>
|
||||
<key code="59"/>
|
||||
<key code="60"/>
|
||||
<key code="61"/>
|
||||
<key code="62" width="RightShift" label="⤊" action="shiftText" modifier="1" />
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<key code="37" width="LCtrl" label="Ctrl" modifier="1"/>
|
||||
<key code="133" width="LMeta" colorGroup="system" label="Win" modifier="1" />
|
||||
<key code="64" width="LAlt" label="Alt" modifier="1"/>
|
||||
<key code="65" width="Space" name="currentLayout" label=" "/>
|
||||
<key code="108" width="RAlt" label="Alt Gr" modifier="1"/>
|
||||
<key code="134" width="RMeta" label="Win" colorGroup="system" modifier="1"/>
|
||||
<key code="135" width="RApp" label="Prop" colorGroup="application" modifier="1"/>
|
||||
<key code="105" width="RCtrl" label="Ctrl" modifier="1"/>
|
||||
</row>
|
||||
|
||||
<extension attachment="right">
|
||||
<row height="FKey">
|
||||
<spacing width="NumPadFullRow" height="FKey" />
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<key code="77" label="Num" action="group_toggle" group_name="numlock" checkable="1" colorGroup="numeric"/>
|
||||
<key code="106" colorGroup="numeric" label="/" />
|
||||
<key code="63" colorGroup="numeric" label="*" />
|
||||
<key code="82" colorGroup="numeric" label="-" />
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<key code="79" colorGroup="numeric" label="Home" group_toggle="numlock" group_label="7" />
|
||||
<key code="80" colorGroup="numeric" label="▲" group_toggle="numlock" group_label="8" />
|
||||
<key code="81" colorGroup="numeric" label="PgUp" group_toggle="numlock" group_label="9" />
|
||||
<key code="86" label="+" height="NumPadPlus" colorGroup="numeric"/>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<key code="83" colorGroup="numeric" label="◄" group_toggle="numlock" group_label="4"/>
|
||||
<key code="84" colorGroup="numeric" label=" " group_toggle="numlock" group_label="5"/>
|
||||
<key code="85" colorGroup="numeric" label="►" group_toggle="numlock" group_label="6"/>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<key code="87" colorGroup="numeric" label="End" group_toggle="numlock" group_label="1"/>
|
||||
<key code="88" colorGroup="numeric" label="▼" group_toggle="numlock" group_label="2"/>
|
||||
<key code="89" colorGroup="numeric" label="PgDn" group_toggle="numlock" group_label="3"/>
|
||||
<key code="104" label="⤶" height="NumPadEnter" colorGroup="enter" />
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<key code="90" width="Insert" label="Ins" colorGroup="numeric" group_toggle="numlock" group_label="0"/>
|
||||
<key code="91" label="Del" colorGroup="numeric" group_toggle="numlock" group_label="."/>
|
||||
|
||||
</row>
|
||||
|
||||
</extension>
|
||||
|
||||
</part>
|
||||
|
||||
</layout>
|
|
@ -32,45 +32,35 @@
|
|||
#include <KAction>
|
||||
#include <KIcon>
|
||||
#include <KToggleAction>
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
#include <KDebug>
|
||||
|
||||
int defaultWidth = 25;
|
||||
int defaultHeight = 25;
|
||||
|
||||
#define DEFAULT_CSS ":/theme/standart.css"
|
||||
|
||||
ThemeLoader::ThemeLoader(QWidget *parent) : QObject(parent)
|
||||
{
|
||||
|
||||
defaultcss = KStandardDirs::locate("data", QString::fromLatin1("kvkbd/themes/standart.css"));
|
||||
if (defaultcss.isEmpty()) {
|
||||
kWarning() << "Could not locate standard theme CSS file";
|
||||
}
|
||||
themespath = QFileInfo(defaultcss).path();
|
||||
// qDebug() << Q_FUNC_INFO << defaultcss << themespath;
|
||||
}
|
||||
|
||||
ThemeLoader::~ThemeLoader()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ThemeLoader::loadTheme(QString& themeName)
|
||||
{
|
||||
bool loading = true;
|
||||
while (loading) {
|
||||
int ret = this->loadLayout(themeName, ":/theme/");
|
||||
QString themePath = QString::fromLatin1("%1/%2").arg(themespath).arg(themeName);
|
||||
int ret = loadLayout(themePath);
|
||||
|
||||
if (ret == 0) {
|
||||
break;
|
||||
}
|
||||
//bail out
|
||||
else {
|
||||
if (QString::compare(themeName, "standart")==0) {
|
||||
loading = false;
|
||||
kapp->quit();
|
||||
} else {
|
||||
themeName="standart";
|
||||
}
|
||||
}
|
||||
if (ret != 0) {
|
||||
kapp->quit();
|
||||
}
|
||||
}
|
||||
|
||||
void ThemeLoader::loadColorFile(const QString& fileName)
|
||||
{
|
||||
lastcolorstyle = fileName;
|
||||
|
@ -124,7 +114,7 @@ void ThemeLoader::findColorStyles(QMenu *colors, const QString& configSelectedSt
|
|||
QAction *item = new QAction(colors);
|
||||
item->setCheckable(true);
|
||||
item->setText("standart");
|
||||
item->setData(DEFAULT_CSS);
|
||||
item->setData(defaultcss);
|
||||
colors->addAction(item);
|
||||
color_group->addAction(item);
|
||||
|
||||
|
@ -163,7 +153,7 @@ void ThemeLoader::findColorStyles(QMenu *colors, const QString& configSelectedSt
|
|||
|
||||
QString selectedStyle = configSelectedStyle;
|
||||
if (selectedStyle.length() < 1) {
|
||||
selectedStyle = DEFAULT_CSS;
|
||||
selectedStyle = defaultcss;
|
||||
}
|
||||
QAction *selectedAction = 0;
|
||||
|
||||
|
@ -186,7 +176,7 @@ void ThemeLoader::findColorStyles(QMenu *colors, const QString& configSelectedSt
|
|||
}
|
||||
|
||||
|
||||
int ThemeLoader::loadLayout(const QString& themeName, const QString& path)
|
||||
int ThemeLoader::loadLayout(const QString& themeName)
|
||||
{
|
||||
|
||||
// const KArchiveDirectory * KArchive::directory ( ) const
|
||||
|
@ -196,7 +186,7 @@ int ThemeLoader::loadLayout(const QString& themeName, const QString& path)
|
|||
|
||||
QDomDocument doc;
|
||||
|
||||
themeFile.setFileName(QString(path + "%1.xml").arg(themeName));
|
||||
themeFile.setFileName(QString::fromLatin1("%1.xml").arg(themeName));
|
||||
|
||||
if (!themeFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QMessageBox::information(0, "Error", QString("Unable to open theme xml file: %1").arg(themeFile.fileName()));
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
|
||||
void loadColorFile(const QString& fileName);
|
||||
|
||||
int loadLayout(const QString& themeName, const QString& path);
|
||||
int loadLayout(const QString& themeName);
|
||||
|
||||
void findColorStyles(QMenu *parent, const QString& selectedStyle);
|
||||
|
||||
|
@ -66,6 +66,8 @@ signals:
|
|||
|
||||
private:
|
||||
QString lastcolorstyle;
|
||||
QString defaultcss;
|
||||
QString themespath;
|
||||
};
|
||||
|
||||
#endif // THEMELOADER_H
|
||||
|
|
|
@ -1 +1,6 @@
|
|||
install( FILES standart.xml DESTINATION ${KDE4_DATA_INSTALL_DIR}/kvkbd/themes)
|
||||
install(
|
||||
FILES
|
||||
standart.xml
|
||||
standart.css
|
||||
DESTINATION ${KDE4_DATA_INSTALL_DIR}/kvkbd/themes
|
||||
)
|
||||
|
|
|
@ -58,8 +58,8 @@
|
|||
<key code="77" width="FKey" height="FKey" label="F11" colorGroup="function"/>
|
||||
<key code="78" width="FKey" height="FKey" label="F12" colorGroup="function"/>
|
||||
<spacing width="SpecialKeys"/>
|
||||
<key action="toggleExtension" width="FKey" height="FKey" label=" " colorGroup="settings"/>
|
||||
<key action="hide" width="FKey" height="FKey" label=" " colorGroup="hide"/>
|
||||
<key action="toggleExtension" width="FKey" height="FKey" label=" " colorGroup="settings" tooltip="Toggle Extension"/>
|
||||
<key action="toggleVisibility" width="FKey" height="FKey" label=" " colorGroup="hide" tooltip="Hide Keyboard"/>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
|
|
Loading…
Add table
Reference in a new issue