File indexing completed on 2025-05-04 04:59:33

0001 /*
0002    SPDX-FileCopyrightText: 2016-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "managelocaldatabasegui.h"
0008 #include "../localdatabasemanager.h"
0009 #include <QStandardPaths>
0010 
0011 #include <QApplication>
0012 #include <QPlainTextEdit>
0013 #include <QPushButton>
0014 #include <QVBoxLayout>
0015 
0016 ManageLocalDataBaseGui::ManageLocalDataBaseGui(QWidget *parent)
0017     : QWidget(parent)
0018     , mDbManager(new WebEngineViewer::LocalDataBaseManager(this))
0019 {
0020     auto layout = new QVBoxLayout(this);
0021 
0022     mResult = new QPlainTextEdit(this);
0023     mResult->setReadOnly(true);
0024     layout->addWidget(mResult);
0025 
0026     auto button = new QPushButton(QStringLiteral("Create Database"), this);
0027     connect(button, &QPushButton::clicked, this, &ManageLocalDataBaseGui::slotDownloadFullDatabase);
0028     layout->addWidget(button);
0029 }
0030 
0031 ManageLocalDataBaseGui::~ManageLocalDataBaseGui() = default;
0032 
0033 void ManageLocalDataBaseGui::slotDownloadFullDatabase()
0034 {
0035     mDbManager->initialize();
0036 }
0037 
0038 int main(int argc, char **argv)
0039 {
0040     QApplication app(argc, argv);
0041     QStandardPaths::setTestModeEnabled(true);
0042     auto w = new ManageLocalDataBaseGui;
0043 
0044     w->show();
0045     app.exec();
0046     delete w;
0047     return 0;
0048 }
0049 
0050 #include "moc_managelocaldatabasegui.cpp"