forked from Ivasoft/DSView
All interfaces use the same font size
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -65,6 +65,7 @@ struct AppOptions
|
||||
bool trigPosDisplayInMid;
|
||||
bool displayProfileInBar;
|
||||
bool swapBackBufferAlways;
|
||||
float fontSize;
|
||||
|
||||
std::vector<StringPair> 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;
|
||||
};
|
||||
|
||||
@@ -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<FontBindInfo> 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;
|
||||
|
||||
@@ -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){
|
||||
|
||||
@@ -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){
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,11 +23,8 @@
|
||||
#include "dscombobox.h"
|
||||
#include <QFontMetrics>
|
||||
#include <QString>
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
#include <QGuiApplication>
|
||||
#include <QScreen>
|
||||
#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<QFrame*>();
|
||||
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()
|
||||
|
||||
@@ -29,10 +29,11 @@
|
||||
#include <QToolBar>
|
||||
#include <QWidget>
|
||||
#include <QLineEdit>
|
||||
#include <QTableWidget>
|
||||
#include <QTabWidget>
|
||||
#include <QGroupBox>
|
||||
#include <QTextEdit>
|
||||
#include <QRadioButton>
|
||||
#include <QCheckBox>
|
||||
|
||||
#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<QLabel*>();
|
||||
@@ -123,13 +127,19 @@ namespace ui
|
||||
o->setFont(font);
|
||||
}
|
||||
|
||||
auto checks = wid->findChildren<QCheckBox*>();
|
||||
for(auto o : checks)
|
||||
{
|
||||
o->setFont(font);
|
||||
}
|
||||
|
||||
// Magnify the size.
|
||||
font.setPointSizeF(font.pointSizeF() + 1);
|
||||
|
||||
auto tabs = wid->findChildren<QTableWidget*>();
|
||||
auto tabs = wid->findChildren<QTabWidget*>();
|
||||
for(auto o : tabs)
|
||||
{
|
||||
o->setFont(font);
|
||||
o->setFont(font);
|
||||
}
|
||||
|
||||
auto groups = wid->findChildren<QGroupBox*>();
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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<QToolButton*>();
|
||||
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
|
||||
|
||||
@@ -27,15 +27,15 @@
|
||||
#include <utility>
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
#include <QWidget>
|
||||
#include <QPushButton>
|
||||
#include <QVector>
|
||||
#include <QToolButton>
|
||||
#include <QLabel>
|
||||
|
||||
#include <libsigrok.h>
|
||||
|
||||
#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();
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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": "字体大小"
|
||||
}
|
||||
]
|
||||
@@ -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"
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user