Remove dummy blackd folder

blackd contained dummy code for a future daemon running
blackcore. It was just a dummy window and every
other line of code contained deprecated dependencies.

refs #90
This commit is contained in:
Roland Winklmeier
2014-02-04 18:31:53 +01:00
parent 17534e5154
commit e6a29a083e
11 changed files with 0 additions and 688 deletions

View File

@@ -1,25 +0,0 @@
FILE(GLOB blackd_SOURCES *.cpp)
FILE(GLOB blackd_HEADERS *.h)
SET(blackd_HEADERS_QOBJECT
blackd.h)
SET(blackd_FORMS blackd.ui)
SET(blackd_RESOURCES blackd.qrc)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
QT4_WRAP_CPP(blackd_HEADERS_MOC ${blackd_HEADERS_QOBJECT})
QT4_WRAP_UI(blackd_FORMS_HEADERS ${blackd_FORMS})
QT4_ADD_RESOURCES(blackd_RESOURCES_RCC ${blackd_RESOURCES})
SOURCE_GROUP(QtGeneratedMocSrc FILES ${blackd_HEADERS_MOC})
SOURCE_GROUP (QtResources FILES ${blackd_RESOURCES_RCC})
SOURCE_GROUP (QtForms FILES ${blackd_FORMS_HEADERS})
ADD_EXECUTABLE(blackd WIN32 MACOSX_BUNDLE ${blackd_SOURCES}
${blackd_HEADERS_MOC}
${blackd_FORMS_HEADERS}
${blackd_RESOURCES_RCC})
TARGET_LINK_LIBRARIES(blackd blackmisc blackcore ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY})
SET_TARGET_PROPERTIES(blackd PROPERTIES PROJECT_LABEL "BlackBox Daemon - blackd")

View File

@@ -1,174 +0,0 @@
//! Copyright (C) 2013 Roland Winklmeier
//! This Source Code Form is subject to the terms of the Mozilla Public
//! License, v. 2.0. If a copy of the MPL was not distributed with this
//! file, You can obtain one at http://mozilla.org/MPL/2.0/
#include <QtGui>
#include <QMessageBox>
#include <QMenu>
#include "blackmisc/context.h"
#include "blackmisc/debug.h"
#include "blackmisc/message_factory.h"
#include "blackcore/fsd_client.h"
#include "qt_displayer.h"
#include "blackd.h"
#include "ui_blackd.h"
using namespace FSD;
BlackD::BlackD(QWidget *parent) :
QDialog(parent),
ui(new Ui::BlackD)
{
ui->setupUi(this);
createActions();
createTrayIcon();
connect(trayIcon, &QSystemTrayIcon::activated,
this, &BlackD::iconActivated);
setWindowTitle(tr("BlackD"));
QIcon icon = QIcon(":/images/blackbox_icon.svg");
trayIcon->setIcon(icon);
trayIcon->show();
setWindowIcon(icon);
createLogging();
createComServer();
m_fsd_client = new CFSDClient(BlackMisc::IContext::getInstance());
bAppDebug << "BlackDaemon running...";
}
BlackD::~BlackD()
{
delete ui;
}
void BlackD::setVisible(bool visible)
{
minimizeAction->setEnabled(visible);
maximizeAction->setEnabled(!isMaximized());
restoreAction->setEnabled(isMaximized() || !visible);
QDialog::setVisible(visible);
}
void BlackD::closeEvent(QCloseEvent *event)
{
if (trayIcon->isVisible())
{
QMessageBox::information(this, tr("BlackD"),
tr("The program will keep running in the "
"system tray. To terminate the program, "
"choose <b>Quit</b> in the context menu "
"of the system tray entry."));
hide();
event->ignore();
}
}
void BlackD::iconActivated(QSystemTrayIcon::ActivationReason reason)
{
switch (reason)
{
case QSystemTrayIcon::DoubleClick:
setVisible(!isVisible());
break;
default:
break;
}
}
void BlackD::createActions()
{
minimizeAction = new QAction(tr("Mi&nimize"), this);
connect(minimizeAction, SIGNAL(triggered()), this, SLOT(hide()));
maximizeAction = new QAction(tr("Ma&ximize"), this);
connect(maximizeAction, SIGNAL(triggered()), this, SLOT(showMaximized()));
restoreAction = new QAction(tr("&Restore"), this);
connect(restoreAction, SIGNAL(triggered()), this, SLOT(showNormal()));
quitAction = new QAction(tr("&Quit"), this);
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
}
void BlackD::createTrayIcon()
{
trayIconMenu = new QMenu(this);
trayIconMenu->addAction(minimizeAction);
trayIconMenu->addAction(maximizeAction);
trayIconMenu->addAction(restoreAction);
trayIconMenu->addSeparator();
trayIconMenu->addAction(quitAction);
trayIcon = new QSystemTrayIcon(this);
trayIcon->setContextMenu(trayIconMenu);
}
void BlackD::createLogging()
{
BlackMisc::IContext::getInstance().getDebug().create();
m_displayer = new CQtDisplayer(ui->logginView);
BlackMisc::IContext::getInstance().getDebug().getDebugLog()->attachDisplay(m_displayer);
BlackMisc::IContext::getInstance().getDebug().getInfoLog()->attachDisplay(m_displayer);
BlackMisc::IContext::getInstance().getDebug().getWarningLog()->attachDisplay(m_displayer);
BlackMisc::IContext::getInstance().getDebug().getErrorLog()->attachDisplay(m_displayer);
}
void BlackD::createComServer()
{
BlackMisc::CMessageFactory::getInstance().registerMessages();
m_comserver = new BlackMisc::CComServer(BlackMisc::IContext::getInstance(), this);
registerMessageFunction(this, &BlackD::onMSG_CONNECT_TO_VATSIM);
QHostAddress local = QHostAddress(QHostAddress::LocalHost);
m_comserver->Host(local, 42000);
connect(m_comserver, SIGNAL(doMessageReceived(QString &, QByteArray &)), this, SLOT(onData(QString &, QByteArray &)));
}
void BlackD::onData(QString &messageID, QByteArray &message)
{
bAppDebug << messageID;
BlackMisc::IMessage *test = BlackMisc::CMessageFactory::getInstance().create(messageID);
QDataStream stream(&message, QIODevice::ReadOnly);
Q_ASSERT(test);
*test << stream;
BlackMisc::CMessageDispatcher::getInstance().append(test);
BlackMisc::CMessageDispatcher::getInstance().dispatch();
}
void BlackD::onMSG_CONNECT_TO_VATSIM(const BlackMisc::MSG_CONNECT_TO_VATSIM *connect)
{
bAppDebug << "Connecting to FSD server:";
bAppDebug << connect->getHost() << ":" << connect->getPort();
FSD::TClientInfo clientinfo;
clientinfo.m_callsign = connect->getCallsign();
clientinfo.m_host = connect->getHost();
clientinfo.m_password = connect->getPassword();
clientinfo.m_port = connect->getPort();
clientinfo.m_realName = connect->getRealName();
clientinfo.m_simType = FSD::SIM_UNKNOWN;
clientinfo.m_userid = connect->getUserID();
m_fsd_client->updateClientInfo(clientinfo);
m_fsd_client->connectTo(connect->getHost(), connect->getPort());
}

