Skip to content

Commit

Permalink
有一段代码不见了,奇怪的事情发生了
Browse files Browse the repository at this point in the history
  • Loading branch information
iotang committed Apr 18, 2020
1 parent c7c82d0 commit 8e720eb
Show file tree
Hide file tree
Showing 36 changed files with 532 additions and 791 deletions.
29 changes: 9 additions & 20 deletions addcompilerwizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand All @@ -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()),
Expand Down Expand Up @@ -89,32 +86,29 @@ AddCompilerWizard::~AddCompilerWizard()
delete ui;
}

const QList<Compiler *> &AddCompilerWizard::getCompilerList() const
auto AddCompilerWizard::getCompilerList() const -> const QList<Compiler *> &
{
return compilerList;
}

int AddCompilerWizard::nextId() const
auto AddCompilerWizard::nextId() const -> int
{
if (currentId() == 0)
{
if (ui->customRadioButton->isChecked())
{
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)
{
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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())
Expand Down
8 changes: 0 additions & 8 deletions addtaskdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down Expand Up @@ -69,9 +67,7 @@ auto AddTaskDialog::getFullScore(int index) const -> int
return fullScore[index];
}


return 0;

}

auto AddTaskDialog::getTimeLimit(int index) const -> int
Expand All @@ -81,9 +77,7 @@ auto AddTaskDialog::getTimeLimit(int index) const -> int
return timeLimit[index];
}


return 0;

}

auto AddTaskDialog::getMemoryLimit(int index) const -> int
Expand All @@ -93,9 +87,7 @@ auto AddTaskDialog::getMemoryLimit(int index) const -> int
return memoryLimit[index];
}


return 0;

}

void AddTaskDialog::taskBoxIndexChanged()
Expand Down
7 changes: 0 additions & 7 deletions addtestcaseswizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ++)
Expand Down Expand Up @@ -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 ++)
Expand All @@ -294,7 +290,6 @@ void AddTestCasesWizard::searchMatchedFiles()

std::sort(inputFiles.begin(), inputFiles.end(), compareFileName);
std::sort(outputFiles.begin(), outputFiles.end(), compareFileName);

QList<QStringList> inputFilesMatchedPart;
QList<QStringList> outputFilesMatchedPart;

Expand Down Expand Up @@ -334,7 +329,6 @@ void AddTestCasesWizard::searchMatchedFiles()
matchedPart.append(inputFilesMatchedPart[i]);
}
}*/

loc.clear();

for (int i = 0; i < singleCases.size(); i ++)
Expand All @@ -355,7 +349,6 @@ void AddTestCasesWizard::searchMatchedFiles()
matchedInputFiles.clear();
matchedOutputFiles.clear();
ui->testCasesViewer->clear();

QList<QString> keys = loc.uniqueKeys();
std::sort(keys.begin(), keys.end(), compareFileName);

Expand Down
2 changes: 0 additions & 2 deletions advancedcompilersettingsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down
9 changes: 0 additions & 9 deletions assignmentthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Compiler *> compilerList = settings->getCompilerList();

for (auto &i : compilerList)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -399,11 +397,8 @@ void AssignmentThread::run()
}
}


skipEnabled = 0;

assign();

exec();
}

Expand All @@ -417,7 +412,6 @@ void AssignmentThread::assign()
}

TestCase *curTestCase = task->getTestCase(curTestCaseIndex);

bool beingSkipped = false;

if (curSingleCaseIndex == curTestCase->getInputFiles().size())
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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())
Expand Down
3 changes: 0 additions & 3 deletions compilersettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand Down Expand Up @@ -70,7 +68,6 @@ CompilerSettings::~CompilerSettings()
void CompilerSettings::resetEditSettings(Settings *settings)
{
editSettings = settings;

const QList<Compiler *> &compilerList = editSettings->getCompilerList();
ui->compilerList->clear();

Expand Down
18 changes: 0 additions & 18 deletions contest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ auto Contest::getTask(int index) const -> Task *
return taskList[index];
}


return nullptr;

}

auto Contest::getTaskList() const -> const QList<Task *> &
Expand Down Expand Up @@ -98,9 +96,7 @@ auto Contest::getContestant(const QString &name) const -> Contestant *
return contestantList.value(name);
}


return nullptr;

}

auto Contest::getContestantList() const -> QList<Contestant *>
Expand Down Expand Up @@ -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)));
Expand Down Expand Up @@ -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();
}
Expand All @@ -301,7 +293,6 @@ void Contest::judge(Contestant *contestant, const QSet<int> &index)
if (!index.contains(i)) continue;

emit taskJudgingStarted(taskList[i]->getProblemTile());

auto *thread = new AssignmentThread();
connect(thread, SIGNAL(dialogAlert(QString)),
this, SIGNAL(dialogAlert(QString)));
Expand Down Expand Up @@ -339,18 +330,15 @@ void Contest::judge(Contestant *contestant, const QSet<int> &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();
}
Expand All @@ -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)));
Expand Down Expand Up @@ -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();
}
Expand Down
Loading

0 comments on commit 8e720eb

Please sign in to comment.