本文整理汇总了C++中AppSettings::fixturePath方法的典型用法代码示例。如果您正苦于以下问题:C++ AppSettings::fixturePath方法的具体用法?C++ AppSettings::fixturePath怎么用?C++ AppSettings::fixturePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppSettings
的用法示例。
在下文中一共展示了AppSettings::fixturePath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main( int argc, char* argv[] )
{
QApplication app(argc, argv);
LOGGER.setLevel( 3 );
LOGGER.setOutput( Logger::Console );
LOG( 1, "Pixout ArtNet Viewer" );
LOG( 1, "viewer Version: %s ", VERSION );
const QString settings_path = QDir::fromNativeSeparators(
QStandardPaths::writableLocation( QStandardPaths::AppLocalDataLocation ) + QDir::separator()
);
// create settings location if not exists
QDir ().mkdir( settings_path );
AppSettings settings;
if( argc < 3 )
{
if( !settings.load( settings_path + "app.data") )
{
WARN("Can't open or empty fixture file: %s", qPrintable(settings_path + "app.data") );
}
}
else {
settings.setProperty("port", atoi( argv[1] ));
settings.setProperty("fixturePath", argv[2]);
settings.setProperty("position", argv[3]);
}
QQmlApplicationEngine engine;
app.setWindowIcon(QIcon(":favicon.png"));
engine.addImportPath( QStringLiteral("qrc:/"));
qmlRegisterType<PainterOutput>("Painter", 1, 0, "PainterItem");
qmlRegisterUncreatableType<AppSettings,1>("AppSettings",1,0,"AppSettings","AppSettings couldn't be created from QML");
engine.rootContext()->setContextProperty("settings", &settings);
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
QObject *rootObject = engine.rootObjects().first();
Q_ASSERT( rootObject );
PainterOutput *output( rootObject->findChild<PainterOutput*>( "painter" ) );
Q_ASSERT( output );
Painter painter( output, &settings );
PixelMapperWithError mapper( &settings );
painter.SetPixelMapper( &mapper );
Receiver receiver( &settings );
QObject::connect( &receiver, &Receiver::Received, &painter, &Painter::Draw );
QObject::connect( &painter, &Painter::ReadyToOutput, output, &PainterOutput::Process );
QObject::connect( &mapper, &PixelMapper::OnResize, &painter, &Painter::Resize );
QObject::connect( &mapper, &PixelMapper::OnResize, output, &PainterOutput::setCellSize );
QObject::connect( &settings, &AppSettings::fixturePathChanged, &mapper, &PixelMapperWithError::Reload );
QObject::connect( &settings, &AppSettings::portChanged, &receiver, &Receiver::Reconnect );
QObject::connect( &settings, &AppSettings::positionChanged, &painter, &Painter::RePosition );
if( !settings.fixturePath().isEmpty() )
mapper.Reload();
else
WARN("Pixel mapping empty, skip" );
LOG(1, "Listening on port %u with pixel-mapping file %s and orientation %s",
settings.port(), qPrintable(settings.fixturePath()), painter.Orientation() == Painter::Vertical ? "vertical" : "horizontal" );
QQuickWindow *window = qobject_cast<QQuickWindow *>(rootObject);
Q_ASSERT( window );
window->show();
const int res = app.exec();
settings.Save( settings_path + "app.data" );
return res;
}