Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: merge recent changes from master to release/eagle #340

Open
wants to merge 5 commits into
base: release/eagle
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .tx/transifex.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
#
# SPDX-License-Identifier: CC0-1.0
filters:
- filter_type: file
source_file: translations/deepin-log-viewer.ts
file_format: QT
source_language: en_US
translation_files_expression: translations/deepin-log-viewer_<lang>.ts
- filter_type: file
source_file: translations/desktop/desktop.ts
file_format: QT
source_language: en_US
translation_files_expression: translations/desktop/desktop_<lang>.ts
- filter_type: file
source_file: translations/policy/auth/policy.ts
file_format: QT
source_language: en_US
translation_files_expression: translations/policy/auth/policy_<lang>.ts
- filter_type: file
source_file: translations/policy/truncate/policy.ts
file_format: QT
source_language: en_US
translation_files_expression: translations/policy/truncate/policy_<lang>.ts
settings:
pr_branch_name: transifex_update_<br_unique_id>
12 changes: 5 additions & 7 deletions application/filtercontent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

#define BUTTON_WIDTH_MIN 68
#define BUTTON_HEIGHT_MIN 36
#define BUTTON_HEIGHT_MIN_COMPACT 24
#define BUTTON_EXPORT_WIDTH_MIN 142
#define FONT_20_MIN_WIDTH 821
#define FONT_18_MIN_WIDTH 100
Expand Down Expand Up @@ -104,7 +105,7 @@ void FilterContent::initUI()
lvTxt->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
cbx_lv = new LogCombox(this);
cbx_lv->view()->setAccessibleName("combobox_level_view");
cbx_lv->setMinimumSize(QSize(LEVEL_COMBO_WIDTH, BUTTON_HEIGHT_MIN));
cbx_lv->setMinimumWidth(LEVEL_COMBO_WIDTH);
cbx_lv->addItems(QStringList() << DApplication::translate("ComboBox", "All")
<< DApplication::translate("ComboBox", "Emergency")
<< DApplication::translate("ComboBox", "Alert")
Expand All @@ -125,7 +126,7 @@ void FilterContent::initUI()
dnflvTxt->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
cbx_dnf_lv = new LogCombox(this);
cbx_dnf_lv->view()->setAccessibleName("combobox_dnflevel_view");
cbx_dnf_lv->setMinimumSize(QSize(198, BUTTON_HEIGHT_MIN));
cbx_dnf_lv->setMinimumWidth(198);
cbx_dnf_lv->addItem(DApplication::translate("ComboBox", "All"), DNFLVALL);
cbx_dnf_lv->addItem(DApplication::translate("ComboBox", "Super critical"), SUPERCRITICAL);
cbx_dnf_lv->addItem(DApplication::translate("ComboBox", "Critical"), CRITICAL);
Expand All @@ -144,7 +145,7 @@ void FilterContent::initUI()
cbx_app = new LogCombox(this);
cbx_app->view()->setAccessibleName("combobox_app_view");

cbx_app->setMinimumSize(QSize(160, BUTTON_HEIGHT_MIN));
cbx_app->setMinimumWidth(160);
hLayout_app->addWidget(appTxt);
hLayout_app->addWidget(cbx_app, 1);
hLayout_app->setSpacing(6);
Expand All @@ -156,7 +157,7 @@ void FilterContent::initUI()
cbx_submodule = new LogCombox(this);
cbx_submodule->view()->setAccessibleName("combobox_submodule_view");

cbx_submodule->setMinimumSize(QSize(143, BUTTON_HEIGHT_MIN));
cbx_submodule->setMinimumWidth(143);
hLayout_submodule->addWidget(submoduleTxt);
hLayout_submodule->addWidget(cbx_submodule, 1);
hLayout_submodule->setSpacing(6);
Expand All @@ -169,7 +170,6 @@ void FilterContent::initUI()
cbx_status = new LogCombox(this);
cbx_status->view()->setAccessibleName("combobox_status_view");
cbx_status->setMinimumWidth(120);
cbx_status->setMinimumSize(QSize(120, BUTTON_HEIGHT_MIN));
cbx_status->addItems(QStringList() << DApplication::translate("ComboBox", "All") << "OK"
<< "Failed");
hLayout_status->addWidget(statusTxt);
Expand All @@ -183,7 +183,6 @@ void FilterContent::initUI()
typeCbx = new LogCombox(this);
typeCbx->view()->setAccessibleName("combobox_eventtype_view");
typeCbx->setMinimumWidth(120);
typeCbx->setMinimumSize(QSize(120, BUTTON_HEIGHT_MIN));
typeCbx->addItems(QStringList() << DApplication::translate("ComboBox", "All")
<< DApplication::translate("ComboBox", "Login")
<< DApplication::translate("ComboBox", "Boot")
Expand All @@ -198,7 +197,6 @@ void FilterContent::initUI()
auditTypeTxt = new DLabel(DApplication::translate("Label", "Audit Type:"), this);
auditTypeCbx = new LogCombox(this);
auditTypeCbx->setMinimumWidth(120);
auditTypeCbx->setMinimumSize(QSize(120, BUTTON_HEIGHT_MIN));
auditTypeCbx->addItems(QStringList() << DApplication::translate("ComboBox", "All")
<< DApplication::translate("ComboBox", "Identity authentication")
<< DApplication::translate("ComboBox", "Discretionary Access Control")
Expand Down
1 change: 1 addition & 0 deletions application/filtercontent.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class FilterContent : public Dtk::Widget::DFrame
* @param value
*/
void setChangedcomboxstate(bool value);

protected:
// void resizeEvent(QResizeEvent *event) override;
void paintEvent(QPaintEvent *event) override;
Expand Down
5 changes: 3 additions & 2 deletions application/logauththread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1222,8 +1222,9 @@ void LogAuthThread::handleCoredump()
}

// 获取信号名称
int sigId = tmpList[7].toInt();
if ( sigId <= sigList.size()) {
bool isOk = false;
int sigId = tmpList[7].toInt(&isOk);
if (isOk && sigId >= 1 && sigId <= sigList.size()) {
coredumpMsg.sig = sigList[sigId - 1];
} else {
coredumpMsg.sig = tmpList[7];
Expand Down
29 changes: 29 additions & 0 deletions application/logcollectormain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
#define LEFT_LIST_WIDTH 200
DWIDGET_USE_NAMESPACE

const int BUTTON_SIZE = 36;
const int BUTTON_SIZE_COMPACT = 24;

//刷新间隔
static const QString refreshIntervalKey = "base.RefreshInterval";
/**
Expand Down Expand Up @@ -429,6 +432,12 @@
connect(m_topRightWgt, &FilterContent::sigStatusChanged, this, &LogCollectorMain::slotClearInfoandFocus);
//开关机日志下拉框选项切换清空搜索栏
connect(m_topRightWgt, &FilterContent::sigLogtypeChanged, this, &LogCollectorMain::slotClearInfoandFocus);

#ifdef DTKWIDGET_CLASS_DSizeMode
// 紧凑模式信号处理
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::sizeModeChanged, this, &LogCollectorMain::updateSizeMode);
updateSizeMode();
#endif
}

void LogCollectorMain::slotClearInfoandFocus()
Expand All @@ -441,6 +450,26 @@
}
}

void LogCollectorMain::updateSizeMode()
{
int nBtnSize = BUTTON_SIZE;

Check warning on line 455 in application/logcollectormain.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Redundant initialization for 'nBtnSize'. The initialized value is overwritten before it is read.

Check warning on line 455 in application/logcollectormain.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Redundant initialization for 'nBtnSize'. The initialized value is overwritten before it is read.
#ifdef DTKWIDGET_CLASS_DSizeMode
if (DGuiApplicationHelper::isCompactMode())
nBtnSize = BUTTON_SIZE_COMPACT;
else
nBtnSize = BUTTON_SIZE;
#else
nBtnSize = BUTTON_SIZE;
#endif

if (m_exportAllBtn) {
m_exportAllBtn->setFixedSize(QSize(nBtnSize, nBtnSize));
}
if (m_refreshBtn) {
m_refreshBtn->setFixedSize(QSize(nBtnSize, nBtnSize));
}
}

/**
* @brief LogCollectorMain::initShortCut 初始化快捷键
*/
Expand Down
5 changes: 5 additions & 0 deletions application/logcollectormain.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ public slots:
*/
void slotClearInfoandFocus();

private slots:
/**
* @brief 根据布局模式(紧凑)变更更新界面布局
*/
void updateSizeMode();
protected:
void closeEvent(QCloseEvent *event);

Expand Down
28 changes: 28 additions & 0 deletions application/loglistview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <QShortcut>
#include <QAbstractButton>
#define ITEM_HEIGHT 40
#define ITEM_HEIGHT_COMPACT 24
#define ITEM_WIDTH 108
#define ICON_SIZE 16

Expand Down Expand Up @@ -136,6 +137,12 @@ LogListView::LogListView(QWidget *parent)
});

connect(LogApplicationHelper::instance(), &LogApplicationHelper::sigValueChanged, this, &LogListView::slot_valueChanged_dConfig_or_gSetting);

#ifdef DTKWIDGET_CLASS_DSizeMode
// 紧凑模式信号处理
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::sizeModeChanged, this, &LogListView::updateSizeMode);
updateSizeMode();
#endif
}

