s,--sputdev,--debug,g
authorManuel Nickschas <sputnick@quassel-irc.org>
Fri, 18 Apr 2008 18:27:56 +0000 (18:27 +0000)
committerManuel Nickschas <sputnick@quassel-irc.org>
Fri, 18 Apr 2008 18:27:56 +0000 (18:27 +0000)
Also added a qmake switch that enables advanced b0rkage at build-time. I mean it.

build/buildconf.pri
src/common/global.cpp
src/common/global.h
src/common/main.cpp
src/qtopia/qtopiamainwin.cpp
src/qtui/bufferwidget.cpp
src/qtui/mainwin.cpp
src/uisupport/bufferview.cpp

index 11297db..81591be 100644 (file)
@@ -7,6 +7,10 @@ release {
   CONFIG *= debug
 }
 
+sputdev {
+  DEFINES *= SPUTDEV
+}
+
 win32:static { 
   CONFIG = release warn_on uic resources qt windows static
 }
index 300d182..9f0e224 100644 (file)
@@ -112,4 +112,4 @@ QString Global::coreVersionNeeded;
 Global::RunMode Global::runMode;
 uint Global::defaultPort;
 
-bool Global::SPUTDEV;
+bool Global::DEBUG;
index d5fbdec..0759c27 100644 (file)
@@ -53,7 +53,7 @@ namespace Global {
   extern RunMode runMode;
   extern unsigned int defaultPort;
 
-  extern bool SPUTDEV; // FIXME This is for internal use only!
+  extern bool DEBUG;
 
   void registerMetaTypes();
 };
index d958e7a..3c36a28 100644 (file)
@@ -103,7 +103,7 @@ int main(int argc, char **argv) {
 
   // Check if a non-standard core port is requested
   QStringList args = QCoreApplication::arguments();  // TODO Build a CLI parser
-  Global::SPUTDEV = args.contains("--sputdev"); // This enables various debug features for Sput. Do not touch.
+  Global::DEBUG = args.contains("--debug"); // This enables various debug features.
 
   Global::defaultPort = 4242;
   int idx;
index 30e6ecf..b927e72 100644 (file)
@@ -47,7 +47,7 @@ QtopiaMainWin::QtopiaMainWin(QWidget *parent, Qt::WFlags flags) : QMainWindow(pa
 
   Global::runMode = Global::ClientOnly;
   Global::defaultPort = 4242;
-  Global::SPUTDEV = true;
+  Global::DEBUG = true;
 
   Network::setDefaultCodecForServer("ISO-8859-1");
   Network::setDefaultCodecForEncoding("UTF-8");
index 4158311..c614bb7 100644 (file)
@@ -38,11 +38,11 @@ BufferWidget::~BufferWidget() {
 
 AbstractChatView *BufferWidget::createChatView(BufferId id) {
   QWidget *chatView;
-  if(Global::SPUTDEV) {
-    chatView = new ChatView(Client::buffer(id), this);
-  } else {
-    chatView = new ChatWidget(id, this);
-  }
+#ifdef SPUTDEV
+  chatView = new ChatView(Client::buffer(id), this);
+#else
+  chatView = new ChatWidget(id, this);
+#endif
   _chatViews[id] = chatView;
   ui.stackedWidget->addWidget(chatView);
   chatView->setFocusProxy(this);
index 7b177c1..6dcd8cd 100644 (file)
@@ -141,7 +141,7 @@ void MainWin::init() {
   ui.bufferWidget->setModel(Client::bufferModel());
   ui.bufferWidget->setSelectionModel(Client::bufferModel()->standardSelectionModel());
 
-  if(Global::SPUTDEV) {
+  if(Global::DEBUG) {
     //showSettingsDlg();
     //showAboutDlg();
     //showNetworkDlg();
@@ -484,8 +484,11 @@ void MainWin::setDisconnectedState() {
 }
 
 AbstractUiMsg *MainWin::layoutMsg(const Message &msg) {
-  if(Global::SPUTDEV) return new ChatLine(msg);
+#ifdef SPUTDEV
+  return new ChatLine(msg);
+#else
   return new ChatLineOld(msg);
+#endif
 }
 
 void MainWin::showCoreConnectionDlg(bool autoConnect) {
index 49d2ae7..a57069b 100644 (file)
@@ -223,12 +223,11 @@ void BufferView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bott
       continue;
 
     bool isActive = networkIdx.data(NetworkModel::ItemActiveRole).toBool();
-    if(Global::SPUTDEV) {
-      if(isExpanded(networkIdx) != isActive) setExpanded(networkIdx, true);
-    } else {
-      if(isExpanded(networkIdx) != isActive)
-        setExpanded(networkIdx, isActive);
-    }
+#ifdef SPUTDEV
+    if(isExpanded(networkIdx) != isActive) setExpanded(networkIdx, true);
+#else
+    if(isExpanded(networkIdx) != isActive) setExpanded(networkIdx, isActive);
+#endif
   }
 }