Skip to content

Commit

Permalink
Merge pull request #1598 from timblechmann/topic/ide-keyevent-fixes
Browse files Browse the repository at this point in the history
Topic/ide keyevent fixes
  • Loading branch information
scztt committed Jul 7, 2015
2 parents e271d31 + 91735d8 commit e248067
Show file tree
Hide file tree
Showing 34 changed files with 255 additions and 208 deletions.
4 changes: 2 additions & 2 deletions QtCollider/LanguageClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void LangClient::customEvent( QEvent *e )
case Event_SCRequest_Quit:
{
int code = static_cast<SCRequestEvent*>(e)->data.toInt();
qcDebugMsg( 1, QString("Quit requested with code %1").arg(code) );
qcDebugMsg( 1, QStringLiteral("Quit requested with code %1").arg(code) );
qApp->exit( code );
break;
}
Expand All @@ -107,7 +107,7 @@ void LangClient::tick()
secs -= elapsedTime();
secs *= 1000;
int ti = qMax(0, qCeil(secs));
qcDebugMsg(2, QString("next at %1").arg(ti) );
qcDebugMsg(2, QStringLiteral("next at %1").arg(ti) );
appClockTimer.start( ti, this );
} else
appClockTimer.stop();
Expand Down
24 changes: 12 additions & 12 deletions QtCollider/QObjectProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ QObjectProxy::QObjectProxy( QObject *qObject_, PyrObject *scObject_ )

QObjectProxy::~QObjectProxy()
{
qcProxyDebugMsg( 1, QString("Proxy is being deleted.") );
qcProxyDebugMsg( 1, QStringLiteral("Proxy is being deleted.") );
}

bool QObjectProxy::compareThread() {
return gMainVMGlobals->canCallOS;
}

void QObjectProxy::invalidate() {
qcProxyDebugMsg( 1, QString("Object has been deleted. Invalidating proxy.") );
qcProxyDebugMsg( 1, QStringLiteral("Object has been deleted. Invalidating proxy.") );
mutex.lock(); qObject = 0; mutex.unlock();
QApplication::postEvent( this, new QEvent((QEvent::Type) QtCollider::Event_Proxy_Release) );
}
Expand Down Expand Up @@ -168,7 +168,7 @@ bool QObjectProxy::invokeMethod( const char *method, PyrSlot *retSlot, PyrSlot *
}

