Example #1
0
NewGraphDialog::NewGraphDialog(DBCHandler *handler, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::NewGraphDialog)
{
    ui->setupUi(this);

    dbcHandler = handler;

    connect(ui->colorSwatch, SIGNAL(clicked(bool)), this, SLOT(colorSwatchClick()));
    connect(ui->btnAddGraph, SIGNAL(clicked(bool)), this, SLOT(addButtonClicked()));

    // Seed the random generator with current time
    QTime time = QTime::currentTime();
    qsrand((uint)time.msec());

    QPalette p = ui->colorSwatch->palette();
    //using 160 instead of 255 so that colors are always at least a little dark
    p.setColor(QPalette::Button, QColor(qrand() % 160,qrand() % 160,qrand() % 160));
    ui->colorSwatch->setPalette(p);

    connect(ui->cbMessages, SIGNAL(currentIndexChanged(int)), this, SLOT(loadSignals(int)));
    connect(ui->cbSignals, SIGNAL(currentIndexChanged(int)), this, SLOT(fillFormFromSignal(int)));

    loadMessages();
}
Example #2
0
void QStreamCubeChat::onChannelInfoLoaded()
{
    QNetworkReply * reply = qobject_cast< QNetworkReply * >( sender() );

    QJsonParseError parseError;

    QJsonDocument jsonDoc = QJsonDocument::fromJson( reply->readAll(), &parseError );

    if( QJsonParseError::NoError == parseError.error && jsonDoc.isArray() )
    {
        QJsonArray jsonArr = jsonDoc.array();

        channelId_ = jsonArr[ 0 ].toString();

        if( isShowSystemMessages() )
        {
            emit newMessage( ChatMessage( SERVICE_NAME, SERVICE_USER_NAME, tr( "Connected to " ) + channelName_ + tr( "..." ), QString(), this ) );
            emitSystemMessage( SERVICE_NAME, SERVICE_USER_NAME, tr( "Connected to " ) + channelName_ + tr( "..." ) );
        }

        loadMessages();
        startUniqueTimer( updateTimerId_, UPDATE_INTERVAL );
    }

    reply->deleteLater();
}
void AuthorizationDialog::request(const UserInfo &userInfo)
{
	this->userInfo = userInfo;

	topLabel->setText(tr(REQUEST_TOP_LABEL).arg(userInfo.getDisplayName()));

	messageEdit->setPlainText(tr(REQUEST_DEFAULT_TEXT));
	messageEdit->setReadOnly(false);
	messageEdit->setFocus();
	messageEdit->selectAll();
	
	connect(messageEdit, SIGNAL(textChanged()), this, SLOT(checkMessages()));
	loadMessages();

	okButton->setText(tr(REQUEST_OK_BUTTON));
	rejectButton->hide();
	cancelButton->setText(tr(REQUEST_CANCEL_BUTTON));

	// Set widget info about yourself
	UserAccount currentUser = INFOMANAGER->getUserAccount();
	authUserNameLabel->setText(currentUser.getDisplayName());
	
	contactAvatarToolButton->setThumbnailMode(false);
	contactAvatarToolButton->setContactId(currentUser.getId());

	mode = Request;
	
	show();
}
// virtual
bool LLMessageConfigFile::loadFile()
{
	LLSD data;
    {
        llifstream file(filename());
        
        if (file.is_open())
        {
			LL_DEBUGS("AppInit") << "Loading message.xml file at " << filename() << LL_ENDL;
            LLSDSerialize::fromXML(data, file);
        }

        if (data.isUndefined())
        {
            LL_INFOS("AppInit") << "LLMessageConfigFile::loadFile: file missing,"
				" ill-formed, or simply undefined; not changing the"
				" file" << LL_ENDL;
            return false;
        }
    }
	loadServerDefaults(data);
	loadMaxQueuedEvents(data);
	loadMessages(data);
	loadCapBans(data);
	loadMessageBans(data);
	return true;
}
Example #5
0
void MessageManager::reloadMessages(int contactId)
{
    qDebug() << QString("<MessageManager::loadContactMessages> Loading messages of contact %1").arg(contactId);

    mMessageModel.reset();

    mContactId = contactId;

    loadMessages(mContactId);
}
Example #6
0
void QStreamCubeChat::timerEvent( QTimerEvent * event )
{
    if( updateTimerId_ == event->timerId() )
    {
        loadMessages();
    }
    else if( reconnectTimerId_ == event->timerId() )
    {
        reconnect();
    }
}
Example #7
0
void MessageManager::loadMore()
{
    // simulate a network call, and its delay
    mMessageModel.setLoading(true);
    QTimer::singleShot(3000, [=](){
        if (mMessageModel.rowCount() > 0) {
            loadMessages(mContactId, mMessageModel.first()->timestamp());
        } else {
            mMessageModel.setLoading(false);
        }
    });
}
Example #8
0
void HiRes4Engine_Atari::loadCommonData() {
	_messages.clear();
	StreamPtr stream(createReadStream(_boot, 0x0a, 0x4, 0x00, 3));
	loadMessages(*stream, IDI_HR4_NUM_MESSAGES);

	_pictures.clear();
	stream.reset(createReadStream(_boot, 0x05, 0xe, 0x80));
	loadPictures(*stream);

	_itemPics.clear();
	stream.reset(createReadStream(_boot, 0x09, 0xe, 0x05));
	loadItemPictures(*stream, IDI_HR4_NUM_ITEM_PICS);
}
Example #9
0
	void GameState::loadLevel()
	{
		mPlayer.resetRotation();
		mPlayer.setPosition({ 100.f, 50.f });
		mPlayer.setVelocity({ 0.f, 0.f });
		//Load the map
		mMap.load(mPath);
		std::vector<std::string> message;
		loadMessages(mPath, "message", message);
		//Init intro message
		mIntroMessage.setMessage(message, "Press enter to start the game!");
		//Setup the default view for the camera
		mCamera.setDefaultView(mWindow.getDefaultView());
	}
