适配平板

This commit is contained in:
jishengjie 2022-10-21 15:02:45 +08:00
parent 5357b3187f
commit 7ef05e51c9
44 changed files with 1056 additions and 987 deletions

142
README.md Normal file
View File

@ -0,0 +1,142 @@
## 麒麟计算器
### 项目运行方式
chmod 777 ./run
./run kylin-calculator
### 更新历史
#### 20210611 09:08 cl
1.0.31kord15
解决键盘输入一位数,界面显示两位数的问题
#### 20210519 13:39 jdy
1.0.31kord13
优化n次方/n次方根计算流程:禁止多次连续点击n次方/n次方根连续点击操作
#### 20210419 17:09 cl
1.0.31kord10
创建DBus服务最小化后再次启动应用时拉起主界面
#### 20210419 16:38 jdy
1.0.31kord9
添加新版日志
修复一个debug模式发现的段错误
#### 20210416 11:15 jdy
1.0.31kord8
根据新版设计稿修改应用名称
#### 20210401 11:46 cl
1.0.31kord7
修复bug 34897 44911
实现需求 输入过长时字号变小,删除或清除时字号变大
#### 20210330 09:47 jdy
1.0.31kord6
修复bug 45498 45469
#### 20210127 18:58 jdy
1.0.31
#### 20210126 19:21 cl
修复BUG 27685 27661 32782
重构界面切换逻辑
实现前端组件复用
1.0.30 kord1~rc1
#### 20210125 21:54 jdy
移动翻译文件到translations
删除二进制pm文件
#### 20210123 17:40 jdy
1.0.30
#### 20210116 09:27 jdy
1.0.29
#### 20210115 13:58 cl
1.0.28 Update Desktop
#### 20210114 19:55 cl
Fix bug 33043 汇率模式点击“00”无反应
#### 20210112 10:08 cl
1.0.27
#### 20210109 09:02 jdy
1.0.26
#### 20210108 15:55 jdy
1.0.25
#### 20210108 15:00 jdy
1.0.24
#### 20210107 10:45 cl
1.0.23
增加菜单栏 (不完善未添加gsetting)
#### 20201230 20:19 cl
1.0.23
汇率模式及汇率列表适配主题颜色
#### 20201229 14:45 jdy
1.0.23
#### 20201229 10:23 cl
1.0.22
适配主题颜色和三联按钮样式
#### 20201219 20:57 cl
1.0.21
适配4K屏标题栏按钮样式和三联保持一致
#### 20201214 20:57 jdy
1.0.20
#### 20201205 11:21 jdy
1.0.19
#### 20201204 20:28 jdy
1.0.18
#### 20201202 17:15 jdy
1.0.17~rc
合并dev代码
#### 20201202 13:54 jdy
1.0.16版本
#### 20201127 15:37 jdy
1.0.15版本
#### 20201124 11:03 jdy
生成字符串处理md
合并dev代码
#### 20201124 10:16 cl
生成ts和qm文件
#### 20201119 15:16 cl
适配desktop文件藏文翻译
#### 20201113 20:00 cl
汇率换算历史记录ANS按钮
#### 20201111 17:18 cl
开发2nd按钮和Rad按钮功能实现三角函数和反三角函数替换以及弧度角度替换
#### 20201111 17:25 jdy
合并dev分支代码 解决闪退bug
#### 20201107 15:53 jdy
合并dev分支代码
#### 20201107 15:01 cl
将汇率换算模式下的历史记录转换为相应的历史记录使用unitConvHistory函数对原本的历史记录进行转换。
#### 20201107 09:58 cl
将计算器各个模式下的按钮替换为BasicButton使用图片作为显示重写setText和text函数从而保证按钮显示不受系统字体影响。

View File

