Skip to content

Commit

Permalink
现在可以调整启动横幅的持续时间了
Browse files Browse the repository at this point in the history
  • Loading branch information
iotang committed Mar 3, 2020
1 parent 8a9dc11 commit 0c3e750
Show file tree
Hide file tree
Showing 11 changed files with 365 additions and 287 deletions.
295 changes: 164 additions & 131 deletions forms/visualsettings.ui

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions lemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@ void Lemon::closeEvent(QCloseEvent */*event*/)
settings.setValue("WindowSize", size());
}

int Lemon::getSplashTime()
{
return settings->getSplashTime();
}

void Lemon::welcome()
{
if (settings->getCompilerList().size() == 0)
Expand Down
1 change: 1 addition & 0 deletions lemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class Lemon : public QMainWindow
~Lemon();
void changeEvent(QEvent *);
void closeEvent(QCloseEvent *);
int getSplashTime();
void welcome();

private:
Expand Down
Binary file modified lemon_zh_CN.qm
Binary file not shown.
243 changes: 124 additions & 119 deletions lemon_zh_CN.ts

Large diffs are not rendered by default.

17 changes: 11 additions & 6 deletions main.cpp
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,25 @@ int main(int argc, char *argv[])

QPixmap pixmap(":/logo/splash.png");
QSplashScreen screen(pixmap);
screen.show();

Lemon w;

qint64 startTime = QDateTime::currentMSecsSinceEpoch();
int splashTime = w.getSplashTime();

do
if (splashTime > 0)
{
a.processEvents();
} while (QDateTime::currentMSecsSinceEpoch() - startTime <= 500);
screen.show();
do
{
a.processEvents();
} while (QDateTime::currentMSecsSinceEpoch() - startTime <= splashTime);
screen.finish(&w);
}

Lemon w;
a.setActivationWindow(&w);

w.show();
screen.finish(&w);
w.welcome();

return a.exec();
Expand Down
2 changes: 1 addition & 1 deletion resultviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ void ResultViewer::refreshViewer()
// bg = QColor::fromHslF(cmeBaseColorHF, cmeBaseColorSF, cmeBaseColorLF);
}
else bg = setting.getColorPer(score, fullScore[j]);
//bg = QColor::fromHslF(oriBaseColorHF, oriBaseColorSF, oriBaseColorLF(score, fullScore[j], 0.3));
//bg = QColor::fromHslF(oriBaseColorHF, oriBaseColorSF, oriBaseColorLF(score, fullScore[j], 0.3));

item(i, j + 3)->setBackground(bg);
}
Expand Down
13 changes: 13 additions & 0 deletions settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ double Settings::getGrandRateL()
return grandRateL;
}

int Settings::getSplashTime()
{
return splashTime;
}

QColor Settings::getColorMx()
{
return QColor::fromHslF(colorMxH / 360.00, colorMxS / 100.00, colorMxL / 100.00);
Expand Down Expand Up @@ -481,6 +486,11 @@ void Settings::setGrandRateL(double x)
grandRateL = x;
}

void Settings::setSplashTime(int x)
{
splashTime = x;
}

