new project for server
authorDavid Solbach <d@vidsolbach.de>
Sun, 14 Nov 2010 06:01:47 +0000 (07:01 +0100)
committerDavid Solbach <d@vidsolbach.de>
Sun, 14 Nov 2010 06:01:47 +0000 (07:01 +0100)
buliscores-server/buliscores-server.pro [new file with mode: 0644]
buliscores-server/buliscoressrv.cpp [new file with mode: 0644]
buliscores-server/buliscoressrv.h [new file with mode: 0644]
buliscores-server/main.cpp [new file with mode: 0644]
buliscores.pro.user
src/src/backendkicker.cpp

diff --git a/buliscores-server/buliscores-server.pro b/buliscores-server/buliscores-server.pro
new file mode 100644 (file)
index 0000000..611fd92
--- /dev/null
@@ -0,0 +1,23 @@
+#-------------------------------------------------
+#
+# Project created by QtCreator 2010-11-14T06:42:15
+#
+#-------------------------------------------------
+
+QT       += core
+QT       += network
+
+QT       -= gui
+
+TARGET = buliscores-server
+CONFIG   += console
+CONFIG   -= app_bundle
+
+TEMPLATE = app
+
+
+SOURCES += main.cpp \
+    buliscoressrv.cpp
+
+HEADERS += \
+    buliscoressrv.h
diff --git a/buliscores-server/buliscoressrv.cpp b/buliscores-server/buliscoressrv.cpp
new file mode 100644 (file)
index 0000000..05e26d6
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2010 David Solbach <d@vidsolbach.de>
+ *
+ * This file is part of BuliScores.
+ *
+ * BuliScores is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * BiliScores 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#include "buliscoressrv.h"
+
+BuliScoresSrv::BuliScoresSrv(QObject *parent) :
+    QObject(parent)
+{
+}
diff --git a/buliscores-server/buliscoressrv.h b/buliscores-server/buliscoressrv.h
new file mode 100644 (file)
index 0000000..0f8aa82
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2010 David Solbach <d@vidsolbach.de>
+ *
+ * This file is part of BuliScores.
+ *
+ * BuliScores is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * BiliScores 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+#ifndef BULISCORESSRV_H
+#define BULISCORESSRV_H
+
+#include <QObject>
+#include <QTcpServer>
+
+class BuliScoresSrv : public QObject
+{
+    Q_OBJECT
+private:
+    QTcpServer m_tcpServer;
+
+public:
+    explicit BuliScoresSrv(QObject *parent = 0);
+
+signals:
+
+public slots:
+
+};
+
+#endif // BULISCORESSRV_H
diff --git a/buliscores-server/main.cpp b/buliscores-server/main.cpp
new file mode 100644 (file)
index 0000000..0ae31c6
--- /dev/null
@@ -0,0 +1,59 @@
+#include <QtCore/QCoreApplication>
+#include <QDateTime>
+#include <QFile>
+#include <QTextStream>
+
+void messageHandler(QtMsgType type, const char *msg)
+{
+    static QFile logfile;
+    static QTextStream fw;
+    static const QString LOGFILE_PATH = "/tmp/buliscores.log";
+    static const QtMsgType LOGLEVEL = QtDebugMsg;
+    QString out;
+
+    if (type < LOGLEVEL) {
+        return;
+    }
+
+    if (logfile.isOpen() == false) {
+        logfile.setFileName(LOGFILE_PATH);
+        if (logfile.open(QIODevice::Append) == true) {
+            fw.setDevice((QIODevice*)&logfile);
+            fw << "Logfile Opened: " << QDateTime::currentDateTime().toString();
+        }
+    }
+
+    switch (type) {
+    case QtDebugMsg:
+        out = "%1   Debug: %2\n";
+        break;
+    case QtWarningMsg:
+        out = "%1   Warning: %2\n";
+        break;
+    case QtCriticalMsg:
+        out = "%1   Critical: %2\n";
+        break;
+    case QtFatalMsg:
+        out = "%1   Fatal: %2\n";
+        break;
+    }
+
+    out = out.arg(QDateTime::currentDateTime().toString(), msg);
+
+    if (logfile.isOpen()) {
+        fw << out;
+        fw.flush();
+    }
+    printf("%s", out.toAscii().constData());
+
+    if (type == QtFatalMsg) {
+        qApp->exit(-1);
+    }
+}
+
+int main(int argc, char *argv[])
+{
+    QCoreApplication a(argc, argv);
+
+    return a.exec();
+}
index 59a8a9a..06b37e1 100644 (file)
@@ -16,7 +16,7 @@
    <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Desktop</value>
    <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Target.DesktopTarget</value>
    <value key="ProjectExplorer.Target.ActiveBuildConfiguration" type="int">0</value>
