2
0
forked from Ivasoft/DSView

fix: the last cache have not clear when the language be changed, so maybe the UI used an error text

This commit is contained in:
dreamsourcelabTAI
2024-04-29 14:40:00 +08:00
parent e75c068443
commit 42368463a3
4 changed files with 11 additions and 24 deletions

View File

@@ -338,7 +338,6 @@ namespace pv
_protocol_dock->setWindowTitle(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_PROTOCOL_DOCK_TITLE), "Decode Protocol"));
_measure_dock->setWindowTitle(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_MEASURE_DOCK_TITLE), "Measurement"));
_search_dock->setWindowTitle(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_SEARCH_DOCK_TITLE), "Search..."));
_view->get_time_view()->update_lang();
}
void MainWindow::on_load_file(QString file_name)

View File

@@ -98,11 +98,9 @@ bool LangResource::Load(int lang)
}
_cur_lang = lang;
_query_decoders.clear();
release_self();
release_self();
num = sizeof(lange_page_keys) / sizeof(lang_page_item);
for (int i = 0; i < num; i++)
@@ -131,6 +129,7 @@ void LangResource::release_self()
delete p;
}
_pages.clear();
_current_page = NULL;
}
void LangResource::load_page(Lang_resource_page &p)
@@ -225,8 +224,9 @@ const char* LangResource::get_lang_text(int page_id, const char *str_id, const c
return default_str;
}
if (_current_page->_loaded == false)
if (_current_page->_loaded == false){
load_page(*_current_page);
}
std::string key(str_id);

View File

@@ -108,7 +108,6 @@ Viewport::Viewport(View &parent, View_type type) :
_xAction = xAction;
setContextMenuPolicy(Qt::CustomContextMenu);
this->update_font();
connect(&_trigger_timer, SIGNAL(timeout()),this, SLOT(on_trigger_timer()));
connect(&_drag_timer, SIGNAL(timeout()),this, SLOT(on_drag_timer()));
@@ -2144,31 +2143,22 @@ void Viewport::add_cursor_x()
_view.show_xcursors(true);
}
void Viewport::update_font()
{
QFont font = this->font();
font.setPointSizeF(AppConfig::Instance().appOptions.fontSize);
_yAction->setFont(font);
_xAction->setFont(font);
}
void Viewport::update_lang()
void Viewport::UpdateLanguage()
{
_yAction->setText(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_ADD_Y_CURSOR), "Add Y-cursor"));
_xAction->setText(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_ADD_X_CURSOR), "Add X-cursor"));
}
void Viewport::UpdateLanguage()
{
}
void Viewport::UpdateTheme()
{
}
void Viewport::UpdateFont()
{
update_font();
QFont font = this->font();
font.setPointSizeF(AppConfig::Instance().appOptions.fontSize);
_yAction->setFont(font);
_xAction->setFont(font);
}
} // namespace view

View File

@@ -118,9 +118,7 @@ public:
void set_receive_len(quint64 length);
void unshow_wait_trigger();
void show_wait_trigger();
void update_lang();
void update_font();
void measure();
void update(int event);