File indexing completed on 2024-05-19 05:16:11

0001 /*
0002     SPDX-FileCopyrightText: 2008 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "kmigratorbase.h"
0010 #include "migratorbase.h"
0011 #include <QDialog>
0012 #include <QEventLoopLocker>
0013 
0014 class QLabel;
0015 class QListWidget;
0016 class QProgressBar;
0017 class QDialogButtonBox;
0018 
0019 class InfoDialog : public QDialog
0020 {
0021     Q_OBJECT
0022 public:
0023     InfoDialog(bool closeWhenDone = true);
0024     ~InfoDialog() override;
0025 
0026     static bool hasError()
0027     {
0028         return mError;
0029     }
0030 
0031 public Q_SLOTS:
0032     void message(KMigratorBase::MessageType type, const QString &msg);
0033     void message(MigratorBase::MessageType type, const QString &msg);
0034 
0035     void migratorAdded();
0036     void migratorDone();
0037 
0038     void status(const QString &msg);
0039 
0040     void progress(int value);
0041     void progress(int min, int max, int value);
0042 
0043 private:
0044     bool hasChange() const
0045     {
0046         return mChange;
0047     }
0048 
0049     void scrollBarMoved(int value);
0050     QEventLoopLocker eventLoopLocker;
0051     QDialogButtonBox *const mButtonBox;
0052     QListWidget *const mList;
0053     QLabel *const mStatusLabel;
0054     QProgressBar *const mProgressBar;
0055     int mMigratorCount = 0;
0056     static bool mError;
0057     bool mChange = false;
0058     const bool mCloseWhenDone;
0059     bool mAutoScrollList = true;
0060 };