Skip to content

Commit

Permalink
chore: fix build warnings (#356)
Browse files Browse the repository at this point in the history
fix build warning messages as much as I can
  • Loading branch information
hualet authored Aug 28, 2024
1 parent fa0eeba commit 033bab6
Show file tree
Hide file tree
Showing 21 changed files with 119 additions and 97 deletions.
9 changes: 5 additions & 4 deletions src/customcommand/customcommandoptdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <DCommandLinkButton>
#include <DDialogCloseButton>
#include <DApplicationHelper>
#include <DPaletteHelper>
#include <DGuiApplicationHelper>
#include <DWidgetUtil>
#include <DLog>
Expand Down Expand Up @@ -269,7 +270,7 @@ void CustomCommandOptDlg::initUITitle()
// 字色
DPalette palette = m_titleText->palette();
QColor color;
if (DApplicationHelper::DarkType == DApplicationHelper::instance()->themeType())
if (DGuiApplicationHelper::DarkType == DGuiApplicationHelper::instance()->themeType())
color = QColor::fromRgb(192, 198, 212, 255);
else
color = QColor::fromRgb(0, 26, 46, 255);
Expand Down Expand Up @@ -303,7 +304,7 @@ void CustomCommandOptDlg::initTitleConnections()
{
connect(m_closeButton, &DWindowCloseButton::clicked, this, &CustomCommandOptDlg::slotCloseButtonClicked);
// 字体颜色随主题变化变化
connect(DApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, &CustomCommandOptDlg::slotThemeTypeChanged);
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, &CustomCommandOptDlg::slotThemeTypeChanged);
}

