From 901d93aabe48986861a9d828ea6cfe32efc59c52 Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Wed, 27 Sep 2023 14:53:11 -0400 Subject: [PATCH] 2023-09-27 Fred Gleason * Fixed bugs in 'RDSoundPanel' affecting drag-and-drop operation. Signed-off-by: Fred Gleason --- ChangeLog | 2 ++ lib/rdbutton_panel.cpp | 8 +++++--- lib/rdpanel_button.cpp | 4 ++-- lib/rdsound_panel.cpp | 9 ++++----- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 41b9da6b..1c198949 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24391,3 +24391,5 @@ 2023-09-27 Fred Gleason * Fixed a bug in 'RDSoundPanel' where clicking a non-configured button in Setup mode would fail to open the 'Edit Button' dialog. +2023-09-27 Fred Gleason + * Fixed bugs in 'RDSoundPanel' affecting drag-and-drop operation. diff --git a/lib/rdbutton_panel.cpp b/lib/rdbutton_panel.cpp index 0682f3a9..cf6b3599 100644 --- a/lib/rdbutton_panel.cpp +++ b/lib/rdbutton_panel.cpp @@ -31,9 +31,11 @@ RDButtonPanel::RDButtonPanel(RDAirPlayConf::PanelType type,QWidget *parent) panel_button[i][j]= new RDPanelButton(i,j,rda->station(),rda->panelConf()->flashPanel(), parent); - if(rda->station()->enableDragdrop()&& - (!rda->station()->enforcePanelSetup())) { - panel_button[i][j]->setAcceptDrops(true); + if(rda->station()->enableDragdrop()) { + panel_button[i][j]->setAllowDrags(true); + if(!rda->station()->enforcePanelSetup()) { + panel_button[i][j]->setAcceptDrops(true); + } } panel_button[i][j]->setGeometry((15+PANEL_BUTTON_SIZE_X)*j, (15+PANEL_BUTTON_SIZE_Y)*i, diff --git a/lib/rdpanel_button.cpp b/lib/rdpanel_button.cpp index 36d14335..4d0b8126 100644 --- a/lib/rdpanel_button.cpp +++ b/lib/rdpanel_button.cpp @@ -2,7 +2,7 @@ // // The SoundPanel Button for RDAirPlay. // -// (C) Copyright 2002-2021 Fred Gleason +// (C) Copyright 2002-2023 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -383,7 +383,7 @@ void RDPanelButton::mousePressEvent(QMouseEvent *e) void RDPanelButton::mouseMoveEvent(QMouseEvent *e) { button_move_count--; - if(button_move_count==0) { + if(button_allow_drags&&(button_move_count==0)) { QPushButton::mouseReleaseEvent(e); QDrag *drag=new QDrag(this); RDCartDrag *cd=new RDCartDrag(button_cart,button_text,button_color); diff --git a/lib/rdsound_panel.cpp b/lib/rdsound_panel.cpp index f177d6a7..b1970186 100644 --- a/lib/rdsound_panel.cpp +++ b/lib/rdsound_panel.cpp @@ -704,9 +704,10 @@ void RDSoundPanel::setupClickedData() panel_playmode_box->setDisabled(true); } if(rda->station()->enableDragdrop()&&(rda->station()->enforcePanelSetup())) { - for(int i=0;isetAcceptDrops(panel_setup_mode); + for(QMap >::const_iterator it= + panel_panels.begin();it!=panel_panels.end();it++) { + for(int i=0;isetAcceptDrops(panel_setup_mode); } } } @@ -716,8 +717,6 @@ void RDSoundPanel::setupClickedData() void RDSoundPanel::buttonMapperData(int grid_pos) { - printf("buttonMapperData(%d)\n",grid_pos); - RDPanelButton *button=GetCurrentPanel()-> panelButton(grid_pos/PANEL_MAX_BUTTON_COLUMNS, grid_pos%PANEL_MAX_BUTTON_COLUMNS);