Merge pull request #108 from mammonsama666/0126-dev
fix(frontend): Retract button is not reset when get new result.
This commit is contained in:
commit
53882a08ee
|
@ -289,7 +289,7 @@ void ContentWidget::initHomePage() {
|
|||
QStringList recentlyList;
|
||||
recentlyList = map.value("Recently");
|
||||
QStringList quicklyList;
|
||||
quicklyList<<"/usr/share/applications/peony.desktop"<<"/usr/share/applications/ukui-control-center.desktop"<<"Theme/主题/更改壁纸";
|
||||
quicklyList<<"/usr/share/applications/peony.desktop"<<"/usr/share/applications/ukui-control-center.desktop"<<"Background/背景/更改壁纸";
|
||||
lists.append(commonlyList);
|
||||
lists.append(recentlyList);
|
||||
lists.append(quicklyList);
|
||||
|
|
|
@ -16,6 +16,7 @@ ShowMoreLabel::~ShowMoreLabel()
|
|||
|
||||
void ShowMoreLabel::resetLabel()
|
||||
{
|
||||
m_isOpen = false;
|
||||
m_textLabel->setText(tr("Show More..."));
|
||||
}
|
||||
|
||||
|
|
|
@ -198,9 +198,11 @@ int main(int argc, char *argv[])
|
|||
|
||||
MainWindow *w = new MainWindow;
|
||||
QStringList arguments = QCoreApplication::arguments();
|
||||
centerToScreen(w);
|
||||
// centerToScreen(w);
|
||||
w->moveToPanel();
|
||||
|
||||
//使用窗管的无边框策略
|
||||
w->setProperty("useStyleWindowManager", false); //禁用拖动
|
||||
MotifWmHints hints;
|
||||
hints.flags = MWM_HINTS_FUNCTIONS|MWM_HINTS_DECORATIONS;
|
||||
hints.functions = MWM_FUNC_ALL;
|
||||
|
@ -208,6 +210,10 @@ int main(int argc, char *argv[])
|
|||
XAtomHelper::getInstance()->setWindowMotifHint(w->winId(), hints);
|
||||
|
||||
app.setActivationWindow(w);
|
||||
|
||||
if (QString::compare(QString("-s"), QString(QLatin1String(argv[1]))) == 0) {
|
||||
w->show();
|
||||
}
|
||||
// if(arguments.size()>1)
|
||||
// w->searchContent(arguments.at(1));
|
||||
QObject::connect(&app, SIGNAL(messageReceived(const QString&)),w, SLOT(bootOptionsFilter(const QString&)));
|
||||
|
|
|
@ -93,15 +93,15 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
m_search_result_thread = new SearchResult(this);
|
||||
// m_search_result_thread->start();
|
||||
connect(m_search_result_thread, &SearchResult::searchResultFile, this, [ = ](QString path) {
|
||||
// qDebug()<<"Append a file into list: "<<path;
|
||||
qDebug()<<"Append a file into list: "<<path;
|
||||
m_contentFrame->appendSearchItem(SearchItem::SearchType::Files, path);
|
||||
});
|
||||
connect(m_search_result_thread, &SearchResult::searchResultDir, this, [ = ](QString path) {
|
||||
// qDebug()<<"Append a dir into list: "<<path;
|
||||
qDebug()<<"Append a dir into list: "<<path;
|
||||
m_contentFrame->appendSearchItem(SearchItem::SearchType::Dirs, path);
|
||||
});
|
||||
connect(m_search_result_thread, &SearchResult::searchResultContent, this, [ = ](QPair<QString, QStringList> pair) {
|
||||
// qDebug()<<"Append a file content into list: "<<pair.first;
|
||||
qDebug()<<"Append a file content into list: "<<pair.first;
|
||||
m_contentFrame->appendSearchItem(SearchItem::SearchType::Contents, pair.first, pair.second);
|
||||
});
|
||||
|
||||
|
@ -113,6 +113,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
if(reason == QSystemTrayIcon::Trigger)
|
||||
{
|
||||
clearSearchResult();
|
||||
this->moveToPanel();
|
||||
this->show();
|
||||
this->raise();
|
||||
this->activateWindow();
|
||||
|
@ -165,7 +166,8 @@ void MainWindow::initUi()
|
|||
m_menuBtn->setFixedSize(24, 24);
|
||||
// m_menuBtn->setIcon(QIcon(":/res/icons/commonuse.svg"));
|
||||
m_menuBtn->setIcon(QIcon::fromTheme("document-properties-symbolic"));
|
||||
m_menuBtn->setProperty("useIconHighlightEffect", 0x08);
|
||||
m_menuBtn->setProperty("useIconHighlightEffect", 0x2);
|
||||
m_menuBtn->setProperty("isWindowButton", 0x01);
|
||||
m_menuBtn->setFlat(true);
|
||||
connect(m_menuBtn, &QPushButton::clicked, this, [ = ]() {
|
||||
if (m_settingsWidget) { //当此窗口已存在时,仅需置顶
|
||||
|
@ -215,6 +217,9 @@ void MainWindow::initUi()
|
|||
} else {
|
||||
m_contentFrame->setCurrentIndex(1);
|
||||
QTimer::singleShot(10,this,[=](){
|
||||
m_search_result_file->clear();
|
||||
m_search_result_dir->clear();
|
||||
m_search_result_content->clear();
|
||||
if (! m_search_result_thread->isRunning()) {
|
||||
m_search_result_thread->start();
|
||||
}
|
||||
|
@ -235,6 +240,7 @@ void MainWindow::bootOptionsFilter(QString opt)
|
|||
{
|
||||
if (opt == "-s" || opt == "--show") {
|
||||
clearSearchResult();
|
||||
this->moveToPanel();
|
||||
this->show();
|
||||
this->raise();
|
||||
this->activateWindow();
|
||||
|
@ -282,9 +288,9 @@ void MainWindow::searchContent(QString searchcontent){
|
|||
m_app_setting_lists.clear();
|
||||
m_contentFrame->setKeyword(searchcontent);
|
||||
|
||||
m_search_result_file->clear();
|
||||
m_search_result_dir->clear();
|
||||
m_search_result_content->clear();
|
||||
// m_search_result_file->clear();
|
||||
// m_search_result_dir->clear();
|
||||
// m_search_result_content->clear();
|
||||
|
||||
AppMatch * appMatchor = new AppMatch(this);
|
||||
SettingsMatch * settingMatchor = new SettingsMatch(this);
|
||||
|
@ -296,11 +302,72 @@ void MainWindow::searchContent(QString searchcontent){
|
|||
m_app_setting_lists.append(appList);
|
||||
m_app_setting_lists.append(settingList);
|
||||
m_contentFrame->refreshSearchList(m_app_setting_lists);
|
||||
|
||||
|
||||
//文件、文件夹、内容搜索
|
||||
this->m_searcher->onKeywordSearch(searchcontent, m_search_result_file, m_search_result_dir, m_search_result_content);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief MainWindow::moveToPanel 将主界面移动到任务栏旁边(跟随任务栏位置)
|
||||
*/
|
||||
void MainWindow::moveToPanel()
|
||||
{
|
||||
QRect availableGeometry = qApp->primaryScreen()->availableGeometry();
|
||||
QRect screenGeometry = qApp->primaryScreen()->geometry();
|
||||
|
||||
QDesktopWidget * desktopWidget = QApplication::desktop();
|
||||
QRect screenMainRect = desktopWidget->screenGeometry(0);//获取设备屏幕大小
|
||||
|
||||
QDBusInterface interface( "com.ukui.panel.desktop",
|
||||
"/",
|
||||
"com.ukui.panel.desktop",
|
||||
QDBusConnection::sessionBus() );
|
||||
|
||||
int position = QDBusReply<int>(interface.call("GetPanelPosition", "position"));
|
||||
int height = QDBusReply<int>(interface.call("GetPanelPosition", "height"));
|
||||
int d = 2; //窗口边沿到任务栏距离
|
||||
|
||||
if (screenGeometry.width() == availableGeometry.width() && screenGeometry.height() == availableGeometry.height()) {
|
||||
if (position == 0) {
|
||||
//任务栏在下侧
|
||||
this->move(availableGeometry.x() + availableGeometry.width() - this->width(), screenMainRect.y() + availableGeometry.height() - this->height() - height - d);
|
||||
} else if(position == 1) {
|
||||
//任务栏在上侧
|
||||
this->move(availableGeometry.x() + availableGeometry.width() - this->width(), 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());
|
||||
}
|
||||
} 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());
|
||||
}
|
||||
}
|
||||
} else if(screenGeometry.width() == availableGeometry.width() ) {
|
||||
if (m_sys_tray_icon->geometry().y() > availableGeometry.height()/2) {
|
||||
//任务栏在下侧
|
||||
this->move(availableGeometry.x() + availableGeometry.width() - this->width(), screenMainRect.y() + availableGeometry.height() - this->height() - d);
|
||||
} else {
|
||||
//任务栏在上侧
|
||||
this->move(availableGeometry.x() + availableGeometry.width() - this->width(), screenMainRect.y() + screenGeometry.height() - availableGeometry.height() + d);
|
||||
}
|
||||
} else if (screenGeometry.height() == availableGeometry.height()) {
|
||||
if (m_sys_tray_icon->geometry().x() > availableGeometry.width()/2) {
|
||||
//任务栏在右侧
|
||||
this->move(availableGeometry.x() + availableGeometry.width() - this->width() - d, screenMainRect.y() + screenGeometry.height() - this->height());
|
||||
} else {
|
||||
//任务栏在左侧
|
||||
this->move(screenGeometry.width() - availableGeometry.width() + d, screenMainRect.y() + screenGeometry.height() - this->height());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//使用GSetting获取当前窗口应该使用的透明度
|
||||
double MainWindow::getTransparentData()
|
||||
{
|
||||
|
|
|
@ -58,6 +58,7 @@ public:
|
|||
* @brief Load the main window
|
||||
*/
|
||||
void searchContent(QString searchcontent);
|
||||
void moveToPanel();
|
||||
|
||||
private:
|
||||
bool nativeEvent(const QByteArray&, void *, long *);
|
||||
|
|
|
@ -178,7 +178,7 @@
|
|||
<message>
|
||||
<location filename="../../src/settings-widget.cpp" line="101"/>
|
||||
<source>Add ignored folders</source>
|
||||
<translation>添加禁止索引文件夹</translation>
|
||||
<translation>添加文件夹至黑名单</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/settings-widget.cpp" line="122"/>
|
||||
|
|
Loading…
Reference in New Issue