void Bubble::init() { m_svg->resize(geometry().width(), geometry().height()); m_sensorModel = new QStandardItemModel(this); connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(reloadTheme())); m_animator = new QTimer(this); m_animator->setInterval(75); connect(m_animator, SIGNAL(timeout()), this, SLOT(moveBubbles())); m_interpolator = new QTimeLine(m_speed, this); connect(m_interpolator, SIGNAL(frameChanged(int)), this, SLOT(interpolateValue())); m_engine = dataEngine("systemmonitor"); if (!m_engine->isValid()) { setFailedToLaunch(true, i18nc("@info:status The system monitor data engine could not be found or loaded", "Could not load the System Monitor data engine.")); } else { connect(m_engine, SIGNAL(sourceAdded(QString)), this, SLOT(connectSensor())); } configChanged(); m_bubbleRect = m_svg->elementSize("bubble"); }
/*! * \brief sets the sensor configuration and connects the sensor if specified. */ void StationInfoDialog::on_toolButton_ok_clicked() { if(ui->checkBox_connectionChanged->isChecked()){ if(OiFeatureState::getActiveFeature()->getStation()->sensorPad->instrument->getConnectionState()){ emit disconnectSensor(); } //OiFeatureState::getActiveFeature()->getStation()->startDisconnect(); initSensorConfiguration(); OiFeatureState::getActiveFeature()->getStation()->setInstrumentConfig(this->sensorConfig); QMessageBox msgBox; msgBox.setText("Sensor disconnected, because connection config changed."); msgBox.setInformativeText("Want to reconnect?"); msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); msgBox.setDefaultButton(QMessageBox::Ok); int ret = msgBox.exec(); switch (ret) { case QMessageBox::Ok: emit connectSensor(); break; case QMessageBox::Cancel: break; default: break; } //OiFeatureState::getActiveFeature()->getStation()->startConnect(OiFeatureState::getActiveFeature()->getStation()->getInstrumentConfig()->connConfig); }else{ initSensorConfiguration(); OiFeatureState::getActiveFeature()->getStation()->setInstrumentConfig(this->sensorConfig); } this->close(); }
void Bubble::reconnectSensor() { disconnectSensor(); connectSensor(); }