UI: Move ControlUtil::fontBold() to GuiUtil

This commit is contained in:
Nodir Temirkhodjaev 2024-03-11 18:46:37 +03:00
parent 114537d0da
commit 82b1322de5
13 changed files with 32 additions and 26 deletions

View File

@ -33,7 +33,7 @@ void AppInfoRow::setupUi()
m_lineAppPath = ControlUtil::createLineLabel();
m_labelAppProductName = ControlUtil::createLabel();
m_labelAppProductName->setFont(ControlUtil::fontBold());
m_labelAppProductName->setFont(GuiUtil::fontBold());
m_labelAppCompanyName = ControlUtil::createLabel();

View File

@ -315,13 +315,6 @@ QWidget *ControlUtil::wrapToScrollArea(QWidget *content, bool isBgTransparent)
return c;
}
QFont ControlUtil::fontBold()
{
QFont font;
font.setBold(true);
return font;
}
LabelSpinCombo *ControlUtil::createSpinCombo(int v, int min, int max, const QVector<int> &values,
const QString &suffix, const std::function<void(int)> &onValueChanged)
{

View File

@ -95,8 +95,6 @@ public:
static QLayout *createScrollLayout(QLayout *content, bool isBgTransparent = true);
static QWidget *wrapToScrollArea(QWidget *content, bool isBgTransparent = true);
static QFont fontBold();
static LabelSpinCombo *createSpinCombo(int v, int min, int max, const QVector<int> &values,
const QString &suffix, const std::function<void(int value)> &onValueChanged);
static LabelSpin *createSpin(int v, int min, int max, const QString &suffix,

View File

@ -11,6 +11,7 @@
#include <fortmanager.h>
#include <fortsettings.h>
#include <manager/windowmanager.h>
#include <util/guiutil.h>
#include <util/iconcache.h>
HomePage::HomePage(HomeController *ctrl, QWidget *parent) : HomeBasePage(ctrl, parent)
@ -68,7 +69,7 @@ void HomePage::setupDriverBox()
m_labelDriverMessage = ControlUtil::createLabel();
m_labelDriverMessage->setWordWrap(true);
m_labelDriverMessage->setFont(ControlUtil::fontBold());
m_labelDriverMessage->setFont(GuiUtil::fontBold());
setupDriverIcon();

View File

@ -10,6 +10,7 @@
#include <form/controls/plaintextedit.h>
#include <form/controls/zonesselector.h>
#include <manager/windowmanager.h>
#include <util/guiutil.h>
#include <util/ioc/ioccontainer.h>
AddressesColumn::AddressesColumn(QWidget *parent) : QWidget(parent)
@ -41,7 +42,7 @@ void AddressesColumn::setupUi()
QLayout *AddressesColumn::setupHeaderLayout()
{
m_labelTitle = ControlUtil::createLabel();
m_labelTitle->setFont(ControlUtil::fontBold());
m_labelTitle->setFont(GuiUtil::fontBold());
// Use All
m_cbUseAll = new QCheckBox();

View File

@ -27,6 +27,7 @@
#include <form/opt/optionscontroller.h>
#include <fortsettings.h>
#include <user/iniuser.h>
#include <util/guiutil.h>
#include <util/net/netutil.h>
#include <util/textareautil.h>
@ -376,7 +377,7 @@ void ApplicationsPage::setupGroupEnabled()
pageAppGroupSetChecked(this, &AppGroup::setEnabled, checked, /*isFlag=*/true);
});
m_cbGroupEnabled->setFont(ControlUtil::fontBold());
m_cbGroupEnabled->setFont(GuiUtil::fontBold());
}
void ApplicationsPage::setupGroupPeriod()

View File

@ -6,6 +6,7 @@
#include <form/controls/controlutil.h>
#include <form/controls/plaintextedit.h>
#include <util/guiutil.h>
#include <util/iconcache.h>
AppsColumn::AppsColumn(const QString &iconPath, QWidget *parent) : QWidget(parent)
@ -44,7 +45,7 @@ QLayout *AppsColumn::setupHeaderLayout()
m_icon->setMaximumSize(16, 16);
m_labelTitle = ControlUtil::createLabel();
m_labelTitle->setFont(ControlUtil::fontBold());
m_labelTitle->setFont(GuiUtil::fontBold());
m_labelTitle->setFixedHeight(24);
m_btClear =

View File

