GuiWindow::GuiWindow(TiXmlNode* node) { assert( node->Type() == TiXmlNode::ELEMENT && strcmp( node->Value(), "window" ) == 0 ); // initialize window name _name = static_cast<TiXmlElement*>( node )->Attribute( "name" ); // initialize window panel initializePanel( node ); }
PanelConfig::PanelConfig(QWidget *parent) : QWidget(parent), ui(new Ui::PanelConfig) { ui->setupUi(this); connect(ui->configList, SIGNAL(currentRowChanged(int)), this, SLOT(selectConfig(int))); connect(ui->configTable, SIGNAL(cellClicked(int,int)), this, SLOT(selectDescription(int,int))); connect(this, SIGNAL(initializePanel(QMap<QString,QString>)), this, SLOT(initialize(QMap<QString,QString>))); connect(this, SIGNAL(messageIn(QByteArray)), this, SLOT(parseMessage(QByteArray))); connect(this, SIGNAL(connectionState(bool)), this, SLOT(updateConnectionState(bool))); }
PanelMonitor::PanelMonitor(QWidget *parent) : QWidget(parent), ui(new Ui::PanelMonitor) { ui->setupUi(this); ui->console->setReadOnly(true); ui->console->setMaximumBlockCount(1024); ui->console->setWordWrapMode(QTextOption::NoWrap); connect(ui->commandLine, SIGNAL(returnPressed()), this, SLOT(on_sendButton_clicked())); connect(this, SIGNAL(initializePanel(QMap<QString,QString>)), this, SLOT(initialize(QMap<QString,QString>))); connect(this, SIGNAL(messageIn(QByteArray)), this, SLOT(parseMessage(QByteArray))); connect(this, SIGNAL(connectionState(bool)), this, SLOT(updateConnectionState(bool))); }
PanelFirmware::PanelFirmware(QWidget *parent) : QWidget(parent), ui(new Ui::PanelFirmware) { ui->setupUi(this); scroll = false; upload = new QProcess(this); connect(this, SIGNAL(initializePanel(QMap<QString,QString>)), this, SLOT(initialize(QMap<QString,QString>))); connect(this, SIGNAL(messageIn(QByteArray)), this, SLOT(parseMessage(QByteArray))); connect(this, SIGNAL(connectionState(bool)), this, SLOT(updateConnectionState(bool))); connect(upload, SIGNAL(readyReadStandardOutput()), this, SLOT(printConsole())); connect(upload, SIGNAL(readyReadStandardError()), this, SLOT(printErrors())); connect(ui->webView->page(), SIGNAL(loadStarted()), this, SLOT(startFirmwareUpload())); connect(ui->webView->page(), SIGNAL(loadProgress(int)), this, SLOT(scrollToBottom(int))); connect(ui->webView->page(), SIGNAL(loadFinished(bool)), this, SLOT(downloadFirmware(bool))); connect(&networkManager, SIGNAL(finished(QNetworkReply *)), this, SLOT(firmwareDownloaded(QNetworkReply*))); QFont consoleFont = ui->console->font(); consoleFont.setPointSize(12); ui->console->setFont(consoleFont); ui->console->append("To return the board it's default factory configuration, select the Bootloader button. To upload existing firmware, select the Firmware button.\n\nTo create and upload new firmware, complete the selections below. You will need to be connected to the internet for this feature."); }
PanelPlot::PanelPlot(QWidget *parent) : QWidget(parent), ui(new Ui::PanelPlot) { connect(this, SIGNAL(initializePanel(QMap<QString,QString>)), this, SLOT(initialize(QMap<QString,QString>))); connect(this, SIGNAL(messageIn(QByteArray)), this, SLOT(parseMessage(QByteArray))); connect(this, SIGNAL(connectionState(bool)), this, SLOT(updateConnectionState(bool))); timeAxisLength = 15; // seconds ui->setupUi(this); ui->plotWindow->xAxis->setTickLabelType(QCPAxis::ltDateTime); ui->plotWindow->xAxis->setDateTimeFormat("hh:mm:ss"); ui->plotWindow->xAxis->setAutoTickStep(false); ui->plotWindow->xAxis->setTickStep(2); ui->plotWindow->axisRect()->setupFullAxesBox(); ui->plotWindow->autoAddPlottableToLegend(); ui->plotWindow->legend->setVisible(true); ui->plotWindow->axisRect()->insetLayout()->setInsetAlignment(0, Qt::AlignLeft|Qt::AlignTop); ui->plotWindow->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables); //Should we read this from file? colorNames.append("blue"); colorNames.append("red"); colorNames.append("green"); colorNames.append("orange"); colorNames.append("purple"); colorNames.append("brown"); colorNames.append("light blue"); colorNames.append("light red"); colorNames.append("lime"); colorNames.append("violet"); //setupPlotNames(0); connect(ui->plotWindow->xAxis, SIGNAL(rangeChanged(QCPRange)), ui->plotWindow->xAxis2, SLOT(setRange(QCPRange))); connect(ui->plotWindow->yAxis, SIGNAL(rangeChanged(QCPRange)), ui->plotWindow->yAxis2, SLOT(setRange(QCPRange))); connect(ui->plotTypes, SIGNAL(currentRowChanged(int)), this, SLOT(initializePlot(int))); connect(ui->plotTypes, SIGNAL(currentRowChanged(int)), this, SLOT(setupPlotNames(int))); connect(ui->plotNames, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(selectPlot(QListWidgetItem*))); }
GuiSlider::GuiSlider(TiXmlNode* node) { // retrieve name _name = static_cast<TiXmlElement*>( node )->Attribute( "name" ); // initialize control panel initializePanel( node ); // determine type of slider const char* orientation = static_cast<TiXmlElement*>( node )->Attribute( "orientation" ); assert( orientation ); if( strstr( orientation, "h" ) || strstr( orientation, "H" ) ) { _horizontal = true; } else if( strstr( orientation, "v" ) || strstr( orientation, "V" ) ) { _horizontal = false; } else { throw Exception( "Unknown slider type: \"%s\"", _name.c_str() ); } if( strstr( orientation, "r" ) || strstr( orientation, "R" ) ) { _reverse = true; } else { _reverse = false; } // search for scroll button _scrollButton = NULL; for( GuiPanelI panelI = _children.begin(); panelI != _children.end(); panelI++ ) { if( strcmp( (*panelI)->getName(), "ScrollButton" ) == 0 ) { _scrollButton = dynamic_cast<GuiButton*>( (*panelI)->getButton() ); } } assert( _scrollButton ); // initialize autos if( _horizontal ) { _lowerRect.left = 0; _lowerRect.top = 0; _lowerRect.right = _rect.bottom - _rect.top; _lowerRect.bottom = _lowerRect.right; _upperRect.left = ( _rect.right - _rect.left ) - _lowerRect.right; _upperRect.top = 0; _upperRect.right = ( _rect.right - _rect.left ); _upperRect.bottom = _lowerRect.right; } else { _lowerRect.left = 0; _lowerRect.top = 0; _lowerRect.right = _rect.right - _rect.left; _lowerRect.bottom = _lowerRect.right; _upperRect.left = 0; _upperRect.top = ( _rect.bottom - _rect.top ) - _lowerRect.bottom; _upperRect.right = _rect.right - _rect.left; _upperRect.bottom = ( _rect.bottom - _rect.top ); } if( _reverse ) { RECT temp = _lowerRect; _lowerRect = _upperRect; _upperRect = temp; } // update slider appearance _lowerLimit = 0; _upperLimit = 10; _pos = 0; _scrolling = false; updateAppearance(); }