Esempio n. 1
0
void page_handler (void *p_arg)
{
	static uint8_t progress_val;
	mn_screen_event_t *p_page_hdl = p_arg;
	mn_load_t *p_load_arg = p_page_hdl->p_arg;
	char str[20];

	if (p_page_hdl->event == EVENT_SHOW)
	{
		if (p_load_arg->type == MEM_FORMAT)
		{
			widgetVisible(&btn_sim, NT_HIDE);
			widgetVisible(&btn_nao, NT_HIDE);
			widgetVisible(&txt_info, NT_HIDE);
			widgetVisible(&load_bar, NT_SHOW);
			snprintf(str,sizeof(str), "Formatando mem ext");
		    xTaskCreate( (pdTASK_CODE)format_mem_task,     "format_mem_task    ",  256, NULL, 1, NULL); /* keyboard_task      */
		}
		if (p_load_arg->type == FILE_LOAD)
		{
			widgetVisible(&btn_sim, NT_HIDE);
			widgetVisible(&btn_nao, NT_HIDE);
			widgetVisible(&txt_info, NT_HIDE);
			widgetVisible(&load_bar, NT_SHOW);
			snprintf(str,sizeof(str), "Carregando arquivo");
		    xTaskCreate( (pdTASK_CODE)copy_file_task,     "format_mem_task    ",  512, p_file_path, 1, &xHdlTaskFilecopy);
		}
		changeTxt(&txt_version,str);
		mn_screen_create_timer(&timer0,200);
		mn_screen_start_timer(&timer0);
	}
	else if (p_page_hdl->event == EVENT_SIGNAL(timer0.id,EVENT_TIMER))
	{
		if(progress_val <= 10)
		{
			widgetProgressBar(&load_bar,(progress_val*100)/10);
			progress_val++;
		}
		else
		{
			progress_val = 0;
		}
	}
	else if (p_page_hdl->event == FILE_LOAD_EVENT)
	{
		mn_screen_change(&main_page,EVENT_SHOW);
	}
	else if (p_page_hdl->event == EMERGENCIA_SIGNAL_EVENT)
	{
		emergencia_args.p_ret_page = page;
		emergencia_page.p_args = &emergencia_args;
		mn_screen_change(&emergencia_page,EVENT_SHOW);
	}
}
Esempio n. 2
0
void CollapsibleHeaderWidget::toggleCollapsedState()
{
    // Toggle our collapsed state

    mCollapsed = !mCollapsed;

    // Update our button's icon to reflect our new collapsed state

    if (mCollapsed)
        mButton->setIcon(QIcon(":/oxygen/actions/arrow-right.png"));
    else
        mButton->setIcon(QIcon(":/oxygen/actions/arrow-down.png"));

    // Update our bottom separator visible status

    updateBottomSeparatorVisibleStatus();

    // Let people know about our new new collapsed state

    emit widgetVisible(!mCollapsed);
}
Esempio n. 3
0
/**
 * @brief Delete notification bar from visible elements and widget on scroll area
 * @param widget Chatroom widget to remove from tracked widgets
 */
void NotificationScrollArea::updateTracking(GenericChatroomWidget *widget)
{
    QHash<GenericChatroomWidget*, Visibility>::iterator i = trackedWidgets.begin();
    while (i != trackedWidgets.end())
    {
        if (i.key() == widget || widgetVisible(i.key()) == Visible)
        {
            if (i.value() == Above)
            {
                if (--referencesAbove == 0)
                {
                    topEdge->deleteLater();
                    topEdge = nullptr;
                }
                else
                {
                    topEdge->updateNotificationCount(referencesAbove);
                }
            }
            else
            {
                if (--referencesBelow == 0)
                {
                    bottomEdge->deleteLater();
                    bottomEdge = nullptr;
                }
                else
                {
                    bottomEdge->updateNotificationCount(referencesBelow);
                }
            }
            i = trackedWidgets.erase(i);
            continue;
        }
        ++i;
    }
}
Esempio n. 4
0
void NotificationScrollArea::trackWidget(GenericChatroomWidget* widget)
{
    if (trackedWidgets.find(widget) != trackedWidgets.end())
        return;

    Visibility visibility = widgetVisible(widget);
    if (visibility != Visible)
    {
        if (visibility == Above)
        {
            if (referencesAbove++ == 0)
            {
                assert(topEdge == nullptr);
                topEdge = new NotificationEdgeWidget(NotificationEdgeWidget::Top, this);
                connect(topEdge, &NotificationEdgeWidget::clicked, this, &NotificationScrollArea::findPreviousWidget);
                recalculateTopEdge();
                topEdge->show();
            }
            topEdge->updateNotificationCount(referencesAbove);
        }
        else
        {
            if (referencesBelow++ == 0)
            {
                assert(bottomEdge == nullptr);
                bottomEdge = new NotificationEdgeWidget(NotificationEdgeWidget::Bottom, this);
                connect(bottomEdge, &NotificationEdgeWidget::clicked, this, &NotificationScrollArea::findNextWidget);
                recalculateBottomEdge();
                bottomEdge->show();
            }
            bottomEdge->updateNotificationCount(referencesBelow);
        }

        trackedWidgets.insert(widget, visibility);
    }
}