Esempio n. 1
0
void SummaryTree::setContest(Contest *contest)
{
    if (curContest) {
        QList<Task*> taskList = curContest->getTaskList();
        for (int i = 0; i <  taskList.size(); i ++)
            disconnect(taskList[i], SIGNAL(problemTitleChanged(QString)),
                       this, SLOT(titleChanged(QString)));
    }
    curContest = contest;
    if (! curContest) return;
    setEnabled(false);
    clear();
    QList<Task*> taskList = curContest->getTaskList();
    for (int i = 0; i < taskList.size(); i ++) {
        connect(taskList[i], SIGNAL(problemTitleChanged(QString)),
                this, SLOT(titleChanged(QString)));
        QTreeWidgetItem *newTaskItem = new QTreeWidgetItem(this);
        newTaskItem->setText(0, taskList[i]->getProblemTile());
        newTaskItem->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsEnabled);
        for (int j = 0; j < taskList[i]->getTestCaseList().size(); j ++) {
            QTreeWidgetItem *newTestCaseItem = new QTreeWidgetItem(newTaskItem);
            newTestCaseItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
            newTestCaseItem->setText(0, tr("Test Case #%1").arg(newTaskItem->childCount()));
        }
    }
    if (taskList.size() > 0) setCurrentItem(topLevelItem(0));
    setEnabled(true);
    emit currentItemChanged(0, 0);
}
Esempio n. 2
0
void Contest::addTask(Task *task)
{
    task->setParent(this);
    taskList.append(task);
    connect(task, SIGNAL(problemTitleChanged(QString)),
            this, SIGNAL(problemTitleChanged()));
    emit taskAddedForContestant();
    emit taskAddedForViewer();
}
Esempio n. 3
0
void SummaryTree::addTask()
{
    Task *newTask = new Task;
    newTask->setAnswerFileExtension(settings->getDefaultOutputFileExtension());
    curContest->addTask(newTask);
    newTask->refreshCompilerConfiguration(settings);
    connect(newTask, SIGNAL(problemTitleChanged(QString)),
            this, SLOT(titleChanged(QString)));
    QTreeWidgetItem *newItem = new QTreeWidgetItem(this);
    setCurrentItem(newItem);
    newItem->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsEnabled);
    newItem->setText(0, tr("Problem %1").arg(++ addCount));
    editItem(newItem);
}
void TaskEditWidget::setEditTask(Task *task)
{
    if (editTask) {
        disconnect(editTask, SIGNAL(problemTitleChanged(QString)),
                   this, SLOT(refreshProblemTitle(QString)));
        disconnect(editTask, SIGNAL(compilerConfigurationRefreshed()),
                   this, SLOT(refreshCompilerConfiguration()));
    }
    editTask = task;
    if (! task) return;
    connect(editTask, SIGNAL(problemTitleChanged(QString)),
            this, SLOT(refreshProblemTitle(QString)));
    connect(editTask, SIGNAL(compilerConfigurationRefreshed()),
            this, SLOT(refreshCompilerConfiguration()));
    ui->problemTitle->setText(editTask->getProblemTile());
    ui->sourceFileName->setEnabled(false);
    ui->sourceFileName->setText(editTask->getSourceFileName());
    ui->sourceFileName->setEnabled(true);
    ui->inputFileName->setText(editTask->getInputFileName());
    ui->outputFileName->setText(editTask->getOutputFileName());
    ui->comparisonMode->setCurrentIndex(int(editTask->getComparisonMode()));
    ui->diffArguments->setText(editTask->getDiffArguments());
    ui->realPrecision->setValue(editTask->getRealPrecision());
    ui->specialJudge->setText(editTask->getSpecialJudge());
    ui->standardInputCheck->setChecked(editTask->getStandardInputCheck());
    ui->standardOutputCheck->setChecked(editTask->getStandardOutputCheck());
    ui->answerFileExtension->setText(editTask->getAnswerFileExtension());
    refreshCompilerConfiguration();
    if (editTask->getTaskType() == Task::Traditional) {
        ui->traditionalButton->setChecked(true);
    }
    if (editTask->getTaskType() == Task::AnswersOnly) {
        ui->answersOnlyButton->setChecked(true);
    }
    refreshWidgetState();
}
TaskEditWidget::TaskEditWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::TaskEditWidget)
{
    ui->setupUi(this);
    
    editTask = 0;
    
    ui->specialJudge->setFilters(QDir::Files | QDir::Executable);
    connect(this, SIGNAL(dataPathChanged()),
            ui->specialJudge, SLOT(refreshFileList()));
    
    ui->sourceFileName->setValidator(new QRegExpValidator(QRegExp("\\w+"), this));
    ui->inputFileName->setValidator(new QRegExpValidator(QRegExp("(\\w+)(\\.\\w+)?"), this));
    ui->outputFileName->setValidator(new QRegExpValidator(QRegExp("(\\w+)(\\.\\w+)?"), this));
    ui->answerFileExtension->setValidator(new QRegExpValidator(QRegExp("\\w+"), this));
    
    connect(ui->problemTitle, SIGNAL(textChanged(QString)),
            this, SLOT(problemTitleChanged(QString)));
    connect(ui->traditionalButton, SIGNAL(toggled(bool)),
            this, SLOT(setToTraditional(bool)));
    connect(ui->answersOnlyButton, SIGNAL(toggled(bool)),
            this, SLOT(setToAnswersOnly(bool)));
    connect(ui->sourceFileName, SIGNAL(textChanged(QString)),
            this, SLOT(sourceFileNameChanged(QString)));
    connect(ui->inputFileName, SIGNAL(textChanged(QString)),
            this, SLOT(inputFileNameChanged(QString)));
    connect(ui->outputFileName, SIGNAL(textChanged(QString)),
            this, SLOT(outputFileNameChanged(QString)));
    connect(ui->standardInputCheck, SIGNAL(stateChanged(int)),
            this, SLOT(standardInputCheckChanged()));
    connect(ui->standardOutputCheck, SIGNAL(stateChanged(int)),
            this, SLOT(standardOutputCheckChanged()));
    connect(ui->comparisonMode, SIGNAL(currentIndexChanged(int)),
            this, SLOT(comparisonModeChanged()));
    connect(ui->diffArguments, SIGNAL(textChanged(QString)),
            this, SLOT(diffArgumentsChanged(QString)));
    connect(ui->realPrecision, SIGNAL(valueChanged(int)),
            this, SLOT(realPrecisionChanged(int)));
    connect(ui->specialJudge, SIGNAL(textChanged(QString)),
            this, SLOT(specialJudgeChanged(QString)));
    connect(ui->compilersList, SIGNAL(currentRowChanged(int)),
            this, SLOT(compilerSelectionChanged()));
    connect(ui->configurationSelect, SIGNAL(currentIndexChanged(int)),
            this, SLOT(configurationSelectionChanged()));
    connect(ui->answerFileExtension, SIGNAL(textChanged(QString)),
            this, SLOT(answerFileExtensionChanged(QString)));
}