Merge pull request #81 from mammonsama666/0114-dev

Fix bus of frontend.
This commit is contained in:
iaom 2021-01-14 10:31:33 +08:00 committed by GitHub
commit c62fff805b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 44 deletions

View File

@ -158,6 +158,15 @@ int ContentWidget::currentPage() {
*/
void ContentWidget::refreshSearchList(const QVector<int>& types, const QVector<QStringList>& lists, const QString& keyword) {
if (!m_listLyt->isEmpty()) {
if (m_fileListView) {
m_fileListView->clear();
}
if (m_dirListView) {
m_dirListView->clear();
}
if (m_contentListView) {
m_contentListView->clear();
}
clearLayout(m_listLyt);
m_resultList->setFixedHeight(0);
}
@ -396,15 +405,6 @@ QString ContentWidget::getTitleName(const int& type) {
* @param layout
*/
void ContentWidget::clearLayout(QLayout * layout) {
if (m_fileListView) {
m_fileListView->clear();
}
if (m_dirListView) {
m_dirListView->clear();
}
if (m_contentListView) {
m_contentListView->clear();
}
m_contentList.clear();
if (! layout) return;
QLayoutItem * child;

View File

@ -58,7 +58,6 @@ bool ConfigFile::writeRecently(QString message){
recently.insert(0,message);
m_qSettings->beginGroup("Recently");
qWarning()<<m_qSettings->value("Recently").toStringList().length();
if (m_qSettings->value("Recently").toStringList().length() >= 20) {
m_qSettings->setValue("Recently",QStringList(recently.mid(0, 20)));
} else {

View File

@ -34,20 +34,14 @@ void HomePageItem::setupUi(const int& type, const QString& path) {
case SearchListView::ResType::Content:
case SearchListView::ResType::Dir:
case SearchListView::ResType::File: {
QProcess * process = new QProcess;
process->start(QString("xdg-open %1").arg(path));
connect(process, static_cast<void(QProcess::*)(int,QProcess::ExitStatus)>(&QProcess::finished), this, [ = ]() {
process->deleteLater();
});
QProcess process;
process.start(QString("xdg-open %1").arg(path));
break;
}
case SearchListView::ResType::Setting: {
//打开控制面板对应页面
QProcess * process = new QProcess;
process->start(QString("ukui-control-center --%1").arg(path.left(path.indexOf("/")).toLower()));
connect(process, static_cast<void(QProcess::*)(int,QProcess::ExitStatus)>(&QProcess::finished), this, [ = ]() {
process->deleteLater();
});
QProcess process;
process.start(QString("ukui-control-center --%1").arg(path.left(path.indexOf("/")).toLower()));
break;
}
default:

View File

@ -65,13 +65,13 @@ QString SearchDetailView::getHtmlText(const QString & text, const QString & keyw
if ((keyword.toUpper()).contains(QString(text.at(i)).toUpper())) {
if (! boldOpenned) {
boldOpenned = true;
htmlString.append(QString("<b>"));
htmlString.append(QString("<b><font size=\"4\">"));
}
htmlString.append(QString(text.at(i)));
} else {
if (boldOpenned) {
boldOpenned = false;
htmlString.append(QString("</b>"));
htmlString.append(QString("</font></b>"));
}
htmlString.append(QString(text.at(i)));
}
@ -251,21 +251,15 @@ bool SearchDetailView::openAction(const int& type, const QString& path) {
case SearchListView::ResType::Content:
case SearchListView::ResType::Dir:
case SearchListView::ResType::File: {
QProcess * process = new QProcess;
process->start(QString("xdg-open %1").arg(path));
connect(process, static_cast<void(QProcess::*)(int,QProcess::ExitStatus)>(&QProcess::finished), this, [ = ]() {
process->deleteLater();
});
QProcess process;
process.start(QString("xdg-open %1").arg(path));
return true;
break;
}
case SearchListView::ResType::Setting: {
//打开控制面板对应页面
QProcess * process = new QProcess;
process->start(QString("ukui-control-center --%1").arg(path.left(path.indexOf("/")).toLower()));
connect(process, static_cast<void(QProcess::*)(int,QProcess::ExitStatus)>(&QProcess::finished), this, [ = ]() {
process->deleteLater();
});
QProcess process;
process.start(QString("ukui-control-center --%1").arg(path.left(path.indexOf("/")).toLower()));
return true;
break;
}
@ -283,7 +277,9 @@ bool SearchDetailView::openAction(const int& type, const QString& path) {
bool SearchDetailView::writeConfigFile(const QString& path) {
if (ConfigFile::writeConfig(path)) {
Q_EMIT this->configFileChanged();
return true;
}
return false;
}
/**
@ -299,11 +295,8 @@ bool SearchDetailView::addDesktopShortcut(const QString& path) {
bool ret = file.copy(QString(dirpath+"/"+desktopfn));
if(ret)
{
QProcess * process = new QProcess;
process->start(QString("chmod a+x %1").arg(newName));
connect(process, static_cast<void(QProcess::*)(int,QProcess::ExitStatus)>(&QProcess::finished), this, [ = ]() {
process->deleteLater();
});
QProcess process;
process.start(QString("chmod a+x %1").arg(newName));
return true;
}
return false;
@ -328,6 +321,7 @@ bool SearchDetailView::addPanelShortcut(const QString& path) {
qDebug()<<"qDebug: Add shortcut to panel successed!";
return true;
}
return false;
}
/**
@ -335,11 +329,8 @@ bool SearchDetailView::addPanelShortcut(const QString& path) {
* @return
*/
bool SearchDetailView::openPathAction(const QString& path) {
QProcess * process = new QProcess;
process->start(QString("xdg-open %1").arg(path.left(path.lastIndexOf("/"))));
connect(process, static_cast<void(QProcess::*)(int,QProcess::ExitStatus)>(&QProcess::finished), this, [ = ]() {
process->deleteLater();
});
QProcess process;
process.start(QString("xdg-open %1").arg(path.left(path.lastIndexOf("/"))));
return true;
}
@ -350,4 +341,5 @@ bool SearchDetailView::openPathAction(const QString& path) {
bool SearchDetailView::copyPathAction(const QString& path) {
QClipboard * clipboard = QApplication::clipboard(); //获取系统剪贴板指针
clipboard->setText(path);
return true;
}

View File

@ -206,7 +206,7 @@ void MainWindow::initUi()
&MainWindow::primaryScreenChangedSlot);
connect(m_searchLayout, &UkuiSearchBarHLayout::textChanged, this, [ = ](QString text) {
if (text == "") {
if (m_search_result_thread->isInterruptionRequested()) {
if (m_search_result_thread->isRunning()) {
m_search_result_thread->requestInterruption();
m_search_result_thread->quit();
}
@ -214,7 +214,7 @@ void MainWindow::initUi()
} else {
m_contentFrame->setCurrentIndex(1);
// QTimer::singleShot(50,this,[=](){
if (! m_search_result_thread->isInterruptionRequested()) {
if (! m_search_result_thread->isRunning()) {
m_search_result_thread->start();
}
searchContent(text);