예제 #1
0
void canvasView::mightSnap(QPainter *painter)
{
    if(state == READY)
    {
        if(model->snapper(start,snapDesc1))
        {
            snap = true;
            painter->save();
            painter->setBrush(QBrush(Qt::red));
            painter->drawEllipse(start,10,10);
            painter->setBrush(QBrush(Qt::blue));
            painter->drawEllipse(start,5,5);
            painter->restore();
            emit messageChanged(display,snapDesc1, "...",shape);
        }
        else snap = false;
    }
    else if(state == START)
    {
        if(model->snapper(end,snapDesc2))
        {
            snap = true;
            painter->save();
            painter->setBrush(QBrush(Qt::red));
            painter->drawEllipse(end,10,10);
            painter->setBrush(QBrush(Qt::blue));
            painter->drawEllipse(end,5,5);
            painter->restore();
            if(snapDesc1!="NA") emit messageChanged(display,snapDesc1,snapDesc2,shape);
        }
        else snap = false;
    }
}
void QtWebKitNetworkManager::requestFinished(QNetworkReply *reply)
{
	if (reply)
	{
		m_replies.remove(reply);
	}

	if (m_replies.isEmpty())
	{
		killTimer(m_updateTimer);

		m_updateTimer = 0;

		updateStatus();
	}

	++m_finishedRequests;

	if (reply)
	{
		emit messageChanged(tr("Completed request to %1").arg(reply->url().host().isEmpty() ? QLatin1String("localhost") : reply->url().host()));

		disconnect(reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(downloadProgress(qint64,qint64)));
	}
}
예제 #3
0
void canvasView::keyPressEvent(QKeyEvent *event)
{
    if(event->key() == Qt::Key_X){
        if(state==IDLE){
            state = READY;
            shape = LINE;
            highlight = display = true;
            start = mapFromGlobal(QCursor::pos());
        }
    }
    else if(event->key() == Qt::Key_C){
        if(state==IDLE){  
            state = READY;
            shape = CIRCLE;
            highlight = display =true;
            start = mapFromGlobal(QCursor::pos());
        }
    }
    else if(event->key() == Qt::Key_Escape){
            state = IDLE;
            highlight = snap = display = false;
            snapDesc1 = snapDesc2 = "NA";
            shape = UNDEFINED;
    }
    emit shapeChanged(this->shape);
    emit messageChanged(display,toString(start),"...",shape);
    update();
}
예제 #4
0
void tst_QMenu::statusTip()
{
    //check that the statustip of actions inserted into the menu are displayed
    QMainWindow w;
    connect(w.statusBar(), SIGNAL(messageChanged(QString)), SLOT(onStatusMessageChanged(QString)));; //creates the status bar
    QToolBar tb;
    QAction a("main action", &tb);
    a.setStatusTip("main action");
    QMenu m(&tb);
    QAction subact("sub action", &m);
    subact.setStatusTip("sub action");
    m.addAction(&subact);
    a.setMenu(&m);
    tb.addAction(&a);

    w.addToolBar(&tb);
    w.show();
    QVERIFY(QTest::qWaitForWindowExposed(&w));

    QRect rect1 = tb.actionGeometry(&a);
    QToolButton *btn = qobject_cast<QToolButton*>(tb.childAt(rect1.center()));

    QVERIFY(btn != NULL);

    //because showMenu calls QMenu::exec, we need to use a singleshot
    //to continue the test
    QTimer::singleShot(200,this, SLOT(onStatusTipTimer()));
    btn->showMenu();
    QVERIFY(statustip.isEmpty());
}
예제 #5
0
SplashScreen::SplashScreen(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::SplashScreen)
{
    ui->setupUi(this);
    setWindowTitle("pi|game CREATOR");
    setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint);
    setAttribute(Qt::WA_TranslucentBackground);

    ssInitThread = new initThread();

    QGraphicsDropShadowEffect* ds = new QGraphicsDropShadowEffect;
    ds->setBlurRadius(4);
    ds->setXOffset(1);
    ds->setYOffset(1);
    ds->setColor(Qt::black);
    ui->splashLabel->setGraphicsEffect(ds);
    canClose = true;

    initThread* t = new initThread;
    t->splash = this;
    connect(t,SIGNAL(finished()), this, SLOT(initcomplete()));
    connect(t,SIGNAL(terminated()), this, SLOT(initcomplete()));
    connect(t,SIGNAL(messageChanged(QString)),this,SLOT(setMessage(QString)));
    t->start();
}
예제 #6
0
void KexiNameDialog::init()
{
    d->checkIfObjectExists = false;
    d->allowOverwriting = false;
    d->validator = 0;
    setButtons(Ok | Cancel | Help);
    QGridLayout *lyr = new QGridLayout(mainWidget());
    d->icon = new QLabel(mainWidget());
    d->icon->setAlignment(Qt::AlignTop | Qt::AlignLeft);
    QSizePolicy sp(QSizePolicy::Fixed, QSizePolicy::Preferred);
    sp.setHorizontalStretch(1);
    d->icon->setSizePolicy(sp);
    d->icon->setFixedWidth(50);
    lyr->addWidget(d->icon, 0, 0);

    sp = QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
    sp.setHorizontalStretch(1);
    d->widget->setSizePolicy(sp);
    lyr->addWidget(d->widget, 0, 1);
    lyr->addItem(new QSpacerItem(25, 10, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 2);
    lyr->addItem(new QSpacerItem(5, 10, QSizePolicy::Minimum, QSizePolicy::Expanding), 1, 1);
// d->widget->captionLineEdit()->selectAll();
// d->widget->captionLineEdit()->setFocus();
    connect(d->widget, SIGNAL(messageChanged()), this, SLOT(updateSize()));
    updateSize();
    enableButtonOk(true);
    slotTextChanged();
    connect(d->widget, SIGNAL(textChanged()), this, SLOT(slotTextChanged()));
}
예제 #7
0
void ControlWindow::setupUi()
{
	setWindowTitle("StageDisplay Control");
	
	connect(ui->sourceBox, SIGNAL(textChanged(QString)), this, SLOT(setVideoSource(QString)));
	connect(ui->connectBtn, SIGNAL(clicked()), this, SLOT(connectSource()));
	
	connect(ui->outX, SIGNAL(valueChanged(int)), this, SLOT(setOutputX(int)));
	connect(ui->outY, SIGNAL(valueChanged(int)), this, SLOT(setOutputY(int)));
	connect(ui->outW, SIGNAL(valueChanged(int)), this, SLOT(setOutputW(int)));
	connect(ui->outH, SIGNAL(valueChanged(int)), this, SLOT(setOutputH(int)));
	
	connect(ui->timerEnabled, SIGNAL(toggled(bool)), 		this, SLOT(setTimerEnabled(bool)));
	connect(ui->currentTime, SIGNAL(valueChanged(int)), 		this, SLOT(setCurrentTime(int)));
	connect(ui->timerBtn, SIGNAL(clicked()), 			this, SLOT(timerBtn()));
	connect(ui->resetBtn, SIGNAL(clicked()), 			this, SLOT(resetTimerBtn()));
	connect(ui->timerFontSize, SIGNAL(valueChanged(int)), 		this, SLOT(timerFontSizeChanged(int)));
	connect(ui->timerDrawBg, SIGNAL(toggled(bool)), 		this, SLOT(timerDrawBgChanged(bool)));
	connect(ui->timerPosition, SIGNAL(currentIndexChanged(int)),	this, SLOT(timerPositionChanged(int)));
	
	connect(ui->message, SIGNAL(textChanged(QString)),		this, SLOT(messageChanged(QString)));
	connect(ui->showMsgBtn, SIGNAL(clicked()), 			this, SLOT(showMsgBtn()));
	connect(ui->hideMsgBtn, SIGNAL(clicked()), 			this, SLOT(hideMsgBtn()));
	connect(ui->flashMsgBtn, SIGNAL(toggled(bool)), 		this, SLOT(flashMsgBtnToggled(bool)));
	connect(ui->flashSpeed, SIGNAL(valueChanged(int)), 		this, SLOT(flashSpeedChanged(int)));
	connect(ui->msgFontSize, SIGNAL(valueChanged(int)), 		this, SLOT(msgFontSizeChanged(int)));
	connect(ui->msgDrawBg, SIGNAL(toggled(bool)), 			this, SLOT(msgDrawBgChanged(bool)));
	connect(ui->msgPosition, SIGNAL(currentIndexChanged(int)), 	this, SLOT(msgPositionChanged(int)));
}
예제 #8
0
void canvasView::mouseMoveEvent(QMouseEvent *event)
{
    if(event->type() == QEvent::MouseMove){
        if(state == READY)
        {
            start = event->pos();
            emit messageChanged(display,toString(start),"...",shape);
        }
        else if(state == START)
        {
            end = event->pos();
            if(snapDesc1 != "NA") emit messageChanged(display,snapDesc1,toString(end),shape);
            else emit messageChanged(display,toString(start),toString(end),shape);
        }
        update();
    }
}
예제 #9
0
void CreatePostLoader::setMessage(const QString &message)
{
    Q_D(CreatePostLoader);
    if(d->message != message) {
        d->message = message;
        emit messageChanged();
    }
}
예제 #10
0
void EventEditTest::shouldNotEmitWhenMessageIsNotChanged()
{
    MessageViewer::EventEdit edit;
    KMime::Message::Ptr msg(new KMime::Message);
    edit.setMessage(msg);
    QSignalSpy spy(&edit, SIGNAL(messageChanged(KMime::Message::Ptr)));
    edit.setMessage(msg);
    QCOMPARE(spy.count(), 0);
}
예제 #11
0
/*!
    Draws the \a message text onto the splash screen with color \a
    color and aligns the text according to the flags in \a alignment.

    \sa Qt::AlignmentFlags clear()
*/
void QSplashScreen::message( const QString &message, int alignment,
			     const QColor &color )
{
    d->currStatus = message;
    d->currAlign = alignment;
    d->currColor = color;
    emit messageChanged( d->currStatus );
    repaint();
}
예제 #12
0
void EventEditTest::shouldEmitMessageChanged()
{
    MessageViewer::EventEdit edit;
    QSignalSpy spy(&edit, SIGNAL(messageChanged(KMime::Message::Ptr)));
    KMime::Message::Ptr msg(new KMime::Message);
    edit.setMessage(msg);
    QCOMPARE(spy.count(), 1);
    QCOMPARE(spy.at(0).at(0).value<KMime::Message::Ptr>(), msg);
}
void JackContextGraphicsScene::loadMacro(const QString &fileName)
{
    macroFileName = fileName;
    waitForMacroPosition = true;
    // set a special cursor to show the user what we are waiting for:
    QApplication::setOverrideCursor(QCursor(Qt::CrossCursor));
    // also send a message for the user to read:
    messageChanged("Left-click anywhere in the canvas to place the macro to load. Click with any other mouse button to abort macro creation.");
}
예제 #14
0
bool QSplashScreen::qt_emit( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->signalOffset() ) {
    case 0: messageChanged((const QString&)static_QUType_QString.get(_o+1)); break;
    default:
	return QWidget::qt_emit(_id,_o);
    }
    return TRUE;
}
void JackContextGraphicsScene::createNewMacro()
{
    if (!waitForMacroPosition) {
        waitForMacroPosition = true;
        // set a special cursor to show the user what we are waiting for:
        QApplication::setOverrideCursor(QCursor(Qt::CrossCursor));
        // also send a message for the user to read:
        messageChanged("Left-click anywhere in the canvas to place the new macro. Click with any other mouse button to abort macro creation.");
    }
}
void QtWebKitNetworkManager::handleAuthenticationRequired(QNetworkReply *reply, QAuthenticator *authenticator)
{
	emit messageChanged(tr("Waiting for authentication…"));

	AuthenticationDialog *authenticationDialog = new AuthenticationDialog(reply->url(), authenticator, m_widget);
	authenticationDialog->setButtonsVisible(false);

	ContentsDialog dialog(Utils::getIcon(QLatin1String("dialog-password")), authenticationDialog->windowTitle(), QString(), QString(), (QDialogButtonBox::Ok | QDialogButtonBox::Cancel), authenticationDialog, m_widget);

	connect(&dialog, SIGNAL(accepted()), authenticationDialog, SLOT(accept()));
	connect(m_widget, SIGNAL(aboutToReload()), &dialog, SLOT(close()));

	m_widget->showDialog(&dialog);
}
예제 #17
0
void QtWebKitNetworkManager::downloadProgress(qint64 bytesReceived, qint64 bytesTotal)
{
	QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());

	if (reply && reply == m_baseReply)
	{
		if (m_baseReply->hasRawHeader(QStringLiteral("Location").toLatin1()))
		{
			m_baseReply = NULL;
		}
		else
		{
			if (bytesTotal > 0)
			{
				emit documentLoadProgressChanged(((bytesReceived * 1.0) / bytesTotal) * 100);
			}
			else
			{
				emit documentLoadProgressChanged(-1);
			}
		}
	}

	if (!reply || !m_replies.contains(reply))
	{
		return;
	}

	emit messageChanged(tr("Receiving data from %1…").arg(reply->url().host().isEmpty() ? QLatin1String("localhost") : reply->url().host()));

	const qint64 difference = (bytesReceived - m_replies[reply].first);

	m_replies[reply].first = bytesReceived;

	if (!m_replies[reply].second && bytesTotal > 0)
	{
		m_replies[reply].second = true;

		m_bytesTotal += bytesTotal;
	}

	if (difference <= 0)
	{
		return;
	}

	m_bytesReceived += difference;
	m_bytesReceivedDifference += difference;
}
예제 #18
0
void QtWebKitNetworkManager::requestFinished(QNetworkReply *reply)
{
	if (reply)
	{
		if (reply == m_baseReply)
		{
			if (reply->sslConfiguration().isNull())
			{
				m_sslInformation.certificate = QSslCertificate();
				m_sslInformation.cipher = QSslCipher();
			}
			else
			{
				m_sslInformation.certificate = reply->sslConfiguration().peerCertificate();
				m_sslInformation.cipher = reply->sslConfiguration().sessionCipher();
			}
		}

		m_replies.remove(reply);
	}

	if (m_replies.isEmpty())
	{
		killTimer(m_updateTimer);

		m_dateDownloaded = QDateTime::currentDateTime();
		m_updateTimer = 0;

		updateStatus();

		if ((m_isSecure == 1 || (m_isSecure == 0 && m_contentState.testFlag(WindowsManager::SecureContentState))) && m_sslInformation.errors.isEmpty())
		{
			m_contentState = WindowsManager::SecureContentState;
		}

		emit contentStateChanged(m_contentState);
	}

	++m_finishedRequests;

	if (reply)
	{
		emit messageChanged(tr("Completed request to %1").arg(reply->url().host().isEmpty() ? QLatin1String("localhost") : reply->url().host()));

		disconnect(reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(downloadProgress(qint64,qint64)));
	}
}
예제 #19
0
/*!
 *  \fn void MessageProgrammesDialog::loadTable(bool newMessage)
 *  \bief remplit le tableau en exploitant les données écrite dans le fichier programmes.txt
 *  \param[in] modification Indique si le chargement est du au chargement de la page ou a une modification
 *
 *  Si modification est vrai alors c'est qu'il y a eu du changement dans la programmation le
 *  programme envoi donc un signal afin de prévenir la fenetre principale.
 */
