File indexing completed on 2024-10-06 12:23:26

0001 /*
0002     knewstuff3/ui/downloaddialog.cpp.
0003     SPDX-FileCopyrightText: 2005 Enrico Ros <eros.kde@email.it>
0004     SPDX-FileCopyrightText: 2005-2007 Josef Spillner <spillner@kde.org>
0005     SPDX-FileCopyrightText: 2007 Dirk Mueller <mueller@kde.org>
0006     SPDX-FileCopyrightText: 2007-2009 Jeremy Whiting <jpwhiting@kde.org>
0007     SPDX-FileCopyrightText: 2009-2010 Frederik Gladhorn <gladhorn@kde.org>
0008     SPDX-FileCopyrightText: 2010 Reza Fatahilah Shah <rshah0385@kireihana.com>
0009 
0010     SPDX-License-Identifier: LGPL-2.1-or-later
0011 */
0012 
0013 #ifndef KNEWSTUFF3_UI_DOWNLOADWIDGET_P_H
0014 #define KNEWSTUFF3_UI_DOWNLOADWIDGET_P_H
0015 
0016 #include <QListView>
0017 #include <QTimer>
0018 
0019 #include "core/itemsmodel.h"
0020 
0021 #include "ui/entrydetailsdialog_p.h"
0022 #include "ui/itemsviewbasedelegate_p.h"
0023 
0024 #include "ui_downloadwidget.h"
0025 
0026 namespace KNS3
0027 {
0028 class DownloadWidget;
0029 
0030 class DownloadWidgetPrivate : public QObject
0031 {
0032     Q_OBJECT
0033 public:
0034     DownloadWidget *q;
0035     EntryDetails *details;
0036 
0037     // The engine that does all the work
0038     KNSCore::Engine *engine;
0039     Ui::DownloadWidget ui;
0040     // Model to show the entries
0041     KNSCore::ItemsModel *model;
0042     // Timeout for message display
0043     QTimer *messageTimer;
0044 
0045     ItemsViewBaseDelegate *delegate;
0046 
0047     QString searchTerm;
0048     QSet<KNSCore::EntryInternal> changedEntries;
0049 
0050     QSet<QString> categories;
0051     QSet<QString> providers;
0052 
0053     QString titleText;
0054     QString m_configFile;
0055     bool dialogMode;
0056 
0057     explicit DownloadWidgetPrivate(DownloadWidget *qq);
0058     ~DownloadWidgetPrivate() override;
0059 
0060     void init(const QString &configFile);
0061     void slotShowMessage(const QString &msg);
0062     void displayMessage(const QString &msg, KTitleWidget::MessageType type, int timeOutMs = 0);
0063 
0064     void slotProvidersLoaded();
0065     void slotEntriesLoaded(const KNSCore::EntryInternal::List &entries);
0066     void slotEntryEvent(const KNSCore::EntryInternal &entry, KNSCore::EntryInternal::EntryEvent event);
0067 
0068     void slotShowDetails(const KNSCore::EntryInternal &entry);
0069     void slotShowOverview();
0070 
0071     void slotPayloadFailed(const KNSCore::EntryInternal &entry);
0072     void slotPayloadLoaded(QUrl url);
0073 
0074     void slotResetMessage();
0075     void slotNetworkTimeout();
0076     void sortingChanged();
0077     void slotSearchTextChanged();
0078     void slotUpdateSearch();
0079     void slotCategoryChanged(int);
0080 
0081     void slotInfo(QString provider, QString server, QString version);
0082     void slotError(const QString &message);
0083     void scrollbarValueChanged(int value);
0084 
0085     void slotUpload();
0086     void slotListViewListMode();
0087     void slotListViewIconMode();
0088     void setListViewMode(QListView::ViewMode mode);
0089 };
0090 
0091 }
0092 
0093 #endif