pax_global_header 0000666 0000000 0000000 00000000064 12301005766 0014512 g ustar 00root root 0000000 0000000 52 comment=4404a85b0af7be76d5ccae6d189a37b2f904a45b
fcitx-qimpanel-fcitx-qimpanel-0.1.5/ 0000775 0000000 0000000 00000000000 12301005766 0017355 5 ustar 00root root 0000000 0000000 fcitx-qimpanel-fcitx-qimpanel-0.1.5/.gitignore 0000664 0000000 0000000 00000000134 12301005766 0021343 0 ustar 00root root 0000000 0000000 *~
build*/
.*
!.git*
.git/
*.tar.*
*.kdev4
*.kate-swp
*.orig
tags
astyle.sh
cscope.*
*.part
fcitx-qimpanel-fcitx-qimpanel-0.1.5/CMakeLists.txt 0000664 0000000 0000000 00000002630 12301005766 0022116 0 ustar 00root root 0000000 0000000 project(fcitx-qimpanel)
cmake_minimum_required(VERSION 2.8.6)
find_package(Fcitx 4.2.7 REQUIRED)
find_package(Qt4 REQUIRED)
include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR})
SET(fcitx-qimpanel_TRANS po/zh_CN.ts)
SET(fcitx-qimpanel_RCCS qml.qrc)
set(fcitx-qimpanel_SRCS main.cpp main_controller.cpp toplevel.cpp
main_model.cpp kimpanelagent.cpp candidate_word.cpp system_tray_menu.cpp
my_action.cpp skin/skinmenu.cpp skin/skinbase.cpp skin/skinfcitx.cpp
skin/skinsogou.cpp)
QT4_ADD_DBUS_ADAPTOR(fcitx-qimpanel_SRCS
org.kde.impanel.xml
kimpanelagent.h
PanelAgent)
QT4_ADD_TRANSLATION(fcitx-qimpanel_TRAN_SRCS ${fcitx-qimpanel_TRANS})
QT4_ADD_RESOURCES(fcitx-qimpanel_RCC_SRCS ${fcitx-qimpanel_RCCS})
configure_file(${PROJECT_SOURCE_DIR}/config.h.in ${PROJECT_BINARY_DIR}/config.h)
add_executable(fcitx-qimpanel ${fcitx-qimpanel_SRCS} ${fcitx-qimpanel_TRAN_SRCS}
${fcitx-qimpanel_RCC_SRCS})
set_target_properties(fcitx-qimpanel PROPERTIES AUTOMOC TRUE)
target_link_libraries(fcitx-qimpanel fcitx-config fcitx-utils
${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY}
${QT_QTDBUS_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY})
set(pkgbindir /usr/bin/)
set(pkgdatadir /usr/share/fcitx-qimpanel)
install(TARGETS fcitx-qimpanel RUNTIME DESTINATION ${pkgbindir})
install(FILES ${fcitx-qimpanel_TRAN_SRCS} DESTINATION ${pkgdatadir})
add_subdirectory(uk-default-skin)
fcitx-qimpanel-fcitx-qimpanel-0.1.5/README 0000664 0000000 0000000 00000001104 12301005766 0020231 0 ustar 00root root 0000000 0000000 How to Install fcitx-qimpanel in ubuntu:
mkdir build; cd build
sudo apt-get install cmake
sudo apt-get install build-essential
sudo apt-get install fcitx-libs-dev
sudo apt-get install libqt4-declarative libqt4-dev libqt4-dev-bin qt4-default qt4-dev-tools qt4-qmake
cmake ../
make
sudo make install
How to Install sogou skin:
You can find sogou skin here: http://pinyin.sogou.com/skins/
Once you have download skin file named like demo.ssf, you can install like this:
mv demo.ssf demo.zip
unzip -d demo demo.zip
sudo cp -r demo /usr/share/fcitx/skin/
fcitx-qimpanel-fcitx-qimpanel-0.1.5/TODO 0000664 0000000 0000000 00000000157 12301005766 0020050 0 ustar 00root root 0000000 0000000 TODO List:
sogou skin:
* add support of multi pictures
* FIXME: candidate word color
fcitx-qimpanel-fcitx-qimpanel-0.1.5/candidate_word.cpp 0000664 0000000 0000000 00000002147 12301005766 0023034 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd.
*
* Authors:
* lenky gao lenky0401@gmail.com/gaoqunkai@ubuntukylin.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include "candidate_word.h"
void CandidateWord::setCddLabel(const QString label) {
mCddLabel = label;
emit cddLabelChanged();
}
void CandidateWord::setCddText(const QString text) {
mCddText = text;
emit cddTextChanged();
}
QString CandidateWord::cddLabel() const {
return mCddLabel;
}
QString CandidateWord::cddText() const {
return mCddText;
}
fcitx-qimpanel-fcitx-qimpanel-0.1.5/candidate_word.h 0000664 0000000 0000000 00000003120 12301005766 0022471 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd.
*
* Authors:
* lenky gao lenky0401@gmail.com/gaoqunkai@ubuntukylin.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#ifndef __CANDIDATE_WORD_H__
#define __CANDIDATE_WORD_H__
#include
#include
#include
class CandidateWord : public QObject
{
Q_OBJECT
Q_PROPERTY(QString cddLabel READ cddLabel WRITE setCddLabel
NOTIFY cddLabelChanged)
Q_PROPERTY(QString cddText READ cddText WRITE setCddText
NOTIFY cddTextChanged)
public:
void setCddLabel(const QString label);
QString cddLabel() const;
void setCddText(const QString text);
QString cddText() const;
signals:
void cddLabelChanged();
void cddTextChanged();
private:
QString mCddLabel; //存放标号字符串,比如“1.”,“2.”,“3.”,“4.”,“5.”
QString mCddText; //存放候选词字符串,比如“啊”,“阿”,“吖”,“呵”,“腌”
};
#endif // __CANDIDATE_WORD_H__
fcitx-qimpanel-fcitx-qimpanel-0.1.5/config.h.in 0000664 0000000 0000000 00000000124 12301005766 0021375 0 ustar 00root root 0000000 0000000 #ifndef ___CONFIG_H___
#define ___CONFIG_H___
#cmakedefine DISABLE_UK_SYNC
#endif
fcitx-qimpanel-fcitx-qimpanel-0.1.5/kimpanelagent.cpp 0000664 0000000 0000000 00000025074 12301005766 0022710 0 ustar 00root root 0000000 0000000 /***************************************************************************
* Copyright (C) 2009 by Wang Hoi *
* Copyright (C) 2011 by CSSlayer *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
#include "kimpanelagent.h"
#include "impaneladaptor.h"
// Qt
#include
#include
#include
#include
#include
#include
#include
#include "kimpanelagent.h"
PanelAgent::PanelAgent(QObject *parent)
: QObject(parent)
,adaptor(new ImpanelAdaptor(this))
,adaptor2(new Impanel2Adaptor(this))
,watcher(new QDBusServiceWatcher(this))
{
watcher->setConnection(QDBusConnection::sessionBus());
watcher->setWatchMode(QDBusServiceWatcher::WatchForUnregistration);
QDBusConnection::connectToBus(QDBusConnection::SessionBus, "kimpanel_bus").registerObject("/org/kde/impanel", this);
QDBusConnection::connectToBus(QDBusConnection::SessionBus, "kimpanel_bus").registerService("org.kde.impanel");
// directly connect to corresponding signal
QDBusConnection("kimpanel_bus").connect("", "", "org.kde.kimpanel.inputmethod",
"Enable", this, SIGNAL(enable(bool)));
QDBusConnection("kimpanel_bus").connect("", "", "org.kde.kimpanel.inputmethod",
"ShowPreedit", this, SIGNAL(showPreedit(bool)));
QDBusConnection("kimpanel_bus").connect("", "", "org.kde.kimpanel.inputmethod",
"ShowAux", this, SIGNAL(showAux(bool)));
QDBusConnection("kimpanel_bus").connect("", "", "org.kde.kimpanel.inputmethod",
"ShowLookupTable", this, SIGNAL(showLookupTable(bool)));
QDBusConnection("kimpanel_bus").connect("", "", "org.kde.kimpanel.inputmethod",
"UpdateLookupTableCursor", this, SIGNAL(updateLookupTableCursor(int)));
// do some serialization
QDBusConnection("kimpanel_bus").connect("", "", "org.kde.kimpanel.inputmethod",
"UpdateLookupTable", this, SLOT(UpdateLookupTable(QStringList,
QStringList, QStringList, bool, bool)));
QDBusConnection("kimpanel_bus").connect("", "", "org.kde.kimpanel.inputmethod",
"UpdatePreeditCaret", this, SIGNAL(updatePreeditCaret(int)));
QDBusConnection("kimpanel_bus").connect("", "", "org.kde.kimpanel.inputmethod",
"UpdatePreeditText", this, SLOT(UpdatePreeditText(QString, QString)));
QDBusConnection("kimpanel_bus").connect("", "", "org.kde.kimpanel.inputmethod",
"UpdateAux", this, SLOT(UpdateAux(QString, QString)));
QDBusConnection("kimpanel_bus").connect("", "", "org.kde.kimpanel.inputmethod",
"UpdateSpotLocation", this, SIGNAL(updateSpotLocation(int, int)));
QDBusConnection("kimpanel_bus").connect("", "", "org.kde.kimpanel.inputmethod",
"UpdateScreen", this, SLOT(UpdateScreen(int)));
QDBusConnection("kimpanel_bus").connect("", "", "org.kde.kimpanel.inputmethod",
"UpdateProperty", this, SLOT(UpdateProperty(QString)));
QDBusConnection("kimpanel_bus").connect("", "", "org.kde.kimpanel.inputmethod",
"RegisterProperties", this, SLOT(RegisterProperties(QStringList)));
QDBusConnection("kimpanel_bus").connect("", "", "org.kde.kimpanel.inputmethod",
"ExecDialog", this, SLOT(ExecDialog(QString)));
QDBusConnection("kimpanel_bus").connect("", "", "org.kde.kimpanel.inputmethod",
"ExecMenu", this, SLOT(ExecMenu(QStringList)));
connect(watcher, SIGNAL(serviceUnregistered(QString)), this, SLOT(serviceUnregistered(QString)));
}
PanelAgent::~PanelAgent()
{
// destructor
QDBusConnection::disconnectFromBus("kimpanel_bus");
}
void PanelAgent::serviceUnregistered(const QString& service)
{
if (service == m_currentService) {
watcher->setWatchedServices(QStringList());
cached_props.clear();
m_currentService = QString();
emit showAux(false);
emit showPreedit(false);
emit showLookupTable(false);
emit registerProperties(QList());
}
}
void PanelAgent::configure()
{
emit Configure();
}
void PanelAgent::lookupTablePageDown()
{
emit LookupTablePageDown();
}
void PanelAgent::lookupTablePageUp()
{
emit LookupTablePageUp();
}
void PanelAgent::movePreeditCaret(int pos)
{
emit MovePreeditCaret(pos);
}
void PanelAgent::triggerProperty(const QString& key)
{
emit TriggerProperty(key);
}
void PanelAgent::selectCandidate(int idx)
{
emit SelectCandidate(idx);
}
static QList String2AttrList(const QString &str)
{
QList result;
if (str.isEmpty()) {
return result;
}
foreach(const QString & s, str.split(';')) {
TextAttribute attr;
QStringList list = s.split(':');
if (list.size() < 4)
continue;
switch (list.at(0).toInt()) {
case 0:
attr.type = TextAttribute::None;
break;
case 1:
attr.type = TextAttribute::Decorate;
break;
case 2:
attr.type = TextAttribute::Foreground;
break;
case 3:
attr.type = TextAttribute::Background;
break;
default:
attr.type = TextAttribute::None;
}
attr.start = list.at(1).toInt();
attr.length = list.at(2).toInt();
attr.value = list.at(3).toInt();
result << attr;
}
return result;
}
static KimpanelProperty String2Property(const QString &str)
{
KimpanelProperty result;
QStringList list = str.split(':');
if (list.size() < 4)
return result;
result.key = list.at(0);
result.label = list.at(1);
result.icon = list.at(2);
result.tip = list.at(3);
if (list.size() >= 5)
result.menu = list.at(4);
//X {
//X result.state = KimpanelProperty::None;
//X int n = list.at(4).toInt();
//X if (n & KimpanelProperty::Active)
//X result.state &= KimpanelProperty::Active;
//X if (n & KimpanelProperty::Visible)
//X result.state &= KimpanelProperty::Visible;
//X }
return result;
}
static KimpanelLookupTable Args2LookupTable(const QStringList &labels, const QStringList &candis, const QStringList &attrs, bool has_prev, bool has_next)
{
Q_ASSERT(labels.size() == candis.size());
Q_ASSERT(labels.size() == attrs.size());
KimpanelLookupTable result;
for (int i = 0; i < labels.size(); i++) {
KimpanelLookupTable::Entry entry;
entry.label = labels.at(i);
entry.text = candis.at(i);
entry.attr = String2AttrList(attrs.at(i));
result.entries << entry;
}
result.has_prev = has_prev;
result.has_next = has_next;
return result;
}
void PanelAgent::created()
{
emit PanelCreated();
emit PanelCreated2();
}
void PanelAgent::exit()
{
emit Exit();
}
void PanelAgent::restart()
{
emit Restart();
}
void PanelAgent::reloadConfig()
{
emit ReloadConfig();
}
void PanelAgent::UpdateLookupTable(const QStringList &labels,
const QStringList &candis,
const QStringList &attrlists,
bool has_prev, bool has_next)
{
emit updateLookupTable(Args2LookupTable(labels, candis, attrlists, has_prev, has_next));
}
void PanelAgent::UpdatePreeditText(const QString &text, const QString &attr)
{
emit updatePreeditText(text, String2AttrList(attr));
}
void PanelAgent::UpdateAux(const QString &text, const QString &attr)
{
emit updateAux(text, String2AttrList(attr));
}
void PanelAgent::UpdateScreen(int screen_id)
{
Q_UNUSED(screen_id);
}
void PanelAgent::UpdateProperty(const QString &prop)
{
emit updateProperty(String2Property(prop));
}
void PanelAgent::RegisterProperties(const QStringList &props)
{
const QDBusMessage& msg = message();
if (msg.service() != m_currentService) {
watcher->removeWatchedService(m_currentService);
m_currentService = msg.service();
watcher->addWatchedService(m_currentService);
}
if (cached_props != props) {
cached_props = props;
QList list;
foreach(const QString & prop, props) {
list << String2Property(prop);
}
emit registerProperties(list);
}
}
void PanelAgent::ExecDialog(const QString &prop)
{
emit execDialog(String2Property(prop));
}
void PanelAgent::ExecMenu(const QStringList &entries)
{
QList list;
foreach(const QString & entry, entries) {
list << String2Property(entry);
}
emit execMenu(list);
}
void PanelAgent::SetSpotRect(int x, int y, int w, int h)
{
emit updateSpotRect(x, y, w, h);
}
void PanelAgent::SetLookupTable(const QStringList& labels, const QStringList& candis, const QStringList& attrlists, bool hasPrev, bool hasNext, int cursor, int layout)
{
emit updateLookupTableFull(Args2LookupTable(labels, candis, attrlists, hasPrev, hasNext), cursor, layout);
}
fcitx-qimpanel-fcitx-qimpanel-0.1.5/kimpanelagent.h 0000664 0000000 0000000 00000011215 12301005766 0022345 0 ustar 00root root 0000000 0000000 /***************************************************************************
* Copyright (C) 2009 by Wang Hoi *
* Copyright (C) 2011 by CSSlayer *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
#ifndef KIMPANEL_AGENT_H
#define KIMPANEL_AGENT_H
#include "kimpanelagenttype.h"
// Qt
#include
#include
#include
class QDBusServiceWatcher;
class Impanel2Adaptor;
class ImpanelAdaptor;
class PanelAgent: public QObject, protected QDBusContext
{
Q_OBJECT
public:
PanelAgent(QObject *parent);
virtual ~PanelAgent();
void configure();
void created();
void exit();
void restart();
void reloadConfig();
void selectCandidate(int idx);
void lookupTablePageUp();
void lookupTablePageDown();
void movePreeditCaret(int pos);
void triggerProperty(const QString& key);
public: // PROPERTIES
public Q_SLOTS: // METHODS
void UpdateLookupTable(const QStringList &labels,
const QStringList &candis,
const QStringList &attrlists,
bool has_prev, bool has_next);
void UpdatePreeditText(const QString &text, const QString &attr);
void UpdateAux(const QString &text, const QString &attr);
void UpdateScreen(int screen_id);
void UpdateProperty(const QString &prop);
void RegisterProperties(const QStringList &props);
void ExecDialog(const QString &prop);
void ExecMenu(const QStringList &entries);
void SetSpotRect(int x, int y, int w, int h);
void SetLookupTable(const QStringList &labels,
const QStringList &candis,
const QStringList &attrlists, //layout参数:用来覆盖是否要强制竖排/横排
bool hasPrev, bool hasNext, int cursor, int layout);
void serviceUnregistered(const QString& service);
Q_SIGNALS:
// signals that from kimpanel
void Configure();
void MovePreeditCaret(int position);
void SelectCandidate(int index);
void LookupTablePageUp();
void LookupTablePageDown();
void TriggerProperty(const QString &key);
void PanelCreated();
void PanelCreated2();
void Exit();
void Restart();
void ReloadConfig();
// signals to inform kimpanel
void enable(bool to_enable);
void updatePreeditCaret(int pos);
void updatePreeditText(const QString &text, const QList &attr);
void updateAux(const QString &text, const QList &attr);
void updateProperty(const KimpanelProperty &prop);
void updateLookupTable(const KimpanelLookupTable &lookup_table);
void updateLookupTableFull(const KimpanelLookupTable& lookup_table, int cursor, int layout);
void updateSpotLocation(int x, int y);
void updateSpotRect(int x, int y, int w, int h);
void registerProperties(const QList &props);
void execDialog(const KimpanelProperty &prop);
void execMenu(const QList &prop_list);
void showPreedit(bool to_show);
void showAux(bool to_show);
void showLookupTable(bool to_show);
void updateLookupTableCursor(int pos);
private:
bool m_show_aux;
bool m_show_preedit;
bool m_show_lookup_table;
int m_spot_x;
int m_spot_y;
QString m_currentService;
QStringList cached_props;
ImpanelAdaptor* adaptor;
Impanel2Adaptor* adaptor2;
QDBusServiceWatcher* watcher;
};
#endif // KIMPANEL_AGENT_H
fcitx-qimpanel-fcitx-qimpanel-0.1.5/kimpanelagenttype.h 0000664 0000000 0000000 00000005775 12301005766 0023265 0 ustar 00root root 0000000 0000000 /***************************************************************************
* Copyright (C) 2009 by Wang Hoi *
* Copyright (C) 2011 by CSSlayer *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
#ifndef KIMPANEL_AGENTTYPE_H
#define KIMPANEL_AGENTTYPE_H
// Qt
#include
#include
#include
struct TextAttribute {
enum Type {
None,
Decorate,
Foreground,
Background
};
Type type;
int start;
int length;
int value;
};
struct KimpanelProperty {
enum State {
None = 0,
Active = 1,
Visible = (1 << 1)
};
Q_DECLARE_FLAGS(States, State)
KimpanelProperty() { }
KimpanelProperty(QString key, QString label, QString icon, QString tip, int state, QString menu) {
this->key = key;
this->label = label;
this->tip = tip;
this->icon = icon;
this->state = (State) state;
this->menu = menu;
}
QString key;
QString label;
QString icon;
QString tip;
States state;
QString menu;
QVariantMap toMap() const {
QVariantMap map;
map["key"] = key;
map["label"] = label;
map["icon"] = icon;
map["tip"] = tip;
map["state"] = (int) state;
map["menu"] = menu;
return map;
}
};
Q_DECLARE_OPERATORS_FOR_FLAGS(KimpanelProperty::States)
struct KimpanelLookupTable {
struct Entry {
QString label; //存放标号字符串,比如“1.”,“2.”,“3.”,“4.”,“5.”
QString text; //存放候选词字符串,比如“啊”,“阿”,“吖”,“呵”,“腌”
QList attr;
};
QList entries;
bool has_prev;
bool has_next;
};
#endif // KIMPANEL_AGENTTYPE_H
fcitx-qimpanel-fcitx-qimpanel-0.1.5/main.cpp 0000664 0000000 0000000 00000010633 12301005766 0021010 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd.
*
* Authors:
* lenky gao lenky0401@gmail.com/gaoqunkai@ubuntukylin.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "main.h"
#include "main_controller.h"
#define BUFF_SIZE (512)
char filePath[BUFF_SIZE] = {0};
#define LOCKFILE "/tmp/fcitx-qimpanel:%d.pid"
#define LOCKMODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)
int isRunning()
{
char buf[16];
struct flock fl;
snprintf(filePath, BUFF_SIZE, LOCKFILE, fcitx_utils_get_display_number());
int fd = open(filePath, O_RDWR|O_CREAT, LOCKMODE);
if (fd < 0) {
printf("Can not open %s: %s.\n", filePath, strerror(errno));
return -1;
}
fl.l_type = F_WRLCK;
fl.l_start = 0;
fl.l_whence = SEEK_SET;
fl.l_len = 0;
if (fcntl(fd, F_SETLK, &fl) < 0) {
printf("Can not lock %s: %s.\n", filePath, strerror(errno));
return -1;
}
ftruncate(fd, 0);
sprintf(buf, "%d\n", getpid());
write(fd, buf, strlen(buf));
return 0;
}
char* getQimpanelSharePath(const char * const fileName)
{
strcpy(filePath, "/usr/share/fcitx-qimpanel/");
strcpy(filePath + strlen("/usr/share/fcitx-qimpanel/"), fileName);
printf("%s\n", filePath);
return filePath;
}
char* getQimpanelBinPath(const char * const fileName)
{
strcpy(filePath, "/usr/bin/");
strcpy(filePath + strlen("/usr/bin/"), fileName);
printf("%s\n", filePath);
return filePath;
}
//void sigRoutine(int sigNum) {
// switch (sigNum) {
// case 1:
// char a = '1';
// write(MainController::self()->mSigFd[0], &a, sizeof(a));
// qDebug()<<"write(MainController::self()->mSigFd[0], &a, sizeof(a))";
// break;
// }
// qDebug() << "Get a signal" << sigNum;
// return;
//}
#define FCITX_DBUS_SERVICE "org.fcitx.Fcitx"
int fcitxIsNotRunning()
{
char* servicename = NULL;
asprintf(&servicename, "%s-%d", FCITX_DBUS_SERVICE,
fcitx_utils_get_display_number());
QDBusConnection conn = QDBusConnection::sessionBus();
if (!conn.isConnected())
return -1;
// ?? Always return false...
//QDBusReply reply = conn.interface()->call("NameHasOwner", servicename);
QDBusReply reply = conn.interface()->call("GetNameOwner", servicename);
qDebug() << "reply.value():" << reply.value();
return reply.value() == "";
}
int main(int argc, char** argv)
{
// signal(SIGHUP, SIG_IGN);
fcitx_utils_init_as_daemon();//?
if (isRunning()) {
exit(1);
}
QTextCodec::setCodecForTr(QTextCodec::codecForLocale());
QTextCodec::setCodecForCStrings(QTextCodec::codecForLocale());
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
QTranslator translator;
if (translator.load(QString(getQimpanelSharePath("zh_CN.qm"))) == false)
qDebug() << "load qm error.";
QApplication *app = new QApplication(argc, argv);
app->installTranslator(&translator);
app->setApplicationName("fcitx-qimpanel");
int waittTick = 0;
int waitTime = 10;
while (waittTick ++ < waitTime && fcitxIsNotRunning()) {
qDebug() << "Fcitx not running.";
sleep(1);
}
qDebug() << "fcitxIsNotRunning():" << fcitxIsNotRunning();
if (waittTick >= waitTime)
return -1;
MainController *ctrl = MainController::self();
// signal(SIGHUP, sigRoutine);
app->setQuitOnLastWindowClosed(false);
app->exec();
delete ctrl;
delete app;
return 0;
}
fcitx-qimpanel-fcitx-qimpanel-0.1.5/main.h 0000664 0000000 0000000 00000001637 12301005766 0020461 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd.
*
* Authors:
* lenky gao lenky0401@gmail.com/gaoqunkai@ubuntukylin.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#ifndef __MAIN_H__
#define __MAIN_H__
char* getQimpanelSharePath(const char * const fileName);
char* getQimpanelBinPath(const char * const fileName);
#endif // __MAIN_H__
fcitx-qimpanel-fcitx-qimpanel-0.1.5/main_controller.cpp 0000664 0000000 0000000 00000023000 12301005766 0023243 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd.
*
* Authors:
* lenky gao lenky0401@gmail.com/gaoqunkai@ubuntukylin.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "main_model.h"
#include "candidate_word.h"
#include "main_controller.h"
#include "kimpanelagent.h"
#include "toplevel.h"
MainController* MainController::mSelf = 0;
MainController* MainController::self()
{
if (!mSelf) {
mSelf = new MainController;
mSelf->init();
}
return mSelf;
}
MainController::MainController()
{
}
void MainController::loadCfg()
{
QSettings *settings = new QSettings("fcitx-qimpanel", "main");
settings->setIniCodec("UTF-8");
settings->beginGroup("base");
mIsHorizontal = !settings->value("VerticalList", false).toBool();
qDebug() << "mIsHorizontal:" << mIsHorizontal;
mSkinName = settings->value("CurtSkinType", "ubuntukylin-dark1").toString();
qDebug() << "mSkinName:" << mSkinName;
settings->endGroup();
delete settings;
}
void MainController::init()
{
loadCfg();
qDebug()<<"MainController::init()";
qmlRegisterType();
mTopLevel = new TopLevel;
mView = new QDeclarativeView;
mModel = MainModel::self();
mModel->setIsHorizontal(mIsHorizontal);
mSkinBase = new SkinBase;
mTopLevel->setCenterWidget(mView);
mView->setContentsMargins(0, 0, 0, 0);
mView->setResizeMode(QDeclarativeView::SizeViewToRootObject);
mView->setResizeAnchor(QGraphicsView::AnchorViewCenter);
mView->viewport()->setAutoFillBackground(false);
mView->rootContext()->setContextProperty("mainCtrl", this);
mView->rootContext()->setContextProperty("mainModel", mModel);
mView->rootContext()->setContextProperty("mainSkin", mSkinBase);
mView->rootContext()->setContextProperty("mainWidget", mTopLevel);
mView->setSource(QUrl("qrc:/qml/main.qml"));
mAgent = new PanelAgent(this);
mSystemTray = new QSystemTrayIcon(QIcon::fromTheme("fcitx"), this);
mTrayMenu = new SystemTrayMenu(mAgent);
mAgent->created();
mTrayMenu->init();
mSystemTray->setContextMenu(mTrayMenu);
mSystemTray->setToolTip("fcitx-qimpanel");
mSystemTray->show();
QObject::connect(mAgent,
SIGNAL(updateProperty(KimpanelProperty)), this,
SLOT(updateProperty(KimpanelProperty)));
QObject::connect(mAgent,
SIGNAL(updatePreeditText(QString, QList)),
this, SLOT(updatePreeditText(QString, QList)));
QObject::connect(mAgent,
SIGNAL(updateLookupTable(KimpanelLookupTable)),
this, SLOT(updateLookupTable(KimpanelLookupTable)));
QObject::connect(mAgent,
SIGNAL(updateLookupTableFull(KimpanelLookupTable, int, int)),
this, SLOT(updateLookupTableFull(KimpanelLookupTable, int, int)));
QObject::connect(mAgent,
SIGNAL(updateSpotLocation(int, int)),
this, SLOT(updateSpotLocation(int, int)));
QObject::connect(mAgent,
SIGNAL(updateSpotRect(int, int, int, int)),
this, SLOT(updateSpotRect(int, int, int, int)));
QObject::connect(mAgent,
SIGNAL(showPreedit(bool)),
this, SLOT(showPreedit(bool)));
QObject::connect(mAgent,
SIGNAL(showAux(bool)),
this, SLOT(showAux(bool)));
QObject::connect(mAgent,
SIGNAL(updateAux(QString, QList)),
this, SLOT(updateAux(QString, QList)));
QObject::connect(mAgent,
SIGNAL(showLookupTable(bool)),
this, SLOT(showLookupTable(bool)));
QObject::connect(mAgent,
SIGNAL(updateLookupTableCursor(int)),
this, SLOT(updateLookupTableCursor(int)));
QObject::connect(mAgent,
SIGNAL(updatePreeditCaret(int)),
this, SLOT(updatePreeditCaret(int)));
// socketpair(AF_UNIX, SOCK_STREAM, 0, mSigFd);
// mSocketNotifier = new QSocketNotifier(mSigFd[1], QSocketNotifier::Read, this);
// connect(mSocketNotifier, SIGNAL(activated(int)), this, SLOT(handleSig()));
creatDBusService();//创建DBus服务
}
MainController::~MainController()
{
if (mModel)
delete mModel;
if (mAgent)
delete mAgent;
if (mView)
delete mView;
if (mTopLevel)
delete mTopLevel;
if (mSystemTray)
delete mSystemTray;
if (mTrayMenu)
delete mTrayMenu;
}
//void MainController::handleSig()
//{
// mSocketNotifier->setEnabled(false);
// char tmp;
// read(mSigFd[1], &tmp, sizeof(tmp));
// qDebug() << "handleSig";
// mSocketNotifier->setEnabled(true);
// mTrayMenu->restart();
//}
SystemTrayMenu* MainController::getTrayMenu()
{
return mTrayMenu;
}
void MainController::setSkinBase(SkinBase *skinBase, int skinType)
{
if (mSkinBase != skinBase)
delete mSkinBase;
mSkinBase = skinBase;
mView->rootContext()->setContextProperty("mainSkin", mSkinBase);
switch (skinType) {
case SOGOU:
qDebug() << "SkinType is sogou";
mView->setSource(QUrl("qrc:/qml/sogou.qml"));
break;
case FCITX:
default:
qDebug() << "SkinType is default";
mView->setSource(QUrl("qrc:/qml/main.qml"));
}
}
QString MainController::getSkinName()
{
return mSkinName;
}
void MainController::setSkinName(QString skinName)
{
mSkinName = skinName;
QSettings *settings = new QSettings("fcitx-qimpanel", "main");
settings->setIniCodec("UTF-8");
settings->beginGroup("base");
settings->setValue("CurtSkinType", skinName);
settings->endGroup();
delete settings;
}
void MainController::updateProperty(const KimpanelProperty &prop)
{
if (tr("No input window") == prop.label) {
QIcon icon = QIcon::fromTheme("fcitx");
mSystemTray->setIcon(icon);
return;
}
QIcon icon = QIcon::fromTheme(prop.icon, QIcon::fromTheme("fcitx-kbd"));
mSystemTray->setIcon(icon);
mModel->resetData();
}
void MainController::updatePreeditText(const QString inputString,
QList attributes)
{
mModel->setInputString(inputString);
}
void MainController::updateLookupTable(const KimpanelLookupTable &lookup_table)
{
mModel->setCandidateWords(lookup_table);
}
void MainController::updateLookupTableFull(const KimpanelLookupTable &lookup_table,
int cursor, int layout)
{
bool isHorizontal;
switch (layout) {
case CLH_Vertical:
isHorizontal = false;
break;
case CLH_Horizontal:
isHorizontal = true;
break;
default:
isHorizontal = mIsHorizontal;
break;
}
if (isHorizontal != mModel->isHorizontal()) {
mModel->setIsHorizontal(isHorizontal);
mSkinBase->reloadSkin();
}
mModel->setHighLight(cursor);
updateLookupTable(lookup_table);
}
void MainController::updateSpotLocation(int x, int y)
{
}
void MainController::updateSpotRect(int x, int y, int w, int h)
{
mTopLevel->setSpotRect(QRect(QPoint(x, y), QSize(w, h)));
}
void MainController::showPreedit(bool to_show)
{
mModel->setShowPreedit(to_show);
mTopLevel->setTopLevelVisible(mModel->showTips(), mModel->showPreedit(), mModel->showLookupTable());
}
void MainController::showAux(bool to_show)
{
mModel->setShowTips(to_show);
mTopLevel->setTopLevelVisible(mModel->showTips(), mModel->showPreedit(), mModel->showLookupTable());
}
void MainController::updateAux(const QString &text, const QList &attr)
{
mModel->setTipsString(text);
}
void MainController::showLookupTable(bool to_show)
{
mModel->setShowLookupTable(to_show);
mTopLevel->setTopLevelVisible(mModel->showTips(), mModel->showPreedit(), mModel->showLookupTable());
}
void MainController::updateLookupTableCursor(int pos)
{
// qDebug() << QString("updateLookupTableCursor: %1").arg(pos);
}
void MainController::getPrevPage()
{
mAgent->lookupTablePageUp();
}
void MainController::getNextPage()
{
mAgent->lookupTablePageDown();
}
void MainController::selectCandidate(int index)
{
mAgent->selectCandidate(index);
}
void MainController::updatePreeditCaret(int pos)
{
mModel->setInputStringCursorPos(pos);
}
void MainController::creatDBusService()
{
// 用于建立到session bus的连接
QDBusConnection bus = QDBusConnection::sessionBus();
// 在session bus上注册名为"com.fcitx_qimpanel.hotel"的service
if (!bus.registerService("com.fcitx_qimpanel.hotel")) { //注意命名规则-和_
qDebug() << bus.lastError().message();
exit(1);
}
// "QDBusConnection::ExportAllSlots"表示把类Hotel的所有Slot都导出为这个Object的method
bus.registerObject("/", mSelf ,QDBusConnection::ExportAllSlots);//可以优化只导出需要的
}
void MainController::qtDbusSot_restartQimpanel()
{
mTrayMenu->restart();
qDebug()<< "MainController::qtDbusSot_restartQimpanel()";
}
fcitx-qimpanel-fcitx-qimpanel-0.1.5/main_controller.h 0000664 0000000 0000000 00000006042 12301005766 0022717 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd.
*
* Authors:
* lenky gao lenky0401@gmail.com/gaoqunkai@ubuntukylin.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#ifndef __MAIN_CONTROLLER_H__
#define __MAIN_CONTROLLER_H__
#include
#include
#include
#include
#include
#include
#include
#include "main_model.h"
#include "system_tray_menu.h"
#include "kimpanelagent.h"
#include "toplevel.h"
#include "skin/skinbase.h"
#include "skin/skinmenu.h"
//必须与FcitxCandidateLayoutHint的定义一致
enum CandidateLayout {
CLH_NotSet,
CLH_Vertical,
CLH_Horizontal
};
class MainController : public QObject
{
Q_OBJECT
// 定义Interface名称为"com.test.hotel"
Q_CLASSINFO("D-Bus Interface", "com.fcitx_qimpanel.hotel")
public:
static MainController* self();
virtual ~MainController();
void init();
void loadCfg();
private:
explicit MainController();
static MainController *mSelf;
private:
TopLevel *mTopLevel;
MainModel *mModel;
PanelAgent *mAgent;
SkinBase *mSkinBase;
QDeclarativeView *mView;
QUrl mUrl;
QTimer *mTimer;
QSystemTrayIcon *mSystemTray;
SystemTrayMenu *mTrayMenu;
bool mIsHorizontal;
QString mSkinName;
private:
QSocketNotifier *mSocketNotifier;
private slots:
// void handleSig();
public:
int mSigFd[2];
public:
void setSkinBase(SkinBase *skinBase, int skinType);
QString getSkinName();
void setSkinName(QString skinName);
SystemTrayMenu* getTrayMenu();
void creatDBusService();
public slots:
void updateProperty(const KimpanelProperty &prop);
void updatePreeditText(const QString inputString,
QList attributes);
void updateLookupTable(const KimpanelLookupTable &lookup_table);
void updateLookupTableFull(const KimpanelLookupTable &lookup_table,
int cursor, int layout);
void updateSpotLocation(int x, int y);
void updateSpotRect(int x, int y, int w, int h);
void showPreedit(bool to_show);
void showAux(bool to_show);
void updateAux(const QString &text, const QList &attr);
void showLookupTable(bool to_show);
void updateLookupTableCursor(int pos);
void updatePreeditCaret(int pos);
void qtDbusSot_restartQimpanel();
public:
Q_INVOKABLE void getPrevPage();
Q_INVOKABLE void getNextPage();
Q_INVOKABLE void selectCandidate(int index);
};
#endif // __MAIN_CONTROLLER_H__
fcitx-qimpanel-fcitx-qimpanel-0.1.5/main_model.cpp 0000664 0000000 0000000 00000011270 12301005766 0022166 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd.
*
* Authors:
* lenky gao lenky0401@gmail.com/gaoqunkai@ubuntukylin.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include
#include "main_model.h"
#include "candidate_word.h"
MainModel* MainModel::mSelf = 0;
MainModel* MainModel::self()
{
if (!mSelf) {
mSelf = new MainModel;
}
return mSelf;
}
MainModel::MainModel()
{
}
MainModel::~MainModel()
{
}
void MainModel::resetData() {
KimpanelLookupTable lookup_table;
setCandidateWords(lookup_table);
setInputString("");
setHasPrev(false);
setHasNext(false);
setInputStringCursorPos(-1);
setHighLight(-1);
//这个不属于焦点切换时需要重置的值
//setIsHorizontal(true);
setShowTips(false);
setShowPreedit(false);
setShowLookupTable(false);
}
void MainModel::setInputString(const QString inputString) {
mInputString = inputString;
emit inputStringChanged();
}
QString MainModel::inputString() const {
return mInputString;
}
void MainModel::setTipsString(const QString tipsString) {
mTipsString = tipsString;
emit tipsStringChanged();
emit mainWindowSizeChanged();
}
QString MainModel::tipsString() const {
return mTipsString;
}
void MainModel::setInputStringCursorPos(int pos) {
setInputString(mInputString.insert(pos, QString("|")));
}
void candidateWordsPropAppend(QDeclarativeListProperty* prop, CandidateWord* value)
{
Q_UNUSED(prop);
Q_UNUSED(value);
return; //Append not supported
}
int candidateWordsPropCount(QDeclarativeListProperty* prop)
{
return static_cast*>(prop->data)->count();
}
CandidateWord* candidateWordsPropAt(QDeclarativeListProperty* prop, int index)
{
return static_cast*>(prop->data)->at(index);
}
void MainModel::setCandidateWords(const KimpanelLookupTable &lookup_table) {
CandidateWord *candidate;
QList::iterator iter;
QList entries = lookup_table.entries;
qDeleteAll(mCandidateWords);
mCandidateWords.clear();
for (iter = entries.begin(); iter != entries.end(); ++ iter) {
if ((candidate = new (std::nothrow)CandidateWord) == NULL)
break;
candidate->setCddLabel(iter->label);
candidate->setCddText(iter->text);
mCandidateWords.append(candidate);
}
setHasPrev(lookup_table.has_prev);
setHasNext(lookup_table.has_next);
emit candidateWordsChanged();
emit mainWindowSizeChanged();
}
QDeclarativeListProperty MainModel::candidateWords() {
return QDeclarativeListProperty(this, &mCandidateWords, &candidateWordsPropAppend,
&candidateWordsPropCount, &candidateWordsPropAt, 0);
}
void MainModel::setHasPrev(const bool hasPrev) {
mHasPrev = hasPrev;
emit hasPrevChanged();
}
bool MainModel::hasPrev() const {
return mHasPrev;
}
void MainModel::setHasNext(const bool hasNext) {
mHasNext = hasNext;
emit hasNextChanged();
}
bool MainModel::hasNext() const {
return mHasNext;
}
void MainModel::setHighLight(const int highLight) {
mHighLight = highLight;
emit highLightChanged();
}
int MainModel::highLight() const {
return mHighLight;
}
void MainModel::setIsHorizontal(const bool isHorizontal) {
mIsHorizontal = isHorizontal;
emit isHorizontalChanged();
}
bool MainModel::isHorizontal() const {
return mIsHorizontal;
}
void MainModel::setShowTips(const bool showTips) {
mShowTips = showTips;
emit showTipsChanged();
emit mainWindowSizeChanged();
}
bool MainModel::showTips() const {
return mShowTips;
}
void MainModel::setShowPreedit(const bool showPreedit) {
mShowPreedit = showPreedit;
emit showPreeditChanged();
emit mainWindowSizeChanged();
}
bool MainModel::showPreedit() const {
return mShowPreedit;
}
void MainModel::setShowLookupTable(const bool showLookupTable) {
mShowLookupTable = showLookupTable;
emit showLookupTableChanged();
emit mainWindowSizeChanged();
}
bool MainModel::showLookupTable() const {
return mShowLookupTable;
}
fcitx-qimpanel-fcitx-qimpanel-0.1.5/main_model.h 0000664 0000000 0000000 00000007214 12301005766 0021636 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd.
*
* Authors:
* lenky gao lenky0401@gmail.com/gaoqunkai@ubuntukylin.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#ifndef __MAIN_MODEL_H__
#define __MAIN_MODEL_H__
#include
#include
#include
#include "candidate_word.h"
#include "kimpanelagenttype.h"
class MainModel : public QObject
{
Q_OBJECT
Q_PROPERTY(QString inputString READ inputString WRITE setInputString
NOTIFY inputStringChanged)
Q_PROPERTY(QString tipsString READ tipsString WRITE setTipsString
NOTIFY tipsStringChanged)
Q_PROPERTY(QDeclarativeListProperty candidateWords
READ candidateWords NOTIFY candidateWordsChanged)
Q_PROPERTY(bool hasPrev READ hasPrev WRITE setHasPrev
NOTIFY hasPrevChanged)
Q_PROPERTY(bool hasNext READ hasNext WRITE setHasNext
NOTIFY hasNextChanged)
Q_PROPERTY(int highLight READ highLight WRITE setHighLight
NOTIFY highLightChanged)
Q_PROPERTY(bool isHorizontal READ isHorizontal WRITE setIsHorizontal
NOTIFY isHorizontalChanged)
Q_PROPERTY(bool showTips READ showTips WRITE setShowTips
NOTIFY showTipsChanged)
Q_PROPERTY(bool showPreedit READ showPreedit WRITE setShowPreedit
NOTIFY showPreeditChanged)
Q_PROPERTY(bool showLookupTable READ showLookupTable WRITE setShowLookupTable
NOTIFY showLookupTableChanged)
public:
static MainModel* self();
virtual ~MainModel();
void init();
private:
explicit MainModel();
static MainModel *mSelf;
public:
void resetData();
void setInputStringCursorPos(int pos);
public:
void setInputString(const QString inputString);
QString inputString() const;
void setTipsString(const QString tipsString);
QString tipsString() const;
void setCandidateWords(const KimpanelLookupTable &lookup_table);
QDeclarativeListProperty candidateWords();
void setHasPrev(const bool hasPrev);
bool hasPrev() const;
void setHasNext(const bool hasNext);
bool hasNext() const;
void setHighLight(const int highLight);
int highLight() const;
void setIsHorizontal(const bool isHorizontal);
bool isHorizontal() const;
void setShowTips(const bool showTips);
bool showTips() const;
void setShowPreedit(const bool showPreedit);
bool showPreedit() const;
void setShowLookupTable(const bool showLookupTable);
bool showLookupTable() const;
signals:
void inputStringChanged();
void tipsStringChanged();
void candidateWordsChanged();
void hasPrevChanged();
void hasNextChanged();
void highLightChanged();
void isHorizontalChanged();
void showTipsChanged();
void showPreeditChanged();
void showLookupTableChanged();
void mainWindowSizeChanged();
private:
QString mInputString;
QString mTipsString;
QList mCandidateWords;
bool mHasPrev;
bool mHasNext;
int mHighLight;
bool mIsHorizontal;
bool mShowTips;
bool mShowPreedit;
bool mShowLookupTable;
};
#endif // __MAIN_MODEL_H__
fcitx-qimpanel-fcitx-qimpanel-0.1.5/my_action.cpp 0000664 0000000 0000000 00000002725 12301005766 0022051 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd.
*
* Authors:
* lenky gao lenky0401@gmail.com/gaoqunkai@ubuntukylin.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include "my_action.h"
MyAction::MyAction(const QString &text, QObject *parent) : QAction(text, parent)
{
}
MyAction::MyAction(const QIcon &icon, const QString &text, QObject *parent)
: QAction(icon, text, parent)
{
}
MyAction::~MyAction()
{
}
void MyAction::setProp(const KimpanelProperty &prop)
{
this->mProp = prop;
}
const KimpanelProperty& MyAction::getProp()
{
return this->mProp;
}
void MyAction::setSkinPath(const QString skinPath)
{
this->mSkinPath = skinPath;
}
const QString MyAction::getSkinPath()
{
return this->mSkinPath;
}
void MyAction::setSkinClass(const SkinClass skinClass)
{
this->mSkinClass = skinClass;
}
const SkinClass MyAction::getSkinClass()
{
return this->mSkinClass;
}
fcitx-qimpanel-fcitx-qimpanel-0.1.5/my_action.h 0000664 0000000 0000000 00000002725 12301005766 0021516 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd.
*
* Authors:
* lenky gao lenky0401@gmail.com/gaoqunkai@ubuntukylin.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#ifndef __MY_ACTION_H__
#define __MY_ACTION_H__
#include
#include "kimpanelagent.h"
typedef enum SkinClass
{
FCITX,
SOGOU
} SkinClass;
class MyAction : public QAction
{
Q_OBJECT
public:
MyAction(const QString &text, QObject *parent);
MyAction(const QIcon &icon, const QString &text, QObject *parent);
virtual ~MyAction();
public:
void setProp(const KimpanelProperty &prop);
const KimpanelProperty& getProp();
void setSkinPath(const QString skinPath);
const QString getSkinPath();
void setSkinClass(const SkinClass skinClass);
const SkinClass getSkinClass();
private:
KimpanelProperty mProp;
QString mSkinPath;
SkinClass mSkinClass;
};
#endif // __MY_ACTION_H__
fcitx-qimpanel-fcitx-qimpanel-0.1.5/org.kde.impanel.xml 0000664 0000000 0000000 00000003600 12301005766 0023053 0 ustar 00root root 0000000 0000000
fcitx-qimpanel-fcitx-qimpanel-0.1.5/po/ 0000775 0000000 0000000 00000000000 12301005766 0017773 5 ustar 00root root 0000000 0000000 fcitx-qimpanel-fcitx-qimpanel-0.1.5/po/ReadMe.txt 0000664 0000000 0000000 00000000477 12301005766 0021701 0 ustar 00root root 0000000 0000000 ts文件按如下方式生成:
lenky@robert-T430S:~/lenky/work/fcitx/fcitx-qimpanel$ lupdate . -ts po/zh_CN.ts
Scanning directory '.'...
Updating 'po/zh_CN.ts'...
Found 6 source text(s) (0 new and 6 already existing)
用gedit打开对应ts文件做翻译,再执行make,编译工程fcitx-qimpanel,OK。
fcitx-qimpanel-fcitx-qimpanel-0.1.5/po/zh_CN.ts 0000664 0000000 0000000 00000011374 12301005766 0021352 0 ustar 00root root 0000000 0000000
MainController
No input window
无输入窗口
SystemTrayMenu
Virtual Keyboard
虚拟键盘
Input Method
输入法
Skin
皮肤
ConfigureSync
配置同步
No input window
无输入窗口
Online &Help!
在线帮助
ConfigureIM
配置当前输入法
ConfigureUp
同步上传
ConfigureDwon
同步下载
Warning
警告!
[Ubuntu Kylin Sync] Synchronize directories have been deleted?!
[Ubuntu Kylin Sync]该同步目录已经被删除?请自行创建。
Please log in kuaipan!
请登录金山快盘!
No configure can be synchronized!
云端没有存储配置文件,无法同步到本地!
Please install fcitx-qimpanel-configtool!
请安装配置工具:fcitx-qimpanel-configtool
Configure
配置
ConfigureIMPanel
配置面板和皮肤
Restart
重新启动
Exit
退出
fcitx-qimpanel-fcitx-qimpanel-0.1.5/qml.qrc 0000664 0000000 0000000 00000000176 12301005766 0020661 0 ustar 00root root 0000000 0000000
qml/main.qml
qml/sogou.qml
fcitx-qimpanel-fcitx-qimpanel-0.1.5/qml/ 0000775 0000000 0000000 00000000000 12301005766 0020146 5 ustar 00root root 0000000 0000000 fcitx-qimpanel-fcitx-qimpanel-0.1.5/qml/main.qml 0000664 0000000 0000000 00000026253 12301005766 0021615 0 ustar 00root root 0000000 0000000 import QtQuick 1.1
Rectangle {
id: mainWindow
objectName: "mainWindowQml"
visible : mainModel.showTips || mainModel.showPreedit || mainModel.showLookupTable
border.color: "#0080FF"
border.width: mainSkin.inputBackImg ? 0 : 1
color: "transparent"
BorderImage {
visible : mainModel.showPreedit || mainModel.showLookupTable
anchors.fill: parent
border {
left: mainSkin.marginLeft;
top: mainSkin.marginTop;
right: mainSkin.marginRight;
bottom: mainSkin.marginBottom;
}
horizontalTileMode: mainSkin.horizontalTileMode
verticalTileMode: mainSkin.verticalTileMode
source: mainSkin.inputBackImg
}
BorderImage {
visible : mainModel.showTips && !mainModel.showPreedit && !mainModel.showLookupTable
anchors.fill: parent
border {
left: 10;
top: 10;
right: 10;
bottom: 10;
}
horizontalTileMode: BorderImage.Stretch
verticalTileMode: BorderImage.Stretch
source: mainSkin.tipsImg
}
Text {
x: 5
y: 3
id: "tipsString"
visible : mainModel.showTips
text: mainModel.tipsString
font.pointSize : mainSkin.fontSize
color: mainSkin.inputColor
}
Text {
id: "inputString"
visible : mainModel.showPreedit
text: mainModel.inputString
font.pointSize : mainSkin.fontSize
color: mainSkin.inputColor
}
MouseArea {
anchors.fill: parent
property variant previousPosition
onPressed: {
previousPosition = Qt.point(mouseX, mouseY)
}
onPositionChanged: {
if (pressedButtons == Qt.LeftButton) {
var dx = mouseX - previousPosition.x
var dy = mouseY - previousPosition.y
mainWidget.pos = Qt.point(mainWidget.pos.x + dx,
mainWidget.pos.y + dy)
}
}
}
Row {
id: "horizontal"
visible : mainModel.showLookupTable && mainModel.isHorizontal
Repeater {
model: mainModel.candidateWords
Text {
id: "candidateWord"
text: "" + cddLabel + "" +
"" + cddText + "" + " "
font.pointSize : mainSkin.candFontSize != 0 ? mainSkin.candFontSize : mainSkin.fontSize
MouseArea {
anchors.fill: parent
hoverEnabled: true
onEntered: {
parent.opacity = 0.6
}
onExited: {
parent.opacity = 1
}
onClicked: {
mainCtrl.selectCandidate(index)
}
}
}
}
}
Column {
id: "vertical"
visible : mainModel.showLookupTable && !mainModel.isHorizontal
Repeater {
model: mainModel.candidateWords
Text {
id: "candidateWord"
text: "" + cddLabel + "" +
"" + cddText + "" + " "
font.pointSize : mainSkin.candFontSize != 0 ? mainSkin.candFontSize : mainSkin.fontSize
MouseArea {
anchors.fill: parent
hoverEnabled: true
onEntered: {
parent.opacity = 0.6
}
onExited: {
parent.opacity = 1
}
onClicked: {
mainCtrl.selectCandidate(index)
}
}
}
}
}
Image {
id: "prev_page"
visible : mainModel.hasPrev || mainModel.hasNext
source: mainSkin.backArrowImg
opacity: mainModel.hasPrev ? 1 : 0.5
MouseArea {
anchors.fill: parent
onClicked: {
if (mainModel.hasPrev)
mainCtrl.getPrevPage()
}
}
}
Image {
id: "next_page"
visible : mainModel.hasPrev || mainModel.hasNext
source: mainSkin.forwardArrowImg
opacity: mainModel.hasNext ? 1 : 0.5
MouseArea {
anchors.fill: parent
onClicked: {
if (mainModel.hasNext)
mainCtrl.getNextPage()
}
}
}
function clearAllAnchors(obj) {
obj.anchors.left = undefined;
obj.anchors.leftMargin = 0;
obj.anchors.top = undefined;
obj.anchors.topMargin = 0;
obj.anchors.right = undefined;
obj.anchors.rightMargin = 0;
obj.anchors.bottom = undefined;
obj.anchors.bottomMargin = 0;
}
function setObjAbsolutePosition(bindObj, x, y) {
if (x > 0) {
bindObj.anchors.left = mainWindow.left;
bindObj.anchors.leftMargin = x;
} else if (x < 0) {
bindObj.anchors.right = mainWindow.right;
bindObj.anchors.rightMargin = -x;
}
if (y > 0) {
bindObj.anchors.top = mainWindow.top;
bindObj.anchors.topMargin = y;
} else if (y < 0) {
bindObj.anchors.bottom = mainWindow.bottom;
bindObj.anchors.bottomMargin = -y;
}
}
Component.onCompleted: {
if (mainSkin.inputStringPosX == 0)
mainSkin.inputStringPosX = mainSkin.marginLeft;
if (mainSkin.inputStringPosY == 0)
mainSkin.inputStringPosY = mainSkin.marginTop;
clearAllAnchors(inputString);
setObjAbsolutePosition(inputString, mainSkin.inputStringPosX, mainSkin.inputStringPosY);
if (mainSkin.outputCandPosX == 0)
mainSkin.outputCandPosX = mainSkin.marginLeft;
if (mainSkin.outputCandPosY == 0)
mainSkin.outputCandPosY = inputString.height + mainSkin.marginTop;
clearAllAnchors(horizontal);
setObjAbsolutePosition(horizontal, mainSkin.outputCandPosX, mainSkin.outputCandPosY);
clearAllAnchors(vertical);
setObjAbsolutePosition(vertical, mainSkin.outputCandPosX, mainSkin.outputCandPosY);
if (mainSkin.backArrowPosX == 0)
mainSkin.backArrowPosX = - prev_page.width - next_page.width - 5 - 10;
if (mainSkin.backArrowPosY == 0)
mainSkin.backArrowPosY = mainSkin.inputStringPosY;
clearAllAnchors(prev_page);
setObjAbsolutePosition(prev_page, mainSkin.backArrowPosX, mainSkin.backArrowPosY);
if (mainSkin.forwardArrowPosX == 0)
mainSkin.forwardArrowPosX = - next_page.width - 10;
if (mainSkin.forwardArrowPosY == 0)
mainSkin.forwardArrowPosY = mainSkin.inputStringPosY;
clearAllAnchors(next_page);
setObjAbsolutePosition(next_page, mainSkin.forwardArrowPosX, mainSkin.forwardArrowPosY);
}
function max(x, y) { return x > y ? x : y; }
Connections {
target: mainModel
onMainWindowSizeChanged: {
var tmp;
var width, width1;
var height, height1;
if (mainModel.showTips && !mainModel.showPreedit && !mainModel.showLookupTable) {
mainWindow.width = tipsString.width + 10;
mainWindow.height = tipsString.height + 10;
return;
}
width = mainSkin.marginLeft;
width1 = 0;
height = mainSkin.marginTop;
height1 = 0;
if (mainModel.showTips) {
tmp = tipsString.x + tipsString.width;
width = max(width, tmp);
tmp = tipsString.y + tipsString.height;
height = max(height, tmp);
}
if (mainModel.showPreedit) {
if (mainSkin.inputStringPosX > 0) {
tmp = inputString.x + inputString.width;
width = max(width, tmp);
} else {
width1 = max(width1, -mainSkin.inputStringPosX);
}
if (mainSkin.inputStringPosY > 0) {
tmp = inputString.y + inputString.height;
height = max(height, tmp);
} else {
height1 = max(height1, -mainSkin.inputStringPosY);
}
}
if (mainModel.showLookupTable) {
if (mainSkin.outputCandPosX > 0) {
if (mainModel.isHorizontal)
tmp = horizontal.x + horizontal.width;
else
tmp = vertical.x + vertical.width;
width = max(width, tmp);
} else {
width1 = max(width1, -mainSkin.outputCandPosX);
}
if (mainSkin.outputCandPosY > 0) {
if (mainModel.isHorizontal)
tmp = horizontal.y + horizontal.height;
else
tmp = vertical.y + vertical.height;
height = max(height, tmp);
} else {
height1 = max(height1, -mainSkin.outputCandPosY);
}
}
if (mainModel.hasPrev || mainModel.hasNext) {
if (mainSkin.backArrowPosX > 0) {
tmp = prev_page.x + prev_page.width;
width = max(width, tmp);
} else {
width1 = max(width1, -mainSkin.backArrowPosX);
}
if (mainSkin.forwardArrowPosX > 0) {
tmp = next_page.x + next_page.width;
width = max(width, tmp);
} else {
width1 = max(width1, -mainSkin.forwardArrowPosX);
}
if (mainSkin.backArrowPosY > 0) {
tmp = prev_page.y + prev_page.height;
height = max(height, tmp);
} else {
height1 = max(height1, -mainSkin.backArrowPosY);
}
if (mainSkin.forwardArrowPosY > 0) {
tmp = next_page.y + next_page.height;
height = max(height, tmp);
} else {
height1 = max(height1, -mainSkin.forwardArrowPosY);
}
}
mainWindow.width = width + width1 + mainSkin.marginRight + mainSkin.adjustWidth;
mainWindow.height = height + height1 + mainSkin.marginBottom + mainSkin.adjustHeight;
}
}
}
fcitx-qimpanel-fcitx-qimpanel-0.1.5/qml/sogou.qml 0000664 0000000 0000000 00000021332 12301005766 0022016 0 ustar 00root root 0000000 0000000 import QtQuick 1.1
Rectangle {
id: mainWindow
objectName: "mainWindowQml"
visible : mainModel.showTips || mainModel.showPreedit || mainModel.showLookupTable
border.color: "#0080FF"
border.width: mainSkin.inputBackImg ? 0 : 1
color: "transparent"
BorderImage {
id: inputBackImg
visible : mainModel.showPreedit || mainModel.showLookupTable
anchors.fill: parent
anchors.left:parent.left
border {
left: mainSkin.marginLeft;
top: mainSkin.marginTop;
right: mainSkin.marginRight;
bottom: mainSkin.marginBottom;
}
horizontalTileMode: mainSkin.horizontalTileMode
verticalTileMode: mainSkin.verticalTileMode
source: mainSkin.inputBackImg
}
//custom0
Image {
id:custom0
source: mainSkin.customImg0
visible : mainModel.isHorizontal && (mainModel.showPreedit || mainModel.showLookupTable)
width: sourceSize.width; height: sourceSize.height
fillMode: Image.PreserveAspectFit
anchors.left: inputBackImg.left
}
//custom1
Image {
id:custom1
source: mainSkin.customImg1
visible : mainModel.isHorizontal && (mainModel.showPreedit || mainModel.showLookupTable)
width: sourceSize.width; height: sourceSize.height
fillMode: Image.PreserveAspectFit
anchors.right: parent.right
}
BorderImage {
visible : mainModel.showTips && !mainModel.showPreedit && !mainModel.showLookupTable
anchors.fill: parent
border {
left: 10;
top: 10;
right: 10;
bottom: 10;
}
horizontalTileMode: BorderImage.Stretch
verticalTileMode: BorderImage.Stretch
source: mainSkin.tipsImg
}
Text {
x: 5
y: 3
id: "tipsString"
visible : mainModel.showTips
text: mainModel.tipsString
font.pointSize : mainSkin.fontSize
color: mainSkin.inputColor
}
Text {
id: "inputString"
visible : mainModel.showPreedit
text: mainModel.inputString
font.pointSize : mainSkin.fontSize
color: mainSkin.inputColor
}
MouseArea {
anchors.fill: parent
property variant previousPosition
onPressed: {
previousPosition = Qt.point(mouseX, mouseY)
}
onPositionChanged: {
if (pressedButtons == Qt.LeftButton) {
var dx = mouseX - previousPosition.x
var dy = mouseY - previousPosition.y
mainWidget.pos = Qt.point(mainWidget.pos.x + dx,
mainWidget.pos.y + dy)
}
}
}
Row {
id: "horizontal"
visible : mainModel.showLookupTable && mainModel.isHorizontal
Repeater {
model: mainModel.candidateWords
Text {
id: "candidateWord"
text: "" + cddLabel + "" +
"" + cddText + "" + " "
font.pointSize : mainSkin.candFontSize != 0 ? mainSkin.candFontSize : mainSkin.fontSize
MouseArea {
anchors.fill: parent
onClicked: {
mainCtrl.selectCandidate(index)
}
}
}
}
}
Column {
id: "vertical"
visible : mainModel.showLookupTable && !mainModel.isHorizontal
Repeater {
model: mainModel.candidateWords
Text {
id: "candidateWord"
text: "" + cddLabel + "" +
"" + cddText + "" + " "
font.pointSize : mainSkin.candFontSize != 0 ? mainSkin.candFontSize : mainSkin.fontSize
MouseArea {
anchors.fill: parent
onClicked: {
mainCtrl.selectCandidate(index)
}
}
}
}
}
function clearAllAnchors(obj) {
obj.anchors.left = undefined;
obj.anchors.leftMargin = 0;
obj.anchors.top = undefined;
obj.anchors.topMargin = 0;
obj.anchors.right = undefined;
obj.anchors.rightMargin = 0;
obj.anchors.bottom = undefined;
obj.anchors.bottomMargin = 0;
}
function setObjAbsolutePosition(bindObj, x, y) {
if (x > 0) {
bindObj.anchors.left = mainWindow.left;
bindObj.anchors.leftMargin = x;
} else if (x < 0) {
bindObj.anchors.right = mainWindow.right;
bindObj.anchors.rightMargin = -x;
}
if (y > 0) {
bindObj.anchors.top = mainWindow.top;
bindObj.anchors.topMargin = y;
} else if (y < 0) {
bindObj.anchors.bottom = mainWindow.bottom;
bindObj.anchors.bottomMargin = -y;
}
}
Component.onCompleted: {
if (mainSkin.inputStringPosX == 0)
mainSkin.inputStringPosX = mainSkin.marginLeft;
if (mainSkin.inputStringPosY == 0)
mainSkin.inputStringPosY = mainSkin.marginTop;
clearAllAnchors(inputString);
setObjAbsolutePosition(inputString, mainSkin.inputStringPosX, mainSkin.inputStringPosY);
if (mainSkin.outputCandPosX == 0)
mainSkin.outputCandPosX = mainSkin.marginLeft;
if (mainSkin.outputCandPosY == 0)
mainSkin.outputCandPosY = inputString.height + mainSkin.marginTop;
clearAllAnchors(horizontal);
setObjAbsolutePosition(horizontal, mainSkin.outputCandPosX, mainSkin.outputCandPosY);
clearAllAnchors(vertical);
setObjAbsolutePosition(vertical, mainSkin.outputCandPosX, mainSkin.outputCandPosY);
}
function max(x, y) { return x > y ? x : y; }
Connections {
target: mainModel
onMainWindowSizeChanged: {
var tmp;
var width, width1;
var height, height1;
if (mainModel.showTips && !mainModel.showPreedit && !mainModel.showLookupTable) {
mainWindow.width = tipsString.width + 10;
mainWindow.height = tipsString.height + 10;
return;
}
width = mainSkin.marginLeft;
width1 = 0;
height = mainSkin.marginTop;
height1 = 0;
if (mainModel.showTips) {
tmp = tipsString.x + tipsString.width;
width = max(width, tmp);
tmp = tipsString.y + tipsString.height;
height = max(height, tmp);
}
if (mainModel.showPreedit) {
if (mainSkin.inputStringPosX > 0) {
tmp = inputString.x + inputString.width;
width = max(width, tmp);
} else {
width1 = max(width1, -mainSkin.inputStringPosX);
}
if (mainSkin.inputStringPosY > 0) {
tmp = inputString.y + inputString.height;
height = max(height, tmp);
} else {
height1 = max(height1, -mainSkin.inputStringPosY);
}
}
if (mainModel.showLookupTable) {
if (mainSkin.outputCandPosX > 0) {
if (mainModel.isHorizontal)
tmp = horizontal.x + horizontal.width;
else
tmp = vertical.x + vertical.width;
width = max(width, tmp);
} else {
width1 = max(width1, -mainSkin.outputCandPosX);
}
if (mainSkin.outputCandPosY > 0) {
if (mainModel.isHorizontal)
tmp = horizontal.y + horizontal.height;
else
tmp = vertical.y + vertical.height;
height = max(height, tmp);
} else {
height1 = max(height1, -mainSkin.outputCandPosY);
}
}
mainWindow.width = width + width1 + mainSkin.marginRight + mainSkin.adjustWidth;
mainWindow.height = height + height1 + mainSkin.marginBottom + mainSkin.adjustHeight;
}
}
}
fcitx-qimpanel-fcitx-qimpanel-0.1.5/skin/ 0000775 0000000 0000000 00000000000 12301005766 0020321 5 ustar 00root root 0000000 0000000 fcitx-qimpanel-fcitx-qimpanel-0.1.5/skin/skinbase.cpp 0000664 0000000 0000000 00000027176 12301005766 0022641 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd.
*
* Authors:
* lenky gao lenky0401@gmail.com/gaoqunkai@ubuntukylin.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include
#include "skinbase.h"
#include "../main_model.h"
SkinBase::SkinBase()
{
init();
}
SkinBase::~SkinBase()
{
}
void SkinBase::init()
{
//横排配置填默认值
mTipsImg = "";
mInputBackImg = "";
mCustomImg0 = "";
mCustomImg1 = "";
mMarginLeft = 0;
mMarginRight = 0;
mMarginTop = 0;
mMarginBottom = 0;
mBackArrowImg = "";
mForwardArrowImg = "";
//如果为0,那么会提示:QFont::setPointSizeF: Point size <= 0 (0.000000), must be greater than 0
//所以设置为13好了
mFontSize = 13;
mCandFontSize = 0;
mInputColor = Qt::color0;
mIndexColor = Qt::color0;
mFirstCandColor = Qt::color0;
mOtherColor = Qt::color0;
mInputStringPosX = 0;
mInputStringPosY = 0;
mOutputCandPosX = 0;
mOutputCandPosY = 0;
mBackArrowPosX = 0;
mBackArrowPosY = 0;
mForwardArrowPosX = 0;
mForwardArrowPosY = 0;
mAdjustWidth = 0;
mAdjustHeight = 0;
mHorizontalTileMode = "Stretch";
mVerticalTileMode = "Stretch";
//竖排配置填写零值,而不是默认值,因为在实际使用时,如果判断其为零值,那么会自动返回对应的横排值
mTipsImgVertical = "";
mInputBackImgVertical = "";
mCustomImgVertical0 = "";
mCustomImgVertical1 = "";
mMarginLeftVertical = 0;
mMarginRightVertical = 0;
mMarginTopVertical = 0;
mMarginBottomVertical = 0;
mBackArrowImgVertical = "";
mForwardArrowImgVertical = "";
mFontSizeVertical = 0;
mCandFontSizeVertical = 0;
mInputColorVertical = Qt::color0;
mIndexColorVertical = Qt::color0;
mFirstCandColorVertical = Qt::color0;
mOtherColorVertical = Qt::color0;
mInputStringPosXVertical = 0;
mInputStringPosYVertical = 0;
mOutputCandPosXVertical = 0;
mOutputCandPosYVertical = 0;
mBackArrowPosXVertical = 0;
mBackArrowPosYVertical = 0;
mForwardArrowPosXVertical = 0;
mForwardArrowPosYVertical = 0;
mAdjustWidthVertical = 0;
mAdjustHeightVertical = 0;
mHorizontalTileModeVertical = "";
mVerticalTileModeVertical = "";
}
bool SkinBase::loadSkin(const QString skinPath)
{
}
QColor SkinBase::value2color(const QString& value)
{
QStringList list = value.split(' ');
if(list.size() < 3) {
return Qt::color0;
}
int r = list.at(0).toInt();
int g = list.at(1).toInt();
int b = list.at(2).toInt();
return QColor(r, g, b);
}
void SkinBase::reloadSkin()
{
emit inputBackImgChanged();
emit customImg0Changed();
emit customImg1Changed();
emit tipsImgChanged();
emit marginLeftChanged();
emit marginRightChanged();
emit marginTopChanged();
emit marginBottomChanged();
emit backArrowImgChanged();
emit forwardArrowImgChanged();
emit fontSizeChanged();
emit candFontSizeChanged();
emit inputColorChanged();
emit indexColorChanged();
emit fontSizeChanged();
emit otherColorChanged();
emit inputStringPosXChanged();
emit inputStringPosYChanged();
emit outputCandPosXChanged();
emit outputCandPosYChanged();
emit backArrowPosXChanged();
emit backArrowPosYChanged();
emit forwardArrowPosXChanged();
emit forwardArrowPosYChanged();
emit adjustWidthChanged();
emit adjustHeightChanged();
emit horizontalTileModeChanged();
emit verticalTileModeChanged();
}
void SkinBase::setInputBackImg(const QString inputBackImg)
{
mInputBackImg = inputBackImg;
}
QString SkinBase::inputBackImg() const
{
if (MainModel::self()->isHorizontal() || mInputBackImgVertical == "")
return mInputBackImg;
else
return mInputBackImgVertical;
}
void SkinBase::setCustomImg0(const QString customImg)
{
mCustomImg0 = customImg;
}
QString SkinBase::customImg0() const
{
if (MainModel::self()->isHorizontal() || mCustomImgVertical0 == "")
return mCustomImg0;
else
return mCustomImgVertical0;
}
void SkinBase::setCustomImg1(const QString customImg)
{
mCustomImg1 = customImg;
}
QString SkinBase::customImg1() const
{
if (MainModel::self()->isHorizontal() || mCustomImgVertical1 == "")
return mCustomImg1;
else
return mCustomImgVertical1;
}
void SkinBase::setTipsImg(const QString tipsImg)
{
mTipsImg = tipsImg;
}
QString SkinBase::tipsImg() const
{
if (MainModel::self()->isHorizontal() || mTipsImgVertical == "")
return mTipsImg;
else
return mTipsImgVertical;
}
void SkinBase::setMarginLeft(const int marginLeft)
{
mMarginLeft = marginLeft;
}
int SkinBase::marginLeft() const
{
if (MainModel::self()->isHorizontal() || mMarginLeftVertical == 0)
return mMarginLeft;
else
return mMarginLeftVertical;
}
void SkinBase::setMarginRight(const int marginRight)
{
mMarginRight = marginRight;
}
int SkinBase::marginRight() const
{
if (MainModel::self()->isHorizontal() || mMarginRightVertical == 0)
return mMarginRight;
else
return mMarginRightVertical;
}
void SkinBase::setMarginTop(const int marginTop)
{
mMarginTop = marginTop;
}
int SkinBase::marginTop() const
{
if (MainModel::self()->isHorizontal() || mMarginTopVertical == 0)
return mMarginTop;
else
return mMarginTopVertical;
}
void SkinBase::setMarginBottom(const int marginBottom)
{
mMarginBottom = marginBottom;
}
int SkinBase::marginBottom() const
{
if (MainModel::self()->isHorizontal() || mMarginBottomVertical == 0)
return mMarginBottom;
else
return mMarginBottomVertical;
}
void SkinBase::setBackArrowImg(const QString backArrowImg)
{
mBackArrowImg = backArrowImg;
}
QString SkinBase::backArrowImg() const
{
if (MainModel::self()->isHorizontal() || mBackArrowImgVertical == "")
return mBackArrowImg;
else
return mBackArrowImgVertical;
}
void SkinBase::setForwardArrowImg(const QString forwardArrowImg)
{
mForwardArrowImg = forwardArrowImg;
}
QString SkinBase::forwardArrowImg() const
{
if (MainModel::self()->isHorizontal() || mForwardArrowImgVertical == "")
return mForwardArrowImg;
else
return mForwardArrowImgVertical;
}
void SkinBase::setFontSize(const int fontSize)
{
mFontSize = fontSize;
}
int SkinBase::fontSize() const
{
if (MainModel::self()->isHorizontal() || mFontSizeVertical == 0)
return mFontSize;
else
return mFontSizeVertical;
}
void SkinBase::setCandFontSize(const int candFontSize)
{
mCandFontSize = candFontSize;
}
int SkinBase::candFontSize() const
{
if (MainModel::self()->isHorizontal() || mCandFontSizeVertical == 0)
return mCandFontSize;
else
return mCandFontSizeVertical;
}
void SkinBase::setInputColor(const QColor inputColor)
{
mInputColor = inputColor;
}
QColor SkinBase::inputColor() const
{
if (MainModel::self()->isHorizontal() || mInputColorVertical == Qt::color0)
return mInputColor;
else
return mInputColorVertical;
}
void SkinBase::setIndexColor(const QColor indexColor)
{
mIndexColor = indexColor;
}
QColor SkinBase::indexColor() const
{
if (MainModel::self()->isHorizontal() || mIndexColorVertical == Qt::color0)
return mIndexColor;
else
return mIndexColorVertical;
}
void SkinBase::setFirstCandColor(const QColor firstCandColor)
{
mFirstCandColor = firstCandColor;
}
QColor SkinBase::firstCandColor() const
{
if (MainModel::self()->isHorizontal() || mFirstCandColorVertical == Qt::color0)
return mFirstCandColor;
else
return mFirstCandColorVertical;
}
void SkinBase::setOtherColor(const QColor otherColor)
{
mOtherColor = otherColor;
}
QColor SkinBase::otherColor() const
{
if (MainModel::self()->isHorizontal() || mOtherColorVertical == Qt::color0)
return mOtherColor;
else
return mOtherColorVertical;
}
#define DEFINE_PROPERTY(read, type, property, zero) \
void SkinBase::set##property(const type read) { \
m##property = read; \
} \
type SkinBase::read() const { \
if (MainModel::self()->isHorizontal() || m##property##Vertical == zero) \
return m##property; \
else \
return m##property##Vertical; \
}
DEFINE_PROPERTY(inputStringPosX, int, InputStringPosX, 0)
DEFINE_PROPERTY(inputStringPosY, int, InputStringPosY, 0)
DEFINE_PROPERTY(outputCandPosX, int, OutputCandPosX, 0)
DEFINE_PROPERTY(outputCandPosY, int, OutputCandPosY, 0)
DEFINE_PROPERTY(backArrowPosX, int, BackArrowPosX, 0)
DEFINE_PROPERTY(backArrowPosY, int, BackArrowPosY, 0)
DEFINE_PROPERTY(forwardArrowPosX, int, ForwardArrowPosX, 0)
DEFINE_PROPERTY(forwardArrowPosY, int, ForwardArrowPosY, 0)
DEFINE_PROPERTY(adjustWidth, int, AdjustWidth, 0)
DEFINE_PROPERTY(adjustHeight, int, AdjustHeight, 0)
DEFINE_PROPERTY(horizontalTileMode, QString, HorizontalTileMode, "")
DEFINE_PROPERTY(verticalTileMode, QString, VerticalTileMode, "")
#undef DEFINE_PROPERTY
#define DEFINE_SET_PROPERTY(read, type, property) \
void SkinBase::set##property(const type read) { \
m##property = read; \
}
DEFINE_SET_PROPERTY(inputBackImgVertical, QString, InputBackImgVertical)
DEFINE_SET_PROPERTY(tipsImgVertical, QString, TipsImgVertical)
DEFINE_SET_PROPERTY(marginLeftVertical, int, MarginLeftVertical)
DEFINE_SET_PROPERTY(marginRightVertical, int, MarginRightVertical)
DEFINE_SET_PROPERTY(marginTopVertical, int, MarginTopVertical)
DEFINE_SET_PROPERTY(marginBottomVertical, int, MarginBottomVertical)
DEFINE_SET_PROPERTY(backArrowImgVertical, QString, BackArrowImgVertical)
DEFINE_SET_PROPERTY(forwardArrowImgVertical, QString, ForwardArrowImgVertical)
DEFINE_SET_PROPERTY(fontSizeVertical, int, FontSizeVertical)
DEFINE_SET_PROPERTY(candFontSizeVertical, int, CandFontSizeVertical)
DEFINE_SET_PROPERTY(inputColorVertical, QColor, InputColorVertical)
DEFINE_SET_PROPERTY(indexColorVertical, QColor, IndexColorVertical)
DEFINE_SET_PROPERTY(firstCandColorVertical, QColor, FirstCandColorVertical)
DEFINE_SET_PROPERTY(otherColorVertical, QColor, OtherColorVertical)
DEFINE_SET_PROPERTY(inputStringPosXVertical, int, InputStringPosXVertical)
DEFINE_SET_PROPERTY(inputStringPosYVertical, int, InputStringPosYVertical)
DEFINE_SET_PROPERTY(outputCandPosXVertical, int, OutputCandPosXVertical)
DEFINE_SET_PROPERTY(outputCandPosYVertical, int, OutputCandPosYVertical)
DEFINE_SET_PROPERTY(backArrowPosXVertical, int, BackArrowPosXVertical)
DEFINE_SET_PROPERTY(backArrowPosYVertical, int, BackArrowPosYVertical)
DEFINE_SET_PROPERTY(forwardArrowPosXVertical, int, ForwardArrowPosXVertical)
DEFINE_SET_PROPERTY(forwardArrowPosYVertical, int, ForwardArrowPosYVertical)
DEFINE_SET_PROPERTY(adjustWidthVertical, int, AdjustWidthVertical)
DEFINE_SET_PROPERTY(adjustHeightVertical, int, AdjustHeightVertical)
DEFINE_SET_PROPERTY(horizontalTileModeVertical, QString, HorizontalTileModeVertical)
DEFINE_SET_PROPERTY(verticalTileModeVertical, QString, VerticalTileModeVertical)
#undef DEFINE_SET_PROPERTY
fcitx-qimpanel-fcitx-qimpanel-0.1.5/skin/skinbase.h 0000664 0000000 0000000 00000027354 12301005766 0022304 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd.
*
* Authors:
* lenky gao lenky0401@gmail.com/gaoqunkai@ubuntukylin.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#ifndef __SKIN_BASE_H__
#define __SKIN_BASE_H__
#include
#include
#include
#include
#include
#include
#include
class SkinBase : public QObject
{
Q_OBJECT
Q_PROPERTY(QString inputBackImg READ inputBackImg WRITE setInputBackImg
NOTIFY inputBackImgChanged)
Q_PROPERTY(QString customImg0 READ customImg0 WRITE setCustomImg0
NOTIFY customImg0Changed)
Q_PROPERTY(QString customImg1 READ customImg1 WRITE setCustomImg1
NOTIFY customImg1Changed)
Q_PROPERTY(QString tipsImg READ tipsImg WRITE setTipsImg
NOTIFY tipsImgChanged)
Q_PROPERTY(int marginLeft READ marginLeft WRITE setMarginLeft
NOTIFY marginLeftChanged)
Q_PROPERTY(int marginRight READ marginRight WRITE setMarginRight
NOTIFY marginRightChanged)
Q_PROPERTY(int marginTop READ marginTop WRITE setMarginTop
NOTIFY marginTopChanged)
Q_PROPERTY(int marginBottom READ marginBottom WRITE setMarginBottom
NOTIFY marginBottomChanged)
Q_PROPERTY(QString backArrowImg READ backArrowImg WRITE setBackArrowImg
NOTIFY backArrowImgChanged)
Q_PROPERTY(QString forwardArrowImg READ forwardArrowImg WRITE setForwardArrowImg
NOTIFY forwardArrowImgChanged)
Q_PROPERTY(int fontSize READ fontSize WRITE setFontSize
NOTIFY fontSizeChanged)
Q_PROPERTY(int candFontSize READ candFontSize WRITE setCandFontSize
NOTIFY candFontSizeChanged)
Q_PROPERTY(QColor inputColor READ inputColor WRITE setInputColor
NOTIFY inputColorChanged)
Q_PROPERTY(QColor indexColor READ indexColor WRITE setIndexColor
NOTIFY indexColorChanged)
Q_PROPERTY(QColor firstCandColor READ firstCandColor WRITE setFirstCandColor
NOTIFY firstCandColorChanged)
Q_PROPERTY(QColor otherColor READ otherColor WRITE setOtherColor
NOTIFY otherColorChanged)
public:
void setInputBackImg(const QString inputBackImg);
QString inputBackImg() const;
void setCustomImg0(const QString customImg);
QString customImg0() const;
void setCustomImg1(const QString customImg);
QString customImg1() const;
void setTipsImg(const QString tipsImg);
QString tipsImg() const;
void setMarginLeft(const int marginLeft);
int marginLeft() const;
void setMarginRight(const int marginRight);
int marginRight() const;
void setMarginTop(const int marginTop);
int marginTop() const;
void setMarginBottom(const int marginBottom);
int marginBottom() const;
void setBackArrowImg(const QString backArrowImg);
QString backArrowImg() const;
void setForwardArrowImg(const QString forwardArrowImg);
QString forwardArrowImg() const;
void setFontSize(const int fontSize);
int fontSize() const;
void setCandFontSize(const int candFontSize);
int candFontSize() const;
void setInputColor(const QColor inputColor);
QColor inputColor() const;
void setIndexColor(const QColor indexColor);
QColor indexColor() const;
void setFirstCandColor(const QColor firstCandColor);
QColor firstCandColor() const;
void setOtherColor(const QColor otherColor);
QColor otherColor() const;
signals:
void inputBackImgChanged();
void customImg0Changed();
void customImg1Changed();
void tipsImgChanged();
void marginLeftChanged();
void marginRightChanged();
void marginTopChanged();
void marginBottomChanged();
void backArrowImgChanged();
void forwardArrowImgChanged();
void fontSizeChanged();
void candFontSizeChanged();
void inputColorChanged();
void indexColorChanged();
void firstCandColorChanged();
void otherColorChanged();
private:
//Fcitx SkinInputBar
QString mInputBackImg;
QString mCustomImg0;
QString mCustomImg1;
QString mTipsImg;
int mMarginLeft;
int mMarginRight;
int mMarginTop;
int mMarginBottom;
QString mBackArrowImg;
QString mForwardArrowImg;
//Fcitx SkinFont
int mFontSize;
int mCandFontSize;
QColor mInputColor;
QColor mIndexColor;
QColor mFirstCandColor;
QColor mOtherColor;
public:
Q_PROPERTY(int inputStringPosX READ inputStringPosX WRITE setInputStringPosX
NOTIFY inputStringPosXChanged)
void setInputStringPosX(const int inputStringPosX);
int inputStringPosX() const;
signals:
void inputStringPosXChanged();
private:
int mInputStringPosX;
public:
Q_PROPERTY(int inputStringPosY READ inputStringPosY WRITE setInputStringPosY
NOTIFY inputStringPosYChanged)
void setInputStringPosY(const int inputStringPosY);
int inputStringPosY() const;
signals:
void inputStringPosYChanged();
private:
int mInputStringPosY;
public:
Q_PROPERTY(int outputCandPosX READ outputCandPosX WRITE setOutputCandPosX
NOTIFY outputCandPosXChanged)
void setOutputCandPosX(const int outputCandPosX);
int outputCandPosX() const;
signals:
void outputCandPosXChanged();
private:
int mOutputCandPosX;
public:
Q_PROPERTY(int outputCandPosY READ outputCandPosY WRITE setOutputCandPosY
NOTIFY outputCandPosYChanged)
void setOutputCandPosY(const int outputCandPosY);
int outputCandPosY() const;
signals:
void outputCandPosYChanged();
private:
int mOutputCandPosY;
public:
Q_PROPERTY(int backArrowPosX READ backArrowPosX WRITE setBackArrowPosX
NOTIFY backArrowPosXChanged)
void setBackArrowPosX(const int backArrowPosX);
int backArrowPosX() const;
signals:
void backArrowPosXChanged();
private:
int mBackArrowPosX;
public:
Q_PROPERTY(int backArrowPosY READ backArrowPosY WRITE setBackArrowPosY
NOTIFY backArrowPosYChanged)
void setBackArrowPosY(const int backArrowPosY);
int backArrowPosY() const;
signals:
void backArrowPosYChanged();
private:
int mBackArrowPosY;
public:
Q_PROPERTY(int forwardArrowPosX READ forwardArrowPosX WRITE setForwardArrowPosX
NOTIFY forwardArrowPosXChanged)
void setForwardArrowPosX(const int forwardArrowPosX);
int forwardArrowPosX() const;
signals:
void forwardArrowPosXChanged();
private:
int mForwardArrowPosX;
public:
Q_PROPERTY(int forwardArrowPosY READ forwardArrowPosY WRITE setForwardArrowPosY
NOTIFY forwardArrowPosYChanged)
void setForwardArrowPosY(const int forwardArrowPosY);
int forwardArrowPosY() const;
signals:
void forwardArrowPosYChanged();
private:
int mForwardArrowPosY;
public:
Q_PROPERTY(int adjustWidth READ adjustWidth WRITE setAdjustWidth
NOTIFY adjustWidthChanged)
void setAdjustWidth(const int adjustWidth);
int adjustWidth() const;
signals:
void adjustWidthChanged();
private:
int mAdjustWidth;
public:
Q_PROPERTY(int adjustHeight READ adjustHeight WRITE setAdjustHeight
NOTIFY adjustHeightChanged)
void setAdjustHeight(const int adjustHeight);
int adjustHeight() const;
signals:
void adjustHeightChanged();
private:
int mAdjustHeight;
public:
Q_PROPERTY(QString horizontalTileMode READ horizontalTileMode WRITE setHorizontalTileMode
NOTIFY horizontalTileModeChanged)
void setHorizontalTileMode(const QString horizontalTileMode);
QString horizontalTileMode() const;
signals:
void horizontalTileModeChanged();
private:
QString mHorizontalTileMode;
public:
Q_PROPERTY(QString verticalTileMode READ verticalTileMode WRITE setVerticalTileMode
NOTIFY verticalTileModeChanged)
void setVerticalTileMode(const QString verticalTileMode);
QString verticalTileMode() const;
signals:
void verticalTileModeChanged();
private:
QString mVerticalTileMode;
//===================================================================================================
private:
//Fcitx SkinInputBar
QString mInputBackImgVertical;
QString mCustomImgVertical0;
QString mCustomImgVertical1;
QString mTipsImgVertical;
int mMarginLeftVertical;
int mMarginRightVertical;
int mMarginTopVertical;
int mMarginBottomVertical;
QString mBackArrowImgVertical;
QString mForwardArrowImgVertical;
//Fcitx SkinFont
int mFontSizeVertical;
int mCandFontSizeVertical;
QColor mInputColorVertical;
QColor mIndexColorVertical;
QColor mFirstCandColorVertical;
QColor mOtherColorVertical;
int mInputStringPosXVertical;
int mInputStringPosYVertical;
int mOutputCandPosXVertical;
int mOutputCandPosYVertical;
int mBackArrowPosXVertical;
int mBackArrowPosYVertical;
int mForwardArrowPosXVertical;
int mForwardArrowPosYVertical;
int mAdjustWidthVertical;
int mAdjustHeightVertical;
QString mHorizontalTileModeVertical;
QString mVerticalTileModeVertical;
public:
#define DEFINE_SET_PROPERTY(read, type, property) \
void set##property(const type read);
DEFINE_SET_PROPERTY(inputBackImgVertical, QString, InputBackImgVertical)
DEFINE_SET_PROPERTY(tipsImgVertical, QString, TipsImgVertical)
DEFINE_SET_PROPERTY(marginLeftVertical, int, MarginLeftVertical)
DEFINE_SET_PROPERTY(marginRightVertical, int, MarginRightVertical)
DEFINE_SET_PROPERTY(marginTopVertical, int, MarginTopVertical)
DEFINE_SET_PROPERTY(marginBottomVertical, int, MarginBottomVertical)
DEFINE_SET_PROPERTY(backArrowImgVertical, QString, BackArrowImgVertical)
DEFINE_SET_PROPERTY(forwardArrowImgVertical, QString, ForwardArrowImgVertical)
DEFINE_SET_PROPERTY(fontSizeVertical, int, FontSizeVertical)
DEFINE_SET_PROPERTY(candFontSizeVertical, int, CandFontSizeVertical)
DEFINE_SET_PROPERTY(inputColorVertical, QColor, InputColorVertical)
DEFINE_SET_PROPERTY(indexColorVertical, QColor, IndexColorVertical)
DEFINE_SET_PROPERTY(firstCandColorVertical, QColor, FirstCandColorVertical)
DEFINE_SET_PROPERTY(otherColorVertical, QColor, OtherColorVertical)
DEFINE_SET_PROPERTY(inputStringPosXVertical, int, InputStringPosXVertical)
DEFINE_SET_PROPERTY(inputStringPosYVertical, int, InputStringPosYVertical)
DEFINE_SET_PROPERTY(outputCandPosXVertical, int, OutputCandPosXVertical)
DEFINE_SET_PROPERTY(outputCandPosYVertical, int, OutputCandPosYVertical)
DEFINE_SET_PROPERTY(backArrowPosXVertical, int, BackArrowPosXVertical)
DEFINE_SET_PROPERTY(backArrowPosYVertical, int, BackArrowPosYVertical)
DEFINE_SET_PROPERTY(forwardArrowPosXVertical, int, ForwardArrowPosXVertical)
DEFINE_SET_PROPERTY(forwardArrowPosYVertical, int, ForwardArrowPosYVertical)
DEFINE_SET_PROPERTY(adjustWidthVertical, int, AdjustWidthVertical)
DEFINE_SET_PROPERTY(adjustHeightVertical, int, AdjustHeightVertical)
DEFINE_SET_PROPERTY(horizontalTileModeVertical, QString, HorizontalTileModeVertical)
DEFINE_SET_PROPERTY(verticalTileModeVertical, QString, VerticalTileModeVertical)
#undef DEFINE_SET_PROPERTY
//===================================================================================================
public:
SkinBase();
virtual ~SkinBase();
virtual bool loadSkin(const QString skinPath);
void reloadSkin();
void init();
protected:
QColor value2color(const QString& value);
};
#endif //__SKIN_BASE_H__
fcitx-qimpanel-fcitx-qimpanel-0.1.5/skin/skinfcitx.cpp 0000664 0000000 0000000 00000017154 12301005766 0023037 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2013 Canonical Ltd All rights reserved.
*
* Authors:
* FJKong kroodywar3@gmail.com/fanjun.kong@canonical.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "skinfcitx.h"
SkinFcitx::SkinFcitx() : SkinBase()
{
}
SkinFcitx::~SkinFcitx()
{
}
bool SkinFcitx::loadSkin(const QString skinPath)
{
init();
QFile fcitxSkinConfFile(skinPath + "fcitx_skin.conf");
if (!fcitxSkinConfFile.exists())
return false;
if (!fcitxSkinConfFile.open(QIODevice::ReadOnly))
return false;
QString line;
QString key, value;
bool skinFont = false;
bool skinInputBar = false;
bool skinFontVertical = false;
bool skinInputBarVertical = false;
QTextStream textStream(fcitxSkinConfFile.readAll());
do {
line = textStream.readLine();
if (line.isEmpty() || line.at(0) == '#')
continue;
if (line.at(0) == '[') {
skinFont = (line == "[SkinFont]");
skinInputBar = (line == "[SkinInputBar]");
skinFontVertical = (line == "[SkinFontVertical]");
skinInputBarVertical = (line == "[SkinInputBarVertical]");
continue;
}
if (!line.contains('='))
continue;
key = line.split('=').at(0);
value = line.split('=').at(1);
if (value.isEmpty())
continue;
if (skinFont) {
if (key == "FontSize") {
setFontSize(value.toInt());
} else if (key == "CandFontSize") {
setCandFontSize(value.toInt());
} else if (key == "InputColor") {
setInputColor(value2color(value));
} else if (key == "IndexColor") {
setIndexColor(value2color(value));
} else if (key == "FirstCandColor") {
setFirstCandColor(value2color(value));
} else if (key == "OtherColor") {
setOtherColor(value2color(value));
}
} else if (skinInputBar) {
if (key == "BackImg") {
setInputBackImg("file:/" + skinPath + value);
} else if (key == "TipsImg") {
setTipsImg("file:/" + skinPath + value);
} else if (key == "AdjustWidth") {
setAdjustWidth(value.toInt());
} else if (key == "AdjustHeight") {
setAdjustHeight(value.toInt());
} else if (key == "MarginLeft") {
setMarginLeft(value.toInt());
} else if (key == "MarginTop") {
setMarginTop(value.toInt());
} else if (key == "MarginRight") {
setMarginRight(value.toInt());
} else if (key == "MarginBottom") {
setMarginBottom(value.toInt());
} else if (key == "horizontalTileMode") {
setHorizontalTileMode(value);
} else if (key == "verticalTileMode") {
setVerticalTileMode(value);
} else if (key == "InputStringPosX") {
setInputStringPosX(value.toInt());
} else if (key == "InputStringPosY") {
setInputStringPosY(value.toInt());
} else if (key == "OutputCandPosX") {
setOutputCandPosX(value.toInt());
} else if (key == "OutputCandPosY") {
setOutputCandPosY(value.toInt());
} else if (key == "BackArrowPosX") {
setBackArrowPosX(value.toInt());
} else if (key == "BackArrowPosY") {
setBackArrowPosY(value.toInt());
} else if (key == "ForwardArrowPosX") {
setForwardArrowPosX(value.toInt());
} else if (key == "ForwardArrowPosY") {
setForwardArrowPosY(value.toInt());
} else if (key == "BackArrow") {
setBackArrowImg("file:/" + skinPath + value);
} else if (key == "ForwardArrow") {
setForwardArrowImg("file:/" + skinPath + value);
}
} else if (skinFontVertical) {
if (key == "FontSize") {
setFontSizeVertical(value.toInt());
} else if (key == "CandFontSize") {
setCandFontSizeVertical(value.toInt());
} else if (key == "InputColor") {
setInputColorVertical(value2color(value));
} else if (key == "IndexColor") {
setIndexColorVertical(value2color(value));
} else if (key == "FirstCandColor") {
setFirstCandColorVertical(value2color(value));
} else if (key == "OtherColor") {
setOtherColorVertical(value2color(value));
}
} else if (skinInputBarVertical) {
if (key == "BackImg") {
setInputBackImgVertical("file:/" + skinPath + value);
} else if (key == "TipsImg") {
setTipsImgVertical("file:/" + skinPath + value);
} else if (key == "AdjustWidth") {
setAdjustWidthVertical(value.toInt());
} else if (key == "AdjustHeight") {
setAdjustHeightVertical(value.toInt());
} else if (key == "MarginLeft") {
setMarginLeftVertical(value.toInt());
} else if (key == "MarginTop") {
setMarginTopVertical(value.toInt());
} else if (key == "MarginRight") {
setMarginRightVertical(value.toInt());
} else if (key == "MarginBottom") {
setMarginBottomVertical(value.toInt());
} else if (key == "horizontalTileMode") {
setHorizontalTileModeVertical(value);
} else if (key == "verticalTileMode") {
setVerticalTileModeVertical(value);
} else if (key == "InputStringPosX") {
setInputStringPosXVertical(value.toInt());
} else if (key == "InputStringPosY") {
setInputStringPosYVertical(value.toInt());
} else if (key == "OutputCandPosX") {
setOutputCandPosXVertical(value.toInt());
} else if (key == "OutputCandPosY") {
setOutputCandPosYVertical(value.toInt());
} else if (key == "BackArrowPosX") {
setBackArrowPosXVertical(value.toInt());
} else if (key == "BackArrowPosY") {
setBackArrowPosYVertical(value.toInt());
} else if (key == "ForwardArrowPosX") {
setForwardArrowPosXVertical(value.toInt());
} else if (key == "ForwardArrowPosY") {
setForwardArrowPosYVertical(value.toInt());
} else if (key == "BackArrow") {
setBackArrowImgVertical("file:/" + skinPath + value);
} else if (key == "ForwardArrow") {
setForwardArrowImgVertical("file:/" + skinPath + value);
}
}
} while (!line.isNull());
fcitxSkinConfFile.close();
return true;
}
fcitx-qimpanel-fcitx-qimpanel-0.1.5/skin/skinfcitx.h 0000664 0000000 0000000 00000001746 12301005766 0022504 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd.
*
* Authors:
* lenky gao lenky0401@gmail.com/gaoqunkai@ubuntukylin.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#ifndef __SKIN_FCITX_H__
#define __SKIN_FCITX_H__
#include "skinbase.h"
class SkinFcitx : public SkinBase
{
public:
SkinFcitx();
virtual ~SkinFcitx();
virtual bool loadSkin(const QString skinPath);
};
#endif // __SKIN_FCITX_H__
fcitx-qimpanel-fcitx-qimpanel-0.1.5/skin/skinmenu.cpp 0000664 0000000 0000000 00000013234 12301005766 0022661 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd.
*
* Authors:
* lenky gao lenky0401@gmail.com/gaoqunkai@ubuntukylin.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include
#include
#include
#include "skinmenu.h"
#include "../main_controller.h"
#include "../my_action.h"
#include "skinfcitx.h"
#include "skinsogou.h"
#include "../main.h"
SkinMenu::SkinMenu(const QString &title, QWidget *parent)
: QMenu(title, parent)
{
mSkinNameMenu = NULL;
triggerUpdateSkinListMenu();
if (mSkinNameMenu)
menuItemOnClick(mSkinNameMenu);
QObject::connect(this, SIGNAL(aboutToShow()), this,
SLOT(triggerUpdateSkinListMenu()));
QObject::connect(this, SIGNAL(triggered(QAction*)), this,
SLOT(menuItemOnClick(QAction *)));
}
SkinMenu::~SkinMenu()
{
}
void SkinMenu::triggerUpdateSkinListMenu()
{
int i;
size_t len;
QDir skinDir;
bool checked = false;
MyAction *firstMenu = NULL, *menu;
QFileInfoList list;
QFileInfoList::Iterator iter;
QString skinName = MainController::self()->getSkinName();
SkinClass skinClass;
bool localExist;
this->clear();
QString localSkinPath = qgetenv("HOME") + "/.config/fcitx-qimpanel/skin/";
for (i = 0; i < 1; i ++) {
skinDir = QDir(localSkinPath);
if (!skinDir.exists())
continue;
skinDir.setFilter(QDir::Dirs);
list = skinDir.entryInfoList();
for (iter = list.begin(); iter != list.end(); ++ iter) {
if (iter->isDir() && "." != iter->fileName() && ".." != iter->fileName()) {
QFile fcitxSkinConfFile(iter->absoluteFilePath() + "/fcitx_skin.conf");
QFile sogouSkinConfFile(iter->absoluteFilePath() + "/skin.ini");
if (fcitxSkinConfFile.exists()){
skinClass = FCITX;
}else if (sogouSkinConfFile.exists()){
skinClass = SOGOU;
}else continue;
menu = new MyAction(iter->fileName(), this);
menu->setSkinPath(iter->absoluteFilePath() + "/");
menu->setSkinClass(skinClass);
this->addAction(menu);
if (firstMenu == NULL)
firstMenu = menu;
menu->setCheckable(true);
if (iter->fileName() == skinName) {
checked = true;
menu->setChecked(true);
mSkinNameMenu = menu;
}
}
}
}
char* ukSkinPath = getQimpanelSharePath("skin");
for (i = 0; i < 1; i ++) {
skinDir = QDir(ukSkinPath);
if (!skinDir.exists())
continue;
skinDir.setFilter(QDir::Dirs);
list = skinDir.entryInfoList();
for (iter = list.begin(); iter != list.end(); ++ iter) {
if (iter->isDir() && "." != iter->fileName() && ".." != iter->fileName()) {
QFile fcitxSkinConfFile(iter->absoluteFilePath() + "/fcitx_skin.conf");
QFile sogouSkinConfFile(iter->absoluteFilePath() + "/skin.ini");
if (fcitxSkinConfFile.exists()){
skinClass = FCITX;
}else if (sogouSkinConfFile.exists()){
skinClass = SOGOU;
}else continue;
//check if exist in local
localExist = false;
QList localExistList = this->actions();
QList::iterator localExistIter;
for (localExistIter = localExistList.begin();
localExistIter != localExistList.end(); ++ localExistIter)
{
if (((MyAction *)(*localExistIter))->text() == iter->fileName()) {
localExist = true;
break;
}
}
if (localExist)
continue;
menu = new MyAction(iter->fileName(), this);
//qDebug() << iter->absoluteFilePath();
menu->setSkinPath(iter->absoluteFilePath() + "/");
menu->setSkinClass(skinClass);
this->addAction(menu);
if (firstMenu == NULL)
firstMenu = menu;
menu->setCheckable(true);
if (iter->fileName() == skinName) {
checked = true;
menu->setChecked(true);
mSkinNameMenu = menu;
}
}
}
}
if (!checked)
firstMenu->setChecked(true);
if (mSkinNameMenu == NULL)
mSkinNameMenu = firstMenu;
}
void SkinMenu::menuItemOnClick(QAction *action)
{
SkinBase *skin;
MyAction *myAction = (MyAction *)action;
MainController::self()->setSkinName(myAction->text());
if (FCITX == myAction->getSkinClass())
skin = new SkinFcitx;
else if (SOGOU == myAction->getSkinClass())
skin = new SkinSogou;
else qDebug() << "Load skin failed!";
skin->loadSkin(myAction->getSkinPath());
MainController::self()->setSkinBase(skin, myAction->getSkinClass());
}
fcitx-qimpanel-fcitx-qimpanel-0.1.5/skin/skinmenu.h 0000664 0000000 0000000 00000002212 12301005766 0022320 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd.
*
* Authors:
* lenky gao lenky0401@gmail.com/gaoqunkai@ubuntukylin.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#ifndef __SKIN_MENU_H__
#define __SKIN_MENU_H__
#include
#include
#include "../my_action.h"
class SkinMenu : public QMenu
{
Q_OBJECT
public:
SkinMenu(const QString &title, QWidget *parent);
virtual ~SkinMenu();
private slots:
void triggerUpdateSkinListMenu();
void menuItemOnClick(QAction* action);
private:
MyAction *mSkinNameMenu;
};
#endif // __SKIN_MENU_H__
fcitx-qimpanel-fcitx-qimpanel-0.1.5/skin/skinsogou.cpp 0000664 0000000 0000000 00000012713 12301005766 0023052 0 ustar 00root root 0000000 0000000 #include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "skinsogou.h"
#include "../main_model.h"
SkinSogou::SkinSogou() : SkinBase()
{
}
SkinSogou::~SkinSogou()
{
}
bool SkinSogou::loadSkin(const QString skinPath)
{
init();
QFile sogouSkinConfFile(skinPath + "skin.ini");
if (!sogouSkinConfFile.exists())
return false;
if (!sogouSkinConfFile.open(QIODevice::ReadOnly))
return false;
QString line;
QString key, value;
/// parse ini file content
bool general = false;
bool display = false;
bool scheme_h1 = false;
bool scheme_v1 = false;
bool statusbar = false;
int h_pt, h_pb, h_pl, h_pr;
int v_pt, v_pb, v_pl, v_pr;
unsigned int pinyin_color, zhongwen_color, zhongwen_first_color, comphint_color;
int fontPixelSize = 12;
setAdjustWidth(10);
setAdjustHeight(30);
setHorizontalTileMode("Stretch");
setVerticalTileMode("Stretch");
setInputStringPosX(0);
setInputStringPosY(0);
setOutputCandPosX(0);
setOutputCandPosY(0);
QTextStream textStream(sogouSkinConfFile.readAll());
do {
line = textStream.readLine();
if (line.isEmpty() || line.at(0) == '#')
continue;
if (line.at(0) == '[') {
general = (line == "[General]");
display = (line == "[Display]");
scheme_h1 = (line == "[Scheme_H1]");
scheme_v1 = (line == "[Scheme_V1]");
statusbar = (line == "[StatusBar]");
continue;
}
if (!line.contains('='))
continue;
key = line.split('=').at(0);
value = line.split('=').at(1);
if (value.isEmpty())
continue;
if (display) {
if (key == "font_size")
setFontSize(value.toInt());
else if (key == "pinyin_color"){
pinyin_color = value.toUInt(0, 0);
setInputColor(QColor(qBlue(pinyin_color), qGreen(pinyin_color), qRed(pinyin_color)));
}
else if (key == "zhongwen_color"){
zhongwen_color = value.toUInt(0, 0);
setOtherColor(QColor(qBlue(zhongwen_color), qGreen(zhongwen_color), qRed(zhongwen_color)));
}
else if (key == "zhongwen_first_color"){
zhongwen_first_color = value.toUInt(0, 0);
setFirstCandColor(QColor(qBlue(zhongwen_first_color), qGreen(zhongwen_first_color), qRed(zhongwen_first_color)));
}
else if (key == "comphint_color"){
//FIXME
//comphint_color = value.toUInt(0, 0);
}
}else if (scheme_h1) {
if (key == "pic" && MainModel::self()->isHorizontal()) {
setInputBackImg("file:/" + skinPath + value);
}
else if (key == "pinyin_marge") {
QStringList list = value.split(',');
h_pt = list.at(0).trimmed().toInt();
h_pb = list.at(1).trimmed().toInt();
h_pl = list.at(2).trimmed().toInt();
h_pr = list.at(3).trimmed().toInt();
if (MainModel::self()->isHorizontal()){
setMarginTop(h_pt);
setMarginBottom(h_pb);
setMarginLeft(h_pl);
setMarginRight(h_pr);
}
}
else if (key == "custom0_align") {
//todo
}
else if (key == "custom0") {
mCustomImgH1[0] = value;
setCustomImg0 ("file:/" + skinPath + value);
}
else if (key == "custom1") {
mCustomImgH1[1] = value;
setCustomImg1 ("file:/" + skinPath + value);
}
else if (key == "custom_cnt") {
mCustomCntH1 = value.toInt();
}
}else if (scheme_v1) {
if (key == "pic" && !MainModel::self()->isHorizontal()) {
setInputBackImg("file:/" + skinPath + value);
}
else if (key == "pinyin_marge") {
QStringList list = value.split(',');
v_pt = list.at(0).trimmed().toInt();
v_pb = list.at(1).trimmed().toInt();
v_pl = list.at(2).trimmed().toInt();
v_pr = list.at(3).trimmed().toInt();
if (!MainModel::self()->isHorizontal()){
setMarginTop(v_pt);
setMarginBottom(v_pb);
setMarginLeft(v_pl);
setMarginRight(v_pr);
}
}
else if (key == "custom0") {
mCustomImgV1[0] = value;
//qDebug() << "cuystom0 " << value;
//setCustomImg0(value);
}
else if (key == "custom1") {
mCustomImgV1[1] = value;
qDebug() << "cuystom1 " << value;
//setCustomImg1(value);
}
else if (key == "custom_cnt") {
mCustomCntV1 = value.toInt();
//qDebug() << "cuystom_cnt " << mCustomCntV1;
}
} else if (statusbar) {
if (key == "pic") {
//FIXME
//setTipsImg("file:/" + skinPath + value);
}
}
} while (!line.isNull());
sogouSkinConfFile.close();
return true;
}
fcitx-qimpanel-fcitx-qimpanel-0.1.5/skin/skinsogou.h 0000664 0000000 0000000 00000002146 12301005766 0022516 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd.
*
* Authors:
* lenky gao lenky0401@gmail.com/gaoqunkai@ubuntukylin.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#ifndef __SKIN_SOGOU_H__
#define __SKIN_SOGOU_H__
#include
#include "skinbase.h"
class SkinSogou : public SkinBase
{
public:
SkinSogou();
virtual ~SkinSogou();
virtual bool loadSkin(const QString skinPath);
private:
QString mCustomImgH1[8];
int mCustomCntH1;
QString mCustomImgV1[8];
int mCustomCntV1;
};
#endif // __SKIN_SOGOU_H__
fcitx-qimpanel-fcitx-qimpanel-0.1.5/system_tray_menu.cpp 0000664 0000000 0000000 00000032374 12301005766 0023501 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd.
*
* Authors:
* lenky gao lenky0401@gmail.com/gaoqunkai@ubuntukylin.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include
#include
#include
#include
#include
#include
#include
#include "main.h"
#include "my_action.h"
#include "system_tray_menu.h"
#include "config.h"
#ifndef DISABLE_UK_SYNC
#define UBUNTU_KYLIN_SYNC "/[Ubuntu\\ Kylin\\ Sync]/"
#define UBUNTU_KYLIN_SYNC_M "/[Ubuntu Kylin Sync]/"
#endif
SystemTrayMenu::SystemTrayMenu(PanelAgent *agent)
: QMenu()
{
mAgent = agent;
}
SystemTrayMenu::~SystemTrayMenu()
{
delete mVKListMenu;
delete mIMListMenu;
delete mSkinMenu;
#ifndef DISABLE_UK_SYNC
delete mSyncMenu;
#endif
}
void SystemTrayMenu::init()
{
mVKListMenu = new QMenu(tr("Virtual Keyboard"), this);
mIMListMenu = new QMenu(tr("Input Method"), this);
#ifndef DISABLE_UK_SYNC
mSyncMenu = new QMenu(tr("ConfigureSync"),this);
#endif
mSkinMenu = new SkinMenu(tr("Skin"), this);
QObject::connect(mVKListMenu, SIGNAL(aboutToShow()), this,
SLOT(triggerUpdateVKListMenu()));
QObject::connect(mIMListMenu, SIGNAL(aboutToShow()), this,
SLOT(triggerUpdateIMListMenu()));
#ifndef DISABLE_UK_SYNC
QObject::connect(mSyncMenu, SIGNAL(aboutToShow()), this,
SLOT(triggerUpdateSyncMenu()));
#endif
QObject::connect(this, SIGNAL(aboutToShow()), this,
SLOT(triggerUpdateMainMenu()));
QObject::connect(this, SIGNAL(triggered(QAction*)), this,
SLOT(menuItemOnClick(QAction *)));
QObject::connect(mAgent, SIGNAL(execMenu(const QList)),
this, SLOT(execMenu(const QList)));
QObject::connect(mAgent, SIGNAL(registerProperties(const QList)),
this, SLOT(registerProperties(const QList)));
QObject::connect(mAgent, SIGNAL(updateProperty(KimpanelProperty)), this,
SLOT(updateProperty(KimpanelProperty)));
}
void SystemTrayMenu::registerProperties(const QList &props)
{
int count = 0;
mStatusMenuList.clear();
foreach(const KimpanelProperty &prop, props) {
//qDebug() << QString("triggerUpdateMainMenu(1:%1 2:%2 3:%3 4:%4 5:%5 6:%6)").arg(prop.key)
// .arg(prop.label).arg(prop.icon).arg(prop.tip).arg(prop.state).arg(prop.menu);
if (count ++ < StatusMenuSkip)
continue;
if (prop.key == "/Fcitx/vk")
continue;
this->mStatusMenuList << prop;
}
}
void SystemTrayMenu::updateProperty(const KimpanelProperty &prop)
{
if (tr("No input window") == prop.label)
return;
this->mCurtIMLabel = prop.label;
}
void SystemTrayMenu::triggerUpdateMainMenu()
{
MyAction *menu;
this->clear();
this->addAction(QIcon::fromTheme("help-contents"), tr("Online &Help!"));
this->addSeparator();
foreach(const KimpanelProperty &prop, this->mStatusMenuList) {
menu = new MyAction(QIcon::fromTheme(prop.icon), prop.label, this);
menu->setProp(prop);
this->addAction(menu);
}
this->addSeparator();
this->addMenu(mVKListMenu);
this->addMenu(mIMListMenu);
this->addMenu(mSkinMenu);
this->addSeparator();
this->addAction(QIcon::fromTheme("preferences-desktop"), tr("Configure"));
this->addAction(QIcon::fromTheme("preferences-desktop"), tr("ConfigureIMPanel"));
this->addAction(QIcon::fromTheme("preferences-desktop"), tr("ConfigureIM"));
#ifndef DISABLE_UK_SYNC
this->addMenu(mSyncMenu);
#endif
this->addSeparator();
this->addAction(QIcon::fromTheme("view-refresh"), tr("Restart"));
this->addAction(QIcon::fromTheme("application-exit"), tr("Exit"));
}
void SystemTrayMenu::triggerUpdateVKListMenu()
{
mExecMenuType = updateVKListMenu;
mAgent->triggerProperty(QString("/Fcitx/vk"));
}
void SystemTrayMenu::triggerUpdateIMListMenu()
{
mExecMenuType = updateIMListMenu;
mAgent->triggerProperty(QString("/Fcitx/im"));
}
#ifndef DISABLE_UK_SYNC
void SystemTrayMenu::triggerUpdateSyncMenu()
{
mSyncMenu->clear();
mSyncMenu->addAction(QIcon::fromTheme(""), tr("ConfigureUp"));
mSyncMenu->addAction(QIcon::fromTheme(""), tr("ConfigureDwon"));
}
#endif
void SystemTrayMenu::doUpdateVKListMenu(const QList &prop_list)
{
MyAction *menu;
QList::const_iterator iter;
mVKListMenu->clear();
for (iter = prop_list.begin(); iter != prop_list.end(); ++ iter) {
menu = new MyAction(QIcon::fromTheme(iter->icon), iter->label, this);
menu->setProp(*iter);
mVKListMenu->addAction(menu);
}
}
void SystemTrayMenu::doUpdateIMListMenu(const QList &prop_list)
{
bool checked = false;
MyAction *firstMenu = NULL, *menu;
QList::const_iterator iter;
mIMListMenu->clear();
for (iter = prop_list.begin(); iter != prop_list.end(); ++ iter) {
menu = new MyAction(QIcon::fromTheme(iter->icon), iter->label, this);
menu->setProp(*iter);
mIMListMenu->addAction(menu);
if (firstMenu == NULL)
firstMenu = menu;
menu->setCheckable(true);
if (iter->label == this->mCurtIMLabel) {
checked = true;
menu->setChecked(true);
}
}
if (!checked)
firstMenu->setChecked(true);
}
void SystemTrayMenu::execMenu(const QList &prop_list)
{
QList::const_iterator iter;
switch (mExecMenuType) {
case updateVKListMenu:
doUpdateVKListMenu(prop_list);
break;
case updateIMListMenu:
doUpdateIMListMenu(prop_list);
break;
//case updateThemerMenu:
// tmpMenu = mSkinMenu;
// break;
default:
for (iter = prop_list.begin(); iter != prop_list.end(); ++ iter) {
qDebug() << QString("execMenuCallback(1:%1 2:%2 3:%3 4:%4 5:%5 6:%6)").arg(iter->key)
.arg(iter->label).arg(iter->icon).arg(iter->tip).arg(iter->state).arg(iter->menu);
}
break;
}
mExecMenuType = nullExecMenuType;
}
void SystemTrayMenu::restart()
{
/* exec command */
pid_t child_pid;
child_pid = fork();
if (child_pid < 0) {
perror("fork");
} else if (child_pid == 0) { /* child process */
pid_t grandchild_pid;
grandchild_pid = fork();
if (grandchild_pid < 0) {
perror("fork");
_exit(1);
} else if (grandchild_pid == 0) { /* grandchild process */
execvp("fcitx-qimpanel", NULL);
perror("execvp");
_exit(1);
} else {
_exit(0);
}
} else { /* parent process */
int status;
waitpid(child_pid, &status, 0);
_exit(0);
}
}
void SystemTrayMenu::startChildApp(const char *app_exe)
{
/* exec command */
pid_t child_pid;
child_pid = fork();
if (child_pid < 0) {
perror("fork");
} else if (child_pid == 0) { /* child process */
pid_t grandchild_pid;
grandchild_pid = fork();
if (grandchild_pid < 0) {
perror("fork");
_exit(1);
} else if (grandchild_pid == 0) { /* grandchild process */
execvp(app_exe, NULL);
perror("execvp");
_exit(1);
} else {
_exit(0);
}
}
}
#ifndef DISABLE_UK_SYNC
void SystemTrayMenu::syncConfigUp()
{
qDebug()<<"SystemTrayMenu::syncConfigUp";
QString kuaipanConfPath = qgetenv("HOME") + "/.config/ubuntukylin/";
QString kuaipanSyncPath;
QString fcitxQimpanelConfPath = qgetenv("HOME") +"/.config/fcitx-qimpanel/main.conf ";
QString fcitxConfPath = qgetenv("HOME") +"/.config/fcitx/config ";
QDir *temp = new QDir;
QDir *temp1 = new QDir;
if(true == temp->exists(kuaipanConfPath))
{
QSettings* mSettings = new QSettings(kuaipanConfPath + "kuaipan4uk.conf",QSettings::IniFormat);
mSettings->setIniCodec("UTF-8");
mSettings->beginGroup("client-info");
kuaipanSyncPath = mSettings->value("Root").toString();
mSettings->endGroup();
if(true == temp1->exists(kuaipanSyncPath + UBUNTU_KYLIN_SYNC_M))
{
if(false == temp1->exists(kuaipanSyncPath + UBUNTU_KYLIN_SYNC_M"fcitx"))
{
QString cmd = "mkdir " + kuaipanSyncPath +UBUNTU_KYLIN_SYNC +"fcitx";
qDebug()<exists(kuaipanConfPath))
{
QSettings* mSettings = new QSettings(kuaipanConfPath + "kuaipan4uk.conf",QSettings::IniFormat);
mSettings->setIniCodec("UTF-8");
mSettings->beginGroup("client-info");
kuaipanSyncPath = mSettings->value("Root").toString();
mSettings->endGroup();
if(true == temp1->exists(kuaipanSyncPath + UBUNTU_KYLIN_SYNC_M))
{
if(false == temp1->exists(kuaipanSyncPath + UBUNTU_KYLIN_SYNC_M"fcitx"))
{
QMessageBox::warning(this,tr("Warning"),tr("No configure can be synchronized!"));
return;
}
//fcitx-qimpanel
QString cmd1 = "cp " + kuaipanSyncPath +UBUNTU_KYLIN_SYNC"fcitx/main.conf " + fcitxQimpanelConfPath;
QByteArray ba1 = cmd1.toLatin1();
const char *transpd1 = ba1.data();
if(0!= system(transpd1))
{
return;
}
//fcitx
QString cmd2 = "cp " + kuaipanSyncPath +UBUNTU_KYLIN_SYNC"fcitx/config " + fcitxConfPath;
QByteArray ba2 = cmd2.toLatin1();
const char *transpd2 = ba2.data();
if(0!= system(transpd2))
{
return;
}
}
else{
QMessageBox::warning(this,tr("Warning"),tr("[Ubuntu Kylin Sync] Synchronize directories have been deleted?!"));
}
}
else{
QMessageBox::warning(this,tr("Warning"),tr("Please log in kuaipan!"));
}
}
#endif
void SystemTrayMenu::menuItemOnClick(QAction *action)
{
if (tr("Online &Help!") == action->text()) {
QDesktopServices::openUrl(QUrl("http://fcitx-im.org/"));
} else if (tr("ConfigureIM") == action->text()) {
mAgent->triggerProperty(QString("/Fcitx/logo/configureim"));
} else if (tr("ConfigureIMPanel") == action->text()) {
QFile toolFile(getQimpanelBinPath("fcitx-qimpanel-configtool"));
if (!toolFile.exists()) {
QMessageBox::warning(this,tr("Warning"),tr("Please install fcitx-qimpanel-configtool!"));
}
startChildApp("fcitx-qimpanel-configtool");
} else if (tr("Configure") == action->text()) {
mAgent->configure();
} else if (tr("Restart") == action->text()) {
mAgent->restart();
this->restart();
} else if (tr("Exit") == action->text()) {
mAgent->exit();
exit(0);
#ifndef DISABLE_UK_SYNC
} else if (tr("ConfigureUp") == action->text()) {
qDebug()<<"SystemTrayMenu::ConfigureUp";
syncConfigUp();
} else if (tr("ConfigureDwon") == action->text()){
qDebug()<<"SystemTrayMenu::ConfigureDown";
syncConfigDown();
#endif
} else {
MyAction *myAction = (MyAction *)action;
if (myAction->getProp().key != "") {
mAgent->triggerProperty(myAction->getProp().key);
}
}
}
fcitx-qimpanel-fcitx-qimpanel-0.1.5/system_tray_menu.h 0000664 0000000 0000000 00000004535 12301005766 0023144 0 ustar 00root root 0000000 0000000 /*
* Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd.
*
* Authors:
* lenky gao lenky0401@gmail.com/gaoqunkai@ubuntukylin.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#ifndef __SYSTEM_TRAY_MENU_H__
#define __SYSTEM_TRAY_MENU_H__
#include
#include
#include "kimpanelagent.h"
#include
#include
#include
#include "config.h"
#include "skin/skinmenu.h"
enum ExecMenuType
{
nullExecMenuType,
updateVKListMenu,
updateIMListMenu,
//updateThemerMenu,
};
class SystemTrayMenu : public QMenu
{
Q_OBJECT
public:
SystemTrayMenu(PanelAgent *agent);
virtual ~SystemTrayMenu();
void init();
private slots:
void triggerUpdateMainMenu();
void triggerUpdateVKListMenu();
void triggerUpdateIMListMenu();
#ifndef DISABLE_UK_SYNC
void triggerUpdateSyncMenu();
#endif
void menuItemOnClick(QAction* action);
private:
PanelAgent *mAgent;
public slots:
void execMenu(const QList &prop_list);
void registerProperties(const QList &props);
void updateProperty(const KimpanelProperty &prop);
private:
void doUpdateVKListMenu(const QList &prop_list);
void doUpdateIMListMenu(const QList &prop_list);
void startChildApp(const char *app_exe);
#ifndef DISABLE_UK_SYNC
void syncConfigUp();
void syncConfigDown();
#endif
public:
void restart();
private:
QString mCurtIMLabel;
//前两个用不到,见后端KimpanelRegisterAllStatus()函数
#define StatusMenuSkip (2)
QList mStatusMenuList;
SkinMenu *mSkinMenu;
QMenu *mVKListMenu;
QMenu *mIMListMenu;
#ifndef DISABLE_UK_SYNC
QMenu *mSyncMenu;
#endif
ExecMenuType mExecMenuType;
};
#endif // __SYSTEM_TRAY_MENU_H__
fcitx-qimpanel-fcitx-qimpanel-0.1.5/toplevel.cpp 0000664 0000000 0000000 00000007543 12301005766 0021724 0 ustar 00root root 0000000 0000000 /***************************************************************************
* Copyright (C) 2013 by CSSlayer *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
#include
#include
#include
#include
#include
#include
#include "toplevel.h"
TopLevel::TopLevel(QWidget* parent) : QWidget(parent,
Qt::Tool | Qt::WindowStaysOnTopHint
| Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint)
{
setAttribute(Qt::WA_TranslucentBackground, true);
QVBoxLayout *lay = new QVBoxLayout(this);
lay->setMargin(0);
lay->setSpacing(0);
setLayout(lay);
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
}
void TopLevel::setCenterWidget(QWidget* widget)
{
if (m_widget) {
m_widget->removeEventFilter(this);
layout()->removeWidget(m_widget);
}
m_widget = widget;
widget->installEventFilter(this);
widget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
layout()->addWidget(widget);
layout()->activate();//?
}
void TopLevel::showEvent(QShowEvent* event)
{
QWidget::showEvent(event);
setMask(rect());
updateLocation();
}
bool TopLevel::eventFilter(QObject* object, QEvent* event)
{
if (object == m_widget.data() &&
event->type() == QEvent::Resize) {
setMinimumSize(m_widget->sizeHint());
setMaximumSize(m_widget->sizeHint());
}
return QObject::eventFilter(object, event);
}
void TopLevel::resizeEvent(QResizeEvent* resize)
{
QWidget::resizeEvent(resize);
setMask(rect());
updateLocation();
}
void TopLevel::setSpotRect(const QRect& rect)
{
m_spotRect = rect;
updateLocation();
}
void TopLevel::updateLocation()
{
QRect screenRect = QApplication::desktop()->screenGeometry(QPoint(m_spotRect.x(), m_spotRect.y()));
int x;
x = qMin(m_spotRect.x(), screenRect.x() + screenRect.width() - width());
x = qMax(x, screenRect.x());
int oy = m_spotRect.y() + m_spotRect.height();
int y = oy + 10;
if (y < screenRect.y()) {
y = screenRect.y();
}
if (y > screenRect.y() + screenRect.height()) {
y = screenRect.height();
}
if (y + height() > screenRect.y() + screenRect.height()) {
/// minus 20 to make preedit bar never overlap the input context
y = oy - (height() + ((m_spotRect.height() == 0)?20:(m_spotRect.height() + 10)));
}
QPoint p(x, y);
if (p != pos())
move(p);
}
void TopLevel::setTopLevelVisible(bool aux, bool preedit, bool lookupTable)
{
this->setVisible(aux || preedit || lookupTable);
}
fcitx-qimpanel-fcitx-qimpanel-0.1.5/toplevel.h 0000664 0000000 0000000 00000003706 12301005766 0021366 0 ustar 00root root 0000000 0000000 /***************************************************************************
* Copyright (C) 2013 by CSSlayer *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
#ifndef _TOPLEVEL_H_
#define _TOPLEVEL_H_
#include
#include
class TopLevel : public QWidget
{
Q_OBJECT
public:
explicit TopLevel(QWidget* parent = 0);
void setCenterWidget(QWidget* widget);
virtual void showEvent(QShowEvent* event);
virtual void resizeEvent(QResizeEvent* resize);
virtual bool eventFilter(QObject* object, QEvent* event);
void setSpotRect(const QRect& rect);
void setTopLevelVisible(bool aux, bool preedit, bool lookupTable);
private:
void updateLocation();
QPointer m_widget;
QRect m_spotRect;
};
#endif
fcitx-qimpanel-fcitx-qimpanel-0.1.5/uk-default-skin/ 0000775 0000000 0000000 00000000000 12301005766 0022360 5 ustar 00root root 0000000 0000000 fcitx-qimpanel-fcitx-qimpanel-0.1.5/uk-default-skin/CMakeLists.txt 0000664 0000000 0000000 00000000404 12301005766 0025116 0 ustar 00root root 0000000 0000000
set(pkgbindir /usr/bin/)
set(pkgdatadir /usr/share/fcitx-qimpanel)
foreach(skin ubuntukylin-dark1 ubuntukylin-dark2 ubuntukylin-light1 ubuntukylin-light2)
install(DIRECTORY ${skin} DESTINATION ${pkgdatadir}/skin)
endforeach(skin default classic dark)
fcitx-qimpanel-fcitx-qimpanel-0.1.5/uk-default-skin/ubuntukylin-dark1/ 0000775 0000000 0000000 00000000000 12301005766 0025751 5 ustar 00root root 0000000 0000000 fcitx-qimpanel-fcitx-qimpanel-0.1.5/uk-default-skin/ubuntukylin-dark1/fcitx_skin.conf 0000664 0000000 0000000 00000016142 12301005766 0030765 0 ustar 00root root 0000000 0000000 #备注:此皮肤conf文件作为范本,包含有各个字段的详细说明。
# --- By Lenky 2013-9-12
[SkinInfo]
#名词
Name=ubuntukylin-dark1
#版本
Version=0.1
#作者
Author=Ou Yangyu
#描述
Desc=ubuntukylin-dark1
[SkinFont]
#输入字符串的字体大小,以points为单位计算
FontSize=13
#候选词前的数字标号和候选词的字体大小,以points为单位计算
CandFontSize=13
#输入字符串的字体颜色,按RGB的十进制计算,比如#1a9bff则为:十六进制1a为十进制25,十六进制9b为十进制155,十六进制ff为十进制255
InputColor=26 155 255
#候选词前的数字标号的字体颜色
IndexColor=255 255 255
#首选候选词的字体颜色
FirstCandColor=26 155 255
#其他候选词的字体颜色
OtherColor=255 255 255
#==================================================
#以下字段在qim-panel暂时没用到,仅为了兼容fcitx
#因为默认启动fcitx时,会检查皮肤文件是否正确,如果没有下面这些字段,
#那么检查结果为错误,导致把皮肤退回为default,导致再启动qim-panel就
#使用的也是default了。
TipColor=162 181 255
UserPhraseColor=255 255 143
CodeColor=26 155 255
ActiveMenuColor=255 255 255
InactiveMenuColor=178 178 178
[SkinMainBar]
BackImg=bar.png
Logo=logo.png
Eng=en.png
Active=cn.png
MarginLeft=8
MarginRight=8
MarginTop=8
MarginBottom=8
[SkinTrayIcon]
Active=active.png
Inactive=inactive.png
[SkinMenu]
BackImg=menu.png
MarginLeft=8
MarginRight=8
MarginTop=8
MarginBottom=8
ActiveColor=50 87 244
LineColor=204 204 204
[SkinKeyboard]
# Virtual Keyboard Image
BackImg=keyboard.png
# Key Color On Virutal Keyboard
KeyColor=101 153 209
#以上字段在qim-panel暂时没用,仅为了兼容fcitx
#==================================================
#说明1:以下几个坐标以均以整个面板的左上角为原点(0, 0)
# (0, 0)
# ----------------------------------->
# |
# | (x, y)
# |
# |
# |
# |
# V
#说明2:输入面板主要有四个元素,分别为输入字符串(InputString),候选词(OutputCand),左翻页(BackArrow),右翻页(ForwardArrow)
#默认的横向布局为(以5个候选词为例):
# ---------------------------------------------------------------------------
# | [InputString] [BackArrow] [ForwardArrow] |
# | [OutputCand1] [OutputCand2] [OutputCand3] [OutputCand4] [OutputCand5] |
# ---------------------------------------------------------------------------
#默认的纵向布局为:
# -------------------------------------------------
# | [InputString] [BackArrow] [ForwardArrow] |
# | [OutputCand1] |
# | [OutputCand2] |
# | [OutputCand3] |
# | [OutputCand4] |
# | [OutputCand5] |
# -------------------------------------------------
#说明3:所有文本或图片的配置坐标均以其左上角为准,所以,如果填写负数的话,需要考虑把文本或图片的宽和高预计在内
#说明4:因为整个输入面板的宽和高是动态变化的,其计算方法是:
#高:四个元素InputString OutputCand BackArrow ForwardArrow中靠最下方的那个元素的bottom值 再 加上 MarginBottom + AdjustHeight 为整个面板的高度
#宽:四个元素InputString OutputCand BackArrow ForwardArrow中靠最右方的那个元素的right值 再 加上 MarginRight + AdjustWidth 为整个面板的宽度
#横向布局
[SkinInputBar]
#面板宽度调节,可正可负,默认为0
AdjustWidth=0
#面板高度调节,可正可负,默认为0
AdjustHeight=0
#输入面板时的背景图片
BackImg=input.png
#切换时提示信息的背景图片
TipsImg=tips.png
#关于皮肤九宫格的特性可以参考:http://qt-project.org/doc/qt-4.8/qml-borderimage.html
#简单点说就是:左上、左下、右上、右下,这四个角落不会被拉伸,而上下会水平拉伸,左右会垂直拉伸,而中间既会水平拉伸,也会垂直拉伸
#因此要把一些不让变形的logo等图片放置在左上、左下、右上、右下,这四个区域
#下面这个值用于标记整个九宫格布局
#九宫格的左边距
MarginLeft=17
#九宫格的右边距,必须为正数,表示离右边的距离
MarginRight=39
#九宫格的上边距
MarginTop=25
#九宫格的下边距,必须为正数,表示离下边的距离
MarginBottom=10
#水平拉伸时填充方式,可选值:Stretch,伸缩填充;Repeat,重复填充;Round,重复填充,但可以保证最后一个重复也是完整的,因此会进行适当伸缩
#默认为Stretch
horizontalTileMode=Stretch
#垂直拉伸时填充方式,可选值:Stretch,伸缩填充;Repeat,重复填充;Round,重复填充,但可以保证最后一个重复也是完整的,因此会进行适当伸缩
#默认为Stretch
verticalTileMode=Stretch
#输入字符串位置X坐标,为0则默认为MarginLeft,为负数则从最右边往左推进的距离
InputStringPosX=0
#输入字符串位置Y坐标,为0则默认为MarginTop,为负数则从最底边往上推进的距离
InputStringPosY=6
#输出候选词位置X坐标,为0则默认为MarginLeft,为负数则从最右边往左推进的距离
OutputCandPosX=0
#输出候选词位置Y坐标,为0则默认为(MarginTop + 输入字符串的高度),为负数则从最底边往上推进的距离
OutputCandPosY=30
#左翻页图片
BackArrow=prev.png
#左翻页图片位置X坐标,为0则默认为从最右边往左推进的(左翻页图片宽度 + 右翻页图片宽度 + 15)的距离,为负数则从最右边往左推进的距离
BackArrowX=0
#左翻页图片位置Y坐标,为0则默认为InputStringPosY,为负数则从最底边往上推进的距离
BackArrowY=0
#右翻页图片
ForwardArrow=next.png
#右翻页图片位置X坐标,为0则默认为从最右边往左推进的(右翻页图片宽度 + 10)的距离,为负数则从最右边往左推进的距离
ForwardArrowX=0
#右翻页图片位置Y坐标,为0则默认为InputStringPosY,为负数则从最底边往上推进的距离
ForwardArrowY=0
#==================================================
#以下字段在qim-panel暂时没用到,仅为了兼容fcitx
#因为默认启动fcitx时,会检查皮肤文件是否正确,如果没有下面这些字段,
#那么检查结果为错误,导致把皮肤退回为default,导致再启动qim-panel就
#使用的也是default了。
InputPos=0
OutputPos=26
BackArrowX=20
BackArrowY=6
ForwardArrowX=10
ForwardArrowY=6
CursorColor=255 255 255
#==================================================
#纵向布局
#说明:如果和横向布局的配置一致,纵向布局里可以不用重复设置
#比如横向布局里的FontSize为16,如果纵向布局里的FontSize也是16,那么可以不配置该字段或配置该字段为0
[SkinFontVertical]
[SkinInputBarVertical]
#面板宽度调节,可正可负
AdjustWidth=10
#面板高度调节,可正可负
AdjustHeight=-30
BackImg=input_v.png
MarginTop=33
MarginBottom=48
fcitx-qimpanel-fcitx-qimpanel-0.1.5/uk-default-skin/ubuntukylin-dark1/input.png 0000664 0000000 0000000 00000020605 12301005766 0027621 0 ustar 00root root 0000000 0000000 PNG
IHDR > tEXtSoftware Adobe ImageReadyqe<