/**
Expand Down Expand Up @@ -613,3 +620,24 @@ void LogListView::slot_valueChanged_dConfig_or_gSetting(const QString &key)
}
}
}

void LogListView::updateSizeMode()
{
int nItemHeight = ITEM_HEIGHT;
#ifdef DTKWIDGET_CLASS_DSizeMode
if (DGuiApplicationHelper::isCompactMode())
nItemHeight = ITEM_HEIGHT_COMPACT;
else
nItemHeight = ITEM_HEIGHT;
#else
nItemHeight = ITEM_HEIGHT;
#endif

if (m_pModel) {
int nCount = m_pModel->rowCount();
for (int i = 0; i < nCount; i++) {
QStandardItem* item = m_pModel->item(i);
item->setSizeHint(QSize(ITEM_WIDTH, nItemHeight));
}
}
}
5 changes: 5 additions & 0 deletions application/loglistview.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ public slots:
void requestshowRightMenu(const QPoint &pos);
void slot_valueChanged_dConfig_or_gSetting(const QString &key);

private slots:
/**
* @brief 根据布局模式(紧凑)变更更新界面布局
*/
void updateSizeMode();
protected:
void paintEvent(QPaintEvent *event) override;
void currentChanged(const QModelIndex &current, const QModelIndex &previous) override;
Expand Down
33 changes: 32 additions & 1 deletion application/logviewheaderview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include <DStyle>

