1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-27 02:09:14 -05:00

Multi device support: save main window state across master (sampling device) tab changes

This commit is contained in:
f4exb 2016-05-18 16:24:04 +02:00
parent 90b1fae799
commit 1c9b4ef1c9
2 changed files with 14 additions and 0 deletions

View File

@ -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);

View File

@ -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<DeviceUISet*> m_deviceUIs;
QList<DeviceWidgetTabData> m_deviceWidgetTabs;
int m_masterTabIndex;
DSPEngine* m_dspEngine;
PluginManager* m_pluginManager;