void SettingsWindow::connectSlots() { connect (m_ok, SIGNAL (clicked()), this, SLOT (apply())); connect (m_reset, SIGNAL (clicked()), this, SLOT (reset())); connect (m_cancel, SIGNAL (clicked()), this, SLOT (cancel())); connect (DS(), SIGNAL (teamChanged (int)), this, SLOT (updateTeam (int))); connect (DS(), SIGNAL (protocolChanged()), this, SLOT (readSettings())); connect (m_useCustomAddress, SIGNAL (toggled (bool)), m_robotAddress, SLOT (setEnabled (bool))); connect (m_baseButton, SIGNAL (clicked()), this, SLOT (onSelectorClicked())); connect (m_highlightButton, SIGNAL (clicked()), this, SLOT (onSelectorClicked())); connect (m_backgroundButton, SIGNAL (clicked()), this, SLOT (onSelectorClicked())); connect (m_foregroundButton, SIGNAL (clicked()), this, SLOT (onSelectorClicked())); connect (m_baseEdit, SIGNAL (textChanged (QString)), this, SLOT (onColorChanged (QString))); connect (m_highlightEdit, SIGNAL (textChanged (QString)), this, SLOT (onColorChanged (QString))); connect (m_backgroundEdit, SIGNAL (textChanged (QString)), this, SLOT (onColorChanged (QString))); connect (m_foregroundEdit, SIGNAL (textChanged (QString)), this, SLOT (onColorChanged (QString))); }
void chooseProtoWidget::changeProto(int value) { Cell* old_cell = this->proto->cell->clone(); string datadir = this->proto->datadir; string cellStateDir = this->proto->cellStateDir; if(old_cell->type == string("gridCell")) { cell_type->setEnabled(true); cell_type->removeItem(cell_type->count() -1); } switch(value) { case 0: this->proto = new CurrentClamp(); this->proto->cell = old_cell; break; case 1: this->proto = new voltageClamp(); this->proto->cell = old_cell; break; case 2: this->proto = new gridProtocol(); cell_type->addItem("gridCell"); cell_type->setEnabled(false); emit cell_type_changed(); break; } if(old_cell->type == string("gridCell")) { changeCell(defaultCell); } this->proto->datadir = datadir; this->proto->cellStateDir = cellStateDir; emit protocolChanged(this->proto); }
/** * De-allocates the current protocol and loads the given \a protocol * * \param protocol the new communication protocol to use */ void DriverStation::loadProtocol (const DS_Protocol& protocol) { DS_ConfigureProtocol (&protocol); setCustomFMSAddress (customFMSAddress()); setCustomRadioAddress (customRadioAddress()); setCustomRobotAddress (customRobotAddress()); emit protocolChanged(); emit statusChanged (QString::fromUtf8 (DS_GetStatusString())); }
void PasteSelectDialog::setProtocol(const QString &p) { const int index = m_ui.protocolBox->findText(p); if (index >= 0) { if (index != m_ui.protocolBox->currentIndex()) { m_ui.protocolBox->setCurrentIndex(index); } else { // Trigger a refresh protocolChanged(index); } } }
NewProtocol::NewProtocol(QWidget *parent) : NewProtocolBase(parent, "new_protocol", true) { m_setup = NULL; m_client = NULL; m_last = NULL; m_connectWnd = NULL; m_bConnected = false; m_bConnect = false; m_bStart = (parent == NULL); SET_WNDPROC("protocol") setIcon(Pict("configure")); setButtonsPict(this); setCaption(caption()); helpButton()->hide(); for (unsigned n = 0;; n++){ Event e(EventPluginGetInfo, (void*)n); pluginInfo *info = (pluginInfo*)e.process(); if (info == NULL) break; if (info->info == NULL){ Event e(EventLoadPlugin, info->name); e.process(); if (info->info && !(info->info->flags & (PLUGIN_PROTOCOL & ~PLUGIN_NOLOAD_DEFAULT))){ Event e(EventUnloadPlugin, info->name); e.process(); } } if ((info->info == NULL) || !(info->info->flags & (PLUGIN_PROTOCOL & ~PLUGIN_NOLOAD_DEFAULT))) continue; info->bDisabled = false; Event eApply(EventApplyPlugin, info->name); eApply.process(); } Protocol *protocol; ContactList::ProtocolIterator it; while ((protocol = ++it) != NULL){ const CommandDef *cmd = protocol->description(); if (cmd == NULL) continue; m_protocols.push_back(protocol); } sort(m_protocols.begin(), m_protocols.end(), cmp_protocol); for (unsigned i = 0; i < m_protocols.size(); i++){ const CommandDef *cmd = m_protocols[i]->description(); cmbProtocol->insertItem(Pict(cmd->icon), i18n(cmd->text)); } connect(cmbProtocol, SIGNAL(activated(int)), this, SLOT(protocolChanged(int))); cmbProtocol->setCurrentItem(0); protocolChanged(0); connect(this, SIGNAL(selected(const QString&)), this, SLOT(pageChanged(const QString&))); }
void NewProtocol::pageChanged(const QString&) { if (currentPage() == m_connectWnd){ emit apply(); m_bConnect = true; unsigned status = CorePlugin::m_plugin->getManualStatus(); if (status == STATUS_OFFLINE) status = STATUS_ONLINE; m_client->setStatus(status, false); m_connectWnd->setConnecting(true); setBackEnabled(m_connectWnd, false); setNextEnabled(currentPage(), false); setFinishEnabled(m_connectWnd, false); } if (m_last && (currentPage() == m_last)){ setFinishEnabled(m_connectWnd, false); cancelButton()->show(); backButton()->show(); finishButton()->hide(); showPage(protocolPage); protocolChanged(0); } }
void DriverStation::setProtocol (DS_ProtocolBase* protocol) { if (protocol != Q_NULLPTR) { /* Pass current protocol settings to new protocol */ if (m_manager->isValid()) { int team = m_manager->currentProtocol()->team(); QString address = m_manager->currentProtocol()->robotAddress(); protocol->setTeam (team); protocol->setRobotAddress (address); } /* Configure the DS modules with the new protocol */ m_manager->setProtocol (protocol); m_client->setRobotPort (protocol->robotPort()); m_client->setClientPort (protocol->clientPort()); m_netConsole->setPort (protocol->netConsolePort()); emit protocolChanged(); } }
void testQOfonoConnectionManagerContext () { QSignalSpy conadd(m, SIGNAL(contextAdded(QString))); QSignalSpy conrem(m, SIGNAL(contextRemoved(QString))); m->addContext("internet"); QTRY_COMPARE(conadd.count(), 1); QString contextid = conadd.takeFirst().at(0).toString(); QVERIFY(m->contexts().contains(contextid)); QOfonoConnectionContext* context = new QOfonoConnectionContext(this); context->setContextPath(contextid); QSignalSpy active(context, SIGNAL(activeChanged(bool))); QSignalSpy apn(context,SIGNAL(accessPointNameChanged(QString))); QSignalSpy name(context, SIGNAL(nameChanged(QString))); QSignalSpy type (context, SIGNAL(typeChanged(QString))); QSignalSpy uname (context, SIGNAL(usernameChanged(QString))); QSignalSpy pw (context, SIGNAL(passwordChanged(QString))); QSignalSpy proto (context, SIGNAL(protocolChanged(QString))); QSignalSpy sett (context, SIGNAL(settingsChanged(QVariantMap))); QSignalSpy sett6 (context, SIGNAL(IPv6SettingsChanged(QVariantMap))); context->setAccessPointName("hyva"); QTRY_COMPARE(apn.count(), 1); QCOMPARE(apn.takeFirst().at(0).toString(), QString("hyva")); context->setUsername("huomenta"); QTRY_COMPARE(uname.count(), 1); QCOMPARE(uname.takeFirst().at(0).toString(), QString("huomenta")); context->setPassword("HYVA"); QTRY_COMPARE(pw.count(), 1); QCOMPARE(pw.takeFirst().at(0).toString(), QString("HYVA")); context->setName("yota"); QTRY_COMPARE(name.count(), 1); QCOMPARE(name.takeFirst().at(0).toString(), QString("yota")); context->setType("mms"); QTRY_COMPARE(type.count(), 1); QCOMPARE(type.takeFirst().at(0).toString(), QString("mms")); context->setProtocol("ipv6"); QTRY_COMPARE(proto.count(), 1); QCOMPARE(proto.takeFirst().at(0).toString(), QString("ipv6")); context->setActive(true); QTRY_COMPARE(active.count(), 1); QCOMPARE(active.takeFirst().at(0).toBool(), true); QTRY_COMPARE(sett6.count(), 1); QCOMPARE(sett6.takeFirst().at(0).toMap()["Interface"].value<QString>().left(5), QString("dummy")); // "dummy" plus number QVariantMap settings = context->IPv6Settings(); QCOMPARE(settings["Interface"].value<QString>().left(5),QString("dummy")); // "dummy" plus number QTest::qWait(REASONABLE_TIMEOUT); QCOMPARE(apn.count(), 0); QCOMPARE(uname.count(), 0); QCOMPARE(pw.count(), 0); QCOMPARE(name.count(), 0); QCOMPARE(type.count(), 0); QCOMPARE(sett.count(), 0); QCOMPARE(proto.count(), 0); QCOMPARE(active.count(), 0); context->setActive(false); QTRY_COMPARE(active.count(), 1); QCOMPARE(active.takeFirst().at(0).toBool(), false); delete context; m->removeContext(contextid); QTRY_COMPARE(conrem.count(), 1); QCOMPARE(conrem.takeFirst().at(0).toString(), contextid); }
IconCfg::IconCfg(QWidget *parent, IconsPlugin *plugin) : IconCfgBase(parent) { m_plugin = plugin; unsigned i; for (i = 1; ; i++){ const char *n = plugin->getIconDLLs(i); if ((n == NULL) || (*n == 0)) break; string v = n; IconsDef d; d.protocol = getToken(v, ','); d.icon = v; d.index = -1; defs.push_back(d); } list<string> icons; Event e(EventGetIcons, &icons); e.process(); list<string> protocols; for (list<string>::iterator it = icons.begin(); it != icons.end(); ++it){ string name = (*it); int n = name.find('_'); char c = name[0]; if ((c < 'A') || (c > 'Z')) continue; if (n <= 0) continue; name = name.substr(0, n); list<string>::iterator its; for (its = protocols.begin(); its != protocols.end(); ++its) if ((*its) == name) break; if (its != protocols.end()) continue; protocols.push_back(name); } i = 0; for (list<string>::iterator its = protocols.begin(); its != protocols.end(); ++its, i++){ cmbProtocol->insertItem(i18n((*its).c_str())); list<IconsDef>::iterator it; for (it = defs.begin(); it != defs.end(); ++it){ if ((*it).protocol == (*its)){ (*it).index = i; break; } } if (it == defs.end()){ IconsDef d; d.protocol = (*its); d.index = i; defs.push_back(d); } } connect(cmbProtocol, SIGNAL(activated(int)), this, SLOT(protocolChanged(int))); cmbProtocol->setCurrentItem(0); protocolChanged(0); lblMore->setUrl("http://miranda-im.org/download/index.php?action=display&id=35"); #ifdef WIN32 edtIcon->setStartDir(QFile::decodeName(app_file("icons/").c_str())); #else edtIcon->setStartDir(QFile::decodeName(user_file("icons/").c_str())); #endif edtIcon->setTitle(i18n("Select icons DLL")); edtIcon->setFilePreview(createPreview); #ifdef USE_KDE edtIcon->setFilter(i18n("*.dll|Icons themes")); #else edtIcon->setFilter(i18n("Icons themes (*.dll)")); #endif lblMore->setText(i18n("Get more icons themes")); connect(edtIcon, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&))); for (QObject *p = parent; p != NULL; p = p->parent()){ if (!p->inherits("QTabWidget")) continue; QTabWidget *tab = static_cast<QTabWidget*>(p); m_smiles = new SmileCfg(tab, plugin); tab->addTab(m_smiles, i18n("Smiles")); tab->adjustSize(); break; } }