#include "hello.h" #include "ui_hello.h" #include "manager.h" #include "mainwindow.h" #include #include const QString Hello::fileDialogFilterString = tr("SQLite Database Files (*.sqlite3 *.sqlite *.db *.db3 *.sl3 *.s3db *.sdb *.sqlite2 *.db2 *.sl2 *.s2db)"); Hello::Hello(QWidget *parent) : QWidget(parent), ui(new Ui::Hello) { ui->setupUi(this); // manager = new Manager(); // dial.manager = manager; this->setFixedSize(422,300); } Hello::~Hello() { delete ui; } void Hello::on_pushButton_2_clicked() { ui->stackedWidget->setCurrentIndex(1); } void Hello::on_pushButton_4_clicked() { dbFileFullPath = QFileDialog::getOpenFileName(this, tr("Open SQLite Database File"), "", Hello::fileDialogFilterString); // manager->initAppWithDatabaseFile(dbFileFullPath); ui->lineEdit->setText(dbFileFullPath); // emit sendText(dbFileFullPath); } void Hello::on_pushButton_5_clicked() { dbFileFullPath = QFileDialog::getSaveFileName(this, tr("Open SQLite Database File"), "", Hello::fileDialogFilterString); // manager->initAppWithDatabaseFile(dbFileFullPath); ui->lineEdit_3->setText(dbFileFullPath); // emit sendText(dbFileFullPath); } void Hello::on_pushButton_6_clicked() { ui->stackedWidget->setCurrentIndex(0); } void Hello::on_okButton_clicked() { QString password = ui->passwordLine->text(); // mainwindow.createModel(); if(mainwindow.initAppWithDatabaseFile(dbFileFullPath, password, false)) { if(mainwindow.checkPassoword(password)) { mainwindow.show(); QWidget::close() ; } } } void Hello::on_createOkButton_clicked() { if(QString::compare(ui->newPasswordLine1->text(), ui->newPasswordLine2->text()) == 0) { mainwindow.initAppWithDatabaseFile(dbFileFullPath, ui->newPasswordLine1->text(), true); mainwindow.show(); QWidget::close() ; }else { // std::cout << "passwords not equals : " << ui->newPasswordLine1->text().toStdString() << "!=" << ui->newPasswordLine2->text().toStdString() << std::endl; } }