From 8a9dc115a05bb947bac9e4ff206407d721c26223 Mon Sep 17 00:00:00 2001 From: iotang <3057244225@qq.com> Date: Tue, 3 Mar 2020 08:39:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=20Bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- forms/optionsdialog.ui | 6 +- forms/visualsettings.ui | 264 ++++++++++++++++++++++++++++++---------- lemon_zh_CN.qm | Bin 51170 -> 51312 bytes lemon_zh_CN.ts | 20 ++- resultviewer.cpp | 2 +- settings.cpp | 117 ++++++++++++++++++ settings.h | 21 ++++ visualsettings.cpp | 61 ++++++++++ visualsettings.h | 7 ++ 9 files changed, 425 insertions(+), 73 deletions(-) diff --git a/forms/optionsdialog.ui b/forms/optionsdialog.ui index 8b47f013..6291cbd9 100755 --- a/forms/optionsdialog.ui +++ b/forms/optionsdialog.ui @@ -6,13 +6,13 @@ 0 0 - 400 + 450 437 - 400 + 450 437 @@ -26,7 +26,7 @@ font-size: 11pt; - 2 + 0 diff --git a/forms/visualsettings.ui b/forms/visualsettings.ui index 77770289..2439795b 100644 --- a/forms/visualsettings.ui +++ b/forms/visualsettings.ui @@ -9,13 +9,13 @@ 0 0 - 382 - 212 + 437 + 332 - 382 + 437 0 @@ -23,42 +23,76 @@ Form + + + + + 0 + 0 + + + + font-size:11pt;font-weight:bold; + + + Color CE (HSL) + + + - + - + + + -360.000000000000000 + - 359 + 360.000000000000000 + + + 1.000000000000000 - 300 + 0.000000000000000 - + + + -100.000000000000000 + 100.000000000000000 + + 1.000000000000000 + - 100.000000000000000 + 0.000000000000000 - + + + -100.000000000000000 + 100.000000000000000 + + 1.000000000000000 + - 83.329999999999998 + 0.000000000000000 - - + + 0 @@ -69,7 +103,7 @@ font-size:11pt;font-weight:bold; - Color CE (HSL) + Color Max (HSL) @@ -90,24 +124,18 @@ - - - Qt::Vertical - - - - 20 - 40 - + + + Reset to Default - + - - + + - + - 359 + 719 120 @@ -115,7 +143,7 @@ - + 100.000000000000000 @@ -125,67 +153,51 @@ - + 100.000000000000000 - 100.000000000000000 + 57.500000000000000 - - + + - + 359 - 0 + 300 - + 100.000000000000000 - 0.000000000000000 + 100.000000000000000 - + 100.000000000000000 - 91.670000000000002 + 83.329999999999998 - - - - - 0 - 0 - - - - font-size:11pt;font-weight:bold; - - - Color Max (HSL) - - - @@ -202,20 +214,106 @@ - - + + - + + + -10.000000000000000 + + + 10.000000000000000 + + + 0.100000000000000 + + + 1.000000000000000 + + + + + + + -10.000000000000000 + + + 10.000000000000000 + + + 0.100000000000000 + + + 1.000000000000000 + + + + + + + -10.000000000000000 + + + 10.000000000000000 + + + 0.100000000000000 + + + 1.330000000000000 + + + + + + + + + 359 + + 0 + + + + + + + 100.000000000000000 + + + 0.000000000000000 + + + + + + + 100.000000000000000 + + + 91.670000000000002 + + + + + + + + + + + 719 + 120 - + 100.000000000000000 @@ -225,24 +323,62 @@ - + 100.000000000000000 - 57.500000000000000 + 100.000000000000000 - - + + + + + 0 + 0 + + + + font-size:11pt;font-weight:bold; + - Reset to Default + Grand Compensation + + + + + + + + 0 + 0 + + + + font-size:11pt;font-weight:bold; + + + Grand Rate + + + + Qt::Vertical + + + + 20 + 40 + + + + diff --git a/lemon_zh_CN.qm b/lemon_zh_CN.qm index cba3eaf2d18b844724fd11d9b251fe0df3433e4e..077c8f970c56d2dda21a86a6f24c48135b75d4a4 100755 GIT binary patch delta 162 zcmaFV&-`Hm^8^vb4--Y}8J|s@I*n-y|7KmriLC62391YXn{y`bW&6l3mbVYc*5169 z{W~M$%FRnT*ReBgvD_RgxR{A)OWNjN!up#vc@nIH*k;UWD(XnhPUc_$0yZEPaxY5E wOHpvn&n-yJD^4uQ%+H%FcuYc70H!+lMzB}_Z*eIU1(U`G@Uy-L_5lGav$YAX2LiLZ Uvt<#Z0s^z>vkDY1vy->Sxjs=E>;M1& diff --git a/lemon_zh_CN.ts b/lemon_zh_CN.ts index a7f9a7e7..f516ce8e 100755 --- a/lemon_zh_CN.ts +++ b/lemon_zh_CN.ts @@ -3819,27 +3819,37 @@ p, li { white-space: pre-wrap; } Form - + Color CE (HSL) 编译错误 HSL 颜色 - + Color Min (HSL) 背景 HSL 颜色 - + + Grand Compensation + 总分颜色补正 + + + + Grand Rate + 总分颜色变化倍率 + + + Color Max (HSL) 满分 HSL 颜色 - + Color NoFile (HSL) 无文件 HSL 颜色 - + Reset to Default 重置到默认 diff --git a/resultviewer.cpp b/resultviewer.cpp index ecb0a72c..6cc38b38 100644 --- a/resultviewer.cpp +++ b/resultviewer.cpp @@ -211,7 +211,7 @@ void ResultViewer::refreshViewer() if (totalScore != -1) { item(i, 2)->setData(Qt::DisplayRole, totalScore); - item(i, 2)->setBackground(setting.getColorPer(totalScore * 1.33, sfullScore)); + item(i, 2)->setBackground(setting.getColorGrand(totalScore, sfullScore)); QFont font; font.setBold(true); diff --git a/settings.cpp b/settings.cpp index 0aa5b5d9..4abd7883 100644 --- a/settings.cpp +++ b/settings.cpp @@ -167,6 +167,36 @@ double Settings::getColorCeL() return colorCeL; } +double Settings::getGrandCompH() +{ + return grandCompH; +} + +double Settings::getGrandCompS() +{ + return grandCompS; +} + +double Settings::getGrandCompL() +{ + return grandCompL; +} + +double Settings::getGrandRateH() +{ + return grandRateH; +} + +double Settings::getGrandRateS() +{ + return grandRateS; +} + +double Settings::getGrandRateL() +{ + return grandRateL; +} + QColor Settings::getColorMx() { return QColor::fromHslF(colorMxH / 360.00, colorMxS / 100.00, colorMxL / 100.00); @@ -211,6 +241,40 @@ QColor Settings::getColorPer(double p) if (p > 0) l += distan * 5; if (p >= 1 - 1e-12) l += distan * 5; + while (h > 1 + 1e-12) h -= 1; + + h = fmax(0, fmin(h, 1)); + s = fmax(0, fmin(s, 1)); + l = fmax(0, fmin(l, 1)); + + return QColor::fromHslF(h, s, l); +} + +QColor Settings::getColorGrand(double p) +{ + double distan, h, s, l; + + distan = grandRateH * (colorMxH - colorMiH) / 360.00 / 110.00; + h = grandCompH / 360.00 + colorMiH / 360.00 + 100 * p * distan; + if (p > 0) h += distan * 5; + if (p >= 1 - 1e-12) h += distan * 5; + + distan = grandRateS * (colorMxS - colorMiS) / 100.00 / 110.00; + s = grandCompS / 100.00 + colorMiS / 100.00 + 100 * p * distan; + if (p > 0) s += distan * 5; + if (p >= 1 - 1e-12) s += distan * 5; + + distan = grandRateL * (colorMxL - colorMiL) / 100.00 / 110.00; + l = grandCompL / 100.0 + colorMiL / 100.00 + 100 * p * distan; + if (p > 0) l += distan * 5; + if (p >= 1 - 1e-12) l += distan * 5; + + while (h > 1 + 1e-12) h -= 1; + + h = fmax(0, fmin(h, 1)); + s = fmax(0, fmin(s, 1)); + l = fmax(0, fmin(l, 1)); + return QColor::fromHslF(h, s, l); } @@ -219,6 +283,11 @@ QColor Settings::getColorPer(double a, double b) return getColorPer(a / b); } +QColor Settings::getColorGrand(double a, double b) +{ + return getColorGrand(a / b); +} + void Settings::setDefaultFullScore(int score) { defaultFullScore = score; @@ -382,6 +451,36 @@ void Settings::setColorCeL(double x) colorCeL = x; } +void Settings::setGrandCompH(double x) +{ + grandCompH = x; +} + +void Settings::setGrandCompS(double x) +{ + grandCompS = x; +} + +void Settings::setGrandCompL(double x) +{ + grandCompL = x; +} + +void Settings::setGrandRateH(double x) +{ + grandRateH = x; +} + +void Settings::setGrandRateS(double x) +{ + grandRateS = x; +} + +void Settings::setGrandRateL(double x) +{ + grandRateL = x; +} + void Settings::copyFrom(Settings *other) { setDefaultFullScore(other->getDefaultFullScore()); @@ -407,6 +506,12 @@ void Settings::copyFrom(Settings *other) setColorCeH(other->getColorCeH()); setColorCeS(other->getColorCeS()); setColorCeL(other->getColorCeL()); + setGrandCompH(other->getGrandCompH()); + setGrandCompS(other->getGrandCompS()); + setGrandCompL(other->getGrandCompL()); + setGrandRateH(other->getGrandRateH()); + setGrandRateS(other->getGrandRateS()); + setGrandRateL(other->getGrandRateL()); for (int i = 0; i < compilerList.size(); i ++) { @@ -457,6 +562,12 @@ void Settings::saveSettings() settings.setValue("ColorCeH", colorCeH); settings.setValue("ColorCeS", colorCeS); settings.setValue("ColorCeL", colorCeL); + settings.setValue("GrandCompH", grandCompH); + settings.setValue("GrandCompS", grandCompS); + settings.setValue("GrandCompL", grandCompL); + settings.setValue("GrandRateH", grandRateH); + settings.setValue("GrandRateS", grandRateS); + settings.setValue("GrandRateL", grandRateL); settings.endGroup(); settings.beginWriteArray("v1.2/CompilerSettings"); @@ -542,6 +653,12 @@ void Settings::loadSettings() colorCeH = settings.value("ColorCeH", 300).toInt(); colorCeS = settings.value("ColorCeS", 100).toDouble(); colorCeL = settings.value("ColorCeL", 83.33).toDouble(); + grandCompH = settings.value("GrandCompH", 0).toDouble(); + grandCompS = settings.value("GrandCompS", 0).toDouble(); + grandCompL = settings.value("GrandCompL", 0).toDouble(); + grandRateH = settings.value("GrandRateH", 1).toDouble(); + grandRateS = settings.value("GrandRateS", 1).toDouble(); + grandRateL = settings.value("GrandRateL", 1.33).toDouble(); settings.endGroup(); int compilerCount = settings.beginReadArray("v1.2/CompilerSettings"); diff --git a/settings.h b/settings.h index f4809d9e..01f1b74d 100755 --- a/settings.h +++ b/settings.h @@ -62,6 +62,12 @@ class Settings : public QObject int getColorCeH(); double getColorCeS(); double getColorCeL(); + double getGrandCompH(); + double getGrandCompS(); + double getGrandCompL(); + double getGrandRateH(); + double getGrandRateS(); + double getGrandRateL(); QColor getColorMx(); QColor getColorMi(); @@ -69,7 +75,9 @@ class Settings : public QObject QColor getColorCe(); QColor getColorAntiMi(); QColor getColorPer(double); + QColor getColorGrand(double); QColor getColorPer(double, double); + QColor getColorGrand(double, double); void setDefaultFullScore(int); void setDefaultTimeLimit(int); @@ -96,6 +104,12 @@ class Settings : public QObject void setColorCeH(int); void setColorCeS(double); void setColorCeL(double); + void setGrandCompH(double); + void setGrandCompS(double); + void setGrandCompL(double); + void setGrandRateH(double); + void setGrandRateS(double); + void setGrandRateL(double); void addCompiler(Compiler *); void deleteCompiler(int); @@ -145,6 +159,13 @@ class Settings : public QObject int colorCeH; double colorCeS; double colorCeL; + + double grandCompH; + double grandCompS; + double grandCompL; + double grandRateH; + double grandRateS; + double grandRateL; }; #endif // SETTINGS_H diff --git a/visualsettings.cpp b/visualsettings.cpp index 10888212..7dd08ed3 100644 --- a/visualsettings.cpp +++ b/visualsettings.cpp @@ -51,6 +51,19 @@ VisualSettings::VisualSettings(QWidget *parent) : connect(ui->doubleSpinBoxCeL, SIGNAL(valueChanged(double)), this, SLOT(colorCeLChanged(double))); + connect(ui->grandCompH, SIGNAL(valueChanged(double)), + this, SLOT(grandCompHChanged(double))); + connect(ui->grandCompS, SIGNAL(valueChanged(double)), + this, SLOT(grandCompSChanged(double))); + connect(ui->grandCompL, SIGNAL(valueChanged(double)), + this, SLOT(grandCompLChanged(double))); + connect(ui->grandRateH, SIGNAL(valueChanged(double)), + this, SLOT(grandRateHChanged(double))); + connect(ui->grandRateS, SIGNAL(valueChanged(double)), + this, SLOT(grandRateSChanged(double))); + connect(ui->grandRateL, SIGNAL(valueChanged(double)), + this, SLOT(grandRateLChanged(double))); + connect(ui->resetToDefaultButton, SIGNAL(clicked()), this, SLOT(resetToDefault())); } @@ -69,6 +82,12 @@ void VisualSettings::resetToDefault() ui->spinBoxCeH->setValue(300); ui->doubleSpinBoxCeS->setValue(100); ui->doubleSpinBoxCeL->setValue(83.33); + ui->grandCompH->setValue(0); + ui->grandCompS->setValue(0); + ui->grandCompL->setValue(0); + ui->grandRateH->setValue(1); + ui->grandRateS->setValue(1); + ui->grandRateL->setValue(1.33); editSettings->setColorMxH(ui->spinBoxMxH->value()); editSettings->setColorMxS(ui->doubleSpinBoxMxS->value()); editSettings->setColorMxL(ui->doubleSpinBoxMxL->value()); @@ -81,6 +100,12 @@ void VisualSettings::resetToDefault() editSettings->setColorCeH(ui->spinBoxCeH->value()); editSettings->setColorCeS(ui->doubleSpinBoxCeS->value()); editSettings->setColorCeL(ui->doubleSpinBoxCeL->value()); + editSettings->setGrandCompH(ui->grandCompH->value()); + editSettings->setGrandCompS(ui->grandCompS->value()); + editSettings->setGrandCompL(ui->grandCompL->value()); + editSettings->setGrandRateH(ui->grandRateH->value()); + editSettings->setGrandRateS(ui->grandRateS->value()); + editSettings->setGrandRateL(ui->grandRateL->value()); } void VisualSettings::resetEditSettings(Settings *settings) @@ -99,6 +124,12 @@ void VisualSettings::resetEditSettings(Settings *settings) ui->spinBoxCeH->setValue(editSettings->getColorCeH()); ui->doubleSpinBoxCeS->setValue(editSettings->getColorCeS()); ui->doubleSpinBoxCeL->setValue(editSettings->getColorCeL()); + ui->grandCompH->setValue(editSettings->getGrandCompH()); + ui->grandCompS->setValue(editSettings->getGrandCompS()); + ui->grandCompL->setValue(editSettings->getGrandCompL()); + ui->grandRateH->setValue(editSettings->getGrandRateH()); + ui->grandRateS->setValue(editSettings->getGrandRateS()); + ui->grandRateL->setValue(editSettings->getGrandRateL()); } void VisualSettings::colorMxHChanged(const int &x) @@ -161,6 +192,36 @@ void VisualSettings::colorCeLChanged(const double &x) editSettings->setColorCeL(x); } +void VisualSettings::grandCompHChanged(const double &x) +{ + editSettings->setGrandCompH(x); +} + +void VisualSettings::grandCompSChanged(const double &x) +{ + editSettings->setGrandCompS(x); +} + +void VisualSettings::grandCompLChanged(const double &x) +{ + editSettings->setGrandCompL(x); +} + +void VisualSettings::grandRateHChanged(const double &x) +{ + editSettings->setGrandRateH(x); +} + +void VisualSettings::grandRateSChanged(const double &x) +{ + editSettings->setGrandRateS(x); +} + +void VisualSettings::grandRateLChanged(const double &x) +{ + editSettings->setGrandRateL(x); +} + VisualSettings::~VisualSettings() { delete ui; diff --git a/visualsettings.h b/visualsettings.h index 6b1885cf..f5d13c29 100644 --- a/visualsettings.h +++ b/visualsettings.h @@ -54,6 +54,13 @@ class VisualSettings : public QWidget void colorCeHChanged(const int &); void colorCeSChanged(const double &); void colorCeLChanged(const double &); + void grandCompHChanged(const double &); + void grandCompSChanged(const double &); + void grandCompLChanged(const double &); + void grandRateHChanged(const double &); + void grandRateSChanged(const double &); + void grandRateLChanged(const double &); + void resetToDefault(); };