void SavingSettingsTabView::chooseResultDBPathSlot()
{
    QString filePath = QFileDialog::getExistingDirectory(this, tr("Choose Test Directory"), "");
    if (filePath.indexOf("/") == filePath.count() - 1)
        m_savingPath->setText(filePath);
    else
        m_savingPath->setText(filePath + slash);
    setDbName(m_savingPath->text() + m_resDbName->text());
}
SavingSettingsTabView::SavingSettingsTabView(QWidget *parent) :
    TestBaseView(parent),
    m_savingPath(new QLabel(QDir::currentPath() + slash, this)),
    m_resDbName(new QLineEdit("ResultDB", this)),
    m_choosePath(new QPushButton("Выбрать путь хранения", this)),
    m_grid(new QGridLayout(this)),
    m_model(new QSqlQueryModel(this)),
    m_table(new QTableView(this)),
    m_header(new QLabel("Таблица результатов тестирования:", this)),
    m_update(new QPushButton("Обновить таблицу", this)),
    m_docSaver(new QPushButton("Выгрузить в Doc файл", this)),
    m_back(new QPushButton("Вернуться на главную", this))
{
    m_header->setFixedHeight(50);
    this->setStyleSheet("QPushButton { height: 45px; }"
                        "QTextEdit { height: 45px; }"
                        "QTimeEdit { height: 45px; }"
                        "QLineEdit { height: 45px; }"
                        "QPlainTextEdit { height: 45px; }");

    connect(m_update,   &QPushButton::clicked, this, &SavingSettingsTabView::loadDbModel);
    connect(m_docSaver, &QPushButton::clicked, this, &SavingSettingsTabView::saveToDocFile);

    connect(m_choosePath, &QPushButton::clicked,       this, &SavingSettingsTabView::chooseResultDBPathSlot);
    connect(m_resDbName,  &QLineEdit::editingFinished, this, &SavingSettingsTabView::changeResultDbNameSlot);
    connect(m_back,       &QPushButton::clicked,       this, &SavingSettingsTabView::back);

    m_table->setModel(m_model);

    QHBoxLayout *hbox = new QHBoxLayout(this);
    hbox->addWidget(m_savingPath);
    hbox->addWidget(m_resDbName);

    hbox->setSpacing(0);
    hbox->setMargin(0);

    QVBoxLayout *vbox = new QVBoxLayout(this);
    vbox->addWidget(m_update);
    vbox->addWidget(m_docSaver);
    vbox->addWidget(m_back);

    QVBoxLayout *middle = new QVBoxLayout(this);
    middle->addWidget(m_header);
    middle->addWidget(m_table);

    m_grid->addLayout(hbox,         0, 0);
    m_grid->addWidget(m_choosePath, 0, 1);
    m_grid->addLayout(middle,       2, 0);
    m_grid->addLayout(vbox,         2, 1);

    m_grid->setMargin(margin);
    m_grid->setSpacing(margin/2);

    setDbName(m_savingPath->text() + m_resDbName->text());

    setLayout(m_grid);
}
Пример #3
0
bool
DbUtil::createDb(BaseString& m_db)
{
  BaseString stm;
  setDbName(m_db.c_str());
  
  {
    if(selectDb())
    {
      stm.assfmt("DROP DATABASE %s", m_db.c_str());
      if(!doQuery(m_db.c_str()))
        return false;
    }
    stm.assfmt("CREATE DATABASE %s", m_db.c_str());
    if(!doQuery(m_db.c_str()))
      return false;
    return true;
  }
}
KeychainAuthLogger::KeychainAuthLogger(const AuditToken &srcToken, short auEvent, const char *database, const char *item)
    : AuditLogger(srcToken, auEvent)
{
    setDbName(database);
    setItemName(item);
}
void SavingSettingsTabView::changeResultDbNameSlot()
{
    setDbName(m_savingPath->text() + m_resDbName->text());
}