if( mi < 0 || mi >= mo->methodCount() ) {
qcProxyDebugMsg( 1, QString("WARNING: No such method: %1::%2").arg( mo->className() )
qcProxyDebugMsg( 1, QStringLiteral("WARNING: No such method: %1::%2").arg( mo->className() )
.arg( sig.constData() ) );
return false;
}
Expand All @@ -185,7 +185,7 @@ bool QObjectProxy::invokeMethod( const char *method, PyrSlot *retSlot, PyrSlot *
if( retSlot && rtype_id != QMetaType::Void ) {
MetaType *type = MetaType::find(rtype_id);
if(!type) {
qcErrorMsg(QString("No translation for return type '%1'").arg(rtype_name));
qcErrorMsg(QStringLiteral("No translation for return type '%1'").arg(rtype_name));
return false;
}

Expand Down Expand Up @@ -225,7 +225,7 @@ void QObjectProxy::invokeScMethod
( PyrSymbol *method, const QList<QVariant> & args, PyrSlot *result,
bool locked )
{
qcProxyDebugMsg(1, QString("SC METHOD CALL [+++]: ") + QString(method->name) );
qcProxyDebugMsg(1, QStringLiteral("SC METHOD CALL [+++]: ") + QString(method->name) );

if( !locked ) {
QtCollider::lockLang();
Expand All @@ -241,7 +241,7 @@ void QObjectProxy::invokeScMethod

if( !locked ) QtCollider::unlockLang();

qcProxyDebugMsg(1, QString("SC METHOD CALL [---]: ") + QString(method->name) );
qcProxyDebugMsg(1, QStringLiteral("SC METHOD CALL [---]: ") + QString(method->name) );
}

void QObjectProxy::customEvent( QEvent *event )
Expand Down Expand Up @@ -274,7 +274,7 @@ bool QObjectProxy::setProperty( const char *property, const QVariant & val )
{
if( !qObject ) return true;
if( !qObject->setProperty( property, val ) ) {
qcProxyDebugMsg(1, QString("WARNING: Property '%1' not found. Setting dynamic property.")
qcProxyDebugMsg(1, QStringLiteral("WARNING: Property '%1' not found. Setting dynamic property.")
.arg( property ) );
}
return false;
Expand Down Expand Up @@ -374,7 +374,7 @@ bool QObjectProxy::disconnectObject( const char *sig, PyrObject *object )
QByteArray signal = QMetaObject::normalizedSignature( sig );
int sigId = mo->indexOfSignal( signal );
if( sigId < 0 ) {
qcDebugMsg( 1, QString("WARNING: No such signal: '%1'").arg(signal.constData()) );
qcDebugMsg( 1, QStringLiteral("WARNING: No such signal: '%1'").arg(signal.constData()) );
return false;
}

Expand All @@ -398,7 +398,7 @@ bool QObjectProxy::disconnectMethod( const char *sig, PyrSymbol *method)
QByteArray signal = QMetaObject::normalizedSignature( sig );
int sigId = mo->indexOfSignal( signal );
if( sigId < 0 ) {
qcDebugMsg( 1, QString("WARNING: No such signal: '%1'").arg(signal.constData()) );
qcDebugMsg( 1, QStringLiteral("WARNING: No such signal: '%1'").arg(signal.constData()) );
return false;
}

Expand Down Expand Up @@ -504,21 +504,21 @@ bool QObjectProxy::eventFilter( QObject * watched, QEvent * event )
}
if(n < 0)
{
qcProxyDebugMsg(3,QString("No handler for event (%1), forwarding to the widget")
qcProxyDebugMsg(3,QStringLiteral("No handler for event (%1), forwarding to the widget")
.arg(type));
return false;
}

QList<QVariant> args;

if( !preProcessEvent( watched, event, *d, args ) ) {
qcProxyDebugMsg(3,QString("Event (%1, %2) not handled, forwarding to the widget")
qcProxyDebugMsg(3,QStringLiteral("Event (%1, %2) not handled, forwarding to the widget")
.arg(type)
.arg(event->spontaneous() ? "spontaneous" : "inspontaneous") );
return false;
}

qcProxyDebugMsg(1,QString("Will handle event (%1, %2) -> (%3, %4)")
qcProxyDebugMsg(1,QStringLiteral("Will handle event (%1, %2) -> (%3, %4)")
.arg(type)
.arg(event->spontaneous() ? "spontaneous" : "inspontaneous")
.arg(d->method->name)
Expand Down
2 changes: 1 addition & 1 deletion QtCollider/QObjectProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include <PyrSymbol.h>

#define qcProxyDebugMsg( LEVEL, MSG ) \
qcDebugMsg( LEVEL, QString("[%1]: ").arg(_scClassName) + QString(MSG) )
qcDebugMsg( LEVEL, QStringLiteral("[%1]: ").arg(_scClassName) + QString(MSG) )

class QObjectProxy;
class QcSignalSpy;
Expand Down
6 changes: 3 additions & 3 deletions QtCollider/QWidgetProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,15 @@ void QWidgetProxy::setLayout ( QObjectProxy *layoutProxy ) {
QLayout *exLayout = w->layout();
if( exLayout != l ) {
if( exLayout != 0 ) {
qcDebugMsg( 2, QString("Deleting old layout.") );
qcDebugMsg( 2, QStringLiteral("Deleting old layout.") );
delete exLayout;
}
qcDebugMsg( 2, QString("Setting layout.") );
qcDebugMsg( 2, QStringLiteral("Setting layout.") );
w->setLayout( l );
l->activate();
}
else {
qcDebugMsg( 2, QString("Layout same as existing. Will do nothing.") );
qcDebugMsg( 2, QStringLiteral("Layout same as existing. Will do nothing.") );
}
}

Expand Down
2 changes: 1 addition & 1 deletion QtCollider/QcApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ bool QcApplication::event( QEvent *event )
case QEvent::FileOpen: {
// open the file dragged onto the application icon on Mac
QFileOpenEvent *fe = static_cast<QFileOpenEvent*>(event);
interpret( QString("Document.open(\"%1\")").arg(fe->file()), false );
interpret( QStringLiteral("Document.open(\"%1\")").arg(fe->file()), false );
event->accept();
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion QtCollider/QcObjectFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class QcAbstractFactory

static void qcNoConstructorMsg( const QMetaObject *metaObject, int argc, QtCollider::MetaValue *argv )
{
QString str = QString("No appropriate constructor found for %1 (")
QString str = QStringLiteral("No appropriate constructor found for %1 (")
.arg( metaObject->className() );

for (int i = 0; i < argc; ++i)
Expand Down
2 changes: 1 addition & 1 deletion QtCollider/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ extern void error(const char *fmt, ...);
#endif

#define qcSCObjectDebugMsg( LEVEL, OBJ, MSG ) \
qcDebugMsg( LEVEL, QString("[%1] %2") \
qcDebugMsg( LEVEL, QStringLiteral("[%1] %2") \
.arg( OBJ ? slotRawSymbol( &OBJ->classptr->name )->name : "null" ) \
.arg(MSG) )

Expand Down
2 changes: 1 addition & 1 deletion QtCollider/metatype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ MetaType *MetaType::find( PyrSlot *slot )
}
else {
QString className = TypeCodec<QString>::read( &slotRawObject(slot)->classptr->name );
qcWarningMsg(QString("WARNING: Do not know how to use an instance of class '%1'").arg(className));
qcWarningMsg(QStringLiteral("WARNING: Do not know how to use an instance of class '%1'").arg(className));
return 0;
}
}
Expand Down
14 changes: 7 additions & 7 deletions QtCollider/primitives/prim_QImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ QC_LANG_PRIMITIVE( QImage_NewURL, 2, PyrSlot *r, PyrSlot *a, VMGlobals *g )
QString url_str = QtCollider::get(a);
QUrl url(url_str);
if( !url.isValid() || url.isEmpty() ) {
qcErrorMsg( QString("QImage: invalid or empty URL: ") + url_str );
qcErrorMsg( QStringLiteral("QImage: invalid or empty URL: ") + url_str );
return errFailed;
}

if( QURL_IS_LOCAL_FILE(url) ) {
if( QImage_InitPath( g, slotRawObject(r), url.toLocalFile() ) ) {
return errNone;
} else {
qcErrorMsg( QString("QImage: file doesn't exist or can't be opened: ") + url_str );
qcErrorMsg( QStringLiteral("QImage: file doesn't exist or can't be opened: ") + url_str );
return errFailed;
}
}
Expand All @@ -103,26 +103,26 @@ QC_LANG_PRIMITIVE( QImage_NewURL, 2, PyrSlot *r, PyrSlot *a, VMGlobals *g )
loop.exec(); // blocks

if( reply->error() != QNetworkReply::NoError ) {
qcErrorMsg( QString("QImage: error trying to download: ") + url_str );
qcErrorMsg( QStringLiteral("QImage: error trying to download: ") + url_str );
return errFailed;
}
else if( !reply->isFinished() ) {
qcErrorMsg( QString("QImage: timeout while trying to download: ") + url_str );
qcErrorMsg( QStringLiteral("QImage: timeout while trying to download: ") + url_str );
reply->abort();
return errFailed;
}

QByteArray byteArray = reply->readAll();
if( byteArray.isEmpty() ) {
qcErrorMsg( QString("QImage: no data received: ") + url_str );
qcErrorMsg( QStringLiteral("QImage: no data received: ") + url_str );
return errFailed;
}

if( QImage_InitFromData( g, slotRawObject(r), byteArray ) ) {
return errNone;
}
else {
qcErrorMsg( QString("QImage: failed trying to open downloaded data: ") + url_str );
qcErrorMsg( QStringLiteral("QImage: failed trying to open downloaded data: ") + url_str );
return errFailed;
}
#endif
Expand Down Expand Up @@ -254,7 +254,7 @@ QC_LANG_PRIMITIVE( QImage_Write, 3, PyrSlot *r, PyrSlot *a, VMGlobals *g )
if( image.save(path, format.toUpper().toStdString().c_str(), quality) )
return errNone;

qcErrorMsg( QString("QImage: Failed to write to file: ") + path );
qcErrorMsg( QStringLiteral("QImage: Failed to write to file: ") + path );
return errFailed;
}

Expand Down
Loading

0 comments on commit e248067

Please sign in to comment.