示例#1
0
StatusWidget::StatusWidget(QWidget *parent)
  : QLabel(parent)
{
  hide();

  connect(StatusMenu::i(), SIGNAL(updated()), SLOT(reload()));

  if (!ChatCore::isReady())
    connect(ChatCore::i(), SIGNAL(ready()), SLOT(onReady()));
  else
    onReady();
}
示例#2
0
TabWidget::TabWidget(QWidget *parent)
  : QTabWidget(parent)
  , m_serverTab(0)
  , m_tray(0)
{
  m_self = this;

  m_tabBar = new TabBar(this);
  setTabBar(m_tabBar);
  setDocumentMode(true);

# if !defined(Q_OS_MAC)
  setStyleSheet(LS("QToolBar { margin:0px; border:0px; }"));
# endif

  int fontSize = ChatCore::settings()->value(ChatSettings::kChatViewFontSize).toInt();
  if (fontSize == -1)
    fontSize = fontInfo().pixelSize();

  QString fontFamily = ChatCore::settings()->value(ChatSettings::kChatViewFontFamily).toString();
  if (fontFamily.isEmpty() || fontFamily == LS("\"\""))
    fontFamily = fontInfo().family();

  QWebSettings::globalSettings()->setFontSize(QWebSettings::DefaultFontSize,         fontSize);
  QWebSettings::globalSettings()->setFontSize(QWebSettings::DefaultFixedFontSize,    fontSize);
  QWebSettings::globalSettings()->setFontFamily(QWebSettings::StandardFont,          fontFamily);
  QWebSettings::globalSettings()->setFontFamily(QWebSettings::SerifFont,             fontFamily);
  QWebSettings::globalSettings()->setFontFamily(QWebSettings::SansSerifFont,         fontFamily);
  QWebSettings::globalSettings()->setAttribute(QWebSettings::LocalStorageEnabled,    true);
  QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, ChatCore::settings()->value(SETTINGS_LABS_DEVELOPER_EXTRAS).toBool());

  m_authIcon = new AuthIcon();

  add(new AboutTabCreator());
  add(new SettingsTabCreator());
  add(new WelcomeTabCreator());
  add(new ProgressTabCreator());

  tab(PROGRESS_TAB);

  createToolBars();

  if (!ChatCore::isReady())
    connect(ChatCore::i(), SIGNAL(ready()), SLOT(onReady()));
  else
    onReady();

  connect(this, SIGNAL(tabCloseRequested(int)), SLOT(closeTab(int)));
  connect(this, SIGNAL(currentChanged(int)), SLOT(currentChanged(int)));
  connect(ChatNotify::i(), SIGNAL(notify(Notify)), SLOT(notify(Notify)));
}
示例#3
0
void Model::create(const bgfx::VertexDecl& def,
				   Material* material,
				   const int* indices_data,
				   int indices_size,
				   const void* attributes_data,
				   int attributes_size)
{
	m_geometry_buffer_object.setAttributesData(
		attributes_data, attributes_size, def);
	m_geometry_buffer_object.setIndicesData(indices_data, indices_size);

	m_meshes.emplace(def,
					 material,
					 0,
					 attributes_size,
					 0,
					 indices_size / sizeof(int),
					 "default",
					 m_allocator);

	Model::LOD lod;
	lod.m_distance = FLT_MAX;
	lod.m_from_mesh = 0;
	lod.m_to_mesh = 0;
	m_lods.push(lod);

	m_indices.resize(indices_size / sizeof(m_indices[0]));
	memcpy(&m_indices[0], indices_data, indices_size);

	m_vertices.resize(attributes_size / def.getStride());
	computeRuntimeData((const uint8_t*)attributes_data);

	onReady();
}
示例#4
0
void AsyncDriver::stopNow(){
	_targetPos		= _currentPos;
	stepInterval	= 0;
	_speed			= 0.0;
	lastStepTime	= 0;
	_n				= 0;
	onReady();
}
示例#5
0
void AsyncDriver::computeNewSpeed( boolean sync ){
	volatile long distanceTo	= _targetPos - _currentPos;
	volatile long stepsToStop	= (long)((_speed * _speed) / (2.0 * _acceleration)); // Equation 16

	if (distanceTo == 0 && stepsToStop <= 1){	// We are at the target and its time to stop
		stepInterval = 0;
		_speed = 0.0;
		_n = 0;
		onReady();
		return;
	}
	if (distanceTo > 0){
		// We are anticlockwise from the target
		// Need to go clockwise from here, maybe decelerate now
		if (_n > 0){
			// Currently accelerating, need to decel now? Or maybe going the wrong way?
			if ((stepsToStop >= distanceTo) || _direction == DIR_ACW)
			_n = -stepsToStop; // Start deceleration
		}else if (_n < 0){
			// Currently decelerating, need to accel again?
			if ((stepsToStop < distanceTo) && _direction == DIR_CW)
			_n = -_n; // Start accceleration
		}
	}else if (distanceTo < 0){
		// We are clockwise from the target
		// Need to go anticlockwise from here, maybe decelerate
		if (_n > 0){
			// Currently accelerating, need to decel now? Or maybe going the wrong way?
			if ((stepsToStop >= -distanceTo) || _direction == DIR_CW)
			_n = -stepsToStop; // Start deceleration
		}else if (_n < 0){
			// Currently decelerating, need to accel again?
			if ((stepsToStop < -distanceTo) && _direction == DIR_ACW)
			_n = -_n; // Start accceleration
		}
	}
	// Need to accelerate or decelerate
	if (_n == 0){
		// First step from stopped
		_cn = _c0;
		_direction = (distanceTo > 0) ? DIR_CW : DIR_ACW;
	}else{	// Subsequent step. Works for accel (n is +_ve) and decel (n is -ve).
		_cn = _cn - ((2.0 * _cn) / ((4.0 * _n) + 1)); // Equation 13
		_cn = max(_cn, _cmin); 
	}
	_n++;
	stepInterval = _cn;
	_speed = 1000000.0 / _cn;
	if (_direction == DIR_ACW){
		_speed = -_speed;
	}
	if(sync){
	//	debug();
	//# if 0
	//# endif
	}
}
示例#6
0
ServiceThread::ServiceThread(QObject *parent)
  : QThread(parent)
  , m_ready(false)
  , m_counter(-1)
{
  qRegisterMetaType<IServiceTask*>("IServiceTask*");
  qRegisterMetaType<QQueue<IServiceTask*> >("QQueue<IServiceTask*>");

  connect(this, SIGNAL(ready()), SLOT(onReady()));
}
bool ControllerInterface::connectToDataSource(const QString &source)
{
   d->mDataSource = PluginLoader::getInstance()->engine(source);

   if (!d->mDataSource.data())
       return 0;

   connect(d->mDataSource.data(), SIGNAL(ready()), this, SLOT(onReady()));

   return true;
}
示例#8
0
	virtual void onChannelDataReady(Ipc::ChannelRef channel, Ipc::MessageRef message) {
		switch(Ipc::CommandId cmd = message->get_cmd()) {
			default: {
				logger->error() << "Tab: received unknown command '" << cmd << "'" << std::endl;
				break;
			}
			case Ipc::CommandId::onReady: {
				onReady();
				break;
			}
			case Ipc::CommandId::onPaint: {
				onPaint();
				break;
			}
		}
	}
