mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-02-02 13:52:55 +08:00
font size list for each operation system
This commit is contained in:
parent
abcab0949b
commit
3312a13906
@ -123,6 +123,7 @@ static void _loadApp(AppOptions &o, QSettings &st)
|
|||||||
getFiled("swapBackBufferAlways", st, o.swapBackBufferAlways, false);
|
getFiled("swapBackBufferAlways", st, o.swapBackBufferAlways, false);
|
||||||
getFiled("fontSize", st, o.fontSize, 9.0);
|
getFiled("fontSize", st, o.fontSize, 9.0);
|
||||||
getFiled("autoScrollLatestData", st, o.autoScrollLatestData, true);
|
getFiled("autoScrollLatestData", st, o.autoScrollLatestData, true);
|
||||||
|
getFiled("version", st, o.version, 1);
|
||||||
|
|
||||||
o.warnofMultiTrig = true;
|
o.warnofMultiTrig = true;
|
||||||
|
|
||||||
@ -132,6 +133,15 @@ static void _loadApp(AppOptions &o, QSettings &st)
|
|||||||
StringToFormatArray(fmt, o.m_protocolFormats);
|
StringToFormatArray(fmt, o.m_protocolFormats);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float minSize = 0;
|
||||||
|
float maxSize = 0;
|
||||||
|
AppConfig::GetFontSizeRange(&minSize, &maxSize);
|
||||||
|
|
||||||
|
if (o.version == 1 || o.fontSize < minSize || o.fontSize > maxSize)
|
||||||
|
{
|
||||||
|
o.fontSize = (maxSize + minSize) / 2;
|
||||||
|
}
|
||||||
|
|
||||||
st.endGroup();
|
st.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,6 +160,7 @@ static void _saveApp(AppOptions &o, QSettings &st)
|
|||||||
setFiled("swapBackBufferAlways", st, o.swapBackBufferAlways);
|
setFiled("swapBackBufferAlways", st, o.swapBackBufferAlways);
|
||||||
setFiled("fontSize", st, o.fontSize);
|
setFiled("fontSize", st, o.fontSize);
|
||||||
setFiled("autoScrollLatestData", st, o.autoScrollLatestData);
|
setFiled("autoScrollLatestData", st, o.autoScrollLatestData);
|
||||||
|
setFiled("version", st, APP_CONFIG_VERSION);
|
||||||
|
|
||||||
QString fmt = FormatArrayToString(o.m_protocolFormats);
|
QString fmt = FormatArrayToString(o.m_protocolFormats);
|
||||||
setFiled("protocalFormats", st, fmt);
|
setFiled("protocalFormats", st, fmt);
|
||||||
@ -392,6 +403,28 @@ std::string AppConfig::GetProtocolFormat(const std::string &protocolName)
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AppConfig::GetFontSizeRange(float *minSize, float *maxSize)
|
||||||
|
{
|
||||||
|
assert(minSize);
|
||||||
|
assert(maxSize);
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
*minSize = 7;
|
||||||
|
*maxSize = 12;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef Q_OS_LINUX
|
||||||
|
*minSize = 8;
|
||||||
|
*maxSize = 14;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef Q_OS_DARWIN
|
||||||
|
*minSize = 9;
|
||||||
|
*maxSize = 15;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------api
|
//-------------api
|
||||||
QString GetIconPath()
|
QString GetIconPath()
|
||||||
{
|
{
|
||||||
|
@ -53,8 +53,11 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#define APP_CONFIG_VERSION 3
|
||||||
|
|
||||||
struct AppOptions
|
struct AppOptions
|
||||||
{
|
{
|
||||||
|
bool version;
|
||||||
bool quickScroll;
|
bool quickScroll;
|
||||||
bool warnofMultiTrig;
|
bool warnofMultiTrig;
|
||||||
bool originalData;
|
bool originalData;
|
||||||
@ -149,6 +152,8 @@ public:
|
|||||||
return frameOptions.language == LAN_CN;
|
return frameOptions.language == LAN_CN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void GetFontSizeRange(float *minSize, float *maxSize);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AppOptions appOptions;
|
AppOptions appOptions;
|
||||||
UserHistory userHistory;
|
UserHistory userHistory;
|
||||||
|
@ -87,7 +87,12 @@ void ApplicationParamDlg::bind_font_size_list(QComboBox *box, float size)
|
|||||||
{
|
{
|
||||||
int selDex = -1;
|
int selDex = -1;
|
||||||
|
|
||||||
for(int i=7; i<=12; i++)
|
float minSize = 0;
|
||||||
|
float maxSize = 0;
|
||||||
|
|
||||||
|
AppConfig::GetFontSizeRange(&minSize, &maxSize);
|
||||||
|
|
||||||
|
for(int i=minSize; i<=maxSize; i++)
|
||||||
{
|
{
|
||||||
box->addItem(QString::number(i));
|
box->addItem(QString::number(i));
|
||||||
if (i == size){
|
if (i == size){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user