mirror of
https://github.com/iDescriptor/iDescriptor.git
synced 2026-06-22 03:45:51 +08:00
6fe6245be9
- Removed TabWidget - Added DeviceSidebarWidget and DeviceSidebarItem classes for managing device navigation in a sidebar format. - Removed the obsolete DeviceTabWidget class and its associated files. - Updated MainWindow to integrate DeviceManagerWidget for device management. - Implemented SettingsManager and SettingsWidget for user-configurable settings. - Enhanced the main application to support settings loading and saving. - Updated UI to accommodate new settings and device management features.
80 lines
2.2 KiB
C++
80 lines
2.2 KiB
C++
#ifndef DEVDISKIMAGESWIDGET_H
|
|
#define DEVDISKIMAGESWIDGET_H
|
|
|
|
#include "iDescriptor.h"
|
|
#include <QMap>
|
|
#include <QWidget>
|
|
|
|
class QNetworkAccessManager;
|
|
class QNetworkReply;
|
|
class QListWidget;
|
|
class QStackedWidget;
|
|
class QLabel;
|
|
class QLineEdit;
|
|
class QPushButton;
|
|
class QProgressBar;
|
|
class QComboBox;
|
|
|
|
class DevDiskImagesWidget : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit DevDiskImagesWidget(iDescriptorDevice *device,
|
|
QWidget *parent = nullptr);
|
|
|
|
private slots:
|
|
void fetchImages();
|
|
void onDownloadButtonClicked();
|
|
void onDownloadProgress(qint64 bytesReceived, qint64 bytesTotal);
|
|
void onFileDownloadFinished();
|
|
void changeDownloadDirectory();
|
|
void updateDeviceList();
|
|
void onMountButtonClicked();
|
|
void onImageListFetched(bool success,
|
|
const QString &errorMessage = QString());
|
|
|
|
private:
|
|
void setupUi();
|
|
void displayImages();
|
|
void startDownload(const QString &version);
|
|
void mountImage(const QString &version);
|
|
void onDeviceSelectionChanged(int index);
|
|
void closeEvent(QCloseEvent *event) override;
|
|
void checkMountedImage();
|
|
|
|
struct DownloadItem {
|
|
QNetworkReply *dmgReply = nullptr;
|
|
QNetworkReply *sigReply = nullptr;
|
|
QProgressBar *progressBar = nullptr;
|
|
QPushButton *downloadButton = nullptr;
|
|
QString version;
|
|
qint64 totalSize = 0;
|
|
qint64 totalReceived = 0;
|
|
qint64 dmgReceived = 0;
|
|
qint64 sigReceived = 0;
|
|
};
|
|
|
|
char *m_mounted_sig = NULL;
|
|
uint64_t m_mounted_sig_len = 0;
|
|
|
|
QStackedWidget *m_stackedWidget;
|
|
QListWidget *m_imageListWidget;
|
|
QLabel *m_statusLabel;
|
|
QLabel *m_initialStatusLabel;
|
|
QWidget *m_errorWidget;
|
|
QLineEdit *m_downloadPathEdit;
|
|
QComboBox *m_deviceComboBox;
|
|
QPushButton *m_mountButton;
|
|
QPushButton *m_check_mountedButton;
|
|
|
|
iDescriptorDevice *m_currentDevice;
|
|
QStringList m_compatibleVersions;
|
|
QStringList m_otherVersions;
|
|
|
|
QMap<QString, QPair<QString, QString>>
|
|
m_availableImages; // version -> {dmg_path, sig_path}
|
|
QMap<QNetworkReply *, DownloadItem *> m_activeDownloads;
|
|
};
|
|
|
|
#endif // DEVDISKIMAGESWIDGET_H
|