本文整理汇总了C++中Controller::config方法的典型用法代码示例。如果您正苦于以下问题:C++ Controller::config方法的具体用法?C++ Controller::config怎么用?C++ Controller::config使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Controller
的用法示例。
在下文中一共展示了Controller::config方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onDeviceChange
/**
* Called when a Leap Motion controller is plugged in, unplugged, or the device changes state.
*
* State changes include entering or leaving robust mode and low resource mode.
* Note that there is no direct way to query whether the device is in these modes,
* although you can use Controller::isLightingBad() to check if there are environmental
* IR lighting problems.
*
* \include Listener_onDeviceChange.txt
*
* @param controller The Controller object invoking this callback function.
* @since 1.2
*/
void CServerDriver_Leap::onDeviceChange(const Controller&controller)
{
DriverLog("CServerDriver_Leap::onDeviceChange()\n");
if (controller.isConnected())
{
bool backgroundModeAllowed = controller.config().getInt32("background_app_mode") == 2;
if (!backgroundModeAllowed) {
// TODO: Show dialog to request permission to allow background mode apps
bool userPermission = true;
if (userPermission) {
controller.config().setInt32("background_app_mode", 2);
controller.config().save();
}
}
controller.setPolicy(Leap::Controller::POLICY_OPTIMIZE_HMD);
controller.setPolicy(Leap::Controller::POLICY_BACKGROUND_FRAMES);
// make sure we always get background frames even when we lose the focus to another
// Leap-enabled application
controller.setPolicy((Leap::Controller::PolicyFlag)(15));
// allow other background applications to receive frames even when SteamVR has the focus.
controller.setPolicy((Leap::Controller::PolicyFlag)(23));
ScanForNewControllers(true);
}
else
{
for (auto it = m_vecControllers.begin(); it != m_vecControllers.end(); ++it)
delete (*it);
m_vecControllers.clear();
}
}
示例2: onConnect
void LeapListener::onConnect(const Controller &controller){
controller.enableGesture(Gesture::TYPE_CIRCLE);
controller.enableGesture(Gesture::TYPE_SWIPE);
controller.config().setFloat("Gesture.Circle.MinRadius", 5.0);
controller.config().setFloat("Gesture.Circle.MinArc", 1.8 * PI);
controller.config().setFloat("Gesture.Swipe.MinLength", 150.0);
controller.config().setFloat("Gesture.Swipe.MinVelocity", 200);
controller.config().save();
printf("Leap Motion is Connected");
}
示例3:
void Leap::LeapListener::onConnect( const Controller& controller )
{
// we put our gestures here to initialize them
controller.enableGesture( Gesture::TYPE_CIRCLE );
controller.enableGesture( Gesture::TYPE_KEY_TAP );
//controller.enableGesture(Gesture::TYPE_SCREEN_TAP);
controller.enableGesture( Gesture::TYPE_SWIPE );
controller.config().setFloat( "Gesture.Swipe.MinLength",60.0f );
controller.config().setFloat( "Gesture.Circle.MinArc", 6.28f );
controller.config().save();
}
示例4: newInstance
ProviderPtr
ImporterManager::createProvider( QVariantMap config )
{
Controller *controller = Amarok::Components::statSyncingController();
// First, get rid of the old provider instance. Note: the StatSyncing::Config
// remembers the provider by the id, even when it's unregistered. After this
// block, old instance should be destroyed, its destructor called.
if( config.contains( "uid" ) )
{
const QString providerId = config.value( "uid" ).toString();
if( m_providers.contains( providerId ) )
{
ProviderPtr oldProvider = m_providers.take( providerId );
if( controller )
controller->unregisterProvider( oldProvider );
}
}
// Create a concrete provider using the config. The QueuedConnection in connect()
// is important, because on reconfigure we *destroy* the old provider instance
ImporterProviderPtr provider = newInstance( config );
if( !provider )
{
warning() << __PRETTY_FUNCTION__ << "created provider is null!";
return provider;
}
connect( provider.data(), SIGNAL(reconfigurationRequested(QVariantMap)),
SLOT(createProvider(QVariantMap)), Qt::QueuedConnection);
m_providers.insert( provider->id(), provider );
// Register the provider
if( controller )
{
controller->registerProvider( provider );
// Set provider to offline
if( Config *config = controller->config() )
{
config->updateProvider( provider->id(), provider->prettyName(),
provider->icon(), /*online*/ false );
config->save();
}
}
// Save the settings
KConfigGroup group = providerConfig( provider );
group.deleteGroup();
foreach( const QString &key, provider->m_config.keys() )
group.writeEntry( key, provider->m_config.value( key ) );
group.sync();
return provider;
}
示例5: main
Q_DECL_EXPORT int main(int argc, char* argv[])
{
//QApplication::setGraphicsSystem("native");
QApplication app(argc, argv);
app.setProperty("NoMStyle", true);
QDir::setCurrent(app.applicationDirPath());
std::cerr<<"Begin "<<std::endl;
std::cerr<<app.applicationDirPath().toStdString().c_str()<<std::endl;
std::cerr<<"End "<<std::endl;
QString str = QDir::currentPath();
std::cerr<<str.toStdString().c_str()<<std::endl;
str.truncate(str.length()-4);
Core::AbstractConfig::prefix = str.toStdString();
QDir::setCurrent(QDir::currentPath());
/*
//Set up a graphics scene with a QGraphicsWidget and Layout
QGraphicsView view;
QGraphicsScene scene;
QGraphicsWidget *widget = new QGraphicsWidget();
QGraphicsGridLayout *layout = new QGraphicsGridLayout;
layout->setSpacing(0);
widget->setLayout(layout);
scene.addItem(widget);
view.setScene(&scene);
*/
//Add the QML snippet into the layout
// QString locale = QLocale::system().name();
// std::cerr<<"locale: "<<locale.toStdString()<<std::endl;
//ConfigQml *config;
//
Controller *controller;
/*
QTranslator translator;
translator.load("ru.qml", "i18n");
app.installTranslator(&translator);
*/
controller = new Controller();
/* Locale */
for (unsigned int i=1; i<controller->config()->languagesList().size(); i++){
if (controller->config()->languagesList().at(i).first == controller->config()->Language()){
setlocale (LC_ALL, controller->config()->languagesList().at(i).second.c_str());
setlocale (LC_MESSAGES, controller->config()->languagesList().at(i).second.c_str());
QLocale::setDefault(QLocale(controller->config()->languagesList().at(i).second.c_str()));
}
}
textdomain("omweather");
bindtextdomain("omweather", "/opt/com.meecast.omweather/share/locale");
/* D-BUS */
DbusAdaptor* dadapt = new DbusAdaptor(controller);
QDBusConnection connection = QDBusConnection::sessionBus();
connection.registerService("org.meego.omweather");
connection.registerObject("/org/meego/omweather", controller);
//config = controller->config();
//std::cerr<<"iconpath = "<<config->imagespath().toStdString() << std::endl;
//update_weather_forecast(config);
QDeclarativeView *qview;
qview = controller->qview();
std::cerr << "qml path = " << Core::AbstractConfig::layoutqml << std::endl;
qview->setSource(QUrl::fromLocalFile(QString::fromStdString(Core::AbstractConfig::prefix +
Core::AbstractConfig::sharePath +
Core::AbstractConfig::layoutqml)));
QObject::connect((QObject*)qview->engine(), SIGNAL(quit()), &app, SLOT(quit()));
qview->showFullScreen();
/*This code provides Segmantation fault
delete dadapt;
delete controller;
*/
return app.exec();
}