Exemplo n.º 1
0
LabelStack::LabelStack(QWidget *parent) :
    QLabel(parent)
{
#ifdef Q_WS_MAC
    setAttribute(Qt::WA_MacSmallSize, true);
#endif
    m_temporaryCtx = -1;
    fillLabel();
}
Exemplo n.º 2
0
LabelStack::LabelStack(QWidget *parent) :
    QLabel(parent)
{
#ifdef Q_OS_MAC
    setAttribute(Qt::WA_MacSmallSize, true);
#endif
    temporary_ctx_ = -1;
    fillLabel();

    connect(&temporary_timer_, SIGNAL(timeout()), this, SLOT(updateTemporaryStatus()));
}
Exemplo n.º 3
0
void LabelStack::popText(int ctx) {
    QMutableListIterator<StackItem *> iter(labels_);

    while (iter.hasNext()) {
        if (iter.next()->ctx == ctx) {
            iter.remove();
            break;
        }
    }

    fillLabel();
}
Exemplo n.º 4
0
void LabelStack::pushText(QString &text, int ctx) {
    StackItem *si = new StackItem;
    si->text = text;
    si->ctx = ctx;
    m_labels.prepend(si);

    if (ctx == m_temporaryCtx) {
        QTimer::singleShot(TEMPORARY_MSG_TIMEOUT, this, SLOT(popTemporaryText()));
    }

    fillLabel();
}
Exemplo n.º 5
0
void LogUI::onGUI()
{
	Lumix::MT::SpinLock lock(m_guard);
	showNotifications();

	if (!m_is_opened) return;

	if (ImGui::Begin("Log", &m_is_opened))
	{
		const char* labels[] = { "Info", "Warning", "Error", "BGFX" };
		for (int i = 0; i < Lumix::lengthOf(labels); ++i)
		{
			char label[20];
			fillLabel(label, sizeof(label), labels[i], m_new_message_count[i]);
			if(i > 0) ImGui::SameLine();
			if (ImGui::Button(label))
			{
				m_current_tab = i;
				m_new_message_count[i] = 0;
			}
		}
		
		auto* messages = &m_messages[m_current_tab];

		if (ImGui::Button("Clear"))
		{
			for (int i = 0; i < m_messages.size(); ++i)
			{
				m_messages[i].clear();
				m_new_message_count[i] = 0;
			}
		}

		ImGui::SameLine();
		char filter[128] = "";
		ImGui::InputText("Filter", filter, sizeof(filter));

		if (ImGui::BeginChild("log_messages"))
		{
			for (int i = 0; i < messages->size(); ++i)
			{
				const char* msg = (*messages)[i].c_str();
				if (filter[0] == '\0' || strstr(msg, filter) != nullptr)
				{
					ImGui::Text(msg);
				}
			}
		}
		ImGui::EndChild();
	}
	ImGui::End();
}
Exemplo n.º 6
0
void LabelStack::pushText(QString &text, int ctx) {
    StackItem *si = new StackItem;

    if (ctx == temporary_ctx_) {
        temporary_timer_.stop();
        popText(temporary_ctx_);

        temporary_epoch_.start();
        temporary_timer_.start(temporary_flash_timeout_);
        emit toggleTemporaryFlash(true);
    }

    si->text = text;
    si->ctx = ctx;
    labels_.prepend(si);
    fillLabel();
}