From 5d0c85e257128879738f25089a41de92f5be5aca Mon Sep 17 00:00:00 2001 From: uncor3 Date: Mon, 22 Sep 2025 17:22:52 -0700 Subject: [PATCH] bugfix removeDevice and style changes --- icons/video-x-generic.png | Bin 0 -> 8351 bytes resources.qrc | 1 + src/devicemanagerwidget.cpp | 13 ++++++++----- src/devicesidebarwidget.cpp | 21 +++++++++++++++++++-- src/devicesidebarwidget.h | 2 +- src/gallerywidget.cpp | 32 +++++++++++++++++++++----------- src/mainwindow.cpp | 7 ++++--- src/mainwindow.ui | 15 +++++++++++++++ src/mediapreviewdialog.cpp | 28 +++++++++++++++++++++++++++- src/mediapreviewdialog.h | 1 + src/photomodel.cpp | 8 ++++++-- 11 files changed, 103 insertions(+), 25 deletions(-) create mode 100644 icons/video-x-generic.png diff --git a/icons/video-x-generic.png b/icons/video-x-generic.png new file mode 100644 index 0000000000000000000000000000000000000000..e8c0116ad6a8f9d2179967a025a990e963f1834d GIT binary patch literal 8351 zcmdUUcT`i&*7qC|Ac!=*8k8m)z{e6m1f(M>5~>wY3Ti>_tAMd~K`<}JVnmIFj_RO5wv-fZBedmPvaiI;{ zHvj;HNJd9b0l)*RJOIZBi#h++Kd=z+G&<)EfZ*o!7Xits;;^y6(VFB$BJBY<_`wG@ zAsB$b+WNa4;r(Z63F{L7uG_-;?tjy)&#;;2|IxcdVE;+)1l!jiBlxcK`M)Jx%6)!- zg)K@4l$DSN|EeR91IYY$yRwoJlKC%=TrOOH=D#?uZwB-K)gcS;z;1>KfXoBZ(Zgr_ zQ`x=z1s-RwD@-e%!ipU|bL;t|zi&LY{+m~>=+fuU+XcfqDBYBs&`F&0_)TN7f=3E_UoC9=BzYy;(Qs-T0zhF?TIp6q6CuZ)?wjggxbh;DKgeb z?&+8E2jx){Do9`pXESmH1Y~W^E!wd&dY(;YY~L1Q`Nobg<{{sN-F(koIb)7iL>_o zFu>CG)GSYu?iq8wesAPgtBxb-K4h^79wg39ChuW09(r}BI^!xyI)gPr#bZ`%#1l0! z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git a/src/devicemanagerwidget.cpp b/src/devicemanagerwidget.cpp index 52567c3..a3ebd89 100644 --- a/src/devicemanagerwidget.cpp +++ b/src/devicemanagerwidget.cpp @@ -147,14 +147,17 @@ void DeviceManagerWidget::removeDevice(const std::string &uuid) { qDebug() << "Removing:" << QString::fromStdString(uuid); - std::pair &d = - m_deviceWidgets[uuid]; + DeviceMenuWidget *deviceWidget = m_deviceWidgets[uuid].first; + DeviceSidebarItem *sidebarItem = m_deviceWidgets[uuid].second; - if (d.first != nullptr && d.second != nullptr) { + if (deviceWidget != nullptr && sidebarItem != nullptr) { + qDebug() << "Device exists removing:" << QString::fromStdString(uuid); // TODO: cleanups m_deviceWidgets.remove(uuid); - delete d.first; - delete d.second; + m_stackedWidget->removeWidget(deviceWidget); + m_sidebar->removeFromSidebar(sidebarItem); + deviceWidget->deleteLater(); + // delete d.second; if (m_deviceWidgets.count() > 0) { setCurrentDevice(m_deviceWidgets.firstKey()); diff --git a/src/devicesidebarwidget.cpp b/src/devicesidebarwidget.cpp index 3039dce..79e28aa 100644 --- a/src/devicesidebarwidget.cpp +++ b/src/devicesidebarwidget.cpp @@ -33,13 +33,14 @@ void DeviceSidebarItem::setupUI() QVBoxLayout *headerLayout = new QVBoxLayout(m_headerWidget); headerLayout->setContentsMargins(0, 0, 0, 0); headerLayout->setSpacing(2); - m_headerWidget->setStyleSheet("ClickableWidget { }"); + m_headerWidget->setStyleSheet( + "ClickableWidget { background-color: #ff0000ff; }"); connect(m_headerWidget, &ClickableWidget::clicked, this, [this]() { emit deviceSelected(m_uuid); }); // Device name label m_deviceLabel = new QLabel(m_deviceName); - m_deviceLabel->setStyleSheet("QLabel { font-weight: bold; color: #333; }"); + m_deviceLabel->setStyleSheet("QLabel { font-weight: bold; }"); m_deviceLabel->setWordWrap(true); headerLayout->addWidget(m_deviceLabel); @@ -96,6 +97,7 @@ void DeviceSidebarItem::setupUI() " text-align: center; " " border-radius: 3px; " " font-size: 11px; " + " color: #212529; " "} " "QPushButton:checked { " " background-color: #0d6efd; " @@ -225,6 +227,11 @@ DeviceSidebarWidget::DeviceSidebarWidget(QWidget *parent) : QWidget(parent) m_scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_scrollArea->setFrameStyle(QFrame::NoFrame); + // Make the scroll area and its viewport transparent + m_scrollArea->setStyleSheet( + "QScrollArea { background: transparent; border: none; }"); + m_scrollArea->viewport()->setStyleSheet("background: transparent;"); + // Create content widget m_contentWidget = new QWidget(); m_contentLayout = new QVBoxLayout(m_contentWidget); @@ -232,6 +239,9 @@ DeviceSidebarWidget::DeviceSidebarWidget(QWidget *parent) : QWidget(parent) m_contentLayout->setSpacing(10); m_contentLayout->addStretch(); // Push items to top + // Ensure the content widget is also transparent + m_contentWidget->setStyleSheet("background: transparent;"); + m_scrollArea->setWidget(m_contentWidget); mainLayout->addWidget(m_scrollArea); @@ -267,6 +277,13 @@ DeviceSidebarItem *DeviceSidebarWidget::addToSidebar(const QString &deviceName, return item; } +void DeviceSidebarWidget::removeFromSidebar(DeviceSidebarItem *item) +{ + m_deviceSidebarItems.removeAll(item); + m_contentLayout->removeWidget(item); + item->deleteLater(); +} + DevicePendingSidebarItem * DeviceSidebarWidget::addPendingToSidebar(const QString &uuid) { diff --git a/src/devicesidebarwidget.h b/src/devicesidebarwidget.h index dd89365..d1f8d8b 100644 --- a/src/devicesidebarwidget.h +++ b/src/devicesidebarwidget.h @@ -83,7 +83,7 @@ public: DeviceSidebarItem *addToSidebar(const QString &deviceName, const std::string &uuid); - + void removeFromSidebar(DeviceSidebarItem *item); DevicePendingSidebarItem *addPendingToSidebar(const QString &uuid); void removePendingFromSidebar(DevicePendingSidebarItem *item); void setDeviceNavigationSection(int deviceIndex, const QString §ion); diff --git a/src/gallerywidget.cpp b/src/gallerywidget.cpp index 8cc02a3..78a716e 100644 --- a/src/gallerywidget.cpp +++ b/src/gallerywidget.cpp @@ -84,8 +84,8 @@ GalleryWidget::GalleryWidget(iDescriptorDevice *device, QWidget *parent) void GalleryWidget::setupUI() { m_mainLayout = new QVBoxLayout(this); - m_mainLayout->setContentsMargins(10, 10, 10, 10); - m_mainLayout->setSpacing(10); + m_mainLayout->setContentsMargins(0, 0, 0, 0); + // m_mainLayout->setSpacing(10); // Setup controls at the top setupControlsLayout(); @@ -99,7 +99,21 @@ void GalleryWidget::setupUI() m_listView->setIconSize(QSize(120, 120)); m_listView->setSpacing(10); m_listView->setSelectionMode(QAbstractItemView::ExtendedSelection); + m_listView->setUniformItemSizes(true); + // m_listView->setGridSize(QSize(140, 300)); // Fixed grid size + // m_listView->setIconSize(QSize(120, 300)); + m_listView->setStyleSheet( + "QListView { " + " border-top: 1px solid #c1c1c1ff; " // Gray border for the ListView + " background-color: transparent; " // Optional: background + " padding: 0px;" + "} " + "QListView::item { " + " width: 150px; " + " height: 150px; " + " margin: 2px; " + "}"); // Create and set model m_model = new PhotoModel(m_device, this); m_listView->setModel(m_model); @@ -142,11 +156,12 @@ void GalleryWidget::setupUI() void GalleryWidget::setupControlsLayout() { m_controlsLayout = new QHBoxLayout(); - m_controlsLayout->setSpacing(15); + m_controlsLayout->setSpacing(5); + m_controlsLayout->setContentsMargins(7, 7, 7, 7); // Sort order combo box QLabel *sortLabel = new QLabel("Sort:"); - sortLabel->setStyleSheet("font-weight: bold; color: #555;"); + sortLabel->setStyleSheet("font-weight: bold;"); m_sortComboBox = new QComboBox(); m_sortComboBox->addItem("Newest First", static_cast(PhotoModel::NewestFirst)); @@ -155,9 +170,7 @@ void GalleryWidget::setupControlsLayout() m_sortComboBox->setCurrentIndex(0); // Default to Newest First m_sortComboBox->setStyleSheet("QComboBox { " " padding: 5px 10px; " - " border: 1px solid #ccc; " " border-radius: 4px; " - " background-color: white; " " min-width: 100px; " "} " "QComboBox:hover { " @@ -174,7 +187,7 @@ void GalleryWidget::setupControlsLayout() // Filter combo box QLabel *filterLabel = new QLabel("Filter:"); - filterLabel->setStyleSheet("font-weight: bold; color: #555;"); + filterLabel->setStyleSheet("font-weight: bold;"); m_filterComboBox = new QComboBox(); m_filterComboBox->addItem("All Media", static_cast(PhotoModel::All)); m_filterComboBox->addItem("Images Only", @@ -246,10 +259,7 @@ void GalleryWidget::setupControlsLayout() QWidget *controlsWidget = new QWidget(); controlsWidget->setLayout(m_controlsLayout); controlsWidget->setStyleSheet("QWidget { " - " background-color: #f8f9fa; " - " border: 1px solid #dee2e6; " - " border-radius: 6px; " - " padding: 10px; " + " padding: 2px; " "}"); m_mainLayout->addWidget(controlsWidget); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 03270ad..119366d 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -116,6 +116,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); + setWindowTitle("iDescriptor"); m_deviceManager = new DeviceManagerWidget(this); ui->stackedWidget->insertWidget(1, m_deviceManager); @@ -124,7 +125,7 @@ MainWindow::MainWindow(QWidget *parent) // settings button QPushButton *settingsButton = new QPushButton(); - settingsButton->setIcon(QIcon::fromTheme("settings")); + settingsButton->setIcon(QIcon::fromTheme("preferences-system")); settingsButton->setToolTip("Settings"); settingsButton->setFlat(true); settingsButton->setCursor(Qt::PointingHandCursor); @@ -140,13 +141,13 @@ MainWindow::MainWindow(QWidget *parent) settingsDialog.setLayout(layout); settingsDialog.exec(); }); - ui->centralwidget->layout()->addWidget(settingsButton); - + // ui->centralwidget->layout()->addWidget(settingsButton); ui->mainTabWidget->widget(1)->layout()->addWidget(new AppsWidget(this)); ui->mainTabWidget->widget(2)->layout()->addWidget(new ToolboxWidget(this)); ui->mainTabWidget->widget(3)->layout()->addWidget( new JailbrokenWidget(this)); + ui->statusbar->addPermanentWidget(settingsButton); irecv_error_t res_recovery = irecv_device_event_subscribe(&context, handleCallbackRecovery, nullptr); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 8064bbe..b9d20d0 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -15,6 +15,21 @@ + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + diff --git a/src/mediapreviewdialog.cpp b/src/mediapreviewdialog.cpp index a8affa2..1c0052b 100644 --- a/src/mediapreviewdialog.cpp +++ b/src/mediapreviewdialog.cpp @@ -47,9 +47,13 @@ MediaPreviewDialog::MediaPreviewDialog(iDescriptorDevice *device, Qt::WindowCloseButtonHint); // Use full screen size - const QSize screenSize = QApplication::primaryScreen()->availableSize(); + const QSize screenSize = QApplication::primaryScreen()->size(); resize(screenSize); + // Add window transparency + setAttribute(Qt::WA_TranslucentBackground); + setWindowOpacity(0.99); + setupUI(); loadMedia(); } @@ -702,4 +706,26 @@ void MediaPreviewDialog::onVolumeChanged(int value) qDebug() << "Volume changed to:" << value << "%" << "(" << volume << ")"; } +} + +bool MediaPreviewDialog::event(QEvent *event) +{ + // catch platform Close (Cmd+W on macOS) + if (event->type() == QEvent::ShortcutOverride) { + if (auto *ke = dynamic_cast(event)) { + const Qt::KeyboardModifiers mods = ke->modifiers(); + if (ke->key() == Qt::Key_W && + (mods & (Qt::MetaModifier | Qt::ControlModifier))) { + ke->accept(); + close(); + return true; + } + if (ke->key() == Qt::Key_Escape) { + ke->accept(); + close(); + return true; + } + } + } + return QDialog::event(event); } \ No newline at end of file diff --git a/src/mediapreviewdialog.h b/src/mediapreviewdialog.h index c4a3ae9..e7436b2 100644 --- a/src/mediapreviewdialog.h +++ b/src/mediapreviewdialog.h @@ -40,6 +40,7 @@ protected: void wheelEvent(QWheelEvent *event) override; void keyPressEvent(QKeyEvent *event) override; void resizeEvent(QResizeEvent *event) override; + bool event(QEvent *event) override; // handle ShortcutOverride private slots: void onImageLoaded(); diff --git a/src/photomodel.cpp b/src/photomodel.cpp index bd0e038..b2b1c74 100644 --- a/src/photomodel.cpp +++ b/src/photomodel.cpp @@ -144,7 +144,8 @@ QVariant PhotoModel::data(const QModelIndex &index, int role) const if (info.fileName.endsWith(".MOV", Qt::CaseInsensitive) || info.fileName.endsWith(".MP4", Qt::CaseInsensitive) || info.fileName.endsWith(".M4V", Qt::CaseInsensitive)) { - return QIcon::fromTheme("video-x-generic"); + // return QIcon::fromTheme("video-x-generic"); + return QIcon(":/icons/video-x-generic.png"); } else { return QIcon::fromTheme("image-x-generic"); } @@ -161,7 +162,8 @@ QVariant PhotoModel::data(const QModelIndex &index, int role) const if (info.fileName.endsWith(".MOV", Qt::CaseInsensitive) || info.fileName.endsWith(".MP4", Qt::CaseInsensitive) || info.fileName.endsWith(".M4V", Qt::CaseInsensitive)) { - return QIcon::fromTheme("video-x-generic"); + // return QIcon::fromTheme("video-x-generic"); + return QIcon(":/icons/video-x-generic.png"); } else { return QIcon::fromTheme("image-x-generic"); } @@ -399,6 +401,8 @@ QPixmap PhotoModel::loadImage(iDescriptorDevice *device, void PhotoModel::populatePhotoPaths() { + // TODO:beginResetModel called on PhotoModel(0x600002d12a40) without calling + // endResetModel first beginResetModel(); m_allPhotos.clear(); m_photos.clear();