void TCPServerProcessor::setPort(int port, bool doEmit )
{
    QMutexLocker lock(m_propertyMutex);
    m_port = port;
    lock.unlock();
    if( doEmit ) emit( portChanged(port) );
}
Ejemplo n.º 2
0
void Application::setPort(int port)
{
    if (m_port == port)
        return;
    m_port = port;
    emit portChanged(port);
}
Ejemplo n.º 3
0
void TcpSocket::setPort(int p)
{
    if(port != p){
        port = p;
        Q_EMIT portChanged(p);
    }
}
Ejemplo n.º 4
0
bool ProxyManager::load()
{
    if(!QFile::exists(this->_proxyfile))
        return false;

    QFile file(this->_proxyfile);

    if(!file.open(QFile::ReadOnly))
        return false;

    bool res = false;
    QStringList settings = QString::fromUtf8(file.readAll()).simplified().split(":");

    if(settings.length() == 2)
    {
        this->_host = settings.first();
        this->_port = settings.last().toInt();

        emit hostChanged();
        emit portChanged();

        res = true;
    }

    file.close();
    return res;
}
Ejemplo n.º 5
0
void NetworkDevice::setPort(const QString &port)
{
    if (m_port != port) {
        m_port = port;
        emit portChanged();
    }
}
Ejemplo n.º 6
0
void RDHPISoundSelector::selection(int selection)
{
  emit changed(selection/HPI_MAX_ADAPTERS,
	       selection-HPI_MAX_ADAPTERS*(selection/HPI_MAX_ADAPTERS));
  emit cardChanged(selection/HPI_MAX_ADAPTERS);
  emit portChanged(selection-HPI_MAX_ADAPTERS*(selection/HPI_MAX_ADAPTERS));
}
Ejemplo n.º 7
0
void Settings::setPort(int value)
{
    if (getPort() != value) {
        settings.setValue("port", value);
        emit portChanged();
    }
}
Ejemplo n.º 8
0
InterfaceHttp::InterfaceHttp(QWidget *parent) :
    NetworkInterface(parent),
    ui(new Ui::InterfaceHttp) {
    ui->setupUi(this);

    connect(ui->examples, SIGNAL(released()), SLOT(openExamples()));

    //HTTP server
    httpServer = new InterfaceHttpServer(this);
    connect(httpServer, SIGNAL(parseRequest(QNetworkReply*)), SLOT(parseRequest(QNetworkReply*)));
    connect(httpServer, SIGNAL(parseSocket(QTcpSocket*)),     SLOT(parseSocket(QTcpSocket*)));

    //Websockets server
    webSocketServer = new WebSocketServer(this);
    connect(webSocketServer, SIGNAL(newConnection()), SLOT(webSocketsNewConnection()));

    //Html template
    QFile htmlTemplateFile("Tools/HTML Template.html");
    if(htmlTemplateFile.open(QFile::ReadOnly)) {
        htmlTemplate = htmlTemplateFile.readAll();
        htmlTemplateFile.close();
    }

    //Interfaces link
    enable.setAction(ui->enable, "interfaceHttpEnable");
    port.setAction(ui->port,     "interfaceHttpPort");
    connect(&port, SIGNAL(triggered(qreal)), SLOT(portChanged()));
    port = 1236;
    webSocketsPort.setAction(ui->portWebSockets, "interfaceHttpWebSocketsPort");
    connect(&webSocketsPort, SIGNAL(triggered(qreal)), SLOT(portWebSocketsChanged()));
    webSocketsPort = 1237;
}
Ejemplo n.º 9
0
void ProxySettings::setPort(int value)
{
	QSettings s;
	s.beginGroup(group);
	s.setValue("proxy_port", value);
	prefs.proxy_port = value;
	emit portChanged(value);
}
Ejemplo n.º 10
0
void ProxyManager::setPort(int port)
{
    if(this->_port == port)
        return;

    this->_port = port;
    emit portChanged();
}
Ejemplo n.º 11
0
void MainRSTView::rePort()
{
    resetTransform();
    centerOn(father_->fx_, father_->fy_);
    scale(father_->sc_, father_->sc_);

    emit portChanged(width() / father_->sc_, height() / father_->sc_);
}
Ejemplo n.º 12
0
void Transfer::setPort(quint16 port)
{
    if (_port != port) {
        _port = port;
        SYNC(ARG(port));
        emit portChanged(port);
    }
}
Ejemplo n.º 13
0
void OSCReceiver::setPort(int port)
{
    // if (isRunning_) return;

    port_ = port;
    run();
    emit portChanged();
}
Ejemplo n.º 14
0
SerialMonitor::SerialMonitor(QWidget *parent) :
	QMainWindow(parent),
	ui(new Ui::SerialMonitor),
	subWindows(3),
	axesNames(3),
	baudRate(9600)
{
	ui->setupUi(this);

	//Establecemos el primer puerto encontrado como puerto de conexión
	setSerialPort(ui->menuSerialPorts->getDefaultPort());

	//El QtDesigner no la crea automáticamente
	connect(ui->menuSerialPorts, SIGNAL(portChanged(QString)), this, SLOT(setSerialPort(QString)));

	//Inicializamos los nombres de los ejes de cada curva
	axesNames[0] = (tr("x axis"));
	axesNames[1] = (tr("y axis"));
	axesNames[2] = (tr("z axis"));

	//Creamos las sub-ventanas del mdi
	subWindows[0] = new QMdiSubWindow;
	subWindows[1] = new QMdiSubWindow;
	subWindows[2] = new QMdiSubWindow;

	//Creamos las gráficas
	subWindows[0]->setWidget(new Plotter(tr("Gyroscope"), axesNames,this));
	subWindows[1]->setWidget(new Plotter(tr("Accelerometer"), axesNames,this));
	subWindows[2]->setWidget(new Plotter(tr("Magnetometer"), axesNames,this));
	//TODO: No se pueden cerrar
	//Desabilitamos cerrar, junto con minimizar y maximizar
	//subWindows[0]->setWindowFlags(Qt::CustomizeWindowHint);
	//subWindows[1]->setWindowFlags(Qt::CustomizeWindowHint);
	//subWindows[2]->setWindowFlags(Qt::CustomizeWindowHint);

	//Añadimos las gráficas al mdi y al menu
	for(int i = 0 ; i < subWindows.size() ; ++i){
		ui->mdiArea->addSubWindow(subWindows[i]);

		//Creamos la acción y la añadimos al menu
		checkableQAction *a = new checkableQAction(i, subWindows[i]->windowTitle(), this);
		a->setChecked(true);
		//Conectamos la señal de la acción
		connect(a, SIGNAL(toggledNum(int,bool)), this, SLOT(menuWindowsAction(int,bool)));
		ui->menuWindows->addAction(a);

		subWindows[i]->show();
	}

	//Conectamos las señales del hilo de Serial
	connect(&serial, SIGNAL(started()), this, SLOT(connectedSerial()));
	connect(&serial, SIGNAL(finished()), this, SLOT(disconnectedSerial()));
	connect(&serial, SIGNAL(terminated()), this, SLOT(disconnectedSerial()));
	connect(&serial, SIGNAL(readException(QString)), this, SLOT(readException(QString)));
	//Conectamos la señal de nueva trama para recoger las tramas
	qRegisterMetaType<Frame>("Frame");
	connect(&serial, SIGNAL(newFrame(Frame)), this, SLOT(newFrame(Frame)));
}
Ejemplo n.º 15
0
void InputSettingsWindow::setup() {
  panel = new QWidget;

  layout = new QVBoxLayout;
  layout->setMargin(0);
  layout->setSpacing(0);

  title = new QLabel("Input Configuration Editor");
  title->setProperty("class", "title");
  layout->addWidget(title);

  selection = new QHBoxLayout; {
    port = new QComboBox;
    port->addItem("Controller Port 1");
    port->addItem("Controller Port 2");
    port->addItem("User Interface");
    selection->addWidget(port);

    device = new QComboBox;
    selection->addWidget(device);
  }
  selection->setSpacing(Style::WidgetSpacing);
  layout->addLayout(selection);
  layout->addSpacing(Style::WidgetSpacing);

  list = new QTreeWidget;
  list->setColumnCount(3);
  list->setHeaderLabels(QStringList() << "Hidden" << "Name" << "Assignment");
  list->hideColumn(0);  //used for default sorting + hides child expansion box
  layout->addWidget(list);
  layout->addSpacing(Style::WidgetSpacing);

  controls = new QHBoxLayout; {
    assign = new QPushButton("Assign ...");
    controls->addWidget(assign);

    assignAll = new QPushButton("Assign All ...");
    controls->addWidget(assignAll);

    unassign = new QPushButton("Unassign");
    controls->addWidget(unassign);
  }
  controls->setSpacing(Style::WidgetSpacing);
  layout->addLayout(controls);

  panel->setLayout(layout);
  connect(port, SIGNAL(currentIndexChanged(int)), this, SLOT(portChanged()));
  connect(device, SIGNAL(currentIndexChanged(int)), this, SLOT(reloadList()));
  connect(list, SIGNAL(itemActivated(QTreeWidgetItem*, int)), this, SLOT(assignKey()));
  connect(list, SIGNAL(itemSelectionChanged()), this, SLOT(listChanged()));
  connect(assign, SIGNAL(released()), this, SLOT(assignKey()));
  connect(assignAll, SIGNAL(released()), this, SLOT(assignAllKeys()));
  connect(unassign, SIGNAL(released()), this, SLOT(unassignKey()));

  portChanged();
}
Ejemplo n.º 16
0
void checkChange (unsigned int oldValue, unsigned int newValue, unsigned char port)
{
	int change = oldValue ^ newValue;
	int i;
	for (i = 0; i<8;i++){
		if ((change & 0x01) == 1)
			portChanged(port, i);
		change >>= 1; 
	}
}
Ejemplo n.º 17
0
void OSCSender::setPort(int port)
{
    try {
        port_ = port;
        socket_.Connect(IpEndpointName(ip_.c_str(), port_));
        emit portChanged();
    } catch (const std::exception& e) {
        emit error(e.what());
    }
}
Ejemplo n.º 18
0
void Server::setPort(int arg)
{
    if (m_port == arg) return;
    m_port = arg;
    emit portChanged(arg);
    if (m_running) {
        stop();
        start();
    }
}
Ejemplo n.º 19
0
void SslClient::setPort(const QString &portString)
{
    bool ok = false;
    const int port = portString.toInt(&ok);

    if (!ok || (m_port == port))
        return;

    m_port = port;
    emit portChanged();
}
Ejemplo n.º 20
0
void IrcSession::setPort(int port)
{
    Q_D(IrcSession);
    if (isActive())
        qWarning("IrcSession::setPort() has no effect until re-connect");
    if (d->port != port)
    {
        d->port = port;
        emit portChanged(port);
    }
}
Ejemplo n.º 21
0
void MeeTv::_connected()
{
    disconnect(m_htsp, SIGNAL(connected()), this, SLOT(_connected()));
    disconnect(this, SIGNAL(activeChanged()), this, SLOT(_connectHtsp()));
    disconnect(m_settings, SIGNAL(hostnameChanged()), this, SLOT(_connectionSettingsChanged()));
    disconnect(m_settings, SIGNAL(portChanged()), this, SLOT(_connectionSettingsChanged()));

    connect(this, SIGNAL(activeChanged()), this, SLOT(_idleHandler()));

    if(m_settings->hasUsername() && m_settings->hasPassword())
        authenticate();
    m_htsp->enableAsync();
}
Ejemplo n.º 22
0
bool MClient::setPort(const quint16 &port){
    /*  se la porta è diverso da quella precedente                                                  */
    if(m_port != port){
        /*  cambio la porta                                                                         */
        m_port = port;
        /*  ed emetto il segnale                                                                    */
        emit portChanged(port);
        /*  ritorno true                                                                            */
        return true;
    }
    /*  altrimenti ritorno false                                                                    */
    return false;
}
Ejemplo n.º 23
0
void QQmlWebSocketServer::setPort(quint16 port)
{
    if (port == m_port) {
        return;
    }

    m_port = port;
    emit portChanged(port);
    emit urlChanged(url());

    if (m_componentCompleted && m_server->isListening()) {
        updateListening();
    }
}
Ejemplo n.º 24
0
bool KHost::ReadConfig()
{
	KConfig *config = ((KConnection*) topLevelWidget())->GetConfig();
	QStrList List;
	const char *Value;
	int i;

	if (config == NULL)
		return FALSE;

	config->setGroup(KI_SEC_HOSTS);

	config->readListEntry(KI_ENT_HOSTS,List);
	hostCombo->insertStrList(&List);

	List.clear();

	config->readListEntry(KI_ENT_PORTS,List);
	portCombo->insertStrList(&List);

	Value = config->readEntry(KI_ENT_LAST_HOST);

	if (Value != NULL && *Value != '\0')
		for (i = 0; i < hostCombo->count(); i++)
			if (!strcmp(Value,hostCombo->text(i)))
			{
				hostCombo->setCurrentItem(i);
				break;
			}

	Value = config->readEntry(KI_ENT_LAST_PORT);

	if (Value != NULL && *Value != '\0')
		for (i = 0; i < portCombo->count(); i++)
			if (!strcmp(Value,portCombo->text(i)))
			{
				portCombo->setCurrentItem(i);
				break;
			}

	hostChanged(0);
	portChanged(0);

	return TRUE;
}
Ejemplo n.º 25
0
bool KHost::WriteConfig()
{
	KConfig *config = ((KConnection*) topLevelWidget())->GetConfig();
	QStrList List;
	const char *Value;
	int i;

	if (config == NULL)
		return FALSE;

	hostChanged(0);
	portChanged(0);

	config->setGroup(KI_SEC_HOSTS);

	if ((Value = hostCombo->currentText()) != NULL && *Value != '\0' && List.find(Value) == -1)
		List.append(Value);

	for (i = 0; i < hostCombo->count(); i++)
		if (List.find(hostCombo->text(i)) == -1)
			List.append(hostCombo->text(i));

	config->writeEntry(KI_ENT_HOSTS,List);
	List.clear();

	if ((Value = portCombo->currentText()) != NULL && *Value != '\0' && List.find(Value) == -1)
		List.append(Value);

	for (i = 0; i < portCombo->count(); i++)
		if (List.find(portCombo->text(i)) == -1)
			List.append(portCombo->text(i));

	config->writeEntry(KI_ENT_PORTS,List);

	config->writeEntry(KI_ENT_LAST_HOST,hostCombo->currentText());
	config->writeEntry(KI_ENT_LAST_PORT,portCombo->currentText());

	return TRUE;
}
Ejemplo n.º 26
0
void WebServer::handleSettingsUpdate(const settings::type& type, const QJsonDocument& config)
{
	if(type == settings::WEBSERVER)
	{
		const QJsonObject& obj = config.object();

		_baseUrl = obj["document_root"].toString(WEBSERVER_DEFAULT_PATH);


		if ( (_baseUrl != ":/webconfig") && !_baseUrl.trimmed().isEmpty())
		{
			QFileInfo info(_baseUrl);
			if (!info.exists() || !info.isDir())
			{
				Error(_log, "document_root '%s' is invalid", _baseUrl.toUtf8().constData());
				_baseUrl = WEBSERVER_DEFAULT_PATH;
			}
		}
		else
			_baseUrl = WEBSERVER_DEFAULT_PATH;

		Debug(_log, "Set document root to: %s", _baseUrl.toUtf8().constData());
		_staticFileServing->setBaseUrl(_baseUrl);

		if(_port != obj["port"].toInt(WEBSERVER_DEFAULT_PORT))
		{
			_port = obj["port"].toInt(WEBSERVER_DEFAULT_PORT);
			stop();
		}

		// eval if the port is available, will be incremented if not
		if(!_server->isListening())
			NetUtils::portAvailable(_port, _log);

		start();
		emit portChanged(_port);
	}
}
Ejemplo n.º 27
0
MeeTv::MeeTv(QObject *parent) :
    QObject(parent)
{
#ifndef QT_SIMULATOR
    m_settings = new MeeTvSettingsGConf(this);
#else
    m_settings = new MeeTvSettingsHard(this);
#endif
    m_active = false;
    m_authenticationSettingsChanged = false;
    m_connecting = false;
    m_connectionSettingsChanged = false;

    connect(m_settings, SIGNAL(hostnameChanged()), this, SLOT(_connectionSettingsChanged()));
    connect(m_settings, SIGNAL(portChanged()), this, SLOT(_connectionSettingsChanged()));
    connect(this, SIGNAL(activeChanged()), this, SLOT(_connectHtsp()));

    connect(m_settings, SIGNAL(passwordChanged()), this, SLOT(_authenticationSettingsChanged()));
    connect(m_settings, SIGNAL(usernameChanged()), this, SLOT(_authenticationSettingsChanged()));

    m_idleTimer.setSingleShot(true);
    m_idleTimer.setMinimumInterval(60);
    m_idleTimer.setMaximumInterval(90);
}
Ejemplo n.º 28
0
InterfaceSerial::InterfaceSerial(QWidget *parent) :
    NetworkInterface(parent),
    ui(new Ui::InterfaceSerial) {
    ui->setupUi(this);
    port = 0;
    connect(ui->examples, SIGNAL(released()), SLOT(openExamples()));

    baudrateEnum << BAUD110;
    baudrateEnum << BAUD300;
    baudrateEnum << BAUD600;
    baudrateEnum << BAUD1200;
    baudrateEnum << BAUD2400;
    baudrateEnum << BAUD4800;
    baudrateEnum << BAUD9600;
    baudrateEnum << BAUD19200;
    baudrateEnum << BAUD38400;
    baudrateEnum << BAUD57600;
    baudrateEnum << BAUD115200;

    databitsEnum << DATA_5;
    databitsEnum << DATA_6;
    databitsEnum << DATA_7;
    databitsEnum << DATA_8;

    parityEnum   << PAR_NONE;
    parityEnum   << PAR_ODD;
    parityEnum   << PAR_EVEN;
    parityEnum   << PAR_SPACE;

    stopbitsEnum << STOP_1;
    stopbitsEnum << STOP_2;

    flowEnum     << FLOW_OFF;
    flowEnum     << FLOW_HARDWARE;
    flowEnum     << FLOW_XONXOFF;

    //Interfaces link
    enable.setAction(ui->enable, "interfaceSerialEnable");

    portName  .setAction(ui->portCombo,   "interfaceSerialPortname");
    portBaud  .setAction(ui->baudCombo,   "interfaceSerialBaud");
    portBits  .setAction(ui->bitsCombo,   "interfaceSerialBits");
    portParity.setAction(ui->parityCombo, "interfaceSerialParity");
    portStop  .setAction(ui->stopCombo,   "interfaceSerialStop");
    portFlow  .setAction(ui->flowCombo,   "interfaceSerialFlow");
    connect(&portName,   SIGNAL(triggered(QString)), SLOT(portChanged()));
    connect(&portBaud,   SIGNAL(triggered(qreal)),   SLOT(portChanged()));
    connect(&portBits,   SIGNAL(triggered(qreal)),   SLOT(portChanged()));
    connect(&portParity, SIGNAL(triggered(qreal)),   SLOT(portChanged()));
    connect(&portStop,   SIGNAL(triggered(qreal)),   SLOT(portChanged()));
    connect(&portFlow,   SIGNAL(triggered(qreal)),   SLOT(portChanged()));

    portBaud   = 10;
    portBits   = 3;
    portParity = 0;
    portStop   = 0;
    portFlow   = 0;

    connect(ui->enable, SIGNAL(toggled(bool)), SLOT(portChanged()));
    //Valeurs par défaut
    /*
    portStr = "COM1\nBAUD115200\nDATA_8\nPAR_NONE\nSTOP_1\nFLOW_OFF";
    portStr = "/dev/tty.usbmodemfa141\nBAUD115200\nDATA_8\nPAR_NONE\nSTOP_1\nFLOW_OFF";
    */

    timerEvent(0);
    startTimer(5000);
}
Ejemplo n.º 29
0
int SocketBase::setPort(int port) {
    _port = port;
    Q_EMIT portChanged(_port);
    return _port;
}
Ejemplo n.º 30
0
SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent) {

  okButton = new QPushButton(tr("&OK"));
  connect(okButton, SIGNAL(clicked()), this, SLOT(okButtonClicked()));
  okButton->setEnabled(false);
  cancelButton = new QPushButton(tr("&Cancel"));
  connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelButtonClicked()));

  host = "";
  port = "";
  url  = "";
  autoRefresh = Qt::Unchecked;
  interval = 3;

  hostLineEdit = new QLineEdit();
  hostLineEdit->setText(host);
  connect(hostLineEdit, SIGNAL(textChanged(QString)), this, SLOT(hostChanged(QString)));
  portLineEdit = new QLineEdit();
  portLineEdit->setText(port);
  connect(portLineEdit, SIGNAL(textChanged(QString)), this, SLOT(portChanged(QString)));
  urlLineEdit  = new QLineEdit();
  urlLineEdit->setText(url);
  connect(urlLineEdit, SIGNAL(textChanged(QString)), this, SLOT(urlChanged(QString)));
  intervalSpinBox = new QSpinBox();
  intervalSpinBox->setMaximum(600);
  intervalSpinBox->setMinimum(3);
  intervalSpinBox->setValue(interval);
  intervalSpinBox->setEnabled(false);
  connect(intervalSpinBox, SIGNAL(valueChanged(int)), this, SLOT(intervalChanged(int)));
  autoRefreshCheckBox = new QCheckBox();
  autoRefreshCheckBox->setCheckState(autoRefresh); 
  connect(autoRefreshCheckBox, SIGNAL(stateChanged(int)), this, SLOT(autoRefreshChanged(int)));
  

  hostLabel = new QLabel(tr("Host name: "));
  hostLabel->setBuddy(hostLineEdit);
  portLabel = new QLabel(tr("Port: "));
  portLabel->setBuddy(portLineEdit);
  urlLabel  = new QLabel(tr("URL: "));
  urlLabel->setBuddy(urlLineEdit);
  intervalLabel = new QLabel(tr("Interval: "));
  intervalLabel->setBuddy(intervalSpinBox);
  autoRefreshLabel = new QLabel(tr("Auto Refresh: "));
  autoRefreshLabel->setBuddy(autoRefreshCheckBox);


  //Layouts
  QHBoxLayout *buttonsLayout = new QHBoxLayout();
  buttonsLayout->addWidget(okButton);
  buttonsLayout->addWidget(cancelButton);

  QHBoxLayout *hostLayout = new QHBoxLayout();
  hostLayout->addWidget(hostLabel);
  hostLayout->addWidget(hostLineEdit);

  QHBoxLayout *portLayout = new QHBoxLayout();
  portLayout->addWidget(portLabel);
  portLayout->addWidget(portLineEdit);

  QHBoxLayout *urlLayout = new QHBoxLayout();
  urlLayout->addWidget(urlLabel);
  urlLayout->addWidget(urlLineEdit);

  QHBoxLayout *autoRefreshLayout = new QHBoxLayout();
  autoRefreshLayout->addWidget(autoRefreshLabel);
  autoRefreshLayout->addWidget(autoRefreshCheckBox);

  QHBoxLayout *intervalLayout = new QHBoxLayout();
  intervalLayout->addWidget(intervalLabel);
  intervalLayout->addWidget(intervalSpinBox);

  QVBoxLayout *itemsLayout = new QVBoxLayout();
  itemsLayout->addLayout(hostLayout);
  itemsLayout->addLayout(portLayout);
  itemsLayout->addLayout(urlLayout);
  itemsLayout->addLayout(autoRefreshLayout);
  itemsLayout->addLayout(intervalLayout);
  
  QVBoxLayout *mainLayout = new QVBoxLayout();
  mainLayout->addLayout(itemsLayout);
  mainLayout->addLayout(buttonsLayout);

  setLayout(mainLayout);
};