From 1c9b4ef1c9e7b067478bd4e547b32908cafebad3 Mon Sep 17 00:00:00 2001 From: f4exb Date: Wed, 18 May 2016 16:24:04 +0200 Subject: [PATCH] Multi device support: save main window state across master (sampling device) tab changes --- sdrbase/mainwindow.cpp | 12 ++++++++++++ sdrbase/mainwindow.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/sdrbase/mainwindow.cpp b/sdrbase/mainwindow.cpp index 122ccea01..ef069c21b 100644 --- a/sdrbase/mainwindow.cpp +++ b/sdrbase/mainwindow.cpp @@ -56,6 +56,7 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWindow), m_audioDeviceInfo(new AudioDeviceInfo), + m_masterTabIndex(0), m_settings(), m_dspEngine(DSPEngine::instance()), m_lastEngineState((DSPDeviceEngine::State)-1), @@ -719,6 +720,17 @@ void MainWindow::tabInputViewIndexChanged() { int inputViewIndex = ui->tabInputsView->currentIndex(); + if ((inputViewIndex >= 0) && (inputViewIndex >= 0) && (inputViewIndex != m_masterTabIndex)) + { + DeviceUISet *deviceUI = m_deviceUIs[inputViewIndex]; + DeviceUISet *lastdeviceUI = m_deviceUIs[m_masterTabIndex]; + deviceUI->m_mainWindowState = saveState(); + restoreState(lastdeviceUI->m_mainWindowState); + m_masterTabIndex = inputViewIndex; + } + +// qDebug("MainWindow::tabInputViewIndexChanged: old: %d new: %d", m_masterTabIndex, inputViewIndex); + ui->tabSpectra->setCurrentIndex(inputViewIndex); ui->tabChannels->setCurrentIndex(inputViewIndex); ui->tabInputsSelect->setCurrentIndex(inputViewIndex); diff --git a/sdrbase/mainwindow.h b/sdrbase/mainwindow.h index 52701abd3..bd48a0c40 100644 --- a/sdrbase/mainwindow.h +++ b/sdrbase/mainwindow.h @@ -65,6 +65,7 @@ public: SamplingDeviceControl *m_samplingDeviceControl; DSPDeviceEngine *m_deviceEngine; DeviceAPI *m_deviceAPI; + QByteArray m_mainWindowState; DeviceUISet(QTimer& timer); ~DeviceUISet(); @@ -101,6 +102,7 @@ private: MainSettings m_settings; std::vector m_deviceUIs; QList m_deviceWidgetTabs; + int m_masterTabIndex; DSPEngine* m_dspEngine; PluginManager* m_pluginManager;