2017-05-16 07:34:54 +00:00
|
|
|
#include "mainwindow.h"
|
|
|
|
#include "ui_mainwindow.h"
|
|
|
|
|
2017-05-20 02:57:51 +00:00
|
|
|
#include "boltdb.h"
|
2017-05-16 07:34:54 +00:00
|
|
|
|
|
|
|
#include <QFileDialog>
|
|
|
|
#include <QMessageBox>
|
|
|
|
|
|
|
|
MainWindow::MainWindow(QWidget *parent) :
|
|
|
|
QMainWindow(parent),
|
|
|
|
ui(new Ui::MainWindow)
|
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
MainWindow::~MainWindow()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::on_actionOpen_database_triggered()
|
|
|
|
{
|
|
|
|
QString file = QFileDialog::getOpenFileName(this, tr("Select bolt database..."));
|
|
|
|
if (! file.length()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-05-20 02:57:51 +00:00
|
|
|
// Open
|
|
|
|
QString error;
|
|
|
|
auto *bdb = BoltDB::createFrom(file, error);
|
|
|
|
if (bdb == nullptr) {
|
2017-05-16 07:34:54 +00:00
|
|
|
QMessageBox qmb;
|
2017-05-20 02:57:51 +00:00
|
|
|
qmb.setText(tr("Error opening database: %s").arg(error));
|
2017-05-16 07:34:54 +00:00
|
|
|
qmb.exec();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-05-20 02:57:51 +00:00
|
|
|
// Free
|
|
|
|
delete bdb;
|
2017-05-16 07:34:54 +00:00
|
|
|
}
|
2017-05-20 03:20:30 +00:00
|
|
|
|
|
|
|
void MainWindow::on_actionExit_triggered()
|
|
|
|
{
|
|
|
|
close();
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_actionAbout_Qt_triggered()
|
|
|
|
{
|
|
|
|
QApplication::aboutQt();
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::on_actionAbout_qbolt_triggered()
|
|
|
|
{
|
|
|
|
QMessageBox::about(
|
|
|
|
this,
|
|
|
|
QApplication::applicationDisplayName(),
|
|
|
|
"<b>QBolt</b><br>Graphical interface for managing Bolt databases<br><br>"
|
|
|
|
"- <a href='https://github.com/boltdb/bolt'>About BoltDB</a><br>"
|
|
|
|
"- <a href='http://www.famfamfam.com/lab/icons/silk/'>FamFamFam "Silk" icon set</a><br>"
|
|
|
|
"- <a href='https://code.ivysaur.me/qbolt'>QBolt homepage</a><br>"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|