void ElevationProfileFloatItem::switchDataSource(ElevationProfileDataSource* source)
{
    disconnect(m_activeDataSource, SIGNAL(dataUpdated(GeoDataLineString,QList<QPointF>)),0,0);
    m_activeDataSource = source;
    connect(m_activeDataSource, SIGNAL(dataUpdated(GeoDataLineString,QList<QPointF>)), this, SLOT(handleDataUpdate(GeoDataLineString,QList<QPointF>)));
    m_activeDataSource->requestUpdate();
}
示例#2
0
bool Hdd::addVisualization(const QString& source)
{
    Plasma::Meter *w;
    Plasma::DataEngine *engine = dataEngine("soliddevice");
    Plasma::DataEngine::Data data;

    if (!engine) {
        return false;
    }
    if (!isValidDevice(source, &data)) {
        // do not try to show hard drives and swap partitions.
        return false;
    }
    QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Horizontal);
    layout->setContentsMargins(3, 3, 3, 3);
    layout->setSpacing(5);

    w = new Plasma::Meter(this);
    w->setMeterType(Plasma::Meter::BarMeterHorizontal);
    if (mode() != SM::Applet::Panel) {
        MonitorIcon *icon = new MonitorIcon(this);
        m_icons.insert(source, icon);
        icon->setImage("drive-harddisk");
        if (data["Accessible"].toBool()) {
            QStringList overlays;
            overlays << QString("emblem-mounted");
            icon->setOverlays(overlays);
        }
        layout->addItem(icon);
    } else {
        w->setSvg("system-monitor/hdd_panel");
    }
    w->setLabel(0, hddTitle(source, data));
    w->setLabelAlignment(0, Qt::AlignVCenter | Qt::AlignLeft);
    w->setLabelAlignment(1, Qt::AlignVCenter | Qt::AlignRight);
    w->setLabelAlignment(2, Qt::AlignVCenter | Qt::AlignCenter);
    w->setMaximum(data["Size"].toULongLong() / (1024 * 1024));
    applyTheme(w);
    appendVisualization(source, w);
    layout->addItem(w);
    mainLayout()->addItem(layout);
    dataUpdated(source, data);
    setPreferredItemHeight(layout->preferredSize().height());

    QString disk = data["Parent UDI"].toString();

    m_diskMap[disk] << w;
    if (!connectedSources().contains(disk)) {
        data = engine->query(disk);
        dataUpdated(disk, data);
        connectSource(disk);
    }
    return true;
}
QGeoPositionInfoSourceWinCE::QGeoPositionInfoSourceWinCE(QObject *parent)
    : QGeoPositionInfoSource(parent)
{
    QGeoInfoValidator *validator = new QGeoPositionInfoValidator();

    // The QGeoInfoThreadWinCE instance takes ownership of the validator.
    infoThread = new QGeoInfoThreadWinCE(validator, true, this);
    infoThread->start();
    // QGeoInfoThreadWinCE takes care of registering GPS_POSITION as a metatype.
    connect(infoThread, SIGNAL(dataUpdated(GPS_POSITION)), this, SLOT(dataUpdated(GPS_POSITION)));
    connect(infoThread, SIGNAL(updateTimeout()), this, SIGNAL(updateTimeout()));
}
示例#4
0
void SongkickApplet::connectSource( const QString& source )
{
    if( source == "ontour" )
    {
        dataEngine( "amarok-songkick" )->connectSource( source, this );
        dataUpdated( source, dataEngine("amarok-songkick" )->query( "ontour" ) );
    }
    else if( source == "dates" )
    {
        dataEngine( "amarok-songkick" )->connectSource( source, this );
        dataUpdated( source, dataEngine("amarok-songkick" )->query( "dates" ) );
    }
}
示例#5
0
/*---------------------------------------------------------------------------
* neue Statistikseite einfuegen
*---------------------------------------------------------------------------*/
void MainWindow::on_actionNeuStatistik_triggered()
{
   DtaStatsFrame *f = new DtaStatsFrame(&data,ui->tabWidget);
   connect( this, SIGNAL(dataChanged()), f, SLOT(dataUpdated()));
   int idx = ui->tabWidget->addTab( f, QIcon(), tr("Statistik %1").arg(tabStatisticsCount++));
   ui->tabWidget->setCurrentIndex(idx);
}
示例#6
0
/*---------------------------------------------------------------------------
* neues Diagramm einfuegen
*---------------------------------------------------------------------------*/
void MainWindow::on_actionNeuDiagramm_triggered()
{
   DtaPlotFrame *f = new DtaPlotFrame(&data, ui->tabWidget);
   connect( this, SIGNAL(dataChanged()), f, SLOT(dataUpdated()));
   int idx = ui->tabWidget->addTab( f, QIcon(), tr("Diagramm %1").arg(tabDiagramCount++));
   ui->tabWidget->setCurrentIndex(idx);
}
示例#7
0
void SignalRelay::timerEvent(QTimerEvent *event)
{
    if (event->timerId() != m_timerId) {
        QObject::timerEvent(event);
        return;
    }

    if (m_resetTimer) {
        killTimer(m_timerId);
        m_timerId = startTimer(m_interval);
        m_resetTimer = false;
    }

    if (m_align != Plasma::NoAlignment) {
        checkAlignment();
    }

    emit dc->updateRequested(dc);
    if (d->hasUpdates()) {
        //kDebug() << "emitting data updated directly" << d->data;
        emit dataUpdated(dc->objectName(), d->data);
        m_queued = false;
    } else {
        // the source wasn't actually updated; so let's put ourselves in the queue
        // so we get a dataUpdated() call when the data does arrive
        //kDebug() << "queued";
        m_queued = true;
    }
}
示例#8
0
/*---------------------------------------------------------------------------
* neue Kompressor-Starts-Seite einfuegen
*---------------------------------------------------------------------------*/
void MainWindow::on_actionNeuKompStarts_triggered()
{
   DtaCompStartsFrame *f = new DtaCompStartsFrame(&data,ui->tabWidget);
   connect( this, SIGNAL(dataChanged()), f, SLOT(dataUpdated()));
   int idx = ui->tabWidget->addTab( f, QIcon(), tr("Verdichter Starts %1").arg(tabCompStartsCount++));
   ui->tabWidget->setCurrentIndex(idx);
}
示例#9
0
GpsdRawDataViewer::GpsdRawDataViewer(QWidget *parent)
    : QWidget(parent)
{
    host = QString();
    port = 0;
    format = Gpsd::None;
    
    ui.setupUi(this);
    
    ui.rawDataFormat->addItem("None", QVariant((int)Gpsd::None));
    ui.rawDataFormat->addItem("JSON", QVariant((int)Gpsd::Json));
    ui.rawDataFormat->addItem("NMEA", QVariant((int)Gpsd::Nmea));
    ui.rawDataFormat->addItem("Raw", QVariant((int)Gpsd::Hex));
    
    ui.rawDataClear->setDefaultAction(ui.actionClear);
    ui.rawDataCopy->setDefaultAction(ui.actionCopy);
    ui.rawDataSave->setDefaultAction(ui.actionSave);
    
    connect(ui.wrapText, SIGNAL(toggled(bool)), this, SLOT(wrapText(bool)));
    connect(ui.actionClear, SIGNAL(triggered(bool)), ui.rawDataViewer, SLOT(clear()));
    connect(ui.actionCopy, SIGNAL(triggered(bool)), this, SLOT(copyToClipboard()));
    connect(ui.actionSave, SIGNAL(triggered(bool)), this, SLOT(saveToFile()));
    connect(ui.rawDataFormat, SIGNAL(activated(int)), this, SLOT(switchFormat(int)));
    connect(&gpsd, SIGNAL(dataUpdated()), this, SLOT(updateData()));
}
示例#10
0
//update the choices of the variable, called on variable thread from the var_AddCallback callback
//calling vlcValToVariant is safe here as m_type will only be modified when no callbacks is registred
int VLCVarChoiceModel::updateData(const vlc_object_t* object, const vlc_value_t& oldvalue, const vlc_value_t& newvalue)
{
    QVariant oldvalueVariant = vlcValToVariant(oldvalue);
    QVariant newvalueVariant = vlcValToVariant(newvalue);

    emit dataUpdated(object, oldvalueVariant, newvalueVariant, QPrivateSignal{});
    return VLC_SUCCESS;
}
示例#11
0
void ArtistsModel::handleDataUpdate()
{
  if (!updateSignaled())
  {
    setUpdateSignaled(true);
    dataUpdated();
  }
}
void
TextSourceDataModel::
onTextEdited(QString const &string)
{
  Q_UNUSED(string);

  emit dataUpdated(0);
}
示例#13
0
ATCDetailsWindow::ATCDetailsWindow(QWidget* _parent) :
    QWidget(_parent) {
  setupUi(this);
  UserInterface::setWindowPosition(this);

  connect(ShowButton, SIGNAL(clicked()), this, SLOT(__handleShowClicked()));
  connect(VatsinatorApplication::getSingletonPtr(), SIGNAL(dataUpdated()),
          this,       SLOT(__updateData()));
}
示例#14
0
void AccountShared::setProtocolName(QString protocolName)
{
	ensureLoaded();

	ProtocolName = protocolName;
	useProtocolFactory(ProtocolsManager::instance()->byName(protocolName));

	dataUpdated();
}
ProjectProxyModel::ProjectProxyModel(ProjectModel* project, QObject* parent) : QAbstractItemModel(parent)
{
    this->project = project;
    QList<QVariant> rootData;
    rootData << "Name" << "ID" << "Client" << "Total Time" << "Total Cost" << "Archived";
    rootItem = new ProjectModelItem(rootData);
    this->setupModelData(rootItem);

    this->connect(project, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(dataUpdated(QModelIndex, QModelIndex)));
}
示例#16
0
void Albums::saveConfiguration()
{
    Amarok::config("Albums Applet").writeEntry( "RecentlyAdded", QString::number( m_recentCount ) );
    Amarok::config("Albums Applet").writeEntry( "RightAlignLength", m_rightAlignLength );

    // clear to force an update
    m_albums.clear();

    Plasma::DataEngine::Data data = dataEngine( "amarok-current" )->query( "albums" );
    dataUpdated( QLatin1String("albums"), data );
}
void DBusSystemTrayTask::updateWidgets()
{
    if (Plasma::DataContainer *c = m_dataEngine->containerForSource(m_serviceName)) {
        // fairly inneficient as it updates _all_ icons!
        Plasma::DataEngine::Data data = c->data();
        data["IconsChanged"] = true;
        data["StatusChanged"] = true;
        data["ToolTipChanged"] = true;
        dataUpdated(m_serviceName, data);
    }
}
示例#18
0
ModuleManager::ModuleManager() :
    __airportTracker(new AirportTracker()),
    __flightTracker(new FlightTracker()),
    __modelsMatcher(new ModelMatcher()),
    __vatbookHandler(new VatbookHandler()) {
  connect(VatsinatorApplication::getSingletonPtr(), SIGNAL(glInitialized()),
          this,                                     SLOT(__initAfterGL()),
          Qt::DirectConnection);
  connect(VatsinatorApplication::getSingletonPtr(), SIGNAL(dataUpdated()),
          this,                                     SLOT(updateData()),
          Qt::DirectConnection);
}
示例#19
0
void AccountShared::setId(const QString &id)
{
	ensureLoaded();

	if (Id == id)
		return;

	Id = id;
	AccountContact.setId(id);

	dataUpdated();
}
void ElevationProfileFloatItem::handleDataUpdate(const GeoDataLineString &points, QList<QPointF> eleData)
{
    m_eleData = eleData;
    m_points = points;
    calculateStatistics( m_eleData );
    if ( m_eleData.length() >= 2 ) {
        m_axisX.setRange( m_eleData.first().x(), m_eleData.last().x() );
        m_axisY.setRange( qMin( m_minElevation, qreal( 0.0 ) ), m_maxElevation );
    }

    emit dataUpdated();
}
ControlAlgorithm::ControlAlgorithm(QObject *parent) :
    QObject(parent)
{

    //TODO: point to already created kiteColorTracker instead of making new one
    // kiteColorTracker = new KiteColorTracker(this);

    imageProcessingWindow = new ImageProcessing();


    kiteColorTracker = imageProcessingWindow->getColorTracker();
    kiteColorTracker->setSampleRate(1);

    // call update whenever a new position computed by kiteColorTracker
    connect(kiteColorTracker,SIGNAL(dataUpdated()),this,SLOT(update()));


    // initialize start and end points for left/right paths



    //set quadrant parameters
    OUTER_GRID_OFFSET_X=50;
    OUTER_GRID_OFFSET_Y=25;
    POWER_ZONE_X=100;
    POWER_ZONE_Y=100;
    initGrid();

    // initialize PID controller
    Kp = 1.0;
    Ki =  0.0;
    Kd = 0.0;
    interval = 0.01; // in seconds

    pid = new PID(Kp,Ki,Kd,interval);
    pid->setMode(1.0); // 1 Automatic, 0 Manual
    pid->setSetPoint(0.0);    // setpoint will always be 0 degrees relative to current heading
    pid->setInputLimits(-45.0,45.0);
    pid->setOutputLimits(0.0,30.0); // turning values
    pid->setProcessValue(10.0); // initialize input to be 0 so no error


    // timer for pid loop
    // timer will be started by a user input that we are now tracking the kite
    pidTimer = new QTimer;
    pidTimer->setInterval(interval*1000);   // convert from s to ms
    connect(pidTimer,SIGNAL(timeout()),this,SLOT(updatePID()));
    //pidTimer->start();

    autoPilotOn = false;

}
示例#22
0
void MainWindow::addRefuel()
{
	// assign to locals
	QSqlQuery query;
	quint32 odometer = ui->spinOdometer->value();
	quint32 curtime = ui->dteTime->dateTime().toTime_t();
	QString state = ui->comboCurState->currentText();
	double gal = ui->spinGallons->value();
	double cost = ui->spinCost->value();
	Command entry = {"Refuels", odometer, state};
	
	// obviously, INSERT INTO Refuels table
	query.prepare("INSERT INTO Refuels (Date,Odometer,State,Volume,Cost) "
			   "VALUES (:date, :odo, :state, :vol, :cost);");
	query.bindValue(":date", curtime);
	query.bindValue(":odo", odometer);
	query.bindValue(":state", state);
	query.bindValue(":vol", gal);
	query.bindValue(":cost", cost);
	query.exec();
	
	// add entry to undo stack
	undoStack.push(entry);
	
	// update the states fields with the results of the refuel
	query.prepare("UPDATE States SET "
               "NumRefuels= (SELECT COUNT(*) FROM Refuels WHERE State=:state1), "
               "GasAmt= (SELECT SUM(Volume) FROM Refuels WHERE State=:state2), "
               "PurchaseAmt= (SELECT SUM(Cost) FROM Refuels WHERE State=:state3) "
               "WHERE Abbrev=:state4;");
	query.bindValue(":state1", state);
	query.bindValue(":state2", state);
	query.bindValue(":state3", state);
	query.bindValue(":state4", state);
	query.exec();
	//addToLog( QString("%1: %2").arg(query.lastError().number()).arg(query.lastError().text()));
	
	emit dataUpdated();

	addToLog(QString("%1 [%L2]: You bought %3 gallons of gas for $%4 in %5.")
		.arg(QDateTime::fromTime_t(curtime).toString(dtFormat))
		.arg(odometer)
		.arg(gal, 0, 'f', 2)
		.arg(cost, 0, 'f', 2)
		.arg(state)
	);
	
	// update widgets
	ui->dteTime->setTime( ui->dteTime->time().addSecs(60) );
	ui->action_Undo->setEnabled(true);
}
示例#23
0
void MainWindow::undoLastCommand()
{
	// make sure that the stack isn't empty
	if( undoStack.isEmpty() ) return;
	
	// get the most recently executed command
	Command entry = undoStack.pop();
	QSqlQuery query;
	
	/*addToLog( QString("Command retrieved: %1, %2, %3")
	         .arg(entry.type).arg(entry.odometer).arg(entry.state) );*/
	
	// remove the entry from given table at given odometer reading
	if(entry.type=="Crossings") query.prepare("DELETE FROM Crossings WHERE Odometer= :odo");
	else query.prepare("DELETE FROM Refuels WHERE Odometer= :odo");
	query.bindValue( ":odo", entry.odometer );
	if( !query.exec() ){
		addToLog( query.lastQuery() );
		addToLog( QString("Error %1: %2").arg(query.lastError().number()).arg(query.lastError().text()));
		return;
	} else{
		addToLog( QString("Event at odometer %1 was removed from the set of %2.")
		         .arg(entry.odometer).arg(entry.type) );
	}
	query.clear();
	
	// update the states fields with the new state of the tables
	query.prepare("UPDATE States SET "
               "NumRefuels= (SELECT COUNT(*) FROM Refuels WHERE State=:state1), "
               "GasAmt= (SELECT SUM(Volume) FROM Refuels WHERE State=:state2), "
               "PurchaseAmt= (SELECT SUM(Cost) FROM Refuels WHERE State=:state3), "
               "Mileage= (SELECT SUM(Distance) FROM Crossings WHERE Origin=:state4), "
               "NumEntries= (SELECT COUNT(*) FROM Crossings WHERE Origin=:state5 AND Distance<>0) "
               "WHERE Abbrev=:state6;");
	query.bindValue(":state1", entry.state);
	query.bindValue(":state2", entry.state);
	query.bindValue(":state3", entry.state);
	query.bindValue(":state4", entry.state);
	query.bindValue(":state5", entry.state);
	query.bindValue(":state6", entry.state);
	
	if( !query.exec() ){
		addToLog( query.lastQuery() );
		addToLog( QString("Error %1: %2").arg(query.lastError().number()).arg(query.lastError().text()));
		return;
	}
	
	// tell the gui to update the tables
	if( undoStack.isEmpty() ) ui->action_Undo->setEnabled(false);
	emit dataUpdated();
}
示例#24
0
PlayerControl::PlayerControl(PlayerContainer* container, QObject* parent)
    : Plasma::Service(parent)
    , m_container(container)
{
    setObjectName(container->objectName() + QLatin1String(" controller"));
    setName("mpris2");
    setDestination(container->objectName());

    connect(container, SIGNAL(dataUpdated(QString,Plasma::DataEngine::Data)),
            this,      SLOT(updateEnabledOperations()));
    connect(container, SIGNAL(destroyed(QObject*)),
            this,      SLOT(containerDestroyed()));
    updateEnabledOperations();
}
示例#25
0
void DataContainer::connectVisualization(QObject *visualization, uint pollingInterval,
        Plasma::Types::IntervalAlignment alignment)
{
    //qCDebug(LOG_PLASMA) << "connecting visualization" <<this<< visualization << "at interval of"
    //         << pollingInterval << "to" << objectName();
    QMap<QObject *, SignalRelay *>::iterator objIt = d->relayObjects.find(visualization);
    bool connected = objIt != d->relayObjects.end();
    if (connected) {
        // this visualization is already connected. just adjust the update
        // frequency if necessary
        SignalRelay *relay = objIt.value();
        if (relay) {
            // connected to a relay
            //qCDebug(LOG_PLASMA) << "     already connected, but to a relay";
            if (relay->m_interval == pollingInterval && relay->m_align == alignment) {
                //qCDebug(LOG_PLASMA) << "    already connected to a relay of the same interval of"
                //          << pollingInterval << ", nothing to do";
                return;
            }

            if (relay->receiverCount() == 1) {
                //qCDebug(LOG_PLASMA) << "    removing relay, as it is now unused";
                d->relays.remove(relay->m_interval);
                delete relay;
            } else {
                if (visualization->metaObject()->indexOfSlot("dataUpdated(QString,Plasma::DataEngine::Data)") >= 0) {
                    disconnect(relay, SIGNAL(dataUpdated(QString,Plasma::DataEngine::Data)),
                               visualization, SLOT(dataUpdated(QString,Plasma::DataEngine::Data)));
                }
                //modelChanged is always emitted by the dataSource since there is no polling there
                if (visualization->metaObject()->indexOfSlot("modelChanged(QString,QAbstractItemModel*)") >= 0) {
                        disconnect(this, SIGNAL(modelChanged(QString,QAbstractItemModel*)),
                                visualization, SLOT(modelChanged(QString,QAbstractItemModel*)));
                }
                //relay->isUnused();
            }
        } else if (pollingInterval < 1) {
void DVRServersModel::cameraAdded(DVRCamera *camera)
{
    Q_ASSERT(camera);

    QModelIndex parent = indexForServer(camera->data().server());
    if (!parent.isValid())
        return;

    Item &it = m_items[parent.row()];

    connect(camera, SIGNAL(dataUpdated()), SLOT(cameraDataChanged()));

    beginInsertRows(parent, it.cameras.size(), it.cameras.size());
    it.cameras.append(camera);
    endInsertRows();
}
示例#27
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    this->time = 0;
    //ui->tabWidget->setEnabled(false);
    ui->Desconectar->setEnabled(false);

//    PlotHandler::plotProperties ppX;
//    ppX.setPlotFrame(ui->widgetX);
//    //ppX.setCentralWidget(ui->widgetX);
//    ppX.setTitle("Valor bruto");
//    ppX.setxLabel("Tempo");
//    ppX.setyLabel("Aceleração");
//    ppX.setyAxisRange(-0.5,0.5);
//    this->P1 = new PlotHandler::plot<double>(1,1,ppX);

//    PlotHandler::plotProperties ppY;
//    ppY.setPlotFrame(ui->widgetY);
//    //ppY.setCentralWidget(ui->widgetY);
//    ppY.setTitle("Filtro 1");
//    ppY.setxLabel("Tempo");
//    ppY.setyLabel("Aceleração");
//    ppY.setyAxisRange(-0.5,0.5);
//    this->P2 = new PlotHandler::plot<double>(1,1, ppY);

//    PlotHandler::plotProperties ppZ;
//    ppZ.setPlotFrame(ui->widgetZ);
//    //ppZ.setCentralWidget(ui->widgetZ);
//    ppZ.setTitle("Filtro 2");
//    ppZ.setxLabel("Tempo");
//    ppZ.setyLabel("Aceleração");
//    ppZ.setyAxisRange(-0.5,0.5);
//    this->P3 = new PlotHandler::plot<double>(1,1, ppZ);

    ac = new AccelHandler(QAccelerometer::Combined, 200);
    connect(ac, SIGNAL(dataUpdated()), this, SLOT(updatePlot()));

//    QTimer *timer = new QTimer(this);
//    timer->setInterval(1000);
//    connect(timer, SIGNAL(timeout()), this, SLOT(updatePlot()));
//    timer->start();
}
示例#28
0
void TableItem::setDataPackage(QByteArray message)
{
    QPoint position;
    QDataStream messageStream(message);
    messageStream >> name;
    messageStream >> position;
    messageStream >> fileHash;
    messageStream >> id;
    messageStream >> teamsHidden;
    messageStream >> teamsLocked;
    messageStream >> rotation;
    messageStream >> currentZPosition;
    messageStream >> ownerID;

    move(position);
    useDataFromStream(messageStream);
    emit dataUpdated();
}
AirportDetailsWindow::AirportDetailsWindow(QWidget* _parent) :
    QWidget(_parent),
    __currentICAO("") {
    setupUi(this);
    UserInterface::setWindowPosition(this);

    connect(MetarListModel::getSingletonPtr(),  SIGNAL(newMetarsAvailable()),
            this,                               SLOT(updateMetar()));

    connect(MetarListModel::getSingletonPtr(),  SIGNAL(noMetar(QString)),
            this,                               SLOT(updateMetar(QString)));

    connect(VatsinatorApplication::getSingletonPtr(), SIGNAL(dataUpdated()),
            this,                                     SLOT(__updateData()));

    connect(ShowButton, SIGNAL(clicked()),
            this,       SLOT(__handleShowClicked()));
}
示例#30
0
void AccountShared::setAccountIdentity(Identity accountIdentity)
{
	ensureLoaded();

	if (AccountIdentity == accountIdentity)
		return;

	/* NOTE: This guard is needed to avoid deleting this object when removing
	 * Account from Identity which may hold last reference to it and thus wants
	 * to delete it.
	 */
	Account guard(this);

	AccountIdentity.removeAccount(this);
	AccountIdentity = accountIdentity;
	AccountIdentity.addAccount(this);

	dataUpdated();
}