mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-04-21 16:38:54 +02:00
Merge branch 'deltecent-rdlibrary-macro'
This commit is contained in:
commit
767654a751
@ -17981,3 +17981,6 @@
|
||||
* Tweaked parameters of the Systemd service file to provide for
|
||||
more response startup of the 'rivendell' service after a system
|
||||
restart.
|
||||
2018-11-05 Patrick Linstruth <patrick@deltecent.com>
|
||||
* Update macro editor in rdlibrary(1) to fix display of
|
||||
"--- End of cart ---" item and improve buttons and permissions.
|
||||
|
@ -67,6 +67,7 @@ MacroCart::MacroCart(RDCart *cart,QWidget *parent)
|
||||
rdcart_add_button->setGeometry(10,0,80,50);
|
||||
rdcart_add_button->setFont(button_font);
|
||||
rdcart_add_button->setText(tr("Add"));
|
||||
rdcart_add_button->setEnabled(false);
|
||||
connect(rdcart_add_button,SIGNAL(clicked()),this,SLOT(addMacroData()));
|
||||
|
||||
//
|
||||
@ -76,6 +77,7 @@ MacroCart::MacroCart(RDCart *cart,QWidget *parent)
|
||||
rdcart_delete_button->setGeometry(10,60,80,50);
|
||||
rdcart_delete_button->setFont(button_font);
|
||||
rdcart_delete_button->setText(tr("Delete"));
|
||||
rdcart_delete_button->setEnabled(false);
|
||||
connect(rdcart_delete_button,SIGNAL(clicked()),this,SLOT(deleteMacroData()));
|
||||
|
||||
//
|
||||
@ -85,6 +87,7 @@ MacroCart::MacroCart(RDCart *cart,QWidget *parent)
|
||||
rdcart_copy_button->setGeometry(10,120,80,50);
|
||||
rdcart_copy_button->setFont(button_font);
|
||||
rdcart_copy_button->setText(tr("Copy"));
|
||||
rdcart_copy_button->setEnabled(false);
|
||||
connect(rdcart_copy_button,SIGNAL(clicked()),this,SLOT(copyMacroData()));
|
||||
|
||||
//
|
||||
@ -95,6 +98,7 @@ MacroCart::MacroCart(RDCart *cart,QWidget *parent)
|
||||
paste_macro_button->setFont(button_font);
|
||||
paste_macro_button->setText(tr("Paste"));
|
||||
paste_macro_button->setDisabled(true);
|
||||
paste_macro_button->setEnabled(false);
|
||||
connect(paste_macro_button,SIGNAL(clicked()),this,SLOT(pasteMacroData()));
|
||||
|
||||
//
|
||||
@ -107,11 +111,15 @@ MacroCart::MacroCart(RDCart *cart,QWidget *parent)
|
||||
rdcart_macro_list->setGeometry(100,0,430,sizeHint().height());
|
||||
rdcart_macro_list->setAllColumnsShowFocus(true);
|
||||
rdcart_macro_list->setItemMargin(5);
|
||||
rdcart_macro_list->setSorting(0);
|
||||
rdcart_macro_list->setSorting(-1);
|
||||
connect(rdcart_macro_list,
|
||||
SIGNAL(doubleClicked(Q3ListViewItem *,const QPoint &,int)),
|
||||
SIGNAL(selectionChanged(Q3ListViewItem *)),
|
||||
this,
|
||||
SLOT(doubleClickedData(Q3ListViewItem *,const QPoint &,int)));
|
||||
SLOT(selectionChangedData(Q3ListViewItem *)));
|
||||
connect(rdcart_macro_list,
|
||||
SIGNAL(doubleClicked(Q3ListViewItem *)),
|
||||
this,
|
||||
SLOT(doubleClickedData(Q3ListViewItem *)));
|
||||
|
||||
rdcart_macro_list->addColumn(tr("Line"));
|
||||
rdcart_macro_list->setColumnAlignment(0,Qt::AlignHCenter);
|
||||
@ -132,6 +140,7 @@ MacroCart::MacroCart(RDCart *cart,QWidget *parent)
|
||||
rdcart_edit_button->setGeometry(550,0,80,50);
|
||||
rdcart_edit_button->setFont(button_font);
|
||||
rdcart_edit_button->setText(tr("Edit"));
|
||||
rdcart_edit_button->setEnabled(false);
|
||||
connect(rdcart_edit_button,SIGNAL(clicked()),this,SLOT(editMacroData()));
|
||||
|
||||
//
|
||||
@ -141,6 +150,7 @@ MacroCart::MacroCart(RDCart *cart,QWidget *parent)
|
||||
rdcart_runline_button->setGeometry(550,120,80,50);
|
||||
rdcart_runline_button->setFont(button_font);
|
||||
rdcart_runline_button->setText(tr("Run\nLine"));
|
||||
rdcart_runline_button->setEnabled(false);
|
||||
connect(rdcart_runline_button,SIGNAL(clicked()),
|
||||
this,SLOT(runLineMacroData()));
|
||||
|
||||
@ -153,14 +163,6 @@ MacroCart::MacroCart(RDCart *cart,QWidget *parent)
|
||||
rdcart_runcart_button->setText(tr("Run\nCart"));
|
||||
connect(rdcart_runcart_button,SIGNAL(clicked()),
|
||||
this,SLOT(runCartMacroData()));
|
||||
|
||||
//
|
||||
// Set Control Permissions
|
||||
//
|
||||
rdcart_add_button->setEnabled(rdcart_allow_modification);
|
||||
rdcart_delete_button->setEnabled(rdcart_allow_modification);
|
||||
rdcart_copy_button->setEnabled(rdcart_allow_modification);
|
||||
rdcart_edit_button->setEnabled(rdcart_allow_modification);
|
||||
}
|
||||
|
||||
|
||||
@ -194,10 +196,7 @@ void MacroCart::addMacroData()
|
||||
RDMacro cmd;
|
||||
unsigned line;
|
||||
|
||||
if(item==NULL) {
|
||||
return;
|
||||
}
|
||||
if(item->text(0).isEmpty()) {
|
||||
if(item==NULL||item->text(0).isEmpty()) {
|
||||
line=rdcart_events->size();
|
||||
}
|
||||
else {
|
||||
@ -232,7 +231,7 @@ void MacroCart::copyMacroData()
|
||||
return;
|
||||
}
|
||||
rdcart_clipboard=*rdcart_events->command(item->text(0).toUInt()-1);
|
||||
paste_macro_button->setEnabled(true);
|
||||
paste_macro_button->setEnabled(rdcart_allow_modification);
|
||||
}
|
||||
|
||||
|
||||
@ -290,11 +289,30 @@ void MacroCart::runCartMacroData()
|
||||
}
|
||||
|
||||
|
||||
void MacroCart::doubleClickedData(Q3ListViewItem *,const QPoint &,int)
|
||||
void MacroCart::selectionChangedData(Q3ListViewItem *item)
|
||||
{
|
||||
rdcart_add_button->setEnabled(rdcart_allow_modification);
|
||||
if(!rdcart_clipboard.isNull()) {
|
||||
paste_macro_button->setEnabled(rdcart_allow_modification);
|
||||
}
|
||||
if(!item->text(0).isEmpty()) {
|
||||
rdcart_runline_button->setEnabled(rdcart_allow_modification);
|
||||
rdcart_delete_button->setEnabled(rdcart_allow_modification);
|
||||
rdcart_copy_button->setEnabled(rdcart_allow_modification);
|
||||
rdcart_edit_button->setEnabled(rdcart_allow_modification);
|
||||
}
|
||||
else {
|
||||
rdcart_runline_button->setEnabled(false);
|
||||
rdcart_delete_button->setEnabled(false);
|
||||
rdcart_copy_button->setEnabled(false);
|
||||
rdcart_edit_button->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MacroCart::doubleClickedData(Q3ListViewItem *item)
|
||||
{
|
||||
if(rdcart_allow_modification) {
|
||||
Q3ListViewItem *item=rdcart_macro_list->selectedItem();
|
||||
|
||||
if((item==NULL)||(item->text(0).isEmpty())) {
|
||||
addMacroData();
|
||||
}
|
||||
@ -307,15 +325,36 @@ void MacroCart::doubleClickedData(Q3ListViewItem *,const QPoint &,int)
|
||||
|
||||
void MacroCart::RefreshList()
|
||||
{
|
||||
Q3ListViewItem *item;
|
||||
Q3ListViewItem *item=NULL;
|
||||
Q3ListViewItem *selected;
|
||||
QString line;
|
||||
|
||||
item=new Q3ListViewItem(rdcart_macro_list);
|
||||
item->setText(1,tr("--- End of cart ---"));
|
||||
selected=rdcart_macro_list->selectedItem();
|
||||
if(selected!=NULL) {
|
||||
line=selected->text(0);
|
||||
}
|
||||
|
||||
rdcart_macro_list->clear();
|
||||
for(int i=0;i<rdcart_events->size();i++) {
|
||||
item=new Q3ListViewItem(rdcart_macro_list);
|
||||
item->setText(0,QString().sprintf("%03d",i+1));
|
||||
item->setText(1,rdcart_events->command(i)->toString());
|
||||
}
|
||||
SortLines();
|
||||
if(item!=NULL) {
|
||||
item=new Q3ListViewItem(rdcart_macro_list,item);
|
||||
}
|
||||
else {
|
||||
item=new Q3ListViewItem(rdcart_macro_list);
|
||||
}
|
||||
item->setText(1,tr("--- End of Cart ---"));
|
||||
|
||||
if (!line.isEmpty()) {
|
||||
selected=rdcart_macro_list->findItem(line,0);
|
||||
if(selected!=NULL) {
|
||||
rdcart_macro_list->setSelected(selected,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -326,6 +365,13 @@ void MacroCart::RefreshLine(Q3ListViewItem *item)
|
||||
}
|
||||
|
||||
|
||||
void MacroCart::SortLines()
|
||||
{
|
||||
rdcart_macro_list->setSorting(0);
|
||||
rdcart_macro_list->sort();
|
||||
rdcart_macro_list->setSorting(-1);
|
||||
}
|
||||
|
||||
void MacroCart::AddLine(unsigned line,RDMacro *cmd)
|
||||
{
|
||||
unsigned curr_line;
|
||||
@ -341,8 +387,9 @@ void MacroCart::AddLine(unsigned line,RDMacro *cmd)
|
||||
rdcart_events->insert(line,cmd);
|
||||
item=new Q3ListViewItem(rdcart_macro_list);
|
||||
item->setText(0,QString().sprintf("%03u",line+1));
|
||||
RefreshLine(item);
|
||||
item->setText(1,rdcart_events->command(line)->toString());
|
||||
rdcart_macro_list->setSelected(item,true);
|
||||
RefreshList();
|
||||
}
|
||||
|
||||
|
||||
|
@ -60,7 +60,8 @@ class MacroCart : public QWidget
|
||||
void editMacroData();
|
||||
void runLineMacroData();
|
||||
void runCartMacroData();
|
||||
void doubleClickedData(Q3ListViewItem *,const QPoint &,int);
|
||||
void selectionChangedData(Q3ListViewItem *);
|
||||
void doubleClickedData(Q3ListViewItem *);
|
||||
|
||||
private:
|
||||
void RefreshList();
|
||||
@ -68,6 +69,7 @@ class MacroCart : public QWidget
|
||||
void AddLine(unsigned line,RDMacro *cmd);
|
||||
void DeleteLine(Q3ListViewItem *item);
|
||||
void UpdateLength();
|
||||
void SortLines();
|
||||
RDCart *rdcart_cart;
|
||||
Q3ListView *rdcart_macro_list;
|
||||
QLabel *rdcart_macro_list_label;
|
||||
|
@ -1140,7 +1140,7 @@ vozík</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>--- End of cart ---</source>
|
||||
<translation>--- Konec vozíku ---</translation>
|
||||
<translation type="obsolete">--- Konec vozíku ---</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Line</source>
|
||||
@ -1150,6 +1150,10 @@ vozík</translation>
|
||||
<source>Command</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>--- End of Cart ---</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MainWidget</name>
|
||||
|
@ -1128,7 +1128,7 @@ starten</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>--- End of cart ---</source>
|
||||
<translation>--- Ende des Carts ---</translation>
|
||||
<translation type="obsolete">--- Ende des Carts ---</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Line</source>
|
||||
@ -1138,6 +1138,10 @@ starten</translation>
|
||||
<source>Command</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>--- End of Cart ---</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MainWidget</name>
|
||||
|
@ -1137,7 +1137,7 @@ Cartucho</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>--- End of cart ---</source>
|
||||
<translation>--- Fin del cartucho ---</translation>
|
||||
<translation type="obsolete">--- Fin del cartucho ---</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Line</source>
|
||||
@ -1147,6 +1147,10 @@ Cartucho</translation>
|
||||
<source>Command</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>--- End of Cart ---</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MainWidget</name>
|
||||
|
@ -938,10 +938,6 @@ Line</source>
|
||||
Cart</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>--- End of cart ---</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Line</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -950,6 +946,10 @@ Cart</source>
|
||||
<source>Command</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>--- End of Cart ---</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MainWidget</name>
|
||||
|
@ -1124,7 +1124,7 @@ korg</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>--- End of cart ---</source>
|
||||
<translation>--- Slutten på korga ---</translation>
|
||||
<translation type="obsolete">--- Slutten på korga ---</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Line</source>
|
||||
@ -1134,6 +1134,10 @@ korg</translation>
|
||||
<source>Command</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>--- End of Cart ---</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MainWidget</name>
|
||||
|
@ -1124,7 +1124,7 @@ korg</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>--- End of cart ---</source>
|
||||
<translation>--- Slutten på korga ---</translation>
|
||||
<translation type="obsolete">--- Slutten på korga ---</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Line</source>
|
||||
@ -1134,6 +1134,10 @@ korg</translation>
|
||||
<source>Command</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>--- End of Cart ---</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MainWidget</name>
|
||||
|
@ -1126,7 +1126,7 @@ Cartão</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>--- End of cart ---</source>
|
||||
<translation>-- Fim do Cartão --</translation>
|
||||
<translation type="obsolete">-- Fim do Cartão --</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Line</source>
|
||||
@ -1136,6 +1136,10 @@ Cartão</translation>
|
||||
<source>Command</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>--- End of Cart ---</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MainWidget</name>
|
||||
|
Loading…
x
Reference in New Issue
Block a user