Example #1
0
void QwcUsersWidget::setSocket(QwcSocket *socket)
{
    if (m_socket) {
        // Disconnect all signals
        disconnect(m_socket, 0, this, 0);
    }

    m_socket = socket;
    clear();
    if (socket) {
        connect(m_socket, SIGNAL(receivedUserlist(int)),
                this, SLOT(handleReceivedUserlist(int)));
        connect(m_socket, SIGNAL(userJoinedRoom(int,QwcUserInfo)),
                this, SLOT(handleUserJoined(int,QwcUserInfo)));
        connect(m_socket, SIGNAL(userLeftRoom(int,QwcUserInfo)),
                this, SLOT(handleUserLeft(int,QwcUserInfo)));
        connect(m_socket, SIGNAL(userChanged(QwcUserInfo,QwcUserInfo)),
                this, SLOT(handleUserChanged(QwcUserInfo,QwcUserInfo)));
        updateUsers();
    }


    // Setup the delegate
    QwcUserlistDelegate *delegate = new QwcUserlistDelegate(this);
    delegate->setSocket(m_socket);
    setItemDelegate(delegate);
}
Example #2
0
PopupChatWidget::PopupChatWidget(SimpleChatServer& server,
				 const std::string& id)
  : SimpleChatWidget(server),
    missedMessages_(0)
{
  setId(id);

  if (Wt::WApplication::instance()->environment().agentIsIE()) {
    if (Wt::WApplication::instance()->environment().agent()
	== Wt::WEnvironment::IE6)
      setPositionScheme(Wt::Absolute);
    else
      setPositionScheme(Wt::Fixed);
  }

  implementJavaScript
    (&PopupChatWidget::toggleSize,
     "{"
     """var s = $('#" + id + "');"
     """s.toggleClass('chat-maximized chat-minimized');"
     "}");

  online_ = false;
  minimized_ = true;
  setStyleClass("chat-widget chat-minimized");

  clear();
  addWidget(createBar());
  updateUsers();

  connect();

}
void ScheduleDialog::setAssetType( const AssetType & tt )
{
	if( tt.isRecord() ) {
		mAssetType = tt;
		mTypeCombo->setCurrent( tt );
		updateUsers();
	}
}
Example #4
0
void OverlayUserGroup::moveUsers() {
	if (! qgeiHandle)
		return;

	const QRectF &sr = scene()->sceneRect();
	const QPointF &p = qgeiHandle->pos();

	os->fX = static_cast<float>(qBound(0.0, p.x() / sr.width(), 1.0));
	os->fY = static_cast<float>(qBound(0.0, p.y() / sr.height(), 1.0));

	qgeiHandle->setPos(os->fX * sr.width(), os->fY * sr.height());
	updateUsers();
}
Example #5
0
void ChatChannel::connectAll()
{
  connect(_conn, SIGNAL(chatUsersRecv(QString,QMap<QString,shared_ptr<ChatUser> >)),
          this, SLOT(updateUsers(QString,QMap<QString,shared_ptr<ChatUser> >)));
  connect(_conn, SIGNAL(chatUserEnter(QString,shared_ptr<ChatUser>)),
          this, SLOT(insertUser(QString,shared_ptr<ChatUser>)));
  connect(_conn, SIGNAL(chatUserLeave(QString,QString)),
          this, SLOT(removeUser(QString,QString)));
  connect(this, SIGNAL(sendPublicReady(QString,QString)),
          _conn, SLOT(chatSendPublic(QString,QString)));
  connect(_conn, SIGNAL(chatPublicMessage(QString,QString,QString)),
          this, SLOT(publicMessageRecv(QString,QString,QString)));
}
Example #6
0
void OverlayUserGroup::moveUsers() {
	if (! qgeiHandle)
		return;

	const QRectF &sr = scene()->sceneRect();
	const QPointF &p = qgeiHandle->pos();

	os->fX = qBound<qreal>(0.0f, p.x() / sr.width(), 1.0f);
	os->fY = qBound<qreal>(0.0f, p.y() / sr.height(), 1.0f);

	qgeiHandle->setPos(os->fX * sr.width(), os->fY * sr.height());
	updateUsers();
}
void CinderOpenNISkeleton::update()
{
	int iteration = 0;

	while (!_stopRequested)
	{
		XnStatus nRetVal = XN_STATUS_OK;

		// nRetVal = skeleton->mContext.WaitOneUpdateAll( skeleton->mDepthGenerator );
		nRetVal = mContext.WaitAndUpdateAll();

		if( nRetVal != XN_STATUS_OK ) { // Update
			printf("WaitAndUpdateAll failed: %s\n", xnGetStatusString(nRetVal));
			continue;
		}
		if( !mUserGenerator ) { // User gen
			std::cout << "No user generator" << std::endl;
			return;
		}

		// Get depthgenerator
		nRetVal = mContext.FindExistingNode(XN_NODE_TYPE_DEPTH, mDepthGenerator);
		if( nRetVal != XN_STATUS_OK ) {
			printf("FindExistingNode failed: %s\n", xnGetStatusString(nRetVal));
			continue;
		}

		// Cannot retrieve FPS or depthGenerator
		if(!&xnFPS) {
			std::cout << "(Oneday) OpenNIThreadRunner Not ready!" << std::endl;
			continue;
		}

		// All clear - update
		maxUsers = 15;
		mUserGenerator.GetUsers(currentUsers, maxUsers);
		mDepthGenerator.GetMetaData( mDepthMD );
		mUserGenerator.GetUserPixels(0, mSceneMD);
		setDepthSurface();

		updateUsers();
		++iteration;
	}
}
ScheduleDialog::ScheduleDialog( QWidget * parent )
: QDialog( parent )
, mAssetModel( 0 )
, mDisableUpdates( false )
{
	setupUi( this );

	mAssetModel = new ElementModel( mAssetTree );
	mAssetModel->setSecondColumnIsLocation( true );
	mAssetModel->setAutoSort( true );
	mAssetTree->setModel( mAssetModel );

	mUserModel = new ElementModel( mUserCombo );
	mUserModel->setAutoSort( true );
	mUserCombo->setModel( mUserModel );
	mUserCombo->setModelColumn( 0 );

//	connect( mCalendarButton, SIGNAL( clicked() ), SLOT( showCalendar() ) );
	connect( mProjectCombo, SIGNAL( activated( const QString & ) ), SLOT( projectSelected( const QString & ) ) );
	connect( mTypeCombo, SIGNAL( currentChanged( const Record & ) ), SLOT( assetTypeChanged( const Record & ) ) );
	connect( mTypeFilterCheck, SIGNAL( toggled( bool ) ), SLOT( setUseTypeFilter( bool ) ) );
	connect( mTypeFilterAssetsCheck, SIGNAL( toggled( bool ) ), SLOT( setUseAssetsTypeFilter( bool ) ) );

	connect( mUserCombo, SIGNAL( currentChanged( const Record & ) ), SLOT( employeeSelected( const Record & ) ) );

	connect( mChooseStartDateButton, SIGNAL( clicked() ), SLOT( chooseStartDate() ) );
	connect( mChooseEndDateButton, SIGNAL( clicked() ), SLOT( chooseEndDate() ) );

	QDate d( QDate::currentDate() );
	setDateRange( d, d );
	ProjectList pl = Project::select().filter( "fkeyProjectStatus", 4 ).sorted( "name" );
	mProject = pl[0];
	mProjectCombo->addItems( pl.names() );

	mTypeCombo->setTagFilters( QStringList() << "schedule" );
	mAssetType = mTypeCombo->current();

	updateUsers();

	mDateStartEdit->setMaximumDate( QDate::currentDate() );
	mDateEndEdit->setMinimumDate( QDate::currentDate() );
}
Example #9
0
void Gource::logic(float t, float dt) {

    if(draw_loading) return;

    if(splash>0.0) splash -= dt;

    //init log file
    if(commitlog == 0) {
        commitlog = determineFormat(logfile);

        if(commitlog == 0) {
            //if not in a git dir and no log file, show help
            if(logfile.size() == 0 || logfile == ".") {
                SDL_Quit();
                gource_help("");
            } else if(SDLAppDirExists(logfile)) {
                gource_quit("Directory not supported.");
            } else {
                gource_quit("Unsupported log format.  You may need to regenerate your log file.");
            }
        }

        if(start_position>0.0) {
            seekTo(start_position);
        }
    }

    slider.logic(dt);

    //still want to update camera while paused
    if(paused) {
        updateCamera(dt);
        return;
    }

    // get more entries
    if(commitqueue.size() == 0) {
        readLog();
    }

    //loop in attempt to find commits
    if(commitqueue.size()==0 && commitlog->isSeekable() && gGourceFileLoop) {
        first_read=true;
        seekTo(0.0);
        readLog();
    }

    if(currtime==0 && commitqueue.size()) {
        currtime   = commitqueue[0].timestamp;
        subseconds = 0.0;
    }

    //set current time
    float time_inc = (dt * 86400.0 * gGourceDaysPerSecond);
    int seconds    = (int) time_inc;

    subseconds += time_inc - ((float) seconds);

    if(subseconds >= 1.0) {
        currtime   += (int) subseconds;
        subseconds -= (int) subseconds;
    }

    currtime += seconds;

    // delete files
    for(std::vector<RFile*>::iterator it = gGourceRemovedFiles.begin(); it != gGourceRemovedFiles.end(); it++) {
        deleteFile(*it);
    }

    gGourceRemovedFiles.clear();


    //add commits up until the current time
    while(commitqueue.size() > 0) {

        RCommit commit = commitqueue[0];

        if(gGourceAutoSkipSeconds>=0.0 && idle_time >= gGourceAutoSkipSeconds) {
            currtime = commit.timestamp;
            idle_time = 0.0;
        }

        if(commit.timestamp > currtime) break;

        processCommit(commit, t);

        currtime = commit.timestamp;
        subseconds = 0.0;

        commitqueue.pop_front();
    }

    //reset loop counters
    gGourceUserInnerLoops = 0;
    gGourceDirNodeInnerLoops = 0;
    gGourceFileInnerLoops = 0;

    interactUsers();
    interactDirs();

    updateUsers(t, dt);
    updateDirs(dt);

    updateCamera(dt);

    updateTime();
}
Example #10
0
int main() {
    startup();
    updateUsers();
    loadSettings();
    while(!vars::accepted) {
        getmaxyx(stdscr, vars::maxY, vars::maxX);
        erase();
        firstNotice();
        if(!vars::running)
            break;
        refresh();
    }
    vars::noticeText.scroll = 0;
    while(vars::running) {//Main loop
        updateColors();
        updateUsers();
        if((vars::userList.at(vars::yourself).stat == 0) || ((!vars::chatting) && (!vars::banning)) || ((vars::about) && (!vars::settingsChangingDescription) && (!vars::settingsChangingNickname)))
            curs_set(0);
        else
            curs_set(1);
        getmaxyx(stdscr, vars::maxY, vars::maxX);
        erase();
        if((vars::maxX < 80) || (vars::maxY < 20)) {
            printw("The console window size is too small.\nPlease resize it to at least 80 * 20 width and height respectively.\nPress [Esc] or [Ctrl]+[C] to quit if resizing is not possible.");
            if(getch() == 27)
                vars::running = false;
        }
        else {
            printMainframe();
            if(vars::about)
                about();
            else {
                if(vars::menu == 0) {
                    notifications();
                    askUser();
                }
                else if(vars::menu == 1)
                    chatFrame();
            }
		}

        if((vars::previousState != 4) && (vars::previousState != vars::userList.at(vars::yourself).stat)) { //Check if your user stat changed
            curs_set(0);
            unsigned char thisState = vars::userList.at(vars::yourself).stat;
            if((vars::previousState > 0) && (thisState == 0)) {
                broadcast(std::vector < std::string >(1, "You have been banned!"), 6);
                vars::input.clear();
                vars::chattingWith.clear();
                vars::yourStr.clear();
                vars::menu = 0;
                vars::chatting = true;
                vars::chatScroll = -1;
                flushinp();
            }
            else if((vars::previousState == 0) && (thisState == 1))
                broadcast(std::vector < std::string >(1, "You have been unbanned!"), 8);
            else if((vars::previousState == 2) && (thisState == 1))
                broadcast(std::vector < std::string >(1, "You have been demoted!"), 6);
            else if((vars::previousState < 2) && (thisState == 2))
                broadcast(std::vector < std::string >(1, "You have been promoted to moderator!"), 8);
            broadcastWait(10);
        }
        else if(vars::broadcast.size() > 0) { //Or just draw a broadcast to the screen if there is one being sent.
            curs_set(0);
            broadcast(vars::broadcast, 6);
            vars::broadcast.clear();
            broadcastWait(10);
        }
        else {
            parseInput();
            refresh();
        }
        vars::previousState = vars::userList.at(vars::yourself).stat;
    }
    endwin();
    return 0;
}
void ScheduleDialog::assetTypeChanged( const Record & assetType )
{
	mAssetType = assetType;
	updateAssets();
	updateUsers();
}
void ScheduleDialog::setUseTypeFilter( bool tf )
{
	mTypeFilterCheck->setChecked( tf );
	updateUsers();
}
Example #13
0
void QwcUsersWidget::handleReceivedUserlist(int chatId)
{
    if (chatId != m_chatId) { return; }
    updateUsers();
}
Example #14
0
void Gource::logic(float t, float dt) {
    dt = std::min(dt, gGourceMaxDelta);

    if(draw_loading) return;

    if(splash>0.0) splash -= dt;

    //init log file
    if(commitlog == 0) {
        commitlog = determineFormat(logfile);

        if(commitlog == 0) {
            printf("unsupported log file or directory not supported\n", logfile.c_str());
            exit(1);
        }

        if(start_position>0.0) {
            seekTo(start_position);
        }
    }

    slider.logic(dt);

    if(paused) return;

    elapsed_time += dt * 86400.0 * gGourceDaysPerSecond;

    // get more entries
    if(commitqueue.size() == 0) {
        readLog();
    }

    //loop in attempt to find commits
    if(commitqueue.size()==0 && commitlog->isSeekable()) {
        seekTo(0.0);

        readLog();

        if(commitqueue.size() == 0 && starttime==0) {
            debugLog("no commits and starttime is not defined - cant continue\n");
            exit(1);
        }
    }

    if(starttime==0) {
        starttime = commitqueue[0].timestamp;
    }

    //set current time
    currtime = starttime + elapsed_time;
    float csubsec  = elapsed_time - floorf(elapsed_time);


    // delete files
    for(std::vector<RFile*>::iterator it = gGourceRemovedFiles.begin(); it != gGourceRemovedFiles.end(); it++) {
        deleteFile(*it);
    }

    gGourceRemovedFiles.clear();


    //add commits up until the current time
    while(commitqueue.size() > 0) {

        RCommit commit = commitqueue[0];

        if(gGourceAutoSkipSeconds>=0.0 && idle_time >= gGourceAutoSkipSeconds) {
            currtime = commit.timestamp;
            elapsed_time = commit.timestamp - starttime;
            idle_time = 0.0;
        }

        if(commit.timestamp > currtime) break;

        processCommit(commit);
        commitqueue.pop_front();
    }

    //reset loop counters
    gGourceUserInnerLoops = 0;
    gGourceDirNodeInnerLoops = 0;
    gGourceFileInnerLoops = 0;

    interactUsers();
    interactDirs();

    updateUsers(dt);
    updateDirs(dt);

    updateTime();
}
Example #15
0
void QwcUsersWidget::setChatId(int id)
{
    m_chatId = id;
    updateUsers();
}
Example #16
0
void Gource::logic(float t, float dt) {

    if(draw_loading) return;

    if(message_timer>0.0f) message_timer -= dt;
    if(splash>0.0f)        splash -= dt;

    //init log file
    if(commitlog == 0) {

        try {

            commitlog = determineFormat(logfile);

        } catch(SeekLogException& exception) {
            throw SDLAppException("unable to read log file");
        }

        if(commitlog == 0) {
            //if not in a git dir and no log file, show help
            if(logfile.size() == 0 || logfile == ".") {
                SDL_Quit();

                SDLAppException exception("");
                exception.setShowHelp(true);
                throw exception;
            } else if(SDLAppDirExists(logfile)) {
                throw SDLAppException("directory not supported");
            } else {
                throw SDLAppException("unsupported log format (you may need to regenerate your log file)");
            }
        }

        if(gGourceSettings.start_position>0.0) {
            seekTo(gGourceSettings.start_position);
        }
    }

    slider.logic(dt);

    //apply rotation
    if(rotate_angle != 0.0f) {

        float s = sinf(rotate_angle);
        float c = cosf(rotate_angle);

        root->rotate(s, c);

        for(std::map<std::string,RUser*>::iterator it = users.begin(); it!=users.end(); it++) {
            RUser* user = it->second;

            vec2f userpos = user->getPos();

            user->setPos(userpos.rotate(s, c));
        }

        rotate_angle = 0.0f;
    }

    //still want to update camera while paused
    if(paused) {
        updateBounds();
        updateQuadTree();
        updateCamera(dt);
        return;
    }

    // get more entries
    if(commitqueue.size() == 0) {
        readLog();
    }

    //loop in attempt to find commits
    if(commitqueue.size()==0 && commitlog->isSeekable() && gGourceSettings.loop) {
        first_read=true;
        seekTo(0.0);
        readLog();
    }

    if(currtime==0 && commitqueue.size()) {
        currtime   = lasttime = commitqueue[0].timestamp;
        subseconds = 0.0;
    }

    //set current time
    float time_inc = (dt * 86400.0 * gGourceSettings.days_per_second);
    int seconds    = (int) time_inc;

    subseconds += time_inc - ((float) seconds);

    if(subseconds >= 1.0) {
        currtime   += (int) subseconds;
        subseconds -= (int) subseconds;
    }

    currtime += seconds;

    // delete files
    for(std::vector<RFile*>::iterator it = gGourceRemovedFiles.begin(); it != gGourceRemovedFiles.end(); it++) {
        deleteFile(*it);
    }

    gGourceRemovedFiles.clear();


    //add commits up until the current time
    while(commitqueue.size() > 0) {

        RCommit commit = commitqueue[0];

        //auto skip ahead, unless stop_position_reached
        if(gGourceSettings.auto_skip_seconds>=0.0 && idle_time >= gGourceSettings.auto_skip_seconds && !stop_position_reached) {
            currtime = lasttime = commit.timestamp;
            idle_time = 0.0;
        }

        if(commit.timestamp > currtime) break;

        processCommit(commit, t);

        currtime = lasttime = commit.timestamp;
        subseconds = 0.0;

        commitqueue.pop_front();
    }

    //reset loop counters
    gGourceUserInnerLoops = 0;
    gGourceDirNodeInnerLoops = 0;
    gGourceFileInnerLoops = 0;

    interactUsers();
    updateUsers(t, dt);

    updateQuadTree();
    updateBounds();
    updateDirs(dt);

    updateCamera(dt);

    updateTime(commitqueue.size() > 0 ? currtime : lasttime);
}
Example #17
0
void LayerBaCayAvatar::setListUserForBaCay(string listUser)
{
	this->listUser = listUser;
	updateUsers();
}
Example #18
0
void OverlayUserGroup::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) {
	event->accept();

#ifdef Q_OS_MAC
	bool embed = g.ocIntercept != NULL;
	QMenu qm(embed ? NULL : event->widget());
	if (embed) {
		QGraphicsScene *scene = g.ocIntercept->qgv.scene();
		scene->addWidget(&qm);
	}
#else
	QMenu qm(g.ocIntercept ? g.mw : event->widget());
#endif

	QMenu *qmShow = qm.addMenu(OverlayClient::tr("Filter"));

	QAction *qaShowTalking = qmShow->addAction(OverlayClient::tr("Only talking"));
	qaShowTalking->setCheckable(true);
	if (os->osShow == OverlaySettings::Talking)
		qaShowTalking->setChecked(true);

	QAction *qaShowActive = qmShow->addAction(OverlayClient::tr("Talking and recently active"));
	qaShowActive->setCheckable(true);
	if (os->osShow == OverlaySettings::Active)
		qaShowActive->setChecked(true);

	QAction *qaShowHome = qmShow->addAction(OverlayClient::tr("All in current channel"));
	qaShowHome->setCheckable(true);
	if (os->osShow == OverlaySettings::HomeChannel)
		qaShowHome->setChecked(true);

	QAction *qaShowLinked = qmShow->addAction(OverlayClient::tr("All in linked channels"));
	qaShowLinked->setCheckable(true);
	if (os->osShow == OverlaySettings::LinkedChannels)
		qaShowLinked->setChecked(true);

	qmShow->addSeparator();

	QAction *qaShowSelf = qmShow->addAction(OverlayClient::tr("Always show yourself"));
	qaShowSelf->setCheckable(true);
	qaShowSelf->setEnabled(os->osShow == OverlaySettings::Talking || os->osShow == OverlaySettings::Active);
	if (os->bAlwaysSelf)
		qaShowSelf->setChecked(true);

	qmShow->addSeparator();

	QAction *qaConfigureRecentlyActiveTime = qmShow->addAction(OverlayClient::tr("Configure recently active time (%1 seconds)...").arg(os->uiActiveTime));
	qaConfigureRecentlyActiveTime->setEnabled(os->osShow == OverlaySettings::Active);

	QMenu *qmColumns = qm.addMenu(OverlayClient::tr("Columns"));
	QAction *qaColumns[6];
	for (unsigned int i=1;i<=5;++i) {
		qaColumns[i] = qmColumns->addAction(QString::number(i));
		qaColumns[i]->setCheckable(true);
		qaColumns[i]->setChecked(i == os->uiColumns);
	}

	QMenu *qmSort = qm.addMenu(OverlayClient::tr("Sort"));

	QAction *qaSortAlphabetically = qmSort->addAction(OverlayClient::tr("Alphabetically"));
	qaSortAlphabetically->setCheckable(true);
	if (os->osSort == OverlaySettings::Alphabetical)
		qaSortAlphabetically->setChecked(true);

	QAction *qaSortLastStateChange = qmSort->addAction(OverlayClient::tr("Last state change"));
	qaSortLastStateChange->setCheckable(true);
	if (os->osSort == OverlaySettings::LastStateChange)
		qaSortLastStateChange->setChecked(true);

	QAction *qaEdit = qm.addAction(OverlayClient::tr("Edit..."));
	QAction *qaZoom = qm.addAction(OverlayClient::tr("Reset Zoom"));

	QAction *act = qm.exec(event->screenPos());

	if (! act)
		return;

	if (act == qaEdit) {
		if (g.ocIntercept) {
			QMetaObject::invokeMethod(g.ocIntercept, "openEditor", Qt::QueuedConnection);
		} else {
			OverlayEditor oe(qApp->activeModalWidget(), NULL, os);
			connect(&oe, SIGNAL(applySettings()), this, SLOT(updateLayout()));
			oe.exec();
		}
	} else if (act == qaZoom) {
		os->fZoom = 1.0f;
		updateLayout();
	} else if (act == qaShowTalking) {
		os->osShow = OverlaySettings::Talking;
		updateUsers();
	} else if (act == qaShowActive) {
		os->osShow = OverlaySettings::Active;
		updateUsers();
	} else if (act == qaShowHome) {
		os->osShow = OverlaySettings::HomeChannel;
		updateUsers();
	} else if (act == qaShowLinked) {
		os->osShow = OverlaySettings::LinkedChannels;
		updateUsers();
	} else if (act == qaShowSelf) {
		os->bAlwaysSelf = ! os->bAlwaysSelf;
		updateUsers();
	} else if (act == qaConfigureRecentlyActiveTime) {
		// FIXME: This might not be the best place to configure this setting, but currently
		// there's not really a suitable place to put this. In the future an additional tab
		// might be added for some advanced overlay options, which could then include this
		// setting.
		bool ok;
		int newValue = QInputDialog::getInt(
		                   qm.parentWidget(),
		                   OverlayClient::tr("Configure recently active time"),
		                   OverlayClient::tr("Amount of seconds users remain active after talking:"),
		                   os->uiActiveTime, 1, 2147483647, 1, &ok);
		if (ok) {
			os->uiActiveTime = newValue;
		}
		updateUsers();
	} else if (act == qaSortAlphabetically) {
		os->osSort = OverlaySettings::Alphabetical;
		updateUsers();
	} else if (act == qaSortLastStateChange) {
		os->osSort = OverlaySettings::LastStateChange;
		updateUsers();
	} else {
		for (int i=1;i<=5;++i) {
			if (act == qaColumns[i]) {
				os->uiColumns = i;
				updateLayout();
			}
		}
	}
}
Example #19
0
void OverlayUserGroup::updateLayout() {
	prepareGeometryChange();
	reset();
	updateUsers();
}