示例#1
0
 void VerticalListLayout::onEvent(const Event &e)
 {
     Layouter::onEvent(e);
     if(e.type == EventType::Focus)
     {
         if(!e.focus.wasHandled() && (memberInFocus() || isFocused()))
         {
             if(e.focus.direction == UP)
             {
                 if(m_currentlyFocused != 0)
                 {
                     m_currentlyFocused -= 1;
                     e.focus.setHandled();
                     getGlobalConfig()->getFocusManager()->setFocused(getCurrentlyFocusedWidget(), e.playerID);
                 }
             }
             else if(e.focus.direction == DOWN)
             {
                 if((m_currentlyFocused + 1) < m_widgets->size())
                 {
                     m_currentlyFocused += 1;
                     e.focus.setHandled();
                     getGlobalConfig()->getFocusManager()->setFocused(getCurrentlyFocusedWidget(), e.playerID);
                 }
             }
         }
     }
 }
示例#2
0
void Connection::saveConfig (QString const & preset_name)
{
	QString const path = mkAppPresetPath(getGlobalConfig().m_appdir, getAppName(), preset_name);
	mkPath(path);
	QString const fname = path + "/" + getAppName() + ".xml";
	saveConfigTemplate(m_config, fname);
}
示例#3
0
文件: Label.cpp 项目: Pigaco/pihud
    void Label::redraw()
    {
        if(m_font && m_text.length() > 0)
        {
            if(m_renderedText != nullptr)
            {
                SDL_DestroyTexture(m_renderedText);
            }
            SDL_Surface *rendered = nullptr;

            if(getBoundingBox().w == 0)
            {
                rendered = TTF_RenderUTF8_Blended(m_font->getFont(), m_text.c_str(), m_color);
            }
            else
            {
                rendered = TTF_RenderUTF8_Blended_Wrapped(m_font->getFont(), m_text.c_str(), m_color, getBoundingBox().w);
            }

            if(rendered == nullptr)
            {
                cout << "Problem rendering text to surface: " << TTF_GetError() << endl;
            }
            m_renderedText = SDL_CreateTextureFromSurface(getGlobalConfig()->getSDLRenderer(), rendered);
            if(m_renderedText == nullptr)
            {
                cout << "Problem rendering text to texture: " << SDL_GetError() << endl;
            }
            SDL_FreeSurface(rendered);

            SDL_QueryTexture(m_renderedText, nullptr, nullptr, &m_textW, &m_textH);

            updateParent();
        }
    }
示例#4
0
void Connection::loadConfig (QString const & preset_name)
{
	QString const path = mkAppPresetPath(getGlobalConfig().m_appdir, getAppName(), preset_name);
	QString const fname = path + "/" + getAppName() + ".xml";
	bool const loaded = loadConfigTemplate(m_config, fname);
	if (!loaded)
	{
		m_config = ConnectionConfig();
		//m_config.m_tag = tag_backup; // defaultConfigFor destroys tag
	}
	setConfigValuesToUI(m_config);
}
示例#5
0
Connection::Connection (QString const & app_name, QObject * parent)
	: QThread(parent)
	, ActionAble(QStringList(qobject_cast<MainWindow *>(parent)->dockManager().path()) << app_name)
	, m_app_name(app_name)
	, m_main_window(qobject_cast<MainWindow *>(parent))
	, m_src_stream(e_Stream_TCP)
	, m_src_protocol(e_Proto_TLV)
	, m_config()
	, m_app_data()
	, m_storage_idx(-2)
	, m_recv_bytes(0)
	, m_marked_for_close(false)
	, m_curr_preset()
	, m_control_bar(0)
	, m_file_tlv_stream(0)
	, m_file_csv_stream(0)
	, m_file_size(0)
	, m_buffer(e_ringbuff_size)
	, m_current_cmd()
	, m_decoded_cmds(e_ringcmd_size)
	, m_storage(0)
	, m_tcp_dump_stream(0)
	, m_tcpstream(0)
{
	qDebug("Connection::Connection() this=0x%08x", this);

	m_control_bar = new ControlBarCommon();

	m_config.m_auto_scroll = getGlobalConfig().m_auto_scroll;
	m_config.m_level = getGlobalConfig().m_level;
	m_config.m_buffered = getGlobalConfig().m_buffered;
	m_config.m_time_units_str = getGlobalConfig().m_time_units_str;
	m_config.m_time_units = getGlobalConfig().m_time_units;
	m_config.m_font = getGlobalConfig().m_font;
	m_config.m_fontsize = getGlobalConfig().m_fontsize;

	static int counter = 0;
	m_storage_idx = counter;
	++counter;

	setConfigValuesToUI(m_config);

	connect(m_control_bar->ui->levelSpinBox, SIGNAL(valueChanged(int)), this, SLOT(onGuiLevelValueChanged(int)));
	connect(m_control_bar->ui->buffCheckBox, SIGNAL(stateChanged(int)), this, SLOT(onBufferingStateChanged(int)));
	connect(m_control_bar->ui->presetComboBox, SIGNAL(activated(int)), this, SLOT(onPresetChanged(int)));
	connect(m_control_bar->ui->activatePresetButton, SIGNAL(clicked()), this, SLOT(onPresetApply()));
	connect(m_control_bar->ui->presetSaveButton, SIGNAL(clicked()), this, SLOT(onPresetSave()));
	connect(m_control_bar->ui->presetAddButton, SIGNAL(clicked()), this, SLOT(onPresetAdd()));
	connect(m_control_bar->ui->presetRmButton, SIGNAL(clicked()), this, SLOT(onPresetRm()));
	connect(m_control_bar->ui->presetResetButton, SIGNAL(clicked()), this, SLOT(onPresetReset()));
	connect(m_control_bar->ui->logSlider, SIGNAL(valueChanged(int)), this, SLOT(onLogsStateChanged(int)));
	connect(m_control_bar->ui->plotSlider, SIGNAL(valueChanged(int)), this, SLOT(onPlotsStateChanged(int)));
	connect(m_control_bar->ui->tableSlider, SIGNAL(valueChanged(int)), this, SLOT(onTablesStateChanged(int)));
	connect(m_control_bar->ui->ganttSlider, SIGNAL(valueChanged(int)), this, SLOT(onGanttsStateChanged(int)));
}