250 lines
12 KiB
Diff
250 lines
12 KiB
Diff
From: lixueman <lixueman@kylinos.cn>
|
|
Date: Mon, 18 Jul 2022 15:21:40 +0800
|
|
Subject: =?utf-8?b?5pu05pawY2hhbmdlbG9n5L+h5oGv?=
|
|
|
|
---
|
|
src/UserInterface/ListView/klistview.cpp | 1 +
|
|
src/UserInterface/Widget/full_function_widget.cpp | 1 +
|
|
src/UserInterface/Widget/full_function_widget.h | 2 ++
|
|
src/UserInterface/Widget/full_letter_widget.cpp | 1 +
|
|
src/UserInterface/Widget/full_letter_widget.h | 2 ++
|
|
src/UserInterface/full_mainwindow.cpp | 23 ++++++++++++++-
|
|
src/UserInterface/full_mainwindow.h | 1 +
|
|
src/UserInterface/mainwindow.cpp | 34 +++++++++++++++++------
|
|
8 files changed, 55 insertions(+), 10 deletions(-)
|
|
|
|
diff --git a/src/UserInterface/ListView/klistview.cpp b/src/UserInterface/ListView/klistview.cpp
|
|
index 96a03e6..8151d04 100755
|
|
--- a/src/UserInterface/ListView/klistview.cpp
|
|
+++ b/src/UserInterface/ListView/klistview.cpp
|
|
@@ -46,6 +46,7 @@ void KListView::onClicked(QModelIndex index)
|
|
if (var.isValid()) {
|
|
QString desktopfp = var.value<QString>();
|
|
execApp(desktopfp);
|
|
+ Q_EMIT sendHideMainWindowSignal();
|
|
}
|
|
}
|
|
|
|
diff --git a/src/UserInterface/Widget/full_function_widget.cpp b/src/UserInterface/Widget/full_function_widget.cpp
|
|
index 253f210..fd124e4 100755
|
|
--- a/src/UserInterface/Widget/full_function_widget.cpp
|
|
+++ b/src/UserInterface/Widget/full_function_widget.cpp
|
|
@@ -210,6 +210,7 @@ void FullFunctionWidget::insertAppList(QStringList desktopfplist)
|
|
listview->addData(m_data);
|
|
connect(listview, &FullListView::sendItemClickedSignal, this, &FullFunctionWidget::execApplication);
|
|
connect(listview, &FullListView::sendHideMainWindowSignal, this, &FullFunctionWidget::sendHideMainWindowSignal);
|
|
+ connect(listview, &FullListView::sendUpdateAppListSignal, this, &FullFunctionWidget::sendUpdateCommonView);
|
|
}
|
|
|
|
/**
|
|
diff --git a/src/UserInterface/Widget/full_function_widget.h b/src/UserInterface/Widget/full_function_widget.h
|
|
index ead61ff..931104c 100755
|
|
--- a/src/UserInterface/Widget/full_function_widget.h
|
|
+++ b/src/UserInterface/Widget/full_function_widget.h
|
|
@@ -195,6 +195,8 @@ Q_SIGNALS:
|
|
|
|
void changeScrollValue(int value, int maximumValue);
|
|
|
|
+ void sendUpdateCommonView();
|
|
+
|
|
};
|
|
|
|
#endif // FULLFUNCTIONWIDGET_H
|
|
diff --git a/src/UserInterface/Widget/full_letter_widget.cpp b/src/UserInterface/Widget/full_letter_widget.cpp
|
|
index 96daac2..45fb165 100755
|
|
--- a/src/UserInterface/Widget/full_letter_widget.cpp
|
|
+++ b/src/UserInterface/Widget/full_letter_widget.cpp
|
|
@@ -210,6 +210,7 @@ void FullLetterWidget::fillAppList()
|
|
listview->addData(m_data);
|
|
connect(listview, &FullListView::sendItemClickedSignal, this, &FullLetterWidget::execApplication);
|
|
connect(listview, &FullListView::sendHideMainWindowSignal, this, &FullLetterWidget::sendHideMainWindowSignal);
|
|
+ connect(listview, &FullListView::sendUpdateAppListSignal, this, &FullLetterWidget::sendUpdateCommonView);
|
|
}
|
|
}
|
|
|
|
diff --git a/src/UserInterface/Widget/full_letter_widget.h b/src/UserInterface/Widget/full_letter_widget.h
|
|
index 5f94658..662408b 100755
|
|
--- a/src/UserInterface/Widget/full_letter_widget.h
|
|
+++ b/src/UserInterface/Widget/full_letter_widget.h
|
|
@@ -197,6 +197,8 @@ Q_SIGNALS:
|
|
void selectFirstItem();
|
|
|
|
void changeScrollValue(int value, int maximumValue);
|
|
+
|
|
+ void sendUpdateCommonView();
|
|
};
|
|
|
|
#endif // FULLLETTERWIDGET_H
|
|
diff --git a/src/UserInterface/full_mainwindow.cpp b/src/UserInterface/full_mainwindow.cpp
|
|
index 4e6ea9a..3c77fd5 100755
|
|
--- a/src/UserInterface/full_mainwindow.cpp
|
|
+++ b/src/UserInterface/full_mainwindow.cpp
|
|
@@ -209,9 +209,12 @@ void FullMainWindow::initConnect()
|
|
connect(this, &FullMainWindow::sendSetFocusToResult, m_fullResultPage, &FullSearchResultWidget::selectFirstItemTab);
|
|
// connect(m_fullSelectMenuButton, &QToolButton::clicked, this, &FullMainWindow::on_fullSelectMenuButton_clicked);
|
|
connect(m_fullCommonPage, &FullCommonUseWidget::sendUpdateOtherView, this, &FullMainWindow::sendUpdateOtherView);
|
|
+ connect(m_fullFunctionPage, &FullFunctionWidget::sendUpdateCommonView, m_fullCommonPage, &FullCommonUseWidget::updateListViewSlot);
|
|
+ connect(m_fullLetterPage, &FullLetterWidget::sendUpdateCommonView, m_fullCommonPage, &FullCommonUseWidget::updateListViewSlot);
|
|
connect(m_fullCommonPage, &FullCommonUseWidget::sendHideMainWindowSignal, this, &FullMainWindow::fullWindowHide);
|
|
connect(m_fullFunctionPage, &FullFunctionWidget::sendHideMainWindowSignal, this, &FullMainWindow::fullWindowHide);
|
|
connect(m_fullLetterPage, &FullLetterWidget::sendHideMainWindowSignal, this, &FullMainWindow::fullWindowHide);
|
|
+ connect(m_fullResultPage, &FullSearchResultWidget::sendHideMainWindowSignal, this, &FullMainWindow::fullWindowHide);
|
|
connect(m_dropDownMenu, &MenuBox::triggered, this, &FullMainWindow::on_fullSelectMenuButton_triggered);
|
|
connect(m_dropDownMenu, &MenuBox::sendMainWinActiveSignal, [ = ]() {
|
|
selectIconAnimation(false);
|
|
@@ -316,7 +319,7 @@ bool FullMainWindow::eventFilter(QObject *watched, QEvent *event)
|
|
if (event->type() == QEvent::KeyPress) {
|
|
QKeyEvent *ke = (QKeyEvent *)event;
|
|
|
|
- if (ke->key() == Qt::Key_Enter || ke->key() == Qt::Key_Return) {
|
|
+ if (ke->key() == Qt::Key_Enter || ke->key() == Qt::Key_Return || ke->key() == Qt::Key_Down) {
|
|
Q_EMIT sendSetFocusToResult();
|
|
}
|
|
}
|
|
@@ -370,6 +373,23 @@ void FullMainWindow::iconAnimationFinished()
|
|
-Style::DropMenuWidth, 45)));
|
|
}
|
|
|
|
+void FullMainWindow::keyPressEvent(QKeyEvent *e)
|
|
+{
|
|
+ if (e->type() == QEvent::KeyPress) {
|
|
+ if ((e->key() >= Qt::Key_0 && e->key() <= Qt::Key_9) || (e->key() >= Qt::Key_A && e->key() <= Qt::Key_Z)) {
|
|
+ qDebug() << "void MainWindow::keyPressEvent(QKeyEvent *e)" << e->text();
|
|
+ m_lineEdit->setFocus();
|
|
+ m_lineEdit->setText(e->text());
|
|
+ }
|
|
+
|
|
+ if (e->key() == Qt::Key_Backspace) {
|
|
+ if (!m_lineEdit->text().isEmpty()) {
|
|
+ m_lineEdit->setText("");
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+}
|
|
+
|
|
void FullMainWindow::selectIconAnimation(const bool &flag)
|
|
{
|
|
iconAnimation = new QPropertyAnimation(m_fullSelectMenuButton, "rotation", this);
|
|
@@ -451,6 +471,7 @@ bool FullMainWindow::event(QEvent *event)
|
|
}
|
|
|
|
if (keyEvent->key() == Qt::Key_Escape) {
|
|
+ m_lineEdit->clear();
|
|
this->hide();
|
|
}
|
|
}
|
|
diff --git a/src/UserInterface/full_mainwindow.h b/src/UserInterface/full_mainwindow.h
|
|
index 34a91ca..9592169 100755
|
|
--- a/src/UserInterface/full_mainwindow.h
|
|
+++ b/src/UserInterface/full_mainwindow.h
|
|
@@ -63,6 +63,7 @@ protected:
|
|
void initLayout();
|
|
void selectIconAnimation(const bool &flag);
|
|
void iconAnimationFinished();
|
|
+ void keyPressEvent(QKeyEvent *e);
|
|
|
|
private:
|
|
QAction *m_allAction = nullptr;
|
|
diff --git a/src/UserInterface/mainwindow.cpp b/src/UserInterface/mainwindow.cpp
|
|
index 4a3f7d9..1f09418 100755
|
|
--- a/src/UserInterface/mainwindow.cpp
|
|
+++ b/src/UserInterface/mainwindow.cpp
|
|
@@ -319,6 +319,7 @@ void MainWindow::initSearchUi()
|
|
m_lineEdit->setStyleSheet(QString::fromUtf8("border-radius: 13px; border:1px solid rgba(5, 151, 255, 1); background: transparent;"));
|
|
m_lineEdit->setFrame(false);
|
|
m_lineEdit->setPlaceholderText(tr("Search"));
|
|
+ m_lineEdit->installEventFilter(this);
|
|
m_cancelSearchPushButton = new QPushButton(m_minSearchPage);
|
|
m_cancelSearchPushButton->setFixedSize(QSize(26, 26));
|
|
// m_cancelSearchPushButton->setStyleSheet(m_buttonStyle.arg("QPushButton"));
|
|
@@ -570,6 +571,7 @@ void MainWindow::initUi()
|
|
connect(m_minFuncListView, &ListView::sendUpdateAppListSignal, this, &MainWindow::updateView);
|
|
connect(m_minLetterListView, &ListView::sendUpdateAppListSignal, this, &MainWindow::updateView);
|
|
connect(m_minSearchResultListView, &ListView::sendUpdateAppListSignal, this, &MainWindow::updateView);
|
|
+ connect(m_collectListView, &RightListView::sendUpdateAppListSignal, this, &MainWindow::updateView);
|
|
connect(m_minAllListView, &ListView::sendCollectViewUpdate, this, &MainWindow::updateCollectView);
|
|
connect(m_minFuncListView, &ListView::sendCollectViewUpdate, this, &MainWindow::updateCollectView);
|
|
connect(m_minSearchResultListView, &ListView::sendCollectViewUpdate, this, &MainWindow::updateCollectView);
|
|
@@ -1012,6 +1014,13 @@ bool MainWindow::eventFilter(QObject *target, QEvent *event)
|
|
}
|
|
}
|
|
|
|
+ if (target == m_lineEdit) {
|
|
+ if (ke->key() == Qt::Key_Down) {
|
|
+ m_minSearchResultListView->setFocus();
|
|
+ return true;
|
|
+ }
|
|
+ }
|
|
+
|
|
if (target == m_minSelectButton) {
|
|
if (ke->key() == Qt::Key_Down) {
|
|
if (m_state == 0) {
|
|
@@ -1099,6 +1108,7 @@ void MainWindow::recvSearchResult(QVector<QStringList> arg)
|
|
m_searchAppThread->quit();
|
|
QVector<QStringList> m_data;
|
|
m_data.clear();
|
|
+ m_minSearchResultListView->verticalScrollBar()->setSliderPosition(0);
|
|
m_minSearchResultListView->addData(m_data, 3);
|
|
|
|
Q_FOREACH (QStringList appinfo, arg) {
|
|
@@ -1240,14 +1250,16 @@ void MainWindow::on_minMaxChangeButton_clicked()
|
|
m_canHide = true;
|
|
m_isFullScreen = true;
|
|
|
|
- m_animationPage->show();
|
|
if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) {
|
|
- kdk::WindowManager::setGeometry(m_animationPage->windowHandle(), QRect(this->x(), this->y(), Style::minw, Style::minh));
|
|
+ m_maxAnimation->setDuration(1);
|
|
} else {
|
|
+ m_animationPage->show();
|
|
m_animationPage->setGeometry(this->x(), this->y(), Style::minw, Style::minh);
|
|
+ m_animationPage->raise();
|
|
+ m_animationPage->repaint();
|
|
+ m_maxAnimation->setDuration(260);
|
|
}
|
|
- m_animationPage->raise();
|
|
- m_animationPage->repaint();
|
|
+
|
|
QEventLoop loop;
|
|
QTimer::singleShot(100, &loop, SLOT(quit()));
|
|
loop.exec();
|
|
@@ -1255,7 +1267,7 @@ void MainWindow::on_minMaxChangeButton_clicked()
|
|
// m_maxAnimation->setStartValue(QRect(Style::m_primaryScreenX, Style::m_primaryScreenY + Style::m_availableScreenHeight - Style::minh, Style::minw, Style::minh));
|
|
m_maxAnimation->setStartValue(QRect(this->x(), this->y(), Style::minw, Style::minh));
|
|
m_maxAnimation->setEndValue(QRect(0, 0, Style::m_availableScreenWidth, Style::m_availableScreenHeight));
|
|
- m_maxAnimation->setDuration(260);
|
|
+
|
|
m_maxAnimation->start();
|
|
this->hide();
|
|
}
|
|
@@ -1354,13 +1366,17 @@ void MainWindow::repaintWidget()
|
|
void MainWindow::showNormalWindowSlot()
|
|
{
|
|
myDebug() << "Style::m_availableScreenWidth" << Style::m_availableScreenWidth << "Style::m_availableScreenHeight" << Style::m_availableScreenHeight;
|
|
- m_animationPage->show();
|
|
+
|
|
if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) {
|
|
- kdk::WindowManager::setGeometry(m_animationPage->windowHandle(), QRect(0, 0, Style::m_availableScreenWidth, Style::m_availableScreenHeight));
|
|
+ m_minAnimation->setDuration(1);
|
|
} else {
|
|
+ m_animationPage->show();
|
|
m_animationPage->setGeometry(0, 0, Style::m_availableScreenWidth, Style::m_availableScreenHeight);
|
|
+ m_animationPage->raise();
|
|
+ m_animationPage->repaint();
|
|
+ m_minAnimation->setDuration(260);
|
|
}
|
|
- m_animationPage->raise();
|
|
+
|
|
myDebug() << m_animationPage->rect();
|
|
QEventLoop loop;
|
|
QTimer::singleShot(100, &loop, SLOT(quit()));
|
|
@@ -1369,7 +1385,7 @@ void MainWindow::showNormalWindowSlot()
|
|
m_minAnimation->setEasingCurve(QEasingCurve::OutExpo);
|
|
m_minAnimation->setStartValue(QRect(0, 0, Style::m_availableScreenWidth, Style::m_availableScreenHeight));
|
|
m_minAnimation->setEndValue(QRect(this->x(), this->y(), Style::minw, Style::minh));
|
|
- m_minAnimation->setDuration(260);
|
|
+
|
|
m_minAnimation->start();
|
|
m_fullWindow->hide();
|
|
}
|