当前位置: 首页>>代码示例>>C++>>正文


C++ QNetworkConfiguration::name方法代码示例

本文整理汇总了C++中QNetworkConfiguration::name方法的典型用法代码示例。如果您正苦于以下问题:C++ QNetworkConfiguration::name方法的具体用法?C++ QNetworkConfiguration::name怎么用?C++ QNetworkConfiguration::name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QNetworkConfiguration的用法示例。


在下文中一共展示了QNetworkConfiguration::name方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: init

bool AutoConnect::init() {
    QList<QNetworkConfiguration> configurations = mManager.allConfigurations ( QNetworkConfiguration::Defined );

    QNetworkConfiguration config;
    foreach(config, configurations) {
        qDebug() << "Network: " << config.name();
        if (config.name() == mSSID) {
            mConnectConfig = config;
        }
    }
开发者ID:pthimon,项目名称:autoconnect,代码行数:10,代码来源:autoconnect.cpp

示例2: comparison

void tst_QNetworkConfiguration::comparison()
{
    //test copy constructor and assignment operator
    //compare invalid connection points
    QNetworkConfiguration pt1;
    QVERIFY(!pt1.isValid());
    QVERIFY(pt1.type() == QNetworkConfiguration::Invalid);

    QNetworkConfiguration pt2(pt1);
    QVERIFY(pt1==pt2);
    QVERIFY(!(pt1!=pt2));
    QVERIFY(pt1.name() == pt2.name());
    QVERIFY(pt1.isValid() == pt2.isValid());
    QVERIFY(pt1.type() == pt2.type());
    QVERIFY(pt1.state() == pt2.state());
    QVERIFY(pt1.purpose() == pt2.purpose());


    QNetworkConfiguration pt3;
    pt3 = pt1;
    QVERIFY(pt1==pt3);
    QVERIFY(!(pt1!=pt3));
    QVERIFY(pt1.name() == pt3.name());
    QVERIFY(pt1.isValid() == pt3.isValid());
    QVERIFY(pt1.type() == pt3.type());
    QVERIFY(pt1.state() == pt3.state());
    QVERIFY(pt1.purpose() == pt3.purpose());

    //test case must run on machine that has valid connection points
    QNetworkConfigurationManager manager;
    QList<QNetworkConfiguration> preScanConfigs = manager.allConfigurations();

    QSignalSpy spy(&manager, SIGNAL(updateCompleted()));
    manager.updateConfigurations(); //initiate scans
    QTRY_VERIFY_WITH_TIMEOUT(spy.count() == 1, TestTimeOut); //wait for scan to complete

    QList<QNetworkConfiguration> configs = manager.allConfigurations(QNetworkConfiguration::Discovered);
    QVERIFY(configs.count());
    QNetworkConfiguration defaultConfig = manager.defaultConfiguration();
    QVERIFY(defaultConfig.isValid());
    QVERIFY(defaultConfig.type() != QNetworkConfiguration::Invalid);
    QVERIFY(!defaultConfig.name().isEmpty());

    pt3 = defaultConfig;
    QVERIFY(defaultConfig==pt3);
    QVERIFY(!(defaultConfig!=pt3));
    QVERIFY(defaultConfig.name() == pt3.name());
    QVERIFY(defaultConfig.isValid() == pt3.isValid());
    QVERIFY(defaultConfig.type() == pt3.type());
    QVERIFY(defaultConfig.state() == pt3.state());
    QVERIFY(defaultConfig.purpose() == pt3.purpose());
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:52,代码来源:tst_qnetworkconfiguration.cpp

示例3: networkConfigurationChanged

/** @short Some of the configuration profiles have changed

This can be some completely harmelss change, like user editting an inactive profile of some random WiFi network.
Unfortunately, this is also the only method in which the Qt's NetworkManager plugin informs us about a switch
from eth0 to wlan0.

There's apparently no better signal, see http://lists.qt-project.org/pipermail/interest/2013-December/010374.html

*/
void SystemNetworkWatcher::networkConfigurationChanged(const QNetworkConfiguration &conf)
{
    bool reconnect = false;

    if (conf == sessionsActiveConfiguration() && !conf.state().testFlag(QNetworkConfiguration::Active) &&
            conf != m_netConfManager->defaultConfiguration() && m_netConfManager->defaultConfiguration().isValid()) {
        // Change of the "session's own configuration" which is not a default config of the system (anymore?), and the new default
        // is something valid.
        // I'm seeing (Qt 5.5-git, Linux, NetworkManager,...) quite a few of these as false positives on a random hotel WiFi.
        // Let's prevent a ton of useless reconnects here by only handling this if the system now believes that a default session
        // is something else.
        m_model->logTrace(0, Common::LOG_OTHER, QStringLiteral("Network Session"),
                          QStringLiteral("Change of configuration of the current session (%1); current default session is %2")
                          .arg(conf.name(), m_netConfManager->defaultConfiguration().name()));
        reconnect = true;
    } else if (conf.state().testFlag(QNetworkConfiguration::Active) && conf.type() == QNetworkConfiguration::InternetAccessPoint &&
               conf != sessionsActiveConfiguration() && conf == m_netConfManager->defaultConfiguration()) {
        // We are going to interpret this as a subtle hint for switching to another session

        if (m_session->configuration().type() == QNetworkConfiguration::UserChoice && !sessionsActiveConfiguration().isValid()) {
            // No configuration has been assigned yet, just ignore this event. This happens on Harmattan when we get a change
            // of e.g. an office WiFi connection in reply to us trying to open a session with the system's default configuration.
            m_model->logTrace(0, Common::LOG_OTHER, QStringLiteral("Network Session"),
                              QStringLiteral("No configuration has been assigned yet, let's wait for it"));
            return;
        }

        m_model->logTrace(0, Common::LOG_OTHER, QStringLiteral("Network Session"),
                          m_session->configuration().type() == QNetworkConfiguration::InternetAccessPoint ?
                              QStringLiteral("Change of system's default configuration: %1. Currently using %2.")
                              .arg(conf.name(), m_session->configuration().name())
                            :
                              QStringLiteral("Change of system's default configuration: %1. Currently using %2 (active: %3).")
                              .arg(conf.name(), m_session->configuration().name(), sessionsActiveConfiguration().name()));
        reconnect = true;
    }

    if (reconnect) {
        m_model->setNetworkPolicy(NETWORK_OFFLINE);
        resetSession();
        if (m_session->configuration().isValid()) {
            m_session->open();
        } else {
            m_model->logTrace(0, Common::LOG_OTHER, QStringLiteral("Network Session"),
                              QStringLiteral("Waiting for network to become available..."));
        }
    }
}
开发者ID:ChristopherCotnoir,项目名称:trojita,代码行数:57,代码来源:SystemNetworkWatcher.cpp

示例4: validWlanConfiguration

/*!
  Returns true if \a configuration is a valid WLAN network configuration.
  False otherwise.
*/
bool ConnectionManager::validWlanConfiguration(
        QNetworkConfiguration &configuration) const
{
    bool valid =
#ifdef Q_OS_SYMBIAN
            (configuration.isValid() &&
             configuration.bearerType() == QNetworkConfiguration::BearerWLAN);
#else
            (configuration.isValid() &&
             (configuration.bearerType() == QNetworkConfiguration::BearerWLAN
              || configuration.type() == QNetworkConfiguration::ServiceNetwork));
#endif

    if (valid) {
        qDebug() << "ConnectionManager::validWlanConfiguration():"
                 << configuration.name()
                 << configuration.bearerTypeName()
                 << configuration.bearerType()
                 << configuration.type()
                 << configuration.state()
                 << configuration.isValid();
    }

    return valid;
}
开发者ID:Alex237,项目名称:tic-tac-toe-qt,代码行数:29,代码来源:connectionmanager.cpp

示例5: updateItem

static void updateItem(QTreeWidgetItem *item, const QNetworkConfiguration &config)
{
    item->setText(0, config.name());
    item->setData(0, Qt::UserRole, config.identifier());

    QFont font = item->font(1);
    font.setBold((config.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active);
    item->setFont(0, font);
}
开发者ID:Andreas665,项目名称:qt,代码行数:9,代码来源:bearermonitor.cpp

示例6: printNetworkConfigStatus

void ConnectionManagerPrivate::printNetworkConfigStatus(const QNetworkConfiguration &config) {

    qDebug() << "Bearer:" << config.bearerTypeName();
    qDebug() << "Roaming available:" << config.isRoamingAvailable();
    qDebug() << "Valid:" << config.isValid();
    qDebug() << "Name:" << config.name();
    qDebug() << "Purpose:" << config.purpose();
    qDebug() << "State:" << config.state();
    qDebug() << "Type:" << config.type();
}
开发者ID:arcean,项目名称:webupload-engine,代码行数:10,代码来源:connectionmanager.cpp

示例7: configurationChanged

void BearerEx::configurationChanged(const QNetworkConfiguration & config)
{
    QListWidgetItem* listItem = new QListWidgetItem();
    QString state;
    switch (config.state())
    {
        case QNetworkConfiguration::Undefined:
            state = "Undef : ";
            break;
        case QNetworkConfiguration::Defined:
            state = "Def : ";
            break;
        case QNetworkConfiguration::Discovered:
            state = "Disc : ";
            break;
        case QNetworkConfiguration::Active:
            state = "Act : ";
            break;
    }
    listItem->setText(state+config.name());
    eventListWidget->addItem(listItem);
}
开发者ID:tsuibin,项目名称:emscripten-qt,代码行数:22,代码来源:bearerex.cpp

示例8: invalidPoint

void tst_QNetworkConfiguration::invalidPoint()
{
    QNetworkConfiguration pt;

    QVERIFY(pt.name().isEmpty());
    QVERIFY(!pt.isValid());
    QVERIFY(pt.type() == QNetworkConfiguration::Invalid);
    QVERIFY(!(pt.state() & QNetworkConfiguration::Defined));
    QVERIFY(!(pt.state() & QNetworkConfiguration::Discovered));
    QVERIFY(!(pt.state() & QNetworkConfiguration::Active));
    QVERIFY(!pt.isRoamingAvailable());

    QNetworkConfiguration pt2(pt);
    QVERIFY(pt2.name().isEmpty());
    QVERIFY(!pt2.isValid());
    QVERIFY(pt2.type() == QNetworkConfiguration::Invalid);
    QVERIFY(!(pt2.state() & QNetworkConfiguration::Defined));
    QVERIFY(!(pt2.state() & QNetworkConfiguration::Discovered));
    QVERIFY(!(pt2.state() & QNetworkConfiguration::Active));
    QVERIFY(!pt2.isRoamingAvailable());

}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:22,代码来源:tst_qnetworkconfiguration.cpp

示例9: networkConfigIsQualified

bool ServiceDiscovery::networkConfigIsQualified(const QNetworkConfiguration &config)
{
    switch (config.bearerType()) {
    case QNetworkConfiguration::BearerEthernet:
    case QNetworkConfiguration::BearerWLAN:
        return true;
    case QNetworkConfiguration::BearerUnknown: // unknown is usually ethernet or any other local network
        return !config.name().contains("Teredo");
    case QNetworkConfiguration::Bearer2G:
    case QNetworkConfiguration::BearerBluetooth:
    case QNetworkConfiguration::BearerCDMA2000:
    case QNetworkConfiguration::BearerEVDO:
    case QNetworkConfiguration::BearerWCDMA:
    case QNetworkConfiguration::BearerHSPA:
    case QNetworkConfiguration::Bearer3G:
    case QNetworkConfiguration::BearerWiMAX:
    case QNetworkConfiguration::BearerLTE:
    case QNetworkConfiguration::Bearer4G:
        return false;
    }

    return false; // can never be reached
}
开发者ID:strahlex,项目名称:QtQuickVcp,代码行数:23,代码来源:servicediscovery.cpp

示例10: configurationRemoved

void BearerEx::configurationRemoved(const QNetworkConfiguration& config)
{
    QListWidgetItem* listItem = new QListWidgetItem();
    listItem->setText(QString("Removed: ")+config.name());
    eventListWidget->addItem(listItem);
}
开发者ID:tsuibin,项目名称:emscripten-qt,代码行数:6,代码来源:bearerex.cpp

示例11: printConfigurationDetails

void printConfigurationDetails(const QNetworkConfiguration& p)
{
    qDebug() << p.name() <<":  isvalid->" <<p.isValid() << " type->"<< p.type() <<
                " roaming->" << p.isRoamingAvailable() << "identifier->" << p.identifier() <<
                " purpose->" << p.purpose() << " state->" << p.state();
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:6,代码来源:tst_qnetworkconfigurationmanager.cpp


注:本文中的QNetworkConfiguration::name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。