View File

@@ -1,73 +0,0 @@
//! Copyright (C) 2013 Roland Winklmeier
//! This Source Code Form is subject to the terms of the Mozilla Public
//! License, v. 2.0. If a copy of the MPL was not distributed with this
//! file, You can obtain one at http://mozilla.org/MPL/2.0/
#ifndef BLACKD_H
#define BLACKD_H
#include <QSystemTrayIcon>
#include <QDialog>
#include "blackmisc/com_server.h"
#include "blackmisc/gui_messages.h"
#include "blackmisc/message_system.h"
namespace Ui {
class BlackD;
}
namespace FSD {
class CFSDClient;
}
class CQtDisplayer;
class CMultiPlayer;
class BlackD : public QDialog, public BlackMisc::CMessageHandler
{
Q_OBJECT
public:
explicit BlackD(QWidget *parent = 0);
~BlackD();
void setVisible(bool visible);
protected:
void closeEvent(QCloseEvent *event);
private slots:
void iconActivated(QSystemTrayIcon::ActivationReason reason);
void onData(QString &messageID, QByteArray &message);
private:
void createActions();
void createTrayIcon();
void createLogging();
void createComServer();
//! Messages
void onMSG_CONNECT_TO_VATSIM(const BlackMisc::MSG_CONNECT_TO_VATSIM *connect);
Ui::BlackD *ui;
QAction *minimizeAction;
QAction *maximizeAction;
QAction *restoreAction;
QAction *quitAction;
QSystemTrayIcon *trayIcon;
QMenu *trayIconMenu;
CQtDisplayer *m_displayer;
FSD::CFSDClient *m_fsd_client;
CMultiPlayer *m_multi_player;
BlackMisc::CComServer *m_comserver;
};
#endif // BLACKD_H

View File

@@ -1,29 +0,0 @@
QT += core gui xml svg network
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = blackd
TEMPLATE = app
CONFIG += c++11
DEPENDPATH += . ..
INCLUDEPATH += ..
SOURCES += *.cpp
HEADERS += *.h
FORMS += blackd.ui
RESOURCES += blackd.qrc
LIBS += -L../../lib -lblackcore -lblackmisc
win32:!win32-g++*: PRE_TARGETDEPS += ../../lib/blackmisc.lib \
../../lib/blackcore.lib
else: PRE_TARGETDEPS += ../../lib/libblackmisc.a \
../../lib/libblackcore.a
DESTDIR = ../../bin