static const int kSpacingMargin = 4;
#define ROW_HEIGHT 36
#define ROW_HEIGHT_COMPACT 24

LogViewHeaderView::LogViewHeaderView(Qt::Orientation orientation, QWidget *parent)
: DHeaderView(orientation, parent)
Expand All @@ -27,6 +29,12 @@ LogViewHeaderView::LogViewHeaderView(Qt::Orientation orientation, QWidget *paren
setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);
setFixedHeight(37);
setFocusPolicy(Qt::NoFocus);

#ifdef DTKWIDGET_CLASS_DSizeMode
// 紧凑模式信号处理
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::sizeModeChanged, this, &LogViewHeaderView::updateSizeMode);
updateSizeMode();
#endif
}

LogViewHeaderView::~LogViewHeaderView()
Expand Down Expand Up @@ -191,7 +199,16 @@ void LogViewHeaderView::paintEvent(QPaintEvent *event)

QSize LogViewHeaderView::sizeHint() const
{
return QSize(width(), 36 + m_spacing);
int nRowHeight = ROW_HEIGHT;
#ifdef DTKWIDGET_CLASS_DSizeMode
if (DGuiApplicationHelper::isCompactMode())
nRowHeight = ROW_HEIGHT_COMPACT;
else
nRowHeight = ROW_HEIGHT;
#else
nRowHeight = ROW_HEIGHT;
#endif
return QSize(width(), nRowHeight + m_spacing);
}
/**
* @brief LogViewHeaderView::sectionSizeHint 根据是否有排序箭头返回逻辑字段合适的尺寸
Expand All @@ -216,3 +233,17 @@ int LogViewHeaderView::sectionSizeHint(int logicalIndex) const
return fm.width(buf) + margin * 2;
}
}

void LogViewHeaderView::updateSizeMode()
{
int nRowHeight = ROW_HEIGHT;
#ifdef DTKWIDGET_CLASS_DSizeMode
if (DGuiApplicationHelper::isCompactMode())
nRowHeight = ROW_HEIGHT_COMPACT;
else
nRowHeight = ROW_HEIGHT;
#else
nRowHeight = ROW_HEIGHT;
#endif
setFixedHeight(nRowHeight);
}
5 changes: 5 additions & 0 deletions application/logviewheaderview.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ class LogViewHeaderView : public DHeaderView
inline int getSpacing() const { return m_spacing; }
inline void setSpacing(int spacing) { m_spacing = spacing; }

private slots:
/**
* @brief 根据布局模式(紧凑)变更更新界面布局
*/
void updateSizeMode();
protected:
void paintEvent(QPaintEvent *e) override;
virtual void paintSection(QPainter *painter, const QRect &rect,
Expand Down
14 changes: 13 additions & 1 deletion application/logviewitemdelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ DWIDGET_USE_NAMESPACE
#define ICON_WIDTH 24
#define ICON_HEIGHT 24

#define ROW_HEIGHT 38
#define ROW_HEIGHT_COMPACT 26

LogViewItemDelegate::LogViewItemDelegate(QObject *parent)
: QStyledItemDelegate(parent)
{
Expand Down Expand Up @@ -121,7 +124,16 @@ QSize LogViewItemDelegate::sizeHint(const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
QSize size = QStyledItemDelegate::sizeHint(option, index);
size.setHeight(36);
int nRowHeight = ROW_HEIGHT;
#ifdef DTKWIDGET_CLASS_DSizeMode
if (DGuiApplicationHelper::isCompactMode())
nRowHeight = ROW_HEIGHT_COMPACT;
else
nRowHeight = ROW_HEIGHT;
#else
nRowHeight = ROW_HEIGHT;
#endif
size.setHeight(nRowHeight);
return size;
}
/**
Expand Down
Loading