void RocketOfflineLobby::Countdown()
{
    ui_.retryLabel->setText(QString("Retrying connection in %1 seconds").arg(actualSeconds_--));
    ui_.retryButton->setEnabled(true);
    if (actualSeconds_ >= 0)
        return;

    OnRetry();
}
RocketOfflineLobby::RocketOfflineLobby(RocketPlugin *plugin, QWidget *parent) :
    QWidget(parent),
    plugin_(plugin),
    framework_(plugin->GetFramework()),
    animation_(new RocketAnimationEngine(this)),
    retryTimer_(0),
    retrySeconds_(3),
    actualSeconds_(retrySeconds_),
    preventShow_(false),
    opacity_(1.0)
{
    ui_.setupUi(this);
    UiProxyWidget *proxy = framework_->Ui()->AddWidgetToScene(this, Qt::Widget);
    proxy->setZValue(100000);

    setGeometry(0, 0, framework_->Ui()->GraphicsView()->width(), framework_->Ui()->GraphicsView()->height());

    retryTimer_ = new QTimer();
    retryTimer_->setInterval(1000);

    QPixmap presisImage(":/images/icon-presis.png");
    RocketOfflineLobbyButton *presisButton = new RocketOfflineLobbyButton("Presis", "Rocket's presentations tool", presisImage);
    AddButton(presisButton);

    QPixmap settingsImage(":/images/icon-settings2.png");
    RocketOfflineLobbyButton *settingsButton = new RocketOfflineLobbyButton("Settings", "Change Rocket settings", settingsImage);
    AddButton(settingsButton);

    animation_->Initialize(proxy, false, false, false, true, 500, QEasingCurve::OutCubic);
    connect(animation_->opacity, SIGNAL(finished()), SLOT(OnAnimationFinished()));

    connect(retryTimer_, SIGNAL(timeout()), this, SLOT(Countdown()));
    connect(ui_.retryButton, SIGNAL(clicked()), this, SLOT(OnRetry()));
    connect(ui_.exitButton, SIGNAL(clicked()), framework_, SLOT(Exit()), Qt::QueuedConnection);
    connect(framework_->Ui()->GraphicsView(), SIGNAL(WindowResized(int, int)), this, SLOT(OnResize(int, int)));
    connect(plugin_->Backend(), SIGNAL(AuthCompleted(const Meshmoon::User &)), this, SLOT(OnAuthenticated()));

    connect(settingsButton, SIGNAL(Clicked()), this, SLOT(Hide()));
    connect(presisButton, SIGNAL(Clicked()), this, SLOT(Hide()));
    connect(settingsButton, SIGNAL(Clicked()), plugin_->Lobby(), SIGNAL(EditSettingsRequest()));
    connect(presisButton, SIGNAL(Clicked()), plugin_->Lobby(), SIGNAL(OpenPresisRequest()));
}
示例#3
0
void IEventChannel::FiredEvents()
{
	ChannelEventFlags val=mFiredEvents;
	mFiredEvents = ChannelEventFlags::None;

	if (MEDUSA_FLAG_HAS(val,ChannelEventFlags::Read))
	{
		OnActive();
		OnRead();
	}
	if (!mIsAlive)
	{
		return;
	}

	if (MEDUSA_FLAG_HAS(val, ChannelEventFlags::Write))
	{
		OnActive();
		OnWrite();
	}

	if (MEDUSA_FLAG_HAS(val, ChannelEventFlags::Timeout))
	{
		OnTimeout();
	}

	if (MEDUSA_FLAG_HAS(val, ChannelEventFlags::Retry))
	{
		OnRetry();
	}

	if (MEDUSA_FLAG_HAS(val, ChannelEventFlags::Fault))
	{
		OnError();
	}
	
	if (MEDUSA_FLAG_HAS(val, ChannelEventFlags::Idle))
	{
		OnIdle();
	}

}