inline void CustomCommandOptDlg::slotCloseButtonClicked()
Expand All @@ -315,7 +316,7 @@ inline void CustomCommandOptDlg::slotThemeTypeChanged(DGuiApplicationHelper::Col
{
DPalette palette = m_titleText->palette();
QColor color;
if (DApplicationHelper::DarkType == themeType)
if (DGuiApplicationHelper::DarkType == themeType)
color = QColor::fromRgb(192, 198, 212, 255);
else
color = QColor::fromRgb(0, 26, 46, 255);
Expand Down Expand Up @@ -491,7 +492,7 @@ void CustomCommandOptDlg::addCancelConfirmButtons()
setTabOrder(m_confirmBtn, m_closeButton);//设置右上角关闭按钮的tab键控制顺序

DVerticalLine *verticalLine = new DVerticalLine(this);
DPalette pa = DApplicationHelper::instance()->palette(verticalLine);
DPalette pa = DPaletteHelper::instance()->palette(verticalLine);
QColor splitColor = pa.color(DPalette::ItemBackground);
pa.setBrush(DPalette::Background, splitColor);
verticalLine->setPalette(pa);
Expand Down
7 changes: 4 additions & 3 deletions src/customcommand/customcommandsearchrstpanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "mainwindow.h"

#include <DApplicationHelper>
#include <DPaletteHelper>
#include <DMessageBox>

#include <QAction>
Expand Down Expand Up @@ -46,7 +47,7 @@ void CustomCommandSearchRstPanel::initUI()
// 字体颜色随主题变化变化
DPalette palette = m_label->palette();
QColor color;
if (DApplicationHelper::DarkType == DApplicationHelper::instance()->themeType())
if (DGuiApplicationHelper::DarkType == DGuiApplicationHelper::instance()->themeType())
color = QColor::fromRgb(192, 198, 212, 102);
else
color = QColor::fromRgb(85, 85, 85, 102);
Expand Down Expand Up @@ -76,7 +77,7 @@ void CustomCommandSearchRstPanel::initUI()
connect(m_cmdListWidget, &ListView::itemClicked, this, &CustomCommandSearchRstPanel::doCustomCommand);
connect(m_backButton, &DIconButton::clicked, this, &CustomCommandSearchRstPanel::showCustomCommandPanel);
// 字体颜色随主题变化变化
connect(DApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, &CustomCommandSearchRstPanel::handleThemeTypeChanged);
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, &CustomCommandSearchRstPanel::handleThemeTypeChanged);

connect(m_rebackButton, &IconButton::focusOut, this, &CustomCommandSearchRstPanel::handleIconButtonFocusOut);

Expand All @@ -87,7 +88,7 @@ inline void CustomCommandSearchRstPanel::handleThemeTypeChanged(DGuiApplicationH
{
DPalette palette = m_label->palette();
QColor color;
if (DApplicationHelper::DarkType == themeType)
if (DGuiApplicationHelper::DarkType == themeType)
color = QColor::fromRgb(192, 198, 212, 102);
else
color = QColor::fromRgb(85, 85, 85, 102);
Expand Down
7 changes: 4 additions & 3 deletions src/encodeplugin/encodelistview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

//dtk
#include <DLog>
#include <DPaletteHelper>

//qt
#include <QScrollBar>
Expand Down Expand Up @@ -272,14 +273,14 @@ void EncodeDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opt,
// 悬浮状态
if (option.state & QStyle::State_MouseOver) {
/*** mod begin by ut001121 zhangmeng 20200729 鼠标悬浮在编码插件时使用突出背景处理 修复BUG40078***/
DPalette pa = DApplicationHelper::instance()->palette(m_parentView);
DPalette pa = DPaletteHelper::instance()->palette(m_parentView);
DStyleHelper styleHelper;
QColor fillColor = styleHelper.getColor(static_cast<const QStyleOption *>(&option), pa, DPalette::ObviousBackground);
/*** mod end by ut001121 zhangmeng 20200729***/
painter->setBrush(QBrush(fillColor));
painter->fillPath(path, fillColor);
} else {
DPalette pa = DApplicationHelper::instance()->palette(m_parentView);
DPalette pa = DPaletteHelper::instance()->palette(m_parentView);
DStyleHelper styleHelper;
QColor fillColor = styleHelper.getColor(static_cast<const QStyleOption *>(&option), pa, DPalette::ItemBackground);
painter->setBrush(QBrush(fillColor));
Expand Down Expand Up @@ -308,7 +309,7 @@ void EncodeDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opt,
// mod by ut001121 zhangmeng 20200731 有效效焦点原因下绘制边框 修复BUG40390
if ((option.state & QStyle::State_Selected) && (focusReason != INVALID_FOCUS_REASON)) {
QPen framePen;
DPalette pax = DApplicationHelper::instance()->palette(m_parentView);
DPalette pax = DPaletteHelper::instance()->palette(m_parentView);
if (option.state & QStyle::State_Selected) {
painter->setOpacity(1);
framePen = QPen(pax.color(DPalette::Highlight), 2);
Expand Down
69 changes: 28 additions & 41 deletions src/main/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,10 +458,10 @@ bool MainWindow::hasRunningProcesses()
//没有校验当前tab中是否有其它正在执行的分屏
if (tabPage->runningTerminalCount() != 0) {
/******** Modify by nt001000 renfeixiang 2020-05-28:修改 判断当前tab中是否有其它分屏正在执行 End***************/
qInfo() << "here are processes running in this terminal tab... " << tabPage->identifier() << endl;
qInfo() << "here are processes running in this terminal tab... " << tabPage->identifier();
return true;
} else {
qInfo() << "no processes running in this terminal tab... " << tabPage->identifier() << endl;
qInfo() << "no processes running in this terminal tab... " << tabPage->identifier();
}
}

Expand Down Expand Up @@ -860,7 +860,7 @@ void MainWindow::closeEvent(QCloseEvent *event)
if ((!m_hasConfirmedClose) && (runningCount != 0)) {
// 如果不能马上关闭,并且还在没有最小化.
if ((runningCount != 0) && isMinimized()) {
qInfo() << "isMinimized........... " << endl;
qInfo() << "isMinimized........... ";
setWindowState((windowState() & ~Qt::WindowMinimized) | Qt::WindowActive);
}

Expand Down Expand Up @@ -929,8 +929,9 @@ QString MainWindow::getConfigWindowState()

QSize MainWindow::halfScreenSize()
{
int w = qApp->desktop()->availableGeometry().width();
int h = qApp->desktop()->availableGeometry().height();
QScreen *screen = QGuiApplication::screenAt(QCursor::pos());
int w = screen->availableGeometry().width();
int h = screen->availableGeometry().height();

QSize size;
//开启窗管特效时会有1px的border
Expand Down Expand Up @@ -1069,11 +1070,11 @@ inline void MainWindow::slotShortcutSwitchActivated()
}

if (i - 1 >= m_tabbar->count()) {
qInfo() << "i - 1 > tabcount" << i - 1 << m_tabbar->count() << endl;
qInfo() << "i - 1 > tabcount" << i - 1 << m_tabbar->count();
return;
}

qInfo() << "index" << i - 1 << endl;
qInfo() << "index" << i - 1;
m_tabbar->setCurrentIndex(i - 1);
return;
}
Expand Down Expand Up @@ -2418,26 +2419,17 @@ void QuakeWindow::initTitleBar()

void QuakeWindow::slotWorkAreaResized()
{
qInfo() << "workAreaResized" << QApplication::desktop()->availableGeometry();
/******** Modify by nt001000 renfeixiang 2020-05-20:修改成只需要设置雷神窗口宽度,根据字体高度设置雷神最小高度 Begin***************/
setMinimumWidth(QApplication::desktop()->availableGeometry().width());
resizeByCurrentScreen(true);
setWindowMinHeightForFont();
/******** Add by ut001000 renfeixiang 2020-08-07:workAreaResized时改变大小,bug#41436***************/
updateMinHeight();
/******** Modify by nt001000 renfeixiang 2020-05-20:修改成只需要设置雷神窗口宽度,根据字体高度设置雷神最小高度 End***************/
move(QApplication::desktop()->availableGeometry().x(), QApplication::desktop()->availableGeometry().y());
qInfo() << "size" << size();
setFixedWidth(QApplication::desktop()->availableGeometry().width());
return ;
}

void QuakeWindow::initWindowAttribute()
{
/************************ Add by m000743 sunchengxi 2020-04-27:雷神窗口任务栏移动后位置异常问题 Begin************************/
setWindowRadius(0);
//QRect deskRect = QApplication::desktop()->availableGeometry();//获取可用桌面大小
QDesktopWidget *desktopWidget = QApplication::desktop();
QRect screenRect = desktopWidget->screenGeometry(); //获取设备屏幕大小

Qt::WindowFlags windowFlags = this->windowFlags();
setWindowFlags(windowFlags | Qt::WindowStaysOnTopHint/* | Qt::FramelessWindowHint | Qt::BypassWindowManagerHint*/ /*| Qt::Dialog*/);
//wayland时需要隐藏WindowTitle
Expand All @@ -2448,31 +2440,11 @@ void QuakeWindow::initWindowAttribute()
//add a line by ut001121 zhangmeng 2020-04-27雷神窗口禁用移动(修复bug#22975)
setEnableSystemMove(false);// setAttribute(Qt::WA_Disabled, true);

/******** Modify by m000714 daizhengwen 2020-03-26: 窗口高度超过2/3****************/
setMinimumSize(screenRect.size().width(), 60);
setMaximumHeight(screenRect.size().height() * 2 / 3);
/********************* Modify by m000714 daizhengwen End ************************/
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
// 计算屏幕宽度,设置雷神终端宽度
QList<QScreen *> screenList = qApp->screens();
int w = screenList[0]->geometry().width();
for (auto it = screenList.constBegin(); it != screenList.constEnd(); ++it) {
QRect rect = (*it)->geometry();
if (rect.x() == 0 && rect.y() == 0) {
w = rect.width();
break;
}
}
setFixedWidth(w);
connect(desktopWidget, &QDesktopWidget::workAreaResized, this, &QuakeWindow::slotWorkAreaResized);

int saveHeight = getQuakeHeight();
int saveWidth = screenRect.size().width();
resize(QSize(saveWidth, saveHeight));
// 记录雷神高度
m_quakeWindowHeight = saveHeight;
move(QApplication::primaryScreen()->availableGeometry().x(), QApplication::primaryScreen()->availableGeometry().y());
/************************ Add by m000743 sunchengxi 2020-04-27:雷神窗口任务栏移动后位置异常问题 End ************************/
resizeByCurrentScreen(true);
// FIXME(hualet): don't know why, just keep it for now.
getQuakeHeight();

/******** Add by nt001000 renfeixiang 2020-05-20:增加setQuakeWindowMinHeight函数,设置雷神最小高度 Begin***************/
setWindowMinHeightForFont();
Expand Down Expand Up @@ -2700,6 +2672,21 @@ void QuakeWindow::sendWindowForhibitMove(bool forhibit)
reply, reply, 32, 1, &ldata);
}

void QuakeWindow::resizeByCurrentScreen(bool force)
{
QPoint cursorPoint = QCursor::pos();
const QScreen *quakeScreen = QGuiApplication::screenAt(pos());
const QScreen *cursorScreen = QGuiApplication::screenAt(cursorPoint);
if (force || (!isVisible() && quakeScreen->serialNumber() != cursorScreen->serialNumber())) {
int windowWidth = cursorScreen->geometry().width();
move(cursorScreen->geometry().topLeft());
setFixedWidth(windowWidth);
setMinimumHeight(60);
setMaximumHeight(cursorScreen->geometry().height() * 2 / 3);
connect(cursorScreen, &QScreen::availableGeometryChanged, this, &QuakeWindow::slotWorkAreaResized);
}
}

void QuakeWindow::changeEvent(QEvent *event)
{
// 不是激活事件,不处理
Expand Down
2 changes: 2 additions & 0 deletions src/main/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -1110,6 +1110,8 @@ public slots:
* @param forhibit
*/
void sendWindowForhibitMove(bool forhibit);

void resizeByCurrentScreen(bool force);
};

#endif // MAINWINDOW_H
2 changes: 2 additions & 0 deletions src/main/windowsmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ void WindowsManager::quakeWindowShowOrHide()
int windowWidth = cursorScreen->geometry().width();
m_quakeWindow->move(cursorScreen->geometry().topLeft());
m_quakeWindow->setFixedWidth(windowWidth);
m_quakeWindow->setMinimumHeight(60);
m_quakeWindow->setMaximumHeight(cursorScreen->geometry().height() * 2 / 3);
}

//隐藏 则 显示终端
Expand Down
5 changes: 3 additions & 2 deletions src/remotemanage/groupconfigoptdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include <DSuggestButton>
#include <DVerticalLine>
#include <DPaletteHelper>

GroupConfigOptDlg::GroupConfigOptDlg(const QString &groupName, QWidget *parent)
: DAbstractDialog(false, parent),
Expand All @@ -48,7 +49,7 @@ GroupConfigOptDlg::GroupConfigOptDlg(const QString &groupName, QWidget *parent)
// 字色
DPalette palette = m_titleLabel->palette();
QColor color;
if (DApplicationHelper::DarkType == DApplicationHelper::instance()->themeType())
if (DGuiApplicationHelper::DarkType == DGuiApplicationHelper::instance()->themeType())
color = QColor::fromRgb(192, 198, 212, 255);
else
color = QColor::fromRgb(0, 26, 46, 255);
Expand Down Expand Up @@ -91,7 +92,7 @@ GroupConfigOptDlg::GroupConfigOptDlg(const QString &groupName, QWidget *parent)
});
Utils::setSpaceInWord(pCancelButton);
Utils::setSpaceInWord(pAddSaveButton);
DPalette pa = DApplicationHelper::instance()->palette(pAddSaveButton);
DPalette pa = DPaletteHelper::instance()->palette(pAddSaveButton);
QBrush brush = pa.textLively().color();
pa.setBrush(DPalette::ButtonText, brush);
pAddSaveButton->setPalette(pa);
Expand Down
7 changes: 4 additions & 3 deletions src/remotemanage/remotemanagementsearchpanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "mainwindow.h"

#include <DApplicationHelper>
#include <DPaletteHelper>

#include <QKeyEvent>
#include <QApplication>
Expand Down Expand Up @@ -41,7 +42,7 @@ void RemoteManagementSearchPanel::initUI()
// 字体颜色随主题变化而变化
DPalette palette = m_label->palette();
QColor color;
if (DApplicationHelper::DarkType == DApplicationHelper::instance()->themeType())
if (DGuiApplicationHelper::DarkType == DGuiApplicationHelper::instance()->themeType())
color = QColor::fromRgb(192, 198, 212, 102);
else
color = QColor::fromRgb(85, 85, 85, 102);
Expand Down Expand Up @@ -73,7 +74,7 @@ void RemoteManagementSearchPanel::initUI()
connect(ServerConfigManager::instance(), &ServerConfigManager::refreshList, this, &RemoteManagementSearchPanel::onRefreshList);
connect(m_listWidget, &ListView::focusOut, this, &RemoteManagementSearchPanel::handleListViewFocusOut);
// 字体颜色随主题变化变化
connect(DApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, &RemoteManagementSearchPanel::handleThemeTypeChanged);
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, &RemoteManagementSearchPanel::handleThemeTypeChanged);
}