-   <value key="ProjectExplorer.Target.ActiveRunConfiguration" type="int">4</value>
+   <value key="ProjectExplorer.Target.ActiveRunConfiguration" type="int">0</value>
    <valuemap key="ProjectExplorer.Target.BuildConfiguration.0" type="QVariantMap">
     <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
      <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
    </valuemap>
    <value key="ProjectExplorer.Target.BuildConfigurationCount" type="int">2</value>
    <valuemap key="ProjectExplorer.Target.RunConfiguration.0" type="QVariantMap">
-    <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">cmdline_tester</value>
-    <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4RunConfiguration</value>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.BaseEnvironmentBase" type="int">2</value>
-    <valuelist key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments" type="QVariantList"/>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.ProFile" type="QString">qjson/tests/cmdline_tester/cmdline_tester.pro</value>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix" type="bool">false</value>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal" type="bool">false</value>
-    <valuelist key="Qt4ProjectManager.Qt4RunConfiguration.UserEnvironmentChanges" type="QVariantList"/>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.UserSetName" type="bool">false</value>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.UserSetWorkingDirectory" type="bool">false</value>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory" type="QString"></value>
-   </valuemap>
-   <valuemap key="ProjectExplorer.Target.RunConfiguration.1" type="QVariantMap">
-    <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">parser</value>
-    <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4RunConfiguration</value>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.BaseEnvironmentBase" type="int">2</value>
-    <valuelist key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments" type="QVariantList"/>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.ProFile" type="QString">qjson/tests/parser/parser.pro</value>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix" type="bool">false</value>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal" type="bool">false</value>
-    <valuelist key="Qt4ProjectManager.Qt4RunConfiguration.UserEnvironmentChanges" type="QVariantList"/>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.UserSetName" type="bool">false</value>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.UserSetWorkingDirectory" type="bool">false</value>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory" type="QString"></value>
-   </valuemap>
-   <valuemap key="ProjectExplorer.Target.RunConfiguration.2" type="QVariantMap">
-    <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qobjecthelper</value>
-    <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4RunConfiguration</value>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.BaseEnvironmentBase" type="int">2</value>
-    <valuelist key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments" type="QVariantList"/>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.ProFile" type="QString">qjson/tests/qobjecthelper/qobjecthelper.pro</value>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix" type="bool">false</value>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal" type="bool">false</value>
-    <valuelist key="Qt4ProjectManager.Qt4RunConfiguration.UserEnvironmentChanges" type="QVariantList"/>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.UserSetName" type="bool">false</value>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.UserSetWorkingDirectory" type="bool">false</value>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory" type="QString"></value>
-   </valuemap>
-   <valuemap key="ProjectExplorer.Target.RunConfiguration.3" type="QVariantMap">
-    <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">serializer</value>
-    <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4RunConfiguration</value>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.BaseEnvironmentBase" type="int">2</value>
-    <valuelist key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments" type="QVariantList"/>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.ProFile" type="QString">qjson/tests/serializer/serializer.pro</value>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix" type="bool">false</value>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal" type="bool">false</value>
-    <valuelist key="Qt4ProjectManager.Qt4RunConfiguration.UserEnvironmentChanges" type="QVariantList"/>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.UserSetName" type="bool">false</value>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.UserSetWorkingDirectory" type="bool">false</value>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory" type="QString"></value>
-   </valuemap>
-   <valuemap key="ProjectExplorer.Target.RunConfiguration.4" type="QVariantMap">
     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">src</value>
     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4RunConfiguration</value>
     <value key="Qt4ProjectManager.Qt4RunConfiguration.BaseEnvironmentBase" type="int">2</value>
     <value key="Qt4ProjectManager.Qt4RunConfiguration.UserSetWorkingDirectory" type="bool">false</value>
     <value key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory" type="QString"></value>
    </valuemap>
-   <value key="ProjectExplorer.Target.RunConfigurationCount" type="int">5</value>
+   <value key="ProjectExplorer.Target.RunConfigurationCount" type="int">1</value>
   </valuemap>
  </data>
  <data>
index f52755d..ad16b60 100644 (file)
@@ -9,6 +9,7 @@
 #include <QApplication>
 
 #include <qjson/qobjecthelper.h>
+#include <qjson/serializer.h>
 
 #include "backendkicker.h"
 
@@ -76,11 +77,14 @@ QVariant BackendKicker::serializableData()
     QList<QVariant>         list;
     QListIterator<Match*>   iter(m_matchlist);
     Match*                  match;
+    QJson::Serializer       serializer;
+
 
     while (iter.hasNext()) {
         match = iter.next();
 
         matchvariantmap = QJson::QObjectHelper::qobject2qvariant(match);
+        qDebug() << serializer.serialize(matchvariantmap);
         list.append(QVariant(matchvariantmap));
     }