1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-10-01 17:26:40 -04:00

Multi device support: first working prototype

This commit is contained in:
f4exb 2016-05-14 00:49:18 +02:00
parent f5a65ddc97
commit 4306192097
2 changed files with 446 additions and 10 deletions

View File

@ -93,6 +93,8 @@ MainWindow::MainWindow(QWidget* parent) :
ui->menu_Window->addAction(ui->presetDock->toggleViewAction()); ui->menu_Window->addAction(ui->presetDock->toggleViewAction());
ui->menu_Window->addAction(ui->channelDock->toggleViewAction()); ui->menu_Window->addAction(ui->channelDock->toggleViewAction());
//ui->tabInputsVoew->setStyleSheet("background-color: rgb(46,46,46)");
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleMessages()), Qt::QueuedConnection); connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleMessages()), Qt::QueuedConnection);
connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus())); connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
@ -120,7 +122,7 @@ MainWindow::MainWindow(QWidget* parent) :
// m_pluginManager->fillSampleSourceSelector(m_deviceUIs.back()->m_sampleSource); // m_pluginManager->fillSampleSourceSelector(m_deviceUIs.back()->m_sampleSource);
// connect(m_deviceUIs.back()->m_sampleSource, SIGNAL(currentIndexChanged(int)), this, SLOT(on_sampleSource_currentIndexChanged(int))); // connect(m_deviceUIs.back()->m_sampleSource, SIGNAL(currentIndexChanged(int)), this, SLOT(on_sampleSource_currentIndexChanged(int)));
// m_deviceUIs.back()->m_sampleSource->blockSignals(sampleSourceSignalsBlocked); // m_deviceUIs.back()->m_sampleSource->blockSignals(sampleSourceSignalsBlocked);
// ui->tabInputs->addTab(m_deviceUIs.back()->m_sampleSource, "X0"); // ui->tabInputsSelect->addTab(m_deviceUIs.back()->m_sampleSource, "X0");
qDebug() << "MainWindow::MainWindow: loadSettings..."; qDebug() << "MainWindow::MainWindow: loadSettings...";
@ -208,7 +210,7 @@ void MainWindow::addDevice()
pluginManager->fillSampleSourceSelector(m_deviceUIs.back()->m_sampleSource); pluginManager->fillSampleSourceSelector(m_deviceUIs.back()->m_sampleSource);
connect(m_deviceUIs.back()->m_sampleSource, SIGNAL(currentIndexChanged(int)), this, SLOT(on_sampleSource_currentIndexChanged(int))); connect(m_deviceUIs.back()->m_sampleSource, SIGNAL(currentIndexChanged(int)), this, SLOT(on_sampleSource_currentIndexChanged(int)));
m_deviceUIs.back()->m_sampleSource->blockSignals(sampleSourceSignalsBlocked); m_deviceUIs.back()->m_sampleSource->blockSignals(sampleSourceSignalsBlocked);
ui->tabInputs->addTab(m_deviceUIs.back()->m_sampleSource, tabNameCStr); ui->tabInputsSelect->addTab(m_deviceUIs.back()->m_sampleSource, tabNameCStr);
// if (dspDeviceEngineUID == 0) // if (dspDeviceEngineUID == 0)
// { // {
@ -235,7 +237,7 @@ void MainWindow::removeLastDevice()
lastDeviceEngine->stop(); lastDeviceEngine->stop();
m_dspEngine->removeLastDeviceEngine(); m_dspEngine->removeLastDeviceEngine();
ui->tabInputs->removeTab(ui->tabInputs->count() - 1); ui->tabInputsSelect->removeTab(ui->tabInputsSelect->count() - 1);
delete m_deviceUIs.back(); delete m_deviceUIs.back();
m_deviceUIs.pop_back(); m_deviceUIs.pop_back();
@ -280,7 +282,25 @@ void MainWindow::removeChannelMarker(ChannelMarker* channelMarker)
void MainWindow::setInputGUI(int deviceTabIndex, QWidget* gui) void MainWindow::setInputGUI(int deviceTabIndex, QWidget* gui)
{ {
ui->stackInputs->addWidget(gui); qDebug("MainWindow::setInputGUI: count before %d", ui->tabInputsView->count());
char tabNameCStr[16];
sprintf(tabNameCStr, "R%d", deviceTabIndex);
if (deviceTabIndex < ui->tabInputsView->count())
{
qDebug("MainWindow::setInputGUI: device index %d replace", deviceTabIndex);
ui->tabInputsView->removeTab(deviceTabIndex);
ui->tabInputsView->insertTab(deviceTabIndex, gui, tabNameCStr);
}
else
{
qDebug("MainWindow::setInputGUI: device index %d add", deviceTabIndex);
ui->tabInputsView->addTab(gui, tabNameCStr);
}
qDebug("MainWindow::setInputGUI: count after %d", ui->tabInputsView->count());
} }
void MainWindow::loadSettings() void MainWindow::loadSettings()
@ -302,7 +322,7 @@ void MainWindow::loadPresetSettings(const Preset* preset)
qPrintable(preset->getDescription())); qPrintable(preset->getDescription()));
// Load into currently selected source tab // Load into currently selected source tab
int currentSourceTabIndex = ui->tabInputs->currentIndex(); int currentSourceTabIndex = ui->tabInputsSelect->currentIndex();
if (currentSourceTabIndex >= 0) if (currentSourceTabIndex >= 0)
{ {
@ -336,7 +356,7 @@ void MainWindow::savePresetSettings(Preset* preset)
preset->clearChannels(); preset->clearChannels();
// Save from currently selected source tab // Save from currently selected source tab
int currentSourceTabIndex = ui->tabInputs->currentIndex(); int currentSourceTabIndex = ui->tabInputsSelect->currentIndex();
if (currentSourceTabIndex >= 0) if (currentSourceTabIndex >= 0)
{ {
@ -673,7 +693,7 @@ void MainWindow::on_action_DV_Serial_triggered(bool checked)
void MainWindow::on_sampleSource_currentIndexChanged(int index) void MainWindow::on_sampleSource_currentIndexChanged(int index)
{ {
// Do it in the currently selected source tab // Do it in the currently selected source tab
int currentSourceTabIndex = ui->tabInputs->currentIndex(); int currentSourceTabIndex = ui->tabInputsSelect->currentIndex();
if (currentSourceTabIndex >= 0) if (currentSourceTabIndex >= 0)
{ {

View File

@ -405,7 +405,7 @@
<attribute name="dockWidgetArea"> <attribute name="dockWidgetArea">
<number>1</number> <number>1</number>
</attribute> </attribute>
<widget class="QWidget" name="dockWidgetContents_6"> <widget class="QWidget" name="intpuDockWidget">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum"> <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -420,7 +420,7 @@
<number>2</number> <number>2</number>
</property> </property>
<item> <item>
<widget class="QTabWidget" name="tabInputs"> <widget class="QTabWidget" name="tabInputsSelect">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
@ -433,7 +433,423 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QStackedWidget" name="stackInputs"/> <widget class="QTabWidget" name="tabInputsView">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>53</red>
<green>52</green>
<blue>50</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>79</red>
<green>78</green>
<blue>75</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>66</red>
<green>65</green>
<blue>62</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>26</red>
<green>26</green>
<blue>25</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>35</red>
<green>34</green>
<blue>33</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>53</red>
<green>52</green>
<blue>50</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>26</red>
<green>26</green>
<blue>25</blue>
</color>
</brush>
</colorrole>
<colorrole role="ToolTipBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
<colorrole role="ToolTipText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>53</red>
<green>52</green>
<blue>50</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>79</red>
<green>78</green>
<blue>75</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>66</red>
<green>65</green>
<blue>62</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>26</red>
<green>26</green>
<blue>25</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>35</red>
<green>34</green>
<blue>33</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>53</red>
<green>52</green>
<blue>50</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>26</red>
<green>26</green>
<blue>25</blue>
</color>
</brush>
</colorrole>
<colorrole role="ToolTipBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
<colorrole role="ToolTipText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Button">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>53</red>
<green>52</green>
<blue>50</blue>
</color>
</brush>
</colorrole>
<colorrole role="Light">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>79</red>
<green>78</green>
<blue>75</blue>
</color>
</brush>
</colorrole>
<colorrole role="Midlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>66</red>
<green>65</green>
<blue>62</blue>
</color>
</brush>
</colorrole>
<colorrole role="Dark">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>26</red>
<green>26</green>
<blue>25</blue>
</color>
</brush>
</colorrole>
<colorrole role="Mid">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>35</red>
<green>34</green>
<blue>33</blue>
</color>
</brush>
</colorrole>
<colorrole role="Text">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>212</red>
<green>212</green>
<blue>205</blue>
</color>
</brush>
</colorrole>
<colorrole role="BrightText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>212</red>
<green>212</green>
<blue>205</blue>
</color>
</brush>
</colorrole>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>53</red>
<green>52</green>
<blue>50</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>53</red>
<green>52</green>
<blue>50</blue>
</color>
</brush>
</colorrole>
<colorrole role="Shadow">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
<colorrole role="AlternateBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>53</red>
<green>52</green>
<blue>50</blue>
</color>
</brush>
</colorrole>
<colorrole role="ToolTipBase">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>220</blue>
</color>
</brush>
</colorrole>
<colorrole role="ToolTipText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>