@ -24,6 +24,7 @@
#include <manager/translationmanager.h>
#include <manager/windowmanager.h>
#include <user/iniuser.h>
#include <util/guiutil.h>
#include <util/iconcache.h>
#include <util/osutil.h>
#include <util/startuputil.h>
@ -601,7 +602,7 @@ void OptionsPage::setupLogBlocked()
}
});
m_cbLogBlocked->setFont(ControlUtil::fontBold());
m_cbLogBlocked->setFont(GuiUtil::fontBold());
}
QLayout *OptionsPage::setupColumn2()

View File

@ -17,6 +17,7 @@
#include <task/taskinfo.h>
#include <task/tasklistmodel.h>
#include <task/taskmanager.h>
#include <util/guiutil.h>
namespace {
@ -145,7 +146,7 @@ void SchedulePage::setupTaskDetails()
void SchedulePage::setupTaskInterval()
{
m_cscTaskInterval = new CheckSpinCombo();
m_cscTaskInterval->checkBox()->setFont(ControlUtil::fontBold());
m_cscTaskInterval->checkBox()->setFont(GuiUtil::fontBold());
m_cscTaskInterval->spinBox()->setRange(1, 24 * 30 * 12); // ~Year
m_cscTaskInterval->setValues(taskIntervalHourValues);

View File

@ -16,6 +16,7 @@
#include <form/controls/labelspin.h>
#include <form/controls/labelspincombo.h>
#include <form/opt/optionscontroller.h>
#include <util/guiutil.h>
#include <util/iconcache.h>
#include <util/net/netutil.h>
@ -213,7 +214,7 @@ void StatisticsPage::setupLogStat()
}
});
m_cbLogStat->setFont(ControlUtil::fontBold());
m_cbLogStat->setFont(GuiUtil::fontBold());
}
void StatisticsPage::setupLogStatNoFilter()
@ -360,7 +361,7 @@ void StatisticsPage::setupLogBlockedIp()
}
});
m_cbLogBlockedIp->setFont(ControlUtil::fontBold());
m_cbLogBlockedIp->setFont(GuiUtil::fontBold());
m_cbLogAlertedBlockedIp =
ControlUtil::createCheckBox(conf()->logAlertedBlockedIp(), [&](bool checked) {
@ -403,7 +404,7 @@ void StatisticsPage::setupLogAllowedIp()
}
});
m_cbLogAllowedIp->setFont(ControlUtil::fontBold());
m_cbLogAllowedIp->setFont(GuiUtil::fontBold());
const auto logIpKeepCountList = SpinCombo::makeValuesList(logIpKeepCountValues);
m_lscAllowedIpKeepCount = ControlUtil::createSpinCombo(

View File

@ -1,5 +1,6 @@
#include "rulelistmodel.h"
#include <QFont>
#include <QIcon>
#include <QLoggingCategory>
@ -9,6 +10,7 @@
#include <conf/confmanager.h>
#include <conf/confrulemanager.h>
#include <util/guiutil.h>
#include <util/iconcache.h>
#include <util/ioc/ioccontainer.h>
@ -142,10 +144,6 @@ QVariant RuleListModel::data(const QModelIndex &index, int role) const
// Enabled
case Qt::CheckStateRole:
return dataCheckState(index);
// Row Height
case Qt::SizeHintRole:
return QSize(100, 24);
}
return QVariant();
@ -162,9 +160,9 @@ QVariant RuleListModel::rootData(const QModelIndex &index, int role) const
case Qt::ToolTipRole:
return ruleTypeNames().value(index.row());
// Row Height
case Qt::SizeHintRole:
return QSize(100, 24);
// Font
case Qt::FontRole:
return GuiUtil::fontBold();
}
return QVariant();

View File

@ -61,3 +61,10 @@ QIcon GuiUtil::overlayIcon(
return pixmap;
}
QFont GuiUtil::fontBold()
{
QFont font;
font.setBold(true);
return font;
}

View File

@ -1,6 +1,7 @@
#ifndef GUIUTIL_H
#define GUIUTIL_H
#include <QFont>
#include <QIcon>
#include <QVariant>
@ -11,6 +12,8 @@ public:
static QIcon overlayIcon(const QString &basePath, const QString &overlayPath,
Qt::Alignment alignment = Qt::AlignRight | Qt::AlignBottom);
static QFont fontBold();
};
#endif // GUIUTIL_H