View File

@@ -1,5 +0,0 @@
<RCC>
<qresource prefix="/">
<file>images/blackbox_icon.svg</file>
</qresource>
</RCC>

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>BlackD</class>
<widget class="QDialog" name="BlackD">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QPlainTextEdit" name="logginView">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>381</width>
<height>281</height>
</rect>
</property>
</widget>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

View File

@@ -1,101 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="64px"
height="64px"
id="svg2985"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="blackbox.svg">
<defs
id="defs2987" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="11.266818"
inkscape:cx="26.048327"
inkscape:cy="29.250352"
inkscape:current-layer="g3012"
showgrid="true"
inkscape:document-units="px"
inkscape:grid-bbox="true"
inkscape:window-width="1680"
inkscape:window-height="988"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1" />
<metadata
id="metadata2990">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<g
id="g3012"
transform="matrix(0.09962527,0,0,0.13270424,0.35358383,-0.14036314)">
<title
id="title3014">Layer 1</title>
<path
d="m 80.445297,559.84167 0,-637.468173 476.953563,637.468173 -476.953563,0 z"
id="svg_3"
transform="matrix(0.00183958,-0.99999831,0.99999831,0.00183958,77.228725,559.58692)"
inkscape:connector-curvature="0"
style="fill:#000000;stroke:#000000;stroke-width:5" />
<text
x="93"
y="266"
id="svg_4"
font-size="317"
xml:space="preserve"
style="font-size:317px;text-anchor:middle;fill:#000000;stroke:#000000;stroke-width:0;font-family:Cursive"><tspan
style="-inkscape-font-specification:Comic Sans MS;font-family:Comic Sans MS;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal"
id="tspan3052">B</tspan></text>
<text
x="445"
y="443"
id="svg_5"
font-size="216"
xml:space="preserve"
style="font-size:216px;text-anchor:middle;fill:#ffffff;stroke:#000000;stroke-width:0;font-family:Cursive"><tspan
style="fill:#f9f9f9;font-weight:bold;-inkscape-font-specification:Comic Sans MS Bold;font-family:Comic Sans MS;font-style:normal;font-stretch:normal;font-variant:normal;font-size:208.72962190999999000px"
id="tspan3048">Box</tspan></text>
<text
x="254"
y="87"
id="svg_6"
font-size="0.001"
xml:space="preserve"
style="font-size:0.001px;text-anchor:middle;fill:#000000;stroke:#000000;stroke-width:0;font-family:Cursive" />
<text
x="315"
y="129"
id="svg_7"
font-size="147"
xml:space="preserve"
style="font-size:147px;text-anchor:middle;fill:#000000;stroke:#000000;stroke-width:0;font-family:Cursive"><tspan
style="-inkscape-font-specification:Comic Sans MS;font-family:Comic Sans MS;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal"
id="tspan3050">lack</tspan></text>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.6 KiB

View File

@@ -1,102 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="64px"
height="64px"
id="svg2985"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="blackbox.svg">
<defs
id="defs2987" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="11.266818"
inkscape:cx="26.048327"
inkscape:cy="32.591504"
inkscape:current-layer="g3012"
showgrid="true"
inkscape:document-units="px"
inkscape:grid-bbox="true"
inkscape:window-width="1680"
inkscape:window-height="988"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1" />
<metadata
id="metadata2990">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<g
id="g3012"
transform="matrix(0.09962527,0,0,0.13270424,0.35358383,-0.14036314)">
<title
id="title3014">Layer 1</title>
<path
d="m 80.445297,559.84167 0,-637.468173 476.953563,637.468173 -476.953563,0 z"
id="svg_3"
transform="matrix(0.00183958,-0.99999831,0.99999831,0.00183958,77.228725,559.58692)"
inkscape:connector-curvature="0"
style="fill:#000000;stroke:#000000;stroke-width:5" />
<text
x="119.72701"
y="300.77899"
id="svg_4"
font-size="317"
xml:space="preserve"
style="font-size:373.97390747px;text-anchor:middle;fill:#000000;stroke:#000000;stroke-width:0;font-family:Cursive"><tspan
style="font-size:373.97390747px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:Comic Sans MS;-inkscape-font-specification:Comic Sans MS Bold"
id="tspan3052">B</tspan></text>
<text
x="515.95374"
y="457.04535"
id="svg_5"
font-size="216"
xml:space="preserve"
style="font-size:216px;text-anchor:middle;fill:#ffffff;stroke:#000000;stroke-width:0;font-family:Cursive"><tspan
style="font-size:373.97390747px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#f9f9f9;font-family:Comic Sans MS;-inkscape-font-specification:Comic Sans MS Bold"
id="tspan3048">B</tspan></text>
<text
x="254"
y="87"
id="svg_6"
font-size="0.001"
xml:space="preserve"
style="font-size:0.001px;text-anchor:middle;fill:#000000;stroke:#000000;stroke-width:0;font-family:Cursive" />
<text
x="315"
y="129"
id="svg_7"
font-size="147"
xml:space="preserve"
style="font-size:147px;text-anchor:middle;fill:#000000;stroke:#000000;stroke-width:0;font-family:Cursive"><tspan
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Comic Sans MS;-inkscape-font-specification:Comic Sans MS"
id="tspan3050" /></text>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.7 KiB

