Beispiel #1
0
void MainWindow::msgServerSync(const MumbleProto::ServerSync &msg) {
	g.sh->sendPing(); // Send initial ping to establish UDP connection

	g.uiSession = msg.session();
	g.pPermissions = ChanACL::Permissions(static_cast<unsigned int>(msg.permissions()));
	g.l->clearIgnore();
	if (msg.has_welcome_text()) {
		QString str = u8(msg.welcome_text());
		if (!str.isEmpty()) {
			g.l->log(Log::Information, tr("Welcome message: %1").arg(str));
		}
	}
	pmModel->ensureSelfVisible();
	pmModel->recheckLinks();

	qmTargetUse.clear();
	qmTargets.clear();
	for (int i=1;i<6;++i) {
		qmTargetUse.insert(i, i);
	}
	iTargetCounter = 100;

	AudioInput::setMaxBandwidth(msg.max_bandwidth());

	findDesiredChannel();

	QString host, uname, pw;
	unsigned short port;

	g.sh->getConnectionInfo(host, port, uname, pw);

	QList<Shortcut> sc = Database::getShortcuts(g.sh->qbaDigest);
	if (! sc.isEmpty()) {
		for (int i=0;i<sc.count(); ++i) {
			Shortcut &s = sc[i];
			s.iIndex = g.mw->gsWhisper->idx;
		}
		g.s.qlShortcuts << sc;
		GlobalShortcutEngine::engine->bNeedRemap = true;
	}

	const ClientUser *user = ClientUser::get(g.uiSession);
	connect(user, SIGNAL(talkingStateChanged()), this, SLOT(userStateChanged()));
	connect(user, SIGNAL(muteDeafStateChanged()), this, SLOT(userStateChanged()));
	connect(user, SIGNAL(prioritySpeakerStateChanged()), this, SLOT(userStateChanged()));
	connect(user, SIGNAL(recordingStateChanged()), this, SLOT(userStateChanged()));
	
	qstiIcon->setToolTip(tr("Mumble: %1").arg(Qt::escape(Channel::get(0)->qsName)));

	// Update QActions and menues
	on_qmServer_aboutToShow();
	on_qmSelf_aboutToShow();
	qmChannel_aboutToShow();
	qmUser_aboutToShow();
	on_qmConfig_aboutToShow();

	updateTrayIcon();
}
void MusicUserWindow::checkToAutoLogin()
{
    MusicUserDialog dialog;
    QString name, icon;
    dialog.checkToAutoLogin(name, icon);
    userStateChanged(name, icon);
}
void MusicUserWindow::musicUserLogin()
{
    MusicUserDialog dialog;
    connect(&dialog, SIGNAL(userLoginSuccess(QString,QString)),
                     SLOT(userStateChanged(QString,QString)));
    dialog.exec();
}
MusicUserWindow::MusicUserWindow(QWidget *parent)
   : QStackedWidget(parent),
     ui(new Ui::MusicUserWindow)
{
    ui->setupUi(this);
    ui->userNameL->setStyleSheet(MusicUIObject::MPushButtonStyle11);
    ui->userNameL->setCursor(QCursor(Qt::PointingHandCursor));
    ui->userNameU->setCursor(QCursor(Qt::PointingHandCursor));

    connectDatabase();

    m_userManager = new MusicUserManager(this);
    connect(ui->userNameU, SIGNAL(clicked()), SLOT(musicUserLogin()));
    connect(ui->userNameL, SIGNAL(clicked()), m_userManager, SLOT(exec()));
    connect(m_userManager, SIGNAL(userStateChanged(QString,QString)),
                           SLOT(userStateChanged(QString,QString)));

    QTimer::singleShot(1, this, SLOT(checkToAutoLogin()));
}
void MusicUserManager::musicUserLogoff()
{
    m_userModel->updateUser(m_currentUserUID, QString(), QString(), ui->username->text(),
                            QString::number(m_userModel->getUserLogTime(m_currentUserUID)
                            .toLongLong() + m_time.elapsed()/(MT_S2MS*30) ));

    MusicUserConfigManager xml;
    if(!xml.readUserXMLConfig())
    {
        return;
    }
    MusicUserRecord record;
    xml.readUserConfig( record );
    int index = record.m_names.indexOf(m_currentUserUID);
    record.m_als[index] = "0";  //auto login flag
    xml.writeUserXMLConfig( record );

    m_currentUserUID.clear();
    emit userStateChanged(QString(), QString());
    close();
}