示例#1
0
  int main(const std::vector<std::string>& args)
  {
    ScopedLogMessage msg(" main() ", "start", "end");
 
    if(m_helpRequested)
      {
	displayHelp();
      }
    else
      {
	CommandDispatcher	commandDispatcher(msg);
 
	unsigned short port = (unsigned short) config().getInt("MyTCPServer.port", 9923);
	Poco::Net::ServerSocket svs(port);
	Poco::Net::TCPServer srv(new TCPConnectionFactory(msg, commandDispatcher),
				 svs, new Poco::Net::TCPServerParams);
	srv.start();
 
	// wait for CTRL-C or kill
	waitForTerminationRequest();
 
	srv.stop();
      }
    return Poco::Util::Application::EXIT_OK;
  }
PointInspectorWidget::PointInspectorWidget(
    const Curve::PointModel& model,
    const iscore::DocumentContext& doc,
    QWidget* parent):
    InspectorWidgetBase{model, doc, parent},
    m_model{model},
    m_dispatcher{commandDispatcher()->stack()}
{
    setObjectName("CurvePointInspectorWidget");
    setParent(parent);

    std::list<QWidget*> vec;
    auto cm = safe_cast<Curve::Model*>(m_model.parent());
    auto automModel_base = dynamic_cast<ProcessModel*>(cm->parent());
    if(!automModel_base)
        return;

    auto& automModel = *automModel_base;
    m_xFactor = automModel.duration().msec();
    m_Ymin = automModel.min();
    m_yFactor = automModel.max() - m_Ymin;

    // x box
    auto widgX = new QWidget;
    auto hlayX = new QHBoxLayout{widgX};
    m_XBox = new QDoubleSpinBox{};
    m_XBox->setRange(0., m_xFactor);
    m_XBox->setDecimals(0);

    m_XBox->setValue(m_model.pos().x() * m_xFactor);

    connect(m_XBox, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
            this, &PointInspectorWidget::on_pointChanged);

    connect(m_XBox, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
            this, &PointInspectorWidget::on_editFinished);

    vec.push_back(widgX);
    m_XBox->setSingleStep(m_xFactor/100);
    m_XBox->setEnabled(false);

    hlayX->addWidget(new QLabel{"t (ms)"});
    hlayX->addWidget(m_XBox);

    // y  box
    auto widgY = new QWidget;
    auto hlayY = new QHBoxLayout{widgY};
    m_YBox = new QDoubleSpinBox{};
    m_YBox->setRange(automModel.min(), automModel.max());
    m_YBox->setSingleStep(m_yFactor/100);
    m_YBox->setValue(m_model.pos().y() * m_yFactor  + m_Ymin);
    m_YBox->setDecimals(4); // NOTE : settings ?

    connect(m_YBox, SignalUtils::QDoubleSpinBox_valueChanged_double(),
            this, &PointInspectorWidget::on_pointChanged);

    connect(m_YBox, SignalUtils::QDoubleSpinBox_valueChanged_double(),
            this, &PointInspectorWidget::on_editFinished);
    vec.push_back(widgY);

    hlayY->addWidget(new QLabel{"value"});
    hlayY->addWidget(m_YBox);

    // y en %
/*    auto widgP = new QWidget;
    auto hlayP = new QHBoxLayout{widgP};
    auto spinP = new QDoubleSpinBox{};
    spinP->setRange(automModel.min(), automModel.max());
    spinP->setSingleStep(m_yFactor/100);
    spinP->setValue(m_model.pos().y());

    hlayP->addWidget(new QLabel{"value %"});
    hlayP->addWidget(spinP);

    vec.push_back(widgP);
*/
    vec.push_back(new QWidget{});

    updateAreaLayout(vec);
}