예제 #1
0
void MainWindow::createDeclarativeView()
{
    m_tweetListModel = new TweetQmlListModel(m_oauthTwitter);
    //connect user stream to tweet home timeline
    connect(m_userStream, SIGNAL(statusesStream(QTweetStatus)),
            m_tweetListModel, SLOT(onStatusesStream(QTweetStatus)));
    connect(m_userStream, SIGNAL(deleteStatusStream(qint64,qint64)),
            m_tweetListModel, SLOT(onDeleteStatusStream(qint64,qint64)));
    // ### TODO: Test for syncing problems
    connect(m_userStream, SIGNAL(reconnected()),
            m_tweetListModel, SLOT(fetchLastTweets()));
    //try using REST API when streams fails
    connect(m_userStream, SIGNAL(failureConnect()),
            m_tweetListModel, SLOT(fetchLastTweets()));

    m_mentionsListModel = new MentionsQmlListModel(m_oauthTwitter);
    connect(m_userStream, SIGNAL(statusesStream(QTweetStatus)),
            m_mentionsListModel, SLOT(onStatusesStream(QTweetStatus)));
    connect(m_userStream, SIGNAL(deleteStatusStream(qint64,qint64)),
            m_mentionsListModel, SLOT(onDeleteStatusStream(qint64,qint64)));
    connect(m_userStream, SIGNAL(reconnected()),
            m_mentionsListModel, SLOT(fetchLastTweets()));

    m_directMessagesListModel = new DirectMessagesQmlListModel(m_oauthTwitter);
    connect(m_userStream, SIGNAL(directMessageStream(QTweetDMStatus)),
            m_directMessagesListModel, SLOT(onDirectMessageStream(QTweetDMStatus)));

    m_searchListModel = new SearchQmlListModel(m_oauthTwitter);

    m_userInfo = new UserInfo;
    m_userInfo->setOAuthTwitter(m_oauthTwitter);
    connect(m_userStream, SIGNAL(friendsList(QList<qint64>)),
            m_userInfo, SLOT(onUserStreamFriendsList(QList<qint64>)));

    m_userTimelineListModel = new UserTimelineListModel(m_oauthTwitter);

    m_conversationListModel = new ConversationListModel(m_oauthTwitter);

    rootContext()->setContextProperty("hometimelineListModel", m_tweetListModel);
    rootContext()->setContextProperty("mentionsListModel", m_mentionsListModel);
    rootContext()->setContextProperty("directMessagesListModel", m_directMessagesListModel);
    rootContext()->setContextProperty("searchListModel", m_searchListModel);
    rootContext()->setContextProperty("userInfo", m_userInfo);
    rootContext()->setContextProperty("userTimelineListModel", m_userTimelineListModel);
    rootContext()->setContextProperty("conversationListModel", m_conversationListModel);
    rootContext()->setContextProperty("rootWindow", this);

    //setSource(QUrl::fromLocalFile("qml/QTwitdget/Main.qml"));
    setMainQmlFile(QLatin1String("qml/QTwitdget/Main.qml"));
}
예제 #2
0
void ProviderWindow::saveAction()
{

try
{
	if(record != NULL)
		dbwrite();

	if(record != NULL)
	{
		if(record->getType() == PROVIDER_NEW)
			emit newComplete();
		else
			emit editComplete();

		delete record;
		record = NULL;
	}
	close();
}
catch(pqxx::broken_connection)
{
		DBErrorWindow *dialog = new DBErrorWindow(this, database);
		dialog->setAttribute(Qt::WA_DeleteOnClose,true);

		connect(dialog,SIGNAL(reconnected()),this,SLOT(saveAction()));

		dialog->exec();
}



}
예제 #3
0
파일: NodeInput.cpp 프로젝트: GenaBitu/NIMP
void NodeInput::removeConnection(NodeOutput* connection)
{
    if(this->connection == connection)
    {
        this->connection = nullptr;
        emit reconnected();
    }
}
예제 #4
0
파일: NodeInput.cpp 프로젝트: GenaBitu/NIMP
void NodeInput::setConnection(NodeOutput* connection)
{
    if(this->connection != nullptr)
    {
        this->connection->removeConnection(this);
    }
    this->connection = connection;
    emit reconnected();
}
예제 #5
0
void RDSqlDatabaseStatus::sendRecon()
{
  if (discon){
    discon = false;
    emit reconnected();
    fprintf (stderr,"Database connection restored.\n");
    emit logText(RDConfig::LogErr,QString(tr("Database connection restored.")));
  }
}
예제 #6
0
void QTweetUserStream::replyReadyRead()
{
    QByteArray response = m_reply->readAll();

#ifdef STREAM_LOGGER
    m_streamLog.write(response);
    m_streamLog.write("\n");
#endif

    if (m_streamTryingReconnect) {
        emit reconnected();
        m_streamTryingReconnect = false;
    }

    //set backoff timer to initial interval
    m_backofftimer->setInterval(20000);

    QByteArray responseWithPreviousCache = response.prepend(m_cachedResponse);

    int start = 0;
    int end;

    while ((end = responseWithPreviousCache.indexOf('\r', start)) != -1) {
        if (start != end) {
            QByteArray element = responseWithPreviousCache.mid(start, end - start);

            if (!element.isEmpty()) {
                emit stream(element);
                parseStream(element);
            }
        }

        int skip = (response.at(end + 1) == QLatin1Char('\n')) ? 2 : 1;
        start = end + skip;
    }

    //undelimited part just cache it
    m_cachedResponse.clear();

    if (start != responseWithPreviousCache.size()) {
        QByteArray element = responseWithPreviousCache.mid(start);
        if (!element.isEmpty())
            m_cachedResponse = element;
    }
}
예제 #7
0
void ProviderWindow::setEditBoxData()
{
try
{
	// set the active check box.
	if(record->getDataItem(Provider::active) == "Y")
		provideractiveCheckBox->setChecked(true);
	else
		provideractiveCheckBox->setChecked(false);

	// Standard Read in data. If it's null, doesn't matter, Provider class gives a "" string.
	// not  == NULL;
	codeEdit->setText(QString::fromStdString(record->getDataItem(Provider::code)));
	lastnameEdit->setText(QString::fromStdString(record->getDataItem(Provider::lastname)));
	firstnameEdit->setText(QString::fromStdString(record->getDataItem(Provider::firstname)));
	middleiEdit->setText(QString::fromStdString(record->getDataItem(Provider::middlei)));
	street1Edit->setText(QString::fromStdString(record->getDataItem(Provider::street1)));
	street2Edit->setText(QString::fromStdString(record->getDataItem(Provider::street2)));
	cityEdit->setText(QString::fromStdString(record->getDataItem(Provider::city)));
	stateEdit->setText(QString::fromStdString(record->getDataItem(Provider::state)));
	zipcodeEdit->setText(QString::fromStdString(record->getDataItem(Provider::zipcode)));
	zipextEdit->setText(QString::fromStdString(record->getDataItem(Provider::zipext)));
	countryEdit->setText(QString::fromStdString(record->getDataItem(Provider::country)));
	homephoneEdit->setText(QString::fromStdString(record->getDataItem(Provider::homephone)));
	homeextEdit->setText(QString::fromStdString(record->getDataItem(Provider::homeext)));
	workphoneEdit->setText(QString::fromStdString(record->getDataItem(Provider::workphone)));
	workextEdit->setText(QString::fromStdString(record->getDataItem(Provider::workext)));
	mobilephoneEdit->setText(QString::fromStdString(record->getDataItem(Provider::mobilephone)));
	mobileextEdit->setText(QString::fromStdString(record->getDataItem(Provider::mobileext)));
	faxEdit->setText(QString::fromStdString(record->getDataItem(Provider::fax)));
	faxextEdit->setText(QString::fromStdString(record->getDataItem(Provider::faxext)));
	emailEdit->setText(QString::fromStdString(record->getDataItem(Provider::email)));
	ssnEdit->setText(QString::fromStdString(record->getDataItem(Provider::ssn)));
	licensenumberEdit->setText(QString::fromStdString(record->getDataItem(Provider::licensenumber)));
//	Edit->setText(QString::fromStdString(record->getDataItem(Provider::)));


	// Signature on file Read data
	if(record->getDataItem(Provider::signatureonfile) == "Y")
	{	sofCheckBox->setChecked(true);
		sofdateEdit->setEnabled(true);
	}
	else
	{	sofCheckBox->setChecked(false);
		sofdateEdit->setEnabled(false);
	}

	sexComboBox->setCurrentIndex(QString::fromStdString(record->getDataItem(Provider::sex)).toInt());

	//  Date read data
	datecreatedEdit->setDate(QDate::fromString(QString::fromStdString(record->getDataItem(Provider::datecreated)), "yyyy-MM-dd"));
	sofdateEdit->setDate(QDate::fromString(QString::fromStdString(record->getDataItem(Provider::sofdate)), "yyyy-MM-dd"));
	// End Date Reads


}
catch (pqxx::broken_connection)
{
		DBErrorWindow *dialog = new DBErrorWindow(this, database);
		dialog->setAttribute(Qt::WA_DeleteOnClose,true);

		connect(dialog,SIGNAL(reconnected()),this,SLOT(setEditBoxData()));

		dialog->exec();
}

}