KejPi / AbracaDABra

Abraca DAB radio: DAB/DAB+ Software Defined Radio (SDR)
MIT License
68 stars 8 forks source link

Save and restore windows pos #35

Closed gvanem closed 2 years ago

gvanem commented 2 years ago

This patch tries to save and restore the main UI's size and position to AbracaDABra.ini. Write / reads this:

win_x=246
win_y=177
win_h=511
win_w=1254

in the [General] section. Hope I've not misunderstood these single-shot timers. I'm new to Qt6....

But I messed up the PR again. The patch to mainwindow.h is simply this:

--- a/gui/mainwindow.h 2022-08-18 18:51:03
+++ b/gui/mainwindow.h 2022-08-19 15:35:17
@@ -102,6 +102,9 @@
     EnsembleInfoDialog * ensembleInfoDialog;
     CatSLSDialog * catSlsDialog;
     QProgressBar * snrProgress;
+    QSettings * settings;
+    QSize  win_size;
+    QPoint win_point;
     ClickableLabel * settingsLabel;
     ClickableLabel * muteLabel;

@@ -160,6 +163,8 @@
     void onChannelSelection();
     void loadSettings();
     void saveSettings();
+    void saveWindowPos();
+    void restoreWindowPos();

     void setFavoriteLabel(bool ena);
     void favoriteToggled(bool checked);
KejPi commented 2 years ago

Acknowledged, I will check it after vacation.

KejPi commented 2 years ago

I have used Qt6 API to implement this feature in 88c55ff40e59f3b16246b1c16ef25b611da05137 Please check if this implementation fits your expectations and report issues you may find. Thanks!