diff --git a/addcompilerwizard.cpp b/addcompilerwizard.cpp index 3984ddc0..056635d0 100644 --- a/addcompilerwizard.cpp +++ b/addcompilerwizard.cpp @@ -35,11 +35,9 @@ AddCompilerWizard::AddCompilerWizard(QWidget *parent) : ui(new Ui::AddCompilerWizard) { ui->setupUi(this); - ui->sourceFileExtensions->setValidator(new QRegExpValidator(QRegExp("(\\w+;)*\\w+"), this)); ui->bytecodeFileExtensions->setValidator(new QRegExpValidator(QRegExp("(\\w+;)*\\w+"), this)); ui->javaMemoryLimit->setValidator(new QIntValidator(64, 2048, this)); - #ifdef Q_OS_LINUX if (QFileInfo::exists("/usr/bin/gcc")) @@ -61,7 +59,6 @@ AddCompilerWizard::AddCompilerWizard(QWidget *parent) : ui->pythonPath->setText("/usr/bin/python"); #endif - connect(ui->typeSelect, SIGNAL(currentIndexChanged(int)), this, SLOT(compilerTypeChanged())); connect(ui->compilerSelectButton, SIGNAL(clicked()), @@ -89,12 +86,12 @@ AddCompilerWizard::~AddCompilerWizard() delete ui; } -const QList &AddCompilerWizard::getCompilerList() const +auto AddCompilerWizard::getCompilerList() const -> const QList & { return compilerList; } -int AddCompilerWizard::nextId() const +auto AddCompilerWizard::nextId() const -> int { if (currentId() == 0) { @@ -102,19 +99,16 @@ int AddCompilerWizard::nextId() const { return 1; } - else - { - return 2; - } - } - else - { - if (currentId() == 3) return -1; - else return 3; + + return 2; } + + if (currentId() == 3) return -1; + + return 3; } -bool AddCompilerWizard::validateCurrentPage() +auto AddCompilerWizard::validateCurrentPage() -> bool { if (currentId() == 1) { @@ -534,12 +528,10 @@ void AddCompilerWizard::accept() compiler->setCompilerName("gcc"); compiler->setCompilerLocation(ui->gccPath->text()); compiler->setSourceExtensions("c"); - QString stackArg = ""; #ifdef Q_OS_WIN32 stackArg = " -Wl,--stack=2147483647"; #endif - compiler->addConfiguration("default", "-o %s %s.* -lm" + stackArg, ""); if (ui->gccRecommendedCheck->isChecked()) @@ -577,12 +569,10 @@ void AddCompilerWizard::accept() compiler->setCompilerName("g++"); compiler->setCompilerLocation(ui->gppPath->text()); compiler->setSourceExtensions("cpp;cc;cxx"); - QString stackArg = ""; #ifdef Q_OS_WIN32 stackArg = " -Wl,--stack=2147483647"; #endif - compiler->addConfiguration("default", "-o %s %s.* -lm" + stackArg, ""); if (ui->gppRecommendedCheck->isChecked()) @@ -623,7 +613,6 @@ void AddCompilerWizard::accept() compiler->setCompilerName("fpc"); compiler->setCompilerLocation(ui->fpcPath->text()); compiler->setSourceExtensions("pas;pp;inc"); - compiler->addConfiguration("default", "%s.*", ""); if (ui->fpcRecommendedCheck->isChecked()) diff --git a/addtaskdialog.cpp b/addtaskdialog.cpp index f5d99e4b..99d563da 100644 --- a/addtaskdialog.cpp +++ b/addtaskdialog.cpp @@ -33,11 +33,9 @@ AddTaskDialog::AddTaskDialog(QWidget *parent) : ui(new Ui::AddTaskDialog) { ui->setupUi(this); - ui->fullScore->setValidator(new QIntValidator(1, Settings::upperBoundForFullScore() * 100, this)); ui->timeLimit->setValidator(new QIntValidator(1, Settings::upperBoundForTimeLimit(), this)); ui->memoryLimit->setValidator(new QIntValidator(1, Settings::upperBoundForMemoryLimit(), this)); - connect(ui->taskBox, SIGNAL(currentIndexChanged(int)), this, SLOT(taskBoxIndexChanged())); connect(ui->fullScore, SIGNAL(textChanged(QString)), @@ -69,9 +67,7 @@ auto AddTaskDialog::getFullScore(int index) const -> int return fullScore[index]; } - return 0; - } auto AddTaskDialog::getTimeLimit(int index) const -> int @@ -81,9 +77,7 @@ auto AddTaskDialog::getTimeLimit(int index) const -> int return timeLimit[index]; } - return 0; - } auto AddTaskDialog::getMemoryLimit(int index) const -> int @@ -93,9 +87,7 @@ auto AddTaskDialog::getMemoryLimit(int index) const -> int return memoryLimit[index]; } - return 0; - } void AddTaskDialog::taskBoxIndexChanged() diff --git a/addtestcaseswizard.cpp b/addtestcaseswizard.cpp index d199bfca..40869537 100644 --- a/addtestcaseswizard.cpp +++ b/addtestcaseswizard.cpp @@ -31,18 +31,15 @@ AddTestCasesWizard::AddTestCasesWizard(QWidget *parent) : ui(new Ui::AddTestCasesWizard) { ui->setupUi(this); - ui->fullScore->setValidator(new QIntValidator(1, Settings::upperBoundForFullScore(), this)); ui->timeLimit->setValidator(new QIntValidator(1, Settings::upperBoundForTimeLimit(), this)); ui->memoryLimit->setValidator(new QIntValidator(1, Settings::upperBoundForMemoryLimit(), this)); - connect(ui->fullScore, SIGNAL(textChanged(QString)), this, SLOT(fullScoreChanged(QString))); connect(ui->timeLimit, SIGNAL(textChanged(QString)), this, SLOT(timeLimitChanged(QString))); connect(ui->memoryLimit, SIGNAL(textChanged(QString)), this, SLOT(memoryLimitChanged(QString))); - QHeaderView *header = ui->argumentList->horizontalHeader(); for (int i = 0; i < 3; i ++) @@ -269,7 +266,6 @@ void AddTestCasesWizard::searchMatchedFiles() QStringList outputFiles; getFiles(Settings::dataPath(), "", inputFiles); getFiles(Settings::dataPath(), "", outputFiles); - QString regExp = getFullRegExp(inputFilesPattern); for (int i = 0; i < inputFiles.size(); i ++) @@ -294,7 +290,6 @@ void AddTestCasesWizard::searchMatchedFiles() std::sort(inputFiles.begin(), inputFiles.end(), compareFileName); std::sort(outputFiles.begin(), outputFiles.end(), compareFileName); - QList inputFilesMatchedPart; QList outputFilesMatchedPart; @@ -334,7 +329,6 @@ void AddTestCasesWizard::searchMatchedFiles() matchedPart.append(inputFilesMatchedPart[i]); } }*/ - loc.clear(); for (int i = 0; i < singleCases.size(); i ++) @@ -355,7 +349,6 @@ void AddTestCasesWizard::searchMatchedFiles() matchedInputFiles.clear(); matchedOutputFiles.clear(); ui->testCasesViewer->clear(); - QList keys = loc.uniqueKeys(); std::sort(keys.begin(), keys.end(), compareFileName); diff --git a/advancedcompilersettingsdialog.cpp b/advancedcompilersettingsdialog.cpp index fde7f648..71ce8667 100644 --- a/advancedcompilersettingsdialog.cpp +++ b/advancedcompilersettingsdialog.cpp @@ -36,11 +36,9 @@ AdvancedCompilerSettingsDialog::AdvancedCompilerSettingsDialog(QWidget *parent) ui(new Ui::AdvancedCompilerSettingsDialog) { ui->setupUi(this); - editCompiler = new Compiler(this); ui->bytecodeExtension->setValidator(new QRegExpValidator(QRegExp("(\\w+;)*\\w+"), this)); ui->configurationSelect->setLineEdit(new QLineEdit(this)); - connect(ui->buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(okayButtonClicked())); connect(ui->typeSelect, SIGNAL(currentIndexChanged(int)), diff --git a/assignmentthread.cpp b/assignmentthread.cpp index 920a0b06..a96d7691 100644 --- a/assignmentthread.cpp +++ b/assignmentthread.cpp @@ -113,7 +113,6 @@ auto AssignmentThread::traditionalTaskPrepare() -> bool compileState = NoValidSourceFile; QDir contestantDir; contestantDir = ! task->getSubFolderCheck() ? QDir(Settings::sourcePath() + contestantName) : QDir(Settings::sourcePath() + contestantName + QDir::separator() + task->getSourceFileName()); - QList compilerList = settings->getCompilerList(); for (auto &i : compilerList) @@ -252,7 +251,6 @@ auto AssignmentThread::traditionalTaskPrepare() -> bool if (i->getCompilerType() != Compiler::InterpretiveWithoutByteCode) { makeDialogAlert(tr("Compiling...")); - QString arguments = compilerArguments[j]; if (task->getTaskType() == Task::Interaction) @@ -399,11 +397,8 @@ void AssignmentThread::run() } } - skipEnabled = 0; - assign(); - exec(); } @@ -417,7 +412,6 @@ void AssignmentThread::assign() } TestCase *curTestCase = task->getTestCase(curTestCaseIndex); - bool beingSkipped = false; if (curSingleCaseIndex == curTestCase->getInputFiles().size()) @@ -512,10 +506,8 @@ void AssignmentThread::assign() } thread->setTask(task); - connect(thread, SIGNAL(finished()), this, SLOT(threadFinished())); connect(this, SIGNAL(stopJudgingSignal()), thread, SLOT(stopJudgingSlot())); - thread->setInputFile(Settings::dataPath() + curTestCase->getInputFiles().at(curSingleCaseIndex)); thread->setOutputFile(Settings::dataPath() + curTestCase->getOutputFiles().at(curSingleCaseIndex)); thread->setFullScore(curTestCase->getFullScore()); @@ -585,7 +577,6 @@ void AssignmentThread::threadFinished() running.remove(thread); countFinished ++; delete thread; - int nowScore = score[cur.first][cur.second]; if (cur.second + 1 == task->getTestCase(cur.first)->getInputFiles().size()) diff --git a/compilersettings.cpp b/compilersettings.cpp index e541fbdb..2306159b 100644 --- a/compilersettings.cpp +++ b/compilersettings.cpp @@ -34,14 +34,12 @@ CompilerSettings::CompilerSettings(QWidget *parent) : ui(new Ui::CompilerSettings) { ui->setupUi(this); - ui->sourceExtensions->setValidator(new QRegExpValidator(QRegExp("(\\w+;)*\\w+"), this)); deleteCompilerKeyAction = new QAction(ui->compilerList); deleteCompilerKeyAction->setShortcutContext(Qt::WidgetShortcut); deleteCompilerKeyAction->setShortcut(QKeySequence::Delete); deleteCompilerKeyAction->setEnabled(false); ui->compilerList->addAction(deleteCompilerKeyAction); - connect(ui->moveUpButton, SIGNAL(clicked()), this, SLOT(moveUpCompiler())); connect(ui->moveDownButton, SIGNAL(clicked()), @@ -70,7 +68,6 @@ CompilerSettings::~CompilerSettings() void CompilerSettings::resetEditSettings(Settings *settings) { editSettings = settings; - const QList &compilerList = editSettings->getCompilerList(); ui->compilerList->clear(); diff --git a/contest.cpp b/contest.cpp index 3b44bfd2..a60c7afe 100644 --- a/contest.cpp +++ b/contest.cpp @@ -67,9 +67,7 @@ auto Contest::getTask(int index) const -> Task * return taskList[index]; } - return nullptr; - } auto Contest::getTaskList() const -> const QList & @@ -98,9 +96,7 @@ auto Contest::getContestant(const QString &name) const -> Contestant * return contestantList.value(name); } - return nullptr; - } auto Contest::getContestantList() const -> QList @@ -237,7 +233,6 @@ void Contest::judge(Contestant *contestant) for (int i = 0; i < taskList.size(); i ++) { emit taskJudgingStarted(taskList[i]->getProblemTile()); - auto *thread = new AssignmentThread(); connect(thread, SIGNAL(dialogAlert(QString)), this, SIGNAL(dialogAlert(QString))); @@ -275,18 +270,15 @@ void Contest::judge(Contestant *contestant) contestant->setScore(i, thread->getScore()); contestant->setTimeUsed(i, thread->getTimeUsed()); contestant->setMemoryUsed(i, thread->getMemoryUsed()); - contestant->setCheckJudged(i, true); emit taskJudgedDisplay(taskList[i]->getProblemTile(), thread->getScore(), taskList[i]->getTotalScore()); emit taskJudgingFinished(); - delete thread; clearPath(Settings::temporaryPath()); } contestant->setJudgingTime(QDateTime::currentDateTime()); QDir().rmdir(Settings::temporaryPath()); - emit contestantJudgedDisplay(contestant->getContestantName(), contestant->getTotalScore(), getTotalScore()); emit contestantJudgingFinished(); } @@ -301,7 +293,6 @@ void Contest::judge(Contestant *contestant, const QSet &index) if (!index.contains(i)) continue; emit taskJudgingStarted(taskList[i]->getProblemTile()); - auto *thread = new AssignmentThread(); connect(thread, SIGNAL(dialogAlert(QString)), this, SIGNAL(dialogAlert(QString))); @@ -339,18 +330,15 @@ void Contest::judge(Contestant *contestant, const QSet &index) contestant->setScore(i, thread->getScore()); contestant->setTimeUsed(i, thread->getTimeUsed()); contestant->setMemoryUsed(i, thread->getMemoryUsed()); - contestant->setCheckJudged(i, true); emit taskJudgedDisplay(taskList[i]->getProblemTile(), thread->getScore(), taskList[i]->getTotalScore()); emit taskJudgingFinished(); - delete thread; clearPath(Settings::temporaryPath()); } contestant->setJudgingTime(QDateTime::currentDateTime()); QDir().rmdir(Settings::temporaryPath()); - emit contestantJudgedDisplay(contestant->getContestantName(), contestant->getTotalScore(), getTotalScore()); emit contestantJudgingFinished(); } @@ -359,9 +347,7 @@ void Contest::judge(Contestant *contestant, int index) { emit contestantJudgingStart(contestant->getContestantName()); QDir(QDir::current()).mkdir(Settings::temporaryPath()); - emit taskJudgingStarted(taskList[index]->getProblemTile()); - auto *thread = new AssignmentThread(); connect(thread, SIGNAL(dialogAlert(QString)), this, SIGNAL(dialogAlert(QString))); @@ -399,17 +385,13 @@ void Contest::judge(Contestant *contestant, int index) contestant->setScore(index, thread->getScore()); contestant->setTimeUsed(index, thread->getTimeUsed()); contestant->setMemoryUsed(index, thread->getMemoryUsed()); - contestant->setCheckJudged(index, true); emit taskJudgedDisplay(taskList[index]->getProblemTile(), thread->getScore(), taskList[index]->getTotalScore()); emit taskJudgingFinished(); - delete thread; clearPath(Settings::temporaryPath()); - contestant->setJudgingTime(QDateTime::currentDateTime()); QDir().rmdir(Settings::temporaryPath()); - emit contestantJudgedDisplay(contestant->getContestantName(), contestant->getTotalScore(), getTotalScore()); emit contestantJudgingFinished(); } diff --git a/detaildialog.cpp b/detaildialog.cpp index a9c1b537..c938790f 100644 --- a/detaildialog.cpp +++ b/detaildialog.cpp @@ -54,15 +54,12 @@ void DetailDialog::refreshViewer(Contest *_contest, Contestant *_contestant) { contest = _contest; contestant = _contestant; - setWindowTitle(tr("Contestant: %1").arg(contestant->getContestantName())); ui->detailViewer->clear(); QString htmlCode; - htmlCode += ""; htmlCode += ""; htmlCode += ""; - QList taskList = contest->getTaskList(); for (int i = 0; i < taskList.size(); i++) @@ -132,7 +129,6 @@ void DetailDialog::refreshViewer(Contest *_contest, Contestant *_contestant) htmlCode += QString(R"(%1)").arg(tr("Time Used")); htmlCode += QString(R"(%1)").arg(tr("Memory Used")); htmlCode += QString(R"(%1)").arg(tr("Score")); - QList testCases = taskList[i]->getTestCaseList(); QList inputFiles = contestant->getInputFiles(i); QList< QList> result = contestant->getResult(i); @@ -158,13 +154,10 @@ void DetailDialog::refreshViewer(Contest *_contest, Contestant *_contestant) } htmlCode += QString(R"(%1)").arg(inputFiles[j][k]); - QString text; QString bgColor = "rgb(255, 255, 255)"; QString frColor = "rgb(0, 0, 0)"; - Settings::setTextAndColor(result[j][k], text, frColor, bgColor); - htmlCode += QString(R"(%1)").arg(text).arg(bgColor).arg(frColor); if (! message[j][k].isEmpty()) @@ -173,7 +166,6 @@ void DetailDialog::refreshViewer(Contest *_contest, Contestant *_contestant) } htmlCode += ""; - htmlCode += R"()"; if (timeUsed[j][k] != -1) @@ -186,7 +178,6 @@ void DetailDialog::refreshViewer(Contest *_contest, Contestant *_contestant) } htmlCode += ""; - htmlCode += R"()"; if (memoryUsed[j][k] != -1) diff --git a/editvariabledialog.cpp b/editvariabledialog.cpp index 47402143..7af2b6dc 100644 --- a/editvariabledialog.cpp +++ b/editvariabledialog.cpp @@ -30,7 +30,6 @@ EditVariableDialog::EditVariableDialog(QWidget *parent) : { ui->setupUi(this); ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); - connect(ui->variableName, SIGNAL(textChanged(QString)), this, SLOT(textChanged())); connect(ui->variableValue, SIGNAL(textChanged(QString)), diff --git a/environmentvariablesdialog.cpp b/environmentvariablesdialog.cpp index 0e9020a6..71978db3 100644 --- a/environmentvariablesdialog.cpp +++ b/environmentvariablesdialog.cpp @@ -30,7 +30,6 @@ EnvironmentVariablesDialog::EnvironmentVariablesDialog(QWidget *parent) : ui(new Ui::EnvironmentVariablesDialog) { ui->setupUi(this); - connect(ui->addButton, SIGNAL(clicked()), this, SLOT(addButtonClicked())); connect(ui->editButton, SIGNAL(clicked()), diff --git a/exportutil.cpp b/exportutil.cpp index 20e7726b..ab1d8aa4 100644 --- a/exportutil.cpp +++ b/exportutil.cpp @@ -45,7 +45,6 @@ ExportUtil::ExportUtil(QObject *parent) : auto ExportUtil::getContestantHtmlCode(Contest *contest, Contestant *contestant, int num) -> QString { QString htmlCode; - QList taskList = contest->getTaskList(); for (int i = 0; i < taskList.size(); i ++) @@ -120,7 +119,6 @@ auto ExportUtil::getContestantHtmlCode(Contest *contest, Contestant *contestant, htmlCode += QString(R"(%1)").arg(tr("Time Used")); htmlCode += QString(R"(%1)").arg(tr("Memory Used")); htmlCode += QString(R"(%1)").arg(tr("Score")); - QList testCases = taskList[i]->getTestCaseList(); QList inputFiles = contestant->getInputFiles(i); QList< QList> result = contestant->getResult(i); @@ -146,13 +144,10 @@ auto ExportUtil::getContestantHtmlCode(Contest *contest, Contestant *contestant, } htmlCode += QString("%1").arg(inputFiles[j][k]); - QString text; QString bgColor = "rgb(255, 255, 255)"; QString frColor = "rgb(0, 0, 0)"; - Settings::setTextAndColor(result[j][k], text, frColor, bgColor); - htmlCode += QString("%1").arg(text).arg(bgColor).arg(frColor); if (! message[j][k].isEmpty()) @@ -165,7 +160,6 @@ auto ExportUtil::getContestantHtmlCode(Contest *contest, Contestant *contestant, } htmlCode += ""; - htmlCode += ""; if (timeUsed[j][k] != -1) @@ -178,7 +172,6 @@ auto ExportUtil::getContestantHtmlCode(Contest *contest, Contestant *contestant, } htmlCode += ""; - htmlCode += ""; if (memoryUsed[j][k] != -1) @@ -242,17 +235,14 @@ void ExportUtil::exportHtml(QWidget *widget, Contest *contest, const QString &fi QApplication::setOverrideCursor(Qt::WaitCursor); QTextStream out(&file); - QList contestantList = contest->getContestantList(); QList taskList = contest->getTaskList(); - out.setCodec("UTF-8"); out << ""; out << R"()"; out << ""; out << "" << tr("Contest Result") << ""; out << ""; - QList< QPair> sortList; for (auto &i : contestantList) @@ -297,14 +287,12 @@ void ExportUtil::exportHtml(QWidget *widget, Contest *contest, const QString &fi out << R"(

)"; out << QString(R"()").arg(tr("Rank")); out << QString(R"()").arg(tr("Name")); - out << QString(R"()").arg(tr("Total Score")); for (auto &i : taskList) out << QString(R"()").arg(i->getProblemTile()); out << ""; - QList fullScore; int sfullScore = contest->getTotalScore(); @@ -320,7 +308,6 @@ void ExportUtil::exportHtml(QWidget *widget, Contest *contest, const QString &fi .arg(rankList[contestant->getContestantName()] + 1); out << QString(R"()") .arg(loc[contestant]).arg(i.second); - int allScore = contestant->getTotalScore(); if (allScore >= 0) @@ -381,7 +368,6 @@ void ExportUtil::exportHtml(QWidget *widget, Contest *contest, const QString &fi } out << ""; - QApplication::restoreOverrideCursor(); QMessageBox::information(widget, tr("LemonLime"), tr("Export is done"), QMessageBox::Ok); } @@ -389,7 +375,6 @@ void ExportUtil::exportHtml(QWidget *widget, Contest *contest, const QString &fi auto ExportUtil::getSmallerContestantHtmlCode(Contest *contest, Contestant *contestant) -> QString { QString htmlCode; - QList taskList = contest->getTaskList(); for (int i = 0; i < taskList.size(); i ++) @@ -464,7 +449,6 @@ auto ExportUtil::getSmallerContestantHtmlCode(Contest *contest, Contestant *cont htmlCode += QString("").arg(tr("Time Used")); htmlCode += QString("").arg(tr("Memory Used")); htmlCode += QString("").arg(tr("Score")); - QList testCases = taskList[i]->getTestCaseList(); QList inputFiles = contestant->getInputFiles(i); QList< QList> result = contestant->getResult(i); @@ -490,13 +474,10 @@ auto ExportUtil::getSmallerContestantHtmlCode(Contest *contest, Contestant *cont } htmlCode += QString("").arg(inputFiles[j][k]); - QString text; QString bgColor; QString frColor; - Settings::setTextAndColor(result[j][k], text, frColor, bgColor); - htmlCode += QString(""; - htmlCode += ""; - htmlCode += "
%1%1%1%1
%2%1%1%1
%1%1").arg(text); if (! message[j][k].isEmpty()) @@ -509,7 +490,6 @@ auto ExportUtil::getSmallerContestantHtmlCode(Contest *contest, Contestant *cont } htmlCode += ""; if (timeUsed[j][k] != -1) @@ -522,7 +502,6 @@ auto ExportUtil::getSmallerContestantHtmlCode(Contest *contest, Contestant *cont } htmlCode += ""; if (memoryUsed[j][k] != -1) @@ -571,17 +550,14 @@ void ExportUtil::exportSmallerHtml(QWidget *widget, Contest *contest, const QStr QApplication::setOverrideCursor(Qt::WaitCursor); QTextStream out(&file); - QList contestantList = contest->getContestantList(); QList taskList = contest->getTaskList(); - out.setCodec("UTF-8"); out << ""; out << R"()"; out << ""; out << "" << tr("Contest Result") << ""; out << ""; - QList< QPair> sortList; for (auto &i : contestantList) @@ -626,14 +602,12 @@ void ExportUtil::exportSmallerHtml(QWidget *widget, Contest *contest, const QStr out << R"(

)"; out << QString("").arg(tr("Rank")); out << QString("").arg(tr("Name")); - out << QString("").arg(tr("Total Score")); for (auto &i : taskList) out << QString("").arg(i->getProblemTile()); out << QString(""); - QList fullScore; for (auto &i : taskList) @@ -649,7 +623,6 @@ void ExportUtil::exportSmallerHtml(QWidget *widget, Contest *contest, const QStr .arg(rankList[contestant->getContestantName()] + 1); out << QString("") .arg(loc[contestant]).arg(i.second); - int allScore = contestant->getTotalScore(); if (allScore != -1) @@ -686,7 +659,6 @@ void ExportUtil::exportSmallerHtml(QWidget *widget, Contest *contest, const QStr } out << ""; - QApplication::restoreOverrideCursor(); QMessageBox::information(widget, tr("LemonLime"), tr("Export is done"), QMessageBox::Ok); } @@ -704,7 +676,6 @@ void ExportUtil::exportCsv(QWidget *widget, Contest *contest, const QString &fil QApplication::setOverrideCursor(Qt::WaitCursor); QTextStream out(&file); - QList contestantList = contest->getContestantList(); QList taskList = contest->getTaskList(); QList< QPair> sortList; @@ -805,7 +776,6 @@ void ExportUtil::exportXls(QWidget *widget, Contest *contest, const QString &fil } QApplication::setOverrideCursor(Qt::WaitCursor); - QList contestantList = contest->getContestantList(); QList taskList = contest->getTaskList(); QList< QPair> sortList; @@ -850,7 +820,6 @@ void ExportUtil::exportXls(QWidget *widget, Contest *contest, const QString &fil QAxObject *workbook = excel->querySubObject("Workbooks")->querySubObject("Add"); QAxObject *sheet = workbook->querySubObject("ActiveSheet"); sheet->setProperty("Name", QDate::currentDate().toString("yyyy-MM-dd")); - sheet->querySubObject("Cells(int, int)", 1, 1)->setProperty("Value", tr("Rank")); sheet->querySubObject("Cells(int, int)", 1, 2)->setProperty("Value", tr("Name")); @@ -898,7 +867,6 @@ void ExportUtil::exportXls(QWidget *widget, Contest *contest, const QString &fil workbook->dynamicCall("SaveAs(const QString&, int)", QDir::toNativeSeparators(fileName), -4143); excel->dynamicCall("Quit()"); delete excel; - QApplication::restoreOverrideCursor(); QMessageBox::information(widget, tr("LemonLime"), tr("Export is done"), QMessageBox::Ok); #endif @@ -922,7 +890,6 @@ void ExportUtil::exportResult(QWidget *widget, Contest *contest) } QString filter = tr("HTML Document (*.html *.htm);;CSV (*.csv)"); - #ifdef Q_OS_WIN32 QAxObject *excel = new QAxObject("Excel.Application", widget); @@ -930,7 +897,6 @@ void ExportUtil::exportResult(QWidget *widget, Contest *contest) delete excel; #endif - QString fileName = QFileDialog::getSaveFileName(widget, tr("Export Result"), QDir::currentPath() + QDir::separator() + "result.html", filter); @@ -939,7 +905,6 @@ void ExportUtil::exportResult(QWidget *widget, Contest *contest) if (QFileInfo(fileName).suffix() == "html") { QMessageBox::StandardButton res = QMessageBox::warning(widget, tr("Export Result"), tr("Use Default Color Theme?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); - exportHtml(widget, contest, fileName, res == QMessageBox::Yes); } diff --git a/filelineedit.cpp b/filelineedit.cpp index a2bf6799..31804cd0 100644 --- a/filelineedit.cpp +++ b/filelineedit.cpp @@ -76,9 +76,7 @@ void FileLineEdit::refreshFileList() { QStringList files; getFiles(Settings::dataPath(), "", files); - delete completer; - completer = new QCompleter(files, this); setCompleter(completer); } diff --git a/forms/lemon.ui b/forms/lemon.ui index ba57a4a3..790eaa96 100755 --- a/forms/lemon.ui +++ b/forms/lemon.ui @@ -410,7 +410,7 @@ 0 0 725 - 35 + 28 @@ -850,6 +850,10 @@ + + + :/icon/acrobat.svg:/icon/acrobat.svg + Manual diff --git a/generalsettings.cpp b/generalsettings.cpp index 0146544f..a596fedb 100644 --- a/generalsettings.cpp +++ b/generalsettings.cpp @@ -30,7 +30,6 @@ GeneralSettings::GeneralSettings(QWidget *parent) : ui(new Ui::GeneralSettings) { ui->setupUi(this); - ui->defaultFullScore->setValidator(new QIntValidator(1, Settings::upperBoundForFullScore(), this)); ui->defaultTimeLimit->setValidator(new QIntValidator(1, Settings::upperBoundForTimeLimit(), this)); ui->defaultMemoryLimit->setValidator(new QIntValidator(1, Settings::upperBoundForMemoryLimit(), this)); @@ -40,7 +39,6 @@ GeneralSettings::GeneralSettings(QWidget *parent) : ui->rejudgeTimes->setValidator(new QIntValidator(0, Settings::upperBoundForRejudgeTimes(), this)); ui->inputFileExtensions->setValidator(new QRegExpValidator(QRegExp("(\\w+;)*\\w+"), this)); ui->outputFileExtensions->setValidator(new QRegExpValidator(QRegExp("(\\w+;)*\\w+"), this)); - connect(ui->defaultFullScore, SIGNAL(textChanged(QString)), this, SLOT(defaultFullScoreChanged(QString))); connect(ui->defaultTimeLimit, SIGNAL(textChanged(QString)), @@ -69,7 +67,6 @@ GeneralSettings::~GeneralSettings() void GeneralSettings::resetEditSettings(Settings *settings) { editSettings = settings; - ui->defaultFullScore->setText(QString("%1").arg(editSettings->getDefaultFullScore())); ui->defaultTimeLimit->setText(QString("%1").arg(editSettings->getDefaultTimeLimit())); ui->defaultMemoryLimit->setText(QString("%1").arg(editSettings->getDefaultMemoryLimit())); diff --git a/judgingdialog.cpp b/judgingdialog.cpp index 87a60fbe..99ad50b6 100644 --- a/judgingdialog.cpp +++ b/judgingdialog.cpp @@ -100,7 +100,6 @@ void JudgingDialog::judge(const QString &name, int index) stopJudging = false; ui->progressBar->setMaximum(curContest->getTask(index)->getTotalTimeLimit()); curContest->judge(name, index); - /* #ifdef Q_OS_LINUX QString text = "notify-send --expire-time=2000 --urgency=normal " + tr("Finished") + " \"" + tr("Judge Finished - LemonLime") + "\""; @@ -113,9 +112,7 @@ void JudgingDialog::judge(const QString &name, int index) void JudgingDialog::judge(const QList>> &lists) { stopJudging = false; - int allTime = 0; - int listsSize = lists.size(); for (int i = 0; i < listsSize; i++) @@ -160,7 +157,6 @@ void JudgingDialog::judgeAll() void JudgingDialog::singleCaseFinished(int progress, int x, int y, int result, int scoreGot, int timeUsed, int memoryUsed) { bool isOnMaxValue = ui->logViewer->verticalScrollBar()->value() == ui->logViewer->verticalScrollBar()->maximum(); - QTextBlockFormat blockFormat; blockFormat.setLeftMargin(30); cursor->insertBlock(blockFormat); @@ -172,7 +168,6 @@ void JudgingDialog::singleCaseFinished(int progress, int x, int y, int result, i addcharFormat.setFontPointSize(7); addcharFormat.setForeground(QBrush(Qt::darkGray)); scorecharFormat.setFontPointSize(8); - QString text; QString addtext = ""; QString scoretext = ""; @@ -284,7 +279,6 @@ void JudgingDialog::singleCaseFinished(int progress, int x, int y, int result, i if (scoretext.length() > 0)cursor->insertText(scoretext, scorecharFormat); ui->progressBar->setValue(ui->progressBar->value() + progress); - QScrollBar *bar = ui->logViewer->verticalScrollBar(); if (isOnMaxValue) bar->setValue(bar->maximum()); @@ -293,7 +287,6 @@ void JudgingDialog::singleCaseFinished(int progress, int x, int y, int result, i void JudgingDialog::dialogAlert(const QString &msg) { bool isOnMaxValue = ui->logViewer->verticalScrollBar()->value() == ui->logViewer->verticalScrollBar()->maximum(); - QTextBlockFormat blockFormat; blockFormat.setLeftMargin(30); cursor->insertBlock(blockFormat); @@ -301,7 +294,6 @@ void JudgingDialog::dialogAlert(const QString &msg) format.setFontPointSize(9); format.setForeground(QBrush(Qt::gray)); cursor->insertText(msg, format); - QScrollBar *bar = ui->logViewer->verticalScrollBar(); if (isOnMaxValue) bar->setValue(bar->maximum()); @@ -310,7 +302,6 @@ void JudgingDialog::dialogAlert(const QString &msg) void JudgingDialog::singleSubtaskDependenceFinished(int x, int y, int status) { bool isOnMaxValue = ui->logViewer->verticalScrollBar()->value() == ui->logViewer->verticalScrollBar()->maximum(); - QTextBlockFormat blockFormat; blockFormat.setLeftMargin(30); cursor->insertBlock(blockFormat); @@ -318,7 +309,6 @@ void JudgingDialog::singleSubtaskDependenceFinished(int x, int y, int status) QTextCharFormat ratioFormat; charFormat.setFontPointSize(9); ratioFormat.setFontPointSize(9); - QString text; if (status >= 2) @@ -343,7 +333,6 @@ void JudgingDialog::singleSubtaskDependenceFinished(int x, int y, int status) cursor->insertText(tr("Subtask Dependence %1.%2: ").arg(x + 1).arg(y + 1), charFormat); cursor->insertText(text, ratioFormat); - QScrollBar *bar = ui->logViewer->verticalScrollBar(); if (isOnMaxValue) bar->setValue(bar->maximum()); @@ -352,7 +341,6 @@ void JudgingDialog::singleSubtaskDependenceFinished(int x, int y, int status) void JudgingDialog::taskJudgingStarted(const QString &taskName) { bool isOnMaxValue = ui->logViewer->verticalScrollBar()->value() == ui->logViewer->verticalScrollBar()->maximum(); - QTextBlockFormat blockFormat; blockFormat.setLeftMargin(15); cursor->insertBlock(blockFormat); @@ -367,7 +355,6 @@ void JudgingDialog::taskJudgingStarted(const QString &taskName) void JudgingDialog::taskJudgedDisplay(const QString &taskName, const QList< QList> &scoreList, const int mxScore) { bool isOnMaxValue = ui->logViewer->verticalScrollBar()->value() == ui->logViewer->verticalScrollBar()->maximum(); - QTextBlockFormat blockFormat; blockFormat.setLeftMargin(15); cursor->insertBlock(blockFormat); @@ -377,7 +364,6 @@ void JudgingDialog::taskJudgedDisplay(const QString &taskName, const QList< QLis scoreFormat.setFontPointSize(10); scoreFormat.setFontWeight(QFont::Bold); scoreFormat.setForeground(QBrush(Qt::darkCyan)); - int allScore = 0; for (const auto &i : scoreList) @@ -404,7 +390,6 @@ void JudgingDialog::taskJudgedDisplay(const QString &taskName, const QList< QLis void JudgingDialog::contestantJudgingStart(const QString &contestantName) { bool isOnMaxValue = ui->logViewer->verticalScrollBar()->value() == ui->logViewer->verticalScrollBar()->maximum(); - QTextCharFormat charFormat; charFormat.setFontPointSize(12); charFormat.setFontWeight(QFont::Bold); @@ -417,7 +402,6 @@ void JudgingDialog::contestantJudgingStart(const QString &contestantName) void JudgingDialog::contestantJudgingFinished() { bool isOnMaxValue = ui->logViewer->verticalScrollBar()->value() == ui->logViewer->verticalScrollBar()->maximum(); - QTextBlockFormat blockFormat; cursor->insertBlock(blockFormat); cursor->insertBlock(blockFormat); @@ -429,7 +413,6 @@ void JudgingDialog::contestantJudgingFinished() void JudgingDialog::contestantJudgedDisplay(const QString &contestantName, const int score, const int mxScore) { bool isOnMaxValue = ui->logViewer->verticalScrollBar()->value() == ui->logViewer->verticalScrollBar()->maximum(); - QTextBlockFormat blockFormat; blockFormat.setLeftMargin(15); cursor->insertBlock(blockFormat); @@ -439,7 +422,6 @@ void JudgingDialog::contestantJudgedDisplay(const QString &contestantName, const scoreFormat.setFontPointSize(12); scoreFormat.setFontWeight(QFont::Bold); scoreFormat.setForeground(QBrush(Qt::darkCyan)); - cursor->insertText(tr("Total score of %1 : ").arg(contestantName), charFormat); cursor->insertText(tr("%1 / %2\n").arg(score).arg(mxScore), scoreFormat); QScrollBar *bar = ui->logViewer->verticalScrollBar(); @@ -451,13 +433,11 @@ void JudgingDialog::contestantJudgedDisplay(const QString &contestantName, const void JudgingDialog::compileError(int progress, int compileState) { bool isOnMaxValue = ui->logViewer->verticalScrollBar()->value() == ui->logViewer->verticalScrollBar()->maximum(); - QTextBlockFormat blockFormat; blockFormat.setLeftMargin(30); cursor->insertBlock(blockFormat); QTextCharFormat charFormat; charFormat.setFontPointSize(9); - QString text; switch (CompileState(compileState)) @@ -494,7 +474,6 @@ void JudgingDialog::compileError(int progress, int compileState) cursor->insertText(text, charFormat); ui->progressBar->setValue(ui->progressBar->value() + progress); - QScrollBar *bar = ui->logViewer->verticalScrollBar(); if (isOnMaxValue) bar->setValue(bar->maximum()); diff --git a/judgingthread.cpp b/judgingthread.cpp index b563484e..3a155527 100644 --- a/judgingthread.cpp +++ b/judgingthread.cpp @@ -80,7 +80,6 @@ JudgingThread::JudgingThread(QObject *parent) : timeUsed = -1; memoryUsed = -1; judgedTimes = 0; - QTime t = QTime::currentTime(); qsrand(static_cast(t.msec() + t.second() * 1000)); } @@ -265,9 +264,7 @@ void JudgingThread::compareLineByLine(const QString &contestantOutput) } str1[len1 ++] = '\0'; - chkEof1 = ch == EOF; - len2 = 0; while (len2 < 10) @@ -298,7 +295,6 @@ void JudgingThread::compareLineByLine(const QString &contestantOutput) } str2[len2 ++] = '\0'; - chkEof2 = ch == EOF; if (chkEof1 && ! chkEof2) @@ -526,7 +522,6 @@ void JudgingThread::compareIgnoreSpaces(const QString &contestantOutput) } str1[len1] = '\0'; - int len2 = 0; while (len2 < 10) @@ -777,7 +772,6 @@ void JudgingThread::specialJudge(const QString &fileName) } delete judge; - QFile scoreFile(workingDirectory + "_score"); if (! scoreFile.open(QFile::ReadOnly)) @@ -839,11 +833,9 @@ void JudgingThread::runProgram() #ifdef Q_OS_WIN32 SetErrorMode(SEM_NOGPFAULTERRORBOX); - STARTUPINFO si; PROCESS_INFORMATION pi; SECURITY_ATTRIBUTES sa; - ZeroMemory(&si, sizeof(si)); si.cb = sizeof(si); si.dwFlags = STARTF_USESTDHANDLES; @@ -868,7 +860,6 @@ void JudgingThread::runProgram() si.hStdError = CreateFile((const WCHAR *)((workingDirectory + "_tmperr").utf16()), GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, &sa, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - QString values = environment.toStringList().join(QChar('\0')) + '\0'; if (! CreateProcess(NULL, (WCHAR *)(QString("\"%1\" %2").arg(executableFile, arguments).utf16()), NULL, &sa, @@ -1010,15 +1001,12 @@ void JudgingThread::runProgram() FILETIME creationTime, exitTime, kernelTime, userTime; GetProcessTimes(pi.hProcess, &creationTime, &exitTime, &kernelTime, &userTime); - SYSTEMTIME realTime; FileTimeToSystemTime(&userTime, &realTime); - timeUsed = realTime.wMilliseconds + realTime.wSecond * 1000 + realTime.wMinute * 60 * 1000 + realTime.wHour * 60 * 60 * 1000; - GetProcessMemoryInfo(pi.hProcess, (PROCESS_MEMORY_COUNTERS *) &info, sizeof(info)); memoryUsed = info.PeakWorkingSetSize; @@ -1030,10 +1018,8 @@ void JudgingThread::runProgram() CloseHandle(pi.hProcess); CloseHandle(pi.hThread); #else - QFile::copy(":/watcher/watcher_unix", workingDirectory + "watcher"); QProcess::execute(QString("chmod +wx \"") + workingDirectory + "watcher" + "\""); - auto *runner = new QProcess(this); QStringList argumentsList; argumentsList << QString("\"%1\" %2").arg(executableFile, arguments); diff --git a/lemon.cpp b/lemon.cpp index ad5b1f78..f670c6fc 100644 --- a/lemon.cpp +++ b/lemon.cpp @@ -58,31 +58,24 @@ Lemon::Lemon(QWidget *parent) : ui(new Ui::Lemon) { ui->setupUi(this); - curContest = nullptr; settings = new Settings(this); - ui->tabWidget->setVisible(false); ui->closeAction->setEnabled(false); ui->saveAction->setEnabled(false); ui->openFolderAction->setEnabled(false); ui->actionChangeContestName->setEnabled(false); - dataDirWatcher = nullptr; settings->loadSettings(); - TaskMenu = new QMenu(); signalMapper = new QSignalMapper(); - ui->summary->setSettings(settings); ui->taskEdit->setSettings(settings); ui->testCaseEdit->setSettings(settings); - connect(this, SIGNAL(dataPathChanged()), ui->taskEdit, SIGNAL(dataPathChanged())); connect(this, SIGNAL(dataPathChanged()), ui->testCaseEdit, SIGNAL(dataPathChanged())); - connect(ui->summary, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(summarySelectionChanged())); connect(ui->optionsAction, SIGNAL(triggered()), @@ -139,20 +132,18 @@ Lemon::Lemon(QWidget *parent) : this, SLOT(exportStatstics())); connect(ui->aboutAction, SIGNAL(triggered()), this, SLOT(aboutLemon())); - connect(ui->actionManual, SIGNAL(triggered()), this, SLOT(actionManual())); connect(ui->actionMore, SIGNAL(triggered()), this, SLOT(actionMore())); - + connect(ui->actionChangeContestName, SIGNAL(triggered()), + this, SLOT(changeContestName())); connect(ui->exitAction, SIGNAL(triggered()), this, SLOT(close())); - appTranslator = new QTranslator(this); qtTranslator = new QTranslator(this); QApplication::installTranslator(appTranslator); QApplication::installTranslator(qtTranslator); - QStringList fileList = QDir(":/translation").entryList(QStringList() << "lemon_*.qm", QDir::Files); for (int i = 0; i < fileList.size(); i ++) @@ -174,7 +165,6 @@ Lemon::Lemon(QWidget *parent) : connect(ui->setEnglishAction, SIGNAL(triggered()), this, SLOT(setUiLanguage())); loadUiLanguage(); - QSettings settings("Crash", "Lemon"); QSize _size = settings.value("WindowSize", size()).toSize(); resize(_size); @@ -292,7 +282,6 @@ void Lemon::insertWatchPath(const QString &curDir, QFileSystemWatcher *watcher) void Lemon::resetDataWatcher() { delete dataDirWatcher; - dataDirWatcher = new QFileSystemWatcher(this); insertWatchPath(Settings::dataPath(), dataDirWatcher); connect(dataDirWatcher, SIGNAL(directoryChanged(QString)), @@ -356,7 +345,6 @@ void Lemon::showOptionsDialog() } ui->resultViewer->refreshViewer(); - delete dialog; } @@ -374,7 +362,6 @@ void Lemon::refreshButtonClicked() { curContest->refreshContestantList(); ui->resultViewer->refreshViewer(); - judgeExtButtonFlip(ui->resultViewer->rowCount() > 0); ui->cleanupAction->setEnabled(true); ui->refreshAction->setEnabled(true); @@ -389,7 +376,6 @@ void removePath(const QString &path) if (!dir.exists())return; dir.setFilter(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::Hidden); - QFileInfoList fileList = dir.entryInfoList(); foreach (QFileInfo fi, fileList) @@ -409,9 +395,7 @@ void copyPath(const QString &fromPath, const QString &toPath) QString fpath = fromPath + QDir::separator(); QString tpath = toPath + QDir::separator(); - dir.setFilter(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::Hidden); - QFileInfoList fileList = dir.entryInfoList(); foreach (QFileInfo fi, fileList) @@ -442,18 +426,14 @@ void Lemon::cleanupButtonClicked() QDir basDir(Settings::sourcePath()); basDir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot); QFileInfoList basDirLis = basDir.entryInfoList(); - int tarcnt = basDirLis.size(); - QString backupFolder = "source_bak_%1"; int backupNum = 0; - QDir tempBackupLoca; while (tempBackupLoca.exists(backupFolder.arg(backupNum)))backupNum++; backupFolder = backupFolder.arg(backupNum); - text = tr("Making backup files to dir
`%1'?").arg(backupFolder) + "
"; QMessageBox::StandardButton doBackup = QMessageBox::information(this, tr("Clean up Files"), text, QMessageBox::Yes | QMessageBox::No | QMessageBox::Abort, QMessageBox::Yes); @@ -480,7 +460,6 @@ void Lemon::cleanupButtonClicked() } bkLoca = QDir(backupFolder); - auto *bkProcess = new QProgressDialog(tr("Making Backup..."), "", 0, 0, this); bkProcess->setWindowModality(Qt::WindowModal); bkProcess->setWindowFlags(windowFlags() | Qt::FramelessWindowHint); @@ -489,7 +468,6 @@ void Lemon::cleanupButtonClicked() bkProcess->setRange(0, tarcnt); bkProcess->setValue(0); QCoreApplication::processEvents(); - basDir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot); basDirLis = basDir.entryInfoList(); @@ -511,23 +489,18 @@ void Lemon::cleanupButtonClicked() process->setCancelButton(nullptr); process->setRange(0, 5); process->setValue(0); - process->setLabelText(tr("Working on it...")); QCoreApplication::processEvents(); - process->setRange(0, tarcnt + 5); process->setValue(0); process->setModal(true); - process->setLabelText(tr("Fetching Data...")); QCoreApplication::processEvents(); - QSet tarNameSet; QSet nameSet; QMap typeSet; QMap origSet; QList taskList = curContest->getTaskList(); - process->setValue(1); process->setLabelText(tr("Initing...")); QCoreApplication::processEvents(); @@ -571,14 +544,12 @@ void Lemon::cleanupButtonClicked() process->setValue(5); process->setLabelText(tr("Now Cleaning...")); QCoreApplication::processEvents(); - basDir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot); basDirLis = basDir.entryInfoList(); foreach (QFileInfo conDirWho, basDirLis) { QDir conDir(conDirWho.filePath()); - conDir.setFilter(QDir::Files | QDir::Hidden); QFileInfoList conDirLis = conDir.entryInfoList(); @@ -596,7 +567,6 @@ void Lemon::cleanupButtonClicked() if (nameSet.contains(proDirWho.fileName())) { QDir proDir(proDirWho.filePath()); - proDir.setFilter(QDir::Files | QDir::Hidden); foreach (QFileInfo sorFilWho, proDir.entryInfoList()) @@ -650,7 +620,6 @@ void Lemon::cleanupButtonClicked() foreach (QFileInfo proDirWho, conDirLis) { QDir proDir(proDirWho.filePath()); - proDir.setFilter(QDir::Files | QDir::Hidden); foreach (QFileInfo sorFilWho, proDir.entryInfoList()) @@ -662,7 +631,6 @@ void Lemon::cleanupButtonClicked() } delete process; - text = tr("Finished.") + "
"; QMessageBox::information(this, tr("Clean up Files"), text); } @@ -704,7 +672,6 @@ void Lemon::tabIndexChanged(int index) } judgeExtButtonFlip(ui->resultViewer->rowCount() > 0); - ui->cleanupAction->setEnabled(true); ui->refreshAction->setEnabled(true); } @@ -721,7 +688,6 @@ void Lemon::moveUpTask() ui->summary->setContest(curContest); ui->statisticsBrowser->refresh(); ui->resultViewer->refreshViewer(); - curItem = ui->summary->topLevelItem(index - 1); if (!curItem)curItem = ui->summary->topLevelItem(index); @@ -740,7 +706,6 @@ void Lemon::moveDownTask() ui->summary->setContest(curContest); ui->resultViewer->refreshViewer(); ui->statisticsBrowser->refresh(); - curItem = ui->summary->topLevelItem(index + 1); if (!curItem)curItem = ui->summary->topLevelItem(index); @@ -784,7 +749,6 @@ void Lemon::saveContest(const QString &fileName) } QApplication::setOverrideCursor(Qt::WaitCursor); - QByteArray data; QDataStream _out(&data, QIODevice::WriteOnly); curContest->writeToStream(_out); @@ -792,7 +756,6 @@ void Lemon::saveContest(const QString &fileName) QDataStream out(&file); out << unsigned(MagicNumber) << qChecksum(data.data(), static_cast(data.length())) << data.length(); out.writeRawData(data.data(), data.length()); - QApplication::restoreOverrideCursor(); ui->statusBar->showMessage(tr("Saved"), 1000); } @@ -839,13 +802,10 @@ void Lemon::loadContest(const QString &filePath) delete[] raw; data = qUncompress(data); QDataStream in (data); - QApplication::setOverrideCursor(Qt::WaitCursor); - curContest = new Contest(this); curContest->setSettings(settings); curContest->readFromStream(in); - curFile = QFileInfo(filePath).fileName(); QDir::setCurrent(QFileInfo(filePath).path()); QDir().mkdir(Settings::dataPath()); @@ -867,7 +827,6 @@ void Lemon::loadContest(const QString &filePath) ui->cleanupAction->setEnabled(false); ui->refreshAction->setEnabled(false); setWindowTitle(tr("LemonLime - %1").arg(curContest->getContestTitle())); - QApplication::restoreOverrideCursor(); ui->tabWidget->setCurrentIndex(0); } @@ -1035,7 +994,6 @@ void Lemon::addTaskWithScoreScale(const QString &title, const QListrefreshCompilerConfiguration(settings); newTask->setAnswerFileExtension(settings->getDefaultOutputFileExtension()); curContest->addTask(newTask); - int scorePer = sumScore / testCases.size(); int scoreLos = sumScore - scorePer * testCases.size(); @@ -1087,7 +1045,6 @@ void Lemon::addTasksAction() QMap inputFiles; getFiles(Settings::dataPath() + list[i], filters, inputFiles); - filters = settings->getOutputFileExtensions(); if (filters.isEmpty()) filters << "out" << "ans"; @@ -1099,7 +1056,6 @@ void Lemon::addTasksAction() QMap outputFiles; getFiles(Settings::dataPath() + list[i], filters, outputFiles); - QList< QPair> cases; QStringList baseNameList = inputFiles.keys(); @@ -1159,6 +1115,29 @@ void Lemon::exportStatstics() StatisticsBrowser::exportStatstics(this, curContest); } +void Lemon::changeContestName() +{ + if (!curContest) + { + QMessageBox::warning(this, tr("Rename Contest"), tr("No Contest Yet")); + } + + bool confirmed = false; + QString newName = QInputDialog::getText(this, tr("Rename Contest"), tr("Write the name you want."), QLineEdit::Normal, tr("New Name"), &confirmed); + + if (!confirmed) + { + QMessageBox::warning(this, tr("Rename Contest"), tr("The name did not changes.")); + return; + } + + curContest->setContestTitle(newName); + setWindowTitle(tr("LemonLime - %1").arg(curContest->getContestTitle())); + ui->resultViewer->refreshViewer(); + ui->statisticsBrowser->refresh(); + saveContest(curFile); +} + void Lemon::aboutLemon() { QString text; @@ -1167,7 +1146,7 @@ void Lemon::aboutLemon() text += tr("Based on Project Lemon version 1.2 Beta by Zhipeng Jia, 2011") + "
"; QDateTime nowTime(QDateTime::currentDateTime()); text += tr("Build Date: %1").arg(nowTime.toString("yyyy-MM-dd hh:mm:ss")) + "
"; - text += tr("UNSTABLE VERISON") + "
"; + text += tr("BETA VERISON") + "
"; text += tr("This program is under the GPLv3 license") + "
"; text += tr("Update by Dust1404 and iotang") + "
"; @@ -1187,7 +1166,7 @@ void Lemon::actionManual() void Lemon::actionMore() { - QDesktopServices::openUrl(QUrl(QString("https://github.com/iotang/Project_LemonLime/wiki"))); + QDesktopServices::openUrl(QUrl(QString("https://github.com/iotang/Project_LemonLime"))); } void Lemon::setUiLanguage() diff --git a/lemon.h b/lemon.h index ee57ef75..e38ae745 100644 --- a/lemon.h +++ b/lemon.h @@ -90,6 +90,7 @@ private slots: void addTasksAction(); void exportResult(); void exportStatstics(); + void changeContestName(); void aboutLemon(); void actionManual(); static void actionMore(); diff --git a/lemon_zh_CN.qm b/lemon_zh_CN.qm index 155d3db1..1112656b 100755 Binary files a/lemon_zh_CN.qm and b/lemon_zh_CN.qm differ diff --git a/lemon_zh_CN.ts b/lemon_zh_CN.ts index fe061088..676e8a2c 100755 --- a/lemon_zh_CN.ts +++ b/lemon_zh_CN.ts @@ -97,9 +97,9 @@ - - - + + + Add recommended configurations 添加建议配置 @@ -124,231 +124,231 @@ 步骤 3/3:检查结果,开始使用 LemonLime。 - - - - - - - - - - - - + + + + + + + + + + + + Error 出错了 - + Empty compiler name! 编译器名称为空! - + Empty compiler location! 编译器位置为空! - + Empty interpreter location! 解释器位置为空! - + Empty source file extensions! 源程序扩展名为空! - + Empty byte-code file extensions! 中间字节码扩展名为空! - + [Custom Compiler] 【自定义编译器】 - + Compiler Name: 编译器名称: - + Compiler Type: 编译器类型: - + Compiler's Location: 编译器位置: - + Interpreter's Location: 解释器位置: - + Source File Extensions: 源程序扩展名: - + Byte-code File Extensions: 中间字节码扩展名: - + Default Compiler's Arguments: 默认编译器参数: - + Default Interpreter's Arguments: 默认解释器参数: - + Empty gcc path! gcc 路径为空! - + Empty g++ path! g++ 路径为空! - + Empty fpc path! fpc 路径为空! - + Empty fbc path! fbc 路径为空! - + Empty javac path! javac 路径为空! - + Empty java path! java 路径为空! - + Empty python path! python 路径为空! - + [gcc Compiler] 【gcc 编译器】 - + gcc Path: gcc 路径: - + [g++ Compiler] 【g++ 编译器】 - + g++ Path: g++ 路径: - + [fpc Compiler] 【fpc 编译器】 - + fpc Path: fpc 路径: - + [fbc Compiler] 【fbc 编译器】 - + fbc Path: fbc 路径: - + [Java Compiler] 【Java 编译器】 - + javac Path: javac 路径: - + java Path: java 路径: - + Memory Limit: %1 MB 内存限制:%1 MB - + [Python Compiler] 【Python 编译器】 - + python Path: python 路径: - - - - - - - - - - - - + + + + + + + + + + + + Select Compiler's Location 选择编译器位置 - - + + Executable files (*.exe) 可执行文件 (*.exe) - - + + Executable files (*.*) 可执行文件 (*.*) - - - - - - + + + + + + Select Interpreter's Location 选择解释器位置 @@ -465,59 +465,59 @@ 正则表达式 - + Test Case #%1 测试点 #%1 + - + - - - - + + + Error 出错了 - + Empty full score! 分值为空! - + Empty time limit! 时间限制为空! - + Empty memory limit! 空间限制为空! - + Empty input files pattern! 输入文件格式为空! - + Empty output files pattern! 输出文件格式为空! - + Argument <%1> appears more than once in input files pattern! 参数<%1>在输入文件格式中出现多次! - + Argument <%1> appears more than once in output files pattern! 参数<%1>在输出文件格式中出现多次! - + Invalid regular expression! 正则表达式语法错误! @@ -615,77 +615,77 @@ 环境变量 - - + + Add new ... 添加... - - - - - - + + + + + + Error 出错了 - + Empty compiler's Location! 编译器位置为空! - + Empty interpreter's Location! 解释器位置为空! - + Empty Byte-code Extensions! 中间字节码扩展名为空! - + Empty configuration name! 配置名称为空! - + Configuration %1 appears more than once! 配置 %1 出现多次! - + Invalid configuration name "disable"! 你不能把配置名取名为“disable”! - - + + Select Compiler's Location 选择编译器位置 - - + + Executable files (*.exe) 可执行文件 (*.exe) - - + + Executable files (*.*) 可执行文件 (*.*) - - + + Select Interpreter's Location 选择解释器位置 - + New configuration %1 新建配置 %1 @@ -698,7 +698,7 @@ 准备中… - + Compiling... 编译中… @@ -727,35 +727,35 @@ 高级选项 - - - + + + Error 出错了 - + Compiler %1 appears more than once! 编译器 %1 出现多次! - + Empty compiler name! 编译器名称为空! - + Empty source file extensions! 源程序扩展名为空! - + LemonLime Lemon LemonLime - + Are you sure to delete compiler %1? 确定删除编译器 %1 吗? @@ -773,98 +773,98 @@ 关闭(&C) - + Contestant: %1 选手:%1 - - + + Task 试题 - - + + Rejudge 重新测试 - + Not judged 未测试 - + Cannot find valid source file 未找到选手程序 - - - + + + Source file: 源程序: - + Compile time limit exceeded 编译超时 - + Cannot run given compiler 给定编译器无法运行 - + Compile error &nbsp;&nbsp;Compile error 编译错误 - + Test Case 测试点 - + Input File 输入文件 - + Result 测试结果 - + Time Used 运行用时 - + Memory Used 内存消耗 - + Score 得分 - + Subtask Dependence Status Subtask Dependence Score 子任务依赖情况 - + Success 通过 - + Failed 失败 @@ -921,18 +921,18 @@ 交互库错误 - - + + Invalid 不可用 - + Compile Message 编译信息 - + Message 信息 @@ -988,23 +988,23 @@ 删除(&D) - + Add New Variable 添加新变量 - + Edit Variable 编辑变量 - + LemonLime Lemon LemonLime - + Are you sure to delete variable %1? 确定删除变量%1? @@ -1012,108 +1012,108 @@ ExportUtil - - + + Task 试题 - - + + Not judged 未测试 - - + + Cannot find valid source file 未找到选手程序 - - - - - - + + + + + + Source file: 源程序: - - + + Compile time limit exceeded 编译超时 - - + + Cannot run given compiler 给定编译器无法运行 - - + + Compile error 编译错误 - - + + Test Case 测试点 - - + + Input File 输入文件 - - + + Result 测试结果 - - + + Time Used 运行用时 - - + + Memory Used 内存消耗 - - + + Score 得分 - - + + Subtask Dependence Status Subtask Dependence Score 子任务依赖情况 - - + + Success 通过 - - + + Failed 失败 - + Use Default Color Theme? 使用默认的颜色主题吗? @@ -1170,93 +1170,93 @@ 交互库错误 - - - - - - - - - - - - + + + + + + + + + + + + Invalid 不可用 - - + + Return to top 返回顶部 - - - - - - - - - - + + + + + + + + + + LemonLime Lemon LemonLime - - - - + + + + Cannot open file %1 无法打开%1 - - + + Contest Result 比赛结果 - - + + Rank List 排名表 - + Click names or task scores to jump to details. Judged By LemonLime 点击名字或单题分数跳转到详细信息。使用 LemonLime 评测 - - - - + + + + Rank 排名 - - - - + + + + Name 名称 - - - - + + + + Total Score 总分 - + HTML Document (*.html *.htm);;CSV (*.csv) HTML文档 (*.html *htm);;逗号分隔符 (*.csv) @@ -1269,31 +1269,31 @@ 项目地址: - - + + Contestant: %1 选手:%1 - - - - + + + + Export is done 导出完成 - + Judged By LemonLime 使用 LemonLime 评测 - + No contestant in current contest 不存在选手 - + No task in current contest 不存在试题 @@ -1302,13 +1302,13 @@ HTML文档 (*.html);;逗号分隔符 (*.csv) - + ;;Excel Workbook (*.xls) ;;Excel工作簿 (*.xls) - - + + Export Result 导出成绩 @@ -1387,43 +1387,43 @@ (用";"分隔,空表示无限制。) - - - - - - - + + + + + + + Error 出错了 - + Empty default full score! 默认分值为空! - + Empty default time limit! 默认时间限制为空! - + Empty default memory limit! 默认空间限制为空! - + Empty compile time limit! 编译时间限制为空! - + Empty special judge time limit! 校验器时间限制为空! - + Empty source file size limit! 源程序大小限制为空! @@ -1432,7 +1432,7 @@ 测试线程数为空! - + Empty maximum rejudge times! 最大重测次数为空! @@ -1466,36 +1466,36 @@ 停止测试 - + Test case %1.%2: 测试点 %1.%2: - + Correct answer 答案正确 - + Wrong answer 答案错误 - + Partly correct 答案部分正确 - - + + %1 ms %1 ms %2 MB %1 ms - - - + + + %1 Pt %1 Pt @@ -1504,53 +1504,53 @@ (%1 Pt) - + Time limit exceeded 超过时间限制 - + Memory limit exceeded 超过空间限制 - + Cannot start program 进程被阻塞 - + File error 文件错误 - + Run time error 运行时错误 - - + + %1 MB %1 MB - + Invalid special judge 校验器没有被正确配置 - + Special judge time limit exceeded 校验器超过时间限制 - + Special judge run time error 校验器运行时错误 - + Skipped 被忽略 @@ -1567,80 +1567,80 @@ +%1 Pt, %2 ms, %3 MB - + Interactor error 交互库错误 - + Pure Pure - + Lost Lost - + Far Far - + Subtask Dependence %1.%2: 检查子任务依赖 %1.%2: - + Start judging task %1 开始测试试题 %1 - + Score of Task %1 : 题目 %1 分数: - - + + %1 / %2 %1 / %2 - + Start judging contestant %1 开始测试选手 %1 - + Total score of %1 : 选手 %1 总分: - + Cannot find valid source file 未找到选手程序 - + Compile error 编译错误 - + Compile time limit exceeded 编译超时 - + Invalid compiler 编译器不可用 - + Compile Successfully 编译完成 @@ -1648,72 +1648,72 @@ JudgingThread - - - + + + Cannot open contestant's output file 无法打开选手输出文件 - - - + + + Cannot open standard output file 无法打开标准输出文件 - - - + + + Read "%1" but expect "%2" Read %1 but expect %2 读取到 "%1" ,但期望 "%2" - + Invalid characters found 包含无效字符 - + Invalid characters in standard output file 标准输出文件中包含无效字符 - - + + Shorter than standard output 比标准输出短(确认你的比较方式) - - + + Longer than standard output 比标准输出长(确认你的比较方式) - + Presentation error 格式错误 - - + + Cannot find standard input file 找不到标准输入文件 - + Cannot find contestant's output file 找不到选手输出文件 - + Cannot find standard output file 找不到标准输出文件 - + Cannot copy standard input file 无法复制标准输入文件 @@ -1738,8 +1738,8 @@ Lemon - - + + LemonLime Lemon LemonLime @@ -2006,13 +2006,13 @@ + + + - - - - - + + Clean up Files &Clean up Files 整理文件 @@ -2250,7 +2250,7 @@ - + Manual 用户手册 @@ -2259,17 +2259,17 @@ 导出统计信息 - + English 简体中文 - + Are you sure to Clean up Files? 确定要整理文件吗? - + Reading guide are recommended. 建议参看教程后再确认操作。 @@ -2278,7 +2278,7 @@ 创建备份文件到 <br> `source.bak'? - + Aborted. 没有进行整理。 @@ -2291,90 +2291,103 @@ 没有进行整理:没法创建 `source.bak'。 - + Making Backup... 备份中… - + Cleaning 整理中 - + Working on it... 正在整理… - + Fetching Data... 抓取题目数据… - + Initing... 预处理中… - + Now Cleaning... 整理文件中… - + Finished. 整理完成。 - + Aborted 没有进行整理 - - - - - + + + + + Error 出错了 - - + + Cannot open file %1 无法打开 %1 - + Save Failed 保存失败 - + Saved 已保存 - - + + File %1 is broken %1 已损坏 - - + + + LemonLime - %1 LemonLime - %1 - + + The name did not changes. + 名字没有改变。 + + + + BETA VERISON + BETA 版本 + + UNSTABLE VERISON - 不稳定版本 + 不稳定版本 + + + Rename Contest - 重命名比赛 + 重命名比赛 Input the name you prefer. @@ -2398,7 +2411,7 @@ 注意 - + Aborted: Cannot make dir `%1'. 没有进行整理:没法创建 `%1'。 @@ -2571,23 +2584,38 @@ LemonLime - %1 - + Cannot make contest path 无法创建比赛目录 - + No task found 找不到任何试题 - + + No Contest Yet + 还没有比赛 + + + + Write the name you want. + 输入你想要的名字。 + + + + New Name + 新名字 + + + A tiny judging environment for OI contest based on Project Lemon A tiny judging environment for OI contest 基于Lemon的简易OI竞赛测试环境 - + Based on Project Lemon version 1.2 Beta by Zhipeng Jia, 2011 Base on Project Lemon version 1.2 Beta by Zhipeng Jia, 2011 基于Lemon v1.2 by Zhipeng Jia, 2011 @@ -2601,7 +2629,7 @@ 由Dust1404更新 - + Update by Dust1404 and iotang Featured by iotang 由 Dust1404 和 iotang 更新 @@ -2659,12 +2687,12 @@ 下面是一个例子: - + Making backup files to dir <br> `%1'? 创建备份文件到 <br> `%1'? - + Aborted: `%1' already exist. 没有进行整理:`%1' 已经存在。 @@ -2781,7 +2809,7 @@ 项目地址 - + About LemonLime About LemonPlus 关于 LemonLime @@ -2791,7 +2819,7 @@ v1.2 测试版 - + Build Date: %1 构建日期:%1 @@ -2800,7 +2828,7 @@ Copyright (c) 2011 Zhipeng Jia - + This program is under the <a href="http://www.gnu.org/licenses/gpl-3.0.html">GPLv3</a> license 本程序基于<a href="http://www.gnu.org/licenses/gpl-3.0.html">GPLv3</a>许可协议 @@ -2961,71 +2989,71 @@ ResultViewer - - + + Delete 删除选手 - - + + Details 详情 - - + + Judge 测试 - + Name 名称 - + Rank 排名 - + Total Score 总分 - + Total Used Time (s) 总用时(s) - + Judging Time 测试时间 - - - - - - + + + + + + Invalid 不可用 - + LemonLime Lemon LemonLime - + Are you sure to delete selected contestant(s)? 确定删除选定的选手吗? - + Delete data in the disk as well Delete directories in the hard disk as well 同时从硬盘中删除选手数据 @@ -3065,67 +3093,67 @@ Settings - + Correct Answer 答案正确 - + Wrong Answer 答案错误 - + Partly Correct 答案部分正确 - + Time Limit Exceeded 超过时间限制 - + Memory Limit Exceeded 超过空间限制 - + Cannot Start Program 进程被阻塞 - + File Error 文件错误 - + Run Time Error 运行时错误 - + Invalid Special Judge 校验器没有被正确配置 - + Special Judge Time Limit Exceeded 校验器超过时间限制 - + Special Judge Run Time Error 校验器运行时错误 - + Skipped 被忽略 - + Interactor Error 交互库错误 @@ -3147,165 +3175,165 @@ p, li { white-space: pre-wrap; } - - + + No contest yet 还没有比赛 - - + + No task yet 还没有题目 - - + + No contestant yet 还没有参赛者 - + Contest 比赛 - + Overall 总览 - + Score 得分 - + Count 数量 - + Ratio 占比 - + Prefix 前缀和 - + Suffix 后缀和 - - + + Average 平均 - + Standard Deviation 标准差 - + Score Discrimination Power 区分度 - + No. 编号. - + Input 输入 - + Output 输出 - + Pure Arcaea Pure - + Far Arcaea Far - + Lost Arcaea Lost - - + + Files 个文件 - + Some unhandled situation happened. May not all contestants are well judged, or not rejudged after changing testcases. Please refresh and rejudge. Some unhandled situation happened. Please refresh and rejudge. 有些奇怪的错误发生了。可能并非所有参赛者都测试了,或者在更改测试数据后没有重新测试。请刷新选手列表并重新测试。 - + Warning: Judgement is not finished. 警告:没有测试完全部选手。 - + Problems 题目 - + Task 试题 - + Number of answer submitted 提交人数 - - - - - + + + + + LemonLime LemonLime - + Cannot open file %1 无法打开 %1 - + Export is done 导出完成 - + HTML Document (*.html) HTML文档 (*.html) - + Export Statstics 导出统计信息 @@ -3313,56 +3341,56 @@ p, li { white-space: pre-wrap; } SummaryTree - - + + Add a New Task 添加新试题 - - + + Add a Test Case 添加新测试点 - - + + Add Test Cases ... 添加多组测试点... - - + + Delete Current Task 删除选定试题 - - + + Delete Current Test Case 删除选定测试点 - - - - + + + + Test Case #%1 测试点 #%1 - + Problem %1 试题%1 - + LemonLime Lemon LemonLime - + Are you sure to delete this task? 确定删除选定试题? @@ -3751,24 +3779,24 @@ p, li { white-space: pre-wrap; } MB - - - + + + Error 出错了 - + Empty input file name! 输入文件名为空! - + Empty output file name! 输出文件名为空! - + Dependence subtask index error! 子任务依赖编号错误! diff --git a/main.cpp b/main.cpp index 48486171..623609f4 100644 --- a/main.cpp +++ b/main.cpp @@ -36,7 +36,6 @@ auto main(int argc, char *argv[]) -> int #if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // High DPI supported #endif - QtSingleApplication a(argc, argv); if (a.sendMessage("")) @@ -56,14 +55,10 @@ auto main(int argc, char *argv[]) -> int fonts.setFamily("PingFangSC-Regular"); #endif QtSingleApplication::setFont(fonts); - Q_INIT_RESOURCE(resource); - QPixmap pixmap(":/logo/splash.png"); QSplashScreen screen(pixmap); - Lemon w; - qint64 startTime = QDateTime::currentMSecsSinceEpoch(); int splashTime = w.getSplashTime(); @@ -80,9 +75,7 @@ auto main(int argc, char *argv[]) -> int } a.setActivationWindow(&w); - w.show(); w.welcome(); - return QtSingleApplication::exec(); } diff --git a/pics/acrobat.svg b/pics/acrobat.svg new file mode 100644 index 00000000..bde6bc15 --- /dev/null +++ b/pics/acrobat.svg @@ -0,0 +1,3 @@ + + + diff --git a/resource.qrc b/resource.qrc index 1d73cb29..93cad110 100755 --- a/resource.qrc +++ b/resource.qrc @@ -37,6 +37,7 @@ pics/quickopen-file.svg pics/system-help.svg pics/splash.png + pics/acrobat.svg lemon_zh_CN.qm diff --git a/resultviewer.cpp b/resultviewer.cpp index 8f92094e..d2d84415 100644 --- a/resultviewer.cpp +++ b/resultviewer.cpp @@ -44,7 +44,6 @@ ResultViewer::ResultViewer(QWidget *parent) : QTableWidget(parent) { curContest = nullptr; - deleteContestantAction = new QAction(tr("Delete"), this); detailInformationAction = new QAction(tr("Details"), this); judgeSelectedAction = new QAction(tr("Judge"), this); @@ -140,7 +139,6 @@ void ResultViewer::refreshViewer() QStringList headerList; headerList << tr("Rank") << tr("Name") << tr("Total Score"); QList taskList = curContest->getTaskList(); - Settings setting; curContest->copySettings(setting); @@ -153,7 +151,6 @@ void ResultViewer::refreshViewer() setColumnCount(taskList.size() + 5); setHorizontalHeaderLabels(headerList); horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); - QList contestantList = curContest->getContestantList(); QList< QPair> sortList; QList fullScore; @@ -180,7 +177,6 @@ void ResultViewer::refreshViewer() if (score != -1) { item(i, j + 3)->setData(Qt::DisplayRole, score); - QColor bg = QColor::fromHsl(0, 0, 255); if (taskList[j]->getTaskType() != Task::AnswersOnly && contestantList[i]->getCompileState(j) != CompileSuccessfully) @@ -209,11 +205,9 @@ void ResultViewer::refreshViewer() { item(i, 2)->setData(Qt::DisplayRole, totalScore); item(i, 2)->setBackground(setting.getColorGrand(totalScore, sfullScore)); - QFont font; font.setBold(true); item(i, 2)->setFont(font); - item(i, taskList.size() + 3)->setData(Qt::DisplayRole, double (totalUsedTime) / 1000); item(i, taskList.size() + 4)->setData(Qt::DisplayRole, judgingTime.toString("yyyy-MM-dd hh:mm:ss")); sortList.append(qMakePair(-totalScore, contestantList[i]->getContestantName())); @@ -267,9 +261,7 @@ void ResultViewer::refreshViewer() void ResultViewer::judgeSelected() { QList selectionRange = selectedRanges(); - QMap> mapping; - QList taskList = curContest->getTaskList(); int taskSize = taskList.size(); @@ -318,7 +310,6 @@ void ResultViewer::judgeAll() void ResultViewer::judgeUnjudged() { QMap> mapping; - QList contestantList = curContest->getContestantList(); QList taskList = curContest->getTaskList(); int contestantSize = contestantList.size(); @@ -354,7 +345,6 @@ void ResultViewer::judgeUnjudged() void ResultViewer::judgeGrey() { QMap> mapping; - QList contestantList = curContest->getContestantList(); QList taskList = curContest->getTaskList(); int contestantSize = contestantList.size(); @@ -390,7 +380,6 @@ void ResultViewer::judgeGrey() void ResultViewer::judgeMagenta() { QMap> mapping; - QList contestantList = curContest->getContestantList(); QList taskList = curContest->getTaskList(); int contestantSize = contestantList.size(); diff --git a/settings.cpp b/settings.cpp index 70df2f51..4e40b4a6 100644 --- a/settings.cpp +++ b/settings.cpp @@ -233,7 +233,6 @@ auto Settings::getColorPer(double p) -> QColor double h; double s; double l; - distan = (colorMxH - colorMiH) / 360.00 / 110.00; h = colorMiH / 360.00 + 100 * p * distan; @@ -262,7 +261,6 @@ auto Settings::getColorPer(double p) -> QColor h = fmax(0, fmin(h, 1)); s = fmax(0, fmin(s, 1)); l = fmax(0, fmin(l, 1)); - return QColor::fromHslF(h, s, l); } @@ -272,7 +270,6 @@ auto Settings::getColorGrand(double p) -> QColor double h; double s; double l; - distan = grandRateH * (colorMxH - colorMiH) / 360.00 / 110.00; h = grandCompH / 360.00 + colorMiH / 360.00 + 100 * p * distan; @@ -301,7 +298,6 @@ auto Settings::getColorGrand(double p) -> QColor h = fmax(0, fmin(h, 1)); s = fmax(0, fmin(s, 1)); l = fmax(0, fmin(l, 1)); - return QColor::fromHslF(h, s, l); } @@ -402,9 +398,7 @@ auto Settings::getCompiler(int index) -> Compiler * return compilerList[index]; } - return nullptr; - } void Settings::swapCompiler(int a, int b) @@ -647,9 +641,7 @@ void Settings::copyFrom(Settings *other) void Settings::saveSettings() { QSettings settings("Crash", "Lemon"); - settings.setValue("UiLanguage", uiLanguage); - settings.beginGroup("GeneralSettings"); settings.setValue("DefaultFullScore", defaultFullScore); settings.setValue("DefaultTimeLimit", defaultTimeLimit); @@ -663,7 +655,6 @@ void Settings::saveSettings() settings.setValue("InputFileExtensions", inputFileExtensions); settings.setValue("OutputFileExtensions", outputFileExtensions); settings.endGroup(); - settings.beginGroup("VisualSettings"); settings.setValue("ColorMxH", colorMxH); settings.setValue("ColorMxS", colorMxS); @@ -685,7 +676,6 @@ void Settings::saveSettings() settings.setValue("GrandRateL", grandRateL); settings.setValue("SplashTime", splashTime); settings.endGroup(); - settings.beginWriteArray("v1.2/CompilerSettings"); for (int i = 0; i < compilerList.size(); i ++) @@ -718,7 +708,6 @@ void Settings::saveSettings() } settings.endArray(); - settings.beginWriteArray("v1.2/RecentContest"); for (int i = 0; i < recentContest.size(); i ++) @@ -737,11 +726,8 @@ void Settings::loadSettings() compilerList.clear(); recentContest.clear(); - QSettings settings("Crash", "Lemon"); - uiLanguage = settings.value("UiLanguage", QLocale::system().name()).toString(); - settings.beginGroup("GeneralSettings"); defaultFullScore = settings.value("DefaultFullScore", 10).toInt(); defaultTimeLimit = settings.value("DefaultTimeLimit", 1000).toInt(); @@ -755,7 +741,6 @@ void Settings::loadSettings() inputFileExtensions = settings.value("InputFileExtensions", QStringList() << "in").toStringList(); outputFileExtensions = settings.value("OutputFileExtensions", QStringList() << "out" << "ans").toStringList(); settings.endGroup(); - settings.beginGroup("VisualSettings"); colorMxH = settings.value("ColorMxH", 120).toInt(); colorMxS = settings.value("ColorMxS", 50).toDouble(); @@ -777,7 +762,6 @@ void Settings::loadSettings() grandRateL = settings.value("GrandRateL", 1.33).toDouble(); splashTime = settings.value("SplashTime", 500).toInt(); settings.endGroup(); - int compilerCount = settings.beginReadArray("v1.2/CompilerSettings"); for (int i = 0; i < compilerCount; i ++) @@ -820,7 +804,6 @@ void Settings::loadSettings() } settings.endArray(); - int listCount = settings.beginReadArray("v1.2/RecentContest"); for (int i = 0; i < listCount; i ++) @@ -830,7 +813,6 @@ void Settings::loadSettings() } settings.endArray(); - #ifdef Q_OS_WIN32 diffPath = QDir::toNativeSeparators(QDir::currentPath()) + QDir::separator() + "diff.exe"; #endif diff --git a/statisticsbrowser.cpp b/statisticsbrowser.cpp index bd56e550..dcd1f51a 100644 --- a/statisticsbrowser.cpp +++ b/statisticsbrowser.cpp @@ -53,7 +53,6 @@ void StatisticsBrowser::setContest(Contest *contest) auto StatisticsBrowser::getScoreNormalChart(const QMap &scoreCount, int listSize, int totalScore) -> QString { QString buffer = ""; - long long overallScoreSum = 0; double scoreDiscrim = 0; double scoreStandardDevia = 0; @@ -78,7 +77,6 @@ auto StatisticsBrowser::getScoreNormalChart(const QMap &scoreCount, in } double scoreAverage = 1.00 * overallScoreSum / listSize; - buffer += "
%1%1%1%1
%2
"; buffer += QString("").arg(tr("Score")).arg(tr("Count")).arg(tr("Ratio")).arg(tr("Prefix")).arg(tr("Suffix")); @@ -87,9 +85,7 @@ auto StatisticsBrowser::getScoreNormalChart(const QMap &scoreCount, in i--; int curScoreTier = i.key(); int curScoreTierNum = i.value(); - scoreStandardDevia += qPow(curScoreTier - scoreAverage, 2) * curScoreTierNum; - buffer += ""; buffer += QString("").arg(curScoreTier < 0 ? QString("N/A") : QString::number(curScoreTier)); buffer += QString("").arg(curScoreTierNum); @@ -101,21 +97,17 @@ auto StatisticsBrowser::getScoreNormalChart(const QMap &scoreCount, in } buffer += "
%1%2%3%4%5
%1 Pt%1
"; - scoreStandardDevia = qSqrt(scoreStandardDevia / listSize); scoreDiscrim = scoreDiscrim * scoreDiscrim; - buffer += "

" + tr("Average") + " : " + QString::number(scoreAverage) + " / " + QString::number(totalScore) + "

"; buffer += "

" + tr("Standard Deviation") + " : " + QString::number(scoreStandardDevia) + "

"; buffer += "

" + tr("Score Discrimination Power") + " : " + QString::number(scoreDiscrim) + "

"; - return buffer; } auto StatisticsBrowser::getTestcaseScoreChart(QList testCaseList, QList>> scoreList, QList>> resultList) -> QString { QString buffer = ""; - buffer += ""; buffer += QString("").arg(tr("No.")).arg(tr("Input")).arg(tr("Output")).arg(tr("Pure")).arg(tr("Far")).arg(tr("Lost")).arg(tr("Average")); @@ -123,7 +115,6 @@ auto StatisticsBrowser::getTestcaseScoreChart(QList testCaseList, QL { QStringList inFileList = testCaseList[i]->getInputFiles(); QStringList outFileList = testCaseList[i]->getOutputFiles(); - int mxScore = testCaseList[i]->getFullScore(); QList miScoreRecord; QList miStatRecord; @@ -202,11 +193,10 @@ auto StatisticsBrowser::getTestcaseScoreChart(QList testCaseList, QL } buffer += "
%1%2%3%4%5%6%7
"; - return buffer; } -int StatisticsBrowser::checkValid(QList taskList, QList contestantList) +auto StatisticsBrowser::checkValid(QList taskList, const QList &contestantList) -> int { for (auto i : taskList) { @@ -296,17 +286,12 @@ void StatisticsBrowser::refresh() } int totalScore = curContest->getTotalScore(); - buffer += ""; buffer += ""; buffer += ""; - buffer += "

" + QString("%1 %2").arg(tr("Contest")).arg(curContest->getContestTitle()) + "

"; - buffer += "

" + tr("Overall") + "

"; - int haveError = 0; - QMap scoreCount; for (auto &i : contestantList) @@ -333,7 +318,6 @@ void StatisticsBrowser::refresh() buffer += getScoreNormalChart(scoreCount, contestantList.size(), totalScore); buffer += "
"; buffer += "
"; - buffer += "

" + tr("Problems") + "

"; for (int i = 0; i < taskList.size(); i++) @@ -341,9 +325,7 @@ void StatisticsBrowser::refresh() buffer += "

"; buffer += QString("%1 %2: %3").arg(tr("Task")).arg(i + 1).arg(taskList[i]->getProblemTile()); buffer += "

"; - int numberSubmitted = 0; - QMap cnts; QList>> TestcaseScoreList; QList>> resultList; @@ -384,10 +366,8 @@ void StatisticsBrowser::exportStatsticsHtml(QWidget *widget, const QString &file QApplication::setOverrideCursor(Qt::WaitCursor); QTextStream out(&file); - out.setCodec("UTF-8"); out << nowBrowserText; - QApplication::restoreOverrideCursor(); QMessageBox::information(widget, tr("LemonLime"), tr("Export is done"), QMessageBox::Ok); } @@ -418,12 +398,10 @@ void StatisticsBrowser::exportStatstics(QWidget *widget, Contest *curContest) } QString filter = tr("HTML Document (*.html)"); - QString fileName = QFileDialog::getSaveFileName(widget, tr("Export Statstics"), QDir::currentPath() + QDir::separator() + "statstics.html", filter); if (fileName.isEmpty()) return; if (QFileInfo(fileName).suffix() == "html") exportStatsticsHtml(widget, fileName); - } diff --git a/statisticsbrowser.h b/statisticsbrowser.h index d244f5cc..1e9dfa0a 100644 --- a/statisticsbrowser.h +++ b/statisticsbrowser.h @@ -51,7 +51,7 @@ public slots: private: Ui::StatisticsBrowser *ui; Contest *curContest; - int checkValid(QList, QList); + static int checkValid(QList, const QList &); static QString getScoreNormalChart(const QMap &, int, int); static QString getTestcaseScoreChart(QList, QList>>, QList>>); static void exportStatsticsHtml(QWidget *, const QString &); diff --git a/summarytree.cpp b/summarytree.cpp index 51075212..d6924a81 100644 --- a/summarytree.cpp +++ b/summarytree.cpp @@ -32,7 +32,6 @@ SummaryTree::SummaryTree(QWidget *parent) : { curContest = nullptr; addCount = 0; - addTaskAction = new QAction(tr("Add a New Task"), this); addTestCaseAction = new QAction(tr("Add a Test Case"), this); addTestCasesAction = new QAction(tr("Add Test Cases ..."), this); @@ -42,7 +41,6 @@ SummaryTree::SummaryTree(QWidget *parent) : addTestCaseKeyAction = new QAction(this); deleteTaskKeyAction = new QAction(this); deleteTestCaseKeyAction = new QAction(this); - addTaskKeyAction->setShortcutContext(Qt::WidgetShortcut); addTestCaseKeyAction->setShortcutContext(Qt::WidgetShortcut); deleteTaskKeyAction->setShortcutContext(Qt::WidgetShortcut); @@ -59,7 +57,6 @@ SummaryTree::SummaryTree(QWidget *parent) : addAction(addTestCaseKeyAction); addAction(deleteTaskKeyAction); addAction(deleteTestCaseKeyAction); - connect(addTaskAction, SIGNAL(triggered()), this, SLOT(addTask())); connect(addTestCaseAction, SIGNAL(triggered()), @@ -162,7 +159,6 @@ void SummaryTree::setSettings(Settings *_settings) void SummaryTree::contextMenuEvent(QContextMenuEvent */*event*/) { auto *contextMenu = new QMenu(this); - QTreeWidgetItem *curItem = currentItem(); if (! curItem) diff --git a/task.cpp b/task.cpp index cd1800ef..48198dd4 100644 --- a/task.cpp +++ b/task.cpp @@ -303,9 +303,7 @@ auto Task::getTestCase(int index) const -> TestCase * return testCaseList[index]; } - return nullptr; - } void Task::deleteTestCase(int index) diff --git a/taskeditwidget.cpp b/taskeditwidget.cpp index 8505f0ba..887f11d9 100644 --- a/taskeditwidget.cpp +++ b/taskeditwidget.cpp @@ -31,9 +31,7 @@ TaskEditWidget::TaskEditWidget(QWidget *parent) : ui(new Ui::TaskEditWidget) { ui->setupUi(this); - editTask = nullptr; - ui->specialJudge->setFilters(QDir::Files | QDir::Executable); ui->interactorPath->setFilters(QDir::Files); ui->graderPath->setFilters(QDir::Files); @@ -43,18 +41,14 @@ TaskEditWidget::TaskEditWidget(QWidget *parent) : ui->interactorPath, SLOT(refreshFileList())); connect(this, SIGNAL(dataPathChanged()), ui->graderPath, SLOT(refreshFileList())); - ui->sourceFileName->setValidator(new QRegExpValidator(QRegExp("\\w+"), this)); ui->inputFileName->setValidator(new QRegExpValidator(QRegExp(R"((\w+)(\.\w+)?)"), this)); ui->outputFileName->setValidator(new QRegExpValidator(QRegExp(R"((\w+)(\.\w+)?)"), this)); ui->interactorName->setValidator(new QRegExpValidator(QRegExp(R"((\w+)(\.\w+)?)"), this)); ui->answerFileExtension->setValidator(new QRegExpValidator(QRegExp("\\w+"), this)); - ui->sourceFilesTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); ui->graderFilesTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); - //ui->interactionButton->setVisible(false); //rebuilding interaction, remove it temporarily - connect(ui->problemTitle, SIGNAL(textChanged(QString)), this, SLOT(problemTitleChanged(QString))); connect(ui->traditionalButton, SIGNAL(toggled(bool)), @@ -200,7 +194,6 @@ void TaskEditWidget::refreshWidgetState() if (! editTask) return; int types = editTask->getTaskType(); - ui->interactorPathLabel->setVisible(types == Task::Interaction); ui->interactorPath->setVisible(types == Task::Interaction); ui->graderPathLabel->setVisible(types == Task::Interaction); @@ -240,7 +233,6 @@ void TaskEditWidget::refreshWidgetState() ui->multiFilesPathLineEdit->setVisible(types == Task::Communication); ui->multiFilesNameLineEdit->setVisible(types == Task::Communication); ui->multiFilesPathNameLabel->setVisible(types == Task::Communication); - multiFilesRefresh(); } @@ -483,7 +475,6 @@ void TaskEditWidget::multiFilesRefresh() QStringList sourcePaths = editTask->getSourceFilesPath(); QStringList sourceNames = editTask->getSourceFilesName(); - ui->sourceFilesTable->setRowCount(sourcePaths.length()); for (int i = 0; i < sourcePaths.length() ; i++) @@ -494,7 +485,6 @@ void TaskEditWidget::multiFilesRefresh() QStringList graderPaths = editTask->getGraderFilesPath(); QStringList graderNames = editTask->getGraderFilesName(); - ui->graderFilesTable->setRowCount(graderPaths.length()); for (int i = 0; i < graderPaths.length() ; i++) @@ -542,10 +532,8 @@ void TaskEditWidget::addSourceFileClicked() if (path.length() <= 0 || name.length() <= 0) return; addSourceFiles(path, name); - ui->multiFilesPathLineEdit->clear(); ui->multiFilesNameLineEdit->clear(); - multiFilesRefresh(); } @@ -559,10 +547,8 @@ void TaskEditWidget::addGraderFileClicked() if (path.length() <= 0 || name.length() <= 0) return; addGraderFiles(path, name); - ui->multiFilesPathLineEdit->clear(); ui->multiFilesNameLineEdit->clear(); - multiFilesRefresh(); } @@ -575,7 +561,6 @@ void TaskEditWidget::rmSourceFileClicked() if (ranges.length() <= 0) return; rmSourceFilesAt(ranges.at(0).topRow()); - multiFilesRefresh(); } @@ -588,6 +573,5 @@ void TaskEditWidget::rmGraderFileClicked() if (ranges.length() <= 0) return; rmGraderFilesAt(ranges.at(0).topRow()); - multiFilesRefresh(); } diff --git a/testcaseeditwidget.cpp b/testcaseeditwidget.cpp index 44c10cfc..1423f052 100644 --- a/testcaseeditwidget.cpp +++ b/testcaseeditwidget.cpp @@ -31,24 +31,19 @@ TestCaseEditWidget::TestCaseEditWidget(QWidget *parent) : ui(new Ui::TestCaseEditWidget) { ui->setupUi(this); - editTestCase = nullptr; - deleteAction = new QAction(this); deleteAction->setShortcutContext(Qt::WidgetShortcut); deleteAction->setShortcut(QKeySequence::Delete); deleteAction->setEnabled(false); ui->fileList->addAction(deleteAction); - QRegExp regx("[0-9,]+$"); QValidator *subtaskDependenceValidator = new QRegExpValidator(regx, ui->subtaskDependecne); ui->subtaskDependecne->setValidator(subtaskDependenceValidator); - ui->fullScore->setValidator(new QIntValidator(1, Settings::upperBoundForFullScore(), this)); ui->timeLimit->setValidator(new QIntValidator(1, Settings::upperBoundForTimeLimit(), this)); ui->memoryLimit->setValidator(new QIntValidator(1, Settings::upperBoundForMemoryLimit(), this)); ui->fileList->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); - ui->inputFileEdit->setFilters(QDir::Files); ui->outputFileEdit->setFilters(QDir::Files); connect(this, SIGNAL(dataPathChanged()), @@ -57,7 +52,6 @@ TestCaseEditWidget::TestCaseEditWidget(QWidget *parent) : ui->outputFileEdit, SLOT(refreshFileList())); connect(ui->subtaskDependecne, SIGNAL(editingFinished()), this, SLOT(subtaskDependenceChanged())); //auto save subtaskDependence - connect(ui->addButton, SIGNAL(clicked()), this, SLOT(addSingleCase())); connect(deleteAction, SIGNAL(triggered()), diff --git a/testlib_for_lemons.h b/testlib_for_lemons.h index fc07f1b1..0623b5af 100644 --- a/testlib_for_lemons.h +++ b/testlib_for_lemons.h @@ -503,7 +503,6 @@ class random_t void setSeed(int argc, char *argv[]) { random_t p; - seed = 3905348978240129619LL; for (int i = 1; i < argc; i++) @@ -552,7 +551,6 @@ class random_t return (int)((n * (long long) nextBits(31)) >> 31); const long long limit = INT_MAX / n * n; - long long bits; do @@ -579,7 +577,6 @@ class random_t __testlib_fail("random_t::next(long long n): n must be positive"); const long long limit = __TESTLIB_LONGLONG_MAX / n * n; - long long bits; do @@ -968,7 +965,6 @@ static bool __pattern_isCommandChar(const std::string &s, size_t pos, char value return false; int slashes = 0; - int before = int (pos) - 1; while (before >= 0 && s[before] == '\\') @@ -1078,7 +1074,6 @@ static void __pattern_scanCounts(const std::string &s, size_t &pos, int &from, i { std::vector parts; std::string part; - pos++; while (pos < s.length() && !__pattern_isCommandChar(s, pos, '}')) @@ -1158,7 +1153,6 @@ static std::vector __pattern_scanCharSet(const std::string &s, size_t &pos { pos++; bool negative = __pattern_isCommandChar(s, pos, '^'); - char prev = 0; while (pos < s.length() && !__pattern_isCommandChar(s, pos, ']')) @@ -1183,7 +1177,6 @@ static std::vector __pattern_scanCharSet(const std::string &s, size_t &pos result.push_back(c); result.push_back(next); - prev = 0; } else @@ -1236,7 +1229,6 @@ pattern::pattern(std::string s) : s(s), from(0), to(0) t += s[i]; s = t; - int opened = 0; int firstClose = -1; std::vector seps; @@ -1539,7 +1531,6 @@ class BufferedFileInputStreamReader: public InputStreamReader bufferSize = MAX_UNREAD_COUNT + readSize; bufferPos = int (MAX_UNREAD_COUNT); std::memset(isEof + MAX_UNREAD_COUNT, 0, sizeof(isEof[0]) * readSize); - return readSize > 0; } else @@ -1977,7 +1968,6 @@ void InStream::textColor(WORD color) HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleTextAttribute(handle, color); #endif - #ifdef linux char *shell_path = getenv("SHELL"); @@ -2148,7 +2138,6 @@ NORETURN void InStream::quit(TResult result, const char *msg) quitscr(LightGray, msg); std::fprintf(stderr, "\n"); - inf.close(); ouf.close(); ans.close(); @@ -2256,7 +2245,6 @@ void InStream::reset() } opened = true; - __testlib_set_binary(file); if (stdfile) @@ -2277,7 +2265,6 @@ void InStream::init(std::string fileName, TMode mode) void InStream::init(std::FILE *f, TMode mode) { opened = false; - name = "untitled"; if (f == stdin) @@ -2291,7 +2278,6 @@ void InStream::init(std::FILE *f, TMode mode) this->file = f; this->mode = mode; - reset(); } @@ -2499,9 +2485,7 @@ static inline bool equals(long long integer, const char *s) static inline double stringToDouble(InStream &in, const char *buffer) { double retval; - size_t length = strlen(buffer); - int minusCount = 0; int plusCount = 0; int decimalPointCount = 0; @@ -2562,7 +2546,6 @@ static inline double stringToStrictDouble(InStream &in, const char *buffer, int in.quit(_fail, "stringToStrictDouble: minAfterPointDigitCount should be less or equal to maxAfterPointDigitCount."); double retval; - size_t length = strlen(buffer); if (length == 0 || length > 1000) @@ -2647,7 +2630,6 @@ static inline long long stringToLongLong(InStream &in, const char *buffer) in.quit(_pe, ("Expected integer, but \"" + __testlib_part(buffer) + "\" found").c_str()); long long retval = 0LL; - int zeroes = 0; int processingZeroes = true; @@ -2687,7 +2669,6 @@ int InStream::readInteger() quit(_unexpected_eof, "Unexpected end of file - int32 expected"); readWordTo(_tmpReadToken); - long long value = stringToLongLong(*this, _tmpReadToken.c_str()); if (value < INT_MIN || value > INT_MAX) @@ -2860,7 +2841,6 @@ bool InStream::eoln() else { bool returnCr = false; - #ifdef CR_MUST_IN_EOL if (c != CR) @@ -3048,7 +3028,6 @@ NORETURN void quit(TResult result, const char *msg) NORETURN void __testlib_quitp(double points, const char *message) { __testlib_points = points; - std::string quitMessage; if (localJudger) @@ -3122,7 +3101,6 @@ NORETURN void __testlib_help() std::fprintf(stderr, "by Mike Mirzayanov, copyright(c) 2005-2013\n"); std::fprintf(stderr, "Checker name: \"%s\"\n", checkerName.c_str()); InStream::textColor(InStream::LightGray); - std::fprintf(stderr, "\n"); std::fprintf(stderr, "Latest features: \n"); @@ -3132,10 +3110,8 @@ NORETURN void __testlib_help() } std::fprintf(stderr, "\n"); - std::fprintf(stderr, "Program must be run with the following arguments: \n"); std::fprintf(stderr, " [ [<-appes>]]\n\n"); - std::exit(FAIL_EXIT_CODE); } @@ -3143,10 +3119,8 @@ static void __testlib_ensuresPreconditions() { // testlib assumes: sizeof(int) = 4. __TESTLIB_STATIC_ASSERT(sizeof(int) == 4); - // testlib assumes: INT_MAX == 2147483647. __TESTLIB_STATIC_ASSERT(INT_MAX == 2147483647); - // testlib assumes: sizeof(long long) = 8. __TESTLIB_STATIC_ASSERT(sizeof(long long) == 8); @@ -3164,9 +3138,7 @@ void registerGen(int argc, char *argv[], int randomGeneratorVersion) quitf(_fail, "Random generator version is expected to be 0 or 1."); random_t::version = randomGeneratorVersion; - __testlib_ensuresPreconditions(); - testlibMode = _generator; __testlib_set_binary(stdin); rnd.setSeed(argc, argv); @@ -3191,7 +3163,6 @@ void registerGen(int argc, char *argv[]) void registerInteraction(int argc, char *argv[]) { __testlib_ensuresPreconditions(); - testlibMode = _interactor; __testlib_set_binary(stdin); @@ -3252,10 +3223,8 @@ void registerInteraction(int argc, char *argv[]) void registerValidation() { __testlib_ensuresPreconditions(); - testlibMode = _validator; __testlib_set_binary(stdin); - inf.init(stdin, _input); inf.strict = true; } @@ -3263,7 +3232,6 @@ void registerValidation() void registerTestlibCmd(int argc, char *argv[]) { __testlib_ensuresPreconditions(); - testlibMode = _checker; __testlib_set_binary(stdin); @@ -3315,7 +3283,6 @@ void registerTestlib(int argc, ...) " [ [<-appes>]]"); char **argv = new char *[argc + 1]; - va_list ap; va_start(ap, argc); argv[0] = NULL; @@ -3326,7 +3293,6 @@ void registerTestlib(int argc, ...) } va_end(ap); - registerTestlibCmd(argc + 1, argv); delete[] argv; } @@ -3335,10 +3301,8 @@ void registerLocalChecker(const std::string &_inputFile, const std::string &_out { localJudger = 1; __testlib_ensuresPreconditions(); - testlibMode = _checker; __testlib_set_binary(stdin); - inf.init(_inputFile, _input); ouf.init(_outputFile, _output); ans.init(_answerFile, _answer); diff --git a/visualsettings.cpp b/visualsettings.cpp index f93d5f74..8a3167e7 100644 --- a/visualsettings.cpp +++ b/visualsettings.cpp @@ -25,7 +25,6 @@ VisualSettings::VisualSettings(QWidget *parent) : ui(new Ui::VisualSettings) { ui->setupUi(this); - connect(ui->spinBoxMxH, SIGNAL(valueChanged(int)), this, SLOT(colorMxHChanged(int))); connect(ui->doubleSpinBoxMxS, SIGNAL(valueChanged(double)), @@ -50,7 +49,6 @@ VisualSettings::VisualSettings(QWidget *parent) : this, SLOT(colorCeSChanged(double))); 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)), @@ -63,10 +61,8 @@ VisualSettings::VisualSettings(QWidget *parent) : this, SLOT(grandRateSChanged(double))); 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(whenResetToDefault())); } @@ -121,7 +117,6 @@ void VisualSettings::whenResetToDefault() void VisualSettings::resetEditSettings(Settings *settings) { editSettings = settings; - ui->spinBoxMxH->setValue(editSettings->getColorMxH()); ui->doubleSpinBoxMxS->setValue(editSettings->getColorMxS()); ui->doubleSpinBoxMxL->setValue(editSettings->getColorMxL()); diff --git a/watcher_macos.cpp b/watcher_macos.cpp index dc63cbee..a9e63203 100644 --- a/watcher_macos.cpp +++ b/watcher_macos.cpp @@ -47,7 +47,6 @@ int main(int argc, char *argv[]) timeLimit = (timeLimit - 1) / 1000 + 1; sscanf(argv[6], "%d", &memoryLimit); memoryLimit *= 1024; - pid = fork(); if (pid > 0) @@ -124,7 +123,6 @@ int main(int argc, char *argv[]) { (rlim_t) timeLimit, (rlim_t)(timeLimit + 1) }; - setrlimit(RLIMIT_AS, &memlim); setrlimit(RLIMIT_STACK, &stalim); setrlimit(RLIMIT_CPU, &timlim); diff --git a/watcher_unix b/watcher_unix index 2c193c59..3906783e 100755 Binary files a/watcher_unix and b/watcher_unix differ diff --git a/watcher_unix.cpp b/watcher_unix.cpp index 909ad395..ea468ae6 100644 --- a/watcher_unix.cpp +++ b/watcher_unix.cpp @@ -47,7 +47,6 @@ int main(int argc, char *argv[]) timeLimit = (timeLimit - 1) / 1000 + 1; sscanf(argv[6], "%d", &memoryLimit); memoryLimit *= 1024 * 1024; - pid = fork(); if (pid > 0) @@ -124,7 +123,6 @@ int main(int argc, char *argv[]) { (rlim_t) timeLimit, (rlim_t)(timeLimit + 1) }; - setrlimit(RLIMIT_AS, &memlim); setrlimit(RLIMIT_STACK, &stalim); setrlimit(RLIMIT_CPU, &timlim);