Skip to content
Browse files

QtCollider: separate debug stuff out of Common.cpp/h

  • Loading branch information...
1 parent 8d7a54c commit 66fb354343749b2fdba82f0dbb056eb36f555ccd @jleben jleben committed May 11, 2011
Showing with 86 additions and 46 deletions.
  1. +1 −0 QtCollider/CMakeLists.txt
  2. +0 −18 QtCollider/Common.cpp
  3. +1 −28 QtCollider/Common.h
  4. +38 −0 QtCollider/debug.cpp
  5. +46 −0 QtCollider/debug.h
View
1 QtCollider/CMakeLists.txt
@@ -35,6 +35,7 @@ set( QT_COLLIDER_HDRS
)
set( QT_COLLIDER_SRCS
+ debug.cpp
interface.cpp
QcApplication.cpp
Common.cpp
View
18 QtCollider/Common.cpp
@@ -1,23 +1,5 @@
#include "Common.h"
-#include <QApplication>
-#include <QThread>
-#include <QAtomicInt>
-
-static QAtomicInt& debugLevelInt() {
- static QAtomicInt *i = new QAtomicInt(0);
- return *i;
-}
-
-int QtCollider::debugLevel() {
- int l = debugLevelInt();
- return l;
-}
-
-void QtCollider::setDebugLevel( int i ) {
- debugLevelInt() = i;
-}
-
void QtCollider::lockLang()
{
qcDebugMsg(2,"locking lang!");
View
29 QtCollider/Common.h
@@ -19,37 +19,10 @@
*
************************************************************************/
-
#ifndef _SC_QT_COMMON_H
#define _SC_QT_COMMON_H
-#include <cstdarg>
-
-namespace QtCollider {
- int debugLevel();
- void setDebugLevel( int );
-}
-
-#include <QString>
-
-extern void postfl(const char *fmt, ...);
-extern void error(const char *fmt, ...);
-
-#ifdef QC_DEBUG
- #define qcDebugMsg( LEVEL, MSG ) \
- if( LEVEL <= QtCollider::debugLevel() ) { \
- postfl( "Qt:: %s\n", QString(MSG).toStdString().c_str() ); \
- }
-#else
- #define qcDebugMsg( LEVEL, MSG )
-#endif
-
-#define qcSCObjectDebugMsg( LEVEL, OBJ, MSG ) \
- qcDebugMsg( LEVEL, QString("[%1] %2") \
- .arg( OBJ ? slotRawSymbol( &OBJ->classptr->name )->name : "null" ) \
- .arg(MSG) )
-
-#define qcErrorMsg( MSG ) error( "Qt: %s\n", QString(MSG).toStdString().c_str() )
+#include "debug.h"
#include <QList>
#include <QVariant>
View
38 QtCollider/debug.cpp
@@ -0,0 +1,38 @@
+/************************************************************************
+*
+* Copyright 2010-2011 Jakob Leben (jakob.leben@gmail.com)
+*
+* This file is part of SuperCollider Qt GUI.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+************************************************************************/
+
+#include "debug.h"
+
+#include <QAtomicInt>
+
+static QAtomicInt& debugLevelInt() {
+ static QAtomicInt *i = new QAtomicInt(0);
+ return *i;
+}
+
+int QtCollider::debugLevel() {
+ int l = debugLevelInt();
+ return l;
+}
+
+void QtCollider::setDebugLevel( int i ) {
+ debugLevelInt() = i;
+}
View
46 QtCollider/debug.h
@@ -0,0 +1,46 @@
+/************************************************************************
+*
+* Copyright 2010-2011 Jakob Leben (jakob.leben@gmail.com)
+*
+* This file is part of SuperCollider Qt GUI.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+************************************************************************/
+
+namespace QtCollider {
+ int debugLevel();
+ void setDebugLevel( int );
+}
+
+#include <QString>
+
+extern void postfl(const char *fmt, ...);
+extern void error(const char *fmt, ...);
+
+#ifdef QC_DEBUG
+ #define qcDebugMsg( LEVEL, MSG ) \
+ if( LEVEL <= QtCollider::debugLevel() ) { \
+ postfl( "Qt:: %s\n", QString(MSG).toStdString().c_str() ); \
+ }
+#else
+ #define qcDebugMsg( LEVEL, MSG )
+#endif
+
+#define qcSCObjectDebugMsg( LEVEL, OBJ, MSG ) \
+ qcDebugMsg( LEVEL, QString("[%1] %2") \
+ .arg( OBJ ? slotRawSymbol( &OBJ->classptr->name )->name : "null" ) \
+ .arg(MSG) )
+
+#define qcErrorMsg( MSG ) error( "Qt: %s\n", QString(MSG).toStdString().c_str() )

0 comments on commit 66fb354

Please sign in to comment.
Something went wrong with that request. Please try again.