New Build System
authorManuel Nickschas <sputnick@quassel-irc.org>
Mon, 10 Jul 2006 13:40:46 +0000 (13:40 +0000)
committerManuel Nickschas <sputnick@quassel-irc.org>
Mon, 10 Jul 2006 13:40:46 +0000 (13:40 +0000)
12 files changed:
CMakeLists.txt
core/CMakeLists.txt
core/core.cpp [new file with mode: 0644]
core/core.h [new file with mode: 0644]
core/proxy.cpp [new file with mode: 0644]
core/proxy.h [new file with mode: 0644]
core/quassel.cpp
core/quassel.h
gui/CMakeLists.txt
gui/serverlist.cpp
main/main_core.cpp [new file with mode: 0644]
main/main_mono.cpp

index 59487d1..8fa82df 100644 (file)
@@ -3,40 +3,29 @@ PROJECT(Quassel)
 # CMAKE_MINIMUM_REQUIRED(VERSION 2.4.2)
 
 # Select if Quassel should be built in client, server or monolithic mode
-SET(BUILD "mono" CACHE STRING "Defines which Quassel parts are to be built. Can contain 'server', 'client' and/or 'monolithic' (which is the default).")
-SET(BUILD_SERVER )
-SET(BUILD_CLIENT )
+SET(BUILD "mono" CACHE STRING "Defines which Quassel parts are to be built. Can contain 'core', 'gui' and/or 'monolithic' (which is the default).")
+SET(BUILD_CORE )
+SET(BUILD_GUI )
 SET(BUILD_MONO )
-IF(BUILD MATCHES "server")
-  SET(BUILD_SERVER true)
-  MESSAGE(STATUS "Building Quassel server.")
-ENDIF(BUILD MATCHES "server")
-IF(BUILD MATCHES "client")
-  SET(BUILD_CLIENT true)
-  MESSAGE(STATUS "Building Quassel client.")
-ENDIF(BUILD MATCHES "client")
+IF(BUILD MATCHES "core")
+  SET(BUILD_CORE true)
+  MESSAGE(STATUS "Building Quassel core.")
+ENDIF(BUILD MATCHES "core")
+IF(BUILD MATCHES "gui")
+  SET(BUILD_GUI true)
+  MESSAGE(STATUS "Building Quassel GUI.")
+ENDIF(BUILD MATCHES "gui")
 IF(BUILD MATCHES "mono")
   SET(BUILD_MONO true)
   MESSAGE(STATUS "Building monolithic Quassel.")
 ENDIF(BUILD MATCHES "mono")
-IF(NOT BUILD_MONO AND NOT BUILD_SERVER AND NOT BUILD_CLIENT)
-  MESSAGE(FATAL_ERROR "You have not selected which parts of Quassel I should build. Aborting.\nRun 'cmake -DBUILD=<part>', where <part> contains one or more of 'server', 'client' or 'monolithic'.")
-ENDIF(NOT BUILD_MONO AND NOT BUILD_SERVER AND NOT BUILD_CLIENT)
-
-# We need Qt4 support.
-FIND_PACKAGE(Qt4 REQUIRED)
-
-# Set needed libraries
-SET(QT_USE_QTXML true)
-IF(NOT BUILD_CLIENT AND NOT BUILD_MONO)
-  SET(QT_DONT_USE_QTGUI true)
-  MESSAGE(STATUS "Disabling GUI support.")
-ENDIF(NOT BUILD_CLIENT AND NOT BUILD_MONO)
-INCLUDE(${QT_USE_FILE})
-ADD_DEFINITIONS(${QT_DEFINITIONS})
+IF(NOT BUILD_MONO AND NOT BUILD_CORE AND NOT BUILD_GUI)
+  MESSAGE(FATAL_ERROR "You have not selected which parts of Quassel I should build. Aborting.\nRun 'cmake -DBUILD=<part>', where <part> contains one or more of 'core', 'gui' or 'monolithic'.")
+ENDIF(NOT BUILD_MONO AND NOT BUILD_CORE AND NOT BUILD_GUI)
 
 # Define files
 SET(quassel_mono_SRCS main/main_mono.cpp)
+SET(quassel_core_SRCS main/main_core.cpp)
 SET(quassel_RCCS images/icons.qrc)
 SET(quassel_DIRS gui core)
 
@@ -45,24 +34,40 @@ SET(SDIRS "")
 FOREACH(dir ${quassel_DIRS})
   SET(SDIRS ${SDIRS} "${CMAKE_CURRENT_SOURCE_DIR}/${dir}")
 ENDFOREACH(dir)
