2019-12-13 Fred Gleason <fredg@paravelsystems.com>

* Added a 'Show Start Time As' control to the 'Edit Log' dialog
	in rdlogedit(1).
	* Made the main window and 'Edit Log' dialog window size persistent.
	* Changed the 'Time' column in the 'Full Log Widget' in rdairplay(1)
	to 'Sch. Time'.
This commit is contained in:
Fred Gleason
2019-12-13 16:21:00 -05:00
parent 755a84604f
commit f263c5e0d3
24 changed files with 392 additions and 96 deletions

View File

@@ -25,6 +25,7 @@
#include <rdadd_log.h>
#include <rdconf.h>
#include <rdescape_string.h>
#include <rdprofile.h>
#include <rdreport.h>
#include <rdtextfile.h>
@@ -46,8 +47,10 @@
//
// Global Resources
//
RDCartDialog *log_cart_dialog;
bool import_running=false;
bool global_import_running=false;
QSize global_top_window_size;
QSize global_logedit_window_size;
int global_start_time_style;
MainWidget::MainWidget(RDConfig *c,QWidget *parent)
: RDWidget(c,parent)
@@ -61,7 +64,9 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent)
//
// Fix the Window Size
//
setMinimumSize(sizeHint());
setMinimumWidth(RDLOGEDIT_DEFAULT_WIDTH);
setMinimumHeight(RDLOGEDIT_DEFAULT_HEIGHT);
LoadPositions();
//
// Open the Database
@@ -219,7 +224,7 @@ MainWidget::MainWidget(RDConfig *c,QWidget *parent)
QSize MainWidget::sizeHint() const
{
return QSize(640,480);
return global_top_window_size;
}
@@ -651,6 +656,7 @@ void MainWidget::notificationReceivedData(RDNotification *notify)
void MainWidget::quitMainWidget()
{
SavePositions();
exit(0);
}
@@ -672,6 +678,8 @@ void MainWidget::resizeEvent(QResizeEvent *e)
log_track_button->setGeometry(300,size().height()-55,80,50);
log_report_button->setGeometry(400,size().height()-55,80,50);
log_close_button->setGeometry(size().width()-90,size().height()-55,80,50);
global_top_window_size=e->size();
}
@@ -876,3 +884,39 @@ int main(int argc,char *argv[])
w->show();
return a.exec();
}
void MainWidget::LoadPositions() const
{
QString filename=RDHomeDir()+"/"+RDLOGEDIT_POSITION_FILENAME;
RDProfile *p=new RDProfile();
p->setSource(filename);
global_top_window_size=
QSize(p->intValue("RDLogEdit","TopWindowWidth",RDLOGEDIT_DEFAULT_WIDTH),
p->intValue("RDLogEdit","TopWindowHeight",RDLOGEDIT_DEFAULT_HEIGHT));
global_logedit_window_size=
QSize(p->intValue("RDLogEdit","LogeditWindowWidth",RDLOGEDIT_EDITLOG_DEFAULT_WIDTH),
p->intValue("RDLogEdit","LogeditWindowHeight",RDLOGEDIT_EDITLOG_DEFAULT_HEIGHT));
global_start_time_style=p->intValue("RDLogEdit","StartTimeStyle",0);
delete p;
}
void MainWidget::SavePositions() const
{
QString filename=RDHomeDir()+"/"+RDLOGEDIT_POSITION_FILENAME;
QString temp_filename=RDHomeDir()+"/"+RDLOGEDIT_POSITION_FILENAME+"-temp";
FILE *f=NULL;
if((f=fopen(temp_filename.toUtf8(),"w"))!=NULL) {
fprintf(f,"[RDLogEdit]\n");
fprintf(f,"TopWindowWidth=%d\n",global_top_window_size.width());
fprintf(f,"TopWindowHeight=%d\n",global_top_window_size.height());
fprintf(f,"LogeditWindowWidth=%d\n",global_logedit_window_size.width());
fprintf(f,"LogeditWindowHeight=%d\n",global_logedit_window_size.height());
fprintf(f,"StartTimeStyle=%d\n",global_start_time_style);
fclose(f);
rename(temp_filename.toUtf8(),filename.toUtf8());
}
}