mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-05-29 15:12:34 +02:00
Replace getenv("HOME") by RDGetHomeDir() in MainWidget::LoadGeometry/SaveGeometry. Create MainWidget::GeometryFile to share logic
This commit is contained in:
parent
eb8e95d994
commit
ea10c041fb
@ -2513,15 +2513,24 @@ int MainWidget::GetConnection(QString station,unsigned chan)
|
||||
return -1;
|
||||
}
|
||||
|
||||
QString MainWidget::GeometryFile() {
|
||||
bool home_found = false;
|
||||
QString home = RDGetHomeDir(&home_found);
|
||||
if (home_found) {
|
||||
return home + "/" + RDCATCH_GEOMETRY_FILE;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWidget::LoadGeometry()
|
||||
{
|
||||
if(getenv("HOME")==NULL) {
|
||||
QString geometry_file = GeometryFile();
|
||||
if(geometry_file==NULL) {
|
||||
return;
|
||||
}
|
||||
RDProfile *profile=new RDProfile();
|
||||
profile->
|
||||
setSource(QString().sprintf("%s/%s",getenv("HOME"),RDCATCH_GEOMETRY_FILE));
|
||||
profile->setSource(geometry_file);
|
||||
resize(profile->intValue("RDCatch","Width",sizeHint().width()),
|
||||
profile->intValue("RDCatch","Height",sizeHint().height()));
|
||||
|
||||
@ -2531,12 +2540,11 @@ void MainWidget::LoadGeometry()
|
||||
|
||||
void MainWidget::SaveGeometry()
|
||||
{
|
||||
if(getenv("HOME")==NULL) {
|
||||
QString geometry_file = GeometryFile();
|
||||
if(geometry_file==NULL) {
|
||||
return;
|
||||
}
|
||||
FILE *file=fopen((const char *)QString().
|
||||
sprintf("%s/%s",getenv("HOME"),RDCATCH_GEOMETRY_FILE),
|
||||
"w");
|
||||
FILE *file=fopen(geometry_file,"w");
|
||||
if(file==NULL) {
|
||||
return;
|
||||
}
|
||||
|
@ -126,6 +126,7 @@ class MainWidget : public QWidget
|
||||
RDListViewItem *GetItem(int id);
|
||||
int GetMonitor(int serial,int chan);
|
||||
int GetConnection(QString station,unsigned chan=0);
|
||||
QString GeometryFile();
|
||||
void LoadGeometry();
|
||||
void SaveGeometry();
|
||||
std::vector<CatchMonitor *> catch_monitor;
|
||||
|
Loading…
x
Reference in New Issue
Block a user