From f66536d84b38aa0eb46e928fdaf13d7da790b2ee Mon Sep 17 00:00:00 2001 From: daniel-Jones Date: Sun, 4 Jun 2017 16:26:56 +0930 Subject: added HTML/JS/PHP pages/scripts to allow RGB changes over a web page. Integrated a server into the application to allow incoming connections and receive commands --- arduino/rgb/rgb.ino | 251 ++- arduino/rgb/tags | 6 + qt/RGBController/.controllerwindow.cpp.swn | Bin 0 -> 16384 bytes qt/RGBController/Makefile | 45 +- qt/RGBController/RGBController | Bin 136960 -> 143248 bytes qt/RGBController/RGBController.pro | 6 +- qt/RGBController/controllerwindow.cpp | 39 +- qt/RGBController/controllerwindow.h | 15 +- qt/RGBController/controllerwindow.ui | 59 +- qt/RGBController/irc.cpp | 2 +- qt/RGBController/server.cpp | 54 + qt/RGBController/server.h | 26 + qt/build-RGBController-Desktop-Debug/Makefile | 60 +- qt/build-RGBController-Desktop-Debug/RGBController | Bin 1614688 -> 1813016 bytes .../moc_controllerwindow.cpp | 250 +-- qt/build-RGBController-Desktop-Debug/moc_irc.cpp | 148 ++ .../moc_server.cpp | 139 ++ .../ui_controllerwindow.h | 621 ++++--- qt/ircbot/.qmake.stash | 12 + qt/ircbot/Makefile | 825 +++++++++ qt/ircbot/main.cpp | 13 + qt/ircbot/moc_predefs.h | 284 +++ qt/ircbot/moc_qtbot.cpp | 156 ++ qt/ircbot/qtbot | Bin 0 -> 30944 bytes qt/ircbot/qtbot.cpp | 82 + qt/ircbot/qtbot.h | 37 + qt/ircbot/qtbot.pro | 27 + qt/ircbot/qtbot.pro.user | 336 ++++ web/index.html | 28 + web/jscolor.js | 1844 ++++++++++++++++++++ web/sendcmd.php | 23 + 31 files changed, 4951 insertions(+), 437 deletions(-) create mode 100644 arduino/rgb/tags create mode 100644 qt/RGBController/.controllerwindow.cpp.swn create mode 100644 qt/RGBController/server.cpp create mode 100644 qt/RGBController/server.h create mode 100644 qt/build-RGBController-Desktop-Debug/moc_irc.cpp create mode 100644 qt/build-RGBController-Desktop-Debug/moc_server.cpp create mode 100644 qt/ircbot/.qmake.stash create mode 100644 qt/ircbot/Makefile create mode 100644 qt/ircbot/main.cpp create mode 100644 qt/ircbot/moc_predefs.h create mode 100644 qt/ircbot/moc_qtbot.cpp create mode 100755 qt/ircbot/qtbot create mode 100644 qt/ircbot/qtbot.cpp create mode 100644 qt/ircbot/qtbot.h create mode 100644 qt/ircbot/qtbot.pro create mode 100644 qt/ircbot/qtbot.pro.user create mode 100644 web/index.html create mode 100644 web/jscolor.js create mode 100644 web/sendcmd.php diff --git a/arduino/rgb/rgb.ino b/arduino/rgb/rgb.ino index aa35aa0..52e9519 100644 --- a/arduino/rgb/rgb.ino +++ b/arduino/rgb/rgb.ino @@ -1,5 +1,9 @@ #include #include +#include +#include +#define OLED_RESET 4 +Adafruit_SSD1306 display(OLED_RESET); const int redPin = 2; const int greenPin = 4; @@ -15,6 +19,8 @@ int blue = 0; int bf = 0; int bt = 255; +void tests(); + void red_thread(); bool r_rev = false; @@ -24,14 +30,65 @@ bool g_rev = false; void blue_thread(); bool b_rev = false; +void draw_square(struct square *sq); + Thread r_fade = Thread(); Thread g_fade = Thread(); Thread b_fade = Thread(); + +struct square { + int x1; // top left + int x2; // top right + int x3; // bottom left + int x4; //bottom right + int y1; //top left + int y2; // top right + int y3; // bottom left + int y4; // bottom right +}; + + +struct square sq1; + +struct square sq2; + + + void parse(String com); +void OledWrite(int x, int y, int size, String text) { // this function will write to our oled + display.setTextSize(size); // set the font size + display.setTextColor(WHITE); // set the font color + display.setCursor(x, y); // set the cursor position + display.println(text); // add our text to the oled buffer + display.display(); +} + void setup() { + sq1.x1 = 0; + sq1.x2 = 30; + sq1.x3 = 0; + sq1.x4 = 30; + sq1.y1 = 0; + sq1.y2 = 0; + sq1.y3 = 30; + sq1.y4 = 30; + + + sq2.x1 = 60; + sq2.x2 = 90; + sq2.x3 = 60; + sq2.x4 = 90; + sq2.y1 = 0; + sq2.y2 = 0; + sq2.y3 = 30; + sq2.y4 = 30; + + + display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // lets begin our oled display/connection + display.clearDisplay(); // clear oled display from anything left over from last session Serial.begin(9600); pinMode(redPin, OUTPUT); pinMode(greenPin, OUTPUT); @@ -42,12 +99,12 @@ void setup() r_fade.setInterval(10); g_fade.enabled = false; - g_fade.onRun(green_thread); - g_fade.setInterval(10); + g_fade.onRun(green_thread); + g_fade.setInterval(10); b_fade.enabled = false; - b_fade.onRun(blue_thread); - b_fade.setInterval(10); + b_fade.onRun(blue_thread); + b_fade.setInterval(10); } @@ -57,47 +114,47 @@ void red_thread() red = rf; if (red > rt) red = rf; - if (red == rt) - r_rev = true; - if (red == rf) - r_rev = false; - if (!r_rev) - red++;analogWrite(redPin, red); - if (r_rev) - red--;analogWrite(redPin, red); + if (red == rt) + r_rev = true; + if (red == rf) + r_rev = false; + if (!r_rev) + red++;analogWrite(redPin, red); + if (r_rev) + red--;analogWrite(redPin, red); } void green_thread() { if (red < rf) - green = gf; - if (green > gt) - green = gf; - if (green == gt) - g_rev = true; - if (green == gf) - g_rev = false; - if (!g_rev) - green++;analogWrite(greenPin, green); - if (g_rev) - green--;analogWrite(greenPin, green); + green = gf; + if (green > gt) + green = gf; + if (green == gt) + g_rev = true; + if (green == gf) + g_rev = false; + if (!g_rev) + green++;analogWrite(greenPin, green); + if (g_rev) + green--;analogWrite(greenPin, green); } void blue_thread() { if (blue < bf) - red = bf; - if (blue > bt) - blue = bf; - if (blue == bt) - b_rev = true; - if (blue == bf) - b_rev = false; - if (!b_rev) - blue++;analogWrite(bluePin, blue); - if (b_rev) - blue--;analogWrite(bluePin, blue); + red = bf; + if (blue > bt) + blue = bf; + if (blue == bt) + b_rev = true; + if (blue == bf) + b_rev = false; + if (!b_rev) + blue++;analogWrite(bluePin, blue); + if (b_rev) + blue--;analogWrite(bluePin, blue); } void parse(String com) @@ -113,52 +170,52 @@ void parse(String com) analogWrite(redPin, red); } if (p1.equalsIgnoreCase("green")) - { - green = p2.toInt(); + { + green = p2.toInt(); analogWrite(greenPin, green); - } + } if (p1.equalsIgnoreCase("blue")) - { - blue = p2.toInt(); + { + blue = p2.toInt(); analogWrite(bluePin, blue); - } + } if (p1.equalsIgnoreCase("redfade")) - { + { if (r_fade.enabled) - r_fade.enabled = false; + r_fade.enabled = false; else if (!r_fade.enabled) r_fade.enabled = true; - } + } if (p1.equalsIgnoreCase("greenfade")) - { - if (g_fade.enabled) - g_fade.enabled = false; - else if (!g_fade.enabled) - g_fade.enabled = true; - } + { + if (g_fade.enabled) + g_fade.enabled = false; + else if (!g_fade.enabled) + g_fade.enabled = true; + } if (p1.equalsIgnoreCase("bluefade")) - { - if (b_fade.enabled) - b_fade.enabled = false; - else if (!b_fade.enabled) - b_fade.enabled = true; - } - if (p1.equalsIgnoreCase("rspeed")) - { - r_fade.setInterval(p2.toInt()); - } - if (p1.equalsIgnoreCase("gspeed")) - { - g_fade.setInterval(p2.toInt()); - } - - if (p1.equalsIgnoreCase("bspeed")) - { - b_fade.setInterval(p2.toInt()); - } + { + if (b_fade.enabled) + b_fade.enabled = false; + else if (!b_fade.enabled) + b_fade.enabled = true; + } + if (p1.equalsIgnoreCase("rspeed")) + { + r_fade.setInterval(p2.toInt()); + } + if (p1.equalsIgnoreCase("gspeed")) + { + g_fade.setInterval(p2.toInt()); + } + + if (p1.equalsIgnoreCase("bspeed")) + { + b_fade.setInterval(p2.toInt()); + } if (p1.equalsIgnoreCase("speed")) - { + { r_fade.setInterval(p2.toInt()); g_fade.setInterval(p2.toInt()); b_fade.setInterval(p2.toInt()); @@ -168,15 +225,32 @@ void parse(String com) if (p1.equalsIgnoreCase("rt")) rt = p2.toInt(); if (p1.equalsIgnoreCase("gf")) - gf = p2.toInt(); - if (p1.equalsIgnoreCase("gt")) - gt = p2.toInt(); + gf = p2.toInt(); + if (p1.equalsIgnoreCase("gt")) + gt = p2.toInt(); if (p1.equalsIgnoreCase("bf")) - bf = p2.toInt(); - if (p1.equalsIgnoreCase("bt")) - bt = p2.toInt(); + bf = p2.toInt(); + if (p1.equalsIgnoreCase("bt")) + bt = p2.toInt(); if (p1.equalsIgnoreCase("ping")) Serial.write("ping=pong\n"); + if (p1.equalsIgnoreCase("write")) + { + display.clearDisplay(); + OledWrite(0, 0, 3, p2); + } + if (p1.equalsIgnoreCase("off")) + { + red = 0; + green = 0; + blue = 0; + r_fade.enabled = false; + g_fade.enabled = false; + b_fade.enabled = false; + analogWrite(redPin, red); + analogWrite(greenPin, green); + analogWrite(bluePin, blue); + } } String line; @@ -186,9 +260,9 @@ void loop() if (r_fade.shouldRun()) r_fade.run(); if (g_fade.shouldRun()) - g_fade.run(); + g_fade.run(); if (b_fade.shouldRun()) - b_fade.run(); + b_fade.run(); /* read serial data */ while (Serial.available()) @@ -204,4 +278,27 @@ void loop() line += c; } } + tests(); +} + +void tests() +{ + display.clearDisplay(); + + draw_square(&sq1); + draw_square(&sq2); + + display.display(); +} + +void draw_square(struct square *sq) +{ + /* top left -> top right */ + display.drawLine(sq->x2, sq->y1, sq->x1, sq->y2, WHITE); + /* top right -> bottom right */ + display.drawLine(sq->x2, sq->y2, sq->x4, sq->y4, WHITE); + /* bottom right -> bottom left */ + display.drawLine(sq->x4, sq->y4, sq->x3, sq->y3, WHITE); + /* bottom left -> top left */ + display.drawLine(sq->x3, sq->y3, sq->x1, sq->y1, WHITE); } diff --git a/arduino/rgb/tags b/arduino/rgb/tags new file mode 100644 index 0000000..d01d39b --- /dev/null +++ b/arduino/rgb/tags @@ -0,0 +1,6 @@ +!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ +!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ +!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/ +!_TAG_PROGRAM_NAME Exuberant Ctags // +!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/ +!_TAG_PROGRAM_VERSION 5.8 // diff --git a/qt/RGBController/.controllerwindow.cpp.swn b/qt/RGBController/.controllerwindow.cpp.swn new file mode 100644 index 0000000..bc195e4 Binary files /dev/null and b/qt/RGBController/.controllerwindow.cpp.swn differ diff --git a/qt/RGBController/Makefile b/qt/RGBController/Makefile index f615390..4f437ac 100644 --- a/qt/RGBController/Makefile +++ b/qt/RGBController/Makefile @@ -50,13 +50,17 @@ OBJECTS_DIR = ./ SOURCES = main.cpp \ controllerwindow.cpp \ - irc.cpp moc_controllerwindow.cpp \ - moc_irc.cpp + irc.cpp \ + server.cpp moc_controllerwindow.cpp \ + moc_irc.cpp \ + moc_server.cpp OBJECTS = main.o \ controllerwindow.o \ irc.o \ + server.o \ moc_controllerwindow.o \ - moc_irc.o + moc_irc.o \ + moc_server.o DIST = /usr/lib/qt/mkspecs/features/spec_pre.prf \ /usr/lib/qt/mkspecs/common/unix.conf \ /usr/lib/qt/mkspecs/common/linux.conf \ @@ -281,9 +285,11 @@ DIST = /usr/lib/qt/mkspecs/features/spec_pre.prf \ /usr/lib/qt/mkspecs/features/yacc.prf \ /usr/lib/qt/mkspecs/features/lex.prf \ RGBController.pro controllerwindow.h \ - irc.h main.cpp \ + irc.h \ + server.h main.cpp \ controllerwindow.cpp \ - irc.cpp + irc.cpp \ + server.cpp QMAKE_TARGET = RGBController DESTDIR = TARGET = RGBController @@ -769,8 +775,8 @@ distdir: FORCE @test -d $(DISTDIR) || mkdir -p $(DISTDIR) $(COPY_FILE) --parents $(DIST) $(DISTDIR)/ $(COPY_FILE) --parents /usr/lib/qt/mkspecs/features/data/dummy.cpp $(DISTDIR)/ - $(COPY_FILE) --parents controllerwindow.h irc.h $(DISTDIR)/ - $(COPY_FILE) --parents main.cpp controllerwindow.cpp irc.cpp $(DISTDIR)/ + $(COPY_FILE) --parents controllerwindow.h irc.h server.h $(DISTDIR)/ + $(COPY_FILE) --parents main.cpp controllerwindow.cpp irc.cpp server.cpp $(DISTDIR)/ $(COPY_FILE) --parents controllerwindow.ui $(DISTDIR)/ @@ -803,10 +809,12 @@ compiler_moc_predefs_clean: moc_predefs.h: /usr/lib/qt/mkspecs/features/data/dummy.cpp g++ -pipe -O2 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -Wall -W -dM -E -o moc_predefs.h /usr/lib/qt/mkspecs/features/data/dummy.cpp -compiler_moc_header_make_all: moc_controllerwindow.cpp moc_irc.cpp +compiler_moc_header_make_all: moc_controllerwindow.cpp moc_irc.cpp moc_server.cpp compiler_moc_header_clean: - -$(DEL_FILE) moc_controllerwindow.cpp moc_irc.cpp + -$(DEL_FILE) moc_controllerwindow.cpp moc_irc.cpp moc_server.cpp moc_controllerwindow.cpp: ui_controllerwindow.h \ + irc.h \ + server.h \ controllerwindow.h \ moc_predefs.h \ /usr/bin/moc @@ -817,6 +825,11 @@ moc_irc.cpp: irc.h \ /usr/bin/moc /usr/bin/moc $(DEFINES) --include ./moc_predefs.h -I/usr/lib/qt/mkspecs/linux-g++ -I'/home/daniel_j/documents/school/2016 research project/RGBController/qt/RGBController' -I/usr/include/qt -I/usr/include/qt/QtWidgets -I/usr/include/qt/QtGui -I/usr/include/qt/QtSerialPort -I/usr/include/qt/QtNetwork -I/usr/include/qt/QtCore -I/usr/include/c++/6.3.1 -I/usr/include/c++/6.3.1/x86_64-pc-linux-gnu -I/usr/include/c++/6.3.1/backward -I/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/include -I/usr/local/include -I/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/include-fixed -I/usr/include irc.h -o moc_irc.cpp +moc_server.cpp: server.h \ + moc_predefs.h \ + /usr/bin/moc + /usr/bin/moc $(DEFINES) --include ./moc_predefs.h -I/usr/lib/qt/mkspecs/linux-g++ -I'/home/daniel_j/documents/school/2016 research project/RGBController/qt/RGBController' -I/usr/include/qt -I/usr/include/qt/QtWidgets -I/usr/include/qt/QtGui -I/usr/include/qt/QtSerialPort -I/usr/include/qt/QtNetwork -I/usr/include/qt/QtCore -I/usr/include/c++/6.3.1 -I/usr/include/c++/6.3.1/x86_64-pc-linux-gnu -I/usr/include/c++/6.3.1/backward -I/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/include -I/usr/local/include -I/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/include-fixed -I/usr/include server.h -o moc_server.cpp + compiler_moc_source_make_all: compiler_moc_source_clean: compiler_uic_make_all: ui_controllerwindow.h @@ -837,22 +850,32 @@ compiler_clean: compiler_moc_predefs_clean compiler_moc_header_clean compiler_ui ####### Compile main.o: main.cpp controllerwindow.h \ - ui_controllerwindow.h + ui_controllerwindow.h \ + irc.h \ + server.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp controllerwindow.o: controllerwindow.cpp controllerwindow.h \ - ui_controllerwindow.h + ui_controllerwindow.h \ + irc.h \ + server.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o controllerwindow.o controllerwindow.cpp irc.o: irc.cpp irc.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o irc.o irc.cpp +server.o: server.cpp server.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o server.o server.cpp + moc_controllerwindow.o: moc_controllerwindow.cpp $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_controllerwindow.o moc_controllerwindow.cpp moc_irc.o: moc_irc.cpp $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_irc.o moc_irc.cpp +moc_server.o: moc_server.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_server.o moc_server.cpp + ####### Install install: FORCE diff --git a/qt/RGBController/RGBController b/qt/RGBController/RGBController index 7b54e8c..a6cfd3f 100755 Binary files a/qt/RGBController/RGBController and b/qt/RGBController/RGBController differ diff --git a/qt/RGBController/RGBController.pro b/qt/RGBController/RGBController.pro index 07060da..a4ed2e3 100755 --- a/qt/RGBController/RGBController.pro +++ b/qt/RGBController/RGBController.pro @@ -14,10 +14,12 @@ TEMPLATE = app SOURCES += main.cpp\ controllerwindow.cpp \ - irc.cpp + irc.cpp \ + server.cpp HEADERS += controllerwindow.h \ - irc.h + irc.h \ + server.h FORMS += controllerwindow.ui diff --git a/qt/RGBController/controllerwindow.cpp b/qt/RGBController/controllerwindow.cpp index 7c4f552..dd21ece 100755 --- a/qt/RGBController/controllerwindow.cpp +++ b/qt/RGBController/controllerwindow.cpp @@ -12,9 +12,12 @@ controllerWindow::controllerWindow(QWidget *parent) : connect(ser, &QSerialPort::readyRead, this, &controllerWindow::read); ptimer = new QTimer(this); connect(ptimer, SIGNAL(timeout()), this, SLOT(ping())); - connect (&ircbot, SIGNAL(sendcmd(QString)), this, SLOT(cmdrecv(QString))); + connect(&ircbot, SIGNAL(sendcmd(QString)), this, SLOT(cmdrecv(QString))); + connect(&srv, SIGNAL(sendcmd(QString)), this, SLOT(cmdrecv(QString))); pingtries = 0; irccon = false; + pingcount = 0; + server_started = false; /* disable buttons and widgets that should not be enabled yet, set slider values to 0 */ ui->disconnect_button->setEnabled(false); ui->connect_button->setEnabled(false); @@ -413,6 +416,7 @@ void controllerWindow::on_off_button_clicked() ui->r_slider->setValue(0); ui->g_slider->setValue(0); ui->b_slider->setValue(0); + send("off"); } void controllerWindow::on_set_preset_button_clicked() @@ -616,6 +620,8 @@ void controllerWindow::ping() send("ping\n"); tping = false; QTimer::singleShot(1000, this, SLOT(check_ping())); + pingcount++; + ui->ping_count_label->setText("Ping: " + QString::number(pingcount)); } void controllerWindow::check_ping() @@ -658,6 +664,37 @@ void controllerWindow::on_irc_connect_button_clicked() } } +void controllerWindow::on_server_start_button_clicked() +{ + if (!server_started) + { + if (srv.server_start()) + { + server_started = true; + ui->server_start_button->setText("Stop server"); + info_log("Server started"); + } + else + { + info_log("Server could not start"); + } + } + + else if (server_started) + { + if (srv.server_stop()) + { + server_started = false; + ui->server_start_button->setText("Start server"); + info_log("Server stopped"); + } + else + { + info_log("Server not not be stopped"); + } + } +} + void controllerWindow::cmdrecv(QString cmd) { qDebug() << "got cmd" << cmd; diff --git a/qt/RGBController/controllerwindow.h b/qt/RGBController/controllerwindow.h index a9196d2..b36d70b 100755 --- a/qt/RGBController/controllerwindow.h +++ b/qt/RGBController/controllerwindow.h @@ -15,6 +15,7 @@ #include #include "ui_controllerwindow.h" #include "irc.h" +#include "server.h" namespace Ui { class controllerWindow; @@ -64,7 +65,7 @@ class controllerWindow : public QMainWindow void cmdrecv(QString cmd); private slots: /* these slots are used to trigger button clicks and drop down items selections etc */ - void on_connect_button_clicked(); + void on_connect_button_clicked(); void on_disconnect_button_clicked(); @@ -120,16 +121,22 @@ class controllerWindow : public QMainWindow void on_bto_valueChanged(int arg1); - void on_serial_send_button_clicked(); + void on_serial_send_button_clicked(); void ping(); void check_ping(); - void on_irc_connect_button_clicked(); + void on_irc_connect_button_clicked(); -private: + void on_server_start_button_clicked(); + + + private: Ui::controllerWindow *ui; bool irccon; irc ircbot; + server srv; + int pingcount; + bool server_started; }; #endif // CONTROLLERWINDOW_H diff --git a/qt/RGBController/controllerwindow.ui b/qt/RGBController/controllerwindow.ui index 63a91b1..0a10269 100644 --- a/qt/RGBController/controllerwindow.ui +++ b/qt/RGBController/controllerwindow.ui @@ -9,8 +9,8 @@ 0 0 - 364 - 238 + 433 + 254 @@ -21,7 +21,7 @@ - 4 + 5 @@ -528,21 +528,21 @@ - + Server - + irc.danieljon.es - + @@ -558,42 +558,42 @@ - + Channel - + #csgo - + Name - + LightBot - + Port - + Connect @@ -602,15 +602,40 @@ + + + Server + + + + + + + + Start server + + + + + + + Log - + - + + + + Send + + + + @@ -620,10 +645,10 @@ - - + + - Send + Ping diff --git a/qt/RGBController/irc.cpp b/qt/RGBController/irc.cpp index 50f7fac..9c3c14d 100644 --- a/qt/RGBController/irc.cpp +++ b/qt/RGBController/irc.cpp @@ -33,7 +33,7 @@ void irc::read() buf = "JOIN " + channel + "\r\n"; socket->write(buf.toUtf8()); } - if (line.contains("!")) /* mostl ikely a message to handle */ + if (line.contains("!")) /* most likely a message to handle */ handle(line); if(socket->canReadLine()) read(); diff --git a/qt/RGBController/server.cpp b/qt/RGBController/server.cpp new file mode 100644 index 0000000..85e43ee --- /dev/null +++ b/qt/RGBController/server.cpp @@ -0,0 +1,54 @@ +#include "server.h" + +server::server(QObject *parent) : QObject(parent) +{ + srv = new QTcpServer(); + connect(srv, SIGNAL(newConnection()), this, SLOT(new_connection())); +} + +bool server::server_start() +{ + if (srv->listen(QHostAddress::Any, 3001)) + { + return true; + } + else + { + return false; + } +} + +bool server::server_stop() +{ + srv->close(); + if (srv->isListening()) + return false; + return true; +} + +void server::new_connection() +{ + QTcpSocket *socket; + socket = srv->nextPendingConnection(); + socket->waitForReadyRead(3000); + handle(QString(socket->readAll()).remove(QRegExp("[\\n\\t\\r]"))); + socket->close(); + delete socket; +} + +void server::handle(QString msg) +{ + if (msg.contains(";")) + { + QStringList tmp = msg.split(";"); + for (int x = 0; x < tmp.size(); x++) + { + emit sendcmd(tmp.at(x)); + } + } + else + { + emit sendcmd(msg); + } + +} diff --git a/qt/RGBController/server.h b/qt/RGBController/server.h new file mode 100644 index 0000000..8d46539 --- /dev/null +++ b/qt/RGBController/server.h @@ -0,0 +1,26 @@ +#ifndef SERVER_H +#define SERVER_H + +#include +#include + +class server : public QObject +{ + Q_OBJECT + public: + explicit server(QObject *parent = 0); + bool server_start(); + bool server_stop(); + private: + QTcpServer *srv; + void handle(QString msg); + private slots: + void new_connection(); +signals: + void sendcmd(QString cmd); + + + public slots: +}; + +#endif // SERVER_H diff --git a/qt/build-RGBController-Desktop-Debug/Makefile b/qt/build-RGBController-Desktop-Debug/Makefile index 1314c66..524bb85 100644 --- a/qt/build-RGBController-Desktop-Debug/Makefile +++ b/qt/build-RGBController-Desktop-Debug/Makefile @@ -49,10 +49,18 @@ OBJECTS_DIR = ./ ####### Files SOURCES = ../RGBController/main.cpp \ - ../RGBController/controllerwindow.cpp moc_controllerwindow.cpp + ../RGBController/controllerwindow.cpp \ + ../RGBController/irc.cpp \ + ../RGBController/server.cpp moc_controllerwindow.cpp \ + moc_irc.cpp \ + moc_server.cpp OBJECTS = main.o \ controllerwindow.o \ - moc_controllerwindow.o + irc.o \ + server.o \ + moc_controllerwindow.o \ + moc_irc.o \ + moc_server.o DIST = /usr/lib/qt/mkspecs/features/spec_pre.prf \ /usr/lib/qt/mkspecs/common/unix.conf \ /usr/lib/qt/mkspecs/common/linux.conf \ @@ -276,8 +284,12 @@ DIST = /usr/lib/qt/mkspecs/features/spec_pre.prf \ /usr/lib/qt/mkspecs/features/exceptions.prf \ /usr/lib/qt/mkspecs/features/yacc.prf \ /usr/lib/qt/mkspecs/features/lex.prf \ - ../RGBController/RGBController.pro ../RGBController/controllerwindow.h ../RGBController/main.cpp \ - ../RGBController/controllerwindow.cpp + ../RGBController/RGBController.pro ../RGBController/controllerwindow.h \ + ../RGBController/irc.h \ + ../RGBController/server.h ../RGBController/main.cpp \ + ../RGBController/controllerwindow.cpp \ + ../RGBController/irc.cpp \ + ../RGBController/server.cpp QMAKE_TARGET = RGBController DESTDIR = TARGET = RGBController @@ -763,8 +775,8 @@ distdir: FORCE @test -d $(DISTDIR) || mkdir -p $(DISTDIR) $(COPY_FILE) --parents $(DIST) $(DISTDIR)/ $(COPY_FILE) --parents /usr/lib/qt/mkspecs/features/data/dummy.cpp $(DISTDIR)/ - $(COPY_FILE) --parents ../RGBController/controllerwindow.h $(DISTDIR)/ - $(COPY_FILE) --parents ../RGBController/main.cpp ../RGBController/controllerwindow.cpp $(DISTDIR)/ + $(COPY_FILE) --parents ../RGBController/controllerwindow.h ../RGBController/irc.h ../RGBController/server.h $(DISTDIR)/ + $(COPY_FILE) --parents ../RGBController/main.cpp ../RGBController/controllerwindow.cpp ../RGBController/irc.cpp ../RGBController/server.cpp $(DISTDIR)/ $(COPY_FILE) --parents ../RGBController/controllerwindow.ui $(DISTDIR)/ @@ -797,15 +809,27 @@ compiler_moc_predefs_clean: moc_predefs.h: /usr/lib/qt/mkspecs/features/data/dummy.cpp g++ -pipe -g -Wall -W -dM -E -o moc_predefs.h /usr/lib/qt/mkspecs/features/data/dummy.cpp -compiler_moc_header_make_all: moc_controllerwindow.cpp +compiler_moc_header_make_all: moc_controllerwindow.cpp moc_irc.cpp moc_server.cpp compiler_moc_header_clean: - -$(DEL_FILE) moc_controllerwindow.cpp + -$(DEL_FILE) moc_controllerwindow.cpp moc_irc.cpp moc_server.cpp moc_controllerwindow.cpp: ../RGBController/ui_controllerwindow.h \ + ../RGBController/irc.h \ + ../RGBController/server.h \ ../RGBController/controllerwindow.h \ moc_predefs.h \ /usr/bin/moc /usr/bin/moc $(DEFINES) --include ./moc_predefs.h -I/usr/lib/qt/mkspecs/linux-g++ -I'/home/daniel_j/documents/school/2016 research project/RGBController/qt/RGBController' -I/usr/include/qt -I/usr/include/qt/QtWidgets -I/usr/include/qt/QtGui -I/usr/include/qt/QtSerialPort -I/usr/include/qt/QtNetwork -I/usr/include/qt/QtCore -I. -I/usr/include/c++/6.3.1 -I/usr/include/c++/6.3.1/x86_64-pc-linux-gnu -I/usr/include/c++/6.3.1/backward -I/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/include -I/usr/local/include -I/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/include-fixed -I/usr/include ../RGBController/controllerwindow.h -o moc_controllerwindow.cpp +moc_irc.cpp: ../RGBController/irc.h \ + moc_predefs.h \ + /usr/bin/moc + /usr/bin/moc $(DEFINES) --include ./moc_predefs.h -I/usr/lib/qt/mkspecs/linux-g++ -I'/home/daniel_j/documents/school/2016 research project/RGBController/qt/RGBController' -I/usr/include/qt -I/usr/include/qt/QtWidgets -I/usr/include/qt/QtGui -I/usr/include/qt/QtSerialPort -I/usr/include/qt/QtNetwork -I/usr/include/qt/QtCore -I. -I/usr/include/c++/6.3.1 -I/usr/include/c++/6.3.1/x86_64-pc-linux-gnu -I/usr/include/c++/6.3.1/backward -I/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/include -I/usr/local/include -I/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/include-fixed -I/usr/include ../RGBController/irc.h -o moc_irc.cpp + +moc_server.cpp: ../RGBController/server.h \ + moc_predefs.h \ + /usr/bin/moc + /usr/bin/moc $(DEFINES) --include ./moc_predefs.h -I/usr/lib/qt/mkspecs/linux-g++ -I'/home/daniel_j/documents/school/2016 research project/RGBController/qt/RGBController' -I/usr/include/qt -I/usr/include/qt/QtWidgets -I/usr/include/qt/QtGui -I/usr/include/qt/QtSerialPort -I/usr/include/qt/QtNetwork -I/usr/include/qt/QtCore -I. -I/usr/include/c++/6.3.1 -I/usr/include/c++/6.3.1/x86_64-pc-linux-gnu -I/usr/include/c++/6.3.1/backward -I/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/include -I/usr/local/include -I/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/include-fixed -I/usr/include ../RGBController/server.h -o moc_server.cpp + compiler_moc_source_make_all: compiler_moc_source_clean: compiler_uic_make_all: ui_controllerwindow.h @@ -826,16 +850,32 @@ compiler_clean: compiler_moc_predefs_clean compiler_moc_header_clean compiler_ui ####### Compile main.o: ../RGBController/main.cpp ../RGBController/controllerwindow.h \ - ../RGBController/ui_controllerwindow.h + ../RGBController/ui_controllerwindow.h \ + ../RGBController/irc.h \ + ../RGBController/server.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o ../RGBController/main.cpp controllerwindow.o: ../RGBController/controllerwindow.cpp ../RGBController/controllerwindow.h \ - ../RGBController/ui_controllerwindow.h + ../RGBController/ui_controllerwindow.h \ + ../RGBController/irc.h \ + ../RGBController/server.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o controllerwindow.o ../RGBController/controllerwindow.cpp +irc.o: ../RGBController/irc.cpp ../RGBController/irc.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o irc.o ../RGBController/irc.cpp + +server.o: ../RGBController/server.cpp ../RGBController/server.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o server.o ../RGBController/server.cpp + moc_controllerwindow.o: moc_controllerwindow.cpp $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_controllerwindow.o moc_controllerwindow.cpp +moc_irc.o: moc_irc.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_irc.o moc_irc.cpp + +moc_server.o: moc_server.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_server.o moc_server.cpp + ####### Install install: FORCE diff --git a/qt/build-RGBController-Desktop-Debug/RGBController b/qt/build-RGBController-Desktop-Debug/RGBController index 8091a3a..dbe7020 100755 Binary files a/qt/build-RGBController-Desktop-Debug/RGBController and b/qt/build-RGBController-Desktop-Debug/RGBController differ diff --git a/qt/build-RGBController-Desktop-Debug/moc_controllerwindow.cpp b/qt/build-RGBController-Desktop-Debug/moc_controllerwindow.cpp index 9e86e81..e0fde24 100644 --- a/qt/build-RGBController-Desktop-Debug/moc_controllerwindow.cpp +++ b/qt/build-RGBController-Desktop-Debug/moc_controllerwindow.cpp @@ -21,8 +21,8 @@ QT_BEGIN_MOC_NAMESPACE QT_WARNING_PUSH QT_WARNING_DISABLE_DEPRECATED struct qt_meta_stringdata_controllerWindow_t { - QByteArrayData data[33]; - char stringdata0[777]; + QByteArrayData data[40]; + char stringdata0[896]; }; #define QT_MOC_LITERAL(idx, ofs, len) \ Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ @@ -32,42 +32,50 @@ struct qt_meta_stringdata_controllerWindow_t { static const qt_meta_stringdata_controllerWindow_t qt_meta_stringdata_controllerWindow = { { QT_MOC_LITERAL(0, 0, 16), // "controllerWindow" -QT_MOC_LITERAL(1, 17, 25), // "on_connect_button_clicked" -QT_MOC_LITERAL(2, 43, 0), // "" -QT_MOC_LITERAL(3, 44, 28), // "on_disconnect_button_clicked" -QT_MOC_LITERAL(4, 73, 30), // "on_refresh_port_button_clicked" -QT_MOC_LITERAL(5, 104, 31), // "on_reload_preset_button_clicked" -QT_MOC_LITERAL(6, 136, 24), // "on_r_slider_valueChanged" -QT_MOC_LITERAL(7, 161, 5), // "value" -QT_MOC_LITERAL(8, 167, 24), // "on_g_slider_valueChanged" -QT_MOC_LITERAL(9, 192, 24), // "on_b_slider_valueChanged" -QT_MOC_LITERAL(10, 217, 21), // "on_red_button_clicked" -QT_MOC_LITERAL(11, 239, 23), // "on_green_button_clicked" -QT_MOC_LITERAL(12, 263, 22), // "on_blue_button_clicked" -QT_MOC_LITERAL(13, 286, 21), // "on_off_button_clicked" -QT_MOC_LITERAL(14, 308, 28), // "on_set_preset_button_clicked" -QT_MOC_LITERAL(15, 337, 39), // "on_presets_dropdown_currentIn..." -QT_MOC_LITERAL(16, 377, 5), // "index" -QT_MOC_LITERAL(17, 383, 29), // "on_preset_save_button_clicked" -QT_MOC_LITERAL(18, 413, 31), // "on_preset_delete_button_clicked" -QT_MOC_LITERAL(19, 445, 26), // "on_red_fade_button_clicked" -QT_MOC_LITERAL(20, 472, 28), // "on_green_fade_button_clicked" -QT_MOC_LITERAL(21, 501, 27), // "on_blue_fade_button_clicked" -QT_MOC_LITERAL(22, 529, 23), // "on_speed_button_clicked" -QT_MOC_LITERAL(23, 553, 30), // "on_r_speed_slider_valueChanged" -QT_MOC_LITERAL(24, 584, 30), // "on_g_speed_slider_valueChanged" -QT_MOC_LITERAL(25, 615, 30), // "on_b_speed_slider_valueChanged" -QT_MOC_LITERAL(26, 646, 21), // "on_rfrom_valueChanged" -QT_MOC_LITERAL(27, 668, 4), // "arg1" -QT_MOC_LITERAL(28, 673, 19), // "on_rto_valueChanged" -QT_MOC_LITERAL(29, 693, 21), // "on_gfrom_valueChanged" -QT_MOC_LITERAL(30, 715, 19), // "on_gto_valueChanged" -QT_MOC_LITERAL(31, 735, 21), // "on_bfrom_valueChanged" -QT_MOC_LITERAL(32, 757, 19) // "on_bto_valueChanged" +QT_MOC_LITERAL(1, 17, 7), // "cmdrecv" +QT_MOC_LITERAL(2, 25, 0), // "" +QT_MOC_LITERAL(3, 26, 3), // "cmd" +QT_MOC_LITERAL(4, 30, 25), // "on_connect_button_clicked" +QT_MOC_LITERAL(5, 56, 28), // "on_disconnect_button_clicked" +QT_MOC_LITERAL(6, 85, 30), // "on_refresh_port_button_clicked" +QT_MOC_LITERAL(7, 116, 31), // "on_reload_preset_button_clicked" +QT_MOC_LITERAL(8, 148, 24), // "on_r_slider_valueChanged" +QT_MOC_LITERAL(9, 173, 5), // "value" +QT_MOC_LITERAL(10, 179, 24), // "on_g_slider_valueChanged" +QT_MOC_LITERAL(11, 204, 24), // "on_b_slider_valueChanged" +QT_MOC_LITERAL(12, 229, 21), // "on_red_button_clicked" +QT_MOC_LITERAL(13, 251, 23), // "on_green_button_clicked" +QT_MOC_LITERAL(14, 275, 22), // "on_blue_button_clicked" +QT_MOC_LITERAL(15, 298, 21), // "on_off_button_clicked" +QT_MOC_LITERAL(16, 320, 28), // "on_set_preset_button_clicked" +QT_MOC_LITERAL(17, 349, 39), // "on_presets_dropdown_currentIn..." +QT_MOC_LITERAL(18, 389, 5), // "index" +QT_MOC_LITERAL(19, 395, 29), // "on_preset_save_button_clicked" +QT_MOC_LITERAL(20, 425, 31), // "on_preset_delete_button_clicked" +QT_MOC_LITERAL(21, 457, 26), // "on_red_fade_button_clicked" +QT_MOC_LITERAL(22, 484, 28), // "on_green_fade_button_clicked" +QT_MOC_LITERAL(23, 513, 27), // "on_blue_fade_button_clicked" +QT_MOC_LITERAL(24, 541, 23), // "on_speed_button_clicked" +QT_MOC_LITERAL(25, 565, 30), // "on_r_speed_slider_valueChanged" +QT_MOC_LITERAL(26, 596, 30), // "on_g_speed_slider_valueChanged" +QT_MOC_LITERAL(27, 627, 30), // "on_b_speed_slider_valueChanged" +QT_MOC_LITERAL(28, 658, 21), // "on_rfrom_valueChanged" +QT_MOC_LITERAL(29, 680, 4), // "arg1" +QT_MOC_LITERAL(30, 685, 19), // "on_rto_valueChanged" +QT_MOC_LITERAL(31, 705, 21), // "on_gfrom_valueChanged" +QT_MOC_LITERAL(32, 727, 19), // "on_gto_valueChanged" +QT_MOC_LITERAL(33, 747, 21), // "on_bfrom_valueChanged" +QT_MOC_LITERAL(34, 769, 19), // "on_bto_valueChanged" +QT_MOC_LITERAL(35, 789, 29), // "on_serial_send_button_clicked" +QT_MOC_LITERAL(36, 819, 4), // "ping" +QT_MOC_LITERAL(37, 824, 10), // "check_ping" +QT_MOC_LITERAL(38, 835, 29), // "on_irc_connect_button_clicked" +QT_MOC_LITERAL(39, 865, 30) // "on_server_start_button_clicked" }, - "controllerWindow\0on_connect_button_clicked\0" - "\0on_disconnect_button_clicked\0" + "controllerWindow\0cmdrecv\0\0cmd\0" + "on_connect_button_clicked\0" + "on_disconnect_button_clicked\0" "on_refresh_port_button_clicked\0" "on_reload_preset_button_clicked\0" "on_r_slider_valueChanged\0value\0" @@ -89,7 +97,9 @@ QT_MOC_LITERAL(32, 757, 19) // "on_bto_valueChanged" "on_rfrom_valueChanged\0arg1\0" "on_rto_valueChanged\0on_gfrom_valueChanged\0" "on_gto_valueChanged\0on_bfrom_valueChanged\0" - "on_bto_valueChanged" + "on_bto_valueChanged\0on_serial_send_button_clicked\0" + "ping\0check_ping\0on_irc_connect_button_clicked\0" + "on_server_start_button_clicked" }; #undef QT_MOC_LITERAL @@ -99,7 +109,7 @@ static const uint qt_meta_data_controllerWindow[] = { 7, // revision 0, // classname 0, 0, // classinfo - 28, 14, // methods + 34, 14, // methods 0, 0, // properties 0, 0, // enums/sets 0, 0, // constructors @@ -107,64 +117,76 @@ static const uint qt_meta_data_controllerWindow[] = { 0, // signalCount // slots: name, argc, parameters, tag, flags - 1, 0, 154, 2, 0x08 /* Private */, - 3, 0, 155, 2, 0x08 /* Private */, - 4, 0, 156, 2, 0x08 /* Private */, - 5, 0, 157, 2, 0x08 /* Private */, - 6, 1, 158, 2, 0x08 /* Private */, - 8, 1, 161, 2, 0x08 /* Private */, - 9, 1, 164, 2, 0x08 /* Private */, - 10, 0, 167, 2, 0x08 /* Private */, - 11, 0, 168, 2, 0x08 /* Private */, - 12, 0, 169, 2, 0x08 /* Private */, - 13, 0, 170, 2, 0x08 /* Private */, - 14, 0, 171, 2, 0x08 /* Private */, - 15, 1, 172, 2, 0x08 /* Private */, - 17, 0, 175, 2, 0x08 /* Private */, - 18, 0, 176, 2, 0x08 /* Private */, - 19, 0, 177, 2, 0x08 /* Private */, - 20, 0, 178, 2, 0x08 /* Private */, - 21, 0, 179, 2, 0x08 /* Private */, - 22, 0, 180, 2, 0x08 /* Private */, - 23, 1, 181, 2, 0x08 /* Private */, - 24, 1, 184, 2, 0x08 /* Private */, - 25, 1, 187, 2, 0x08 /* Private */, - 26, 1, 190, 2, 0x08 /* Private */, - 28, 1, 193, 2, 0x08 /* Private */, - 29, 1, 196, 2, 0x08 /* Private */, - 30, 1, 199, 2, 0x08 /* Private */, - 31, 1, 202, 2, 0x08 /* Private */, - 32, 1, 205, 2, 0x08 /* Private */, + 1, 1, 184, 2, 0x0a /* Public */, + 4, 0, 187, 2, 0x08 /* Private */, + 5, 0, 188, 2, 0x08 /* Private */, + 6, 0, 189, 2, 0x08 /* Private */, + 7, 0, 190, 2, 0x08 /* Private */, + 8, 1, 191, 2, 0x08 /* Private */, + 10, 1, 194, 2, 0x08 /* Private */, + 11, 1, 197, 2, 0x08 /* Private */, + 12, 0, 200, 2, 0x08 /* Private */, + 13, 0, 201, 2, 0x08 /* Private */, + 14, 0, 202, 2, 0x08 /* Private */, + 15, 0, 203, 2, 0x08 /* Private */, + 16, 0, 204, 2, 0x08 /* Private */, + 17, 1, 205, 2, 0x08 /* Private */, + 19, 0, 208, 2, 0x08 /* Private */, + 20, 0, 209, 2, 0x08 /* Private */, + 21, 0, 210, 2, 0x08 /* Private */, + 22, 0, 211, 2, 0x08 /* Private */, + 23, 0, 212, 2, 0x08 /* Private */, + 24, 0, 213, 2, 0x08 /* Private */, + 25, 1, 214, 2, 0x08 /* Private */, + 26, 1, 217, 2, 0x08 /* Private */, + 27, 1, 220, 2, 0x08 /* Private */, + 28, 1, 223, 2, 0x08 /* Private */, + 30, 1, 226, 2, 0x08 /* Private */, + 31, 1, 229, 2, 0x08 /* Private */, + 32, 1, 232, 2, 0x08 /* Private */, + 33, 1, 235, 2, 0x08 /* Private */, + 34, 1, 238, 2, 0x08 /* Private */, + 35, 0, 241, 2, 0x08 /* Private */, + 36, 0, 242, 2, 0x08 /* Private */, + 37, 0, 243, 2, 0x08 /* Private */, + 38, 0, 244, 2, 0x08 /* Private */, + 39, 0, 245, 2, 0x08 /* Private */, // slots: parameters + QMetaType::Void, QMetaType::QString, 3, QMetaType::Void, QMetaType::Void, QMetaType::Void, QMetaType::Void, - QMetaType::Void, QMetaType::Int, 7, - QMetaType::Void, QMetaType::Int, 7, - QMetaType::Void, QMetaType::Int, 7, + QMetaType::Void, QMetaType::Int, 9, + QMetaType::Void, QMetaType::Int, 9, + QMetaType::Void, QMetaType::Int, 9, QMetaType::Void, QMetaType::Void, QMetaType::Void, QMetaType::Void, QMetaType::Void, - QMetaType::Void, QMetaType::Int, 16, + QMetaType::Void, QMetaType::Int, 18, QMetaType::Void, QMetaType::Void, QMetaType::Void, QMetaType::Void, QMetaType::Void, QMetaType::Void, - QMetaType::Void, QMetaType::Int, 7, - QMetaType::Void, QMetaType::Int, 7, - QMetaType::Void, QMetaType::Int, 7, - QMetaType::Void, QMetaType::Int, 27, - QMetaType::Void, QMetaType::Int, 27, - QMetaType::Void, QMetaType::Int, 27, - QMetaType::Void, QMetaType::Int, 27, - QMetaType::Void, QMetaType::Int, 27, - QMetaType::Void, QMetaType::Int, 27, + QMetaType::Void, QMetaType::Int, 9, + QMetaType::Void, QMetaType::Int, 9, + QMetaType::Void, QMetaType::Int, 9, + QMetaType::Void, QMetaType::Int, 29, + QMetaType::Void, QMetaType::Int, 29, + QMetaType::Void, QMetaType::Int, 29, + QMetaType::Void, QMetaType::Int, 29, + QMetaType::Void, QMetaType::Int, 29, + QMetaType::Void, QMetaType::Int, 29, + QMetaType::Void, + QMetaType::Void, + QMetaType::Void, + QMetaType::Void, + QMetaType::Void, 0 // eod }; @@ -175,34 +197,40 @@ void controllerWindow::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int controllerWindow *_t = static_cast(_o); Q_UNUSED(_t) switch (_id) { - case 0: _t->on_connect_button_clicked(); break; - case 1: _t->on_disconnect_button_clicked(); break; - case 2: _t->on_refresh_port_button_clicked(); break; - case 3: _t->on_reload_preset_button_clicked(); break; - case 4: _t->on_r_slider_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break; - case 5: _t->on_g_slider_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break; - case 6: _t->on_b_slider_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break; - case 7: _t->on_red_button_clicked(); break; - case 8: _t->on_green_button_clicked(); break; - case 9: _t->on_blue_button_clicked(); break; - case 10: _t->on_off_button_clicked(); break; - case 11: _t->on_set_preset_button_clicked(); break; - case 12: _t->on_presets_dropdown_currentIndexChanged((*reinterpret_cast< int(*)>(_a[1]))); break; - case 13: _t->on_preset_save_button_clicked(); break; - case 14: _t->on_preset_delete_button_clicked(); break; - case 15: _t->on_red_fade_button_clicked(); break; - case 16: _t->on_green_fade_button_clicked(); break; - case 17: _t->on_blue_fade_button_clicked(); break; - case 18: _t->on_speed_button_clicked(); break; - case 19: _t->on_r_speed_slider_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break; - case 20: _t->on_g_speed_slider_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break; - case 21: _t->on_b_speed_slider_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break; - case 22: _t->on_rfrom_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break; - case 23: _t->on_rto_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break; - case 24: _t->on_gfrom_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break; - case 25: _t->on_gto_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break; - case 26: _t->on_bfrom_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break; - case 27: _t->on_bto_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break; + case 0: _t->cmdrecv((*reinterpret_cast< QString(*)>(_a[1]))); break; + case 1: _t->on_connect_button_clicked(); break; + case 2: _t->on_disconnect_button_clicked(); break; + case 3: _t->on_refresh_port_button_clicked(); break; + case 4: _t->on_reload_preset_button_clicked(); break; + case 5: _t->on_r_slider_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break; + case 6: _t->on_g_slider_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break; + case 7: _t->on_b_slider_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break; + case 8: _t->on_red_button_clicked(); break; + case 9: _t->on_green_button_clicked(); break; + case 10: _t->on_blue_button_clicked(); break; + case 11: _t->on_off_button_clicked(); break; + case 12: _t->on_set_preset_button_clicked(); break; + case 13: _t->on_presets_dropdown_currentIndexChanged((*reinterpret_cast< int(*)>(_a[1]))); break; + case 14: _t->on_preset_save_button_clicked(); break; + case 15: _t->on_preset_delete_button_clicked(); break; + case 16: _t->on_red_fade_button_clicked(); break; + case 17: _t->on_green_fade_button_clicked(); break; + case 18: _t->on_blue_fade_button_clicked(); break; + case 19: _t->on_speed_button_clicked(); break; + case 20: _t->on_r_speed_slider_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break; + case 21: _t->on_g_speed_slider_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break; + case 22: _t->on_b_speed_slider_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break; + case 23: _t->on_rfrom_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break; + case 24: _t->on_rto_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break; + case 25: _t->on_gfrom_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break; + case 26: _t->on_gto_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break; + case 27: _t->on_bfrom_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break; + case 28: _t->on_bto_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break; + case 29: _t->on_serial_send_button_clicked(); break; + case 30: _t->ping(); break; + case 31: _t->check_ping(); break; + case 32: _t->on_irc_connect_button_clicked(); break; + case 33: _t->on_server_start_button_clicked(); break; default: ; } } @@ -233,13 +261,13 @@ int controllerWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { - if (_id < 28) + if (_id < 34) qt_static_metacall(this, _c, _id, _a); - _id -= 28; + _id -= 34; } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { - if (_id < 28) + if (_id < 34) *reinterpret_cast(_a[0]) = -1; - _id -= 28; + _id -= 34; } return _id; } diff --git a/qt/build-RGBController-Desktop-Debug/moc_irc.cpp b/qt/build-RGBController-Desktop-Debug/moc_irc.cpp new file mode 100644 index 0000000..4756835 --- /dev/null +++ b/qt/build-RGBController-Desktop-Debug/moc_irc.cpp @@ -0,0 +1,148 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'irc.h' +** +** Created by: The Qt Meta Object Compiler version 67 (Qt 5.8.0) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "../RGBController/irc.h" +#include +#include +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'irc.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 67 +#error "This file was generated using the moc from 5.8.0. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED +struct qt_meta_stringdata_irc_t { + QByteArrayData data[8]; + char stringdata0[37]; +}; +#define QT_MOC_LITERAL(idx, ofs, len) \ + Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ + qptrdiff(offsetof(qt_meta_stringdata_irc_t, stringdata0) + ofs \ + - idx * sizeof(QByteArrayData)) \ + ) +static const qt_meta_stringdata_irc_t qt_meta_stringdata_irc = { + { +QT_MOC_LITERAL(0, 0, 3), // "irc" +QT_MOC_LITERAL(1, 4, 7), // "sendcmd" +QT_MOC_LITERAL(2, 12, 0), // "" +QT_MOC_LITERAL(3, 13, 3), // "cmd" +QT_MOC_LITERAL(4, 17, 4), // "read" +QT_MOC_LITERAL(5, 22, 3), // "con" +QT_MOC_LITERAL(6, 26, 6), // "handle" +QT_MOC_LITERAL(7, 33, 3) // "str" + + }, + "irc\0sendcmd\0\0cmd\0read\0con\0handle\0str" +}; +#undef QT_MOC_LITERAL + +static const uint qt_meta_data_irc[] = { + + // content: + 7, // revision + 0, // classname + 0, 0, // classinfo + 4, 14, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 1, // signalCount + + // signals: name, argc, parameters, tag, flags + 1, 1, 34, 2, 0x06 /* Public */, + + // slots: name, argc, parameters, tag, flags + 4, 0, 37, 2, 0x08 /* Private */, + 5, 0, 38, 2, 0x08 /* Private */, + 6, 1, 39, 2, 0x08 /* Private */, + + // signals: parameters + QMetaType::Void, QMetaType::QString, 3, + + // slots: parameters + QMetaType::Void, + QMetaType::Void, + QMetaType::Void, QMetaType::QString, 7, + + 0 // eod +}; + +void irc::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) +{ + if (_c == QMetaObject::InvokeMetaMethod) { + irc *_t = static_cast(_o); + Q_UNUSED(_t) + switch (_id) { + case 0: _t->sendcmd((*reinterpret_cast< QString(*)>(_a[1]))); break; + case 1: _t->read(); break; + case 2: _t->con(); break; + case 3: _t->handle((*reinterpret_cast< QString(*)>(_a[1]))); break; + default: ; + } + } else if (_c == QMetaObject::IndexOfMethod) { + int *result = reinterpret_cast(_a[0]); + void **func = reinterpret_cast(_a[1]); + { + typedef void (irc::*_t)(QString ); + if (*reinterpret_cast<_t *>(func) == static_cast<_t>(&irc::sendcmd)) { + *result = 0; + return; + } + } + } +} + +const QMetaObject irc::staticMetaObject = { + { &QObject::staticMetaObject, qt_meta_stringdata_irc.data, + qt_meta_data_irc, qt_static_metacall, Q_NULLPTR, Q_NULLPTR} +}; + + +const QMetaObject *irc::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; +} + +void *irc::qt_metacast(const char *_clname) +{ + if (!_clname) return Q_NULLPTR; + if (!strcmp(_clname, qt_meta_stringdata_irc.stringdata0)) + return static_cast(const_cast< irc*>(this)); + return QObject::qt_metacast(_clname); +} + +int irc::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QObject::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + if (_c == QMetaObject::InvokeMetaMethod) { + if (_id < 4) + qt_static_metacall(this, _c, _id, _a); + _id -= 4; + } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { + if (_id < 4) + *reinterpret_cast(_a[0]) = -1; + _id -= 4; + } + return _id; +} + +// SIGNAL 0 +void irc::sendcmd(QString _t1) +{ + void *_a[] = { Q_NULLPTR, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 0, _a); +} +QT_WARNING_POP +QT_END_MOC_NAMESPACE diff --git a/qt/build-RGBController-Desktop-Debug/moc_server.cpp b/qt/build-RGBController-Desktop-Debug/moc_server.cpp new file mode 100644 index 0000000..9cc6f2b --- /dev/null +++ b/qt/build-RGBController-Desktop-Debug/moc_server.cpp @@ -0,0 +1,139 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'server.h' +** +** Created by: The Qt Meta Object Compiler version 67 (Qt 5.8.0) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "../RGBController/server.h" +#include +#include +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'server.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 67 +#error "This file was generated using the moc from 5.8.0. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED +struct qt_meta_stringdata_server_t { + QByteArrayData data[5]; + char stringdata0[35]; +}; +#define QT_MOC_LITERAL(idx, ofs, len) \ + Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ + qptrdiff(offsetof(qt_meta_stringdata_server_t, stringdata0) + ofs \ + - idx * sizeof(QByteArrayData)) \ + ) +static const qt_meta_stringdata_server_t qt_meta_stringdata_server = { + { +QT_MOC_LITERAL(0, 0, 6), // "server" +QT_MOC_LITERAL(1, 7, 7), // "sendcmd" +QT_MOC_LITERAL(2, 15, 0), // "" +QT_MOC_LITERAL(3, 16, 3), // "cmd" +QT_MOC_LITERAL(4, 20, 14) // "new_connection" + + }, + "server\0sendcmd\0\0cmd\0new_connection" +}; +#undef QT_MOC_LITERAL + +static const uint qt_meta_data_server[] = { + + // content: + 7, // revision + 0, // classname + 0, 0, // classinfo + 2, 14, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 1, // signalCount + + // signals: name, argc, parameters, tag, flags + 1, 1, 24, 2, 0x06 /* Public */, + + // slots: name, argc, parameters, tag, flags + 4, 0, 27, 2, 0x08 /* Private */, + + // signals: parameters + QMetaType::Void, QMetaType::QString, 3, + + // slots: parameters + QMetaType::Void, + + 0 // eod +}; + +void server::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) +{ + if (_c == QMetaObject::InvokeMetaMethod) { + server *_t = static_cast(_o); + Q_UNUSED(_t) + switch (_id) { + case 0: _t->sendcmd((*reinterpret_cast< QString(*)>(_a[1]))); break; + case 1: _t->new_connection(); break; + default: ; + } + } else if (_c == QMetaObject::IndexOfMethod) { + int *result = reinterpret_cast(_a[0]); + void **func = reinterpret_cast(_a[1]); + { + typedef void (server::*_t)(QString ); + if (*reinterpret_cast<_t *>(func) == static_cast<_t>(&server::sendcmd)) { + *result = 0; + return; + } + } + } +} + +const QMetaObject server::staticMetaObject = { + { &QObject::staticMetaObject, qt_meta_stringdata_server.data, + qt_meta_data_server, qt_static_metacall, Q_NULLPTR, Q_NULLPTR} +}; + + +const QMetaObject *server::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; +} + +void *server::qt_metacast(const char *_clname) +{ + if (!_clname) return Q_NULLPTR; + if (!strcmp(_clname, qt_meta_stringdata_server.stringdata0)) + return static_cast(const_cast< server*>(this)); + return QObject::qt_metacast(_clname); +} + +int server::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QObject::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + if (_c == QMetaObject::InvokeMetaMethod) { + if (_id < 2) + qt_static_metacall(this, _c, _id, _a); + _id -= 2; + } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { + if (_id < 2) + *reinterpret_cast(_a[0]) = -1; + _id -= 2; + } + return _id; +} + +// SIGNAL 0 +void server::sendcmd(QString _t1) +{ + void *_a[] = { Q_NULLPTR, const_cast(reinterpret_cast(&_t1)) }; + QMetaObject::activate(this, &staticMetaObject, 0, _a); +} +QT_WARNING_POP +QT_END_MOC_NAMESPACE diff --git a/qt/build-RGBController-Desktop-Debug/ui_controllerwindow.h b/qt/build-RGBController-Desktop-Debug/ui_controllerwindow.h index 5c2c857..8b77987 100644 --- a/qt/build-RGBController-Desktop-Debug/ui_controllerwindow.h +++ b/qt/build-RGBController-Desktop-Debug/ui_controllerwindow.h @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -22,6 +23,7 @@ #include #include #include +#include #include #include @@ -32,366 +34,579 @@ class Ui_controllerWindow public: QWidget *centralWidget; QGridLayout *gridLayout_2; - QPushButton *reload_preset_button; - QPushButton *off_button; - QPushButton *preset_delete_button; - QLabel *presets_label; - QPushButton *disconnect_button; + QTabWidget *display_tab; + QWidget *status_tab; + QFormLayout *formLayout; + QGridLayout *gridLayout_5; + QLabel *arduino_port_label; + QPushButton *refresh_port_button; + QLabel *status_label; QLabel *arduino_status_label; QComboBox *arduino_port_dropdown; - QSlider *b_slider; - QSlider *b_speed_slider; - QTextEdit *info_log_textarea; - QLineEdit *preset_name_textbox; - QComboBox *presets_dropdown; - QLabel *info_log_label; - QPushButton *green_button; - QPushButton *refresh_port_button; - QSlider *g_speed_slider; + QPushButton *disconnect_button; + QPushButton *connect_button; + QWidget *color_tab; + QFormLayout *formLayout_2; QLabel *rgb_label; - QLabel *status_label; - QPushButton *preset_save_button; - QSlider *g_slider; - QSlider *r_speed_slider; - QLabel *g_speed_label; + QSlider *r_slider; QPushButton *red_button; + QSlider *g_slider; + QPushButton *green_button; + QSlider *b_slider; QPushButton *blue_button; - QPushButton *connect_button; - QLabel *r_speed_label; - QSlider *r_slider; - QPushButton *set_preset_button; + QPushButton *off_button; + QWidget *fade_tab; + QFormLayout *formLayout_3; QGridLayout *gridLayout; QPushButton *blue_fade_button; - QSpinBox *bfrom; - QSpinBox *rto; QSpinBox *gfrom; - QLabel *r_to_label; - QSpinBox *rfrom; QLabel *g_to_label; + QLabel *r_to_label; QSpinBox *bto; - QSpinBox *gto; + QSpinBox *rto; + QSpinBox *bfrom; QPushButton *green_fade_button; + QSlider *b_speed_slider; + QSlider *g_speed_slider; + QSpinBox *gto; + QSpinBox *rfrom; QPushButton *red_fade_button; QLabel *_to_label; QLabel *fade_label; - QLabel *arduino_port_label; + QSlider *r_speed_slider; + QSlider *speed_slider; + QLabel *r_speed_label; + QLabel *g_speed_label; QLabel *b_speed_label; QPushButton *speed_button; - QSlider *speed_slider; + QWidget *presets_tab; + QFormLayout *formLayout_4; + QLabel *presets_label; + QComboBox *presets_dropdown; + QPushButton *set_preset_button; + QPushButton *reload_preset_button; + QLineEdit *preset_name_textbox; + QPushButton *preset_save_button; + QPushButton *preset_delete_button; + QWidget *irc_tab; + QFormLayout *formLayout_5; + QLabel *irc_bot_label; + QLabel *irc_server_label; + QLineEdit *irc_server_input; + QSpinBox *irc_bot_spinbox; + QLabel *irc_channel_label; + QLineEdit *irc_channel_input; + QLabel *irc_name_label; + QLineEdit *irc_name_input; + QLabel *irc_port_label; + QPushButton *irc_connect_button; + QWidget *server_tab; + QGridLayout *gridLayout_6; + QFormLayout *server_tab_layout; + QPushButton *server_start_button; + QWidget *log_tab; + QGridLayout *gridLayout_3; + QLineEdit *serial_input; + QPushButton *serial_send_button; + QTextEdit *info_log_textarea; + QLabel *info_log_label; + QLabel *ping_count_label; void setupUi(QMainWindow *controllerWindow) { if (controllerWindow->objectName().isEmpty()) controllerWindow->setObjectName(QStringLiteral("controllerWindow")); controllerWindow->setWindowModality(Qt::WindowModal); - controllerWindow->resize(232, 629); + controllerWindow->resize(433, 254); centralWidget = new QWidget(controllerWindow); centralWidget->setObjectName(QStringLiteral("centralWidget")); gridLayout_2 = new QGridLayout(centralWidget); gridLayout_2->setSpacing(6); gridLayout_2->setContentsMargins(11, 11, 11, 11); gridLayout_2->setObjectName(QStringLiteral("gridLayout_2")); - reload_preset_button = new QPushButton(centralWidget); - reload_preset_button->setObjectName(QStringLiteral("reload_preset_button")); + display_tab = new QTabWidget(centralWidget); + display_tab->setObjectName(QStringLiteral("display_tab")); + status_tab = new QWidget(); + status_tab->setObjectName(QStringLiteral("status_tab")); + formLayout = new QFormLayout(status_tab); + formLayout->setSpacing(6); + formLayout->setContentsMargins(11, 11, 11, 11); + formLayout->setObjectName(QStringLiteral("formLayout")); + gridLayout_5 = new QGridLayout(); + gridLayout_5->setSpacing(6); + gridLayout_5->setObjectName(QStringLiteral("gridLayout_5")); + arduino_port_label = new QLabel(status_tab); + arduino_port_label->setObjectName(QStringLiteral("arduino_port_label")); + arduino_port_label->setMinimumSize(QSize(120, 0)); - gridLayout_2->addWidget(reload_preset_button, 11, 0, 1, 1); + gridLayout_5->addWidget(arduino_port_label, 1, 0, 1, 1); - off_button = new QPushButton(centralWidget); - off_button->setObjectName(QStringLiteral("off_button")); + refresh_port_button = new QPushButton(status_tab); + refresh_port_button->setObjectName(QStringLiteral("refresh_port_button")); - gridLayout_2->addWidget(off_button, 8, 1, 1, 1); + gridLayout_5->addWidget(refresh_port_button, 2, 1, 1, 1); - preset_delete_button = new QPushButton(centralWidget); - preset_delete_button->setObjectName(QStringLiteral("preset_delete_button")); + status_label = new QLabel(status_tab); + status_label->setObjectName(QStringLiteral("status_label")); - gridLayout_2->addWidget(preset_delete_button, 13, 1, 1, 1); + gridLayout_5->addWidget(status_label, 0, 0, 1, 1); - presets_label = new QLabel(centralWidget); - presets_label->setObjectName(QStringLiteral("presets_label")); + arduino_status_label = new QLabel(status_tab); + arduino_status_label->setObjectName(QStringLiteral("arduino_status_label")); + + gridLayout_5->addWidget(arduino_status_label, 0, 1, 1, 1); - gridLayout_2->addWidget(presets_label, 9, 0, 1, 1); + arduino_port_dropdown = new QComboBox(status_tab); + arduino_port_dropdown->setObjectName(QStringLiteral("arduino_port_dropdown")); + + gridLayout_5->addWidget(arduino_port_dropdown, 1, 1, 1, 1); - disconnect_button = new QPushButton(centralWidget); + disconnect_button = new QPushButton(status_tab); disconnect_button->setObjectName(QStringLiteral("disconnect_button")); - gridLayout_2->addWidget(disconnect_button, 3, 1, 1, 1); + gridLayout_5->addWidget(disconnect_button, 3, 1, 1, 1); - arduino_status_label = new QLabel(centralWidget); - arduino_status_label->setObjectName(QStringLiteral("arduino_status_label")); + connect_button = new QPushButton(status_tab); + connect_button->setObjectName(QStringLiteral("connect_button")); - gridLayout_2->addWidget(arduino_status_label, 0, 1, 1, 1); + gridLayout_5->addWidget(connect_button, 3, 0, 1, 1); - arduino_port_dropdown = new QComboBox(centralWidget); - arduino_port_dropdown->setObjectName(QStringLiteral("arduino_port_dropdown")); - gridLayout_2->addWidget(arduino_port_dropdown, 1, 1, 1, 1); + formLayout->setLayout(0, QFormLayout::LabelRole, gridLayout_5); + + display_tab->addTab(status_tab, QString()); + color_tab = new QWidget(); + color_tab->setObjectName(QStringLiteral("color_tab")); + formLayout_2 = new QFormLayout(color_tab); + formLayout_2->setSpacing(6); + formLayout_2->setContentsMargins(11, 11, 11, 11); + formLayout_2->setObjectName(QStringLiteral("formLayout_2")); + rgb_label = new QLabel(color_tab); + rgb_label->setObjectName(QStringLiteral("rgb_label")); + + formLayout_2->setWidget(0, QFormLayout::LabelRole, rgb_label); + + r_slider = new QSlider(color_tab); + r_slider->setObjectName(QStringLiteral("r_slider")); + r_slider->setMinimumSize(QSize(120, 0)); + r_slider->setMaximumSize(QSize(120, 16777215)); + r_slider->setMaximum(255); + r_slider->setOrientation(Qt::Horizontal); + + formLayout_2->setWidget(1, QFormLayout::LabelRole, r_slider); + + red_button = new QPushButton(color_tab); + red_button->setObjectName(QStringLiteral("red_button")); + red_button->setMaximumSize(QSize(90, 16777215)); + + formLayout_2->setWidget(1, QFormLayout::FieldRole, red_button); - b_slider = new QSlider(centralWidget); + g_slider = new QSlider(color_tab); + g_slider->setObjectName(QStringLiteral("g_slider")); + g_slider->setMinimumSize(QSize(120, 0)); + g_slider->setMaximumSize(QSize(120, 16777215)); + g_slider->setMaximum(255); + g_slider->setOrientation(Qt::Horizontal); + + formLayout_2->setWidget(2, QFormLayout::LabelRole, g_slider); + + green_button = new QPushButton(color_tab); + green_button->setObjectName(QStringLiteral("green_button")); + green_button->setMaximumSize(QSize(90, 16777215)); + + formLayout_2->setWidget(2, QFormLayout::FieldRole, green_button); + + b_slider = new QSlider(color_tab); b_slider->setObjectName(QStringLiteral("b_slider")); b_slider->setMinimumSize(QSize(120, 0)); b_slider->setMaximumSize(QSize(120, 16777215)); b_slider->setMaximum(255); b_slider->setOrientation(Qt::Horizontal); - gridLayout_2->addWidget(b_slider, 7, 0, 1, 1); + formLayout_2->setWidget(3, QFormLayout::LabelRole, b_slider); - b_speed_slider = new QSlider(centralWidget); - b_speed_slider->setObjectName(QStringLiteral("b_speed_slider")); - b_speed_slider->setMinimum(1); - b_speed_slider->setMaximum(500); - b_speed_slider->setOrientation(Qt::Horizontal); + blue_button = new QPushButton(color_tab); + blue_button->setObjectName(QStringLiteral("blue_button")); + blue_button->setMaximumSize(QSize(90, 16777215)); - gridLayout_2->addWidget(b_speed_slider, 17, 0, 1, 1); + formLayout_2->setWidget(3, QFormLayout::FieldRole, blue_button); - info_log_textarea = new QTextEdit(centralWidget); - info_log_textarea->setObjectName(QStringLiteral("info_log_textarea")); + off_button = new QPushButton(color_tab); + off_button->setObjectName(QStringLiteral("off_button")); + off_button->setMaximumSize(QSize(90, 16777215)); + + formLayout_2->setWidget(4, QFormLayout::FieldRole, off_button); + + display_tab->addTab(color_tab, QString()); + rgb_label->raise(); + r_slider->raise(); + g_slider->raise(); + b_slider->raise(); + red_button->raise(); + green_button->raise(); + blue_button->raise(); + off_button->raise(); + fade_tab = new QWidget(); + fade_tab->setObjectName(QStringLiteral("fade_tab")); + formLayout_3 = new QFormLayout(fade_tab); + formLayout_3->setSpacing(6); + formLayout_3->setContentsMargins(11, 11, 11, 11); + formLayout_3->setObjectName(QStringLiteral("formLayout_3")); + gridLayout = new QGridLayout(); + gridLayout->setSpacing(6); + gridLayout->setObjectName(QStringLiteral("gridLayout")); + blue_fade_button = new QPushButton(fade_tab); + blue_fade_button->setObjectName(QStringLiteral("blue_fade_button")); - gridLayout_2->addWidget(info_log_textarea, 20, 0, 1, 2); + gridLayout->addWidget(blue_fade_button, 4, 3, 1, 1); - preset_name_textbox = new QLineEdit(centralWidget); - preset_name_textbox->setObjectName(QStringLiteral("preset_name_textbox")); + gfrom = new QSpinBox(fade_tab); + gfrom->setObjectName(QStringLiteral("gfrom")); + gfrom->setMaximumSize(QSize(50, 16777215)); + gfrom->setMaximum(255); - gridLayout_2->addWidget(preset_name_textbox, 12, 0, 1, 1); + gridLayout->addWidget(gfrom, 3, 0, 1, 1); - presets_dropdown = new QComboBox(centralWidget); - presets_dropdown->setObjectName(QStringLiteral("presets_dropdown")); - presets_dropdown->setMinimumSize(QSize(120, 0)); + g_to_label = new QLabel(fade_tab); + g_to_label->setObjectName(QStringLiteral("g_to_label")); - gridLayout_2->addWidget(presets_dropdown, 10, 0, 1, 1); + gridLayout->addWidget(g_to_label, 3, 1, 1, 1); - info_log_label = new QLabel(centralWidget); - info_log_label->setObjectName(QStringLiteral("info_log_label")); + r_to_label = new QLabel(fade_tab); + r_to_label->setObjectName(QStringLiteral("r_to_label")); - gridLayout_2->addWidget(info_log_label, 19, 0, 1, 1); + gridLayout->addWidget(r_to_label, 1, 1, 1, 1); - green_button = new QPushButton(centralWidget); - green_button->setObjectName(QStringLiteral("green_button")); + bto = new QSpinBox(fade_tab); + bto->setObjectName(QStringLiteral("bto")); + bto->setMaximumSize(QSize(50, 16777215)); + bto->setMaximum(255); - gridLayout_2->addWidget(green_button, 6, 1, 1, 1); + gridLayout->addWidget(bto, 4, 2, 1, 1); - refresh_port_button = new QPushButton(centralWidget); - refresh_port_button->setObjectName(QStringLiteral("refresh_port_button")); + rto = new QSpinBox(fade_tab); + rto->setObjectName(QStringLiteral("rto")); + rto->setMaximumSize(QSize(50, 16777215)); + rto->setMaximum(255); + + gridLayout->addWidget(rto, 1, 2, 1, 1); + + bfrom = new QSpinBox(fade_tab); + bfrom->setObjectName(QStringLiteral("bfrom")); + bfrom->setMaximumSize(QSize(50, 16777215)); + bfrom->setMaximum(255); + + gridLayout->addWidget(bfrom, 4, 0, 1, 1); + + green_fade_button = new QPushButton(fade_tab); + green_fade_button->setObjectName(QStringLiteral("green_fade_button")); + + gridLayout->addWidget(green_fade_button, 3, 3, 1, 1); + + b_speed_slider = new QSlider(fade_tab); + b_speed_slider->setObjectName(QStringLiteral("b_speed_slider")); + b_speed_slider->setMinimum(1); + b_speed_slider->setMaximum(500); + b_speed_slider->setOrientation(Qt::Horizontal); - gridLayout_2->addWidget(refresh_port_button, 2, 1, 1, 1); + gridLayout->addWidget(b_speed_slider, 7, 0, 1, 1); - g_speed_slider = new QSlider(centralWidget); + g_speed_slider = new QSlider(fade_tab); g_speed_slider->setObjectName(QStringLiteral("g_speed_slider")); g_speed_slider->setMinimum(1); g_speed_slider->setMaximum(500); g_speed_slider->setOrientation(Qt::Horizontal); - gridLayout_2->addWidget(g_speed_slider, 16, 0, 1, 1); + gridLayout->addWidget(g_speed_slider, 6, 0, 1, 1); - rgb_label = new QLabel(centralWidget); - rgb_label->setObjectName(QStringLiteral("rgb_label")); + gto = new QSpinBox(fade_tab); + gto->setObjectName(QStringLiteral("gto")); + gto->setMaximumSize(QSize(50, 16777215)); + gto->setMaximum(255); - gridLayout_2->addWidget(rgb_label, 4, 0, 1, 1); + gridLayout->addWidget(gto, 3, 2, 1, 1); - status_label = new QLabel(centralWidget); - status_label->setObjectName(QStringLiteral("status_label")); + rfrom = new QSpinBox(fade_tab); + rfrom->setObjectName(QStringLiteral("rfrom")); + rfrom->setMaximumSize(QSize(50, 16777215)); + rfrom->setMaximum(255); - gridLayout_2->addWidget(status_label, 0, 0, 1, 1); + gridLayout->addWidget(rfrom, 1, 0, 1, 1); - preset_save_button = new QPushButton(centralWidget); - preset_save_button->setObjectName(QStringLiteral("preset_save_button")); + red_fade_button = new QPushButton(fade_tab); + red_fade_button->setObjectName(QStringLiteral("red_fade_button")); - gridLayout_2->addWidget(preset_save_button, 12, 1, 1, 1); + gridLayout->addWidget(red_fade_button, 1, 3, 1, 1); - g_slider = new QSlider(centralWidget); - g_slider->setObjectName(QStringLiteral("g_slider")); - g_slider->setMinimumSize(QSize(120, 0)); - g_slider->setMaximumSize(QSize(120, 16777215)); - g_slider->setMaximum(255); - g_slider->setOrientation(Qt::Horizontal); + _to_label = new QLabel(fade_tab); + _to_label->setObjectName(QStringLiteral("_to_label")); - gridLayout_2->addWidget(g_slider, 6, 0, 1, 1); + gridLayout->addWidget(_to_label, 4, 1, 1, 1); - r_speed_slider = new QSlider(centralWidget); + fade_label = new QLabel(fade_tab); + fade_label->setObjectName(QStringLiteral("fade_label")); + + gridLayout->addWidget(fade_label, 0, 0, 1, 1); + + r_speed_slider = new QSlider(fade_tab); r_speed_slider->setObjectName(QStringLiteral("r_speed_slider")); r_speed_slider->setMinimum(1); - r_speed_slider->setMaximum(500); + r_speed_slider->setMaximum(100); r_speed_slider->setOrientation(Qt::Horizontal); - gridLayout_2->addWidget(r_speed_slider, 15, 0, 1, 1); + gridLayout->addWidget(r_speed_slider, 5, 0, 1, 1); + + speed_slider = new QSlider(fade_tab); + speed_slider->setObjectName(QStringLiteral("speed_slider")); + speed_slider->setMinimum(10); + speed_slider->setMaximum(500); + speed_slider->setOrientation(Qt::Horizontal); + + gridLayout->addWidget(speed_slider, 8, 0, 1, 1); + + r_speed_label = new QLabel(fade_tab); + r_speed_label->setObjectName(QStringLiteral("r_speed_label")); + + gridLayout->addWidget(r_speed_label, 5, 2, 1, 1); - g_speed_label = new QLabel(centralWidget); + g_speed_label = new QLabel(fade_tab); g_speed_label->setObjectName(QStringLiteral("g_speed_label")); - gridLayout_2->addWidget(g_speed_label, 16, 1, 1, 1); + gridLayout->addWidget(g_speed_label, 6, 2, 1, 1); - red_button = new QPushButton(centralWidget); - red_button->setObjectName(QStringLiteral("red_button")); + b_speed_label = new QLabel(fade_tab); + b_speed_label->setObjectName(QStringLiteral("b_speed_label")); - gridLayout_2->addWidget(red_button, 5, 1, 1, 1); + gridLayout->addWidget(b_speed_label, 7, 2, 1, 1); - blue_button = new QPushButton(centralWidget); - blue_button->setObjectName(QStringLiteral("blue_button")); + speed_button = new QPushButton(fade_tab); + speed_button->setObjectName(QStringLiteral("speed_button")); - gridLayout_2->addWidget(blue_button, 7, 1, 1, 1); + gridLayout->addWidget(speed_button, 8, 2, 1, 1); - connect_button = new QPushButton(centralWidget); - connect_button->setObjectName(QStringLiteral("connect_button")); - gridLayout_2->addWidget(connect_button, 3, 0, 1, 1); + formLayout_3->setLayout(0, QFormLayout::LabelRole, gridLayout); - r_speed_label = new QLabel(centralWidget); - r_speed_label->setObjectName(QStringLiteral("r_speed_label")); + display_tab->addTab(fade_tab, QString()); + presets_tab = new QWidget(); + presets_tab->setObjectName(QStringLiteral("presets_tab")); + formLayout_4 = new QFormLayout(presets_tab); + formLayout_4->setSpacing(6); + formLayout_4->setContentsMargins(11, 11, 11, 11); + formLayout_4->setObjectName(QStringLiteral("formLayout_4")); + presets_label = new QLabel(presets_tab); + presets_label->setObjectName(QStringLiteral("presets_label")); - gridLayout_2->addWidget(r_speed_label, 15, 1, 1, 1); + formLayout_4->setWidget(0, QFormLayout::LabelRole, presets_label); - r_slider = new QSlider(centralWidget); - r_slider->setObjectName(QStringLiteral("r_slider")); - r_slider->setMinimumSize(QSize(120, 0)); - r_slider->setMaximumSize(QSize(120, 16777215)); - r_slider->setMaximum(255); - r_slider->setOrientation(Qt::Horizontal); + presets_dropdown = new QComboBox(presets_tab); + presets_dropdown->setObjectName(QStringLiteral("presets_dropdown")); + presets_dropdown->setMinimumSize(QSize(120, 0)); - gridLayout_2->addWidget(r_slider, 5, 0, 1, 1); + formLayout_4->setWidget(1, QFormLayout::LabelRole, presets_dropdown); - set_preset_button = new QPushButton(centralWidget); + set_preset_button = new QPushButton(presets_tab); set_preset_button->setObjectName(QStringLiteral("set_preset_button")); + set_preset_button->setMaximumSize(QSize(90, 16777215)); - gridLayout_2->addWidget(set_preset_button, 10, 1, 1, 1); + formLayout_4->setWidget(1, QFormLayout::FieldRole, set_preset_button); - gridLayout = new QGridLayout(); - gridLayout->setSpacing(6); - gridLayout->setObjectName(QStringLiteral("gridLayout")); - blue_fade_button = new QPushButton(centralWidget); - blue_fade_button->setObjectName(QStringLiteral("blue_fade_button")); + reload_preset_button = new QPushButton(presets_tab); + reload_preset_button->setObjectName(QStringLiteral("reload_preset_button")); - gridLayout->addWidget(blue_fade_button, 4, 3, 1, 1); + formLayout_4->setWidget(2, QFormLayout::LabelRole, reload_preset_button); - bfrom = new QSpinBox(centralWidget); - bfrom->setObjectName(QStringLiteral("bfrom")); - bfrom->setMaximum(255); + preset_name_textbox = new QLineEdit(presets_tab); + preset_name_textbox->setObjectName(QStringLiteral("preset_name_textbox")); - gridLayout->addWidget(bfrom, 4, 0, 1, 1); + formLayout_4->setWidget(3, QFormLayout::LabelRole, preset_name_textbox); - rto = new QSpinBox(centralWidget); - rto->setObjectName(QStringLiteral("rto")); - rto->setMaximum(255); + preset_save_button = new QPushButton(presets_tab); + preset_save_button->setObjectName(QStringLiteral("preset_save_button")); + preset_save_button->setMaximumSize(QSize(90, 16777215)); - gridLayout->addWidget(rto, 1, 2, 1, 1); + formLayout_4->setWidget(3, QFormLayout::FieldRole, preset_save_button); - gfrom = new QSpinBox(centralWidget); - gfrom->setObjectName(QStringLiteral("gfrom")); - gfrom->setMaximum(255); + preset_delete_button = new QPushButton(presets_tab); + preset_delete_button->setObjectName(QStringLiteral("preset_delete_button")); + preset_delete_button->setMaximumSize(QSize(90, 16777215)); - gridLayout->addWidget(gfrom, 3, 0, 1, 1); + formLayout_4->setWidget(4, QFormLayout::FieldRole, preset_delete_button); - r_to_label = new QLabel(centralWidget); - r_to_label->setObjectName(QStringLiteral("r_to_label")); + display_tab->addTab(presets_tab, QString()); + irc_tab = new QWidget(); + irc_tab->setObjectName(QStringLiteral("irc_tab")); + formLayout_5 = new QFormLayout(irc_tab); + formLayout_5->setSpacing(6); + formLayout_5->setContentsMargins(11, 11, 11, 11); + formLayout_5->setObjectName(QStringLiteral("formLayout_5")); + irc_bot_label = new QLabel(irc_tab); + irc_bot_label->setObjectName(QStringLiteral("irc_bot_label")); - gridLayout->addWidget(r_to_label, 1, 1, 1, 1); + formLayout_5->setWidget(0, QFormLayout::LabelRole, irc_bot_label); - rfrom = new QSpinBox(centralWidget); - rfrom->setObjectName(QStringLiteral("rfrom")); - rfrom->setMaximum(255); + irc_server_label = new QLabel(irc_tab); + irc_server_label->setObjectName(QStringLiteral("irc_server_label")); - gridLayout->addWidget(rfrom, 1, 0, 1, 1); + formLayout_5->setWidget(2, QFormLayout::LabelRole, irc_server_label); - g_to_label = new QLabel(centralWidget); - g_to_label->setObjectName(QStringLiteral("g_to_label")); + irc_server_input = new QLineEdit(irc_tab); + irc_server_input->setObjectName(QStringLiteral("irc_server_input")); - gridLayout->addWidget(g_to_label, 3, 1, 1, 1); + formLayout_5->setWidget(5, QFormLayout::LabelRole, irc_server_input); - bto = new QSpinBox(centralWidget); - bto->setObjectName(QStringLiteral("bto")); - bto->setMaximum(255); + irc_bot_spinbox = new QSpinBox(irc_tab); + irc_bot_spinbox->setObjectName(QStringLiteral("irc_bot_spinbox")); + irc_bot_spinbox->setMaximumSize(QSize(50, 16777215)); + irc_bot_spinbox->setMaximum(99999); + irc_bot_spinbox->setValue(6667); - gridLayout->addWidget(bto, 4, 2, 1, 1); + formLayout_5->setWidget(5, QFormLayout::FieldRole, irc_bot_spinbox); - gto = new QSpinBox(centralWidget); - gto->setObjectName(QStringLiteral("gto")); - gto->setMaximum(255); + irc_channel_label = new QLabel(irc_tab); + irc_channel_label->setObjectName(QStringLiteral("irc_channel_label")); - gridLayout->addWidget(gto, 3, 2, 1, 1); + formLayout_5->setWidget(6, QFormLayout::LabelRole, irc_channel_label); - green_fade_button = new QPushButton(centralWidget); - green_fade_button->setObjectName(QStringLiteral("green_fade_button")); + irc_channel_input = new QLineEdit(irc_tab); + irc_channel_input->setObjectName(QStringLiteral("irc_channel_input")); - gridLayout->addWidget(green_fade_button, 3, 3, 1, 1); + formLayout_5->setWidget(7, QFormLayout::LabelRole, irc_channel_input); - red_fade_button = new QPushButton(centralWidget); - red_fade_button->setObjectName(QStringLiteral("red_fade_button")); + irc_name_label = new QLabel(irc_tab); + irc_name_label->setObjectName(QStringLiteral("irc_name_label")); - gridLayout->addWidget(red_fade_button, 1, 3, 1, 1); + formLayout_5->setWidget(8, QFormLayout::LabelRole, irc_name_label); - _to_label = new QLabel(centralWidget); - _to_label->setObjectName(QStringLiteral("_to_label")); + irc_name_input = new QLineEdit(irc_tab); + irc_name_input->setObjectName(QStringLiteral("irc_name_input")); - gridLayout->addWidget(_to_label, 4, 1, 1, 1); + formLayout_5->setWidget(9, QFormLayout::LabelRole, irc_name_input); - fade_label = new QLabel(centralWidget); - fade_label->setObjectName(QStringLiteral("fade_label")); + irc_port_label = new QLabel(irc_tab); + irc_port_label->setObjectName(QStringLiteral("irc_port_label")); - gridLayout->addWidget(fade_label, 0, 0, 1, 1); + formLayout_5->setWidget(2, QFormLayout::FieldRole, irc_port_label); + irc_connect_button = new QPushButton(irc_tab); + irc_connect_button->setObjectName(QStringLiteral("irc_connect_button")); - gridLayout_2->addLayout(gridLayout, 14, 0, 1, 2); + formLayout_5->setWidget(10, QFormLayout::LabelRole, irc_connect_button); - arduino_port_label = new QLabel(centralWidget); - arduino_port_label->setObjectName(QStringLiteral("arduino_port_label")); - arduino_port_label->setMinimumSize(QSize(120, 0)); + display_tab->addTab(irc_tab, QString()); + server_tab = new QWidget(); + server_tab->setObjectName(QStringLiteral("server_tab")); + gridLayout_6 = new QGridLayout(server_tab); + gridLayout_6->setSpacing(6); + gridLayout_6->setContentsMargins(11, 11, 11, 11); + gridLayout_6->setObjectName(QStringLiteral("gridLayout_6")); + server_tab_layout = new QFormLayout(); + server_tab_layout->setSpacing(6); + server_tab_layout->setObjectName(QStringLiteral("server_tab_layout")); + server_start_button = new QPushButton(server_tab); + server_start_button->setObjectName(QStringLiteral("server_start_button")); - gridLayout_2->addWidget(arduino_port_label, 1, 0, 1, 1); + server_tab_layout->setWidget(0, QFormLayout::LabelRole, server_start_button); - b_speed_label = new QLabel(centralWidget); - b_speed_label->setObjectName(QStringLiteral("b_speed_label")); - gridLayout_2->addWidget(b_speed_label, 17, 1, 1, 1); + gridLayout_6->addLayout(server_tab_layout, 0, 0, 1, 1); - speed_button = new QPushButton(centralWidget); - speed_button->setObjectName(QStringLiteral("speed_button")); + display_tab->addTab(server_tab, QString()); + log_tab = new QWidget(); + log_tab->setObjectName(QStringLiteral("log_tab")); + gridLayout_3 = new QGridLayout(log_tab); + gridLayout_3->setSpacing(6); + gridLayout_3->setContentsMargins(11, 11, 11, 11); + gridLayout_3->setObjectName(QStringLiteral("gridLayout_3")); + serial_input = new QLineEdit(log_tab); + serial_input->setObjectName(QStringLiteral("serial_input")); - gridLayout_2->addWidget(speed_button, 18, 1, 1, 1); + gridLayout_3->addWidget(serial_input, 5, 0, 1, 1); - speed_slider = new QSlider(centralWidget); - speed_slider->setObjectName(QStringLiteral("speed_slider")); - speed_slider->setMinimum(10); - speed_slider->setMaximum(500); - speed_slider->setOrientation(Qt::Horizontal); + serial_send_button = new QPushButton(log_tab); + serial_send_button->setObjectName(QStringLiteral("serial_send_button")); + + gridLayout_3->addWidget(serial_send_button, 5, 1, 1, 1); + + info_log_textarea = new QTextEdit(log_tab); + info_log_textarea->setObjectName(QStringLiteral("info_log_textarea")); + + gridLayout_3->addWidget(info_log_textarea, 4, 0, 1, 2); + + info_log_label = new QLabel(log_tab); + info_log_label->setObjectName(QStringLiteral("info_log_label")); + + gridLayout_3->addWidget(info_log_label, 0, 0, 1, 1); + + ping_count_label = new QLabel(log_tab); + ping_count_label->setObjectName(QStringLiteral("ping_count_label")); + + gridLayout_3->addWidget(ping_count_label, 0, 1, 1, 1); - gridLayout_2->addWidget(speed_slider, 18, 0, 1, 1); + display_tab->addTab(log_tab, QString()); + + gridLayout_2->addWidget(display_tab, 7, 1, 1, 1); controllerWindow->setCentralWidget(centralWidget); retranslateUi(controllerWindow); + display_tab->setCurrentIndex(5); + + QMetaObject::connectSlotsByName(controllerWindow); } // setupUi void retranslateUi(QMainWindow *controllerWindow) { controllerWindow->setWindowTitle(QApplication::translate("controllerWindow", "RGB Controller", Q_NULLPTR)); - reload_preset_button->setText(QApplication::translate("controllerWindow", "Reload", Q_NULLPTR)); - off_button->setText(QApplication::translate("controllerWindow", "Off", Q_NULLPTR)); - preset_delete_button->setText(QApplication::translate("controllerWindow", "Delete", Q_NULLPTR)); - presets_label->setText(QApplication::translate("controllerWindow", "Presets", Q_NULLPTR)); - disconnect_button->setText(QApplication::translate("controllerWindow", "Disconnect", Q_NULLPTR)); - arduino_status_label->setText(QApplication::translate("controllerWindow", "Disconnected", Q_NULLPTR)); - info_log_label->setText(QApplication::translate("controllerWindow", "Information log", Q_NULLPTR)); - green_button->setText(QApplication::translate("controllerWindow", "Green", Q_NULLPTR)); + arduino_port_label->setText(QApplication::translate("controllerWindow", "Arduino port", Q_NULLPTR)); refresh_port_button->setText(QApplication::translate("controllerWindow", "Refresh", Q_NULLPTR)); - rgb_label->setText(QApplication::translate("controllerWindow", "RGB colors", Q_NULLPTR)); status_label->setText(QApplication::translate("controllerWindow", "Status", Q_NULLPTR)); - preset_save_button->setText(QApplication::translate("controllerWindow", "Save", Q_NULLPTR)); - g_speed_label->setText(QApplication::translate("controllerWindow", "Green speed", Q_NULLPTR)); + arduino_status_label->setText(QApplication::translate("controllerWindow", "Disconnected", Q_NULLPTR)); + disconnect_button->setText(QApplication::translate("controllerWindow", "Disconnect", Q_NULLPTR)); + connect_button->setText(QApplication::translate("controllerWindow", "Connect", Q_NULLPTR)); + display_tab->setTabText(display_tab->indexOf(status_tab), QApplication::translate("controllerWindow", "Status", Q_NULLPTR)); + rgb_label->setText(QApplication::translate("controllerWindow", "RGB colors", Q_NULLPTR)); red_button->setText(QApplication::translate("controllerWindow", "Red", Q_NULLPTR)); + green_button->setText(QApplication::translate("controllerWindow", "Green", Q_NULLPTR)); blue_button->setText(QApplication::translate("controllerWindow", "Blue", Q_NULLPTR)); - connect_button->setText(QApplication::translate("controllerWindow", "Connect", Q_NULLPTR)); - r_speed_label->setText(QApplication::translate("controllerWindow", "Red speed", Q_NULLPTR)); - set_preset_button->setText(QApplication::translate("controllerWindow", "Set", Q_NULLPTR)); + off_button->setText(QApplication::translate("controllerWindow", "Off", Q_NULLPTR)); + display_tab->setTabText(display_tab->indexOf(color_tab), QApplication::translate("controllerWindow", "Color", Q_NULLPTR)); blue_fade_button->setText(QApplication::translate("controllerWindow", "Blue toggle", Q_NULLPTR)); - r_to_label->setText(QApplication::translate("controllerWindow", "to", Q_NULLPTR)); g_to_label->setText(QApplication::translate("controllerWindow", "to", Q_NULLPTR)); + r_to_label->setText(QApplication::translate("controllerWindow", "to", Q_NULLPTR)); green_fade_button->setText(QApplication::translate("controllerWindow", "Green toggle", Q_NULLPTR)); red_fade_button->setText(QApplication::translate("controllerWindow", "Red toggle", Q_NULLPTR)); _to_label->setText(QApplication::translate("controllerWindow", "to", Q_NULLPTR)); fade_label->setText(QApplication::translate("controllerWindow", "Fade", Q_NULLPTR)); - arduino_port_label->setText(QApplication::translate("controllerWindow", "Arduino port", Q_NULLPTR)); + r_speed_label->setText(QApplication::translate("controllerWindow", "Red speed", Q_NULLPTR)); + g_speed_label->setText(QApplication::translate("controllerWindow", "Green speed", Q_NULLPTR)); b_speed_label->setText(QApplication::translate("controllerWindow", "Blue speed", Q_NULLPTR)); speed_button->setText(QApplication::translate("controllerWindow", "Speed", Q_NULLPTR)); + display_tab->setTabText(display_tab->indexOf(fade_tab), QApplication::translate("controllerWindow", "Fade", Q_NULLPTR)); + presets_label->setText(QApplication::translate("controllerWindow", "Presets", Q_NULLPTR)); + set_preset_button->setText(QApplication::translate("controllerWindow", "Set", Q_NULLPTR)); + reload_preset_button->setText(QApplication::translate("controllerWindow", "Reload", Q_NULLPTR)); + preset_save_button->setText(QApplication::translate("controllerWindow", "Save", Q_NULLPTR)); + preset_delete_button->setText(QApplication::translate("controllerWindow", "Delete", Q_NULLPTR)); + display_tab->setTabText(display_tab->indexOf(presets_tab), QApplication::translate("controllerWindow", "Presets", Q_NULLPTR)); + irc_bot_label->setText(QApplication::translate("controllerWindow", "IRC bot", Q_NULLPTR)); + irc_server_label->setText(QApplication::translate("controllerWindow", "Server", Q_NULLPTR)); + irc_server_input->setText(QApplication::translate("controllerWindow", "irc.danieljon.es", Q_NULLPTR)); + irc_channel_label->setText(QApplication::translate("controllerWindow", "Channel", Q_NULLPTR)); + irc_channel_input->setText(QApplication::translate("controllerWindow", "#csgo", Q_NULLPTR)); + irc_name_label->setText(QApplication::translate("controllerWindow", "Name", Q_NULLPTR)); + irc_name_input->setText(QApplication::translate("controllerWindow", "LightBot", Q_NULLPTR)); + irc_port_label->setText(QApplication::translate("controllerWindow", "Port", Q_NULLPTR)); + irc_connect_button->setText(QApplication::translate("controllerWindow", "Connect", Q_NULLPTR)); + display_tab->setTabText(display_tab->indexOf(irc_tab), QApplication::translate("controllerWindow", "IRC", Q_NULLPTR)); + server_start_button->setText(QApplication::translate("controllerWindow", "Start server", Q_NULLPTR)); + display_tab->setTabText(display_tab->indexOf(server_tab), QApplication::translate("controllerWindow", "Server", Q_NULLPTR)); + serial_send_button->setText(QApplication::translate("controllerWindow", "Send", Q_NULLPTR)); + info_log_label->setText(QApplication::translate("controllerWindow", "Information log", Q_NULLPTR)); + ping_count_label->setText(QApplication::translate("controllerWindow", "Ping", Q_NULLPTR)); + display_tab->setTabText(display_tab->indexOf(log_tab), QApplication::translate("controllerWindow", "Log", Q_NULLPTR)); } // retranslateUi }; diff --git a/qt/ircbot/.qmake.stash b/qt/ircbot/.qmake.stash new file mode 100644 index 0000000..39abb16 --- /dev/null +++ b/qt/ircbot/.qmake.stash @@ -0,0 +1,12 @@ +QMAKE_DEFAULT_INCDIRS = \ + /usr/include/c++/6.3.1 \ + /usr/include/c++/6.3.1/x86_64-pc-linux-gnu \ + /usr/include/c++/6.3.1/backward \ + /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/include \ + /usr/local/include \ + /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/include-fixed \ + /usr/include +QMAKE_DEFAULT_LIBDIRS = \ + /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1 \ + /usr/lib \ + /lib diff --git a/qt/ircbot/Makefile b/qt/ircbot/Makefile new file mode 100644 index 0000000..42c2015 --- /dev/null +++ b/qt/ircbot/Makefile @@ -0,0 +1,825 @@ +############################################################################# +# Makefile for building: qtbot +# Generated by qmake (3.1) (Qt 5.8.0) +# Project: qtbot.pro +# Template: app +# Command: /usr/bin/qmake -o Makefile qtbot.pro +############################################################################# + +MAKEFILE = Makefile + +####### Compiler, tools and options + +CC = gcc +CXX = g++ +DEFINES = -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_NETWORK_LIB -DQT_SERIALPORT_LIB -DQT_CORE_LIB +CFLAGS = -pipe -O2 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -Wall -W -D_REENTRANT -fPIC $(DEFINES) +CXXFLAGS = -pipe -O2 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -std=gnu++11 -Wall -W -D_REENTRANT -fPIC $(DEFINES) +INCPATH = -I. -isystem /usr/include/qt -isystem /usr/include/qt/QtNetwork -isystem /usr/include/qt/QtSerialPort -isystem /usr/include/qt/QtCore -I. -I/usr/lib/qt/mkspecs/linux-g++ +QMAKE = /usr/bin/qmake +DEL_FILE = rm -f +CHK_DIR_EXISTS= test -d +MKDIR = mkdir -p +COPY = cp -f +COPY_FILE = cp -f +COPY_DIR = cp -f -R +INSTALL_FILE = install -m 644 -p +INSTALL_PROGRAM = install -m 755 -p +INSTALL_DIR = cp -f -R +DEL_FILE = rm -f +SYMLINK = ln -f -s +DEL_DIR = rmdir +MOVE = mv -f +TAR = tar -cf +COMPRESS = gzip -9f +DISTNAME = qtbot1.0.0 +DISTDIR = /home/daniel_j/documents/school/2016\ research\ project/RGBController/qt/ircbot/.tmp/qtbot1.0.0 +LINK = g++ +LFLAGS = -Wl,-O1 -Wl,-O1,--sort-common,--as-needed,-z,relro +LIBS = $(SUBLIBS) -lQt5Network -lQt5SerialPort -lQt5Core -lpthread +AR = ar cqs +RANLIB = +SED = sed +STRIP = strip + +####### Output directory + +OBJECTS_DIR = ./ + +####### Files + +SOURCES = main.cpp \ + qtbot.cpp moc_qtbot.cpp +OBJECTS = main.o \ + qtbot.o \ + moc_qtbot.o +DIST = /usr/lib/qt/mkspecs/features/spec_pre.prf \ + /usr/lib/qt/mkspecs/common/unix.conf \ + /usr/lib/qt/mkspecs/common/linux.conf \ + /usr/lib/qt/mkspecs/common/sanitize.conf \ + /usr/lib/qt/mkspecs/common/gcc-base.conf \ + /usr/lib/qt/mkspecs/common/gcc-base-unix.conf \ + /usr/lib/qt/mkspecs/common/g++-base.conf \ + /usr/lib/qt/mkspecs/common/g++-unix.conf \ + /usr/lib/qt/mkspecs/qconfig.pri \ + /usr/lib/qt/mkspecs/modules/qt_Attica.pri \ + /usr/lib/qt/mkspecs/modules/qt_KArchive.pri \ + /usr/lib/qt/mkspecs/modules/qt_KAuth.pri \ + /usr/lib/qt/mkspecs/modules/qt_KBookmarks.pri \ + /usr/lib/qt/mkspecs/modules/qt_KCodecs.pri \ + /usr/lib/qt/mkspecs/modules/qt_KCompletion.pri \ + /usr/lib/qt/mkspecs/modules/qt_KConfigCore.pri \ + /usr/lib/qt/mkspecs/modules/qt_KConfigGui.pri \ + /usr/lib/qt/mkspecs/modules/qt_KConfigWidgets.pri \ + /usr/lib/qt/mkspecs/modules/qt_KCoreAddons.pri \ + /usr/lib/qt/mkspecs/modules/qt_KCrash.pri \ + /usr/lib/qt/mkspecs/modules/qt_KDBusAddons.pri \ + /usr/lib/qt/mkspecs/modules/qt_KDEWebKit.pri \ + /usr/lib/qt/mkspecs/modules/qt_KEmoticons.pri \ + /usr/lib/qt/mkspecs/modules/qt_KGlobalAccel.pri \ + /usr/lib/qt/mkspecs/modules/qt_KGuiAddons.pri \ + /usr/lib/qt/mkspecs/modules/qt_KI18n.pri \ + /usr/lib/qt/mkspecs/modules/qt_KIconThemes.pri \ + /usr/lib/qt/mkspecs/modules/qt_KIOCore.pri \ + /usr/lib/qt/mkspecs/modules/qt_KIOFileWidgets.pri \ + /usr/lib/qt/mkspecs/modules/qt_KIOGui.pri \ + /usr/lib/qt/mkspecs/modules/qt_KIOWidgets.pri \ + /usr/lib/qt/mkspecs/modules/qt_KItemModels.pri \ + /usr/lib/qt/mkspecs/modules/qt_KItemViews.pri \ + /usr/lib/qt/mkspecs/modules/qt_KJobWidgets.pri \ + /usr/lib/qt/mkspecs/modules/qt_KNewStuff.pri \ + /usr/lib/qt/mkspecs/modules/qt_KNewStuffCore.pri \ + /usr/lib/qt/mkspecs/modules/qt_KNotifications.pri \ + /usr/lib/qt/mkspecs/modules/qt_KNotifyConfig.pri \ + /usr/lib/qt/mkspecs/modules/qt_KNTLM.pri \ + /usr/lib/qt/mkspecs/modules/qt_KParts.pri \ + /usr/lib/qt/mkspecs/modules/qt_KPlotting.pri \ + /usr/lib/qt/mkspecs/modules/qt_KPty.pri \ + /usr/lib/qt/mkspecs/modules/qt_KService.pri \ + /usr/lib/qt/mkspecs/modules/qt_KTextWidgets.pri \ + /usr/lib/qt/mkspecs/modules/qt_KUnitConversion.pri \ + /usr/lib/qt/mkspecs/modules/qt_KWallet.pri \ + /usr/lib/qt/mkspecs/modules/qt_KWidgetsAddons.pri \ + /usr/lib/qt/mkspecs/modules/qt_KWindowSystem.pri \ + /usr/lib/qt/mkspecs/modules/qt_KXmlGui.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3dcore.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3dcore_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3dextras.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3dextras_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3dinput.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3dinput_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3dlogic.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3dlogic_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3dquick.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3dquick_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3dquickextras.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3dquickextras_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3dquickinput.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3dquickinput_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3dquickrender.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3dquickrender_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3drender.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3drender_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_accessibility_support_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_bluetooth.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_bluetooth_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_bootstrap_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_charts.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_charts_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_clucene_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_concurrent.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_concurrent_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_core.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_core_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_datavisualization.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_datavisualization_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_dbus.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_dbus_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_designer.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_designer_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_designercomponents_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_devicediscovery_support_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_egl_support_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_eglfs_kms_support_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_eglfsdeviceintegration_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_enginio.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_enginio_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_eventdispatcher_support_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_fb_support_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_fontdatabase_support_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_gamepad.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_gamepad_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_glx_support_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_gui.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_gui_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_help.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_help_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_input_support_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_linuxaccessibility_support_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_location.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_location_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_multimedia.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_multimedia_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_multimediawidgets.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_multimediawidgets_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_network.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_network_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_networkauth.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_networkauth_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_nfc.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_nfc_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_opengl.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_opengl_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_openglextensions.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_openglextensions_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_packetprotocol_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_platformcompositor_support_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_positioning.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_positioning_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_printsupport.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_printsupport_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_qml.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_qml_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_qmldebug_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_qmldevtools_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_qmltest.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_qmltest_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_qtmultimediaquicktools_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_quick.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_quick_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_quickcontrols2.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_quickcontrols2_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_quickparticles_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_quicktemplates2_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_quickwidgets.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_quickwidgets_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_script.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_script_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_scripttools.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_scripttools_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_scxml.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_scxml_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_sensors.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_sensors_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_serialbus.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_serialbus_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_serialport.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_serialport_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_service_support_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_sql.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_sql_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_svg.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_svg_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_testlib.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_testlib_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_texttospeech.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_texttospeech_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_theme_support_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_uiplugin.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_uitools.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_uitools_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_waylandclient.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_waylandclient_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_waylandcompositor.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_waylandcompositor_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_webchannel.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_webchannel_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_webengine.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_webengine_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_webenginecore.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_webenginecore_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_webenginecoreheaders_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_webenginewidgets.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_webenginewidgets_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_webkit.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_webkit_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_webkitwidgets.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_webkitwidgets_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_websockets.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_websockets_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_webview.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_webview_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_widgets.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_widgets_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_x11extras.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_x11extras_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_xml.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_xml_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_xmlpatterns.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_xmlpatterns_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_phonon4qt5.pri \ + /usr/lib/qt/mkspecs/modules/qt_QGpgme.pri \ + /usr/lib/qt/mkspecs/modules/qt_Solid.pri \ + /usr/lib/qt/mkspecs/modules/qt_SonnetCore.pri \ + /usr/lib/qt/mkspecs/modules/qt_SonnetUi.pri \ + /usr/lib/qt/mkspecs/features/qt_functions.prf \ + /usr/lib/qt/mkspecs/features/qt_config.prf \ + /usr/lib/qt/mkspecs/linux-g++/qmake.conf \ + /usr/lib/qt/mkspecs/features/spec_post.prf \ + .qmake.stash \ + /usr/lib/qt/mkspecs/features/exclusive_builds.prf \ + /usr/lib/qt/mkspecs/features/toolchain.prf \ + /usr/lib/qt/mkspecs/features/default_pre.prf \ + /usr/lib/qt/mkspecs/features/resolve_config.prf \ + /usr/lib/qt/mkspecs/features/default_post.prf \ + /usr/lib/qt/mkspecs/features/warn_on.prf \ + /usr/lib/qt/mkspecs/features/qt.prf \ + /usr/lib/qt/mkspecs/features/resources.prf \ + /usr/lib/qt/mkspecs/features/moc.prf \ + /usr/lib/qt/mkspecs/features/unix/thread.prf \ + /usr/lib/qt/mkspecs/features/qmake_use.prf \ + /usr/lib/qt/mkspecs/features/file_copies.prf \ + /usr/lib/qt/mkspecs/features/testcase_targets.prf \ + /usr/lib/qt/mkspecs/features/exceptions.prf \ + /usr/lib/qt/mkspecs/features/yacc.prf \ + /usr/lib/qt/mkspecs/features/lex.prf \ + qtbot.pro qtbot.h main.cpp \ + qtbot.cpp +QMAKE_TARGET = qtbot +DESTDIR = +TARGET = qtbot + + +first: all +####### Build rules + +$(TARGET): $(OBJECTS) + $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) + +Makefile: qtbot.pro /usr/lib/qt/mkspecs/linux-g++/qmake.conf /usr/lib/qt/mkspecs/features/spec_pre.prf \ + /usr/lib/qt/mkspecs/common/unix.conf \ + /usr/lib/qt/mkspecs/common/linux.conf \ + /usr/lib/qt/mkspecs/common/sanitize.conf \ + /usr/lib/qt/mkspecs/common/gcc-base.conf \ + /usr/lib/qt/mkspecs/common/gcc-base-unix.conf \ + /usr/lib/qt/mkspecs/common/g++-base.conf \ + /usr/lib/qt/mkspecs/common/g++-unix.conf \ + /usr/lib/qt/mkspecs/qconfig.pri \ + /usr/lib/qt/mkspecs/modules/qt_Attica.pri \ + /usr/lib/qt/mkspecs/modules/qt_KArchive.pri \ + /usr/lib/qt/mkspecs/modules/qt_KAuth.pri \ + /usr/lib/qt/mkspecs/modules/qt_KBookmarks.pri \ + /usr/lib/qt/mkspecs/modules/qt_KCodecs.pri \ + /usr/lib/qt/mkspecs/modules/qt_KCompletion.pri \ + /usr/lib/qt/mkspecs/modules/qt_KConfigCore.pri \ + /usr/lib/qt/mkspecs/modules/qt_KConfigGui.pri \ + /usr/lib/qt/mkspecs/modules/qt_KConfigWidgets.pri \ + /usr/lib/qt/mkspecs/modules/qt_KCoreAddons.pri \ + /usr/lib/qt/mkspecs/modules/qt_KCrash.pri \ + /usr/lib/qt/mkspecs/modules/qt_KDBusAddons.pri \ + /usr/lib/qt/mkspecs/modules/qt_KDEWebKit.pri \ + /usr/lib/qt/mkspecs/modules/qt_KEmoticons.pri \ + /usr/lib/qt/mkspecs/modules/qt_KGlobalAccel.pri \ + /usr/lib/qt/mkspecs/modules/qt_KGuiAddons.pri \ + /usr/lib/qt/mkspecs/modules/qt_KI18n.pri \ + /usr/lib/qt/mkspecs/modules/qt_KIconThemes.pri \ + /usr/lib/qt/mkspecs/modules/qt_KIOCore.pri \ + /usr/lib/qt/mkspecs/modules/qt_KIOFileWidgets.pri \ + /usr/lib/qt/mkspecs/modules/qt_KIOGui.pri \ + /usr/lib/qt/mkspecs/modules/qt_KIOWidgets.pri \ + /usr/lib/qt/mkspecs/modules/qt_KItemModels.pri \ + /usr/lib/qt/mkspecs/modules/qt_KItemViews.pri \ + /usr/lib/qt/mkspecs/modules/qt_KJobWidgets.pri \ + /usr/lib/qt/mkspecs/modules/qt_KNewStuff.pri \ + /usr/lib/qt/mkspecs/modules/qt_KNewStuffCore.pri \ + /usr/lib/qt/mkspecs/modules/qt_KNotifications.pri \ + /usr/lib/qt/mkspecs/modules/qt_KNotifyConfig.pri \ + /usr/lib/qt/mkspecs/modules/qt_KNTLM.pri \ + /usr/lib/qt/mkspecs/modules/qt_KParts.pri \ + /usr/lib/qt/mkspecs/modules/qt_KPlotting.pri \ + /usr/lib/qt/mkspecs/modules/qt_KPty.pri \ + /usr/lib/qt/mkspecs/modules/qt_KService.pri \ + /usr/lib/qt/mkspecs/modules/qt_KTextWidgets.pri \ + /usr/lib/qt/mkspecs/modules/qt_KUnitConversion.pri \ + /usr/lib/qt/mkspecs/modules/qt_KWallet.pri \ + /usr/lib/qt/mkspecs/modules/qt_KWidgetsAddons.pri \ + /usr/lib/qt/mkspecs/modules/qt_KWindowSystem.pri \ + /usr/lib/qt/mkspecs/modules/qt_KXmlGui.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3dcore.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3dcore_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3dextras.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3dextras_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3dinput.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3dinput_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3dlogic.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3dlogic_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3dquick.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3dquick_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3dquickextras.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3dquickextras_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3dquickinput.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3dquickinput_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3dquickrender.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3dquickrender_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3drender.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_3drender_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_accessibility_support_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_bluetooth.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_bluetooth_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_bootstrap_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_charts.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_charts_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_clucene_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_concurrent.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_concurrent_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_core.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_core_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_datavisualization.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_datavisualization_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_dbus.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_dbus_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_designer.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_designer_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_designercomponents_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_devicediscovery_support_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_egl_support_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_eglfs_kms_support_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_eglfsdeviceintegration_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_enginio.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_enginio_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_eventdispatcher_support_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_fb_support_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_fontdatabase_support_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_gamepad.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_gamepad_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_glx_support_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_gui.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_gui_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_help.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_help_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_input_support_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_linuxaccessibility_support_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_location.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_location_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_multimedia.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_multimedia_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_multimediawidgets.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_multimediawidgets_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_network.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_network_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_networkauth.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_networkauth_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_nfc.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_nfc_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_opengl.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_opengl_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_openglextensions.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_openglextensions_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_packetprotocol_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_platformcompositor_support_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_positioning.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_positioning_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_printsupport.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_printsupport_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_qml.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_qml_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_qmldebug_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_qmldevtools_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_qmltest.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_qmltest_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_qtmultimediaquicktools_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_quick.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_quick_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_quickcontrols2.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_quickcontrols2_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_quickparticles_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_quicktemplates2_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_quickwidgets.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_quickwidgets_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_script.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_script_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_scripttools.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_scripttools_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_scxml.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_scxml_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_sensors.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_sensors_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_serialbus.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_serialbus_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_serialport.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_serialport_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_service_support_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_sql.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_sql_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_svg.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_svg_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_testlib.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_testlib_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_texttospeech.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_texttospeech_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_theme_support_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_uiplugin.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_uitools.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_uitools_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_waylandclient.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_waylandclient_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_waylandcompositor.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_waylandcompositor_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_webchannel.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_webchannel_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_webengine.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_webengine_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_webenginecore.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_webenginecore_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_webenginecoreheaders_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_webenginewidgets.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_webenginewidgets_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_webkit.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_webkit_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_webkitwidgets.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_webkitwidgets_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_websockets.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_websockets_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_webview.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_webview_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_widgets.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_widgets_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_x11extras.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_x11extras_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_xml.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_xml_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_xmlpatterns.pri \ + /usr/lib/qt/mkspecs/modules/qt_lib_xmlpatterns_private.pri \ + /usr/lib/qt/mkspecs/modules/qt_phonon4qt5.pri \ + /usr/lib/qt/mkspecs/modules/qt_QGpgme.pri \ + /usr/lib/qt/mkspecs/modules/qt_Solid.pri \ + /usr/lib/qt/mkspecs/modules/qt_SonnetCore.pri \ + /usr/lib/qt/mkspecs/modules/qt_SonnetUi.pri \ + /usr/lib/qt/mkspecs/features/qt_functions.prf \ + /usr/lib/qt/mkspecs/features/qt_config.prf \ + /usr/lib/qt/mkspecs/linux-g++/qmake.conf \ + /usr/lib/qt/mkspecs/features/spec_post.prf \ + .qmake.stash \ + /usr/lib/qt/mkspecs/features/exclusive_builds.prf \ + /usr/lib/qt/mkspecs/features/toolchain.prf \ + /usr/lib/qt/mkspecs/features/default_pre.prf \ + /usr/lib/qt/mkspecs/features/resolve_config.prf \ + /usr/lib/qt/mkspecs/features/default_post.prf \ + /usr/lib/qt/mkspecs/features/warn_on.prf \ + /usr/lib/qt/mkspecs/features/qt.prf \ + /usr/lib/qt/mkspecs/features/resources.prf \ + /usr/lib/qt/mkspecs/features/moc.prf \ + /usr/lib/qt/mkspecs/features/unix/thread.prf \ + /usr/lib/qt/mkspecs/features/qmake_use.prf \ + /usr/lib/qt/mkspecs/features/file_copies.prf \ + /usr/lib/qt/mkspecs/features/testcase_targets.prf \ + /usr/lib/qt/mkspecs/features/exceptions.prf \ + /usr/lib/qt/mkspecs/features/yacc.prf \ + /usr/lib/qt/mkspecs/features/lex.prf \ + qtbot.pro \ + /usr/lib/libQt5Network.prl \ + /usr/lib/libQt5SerialPort.prl \ + /usr/lib/libQt5Core.prl + $(QMAKE) -o Makefile qtbot.pro +/usr/lib/qt/mkspecs/features/spec_pre.prf: +/usr/lib/qt/mkspecs/common/unix.conf: +/usr/lib/qt/mkspecs/common/linux.conf: +/usr/lib/qt/mkspecs/common/sanitize.conf: +/usr/lib/qt/mkspecs/common/gcc-base.conf: +/usr/lib/qt/mkspecs/common/gcc-base-unix.conf: +/usr/lib/qt/mkspecs/common/g++-base.conf: +/usr/lib/qt/mkspecs/common/g++-unix.conf: +/usr/lib/qt/mkspecs/qconfig.pri: +/usr/lib/qt/mkspecs/modules/qt_Attica.pri: +/usr/lib/qt/mkspecs/modules/qt_KArchive.pri: +/usr/lib/qt/mkspecs/modules/qt_KAuth.pri: +/usr/lib/qt/mkspecs/modules/qt_KBookmarks.pri: +/usr/lib/qt/mkspecs/modules/qt_KCodecs.pri: +/usr/lib/qt/mkspecs/modules/qt_KCompletion.pri: +/usr/lib/qt/mkspecs/modules/qt_KConfigCore.pri: +/usr/lib/qt/mkspecs/modules/qt_KConfigGui.pri: +/usr/lib/qt/mkspecs/modules/qt_KConfigWidgets.pri: +/usr/lib/qt/mkspecs/modules/qt_KCoreAddons.pri: +/usr/lib/qt/mkspecs/modules/qt_KCrash.pri: +/usr/lib/qt/mkspecs/modules/qt_KDBusAddons.pri: +/usr/lib/qt/mkspecs/modules/qt_KDEWebKit.pri: +/usr/lib/qt/mkspecs/modules/qt_KEmoticons.pri: +/usr/lib/qt/mkspecs/modules/qt_KGlobalAccel.pri: +/usr/lib/qt/mkspecs/modules/qt_KGuiAddons.pri: +/usr/lib/qt/mkspecs/modules/qt_KI18n.pri: +/usr/lib/qt/mkspecs/modules/qt_KIconThemes.pri: +/usr/lib/qt/mkspecs/modules/qt_KIOCore.pri: +/usr/lib/qt/mkspecs/modules/qt_KIOFileWidgets.pri: +/usr/lib/qt/mkspecs/modules/qt_KIOGui.pri: +/usr/lib/qt/mkspecs/modules/qt_KIOWidgets.pri: +/usr/lib/qt/mkspecs/modules/qt_KItemModels.pri: +/usr/lib/qt/mkspecs/modules/qt_KItemViews.pri: +/usr/lib/qt/mkspecs/modules/qt_KJobWidgets.pri: +/usr/lib/qt/mkspecs/modules/qt_KNewStuff.pri: +/usr/lib/qt/mkspecs/modules/qt_KNewStuffCore.pri: +/usr/lib/qt/mkspecs/modules/qt_KNotifications.pri: +/usr/lib/qt/mkspecs/modules/qt_KNotifyConfig.pri: +/usr/lib/qt/mkspecs/modules/qt_KNTLM.pri: +/usr/lib/qt/mkspecs/modules/qt_KParts.pri: +/usr/lib/qt/mkspecs/modules/qt_KPlotting.pri: +/usr/lib/qt/mkspecs/modules/qt_KPty.pri: +/usr/lib/qt/mkspecs/modules/qt_KService.pri: +/usr/lib/qt/mkspecs/modules/qt_KTextWidgets.pri: +/usr/lib/qt/mkspecs/modules/qt_KUnitConversion.pri: +/usr/lib/qt/mkspecs/modules/qt_KWallet.pri: +/usr/lib/qt/mkspecs/modules/qt_KWidgetsAddons.pri: +/usr/lib/qt/mkspecs/modules/qt_KWindowSystem.pri: +/usr/lib/qt/mkspecs/modules/qt_KXmlGui.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_3dcore.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_3dcore_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_3dextras.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_3dextras_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_3dinput.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_3dinput_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_3dlogic.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_3dlogic_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_3dquick.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_3dquick_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_3dquickextras.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_3dquickextras_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_3dquickinput.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_3dquickinput_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_3dquickrender.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_3dquickrender_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_3drender.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_3drender_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_accessibility_support_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_bluetooth.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_bluetooth_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_bootstrap_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_charts.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_charts_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_clucene_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_concurrent.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_concurrent_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_core.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_core_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_datavisualization.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_datavisualization_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_dbus.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_dbus_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_designer.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_designer_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_designercomponents_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_devicediscovery_support_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_egl_support_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_eglfs_kms_support_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_eglfsdeviceintegration_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_enginio.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_enginio_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_eventdispatcher_support_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_fb_support_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_fontdatabase_support_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_gamepad.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_gamepad_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_glx_support_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_gui.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_gui_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_help.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_help_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_input_support_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_linuxaccessibility_support_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_location.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_location_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_multimedia.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_multimedia_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_multimediawidgets.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_multimediawidgets_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_network.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_network_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_networkauth.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_networkauth_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_nfc.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_nfc_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_opengl.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_opengl_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_openglextensions.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_openglextensions_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_packetprotocol_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_platformcompositor_support_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_positioning.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_positioning_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_printsupport.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_printsupport_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_qml.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_qml_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_qmldebug_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_qmldevtools_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_qmltest.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_qmltest_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_qtmultimediaquicktools_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_quick.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_quick_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_quickcontrols2.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_quickcontrols2_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_quickparticles_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_quicktemplates2_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_quickwidgets.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_quickwidgets_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_script.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_script_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_scripttools.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_scripttools_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_scxml.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_scxml_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_sensors.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_sensors_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_serialbus.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_serialbus_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_serialport.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_serialport_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_service_support_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_sql.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_sql_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_svg.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_svg_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_testlib.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_testlib_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_texttospeech.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_texttospeech_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_theme_support_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_uiplugin.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_uitools.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_uitools_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_waylandclient.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_waylandclient_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_waylandcompositor.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_waylandcompositor_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_webchannel.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_webchannel_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_webengine.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_webengine_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_webenginecore.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_webenginecore_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_webenginecoreheaders_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_webenginewidgets.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_webenginewidgets_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_webkit.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_webkit_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_webkitwidgets.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_webkitwidgets_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_websockets.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_websockets_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_webview.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_webview_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_widgets.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_widgets_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_x11extras.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_x11extras_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_xml.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_xml_private.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_xmlpatterns.pri: +/usr/lib/qt/mkspecs/modules/qt_lib_xmlpatterns_private.pri: +/usr/lib/qt/mkspecs/modules/qt_phonon4qt5.pri: +/usr/lib/qt/mkspecs/modules/qt_QGpgme.pri: +/usr/lib/qt/mkspecs/modules/qt_Solid.pri: +/usr/lib/qt/mkspecs/modules/qt_SonnetCore.pri: +/usr/lib/qt/mkspecs/modules/qt_SonnetUi.pri: +/usr/lib/qt/mkspecs/features/qt_functions.prf: +/usr/lib/qt/mkspecs/features/qt_config.prf: +/usr/lib/qt/mkspecs/linux-g++/qmake.conf: +/usr/lib/qt/mkspecs/features/spec_post.prf: +.qmake.stash: +/usr/lib/qt/mkspecs/features/exclusive_builds.prf: +/usr/lib/qt/mkspecs/features/toolchain.prf: +/usr/lib/qt/mkspecs/features/default_pre.prf: +/usr/lib/qt/mkspecs/features/resolve_config.prf: +/usr/lib/qt/mkspecs/features/default_post.prf: +/usr/lib/qt/mkspecs/features/warn_on.prf: +/usr/lib/qt/mkspecs/features/qt.prf: +/usr/lib/qt/mkspecs/features/resources.prf: +/usr/lib/qt/mkspecs/features/moc.prf: +/usr/lib/qt/mkspecs/features/unix/thread.prf: +/usr/lib/qt/mkspecs/features/qmake_use.prf: +/usr/lib/qt/mkspecs/features/file_copies.prf: +/usr/lib/qt/mkspecs/features/testcase_targets.prf: +/usr/lib/qt/mkspecs/features/exceptions.prf: +/usr/lib/qt/mkspecs/features/yacc.prf: +/usr/lib/qt/mkspecs/features/lex.prf: +qtbot.pro: +/usr/lib/libQt5Network.prl: +/usr/lib/libQt5SerialPort.prl: +/usr/lib/libQt5Core.prl: +qmake: FORCE + @$(QMAKE) -o Makefile qtbot.pro + +qmake_all: FORCE + + +all: Makefile $(TARGET) + +dist: distdir FORCE + (cd `dirname $(DISTDIR)` && $(TAR) $(DISTNAME).tar $(DISTNAME) && $(COMPRESS) $(DISTNAME).tar) && $(MOVE) `dirname $(DISTDIR)`/$(DISTNAME).tar.gz . && $(DEL_FILE) -r $(DISTDIR) + +distdir: FORCE + @test -d $(DISTDIR) || mkdir -p $(DISTDIR) + $(COPY_FILE) --parents $(DIST) $(DISTDIR)/ + $(COPY_FILE) --parents /usr/lib/qt/mkspecs/features/data/dummy.cpp $(DISTDIR)/ + $(COPY_FILE) --parents qtbot.h $(DISTDIR)/ + $(COPY_FILE) --parents main.cpp qtbot.cpp $(DISTDIR)/ + + +clean: compiler_clean + -$(DEL_FILE) $(OBJECTS) + -$(DEL_FILE) *~ core *.core + + +distclean: clean + -$(DEL_FILE) $(TARGET) + -$(DEL_FILE) .qmake.stash + -$(DEL_FILE) Makefile + + +####### Sub-libraries + +mocclean: compiler_moc_header_clean compiler_moc_source_clean + +mocables: compiler_moc_header_make_all compiler_moc_source_make_all + +check: first + +benchmark: first + +compiler_rcc_make_all: +compiler_rcc_clean: +compiler_moc_predefs_make_all: moc_predefs.h +compiler_moc_predefs_clean: + -$(DEL_FILE) moc_predefs.h +moc_predefs.h: /usr/lib/qt/mkspecs/features/data/dummy.cpp + g++ -pipe -O2 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -std=gnu++11 -Wall -W -dM -E -o moc_predefs.h /usr/lib/qt/mkspecs/features/data/dummy.cpp + +compiler_moc_header_make_all: moc_qtbot.cpp +compiler_moc_header_clean: + -$(DEL_FILE) moc_qtbot.cpp +moc_qtbot.cpp: qtbot.h \ + moc_predefs.h \ + /usr/bin/moc + /usr/bin/moc $(DEFINES) --include ./moc_predefs.h -I/usr/lib/qt/mkspecs/linux-g++ -I'/home/daniel_j/documents/school/2016 research project/RGBController/qt/ircbot' -I/usr/include/qt -I/usr/include/qt/QtNetwork -I/usr/include/qt/QtSerialPort -I/usr/include/qt/QtCore -I/usr/include/c++/6.3.1 -I/usr/include/c++/6.3.1/x86_64-pc-linux-gnu -I/usr/include/c++/6.3.1/backward -I/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/include -I/usr/local/include -I/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/include-fixed -I/usr/include qtbot.h -o moc_qtbot.cpp + +compiler_moc_source_make_all: +compiler_moc_source_clean: +compiler_yacc_decl_make_all: +compiler_yacc_decl_clean: +compiler_yacc_impl_make_all: +compiler_yacc_impl_clean: +compiler_lex_make_all: +compiler_lex_clean: +compiler_clean: compiler_moc_predefs_clean compiler_moc_header_clean + +####### Compile + +main.o: main.cpp qtbot.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp + +qtbot.o: qtbot.cpp qtbot.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o qtbot.o qtbot.cpp + +moc_qtbot.o: moc_qtbot.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_qtbot.o moc_qtbot.cpp + +####### Install + +install: FORCE + +uninstall: FORCE + +FORCE: + diff --git a/qt/ircbot/main.cpp b/qt/ircbot/main.cpp new file mode 100644 index 0000000..7022866 --- /dev/null +++ b/qt/ircbot/main.cpp @@ -0,0 +1,13 @@ +#include +#include +#include +#include + +int main(int argc, char *argv[]) +{ + QCoreApplication a(argc, argv); + QtBot qtbot; + QObject::connect(&qtbot, SIGNAL(done()), &a, SLOT(quit()), Qt::QueuedConnection); + QTimer::singleShot(0, &qtbot, SLOT(setup())); + return a.exec(); +} diff --git a/qt/ircbot/moc_predefs.h b/qt/ircbot/moc_predefs.h new file mode 100644 index 0000000..6a9590c --- /dev/null +++ b/qt/ircbot/moc_predefs.h @@ -0,0 +1,284 @@ +#define __SSP_STRONG__ 3 +#define __DBL_MIN_EXP__ (-1021) +#define __cpp_attributes 200809 +#define __UINT_LEAST16_MAX__ 0xffff +#define __ATOMIC_ACQUIRE 2 +#define __FLT_MIN__ 1.17549435082228750797e-38F +#define __GCC_IEC_559_COMPLEX 2 +#define __UINT_LEAST8_TYPE__ unsigned char +#define __SIZEOF_FLOAT80__ 16 +#define __INTMAX_C(c) c ## L +#define __CHAR_BIT__ 8 +#define __UINT8_MAX__ 0xff +#define __WINT_MAX__ 0xffffffffU +#define __cpp_static_assert 200410 +#define __ORDER_LITTLE_ENDIAN__ 1234 +#define __SIZE_MAX__ 0xffffffffffffffffUL +#define __WCHAR_MAX__ 0x7fffffff +#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1 +#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1 +#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1 +#define __DBL_DENORM_MIN__ double(4.94065645841246544177e-324L) +#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1 +#define __GCC_ATOMIC_CHAR_LOCK_FREE 2 +#define __GCC_IEC_559 2 +#define __FLT_EVAL_METHOD__ 0 +#define __unix__ 1 +#define __cpp_binary_literals 201304 +#define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 2 +#define __x86_64 1 +#define __cpp_variadic_templates 200704 +#define __UINT_FAST64_MAX__ 0xffffffffffffffffUL +#define __SIG_ATOMIC_TYPE__ int +#define __DBL_MIN_10_EXP__ (-307) +#define __FINITE_MATH_ONLY__ 0 +#define __GNUC_PATCHLEVEL__ 1 +#define __UINT_FAST8_MAX__ 0xff +#define __has_include(STR) __has_include__(STR) +#define __DEC64_MAX_EXP__ 385 +#define __INT8_C(c) c +#define __UINT_LEAST64_MAX__ 0xffffffffffffffffUL +#define __SHRT_MAX__ 0x7fff +#define __LDBL_MAX__ 1.18973149535723176502e+4932L +#define __UINT_LEAST8_MAX__ 0xff +#define __GCC_ATOMIC_BOOL_LOCK_FREE 2 +#define __UINTMAX_TYPE__ long unsigned int +#define __linux 1 +#define __DEC32_EPSILON__ 1E-6DF +#define __OPTIMIZE__ 1 +#define __unix 1 +#define __UINT32_MAX__ 0xffffffffU +#define __GXX_EXPERIMENTAL_CXX0X__ 1 +#define __LDBL_MAX_EXP__ 16384 +#define __WINT_MIN__ 0U +#define __linux__ 1 +#define __SCHAR_MAX__ 0x7f +#define __WCHAR_MIN__ (-__WCHAR_MAX__ - 1) +#define __INT64_C(c) c ## L +#define __DBL_DIG__ 15 +#define __GCC_ATOMIC_POINTER_LOCK_FREE 2 +#define __SIZEOF_INT__ 4 +#define __SIZEOF_POINTER__ 8 +#define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 2 +#define __USER_LABEL_PREFIX__ +#define __STDC_HOSTED__ 1 +#define __LDBL_HAS_INFINITY__ 1 +#define __FLT_EPSILON__ 1.19209289550781250000e-7F +#define __GXX_WEAK__ 1 +#define __LDBL_MIN__ 3.36210314311209350626e-4932L +#define __DEC32_MAX__ 9.999999E96DF +#define __INT32_MAX__ 0x7fffffff +#define __SIZEOF_LONG__ 8 +#define __STDC_IEC_559__ 1 +#define __STDC_ISO_10646__ 201505L +#define __UINT16_C(c) c +#define __DECIMAL_DIG__ 21 +#define __gnu_linux__ 1 +#define __has_include_next(STR) __has_include_next__(STR) +#define __LDBL_HAS_QUIET_NAN__ 1 +#define __GNUC__ 6 +#define __GXX_RTTI 1 +#define __MMX__ 1 +#define __cpp_delegating_constructors 200604 +#define __FLT_HAS_DENORM__ 1 +#define __SIZEOF_LONG_DOUBLE__ 16 +#define __BIGGEST_ALIGNMENT__ 16 +#define __STDC_UTF_16__ 1 +#define __DBL_MAX__ double(1.79769313486231570815e+308L) +#define __cpp_raw_strings 200710 +#define __INT_FAST32_MAX__ 0x7fffffffffffffffL +#define __DBL_HAS_INFINITY__ 1 +#define __INT64_MAX__ 0x7fffffffffffffffL +#define __DEC32_MIN_EXP__ (-94) +#define __INT_FAST16_TYPE__ long int +#define __LDBL_HAS_DENORM__ 1 +#define __cplusplus 201103L +#define __cpp_ref_qualifiers 200710 +#define __DEC128_MAX__ 9.999999999999999999999999999999999E6144DL +#define __INT_LEAST32_MAX__ 0x7fffffff +#define __DEC32_MIN__ 1E-95DF +#define __DEPRECATED 1 +#define __cpp_rvalue_references 200610 +#define __DBL_MAX_EXP__ 1024 +#define __DEC128_EPSILON__ 1E-33DL +#define __SSE2_MATH__ 1 +#define __ATOMIC_HLE_RELEASE 131072 +#define __PTRDIFF_MAX__ 0x7fffffffffffffffL +#define __amd64 1 +#define __STDC_NO_THREADS__ 1 +#define __ATOMIC_HLE_ACQUIRE 65536 +#define __GNUG__ 6 +#define __LONG_LONG_MAX__ 0x7fffffffffffffffLL +#define __SIZEOF_SIZE_T__ 8 +#define __cpp_rvalue_reference 200610 +#define __cpp_nsdmi 200809 +#define __SIZEOF_WINT_T__ 4 +#define __cpp_initializer_lists 200806 +#define __cpp_hex_float 201603 +#define __GCC_HAVE_DWARF2_CFI_ASM 1 +#define __GXX_ABI_VERSION 1010 +#define __FLT_MIN_EXP__ (-125) +#define __cpp_lambdas 200907 +#define __INT_FAST64_TYPE__ long int +#define __DBL_MIN__ double(2.22507385850720138309e-308L) +#define __LP64__ 1 +#define __DECIMAL_BID_FORMAT__ 1 +#define __DEC128_MIN__ 1E-6143DL +#define __REGISTER_PREFIX__ +#define __UINT16_MAX__ 0xffff +#define __DBL_HAS_DENORM__ 1 +#define __UINT8_TYPE__ unsigned char +#define __FLT_MANT_DIG__ 24 +#define __VERSION__ "6.3.1 20170306" +#define __UINT64_C(c) c ## UL +#define __cpp_unicode_characters 200704 +#define _STDC_PREDEF_H 1 +#define __GCC_ATOMIC_INT_LOCK_FREE 2 +#define __FLOAT_WORD_ORDER__ __ORDER_LITTLE_ENDIAN__ +#define __STDC_IEC_559_COMPLEX__ 1 +#define __INT32_C(c) c +#define __DEC64_EPSILON__ 1E-15DD +#define __ORDER_PDP_ENDIAN__ 3412 +#define __DEC128_MIN_EXP__ (-6142) +#define __INT_FAST32_TYPE__ long int +#define __UINT_LEAST16_TYPE__ short unsigned int +#define unix 1 +#define __INT16_MAX__ 0x7fff +#define __cpp_rtti 199711 +#define __SIZE_TYPE__ long unsigned int +#define __UINT64_MAX__ 0xffffffffffffffffUL +#define __INT8_TYPE__ signed char +#define __ELF__ 1 +#define __GCC_ASM_FLAG_OUTPUTS__ 1 +#define __FLT_RADIX__ 2 +#define __INT_LEAST16_TYPE__ short int +#define __LDBL_EPSILON__ 1.08420217248550443401e-19L +#define __UINTMAX_C(c) c ## UL +#define __GLIBCXX_BITSIZE_INT_N_0 128 +#define __k8 1 +#define __SIG_ATOMIC_MAX__ 0x7fffffff +#define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2 +#define __SIZEOF_PTRDIFF_T__ 8 +#define __x86_64__ 1 +#define __DEC32_SUBNORMAL_MIN__ 0.000001E-95DF +#define __INT_FAST16_MAX__ 0x7fffffffffffffffL +#define __UINT_FAST32_MAX__ 0xffffffffffffffffUL +#define __UINT_LEAST64_TYPE__ long unsigned int +#define __FLT_HAS_QUIET_NAN__ 1 +#define __FLT_MAX_10_EXP__ 38 +#define __LONG_MAX__ 0x7fffffffffffffffL +#define __DEC128_SUBNORMAL_MIN__ 0.000000000000000000000000000000001E-6143DL +#define __FLT_HAS_INFINITY__ 1 +#define __cpp_unicode_literals 200710 +#define __UINT_FAST16_TYPE__ long unsigned int +#define __DEC64_MAX__ 9.999999999999999E384DD +#define __CHAR16_TYPE__ short unsigned int +#define __PRAGMA_REDEFINE_EXTNAME 1 +#define __SEG_FS 1 +#define __INT_LEAST16_MAX__ 0x7fff +#define __DEC64_MANT_DIG__ 16 +#define __UINT_LEAST32_MAX__ 0xffffffffU +#define __SEG_GS 1 +#define __GCC_ATOMIC_LONG_LOCK_FREE 2 +#define __INT_LEAST64_TYPE__ long int +#define __INT16_TYPE__ short int +#define __INT_LEAST8_TYPE__ signed char +#define __DEC32_MAX_EXP__ 97 +#define __INT_FAST8_MAX__ 0x7f +#define __INTPTR_MAX__ 0x7fffffffffffffffL +#define linux 1 +#define __cpp_range_based_for 200907 +#define __SSE2__ 1 +#define __EXCEPTIONS 1 +#define __LDBL_MANT_DIG__ 64 +#define __DBL_HAS_QUIET_NAN__ 1 +#define __SIG_ATOMIC_MIN__ (-__SIG_ATOMIC_MAX__ - 1) +#define __code_model_small__ 1 +#define __k8__ 1 +#define __INTPTR_TYPE__ long int +#define __UINT16_TYPE__ short unsigned int +#define __WCHAR_TYPE__ int +#define __SIZEOF_FLOAT__ 4 +#define __UINTPTR_MAX__ 0xffffffffffffffffUL +#define __DEC64_MIN_EXP__ (-382) +#define __cpp_decltype 200707 +#define __INT_FAST64_MAX__ 0x7fffffffffffffffL +#define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1 +#define __FLT_DIG__ 6 +#define __UINT_FAST64_TYPE__ long unsigned int +#define __INT_MAX__ 0x7fffffff +#define __amd64__ 1 +#define __INT64_TYPE__ long int +#define __FLT_MAX_EXP__ 128 +#define __ORDER_BIG_ENDIAN__ 4321 +#define __DBL_MANT_DIG__ 53 +#define __cpp_inheriting_constructors 200802 +#define __SIZEOF_FLOAT128__ 16 +#define __INT_LEAST64_MAX__ 0x7fffffffffffffffL +#define __DEC64_MIN__ 1E-383DD +#define __WINT_TYPE__ unsigned int +#define __UINT_LEAST32_TYPE__ unsigned int +#define __SIZEOF_SHORT__ 2 +#define __SSE__ 1 +#define __LDBL_MIN_EXP__ (-16381) +#define __INT_LEAST8_MAX__ 0x7f +#define __SIZEOF_INT128__ 16 +#define __LDBL_MAX_10_EXP__ 4932 +#define __ATOMIC_RELAXED 0 +#define __DBL_EPSILON__ double(2.22044604925031308085e-16L) +#define _LP64 1 +#define __UINT8_C(c) c +#define __INT_LEAST32_TYPE__ int +#define __SIZEOF_WCHAR_T__ 4 +#define __UINT64_TYPE__ long unsigned int +#define __INT_FAST8_TYPE__ signed char +#define __GNUC_STDC_INLINE__ 1 +#define __DBL_DECIMAL_DIG__ 17 +#define __STDC_UTF_32__ 1 +#define __FXSR__ 1 +#define __DEC_EVAL_METHOD__ 2 +#define __cpp_runtime_arrays 198712 +#define __UINT32_C(c) c ## U +#define __INTMAX_MAX__ 0x7fffffffffffffffL +#define __cpp_alias_templates 200704 +#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ +#define __FLT_DENORM_MIN__ 1.40129846432481707092e-45F +#define __INT8_MAX__ 0x7f +#define __UINT_FAST32_TYPE__ long unsigned int +#define __CHAR32_TYPE__ unsigned int +#define __FLT_MAX__ 3.40282346638528859812e+38F +#define __cpp_constexpr 200704 +#define __INT32_TYPE__ int +#define __SIZEOF_DOUBLE__ 8 +#define __cpp_exceptions 199711 +#define __INTMAX_TYPE__ long int +#define __DEC128_MAX_EXP__ 6145 +#define __ATOMIC_CONSUME 1 +#define __GNUC_MINOR__ 3 +#define __GLIBCXX_TYPE_INT_N_0 __int128 +#define __UINTMAX_MAX__ 0xffffffffffffffffUL +#define __DEC32_MANT_DIG__ 7 +#define __DBL_MAX_10_EXP__ 308 +#define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L +#define __INT16_C(c) c +#define __STDC__ 1 +#define __PTRDIFF_TYPE__ long int +#define __ATOMIC_SEQ_CST 5 +#define __UINT32_TYPE__ unsigned int +#define __UINTPTR_TYPE__ long unsigned int +#define __DEC64_SUBNORMAL_MIN__ 0.000000000000001E-383DD +#define __DEC128_MANT_DIG__ 34 +#define __LDBL_MIN_10_EXP__ (-4931) +#define __SSE_MATH__ 1 +#define __SIZEOF_LONG_LONG__ 8 +#define __cpp_user_defined_literals 200809 +#define __GCC_ATOMIC_LLONG_LOCK_FREE 2 +#define __LDBL_DIG__ 18 +#define __FLT_DECIMAL_DIG__ 9 +#define __UINT_FAST16_MAX__ 0xffffffffffffffffUL +#define __FLT_MIN_10_EXP__ (-37) +#define __GCC_ATOMIC_SHORT_LOCK_FREE 2 +#define __UINT_FAST8_TYPE__ unsigned char +#define _GNU_SOURCE 1 +#define __ATOMIC_ACQ_REL 4 +#define __ATOMIC_RELEASE 3 diff --git a/qt/ircbot/moc_qtbot.cpp b/qt/ircbot/moc_qtbot.cpp new file mode 100644 index 0000000..4eff919 --- /dev/null +++ b/qt/ircbot/moc_qtbot.cpp @@ -0,0 +1,156 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'qtbot.h' +** +** Created by: The Qt Meta Object Compiler version 67 (Qt 5.8.0) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "qtbot.h" +#include +#include +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'qtbot.h' doesn't include ." +#elif Q_MOC_OUTPUT_REVISION != 67 +#error "This file was generated using the moc from 5.8.0. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED +struct qt_meta_stringdata_QtBot_t { + QByteArrayData data[10]; + char stringdata0[52]; +}; +#define QT_MOC_LITERAL(idx, ofs, len) \ + Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ + qptrdiff(offsetof(qt_meta_stringdata_QtBot_t, stringdata0) + ofs \ + - idx * sizeof(QByteArrayData)) \ + ) +static const qt_meta_stringdata_QtBot_t qt_meta_stringdata_QtBot = { + { +QT_MOC_LITERAL(0, 0, 5), // "QtBot" +QT_MOC_LITERAL(1, 6, 4), // "done" +QT_MOC_LITERAL(2, 11, 0), // "" +QT_MOC_LITERAL(3, 12, 4), // "read" +QT_MOC_LITERAL(4, 17, 8), // "bconnect" +QT_MOC_LITERAL(5, 26, 5), // "parse" +QT_MOC_LITERAL(6, 32, 4), // "line" +QT_MOC_LITERAL(7, 37, 4), // "send" +QT_MOC_LITERAL(8, 42, 3), // "com" +QT_MOC_LITERAL(9, 46, 5) // "setup" + + }, + "QtBot\0done\0\0read\0bconnect\0parse\0line\0" + "send\0com\0setup" +}; +#undef QT_MOC_LITERAL + +static const uint qt_meta_data_QtBot[] = { + + // content: + 7, // revision + 0, // classname + 0, 0, // classinfo + 6, 14, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 1, // signalCount + + // signals: name, argc, parameters, tag, flags + 1, 0, 44, 2, 0x06 /* Public */, + + // slots: name, argc, parameters, tag, flags + 3, 0, 45, 2, 0x08 /* Private */, + 4, 0, 46, 2, 0x08 /* Private */, + 5, 1, 47, 2, 0x08 /* Private */, + 7, 1, 50, 2, 0x08 /* Private */, + 9, 0, 53, 2, 0x0a /* Public */, + + // signals: parameters + QMetaType::Void, + + // slots: parameters + QMetaType::Void, + QMetaType::Void, + QMetaType::Void, QMetaType::QString, 6, + QMetaType::Void, QMetaType::QString, 8, + QMetaType::Void, + + 0 // eod +}; + +void QtBot::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) +{ + if (_c == QMetaObject::InvokeMetaMethod) { + QtBot *_t = static_cast(_o); + Q_UNUSED(_t) + switch (_id) { + case 0: _t->done(); break; + case 1: _t->read(); break; + case 2: _t->bconnect(); break; + case 3: _t->parse((*reinterpret_cast< QString(*)>(_a[1]))); break; + case 4: _t->send((*reinterpret_cast< QString(*)>(_a[1]))); break; + case 5: _t->setup(); break; + default: ; + } + } else if (_c == QMetaObject::IndexOfMethod) { + int *result = reinterpret_cast(_a[0]); + void **func = reinterpret_cast(_a[1]); + { + typedef void (QtBot::*_t)(); + if (*reinterpret_cast<_t *>(func) == static_cast<_t>(&QtBot::done)) { + *result = 0; + return; + } + } + } +} + +const QMetaObject QtBot::staticMetaObject = { + { &QObject::staticMetaObject, qt_meta_stringdata_QtBot.data, + qt_meta_data_QtBot, qt_static_metacall, Q_NULLPTR, Q_NULLPTR} +}; + + +const QMetaObject *QtBot::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; +} + +void *QtBot::qt_metacast(const char *_clname) +{ + if (!_clname) return Q_NULLPTR; + if (!strcmp(_clname, qt_meta_stringdata_QtBot.stringdata0)) + return static_cast(const_cast< QtBot*>(this)); + return QObject::qt_metacast(_clname); +} + +int QtBot::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QObject::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + if (_c == QMetaObject::InvokeMetaMethod) { + if (_id < 6) + qt_static_metacall(this, _c, _id, _a); + _id -= 6; + } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { + if (_id < 6) + *reinterpret_cast(_a[0]) = -1; + _id -= 6; + } + return _id; +} + +// SIGNAL 0 +void QtBot::done() +{ + QMetaObject::activate(this, &staticMetaObject, 0, Q_NULLPTR); +} +QT_WARNING_POP +QT_END_MOC_NAMESPACE diff --git a/qt/ircbot/qtbot b/qt/ircbot/qtbot new file mode 100755 index 0000000..72dc64d Binary files /dev/null and b/qt/ircbot/qtbot differ diff --git a/qt/ircbot/qtbot.cpp b/qt/ircbot/qtbot.cpp new file mode 100644 index 0000000..2cb67dd --- /dev/null +++ b/qt/ircbot/qtbot.cpp @@ -0,0 +1,82 @@ +#include "qtbot.h" + +QtBot::QtBot(QObject *parent) : QObject(parent) +{ + +} + +void QtBot::setup() +{ + qDebug() << "setup()"; + /* setup socket, connect signal/slot */ + socket = new QTcpSocket(this); + connect(socket, SIGNAL(readyRead()), this, SLOT(read())); + /* connect */ + bconnect(); + /* serial connect */ + ser = new QSerialPort(this); + ser->setPortName("ttyACM0"); + ser->setBaudRate(QSerialPort::Baud9600); + ser->setDataBits(QSerialPort::Data8); + ser->setParity(QSerialPort::NoParity); + ser->setStopBits(QSerialPort::OneStop); + ser->setFlowControl(QSerialPort::NoFlowControl); + ser->open(QIODevice::ReadWrite); + ser->waitForBytesWritten(9000); + if (ser->isWritable()) + { + qDebug() << "Writable serial"; + } +} + +void QtBot::send(QString com) +{ + data = ""; + qDebug() << "sending" << com; + data.append(com + "\n"); + if (ser->isOpen()) + ser->write(data); +} + +void QtBot::read() +{ + QString line = socket->readLine(); + if (line.contains("PING :")) + { + QString sline = "PONG :" + line.split(":")[1]; + socket->write(sline.toLatin1()); + } + if (line.contains("qtbot MODE qtbot :+")) + { + socket->write("JOIN #bukkake \r\n"); + socket->write("JOIN #fun \r\n"); + } + if (line.contains("!")) + parse(line); + if(socket->canReadLine()) + read(); +} + +void QtBot::bconnect() +{ + socket->connectToHost(server, port); + socket->write("NICK qtbot \r\n"); + socket->write("USER qtbot 8 * :qtbot \r\n"); +} + +void QtBot::parse(QString line) +{ + QString l = line.split(":")[2].remove(QRegExp("[\\n\\t\\r]")); + qDebug() << "parsing: " << l; + if (l.split(" ")[0] == ".command") + { + if (l.split(" ")[1].size() > 2) + { + QString sendl = "PRIVMSG #tests :red set. \r\n"; + QString command = l.split(" ")[1]; + qDebug() << "command is " << command; + send(command); + //socket->write(send.toLocal8Bit()); + } + } +} diff --git a/qt/ircbot/qtbot.h b/qt/ircbot/qtbot.h new file mode 100644 index 0000000..5878def --- /dev/null +++ b/qt/ircbot/qtbot.h @@ -0,0 +1,37 @@ +#ifndef QTBOT_H +#define QTBOT_H + +#include +#include +#include +#include +#include + +class QtBot : public QObject +{ + Q_OBJECT + public: + explicit QtBot(QObject *parent = 0); + QString server = "irc.danieljon.es"; + int port = 6667; + QString name = "RGBBot"; + QSerialPort *ser; + QByteArray data; + QByteArray serdata; + + private: + QTcpSocket *socket; + private slots: + void read(); + void bconnect(); + void parse(QString line); + void send(QString com); + +signals: + void done(); + + public slots: + void setup(); +}; + +#endif // QTBOT_H diff --git a/qt/ircbot/qtbot.pro b/qt/ircbot/qtbot.pro new file mode 100644 index 0000000..1f87c7f --- /dev/null +++ b/qt/ircbot/qtbot.pro @@ -0,0 +1,27 @@ +QT += core network serialport +QT -= gui + +CONFIG += c++11 + +TARGET = qtbot +CONFIG += console +CONFIG -= app_bundle + +TEMPLATE = app + +SOURCES += main.cpp \ + qtbot.cpp + +# The following define makes your compiler emit warnings if you use +# any feature of Qt which as been marked deprecated (the exact warnings +# depend on your compiler). Please consult the documentation of the +# deprecated API in order to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS + +# You can also make your code fail to compile if you use deprecated APIs. +# In order to do so, uncomment the following line. +# You can also select to disable deprecated APIs only up to a certain version of Qt. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +HEADERS += \ + qtbot.h \ diff --git a/qt/ircbot/qtbot.pro.user b/qt/ircbot/qtbot.pro.user new file mode 100644 index 0000000..c51a605 --- /dev/null +++ b/qt/ircbot/qtbot.pro.user @@ -0,0 +1,336 @@ + + + + + + EnvironmentId + {c148e485-3cf0-4847-b5fd-56246b2688e8} + + + 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 + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + + ProjectExplorer.Project.Target.0 + + Desktop + Desktop + {a6071b8b-a567-46c9-babb-33312c5773b5} + 0 + 0 + 0 + + /home/daniel_j/programming/c++/build-qtbot-Desktop-Debug + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + /home/daniel_j/programming/c++/build-qtbot-Desktop-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + /home/daniel_j/programming/c++/build-qtbot-Desktop-Profile + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + true + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 3 + + + 0 + Deploy + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deploy locally + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + false + false + 1000 + + true + + 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 + + qtbot + + Qt4ProjectManager.Qt4RunConfiguration:/home/daniel_j/programming/c++/qtbot/qtbot.pro + true + + qtbot.pro + false + + /home/daniel_j/programming/c++/build-qtbot-Desktop-Debug + 3768 + false + true + false + false + true + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 18 + + + Version + 18 + + diff --git a/web/index.html b/web/index.html new file mode 100644 index 0000000..2d22fb1 --- /dev/null +++ b/web/index.html @@ -0,0 +1,28 @@ + + + RGB Controler + + + +
+ + +
+ diff --git a/web/jscolor.js b/web/jscolor.js new file mode 100644 index 0000000..ebbd047 --- /dev/null +++ b/web/jscolor.js @@ -0,0 +1,1844 @@ +/** + * jscolor - JavaScript Color Picker + * + * @link http://jscolor.com + * @license For open source use: GPLv3 + * For commercial use: JSColor Commercial License + * @author Jan Odvarko + * @version 2.0.4 + * + * See usage examples at http://jscolor.com/examples/ + */ + + +"use strict"; + + +if (!window.jscolor) { window.jscolor = (function () { + + +var jsc = { + + + register : function () { + jsc.attachDOMReadyEvent(jsc.init); + jsc.attachEvent(document, 'mousedown', jsc.onDocumentMouseDown); + jsc.attachEvent(document, 'touchstart', jsc.onDocumentTouchStart); + jsc.attachEvent(window, 'resize', jsc.onWindowResize); + }, + + + init : function () { + if (jsc.jscolor.lookupClass) { + jsc.jscolor.installByClassName(jsc.jscolor.lookupClass); + } + }, + + + tryInstallOnElements : function (elms, className) { + var matchClass = new RegExp('(^|\\s)(' + className + ')(\\s*(\\{[^}]*\\})|\\s|$)', 'i'); + + for (var i = 0; i < elms.length; i += 1) { + if (elms[i].type !== undefined && elms[i].type.toLowerCase() == 'color') { + if (jsc.isColorAttrSupported) { + // skip inputs of type 'color' if supported by the browser + continue; + } + } + var m; + if (!elms[i].jscolor && elms[i].className && (m = elms[i].className.match(matchClass))) { + var targetElm = elms[i]; + var optsStr = null; + + var dataOptions = jsc.getDataAttr(targetElm, 'jscolor'); + if (dataOptions !== null) { + optsStr = dataOptions; + } else if (m[4]) { + optsStr = m[4]; + } + + var opts = {}; + if (optsStr) { + try { + opts = (new Function ('return (' + optsStr + ')'))(); + } catch(eParseError) { + jsc.warn('Error parsing jscolor options: ' + eParseError + ':\n' + optsStr); + } + } + targetElm.jscolor = new jsc.jscolor(targetElm, opts); + } + } + }, + + + isColorAttrSupported : (function () { + var elm = document.createElement('input'); + if (elm.setAttribute) { + elm.setAttribute('type', 'color'); + if (elm.type.toLowerCase() == 'color') { + return true; + } + } + return false; + })(), + + + isCanvasSupported : (function () { + var elm = document.createElement('canvas'); + return !!(elm.getContext && elm.getContext('2d')); + })(), + + + fetchElement : function (mixed) { + return typeof mixed === 'string' ? document.getElementById(mixed) : mixed; + }, + + + isElementType : function (elm, type) { + return elm.nodeName.toLowerCase() === type.toLowerCase(); + }, + + + getDataAttr : function (el, name) { + var attrName = 'data-' + name; + var attrValue = el.getAttribute(attrName); + if (attrValue !== null) { + return attrValue; + } + return null; + }, + + + attachEvent : function (el, evnt, func) { + if (el.addEventListener) { + el.addEventListener(evnt, func, false); + } else if (el.attachEvent) { + el.attachEvent('on' + evnt, func); + } + }, + + + detachEvent : function (el, evnt, func) { + if (el.removeEventListener) { + el.removeEventListener(evnt, func, false); + } else if (el.detachEvent) { + el.detachEvent('on' + evnt, func); + } + }, + + + _attachedGroupEvents : {}, + + + attachGroupEvent : function (groupName, el, evnt, func) { + if (!jsc._attachedGroupEvents.hasOwnProperty(groupName)) { + jsc._attachedGroupEvents[groupName] = []; + } + jsc._attachedGroupEvents[groupName].push([el, evnt, func]); + jsc.attachEvent(el, evnt, func); + }, + + + detachGroupEvents : function (groupName) { + if (jsc._attachedGroupEvents.hasOwnProperty(groupName)) { + for (var i = 0; i < jsc._attachedGroupEvents[groupName].length; i += 1) { + var evt = jsc._attachedGroupEvents[groupName][i]; + jsc.detachEvent(evt[0], evt[1], evt[2]); + } + delete jsc._attachedGroupEvents[groupName]; + } + }, + + + attachDOMReadyEvent : function (func) { + var fired = false; + var fireOnce = function () { + if (!fired) { + fired = true; + func(); + } + }; + + if (document.readyState === 'complete') { + setTimeout(fireOnce, 1); // async + return; + } + + if (document.addEventListener) { + document.addEventListener('DOMContentLoaded', fireOnce, false); + + // Fallback + window.addEventListener('load', fireOnce, false); + + } else if (document.attachEvent) { + // IE + document.attachEvent('onreadystatechange', function () { + if (document.readyState === 'complete') { + document.detachEvent('onreadystatechange', arguments.callee); + fireOnce(); + } + }) + + // Fallback + window.attachEvent('onload', fireOnce); + + // IE7/8 + if (document.documentElement.doScroll && window == window.top) { + var tryScroll = function () { + if (!document.body) { return; } + try { + document.documentElement.doScroll('left'); + fireOnce(); + } catch (e) { + setTimeout(tryScroll, 1); + } + }; + tryScroll(); + } + } + }, + + + warn : function (msg) { + if (window.console && window.console.warn) { + window.console.warn(msg); + } + }, + + + preventDefault : function (e) { + if (e.preventDefault) { e.preventDefault(); } + e.returnValue = false; + }, + + + captureTarget : function (target) { + // IE + if (target.setCapture) { + jsc._capturedTarget = target; + jsc._capturedTarget.setCapture(); + } + }, + + + releaseTarget : function () { + // IE + if (jsc._capturedTarget) { + jsc._capturedTarget.releaseCapture(); + jsc._capturedTarget = null; + } + }, + + + fireEvent : function (el, evnt) { + if (!el) { + return; + } + if (document.createEvent) { + var ev = document.createEvent('HTMLEvents'); + ev.initEvent(evnt, true, true); + el.dispatchEvent(ev); + } else if (document.createEventObject) { + var ev = document.createEventObject(); + el.fireEvent('on' + evnt, ev); + } else if (el['on' + evnt]) { // alternatively use the traditional event model + el['on' + evnt](); + } + }, + + + classNameToList : function (className) { + return className.replace(/^\s+|\s+$/g, '').split(/\s+/); + }, + + + // The className parameter (str) can only contain a single class name + hasClass : function (elm, className) { + if (!className) { + return false; + } + return -1 != (' ' + elm.className.replace(/\s+/g, ' ') + ' ').indexOf(' ' + className + ' '); + }, + + + // The className parameter (str) can contain multiple class names separated by whitespace + setClass : function (elm, className) { + var classList = jsc.classNameToList(className); + for (var i = 0; i < classList.length; i += 1) { + if (!jsc.hasClass(elm, classList[i])) { + elm.className += (elm.className ? ' ' : '') + classList[i]; + } + } + }, + + + // The className parameter (str) can contain multiple class names separated by whitespace + unsetClass : function (elm, className) { + var classList = jsc.classNameToList(className); + for (var i = 0; i < classList.length; i += 1) { + var repl = new RegExp( + '^\\s*' + classList[i] + '\\s*|' + + '\\s*' + classList[i] + '\\s*$|' + + '\\s+' + classList[i] + '(\\s+)', + 'g' + ); + elm.className = elm.className.replace(repl, '$1'); + } + }, + + + getStyle : function (elm) { + return window.getComputedStyle ? window.getComputedStyle(elm) : elm.currentStyle; + }, + + + setStyle : (function () { + var helper = document.createElement('div'); + var getSupportedProp = function (names) { + for (var i = 0; i < names.length; i += 1) { + if (names[i] in helper.style) { + return names[i]; + } + } + }; + var props = { + borderRadius: getSupportedProp(['borderRadius', 'MozBorderRadius', 'webkitBorderRadius']), + boxShadow: getSupportedProp(['boxShadow', 'MozBoxShadow', 'webkitBoxShadow']) + }; + return function (elm, prop, value) { + switch (prop.toLowerCase()) { + case 'opacity': + var alphaOpacity = Math.round(parseFloat(value) * 100); + elm.style.opacity = value; + elm.style.filter = 'alpha(opacity=' + alphaOpacity + ')'; + break; + default: + elm.style[props[prop]] = value; + break; + } + }; + })(), + + + setBorderRadius : function (elm, value) { + jsc.setStyle(elm, 'borderRadius', value || '0'); + }, + + + setBoxShadow : function (elm, value) { + jsc.setStyle(elm, 'boxShadow', value || 'none'); + }, + + + getElementPos : function (e, relativeToViewport) { + var x=0, y=0; + var rect = e.getBoundingClientRect(); + x = rect.left; + y = rect.top; + if (!relativeToViewport) { + var viewPos = jsc.getViewPos(); + x += viewPos[0]; + y += viewPos[1]; + } + return [x, y]; + }, + + + getElementSize : function (e) { + return [e.offsetWidth, e.offsetHeight]; + }, + + + // get pointer's X/Y coordinates relative to viewport + getAbsPointerPos : function (e) { + if (!e) { e = window.event; } + var x = 0, y = 0; + if (typeof e.changedTouches !== 'undefined' && e.changedTouches.length) { + // touch devices + x = e.changedTouches[0].clientX; + y = e.changedTouches[0].clientY; + } else if (typeof e.clientX === 'number') { + x = e.clientX; + y = e.clientY; + } + return { x: x, y: y }; + }, + + + // get pointer's X/Y coordinates relative to target element + getRelPointerPos : function (e) { + if (!e) { e = window.event; } + var target = e.target || e.srcElement; + var targetRect = target.getBoundingClientRect(); + + var x = 0, y = 0; + + var clientX = 0, clientY = 0; + if (typeof e.changedTouches !== 'undefined' && e.changedTouches.length) { + // touch devices + clientX = e.changedTouches[0].clientX; + clientY = e.changedTouches[0].clientY; + } else if (typeof e.clientX === 'number') { + clientX = e.clientX; + clientY = e.clientY; + } + + x = clientX - targetRect.left; + y = clientY - targetRect.top; + return { x: x, y: y }; + }, + + + getViewPos : function () { + var doc = document.documentElement; + return [ + (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0), + (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0) + ]; + }, + + + getViewSize : function () { + var doc = document.documentElement; + return [ + (window.innerWidth || doc.clientWidth), + (window.innerHeight || doc.clientHeight), + ]; + }, + + + redrawPosition : function () { + + if (jsc.picker && jsc.picker.owner) { + var thisObj = jsc.picker.owner; + + var tp, vp; + + if (thisObj.fixed) { + // Fixed elements are positioned relative to viewport, + // therefore we can ignore the scroll offset + tp = jsc.getElementPos(thisObj.targetElement, true); // target pos + vp = [0, 0]; // view pos + } else { + tp = jsc.getElementPos(thisObj.targetElement); // target pos + vp = jsc.getViewPos(); // view pos + } + + var ts = jsc.getElementSize(thisObj.targetElement); // target size + var vs = jsc.getViewSize(); // view size + var ps = jsc.getPickerOuterDims(thisObj); // picker size + var a, b, c; + switch (thisObj.position.toLowerCase()) { + case 'left': a=1; b=0; c=-1; break; + case 'right':a=1; b=0; c=1; break; + case 'top': a=0; b=1; c=-1; break; + default: a=0; b=1; c=1; break; + } + var l = (ts[b]+ps[b])/2; + + // compute picker position + if (!thisObj.smartPosition) { + var pp = [ + tp[a], + tp[b]+ts[b]-l+l*c + ]; + } else { + var pp = [ + -vp[a]+tp[a]+ps[a] > vs[a] ? + (-vp[a]+tp[a]+ts[a]/2 > vs[a]/2 && tp[a]+ts[a]-ps[a] >= 0 ? tp[a]+ts[a]-ps[a] : tp[a]) : + tp[a], + -vp[b]+tp[b]+ts[b]+ps[b]-l+l*c > vs[b] ? + (-vp[b]+tp[b]+ts[b]/2 > vs[b]/2 && tp[b]+ts[b]-l-l*c >= 0 ? tp[b]+ts[b]-l-l*c : tp[b]+ts[b]-l+l*c) : + (tp[b]+ts[b]-l+l*c >= 0 ? tp[b]+ts[b]-l+l*c : tp[b]+ts[b]-l-l*c) + ]; + } + + var x = pp[a]; + var y = pp[b]; + var positionValue = thisObj.fixed ? 'fixed' : 'absolute'; + var contractShadow = + (pp[0] + ps[0] > tp[0] || pp[0] < tp[0] + ts[0]) && + (pp[1] + ps[1] < tp[1] + ts[1]); + + jsc._drawPosition(thisObj, x, y, positionValue, contractShadow); + } + }, + + + _drawPosition : function (thisObj, x, y, positionValue, contractShadow) { + var vShadow = contractShadow ? 0 : thisObj.shadowBlur; // px + + jsc.picker.wrap.style.position = positionValue; + jsc.picker.wrap.style.left = x + 'px'; + jsc.picker.wrap.style.top = y + 'px'; + + jsc.setBoxShadow( + jsc.picker.boxS, + thisObj.shadow ? + new jsc.BoxShadow(0, vShadow, thisObj.shadowBlur, 0, thisObj.shadowColor) : + null); + }, + + + getPickerDims : function (thisObj) { + var displaySlider = !!jsc.getSliderComponent(thisObj); + var dims = [ + 2 * thisObj.insetWidth + 2 * thisObj.padding + thisObj.width + + (displaySlider ? 2 * thisObj.insetWidth + jsc.getPadToSliderPadding(thisObj) + thisObj.sliderSize : 0), + 2 * thisObj.insetWidth + 2 * thisObj.padding + thisObj.height + + (thisObj.closable ? 2 * thisObj.insetWidth + thisObj.padding + thisObj.buttonHeight : 0) + ]; + return dims; + }, + + + getPickerOuterDims : function (thisObj) { + var dims = jsc.getPickerDims(thisObj); + return [ + dims[0] + 2 * thisObj.borderWidth, + dims[1] + 2 * thisObj.borderWidth + ]; + }, + + + getPadToSliderPadding : function (thisObj) { + return Math.max(thisObj.padding, 1.5 * (2 * thisObj.pointerBorderWidth + thisObj.pointerThickness)); + }, + + + getPadYComponent : function (thisObj) { + switch (thisObj.mode.charAt(1).toLowerCase()) { + case 'v': return 'v'; break; + } + return 's'; + }, + + + getSliderComponent : function (thisObj) { + if (thisObj.mode.length > 2) { + switch (thisObj.mode.charAt(2).toLowerCase()) { + case 's': return 's'; break; + case 'v': return 'v'; break; + } + } + return null; + }, + + + onDocumentMouseDown : function (e) { + if (!e) { e = window.event; } + var target = e.target || e.srcElement; + + if (target._jscLinkedInstance) { + if (target._jscLinkedInstance.showOnClick) { + target._jscLinkedInstance.show(); + } + } else if (target._jscControlName) { + jsc.onControlPointerStart(e, target, target._jscControlName, 'mouse'); + } else { + // Mouse is outside the picker controls -> hide the color picker! + if (jsc.picker && jsc.picker.owner) { + jsc.picker.owner.hide(); + } + } + }, + + + onDocumentTouchStart : function (e) { + if (!e) { e = window.event; } + var target = e.target || e.srcElement; + + if (target._jscLinkedInstance) { + if (target._jscLinkedInstance.showOnClick) { + target._jscLinkedInstance.show(); + } + } else if (target._jscControlName) { + jsc.onControlPointerStart(e, target, target._jscControlName, 'touch'); + } else { + if (jsc.picker && jsc.picker.owner) { + jsc.picker.owner.hide(); + } + } + }, + + + onWindowResize : function (e) { + jsc.redrawPosition(); + }, + + + onParentScroll : function (e) { + // hide the picker when one of the parent elements is scrolled + if (jsc.picker && jsc.picker.owner) { + jsc.picker.owner.hide(); + } + }, + + + _pointerMoveEvent : { + mouse: 'mousemove', + touch: 'touchmove' + }, + _pointerEndEvent : { + mouse: 'mouseup', + touch: 'touchend' + }, + + + _pointerOrigin : null, + _capturedTarget : null, + + + onControlPointerStart : function (e, target, controlName, pointerType) { + var thisObj = target._jscInstance; + + jsc.preventDefault(e); + jsc.captureTarget(target); + + var registerDragEvents = function (doc, offset) { + jsc.attachGroupEvent('drag', doc, jsc._pointerMoveEvent[pointerType], + jsc.onDocumentPointerMove(e, target, controlName, pointerType, offset)); + jsc.attachGroupEvent('drag', doc, jsc._pointerEndEvent[pointerType], + jsc.onDocumentPointerEnd(e, target, controlName, pointerType)); + }; + + registerDragEvents(document, [0, 0]); + + if (window.parent && window.frameElement) { + var rect = window.frameElement.getBoundingClientRect(); + var ofs = [-rect.left, -rect.top]; + registerDragEvents(window.parent.window.document, ofs); + } + + var abs = jsc.getAbsPointerPos(e); + var rel = jsc.getRelPointerPos(e); + jsc._pointerOrigin = { + x: abs.x - rel.x, + y: abs.y - rel.y + }; + + switch (controlName) { + case 'pad': + // if the slider is at the bottom, move it up + switch (jsc.getSliderComponent(thisObj)) { + case 's': if (thisObj.hsv[1] === 0) { thisObj.fromHSV(null, 100, null); }; break; + case 'v': if (thisObj.hsv[2] === 0) { thisObj.fromHSV(null, null, 100); }; break; + } + jsc.setPad(thisObj, e, 0, 0); + break; + + case 'sld': + jsc.setSld(thisObj, e, 0); + break; + } + + jsc.dispatchFineChange(thisObj); + }, + + + onDocumentPointerMove : function (e, target, controlName, pointerType, offset) { + return function (e) { + var thisObj = target._jscInstance; + switch (controlName) { + case 'pad': + if (!e) { e = window.event; } + jsc.setPad(thisObj, e, offset[0], offset[1]); + jsc.dispatchFineChange(thisObj); + break; + + case 'sld': + if (!e) { e = window.event; } + jsc.setSld(thisObj, e, offset[1]); + jsc.dispatchFineChange(thisObj); + break; + } + } + }, + + + onDocumentPointerEnd : function (e, target, controlName, pointerType) { + return function (e) { + var thisObj = target._jscInstance; + jsc.detachGroupEvents('drag'); + jsc.releaseTarget(); + // Always dispatch changes after detaching outstanding mouse handlers, + // in case some user interaction will occur in user's onchange callback + // that would intrude with current mouse events + jsc.dispatchChange(thisObj); + }; + }, + + + dispatchChange : function (thisObj) { + if (thisObj.valueElement) { + if (jsc.isElementType(thisObj.valueElement, 'input')) { + jsc.fireEvent(thisObj.valueElement, 'change'); + } + } + }, + + + dispatchFineChange : function (thisObj) { + if (thisObj.onFineChange) { + var callback; + if (typeof thisObj.onFineChange === 'string') { + callback = new Function (thisObj.onFineChange); + } else { + callback = thisObj.onFineChange; + } + callback.call(thisObj); + } + }, + + + setPad : function (thisObj, e, ofsX, ofsY) { + var pointerAbs = jsc.getAbsPointerPos(e); + var x = ofsX + pointerAbs.x - jsc._pointerOrigin.x - thisObj.padding - thisObj.insetWidth; + var y = ofsY + pointerAbs.y - jsc._pointerOrigin.y - thisObj.padding - thisObj.insetWidth; + + var xVal = x * (360 / (thisObj.width - 1)); + var yVal = 100 - (y * (100 / (thisObj.height - 1))); + + switch (jsc.getPadYComponent(thisObj)) { + case 's': thisObj.fromHSV(xVal, yVal, null, jsc.leaveSld); break; + case 'v': thisObj.fromHSV(xVal, null, yVal, jsc.leaveSld); break; + } + }, + + + setSld : function (thisObj, e, ofsY) { + var pointerAbs = jsc.getAbsPointerPos(e); + var y = ofsY + pointerAbs.y - jsc._pointerOrigin.y - thisObj.padding - thisObj.insetWidth; + + var yVal = 100 - (y * (100 / (thisObj.height - 1))); + + switch (jsc.getSliderComponent(thisObj)) { + case 's': thisObj.fromHSV(null, yVal, null, jsc.leavePad); break; + case 'v': thisObj.fromHSV(null, null, yVal, jsc.leavePad); break; + } + }, + + + _vmlNS : 'jsc_vml_', + _vmlCSS : 'jsc_vml_css_', + _vmlReady : false, + + + initVML : function () { + if (!jsc._vmlReady) { + // init VML namespace + var doc = document; + if (!doc.namespaces[jsc._vmlNS]) { + doc.namespaces.add(jsc._vmlNS, 'urn:schemas-microsoft-com:vml'); + } + if (!doc.styleSheets[jsc._vmlCSS]) { + var tags = ['shape', 'shapetype', 'group', 'background', 'path', 'formulas', 'handles', 'fill', 'stroke', 'shadow', 'textbox', 'textpath', 'imagedata', 'line', 'polyline', 'curve', 'rect', 'roundrect', 'oval', 'arc', 'image']; + var ss = doc.createStyleSheet(); + ss.owningElement.id = jsc._vmlCSS; + for (var i = 0; i < tags.length; i += 1) { + ss.addRule(jsc._vmlNS + '\\:' + tags[i], 'behavior:url(#default#VML);'); + } + } + jsc._vmlReady = true; + } + }, + + + createPalette : function () { + + var paletteObj = { + elm: null, + draw: null + }; + + if (jsc.isCanvasSupported) { + // Canvas implementation for modern browsers + + var canvas = document.createElement('canvas'); + var ctx = canvas.getContext('2d'); + + var drawFunc = function (width, height, type) { + canvas.width = width; + canvas.height = height; + + ctx.clearRect(0, 0, canvas.width, canvas.height); + + var hGrad = ctx.createLinearGradient(0, 0, canvas.width, 0); + hGrad.addColorStop(0 / 6, '#F00'); + hGrad.addColorStop(1 / 6, '#FF0'); + hGrad.addColorStop(2 / 6, '#0F0'); + hGrad.addColorStop(3 / 6, '#0FF'); + hGrad.addColorStop(4 / 6, '#00F'); + hGrad.addColorStop(5 / 6, '#F0F'); + hGrad.addColorStop(6 / 6, '#F00'); + + ctx.fillStyle = hGrad; + ctx.fillRect(0, 0, canvas.width, canvas.height); + + var vGrad = ctx.createLinearGradient(0, 0, 0, canvas.height); + switch (type.toLowerCase()) { + case 's': + vGrad.addColorStop(0, 'rgba(255,255,255,0)'); + vGrad.addColorStop(1, 'rgba(255,255,255,1)'); + break; + case 'v': + vGrad.addColorStop(0, 'rgba(0,0,0,0)'); + vGrad.addColorStop(1, 'rgba(0,0,0,1)'); + break; + } + ctx.fillStyle = vGrad; + ctx.fillRect(0, 0, canvas.width, canvas.height); + }; + + paletteObj.elm = canvas; + paletteObj.draw = drawFunc; + + } else { + // VML fallback for IE 7 and 8 + + jsc.initVML(); + + var vmlContainer = document.createElement('div'); + vmlContainer.style.position = 'relative'; + vmlContainer.style.overflow = 'hidden'; + + var hGrad = document.createElement(jsc._vmlNS + ':fill'); + hGrad.type = 'gradient'; + hGrad.method = 'linear'; + hGrad.angle = '90'; + hGrad.colors = '16.67% #F0F, 33.33% #00F, 50% #0FF, 66.67% #0F0, 83.33% #FF0' + + var hRect = document.createElement(jsc._vmlNS + ':rect'); + hRect.style.position = 'absolute'; + hRect.style.left = -1 + 'px'; + hRect.style.top = -1 + 'px'; + hRect.stroked = false; + hRect.appendChild(hGrad); + vmlContainer.appendChild(hRect); + + var vGrad = document.createElement(jsc._vmlNS + ':fill'); + vGrad.type = 'gradient'; + vGrad.method = 'linear'; + vGrad.angle = '180'; + vGrad.opacity = '0'; + + var vRect = document.createElement(jsc._vmlNS + ':rect'); + vRect.style.position = 'absolute'; + vRect.style.left = -1 + 'px'; + vRect.style.top = -1 + 'px'; + vRect.stroked = false; + vRect.appendChild(vGrad); + vmlContainer.appendChild(vRect); + + var drawFunc = function (width, height, type) { + vmlContainer.style.width = width + 'px'; + vmlContainer.style.height = height + 'px'; + + hRect.style.width = + vRect.style.width = + (width + 1) + 'px'; + hRect.style.height = + vRect.style.height = + (height + 1) + 'px'; + + // Colors must be specified during every redraw, otherwise IE won't display + // a full gradient during a subsequential redraw + hGrad.color = '#F00'; + hGrad.color2 = '#F00'; + + switch (type.toLowerCase()) { + case 's': + vGrad.color = vGrad.color2 = '#FFF'; + break; + case 'v': + vGrad.color = vGrad.color2 = '#000'; + break; + } + }; + + paletteObj.elm = vmlContainer; + paletteObj.draw = drawFunc; + } + + return paletteObj; + }, + + + createSliderGradient : function () { + + var sliderObj = { + elm: null, + draw: null + }; + + if (jsc.isCanvasSupported) { + // Canvas implementation for modern browsers + + var canvas = document.createElement('canvas'); + var ctx = canvas.getContext('2d'); + + var drawFunc = function (width, height, color1, color2) { + canvas.width = width; + canvas.height = height; + + ctx.clearRect(0, 0, canvas.width, canvas.height); + + var grad = ctx.createLinearGradient(0, 0, 0, canvas.height); + grad.addColorStop(0, color1); + grad.addColorStop(1, color2); + + ctx.fillStyle = grad; + ctx.fillRect(0, 0, canvas.width, canvas.height); + }; + + sliderObj.elm = canvas; + sliderObj.draw = drawFunc; + + } else { + // VML fallback for IE 7 and 8 + + jsc.initVML(); + + var vmlContainer = document.createElement('div'); + vmlContainer.style.position = 'relative'; + vmlContainer.style.overflow = 'hidden'; + + var grad = document.createElement(jsc._vmlNS + ':fill'); + grad.type = 'gradient'; + grad.method = 'linear'; + grad.angle = '180'; + + var rect = document.createElement(jsc._vmlNS + ':rect'); + rect.style.position = 'absolute'; + rect.style.left = -1 + 'px'; + rect.style.top = -1 + 'px'; + rect.stroked = false; + rect.appendChild(grad); + vmlContainer.appendChild(rect); + + var drawFunc = function (width, height, color1, color2) { + vmlContainer.style.width = width + 'px'; + vmlContainer.style.height = height + 'px'; + + rect.style.width = (width + 1) + 'px'; + rect.style.height = (height + 1) + 'px'; + + grad.color = color1; + grad.color2 = color2; + }; + + sliderObj.elm = vmlContainer; + sliderObj.draw = drawFunc; + } + + return sliderObj; + }, + + + leaveValue : 1<<0, + leaveStyle : 1<<1, + leavePad : 1<<2, + leaveSld : 1<<3, + + + BoxShadow : (function () { + var BoxShadow = function (hShadow, vShadow, blur, spread, color, inset) { + this.hShadow = hShadow; + this.vShadow = vShadow; + this.blur = blur; + this.spread = spread; + this.color = color; + this.inset = !!inset; + }; + + BoxShadow.prototype.toString = function () { + var vals = [ + Math.round(this.hShadow) + 'px', + Math.round(this.vShadow) + 'px', + Math.round(this.blur) + 'px', + Math.round(this.spread) + 'px', + this.color + ]; + if (this.inset) { + vals.push('inset'); + } + return vals.join(' '); + }; + + return BoxShadow; + })(), + + + // + // Usage: + // var myColor = new jscolor( [, ]) + // + + jscolor : function (targetElement, options) { + + // General options + // + this.value = null; // initial HEX color. To change it later, use methods fromString(), fromHSV() and fromRGB() + this.valueElement = targetElement; // element that will be used to display and input the color code + this.styleElement = targetElement; // element that will preview the picked color using CSS backgroundColor + this.required = true; // whether the associated text can be left empty + this.refine = true; // whether to refine the entered color code (e.g. uppercase it and remove whitespace) + this.hash = false; // whether to prefix the HEX color code with # symbol + this.uppercase = true; // whether to uppercase the color code + this.onFineChange = null; // called instantly every time the color changes (value can be either a function or a string with javascript code) + this.activeClass = 'jscolor-active'; // class to be set to the target element when a picker window is open on it + this.minS = 0; // min allowed saturation (0 - 100) + this.maxS = 100; // max allowed saturation (0 - 100) + this.minV = 0; // min allowed value (brightness) (0 - 100) + this.maxV = 100; // max allowed value (brightness) (0 - 100) + + // Accessing the picked color + // + this.hsv = [0, 0, 100]; // read-only [0-360, 0-100, 0-100] + this.rgb = [255, 255, 255]; // read-only [0-255, 0-255, 0-255] + + // Color Picker options + // + this.width = 181; // width of color palette (in px) + this.height = 101; // height of color palette (in px) + this.showOnClick = true; // whether to display the color picker when user clicks on its target element + this.mode = 'HSV'; // HSV | HVS | HS | HV - layout of the color picker controls + this.position = 'bottom'; // left | right | top | bottom - position relative to the target element + this.smartPosition = true; // automatically change picker position when there is not enough space for it + this.sliderSize = 16; // px + this.crossSize = 8; // px + this.closable = false; // whether to display the Close button + this.closeText = 'Close'; + this.buttonColor = '#000000'; // CSS color + this.buttonHeight = 18; // px + this.padding = 12; // px + this.backgroundColor = '#FFFFFF'; // CSS color + this.borderWidth = 1; // px + this.borderColor = '#BBBBBB'; // CSS color + this.borderRadius = 8; // px + this.insetWidth = 1; // px + this.insetColor = '#BBBBBB'; // CSS color + this.shadow = true; // whether to display shadow + this.shadowBlur = 15; // px + this.shadowColor = 'rgba(0,0,0,0.2)'; // CSS color + this.pointerColor = '#4C4C4C'; // px + this.pointerBorderColor = '#FFFFFF'; // px + this.pointerBorderWidth = 1; // px + this.pointerThickness = 2; // px + this.zIndex = 1000; + this.container = null; // where to append the color picker (BODY element by default) + + + for (var opt in options) { + if (options.hasOwnProperty(opt)) { + this[opt] = options[opt]; + } + } + + + this.hide = function () { + if (isPickerOwner()) { + detachPicker(); + } + }; + + + this.show = function () { + drawPicker(); + }; + + + this.redraw = function () { + if (isPickerOwner()) { + drawPicker(); + } + }; + + + this.importColor = function () { + if (!this.valueElement) { + this.exportColor(); + } else { + if (jsc.isElementType(this.valueElement, 'input')) { + if (!this.refine) { + if (!this.fromString(this.valueElement.value, jsc.leaveValue)) { + if (this.styleElement) { + this.styleElement.style.backgroundImage = this.styleElement._jscOrigStyle.backgroundImage; + this.styleElement.style.backgroundColor = this.styleElement._jscOrigStyle.backgroundColor; + this.styleElement.style.color = this.styleElement._jscOrigStyle.color; + } + this.exportColor(jsc.leaveValue | jsc.leaveStyle); + } + } else if (!this.required && /^\s*$/.test(this.valueElement.value)) { + this.valueElement.value = ''; + if (this.styleElement) { + this.styleElement.style.backgroundImage = this.styleElement._jscOrigStyle.backgroundImage; + this.styleElement.style.backgroundColor = this.styleElement._jscOrigStyle.backgroundColor; + this.styleElement.style.color = this.styleElement._jscOrigStyle.color; + } + this.exportColor(jsc.leaveValue | jsc.leaveStyle); + + } else if (this.fromString(this.valueElement.value)) { + // managed to import color successfully from the value -> OK, don't do anything + } else { + this.exportColor(); + } + } else { + // not an input element -> doesn't have any value + this.exportColor(); + } + } + }; + + + this.exportColor = function (flags) { + if (!(flags & jsc.leaveValue) && this.valueElement) { + var value = this.toString(); + if (this.uppercase) { value = value.toUpperCase(); } + if (this.hash) { value = '#' + value; } + + if (jsc.isElementType(this.valueElement, 'input')) { + this.valueElement.value = value; + } else { + this.valueElement.innerHTML = value; + } + } + if (!(flags & jsc.leaveStyle)) { + if (this.styleElement) { + this.styleElement.style.backgroundImage = 'none'; + this.styleElement.style.backgroundColor = '#' + this.toString(); + this.styleElement.style.color = this.isLight() ? '#000' : '#FFF'; + } + } + if (!(flags & jsc.leavePad) && isPickerOwner()) { + redrawPad(); + } + if (!(flags & jsc.leaveSld) && isPickerOwner()) { + redrawSld(); + } + }; + + + // h: 0-360 + // s: 0-100 + // v: 0-100 + // + this.fromHSV = function (h, s, v, flags) { // null = don't change + if (h !== null) { + if (isNaN(h)) { return false; } + h = Math.max(0, Math.min(360, h)); + } + if (s !== null) { + if (isNaN(s)) { return false; } + s = Math.max(0, Math.min(100, this.maxS, s), this.minS); + } + if (v !== null) { + if (isNaN(v)) { return false; } + v = Math.max(0, Math.min(100, this.maxV, v), this.minV); + } + + this.rgb = HSV_RGB( + h===null ? this.hsv[0] : (this.hsv[0]=h), + s===null ? this.hsv[1] : (this.hsv[1]=s), + v===null ? this.hsv[2] : (this.hsv[2]=v) + ); + + this.exportColor(flags); + }; + + + // r: 0-255 + // g: 0-255 + // b: 0-255 + // + this.fromRGB = function (r, g, b, flags) { // null = don't change + if (r !== null) { + if (isNaN(r)) { return false; } + r = Math.max(0, Math.min(255, r)); + } + if (g !== null) { + if (isNaN(g)) { return false; } + g = Math.max(0, Math.min(255, g)); + } + if (b !== null) { + if (isNaN(b)) { return false; } + b = Math.max(0, Math.min(255, b)); + } + + var hsv = RGB_HSV( + r===null ? this.rgb[0] : r, + g===null ? this.rgb[1] : g, + b===null ? this.rgb[2] : b + ); + if (hsv[0] !== null) { + this.hsv[0] = Math.max(0, Math.min(360, hsv[0])); + } + if (hsv[2] !== 0) { + this.hsv[1] = hsv[1]===null ? null : Math.max(0, this.minS, Math.min(100, this.maxS, hsv[1])); + } + this.hsv[2] = hsv[2]===null ? null : Math.max(0, this.minV, Math.min(100, this.maxV, hsv[2])); + + // update RGB according to final HSV, as some values might be trimmed + var rgb = HSV_RGB(this.hsv[0], this.hsv[1], this.hsv[2]); + this.rgb[0] = rgb[0]; + this.rgb[1] = rgb[1]; + this.rgb[2] = rgb[2]; + + this.exportColor(flags); + }; + + + this.fromString = function (str, flags) { + var m; + if (m = str.match(/^\W*([0-9A-F]{3}([0-9A-F]{3})?)\W*$/i)) { + // HEX notation + // + + if (m[1].length === 6) { + // 6-char notation + this.fromRGB( + parseInt(m[1].substr(0,2),16), + parseInt(m[1].substr(2,2),16), + parseInt(m[1].substr(4,2),16), + flags + ); + } else { + // 3-char notation + this.fromRGB( + parseInt(m[1].charAt(0) + m[1].charAt(0),16), + parseInt(m[1].charAt(1) + m[1].charAt(1),16), + parseInt(m[1].charAt(2) + m[1].charAt(2),16), + flags + ); + } + return true; + + } else if (m = str.match(/^\W*rgba?\(([^)]*)\)\W*$/i)) { + var params = m[1].split(','); + var re = /^\s*(\d*)(\.\d+)?\s*$/; + var mR, mG, mB; + if ( + params.length >= 3 && + (mR = params[0].match(re)) && + (mG = params[1].match(re)) && + (mB = params[2].match(re)) + ) { + var r = parseFloat((mR[1] || '0') + (mR[2] || '')); + var g = parseFloat((mG[1] || '0') + (mG[2] || '')); + var b = parseFloat((mB[1] || '0') + (mB[2] || '')); + this.fromRGB(r, g, b, flags); + return true; + } + } + return false; + }; + + + this.toString = function () { + return ( + (0x100 | Math.round(this.rgb[0])).toString(16).substr(1) + + (0x100 | Math.round(this.rgb[1])).toString(16).substr(1) + + (0x100 | Math.round(this.rgb[2])).toString(16).substr(1) + ); + }; + + + this.toHEXString = function () { + return '#' + this.toString().toUpperCase(); + }; + + + this.toRGBString = function () { + return ('rgb(' + + Math.round(this.rgb[0]) + ',' + + Math.round(this.rgb[1]) + ',' + + Math.round(this.rgb[2]) + ')' + ); + }; + + + this.isLight = function () { + return ( + 0.213 * this.rgb[0] + + 0.715 * this.rgb[1] + + 0.072 * this.rgb[2] > + 255 / 2 + ); + }; + + + this._processParentElementsInDOM = function () { + if (this._linkedElementsProcessed) { return; } + this._linkedElementsProcessed = true; + + var elm = this.targetElement; + do { + // If the target element or one of its parent nodes has fixed position, + // then use fixed positioning instead + // + // Note: In Firefox, getComputedStyle returns null in a hidden iframe, + // that's why we need to check if the returned style object is non-empty + var currStyle = jsc.getStyle(elm); + if (currStyle && currStyle.position.toLowerCase() === 'fixed') { + this.fixed = true; + } + + if (elm !== this.targetElement) { + // Ensure to attach onParentScroll only once to each parent element + // (multiple targetElements can share the same parent nodes) + // + // Note: It's not just offsetParents that can be scrollable, + // that's why we loop through all parent nodes + if (!elm._jscEventsAttached) { + jsc.attachEvent(elm, 'scroll', jsc.onParentScroll); + elm._jscEventsAttached = true; + } + } + } while ((elm = elm.parentNode) && !jsc.isElementType(elm, 'body')); + }; + + + // r: 0-255 + // g: 0-255 + // b: 0-255 + // + // returns: [ 0-360, 0-100, 0-100 ] + // + function RGB_HSV (r, g, b) { + r /= 255; + g /= 255; + b /= 255; + var n = Math.min(Math.min(r,g),b); + var v = Math.max(Math.max(r,g),b); + var m = v - n; + if (m === 0) { return [ null, 0, 100 * v ]; } + var h = r===n ? 3+(b-g)/m : (g===n ? 5+(r-b)/m : 1+(g-r)/m); + return [ + 60 * (h===6?0:h), + 100 * (m/v), + 100 * v + ]; + } + + + // h: 0-360 + // s: 0-100 + // v: 0-100 + // + // returns: [ 0-255, 0-255, 0-255 ] + // + function HSV_RGB (h, s, v) { + var u = 255 * (v / 100); + + if (h === null) { + return [ u, u, u ]; + } + + h /= 60; + s /= 100; + + var i = Math.floor(h); + var f = i%2 ? h-i : 1-(h-i); + var m = u * (1 - s); + var n = u * (1 - s * f); + switch (i) { + case 6: + case 0: return [u,n,m]; + case 1: return [n,u,m]; + case 2: return [m,u,n]; + case 3: return [m,n,u]; + case 4: return [n,m,u]; + case 5: return [u,m,n]; + } + } + + + function detachPicker () { + jsc.unsetClass(THIS.targetElement, THIS.activeClass); + jsc.picker.wrap.parentNode.removeChild(jsc.picker.wrap); + delete jsc.picker.owner; + } + + + function drawPicker () { + + // At this point, when drawing the picker, we know what the parent elements are + // and we can do all related DOM operations, such as registering events on them + // or checking their positioning + THIS._processParentElementsInDOM(); + + if (!jsc.picker) { + jsc.picker = { + owner: null, + wrap : document.createElement('div'), + box : document.createElement('div'), + boxS : document.createElement('div'), // shadow area + boxB : document.createElement('div'), // border + pad : document.createElement('div'), + padB : document.createElement('div'), // border + padM : document.createElement('div'), // mouse/touch area + padPal : jsc.createPalette(), + cross : document.createElement('div'), + crossBY : document.createElement('div'), // border Y + crossBX : document.createElement('div'), // border X + crossLY : document.createElement('div'), // line Y + crossLX : document.createElement('div'), // line X + sld : document.createElement('div'), + sldB : document.createElement('div'), // border + sldM : document.createElement('div'), // mouse/touch area + sldGrad : jsc.createSliderGradient(), + sldPtrS : document.createElement('div'), // slider pointer spacer + sldPtrIB : document.createElement('div'), // slider pointer inner border + sldPtrMB : document.createElement('div'), // slider pointer middle border + sldPtrOB : document.createElement('div'), // slider pointer outer border + btn : document.createElement('div'), + btnT : document.createElement('span') // text + }; + + jsc.picker.pad.appendChild(jsc.picker.padPal.elm); + jsc.picker.padB.appendChild(jsc.picker.pad); + jsc.picker.cross.appendChild(jsc.picker.crossBY); + jsc.picker.cross.appendChild(jsc.picker.crossBX); + jsc.picker.cross.appendChild(jsc.picker.crossLY); + jsc.picker.cross.appendChild(jsc.picker.crossLX); + jsc.picker.padB.appendChild(jsc.picker.cross); + jsc.picker.box.appendChild(jsc.picker.padB); + jsc.picker.box.appendChild(jsc.picker.padM); + + jsc.picker.sld.appendChild(jsc.picker.sldGrad.elm); + jsc.picker.sldB.appendChild(jsc.picker.sld); + jsc.picker.sldB.appendChild(jsc.picker.sldPtrOB); + jsc.picker.sldPtrOB.appendChild(jsc.picker.sldPtrMB); + jsc.picker.sldPtrMB.appendChild(jsc.picker.sldPtrIB); + jsc.picker.sldPtrIB.appendChild(jsc.picker.sldPtrS); + jsc.picker.box.appendChild(jsc.picker.sldB); + jsc.picker.box.appendChild(jsc.picker.sldM); + + jsc.picker.btn.appendChild(jsc.picker.btnT); + jsc.picker.box.appendChild(jsc.picker.btn); + + jsc.picker.boxB.appendChild(jsc.picker.box); + jsc.picker.wrap.appendChild(jsc.picker.boxS); + jsc.picker.wrap.appendChild(jsc.picker.boxB); + } + + var p = jsc.picker; + + var displaySlider = !!jsc.getSliderComponent(THIS); + var dims = jsc.getPickerDims(THIS); + var crossOuterSize = (2 * THIS.pointerBorderWidth + THIS.pointerThickness + 2 * THIS.crossSize); + var padToSliderPadding = jsc.getPadToSliderPadding(THIS); + var borderRadius = Math.min( + THIS.borderRadius, + Math.round(THIS.padding * Math.PI)); // px + var padCursor = 'crosshair'; + + // wrap + p.wrap.style.clear = 'both'; + p.wrap.style.width = (dims[0] + 2 * THIS.borderWidth) + 'px'; + p.wrap.style.height = (dims[1] + 2 * THIS.borderWidth) + 'px'; + p.wrap.style.zIndex = THIS.zIndex; + + // picker + p.box.style.width = dims[0] + 'px'; + p.box.style.height = dims[1] + 'px'; + + p.boxS.style.position = 'absolute'; + p.boxS.style.left = '0'; + p.boxS.style.top = '0'; + p.boxS.style.width = '100%'; + p.boxS.style.height = '100%'; + jsc.setBorderRadius(p.boxS, borderRadius + 'px'); + + // picker border + p.boxB.style.position = 'relative'; + p.boxB.style.border = THIS.borderWidth + 'px solid'; + p.boxB.style.borderColor = THIS.borderColor; + p.boxB.style.background = THIS.backgroundColor; + jsc.setBorderRadius(p.boxB, borderRadius + 'px'); + + // IE hack: + // If the element is transparent, IE will trigger the event on the elements under it, + // e.g. on Canvas or on elements with border + p.padM.style.background = + p.sldM.style.background = + '#FFF'; + jsc.setStyle(p.padM, 'opacity', '0'); + jsc.setStyle(p.sldM, 'opacity', '0'); + + // pad + p.pad.style.position = 'relative'; + p.pad.style.width = THIS.width + 'px'; + p.pad.style.height = THIS.height + 'px'; + + // pad palettes (HSV and HVS) + p.padPal.draw(THIS.width, THIS.height, jsc.getPadYComponent(THIS)); + + // pad border + p.padB.style.position = 'absolute'; + p.padB.style.left = THIS.padding + 'px'; + p.padB.style.top = THIS.padding + 'px'; + p.padB.style.border = THIS.insetWidth + 'px solid'; + p.padB.style.borderColor = THIS.insetColor; + + // pad mouse area + p.padM._jscInstance = THIS; + p.padM._jscControlName = 'pad'; + p.padM.style.position = 'absolute'; + p.padM.style.left = '0'; + p.padM.style.top = '0'; + p.padM.style.width = (THIS.padding + 2 * THIS.insetWidth + THIS.width + padToSliderPadding / 2) + 'px'; + p.padM.style.height = dims[1] + 'px'; + p.padM.style.cursor = padCursor; + + // pad cross + p.cross.style.position = 'absolute'; + p.cross.style.left = + p.cross.style.top = + '0'; + p.cross.style.width = + p.cross.style.height = + crossOuterSize + 'px'; + + // pad cross border Y and X + p.crossBY.style.position = + p.crossBX.style.position = + 'absolute'; + p.crossBY.style.background = + p.crossBX.style.background = + THIS.pointerBorderColor; + p.crossBY.style.width = + p.crossBX.style.height = + (2 * THIS.pointerBorderWidth + THIS.pointerThickness) + 'px'; + p.crossBY.style.height = + p.crossBX.style.width = + crossOuterSize + 'px'; + p.crossBY.style.left = + p.crossBX.style.top = + (Math.floor(crossOuterSize / 2) - Math.floor(THIS.pointerThickness / 2) - THIS.pointerBorderWidth) + 'px'; + p.crossBY.style.top = + p.crossBX.style.left = + '0'; + + // pad cross line Y and X + p.crossLY.style.position = + p.crossLX.style.position = + 'absolute'; + p.crossLY.style.background = + p.crossLX.style.background = + THIS.pointerColor; + p.crossLY.style.height = + p.crossLX.style.width = + (crossOuterSize - 2 * THIS.pointerBorderWidth) + 'px'; + p.crossLY.style.width = + p.crossLX.style.height = + THIS.pointerThickness + 'px'; + p.crossLY.style.left = + p.crossLX.style.top = + (Math.floor(crossOuterSize / 2) - Math.floor(THIS.pointerThickness / 2)) + 'px'; + p.crossLY.style.top = + p.crossLX.style.left = + THIS.pointerBorderWidth + 'px'; + + // slider + p.sld.style.overflow = 'hidden'; + p.sld.style.width = THIS.sliderSize + 'px'; + p.sld.style.height = THIS.height + 'px'; + + // slider gradient + p.sldGrad.draw(THIS.sliderSize, THIS.height, '#000', '#000'); + + // slider border + p.sldB.style.display = displaySlider ? 'block' : 'none'; + p.sldB.style.position = 'absolute'; + p.sldB.style.right = THIS.padding + 'px'; + p.sldB.style.top = THIS.padding + 'px'; + p.sldB.style.border = THIS.insetWidth + 'px solid'; + p.sldB.style.borderColor = THIS.insetColor; + + // slider mouse area + p.sldM._jscInstance = THIS; + p.sldM._jscControlName = 'sld'; + p.sldM.style.display = displaySlider ? 'block' : 'none'; + p.sldM.style.position = 'absolute'; + p.sldM.style.right = '0'; + p.sldM.style.top = '0'; + p.sldM.style.width = (THIS.sliderSize + padToSliderPadding / 2 + THIS.padding + 2 * THIS.insetWidth) + 'px'; + p.sldM.style.height = dims[1] + 'px'; + p.sldM.style.cursor = 'default'; + + // slider pointer inner and outer border + p.sldPtrIB.style.border = + p.sldPtrOB.style.border = + THIS.pointerBorderWidth + 'px solid ' + THIS.pointerBorderColor; + + // slider pointer outer border + p.sldPtrOB.style.position = 'absolute'; + p.sldPtrOB.style.left = -(2 * THIS.pointerBorderWidth + THIS.pointerThickness) + 'px'; + p.sldPtrOB.style.top = '0'; + + // slider pointer middle border + p.sldPtrMB.style.border = THIS.pointerThickness + 'px solid ' + THIS.pointerColor; + + // slider pointer spacer + p.sldPtrS.style.width = THIS.sliderSize + 'px'; + p.sldPtrS.style.height = sliderPtrSpace + 'px'; + + // the Close button + function setBtnBorder () { + var insetColors = THIS.insetColor.split(/\s+/); + var outsetColor = insetColors.length < 2 ? insetColors[0] : insetColors[1] + ' ' + insetColors[0] + ' ' + insetColors[0] + ' ' + insetColors[1]; + p.btn.style.borderColor = outsetColor; + } + p.btn.style.display = THIS.closable ? 'block' : 'none'; + p.btn.style.position = 'absolute'; + p.btn.style.left = THIS.padding + 'px'; + p.btn.style.bottom = THIS.padding + 'px'; + p.btn.style.padding = '0 15px'; + p.btn.style.height = THIS.buttonHeight + 'px'; + p.btn.style.border = THIS.insetWidth + 'px solid'; + setBtnBorder(); + p.btn.style.color = THIS.buttonColor; + p.btn.style.font = '12px sans-serif'; + p.btn.style.textAlign = 'center'; + try { + p.btn.style.cursor = 'pointer'; + } catch(eOldIE) { + p.btn.style.cursor = 'hand'; + } + p.btn.onmousedown = function () { + THIS.hide(); + }; + p.btnT.style.lineHeight = THIS.buttonHeight + 'px'; + p.btnT.innerHTML = ''; + p.btnT.appendChild(document.createTextNode(THIS.closeText)); + + // place pointers + redrawPad(); + redrawSld(); + + // If we are changing the owner without first closing the picker, + // make sure to first deal with the old owner + if (jsc.picker.owner && jsc.picker.owner !== THIS) { + jsc.unsetClass(jsc.picker.owner.targetElement, THIS.activeClass); + } + + // Set the new picker owner + jsc.picker.owner = THIS; + + // The redrawPosition() method needs picker.owner to be set, that's why we call it here, + // after setting the owner + if (jsc.isElementType(container, 'body')) { + jsc.redrawPosition(); + } else { + jsc._drawPosition(THIS, 0, 0, 'relative', false); + } + + if (p.wrap.parentNode != container) { + container.appendChild(p.wrap); + } + + jsc.setClass(THIS.targetElement, THIS.activeClass); + } + + + function redrawPad () { + // redraw the pad pointer + switch (jsc.getPadYComponent(THIS)) { + case 's': var yComponent = 1; break; + case 'v': var yComponent = 2; break; + } + var x = Math.round((THIS.hsv[0] / 360) * (THIS.width - 1)); + var y = Math.round((1 - THIS.hsv[yComponent] / 100) * (THIS.height - 1)); + var crossOuterSize = (2 * THIS.pointerBorderWidth + THIS.pointerThickness + 2 * THIS.crossSize); + var ofs = -Math.floor(crossOuterSize / 2); + jsc.picker.cross.style.left = (x + ofs) + 'px'; + jsc.picker.cross.style.top = (y + ofs) + 'px'; + + // redraw the slider + switch (jsc.getSliderComponent(THIS)) { + case 's': + var rgb1 = HSV_RGB(THIS.hsv[0], 100, THIS.hsv[2]); + var rgb2 = HSV_RGB(THIS.hsv[0], 0, THIS.hsv[2]); + var color1 = 'rgb(' + + Math.round(rgb1[0]) + ',' + + Math.round(rgb1[1]) + ',' + + Math.round(rgb1[2]) + ')'; + var color2 = 'rgb(' + + Math.round(rgb2[0]) + ',' + + Math.round(rgb2[1]) + ',' + + Math.round(rgb2[2]) + ')'; + jsc.picker.sldGrad.draw(THIS.sliderSize, THIS.height, color1, color2); + break; + case 'v': + var rgb = HSV_RGB(THIS.hsv[0], THIS.hsv[1], 100); + var color1 = 'rgb(' + + Math.round(rgb[0]) + ',' + + Math.round(rgb[1]) + ',' + + Math.round(rgb[2]) + ')'; + var color2 = '#000'; + jsc.picker.sldGrad.draw(THIS.sliderSize, THIS.height, color1, color2); + break; + } + } + + + function redrawSld () { + var sldComponent = jsc.getSliderComponent(THIS); + if (sldComponent) { + // redraw the slider pointer + switch (sldComponent) { + case 's': var yComponent = 1; break; + case 'v': var yComponent = 2; break; + } + var y = Math.round((1 - THIS.hsv[yComponent] / 100) * (THIS.height - 1)); + jsc.picker.sldPtrOB.style.top = (y - (2 * THIS.pointerBorderWidth + THIS.pointerThickness) - Math.floor(sliderPtrSpace / 2)) + 'px'; + } + } + + + function isPickerOwner () { + return jsc.picker && jsc.picker.owner === THIS; + } + + + function blurValue () { + THIS.importColor(); + } + + + // Find the target element + if (typeof targetElement === 'string') { + var id = targetElement; + var elm = document.getElementById(id); + if (elm) { + this.targetElement = elm; + } else { + jsc.warn('Could not find target element with ID \'' + id + '\''); + } + } else if (targetElement) { + this.targetElement = targetElement; + } else { + jsc.warn('Invalid target element: \'' + targetElement + '\''); + } + + if (this.targetElement._jscLinkedInstance) { + jsc.warn('Cannot link jscolor twice to the same element. Skipping.'); + return; + } + this.targetElement._jscLinkedInstance = this; + + // Find the value element + this.valueElement = jsc.fetchElement(this.valueElement); + // Find the style element + this.styleElement = jsc.fetchElement(this.styleElement); + + var THIS = this; + var container = + this.container ? + jsc.fetchElement(this.container) : + document.getElementsByTagName('body')[0]; + var sliderPtrSpace = 3; // px + + // For BUTTON elements it's important to stop them from sending the form when clicked + // (e.g. in Safari) + if (jsc.isElementType(this.targetElement, 'button')) { + if (this.targetElement.onclick) { + var origCallback = this.targetElement.onclick; + this.targetElement.onclick = function (evt) { + origCallback.call(this, evt); + return false; + }; + } else { + this.targetElement.onclick = function () { return false; }; + } + } + + /* + var elm = this.targetElement; + do { + // If the target element or one of its offsetParents has fixed position, + // then use fixed positioning instead + // + // Note: In Firefox, getComputedStyle returns null in a hidden iframe, + // that's why we need to check if the returned style object is non-empty + var currStyle = jsc.getStyle(elm); + if (currStyle && currStyle.position.toLowerCase() === 'fixed') { + this.fixed = true; + } + + if (elm !== this.targetElement) { + // attach onParentScroll so that we can recompute the picker position + // when one of the offsetParents is scrolled + if (!elm._jscEventsAttached) { + jsc.attachEvent(elm, 'scroll', jsc.onParentScroll); + elm._jscEventsAttached = true; + } + } + } while ((elm = elm.offsetParent) && !jsc.isElementType(elm, 'body')); + */ + + // valueElement + if (this.valueElement) { + if (jsc.isElementType(this.valueElement, 'input')) { + var updateField = function () { + THIS.fromString(THIS.valueElement.value, jsc.leaveValue); + jsc.dispatchFineChange(THIS); + }; + jsc.attachEvent(this.valueElement, 'keyup', updateField); + jsc.attachEvent(this.valueElement, 'input', updateField); + jsc.attachEvent(this.valueElement, 'blur', blurValue); + this.valueElement.setAttribute('autocomplete', 'off'); + } + } + + // styleElement + if (this.styleElement) { + this.styleElement._jscOrigStyle = { + backgroundImage : this.styleElement.style.backgroundImage, + backgroundColor : this.styleElement.style.backgroundColor, + color : this.styleElement.style.color + }; + } + + if (this.value) { + // Try to set the color from the .value option and if unsuccessful, + // export the current color + this.fromString(this.value) || this.exportColor(); + } else { + this.importColor(); + } + } + +}; + + +//================================ +// Public properties and methods +//================================ + + +// By default, search for all elements with class="jscolor" and install a color picker on them. +// +// You can change what class name will be looked for by setting the property jscolor.lookupClass +// anywhere in your HTML document. To completely disable the automatic lookup, set it to null. +// +jsc.jscolor.lookupClass = 'jscolor'; + + +jsc.jscolor.installByClassName = function (className) { + var inputElms = document.getElementsByTagName('input'); + var buttonElms = document.getElementsByTagName('button'); + + jsc.tryInstallOnElements(inputElms, className); + jsc.tryInstallOnElements(buttonElms, className); +}; + + +jsc.register(); + + +return jsc.jscolor; + + +})(); } diff --git a/web/sendcmd.php b/web/sendcmd.php new file mode 100644 index 0000000..80de312 --- /dev/null +++ b/web/sendcmd.php @@ -0,0 +1,23 @@ + -- cgit v1.2.3