Exemplo n.º 1
0
MainWindow::MainWindow(QWidget *parent): QWidget(parent)
{
    this->setWindowTitle("Art Prompt Generator");
    this->setFixedSize(300, 100);
    QFont font;
    font.setPointSize(14);
    mainLayout = new QGridLayout;
    generate = new QPushButton;
    generate->setFont(font);
    generate->setText("Generate");
    first = new QLabel;
    first->setFont(font);
    first->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
    first->setAlignment(Qt::AlignCenter);
    second = new QLabel;
    second->setFont(font);
    second->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
    second->setAlignment(Qt::AlignCenter);
    third = new QLabel;
    third->setFont(font);
    third->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
    third->setAlignment(Qt::AlignCenter);
    mainLayout->addWidget(first, 0, 0);
    mainLayout->addWidget(second, 0, 1);
    mainLayout->addWidget(third, 0, 2);
    mainLayout->addWidget(generate, 1, 0, 1, 3);
    this->setLayout(mainLayout);
    connect(generate, SIGNAL(released()), this, SLOT(generatePrompt()));
}
Exemplo n.º 2
0
/**
 * Gets input from the user until the command `exit` is entered.
 *
 * @returns nothing
 */
void getInput()
{
    shellInternal* env = malloc(sizeof(shellInternal));

    do
    {
        char* prompt = generatePrompt();
        char* command = readline(prompt);

        add_history(command);
        runCommand(command, env);

        free(prompt);
        free(command);

    } while(1);

    free(env);
}