Skip to content

Commit

Permalink
Window geometry restoring fix
Browse files Browse the repository at this point in the history
  • Loading branch information
KejPi committed Sep 1, 2022
1 parent 06c3786 commit b37f197
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions gui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1476,12 +1476,12 @@ void MainWindow::loadSettings()

// load servicelist
serviceList->load(*settings);
restoreGeometry(settings->value("windowGeometry").toByteArray());
expertMode = settings->value("ExpertMode").toBool();
setExpertMode(expertMode);
#if (!defined HAVE_PORTAUDIO) || (AUDIOOUTPUT_PORTAUDIO_VOLUME_ENA)
volumeSlider->setValue(settings->value("volume", 100).toInt());
#endif
restoreGeometry(settings->value("windowGeometry").toByteArray());

int inDevice = settings->value("inputDeviceId", int(InputDeviceId::RTLSDR)).toInt();

Expand Down Expand Up @@ -1795,13 +1795,18 @@ void MainWindow::showCatSLS()

void MainWindow::setExpertMode(bool ena)
{
bool doResize = false;
if (ena)
{
switchModeAct->setText("Basic mode");
}
else
{
switchModeAct->setText("Expert mode");
switchModeAct->setText("Expert mode");

// going to basic mode -> windows get resized if user did not resize before
// this always keeps minimum window size
doResize = (size() == minimumSizeHint());
}
ui->channelFrame->setVisible(ena);
ui->audioFrame->setVisible(ena);
Expand All @@ -1819,7 +1824,10 @@ void MainWindow::setExpertMode(bool ena)

emit expertModeChanged(ena);

QTimer::singleShot(10, this, [this](){ resize(minimumSizeHint()); } );
if (doResize)
{
QTimer::singleShot(10, this, [this](){ resize(minimumSizeHint()); } );
}
}

void MainWindow::bandScan()
Expand Down

0 comments on commit b37f197

Please sign in to comment.