-INCLUDE_DIRECTORIES(${SDIRS} ${QT_INCLUDES})
+INCLUDE_DIRECTORIES(${SDIRS})
 
-ADD_SUBDIRECTORY(gui)
-ADD_SUBDIRECTORY(core)
+# We need Qt4 support.
+FIND_PACKAGE(Qt4 REQUIRED)
+
+# Set needed libraries
+SET(QT_USE_QTXML true)
+SET(QT_DONT_USE_QTGUI true)   # This is added later if GUI is requested
+INCLUDE(${QT_USE_FILE})
 
+ADD_SUBDIRECTORY(core)
 QT4_ADD_RESOURCES(_RCCS ${quassel_RCCS})
 
-IF(BUILD_MONO)
-  ADD_EXECUTABLE(quassel ${quassel_mono_SRCS} ${_RCCS})
-  TARGET_LINK_LIBRARIES(quassel gui core ${QT_LIBRARIES})
-ENDIF(BUILD_MONO)
+IF(BUILD_CORE)
+  ADD_EXECUTABLE(quasselcore ${quassel_core_SRCS} ${_RCCS})
+  TARGET_LINK_LIBRARIES(quasselcore core ${QT_LIBRARIES})
+ENDIF(BUILD_CORE)
+
+IF(BUILD_GUI OR BUILD_MONO)  # OK, now we need QtGui!
+  REMOVE_DEFINITIONS(-DQT_CORE_LIB -DQT_GUI_LIB ${QT_DEFINITIONS})
+  SET(QT_DONT_USE_QTGUI "")
+  SET(QT_INCLUDE_DIR "")
+  SET(QT_LIBRARIES "")
+  INCLUDE(${QT_USE_FILE})
+
+  IF(BUILD_MONO)
+    ADD_SUBDIRECTORY(gui)
+    ADD_EXECUTABLE(quassel ${quassel_mono_SRCS} ${_RCCS})
+    TARGET_LINK_LIBRARIES(quassel gui core ${QT_LIBRARIES})
+  ENDIF(BUILD_MONO)
 
-IF(BUILD_SERVER)
-#  MESSAGE(FATAL_ERROR "Server mode not yet supported.")
-  ADD_EXECUTABLE(quasselserver ${quassel_mono_SRCS} ${_RCCS})
-  TARGET_LINK_LIBRARIES(quasselserver gui core ${QT_LIBRARIES})
-ENDIF(BUILD_SERVER)
+  IF(BUILD_GUI)
+    ADD_SUBDIRECTORY(gui)
+    MESSAGE(FATAL_ERROR "Client mode not yet supported.")
+  ENDIF(BUILD_GUI)
 
-IF(BUILD_CLIENT)
-  MESSAGE(FATAL_ERROR "Client mode not yet supported.")
-ENDIF(BUILD_CLIENT)
+ENDIF(BUILD_GUI OR BUILD_MONO)
index 71f620c..4c00fa9 100644 (file)
@@ -1,5 +1,5 @@
-SET(core_SRCS logger.cpp quassel.cpp)
-SET(core_HDRS quassel.h)
+SET(core_SRCS logger.cpp quassel.cpp proxy.cpp core.cpp)
+SET(core_HDRS quassel.h proxy.h core.h)
 SET(core_MOCS logger.h)
 
 QT4_WRAP_CPP(_MOC ${core_MOCS})
