diff --git a/src/deviceinfowidget.cpp b/src/deviceinfowidget.cpp index f7f597a..0e6f37f 100644 --- a/src/deviceinfowidget.cpp +++ b/src/deviceinfowidget.cpp @@ -42,6 +42,7 @@ #include #include #include +#include DeviceInfoWidget::DeviceInfoWidget(iDescriptorDevice *device, QWidget *parent) : QWidget(parent), m_device(device) @@ -156,9 +157,9 @@ DeviceInfoWidget::DeviceInfoWidget(iDescriptorDevice *device, QWidget *parent) m_lightningIconLabel = new ZIconLabel( QIcon(":/resources/icons/MdiLightningBolt.png"), " Charging", this); - m_batteryWidget = - new BatteryWidget(device->deviceInfo.batteryInfo.currentBatteryLevel, - device->deviceInfo.batteryInfo.isCharging, this); + m_batteryWidget = new BatteryWidget( + qBound(1, device->deviceInfo.batteryInfo.currentBatteryLevel, 100), + device->deviceInfo.batteryInfo.isCharging, this); // Add the widgets to the new layout chargingLayout->addWidget(m_chargingStatusLabel); @@ -375,8 +376,9 @@ void DeviceInfoWidget::updateBatteryInfo() ? "USB" : "USB-C")); - m_batteryWidget->updateContext(d.batteryInfo.isCharging, - d.batteryInfo.currentBatteryLevel); + m_batteryWidget->updateContext( + d.batteryInfo.isCharging, + qBound(1, d.batteryInfo.currentBatteryLevel, 100)); } void DeviceInfoWidget::updateChargingStatusIcon() diff --git a/src/diagnosewidget.cpp b/src/diagnosewidget.cpp index 2841a2b..3215a06 100644 --- a/src/diagnosewidget.cpp +++ b/src/diagnosewidget.cpp @@ -38,10 +38,8 @@ DependencyItem::DependencyItem(const QString &name, const QString &description, QWidget *parent) : QWidget(parent), m_name(name) { - setFixedHeight(80); - QHBoxLayout *layout = new QHBoxLayout(this); - layout->setContentsMargins(10, 5, 10, 5); + layout->setContentsMargins(0, 0, 0, 0); // Left side - info QVBoxLayout *infoLayout = new QVBoxLayout(); @@ -130,7 +128,7 @@ void DependencyItem::setInstalling(bool installing) void DependencyItem::onInstallClicked() { emit installRequested(m_name); } DiagnoseWidget::DiagnoseWidget(QWidget *parent) - : QFrame(parent), m_isExpanded(false) + : QWidget(parent), m_isExpanded(false) { setupUI(); @@ -138,8 +136,7 @@ DiagnoseWidget::DiagnoseWidget(QWidget *parent) // Add dependency items addDependencyItem("Apple Mobile Device Support", "Required for iOS device communication"); - addDependencyItem("WinFsp", - "Required for filesystem operations and mounting"); + addDependencyItem("WinFsp", "Required for mounting your device as a drive"); #endif #ifdef __linux__ @@ -155,16 +152,10 @@ DiagnoseWidget::DiagnoseWidget(QWidget *parent) void DiagnoseWidget::setupUI() { setObjectName("diagnoseWidget"); - setContentsMargins(20, 10, 10, 0); - setStyleSheet("QFrame#diagnoseWidget { " - " background-color: palette(window); " // Set background - // from the theme - " border-top-right-radius: 10px; " - " border-top-left-radius: 10px; " - " border-top: 1px solid #ccc; " - "}"); + setContentsMargins(20, 2, 20, 0); + setAutoFillBackground(true); m_mainLayout = new QVBoxLayout(this); - m_mainLayout->setSpacing(10); + m_mainLayout->setSpacing(5); // Title and summary QLabel *titleLabel = new QLabel("Dependency Check"); @@ -189,11 +180,8 @@ void DiagnoseWidget::setupUI() &DiagnoseWidget::onToggleExpand); m_itemsWidget = new QWidget(); - // m_itemsWidget->setSizePolicy(QSizePolicy::Expanding, - // QSizePolicy::Preferred); - m_itemsWidget->setFixedHeight(400); m_itemsLayout = new QVBoxLayout(m_itemsWidget); - m_itemsLayout->setSpacing(5); + m_itemsLayout->setSpacing(10); m_itemsLayout->addStretch(); m_itemsWidget->setVisible(m_isExpanded); @@ -565,4 +553,6 @@ void DiagnoseWidget::onToggleExpand() m_isExpanded = !m_isExpanded; m_itemsWidget->setVisible(m_isExpanded); m_toggleButton->setText(m_isExpanded ? "▲" : "▼"); + m_itemsWidget->updateGeometry(); + adjustSize(); } diff --git a/src/diagnosewidget.h b/src/diagnosewidget.h index f6d346f..006987d 100644 --- a/src/diagnosewidget.h +++ b/src/diagnosewidget.h @@ -20,7 +20,6 @@ #ifndef DIAGNOSE_WIDGET_H #define DIAGNOSE_WIDGET_H -#include #include #include #include @@ -28,6 +27,7 @@ #include #include #include +#include #include "qprocessindicator.h" @@ -57,7 +57,7 @@ private: QProcessIndicator *m_processIndicator; }; -class DiagnoseWidget : public QFrame +class DiagnoseWidget : public QWidget { Q_OBJECT diff --git a/src/exportprogressdialog.cpp b/src/exportprogressdialog.cpp index 01a02ef..b740223 100644 --- a/src/exportprogressdialog.cpp +++ b/src/exportprogressdialog.cpp @@ -133,19 +133,19 @@ void ExportProgressDialog::setupUI() buttonLayout->addStretch(); m_cancelButton = new QPushButton("Cancel"); - m_cancelButton->setFixedSize(80, 32); + m_cancelButton->setMaximumWidth(m_cancelButton->sizeHint().width()); connect(m_cancelButton, &QPushButton::clicked, this, &ExportProgressDialog::onCancelClicked); buttonLayout->addWidget(m_cancelButton); m_closeButton = new QPushButton("Close"); - m_closeButton->setFixedSize(80, 32); + m_closeButton->setMaximumWidth(m_closeButton->sizeHint().width()); m_closeButton->setVisible(false); connect(m_closeButton, &QPushButton::clicked, this, &QDialog::accept); buttonLayout->addWidget(m_closeButton); m_openDirButton = new QPushButton("Show Files"); - m_openDirButton->setFixedSize(80, 32); + m_openDirButton->setMaximumWidth(m_openDirButton->sizeHint().width()); m_openDirButton->setVisible(false); connect(m_openDirButton, &QPushButton::clicked, this, &ExportProgressDialog::onOpenDirectoryClicked); @@ -311,6 +311,8 @@ void ExportProgressDialog::onExportFinished(const QUuid &jobId, m_jobCompleted = true; m_transferRateTimer->stop(); + m_destinationPath = summary.destinationPath; + m_progressBar->setValue(100); m_currentFileLabel->clear(); @@ -376,8 +378,10 @@ void ExportProgressDialog::onCancelClicked() void ExportProgressDialog::onOpenDirectoryClicked() { + qDebug() << "Opening export directory:" << m_destinationPath; if (!m_destinationPath.isEmpty()) { QDesktopServices::openUrl(QUrl::fromLocalFile(m_destinationPath)); + QTimer::singleShot(100, this, &QDialog::accept); } } diff --git a/src/welcomewidget.cpp b/src/welcomewidget.cpp index ef22c9b..7bca341 100644 --- a/src/welcomewidget.cpp +++ b/src/welcomewidget.cpp @@ -45,14 +45,12 @@ void WelcomeWidget::setupUI() m_titleLabel = createStyledLabel("Welcome to iDescriptor", 28, true); m_titleLabel->setAlignment(Qt::AlignCenter); m_mainLayout->addWidget(m_titleLabel); - m_mainLayout->addSpacing(12); // Subtitle - m_subtitleLabel = createStyledLabel("Open-Source & Free", 16, false); + m_subtitleLabel = createStyledLabel("Open-Source & Free", 10, false); m_subtitleLabel->setAlignment(Qt::AlignCenter); QPalette palette = m_subtitleLabel->palette(); m_mainLayout->addWidget(m_subtitleLabel); - m_mainLayout->addSpacing(10); m_imageLabel = new ResponsiveQLabel(); m_imageLabel->setPixmap(QPixmap(":/resources/connect.png")); @@ -66,7 +64,7 @@ void WelcomeWidget::setupUI() m_mainLayout->addSpacing(10); m_instructionLabel = createStyledLabel( - "Please connect an iOS device to get started", 14, false); + "Please connect an iDevice to get started", 14, false); m_instructionLabel->setAlignment(Qt::AlignCenter); m_mainLayout->addWidget(m_instructionLabel); m_mainLayout->addSpacing(10); @@ -74,7 +72,8 @@ void WelcomeWidget::setupUI() // GitHub link m_githubLabel = createStyledLabel("Found an issue? Report it on GitHub", 12, false); - m_githubLabel->setAlignment(Qt::AlignCenter); + m_githubLabel->setWordWrap(false); + m_githubLabel->setMaximumWidth(m_imageLabel->sizeHint().width()); m_githubLabel->setCursor(Qt::PointingHandCursor); connect(m_githubLabel, &ZLabel::clicked, this, []() { QDesktopServices::openUrl( @@ -90,7 +89,7 @@ void WelcomeWidget::setupUI() // Connect click functionality using installEventFilter m_githubLabel->installEventFilter(this); - m_mainLayout->addWidget(m_githubLabel); + m_mainLayout->addWidget(m_githubLabel, 0, Qt::AlignCenter); // no additional deps needed on macOS #ifndef __APPLE__