예제 #1
0
파일: androidgui.cpp 프로젝트: 4myPAL/qTox
void AndroidGUI::onConnected()
{
    if (beforeDisconnect == Status::Offline)
        emit statusSet(Status::Online);
    else
        emit statusSet(beforeDisconnect);
}
예제 #2
0
파일: widget.cpp 프로젝트: AWeinb/qTox
void Widget::onUserAwayCheck()
{
#ifdef QTOX_PLATFORM_EXT
    uint32_t autoAwayTime = Settings::getInstance().getAutoAwayTime() * 60 * 1000;

    if (ui->statusButton->property("status").toString() == "online")
    {
        if (autoAwayTime && Platform::getIdleTime() >= autoAwayTime)
        {
            qDebug() << "Widget: auto away activated at" << QTime::currentTime().toString();
            emit statusSet(Status::Away);
            autoAwayActive = true;
        }
    }
    else if (ui->statusButton->property("status").toString() == "away")
    {
        if (autoAwayActive && (!autoAwayTime || Platform::getIdleTime() < autoAwayTime))
        {
            qDebug() << "Widget: auto away deactivated at" << QTime::currentTime().toString();
            emit statusSet(Status::Online);
            autoAwayActive = false;
        }
    }
    else if (autoAwayActive)
        autoAwayActive = false;
#endif
}
예제 #3
0
파일: widget.cpp 프로젝트: Disva/qTox
void Widget::onConnected()
{
    ui->statusButton->setEnabled(true);
    if (beforeDisconnect == Status::Offline)
        emit statusSet(Status::Online);
    else
        emit statusSet(beforeDisconnect);
}
예제 #4
0
bool Widget::event(QEvent * e)
{
    switch(e->type()) {
        case QEvent::WindowActivate:
            if (activeChatroomWidget != nullptr)
            {
                activeChatroomWidget->resetEventFlags();
                activeChatroomWidget->updateStatusLight();
            }
        // http://qt-project.org/faq/answer/how_can_i_detect_a_period_of_no_user_interaction
        // Detecting global inactivity, like Skype, is possible but not via Qt:
        // http://stackoverflow.com/a/21905027/1497645
        case QEvent::MouseButtonPress:
        case QEvent::MouseButtonRelease:
        case QEvent::Wheel:
        case QEvent::KeyPress:
        case QEvent::KeyRelease:
            if (autoAwayActive)
            {
                qDebug() << "Widget: auto away deactivated";
                autoAwayActive = false;
                emit statusSet(Status::Online);
                int mins = Settings::getInstance().getAutoAwayTime();
                if (mins > 0)
                    idleTimer->start(mins * 1000*60);
            }
        default:
            break;
    }

    return QWidget::event(e);
}
예제 #5
0
파일: widget.cpp 프로젝트: Disva/qTox
bool Widget::event(QEvent * e)
{
    switch(e->type()) {
        case QEvent::WindowActivate:
            if (activeChatroomWidget != nullptr)
            {
                activeChatroomWidget->resetEventFlags();
                activeChatroomWidget->updateStatusLight();
            }
        // http://qt-project.org/faq/answer/how_can_i_detect_a_period_of_no_user_interaction
        // Detecting global inactivity, like Skype, is possible but not via Qt:
        // http://stackoverflow.com/a/21905027/1497645
        case QEvent::MouseButtonPress:
        case QEvent::MouseButtonRelease:
        case QEvent::Wheel:
        case QEvent::KeyPress:
        case QEvent::KeyRelease:
            if (autoAwayActive && ui->statusButton->property("status").toString() == "away")
            { // be sure nothing else has changed the status in the meantime
                qDebug() << "Widget: auto away deactivated at" << QTime::currentTime().toString();
                autoAwayActive = false;
                emit statusSet(Status::Online);
            }
            setIdleTimer(Settings::getInstance().getAutoAwayTime());
        default:
            break;
    }

    return QWidget::event(e);
}
예제 #6
0
파일: core.cpp 프로젝트: ReDetection/qTox
void Core::setStatus(Status status)
{
    TOX_USERSTATUS userstatus;
    switch (status) {
        case Status::Online:
            userstatus = TOX_USERSTATUS_NONE;
            break;
        case Status::Away:
            userstatus = TOX_USERSTATUS_AWAY;
            break;
        case Status::Busy:
            userstatus = TOX_USERSTATUS_BUSY;
            break;
        default:
            userstatus = TOX_USERSTATUS_INVALID;
            break;
    }

    if (tox_set_user_status(tox, userstatus) == 0) {
        saveConfiguration();
        emit statusSet(status);
    } else {
        emit failedToSetStatus(status);
    }
}
예제 #7
0
파일: core.cpp 프로젝트: mpxc/qTox
void Core::setStatus(Status status)
{
    TOX_USER_STATUS userstatus;
    switch (status) {
    case Status::Online:
        userstatus = TOX_USER_STATUS_NONE;
        break;

    case Status::Away:
        userstatus = TOX_USER_STATUS_AWAY;
        break;

    case Status::Busy:
        userstatus = TOX_USER_STATUS_BUSY;
        break;

    default:
        return;
        break;
    }

    tox_self_set_status(tox, userstatus);
    profile.saveToxSave();
    emit statusSet(status);
}
예제 #8
0
void Widget::onUserAway()
{
    if (Settings::getInstance().getAutoAwayTime() > 0
        && ui->statusButton->property("status").toString() == "online") // leave user-set statuses in place
    {
        qDebug() << "Widget: auto away activated";
        emit statusSet(Status::Away);
        autoAwayActive = true;
    }
    idleTimer->stop();
}
예제 #9
0
파일: widget.cpp 프로젝트: Disva/qTox
void Widget::onDisconnected()
{
    QString stat = ui->statusButton->property("status").toString();
    if      (stat == "online")
        beforeDisconnect = Status::Online;
    else if (stat == "busy")
        beforeDisconnect = Status::Busy;
    else if (stat == "away")
        beforeDisconnect = Status::Away;
    else
        beforeDisconnect = Status::Offline;

    ui->statusButton->setEnabled(false);
    emit statusSet(Status::Offline);
}
예제 #10
0
void Widget::onDisconnected()
{
    ui->statusButton->setEnabled(false);
    emit statusSet(Status::Offline);
}
예제 #11
0
void Widget::onConnected()
{
    ui->statusButton->setEnabled(true);
    emit statusSet(Status::Online);
}
예제 #12
0
파일: widget.cpp 프로젝트: AWeinb/qTox
void Widget::onDisconnected()
{
    beforeDisconnect = getStatusFromString(ui->statusButton->property("status").toString());
    ui->statusButton->setEnabled(false);
    emit statusSet(Status::Offline);
}
예제 #13
0
파일: androidgui.cpp 프로젝트: 4myPAL/qTox
void AndroidGUI::onDisconnected()
{
    emit statusSet(Status::Offline);
}
예제 #14
0
파일: widget.cpp 프로젝트: ReDetection/qTox
void Widget::onDisconnected()
{
    emit statusSet(Status::Offline);
}
예제 #15
0
파일: widget.cpp 프로젝트: ReDetection/qTox
void Widget::onConnected()
{
    emit statusSet(Status::Online);
}