diff --git a/core/core.cpp b/core/core.cpp
new file mode 100644 (file)
index 0000000..4d14402
--- /dev/null
@@ -0,0 +1,38 @@
+/***************************************************************************
+ *   Copyright (C) 2005/06 by The Quassel Team                             *
+ *   devel@quassel-irc.org                                                 *
+ *                                                                         *
+ *   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 2 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, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+
+#include "core.h"
+
+#include <QSettings>
+
+void Core::init() {
+
+
+}
+
+VarMap Core::loadIdentities() {
+  QSettings s;
+  return s.value("Network/Identities").toMap();
+}
+
+void Core::storeIdentities(VarMap identities) {
+  QSettings s;
+  s.setValue("Network/Identities", identities);
+}
diff --git a/core/core.h b/core/core.h
new file mode 100644 (file)
index 0000000..4220056
--- /dev/null
@@ -0,0 +1,41 @@
+/***************************************************************************
+ *   Copyright (C) 2005/06 by The Quassel Team                             *
+ *   devel@quassel-irc.org                                                 *
+ *                                                                         *
+ *   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 2 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, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+
+#ifndef _CORE_H_
+#define _CORE_H_
+
+#include <QMap>
+#include <QString>
+#include <QVariant>
+
+typedef QMap<QString, QVariant> VarMap;
+
+class Core {
+
+  public:
+    static void init();
+    static VarMap loadNetworks();
+    static void storeNetworks(VarMap);
+    static VarMap loadIdentities();
+    static void storeIdentities(VarMap);
+
+};
+
+#endif
diff --git a/core/proxy.cpp b/core/proxy.cpp
new file mode 100644 (file)
index 0000000..acf0f78
--- /dev/null
@@ -0,0 +1,54 @@
+/***************************************************************************
+ *   Copyright (C) 2005/06 by The Quassel Team                             *
+ *   devel@quassel-irc.org                                                 *
+ *                                                                         *
+ *   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 2 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, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+
+#include "proxy.h"
+
+#include <iostream>
+
+using namespace Proxy;
+
+VarMap CoreProxy::loadIdentities() {
+  return Core::loadIdentities();
+}
+
+void CoreProxy::storeIdentities(VarMap id) {
+  Core::storeIdentities(id);
+}
+
+
+
+VarMap GuiProxy::loadIdentities() {
+  return proxyConnect(LOAD_IDENTITIES).toMap();
+}
+
+void GuiProxy::storeIdentities(VarMap arg) {
+  proxyConnect(STORE_IDENTITIES, arg);
+}
+
+/*
+QVariant proxyConnect(uint func, QVariant arg) {
+  switch(func) {
+    case LOAD_IDENTITIES: return (QVariant) CoreProxy::loadIdentities();
+    case STORE_IDENTITIES: CoreProxy::storeIdentities(arg.toMap()); return 0;
+
+  }
+  return 0;
+}
+*/
\ No newline at end of file
diff --git a/core/proxy.h b/core/proxy.h
new file mode 100644 (file)
index 0000000..ca0319b
--- /dev/null
@@ -0,0 +1,51 @@
+/***************************************************************************
+ *   Copyright (C) 2005/06 by The Quassel Team                             *
+ *   devel@quassel-irc.org                                                 *
+ *                                                                         *
+ *   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 2 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, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+
+#ifndef _PROXY_H_
+#define _PROXY_H_
+
+#include "core.h"
+
+namespace Proxy {
+  enum { LOAD_IDENTITIES, STORE_IDENTITIES };
+};
+
+class CoreProxy {
+  Q_OBJECT
+
+  public:
+    static VarMap loadIdentities();
+    static void storeIdentities(VarMap);
+
+};
+
+
+class GuiProxy {
+  Q_OBJECT
+
+  public:
+    static VarMap loadIdentities();
+    static void storeIdentities(VarMap);
+
+};
+
+extern QVariant proxyConnect(uint func, QVariant arg = QVariant());
+
+#endif
index 9149263..eb9d236 100644 (file)
@@ -20,8 +20,8 @@
 
 #include "quassel.h"
 #include "logger.h"
+#include "proxy.h"
 
-#include <QIcon>
 #include <QString>
 #include <QDomDocument>
 
@@ -37,6 +37,8 @@ void Quassel::setLogger(Logger *) {
 
 /* not done yet */
 void Quassel::initIconMap() {
+// Do not depend on GUI in core!
+/*
   QDomDocument doc("IconMap");
   QFile file("images/iconmap.xml");
   if(!file.open(QIODevice::ReadOnly)) {
@@ -49,6 +51,7 @@ void Quassel::initIconMap() {
     file.close();
 
   }
+*/
 }
 
 
