File indexing completed on 2025-01-19 03:53:48

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2009-11-14
0007  * Description : database migration dialog
0008  *
0009  * SPDX-FileCopyrightText: 2009-2010 by Holger Foerster <Hamsi2k at freenet dot de>
0010  * SPDX-FileCopyrightText: 2010-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #ifndef DIGIKAM_DB_MIGRATION_DLG_H
0017 #define DIGIKAM_DB_MIGRATION_DLG_H
0018 
0019 // QT includes
0020 
0021 #include <QThread>
0022 #include <QProgressBar>
0023 #include <QDialog>
0024 
0025 // Local includes
0026 
0027 #include "digikam_export.h"
0028 #include "dbsettingswidget.h"
0029 #include "coredbbackend.h"
0030 #include "coredbcopymanager.h"
0031 
0032 namespace Digikam
0033 {
0034 
0035 class DatabaseCopyThread : public QThread
0036 {
0037     Q_OBJECT
0038 
0039 public:
0040 
0041     explicit DatabaseCopyThread(QWidget* const parent);
0042     ~DatabaseCopyThread() override;
0043 
0044     void init(const DbEngineParameters& fromDatabaseSettingsWidget,
0045               const DbEngineParameters& toDatabaseSettingsWidget);
0046     void run() override;
0047 
0048 public:
0049 
0050     CoreDbCopyManager m_copyManager;
0051 
0052 private:
0053 
0054     class Private;
0055     Private* const d;
0056 };
0057 
0058 // --------------------------------------------------------------------
0059 
0060 class DIGIKAM_GUI_EXPORT DatabaseMigrationDialog : public QDialog
0061 {
0062     Q_OBJECT
0063 
0064 public:
0065 
0066     explicit DatabaseMigrationDialog(QWidget* const parent);
0067     ~DatabaseMigrationDialog() override;
0068 
0069 private Q_SLOTS:
0070 
0071     void slotHelp();
0072     void slotPerformCopy();
0073     void slotUnlockInputFields();
0074     void slotLockInputFields();
0075 
0076     void slotHandleFinish(int finishState, const QString& errorMsg);
0077     void slotHandleStepStarted(const QString& stepName);
0078     void slotHandleSmallStepStarted(int currValue, int maxValue);
0079 
0080 private:
0081 
0082     void setupMainArea();
0083     void dataInit();
0084 
0085 private:
0086 
0087     class Private;
0088     Private* const d;
0089 };
0090 
0091 } // namespace Digikam
0092 
0093 #endif // DIGIKAM_DB_MIGRATION_DLG_H