Example #1
0
void OutputTableBase::openFile(QString appendix) {
    QString fileNameApp = insertAppendix(fileName, appendix);
    QString useFileName = (runNumber() == 1 || hasSummary()) ?
                          fileNameApp : insertNumber(fileNameApp, runNumber());

    QString path = FileLocations::location(FileLocationInfo::Output).absolutePath();
    QString filePath = path + "/" + useFileName;
    outputFilePaths << filePath;

    file.setFileName(filePath);
    if (!file.open(QIODevice::Text | QIODevice::WriteOnly))
        throw Exception("Could not open output file to write table:\n'" + filePath + "'");

    // If more than one file then give the first file a number too
    if (runNumber() == 2 && !hasSummary()) {
        QString filePath = path + "/" + fileNameApp;
        QFile prevFile(filePath);

        QString newName = path + "/" + insertNumber(fileNameApp, 1);
        outputFilePaths[0] = newName;

        // Delete any existing file named newName
        QFile toDelete(newName);
        toDelete.remove();
        prevFile.rename(newName);
    }
}
Example #2
0
void LineEdit::backspace()
{
    QLineEdit::backspace();
    if(text().isEmpty())
        clearSlot();
    insertNumber(Number::toNumber(text()));
}
Example #3
0
void test_single_linked_list() {
  LinkedList *list = createLinkedList();
  printf("Starting size of the list: %d\n", sizeOfList(list));
  insertNumber(5, list);
  printf("Inserting number into list, new size: %d\n", sizeOfList(list));
  removeAll(list);
  free(list);
}
Example #4
0
void Game::compose() {
    for (int i = 0; i < 9; i++) {
        for (int j = 0; j < 9; j++) {
            if (grid[i * 9 + j] == 0) {
                insertNumber(i, j);
            }
        }
    }
}
Example #5
0
void LineEdit::pasteSlot()
{
    QClipboard *cl = qApp->clipboard();
    insertNumber(Number::toNumber(cl->text()));
}