diff --git a/DSView/pv/config/appconfig.cpp b/DSView/pv/config/appconfig.cpp index bcaac225..f2791125 100644 --- a/DSView/pv/config/appconfig.cpp +++ b/DSView/pv/config/appconfig.cpp @@ -121,6 +121,7 @@ static void _loadApp(AppOptions &o, QSettings &st) getFiled("trigPosDisplayInMid", st, o.trigPosDisplayInMid, true); getFiled("displayProfileInBar", st, o.displayProfileInBar, false); getFiled("swapBackBufferAlways", st, o.swapBackBufferAlways, false); + getFiled("fontSize", st, o.fontSize, 9.0); QString fmt; getFiled("protocalFormats", st, fmt, ""); @@ -144,6 +145,7 @@ static void _saveApp(AppOptions &o, QSettings &st) setFiled("trigPosDisplayInMid", st, o.trigPosDisplayInMid); setFiled("displayProfileInBar", st, o.displayProfileInBar); setFiled("swapBackBufferAlways", st, o.swapBackBufferAlways); + setFiled("fontSize", st, o.fontSize); QString fmt = FormatArrayToString(o.m_protocolFormats); setFiled("protocalFormats", st, fmt); @@ -318,7 +320,6 @@ void AppConfig::LoadAll() _loadApp(appOptions, st); _loadHistory(userHistory, st); _loadFrame(frameOptions, st); - _loadFont(fontOptions, st); //dsv_dbg("Config file path:\"%s\"", st.fileName().toUtf8().data()); } @@ -341,12 +342,6 @@ void AppConfig::SaveFrame() _saveFrame(frameOptions, st); } -void AppConfig::SaveFont() -{ - QSettings st(QApplication::organizationName(), QApplication::applicationName()); - _saveFont(fontOptions, st); -} - void AppConfig::SetProtocolFormat(const std::string &protocolName, const std::string &value) { bool bChange = false; diff --git a/DSView/pv/config/appconfig.h b/DSView/pv/config/appconfig.h index 02c642d5..e34b91ea 100644 --- a/DSView/pv/config/appconfig.h +++ b/DSView/pv/config/appconfig.h @@ -65,6 +65,7 @@ struct AppOptions bool trigPosDisplayInMid; bool displayProfileInBar; bool swapBackBufferAlways; + float fontSize; std::vector m_protocolFormats; }; @@ -136,7 +137,6 @@ public: void SaveApp(); void SaveHistory(); void SaveFrame(); - void SaveFont(); void SetProtocolFormat(const std::string &protocolName, const std::string &value); std::string GetProtocolFormat(const std::string &protocolName); @@ -150,5 +150,4 @@ public: AppOptions appOptions; UserHistory userHistory; FrameOptions frameOptions; - FontOptions fontOptions; }; diff --git a/DSView/pv/dialogs/applicationpardlg.cpp b/DSView/pv/dialogs/applicationpardlg.cpp index eb076a0e..0635044d 100644 --- a/DSView/pv/dialogs/applicationpardlg.cpp +++ b/DSView/pv/dialogs/applicationpardlg.cpp @@ -135,65 +135,10 @@ bool ApplicationParamDlg::ShowDlg(QWidget *parent) lay.addRow(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_DISPLAY_PROFILE_IN_BAR), "Profile in bar"), ck_profileBar); - //----------------Font setting. - std::vector font_bind_list; - FontBindInfo ft1 = {NULL, NULL, S_ID(IDS_DLG_TOOLBAR_FONT), "Toolbar", - &app.fontOptions.toolbar.name, &app.fontOptions.toolbar.size}; - font_bind_list.push_back(ft1); - - FontBindInfo ft2 = {NULL, NULL, S_ID(IDS_DLG_CHANNEL_NAME_FONT), "Channel Name", - &app.fontOptions.channelLabel.name, &app.fontOptions.channelLabel.size}; - font_bind_list.push_back(ft2); - - FontBindInfo ft3 = {NULL, NULL, S_ID(IDS_DLG_CHANNEL_BODY_FONT), "Channel Body", - &app.fontOptions.channelBody.name, &app.fontOptions.channelBody.size}; - font_bind_list.push_back(ft3); - - FontBindInfo ft4 = {NULL, NULL, S_ID(IDS_DLG_RULER_FONT), "Ruler", - &app.fontOptions.ruler.name, &app.fontOptions.ruler.size}; - font_bind_list.push_back(ft4); - - FontBindInfo ft5 = {NULL, NULL, S_ID(IDS_DLG_TITLE_FONT), "Titel", - &app.fontOptions.title.name, &app.fontOptions.title.size}; - font_bind_list.push_back(ft5); - - FontBindInfo ft6 = {NULL, NULL, S_ID(IDS_DLG_OTHER_FONT), "Other", - &app.fontOptions.other.name, &app.fontOptions.other.size}; - font_bind_list.push_back(ft6); - - QWidget *lineSpace = new QWidget(); - lineSpace->setFixedHeight(8); - lay.addRow(lineSpace); - - QGroupBox *ftGroup = new QGroupBox(); - ftGroup->setTitle(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_FONT_GROUP), "Font")); - QVBoxLayout *ftPannelLay = new QVBoxLayout(); - ftGroup->setLayout(ftPannelLay); - ftPannelLay->setContentsMargins(5,15,5,10); - - for (FontBindInfo &inf : font_bind_list) - { - QWidget *ftWid = new QWidget(); - QHBoxLayout *ftLay = new QHBoxLayout(); - ftLay->setContentsMargins(0,0,0,0); - ftWid->setLayout(ftLay); - QString ftLb = LangResource::Instance()->get_lang_text(STR_PAGE_DLG, - inf.lang_id.toUtf8().data(), inf.lang_def); - ftLay->addWidget(new QLabel(ftLb)); - QComboBox *ftCbName = new DsComboBox(); - bind_font_name_list(ftCbName, *inf.ptr_name); - ftLay->addWidget(ftCbName); - QComboBox *ftCbSize = new DsComboBox(); - ftCbSize->setFixedWidth(50); - bind_font_size_list(ftCbSize, *inf.ptr_size); - ftLay->addWidget(ftCbSize); - ftPannelLay->addWidget(ftWid); - - inf.name_box = ftCbName; - inf.size_box = ftCbSize; - } - - lay.addRow(ftGroup); + QComboBox *ftCbSize = new DsComboBox(); + ftCbSize->setFixedWidth(50); + bind_font_size_list(ftCbSize, app.appOptions.fontSize); + lay.addRow(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_FONT_SIZE), "Font size"), ftCbSize); dlg.layout()->addLayout(&lay); @@ -206,6 +151,7 @@ bool ApplicationParamDlg::ShowDlg(QWidget *parent) bool bAppChanged = false; bool bFontChanged = false; + float fSize = ftCbSize->currentText().toFloat(); if (app.appOptions.quickScroll != ck_quickScroll->isChecked()){ app.appOptions.quickScroll = ck_quickScroll->isChecked(); @@ -222,37 +168,23 @@ bool ApplicationParamDlg::ShowDlg(QWidget *parent) if (app.appOptions.swapBackBufferAlways != ck_abortData->isChecked()){ app.appOptions.swapBackBufferAlways = ck_abortData->isChecked(); bAppChanged = true; + } + if (app.appOptions.fontSize != fSize){ + app.appOptions.fontSize = fSize; + bFontChanged = true; } - - for (FontBindInfo &inf : font_bind_list) - { - QString oldName = *inf.ptr_name; - float oldSize = *inf.ptr_size; - - if (inf.name_box->currentIndex() > 0) - *inf.ptr_name = inf.name_box->currentText(); - else - *inf.ptr_name = ""; - - if (inf.size_box->currentIndex() >= 0) - *inf.ptr_size = inf.size_box->currentText().toFloat(); - else - *inf.ptr_size = 9; - - if (oldName != *inf.ptr_name || oldSize != *inf.ptr_size){ - bFontChanged = true; - } - } - - if (bFontChanged){ - app.SaveFont(); - AppControl::Instance()->GetSession()->broadcast_msg(DSV_MSG_FONT_OPTIONS_CHANGED); - } - + if (bAppChanged){ app.SaveApp(); AppControl::Instance()->GetSession()->broadcast_msg(DSV_MSG_APP_OPTIONS_CHANGED); - } + } + + if (bFontChanged){ + if (!bAppChanged){ + app.SaveApp(); + } + AppControl::Instance()->GetSession()->broadcast_msg(DSV_MSG_FONT_OPTIONS_CHANGED); + } } return ret; diff --git a/DSView/pv/dialogs/dsdialog.cpp b/DSView/pv/dialogs/dsdialog.cpp index 79cee824..71c1cacb 100644 --- a/DSView/pv/dialogs/dsdialog.cpp +++ b/DSView/pv/dialogs/dsdialog.cpp @@ -176,9 +176,8 @@ void DSDialog::build_base(bool hasClose) void DSDialog::update_font() { - FontOptions &st = AppConfig::Instance().fontOptions; QFont font = this->font(); - ui::set_font_param(font, st.other); + font.setPointSizeF(AppConfig::Instance().appOptions.fontSize); ui::set_form_font(this, font); if (_titlebar != NULL){ diff --git a/DSView/pv/dialogs/dsmessagebox.cpp b/DSView/pv/dialogs/dsmessagebox.cpp index 2b3559d5..38f32c96 100644 --- a/DSView/pv/dialogs/dsmessagebox.cpp +++ b/DSView/pv/dialogs/dsmessagebox.cpp @@ -130,9 +130,8 @@ void DSMessageBox::on_button(QAbstractButton *btn) int DSMessageBox::exec() { - FontOptions &st = AppConfig::Instance().fontOptions; QFont font = this->font(); - ui::set_font_param(font, st.other); + font.setPointSizeF(AppConfig::Instance().appOptions.fontSize); ui::set_form_font(this, font); if (_titlebar != NULL){ diff --git a/DSView/pv/dialogs/waitingdialog.cpp b/DSView/pv/dialogs/waitingdialog.cpp index e80225d8..836bb4be 100644 --- a/DSView/pv/dialogs/waitingdialog.cpp +++ b/DSView/pv/dialogs/waitingdialog.cpp @@ -32,8 +32,8 @@ #include "../view/trace.h" #include "../view/dsosignal.h" #include "../config/appconfig.h" - #include "../ui/langresource.h" +#include "../appcontrol.h" using namespace boost; using namespace std; @@ -57,7 +57,7 @@ WaitingDialog::WaitingDialog(QWidget *parent, SigSession *session, int key) : this->setWindowOpacity(0.7); QFont font; - font.setPointSize(9); + font.setPointSizeF(AppConfig::Instance().appOptions.fontSize); font.setBold(true); QLabel *warning_tips = new QLabel(this); diff --git a/DSView/pv/dock/dsotriggerdock.cpp b/DSView/pv/dock/dsotriggerdock.cpp index c37dced3..abfaa670 100644 --- a/DSView/pv/dock/dsotriggerdock.cpp +++ b/DSView/pv/dock/dsotriggerdock.cpp @@ -494,10 +494,9 @@ void DsoTriggerDock::update_view() void DsoTriggerDock::update_font() { QFont font = this->font(); - FontOptions &st = AppConfig::Instance().fontOptions; - ui::set_font_param(font, st.other); + font.setPointSizeF(AppConfig::Instance().appOptions.fontSize); ui::set_form_font(this, font); - + font.setPointSizeF(font.pointSizeF() + 1); this->parentWidget()->setFont(font); } diff --git a/DSView/pv/dock/measuredock.cpp b/DSView/pv/dock/measuredock.cpp index e277c7e1..f6928687 100644 --- a/DSView/pv/dock/measuredock.cpp +++ b/DSView/pv/dock/measuredock.cpp @@ -709,10 +709,9 @@ void MeasureDock::del_cursor() void MeasureDock::update_font() { QFont font = this->font(); - FontOptions &st = AppConfig::Instance().fontOptions; - ui::set_font_param(font, st.other); + font.setPointSizeF(AppConfig::Instance().appOptions.fontSize); ui::set_form_font(this, font); - + font.setPointSizeF(font.pointSizeF() + 1); this->parentWidget()->setFont(font); } diff --git a/DSView/pv/dock/protocoldock.cpp b/DSView/pv/dock/protocoldock.cpp index 1487dbc3..bad191e2 100644 --- a/DSView/pv/dock/protocoldock.cpp +++ b/DSView/pv/dock/protocoldock.cpp @@ -1034,10 +1034,9 @@ bool ProtocolDock::protocol_sort_callback(const DecoderInfoItem *o1, const Decod void ProtocolDock::update_font() { QFont font = this->font(); - FontOptions &st = AppConfig::Instance().fontOptions; - ui::set_font_param(font, st.other); + font.setPointSizeF(AppConfig::Instance().appOptions.fontSize); ui::set_form_font(this, font); - + font.setPointSizeF(font.pointSizeF() + 1); this->parentWidget()->setFont(font); } diff --git a/DSView/pv/dock/searchcombobox.cpp b/DSView/pv/dock/searchcombobox.cpp index 85a16426..19c18eef 100644 --- a/DSView/pv/dock/searchcombobox.cpp +++ b/DSView/pv/dock/searchcombobox.cpp @@ -134,8 +134,7 @@ void SearchComboBox::ShowDlg(QWidget *editline) this, SLOT(on_keyword_changed(const QString &))); QFont font = this->font(); - FontOptions &st = AppConfig::Instance().fontOptions; - ui::set_font_param(font, st.other); + font.setPointSizeF(AppConfig::Instance().appOptions.fontSize); ui::set_form_font(this, font); this->show(); diff --git a/DSView/pv/dock/searchdock.cpp b/DSView/pv/dock/searchdock.cpp index 01f8b0c8..bf4cf1e0 100644 --- a/DSView/pv/dock/searchdock.cpp +++ b/DSView/pv/dock/searchdock.cpp @@ -256,8 +256,7 @@ void SearchDock::on_set() void SearchDock::update_font() { QFont font = this->font(); - FontOptions &st = AppConfig::Instance().fontOptions; - ui::set_font_param(font, st.other); + font.setPointSizeF(AppConfig::Instance().appOptions.fontSize); _search_value->setFont(font); } diff --git a/DSView/pv/dock/triggerdock.cpp b/DSView/pv/dock/triggerdock.cpp index b99fccd1..e36a3d88 100644 --- a/DSView/pv/dock/triggerdock.cpp +++ b/DSView/pv/dock/triggerdock.cpp @@ -1071,10 +1071,9 @@ void TriggerDock::on_serial_hex_changed() void TriggerDock::update_font() { QFont font = this->font(); - FontOptions &st = AppConfig::Instance().fontOptions; - ui::set_font_param(font, st.other); + font.setPointSizeF(AppConfig::Instance().appOptions.fontSize); ui::set_form_font(this, font); - + font.setPointSizeF(font.pointSizeF() + 1); this->parentWidget()->setFont(font); } diff --git a/DSView/pv/toolbars/filebar.cpp b/DSView/pv/toolbars/filebar.cpp index e0b1b2bf..769a51ee 100644 --- a/DSView/pv/toolbars/filebar.cpp +++ b/DSView/pv/toolbars/filebar.cpp @@ -255,10 +255,9 @@ void FileBar::update_view_status() } void FileBar::update_font() -{ - FontOptions &st = AppConfig::Instance().fontOptions; +{ QFont font = this->font(); - ui::set_font_param(font, st.toolbar); + font.setPointSizeF(AppConfig::Instance().appOptions.fontSize); ui::set_toolbar_font(this, font); } diff --git a/DSView/pv/toolbars/logobar.cpp b/DSView/pv/toolbars/logobar.cpp index 215d5881..a307be0f 100644 --- a/DSView/pv/toolbars/logobar.cpp +++ b/DSView/pv/toolbars/logobar.cpp @@ -349,10 +349,9 @@ void LogoBar::on_clear_log_file() } void LogoBar::update_font() -{ - FontOptions &st = AppConfig::Instance().fontOptions; +{ QFont font = this->font(); - ui::set_font_param(font, st.toolbar); + font.setPointSizeF(AppConfig::Instance().appOptions.fontSize); ui::set_toolbar_font(this, font); } diff --git a/DSView/pv/toolbars/samplingbar.cpp b/DSView/pv/toolbars/samplingbar.cpp index b2a8bbc1..656ae573 100644 --- a/DSView/pv/toolbars/samplingbar.cpp +++ b/DSView/pv/toolbars/samplingbar.cpp @@ -1252,10 +1252,9 @@ namespace pv } void SamplingBar::update_font() - { - FontOptions &st = AppConfig::Instance().fontOptions; + { QFont font = this->font(); - ui::set_font_param(font, st.toolbar); + font.setPointSizeF(AppConfig::Instance().appOptions.fontSize); ui::set_toolbar_font(this, font); } diff --git a/DSView/pv/toolbars/titlebar.cpp b/DSView/pv/toolbars/titlebar.cpp index 71c3bcf5..c1c00b37 100644 --- a/DSView/pv/toolbars/titlebar.cpp +++ b/DSView/pv/toolbars/titlebar.cpp @@ -237,10 +237,9 @@ void TitleBar::mouseDoubleClickEvent(QMouseEvent *event) } void TitleBar::update_font() -{ - FontOptions &st = AppConfig::Instance().fontOptions; +{ QFont font = this->font(); - ui::set_font_param(font, st.title); + font.setPointSizeF(AppConfig::Instance().appOptions.fontSize + 2); _title->setFont(font); } diff --git a/DSView/pv/toolbars/trigbar.cpp b/DSView/pv/toolbars/trigbar.cpp index 2eb8a736..6c0851a7 100644 --- a/DSView/pv/toolbars/trigbar.cpp +++ b/DSView/pv/toolbars/trigbar.cpp @@ -254,7 +254,7 @@ void TrigBar::reload() _search_action->setVisible(false); _function_action->setVisible(false); _action_lissajous->setVisible(false); - _action_dispalyOptions->setVisible(false); + _action_dispalyOptions->setVisible(true); } else if (mode == DSO) { _trig_action->setVisible(true); @@ -372,10 +372,9 @@ void TrigBar::update_checked_status() } void TrigBar::update_font() -{ - FontOptions &st = AppConfig::Instance().fontOptions; +{ QFont font = this->font(); - ui::set_font_param(font, st.toolbar); + font.setPointSizeF(AppConfig::Instance().appOptions.fontSize); ui::set_toolbar_font(this, font); } diff --git a/DSView/pv/ui/dscombobox.cpp b/DSView/pv/ui/dscombobox.cpp index 33d7f2eb..7d769bf2 100644 --- a/DSView/pv/ui/dscombobox.cpp +++ b/DSView/pv/ui/dscombobox.cpp @@ -23,11 +23,8 @@ #include "dscombobox.h" #include #include - -#ifdef Q_OS_DARWIN #include #include -#endif #include "../config/appconfig.h" @@ -59,19 +56,22 @@ DsComboBox::DsComboBox(QWidget *parent) : QComboBox(parent) QComboBox::showPopup(); _bPopup = true; -#ifdef Q_OS_DARWIN - QWidget *popup = this->findChild(); auto rc = popup->geometry(); - int x = rc.left() + 6; + int x = rc.left(); int y = rc.top(); - int w = rc.right() - rc.left(); + int w = rc.right() - rc.left() + 2; int h = rc.bottom() - rc.top() + 20; + +#ifdef Q_OS_DARWIN + x += 6; +#endif + popup->setGeometry(x, y, w, h); int sy = QGuiApplication::primaryScreen()->size().height(); if (sy <= 1080){ - popup->setMaximumHeight(750); + popup->setMaximumHeight(750); } if (AppConfig::Instance().frameOptions.style == THEME_STYLE_DARK){ @@ -80,7 +80,6 @@ DsComboBox::DsComboBox(QWidget *parent) : QComboBox(parent) else{ popup->setStyleSheet("background-color:#white;"); } -#endif } void DsComboBox::hidePopup() diff --git a/DSView/pv/ui/fun.cpp b/DSView/pv/ui/fun.cpp index a9957508..6e3b721a 100644 --- a/DSView/pv/ui/fun.cpp +++ b/DSView/pv/ui/fun.cpp @@ -29,10 +29,11 @@ #include #include #include -#include +#include #include #include #include +#include #include "../config/appconfig.h" @@ -48,7 +49,7 @@ namespace ui } } - void set_toolbar_font(QToolBar *bar, QFont &font) + void set_toolbar_font(QToolBar *bar, QFont font) { assert(bar); @@ -83,7 +84,7 @@ namespace ui } } - void set_form_font(QWidget *wid, QFont &font) + void set_form_font(QWidget *wid, QFont font) { assert(wid); @@ -97,6 +98,9 @@ namespace ui for(auto o : comboxs) { o->setFont(font); + + // int h = o->sizeHint().height() + 50; + //o->setMinimumHeight(h); } auto labels = wid->findChildren(); @@ -123,13 +127,19 @@ namespace ui o->setFont(font); } + auto checks = wid->findChildren(); + for(auto o : checks) + { + o->setFont(font); + } + // Magnify the size. font.setPointSizeF(font.pointSizeF() + 1); - auto tabs = wid->findChildren(); + auto tabs = wid->findChildren(); for(auto o : tabs) { - o->setFont(font); + o->setFont(font); } auto groups = wid->findChildren(); diff --git a/DSView/pv/ui/fun.h b/DSView/pv/ui/fun.h index 0fae3a5c..29468b46 100644 --- a/DSView/pv/ui/fun.h +++ b/DSView/pv/ui/fun.h @@ -33,9 +33,9 @@ namespace ui { void set_font_param(QFont &font, struct FontParam ¶m); - void set_toolbar_font(QToolBar *bar, QFont &font); + void set_toolbar_font(QToolBar *bar, QFont font); - void set_form_font(QWidget *wid, QFont &font); + void set_form_font(QWidget *wid, QFont font); } // namespace ui diff --git a/DSView/pv/view/devmode.cpp b/DSView/pv/view/devmode.cpp index 0e96248d..f018deeb 100644 --- a/DSView/pv/view/devmode.cpp +++ b/DSView/pv/view/devmode.cpp @@ -34,8 +34,9 @@ #include "../config/appconfig.h" #include "../ui/msgbox.h" #include "../log.h" - #include "../ui/langresource.h" +#include "../appcontrol.h" +#include "../ui/fun.h" static const struct dev_mode_name dev_mode_name_list[] = @@ -89,6 +90,8 @@ DevMode::DevMode(QWidget *parent, SigSession *session) : layout->setStretch(1, 100); setLayout(layout); + update_font(); + connect(_close_button, SIGNAL(clicked()), this, SLOT(on_close())); } @@ -174,7 +177,8 @@ void DevMode::set_device() _bFile = true; } - update(); + update_font(); + update(); } void DevMode::paintEvent(QPaintEvent*) @@ -233,6 +237,8 @@ void DevMode::on_mode_change() break; } } + + update_font(); } void DevMode::on_close() @@ -280,5 +286,22 @@ const struct dev_mode_name* DevMode::get_mode_name(int mode) assert(false); } +void DevMode::update_font() +{ + QFont font = this->font(); + font.setPointSizeF(AppConfig::Instance().appOptions.fontSize); + + auto buttons = this->findChildren(); + for(auto o : buttons) + { + o->setFont(font); + } + + for (auto it = _mode_list.begin(); it != _mode_list.end(); it++) + { + (*it).first->setFont(font); + } +} + } // namespace view } // namespace pv diff --git a/DSView/pv/view/devmode.h b/DSView/pv/view/devmode.h index 638e1eab..7377eebc 100644 --- a/DSView/pv/view/devmode.h +++ b/DSView/pv/view/devmode.h @@ -27,15 +27,15 @@ #include #include #include - #include #include #include #include #include - #include +#include "../interface/icallbacks.h" + struct dev_mode_name{ int _mode; const char *_logo; @@ -50,7 +50,7 @@ class SigSession; namespace view { //devece work mode select list -class DevMode : public QWidget +class DevMode : public QWidget, public IFontForm { Q_OBJECT @@ -71,6 +71,9 @@ private: void changeEvent(QEvent *event); const dev_mode_name* get_mode_name(int mode); + //IFontForm + void update_font(); + public slots: void set_device(); void on_mode_change(); diff --git a/DSView/pv/view/header.cpp b/DSView/pv/view/header.cpp index 39a34589..cceed736 100644 --- a/DSView/pv/view/header.cpp +++ b/DSView/pv/view/header.cpp @@ -126,10 +126,9 @@ void Header::paintEvent(QPaintEvent*) const bool dragging = !_drag_traces.empty(); QColor fore(QWidget::palette().color(QWidget::foregroundRole())); fore.setAlpha(View::ForeAlpha); - - FontOptions &st = AppConfig::Instance().fontOptions; + QFont font(painter.font()); - ui::set_font_param(font, st.channelLabel); + font.setPointSizeF(9); painter.setFont(font); for(auto t : traces) diff --git a/DSView/pv/view/ruler.cpp b/DSView/pv/view/ruler.cpp index d4f4fdcb..bc5adc60 100644 --- a/DSView/pv/view/ruler.cpp +++ b/DSView/pv/view/ruler.cpp @@ -197,8 +197,7 @@ void Ruler::paintEvent(QPaintEvent*) style()->drawPrimitive(QStyle::PE_Widget, &o, &p, this); QFont font = p.font(); - FontOptions &st = AppConfig::Instance().fontOptions; - ui::set_font_param(font, st.ruler); + font.setPointSizeF(9); p.setFont(font); SigSession *session = AppControl::Instance()->GetSession(); diff --git a/DSView/pv/view/view.cpp b/DSView/pv/view/view.cpp index 1a1267bf..1c2ffcf7 100644 --- a/DSView/pv/view/view.cpp +++ b/DSView/pv/view/view.cpp @@ -49,6 +49,7 @@ #include "../dsvdef.h" #include "../log.h" #include "../config/appconfig.h" +#include "../appcontrol.h" using namespace std; @@ -120,6 +121,8 @@ View::View(SigSession *session, pv::toolbars::SamplingBar *sampling_bar, QWidget _ruler = new Ruler(*this); _header = new Header(*this); _devmode = new DevMode(this, session); + + AppControl::Instance()->add_font_form(_devmode); setViewportMargins(headerWidth(), RulerHeight, 0, 0); diff --git a/DSView/pv/view/viewport.cpp b/DSView/pv/view/viewport.cpp index 9e9fb5e4..b404ecb0 100644 --- a/DSView/pv/view/viewport.cpp +++ b/DSView/pv/view/viewport.cpp @@ -156,8 +156,7 @@ void Viewport::doPaint() style()->drawPrimitive(QStyle::PE_Widget, &o, &p, this); QFont font = p.font(); - FontOptions &st = AppConfig::Instance().fontOptions; - ui::set_font_param(font, st.channelBody); + font.setPointSizeF(9); p.setFont(font); _view.session().check_update(); @@ -558,8 +557,7 @@ void Viewport::paintProgress(QPainter &p, QColor fore, QColor back) p.setPen(View::Blue); QFont font = p.font(); - FontOptions &st = AppConfig::Instance().fontOptions; - ui::set_font_param(font, st.channelBody); + font.setPointSizeF(9); font.setBold(true); p.setFont(font); diff --git a/DSView/pv/view/viewstatus.cpp b/DSView/pv/view/viewstatus.cpp index d2ebb89d..41806fe7 100644 --- a/DSView/pv/view/viewstatus.cpp +++ b/DSView/pv/view/viewstatus.cpp @@ -70,8 +70,7 @@ void ViewStatus::paintEvent(QPaintEvent *) QColor fore(QWidget::palette().color(QWidget::foregroundRole())); QFont font = p.font(); - FontOptions &st = AppConfig::Instance().fontOptions; - ui::set_font_param(font, st.channelBody); + font.setPointSizeF(9); p.setFont(font); int mode = _session->get_device()->get_work_mode(); diff --git a/lang/cn/dlg.json b/lang/cn/dlg.json index 317b9e78..b12f956d 100644 --- a/lang/cn/dlg.json +++ b/lang/cn/dlg.json @@ -704,35 +704,7 @@ "text": "重复模式下允许使用中途停止的数据" }, { - "id": "IDS_DLG_FONT_GROUP", - "text": "字体设置" - }, - { - "id": "IDS_DLG_TOOLBAR_FONT", - "text": "工具栏" - }, - { - "id": "IDS_DLG_CHANNEL_NAME_FONT", - "text": "通道名称" - }, - { - "id": "IDS_DLG_CHANNEL_BODY_FONT", - "text": "通道内容" - }, - { - "id": "IDS_DLG_RULER_FONT", - "text": "刻度" - }, - { - "id": "IDS_DLG_TITLE_FONT", - "text": "标题" - }, - { - "id": "IDS_DLG_OTHER_FONT", - "text": "其它" - }, - { - "id": "IDS_DLG_DEFAULT_FONT", - "text": "默认" + "id": "IDS_DLG_FONT_SIZE", + "text": "字体大小" } ] \ No newline at end of file diff --git a/lang/en/dlg.json b/lang/en/dlg.json index 0912dd79..0120c1ca 100644 --- a/lang/en/dlg.json +++ b/lang/en/dlg.json @@ -704,35 +704,7 @@ "text": "Allow use of the midway stopped data on repeat mode" }, { - "id": "IDS_DLG_FONT_GROUP", - "text": "Font Setting" - }, - { - "id": "IDS_DLG_TOOLBAR_FONT", - "text": "Toolbar" - }, - { - "id": "IDS_DLG_CHANNEL_NAME_FONT", - "text": "Channel Name" - }, - { - "id": "IDS_DLG_CHANNEL_BODY_FONT", - "text": "Channel Body" - }, - { - "id": "IDS_DLG_RULER_FONT", - "text": "Ruler" - }, - { - "id": "IDS_DLG_TITLE_FONT", - "text": "Title" - }, - { - "id": "IDS_DLG_OTHER_FONT", - "text": "Other" - }, - { - "id": "IDS_DLG_DEFAULT_FONT", - "text": "Default" + "id": "IDS_DLG_FONT_SIZE", + "text": "Font Size" } ] \ No newline at end of file