@@ -58,8 +61,9 @@ void Quassel::initIconMap() {
  * @param symbol Symbol of requested icon
  * @return Pointer to a newly created QIcon
  */
-QIcon *Quassel::getIcon(QString /*symbol*/) {
+//
+//QIcon *Quassel::getIcon(QString /*symbol*/) {
   //if(symbol == "connect"
 
-  return 0;
-}
+//  return 0;
+//}
index 0c2a11b..08a72d5 100644 (file)
@@ -22,7 +22,6 @@
 #define _QUASSEL_H_
 
 class Logger;
-class QIcon;
 class QString;
 
 #include <QHash>
@@ -38,14 +37,14 @@ class Quassel {
     static Logger *getLogger();
     static void setLogger(Logger *);
 
-    static QIcon *getIcon(QString symbol);
+//    static QIcon *getIcon(QString symbol);
 
   private:
     static void initIconMap();
     
     static Logger *logger;
 
-    static QString iconPath;
+//    static QString iconPath;
     static QHash<QString, QString> iconMap;
 
 };
index 0415a01..35eebf6 100644 (file)
@@ -7,8 +7,7 @@ QT4_WRAP_UI(_UIC ${gui_UICS})
 QT4_WRAP_CPP(_MOC ${gui_MOCS})
 
 # We need to workaround a dependency bug with out-of-source builds...
-SET_SOURCE_FILES_PROPERTIES(${gui_SRCS} PROPERTIES
-OBJECT_DEPENDS "${_UIC}")
+SET_SOURCE_FILES_PROPERTIES(${gui_SRCS} PROPERTIES OBJECT_DEPENDS "${_UIC}")
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
 
 ADD_LIBRARY(gui ${gui_HDRS} ${gui_SRCS} ${_MOC} ${_UIC})
index 221eb2a..b194c60 100644 (file)
@@ -19,6 +19,7 @@
  ***************************************************************************/
 
 #include "serverlist.h"
+#include "proxy.h"
 
 /* NOTE: This dialog holds not only the server list, but also the identities.
  *       This makes perfect sense given the fact that connections are initiated from
@@ -113,9 +114,10 @@ void ServerListDlg::storeNetworks() {
 }
 
 void ServerListDlg::loadIdentities() {
 QSettings s;
//QSettings s;
   //s.beginGroup("Identities");
-  identities = s.value("Network/Identities").toMap();
+  //identities = s.value("Network/Identities").toMap();
+  identities = GuiProxy::loadIdentities();
   while(!identities.contains("Default")) {
     identities = VarMap();
     editIdentities();
@@ -123,8 +125,9 @@ void ServerListDlg::loadIdentities() {
 }
 
 void ServerListDlg::storeIdentities() {
-  QSettings s;
-  s.setValue("Network/Identities", identities);
+  //QSettings s;
+  //s.setValue("Network/Identities", identities);
+  GuiProxy::storeIdentities(identities);
 }
 
 void ServerListDlg::editIdentities() {
diff --git a/main/main_core.cpp b/main/main_core.cpp
new file mode 100644 (file)
index 0000000..f8e6630
--- /dev/null
@@ -0,0 +1,51 @@
+/***************************************************************************
+ *   Copyright (C) 2005/06 by The Quassel Team                             *
+ *   devel@quassel-irc.org                                                 *
+ *                                                                         *
+ *   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 2 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, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+#include <iostream>
+
+#include <QCoreApplication>
+
+#include "quassel.h"
+#include "logger.h"
+#include "proxy.h"
+
+int main(int argc, char **argv) {
+
+  Core::init();
+  Quassel::init();
+  Logger *logger = new Logger();
+  Quassel::setLogger(logger);
+
+  QCoreApplication app(argc, argv);
+
+  QCoreApplication::setOrganizationDomain("quassel-irc.org");
+  QCoreApplication::setApplicationName("Quassel IRC");
+  QCoreApplication::setOrganizationName("The Quassel Team");
+
+  return app.exec();
+}
+
+QVariant proxyConnect(uint func, QVariant arg) {
+  switch(func) {
+    case LOAD_IDENTITIES: return (QVariant) CoreProxy::loadIdentities();
+    case STORE_IDENTITIES: CoreProxy::storeIdentities(arg.toMap()); return 0;
+
+  }
+  return 0;
+}
index 620084b..b935a12 100644 (file)
 
 #include <QApplication>
 
+#include "core.h"
 #include "quassel.h"
 #include "logger.h"
+#include "proxy.h"
 
 #include "mainwin.h"
 
@@ -39,7 +41,20 @@ int main(int argc, char **argv) {
   QApplication::setApplicationName("Quassel IRC");
   QApplication::setOrganizationName("The Quassel Team");
 
+  Core::init();
+
   MainWin mainWin;
   mainWin.show();
   return app.exec();
 }
+
+QVariant proxyConnect(uint func, QVariant arg) {
+  using namespace Proxy;
+
+  switch(func) {
+    case LOAD_IDENTITIES: return (QVariant) CoreProxy::loadIdentities();
+    case STORE_IDENTITIES: CoreProxy::storeIdentities(arg.toMap()); return 0;
+
+  }
+  return 0;
+}