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

3
.gitignore vendored
View File

@ -5,4 +5,5 @@ release/*
*.Debug *.Debug
*.Release *.Release
Makefile Makefile
ui_* 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 QT += core gui network widgets
BIN = bin
TEMPLATE = subdirs TEMPLATE = subdirs
CONFIG += ordered c++11 CONFIG += ordered c++11
SUBDIRS = ircbot \ SUBDIRS = ircbot \

View File

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

View File

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

View File

@ -2,7 +2,7 @@
#include "message.h" #include "message.h"
#include <time.h> #include <time.h>
RegisModule::RegisModule() RegisModule::RegisModule() : regisEnable(false)
{ {
std::srand(time(NULL)); std::srand(time(NULL));
noms.push_back("Le chat"); noms.push_back("Le chat");
@ -35,7 +35,7 @@ RegisModule::RegisModule()
bool RegisModule::messageHandler(Message msg) bool RegisModule::messageHandler(Message msg)
{ {
if(msg.args.contains("régis")) if(msg.args.contains("régis ?"))
{ {
int nom1 = std::rand() % noms.size(); int nom1 = std::rand() % noms.size();
int nom2 = 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] + "."); answer = say(noms[nom1] + " " + adjectifs[adjectif] + " " + verbes[verbe] + " " + noms[nom2] + ".");
return true; 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; return false;
} }

View File

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

View File

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

View File

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

View File

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