本文整理汇总了C++中qFatal函数的典型用法代码示例。如果您正苦于以下问题:C++ qFatal函数的具体用法?C++ qFatal怎么用?C++ qFatal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qFatal函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: true
/*!
forks the current Process
you can specify weather it will write a pidfile to /var/run/mydaemon.pid or not
if you specify true (the default) QxtDaemon will also try to lock the pidfile. If it can't get a lock it will assume another daemon of the same name is already running and exit
be aware that after calling this function all file descriptors are invalid. QFile will not detect the change, you have to explicitly close all files before forking.
return true on success
*/
bool QxtDaemon::daemonize(bool pidfile)
{
#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
if (!logfile->open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append))
qFatal("cannot open logfile %s", qPrintable(logfile->fileName()));
logfile->close();
if (pidfile)
{
QFile f("/var/run/" + m_name + ".pid");
if (!f.open(QIODevice::WriteOnly | QIODevice::Text))
qFatal("cannot open pidfile \"/var/run/%s.pid\"", qPrintable(m_name));
if (lockf(f.handle(), F_TEST, 0) < 0)
qFatal("can't get a lock on \"/var/run/%s.pid\". another instance is propably already running.", qPrintable(m_name));
f.close();
}
if (!logfile->open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append))
qFatal("cannot open logfile %s", qPrintable(logfile->fileName()));
logfile->close();
int i;
if (getppid() == 1) return true; /* already a daemon */
i = fork();
/* double fork.*/
if (i < 0) return false; /*fork error */
if (i > 0) exit(0); /*parent exits */
if (i < 0) return false; /*fork error */
if (i > 0) exit(0); /*parent exits */
/* child (daemon) continues */
setsid(); /* obtain a new process group */
for (i = getdtablesize();i >= 0;--i) close(i); /* close all descriptors */
#ifdef Q_OS_LINUX
::umask(027); /* some programmers don't understand security, so we set a sane default here */
#endif
::signal(SIGCHLD, SIG_IGN); /* ignore child */
::signal(SIGTSTP, SIG_IGN); /* ignore tty signals */
::signal(SIGTTOU, SIG_IGN);
::signal(SIGTTIN, SIG_IGN);
::signal(SIGHUP, QxtDaemon::signalHandler); /* catch hangup signal */
::signal(SIGTERM, QxtDaemon::signalHandler); /* catch kill signal */
if (pidfile)
{
int lfp =::open(qPrintable("/var/run/" + m_name + ".pid"), O_RDWR | O_CREAT, 0640);
if (lfp < 0)
qFatal("cannot open pidfile \"/var/run/%s.pid\"", qPrintable(m_name));
if (lockf(lfp, F_TLOCK, 0) < 0)
qFatal("can't get a lock on \"/var/run/%s.pid\". another instance is propably already running.", qPrintable(m_name));
QByteArray d = QByteArray::number(pid());
Q_UNUSED(::write(lfp, d.constData(), d.size()));
}
assert(logfile->open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append));
qInstallMsgHandler(QxtDaemon::messageHandler);
return true;
#else
return false;
#endif
}
开发者ID:MorS25,项目名称:OpenPilot,代码行数:78,代码来源:qxtdaemon.cpp
示例2: qFatal
void QAdoptedThread::run()
{
// this function should never be called
qFatal("QAdoptedThread::run(): Internal error, this implementation should never be called.");
}
开发者ID:FilipBE,项目名称:qtextended,代码行数:5,代码来源:qthread.cpp
示例3: qDebug
void XmlRpcServer::registerSlot( QObject *receiver, const char *slot, QByteArray path )
{
#ifdef DEBUG_XMLRPC
qDebug() << this << "registerSlot():" << receiver << slot;
#endif
/* skip code first symbol 1 from SLOT macro (from qobject.cpp) */
++slot;
/* find QMetaMethod.. */
const QMetaObject *mo= receiver->metaObject();
/* we need buf in memory for const char (from qobject.cpp) */
QByteArray method= QMetaObject::normalizedSignature( slot );
const char *normalized= method.constData();
int slotId= mo->indexOfSlot( normalized );
if ( slotId == -1 )
{
qCritical() << this << "registerSlot():" << receiver << normalized << "can't find slot";
qFatal( "programming error" );
}
QMetaMethod m= receiver->metaObject()->method( slotId );
bool isDefferedResult= !qstrcmp( m.typeName(), "DeferredResult*" );
if ( qstrcmp( m.typeName(), "QVariant") && !isDefferedResult )
{
qCritical() << this << "registerSlot():" << receiver << normalized
<< "rpc return type should be QVariant or DeferredResult*, but"
<< m.typeName();
qFatal( "programming error" );
}
foreach( QByteArray c, m.parameterTypes() ) if ( c != "QVariant" )
{
qCritical() << this << "registerSlot():" << receiver << normalized
<< "all parameters should be QVariant";
qFatal( "programming error" );
}
/* ok, now lets make just function name from our SLOT */
Q_ASSERT( method.indexOf( '(') > 0 );
method.truncate( method.indexOf( '(') );
if ( path[0] != '/' )
path.prepend( '/' );
if ( path[path.size() - 1] != '/' )
path.append( '/' );
method.prepend( path );
/* check if allready exists */
if ( callbacks.contains( method) )
{
qCritical() << this << "registerSlot():" << receiver << method
<< "allready registered, receiver" << callbacks[method];
qFatal( "programming error" );
}
callbacks[method]= IsMethodDeffered( receiver, isDefferedResult );
Methods &methods= objectMethods[receiver];
if ( methods.isEmpty() )
{
#ifdef DEBUG_XMLRPC
qDebug() << this << "registerSlot(): connecting SIGNAL(destroyed()) of" << receiver;
#endif
connect( receiver, SIGNAL( destroyed ( QObject * )), this, SLOT( slotReceiverDestroed ( QObject * )) );
}
开发者ID:shaosHumbleAccount,项目名称:qtxmlrpc,代码行数:66,代码来源:xmlrpcserver.cpp
示例4: QObject
QDeclarativeAnchors::QDeclarativeAnchors(QObject *parent)
: QObject(*new QDeclarativeAnchorsPrivate(0), parent)
{
qFatal("QDeclarativeAnchors::QDeclarativeAnchors(QObject*) called");
}
开发者ID:wpbest,项目名称:copperspice,代码行数:5,代码来源:qdeclarativeanchors.cpp
示例5: initialize
void initialize() override
{
OpenGLWindow::initialize();
//load shaders
{
QOpenGLShader vs(QOpenGLShader::Vertex);
vs.compileSourceFile("TessellationTerrain/main.vs.glsl");
mProgram.addShader(&vs);
QOpenGLShader tcs(QOpenGLShader::TessellationControl);
tcs.compileSourceFile("TessellationTerrain/main.tcs.glsl");
mProgram.addShader(&tcs);
QOpenGLShader tes(QOpenGLShader::TessellationEvaluation);
tes.compileSourceFile("TessellationTerrain/main.tes.glsl");
mProgram.addShader(&tes);
QOpenGLShader fs(QOpenGLShader::Fragment);
fs.compileSourceFile("TessellationTerrain/main.fs.glsl");
mProgram.addShader(&fs);
if (!mProgram.link())
qFatal("Error linking shaders");
}
//grab uniform locations
{
mUniforms.mvMatrix = mProgram.uniformLocation("mvMatrix");
mUniforms.mvpMatrix = mProgram.uniformLocation("mvpMatrix");
mUniforms.projMatrix = mProgram.uniformLocation("projMatrix");
mUniforms.dmapDepth = mProgram.uniformLocation("dmapDepth");
}
mVao.bind();
glPatchParameteri(GL_PATCH_VERTICES, 4);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
//build displacment map
{
QVector<GLubyte> displacmentMap;
displacmentMap.reserve(mSize*mSize);
std::srand(35456);
for (int i=0; i<mSize*mSize; i++)
displacmentMap.append(randInt(0, 255));
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
glTexStorage2D(GL_TEXTURE_2D, 1, GL_R8, mSize, mSize);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, mSize, mSize, GL_R, GL_UNSIGNED_BYTE, &displacmentMap[0]);
}
//load terrain texture
{
glActiveTexture(GL_TEXTURE1);
mTerrainTexture = QSharedPointer<QOpenGLTexture>(new QOpenGLTexture(QImage("./Common/dirt.png").mirrored()));
mTerrainTexture->setMinificationFilter(QOpenGLTexture::LinearMipMapLinear);
mTerrainTexture->setMagnificationFilter(QOpenGLTexture::Linear);
}
}
开发者ID:DanWatkins,项目名称:OpenGLStudy,代码行数:62,代码来源:TessellationTerrain.cpp
示例6: Q_onAssert
//****************************************************************************
void Q_onAssert(char_t const * const module, int loc) {
QS_ASSERTION(module, loc, 10000U); // send assertion info to the QS trace
qFatal("Assertion failed in module %s, location %d", module, loc);
}
开发者ID:alisonjoe,项目名称:qpcpp,代码行数:5,代码来源:bsp.cpp
示例7: qFatal
QString QFont::lastResortFont() const
{
qFatal("QFont::lastResortFont: Cannot find any reasonable font");
// Shut compiler up
return QString();
}
开发者ID:2011fuzhou,项目名称:vlc-2.1.0.subproject-2010,代码行数:6,代码来源:qfont_qws.cpp
示例8: qDebug
syncManagerType::syncManagerType(QDomElement element, bool verbose)
{
QString attributeStr;
verb = verbose;
// Parse value for SM type
if (element.text().compare("MBoxOut") == 0)
{
if (verb)
qDebug()<<"--SM type: MBoxOut";
smType = mailboxOut;
}
else if (element.text().compare("MBoxIn") == 0)
{
if (verb)
qDebug()<<"--SM type: MBoxIn";
smType = mailboxIn;
}
else if (element.text().compare("Outputs") == 0)
{
if (verb)
qDebug()<<"--SM type: Outputs";
smType = processDataOut;
}
else if (element.text().compare("Inputs") == 0)
{
if (verb)
qDebug()<<"--SM type: Inputs";
smType = processDataIn;
}
else
{
if (verb)
qDebug()<<"--SM type: Unused";
smType = unused;
phyStartAddr = 0;
length = 0;
controlRegister = 0;
enable = false;
virtualSM = false;
opOnly = false;
return;
}
attributeStr.clear();
attributeStr = element.attribute("StartAddress");
if (!attributeStr.isEmpty())
{
if (verb)
qDebug()<<"--Found start address with value:"<<attributeStr;
// since it would appear the default hex encoding is #x0000 then we need to catch this our selves
if ((attributeStr.at(0) == '#') && (attributeStr.at(1) == 'x'))
phyStartAddr = attributeStr.remove(0,2).toInt(0,16);
else
phyStartAddr = attributeStr.toInt(0,0);
}
else
qFatal("No start address found for sync manager");
attributeStr.clear();
attributeStr = element.attribute("ControlByte");
if (!attributeStr.isEmpty())
{
if (verb)
qDebug()<<"--Found ControlByte with value:"<<attributeStr;
// since it would appear the default hex encoding is #x0000 then we need to catch this our selves
if ((attributeStr.at(0) == '#') && (attributeStr.at(1) == 'x'))
controlRegister = attributeStr.remove(0,2).toInt(0,16);
else
controlRegister = attributeStr.toInt(0,0);
}
else
controlRegister = 0;
attributeStr.clear();
attributeStr = element.attribute("DefaultSize");
if (!attributeStr.isEmpty())
{
if (verb)
qDebug()<<"--Found DefaultSize with value:"<<attributeStr;
// since it would appear the default hex encoding is #x0000 then we need to catch this our selves
if ((attributeStr.at(0) == '#') && (attributeStr.at(1) == 'x'))
length = attributeStr.remove(0,2).toInt(0,16);
else
length = attributeStr.toInt(0,0);
}
else
length = 0;
attributeStr.clear();
attributeStr = element.attribute("Enable");
if (!attributeStr.isEmpty())
{
if (verb)
qDebug()<<"--Found Enable attribute with value:"<<attributeStr;
if ((attributeStr.at(0) == '#') && (attributeStr.at(1) == 'x'))
enable = attributeStr.remove(0,2).toInt(0,16) != 0;
else
enable = attributeStr.toInt(0,0) != 0;
}
//.........这里部分代码省略.........
开发者ID:alireza1405,项目名称:medulla,代码行数:101,代码来源:syncmanagertype.cpp
示例9: qFatal
void Platform::Assert(const char *c, const char *file, int line)
{
qFatal("Assertion [%s] failed at %s %d\n", c, file, line);
}
开发者ID:jzsun,项目名称:raptor,代码行数:4,代码来源:PlatQt.cpp
示例10: main
Q_DECL_EXPORT
#endif
int main(int argc, char *argv[])
{
#if defined(Q_WS_X11)
#if QT_VERSION >= 0x040800
QApplication::setAttribute(Qt::AA_X11InitThreads, true);
#else
XInitThreads();
QApplication::setAttribute(static_cast<Qt::ApplicationAttribute>(10), true);
#endif
#endif
QApplication *application;
QDeclarativeView *view;
#ifdef HARMATTAN_BOOSTER
application = MDeclarativeCache::qApplication(argc, argv);
view = MDeclarativeCache::qDeclarativeView();
#else
qWarning() << Q_FUNC_INFO << "Warning! Running without booster. This may be a bit slower.";
QApplication stackApp(argc, argv);
QmlApplicationViewer stackView;
application = &stackApp;
view = &stackView;
stackView.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
#endif
application->setQuitOnLastWindowClosed(true);
// FIXME uncommenting this will make UI not loaded
// QMozContext::GetInstance();
QString path;
QString urlstring;
QString qmlstring;
#ifdef __arm__
bool isFullscreen = true;
#else
bool isFullscreen = false;
#endif
#if !defined(Q_WS_MAEMO_5)
bool glwidget = true;
#else
bool glwidget = false;
#endif
QStringList arguments = application->arguments();
for (int i = 0; i < arguments.count(); ++i) {
QString parameter = arguments.at(i);
if (parameter == "-path") {
if (i + 1 >= arguments.count())
qFatal("-path requires an argument");
path = arguments.at(i + 1);
i++;
} else if (parameter == "-url") {
if (i + 1 >= arguments.count())
qFatal("-url requires an argument");
urlstring = arguments.at(i + 1);
i++;
} else if (parameter == "-qml") {
if (i + 1 >= arguments.count())
qFatal("-qml requires an argument");
qmlstring = arguments.at(i + 1);
i++;
} else if (parameter == "-fullscreen") {
isFullscreen = true;
} else if (parameter == "-no-glwidget") {
glwidget = false;
} else if (parameter == "-glwidget") {
glwidget = true;
} else if (parameter == "-help") {
qDebug() << "EMail application";
qDebug() << "-fullscreen - show QML fullscreen";
qDebug() << "-path - path to cd to before launching -url";
qDebug() << "-qml - file to launch (default: main.qml inside -path)";
qDebug() << "-url - url to load";
qDebug() << "-no-glwidget - Don't use QGLWidget viewport";
exit(0);
}
}
if (!path.isEmpty())
QDir::setCurrent(path);
qmlRegisterType<QMozContext>("QtMozilla", 1, 0, "QMozContext");
qmlRegisterType<QGraphicsMozView>("QtMozilla", 1, 0, "QGraphicsMozView");
qmlRegisterType<QDeclarativeMozView>("QtMozilla", 1, 0, "QDeclarativeMozView");
QUrl qml;
if (qmlstring.isEmpty())
#if defined(__arm__) && !defined(Q_WS_MAEMO_5)
qml = QUrl("qrc:/qml/main_meego.qml");
#else
qml = QUrl("qrc:/qml/main.qml");
#endif
else
开发者ID:romaxa,项目名称:qmlmozbrowser,代码行数:94,代码来源:main.cpp
示例11: switch
QVariant Dot3Protocol::fieldData(int index, FieldAttrib attrib,
int streamIndex) const
{
switch (index)
{
case dot3_length:
switch(attrib)
{
case FieldName:
return QString("Length");
case FieldValue:
{
quint16 len = data.is_override_length() ?
data.length() : protocolFramePayloadSize(streamIndex);
return len;
}
case FieldTextValue:
{
quint16 len = data.is_override_length() ?
data.length() : protocolFramePayloadSize(streamIndex);
return QString("%1").arg(len);
}
case FieldFrameValue:
{
quint16 len = data.is_override_length() ?
data.length() : protocolFramePayloadSize(streamIndex);
QByteArray fv;
fv.resize(2);
qToBigEndian(len, (uchar*) fv.data());
return fv;
}
case FieldBitSize:
return 16;
default:
break;
}
break;
// Meta fields
case dot3_is_override_length:
{
switch(attrib)
{
case FieldValue:
return data.is_override_length();
default:
break;
}
break;
}
default:
qFatal("%s: unimplemented case %d in switch", __PRETTY_FUNCTION__,
index);
break;
}
return AbstractProtocol::fieldData(index, attrib, streamIndex);
}
开发者ID:aromakh,项目名称:ostinato,代码行数:61,代码来源:dot3.cpp
示例12: while
Scanner::Token Scanner::nextToken() {
Token tok = NoToken;
// remove whitespace
while (m_pos < m_length && m_chars[m_pos] == ' ') {
++m_pos;
}
m_token_start = m_pos;
while (m_pos < m_length) {
const QChar &c = m_chars[m_pos];
if (tok == NoToken) {
switch (c.toLatin1()) {
case '*': tok = StarToken; break;
case '&': tok = AmpersandToken; break;
case '<': tok = LessThanToken; break;
case '>': tok = GreaterThanToken; break;
case ',': tok = CommaToken; break;
case '(': tok = OpenParenToken; break;
case ')': tok = CloseParenToken; break;
case '[': tok = SquareBegin; break;
case ']' : tok = SquareEnd; break;
case ':':
tok = ColonToken;
Q_ASSERT(m_pos + 1 < m_length);
++m_pos;
break;
default:
if (c.isLetterOrNumber() || c == '_')
tok = Identifier;
else
qFatal("Unrecognized character in lexer: %c", c.toLatin1());
break;
}
}
if (tok <= GreaterThanToken) {
++m_pos;
break;
}
if (tok == Identifier) {
if (c.isLetterOrNumber() || c == '_')
++m_pos;
else
break;
}
}
if (tok == Identifier && m_pos - m_token_start == 5) {
if (m_chars[m_token_start] == 'c'
&& m_chars[m_token_start + 1] == 'o'
&& m_chars[m_token_start + 2] == 'n'
&& m_chars[m_token_start + 3] == 's'
&& m_chars[m_token_start + 4] == 't')
tok = ConstToken;
}
return tok;
}
开发者ID:qtjambi,项目名称:qtjambi-community-maven,代码行数:64,代码来源:typeparser.cpp
示例13: qFatal
QObject* Plugin::component(ComponentType componentType, QObject*)
{
qFatal("Plugin '%s' was asked to create a component of type %d", qPrintable(uniqueId()), componentType);
return 0; // -Wall -Werror
}
开发者ID:fredemmott,项目名称:jerboa,代码行数:5,代码来源:JerboaPlugin.cpp
示例14: qWarning
//.........这里部分代码省略.........
#ifdef __OPTIMIZE__
case DBUS_TYPE_BYTE:
case DBUS_TYPE_BOOLEAN:
case DBUS_TYPE_INT16:
case DBUS_TYPE_UINT16:
case DBUS_TYPE_INT32:
case DBUS_TYPE_UINT32:
case DBUS_TYPE_INT64:
case DBUS_TYPE_UINT64:
case DBUS_TYPE_DOUBLE:
qIterAppend(&iterator, ba, *signature, arg.constData());
return true;
case DBUS_TYPE_STRING:
case DBUS_TYPE_OBJECT_PATH:
case DBUS_TYPE_SIGNATURE: {
const QByteArray data =
reinterpret_cast<const QString *>(arg.constData())->toUtf8();
const char *rawData = data.constData();
qIterAppend(&iterator, ba, *signature, &rawData);
return true;
}
#else
case DBUS_TYPE_BYTE:
append( qvariant_cast<uchar>(arg) );
return true;
case DBUS_TYPE_BOOLEAN:
append( arg.toBool() );
return true;
case DBUS_TYPE_INT16:
append( qvariant_cast<short>(arg) );
return true;
case DBUS_TYPE_UINT16:
append( qvariant_cast<ushort>(arg) );
return true;
case DBUS_TYPE_INT32:
append( static_cast<dbus_int32_t>(arg.toInt()) );
return true;
case DBUS_TYPE_UINT32:
append( static_cast<dbus_uint32_t>(arg.toUInt()) );
return true;
case DBUS_TYPE_INT64:
append( arg.toLongLong() );
return true;
case DBUS_TYPE_UINT64:
append( arg.toULongLong() );
return true;
case DBUS_TYPE_DOUBLE:
append( arg.toDouble() );
return true;
case DBUS_TYPE_STRING:
append( arg.toString() );
return true;
case DBUS_TYPE_OBJECT_PATH:
append( qvariant_cast<QDBusObjectPath>(arg) );
return true;
case DBUS_TYPE_SIGNATURE:
append( qvariant_cast<QDBusSignature>(arg) );
return true;
#endif
// compound types:
case DBUS_TYPE_VARIANT:
// nested QVariant
return append( qvariant_cast<QDBusVariant>(arg) );
case DBUS_TYPE_ARRAY:
// could be many things
// find out what kind of array it is
switch (arg.type()) {
case QVariant::StringList:
append( arg.toStringList() );
return true;
case QVariant::ByteArray:
append( arg.toByteArray() );
return true;
default:
; // fall through
}
// fall through
case DBUS_TYPE_STRUCT:
case DBUS_STRUCT_BEGIN_CHAR:
return appendRegisteredType( arg );
case DBUS_TYPE_DICT_ENTRY:
case DBUS_DICT_ENTRY_BEGIN_CHAR:
qFatal("QDBusMarshaller::appendVariantInternal got a DICT_ENTRY!");
return false;
default:
qWarning("QDBusMarshaller::appendVariantInternal: Found unknown D-BUS type '%s'",
signature);
return false;
}
return true;
}
开发者ID:FilipBE,项目名称:qtextended,代码行数:101,代码来源:qdbusmarshaller.cpp
示例15: qFatal
void MScore::init()
{
if (!QMetaType::registerConverter<Spatium, double>(&Spatium::toDouble))
qFatal("registerConverter Spatium::toDouble failed");
if (!QMetaType::registerConverter<double, Spatium>(&doubleToSpatium))
qFatal("registerConverter douobleToSpatium failed");
if (!QMetaType::registerConverter<int, TextStyleType>(&intToTextStyleType))
qFatal("registerConverter intToTextStyleType failed");
#ifdef SCRIPT_INTERFACE
qRegisterMetaType<Element::Type> ("ElementType");
qRegisterMetaType<Note::ValueType> ("ValueType");
qRegisterMetaType<Direction::E>("Direction");
qRegisterMetaType<MScore::DirectionH>("DirectionH");
qRegisterMetaType<Element::Placement>("Placement");
qRegisterMetaType<Spanner::Anchor> ("Anchor");
qRegisterMetaType<NoteHead::Group> ("NoteHeadGroup");
qRegisterMetaType<NoteHead::Type>("NoteHeadType");
qRegisterMetaType<Segment::Type>("SegmentType");
qRegisterMetaType<FiguredBassItem::Modifier>("Modifier");
qRegisterMetaType<FiguredBassItem::Parenthesis>("Parenthesis");
qRegisterMetaType<FiguredBassItem::ContLine>("ContLine");
qRegisterMetaType<Volta::Type>("VoltaType");
qRegisterMetaType<Ottava::Type>("OttavaType");
qRegisterMetaType<Trill::Type>("TrillType");
qRegisterMetaType<Dynamic::Range>("DynamicRange");
qRegisterMetaType<Jump::Type>("JumpType");
qRegisterMetaType<Marker::Type>("MarkerType");
qRegisterMetaType<Beam::Mode>("BeamMode");
qRegisterMetaType<HairpinType>("HairpinType");
qRegisterMetaType<Lyrics::Syllabic>("Syllabic");
qRegisterMetaType<LayoutBreak::Type>("LayoutBreakType");
qRegisterMetaType<Glissando::Type>("GlissandoType");
//classed enumerations
qRegisterMetaType<MSQE_TextStyleType::E>("TextStyleType");
qRegisterMetaType<MSQE_BarLineType::E>("BarLineType");
#endif
qRegisterMetaType<Fraction>("Fraction");
// DPMM = DPI / INCH; // dots/mm
#ifdef Q_OS_WIN
QDir dir(QCoreApplication::applicationDirPath() + QString("/../" INSTALL_NAME));
_globalShare = dir.absolutePath() + "/";
#elif defined(Q_OS_IOS)
{
extern QString resourcePath();
_globalShare = resourcePath();
}
#elif defined(Q_OS_MAC)
QDir dir(QCoreApplication::applicationDirPath() + QString("/../Resources"));
_globalShare = dir.absolutePath() + "/";
#else
// Try relative path (needed for portable AppImage and non-standard installations)
QDir dir(QCoreApplication::applicationDirPath() + QString("/../share/" INSTALL_NAME));
if (dir.exists())
_globalShare = dir.absolutePath() + "/";
else // Fall back to default location (e.g. if binary has moved relative to share)
_globalShare = QString( INSTPREFIX "/share/" INSTALL_NAME);
#endif
selectColor[0].setNamedColor("#1259d0"); //blue
selectColor[1].setNamedColor("#009234"); //green
selectColor[2].setNamedColor("#c04400"); //orange
selectColor[3].setNamedColor("#70167a"); //purple
defaultColor = Qt::black;
dropColor = QColor("#1778db");
defaultPlayDuration = 300; // ms
warnPitchRange = true;
playRepeats = true;
panPlayback = true;
lastError = "";
layoutBreakColor = QColor("#5999db");
frameMarginColor = QColor("#5999db");
bgColor.setNamedColor("#dddddd");
_defaultStyle = new MStyle();
Ms::initStyle(_defaultStyle);
_defaultStyleForParts = 0;
_baseStyle = new MStyle(*_defaultStyle);
//
// load internal fonts
//
//
// do not load application specific fonts
// for MAC, they are in Resources/fonts
//
#if !defined(Q_OS_MAC) && !defined(Q_OS_IOS)
static const char* fonts[] = {
":/fonts/musejazz/MuseJazzText.ttf",
":/fonts/FreeSans.ttf",
":/fonts/FreeSerif.ttf",
//.........这里部分代码省略.........
开发者ID:ajyoon,项目名称:MuseScore,代码行数:101,代码来源:mscore.cpp
示例16: while
//.........这里部分代码省略.........
// interpret result
switch ( state ) {
case StartState:
if ( opt.type == OSwitch ) {
setSwitch( opt );
setOptions.insert( opt.lname, 1 );
setOptions.insert( QString( QChar( opt.sname ) ), 1 );
} else if ( opt.type == OArg1 || opt.type == ORepeat ) {
state = ExpectingState;
currOpt = opt;
currType = t;
setOptions.insert( opt.lname, 1 );
setOptions.insert( QString( QChar( opt.sname ) ), 1 );
} else if ( opt.type == OOpt || opt.type == OVarLen ) {
state = OptionalState;
currOpt = opt;
currType = t;
setOptions.insert( opt.lname, 1 );
setOptions.insert( QString( QChar( opt.sname ) ), 1 );
} else if ( opt.type == OEnd ) {
// we're done
} else if ( opt.type == OUnknown && t == Arg ) {
if ( numReqArgs > 0 ) {
if ( reqArg.stringValue->isNull() ) { // ###
*reqArg.stringValue = a;
} else {
qWarning( "Too many arguments" );
return false;
}
} else if ( numOptArgs > 0 ) {
if ( optArg.stringValue->isNull() ) { // ###
*optArg.stringValue = a;
} else {
qWarning( "Too many arguments" );
return false;
}
}
} else {
qFatal( "unhandled StartState case %d", opt.type );
}
break;
case ExpectingState:
if ( t == Arg ) {
if ( currOpt.type == OArg1 ) {
*currOpt.stringValue = a;
state = StartState;
} else if ( currOpt.type == ORepeat ) {
currOpt.listValue->append( a );
state = StartState;
} else {
abort();
}
} else {
QString n = currType == LongOpt ?
currOpt.lname : QString( QChar( currOpt.sname ) );
qWarning( "Expected an argument after '%s' option", n.toLocal8Bit().constData() );
return false;
}
break;
case OptionalState:
if ( t == Arg ) {
if ( currOpt.type == OOpt ) {
*currOpt.stringValue = a;
state = StartState;
} else if ( currOpt.type == OVarLen ) {
currOpt.listValue->append( origA );
// remain in this state
} else {
abort();
}
} else {
// optional argument not specified
if ( currOpt.type == OOpt )
*currOpt.stringValue = currOpt.def;
if ( t != End ) {
// re-evaluate current argument
stack.push( origA );
currArg--;
}
state = StartState;
}
break;
}
if ( untilFirstSwitchOnly && opt.type == OSwitch )
return true;
// are we in the extra loop ? if so, flag the final end
if ( t == End )
extraLoop = false;
}
if ( numReqArgs > 0 && reqArg.stringValue->isNull() ) {
qWarning( "Lacking required argument" );
return false;
}
return true;
}
开发者ID:cdhowie,项目名称:Quackle,代码行数:101,代码来源:froggetopt.cpp
示例17: QObject
Worker::Worker(RoboCompJointMotor::JointMotorPrx jointmotorprx, QObject *parent) : QObject(parent)
{
jointmotor = jointmotorprx;
//mutex = new QMutex();
//setupUi(this);
//show();
// try
// {
// params = jointmotor->getAllMotorParams();
// if(params.size() < 4)
// qFatal("Error num motor: required 4 obtained: "+params.size());
// }
// catch(Ice::Exception e)
// {
// qFatal("Error talking to jointMotor::getting params");
// }
//
// r_vmax.resize(4);
// //Creamos el vector de rampas
// for(int i=0;i<4;i++)
// rampa.append(1);
// //Calcula r_vmax para cada motor
// for(int i=0;i<4;i++)
// {
// params[i].maxVelocity = 2.5;
// qDebug()<<"velocidad maxima"<<params[i].maxVelocity;
// r_vmax[i] = pow(params[i].maxVelocity,2)/(rampa.at(i)*2);
// }
// move = false;
// vLimites.resize(4);
// pDistances.resize(4);
// tiempo = 0.f;
// tcambio1.resize(4);
// tcambio2.resize(4);
// goals.resize(4);
// poseEstimada.resize(4);
// poseInicial.resize(4);
//
// for(uint i=0;i<params.size();i++)
// {
// RoboCompJointMotor::MotorGoalPosition goal;
// // goal.position = -2.f;
// goal.name = params[i].name;
// // goal.maxSpeed = 6.f;
// //
// goals[i] = goal;
// }
//
// qDebug()<<"constructor";
connect(&timer, SIGNAL(timeout()), this, SLOT(compute()));
timer.start(BASIC_PERIOD);
/**NUEVO*/
try
{
params = jointmotor->getAllMotorParams();
if(params.size() < 10)
qFatal("Error num motor: required 10 obtained: "+params.size());
}
catch(Ice::Exception e)
{
qFatal("Error talking to jointMotor::getting params");
}
right.resize(5);
left.resize(5);
both.resize(10);
RoboCompJointMotor::MotorGoalPosition aux;
aux.maxSpeed = 0.75;
for(int i=0;i<5;i++)
{
right[i] = aux;
left[i] = aux;
both[i] = aux;
both[i+5] = aux;
}
both[0].name = right[0].name = "r1";
both[1].name = right[1].name = "r2";
both[2].name = right[2].name = "r3";
both[3].name = right[3].name = "r4";
both[4].name = right[4].name = "r5";
both[5].name = left[0].name = "l1";
both[6].name = left[1].name = "l2";
both[7].name = left[2].name = "l3";
both[8].name = left[3].name = "l4";
both[9].name = left[4].name = "l5";
}
开发者ID:robocomp,项目名称:robocomp-robolab-deprecated,代码行数:89,代码来源:worker.cpp
示例18: switch
void SessionFactory::CreateSession(Node *node, const Id &session_id,
SessionType type, AuthFactory::AuthType auth_type,
const QSharedPointer<KeyShare> &public_keys)
{
CreateRound cr;
switch(type) {
case NULL_ROUND:
cr = &TCreateRound<NullRound>;
break;
case SHUFFLE:
cr = &TCreateRound<ShuffleRound>;
break;
case BULK:
cr = &TCreateRound<BulkRound>;
break;
case REPEATING_BULK:
cr = &TCreateRound<RepeatingBulkRound>;
break;
case CSBULK:
cr = &TCreateBulkRound<CSBulkRound, NeffKeyShuffleRound>;
break;
case NEFF_SHUFFLE:
cr = &TCreateRound<NeffShuffleRound>;
case BLOG_DROP_REACTIVE:
cr = TCreateBlogDropRound<Parameters::ParameterType_CppECHashingProduction,
NeffShuffleRound, false>;
break;
case BLOG_DROP_PROACTIVE:
cr = TCreateBlogDropRound<Parameters::ParameterType_CppECHashingProduction,
NeffShuffleRound, true>;
break;
default:
qFatal("Invalid session type");
}
QSharedPointer<IAuthenticate> authe(AuthFactory::CreateAuthenticate(
node, auth_type, public_keys));
Session *session = new Session(node->GetGroupHolder(), authe, session_id,
node->GetNetwork(), cr);
QObject::connect(node->GetOverlay().data(), SIGNAL(Disconnecting()),
session, SLOT(CallStop()));
QSharedPointer<Session> psession(session);
session->SetSharedPointer(psession);
node->GetSessionManager().AddSession(psession);
psession->SetSink(node->GetSink().data());
if(node->GetPrivateIdentity().GetLocalId() ==
node->GetGroupHolder()->GetGroup().GetLeader())
{
QSharedPointer<IAuthenticator> autho(AuthFactory::CreateAuthenticator(
node, auth_type, public_keys));
QSharedPointer<SessionLeader> sl(new SessionLeader(
node->GetGroupHolder()->GetGroup(), node->GetPrivateIdentity(),
node->GetNetwork(), psession, autho));
node->GetSessionManager().AddSessionLeader(sl);
sl->Start();
} else {
psession->Start();
}
}
开发者ID:ASchurman,项目名称:Dissent,代码行数:63,代码来源:SessionFactory.cpp
示例19: testPlayerScript
//.........这里部分代码省略.........
vector.setProperty("isAI", i != 0, QScriptValue::ReadOnly | QScriptValue::Undeletable);
vector.setProperty("isHuman", i == 0, QScriptValue::ReadOnly | QScriptValue::Undeletable);
playerData.setProperty(i, vector, QScriptValue::ReadOnly | QScriptValue::Undeletable);
}
engine->globalObject().setProperty("playerData", playerData, QScriptValue::ReadOnly | QScriptValue::Undeletable);
// Static map knowledge about start positions
//== \item[derrickPositions] An array of derrick starting positions on the current map. Each item in the array is an
//== object containing the x and y variables for a derrick.
//== \item[startPositions] An array of player start positions on the current map. Each item in the array is an
//== object containing the x and y variables for a player start position.
QScriptValue startPositions = engine->newArray(CUR_PLAYERS);
for (int i = 0; i < CUR_PLAYERS; i++)
{
QScriptValue vector = engine->newObject();
vector.setProperty("x", 40, QScriptValue::ReadOnly | QScriptValue::Undeletable);
vector.setProperty("y", 40, QScriptValue::ReadOnly | QScriptValue::Undeletable);
startPositions.setProperty(i, vector, QScriptValue::ReadOnly | QScriptValue::Undeletable);
}
QScriptValue derrickPositions = engine->newArray(6);
for (int i = 0; i < 6; i++)
{
QScriptValue vector = engine->newObject();
vector.setProperty("x", 40, QScriptValue::ReadOnly | QScriptValue::Undeletable);
vector.setProperty("y", 40, QScriptValue::ReadOnly | QScriptValue::Undeletable);
derrickPositions.setProperty(i, vector, QScriptValue::ReadOnly | QScriptValue::Undeletable);
}
engine->globalObject().setProperty("derrickPositions", derrickPositions, QScriptValue::ReadOnly | QScriptValue::Undeletable);
engine->globalObject().setProperty("startPositions", startPositions, QScriptValue::ReadOnly | QScriptValue::Undeletable);
QScriptSyntaxCheckResult syntax = QScriptEngine::checkSyntax(source);
if (syntax.state() != QScriptSyntaxCheckResult::Valid)
{
qFatal("Syntax error in %s line %d: %s", path.toUtf8().constData(), syntax.errorLineNumber(), syntax.errorMessage().toUtf8().constData());
return false;
}
QScriptValue result = engine->evaluate(source, path);
if (engine->hasUncaughtException())
{
int line = engine->uncaughtExceptionLineNumber();
qFatal("Uncaught exception at line %d, file %s: %s", line, path.toUtf8().constData(), result.toString().toUtf8().constData());
return false;
}
// Call init
callFunction(engine, "eventGameInit", QScriptValueList());
// Now set gameTime to something proper
engine->gl
|
请发表评论