From 8abcc89174892fbc2d50d583175d380474467be0 Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Fri, 17 Aug 2018 12:29:41 -0400 Subject: [PATCH] 2018-08-17 Fred Gleason * Fixed problems with dragged carts setting the correct color when dropped on a sound panel button. --- ChangeLog | 3 + lib/rdbutton_dialog.cpp | 10 +- lib/rdbutton_dialog.h | 4 +- lib/rdcartdrag.cpp | 5 +- lib/rdcartdrag.h | 3 +- lib/rdemptycart.cpp | 2 +- lib/rdslotbox.cpp | 4 +- lib/rdsound_panel.cpp | 306 +++++++++++++++++----------------- lib/rdsound_panel.h | 4 +- rdairplay/loglinebox.cpp | 3 +- rdlogmanager/lib_listview.cpp | 3 +- 11 files changed, 179 insertions(+), 168 deletions(-) diff --git a/ChangeLog b/ChangeLog index 440d178e..531a6457 100644 --- a/ChangeLog +++ b/ChangeLog @@ -17477,3 +17477,6 @@ 2018-08-17 Fred Gleason * Fixed a bug in the Cart Picker dialog that caused corruption with UTF-8 strings. +2018-08-17 Fred Gleason + * Fixed problems with dragged carts setting the correct color + when dropped on a sound panel button. diff --git a/lib/rdbutton_dialog.cpp b/lib/rdbutton_dialog.cpp index 31053384..4993605d 100644 --- a/lib/rdbutton_dialog.cpp +++ b/lib/rdbutton_dialog.cpp @@ -1,8 +1,8 @@ // rdbutton_dialog.cpp // -// Event Editor for RDAirPlay +// Button Editor for SoundPanel // -// (C) Copyright 2002-2004,2016 Fred Gleason +// (C) Copyright 2002-2018 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 @@ -32,8 +32,10 @@ RDButtonDialog::RDButtonDialog(QString station_name, const QString &label_template, RDCartDialog *cart_dialog,const QString &svcname, QWidget *parent) - : QDialog(parent,"",true) + : QDialog(parent) { + setModal(true); + // // Fix the Window Size // @@ -179,7 +181,7 @@ void RDButtonDialog::setCartData() void RDButtonDialog::clearCartData() { edit_cart=0; - edit_color=backgroundColor(); + edit_color=Qt::lightGray; edit_color_button->setPalette(QPalette(edit_color,backgroundColor())); edit_label_edit->setText(""); edit_cart_edit->setText(""); diff --git a/lib/rdbutton_dialog.h b/lib/rdbutton_dialog.h index 15494510..98544a55 100644 --- a/lib/rdbutton_dialog.h +++ b/lib/rdbutton_dialog.h @@ -1,8 +1,8 @@ // rdbutton_dialog.h // -// Button Editor for the SoundPanel in RDAirPlay. +// Button Editor for SoundPanel // -// (C) Copyright 2002-2003,2016 Fred Gleason +// (C) Copyright 2002-2018 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 diff --git a/lib/rdcartdrag.cpp b/lib/rdcartdrag.cpp index 7237a05c..43989f43 100644 --- a/lib/rdcartdrag.cpp +++ b/lib/rdcartdrag.cpp @@ -34,10 +34,11 @@ #include "../icons/rml5.xpm" #include "../icons/trashcan-16x16.xpm" -RDCartDrag::RDCartDrag(unsigned cartnum,const QPixmap *icon,QWidget *src) +RDCartDrag::RDCartDrag(unsigned cartnum,const QPixmap *icon,const QColor &color, + QWidget *src) : Q3StoredDrag(RDMIMETYPE_CART,src) { - SetData(cartnum,QColor(),QString()); + SetData(cartnum,color,QString()); if(icon==NULL) { RDCart *cart=new RDCart(cartnum); switch(cart->type()) { diff --git a/lib/rdcartdrag.h b/lib/rdcartdrag.h index a36a9e8c..e3af02af 100644 --- a/lib/rdcartdrag.h +++ b/lib/rdcartdrag.h @@ -32,7 +32,8 @@ class RDCartDrag : public Q3StoredDrag { public: - RDCartDrag(unsigned cartnum,const QPixmap *icon,QWidget *src=0); + RDCartDrag(unsigned cartnum,const QPixmap *icon,const QColor &color, + QWidget *src=0); RDCartDrag(unsigned cartnum,const QString &title,const QColor &color, QWidget *src=0); static bool canDecode(QMimeSource *e); diff --git a/lib/rdemptycart.cpp b/lib/rdemptycart.cpp index b06e63ea..e82814ce 100644 --- a/lib/rdemptycart.cpp +++ b/lib/rdemptycart.cpp @@ -59,6 +59,6 @@ QSizePolicy RDEmptyCart::sizePolicy() const void RDEmptyCart::mousePressEvent(QMouseEvent *e) { QWidget::mousePressEvent(e); - RDCartDrag *d=new RDCartDrag(0,"",QColor(),this); + RDCartDrag *d=new RDCartDrag(0,"",Qt::lightGray,this); d->dragCopy(); } diff --git a/lib/rdslotbox.cpp b/lib/rdslotbox.cpp index f4c4468a..1e2744fa 100644 --- a/lib/rdslotbox.cpp +++ b/lib/rdslotbox.cpp @@ -522,7 +522,9 @@ void RDSlotBox::mousePressEvent(QMouseEvent *e) if((line_logline!=NULL)&&(line_mode==RDSlotOptions::CartDeckMode)&& line_allow_drags) { RDCartDrag *d=new RDCartDrag(line_logline->cartNumber(), - line_icon_label->pixmap(),this); + line_icon_label->pixmap(), + line_group_label->palette(). + color(QColorGroup::Foreground),this); d->dragCopy(); } } diff --git a/lib/rdsound_panel.cpp b/lib/rdsound_panel.cpp index 0095aad9..d30cbea5 100644 --- a/lib/rdsound_panel.cpp +++ b/lib/rdsound_panel.cpp @@ -2,7 +2,7 @@ // // The sound panel widget for RDAirPlay // -// (C) Copyright 2002-2016-2018 Fred Gleason +// (C) Copyright 2002-2018 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 @@ -426,25 +426,25 @@ void RDSoundPanel::setActionMode(RDAirPlayConf::ActionMode mode) return; } switch(mode) { - case RDAirPlayConf::CopyFrom: - mode=RDAirPlayConf::CopyFrom; - break; + case RDAirPlayConf::CopyFrom: + mode=RDAirPlayConf::CopyFrom; + break; - case RDAirPlayConf::CopyTo: - mode=RDAirPlayConf::CopyTo; - break; + case RDAirPlayConf::CopyTo: + mode=RDAirPlayConf::CopyTo; + break; - case RDAirPlayConf::AddTo: - mode=RDAirPlayConf::AddTo; - break; + case RDAirPlayConf::AddTo: + mode=RDAirPlayConf::AddTo; + break; - case RDAirPlayConf::DeleteFrom: - mode=RDAirPlayConf::DeleteFrom; - break; + case RDAirPlayConf::DeleteFrom: + mode=RDAirPlayConf::DeleteFrom; + break; - default: - mode=RDAirPlayConf::Normal; - break; + default: + mode=RDAirPlayConf::Normal; + break; } if(mode!=panel_action_mode) { panel_action_mode=mode; @@ -702,85 +702,85 @@ void RDSoundPanel::buttonMapperData(int id) unsigned cartnum; switch(panel_action_mode) { - case RDAirPlayConf::CopyFrom: - if((cartnum=panel_buttons[PanelOffset(panel_type,panel_number)]-> - panelButton(row,col)->cart())>0) { - emit selectClicked(cartnum,0,0); - } - break; + case RDAirPlayConf::CopyFrom: + if((cartnum=panel_buttons[PanelOffset(panel_type,panel_number)]-> + panelButton(row,col)->cart())>0) { + emit selectClicked(cartnum,0,0); + } + break; - case RDAirPlayConf::CopyTo: - if(panel_buttons[PanelOffset(panel_type,panel_number)]-> - panelButton(row,col)->playDeck()==NULL - && ((panel_type==RDAirPlayConf::UserPanel) || - panel_config_panels)) { - emit selectClicked(0,row,col); - } - break; + case RDAirPlayConf::CopyTo: + if(panel_buttons[PanelOffset(panel_type,panel_number)]-> + panelButton(row,col)->playDeck()==NULL + && ((panel_type==RDAirPlayConf::UserPanel) || + panel_config_panels)) { + emit selectClicked(0,row,col); + } + break; - case RDAirPlayConf::AddTo: - if(panel_buttons[PanelOffset(panel_type,panel_number)]-> - panelButton(row,col)->playDeck()==NULL - && ((panel_type==RDAirPlayConf::UserPanel) || - panel_config_panels)) { - emit selectClicked(0,row,col); - } - break; + case RDAirPlayConf::AddTo: + if(panel_buttons[PanelOffset(panel_type,panel_number)]-> + panelButton(row,col)->playDeck()==NULL + && ((panel_type==RDAirPlayConf::UserPanel) || + panel_config_panels)) { + emit selectClicked(0,row,col); + } + break; - case RDAirPlayConf::DeleteFrom: - if(panel_buttons[PanelOffset(panel_type,panel_number)]-> - panelButton(row,col)->playDeck()==NULL - && ((panel_type==RDAirPlayConf::UserPanel) || - panel_config_panels)) { - emit selectClicked(0,row,col); - } - break; + case RDAirPlayConf::DeleteFrom: + if(panel_buttons[PanelOffset(panel_type,panel_number)]-> + panelButton(row,col)->playDeck()==NULL + && ((panel_type==RDAirPlayConf::UserPanel) || + panel_config_panels)) { + emit selectClicked(0,row,col); + } + break; - default: - if(panel_setup_mode) { - if((panel_type==RDAirPlayConf::StationPanel)&& - (!panel_config_panels)) { - ClearReset(); - return; - } - if(panel_button_dialog-> - exec(panel_buttons[PanelOffset(panel_type,panel_number)]-> - panelButton(row,col),panel_playmode_box->currentItem()==1, - rda->user()->name(),rda->user()->password()) - ==0) { - SaveButton(panel_type,panel_number,row,col); - } + default: + if(panel_setup_mode) { + if((panel_type==RDAirPlayConf::StationPanel)&& + (!panel_config_panels)) { + ClearReset(); + return; + } + if(panel_button_dialog-> + exec(panel_buttons[PanelOffset(panel_type,panel_number)]-> + panelButton(row,col),panel_playmode_box->currentItem()==1, + rda->user()->name(),rda->user()->password()) + ==0) { + SaveButton(panel_type,panel_number,row,col); + } + } + else { + RDPanelButton *button= + panel_buttons[PanelOffset(panel_type,panel_number)]-> + panelButton(row,col); + RDPlayDeck *deck=button->playDeck(); + if(panel_reset_mode) { + StopButton(panel_type,panel_number,row,col); + } + else { + if(deck==NULL) { + PlayButton(panel_type,panel_number,row,col, + RDLogLine::StartManual, + panel_playmode_box->currentItem()==1); } else { - RDPanelButton *button= - panel_buttons[PanelOffset(panel_type,panel_number)]-> - panelButton(row,col); - RDPlayDeck *deck=button->playDeck(); - if(panel_reset_mode) { - StopButton(panel_type,panel_number,row,col); - } - else { - if(deck==NULL) { - PlayButton(panel_type,panel_number,row,col, - RDLogLine::StartManual, - panel_playmode_box->currentItem()==1); + if(panel_pause_enabled) { + if(deck->state()!=RDPlayDeck::Paused) { + PauseButton(panel_type,panel_number,row,col); } else { - if(panel_pause_enabled) { - if(deck->state()!=RDPlayDeck::Paused) { - PauseButton(panel_type,panel_number,row,col); - } - else { - PlayButton(panel_type,panel_number,row,col, - RDLogLine::StartManual,button->hookMode()); - } - } - else { - StopButton(panel_type,panel_number,row,col); - } + PlayButton(panel_type,panel_number,row,col, + RDLogLine::StartManual,button->hookMode()); } } + else { + StopButton(panel_type,panel_number,row,col); + } } + } + } } ClearReset(); } @@ -789,21 +789,21 @@ void RDSoundPanel::buttonMapperData(int id) void RDSoundPanel::stateChangedData(int id,RDPlayDeck::State state) { switch(state) { - case RDPlayDeck::Playing: - Playing(id); - break; + case RDPlayDeck::Playing: + Playing(id); + break; - case RDPlayDeck::Stopped: - case RDPlayDeck::Finished: - Stopped(id); - break; + case RDPlayDeck::Stopped: + case RDPlayDeck::Finished: + Stopped(id); + break; - case RDPlayDeck::Paused: - Paused(id); - break; + case RDPlayDeck::Paused: + Paused(id); + break; - default: - break; + default: + break; } } @@ -817,13 +817,13 @@ void RDSoundPanel::hookEndData(int id) RDPlayDeck *deck=button->playDeck(); if(deck!=NULL) { switch(deck->state()) { - case RDPlayDeck::Playing: - case RDPlayDeck::Paused: - StopButton(id); - break; + case RDPlayDeck::Playing: + case RDPlayDeck::Paused: + StopButton(id); + break; - default: - break; + default: + break; } } } @@ -954,16 +954,16 @@ void RDSoundPanel::PlayButton(RDAirPlayConf::PanelType type,int panel, button->setPauseWhenFinished(false); } switch(cart->type()) { - case RDCart::Audio: - PlayAudio(button,cart,hookmode,mport); - break; + case RDCart::Audio: + PlayAudio(button,cart,hookmode,mport); + break; - case RDCart::Macro: - PlayMacro(button,cart); - break; + case RDCart::Macro: + PlayMacro(button,cart); + break; - default: - break; + default: + break; } delete cart; } @@ -1124,17 +1124,17 @@ void RDSoundPanel::StopButton(RDAirPlayConf::PanelType type,int panel, setPauseWhenFinished(false); } switch(deck->state()) { - case RDPlayDeck::Playing: - deck->stop(fade_out,RD_FADE_DEPTH); - break; + case RDPlayDeck::Playing: + deck->stop(fade_out,RD_FADE_DEPTH); + break; - case RDPlayDeck::Paused: - deck->clear(); - break; + case RDPlayDeck::Paused: + deck->clear(); + break; - default: - deck->clear(); - break; + default: + deck->clear(); + break; } } } @@ -1167,16 +1167,16 @@ void RDSoundPanel::StopButton(RDPlayDeck *deck) { if(deck!=NULL) { switch(deck->state()) { - case RDPlayDeck::Playing: - deck->stop(); - break; + case RDPlayDeck::Playing: + deck->stop(); + break; - case RDPlayDeck::Paused: - deck->clear(); - break; + case RDPlayDeck::Paused: + deck->clear(); + break; - default: - break; + default: + break; } } } @@ -1231,15 +1231,15 @@ void RDSoundPanel::LoadPanel(RDAirPlayConf::PanelType type,int panel) int offset=0; switch(type) { - case RDAirPlayConf::UserPanel: - owner=rda->user()->name(); - offset=panel_station_panels+panel; - break; + case RDAirPlayConf::UserPanel: + owner=rda->user()->name(); + offset=panel_station_panels+panel; + break; - case RDAirPlayConf::StationPanel: - owner=rda->station()->name(); - offset=panel; - break; + case RDAirPlayConf::StationPanel: + owner=rda->station()->name(); + offset=panel; + break; } QString sql=QString("select ")+panel_tablename+".ROW_NO,"+ @@ -1326,15 +1326,15 @@ void RDSoundPanel::SaveButton(RDAirPlayConf::PanelType type, int offset=0; switch(type) { - case RDAirPlayConf::UserPanel: - owner=rda->user()->name(); - offset=panel_station_panels+panel; - break; + case RDAirPlayConf::UserPanel: + owner=rda->user()->name(); + offset=panel_station_panels+panel; + break; - case RDAirPlayConf::StationPanel: - owner=rda->station()->name(); - offset=panel; - break; + case RDAirPlayConf::StationPanel: + owner=rda->station()->name(); + offset=panel; + break; } // @@ -1399,13 +1399,13 @@ void RDSoundPanel::SaveButton(RDAirPlayConf::PanelType type, int RDSoundPanel::PanelOffset(RDAirPlayConf::PanelType type,int panel) { switch(type) { - case RDAirPlayConf::StationPanel: - return panel; - break; + case RDAirPlayConf::StationPanel: + return panel; + break; - case RDAirPlayConf::UserPanel: - return panel_station_panels+panel; - break; + case RDAirPlayConf::UserPanel: + return panel_station_panels+panel; + break; } return 0; } @@ -1680,11 +1680,11 @@ QString RDSoundPanel::PanelTag(int index) QString RDSoundPanel::PanelOwner(RDAirPlayConf::PanelType type) { switch(type) { - case RDAirPlayConf::StationPanel: - return rda->station()->name(); + case RDAirPlayConf::StationPanel: + return rda->station()->name(); - case RDAirPlayConf::UserPanel: - return rda->user()->name(); + case RDAirPlayConf::UserPanel: + return rda->user()->name(); } return QString(); } diff --git a/lib/rdsound_panel.h b/lib/rdsound_panel.h index a2bb01f2..707dc502 100644 --- a/lib/rdsound_panel.h +++ b/lib/rdsound_panel.h @@ -1,8 +1,8 @@ // rdsound_panel.h // -// The sound panel widget for RDAirPlay +// The sound panel widget // -// (C) Copyright 2002-2004,2016-2018 Fred Gleason +// (C) Copyright 2002-2018 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 diff --git a/rdairplay/loglinebox.cpp b/rdairplay/loglinebox.cpp index e5ad084f..d29fa859 100644 --- a/rdairplay/loglinebox.cpp +++ b/rdairplay/loglinebox.cpp @@ -794,7 +794,8 @@ void LogLineBox::mouseMoveEvent(QMouseEvent *e) if(line_allow_drags&&(line_logline!=NULL)) { RDCartDrag *d= new RDCartDrag(line_logline->cartNumber(),line_icon_label->pixmap(), - this); + line_group_label->palette(). + color(QColorGroup::Foreground),this); d->dragCopy(); } } diff --git a/rdlogmanager/lib_listview.cpp b/rdlogmanager/lib_listview.cpp index 5116843f..9e00c8f6 100644 --- a/rdlogmanager/lib_listview.cpp +++ b/rdlogmanager/lib_listview.cpp @@ -46,7 +46,8 @@ void LibListView::contentsMousePressEvent(QMouseEvent *e) if(item==NULL) { return; } - RDCartDrag *d=new RDCartDrag(item->text(1).toUInt(),item->pixmap(0),this); + RDCartDrag *d=new RDCartDrag(item->text(1).toUInt(),item->pixmap(0), + Qt::lightGray,this); d->dragCopy(); emit clicked(item);