示例#9
0
void AsyncDriver::moveTo(long absolute){
	uint8_t oldSREG = SREG;
	noInterrupts();
	if ( _targetPos == absolute ){
		if( _targetPos ==_currentPos){
			onReady();
		}
	}else{
		if( disable_on_ready && is_disabled ){
			enableOutputs();
		}
		_targetPos = absolute;
		computeNewSpeed(true);
	}
	SREG = oldSREG;
}
示例#10
0
// Called in loading thread
void QSample::readSample()
{
    Q_ASSERT(QThread::currentThread()->objectName() == "QSampleCache::LoadingThread");
    QMutexLocker m(&m_mutex);
#ifdef  QT_SAMPLECACHE_DEBUG
    qDebug() << "QSample: readSample";
#endif
    qint64 read = m_waveDecoder->read(m_soundData.data() + m_sampleReadLength,
                                      qMin(m_waveDecoder->bytesAvailable(),
                                           qint64(m_waveDecoder->size() - m_sampleReadLength)));
    if (read > 0)
        m_sampleReadLength += read;
    if (m_sampleReadLength < m_waveDecoder->size())
        return;
    Q_ASSERT(m_sampleReadLength == qint64(m_soundData.size()));
    onReady();
}
示例#11
0
// Called in loading thread
void QSample::decoderReady()
{
    Q_ASSERT(QThread::currentThread()->objectName() == "QSampleCache::LoadingThread");
    QMutexLocker m(&m_mutex);
#ifdef QT_SAMPLECACHE_DEBUG
    qDebug() << "QSample: decoder ready";
#endif
    m_parent->refresh(m_waveDecoder->size());

    m_soundData.resize(m_waveDecoder->size());
    m_sampleReadLength = 0;
    qint64 read = m_waveDecoder->read(m_soundData.data(), m_waveDecoder->size());
    if (read > 0)
        m_sampleReadLength += read;
    if (m_sampleReadLength >= m_waveDecoder->size())
        onReady();
}
void *control_main(){
	do{
		if(rpi_hasReceived && isReady()){
			rpi_hasReceived = 0;

			// printf("-------------------------------\n");
			printf("[RPI] Received: %s\n", input);

			// Split Command
			int result = splitString(input, "<", inputPtr, 2);
			if(result == 2){
				message_size = strlen(inputPtr[1]);
				tempCommand = inputPtr[1];

				// printf("Target: %s\n", inputPtr[0]);
				// printf("Target Length: %d\n", strlen(inputPtr[0]));
				// printf("Target Size: %d\n", sizeof(inputPtr[0]));
				// printf("Message: %s\n", inputPtr[1]);
				// printf("Message Length: %d\n", strlen(inputPtr[1]));
				// printf("Message Size: %d\n", sizeof(inputPtr[1]));
				// printf("-------------------------------\n");

				memset(output, 0, sizeof(output));
				strncpy(output, tempCommand, strlen(tempCommand));

				for(i = 0; i < strlen(inputPtr[0]); i++){
					setTarget((&input[0])[i]);
				}
			}
			// }else{
			// 	memset(output, 0, sizeof(output));
			// 	strncpy(output, "Invalid Command: ", 17);
			// 	strcat(output, input);
			// 	setTarget(sender);
			// }

			//printf("%d:%d:%d\n", arduino_isWriting, bt_isWriting, tcp_isWriting);
		}

		if(tcp_isReconnected){
			tcp_isReconnected = 0;
			onReady();
		}
	}while(1);
}
示例#13
0
/**
 * @brief downloader::onResult
 * @param reply
 */
