swift
Loading...
Searching...
No Matches
downloadcomponent.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 2017 swift Project Community / Contributors
2// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3
5
6#ifndef SWIFT_GUI_COMPONENTS_DOWNLOADCOMPONENT_H
7#define SWIFT_GUI_COMPONENTS_DOWNLOADCOMPONENT_H
8
9#include <QFileDialog>
10#include <QFlags>
11#include <QNetworkReply>
12#include <QScopedPointer>
13#include <QWizard>
14
15#include "gui/loadindicator.h"
17#include "gui/swiftguiexport.h"
19
20namespace Ui
21{
22 class CDownloadComponent;
23}
25{
30 {
32
33 public:
42 Q_DECLARE_FLAGS(Mode, ModeFlag)
43
44
45 explicit CDownloadComponent(QWidget *parent = nullptr);
46
49
52
55
57 bool setDownloadDirectory(const QString &path);
58
60 bool triggerDownloadingOfFiles(int delayMs = -1);
61
63 bool isDownloading() const;
64
66 bool haveAllDownloadsCompleted() const;
67
69 Mode getMode() const;
70
72 void setMode(Mode mode);
73
75 void clear();
76
79
80 signals:
83
84 private:
85 static constexpr std::chrono::milliseconds OverlayMsgTimeout { 5000 };
89 swift::misc::network::CRemoteFile m_fileInProgress;
91 swift::misc::network::CRemoteFileList m_waitingForDownload;
92 QNetworkReply *m_reply = nullptr;
93
95 void selectDownloadDirectory();
96
98 bool triggerDownloadingOfNextFile();
99
101 bool triggerDownloadingOfFile(const swift::misc::network::CRemoteFile &remoteFile);
102
104 void downloadedFile(const swift::misc::CStatusMessage &status);
105
107 void lastFileDownloaded();
108
110 void startDownloadedExecutable();
111
113 bool existsDownloadDir() const;
114
116 void openDownloadDir();
117
119 void resetDownloadDir();
120
122 void showStartedFileMessage(const swift::misc::network::CRemoteFile &rf);
123
125 void showCompletedFileMessage(const swift::misc::network::CRemoteFile &rf);
126
128 void downloadProgress(qint64 bytesReceived, qint64 bytesTotal);
129
131 void showFileInfo();
132 };
133} // namespace swift::gui::components
134
135Q_DECLARE_METATYPE(swift::gui::components::CDownloadComponent::Mode)
137Q_DECLARE_OPERATORS_FOR_FLAGS(swift::gui::components::CDownloadComponent::Mode)
138
139#endif // SWIFT_GUI_COMPONENTS_DOWNLOADCOMPONENT_H
CLoadIndicatorEnabled(QWidget *usingWidget)
Ctor.
COverlayMessagesFrame(QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags())
Constructor.
@ ShutdownSwift
for installers, stop swift before running
bool triggerDownloadingOfFiles(int delayMs=-1)
Trigger downloading of the file.
bool setDownloadFile(const swift::misc::network::CRemoteFile &remoteFile)
Set file to be downloaded.
void allDownloadsCompleted()
All downloads have been completed.
bool haveAllDownloadsCompleted() const
Have all downloads completed?
CDownloadComponent(QWidget *parent=nullptr)
Default constructor.
bool setDownloadDirectory(const QString &path)
Set donwload directory.
bool isDownloading() const
Downloads in progress.
bool setDownloadFiles(const swift::misc::network::CRemoteFileList &remoteFiles)
Set files to be downloaded.
void cancelOngoingDownloads()
Cancel ongoing downloads.
Streamable status message, e.g.
Value object encapsulating a list of remote files.
High level reusable GUI components.
typedef Options
Q_OBJECTQ_OBJECT
#define SWIFT_GUI_EXPORT
Export a class or function from the library.