void Settings::copyFrom(Settings *other)
{
setDefaultFullScore(other->getDefaultFullScore());
Expand Down Expand Up @@ -512,6 +522,7 @@ void Settings::copyFrom(Settings *other)
setGrandRateH(other->getGrandRateH());
setGrandRateS(other->getGrandRateS());
setGrandRateL(other->getGrandRateL());
setSplashTime(other->getSplashTime());

for (int i = 0; i < compilerList.size(); i ++)
{
Expand Down Expand Up @@ -568,6 +579,7 @@ void Settings::saveSettings()
settings.setValue("GrandRateH", grandRateH);
settings.setValue("GrandRateS", grandRateS);
settings.setValue("GrandRateL", grandRateL);
settings.setValue("SplashTime", splashTime);
settings.endGroup();

settings.beginWriteArray("v1.2/CompilerSettings");
Expand Down Expand Up @@ -659,6 +671,7 @@ void Settings::loadSettings()
grandRateH = settings.value("GrandRateH", 1).toDouble();
grandRateS = settings.value("GrandRateS", 1).toDouble();
grandRateL = settings.value("GrandRateL", 1.33).toDouble();
splashTime = settings.value("SplashTime", 500).toInt();
settings.endGroup();

int compilerCount = settings.beginReadArray("v1.2/CompilerSettings");
Expand Down
4 changes: 4 additions & 0 deletions settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class Settings : public QObject
double getGrandRateH();
double getGrandRateS();
double getGrandRateL();
int getSplashTime();

QColor getColorMx();
QColor getColorMi();
Expand Down Expand Up @@ -110,6 +111,7 @@ class Settings : public QObject
void setGrandRateH(double);
void setGrandRateS(double);
void setGrandRateL(double);
void setSplashTime(int);

void addCompiler(Compiler *);
void deleteCompiler(int);
Expand Down Expand Up @@ -166,6 +168,8 @@ class Settings : public QObject
double grandRateH;
double grandRateS;
double grandRateL;

int splashTime;
};

#endif // SETTINGS_H
15 changes: 13 additions & 2 deletions visualsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
#include "settings.h"

VisualSettings::VisualSettings(QWidget *parent) :
QWidget(parent),
ui(new Ui::VisualSettings)
QWidget(parent),
ui(new Ui::VisualSettings)
{
ui->setupUi(this);

Expand Down Expand Up @@ -64,6 +64,9 @@ VisualSettings::VisualSettings(QWidget *parent) :
connect(ui->grandRateL, SIGNAL(valueChanged(double)),
this, SLOT(grandRateLChanged(double)));

connect(ui->splashTime, SIGNAL(valueChanged(int)),
this, SLOT(splashTimeChanged(int)));

connect(ui->resetToDefaultButton, SIGNAL(clicked()),
this, SLOT(resetToDefault()));
}
Expand All @@ -88,6 +91,7 @@ void VisualSettings::resetToDefault()
ui->grandRateH->setValue(1);
ui->grandRateS->setValue(1);
ui->grandRateL->setValue(1.33);
ui->splashTime->setValue(500);
editSettings->setColorMxH(ui->spinBoxMxH->value());
editSettings->setColorMxS(ui->doubleSpinBoxMxS->value());
editSettings->setColorMxL(ui->doubleSpinBoxMxL->value());
Expand All @@ -106,6 +110,7 @@ void VisualSettings::resetToDefault()
editSettings->setGrandRateH(ui->grandRateH->value());
editSettings->setGrandRateS(ui->grandRateS->value());
editSettings->setGrandRateL(ui->grandRateL->value());
editSettings->setSplashTime(ui->splashTime->value());
}

void VisualSettings::resetEditSettings(Settings *settings)
Expand All @@ -130,6 +135,7 @@ void VisualSettings::resetEditSettings(Settings *settings)
ui->grandRateH->setValue(editSettings->getGrandRateH());
ui->grandRateS->setValue(editSettings->getGrandRateS());
ui->grandRateL->setValue(editSettings->getGrandRateL());
ui->splashTime->setValue(editSettings->getSplashTime());
}

void VisualSettings::colorMxHChanged(const int &x)
Expand Down Expand Up @@ -222,6 +228,11 @@ void VisualSettings::grandRateLChanged(const double &x)
editSettings->setGrandRateL(x);
}

void VisualSettings::splashTimeChanged(const int &x)
{
editSettings->setSplashTime(x);
}

VisualSettings::~VisualSettings()
{
delete ui;
Expand Down
57 changes: 29 additions & 28 deletions visualsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,38 +30,39 @@ class Settings;

class VisualSettings : public QWidget
{
Q_OBJECT
Q_OBJECT

public:
explicit VisualSettings(QWidget *parent = nullptr);
void resetEditSettings(Settings *);
~VisualSettings();
public:
explicit VisualSettings(QWidget *parent = nullptr);
void resetEditSettings(Settings *);
~VisualSettings();

private:
Ui::VisualSettings *ui;
Settings *editSettings;
private:
Ui::VisualSettings *ui;
Settings *editSettings;

private slots:
void colorMxHChanged(const int &);
void colorMxSChanged(const double &);
void colorMxLChanged(const double &);
void colorMiHChanged(const int &);
void colorMiSChanged(const double &);
void colorMiLChanged(const double &);
void colorNfHChanged(const int &);
void colorNfSChanged(const double &);
void colorNfLChanged(const double &);
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 &);
private slots:
void colorMxHChanged(const int &);
void colorMxSChanged(const double &);
void colorMxLChanged(const double &);
void colorMiHChanged(const int &);
void colorMiSChanged(const double &);
void colorMiLChanged(const double &);
void colorNfHChanged(const int &);
void colorNfSChanged(const double &);
void colorNfLChanged(const double &);
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 splashTimeChanged(const int &);

void resetToDefault();
void resetToDefault();
};

#endif // VISUALSETTINGS_H

0 comments on commit 0c3e750

Please sign in to comment.