View File

@@ -1,37 +0,0 @@
//! Copyright (C) 2013 Roland Winklmeier
//! This Source Code Form is subject to the terms of the Mozilla Public
//! License, v. 2.0. If a copy of the MPL was not distributed with this
//! file, You can obtain one at http://mozilla.org/MPL/2.0/
#include "blackmisc/context.h"
#include "blackmisc/debug.h"
#include "blackd.h"
#include <QApplication>
#include <QMessageBox>
#include <QtGui>
int main(int argc, char *argv[])
{
Q_INIT_RESOURCE(blackd);
QApplication app(argc, argv);
BlackMisc::CApplicationContext ctx;
BlackMisc::IContext::setInstance(ctx);
BlackMisc::CDebug debug;
ctx.setObject(debug);
if (!QSystemTrayIcon::isSystemTrayAvailable()) {
QMessageBox::critical(0, QObject::tr("Systray"),
QObject::tr("I couldn't detect any system tray "
"on this system."));
return 1;
}
QApplication::setQuitOnLastWindowClosed(false);
BlackD w;
w.hide();
return app.exec();
}

View File

@@ -1,78 +0,0 @@
//! Copyright (C) 2013 Roland Winklmeier
//! This Source Code Form is subject to the terms of the Mozilla Public
//! License, v. 2.0. If a copy of the MPL was not distributed with this
//! file, You can obtain one at http://mozilla.org/MPL/2.0/
#include "qt_displayer.h"
using namespace BlackMisc;
CQtDisplayer::CQtDisplayer(QPlainTextEdit *debugWindow, const char *displayerName)
: ILogDisplay (displayerName), m_needHeader(true)
{
setParam(debugWindow);
}
CQtDisplayer::CQtDisplayer()
: ILogDisplay (""), m_needHeader(true)
{
}
CQtDisplayer::~CQtDisplayer() {
}
void CQtDisplayer::setParam (QPlainTextEdit *debugWindow)
{
m_DebugWindow=debugWindow;
}
void CQtDisplayer::doPrint ( const BlackMisc::CLog::SLogInformation &logInformation, const QString &message)
{
if (!m_DebugWindow)
return;
bool needSpace = false;
QString line;
if(m_DebugWindow==NULL)
return;
QTextCharFormat format;
if (logInformation.m_dateTime.isValid()) {
line += dateToString(logInformation.m_dateTime);
needSpace = true;
}
if (logInformation.m_logType != CLog::eOff)
{
if (needSpace) { line += " "; needSpace = false; }
line += logTypeToString(logInformation.m_logType);
if (logInformation.m_logType == BlackMisc::CLog::eWarning)
format.setForeground(QBrush(QColor("red")));
else
format.setForeground(QBrush(QColor("black")));
needSpace = true;
}
if (logInformation.m_methodName != NULL)
{
if (needSpace)
{
line += " "; needSpace = false;
}
line += logInformation.m_methodName;
needSpace = true;
}
if (needSpace)
{
line += " : "; needSpace = false;
}
line += message;
m_DebugWindow->textCursor().insertText(line, format);
m_DebugWindow->centerCursor();
}

View File

@@ -1,31 +0,0 @@
//! Copyright (C) 2013 Roland Winklmeier
//! This Source Code Form is subject to the terms of the Mozilla Public
//! License, v. 2.0. If a copy of the MPL was not distributed with this
//! file, You can obtain one at http://mozilla.org/MPL/2.0/
#ifndef QT_DISPLAYER_H
#define QT_DISPLAYER_H
#include "blackmisc/display.h"
// Qt includes
#include <QPlainTextEdit>
class CQtDisplayer : virtual public BlackMisc::ILogDisplay
{
public:
CQtDisplayer(QPlainTextEdit *debugWindow,
const char *displayerName = "");
CQtDisplayer();
~CQtDisplayer ();
void setParam (QPlainTextEdit *debugWindow);
protected:
virtual void doPrint(const BlackMisc::CLog::SLogInformation &logInformation, const QString &message);
private:
QPlainTextEdit *m_DebugWindow;
bool m_needHeader;
};
#endif // QT_DISPLAYER_H