File indexing completed on 2024-05-19 05:05:55

0001 /***************************************************************************
0002  *   SPDX-License-Identifier: GPL-2.0-or-later
0003  *                                                                         *
0004  *   SPDX-FileCopyrightText: 2004-2019 Thomas Fischer <fischer@unix-ag.uni-kl.de>
0005  *                                                                         *
0006  *   This program is free software; you can redistribute it and/or modify  *
0007  *   it under the terms of the GNU General Public License as published by  *
0008  *   the Free Software Foundation; either version 2 of the License, or     *
0009  *   (at your option) any later version.                                   *
0010  *                                                                         *
0011  *   This program is distributed in the hope that it will be useful,       *
0012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0014  *   GNU General Public License for more details.                          *
0015  *                                                                         *
0016  *   You should have received a copy of the GNU General Public License     *
0017  *   along with this program; if not, see <https://www.gnu.org/licenses/>. *
0018  ***************************************************************************/
0019 
0020 #ifndef KBIBTEXTEST_H
0021 #define KBIBTEXTEST_H
0022 
0023 #include <QList>
0024 #include <QDialog>
0025 #include <QIcon>
0026 
0027 class OnlineSearchAbstract;
0028 class TestWidget;
0029 
0030 class KBibTeXTest : public QDialog
0031 {
0032     Q_OBJECT
0033 
0034 public:
0035     explicit KBibTeXTest(QWidget *parent = nullptr);
0036 
0037 public Q_SLOTS:
0038     void startOnlineSearchTests();
0039 
0040 private Q_SLOTS:
0041     void aboutToQuit();
0042     void onlineSearchStoppedSearch(int);
0043     void progress(int, int);
0044 
0045 private:
0046     enum class MessageStatus { Info, Ok, Error, Auth, Network };
0047 
0048     bool m_running;
0049     TestWidget *m_testWidget;
0050     bool m_isBusy;
0051 
0052     QList<OnlineSearchAbstract *> m_onlineSearchList;
0053     QList<OnlineSearchAbstract *>::ConstIterator m_currentOnlineSearch;
0054     int m_currentOnlineSearchNumFoundEntries;
0055 
0056     void addMessage(const QString &message, const MessageStatus messageStatus);
0057     void setBusy(bool isBusy);
0058 
0059     void processNextSearch();
0060 };
0061 
0062 #endif // KBIBTEXTEST_H