void downloader::onResult(QNetworkReply *reply)
{
    // Если в процесе получения данных произошла ошибка
    if(reply->error()){
        // Сообщаем об этом и показываем информацию об ошибках
        qDebug() << "ERROR";
        qDebug() << reply->errorString();
    } else {
        // В противном случае создаём объект для работы с файлом
        QFile *file = new QFile("C:/example/file.xml");
        // Создаём файл или открываем его на перезапись ...
        if(file->open(QFile::WriteOnly)){
            file->write(reply->readAll());  // ... и записываем всю информацию со страницы в файл
            file->close();                  // закрываем файл
        qDebug() << "Downloading is completed";
        emit onReady(); // Посылаем сигнал о завершении получения файла
        }
    }
}
示例#14
0
UpdateStateRow::UpdateStateRow(QWidget *parent) : RpWidget(parent)
, _check(this, lang(lng_settings_check_now))
, _restart(this, lang(lng_settings_update_now)) {
	connect(_check, SIGNAL(clicked()), this, SLOT(onCheck()));
	connect(_restart, SIGNAL(clicked()), this, SIGNAL(restart()));

	_versionText = lng_settings_current_version_label(lt_version, currentVersionText());

	Core::UpdateChecker checker;
	checker.checking() | rpl::start_with_next([=] {
		onChecking();
	}, lifetime());
	checker.isLatest() | rpl::start_with_next([=] {
		onLatest();
	}, lifetime());
	checker.progress(
	) | rpl::start_with_next([=](Core::UpdateChecker::Progress progress) {
		onDownloading(progress.already, progress.size);
	}, lifetime());
	checker.failed() | rpl::start_with_next([=] {
		onFailed();
	}, lifetime());
	checker.ready() | rpl::start_with_next([=] {
		onReady();
	}, lifetime());

	switch (checker.state()) {
	case Core::UpdateChecker::State::Download:
		setState(State::Download, true);
		setDownloadProgress(checker.already(), checker.size());
		break;
	case Core::UpdateChecker::State::Ready:
		setState(State::Ready, true);
		break;
	default:
		setState(State::None, true);
		break;
	}
}
示例#15
0
UpdateStateRow::UpdateStateRow(QWidget *parent) : TWidget(parent)
, _check(this, lang(lng_settings_check_now))
, _restart(this, lang(lng_settings_update_now)) {
	connect(_check, SIGNAL(clicked()), this, SLOT(onCheck()));
	connect(_restart, SIGNAL(clicked()), this, SIGNAL(restart()));

	Sandbox::connect(SIGNAL(updateChecking()), this, SLOT(onChecking()));
	Sandbox::connect(SIGNAL(updateLatest()), this, SLOT(onLatest()));
	Sandbox::connect(SIGNAL(updateProgress(qint64, qint64)), this, SLOT(onDownloading(qint64, qint64)));
	Sandbox::connect(SIGNAL(updateFailed()), this, SLOT(onFailed()));
	Sandbox::connect(SIGNAL(updateReady()), this, SLOT(onReady()));

	_versionText = lng_settings_current_version_label(lt_version, currentVersionText());

	switch (Sandbox::updatingState()) {
	case Application::UpdatingDownload:
		setState(State::Download, true);
		setDownloadProgress(Sandbox::updatingReady(), Sandbox::updatingSize());
	break;
	case Application::UpdatingReady: setState(State::Ready, true); break;
	default: setState(State::None, true); break;
	}
}
示例#16
0
//------------------------------------------------------------------------------
void Entity::propagateOnReady()
{
    onReady();
    for (auto it = m_children.begin(); it != m_children.end(); ++it)
        (*it)->propagateOnReady();
}
示例#17
0
 const Future<T>& onReady(_Deferred<F>&& deferred) const
 {
   return onReady(std::function<void(const T&)>(deferred));
 }
示例#18
0
int main() {
    loadResource(IMG_BOSSES);
    onReady("gameRun");
}