@ -20,31 +20,31 @@
#include "InputProcess.h"
QVector<QString> InputProcess::res = QVector<QString>{ZERO, ZERO, EMPTY,EMPTY,EMPTY,EMPTY};
QVector<QString> InputProcess::res = QVector<QString> {ZERO, ZERO, EMPTY, EMPTY, EMPTY, EMPTY};
QString InputProcess::qstrNow = ZERO;
QString InputProcess::qstrPrepare = EMPTY;
QString InputProcess::labelNow = ZERO;
QString InputProcess::qstrNow = ZERO;
QString InputProcess::qstrPrepare = EMPTY;
QString InputProcess::labelNow = ZERO;
QString InputProcess::labelPrepare = EMPTY;
QString InputProcess::calAns = EMPTY;
QString InputProcess::lastAns = EMPTY;
QString InputProcess::calAns = EMPTY;
QString InputProcess::lastAns = EMPTY;
QStringList InputProcess::calHistory = QStringList();
InputJudgmentGraph InputProcess::G = InputJudgmentGraph();
int InputProcess::i_couldBeCalFlag = -1;
int InputProcess::i_qstrAddFlag = -1;
int InputProcess::i_couldBeCalFlag = -1;
int InputProcess::i_qstrAddFlag = -1;
int InputProcess::i_qstrNowUpdateFlag = -1;
int InputProcess::i_qstrUpdateFlag = -1;
int InputProcess::i_qstrUpdateFlag = -1;
void InputProcess::init()
{
qstrNow = ZERO;
qstrPrepare = EMPTY;
labelNow = ZERO;
qstrNow = ZERO;
qstrPrepare = EMPTY;
labelNow = ZERO;
labelPrepare = EMPTY;
lastAns = EMPTY;
res = QVector<QString>{ZERO , ZERO , EMPTY , EMPTY , EMPTY , EMPTY};
lastAns = EMPTY;
res = QVector<QString> {ZERO, ZERO, EMPTY, EMPTY, EMPTY, EMPTY};
}
/* 判断该字符是否可以添加到表达式中 */
@ -82,7 +82,7 @@ int InputProcess::qstrAdd(const QString &text)
/* 当上个字符为 右括号 或 数字 时进行添加 */
if (ch == BRACKET_R || ZERO_TO_NINE.contains(ch)) {
qstrNow += BRACKET_R;
if (findBracketPair(qstrNow , qstrNow.size() - 1) != -1) {
if (findBracketPair(qstrNow, qstrNow.size() - 1) != -1) {
return CORRECT_QSTR_ADD;
}
qstrNow.chop(1);
@ -127,7 +127,7 @@ int InputProcess::qstrAdd(const QString &text)
/* 00 判断 */
if (text == DOUBLE_ZERO) {
if (qstrNow.size() == 0 || qstrNow.size() == 1 && qstrNow == ZERO || ch == ANS_END || ch == SCI_NUM_END ) {
if (qstrNow.size() == 0 || qstrNow.size() == 1 && qstrNow == ZERO || ch == ANS_END || ch == SCI_NUM_END) {
return CANNOT_ADD_DOUBLE_ZERO;
}
@ -154,7 +154,8 @@ int InputProcess::qstrAdd(const QString &text)
QString tempQstr = getNumberFromBack(qstrNow);
if (tempQstr.contains(POINT) || tempQstr.contains(PERCENT) || isCorrectInt(getNumberFromBack(qstrNow)).first != 1 ) {
if (tempQstr.contains(POINT) || tempQstr.contains(PERCENT)
|| isCorrectInt(getNumberFromBack(qstrNow)).first != 1) {
return CANNOT_ADD_POINT;
}
@ -206,7 +207,7 @@ int InputProcess::qstrAdd(const QString &text)
return CORRECT_QSTR_ADD;
}
if (formulaOrNum == 2 || formulaOrNum == -2 || formulaOrNum == -1) {
if (formulaOrNum == 2 || formulaOrNum == -2 || formulaOrNum == -1) {
qstrNow = text + BRACKET_L + qstrNow + BRACKET_R;
return CORRECT_QSTR_ADD;
}
@ -216,21 +217,22 @@ int InputProcess::qstrAdd(const QString &text)
/* trans */
if (TRANS_LIST.contains(text)) {
if ((qstrNow.size() == 1 && qstrNow.left(1) == BRACKET_L) || qstrNow.size() >= 1 && qstrNow.right(1) == BRACKET_L) {
if ((qstrNow.size() == 1 && qstrNow.left(1) == BRACKET_L)
|| qstrNow.size() >= 1 && qstrNow.right(1) == BRACKET_L) {
return CANNOT_ADD_TRANS;
}
QStringList temp_trans = QString("x^(ー1),x^(2),x^(3),x^(,x^(1÷,x!").split(","); /*))*/
QStringList temp_trans = QString("x^(ー1),x^(2),x^(3),x^(,x^(1÷,x!").split(","); /*))*/
QString temp = text;
temp = temp_trans.at(TRANS_LIST.indexOf(temp));
temp.remove(0 , 1);
temp.remove(0, 1);
if (formulaOrNum == 0) {
qstrNow = ZERO + temp;
return CORRECT_QSTR_ADD;
}
if (formulaOrNum == -1 || formulaOrNum == -2 ) {
if (formulaOrNum == -1 || formulaOrNum == -2) {
qstrNow = qstrNow + temp;
return CORRECT_QSTR_ADD;
}
@ -249,16 +251,22 @@ int InputProcess::qstrAdd(const QString &text)
if (qstrNow.right(1) == BRACKET_R) {
int index = InputTools::findBracketPair(qstrNow, size - 1);
if (QString("³√") == qstrNow.mid(index - 2, 2)) {
qstrNow = qstrNow.mid(0, index - 2) + BRACKET_L + QString("³√") + qstrNow.mid(index, size - index) + BRACKET_R + temp;
qstrNow = qstrNow.mid(0, index - 2) + BRACKET_L + QString("³√") + qstrNow.mid(index, size - index)
+ BRACKET_R + temp;
return CORRECT_QSTR_ADD;
}
if (QString("") == qstrNow.mid(index - 1, 1) && QString("³√") != qstrNow.mid(index - 2, 2)) {
qstrNow = qstrNow.mid(0, index - 1) + BRACKET_L + QString("") + qstrNow.mid(index, size - index) + BRACKET_R + temp;
qstrNow = qstrNow.mid(0, index - 1) + BRACKET_L + QString("") + qstrNow.mid(index, size - index)
+ BRACKET_R + temp;
return CORRECT_QSTR_ADD;
}
qstrNow = qstrNow + temp;
return CORRECT_QSTR_ADD;
}
if (qstrNow.right(1) == SCI_NUM_END) {
qstrNow = qstrNow + temp;
return CORRECT_QSTR_ADD;
}
int index = InputTools::getNumLastIndex(qstrNow);
qstrNow = qstrNow.mid(0, index) + BRACKET_L + qstrNow.mid(index, size - index) + BRACKET_R + temp;
@ -304,7 +312,7 @@ int InputProcess::qstrNowUpdate(const QString &text)
/* 最后一个字符 */
if (qstrNow.size() >= 1) {
qstrBack = QString(qstrNow.at(qstrNow.size() - 1));
qstrBack = QString(qstrNow.at(qstrNow.size() - 1));
}
/* 倒数第二个字符 */
@ -356,14 +364,16 @@ int InputProcess::qstrNowUpdate(const QString &text)
}
/* 处理 " 3.+ " 这类情况 , 移除小数点*/
if ((qstrNow.size() >= 2) && (isArithmeticOperator(qstrBack2) || qstrBack2 == POINT) && (isArithmeticOperator(qstrBack) || qstrBack == EQUAL)) {
qstrNow.remove(qstrNow.size() - 2 , 1);
if ((qstrNow.size() >= 2) && (isArithmeticOperator(qstrBack2) || qstrBack2 == POINT)
&& (isArithmeticOperator(qstrBack) || qstrBack == EQUAL)) {
qstrNow.remove(qstrNow.size() - 2, 1);
return CORRECT_QSTR_NOW_UPDATE;
}
// 4.
if ((qstrNow.size() >= 2) && (isArithmeticOperator(qstrBack2) || isBracket(qstrBack2)) && (qstrBack == POINT || qstrBack == PERCENT)) {
qstrNow.insert(qstrNow.size() - 1 , ZERO);
if ((qstrNow.size() >= 2) && (isArithmeticOperator(qstrBack2) || isBracket(qstrBack2))
&& (qstrBack == POINT || qstrBack == PERCENT)) {
qstrNow.insert(qstrNow.size() - 1, ZERO);
return CORRECT_QSTR_NOW_UPDATE;
}
@ -379,8 +389,8 @@ int InputProcess::qstrNowUpdate(const QString &text)
}
QString qstrBack3 = QString(qstrNow[qstrNow.size() - 3]);
if (qstrBack2 == ZERO && (isArithmeticOperator(qstrBack3) || qstrBack3 == BRACKET_L) ) {
qstrNow.remove(qstrNow.size() - 2 , 0);
if (qstrBack2 == ZERO && (isArithmeticOperator(qstrBack3) || qstrBack3 == BRACKET_L)) {
qstrNow.remove(qstrNow.size() - 2, 0);
return qstrBack == ZERO ? CORRECT_QSTR_NOW_UPDATE : FAILED_QSTR_NOW_UPDATE;
}
@ -414,7 +424,7 @@ void InputProcess::labelUpdate()
QStringList qstrList;
qstrList = formulaSplit(qstrNow);
for (int i = 0 ; i < qstrList.size() ; i++) {
for (int i = 0; i < qstrList.size(); i++) {
if (ZERO_TO_NINE.contains(QString(qstrList.at(i).at(0))))
qstrList[i] = addComma(qstrList[i]);
}
@ -435,14 +445,13 @@ void InputProcess::graphNodeUpdate(const QString &text)
if (DEBUG_MODE) {
qDebug() << "im in InputProcess::graphNodeUpdate";
}
// 1.
if ( ( G.getStatus(STANDARD) && !G.getStatus(ERROR) )
|| ( G.getStatus(SCIENTIFIC) && (!G.getStatus(ERROR_INF) || !G.getStatus(ERROR_NAN) ) ) ) {
if ((G.getStatus(STANDARD) && !G.getStatus(ERROR))
|| (G.getStatus(SCIENTIFIC) && (!G.getStatus(ERROR_INF) || !G.getStatus(ERROR_NAN)))) {
// 2.
if ( text == CLEAN
|| text == BACKSPACE ) {
if (text == CLEAN || text == BACKSPACE) {
if (G.getStatus(STANDARD))
G.updateAllSon(STANDARD, 1);
@ -450,34 +459,33 @@ void InputProcess::graphNodeUpdate(const QString &text)
G.updateAllSon(SCIENTIFIC, 1);
}
}
return ;
return;
}
if (text == EQUAL) {
if (G.getStatus(SCIENTIFIC)) {
if (calAns.contains(INF_SYMBOL)) {
G.update(ERROR_INF, false);
}
else if (calAns.contains(NAN_SYMBOL)) {
} else if (calAns.contains(NAN_SYMBOL)) {
G.update(ERROR_NAN, false);
}
}
else if (G.getStatus(STANDARD)) {
if ( calAns.contains(INF_SYMBOL)
|| calAns.contains(NAN_SYMBOL)) {
if (calAns.contains(INF_SYMBOL) || calAns.contains(NAN_SYMBOL)) {
G.update(ERROR, false);
}
}
return ;
return;
}
return ;
return;
}
QVector<QString> InputProcess::output(const QString &text)
{
if ((i_qstrAddFlag != -1 && i_qstrAddFlag != CORRECT_QSTR_ADD) || (i_qstrNowUpdateFlag != -1 && i_qstrNowUpdateFlag != CORRECT_QSTR_NOW_UPDATE )) {
if ((i_qstrAddFlag != -1 && i_qstrAddFlag != CORRECT_QSTR_ADD)
|| (i_qstrNowUpdateFlag != -1 && i_qstrNowUpdateFlag != CORRECT_QSTR_NOW_UPDATE)) {
QVector<QString> error_res = res;
error_res[DISPLAY_ON_LABEL_PREPARE] = "input Error!";
error_res[LATEST_HISTORY].clear();
@ -498,7 +506,8 @@ QVector<QString> InputProcess::output(const QString &text)
res[DISPLAY_ON_LABEL_NOW] = clearANS_END_and_SCI_NUM_END(labelNow);
res[LABEL_NOW_CAL_QSTR] = clearANS_END_and_SCI_NUM_END(qstrNow);
res[CAL_ANS] = text == EQUAL ? clearANS_END_and_SCI_NUM_END(calAns) : EMPTY;
res[LATEST_HISTORY] = (text == EQUAL && calHistory.size() && i_couldBeCalFlag) ? calHistory.at(calHistory.size()-1) : EMPTY;
res[LATEST_HISTORY] =
(text == EQUAL && calHistory.size() && i_couldBeCalFlag) ? calHistory.at(calHistory.size() - 1) : EMPTY;
res[DISPLAY_ON_LABEL_PREPARE] = clearANS_END_and_SCI_NUM_END(labelPrepare);
res[LABEL_PREPARE_CAL_QSTR] = clearANS_END_and_SCI_NUM_END(qstrPrepare);
@ -507,15 +516,15 @@ QVector<QString> InputProcess::output(const QString &text)
void InputProcess::init_inputFromButton()
{
qstrPrepare = EMPTY;
labelNow = EMPTY;
qstrPrepare = EMPTY;
labelNow = EMPTY;
labelPrepare = EMPTY;
calAns = EMPTY;
calAns = EMPTY;
i_couldBeCalFlag = -1;
i_qstrAddFlag = -1;
i_couldBeCalFlag = -1;
i_qstrAddFlag = -1;
i_qstrNowUpdateFlag = -1;
i_qstrUpdateFlag = -1;
i_qstrUpdateFlag = -1;
}
/* 对输入数据进行处理 , 返回需要显示的数据 */
@ -529,17 +538,17 @@ QVector<QString> InputProcess::inputFromButton(const QString &text)
/* 计算标志位处理 */
if (text == STANDARD || text == SCIENTIFIC || text == DEG_SYMBOL || text == RAD_SYMBOL || text == EXCHANGE_RATE) {
if (text == STANDARD || text == EXCHANGE_RATE) {
G.updateAllSon(SCIENTIFIC , 0);
G.updateAllSon(SCIENTIFIC, 0);
init();
G.updateAllSon(STANDARD , 1);
G.updateAllSon(STANDARD, 1);
calHistory.clear();
return res;
}
if (text == SCIENTIFIC) {
G.updateAllSon(STANDARD , 0);
G.updateAllSon(STANDARD, 0);
init();
G.updateAllSon(SCIENTIFIC , 1);
G.updateAllSon(SCIENTIFIC, 1);
calHistory.clear();
return res;
}
@ -555,7 +564,7 @@ QVector<QString> InputProcess::inputFromButton(const QString &text)
if (DEBUG_MODE) {
qDebug() << "find text:" << text;
}
res[LATEST_HISTORY].clear();
return res;
@ -567,7 +576,7 @@ QVector<QString> InputProcess::inputFromButton(const QString &text)
qDebug() << "AfterQstrAddFlag:" << qstrNow;
qDebug() << i_qstrAddFlag;
}
if (i_qstrAddFlag != CORRECT_QSTR_ADD) {
return output(text);
}
@ -577,9 +586,9 @@ QVector<QString> InputProcess::inputFromButton(const QString &text)
if (DEBUG_MODE) {
qDebug() << "AfterQstrNowUpdate:" << qstrNow;
qDebug() <<i_qstrNowUpdateFlag;
qDebug() << i_qstrNowUpdateFlag;
}
if (i_qstrNowUpdateFlag != CORRECT_QSTR_NOW_UPDATE) {
return output(text);
}

View File

@ -2,8 +2,8 @@
#define DEBUG_MODE true
const QPair<int, QString> InputTools::QP_QSTR_ERROR = qMakePair(0 , ERROR);
const QPair<int, QStringList> InputTools::QP_QSTR_LIST_ERROR = qMakePair(0 , QStringList(ERROR));
const QPair<int, QString> InputTools::QP_QSTR_ERROR = qMakePair(0, ERROR);
const QPair<int, QStringList> InputTools::QP_QSTR_LIST_ERROR = qMakePair(0, QStringList(ERROR));
bool InputTools::isSpace(const QChar qc)
{
@ -68,7 +68,7 @@ bool InputTools::isNumber(const QString &qstr)
if (qstr.contains(SCIENTIFIC_NOTATION)) {
int idx = qstr.indexOf(SCIENTIFIC_NOTATION);
if (isNumber(qstr.mid(0 , idx)) && isNumber(qstr.mid(idx + 2 , qstr.size() - idx - 2))) {
if (isNumber(qstr.mid(0, idx)) && isNumber(qstr.mid(idx + 2, qstr.size() - idx - 2))) {
return true;
}
@ -131,7 +131,7 @@ bool InputTools::isArithmeticOperator(const QString &qstr)
return false;
}
foreach (QChar qc , qstr) {
foreach (QChar qc, qstr) {
if (!isArithmeticOperator(qc))
return false;
}
@ -166,7 +166,7 @@ bool InputTools::isSciNum(const QString &qstr)
*/
int InputTools::findBracketPair(const QString &qstr, const int idx)
{
if (qstr.size() < idx) {
if (qstr.size() < idx) {
return -1;
}
@ -176,26 +176,26 @@ int InputTools::findBracketPair(const QString &qstr, const int idx)
int i_cnt = 0;
if (qstr[idx] == BRACKET_L) {
for (int i = idx ; i < qstr.size() ; i++) {
for (int i = idx; i < qstr.size(); i++) {
if (qstr[i] == BRACKET_L) {
i_cnt++;
} else if (qstr[i] == BRACKET_R) {
i_cnt--;
}
if(!i_cnt) {
if (!i_cnt) {
return i;
}
}
} else if (qstr[idx] == BRACKET_R) {
for (int i = idx ; i >= 0 ; i--) {
for (int i = idx; i >= 0; i--) {
if (qstr[i] == BRACKET_L) {
i_cnt++;
} else if (qstr[i] == BRACKET_R) {
i_cnt--;
}
if(!i_cnt) {
if (!i_cnt) {
return i;
}
}
@ -204,14 +204,14 @@ int InputTools::findBracketPair(const QString &qstr, const int idx)
return -1;
}
int InputTools::findBracketPair(const QStringList &qstrList , const int idx)
int InputTools::findBracketPair(const QStringList &qstrList, const int idx)
{
QString t;
foreach (QString a , qstrList) {
foreach (QString a, qstrList) {
t.append(a[0]);
}
return findBracketPair(t,idx);
return findBracketPair(t, idx);
}
/* 检测括号是否匹配 */
@ -220,9 +220,9 @@ bool InputTools::allBracketMatchCorrectly(const QString &qstr)
if (!qstr.size())
return false;
for (int i = 0 ; i < qstr.size() ; i++) {
for (int i = 0; i < qstr.size(); i++) {
if (isBracket(qstr[i])) {
if (findBracketPair(qstr , i) == -1) {
if (findBracketPair(qstr, i) == -1) {
return false;
}
}
@ -236,9 +236,9 @@ QString InputTools::bracketCompletion(const QString &qstr)
{
QString res = qstr;
int braCnt = 0;
int braCnt = 0;
for (int i = 0 ; i < res.size() ; i++) {
for (int i = 0; i < res.size(); i++) {
QString ch = QString(res[i]);
if (ch == BRACKET_L) {
braCnt++;
@ -249,11 +249,11 @@ QString InputTools::bracketCompletion(const QString &qstr)
if (braCnt > 0) {
while (braCnt--) {
res.insert(int(res.size()) , BRACKET_R);
res.insert(int(res.size()), BRACKET_R);
}
} else if (braCnt < 0) {
while (braCnt--) {
res.insert(0 , BRACKET_L);
res.insert(0, BRACKET_L);
}
}
@ -264,23 +264,23 @@ QString InputTools::bracketCompletion(const QString &qstr)
QString InputTools::getFunctionOrSciNumName(const QString &qstr, const int idx)
{
if (DEBUG_MODE) {
qDebug () << "im in getFunctionOrSciNumName!";
qDebug() << "im in getFunctionOrSciNumName!";
}
if (qstr.size() < idx + 3)
return "";
QString ans = qstr.mid(idx , 4);
QString ans = qstr.mid(idx, 4);
if (DEBUG_MODE) {
qDebug () << ans;
qDebug() << ans;
}
while(ans.contains(BRACKET_L) || ans.contains(BRACKET_R)) {
while (ans.contains(BRACKET_L) || ans.contains(BRACKET_R)) {
ans.chop(1);
}
while(!ans.right(1)[0].isLetter())
while (!ans.right(1)[0].isLetter())
ans.chop(1);
if (FUNCTION_LIST.contains(ans)) {
@ -298,10 +298,10 @@ QString InputTools::getFunctionOrSciNumName(const QString &qstr, const int idx)
QStringList InputTools::formulaSplit(const QString &qstr)
{
if (DEBUG_MODE) {
qDebug () << "im in formulaSplit!";
qDebug () << "Before formulaSplit :" <<qstr;
qDebug() << "im in formulaSplit!";
qDebug() << "Before formulaSplit :" << qstr;
}
QStringList ans;
QString formula = qstr + END;
@ -309,40 +309,41 @@ QStringList InputTools::formulaSplit(const QString &qstr)
return ans;
}
for (int i = 0 ; i < formula.size() ; ) {
for (int i = 0; i < formula.size();) {
QString ch = QString(formula[i]);
if (ch == PERCENT && !i) {
/* %处理 */
ans.append(ch);
formula.remove(0 , 1);
formula.remove(0, 1);
i = 0;
} else if (isArithmeticOperator(ch) || isBracket(ch) || ch == POWER_SYMBOL || ch == END || ch == SCIENTIFIC_NOTATION || ch == FACTORIAL_SYMBOL) {
} else if (isArithmeticOperator(ch) || isBracket(ch) || ch == POWER_SYMBOL || ch == END
|| ch == SCIENTIFIC_NOTATION || ch == FACTORIAL_SYMBOL) {
/* + - * / ( ) ^ $ e 处理 */
if (i) {
ans.append(formula.mid(0 , i));
ans.append(formula.mid(0, i));
}
ans.append(ch);
formula.remove(0 , i + 1);
formula.remove(0, i + 1);
i = 0;
} else if (formula[i].isLetter()) {
/* 处理字母开头 */
QString t = getFunctionOrSciNumName(formula , i);
QString t = getFunctionOrSciNumName(formula, i);
if (t.size()) {
if (i) {
ans.append(formula.mid(0 , i));
ans.append(formula.mid(0, i));
}
ans.append(t);
formula.remove(0 , i + t.size());
formula.remove(0, i + t.size());
i = 0;
} else {
/* 处理 inf , nan */
if (formula[i] == 'i' || formula[i] == 'n') {
if (formula.mid(i , 3) == INF_SYMBOL || formula.mid(i , 3) == NAN_SYMBOL) {
ans.append(formula.mid(i , 3));
formula.remove(0 , 3);
if (formula.mid(i, 3) == INF_SYMBOL || formula.mid(i, 3) == NAN_SYMBOL) {
ans.append(formula.mid(i, 3));
formula.remove(0, 3);
i = 0;
}
}
@ -354,81 +355,81 @@ QStringList InputTools::formulaSplit(const QString &qstr)
while (ans.contains(SCIENTIFIC_NOTATION)) {
int idx = ans.indexOf(SCIENTIFIC_NOTATION);
ans.replace(idx - 1 , ans.mid(idx - 1 , 4).join(""));
ans.replace(idx - 1, ans.mid(idx - 1, 4).join(""));
for (int i = idx ; i <= idx + 2 ; i++)
for (int i = idx; i <= idx + 2; i++)
ans.removeAt(idx);
}
/* 移除等号 */
ans.removeAt(ans.size() - 1);
if (DEBUG_MODE) {
qDebug () << "After formulaSplit :" << ans;
qDebug() << "After formulaSplit :" << ans;
}
return ans;
}
void InputTools::qpairUpdate(QPair<int , QString> &qpair1 , const QPair<int , QString> &qpair2)
void InputTools::qpairUpdate(QPair<int, QString> &qpair1, const QPair<int, QString> &qpair2)
{
if (qpair1 == QP_QSTR_ERROR)
return;
if (qpair2.first == 0) {
qpair1 = QP_QSTR_ERROR;
return ;
return;
}
if (qpair2.first == 1) {
if (qpair1 == QP_QSTR_ERROR || qpair1.first == 2)
return ;
return;
qpair1 = qpair2;
return ;
return;
}
if (qpair2.first == 2) {
if (qpair1 == QP_QSTR_ERROR)
return ;
return;
qpair1 = qpair2;
return ;
return;
}
return ;
return;
}
void InputTools::qpairUpdate(QPair<int , QStringList> &qpair1 , const QPair<int , QStringList> &qpair2)
void InputTools::qpairUpdate(QPair<int, QStringList> &qpair1, const QPair<int, QStringList> &qpair2)
{
if (qpair1 == QP_QSTR_LIST_ERROR)
return;
if (qpair2.first == 0) {
qpair1 = QP_QSTR_LIST_ERROR;
return ;
return;
}
if (qpair2.first == 1) {
if (qpair1 == QP_QSTR_LIST_ERROR || qpair1.first == 2)
return ;
return;
qpair1 = qpair2;
return ;
return;
}
if (qpair2.first == 2) {
if (qpair1 == QP_QSTR_LIST_ERROR)
return ;
return;
qpair1 = qpair2;
return ;
return;
}
return ;
return;
}
QPair<int, QString> InputTools::isCorrectInt(const QString &qstr)
{
if (!qstr.size()) {
return qMakePair(0 , ERROR);
return qMakePair(0, ERROR);
}
QPair<int , QString> qp;
QPair<int, QString> qp;
if (qstr[0] == SUB) {
qp = isCorrectInt(qstr.right(qstr.size() - 1));
@ -436,18 +437,18 @@ QPair<int, QString> InputTools::isCorrectInt(const QString &qstr)
return qp;
}
foreach (QChar ch , qstr) {
foreach (QChar ch, qstr) {
if (!isNumber(ch) || ch == POINT || ch == PERCENT) {
return qMakePair(0 , ERROR);
return qMakePair(0, ERROR);
}
}
qp = qMakePair(1 , qstr);
qp = qMakePair(1, qstr);
if (qstr[0] == ZERO && qstr.size() > 1) {
qpairUpdate(qp , qMakePair(2 , qstr));
qpairUpdate(qp, qMakePair(2, qstr));
while (qp.second.at(0) == ZERO) {
qp.second.remove(0 , 1);
qp.second.remove(0, 1);
}
}
@ -457,49 +458,46 @@ QPair<int, QString> InputTools::isCorrectInt(const QString &qstr)
QPair<int, QString> InputTools::isCorrectDouble(const QString &qstr)
{
if (!qstr.size())
return qMakePair(0,ERROR);
return qMakePair(0, ERROR);
if (qstr.contains(INF_SYMBOL) || qstr.contains(NAN_SYMBOL)) {
if (qstr.size() == 3)
return qMakePair(1,qstr);
return qMakePair(1, qstr);
if (qstr.size() == 4 && qstr[0] == SUB) {
return qMakePair(1,qstr);
return qMakePair(1, qstr);
}
return qMakePair(0,ERROR);
return qMakePair(0, ERROR);
}
int idx;
QPair<int,QString> qp;
QPair<int, QString> qp;
if (qstr.contains(SCIENTIFIC_NOTATION)) {
idx = qstr.indexOf(SCIENTIFIC_NOTATION);
if (idx != -1) {
// 判断e后的'+','-'
if (qstr[idx + 1] != ADD && qstr[idx + 1] != SUB)
return qMakePair(0,ERROR);
return qMakePair(0, ERROR);
// 判断e后的数字
qp = isCorrectInt(qstr.right(qstr.size() - idx - 2));
if (!qp.first) {
return qMakePair(0,ERROR);
}
else {
return qMakePair(0, ERROR);
} else {
qp.second = qstr.left(idx) + qp.second;
}
// 判断e前的整数
QPair<int,QString> qp1 = isCorrectInt(qstr.left(idx));
QPair<int,QString> qp2 = isCorrectDouble(qstr.left(idx));
QPair<int, QString> qp1 = isCorrectInt(qstr.left(idx));
QPair<int, QString> qp2 = isCorrectDouble(qstr.left(idx));
if (qp1.first && !qp2.first) {
qp1.second += qstr.right(qstr.size() - idx);
qpairUpdate(qp, qp1);
}
else if (!qp1.first && qp2.first) {
} else if (!qp1.first && qp2.first) {
qp2.second += qstr.right(qstr.size() - idx);
qpairUpdate(qp, qp2);
}
else {
return qMakePair(0,ERROR);
} else {
return qMakePair(0, ERROR);
}
}
return qp;
@ -509,14 +507,13 @@ QPair<int, QString> InputTools::isCorrectDouble(const QString &qstr)
if (idx != -1) {
qp = isCorrectInt(qstr.left(idx));
if (!qp.first) {
return qMakePair(0,ERROR);
}
else {
return qMakePair(0, ERROR);
} else {
qp.second += qstr.right(qstr.size() - idx);
}
foreach (QChar ch , qstr.right(qstr.size() - 1 - idx) ) {
foreach (QChar ch, qstr.right(qstr.size() - 1 - idx)) {
if (!isNumber(ch) || ch == POINT || ch == PERCENT)
return qMakePair(0,ERROR);
return qMakePair(0, ERROR);
}
if (qp.second.right(1) == ZERO) {
qp.first = 2;
@ -528,7 +525,7 @@ QPair<int, QString> InputTools::isCorrectDouble(const QString &qstr)
}
return qp;
}
return qMakePair(0,ERROR);
return qMakePair(0, ERROR);
}
QPair<int, QString> InputTools::isCorrectNumber(const QString &qstr)
@ -537,7 +534,7 @@ QPair<int, QString> InputTools::isCorrectNumber(const QString &qstr)
return QP_QSTR_ERROR;
}
QPair<int , QString> qp;
QPair<int, QString> qp;
/* %处理 */
if (qstr.contains(PERCENT)) {
@ -549,7 +546,8 @@ QPair<int, QString> InputTools::isCorrectNumber(const QString &qstr)
return qp;
}
if (qstr.contains(POINT) || qstr.contains(SCIENTIFIC_NOTATION) || qstr.contains(INF_SYMBOL) || qstr.contains(NAN_SYMBOL)) {
if (qstr.contains(POINT) || qstr.contains(SCIENTIFIC_NOTATION) || qstr.contains(INF_SYMBOL)
|| qstr.contains(NAN_SYMBOL)) {
qp = isCorrectDouble(qstr);
if (!qp.first) {
return QP_QSTR_ERROR;
@ -564,7 +562,7 @@ QPair<int, QString> InputTools::isCorrectNumber(const QString &qstr)
return qp;
}
bool InputTools::adjacencyJudgment(const QString &x , const QString &y)
bool InputTools::adjacencyJudgment(const QString &x, const QString &y)
{
// )
if (x == BRACKET_R) {
@ -595,8 +593,7 @@ bool InputTools::adjacencyJudgment(const QString &x , const QString &y)
// num
if (isNumber(x) || isSciNum(x)) {
if ( y == BRACKET_R || y == POWER_SYMBOL
|| isArithmeticOperator(y) || y == FACTORIAL_SYMBOL) {
if (y == BRACKET_R || y == POWER_SYMBOL || isArithmeticOperator(y) || y == FACTORIAL_SYMBOL) {
return true;
}
@ -604,7 +601,7 @@ bool InputTools::adjacencyJudgment(const QString &x , const QString &y)
}
if (x == FACTORIAL_SYMBOL) {
if ( isArithmeticOperator(y) || y == BRACKET_R) {
if (isArithmeticOperator(y) || y == BRACKET_R) {
return true;
}
return false;
@ -620,21 +617,22 @@ bool InputTools::adjacencyJudgment(const QString &x , const QString &y)
QPair<int, QStringList> InputTools::isCorrectFormulaList(const QStringList &formulaList)
{
if (!formulaList.size()) {
return qMakePair(1 , QStringList(""));
return qMakePair(1, QStringList(""));
}
/* 列表第一项不能为 " * / " , 列表最后一项不能为 " + - * / " */
if ((isArithmeticOperator(formulaList[0]) && formulaList[0] != SUB && formulaList[0] != ADD) || (isArithmeticOperator(formulaList.back()))) {
if ((isArithmeticOperator(formulaList[0]) && formulaList[0] != SUB && formulaList[0] != ADD)
|| (isArithmeticOperator(formulaList.back()))) {
return QP_QSTR_LIST_ERROR;
}
QPair<int , QStringList> qp;
qp = qMakePair(1 , formulaList);
QPair<int, QStringList> qp;
qp = qMakePair(1, formulaList);
/* 如果列表第一项为 - , 第二项为数字 , 一二项进行合并 */
if (qp.second.size() > 1 && qp.second.at(0) == SUB && isNumber(qp.second.at(1))) {
qp.second.removeAt(0);
qp.second.replace(0 , SUB + qp.second.at(0));
qp.second.replace(0, SUB + qp.second.at(0));
}
/* 如果列表第一项为 + , 则移除 */
@ -647,11 +645,11 @@ QPair<int, QStringList> InputTools::isCorrectFormulaList(const QStringList &form
if (qp.second.size() == 1) {
QPair<int, QString> temp_qp = isCorrectNumber(qp.second.at(0));
qp.first = temp_qp.first;
qp.second.replace(0 , temp_qp.second);
qp.second.replace(0, temp_qp.second);
return qp;
}
for (int i = 0 ; i < qp.second.size() - 1 ; i++) {
for (int i = 0; i < qp.second.size() - 1; i++) {
QString qstri = qp.second.at(i);
QString qstrj = qp.second.at(i + 1);
@ -661,12 +659,12 @@ QPair<int, QStringList> InputTools::isCorrectFormulaList(const QStringList &form
if (qstri == BRACKET_L) {
/* 处理括号中的表达式 */
int idx = findBracketPair(qp.second , i);
int idx = findBracketPair(qp.second, i);
if (idx == -1) {
return QP_QSTR_LIST_ERROR;
} else {
QPair<int , QStringList> temp_qp;
temp_qp = isCorrectFormulaList(qp.second.mid(i + 1 , idx - i - 1));
QPair<int, QStringList> temp_qp;
temp_qp = isCorrectFormulaList(qp.second.mid(i + 1, idx - i - 1));
if (!qp.first || !temp_qp.first) {
return QP_QSTR_LIST_ERROR;
@ -677,11 +675,11 @@ QPair<int, QStringList> InputTools::isCorrectFormulaList(const QStringList &form
}
if (temp_qp.second.size() && !temp_qp.second.contains("")) {
qp.second = qp.second.mid(0 , i + 1) + temp_qp.second + qp.second.mid(idx , qp.second.size() - idx);
qp.second = qp.second.mid(0, i + 1) + temp_qp.second + qp.second.mid(idx, qp.second.size() - idx);
i += temp_qp.second.size();
} else {
qp.first = 2;
qp.second = qp.second.mid(0 , i) + qp.second.mid(idx + 1 , qp.second.size() - idx - 1);
qp.second = qp.second.mid(0, i) + qp.second.mid(idx + 1, qp.second.size() - idx - 1);
if (i) {
i -= 2;
} else {
@ -689,7 +687,7 @@ QPair<int, QStringList> InputTools::isCorrectFormulaList(const QStringList &form
}
}
}
} else if (isNumber(qstri)) {
} else if (isNumber(qstri)) {
if (isNumber(qstrj)) {
return QP_QSTR_LIST_ERROR;
}
@ -704,7 +702,7 @@ QPair<int, QStringList> InputTools::isCorrectFormulaList(const QStringList &form
if (qp.first != 2) {
qp.first = temp_qp.first;
}
qp.second.replace(i , temp_qp.second);
qp.second.replace(i, temp_qp.second);
}
}
}
@ -721,10 +719,10 @@ QPair<int, QStringList> InputTools::isCorrectFormulaList(const QStringList &form
QPair<int, QString> InputTools::isCorrectFormula(const QString &qstr)
{
if (!qstr.size()) {
return qMakePair(0 , ERROR);
return qMakePair(0, ERROR);
}
QPair<int, QString> qp = qMakePair(1 , qstr);
QPair<int, QString> qp = qMakePair(1, qstr);
qp.second = clearANS_END_and_SCI_NUM_END(qp.second);
@ -741,14 +739,14 @@ QPair<int, QString> InputTools::isCorrectFormula(const QString &qstr)
QPair<int, QStringList> qpList = isCorrectFormulaList(formulaList);
if (!qpList.first) {
return qMakePair(0 , ERROR);
return qMakePair(0, ERROR);
}
if (qp.first == 2) {
qpList.first = qp.first;
}
return qMakePair(qpList.first , qpList.second.join(""));
return qMakePair(qpList.first, qpList.second.join(""));
}
int InputTools::formulaTypeCheck(const QString &formula)
@ -764,7 +762,8 @@ int InputTools::formulaTypeCheck(const QString &formula)
}
/* 为数字加结束符 */
if ((isNumber(formula.left(formula.size() - 1)) && formula.right(1) == ANS_END) || (formula[0] == SUB && formulaTypeCheck(formula.right(formula.size() - 1)) == -2 )) {
if ((isNumber(formula.left(formula.size() - 1)) && formula.right(1) == ANS_END)
|| (formula[0] == SUB && formulaTypeCheck(formula.right(formula.size() - 1)) == -2)) {
return -2;
}
@ -832,7 +831,8 @@ QString InputTools::clearSCI_NUM_END(const QString &qstr)
return res;
}
QString InputTools::clearANS_END_and_SCI_NUM_END(const QString &qstr) {
QString InputTools::clearANS_END_and_SCI_NUM_END(const QString &qstr)
{
QString res = qstr;
res = clearANS_END(res);
res = clearSCI_NUM_END(res);
@ -868,9 +868,7 @@ QString InputTools::addComma(const QString &qstr)
int pointIndex;
for (int i = 0; i < s.size(); i++) {
if ( s[i] == POINT[0]
|| s[i] == SCIENTIFIC_NOTATION[0]
|| s[i] == ANS_END[0] ) {
if (s[i] == POINT[0] || s[i] == SCIENTIFIC_NOTATION[0] || s[i] == ANS_END[0]) {
pointFlag = 1;
pointIndex = i;
@ -878,12 +876,11 @@ QString InputTools::addComma(const QString &qstr)
}
}
if(pointFlag == 1) {
return addComma(s.mid(0,pointIndex)) + s.mid(pointIndex, s.size()-pointIndex);
}
else {
if (pointFlag == 1) {
return addComma(s.mid(0, pointIndex)) + s.mid(pointIndex, s.size() - pointIndex);
} else {
QString ans;
for(int i = s.size() - 3; i > 0; i -= 3)
for (int i = s.size() - 3; i > 0; i -= 3)
s.insert(i, ",");
return s;
}
@ -899,7 +896,8 @@ int InputTools::couldBeCal(const QString &qstr)
QString ch = qstr.right(1);
if (isArithmeticOperator(ch) || ch == BRACKET_L || ch == POINT || ch == POWER_SYMBOL || FUNCTION_QSTR.contains(ch)) {
if (isArithmeticOperator(ch) || ch == BRACKET_L || ch == POINT || ch == POWER_SYMBOL
|| FUNCTION_QSTR.contains(ch)) {
return COULD_NOT_BE_CAL;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 601 B

After

Width:  |  Height:  |  Size: 638 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 638 B

After

Width:  |  Height:  |  Size: 601 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

@ -5,7 +5,7 @@ Calculator is an efficient and practical desktop computing tool developed by our
### Open mode
"Start menu"![](./image/1.png)>"Calculator" or "taskbar">"Search"![](image/2.png)>"Calculator"
"Start menu">"Calculator" or "taskbar">"Search">"Calculator"
### Basic operation

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 601 B

After

Width:  |  Height:  |  Size: 638 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 638 B

After

Width:  |  Height:  |  Size: 601 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

@ -5,7 +5,7 @@
### 打开方式
“开始菜单”![](image/1.png)>“计算器”或“任务栏”>“搜索”![](image/2.png)>“计算器”
“开始菜单”>“计算器”或“任务栏”>“搜索”>“计算器”
### 基本操作

View File

@ -36,6 +36,9 @@ void DataWarehouse::init(void)
void DataWarehouse::getPlatForm(void)
{
this->platform = "xc-tablet";
return;
char *projectName = kdk_system_get_projectName();
if (projectName == NULL) {
return;

View File

@ -16,7 +16,7 @@ public:
};
/* 运行平台 */
/* 990 , 9a0 , v100 , v101 , inter */
/* 990 , 9a0 , v100 , v101 , inter , xc-tablet*/
QString platform;
/* 启动是否为 intel 小插件方式 , 该变量标识两种状态 0 ---> 正常方式启动 , 1 ---> 小插件启动 */

64
debian/changelog vendored
View File

@ -1,31 +1,57 @@
kylin-calculator (1.2.0.0-ok2~0803) yangtze; urgency=medium
kylin-calculator (1.2.0-5) v101; urgency=medium
* BUG号
* 任务号107837 界面布局按照设计稿调整
* 其他更改说明:无
* 其他改动影响域:无
* 处理编译卡住问题
-- jishengjie <jishengjie@kylinos.cn> Fri, 30 Sep 2022 00:00:00 +0800
-- Kevin Duan <duankaiwen@kylinos.cn> Wed, 03 Aug 2022 17:30:29 +0800
kylin-calculator (1.2.0-4) v101; urgency=medium
* BUG号 :139425 【设计】【计算器】应用关于窗口适配SDK
* 需求号 : 无
* 其他更改说明 : 无
* 其他改动影响域 : 无
kylin-calculator (1.2.0.0-ok2~0721) yangtze; urgency=medium
-- huheng <huheng@kylinos.cn> Fri, 09 Sep 2022 11:40:05 +0800
* build for openKylin
* close-cd 109779 修复用户手册主页图标不是寻光主题图标问题
* close-cd 更换按钮图片
* close-cd 修改编译依赖
kylin-calculator (1.2.0.3) v101; urgency=medium
* BUG号 :135924 【计算器】e和π无法进行指数运算
* 需求号 : 无
* 其他更改说明 : 无
* 其他改动影响域 : 无
-- huheng <huheng@kylinos.cn> Thu, 21 Jul 2022 12:32:08 +0800
-- huheng <huheng@kylinos.cn> Wed, 31 Aug 2022 19:51:24 +0800
kylin-calculator (1.2.0.0-ok2~0718) yangtze; urgency=medium
kylin-calculator (1.2.0.2) v101; urgency=medium
* BUG号 : 114015 【计算器】英文模式15号字体关于界面字母显示不全
125134 【用户手册】计算器“概述”和“打开方式”中开始菜单图标与系统实际不一致
125544 【用户手册】用户手册中计算器的图标与实际不一致,且实际的计算机无“置顶”功能
125588 【计算器】计算器的置顶按钮不显示
127264 【计算器】关于中的版本跟实际不一致
127284 【计算器】不支持复制负数计算结果
128340 【计算器】【藏文】藏文系统下左侧栏显示不全
123354 【ukui3.20】【设计】计算器-实现细节与设计稿不符
128405 【ukui3.20】【设计】计算器-汇率选择界面没有跟随主题高亮色变化
128407 【ukui3.20】【设计】计算器等号悬停效果不对
109779 【用户手册】用户手册首页传书、计算器的图标icon需替换为寻光主题图标
* 需求号 : 无
* 其他更改说明 : 无
* 其他改动影响域 : 无
* build for openKylin
* close-cd #127642 更换置顶图标
* close-cd #127644 更换置顶接口
-- songqianpeng <songqianpeng@kylinos.cn> Wed, 27 Jul 2022 11:19:33 +0800
-- huheng <huheng@kylinos.cn> Mon, 18 Jul 2022 15:30:24 +0800
kylin-calculator (1.2.0.1) v101; urgency=medium
* BUG号 : 无
* 需求号 : 无
* 其他更改说明 : 移除 libukui-comm 依赖,改用 libkysdk-sysinfo
* 其他改动影响域 : SP1 和 intel 平台判断逻辑
kylin-calculator (1.2.0.0-ok1) yangtze; urgency=medium
* build for openKylin
-- Xie Wei <xiewei@kylinos.cn> Wed, 22 Jun 2022 18:40:18 +0800
-- jishengjie <jishengjie@kylinos.cn> Fri, 15 Jul 2022 00:00:00 +0800
kylin-calculator (1.2.0.0) v101; urgency=medium

7
debian/source/local-options vendored Normal file
View File

@ -0,0 +1,7 @@
tar-ignore = build
tar-ignore = build-*
tar-ignore = .vscode
tar-ignore = .git
tar-ignore = .qm
tar-ignore = run
tar-ignore = README.md

View File

@ -1 +0,0 @@
include-binaries

View File

@ -1,7 +1,6 @@
<RCC>
<qresource prefix="/">
<file>translations/kylin-calculator_zh_CN.ts</file>
<file>data/org.kylin-calculator-data.gschema.xml</file>
<file>image/delete.png</file>
<file>image/close.png</file>
<file>image/max.png</file>

View File

@ -2,8 +2,11 @@
Name=Calculator
Name[zh_CN]=计算器
Name[bo_CN]=རྩིས་ཆས།
Name[zh_HK]=計算器
GenericName[bo_CN]=རྩིས་ཆས།
GenericName=Calculator
GenericName[zh_CN]=计算器
GenericName[zh_HK]=計算器
Keywords=calculator
Exec=/usr/bin/kylin-calculator %u
Icon=kylin-calculator

View File

@ -11,7 +11,7 @@ LIBS += -lX11
LIBS += -lgmp
CONFIG += link_pkgconfig c++11 link_pkgconfig lrelease
PKGCONFIG += gsettings-qt gsl kysdk-alm kysdk-ukenv kysdk-log kysdk-diagnostics kysdk-waylandhelper kysdk-sysinfo
PKGCONFIG += gsettings-qt gsl kysdk-alm kysdk-ukenv kysdk-log kysdk-diagnostics kysdk-waylandhelper kysdk-sysinfo kysdk-qtwidgets
message($$system(./translations/generate_translations_qm.sh))
@ -108,9 +108,6 @@ guide.path = /usr/share/kylin-user-guide/data/guide/
lib.files = $$PWD/libkylin-calculator.so
lib.path = /opt/small-plugin/children/bin
schemes.files += $$PWD/data/org.kylin-calculator-data.gschema.xml $$PWD/data/org.ukui.log4qt.kylin-calculator.gschema.xml
schemes.path = /usr/share/glib-2.0/schemas/
desktop.files += $$PWD/kylin-calculator.desktop
desktop.path = /usr/share/applications/
@ -120,7 +117,6 @@ translationsFiles.path = /usr/share/kylin-calculator/translations/
INSTALLS += \
target \
lib \
schemes \
desktop \
translationsFiles \
guide \

View File

@ -19,7 +19,7 @@ int main(int argc, char *argv[])
qInstallMessageHandler(kabase::Log::logOutput);
kabase::WindowManage::setScalingProperties();
kdk::QtSingleApplication a(argc, argv);
a.setApplicationVersion("1.1.0");
a.setApplicationVersion("1.2.0.2");
a.setWindowIcon(QIcon::fromTheme("kylin-calculator"));
if (a.isRunning()) {
qDebug() << "is running";
@ -43,6 +43,19 @@ int main(int argc, char *argv[])
qDebug() << "Waring : load qt translation file fail";
}
// 加载sdk控件翻译
QTranslator trans;
QString locale = QLocale::system().name();
if (locale == "zh_CN") {
if (trans.load(":/translations/gui_zh_CN.qm")) {
a.installTranslator(&trans);
}
} else if (locale == "bo_CN") {
if (trans.load(":/translations/gui_bo_CN.qm")) {
a.installTranslator(&trans);
}
}
/* 实例 */
LogicCenter::getInstance();

View File

@ -216,6 +216,8 @@ void MainWindow::setWidgetUi()
mainLayout->setSpacing(0);
this->mainWid->setLayout(mainLayout);
this->resize(STANDARD_WINDOWW, STANDARD_WINDOWH);
return;
}
@ -276,6 +278,9 @@ void MainWindow::setStandardUi()
this->setMinimumSize(INTEL_STANDARD_WINDOWW, INTEL_STANDARD_WINDOWH);
this->resize(INTEL_STANDARD_WINDOWW, INTEL_STANDARD_WINDOWH);
}
} else if (DataWarehouse::getInstance()->platform == QString("xc-tablet")) {
/* xc 平板 */
this->setMinimumSize(STANDARD_WINDOWW, STANDARD_WINDOWH);
} else {
this->setFixedSize(STANDARD_WINDOWW, STANDARD_WINDOWH);
}
@ -348,6 +353,8 @@ void MainWindow::setScientificUi()
this->setMinimumSize(INTEL_SCIENTIFIC_WINDOWW, INTEL_SCIENTIFIC_WINDOWH);
this->resize(INTEL_SCIENTIFIC_WINDOWW, INTEL_SCIENTIFIC_WINDOWH);
}
} else if (DataWarehouse::getInstance()->platform == QString("xc-tablet")) {
this->setMinimumSize(SCIENTIFIC_WINDOWW, SCIENTIFIC_WINDOWH);
} else {
this->setFixedSize(SCIENTIFIC_WINDOWW, SCIENTIFIC_WINDOWH);
}
@ -439,7 +446,12 @@ void MainWindow::setToolUi()
{
qInfo() << "Switch to exchange rate mode.";
/* 固定窗口大小 */
this->setFixedSize(STANDARD_WINDOWW, STANDARD_WINDOWH);
if (DataWarehouse::getInstance()->platform == QString("xc-tablet")) {
/* xc 平板 */
this->setMinimumSize(STANDARD_WINDOWW, STANDARD_WINDOWH);
} else {
this->setFixedSize(STANDARD_WINDOWW, STANDARD_WINDOWH);
}
// 设置当前模式
this->currentModel = EXCHANGE_RATE;
@ -477,8 +489,6 @@ void MainWindow::setToolUi()
this->lab_now = toolModelOutput->toolLabBef;
toolModelOutput->setWidgetStyle();
toolModelOutput->unitListBef->setWidgetStyle();
toolModelOutput->unitListAft->setWidgetStyle();
mainOutputLayout->addWidget(toolModelOutput);
mainButtonLayout->addWidget(toolModelButton);
@ -503,10 +513,20 @@ void MainWindow::setProgrammerUi()
connect(m_prograModel, &MainWindow::customContextMenuRequested, this,
&MainWindow::myCustomContextMenuRequested);
}
if (!m_prograModel->isBinWinShow()) {
this->setFixedSize(QSize(PROGRAM_WIN_WIDTH, PROGRAM_WIN_HEIGHT));
/* xc 平板 */
if (DataWarehouse::getInstance()->platform == QString("xc-tablet")) {
if (!m_prograModel->isBinWinShow()) {
this->setMinimumSize(QSize(PROGRAM_WIN_WIDTH, PROGRAM_WIN_HEIGHT));
} else {
this->setMinimumSize(QSize(PROGRAM_WIN_WIDTH, PROGRAM_WIN_HEIGHT + PROGRAM_BIN_HEIGHT));
}
} else {
this->setFixedSize(QSize(PROGRAM_WIN_WIDTH, PROGRAM_WIN_HEIGHT + PROGRAM_BIN_HEIGHT));
if (!m_prograModel->isBinWinShow()) {
this->setFixedSize(QSize(PROGRAM_WIN_WIDTH, PROGRAM_WIN_HEIGHT));
} else {
this->setFixedSize(QSize(PROGRAM_WIN_WIDTH, PROGRAM_WIN_HEIGHT + PROGRAM_BIN_HEIGHT));
}
}
if (WidgetStyle::ThemeColor::LIGHT == WidgetStyle::themeColor) {
@ -675,8 +695,6 @@ void MainWindow::changeDarkTheme()
scientificOutput->setWidgetStyle(false);
} else if (label.contains(EXCHANGE_RATE)) {
toolModelOutput->setWidgetStyle(false);
toolModelOutput->unitListBef->setWidgetStyle();
toolModelOutput->unitListAft->setWidgetStyle();
} else if (label.contains(PROGRAMMER)) {
m_prograModel->setDarkUI();
}
@ -715,8 +733,6 @@ void MainWindow::changeLightTheme()
scientificOutput->setWidgetStyle(false);
} else if (label.contains(EXCHANGE_RATE)) {
toolModelOutput->setWidgetStyle(false);
toolModelOutput->unitListBef->setWidgetStyle();
toolModelOutput->unitListAft->setWidgetStyle();
} else if (label.contains(PROGRAMMER)) {
m_prograModel->setLightUI();
}
@ -841,6 +857,9 @@ void MainWindow::btn_merge(const QString &disText)
{
this->inputLongSym = false;
if (this->currentModel == EXCHANGE_RATE && lab_prepare->fontInfo().pixelSize() < 40) {
lab_prepare->setStyleSheet("font-size:40px;font-weight:15px;line-height:50px;");
}
/* 处理屏幕显示字号大小 */
if (disText != BACKSPACE && disText != CLEAN && disText != EQUAL) {
/* 判断是否输入过长 */
@ -852,6 +871,19 @@ void MainWindow::btn_merge(const QString &disText)
&& str.size() >= (DataWarehouse::getInstance()->maxInputNum) - 12)) {
this->lab_prepare->setText(tr("input too long"));
QFont labFont = lab_prepare->font();
QFontMetrics fontMts(labFont);
int dif = fontMts.width(lab_prepare->text()) - lab_prepare->width();
QString fontSizeStr = QString::number(lab_prepare->fontInfo().pixelSize() - 8);
/* 不同模式下需要判断的距离阈值不一样 */
while (this->currentModel == EXCHANGE_RATE && dif > -20) {
lab_prepare->setStyleSheet("font-size:" + fontSizeStr + "px;font-weight:15px;");
labFont.setPixelSize(labFont.pixelSize() - 8);
QFontMetrics fontMts(labFont);
dif = fontMts.width(lab_prepare->text()) - lab_prepare->width();
fontSizeStr = QString::number(labFont.pixelSize() - 8);
}
this->inputLongSym = true;
return;
}
@ -1115,9 +1147,12 @@ void MainWindow::changeModel(QString label)
/* 判断字符串是否为纯数字 */
bool MainWindow::isDigitStr(QString str)
{
str.replace(SUB, "-");
QByteArray byteArray = str.toLatin1();
const char *s = byteArray.data();
if (*s == '-') {
s++;
}
/* 判断是否为纯数字 */
while (*s && *s >= '0' && *s <= '9') {
s++;

View File

@ -34,12 +34,6 @@ void menuModule::init()
void menuModule::initAction()
{
titleText = new QLabel();
bodyAppName = new QLabel();
bodyAppVersion = new QLabel();
bodyAppDesc = new QLabel();
bodySupport = new QLabel();
iconSize = QSize(30, 30);
menuButton = new QToolButton(this);
menuButton->setToolTip(tr("Menu"));
@ -79,69 +73,8 @@ void menuModule::initAction()
<< actionHelp << actionAbout << actionQuit;
m_menu->addActions(actions);
// 互斥按钮组
QMenu *themeMenu = new QMenu;
QActionGroup *themeMenuGroup = new QActionGroup(this);
QAction *autoTheme = new QAction(tr("Auto"), this);
themeMenuGroup->addAction(autoTheme);
themeMenu->addAction(autoTheme);
autoTheme->setCheckable(true);
QAction *lightTheme = new QAction(tr("Light"), this);
themeMenuGroup->addAction(lightTheme);
themeMenu->addAction(lightTheme);
lightTheme->setCheckable(true);
QAction *darkTheme = new QAction(tr("Dark"), this);
themeMenuGroup->addAction(darkTheme);
themeMenu->addAction(darkTheme);
darkTheme->setCheckable(true);
QList<QAction *> themeActions;
themeActions << autoTheme << lightTheme << darkTheme;
// autoTheme->setChecked(true);
actionTheme->setMenu(themeMenu);
menuButton->setMenu(m_menu);
connect(m_menu, &QMenu::triggered, this, &menuModule::triggerMenu);
initGsetting();
setThemeFromLocalThemeSetting(themeActions);
themeUpdate();
connect(themeMenu, &QMenu::triggered, this, &menuModule::triggerThemeMenu);
}
void menuModule::setThemeFromLocalThemeSetting(QList<QAction *> themeActions)
{
m_pGsettingThemeStatus = new QGSettings(confPath.toLocal8Bit());
QString appConf = m_pGsettingThemeStatus->get("thememode").toString();
if ("lightonly" == appConf) {
themeStatus = themeLightOnly;
themeActions[1]->setChecked(true); //程序gsetting中为浅色only的时候就给浅色按钮设置checked
} else if ("darkonly" == appConf) {
themeStatus = themeBlackOnly;
themeActions[2]->setChecked(true);
} else {
themeStatus = themeAuto;
themeActions[0]->setChecked(true);
}
}
void menuModule::themeUpdate()
{
if (themeStatus == themeLightOnly) {
setThemeLight();
} else if (themeStatus == themeBlackOnly) {
setThemeDark();
} else {
setStyleByThemeGsetting();
}
}
void menuModule::setStyleByThemeGsetting()
{
QString nowThemeStyle = m_pGsettingThemeData->get("styleName").toString();
if ("ukui-dark" == nowThemeStyle || "ukui-black" == nowThemeStyle) {
setThemeDark();
} else {
setThemeLight();
}
}
void menuModule::triggerMenu(QAction *act)
@ -164,36 +97,20 @@ void menuModule::triggerMenu(QAction *act)
}
}
void menuModule::triggerThemeMenu(QAction *act)
{
if (!m_pGsettingThemeStatus) {
m_pGsettingThemeStatus =
new QGSettings(confPath.toLocal8Bit()); // m_pGsettingThemeStatus指针重复使用避免占用栈空间
}
QString str = act->text();
if ("Light" == str) {
themeStatus = themeLightOnly;
disconnect(m_pGsettingThemeData, &QGSettings::changed, this, &menuModule::dealSystemGsettingChange);
m_pGsettingThemeStatus->set("thememode", "lightonly");
// disconnect()
setThemeLight();
} else if ("Dark" == str) {
themeStatus = themeBlackOnly;
disconnect(m_pGsettingThemeData, &QGSettings::changed, this, &menuModule::dealSystemGsettingChange);
m_pGsettingThemeStatus->set("thememode", "darkonly");
setThemeDark();
} else {
themeStatus = themeAuto;
m_pGsettingThemeStatus->set("thememode", "auto");
initGsetting();
// updateTheme();
themeUpdate();
}
}
void menuModule::aboutAction()
{
initAbout();
m_aboutWindow = new kdk::KAboutDialog(this, QIcon::fromTheme("kylin-calculator"), QString(tr("Calculator")),
tr("Version: ") + qApp->applicationVersion());
m_aboutWindow->setAttribute(Qt::WA_DeleteOnClose);
m_aboutWindow->setBodyText(
tr("Calculator is a lightweight calculator based on Qt5, which provides standard calculation, "
"scientific calculation and exchange rate conversion."));
m_aboutWindow->setBodyTextVisiable(true);
m_aboutWindow->setWindowModality(Qt::WindowModal);
m_aboutWindow->setWindowModality(Qt::ApplicationModal);
m_aboutWindow->show();
m_aboutWindow->exec();
return;
}
@ -207,126 +124,6 @@ void menuModule::helpAction()
}
}
void menuModule::initAbout()
{
aboutWindow = new QDialog();
kabase::WindowManage::removeHeader(aboutWindow);
aboutWindow->setFixedSize(420, 360);
aboutWindow->setMinimumHeight(324);
QVBoxLayout *mainlyt = new QVBoxLayout();
QHBoxLayout *titleLyt = initTitleBar();
QVBoxLayout *bodylyt = initBody();
mainlyt->setContentsMargins(0, 0, 0, 0);
mainlyt->setSpacing(0);
mainlyt->addLayout(titleLyt);
mainlyt->addLayout(bodylyt);
mainlyt->addStretch();
aboutWindow->setLayout(mainlyt);
/* 关于弹窗应用内居中 */
QRect availableGeometry = this->parentWidget()->parentWidget()->parentWidget()->geometry();
aboutWindow->move(availableGeometry.center() - aboutWindow->rect().center());
dealSystemGsettingChange("styleName");
aboutWindow->exec();
return;
}
QHBoxLayout *menuModule::initTitleBar()
{
titleIconBtn = new QPushButton();
titleIconBtn->setIcon(QIcon::fromTheme("kylin-calculator"));
titleIconBtn->setIconSize(QSize(24, 24));
titleIconBtn->setFixedSize(QSize(24, 24));
QString btnStyle = "QPushButton{border:0px;border-radius:4px;background:transparent;}"
"QPushButton:Hover{border:0px;border-radius:4px;background:transparent;}"
"QPushButton:Pressed{border:0px;border-radius:4px;background:transparent;}";
titleIconBtn->setStyleSheet(btnStyle);
QPushButton *titleBtnClose = new QPushButton;
titleBtnClose->setFixedSize(30, 30);
titleBtnClose->setIcon(QIcon::fromTheme("window-close-symbolic"));
titleBtnClose->setProperty("isWindowButton", 0x2);
titleBtnClose->setProperty("useIconHighlightEffect", 0x8);
titleBtnClose->setFlat(true);
connect(titleBtnClose, &QPushButton::clicked, [=]() {
aboutWindow->close();
});
titleText->setText(tr(appShowingName.toLocal8Bit()));
// titleText->setStyleSheet("font-size:14px;");
QHBoxLayout *hlyt = new QHBoxLayout;
hlyt->setSpacing(0);
hlyt->setContentsMargins(4, 4, 4, 4);
hlyt->addSpacing(4);
hlyt->addWidget(titleIconBtn); //居下显示
hlyt->addSpacing(8);
hlyt->addWidget(titleText);
hlyt->addStretch();
hlyt->addWidget(titleBtnClose);
return hlyt;
}
QVBoxLayout *menuModule::initBody()
{
bodyIcon = new QPushButton();
bodyIcon->setIcon(QIcon::fromTheme("kylin-calculator"));
bodyIcon->setIconSize(QSize(96, 96));
bodyIcon->setFixedSize(QSize(96, 96));
QString btnStyle = "QPushButton{border:0px;border-radius:4px;background:transparent;}"
"QPushButton:Hover{border:0px;border-radius:4px;background:transparent;}"
"QPushButton:Pressed{border:0px;border-radius:4px;background:transparent;}";
bodyIcon->setStyleSheet(btnStyle);
bodyAppName->setFixedHeight(30);
bodyAppName->setText(tr(appShowingName.toLocal8Bit()));
bodyAppVersion->setFixedHeight(30);
bodyAppVersion->setText(tr("Version: ") + appVersion);
bodyAppVersion->setAlignment(Qt::AlignLeft);
bodyAppDesc->setText(tr("Calculator is a lightweight calculator based on Qt5, which provides standard calculation, "
"scientific calculation and exchange rate conversion."));
bodyAppDesc->setWordWrap(true);
bodyAppDesc->setAlignment(Qt::AlignCenter);
connect(bodySupport, &QLabel::linkActivated, this, [=](const QString url) {
QDesktopServices::openUrl(QUrl(url));
});
bodySupport->setContextMenuPolicy(Qt::NoContextMenu);
bodySupport->setFixedHeight(30);
QVBoxLayout *vlyt = new QVBoxLayout;
vlyt->setMargin(0);
vlyt->setSpacing(0);
vlyt->addSpacing(10);
vlyt->addWidget(bodyIcon, 0, Qt::AlignHCenter);
vlyt->addSpacing(8);
vlyt->addWidget(bodyAppName, 0, Qt::AlignHCenter);
vlyt->addSpacing(8);
vlyt->addWidget(bodyAppVersion, 0, Qt::AlignHCenter);
vlyt->addSpacing(8);
vlyt->addWidget(bodyAppDesc, 0, Qt::AlignHCenter);
vlyt->addSpacing(8);
vlyt->addWidget(bodySupport, 0, Qt::AlignHCenter);
vlyt->addStretch();
return vlyt;
}
void menuModule::initGsetting()
{
if (QGSettings::isSchemaInstalled(UKUI_THEME_GSETTING_PATH)) {
m_pGsettingThemeData = new QGSettings(UKUI_THEME_GSETTING_PATH);
connect(m_pGsettingThemeData, &QGSettings::changed, this, &menuModule::dealSystemGsettingChange);
}
}
void menuModule::keyPressEvent(QKeyEvent *event)
{
if (event->key() == Qt::Key_F1) {
@ -334,50 +131,4 @@ void menuModule::keyPressEvent(QKeyEvent *event)
} else {
QWidget::keyPressEvent(event);
}
}
void menuModule::dealSystemGsettingChange(const QString key)
{
if (key == "styleName") {
refreshThemeBySystemConf();
}
}
void menuModule::refreshThemeBySystemConf()
{
QString themeNow = m_pGsettingThemeData->get("styleName").toString();
if ("ukui-dark" == themeNow || "ukui-black" == themeNow) {
setThemeDark();
} else {
setThemeLight();
}
}
void menuModule::setThemeDark()
{
if (aboutWindow) {
QPalette palette(this->palette());
palette.setColor(QPalette::Background, QColor::fromRgb(13, 13, 14));
aboutWindow->setPalette(palette);
// aboutWindow->setStyleSheet("background-color:rgba(13,13,14,1);");
}
emit menuModuleSetThemeStyle("dark-theme");
bodySupport->setText(tr("Service & Support: ")
+ "<a href=\"mailto://support@kylinos.cn\""
"style=\"color:rgba(225,225,225,1)\">"
"support@kylinos.cn</a>");
}
void menuModule::setThemeLight()
{
if (aboutWindow) {
QPalette palette(this->palette());
palette.setColor(QPalette::Background, QColor::fromRgb(255, 255, 255));
aboutWindow->setPalette(palette);
}
emit menuModuleSetThemeStyle("light-theme");
bodySupport->setText(tr("Service & Support: ")
+ "<a href=\"mailto://support@kylinos.cn\""
"style=\"color:rgba(0,0,0,1)\">"
"support@kylinos.cn</a>");
}
}

View File

@ -18,10 +18,6 @@
#ifndef MENUMODULE_H
#define MENUMODULE_H
#ifndef UKUI_THEME_GSETTING_PATH
#define UKUI_THEME_GSETTING_PATH "org.ukui.style"
#endif
#include <QApplication>
#include <QObject>
#include <QWidget>
@ -32,15 +28,10 @@
#include <QDebug>
#include <QString>
#include <QLabel>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QDesktopServices>
#include <QRect>
#include <QUrl>
#include <QScreen>
#include <QGSettings>
#include <QMetaEnum>
#include <QDialog>
#include "kaboutdialog.h"
#include "highlight-effect.h"
@ -49,68 +40,32 @@ class menuModule : public QWidget
Q_OBJECT
public:
explicit menuModule(QWidget *);
void themeUpdate();
signals:
void menuModuleClose();
void menuModuleChanged(QString);
void pullupHelp();
void menuModuleSetThemeStyle(QString);
public:
QToolButton *menuButton = nullptr;
public:
// 程序在实例化的时候需要传递的信息字段,打开debug开关后这些字段会被自动填充
QString appName = "kylin-calculator"; //格式kylin-usb-creator
QString appShowingName = tr("Calculator"); //格式kylin usb creator ,用来在前端展示
QString appVersion = qApp->applicationVersion();
QString appDesc = "kylin calculator";
QString confPath = "org.kylin-calculator-data.settings";
QDialog *aboutWindow = nullptr;
kdk::KAboutDialog *m_aboutWindow = nullptr;
private:
QMenu *m_menu = nullptr;
QMenu *themeMenu = nullptr;
QSize iconSize;
QString appPath = "tools/kylin-calculator"; //拉起帮助菜单时使用appName字段
QGSettings *m_pGsettingThemeData = nullptr;
QGSettings *m_pGsettingThemeStatus = nullptr;
enum typeThemeStatus : int { themeAuto = 0, themeBlackOnly = 1, themeLightOnly = 2 } themeStatus;
public slots:
void dealSystemGsettingChange(const QString);
private:
void keyPressEvent(QKeyEvent *event);
void init();
QHBoxLayout *initTitleBar(); //关于窗口标题栏初始化
QVBoxLayout *initBody(); // 关于窗口body初始化
void initGsetting();
void initAction();
void triggerMenu(QAction *act); //主菜单动作4
void triggerThemeMenu(QAction *act); //主题动作
void triggerMenu(QAction *act); //主菜单动作4
void aboutAction();
void initAbout(); //关于窗口初始化
void helpAction();
void setThemeFromLocalThemeSetting(QList<QAction *>); //获取本地主题配置
void setStyleByThemeGsetting(); //通过外部主题配置设置主题
void setThemeStyle();
void setThemeLight();
void setThemeDark();
// void updateTheme(); //点击菜单中的主题设置后更新一次主题
QLabel *titleText = nullptr;
QLabel *bodyAppName = nullptr;
QLabel *bodyAppVersion = nullptr;
QLabel *bodyAppDesc = nullptr;
QLabel *bodySupport = nullptr;
QPushButton *titleIconBtn = nullptr;
QPushButton *bodyIcon = nullptr;
void refreshThemeBySystemConf(); //通过系统配置更改主题
};
#endif // MENUMODULE_H

View File

@ -20,11 +20,12 @@ void ProgramKeyboary::init()
}
if (QString("Equal") == m_btnList[i]) {
btn->setProperty("isImportant", true);
} else {
btn->setProperty("useButtonPalette", true);
}
btn->setIcon(QIcon(":/image/programmer/btn" + m_btnList[i] + ".svg"));
btn->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
btn->setFocusPolicy(Qt::NoFocus);
btn->setProperty("useButtonPalette", true);
connect(btn, &QPushButton::clicked, this, &ProgramKeyboary::onClicked);
if (m_btnDecDisList.contains(m_btnList[i])) {
// 该按钮在十进制中需要禁用
@ -32,7 +33,6 @@ void ProgramKeyboary::init()
}
m_btnMap.insert(m_btnList[i], btn);
}
}
void ProgramKeyboary::initLayout()
@ -85,7 +85,7 @@ void ProgramKeyboary::initLayout()
m_layout->setHorizontalSpacing(2);
m_layout->setVerticalSpacing(2);
m_layout->setMargin(2);
m_layout->setMargin(0);
this->setLayout(m_layout);
}

View File

@ -1,3 +1,5 @@
#include "data_warehouse.h"
#include "programmodel.h"
ProgramModel::ProgramModel(QWidget *parent) : QWidget(parent)
@ -21,15 +23,15 @@ ProgramModel::ProgramModel(QWidget *parent) : QWidget(parent)
// 布局
m_layout = new QVBoxLayout();
m_layout->addWidget(m_display);
m_layout->addSpacing(2);
m_layout->addWidget(m_toolbar);
m_layout->addSpacing(6);
m_layout->addWidget(m_binWin);
m_layout->addSpacing(7);
m_layout->addWidget(m_keyboary);
m_layout->setSpacing(0);
m_layout->setMargin(0);
m_layout->addWidget(m_display, 228);
m_layout->addSpacing(2);
m_layout->addWidget(m_toolbar, 60);
m_layout->addSpacing(4);
m_layout->addWidget(m_binWin, 168);
m_layout->addSpacing(4);
m_layout->addWidget(m_keyboary, 572);
m_layout->setContentsMargins(4, 0, 4, 4);
this->setLayout(m_layout);
// 初始隐藏二进制显示
@ -394,14 +396,24 @@ void ProgramModel::slotToolBtnClicked(QString value)
return;
}
if (QString(tr("ShowBinary")) == value) {
this->parentWidget()->window()->setFixedSize(QSize(PROGRAM_WIN_WIDTH, PROGRAM_WIN_HEIGHT + PROGRAM_BIN_HEIGHT));
if (DataWarehouse::getInstance()->platform == QString("xc-tablet")) {
/* xc 平板 */
this->parentWidget()->window()->setMinimumSize(QSize(PROGRAM_WIN_WIDTH, PROGRAM_WIN_HEIGHT + PROGRAM_BIN_HEIGHT));
} else {
this->parentWidget()->window()->setFixedSize(QSize(PROGRAM_WIN_WIDTH, PROGRAM_WIN_HEIGHT + PROGRAM_BIN_HEIGHT));
}
m_binWinShowState = QString("TRUE");
m_binWin->show();
return;
}
if (QString(tr("HideBinary")) == value) {
m_binWin->hide();
this->parentWidget()->window()->setFixedSize(QSize(PROGRAM_WIN_WIDTH, PROGRAM_WIN_HEIGHT));
if (DataWarehouse::getInstance()->platform == QString("xc-tablet")) {
/*xc 平板*/
this->parentWidget()->window()->setMinimumSize(QSize(PROGRAM_WIN_WIDTH, PROGRAM_WIN_HEIGHT));
} else {
this->parentWidget()->window()->setFixedSize(QSize(PROGRAM_WIN_WIDTH, PROGRAM_WIN_HEIGHT));
}
m_binWinShowState = QString("FALSE");
return;
}

View File

@ -116,17 +116,15 @@ void ToolBar::initLayout()
m_labBase->setLayout(m_layoutBase);
m_labBase->layout()->setSizeConstraint(QLayout::SetMinimumSize);
m_layout->addSpacing(8);
m_layout->addWidget(m_labCode);
m_layout->addStretch(1);
m_layout->addWidget(m_boxDigit);
m_layout->addStretch(1);
m_layout->addWidget(m_btnBin);
m_layout->addStretch(1);
m_layout->addWidget(m_btnMS);
m_layout->addStretch(1);
m_layout->addWidget(m_labBase);
m_layout->addSpacing(8);
m_layout->addWidget(m_labCode, 367);
m_layout->addStretch(45);
m_layout->addWidget(m_boxDigit, 305);
m_layout->addStretch(45);
m_layout->addWidget(m_btnBin, 283);
m_layout->addStretch(45);
m_layout->addWidget(m_btnMS, 112);
m_layout->addStretch(56);
m_layout->addWidget(m_labBase, 333);
m_layout->setMargin(0);
this->setLayout(m_layout);

View File

@ -231,7 +231,6 @@ void ScientificModel::setWidgetUi()
btnDelete->setProperty("useButtonPalette", true);
btnSub->setProperty("useButtonPalette", true);
btnAdd->setProperty("useButtonPalette", true);
btnEqual->setProperty("useButtonPalette", true);
btnPer->setProperty("useButtonPalette", true);
btnPoint->setProperty("useButtonPalette", true);
@ -447,6 +446,7 @@ void ScientificModel::setWidgetUi()
btnAllLayout->setSpacing(0);
btnAllLayout->setMargin(0);
btnAllLayout->setContentsMargins(4, 0, 4, 4);
// this->setFixedHeight(320);
this->setLayout(btnAllLayout);
@ -1108,7 +1108,6 @@ void ScientificModel::updateBtnRadDisplay()
m_picturetowhite->drawSymbolicColoredPixmap(QPixmap(":/image/newIcon/scientific/btnDeg.svg")));
}
}
}
}

View File

@ -487,7 +487,6 @@ void StandardModel::setWidgetUi()
btnDelete->setProperty("useButtonPalette", true);
btnSub->setProperty("useButtonPalette", true);
btnAdd->setProperty("useButtonPalette", true);
btnEqual->setProperty("useButtonPalette", true);
btnPer->setProperty("useButtonPalette", true);
btnPoint->setProperty("useButtonPalette", true);
@ -525,6 +524,7 @@ void StandardModel::setWidgetUi()
// 设置间距和背景样式
btnLayout->setSpacing(2);
btnLayout->setMargin(1);
btnLayout->setContentsMargins(4, 0, 4, 4);
// this->setFixedHeight(320);
this->setLayout(btnLayout);
}

View File

@ -371,6 +371,11 @@ void TitleBar::setWidgetUi()
/* 主线版本 放大功能暂时不上 , 暂时隐藏按钮 */
this->m_pMaximizeButton->hide();
/* xc 平板 隐藏置顶按钮 */
if (DataWarehouse::getInstance()->platform == QString("xc-tablet")) {
this->m_pTopButton->hide();
}
this->setLayout(pLayout);
// 设置信号和槽函数

View File

@ -4,6 +4,8 @@
#include "toolmodel.h"
#include "cal.h"
const int TAG_INFO = 100;
using namespace std;
ToolModelOutput::ToolModelOutput(QWidget *parent) : QWidget(parent)
@ -26,55 +28,55 @@ void ToolModelOutput::setWidgetUi()
toolLabRate = new QLabel(this);
toolUpdateLayout = new QVBoxLayout(this);
timeRateLayout = new QVBoxLayout(this);
timeRateLayout->addWidget(toolLabTime, 0, Qt::AlignCenter);
timeRateLayout->addWidget(toolLabRate, 0, Qt::AlignCenter);
timeRateLayout->setSpacing(0);
timeRateLayout->setMargin(0);
toolUpdateLayout->addSpacing(15);
toolUpdateLayout->addWidget(toolLabUpdate, 0, Qt::AlignCenter);
toolUpdateLayout->addWidget(toolIconUpdate, 0, Qt::AlignCenter);
toolUpdateLayout->addLayout(timeRateLayout, 0);
toolUpdateLayout->addSpacing(15);
toolUpdateLayout->setMargin(0);
toolUpdateLayout->addStretch(16);
toolUpdateLayout->addWidget(toolLabUpdate, 33, Qt::AlignCenter);
toolUpdateLayout->addStretch(36);
toolUpdateLayout->addWidget(toolIconUpdate, 27, Qt::AlignCenter);
toolUpdateLayout->addStretch(36);
toolUpdateLayout->addWidget(toolLabTime, 16, Qt::AlignCenter);
toolUpdateLayout->addStretch(15);
toolUpdateLayout->addWidget(toolLabRate, 16, Qt::AlignCenter);
toolUpdateLayout->addStretch(23);
toolUpdateWid = new QWidget(this);
toolUpdateWid->setLayout(toolUpdateLayout);
toolUpdateWid->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
toolUpdateWid->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
/* 换算前单位标识 */
toolLabUnitBef = new QLabel(this);
toolLabIconBef = new QLabel(this);
toolLabUnitBef->setFixedWidth(64);
toolLabUnitBef->setMinimumWidth(64);
toolLabUnitBef->setWordWrap(true);
toolUnitBefLayout = new QHBoxLayout(this);
toolUnitBefLayout->addWidget(toolLabUnitBef);
toolUnitBefLayout->addWidget(toolLabIconBef);
toolUnitBefLayout->addSpacing(16);
toolUnitBefLayout->setMargin(0);
toolUnitBefLayout->addStretch(15);
toolUnitBefLayout->addWidget(toolLabUnitBef, 72, Qt::AlignCenter);
toolUnitBefLayout->addStretch(240);
toolUnitBefLayout->addWidget(toolLabIconBef, 21, Qt::AlignCenter);
toolUnitBefLayout->addStretch(50);
toolUnitBefWid = new QPushButton(this);
toolUnitBefWid->setLayout(toolUnitBefLayout);
toolUnitBefWid->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
toolUnitBefWid->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
/* 换算后单位标识 */
toolLabUnitAft = new QLabel(this);
toolLabIconAft = new QLabel(this);
toolLabUnitAft->setFixedWidth(64);
toolLabUnitAft->setMinimumWidth(64);
toolLabUnitAft->setWordWrap(true);
toolUnitAftLayout = new QHBoxLayout(this);
toolUnitAftLayout->addWidget(toolLabUnitAft);
toolUnitAftLayout->addWidget(toolLabIconAft);
toolUnitAftLayout->addSpacing(16);
toolUnitAftLayout->setMargin(0);
toolUnitAftLayout->addStretch(15);
toolUnitAftLayout->addWidget(toolLabUnitAft, 72, Qt::AlignCenter);
toolUnitAftLayout->addStretch(240);
toolUnitAftLayout->addWidget(toolLabIconAft, 21, Qt::AlignCenter);
toolUnitAftLayout->addStretch(50);
toolUnitAftWid = new QPushButton(this);
toolUnitAftWid->setLayout(toolUnitAftLayout);
toolUnitAftWid->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
toolUnitAftWid->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
/* 汇率刷新 */
toolLabUpdate->setText(tr("Rate update"));
@ -95,17 +97,15 @@ void ToolModelOutput::setWidgetUi()
toolRateNameBef = tr("Chinese Yuan");
toolRateSymbBef = "CNY";
toolLabUnitBef->setText(toolRateNameBef + "\n" + toolRateSymbBef);
toolLabUnitBef->setAlignment(Qt::AlignCenter);
toolLabUnitBef->setAlignment(Qt::AlignLeft);
toolLabIconBef->setPixmap(QIcon::fromTheme("ukui-down-symbolic").pixmap(16, 16));
toolLabIconBef->setFixedSize(16, 16);
/* 换算后单位标识 */
toolRateNameAft = tr("US Dollar");
toolRateSymbAft = "USD";
toolLabUnitAft->setText(toolRateNameAft + "\n" + toolRateSymbAft);
toolLabUnitAft->setAlignment(Qt::AlignCenter);
toolLabUnitAft->setAlignment(Qt::AlignLeft);
toolLabIconAft->setPixmap(QIcon::fromTheme("ukui-down-symbolic").pixmap(16, 16));
toolLabIconAft->setFixedSize(16, 16);
connect(toolUnitBefWid, SIGNAL(clicked()), this, SLOT(unitListBefShow()));
connect(toolUnitAftWid, SIGNAL(clicked()), this, SLOT(unitListAftShow()));
@ -142,35 +142,30 @@ void ToolModelOutput::setWidgetUi()
// 将数据输出组件和数据单位列表加入布局
QGridLayout *toolOutputLayout = new QGridLayout(this);
toolOutputLayout->setColumnStretch(0, 398);
toolOutputLayout->setColumnStretch(1, 1208);
toolOutputLayout->setRowStretch(0, 224);
toolOutputLayout->setRowStretch(1, 107);
toolOutputLayout->setRowStretch(2, 107);
toolOutputLayout->addWidget(toolUpdateWid, 0, 0, 1, 1);
toolOutputLayout->addWidget(toolUnitBefWid, 1, 0, 1, 1);
toolOutputLayout->addWidget(toolUnitAftWid, 2, 0, 1, 1);
toolOutputLayout->addWidget(toolLabHis, 0, 1, 1, 3);
toolOutputLayout->addWidget(toolLabBef, 1, 1, 1, 3);
toolOutputLayout->addWidget(toolLabAft, 2, 1, 1, 3);
toolOutputLayout->addWidget(toolUpdateWid, 0, 0);
toolOutputLayout->addWidget(toolUnitBefWid, 1, 0);
toolOutputLayout->addWidget(toolUnitAftWid, 2, 0);
toolOutputLayout->addWidget(toolLabHis, 0, 1);
toolOutputLayout->addWidget(toolLabBef, 1, 1);
toolOutputLayout->addWidget(toolLabAft, 2, 1);
toolOutputLayout->setSpacing(2);
toolOutputLayout->setContentsMargins(1, 1, 1, 0);
toolOutputLayout->setContentsMargins(4, 1, 1, 2);
this->setLayout(toolOutputLayout);
// this->setFixedHeight(270);
// 数据单位列表
this->unitListBef = new UnitListWidget(this->parentWidget(), this->toolUnitBefWid);
this->unitListAft = new UnitListWidget(this->parentWidget(), this->toolUnitAftWid);
this->unitListBef = new UnitListWidget(this->toolUnitBefWid, this->parentWidget());
this->unitListAft = new UnitListWidget(this->toolUnitAftWid, this->parentWidget());
// QString strUnitList = "人民币,美元,欧元,英镑,日元,韩元,澳大利亚元";
// initUnitList(strUnitList);
connect(unitListBef->unitList, SIGNAL(itemClicked(QListWidgetItem *)), this,
SLOT(unitListSelect(QListWidgetItem *)));
connect(unitListAft->unitList, SIGNAL(itemClicked(QListWidgetItem *)), this,
SLOT(unitListSelect(QListWidgetItem *)));
connect(unitListBef->btnCancel, SIGNAL(clicked()), this, SLOT(unitListBefShow()));
connect(unitListAft->btnCancel, SIGNAL(clicked()), this, SLOT(unitListAftShow()));
connect(this->unitListBef, &QListWidget::itemClicked, this, &ToolModelOutput::listItemClicked);
connect(this->unitListAft, &QListWidget::itemClicked, this, &ToolModelOutput::listItemClicked);
this->unitListBef->hide();
this->unitListAft->hide();
@ -343,7 +338,7 @@ void ToolModelOutput::setWidgetStyle(bool resetFontSize)
toolLabRate->setStyleSheet("font-size:10px;color:#272A2D;");
toolUpdateWid->setStyleSheet("background:#F3F3F3;opacity:1;");
QString unitLabStyle = "font-family:SourceHanSansCN-ExtraLight;font-size:18px;color:#272A2D;line-height:22px;";
QString unitLabStyle = "font-family:SourceHanSansCN-ExtraLight;font-size:18px;color:#272A2D;line-height:18px;";
toolLabUnitBef->setStyleSheet(unitLabStyle);
toolLabIconBef->setPixmap(QIcon::fromTheme("ukui-down-symbolic").pixmap(16, 16));
// toolLabIconBef->setStyleSheet("border-image:url(:/image/downward.png);");
@ -356,12 +351,15 @@ void ToolModelOutput::setWidgetStyle(bool resetFontSize)
"QPushButton:hover{background-color:#F3F3F3;}");
// 数据输出界面
this->toolLabHis->setStyleSheet("color:#8C8C8C;font-size:12px;font-weight:15px;line-height:50px;");
this->toolLabAft->setStyleSheet("color:#272A2D;font-size:40px;font-weight:15px;line-height:50px;");
if (resetFontSize) {
this->toolLabAft->setStyleSheet("color:#272A2D;font-size:40px;font-weight:15px;line-height:50px;");
this->toolLabBef->setStyleSheet("color:#272A2D;font-size:48px;font-weight:15px;");
} else {
QString fontSizeStr = QString::number(toolLabBef->font().pixelSize());
QString fontSizeStr = QString::number(toolLabAft->font().pixelSize());
this->toolLabAft->setStyleSheet("color:#272A2D;font-size:" + fontSizeStr
+ "px;font-weight:15px;line-height:50px;");
fontSizeStr = QString::number(toolLabBef->font().pixelSize());
this->toolLabBef->setStyleSheet("color:#272A2D;font-size:" + fontSizeStr + "px;font-weight:15px;");
}
@ -390,21 +388,18 @@ void ToolModelOutput::setWidgetStyle(bool resetFontSize)
// 数据输出界面
this->toolLabHis->setStyleSheet("color:#8C8C8C;font-size:12px;font-weight:15px;line-height:50px;");
this->toolLabAft->setStyleSheet("color:#FFFFFF;font-size:40px;font-weight:15px;line-height:50px;");
if (resetFontSize) {
this->toolLabAft->setStyleSheet("color:#FFFFFF;font-size:40px;font-weight:15px;line-height:50px;");
this->toolLabBef->setStyleSheet("color:#FFFFFF;font-size:48px;font-weight:15px;");
} else {
QString fontSizeStr = QString::number(toolLabBef->font().pixelSize());
QString fontSizeStr = QString::number(toolLabAft->font().pixelSize());
this->toolLabAft->setStyleSheet("color:#FFFFFF;font-size:" + fontSizeStr
+ "px;font-weight:15px;line-height:50px;");
fontSizeStr = QString::number(toolLabBef->font().pixelSize());
this->toolLabBef->setStyleSheet("color:#FFFFFF;font-size:" + fontSizeStr + "px;font-weight:15px;");
}
}
QListWidgetItem *item = unitListBef->getItem();
unitListBef->setSelectItem(unitListBef->unitList->row(item));
item = unitListAft->getItem();
unitListAft->setSelectItem(unitListAft->unitList->row(item));
}
// 初始化单位列表
@ -412,8 +407,8 @@ void ToolModelOutput::initUnitList(QString listStr)
{
QStringList unitStrList = listStr.split(",");
unitListBef->unitList->clear();
unitListAft->unitList->clear();
unitListBef->clear();
unitListAft->clear();
QListWidgetItem *unitBeforeItem[unitStrList.size()];
QListWidgetItem *unitAfterItem[unitStrList.size()];
@ -452,31 +447,25 @@ void ToolModelOutput::initUnitList(QString listStr)
}
}
UnitListItem *listItemBef = new UnitListItem(unitListBef->unitList);
UnitListItem *listItemAft = new UnitListItem(unitListAft->unitList);
unitBeforeItem[i] = new QListWidgetItem(unitListBef, i);
unitAfterItem[i] = new QListWidgetItem(unitListAft, i);
unitBeforeItem[i]->setSizeHint(QSize(240, 36));
unitAfterItem[i]->setSizeHint(QSize(240, 36));
unitBeforeItem[i]->setText(itemName + " " + unitStrList[i]);
unitAfterItem[i]->setText(itemName + " " + unitStrList[i]);
unitBeforeItem[i]->setData(Qt::DisplayRole + TAG_INFO, unitStrList[i]);
unitAfterItem[i]->setData(Qt::DisplayRole + TAG_INFO, unitStrList[i]);
// 设置列表项的单位名称和单位符号
listItemBef->unitItemName->setText(itemName);
listItemAft->unitItemName->setText(itemName);
listItemBef->unitItemSymb->setText(unitStrList[i]);
listItemAft->unitItemSymb->setText(unitStrList[i]);
unitBeforeItem[i] = new QListWidgetItem(unitListBef->unitList, i);
unitAfterItem[i] = new QListWidgetItem(unitListAft->unitList, i);
unitListBef->unitList->setItemWidget(unitBeforeItem[i], listItemBef);
unitListAft->unitList->setItemWidget(unitAfterItem[i], listItemAft);
unitListBef->insertItem(i, unitBeforeItem[i]);
unitListAft->insertItem(i, unitAfterItem[i]);
}
unitListBef->unitList->setSpacing(2);
unitListAft->unitList->setSpacing(2);
unitListBef->setSpacing(2);
unitListAft->setSpacing(2);
// 默认汇率选择人民币和美元
unitListBef->unitList->setCurrentRow(12);
unitListAft->unitList->setCurrentRow(63);
unitListBef->setSelectItem(12);
unitListAft->setSelectItem(63);
unitListBef->setCurrentRow(12);
unitListAft->setCurrentRow(63);
return;
}
@ -579,29 +568,33 @@ void ToolModelOutput::defUpdateRate()
m_firstLoad = false;
QString strRateAll =
"{\"base\":\"CNY\",\"date\":\"2021-06-11\",\"time_last_updated\":1623369601,\"rates\":{\"AED\":0.575,"
"\"AFN\":12.34,\"ALL\":15.77,\"AMD\":81.17,\"ANG\":0.28,\"AOA\":101.21,\"ARS\":14.86,\"AUD\":0.202,\"AWG\":"
"0.28,\"AZN\":0.266,\"BAM\":0.251,\"BBD\":0.313,\"BDT\":13.25,\"BGN\":0.251,\"BHD\":0.0588,\"BIF\":308.3,"
"\"BMD\":0.156,\"BND\":0.207,\"BOB\":1.08,\"BRL\":0.791,\"BSD\":0.156,\"BTN\":11.42,\"BWP\":1.66,\"BYN\":0."
"39,\"BZD\":0.313,\"CAD\":0.189,\"CDF\":312.11,\"CHF\":0.14,\"CLP\":112.58,\"CNY\":1,\"COP\":561.66,"
"\"CRC\":96.53,\"CUC\":0.156,\"CUP\":4.03,\"CVE\":14.17,\"CZK\":3.27,\"DJF\":27.81,\"DKK\":0.959,\"DOP\":8."
"91,\"DZD\":20.95,\"EGP\":2.45,\"ERN\":2.35,\"ETB\":6.78,\"EUR\":0.129,\"FJD\":0.319,\"FKP\":0.111,\"FOK\":"
"0.959,\"GBP\":0.111,\"GEL\":0.493,\"GGP\":0.111,\"GHS\":0.91,\"GIP\":0.111,\"GMD\":8.11,\"GNF\":1537.96,"
"\"GTQ\":1.21,\"GYD\":32.8,\"HKD\":1.21,\"HNL\":3.76,\"HRK\":0.968,\"HTG\":14.3,\"HUF\":44.62,\"IDR\":2233."
"07,\"ILS\":0.51,\"IMP\":0.111,\"INR\":11.42,\"IQD\":228.91,\"IRR\":6534.46,\"ISK\":18.91,\"JMD\":23.21,"
"\"JOD\":0.111,\"JPY\":17.14,\"KES\":16.89,\"KGS\":13.2,\"KHR\":640.25,\"KID\":0.202,\"KMF\":63.23,\"KRW\":"
"174.61,\"KWD\":0.0469,\"KYD\":0.13,\"KZT\":66.88,\"LAK\":1474.08,\"LBP\":235.9,\"LKR\":31,\"LRD\":26.8,"
"\"LSL\":2.13,\"LYD\":0.699,\"MAD\":1.38,\"MDL\":2.76,\"MGA\":593,\"MKD\":7.92,\"MMK\":257.31,\"MNT\":448."
"17,\"MOP\":1.25,\"MRU\":5.67,\"MUR\":6.36,\"MVR\":2.41,\"MWK\":125.78,\"MXN\":3.08,\"MYR\":0.644,\"MZN\":"
"9.9,\"NAD\":2.13,\"NGN\":66.76,\"NIO\":5.46,\"NOK\":1.3,\"NPR\":18.28,\"NZD\":0.218,\"OMR\":0.0602,"
"\"PAB\":0.156,\"PEN\":0.603,\"PGK\":0.549,\"PHP\":7.47,\"PKR\":24.34,\"PLN\":0.576,\"PYG\":1041.92,"
"\"QAR\":0.57,\"RON\":0.633,\"RSD\":15.11,\"RUB\":11.28,\"RWF\":156.52,\"SAR\":0.587,\"SBD\":1.24,\"SCR\":"
"2.57,\"SDG\":67.49,\"SEK\":1.29,\"SGD\":0.207,\"SHP\":0.111,\"SLL\":1606.89,\"SOS\":90.77,\"SRD\":2.21,"
"\"SSP\":27.82,\"STN\":3.15,\"SYP\":197.22,\"SZL\":2.13,\"THB\":4.88,\"TJS\":1.77,\"TMT\":0.547,\"TND\":0."
"427,\"TOP\":0.346,\"TRY\":1.33,\"TTD\":1.06,\"TVD\":0.202,\"TWD\":4.33,\"TZS\":363.16,\"UAH\":4.23,"
"\"UGX\":550.96,\"USD\":0.156,\"UYU\":6.81,\"UZS\":1656.53,\"VES\":490206.01,\"VND\":3583.66,\"VUV\":16.88,"
"\"WST\":0.393,\"XAF\":84.3,\"XCD\":0.422,\"XDR\":0.108,\"XOF\":84.3,\"XPF\":15.34,\"YER\":39.08,\"ZAR\":2."
"13,\"ZMW\":3.53}}";
"{\"base\":\"CNY\",\"date\":\"2022-08-31\",\"time_last_updated\":1661904002,\"rates\":{\"CNY\":1,"
"\"AED\":0.532,\"AFN\":12.79,\"ALL\":16.96,\"AMD\":58.69,\"ANG\":0.259,\"AOA\":63.56,\"ARS\":20.04,\"AUD"
":0.21,\"AWG\":0.259,\"AZN\":0.246,\"BAM\":0.283,\"BBD\":0.29,\"BDT\":13.68,\"BGN\":0.283,\"BHD"
":0.0544,\"BIF\":293.57,\"BMD\":0.145,\"BND\":0.202,\"BOB\":1,\"BRL\":0.73,\"BSD\":0.145,\"BTN\":11.51,"
"\"BWP"
":1.86,\"BYN\":0.368,\"BZD\":0.29,\"CAD\":0.189,\"CDF\":290.88,\"CHF\":0.141,\"CLP\":127.83,\"COP"
":632.2,\"CRC\":91.77,\"CUP\":3.48,\"CVE\":15.94,\"CZK\":3.55,\"DJF\":25.73,\"DKK\":1.08,\"DOP\":7.72,\"DZD"
":20.38,\"EGP\":2.78,\"ERN\":2.17,\"ETB\":7.62,\"EUR\":0.145,\"FJD\":0.32,\"FKP\":0.124,\"FOK\":1.08,\"GBP"
":0.124,\"GEL\":0.422,\"GGP\":0.124,\"GHS\":1.48,\"GIP\":0.124,\"GMD\":7.95,\"GNF\":1248.08,\"GTQ"
":1.12,\"GYD\":30.25,\"HKD\":1.14,\"HNL\":3.56,\"HRK\":1.09,\"HTG\":16.75,\"HUF\":58.34,\"IDR"
":2140.06,\"ILS\":0.479,\"IMP\":0.124,\"INR\":11.51,\"IQD\":211.05,\"IRR\":6107.09,\"ISK\":20.52,\"JEP"
":0.124,\"JMD\":21.82,\"JOD\":0.103,\"JPY\":20.05,\"KES\":17.45,\"KGS\":11.9,\"KHR\":593.1,\"KID"
":0.21,\"KMF\":71.12,\"KRW\":195,\"KWD\":0.0434,\"KYD\":0.121,\"KZT\":68.73,\"LAK\":2520.87,\"LBP"
":218.29,\"\LKR\":51.24,\"LRD\":22.27,\"LSL\":2.45,\"\LYD\":0.714,\"MAD\":1.53,\"\MDL\":2.8,\"MGA"
":594.64,\"MKD\":8.92,\"MMK\":302.63,\"MNT\":461.08,\"MOP\":1.17,\"MRU\":5.45,\"MUR\":6.37,\"MVR"
":2.23,\"MWK\":150.35,\"MXN\":2.9,\"MYR\":0.649,\"MZN\":9.23,\"NAD\":2.45,\"NGN\":61.17,\"NIO\":5.2,\"NOK"
":1.42,\"NPR\":18.42,\"NZD\":0.236,\"OMR\":0.0557,\"PAB\":0.145,\"PEN\":0.554,\"PGK\":0.51,\"PHP"
":8.12,\"PKR\":31.84,\"PLN\":0.682,\"PYG\":995.19,\"QAR\":0.527,\"RON\":0.702,\"RSD\":16.95,\"RUB"
":8.79,\"RWF\":155.47,\"SAR\":0.543,\"SBD\":1.18,\"SCR\":1.87,\"\SDG\":81.92,\"SEK\":1.54,\"SGD\":0.202,"
"\"SHP"
":0.124,\"SLE\":2.07,\"SLL\":2067.73,\"SOS\":82.2,\"SRD\":3.54,\"SSP\":93.98,\"STN\":3.54,\"SYP"
":364.07,\"SZL\":2.45,\"\THB\":5.27,\"TJS\":1.48,\"TMT\":0.507,\"TND\":0.423,\"TOP\":0.341,\"TRY\":2.63,"
"\"TTD"
":0.983,\"TVD\":0.21,\"TWD\":4.4,\"TZS\":337.14,\"UAH\":5.38,\"UGX\":551.16,\"USD\":0.145,\"UYU\":5.85,"
"\"UZS"
":1584.59,\"VES\":1.14,\"VND\":3394.8,\"VUV\":17.16,\"WST\":0.394,\"XAF\":94.82,\"XCD\":0.391,\"XDR"
":0.111,\"XOF\":94.82,\"XPF\":17.25,\"YER\":36.25,\"ZAR\":2.45,\"ZMW\":2.31,\"ZWL\":78.55}}";
// 格式化处理汇率信息字符串键值对
strRateList = strRateAll.split(QRegExp("[{} :,\"\n]"));
@ -678,52 +671,14 @@ void ToolModelOutput::unitListAftShow()
}
}
// 选择换算前的单位列表
void ToolModelOutput::unitListBefSelect(QListWidgetItem *item)
{
unitListBef->hide();
}
// 选择换算后的单位列表
void ToolModelOutput::unitListAftSelect(QListWidgetItem *item)
{
QString rateSymbol = item->text();
QString rateName = rateSymbol;
// 更新汇率比率显示
QString labelRate = toolLabRate->text();
labelRate = labelRate.section("=", 0, 0) + "= " + QString::number(toolDouRate) + " " + rateName;
toolLabRate->setText(labelRate);
toolLabUnitAft->setText(rateSymbol + "\n" + rateName);
unitListAft->hide();
}
/* 选择货币单位列表 */
void ToolModelOutput::unitListSelect(QListWidgetItem *item)
void ToolModelOutput::listItemClicked(QListWidgetItem *item)
{
if (unitListAft->isHidden()) {
// 获取QWidget
QWidget *itemWid = unitListBef->unitList->itemWidget(item);
// 获取所有的QLabel
QList<QLabel *> labelList = itemWid->findChildren<QLabel *>();
unitListBef->setSelectItem(unitListBef->unitList->row(item));
toolRateSymbBef = labelList[1]->text();
toolRateSymbBef = item->data(Qt::DisplayRole + TAG_INFO).toString();
updateRateName();
unitListBef->hide();
} else {
// 获取QWidget
QWidget *itemWid = unitListAft->unitList->itemWidget(item);
// 获取所有的QLabel
QList<QLabel *> labelList = itemWid->findChildren<QLabel *>();
unitListAft->setSelectItem(unitListAft->unitList->row(item));
toolRateSymbAft = labelList[1]->text();
toolRateSymbAft = item->data(Qt::DisplayRole + TAG_INFO).toString();
updateRateName();
unitListAft->hide();
}
@ -929,7 +884,6 @@ void ToolModelButton::setWidgetUi()
btnDelete->setProperty("useButtonPalette", true);
btnSub->setProperty("useButtonPalette", true);
btnAdd->setProperty("useButtonPalette", true);
btnEqual->setProperty("useButtonPalette", true);
btnPer->setProperty("useButtonPalette", true);
btnPoint->setProperty("useButtonPalette", true);
@ -957,6 +911,7 @@ void ToolModelButton::setWidgetUi()
// 设置间距和背景样式
btnLayout->setSpacing(2);
btnLayout->setMargin(1);
btnLayout->setContentsMargins(4, 0, 4, 4);
// this->setFixedHeight(320);
this->setLayout(btnLayout);
@ -1036,216 +991,22 @@ void ToolModelButton::keyPressEvent(QKeyEvent *event)
return;
}
// 换算器单位列表界面
UnitListWidget::UnitListWidget(QWidget *parent, QWidget *pWidget) : QWidget(parent)
UnitListWidget::UnitListWidget(QWidget *win, QWidget *parent) : QListWidget(parent)
{
this->pWidget = pWidget;
// 初始化组件
this->setWidgetUi();
// 设置组件样式
this->setWidgetStyle();
this->verticalScrollBar()->setProperty("drawScrollBarGroove", false);
this->setAutoFillBackground(true);
this->setBackgroundRole(QPalette::Base);
m_win = win;
}
// 初始化组件
void UnitListWidget::setWidgetUi()
void UnitListWidget::focusOutEvent(QFocusEvent *event)
{
// 标题和取消
unitTitle = new QLabel(this);
btnCancel = new QPushButton(this);
unitTitle->setText(tr("currency"));
// unitTitle->setText("货币");
unitTitle->setAlignment(Qt::AlignLeft);
unitTitle->setFixedHeight(20);
// unitTitle->resize(this->width(),20);
btnCancel->setText(tr("cancel"));
// btnCancel->setText("取消");
btnCancel->setFixedSize(QSize(55, 20));
// btnCancel->move(this->x() + 260 - btnCancel->width(), 15);
// 搜索框
// searchEdit = new QLineEdit(this);
// searchEdit->setPlaceholderText(tr("search"));
// searchEdit->setPlaceholderText("搜索");
// 单位列表
unitList = new QListWidget(this);
unitList->setFrameShape(QListWidget::NoFrame);
unitList->verticalScrollBar()->setProperty("drawScrollBarGroove", false);
// unitList->setVerticalScrollMode(QListWidget::ScrollPerPixel);
// 总体布局
m_layout = new QHBoxLayout;
m_layout->addSpacing(8);
m_layout->addWidget(unitTitle);
m_layout->addStretch();
m_layout->addWidget(btnCancel);
m_layout->addSpacing(8);
m_layout->setMargin(0);
m_layout->setSpacing(0);
unitListLayout = new QVBoxLayout(this);
unitListLayout->addLayout(m_layout);
// unitListLayout->addWidget(searchEdit);
unitListLayout->addWidget(unitList);
unitWid = new QWidget(this);
unitWid->setLayout(unitListLayout);
unitWid->setObjectName("unitWid");
QVBoxLayout *unitLayout = new QVBoxLayout(this);
unitLayout->addWidget(unitWid);
this->setLayout(unitLayout);
this->setContentsMargins(0, 0, 0, 0);
this->setFixedHeight(410);
this->setFixedWidth(280);
// this->resize(280,410);
// btnCancel->raise();
// searchEdit->hide();
//绘制阴影
QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect(this);
static const QColor shadowColor = QColor(70, 70, 70); // 阴影颜色
static const int shadowRedius = 10; // 阴影模糊度
effect->setOffset(0, 0); // (0,0)代表向四周发散
effect->setColor(shadowColor); // 设置阴影颜色
effect->setBlurRadius(shadowRedius); // 设定阴影的模糊半径,数值越大越模糊
this->setGraphicsEffect(effect);
}
// 初始化组件样式
void UnitListWidget::setWidgetStyle()
{
if (WidgetStyle::themeColor == WidgetStyle::ThemeColor::LIGHT) {
unitTitle->setStyleSheet(
"width:30px;height:20px;font-size:14px;font-family:Source Han Sans CN;color:#000000;text-align:left;");
btnCancel->setStyleSheet("width:30px;height:20px;border:0px;font-size:14px;"
"font-family:Source Han Sans CN;color:#3D6BE5;");
// searchEdit->setStyleSheet("width:246px;height:32px;background:rgba(231,231,231,0.5);border-radius:4px;");
unitList->setStyleSheet("QListWidget{background-color:#FFFFFF;}"
"QListWidget::item{border-radius:4px;height:31px;}"
"QListWidget::item:selected{background-color:#3D6BE5;color:#FFFFFF;}"
"QListWidget::item:hover{background-color:#E9E9E9;}");
// unitList->verticalScrollBar()->setStyleSheet("width:4px;background:#E9E9E9;border-radius:2px;border:0;");
unitWid->setStyleSheet("#unitWid{background-color:#FFFFFF;border-radius:4px;}");
} else if (WidgetStyle::themeColor == WidgetStyle::ThemeColor::DARK) {
unitTitle->setStyleSheet(
"width:30px;height:20px;font-size:14px;font-family:Source Han Sans CN;color:#FFFFFF;text-align:left;");
btnCancel->setStyleSheet("width:30px;height:20px;border:0px;font-size:14px;"
"font-family:Source Han Sans CN;color:#EE8A18;");
// searchEdit->setStyleSheet("width:246px;height:32px;background:rgba(30,30,32,0.5);border-radius:4px;");
unitList->setStyleSheet("QListWidget{background-color:#121212;}"
"QListWidget::item{border-radius:4px;height:31px;}"
"QListWidget::item:selected{background-color:#FF800F;}"
"QListWidget::item:hover{background-color:#666666;}");
// unitList->verticalScrollBar()->setStyleSheet("width:4px;background:#47474D;border-radius:2px;border:0;");
unitWid->setStyleSheet("#unitWid{background-color:#121212;border-radius:4px;}");
}
}
void UnitListWidget::setSelectItem(int row)
{
m_item = unitList->item(row);
for (int i = 0; i < unitList->count(); i++) {
// 获取QWidget
QWidget *itemWid = this->unitList->itemWidget(unitList->item(i));
// 获取所有的QLabel
QList<QLabel *> labelList = itemWid->findChildren<QLabel *>();
if (i == row) {
labelList[0]->setStyleSheet("color:#FFFFFF");
labelList[1]->setStyleSheet("color:#FFFFFF");
} else {
if (WidgetStyle::themeColor == WidgetStyle::ThemeColor::LIGHT) {
labelList[0]->setStyleSheet("color:#000000");
labelList[1]->setStyleSheet("color:#000000");
} else if (WidgetStyle::themeColor == WidgetStyle::ThemeColor::DARK) {
labelList[0]->setStyleSheet("color:#FFFFFF");
labelList[1]->setStyleSheet("color:#FFFFFF");
}
}
}
}
// 失去焦点窗口隐藏
void UnitListWidget::focusOutEvent(QFocusEvent *e)
{
if (this->btnCancel->hasFocus() || this->unitList->hasFocus() || this->pWidget->hasFocus()) {
if (m_win->hasFocus()) {
return;
}
this->hide();
}
QListWidgetItem *UnitListWidget::getItem() const
{
return m_item;
}
// 单位列表列表项
UnitListItem::UnitListItem(QWidget *parent) : QWidget(parent)
{
// 设置列表项背景透明
this->setAttribute(Qt::WA_TranslucentBackground, true);
// 初始化列表项组件
setWidgetUi();
// 初始化列表项样式
setWidgetStyle();
}
// 初始化列表项组件
void UnitListItem::setWidgetUi()
{
// 初始化组件元素
unitItemName = new QLabel(this);
unitItemSymb = new QLabel(this);
unitItemLayout = new QHBoxLayout(this);
// 文字对齐方式和自适应放缩
unitItemName->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
unitItemSymb->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
// unitItemName->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
// 将组件加入布局
unitItemLayout->addSpacing(8);
unitItemLayout->addWidget(unitItemName);
unitItemLayout->addWidget(unitItemSymb);
unitItemLayout->setSpacing(0);
unitItemLayout->setMargin(0);
this->setLayout(unitItemLayout);
}
// 初始化列表项样式
void UnitListItem::setWidgetStyle()
{
// 单位名称组件样式
QString itemNameStyle = "font-family:SourceHanSansCN-ExtraLight;font-size:16px;background:transparent;";
unitItemName->setStyleSheet(itemNameStyle);
// 单位符号组件样式
QString itemSymbStyle = "font-family:SourceHanSansCN-ExtraLight;font-size:16px;width:30px;background:transparent;";
unitItemSymb->setStyleSheet(itemSymbStyle);
unitItemSymb->setFixedWidth(50);
this->setFixedHeight(32);
}
void UpdateRateThread::run()
{
// 访问汇算换算api

View File

@ -57,9 +57,8 @@
#include "../common/picturetowhite.h"
//#include "cal.h"
class UnitListWidget;
class UnitListItem;
class UpdateRateThread;
class UnitListWidget;
// 换算器输入输出界面
class ToolModelOutput : public QWidget, public InputSymbols
@ -153,8 +152,6 @@ public:
// 默认更新汇率
void defUpdateRate();
// signals:
// void clicked();
public slots:
// 控制换算前的单位列表
@ -163,14 +160,7 @@ public slots:
// 控制换算后的单位列表
void unitListAftShow();
// 选择换算前的单位列表
void unitListBefSelect(QListWidgetItem *);
// 选择换算后的单位列表
void unitListAftSelect(QListWidgetItem *);
// 选择货币单位列表
void unitListSelect(QListWidgetItem *);
void listItemClicked(QListWidgetItem *item);
// 响应线程汇率更新完成
void dealDone(QStringList list);
@ -213,73 +203,17 @@ public slots:
void keyPressEvent(QKeyEvent *event);
};
// 换算器单位列表项
class UnitListItem : public QWidget
class UnitListWidget : public QListWidget
{
Q_OBJECT
public:
explicit UnitListItem(QWidget *parent = 0);
// 初始化列表项组件
void setWidgetUi();
// 初始化列表项样式
void setWidgetStyle();
// 单位名称
QLabel *unitItemName;
// 单位标识
QLabel *unitItemSymb;
// 列表项水平布局
QHBoxLayout *unitItemLayout;
};
// 换算器单位列表界面
class UnitListWidget : public QWidget
{
Q_OBJECT
public:
explicit UnitListWidget(QWidget *parent = 0, QWidget *pWidget = 0);
// 标题和取消
QLabel *unitTitle;
QPushButton *btnCancel;
// 搜索框
// QLineEdit *searchEdit;
// 单位列表
QListWidget *unitList;
QHBoxLayout *unitItemLayout;
QLabel *unitName;
QLabel *unitSign;
// 总体布局
QHBoxLayout *m_layout;
QVBoxLayout *unitListLayout;
// 初始化组件
void setWidgetUi();
// 初始化组件样式
void setWidgetStyle();
void setSelectItem(int row);
QListWidgetItem *getItem() const;
protected:
// 失去焦点窗口隐藏
virtual void focusOutEvent(QFocusEvent *e);
explicit UnitListWidget(QWidget *win, QWidget *parent = nullptr);
private:
QWidget *pWidget;
QWidget *m_win = nullptr;
QWidget *unitWid;
QListWidgetItem *m_item; // 当前所选行
protected:
void focusOutEvent(QFocusEvent *event);
};
class UpdateRateThread : public QThread

View File

@ -37,7 +37,7 @@
</message>
<message>
<source>Right operand error!</source>
<translation type="unfinished"></translation>
<translation>!</translation>
</message>
</context>
<context>
@ -140,7 +140,7 @@
</message>
<message>
<source>ShowBinary</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
</context>
<context>
@ -198,7 +198,7 @@
</message>
<message>
<source>ShowBinary</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
</context>
<context>
@ -217,7 +217,7 @@
</message>
<message>
<source>Error!</source>
<translation type="unfinished">!</translation>
<translation>!</translation>
</message>
</context>
<context>

View File

@ -0,0 +1,424 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="zh">
<context>
<name>Calc</name>
<message>
<location filename="../calc_programmer/calc/calc.cpp" line="85"/>
<source>The expression is empty!</source>
<translation></translation>
</message>
<message>
<location filename="../calc_programmer/calc/calc.cpp" line="106"/>
<location filename="../calc_programmer/calc/calc.cpp" line="121"/>
<location filename="../calc_programmer/calc/calc.cpp" line="126"/>
<location filename="../calc_programmer/calc/calc.cpp" line="153"/>
<location filename="../calc_programmer/calc/calc.cpp" line="180"/>
<location filename="../calc_programmer/calc/calc.cpp" line="247"/>
<location filename="../calc_programmer/calc/calc.cpp" line="272"/>
<location filename="../calc_programmer/calc/calc.cpp" line="298"/>
<source>Expression error!</source>
<translation></translation>
</message>
<message>
<location filename="../calc_programmer/calc/calc.cpp" line="116"/>
<location filename="../calc_programmer/calc/calc.cpp" line="140"/>
<source>Missing left parenthesis!</source>
<translation></translation>
</message>
<message>
<location filename="../calc_programmer/calc/calc.cpp" line="207"/>
<source>The value is too large!</source>
<translation></translation>
</message>
<message>
<location filename="../calc_programmer/calc/calc.cpp" line="219"/>
<source>Miss operand!</source>
<translation></translation>
</message>
<message>
<location filename="../calc_programmer/calc/calc.cpp" line="328"/>
<location filename="../calc_programmer/calc/calc.cpp" line="386"/>
<source>Operator undefined!</source>
<translation></translation>
</message>
<message>
<location filename="../calc_programmer/calc/calc.cpp" line="350"/>
<source>Divisor cannot be 0!</source>
<translation> 0</translation>
</message>
<message>
<location filename="../calc_programmer/calc/calc.cpp" line="370"/>
<location filename="../calc_programmer/calc/calc.cpp" line="378"/>
<source>Right operand error!</source>
<translation></translation>
</message>
<message>
<source>The shifted right operand is negative!</source>
<translation type="vanished">!</translation>
</message>
</context>
<context>
<name>FuncList</name>
<message>
<location filename="../src/funclist.cpp" line="37"/>
<source>Calculator</source>
<translation></translation>
</message>
<message>
<location filename="../src/funclist.cpp" line="42"/>
<source>standard</source>
<translation></translation>
</message>
<message>
<location filename="../src/funclist.cpp" line="42"/>
<source>scientific</source>
<translation></translation>
</message>
<message>
<location filename="../src/funclist.cpp" line="58"/>
<source>Unit converter</source>
<translation></translation>
</message>
<message>
<location filename="../src/funclist.cpp" line="64"/>
<source>exchange rate</source>
<translation></translation>
</message>
</context>
<context>
<name>IntelModeList</name>
<message>
<location filename="../src/basicbutton.cpp" line="145"/>
<source>standard</source>
<translation></translation>
</message>
<message>
<location filename="../src/basicbutton.cpp" line="148"/>
<source>scientific</source>
<translation></translation>
</message>
</context>
<context>
<name>MainWindow</name>
<message>
<location filename="../src/mainwindow.cpp" line="233"/>
<source>Calculator</source>
<translation></translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="996"/>
<location filename="../src/mainwindow.cpp" line="1185"/>
<location filename="../src/mainwindow.cpp" line="1201"/>
<source>standard</source>
<translation></translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="1183"/>
<source>calculator</source>
<translation></translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="260"/>
<source>Copy</source>
<translation></translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="261"/>
<source>Paste</source>
<translation></translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="853"/>
<source>input too long</source>
<translation></translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="55"/>
<location filename="../src/mainwindow.cpp" line="1185"/>
<location filename="../src/mainwindow.cpp" line="1205"/>
<source>scientific</source>
<translation></translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="1218"/>
<source>exchange rate</source>
<translation></translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="748"/>
<location filename="../src/mainwindow.cpp" line="752"/>
<source>Error!</source>
<translation></translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="756"/>
<source>Input error!</source>
<translation></translation>
</message>
</context>
<context>
<name>ProgramDisplay</name>
<message>
<location filename="../src/programmer/programdisplay.cpp" line="56"/>
<location filename="../src/programmer/programdisplay.cpp" line="79"/>
<source>input too long!</source>
<translation></translation>
</message>
</context>
<context>
<name>ProgramModel</name>
<message>
<location filename="../src/programmer/programmodel.cpp" line="234"/>
<location filename="../src/programmer/programmodel.cpp" line="318"/>
<source>Input error!</source>
<translation></translation>
</message>
<message>
<location filename="../src/programmer/programmodel.cpp" line="400"/>
<source>ShowBinary</source>
<translation></translation>
</message>
<message>
<source>DisplayBinary</source>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../src/programmer/programmodel.cpp" line="406"/>
<source>HideBinary</source>
<translation></translation>
</message>
</context>
<context>
<name>TitleBar</name>
<message>
<source>FuncList</source>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../src/titlebar.cpp" line="280"/>
<source>Standard</source>
<translation></translation>
</message>
<message>
<location filename="../src/titlebar.cpp" line="281"/>
<source>Scientific</source>
<translation></translation>
</message>
<message>
<source>standard </source>
<translation type="vanished"> </translation>
</message>
<message>
<location filename="../src/titlebar.cpp" line="56"/>
<location filename="../src/titlebar.cpp" line="67"/>
<location filename="../src/titlebar.cpp" line="248"/>
<source>standard</source>
<translation></translation>
</message>
<message>
<location filename="../src/titlebar.cpp" line="57"/>
<location filename="../src/titlebar.cpp" line="260"/>
<source>scientific</source>
<translation></translation>
</message>
<message>
<source>scientific </source>
<translation type="vanished"> </translation>
</message>
<message>
<location filename="../src/titlebar.cpp" line="282"/>
<source>Exchange Rate</source>
<translation></translation>
</message>
<message>
<location filename="../src/titlebar.cpp" line="283"/>
<source>Programmer</source>
<translation></translation>
</message>
<message>
<location filename="../src/titlebar.cpp" line="308"/>
<source>StayTop</source>
<translation></translation>
</message>
<message>
<location filename="../src/titlebar.cpp" line="413"/>
<source>Restore</source>
<translation></translation>
</message>
<message>
<location filename="../src/titlebar.cpp" line="112"/>
<location filename="../src/titlebar.cpp" line="309"/>
<source>Minimize</source>
<translation></translation>
</message>
<message>
<location filename="../src/titlebar.cpp" line="113"/>
<location filename="../src/titlebar.cpp" line="310"/>
<location filename="../src/titlebar.cpp" line="404"/>
<source>Maximize</source>
<translation></translation>
</message>
<message>
<location filename="../src/titlebar.cpp" line="114"/>
<location filename="../src/titlebar.cpp" line="311"/>
<source>Close</source>
<translation></translation>
</message>
</context>
<context>
<name>ToolBar</name>
<message>
<source>DisplayBinary</source>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../src/programmer/toolbar.cpp" line="63"/>
<location filename="../src/programmer/toolbar.cpp" line="219"/>
<location filename="../src/programmer/toolbar.cpp" line="222"/>
<source>ShowBinary</source>
<translation></translation>
</message>
<message>
<location filename="../src/programmer/toolbar.cpp" line="220"/>
<location filename="../src/programmer/toolbar.cpp" line="221"/>
<source>HideBinary</source>
<translation></translation>
</message>
</context>
<context>
<name>ToolModelOutput</name>
<message>
<location filename="../src/toolmodel.cpp" line="80"/>
<source>Rate update</source>
<translation></translation>
</message>
<message>
<location filename="../src/toolmodel.cpp" line="95"/>
<source>Chinese Yuan</source>
<translation></translation>
</message>
<message>
<location filename="../src/toolmodel.cpp" line="103"/>
<source>US Dollar</source>
<translation></translation>
</message>
<message>
<location filename="../src/toolmodel.cpp" line="515"/>
<source>Error!</source>
<translation></translation>
</message>
</context>
<context>
<name>UnitListWidget</name>
<message>
<location filename="../src/toolmodel.cpp" line="1163"/>
<source>currency</source>
<translation></translation>
</message>
<message>
<location filename="../src/toolmodel.cpp" line="1169"/>
<source>cancel</source>
<translation></translation>
</message>
<message>
<source>search</source>
<translation type="vanished"></translation>
</message>
</context>
<context>
<name>menuModule</name>
<message>
<location filename="../src/menumodule/menumodule.cpp" line="44"/>
<source>Menu</source>
<translation></translation>
</message>
<message>
<location filename="../src/menumodule/menumodule.cpp" line="56"/>
<location filename="../src/menumodule/menumodule.cpp" line="155"/>
<source>Standard</source>
<translation></translation>
</message>
<message>
<location filename="../src/menumodule/menumodule.cpp" line="58"/>
<location filename="../src/menumodule/menumodule.cpp" line="157"/>
<source>Scientific</source>
<translation></translation>
</message>
<message>
<location filename="../src/menumodule/menumodule.cpp" line="60"/>
<location filename="../src/menumodule/menumodule.cpp" line="159"/>
<source>Exchange Rate</source>
<translation></translation>
</message>
<message>
<location filename="../src/menumodule/menumodule.cpp" line="62"/>
<location filename="../src/menumodule/menumodule.cpp" line="161"/>
<source>Programmer</source>
<translation></translation>
</message>
<message>
<location filename="../src/menumodule/menumodule.cpp" line="68"/>
<source>Theme</source>
<translation></translation>
</message>
<message>
<location filename="../src/menumodule/menumodule.cpp" line="70"/>
<location filename="../src/menumodule/menumodule.cpp" line="153"/>
<source>Help</source>
<translation></translation>
</message>
<message>
<location filename="../src/menumodule/menumodule.cpp" line="72"/>
<location filename="../src/menumodule/menumodule.cpp" line="151"/>
<source>About</source>
<translation></translation>
</message>
<message>
<location filename="../src/menumodule/menumodule.cpp" line="74"/>
<location filename="../src/menumodule/menumodule.cpp" line="149"/>
<source>Quit</source>
<translation>退</translation>
</message>
<message>
<location filename="../src/menumodule/menumodule.cpp" line="85"/>
<source>Auto</source>
<translation></translation>
</message>
<message>
<location filename="../src/menumodule/menumodule.cpp" line="89"/>
<source>Light</source>
<translation></translation>
</message>
<message>
<location filename="../src/menumodule/menumodule.cpp" line="93"/>
<source>Dark</source>
<translation></translation>
</message>
<message>
<location filename="../src/menumodule/menumodule.cpp" line="302"/>
<source>Version: </source>
<translation> </translation>
</message>
<message>
<location filename="../src/menumodule/menumodule.cpp" line="306"/>
<source>Calculator is a lightweight calculator based on Qt5, which provides standard calculation, scientific calculation and exchange rate conversion.</source>
<translation>Qt5的羽量級計算機</translation>
</message>
<message>
<location filename="../src/menumodule/menumodule.cpp" line="371"/>
<location filename="../src/menumodule/menumodule.cpp" line="379"/>
<source>Service &amp; Support: </source>
<translation> </translation>
</message>
<message>
<source>Support: support@kylinos.cn</source>
<translation type="vanished">support@kylinos.cn</translation>
</message>
<message>
<location filename="../src/menumodule/menumodule.h" line="66"/>
<source>Calculator</source>
<translation></translation>
</message>
</context>
</TS>