コード例 #1
0
ファイル: mainwindow.cpp プロジェクト: metthal/ITU-Projekt
void MainWindow::on_actionOpen_triggered()
{
    QString newDbPath = QFileDialog::getOpenFileName(this, "Open database", QDir::homePath(), "Database Files (*.sqlite)");
    if (newDbPath == "")
        return;

    mgr->storeDatabase(currentDbPath);
    WifiManager* newMgr = new WifiManager(_db);

    try
    {
        newMgr->loadDatabase(newDbPath);
        newMgr->loadDevices();

        if (!newMgr->devices().empty())
            newMgr->loadNetworks(mgr->devices()[0]);

        currentDbPath = newDbPath;
        mgr = newMgr;

        // Disconnect all current signals
        disconnect(this, SLOT(onPropertyChanged()));
        // Reconnect new signals
        for (WifiNetwork* network : newMgr->networks())
            connect(network, SIGNAL(propertiesChanged()), this, SLOT(onPropertyChanged()));
    }
    catch(Exception& e)
    {
        KMessageBox::error(this, "Database failed to open.");
    }

    ui->networkList->clear();
    _orderItems();
}
コード例 #2
0
ファイル: qofonomodem.cpp プロジェクト: martyone/libqofono
void QOfonoModem::connectOfono()
{
    bool wasValid = isValid();
    if (d_ptr->modem) {
        delete d_ptr->modem;
        d_ptr->modem = NULL;
        if (!d_ptr->properties.isEmpty()) {
            QStringList keys = d_ptr->properties.keys();
            d_ptr->properties.clear();
            for (int i=0; i<keys.size(); i++) {
                propertyChanged(keys[i], QVariant());
            }
        }
    }
    if (!d_ptr->modemPath.isEmpty()) {
        OfonoModem* modem = new OfonoModem("org.ofono", d_ptr->modemPath, QDBusConnection::systemBus(), this);
        if (modem->isValid()) {
            d_ptr->modem = modem;
            connect(new QDBusPendingCallWatcher(modem->GetProperties(), modem),
                SIGNAL(finished(QDBusPendingCallWatcher*)),
                SLOT(onGetPropertiesFinished(QDBusPendingCallWatcher*)));
            connect(modem,
                SIGNAL(PropertyChanged(QString,QDBusVariant)),
                SLOT(onPropertyChanged(QString,QDBusVariant)));
        } else {
コード例 #3
0
ファイル: mainwindow.cpp プロジェクト: metthal/ITU-Projekt
void MainWindow::_init()
{
    _db = new DatabaseSQLite(this);
    currentDbPath = QDir::homePath() + "/WifiMgr.sqlite";

    mgr = new WifiManager(_db);
    try
    {
        mgr->loadDatabase(currentDbPath);
    }
    catch(Exception& e)
    {
        KMessageBox::error(this, "Database failed to open.");
    }
    mgr->loadDevices();

    if (mgr->devices().empty())
        KMessageBox::error(this, "No wireless devices found.");
    else
        mgr->loadNetworks(mgr->devices()[0]);

    for (WifiNetwork* network : mgr->networks())
        connect(network, SIGNAL(propertiesChanged()), this, SLOT(onPropertyChanged()));

    ui->networkList->setStyleSheet("KListWidget { background-color: rgb(176,224,230); }");

    _showOOR = true;
    ui->actionToggle_OOR->setText("Hide unavailable");

    filter = new KeyEventFilter(this);
    ui->networkList->installEventFilter(filter);

    _orderItems();
}
コード例 #4
0
NetworkRegistrationWatcher::NetworkRegistrationWatcher(const QString path, QObject *parent) :
    ModemWatcher(path, OfonoConstants::OFONO_NETWORKREGISTRATION_INTERFACE, parent)
{
    QDBusConnection::systemBus().connect(OfonoConstants::OFONO_SERVICE, objectPath(),
                                         interface(), "PropertyChanged",
                                         this, SLOT(onPropertyChanged(QString, QDBusVariant)));

    QObject::connect(this, SIGNAL(interfaceAvailableChanged(bool)),
                     this, SLOT(getPropertiesAsync()));
}
コード例 #5
0
void ReflectionObject::notifyPropertyChange( const std::string& propertyName )
{
    // find the field in this or the parent types
    ReflectionTypeComponent* propertyField = NULL;
    {
        std::vector< const SerializableReflectionType* > types;
        types.push_back( &getVirtualRTTI() );

        while( !types.empty() )
        {
            const SerializableReflectionType* analyzedType = types.back();
            types.pop_back();

            propertyField = analyzedType->findMemberField( propertyName );
            if ( propertyField != NULL )
            {
                // found it !!!
                break;
            }

            // collect parent types for further analysis
            analyzedType->collectParents( types );
        }
    }

    if ( !propertyField )
    {
        // this field doesn't exist
        return;
    }

    ReflectionProperty* property = propertyField->createProperty( this );

    // notify the object itself
    onPropertyChanged( *property );

    // notify the listeners
    uint listenersCount = m_listener.size();
    for ( uint i = 0; i < listenersCount; ++i )
    {
        m_listener[i]->onPropertyChanged( *property );
    }

    // cleanup
    delete property;
}
コード例 #6
0
void Camera::setIsDraw(const bool isDraw)
{
	m_isDraw=isDraw;
	emit onPropertyChanged(this);
}
コード例 #7
0
void Camera::setIsShowInfo(const bool isShowInfo)
{
	m_isShowInfo=isShowInfo;
	emit onPropertyChanged(this);
}
コード例 #8
0
void Camera::setUp(const GGL::Point3f &up)
{
	m_up=up;
	emit onPropertyChanged(this);
}
コード例 #9
0
void Camera::setTo(const GGL::Point3f &to)
{
	m_to=to;
	emit onPropertyChanged(this);
}
コード例 #10
0
void Camera::setFrom(const GGL::Point3f &from)
{
	m_from=from;
	emit onPropertyChanged(this);
}
コード例 #11
0
void Camera::setNearPlane(const float nearPlane)
{
	m_nearPlane=nearPlane;
	emit onPropertyChanged(this);
}
コード例 #12
0
void Camera::setFarPlane(const float farPlane)
{
	m_farPlane=farPlane;
	emit onPropertyChanged(this);
}
コード例 #13
0
void Camera::setFov(const float fov)
{
	m_fov=fov;
	emit onPropertyChanged(this);
}
コード例 #14
0
void Camera::setCameraName(const QString &cameraName)
{
	m_cameraName=cameraName;
	emit onPropertyChanged(this);
}
コード例 #15
0
NetworkRegistrationWatcher::~NetworkRegistrationWatcher()
{
    QDBusConnection::systemBus().disconnect(OfonoConstants::OFONO_SERVICE, objectPath(),
                                            interface(), "PropertyChanged",
                                            this, SLOT(onPropertyChanged(QString, QDBusVariant)));
}