TEST_F(NetworkStateNotifierTest, RemoveSoleObserverWhileNotifying) { StateObserver observer1; m_notifier.addObserver(&observer1, executionContext()); removeObserverOnNotification(&observer1, &observer1); setConnection(WebConnectionTypeBluetooth, kBluetoothMaxBandwidthMbps); EXPECT_TRUE(verifyObservations(observer1, WebConnectionTypeBluetooth, kBluetoothMaxBandwidthMbps)); setConnection(WebConnectionTypeEthernet, kEthernetMaxBandwidthMbps); EXPECT_TRUE(verifyObservations(observer1, WebConnectionTypeBluetooth, kBluetoothMaxBandwidthMbps)); }
void APMToolBar::connectMAV() { qDebug() << "APMToolBar: connectMAV "; if (LinkManager::instance()->getSerialLinks().count() > 0) { bool result; bool connected = LinkManager::instance()->getSerialLinks().last()->isConnected(); if (connected) { // result need to be the opposite of success. result = !LinkManager::instance()->getSerialLinks().last()->disconnect(); } else { // Need to Connect Link result = LinkManager::instance()->getSerialLinks().last()->connect(); } qDebug() << "result = " << result; // Change the image to represent the state setConnection(result); emit MAVConnected(result); } else { // No Link so prompt to connect one MainWindow::instance()->addLink(); } }
Session::Session ( const std::string& sqliteDb ) : connection_ ( sqliteDb ) { connection_.setProperty ( "show-queries", "true" ); setConnection ( connection_ ); mapClass<User> ( "user" ); mapClass<AuthInfo> ( "auth_info" ); mapClass<AuthInfo::AuthIdentityType> ( "auth_identity" ); mapClass<AuthInfo::AuthTokenType> ( "auth_token" ); try { createTables(); std::cerr << "Created database." << std::endl; } catch ( std::exception& e ) { std::cerr << e.what() << std::endl; std::cerr << "Using existing database"; } users_ = new UserDatabase ( *this ); }
void LocalSocketClient::connectToServer(const QString &serverName) { if (m_connection && m_connection->isOpen()) { if (m_connection->connectionString() == serverName) { return; } else { m_connection->close(); delete m_connection; m_connection = NULL; } } // New connection if (m_connection == NULL) { if (serverName.isEmpty()) { return; } else { LocalSocketConnection *connection = new LocalSocketConnection(this, serverName); setConnection(connection); connection->open(); connection->start(); } } }
void MediaWindow::addComponents() { //bottom button box buttonlab->addWidget(btn_play); buttonlab->addWidget(btn_pause); buttonlab->addWidget(btn_stop); buttonlab->addWidget(slider_Seek); buttonlab->addWidget(btn_volume); buttonlab->addWidget(slider_Volume); //top button box buttonlab2->addWidget(btn_open); buttonlab2->addWidget(btn_settings); buttonlab2->addWidget(btn_minmax); buttonlab2->addWidget(btn_close); //middle video widget videolab->addWidget(video_widget); //main layout setup mainlab->addLayout(buttonlab2); mainlab->addLayout(videolab); mainlab->addLayout(buttonlab); //show whole things setLayout(mainlab); //add signal and slots setConnection(); }
QDBusProxy::QDBusProxy(const QDBusConnection& connection, QObject* parent, const char* name) : QObject(parent, (name ? name : "QDBusProxy")), d(new Private()) { setConnection(connection); }
void MServiceListener::startListening(bool nameHasOwnerCheck) { if (listeningStarted) return; listeningStarted = true; // if we were initialized without a connection, we have to create our own if (connection == 0) { if (busType == QDBusConnection::SystemBus) { connection = new QDBusConnection(QDBusConnection::systemBus()); } else if (busType == QDBusConnection::SessionBus) { connection = new QDBusConnection(QDBusConnection::sessionBus()); } else { return; } } // set the connection + watched service name to the QDBusServiceWatcher // base object; now it will start to watch setConnection(*connection); // Check if the service is already there if (nameHasOwnerCheck) { if (connection->isConnected() == false) { setServiceGone(); return; } QDBusPendingCall nameHasOwnerCall = connection->interface()->asyncCall("NameHasOwner", busName); QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(nameHasOwnerCall, this); sconnect(watcher, SIGNAL(finished(QDBusPendingCallWatcher *)), this, SLOT(onNameHasOwnerFinished(QDBusPendingCallWatcher *))); } }
void finalPass(FILE *file, Rule *rules, int rules_number) { char buffer[BUFFER_LENGTH]; int i, j, c; fseek(file, 0, SEEK_SET); c = extractLine(file, BUFFER_LENGTH, buffer); for(i=0; i<rules_number;i++) { while(c!='[') c = extractLine(file, BUFFER_LENGTH, buffer); c = extractLine(file, BUFFER_LENGTH, buffer); for(j=0; j<rules[i].connections_number; j++) { setConnection(buffer, rules, rules_number, i, j); c = extractLine(file, BUFFER_LENGTH, buffer); } for(j=0; j<rules[i].symbols_number; j++) { setSymbol(buffer, &rules[i], j); c = extractLine(file, BUFFER_LENGTH, buffer); } rules[i].connections_total_weight = 0; for(j=0;j<rules[i].connections_number;j++) rules[i].connections_total_weight+=rules[i].connections_weight[j]; rules[i].symbols_total_weight = 0; for(j=0;j<rules[i].symbols_number;j++) rules[i].symbols_total_weight+=rules[i].symbols_weight[j]; } }
void DeviceExplorerControl::on_documentChanged( iscore::Document* olddoc, iscore::Document* newdoc) { if(olddoc) { auto doc_plugin = olddoc->model().pluginModel<DeviceDocumentPlugin>(); doc_plugin->setConnection(false); } if(newdoc) { auto doc_plugin = newdoc->model().pluginModel<DeviceDocumentPlugin>(); doc_plugin->setConnection(true); } }
APMToolBar::APMToolBar(QWidget *parent): QDeclarativeView(parent), m_uas(0) { // Configure our QML object // Hack to fix QTBUG 34300 on OSX where QDir::currentPath has changed behavior. This causes // relative paths to inside the .app package to fail. #ifdef Q_OS_MAC bool test123; QString qmlFile = QApplication::applicationDirPath(); qmlFile.append("/qml/ApmToolBar.qml"); setSource(QUrl::fromLocalFile(qmlFile)); #else setSource(QUrl::fromLocalFile("qml/ApmToolBar.qml")); #endif setResizeMode(QDeclarativeView::SizeRootObjectToView); this->rootContext()->setContextProperty("globalObj", this); connect(LinkManager::instance(),SIGNAL(newLink(LinkInterface*)), this, SLOT(updateLinkDisplay(LinkInterface*))); if (LinkManager::instance()->getLinks().count()>=3) { updateLinkDisplay(LinkManager::instance()->getLinks().last()); } setConnection(false); connect(UASManager::instance(),SIGNAL(activeUASSet(UASInterface*)),this,SLOT(activeUasSet(UASInterface*))); activeUasSet(UASManager::instance()->getActiveUAS()); }
void ConfigConnection::on_btnOk_clicked() { if (ui->edtServer->text().isEmpty()) { QMessageBox::information(this,"","The Server field can not be empty!"); ui->edtServer->setFocus(); } else if (ui->edtUsuario->text().isEmpty()) { QMessageBox::information(this,"","The User field can not be empty!"); ui->edtUsuario->setFocus(); } else if (ui->edtDatabase->text().isEmpty()) { QMessageBox::information(this,"","The Database field can not be empty!"); ui->edtDatabase->setFocus(); } else { writeSettings(); if (setConnection()) { ui->stackedWidget->setCurrentIndex(1); laycan->setLogFilePath(ui->edtLogFilePath->text()); laycan->setAutoCommit(false); if (!laycan->Migrate(":/Migrations.json")) { QMessageBox::critical(this,"",laycan->lastError()); return; } MainWindow *m = new MainWindow(); m->setAttribute(Qt::WA_DeleteOnClose); m->showMaximized(); this->close(); } } }
QXcbBackingStore::QXcbBackingStore(QWindow *window) : QPlatformBackingStore(window) , m_image(0) , m_syncingResize(false) { QXcbScreen *screen = static_cast<QXcbScreen *>(window->screen()->handle()); setConnection(screen->connection()); }
QXcbWindowSurface::QXcbWindowSurface(QWidget *widget, bool setDefaultSurface) : QWindowSurface(widget, setDefaultSurface) , m_image(0) , m_syncingResize(false) { QXcbScreen *screen = static_cast<QXcbScreen *>(QPlatformScreen::platformScreenForWidget(widget)); setConnection(screen->connection()); }
void toToolWidget::parentConnection(void) { try { setConnection(toConnection::currentConnection(parentWidget())); } TOCATCH }
SR865::SR865(const QString &portName, const int &new_baudrate) { this->serial = nullptr; this->srs = nullptr; init(); setConnection(portName, new_baudrate); }
TEST_F(NetworkStateNotifierTest, RemoveSoleObserver) { StateObserver observer1; m_notifier.addObserver(&observer1, executionContext()); m_notifier.removeObserver(&observer1, executionContext()); setConnection(WebConnectionTypeBluetooth, kBluetoothMaxBandwidthMbps); EXPECT_TRUE(verifyObservations(observer1, WebConnectionTypeNone, kNoneMaxBandwidthMbps)); }
TEST_F(NetworkStateNotifierTest, MultipleContextsAddObserver) { StateObserver observer1, observer2; m_notifier.addObserver(&observer1, executionContext()); m_notifier.addObserver(&observer2, executionContext2()); setConnection(WebConnectionTypeBluetooth, kBluetoothMaxBandwidthMbps); EXPECT_TRUE(verifyObservations(observer1, WebConnectionTypeBluetooth, kBluetoothMaxBandwidthMbps)); EXPECT_TRUE(verifyObservations(observer2, WebConnectionTypeBluetooth, kBluetoothMaxBandwidthMbps)); }
TEST_F(NetworkStateNotifierTest, AddObserver) { StateObserver observer; m_notifier.addObserver(&observer, executionContext()); EXPECT_TRUE(verifyObservations(observer, WebConnectionTypeNone, kNoneMaxBandwidthMbps)); setConnection(WebConnectionTypeBluetooth, kBluetoothMaxBandwidthMbps); EXPECT_TRUE(verifyObservations(observer, WebConnectionTypeBluetooth, kBluetoothMaxBandwidthMbps)); EXPECT_EQ(observer.callbackCount(), 1); }
TEST_F(NetworkStateNotifierTest, AddObserverWhileNotifying) { StateObserver observer1, observer2; m_notifier.addObserver(&observer1, executionContext()); addObserverOnNotification(&observer1, &observer2); setConnection(WebConnectionTypeBluetooth, kBluetoothMaxBandwidthMbps); EXPECT_TRUE(verifyObservations(observer1, WebConnectionTypeBluetooth, kBluetoothMaxBandwidthMbps)); EXPECT_TRUE(verifyObservations(observer2, WebConnectionTypeBluetooth, kBluetoothMaxBandwidthMbps)); }
QDBusProxy::QDBusProxy(const QString& service, const QString& path, const QString& interface, const QDBusConnection& connection, QObject* parent, const char* name) : QObject(parent, (name ? name : "QDBusProxy")), d(new Private()) { setConnection(connection); d->service = service; d->path = path; d->interface = interface; d->checkCanSend(); }
bool SR865::changeBaudrate(const int &new_baudrate) { if (!isValidBaudrate(new_baudrate)) return false; if (!this->serial->isOpen()) { this->serial->setBaudRate((qint32) new_baudrate); return true; } else { this->serial->close(); return setConnection(this->serial->portName(), new_baudrate); } }
ClusterConnectionListWidgetItemContainer::ClusterConnectionListWidgetItemContainer(core::IClusterSettingsBaseSPtr connection, QTreeWidgetItem* parent) : QTreeWidgetItem(parent), connection_() { setConnection(connection); auto nodes = connection_->nodes(); for (size_t i = 0; i < nodes.size(); ++i) { core::IConnectionSettingsBaseSPtr con = nodes[i]; ConnectionListWidgetItem* item = new ConnectionListWidgetItem(this); item->setConnection(con); addChild(item); } }
LogWindow :: LogWindow( QWidget* parent ) : QMainWindow( parent ){ setWindowTitle( "Log Journal" ); fileName = ""; nameLabel = new QLabel( "File Name: " + fileName, this ); resultLabel = new QLabel( "Last Result : " + QString::number( 0 ) ); myCalcDialog = new Calculator( this ); createActions(); createMenu(); createCentralText(); createStatusBar(); setConnection(); }
IsPassLeakedSession::IsPassLeakedSession(const std::string& connInfo) : connection_(connInfo) { try { connection_.connect(DbConn); } catch (std::exception& e) { std::cerr << e.what() << std::endl; } setConnection(connection_); mapClass<User>("user"); }
MyClass::MyClass(QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags) { ui.setupUi(this); setConnection(); loadConfigAddCourseTab(); conn = database::connectByC(); dbFile = new databaseFile(); loadListCourseTab(); loadOriginConfig(); loadConfigClass(); loadDataAddClassTab(0); loadListClassTab(); }
SentinelConnectionListWidgetItemContainer::SentinelConnectionListWidgetItemContainer(core::ISentinelSettingsBaseSPtr connection, QTreeWidgetItem* parent) : QTreeWidgetItem(parent), connection_() { setConnection(connection); core::ISentinelSettingsBase::sentinel_connections_t sentinels = connection_->sentinels(); for (size_t i = 0; i < sentinels.size(); ++i) { core::SentinelSettings sent = sentinels[i]; SentinelConnectionWidgetItem* item = new SentinelConnectionWidgetItem(core::MASTER, this); item->setConnection(sent.sentinel); addChild(item); for (size_t j = 0; j < sent.sentinel_nodes.size(); ++j) { core::IConnectionSettingsBaseSPtr con = sent.sentinel_nodes[j]; ConnectionListWidgetItem* child = new ConnectionListWidgetItem(item); child->setConnection(con); item->addChild(child); } } }
Updater::Updater() : QProgressDialog(), lib(NETWORK) { typedef Network* (*NetworkConstructor)(); NetworkConstructor constructor = (NetworkConstructor) lib.resolve("getNetwork"); if(constructor) net = constructor(); downloadedFiles = 0; FilesMessageSize = 0; NamesMessageSize = 0; ToDoMessageSize = 0; FilesNumber = 0; downloaded = false; this->setLabelText("Téléchargement de la mise à jour en cours..."); this->setCancelButtonText("&Annuler"); this->setAutoClose(false); this->setAutoReset(false); this->setWindowTitle("Updater"); connect(net, SIGNAL(connected()), this, SLOT(setConnection())); connect(this, SIGNAL(canceled()), this, SLOT(stop())); net->tryConnection("multifacile.no-ip.org", 8090); }
PlACloud::PlACloud(Application* apps) { app = apps; // set up the widgets widget.setupUi(this); // filling the forms fillSettingsPage(); // calling funcion for creating connections setConnection(); connectFilePage(); connectConfigPage(); connectSettingsPage(); // first page after start is page with User config widget.ownCloudStackedWidget->setCurrentIndex(2); // try network connection if (app->isNetworkConnection()) { enableClouding(); } else { disableClouding(); } }
Session::Session(const std::string& db) { auto connection = Wt::cpp14::make_unique<Wt::Dbo::backend::Sqlite3>(db); connection->setProperty("show-queries", "true"); setConnection(std::move(connection)); mapClass<User>("user"); mapClass<IssuedToken>("issued_token"); mapClass<OAuthClient>("oauth_client"); mapClass<AuthInfo>("auth_info"); mapClass<AuthInfo::AuthIdentityType>("auth_identity"); mapClass<AuthInfo::AuthTokenType>("auth_token"); try { createTables(); std::cerr << "Created database." << std::endl; } catch (std::exception& e) { std::cerr << e.what() << std::endl; std::cerr << "Using existing database"; } users_ = Wt::cpp14::make_unique<OidcUserDatabase>(*this); }
DepthInternalWidget::DepthInternalWidget(Clocker *_clocker, COM_PORT *com_port, QWidget *parent /* = 0 */) : ui(new Ui::InternalDepthMeter) { ui->setupUi(this); this->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding); QFont tab_font_control = ui->tabWidget->tabBar()->font(); tab_font_control.setBold(false); ui->tabWidget->tabBar()->setFont(tab_font_control); ui->ledDepth->setStyleSheet("QLineEdit { color: darkGreen }"); ui->chboxDepth->setStyleSheet("QCheckBox { color: darkblue }"); ui->chboxRate->setStyleSheet("QCheckBox { color: darkblue }"); ui->chboxTension->setStyleSheet("QCheckBox { color: darkblue }"); ui->chboxMLabels->setStyleSheet("QCheckBox { color: darkblue }"); ui->cboxDepth->setStyleSheet("QComboBox { color: darkblue }"); ui->cboxRate->setStyleSheet("QComboBox { color: darkblue }"); ui->cboxTension->setStyleSheet("QComboBox { color: darkblue }"); ui->label->setStyleSheet("QLabel { color: darkblue }"); ui->label_2->setStyleSheet("QLabel { color: darkblue }"); ui->label_3->setStyleSheet("QLabel { color: darkblue }"); ui->label_4->setStyleSheet("QLabel { color: darkblue }"); ui->gboxAlarm->setStyleSheet("QGroupBox { color: darkblue }"); ui->chboxInversion->setStyleSheet("QCheckBox { color: darkblue }"); ui->dsboxClockMult->setStyleSheet("QDoubleSpinBox { color: darkGreen }"); ui->sboxClocksAver->setStyleSheet("QSpinBox { color: darkGreen }"); ui->ledMinDepth->setStyleSheet("QLineEdit { color: darkGreen }"); ui->ledMaxDepth->setStyleSheet("QLineEdit { color: darkGreen }"); ui->cboxMinDepth->setStyleSheet("QComboBox { color: darkblue }"); ui->cboxMaxDepth->setStyleSheet("QComboBox { color: darkblue }"); ui->pbtConnect->setIconSize(QSize(16,16)); ui->pbtConnect->setText(tr("Connect to Depth Meter")); ui->pbtConnect->setIcon(QIcon(":/images/add.png")); QFont pbt_font = ui->pbtConnect->font(); pbt_font.setBold(false); ui->pbtConnect->setFont(pbt_font); QFont font2 = ui->ledMinDepth->font(); font2.setBold(true); ui->ledMinDepth->setFont(font2); ui->ledMaxDepth->setFont(font2); QFont font3 = ui->dsboxClockMult->font(); font3.setBold(true); ui->dsboxClockMult->setFont(font3); ui->sboxClocksAver->setFont(font3); QFont font4 = ui->ledDepth->font(); font4.setBold(true); ui->ledDepth->setFont(font4); depth_units_list << "m" << "ft"; rate_units_list << "m/hr" << "m/s"<< "ft/s" << "ft/hr"; tension_units_list << "kgf"; k_depth = 1; k_rate = 3600; k_tension = 1; ui->cboxDepth->addItems(depth_units_list); ui->cboxRate->addItems(rate_units_list); ui->cboxTension->addItems(tension_units_list); ui->cboxMinDepth->addItems(depth_units_list); ui->cboxMaxDepth->addItems(depth_units_list); ui->chboxDepth->setChecked(true); ui->chboxRate->setChecked(false); ui->chboxTension->setChecked(false); ui->cboxDepth->setEnabled(true); ui->cboxRate->setEnabled(true); ui->cboxTension->setEnabled(true); is_connected = false; device_is_searching = false; clocker = _clocker; COM_Port = com_port; depth_communicator = NULL; timer.start(1000); setConnection(); }