pax_global_header00006660000000000000000000000064122557470520014523gustar00rootroot0000000000000052 comment=350ebc1817ceaff21aeb7b170d5240cd48590e45 fcitx-qimpanel-configtool-fcitx-qimpanel-configtool-0.1.5/000077500000000000000000000000001225574705200236705ustar00rootroot00000000000000fcitx-qimpanel-configtool-fcitx-qimpanel-configtool-0.1.5/.gitignore000066400000000000000000000002161225574705200256570ustar00rootroot00000000000000*~ build*/ .* !.git* .git/ *.tar.* *.kdev4 *.kate-swp *.orig tags Makefile fcitx-qimpanel-configtool *.o astyle.sh cscope.* *.part *.pro.user fcitx-qimpanel-configtool-fcitx-qimpanel-configtool-0.1.5/LICENSE000066400000000000000000000000001225574705200246630ustar00rootroot00000000000000fcitx-qimpanel-configtool-fcitx-qimpanel-configtool-0.1.5/README.md000066400000000000000000000006061225574705200251510ustar00rootroot00000000000000fcitx-qimpanel-configtool INSTALL cd fcitx-qimpanel-configtool 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 qmake make sudo make install ======================== A qt4.8 based configurae tool for fcitx-qimpanel. This is a qt-creator project. fcitx-qimpanel-configtool-fcitx-qimpanel-configtool-0.1.5/TODO000066400000000000000000000000501225574705200243530ustar00rootroot000000000000001,横排竖排 2,当前使用皮肤 fcitx-qimpanel-configtool-fcitx-qimpanel-configtool-0.1.5/candidate_word.cpp000066400000000000000000000021711225574705200273440ustar00rootroot00000000000000/* * 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" #include 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-configtool-fcitx-qimpanel-configtool-0.1.5/candidate_word.h000066400000000000000000000031201225574705200270040ustar00rootroot00000000000000/* * 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-configtool-fcitx-qimpanel-configtool-0.1.5/editingskindialog.cpp000066400000000000000000000323761225574705200300770ustar00rootroot00000000000000#include #include #include #include #include #include #include #include #include #include #include "editingskindialog.h" #include "ui_editingskindialog.h" #define FCITXSKINSYSTEM_PATH "/usr/share/fcitx-qimpanel/skin/" EditingSkinDialog::EditingSkinDialog(bool pHorizontal,QListWidgetItem *item, QWidget *parent) : QDialog(parent), ui(new Ui::EditingSkinDialog) { ui->setupUi(this); localPath = qgetenv("HOME") + "/.config/fcitx-qimpanel/skin/"; ui->EditingSkinTabWidget->setCurrentIndex(0); mItem = item; mHorizontal = pHorizontal; ui->lineEditSkinAuthor->setEnabled(false); ui->lineEditSkinVersion->setEnabled(false); this->setWindowTitle("skin/"+mItem->text()+"/fcitx_skin.conf"); if(mItem->text().indexOf("(local)")==-1) { mSettings = new QSettings(FCITXSKINSYSTEM_PATH + mItem->text() + "/fcitx_skin.conf",QSettings::IniFormat); mSettings->setIniCodec("UTF-8"); } else { mSettings = new QSettings(localPath + mItem->text().mid(0,mItem->text().indexOf("(local)")) + "/fcitx_skin.conf",QSettings::IniFormat); mSettings->setIniCodec("UTF-8"); } loadMainConf(); } EditingSkinDialog::~EditingSkinDialog() { mSettings->sync(); delete mSettings; delete mSkinFcitx; delete ui; } void EditingSkinDialog::loadMainConf() { mSettings->beginGroup("SkinInfo"); QString skinAuthor = mSettings->value("Author").toString(); QString skinVersion = mSettings->value("Version").toString(); ui->lineEditSkinAuthor->setText(skinAuthor); ui->lineEditSkinVersion->setText(skinVersion); mSettings->endGroup(); mSettings->beginGroup("SkinFont"); int fontSize = mSettings->value("FontSize").toInt(); int candFontSize = mSettings->value("CandFontSize").toInt(); QString inputColor = mSettings->value("InputColor").toString(); QString indexColor = mSettings->value("IndexColor").toString(); QString firstCandColor = mSettings->value("FirstCandColor").toString(); QString otherColor = mSettings->value("OtherColor").toString(); inputColorConf = inputColor; indexColorConf = indexColor; firstCandColorConf = firstCandColor; otherColorConf = otherColor; ui->spinBoxInputFontSize->setValue(fontSize); ui->spinBoxCandFontSize->setValue(candFontSize); ui->pushButtonInputColor->setStyleSheet("QPushButton { background-color: " + colorToRGB(value2color(inputColor)) +";border: none;" +"}"); ui->pushButtonIndexColor->setStyleSheet("QPushButton { background-color: " + colorToRGB(value2color(indexColor)) +";border: none;" +"}"); ui->pushButtonFirstCandColor->setStyleSheet("QPushButton { background-color: " + colorToRGB(value2color(firstCandColor)) +";border: none;" +"}"); ui->pushButtonOtherCandColor->setStyleSheet("QPushButton { background-color: " + colorToRGB(value2color(otherColor)) +";border: none;" +"}"); mSettings->endGroup(); mSettings->beginGroup("SkinInputBar"); QString backImg = mSettings->value("BackImg").toString(); QString tipsImg = mSettings->value("TipsImg").toString(); int marginLeft = mSettings->value("MarginLeft").toInt(); int marginRight = mSettings->value("MarginRight").toInt(); int marginTop = mSettings->value("MarginTop").toInt(); int marginBottom = mSettings->value("MarginBottom").toInt(); int inputStringPosX = mSettings->value("InputStringPosX").toInt(); int inputStringPosY = mSettings->value("InputStringPosY").toInt(); int outputCandPosX = mSettings->value("OutputCandPosX").toInt(); int outputCandPosY = mSettings->value("OutputCandPosY").toInt(); QString backArrow = mSettings->value("BackArrow").toString(); int backArrowX = mSettings->value("BackArrowX").toInt(); int backArrowY = mSettings->value("BackArrowY").toInt(); QString forwardArrow = mSettings->value("ForwardArrow").toString(); int forwardArrowX = mSettings->value("ForwardArrowX").toInt(); int forwardArrowY = mSettings->value("ForwardArrowY").toInt(); int adjustWidth = mSettings->value("AdjustWidth").toInt(); int adjustHeight = mSettings->value("AdjustHeight").toInt(); mSettings->endGroup(); mSettings->beginGroup("SkinInputBarVertical"); int adjustWidth_v = mSettings->value("AdjustWidth").toInt(); int adjustHeight_v = mSettings->value("AdjustHeight").toInt(); QString backImg_v = mSettings->value("BackImg").toString(); int marginTop_v = mSettings->value("MarginTop").toInt(); int marginBottom_v = mSettings->value("MarginBottom").toInt(); mSettings->endGroup(); ui->lineEdit_iTipsImg->setText(tipsImg); ui->spinBox_iLeftMargin->setValue(marginLeft); ui->spinBox_iRightMargin->setValue(marginRight); ui->spinBox_iInputStringPosX->setValue(inputStringPosX); ui->spinBox_iInputStringPosY->setValue(inputStringPosY); ui->spinBox_iOutputCandPosX->setValue(outputCandPosX); ui->spinBox_iOutputCandPosY->setValue(outputCandPosY); ui->lineEdit_iBackArrow->setText(backArrow); ui->spinBox_iBackArrowX->setValue(backArrowX); ui->spinBox_iBackArrowY->setValue(backArrowY); ui->lineEdit_iForwardArrow->setText(forwardArrow); ui->spinBox_iForwardArrowX->setValue(forwardArrowX); ui->spinBox_iForwardArrowY->setValue(forwardArrowY); if(mHorizontal == true) { ui->spinBox_iAdjustHeight->setValue(adjustHeight); ui->spinBox_iAdjustWidth->setValue(adjustWidth); ui->lineEdit_iBackImg->setText(backImg); ui->spinBox_iTopMargin->setValue(marginTop); ui->spinBox_iBottomMargin->setValue(marginBottom); } else { ui->spinBox_iAdjustHeight->setValue(adjustHeight_v); ui->spinBox_iAdjustWidth->setValue(adjustWidth_v); ui->lineEdit_iBackImg->setText(backImg_v); ui->spinBox_iTopMargin->setValue(marginTop_v); ui->spinBox_iBottomMargin->setValue(marginBottom_v); } } void EditingSkinDialog::saveMainConf() { QDir *temp = new QDir; if(false == temp->exists(localPath + mItem->text().mid(0,mItem->text().indexOf("(local)")))) { QString cmd = "cp -R /usr/share/fcitx-qimpanel/skin/" + mItem->text() +" "+ localPath ; qDebug()<text().mid(0,mItem->text().indexOf("(local)")) + "/fcitx_skin.conf",QSettings::IniFormat); mSettings->setIniCodec("UTF-8"); mSettings->beginGroup("SkinFont"); int fontSize = ui->spinBoxInputFontSize->value(); int candFontSize = ui->spinBoxCandFontSize->value(); mSettings->setValue("FontSize",fontSize); mSettings->setValue("CandFontSize",candFontSize); mSettings->setValue("InputColor",inputColorConf); mSettings->setValue("IndexColor",indexColorConf); mSettings->setValue("FirstCandColor",firstCandColorConf); mSettings->setValue("OtherColor",otherColorConf); mSettings->endGroup(); mSettings->beginGroup("SkinInputBar"); QString tipsImg = ui->lineEdit_iTipsImg->text(); int marginLeft = ui->spinBox_iLeftMargin->value(); int marginRight = ui->spinBox_iRightMargin->value(); int inputStringPosX = ui->spinBox_iInputStringPosX->value(); int inputStringPosY = ui->spinBox_iInputStringPosY->value(); int outputCandPosX = ui->spinBox_iOutputCandPosX->value(); int outputCandPosY = ui->spinBox_iOutputCandPosY->value(); QString backArrow = ui->lineEdit_iBackArrow->text(); int backArrowX = ui->spinBox_iBackArrowX->value(); int backArrowY = ui->spinBox_iBackArrowY->value(); QString forwardArrow = ui->lineEdit_iForwardArrow->text(); int forwardArrowX = ui->spinBox_iForwardArrowX->value(); int forwardArrowY = ui->spinBox_iForwardArrowY->value(); int marginTop = ui->spinBox_iTopMargin->value(); int marginBottom = ui->spinBox_iBottomMargin->value(); QString backImg = ui->lineEdit_iBackImg->text(); int adjustWidth = ui->spinBox_iAdjustWidth->value(); int adjustHeight = ui->spinBox_iAdjustHeight->value(); mSettings->setValue("TipsImg",tipsImg); mSettings->setValue("MarginLeft",marginLeft); mSettings->setValue("MarginRight",marginRight); mSettings->setValue("InputStringPosX",inputStringPosX); mSettings->setValue("InputStringPosY",inputStringPosY); mSettings->setValue("OutputCandPosX",outputCandPosX); mSettings->setValue("OutputCandPosY",outputCandPosY); mSettings->setValue("BackArrow",backArrow); mSettings->setValue("BackArrowX",backArrowX); mSettings->setValue("BackArrowY",backArrowY); mSettings->setValue("ForwardArrow",forwardArrow); mSettings->setValue("ForwardArrowX",forwardArrowX); mSettings->setValue("ForwardArrowY",forwardArrowY); if(mHorizontal == true) { mSettings->setValue("MarginTop",marginTop); mSettings->setValue("MarginBottom",marginBottom); mSettings->setValue("BackImg",backImg); mSettings->setValue("AdjustWidth",adjustWidth); mSettings->setValue("AdjustHeight",adjustHeight); } mSettings->endGroup(); mSettings->beginGroup("SkinInputBarVertical"); int marginTop_v = ui->spinBox_iTopMargin->value(); int marginBottom_v = ui->spinBox_iBottomMargin->value(); QString backImg_v = ui->lineEdit_iBackImg->text(); int adjustWidth_v = ui->spinBox_iAdjustWidth->value(); int adjustHeight_v = ui->spinBox_iAdjustHeight->value(); if(mHorizontal == false) { mSettings->setValue("MarginTop",marginTop_v); mSettings->setValue("MarginBottom",marginBottom_v); mSettings->setValue("BackImg",backImg_v); mSettings->setValue("AdjustWidth",adjustWidth_v); mSettings->setValue("AdjustHeight",adjustHeight_v); } mSettings->endGroup(); mSettings->sync(); } void EditingSkinDialog::on_pushButton_ok_released() { if(mItem->text().indexOf("(local)")==-1) { QString cmd = "cp -R /usr/share/fcitx-qimpanel/skin/" + mItem->text() +" "+ localPath ; qDebug()<accept(); } void EditingSkinDialog::on_pushButton_cannel_released() { this->close(); } void EditingSkinDialog::on_pushButton_refresh_released() { if(mItem->text().indexOf("(local)")!=-1) { QString cmd = "rm -rf " + localPath + mItem->text().mid(0,mItem->text().indexOf("(local)")); qDebug()<pushButtonInputColor->setStyleSheet("QPushButton { background-color: " + str +";border: none;" +"}"); } } void EditingSkinDialog::on_pushButtonIndexColor_released() { QColorDialog::setCustomColor(0,QRgb(0x0000FF)); QColor color = QColorDialog::getColor(QColor(0,0,255)); QString str; if(color.isValid()){ str.sprintf("rgb(%d,%d,%d)",color.red(), color.green(), color.blue()); indexColorConf.sprintf("%d %d %d",color.red(),color.green(),color.blue()); ui->pushButtonIndexColor->setStyleSheet("QPushButton { background-color: " + str +";border: none;" +"}"); } } void EditingSkinDialog::on_pushButtonFirstCandColor_released() { QColorDialog::setCustomColor(0,QRgb(0x0000FF)); QColor color = QColorDialog::getColor(QColor(0,0,255)); QString str; if(color.isValid()){ str.sprintf("rgb(%d,%d,%d)",color.red(), color.green(), color.blue()); firstCandColorConf.sprintf("%d %d %d",color.red(),color.green(),color.blue()); ui->pushButtonFirstCandColor->setStyleSheet("QPushButton { background-color: " + str +";border: none;" +"}"); } } void EditingSkinDialog::on_pushButtonOtherCandColor_released() { QColorDialog::setCustomColor(0,QRgb(0x0000FF)); QColor color = QColorDialog::getColor(QColor(0,0,255)); QString str; if(color.isValid()){ str.sprintf("rgb(%d,%d,%d)",color.red(), color.green(), color.blue()); otherColorConf.sprintf("%d %d %d",color.red(),color.green(),color.blue()); ui->pushButtonOtherCandColor->setStyleSheet("QPushButton { background-color: " + str +";border: none;" +"}"); } } QString EditingSkinDialog::colorToRGB(QColor color) { QString str; str.sprintf("rgb(%d,%d,%d)",color.red(), color.green(), color.blue()); return str; } QColor EditingSkinDialog::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); } fcitx-qimpanel-configtool-fcitx-qimpanel-configtool-0.1.5/editingskindialog.h000066400000000000000000000024211225574705200275300ustar00rootroot00000000000000#ifndef EDITINGSKINDIALOG_H #define EDITINGSKINDIALOG_H #include #include #include #include namespace Ui { class EditingSkinDialog; } class EditingSkinDialog : public QDialog { Q_OBJECT public: explicit EditingSkinDialog(bool pHorizontal,QListWidgetItem *item ,QWidget *parent = 0); ~EditingSkinDialog(); private slots: void on_pushButtonInputColor_released(); void on_pushButton_ok_released(); void on_pushButton_refresh_released(); void on_pushButton_cannel_released(); void on_pushButtonIndexColor_released(); void on_pushButtonFirstCandColor_released(); void on_pushButtonOtherCandColor_released(); private: Ui::EditingSkinDialog *ui; QSettings *mSettings; SkinFcitx *mSkinFcitx; QListWidgetItem *mItem; int horizontalTileModeIndex; int verticalTileModeIndex; QString inputColorConf; QString indexColorConf; QString firstCandColorConf; QString otherColorConf; QString localPath; bool mHorizontal; private: void loadMainConf(); void saveMainConf(); QString colorToRGB(QColor color); QColor value2color(const QString& value); void copySkinConf(); }; #endif // EDITINGSKINDIALOG_H fcitx-qimpanel-configtool-fcitx-qimpanel-configtool-0.1.5/editingskindialog.ui000066400000000000000000000717431225574705200277330ustar00rootroot00000000000000 EditingSkinDialog 0 0 615 470 Dialog true 480 360 2 false SkinInfo 0 0 Version Author Qt::Vertical 20 288 SkinFont 170 0 170 16777215 FontSize 170 0 170 16777215 CandFontSize 170 0 170 16777215 InputColor 170 0 170 16777215 IndexColor 170 0 170 16777215 FirstCandColor 170 0 170 16777215 OtherColor Qt::Vertical 20 148 SkinInputBar true 0 0 557 660 170 0 170 16777215 BackImg 170 0 170 16777215 TipsImg 170 0 170 16777215 MarginLeft 170 0 170 16777215 MarginRight 170 0 170 16777215 MarginTop 170 0 170 16777215 MarginBottom 170 0 170 16777215 InputStringPosX 170 0 170 16777215 InputStringPosY 170 0 170 16777215 OutputCandPosX 170 0 170 16777215 OutputCandPosY 170 0 170 16777215 BackArrow 170 0 170 16777215 BackArrowX 170 0 170 16777215 BackArrowY 170 0 170 16777215 ForwardArrow 170 0 170 16777215 ForwardArrowX 170 0 170 16777215 ForwardArrowY 170 0 170 16777215 AdjustWidth -99 170 0 170 16777215 AdjustHeight -99 100 27 100 27 &Refresh Qt::Horizontal 178 20 100 16777215 &Ok 100 16777215 0 0 &Cannel fcitx-qimpanel-configtool-fcitx-qimpanel-configtool-0.1.5/fcitx-qimpanel-configtool.desktop000066400000000000000000000004651225574705200323520ustar00rootroot00000000000000[Desktop Entry] Name=fcitx-qimpanel-configtool Name[zh_CN]=小企鹅皮肤配置向导 Comment=fcitx皮肤配置向导-UbuntuKylin Exec=/usr/bin/fcitx-qimpanel-configtool Icon=fcitx_ubuntukylin.png StartupNotify=true Terminal=false Type=Application Categories=GNOME;GTK;RasterGraphics;Viewer;Utility;Network; fcitx-qimpanel-configtool-fcitx-qimpanel-configtool-0.1.5/fcitx-qimpanel-configtool.pro000066400000000000000000000020661225574705200315000ustar00rootroot00000000000000#------------------------------------------------- # # Project created by QtCreator 2013-10-10T11:17:48 # #------------------------------------------------- ARCH = x86 inst1.files += fcitx_ubuntukylin.png inst1.path = /usr/share/pixmaps inst2.files += fcitx-qimpanel-configtool.desktop inst2.path = /usr/share/applications inst3.files += po/fcitx_skin_zh_CN.qm inst3.path = /usr/share/fcitx-qimpanel target.source += $$TARGET target.path = /usr/bin INSTALLS += inst1 \ inst2 \ inst3 \ target QT += core gui declarative dbus TARGET = fcitx-qimpanel-configtool LIBS += -lfcitx-qt -lfcitx-config -lfcitx-utils -lQtDBus CONFIG += SOURCES += main.cpp \ mainwindow.cpp \ main_model.cpp \ skin/skinbase.cpp \ skin/skinfcitx.cpp \ candidate_word.cpp \ editingskindialog.cpp HEADERS += mainwindow.h \ main_model.h \ skin/skinbase.h \ kimpanelagenttype.h \ candidate_word.h \ editingskindialog.h \ skin/skinfcitx.h FORMS += mainwindow.ui \ editingskindialog.ui RESOURCES += \ main.qrc OTHER_FILES += fcitx-qimpanel-configtool-fcitx-qimpanel-configtool-0.1.5/fcitx_ubuntukylin.png000066400000000000000000000044061225574705200301700ustar00rootroot00000000000000PNG  IHDR//B4mtEXtSoftwareAdobe ImageReadyqe<IDATxbl0 A$a3$@6 J}Rc@!^bC q(?3Ld@X(wEqn_L< @+bx%|7 j¡~|`efr~f'9v#"Iǯ?LPQxކ.z^qƴ7!ʻ1]S% w=pX|?PU59SE#߿lLc`dD( B?" L̈X?h V9dq?s߿9 oog+W}s8w,L%l{f,Ói/PE@Qnt31 ߿s"-uчZ[}gdbUd/3+Ԟpbb񜁅`=c`da Bbl "QGAqE8sϿmn  ' \`05c"`C6D.U1`"†y\~ǯ&5XGNQ.1$Sfľ N<0CbsL-)C_{ ,Zg$ cgu7c/'ȉ'K"|+䌋g:'T[/pEGomY5Z^0}JDn,xX\|L LYXh I*ٌn?HLQ \~?q)dF.d/ǥ  "Y.LÁyY#qTjK1"͗ȦH?{b@L])s.VA,jgy.qѿ͎2?}YyH #e!).FLӋ4РOXM۽Y3$>E.egkjB@XmA ” ،efCMu 7P}`5߿oC62\hZ *sPW)xXSv3 #sInOE_W|p=8!bhP_$O|Y1'O ĩ=>.,3K_d7bBv>9S0Qb*q- AXzD1!S /at7%._8UT+m*қ"nT6fo *ՁrS>&9ure2}SSAa ;>/$JWO*]3I?uEDdR1EddaCD$00  "Hˢ N!0gN?cA*KU% i}65,Ф)+XJ 4|׃IENDB`fcitx-qimpanel-configtool-fcitx-qimpanel-configtool-0.1.5/kimpanelagenttype.h000066400000000000000000000057751225574705200276000ustar00rootroot00000000000000/*************************************************************************** * 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-configtool-fcitx-qimpanel-configtool-0.1.5/main.cpp000066400000000000000000000034311225574705200253210ustar00rootroot00000000000000#include #include #include #include #include #include #include "mainwindow.h" #include #include #define FCITXSKIN_PATH "/usr/share/fcitx-qimpanel/skin/ " #define BUFF_SIZE (512) char sharePath[BUFF_SIZE] = {0}; int main(int argc, char *argv[]) { 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("/usr/share/fcitx-qimpanel/fcitx_skin_zh_CN.qm") == false) // if (translator.load(QString(getQimpanelSharePath("fcitx_skin_zh_CN.qm"))) == false) qDebug() << "load qm error."; QApplication app(argc, argv); app.installTranslator(&translator); app.setApplicationName("fcitx-qimpanel-configtool"); QString localPath = qgetenv("HOME") + "/.config/"; QDir *temp = new QDir; if(false == temp->exists(localPath + "fcitx-qimpanel")) { QString cmd = "mkdir " + localPath +"fcitx-qimpanel"; QByteArray ba = cmd.toLatin1(); const char *transpd = ba.data(); if(0!= system(transpd)) { return 0; } } QString localPath2 = qgetenv("HOME") + "/.config/fcitx-qimpanel/"; QDir *temp2 = new QDir; if(false == temp2->exists(localPath2 + "skin")) { QString cmd2 = "mkdir " + localPath2 +"skin"; QByteArray ba2 = cmd2.toLatin1(); const char *transpd2 = ba2.data(); if(0!= system(transpd2)) { return 0 ; } } MainWindow mainWindow; mainWindow.show(); return app.exec(); } fcitx-qimpanel-configtool-fcitx-qimpanel-configtool-0.1.5/main.qml000066400000000000000000000203341225574705200253310ustar00rootroot00000000000000import QtQuick 1.1 Rectangle { id: mainWindow objectName: "mainWindowQml" visible : true border.color: "#0080FF" border.width: mainSkin.inputBackImg ? 0 : 1 color: "transparent" BorderImage { id:borderInputBackImage visible : true anchors.fill: mainWindow border { left: mainSkin.marginLeft; top: mainSkin.marginTop; right: mainSkin.marginRight; bottom: mainSkin.marginBottom; } source: mainSkin.inputBackImg } Text { id: inputString visible : true text: "ni hao" font.pointSize :mainSkin.fontSize//mainSkin.candFontSize != 0 ? mainSkin.candFontSize : mainSkin.fontSize color: mainSkin.inputColor } Row { id: horizontal visible :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: { // } // } } } } Column { id: vertical visible : !mainModel.isHorizontal Repeater { model: mainModel.candidateWords Text { id: candidateWordVertical text: "" + cddLabel + "" + "" + cddText + "" + " " font.pointSize : mainSkin.candFontSize != 0 ? mainSkin.candFontSize : mainSkin.fontSize // MouseArea { // anchors.fill: parent // onClicked: { // } // } } } } Image { id: prev_page source: mainSkin.backArrowImg opacity: 0.5 MouseArea { anchors.fill: parent onClicked: { } } } Image { id: next_page source: mainSkin.forwardArrowImg MouseArea { anchors.fill: parent onClicked: { } } } 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 onQmlMainWindowSizeChanged: { var tmp; var width, width1; var height, height1; width = mainSkin.marginLeft; width1 = 0; height = mainSkin.marginTop; height1 = 0; 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 (mainSkin.outputCandPosX > 0) { if (mainModel.isHorizontal) tmp = horizontal.x + horizontal.width; else tmp = vertical.x + vertical.width; width = max(width, tmp); // console.log(width) } 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); // console.log(height); } else { height1 = max(height1, -mainSkin.outputCandPosY); } 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-configtool-fcitx-qimpanel-configtool-0.1.5/main.qrc000066400000000000000000000001421225574705200253200ustar00rootroot00000000000000 main.qml fcitx-qimpanel-configtool-fcitx-qimpanel-configtool-0.1.5/main_model.cpp000066400000000000000000000163361225574705200265110ustar00rootroot00000000000000/* * 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() { mCurrentCandidateWordNum = 5; //默认为5 setIsHorizontal(true); } MainModel::~MainModel() { } void MainModel::resetData() { setCandidateWords(); setInputString(""); setHasPrev(false); setHasNext(false); setInputStringCursorPos(-1); setHighLight(-1); //这个不属于焦点切换时需要重置的值 } 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 qmlMainWindowSizeChanged(); } 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() { CandidateWord *candidate; QStringList label; QStringList text; int i = 0; switch (mCurrentCandidateWordNum) { case 1: label.append("1."); text.append("你好"); break; case 2: label.append("1."); text.append("你好"); label.append("2."); text.append("你"); break; case 3: label.append("1."); text.append("你好"); label.append("2."); text.append("你"); label.append("3."); text.append("拟"); break; case 4: label.append("1."); text.append("你好"); label.append("2."); text.append("你"); label.append("3."); text.append("拟"); label.append("4."); text.append("尼"); break; case 5: label.append("1."); text.append("你好"); label.append("2."); text.append("你"); label.append("3."); text.append("拟"); label.append("4."); text.append("尼"); label.append("5."); text.append("呢"); break; case 6: label.append("1."); text.append("你好"); label.append("2."); text.append("你"); label.append("3."); text.append("拟"); label.append("4."); text.append("尼"); label.append("5."); text.append("呢"); label.append("6."); text.append("泥"); break; case 7: label.append("1."); text.append("你好"); label.append("2."); text.append("你"); label.append("3."); text.append("拟"); label.append("4."); text.append("尼"); label.append("5."); text.append("呢"); label.append("6."); text.append("泥"); label.append("7."); text.append("妳"); break; case 8: label.append("1."); text.append("你好"); label.append("2."); text.append("你"); label.append("3."); text.append("拟"); label.append("4."); text.append("尼"); label.append("5."); text.append("呢"); label.append("6."); text.append("泥"); label.append("7."); text.append("妳"); label.append("8."); text.append("妮"); break; case 9: label.append("1."); text.append("你好"); label.append("2."); text.append("你"); label.append("3."); text.append("拟"); label.append("4."); text.append("尼"); label.append("5."); text.append("呢"); label.append("6."); text.append("泥"); label.append("7."); text.append("妳"); label.append("8."); text.append("妮"); label.append("9."); text.append("腻"); break; case 10: label.append("1."); text.append("你好"); label.append("2."); text.append("你"); label.append("3."); text.append("拟"); label.append("4."); text.append("尼"); label.append("5."); text.append("呢"); label.append("6."); text.append("泥"); label.append("7."); text.append("妳"); label.append("8."); text.append("妮"); label.append("9."); text.append("腻"); label.append("0."); text.append("逆"); break; default: break; } qDeleteAll(mCandidateWords); mCandidateWords.clear(); for(i=0;isetCddLabel(label.at(i)); candidate->setCddText(text.at(i)); mCandidateWords.append(candidate); } emit candidateWordsChanged(); emit qmlMainWindowSizeChanged(); } 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 qmlMainWindowSizeChanged(); } bool MainModel::isHorizontal() const { return mIsHorizontal; } void MainModel::emitSigMainWindowSizeChanged() { emit qmlMainWindowSizeChanged(); } fcitx-qimpanel-configtool-fcitx-qimpanel-configtool-0.1.5/main_model.h000066400000000000000000000061751225574705200261560ustar00rootroot00000000000000/* * 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 "kimpanelagenttype.h" #include "candidate_word.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) 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(); 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; int currentCandidateWordNum(int Num); void emitSigMainWindowSizeChanged(); signals: void inputStringChanged(); void tipsStringChanged(); void candidateWordsChanged(); void hasPrevChanged(); void hasNextChanged(); void highLightChanged(); void isHorizontalChanged(); void currentCandidateWordNumChanged(); void qmlMainWindowSizeChanged(); private: QString mInputString; QString mTipsString; QList mCandidateWords; bool mHasPrev; bool mHasNext; int mHighLight; bool mIsHorizontal; bool mShowTips; bool mShowPreedit; bool mShowLookupTable; int mCurrentCandidateWordNum; }; #endif // __MAIN_MODEL_H__ fcitx-qimpanel-configtool-fcitx-qimpanel-configtool-0.1.5/mainwindow.cpp000066400000000000000000000346511225574705200265610ustar00rootroot00000000000000#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "mainwindow.h" #include "ui_mainwindow.h" #define FCITXSKINSYSTEM_PATH "/usr/share/fcitx-qimpanel/skin/" MainWindow::MainWindow(QWidget *parent) : QDialog(parent), ui(new Ui::MainWindow) { ui->setupUi(this); qmlRegisterType();//注册CandidateWord列表到qml qmlView = new QDeclarativeView; mSkinFcitx = new SkinFcitx; mMainModer = MainModel::self(); mSettings = new QSettings("fcitx-qimpanel", "main"); mSettings->setIniCodec("UTF-8"); mLayout = new QHBoxLayout(ui->widgetSkinPreview); localPath = qgetenv("HOME") + "/.config/fcitx-qimpanel/skin/"; this->setWindowTitle(tr("Qimpanel Settings")); loadMainConf(); ui->tabWidget->setCurrentIndex(0); ui->listWidgetAllSkin->setCurrentRow(0); mMainModer->resetData(); changeMainWindowSize(); connect(ui->pushButtonCancel, SIGNAL(clicked()), this, SLOT(sltOnPushButtonCancel())); connect(ui->pushButtonApply, SIGNAL(clicked()), this, SLOT(sltOnPushButtonApply())); connect(ui->tabWidget, SIGNAL(currentChanged(QWidget *)), this, SLOT(sltOnCurrentChanged(QWidget *))); connect(ui->listWidgetAllSkin, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(sltOnAllSkinItemDoubleClicked(QListWidgetItem*))); connect(ui->listWidgetAllSkin, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(sltOnAllSkinItemClicked(QListWidgetItem *))); connect(ui->comboBoxSkinType,SIGNAL(currentIndexChanged(int)),this,SLOT(setListWidgetAllSkinIndex(int))); linkQtDbusServer(); } MainWindow::~MainWindow() { mSettings->sync(); if(mSettings!=NULL) delete mSettings; delete ui; } void MainWindow::changeMainWindowSize() { int y = 0; int x = 0; if (ui->radioButtonVertical->isChecked()) { y = 120; this->setFixedSize(560+x, 360 + y); ui->tabWidget->setFixedHeight(311 + y); ui->tabWidget->setFixedWidth(561 + x); ui->widgetSkinPreview->setFixedWidth(381 + x); ui->widgetSkinPreview->setFixedHeight(121 + y + 40); ui->pushButtonCancel->setGeometry(360+x, 320 + y, 81, 31); ui->pushButtonApply->setGeometry(450+x, 320 + y, 81, 31); } else { this->setFixedSize(560+x, 360 + y); ui->tabWidget->setFixedHeight(311 + y); ui->tabWidget->setFixedWidth(561 + x); ui->widgetSkinPreview->setFixedWidth(381 + x); ui->widgetSkinPreview->setFixedHeight(121 + y + 40); ui->pushButtonCancel->setGeometry(360+x, 320 + y, 81, 31); ui->pushButtonApply->setGeometry(450+x, 320 + y, 81, 31); } } void MainWindow::sltOnCurrentChanged(QWidget *tab) { if (tab == ui->tabSkinDesign) { changeMainWindowSize(); } } void MainWindow::sltOnAllSkinItemDoubleClicked(QListWidgetItem *item) { if(curtSkinType.indexOf("local")==-1) { QString localPath= "/usr/share/fcitx-qimpanel/skin/"+ curtSkinType.mid(0,curtSkinType.indexOf("(local)")); qDebug()<exists(localPath + "/skin.ini")) { QMessageBox::information(this,tr("tips"),tr("Sougo Skin does not support preview and edit!")); } else{ EditingSkinDialog * editingSkinDialog = new EditingSkinDialog(ui->radioButtonHorizontal->isChecked(),item); editingSkinDialog->exec(); refreshListWidgetAllSkin(); } } else{ QString localPath= qgetenv("HOME") + "/.config/fcitx-qimpanel/skin/"+ curtSkinType.mid(0,curtSkinType.indexOf("(local)")); qDebug()<exists(localPath + "/skin.ini")) { QMessageBox::information(this,tr("tips"),tr("Sougo Skin does not support preview and edit!")); } else{ EditingSkinDialog * editingSkinDialog1 = new EditingSkinDialog(ui->radioButtonHorizontal->isChecked(),item); editingSkinDialog1->exec(); refreshListWidgetAllSkin(); } } } void MainWindow::sltOnAllSkinItemClicked(QListWidgetItem *current) { curtSkinType = current->text(); if(curtSkinType.indexOf("local")==-1) { QString localPath= "/usr/share/fcitx-qimpanel/skin/"+ curtSkinType.mid(0,curtSkinType.indexOf("(local)")); qDebug()<exists(localPath + "/skin.ini")) { QMessageBox::information(this,tr("tips"),tr("Sougo Skin does not support preview and edit!")); } else{ setSkinBase(); } } else{ QString localPath= qgetenv("HOME") + "/.config/fcitx-qimpanel/skin/"+ curtSkinType.mid(0,curtSkinType.indexOf("(local)")); qDebug()<exists(localPath + "/skin.ini")) { QMessageBox::information(this,tr("tips"),tr("Sougo Skin does not support preview and edit!")); } else{ setSkinBase(); } } ui->comboBoxSkinType->setCurrentIndex(ui->listWidgetAllSkin->currentRow());//感觉如果加入其它皮肤会出bug } void MainWindow::searchAndSetSystemSkin() { skinPath = FCITXSKINSYSTEM_PATH; int count = 0; QDir skinDir; QFileInfoList list; QFileInfoList::Iterator iter; skinDir = QDir(skinPath); systemSkin_list.clear(); if (!skinDir.exists()) return; skinDir.setFilter(QDir::Dirs); list = skinDir.entryInfoList(); for (iter = list.begin(); iter != list.end(); ++ iter) { if (iter->isDir() && "." != iter->fileName() && ".." != iter->fileName()) { QFile fcitxSkinConfFile_conf(iter->absoluteFilePath() + "/fcitx_skin.conf"); QFile fcitxSkinConfFile_ini(iter->absoluteFilePath() + "/skin.ini"); if (!fcitxSkinConfFile_conf.exists()&&!fcitxSkinConfFile_ini.exists()) continue; SkinTypeEntry entry; entry.name = iter->fileName(); entry.absolutePath = iter->absoluteFilePath(); //allSkinType.append(entry); if (curtSkinType == entry.name) { idx = count; } // ui->comboBoxSkinType->addItem(entry.name); systemSkin_list.append(entry.name); // ui->listWidgetAllSkin->addItem(entry.name); count ++; } } // ui->listWidgetAllSkin->setCurrentRow(idx); // ui->comboBoxSkinType->setCurrentIndex(idx); } void MainWindow::searchAndSetLocalSkin() { int idx = 0; int count = 0; QDir skinDir; QFileInfoList list; QFileInfoList::Iterator iter; skinDir = QDir(localPath); localSkin_list.clear(); if (!skinDir.exists()) { qDebug()<isDir() && "." != iter->fileName() && ".." != iter->fileName()) { QFile fcitxSkinConfFile_conf(iter->absoluteFilePath() + "/fcitx_skin.conf"); QFile fcitxSkinConfFile_ini(iter->absoluteFilePath() + "/skin.ini"); if (!fcitxSkinConfFile_conf.exists()&&!fcitxSkinConfFile_ini.exists()) continue; SkinTypeEntry entry; entry.name = iter->fileName(); entry.absolutePath = iter->absoluteFilePath(); if (curtSkinType == entry.name) { idx = count; } if(ui->listWidgetAllSkin) localSkin_list.append(entry.name+"(local)"); // ui->listWidgetAllSkin->addItem(entry.name+"(local)"); count ++; } } // ui->listWidgetAllSkin->setCurrentRow(idx); } void MainWindow::loadSkinPreview() { qDebug()<<"MainWindow::loadSkinPreview"; setSkinBase(); } void MainWindow::loadMainConf() { bool verticalList; //QString curtSkinType; mSettings->beginGroup("base"); verticalList = mSettings->value("VerticalList", false).toBool(); curtSkinType = mSettings->value("CurtSkinType", "ubuntukylin-dark1").toString(); mSettings->endGroup(); ui->radioButtonVertical->setChecked(verticalList); ui->radioButtonHorizontal->setChecked(!verticalList); searchAndSetLocalSkin(); searchAndSetSystemSkin(); showListWidgetAllSkin(); loadSkinPreview(); } void MainWindow::saveMainConf() { qDebug()<<"MainWindow::saveMainConf"; bool verticalList; mSettings->beginGroup("base"); verticalList = ui->radioButtonVertical->isChecked(); curtSkinType = ui->comboBoxSkinType->currentText(); qDebug()<<"MainWindow::saveMainConf()"<setValue("VerticalList", verticalList); mSettings->setValue("CurtSkinType", curtSkinType); qDebug()<<"MainWindow::saveMainConf()"<endGroup(); } void MainWindow::setSkinBase() { SkinFcitx* skin = new SkinFcitx; mLayout->removeWidget(qmlView); if(curtSkinType.indexOf("(local)")==-1) { skin->loadSkin(skinPath + curtSkinType + "/"); } else { skin->loadSkin(localPath + curtSkinType.mid(0,curtSkinType.indexOf("(local)")) + "/"); } if (mSkinFcitx != skin) delete mSkinFcitx; mSkinFcitx = skin; qmlView->rootContext()->setContextProperty("mainSkin", mSkinFcitx);//把qt程序暴露到qml qmlView->rootContext()->setContextProperty("mainModel", mMainModer); qmlView->setSource(QUrl("qrc:/new/prefix1/main.qml")); mLayout->addWidget(qmlView); mMainModer->emitSigMainWindowSizeChanged(); } void MainWindow::sltOnPushButtonApply() { saveMainConf(); static int flag = 0; static int timeFlag = QTime::currentTime().secsTo(QTime(1970,1,1)); int currentTime = QTime::currentTime().secsTo(QTime(1970,1,1)); qDebug()<< timeFlag; qDebug()<< currentTime; if(((timeFlag - currentTime) > 1)||(flag == 0)) { flag ++; // qDebug()<<"MainWindow::sltOnPushButtonApply()->killall -HUP"; timeFlag = QTime::currentTime().secsTo(QTime(1970,1,1)); // QString cmd2 = "killall -HUP fcitx-qimpanel"; // QByteArray ba2 = cmd2.toLatin1(); // const char * transpd2 = ba2.data(); // if(0!= system(transpd2)) // { // return ; // } emit sigRestartQimpanel(); } } void MainWindow::sltOnPushButtonCancel() { this->close(); } void MainWindow::on_radioButtonHorizontal_toggled(bool checked) { mMainModer->setIsHorizontal(checked); setSkinBase(); changeMainWindowSize(); } void MainWindow::showListWidgetAllSkin() { QList::Iterator iter_system; QList::Iterator iter_local; QString tmp_systemList; QString tmp_localList; bool flag = true;// for (iter_system = systemSkin_list.begin(); iter_system != systemSkin_list.end(); ++ iter_system) { tmp_systemList = *iter_system; for(iter_local = localSkin_list.begin(); iter_local != localSkin_list.end(); ++ iter_local){ tmp_localList = *iter_local; if(tmp_localList.mid(0,tmp_localList.indexOf("(local)")) == tmp_systemList){ ui->listWidgetAllSkin->addItem(tmp_localList); ui->comboBoxSkinType->addItem(tmp_localList.mid(0,tmp_localList.indexOf("(local)"))); qDebug()<listWidgetAllSkin->addItem(tmp_systemList); ui->comboBoxSkinType->addItem(tmp_systemList); } flag = true; } ui->comboBoxSkinType->setCurrentIndex(idx); ui->listWidgetAllSkin->setCurrentRow(idx); } void MainWindow::refreshListWidgetAllSkin() { disconnect(ui->listWidgetAllSkin, SIGNAL(itemDoubleClicked(QListWidgetItem*)),0, 0); disconnect(ui->listWidgetAllSkin, SIGNAL(itemClicked(QListWidgetItem*)),0,0); ui->listWidgetAllSkin->clear(); connect(ui->listWidgetAllSkin, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(sltOnAllSkinItemDoubleClicked(QListWidgetItem*))); connect(ui->listWidgetAllSkin, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(sltOnAllSkinItemClicked(QListWidgetItem *))); searchAndSetLocalSkin(); searchAndSetSystemSkin(); ui->comboBoxSkinType->clear(); showListWidgetAllSkin(); qDebug()<<"MainWindow::refreshListWidgetAllSkin()"; } void MainWindow::setListWidgetAllSkinIndex(int index) { ui->listWidgetAllSkin->setCurrentRow(index); } void MainWindow::linkQtDbusServer() { myInterface = new QDBusInterface("com.fcitx_qimpanel.hotel", "/", "com.fcitx_qimpanel.hotel", QDBusConnection::sessionBus()); if(!myInterface->isValid()) { qDebug()<< qPrintable(QDBusConnection::sessionBus().lastError().message()); } else{ QObject::connect(this,SIGNAL(sigRestartQimpanel()),myInterface,SLOT(qtDbusSot_restartQimpanel())); } // QDBusMessage m = QDBusMessage::createMethodCall("com.fcitx_qimpanel.hotel", // "/", // "com.fcitx_qimpanel.hotel", // "selectCandidate"); // m << 8; // QDBusMessage response = QDBusConnection::sessionBus().call(m); // // 判断Method是否被正确返回 // if (response.type() == QDBusMessage::ReplyMessage) { // // QDBusMessage的arguments不仅可以用来存储发送的参数,也用来存储返回值; // // 这里取得checkIn的返回值 // int num_room = response.arguments().takeFirst().toInt(); // printf("Got %d %s\n", num_room, (num_room > 1) ? "rooms" : "room"); // } else { // fprintf(stderr, "Check In fail!\n"); // } } fcitx-qimpanel-configtool-fcitx-qimpanel-configtool-0.1.5/mainwindow.h000066400000000000000000000033141225574705200262160ustar00rootroot00000000000000#ifndef MAINWINDOW_H #define MAINWINDOW_H #include #include #include #include #include #include #include "skin/skinbase.h" #include "skin/skinfcitx.h" #include "main_model.h" #include "candidate_word.h" #include "editingskindialog.h" #include namespace Ui { class MainWindow; } struct SkinTypeEntry { QString name; QString absolutePath; }; class MainWindow : public QDialog { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); QSettings *mSettings; ~MainWindow(); private: Ui::MainWindow *ui; QString skinPath; QList allSkinType; SkinFcitx *mSkinFcitx; MainModel *mMainModer; QDeclarativeView *qmlView; QHBoxLayout *mLayout; QString curtSkinType; QString localPath; QStringList systemSkin_list; QStringList localSkin_list; int idx; QDBusInterface * myInterface; private: void searchAndSetSystemSkin( ); void searchAndSetLocalSkin( ); void loadMainConf(); void saveMainConf(); void loadSkinPreview(); void changeMainWindowSize(); void setSkinBase(); void showListWidgetAllSkin(); void setListWidgetAllSkin(); void refreshListWidgetAllSkin(); void linkQtDbusServer(); private slots: void sltOnPushButtonApply(); void sltOnPushButtonCancel(); void sltOnAllSkinItemDoubleClicked(QListWidgetItem *item); void sltOnAllSkinItemClicked(QListWidgetItem *current); void sltOnCurrentChanged(QWidget *tab); void on_radioButtonHorizontal_toggled(bool checked); void setListWidgetAllSkinIndex(int index); signals: void sigRestartQimpanel(); }; #endif // MAINWINDOW_H fcitx-qimpanel-configtool-fcitx-qimpanel-configtool-0.1.5/mainwindow.ui000066400000000000000000000117521225574705200264110ustar00rootroot00000000000000 MainWindow 0 0 560 360 Dialog 450 320 81 31 &Apply 360 320 81 31 &Cancel 0 0 561 311 1 Appearance 19 20 161 31 Vertical List: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter 205 20 241 31 Horizontal true 205 50 241 31 Vertical 59 99 120 31 Skin Type: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter true 211 98 200 31 Skin Design 90 10 381 101 -40 10 120 31 All Skin: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter -40 136 121 31 Preview: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter 90 150 381 121 88 115 461 20 Description: Click to select and preview, double-click local to edit, save locally. fcitx-qimpanel-configtool-fcitx-qimpanel-configtool-0.1.5/po/000077500000000000000000000000001225574705200243065ustar00rootroot00000000000000fcitx-qimpanel-configtool-fcitx-qimpanel-configtool-0.1.5/po/ReadMe.txt000066400000000000000000000003621225574705200262050ustar00rootroot00000000000000wuxiaoyi@wuxiaoyi-HP-Pavilion-Sleekbook-15-PC:~/桌面/fcitx-qimpanel-configtool$ lupdate . -ts po/fcitx_skin_zh_CN.ts Scanning directory '.'... Updating 'po/fcitx_skin_zh_CN.ts'... Found 61 source text(s) (61 new and 0 already existing) fcitx-qimpanel-configtool-fcitx-qimpanel-configtool-0.1.5/po/fcitx_skin_zh_CN.qm000066400000000000000000000065401225574705200300740ustar00rootroot00000000000000y: Horizontal MainWindoweHgPreview: MainWindowQel՗bgnQimpanel Settings MainWindowv Skin Design MainWindow_SRMOu(v: Skin Type: MainWindow N e/csougovT-Sougo Skin does not support preview and edit! MainWindowzTf>y:Vertical MainWindowP Rhf>y:Vertical List: MainWindow S`cy:tips MainWindowfcitx-qimpanel-configtool-fcitx-qimpanel-configtool-0.1.5/po/fcitx_skin_zh_CN.ts000066400000000000000000000223171225574705200301050ustar00rootroot00000000000000 EditingSkinDialog SkinInfo 字体信息 Version 皮肤版本 Author 皮肤作者 SkinFont 皮肤字体 FontSize 输入字体大小 CandFontSize 候选词字体大小 InputColor 输入字符串字体颜色 IndexColor 候选词前数字字体颜色 FirstCandColor 首候选词字体颜色 OtherColor 其他候选次词字体颜色 SkinInputBar 皮肤输入框设置 BackImg 背景图片 TipsImg 切换时提示信息背景图片 MarginLeft 左边距 MarginRight 右边距 MarginTop 上边距 MarginBottom 下边距 HorizontalTileMode 水平拉伸时填充方式 VerticalTileMode 垂直拉伸时填充颜色 InputStringPosX 输入字符串位置X坐标 InputStringPosY 输入字符串位置Y坐标 OutputCandPosX 输出候选词位置X坐标 OutputCandPosY 输出候选词位置Y坐标 BackArrow 左翻页图片 BackArrowX 左翻页图片位置X坐标 BackArrowY 左翻页图片位置Y坐标 ForwardArrow 右翻页图片 ForwardArrowX 右翻页图片位置X坐标 ForwardArrowY 右翻页图片位置Y坐标 AdjustWidth 面板宽度调节 AdjustHeight 面板高度调节 &Ok 确定(O) &Cannel 取消(C) Dialog Tips 友情提示: &Refresh 恢复默认(R) tips 友情提示: The default configuration has been restored 该皮肤已经恢复默认配置。 MainWindow &Apply 应用(A) &Cancel 取消(C) Appearance 外观设置 Vertical List: 候选词列表显示: Horizontal 横向显示 Vertical 竖向显示 Skin Type: 当前使用皮肤: Candidate Word Numer: 候选词个数: FontSize: 字体大小: Skin Design 皮肤设计 All Skin: 所有皮肤 Preview: 效果预览 Qimpanel Settings 输入法面板设置 Dialog Description: Click to select and preview, double-click local to edit, save locally. 单击选择并预览,双击创造本地配置或者进行编辑。 tips 友情提示: Sougo Skin does not support preview and edit! 不支持sougo皮肤预览和编辑! PasswardDialog passward: 密码: &Ok 确定(O) &Cannel 取消(C) Password authentication 密码验证 Please enter your password, and give permissions to ensure successful configuration changes! 请输入您的密码,给予修改配置文件的权限。 succeed, please wait! 密码正确,请稍等! passward error,try again! 密码错误,请重新输入。 Warning 警告! server doesn't run, Modifications will not be saved! 配置文件没有修改成功! fcitx-qimpanel-configtool-fcitx-qimpanel-configtool-0.1.5/skin/000077500000000000000000000000001225574705200246345ustar00rootroot00000000000000fcitx-qimpanel-configtool-fcitx-qimpanel-configtool-0.1.5/skin/skinbase.cpp000066400000000000000000000275261225574705200271530ustar00rootroot00000000000000/* * 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() { mSkinAuthor = ""; mSkinName = ""; mSkinVersion = ""; //横排配置填默认值 mInputBackImg = ""; 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"; //竖排配置填写零值,而不是默认值,因为在实际使用时,如果判断其为零值,那么会自动返回对应的横排值 mInputBackImgVertical = ""; 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 = ""; } 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 skinAuthorChanged(); emit skinNameChanged(); emit skinVersionChanged(); emit inputBackImgChanged(); 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::setSkinName(const QString skinName) { mSkinName = skinName; } QString SkinBase::skinName() const { return mSkinName; } void SkinBase::setSkinVersion(const QString skinVersion) { mSkinVersion = skinVersion; } QString SkinBase::skinVersion() const { return mSkinVersion; } void SkinBase::setSkinAuthor(const QString skinAuthor) { mSkinAuthor = skinAuthor; } QString SkinBase::skinAuthor() const { return mSkinAuthor; } void SkinBase::setInputBackImg(const QString inputBackImg) { mInputBackImg = inputBackImg; } QString SkinBase::inputBackImg() const { if (MainModel::self()->isHorizontal() || mInputBackImgVertical=="") { return mInputBackImg; } else { return mInputBackImgVertical; } } 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) // { // qDebug()<<"mFontSize"<isHorizontal() || mCandFontSizeVertical == 0) { // qDebug()<<"mCandFontSize"<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-configtool-fcitx-qimpanel-configtool-0.1.5/skin/skinbase.h000066400000000000000000000277221225574705200266160ustar00rootroot00000000000000/* * 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 //SkinInfo Q_PROPERTY(QString skinName READ skinName WRITE setSkinName NOTIFY skinNameChanged) Q_PROPERTY(QString skinVersion READ skinVersion WRITE setSkinVersion NOTIFY skinVersionChanged) Q_PROPERTY(QString skinAuthor READ skinAuthor WRITE setSkinAuthor NOTIFY skinAuthorChanged) //SkinInputBar Q_PROPERTY(QString inputBackImg READ inputBackImg WRITE setInputBackImg NOTIFY inputBackImgChanged) 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: //SkinInfo void setSkinName(const QString skinName); QString skinName()const; void setSkinVersion(const QString skinVersion); QString skinVersion() const; void setSkinAuthor(const QString skinAuthor); QString skinAuthor() const; //SkinInputBar void setInputBackImg(const QString inputBackImg); QString inputBackImg() 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 skinNameChanged(); void skinVersionChanged(); void skinAuthorChanged(); void inputBackImgChanged(); 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 SkinInfo QString mSkinName; QString mSkinVersion; QString mSkinAuthor; QString mSkinDesc; //Fcitx SkinInputBar QString mInputBackImg; 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 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(); void reloadSkin(); void init(); protected: QColor value2color(const QString& value); }; #endif //__SKIN_BASE_H__ fcitx-qimpanel-configtool-fcitx-qimpanel-configtool-0.1.5/skin/skinfcitx.cpp000066400000000000000000000172261225574705200273520ustar00rootroot00000000000000/* * 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 "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-configtool-fcitx-qimpanel-configtool-0.1.5/skin/skinfcitx.h000066400000000000000000000017461225574705200270170ustar00rootroot00000000000000/* * 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-configtool-fcitx-qimpanel-configtool-0.1.5/skin/skinmenu.cpp000066400000000000000000000040261225574705200271730ustar00rootroot00000000000000/* * 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 "mainwindow.h" #include "skinfcitx.h" #include "main_model.h" SkinMenu::SkinMenu(const QString &title, QWidget *parent) : QMenu(title, parent) { triggerUpdateSkinListMenu(); 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; QDir skinDir; QFileInfoList list; QFileInfoList::Iterator iter; this->clear(); char* ukSkinPath = getQimpanelSharePath("uk-default-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"); if (!fcitxSkinConfFile.exists()) continue; } } } } fcitx-qimpanel-configtool-fcitx-qimpanel-configtool-0.1.5/skin/skinmenu.h000066400000000000000000000021431225574705200266360ustar00rootroot00000000000000/* * 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); }; #endif // __SKIN_MENU_H__