Merge pull request #185 from mammonsama666/0319-dev

feat(frontend): Reset geometry for ukui-search.
This commit is contained in:
iaom 2021-03-19 16:21:38 +08:00 committed by GitHub
commit 171d506c3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 26 deletions

View File

@ -6009,7 +6009,7 @@ zhòng 仲
pǐ,pí,bì 仳
wò 仴
wǔ 仵
jiàn,móu
jiàn 件
jià,jiè,jie 价
yǎo,fó 仸
fēng 仹
@ -11099,7 +11099,7 @@ tuō,chǐ 拖
jū,gōu,jǔ,jú 拘
zhuō 拙
pàn,biàn,fèn,fān,pīn 拚
zhāo,qiáo,sháo
zhāo 招
bài 拜
bài 拝
dǐ 拞
@ -12449,7 +12449,7 @@ guā,tiǎn,kuò 栝
kān 栞
bēn,bīng 栟
rěn 栠
xiào,jiào,jiǎo,qiāo
xiào,jiào,jiǎo 校
bǎi 栢
rěn 栣
bìng 栤

View File

@ -6009,7 +6009,7 @@ zhong 仲
pi,bi 仳
wo 仴
wu 仵
mou,jian 件
jian 件
jie,jia 价
fo,yao 仸
feng 仹
@ -11099,7 +11099,7 @@ niu,yu,ao 拗
ju,gou 拘
zhuo 拙
pin,fan,pan,fen,bian 拚
shao,qiao,zhao 招
zhao 招
bai 拜
bai 拝
di 拞
@ -12449,7 +12449,7 @@ kuo,tian,gua 栝
kan 栞
bing,ben 栟
ren 栠
jiao,qiao,xiao 校
jiao,xiao 校
bai 栢
ren 栣
bing 栤

View File

@ -128,12 +128,20 @@ MainWindow::MainWindow(QWidget *parent) :
connect(m_sys_tray_icon,&QSystemTrayIcon::activated,this,[=](QSystemTrayIcon::ActivationReason reason){
if(reason == QSystemTrayIcon::Trigger)
{
clearSearchResult();
this->moveToPanel();
this->show();
this->m_searchLayout->focusIn(); //打开主界面时输入框夺焦,可直接输入
this->raise();
this->activateWindow();
if (!this->isVisible()) {
clearSearchResult();
this->moveToPanel();
this->show();
this->m_searchLayout->focusIn(); //打开主界面时输入框夺焦,可直接输入
this->raise();
this->activateWindow();
} else {
this->hide();
m_contentFrame->closeWebView();
m_search_result_thread->requestInterruption();
m_search_result_thread->quit();
m_seach_app_thread->stop();
}
}
});
}
@ -334,12 +342,15 @@ void MainWindow::moveToPanel()
QDBusConnection::sessionBus());
if (QDBusReply<int>(primaryScreenInterface.call("x")).isValid()) {
QDBusReply<int> x = primaryScreenInterface.call("x");
QDBusReply<int> y = primaryScreenInterface.call("y");
QDBusReply<int> width = primaryScreenInterface.call("width");
QDBusReply<int> height = primaryScreenInterface.call("height");
screenGeometry.setX(x);
screenGeometry.setY(y);
screenGeometry.setWidth(width);
screenGeometry.setHeight(height);
availableGeometry.setX(x);
availableGeometry.setY(y);
availableGeometry.setWidth(width);
availableGeometry.setHeight(height);
}
@ -354,29 +365,20 @@ void MainWindow::moveToPanel()
int position = QDBusReply<int>(interface.call("GetPanelPosition", "position"));
int height = QDBusReply<int>(interface.call("GetPanelPosition", "height"));
int d = 2; //窗口边沿到任务栏距离
int d = 8; //窗口边沿到任务栏距离
if (position == 0) {
//任务栏在下侧
this->move(availableGeometry.x() + availableGeometry.width() - this->width(), screenMainRect.y() + availableGeometry.height() - this->height() - height - d);
this->move(availableGeometry.x() + availableGeometry.width() - this->width() - d, screenMainRect.y() + availableGeometry.height() - this->height() - height - d);
} else if(position == 1) {
//任务栏在上侧
qDebug()<<"任务栏在上侧";
this->move(availableGeometry.x() + availableGeometry.width() - this->width(), screenMainRect.y() + screenGeometry.height() - availableGeometry.height() + height + d);
this->move(availableGeometry.x() + availableGeometry.width() - this->width() - d, screenMainRect.y() + screenGeometry.height() - availableGeometry.height() + height + d);
} else if (position == 2) {
//任务栏在左侧
if (screenGeometry.x() == 0) {//主屏在左侧
this->move(height + d, screenMainRect.y() + screenMainRect.height() - this->height());
} else {//主屏在右侧
this->move(screenMainRect.x() + height + d, screenMainRect.y() + screenMainRect.height() - this->height());
}
this->move(screenGeometry.x() + screenGeometry.width() - availableGeometry.width() + d, screenGeometry.y() + screenGeometry.height() - this->height() - d);
} else if (position == 3) {
//任务栏在右侧
if (screenGeometry.x() == 0) {//主屏在左侧
this->move(screenMainRect.width() - this->width() - height - d, screenMainRect.y() + screenMainRect.height() - this->height());
} else {//主屏在右侧
this->move(screenMainRect.x() + screenMainRect.width() - this->width() - height - d, screenMainRect.y() + screenMainRect.height() - this->height());
}
this->move(screenGeometry.x() + availableGeometry.width() - this->width() - d, screenGeometry.y() + screenGeometry.height() - this->height() - d);
}
}