diff --git a/SparrowBot.pro.user b/SparrowBot.pro.user new file mode 100644 index 0000000..0f7b04d --- /dev/null +++ b/SparrowBot.pro.user @@ -0,0 +1,257 @@ + + + + + + EnvironmentId + {b81721c3-3b61-4885-a8a1-a98380d26849} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + 1 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + + ProjectExplorer.Project.Target.0 + + Desktop Qt 5.4.0 MinGW 32bit + Desktop Qt 5.4.0 MinGW 32bit + qt.54.win32_mingw491_kit + 0 + 0 + 0 + + C:/Users/anselme/git/SparrowBot/build + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + true + + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + + 2 + Compiler + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + + 1 + Nettoyer + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + C:/Users/anselme/git/build-SparrowBot-Desktop_Qt_5_4_0_MinGW_32bit-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + true + + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + + 2 + Compiler + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + + 1 + Nettoyer + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 2 + + + 0 + Déploiement + + ProjectExplorer.BuildSteps.Deploy + + 1 + Déployer localement + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + SparrowBot + + Qt4ProjectManager.Qt4RunConfiguration:C:/Users/anselme/git/sparrowbot/SparrowBot.pro + + SparrowBot.pro + false + false + + 3768 + false + true + false + false + true + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 18 + + + Version + 18 + + diff --git a/autolaunch.sh b/autolaunch.sh new file mode 100644 index 0000000..68a4304 --- /dev/null +++ b/autolaunch.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +while true +do + git pull + cd build + qmake ../SparrowBot.pro + make release + cd release + ./SparrowBot + cd ../.. +done \ No newline at end of file diff --git a/gitignore b/gitignore new file mode 100644 index 0000000..5228a1b --- /dev/null +++ b/gitignore @@ -0,0 +1,2 @@ +build +*.user \ No newline at end of file diff --git a/main.cpp b/main.cpp index 90f42fc..43081f4 100644 --- a/main.cpp +++ b/main.cpp @@ -11,19 +11,21 @@ int main(int argc, char *argv[]) sock.setPort(6667); // set up the bot - SparrowBot* bot = new SparrowBot("SparrowBot", "#epicsparrow"); + SparrowBot* bot = new SparrowBot("SparrowBot", "epicsparrow"); QObject::connect(&sock, SIGNAL(receivedMsg(QString)), bot, SLOT(receiveMsg(QString))); QObject::connect(bot, SIGNAL(sendMsg(QString)), &sock, SLOT(sendMsg(QString))); QObject::connect(bot, SIGNAL(changeSocketStatus(int)), &sock, SLOT(setConnected(int))); // set up Qt - QApplication a(argc, argv); - bool nogui = a.arguments().contains("-nogui"); - MainWindow w; + + bool nogui = argc > 1 && QString(argv[1]).compare("-nogui") == 0; // set up UI if(!nogui) { + QApplication app(argc, argv); + MainWindow w; + // bind signals to slots QObject::connect(&sock, SIGNAL(receivedMsg(QString)), w.getConsole(), SLOT(append(QString))); QObject::connect(&sock, SIGNAL(stateChanged(int)), w.getLed(), SLOT(setValue(int))); @@ -36,10 +38,12 @@ int main(int argc, char *argv[]) // show window w.show(); + return app.exec(); } - - // run event loop on the main thread - if(nogui) + else + { + QCoreApplication coreApp(argc, argv); bot->forceStatus(1); - return a.exec(); + return coreApp.exec(); + } }