void PlayerSubtitle::onEnableChanged(bool value) { m_enabled = value; if (value) { if (m_player) { connectSignals(); } if (autoLoad()) { if (!m_player) return; QString path = m_player->file(); //path.remove(p->source().scheme() + "://"); QString name = QFileInfo(path).completeBaseName(); path = QFileInfo(path).dir().absoluteFilePath(name); m_sub->setFileName(path); m_sub->setFuzzyMatch(true); m_sub->loadAsync(); } else { m_sub->setFileName(m_file); m_sub->setFuzzyMatch(false); m_sub->loadAsync(); } } else { if (m_player) { disconnectSignals(); } } }
void PropertyWidget_Advanced::setDoc(ScribusDoc *d) { if((d == (ScribusDoc*) m_doc) || (m_ScMW && m_ScMW->scriptIsRunning())) return; if (m_doc) { disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); disconnect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); } m_doc = d; m_item = NULL; if (m_doc.isNull()) { disconnectSignals(); return; } m_unitRatio = m_doc->unitRatio(); m_unitIndex = m_doc->unitIndex(); tracking->setValues( -300, 300, 2, 0); minWordTrackingSpinBox->setValues(1, 100, 2, 100); normWordTrackingSpinBox->setValues(1, 2000, 2, 100); minGlyphExtSpinBox->setValues(90, 110, 2, 100); maxGlyphExtSpinBox->setValues(90, 110, 2, 100); connect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); connect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); }
void PropertyWidget_PathText::setCurrentItem(PageItem *item) { if (!m_ScMW || m_ScMW->scriptIsRunning()) return; //CB We shouldnt really need to process this if our item is the same one //maybe we do if the item has been changed by scripter.. but that should probably //set some status if so. //FIXME: This wont work until when a canvas deselect happens, m_item must be NULL. //if (m_item == i) // return; if (item && m_doc.isNull()) setDoc(item->doc()); m_item = item; disconnectSignals(); configureWidgets(); if (m_item) { if (m_item->asPathText()) { pathTextType->setCurrentIndex(m_item->textPathType); flippedPathText->setChecked(m_item->textPathFlipped); showCurveCheckBox->setChecked(m_item->PoShow); distFromCurve->setValue(m_item->BaseOffs * -1); startOffset->setValue(m_item->textToFrameDistLeft()); } connectSignals(); } }
void ManualSchedule::dateChanged(void) { disconnectSignals(); m_daysahead = m_startdateList->GetCurrentPos(); int hr = m_starthourSpin->GetIntValue(); int min = m_startminuteSpin->GetIntValue(); m_startDateTime = QDateTime( m_nowDateTime.toLocalTime().addDays(m_daysahead).date(), QTime(hr, min), Qt::LocalTime).toUTC(); LOG(VB_SCHEDULE, LOG_INFO, QString("Start Date Time: %1") .arg(m_startDateTime.toString(Qt::ISODate))); // Note we allow start times up to one hour in the past so // if it is 20:25 the user can start a recording at 20:30 // by first setting the hour and then the minute. QDateTime tmp = QDateTime( m_startDateTime.toLocalTime().date(), QTime(m_startDateTime.toLocalTime().time().hour(),59,59), Qt::LocalTime).toUTC(); if (tmp < m_nowDateTime) { hr = m_nowDateTime.toLocalTime().time().hour(); m_starthourSpin->SetValue(hr); m_startDateTime = QDateTime(m_nowDateTime.toLocalTime().date(), QTime(hr, min), Qt::LocalTime).toUTC(); } connectSignals(); }
void PropertyWidget_ParEffect::setDoc(ScribusDoc *doc) { if(doc == (ScribusDoc*) m_doc) return; if (m_doc) { disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); disconnect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); } m_doc = doc; peCharStyleCombo->setDoc(doc); if (m_doc.isNull()) { disconnectSignals(); return; } m_unitRatio = m_doc->unitRatio(); m_unitIndex = m_doc->unitIndex(); fillNumerationsCombo(); connect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); connect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); // Handle properties update when switching document handleSelectionChanged(); }
void PropertyWidget_PathText::setDoc(ScribusDoc *d) { if(d == (ScribusDoc*) m_doc) return; if (m_doc) { disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); disconnect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); } m_doc = d; m_item = NULL; if (m_doc.isNull()) { disconnectSignals(); return; } m_unitRatio = m_doc->unitRatio(); m_unitIndex = m_doc->unitIndex(); startOffset->setMaximum( 30000 ); startOffset->setMinimum( 0 ); startOffset->setSingleStep(10); distFromCurve->setMaximum( 300 ); distFromCurve->setMinimum( -300 ); distFromCurve->setSingleStep(10); connect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); connect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); }
void PropertyWidget_TextColor::setDoc(ScribusDoc *d) { if((d == (ScribusDoc*) m_doc) || (m_ScMW && m_ScMW->scriptIsRunning())) return; if (m_doc) { disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); disconnect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); } m_doc = d; m_item = NULL; if (m_doc.isNull()) { disconnectSignals(); return; } updateColorList(); connect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); connect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); }
void PropertyWidget_ParEffect::handleNumName(QString numName) { if (!m_doc || !m_item) return; disconnectSignals(); ParagraphStyle newStyle; if (numName == "<local block>") { newStyle.setNumOther(true); newStyle.setNumHigher(true); newStyle.setNumRestart(NSRstory); } else { NumStruct * numS = m_doc->numerations.value(numName); Q_ASSERT(numS); int level = qMin(numLevelSpin->value(), numS->m_counters.count()) -1; numLevelSpin->setValue(level +1); newStyle.setNumLevel(level); Numeration num = numS->m_nums[level]; numFormatCombo->setCurrentIndex((int) num.numFormat); numStart->setValue(num.start); numPrefix->setText(num.prefix); numSuffix->setText(num.suffix); } newStyle.setNumPrefix(numPrefix->text()); newStyle.setNumSuffix(numSuffix->text()); newStyle.setNumName(numName); newStyle.setNumFormat((NumFormat) numFormatCombo->currentIndex()); handleChanges(m_item, newStyle); connectSignals(); }
void PropertyWidget_Distance::setDoc(ScribusDoc *d) { if(d == (ScribusDoc*) m_doc) return; if (m_doc) { disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); disconnect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); } m_doc = d; m_item = NULL; if (m_doc.isNull()) { disconnectSignals(); return; } m_unitRatio = m_doc->unitRatio(); m_unitIndex = m_doc->unitIndex(); columns->setDecimals(0); columnGap->setDecimals(2); topDistance->setDecimals(2); leftDistance->setDecimals(2); bottomDistance->setDecimals(2); rightDistance->setDecimals(2); connect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged())); connect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged())); }
void Server::close() { { boost::mutex::scoped_lock l(_stateMutex); if (_dying) { return; } _dying = true; } qiLogVerbose() << "Closing server..."; { const auto subscribersCopy = [&] { boost::recursive_mutex::scoped_lock sl(_socketsMutex); return std::move(_subscribers); }(); for (auto& pair : subscribersCopy) disconnectSignals(pair.first, pair.second); } _server.close(); }
void PropertyWidget_OptMargins::setCurrentItem(PageItem *item) { if (!m_ScMW || m_ScMW->scriptIsRunning()) return; //CB We shouldnt really need to process this if our item is the same one //maybe we do if the item has been changed by scripter.. but that should probably //set some status if so. //FIXME: This wont work until when a canvas deselect happens, m_item must be NULL. //if (m_item == i) // return; if (item && m_doc.isNull()) setDoc(item->doc()); m_item = item; disconnectSignals(); configureWidgets(); if (m_item) { if (m_item->asTextFrame() || m_item->asPathText()) { ParagraphStyle parStyle = m_item->itemText.defaultStyle(); if (m_doc->appMode == modeEdit) m_item->currentTextProps(parStyle); displayOpticalMargins(parStyle); } connectSignals(); } }
/*! * \brief So2sdrBandmap::restart * called when SdrType has changed. Stop the current sdr, initialize and * start the new one. */ void So2sdrBandmap::restartSdr() { sdrSource->stop(); if (sdrThread.isRunning()) { sdrThread.quit(); sdrThread.wait(); } spectrumProcessor->stopSpectrum(); delete sdrSource; // start new one switch ((SdrType)settings->value(s_sdr_type,s_sdr_type_def).toInt()) { case soundcard_t: sdrSource = new AudioReaderPortAudio(settingsFile); break; case afedri_t: sdrSource = new Afedri(settingsFile); break; case network_t: sdrSource = new NetworkSDR(settingsFile); break; } setSdrType(); sdrSource->moveToThread(&sdrThread); connect(actionSetup,SIGNAL(triggered()),sdrSource,SLOT(stop()),Qt::DirectConnection); connect(&sdrThread,SIGNAL(started()),sdrSource,SLOT(initialize())); connect(sdrSource,SIGNAL(stopped()),&sdrThread,SLOT(quit())); connect(sdrSource,SIGNAL(stopped()),this,SLOT(disconnectSignals())); connect(sdrSource,SIGNAL(error(QString)),&errorBox,SLOT(showMessage(QString))); connect(sdrSource, SIGNAL(ready(unsigned char *, unsigned char)),spectrumProcessor, SLOT(processData(unsigned char *, unsigned char))); }
void PropertyWidget_Distance::setCurrentItem(PageItem *item) { if (!m_ScMW || m_ScMW->scriptIsRunning()) return; //CB We shouldn't really need to process this if our item is the same one //maybe we do if the item has been changed by scripter.. but that should probably //set some status if so. //FIXME: This won't work until when a canvas deselect happens, m_item must be NULL. //if (m_item == i) // return; if (item && m_doc.isNull()) setDoc(item->doc()); m_item = item; disconnectSignals(); configureWidgets(); if (!m_item) return; PageItem_TextFrame *textItem = m_item->asTextFrame(); if (m_doc->appMode == modeEditTable) textItem = m_item->asTable()->activeCell().textFrame(); if (!textItem) return; columns->setMaximum(qMax(qRound(textItem->width() / qMax(textItem->ColGap, 10.0)), 1)); columns->setMinimum(1); columns->setValue(textItem->Cols); columnGap->setMinimum(0); if (columnGapLabel->currentIndex() == 0) { columnGap->setMaximum(qMax((textItem->width() / textItem->Cols - textItem->textToFrameDistLeft() - textItem->textToFrameDistRight()) * m_unitRatio, 0.0)); columnGap->setValue(textItem->ColGap*m_unitRatio); } else { columnGap->setMaximum(qMax((textItem->width() / textItem->Cols) * m_unitRatio, 0.0)); columnGap->setValue(textItem->columnWidth() * m_unitRatio); } leftDistance->setValue(textItem->textToFrameDistLeft()*m_unitRatio); topDistance->setValue(textItem->textToFrameDistTop()*m_unitRatio); bottomDistance->setValue(textItem->textToFrameDistBottom()*m_unitRatio); rightDistance->setValue(textItem->textToFrameDistRight()*m_unitRatio); if (columns->value() == 1) { columnGap->setEnabled(false); columnGapLabel->setEnabled(false); } else { columnGap->setEnabled(true); columnGapLabel->setEnabled(true); } showTextDistances(textItem->textToFrameDistLeft(), textItem->textToFrameDistTop(), textItem->textToFrameDistBottom(), textItem->textToFrameDistRight()); verticalAlign->setCurrentIndex(textItem->verticalAlignment()); connectSignals(); }
void PropertyWidget_ParEffect::updateStyle(const ParagraphStyle& newPStyle) { if (peCombo->currentIndex() && !newPStyle.hasBullet() && !newPStyle.hasDropCap() && !newPStyle.hasNum()) { enableParEffect(false); return; } disconnectSignals (); bool enablePE = true; if (newPStyle.hasDropCap()) { peCombo->setCurrentIndex(1); enableDropCap(true); } else if (newPStyle.hasBullet()) { peCombo->setCurrentIndex(2); enableBullet(true); } else if (newPStyle.hasNum()) { peCombo->setCurrentIndex(3); enableNum(true); } else enablePE = false; QString numName = numComboBox->currentText(); int nFormat = 0; dropCapLines->setValue(newPStyle.dropCapLines()); bulletStrEdit->setEditText(newPStyle.bulletStr()); numName = newPStyle.numName(); if (numName == "") numName = "<local block>"; numComboBox->setCurrentIndex(numComboBox->findText(numName)); NumStruct * numS = m_doc->numerations.value(numName); if (numS) numLevelSpin->setMaximum(numS->m_counters.count()+1); else numLevelSpin->setMaximum(3); numLevelSpin->setValue(newPStyle.numLevel() +1); numPrefix->setText(newPStyle.numPrefix()); numSuffix->setText(newPStyle.numSuffix()); numStart->setValue(newPStyle.numStart()); nFormat = newPStyle.numFormat(); numFormatCombo->setCurrentIndex(nFormat); peOffset->setValue(newPStyle.parEffectOffset() * m_unitRatio); peIndent->setChecked(newPStyle.parEffectIndent()); showCharStyle(newPStyle.peCharStyleName()); enableParEffect(enablePE); connectSignals (); }
void Tpalette::setCurrentItem(PageItem* item) { currentItem = item; disconnectSignals(); if (!currentItem || !currentDoc) return; setActTrans(currentItem->fillTransparency(), currentItem->lineTransparency()); setActBlend(currentItem->fillBlendmode(), currentItem->lineBlendmode()); gradEdit->setGradient(currentItem->mask_gradient); if (!currentItem->gradientMask().isEmpty()) { setCurrentComboItem(namedGradient, currentItem->gradientMask()); gradEdit->setGradientEditable(false); } else { namedGradient->setCurrentIndex(0); gradEdit->setGradientEditable(true); } if (currentItem->maskType() == 0) tabWidget->setCurrentIndex(0); else if ((currentItem->maskType() == 1) || (currentItem->maskType() == 2) || (currentItem->maskType() == 4) || (currentItem->maskType() == 5)) tabWidget->setCurrentIndex(1); else tabWidget->setCurrentIndex(2); if (patternList->count() == 0) tabWidget->setTabEnabled(2, false); else tabWidget->setTabEnabled(2, true); transpCalcGradient->setChecked(false); transpCalcPattern->setChecked(false); usePatternInverted->setChecked(false); if ((currentItem->maskType() == 4) || (currentItem->maskType() == 5)) transpCalcGradient->setChecked(true); if ((currentItem->maskType() == 6) || (currentItem->maskType() == 7)) transpCalcPattern->setChecked(true); if ((currentItem->maskType() == 7) || (currentItem->maskType() == 8)) usePatternInverted->setChecked(true); if ((currentItem->maskType() == 1) || (currentItem->maskType() == 4)) gradientType->setCurrentIndex(0); else if ((currentItem->maskType() == 2) || (currentItem->maskType() == 5)) gradientType->setCurrentIndex(1); if(TGradDia && gradEditButton->isChecked()) TGradDia->setValues(currentItem->GrMaskStartX, currentItem->GrMaskStartY, currentItem->GrMaskEndX, currentItem->GrMaskEndY, currentItem->GrMaskFocalX, currentItem->GrMaskFocalY, currentItem->GrMaskScale, currentItem->GrMaskSkew, 0, 0); double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY; bool mirrorX, mirrorY; currentItem->maskTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY); currentItem->maskFlip(mirrorX, mirrorY); setActPattern(currentItem->patternMask(), patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, mirrorX, mirrorY); connectSignals(); }
void PlayerSubtitle::setPlayer(AVPlayer *player) { if (m_player == player) return; if (m_player) { disconnectSignals(); } m_player = player; if (!m_player) return; connectSignals(); }
void SettingsObject::unregisterSetting(Setting *setting) { if (!setting || !m_settings.contains(setting->id())) return; // We can't unregister something that's not registered. m_settings.remove(setting->id()); // Disconnect signals. disconnectSignals(*setting); setting->setParent(NULL); // Drop ownership. }
void LibMuttng::cleanup (void) { disconnectSignals(displayMessage,this); disconnectSignals(displayProgress,this); disconnectSignals(displayError,this); disconnectSignals(displayWarning,this); if (debugObj) delete (debugObj); #ifdef LIBMUTTNG_SSL_OPENSSL SSLConnection::dereg(); #endif Connection::dereg(); mem_free(&Homedir); mem_free(&Realname); mem_free(&Shell); mem_free(&Username); mem_free(&Hostname); mem_free(&OSName); buffer_free(&Fqdn); buffer_free(&AttachMarker); }
void PropertyWidget_TextColor::updateColorList() { if (!m_doc || !m_ScMW || m_ScMW->scriptIsRunning()) return; if (m_item) disconnectSignals(); fillColor->updateBox(m_doc->PageColors, ColorCombo::fancyPixmaps, true); strokeColor->updateBox(m_doc->PageColors, ColorCombo::fancyPixmaps, false); fillColor->view()->setMinimumWidth(fillColor->view()->maximumViewportSize().width() + 24); strokeColor->view()->setMinimumWidth(strokeColor->view()->maximumViewportSize().width() + 24); if (m_item) setCurrentItem(m_item); }
void PropertyWidget_TextColor::setCurrentItem(PageItem *item) { if (!m_ScMW || m_ScMW->scriptIsRunning()) return; //CB We shouldnt really need to process this if our item is the same one //maybe we do if the item has been changed by scripter.. but that should probably //set some status if so. //FIXME: This wont work until when a canvas deselect happens, m_item must be NULL. //if (m_item == i) // return; disconnectSignals(); m_item = item; if (item && m_doc.isNull()) setDoc(item->doc()); configureWidgets(); if (m_item == NULL) return; if (!m_item->isTable() && !m_item->isTextFrame()) return; PageItem_TextFrame *i2; if (m_doc->appMode == modeEditTable) i2 = m_item->asTable()->activeCell().textFrame(); else i2 = m_item->asTextFrame(); if (i2 != 0) revertButton->setChecked(i2->reversed()); if (m_item->asTextFrame() || m_item->asPathText() || m_item->asTable()) { ParagraphStyle parStyle = m_item->itemText.defaultStyle(); if (m_doc->appMode == modeEdit) m_item->currentTextProps(parStyle); else if (m_doc->appMode == modeEditTable) m_item->asTable()->activeCell().textFrame()->currentTextProps(parStyle); updateStyle(parStyle); } connectSignals(); }
void Server::onSocketDisconnected(TransportSocketPtr socket, std::string error) { { boost::mutex::scoped_lock l(_stateMutex); if (_dying) { return; } BoundAnyObjectMap::iterator it; { boost::mutex::scoped_lock sl(_boundObjectsMutex); for (it = _boundObjects.begin(); it != _boundObjects.end(); ++it) { BoundAnyObject o = it->second; try { o->onSocketDisconnected(socket, error); } catch (const std::runtime_error& e) { qiLogError() << e.what(); } } } { // Lock the mutex, erase the socket, and disconnect it outside the lock. auto socketLocal = [&]() { boost::recursive_mutex::scoped_lock sl(_socketsMutex); auto it = _subscribers.find(socket); QI_ASSERT(it != _subscribers.end()); auto local = std::move(*it); _subscribers.erase(it); return local; }(); if (socketLocal.first) disconnectSignals(socketLocal.first, socketLocal.second); } } }
void NodePalette::setDoc(ScribusDoc *dc, ScribusView *vi) { doc = dc; view = vi; unitChange(); disconnect(EditCont, SIGNAL(clicked()), this, SLOT(ToggleConMode())); disconnect(AbsMode, SIGNAL(clicked()), this, SLOT(ToggleAbsMode())); if (doc!=0) { YSpin->setNewUnit(doc->unitIndex()); XSpin->setNewUnit(doc->unitIndex()); } AbsMode->setChecked(false); EditCont->setChecked(false); if (doc==0) disconnectSignals(); else connectSignals(); }
void PropertyWidget_ParEffect::setCurrentItem(PageItem *item) { if (item && m_doc.isNull()) setDoc(item->doc()); m_item = item; disconnectSignals(); if (!m_item) return; if (m_item->asTextFrame() || m_item->asPathText() || m_item->asTable()) { configureWidgets(); ParagraphStyle parStyle = m_item->itemText.defaultStyle(); if (m_doc->appMode == modeEdit || m_doc->appMode == modeEditTable) m_item->currentTextProps(parStyle); updateStyle(parStyle); connectSignals(); } }
void PlayerSubtitle::onEnabledChanged(bool value) { m_enabled = value; if (value) { if (m_player) { connectSignals(); } if (autoLoad()) { if (!m_player) return; m_sub->setFileName(getSubtitleBasePath(m_player->file())); m_sub->setFuzzyMatch(true); m_sub->loadAsync(); } else { m_sub->setFileName(m_file); m_sub->setFuzzyMatch(false); m_sub->loadAsync(); } } else { if (m_player) { disconnectSignals(); } } }
So2sdrBandmap::So2sdrBandmap(QStringList args, QWidget *parent) : QMainWindow(parent) { setupUi(this); initPointers(); initVariables(); // check to see if user directory exists initialized = checkUserDirectory(); settingsFile = userDirectory()+"/so2sdr-bandmap.ini"; // check for optional command argument giving station config file name if (args.size() > 1) { settingsFile = args[1].trimmed(); // Qt doesn't understand that ~/... implies home directory... if (settingsFile.left(1)=="~") { if (settingsFile.left(2)=="~/") { settingsFile=QDir::homePath()+settingsFile.right(settingsFile.size()-1); } else { // for cases like ~name : no easy way to parse, give up QMessageBox msgBox; msgBox.setText("Please use the complete path to the settings file."); msgBox.setInformativeText(settingsFile); msgBox.setStandardButtons(QMessageBox::Ok); msgBox.setDefaultButton(QMessageBox::Ok); msgBox.exec(); close(); } } } QFileInfo fi(settingsFile); if (!fi.exists()) { QMessageBox msgBox; msgBox.setText("The settings file "+settingsFile+" does not exist."); msgBox.setInformativeText("Do you want to create it?"); msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Cancel); msgBox.setDefaultButton(QMessageBox::Save); if (msgBox.exec()==QMessageBox::Cancel) { close(); } firstTime=true; } settings = new QSettings(settingsFile,QSettings::IniFormat,this); if (settings->status()!=QSettings::NoError) { errorBox.showMessage("ERROR: problem starting qsettings"); } // if run the first time with default settings file for second radio, // set second radio if (firstTime && settingsFile.right(19)=="so2sdr-bandmap2.ini") { settings->setValue(s_sdr_nrig,1); } // restore window size and position QString tmp="BandmapWindow"; settings->beginGroup(tmp); resize(settings->value("size", QSize(400, 594)).toSize()); move(settings->value("pos", QPoint(200, 200)).toPoint()); settings->endGroup(); directory.setCurrent(dataDirectory()); setWindowIcon(QIcon("icon24x24.png")); if (settings->value(s_sdr_reverse_scroll,s_sdr_reverse_scroll_def).toBool()) { horizontalLayout->removeWidget(CallLabel); horizontalLayout->removeWidget(FreqLabel); horizontalLayout->removeWidget(display); horizontalLayout->insertWidget(0,CallLabel); horizontalLayout->insertWidget(1,FreqLabel); horizontalLayout->insertWidget(2,display); } freqPixmap = QPixmap(FreqLabel->width(), settings->value(s_sdr_fft,s_sdr_fft_def).toInt()); callPixmap = QPixmap(CallLabel->width(), settings->value(s_sdr_fft,s_sdr_fft_def).toInt()); ipAddress= QHostAddress(QHostAddress::LocalHost).toString(); if (!server.listen(QHostAddress::LocalHost, settings->value(s_sdr_bandmap_tcp_port,s_sdr_bandmap_tcp_port_def).toInt())) { qDebug("couldn't start tcp server"); } connect(&server, SIGNAL(newConnection()), this, SLOT(startConnection())); setFocusPolicy(Qt::StrongFocus); setFocusPolicy(Qt::NoFocus); display->setFocusPolicy(Qt::NoFocus); CallLabel->setFocusPolicy(Qt::NoFocus); FreqLabel->setFocusPolicy(Qt::NoFocus); checkBoxMark.setText("Mark"); checkBoxMark.setToolTip("Enables signal detection."); toolBar->setMovable(false); QWidget* spacer1 = new QWidget(); spacer1->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred); toolBar->addWidget(spacer1); toolBar->addWidget(&checkBoxMark); txLabel.clear(); txLabel.setText("<font color=#000000>TX"); toolBar->addWidget(&txLabel); slider.setToolTip("Gain for signal detection. To the right is LESS sensitive."); slider.setOrientation(Qt::Horizontal); connect(&slider,SIGNAL(valueChanged(int)),this,SLOT(updateLevel(int))); slider.setFixedWidth(60); slider.setMaximum(200); slider.setMinimum(0); slider.setSingleStep(10); slider.setPageStep(50); slider.setValue(settings->value(s_sdr_level,s_sdr_level_def).toInt()); toolBar->addWidget(&slider); QWidget* spacer2 = new QWidget(); spacer2->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred); toolBar->addWidget(spacer2); toolBar->addAction("&Help",this,SLOT(showHelp())); iqDialog = new IQBalance(this, Qt::Window); iqDialog->clearPlots(); showToolBar = new QAction("&toolbar",this); scaleX1 = new QAction("Zoom x&1", this); scaleX2 = new QAction("Zoom x&2", this); deleteAct = new QAction("&Delete Call", this); checkBoxMark.setChecked(settings->value(s_sdr_peakdetect,s_sdr_peakdetect_def).toBool()); iqShowData = new QAction("IQ Balance", this); connect(iqShowData, SIGNAL(triggered()), this, SLOT(showIQData())); connect(&checkBoxMark, SIGNAL(clicked()), this, SLOT(emitParams())); connect(deleteAct, SIGNAL(triggered()), this, SLOT(deleteCallMouse())); showToolBar->setCheckable(true); showToolBar->setChecked(true); connect(showToolBar,SIGNAL(triggered(bool)),this,SLOT(setShowToolbar(bool))); scaleX1->setCheckable(true); scaleX2->setCheckable(true); scaleX2->setChecked(false); scaleX1->setChecked(true); connect(scaleX1, SIGNAL(triggered()), this, SLOT(setScaleX1())); connect(scaleX2, SIGNAL(triggered()), this, SLOT(setScaleX2())); connect(actionRun,SIGNAL(triggered()),this,SLOT(start())); sdrSetup = new SDRDialog(*settings,this); connect(actionSetup,SIGNAL(triggered()),sdrSetup,SLOT(show())); connect(actionSetup,SIGNAL(triggered()),this,SLOT(disconnectSignals())); connect(sdrSetup,SIGNAL(setupErrors(QString)),&errorBox,SLOT(showMessage(QString))); connect(sdrSetup,SIGNAL(update()),this,SLOT(setSdrType())); connect(sdrSetup,SIGNAL(restartSdr()),this,SLOT(restartSdr())); connect(display, SIGNAL(displayMouseQSY(int)), this, SLOT(mouseQSYDelta(int))); toolBarHeight = toolBar->height(); // select type of SDR, create data source sdrSource spectrumProcessor = new Spectrum(this,*settings,userDirectory()); switch ((SdrType)settings->value(s_sdr_type,s_sdr_type_def).toInt()) { case soundcard_t: sdrSource = new AudioReaderPortAudio(settingsFile); break; case afedri_t: sdrSource = new Afedri(settingsFile); break; case network_t: sdrSource = new NetworkSDR(settingsFile); break; } setSdrType(); sdrSource->moveToThread(&sdrThread); connect(actionSetup,SIGNAL(triggered()),sdrSource,SLOT(stop()),Qt::DirectConnection); connect(&sdrThread,SIGNAL(started()),sdrSource,SLOT(initialize())); connect(sdrSource,SIGNAL(stopped()),&sdrThread,SLOT(quit())); connect(sdrSource,SIGNAL(stopped()),this,SLOT(disconnectSignals())); connect(sdrSource,SIGNAL(error(QString)),&errorBox,SLOT(showMessage(QString))); connect(spectrumProcessor, SIGNAL(spectrumReady(unsigned char*, unsigned char)), display, SLOT(plotSpectrum(unsigned char*, unsigned char))); connect(sdrSource, SIGNAL(ready(unsigned char *, unsigned char)),spectrumProcessor, SLOT(processData(unsigned char *, unsigned char)),Qt::QueuedConnection); connect(iqDialog, SIGNAL(closed(bool)), spectrumProcessor, SLOT(setPlotPoints(bool))); connect(iqDialog, SIGNAL(restart()), spectrumProcessor, SLOT(clearIQ())); connect(spectrumProcessor, SIGNAL(qsy(int)), this, SLOT(findQsy(int))); connect(spectrumProcessor, SIGNAL(clearPlot()), iqDialog, SLOT(clearPlots())); connect(spectrumProcessor, SIGNAL(gainPoint(int, double)), iqDialog, SLOT(plotGainPoint(int, double))); connect(spectrumProcessor, SIGNAL(phasePoint(int, double)), iqDialog, SLOT(plotPhasePoint(int, double))); connect(spectrumProcessor, SIGNAL(gainScale(double, double)), iqDialog, SLOT(setGainScale(double, double))); connect(spectrumProcessor, SIGNAL(phaseScale(double, double)), iqDialog, SLOT(setPhaseScale(double, double))); connect(spectrumProcessor, SIGNAL(plotGainFunc(double, double, double, double)), iqDialog, SLOT(plotGainFunc(double, double, double, double))); connect(spectrumProcessor, SIGNAL(plotPhaseFunc(double, double, double, double)), iqDialog, SLOT(plotPhaseFunc(double, double, double, double))); // vfoPos is the position of the red line indicating center vfoPos = (height()-toolBarHeight)/ 2; dragPos = vfoPos; display->setVfoPos(vfoPos); makeFreqScaleAbsolute(); FreqLabel->setPixmap(freqPixmap); FreqLabel->update(); startTimers(); show(); }