mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 03:29:44 -06:00
Add initial version of launcher
This commit is contained in:
66
apps/Launcher/CMakeLists.txt
Normal file
66
apps/Launcher/CMakeLists.txt
Normal file
@@ -0,0 +1,66 @@
|
||||
#########################################################################################
|
||||
# #
|
||||
# OpenSpace #
|
||||
# #
|
||||
# Copyright (c) 2014-2015 #
|
||||
# #
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy of this #
|
||||
# software and associated documentation files (the "Software"), to deal in the Software #
|
||||
# without restriction, including without limitation the rights to use, copy, modify, #
|
||||
# merge, publish, distribute, sublicense, and/or sell copies of the Software, and to #
|
||||
# permit persons to whom the Software is furnished to do so, subject to the following #
|
||||
# conditions: #
|
||||
# #
|
||||
# The above copyright notice and this permission notice shall be included in all copies #
|
||||
# or substantial portions of the Software. #
|
||||
# #
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, #
|
||||
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A #
|
||||
# PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT #
|
||||
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF #
|
||||
# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE #
|
||||
# OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #
|
||||
#########################################################################################
|
||||
|
||||
set(APPLICATION_NAME Launcher)
|
||||
set(APPLICATION_LINK_TO_OPENSPACE ON)
|
||||
|
||||
set(SOURCE_FILES
|
||||
${OPENSPACE_APPS_DIR}/Launcher/main.cpp
|
||||
${OPENSPACE_APPS_DIR}/Launcher/informationwidget.cpp
|
||||
${OPENSPACE_APPS_DIR}/Launcher/mainwindow.cpp
|
||||
${OPENSPACE_APPS_DIR}/Launcher/shortcutwidget.cpp
|
||||
${OPENSPACE_APPS_DIR}/Launcher/syncwidget.cpp
|
||||
)
|
||||
|
||||
set(HEADER_FILES
|
||||
${OPENSPACE_APPS_DIR}/Launcher/informationwidget.h
|
||||
${OPENSPACE_APPS_DIR}/Launcher/mainwindow.h
|
||||
${OPENSPACE_APPS_DIR}/Launcher/shortcutwidget.h
|
||||
${OPENSPACE_APPS_DIR}/Launcher/syncwidget.h
|
||||
)
|
||||
|
||||
find_package(Qt5Widgets)
|
||||
find_package(Qt5Network)
|
||||
|
||||
qt5_wrap_cpp(MOC_FILES ${HEADER_FILES})
|
||||
qt5_add_resources(RESOURCE_FILES ${OPENSPACE_APPS_DIR}/Launcher/files.qrc)
|
||||
|
||||
add_executable(${APPLICATION_NAME} MACOSX_BUNDLE
|
||||
${SOURCE_FILES}
|
||||
${HEADER_FILES}
|
||||
${MOC_FILES}
|
||||
${RESOURCE_FILES}
|
||||
)
|
||||
|
||||
target_link_libraries(${APPLICATION_NAME}
|
||||
Qt5::Widgets
|
||||
Qt5::Network
|
||||
)
|
||||
|
||||
if (APPLE)
|
||||
INSTALL(CODE "
|
||||
include(BundleUtilities)
|
||||
fixup_bundle(\"/Users/alex/Development/OpenSpace/bin/openspace/Debug/Launcher.app/Contents/MacOS/Launcher\" \"/Users/alex/Development/OpenSpace/bin/openspace/Debug/TimelineView.app/Contents/plugins/platforms/libqcocoa.dylib\" \"\")
|
||||
" COMPONENT Runtime)
|
||||
endif ()
|
||||
5
apps/Launcher/files.qrc
Normal file
5
apps/Launcher/files.qrc
Normal file
@@ -0,0 +1,5 @@
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
<file>images/header.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
BIN
apps/Launcher/images/header.png
Normal file
BIN
apps/Launcher/images/header.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
29
apps/Launcher/informationwidget.cpp
Normal file
29
apps/Launcher/informationwidget.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2015 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include "informationwidget.h"
|
||||
|
||||
InformationWidget::InformationWidget(QWidget* parent)
|
||||
: QTextEdit(parent)
|
||||
{}
|
||||
36
apps/Launcher/informationwidget.h
Normal file
36
apps/Launcher/informationwidget.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2015 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __INFORMATIONWIDGET_H__
|
||||
#define __INFORMATIONWIDGET_H__
|
||||
|
||||
#include <QTextEdit>
|
||||
|
||||
class InformationWidget : public QTextEdit {
|
||||
Q_OBJECT
|
||||
public:
|
||||
InformationWidget(QWidget* parent);
|
||||
};
|
||||
|
||||
#endif // __INFORMATIONWIDGET_H__
|
||||
155
apps/Launcher/main.cpp
Normal file
155
apps/Launcher/main.cpp
Normal file
@@ -0,0 +1,155 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2015 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
#include "mainwindow.h"
|
||||
|
||||
//static const QString style = R"style(
|
||||
//QWidget {
|
||||
// background-color: rgb(80, 80, 80);
|
||||
// font-family: Helvetica;
|
||||
//}
|
||||
//
|
||||
//QGroupBox {
|
||||
// background-color: qlineargradient(
|
||||
// x1: 0, y1: 0, x2: 0, y2: 1,
|
||||
// stop: 0 #858585,
|
||||
// stop: 1 #959595);
|
||||
// border: 2px solid gray;
|
||||
// border-radius: 5px;
|
||||
// margin-top: 4ex;
|
||||
// font-size: bold 12px;
|
||||
//}
|
||||
//
|
||||
//QGroupBox::title {
|
||||
// background-color: #E0E0E0;
|
||||
// border: 2px solid gray;
|
||||
// border-radius: 5px;
|
||||
// subcontrol-origin: margin;
|
||||
// subcontrol-position: top center;
|
||||
// padding: 0 10px;
|
||||
//}
|
||||
//
|
||||
//QLineEdit {
|
||||
// color: lightgray;
|
||||
//}
|
||||
//
|
||||
//QSlider::groove:horizontal {
|
||||
// border: 1px solid #999999;
|
||||
// height: 8px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */
|
||||
// background: qlineargradient(
|
||||
// x1:0, y1:0, x2:1, y2:0,
|
||||
// stop:0 #c4c4c4,
|
||||
// stop:0.5 #555555,
|
||||
// stop:1 #c4c4c4
|
||||
// );
|
||||
// margin: 2px 0;
|
||||
//}
|
||||
//
|
||||
//QSlider::handle:horizontal {
|
||||
// background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #b4b4b4, stop:1 #8f8f8f);
|
||||
// border: 1px solid #5c5c5c;
|
||||
// width: 18px;
|
||||
// margin: -2px 0; /* handle is placed by default on the contents rect of the groove. Expand outside the groove */
|
||||
// border-radius: 3px;
|
||||
//}
|
||||
//
|
||||
//QPushButton {
|
||||
// background-color: lightgray;
|
||||
// border-style: outset;
|
||||
// border-width: 0.5px;
|
||||
// border-radius: 5px;
|
||||
// border-color: black;
|
||||
// font: bold 12px;
|
||||
// min-width: 10em;
|
||||
//}
|
||||
//
|
||||
//QPushButton#connection {
|
||||
// background-color: lightgreen;
|
||||
//}
|
||||
//
|
||||
//QPushButton#connection:pressed {
|
||||
// background-color: green;
|
||||
//}
|
||||
//
|
||||
//
|
||||
//QPushButton#pause, QPushButton#play {
|
||||
// padding: 5px;
|
||||
//}
|
||||
//
|
||||
//QPushButton#pause:pressed, QPushButton#play:pressed, QPushButton:pressed {
|
||||
// background-color: darkgray;
|
||||
// border-style: inset;
|
||||
//}
|
||||
//
|
||||
//QCombobox {
|
||||
// border: 1px solid gray;
|
||||
// border-radius: 3px;
|
||||
// padding: 1px 18px 1px 3px;
|
||||
// min-width: 6em;
|
||||
//}
|
||||
//
|
||||
//QComboBox:editable {
|
||||
// background: lightgrey;
|
||||
//}
|
||||
//
|
||||
//QComboBox QAbstractItemView {
|
||||
// border: 2px solid darkgray;
|
||||
// border-radius: 5px;
|
||||
// background-color: #a8a8a8;
|
||||
// selection-background-color: #a8a8a8;
|
||||
//}
|
||||
//
|
||||
//QLabel#label {
|
||||
// font-size: 13px;
|
||||
// background-color: transparent;
|
||||
// font-variant: small-caps;
|
||||
//}
|
||||
//
|
||||
//QLabel#value {
|
||||
// font-family: monospace;
|
||||
// font-weight: bold;
|
||||
// font-size: 14px;
|
||||
// background-color: transparent;
|
||||
//}
|
||||
//
|
||||
//QWidget#background {
|
||||
// background-color: transparent;
|
||||
//}
|
||||
//
|
||||
//QTextEdit {
|
||||
// font-family: monospace;
|
||||
//}
|
||||
//)style";
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
QApplication app(argc, argv);
|
||||
|
||||
// app.setStyleSheet(style);
|
||||
MainWindow window;
|
||||
window.show();
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
377
apps/Launcher/mainwindow.cpp
Normal file
377
apps/Launcher/mainwindow.cpp
Normal file
@@ -0,0 +1,377 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2015 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include "informationwidget.h"
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QGridLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QThread>
|
||||
|
||||
namespace {
|
||||
const QSize WindowSize = QSize(640, 480);
|
||||
}
|
||||
|
||||
MainWindow::MainWindow()
|
||||
: QWidget(nullptr)
|
||||
, _informationWidget(nullptr)
|
||||
{
|
||||
setFixedSize(WindowSize);
|
||||
|
||||
QGridLayout* layout = new QGridLayout;
|
||||
|
||||
QLabel* image = new QLabel;
|
||||
QPixmap p = QPixmap(":/images/header.png");
|
||||
image->setPixmap(p.scaledToWidth(WindowSize.width()));
|
||||
layout->addWidget(image, 0, 0, 1, 2);
|
||||
|
||||
_informationWidget = new InformationWidget(this);
|
||||
layout->addWidget(_informationWidget, 1, 0, 2, 1);
|
||||
|
||||
QWidget* container = new QWidget;
|
||||
{
|
||||
QGridLayout* layout = new QGridLayout;
|
||||
|
||||
QLabel* shortcutLabel = new QLabel("Keyboard Shortcuts:");
|
||||
layout->addWidget(shortcutLabel, 0, 0);
|
||||
QPushButton* shortcutButton = new QPushButton("Open...");
|
||||
QObject::connect(shortcutButton, SIGNAL(clicked(bool)),
|
||||
this, SLOT(shortcutButtonPressed())
|
||||
);
|
||||
layout->addWidget(shortcutButton, 0, 1);
|
||||
|
||||
QLabel* sceneSelectionLabel = new QLabel("Scenes:");
|
||||
layout->addWidget(sceneSelectionLabel, 1, 0);
|
||||
QComboBox* sceneSelection = new QComboBox;
|
||||
layout->addWidget(sceneSelection);
|
||||
|
||||
container->setLayout(layout);
|
||||
}
|
||||
layout->addWidget(container, 1, 1);
|
||||
|
||||
container = new QWidget;
|
||||
{
|
||||
QBoxLayout* layout = new QHBoxLayout;
|
||||
|
||||
QPushButton* cancelButton = new QPushButton("Cancel");
|
||||
layout->addWidget(cancelButton);
|
||||
|
||||
QPushButton* syncButton = new QPushButton("Sync");
|
||||
layout->addWidget(syncButton);
|
||||
|
||||
QPushButton* startButton = new QPushButton("Start");
|
||||
layout->addWidget(startButton);
|
||||
|
||||
container->setLayout(layout);
|
||||
}
|
||||
layout->addWidget(container, 2, 1);
|
||||
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow() {
|
||||
delete _informationWidget;
|
||||
}
|
||||
|
||||
void MainWindow::shortcutButtonPressed() {
|
||||
|
||||
}
|
||||
|
||||
//MainWindow::MainWindow()
|
||||
// : QWidget(nullptr)
|
||||
// , _configurationWidget(nullptr)
|
||||
// , _timeControlWidget(nullptr)
|
||||
// , _informationWidget(nullptr)
|
||||
// , _timelineWidget(nullptr)
|
||||
// , _socket(nullptr)
|
||||
//{
|
||||
// setWindowTitle("OpenSpace Timeline");
|
||||
//
|
||||
// _configurationWidget = new ConfigurationWidget(this);
|
||||
// _configurationWidget->setMinimumWidth(350);
|
||||
// _timeControlWidget = new ControlWidget(this);
|
||||
// _timeControlWidget->setMinimumWidth(350);
|
||||
// _informationWidget = new InformationWidget(this);
|
||||
// _informationWidget->setMinimumWidth(350);
|
||||
// _timelineWidget = new TimelineWidget(this);
|
||||
//
|
||||
// QGridLayout* layout = new QGridLayout;
|
||||
// layout->addWidget(_configurationWidget, 0, 0);
|
||||
// layout->addWidget(_timeControlWidget, 1, 0);
|
||||
// layout->addWidget(_informationWidget, 2, 0);
|
||||
// layout->addWidget(_timelineWidget, 0, 1, 3, 1);
|
||||
//
|
||||
// layout->setColumnStretch(1, 5);
|
||||
//
|
||||
//
|
||||
// QObject::connect(
|
||||
// _configurationWidget, SIGNAL(connect(QString, QString)),
|
||||
// this, SLOT(onConnect(QString, QString))
|
||||
// );
|
||||
// QObject::connect(
|
||||
// _configurationWidget, SIGNAL(disconnect()),
|
||||
// this, SLOT(onDisconnect())
|
||||
// );
|
||||
//
|
||||
// QObject::connect(
|
||||
// _timeControlWidget, SIGNAL(scriptActivity(QString)),
|
||||
// this, SLOT(sendScript(QString))
|
||||
// );
|
||||
//
|
||||
// setLayout(layout);
|
||||
//
|
||||
// _configurationWidget->socketDisconnected();
|
||||
// _timeControlWidget->socketDisconnected();
|
||||
// _informationWidget->socketDisconnected();
|
||||
// _timelineWidget->socketDisconnected();
|
||||
//}
|
||||
//
|
||||
//MainWindow::~MainWindow() {
|
||||
// delete _socket;
|
||||
//}
|
||||
//
|
||||
//void MainWindow::onConnect(QString host, QString port) {
|
||||
// delete _socket;
|
||||
//
|
||||
// _socket = new QTcpSocket(this);
|
||||
// QObject::connect(_socket, SIGNAL(readyRead()), SLOT(readTcpData()));
|
||||
// QObject::connect(_socket, SIGNAL(connected()), SLOT(onSocketConnected()));
|
||||
// QObject::connect(_socket, SIGNAL(disconnected()), SLOT(onSocketDisconnected()));
|
||||
//
|
||||
// _socket->connectToHost(host, port.toUInt());
|
||||
//}
|
||||
//
|
||||
//void MainWindow::onDisconnect() {
|
||||
// delete _socket;
|
||||
// _socket = nullptr;
|
||||
//}
|
||||
//
|
||||
//void MainWindow::readTcpData() {
|
||||
// static const uint16_t MessageTypeStatus = 0;
|
||||
// static const uint16_t MessageTypePlayBookHongKang = 2;
|
||||
// static const uint16_t MessageTypePlayBookLabel = 3;
|
||||
//
|
||||
// QByteArray data = _socket->readAll();
|
||||
//
|
||||
// if (QString(data) == "Connected to SGCT!\r\n")
|
||||
// return;
|
||||
// if (QString(data) == "OK\r\n")
|
||||
// return;
|
||||
//
|
||||
// QByteArray messageTypeData = data.left(2);
|
||||
// union {
|
||||
// uint16_t value;
|
||||
// std::array<char, 2> data;
|
||||
// } messageType;
|
||||
// std::memcpy(messageType.data.data(), messageTypeData.data(), sizeof(uint16_t));
|
||||
//
|
||||
// switch (messageType.value) {
|
||||
// case MessageTypeStatus:
|
||||
// break;
|
||||
// case MessageTypePlayBookHongKang:
|
||||
// qDebug() << "Hong Kang Playbook received";
|
||||
// break;
|
||||
// case MessageTypePlayBookLabel:
|
||||
// qDebug() << "Label Playbook received";
|
||||
// break;
|
||||
// default:
|
||||
// qDebug() << "Unknown message of type '" << messageType.value << "'";
|
||||
// }
|
||||
//
|
||||
// switch (messageType.value) {
|
||||
// case MessageTypeStatus:
|
||||
// {
|
||||
// if (_hasHongKangTimeline && _hasLabelTimeline)
|
||||
// handleStatusMessage(data.mid(2));
|
||||
// break;
|
||||
// }
|
||||
// case MessageTypePlayBookHongKang:
|
||||
// case MessageTypePlayBookLabel:
|
||||
// {
|
||||
// const char* payloadDebug = data.mid(2).data();
|
||||
//
|
||||
// size_t beginning = 0;
|
||||
// uint32_t size = readFromBuffer<uint32_t>(data.mid(2).data(), beginning);
|
||||
//
|
||||
// //qDebug() << "Begin reading data";
|
||||
// while (_socket->waitForReadyRead() && data.size() < int(size)) {
|
||||
// //qDebug() << ".";
|
||||
// data = data.append(_socket->readAll());
|
||||
// //data = data.append(_socket->read(int(size) - data.size()));
|
||||
// QThread::msleep(50);
|
||||
// }
|
||||
// //qDebug() << "Finished reading data. Handling playbook";
|
||||
//
|
||||
// handlePlaybook(data.mid(2));
|
||||
//
|
||||
// //qDebug() << "Finished handling playbook";
|
||||
//
|
||||
// if (messageType.value == MessageTypePlayBookHongKang)
|
||||
// _hasHongKangTimeline = true;
|
||||
// if (messageType.value == MessageTypePlayBookLabel)
|
||||
// _hasLabelTimeline = true;
|
||||
//
|
||||
// if (_hasHongKangTimeline && _hasLabelTimeline) {
|
||||
// fullyConnected();
|
||||
// }
|
||||
//
|
||||
// break;
|
||||
// }
|
||||
// default:
|
||||
// qDebug() << QString(data);
|
||||
// }
|
||||
//
|
||||
//}
|
||||
//
|
||||
//void MainWindow::handleStatusMessage(QByteArray data) {
|
||||
// const char* buffer = data.data();
|
||||
//
|
||||
// union {
|
||||
// double value;
|
||||
// std::array<char, 8> buffer;
|
||||
// } et;
|
||||
// std::memmove(et.buffer.data(), buffer, sizeof(double));
|
||||
//
|
||||
// std::vector<char> timeString(24);
|
||||
// std::memmove(timeString.data(), buffer + sizeof(double), 24);
|
||||
//
|
||||
// union {
|
||||
// double value;
|
||||
// std::array<char, 8> buffer;
|
||||
// } delta;
|
||||
// std::memmove(delta.buffer.data(), buffer + sizeof(double) + 24, sizeof(double));
|
||||
//
|
||||
// _timeControlWidget->update(
|
||||
// QString::fromStdString(std::string(timeString.begin(), timeString.end())),
|
||||
// QString::number(delta.value)
|
||||
// );
|
||||
// _timelineWidget->setCurrentTime(std::string(timeString.begin(), timeString.end()), et.value);
|
||||
//}
|
||||
//
|
||||
//std::vector<std::string> instrumentsFromId(uint16_t instrumentId, std::map<uint16_t, std::string> instrumentMap) {
|
||||
// std::vector<std::string> results;
|
||||
// for (int i = 0; i < 16; ++i) {
|
||||
// uint16_t testValue = 1 << i;
|
||||
// if ((testValue & instrumentId) != 0) {
|
||||
// std::string t = instrumentMap.at(testValue);
|
||||
// if (t.empty())
|
||||
// qDebug() << "Empty instrument";
|
||||
// results.push_back(t);
|
||||
// }
|
||||
// }
|
||||
// return results;
|
||||
//}
|
||||
//
|
||||
//void MainWindow::handlePlaybook(QByteArray data) {
|
||||
// char* buffer = data.data();
|
||||
// size_t currentReadLocation = 0;
|
||||
//
|
||||
// uint32_t totalData = readFromBuffer<uint32_t>(buffer, currentReadLocation);
|
||||
//
|
||||
// uint8_t nTargets = readFromBuffer<uint8_t>(buffer, currentReadLocation);
|
||||
// qDebug() << "Targets: " << nTargets;
|
||||
// std::map<uint8_t, std::string> targetMap;
|
||||
// for (uint8_t i = 0; i < nTargets; ++i) {
|
||||
// uint8_t id = readFromBuffer<uint8_t>(buffer, currentReadLocation);
|
||||
// std::string value = readFromBuffer<std::string>(buffer, currentReadLocation);
|
||||
// qDebug() << QString::fromStdString(value);
|
||||
// targetMap[id] = value;
|
||||
// }
|
||||
//
|
||||
// uint8_t nInstruments = readFromBuffer<uint8_t>(buffer, currentReadLocation);
|
||||
// qDebug() << "Instruments: " << nInstruments;
|
||||
// std::map<uint16_t, std::string> instrumentMap;
|
||||
// for (uint8_t i = 0; i < nInstruments; ++i) {
|
||||
// uint16_t id = readFromBuffer<uint16_t>(buffer, currentReadLocation);
|
||||
// std::string value = readFromBuffer<std::string>(buffer, currentReadLocation);
|
||||
// qDebug() << QString::fromStdString(value);
|
||||
// instrumentMap[id] = value;
|
||||
// }
|
||||
//
|
||||
// uint32_t nImages = readFromBuffer<uint32_t>(buffer, currentReadLocation);
|
||||
// std::vector<Image> images;
|
||||
// for (uint32_t i = 0; i < nImages; ++i) {
|
||||
// Image image;
|
||||
// image.beginning = readFromBuffer<double>(buffer, currentReadLocation);
|
||||
// image.ending = readFromBuffer<double>(buffer, currentReadLocation);
|
||||
//
|
||||
// image.beginningString = readFromBuffer<std::string>(buffer, currentReadLocation);
|
||||
// image.endingString = readFromBuffer<std::string>(buffer, currentReadLocation);
|
||||
//
|
||||
// uint8_t targetId = readFromBuffer<uint8_t>(buffer, currentReadLocation);
|
||||
// uint16_t instrumentId = readFromBuffer<uint16_t>(buffer, currentReadLocation);
|
||||
// image.target = targetMap[targetId];
|
||||
// image.instruments = instrumentsFromId(instrumentId, instrumentMap);
|
||||
// if (image.instruments.empty())
|
||||
// qDebug() << "Instruments were empty";
|
||||
// images.push_back(image);
|
||||
// }
|
||||
//
|
||||
// _timelineWidget->setData(std::move(images), std::move(targetMap), std::move(instrumentMap));
|
||||
//
|
||||
//}
|
||||
//
|
||||
//void MainWindow::sendScript(QString script) {
|
||||
// if (_socket) {
|
||||
// _socket->write(("0" + script + "\r\n").toLatin1());
|
||||
// //QByteArray data = (QString("0") + script).toLocal8Bit();
|
||||
// //qDebug() << data;
|
||||
// //_socket->write(data);
|
||||
// //QThread::msleep(25);
|
||||
// }
|
||||
// //_socket->write(("0" + script + "\r\n").toLatin1());
|
||||
// //_socket->write(("0" + script + "\0").toLatin1());
|
||||
//}
|
||||
//
|
||||
//void MainWindow::onSocketConnected() {
|
||||
// _socket->write(QString("1\r\n").toLatin1());
|
||||
// //_socket->write(QString("1").toLatin1());
|
||||
//
|
||||
//}
|
||||
//
|
||||
//void MainWindow::onSocketDisconnected() {
|
||||
// _configurationWidget->socketDisconnected();
|
||||
// _timeControlWidget->socketDisconnected();
|
||||
// _informationWidget->socketDisconnected();
|
||||
// _timelineWidget->socketDisconnected();
|
||||
//
|
||||
// _informationWidget->logInformation("Disconnected.");
|
||||
//}
|
||||
//
|
||||
//std::string MainWindow::nextTarget() const {
|
||||
// return _timelineWidget->nextTarget();
|
||||
//}
|
||||
//
|
||||
//void MainWindow::fullyConnected() {
|
||||
// _informationWidget->logInformation("Connected to " + _socket->peerName() + " on port " + QString::number(_socket->peerPort()) + ".");
|
||||
//
|
||||
// _configurationWidget->socketConnected();
|
||||
// _timeControlWidget->socketConnected();
|
||||
// _informationWidget->socketConnected();
|
||||
// _timelineWidget->socketConnected();
|
||||
//}
|
||||
82
apps/Launcher/mainwindow.h
Normal file
82
apps/Launcher/mainwindow.h
Normal file
@@ -0,0 +1,82 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2015 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __MAINWINDOW_H__
|
||||
#define __MAINWINDOW_H__
|
||||
|
||||
#include <QWidget>
|
||||
#include <QTcpSocket>
|
||||
|
||||
class InformationWidget;
|
||||
|
||||
class MainWindow : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
MainWindow();
|
||||
~MainWindow();
|
||||
|
||||
private slots:
|
||||
void shortcutButtonPressed();
|
||||
|
||||
private:
|
||||
InformationWidget* _informationWidget;
|
||||
};
|
||||
|
||||
//class MainWindow : public QWidget {
|
||||
//Q_OBJECT
|
||||
//public:
|
||||
// MainWindow();
|
||||
// ~MainWindow();
|
||||
//
|
||||
// std::string nextTarget() const;
|
||||
//
|
||||
//public slots:
|
||||
// void sendScript(QString script);
|
||||
//
|
||||
//private slots:
|
||||
// void onConnect(QString host, QString port);
|
||||
// void onDisconnect();
|
||||
//
|
||||
// void onSocketConnected();
|
||||
// void onSocketDisconnected();
|
||||
//
|
||||
// void readTcpData();
|
||||
// void handleStatusMessage(QByteArray data);
|
||||
// void handlePlaybook(QByteArray data);
|
||||
//
|
||||
// void fullyConnected();
|
||||
//
|
||||
//private:
|
||||
// ConfigurationWidget* _configurationWidget;
|
||||
// ControlWidget* _timeControlWidget;
|
||||
// InformationWidget* _informationWidget;
|
||||
// TimelineWidget* _timelineWidget;
|
||||
//
|
||||
// QTcpSocket* _socket;
|
||||
//
|
||||
// bool _hasHongKangTimeline = false;
|
||||
// bool _hasLabelTimeline = false;
|
||||
//};
|
||||
|
||||
#endif // __MAINWINDOW_H__
|
||||
29
apps/Launcher/shortcutwidget.cpp
Normal file
29
apps/Launcher/shortcutwidget.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2015 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include "shortcutwidget.h"
|
||||
|
||||
ShortcutWidget::ShortcutWidget(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
{}
|
||||
36
apps/Launcher/shortcutwidget.h
Normal file
36
apps/Launcher/shortcutwidget.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2015 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __SHORTCUTWIDGET_H__
|
||||
#define __SHORTCUTWIDGET_H__
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class ShortcutWidget : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ShortcutWidget(QWidget* parent);
|
||||
};
|
||||
|
||||
#endif // __SHORTCUTWIDGET_H__
|
||||
25
apps/Launcher/syncwidget.cpp
Normal file
25
apps/Launcher/syncwidget.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2015 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include "syncwidget.h"
|
||||
34
apps/Launcher/syncwidget.h
Normal file
34
apps/Launcher/syncwidget.h
Normal file
@@ -0,0 +1,34 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2015 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __SYNCWIDGET_H__
|
||||
#define __SYNCWIDGET_H__
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class SyncWidget : public QWidget {
|
||||
|
||||
};
|
||||
|
||||
#endif // __SYNCWIDGET_H__
|
||||
Reference in New Issue
Block a user