void MessageProgrammesDialog::loadTable(bool modification)
{
    if(modification) emit messageChanged();
    QStringList value;
    QFile fichier(Tools::absolutePathFile("src/programmes.txt"));
    if(fichier.open(QIODevice::ReadOnly | QIODevice::Text))
    {
        QTextStream flux(&fichier);
        while(flux.atEnd() == false)
            value.append(flux.readLine());
        fichier.close();
    }
    modele = new QStandardItemModel(value.size(),11,this);
    fullTable(value);
    configView();
    ui->messageTable->setModel(modele);
}
예제 #20
0
int QSplashScreen::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: messageChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 1: showMessage((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< const QColor(*)>(_a[3]))); break;
        case 2: showMessage((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 3: showMessage((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 4: clearMessage(); break;
        default: ;
        }
        _id -= 5;
    }
    return _id;
}
예제 #21
0
int QStatusBar::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: messageChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 1: showMessage((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 2: showMessage((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 3: clearMessage(); break;
        default: ;
        }
        _id -= 4;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< bool*>(_v) = isSizeGripEnabled(); break;
        }
        _id -= 1;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setSizeGripEnabled(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 1;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 1;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
void JackContextGraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent * mouseEvent)
{
    if (waitForMacroPosition || waitForModulePosition) {
        mouseEvent->accept();
        if (mouseEvent->button() == Qt::LeftButton) {
            if (waitForMacroPosition) {
                createNewMacro(mouseEvent->scenePos());
            } else if (waitForModulePosition) {
                createNewModule(factoryName, mouseEvent->scenePos());
            }
        }
        waitForMacroPosition = waitForModulePosition = false;
        // reset cursor and message to normal:
        QApplication::restoreOverrideCursor();
        messageChanged(QString());
    } else {
        QGraphicsScene::mousePressEvent(mouseEvent);
    }
}
예제 #23
0
void MessageView::setEmpty()
{
    markAsReadTimer->stop();
    m_envelope->setMessage(QModelIndex());
    headerSection->hide();
    message = QModelIndex();
    disconnect(this, SLOT(handleDataChanged(QModelIndex,QModelIndex)));
    tags->hide();
    if (viewer != emptyView) {
        layout->removeWidget(viewer);
        viewer->deleteLater();
        viewer = emptyView;
        viewer->show();
        layout->addWidget(viewer);
        emit messageChanged();
        m_loadingItems.clear();
        m_loadingSpinner->stop();
    }
}
예제 #24
0
void KexiNameDialog::init()
{
	QGridLayout *lyr = new QGridLayout(plainPage(), 2, 3);
	m_icon = new QLabel( plainPage(), "icon" );
	m_icon->setAlignment( int( AlignTop | AlignLeft ) );
	m_icon->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred,1,0));
	m_icon->setFixedWidth(50);
	lyr->addWidget(m_icon,0,0);

	m_widget->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred,1,0));
	lyr->addWidget(m_widget,0,1);
	lyr->addItem(new QSpacerItem( 25, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 2);
	lyr->addItem(new QSpacerItem( 5, 10, QSizePolicy::Minimum, QSizePolicy::Expanding ), 1, 1);
//	m_widget->captionLineEdit()->selectAll();
//	m_widget->captionLineEdit()->setFocus();
	connect(m_widget,SIGNAL(messageChanged()),this, SLOT(updateSize()));
	updateSize();
	enableButtonOK( true );
	slotTextChanged();
	connect(m_widget, SIGNAL(textChanged()), this, SLOT(slotTextChanged()));
}
void QtWebKitNetworkManager::handleProxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator)
{
	if (NetworkManagerFactory::isUsingSystemProxyAuthentication())
	{
		authenticator->setUser(QString());

		return;
	}

	emit messageChanged(tr("Waiting for authentication…"));

	AuthenticationDialog *authenticationDialog = new AuthenticationDialog(proxy.hostName(), authenticator, m_widget);
	authenticationDialog->setButtonsVisible(false);

	ContentsDialog dialog(Utils::getIcon(QLatin1String("dialog-password")), authenticationDialog->windowTitle(), QString(), QString(), (QDialogButtonBox::Ok | QDialogButtonBox::Cancel), authenticationDialog, m_widget);

	connect(&dialog, SIGNAL(accepted()), authenticationDialog, SLOT(accept()));
	connect(m_widget, SIGNAL(aboutToReload()), &dialog, SLOT(close()));

	m_widget->showDialog(&dialog);
}
예제 #26
0
void DNSSECTest::setMessage(const QString &message)
{
    strncpy(m_msgBuffer, message.toAscii().data(), sizeof(m_msgBuffer)-1);
    emit messageChanged();
    emit messageChanged(message);
}
예제 #27
0
/*!
    Removes the message being displayed on the splash screen

    \sa showMessage()
 */
