fixed bad project structure

This commit is contained in:
Anselme 2015-06-02 22:38:57 +02:00
parent 782eafe5cb
commit 1cffbc6fb6
10 changed files with 35 additions and 23 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@ release/*
*.Release
Makefile
ui_*
bin/*

1
.qmake.conf Normal file
View File

@ -0,0 +1 @@
top_srcdir=$$PWD/bin

View File

@ -1,5 +1,7 @@
QT += core gui network widgets
BIN = bin
TEMPLATE = subdirs
CONFIG += ordered c++11
SUBDIRS = ircbot \

View File

@ -1,12 +1,12 @@
QT += core gui network widgets
TARGET = ../../SparrowBot
DESTDIR = $$top_srcdir
TARGET = SparrowBot
TEMPLATE = app
CONFIG += c++11
debug:LIBS += ../ircbot/debug/libircbot.a
release:LIBS += ../ircbot/release/libircbot.a
LIBS += $$top_srcdir/libircbot.a
INCLUDEPATH += ../ircbot
SOURCES = main.cpp \

View File

@ -5,10 +5,10 @@
#include "regismodule.h"
#include "sparrowmodule.h"
class CustomModule : public Module
class HelloWorldModule : public Module
{
public :
CustomModule() : Module() {}
HelloWorldModule() : Module() {}
virtual bool messageHandler(Message msg)
{
@ -29,8 +29,8 @@ public :
int main(int argc, char *argv[])
{
BotApp app = BotApp(argc, argv);
app.addModule(new CustomModule());
//app.addModule(new HelloWorldModule());
app.addModule(new RegisModule());
app.addModule(new SparrowModule());
//app.addModule(new SparrowModule());
return app.exec();
}

View File

@ -2,7 +2,7 @@
#include "message.h"
#include <time.h>
RegisModule::RegisModule()
RegisModule::RegisModule() : regisEnable(false)
{
std::srand(time(NULL));
noms.push_back("Le chat");
@ -35,7 +35,7 @@ RegisModule::RegisModule()
bool RegisModule::messageHandler(Message msg)
{
if(msg.args.contains("régis"))
if(msg.args.contains("régis ?"))
{
int nom1 = std::rand() % noms.size();
int nom2 = std::rand() % noms.size();
@ -44,6 +44,14 @@ bool RegisModule::messageHandler(Message msg)
answer = say(noms[nom1] + " " + adjectifs[adjectif] + " " + verbes[verbe] + " " + noms[nom2] + ".");
return true;
}
else if(msg.args.compare("!initrégis") == 0)
{
regisEnable = true;
setNick("il_est_con_Regis");
answer = QString("NICK %1\r\n").arg(getNick());
return true;
}
return false;
}

View File

@ -7,6 +7,7 @@
class RegisModule : public Module
{
bool regisEnable;
std::vector<QString> noms;
std::vector<QString> verbes;
std::vector<QString> adjectifs;

View File

@ -3,13 +3,13 @@
#include "ircbot.h"
#include "socketirc.h"
BotApp::BotApp(int argc, char** argv) :
nogui(false),
server("irc.freenode.net"),
port(6667),
nick("SparrowBotDebug"),
chan("epicsparrow")
BotApp::BotApp(int argc, char** argv) : nogui(false)
{
QString server = QString("irc.freenode.net");
int port = 6667;
QString nick = QString("SparrowBotDebug");
QString chan = QString("epicsparrow");
// parsing arguments
for(int i=1; i<argc; ++i)
{

View File

@ -10,12 +10,7 @@ class MainWindow;
class BotApp
{
bool nogui = false;
QString server = "irc.freenode.net";
int port = 6667;
QString nick = "SparrowBotDebug";
QString chan = "epicsparrow";
bool nogui;
SocketIRC* sock;
IRCBot* bot;
QCoreApplication* coreApp;

View File

@ -1,5 +1,9 @@
QT += core gui network widgets
DESTDIR = $$top_srcdir
TARGET = ircbot
TEMPLATE = lib
CONFIG += staticlib c++11