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

fix: 优化treeland启动慢的问题 #381

Merged
merged 1 commit into from
Dec 13, 2024
Merged
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
1 change: 1 addition & 0 deletions 3rdparty/terminalwidget/lib/encodes/detectcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <QDateTime>
#include <QTextCodec>
#include <exception>
#include <chardet/chardet.h>

#include <stdio.h>

Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/terminalwidget/lib/encodes/detectcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <QString>
#include <QMap>

#include <chardet/chardet.h>

#include <uchardet/uchardet.h>
#include <iconv.h>

Expand Down
31 changes: 6 additions & 25 deletions src/main/service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,41 +192,22 @@ void Service::showHideOpacityAndBlurOptions(bool isShow)

void Service::listenWindowEffectSwitcher()
{
if (nullptr == m_wmSwitcher) {
m_wmSwitcher = new WMSwitcher(WMSwitcherService, WMSwitcherPath, QDBusConnection::sessionBus(), this);
m_wmSwitcher->setObjectName("WMSwitcher");//Add by ut001000 renfeixiang 2020-08-13
connect(m_wmSwitcher, &WMSwitcher::WMChanged, this, &Service::slotWMChanged, Qt::QueuedConnection);
if (!m_mainTerminalIsInitWM) {
connect(DWindowManagerHelper::instance(),&DWindowManagerHelper::hasBlurWindowChanged,this, &Service::slotWMChanged);
m_mainTerminalIsInitWM = true;
}
}

void Service::slotWMChanged(const QString &wmName)
void Service::slotWMChanged()
{
bool isWinEffectEnabled = false;
if (wmName == "deepin wm")
isWinEffectEnabled = true;

bool isWinEffectEnabled = DWindowManagerHelper::instance()->hasBlurWindow();
showHideOpacityAndBlurOptions(isWinEffectEnabled);
emit onWindowEffectEnabled(isWinEffectEnabled);
}

bool Service::isWindowEffectEnabled()
{
QDBusMessage msg = QDBusMessage::createMethodCall(WMSwitcherService, WMSwitcherPath, WMSwitcherService, "CurrentWM");

QDBusMessage response = QDBusConnection::sessionBus().call(msg);
if (response.type() == QDBusMessage::ReplyMessage) {
QList<QVariant> list = response.arguments();
QString wmName = list.first().toString();
if (wmName == "deepin wm") {
qCInfo(mainprocess) << "The window effects is on";
return true;
}
} else {
qCWarning(mainprocess) << "call CurrentWM Fail!" << response.errorMessage();
}

qCWarning(mainprocess) << "The window effects is off";
return false;
return DWindowManagerHelper::instance()->hasBlurWindow();
}

qint64 Service::getEntryTime()
Expand Down
5 changes: 2 additions & 3 deletions src/main/service.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,8 @@ public slots:

/**
* @brief 处理窗口特效打开/关闭时,相关设置项目的显示/隐藏
* @param wmName
*/
void slotWMChanged(const QString &wmName);
void slotWMChanged();

/**
* @brief 自定义主题对话框关闭后的处理
Expand Down Expand Up @@ -264,14 +263,14 @@ public slots:
static Service *g_pService;
DSettingsDialog *m_settingDialog = nullptr;// 设置框 全局唯一显示
CustomThemeSettingDialog *m_customThemeSettingDialog = nullptr;// 自定义主题设置对话框 全局唯一
WMSwitcher *m_wmSwitcher = nullptr;
MainWindow *m_settingOwner = nullptr;// 设置框的所有者
DDialog *m_settingShortcutConflictDialog = nullptr;// 设置框,快捷键冲突弹窗
bool m_isDialogShow = false; // 雷神用来判断是否有弹窗显示
bool m_enable = false; // 是否允许创建新的窗口
QMap<QString, QString> m_shellsMap;
qint64 m_entryTime = 0; // 记录进入的时间,只有创建窗口时,才会来取用这个时间
bool m_mainTerminalIsStarted = false;
bool m_mainTerminalIsInitWM = false;
};

#endif // SERVICE_H
Loading