void QSplashScreen::clearMessage()
{
    d_func()->currStatus.clear();
    emit messageChanged(d_func()->currStatus);
    repaint();
}
예제 #28
0
QNetworkReply* QtWebKitNetworkManager::createRequest(QNetworkAccessManager::Operation operation, const QNetworkRequest &request, QIODevice *outgoingData)
{
	if (request.url() == m_formRequestUrl)
	{
		m_formRequestUrl = QUrl();

		m_widget->openFormRequest(request.url(), operation, outgoingData);

		return QNetworkAccessManager::createRequest(QNetworkAccessManager::GetOperation, QNetworkRequest());
	}

	const QString host = request.url().host();

	if (!m_widget->isNavigating() && ContentBlockingManager::isUrlBlocked(m_widget->getContentBlockingProfiles(), request, m_widget->getUrl()))
	{
		Console::addMessage(QCoreApplication::translate("main", "Blocked request"), Otter::NetworkMessageCategory, LogMessageLevel, request.url().toString());

		QUrl url = QUrl();
		url.setScheme(QLatin1String("http"));

		if (m_blockedRequests.contains(host))
		{
			++m_blockedRequests[host];
		}
		else
		{
			m_blockedRequests[host] = 1;
		}

		return QNetworkAccessManager::createRequest(QNetworkAccessManager::GetOperation, QNetworkRequest(url));
	}

	++m_startedRequests;

	if (operation == GetOperation && request.url().isLocalFile() && QFileInfo(request.url().toLocalFile()).isDir())
	{
		return new LocalListingNetworkReply(this, request);
	}

	QNetworkRequest mutableRequest(request);

	if (!m_canSendReferrer)
	{
		mutableRequest.setRawHeader(QStringLiteral("Referer").toLatin1(), QByteArray());
	}

	if (operation == PostOperation && mutableRequest.header(QNetworkRequest::ContentTypeHeader).isNull())
	{
		mutableRequest.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("application/x-www-form-urlencoded"));
	}

	if (NetworkManagerFactory::isWorkingOffline())
	{
		mutableRequest.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysCache);
	}
	else if (m_doNotTrackPolicy != NetworkManagerFactory::SkipTrackPolicy)
	{
		mutableRequest.setRawHeader(QByteArray("DNT"), QByteArray((m_doNotTrackPolicy == NetworkManagerFactory::DoNotAllowToTrackPolicy) ? "1" : "0"));
	}

	mutableRequest.setRawHeader(QStringLiteral("Accept-Language").toLatin1(), (m_acceptLanguage.isEmpty() ? NetworkManagerFactory::getAcceptLanguage().toLatin1() : m_acceptLanguage.toLatin1()));
	mutableRequest.setHeader(QNetworkRequest::UserAgentHeader, m_userAgent);

	emit messageChanged(tr("Sending request to %1…").arg(host));

	QNetworkReply *reply = QNetworkAccessManager::createRequest(operation, mutableRequest, outgoingData);

	if (!m_baseReply)
	{
		m_baseReply = reply;
	}

	if (m_isSecure >= 0)
	{
		const QString scheme = reply->url().scheme();

		if (scheme == QLatin1String("https"))
		{
			m_isSecure = 1;
		}
		else if (scheme == QLatin1String("http"))
		{
			m_isSecure = -1;
		}
	}

	m_replies[reply] = qMakePair(0, false);

	connect(reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(downloadProgress(qint64,qint64)));

	if (m_updateTimer == 0)
	{
		m_updateTimer = startTimer(500);
	}

	return reply;
}
/* 
 *  Constructs a slider_rot which is a child of 'parent', with the 
 *  name 'name' and widget flags set to 'f'.
 */
