mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-04-09 14:33:28 +02:00
2019-08-28 Fred Gleason <fredg@paravelsystems.com>
* Refactored the 'RDClock::insert()' method to calculate the ordinal position of the inserted event automatically. * Fixed a bug in rdlogmanager(1) that caused newly added events to be incorrectly sorted in the event list in the 'Edit Clock' dialog.
This commit is contained in:
parent
f83ea42a77
commit
c47b54720e
10
ChangeLog
10
ChangeLog
@ -19027,3 +19027,13 @@
|
||||
2019-08-28 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Added a statement to explicitly disable sorting of the
|
||||
events list in the 'List Clocks' dialog in rdlogmanager(1).
|
||||
2019-08-28 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Fixed a bug in rdlogmanager(1) that threw a segfault when
|
||||
adding an event to the end of the event list in the 'Edit
|
||||
Clock' dialog.
|
||||
2019-08-28 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Refactored the 'RDClock::insert()' method to calculate the
|
||||
ordinal position of the inserted event automatically.
|
||||
* Fixed a bug in rdlogmanager(1) that caused newly added events
|
||||
to be incorrectly sorted in the event list in the 'Edit Clock'
|
||||
dialog.
|
||||
|
@ -226,27 +226,42 @@ bool RDClock::save()
|
||||
}
|
||||
|
||||
|
||||
bool RDClock::insert(const QString &event_name,int line)
|
||||
int RDClock::insert(const QString &event_name,const QTime &time,int len)
|
||||
{
|
||||
int line=-1;
|
||||
|
||||
QString sql=QString("select NAME from EVENTS where ")+
|
||||
"NAME=\""+RDEscapeString(event_name)+"\"";
|
||||
RDSqlQuery *q=new RDSqlQuery(sql);
|
||||
if(!q->first()) {
|
||||
delete q;
|
||||
return false;
|
||||
return -1;
|
||||
}
|
||||
delete q;
|
||||
if(line>=size()) {
|
||||
clock_events.push_back(new RDEventLine(clock_station));
|
||||
if((clock_events.size()==0)||(time<clock_events.at(0)->startTime())) {
|
||||
line=0;
|
||||
clock_events.insert(0,new RDEventLine(clock_station));
|
||||
}
|
||||
else {
|
||||
clock_events.insert(line,new RDEventLine(clock_station));
|
||||
// QList<RDEventLine *>::iterator it=clock_events.begin()+line;
|
||||
//clock_events.insert(it,1,RDEventLine(clock_station));
|
||||
for(int i=0;i<clock_events.size()-1;i++) {
|
||||
if((time>clock_events.at(i)->startTime())&&
|
||||
(time<clock_events.at(i+1)->startTime())) {
|
||||
line=i+1;
|
||||
clock_events.insert(line,new RDEventLine(clock_station));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(line<0) {
|
||||
line=clock_events.size();
|
||||
clock_events.push_back(new RDEventLine(clock_station));
|
||||
}
|
||||
}
|
||||
clock_events.at(line)->setName(event_name);
|
||||
clock_events.at(line)->setStartTime(time);
|
||||
clock_events.at(line)->setLength(len);
|
||||
clock_events.at(line)->load();
|
||||
return true;
|
||||
|
||||
return line;
|
||||
}
|
||||
|
||||
|
||||
@ -254,35 +269,6 @@ void RDClock::remove(int line)
|
||||
{
|
||||
delete clock_events[line];
|
||||
clock_events.removeAt(line);
|
||||
// std::vector<RDEventLine>::iterator it=clock_events.begin()+line;
|
||||
// clock_events.erase(it,it+1);
|
||||
}
|
||||
|
||||
|
||||
void RDClock::move(int from_line,int to_line)
|
||||
{
|
||||
int src_offset=0;
|
||||
int dest_offset=1;
|
||||
RDEventLine *srcline;
|
||||
RDEventLine *destline;
|
||||
|
||||
if(to_line<from_line) {
|
||||
src_offset=1;
|
||||
dest_offset=0;
|
||||
}
|
||||
insert(clock_events.at(from_line)->name(),to_line+dest_offset);
|
||||
if((to_line+1)>=size()) {
|
||||
to_line=clock_events.size()-1;
|
||||
dest_offset=0;
|
||||
}
|
||||
|
||||
if(((destline=eventLine(to_line+dest_offset))==NULL)||
|
||||
(srcline=eventLine(from_line+src_offset))==NULL) {
|
||||
remove(to_line+dest_offset);
|
||||
return;
|
||||
}
|
||||
*destline=*srcline;
|
||||
remove(from_line+src_offset);
|
||||
}
|
||||
|
||||
|
||||
|
@ -48,9 +48,8 @@ class RDClock
|
||||
int size() const;
|
||||
bool load();
|
||||
bool save();
|
||||
bool insert(const QString &event_name,int line);
|
||||
int insert(const QString &event_name,const QTime &start,int len);
|
||||
void remove(int line);
|
||||
void move(int from_line,int to_line);
|
||||
bool validate(const QTime &start_time,int length,int except_line=-1);
|
||||
bool generateLog(int hour,const QString &logname,const QString &svc_name,
|
||||
QString *errors);
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// Edit Rivendell Log Clock
|
||||
//
|
||||
// (C) Copyright 2002-2018 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2002-2019 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// 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
|
||||
@ -289,26 +289,22 @@ void EditClock::addData()
|
||||
{
|
||||
int line=0;
|
||||
RDEventLine eventline(rda->station());
|
||||
|
||||
RDListViewItem *item=(RDListViewItem *)edit_clocks_list->selectedItem();
|
||||
if(item!=NULL) {
|
||||
if(item->text(4).isEmpty()) {
|
||||
line=edit_clock->size();
|
||||
}
|
||||
else {
|
||||
line=item->text(4).toInt();
|
||||
}
|
||||
}
|
||||
EditEventLine *edit_eventline=
|
||||
new EditEventLine(&eventline,edit_clock,-1,this);
|
||||
if(edit_eventline->exec()<0) {
|
||||
return;
|
||||
}
|
||||
delete edit_eventline;
|
||||
edit_clock->insert(eventline.name(),line);
|
||||
edit_clock->eventLine(line)->setStartTime(eventline.startTime());
|
||||
edit_clock->eventLine(line)->setLength(eventline.length());
|
||||
edit_clock->eventLine(line)->load();
|
||||
if(line<0) {
|
||||
line=edit_clock->size();
|
||||
}
|
||||
line=edit_clock->
|
||||
insert(eventline.name(),eventline.startTime(),eventline.length());
|
||||
if(line<0) {
|
||||
QMessageBox::warning(this,"RDLogManager - "+tr("Error"),
|
||||
tr("That event does not exist."));
|
||||
return;
|
||||
}
|
||||
edit_modified=true;
|
||||
RefreshList(line);
|
||||
}
|
||||
@ -367,10 +363,13 @@ void EditClock::cloneData()
|
||||
return;
|
||||
}
|
||||
delete edit_eventline;
|
||||
edit_clock->insert(eventline.name(),line);
|
||||
edit_clock->eventLine(line)->setStartTime(eventline.startTime());
|
||||
edit_clock->eventLine(line)->setLength(eventline.length());
|
||||
edit_clock->eventLine(line)->load();
|
||||
line=edit_clock->
|
||||
insert(eventline.name(),eventline.startTime(),eventline.length());
|
||||
if(line<0) {
|
||||
QMessageBox::warning(this,"RDLogManager - "+tr("Error"),
|
||||
tr("That event does not exist."));
|
||||
return;
|
||||
}
|
||||
edit_modified=true;
|
||||
RefreshList(line);
|
||||
}
|
||||
@ -526,8 +525,8 @@ void EditClock::doubleClickedData(Q3ListViewItem *item,const QPoint &,int)
|
||||
|
||||
void EditClock::colorData()
|
||||
{
|
||||
QColor color=QColorDialog::getColor(edit_color_button->backgroundColor(),
|
||||
this,"color_dialog");
|
||||
QColor color=
|
||||
QColorDialog::getColor(edit_color_button->backgroundColor(),this);
|
||||
if(color.isValid()) {
|
||||
edit_color_button->setPalette(QPalette(color,backgroundColor()));
|
||||
}
|
||||
@ -620,18 +619,10 @@ void EditClock::Save()
|
||||
void EditClock::RefreshList(int select_line)
|
||||
{
|
||||
UpdateClock();
|
||||
RDListViewItem *prev_item=(RDListViewItem *)edit_clocks_list->selectedItem();
|
||||
|
||||
if((prev_item!=NULL)&&(select_line>=0)) {
|
||||
select_line=prev_item->text(4).toInt();
|
||||
}
|
||||
RDListViewItem *item;
|
||||
RDEventLine *eventline;
|
||||
|
||||
edit_clocks_list->clear();
|
||||
item=new RDListViewItem(edit_clocks_list);
|
||||
item->setText(2,tr("--- End of clock ---"));
|
||||
item->setText(4,"-2");
|
||||
for(int i=edit_clock->size()-1;i>=0;i--) {
|
||||
if((eventline=edit_clock->eventLine(i))!=NULL) {
|
||||
item=new RDListViewItem(edit_clocks_list);
|
||||
|
@ -169,7 +169,7 @@ Chcete je uložit?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>--- End of clock ---</source>
|
||||
<translation>--- Konec hodin ---</translation>
|
||||
<translation type="obsolete">--- Konec hodin ---</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Invalid Code</source>
|
||||
@ -208,6 +208,14 @@ Chcete je uložit?</translation>
|
||||
<source>Are you sure you want to delete</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>That event does not exist.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>EditEvent</name>
|
||||
|
@ -169,7 +169,7 @@ Wollen Sie sie speichern?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>--- End of clock ---</source>
|
||||
<translation>--- Ende der Uhr ---</translation>
|
||||
<translation type="obsolete">--- Ende der Uhr ---</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Invalid Code</source>
|
||||
@ -208,6 +208,14 @@ Wollen Sie sie speichern?</translation>
|
||||
<source>Are you sure you want to delete</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>That event does not exist.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>EditEvent</name>
|
||||
|
@ -149,7 +149,7 @@ Do you want to save?</source>
|
||||
</message>
|
||||
<message>
|
||||
<source>--- End of clock ---</source>
|
||||
<translation>--- Fin de la torta ---</translation>
|
||||
<translation type="obsolete">--- Fin de la torta ---</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Invalid Code</source>
|
||||
@ -210,6 +210,14 @@ horario</translation>
|
||||
<source>Are you sure you want to delete</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>That event does not exist.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>EditEvent</name>
|
||||
|
@ -151,10 +151,6 @@ Do you want to save?</source>
|
||||
<source>Clock already exists! Overwrite?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>--- End of clock ---</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Invalid Code</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -192,6 +188,14 @@ Do you want to save?</source>
|
||||
<source>Are you sure you want to delete</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>That event does not exist.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>EditEvent</name>
|
||||
|
@ -170,7 +170,7 @@ Vil du lagra?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>--- End of clock ---</source>
|
||||
<translation>--- Slutt på klokka ---</translation>
|
||||
<translation type="obsolete">--- Slutt på klokka ---</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Invalid Code</source>
|
||||
@ -209,6 +209,14 @@ Vil du lagra?</translation>
|
||||
<source>Are you sure you want to delete</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>That event does not exist.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>EditEvent</name>
|
||||
|
@ -170,7 +170,7 @@ Vil du lagra?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>--- End of clock ---</source>
|
||||
<translation>--- Slutt på klokka ---</translation>
|
||||
<translation type="obsolete">--- Slutt på klokka ---</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Invalid Code</source>
|
||||
@ -209,6 +209,14 @@ Vil du lagra?</translation>
|
||||
<source>Are you sure you want to delete</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>That event does not exist.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>EditEvent</name>
|
||||
|
@ -175,7 +175,7 @@ Você quer salvar?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>--- End of clock ---</source>
|
||||
<translation>-- Fim do Relógio --</translation>
|
||||
<translation type="obsolete">-- Fim do Relógio --</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Invalid Code</source>
|
||||
@ -210,6 +210,14 @@ Você quer salvar?</translation>
|
||||
<source>Are you sure you want to delete</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>That event does not exist.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>EditEvent</name>
|
||||
|
Loading…
x
Reference in New Issue
Block a user