inline void RemoteManagementSearchPanel::handleListViewFocusOut(Qt::FocusReason type)
Expand All @@ -96,7 +97,7 @@ inline void RemoteManagementSearchPanel::handleThemeTypeChanged(DGuiApplicationH
{
DPalette palette = m_label->palette();
QColor color;
if (DApplicationHelper::DarkType == themeType)
if (DGuiApplicationHelper::DarkType == themeType)
color = QColor::fromRgb(192, 198, 212, 102);
else
color = QColor::fromRgb(85, 85, 85, 102);
Expand Down
11 changes: 8 additions & 3 deletions src/remotemanage/remotemanagementtoppanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ void RemoteManagementTopPanel::showPrevPanel()
// 动画效果 要显示的界面
QPropertyAnimation *animation1 = nullptr;
switch (prevType) {
case ServerConfigManager::PanelType_Manage:
case ServerConfigManager::PanelType_Manage: {
// 刷新主界面
m_remoteManagementPanel->refreshPanel();
// 显示主界面
Expand All @@ -238,7 +238,8 @@ void RemoteManagementTopPanel::showPrevPanel()
animation1 = new QPropertyAnimation(m_remoteManagementPanel, "geometry");
connect(animation1, &QPropertyAnimation::finished, animation1, &QPropertyAnimation::deleteLater);
break;
case ServerConfigManager::PanelType_Group:
}
case ServerConfigManager::PanelType_Group: {
// 刷新分组列表
m_serverConfigGroupPanel->refreshData(m_group);
// 显示分组
Expand All @@ -247,6 +248,7 @@ void RemoteManagementTopPanel::showPrevPanel()
animation1 = new QPropertyAnimation(m_serverConfigGroupPanel, "geometry");
connect(animation1, &QPropertyAnimation::finished, animation1, &QPropertyAnimation::deleteLater);
break;
}
case ServerConfigManager::PanelType_Search: {
// 刷新列表 => 搜索框能被返回,只能是全局搜索
if (m_filterStack.isEmpty()) {
Expand All @@ -264,8 +266,9 @@ void RemoteManagementTopPanel::showPrevPanel()
// 动画效果的设置
animation1 = new QPropertyAnimation(m_remoteManagementSearchPanel, "geometry");
connect(animation1, &QPropertyAnimation::finished, animation1, &QPropertyAnimation::deleteLater);
break;
}
break;
case ServerConfigManager::PanelType_Serverlist: { break; }
}
if (nullptr == animation || nullptr == animation1) {
qInfo() << "do not has animation";
Expand Down Expand Up @@ -328,6 +331,8 @@ void RemoteManagementTopPanel::setPanelShowState(ServerConfigManager::PanelType
case ServerConfigManager::PanelType_Search:
m_remoteManagementSearchPanel->m_isShow = true;
break;
case ServerConfigManager::PanelType_Serverlist:
break;
}
}

Expand Down
Loading

0 comments on commit 033bab6

Please sign in to comment.