panel_control_hand::panel_control_hand( QWidget* parent,  const char* name, Rchain_hand *pkinechain)
    : QWidget( parent, name)
{
   setCaption(tr("Qilex0.4 " ));
   grasp_number=0;
   if ( !name )
      setName( "joint_widget" );

       if ( !name )
	setName( "panel_joint" );

   setGeometry( QRect( 10, 10, 303, 840 ) );
   mainlayout = new QVBoxLayout( this, 11, 6, "mainlayout");

   if (pkinechain != NULL)
   {
      kinechain = pkinechain;
   }
   else
   {
      cerr << "kinechain is null" << endl;
      exit (1);
   }
//   parser = new QvalParser(kinechain);

   choice = new QButtonGroup (this,"Fingers");
   choice->setGeometry( 10, 10, 100, 100);
   choice->setTitle(tr("Fingers"));

   f0 = new QRadioButton("F1", choice);
   f0->move( 20, 20 );
   f0->setChecked(TRUE);
   f1 = new QRadioButton("F2", choice);
   f1->move( 80, 20 );
   f2 = new QRadioButton("F3", choice);
   f2->move( 140, 20 );
   f3 = new QRadioButton("F4", choice);
   f3->move( 200, 20 );

   choice->insert( f0,0 );
   choice->insert( f1,1 );
   choice->insert( f2,2 );
   choice->insert( f3,3 );

   dials_arm = new QGroupBox( this, "dials_arm" );
   dials_arm->setColumns(6);
   dials_arm->setOrientation(Qt::Vertical);
   dials_arm->layout()->setSpacing( 3 );
   dials_arm->layout()->setMargin( 3 );
   dials_arm->setTitle(tr("Arm's Joints"));

   dials_f0 = new QGroupBox( this, "dials_finger" );
   dials_f0->setColumns(4);
   dials_f0->setOrientation(Qt::Vertical);
   dials_f0->layout()->setSpacing( 3 );
   dials_f0->layout()->setMargin( 3 );
   dials_f0->setTitle(tr("Finger1's Joints"));

   dials_f1 = new QGroupBox( this, "dials_finger" );
   dials_f1->setColumns(4);
   dials_f1->setOrientation(Qt::Vertical);
   dials_f1->layout()->setSpacing( 3 );
   dials_f1->layout()->setMargin( 3 );
   dials_f1->setTitle(tr("Finger2's Joints"));

   dials_f2 = new QGroupBox( this, "dials_finger" );
   dials_f2->setColumns(4);
   dials_f2->setOrientation(Qt::Vertical);
   dials_f2->layout()->setSpacing( 3 );
   dials_f2->layout()->setMargin( 3 );
   dials_f2->setTitle(tr("Finger3's Joints"));

   dials_f3 = new QGroupBox( this, "dials_finger" );
   dials_f3->setColumns(4);
   dials_f3->setOrientation(Qt::Vertical);
   dials_f3->layout()->setSpacing( 3 );
   dials_f3->layout()->setMargin( 3 );
   dials_f3->setTitle(tr("Finger4's Joints"));

   ldial = new Qpanel_joint*[22];

   for(int i = 0; i< kinechain->n_same ; i++)
   {
      ldial[i] = new Qpanel_joint(dials_arm);
      ldial[i]->setLabelJoin(i + 1) ;
   }
   for(int i = kinechain->n_same; i< kinechain->n_same+4 ; i++)
   {
      ldial[i] = new Qpanel_joint(dials_f0);
      ldial[i]->setLabelJoin(i + 1) ;
   }
   for(int i=kinechain->n_same+4; i< kinechain->n_same+8 ; i++)
   {
      ldial[i] = new Qpanel_joint(dials_f1);
      ldial[i]->setLabelJoin(i + 1 - 4) ;
   }
   for(int i=kinechain->n_same+8; i< kinechain->n_same+12 ; i++)
   {
      ldial[i] = new Qpanel_joint(dials_f2);
      ldial[i]->setLabelJoin(i + 1 - 8) ;
   }
   for(int i = kinechain->n_same+12; i< kinechain->n_joint ; i++)
   {
      ldial[i] = new Qpanel_joint(dials_f3);
      ldial[i]->setLabelJoin(i + 1 - 12) ;
   }

   mainlayout->addWidget( dials_arm );
   mainlayout->addWidget( choice );
   mainlayout->insertWidget(2, dials_f0 );
   dials_f0->setShown(TRUE);
   mainlayout->insertWidget(2, dials_f1 );
   dials_f1->setHidden(TRUE);
   mainlayout->insertWidget(2, dials_f2 );
   dials_f2->setHidden(TRUE);
   mainlayout->insertWidget(2, dials_f3 );
   dials_f3->setHidden(TRUE);

   connect( f0, SIGNAL( clicked() ), this, SLOT( slot_finger0() ) );
   connect( f1, SIGNAL( clicked() ), this, SLOT( slot_finger1() ) );
   connect( f2, SIGNAL( clicked() ), this, SLOT( slot_finger2() ) );
   connect( f3, SIGNAL( clicked() ), this, SLOT( slot_finger3() ) );

   GroupBox = new QButtonGroup( this, "GroupBox" );
   GroupBox->setGeometry(10,10,100,100);
   GroupBox->setTitle(tr("Inverse kinematics"));

   kinematic = new QPushButton ( "kinematic", GroupBox );
   kinematic->setText("GO");
   kinematic->setGeometry(10,25,60,20);
   GroupBox->insert( kinematic );

   kinematic_retry = new QPushButton ( "kinematic_retry", GroupBox );
   kinematic_retry->setText("RETRY");
   kinematic_retry->setGeometry(10,50,60,20);
   GroupBox->insert( kinematic_retry );

   kinematic_where = new QPushButton ( "kinematic_stop", GroupBox );
   kinematic_where->setText("WHERE");
   kinematic_where->setGeometry(10,75,60,20);
   GroupBox->insert( kinematic_where );

   pushButton = new QPushButton( "pushButton", GroupBox );
   QPixmap buttonhome(gohome);
   pushButton->setPixmap(buttonhome);
   pushButton->setGeometry(10,100,60,20);
   GroupBox->insert( pushButton );

   TextLabelf0 = new QLabel( "TextLabelf0", GroupBox );
   TextLabelf0->setGeometry(90,25,30,20);
   TextLabelf0->setText( "F1" );

   TextLabelf1 = new QLabel( "TextLabelf1", GroupBox );
   TextLabelf1->setGeometry(90,50,30,20);
   TextLabelf1->setText( "F2" );

   TextLabelf2 = new QLabel( "TextLabelf2", GroupBox );
   TextLabelf2->setGeometry(90,75,30,20);
   TextLabelf2->setText( "F3" );

   TextLabelf3 = new QLabel( "TextLabelf3", GroupBox );
   TextLabelf3->setGeometry(90,100,30,20);
   TextLabelf3->setText( "F4" );

   select_f0 = new QComboBox (GroupBox, "select_f0" );
   select_f0->setGeometry(110,25,60,20);

   select_f1 = new QComboBox (GroupBox, "select_f1" );
   select_f1->setGeometry(110,50,60,20);

   select_f2 = new QComboBox (GroupBox, "select_f2" );
   select_f2->setGeometry(110,75,60,20);

   select_f3 = new QComboBox (GroupBox, "select_f3" );
   select_f3->setGeometry(110,100,60,20);

   select_f0->insertItem("None",0);
   select_f1->insertItem("None",0);
   select_f2->insertItem("None",0);
   select_f3->insertItem("None",0);
   
   comunic0 = new QPushButton ("sim_to_hand", GroupBox);
   comunic0->setText("Qilex->Hand");
   comunic0->setGeometry(180,25,95,20);
   GroupBox->insert( comunic0 );

   comunic1 = new QPushButton ("hand_to_sim", GroupBox);
   comunic1->setText("Hand->Qilex");
   comunic1->setGeometry(180,50,95,20);
   GroupBox->insert( comunic1 );

   comunic2 = new QPushButton ("sim_to_glove", GroupBox);
   comunic2->setText("Qilex->Glove");
   comunic2->setGeometry(180,75,95,20);
   GroupBox->insert( comunic2 );

   comunic3 = new QPushButton ("glove_to_sim", GroupBox);
   comunic3->setText("Glove->Qilex");
   comunic3->setGeometry(180,100,95,20);
   GroupBox->insert( comunic3 );

   comunic_stop = new QPushButton ("stop_comunications", GroupBox);
   comunic_stop->setText("STOP");
   comunic_stop->setGeometry(280,25,45,95);
   GroupBox->insert( comunic_stop );

   mainlayout->insertWidget(6,GroupBox);

   haySocket = 0;
   connect_error = 1;

   connect(pushButton, SIGNAL(clicked()), this, SLOT(slotmove_home()));
   connect(kinematic, SIGNAL(clicked()), this, SLOT(slotgo_inverse()));
   connect(kinematic_where, SIGNAL(clicked()), this, SLOT(slotwhere_inverse()));
   connect(kinematic_retry, SIGNAL(clicked()), this, SLOT(slotretry_inverse()));
   
   connect(comunic0, SIGNAL(clicked()), this, SLOT(crearSocketSlot()));
   connect(comunic_stop, SIGNAL(clicked()), this, SLOT(conexionStoppedSlot()));

   TextBrowser = new consoleWidget( this, "Terminal" );
   TextBrowser->setMinimumSize(330,120);
   mainlayout->addWidget(TextBrowser);

   connect(kinechain,SIGNAL(messageChanged(QString)),  TextBrowser, SLOT(insertLineAtEnd(QString)));
   kinechain->setconsole(TextBrowser);
}
예제 #30
0
파일: model.cpp 프로젝트: Aldrian/IHMc
void Model::SetMessage(QString newMessage, QString from)
{
    this->messageFrom=from;
    this->lastMessage=newMessage;
    emit messageChanged(lastMessage, messageFrom);
}