void SynthSettings::setSampleFormat(const QString &sampleFormat) { if (m_sampleFormat != sampleFormat) { m_sampleFormat = sampleFormat; emit sampleFormatChanged(); } }
void Participant::configureTarget(Target *target) { assert(! configuredTarget); targetView.setAuthor(target->getAuthor()); targetView.setInfo(target->getInfo()); targetView.setKitName(target->getKitName()); targetView.setLayerAlgorithm(target->getLayerAlgorithm()); targetView.setLicense(target->getLicense()); targetView.setName(target->getName()); targetView.setPath(target->getPath()); targetView.setSampleFormat(target->getSampleFormat()); connect(target, SIGNAL(authorChanged(const QString &)), &targetView, SLOT(setAuthor(const QString &))); connect(target, SIGNAL(infoChanged(const QString &)), &targetView, SLOT(setInfo(const QString &))); connect(target, SIGNAL(kitNameChanged(const QString &)), &targetView, SLOT(setKitName(const QString &))); connect(target, SIGNAL(layerAlgorithmChanged(LayerAlgorithm)), &targetView, SLOT(setLayerAlgorithm(LayerAlgorithm))); connect(target, SIGNAL(licenseChanged(const QString &)), &targetView, SLOT(setLicense(const QString &))); connect(target, SIGNAL(nameChanged(const QString &)), &targetView, SLOT(setName(const QString &))); connect(target, SIGNAL(pathChanged(const QString &)), &targetView, SLOT(setPath(const QString &))); connect(target, SIGNAL(sampleFormatChanged(SampleFormat)), &targetView, SLOT(setSampleFormat(SampleFormat))); connect(&targetView, SIGNAL(authorChangeRequest(const QString &)), target, SLOT(setAuthor(const QString &))); connect(&targetView, SIGNAL(infoChangeRequest(const QString &)), target, SLOT(setInfo(const QString &))); connect(&targetView, SIGNAL(kitNameChangeRequest(const QString &)), target, SLOT(setKitName(const QString &))); connect(&targetView, SIGNAL(layerAlgorithmChangeRequest(LayerAlgorithm)), target, SLOT(setLayerAlgorithm(LayerAlgorithm))); connect(&targetView, SIGNAL(licenseChangeRequest(const QString &)), target, SLOT(setLicense(const QString &))); connect(&targetView, SIGNAL(nameChangeRequest(const QString &)), target, SLOT(setName(const QString &))); connect(&targetView, SIGNAL(pathChangeRequest(const QString &)), target, SLOT(setPath(const QString &))); connect(&targetView, SIGNAL(sampleFormatChangeRequest(SampleFormat)), target, SLOT(setSampleFormat(SampleFormat))); targetView.setVisible(true); configuredTarget = target; }
void Participant::handleTargetViewCloseRequest() { disconnect(configuredTarget, SIGNAL(authorChanged(const QString &)), &targetView, SLOT(setAuthor(const QString &))); disconnect(configuredTarget, SIGNAL(infoChanged(const QString &)), &targetView, SLOT(setInfo(const QString &))); disconnect(configuredTarget, SIGNAL(kitNameChanged(const QString &)), &targetView, SLOT(setKitName(const QString &))); disconnect(configuredTarget, SIGNAL(layerAlgorithmChanged(LayerAlgorithm)), &targetView, SLOT(setLayerAlgorithm(LayerAlgorithm))); disconnect(configuredTarget, SIGNAL(licenseChanged(const QString &)), &targetView, SLOT(setLicense(const QString &))); disconnect(configuredTarget, SIGNAL(nameChanged(const QString &)), &targetView, SLOT(setName(const QString &))); disconnect(configuredTarget, SIGNAL(pathChanged(const QString &)), &targetView, SLOT(setPath(const QString &))); disconnect(configuredTarget, SIGNAL(sampleFormatChanged(SampleFormat)), &targetView, SLOT(setSampleFormat(SampleFormat))); disconnect(&targetView, SIGNAL(authorChangeRequest(const QString &)), configuredTarget, SLOT(setAuthor(const QString &))); disconnect(&targetView, SIGNAL(infoChangeRequest(const QString &)), configuredTarget, SLOT(setInfo(const QString &))); disconnect(&targetView, SIGNAL(kitNameChangeRequest(const QString &)), configuredTarget, SLOT(setKitName(const QString &))); disconnect(&targetView, SIGNAL(layerAlgorithmChangeRequest(LayerAlgorithm)), configuredTarget, SLOT(setLayerAlgorithm(LayerAlgorithm))); disconnect(&targetView, SIGNAL(licenseChangeRequest(const QString &)), configuredTarget, SLOT(setLicense(const QString &))); disconnect(&targetView, SIGNAL(nameChangeRequest(const QString &)), configuredTarget, SLOT(setName(const QString &))); disconnect(&targetView, SIGNAL(pathChangeRequest(const QString &)), configuredTarget, SLOT(setPath(const QString &))); disconnect(&targetView, SIGNAL(sampleFormatChangeRequest(SampleFormat)), configuredTarget, SLOT(setSampleFormat(SampleFormat))); targetView.setVisible(false); configuredTarget = 0; }
Target * Participant::addTarget() { Target *target = new Target(tr("Hydrogen"), this); connect(target, SIGNAL(authorChanged(QString)), context, SLOT(setSessionModified())); connect(target, SIGNAL(infoChanged(QString)), context, SLOT(setSessionModified())); connect(target, SIGNAL(kitNameChanged(QString)), context, SLOT(setSessionModified())); connect(target, SIGNAL(layerAlgorithmChanged(LayerAlgorithm)), context, SLOT(setSessionModified())); connect(target, SIGNAL(licenseChanged(QString)), context, SLOT(setSessionModified())); connect(target, SIGNAL(nameChanged(QString)), context, SLOT(setSessionModified())); connect(target, SIGNAL(pathChanged(QString)), context, SLOT(setSessionModified())); connect(target, SIGNAL(sampleFormatChanged(SampleFormat)), context, SLOT(setSessionModified())); synthclone::MenuAction *action = new synthclone::MenuAction(tr("Configure"), target); connect(action, SIGNAL(triggered()), SLOT(handleTargetConfiguration())); const synthclone::Registration &targetRegistration = context->addTarget(target); connect(&targetRegistration, SIGNAL(unregistered(QObject *)), SLOT(handleUnregistration(QObject *))); const synthclone::Registration &actionRegistration = context->addMenuAction(action, target); connect(&actionRegistration, SIGNAL(unregistered(QObject *)), SLOT(handleUnregistration(QObject *))); return target; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), kwp(this), appSettings(new QSettings("vagblocks.ini", QSettings::IniFormat, this)), serialConfigured(false), storedRow(-1), storedCol(-1), currentlyLogging(false) { /* QFile roboto(":/resources/Roboto-Regular.ttf"); roboto.open(QIODevice::ReadOnly); if (QFontDatabase::addApplicationFontFromData(roboto.readAll()) < 0) { // error } roboto.close(); */ ui->setupUi(this); QString svnRev = APP_SVN_REV; int colonAt = svnRev.indexOf(":"); if (colonAt > 0) { svnRev = svnRev.mid(colonAt+1); } QString appVer = APP_VERSION; aboutDialog = new about(appVer, svnRev, this); serSettings = new serialSettingsDialog(this); settingsDialog = new settings(appSettings, this); connect(ui->action_About, SIGNAL(triggered()), aboutDialog, SLOT(show())); connect(ui->actionApplication_settings, SIGNAL(triggered()), settingsDialog, SLOT(show())); setupBlockArray(ui->blocksLayout); connect(&kwp, SIGNAL(log(QString, int)), this, SLOT(log(QString, int))); connect(&kwp, SIGNAL(newBlockData(int)), this, SLOT(newBlockData(int))); connect(&kwp, SIGNAL(blockOpen(int)), this, SLOT(blockOpen(int))); connect(&kwp, SIGNAL(blockClosed(int)), this, SLOT(blockClosed(int))); connect(&kwp, SIGNAL(channelOpen(bool)), this, SLOT(channelOpen(bool))); connect(&kwp, SIGNAL(elmInitialised(bool)), this, SLOT(elmInitialised(bool))); connect(&kwp, SIGNAL(portOpened(bool)), this, SLOT(portOpened(bool))); connect(&kwp, SIGNAL(portClosed()), this, SLOT(portClosed())); connect(&kwp, SIGNAL(newModuleInfo(QStringList)), this, SLOT(moduleInfoReceived(QStringList))); connect(&kwp, SIGNAL(newEcuInfo(QStringList)), this, SLOT(ecuInfoReceived(QStringList))); connect(ui->pushButton_log, SIGNAL(clicked(bool)), this, SLOT(startLogging(bool))); connect(&kwp, SIGNAL(labelsLoaded(bool)), this, SLOT(labelsLoaded(bool))); connect(ui->lineEdit_moduleNum, SIGNAL(textChanged(QString)), this, SLOT(clearUI())); connect(ui->comboBox_modules, SIGNAL(activated(int)), this, SLOT(selectNewModule(int))); connect(&kwp, SIGNAL(moduleListRefreshed()), this, SLOT(refreshModules())); connect(ui->pushButton_refresh, SIGNAL(clicked()), &kwp, SLOT(openGW_refresh())); connect(&kwp, SIGNAL(sampleFormatChanged()), this, SLOT(sampleFormatChanged())); connect(&kwp, SIGNAL(loggingStarted()), this, SLOT(loggingStarted())); connect(settingsDialog, SIGNAL(settingsChanged()), this, SLOT(updateSettings())); for (int i = 0; i < 16; i++) { // setup running average for sample rate avgList.append(0); } restoreSettings(); if (serialConfigured) { kwp.setSerialParams(serSettings->getSettings()); QMetaObject::invokeMethod(&kwp, "openPort", Qt::QueuedConnection); } connect(serSettings, SIGNAL(settingsApplied()), this, SLOT(connectToSerial())); refreshModules(true); }