Example #10
0
File: MPF.cpp Project: aaly/MPF
int MPF::changePage(int direction)
{

	
	if (groups.at(currentGroup)->currentPage+direction < 0
		|| groups.at(currentGroup)->currentPage+direction > groups.at(currentGroup)->pages.size()-1)
	{
		return -1;
	}


	scrollArea->takeWidget();
	if(direction != 0)
	{
		groups.at(currentGroup)->getCurrentPage()->hide();
		//scrollArea->takeWidget();
	}

	QLabel* item = (QLabel*)groups.at(currentGroup)->listGridLayout->itemAtPosition(groups.at(currentGroup)->currentPage, 1)->widget();
	//Ditem->setText(item->text().replace(QString(getApplicationFile("/Icons/current.png")), groups.at(currentGroup)->getCurrentPage()->pageIcon));
	item->setStyleSheet("");
	//item->style()->unpolish(item);
	//item->style()->polish(item);
	//item->update();
	groups.at(currentGroup)->currentPage += direction;
	clearMessages();
	loadMessages(groups.at(currentGroup)->getCurrentPage());


	if(groups.at(currentGroup)->getCurrentPage())
	{
		//QWidget* widget = scrollArea->takeWidget();
		//widget->hide();
		//widget->setParent(this);

		scrollArea->setWidget(groups.at(currentGroup)->getCurrentPage());
	}
	groups.at(currentGroup)->getCurrentPage()->show();

	helpTextEdit->setText(groups.at(currentGroup)->getCurrentPage()->pageHelpMessage);


	if (!groups.at(currentGroup)->getCurrentPage()->init)
	{
		groups.at(currentGroup)->getCurrentPage()->initAll();
	}



	

	QLabel* item0 = (QLabel*)groups.at(currentGroup)->listGridLayout->itemAtPosition(groups.at(currentGroup)->currentPage, 1)->widget();
	//Ditem0->setText(item0->text().replace(groups.at(currentGroup)->getCurrentPage()->pageIcon, QString(getApplicationFile("/Icons/current.png"))));
	item0->setStyleSheet("color : #44aaff; font-weight: bold;");
	//item0->style()->unpolish(item0);
	//item0->style()->polish(item0);
	//item0->update();

	helpTextEdit->setText(groups.at(currentGroup)->getCurrentPage()->pageHelpMessage);
	
	if (nextPushButton->isEnabled())
	{
		nextPushButton->setFocus();
	}
	else
	{
		previousPushButton->setFocus();
	}
	
	if(groups.at(currentGroup)->getCurrentPage()->pageType == "GROUPSELECTOR")
	{
		groupSelector* gSelector = (groupSelector*)groups.at(currentGroup)->getCurrentPage();
		gSelector->Focus();
		//groups.at(currentGroup)->groupsLayout->itemAt(0)->widget()->setFocus();
		//groups.at(currentGroup)->getCurrentPage()->setFocus();
	}
	
	return 0;
}
// Loads JSON from file and parses it and assigns to LibraryFile class properties
bool LibraryFile::loadJson(QString filepath)
{
    // Try to open file and read it
    QFile file(filepath);
    if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
        return false;

    // Copy library file to root directory
    QDir rootDir(libraryDirPath);
    if(!rootDir.exists())
        rootDir.mkdir(libraryDirPath);

    QFileInfo loadedInfo(file);
    QFileInfo info(libraryDirPath, loadedInfo.fileName());
    if(info.exists())
    {
        QFile newFile(info.absoluteFilePath());
        if(newFile.remove())
        {
            //QString s = file.readAll();
            file.copy(loadedInfo.absoluteFilePath(), info.absoluteFilePath());

        }
    }
    else
    {
        file.copy(loadedInfo.absoluteFilePath(), info.absoluteFilePath());
    }

    QFile libFile(info.absoluteFilePath());
    // Parse json file
    if(!libFile.open(QIODevice::ReadOnly | QIODevice::Text))
        return false;

    libraryFileName = info.fileName();
    QString data = libFile.readAll();
    QJsonDocument doc(QJsonDocument::fromJson(data.toUtf8()));

    // Get JSON root object
    QJsonObject root = doc.object();

    // Load basic information
    libraryTitle = root["libraryTitle"].toString();
    libraryInfo = root["libraryInfo"].toString();
    comdelDirectory = root["comdelDirectory"].toString();
    loadComdelHeader(root["comdelHeader"].toArray());

    // Load list of address spaces
    loadAddressSpaceList(root["addressSpaceList"].toArray());

    // Load messages
    loadMessages(root["messages"].toObject());

    // Load all components and its children
    loadComponents(root["componentList"].toArray());

    // Load automatic and regular buses
    loadBuses(root["regularBusList"].toArray(), true);
    loadBuses(root["automaticBusList"].toArray());

    // Load connection rules
    loadRegularBusConnectionRules(root["regularBusConnectionRules"].toArray());
    loadAutomaticBusConnectionRules(root["automaticBusConnectionRules"].toArray());

    return true;
}
Example #12
0
void WebBrowser::loadMessage(const Message &message, RootItem *root) {
  loadMessages(QList<Message>() << message, root);
}
Example #13
0
	void GameState::update(const sf::Time &frameTime)
	{
		if (mGameStatus == GameStatus::RUNNING)
		{
			//Check if music is running
			if (mMusic.getStatus() != sf::Music::Playing)
				mMusic.play();

			if (sf::Keyboard::isKeyPressed(sf::Keyboard::B))
			{
				if (!mGoingBack)
				{
					mGoingBack = true;
					mTracker.startGoingBackInTime(mPlayer.getPosition(), mPlayer.getVelocity());
				}
			}
			else
				mGoingBack = false;

			if (mGoingBack)
			{
				auto values = mTracker.goingBack(frameTime);
				mPlayer.setPosition(values[0]);
				mPlayer.setVelocity(values[1]);
				mPlayer.updateRotation(frameTime);
			}
			else
			{
				//Update velocity (Does not move the character!)
				mPlayer.update(frameTime);
				//Moves the character + checks and handle collision
				mMap.movePlayerWithCollision(mPlayer, frameTime);
				//Check if player is dead
				if (!mPlayer.isAlive())
				{
					mGameStatus = GameStatus::CRASHED;
					std::vector<std::string> temp = { "You died!", "Now you have 2 options", "Press B to go back in time", "Press R to restart" };
					mIntroMessage.setMessage(temp, "");
				}
				//Store player movements
				mTracker.update(frameTime, mPlayer.getPosition(), mPlayer.getVelocity());
				//Check if player reached finish
				if (mMap.playerReachedFinish(mPlayer.getPosition()))
				{
					mGameStatus = GameStatus::FINISHED;
					std::vector<std::string> msg;
					loadMessages(mPath, "finishMessage", msg);
					mIntroMessage.setMessage(msg, "");
				}
			}
		}
		else if (mGameStatus == GameStatus::CRASHED)
		{
			if (sf::Keyboard::isKeyPressed(sf::Keyboard::B))
			{
				mGameStatus = GameStatus::RUNNING;
				auto values = mTracker.goingBack(frameTime);
				mPlayer.setPosition(values[0]);
				mPlayer.setVelocity(values[1]);
			}
			else if (sf::Keyboard::isKeyPressed(sf::Keyboard::R))
			{
				mGameStatus = GameStatus::INTRO;
				loadLevel();
			}
		}

		mCamera.update(mPlayer.getPosition());
	}